Commit graph

660 commits

Author SHA1 Message Date
Danila Poyarkov 5a3e68eade Extract named types, deduplicate field maps, fix internal canvas GUID
- Define VariableAnyValue, VariableDataEntry, VariableConsumptionEntry,
  VariableDataValuesEntry in codec.ts — remove inline type monsters
- Extract VARIABLE_BINDING_FIELDS / VARIABLE_BINDING_FIELDS_INVERSE to
  kiwi-convert.ts — single source of truth for export and import
- Track internal canvas GUID during page loop instead of recalculating
  with incorrect idx+2 formula (broke when scene nodes existed)
- Remove unused modeGuidToId map, unnecessary as-casts
2026-03-08 22:22:26 +03:00
Danila Poyarkov d9fbc6fb92 Serialize variables, collections, and bindings to .fig files
Add VARIABLE_SET node type, variable-related messages (VariableSetMode,
VariableSetID, VariableDataValues, VariableScope, VariableDataMap, etc.)
to the Kiwi schema.

Export: emit VARIABLE_SET and VARIABLE nodeChanges on an internal-only
canvas page, include variableConsumptionMap on nodes with boundVariables.

Import: rewrite variable import to use variableSetModes, variableSetID,
variableResolvedType, and variableDataValues (multi-mode COLOR/FLOAT/
BOOLEAN/STRING/ALIAS). Import variableConsumptionMap bindings.

