openpencil/packages/docs/development
Danila Poyarkov 9081c4b1d6
fix(preview): toggle controls both ways and keep islands in step with the canvas (#982)
* 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.
2026-10-08 17:51:00 +00:00
..
architecture.md feat: behaviours and preview mode (#893) 2026-10-06 13:23:05 +00:00
behaviours-and-preview.md fix(preview): toggle controls both ways and keep islands in step with the canvas (#982) 2026-10-08 17:51:00 +00:00
contributing.md docs: route contributors through per-domain guides and ship npm license text (#785) 2026-09-29 01:02:06 +04:00
fig-reader.md feat(fig): occurrence-scoped instance interpretation as the single .fig reader 2026-10-01 11:20:27 +04:00
navigation-performance.md build(tools): group tools by role and gate them like the rest of the repo (#791) 2026-09-30 05:00:31 +04:00
renderer-lifecycle.md perf(canvas): rebuild navigation rendering (#591) 2026-08-31 13:39:40 +03:00
renderer-profiler.md docs: move development notes into docs package 2026-05-13 02:48:09 +03:00
roadmap.md fix: keep bound text and visibility in step with their variables (#954) 2026-10-07 18:37:15 +00:00
tech-stack.md docs: refresh contributor guidance 2026-09-02 10:56:00 +03:00
testing.md test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
vector-conversion.md docs: generate llms files 2026-05-22 16:03:04 +03:00