@moondraft/import 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +2 -2
  3. package/SOURCE.md +229 -4
  4. package/dist/adapter/convert.d.ts +24 -2
  5. package/dist/adapter/convert.js +669 -160
  6. package/dist/adapter/figma-descriptions.d.ts +7 -0
  7. package/dist/adapter/figma-descriptions.js +34 -0
  8. package/dist/adapter/figma-grids.d.ts +12 -0
  9. package/dist/adapter/figma-grids.js +175 -0
  10. package/dist/adapter/figma-handoff.d.ts +12 -0
  11. package/dist/adapter/figma-handoff.js +167 -0
  12. package/dist/adapter/figma-hyperlinks.d.ts +13 -0
  13. package/dist/adapter/figma-hyperlinks.js +77 -0
  14. package/dist/adapter/figma.d.ts +4 -1
  15. package/dist/adapter/figma.js +14 -4
  16. package/dist/adapter/file-components.d.ts +9 -3
  17. package/dist/adapter/file-components.js +122 -32
  18. package/dist/adapter/file-resources.js +316 -27
  19. package/dist/adapter/image-crop.d.ts +18 -0
  20. package/dist/adapter/image-crop.js +30 -0
  21. package/dist/adapter/link.d.ts +5 -1
  22. package/dist/adapter/link.js +308 -104
  23. package/dist/adapter/payload.js +1 -1
  24. package/dist/adapter/variables.d.ts +2 -1
  25. package/dist/adapter/variables.js +5 -2
  26. package/dist/figma.js +167 -33
  27. package/dist/index.d.ts +1 -0
  28. package/dist/index.js +1 -0
  29. package/dist/report.d.ts +28 -1
  30. package/dist/report.js +102 -29
  31. package/dist/serialize.d.ts +7 -0
  32. package/dist/serialize.js +79 -0
  33. package/dist/taco/figma-import/container/kiwiContainer.d.ts +3 -0
  34. package/dist/taco/figma-import/container/kiwiContainer.js +1 -1
  35. package/dist/taco/figma-import/import/carry.d.ts +14 -1
  36. package/dist/taco/figma-import/import/carry.js +34 -1
  37. package/dist/taco/figma-import/import/componentProps.d.ts +10 -4
  38. package/dist/taco/figma-import/import/componentProps.js +29 -13
  39. package/dist/taco/figma-import/import/componentSets.d.ts +2 -0
  40. package/dist/taco/figma-import/import/componentSets.js +1 -1
  41. package/dist/taco/figma-import/import/converters/exportSettings.d.ts +4 -0
  42. package/dist/taco/figma-import/import/converters/exportSettings.js +49 -0
  43. package/dist/taco/figma-import/import/converters/frame.js +8 -0
  44. package/dist/taco/figma-import/import/converters/gradient.d.ts +2 -0
  45. package/dist/taco/figma-import/import/converters/gradient.js +3 -1
  46. package/dist/taco/figma-import/import/converters/group.d.ts +2 -4
  47. package/dist/taco/figma-import/import/converters/group.js +6 -15
  48. package/dist/taco/figma-import/import/converters/image.d.ts +1 -1
  49. package/dist/taco/figma-import/import/converters/image.js +22 -11
  50. package/dist/taco/figma-import/import/converters/layout.d.ts +3 -4
  51. package/dist/taco/figma-import/import/converters/layout.js +40 -21
  52. package/dist/taco/figma-import/import/converters/rectangle.d.ts +1 -1
  53. package/dist/taco/figma-import/import/converters/rectangle.js +1 -1
  54. package/dist/taco/figma-import/import/converters/section.d.ts +2 -3
  55. package/dist/taco/figma-import/import/converters/section.js +3 -9
  56. package/dist/taco/figma-import/import/converters/shared.d.ts +7 -4
  57. package/dist/taco/figma-import/import/converters/shared.js +15 -5
  58. package/dist/taco/figma-import/import/converters/text.d.ts +14 -1
  59. package/dist/taco/figma-import/import/converters/text.js +143 -12
  60. package/dist/taco/figma-import/import/converters/vector.d.ts +36 -15
  61. package/dist/taco/figma-import/import/converters/vector.js +214 -73
  62. package/dist/taco/figma-import/import/converters/vectorNetwork.d.ts +19 -3
  63. package/dist/taco/figma-import/import/converters/vectorNetwork.js +147 -29
  64. package/dist/taco/figma-import/import/instances.d.ts +25 -4
  65. package/dist/taco/figma-import/import/instances.js +324 -117
  66. package/dist/taco/figma-import/import/styles.d.ts +2 -0
  67. package/dist/taco/figma-import/import/styles.js +6 -0
  68. package/dist/taco/figma-import/import/variables.d.ts +3 -2
  69. package/dist/taco/figma-import/import/variables.js +37 -30
  70. package/dist/taco/figma-import/import/variantTrees.d.ts +1 -1
  71. package/dist/taco/figma-import/import/variantTrees.js +44 -4
  72. package/dist/taco/figma-import/import/walk.d.ts +53 -5
  73. package/dist/taco/figma-import/import/walk.js +273 -106
  74. package/dist/taco/figma-import/kiwi/message.d.ts +4 -2
  75. package/dist/taco/figma-import/kiwi/message.js +13 -11
  76. package/dist/taco/model/codec.d.ts +1 -1
  77. package/dist/taco/model/codec.js +37 -7
  78. package/dist/taco/model/component-evaluation.d.ts +2 -0
  79. package/dist/taco/model/component-evaluation.js +7 -0
  80. package/dist/taco/model/instance-resolver.d.ts +6 -2
  81. package/dist/taco/model/instance-resolver.js +48 -18
  82. package/dist/taco/model/sha256.js +13 -8
  83. package/dist/taco/model/types.d.ts +23 -1
  84. package/package.json +3 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0 — 2026-11-27
