openpencil/crates/op-figma/Cargo.toml
Kayshen-X 155f9daee7 feat(figma): wire parse_fig binary pipeline + image resolver
Stage G — the binary `.fig` parser is now end-to-end functional;
`parse_fig` no longer returns NotYetImplemented for binary input.

- image_resolver.rs: resolve_image_blobs walks the converted document
  and replaces `__blob:N` / `__hash:HEX` image-fill placeholders with
  base64 `data:` URLs (MIME sniffed from magic bytes).
- lib.rs: new `parse_fig_binary(bytes, name, layout_mode) -> FigImport`
  runs the whole pipeline — container split → Kiwi decode → tree
  build → node conversion → image resolution. `parse_fig`'s Binary
  arm delegates to it; `FigParseError::NotYetImplemented` retired in
  favour of `Binary(String)`. Entry points re-exported.
- binary_e2e_tests.rs: assembles a real fig-kiwi container from
  scratch (hand-built Kiwi schema + data chunks, deflate-compressed)
  and asserts the full pipeline yields a PenDocument with the
  rectangle at the right position/size + canonical-JSON round-trip.

op-figma 83 tests green (+6); clean build, no warnings.

Closes the §2.1 P0 gap — Figma binary `.fig` parsing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-05-17 16:23:19 +08:00

24 lines
669 B
TOML

[package]
name = "op-figma"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
description = "OpenPencil Figma import — .fig file detection + clipboard-node parsing onto PenNode"
[lib]
name = "op_figma"
path = "src/lib.rs"
[dependencies]
jian-ops-schema = { path = "../../vendor/jian/crates/jian-ops-schema" }
# Binary `.fig` pipeline. flate2's default miniz_oxide backend + ruzstd are
# pure-Rust (no C toolchain, wasm32-clean); base64 builds the image data URLs.
flate2 = "1"
ruzstd = "0.7"
base64 = "0.22"
[dev-dependencies]
op-editor-core = { path = "../op-editor-core" }
serde_json = { workspace = true }