Commit Graph
5224 Commits
Author SHA1 Message Date
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
Ivan Starkov 4046793179 Fix toggle button styles (#1277)
## Description

#1169

## 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-22 23:11:58 +04:00
Oleg Isonen 51f3230b84 Component card (#1275)
## Description


https://www.figma.com/file/xCBegXEWxROLqA1Y31z2Xo/%F0%9F%93%96-Webstudio-Design-Docs?node-id=3217-86010&t=Muy6FruCcEJ5xYIj-4

Card component for adding components to the canvas

<img width="552" alt="Screenshot 2023-03-22 at 18 44 41"
src="https://user-images.githubusercontent.com/52824/226992472-54c71cc5-ab19-4344-9589-04233c5c0ebd.png">


## 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-22 19:17:01 +01:00
Bogdan Chadkin 70b9e7e5cf Preview navigator drop target while dragging canvas (#1276)
Ref https://github.com/webstudio-is/webstudio-builder/issues/248

We need to get rid of legacy preview to move forward with slots. Here
exposed drag item and drop target from tree component. Now we can
connect canvas and navigator.

Note: navigator changes are not yet reflected in canvas while dragging.
2023-03-22 19:36:28 +07:00
Roman Pominov b4a6a67ada Add SectionTitle; Add utility for focusing using arrow keys (#1249)
## Description

Closes #1100
Closes #1271

1. Added `SectionTitle`
https://section-title--638245578b47d4399fba191a.chromatic.com/?path=/story/library-section-title--demo
2. Added basic `ArrowFocus` utility
3. Used the new `SectionTitle` in `CollapsibleSection`, so props and
style panels now use the new `SectionTitle`
4. Made `CollapsibleSection` open by default as specified in #1100

## Steps for reproduction

1. Open style panel
2. Open props panel
3. Check storybook demos by the links above
2023-03-22 15:29:53 +03:00
Oleg Isonen 736e4c1659 Hide outline on mouse out (#1274)
## Description

1. If you mouse over and then mouse out directly to the side, without
hovering other instances, the instance outline gets stuck


## 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-22 13:28:09 +01:00
Bogdan Chadkin 24406491d1 Switch builder to separate placement indicator computing (#1269)
Ref https://github.com/webstudio-is/webstudio-builder/pull/1268

Now all builder UI rely on separate placement computing

- for background layers had to add default getValidChildren to exclude
placement indicator child
- fixed text selecting in safari while dragging with preventDefault on
move
2023-03-22 18:40:10 +07:00
Ivan Starkov 3f4ce56eb7 Borders - part 1 (#1272)
## Description

ref #1169

<img width="230" alt="image"
src="https://user-images.githubusercontent.com/5077042/226687676-eba0e113-844d-44e6-9afa-81dff5746e73.png">


Based on this comment
https://github.com/webstudio-is/webstudio-builder/issues/1169#issuecomment-1478260843
Border Style section is added. As no  section `+` button exists.

IconButton has changed to be in sync with design.
ToggleButten added.

To review start with borders.tsx


## Steps for reproduction

Open Borders section, change style, borders width, radius, individual
radius, individual borders

## Code Review
- [x] hi @rpominov , I need you to do
check that ToggleButton component and its stories are ok.


- [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

- [ ] made a self-review
- [ ] 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-22 14:15:28 +04:00
Ivan Starkov 828e673681 Update version 0.49.0 (#1273)
## Description

Update version 0.49.0 to publish npm


## Steps for reproduction

1. click button
2. expect xyz

## 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

- [ ] 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.49.0
2023-03-21 17:21:43 +04:00
Bogdan Chadkin dc5553b496 Compute indicator placement separately from drop target (#1268)
We need to render placement indicator on both tree and canvas at the
same time. To achieve this we need to be able to compute position from
drop target which should be universal for tree and canvas.

Here introduced computeaIndicatorPlacement utility which accepts info
inferred from cursor but universal for realms.
2023-03-20 10:45:11 +03:00
Bogdan Chadkin c815f069cd Render tree with normalized data (#1267)
We finally able to use normalized data to render tree. A few last
improvements in tree drag and drop add support for slots with
duplicating ids within tree.
2023-03-19 23:49:41 +03:00
Bogdan Chadkin cbd101173c Simplify horizontal shift computation (#1266)
- root and getItemPath are no longer required
- dropTarget.data with instance no longer used, only selector is
necessary
2023-03-18 20:55:32 +03: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
Bogdan Chadkin cde929f344 Refactor tree node with selectors (#1264)
Tree node is a renderer for pages and navigator instances. Selector of
nodes is build by passing parent selectors.

Select and hover callbacks are now provide selectors.
2023-03-18 19:17:54 +03:00
Bogdan Chadkin 60a2380884 Access instance data by id in tree (#1265)
In many cases the logic in tree component rely only on ids and it's
additional complexity to resolve full instances.

Here I rewrite getItemChildren, canAcceptChild and canLeaveParent to
accept instance id instead of instance.
2023-03-18 19:04:43 +03:00
Oleg Isonen 570a9d0a81 Fix stacking context issues for any combobox dropdowns (#1263)
Closes https://github.com/webstudio-is/webstudio-builder/issues/1104

## Description

anything that uses position relative has higher stacking context, in
this case spacing uses position relative, so we always use portal to
prevent the need to use zIndex

## Steps for reproduction

1. open spacing
2. open style sources dropdown
3. it should not overlap

## 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-18 16:53:44 +01:00
Bogdan Chadkin afb2a35863 Support selectors in tree expanded logic (#1258)
Now getIsExpanded and setIsExpanded accept selectors. Though still have
to use findItemById for getChildren utility. Later whole data will be
managed with ids.
2023-03-18 15:17:39 +03:00
Oleg Isonen 245ff1f8ed less cocain for somebody 2023-03-17 23:36:07 +01:00
9585ab8a62 changed word "inherited" to "remote" (#1252)
and word "set" to "local" for parity with code
also changed background.canvas to background.workspace

---------

Co-authored-by: Bot (build-figma-tokens.yml) <bot@localhost>
Co-authored-by: Roman Pominov <rpominov+github@gmail.com>
2023-03-17 09:43:25 +03:00
Oleg Isonen d93937365e Make canvas iframe receive no pointer events for the time of dragging (#1256)
Fixes https://github.com/webstudio-is/webstudio-builder/issues/1213

## Description

when user drags color picker thumb, they can move mouse over canvas,
with CORS canvas will hide the events and we loose control

## Steps for reproduction

1. see video in the issue
2. also affected dragging components onto canvas

## 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-16 19:03:01 +01:00
Bogdan Chadkin aaffa9019e Output item selector on tree drag end (#1257)
Another step further. Now horizontal shift output item selector instead
of item itself.
2023-03-16 16:29:54 +03:00
Bogdan Chadkin ad53dcdcf3 Refactor tree drag item and drop target with selectors (#1253)
Before supporting selector in callbacks need to upport selectors in
data. Here internal drag item and drop target supported as selectors.

In the future these states will be exposed so for drop target added
custom representation without element to allow sending it via pubsub
between realms.
2023-03-16 12:40:59 +03:00
Oleg Isonen 6f6a57c0e1 Remove handled updates from the updates list (#1251)
## Description

Fixes https://github.com/webstudio-is/webstudio-builder/issues/1223

After handling settings update, I forgot to delete the update from the
list, but if the user doesn't unmount component, switches instance, then
unmounts, the same scheduled update is still there and applies to the
new instance

## Steps for reproduction

1. name an instance
2. select a diff instsance
3. switch from settings tab to styles tab

## 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-15 23:34:27 +01:00
Bogdan Chadkin 55aae4491c Pass selected instance selector to tree (#1250)
Selector is a list of ids from root to target to allow identify
instances even with duplicated ids.

Here is the first step to support selectors in navigator. Passing
selected instance selector already helped to get rid of one getItemPath
usage.
2023-03-15 22:48:21 +03:00
Oleg Isonen 6d4fab40b5 Blocking alerts (#1242)
Fixes #198

## Description

1. disables builder in non-chromium browsers
2. disables builder when window is smaller than 900px
3. allows testing in unsupported browsers via feature flag
"unsupportedBrowsers" or "*"

## Steps for reproduction

1. open builder in safari
2. resize the window to < 900 and then return back to 900+

## 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-15 20:27:18 +01:00
Oleg Isonen 50431010e3 update workspace background color closes #1245 2023-03-15 17:58:05 +01:00
Bogdan Chadkin 48559568f5 Simplify horizontal shift (#1248)
Got rid of getItemPathWithPositions. Horizontal shift can compute these
positions with getItemPath and getChildren. Refactored left shift with
for loop.
2023-03-15 12:36:18 +03:00
Bogdan Chadkin e0553200e9 Improve instance hovering (#1236)
Label again started flickering because hovered instance and hovered
outline store changes have delay in between. Solution as before is to
provide all info with outline. Here I just passed both label and
component to get the shape for getInstanceLabel.

Removed react hook from instance hovering and refactored with instance
selectors.
2023-03-14 19:51:34 +03:00
Roman Pominov 4b1a6847a4 Refactor link behaviour in preview (#1237)
## Description

- Removed Link wrapper that used to apply `preserveBuildParams` (part 1
of #1120)
- Removed `preserveBuildParams` completely, because we no longer need it
as we request page switch instead of letting link to navigate
- Removed `mode` parameter from BuildParams, because it's always "edit"
now
- Fixes #1231

## Steps for reproduction

1. Open preview mode
2. Click on some links
2023-03-14 18:06:24 +03:00
Ivan Starkov d50123128d Drag drop background layers (#1238)
## Description

ref #877

- [x] - add storybook 
<img width="305" alt="image"
src="https://user-images.githubusercontent.com/5077042/224958554-b414cf44-6978-4ae1-81e4-fde7403615b7.png">

- [x] - add drag'n'drop

## Steps for reproduction

Add few background layers, drag'n'drop them

## 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

- [ ] 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-14 18:46:07 +04:00
Ivan Starkov 5cf2212b0b Update versions (#1235)
## 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.48.0
2023-03-14 11:35:16 +04:00
Bogdan Chadkin fddb67e924 Rename instance address to instance selector (#1234)
Selector makes more sense and allows to not introduce "instance element"
term.
2023-03-14 00:29:45 +03:00
Bogdan Chadkin bb7b7f73ab Improve instance selection (#1233)
"Click" based implemention had aa few important bugs. Selecting other
instance was not possible when some text was selected in editing mode.
This is consequence of a fix when other instance is selected user select
text and move cursor outside of editor while still selecting.

Here's how all solved. We track both mousedown and mouseup. When their
targets are different we do nothing because this is most likely text
selection or drag'n'drop.

Editing state a little simplified by just looing for closest
contenteditable instead of editing id comparison.

Instance address now computed by traversing dom.
2023-03-13 23:40:19 +03:00
Bogdan Chadkin 91fbdb2ee1 Address selected instance with tree path (#1228)
With slots there can be same ids in one tree so we need new way to
address instances. Here I propose the list from target instance to the
root.

Now instead of computing parents by normalized tree (one instance of
slot can have many parents) we just access already computed list from
rendered tree.

This address can be computed when user click in dom which can be
traversed or it can be passed top-down with props.

The main con of this approach is collaboration. Reparanted instances on
by one user makes "selected address" stale. Though we have similar
situation with single id when instance is deleted.

Isolated mode for slots/components will make this problem less
noticable.
2023-03-13 18:42:54 +03:00
Bogdan Chadkin 25d30967aa Create page on client (#1232)
Newly created instance does not propagate to client because we no longer
reload on navigating to new page.

Here moved page and root instance creation to client with patches.
2023-03-13 18:42:26 +03:00
Andras Bacsai c9cb63eaa3 Add lostpixel to builder (#1230)
## 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-03-13 15:16:42 +01:00
Roman Pominov 47d35ace8f Update Select and Textarea (#1207)
## Description

- Closes #1155
- Closes #1153 
- Closes #1150

1. Added "Nested Icon Label" component:
https://select-textarea--638245578b47d4399fba191a.chromatic.com/?path=/story/library-nested-icon-label--demo
2. Added "Select Button" component:
https://select-textarea--638245578b47d4399fba191a.chromatic.com/?path=/story/library-select-button--demo
3. "Select Button" is now used as Trigger in Select
4. Updated "Text Area":
https://select-textarea--638245578b47d4399fba191a.chromatic.com/?path=/story/library-text-area--demo
2023-03-13 10:22:34 +03:00