openpencil/packages/core
Vitali sharp8n 0ea0b1b4f0
Some checks failed
Build native contracts CI image / Publish native contracts image (push) Has been cancelled
chore: merge upstream/master into upstream-sync-2026-10
Bring the fork up to upstream v0.15.1 (637 commits). Conflicts resolved by
re-targeting the W4C delta onto upstream's restructured code and dropping
superseded changes:

- i18n: upstream split dialogs.json per feature; re-added webFontLoadFailed to
  the new fonts.json in all locales.
- automation: upstream moved the bridge into the MCP runtime and deleted
  EditorView.vue; re-added the served-build opt-in (?automation=1 /
  VITE_OPENPENCIL_AUTOMATION) with ?automationWs= and ?automationToken= via
  connectServedAutomation(), wired in WorkspaceView.
- fonts: kept the /__font-proxy fetch wrapper on top of upstream's
  browserWebFontFetch and re-enabled the Google provider in the web build.
- recovery/embed: kept auto-recover mode discarding snapshots (no dialog, no
  close prompt) and openFileReusingMatchingTab() for host pushes.
- io/capability: folded the cross-origin subframe guard into
  supportsFileSystemAccess()/pickBrowserSaveFile().
- embed bridge installed from boot.ts; MCP browserToken/tcpHost re-applied.
2026-10-08 23:21:00 +03:00
..
assets fix(fonts): include bundled Arabic fallback asset 2026-05-18 01:04:29 +03:00
src chore: merge upstream/master into upstream-sync-2026-10 2026-10-08 23:21:00 +03:00
tests fix(preview): toggle controls both ways and keep islands in step with the canvas (#982) 2026-10-08 17:51:00 +00:00
AGENTS.md fix(preview): toggle controls both ways and keep islands in step with the canvas (#982) 2026-10-08 17:51:00 +00:00
package.json feat: import and export W3C design tokens (#964) 2026-10-08 16:53:46 +00:00
README.md feat: behaviours and preview mode (#893) 2026-10-06 13:23:05 +00:00
tsconfig.json fix: explain unsupported browsers instead of a blank window (#745) 2026-09-22 14:40:59 +04:00
tsconfig.test.json test(core): move the editor suite into the package (#792) 2026-09-30 10:22:42 +04:00
tsdown.config.ts fix(figma-api): validate effects like Figma (#794) 2026-09-30 21:18:20 +04:00

@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.

Scripts get two globals through compileScript from @open-pencil/core/tools: figma, the Figma Plugin API over a document, and openpencil (OpenPencilAPI from @open-pencil/core/openpencil-api), what OpenPencil adds to it in the same style, such as making a component behave as a Reka UI control:

import { FigmaAPI } from '@open-pencil/core/figma-api'
import { compileScript } from '@open-pencil/core/tools'

await compileScript(`
  const set = figma.currentPage.findOne((n) => n.name === 'Switch')
  openpencil.setBehaviour(set, { kind: 'switch', values: { value: 'State' } })
`)(new FigmaAPI(graph))

MIT License.