AI-native design editor. Open-source Figma alternative.
Sync specs and docs with master: components, context menu, z-order, visibility, lock
Anton A S6d90528bde0d
diff --git a/docs/development/roadmap.md b/docs/development/roadmap.mdindex 208fdc190..03d5bb21e 100644--- a/docs/development/roadmap.md+++ b/docs/development/roadmap.md@@ -52,12 +52,25 @@ Properties panel, layers panel, toolbar, Yoga layout integration, text editing.- Canvas background color per page- Fig-import unit tests, layout unit tests, layers-panel E2E tests-### Phase 4: Components + Variables π²+### Phase 4: Components + Variables π‘Components, instances, overrides, variants, variables, collections, modes/themes.+**Delivered:**+- Component creation from frame/group or multi-selection (β₯βK)+- Component sets from multiple components (β§βK) with dashed purple border+- Instance creation from components with child cloning+- Detach instance back to frame (β₯βB)+- Go to main component (cross-page navigation)+- Always-visible purple component/instance labels with diamond icon+- Opaque container hit testing (click selects component, double-click enters)+- Right-click context menu with clipboard, z-order, grouping, component, visibility, lock, move-to-page actions+- Z-order manipulation (] bring to front, [ send to back)+- Toggle visibility (β§βH) and lock (β§βL)+- Move nodes between pages via context menu+- Viewport culling, Paint reuse, RAF render coalescing+**Planned:**-- Component creation and instantiation- Override propagation- Variant switching- Variable collections with modes (light/dark)@@ -93,6 +106,6 @@ Prototyping, comments, desktop distribution, documentation, public launch.| Phase 1: Core Engine | 3 months | β Complete || Phase 2: Editor UI + Layout | 3 months | β Complete || Phase 3: File I/O + Visual Features | 2 months | β Complete |-| Phase 4: Components + Variables | 2 months | π² Planned |+| Phase 4: Components + Variables | 2 months | π‘ In Progress || Phase 5: AI Integration | 2 months | π² Planned || Phase 6: Polish + Distribution | 2 months | π² Planned |diff --git a/docs/guide/features.md b/docs/guide/features.mdindex 861ada2fe..c4cf49151 100644--- a/docs/guide/features.md+++ b/docs/guide/features.md@@ -86,6 +86,32 @@ The CanvasKit renderer supports full Tier 1 visual features for Figma rendering- **Effects** β drop shadow, inner shadow, layer blur, background blur, foreground blur- **Stroke properties** β cap (none, round, square, arrow), join (miter, bevel, round), dash patterns- **Arc data** β partial ellipses with start/end angle and inner radius (donuts)+- **Viewport culling** β off-screen nodes are skipped during rendering+- **Paint reuse** β Skia Paint objects are recycled across frames instead of reallocated+- **RAF coalescing** β multiple render requests within one frame are batched into a single `requestAnimationFrame` call++## Components & Instances++Create reusable components from frames or selections (<kbd>β₯</kbd><kbd>β</kbd><kbd>K</kbd>). A single frame converts in-place to a COMPONENT; multiple nodes wrap in a new component. Combine multiple components into a COMPONENT_SET (<kbd>β§</kbd><kbd>β</kbd><kbd>K</kbd>) with a dashed purple border. Create instances from components via context menu β instances copy the component's visual properties and children. Detach an instance back to a frame with <kbd>β₯</kbd><kbd>β</kbd><kbd>B</kbd>. "Go to main component" navigates to and selects the source component, switching pages if needed.++Components and instances display always-visible purple labels with a diamond icon showing the node name. They act as opaque containers for selection β clicking selects the component itself, double-clicking enters it to select children.++## Context Menu++Right-click on the canvas opens a Figma-style context menu. Actions adapt to the current selection:++- **Clipboard** β Copy, Cut, Paste here, Duplicate, Delete+- **Z-order** β Bring to front, Send to back+- **Grouping** β Group, Ungroup, Add auto layout+- **Components** β Create component, Create component set, Create instance, Go to main component, Detach instance (purple-styled items)+- **Visibility** β Hide/Show, Lock/Unlock+- **Move to page** β submenu with all other pages++Right-clicking a node selects it first. Right-clicking empty canvas clears selection.++## Z-Order, Visibility & Lock++<kbd>]</kbd> brings selected nodes to front, <kbd>[</kbd> sends to back within their parent. <kbd>β§</kbd><kbd>β</kbd><kbd>H</kbd> toggles visibility β hidden nodes stay in the layers panel but don't render. <kbd>β§</kbd><kbd>β</kbd><kbd>L</kbd> toggles lock β locked nodes can't be selected or moved from the canvas. Move nodes between pages via the context menu's "Move to page" submenu.## Desktop Appdiff --git a/docs/guide/figma-comparison.md b/docs/guide/figma-comparison.mdindex a63fbce9a..ccabd171e 100644--- a/docs/guide/figma-comparison.md+++ b/docs/guide/figma-comparison.md@@ -6,7 +6,7 @@ Feature-by-feature comparison of Figma Design capabilities with Open Pencil's cuβ Supported β feature works end-to-end Β· π‘ Partial β core behavior exists, some sub-features missing Β· π² Not yet implemented:::-**Coverage:** ~43 of ~90 Figma Design feature areas addressed (48%). Last updated: 2026-02-28.+**Coverage:** ~50 of ~90 Figma Design feature areas addressed (56%). Last updated: 2026-02-28.## Interface & Navigation@@ -21,7 +21,8 @@ Feature-by-feature comparison of Figma Design capabilities with Open Pencil's cu| Canvas background color | β | Per-page background via properties panel || Canvas guides | π² | Figma supports draggable guides from rulers || Actions menu / command palette | π² | Figma's quick actions search |-| Keyboard shortcuts | π‘ | Core shortcuts implemented; Scale, Arrow, Pencil, z-order, flip, text formatting not yet wired |+| Context menu | β | Right-click with clipboard, z-order, grouping, component, visibility, lock, move-to-page actions |+| Keyboard shortcuts | π‘ | Core shortcuts + components + z-order + visibility/lock implemented; Scale, Arrow, Pencil, flip, text formatting not yet wired || Find and replace | π² | Text search/replace across document || Layer outlines view | π² | Wireframe view of all layers || Custom file thumbnails | π² | Thumbnail generated on export, but no custom thumbnail picker |@@ -44,9 +45,11 @@ Feature-by-feature comparison of Figma Design capabilities with Open Pencil's cu| Alignment & position | β | Position, rotation, dimensions in properties panel || Copy & paste objects | β | Standard clipboard + Figma fig-kiwi binary format || Scale layers proportionally | π‘ | Shift-resize constrains proportions; no dedicated Scale tool (K) |-| Lock & unlock layers | π² | Lock to prevent selection/editing |-| Toggle layer visibility | β | Eye icon in layers panel |-| Rename layers | π² | Layers use default names; no inline rename in layers panel |+| Lock & unlock layers | β | β§βL toggles lock; locked nodes can't be selected/moved from canvas |+| Toggle layer visibility | β | Eye icon in layers panel + β§βH keyboard shortcut |+| Rename layers | π‘ | Programmatic rename via store; no inline rename UI in layers panel yet |+| Bring to front / Send to back | β | ] and [ keyboard shortcuts; also in context menu |+| Move to page | β | Move selected nodes between pages via context menu || Constraints (responsive resize) | π² | Pin edges/center for parent resize behavior || Smart selection (distribute/align) | π² | Evenly space and align multi-selection || Layout guides (columns, rows, grid) | π² | Column/row/grid overlay guides on frames |@@ -150,16 +153,18 @@ Feature-by-feature comparison of Figma Design capabilities with Open Pencil's cu| Feature | Status | Notes ||---------|--------|-------|-| Create components | π² | Planned for Phase 4 |-| Component instances | π² | Planned for Phase 4 |-| Variants | π² | Planned for Phase 4 |+| Create components | π‘ | β₯βK creates from frame/group or wraps selection; no component properties UI yet |+| Component sets | π‘ | β§βK combines components; dashed purple border; no variant property editing |+| Component instances | π‘ | Create instance from context menu with child cloning; no override editing UI |+| Variants | π² | Variant switching and property-based selection || Component properties | π² | Boolean, text, instance swap properties |-| Override propagation | π² | Planned for Phase 4 |+| Override propagation | π² | Changes to main component do not propagate to instances yet || Variables (color, number, string, boolean) | π² | Planned for Phase 4 || Variable collections & modes | π² | Light/dark themes via variable modes || Styles (color, text, effect, layout) | π² | Reusable named style presets || Libraries (publish, share, update) | π² | Shared component/style libraries |-| Detach instance | π² | Convert instance back to frame |+| Detach instance | β | β₯βB converts instance back to frame |+| Go to main component | β | Navigate to source component, cross-page |## Prototypingdiff --git a/docs/reference/keyboard-shortcuts.md b/docs/reference/keyboard-shortcuts.mdindex 369fa6adf..cd7f78b2d 100644--- a/docs/reference/keyboard-shortcuts.md+++ b/docs/reference/keyboard-shortcuts.md@@ -75,14 +75,19 @@ Full Figma-compatible shortcut map. β = implemented.| <kbd>β</kbd><kbd>G</kbd> | Group Selection | β || <kbd>β§</kbd><kbd>β</kbd><kbd>G</kbd> | Ungroup | β || <kbd>β§</kbd><kbd>A</kbd> | Add Auto Layout | β |-| <kbd>β₯</kbd><kbd>β</kbd><kbd>K</kbd> | Create Component | |-| <kbd>β₯</kbd><kbd>β</kbd><kbd>B</kbd> | Detach Instance | |+| <kbd>β₯</kbd><kbd>β</kbd><kbd>K</kbd> | Create Component | β |+| <kbd>β§</kbd><kbd>β</kbd><kbd>K</kbd> | Create Component Set | β |+| <kbd>β₯</kbd><kbd>β</kbd><kbd>B</kbd> | Detach Instance | β || <kbd>β</kbd><kbd>]</kbd> | Bring Forward | || <kbd>β₯</kbd><kbd>β</kbd><kbd>]</kbd> | Bring to Front | |+| <kbd>]</kbd> | Bring to Front | β || <kbd>β</kbd><kbd>[</kbd> | Send Backward | || <kbd>β₯</kbd><kbd>β</kbd><kbd>[</kbd> | Send to Back | |+| <kbd>[</kbd> | Send to Back | β || <kbd>β§</kbd><kbd>H</kbd> | Flip Horizontal | || <kbd>β§</kbd><kbd>V</kbd> | Flip Vertical | |+| <kbd>β§</kbd><kbd>β</kbd><kbd>H</kbd> | Toggle Visibility | β |+| <kbd>β§</kbd><kbd>β</kbd><kbd>L</kbd> | Toggle Lock | β || <kbd>β</kbd><kbd>E</kbd> | Flatten | |## Textdiff --git a/openspec/changes/archive/2026-02-28-sync-master-features/.openspec.yaml b/openspec/changes/archive/2026-02-28-sync-master-features/.openspec.yamlnew file mode 100644index 000000000..34b5b2315--- /dev/null+++ b/openspec/changes/archive/2026-02-28-sync-master-features/.openspec.yaml@@ -0,0 +1,2 @@+schema: spec-driven+created: 2026-02-28diff --git a/openspec/changes/archive/2026-02-28-sync-master-features/design.md b/openspec/changes/archive/2026-02-28-sync-master-features/design.mdnew file mode 100644index 000000000..5e354bce5--- /dev/null+++ b/openspec/changes/archive/2026-02-28-sync-master-features/design.md@@ -0,0 +1,28 @@+## Context++13 commits from master added components/instances, context menu, and rendering optimizations. The docs branch has specs and VitePress docs that predate these features. This change synchronizes documentation artifacts with the actual codebase state.++## Goals / Non-Goals++**Goals:**+- All new capabilities have corresponding spec requirements and scenarios+- VitePress docs accurately reflect current feature set+- Figma Feature Matrix reflects the new status of implemented features++**Non-Goals:**+- No source code changes+- Not adding specs for low-level implementation details (RAF coalescing, paint reuse are perf optimizations, not user-facing requirements)++## Decisions++### 1. Two new specs: `components` and `context-menu`++Components are a major feature area deserving their own spec. Context menu is a distinct UI capability with its own action set.++### 2. Viewport culling goes into `canvas-rendering` as a modified requirement++Culling changes rendering behavior (off-screen nodes are skipped) so it modifies the rendering spec.++### 3. Keyboard shortcuts documented in `editor-ui` spec, not a separate spec++The shortcuts are part of the editor UI, consistent with existing pattern where `editor-ui` covers keyboard interactions for tools and panels.diff --git a/openspec/changes/archive/2026-02-28-sync-master-features/proposal.md b/openspec/changes/archive/2026-02-28-sync-master-features/proposal.mdnew file mode 100644index 000000000..9c7898d1b--- /dev/null+++ b/openspec/changes/archive/2026-02-28-sync-master-features/proposal.md@@ -0,0 +1,31 @@+## Why++13 commits merged from master introduce components/instances, context menu, z-order, visibility/lock, move-to-page, viewport culling, and rendering optimizations. The openspec specs and VitePress docs don't reflect these new capabilities. The Figma Feature Matrix also needs status updates.++## What Changes++- Update specs to cover: components (create, instance, detach, go-to-main, component sets), context menu, z-order (bring to front/send to back), visibility toggle, lock/unlock, move-to-page, rename node, viewport culling, rendering optimizations (RAF coalescing, paint reuse)+- Update `docs/guide/features.md` with new features+- Update `docs/guide/figma-comparison.md` statuses (components partial, z-order β , lock/visibility β , rename β , context menu β )+- Update `docs/reference/keyboard-shortcuts.md` with newly implemented shortcuts+- Update `docs/development/roadmap.md` β Phase 4 partially started++## Capabilities++### New Capabilities+- `components`: Components, component sets, instances β create, instantiate, detach, go-to-main component, component labels+- `context-menu`: Right-click context menu with clipboard, z-order, grouping, component, visibility, lock, and move-to-page actions++### Modified Capabilities+- `scene-graph`: New methods β cloneTree, createInstance, detachInstance, getMainComponent, getInstances, hitTestDeep; componentId/overrides fields on SceneNode+- `canvas-rendering`: Viewport culling, component label rendering, component set dashed border, Paint reuse, RAF coalescing+- `selection-manipulation`: Components/instances are opaque containers (click selects whole, double-click enters); z-order (bring to front, send to back); toggle visibility; toggle lock; move to page; rename node+- `editor-ui`: Context menu integration, component keyboard shortcuts (β₯βK, β₯βB, β§βK), z-order shortcuts (], [), visibility (β§βH), lock (β§βL)+- `vitepress-docs`: Update features, keyboard shortcuts, roadmap, figma comparison pages+- `figma-comparison-docs`: Status updates for newly implemented features++## Impact++- `openspec/specs/` β 2 new specs, 6 modified specs+- `docs/` β 4 pages updated (features, keyboard-shortcuts, roadmap, figma-comparison)+- No source code changes β specs and docs sync onlydiff --git a/openspec/changes/archive/2026-02-28-sync-master-features/specs/canvas-rendering/spec.md b/openspec/changes/archive/2026-02-28-sync-master-features/specs/canvas-rendering/spec.mdnew file mode 100644index 000000000..4a4933526--- /dev/null+++ b/openspec/changes/archive/2026-02-28-sync-master-features/specs/canvas-rendering/spec.md@@ -0,0 +1,47 @@+## ADDED Requirements++### Requirement: Viewport culling+The renderer SHALL skip drawing nodes whose bounding boxes are entirely outside the visible viewport. Export rendering SHALL disable culling to render all nodes.++#### Scenario: Off-screen node skipped+- **WHEN** a node is completely outside the visible viewport+- **THEN** the renderer does not draw it++#### Scenario: Export renders all nodes+- **WHEN** `renderSceneToCanvas` is called for export+- **THEN** all nodes are rendered regardless of viewport position++### Requirement: Component label rendering+The renderer SHALL draw purple labels for COMPONENT, COMPONENT_SET, and INSTANCE nodes. Labels appear above the node (or inside for COMPONENT_SET children) with a diamond icon and node name.++#### Scenario: Instance label+- **WHEN** an INSTANCE named "Button" is on canvas+- **THEN** a purple label "Button" with diamond icon is rendered above it++### Requirement: Component set border rendering+The renderer SHALL draw COMPONENT_SET nodes with a dashed purple border (6px dash, 4px gap, 1.5px stroke width).++#### Scenario: Dashed border+- **WHEN** a COMPONENT_SET is visible on canvas+- **THEN** its border is rendered as dashed purple lines++### Requirement: Component label hit testing+The renderer SHALL support `hitTestComponentLabel(graph, x, y)` returning the node whose label was clicked, enabling click-to-select via label.++#### Scenario: Click component label+- **WHEN** user clicks on a component's purple label+- **THEN** the component is selected++### Requirement: Paint object reuse+The renderer SHALL reuse Skia Paint objects across frames instead of allocating new ones per render call.++#### Scenario: Multiple renders+- **WHEN** the scene is rendered 60 times per second+- **THEN** Paint objects are reused, not reallocated each frame++### Requirement: RAF render coalescing+The renderer SHALL coalesce multiple render requests within a single frame using `requestAnimationFrame`, rendering at most once per animation frame.++#### Scenario: Rapid state changes+- **WHEN** 10 state changes trigger renders within one frame+- **THEN** only one actual render occursdiff --git a/openspec/changes/archive/2026-02-28-sync-master-features/specs/components/spec.md b/openspec/changes/archive/2026-02-28-sync-master-features/specs/components/spec.mdnew file mode 100644index 000000000..8952c3fb4--- /dev/null+++ b/openspec/changes/archive/2026-02-28-sync-master-features/specs/components/spec.md@@ -0,0 +1,65 @@+## ADDED Requirements++### Requirement: Create component from selection+The editor SHALL convert selected frames/groups to COMPONENT type, or wrap multiple selected nodes in a new COMPONENT node (β₯βK). Single frame/group converts in-place; multiple nodes wraps in a bounding component.++#### Scenario: Convert frame to component+- **WHEN** user selects a single frame and presses β₯βK+- **THEN** the frame's type changes to COMPONENT++#### Scenario: Wrap multiple nodes in component+- **WHEN** user selects three rectangles and presses β₯βK+- **THEN** a COMPONENT node wraps them, positioned at their bounding box++### Requirement: Create component set from components+The editor SHALL combine multiple selected COMPONENT nodes into a COMPONENT_SET container (β§βK). The set gets a dashed purple border and a 40px padding around its children.++#### Scenario: Create component set+- **WHEN** user selects two COMPONENT nodes and presses β§βK+- **THEN** a COMPONENT_SET wraps them with dashed purple border++### Requirement: Create instance from component+The editor SHALL create an INSTANCE node from a COMPONENT, copying its visual properties and children. The instance is placed 40px to the right of the source component.++#### Scenario: Create instance via context menu+- **WHEN** user right-clicks a component and selects "Create instance"+- **THEN** an INSTANCE appears to the right, visually identical to the component++### Requirement: Detach instance+The editor SHALL convert an INSTANCE back to a regular FRAME, clearing its componentId and overrides (β₯βB).++#### Scenario: Detach instance+- **WHEN** user selects an instance and presses β₯βB+- **THEN** the instance becomes a FRAME with no component link++### Requirement: Go to main component+The editor SHALL navigate to and select the main COMPONENT for a selected INSTANCE, switching pages if needed.++#### Scenario: Navigate to main component+- **WHEN** user right-clicks an instance and selects "Go to main component"+- **THEN** the main component is selected and centered in the viewport++### Requirement: Component labels+The renderer SHALL draw always-visible purple labels above COMPONENT and INSTANCE nodes (or inside COMPONENT_SET children). Labels show the node name with a diamond icon.++#### Scenario: Component label visible+- **WHEN** a COMPONENT node exists on canvas+- **THEN** a purple label with the component name is rendered above it++### Requirement: Component set visual treatment+COMPONENT_SET nodes SHALL render with a dashed purple border (6px dash, 4px gap, 1.5px width) instead of a solid border.++#### Scenario: Component set border+- **WHEN** a COMPONENT_SET is on canvas+- **THEN** it renders with a dashed purple border++### Requirement: Opaque container hit testing+COMPONENT and INSTANCE nodes SHALL behave as opaque containers for hit testing β clicking selects the component/instance itself, not its children. Children are accessible only via double-click (deep hit test).++#### Scenario: Click on component child+- **WHEN** user clicks a rectangle inside a component+- **THEN** the component is selected, not the rectangle++#### Scenario: Double-click into component+- **WHEN** user double-clicks a child inside a component+- **THEN** the child is selected (deep selection)diff --git a/openspec/changes/archive/2026-02-28-sync-master-features/specs/context-menu/spec.md b/openspec/changes/archive/2026-02-28-sync-master-features/specs/context-menu/spec.mdnew file mode 100644index 000000000..79ecba57a--- /dev/null+++ b/openspec/changes/archive/2026-02-28-sync-master-features/specs/context-menu/spec.md@@ -0,0 +1,54 @@+## ADDED Requirements++### Requirement: Right-click context menu+Right-clicking on the canvas SHALL show a context menu with Figma-style actions. If clicking on a node, that node is selected first. If clicking empty canvas, selection is cleared.++#### Scenario: Right-click on node+- **WHEN** user right-clicks on a rectangle+- **THEN** the rectangle is selected and a context menu appears with available actions++#### Scenario: Right-click on empty canvas+- **WHEN** user right-clicks on empty canvas+- **THEN** selection is cleared and a context menu appears with paste action available++### Requirement: Context menu clipboard actions+The context menu SHALL include Copy (βC), Cut (βX), Paste here (βV), Duplicate (βD), and Delete (β«). Clipboard actions are disabled when no selection exists.++#### Scenario: Copy from context menu+- **WHEN** user right-clicks a selected node and clicks "Copy"+- **THEN** the node is copied to clipboard++### Requirement: Context menu z-order actions+The context menu SHALL include "Bring to front" (]) and "Send to back" ([), disabled when no selection exists.++#### Scenario: Bring to front via menu+- **WHEN** user right-clicks a node and selects "Bring to front"+- **THEN** the node moves to the top of its parent's child list++### Requirement: Context menu grouping actions+The context menu SHALL include Group (βG, requires 2+ selected), Ungroup (β§βG, shown for groups), and Add auto layout (β§A).++#### Scenario: Group from context menu+- **WHEN** user selects two nodes, right-clicks, and selects "Group"+- **THEN** the nodes are grouped++### Requirement: Context menu component actions+The context menu SHALL include component actions in purple: Create component (β₯βK), Create component set (β§βK, when 2+ components selected), Create instance (for components), Go to main component (for instances), Detach instance (β₯βB, for instances).++#### Scenario: Create component from menu+- **WHEN** user right-clicks a frame and selects "Create component"+- **THEN** the frame becomes a component++### Requirement: Context menu visibility and lock actions+The context menu SHALL include "Hide/Show" (β§βH) and "Lock/Unlock" (β§βL) for selected nodes. Labels toggle based on current state.++#### Scenario: Hide via context menu+- **WHEN** user right-clicks a visible node and selects "Hide"+- **THEN** the node becomes invisible++### Requirement: Context menu move to page+The context menu SHALL include a "Move to page" submenu listing all pages except the current one. Selected nodes are reparented to the chosen page.++#### Scenario: Move node to another page+- **WHEN** user right-clicks a node, opens "Move to page", and selects "Page 2"+- **THEN** the node is moved to Page 2diff --git a/openspec/changes/archive/2026-02-28-sync-master-features/specs/editor-ui/spec.md b/openspec/changes/archive/2026-02-28-sync-master-features/specs/editor-ui/spec.mdnew file mode 100644index 000000000..b17e97380--- /dev/null+++ b/openspec/changes/archive/2026-02-28-sync-master-features/specs/editor-ui/spec.md@@ -0,0 +1,22 @@+## ADDED Requirements++### Requirement: Component keyboard shortcuts+The editor SHALL support keyboard shortcuts for component operations: β₯βK (create component), β₯βB (detach instance), β§βK (create component set).++#### Scenario: Create component shortcut+- **WHEN** user selects a frame and presses β₯βK+- **THEN** the frame becomes a component++### Requirement: Z-order keyboard shortcuts+The editor SHALL support ] (bring to front) and [ (send to back) keyboard shortcuts.++#### Scenario: Bring to front shortcut+- **WHEN** user selects a node and presses ]+- **THEN** the node moves to the top of its z-order++### Requirement: Visibility and lock keyboard shortcuts+The editor SHALL support β§βH (toggle visibility) and β§βL (toggle lock) keyboard shortcuts.++#### Scenario: Toggle visibility shortcut+- **WHEN** user selects a node and presses β§βH+- **THEN** the node's visibility togglesdiff --git a/openspec/changes/archive/2026-02-28-sync-master-features/specs/figma-comparison-docs/spec.md b/openspec/changes/archive/2026-02-28-sync-master-features/specs/figma-comparison-docs/spec.mdnew file mode 100644index 000000000..1534d95fb--- /dev/null+++ b/openspec/changes/archive/2026-02-28-sync-master-features/specs/figma-comparison-docs/spec.md@@ -0,0 +1,12 @@+## MODIFIED Requirements++### Requirement: Feature rows include notes+Each table row SHALL contain columns: Feature, Status, Notes. Statuses SHALL be updated when features are implemented. Specifically: Components (create/instance/detach) β π‘ partial, Lock/unlock β β , Toggle visibility β β (already was), Rename layers β π‘, Z-order (bring to front/send to back) β β , Context menu β β new row.++#### Scenario: Notes explain partial status+- **WHEN** a feature has π‘ partial status+- **THEN** the Notes column explains what is supported and what is missing++#### Scenario: Component status updated+- **WHEN** user views the Components & Design Systems table+- **THEN** "Create components" shows π‘ with note about what's implementeddiff --git a/openspec/changes/archive/2026-02-28-sync-master-features/specs/scene-graph/spec.md b/openspec/changes/archive/2026-02-28-sync-master-features/specs/scene-graph/spec.mdnew file mode 100644index 000000000..c9468928c--- /dev/null+++ b/openspec/changes/archive/2026-02-28-sync-master-features/specs/scene-graph/spec.md@@ -0,0 +1,45 @@+## MODIFIED Requirements++### Requirement: Scene node data model+The scene graph SHALL store nodes in a flat `Map<string, SceneNode>` with parent-child tree via parentIndex. Each SceneNode SHALL include `componentId` (nullable reference to main component for instances) and `overrides` (record of instance-level property overrides).++#### Scenario: Node has component fields+- **WHEN** a SceneNode is created+- **THEN** it has `componentId: null` and `overrides: {}` by default++## ADDED Requirements++### Requirement: Clone tree+The scene graph SHALL support deep-cloning a node subtree to a new parent via `cloneTree(sourceId, parentId)`, copying all properties and recursively cloning children.++#### Scenario: Clone subtree+- **WHEN** `cloneTree` is called on a frame with two children+- **THEN** a new frame with two new children is created under the target parent++### Requirement: Create instance from component+The scene graph SHALL support creating an INSTANCE node from a COMPONENT via `createInstance(componentId, parentId)`, copying visual properties and deep-cloning children.++#### Scenario: Instance copies component children+- **WHEN** `createInstance` is called for a component with three children+- **THEN** the instance has three cloned children matching the component's++### Requirement: Detach instance+The scene graph SHALL support converting an INSTANCE to FRAME via `detachInstance(instanceId)`, clearing `componentId` and `overrides`.++#### Scenario: Detach changes type+- **WHEN** `detachInstance` is called on an instance+- **THEN** its type becomes FRAME and componentId becomes null++### Requirement: Get main component+The scene graph SHALL support `getMainComponent(instanceId)` returning the source COMPONENT for an instance.++#### Scenario: Retrieve main component+- **WHEN** `getMainComponent` is called on an instance+- **THEN** the linked COMPONENT node is returned++### Requirement: Deep hit testing+The scene graph SHALL support `hitTestDeep(px, py)` that traverses into COMPONENT and INSTANCE containers, unlike standard `hitTest` which treats them as opaque.++#### Scenario: Deep hit test enters component+- **WHEN** `hitTestDeep` is called at a position inside a component's child+- **THEN** the child is returned, not the componentdiff --git a/openspec/changes/archive/2026-02-28-sync-master-features/specs/selection-manipulation/spec.md b/openspec/changes/archive/2026-02-28-sync-master-features/specs/selection-manipulation/spec.mdnew file mode 100644index 000000000..431d43c3a--- /dev/null+++ b/openspec/changes/archive/2026-02-28-sync-master-features/specs/selection-manipulation/spec.md@@ -0,0 +1,40 @@+## ADDED Requirements++### Requirement: Z-order manipulation+The editor SHALL support bringing selected nodes to front (]) and sending to back ([). Bring to front moves node to end of parent's childIds; send to back moves to start.++#### Scenario: Bring to front+- **WHEN** user selects a node and presses ]+- **THEN** the node moves to the top of its sibling z-order++#### Scenario: Send to back+- **WHEN** user selects a node and presses [+- **THEN** the node moves to the bottom of its sibling z-order++### Requirement: Toggle visibility+The editor SHALL support toggling node visibility (β§βH). Hidden nodes are not rendered but remain in the scene graph and layers panel.++#### Scenario: Hide node+- **WHEN** user selects a visible node and presses β§βH+- **THEN** the node's `visible` property becomes false++### Requirement: Toggle lock+The editor SHALL support toggling node lock state (β§βL). Locked nodes cannot be selected or moved via canvas interaction.++#### Scenario: Lock node+- **WHEN** user selects a node and presses β§βL+- **THEN** the node's `locked` property becomes true++### Requirement: Move to page+The editor SHALL support moving selected nodes to a different page, reparenting them under the target page's CANVAS node.++#### Scenario: Move selection to another page+- **WHEN** user moves a node to Page 2 via context menu+- **THEN** the node is reparented under Page 2's CANVAS node and removed from the current page++### Requirement: Rename node+The editor SHALL support renaming nodes programmatically via `renameNode(id, name)`.++#### Scenario: Rename a layer+- **WHEN** `renameNode` is called with a new name+- **THEN** the node's name property is updateddiff --git a/openspec/changes/archive/2026-02-28-sync-master-features/specs/vitepress-docs/spec.md b/openspec/changes/archive/2026-02-28-sync-master-features/specs/vitepress-docs/spec.mdnew file mode 100644index 000000000..977ecc9db--- /dev/null+++ b/openspec/changes/archive/2026-02-28-sync-master-features/specs/vitepress-docs/spec.md@@ -0,0 +1,30 @@+## MODIFIED Requirements++### Requirement: Guide section+The docs site SHALL include a guide section with pages: Getting Started, Features, Architecture, Tech Stack. The Features page SHALL document components (create, instance, detach, component sets), context menu, z-order, visibility/lock toggle, move-to-page, and rendering optimizations (viewport culling, RAF coalescing).++#### Scenario: Getting started page+- **WHEN** user navigates to the Getting Started guide+- **THEN** installation instructions (`bun install`, `bun run dev`) and desktop app setup are displayed++#### Scenario: Architecture page+- **WHEN** user navigates to the Architecture guide+- **THEN** the system architecture diagram and component descriptions from PLAN.md are displayed++#### Scenario: Features page documents components+- **WHEN** user reads the features page+- **THEN** component creation, instances, detach, component sets, and context menu are described++### Requirement: Docs reflect updated keyboard shortcuts+The keyboard shortcuts page SHALL mark newly implemented shortcuts: β₯βK (Create Component), β₯βB (Detach Instance), ] (Bring Forward), [ (Send Backward), β§βH (Toggle Visibility), β§βL (Toggle Lock).++#### Scenario: Component shortcuts marked+- **WHEN** user reads the keyboard shortcuts page+- **THEN** β₯βK, β₯βB, ], [ show β status++### Requirement: Roadmap reflects current progress+The roadmap page SHALL reflect that Phase 4 (Components + Variables) has partially started, with component creation, instances, component sets, and detach delivered.++#### Scenario: Phase 4 partial progress+- **WHEN** user reads the roadmap page+- **THEN** Phase 4 shows as π‘ In Progress with components/instances listed as delivereddiff --git a/openspec/changes/archive/2026-02-28-sync-master-features/tasks.md b/openspec/changes/archive/2026-02-28-sync-master-features/tasks.mdnew file mode 100644index 000000000..747d073fe--- /dev/null+++ b/openspec/changes/archive/2026-02-28-sync-master-features/tasks.md@@ -0,0 +1,22 @@+## 1. Update Features Documentation++- [x] 1.1 Add "Components & Instances" section to `docs/guide/features.md` (create component β₯βK, component sets β§βK, create instance, detach β₯βB, go to main, purple labels, opaque container selection)+- [x] 1.2 Add "Context Menu" section to `docs/guide/features.md` (right-click actions: clipboard, z-order, group, component, visibility, lock, move-to-page)+- [x] 1.3 Add "Z-Order, Visibility & Lock" section to `docs/guide/features.md` (] bring to front, [ send to back, β§βH visibility toggle, β§βL lock toggle, move to page via context menu)+- [x] 1.4 Add rendering optimizations note to `docs/guide/features.md` (viewport culling, Paint reuse, RAF coalescing β brief, under existing Advanced Rendering section)++## 2. Update Keyboard Shortcuts++- [x] 2.1 Update `docs/reference/keyboard-shortcuts.md` β mark implemented: β₯βK (Create Component β ), β₯βB (Detach Instance β ), β§βK (Create Component Set β add new row β ), ] (Bring to Front β ), [ (Send to Back β ); add new rows: β§βH (Toggle Visibility β ), β§βL (Toggle Lock β )++## 3. Update Roadmap++- [x] 3.1 Update `docs/development/roadmap.md` β Phase 4 from π² to π‘ In Progress, list delivered: component creation/instantiation, component sets, detach, go-to-main, component labels, context menu++## 4. Update Figma Feature Matrix++- [x] 4.1 Update `docs/guide/figma-comparison.md` β Components & Design Systems table: create components π‘ (basic creation works, no overrides propagation), component instances π‘ (create/detach works, no override editing), detach instance π‘; Layers & Shapes table: lock/unlock β , rename layers π‘ (programmatic via store, no inline UI yet); add new rows: "Bring to front / Send to back" β in Layers & Shapes, "Context menu" β in Interface & Navigation; update coverage count in header++## 5. Verify++- [x] 5.1 Run `bun run docs:build` to confirm all pages build without errorsdiff --git a/openspec/specs/canvas-rendering/spec.md b/openspec/specs/canvas-rendering/spec.mdindex e48e767e3..14aaa2602 100644--- a/openspec/specs/canvas-rendering/spec.md+++ b/openspec/specs/canvas-rendering/spec.md@@ -112,3 +112,49 @@ The renderer SHALL fill the canvas background with the current page's `pageColor- **WHEN** the user sets the page background color to dark gray- **THEN** the canvas renders with a dark gray background instead of the default++### Requirement: Viewport culling+The renderer SHALL skip drawing nodes whose bounding boxes are entirely outside the visible viewport. Export rendering SHALL disable culling to render all nodes.++#### Scenario: Off-screen node skipped+- **WHEN** a node is completely outside the visible viewport+- **THEN** the renderer does not draw it++#### Scenario: Export renders all nodes+- **WHEN** `renderSceneToCanvas` is called for export+- **THEN** all nodes are rendered regardless of viewport position++### Requirement: Component label rendering+The renderer SHALL draw purple labels for COMPONENT, COMPONENT_SET, and INSTANCE nodes. Labels appear above the node (or inside for COMPONENT_SET children) with a diamond icon and node name.++#### Scenario: Instance label+- **WHEN** an INSTANCE named "Button" is on canvas+- **THEN** a purple label "Button" with diamond icon is rendered above it++### Requirement: Component set border rendering+The renderer SHALL draw COMPONENT_SET nodes with a dashed purple border (6px dash, 4px gap, 1.5px stroke width).++#### Scenario: Dashed border+- **WHEN** a COMPONENT_SET is visible on canvas+- **THEN** its border is rendered as dashed purple lines++### Requirement: Component label hit testing+The renderer SHALL support `hitTestComponentLabel(graph, x, y)` returning the node whose label was clicked, enabling click-to-select via label.++#### Scenario: Click component label+- **WHEN** user clicks on a component's purple label+- **THEN** the component is selected++### Requirement: Paint object reuse+The renderer SHALL reuse Skia Paint objects across frames instead of allocating new ones per render call.++#### Scenario: Multiple renders+- **WHEN** the scene is rendered 60 times per second+- **THEN** Paint objects are reused, not reallocated each frame++### Requirement: RAF render coalescing+The renderer SHALL coalesce multiple render requests within a single frame using `requestAnimationFrame`, rendering at most once per animation frame.++#### Scenario: Rapid state changes+- **WHEN** 10 state changes trigger renders within one frame+- **THEN** only one actual render occursdiff --git a/openspec/specs/components/spec.md b/openspec/specs/components/spec.mdnew file mode 100644index 000000000..77db2c12a--- /dev/null+++ b/openspec/specs/components/spec.md@@ -0,0 +1,69 @@+# components Specification++## Purpose+Components, component sets, instances β create, instantiate, detach, go-to-main component, component labels, opaque container hit testing.+## Requirements++### Requirement: Create component from selection+The editor SHALL convert selected frames/groups to COMPONENT type, or wrap multiple selected nodes in a new COMPONENT node (β₯βK). Single frame/group converts in-place; multiple nodes wraps in a bounding component.++#### Scenario: Convert frame to component+- **WHEN** user selects a single frame and presses β₯βK+- **THEN** the frame's type changes to COMPONENT++#### Scenario: Wrap multiple nodes in component+- **WHEN** user selects three rectangles and presses β₯βK+- **THEN** a COMPONENT node wraps them, positioned at their bounding box++### Requirement: Create component set from components+The editor SHALL combine multiple selected COMPONENT nodes into a COMPONENT_SET container (β§βK). The set gets a dashed purple border and a 40px padding around its children.++#### Scenario: Create component set+- **WHEN** user selects two COMPONENT nodes and presses β§βK+- **THEN** a COMPONENT_SET wraps them with dashed purple border++### Requirement: Create instance from component+The editor SHALL create an INSTANCE node from a COMPONENT, copying its visual properties and children. The instance is placed 40px to the right of the source component.++#### Scenario: Create instance via context menu+- **WHEN** user right-clicks a component and selects "Create instance"+- **THEN** an INSTANCE appears to the right, visually identical to the component++### Requirement: Detach instance+The editor SHALL convert an INSTANCE back to a regular FRAME, clearing its componentId and overrides (β₯βB).++#### Scenario: Detach instance+- **WHEN** user selects an instance and presses β₯βB+- **THEN** the instance becomes a FRAME with no component link++### Requirement: Go to main component+The editor SHALL navigate to and select the main COMPONENT for a selected INSTANCE, switching pages if needed.++#### Scenario: Navigate to main component+- **WHEN** user right-clicks an instance and selects "Go to main component"+- **THEN** the main component is selected and centered in the viewport++### Requirement: Component labels+The renderer SHALL draw always-visible purple labels above COMPONENT and INSTANCE nodes (or inside COMPONENT_SET children). Labels show the node name with a diamond icon.++#### Scenario: Component label visible+- **WHEN** a COMPONENT node exists on canvas+- **THEN** a purple label with the component name is rendered above it++### Requirement: Component set visual treatment+COMPONENT_SET nodes SHALL render with a dashed purple border (6px dash, 4px gap, 1.5px width) instead of a solid border.++#### Scenario: Component set border+- **WHEN** a COMPONENT_SET is on canvas+- **THEN** it renders with a dashed purple border++### Requirement: Opaque container hit testing+COMPONENT and INSTANCE nodes SHALL behave as opaque containers for hit testing β clicking selects the component/instance itself, not its children. Children are accessible only via double-click (deep hit test).++#### Scenario: Click on component child+- **WHEN** user clicks a rectangle inside a component+- **THEN** the component is selected, not the rectangle++#### Scenario: Double-click into component+- **WHEN** user double-clicks a child inside a component+- **THEN** the child is selected (deep selection)diff --git a/openspec/specs/context-menu/spec.md b/openspec/specs/context-menu/spec.mdnew file mode 100644index 000000000..ef66e6a9c--- /dev/null+++ b/openspec/specs/context-menu/spec.md@@ -0,0 +1,58 @@+# context-menu Specification++## Purpose+Right-click context menu with Figma-style actions: clipboard, z-order, grouping, component, visibility, lock, and move-to-page.+## Requirements++### Requirement: Right-click context menu+Right-clicking on the canvas SHALL show a context menu with Figma-style actions. If clicking on a node, that node is selected first. If clicking empty canvas, selection is cleared.++#### Scenario: Right-click on node+- **WHEN** user right-clicks on a rectangle+- **THEN** the rectangle is selected and a context menu appears with available actions++#### Scenario: Right-click on empty canvas+- **WHEN** user right-clicks on empty canvas+- **THEN** selection is cleared and a context menu appears with paste action available++### Requirement: Context menu clipboard actions+The context menu SHALL include Copy (βC), Cut (βX), Paste here (βV), Duplicate (βD), and Delete (β«). Clipboard actions are disabled when no selection exists.++#### Scenario: Copy from context menu+- **WHEN** user right-clicks a selected node and clicks "Copy"+- **THEN** the node is copied to clipboard++### Requirement: Context menu z-order actions+The context menu SHALL include "Bring to front" (]) and "Send to back" ([), disabled when no selection exists.++#### Scenario: Bring to front via menu+- **WHEN** user right-clicks a node and selects "Bring to front"+- **THEN** the node moves to the top of its parent's child list++### Requirement: Context menu grouping actions+The context menu SHALL include Group (βG, requires 2+ selected), Ungroup (β§βG, shown for groups), and Add auto layout (β§A).++#### Scenario: Group from context menu+- **WHEN** user selects two nodes, right-clicks, and selects "Group"+- **THEN** the nodes are grouped++### Requirement: Context menu component actions+The context menu SHALL include component actions in purple: Create component (β₯βK), Create component set (β§βK, when 2+ components selected), Create instance (for components), Go to main component (for instances), Detach instance (β₯βB, for instances).++#### Scenario: Create component from menu+- **WHEN** user right-clicks a frame and selects "Create component"+- **THEN** the frame becomes a component++### Requirement: Context menu visibility and lock actions+The context menu SHALL include "Hide/Show" (β§βH) and "Lock/Unlock" (β§βL) for selected nodes. Labels toggle based on current state.++#### Scenario: Hide via context menu+- **WHEN** user right-clicks a visible node and selects "Hide"+- **THEN** the node becomes invisible++### Requirement: Context menu move to page+The context menu SHALL include a "Move to page" submenu listing all pages except the current one. Selected nodes are reparented to the chosen page.++#### Scenario: Move node to another page+- **WHEN** user right-clicks a node, opens "Move to page", and selects "Page 2"+- **THEN** the node is moved to Page 2diff --git a/openspec/specs/editor-ui/spec.md b/openspec/specs/editor-ui/spec.mdindex e4ceefb9a..7ccfbb87b 100644--- a/openspec/specs/editor-ui/spec.md+++ b/openspec/specs/editor-ui/spec.md@@ -115,3 +115,24 @@ The editor SHALL highlight nodes on hover with a shape-aware outline (follows ac- **WHEN** user moves cursor over a node without clicking- **THEN** a highlight outline appears around the node shape++### Requirement: Component keyboard shortcuts+The editor SHALL support keyboard shortcuts for component operations: β₯βK (create component), β₯βB (detach instance), β§βK (create component set).++#### Scenario: Create component shortcut+- **WHEN** user selects a frame and presses β₯βK+- **THEN** the frame becomes a component++### Requirement: Z-order keyboard shortcuts+The editor SHALL support ] (bring to front) and [ (send to back) keyboard shortcuts.++#### Scenario: Bring to front shortcut+- **WHEN** user selects a node and presses ]+- **THEN** the node moves to the top of its z-order++### Requirement: Visibility and lock keyboard shortcuts+The editor SHALL support β§βH (toggle visibility) and β§βL (toggle lock) keyboard shortcuts.++#### Scenario: Toggle visibility shortcut+- **WHEN** user selects a node and presses β§βH+- **THEN** the node's visibility togglesdiff --git a/openspec/specs/figma-comparison-docs/spec.md b/openspec/specs/figma-comparison-docs/spec.mdindex 91f348db2..4df757d24 100644--- a/openspec/specs/figma-comparison-docs/spec.md+++ b/openspec/specs/figma-comparison-docs/spec.md@@ -25,12 +25,16 @@ Each feature row SHALL use one of three status indicators: β (supported β fe- **THEN** its status column contains exactly one of β , π‘, or π²### Requirement: Feature rows include notes-Each table row SHALL contain columns: Feature, Status, Notes. The Notes column provides brief context such as what works, what's missing, or relevant Open Pencil implementation details.+Each table row SHALL contain columns: Feature, Status, Notes. The Notes column provides brief context such as what works, what's missing, or relevant Open Pencil implementation details. Statuses SHALL be updated when features are implemented.#### Scenario: Notes explain partial status- **WHEN** a feature has π‘ partial status- **THEN** the Notes column explains what is supported and what is missing+#### Scenario: Component status updated+- **WHEN** user views the Components & Design Systems table+- **THEN** component creation, instances, and detach show current implementation status+### Requirement: Last-updated timestampThe page SHALL display a last-updated date at the top so readers know the freshness of the comparison data.diff --git a/openspec/specs/scene-graph/spec.md b/openspec/specs/scene-graph/spec.mdindex d74bff371..3eeb852d6 100644--- a/openspec/specs/scene-graph/spec.md+++ b/openspec/specs/scene-graph/spec.md@@ -4,7 +4,7 @@Hierarchical data structure managing all design nodes. Provides flat Map<GUID, Node> storage with parent-child tree via parentIndex, CRUD operations, hit testing, and spatial queries.## Requirements### Requirement: Flat node storage with GUID keys-The scene graph SHALL store all nodes in a flat `Map<string, Node>` keyed by GUID string. Tree structure SHALL be maintained via `parentIndex` references on each node.+The scene graph SHALL store all nodes in a flat `Map<string, SceneNode>` keyed by GUID string. Tree structure SHALL be maintained via `parentIndex` references on each node. Each SceneNode SHALL include `componentId` (nullable reference to main component for instances) and `overrides` (record of instance-level property overrides).#### Scenario: Create and retrieve a node- **WHEN** a node is created with type RECTANGLE and a parent GUID@@ -14,6 +14,10 @@ The scene graph SHALL store all nodes in a flat `Map<string, Node>` keyed by GUI- **WHEN** a child node references a parent via parentIndex- **THEN** `getChildren(parentId)` returns the child sorted by position string+#### Scenario: Node has component fields+- **WHEN** a SceneNode is created+- **THEN** it has `componentId: null` and `overrides: {}` by default+### Requirement: Node typesThe scene graph SHALL support node types: FRAME, RECTANGLE, ELLIPSE, LINE, TEXT, VECTOR, STAR, POLYGON, GROUP, BOOLEAN_OPERATION, DOCUMENT, CANVAS.@@ -118,3 +122,38 @@ Each page SHALL maintain independent viewport state (panX, panY, zoom, pageColor- **WHEN** user switches from Page 1 (zoomed to 200%) to Page 2 and back- **THEN** Page 1's viewport returns to 200% zoom at the previous pan position++### Requirement: Clone tree+The scene graph SHALL support deep-cloning a node subtree to a new parent via `cloneTree(sourceId, parentId)`, copying all properties and recursively cloning children.++#### Scenario: Clone subtree+- **WHEN** `cloneTree` is called on a frame with two children+- **THEN** a new frame with two new children is created under the target parent++### Requirement: Create instance from component+The scene graph SHALL support creating an INSTANCE node from a COMPONENT via `createInstance(componentId, parentId)`, copying visual properties and deep-cloning children.++#### Scenario: Instance copies component children+- **WHEN** `createInstance` is called for a component with three children+- **THEN** the instance has three cloned children matching the component's++### Requirement: Detach instance+The scene graph SHALL support converting an INSTANCE to FRAME via `detachInstance(instanceId)`, clearing `componentId` and `overrides`.++#### Scenario: Detach changes type+- **WHEN** `detachInstance` is called on an instance+- **THEN** its type becomes FRAME and componentId becomes null++### Requirement: Get main component+The scene graph SHALL support `getMainComponent(instanceId)` returning the source COMPONENT for an instance.++#### Scenario: Retrieve main component+- **WHEN** `getMainComponent` is called on an instance+- **THEN** the linked COMPONENT node is returned++### Requirement: Deep hit testing+The scene graph SHALL support `hitTestDeep(px, py)` that traverses into COMPONENT and INSTANCE containers, unlike standard `hitTest` which treats them as opaque.++#### Scenario: Deep hit test enters component+- **WHEN** `hitTestDeep` is called at a position inside a component's child+- **THEN** the child is returned, not the componentdiff --git a/openspec/specs/selection-manipulation/spec.md b/openspec/specs/selection-manipulation/spec.mdindex f3541d91e..e92a9e436 100644--- a/openspec/specs/selection-manipulation/spec.md+++ b/openspec/specs/selection-manipulation/spec.md@@ -87,3 +87,42 @@ Creating a section on the canvas SHALL automatically reparent overlapping siblin- **WHEN** user draws a section that overlaps two rectangles- **THEN** the two rectangles become children of the new section++### Requirement: Z-order manipulation+The editor SHALL support bringing selected nodes to front (]) and sending to back ([). Bring to front moves node to end of parent's childIds; send to back moves to start.++#### Scenario: Bring to front+- **WHEN** user selects a node and presses ]+- **THEN** the node moves to the top of its sibling z-order++#### Scenario: Send to back+- **WHEN** user selects a node and presses [+- **THEN** the node moves to the bottom of its sibling z-order++### Requirement: Toggle visibility+The editor SHALL support toggling node visibility (β§βH). Hidden nodes are not rendered but remain in the scene graph and layers panel.++#### Scenario: Hide node+- **WHEN** user selects a visible node and presses β§βH+- **THEN** the node's `visible` property becomes false++### Requirement: Toggle lock+The editor SHALL support toggling node lock state (β§βL). Locked nodes cannot be selected or moved via canvas interaction.++#### Scenario: Lock node+- **WHEN** user selects a node and presses β§βL+- **THEN** the node's `locked` property becomes true++### Requirement: Move to page+The editor SHALL support moving selected nodes to a different page, reparenting them under the target page's CANVAS node.++#### Scenario: Move selection to another page+- **WHEN** user moves a node to Page 2 via context menu+- **THEN** the node is reparented under Page 2's CANVAS node and removed from the current page++### Requirement: Rename node+The editor SHALL support renaming nodes programmatically via `renameNode(id, name)`.++#### Scenario: Rename a layer+- **WHEN** `renameNode` is called with a new name+- **THEN** the node's name property is updateddiff --git a/openspec/specs/vitepress-docs/spec.md b/openspec/specs/vitepress-docs/spec.mdindex 8c4e399f5..50a7fbae8 100644--- a/openspec/specs/vitepress-docs/spec.md+++ b/openspec/specs/vitepress-docs/spec.md@@ -22,7 +22,7 @@ The docs site SHALL have an index.md landing page with project name, tagline, an- **THEN** a landing page with "OpenPencil" title and feature highlights is displayed### Requirement: Guide section-The docs site SHALL include a guide section with pages: Getting Started, Features, Architecture, Tech Stack.+The docs site SHALL include a guide section with pages: Getting Started, Features, Architecture, Tech Stack. The Features page SHALL document components (create, instance, detach, component sets), context menu, z-order, visibility/lock toggle, move-to-page, and rendering optimizations (viewport culling, RAF coalescing).#### Scenario: Getting started page- **WHEN** user navigates to the Getting Started guide@@ -32,6 +32,10 @@ The docs site SHALL include a guide section with pages: Getting Started, Feature- **WHEN** user navigates to the Architecture guide- **THEN** the system architecture diagram and component descriptions from PLAN.md are displayed+#### Scenario: Features page documents components+- **WHEN** user reads the features page+- **THEN** component creation, instances, detach, component sets, and context menu are described+### Requirement: Reference sectionThe docs site SHALL include a reference section with pages: Keyboard Shortcuts, Node Types, MCP Tools, Scene Graph, File Format.@@ -104,11 +108,11 @@ The features page SHALL document tier 1 rendering: gradients, image fills, effec- **THEN** gradient fills, image fills, effects, and stroke properties are described### Requirement: Docs reflect updated keyboard shortcuts-The keyboard shortcuts page SHALL mark Section tool (S) as implemented (β ) and add Save (βS) and Save As (β§βS) as implemented.+The keyboard shortcuts page SHALL mark Section tool (S), Save (βS), Save As (β§βS), Create Component (β₯βK), Detach Instance (β₯βB), Create Component Set (β§βK), Bring to Front (]), Send to Back ([), Toggle Visibility (β§βH), and Toggle Lock (β§βL) as implemented (β ).#### Scenario: New shortcuts marked- **WHEN** user reads the keyboard shortcuts page-- **THEN** S (Section), βS (Save), β§βS (Save As) show β status+- **THEN** β₯βK, β₯βB, β§βK, ], [, β§βH, β§βL show β status### Requirement: Docs reflect updated node typesThe node-types reference SHALL list the current 17 types in the NodeType union used by the scene graph.@@ -118,11 +122,11 @@ The node-types reference SHALL list the current 17 types in the NodeType union u- **THEN** CANVAS, ROUNDED_RECTANGLE, COMPONENT, COMPONENT_SET, INSTANCE, CONNECTOR, SHAPE_WITH_TEXT are all listed### Requirement: Roadmap reflects current progress-The roadmap page SHALL reflect that .fig export, sections, pages, hover highlight, and advanced rendering are now delivered.+The roadmap page SHALL reflect that .fig export, sections, pages, hover highlight, and advanced rendering are delivered (Phase 3). Phase 4 SHALL show as π‘ In Progress with component creation, instances, component sets, and detach delivered.#### Scenario: Roadmap is current- **WHEN** user reads the roadmap page-- **THEN** Phase 3 lists .fig export and sections and pages as delivered+- **THEN** Phase 3 shows delivered items and Phase 4 shows partial progress with component features### Requirement: Comparison pageThe docs site SHALL include a comparison page at `/guide/comparison` documenting architecture, rendering, data model, layout, file format, state management, developer experience, and performance differences between OpenPencil and Penpot.