@moondraft/import 0.0.0-stage → 0.1.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 +7 -0
- package/LICENSE +34 -0
- package/README.md +36 -2
- package/SOURCE.md +169 -0
- package/dist/adapter/convert.d.ts +122 -0
- package/dist/adapter/convert.js +2302 -0
- package/dist/adapter/figma.d.ts +9 -0
- package/dist/adapter/figma.js +30 -0
- package/dist/adapter/file-components.d.ts +14 -0
- package/dist/adapter/file-components.js +262 -0
- package/dist/adapter/file-resources.d.ts +29 -0
- package/dist/adapter/file-resources.js +562 -0
- package/dist/adapter/index.d.ts +6 -0
- package/dist/adapter/index.js +9 -0
- package/dist/adapter/link.d.ts +45 -0
- package/dist/adapter/link.js +688 -0
- package/dist/adapter/payload.d.ts +31 -0
- package/dist/adapter/payload.js +78 -0
- package/dist/adapter/shapes.d.ts +31 -0
- package/dist/adapter/shapes.js +75 -0
- package/dist/adapter/variables.d.ts +44 -0
- package/dist/adapter/variables.js +103 -0
- package/dist/figma-file.d.ts +38 -0
- package/dist/figma-file.js +97 -0
- package/dist/figma-worker.d.ts +11 -0
- package/dist/figma-worker.js +12 -0
- package/dist/figma.d.ts +26 -0
- package/dist/figma.js +96 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +49 -0
- package/dist/report.d.ts +15 -0
- package/dist/report.js +69 -0
- package/dist/svg.d.ts +33 -0
- package/dist/svg.js +44 -0
- package/dist/syntax.d.ts +8 -0
- package/dist/syntax.js +19 -0
- package/dist/taco/figma-import/clipboard.d.ts +25 -0
- package/dist/taco/figma-import/clipboard.js +87 -0
- package/dist/taco/figma-import/clipboardSize.d.ts +31 -0
- package/dist/taco/figma-import/clipboardSize.js +107 -0
- package/dist/taco/figma-import/container/compression.d.ts +9 -0
- package/dist/taco/figma-import/container/compression.js +174 -0
- package/dist/taco/figma-import/container/error.d.ts +15 -0
- package/dist/taco/figma-import/container/error.js +19 -0
- package/dist/taco/figma-import/container/kiwiContainer.d.ts +38 -0
- package/dist/taco/figma-import/container/kiwiContainer.js +61 -0
- package/dist/taco/figma-import/container/limits.d.ts +22 -0
- package/dist/taco/figma-import/container/limits.js +22 -0
- package/dist/taco/figma-import/container/zip.d.ts +14 -0
- package/dist/taco/figma-import/container/zip.js +154 -0
- package/dist/taco/figma-import/figFile.d.ts +34 -0
- package/dist/taco/figma-import/figFile.js +91 -0
- package/dist/taco/figma-import/figFileDocument.d.ts +25 -0
- package/dist/taco/figma-import/figFileDocument.js +100 -0
- package/dist/taco/figma-import/import/blobs.d.ts +10 -0
- package/dist/taco/figma-import/import/blobs.js +23 -0
- package/dist/taco/figma-import/import/carry.d.ts +11 -0
- package/dist/taco/figma-import/import/carry.js +33 -0
- package/dist/taco/figma-import/import/componentProps.d.ts +84 -0
- package/dist/taco/figma-import/import/componentProps.js +313 -0
- package/dist/taco/figma-import/import/componentSets.d.ts +83 -0
- package/dist/taco/figma-import/import/componentSets.js +647 -0
- package/dist/taco/figma-import/import/converters/effects.d.ts +31 -0
- package/dist/taco/figma-import/import/converters/effects.js +127 -0
- package/dist/taco/figma-import/import/converters/ellipse.d.ts +7 -0
- package/dist/taco/figma-import/import/converters/ellipse.js +54 -0
- package/dist/taco/figma-import/import/converters/frame.d.ts +21 -0
- package/dist/taco/figma-import/import/converters/frame.js +55 -0
- package/dist/taco/figma-import/import/converters/gradient.d.ts +72 -0
- package/dist/taco/figma-import/import/converters/gradient.js +106 -0
- package/dist/taco/figma-import/import/converters/group.d.ts +21 -0
- package/dist/taco/figma-import/import/converters/group.js +39 -0
- package/dist/taco/figma-import/import/converters/image.d.ts +13 -0
- package/dist/taco/figma-import/import/converters/image.js +83 -0
- package/dist/taco/figma-import/import/converters/layout.d.ts +34 -0
- package/dist/taco/figma-import/import/converters/layout.js +168 -0
- package/dist/taco/figma-import/import/converters/line.d.ts +11 -0
- package/dist/taco/figma-import/import/converters/line.js +40 -0
- package/dist/taco/figma-import/import/converters/rectangle.d.ts +3 -0
- package/dist/taco/figma-import/import/converters/rectangle.js +11 -0
- package/dist/taco/figma-import/import/converters/section.d.ts +9 -0
- package/dist/taco/figma-import/import/converters/section.js +35 -0
- package/dist/taco/figma-import/import/converters/shared.d.ts +68 -0
- package/dist/taco/figma-import/import/converters/shared.js +362 -0
- package/dist/taco/figma-import/import/converters/text.d.ts +41 -0
- package/dist/taco/figma-import/import/converters/text.js +576 -0
- package/dist/taco/figma-import/import/converters/vector.d.ts +84 -0
- package/dist/taco/figma-import/import/converters/vector.js +468 -0
- package/dist/taco/figma-import/import/converters/vectorNetwork.d.ts +98 -0
- package/dist/taco/figma-import/import/converters/vectorNetwork.js +385 -0
- package/dist/taco/figma-import/import/fields.d.ts +15 -0
- package/dist/taco/figma-import/import/fields.js +29 -0
- package/dist/taco/figma-import/import/instances.d.ts +163 -0
- package/dist/taco/figma-import/import/instances.js +1323 -0
- package/dist/taco/figma-import/import/nestingCycles.d.ts +86 -0
- package/dist/taco/figma-import/import/nestingCycles.js +488 -0
- package/dist/taco/figma-import/import/slots.d.ts +56 -0
- package/dist/taco/figma-import/import/slots.js +96 -0
- package/dist/taco/figma-import/import/styles.d.ts +46 -0
- package/dist/taco/figma-import/import/styles.js +42 -0
- package/dist/taco/figma-import/import/tree.d.ts +66 -0
- package/dist/taco/figma-import/import/tree.js +194 -0
- package/dist/taco/figma-import/import/types.d.ts +232 -0
- package/dist/taco/figma-import/import/types.js +33 -0
- package/dist/taco/figma-import/import/variables.d.ts +136 -0
- package/dist/taco/figma-import/import/variables.js +762 -0
- package/dist/taco/figma-import/import/variantTrees.d.ts +20 -0
- package/dist/taco/figma-import/import/variantTrees.js +480 -0
- package/dist/taco/figma-import/import/walk.d.ts +159 -0
- package/dist/taco/figma-import/import/walk.js +1297 -0
- package/dist/taco/figma-import/index.d.ts +22 -0
- package/dist/taco/figma-import/index.js +13 -0
- package/dist/taco/figma-import/kiwi/byteReader.d.ts +37 -0
- package/dist/taco/figma-import/kiwi/byteReader.js +151 -0
- package/dist/taco/figma-import/kiwi/error.d.ts +14 -0
- package/dist/taco/figma-import/kiwi/error.js +29 -0
- package/dist/taco/figma-import/kiwi/limits.d.ts +18 -0
- package/dist/taco/figma-import/kiwi/limits.js +18 -0
- package/dist/taco/figma-import/kiwi/message.d.ts +10 -0
- package/dist/taco/figma-import/kiwi/message.js +145 -0
- package/dist/taco/figma-import/kiwi/schema.d.ts +42 -0
- package/dist/taco/figma-import/kiwi/schema.js +206 -0
- package/dist/taco/figma-import/kiwi/types.d.ts +46 -0
- package/dist/taco/figma-import/kiwi/types.js +18 -0
- package/dist/taco/model/agent-hidden-fields.d.ts +20 -0
- package/dist/taco/model/agent-hidden-fields.js +29 -0
- package/dist/taco/model/asset-users.d.ts +23 -0
- package/dist/taco/model/asset-users.js +128 -0
- package/dist/taco/model/auto-layout-lines.d.ts +32 -0
- package/dist/taco/model/auto-layout-lines.js +70 -0
- package/dist/taco/model/codec.d.ts +444 -0
- package/dist/taco/model/codec.js +5635 -0
- package/dist/taco/model/color.d.ts +11 -0
- package/dist/taco/model/color.js +61 -0
- package/dist/taco/model/comment-operations.d.ts +102 -0
- package/dist/taco/model/comment-operations.js +227 -0
- package/dist/taco/model/component-evaluation.d.ts +94 -0
- package/dist/taco/model/component-evaluation.js +548 -0
- package/dist/taco/model/component-expressions.d.ts +242 -0
- package/dist/taco/model/component-expressions.js +1082 -0
- package/dist/taco/model/component-properties.d.ts +111 -0
- package/dist/taco/model/component-properties.js +339 -0
- package/dist/taco/model/component-samples.d.ts +83 -0
- package/dist/taco/model/component-samples.js +290 -0
- package/dist/taco/model/component-validity.d.ts +85 -0
- package/dist/taco/model/component-validity.js +397 -0
- package/dist/taco/model/components.d.ts +155 -0
- package/dist/taco/model/components.js +505 -0
- package/dist/taco/model/connector-ends.d.ts +20 -0
- package/dist/taco/model/connector-ends.js +188 -0
- package/dist/taco/model/connector-geometry.d.ts +74 -0
- package/dist/taco/model/connector-geometry.js +293 -0
- package/dist/taco/model/corner-radii.d.ts +26 -0
- package/dist/taco/model/corner-radii.js +47 -0
- package/dist/taco/model/derivations.d.ts +81 -0
- package/dist/taco/model/derivations.js +151 -0
- package/dist/taco/model/export-settings.d.ts +53 -0
- package/dist/taco/model/export-settings.js +156 -0
- package/dist/taco/model/expressions/ast.d.ts +153 -0
- package/dist/taco/model/expressions/ast.js +6 -0
- package/dist/taco/model/expressions/cache.d.ts +23 -0
- package/dist/taco/model/expressions/cache.js +43 -0
- package/dist/taco/model/expressions/check.d.ts +72 -0
- package/dist/taco/model/expressions/check.js +517 -0
- package/dist/taco/model/expressions/completion.d.ts +61 -0
- package/dist/taco/model/expressions/completion.js +421 -0
- package/dist/taco/model/expressions/evaluate.d.ts +32 -0
- package/dist/taco/model/expressions/evaluate.js +519 -0
- package/dist/taco/model/expressions/forms.d.ts +84 -0
- package/dist/taco/model/expressions/forms.js +200 -0
- package/dist/taco/model/expressions/index.d.ts +14 -0
- package/dist/taco/model/expressions/index.js +17 -0
- package/dist/taco/model/expressions/lexer.d.ts +42 -0
- package/dist/taco/model/expressions/lexer.js +213 -0
- package/dist/taco/model/expressions/library.d.ts +33 -0
- package/dist/taco/model/expressions/library.js +117 -0
- package/dist/taco/model/expressions/names.d.ts +43 -0
- package/dist/taco/model/expressions/names.js +99 -0
- package/dist/taco/model/expressions/parser.d.ts +15 -0
- package/dist/taco/model/expressions/parser.js +438 -0
- package/dist/taco/model/expressions/rename.d.ts +34 -0
- package/dist/taco/model/expressions/rename.js +46 -0
- package/dist/taco/model/expressions/source.d.ts +15 -0
- package/dist/taco/model/expressions/source.js +161 -0
- package/dist/taco/model/expressions/types.d.ts +119 -0
- package/dist/taco/model/expressions/types.js +102 -0
- package/dist/taco/model/expressions/values.d.ts +97 -0
- package/dist/taco/model/expressions/values.js +160 -0
- package/dist/taco/model/geometry-limits.d.ts +16 -0
- package/dist/taco/model/geometry-limits.js +67 -0
- package/dist/taco/model/geometry.d.ts +47 -0
- package/dist/taco/model/geometry.js +193 -0
- package/dist/taco/model/group-bounds.d.ts +38 -0
- package/dist/taco/model/group-bounds.js +144 -0
- package/dist/taco/model/id-table.d.ts +37 -0
- package/dist/taco/model/id-table.js +80 -0
- package/dist/taco/model/index.d.ts +25 -0
- package/dist/taco/model/index.js +27 -0
- package/dist/taco/model/instance-resolver.d.ts +372 -0
- package/dist/taco/model/instance-resolver.js +1748 -0
- package/dist/taco/model/layer-syntax.d.ts +340 -0
- package/dist/taco/model/layer-syntax.js +3506 -0
- package/dist/taco/model/layout/constraints.d.ts +84 -0
- package/dist/taco/model/layout/constraints.js +445 -0
- package/dist/taco/model/layout/frame-layout.d.ts +46 -0
- package/dist/taco/model/layout/frame-layout.js +618 -0
- package/dist/taco/model/layout/node-sizing.d.ts +163 -0
- package/dist/taco/model/layout/node-sizing.js +486 -0
- package/dist/taco/model/legacy-connector-caps.d.ts +15 -0
- package/dist/taco/model/legacy-connector-caps.js +70 -0
- package/dist/taco/model/linear-call.d.ts +48 -0
- package/dist/taco/model/linear-call.js +58 -0
- package/dist/taco/model/new-nodes.d.ts +145 -0
- package/dist/taco/model/new-nodes.js +277 -0
- package/dist/taco/model/node-builder.d.ts +449 -0
- package/dist/taco/model/node-builder.js +2294 -0
- package/dist/taco/model/node-table-watch.d.ts +36 -0
- package/dist/taco/model/node-table-watch.js +63 -0
- package/dist/taco/model/node-transform.d.ts +39 -0
- package/dist/taco/model/node-transform.js +79 -0
- package/dist/taco/model/node-users-index.d.ts +10 -0
- package/dist/taco/model/node-users-index.js +82 -0
- package/dist/taco/model/operation-references.d.ts +80 -0
- package/dist/taco/model/operation-references.js +399 -0
- package/dist/taco/model/operations.d.ts +610 -0
- package/dist/taco/model/operations.js +2882 -0
- package/dist/taco/model/overlay-table.d.ts +71 -0
- package/dist/taco/model/overlay-table.js +171 -0
- package/dist/taco/model/override-remap.d.ts +69 -0
- package/dist/taco/model/override-remap.js +230 -0
- package/dist/taco/model/parent-table.d.ts +53 -0
- package/dist/taco/model/parent-table.js +193 -0
- package/dist/taco/model/problem-collector.d.ts +27 -0
- package/dist/taco/model/problem-collector.js +101 -0
- package/dist/taco/model/sha256.d.ts +10 -0
- package/dist/taco/model/sha256.js +74 -0
- package/dist/taco/model/shape-geometry.d.ts +96 -0
- package/dist/taco/model/shape-geometry.js +368 -0
- package/dist/taco/model/shared-node-table.d.ts +97 -0
- package/dist/taco/model/shared-node-table.js +546 -0
- package/dist/taco/model/slots.d.ts +113 -0
- package/dist/taco/model/slots.js +281 -0
- package/dist/taco/model/stroke-settings.d.ts +37 -0
- package/dist/taco/model/stroke-settings.js +90 -0
- package/dist/taco/model/svg-path-import.d.ts +89 -0
- package/dist/taco/model/svg-path-import.js +219 -0
- package/dist/taco/model/text-measurement.d.ts +142 -0
- package/dist/taco/model/text-measurement.js +846 -0
- package/dist/taco/model/text-reads.d.ts +66 -0
- package/dist/taco/model/text-reads.js +128 -0
- package/dist/taco/model/text-sizer.d.ts +358 -0
- package/dist/taco/model/text-sizer.js +996 -0
- package/dist/taco/model/theme-users.d.ts +59 -0
- package/dist/taco/model/theme-users.js +312 -0
- package/dist/taco/model/thumbnail.d.ts +15 -0
- package/dist/taco/model/thumbnail.js +34 -0
- package/dist/taco/model/types.d.ts +2347 -0
- package/dist/taco/model/types.js +366 -0
- package/dist/taco/model/unknown-property.d.ts +5 -0
- package/dist/taco/model/unknown-property.js +7 -0
- package/dist/taco/model/validated-documents.d.ts +22 -0
- package/dist/taco/model/validated-documents.js +22 -0
- package/dist/taco/model/variable-modes.d.ts +61 -0
- package/dist/taco/model/variable-modes.js +438 -0
- package/dist/taco/model/variable-references.d.ts +54 -0
- package/dist/taco/model/variable-references.js +183 -0
- package/dist/taco/model/variables.d.ts +24 -0
- package/dist/taco/model/variables.js +151 -0
- package/dist/taco/model/vector-network.d.ts +34 -0
- package/dist/taco/model/vector-network.js +411 -0
- package/dist/taco/svg-import/import-svg.d.ts +36 -0
- package/dist/taco/svg-import/import-svg.js +729 -0
- package/dist/taco/svg-import/index.d.ts +3 -0
- package/dist/taco/svg-import/index.js +3 -0
- package/dist/taco/svg-import/limits/limits.d.ts +79 -0
- package/dist/taco/svg-import/limits/limits.js +160 -0
- package/dist/taco/svg-import/paint/gradients.d.ts +64 -0
- package/dist/taco/svg-import/paint/gradients.js +429 -0
- package/dist/taco/svg-import/paint/paint.d.ts +32 -0
- package/dist/taco/svg-import/paint/paint.js +162 -0
- package/dist/taco/svg-import/paths/paths.d.ts +58 -0
- package/dist/taco/svg-import/paths/paths.js +205 -0
- package/dist/taco/svg-import/public-types.d.ts +279 -0
- package/dist/taco/svg-import/public-types.js +56 -0
- package/dist/taco/svg-import/report/report.d.ts +44 -0
- package/dist/taco/svg-import/report/report.js +79 -0
- package/dist/taco/svg-import/reuse/reuse.d.ts +99 -0
- package/dist/taco/svg-import/reuse/reuse.js +840 -0
- package/dist/taco/svg-import/shapes/shapes.d.ts +35 -0
- package/dist/taco/svg-import/shapes/shapes.js +386 -0
- package/dist/taco/svg-import/structure/effects.d.ts +26 -0
- package/dist/taco/svg-import/structure/effects.js +618 -0
- package/dist/taco/svg-import/structure/image.d.ts +24 -0
- package/dist/taco/svg-import/structure/image.js +495 -0
- package/dist/taco/svg-import/structure/walk.d.ts +85 -0
- package/dist/taco/svg-import/structure/walk.js +544 -0
- package/dist/taco/svg-import/style/color.d.ts +40 -0
- package/dist/taco/svg-import/style/color.js +275 -0
- package/dist/taco/svg-import/style/computed.d.ts +214 -0
- package/dist/taco/svg-import/style/computed.js +1534 -0
- package/dist/taco/svg-import/style/css.d.ts +127 -0
- package/dist/taco/svg-import/style/css.js +541 -0
- package/dist/taco/svg-import/style/media.d.ts +25 -0
- package/dist/taco/svg-import/style/media.js +307 -0
- package/dist/taco/svg-import/style/properties.d.ts +43 -0
- package/dist/taco/svg-import/style/properties.js +135 -0
- package/dist/taco/svg-import/style/selector-reach.d.ts +30 -0
- package/dist/taco/svg-import/style/selector-reach.js +169 -0
- package/dist/taco/svg-import/style/selector-validity.d.ts +14 -0
- package/dist/taco/svg-import/style/selector-validity.js +307 -0
- package/dist/taco/svg-import/text/text.d.ts +29 -0
- package/dist/taco/svg-import/text/text.js +545 -0
- package/dist/taco/svg-import/transform/matrix.d.ts +111 -0
- package/dist/taco/svg-import/transform/matrix.js +229 -0
- package/dist/taco/svg-import/tree/element-data.d.ts +52 -0
- package/dist/taco/svg-import/tree/element-data.js +155 -0
- package/dist/taco/svg-import/tree/elements.d.ts +36 -0
- package/dist/taco/svg-import/tree/elements.js +121 -0
- package/dist/taco/svg-import/units/length.d.ts +43 -0
- package/dist/taco/svg-import/units/length.js +125 -0
- package/dist/taco/svg-import/units/viewbox.d.ts +35 -0
- package/dist/taco/svg-import/units/viewbox.js +77 -0
- package/package.json +54 -4
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { FrameNode, FramedNodeBase, NodeResizing, SceneNode, StackAutoLayout, TextNode } from "../../../model/index.ts";
|
|
2
|
+
import { type FigmaObject } from "../fields.ts";
|
|
3
|
+
import type { FigmaImportReportKind } from "../types.ts";
|
|
4
|
+
type Report = (kind: FigmaImportReportKind, reason: string) => void;
|
|
5
|
+
/**
|
|
6
|
+
* A Figma HORIZONTAL or VERTICAL auto layout as a Taco stack, or `undefined`
|
|
7
|
+
* for free layout. The walk turns the stack off again unless every child in
|
|
8
|
+
* the flow was imported and is visible (see `stackBlocker`). An absent
|
|
9
|
+
* `stackPrimarySizing` hugs and an absent `stackCounterSizing` is fixed, as
|
|
10
|
+
* measured on real Figma files.
|
|
11
|
+
*/
|
|
12
|
+
export declare function stackLayoutOf(change: FigmaObject, report: Report): StackAutoLayout | undefined;
|
|
13
|
+
/** `minSize` and `maxSize` as Taco size limits; Figma writes 0 for an unset limit. */
|
|
14
|
+
export declare function sizeLimitsOf(change: FigmaObject): NodeResizing;
|
|
15
|
+
/**
|
|
16
|
+
* The fields a child of a Figma stack gets in Taco: "Ignore auto layout"
|
|
17
|
+
* (`stackPositioning` ABSOLUTE) becomes `layoutPositioning`, a primary-axis
|
|
18
|
+
* grow becomes Fill on the main axis and `stackChildAlignSelf` STRETCH Fill on
|
|
19
|
+
* the cross axis. Taco has no grow weights, so any grow above 0 fills. A
|
|
20
|
+
* flow child loses its constraints, taken off `node` itself, as they apply
|
|
21
|
+
* only to absolute children.
|
|
22
|
+
* `cannotFill` names the kind of a child that Taco does not let fill (a group
|
|
23
|
+
* or a path); such a child keeps its fixed size and the report says so. A
|
|
24
|
+
* line fills only its width, as its height is always 0.
|
|
25
|
+
*
|
|
26
|
+
* Figma keeps one sizing per axis, and Fill wins over the child's own Hug: a
|
|
27
|
+
* frame that hugs an axis, or text that sizes it to its content, shows the
|
|
28
|
+
* filled size there (setting Fill in Figma turns the frame's sizing to fixed
|
|
29
|
+
* and the text's resizing to fixed). Taco refuses a node that both fills and
|
|
30
|
+
* sizes to its content, so such a child gets the fill and a fixed size on that
|
|
31
|
+
* axis instead, and the report says so.
|
|
32
|
+
*/
|
|
33
|
+
export declare function stackChildFields(change: FigmaObject, vertical: boolean, node: SceneNode, report: Report, cannotFill?: string): Pick<FramedNodeBase, "layoutPositioning" | "resizing"> & Partial<Pick<TextNode, "autoResize" | "wrap"> & Pick<FrameNode, "layout">>;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { isObject } from "../fields.js";
|
|
2
|
+
/**
|
|
3
|
+
* A finite number field, or `undefined`. Figma writes NaN in some stack
|
|
4
|
+
* fields it does not use (seen in `stackCounterSpacing`), so a value that is
|
|
5
|
+
* not a finite number counts as absent instead of refusing the message.
|
|
6
|
+
*/
|
|
7
|
+
function numberField(change, name) {
|
|
8
|
+
const value = change[name];
|
|
9
|
+
return typeof value === "number" && Number.isFinite(value) ? value : undefined;
|
|
10
|
+
}
|
|
11
|
+
/** Looks up an enum name in `table`; `undefined` when absent, `null` when Taco has no match. */
|
|
12
|
+
function enumField(change, name, table) {
|
|
13
|
+
const value = change[name];
|
|
14
|
+
if (value === undefined)
|
|
15
|
+
return undefined;
|
|
16
|
+
return typeof value === "string" && Object.hasOwn(table, value) ? table[value] : null;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Figma's file stores the "Space between" spacing mode as SPACE_EVENLY as
|
|
20
|
+
* well as SPACE_BETWEEN; Figma has no space-evenly mode. Both place the first
|
|
21
|
+
* child at the start padding and the last at the end padding, as the child
|
|
22
|
+
* positions saved in real files show, so both import as `space-between`.
|
|
23
|
+
*/
|
|
24
|
+
const JUSTIFY = {
|
|
25
|
+
MIN: "start", CENTER: "center", MAX: "end", SPACE_BETWEEN: "space-between", SPACE_EVENLY: "space-between",
|
|
26
|
+
};
|
|
27
|
+
const ALIGN = { MIN: "start", CENTER: "center", MAX: "end" };
|
|
28
|
+
const SIZING = { FIXED: "fixed", RESIZE_TO_FIT: "hug", RESIZE_TO_FIT_WITH_IMPLICIT_SIZE: "hug" };
|
|
29
|
+
/**
|
|
30
|
+
* A Figma HORIZONTAL or VERTICAL auto layout as a Taco stack, or `undefined`
|
|
31
|
+
* for free layout. The walk turns the stack off again unless every child in
|
|
32
|
+
* the flow was imported and is visible (see `stackBlocker`). An absent
|
|
33
|
+
* `stackPrimarySizing` hugs and an absent `stackCounterSizing` is fixed, as
|
|
34
|
+
* measured on real Figma files.
|
|
35
|
+
*/
|
|
36
|
+
export function stackLayoutOf(change, report) {
|
|
37
|
+
const mode = change["stackMode"];
|
|
38
|
+
if (mode === "GRID") {
|
|
39
|
+
report("property-left-out", "grid auto layout is not imported yet; children keep their positions");
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
if (mode !== "HORIZONTAL" && mode !== "VERTICAL")
|
|
43
|
+
return undefined;
|
|
44
|
+
const vertical = mode === "VERTICAL";
|
|
45
|
+
const justify = enumField(change, "stackPrimaryAlignItems", JUSTIFY);
|
|
46
|
+
if (justify === null)
|
|
47
|
+
report("property-left-out", `stackPrimaryAlignItems ${String(change["stackPrimaryAlignItems"])} is not imported; children pack from the start`);
|
|
48
|
+
const align = enumField(change, "stackCounterAlignItems", ALIGN);
|
|
49
|
+
if (align === null)
|
|
50
|
+
report("approximated", `stackCounterAlignItems ${String(change["stackCounterAlignItems"])} is imported as start`);
|
|
51
|
+
const primary = enumField(change, "stackPrimarySizing", SIZING) ?? "hug";
|
|
52
|
+
const counter = enumField(change, "stackCounterSizing", SIZING) ?? "fixed";
|
|
53
|
+
if (change["stackReverseZIndex"] === true)
|
|
54
|
+
report("property-left-out", "stackReverseZIndex (first child on top) is not imported; later children stay on top");
|
|
55
|
+
if (change["bordersTakeSpace"] === true)
|
|
56
|
+
report("property-left-out", "strokes taking space in the auto layout (bordersTakeSpace) are not imported");
|
|
57
|
+
// Figma's file omits a padding field that is 0, on every side: a missing
|
|
58
|
+
// `stackPaddingRight` or `stackPaddingBottom` is 0, not a copy of the left or
|
|
59
|
+
// top padding. Only the legacy single `stackPadding` stands in for all four.
|
|
60
|
+
const all = numberField(change, "stackPadding") ?? 0;
|
|
61
|
+
const left = numberField(change, "stackHorizontalPadding") ?? all;
|
|
62
|
+
const top = numberField(change, "stackVerticalPadding") ?? all;
|
|
63
|
+
const wrapGap = numberField(change, "stackCounterSpacing");
|
|
64
|
+
return {
|
|
65
|
+
kind: vertical ? "vertical" : "horizontal",
|
|
66
|
+
gap: numberField(change, "stackSpacing") ?? 0,
|
|
67
|
+
padding: { left, right: numberField(change, "stackPaddingRight") ?? all, top, bottom: numberField(change, "stackPaddingBottom") ?? all },
|
|
68
|
+
align: align ?? "start",
|
|
69
|
+
justify: justify ?? "start",
|
|
70
|
+
...(change["stackWrap"] === "WRAP"
|
|
71
|
+
? { wrap: true, ...(wrapGap === undefined ? {} : { wrapGap }), ...(change["stackCounterAlignContent"] === "SPACE_BETWEEN" ? { alignContent: "space-between" } : {}) }
|
|
72
|
+
: {}),
|
|
73
|
+
widthSizing: vertical ? counter : primary,
|
|
74
|
+
heightSizing: vertical ? primary : counter,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/** `minSize` and `maxSize` as Taco size limits; Figma writes 0 for an unset limit. */
|
|
78
|
+
export function sizeLimitsOf(change) {
|
|
79
|
+
const limit = (name, axis) => {
|
|
80
|
+
const box = change[name];
|
|
81
|
+
const value = isObject(box) && isObject(box["value"]) ? numberField(box["value"], axis) : undefined;
|
|
82
|
+
return value !== undefined && value > 0 ? value : undefined;
|
|
83
|
+
};
|
|
84
|
+
const entries = [
|
|
85
|
+
["minWidth", limit("minSize", "x")], ["maxWidth", limit("maxSize", "x")],
|
|
86
|
+
["minHeight", limit("minSize", "y")], ["maxHeight", limit("maxSize", "y")],
|
|
87
|
+
];
|
|
88
|
+
return Object.fromEntries(entries.filter(([, value]) => value !== undefined));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The fields a child of a Figma stack gets in Taco: "Ignore auto layout"
|
|
92
|
+
* (`stackPositioning` ABSOLUTE) becomes `layoutPositioning`, a primary-axis
|
|
93
|
+
* grow becomes Fill on the main axis and `stackChildAlignSelf` STRETCH Fill on
|
|
94
|
+
* the cross axis. Taco has no grow weights, so any grow above 0 fills. A
|
|
95
|
+
* flow child loses its constraints, taken off `node` itself, as they apply
|
|
96
|
+
* only to absolute children.
|
|
97
|
+
* `cannotFill` names the kind of a child that Taco does not let fill (a group
|
|
98
|
+
* or a path); such a child keeps its fixed size and the report says so. A
|
|
99
|
+
* line fills only its width, as its height is always 0.
|
|
100
|
+
*
|
|
101
|
+
* Figma keeps one sizing per axis, and Fill wins over the child's own Hug: a
|
|
102
|
+
* frame that hugs an axis, or text that sizes it to its content, shows the
|
|
103
|
+
* filled size there (setting Fill in Figma turns the frame's sizing to fixed
|
|
104
|
+
* and the text's resizing to fixed). Taco refuses a node that both fills and
|
|
105
|
+
* sizes to its content, so such a child gets the fill and a fixed size on that
|
|
106
|
+
* axis instead, and the report says so.
|
|
107
|
+
*/
|
|
108
|
+
export function stackChildFields(change, vertical, node, report, cannotFill) {
|
|
109
|
+
if (change["stackPositioning"] === "ABSOLUTE")
|
|
110
|
+
return { layoutPositioning: "absolute" };
|
|
111
|
+
// Constraints act on a flow child neither in Figma nor in Taco, so the child keeps none.
|
|
112
|
+
if ("constraints" in node)
|
|
113
|
+
delete node.constraints;
|
|
114
|
+
const grow = numberField(change, "stackChildPrimaryGrow") ?? 0;
|
|
115
|
+
if (grow > 0 && cannotFill !== undefined) {
|
|
116
|
+
report("approximated", `stackChildPrimaryGrow ${String(grow)} is not imported as Fill; ${cannotFill} cannot fill its parent in Taco, so it keeps its size`);
|
|
117
|
+
}
|
|
118
|
+
else if (grow !== 0 && grow !== 1) {
|
|
119
|
+
report("approximated", `stackChildPrimaryGrow ${String(grow)} is imported as Fill; Taco has no grow weights`);
|
|
120
|
+
}
|
|
121
|
+
const alignSelf = change["stackChildAlignSelf"];
|
|
122
|
+
const stretch = alignSelf === "STRETCH";
|
|
123
|
+
if (alignSelf !== undefined && alignSelf !== "AUTO" && !stretch) {
|
|
124
|
+
report("property-left-out", `stackChildAlignSelf ${String(alignSelf)} is not imported; the child follows the frame's alignment`);
|
|
125
|
+
}
|
|
126
|
+
if (stretch && cannotFill !== undefined) {
|
|
127
|
+
report("approximated", `stackChildAlignSelf STRETCH is not imported as Fill; ${cannotFill} cannot fill its parent in Taco, so it keeps its size`);
|
|
128
|
+
}
|
|
129
|
+
if (cannotFill !== undefined)
|
|
130
|
+
return {};
|
|
131
|
+
const fillMain = grow > 0;
|
|
132
|
+
const line = node.type === "shape" && node.shape === "line";
|
|
133
|
+
const fillHeight = vertical ? fillMain : stretch;
|
|
134
|
+
if (fillHeight && line) {
|
|
135
|
+
report("approximated", `${vertical ? `stackChildPrimaryGrow ${String(grow)}` : "stackChildAlignSelf STRETCH"} is not imported as Fill on the height; a line's height is always 0`);
|
|
136
|
+
}
|
|
137
|
+
const fill = {
|
|
138
|
+
...((vertical ? stretch : fillMain) ? { width: "fill" } : {}),
|
|
139
|
+
...(fillHeight && !line ? { height: "fill" } : {}),
|
|
140
|
+
};
|
|
141
|
+
if (fill.width === undefined && fill.height === undefined)
|
|
142
|
+
return {};
|
|
143
|
+
const resizing = "resizing" in node ? node.resizing : undefined;
|
|
144
|
+
return { resizing: { ...resizing, ...fill }, ...fixedWhereFilled(node, fill, report) };
|
|
145
|
+
}
|
|
146
|
+
/** The text resizing or frame sizing that lets `node` fill the axes `fill` names, as Figma shows it. */
|
|
147
|
+
function fixedWhereFilled(node, fill, report) {
|
|
148
|
+
const fillWidth = fill.width === "fill";
|
|
149
|
+
const fillHeight = fill.height === "fill";
|
|
150
|
+
if (node.type === "text") {
|
|
151
|
+
const autoResize = fillHeight ? "none" : fillWidth && node.autoResize === "width-and-height" ? "height" : node.autoResize;
|
|
152
|
+
if (autoResize === node.autoResize)
|
|
153
|
+
return {};
|
|
154
|
+
const axes = fillHeight ? "height" : "width";
|
|
155
|
+
report("approximated", `text that sizes its ${axes} to its content fills its ${axes} in its auto layout parent; it is imported with ${autoResize === "none" ? "a fixed size" : "auto height"}, as Figma shows it`);
|
|
156
|
+
return { autoResize, ...(node.autoResize === "width-and-height" ? { wrap: "word" } : {}) };
|
|
157
|
+
}
|
|
158
|
+
if (node.type !== "frame" || node.layout.kind === "absolute")
|
|
159
|
+
return {};
|
|
160
|
+
const layout = node.layout;
|
|
161
|
+
const width = fillWidth && layout.widthSizing === "hug";
|
|
162
|
+
const height = fillHeight && layout.heightSizing === "hug";
|
|
163
|
+
if (!width && !height)
|
|
164
|
+
return {};
|
|
165
|
+
const axes = width && height ? "width and height" : width ? "width" : "height";
|
|
166
|
+
report("approximated", `a frame that hugs its ${axes} fills it in its auto layout parent; it is imported with a fixed ${axes}, as Figma shows it`);
|
|
167
|
+
return { layout: { ...layout, ...(width ? { widthSizing: "fixed" } : {}), ...(height ? { heightSizing: "fixed" } : {}) } };
|
|
168
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FigmaNodeConverter } from "../walk.ts";
|
|
2
|
+
/**
|
|
3
|
+
* A Figma LINE as a Taco path of one segment from (0, 0) to (size.x, 0) in
|
|
4
|
+
* the node's own space, placed by its `transform` as `convertVector` places
|
|
5
|
+
* a VECTOR. A LINE of length 0 or with no strokes is still imported, as
|
|
6
|
+
* Figma keeps it; one with no length (`size.x`) is left out. Both ends take
|
|
7
|
+
* the node's `strokeCap`. Figma draws a LINE's stroke centred whatever its
|
|
8
|
+
* `strokeAlign`, so the strokes are centred. A LINE that fills its auto
|
|
9
|
+
* layout parent becomes a Taco line instead (`lineWhereItFills`).
|
|
10
|
+
*/
|
|
11
|
+
export declare const convertLine: FigmaNodeConverter;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { getVectorNetworkBounds, vectorSegmentId, vectorVertexId } from "../../../model/index.js";
|
|
2
|
+
import { field } from "../fields.js";
|
|
3
|
+
import { nodeEffects } from "./effects.js";
|
|
4
|
+
import { layerBase } from "./shared.js";
|
|
5
|
+
import { lineWhereItFills, pathStrokes, pathTransform } from "./vector.js";
|
|
6
|
+
/**
|
|
7
|
+
* A Figma LINE as a Taco path of one segment from (0, 0) to (size.x, 0) in
|
|
8
|
+
* the node's own space, placed by its `transform` as `convertVector` places
|
|
9
|
+
* a VECTOR. A LINE of length 0 or with no strokes is still imported, as
|
|
10
|
+
* Figma keeps it; one with no length (`size.x`) is left out. Both ends take
|
|
11
|
+
* the node's `strokeCap`. Figma draws a LINE's stroke centred whatever its
|
|
12
|
+
* `strokeAlign`, so the strokes are centred. A LINE that fills its auto
|
|
13
|
+
* layout parent becomes a Taco line instead (`lineWhereItFills`).
|
|
14
|
+
*/
|
|
15
|
+
export const convertLine = (node, walk) => {
|
|
16
|
+
const where = `node ${node.id}`;
|
|
17
|
+
const transform = pathTransform(node, walk);
|
|
18
|
+
if (transform === null)
|
|
19
|
+
return null;
|
|
20
|
+
const size = field(node.change, "size", "object", where);
|
|
21
|
+
const length = size && field(size, "x", "number", `${where} size`);
|
|
22
|
+
if (length === undefined) {
|
|
23
|
+
walk.report("node-left-out", "the node has no length");
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const start = vectorVertexId("v0"), end = vectorVertexId("v1");
|
|
27
|
+
const network = {
|
|
28
|
+
vertices: [{ id: start, x: 0, y: 0 }, { id: end, x: length, y: 0 }],
|
|
29
|
+
segments: [{ id: vectorSegmentId("s0"), kind: "line", start, end }],
|
|
30
|
+
regions: [],
|
|
31
|
+
};
|
|
32
|
+
const base = layerBase(node, walk, "Line", true);
|
|
33
|
+
const { strokes: aligned, cap } = pathStrokes(node, walk, getVectorNetworkBounds(network) ?? undefined);
|
|
34
|
+
const strokes = aligned.map((stroke) => ({ ...stroke, position: "center" }));
|
|
35
|
+
const path = {
|
|
36
|
+
...base, type: "shape", shape: "path", vectorNetwork: network, transform,
|
|
37
|
+
style: { ...(strokes.length > 0 ? { strokes } : {}), ...nodeEffects(node, walk) }, startCap: cap, endCap: cap,
|
|
38
|
+
};
|
|
39
|
+
return lineWhereItFills(path, node.change);
|
|
40
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { drawnAsPlainRectangle, nodeEffects } from "./effects.js";
|
|
2
|
+
import { framedBase, visualStyle } from "./shared.js";
|
|
3
|
+
/** A Figma ROUNDED_RECTANGLE (the Rectangle tool's node) as a Taco rectangle. */
|
|
4
|
+
export const convertRectangle = (node, walk) => {
|
|
5
|
+
const base = framedBase(node, walk, "Rectangle", true);
|
|
6
|
+
if (base === null)
|
|
7
|
+
return null;
|
|
8
|
+
const visual = visualStyle(node, walk);
|
|
9
|
+
const rectangle = { ...base, type: "shape", shape: "rectangle", style: { ...visual, ...nodeEffects(node, walk, drawnAsPlainRectangle(visual, false)) } };
|
|
10
|
+
return rectangle;
|
|
11
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FigmaNodeConverter } from "../walk.ts";
|
|
2
|
+
/**
|
|
3
|
+
* A Figma SECTION as a Taco frame with free layout. Sections never clip
|
|
4
|
+
* their content in Figma, so `clipContent` is false and `frameMaskDisabled`
|
|
5
|
+
* is ignored. Fields only a section has are
|
|
6
|
+
* reported: `sectionContentsHidden` (the contents are collapsed in Figma)
|
|
7
|
+
* and `devStatus` (the "ready for dev" mark), unless it says `NONE`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const convertSection: FigmaNodeConverter;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { field, isObject } from "../fields.js";
|
|
2
|
+
import { drawnAsPlainRectangle, nodeEffects } from "./effects.js";
|
|
3
|
+
import { framedBase, visualStyle } from "./shared.js";
|
|
4
|
+
/**
|
|
5
|
+
* A Figma SECTION as a Taco frame with free layout. Sections never clip
|
|
6
|
+
* their content in Figma, so `clipContent` is false and `frameMaskDisabled`
|
|
7
|
+
* is ignored. Fields only a section has are
|
|
8
|
+
* reported: `sectionContentsHidden` (the contents are collapsed in Figma)
|
|
9
|
+
* and `devStatus` (the "ready for dev" mark), unless it says `NONE`.
|
|
10
|
+
*/
|
|
11
|
+
export const convertSection = (node, walk) => {
|
|
12
|
+
const where = `node ${node.id}`;
|
|
13
|
+
if (field(node.change, "sectionContentsHidden", "boolean", where) === true) {
|
|
14
|
+
walk.report("property-left-out", "sectionContentsHidden is not imported; the contents are shown");
|
|
15
|
+
}
|
|
16
|
+
const devStatus = node.change["devStatus"];
|
|
17
|
+
const devType = isObject(devStatus) ? field(devStatus, "type", "string", `${where} devStatus`) : undefined;
|
|
18
|
+
if (devStatus !== undefined && devType !== "NONE") {
|
|
19
|
+
walk.report("property-left-out", `devStatus${devType === undefined ? "" : ` ${devType}`} is not imported`);
|
|
20
|
+
}
|
|
21
|
+
const base = framedBase(node, walk, "Section", true);
|
|
22
|
+
if (base === null)
|
|
23
|
+
return null;
|
|
24
|
+
const visual = visualStyle(node, walk);
|
|
25
|
+
const style = { ...visual, ...nodeEffects(node, walk, drawnAsPlainRectangle(visual, true)) };
|
|
26
|
+
const frame = {
|
|
27
|
+
...base,
|
|
28
|
+
type: "frame",
|
|
29
|
+
children: walk.convertChildren(),
|
|
30
|
+
layout: { kind: "absolute" },
|
|
31
|
+
clipContent: false,
|
|
32
|
+
...(Object.keys(style).length > 0 ? { style } : {}),
|
|
33
|
+
};
|
|
34
|
+
return frame;
|
|
35
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type BlendMode, type FramedNodeBase, type NodeBase, type Paint, type DashCap, type ResizeConstraints, type Stroke, type VisualStyle } from "../../../model/index.ts";
|
|
2
|
+
import { type FigmaObject } from "../fields.ts";
|
|
3
|
+
import { type Box } from "./gradient.ts";
|
|
4
|
+
import type { FigmaTreeNode } from "../tree.ts";
|
|
5
|
+
import type { NodeWalk } from "../walk.ts";
|
|
6
|
+
/**
|
|
7
|
+
* A Figma blend mode enum name as a Taco blend mode: `undefined` for
|
|
8
|
+
* `NORMAL` and `PASS_THROUGH` (Taco's default), `null` when Taco has no such
|
|
9
|
+
* mode (`LINEAR_BURN`, `LINEAR_DODGE`).
|
|
10
|
+
*/
|
|
11
|
+
export declare function blendModeOf(value: string): BlendMode | undefined | null;
|
|
12
|
+
export declare function readNumbers<K extends string>(object: FigmaObject, keys: readonly K[], where: string): Record<K, number> | null;
|
|
13
|
+
/** `#rrggbb`, or `#rrggbbaa` when alpha is below 1, from Figma's 0..1 channels. */
|
|
14
|
+
export declare function hexColor(color: Record<"r" | "g" | "b" | "a", number>): string;
|
|
15
|
+
/**
|
|
16
|
+
* The fields every Taco layer shares (id, name, visibility, lock, opacity and
|
|
17
|
+
* blend mode, the mask flag, the aspect ratio lock and resize constraints, see `constraintsOf`).
|
|
18
|
+
* Reports a blend mode Taco lacks, a mask that is not an alpha mask and, unless the
|
|
19
|
+
* caller imports them (`effectsImported`), effects, which are not imported yet.
|
|
20
|
+
*/
|
|
21
|
+
export declare function layerBase(node: FigmaTreeNode, walk: NodeWalk, defaultName: string, effectsImported?: boolean): NodeBase;
|
|
22
|
+
/**
|
|
23
|
+
* Figma's `horizontalConstraint` and `verticalConstraint` as Taco
|
|
24
|
+
* `constraints`, or `undefined` when both are MIN (or absent), Taco's
|
|
25
|
+
* default. A value Taco has no match for (such as FIXED_MIN) is reported and
|
|
26
|
+
* read as MIN. They are taken off again where they do not apply: from a
|
|
27
|
+
* group by `convertGroup`, from a child in an auto layout flow by
|
|
28
|
+
* `stackChildFields`, and from a layer in a section (directly or through
|
|
29
|
+
* groups) by the walk, as Figma applies none when a section is resized.
|
|
30
|
+
*/
|
|
31
|
+
export declare function constraintsOf(change: FigmaObject, report: NodeWalk["report"]): ResizeConstraints | undefined;
|
|
32
|
+
/** A node's size and transform numbers, or `null` when either is incomplete, so `framedBase` leaves the node out. */
|
|
33
|
+
export declare function frameGeometry(node: FigmaTreeNode): {
|
|
34
|
+
sides: Record<"x" | "y", number>;
|
|
35
|
+
m: Record<"m00" | "m01" | "m02" | "m10" | "m11" | "m12", number>;
|
|
36
|
+
} | null;
|
|
37
|
+
/**
|
|
38
|
+
* The fields every framed Taco node shares, or `null` after reporting why
|
|
39
|
+
* the node is left out. Figma's `transform` maps the node's local space to
|
|
40
|
+
* its parent's (x' = m00 x + m01 y + m02, y' = m10 x + m11 y + m12); Taco
|
|
41
|
+
* keeps the unrotated frame plus a rotation about its center, clockwise in
|
|
42
|
+
* degrees, and a horizontal flip when the matrix mirrors.
|
|
43
|
+
*/
|
|
44
|
+
export declare function framedBase(node: FigmaTreeNode, walk: NodeWalk, defaultName: string, effectsImported?: boolean): FramedNodeBase | null;
|
|
45
|
+
/**
|
|
46
|
+
* The solid, gradient and image paints of the node's `fillPaints` or `strokePaints`
|
|
47
|
+
* list, named `fill` or `stroke` in report entries; other paint types are
|
|
48
|
+
* reported and left out. A node that names a fill or stroke style takes the
|
|
49
|
+
* style's paints (`styleBackedList`). `node` may also be a style override entry, with `id`
|
|
50
|
+
* saying where it is; its `change` must then carry the node's `size` for gradients.
|
|
51
|
+
* Figma places a gradient on the node's box (`size`); `box`, in node pixels,
|
|
52
|
+
* is the box the renderer places it on instead when that differs, such as a
|
|
53
|
+
* vector region's bounds.
|
|
54
|
+
*/
|
|
55
|
+
export declare function nodePaints(node: Pick<FigmaTreeNode, "id" | "change">, walk: NodeWalk, list: "fillPaints" | "strokePaints", box?: Box): Paint[];
|
|
56
|
+
/** Figma's `strokeCap` names Taco has, as path ends and dash ends alike. */
|
|
57
|
+
export declare const STROKE_CAPS: Readonly<Record<string, DashCap>>;
|
|
58
|
+
/**
|
|
59
|
+
* Stroke paints with the node's weight, alignment, join, miter limit and
|
|
60
|
+
* dashes, gradients placed on `box` (the node's box when left out). Kiwi
|
|
61
|
+
* leaves out an enum field at its first value, so an absent `strokeAlign` is
|
|
62
|
+
* CENTER, an absent `strokeJoin` MITER and an absent `strokeCap` NONE.
|
|
63
|
+
* `sides` reads Figma's separate side weights, which only rectangles and
|
|
64
|
+
* frames have. A dashed stroke's dash ends follow `strokeCap`, as in Figma.
|
|
65
|
+
*/
|
|
66
|
+
export declare function nodeStrokes(node: FigmaTreeNode, walk: NodeWalk, box?: Box, sides?: boolean): Stroke[];
|
|
67
|
+
/** Solid, gradient and image fills and strokes and corners as a Taco style; other paint types are reported and left out. */
|
|
68
|
+
export declare function visualStyle(node: FigmaTreeNode, walk: NodeWalk): VisualStyle;
|