openpencil/packages
Danila Poyarkov 5146e7f7e5
fix(fig): keep variable metadata, plugin data and default mode on save (#848)
* fix(fig): keep variable metadata, plugin data and default mode on save

Saving a .fig rebuilt every variable record from the model, which held none
of Figma's variable metadata, so each save wrote variables as published to
all scopes with no description or code names, dropped other plugins' data,
and made the first mode the default.

Variables now carry scopes, codeSyntax and pluginData, collections carry
pluginData, and the reader and writer translate description,
symbolDescription, isPublishable, variableScopes and codeSyntax. Figma has
no default-mode field, so setting a default moves that mode first (undo
restores the order) and the writer orders the default first.

This is the base for design tokens: the CSS name will live in
codeSyntax.WEB and unit and mode conditions in OpenPencil plugin data.

* refactor(scene-graph): share the default-first mode order

setDefaultMode and the .fig writer both moved the default mode first by
hand; modesDefaultFirst does it once, with es-toolkit's partition.

* fix(core): undo a default mode change on the collection currently in the graph

Undoing a collection's removal restores a copy of it, so the inverse of
setDefaultMode wrote the previous order and default to an object the
graph no longer held when both were undone. Look the collection up by id
when undoing, as the forward step already does.
2026-10-04 12:53:04 +04:00
..
cli refactor(core): use es-toolkit for diff tool collection helpers (#854) 2026-10-03 23:19:56 +04:00
codegen feat(design-jsx): export every property the renderer accepts (#814) 2026-10-03 15:40:21 +04:00
core fix(fig): keep variable metadata, plugin data and default mode on save (#848) 2026-10-04 12:53:04 +04:00
demos
design-jsx feat: add visual diff and patch apply tools and openpencil diff (#810) 2026-10-03 21:00:13 +04:00
docs feat(app): show who works on each page (#815) 2026-10-04 01:18:16 +04:00
dom-css build: update twirlwind to 0.4.0 (#851) 2026-10-04 12:36:14 +04:00
fig fix(fig): keep variable metadata, plugin data and default mode on save (#848) 2026-10-04 12:53:04 +04:00
harness docs: route contributors through per-domain guides and ship npm license text (#785) 2026-09-29 01:02:06 +04:00
kiwi fix(fig): keep variable metadata, plugin data and default mode on save (#848) 2026-10-04 12:53:04 +04:00
mcp refactor(design-jsx): extract design JSX into its own package (#793) 2026-09-30 20:55:27 +04:00
pen fix(figma-api): validate effects like Figma (#794) 2026-09-30 21:18:20 +04:00
scene-graph fix(fig): keep variable metadata, plugin data and default mode on save (#848) 2026-10-04 12:53:04 +04:00
vue feat(app): show who works on each page (#815) 2026-10-04 01:18:16 +04:00