@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.
- package/CHANGELOG.md +29 -0
- package/README.md +2 -2
- package/SOURCE.md +229 -4
- package/dist/adapter/convert.d.ts +24 -2
- package/dist/adapter/convert.js +669 -160
- package/dist/adapter/figma-descriptions.d.ts +7 -0
- package/dist/adapter/figma-descriptions.js +34 -0
- package/dist/adapter/figma-grids.d.ts +12 -0
- package/dist/adapter/figma-grids.js +175 -0
- package/dist/adapter/figma-handoff.d.ts +12 -0
- package/dist/adapter/figma-handoff.js +167 -0
- package/dist/adapter/figma-hyperlinks.d.ts +13 -0
- package/dist/adapter/figma-hyperlinks.js +77 -0
- package/dist/adapter/figma.d.ts +4 -1
- package/dist/adapter/figma.js +14 -4
- package/dist/adapter/file-components.d.ts +9 -3
- package/dist/adapter/file-components.js +122 -32
- package/dist/adapter/file-resources.js +316 -27
- package/dist/adapter/image-crop.d.ts +18 -0
- package/dist/adapter/image-crop.js +30 -0
- package/dist/adapter/link.d.ts +5 -1
- package/dist/adapter/link.js +308 -104
- package/dist/adapter/payload.js +1 -1
- package/dist/adapter/variables.d.ts +2 -1
- package/dist/adapter/variables.js +5 -2
- package/dist/figma.js +167 -33
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/report.d.ts +28 -1
- package/dist/report.js +102 -29
- package/dist/serialize.d.ts +7 -0
- package/dist/serialize.js +79 -0
- package/dist/taco/figma-import/container/kiwiContainer.d.ts +3 -0
- package/dist/taco/figma-import/container/kiwiContainer.js +1 -1
- package/dist/taco/figma-import/import/carry.d.ts +14 -1
- package/dist/taco/figma-import/import/carry.js +34 -1
- package/dist/taco/figma-import/import/componentProps.d.ts +10 -4
- package/dist/taco/figma-import/import/componentProps.js +29 -13
- package/dist/taco/figma-import/import/componentSets.d.ts +2 -0
- package/dist/taco/figma-import/import/componentSets.js +1 -1
- package/dist/taco/figma-import/import/converters/exportSettings.d.ts +4 -0
- package/dist/taco/figma-import/import/converters/exportSettings.js +49 -0
- package/dist/taco/figma-import/import/converters/frame.js +8 -0
- package/dist/taco/figma-import/import/converters/gradient.d.ts +2 -0
- package/dist/taco/figma-import/import/converters/gradient.js +3 -1
- package/dist/taco/figma-import/import/converters/group.d.ts +2 -4
- package/dist/taco/figma-import/import/converters/group.js +6 -15
- package/dist/taco/figma-import/import/converters/image.d.ts +1 -1
- package/dist/taco/figma-import/import/converters/image.js +22 -11
- package/dist/taco/figma-import/import/converters/layout.d.ts +3 -4
- package/dist/taco/figma-import/import/converters/layout.js +40 -21
- package/dist/taco/figma-import/import/converters/rectangle.d.ts +1 -1
- package/dist/taco/figma-import/import/converters/rectangle.js +1 -1
- package/dist/taco/figma-import/import/converters/section.d.ts +2 -3
- package/dist/taco/figma-import/import/converters/section.js +3 -9
- package/dist/taco/figma-import/import/converters/shared.d.ts +7 -4
- package/dist/taco/figma-import/import/converters/shared.js +15 -5
- package/dist/taco/figma-import/import/converters/text.d.ts +14 -1
- package/dist/taco/figma-import/import/converters/text.js +143 -12
- package/dist/taco/figma-import/import/converters/vector.d.ts +36 -15
- package/dist/taco/figma-import/import/converters/vector.js +214 -73
- package/dist/taco/figma-import/import/converters/vectorNetwork.d.ts +19 -3
- package/dist/taco/figma-import/import/converters/vectorNetwork.js +147 -29
- package/dist/taco/figma-import/import/instances.d.ts +25 -4
- package/dist/taco/figma-import/import/instances.js +324 -117
- package/dist/taco/figma-import/import/styles.d.ts +2 -0
- package/dist/taco/figma-import/import/styles.js +6 -0
- package/dist/taco/figma-import/import/variables.d.ts +3 -2
- package/dist/taco/figma-import/import/variables.js +37 -30
- package/dist/taco/figma-import/import/variantTrees.d.ts +1 -1
- package/dist/taco/figma-import/import/variantTrees.js +44 -4
- package/dist/taco/figma-import/import/walk.d.ts +53 -5
- package/dist/taco/figma-import/import/walk.js +273 -106
- package/dist/taco/figma-import/kiwi/message.d.ts +4 -2
- package/dist/taco/figma-import/kiwi/message.js +13 -11
- package/dist/taco/model/codec.d.ts +1 -1
- package/dist/taco/model/codec.js +37 -7
- package/dist/taco/model/component-evaluation.d.ts +2 -0
- package/dist/taco/model/component-evaluation.js +7 -0
- package/dist/taco/model/instance-resolver.d.ts +6 -2
- package/dist/taco/model/instance-resolver.js +48 -18
- package/dist/taco/model/sha256.js +13 -8
- package/dist/taco/model/types.d.ts +23 -1
- package/package.json +3 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getPathBounds, vectorHandleId, vectorRegionId, vectorSegmentId, vectorRegionToSvgPathData, vectorVertexId, } from "../../../model/index.js";
|
|
2
2
|
import { field, isObject } from "../fields.js";
|
|
3
|
-
import {
|
|
3
|
+
import { styleBackedList } from "../styles.js";
|
|
4
|
+
import { endCapOf, nodePaints } from "./shared.js";
|
|
4
5
|
/**
|
|
5
6
|
* A function giving the tight bounds of a region's outline in node pixels,
|
|
6
7
|
* which the renderer places the region's gradient fills on, or `undefined`
|
|
@@ -271,9 +272,58 @@ function closedChainOutsideRegions(network, used) {
|
|
|
271
272
|
}
|
|
272
273
|
return orderLoop(network, order, "the segments outside every region");
|
|
273
274
|
}
|
|
275
|
+
/**
|
|
276
|
+
* Each maximal chain contributes one loop to the node's fill. Join only
|
|
277
|
+
* through two-way vertices, where there is a unique continuation. Extend
|
|
278
|
+
* both ends of the first unused segment so even unordered segments form
|
|
279
|
+
* one chain and its first stored segment keeps its direction.
|
|
280
|
+
*/
|
|
281
|
+
function implicitFillLoops(network) {
|
|
282
|
+
const touching = new Map();
|
|
283
|
+
for (const [index, { start, end }] of network.segments.entries()) {
|
|
284
|
+
for (const vertex of [start, end]) {
|
|
285
|
+
const incident = touching.get(vertex);
|
|
286
|
+
if (incident)
|
|
287
|
+
incident.push(index);
|
|
288
|
+
else
|
|
289
|
+
touching.set(vertex, [index]);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
const used = new Uint8Array(network.segments.length);
|
|
293
|
+
const extend = (vertex, references, backward) => {
|
|
294
|
+
while (true) {
|
|
295
|
+
const incident = touching.get(vertex);
|
|
296
|
+
if (incident.length !== 2)
|
|
297
|
+
return vertex;
|
|
298
|
+
const index = incident.find((index) => used[index] === 0);
|
|
299
|
+
if (index === undefined)
|
|
300
|
+
return vertex;
|
|
301
|
+
used[index] = 1;
|
|
302
|
+
const segment = network.segments[index];
|
|
303
|
+
const forward = segment.start === vertex;
|
|
304
|
+
references.push({ segmentId: vectorSegmentId(`s${String(index)}`), direction: forward !== backward ? "forward" : "reverse" });
|
|
305
|
+
vertex = forward ? segment.end : segment.start;
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
const loops = [];
|
|
309
|
+
for (const [index, segment] of network.segments.entries()) {
|
|
310
|
+
if (used[index])
|
|
311
|
+
continue;
|
|
312
|
+
used[index] = 1;
|
|
313
|
+
const before = [];
|
|
314
|
+
const after = [{ segmentId: vectorSegmentId(`s${String(index)}`), direction: "forward" }];
|
|
315
|
+
const end = extend(segment.end, after, false);
|
|
316
|
+
const start = extend(segment.start, before, true);
|
|
317
|
+
const segments = before.reverse().concat(after);
|
|
318
|
+
loops.push(start === end ? { segments } : { segments, implicitClose: true });
|
|
319
|
+
}
|
|
320
|
+
return loops;
|
|
321
|
+
}
|
|
274
322
|
/** The node's `styleOverrideTable` entries by `styleID`. */
|
|
275
|
-
function
|
|
323
|
+
export function vectorStyleTable(vectorData, where) {
|
|
276
324
|
const table = new Map();
|
|
325
|
+
if (vectorData === undefined)
|
|
326
|
+
return table;
|
|
277
327
|
(field(vectorData, "styleOverrideTable", "list", `${where} vectorData`) ?? []).forEach((entry, index) => {
|
|
278
328
|
const id = isObject(entry) ? field(entry, "styleID", "number", `${where} vectorData styleOverrideTable[${String(index)}]`) : undefined;
|
|
279
329
|
if (isObject(entry) && id !== undefined)
|
|
@@ -285,13 +335,73 @@ function styleTable(vectorData, where) {
|
|
|
285
335
|
const EDITING_ONLY_STYLE_FIELDS = new Set(["styleID", "handleMirroring"]);
|
|
286
336
|
/** Style field values that draw nothing different: no corner rounding. */
|
|
287
337
|
const NEUTRAL_STYLE_VALUES = { cornerRadius: 0, cornerSmoothing: 0 };
|
|
338
|
+
/** A field with the layer's own value, or one that draws nothing different, loses nothing. */
|
|
339
|
+
function reportUnusedStyle(node, walk, style, used, at) {
|
|
340
|
+
const left = Object.keys(style).filter((key) => !EDITING_ONLY_STYLE_FIELDS.has(key) && !used.includes(key)
|
|
341
|
+
&& style[key] !== node.change[key] && style[key] !== NEUTRAL_STYLE_VALUES[key]);
|
|
342
|
+
if (left.length > 0)
|
|
343
|
+
walk.report("property-left-out", `${at} style ${String(style["styleID"])}: ${left.join(", ")} not imported yet`);
|
|
344
|
+
}
|
|
345
|
+
/** Resolve and budget every region's source list before converting paints for any region. */
|
|
346
|
+
export function applyRegionStyles(node, walk, network, styles, styled, outline = false) {
|
|
347
|
+
if (styled.length === 0)
|
|
348
|
+
return;
|
|
349
|
+
// Keep in sync with the renderer's wire::path budget. Count raw paints and an upper bound on converted stops:
|
|
350
|
+
// clipping can only replace out-of-range stops, except when one stop becomes two.
|
|
351
|
+
let paintsLeft = 100_000, stopsLeft = 1_000_000;
|
|
352
|
+
const stopCounts = new Map();
|
|
353
|
+
const lists = [];
|
|
354
|
+
const represented = outline ? ["fillPaints", "styleIdForFill", "cornerRadius", "cornerSmoothing"] : ["fillPaints", "styleIdForFill"];
|
|
355
|
+
for (const { index, styleId, at } of styled) {
|
|
356
|
+
const style = styles.get(styleId);
|
|
357
|
+
if (style === undefined) {
|
|
358
|
+
walk.report("approximated", `${at} has style ${String(styleId)}, which is not in the styleOverrideTable; the node's style is used`);
|
|
359
|
+
continue;
|
|
360
|
+
}
|
|
361
|
+
const id = `${node.id} ${at} style ${String(styleId)}`;
|
|
362
|
+
const source = styleBackedList(style, "fillPaints", walk.styleList, `node ${id}`, walk.report);
|
|
363
|
+
reportUnusedStyle(node, walk, style, represented, at);
|
|
364
|
+
if (source === undefined)
|
|
365
|
+
continue;
|
|
366
|
+
paintsLeft -= source.length;
|
|
367
|
+
if (paintsLeft < 0) {
|
|
368
|
+
walk.report("approximated", "region fills exceed the renderer's aggregate paints limit; the node's fills are used");
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
let stops = stopCounts.get(source);
|
|
372
|
+
if (stops === undefined) {
|
|
373
|
+
stops = 0;
|
|
374
|
+
for (const paint of source) {
|
|
375
|
+
if (isObject(paint) && typeof paint["type"] === "string" && paint["type"].startsWith("GRADIENT_") && Array.isArray(paint["stops"])) {
|
|
376
|
+
stops += Math.max(2, paint["stops"].length);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
stopCounts.set(source, stops);
|
|
380
|
+
}
|
|
381
|
+
stopsLeft -= stops;
|
|
382
|
+
if (stopsLeft < 0) {
|
|
383
|
+
walk.report("approximated", "region fills exceed the renderer's aggregate gradient stops limit; the node's fills are used");
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
lists.push({ index, id, source });
|
|
387
|
+
}
|
|
388
|
+
if (lists.length === 0)
|
|
389
|
+
return;
|
|
390
|
+
const boxOf = regionBoxes(network);
|
|
391
|
+
for (const { index, id, source } of lists) {
|
|
392
|
+
const region = network.regions[index];
|
|
393
|
+
const fills = nodePaints({ id, change: { size: node.change["size"] } }, walk, "fillPaints", boxOf(region), source);
|
|
394
|
+
network.regions[index] = { ...region, fills };
|
|
395
|
+
}
|
|
396
|
+
}
|
|
288
397
|
/**
|
|
289
398
|
* Builds a Taco network from the node's `vectorData`, scaled from
|
|
290
399
|
* `normalizedSize` to the node's `size` (grida,
|
|
291
400
|
* packages/grida-canvas-io-figma/lib.ts:5064-5120: x by size.x /
|
|
292
401
|
* normalizedSize.x, y likewise, an axis whose normalized size is 0 unscaled).
|
|
293
|
-
* Region styles become region fills; vertex styles give corner radii
|
|
294
|
-
*
|
|
402
|
+
* Region styles become region fills; vertex styles also give corner radii.
|
|
403
|
+
* Cap overrides are collected for open endpoints. Other style fields are
|
|
404
|
+
* reported. Throws `NetworkRefused`.
|
|
295
405
|
*/
|
|
296
406
|
export function vectorDataNetwork(node, vectorData, reference, walk) {
|
|
297
407
|
const where = `node ${node.id}`;
|
|
@@ -318,7 +428,13 @@ export function vectorDataNetwork(node, vectorData, reference, walk) {
|
|
|
318
428
|
throw new NetworkRefused("import-command-limit", `the import has read ${String(shared.limit)} vector commands, its limit (limits.vectorCommands)`);
|
|
319
429
|
}
|
|
320
430
|
shared.left -= raw.segments.length;
|
|
321
|
-
const styles =
|
|
431
|
+
const styles = vectorStyleTable(vectorData, where);
|
|
432
|
+
const degree = new Uint32Array(raw.vertices.length);
|
|
433
|
+
for (const { start, end } of raw.segments) {
|
|
434
|
+
degree[start]++;
|
|
435
|
+
degree[end]++;
|
|
436
|
+
}
|
|
437
|
+
const endpointCaps = {};
|
|
322
438
|
const styleOf = (id, what) => {
|
|
323
439
|
if (id === 0)
|
|
324
440
|
return undefined;
|
|
@@ -327,27 +443,32 @@ export function vectorDataNetwork(node, vectorData, reference, walk) {
|
|
|
327
443
|
walk.report("approximated", `${what} has style ${String(id)}, which is not in the styleOverrideTable; the node's style is used`);
|
|
328
444
|
return style;
|
|
329
445
|
};
|
|
330
|
-
// A field with the node's own value, or one that draws nothing different, loses nothing.
|
|
331
|
-
const reportLeftOver = (style, used, what) => {
|
|
332
|
-
const left = Object.keys(style).filter((key) => !EDITING_ONLY_STYLE_FIELDS.has(key) && !used.includes(key)
|
|
333
|
-
&& style[key] !== node.change[key] && style[key] !== NEUTRAL_STYLE_VALUES[key]);
|
|
334
|
-
if (left.length > 0)
|
|
335
|
-
walk.report("property-left-out", `${what} style ${String(style["styleID"])}: ${left.join(", ")} not imported yet`);
|
|
336
|
-
};
|
|
337
446
|
const vertices = raw.vertices.map((vertex, index) => {
|
|
338
447
|
const style = styleOf(vertex.styleId, `vertex ${String(index)}`);
|
|
339
448
|
const radius = style && field(style, "cornerRadius", "number", `${where} vertex ${String(index)} style`);
|
|
449
|
+
const id = vectorVertexId(`v${String(index)}`);
|
|
450
|
+
const cap = degree[index] === 1 ? endCapOf(style?.["strokeCap"]) : undefined;
|
|
451
|
+
if (cap !== undefined)
|
|
452
|
+
endpointCaps[id] = cap;
|
|
340
453
|
if (style)
|
|
341
|
-
|
|
342
|
-
return { id
|
|
454
|
+
reportUnusedStyle(node, walk, style, cap === undefined ? ["cornerRadius"] : ["cornerRadius", "strokeCap"], `vertex ${String(index)}`);
|
|
455
|
+
return { id, x: vertex.x * sx, y: vertex.y * sy, ...(radius !== undefined && radius > 0 ? { cornerRadius: radius } : {}) };
|
|
343
456
|
});
|
|
344
457
|
const segments = raw.segments.map((segment, index) => {
|
|
345
458
|
const style = styleOf(segment.styleId, `segment ${String(index)}`);
|
|
346
|
-
if (style)
|
|
347
|
-
reportLeftOver(style, [], `segment ${String(index)}`);
|
|
348
459
|
const id = vectorSegmentId(`s${String(index)}`);
|
|
349
460
|
const start = vectorVertexId(`v${String(segment.start)}`);
|
|
350
461
|
const end = vectorVertexId(`v${String(segment.end)}`);
|
|
462
|
+
const cap = degree[segment.start] === 1 || degree[segment.end] === 1 ? endCapOf(style?.["strokeCap"]) : undefined;
|
|
463
|
+
if (cap !== undefined) {
|
|
464
|
+
// A vertex's own cap takes precedence over its incident segment's style.
|
|
465
|
+
if (degree[segment.start] === 1)
|
|
466
|
+
endpointCaps[start] ??= cap;
|
|
467
|
+
if (degree[segment.end] === 1)
|
|
468
|
+
endpointCaps[end] ??= cap;
|
|
469
|
+
}
|
|
470
|
+
if (style)
|
|
471
|
+
reportUnusedStyle(node, walk, style, cap === undefined ? [] : ["strokeCap"], `segment ${String(index)}`);
|
|
351
472
|
if (segment.startDx === 0 && segment.startDy === 0 && segment.endDx === 0 && segment.endDy === 0)
|
|
352
473
|
return { id, kind: "line", start, end };
|
|
353
474
|
return {
|
|
@@ -357,29 +478,26 @@ export function vectorDataNetwork(node, vectorData, reference, walk) {
|
|
|
357
478
|
};
|
|
358
479
|
});
|
|
359
480
|
const used = new Set();
|
|
360
|
-
const
|
|
481
|
+
const styled = [];
|
|
361
482
|
const regions = raw.regions.map((region, index) => {
|
|
362
483
|
const at = `region ${String(index)}`;
|
|
363
484
|
const loops = region.loops.map((loop, loopIndex) => {
|
|
364
485
|
loop.forEach((segment) => used.add(segment));
|
|
365
486
|
return orderLoop(raw, loop, `vector network ${at} loop ${String(loopIndex)}`);
|
|
366
487
|
});
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
const fills = hasFills
|
|
371
|
-
? nodePaints({ id: `${node.id} ${at} style ${String(region.styleId)}`, change: { ...style, size: node.change["size"] } }, walk, "fillPaints", boxOf(shape))
|
|
372
|
-
: undefined;
|
|
373
|
-
if (style)
|
|
374
|
-
reportLeftOver(style, ["fillPaints"], at);
|
|
375
|
-
return { ...shape, ...(fills ? { fills } : {}) };
|
|
488
|
+
if (region.styleId !== 0)
|
|
489
|
+
styled.push({ index, styleId: region.styleId, at });
|
|
490
|
+
return { id: vectorRegionId(`r${String(index)}`), windingRule: region.windingRule, loops };
|
|
376
491
|
});
|
|
492
|
+
applyRegionStyles(node, walk, { vertices, segments, regions }, styles, styled);
|
|
377
493
|
const outside = closedChainOutsideRegions(raw, used);
|
|
378
494
|
if (outside) {
|
|
379
495
|
regions.push({ id: vectorRegionId(`r${String(regions.length)}`), windingRule: "nonzero", loops: [outside] });
|
|
380
496
|
}
|
|
381
|
-
else if (
|
|
382
|
-
|
|
497
|
+
else if (regions.length === 0 && (styleBackedList(node.change, "fillPaints", walk.styleList, where)?.length ?? 0) > 0
|
|
498
|
+
// A lone straight line encloses no area. Keep it eligible for the stack's line conversion.
|
|
499
|
+
&& (segments.length > 1 || segments[0].kind === "cubic")) {
|
|
500
|
+
regions.push({ id: vectorRegionId("r0"), windingRule: "nonzero", loops: implicitFillLoops(raw) });
|
|
383
501
|
}
|
|
384
|
-
return { vertices, segments, regions };
|
|
502
|
+
return { network: { vertices, segments, regions }, endpointCaps };
|
|
385
503
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type InstanceSlots, type ComponentId, type ComponentPropertyId, type ComponentPropertyValue, type FrameNode, type LayerOverride, type NodeId, type SceneNode, type VariableId } from "../../model/index.ts";
|
|
1
|
+
import { type InstanceSlots, type ComponentId, type ComponentPropertyId, type ComponentPropertyValue, type FrameNode, type LayerOverride, type NodeId, type SceneNode, type TransformMatrix, type VariableId } from "../../model/index.ts";
|
|
2
2
|
import { type FigmaObject } from "./fields.ts";
|
|
3
3
|
import { type FigmaStyleList } from "./styles.ts";
|
|
4
4
|
import { type ImportedProperty, type PropertyReport } from "./componentProps.ts";
|
|
@@ -24,6 +24,14 @@ export interface ImportedLayer {
|
|
|
24
24
|
readonly figma: FigmaTreeNode;
|
|
25
25
|
readonly node: SceneNode;
|
|
26
26
|
}
|
|
27
|
+
/** Layout Figma saved for one layer path, in its parent's local coordinates. */
|
|
28
|
+
export interface StoredFigmaBox {
|
|
29
|
+
readonly width: number;
|
|
30
|
+
readonly height: number;
|
|
31
|
+
readonly transform: TransformMatrix;
|
|
32
|
+
/** Scale the component's path vertices from its Figma size to the size at this occurrence. */
|
|
33
|
+
readonly pathScale?: readonly [number, number];
|
|
34
|
+
}
|
|
27
35
|
/** The component bindings the model drops from a layer the override is applied to, so the override must write each again. */
|
|
28
36
|
export declare function bindingsDroppedBy(override: Readonly<Record<string, unknown>>): Set<string>;
|
|
29
37
|
/**
|
|
@@ -44,14 +52,25 @@ export interface HostedSlotFill {
|
|
|
44
52
|
/** The content frame (`isSlotContent`) the host was made from. */
|
|
45
53
|
readonly content: FigmaTreeNode;
|
|
46
54
|
}
|
|
55
|
+
/** Swaps authored at a resolved path, including property assignments that drive a child instance. */
|
|
56
|
+
export interface NestedSwaps {
|
|
57
|
+
symbol?: string;
|
|
58
|
+
properties?: Record<string, string>;
|
|
59
|
+
}
|
|
47
60
|
/** What finishing an instance needs from the walk. */
|
|
48
61
|
export interface InstanceContext {
|
|
62
|
+
/** Keeps the derived boxes for the native file adapter. */
|
|
63
|
+
fileLayout?(boxes: Map<string, StoredFigmaBox>, fillOnly: boolean): void;
|
|
49
64
|
/** Captures an authored override before conversion to literal differences.
|
|
50
65
|
* @param path - Resolved reader layer path.
|
|
51
66
|
* @param change - Fields authored at this occurrence.
|
|
52
67
|
* @returns Nothing.
|
|
53
68
|
*/
|
|
54
69
|
fileOverride?(path: string, change: FigmaObject): void;
|
|
70
|
+
/** The enclosing instance's swaps at this reader path ("" for its own assignments). */
|
|
71
|
+
nestedSwaps(instance: SceneNode, path: string): NestedSwaps | undefined;
|
|
72
|
+
/** Whether a path segment occurs as a node GUID or override key in the source. */
|
|
73
|
+
hasSourceKey(key: string): boolean;
|
|
55
74
|
/** The slots the instance fills, each with its host. */
|
|
56
75
|
readonly slotFills?: readonly HostedSlotFill[];
|
|
57
76
|
/** The imported component made from a SYMBOL, or `undefined` when that symbol was not imported. */
|
|
@@ -133,8 +152,8 @@ export interface Through {
|
|
|
133
152
|
* an override under the root's path, and so does a Hug or Fixed axis that
|
|
134
153
|
* differs. Each `symbolOverrides` path step names a layer by its
|
|
135
154
|
* `overrideKey` (or guid); a step past the first goes through a nested
|
|
136
|
-
* instance into the component it shows, after
|
|
137
|
-
*
|
|
155
|
+
* instance into the component it shows, after explicit swaps by this instance or its nested holders,
|
|
156
|
+
* or a swap driven by a component property. Fields become `LayerOverride` fields where Taco
|
|
138
157
|
* has them (`overriddenSymbolID` a swap, `componentPropAssignments` property
|
|
139
158
|
* values, paints, effects, visibility, opacity, text); the rest are counted
|
|
140
159
|
* through `leftOutField`. A swap in `refusedSwaps` is left out, and so is
|
|
@@ -143,12 +162,14 @@ export interface Through {
|
|
|
143
162
|
* walk's nesting check.
|
|
144
163
|
*/
|
|
145
164
|
export declare function instanceFields(instance: FigmaTreeNode, component: ImportedComponent, self: FrameNode, context: InstanceContext): {
|
|
146
|
-
readonly fields: {
|
|
165
|
+
readonly fields: Pick<FrameNode, "exportSettings"> & {
|
|
147
166
|
readonly overrides?: Record<string, LayerOverride>;
|
|
148
167
|
readonly propertyValues?: Record<string, ComponentPropertyValue>;
|
|
149
168
|
readonly slots?: InstanceSlots;
|
|
150
169
|
};
|
|
151
170
|
readonly swaps: ReadonlySet<string>;
|
|
171
|
+
/** Explicit and property-driven swaps by resolved layer path, including refused swaps. */
|
|
172
|
+
readonly pathSwaps: ReadonlyMap<string, NestedSwaps>;
|
|
152
173
|
/** Each slot frame filled, with the content frame it shows, for the size check once stacks are settled. */
|
|
153
174
|
readonly filledSlots: readonly SlotSizeCheck[];
|
|
154
175
|
readonly nested: ReadonlyMap<string, readonly Through[]>;
|