369 Commits
Author SHA1 Message Date
Oleg Isonen 04188dbbf4 feat: CSS Grid UI (#5614)
## 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
2026-03-08 10:52:21 +01:00
Oleg Isonen 9f497a3513 feat: Redirects improvements (#5619)
Show a warning banner when a redirect path matches the current page
path, indicating the redirect will override access to the page.

Changes:
- Add PanelBanner component with warning variant to page settings
- Implement findMatchingRedirect utility to detect redirect conflicts
- Show contextual warning with link to Redirects settings section
- Add comprehensive tests for redirect conflict detection

Code quality:
- Replace 'return undefined' with 'return' per style guide
- Use 'return null' for React components returning nothing
2026-02-19 11:26:07 +01:00
Bogdan Chadkin 942b81b8ff refactor: upgrade colorjs.io to v0.6 and adopt functional API (#5617)
## Summary

Upgrades colorjs.io from v0.5.x to v0.6.x and adopts the new functional
API to fix TypeScript compatibility issues and reduce bundle size.

## Breaking Changes in v0.6

This release includes two major changes from colorjs.io that required
code updates:

1. `null` instead of `NaN` for "none" values — Coordinates now use
`number | null` instead of the custom `Number` instance that previously
used `"none"` strings. This eliminates runtime casting and improves
TypeScript DX.

2. Plain numbers instead of `Number` objects — Coordinates are now plain
number primitives rather than `Number` objects with parsing metadata,
improving performance and bundle size.

## Changes Made

- Upgraded colorjs.io to v0.6.x
- Adopted functional API (`/fn` entry point) for tree-shakeable imports
and reduced bundle size
- Updated coordinate handling to use `number | null` directly instead of
custom `Number` instances with `"none"` values
- Removed runtime casting previously required for TypeScript
compatibility
- Aligned with engramma and hdr-color-input — both already use the
functional style, enabling code deduplication

## Migration Notes

See [colorjs.io v0.6.0 release
notes](https://github.com/color-js/color.js/releases/tag/v0.6.0) for
full details on the breaking changes.
2026-02-16 12:26:56 +03:00
Oleg Isonenandzehjotkah d87142965c feat: Breakpoint simulator (#5608)
## Problem

When defining CSS variables with different values for condition-based
breakpoints (e.g., `prefers-color-scheme:dark` vs
`prefers-color-scheme:light`), designers had no way to preview these
variations without manually changing system preferences.

Example:
```css
:root {
  --primary-color: #000;
  --background: #fff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary-color: #fff;
    --background: #000;
  }
}
```

Previously, testing dark mode required switching OS settings back and
forth.

## Solution

Implements runtime CSS media rule manipulation to simulate
condition-based breakpoints without changing system settings. When a
designer selects a condition-based breakpoint, the simulator dynamically
modifies CSS media rules:

- Matching rules (e.g., `prefers-color-scheme:dark` when dark is
selected) → replaced with `(min-width: 0px)` (always true)
- Non-matching rules → appended with `(max-width: 0px)` (always false)
- Original media queries are stored and restored when switching away

## Features

**Core Functionality:**
- Simulates media query conditions by replacing them with
always-true/false queries
- Supports all condition-based media features (`prefers-color-scheme`,
`prefers-reduced-motion`, etc.)
- Handles both spaced and non-spaced formats

**Performance:**
- Caches media rules by feature to avoid repeated DOM traversal
- Debounces rapid breakpoint changes (50ms)
- Uses WeakMap for automatic memory management

**Robustness:**
- Validates restoration success with warning logs
- Handles CORS-restricted stylesheets gracefully
- Proper cleanup on abort signal with cache clearing

## Technical Implementation

**Key Functions:**
- `parseCondition()` - Parses condition strings
- `getMediaRulesForFeature()` - Caches and retrieves relevant media
rules
- `applySimulation()` - Debounced application of media rule
modifications
- `restoreAllRules()` - Restores original media queries
- `subscribeBreakpointSimulator()` - Integrates with nano-states and
lifecycle

**Integration:**
- Subscribes to `$selectedBreakpoint` nano-state
- Runs in design mode only
- Cleanup via AbortSignal

## Testing Instructions

**Setup:**
1. Create CSS variables with condition-based values
2. Configure breakpoints with conditions (e.g.,
`prefers-color-scheme:light`, `prefers-color-scheme:dark`)

**Test Cases:**
- Select condition-based breakpoint → verify canvas reflects correct
theme without changing OS settings
- Rapidly switch between breakpoints → verify smooth transitions
- Switch to width-based breakpoint → verify original media queries are
restored
- Check console for errors (should only see warnings for legitimate
issues)

## Impact

Designers can now preview dark/light themes and other condition-based
styles instantly without changing system settings, significantly
improving the workflow for building modern, accessible interfaces.

---------

Co-authored-by: zehjotkah <111518041+zehjotkah@users.noreply.github.com>
2026-02-05 22:33:20 +01:00
Oleg Isonen 0d5efb6e0f chore: rename postrest package to postgrest and enable publishing (#5592)
## 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
2026-01-28 21:32:34 +01:00
Oleg Isonen fdee339de0 chore: Migrate to tsgo (#5578) 2026-01-20 17:25:12 +01:00
Oleg Isonen ff2e086632 feat: Convert instance to an instance of a different component (#5522)
Closes https://github.com/webstudio-is/webstudio/issues/5523

## Description

- convert command now shows a list of available components
- along the way cleaned up commands.ts and made namespaced subscribe api
to subscribe for specific actions

## 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-12-16 22:17:18 +01:00
Bogdan Chadkin 7139a35c68 refactor: migrate to colorjs.io (#5463)
colord library we used does not support new color spaces like oklch.
colorjs.io is mature library and handles this stuff just well.
2025-11-26 01:23:24 +03:00
Bogdan Chadkin 02ca084a0c refactor: upgrade to csstree v3 (#5455)
The new version is aware of modern colors and other new css features.
2025-11-23 14:32:12 +03:00
Oleg Isonen dc508445ce feat: Gradients UI (#5449)
## Description

Closes https://github.com/webstudio-is/webstudio/issues/3448

## Todo

- [x] linear gradient
- [x] without stops linear-gradient(red,green)
- [x] delete stops
- [x] support variables
- [x] tweak design
- [x] conic
- [x] one-color
- [x] radial
2025-11-22 14:28:17 +01:00
Bogdan Chadkin f558311897 feat: load data before saving resource variable (#5392)
Ref https://github.com/webstudio-is/webstudio/issues/3691

- new resource loader with queue to avoid bloating network with huge
responses
- data can be loaded for new variable before saving, easier to preview
result



https://github.com/user-attachments/assets/5c26c5a2-fd33-401b-a4d2-a321c34ca083
2025-09-06 17:09:53 +03:00
Bogdan Chadkin 2c461b431b fix: show proper error when dropping a too big file (#5385)
Fixes https://github.com/webstudio-is/webstudio/issues/5326
2025-09-01 01:37:54 +02:00
Bogdan Chadkin f42488a8f0 fix: decode path params in builder (#5382)
User got encoded Cyrillic slugs when tested in builder. Now decoded the
result of URLPattern parsing.
2025-08-25 17:43:32 +02:00
Bogdan Chadkin 76c436ca1e feat: allow changing asset name (#5367)
Ref https://github.com/webstudio-is/webstudio/issues/3262
https://github.com/webstudio-is/webstudio/issues/3272

This solves a couple of issues.

1. Gives a user ability to change name of uploaded asset.
2. strips internal suffix from filenames in UI

<img width="626" height="541" alt="magic_1"
src="https://github.com/user-attachments/assets/f9c91ac8-cc67-4905-9e86-bf0cbbeae14a"
/>
2025-08-10 20:19:15 +02:00
Bogdan Chadkin 6bc16940e0 chore: drop AI from UI (#5344)
Our first AI experiment is barely used. And we don't want our users to
confuse it with upcoming Inception. The next integrated with builder
solution will be based on Inception.
2025-08-03 02:04:26 +02:00
Bogdan Chadkin 3cc2f3be1e feat: improve automatic domain configuration (#5289)
- added official entrijs with types and mimimal runtime (no
dependencies)
- automatically add `www.` prefix to non-cloudflare root domains
- enabled automatic www redirect to setup with entri (though does not
work seamlesly, namecheap requires ssl certificate, godaddy requires
manual setup by user)
- toast error when click on "Configure automatically" on free plan
2025-06-26 15:22:31 +03:00
Bogdan Chadkin de61cffde6 experimental: paste tailwind (#5217)
Ref https://github.com/webstudio-is/webstudio/issues/2651

Added "Paste Html With Tailwind Classes" command.

For now only tailwind 3 is supported.
Also fixed a few issues with css parser.


<img width="547" alt="Screenshot 2025-05-18 at 00 38 01"
src="https://github.com/user-attachments/assets/470b63e0-9b17-4769-8a65-679b90d73a89"
/>
2025-05-23 13:19:04 +03:00
Bogdan Chadkin 0c9b138bba feat: support GitHub flavored markdown paste (#5225)
Markdown paste now generate html elements. This unlocks us supporting
more features:

**strikethrough**

`~~text~~` -> <del>text</del>

**tables**

```
| Header 1   | Header 2   |
|------------|------------|
| Cell 1.1   | Cell 1.2   |
| Cell 2.1   | Cell 2.2   |
```

*autolinks*

```
The link is https://github.com
```

is converted to

```html
<p>This link is <a href="https://github.com">https://github.com</a></p>
```
<img width="559" alt="Screenshot 2025-05-20 at 16 44 53"
src="https://github.com/user-attachments/assets/48508140-9791-47f6-b1c1-3b2946dd5583"
/>

<img width="514" alt="image"
src="https://github.com/user-attachments/assets/dc19e67a-0067-458f-bf3c-64d9b73d02e3"
/>
2025-05-21 01:50:00 +03:00
Bogdan Chadkin 59b6471c4f experimental: support paste html (#5185)
Ref https://github.com/webstudio-is/webstudio/issues/4404

Slightly reworked paste story. Now minimal API to insert html looks like
this

```js
const fragment = generateFragmentFromHtml(html);
insertWebstudioFragmentAt(fragment);
```

- attributes are casted to string, number and boolean types
- text is wrapped with spans when outside of rich text
- unsupported tags are ignored in result



https://github.com/user-attachments/assets/c8072d86-72bd-4446-a26a-e678b193f93e
2025-05-06 13:31:13 +04:00
Bogdan Chadkin 63c54fcad6 refactor: upgrade remix and react-router (#5177)
This should fix a few vulnerabilities we get from react-router and vite
2025-05-02 00:35:20 +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 c8cbf482bf refactor: upgrade to vite 6 (#5172)
Got rid of "module" export condition everywhere.
Seems like it has very poor usage everywhere.
2025-05-01 10:32:18 +04:00
Bogdan Chadkin 452c50a41a refactor: upgrade vite for vitest and storybook (#5165)
Tough cookie. There is a problem with resolving react-remove-scroll,
figured it by reducing allowed amount of server conditions.
2025-04-29 14:17:42 +04:00
Bogdan Chadkin 395a6b9e72 refactor: move embed template into ai (#5148)
To not bloat cli and remove embed template together with legacy ai
eventually.
2025-04-21 12:47:51 +07:00
Bogdan Chadkin b1e373975d build: upgrade react-router and remix (#5106)
- security fixes
https://github.com/remix-run/remix/blob/main/CHANGELOG.md#v2164
- cloudflare support fixes
https://github.com/remix-run/react-router/blob/main/CHANGELOG.md#v750
2025-04-08 21:35:50 +07:00
Bogdan Chadkin d5bc0f9760 feat: enforce html content model (#5074)
Ref https://github.com/webstudio-is/webstudio/issues/3632

This is a big step into native html elements support. I scraped content
model from html spec and now enforcing all html tags structure so we no
longer need to write custom restrictions.

Now paragraph cannot be nested into heading. Box cannot be nested into
span Text though still can in div Text. Any interactive elements cannot
be nested automatically. List item should have a list as direct parent
(collection and slot are exception because they don't have elements
inside).

Most rules are defined in this table
https://html.spec.whatwg.org/multipage/indices.html#elements-3
2025-04-01 22:07:56 +07:00
Bogdan Chadkin 0a6e282a82 fix: prevent dragging folder inside of itself (#5070)
User reported the case which probably bugged us a few times but we could
not figure out why.

Here added guard to prevent reparanting page folder inside of itself or
child folders.
2025-03-29 00:44:30 +07:00
Bogdan Chadkin 7a73f40889 refactor: upgrade react-router and remix (#5067)
Ref
https://github.com/remix-run/react-router/blob/main/CHANGELOG.md#v740
2025-03-28 18:16:31 +07:00
Bogdan Chadkin 945bf04331 experimental: add field label for animation section (#5068)
Added generic field label to give animation labels similar experience to
property labels.
<img width="268" alt="Screenshot 2025-03-28 at 15 30 34"
src="https://github.com/user-attachments/assets/a9d15f03-8e8b-4f9a-8d77-e4b7847de87e"
/>
2025-03-28 17:17:01 +07:00
Bogdan Chadkin ccba8d9581 feat: substitute variables in calc and box-shadow (#5049)
Ref https://github.com/webstudio-is/webstudio/issues/4939

Here improved style engine logic to substitute variables in unparsed
values which is essential in cases like box-shadow or calc with
variables.

<img width="334" alt="Screenshot 2025-03-26 at 02 03 03"
src="https://github.com/user-attachments/assets/7b002061-1e83-48d9-abad-70547d1cdfc0"
/>
<img width="554" alt="Screenshot 2025-03-26 at 01 59 40"
src="https://github.com/user-attachments/assets/85597b72-cc74-4be9-9c32-ddc1b6510131"
/>
2025-03-26 18:11:55 +07:00
Bogdan Chadkin 5b3144d656 refactor: bump zod (#5035)
All three have minor feature updates

- zod
- zod-validation-error
- zod-to-json-schema
2025-03-25 00:17:05 +07:00
Bogdan Chadkin dd08852d43 build: upgrade typescript (#4991)
Upgraded to 5.8 and bumped all type definitions.
Enabled erasable syntax only flag and got rid from one case in
expression editor.
2025-03-13 11:21:00 +07:00
Bogdan Chadkin 935983b543 build: upgrade checks (#4982)
- vitest
- testing-library (got much lighter)
- eslint and plugins (@types/eslint__js no longer necessary)
- storybook
- esbuild
2025-03-11 15:22:57 +07:00
Bogdan Chadkin 16258bb9b5 refactor: bump remix (#4972)
Upgraded legacy remix. The new version got vite 6 support so we could
upgrade it later.
2025-03-10 16:41:01 +07:00
Bogdan Chadkin dc9eb34289 refactor: bump react-router (#4961)
Upgrade react-router to 7.3

Removed unused dependencies in this version
https://github.com/remix-run/react-router/pull/13134
2025-03-07 16:47:59 +07:00
Ivan Starkov 62a6d939d8 experimental: Animate UI (#4851)
## 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-02-24 14:27:50 +05:00
Bogdan Chadkin 23034dad25 feat: add global system variable in builder (#4896)
Closes https://github.com/webstudio-is/webstudio/issues/4166

Now system is global variable and can be accessed in slots.

Legacy one can be deleted

<img width="264" alt="image"
src="https://github.com/user-attachments/assets/1c1d60f5-6be2-4871-9970-3593e3e7c08a"
/>
2025-02-23 01:46:21 +07:00
Bogdan Chadkin 13a4660391 fix: rebind variables after delete (#4865)
Ref https://github.com/webstudio-is/webstudio/issues/4768

Forgot to handle the case with rebinding with parent variables after
variable on child is deleted.

Also fixed the case with rebinding variables outside of slot scope.
2025-02-13 18:00:54 +08:00
Bogdan Chadkin 9e710f4156 refactor: replace ultraflag with @bomb.sh/args (#4857)
The project migrated to the new name.
No changes.
2025-02-11 23:50:18 +08:00
Bogdan Chadkin a03697e208 refactor: bump radix components (#4848)
Ref
https://www.radix-ui.com/primitives/docs/overview/releases#february-5-2025

Two small changes

- add react 19 to peer dependencies (remember that wall of errors?)
- prevent passing props when slot child is fragment
2025-02-11 23:37:35 +08:00
Ivan StarkovandOleg Isonen 3c42f8ca4b experimental: View Animations support (#4817)
## Description

ref  #2645

- [x] - Add view-timeline-name and scroll-timeline-name support, and
prefixer (use custom property for unsupported browsers)
- [x] - Add initial story

## Steps for reproduction


https://6382151c8b47d4399fb9fc69-uljkhwtbmc.chromatic.com/iframe.html?args=&globals=&id=sdk-components-animation-view-animations--in-out&viewMode=story

## 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

---------

Co-authored-by: Oleg Isonen <oleg008@gmail.com>
2025-02-04 06:02:55 +03:00
Bogdan Chadkin 65e9e80025 refactor: split docker template (#4809)
We want to migrate more templates to react-router
so here I split docker template into react-router and
react-router-docker. Image processing, dockerfile and node environment
are left as docker specifics.
2025-01-31 17:55:59 +07:00
Bogdan Chadkin b72a74c825 refactor: bump ui libraries (#4802)
All maintenance or unrelated bulk bumps.

-
https://www.radix-ui.com/primitives/docs/overview/releases#january-22-2025
-
https://github.com/floating-ui/floating-ui/releases/tag/%40floating-ui%2Futils%400.2.9
- https://react-spectrum.adobe.com/releases/2025-01-15.html
2025-01-30 19:58:10 +07:00
Bogdan Chadkin c0b73ba145 feat: save variable/resource even with validation errors (#4798)
Closes https://github.com/webstudio-is/webstudio/issues/4753

Variable validation especially resources shouldn't be too destructive.
User may configure complex resource and get it all wiped out because url
is invalid or header has empty value.

Here I tweaked the logic to require only not duplicated "name" and
everything else is saved even when invalid.

This will not break anything in generation process and will still show
user an error.

<img width="649" alt="Screenshot 2025-01-28 at 14 18 11"
src="https://github.com/user-attachments/assets/0916d250-a864-4362-bf1f-67b6c15024ef"
/>
2025-01-28 21:24:43 +07:00
Bogdan Chadkin bc618d42fe experimental: add missing pieces to docker template (#4783)
- Got rid of peer dependencies warnings
- Added missing files in template
- reduced install time of dependencies
- added docker to init options
2025-01-25 17:56:20 +07:00
Bogdan Chadkin 73767437b6 feat: forbid data variables with the same name on instance (#4771)
Ref https://github.com/webstudio-is/webstudio/issues/4768

We don't want to allow data variables on one instance with the same
name. Though we will allow child variables to mask parent ones in
another PR.


To test:
- create variable var1 on box
- try to create another variable with var1
- create variable var2
- try to rename it to var1
- create variable on body with var1
2025-01-22 19:24:05 +07:00
Bogdan Chadkin 5acb458a68 build: upgrade dev dependencies (#4764)
Nothing critical, all not related to production

storybook 8.5
eslint 9.18
vitest 3
typescript 5.7.3
@types/node 22.10.7
type-fest 4.32
2025-01-21 00:14:56 +07:00
Bogdan Chadkin 3830b40d2c fix: support more curl flags (#4750)
Fixes https://github.com/webstudio-is/webstudio/issues/4661

- support -G to enforce get method and treat data as search params
- post data has application/x-www-form-urlencoded content type by
default
- -u flag allows basic http authentication
- support more data flags like --data-ascii, --data-raw,
--data-urlencode
2025-01-17 12:34:34 +07:00
Bogdan Chadkin ca85eddd2d refactor: add animation package (#4745)
Just an empty one
2025-01-16 13:29:21 +07:00
Bogdan Chadkin db95b55552 refactor: replace date-fns with use-relative-time (#4738)
See https://github.com/nkzw-tech/use-relative-time

We use only single function from date-fns while the package is like
22MB. Here's small alternative for react based on intl.

Added jsx support to ours toasts inside of builder and RelativeTime
component to use it inside of callbacks.
2025-01-11 20:26:16 +07:00