Commit Graph
5224 Commits
Author SHA1 Message Date
Bogdan Chadkin 58f3b3f3d5 Cleanup project package (#1358)
Here removed from project package everything not related to project
mannagement.

- project no longer depends on sdk
- style updates types moved to builder
- CanvasData no longer necessary, Data from react-sdk is same
2023-04-04 00:11:37 +07:00
Ivan Starkov d58c9aa73b Background list focus management (#1356)
## Description

closes #877

- [x] - Seems like Esc when layer window is open broken, probably this
PR (not this, just broken will create an issue)

added `focusManagerOptions` to ArrowFocus handleKeyDown
what allows us to create nested focus navigation.


## Steps for reproduction

Create a few background layers and use arrows to navigate.

## Code Review

- [ ] hi @rpominov , 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 17:14:51 +04:00
Bogdan Chadkin e7e52a941e Remove assets data reloading (#1355)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1335

We load initial assets in builder and can stop load it additionally from
rest api. And after all mutations client store can be updated directly.
2023-04-03 19:59:25 +07:00
Bogdan Chadkin 7e440df235 Move css generation from project to sdk (#1354)
Generation of css text relies on components and not related to project
management so better move to sdk.

Also need to fix in saas
(https://github.com/webstudio-is/webstudio-saas/issues/126)
2023-04-03 19:30:45 +07:00
Bogdan Chadkin b4d21aadff Run global prettier check (#1353)
Here add check to have formatting always applied in case git hook was
ignored or not run for some reason.

Cached prettier for whole project is run within 2-3 seconds.
2023-04-03 16:48:10 +07: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
c1ad6c89e6 two new color tokens: (#1352)
background/topbar-hover
background/gradient/horizontal-reverse

and some misc updates

---------

Co-authored-by: Bot (build-figma-tokens.yml) <bot@localhost>
Co-authored-by: Roman Pominov <rpominov+github@gmail.com>
2023-04-03 10:11:39 +03:00
Bogdan Chadkin c5c90f6644 Drop radix icons (#1350)
We have all icons in figma. Here replaced with alternatives or exported
from figma. See diff.
2023-04-03 10:13:46 +07:00
Bogdan Chadkin 98b92c1b34 Update components icons (#1348)
Added icons from figma for components panel

See diff for new icons
2023-04-02 19:05:12 +07:00
Bogdan Chadkin 5f8344b2c4 Drop item state from style sources (#1346)
Ref https://github.com/webstudio-is/webstudio-builder/issues/807

We gonna have more complicated selected state with style source "states"
so better split it into separate prop and simplify disabled state with
boolean.

Also dropped "state" style source.
2023-04-02 18:44:09 +07:00
Bogdan Chadkin 56a071dde3 Update text toolbar icons (#1347)
Added icons from figma for text toolbar. And reused same in props and
component panels.

See diff for new icons
2023-04-02 18:38:37 +07:00
Oleg Isonen 172a6da635 Webflow breakpoints (#1340)
## Description

To enable copy-pasting instances from webflow without creating new
breakpoints, we decided to switch by default to the breakpoints webflow
uses.

User can still switch to mobile-first breakpoints like we had before
once we have a new breakpoints editor, but then when copy/pasting from
webflow they will get the missing breakpoints added if the copied styles
are using those.

I had to temporarily hide the breakpoints editor behind a feature flag
because we need the new editor to allow editing min or max width, so
instead of adjusting this current UI, we need a new one.

I think its not a big deal right now to not have the breakpoints editor,
webflow never had one.

## 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-02 12:15:52 +02:00
Bogdan Chadkin 0dd4869f51 Remove isEditable option from style source (#1344)
Ref https://github.com/webstudio-is/webstudio-builder/issues/807

isEditable is inferrable from the local "source" of style source. And no
need to be passed into every item.
2023-04-01 23:51:51 +07:00
Mateusz Burzyński 051cddfea4 Upgrade to TypeScript 5 (#1345) 2023-04-01 16:09:27 +02:00
Bogdan Chadkin 72b23e45e5 Support style source deletion (#1343)
Ref https://github.com/webstudio-is/webstudio-builder/issues/807

Added "delete" item to style source menu and select last style source by
default in input.
2023-04-01 19:50:27 +07:00
Bogdan Chadkin f8a8115359 Refactor style source menu (#1342)
Ref https://github.com/webstudio-is/webstudio-builder/issues/807

Moved style source menu up to style source input. This way we will not
need to drill a lot of callbacks and only pass menu element.

Later we will add even more callbacks. So this just simplifies further
development.
2023-04-01 18:10:03 +07:00
Bogdan Chadkin 9c316b0499 Enable typescript preserveValueImports (#1341)
This option forces all type imports to have "type" specifier even though
there are other value imports.

TS 5 forces it when new verbatimModuleSyntax is enabled.
2023-04-01 17:47:55 +07:00
Bogdan Chadkin 0d30e1c419 Support cross-project breakpoints copy paste (#1332)
Here added utility to merge pasted breakpoints into existing ones or add
new one if breakpoint does not match any.
2023-04-01 15:06:28 +07:00
Oleg Isonen d29f3b7232 Use alt/option as a modifier for quick reset of properties 2023-03-31 19:34:53 +02:00
Oleg Isonen d1c7a8e28e Remove unnecessary span 2023-03-31 18:55:00 +02:00
Oleg Isonen 94bd88627d Enable reset, add cmd+click shortcut on property names (#1337)
## Description

1. Enabling the popover by default now, users need it asap (still
unstyled)
2. Adding cmd+click for quick access to reset


## 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-31 18:52:19 +02:00
Ivan Starkov 11e73390c2 Normalize css (#1333)
## Description

closes #473 

`${tag}:where([${componentAttribute}=${component}])` where is used to
not increase specificity

- [ ] todo remove from getInheritedInfo, as we don't know ancestor
tagName

## Steps for reproduction

See box-sizing etc props for newly created items

## Code Review

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

- [ ] hi @TrySound , I need you to do
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [x] 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-31 18:31:20 +04:00
Roman Pominov d8af510c0c Fix panel color (#1324)
## Description

1. Fixed panel color. Closes #1245 
2. Also fixed backgrounds in TextField and ToggleGroup

## Steps for reproduction

1. Check a panel with controls like Style Panel
2. Background of the panel have changed and all controls have white
background
2023-03-31 11:27:07 +03:00
Bogdan Chadkin 59b9c6fedc Support cross-project instance copy paste (#1326)
Here a little refactored copy paste instance plugin.

Now we copy all data including slots and tokens though paste write them
as is or do not write at all if already exist.

This let us to not do unnecessary patches for copy paste within project
while still have whole UI pasted in different project.

There is still a problem with pasting styles which always have different
breakpoint ids in each project. We will need to implement merging in
other PR.
2023-03-31 11:38:19 +07:00
Lokeswaran AruljothiandOleg Isonen fbc401c4d4 Add gradient color to Button Component (#1316)
## Description

1. What is this PR about (link the issue and add a short description)
This PR contains the changes for the Gradient color for the button
component

Here is an example of share button with `gradient` color:


https://user-images.githubusercontent.com/74011196/228329202-54f1b143-cc99-47d5-bd17-decf170fbe82.mov


## Steps for reproduction

1. Create a Button component
2. set `color="gradient"` in Button Component

## Code Review

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

## Before requesting a review

- [x] made a self-review
- [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)
- [x] updated [test
cases](https://github.com/webstudio-is/webstudio-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [x] added tests
- [x] 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-30 17:39:02 +02:00
Bogdan Chadkin 2731bfb6f9 Fix instance selector leaking into prod (#1322)
Spread caught us here. instanceselector was spread into components.
2023-03-30 16:36:20 +07:00
Bogdan Chadkin 21c5261529 Fix drop target when sort navigator tree (#1323)
Element was not swapped because slice was not reasigned so
canAcceptChild didn't really work.
2023-03-30 16:35:11 +07:00
Roman Pominov 1cf864c428 Dots that represent items inside closed sections; Fix pages scroll (#1309)
## Description

1. Fixes #1308
2. Closes #1262

## Steps for reproduction

1. Modify some styles
2. Close section, notice the dots
2023-03-30 11:50:52 +03:00
Bogdan Chadkin 2c7184c069 Refactor selected outline with store (#1317)
One less pubsub event replaced with store. Now hovered and selected
logic is similar.
2023-03-30 11:39:36 +07:00
Bogdan Chadkin 73c812a4f4 Upgrade to pnpm 8 (#1320)
Ref https://github.com/pnpm/pnpm/releases/tag/v8.0.0

The new version got a lot of stuff enabled by default including the one
I didn't enabled before "dedupe-peer-dependents" which will make
packages upgrade so much easier.
2023-03-29 18:59:46 +07:00
Bogdan ChadkinandNathan Hammond 2a7340353c Upgrade turbo (#1319)
Rebased https://github.com/webstudio-is/webstudio-builder/pull/1111.
Took all changes which already work. Will try to enable caching in
separate PR.

---------

Co-authored-by: Nathan Hammond <nathan.hammond@vercel.com>
2023-03-29 18:54:19 +07:00
Bogdan Chadkin bba102d857 Replace lodash string utilities with change-case (#1318)
Change case is a cool collection of string utilities. See
https://github.com/blakeembrey/change-case

Here replaced lodash snakecase and capitlize used for humanizeString
with single title-case from that collection.

Also dropped other unused lodash packages.
2023-03-29 15:10:08 +07:00
Bogdan Chadkin 1163d2c863 Remove scroll state from builder as not useful (#1315)
Scroll state in builder used only to hide select, hover and text toolbar
while scrolling. Though they all already track scrolling to do the same
and more importantly restore state after scroll. So there is no need to
have it builder.
2023-03-29 01:37:32 +07:00
Bogdan Chadkin 1d62927462 Refactor text toolbar state (#1314)
- refactored with synchronized client store
- recompute toolbar position on scroll end
2023-03-29 00:41:12 +07:00
Ivan Starkov 13db987237 Fix atoms leak (#1312)
## Description

Atom data leaked into the server canvas.
ref #1313 

## Steps for reproduction

Open Vercel app. Any project. Reload a few times not fast to avoid
scaling.
Get the iframe link, then open it. Should be empty.

New relic logs must contain:
```
{
    assetsStore: 0,
    pagesStore: 0,
    instancesStore: 0,
}
```

New relic query 
`"proxy.path":"*71f88d3e-9231-489e-8ba0-8adc10215335*"
"message":"*assetsStore*"`
where `71f88d3e-9231-489e-8ba0-8adc10215335` is your project id 
(add vercel host 


## 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
- [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
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
0.51.1
2023-03-28 19:47:32 +04:00
Ivan Starkov daf932837c Update npm (#1311)
## 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
0.51.0
2023-03-28 16:08:38 +04:00
Bogdan Chadkin 3edd4ea3cc Optimize canvas loading (#1310)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1044
https://github.com/webstudio-is/webstudio-builder/issues/360

Canvas no longer need to load any data. No longer need pages. No longer
need auth token. No longer need static css.

Here I cleaned all unnecessary logic to load canvas. It may load much
faster now.
2023-03-28 19:02:02 +07:00
Bogdan Chadkin 68af3b58b6 Fix possible cyclic slot and hide its styles and props panels (#1306)
One cyclic case I missed. When paste slot into itself as target then
check miss unresolved fragment inside. Here added additional check
before copying and covered with tests.

For slots show only settings panel.
2023-03-28 18:46:18 +07:00
Ivan Starkov 83e2c01dc5 Border style (#1307)
## Description

ref #1169 

BorderStyle now is toggle group

<img width="225" alt="image"
src="https://user-images.githubusercontent.com/5077042/228191674-83d8dd64-490a-4a15-8307-c64ae425d74f.png">

## Steps for reproduction

Open borders, set

## Code Review

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

## Before requesting a review

- [x] made a self-review
- [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
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-03-28 15:29:08 +04:00
Oleg Isonen e87eeaa006 Support minWidth and maxWith in media queries, both are optional (#1305)
## Description

This is in preparation for supporting webflow breakpoints which use a
combination of min and max width
## 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-28 11:42:55 +02:00
Roman Pominov 3279d6fc78 Props panel: basic URL control (#1280)
If this looks good, I will not merge it right away, but open a PR in
`webstudio-saas`

## Description

- #993 

1. Added a new type of Prop `{type: "page"}`, similar to `{type:
"asset"}`
2. Added `pagesStore` to `ReactSdkContext` (will need to make changes to
`webstudio-saas` as well to support this)
3. Added a new control type `{control: "url"}` and corresponding
`<UrlControl>`
4. Updated Link components: 
   - set `{control: "url"}` for the `href` prop
   - made them support `{type: "page"}` as `href`
   - simplified / cleaned up

## Steps for reproduction

1. Add a link
2. Set a page as `href` in props panel
3. Try clicking on the link in preview mode
2023-03-28 11:05:32 +03:00
Ivan Starkov 524882fd0e Update versions (#1303)
## Description

npm version changes

## 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
0.50.0
2023-03-27 22:31:09 +04:00
Oleg Isonen e67aa302fc Fix object position layout (#1302)
## Description

Object position doesn't fit the grid layout like other elements have in
size section


## 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-27 20:29:45 +02:00
Ivan Starkov 6f03fc06b2 Fix border-color (#1300)
## Description

ref #1169 

Fixes bug that only borderTopColor changed 

Was:
<img width="230" alt="image"
src="https://user-images.githubusercontent.com/5077042/228027729-5c6496ea-2f45-4346-9d95-152f9283dda8.png">

Now:
<img width="233" alt="image"
src="https://user-images.githubusercontent.com/5077042/228028039-c376a5a4-4651-4a58-b2ad-62179c5a92eb.png">


## Steps for reproduction

Change borderStyle then change borderColor see all border colors has
changed

## Code Review

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

## Before requesting a review

- [x] made a self-review
- [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
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-03-27 22:15:24 +04:00
Bogdan Chadkin 12814190d7 Implement slots (#1294)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1116

Slot is copy pastable part of the tree which is always in sync. Kinda
like primitive components.

The idea is the following. Slot is copy pasted as any other instance
though its children are preserved as is without cloning with new ids.

This lead to the problem with multiple slot children. While copy paste
they are preserved as is though when add new child to slot, the other
instance of it will not get new child.

To workaround this we add another Fragment component which groups all
children into single one and new children are always reflected in all
slot copies.
2023-03-28 00:48:02 +07:00
Bogdan Chadkin 6854ea950a Upgrade remix (#1299)
Small releases

https://github.com/remix-run/remix/releases/tag/remix%401.13.0
https://github.com/remix-run/remix/releases/tag/remix%401.14.0
2023-03-28 00:38:18 +07:00
Ivan Starkov e5e22e6f6d Background title section (#1279)
## Description

ref #877 

- [x] - Use + in the title instead of "Add background" button
- [x] - Label colors should be moved somewhere outside of Layer items
- [x] - Fix theme.spacing, do not use px values



## Steps for reproduction

Open backgrounds play with it.

## Code Review

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

- [ ] hi @kof I want you
  - 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
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-03-27 15:08:28 +04:00
Bogdan Chadkin 13e2298c97 Upgrade tsx (#1298)
Bumped esbuild inside tsx to the latest version.
2023-03-27 17:49:19 +07:00
Bogdan Chadkin 9b6511f4e2 Migrate style computing to instance selectors (#1291)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1116

This is the last one slots blocker for sure.

Refactored inherited styles to compute from selectors and got rid of
legacy traverser utility.
2023-03-27 17:45:27 +07:00
Bogdan Chadkin 1d9407fde7 Compute bounding box by children when display: contents (#1296)
Slots have display: contents to not affect layout. So we need a way to
show correct hover and selected state. Here's added utility to traverse
all descendants and get their rects and then compute the sum of those
rects.
2023-03-27 17:40:42 +07:00