Commit graph

1063 commits

Author SHA1 Message Date
Danila Poyarkov cd4e1a2271 feat(mcp): add stdio transport for Claude Code / Cursor
- Add packages/mcp/src/stdio.ts — proper stdio MCP server that
  connects to the running app via WebSocket
- openpencil-mcp bin now points to stdio entry (was HTTP)
- openpencil-mcp-http bin added for the HTTP server
- Extract registerTools() from server.ts to share between transports
- Move index.ts banner output to stderr (prevents stdout corruption)
- Update Tauri shell spawn to use openpencil-mcp-http
- Update all docs (EN + 6 translations): correct binary names, source
  paths, port number

Fixes #194
2026-04-13 11:51:01 +03:00
Danila Poyarkov 082fc2c88e fix(kiwi): guard alias resolution against missing GUID
Fixes #192 — val.alias can exist as a stub without a guid in real
.fig files, causing guidToString(undefined) to crash on import.
2026-04-13 09:58:06 +03:00
Danila Poyarkov a2a5376b74 refactor(vue): extract useUndoBatch composable and add batch tests
- Move idle-timer batch logic from PropertyListRoot into reusable useUndoBatch composable
- Add unit tests for batch undo behavior (collapse, flush, redo, no-op)
2026-04-13 09:46:09 +03:00
tae.virus c829f69e1b
fix(vue): batch color picker drag updates into one undo entry (#187)
PropertyListRoot's update() and patch() pushed a new undo entry on
every call, so dragging a color slider or color area in the fill,
stroke, or effect pickers filled the undo stack with dozens of
intermediate entries per interaction. Cmd+Z had to be pressed many
times to revert a single conceptual color change.

Wrap update() and patch() in a debounced begin/commit batch keyed by
(op, propKey, index, nodeIds). Rapid events collapse into one undo
entry, and the batch commits after 300ms of idle. Changing prop key,
index, or selection flushes the previous batch immediately, and
add/remove/toggleVisibility flush any pending batch before running so
button actions never mix with drag history. The existing explicit
batch in toggleVisibility for multi-node is preserved.
2026-04-13 09:45:50 +03:00
Danila Poyarkov a4f30325eb refactor(app): move tool switch and space-hold to useMagicKeys
Only raw handler left is nudge (needs keydown repeat events).
Tool shortcuts now use whenever(plain(code)) loop over TOOL_SHORTCUTS.
Space hold uses watch(spaceHeld) on a computed reactive boolean.
2026-04-10 00:51:15 +03:00
Danila Poyarkov 6d1eec8ad0 refactor(app): extract named actions from keyboard shortcuts
Extract inline callbacks into named functions (smartDelete,
confirmOrEnterText, escapeOrDeselect, toggleAutoLayout, toggleUI,
toggleAI, exportSelectionPng) so the shortcut mapping section is
a clean key→action table with no branching logic.
2026-04-10 00:45:17 +03:00
Danila Poyarkov b3053601f7 Add arrow key nudge and fix undo/redo bugs
Nudge: Arrow keys move selection by 1px, Shift+Arrow by 10px.
Consecutive nudges within 300ms are batched into a single undo
entry so Cmd+Z undoes the entire sequence at once.

Fix duplicate redo creating nodes with new IDs, breaking
subsequent undo entries that reference the original IDs. Now
snapshotSubtree/restoreSubtree preserve node IDs across redo.

Fix delete undo not restoring children — deleteSelected only
snapshotted top-level nodes, so undoing a frame delete lost all
its children. Now snapshots the full subtree.

Fix draw tool not committing resize to undo — shapes created via
draw had their final dimensions lost on redo because handleDrawUp
never recorded the resize. Now uses beginBatch/commitBatch to
combine create+resize into a single undo entry.

Clean up use-keyboard.ts — remove shouldPreventDefault and opaque
PREVENT_* sets, move tool switch and nudge to dedicated keydown
listener, add shift() helper.

Closes #182
2026-04-10 00:26:13 +03:00
Danila Poyarkov a130d9ce1d fix(core): correct version to 0.11.6 in package.json 2026-04-08 22:28:00 +03:00
Danila Poyarkov f8f4af5937 Release v0.11.6 2026-04-08 22:04:22 +03:00
Danila Poyarkov 2c3191cf96 Release v0.11.5 2026-04-08 21:38:44 +03:00
Danila Poyarkov f2136c6be6 fix(lint): normalize file paths in custom rules for Windows CI
- Replace backslashes with forward slashes in noHandRolledColor and
  noTypeofWindowCheck rules so file-path exclusions work on Windows
- Fixes Windows CI build failures where color.ts was incorrectly
  flagged by no-hand-rolled-color
2026-04-08 20:58:47 +03:00
Danila Poyarkov 26a7d2d454 Release v0.11.4 2026-04-08 20:52:09 +03:00
Danila Poyarkov 7e7036b422 fix(mcp): add save_file tool and fix stale dist imports
- Add save_file MCP tool that proxies to the browser app via RPC
- Add save_file RPC handler in the automation server
- Rebuild dist/ to fix stale @open-pencil/core/* self-referencing imports
  from before the domain module restructuring

Fixes #184
Closes #185 (save_file added; open_file requires File System Access API
which is browser-interactive; new_document needs a store reset method)
2026-04-08 20:49:29 +03:00
Danila Poyarkov 92efd70c62 refactor(core): move clipboard text helpers into text/ domain
- Move clipboard-text-outlines.ts → text/opentype.ts
- Move kiwi/serialize-clipboard-v4.ts → text/clipboard-derived-text.ts
- Delete types-opentype.d.ts in favor of @types/opentype.js
- Add opentype.js to core package dependencies
- Add Vite alias for opentype.js ESM resolution
- Update all imports across core, kiwi, clipboard, and tests
2026-04-08 20:45:43 +03:00
Danila Poyarkov a20d170956 Release v0.11.3 2026-04-08 16:06:37 +03:00
Danila Poyarkov 28272ebda0
Add clipboard text v4 export (#164)
* chore: remove unused pi context file

- Delete .pi/context.md
- Remove an unused local context artifact from the repository

* Add clipboard text v4 export

* fix(clipboard): rebase v4 export branch onto master

- Resolve conflicts after the core text module reorganization
- Fix clipboard text export imports and bundled font asset loading
- Update raw binary expectations for textUserLayoutVersion 4
- Re-run check and unit tests after the rebase
2026-04-08 15:35:00 +03:00
Danila Poyarkov 825d3bbe49 docs: add conventional commit guidance and update changelog
- Document semantic/conventional commit format in AGENTS.md with short subjects and detailed bodies
- Keep commit types lowercase, but start each commit body line with an uppercase word
- Add missing unreleased changelog entries from recent editor and UI fixes
- Tighten unreleased changelog wording to stay concise and user-facing
2026-04-08 13:18:02 +03:00
Danila Poyarkov 7426e5d80b Fix no-hand-rolled-color lint rule to match color/index.ts 2026-04-06 23:30:38 +03:00
Danila Poyarkov 862c0f28dc Unify UI styling to slot-based useXxxUI() pattern
- Convert button, input, icon-button, toast, surface from flat-string
  functions to slot-based { base: string } return pattern
- Convert section from bare TV exports to useSectionUI() with
  { wrapper, label } slots
- Remove standalone select helpers (selectTrigger, selectContent,
  selectItem) in favor of useSelectUI()
- Delete use-component-ui.ts — no longer needed
- Update all 20+ call sites across property panels and chat components
2026-04-06 22:58:34 +03:00
Danila Poyarkov e9f8fd352d Use short universal labels for inline sizing suffix
Long localized labels like 'По содержимому' overflow the input.
Add sizingHugShort/sizingFillShort i18n keys with abbreviated
translations for all locales. Dropdown items keep full labels.
2026-04-06 21:25:03 +03:00
Danila Poyarkov 467a2e1dc1 Unify size input with inline sizing dropdown
Replace the separate ScrubInput + AppSelect pair with a single
combined control: the sizing mode (Hug/Fill) shows as an inline
label inside the scrub input, swapping to a chevron on hover.

- ScrubInput: add group class and #suffix slot (stays generic)
- LayoutSection: embed reka-ui Select in the suffix slot with
  group-hover toggle between label and chevron
2026-04-06 19:52:27 +03:00
Danila Poyarkov 2c5c612e0f Show auto-layout panel for components and instances
The layout section was gated on node.type === 'FRAME', hiding it for
COMPONENT, COMPONENT_SET, and INSTANCE nodes that also support
auto-layout. Also use copyStyleRuns instead of structuredClone per
project lint rules.
2026-04-06 16:05:18 +03:00
Danila Poyarkov 3be01dfdeb Include styleRuns in text edit undo
styleRuns were updated on the graph during editing (via syncText) but
commitTextEdit only captured text changes. Now both text and styleRuns
are snapshotted at startTextEditing and restored on undo.
2026-04-06 15:59:57 +03:00
Danila Poyarkov f77c42d798 Fix text edit not pushing to undo history
commitTextEdit compared prevText from the scene graph node, but
syncText already updates the node on every keystroke during editing.
This made prevText === newText, so the undo entry was never pushed.

Fix: capture the original text when startTextEditing is called and
use that snapshot for the undo comparison.
2026-04-06 15:57:11 +03:00
Danila Poyarkov 0287808b87 Use static icon components in layout direction buttons
Dynamic component :is with template literals aren't resolved by
unplugin-icons, so arrow-right/arrow-down/layout-grid were missing.
2026-04-06 15:50:57 +03:00
Danila Poyarkov fcee3117e1 Use FRAME instead of RECTANGLE for gradient cards with children
RECTANGLE is not a container type, so hit-testing and double-click
never recurse into its children. This prevented selecting the text
labels inside gradient cards by double-clicking on the canvas.
2026-04-06 15:42:28 +03:00
Danila Poyarkov b818ddeff0 Enter key opens text editing with select-all on TEXT nodes
Matches Figma behavior: pressing Enter when a single TEXT node is
selected starts text editing mode and selects all text. Uses rAF
to defer text editing start so the Enter keydown event completes
before the textarea is created and focused, preventing the newline
from being inserted into the selected text.

Closes #181
2026-04-06 15:40:55 +03:00
Danila Poyarkov e949118063 Fix ScrubInput Enter key not committing value
Guard commitEdit against double invocation: Enter triggers commitEdit
which sets editing=false, removing the input via v-if, which fires
blur → commitEdit again. The second call read from a detached input
(empty value → 0), overwriting the correct value.

Fixes #181
2026-04-06 15:25:25 +03:00
Danila Poyarkov ba5e8ce420 fix: check resize handles before rotation zone on mousedown (fixes #170) 2026-04-06 15:04:08 +03:00
Danila Poyarkov cc7f055dfc Format 2026-04-06 14:40:19 +03:00
Danila Poyarkov 07674d1919 Restructure @open-pencil/core into domain modules
Move 30+ loose files at src/ root into domain directories:
- scene-graph/ — SceneGraph class, instances, hit-test, copy, snap, undo
- color/ — parse/format, color management, OkHCL
- text/ — text editor, style runs, direction, fonts
- vector/ — vector network encode/decode, bezier math
- figma-api/ — FigmaAPI class, FigmaNodeProxy
- icons/ — Iconify API client, icon rendering
- canvas/ — SkiaRenderer (was renderer/)
- design-jsx/ — JSX-to-design renderer (was render/)

Also:
- Move fig-compress.ts into io/formats/fig/compress.ts
- Delete re-export shims (headless-render.ts, svg-export/)
- Convert all self-referencing @open-pencil/core/* imports to relative
- Clean up package.json exports (26 subpaths, no internal leaks)
- Update AGENTS.md subpath table

Fixes #179
2026-04-06 14:39:53 +03:00
Danila Poyarkov d73caafc8a Add 14 missing subpath exports to @open-pencil/core
Fixes #179
2026-04-06 14:24:35 +03:00
Danila Poyarkov 1c99e6a9c2
fix(acp): show install errors for missing agent CLIs (#176)
* fix(acp): show install errors for missing agent CLIs (#172)

* Use npm for install commands, toasts for errors, tighten error matching

- Replace bun add -g with npm i -g (universal baseline)
- Replace initError inline banner with toast.show() (consistent with rest of app)
- Remove overly broad 'not found' / 'no such file' from isMissingCommandError

* Refactor toast API to toast.info/warning/error
2026-04-06 14:19:38 +03:00
Danila Poyarkov 5f37515bb6 fix(i18n): sync all locales with English source of truth
- Rename panels.sizingFill → panels.fill for paint fill label (was
  colliding with the sizing fill key) in all 6 locales
- Add 9 missing keys to de, es, fr, it, pl: clipContent, colorFormat*,
  colorHint*, colorPreviewClipped
- Remove duplicate alignLeft/alignRight/alignTop/alignBottom keys from
  ru.json (already covered by the canonical alignment keys)
2026-04-01 21:27:49 +03:00
Danila Poyarkov 943995fb70 Fix MCP auth, collab state, and export bounds 2026-04-01 21:27:04 +03:00
jongwong fd15ab6636
feat(i18n): Add Simplified Chinese (zh-CN) localization support (#167)
* feat(i18n): Add Simplified Chinese (zh-CN) localization support

* feat(i18n): Update Simplified Chinese localization with additional alignment and color formatting terms
2026-04-01 21:26:35 +03:00
Danila Poyarkov dd1b3b7b1a Update README roadmap 2026-03-31 18:34:01 +03:00
Danila Poyarkov 2704391700 Update changelog 2026-03-31 16:49:07 +03:00
Danila Poyarkov d263d63da9 Fix rotated frame overlays and add snapshots 2026-03-31 16:44:35 +03:00
Danila Poyarkov b826202b09 Fix inline rename and rotated hit testing 2026-03-31 16:44:35 +03:00
tae.virus 69784953fb
fix: add missing StackWrap enum and fields to kiwi schema (#166)
The kiwi binary encoder silently drops layoutWrap (flex-wrap) and
counterAxisSpacing (row-gap) because they were missing from the
schema definition. The serialize/deserialize code already handles
these values correctly — only the schema was incomplete.

Adds:
- StackWrap enum (NO_WRAP, WRAP)
- stackWrap field (476) to NodeChange
- stackCounterSpacing field (477) to NodeChange
- STRETCH value (4) to StackAlign enum

Fixes open-pencil/open-pencil#165
2026-03-31 15:47:08 +03:00
Danila Poyarkov f90a376bf2 Fix core release build config 2026-03-30 18:54:18 +03:00
Danila Poyarkov 33d293b221 Release v0.11.2 2026-03-30 18:38:36 +03:00
Danila Poyarkov e18c8660e3 Stabilize npm publishing workflow 2026-03-30 18:36:46 +03:00
Danila Poyarkov 9be3514f2b Release v0.11.1 2026-03-30 17:24:00 +03:00
Danila Poyarkov 36bc879421 Fix package publishing pipeline 2026-03-30 17:21:20 +03:00
Danila Poyarkov 911bed3ede Release v0.11.0 2026-03-30 16:48:27 +03:00
Danila Poyarkov 79357f3afe Add Vue package publishing in CI 2026-03-30 16:21:57 +03:00
Danila Poyarkov 93dbbd2f24 Clean up JSX renderer lint config 2026-03-30 15:17:30 +03:00
Danila Poyarkov f1b264fe90 Tighten SDK release docs 2026-03-30 15:17:30 +03:00