Commit Graph
736 Commits
Author SHA1 Message Date
Bogdan ChadkinandOleg Isonen 21bce61052 feat: support modern color spaces in color inputs (#5465)
Ref https://github.com/webstudio-is/webstudio/issues/3574

Here improved css value parser to parse and store any color space.
oklch(), hsl(), color() and others can be used in any color input. Color
picker converts to rgb on the fly and do not support any other color
space at the moment.

---------

Co-authored-by: Oleg Isonen <oleg008@gmail.com>
2025-12-01 02:34:46 +03:00
Bogdan Chadkin 8d14d1b5e3 refactor: generate modern color syntax (#5456)
Ref
https://github.com/webstudio-is/webstudio/issues/3574#issuecomment-3529164146

Here added ColorValue to styles schema.
toValue now generates modern syntax like rgb(0 0 0 / 0.5) for both color
and rgb values.
2025-11-23 23:26:37 +03:00
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
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 2752bcc786 feat: Support script and style tag when pasting HTML (#5447)
## 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-11 14:26:55 +01:00
Bogdan ChadkinandOleg Isonen 801181c8b6 feat: add project tags in dashboard (#5399)
Ref https://github.com/webstudio-is/webstudio/issues/860





https://github.com/user-attachments/assets/a85b525a-d43b-4361-aa5f-f2158b3c0211

---------

Co-authored-by: Oleg Isonen <oleg008@gmail.com>
2025-11-07 11:33:05 +01:00
zehjotkah 1f2e7a25ee feat: add Current Date resource, system.pathname, and Time component custom formatting (#5434)
Closes https://github.com/webstudio-is/webstudio/issues/3510

## Summary

This PR adds a **Current Date** system resource, extends the `system`
object with a `pathname` property, and enhances the **Time component**
with custom date formatting capabilities to provide more flexibility and
prevent hydration errors.

### Key Features

1. **Current Date System Resource** - Provides normalized date/time
information that prevents React hydration errors
2. **System Pathname** - Adds `pathname` property directly to the
`system` object for easy access in expressions
3. **Time Component Custom Formatting** - Adds a `format` prop with
template tokens for flexible date/time display

## Motivation

These changes solve important use cases:

- **Current Date**: Prevents React hydration errors when displaying
dynamic dates (e.g., copyright years in footers). Previously, using `new
Date()` in expressions would cause server/client mismatch.
- **System Pathname**: Provides easy access to the current page path in
expressions without needing to parse the URL manually.
- **Custom Time Formatting**: Allows users to format dates with simple
templates (e.g., `YYYY-MM-DD`) without being limited to
`Intl.DateTimeFormat` options, and provides a simple way to exclude
specific date or time components to avoid hydration issues.

## Changes

### Current Date Resource
- Created
[`apps/builder/app/shared/$resources/current-date.server.ts`](apps/builder/app/shared/$resources/current-date.server.ts)
- Provides date fields: `year`, `month`, `day`, `iso`, `timestamp`
- All values normalized to midnight UTC (00:00:00.000Z) to prevent
hydration errors
- Registered in
[`rest.resources-loader.ts`](apps/builder/app/routes/rest.resources-loader.ts)
- Added to SystemResourceForm dropdown in UI

### System Pathname
- Added `pathname` property to
[`System`](packages/sdk/src/schema/pages.ts) type
- Updated [`system.ts`](apps/builder/app/shared/system.ts) to compute
and include pathname
- Normalized empty pathname to `'/'` for consistency
- Available in expressions as `system.pathname`

### Time Component Enhancements
- Added [`formatDate()`](packages/sdk-components-react/src/time.tsx:353)
function supporting template tokens:
  - `YYYY`, `YY` - year (4-digit, 2-digit)
  - `MM`, `M` - month (zero-padded, no padding)
  - `DD`, `D` - day (zero-padded, no padding)
  - `HH`, `H` - hours (zero-padded, no padding)
  - `mm`, `m` - minutes (zero-padded, no padding)
  - `ss`, `s` - seconds (zero-padded, no padding)
- Added `format` prop to
[`Time`](packages/sdk-components-react/src/time.tsx:386) component that
overrides `dateStyle`/`timeStyle` when provided
- Updated component logic to check for `format` prop first before
falling back to `Intl.DateTimeFormat`
- Added comprehensive tests for date formatting in
[`time.test.ts`](packages/sdk-components-react/src/time.test.ts)
- Updated component metadata in
[`time.ws.ts`](packages/sdk-components-react/src/time.ws.ts) to include
`format` in initialProps
- Example: `format="YYYY-MM-DD HH:mm:ss"` displays as "2025-11-03
18:47:25"

### Template & Fixture Updates
- Updated all CLI templates (defaults, react-router, SSG) to include
`pathname` in system objects
- Updated all fixture files (47 files total) to include `pathname` in
system objects
- All 694 tests passing
- All typecheck passing

## Usage

### Current Date Resource
Users can now add the Current Date resource from the Data Variables
panel:
1. Click + next to Data Variables
2. Select "System Resource"
3. Choose "Current Date" from the dropdown
4. Access in expressions:
   - `date.year` - for copyright year
   - `date.month` - current month (1-12)
   - `date.day` - current day (1-31)
   - `date.iso` - ISO 8601 string
   - `date.timestamp` - Unix timestamp

### System Pathname
Access the current page path directly:
- `system.pathname` - current page path (e.g., `/about`, `/blog/post-1`)

### Time Component Custom Format
Use the `format` prop for custom date/time display:
```jsx
<Time datetime="2025-11-03T18:47:25Z" format="YYYY-MM-DD" />
// Displays: 2025-11-03

<Time datetime="2025-11-03T18:47:25Z" format="YYYY-MM-DD HH:mm:ss" />
// Displays: 2025-11-03 18:47:25

<Time datetime="2025-11-03T18:47:25Z" format="M/D/YYYY" />
// Displays: 11/3/2025
```
Technical Notes
- Current Date values are normalized to midnight UTC to ensure
consistency throughout the day and prevent hydration mismatches
- The pathname property is computed from the request URL and normalized
to '/' when empty
- Custom format templates in the Time component are processed before
falling back to Intl.DateTimeFormat
- All changes are backward compatible
2025-11-03 23:17:53 +01:00
Bogdan Chadkin 631743b860 feat: remove free domains (#5426)
<img width="357" height="297" alt="Screenshot 2025-10-15 at 11 54 23"
src="https://github.com/user-attachments/assets/f4fa0c5f-89b4-4f9b-9152-bf339c2e8f55"
/>
2025-10-15 12:14:11 +04:00
Bogdan Chadkin a9f838a894 fix: upload unoptimized inception images (#5419)
This fixes the issue with uploading avif which is not supported as image
source.
2025-10-05 13:50:14 +03:00
Bogdan Chadkin de444a3501 fix: copy paste search params in resources (#5412)
Reproduced when tried to insert the new baserow template
2025-09-27 16:47:49 +03:00
Bogdan Chadkin a202648367 fix: show resource validation error as response (#5402)
Sometimes users are able to save broken resource
for example without header value. We need to prevent failing all
requests and instead fail only broken one.
2025-09-19 14:52:34 +03: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 cdb2a9581c feat: add search params list to resource UI (#5384)
Ref https://github.com/webstudio-is/webstudio/issues/3691

Editing search params separately from url can improve experience working
with external CMS or databases like baserow.

Also made headers list more compact and aligned with search params.
Validation is simplified, empty pairs will be just ignored without
blocking user with validation errors.


https://github.com/user-attachments/assets/3102d2c8-a902-4e86-8011-d71346fb5491
2025-09-01 09:49:43 +02:00
Bogdan Chadkin 05a2dd290e feat: allow user to add asset description (#5369)
Ref https://github.com/webstudio-is/webstudio/issues/3263

Now users can control "alt" for all image uses with asset description.



https://github.com/user-attachments/assets/c0e5ae4b-d2b0-4ec1-bf93-c385816369d1
2025-08-12 15:57:38 +02:00
Bogdan Chadkin fb466caed1 feat: show when asset is used (#5365)
Ref https://github.com/webstudio-is/webstudio/issues/572
https://github.com/webstudio-is/webstudio/issues/3261

- made settings gear visible when asset is used anywhere
- when asset is used delete button shows dialog with all usages

<img width="235" height="149" alt="image"
src="https://github.com/user-attachments/assets/50fc7e45-fb84-451d-9825-592b3ef45388"
/>



<img width="277" height="288" alt="image"
src="https://github.com/user-attachments/assets/37187a5c-92b5-413c-bcdf-caaf506525a4"
/>


<img width="428" height="246" alt="Screenshot 2025-08-09 at 11 30 37"
src="https://github.com/user-attachments/assets/e77d262a-3de0-4d46-b681-b38becb55862"
/>
2025-08-09 15:14:22 +02:00
Bogdan Chadkin bc599ad37b fix: access available features from product plans (#5358)
This will let us to configure available features for each plan.
2025-08-04 14:11:57 +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 94b1fb9951 fix: consider Text and Link components as rich text (#5334)
This prevents editing Text and Link components parent and instead
enforces editing these components as rich text containers.
2025-07-23 20:50:24 +02:00
Bogdan Chadkin 4a9fe16fd6 refactor: fix inception paste typo (#5323) 2025-07-12 23:57:02 +02:00
Bogdan Chadkin 111564c88f feat: automatically paste tailwind when html has inception mark (#5322)
We want to reduce friction in pasting from inception and will
automatically process tailwind classes and generate styles when paste
into builder without using command panel.
2025-07-12 18:43:05 +02:00
Bogdan ChadkinandOleg Isonen 5632a40940 feat: allow restore from published backup (#5320)
Ref https://github.com/webstudio-is/webstudio/issues/5276

---------

Co-authored-by: Oleg Isonen <oleg008@gmail.com>
2025-07-11 19:05:31 +02:00
Oleg Isonen a57783eb69 chore: Delete support hub (#5317)
## Description

Product was discontinued

## 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-07-07 11:59:12 +02:00
Bogdan Chadkin 395ebc44f2 fix: convert space-* on breakpoints when paste tailwind (#5308)
Ref https://github.com/webstudio-is/webstudio/issues/2651

Didn't consider spaces on breakpoints when converted space-* to gap for
example `md:space-x-6` -> `md:gap-x-6`
2025-06-30 13:33:18 +03:00
Bogdan Chadkin 232847ced1 fix: add unset values to adapt tailwind breakpoints (#5303)
Ref https://github.com/webstudio-is/webstudio/issues/2651

When convert tailwind breakpoints to webstudio breakpoints our algorithm
can find holes and will stop conversion. Though this will create
mobile-first breakpoints which users do not expect.

Here I added workaround to specify "unset" value on property when
tailwind breakpoints has holes. Here's examples

**sm:opacity-20** - here the hole is in the beginning, opacity: 0.2 can
be defined on base breakpoint but we need to fill with something
`max-width: 479`

**max-sm:opacity-10 md:opacity-20** - here the holr is in the middle, we
have `max-width: 479` and base breakpoint but no `max-width: 767`
2025-06-28 17:55:24 +03:00
Bogdan Chadkin 4f2d21ee06 fix: strip invalid attributes when paste html (#5304)
We never validated invalid attributes which cannot be rendered as jsx
and will break the build. Here just strip them away.
2025-06-28 17:15:58 +03:00
Bogdan Chadkin 310ab3aa1d fix: support max-* breakpoints in tailwind (#5299)
Ref https://github.com/webstudio-is/webstudio/issues/2651

Tailwind has max-sm, max-lg etc endpoints which need to adapt to ours as
well
2025-06-27 16:32:41 +03:00
Bogdan Chadkin 1bbfe42249 feat: paste HTML with tailwind classes (#5296)
Ref https://github.com/webstudio-is/webstudio/issues/2651

Added command to let users paste tailwind fragments.

- all classes are converted to local styles
- breakpoints are adapted to desktop-first if possible
- images are automatically uploaded
2025-06-27 00:21:35 +03:00
Bogdan Chadkin 701793d8b8 experimental: use --tw- prefix for tailwind css variables (#5294)
Ref https://github.com/webstudio-is/webstudio/issues/2651
2025-06-26 16:31:00 +03: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 7c05003cc5 fix: properly support details and summary elements (#5285)
This fixes headings inside of summary and interactive elements inside of
details content.
2025-06-25 16:53:27 +03:00
Bogdan Chadkin 88a29bfc21 fix: catch iframe errors (#5279) 2025-06-14 18:53:36 +03:00
Oleg Isonen 959fd11800 feat: Open current page in the publish dialog (#5277)
## 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-06-13 19:18:18 +02:00
Bogdan Chadkin df9fecff3b fix: ignore content model checks for XmlNode component (#5268)
We rely on "tag" in legacy components though it is primary way to setup
tag on xml nodes. Here added exception for all xml components.
2025-06-11 15:10:50 +03:00
Bogdan Chadkin b64a0c077a fix: accept <source> as <video> child (#5264)
Transparent category was overriden by parent categories without merging
others from current element.
2025-06-10 18:42:38 +03:00
Bogdan Chadkin 274c8d84c2 experimental: adapt tailwind to webstudio breakpoints (#5244)
Ref https://github.com/webstudio-is/webstudio/issues/2651

There is an edge case which will prevent from converting breakpoints.
When there is no base breakpoint there is no value to fill with inverted
space. Though it should be very rare usecase. Need to test how often it
will create new breakpoints.
2025-06-09 15:32:52 +03:00
Bogdan Chadkin 24180a2edb perf: improve instance selection performance (#5240)
We have html element mutations in a few places and each can add ~250ms
of repaint time on large projects. Here I got rid of it in two places

1. Collapsed logic enforced document height to preserve scroll position.
Instead I created an absolutely positioned div which enforced scroll
where collapsed elements are reset.
2. Scroll into view logic defined position absolute on scroll container.
Though it's not necessary on html element so just ignored it.
2025-06-01 14:42:10 +03:00
Bogdan Chadkin 04949cbc88 feat: wrap text with span element when droppping instances into it (#5237)
Ref https://github.com/webstudio-is/webstudio/issues/3632

Here changed insertion logic to wrap rich text with span element instead
of Text component when drop into it. This is the last place which
creates legacy components.

Refactored tests with jsx to make them more readable.
2025-05-28 12:11:10 +03:00
Bogdan Chadkin 3d064f1b20 fix: paste markdown (#5235)
Async in html paste broke markdown because await was missing in onPaste.
2025-05-28 00:24:46 +03:00
Bogdan Chadkin 57ea5da3d2 feat: download image when paste html with it (#5232)
Ref https://github.com/webstudio-is/webstudio/issues/3632

Now images will be downloaded when paste it in html to make them
accessible within project even when original one is no longer responds.



https://github.com/user-attachments/assets/2591e981-3ec1-40f8-bf50-19332c322332
2025-05-26 12:18:03 +03:00
Bogdan Chadkin 3506fe881f feat: add element component (#5231)
Ref https://github.com/webstudio-is/webstudio/issues/3632

Here unflagged element component in components panel and html paste.

Additionally

- migrate link template to html element
- added :local-link state to links which is replaced with
[aria-current=page] when css is generated, sadly not yet supported in
any browser
- migrated many templates from legacy components to html elements
- put tailwind paste behind flag
2025-05-25 14:26:40 +03:00
Bogdan Chadkin 4dfdf50380 feat: migrate forms components to html elements (#5230)
Ref https://github.com/webstudio-is/webstudio/issues/3632

This is big one. So I switched to html elements whole forms section in
components. Though here I introduced some deviation from specification

**Textarea**

Initial value is represented as text content
```html
<textarea>content</textarea>
````

Though it is trickier to manage text content as state and all frameworks
rely on value property of textarea dom interface.

**Select**

Similar story. There is no value attribute and state is represented by
selected boolean attribute on options

```html
<select>
  <option value="value1" selected></option>
  <option value="value2"></option>
</select>
```

We replace selected attribute on option with value attribute on selected
when paste.

So basically all form elements are using "value" and "checked"
attributes which can be easily mapped to html and all frameworks.
2025-05-24 15:11:49 +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 c630054c74 feat: use html elements for typography (#5226)
Html elements can completely replace legacy typography components. Here
replace component templates with element templates as part of sdk.

- moved content block to general section
- moved separator into typography section
- moved code text into typography section and used regular `<code>`
element for it
- made "Text Content" setting expandable
- fixed dragging templates onto canvas.

<img width="475" alt="Screenshot 2025-05-21 at 11 27 27"
src="https://github.com/user-attachments/assets/ab53c5ec-e51f-498d-b01b-cc7f2eb20c2d"
/>
<img width="515" alt="Screenshot 2025-05-21 at 11 27 20"
src="https://github.com/user-attachments/assets/0f560c26-7e51-4025-a487-6f7e4e3f43e3"
/>
2025-05-21 15:26:05 +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 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 e35de86421 experimental: add icons to html elements (#5219)
Ref https://github.com/webstudio-is/webstudio/issues/3632

<img width="281" alt="Screenshot 2025-05-18 at 18 37 16"
src="https://github.com/user-attachments/assets/0b95b674-c9fa-4f5d-b79d-b1ce6023dba8"
/>
2025-05-18 20:46:45 +03:00
Bogdan Chadkin 90aa42422d experimental: support html elements in content block (#5216)
Ref https://github.com/webstudio-is/webstudio/issues/3632

Now content block is relying on instances tags instead of component
names. Tested all cases. Should work smoothly.

Also dialog title now have placeholders inferred from tag as well
<img width="1025" alt="image"
src="https://github.com/user-attachments/assets/4c7817fb-cf68-4d61-a672-213b1e8d1cc7"
/>
2025-05-18 00:29:50 +03:00
Bogdan Chadkin 646c5b38e7 fix: normalize html attributes only when not defined by component (#5215)
Proper fix for https://github.com/webstudio-is/webstudio/pull/5211

Now props meta are available in component generator and can be used to
figure if prop is defined by component or comes from html attributes.
Added same logic in canvas and component generator.

Also got rid from no longer necessary registeredComponentPropsMetas
store since all props are described by component meta.
2025-05-17 10:11:56 +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
Bogdan Chadkin d372aa386b experimental: customize initial attributes per tag (#5209)
Ref https://github.com/webstudio-is/webstudio/issues/3632

Now different tags can have own initial attributes. Here added initial
attributes to `<a>` and `<form>` which will be replaced with remix
components on publish. Also overriden href, download and target types
for links.

<img width="246" alt="Screenshot 2025-05-15 at 16 21 00"
src="https://github.com/user-attachments/assets/112c3c94-0c87-4fa5-936b-4def5cc4ee12"
/>
2025-05-16 14:59:10 +03:00