mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-24 10:27:00 -06:00
- New `figcraft_format::rest`: imports the public REST API file JSON (`GET /v1/files/:key`, and the nodes endpoint's response) using the published reference only. Pages (name, background, flow starting points), the layer tree, names, visibility, lock, opacity, blend mode, masks. - Geometry from `relativeTransform` (children of groups/booleans checked against `absoluteBoundingBox` to settle their space), else absolute bounds + rotation; sizes, corner radii (uniform and per corner), smoothing, clip content, constraints, export settings, layout grids. - Paints: solid, linear/radial/angular/diamond gradients (handles map 1:1), image fills (fill, fit, tile, stretch, rotation, filters) with bytes from a resolver or a grey placeholder keyed by the imageRef; paint opacity, visibility and blend. Strokes: weight, per-side weights, align, caps, join, dashes, miter angle. Effects: drop/inner shadow (offset, radius, spread, show behind), layer and background blur. - Vectors from `fillGeometry` (stroke-only vectors use the `strokeGeometry` outline), ellipse arc data, stars/polygons, boolean operations. Text: characters, type style (family, style or weight + italic, size, line height px/%/auto, letter spacing, case, decoration, alignment, auto resize, truncation, paragraph spacing/indent, OpenType flags, links), per-character overrides → styled runs (UTF-16 aware), list type. - Auto layout: direction incl. grid, alignment, padding, gaps, wrap, hug/fixed/fill sizing (legacy and per-axis fields), absolute positioning, min/max, grid cells. - Components and sets with descriptions and property definitions (names lose their `#id` suffix); instances of components in the file become instances with their property values and listed overrides; outside components and component cycles stay frames. Shared styles are created from the layers that use them, named from the metadata. - Unknown types and fields are skipped with a counted warning list; sizes, depth (256), layer count (200,000), path length and list lengths are capped; nothing panics on junk. - Engine: `file.open` / `file.import` / CLI detect the JSON by content, link imported instances to their mains (sources and overrides), read image fills from an `images` folder next to the file, never save over the JSON, and return `warnings`. `file.import` now remaps ids across all imported pages at once (instances keep their main and layer sources) and brings styles and page backgrounds along. `figcraft-cli info` prints load notes. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>