Closes #65
2026-03-08 21:44:01 +03:00
Danila Poyarkov 9752f33486 Merge branch 'master' of github.com:open-pencil/open-pencil 2026-03-08 19:59:27 +03:00
Danila Poyarkov 845e3aa8b9 Merge branch 'docs-ai-automation' 2026-03-08 19:59:06 +03:00
Danila Poyarkov c714feb44a
Add "AI & Automation" docs section, CLI reference, formatting fixes (#75)
* Add AI & Automation docs section, CLI reference, formatting fixes

New 'AI & Automation' top-level nav section with 9 pages:
- AI Chat: setup, 87 tools, example prompts
- Collaboration: room sharing, cursors, follow mode
- JSX Renderer: elements, style props, visual diffing
- CLI (4 pages): inspecting, exporting, analyzing, scripting
- MCP Server: moved from Reference, setup + 90 tools

New CLI reference page in Reference with all 12 commands,
every option, alias, and default value.

Formatting fixes across all 7 locales:
- Wrap enum values in backticks (FRAME, SOLID, ROUND, etc.)
- Fix single-backtick code blocks → triple backticks
- Use <kbd> for all keyboard shortcuts
- Remove implementation details from user guide
- Delete stale eval-command.md and mcp-tools.md (14 files)
- Update dead links to new locations

* Translate AI & Automation + CLI reference to all 6 locales

48 translated pages (de, es, fr, it, pl, ru) for the Programmable
section: overview, AI Chat, Collaboration, JSX Renderer, CLI
(inspecting, exporting, analyzing, scripting).

CLI reference and MCP server pages copied as-is (mostly code/tables).

* Update README and docs for CSS Grid support

- Add 'Auto layout & CSS Grid' to README features
- Update architecture, tech-stack, features, figma-comparison, comparison
- Mark grid as  in all 7 locales
- Replace 'blocked on upstream' with Yoga fork links
2026-03-08 18:30:40 +03:00
Danila Poyarkov c98ac0f230 Update README and docs for CSS Grid support
- Add 'Auto layout & CSS Grid' to README features
- Update architecture, tech-stack, features, figma-comparison, comparison
- Mark grid as  in all 7 locales
- Replace 'blocked on upstream' with Yoga fork links
2026-03-08 18:29:44 +03:00
Danila Poyarkov bfa4b7de8b Translate AI & Automation + CLI reference to all 6 locales
48 translated pages (de, es, fr, it, pl, ru) for the Programmable
section: overview, AI Chat, Collaboration, JSX Renderer, CLI
(inspecting, exporting, analyzing, scripting).

CLI reference and MCP server pages copied as-is (mostly code/tables).
2026-03-08 18:25:35 +03:00
Danila Poyarkov e5b147148e Add AI & Automation docs section, CLI reference, formatting fixes
New 'AI & Automation' top-level nav section with 9 pages:
- AI Chat: setup, 87 tools, example prompts
- Collaboration: room sharing, cursors, follow mode
- JSX Renderer: elements, style props, visual diffing
- CLI (4 pages): inspecting, exporting, analyzing, scripting
- MCP Server: moved from Reference, setup + 90 tools

New CLI reference page in Reference with all 12 commands,
every option, alias, and default value.

Formatting fixes across all 7 locales:
- Wrap enum values in backticks (FRAME, SOLID, ROUND, etc.)
- Fix single-backtick code blocks → triple backticks
- Use <kbd> for all keyboard shortcuts
- Remove implementation details from user guide
- Delete stale eval-command.md and mcp-tools.md (14 files)
- Update dead links to new locations
2026-03-08 18:25:35 +03:00
Danila Poyarkov 45df90c5c7
CSS Grid layout mode (#73)
* Switch to @open-pencil/yoga-layout with CSS Grid support

Use our fork (open-pencil/yoga, grid branch) which cherry-picks the
upstream CSS Grid PRs (#1893–#1898) onto current main. The JS bindings
are ported from the old embind approach to the new wasm_bridge.c API.

npm:@open-pencil/yoga-layout alias keeps all imports as 'yoga-layout'.

Also handle FinalizationRegistry change (upstream #1908) — node.free()
no longer exists, nodes are garbage collected automatically.

* Add CSS Grid layout mode

Scene graph:
- LayoutMode gains 'GRID' option alongside HORIZONTAL/VERTICAL
- GridTrack type (sizing: FIXED/FR/AUTO, value) for track definitions
- GridPosition type (column, row, columnSpan, rowSpan) for children
- New node props: gridTemplateColumns/Rows, gridColumnGap, gridRowGap,
  gridPosition

Layout engine:
- buildGridTree() sets Display.Grid and maps GridTrack[] to Yoga's
  setGridTemplateColumns/Rows API with FR/Points/Auto track types
- Grid children use gridPosition for column/row placement with span
- Flex layout path unchanged

Store:
- setLayoutMode('GRID') auto-creates NxM track grid based on child
  count (sqrt heuristic), defaults to 1fr tracks

UI (LayoutSection.vue):
- Grid button (grid-2x2 icon) added to flow direction row
- Columns/Rows track editors: ScrubInput for value + AppSelect for
  sizing mode (Fill fr / Fixed px / Auto), add/remove buttons
- Separate column gap and row gap ScrubInputs
- Wrap button hidden when grid is active
- Flex alignment grid hidden when grid is active

Kiwi serialization skips GRID mode for now (no .fig codec support).

* Add grid layout integration tests

12 new test scenarios covering:
- Basic 2x2 grid, fixed columns, mixed fr/fixed, unequal fr weights
- Column gap, row gap, both gaps combined
- Padding offsets
- Explicit gridPosition placement, column span, row span
- Absolute children skipped
- Hidden children collapsed
- Nested grid inside flex parent (computeAllLayouts)

Also fix: grid frames as children of flex parents now correctly use
Display.Grid via configureChildAsGrid() instead of falling through
to configureChildAsAutoLayout() which set FlexDirection.

* Deduplicate grid yoga configuration

Extract configureAsGrid() and createGridChildNode() shared by
buildGridTree (root-level grid) and configureChildAsGrid (grid
nested inside flex parent).

* Add grid layout to changelog

* Add grid support to JSX and Tailwind CSS export

OpenPencil format: grid → columns/rows/columnGap/rowGap props,
child colStart/rowStart/colSpan/rowSpan.

Tailwind format: grid grid-cols-N grid-rows-N gap-x-* gap-y-*,
mixed tracks use arbitrary values (grid-cols-[200px_1fr_auto]),
child col-start-*/row-start-*/col-span-*/row-span-*.

Both formats: padding emitted for grid frames (shared with flex),
flex-only props (justify/items/wrap/gap) scoped to isFlex.

* Remove duplicate gridTrackToTw, use shared formatTrack

Also drop unused GridTrackSizing import from LayoutSection.vue.

* Fix grid icon: use layout-grid instead of grid-2x2

unplugin-icons can't resolve icon names with digits after hyphens
(grid-2x2 → grid2x2 which doesn't exist).

* Polish layout UI and fix auto-layout behavior

- Replace text labels with compact icons: ↔/↕ for gap, ☐ for uniform padding, T/R/B/L for per-side padding
- Direction-aware gap icon: ↕ for vertical, ↔ for horizontal
- Pin +/− padding toggle button right of gap input
- Fix alignment grid axes for vertical layout (transpose primary/counter)
- Fix grid switch: set FIXED sizing, compute frame size from children
- Remove hardcoded white fill from Shift+A wrap
- Auto-detect horizontal vs vertical from selection bounds

* Add flex-to-grid switch integration test

Verify HUG frame expands and children are placed in 2x2 grid
when switching from vertical flex to grid layout.

* Update changelog for grid layout
2026-03-08 18:23:53 +03:00
Danila Poyarkov 16033c4c56 Revert mermaid plugin (crashes VitePress dev), use tables instead
vitepress-plugin-mermaid patches vitepress's client app entry,
which breaks ESM module resolution and renders all pages blank.
Replace mermaid diagrams with offset/content tables and pipeline
code blocks that render correctly.
2026-03-08 14:33:56 +03:00
Danila Poyarkov 8d140eef7c Pin mermaid to 11.4.1 to fix ESM default export resolution 2026-03-08 14:25:05 +03:00
Danila Poyarkov a0a2c527a3 Enable mermaid diagrams in VitePress docs
Install vitepress-plugin-mermaid + mermaid, wrap config with withMermaid().
File format page now renders flowcharts and block diagrams.
2026-03-08 14:14:16 +03:00
Danila Poyarkov d91e6a36d9 Fix code formatting across all docs
- Wrap all enum values in backticks (FRAME, SOLID, ROUND, etc.)
- Fix single-backtick code blocks → triple backticks in node-types, scene-graph
- Replace ASCII diagrams with mermaid in file-format
- Delete stale mcp-tools.md and eval-command.md from all locales
- Update dead links: /reference/mcp-tools → /programmable/mcp-server,
  /eval-command → /programmable/cli/scripting
2026-03-08 13:53:33 +03:00
Danila Poyarkov 96b9b7733b Add CLI reference page with all commands and parameters 2026-03-08 13:42:10 +03:00
Danila Poyarkov 25d9039b20 Fix docs review issues: remove nonexistent figma.render(), clean up install 2026-03-08 13:37:37 +03:00
Danila Poyarkov c781a990a2 Fix overview page: match sidebar order, rename Why section 2026-03-08 13:30:49 +03:00
Danila Poyarkov eca7d8bc09 Rename Programmable → AI & Automation, reorder sidebar
Sidebar now starts with the most accessible features:
AI Chat → Collaboration → JSX → CLI → MCP Server

Nav labels translated for all 7 locales.
2026-03-08 13:29:34 +03:00
Danila Poyarkov a4b810620f Add Programmable docs section with CLI, JSX, MCP, AI, Collab
New top-level nav section documenting OpenPencil's programmability:
- CLI: inspecting, exporting, analyzing, scripting (eval)
- JSX Renderer: elements, style props, visual diffing
- MCP Server: moved from Reference (setup + tool list)
- AI Chat: setup, 87 tools, example prompts
- Collaboration: room sharing, cursors, follow mode

Restructured sidebar:
- Programmable added to nav bar (7 locales)
- Context Menu moved from User Guide to Reference
- MCP and eval-command removed from Reference
2026-03-08 13:22:36 +03:00
Danila Poyarkov 11f0fa73df Wrap key names in legend with <kbd> 2026-03-08 13:08:30 +03:00
Danila Poyarkov 81bf188f5f Wrap remaining single-key shortcuts and key names in <kbd>
Single-letter tool keys (R, O, L, F, S, P, H), Escape, Enter,
Space (and locale equivalents), arrow key names in shortcut tables
and prose. Remove <kbd> from non-key words like 'drag'.
2026-03-08 13:07:08 +03:00
Danila Poyarkov 36a3257d29 Remove implementation details from user guide
Replace internal references (Yoga, CanvasKit, Paragraph API, style runs,
characterStyleIDs, vectorNetworkBlob, Kiwi binary, scene graph, font-kit,
Local Font Access API, COMPONENT type, override key format, hex codes, px
specs) with user-facing language across all 7 locales.
2026-03-08 12:55:25 +03:00
Danila Poyarkov 1ecc20e1ec Use <kbd> for keyboard shortcuts across all docs
Wrap all keyboard shortcut references in <kbd> tags in user guide,
reference, and development docs across all 7 locales (en, de, es,
fr, it, pl, ru). Tables, inline prose, and parenthetical hints.
2026-03-08 12:48:02 +03:00
Danila Poyarkov 52b9ebc5c2 Add Russian locale (ru) to docs 2026-03-08 11:40:19 +03:00
Danila Poyarkov e67dd3fbd9 Rewrite docs: landing page, features, architecture — all 6 locales
- Landing page: reorder features (Figma-compatible first), add collaboration card, fix app size
- Features: cut implementation details, group into clear sections, add MCP/CLI/Homebrew
- Architecture: replace ASCII diagram with mermaid, add RPC bridge, update tool counts
- Remove ~500 lines of internal implementation prose from user-facing docs
2026-03-08 11:04:26 +03:00
Danila Poyarkov b485778dfa Move Installation above features 2026-03-08 10:47:42 +03:00
Danila Poyarkov c6c681c25a Restructure README: lead with screenshot and features, show CLI/AI output, move contributor docs down 2026-03-08 10:46:38 +03:00
Danila Poyarkov af2f65b390 Update CLI section: separate file operations from app control 2026-03-08 10:43:14 +03:00
Danila Poyarkov e2e4a2543f Fix release notes: extract from CHANGELOG.md directly (drop ffurrer2 action) 2026-03-08 02:06:52 +03:00
Danila Poyarkov f2b70579e7 Fix npm publish: use OIDC trusted publisher, remove empty NPM_TOKEN override 2026-03-08 01:41:11 +03:00
Danila Poyarkov 0109d33846 Add AI agent skill to README and docs
- README: new 'AI Agent Skill' section with install command
- MCP tools reference: skill section, fix tool count 78→90,
  add 10 missing tools (export_image, export_svg, flatten_nodes,
  list_fonts, page_bounds, set_layout_child, set_text_properties,
  viewport_get, viewport_set, viewport_zoom_to_fit)
- Features page: mention skill with install command
- All 6 locales updated
2026-03-08 01:08:28 +03:00
Danila Poyarkov e6984629fd Fix MCP publish: pre-build then publish with --ignore-scripts 2026-03-08 01:07:32 +03:00
Danila Poyarkov be7150b616 Move open-pencil skill to dedicated repo
Install via: npx skills add open-pencil/skills@open-pencil
Repo: https://github.com/open-pencil/skills
2026-03-08 01:03:25 +03:00
Danila Poyarkov 97a3af26a7 Add open-pencil skill for CLI and MCP usage
Installable via: npx skills add open-pencil/open-pencil --skill open-pencil

Covers both app mode (running editor) and headless mode (.fig files):
CLI commands, MCP server setup, JSX rendering, eval, analyze tools.
2026-03-08 00:56:01 +03:00
Danila Poyarkov a6ea74014a Fix publish: resolve workspace deps then npm publish with provenance 2026-03-08 00:54:22 +03:00
Danila Poyarkov 65e40a2570 Fix pnpm publish auth: write .npmrc in project root 2026-03-08 00:37:24 +03:00
Danila Poyarkov 5c68ab0dee Fix npm publish auth: write .npmrc for pnpm 2026-03-08 00:34:19 +03:00
Danila Poyarkov 5ac70a5976 Update docs: tool counts 75/78 → 87/90, schema.ts → tools/ directory, add RPC bridge 2026-03-08 00:28:11 +03:00
Danila Poyarkov 9882375b4f Release v0.8.0 2026-03-08 00:20:47 +03:00
Danila Poyarkov c2710d11fb Fix roadmap: individual strokes already shipped, restore skewing/OkHCL 2026-03-08 00:07:39 +03:00
Danila Poyarkov d84f165a27 Update README roadmap, features, tool counts, and project structure 2026-03-08 00:04:22 +03:00
Danila Poyarkov 01c8753f6e Merge PR #70: E2E test coverage + mutation unit tests
48 new E2E tests across 9 spec files, 26 mutation unit tests,
store/canvas test helpers, data-test-id attributes.

Fixes: explicit error in canvasBounds(), remove any casts,
trim trailing blank line, condense changelog entries.
2026-03-07 23:47:00 +03:00
Danila Poyarkov 6eb206a451 Merge docs PR, fix all lint/typecheck errors, update changelog
- Merge add-vitepress-docs: docs site with 6 locales, SEO, user guide
- Remove VitePress cache files that slipped into git
- Fix all 11 oxlint warnings: replace non-null assertions in
  use-collab.ts with local const captures inside closures
- Update changelog with docs and lint fix entries
2026-03-07 23:19:19 +03:00
Danila Poyarkov cbff284e78 Merge branch 'add-vitepress-docs' 2026-03-07 23:14:25 +03:00
Anton A S a40c535a4d Update CHANGELOG for e2e-coverage 2026-03-07 23:13:08 +03:00
Anton A S 6f93173256 Add mutation unit tests: toggleBoldInRange, vectorNetworkBlob precision, SceneGraph+UndoManager integration 2026-03-07 23:11:03 +03:00
Anton A S d7dc55264b Improve E2E test quality: stronger assertions, fix bold button test, improve snap guide comparison 2026-03-07 23:06:51 +03:00
Anton A S c3c49fcb2f Fix E2E tests: waitForInit loading guard, selector fixes, bold/italic via node-level toggle 2026-03-07 22:48:33 +03:00
Anton A S 83c72b94a0 Add E2E test coverage for canvas, toolbar, panels, properties, auto-layout, variables, export 2026-03-07 22:11:25 +03:00
Anton A S 4315237399 Ignore VitePress build artifacts under docs/ 2026-03-07 21:45:32 +03:00
Danila Poyarkov 2b525b816b Fix eval response unwrapping and export_jsx page selection
- eval CLI was typing rpc result as {ok, result} but the bridge
  already unwraps to the inner value — use rpc<unknown> directly
- export_jsx defaults to current page children, not first page
- Fix import ordering in server.ts (doc comment above imports)
2026-03-07 20:51:53 +03:00