Commit Graph
3410 Commits
Author SHA1 Message Date
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
Bogdan Chadkin 53ba9abc69 Fix tree level to render root without collapse icon (#1295)
Lost pixel caught this issue with tree. Level is incremented
inconsistenly. Here incremented only for nested tree node.
2023-03-27 17:35:28 +07:00
Bogdan Chadkin 7ec230462b Upgrade esbuild (#1297)
- got rid of unused esbuild-node-externals package
- removed esbuild override/resolution to old version
- deduplicateed webpack 4 and 5 into single 4 instance
- upgraded esbuild to the latest version with "context" api instead of
incremental flag which potentially forces to fix the issue with remix
once they upgrade

Esbuild bump fixed the issue with remix going infinite watch loop after
any changes in packages and looks like esbuild in remix no longer blocks
parallel turbo run!!!
2023-03-27 14:36:57 +07:00
Bogdan Chadkin f53c839fe6 Allow to hide any item in the tree (#1293)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1116

We need this to hide Fragment instance in navigator which is an implicit
child of slot with persistent id.
2023-03-26 18:44:29 +07:00
Bogdan Chadkin 407955c6c0 Cancel tree drag (#1292)
Drag end is called conditionally and I forgot to handle cancel event.
2023-03-26 18:44:15 +07:00
Oleg Isonen b22dfe038e Components Panel (#1284)
## Description

Implements all design changes and accessibility for components add panel



https://user-images.githubusercontent.com/52824/227720011-344b31f8-ce17-4d13-ad4d-2d506ca3bcce.mp4



## 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-03-26 13:36:05 +02:00
Bogdan Chadkin 919d560396 Delete pages with stores (#1289)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1084

Now whole pages management is managed by immerhin patches. Got rid of
pages/$projectId endpoint and no longer used form utils.
2023-03-25 18:56:24 +07:00
Bogdan Chadkin 3592df7bba Migrate text editing to selector (#1287)
The last piece to address instances by selectors

- the mode is represented as text editing instance selector
- reset editing mode along with selection on user input instead of
ssubscribing to selected store
- moved enter/esc shortcuts to shared between builder and canvas
- got rid of legacy subscriptions to stores
2023-03-25 11:35:29 +07:00
Bogdan Chadkin 92342a22a4 Update pages with store (#1288)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1084
https://github.com/webstudio-is/webstudio-builder/issues/1286

Currently only create page patches propagate to canvas. Here migrated
update to immerhin too.
2023-03-25 11:35:15 +07:00
Bogdan Chadkin cd0e01ea56 Select span node with selector (#1285)
Here bit less straightfforward as lexical<>instances conversion is not
very straightfforward because lexical represents a few instances with
its formats.

To solve conversion complexity used almost same ancestor traverser as
before but finish once eiditing node is reached.

Pass instance selector for each webstudio-component ot identify selected
and editing instances.
2023-03-24 23:06:31 +07:00
Bogdan Chadkin bac73301c8 Refactor insert and reparent operations with selectors (#1283)
- in many places root check can be replaced with selector.length === 1
- reparent and insert utilities now accept selectors
- findClosestDroppableTarget output end instead of last index and always
fallback to root
2023-03-24 14:56:30 +07:00
Bogdan Chadkin cb020a7a06 Provide drag origin for canvas and side panel (#1282)
I broke in one of recent PRs drag origin. Here put it back to support
hiding components panel to show preview.
2023-03-24 00:12:10 +07:00
Oleg Isonen 5fb2d6f74d Replace card component (#1281)
## Description

1. Replaces card component in the add component panel

This doesn't add all design changes yet

## 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-23 17:02:12 +01:00
Bogdan Chadkin f1750dde04 Refactor canvas drag and drop to rely on instance selectors (#1278)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1116

Drag payload produce 2 kinds of actions insert and reparent and output
tree compatible drop target.
2023-03-23 16:35:55 +07:00
Bogdan Chadkin 863ca74688 Replace tree preview with navigator tree (#1239)
Ref https://github.com/webstudio-is/webstudio-builder/issues/248

Tree preview requires a lot of work to support with all data changes
2023-03-23 10:24:08 +07:00