@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,242 @@
|
|
|
1
|
+
import { type ExpressionEnvironment } from "./expressions/check.ts";
|
|
2
|
+
import type { ExpressionValueEnvironment } from "./expressions/evaluate.ts";
|
|
3
|
+
import { type ExpressionEnumType, type ExpressionType } from "./expressions/types.ts";
|
|
4
|
+
import { type ExpressionValue } from "./expressions/values.ts";
|
|
5
|
+
import type { DocumentOperation } from "./operations.ts";
|
|
6
|
+
import { type ComponentDefinition, type ComponentId, type ComponentPropertyDefinition, type ComponentPropertyValue, type ComponentPropertyValues, type ComputableField, type DesignDocument, type DocumentTheme, type NodeId, type SceneNode, type VariableCollectionId, type VariableDefinition, type VariableId, type VariableModes, type VariableProperty, type ValuedComponentPropertyDefinition } from "./types.ts";
|
|
7
|
+
import { type LocatedVariable } from "./variables.ts";
|
|
8
|
+
/**
|
|
9
|
+
* The binding properties that hold a length in pixels. A `number` variable
|
|
10
|
+
* whose scopes are all in this list reads as a `length` in expressions.
|
|
11
|
+
* @since 0.24.0
|
|
12
|
+
*/
|
|
13
|
+
export declare const LENGTH_VARIABLE_PROPERTIES: readonly VariableProperty[];
|
|
14
|
+
/**
|
|
15
|
+
* The type a variable reads as in expressions. Colour, string and boolean
|
|
16
|
+
* variables read as `color`, `string` and `boolean`. A `number` variable
|
|
17
|
+
* reads as a `length` (pixels) when it has scopes and every scope is a
|
|
18
|
+
* length (`LENGTH_VARIABLE_PROPERTIES`), and as a plain `number` otherwise:
|
|
19
|
+
* with no scopes, or any scope such as opacity, font weight or line height.
|
|
20
|
+
* @since 0.24.0
|
|
21
|
+
*/
|
|
22
|
+
export declare function variableExpressionType(variable: VariableDefinition): ExpressionType;
|
|
23
|
+
/**
|
|
24
|
+
* The name an expression reads a variable by: `"Collection/Name"`.
|
|
25
|
+
* @since 0.24.0
|
|
26
|
+
*/
|
|
27
|
+
export declare function variableExpressionName(collectionName: string, variableName: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* The document's variables by `"Collection/Name"`. A name that two
|
|
30
|
+
* variables share is left out, so an expression that uses it shows an
|
|
31
|
+
* unknown-variable error instead of reading either one.
|
|
32
|
+
* @since 0.24.0
|
|
33
|
+
*/
|
|
34
|
+
export declare function variablesByExpressionName(theme: DocumentTheme): ReadonlyMap<string, LocatedVariable>;
|
|
35
|
+
/**
|
|
36
|
+
* The value of a variable in the mode its collection shows under `modes`
|
|
37
|
+
* (see `resolveVariableValue`; without `modes`, the active mode), typed as
|
|
38
|
+
* `variableExpressionType`.
|
|
39
|
+
* @since 0.24.0
|
|
40
|
+
*/
|
|
41
|
+
export declare function variableExpressionValue(located: LocatedVariable, modes?: VariableModes): ExpressionValue | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* The type a property reads as: `boolean`, `string` (text), `color`,
|
|
44
|
+
* `component` (instance swap), an enum type named `enumName` (the property
|
|
45
|
+
* name by default) with the option names, or for a number property
|
|
46
|
+
* `number`, `length`, `percent` or `angle` by its unit.
|
|
47
|
+
* @since 0.24.0
|
|
48
|
+
*/
|
|
49
|
+
export declare function componentPropertyExpressionType(property: ValuedComponentPropertyDefinition, enumName?: string): ExpressionType;
|
|
50
|
+
/**
|
|
51
|
+
* The enum type name of a nested component's property, as an outer
|
|
52
|
+
* component's expressions see it: `"<component name>.<property name>"`. A
|
|
53
|
+
* property name has no dot, so it never clashes with the outer component's
|
|
54
|
+
* own enum types, which are named after their properties.
|
|
55
|
+
* @since 0.24.0
|
|
56
|
+
*/
|
|
57
|
+
export declare function nestedPropertyEnumName(component: ComponentDefinition, property: ComponentPropertyDefinition): string;
|
|
58
|
+
/**
|
|
59
|
+
* The expression value of a property: `value` when it fits the property's
|
|
60
|
+
* kind, else the default. An enum value reads as its option's name.
|
|
61
|
+
* @since 0.24.0
|
|
62
|
+
*/
|
|
63
|
+
export declare function componentPropertyExpressionValue(property: ValuedComponentPropertyDefinition, value?: ComponentPropertyValue): ExpressionValue;
|
|
64
|
+
/**
|
|
65
|
+
* The checking environment of a component's expressions: its properties by
|
|
66
|
+
* name, the document's variables by `"Collection/Name"`, and `storedType`
|
|
67
|
+
* for `stored` (leave it out for a condition).
|
|
68
|
+
* @since 0.24.0
|
|
69
|
+
*/
|
|
70
|
+
export declare function componentExpressionEnvironment(document: DesignDocument, component: ComponentDefinition | ComponentId, storedType?: ExpressionType): ExpressionEnvironment;
|
|
71
|
+
/**
|
|
72
|
+
* The evaluation environment matching `componentExpressionEnvironment`: each
|
|
73
|
+
* property's value from `propertyValues` (an instance's values; values that
|
|
74
|
+
* do not fit and missing ones read as the default), each variable in the
|
|
75
|
+
* mode its collection shows under `modes` (the active mode by default), and
|
|
76
|
+
* `stored`.
|
|
77
|
+
* @since 0.24.0
|
|
78
|
+
*/
|
|
79
|
+
export declare function componentValueEnvironment(document: DesignDocument, component: ComponentDefinition | ComponentId, propertyValues?: ComponentPropertyValues, stored?: ExpressionValue, modes?: VariableModes): ExpressionValueEnvironment;
|
|
80
|
+
/** The enum type of the `direction` field. @since 0.24.0 */
|
|
81
|
+
export declare const LAYOUT_DIRECTION_TYPE: ExpressionEnumType;
|
|
82
|
+
/** The enum type of the `align` field. @since 0.24.0 */
|
|
83
|
+
export declare const LAYOUT_ALIGN_TYPE: ExpressionEnumType;
|
|
84
|
+
/**
|
|
85
|
+
* The enum type of the `justify` field; `space_between` and the others are
|
|
86
|
+
* the model's `"space-between"` and so on.
|
|
87
|
+
* @since 0.24.0
|
|
88
|
+
*/
|
|
89
|
+
export declare const LAYOUT_JUSTIFY_TYPE: ExpressionEnumType;
|
|
90
|
+
/** A computed field, or `"condition"`. @since 0.24.0 */
|
|
91
|
+
export type ExpressionField = ComputableField | "condition";
|
|
92
|
+
/**
|
|
93
|
+
* The type an expression in `field` must have: `boolean` for a condition,
|
|
94
|
+
* the field's type from the table in design 8.3, or for
|
|
95
|
+
* `propertyValues.<id>` the type of that property of the nested instance's
|
|
96
|
+
* component (with its enum named by `nestedPropertyEnumName`). Undefined
|
|
97
|
+
* for a field the node cannot compute or a property the nested component
|
|
98
|
+
* does not have.
|
|
99
|
+
* @since 0.24.0
|
|
100
|
+
*/
|
|
101
|
+
export declare function computableFieldType(document: DesignDocument, node: SceneNode, field: ExpressionField): ExpressionType | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* The base value of a computed field, which `stored` reads: the plain value
|
|
104
|
+
* stored on the node, as an expression value. Absent optional values read
|
|
105
|
+
* as zero (for example a missing `maxWidth` is 0 px, a missing corner
|
|
106
|
+
* radius 0 px). The text fields read the first run's resolved style. Line
|
|
107
|
+
* height, stored as a multiplier of the font size, reads as a percent (1.5
|
|
108
|
+
* is 150%); inside a `text_style` it reads as a length in pixels, the
|
|
109
|
+
* multiplier times the font size (1.5 at 16 px is 24 px). A nested
|
|
110
|
+
* instance's `propertyValues.<id>` reads the value stored on the node, else
|
|
111
|
+
* the nested component's default. Undefined for a condition, for fields
|
|
112
|
+
* `computableFieldType` does not type, and for a `propertyValues.<id>` on a
|
|
113
|
+
* layer that is not an instance or whose component has no such property.
|
|
114
|
+
* @since 0.24.0
|
|
115
|
+
*/
|
|
116
|
+
export declare function storedFieldValue(document: DesignDocument, node: SceneNode, field: ExpressionField): ExpressionValue | undefined;
|
|
117
|
+
/** What checking one computed field or condition needs. @since 0.24.0 */
|
|
118
|
+
export interface ExpressionFieldContext {
|
|
119
|
+
readonly expected: ExpressionType;
|
|
120
|
+
readonly environment: ExpressionEnvironment;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* The expected type and checking environment of one field of a layer in
|
|
124
|
+
* `component`, or undefined when the field has no type (see
|
|
125
|
+
* `computableFieldType`).
|
|
126
|
+
* @since 0.24.0
|
|
127
|
+
*/
|
|
128
|
+
export declare function expressionFieldContext(document: DesignDocument, component: ComponentDefinition | ComponentId, node: SceneNode, field: ExpressionField): ExpressionFieldContext | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* The evaluation environment of one field of a layer in `component` for an
|
|
131
|
+
* instance with `propertyValues`: `componentValueEnvironment` with `stored`
|
|
132
|
+
* set to `storedFieldValue`.
|
|
133
|
+
* @since 0.24.0
|
|
134
|
+
*/
|
|
135
|
+
export declare function expressionFieldValueEnvironment(document: DesignDocument, component: ComponentDefinition | ComponentId, node: SceneNode, field: ExpressionField, propertyValues?: ComponentPropertyValues, modes?: VariableModes): ExpressionValueEnvironment;
|
|
136
|
+
/** One stored expression: a computed field or a condition of a layer. @since 0.24.0 */
|
|
137
|
+
export interface ComponentExpressionSite {
|
|
138
|
+
readonly nodeId: NodeId;
|
|
139
|
+
readonly field: ExpressionField;
|
|
140
|
+
readonly source: string;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* The IDs of a component's layers, root first, in tree order.
|
|
144
|
+
* @since 0.24.0
|
|
145
|
+
*/
|
|
146
|
+
export declare function componentLayerIds(document: DesignDocument, component: ComponentDefinition | ComponentId): readonly NodeId[];
|
|
147
|
+
/**
|
|
148
|
+
* Every expression and condition stored on a component's layers, in tree
|
|
149
|
+
* order, conditions after the node's computed fields.
|
|
150
|
+
* @since 0.24.0
|
|
151
|
+
*/
|
|
152
|
+
export declare function componentExpressionSites(document: DesignDocument, component: ComponentDefinition | ComponentId): readonly ComponentExpressionSite[];
|
|
153
|
+
/**
|
|
154
|
+
* How many of `component`'s expressions and conditions name the property
|
|
155
|
+
* (or, with `optionId`, that option of an enum property), plus the
|
|
156
|
+
* `propertyValues.<id>` expressions of nested instances of it in other
|
|
157
|
+
* components that name the option. The editor shows it before a deletion
|
|
158
|
+
* or a kind change ("3 expressions use size").
|
|
159
|
+
* @since 0.24.0
|
|
160
|
+
*/
|
|
161
|
+
export declare function componentPropertyUsage(document: DesignDocument, componentId: ComponentId, propertyId: string, optionId?: string): number;
|
|
162
|
+
/** Operations for one edit, and how many expressions it touches. @since 0.24.0 */
|
|
163
|
+
export interface ExpressionEditResult {
|
|
164
|
+
/** Apply them together, in one `applyOperations` call. */
|
|
165
|
+
readonly operations: readonly DocumentOperation[];
|
|
166
|
+
/**
|
|
167
|
+
* For a rename, how many references were rewritten; for a deletion or a
|
|
168
|
+
* kind change, how many expressions use what changed and will stop
|
|
169
|
+
* checking (see `componentPropertyUsage`).
|
|
170
|
+
*/
|
|
171
|
+
readonly count: number;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Renames a property and rewrites every expression in the component that
|
|
175
|
+
* reads it, in one edit. Throws a `ModelError` when the name is not an
|
|
176
|
+
* identifier or another property has it.
|
|
177
|
+
* @since 0.24.0
|
|
178
|
+
*/
|
|
179
|
+
export declare function renameComponentPropertyOperations(document: DesignDocument, componentId: ComponentId, propertyId: string, written: string): ExpressionEditResult;
|
|
180
|
+
/**
|
|
181
|
+
* Renames an option of an enum property and rewrites every expression that
|
|
182
|
+
* names it: in the component, and in `propertyValues.<id>` expressions of
|
|
183
|
+
* nested instances of the component inside other components. Option IDs
|
|
184
|
+
* do not change, so instance values need no edit.
|
|
185
|
+
* @since 0.24.0
|
|
186
|
+
*/
|
|
187
|
+
export declare function renameComponentPropertyOptionOperations(document: DesignDocument, componentId: ComponentId, propertyId: string, optionId: string, written: string): ExpressionEditResult;
|
|
188
|
+
/**
|
|
189
|
+
* The operations that drop, from every instance of `componentId` and every
|
|
190
|
+
* override of a nested instance of it, the values that `properties`, the
|
|
191
|
+
* component's properties after an edit, no longer take: each value of a
|
|
192
|
+
* property it leaves out, and each value that does not fit a property's
|
|
193
|
+
* new definition (`propertyValueFits`), so that the instance takes the
|
|
194
|
+
* default. Empty when there is nothing to drop; the definition itself is
|
|
195
|
+
* not written.
|
|
196
|
+
* @since 0.32.0
|
|
197
|
+
*/
|
|
198
|
+
export declare function propertyValueDropOperations(document: DesignDocument, componentId: ComponentId, properties: readonly ComponentPropertyDefinition[]): DocumentOperation[];
|
|
199
|
+
/**
|
|
200
|
+
* Deletes a property. In the same edit it removes every instance's value
|
|
201
|
+
* for it (instance nodes and nested instance overrides) and the
|
|
202
|
+
* `propertyValues.<id>` expressions of nested instances of the component.
|
|
203
|
+
* Expressions that read the property are kept and stop checking, so they
|
|
204
|
+
* fall back to the stored value; `count` says how many there are.
|
|
205
|
+
* @since 0.24.0
|
|
206
|
+
*/
|
|
207
|
+
export declare function deleteComponentPropertyOperations(document: DesignDocument, componentId: ComponentId, propertyId: string): ExpressionEditResult;
|
|
208
|
+
/**
|
|
209
|
+
* Deletes one option of an enum property. Instance values that chose it are
|
|
210
|
+
* removed in the same edit, so those instances take the default; when the
|
|
211
|
+
* option was the default, the first remaining option becomes the default.
|
|
212
|
+
* Expressions that name the option are kept and stop checking; `count` says
|
|
213
|
+
* how many. Throws a `ModelError` for the last option.
|
|
214
|
+
* @since 0.24.0
|
|
215
|
+
*/
|
|
216
|
+
export declare function deleteComponentPropertyOptionOperations(document: DesignDocument, componentId: ComponentId, propertyId: string, optionId: string): ExpressionEditResult;
|
|
217
|
+
/**
|
|
218
|
+
* Replaces a property's definition with one of another kind (or the same
|
|
219
|
+
* kind with other settings), keeping its ID and name; rename with
|
|
220
|
+
* `renameComponentPropertyOperations`. Instance values that do not fit the
|
|
221
|
+
* new definition are removed in the same edit. Expressions that read the
|
|
222
|
+
* property, and `propertyValues.<id>` expressions of nested instances of
|
|
223
|
+
* the component, are kept and may stop checking; `count` is how many there
|
|
224
|
+
* are (0 when the kind is unchanged and so are a number's unit and an
|
|
225
|
+
* enum's option names: a new option makes a `match` non-exhaustive and a
|
|
226
|
+
* removed one leaves references unresolved). Throws a `ModelError` when a
|
|
227
|
+
* number property's minimum is above its maximum.
|
|
228
|
+
* @since 0.24.0
|
|
229
|
+
*/
|
|
230
|
+
export declare function changeComponentPropertyOperations(document: DesignDocument, componentId: ComponentId, next: ComponentPropertyDefinition): ExpressionEditResult;
|
|
231
|
+
/**
|
|
232
|
+
* Renames a variable and rewrites every `var("Collection/Name")` that reads
|
|
233
|
+
* it, in every component, in one edit.
|
|
234
|
+
* @since 0.24.0
|
|
235
|
+
*/
|
|
236
|
+
export declare function renameVariableOperations(document: DesignDocument, variableId: VariableId, name: string): ExpressionEditResult;
|
|
237
|
+
/**
|
|
238
|
+
* Renames a variable collection and rewrites every `var("Collection/Name")`
|
|
239
|
+
* that reads one of its variables, in every component, in one edit.
|
|
240
|
+
* @since 0.24.0
|
|
241
|
+
*/
|
|
242
|
+
export declare function renameVariableCollectionOperations(document: DesignDocument, collectionId: VariableCollectionId, name: string): ExpressionEditResult;
|