* 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. |
||
|---|---|---|
| .. | ||
| assets | ||
| src | ||
| tests | ||
| AGENTS.md | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
| tsconfig.test.json | ||
| tsdown.config.ts | ||
@open-pencil/core
Editor engine for OpenPencil: the CanvasKit (Skia WASM) renderer, Yoga layout, the framework-agnostic editor with undo and selection, the Figma Plugin API compatibility layer, the AI/MCP tool definitions, clipboard and vector conversion, and format-neutral document I/O.
It depends on @open-pencil/scene-graph, @open-pencil/pen, @open-pencil/kiwi, and @open-pencil/fig, and keeps browser DOM out so it runs in the app, the CLI, the MCP server, and headless scripts alike.
Import the root barrel or the targeted subpaths listed in package.json exports, for example @open-pencil/core/io, @open-pencil/core/geometry, and @open-pencil/core/canvaskit.
- Programmable overview and SDK docs: https://openpencil.dev/programmable/
- Source and issues: https://github.com/open-pencil/open-pencil
MIT License.