Commit Graph
131 Commits
Author SHA1 Message Date
Oleg Isonen d5aabf8920 chore: Cleanup storybook structure (#5457)
## Description

1. What is this PR about (link the issue and add a short description)

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
0000)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env` file
2025-11-23 20:25:10 +01:00
Oleg Isonen 348a48eae8 fix: Set css states on the right element (#5436)
## Description

Radio group route doesn't have checked/unchecked states via data-state
attribute, only the button and indicator do.

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
0000)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env` file
2025-11-03 14:50:02 +01:00
Bogdan Chadkin 8b60ff7988 feat: infer states from tags in style panel (#5229)
Ref https://github.com/webstudio-is/webstudio/issues/3632

Now states are always inferred from tags. User action states work for
all tags.

<img width="233" alt="Screenshot 2025-05-22 at 19 27 18"
src="https://github.com/user-attachments/assets/f0dc6a07-8a01-4878-950e-61b6e489da7a"
/>
2025-05-22 21:16:40 +03:00
Bogdan Chadkin 88c467c72a fix: make all radix components uncontrolled (#5227)
Here improved handling radix states by making all components
uncontrolled yet still synchronizing external state with local one.
2025-05-21 14:20:40 +03:00
Bogdan Chadkin 0eea205bfc refactor: merge base and animation props with component metas (#5214)
Related https://github.com/webstudio-is/webstudio/pull/5211
2025-05-16 23:31:06 +03:00
Bogdan Chadkin 72345fb1fb refactor: merge radix props with component metas (#5213)
Related https://github.com/webstudio-is/webstudio/pull/5211

We moved html attributes away from props metas and have very little
actual props left in meta. It is safe to merge with component meta to
simplify access in both builder and CLI.

CLI size increase is not very significant

```diff
- 241.92kB
+ 256.64kB
```
2025-05-16 17:55:07 +03:00
Jaya Krishna Namburu 24efd92764 feat: add close button for popover element (#5205)
fixes #3988 

## Description

This PR adds `PopoverClose` button to `Popover` element. Just exported
and added the component from `@radix-ui/popover`. Which is where all the
rest of the elements are being used.

Existing project on staging -
https://p-33460026-be01-4d80-8f4f-1d6677c38fe0-dot-pop-close.staging.webstudio.is
Deployed project on staging - https://jk-popover-close-1ph18.wstd.work


![popover-close](https://github.com/user-attachments/assets/7670dcc7-2afb-4edf-a638-2a32cb48a9e6)

## Steps for reproduction
- You can go to staging, and create a project with popover.
- Deploy the project and checked the rendered popover

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [x] made a self-review

## Before merging

- [x] tested locally and on preview environment (preview dev login:
0000)
2025-05-14 16:44:11 +05:30
Bogdan Chadkin e151c8bfbe refactor: cleanup legacy descriptions (#5175)
Here dropped legacy descriptions generated with AI. All attributes are
using descriptions scraped from html spec. Though many component
properties redefine these attributes without descriptions. So to
workaround just always fall back to attributes descriptions. Covers most
cases.
2025-05-01 17:29:23 +04:00
Bogdan Chadkin 6f792e4aac refactor: bump radix (#5129)
https://www.radix-ui.com/primitives/docs/overview/releases#april-8-2025
2025-05-01 15:49:38 +04:00
Bogdan Chadkin a071280b3d perf: remove html attributes from component metas (#5170)
Now we use html attribute for all components. Now components like Box
with already set "className" property will be migrated to "class"
attribute. This cuts ~350kB in builder scripts. Total ~1MB after
removing both html and aria attributes.

```diff
- 5036    build/client/assets/
+ 4676    build/client/assets/
```

Attributes and properties now have the following order
- component properties
- tag attributes
- global html attributes
- role
- aria attributes
2025-04-30 11:12:42 +04:00
Bogdan Chadkin 414019f823 fix: generate proper rotate variable for accordion (#5168)
Mistyped when refactored with new templates
2025-04-29 11:07:07 +04:00
Bogdan Chadkin 93c00570fd perf: reuse aria attributes between all components (#5160)
Ref https://github.com/webstudio-is/webstudio/issues/3632

We have a universally generated list of aria attributes and can reuse it
instead of generating for every component and bloating our client
bundle.

Now users will have to download ~700kB less javascript when load
builder.

```diff
- 5748    build/client/assets
+ 5036    build/client/assets
```

<img width="299" alt="Screenshot 2025-04-24 at 12 01 46"
src="https://github.com/user-attachments/assets/1faedc01-8f5f-47ad-8601-d17bf5059ea3"
/>
2025-04-24 22:54:51 +07:00
Bogdan Chadkin 21d09cc1f0 refactor: migrate radix to component content model (#5143)
Replaced legacy constraints with component content model in radix
components. Checked all locally.

Removed meta.type for good.
2025-04-19 15:54:48 +07:00
Bogdan Chadkin c5ce5f6313 refactor: move index property to sdk (#5097)
Slowly moving stuff out of react-sdk
2025-04-05 22:50:06 +07:00
Bogdan Chadkin 1dc7af7621 refactor: add tag property control (#5080)
https://github.com/webstudio-is/webstudio/issues/3632

Here added dedicated tag property control which will automatically
migrate Box, Text and Heading components to instance.tag internally and
will be used for ws:element component.

Later will extend tag control with tag descriptions and auto inferring
matching tags.

<img width="428" alt="Screenshot 2025-04-02 at 15 56 46"
src="https://github.com/user-attachments/assets/fa8d24ba-b9e8-4221-b47a-a9e923475bb6"
/>
2025-04-03 11:07:43 +07:00
Bogdan Chadkin a7eff393bb refactor: manually namespace meta (#5073)
Here got rid from auto namespacing meta.constraints and
meta.indexWithinAncestor to unlock using components from other sdk
packages.

Now package prefixes should be explicitly specified in meta though with
the help of proxy.

Though exports are still need to prefix automatically when install
package.
2025-03-31 18:06:38 +07:00
Bogdan Chadkin 0889342c33 refactor: switch to hyphenated preset styles (#4930)
Replaced camel case with kebab in all presets
2025-03-04 17:26:32 +07:00
Bogdan Chadkin 82bc5fb5f0 refactor: drop stylable flag in component meta (#4779)
There is no need in additional flag if we add preset style to every
stylable component already.
2025-01-23 20:15:29 +07:00
Bogdan Chadkin ce34c655bb refactor: generate radix stories from templates (#4733)
Reimplemented generate-stories command in sdk-cli
to not rely on sdk components and load metas
and templates dynamically according to files convention.
2025-01-09 01:31:04 +07:00
Bogdan Chadkin 86defe847f refactor: move component meta to sdk (#4720)
Moved all component meta and embed template to sdk schema. Embed
template generator is left in react-sdk, will probably be removed
eventually.
2025-01-05 23:20:23 +07:00
Bogdan Chadkin 3de8c87a0d refactor: move prop meta schema to sdk (#4718)
PropMeta schema is not specific to react so moved it to agnostic sdk.
2025-01-05 17:54:05 +07:00
Bogdan Chadkin 71f56ea7d6 refactor: bundle webstudio packages in cli (#4706)
Having all webstudio packages as dependency in CLI leads to very long
and bloated install.

Before
<img width="762" alt="Screenshot 2025-01-03 at 19 49 31"
src="https://github.com/user-attachments/assets/96624dae-c72a-4407-83ea-e56ed5d3f7d8"
/>

After
<img width="385" alt="Screenshot 2025-01-03 at 20 00 17"
src="https://github.com/user-attachments/assets/f3271c6e-07ca-47f6-9dfb-491ca68e7caf"
/>

after/before
<img width="633" alt="Screenshot 2025-01-03 at 19 58 15"
src="https://github.com/user-attachments/assets/8273072a-c71e-485c-aa39-116c9698bc8f"
/>
2025-01-04 01:02:13 +07:00
Bogdan Chadkin ee89198084 refactor: drop tailwind from radix package (#4704)
All styles use our css parser, no need to additional abstraction any
more. Theme is handwritten and contains only used stuff.

```diff
- 880 MB
+ 859 MB
```
2025-01-03 16:33:14 +07:00
Bogdan Chadkin be69438303 refactor: rewrite radix navigation menu template with jsx (#4702)
Huge one. And last one.
2025-01-03 14:54:42 +07:00
Bogdan Chadkin b9e20844e5 refactor: rewrite radio group and select templates with jsx (#4697)
- got rid of variables and expressions in template, both use
defaultValue
- returned back radix label in checkbox template
2025-01-02 22:04:33 +07:00
Bogdan Chadkin 517c04850d refactor: rewrite popover and tooltip templates with jsx (#4696)
Very smooth migration
2025-01-02 20:39:40 +07:00
Bogdan Chadkin 830828435a refactor: rewrite collapsible and accordion templates with jsx (#4675)
Css variables in templates are easier to understand now.
2025-01-02 10:46:14 +07:00
Bogdan Chadkin ed36cf852f refactor: rewrite radix switch and checkbox templates with jsx (#4673)
Here avoided using variables and instead made Switch uncontrolled which
should cover most use cases where variables just complicates everything.

Checkbox already works this way.

Both checkbox and switch templates are migrated to jsx.
2024-12-30 14:47:00 +07:00
Bogdan Chadkin ef6e71ac6d refactor: rewrite radix dialog and sheet templates with jsx (#4671)
- dropped radix sheet meta
- added reusable button styles
- added radix dialog and sheet templates
2024-12-29 17:20:36 +07:00
Bogdan Chadkin 6c5711cf2a refactor: rewrite radix tabs template with jsx (#4668)
- support `&[data-state=active]` as state in css parser
- added more theme values
- migrated radix tabs to jsx templates
2024-12-28 18:21:33 +07:00
Bogdan Chadkin 8a89f8e6b2 refactor: rewrite radix label template with jsx (#4665)
- added radix templates to components panel
- support interpolations in css tagged template
- added theme with static values
2024-12-28 16:58:56 +07:00
Bogdan Chadkin a32d6329ed refactor: add templates meta support (#4653)
Here added one more description file for components `*.template.tsx`.

It is decoupled from component meta to fix the issue with some templates
like Sheet being treated as components though we don't have actual
components with this name.

Another reason is have it separately to not include builder specific
code and dependencies into CLI and published websites. Template package
is defined as optional in peer dependencies meta.

In this PR migrated only Button and List as examples. There is still not
support for data sources and styles.

Added support for text placeholders in children
2024-12-25 21:37:15 +07:00
Oleg Isonen 81b67c5dd6 feat: New Icons (#4590)
## Description

- [x] left sidebar tab icons

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
0000)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env` file
2024-12-24 21:17:15 +01:00
Bogdan Chadkin 4f1c4b0452 fix: remove parent/child constraints from navigation menu (#4634)
Looks like parent/child constraints will work only for tags and not for
components.
2024-12-22 01:53:30 +07:00
Bogdan Chadkin 7e414f9c64 fix: stop requiring dialog title and description (#4603)
Ref
https://discord.com/channels/955905230107738152/1318292995023306803/1318292995023306803

Here removed constraints for dialog title and dialog description in
dialog content. Users often delete them though radix starts throwing
warnings about it for a while now.
2024-12-17 16:45:54 +07:00
Bogdan Chadkin cfeb75c876 refactor: replace detachable: false with constraints (#4548)
Here got rid of detachable flag in favor of more universal constraints
queries.

Despite of detachable constraints allow to drag such nodes but limits
drop target more precisely.

Try any radix component.
2024-12-13 00:55:36 +07:00
Ivan Starkov b867e67a91 feat: Experimental INP fix (#4560)
## Description


https://vercel.com/blog/demystifying-inp-new-tools-and-actionable-insights

## new 
https://inp-inp-inp-inp.wstd.work/

## prev
https://no-inp-no-no.wstd.work/

## 20x slowdown new (click)
<img width="323" alt="image"
src="https://github.com/user-attachments/assets/08b063f6-93a3-4e2b-8e5d-e9521f97a40d"
/>
## 20x slowdown new (keyboard)
<img width="305" alt="image"
src="https://github.com/user-attachments/assets/3a1bb563-392f-40d9-9067-7cb085adcedd"
/>


## 20x slowdown old (click)
<img width="308" alt="image"
src="https://github.com/user-attachments/assets/41ff36cd-bd27-4e5d-b569-9040ce12b845"
/>
## 20x slowdown old (keyboard)
<img width="304" alt="image"
src="https://github.com/user-attachments/assets/4cc41ef9-f6d1-4e2a-ad41-de601d713bc9"
/>



## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
0000)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env` file
2024-12-12 16:43:24 +03:00
Ivan Starkov 724dab8f31 fix: Radix components bugs during edit (#4558)
## Description

Also small fix of collapsible calculations.

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
0000)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env` file
2024-12-11 18:14:55 +03:00
Bogdan Chadkin fb2c6b57cc refactor: improve constraints errors (#4535)
Now errors are toasted when insert or paste anything. Legacy constraints
are removed from components.
2024-12-08 21:39:15 +07:00
Bogdan Chadkin ce2babe3d0 refactor: add child and descendant matchers (#4520)
Now we have two more matcher for direct children and descendants.
Eventually they will replace "detachable" flag in meta.

Here used new matchers to prevent user from deleting last tab trigger or
last tab content which cannot be readded from components panel.

Added matchers check to "delete" and "cut"
2024-12-06 16:46:44 +07:00
Bogdan Chadkin 2d3d62ab75 refactor: add new insert constraints (#4499)
Here added new constraints format which will allow us build more
expressive lookups and matchers for internal logic and components
constraints.

For now added only ancestor, parent and self matchers with $eq, $neq,
$in, $nin operations.

Closes https://github.com/webstudio-is/webstudio/issues/2193 "$in"
operation works like "or".
2024-12-04 15:35:55 +07:00
Bogdan Chadkin 641619e4b4 refactor: remove instance selector from component hooks (#4469)
We need to remove reliance on instance selector iteration as much as
possible. In most cases we need only instance key which is a
JSON.stringify or instance selector to access computed props and
variables.

Here got rid of instance selector in component hooks and instead made
api to accept "instance data" with instance id, key and component
inside.
2024-11-29 21:23:24 +07:00
Bogdan Chadkin bdb9860589 refactor: regenerate radix stories (#4256)
After class names change
2024-10-09 16:49:35 +03:00
Bogdan Chadkin bbf37d3e61 refactor: simplify var value fallbacks (#4201)
Ref https://github.com/webstudio-is/webstudio/issues/3399

Initially css variable fallback was defined in schema as array though
it's actually a single value by spec and may contain commas. We don't
have css variables in data yet so should be safe to change schema before
too late.
2024-10-02 18:05:05 +03:00
Oleg Isonen 74420860cb chore: add unused ref to fix the warning (#4062)
## Description

1. What is this PR about (link the issue and add a short description)

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env` file
2024-09-04 13:14:34 +02:00
a0407f3e1f fix: Default form control values (#4045)
## Description

- always use defaultValue and defaultChecked props when passing to react
- expose value and checked as props, remove default*
- reorder initial props to make more sense (name, value, checked - in
this order)

Affected components:

Forms:
- checkbox
- radio
- input
- select
- textarea

Radix:
- checkbox
- radio group
- select
- switch

## Steps for reproduction

1. test each component named above how bound and unbound value/checked
works
2. use in regular form and bind to url params
3. use in webhook form 

## Code Review

- [ ] hi @john, I need you to do
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env` file

---------

Co-authored-by: Ivan Starkov <istarkov@gmail.com>
Co-authored-by: Bogdan Chadkin <opensource@trysound.io>
2024-09-04 00:15:43 +02:00
Bogdan Chadkin 431e58dd34 refactor: rewrite normalize styles with css (#3951)
Our parser is good enough to represent any styles with css. Here
converted normalize styles into css and moved into sdk package.

Also fixed (remix) form component name
2024-08-17 15:00:31 +02:00
Bogdan Chadkin 829d46aed6 refactor: split react-sdk/runtime (#3858)
Here split everything imported from react-sdk by published sites into
separate entry point react-sdk/runtime.

The result in ssg fixture is the following

```diff
-  429788 chunk-CuG10VAj.js
+  370366 chunk-D4NWbWis.js
```
2024-08-02 14:17:42 +02:00
Bogdan Chadkin 8a746f6594 feat: drop data-ws-* attributes (#3806)
Ref https://github.com/webstudio-is/webstudio/issues/3763

We no longer rely on data-ws-id and data-ws-component in generated apps.
Now we get a few benefits

- smaller workers to deploy
- cleaner html to inspect
- generated ssg can be modified directly by user

See generated fixtures

<img width="726" alt="image"
src="https://github.com/user-attachments/assets/59012201-0dce-47f3-aa80-387c77b8f7d6">
2024-07-28 21:30:26 +02:00
Bogdan Chadkin 31bdec9f3b feat: use classes for regular styles (#3796)
Closes https://github.com/webstudio-is/webstudio/issues/3788

Here switched from attribute selector to classes when atomic styles are
disabled. This will let us get rid from data-ws-* attributes in
generated html.
2024-07-26 14:00:20 +02:00