498 Commits
Author SHA1 Message Date
Ivan Starkov f8c97c2e2d release 0.86.0 (#2090)
## Description

release 0.86.0

## 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-08-10 18:49:02 +03:00
Ivan Starkov 7af70bdf50 0.85.0 (#2084)
## 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-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-08-09 23:43:21 +03:00
Ivan Starkov 034709c44d release-0.84.0 (#2082)
## Description

npm packages update


## 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-08-09 22:48:34 +03:00
Bogdan Chadkin fdf22ab9e6 Add component hooks (#2069)
We want to control some builder behavior specific to some components.
For example set open state on dialog, collapsible etc when select in
navigator.

Here I added hooks to be called from builder and executed in canvas. For
now added 2 hooks onNavigatorSelect and onNavigatorDeselect.
2023-08-08 16:38:53 +04:00
Bogdan Chadkin 8c6b5cff82 Bump to remix 1.19.2 (#2062)
Ref https://github.com/remix-run/remix/releases/tag/remix%401.19.2

Here fixed a few vulnerabilities by upgrading proxy-agent dependency.
2023-08-06 19:46:19 +04:00
Ivan Starkov 9a0536e852 Fix presets in radix (namespaces issue) (#2025)
## Description

Fix presets in case of namespaeces added `"` to selector
<img width="605" alt="image"
src="https://github.com/webstudio-is/webstudio-builder/assets/5077042/9b367c73-466e-4592-b45f-0b84660e423f">


Added presets to radix components


## 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-08-03 13:37:44 +03:00
Bogdan Chadkin 40e71b6c5b Simplify indexes within ancestors (#2021)
Here added dedicated field to meta to simplify computing and using
indexes.

```
{
  type: 'container',
  label: 'Tab Trigger',
  // this one
  indexWithinAncestor: 'Tabs'
}
```

Since it's single value, we no longer need to provide ancestor name in
runtime and no longer have bug with namespaces. Index now provided with
props.

```
getIndexWithinAncestorFromComponentProps(props): string | undefined
```
2023-08-01 22:40:16 +04:00
Bogdan Chadkin f751045e22 Add namespace prefix to constraints (#2020)
Ref
https://discord.com/channels/955905230107738152/1135965820602831036/1135965820602831036

This fixes the issue with adding any radix component. It got broken
because of unprefixed constraints.
2023-08-01 20:35:53 +04:00
Bogdan Chadkin 33a4b8dace Decouple data sources from props in templates (#2013)
Here changed the way we define data sources in embed templates. Now they
have separate section on instance. This way we will be able to use data
sources on styles or instances without binding them to props.

Also it's not more clear where data source is created vs where it is
only referenced.

```js
{
  type: 'instance',
  component: 'Form',
  dataSources: {
    state: { type: 'variable', initialValue: 'initial' },
    stateInitial: { type: 'expression', code: `state === 'initial'` }
  },
  props: [
    {
      type: 'dataSource',
      name: 'data-state',
      dataSourceName: 'state'
    }
  ],
  children: []
}
```
2023-08-01 16:59:07 +04:00
Bogdan Chadkin 4cfb0a9d62 Compute indexes within required ancestors (#2000)
Ref https://github.com/webstudio-is/webstudio-builder/pull/1516

Here added utility to compute indexes within ancestors. This should let
us easily co-locate tabs triggers and contents by their indexes.
2023-08-01 14:32:06 +04:00
Bogdan Chadkin ec84e84a10 Bump to remix 1.19 (#2016)
Ref https://github.com/remix-run/remix/releases/tag/remix%401.19.0

The main change is new option to disable polyfills
2023-08-01 00:53:06 +04:00
Bogdan Chadkin ac735df3ce Render component templates in stories (#2009)
Here added utility to render component templates in stories as it will
work in published site without running builder.

It will help to be more confident in templates we write for components.
Especially with complex logic with variables and expressions.

Can be tested here
https://638affb61acca1e593c6e558-gxuvohlrer.chromatic.com/?path=/story/sdk-components-react-radix_components-collapsible--collapsible
2023-07-31 15:46:56 +04:00
Ivan Starkov 22da5ea728 Update NPM 0.83.0 (#2008)
## 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-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-07-31 12:52:19 +03:00
Bogdan Chadkin 923a3868a1 Fix drag&drop on canvas (#2007)
Here fixed droping new components on canvas.
Template was used to check constraints but failed
when no template found. Fixed by using fallback.
2023-07-31 13:23:55 +04:00
Bogdan Chadkin 381a962437 Namespace component libraries (#2005)
Here added support for namespacing external libraries. Need this for
radix components to not prefix manually and have isolation in names in
case a few client libs are added an have collission in names or we add
native components with same names.
2023-07-30 21:14:57 +04:00
Bogdan Chadkin 6500e01397 Move getBrowserStyle utility into builder (#2004)
getBrowserStyle is used only inside of builder and should not be part of
sdk importable by all component libraries. It also depends on global
types which need to be included in every package dependent on react-sdk.
2023-07-30 20:56:29 +04:00
Bogdan Chadkin 004232da63 Bump checks packages (#2002)
- jest
- simple-git-hooks
- eslint
- size-limit
2023-07-28 23:37:33 +03:00
Bogdan Chadkin 9328961b87 Allow to disable components detaching (#1986)
Here added meta.detachable flag which allows when set to true disable
copying, dragging and deleting instances of this component without ts
parent instance.

This is necessary to constrain components based on external code and
prevent deleting hidden components user cannot add again.
2023-07-27 20:43:46 +03:00
Bogdan Chadkin 97b5316eb5 Bump ui libs (#1977)
Minor ui libraries releases

- floating-ui
- lexical
- react-aria
- radix-ui/colors
- pretty-bytes
- prismjs
- react-hotkeys-hook
- react-hot-toast
- @types/react & @types/react-dom
2023-07-26 13:48:16 +03:00
Oleg Isonen 9a52328d16 Change license from MIT to AGPL V3 (#1980)
The main reason for this change is the realization that a product needs
some more protection than a typical library. With this change it is
still an Open Source Core, but now corporations can't build on top of it
without contributing back to the OSS community or without buying a
license.
2023-07-26 01:06:21 +02:00
Bogdan Chadkin 09d2b77151 Support effectful expression arguments (#1967)
Here added support for expression arguments to utilize callback based
state management. So for example Form component can expose onStateChange
action with "newState" value and update any variable with it. So all
state management inside form becomes prop and callback.

You can test it by pasting

<details>
<summary>You can test by pasting this template and clicking on
+</summary>

```ison
{
  "@webstudio/template": [
    {
      "type": "instance",
      "component": "Box",
      "props": [
        {
          "type": "number",
          "name": "data-count",
          "value": 0,
          "dataSourceRef": {
            "type": "variable",
            "name": "count"
          }
        }
      ],
      "styles": [
        {
          "property": "display",
          "value": { "type": "keyword", "value": "flex" }
        }
      ],
      "children": [
        {
          "type": "instance",
          "component": "Button",
          "props": [
            {
              "type": "action",
              "name": "onClick",
              "value": [
                {
                  "type": "execute",
                  "code": "count = count - 1"
                }
              ]
            }
          ],
          "children": [{ "type": "text", "value": "-" }]
        },
        {
          "type": "instance",
          "component": "Box",
          "props": [
            {
              "type": "string",
              "name": "data-count",
              "value": "",
              "dataSourceRef": {
                "type": "expression",
                "name": "countString",
                "code": "\"0\" + count"
              }
            }
          ],
          "styles": [
            {
              "state": "::before",
              "property": "content",
              "value": { "type": "unparsed", "value": "attr(data-count)" }
            }
          ],
          "children": []
        },
        {
          "type": "instance",
          "component": "Button",
          "props": [
            {
              "type": "action",
              "name": "onClick",
              "value": [
                {
                  "type": "execute",
                  "args": ["event"],
                  "code": "count = count + 1 + event"
                }
              ]
            }
          ],
          "children": [{ "type": "text", "value": "+" }]
        }
      ]
    }
  ]
}
```

</details>
2023-07-24 20:14:01 +03:00
Bogdan Chadkin 886f839951 Upgrade to prettier v3 (#1973)
Ref https://prettier.io/blog/2023/07/05/3.0.0.html

Smaller package size, trailing comma for types always enabled, though I
disabled it for code.
2023-07-24 18:36:10 +03:00
Ivan Starkov f5cbd28962 Add tooltip (#1957)
## Description

Left
- [ ] - storybook (next PR)
- [ ] - default styles (next PR)
- [x] - Add property to edit tooltip
- [ ] - Contraints - do not allow delete Trigger and Content (next PRs)
- [ ] - Icons  (next PRs)

### Whats done to make tooltip to work.

1. Portals support through passing
[selectorIdAttribute](https://github.com/webstudio-is/webstudio-builder/blob/20c3b9fdea4a6f8e7a2cc00211b6e4ca95db13a5/apps/builder/app/canvas/features/webstudio-component/webstudio-component.tsx#L290)
2. [Hidden ScreenReader elements
detection](https://github.com/webstudio-is/webstudio-builder/blob/20c3b9fdea4a6f8e7a2cc00211b6e4ca95db13a5/apps/builder/app/canvas/features/webstudio-component/webstudio-component.tsx#L129)
3. [New elements on Canvas
detection]https://github.com/webstudio-is/webstudio-builder/blob/20c3b9fdea4a6f8e7a2cc00211b6e4ca95db13a5/apps/builder/app/canvas/features/webstudio-component/webstudio-component.tsx#L179



- [x] Collapsed
- [x] Do composeEventHandlers 
- [x] Radix add spans of tooltip content 
To support screen readers

https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
Radix here

https://github.com/radix-ui/primitives/blob/main/packages/react/tooltip/src/Tooltip.tsx#L552-L556
Cloning our content

https://github.com/radix-ui/primitives/blob/main/packages/react/visually-hidden/src/VisuallyHidden.tsx

## Steps for reproduction

1. click button
3. 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-07-24 14:50:15 +03:00
Bogdan Chadkin e98fe09eda Optimize typechecking (#1971)
Before we run two configurations of typescript on CI. Though this leads
to very long checks. Here I enabled "typecheck" script to generate dummy
.d.ts files to enable additional checks.

```diff
pnpm run -r typecheck (serial)
- 239.13s
+ 262.94s
pnpm turbo run size-test build checks dts --force (parallel locally)
- 2m30.609s
+ 1m47.622s
- pnpm turbo run size-test build checks dts --force (Ci)
- 6m 5s
+ pnpm turbo run size-test build checks --force (Ci)
+ 3m 22s
```
2023-07-24 11:38:19 +03:00
Bogdan Chadkin b226343599 Support copy pasting of data sources (#1963)
Here fixed the case when copy pasted form looses state and give errors
on submit.

Immerhin now converted to esm to work in tests.
Added tests for instances copy paste plugin.
The new logic is copy data sources as is if they are bound to copied
instances.

The new computeExpressionsDependencies used to detect if expression
depends on data sources outside of copied instances scope.
2023-07-23 11:56:13 +03:00
Ivan Starkov b14664ffd7 Update version 0.82.0 (#1962)
## 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-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-07-20 09:38:40 +03:00
Ivan Starkov 85ac541bde Update 0.81.0 (#1944)
## 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-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-07-17 11:56:56 +03:00
Ivan Starkov 98164cde2a Update version (#1935)
## 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-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-07-16 13:51:30 +03:00
Bogdan Chadkin eb0bc5ff77 Support pasting embed templates (#1936)
Here refactored copy paste plugin system to try each plugin until it
succeeds. This way we can have multiple solutions to copy paste from
plain text. For example embed template is hand written text and should
succeed before markdown starts parsing it.

```json
{
  "@webstudio/template": [
    {
      "type": "instance",
      "component": "Box",
      "children": [
        { "type": "text", "value": "Hello, I'm Box!" }
      ]
    }
  ]
}
```
2023-07-16 13:38:07 +03:00
Bogdan Chadkin 7364b51210 Run jest with sources (#1930)
Here added custom condition to jest config to make it load source code
instead of build artifacts.

This means we no longer need to rebuild after changing code in other
package
and we may even no need to generate cjs anymore.
2023-07-14 17:30:31 +03:00
Bogdan Chadkin 50af5962d4 Bump nano libraries (#1925)
### Nanoid

https://github.com/ai/nanoid/blob/main/CHANGELOG.md

Here nanoid removes dual mode and becomes esm only

### Nanostores

https://github.com/nanostores/nanostores/blob/main/CHANGELOG.md

- deepMap store
- subscribers no longer called when value is not changed
- use-sync-external-store polyfill no longer installed

### Small updates

- nanoevents
(https://github.com/ai/nanoevents/blob/main/CHANGELOG.md#80)
- camelcase
(https://github.com/sindresorhus/camelcase/releases/tag/v7.0.0)
- html-tags
(https://github.com/sindresorhus/html-tags/releases/tag/v3.3.0)
- pretty-bytes
(https://github.com/sindresorhus/pretty-bytes/releases/tag/v6.1.0)
2023-07-13 16:11:34 +03:00
Bogdan Chadkin 05df3910f5 Support effectful expressions in component actions (#1914)
Here added support for callbacks or event handlers on components which
basically can do only assignment to variables for now with extended
(with assignment operator) syntax of expressions.
2023-07-11 20:27:06 +03:00
Bogdan Chadkin 518cced7db Upgrade to remix 18 (#1876)
Enabled v2_headers and increased size limit

- https://github.com/remix-run/remix/releases/tag/remix%401.18.0
- https://github.com/remix-run/remix/releases/tag/remix%401.17.0
- https://github.com/remix-run/remix/releases/tag/remix%401.16.0
2023-07-10 15:26:13 +03:00
Bogdan Chadkin 3cdb2dbbc4 Support effectful expressions (#1908)
Here added two new utilities for generation and executing individual
expressions. Such expressions can use assignment operator to change any
variable.

This give us less opinionated solution for "set" action. We can just
execute any code our parser supports.
2023-07-08 12:15:40 +03:00
Oleg Isonen cda2c05020 Roboto font fallback for arial (#1898)
## Description

Closes #1884 

## Steps for reproduction

1. use Arial on any element
2. check in dev tools if roboto is a fallback

## 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-07-05 14:17:15 +02:00
Ivan Starkov 4411d91c86 Update versions 0.79.0 (#1901)
## 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-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-07-05 14:13:22 +03:00
Ivan Starkov 3587c03f32 Revert override browser default tag (#1900)
## 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-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-07-05 12:46:06 +03:00
Ivan Starkov 596aa50b9f Update version 0.78.0 (#1899)
## 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-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-07-04 22:32:14 +03:00
Ivan Starkov 5909fe5ba9 Upate version (#1896)
## Description

npm libs update

## 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-07-03 23:51:36 +03:00
Oleg IsonenandBogdan Chadkin 8f53eadf5b Override browser default tag based styles that use EM units (#1888)
## Description

EM seems to be challenging to use and people tend to use PX or REM
instead ... I changed those values that come with EM by default from
browsers to the values Webflow is using.


I am not sure why webflow is doing certain things: e.g. paragraphs have
marginTop 0, h1-3 have marginTop 20; marginBottom: 10, h4- have
marginTop 10 ; marginBottom 20

These seem to be inconsistent and weird choices.

---------

Co-authored-by: Bogdan Chadkin <trysound@yandex.ru>
2023-07-03 23:13:37 +03:00
Bogdan Chadkin c5a5809501 Support generating expressions code (#1894)
Here added another expression utility to generate function body
generateExpressionsComputation.

InstanceRoot now requires computeExpressions(variables) prop which can
be generated build time.
2023-07-03 23:09:39 +03:00
Ivan Starkov 4f7ad34cbf Release 0.76.0 (#1890)
## 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-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-07-02 22:39:35 +03:00
Bogdan Chadkin 1d0967e927 Scope data sources to instances (#1885)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1529

Here embed template will add scope to always be shown only within
instance. Before we have data sources UI the only use case is deleting
data sources along with instances.

Also found jsep enable ternary by default and forbid for now caz there
is no generation implemented anyway.
2023-07-01 23:54:28 +03:00
Bogdan Chadkin 114817c266 Support data source expressions (#1882)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1529

Here introduced two types of data sources into "variable" and
"expression". First stores the value, the second only executable code.

Execute expressions now output results of all expressions so we could
access values globally with "computed" store

Embed template references now allow to define both variable reference
and expression.
2023-06-30 22:22:12 +03:00
Oleg Isonen 42748f27b9 Move body font size and line height to normalize and also fix the values (#1867)
Closes https://github.com/webstudio-is/webstudio-builder/issues/1845

## Description

See issue

## 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-06-29 21:20:21 +02:00
Bogdan Chadkin 37aed7edfa Add expression utilities (#1874)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1529

Here added two utilities:

validateExpression to parse syntax and replace identifier. For parsing
used jsep package which is very limited subset of js.

executeExpression to execute the chain of expressions. The code is
unoptimized and will not cache results between calls. But still should
be fast enough because expressions are indented to be quite simple.
2023-06-29 14:21:10 +03:00
Bogdan Chadkin c5f84b7822 Run eslint from the root with cache (#1854)
While turborepo does not work for us we can try to solve long checks
time with builtin caching. Eslint provides similar one to prettier we
already use.

```
pnpm -r lint
51.53s

pnpm eslint . --ext .ts,.tsx --max-warnings 0
18.10s

pnpm eslint . --ext .ts,.tsx --max-warnings 0 --cache (with cache)
1.82s
```

In this PR I removed all lint scripts in packages and added global one
in the to github workflow. It saves like 30s on my laptop because pnpm.
Already stored cache makes linting almost instant.

Also bumped all eslint dependencies.
2023-06-26 10:08:15 +03:00
Bogdan Chadkin 07c6734f8c Support updating data source values (#1849)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1529

Added data source values store which can be updated from both components
and props panel.

```js
const { setState } = useContext(ReactSdkContext)
const instanceId = getInstanceIdFromComponentProps(props)

setState(instanceId, propName, value)
```
2023-06-25 12:05:02 +03:00
Bogdan Chadkin 730d897039 Support data source insert from template (#1826)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1529

- added data sources store
- added dataSource type to props
- insert data sources from template (prop.dataSourceReference allows to
bind several props to the same data source)
- convert to static prop on copying (simplification until requirements
are clear)
2023-06-21 19:57:42 +03:00
Bogdan Chadkin 36b98ef3f6 Add "show" system prop for conditional rendering (#1724)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1529

Here added system "show" prop which already works to not render
component but has lack of dynamic behavior based on some state.
2023-06-19 21:01:50 +03:00