diff --git a/CHANGELOG.md b/CHANGELOG.md index aae43a8c5..785f06479 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,14 +2,12 @@ ## Unreleased -### Added - -- Allow supported AI model profiles to set a provider-specific reasoning effort. (#454) +- Added local crash recovery for unsaved and pathless documents, including MCP-created documents. ### Fixed -- Report exhausted provider credit, request failures, and output-token limits through localized chat toasts and copied diagnostics. (#451, #454) -- Prevent Windows desktop crashes when loading large system fonts for non-Latin text. +- Fixed Windows desktop crashes when loading large system fonts for non-Latin text by using Tauri's binary IPC path and resolving native script fallbacks without parsing full font files in JavaScript. + - Preserve open vector segments when the same vector network also contains filled regions. (#450) - Match Figma Plugin API behavior for `rescale()`, page `backgrounds`, and nullable visual `absoluteRenderBounds`. (#442) - Keep imported Figma instances linked to their remapped source components so later component edits update existing instances. (#385) @@ -19,7 +17,7 @@ - Preserve effective nested instance text overrides when importing complex Figma component hierarchies. (#102) - Preserve circles, ellipses, rectangles, lines, polylines, and polygons supplied as JSX children of inline SVG elements. (#452) -## 0.14.0 — 2026-08-10 +## 0.14.0 - 2026-08-10 ### Breaking changes @@ -32,10 +30,10 @@ - Export selections, pages, and documents as editable PowerPoint (`.pptx`) files from the File menu, CLI, and SDK. Text, rectangles, ellipses, and lines remain editable; visually complex layers are embedded as images. - Import HTML, CSS, Tailwind, and JSX as editable documents from the app, CLI, and SDK, and export standalone browser-ready HTML with compiled CSS and optional external assets. - Drag image files into the desktop app and paste Figma layers with their remote image fills. -- Import dropped SVG files as editable vector layers, preserving compatible multi-color fills and transparent paints. (#386, #392, #394, #446). -- Convert image layers into editable vectors with Recraft or fal.ai from the canvas context menu. (#322). -- Browse document components as thumbnails or a list in the Assets panel, group them by page, and drag instances directly onto the canvas. (#424). -- Create centered frames from Figma-style device and asset presets, or resize selected frames to a preset while preserving their names. (#418). +- Import dropped SVG files as editable vector layers, preserving compatible multi-color fills and transparent paints. (#386, #392, #394, #446) +- Convert image layers into editable vectors with Recraft or fal.ai from the canvas context menu. (#322) +- Browse document components as thumbnails or a list in the Assets panel, group them by page, and drag instances directly onto the canvas. (#424) +- Create centered frames from Figma-style device and asset presets, or resize selected frames to a preset while preserving their names. (#418) - Manage pages by renaming, deleting, and dragging to reorder them in the Pages panel. - Create text by dragging a fixed-size text box or clicking for auto-width text. - Create and edit layout grids for frames and components, including columns, rows, counts, gutters, margins, visibility, and grid size. @@ -45,12 +43,12 @@ - Access more common design actions from the browser and desktop menus, including visibility, locking, masks, flipping, components, z-order, distribution, selection, rulers, multiplayer cursors, and Settings. - Find overlapping layers and overflowing children from the CLI, AI tools, and MCP. - Target a specific open document and page from live CLI and MCP automation, including sessions with multiple documents. -- Connect local MCP clients through automatically discovered private Unix sockets on macOS and Linux, with localhost TCP fallback. (#338). +- Connect local MCP clients through automatically discovered private Unix sockets on macOS and Linux, with localhost TCP fallback. (#338) - Test OpenAI-compatible provider connections from AI settings with clearer setup errors. - Configure separate Design, Review, Fast, and Vision models, providers, endpoints, and credentials from AI settings. - Manage AI, agent, media, and storage credentials from unified Settings, using the system credential store on desktop and encrypted browser storage by default, with a session-only browser option. - Connect an S3-compatible storage workspace with local-first saves, background synchronization, embedded `.fig` previews loaded without downloading full documents, and automatic refresh while the workspace is active. -- Add Japanese localization and improve menu translations across the existing supported languages. (#367). +- Add Japanese localization and improve menu translations across the existing supported languages. (#367) - Author richer Design JSX with components, instances, variables, gradients, structured fills, shadows, blur effects, masks, and inline SVG vectors. - Build custom property panels and document workspaces with new Vue SDK number fields, bindable values, property sections, responsive grids, segmented controls, property lists, color models, fill controls, gradient primitives, and the headless `useDocumentWorkspace()` composable. - Use `useColorModel()` in the Vue SDK for extensible color formats and shared RGB, HSL, HSB, and OkHCL channel behavior. @@ -63,9 +61,9 @@ - Choose Freeform, vertical, horizontal, or grid flow directly from the contextual Layout section, with sizing controls grouped alongside it. - Choose Auto width, Auto height, or Fixed size directly from the Layout section for text layers. - Scale the Layers panel to documents with thousands of nodes through virtualized rows, faster incremental updates, stable expansion, range selection, and scroll-to-selection. -- Open and save large `.fig` documents substantially faster while preserving original metadata and user edits, and switch between large pages with fewer Layers panel stalls. (#420). +- Open and save large `.fig` documents substantially faster while preserving original metadata and user edits, and switch between large pages with fewer Layers panel stalls. (#420) - Resolve fonts before text appears, with language-aware CJK and Arabic fallbacks, character-specific remote subsets, and more reliable rendering as fonts load. -- Use MiniMax M3 as the default model for MiniMax AI connections. (#431). +- Use MiniMax M3 as the default model for MiniMax AI connections. (#431) - Center empty and setup states consistently across panels, dialogs, and workspaces. ### Fixed @@ -76,18 +74,18 @@ - Keep swapped image avatars and thin stepper dividers at their effective imported size and position. - Scale proportion-constrained `.fig` instance geometry through fixed wrapper layers so imported logos and icons retain their intended size. - Match Figma auto-layout spacing, padding, min/max constraints, scalar variable bindings, CanvasKit-shaped generated text, imported text bounds, and nested instance geometry more closely. -- Match Figma Plugin API vector path and network editing, including bounds, transforms, winding rules, region fills, validation, and handle mirroring. (#444). -- Let AI and MCP tools create arbitrary vectors from SVG path data, validating input without leaving blank layers behind. (#440). -- Improve AI design accuracy by exposing every supported shape, including visible stroke colors and weights in visual descriptions, and accepting supported inline SVG attributes without false warnings. (#445, #447, #448). -- Restore Anthropic AI connections in the web app instead of failing with a browser endpoint error. (#438). +- Match Figma Plugin API vector path and network editing, including bounds, transforms, winding rules, region fills, validation, and handle mirroring. (#444) +- Let AI and MCP tools create arbitrary vectors from SVG path data, validating input without leaving blank layers behind. (#440) +- Improve AI design accuracy by exposing every supported shape, including visible stroke colors and weights in visual descriptions, and accepting supported inline SVG attributes without false warnings. (#445, #447, #448) +- Restore Anthropic AI connections in the web app instead of failing with a browser endpoint error. (#438) - Reconnect live CLI and automation sessions automatically after an unexpected bridge disconnection. -- Keep MCP file access inside its configured root when paths contain symlinks, and strengthen local authentication token checks. (#338). -- Start globally installed ACP agents correctly on Windows instead of reporting them as unavailable. (#361). +- Keep MCP file access inside its configured root when paths contain symlinks, and strengthen local authentication token checks. (#338) +- Start globally installed ACP agents correctly on Windows instead of reporting them as unavailable. (#361) - Resume pending cloud saves after restarting the app or temporarily losing credentials, without reviving deleted documents or overwriting newer local changes. - Handle S3 object listings, pagination, and escaped names more reliably, and explain required CORS setup without modifying bucket rules. - Show HTML, CSS, Tailwind, and JSX import errors instead of failing silently. - Preserve inline SVG attributes, nested transforms, and explicit icon dimensions when rendering Design JSX artwork. -- Save auto-layout frames that stretch their children to `.fig` without failing. (#427). +- Save auto-layout frames that stretch their children to `.fig` without failing. (#427) - Preserve nested instance text, visibility, paint, geometry, clipping, variable modes, and component swaps in `.fig` files. - Improve `.fig` import and rendering fidelity for groups, booleans, instances, rotated vectors, complex text fills, auto-sized text, layout grids, page guides, patterns, noise effects, masks, and canvas backgrounds. - Preserve pages, components, prototype and library metadata, export settings, unsupported effects, and other unrelated Figma data when editing and resaving `.fig` files. @@ -96,17 +94,17 @@ - Report corrupted compressed `.fig` data as an error instead of opening it as valid content. - Match Figma auto-layout reflow after deleting children, hiding optional instance slots, or syncing component changes. - Make group and boolean-operation children scale with their parent during resize. -- Edit vectors in opened documents at the correct position, with live fill updates and working undo and redo. (#390). +- Edit vectors in opened documents at the correct position, with live fill updates and working undo and redo. (#390) - Keep duplicated layers independent instead of sharing mutable fills, strokes, bindings, overrides, or vector data, and remove stale bindings when paints are deleted. -- Keep desktop text visible across scene and overlay canvases, refresh it after local fonts load, and preserve rendering when an italic face is unavailable. (#395). -- Vertically center text correctly when an explicit line height adds space above and below its glyphs. (#422). +- Keep desktop text visible across scene and overlay canvases, refresh it after local fonts load, and preserve rendering when an italic face is unavailable. (#395) +- Vertically center text correctly when an explicit line height adds space above and below its glyphs. (#422) - Preserve Hangul IME composition while editing text. - Restore desktop copy, cut, and paste when browser clipboard events are unavailable. - Finish pasting Figma layers promptly even when remote images are slow or unavailable, and hydrate their image fills when downloads complete. -- Reuse the existing tab when reopening a file through its desktop path or browser file handle, avoiding duplicate watchers and conflicting saves. (#297). +- Reuse the existing tab when reopening a file through its desktop path or browser file handle, avoiding duplicate watchers and conflicting saves. (#297) - Share public app links from the desktop collaboration panel and send the current document to newly joined collaborators. - Show only the most specific tooltip when property controls contain nested actions. -- Match regional browser languages to supported locales without selecting a lower-priority language. (#417). +- Match regional browser languages to supported locales without selecting a lower-priority language. (#417) - Improve Simplified Chinese translations and correct localized menu terminology. - Resolve published package types correctly for TypeScript consumers and keep file-backed CLI commands working under Node. @@ -120,19 +118,19 @@ - Update the Homebrew install command to use the published `openpencil` cask. -### Fixed +### Fixes - Fix the published MCP package so global installs include the `openpencil-mcp` and `openpencil-mcp-http` launchers required by desktop app integrations. ## 0.13.1 — 2026-05-29 -### Fixed +### Fixes - Fix the npm package contents for the CLI so Bun installs include the built `openpencil` binary and runtime bundle. ## 0.13.0 — 2026-05-29 -### Fixed +### Fixes - Fix the published CLI package so Bun global installs run the built `openpencil` binary instead of raw TypeScript sources. @@ -171,7 +169,7 @@ - Update Claude Code MCP setup documentation and the docs landing screenshot. - Ignore non-source Markdown files in the app dev watcher so documentation edits do not reload the running editor. -### Fixed +### Fixes - Route Claude Code stdio MCP requests through the live OpenPencil app connection, including immediate disconnected errors when no document is connected. - Keep MCP disconnected guidance focused on starting OpenPencil and opening a document. @@ -182,7 +180,7 @@ ## 0.12.1 — 2026-05-19 -### Fixed +### Fixes - Fix `.fig` round-trips for OpenPencil component sets and variable bindings, and recompute imported layouts after opening documents. - Report desktop/MCP package version mismatches explicitly and include package-manager-aware install guidance from the MCP server. @@ -220,7 +218,7 @@ - Editor command metadata now drives shortcut display across browser menus, native menus, tooltips, and context menus. - Text-to-vector conversion now uses shared loaded-font outline geometry across Boolean, flatten, and outline commands. -### Fixed +### Fixes - Fix `.fig` export of component variant properties and text stretch alignment so designs round-trip correctly through Figma. - Fix CJK and Arabic text rendering — fallback fonts now load before the first paint instead of showing blank text. @@ -268,446 +266,448 @@ ## 0.11.8 — 2026-04-23 -### Fixed +### Fixes -- Fix MCP server not spawning on Windows — use `cmd /c` to resolve `.cmd` wrappers from npm global installs. -- Fix MCP server and automation WebSocket not connecting on Windows/Linux — inline `__TAURI_INTERNALS__` check at call time instead of using stale module-level `IS_TAURI` constant. -- Fix shell PATH not inherited by GUI app on macOS/Linux — add `fix-path-env-rs` to read shell config. +- Fix MCP server not spawning on Windows — use `cmd /c` to resolve `.cmd` wrappers from npm global installs +- Fix MCP server and automation WebSocket not connecting on Windows/Linux — inline `__TAURI_INTERNALS__` check at call time instead of using stale module-level `IS_TAURI` constant +- Fix shell PATH not inherited by GUI app on macOS/Linux — add `fix-path-env-rs` to read shell config ## 0.11.7 — 2026-04-22 -### Added +### Features - Add stdio transport for MCP server — `openpencil-mcp` now works as a proper stdio MCP server for Claude Code, Cursor, etc. HTTP server available as `openpencil-mcp-http`. -- Default canvas background to dark when system prefers dark color scheme. -- Add `list_available_fonts` MCP tool for font discovery. -- Copy node ID / XPath from context menu; CLI selection command. -- Arrow key nudge for selected nodes (1px, Shift+arrow for 10px). -- JSX renderer: `position="absolute"`, `top`, `left` props for absolute children inside auto-layout containers. -- MCP server sends `notifications/tools/list_changed` when the desktop app connects or disconnects. -- Headless text measurement via opentype.js per-glyph advance widths — no CanvasKit needed. -- Add `open_file` and `new_document` MCP tools with `OPENPENCIL_MCP_ROOT` path scoping. -- Optional `path` param on `export_image`, `export_svg`, `get_jsx` — write output to disk instead of returning base64/string. -- Multi-root JSX support — multiple top-level elements auto-wrapped in a fragment. -- `Component` and `Instance` tag aliases in JSX renderer. -- JSX prop reference doc — copy to clipboard via book icon in Code panel. -- Prompts (`CODEGEN_PROMPT`, `JSX_REFERENCE`) moved from embedded strings to markdown files. +- Default canvas background to dark when system prefers dark color scheme +- Add `list_available_fonts` MCP tool for font discovery +- Copy node ID / XPath from context menu; CLI selection command +- Arrow key nudge for selected nodes (1px, Shift+arrow for 10px) +- JSX renderer: `position="absolute"`, `top`, `left` props for absolute children inside auto-layout containers +- MCP server sends `notifications/tools/list_changed` when the desktop app connects or disconnects +- Headless text measurement via opentype.js per-glyph advance widths — no CanvasKit needed +- Add `open_file` and `new_document` MCP tools with `OPENPENCIL_MCP_ROOT` path scoping +- Optional `path` param on `export_image`, `export_svg`, `get_jsx` — write output to disk instead of returning base64/string +- Multi-root JSX support — multiple top-level elements auto-wrapped in a fragment +- `Component` and `Instance` tag aliases in JSX renderer +- JSX prop reference doc — copy to clipboard via book icon in Code panel +- Prompts (`CODEGEN_PROMPT`, `JSX_REFERENCE`) moved from embedded strings to markdown files -### Fixed +### Fixes -- Fix Backspace not deleting selected nodes after clicking on canvas — canvas now receives focus on click so keyboard shortcuts aren't blocked by stale input focus. -- Support Cmd/Ctrl+click for additive multi-select in layers panel (previously only Shift+click worked). -- Fix macOS Tauri build — move `NSAllowsLocalNetworking` ATS config from invalid `tauri.conf.json` property to a proper `Info.plist` file. -- Fix tab order and keyboard handling in inspector panel. -- Fix design token variables not resolved before passing to yoga-layout. -- Suppress keyboard shortcuts while editing property panel inputs. -- Fix tooltip competing with popover trigger on Windows. -- Fix hit area for nodes with rotated parents. -- Error toasts auto-dismiss, deduplicate, and cap stack at 5. -- Bump yoga-layout to 3.3.0-grid.3 with `Node.free()` support. -- Bump PWA precache limit for canvaskit-webgpu. -- Fix color picker dragging flooding the undo stack — fill/stroke/effect color and opacity drags now collapse into a single undo entry per interaction via debounced batching in `PropertyListRoot`. -- Fix .fig import crash on alias variables without a GUID. -- Fix `save_file` crash on vectors with missing tangent control points — default to straight segments. -- Validate `create_vector` path JSON upfront with clear error messages for malformed input. -- Fix MCP/AI tools rejecting string-encoded numeric arguments from MCP clients (`"42"` → `42`). -- Fix "Create Instance" context menu item always grayed out — inverted disabled flag. -- Show "Create Instance" instead of "Create Component" in context menu when a component is selected. -- Fix headless layout: use stored .fig dimensions instead of rough text size estimates (26K → 11K mismatches on material3.fig). -- Fix `--help` output with huge vertical gaps between commands — remove inline examples from query description. -- Fix `openpencil-mcp` npm package missing `dist/stdio.js` — explicitly list entry points in tsconfig. -- Show toast when MCP server fails to start instead of silently swallowing the error. -- Fix provider settings popover not appearing — tooltip wrapper broke floating-ui positioning. -- Fix `set_font_range` producing invalid style runs that crash `.fig` export — use `applyStyleToRange`, apply color and fontWeight from style name. -- Fix MCP "app not connected" error — message now instructs the agent to stop and inform the user. -- Fix external links in AI panel blocked by Tauri ACL — use opener plugin instead of shell. +- Fix Backspace not deleting selected nodes after clicking on canvas — canvas now receives focus on click so keyboard shortcuts aren't blocked by stale input focus +- Support Cmd/Ctrl+click for additive multi-select in layers panel (previously only Shift+click worked) +- Fix macOS Tauri build — move `NSAllowsLocalNetworking` ATS config from invalid `tauri.conf.json` property to a proper `Info.plist` file +- Fix tab order and keyboard handling in inspector panel +- Fix design token variables not resolved before passing to yoga-layout +- Suppress keyboard shortcuts while editing property panel inputs +- Fix tooltip competing with popover trigger on Windows +- Fix hit area for nodes with rotated parents +- Error toasts auto-dismiss, deduplicate, and cap stack at 5 +- Bump yoga-layout to 3.3.0-grid.3 with `Node.free()` support +- Bump PWA precache limit for canvaskit-webgpu +- Fix color picker dragging flooding the undo stack — fill/stroke/effect color and opacity drags now collapse into a single undo entry per interaction via debounced batching in `PropertyListRoot` +- Fix .fig import crash on alias variables without a GUID +- Fix `save_file` crash on vectors with missing tangent control points — default to straight segments +- Validate `create_vector` path JSON upfront with clear error messages for malformed input +- Fix MCP/AI tools rejecting string-encoded numeric arguments from MCP clients (`"42"` → `42`) +- Fix "Create Instance" context menu item always grayed out — inverted disabled flag +- Show "Create Instance" instead of "Create Component" in context menu when a component is selected +- Fix headless layout: use stored .fig dimensions instead of rough text size estimates (26K → 11K mismatches on material3.fig) +- Fix `--help` output with huge vertical gaps between commands — remove inline examples from query description +- Fix `openpencil-mcp` npm package missing `dist/stdio.js` — explicitly list entry points in tsconfig +- Show toast when MCP server fails to start instead of silently swallowing the error +- Fix provider settings popover not appearing — tooltip wrapper broke floating-ui positioning +- Fix `set_font_range` producing invalid style runs that crash `.fig` export — use `applyStyleToRange`, apply color and fontWeight from style name +- Fix MCP "app not connected" error — message now instructs the agent to stop and inform the user +- Fix external links in AI panel blocked by Tauri ACL — use opener plugin instead of shell ## 0.11.6 — 2026-04-08 -### Fixed +### Fixes -- Switch `@open-pencil/core` build from `tsgo` + `fix-esm-import-path` to `tsdown` — fixes bare directory imports that broke Node.js and Bun consumers. +- Switch `@open-pencil/core` build from `tsgo` + `fix-esm-import-path` to `tsdown` — fixes bare directory imports that broke Node.js and Bun consumers ## 0.11.5 — 2026-04-08 -### Fixed +### Fixes -- Fix published npm packages resolving to TypeScript source instead of compiled JavaScript — `publishConfig.exports` overrides are now applied during CI publish. -- Fix Windows CI build failures caused by backslash file paths in custom lint rules. +- Fix published npm packages resolving to TypeScript source instead of compiled JavaScript — `publishConfig.exports` overrides are now applied during CI publish +- Fix Windows CI build failures caused by backslash file paths in custom lint rules ## 0.11.4 — 2026-04-08 -### Fixed +### Fixes -- Fix `@open-pencil/core` published package containing stale import paths from before the domain module restructuring — CLI and MCP installs from npm now resolve correctly. -- Add `save_file` MCP tool for saving the current document to disk. -- Clipboard text export now writes richer v4 `derivedTextData` payloads with glyph outlines for better paste fidelity. +- Fix `@open-pencil/core` published package containing stale import paths from before the domain module restructuring — CLI and MCP installs from npm now resolve correctly +- Add `save_file` MCP tool for saving the current document to disk +- Clipboard text export now writes richer v4 `derivedTextData` payloads with glyph outlines for better paste fidelity ## 0.11.3 — 2026-04-08 -### Fixed +### Fixes -- Show actionable install errors in the chat panel when a required local AI CLI is missing. -- Fix inline layer rename so clearing the name restores the default name, and Backspace/Delete inside rename inputs no longer delete the layer. -- Fix rotated frame hit testing, hover highlights, and selection overlays so interactive areas and overlay labels stay aligned during rotation. -- Fix text edit undo so it restores both the original text and `styleRuns`. -- Pressing Enter with a selected text node now starts text editing and selects all text. -- Fix `ScrubInput` Enter handling so committing a value no longer triggers a second blur-based commit that overwrites it. -- Show the auto-layout panel for `COMPONENT`, `COMPONENT_SET`, and `INSTANCE` nodes. -- Fix missing layout direction icons in the auto-layout controls. -- Fix nested text selection inside gradient cards. -- Unify the size control into a single inline sizing input/dropdown with shorter localized labels to prevent overflow. +- Show actionable install errors in the chat panel when a required local AI CLI is missing +- Fix inline layer rename so clearing the name restores the default name, and Backspace/Delete inside rename inputs no longer delete the layer +- Fix rotated frame hit testing, hover highlights, and selection overlays so interactive areas and overlay labels stay aligned during rotation +- Fix text edit undo so it restores both the original text and `styleRuns` +- Pressing Enter with a selected text node now starts text editing and selects all text +- Fix `ScrubInput` Enter handling so committing a value no longer triggers a second blur-based commit that overwrites it +- Show the auto-layout panel for `COMPONENT`, `COMPONENT_SET`, and `INSTANCE` nodes +- Fix missing layout direction icons in the auto-layout controls +- Fix nested text selection inside gradient cards +- Unify the size control into a single inline sizing input/dropdown with shorter localized labels to prevent overflow ## 0.11.2 — 2026-03-30 -### Fixed +### Fixes -- Stabilize npm publishing with isolated temp publish directories instead of mutating tracked package manifests in CI. -- Strip build-time scripts and dev dependencies from generated publish manifests so tarballs pack from verified artifacts only. -- Fix `@open-pencil/mcp` release packaging so the published npm tarball includes its built `dist/` CLI and server entrypoints deterministically. -- Fix `@open-pencil/core` release build configuration so CI publish jobs include Node and Bun ambient types when compiling package artifacts. +- Stabilize npm publishing with isolated temp publish directories instead of mutating tracked package manifests in CI +- Strip build-time scripts and dev dependencies from generated publish manifests so tarballs pack from verified artifacts only +- Fix `@open-pencil/mcp` release packaging so the published npm tarball includes its built `dist/` CLI and server entrypoints deterministically +- Fix `@open-pencil/core` release build configuration so CI publish jobs include Node and Bun ambient types when compiling package artifacts ## 0.11.1 — 2026-03-30 -### Fixed +### Fixes -- Fix npm publishing pipeline to publish packed tarballs instead of raw package folders. -- Attempt to fix `@open-pencil/mcp` npm package contents so the published CLI includes its built `dist/` entrypoints. -- Fix `@open-pencil/vue` npm package metadata and build output so the published package resolves from `dist/` while local workspace development keeps using source aliases. +- Fix npm publishing pipeline to publish packed tarballs instead of raw package folders +- Attempt to fix `@open-pencil/mcp` npm package contents so the published CLI includes its built `dist/` entrypoints +- Fix `@open-pencil/vue` npm package metadata and build output so the published package resolves from `dist/` while local workspace development keeps using source aliases ## 0.11.0 — 2026-03-30 -### Added +### Features -- Lock and visibility toggle buttons in layers panel (hover to reveal, always shown when active). -- Figma-style selection scope — double-click to enter groups/frames/components, Escape to exit. -- Nested container navigation — each double-click goes one level deeper. -- Dashed border around entered container for visual feedback. -- Layer panel click syncs canvas scope automatically. -- Vue SDK internationalization primitives — `useI18n()`, locale detection, persisted locale selection, lazy-loaded locale JSON files, and exported locale metadata for custom editor shells. -- Vue SDK docs and public API audit — documented advanced exports (`useOkHCL()`, variables helpers, viewport and locale APIs), aligned docs with the actual `provideEditor()` injection model, and expanded release-ready SDK guidance. -- npm release pipeline now publishes `@open-pencil/core`, `@open-pencil/cli`, `@open-pencil/mcp`, and `@open-pencil/vue` together on version tags. -- App language picker in the menu bar — switch UI locale without reloading. -- Added a vector curve editor and improved drawing experience with the pen tool. -- Resume pen drawing from existing open path endpoints — click an endpoint to continue the curve. -- Close open paths by dragging one endpoint to the other. -- Align selected anchor points relative to each other in vector edit mode — the standard alignment buttons in the position panel now operate on selected vertices when 2 or more are selected. -- Unified core IO format registry — `.fig` is now modeled as the native document format alongside shared export adapters for PNG, JPG, WEBP, SVG, and JSX. -- Export selection or current page as `.fig` from the app export UI and app menu. -- New CLI commands: `open-pencil convert` for document conversion, `open-pencil formats` to inspect readable/writable/exportable formats, and `open-pencil lint` for design consistency, structure, and accessibility checks. -- CLI export now supports `.fig` output and routes PNG/JPG/WEBP/SVG/JSX/`.fig` through the shared IO layer. -- `Open…` now supports `.pen` Pencil documents through the shared document reader pipeline while keeping `.fig` as the native save format. -- Display‑P3 document color space pipeline — documents now default to Display‑P3, `.fig` import/export preserves document color profiles, the live canvas requests P3 surfaces with sRGB fallback, and raster/SVG export paths accept explicit color-space targets. -- Color picker overhaul — unified `RGB` / `HSL` / `HSB` / `OkHCL` field formats, slider-space-aware track/thumb previews, and better neutral-color editing behavior for fills, strokes, gradient stops, and component fills. -- OkHCL metadata now round-trips through `.fig` plugin data and integrates directly into the main fill/stroke color workflow with preview gamut diagnostics. -- Vue SDK now exposes reusable color-picker model helpers and solid fill/stroke commit helpers for custom editor shells. -- Update built-in Z.ai and MiniMax model lists — Z.ai now uses the Anthropic-compatible endpoint for GLM coding models, adds GLM-5.1, and MiniMax adds M2.7 / M2.7-highspeed. -- Arabic and RTL support across text rendering, editing, layout, export, and AI tooling — text nodes support `Auto`/`LTR`/`RTL`, auto-layout frames support `Auto`/`LTR`/`RTL` flow, and JSX/AI prompts/tools can now generate and edit both explicitly. +- Lock and visibility toggle buttons in layers panel (hover to reveal, always shown when active) +- Figma-style selection scope — double-click to enter groups/frames/components, Escape to exit +- Nested container navigation — each double-click goes one level deeper +- Dashed border around entered container for visual feedback +- Layer panel click syncs canvas scope automatically +- Vue SDK internationalization primitives — `useI18n()`, locale detection, persisted locale selection, lazy-loaded locale JSON files, and exported locale metadata for custom editor shells +- Vue SDK docs and public API audit — documented advanced exports (`useOkHCL()`, variables helpers, viewport and locale APIs), aligned docs with the actual `provideEditor()` injection model, and expanded release-ready SDK guidance +- npm release pipeline now publishes `@open-pencil/core`, `@open-pencil/cli`, `@open-pencil/mcp`, and `@open-pencil/vue` together on version tags +- App language picker in the menu bar — switch UI locale without reloading +- Added a vector curve editor and improved drawing experience with the pen tool +- Resume pen drawing from existing open path endpoints — click an endpoint to continue the curve +- Close open paths by dragging one endpoint to the other +- Align selected anchor points relative to each other in vector edit mode — the standard alignment buttons in the position panel now operate on selected vertices when 2 or more are selected +- Unified core IO format registry — `.fig` is now modeled as the native document format alongside shared export adapters for PNG, JPG, WEBP, SVG, and JSX +- Export selection or current page as `.fig` from the app export UI and app menu +- New CLI commands: `open-pencil convert` for document conversion, `open-pencil formats` to inspect readable/writable/exportable formats, and `open-pencil lint` for design consistency, structure, and accessibility checks +- CLI export now supports `.fig` output and routes PNG/JPG/WEBP/SVG/JSX/`.fig` through the shared IO layer +- `Open…` now supports `.pen` Pencil documents through the shared document reader pipeline while keeping `.fig` as the native save format +- Display‑P3 document color space pipeline — documents now default to Display‑P3, `.fig` import/export preserves document color profiles, the live canvas requests P3 surfaces with sRGB fallback, and raster/SVG export paths accept explicit color-space targets +- Color picker overhaul — unified `RGB` / `HSL` / `HSB` / `OkHCL` field formats, slider-space-aware track/thumb previews, and better neutral-color editing behavior for fills, strokes, gradient stops, and component fills +- OkHCL metadata now round-trips through `.fig` plugin data and integrates directly into the main fill/stroke color workflow with preview gamut diagnostics +- Vue SDK now exposes reusable color-picker model helpers and solid fill/stroke commit helpers for custom editor shells +- Update built-in Z.ai and MiniMax model lists — Z.ai now uses the Anthropic-compatible endpoint for GLM coding models, adds GLM-5.1, and MiniMax adds M2.7 / M2.7-highspeed +- Arabic and RTL support across text rendering, editing, layout, export, and AI tooling — text nodes support `Auto`/`LTR`/`RTL`, auto-layout frames support `Auto`/`LTR`/`RTL` flow, and JSX/AI prompts/tools can now generate and edit both explicitly -### Fixed +### Fixes - Fix shortcuts, now work on non-English keyboard layouts. -- Fix imported `.fig` file open and page-switch regressions — loaded documents now keep graph/store state in sync, remap imported canvas/page children correctly, and recompute imported auto-layout descendants when switching pages. -- Fix first canvas render happening before fonts load — wait for fonts before the initial draw to avoid Safari and text measurement glitches. -- Preserve `fig-kiwi` version on `.fig` roundtrip — imports keep the original header version instead of rewriting everything to a hardcoded value; new files default to version 101. -- Normalize auto-layout text export for Figma — text children inside auto-layout frames now serialize with `NONE` auto-resize to match Figma behavior and avoid overflow on reimport. -- Fix keyboard editing regressions after the refactor — canvas shortcuts no longer fire while editing text, and Delete/Backspace no longer delete nodes during text entry. -- Fix MCP page switching persistence — `switch_page` now survives across tool calls in the same session. -- Improve CJK font fallback coverage — load multiple Google Fonts for broader Han/Japanese/Korean text support. -- Normalize more visible UI strings for localized app chrome — menus, panels, variables dialog, code panel, chat setup, and editor controls now respect the selected locale instead of falling back to English in common flows. -- Fix imported text rendering in browser and headless export — preserve stored bounds until fonts are ready, restore missing font-loaded guards, use natural width for `WIDTH_AND_HEIGHT` text, and clip text to node bounds. -- Fix browser/headless rendering mismatch for imported toolbar/instance content by correcting runtime imported layout recomputation instead of diverging browser rendering behavior. -- Fix `set_layout` tool not defaulting to HUG sizing when enabling auto-layout — frames now shrink/grow to fit children instead of keeping fixed dimensions. -- Normalize font family names on `.fig` export — strip optical size suffixes (e.g. "DM Sans 9pt" → "DM Sans") so Figma recognizes the font. -- TEXT nodes now default to a solid black fill — previously exported with no fill, making text invisible when opened in Figma. -- Fix save crash when COLOR variable is missing alpha channel. -- Fix console error spam on deployed web app from automation WebSocket reconnect loop. -- Fix headless CLI font fallback — bundled Inter font now ships with `@open-pencil/core` and loads without a web server. -- Locked nodes now block move, resize, rotate, and delete on canvas. -- Locked containers block double-click enter. -- Marquee selection skips locked and hidden nodes. -- COMPONENT/INSTANCE containers are now enterable via double-click. -- Replaced the alignment and reflection icons with the correct ones. +- Fix imported `.fig` file open and page-switch regressions — loaded documents now keep graph/store state in sync, remap imported canvas/page children correctly, and recompute imported auto-layout descendants when switching pages +- Fix first canvas render happening before fonts load — wait for fonts before the initial draw to avoid Safari and text measurement glitches +- Preserve `fig-kiwi` version on `.fig` roundtrip — imports keep the original header version instead of rewriting everything to a hardcoded value; new files default to version 101 +- Normalize auto-layout text export for Figma — text children inside auto-layout frames now serialize with `NONE` auto-resize to match Figma behavior and avoid overflow on reimport +- Fix keyboard editing regressions after the refactor — canvas shortcuts no longer fire while editing text, and Delete/Backspace no longer delete nodes during text entry +- Fix MCP page switching persistence — `switch_page` now survives across tool calls in the same session +- Improve CJK font fallback coverage — load multiple Google Fonts for broader Han/Japanese/Korean text support +- Normalize more visible UI strings for localized app chrome — menus, panels, variables dialog, code panel, chat setup, and editor controls now respect the selected locale instead of falling back to English in common flows +- Fix imported text rendering in browser and headless export — preserve stored bounds until fonts are ready, restore missing font-loaded guards, use natural width for `WIDTH_AND_HEIGHT` text, and clip text to node bounds +- Fix browser/headless rendering mismatch for imported toolbar/instance content by correcting runtime imported layout recomputation instead of diverging browser rendering behavior +- Fix `set_layout` tool not defaulting to HUG sizing when enabling auto-layout — frames now shrink/grow to fit children instead of keeping fixed dimensions +- Normalize font family names on `.fig` export — strip optical size suffixes (e.g. "DM Sans 9pt" → "DM Sans") so Figma recognizes the font +- TEXT nodes now default to a solid black fill — previously exported with no fill, making text invisible when opened in Figma +- Fix save crash when COLOR variable is missing alpha channel +- Fix console error spam on deployed web app from automation WebSocket reconnect loop +- Fix headless CLI font fallback — bundled Inter font now ships with `@open-pencil/core` and loads without a web server +- Locked nodes now block move, resize, rotate, and delete on canvas +- Locked containers block double-click enter +- Marquee selection skips locked and hidden nodes +- COMPONENT/INSTANCE containers are now enterable via double-click +- Replaced the alignment and reflection icons with the correct ones ## 0.10.0 — 2026-03-15 -### Added - -- ACP agent support — use Claude Code, Codex, or Gemini CLI as AI assistants in the desktop chat panel. -- Permission confirmation dialog — ACP agents request user approval for file/shell operations, MCP design tools auto-approved. -- Unified MCP server — single HTTP + WebSocket proxy replaces Vite SSR bridge. -- Stock photo integration — `stock_photo` tool fetches images from Pexels or Unsplash and applies to design nodes. Provider adapter supports custom providers. -- Skeleton-first AI workflow — 4-phase design process (plan → skeleton → content fill via `replace_id` → polish) for more reliable AI-generated layouts. -- Batched AI tools — `calc` accepts arrays of expressions, `stock_photo` fetches all images in parallel, `batch_update` applies multiple property changes in one call, `describe` accepts `ids` array for multi-node inspection. -- AI visual feedback — blue pulsing border on nodes being modified, green flash on completion. -- Auto-depth `describe` — adapts inspection depth to subtree size (small block → deeper, large page → shallower). -- `set_fill` gradient support — linear gradients with `color_end` and `gradient` direction params. -- `render` tool `replace_id` — atomically swap skeleton placeholders with real content. -- MCP `export_image_file` tool for headless PNG rendering. -- Grid layout in AI chat — JSX renderer supports `grid`, `columns`, `rows`, `gap` props. -- Configurable max output tokens in AI provider settings (default 16384). -- Z.ai AI provider with GLM-5, GLM-4.7, GLM-4.6, GLM-4.5 model families. -- MiniMax AI provider with M2.5, M2.1, M2 models. - -### Fixed - -- Resolve variable-bound fill colors through alias chains. -- Fix SCALE constraint resizing for auto-layout instances. -- Propagate SCALE constraints through instance clone chains. -- Skip self-referencing symbolOverrides on nodes with explicit kiwi properties. -- Fix DSD resolution for swapped instance children. -- Fix instance swap override propagation through clone chains. -- Fix component property override resolution through clone chains. -- Fix text/property overrides clobbered by second transitive sync. - - -- Fix text rendering with wrong fonts on file open — all font weights (including default family) are now loaded before the first render. -- Fix `weightToStyle` mapping: weight 400 now correctly maps to "Regular" instead of "Medium". -- Fix detached ArrayBuffer crash when switching pages after saving — export worker now copies image buffers before transferring. -- Show warning toast when fonts fail to load, error toast when file open fails. -- Fix FillPicker crash when selecting image fills (missing `ref` import from #92). -- Fix Google Fonts TLS/network errors not cached — failed families no longer retry on every render. -- Fix CJK text garbled when font is unavailable — fallback now renders through paragraph shaper instead of raw `drawText`, preserving CJK characters via the fallback font chain. -- Fix auto-layout overflow in AI-generated designs — text wrapping, min/max constraints, absolute positioning, and FILL sizing now work correctly. -- Fix `layoutAlignSelf` limited to STRETCH — full range supported (CENTER, MAX, MIN, BASELINE). -- Fix hidden auto-layout children losing their dimensions on layout recompute. -- Fix ProviderSettings popover not visible in AI chat. -- Fix paste/copy/cut intercepted by canvas in AI chat input. -- Strip TypeScript casts from AI-generated JSX (`as any`, `as const`). -- Fix parsing complex .fig files crashing on missing GUIDs in component overrides. -- Fix headless text layout using 100×100 default size instead of estimated dimensions — multi-line wrapping now estimated correctly. -- Fix clipboard roundtrip losing properties — clipsContent, constraints, arcData, strokeCap/Join, layoutAlignSelf, textAutoResize, autoRename now preserved in Figma Kiwi serialization. -- Fix MCP headless export crashing on `window.queryLocalFonts` in non-browser runtimes (Bun/Node). -- Fix MCP `export_image` rendering blank text — fonts now loaded before rasterization. -- Fix text always using paragraph rendering with Inter fallback chain (no more missing-font garbling). -- Clip children to rounded corners when `clipsContent` is true. -- Use child shape for drop shadows on transparent containers. -- Treat `FOREGROUND_BLUR` as layer blur wrapping children. -- Fix radial, angular, and diamond gradient rendering. -- Fix .fig export roundtrip: variable GUIDs colliding with document. -- Fix file open dialog not working on first click in Safari. -- Skip variable fonts from local font access, use Google Fonts instead. -- Disable autosave by default. - ### Performance -- Offload .fig parsing (unzip + Kiwi decode) to a Web Worker — main thread stays responsive during file open. -- Offload .fig compression to a Web Worker during save (was blocking 450ms+). -- Add instance index (`componentId → Set`) — `getInstances()` is O(1) instead of scanning all nodes. -- Defer graph event subscription until after layout computation during file open — eliminates redundant `syncInstances` calls. -- Cache label collection (sections/components) per scene mutation instead of walking the full tree every frame. -- Blocking font loading — fonts load before first render to ensure correct glyphs. +- Offload .fig parsing (unzip + Kiwi decode) to a Web Worker — main thread stays responsive during file open +- Offload .fig compression to a Web Worker during save (was blocking 450ms+) +- Add instance index (`componentId → Set`) — `getInstances()` is O(1) instead of scanning all nodes +- Defer graph event subscription until after layout computation during file open — eliminates redundant `syncInstances` calls +- Cache label collection (sections/components) per scene mutation instead of walking the full tree every frame +- Blocking font loading — fonts load before first render to ensure correct glyphs + +### Features + +- ACP agent support — use Claude Code, Codex, or Gemini CLI as AI assistants in the desktop chat panel +- Permission confirmation dialog — ACP agents request user approval for file/shell operations, MCP design tools auto-approved +- Unified MCP server — single HTTP + WebSocket proxy replaces Vite SSR bridge +- Stock photo integration — `stock_photo` tool fetches images from Pexels or Unsplash and applies to design nodes. Provider adapter supports custom providers. +- Skeleton-first AI workflow — 4-phase design process (plan → skeleton → content fill via `replace_id` → polish) for more reliable AI-generated layouts +- Batched AI tools — `calc` accepts arrays of expressions, `stock_photo` fetches all images in parallel, `batch_update` applies multiple property changes in one call, `describe` accepts `ids` array for multi-node inspection +- AI visual feedback — blue pulsing border on nodes being modified, green flash on completion +- Auto-depth `describe` — adapts inspection depth to subtree size (small block → deeper, large page → shallower) +- `set_fill` gradient support — linear gradients with `color_end` and `gradient` direction params +- `render` tool `replace_id` — atomically swap skeleton placeholders with real content +- MCP `export_image_file` tool for headless PNG rendering +- Grid layout in AI chat — JSX renderer supports `grid`, `columns`, `rows`, `gap` props +- Configurable max output tokens in AI provider settings (default 16384) +- Z.ai AI provider with GLM-5, GLM-4.7, GLM-4.6, GLM-4.5 model families +- MiniMax AI provider with M2.5, M2.1, M2 models + +### Improved .fig import fidelity + +- Resolve variable-bound fill colors through alias chains +- Fix SCALE constraint resizing for auto-layout instances +- Propagate SCALE constraints through instance clone chains +- Skip self-referencing symbolOverrides on nodes with explicit kiwi properties +- Fix DSD resolution for swapped instance children +- Fix instance swap override propagation through clone chains +- Fix component property override resolution through clone chains +- Fix text/property overrides clobbered by second transitive sync + +### Fixes + +- Fix text rendering with wrong fonts on file open — all font weights (including default family) are now loaded before the first render +- Fix `weightToStyle` mapping: weight 400 now correctly maps to "Regular" instead of "Medium" +- Fix detached ArrayBuffer crash when switching pages after saving — export worker now copies image buffers before transferring +- Show warning toast when fonts fail to load, error toast when file open fails +- Fix FillPicker crash when selecting image fills (missing `ref` import from #92) +- Fix Google Fonts TLS/network errors not cached — failed families no longer retry on every render +- Fix CJK text garbled when font is unavailable — fallback now renders through paragraph shaper instead of raw `drawText`, preserving CJK characters via the fallback font chain +- Fix auto-layout overflow in AI-generated designs — text wrapping, min/max constraints, absolute positioning, and FILL sizing now work correctly +- Fix `layoutAlignSelf` limited to STRETCH — full range supported (CENTER, MAX, MIN, BASELINE) +- Fix hidden auto-layout children losing their dimensions on layout recompute +- Fix ProviderSettings popover not visible in AI chat +- Fix paste/copy/cut intercepted by canvas in AI chat input +- Strip TypeScript casts from AI-generated JSX (`as any`, `as const`) +- Fix parsing complex .fig files crashing on missing GUIDs in component overrides +- Fix headless text layout using 100×100 default size instead of estimated dimensions — multi-line wrapping now estimated correctly +- Fix clipboard roundtrip losing properties — clipsContent, constraints, arcData, strokeCap/Join, layoutAlignSelf, textAutoResize, autoRename now preserved in Figma Kiwi serialization +- Fix MCP headless export crashing on `window.queryLocalFonts` in non-browser runtimes (Bun/Node) +- Fix MCP `export_image` rendering blank text — fonts now loaded before rasterization +- Fix text always using paragraph rendering with Inter fallback chain (no more missing-font garbling) +- Clip children to rounded corners when `clipsContent` is true +- Use child shape for drop shadows on transparent containers +- Treat `FOREGROUND_BLUR` as layer blur wrapping children +- Fix radial, angular, and diamond gradient rendering +- Fix .fig export roundtrip: variable GUIDs colliding with document +- Fix file open dialog not working on first click in Safari +- Skip variable fonts from local font access, use Google Fonts instead +- Disable autosave by default ## 0.9.0 — 2026-03-09 -### Added +### Features -- XPath query command — `open-pencil query design.fig "//FRAME[@width < 300]"` to find nodes by type, attributes, and tree structure using XPath selectors. -- CSS Grid layout mode — select a frame, click the grid icon in the auto layout toolbar to switch from flex to grid. Configure column/row tracks (fr, fixed px, auto), column and row gaps, and per-side padding. Powered by a [Yoga fork](https://github.com/open-pencil/yoga/tree/grid) with cherry-picked CSS Grid PRs from upstream. -- JSX and Tailwind CSS export for grid layouts — `grid grid-cols-N`, `gap-x-*`/`gap-y-*`, child `col-start-*`/`row-start-*`/`col-span-*`/`row-span-*`. -- Multi-provider AI support — connect to Anthropic, OpenAI, Google AI, or any OpenAI-compatible endpoint directly, in addition to OpenRouter. Per-provider API key storage, provider settings popover, automatic migration from single OpenRouter key. -- Anthropic-compatible provider for custom API endpoints. -- New AI tools: `get_jsx` (JSX roundtrip view), `diff_jsx` (structural diff), `describe` (semantic role, visual style, layout, design issues). -- AI visual verification — `export_image` returns image content to the model for vision-based review. -- API type toggle (Completions/Responses) for OpenAI-compatible providers. -- Figma zoom shortcuts — ⌘0 (100%), ⌘1 (zoom to fit), ⌘2 (zoom to selection), ⇧1/⇧2 alternatives. -- XPath query tool — `query_nodes` for AI/MCP with attribute selectors, tree traversal, and type filtering. +- XPath query command — `open-pencil query design.fig "//FRAME[@width < 300]"` to find nodes by type, attributes, and tree structure using XPath selectors +- CSS Grid layout mode — select a frame, click the grid icon in the auto layout toolbar to switch from flex to grid. Configure column/row tracks (fr, fixed px, auto), column and row gaps, and per-side padding. Powered by a [Yoga fork](https://github.com/open-pencil/yoga/tree/grid) with cherry-picked CSS Grid PRs from upstream +- JSX and Tailwind CSS export for grid layouts — `grid grid-cols-N`, `gap-x-*`/`gap-y-*`, child `col-start-*`/`row-start-*`/`col-span-*`/`row-span-*` +- Multi-provider AI support — connect to Anthropic, OpenAI, Google AI, or any OpenAI-compatible endpoint directly, in addition to OpenRouter. Per-provider API key storage, provider settings popover, automatic migration from single OpenRouter key +- Anthropic-compatible provider for custom API endpoints +- New AI tools: `get_jsx` (JSX roundtrip view), `diff_jsx` (structural diff), `describe` (semantic role, visual style, layout, design issues) +- AI visual verification — `export_image` returns image content to the model for vision-based review +- API type toggle (Completions/Responses) for OpenAI-compatible providers +- Figma zoom shortcuts — ⌘0 (100%), ⌘1 (zoom to fit), ⌘2 (zoom to selection), ⇧1/⇧2 alternatives +- XPath query tool — `query_nodes` for AI/MCP with attribute selectors, tree traversal, and type filtering -### Changed +### Fixes -- Padding on a frame auto-enables vertical auto-layout. -- AI tools run `computeAllLayouts` after execution — layout updates immediately. -- Enhanced AI system prompt with full JSX prop reference and verification workflow. -- Chat panel preserves messages when toggling UI visibility. -- SceneGraph event bus (nanoevents) — `node:created`, `node:updated`, `node:deleted`, `node:reparented`, `node:reordered` events replace monkey-patching in collab sync and manual render invalidation. -- Replace esbuild-wasm (14 MB) with sucrase (201 KB) for JSX transform — `buildComponent()` and `renderJSX()` now synchronous and browser-compatible. -- `useMagicKeys` keyboard shortcut system — replaces tinykeys with VueUse built-in, cross-platform Meta/Control handling, modifier exclusion for combo conflicts. -- Dev-only debug toolbar for copying chat logs. -- Auto-layout icons in layer tree — vertical (rows), horizontal (columns), and grid icons for auto-layout frames; components keep their purple diamond. -- Frame titles on canvas are now draggable — clicking a selected top-level frame's name label starts a drag. -- Compact layout controls — icon-based gap (↔/↕) and padding (T/R/B/L) inputs instead of text labels. -- Auto-detect horizontal vs vertical direction when wrapping in auto layout (Shift+A). -- Fix alignment grid for vertical layouts — visual positions now match spatial axes. -- Fix grid switch from HUG-sized frames — frame expands to fit children. -- Remove unwanted white fill when wrapping in auto layout. - -### Fixed - -- Serialize variables, collections, and bindings to `.fig` files — previously lost on save (#65). -- Text nodes created via MCP now render in Figma — emit `derivedTextData` with font metadata and layout size (#64). -- Double-click on layer tree no longer toggles expand/collapse — use the chevron instead. -- Page rename input matches layer rename styling. -- Fix `w="fill"`/`h="fill"` in JSX renderer — now direction-aware based on parent flex axis. -- Fix text auto-resize defaulting to fixed 100×100 — text without explicit width uses `WIDTH_AND_HEIGHT`. -- Fix `clipsContent` not propagated to Yoga — frames with clip enabled now set `Overflow.Hidden`. -- Fix `COUNTER_ALIGN_MAP` mapping stretch to `MIN` instead of `STRETCH`. -- Fix JSX export omitting x/y for absolute-positioned children. -- Fix JSX export ignoring `textAutoResize` for text sizing. -- Fix drag terminating on mouseleave — drags now continue outside the canvas. -- Fix `export_image` stack overflow on large nodes — chunked base64 encoding. -- Undo support for auto-layout reorder, layer tree reorder, and drag reparent. -- Page snapshot undo for AI tool mutations. -- Fix collab sync for same-parent reorder — `node:reordered` events now propagated to Yjs peers. -- Fix orphaned instances on clipboard paste — detach to FRAME when component is missing. -- Fix text typography lost on Figma clipboard import — preserve fontFamily, fontWeight, fontSize, lineHeight. -- Fix `copyFill` missing `gradientTransform` and `imageTransform` — gradient fills now round-trip correctly. +- Serialize variables, collections, and bindings to `.fig` files — previously lost on save (#65) +- Text nodes created via MCP now render in Figma — emit `derivedTextData` with font metadata and layout size (#64) +- Double-click on layer tree no longer toggles expand/collapse — use the chevron instead +- Page rename input matches layer rename styling +- Fix `w="fill"`/`h="fill"` in JSX renderer — now direction-aware based on parent flex axis +- Fix text auto-resize defaulting to fixed 100×100 — text without explicit width uses `WIDTH_AND_HEIGHT` +- Fix `clipsContent` not propagated to Yoga — frames with clip enabled now set `Overflow.Hidden` +- Fix `COUNTER_ALIGN_MAP` mapping stretch to `MIN` instead of `STRETCH` +- Fix JSX export omitting x/y for absolute-positioned children +- Fix JSX export ignoring `textAutoResize` for text sizing +- Fix drag terminating on mouseleave — drags now continue outside the canvas +- Fix `export_image` stack overflow on large nodes — chunked base64 encoding +- Undo support for auto-layout reorder, layer tree reorder, and drag reparent +- Page snapshot undo for AI tool mutations +- Fix collab sync for same-parent reorder — `node:reordered` events now propagated to Yjs peers +- Fix orphaned instances on clipboard paste — detach to FRAME when component is missing +- Fix text typography lost on Figma clipboard import — preserve fontFamily, fontWeight, fontSize, lineHeight +- Fix `copyFill` missing `gradientTransform` and `imageTransform` — gradient fills now round-trip correctly ### Performance -- Event-driven rendering and component sync — `SceneGraph` emits typed events on mutations; `requestRender()` calls reduced from 94 to 22, component instance sync uses microtask batching with deduplication. -- Replace `structuredClone` with typed copy helpers for fills, strokes, effects, and style runs (~24× faster in hot paths). -- Filter .fig unzip to only decompress canvas and image entries, skipping metadata cruft. +- Event-driven rendering and component sync — `SceneGraph` emits typed events on mutations; `requestRender()` calls reduced from 94 to 22, component instance sync uses microtask batching with deduplication +- Replace `structuredClone` with typed copy helpers for fills, strokes, effects, and style runs (~24× faster in hot paths) +- Filter .fig unzip to only decompress canvas and image entries, skipping metadata cruft + +### Improvements + +- Padding on a frame auto-enables vertical auto-layout +- AI tools run `computeAllLayouts` after execution — layout updates immediately +- Enhanced AI system prompt with full JSX prop reference and verification workflow +- Chat panel preserves messages when toggling UI visibility +- SceneGraph event bus (nanoevents) — `node:created`, `node:updated`, `node:deleted`, `node:reparented`, `node:reordered` events replace monkey-patching in collab sync and manual render invalidation +- Replace esbuild-wasm (14 MB) with sucrase (201 KB) for JSX transform — `buildComponent()` and `renderJSX()` now synchronous and browser-compatible +- `useMagicKeys` keyboard shortcut system — replaces tinykeys with VueUse built-in, cross-platform Meta/Control handling, modifier exclusion for combo conflicts +- Dev-only debug toolbar for copying chat logs +- Auto-layout icons in layer tree — vertical (rows), horizontal (columns), and grid icons for auto-layout frames; components keep their purple diamond +- Frame titles on canvas are now draggable — clicking a selected top-level frame's name label starts a drag +- Compact layout controls — icon-based gap (↔/↕) and padding (T/R/B/L) inputs instead of text labels +- Auto-detect horizontal vs vertical direction when wrapping in auto layout (Shift+A) +- Fix alignment grid for vertical layouts — visual positions now match spatial axes +- Fix grid switch from HUG-sized frames — frame expands to fit children +- Remove unwanted white fill when wrapping in auto layout ## 0.8.0 — 2026-03-07 -### Added +### Features -- Mobile layout & PWA — responsive editor with touch-optimized toolbar, swipeable bottom drawer (layers/properties/design/code), HUD overlay, and installable PWA with icons and service worker. +- Mobile layout & PWA — responsive editor with touch-optimized toolbar, swipeable bottom drawer (layers/properties/design/code), HUD overlay, and installable PWA with icons and service worker - Tailwind CSS v4 JSX export — export selections as HTML with Tailwind utility classes (`
`) from the Code panel, CLI (`bun open-pencil export --format jsx --style tailwind`), or programmatically via `sceneNodeToJSX(id, graph, 'tailwind')`. Supports layout, sizing, colors, border radius, opacity, rotation, overflow, shadows, blur, and typography. Uses v4 spacing semantics (px/4 multiplier) with automatic fallback to arbitrary values. -- Code panel format toggle — switch between OpenPencil (custom components) and Tailwind (HTML + utility classes) output. -- Homebrew tap — `brew install open-pencil/tap/open-pencil` for macOS (arm64 + x64), auto-updated on each release. -- Double-click to rename layers — inline rename in layer panel, shared `useInlineRename` composable. -- New AI/MCP tools: `analyze_colors`, `analyze_typography`, `analyze_spacing`, `analyze_clusters`, `diff_create`, `diff_show`, `get_components`, `get_current_page`, `arrange`, `node_to_component`. -- CLI-to-app RPC bridge — all CLI commands work against the running app when no file is specified. Start the app, then run `bun open-pencil tree` to inspect the live document. -- VitePress docs site — user guide, reference, architecture, and development docs at openpencil.dev with 6 locales (en, de, fr, es, it, pl), SEO (OG tags, hreflang, JSON-LD, sitemap), and dark theme. +- Code panel format toggle — switch between OpenPencil (custom components) and Tailwind (HTML + utility classes) output +- Homebrew tap — `brew install open-pencil/tap/open-pencil` for macOS (arm64 + x64), auto-updated on each release +- Double-click to rename layers — inline rename in layer panel, shared `useInlineRename` composable +- New AI/MCP tools: `analyze_colors`, `analyze_typography`, `analyze_spacing`, `analyze_clusters`, `diff_create`, `diff_show`, `get_components`, `get_current_page`, `arrange`, `node_to_component` +- CLI-to-app RPC bridge — all CLI commands work against the running app when no file is specified. Start the app, then run `bun open-pencil tree` to inspect the live document +- VitePress docs site — user guide, reference, architecture, and development docs at openpencil.dev with 6 locales (en, de, fr, es, it, pl), SEO (OG tags, hreflang, JSON-LD, sitemap), and dark theme -### Changed +### Improvements -- Refactor mobile drawer tabs, layout sizing dropdowns, and inline rename to use Reka UI primitives. -- Add shared UI style helpers with tailwind-variants for menus, selects, buttons, and surfaces. -- Unified tool definitions — define once in `packages/core/src/tools/`, automatically available in AI chat, CLI, and MCP. -- Harden FigmaAPI — hide internals via Symbols, freeze arrays, fix `layoutSizing`, 30+ new properties and methods. -- Split tools into domain files (read, create, modify, structure, variables, vector, analyze) — easier to navigate and extend. -- Replace inline type definitions with named types (`Color`, `Vector`, `SceneNode`) across the codebase. -- Split 3200-line `renderer.ts` into `packages/core/src/renderer/` with 10 focused files (scene, overlays, fills, strokes, shapes, effects, rulers, labels). -- Centralize all color utilities in `packages/core/src/color.ts` — `colorToHex8`, `colorToCSSCompact`, `normalizeColor`, `colorDistance`; remove 5 duplicate implementations across the codebase. -- Add `geometry.ts` with shared rotation math (`degToRad`, `radToDeg`, `rotatePoint`, `rotatedCorners`, `rotatedBBox`). -- Extract `isArrayMixed()` helper for multi-selection property panels. +- Refactor mobile drawer tabs, layout sizing dropdowns, and inline rename to use Reka UI primitives +- Add shared UI style helpers with tailwind-variants for menus, selects, buttons, and surfaces +- Unified tool definitions — define once in `packages/core/src/tools/`, automatically available in AI chat, CLI, and MCP +- Harden FigmaAPI — hide internals via Symbols, freeze arrays, fix `layoutSizing`, 30+ new properties and methods +- Split tools into domain files (read, create, modify, structure, variables, vector, analyze) — easier to navigate and extend +- Replace inline type definitions with named types (`Color`, `Vector`, `SceneNode`) across the codebase +- Split 3200-line `renderer.ts` into `packages/core/src/renderer/` with 10 focused files (scene, overlays, fills, strokes, shapes, effects, rulers, labels) +- Centralize all color utilities in `packages/core/src/color.ts` — `colorToHex8`, `colorToCSSCompact`, `normalizeColor`, `colorDistance`; remove 5 duplicate implementations across the codebase +- Add `geometry.ts` with shared rotation math (`degToRad`, `radToDeg`, `rotatePoint`, `rotatedCorners`, `rotatedBBox`) +- Extract `isArrayMixed()` helper for multi-selection property panels +### Fixes -- Add `motion-v` for declarative animations — used in mobile drawer (spring-animated height with pan gestures) and toolbar (layout-animated category switching with directional slide transitions). -- Mobile drawer: replace `useSwipe` + manual rAF animation with `motion.div` `:animate` + `@pan`/`@panEnd`; always-on tab state (no more null `activeRibbonTab`); content stays rendered when closed. -- Mobile toolbar: replace manual `scrollWidth` measuring + inline CSS transitions with `motion.div layout` + `AnimatePresence` directional slide variants. -- Mobile UI cleanup: extract shared `colorToCSS` util to core, `initials` to `src/utils/text`, `toolIcons` to `src/utils/tools`; replace hand-rolled dropdowns with reka-ui Popover/DropdownMenu; narrow `mobileDrawerSnap` type to string union; move magic numbers to constants; disable PWA service worker in dev mode. -- 83 new E2E tests (57 → 140): design panel, code panel, components, copy/paste, multi-page, text editing, keyboard shortcuts, context menu. -- 150 new unit tests (588 → 738): color, undo, snap, vector, style-runs, text-editor. -- 48 new E2E tests (9 spec files) + 26 mutation unit tests + store/canvas test helpers. -- Add `data-test-id` attributes to AppearanceSection, LayoutSection, TypographySection, VariablesDialog, EditorView. +- Fix drawer animation jump on close — single spring transition instead of two-phase +- Fix `ALL_TOOLS` registry missing newer tools (`analyzeColors`, `diffCreate`, `exportImage`, `arrangeNodes`) +- Fix `renderJSX` typo in tool definitions (`renderJsx` → `renderJSX`) +- Fix all oxlint warnings and tsgo errors — replace `!` non-null assertions in `use-collab.ts` with local const captures +- Fix broken test imports — stale `../../src/engine/` paths updated to `@open-pencil/core` +- Fix flaky E2E tests: layers panel navigates to `/demo`, zoom-to-fit test zooms in first, snapshot rendering stabilized with `workers: 1` and `colorScheme: dark` +- Fix bogus .fig import mappings for `expanded` and `strokeMiterLimit` fields +- Fix PWA manifest error in dev mode, handle invalid font data gracefully +- Fix eval response unwrapping and `export_jsx` page selection in RPC bridge +- Fix automation commands not recomputing layouts after mutations +- Fix workspace dependency not resolved when installing from npm (switch CI to pnpm publish) -### Fixed +### Internal -- Fix drawer animation jump on close — single spring transition instead of two-phase. -- Fix `ALL_TOOLS` registry missing newer tools (`analyzeColors`, `diffCreate`, `exportImage`, `arrangeNodes`). -- Fix `renderJSX` typo in tool definitions (`renderJsx` → `renderJSX`). -- Fix all oxlint warnings and tsgo errors — replace `!` non-null assertions in `use-collab.ts` with local const captures. -- Fix broken test imports — stale `../../src/engine/` paths updated to `@open-pencil/core`. -- Fix flaky E2E tests: layers panel navigates to `/demo`, zoom-to-fit test zooms in first, snapshot rendering stabilized with `workers: 1` and `colorScheme: dark`. -- Fix bogus .fig import mappings for `expanded` and `strokeMiterLimit` fields. -- Fix PWA manifest error in dev mode, handle invalid font data gracefully. -- Fix eval response unwrapping and `export_jsx` page selection in RPC bridge. -- Fix automation commands not recomputing layouts after mutations. -- Fix workspace dependency not resolved when installing from npm (switch CI to pnpm publish). +- Add `motion-v` for declarative animations — used in mobile drawer (spring-animated height with pan gestures) and toolbar (layout-animated category switching with directional slide transitions) +- Mobile drawer: replace `useSwipe` + manual rAF animation with `motion.div` `:animate` + `@pan`/`@panEnd`; always-on tab state (no more null `activeRibbonTab`); content stays rendered when closed +- Mobile toolbar: replace manual `scrollWidth` measuring + inline CSS transitions with `motion.div layout` + `AnimatePresence` directional slide variants +- Mobile UI cleanup: extract shared `colorToCSS` util to core, `initials` to `src/utils/text`, `toolIcons` to `src/utils/tools`; replace hand-rolled dropdowns with reka-ui Popover/DropdownMenu; narrow `mobileDrawerSnap` type to string union; move magic numbers to constants; disable PWA service worker in dev mode +- 83 new E2E tests (57 → 140): design panel, code panel, components, copy/paste, multi-page, text editing, keyboard shortcuts, context menu +- 150 new unit tests (588 → 738): color, undo, snap, vector, style-runs, text-editor +- 48 new E2E tests (9 spec files) + 26 mutation unit tests + store/canvas test helpers +- Add `data-test-id` attributes to AppearanceSection, LayoutSection, TypographySection, VariablesDialog, EditorView ## 0.7.0 — 2026-03-05 -### Added +### Features -- SVG export — export selections as SVG from the export panel, context menu, CLI (`bun open-pencil export --format svg`), or MCP/AI tools (`export_svg`). Supports rectangles, ellipses, lines, stars, polygons, vectors, text with style runs, gradients, image fills, effects, blend modes, clip paths, and nested groups (#46). -- Copy/Paste as submenu in context menu — Copy as text, Copy as SVG, Copy as PNG (⇧⌘C), Copy as JSX. -- Stroke align (Inside/Center/Outside) with clip-based rendering matching Figma behavior. -- Individual stroke weights per side (Top/Right/Bottom/Left) with side selector dropdown. -- Google Fonts fallback — automatically loads fonts from Google Fonts API when not available locally. -- Auto-save toggle in File menu — disable to prevent automatic writes to the opened .fig file. -- Renderer profiler with in-canvas HUD overlay, GPU timing, and phase instrumentation. +- SVG export — export selections as SVG from the export panel, context menu, CLI (`bun open-pencil export --format svg`), or MCP/AI tools (`export_svg`). Supports rectangles, ellipses, lines, stars, polygons, vectors, text with style runs, gradients, image fills, effects, blend modes, clip paths, and nested groups (#46) +- Copy/Paste as submenu in context menu — Copy as text, Copy as SVG, Copy as PNG (⇧⌘C), Copy as JSX +- Stroke align (Inside/Center/Outside) with clip-based rendering matching Figma behavior +- Individual stroke weights per side (Top/Right/Bottom/Left) with side selector dropdown +- Google Fonts fallback — automatically loads fonts from Google Fonts API when not available locally +- Auto-save toggle in File menu — disable to prevent automatic writes to the opened .fig file +- Renderer profiler with in-canvas HUD overlay, GPU timing, and phase instrumentation -### Changed +### Improvements -- Replace custom color picker with Reka UI Color components (ColorArea, ColorSlider, ColorField) — adds keyboard navigation and accessibility to the color area, hue, and alpha controls. +- Replace custom color picker with Reka UI Color components (ColorArea, ColorSlider, ColorField) — adds keyboard navigation and accessibility to the color area, hue, and alpha controls -### Fixed +### Fixes -- CJK text rendering — load a system CJK font (PingFang SC, Microsoft YaHei, Noto Sans CJK) as fallback; falls back to Noto Sans SC from Google Fonts when no system font is available (#48). -- Font registration errors no longer cache invalid font data — `loadFont` only caches after successful CanvasKit registration. -- Fix `render` tool failing on Windows + Bun with "Cannot find module" error (#43). -- Fix hover highlighting nodes from internal component pages — scope hit-test to current page. -- Fix hit-testing on transparent frames and groups — empty containers without fills or strokes are now click-through, clipping parents reject hits outside their bounds, matching Figma behavior. +- CJK text rendering — load a system CJK font (PingFang SC, Microsoft YaHei, Noto Sans CJK) as fallback; falls back to Noto Sans SC from Google Fonts when no system font is available (#48) +- Font registration errors no longer cache invalid font data — `loadFont` only caches after successful CanvasKit registration +- Fix `render` tool failing on Windows + Bun with "Cannot find module" error (#43) +- Fix hover highlighting nodes from internal component pages — scope hit-test to current page +- Fix hit-testing on transparent frames and groups — empty containers without fills or strokes are now click-through, clipping parents reject hits outside their bounds, matching Figma behavior - Fix instance overrides on .fig import and clipboard paste — resolve guidPaths by overrideKey, handle component swaps (`overriddenSymbolID`), propagate through nested clone chains. Import and paste now share a single override engine. -- Apply Figma component property assignments on import — boolean visibility toggles and instance swaps via `componentPropRefs`/`componentPropAssignments`. -- Apply `derivedSymbolData` sizes on import — containers now shrink correctly when component properties hide children. -- Fix override resolution for nested instance targets — check the current node before searching descendants. -- Fix component property assignments for nested instances — resolve scoped `componentPropAssignments` inside `symbolOverrides` via guidPath, handle `guidValue` for instance swaps, reorder phases so transitive sync doesn't clobber visibility. -- Pixel-perfect vector rendering using pre-computed `fillGeometry`/`strokeGeometry` blobs from .fig files — eliminates white gaps between adjacent stroked shapes. -- Stroke outlines on clipboard paste — convert vectorNetwork paths to filled outlines via CanvasKit when geometry blobs are unavailable. -- Apply `derivedSymbolData` transforms and geometry during import — instance children render at correct scale and position. -- Fix internal pages becoming visible after .fig round-trip — preserve `internalOnly` flag on export. -- Scope layout recomputation to current page for paste/undo/font-load (major speedup on large multi-page files). -- Show loading overlay until all document fonts are loaded (no more partially rendered text). -- Load fonts when switching pages (previously only loaded for the first page). -- Always show visibility toggle on fill, stroke, and effect rows (matches Figma). -- Fix renderer crash on double destroy when closing files quickly. -- Fix .fig page ordering — use deterministic byte comparison for fractional index positions. -- Fix text truncation using `textTruncation` field instead of `textAutoResize`. -- Fix horizontal scrollbar on design and pages panels. -- Style scrollbars for Tauri (thin dark overlay instead of default OS chrome). -- Enable file watcher in Tauri — `watch` feature was missing from `tauri-plugin-fs`. +- Apply Figma component property assignments on import — boolean visibility toggles and instance swaps via `componentPropRefs`/`componentPropAssignments` +- Apply `derivedSymbolData` sizes on import — containers now shrink correctly when component properties hide children +- Fix override resolution for nested instance targets — check the current node before searching descendants +- Fix component property assignments for nested instances — resolve scoped `componentPropAssignments` inside `symbolOverrides` via guidPath, handle `guidValue` for instance swaps, reorder phases so transitive sync doesn't clobber visibility +- Pixel-perfect vector rendering using pre-computed `fillGeometry`/`strokeGeometry` blobs from .fig files — eliminates white gaps between adjacent stroked shapes +- Stroke outlines on clipboard paste — convert vectorNetwork paths to filled outlines via CanvasKit when geometry blobs are unavailable +- Apply `derivedSymbolData` transforms and geometry during import — instance children render at correct scale and position +- Fix internal pages becoming visible after .fig round-trip — preserve `internalOnly` flag on export +- Scope layout recomputation to current page for paste/undo/font-load (major speedup on large multi-page files) +- Show loading overlay until all document fonts are loaded (no more partially rendered text) +- Load fonts when switching pages (previously only loaded for the first page) +- Always show visibility toggle on fill, stroke, and effect rows (matches Figma) +- Fix renderer crash on double destroy when closing files quickly +- Fix .fig page ordering — use deterministic byte comparison for fractional index positions +- Fix text truncation using `textTruncation` field instead of `textAutoResize` +- Fix horizontal scrollbar on design and pages panels +- Style scrollbars for Tauri (thin dark overlay instead of default OS chrome) +- Enable file watcher in Tauri — `watch` feature was missing from `tauri-plugin-fs` ## 0.6.0 — 2026-03-04 -### Added +### Features -- Multi-selection properties panel — edit position, size, appearance, fill, stroke, and effects across multiple selected nodes. -- Shared values display normally, differing values show "Mixed". -- W/H inputs in multi-selection mode. -- Flip horizontal/vertical using scale transform instead of rotation. -- Single-node alignment aligns to parent frame bounds. -- ACP agent package — Agent Communication Protocol server for AI coding tools, reusing core ToolDefs. +- Multi-selection properties panel — edit position, size, appearance, fill, stroke, and effects across multiple selected nodes +- Shared values display normally, differing values show "Mixed" +- W/H inputs in multi-selection mode +- Flip horizontal/vertical using scale transform instead of rotation +- Single-node alignment aligns to parent frame bounds +- ACP agent package — Agent Communication Protocol server for AI coding tools, reusing core ToolDefs -### Changed +### Build -- Apple code signing and notarization for macOS builds. -- Git LFS storage moved from GitHub to Cloudflare R2. +- Apple code signing and notarization for macOS builds +- Git LFS storage moved from GitHub to Cloudflare R2 -### Fixed +### Fixes -- Fix Figma clipboard paste: extract shared kiwi→SceneNode conversion, fixing broken auto-layout, missing gradient/image fills, effects, style runs, and text properties. -- Fix vector rendering on paste — scale path coordinates from Figma's normalizedSize to actual node bounds. -- Fix pasted instances having no children — populate from component via symbolData when both are in clipboard. -- Detect component sets on import — promote FRAME nodes with VARIANT componentPropDefs to COMPONENT_SET. -- Skip internal canvas on paste — components on Figma's hidden internal page populate instances but are not pasted as visible nodes. -- Apply instance overrides on paste — text content, fills, visibility, layoutGrow, and textAutoResize from symbolOverrides. -- Fix auto-layout child ordering — sort by geometric position instead of z-order position strings. -- Load fonts on paste and .fig import — collect font families from text nodes and load into CanvasKit. -- Text measurement in auto-layout — use CanvasKit paragraph metrics for WIDTH_AND_HEIGHT text nodes. -- Recompute layouts after font loading completes. -- Fix PERCENT line height conversion — was stored as raw value instead of pixels. -- Fix InvalidCharacterError when copying nodes with non-ASCII text. -- Load all font weight/style variants needed by pasted text nodes. -- Fix font loading not registering in core cache. -- Fix halfLeading applied to text measurement — enable only for rendering. -- Clear hover on zoom/pinch to keep scene picture cache valid. -- Fix flip buttons using rotation math instead of actual mirroring. -- Fix flip transform encoding — scale first matrix column only (was incorrectly producing 180° rotation). -- Decode flip state from .fig transform matrix on import. +- Fix Figma clipboard paste: extract shared kiwi→SceneNode conversion, fixing broken auto-layout, missing gradient/image fills, effects, style runs, and text properties +- Fix vector rendering on paste — scale path coordinates from Figma's normalizedSize to actual node bounds +- Fix pasted instances having no children — populate from component via symbolData when both are in clipboard +- Detect component sets on import — promote FRAME nodes with VARIANT componentPropDefs to COMPONENT_SET +- Skip internal canvas on paste — components on Figma's hidden internal page populate instances but are not pasted as visible nodes +- Apply instance overrides on paste — text content, fills, visibility, layoutGrow, and textAutoResize from symbolOverrides +- Fix auto-layout child ordering — sort by geometric position instead of z-order position strings +- Load fonts on paste and .fig import — collect font families from text nodes and load into CanvasKit +- Text measurement in auto-layout — use CanvasKit paragraph metrics for WIDTH_AND_HEIGHT text nodes +- Recompute layouts after font loading completes +- Fix PERCENT line height conversion — was stored as raw value instead of pixels +- Fix InvalidCharacterError when copying nodes with non-ASCII text +- Load all font weight/style variants needed by pasted text nodes +- Fix font loading not registering in core cache +- Fix halfLeading applied to text measurement — enable only for rendering +- Clear hover on zoom/pinch to keep scene picture cache valid +- Fix flip buttons using rotation math instead of actual mirroring +- Fix flip transform encoding — scale first matrix column only (was incorrectly producing 180° rotation) +- Decode flip state from .fig transform matrix on import ## 0.5.1 — 2026-03-03 -### Fixed +### Fixes -- Fix File → Save crash when document has layer blur effects. +- Fix File → Save crash when document has layer blur effects ## 0.5.0 — 2026-03-03 -### Added +### Features -- Effects rendering: drop shadow, inner shadow, shadow spread, layer blur, background blur, foreground blur. -- Text shadows render on glyphs instead of bounding box. -- Multi-file tabs — open multiple documents in tabs within a single window. -- Tab bar with close buttons, middle-click to close, and new tab (+) button. -- Keyboard shortcuts: ⌘N/⌘T new tab, ⌘W close tab, ⌘O opens in new tab. -- Native Tauri menu: File → New and File → Close Tab wired to tab actions. -- Render text from SkPicture cache when fonts are missing — pixel-perfect display without the font installed. -- Missing font indicator (⚠) next to font picker in the sidebar. -- Right-click context menu on layers panel — same actions as the canvas context menu. +- Effects rendering: drop shadow, inner shadow, shadow spread, layer blur, background blur, foreground blur +- Text shadows render on glyphs instead of bounding box +- Multi-file tabs — open multiple documents in tabs within a single window +- Tab bar with close buttons, middle-click to close, and new tab (+) button +- Keyboard shortcuts: ⌘N/⌘T new tab, ⌘W close tab, ⌘O opens in new tab +- Native Tauri menu: File → New and File → Close Tab wired to tab actions +- Render text from SkPicture cache when fonts are missing — pixel-perfect display without the font installed +- Missing font indicator (⚠) next to font picker in the sidebar +- Right-click context menu on layers panel — same actions as the canvas context menu - 40+ new AI/MCP tools ported from figma-use: - Granular set tools: `set_rotation`, `set_opacity`, `set_radius`, `set_minmax`, `set_text`, `set_font`, `set_font_range`, `set_text_resize`, `set_visible`, `set_blend`, `set_locked`, `set_stroke_align` - Node operations: `node_bounds`, `node_move`, `node_resize`, `node_ancestors`, `node_children`, `node_tree`, `node_bindings`, `node_replace_with` @@ -718,259 +718,271 @@ - Create tools: `create_page`, `create_vector`, `create_slice` - Viewport: `viewport_get`, `viewport_set`, `viewport_zoom_to_fit`, `page_bounds` - Misc: `flatten_nodes`, `list_fonts` -- `set_text_properties` tool: alignment, auto-resize, decoration. -- `set_layout_child` tool: sizing, grow, align_self, positioning. -- 13 MCP server integration tests via `InMemoryTransport`. +- `set_text_properties` tool: alignment, auto-resize, decoration +- `set_layout_child` tool: sizing, grow, align_self, positioning +- 13 MCP server integration tests via `InMemoryTransport` -### Changed +### UI -- Resizable pages/layers split in left panel with reka-ui Splitter. -- Layers tree auto-expands and scrolls to reveal selected node. -- Loading overlay on canvas while opening .fig files. -- Hide internal-only pages (e.g. "Internal Only Canvas" in design systems). -- Render page dividers — pages named with only dashes/asterisks/spaces show as horizontal lines. -- Only show component labels for COMPONENT and COMPONENT_SET, not instances. -- Replace all native `` dropdowns with reka-ui `AppSelect` component +- Smoother trackpad pinch-to-zoom with `Math.exp` curve and deltaMode normalization +- Fix font picker dropdown truncating long font names +- Show explanation in font picker when Local Font Access API unavailable (Safari/Firefox) +### Fixes -- Auto-populate GitHub Release notes from CHANGELOG.md via `ffurrer2/extract-release-notes@v2`. -- Skip already-published npm versions on CI re-runs instead of failing. -- Exclude non-app directories from Vite file watcher. - - -- Extract shared color constants (`BLACK`, `TRANSPARENT`, `DEFAULT_SHADOW_COLOR`) — replaces 8 inline literals across core. -- Extract shared `NodeContextMenuContent` component to avoid menu duplication. -- Fix `@open-pencil/core` dep in MCP package: `workspace:*` for local dev (pnpm resolves at publish time). -- Replace store thunks with a late-binding proxy. - - -- Clipboard roundtrip tests: encode to Figma Kiwi binary → decode → verify. -- 9 visual regression snapshot tests for effects rendering. -- Zoom/pan E2E tests and pipeline benchmark. -- MCP server edge-case tests for `find_nodes` and Zod validation. -- 6 unit tests for absolute position cache. - -### Fixed - -- Fix drop shadow rendering on top of fills — shadow now draws behind opaque content. -- Fix effect property changes not recorded in undo/redo history. -- Fix active tab text invisible against same-color background. -- Fix clipboard "Outside int range" error — `pasteID` used unsigned int exceeding Kiwi's signed 32-bit field. -- Error toasts are now sticky (don't auto-dismiss), with selectable text, copy button, and close button. -- Truncate long node names in export button. +- Fix drop shadow rendering on top of fills — shadow now draws behind opaque content +- Fix effect property changes not recorded in undo/redo history +- Fix active tab text invisible against same-color background +- Fix clipboard "Outside int range" error — `pasteID` used unsigned int exceeding Kiwi's signed 32-bit field +- Error toasts are now sticky (don't auto-dismiss), with selectable text, copy button, and close button +- Truncate long node names in export button ### Performance -- Per-node SkPicture cache for effect rendering — unchanged shadow/blur nodes replay from cache on scene redraws. -- Drop shadows use `MaskFilter` direct draw instead of `saveLayer` offscreen buffers. -- Cached `ImageFilter`, `MaskFilter`, reusable effect paint — zero per-frame WASM allocations for effects. -- Reuse GL context on panel resize — swap surface without recreating renderer, preserving all caches. -- Per-frame absolute position cache — avoids repeated parent-chain walks during rendering. -- Optimize zoom/pan smoothness with `shallowReactive`, `useRafFn`, and input coalescing. +- Per-node SkPicture cache for effect rendering — unchanged shadow/blur nodes replay from cache on scene redraws +- Drop shadows use `MaskFilter` direct draw instead of `saveLayer` offscreen buffers +- Cached `ImageFilter`, `MaskFilter`, reusable effect paint — zero per-frame WASM allocations for effects +- Reuse GL context on panel resize — swap surface without recreating renderer, preserving all caches +- Per-frame absolute position cache — avoids repeated parent-chain walks during rendering +- Optimize zoom/pan smoothness with `shallowReactive`, `useRafFn`, and input coalescing -## 0.4.2 — 2026-03-02 +### Build -### Changed +- Auto-populate GitHub Release notes from CHANGELOG.md via `ffurrer2/extract-release-notes@v2` +- Skip already-published npm versions on CI re-runs instead of failing +- Exclude non-app directories from Vite file watcher -- Import additional properties from Figma clipboard: `layoutAlignSelf`, `clipsContent`, `fontWeight`, `italic`, `letterSpacing`, `lineHeight`. -- Convert `letterSpacing` PERCENT units to pixels based on font size. +### Internal +- Extract shared color constants (`BLACK`, `TRANSPARENT`, `DEFAULT_SHADOW_COLOR`) — replaces 8 inline literals across core +- Extract shared `NodeContextMenuContent` component to avoid menu duplication +- Fix `@open-pencil/core` dep in MCP package: `workspace:*` for local dev (pnpm resolves at publish time) +- Replace store thunks with a late-binding proxy -- 7 new clipboard import unit tests (14 total). +### Tests -### Fixed +- Clipboard roundtrip tests: encode to Figma Kiwi binary → decode → verify +- 9 visual regression snapshot tests for effects rendering +- Zoom/pan E2E tests and pipeline benchmark +- MCP server edge-case tests for `find_nodes` and Zod validation +- 6 unit tests for absolute position cache -- Fix Figma clipboard paste: skip non-visual node types (variables, widgets, stickies, connectors). -- Fix text not rendering after paste — `letterSpacing` from Figma is a `{value, units}` object, was passed as-is → `NaN` broke CanvasKit paragraph layout. -- Fix undo/redo for Figma paste — no undo entry was recorded; redo duplicated `childIds`. -- Center pasted Figma content in viewport instead of using original coordinates. -- Compute auto-layouts after clipboard paste (same as .fig import and demo creation). +## [0.4.2] (2026-03-02) -## 0.4.1 — 2026-03-02 +### Fixes -### Changed +- Fix Figma clipboard paste: skip non-visual node types (variables, widgets, stickies, connectors) +- Fix text not rendering after paste — `letterSpacing` from Figma is a `{value, units}` object, was passed as-is → `NaN` broke CanvasKit paragraph layout +- Fix undo/redo for Figma paste — no undo entry was recorded; redo duplicated `childIds` +- Center pasted Figma content in viewport instead of using original coordinates +- Compute auto-layouts after clipboard paste (same as .fig import and demo creation) -- Highlight copy & paste with Figma in README and feature docs. -- Replace "fig-kiwi" format name with "Kiwi binary" — the format is shared between .fig files and clipboard. +### Improvements -### Fixed +- Import additional properties from Figma clipboard: `layoutAlignSelf`, `clipsContent`, `fontWeight`, `italic`, `letterSpacing`, `lineHeight` +- Convert `letterSpacing` PERCENT units to pixels based on font size -- Fix text disappearing after hover when SkPicture cache was recorded before fonts loaded. -- Invalidate scene picture cache on font load to prevent stale fallback text. +### Tests -## 0.4.0 — 2026-03-02 +- 7 new clipboard import unit tests (14 total) -### Added +## [0.4.1] (2026-03-02) -- MCP server (`@open-pencil/mcp`) — 29 tools for headless .fig editing via stdio (Claude Code, Cursor, Windsurf) or HTTP (Hono + Streamable HTTP with sessions). -- `openpencil-mcp` and `openpencil-mcp-http` binaries — install globally via `bun add -g @open-pencil/mcp`. +### Fixes -### Changed +- Fix text disappearing after hover when SkPicture cache was recorded before fonts loaded +- Invalidate scene picture cache on font load to prevent stale fallback text -- All packages emit JS via tsgo + fix-esm-import-path — `@open-pencil/core` and `@open-pencil/mcp` work on Node.js without Bun. -- Core package exports: `bun` condition → src (dev), `import` condition → dist (npm consumers). -- `@open-pencil/mcp` added to CI publish workflow. +### Docs -## 0.3.2 — 2026-03-02 +- Highlight copy & paste with Figma in README and feature docs +- Replace "fig-kiwi" format name with "Kiwi binary" — the format is shared between .fig files and clipboard -### Changed +## [0.4.0] (2026-03-02) -- Visual regression tests for SkPicture cache: hover on/off cycle, multiple cycles, mouse hover, scene change + hover. -- Type `window.__OPEN_PENCIL_STORE__` globally, remove ad-hoc casts from tests. +### Features + +- MCP server (`@open-pencil/mcp`) — 29 tools for headless .fig editing via stdio (Claude Code, Cursor, Windsurf) or HTTP (Hono + Streamable HTTP with sessions) +- `openpencil-mcp` and `openpencil-mcp-http` binaries — install globally via `bun add -g @open-pencil/mcp` + +### Build + +- All packages emit JS via tsgo + fix-esm-import-path — `@open-pencil/core` and `@open-pencil/mcp` work on Node.js without Bun +- Core package exports: `bun` condition → src (dev), `import` condition → dist (npm consumers) +- `@open-pencil/mcp` added to CI publish workflow + +## [0.3.2] (2026-03-02) ### Performance -- Re-apply SkPicture scene caching for ~7x faster pan/zoom (0.98ms vs 6.8ms per frame at 500 nodes). +- Re-apply SkPicture scene caching for ~7x faster pan/zoom (0.98ms vs 6.8ms per frame at 500 nodes) -## 0.3.1 — 2026-03-02 +### Tests -### Fixed +- Visual regression tests for SkPicture cache: hover on/off cycle, multiple cycles, mouse hover, scene change + hover +- Type `window.__OPEN_PENCIL_STORE__` globally, remove ad-hoc casts from tests -- Fix text disappearing after hovering a frame (revert SkPicture scene caching). -- Fix macOS startup hang: async font loading, show window on reopen. +## [0.3.1] (2026-03-02) -## 0.3.0 — 2026-03-01 +### Fixes -### Fixed +- Fix text disappearing after hovering a frame (revert SkPicture scene caching) +- Fix macOS startup hang: async font loading, show window on reopen -- Fix npm publish: use pnpm for workspace dependency resolution with provenance. -- CLI version now reads from package.json instead of hardcoded value. -- Update README: accurate app size (~7 MB), streamlined feature list, current project structure. +## [0.3.0] (2026-03-01) ### Performance -- SkPicture scene caching — pan/zoom replays cached display list instead of re-rendering all nodes. -- Cache vector network paths — avoid rebuilding WASM paths every frame. -- Cache ruler and pen overlay paints — eliminate 10 WASM Paint allocations per frame. -- Only enable `preserveDrawingBuffer` in test mode. -- Hoist URL param parsing out of render loop. +- SkPicture scene caching — pan/zoom replays cached display list instead of re-rendering all nodes +- Cache vector network paths — avoid rebuilding WASM paths every frame +- Cache ruler and pen overlay paints — eliminate 10 WASM Paint allocations per frame +- Only enable `preserveDrawingBuffer` in test mode +- Hoist URL param parsing out of render loop -## 0.2.1 — 2026-03-01 +### Fixes -### Changed +- Fix npm publish: use pnpm for workspace dependency resolution with provenance +- CLI version now reads from package.json instead of hardcoded value +- Update README: accurate app size (~7 MB), streamlined feature list, current project structure -- Panel header with app logo, editable document name, and sidebar toggle. -- ⌘\\ to toggle side panels for distraction-free canvas. -- Panels hidden by default on mobile (< 768px). -- Floating bar with logo, filename, and restore button when panels hidden. -- Always show local user avatar in collab header. -- Touch support for pan and pinch-zoom on iOS. +## [0.2.1] (2026-03-01) + +### UI + +- Panel header with app logo, editable document name, and sidebar toggle +- ⌘\\ to toggle side panels for distraction-free canvas +- Panels hidden by default on mobile (< 768px) +- Floating bar with logo, filename, and restore button when panels hidden +- Always show local user avatar in collab header +- Touch support for pan and pinch-zoom on iOS ### Performance -- Stubbed shiki to remove 9MB of unused language grammars (20MB → 11MB bundle). +- Stubbed shiki to remove 9MB of unused language grammars (20MB → 11MB bundle) -## 0.2.0 — 2026-03-01 +## [0.2.0] (2026-03-01) -### Added +### Collaboration -- Real-time P2P collaboration via Trystero (WebRTC) + Yjs CRDT. -- Peer-to-peer sync — no server relay, zero hosting cost. -- WebRTC signaling via MQTT public brokers. -- STUN (Google, Cloudflare) + TURN (Open Relay) for NAT traversal. -- Awareness protocol: live cursors, selections, presence. -- Figma-style colored cursor arrows with name pills. -- Click peer avatar to follow their viewport, click again to stop. -- Stale cursor cleanup on peer disconnect. -- Local persistence via y-indexeddb — room survives page refresh. -- Share link at `/share/` with vue-router. -- Secure room IDs via `crypto.getRandomValues()`. -- Removed Cloudflare Durable Object relay server (`packages/collab/`). +- Real-time P2P collaboration via Trystero (WebRTC) + Yjs CRDT +- Peer-to-peer sync — no server relay, zero hosting cost +- WebRTC signaling via MQTT public brokers +- STUN (Google, Cloudflare) + TURN (Open Relay) for NAT traversal +- Awareness protocol: live cursors, selections, presence +- Figma-style colored cursor arrows with name pills +- Click peer avatar to follow their viewport, click again to stop +- Stale cursor cleanup on peer disconnect +- Local persistence via y-indexeddb — room survives page refresh +- Share link at `/share/` with vue-router +- Secure room IDs via `crypto.getRandomValues()` +- Removed Cloudflare Durable Object relay server (`packages/collab/`) -### Changed +### UI -- Toast notifications via Reka UI Toast — top-center blue pill for info, red for errors. -- Global error handler (window.error + unhandledrejection) shows errors as toasts. -- Link copied toast on share and copy link actions. -- HsvColorArea extracted as shared component (ColorPicker + FillPicker). -- Scrollable app menu without visible scrollbar. -- Selection broadcasting to remote peers. +- Toast notifications via Reka UI Toast — top-center blue pill for info, red for errors +- Global error handler (window.error + unhandledrejection) shows errors as toasts +- Link copied toast on share and copy link actions +- HsvColorArea extracted as shared component (ColorPicker + FillPicker) +- Scrollable app menu without visible scrollbar +- Selection broadcasting to remote peers -## 0.1.0-alpha — 2026-03-01 +## [0.1.0-alpha] (2026-03-01) First public alpha. The editor is functional but not production-ready. -### Added +### Editor -- Canvas rendering via CanvasKit (Skia WASM) on WebGL surface. -- Rectangle, Ellipse, Line, Polygon, Star drawing tools. -- Pen tool with vector network model (bezier curves, open/closed paths). -- Inline text editing on canvas with phantom textarea for input/IME. -- Rich text formatting: bold, italic, underline per-character via style runs. -- Font picker with system font enumeration (font-kit on desktop, Local Font Access API in browser). -- Auto-layout via Yoga WASM (direction, gap, padding, justify, align, child sizing). -- Components, instances, component sets with live sync and override preservation. -- Variables with collections, modes, color bindings, alias chains. -- Undo/redo for all operations (inverse-command pattern). -- Snap guides with rotation-aware edge/center snapping. -- Canvas rulers with selection range badges. -- Marquee selection, multi-select, resize handles, rotation. -- Group/ungroup, z-order, visibility, lock. -- Sections with title pills and auto-adoption of overlapping nodes. -- Multi-page documents with independent viewport state. -- Hover highlight following node geometry (ellipses, rounded rects, vectors). -- Context menu with clipboard, z-order, grouping, component, and visibility actions. -- Color picker with HSV, gradients (linear, radial, angular, diamond), image fills. -- Properties panel: position, appearance, fill, stroke, effects, typography, layout, export. -- ScrubInput drag-to-change number controls. -- Resizable side panels via reka-ui Splitter. +- Canvas rendering via CanvasKit (Skia WASM) on WebGL surface +- Rectangle, Ellipse, Line, Polygon, Star drawing tools +- Pen tool with vector network model (bezier curves, open/closed paths) +- Inline text editing on canvas with phantom textarea for input/IME +- Rich text formatting: bold, italic, underline per-character via style runs +- Font picker with system font enumeration (font-kit on desktop, Local Font Access API in browser) +- Auto-layout via Yoga WASM (direction, gap, padding, justify, align, child sizing) +- Components, instances, component sets with live sync and override preservation +- Variables with collections, modes, color bindings, alias chains +- Undo/redo for all operations (inverse-command pattern) +- Snap guides with rotation-aware edge/center snapping +- Canvas rulers with selection range badges +- Marquee selection, multi-select, resize handles, rotation +- Group/ungroup, z-order, visibility, lock +- Sections with title pills and auto-adoption of overlapping nodes +- Multi-page documents with independent viewport state +- Hover highlight following node geometry (ellipses, rounded rects, vectors) +- Context menu with clipboard, z-order, grouping, component, and visibility actions +- Color picker with HSV, gradients (linear, radial, angular, diamond), image fills +- Properties panel: position, appearance, fill, stroke, effects, typography, layout, export +- ScrubInput drag-to-change number controls +- Resizable side panels via reka-ui Splitter +### File Format -- .fig file import via Kiwi binary codec (194 definitions, ~390 fields). -- .fig file export with Kiwi encoding, Zstd compression, thumbnail generation. -- Figma clipboard: copy/paste between OpenPencil and Figma. -- Round-trip fidelity for supported node types. +- .fig file import via Kiwi binary codec (194 definitions, ~390 fields) +- .fig file export with Kiwi encoding, Zstd compression, thumbnail generation +- Figma clipboard: copy/paste between OpenPencil and Figma +- Round-trip fidelity for supported node types +### AI Integration -- Built-in AI chat in properties panel (⌘J). -- Direct browser → OpenRouter communication, no backend. -- Model selector: Claude, Gemini, GPT, DeepSeek, Qwen, Kimi, Llama. -- 10 AI tools: create_shape, set_fill, set_stroke, update_node, set_layout, delete_node, select_nodes, get_page_tree, get_selection, rename_node. -- Streaming markdown responses (vue-stream-markdown). -- Tool call timeline with collapsible details. +- Built-in AI chat in properties panel (⌘J) +- Direct browser → OpenRouter communication, no backend +- Model selector: Claude, Gemini, GPT, DeepSeek, Qwen, Kimi, Llama +- 10 AI tools: create_shape, set_fill, set_stroke, update_node, set_layout, delete_node, select_nodes, get_page_tree, get_selection, rename_node +- Streaming markdown responses (vue-stream-markdown) +- Tool call timeline with collapsible details +### Code Panel -- JSX export of selected nodes with Tailwind-like shorthand props. -- Syntax highlighting via Prism.js. -- Copy to clipboard. +- JSX export of selected nodes with Tailwind-like shorthand props +- Syntax highlighting via Prism.js +- Copy to clipboard +### CLI (`@open-pencil/cli`) -- `info` — document stats, node types, fonts. -- `tree` — visual node tree. -- `find` — search by name/type. -- `export` — render to PNG/JPG/WEBP at any scale. -- `node` — detailed properties by ID. -- `pages` — list pages with node counts. -- `variables` — list design variables and collections. -- `eval` — run scripts with Figma-compatible plugin API. -- `analyze colors` — color palette usage. -- `analyze typography` — font/size/weight distribution. -- `analyze spacing` — gap/padding values. -- `analyze clusters` — repeated patterns. -- All commands support `--json`. +- `info` — document stats, node types, fonts +- `tree` — visual node tree +- `find` — search by name/type +- `export` — render to PNG/JPG/WEBP at any scale +- `node` — detailed properties by ID +- `pages` — list pages with node counts +- `variables` — list design variables and collections +- `eval` — run scripts with Figma-compatible plugin API +- `analyze colors` — color palette usage +- `analyze typography` — font/size/weight distribution +- `analyze spacing` — gap/padding values +- `analyze clusters` — repeated patterns +- All commands support `--json` +### Core (`@open-pencil/core`) -- Scene graph with flat Map storage and parentIndex tree. -- FigmaAPI with ~65% Figma plugin API compatibility. -- JSX renderer (TreeNode builder functions with shorthand props). -- Kiwi binary codec (encode/decode). -- Vector network blob encoder/decoder. +- Scene graph with flat Map storage and parentIndex tree +- FigmaAPI with ~65% Figma plugin API compatibility +- JSX renderer (TreeNode builder functions with shorthand props) +- Kiwi binary codec (encode/decode) +- Vector network blob encoder/decoder +### Desktop App -- Tauri v2 (~5 MB). -- Native menu bar, save/open dialogs. -- System font enumeration via font-kit. -- Zstd compression in Rust. -- macOS and Windows builds via GitHub Actions. +- Tauri v2 (~5 MB) +- Native menu bar, save/open dialogs +- System font enumeration via font-kit +- Zstd compression in Rust +- macOS and Windows builds via GitHub Actions +### Web App -- Runs at [app.openpencil.dev](https://app.openpencil.dev). -- No installation required. -- File System Access API for save/open (Chrome/Edge), download fallback elsewhere. +- Runs at [app.openpencil.dev](https://app.openpencil.dev) +- No installation required +- File System Access API for save/open (Chrome/Edge), download fallback elsewhere +### Documentation -- [openpencil.dev](https://openpencil.dev) — VitePress site with user guide, reference, and development docs. -- Deployed via Cloudflare Pages. +- [openpencil.dev](https://openpencil.dev) — VitePress site with user guide, reference, and development docs +- Deployed via Cloudflare Pages diff --git a/packages/vue/src/i18n/locales/de/dialogs.json b/packages/vue/src/i18n/locales/de/dialogs.json index d6500f954..58107c21d 100644 --- a/packages/vue/src/i18n/locales/de/dialogs.json +++ b/packages/vue/src/i18n/locales/de/dialogs.json @@ -2,6 +2,11 @@ "cancel": "Abbrechen", "apply": "Anwenden", "close": "Schließen", + "recoverUnsavedWork": "Nicht gespeicherte Arbeit wiederherstellen", + "recoverUnsavedWorkDescription": "OpenPencil hat Dokumente aus einer vorherigen Sitzung gefunden.", + "restore": "Wiederherstellen", + "discard": "Verwerfen", + "recoveryFailed": "Dieses Dokument konnte nicht wiederhergestellt werden.", "rename": "Umbenennen", "renameLayers": "{count} Ebenen umbenennen", "renamePreview": "Vorschau", diff --git a/packages/vue/src/i18n/locales/es/dialogs.json b/packages/vue/src/i18n/locales/es/dialogs.json index 00eb152a8..13fb159df 100644 --- a/packages/vue/src/i18n/locales/es/dialogs.json +++ b/packages/vue/src/i18n/locales/es/dialogs.json @@ -2,6 +2,11 @@ "cancel": "Cancelar", "apply": "Aplicar", "close": "Cerrar", + "recoverUnsavedWork": "Recuperar trabajo no guardado", + "recoverUnsavedWorkDescription": "OpenPencil encontró documentos de una sesión anterior.", + "restore": "Restaurar", + "discard": "Descartar", + "recoveryFailed": "No se pudo restaurar este documento.", "rename": "Renombrar", "renameLayers": "Renombrar {count} capas", "renamePreview": "Vista previa", diff --git a/packages/vue/src/i18n/locales/fr/dialogs.json b/packages/vue/src/i18n/locales/fr/dialogs.json index 7845e4c34..4e64f91c9 100644 --- a/packages/vue/src/i18n/locales/fr/dialogs.json +++ b/packages/vue/src/i18n/locales/fr/dialogs.json @@ -2,6 +2,11 @@ "cancel": "Annuler", "apply": "Appliquer", "close": "Fermer", + "recoverUnsavedWork": "Récupérer le travail non enregistré", + "recoverUnsavedWorkDescription": "OpenPencil a trouvé des documents d’une session précédente.", + "restore": "Restaurer", + "discard": "Ignorer", + "recoveryFailed": "Impossible de restaurer ce document.", "rename": "Renommer", "renameLayers": "Renommer {count} calques", "renamePreview": "Aperçu", diff --git a/packages/vue/src/i18n/locales/it/dialogs.json b/packages/vue/src/i18n/locales/it/dialogs.json index 40a50d295..0cc253c0c 100644 --- a/packages/vue/src/i18n/locales/it/dialogs.json +++ b/packages/vue/src/i18n/locales/it/dialogs.json @@ -2,6 +2,11 @@ "cancel": "Annulla", "apply": "Applica", "close": "Chiudi", + "recoverUnsavedWork": "Recupera il lavoro non salvato", + "recoverUnsavedWorkDescription": "OpenPencil ha trovato documenti di una sessione precedente.", + "restore": "Ripristina", + "discard": "Scarta", + "recoveryFailed": "Impossibile ripristinare questo documento.", "rename": "Rinomina", "renameLayers": "Rinomina {count} livelli", "renamePreview": "Anteprima", diff --git a/packages/vue/src/i18n/locales/ja/dialogs.json b/packages/vue/src/i18n/locales/ja/dialogs.json index a975ef8a0..9af537aed 100644 --- a/packages/vue/src/i18n/locales/ja/dialogs.json +++ b/packages/vue/src/i18n/locales/ja/dialogs.json @@ -2,6 +2,11 @@ "cancel": "キャンセル", "apply": "適用", "close": "閉じる", + "recoverUnsavedWork": "未保存の作業を復元", + "recoverUnsavedWorkDescription": "OpenPencil が前回のセッションのドキュメントを見つけました。", + "restore": "復元", + "discard": "破棄", + "recoveryFailed": "このドキュメントを復元できませんでした。", "rename": "名前を変更", "renameLayers": "{count} 個のレイヤー名を変更", "renamePreview": "プレビュー", diff --git a/packages/vue/src/i18n/locales/pl/dialogs.json b/packages/vue/src/i18n/locales/pl/dialogs.json index 491f68d01..6ba633410 100644 --- a/packages/vue/src/i18n/locales/pl/dialogs.json +++ b/packages/vue/src/i18n/locales/pl/dialogs.json @@ -2,6 +2,11 @@ "cancel": "Anuluj", "apply": "Zastosuj", "close": "Zamknij", + "recoverUnsavedWork": "Odzyskaj niezapisaną pracę", + "recoverUnsavedWorkDescription": "OpenPencil znalazł dokumenty z poprzedniej sesji.", + "restore": "Przywróć", + "discard": "Odrzuć", + "recoveryFailed": "Nie udało się przywrócić tego dokumentu.", "rename": "Zmień nazwę", "renameLayers": "Zmień nazwy {count} warstw", "renamePreview": "Podgląd", diff --git a/packages/vue/src/i18n/locales/ru/dialogs.json b/packages/vue/src/i18n/locales/ru/dialogs.json index 643737db8..838345e48 100644 --- a/packages/vue/src/i18n/locales/ru/dialogs.json +++ b/packages/vue/src/i18n/locales/ru/dialogs.json @@ -2,6 +2,11 @@ "cancel": "Отмена", "apply": "Применить", "close": "Закрыть", + "recoverUnsavedWork": "Восстановить несохранённую работу", + "recoverUnsavedWorkDescription": "OpenPencil обнаружил документы из предыдущего сеанса.", + "restore": "Восстановить", + "discard": "Удалить", + "recoveryFailed": "Не удалось восстановить этот документ.", "rename": "Переименовать", "renameLayers": "Переименовать слои: {count}", "renamePreview": "Предпросмотр", diff --git a/packages/vue/src/i18n/locales/zh-cn/dialogs.json b/packages/vue/src/i18n/locales/zh-cn/dialogs.json index cd34cb94c..ec39ad3d1 100644 --- a/packages/vue/src/i18n/locales/zh-cn/dialogs.json +++ b/packages/vue/src/i18n/locales/zh-cn/dialogs.json @@ -2,6 +2,11 @@ "cancel": "取消", "apply": "应用", "close": "关闭", + "recoverUnsavedWork": "恢复未保存的工作", + "recoverUnsavedWorkDescription": "OpenPencil 找到了上次会话中的文档。", + "restore": "恢复", + "discard": "丢弃", + "recoveryFailed": "无法恢复此文档。", "rename": "重命名", "renameLayers": "重命名 {count} 个图层", "renamePreview": "预览", diff --git a/packages/vue/src/i18n/messages/dialogs.ts b/packages/vue/src/i18n/messages/dialogs.ts index da99ac45b..8e51f8a74 100644 --- a/packages/vue/src/i18n/messages/dialogs.ts +++ b/packages/vue/src/i18n/messages/dialogs.ts @@ -45,6 +45,11 @@ export const dialogMessageDefaults = { importToCanvas: 'Import to canvas', newTab: 'New tab', closeTab: params('Close {name}'), + recoverUnsavedWork: 'Recover unsaved work', + recoverUnsavedWorkDescription: 'OpenPencil found documents from a previous session.', + restore: 'Restore', + discard: 'Discard', + recoveryFailed: 'Could not restore this document.', showUI: params('Show UI ({shortcut})'), fontSettings: 'Font settings', fontSettingsDesktopDescription: diff --git a/src/App.vue b/src/App.vue index a8c0b20d1..8c95a60bf 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,17 +1,20 @@ + + diff --git a/tests/engine/app/document/recovery/controller.test.ts b/tests/engine/app/document/recovery/controller.test.ts new file mode 100644 index 000000000..0e61814ac --- /dev/null +++ b/tests/engine/app/document/recovery/controller.test.ts @@ -0,0 +1,83 @@ +import { describe, expect, test } from 'bun:test' + +import { reactive } from 'vue' + +import { createDefaultEditorState } from '@open-pencil/core/editor' + +import { createDocumentRecovery } from '@/app/document/recovery/controller' +import { createMemoryRecoveryStore } from '@/app/document/recovery/memory' + +function setup(buildFigFile = async () => new Uint8Array([1, 2, 3])) { + const state = reactive({ ...createDefaultEditorState('page-1'), documentName: 'Agent draft' }) + const store = createMemoryRecoveryStore() + let writable = false + const recovery = createDocumentRecovery({ + state, + store, + recoveryId: 'recovery-1', + hasWritableSource: () => writable, + buildFigFile + }) + return { state, store, recovery, setWritable: (value: boolean) => (writable = value) } +} + +describe('document recovery controller', () => { + test('persists source-less changes and skips untouched documents', async () => { + const { state, store, recovery } = setup() + await recovery.persistNow() + expect(await store.list()).toEqual([]) + + state.sceneVersion = 1 + await recovery.persistNow() + expect((await store.read('recovery-1'))?.sceneVersion).toBe(1) + recovery.disposeRecovery() + }) + + test('does not persist documents with writable sources', async () => { + const { state, store, recovery, setWritable } = setup() + setWritable(true) + state.sceneVersion = 1 + await recovery.persistNow() + expect(await store.list()).toEqual([]) + recovery.disposeRecovery() + }) + + test('coalesces concurrent changes to the latest scene version', async () => { + let release: (() => void) | null = null + let calls = 0 + const { state, store, recovery } = setup(async () => { + calls++ + if (calls === 1) { + await new Promise((resolve) => { + release = resolve + }) + } + return new Uint8Array([calls]) + }) + state.sceneVersion = 1 + const pending = recovery.persistNow() + await Promise.resolve() + state.sceneVersion = 2 + void recovery.persistNow() + const releaseFirst = () => { + if (release) release() + } + releaseFirst() + await pending + + expect(calls).toBe(2) + expect((await store.read('recovery-1'))?.sceneVersion).toBe(2) + recovery.disposeRecovery() + }) + + test('successful save removes recovery data', async () => { + const { state, store, recovery } = setup() + state.sceneVersion = 1 + await recovery.persistNow() + expect(await store.list()).toHaveLength(1) + + await recovery.markProtectedVersion(1) + expect(await store.list()).toEqual([]) + recovery.disposeRecovery() + }) +}) diff --git a/tests/engine/app/document/recovery/store.test.ts b/tests/engine/app/document/recovery/store.test.ts new file mode 100644 index 000000000..00d336cb0 --- /dev/null +++ b/tests/engine/app/document/recovery/store.test.ts @@ -0,0 +1,54 @@ +import 'fake-indexeddb/auto' +import { beforeEach, describe, expect, test } from 'bun:test' + +import { createIdbRecoveryStore } from '@/app/document/recovery/idb' +import { createMemoryRecoveryStore } from '@/app/document/recovery/memory' + +const bytes = new Uint8Array([1, 2, 3, 4]) + +describe('document recovery store', () => { + beforeEach(async () => { + await new Promise((resolve) => { + const request = indexedDB.deleteDatabase('open-pencil-recovery') + request.onsuccess = () => resolve() + request.onerror = () => resolve() + request.onblocked = () => resolve() + }) + }) + + test('stores metadata and FIG bytes atomically in IndexedDB', async () => { + const store = createIdbRecoveryStore() + const metadata = await store.write({ + id: 'recovery-1', + documentName: 'Agent draft', + sceneVersion: 12, + figBytes: bytes + }) + + expect(metadata).toMatchObject({ + id: 'recovery-1', + documentName: 'Agent draft', + sceneVersion: 12, + byteLength: 4, + formatVersion: 1 + }) + expect(await store.list()).toEqual([metadata]) + expect(await store.read('recovery-1')).toEqual({ ...metadata, figBytes: bytes }) + + await store.remove('recovery-1') + expect(await store.list()).toEqual([]) + expect(await store.read('recovery-1')).toBeNull() + }) + + test('memory store owns input and output bytes', async () => { + const store = createMemoryRecoveryStore() + const input = new Uint8Array(bytes) + await store.write({ id: 'one', documentName: 'Draft', sceneVersion: 1, figBytes: input }) + input[0] = 99 + + const first = await store.read('one') + expect(first?.figBytes[0]).toBe(1) + if (first) first.figBytes[0] = 88 + expect((await store.read('one'))?.figBytes[0]).toBe(1) + }) +})