Commit Graph
12 Commits
Author SHA1 Message Date
Bogdan Chadkin 39579c904b feat: preserve last selected style source on instances (#2873)
Fixes https://github.com/webstudio-is/webstudio/issues/2575
2024-02-06 20:22:59 +07:00
Oleg Isonen b2bf220ed6 chore: Rename all *Store to $store (#2747)
## Description

Pure renaming, nothing else.

## 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/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
2024-01-09 13:32:51 +01:00
Bogdan Chadkin cac813f2b6 refactor: move click canvas event to commands (#2514)
One less pubsub event replaced with clickCanvas.
Added store for sidebar active panel to manage from commands.

## Steps for reproduction

1. close breakpoints menu by clicking on canvas
2. close sidebar panel by clicking on canvas
2023-10-21 00:50:25 +04:00
Bogdan Chadkin abc7acbc55 Reimplement instance selection with pointer events (#2199)
Here improved instance selection by using pointerdown and pointerup.
This solves issues with libraries like radix preventing firing mouse
events.

Though there is a problem. Pointer events do not support event.detail to
inform about double clicks. So here I implemented multiple clicks
detection. For this I track time between latest pointerup and next
pointerdown events.
2023-08-27 21:00:25 +04:00
Bogdan Chadkin dcae1b5a9d Allow inserting into editable containers (#1735)
Here I removed "rich-text" type from components. Instead "container" can
be edited when has only text or rich text children.

And any time user can drop into editablle container which will wrap all
text and rich text children into "Span" component.

Had to implement position adjustment to consider text children which do
not have representation in navigator tree and canvas dnd.

Span has temporary SpanContainer name to not conflict with existinig
Span for styled text in rich text. Will rename in other PR when remove
no longer necessary components.
2023-06-10 00:55:46 +03:00
Bogdan Chadkin 7c6d06bfd8 Use meta stored in atom in builder and canvas (#1687)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1545

All complex use cases already switched to get meta from arguments and
from atom.

Here migrated the last cases and dropped legacy meta register in
react-sdk package. Now we ready to split components into separate
packages.
2023-05-30 17:45:12 +07:00
Bogdan Chadkin a148507e48 Render style states (#1420)
Ref https://github.com/webstudio-is/webstudio-builder/issues/807

Refactored styles rendering in canvas to consider states and added style
states support to css text renderer.
2023-04-17 15:50:14 +07:00
Oleg Isonen 48b4980d12 Breakpoints redesign stage 2 (#1366)
## Description

- Canvas behavior should be exactly as in Webflow now - responsive
canvas.
- No constraints for resizing, you can switch to different breakpoints
when you change the canvas width just like in preview

## Not done in this PR

- [ ] breakpoints dropdown menu redesign
- [ ] on-canvas resizable handles
- [ ] flash-animate breakpoints list when breakpoint is switched through
resize
- [ ] flash-animate left and right borders when breakpoint is switched
- [ ] gravity of resize handle dragging when reaching next breakpoint
- [ ] vertical labels with @media example that matches current
breakpoint
- [ ] migrate min-width 0 breakpoints to base?
- [ ] hide outline while changing size
- [ ] ensure there is never both min and max in one media

## Todo

- [x] draggable positioning calc
- [x] shortcuts for zoom
- [x] sync width and selected breakpoint
- [x] remove scale
- [x] fix mobile-first breakpoints
- [x] tabbable toolbar items
- [x] icon for base
- [x] fix flicker
- [x] After breakpoint delete/add CascadeIndicator doesn't refresh
- [x] fix when there is no base, min-width 0 should have still a full
width

## Steps for reproduction

1. click button
3. expect xyz

## Code Review

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

## Before requesting a review

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

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-04-09 20:19:12 +02: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 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
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