4
+
5
+ ### Highlights
6
+
7
+ - Imports keep text hyperlinks, OpenType features, layout grids, per-layer export settings and variable scopes.
8
+ - Instance overrides resolve through nested swaps, and imports of large Figma files are faster and use less memory.
9
+
10
+ ### Added
11
+
12
+ - Import text hyperlinks, OpenType feature toggles and variants, text truncation and line limits, and text colour
13
+ bindings and paint-style links.
14
+ - Import frame layout grids and grid styles, per-layer export settings, boolean operations, page dividers, canvas
15
+ stacking, image fill crops, flipped instances, legacy rectangles, variable font axes and handoff metadata.
16
+ - Keep variable scopes, code syntax and descriptions, independent stroke-side and corner bindings, vector region
17
+ fills, and caps on every open vector end. Open vector networks are filled.
18
+ - Instances keep overrides for clipping, corner smoothing and auto layout.
19
+
20
+ ### Changed
21
+
22
+ - The peer dependency on `@moondraft/editor` is now `>=0.4.0 <0.5.0`. Install the editor 0.4.0 or later in the
23
+ 0.4 line.
24
+ - Import reports group repeated entries.
25
+ - Large Figma imports run in about half the time and use less memory.
26
+
27
+ ### Fixed
28
+
29
+ - Import angle-based linear gradients again, and prop overrides only on nested instances.
30
+ - Resolve overrides through nested instance swaps and report swaps that the nesting check rejects.
31
+
3
32
  ## 0.1.0
4
33
 
5
34
  - Import SVG files and markup, and Figma clipboard content, as editable layers.
package/README.md CHANGED
@@ -25,10 +25,10 @@ To convert a saved Figma design in Node, save this as `convert.mjs` and run `nod
25
25
 
26
26
  ```js
27
27
  import { readFile, writeFile } from 'node:fs/promises'
28
- import { openFigmaFile } from '@moondraft/import'
28
+ import { openFigmaFile, serializeImportDocument } from '@moondraft/import'
29
29
 
30
30
  const { document, report } = await openFigmaFile(await readFile('design.fig'))
31
- await writeFile('design.json', JSON.stringify(document))
31
+ await writeFile('design.json', serializeImportDocument(document))
32
32
  console.log(report)
33
33
  ```
34
34
 
package/SOURCE.md CHANGED
@@ -36,8 +36,12 @@ node packages/import/scripts/sync-taco.mjs [taco-packages-dir]
36
36
  ```
37
37
 
38
38
  The script deletes `src/taco` and `test/taco`, copies the files again, makes the rewrites below and then applies
