You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
lir-navcoo
committed
feat(L4): left view switcher + palette-driven drag-and-drop
The two UX gaps the demo exposed:
1. The left icon strip didn't actually drive the left panel —
it was just decorative buttons.
2. There was no way to drag a component from anywhere into the
canvas.
This change wires both ends of the loop.
* designer/Dragon: add `boost(meta, x, y)` so the palette can
start a drag of a not-yet-instantiated component. `commit()`
returns a discriminated union (move | boost) the host can
`switch` on. New events: startBoost, dropBoost, cancelBoost.
* designer: BuiltinSimulatorHost (new) — wires canvas pointer
events to the Dragon. Computes a DropTarget from each
`pointermove` (vertical-thirds algorithm: top → 'before',
middle → 'inside', bottom → 'after') and commits on
`pointerup`. Escape cancels. Window-level pointerup so a
cursor that drifted outside the canvas still commits.
* designer/Project: re-emit the Dragon's boost events on the
Project emitter so plugins can subscribe in one place.
* editor-skeleton: Skeleton now owns a `leftView` state
('outline' | 'components'). The default leftArea renders two
view-switcher buttons (🌳 / 🧩); the left panel body swaps
between OutlineView and the new ComponentPalette. The host
can drive the state via `leftView` + `onLeftViewChange`
(controlled mode).
* editor-skeleton: ComponentPalette (new) — a vertical list of
registered components, each row is a `pointerdown` source for
`dragon.boost`. Pressed-row visual feedback via
startBoost/dropBoost/cancelBoost subscriptions.
* editor-skeleton: Skeleton mounts BuiltinSimulatorHost on the
canvas element as soon as React attaches it (effect deps
canvasEl + project).
* designer: `DocumentModel.rename` now refuses to rename the
document root (parent === null). The root's componentName is
the render entry — renaming it would leave the simulator
with an unresolvable name. Settings panel also hides the
Rename button and shows an italic "root" hint when the root
is the selected node. Both layers guard; the API guard is
the safety net, the UI guard is the friendly face.
* demo: extended leftArea with 🌳/🧩 view switcher buttons,
wired leftView/onLeftViewChange to <Skeleton> in controlled
mode. The user can now flip to the palette, drag a Button
onto the canvas, and watch it insert + auto-select.
0 commit comments