* fix(preview): keep a control's layer path when its variant switches Preview finds a control by its layer path, built from layer names. Swapping an instance named after its variant renamed it to the new variant, as Figma does for a real swap, so a switch or checkbox inside a frame lost its path after one click and could not be toggled back. swapInstanceComponent takes keepName, and preview's private graph keeps every instance's name. * refactor(preview): build preview's private graph with the shared page extractor Preview copied its island and the components its instances show with its own closure and copier, a second version of the extractor the AI preview, history, and export use. extractPageContext takes componentSets, which brings every variant of an instance's set so it can switch, and shareTables, which reads the document's variables and images instead of copying them for a view rebuilt on each state. The extractor now also indexes instances by component, which syncing and swapping an extracted graph need. * test: group scene-graph's instance swap test under instances * fix(preview): move islands with the frames the canvas draws Islands followed the pane's live pan and zoom, which change on every wheel event, while the canvas draws once per animation frame or later on a slow frame. Panning and zooming fast, the islands ran ahead of the drawing and settled back when it caught up. useCanvas reports each drawn frame's view through onFrame, and the islands follow the scene's last drawn frame, so both move in the same frame. * test: release the held canvas even when the island sync test fails * docs: point private document copies at the shared page extractor The Core guide says previews, history snapshots, and exports copy part of a document with the extractor in io/subgraph.ts and its componentSets and shareTables options, and the preview guide says where an island's private graph comes from. |
||
|---|---|---|
| .. | ||
| scripts | ||
| src | ||
| tests | ||
| AGENTS.md | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
| tsconfig.test.json | ||
| tsdown.config.ts | ||
@open-pencil/scene-graph
Shared OpenPencil design document model.
This package owns SceneGraph, SceneNode, paint/effect/layout/variable types, graph mutation helpers, source metadata, and model-level utilities, including component slots and behaviours: the contracts after Reka UI's primitives, the behaviour stored in plugin data, and specs that name properties and slots. It does not own editor state, UI, file format policy, rendering, or app document I/O.