39
- `patches/*.patch` in order with `git apply`. On an unchanged source the tree comes out the same as before. If a patch
40
- no longer applies, the sync stops there: update the patch and this log.
39
+ `patches/*.patch` in sorted filename order with `git apply`. On an unchanged source the tree comes out the same as
40
+ before. If a patch no longer applies, the sync stops there. Update the patch and this log.
41
+
42
+ At merge time, give each new patch the next free number after the last patch on `main` and update this log.
43
+ Before merging, run the sync in a clean checkout against the pinned source commit. The replay must succeed and
44
+ reproduce the checked-in `src/taco/` and `test/taco/` byte for byte, with no missing or extra files.
41
45
 
42
46
  ### Mechanical rewrites (made by the script, not patches)
43
47
 
@@ -52,6 +56,8 @@ no longer applies, the sync stops there: update the patch and this log.
52
56
 
53
57
  ## Local patches
54
58
 
59
+ Quoted patch numbers in copied test markers retain the numbers used when those tests were written.
60
+
55
61
  ### `patches/0001-parameter-properties-as-fields.patch`
56
62
 
57
63
  This repo compiles with `erasableSyntaxOnly`, and Node's type stripping refuses TypeScript parameter properties
@@ -135,14 +141,233 @@ would change its aspect-ratio fit. The path and its paint share the image's orig
135
141
 
136
142
  The SVG and Figma linear-gradient converters retain the original stops and unit-box endpoints for on-canvas editing. Under a shear, the axis follows the transformed gradient normal in local pixels. Layer gradients require both endpoints. For flat SVG geometry the importer preserves the gradient slope and offset along the surviving axis. A flat shape perpendicular to the gradient takes the colour sampled at its position. Layer syntax resolves an authored CSS angle when the owning layer supplies its paint box. The gradient expectations in the copied tests use the endpoint representation.
137
143
 
138
- ### `patches/0005-portable-font-style.patch`
144
+ ### `patches/0006-portable-font-style.patch`
139
145
 
140
146
  Carry the original Figma face style name through the intermediate text style and its codec into editor text palettes.
141
147
 
142
- ### `patches/0006-native-figma-file.patch`
148
+ ### `patches/0007-native-figma-file.patch`
143
149
 
144
150
  The saved-file adapter reads each original variant tree, property declaration, variable alias and style definition before conversion to literals. The reader carries the source paint and effect indexes, font-size bindings and authored override paths needed to associate those definitions with their native layer fields. The reader checks reachable variable values for copied paint alpha and valid text metrics. An explicit instance paint also replaces its inherited style reference. Unpublished resources reuse the model’s synchronous SHA-256 implementation, extended to accept file bytes. Clipboard imports continue to use the literal reader.
145
151
 
