openpencil/src/kiwi
Danila Poyarkov 859afdce45 Add .fig file import (Kiwi codec → scene graph)
File parser:
- .fig files are ZIP archives with Kiwi-encoded canvas data
- Detects canvas blob by name (canvas.fig) or largest binary entry
- Decodes Kiwi Message → NodeChange[] → SceneGraph

Node conversion:
- Maps Figma types to OpenPencil types (COMPONENT → FRAME, etc.)
- Extracts position from transform matrix (m02, m12)
- Extracts rotation from transform matrix (atan2)
- Converts fillPaints/strokePaints to Fill[]/Stroke[]
- Converts effects (shadows, blurs)
- Handles independent corner radii
- Preserves text properties (font, size, alignment, spacing)
- Builds parent-child tree from parentIndex GUIDs
- Sorts children by parentIndex.position

Browser compatibility:
- fzstd for Zstd decompression (replaces Bun.zstd*)
- fflate for ZIP extraction
- Cmd+O opens file dialog for .fig files
- UndoManager.clear() for resetting on file open
2026-02-27 23:01:35 +03:00
..
client.ts PoC 2 & 3: Yoga WASM layout + Kiwi codec 2026-02-27 17:16:21 +03:00
codec.ts Add .fig file import (Kiwi codec → scene graph) 2026-02-27 23:01:35 +03:00
index.ts PoC 2 & 3: Yoga WASM layout + Kiwi codec 2026-02-27 17:16:21 +03:00
poc-test.ts PoC 2 & 3: Yoga WASM layout + Kiwi codec 2026-02-27 17:16:21 +03:00
protocol.ts PoC 2 & 3: Yoga WASM layout + Kiwi codec 2026-02-27 17:16:21 +03:00
schema.ts PoC 2 & 3: Yoga WASM layout + Kiwi codec 2026-02-27 17:16:21 +03:00