43 Commits
Author SHA1 Message Date
61f164d40e (feat): Ability to add box-shadow to nodes. (#1634)
## Description

This is a WIP PR, and will be adding more details about the feature and
the changes that are going in...

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi, 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-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory

---------

Co-authored-by: Bogdan Chadkin <trysound@yandex.ru>
Co-authored-by: Oleg Isonen <oleg008@gmail.com>
2023-07-02 16:31:26 +02:00
Bogdan Chadkin 43868bfbc0 Fix text-align control default value (#1822)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1794

Here fixed initial value in css data. Mdn provides unclear value because
of legacy browsers. Here we need to override it with actual "start".
2023-06-19 17:50:36 +03:00
Bogdan Chadkin 1be61e59bb Compute currentColor (#1815)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1536

Here replaced browser getComputedStyle for currentColor with computing
from data.

`color: inherit` is now considered same as `color: currentColor` and
displayed properly in UI.

Changed initial value for color from inherit to black (in mdn-data it's
canvastext).
2023-06-19 16:27:27 +03:00
GiuseppeandGiuseppe Gurgone 6ffeb6407b Tweak prompt and regenerate properties descriptions (#1807)
Fixes #1793

## Description

I tweaked the prompt and generated new descriptions. 

@kof @taylornowotny The results are still not ideal but please take a
look and decide whether we should merge these changes or not (probably
still better than the previous generation).

PS: I tweaked the script a bit so now it creates: `propertiesOverrides`
and `propertiesGenerated` (same for property:value descriptions). This
way we can add overrides to `propertiesOverrides`

---------

Co-authored-by: Giuseppe Gurgone <ggurgone@users.noreply.github.com>
2023-06-18 08:59:17 +03:00
Bogdan Chadkin c482db745c Add combined control descriptions (#1803)
Ref https://github.com/webstudio-is/webstudio-builder/pull/1785

Here fixed generated height description and added custom descriptions
for following controls

- background
- borderWidth
- borderStyle
- borderColor
- borderRadius
- sizing
2023-06-16 00:19:28 +03:00
Oleg Isonen 4874e4093d Tooltips improvements (#1770)
## Description

- Fixes a bunch of wrong logic for showing style source origin info in
the tooltip
- Renders GPT descriptions

## Steps for reproduction

1. check tooltips in style panel


## Code Review

- [ ] hi @istarkov , 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-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-06-13 07:44:26 +03:00
d207286df3 CSS data descriptions generation script (#1759)
## Description

Using ChatGPT, this scripts generates descriptions for CSS properties
and declarations (property-value).
It uses `keywordValues` from
[`src/__generated__/keyword-values.ts`](https://github.com/webstudio-is/webstudio-builder/blob/css-data-descriptions/packages/css-data/src/__generated__/keyword-values.ts)
to get a list of all the properties and values.

The result is a TS module located at
`./src/__generated__/property-value-descriptions.ts` which exports:
- properties
- declarations

By default it generates descriptions only for new properties/values,
however you can use the `--forceRegenerate` flag to regenerate
everything.

When it comes to generating descriptions for declarations whose value is
a color eg. `background-color: orange` we generate a description for a
generic `property: {color}` declaration (e.g. `background-color:
{color}`) and GPT will generate a description template with a
placeholder `{color}`.

The script then repeats the template for every color value, replacing
`{color}`. This is to avoid generating a ton of similar description and
wasting GPT tokens.

The script needs two env variables:
- process.env.OPENAI_KEY - Your OpenAI API key
https://platform.openai.com/account/api-keys
- process.env.OPENAI_ORG - Your OpenAI Org ID
https://platform.openai.com/account/org-settings

## Steps for reproduction

Run it 

```
OPENAI_KEY=your-key OPENAI_ORG=your-org pnpm build:descriptions
```

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - review sample descriptions

## Before merging

- [x] Get approval on sample descriptions
- [x] Generate all the descriptions
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory

---------

Co-authored-by: Giuseppe Gurgone <ggurgone@users.noreply.github.com>
Co-authored-by: Oleg Isonen <oleg008@gmail.com>
2023-06-12 22:05:06 +02:00
Bogdan Chadkin fd8ac62296 Drop deprecated system colors (#1758)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1301

## 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-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-06-12 17:11:11 +02:00
Ivan Starkov 3441e1b160 Fix unhandled background parsing error (#1753)
## Description

closes #1751

useEffect unsubscribe called parsing and unhandled error caused
everything to break


## 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-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-06-12 16:10:52 +04:00
Giuseppe 6a9c4c013c Initial CSS parser (#1652)
## Description

This PR moves the parse-css-value utility that was before part of the
builder app to the css-data package.

In this package we are adding an initial `parse-css` utility that will take
CSS and convert to a format that we can work on within Webstudio. For
now it is relatively simple and it supports only CSS classes parsing.
2023-05-23 09:47:13 +02:00
Bogdan Chadkin 9d0285f56b Support bold and normal font-weight (#1641)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1535

Here instead of hacky preconverting to numeric font-weight value support
"normal" and "bold" as input for font weight control.

Defaults can be checked on h1 and body.
2023-05-20 10:32:49 +07:00
Oleg IsonenandJayaKrishnaNamburu b4b86a6c89 Outline style property (#1630)
## Description

https://github.com/webstudio-is/webstudio-builder/pull/1596

---------

Co-authored-by: JayaKrishnaNamburu <namburu1995@gmail.com>
2023-05-14 18:40:12 +02:00
Bogdan Chadkin 2afa5e1cd4 Drop link preset states (#1604)
:active and :visited states on links have special behaviour. They are
vendor defined until color on stateless link is defined. Similar to how
vars work there is var with default. And when var is somewhere defined
default is overriden.

Though using vars for this specific case is too complex here easier
solution. We can just remove active and visited states on default
styles. User may never see this inconsistency as usually would modify
color on stateless link first and then go to active or visited states.
2023-05-09 15:01:21 +07:00
Bogdan Chadkin 6fb341b1ce Fix link default and preset styles (#1591)
Here made added browser defaults for link and set color as preset.
2023-05-07 18:58:27 +07:00
Bogdan Chadkin 403edf6523 Parse tuple in css-data (#1548)
We support tuple type in styles and can now parse initial values
properly which is important since we no longer use computed browser
style.
2023-05-03 01:00:37 +08:00
Bogdan Chadkin c60ee0af07 Show initial and html style in style panel (#1533)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1067

We need to move away from getComputedStyle for not local styles in style
panel.

Here added default html style from browser sources. Now we can render it
and properties initial styles instead of computed styles.

Also fixed in properties data generation currentcolor -> currentColor
and removed same from border presets.
2023-04-27 17:06:38 +07:00
Bogdan Chadkin a148507e48 Render style states (#1420)
Ref https://github.com/webstudio-is/webstudio-builder/issues/807

Refactored styles rendering in canvas to consider states and added style
states support to css text renderer.
2023-04-17 15:50:14 +07:00
Bogdan Chadkin 06b3f279ad Drop assets resolving from project-build (#1406)
This big chunk of legacy is no longer necessary.
We resolve style assets on client so css engine can accept db types now.
2023-04-10 23:14:10 +07:00
Bogdan Chadkin 33fd087ece Transform image value to resolve url (#1405)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1179

Succeeded https://github.com/webstudio-is/webstudio-builder/pull/1403

Here added support for transformValue in css-engine StyleRule. So we can
apply any transformation when render css.

In sdk added image transformation which accepts assets and provides
image value with new url value.

Now we can get rid of resolving on server side and apply image loaders
for images rendered in styles.
2023-04-09 22:24:02 +07:00
Ivan Starkov 8bf079d821 Add common keywords (#1385)
## Description

closes #1378

## Steps for reproduction

Take any css property, see it contains 
initial, inherit, unset

## 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-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-04-06 22:21:52 +04:00
Ivan Starkov 8c27c5c86b Show currentcolor value in picker (#1339)
## Description

closes #1304 

To not expose computed style or do hard currentColor recalculation. I
added currentColor: StyleValue to the styleInfo color property.

## Steps for reproduction

Set currentColor on border or background or color, see in color picker
it works

## Code Review

- [ ] hi @TrySound , 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-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-04-03 12:32:15 +04:00
Ivan Starkov fcee225a5f Add simple background parser (#1240)
## Description

ref #877 - the ability to parse multiple gradient layers from Figma 
![Screen Recording 2023-03-18 at 00 25
12](https://user-images.githubusercontent.com/5077042/226031486-0dc0978b-5572-4dd6-9441-b86b2e469a7a.gif)


closes #1255 - now background added at the top

fixes css value input invalid input now shows as invalid

## Steps for reproduction

Copy some background from figma like
```
background: linear-gradient(180deg, #11181C 0%, rgba(17, 24, 28, 0) 36.09%), none, linear-gradient(180deg, rgba(230, 60, 254, 0.33) 0%, rgba(255, 174, 60, 0) 100%), radial-gradient(54.1% 95.83% at 100% 100%, #FFFFFF 0%, rgba(255, 255, 255, 0) 100%), linear-gradient(122.33deg, rgba(74, 78, 250, 0.2) 0%, rgba(0, 0, 0, 0) 69.38%), radial-gradient(92.26% 201.29% at 98.6% 10.65%, rgba(255, 174, 60, 0.3) 0%, rgba(227, 53, 255, 0) 100%) /* warning: gradient uses a rotation that is not supported by CSS and may not behave as expected */, radial-gradient(84.64% 267.51% at 10.07% 81.45%, rgba(53, 255, 182, 0.2) 0%, rgba(74, 78, 250, 0.2) 100%) /* warning: gradient uses a rotation that is not supported by CSS and may not behave as expected */, #EBFFFC;
```

Open any layer paste it into the code, and click enter or blur.
See layers added. BGColor has changed if set.


## Code Review

- [x] 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
- [x] 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-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [x] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-03-18 21:33:48 +04:00
Ivan Starkov 01d66bb015 Hide background layers (#1229)
## Description

ref #877

Allows hiding background layers in edit mode, i.e. eye button now works

<img width="242" alt="image"
src="https://user-images.githubusercontent.com/5077042/224558080-6fd5fa13-4e4b-424f-81ec-26456ba7e363.png">

One of the assumptions I made was that `var` is used only in edit mode
https://github.com/webstudio-is/webstudio-builder/blob/7ae3ed003e4d7f7fc99038ccdde57b5fa634bbe1/packages/css-engine/src/core/to-value.ts#L41



## Steps for reproduction

Add backgrounds, hide/unhide them

## 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-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-03-12 20:44:15 +04:00
Ivan Starkov d3fe478953 Backgrounds, part 2 (#1201)
## Description

Backgrounds part 2. ref #877

- [x] - remove repeat section under gradient part
- [x] - info Icon for gradient "code"

The floating panel, gradients support.

<img width="508" alt="image"
src="https://user-images.githubusercontent.com/5077042/224417159-22a27ffd-6460-4d97-8891-f14a9a3331a3.png">

No drag, no hide, no smart insert



## 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-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-03-11 19:36:48 +04:00
Ivan StarkovandOleg Isonen bac386467c Background section redesign part 1.1 (#1149)
## Description

ref #877
As in this comment part 1
https://github.com/webstudio-is/webstudio-builder/issues/877#issuecomment-1441897685

<img width="647" alt="image"
src="https://user-images.githubusercontent.com/5077042/223226959-3e9b1832-07aa-425b-afcf-27f7cdafa85c.png">

You can add/remove layers. View/Hide not working. No drag.

## Steps for reproduction

Create new project. (existing could not work well because of migration)
Create background layers. Add images. Set various background layers
params.

## Code Review

- [x] 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
- [x] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

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

---------

Co-authored-by: Oleg Isonen <oleg008@gmail.com>
2023-03-08 19:29:53 +04:00
Oleg Isonen 11edeeb1c1 Object Fit & object position (#1180)
## Description

This implements object fit and inside a position control to be reused
with background position and others.



https://user-images.githubusercontent.com/52824/223282840-92b54da6-686d-45fe-8fe8-4422beb7572e.mp4



## Steps for reproduction

1. sizes section
2. object position

## Code Review

- [ ] hi @istarkov, 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-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-03-07 00:51:11 +01:00
Ivan Starkov a82825bfe8 Make Image value not an Array (#1148)
## Description

ref #877

As a part of above I'm changing 
```
export const ImageValue = z.object({
  type: z.literal("image"),
  value: z.array(z.object({ type: z.literal("asset"), value: ImageAsset })),
});
```
to 
```
export const ImageValue = z.object({
  type: z.literal("image"),
  value: z.object({ type: z.literal("asset"), value: ImageAsset }),
});
```
In favour of using in next PRs 

```
const ArrayValue = z.object({
  type: z.literal("array"),
  value: z.array(z.union([UnitValue, KeywordValue, UnparsedValue, ImageValue])),
});
```

For now, to not break compatibility with existing code I'm not
converting to an array immediately.
Just style types simplification.

'array' type is not now supported on db level, parse/serialize will not
work. Will be done in following PRs





## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @TrySound , 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-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-03-01 12:54:44 +04:00
Oleg Isonen 77b8dab455 Support background-clip text (#1123)
## Description

There are multiple problems with clipping to text:
1. it is only supported with vendor prefixed -webkit-background-clip
2. it doesn't work with CSS vars (not using them on canvas for this)


## Steps for reproduction

1. add heading
4. set background image src to some image
5. set color to transparent
6. set background-clip to text
7. Background image should be clipped to text

<img width="294" alt="Screenshot 2023-02-24 at 13 49 22"
src="https://user-images.githubusercontent.com/52824/221194656-9e4591ed-5727-45f0-8560-eba35e278819.png">


## Code Review

- [ ] hi @TrySound , 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-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-02-24 18:21:10 +01:00
Bogdan Chadkin 0c506ed79e Move breakpoints schema to project-build (#1027)
Breakpoints are not really related to css data and represent project
build data so moving it before switching to map patches.
2023-02-14 16:37:33 +03:00
Ivan Starkov 2f1ba03544 Update typescript (#1025)
## 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-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2023-02-13 23:19:11 +03:00
Ivan Starkov 7a44059fbb Enable using css functions in CssValueInput (#1014)
## Description

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

Enable using css functions in CssValueInput 
closes #990 

## Steps for reproduction

Add 
`blur(2px)` or 
`drop-shadow(16px 16px 20px blue)` or 
`blur(2px) drop-shadow(16px 16px 20px blue)` to the filter field

It should work.


## 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-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2023-02-13 14:41:32 +04:00
Bogdan Chadkin 073062a4bf Move breakpoints to Build table (#926)
Ref https://github.com/webstudio-is/webstudio-designer/issues/744

We are trying to co-locate data and simplify cloning/copying. Here I
migrated Breakpoints.values into Build.breakpoints.

This makes Build responsible to all data scoped to project build similar
to tree scope.

We get projectId defined for free and no need additional sql
maintenance.
2023-02-02 21:43:03 +03:00
Bogdan Chadkin 5fe9364cb1 Improve units in style panel (#735)
Ref https://github.com/webstudio-is/webstudio-designer/issues/366

- generate grouped units for non length values
- show unit select when initial unitless

So we get all 3 points from the issue

- all properties has only supported units
- hidden but supported units still can be entered
- unsupported values are validated

<img width="243" alt="Screenshot 2023-01-04 at 14 12 29"
src="https://user-images.githubusercontent.com/5635476/210546684-ca696096-f78c-445f-bbc3-04db7326239b.png">
<img width="224" alt="Screenshot 2023-01-04 at 14 14 54"
src="https://user-images.githubusercontent.com/5635476/210546689-396c7d42-e6f0-42a9-869c-7b231baa3d71.png">
2023-01-04 18:20:15 +03:00
Bogdan Chadkin cdba1c7149 Fix unitless initial values (#734)
Ref https://github.com/webstudio-is/webstudio-designer/issues/366

There were many unitless initial values with "px" unit. Here I extracted
all possible unit types from properties syntaxes. csstree provides a
list of unit groups which in the future will let us provide correct list
of units for css value input.
2023-01-04 13:57:54 +03:00
Bogdan Chadkin 81194d8422 Remove incorrect keywords from generated data (#730)
While fixing units found a lot of keywords appear from css functions
which are complex values and should be ignored. So here I changed
traversing of properties syntaxes to support only top level values and
keywords.

Mostly gone color words

```diff
-6639 lines  116 KB
+4808 lines  85.8 KB
```

See diff for more info
2023-01-03 23:23:04 +03:00
Bogdan Chadkin 5a2b3b8eec Parse properties initial value (#726)
Ref https://github.com/webstudio-is/webstudio-designer/issues/366

Parsed initial values to get correct unit instead of px for some
properties. There is still edge case with unitless values I'm gonna fix
in another PR.

Also bumped mdn-data and removed overrides fixed on mdn side.
2023-01-03 19:57:16 +03:00
Ivan Starkov d73ec1b459 Do not show flex properties in style panel when layout is not flex (#722)
## Description

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

Do not show flex properties in the style panel when a layout is not flex
closes #687

<img width="272" alt="image"
src="https://user-images.githubusercontent.com/5077042/210067036-4571be1d-4745-48a3-be7f-45f91791a6a9.png">

Here I patched `appliesTo` of properties `alignItems`, `justifyItems`
see https://github.com/mdn/data/issues/585

## Steps for reproduction

Opens designer panel, check no flex props in display: block layout

## 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-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2023-01-02 14:15:33 +03:00
Ivan Starkov 6150dc0599 Background image DB support (#701)
## Description

ref  #534

Next PR #705

Db support for ImageValue style.
Having that ImageValue can contain assets we need to transform assets to
`assetId` and back during save/load.

`zod + dataloader` is used for transform for simplicity, allows avoiding
tree traversal, and highly simplifies code.

_I want to merge it to not make one huge PR, it has no breaking changes,
just a new feature save/load support_

## Steps for reproduction

## Code Review

- [x] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
- [x] hi @TrySound, I need 
 - detailed review (read every line)

## Before requesting a review

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

## Before merging

- [x] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2022-12-27 13:17:22 +03:00
Ivan Starkov 2be8511780 Add new RGB Style, then fix typescript errors (#578)
The reason of use opaque types, as otherwise props like `value` reused
everywhere.



Implemented same as CssValueInputLogic - during input editing nothing
changed.
Error is shown on Enter click. Value resetted on blur.
2022-12-09 20:31:20 +03:00
Oleg Isonenandistarkov 4c8989784b Primitive tokens (#507)
https://github.com/webstudio-is/webstudio-designer/issues/494

This PR Renders this UI and, when adding tokens - renders CSS variables
on the canvas: It's behind a feature flag.

<img width="411" alt="Screenshot 2022-11-25 at 15 51 00"
src="https://user-images.githubusercontent.com/52824/204009859-81ed72c4-e758-4973-be49-c8c65e6b4661.png">


## Before requesting a review

- [ ] if the PR is WIP - use draft mode
- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")
- [ ] what kind of review is needed?
  - [ ] conceptual
  - [ ] detailed
  - [ ] with testing

## Test cases

- [ ] step by step interaction description and what is expected to
happen

## Before merging

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

Co-authored-by: istarkov <istarkov@gmail.com>
2022-11-25 19:51:54 +01:00
Ivan Starkov 843467a691 Image (#502)
- [x] - Image optimization component moved into standalone package
- [x] - generate-arg-types moved into standalone package - one issue
with current yarn https://github.com/yarnpkg/yarn/issues/4964 (you need
to delete root node_modules, then yarn and yarn build to make
generate-arg-types to work)
- [x] - move json into `__generated__` folder, (allow import json from
__generated__ folders only)
- [x] - Icons moved all gen into `__generated__`
- [x] - css-data generated content moved to `__generated__`
2022-11-25 12:27:44 +04:00
Oleg Isonen bda114b4e3 move tree utils again back to project
someone merged them back into app after they were moved to project
2022-11-18 14:01:19 +01:00
Oleg Isonen 33160e6632 move css-data to a package 2022-11-17 21:12:39 +01:00