152
+ ### `patches/0008-report-noise.patch`
153
+
154
+ Fewer repeated report entries from component property defs. A deleted def (Figma keeps an id alone, or an id that
155
+ points at a removed set def) is skipped without a report instead of being reported as an unknown property type. A
156
+ def's dropped preferred values are reported for the first symbol that reads it only, not again for each variant of
157
+ its set: `propertiesOf` takes a set of reported defs that the walk shares across symbols. Two tests in the copied
158
+ `convert-instance.test.ts` cover this, each marked "Moondraft patch 0007".
159
+
160
+ ### `patches/0009-text-truncation.patch`
161
+
162
+ Figma's ending truncation becomes the text's `truncate: "ellipsis"`, and its line limit `maxLines`. A fixed-size box without a limit ends at the lines its height holds. Instance overrides carry both; `null` takes the component's away. The intermediate text node and layer override gain the two optional fields, which the codec checks and the instance resolver applies.
163
+
164
+
165
+ ### `patches/0010-repeated-collection-names.patch`
166
+
167
+ The native file reader keeps the Figma name of each variable collection, even when two collections share one. Native
168
+ records name a collection by its id, as Figma does, so numbering the second one ("Theme 2") only changed its name on
169
+ export and round trip. The literal reader still numbers a repeated name, because its `var('collection/name')`
170
+ expressions need distinct names. `test/editor-hook.test.ts` covers two same-name collections with bound layers.
171
+
172
+ ### `patches/0011-live-boolean-groups.patch`
173
+
174
+ A Figma `BOOLEAN_OPERATION` that Moondraft's boolean group can stand for (`liveBooleanOf` in `converters/vector.ts`:
175
+ union, subtract, intersect or exclude; a transform that only moves and turns; not filling its auto layout parent, and in
176
+ an auto layout flow only where its operands fill its box; shown operands that are shapes, nested boolean operations or
177
+ groups of those; regions not painted apart) becomes a frame holding its operands, which the walk imports as layers. The
178
+ frame carries its operation and the `fillGeometry` outline (in its own space) in `metadata.figma.boolean`, which also
179
+ splits clipboard variants (`variantTrees.ts`);
180
+ the adapter (`src/adapter/convert.ts`) makes it a boolean group whose first result is that outline. "In an auto layout
181
+ flow" means placed by a horizontal or vertical stack the walk imported (a grid imports as absolute), and a nested
182
+ boolean operation counts with its operands' box, as the adapter fits it. One with no outline is kept live anyway (the
183
+ renderer cuts its result); in a flow where its operands do not fill its box it carries `fixedBox`, and the adapter puts
184
+ it in a plain frame of its own box. Any other is
185
+ flattened as before, and its report line gives the reason. Changed expectations in `convert-vector.test.ts` and
186
+ `convert-instance.test.ts` are marked "Moondraft patch 0010".
187
+
188
+ ### `patches/0012-vector-stroke-caps.patch`
189
+
190
+ The Figma vector reader carries a map of cap overrides by open vertex ID in `metadata.figma.vectorStrokeCaps`.
191
+ An open vertex uses its own override, then the override on its incident segment, then the node's cap. The
192
+ reader still reports unknown cap values and style overrides without an open endpoint. A horizontal vector
193
+ that becomes a stretchable line keeps each override on its original end. Clipboard variant merging keeps
194
+ different override maps on separate layers. Vector arrowheads use the existing endpoint cap types and Figma's
195
+ dash cap stays separate.
196
+
197
+ ### `patches/0013-strokes-in-layout.patch`
198
+
199
+ Horizontal and vertical Figma frames with `bordersTakeSpace` carry `metadata.figma.strokesIncluded`. The adapter
200
+ sets `layoutData.layout.strokesIncluded` so inside stroke widths affect child placement and sizing. Clipboard variants
201
+ keep distinct layers when the setting differs.
202
+
203
+ ### `patches/0014-first-on-top.patch`
204
+
205
+ The Figma reader carries `stackReverseZIndex: true` on imported horizontal and vertical stacks as
206
+ `metadata.figma.firstOnTop`. Clipboard variant merges keep frames with different stacking separate. The adapter
207
+ writes the editor's `firstOnTop` frame property and preserves child order. A stack that falls back to free layout
208
+ still reports the omitted stacking setting.
209
+
210
+ ### `patches/0015-resized-instance-layout.patch`
211
+
212
+ The saved-file reader carries `derivedSymbolData` boxes for resized instances of free-layout components. It resolves
213
+ layer paths through nested instances, uses the authored or component value for an omitted size or transform, and
214
+ adjusts local transforms when the reader fits groups. The native adapter places the layers at those boxes, and the
215
+ linker stores the differences as existing geometry overrides where it can link the instance.
216
+
217
+ ### `patches/0016-figma-handoff-metadata.patch`
218
+
219
+ Expose the reader's original node relationships to the clipboard adapter. The adapter uses them for both file
220
+ and clipboard import to store Figma annotations, measurements and development status in `data.figma`. Clipboard
221
+ variant merges keep layers with handoff metadata distinct, and copies inside hidden mains keep their source
222
+ instance IDs. Active layer status takes precedence over the canvas map. The adapter reports metadata omitted from
223
+ skipped subtrees, and the reader reports active annotations and measurements in instance overrides, including
224
+ overrides of the instance root.
225
+
226
+ ### `patches/0017-group-and-vector-fill.patch`
227
+
228
+ The Figma reader carries main-axis grow and cross-axis stretch on non-rotated, aspect-unlocked groups and
229
+ paths in non-wrapping stacks, together with the size limits of paths that fill, as `metadata.figma.fillSizing`.
230
+ The adapter maps them to the editor's `layoutData.resizing`. The reader reports other requested group and path fill.
231
+ Groups carry their own resize constraints as `metadata.figma.groupConstraints` where constraints apply,
232
+ and the adapter writes them to `layoutData.constraints`. Clipboard variants with different carried sizing
233
+ or constraints keep distinct layers. A path with zero extent on a requested axis keeps its size on that
234
+ axis and the reader reports the omission. Its other axis can still fill. The adapter keeps a small positive
235
+ minimum on group fill axes so scale-constrained children can recover after a stack collapses.
236
+
237
+ ### `patches/0018-image-fill-crops.patch`
238
+
239
+ The Figma reader carries non-identity STRETCH image-fill matrices on the imported paints. The crop travels with each
240
+ paint through instance overrides, and clipboard variants with different cropped fills retain distinct layers. The
241
+ adapter inverts the layer-to-image mapping and writes the editor's existing image paint transform. It uses stretch
242
+ for crop axes that scale equally relative to the box and cover for crops that retain the image's aspect ratio.
243
+ The importer reports crops the paint transform cannot represent, such as reflections and shears.
244
+
245
+ ### `patches/0019-nested-instance-swaps.patch`
246
+
247
+ The Figma reader follows explicit swaps authored by enclosing instances when resolving an override path. It uses the
248
+ outermost applicable swap and follows swap property assignments on the replacement. If rejecting a swap changes
249
+ a dependent path, the reader checks any newly exposed swap edges for cycles. Unresolved entries are
250
+ counted individually. The report distinguishes missing source GUIDs or override keys from paths that have no layer
251
+ in the shown component, and identifies nested slot assignments that lack an imported declaration or bound frame.
252
+ The reader retains swap assignments that a different variant can bind. After rejecting a swap that changes which
253
+ slot hosts a component owns, it checks the refreshed nesting edges before accepting the remaining swaps.
254
+
255
+ ### `patches/0020-vector-region-fills.patch`
256
+
257
+ Resolve the style IDs of vector network regions and fallback `fillGeometry` paths through the vector style table.
258
+ Keep explicit empty paint lists and inherit the layer's fills when a region has no override. Region gradients use
259
+ the region bounds, while inherited gradients use the combined path bounds. The adapter keeps the editable network
260
+ and writes its own paints to `Region.fills`, including image tiling carried on the paints.
261
+
262
+ ### `patches/0021-fill-open-vector-networks.patch`
263
+
264
+ For a filled Figma vector network with no stored regions, the reader walks its segments into subpaths, ending
265
+ each chain where it reaches a junction or an endpoint. The subpaths share one nonzero fill region. Open loops
266
+ use the existing `implicitClose` flag so the fill closes without adding a segment to the stroke. Synthetic
267
+ tests cover separate subpaths, a cubic, and chains meeting at a junction.
268
+
269
+ ### `patches/0022-legacy-rectangles.patch`
270
+
271
+ The Figma reader sends legacy `RECTANGLE` nodes through the same editable rectangle converter as `ROUNDED_RECTANGLE`.
272
+
273
+ ### `patches/0023-frame-layout-grids.patch`
274
+
275
+ The Figma reader keeps grid style definitions available for lookup by GUID or library key. It skips them when
276
+ walking layers and recognizes grid-bearing frames in the group heuristic. Clipboard variants retain distinct
277
+ grid-bearing layers. The adapter writes each frame's guides to `layoutGrids` and reports shared grid styles
278
+ when it inlines their grids onto frames.
279
+
280
+ ### `patches/0024-reduce-import-allocations.patch`
281
+
282
+ The Kiwi decoder sizes short arrays up front and checks duplicate message fields against the record it is building.
283
+ Saved-file conversion reuses component computations while releasing each resolved occurrence tree after use.
284
+ Style and variable lookups retain their indexes without keeping the reader’s image callback and temporary tables alive.
285
+ The synchronous SHA-256 fallback reads full blocks from the input and allocates only the final padding blocks.
286
+
287
+ ### `patches/0025-stable-fill-layout.patch`
288
+
289
+ The file reader retains explicit vector sizes from instance layout when the imported path fills its stack.
290
+ It resolves each stored path through component swaps and checks fill eligibility after the stack is finalized.
291
+ The adapter holds conflicting stored allocations and lays out the remaining siblings. For groups it enables
292
+ a fill axis only when the children scale to its fitted bounds, with a minimum large enough to preserve
293
+ smaller paths through collapse. A multi-paint path and its painted regions scale together when their opacity wrapper resizes.
294
+
295
+ ### `patches/0026-vector-region-fill-review.patch`
296
+
297
+ Resolve and bound the combined region paint lists and gradient stops before converting any of them. If the
298
+ renderer limit is exceeded, keep the network, inherit the layer paints, and report the fallback. Detached
299
+ styles without a fill list also inherit. Outline styles report unused fields. Clipboard variants compare region
300
+ image placements, and the adapter keeps region-only assets, places crops using the stored layer size and
301
+ the combined region bounds, and isolates opacity for translucent paths with multiple authored regions.
302
+
303
+ ### `patches/0027-stored-fill-allocations.patch`
304
+
305
+ The file reader tracks explicit group and vector fill sizes separately from free-layout geometry. The adapter
306
+ uses these sizes in the placing instance’s scale and reconciles enclosing stacks before their descendants.
307
+
308
+ ### `patches/0028-variable-descriptions.patch`
309
+
310
+ Remove the Figma reader's loss report for variable descriptions. The saved-file adapter reads the description from
311
+ the original variable record, alongside the component, variant set and style descriptions.
312
+
313
+ ### `patches/0029-reduce-file-import-work.patch`
314
+
315
+ The Kiwi reader lets the file adapter compact each root array record immediately after decoding it.
316
+ Vector paint bounds are measured when a gradient needs them. The instance resolver can return
317
+ content, overrides and slot selections
318
+ before layout for the saved-file adapter, which computes its own geometry.
319
+
320
+ ### `patches/0030-figma-export-settings.patch`
321
+
322
+ Read ordered Figma export presets into the layer's `exportSettings` list for file and clipboard import. An instance
323
+ keeps its own presets, including ones stored on its root override. Report preset changes and clears on inherited
324
+ layers, which the editor's instance override schema cannot express.
325
+
326
+ ### `patches/0031-figma-variable-scopes.patch`
327
+
328
+ Skip the scope omission report for native saved-file imports. The adapter reads scopes and platform code syntax
329
+ from the original variable records. The reader still uses scopes to convert opacity units and reports scope
330
+ omissions in its literal import path.
331
+
332
+ ### `patches/0032-text-colour-variables.patch`
333
+
334
+ The saved-file reader identifies the variable on the solid paint drawn by each text run and retains
335
+ independent paint opacity. The adapter uses this provenance when building the native palette.
336
+
337
+ ### `patches/0033-figma-opentype-features.patch`
338
+
339
+ Read Figma's OpenType toggle lists and typography switches into each run's `openTypeFeatures`.
340
+ The reader keeps them on shared typography and instance overrides. An empty run override clears
341
+ inherited settings. The editor adapter converts the settings to numeric feature values for shaping.
342
+
343
+ ### `patches/0034-text-hyperlinks.patch`
344
+
345
+ Carry URL and GUID links on Figma text runs. Range overrides can replace or clear a layer link. Text component
346
+ assignments preserve inherited links on ranges without a hyperlink field and write explicit clears. A paint
347
+ override supplies the palette for links on assigned text. Evaluating
348
+ an unchanged characters property keeps the source's linked ranges. The adapter accepts HTTP, HTTPS and mailto
349
+ URLs. File and clipboard import resolve pending GUIDs to native layers and pages. The public page converter
350
+ omits and reports GUID destinations when it lacks the Figma source lookup. A saved instance that inherits its
351
+ text palette follows the main’s links and colour bindings. The importer reports each omitted instance link
352
+ override. An instance with an explicit paint keeps the links in its imported palette.
353
+
354
+ ### `patches/0035-text-paint-styles.patch`
355
+
356
+ The saved-file reader carries the fill style GUID of each text run through conversion. An explicit
357
+ range paint replaces the layer's style. Paint styles authored by an instance override are marked so
358
+ the native adapter can keep the resolved colour and report the lost link.
359
+
360
+ ### `patches/0036-independent-edge-bindings.patch`
361
+
362
+ The saved-file adapter reads independent corner radius and stroke side bindings from the source records.
363
+ The vendored reader leaves those fields to the adapter, including groups previously collapsed into a
364
+ single binding. The literal reader retains its existing handling.
365
+
366
+ ### `patches/0037-instance-frame-overrides.patch`
367
+
368
+ The Figma reader keeps per-instance clipping, corner smoothing and stack settings on the affected
369
+ component layer or root. The vendored resolver composes the layout members across nested instances.
370
+
146
371
  ## Code and data from elsewhere
