Commit graph

402 commits

Author SHA1 Message Date
Danila Poyarkov 69afd3311f Update changelog with AppSelect and font picker fixes 2026-03-02 21:33:37 +03:00
Danila Poyarkov 25233294a1 Replace native <select> with reka-ui AppSelect component
- New AppSelect.vue: generic wrapper around reka-ui Select primitives
- Replace all 4 native <select> elements (font weight, effect type,
  export scale, export format)
- Fix font picker dropdown truncating names (min-w-56)
- Show explanation when local fonts unavailable (Safari/Firefox)
2026-03-02 21:33:04 +03:00
Danila Poyarkov 412e614d07 Fix font picker dropdown truncating font names
Set min-w-56 on popover so it doesn't shrink below 224px
when the trigger button is narrow.
2026-03-02 21:18:57 +03:00
Danila Poyarkov 4f492d1f8a Update changelog with new tools and MCP server tests 2026-03-02 21:16:46 +03:00
Danila Poyarkov 4ee3a2dcc3 Add set_text_properties and set_layout_child tools (from #11)
Cherry-picked the 2 unique tools from PR #11:
- set_text_properties: alignment, auto-resize, decoration
- set_layout_child: sizing, grow, align_self, positioning

The other 10 tools in the PR were already covered by the
port-tools merge (73 → 75 tools).
2026-03-02 21:12:44 +03:00
Danila Poyarkov 7a5f6b3707 Add MCP server integration tests (closes #19)
13 tests using InMemoryTransport from @modelcontextprotocol/sdk:
- Tool registration (all 76 tools listed with descriptions)
- new_document, open_file, save_file lifecycle
- Tool execution through MCP protocol (create, fill, delete, query)
- Error paths: no document loaded, nonexistent node, invalid file path
- Full workflow: new → create → nest → query → delete

Fix @open-pencil/core dep in MCP package: workspace:* for local dev
(pnpm publish resolves this to the actual version at publish time).
2026-03-02 21:07:25 +03:00
Danila Poyarkov da28a0ed93 Merge branch 'multi-file-tabs' 2026-03-02 19:52:03 +03:00
Danila Poyarkov 6f88a2e47e Merge branch 'port-tools' 2026-03-02 19:51:11 +03:00
Danila Poyarkov afb480d05d Update changelog with layers context menu and CI improvements 2026-03-02 19:46:04 +03:00
Danila Poyarkov 90e29f13a2 Add context menu to layers panel
Extract menu items into shared NodeContextMenuContent component,
used by both the canvas and layers panel context menus.
Right-clicking a layer selects it and shows the same menu.
2026-03-02 19:45:09 +03:00
Danila Poyarkov c3869908ee Format core package 2026-03-02 19:43:44 +03:00
Danila Poyarkov 7534c46583 Truncate long node names in export button 2026-03-02 19:43:42 +03:00
Danila Poyarkov 5147bc1fec Update changelog with new tools and color constants 2026-03-02 19:35:18 +03:00
Danila Poyarkov ef78ffd2e4 Render text from SkPicture cache when fonts are missing
On copy: serialize each text node's paragraph into an SkPicture and
embed the bytes (base64) in the OpenPencil clipboard payload.

On paste: if the font isn't available, render from the cached SkPicture
instead of the broken fallback. Text looks pixel-perfect without the
font installed — same behavior as Figma.

Missing font indicator:
- Orange ⚠ badge on canvas over text nodes with unavailable fonts
- Amber warning banner in the Typography panel listing missing families
- isFontLoaded() check in @open-pencil/core for querying font status
2026-03-02 19:35:04 +03:00
Danila Poyarkov 4e1c15c4ff Extract color constants: BLACK, TRANSPARENT, DEFAULT_SHADOW_COLOR
Replace 8 inline { r: 0, g: 0, b: 0, a: 1 } literals across core
with shared constants from constants.ts. Also reuse CANVAS_BG_COLOR
in fig-export.ts instead of duplicating the value.
2026-03-02 19:34:35 +03:00
Danila Poyarkov 537663aa3c Port figma-use tools: variables, set_*, node ops, boolean, paths, viewport
Add 40+ new tool definitions 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

Variable CRUD: get_variable, find_variables, create_variable,
set_variable, delete_variable, bind_variable

Collection CRUD: get_collection, create_collection, delete_collection

Boolean operations: boolean_union, boolean_subtract, boolean_intersect,
boolean_exclude

Vector path tools: path_get, path_set, path_scale, path_flip, path_move

Create tools: create_page, create_vector, create_slice

Misc: flatten_nodes, viewport_get, viewport_set, viewport_zoom_to_fit,
page_bounds, list_fonts

Also adds createVariable/createCollection to SceneGraph, and viewport,
boolean operation, and flatten methods to FigmaAPI.
2026-03-02 19:27:42 +03:00
Danila Poyarkov a3236a08a0 Update changelog with multi-file tabs and clipboard fix 2026-03-02 18:56:59 +03:00
Danila Poyarkov ce55af6171 Fix pasteID int overflow and make error toasts copyable
- Use Int32Array instead of Uint32Array for Kiwi pasteID (signed int field)
- Error toasts: don't auto-dismiss, show copy button, text is selectable
- Add clipboard roundtrip tests (encode → decode → verify)
2026-03-02 18:55:49 +03:00
Danila Poyarkov b7a634f1ae Skip already-published versions in CI npm publish
Prevents re-run failures when a package was already published.
Real errors (auth, build) still fail the job.
2026-03-02 18:37:00 +03:00
Danila Poyarkov af9b9fd0fa Replace store thunks with a late-binding proxy
useEditorStore() now returns a Proxy that delegates to the current
active store at access time. No more store() wrapper functions,
try/catch guards, or passing stores through function parameters.
2026-03-02 18:36:27 +03:00
Danila Poyarkov a6634b9543 Wire native Tauri menu to tab actions
Map File → New to createTab() and File → Close Tab to closeTab().
Rename menu labels from 'New File'/'Close Window' to 'New'/'Close Tab'.
2026-03-02 18:36:27 +03:00
Danila Poyarkov 1f652b5e90 Use reka-ui Tabs for tab bar accessibility
Arrow key navigation, role=tablist/tab, aria-selected,
focus management, and screen reader support.
2026-03-02 18:36:27 +03:00
Danila Poyarkov b3438cd272 Fix active tab text invisible against same-color background 2026-03-02 18:36:27 +03:00
Danila Poyarkov 1b4dc08c54 Add multi-file tabs
Open multiple documents in tabs within a single window, like Figma.

- Tab bar appears when 2+ documents are open, with close (×) and new (+) buttons
- ⌘N / ⌘T create a new empty tab
- ⌘W closes the active tab (last tab closes and reopens as Untitled)
- ⌘O opens .fig files in a new tab (reuses current tab if Untitled with no changes)
- Middle-click closes a tab
- Each tab has its own SceneGraph, UndoManager, viewport, and selection state
- Switching tabs remounts the canvas to rebind the Skia renderer to the active store
- Keyboard shortcuts, menu actions, and AI tools all operate on the active tab
2026-03-02 18:36:27 +03:00
Danila Poyarkov 7d98201548 Release v0.4.2 2026-03-02 18:14:35 +03:00
Danila Poyarkov 877350a3af Auto-populate GitHub Releases from CHANGELOG.md
Use ffurrer2/extract-release-notes@v2 to extract the version section
and pass it as releaseBody to the Tauri action.

Switch changelog headings to Keep a Changelog format (## [X.Y.Z])
to match the action's expected pattern.
2026-03-02 18:12:36 +03:00
Danila Poyarkov 8bb62d908f Update changelog with clipboard import fixes 2026-03-02 18:07:59 +03:00
Danila Poyarkov db7a019385 Fix Figma paste redo + add clipboard import tests
Redo was creating duplicate childIds because snapshots captured after
tree construction had populated childIds, and createNode appends to
parent.childIds again. Fix: clear childIds in redo snapshots.

New tests (7):
- layoutAlignSelf from stackChildAlignSelf
- clipsContent from frameMaskDisabled
- fontWeight from fontName.style via styleToWeight
- letterSpacing object → pixels conversion
- undo removes full subtree
- redo recreates correct parent-child tree
- redo without childIds:[] demonstrates the duplicate bug
2026-03-02 18:05:22 +03:00
Danila Poyarkov 8850625a6f Fix text not rendering + undo for Figma clipboard paste
- letterSpacing is an object {value, units} not a number — was NaN,
  which silently breaks CanvasKit paragraph layout
- Add mapLetterSpacing() to handle PIXELS and PERCENT units
- Force textAutoResize to NONE (Yoga has no text measurement callback)
- Record undo entry for Figma paste with full subtree snapshots
- Add stackChildAlignSelf, fontWeight to NodeChange interface
2026-03-02 17:59:18 +03:00
Danila Poyarkov e1b5f1901e Import missing layout/text properties from Figma clipboard
- layoutAlignSelf (stackChildAlignSelf → STRETCH/AUTO)
- clipsContent (from frameMaskDisabled, inverted)
- textAutoResize (NONE/HEIGHT/WIDTH_AND_HEIGHT/TRUNCATE)
- fontWeight (from fontName.style via styleToWeight when not explicit)
- italic (from fontName.style)
- lineHeight (PIXELS only, PERCENT deferred)
- letterSpacing
2026-03-02 17:41:42 +03:00
Danila Poyarkov f54871fae2 Compute layouts after clipboard paste 2026-03-02 17:34:53 +03:00
Danila Poyarkov 8b1547ece7 Center pasted Figma nodes in viewport instead of using original coordinates 2026-03-02 17:32:06 +03:00
Danila Poyarkov d7ba0bfef9 Skip non-visual node types in clipboard import (variables, widgets, etc.)
Figma clipboard data includes VARIABLE_SET, VARIABLE, and other non-visual
types that were falling through to the default RECTANGLE case in mapNodeType.
These now join DOCUMENT and CANVAS in the skipTypes set.
2026-03-02 17:22:09 +03:00
Danila Poyarkov e0c5820183 CI: publish releases as non-draft 2026-03-02 15:54:43 +03:00
Danila Poyarkov 7eb74c3969 Release v0.4.1 2026-03-02 15:51:34 +03:00
Danila Poyarkov ebb85e8f20 Improve scene cache regression test for font load race 2026-03-02 15:51:02 +03:00
Danila Poyarkov af8b90a939 Fix text disappearing after hover: invalidate SkPicture on font load
The first render records an SkPicture before fonts are loaded (fallback
drawText path). When fonts finish loading asynchronously, the cached
picture was never invalidated — subsequent renders replayed stale picture
without paragraph text. Hovering a node forced a full re-render (volatile
overlay path), making text reappear. Un-hovering replayed the stale cache.

Fix: call invalidateScenePicture() at the end of loadFonts() so the next
render records a fresh picture with proper paragraph text.
2026-03-02 15:45:58 +03:00
Danila Poyarkov f4b45d4f13 Replace "fig-kiwi" format name with "Kiwi binary" in docs
fig-kiwi is the magic header string in .fig files, not a format name.
The format is Kiwi binary — used for both .fig files and clipboard.
2026-03-02 15:31:25 +03:00
Danila Poyarkov 75cc653efc Fix Kiwi format description — same binary format as .fig files, not a clipboard format 2026-03-02 15:28:24 +03:00
Danila Poyarkov 9103d1b554 Highlight copy & paste with Figma in README and docs 2026-03-02 15:26:06 +03:00
Danila Poyarkov cc77c68143 Fix core exports: node → dist, default → src 2026-03-02 15:03:40 +03:00
Danila Poyarkov 5856233832 Fix core exports: types → src for workspace typecheck 2026-03-02 15:02:43 +03:00
Danila Poyarkov eecc58e63e Regenerate lockfile 2026-03-02 15:01:44 +03:00
Danila Poyarkov 8fea6c086d Bump all packages to 0.4.0, fix Node.js ESM compatibility
- tsgo + fix-esm-import-path for .js extensions in dist/
- Core exports: bun condition → src, import → dist
- MCP depends on core ^0.4.0
2026-03-02 14:59:59 +03:00
Danila Poyarkov 1f27add8c7 Fix MCP build script, bump to 0.3.3 2026-03-02 14:45:48 +03:00
Danila Poyarkov e7209171fa Build MCP package to JS for Node.js bin compatibility
tsgo emits dist/*.js with shebangs. Bins point at dist/ so
openpencil-mcp and openpencil-mcp-http work via npm/npx.
2026-03-02 14:42:15 +03:00
Danila Poyarkov d93bcab0b6 Add install instructions for @open-pencil/mcp 2026-03-02 14:28:56 +03:00
Danila Poyarkov 10b4fc6c13 Add @open-pencil/mcp to npm publish workflow 2026-03-02 14:27:07 +03:00
Danila Poyarkov 4ad90d4819 Add MCP server package with stdio and HTTP transports
29 tools: open_file, save_file, new_document + all 26 from @open-pencil/core.
Stdio for MCP clients (Claude Code, Cursor), HTTP (Hono + Streamable HTTP
with sessions) for scripts, browser extensions, CI.
Runs on both Bun and Node.js (via tsx).
2026-03-02 14:20:49 +03:00
Danila Poyarkov eeaef12c27 Update Penpot comparison to reflect WASM renderer (render-wasm/v1)
Penpot 2.x ships with Rust/Skia WASM rendering enabled by default.
Update architecture diagram, rendering pipeline, and file format sections
to reflect the current state instead of the old SVG-based renderer.
2026-03-02 13:35:09 +03:00