openpencil/packages/scene-graph/tests
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
..
basic feat(canvas): select auto layout frames by their gaps and dot their children, as in Figma (#943) 2026-10-07 11:29:52 +00:00
behaviours refactor: share behaviour control roles through dom-css (#960) 2026-10-07 20:06:16 +00:00
clone test(core): move the fig round-trip suite home, and stop test imports drilling 2026-10-01 14:11:53 +04:00
color fix: meet WCAG AA contrast and name controls for screen readers (#952) 2026-10-07 17:51:24 +00:00
components test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
css fix: share CSS value parsing between dom-css and design JSX (#910) 2026-10-05 17:02:43 +00:00
helpers test: migrate Scene Graph tests into the package and gate new tests/engine files (#790) 2026-09-30 04:53:28 +04:00
instances fix(preview): toggle controls both ways and keep islands in step with the canvas (#982) 2026-10-08 17:51:00 +00:00
plugin-data feat: behaviours and preview mode (#893) 2026-10-06 13:23:05 +00:00
slots feat: create, fill, and edit slots (#862) 2026-10-04 17:02:28 +00:00
text fix(fig): write text glyphs from the layout the renderer draws (#928) 2026-10-06 11:37:02 +00:00
transfer feat(fig): occurrence-scoped instance interpretation as the single .fig reader 2026-10-01 11:20:27 +04:00
undo feat(ai): revert, regenerate, and edit chat turns (#844) 2026-10-06 09:54:42 +00:00
variable fix: keep bound text and visibility in step with their variables (#954) 2026-10-07 18:37:15 +00:00
buffered-events.test.ts feat(fig): occurrence-scoped instance interpretation as the single .fig reader 2026-10-01 11:20:27 +04:00
copy.test.ts feat(scene-graph)!: make a stroke a paint (#864) 2026-10-04 13:38:05 +04:00
guides.test.ts perf: speed up opening large pages (#953) 2026-10-07 20:57:57 +00:00
instance-overrides.test.ts test: migrate Scene Graph tests into the package and gate new tests/engine files (#790) 2026-09-30 04:53:28 +04:00
instance-sync-duplication.test.ts test: migrate Scene Graph tests into the package and gate new tests/engine files (#790) 2026-09-30 04:53:28 +04:00
layout-guides.test.ts test: migrate Scene Graph tests into the package and gate new tests/engine files (#790) 2026-09-30 04:53:28 +04:00
layout-sizing.test.ts fix(layout): size each axis on its own and lay out before geometry reads (#942) 2026-10-07 11:52:08 +00:00
mutation-impact.test.ts test: migrate Scene Graph tests into the package and gate new tests/engine files (#790) 2026-09-30 04:53:28 +04:00
order-keys.test.ts feat(collab)!: sync layer trees as a CRDT and open each room in its own tab (#902) 2026-10-06 10:40:25 +00:00
parse-path.test.ts fix(core): fill open subpaths of filled SVG paths (#876) 2026-10-04 13:25:23 +00:00
random.test.ts feat(scene-graph)!: let a SceneGraph take its ID generator (#887) 2026-10-05 08:21:22 +00:00
reparent-transform.test.ts test: migrate Scene Graph tests into the package and gate new tests/engine files (#790) 2026-09-30 04:53:28 +04:00
source-metadata.test.ts test: migrate Scene Graph tests into the package and gate new tests/engine files (#790) 2026-09-30 04:53:28 +04:00
vector-network.test.ts test: migrate Scene Graph tests into the package and gate new tests/engine files (#790) 2026-09-30 04:53:28 +04:00
world-bounds.test.ts fix(figma-api): size groups and boolean operations to their contents (#775) 2026-09-30 05:23:59 +04:00
world-transform.test.ts test: migrate Scene Graph tests into the package and gate new tests/engine files (#790) 2026-09-30 04:53:28 +04:00