147
372
 
148
373
  - **VS Code themes (MIT).** taco's model adapts the Code - OSS `2026-dark` / `2026-light` colour themes in `code.ts`.
@@ -1,4 +1,5 @@
1
- import type { DocumentJSON, TextStyle } from '@moondraft/editor/schema';
1
+ import { type DocumentJSON, type TextStyle } from '@moondraft/editor/schema';
2
+ import type { StoredFigmaBox } from '../taco/figma-import/import/instances.ts';
2
3
  import { type LinkCounts } from './link.ts';
3
4
  /** A taco document as JSON (schemaVersion 0.44.0): pages, nodes, components, theme and assets, read loosely. */
4
5
  export interface TacoDocument {
@@ -17,6 +18,12 @@ export interface TacoDocument {
17
18
  components: Record<string, any>;
18
19
  /** Placement layer IDs by component ID. */
19
20
  componentPlacements?: Readonly<Record<string, string>>;
21
+ /** Direct file aliases by variable and mode, used to resolve plain text overrides. */
22
+ variableAliases?: ReadonlyMap<string, ReadonlyMap<string, string>>;
23
+ /** Stored Figma boxes by instance ID and layer path, for saved files. */
24
+ instanceBoxes?: ReadonlyMap<string, ReadonlyMap<string, StoredFigmaBox>>;
25
+ /** Sizes saved for flow children, in the placing instance's coordinates. */
26
+ instanceFillSizes?: ReadonlyMap<string, ReadonlyMap<string, StoredFigmaBox>>;
20
27
  /** Source image assets by ID. */
21
28
  assets?: Record<string, any>;
22
29
  /** Theme metadata used to resolve variables and modes. */
@@ -36,6 +43,10 @@ export interface ConvertOptions {
36
43
  kitFixes?: boolean;
37
44
  /** The document's `source` header (the source file's name). */
38
45
  source?: string;
46
+ /** Receives the original reader IDs of expanded instance roots, keyed by converted model ID.
47
+ * @internal
48
+ */
49
+ instanceSources?: Map<string, string>;
39
50
  /**
40
51
  * Resolves the URL for an imported image. Defaults to `assets/<id>.<ext>`.
41
52
  * @param id - Imported asset ID.
@@ -109,14 +120,25 @@ export declare function toDocument(doc: TacoDocument, pageRef: string | number,
109
120
  /** Conversion diagnostics and the page's image assets. */
110
121
  report: ConvertReport;
111
122
  };
123
+ /** Converts the clipboard selection for the Figma adapter's subsequent GUID resolution pass. @internal */
124
+ export declare function figmaClipboardPage(doc: TacoDocument, instanceSources: Map<string, string>): {
125
+ doc: DocumentJSON;
126
+ report: ConvertReport;
127
+ };
112
128
  /** Converts all file pages and keeps the appearance of each linked occurrence.
113
129
  * @param doc - Source document.
114
130
  * @param options - Asset and conversion settings.
115
- * @returns Linked document, conversion report and the pre-link instance literals.
131
+ * @returns Linked document, conversion report, pre-link literals and nested boolean assignments.
116
132
  * @internal
117
133
  */
118
134
  export declare function allPages(doc: TacoDocument, options: ConvertOptions): {
135
+ omittedLinks: Map<string, Set<string>>;
119
136
  expanded: Map<string, any>;
137
+ nestedBooleans: Map<string, NestedBooleanAssignments>;
120
138
  doc: DocumentJSON;
121
139
  report: ConvertReport;
122
140
  };
141
+ export interface NestedBooleanAssignments {
142
+ componentId: string;
143
+ values: Record<string, boolean>;
144
+ }