@open-pencil/scene-graph 0.16.0 → 0.17.0-beta.2
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/dist/arrow-caps.d.ts +35 -14
- package/dist/arrow-caps.d.ts.map +1 -1
- package/dist/arrow-caps.js +286 -55
- package/dist/arrow-caps.js.map +1 -1
- package/dist/asset-keys.d.ts +17 -0
- package/dist/asset-keys.d.ts.map +1 -0
- package/dist/asset-keys.js.map +1 -0
- package/dist/behaviours/index.d.ts +6 -0
- package/dist/behaviours/index.js +6 -0
- package/dist/behaviours/kinds.d.ts +62 -0
- package/dist/behaviours/kinds.d.ts.map +1 -0
- package/dist/{chunks/behaviours → behaviours}/kinds.js +76 -75
- package/dist/behaviours/kinds.js.map +1 -0
- package/dist/behaviours/layers.d.ts +16 -0
- package/dist/behaviours/layers.d.ts.map +1 -0
- package/dist/behaviours/layers.js +43 -0
- package/dist/behaviours/layers.js.map +1 -0
- package/dist/behaviours/model.d.ts +48 -0
- package/dist/behaviours/model.d.ts.map +1 -0
- package/dist/behaviours/model.js +156 -0
- package/dist/behaviours/model.js.map +1 -0
- package/dist/behaviours/schema.d.ts +228 -0
- package/dist/behaviours/schema.d.ts.map +1 -0
- package/dist/behaviours/schema.js +86 -0
- package/dist/behaviours/schema.js.map +1 -0
- package/dist/behaviours/spec.d.ts +26 -0
- package/dist/behaviours/spec.d.ts.map +1 -0
- package/dist/{chunks/behaviours → behaviours}/spec.js +6 -29
- package/dist/behaviours/spec.js.map +1 -0
- package/dist/bindings.js +26 -0
- package/dist/bindings.js.map +1 -0
- package/dist/buffered-events.d.ts +21 -0
- package/dist/buffered-events.d.ts.map +1 -0
- package/dist/buffered-events.js.map +1 -0
- package/dist/checkpoint.d.ts +42 -0
- package/dist/checkpoint.d.ts.map +1 -0
- package/dist/checkpoint.js +249 -0
- package/dist/checkpoint.js.map +1 -0
- package/dist/clipping.d.ts +31 -0
- package/dist/clipping.d.ts.map +1 -0
- package/dist/clipping.js +125 -0
- package/dist/clipping.js.map +1 -0
- package/dist/color/contrast.d.ts +17 -0
- package/dist/color/contrast.d.ts.map +1 -0
- package/dist/{chunks/color → color}/contrast.js +2 -24
- package/dist/color/contrast.js.map +1 -0
- package/dist/color/index.d.ts +38 -0
- package/dist/color/index.d.ts.map +1 -0
- package/dist/color/index.js +110 -0
- package/dist/color/index.js.map +1 -0
- package/dist/color/management.d.ts +32 -0
- package/dist/color/management.d.ts.map +1 -0
- package/dist/color/management.js +187 -0
- package/dist/color/management.js.map +1 -0
- package/dist/color/normalize.d.ts +6 -0
- package/dist/color/normalize.d.ts.map +1 -0
- package/dist/color/normalize.js +15 -0
- package/dist/color/normalize.js.map +1 -0
- package/dist/color/okhcl.d.ts +33 -0
- package/dist/color/okhcl.d.ts.map +1 -0
- package/dist/color/okhcl.js +146 -0
- package/dist/color/okhcl.js.map +1 -0
- package/dist/color/schema.d.ts +11 -0
- package/dist/color/schema.d.ts.map +1 -0
- package/dist/color/schema.js +13 -0
- package/dist/color/schema.js.map +1 -0
- package/dist/comments/document.d.ts +23 -0
- package/dist/comments/document.d.ts.map +1 -0
- package/dist/{chunks/comments → comments}/document.js +2 -1
- package/dist/comments/document.js.map +1 -0
- package/dist/comments/index.d.ts +6 -0
- package/dist/comments/index.js +6 -0
- package/dist/comments/list.d.ts +25 -0
- package/dist/comments/list.d.ts.map +1 -0
- package/dist/comments/list.js +33 -0
- package/dist/comments/list.js.map +1 -0
- package/dist/comments/merge.d.ts +16 -0
- package/dist/comments/merge.d.ts.map +1 -0
- package/dist/{chunks/comments → comments}/merge.js +1 -1
- package/dist/comments/merge.js.map +1 -0
- package/dist/comments/schema.d.ts +8 -0
- package/dist/comments/schema.d.ts.map +1 -0
- package/dist/comments/schema.js +50 -0
- package/dist/comments/schema.js.map +1 -0
- package/dist/comments/threads.d.ts +59 -0
- package/dist/comments/threads.d.ts.map +1 -0
- package/dist/{chunks/comments/list.js → comments/threads.js} +3 -53
- package/dist/comments/threads.js.map +1 -0
- package/dist/components/exposure.d.ts +24 -0
- package/dist/components/exposure.d.ts.map +1 -0
- package/dist/components/exposure.js +51 -0
- package/dist/components/exposure.js.map +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +4 -0
- package/dist/components/properties.d.ts +32 -0
- package/dist/components/properties.d.ts.map +1 -0
- package/dist/components/properties.js +180 -0
- package/dist/components/properties.js.map +1 -0
- package/dist/components/variants.d.ts +33 -0
- package/dist/components/variants.d.ts.map +1 -0
- package/dist/components/variants.js +58 -0
- package/dist/components/variants.js.map +1 -0
- package/dist/connectors/controls.d.ts +34 -0
- package/dist/connectors/controls.d.ts.map +1 -0
- package/dist/connectors/controls.js +196 -0
- package/dist/connectors/controls.js.map +1 -0
- package/dist/connectors/create.d.ts +23 -0
- package/dist/connectors/create.d.ts.map +1 -0
- package/dist/connectors/create.js +33 -0
- package/dist/connectors/create.js.map +1 -0
- package/dist/connectors/elbow.js +191 -0
- package/dist/connectors/elbow.js.map +1 -0
- package/dist/connectors/gaps.d.ts +10 -0
- package/dist/connectors/gaps.d.ts.map +1 -0
- package/dist/connectors/gaps.js +86 -0
- package/dist/connectors/gaps.js.map +1 -0
- package/dist/connectors/hit.d.ts +11 -0
- package/dist/connectors/hit.d.ts.map +1 -0
- package/dist/connectors/hit.js +47 -0
- package/dist/connectors/hit.js.map +1 -0
- package/dist/connectors/index.d.ts +11 -0
- package/dist/connectors/index.js +11 -0
- package/dist/connectors/label.d.ts +32 -0
- package/dist/connectors/label.d.ts.map +1 -0
- package/dist/connectors/label.js +213 -0
- package/dist/connectors/label.js.map +1 -0
- package/dist/connectors/layout.d.ts +46 -0
- package/dist/connectors/layout.d.ts.map +1 -0
- package/dist/connectors/layout.js +234 -0
- package/dist/connectors/layout.js.map +1 -0
- package/dist/connectors/pieces.d.ts +22 -0
- package/dist/connectors/pieces.d.ts.map +1 -0
- package/dist/connectors/pieces.js +156 -0
- package/dist/connectors/pieces.js.map +1 -0
- package/dist/connectors/route.d.ts +23 -0
- package/dist/connectors/route.d.ts.map +1 -0
- package/dist/connectors/route.js +107 -0
- package/dist/connectors/route.js.map +1 -0
- package/dist/connectors/sides.d.ts +23 -0
- package/dist/connectors/sides.d.ts.map +1 -0
- package/dist/connectors/sides.js +98 -0
- package/dist/connectors/sides.js.map +1 -0
- package/dist/connectors/sublayers.d.ts +76 -0
- package/dist/connectors/sublayers.d.ts.map +1 -0
- package/dist/connectors/sublayers.js +208 -0
- package/dist/connectors/sublayers.js.map +1 -0
- package/dist/constants.d.ts +11 -2
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +25 -1
- package/dist/constants.js.map +1 -0
- package/dist/coordinate.d.ts +94 -2
- package/dist/coordinate.d.ts.map +1 -0
- package/dist/coordinate.js +268 -1
- package/dist/coordinate.js.map +1 -0
- package/dist/copy.d.ts +49 -2
- package/dist/copy.d.ts.map +1 -0
- package/dist/copy.js +264 -2
- package/dist/copy.js.map +1 -0
- package/dist/css/blend.d.ts +11 -0
- package/dist/css/blend.d.ts.map +1 -0
- package/dist/css/blend.js +30 -0
- package/dist/css/blend.js.map +1 -0
- package/dist/css/grid.d.ts +7 -0
- package/dist/css/grid.d.ts.map +1 -0
- package/dist/{chunks/css → css}/grid.js +2 -33
- package/dist/css/grid.js.map +1 -0
- package/dist/css/index.d.ts +7 -0
- package/dist/css/index.js +7 -0
- package/dist/css/layout.d.ts +17 -0
- package/dist/css/layout.d.ts.map +1 -0
- package/dist/css/layout.js +45 -0
- package/dist/css/layout.js.map +1 -0
- package/dist/css/shadows.d.ts +10 -0
- package/dist/css/shadows.d.ts.map +1 -0
- package/dist/css/shadows.js +64 -0
- package/dist/css/shadows.js.map +1 -0
- package/dist/css/text.d.ts +22 -0
- package/dist/css/text.d.ts.map +1 -0
- package/dist/css/text.js +76 -0
- package/dist/css/text.js.map +1 -0
- package/dist/css/values.d.ts +14 -0
- package/dist/css/values.d.ts.map +1 -0
- package/dist/css/values.js +36 -0
- package/dist/css/values.js.map +1 -0
- package/dist/cubic.d.ts +7 -0
- package/dist/cubic.d.ts.map +1 -0
- package/dist/cubic.js +17 -0
- package/dist/cubic.js.map +1 -0
- package/dist/events.js.map +1 -0
- package/dist/export-format.d.ts +25 -0
- package/dist/export-format.d.ts.map +1 -0
- package/dist/export-format.js +47 -0
- package/dist/export-format.js.map +1 -0
- package/dist/export-scale.d.ts +14 -0
- package/dist/export-scale.d.ts.map +1 -0
- package/dist/export-scale.js +19 -0
- package/dist/export-scale.js.map +1 -0
- package/dist/fields/appearance.d.ts +9 -0
- package/dist/fields/appearance.d.ts.map +1 -0
- package/dist/fields/appearance.js +36 -0
- package/dist/fields/appearance.js.map +1 -0
- package/dist/fields/geometry.d.ts +7 -0
- package/dist/fields/geometry.d.ts.map +1 -0
- package/dist/fields/geometry.js.map +1 -0
- package/dist/fields/index.d.ts +5 -0
- package/dist/fields/index.js +5 -0
- package/dist/fields/layout.d.ts +10 -0
- package/dist/fields/layout.d.ts.map +1 -0
- package/dist/fields/layout.js +49 -0
- package/dist/fields/layout.js.map +1 -0
- package/dist/fields/text.d.ts +11 -0
- package/dist/fields/text.d.ts.map +1 -0
- package/dist/fields/text.js +64 -0
- package/dist/fields/text.js.map +1 -0
- package/dist/fig-compression.d.ts +11 -0
- package/dist/fig-compression.d.ts.map +1 -0
- package/dist/fig-compression.js +15 -0
- package/dist/fig-compression.js.map +1 -0
- package/dist/figjam/index.d.ts +3 -0
- package/dist/figjam/index.js +3 -0
- package/dist/figjam/palette.d.ts +270 -0
- package/dist/figjam/palette.d.ts.map +1 -0
- package/dist/figjam/palette.js +439 -0
- package/dist/figjam/palette.js.map +1 -0
- package/dist/figjam/text.d.ts +70 -0
- package/dist/figjam/text.d.ts.map +1 -0
- package/dist/figjam/text.js +95 -0
- package/dist/figjam/text.js.map +1 -0
- package/dist/font-style.d.ts +46 -0
- package/dist/font-style.d.ts.map +1 -0
- package/dist/font-style.js +127 -0
- package/dist/font-style.js.map +1 -0
- package/dist/generated/index.d.ts +44 -0
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/index.js +58 -0
- package/dist/generated/index.js.map +1 -0
- package/dist/generated/kind.d.ts +27 -0
- package/dist/generated/kind.d.ts.map +1 -0
- package/dist/generated/shape-with-text.d.ts +43 -0
- package/dist/generated/shape-with-text.d.ts.map +1 -0
- package/dist/generated/shape-with-text.js +135 -0
- package/dist/generated/shape-with-text.js.map +1 -0
- package/dist/generated/sticky.d.ts +128 -0
- package/dist/generated/sticky.d.ts.map +1 -0
- package/dist/generated/sticky.js +233 -0
- package/dist/generated/sticky.js.map +1 -0
- package/dist/geometry.d.ts +89 -2
- package/dist/geometry.d.ts.map +1 -0
- package/dist/geometry.js +306 -2
- package/dist/geometry.js.map +1 -0
- package/dist/gradient.d.ts +9 -2
- package/dist/gradient.d.ts.map +1 -1
- package/dist/gradient.js +13 -1
- package/dist/gradient.js.map +1 -1
- package/dist/graph.d.ts +178 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +625 -0
- package/dist/graph.js.map +1 -0
- package/dist/group-bounds.d.ts +42 -0
- package/dist/group-bounds.d.ts.map +1 -0
- package/dist/{chunks/group-bounds.js → group-bounds.js} +56 -14
- package/dist/group-bounds.js.map +1 -0
- package/dist/guides.d.ts +21 -2
- package/dist/guides.d.ts.map +1 -0
- package/dist/guides.js +5 -1
- package/dist/guides.js.map +1 -1
- package/dist/hit-test.d.ts +48 -2
- package/dist/hit-test.d.ts.map +1 -0
- package/dist/hit-test.js +75 -57
- package/dist/hit-test.js.map +1 -1
- package/dist/icons/glyph.d.ts +22 -0
- package/dist/icons/glyph.d.ts.map +1 -0
- package/dist/{chunks/icons → icons}/glyph.js +2 -40
- package/dist/icons/glyph.js.map +1 -0
- package/dist/icons/index.d.ts +4 -0
- package/dist/icons/index.js +4 -0
- package/dist/icons/model.d.ts +29 -0
- package/dist/icons/model.d.ts.map +1 -0
- package/dist/icons/model.js +51 -0
- package/dist/icons/model.js.map +1 -0
- package/dist/icons/schema.d.ts +31 -0
- package/dist/icons/schema.d.ts.map +1 -0
- package/dist/icons/schema.js +28 -0
- package/dist/icons/schema.js.map +1 -0
- package/dist/ids.d.ts +12 -0
- package/dist/ids.d.ts.map +1 -0
- package/dist/ids.js +31 -0
- package/dist/ids.js.map +1 -0
- package/dist/images.d.ts +39 -2
- package/dist/images.d.ts.map +1 -0
- package/dist/images.js +67 -9
- package/dist/images.js.map +1 -1
- package/dist/index.d.ts +5 -7
- package/dist/index.js +5 -23
- package/dist/instances/assignments.js +89 -0
- package/dist/instances/assignments.js.map +1 -0
- package/dist/instances/content-size.js +60 -0
- package/dist/instances/content-size.js.map +1 -0
- package/dist/instances/copies.js +161 -0
- package/dist/instances/copies.js.map +1 -0
- package/dist/instances/cycles.d.ts +20 -0
- package/dist/instances/cycles.d.ts.map +1 -0
- package/dist/instances/cycles.js +53 -0
- package/dist/instances/cycles.js.map +1 -0
- package/dist/instances/fields.d.ts +18 -0
- package/dist/instances/fields.d.ts.map +1 -0
- package/dist/instances/fields.js +90 -0
- package/dist/instances/fields.js.map +1 -0
- package/dist/instances/index.d.ts +38 -0
- package/dist/instances/index.d.ts.map +1 -0
- package/dist/instances/index.js +180 -0
- package/dist/instances/index.js.map +1 -0
- package/dist/instances/kept-overrides.js +204 -0
- package/dist/instances/kept-overrides.js.map +1 -0
- package/dist/instances/main-component.d.ts +13 -0
- package/dist/instances/main-component.d.ts.map +1 -0
- package/dist/instances/main-component.js +50 -0
- package/dist/instances/main-component.js.map +1 -0
- package/dist/instances/overrides.d.ts +51 -0
- package/dist/instances/overrides.d.ts.map +1 -0
- package/dist/instances/overrides.js +158 -0
- package/dist/instances/overrides.js.map +1 -0
- package/dist/instances/placement.js +30 -0
- package/dist/instances/placement.js.map +1 -0
- package/dist/instances/source-walk.js +31 -0
- package/dist/instances/source-walk.js.map +1 -0
- package/dist/instances/swap.js +288 -0
- package/dist/instances/swap.js.map +1 -0
- package/dist/instances/sync.js +327 -0
- package/dist/instances/sync.js.map +1 -0
- package/dist/instances/vector-geometry.js +70 -0
- package/dist/instances/vector-geometry.js.map +1 -0
- package/dist/layout/aspect-ratio.d.ts +27 -0
- package/dist/layout/aspect-ratio.d.ts.map +1 -0
- package/dist/layout/aspect-ratio.js +45 -0
- package/dist/layout/aspect-ratio.js.map +1 -0
- package/dist/layout/guides.d.ts +25 -0
- package/dist/layout/guides.d.ts.map +1 -0
- package/dist/layout/guides.js +105 -0
- package/dist/layout/guides.js.map +1 -0
- package/dist/layout/index.d.ts +5 -0
- package/dist/{layout.js → layout/index.js} +4 -3
- package/dist/layout/keywords.d.ts +26 -0
- package/dist/layout/keywords.d.ts.map +1 -0
- package/dist/layout/keywords.js +59 -0
- package/dist/layout/keywords.js.map +1 -0
- package/dist/layout/sizing.d.ts +40 -0
- package/dist/layout/sizing.d.ts.map +1 -0
- package/dist/layout/sizing.js +122 -0
- package/dist/layout/sizing.js.map +1 -0
- package/dist/layout/writes.js +55 -0
- package/dist/layout/writes.js.map +1 -0
- package/dist/matrix.d.ts +16 -2
- package/dist/matrix.d.ts.map +1 -0
- package/dist/matrix.js +119 -1
- package/dist/matrix.js.map +1 -0
- package/dist/mutation-impact.d.ts +23 -0
- package/dist/mutation-impact.d.ts.map +1 -0
- package/dist/mutation-impact.js +67 -0
- package/dist/mutation-impact.js.map +1 -0
- package/dist/node-defaults.d.ts +22 -2
- package/dist/node-defaults.d.ts.map +1 -0
- package/dist/node-defaults.js +254 -2
- package/dist/node-defaults.js.map +1 -0
- package/dist/outline/flatten.d.ts +15 -0
- package/dist/outline/flatten.d.ts.map +1 -0
- package/dist/outline/flatten.js +189 -0
- package/dist/outline/flatten.js.map +1 -0
- package/dist/outline/heads.js +34 -0
- package/dist/outline/heads.js.map +1 -0
- package/dist/outline/hit.d.ts +21 -0
- package/dist/outline/hit.d.ts.map +1 -0
- package/dist/outline/hit.js +276 -0
- package/dist/outline/hit.js.map +1 -0
- package/dist/outline/index.d.ts +5 -0
- package/dist/outline/index.js +5 -0
- package/dist/outline/point.d.ts +16 -0
- package/dist/outline/point.d.ts.map +1 -0
- package/dist/outline/point.js +42 -0
- package/dist/outline/point.js.map +1 -0
- package/dist/outline/shapes.d.ts +35 -0
- package/dist/outline/shapes.d.ts.map +1 -0
- package/dist/outline/shapes.js +181 -0
- package/dist/outline/shapes.js.map +1 -0
- package/dist/paints/index.d.ts +2 -0
- package/dist/paints/index.js +2 -0
- package/dist/paints/schema.d.ts +77 -0
- package/dist/paints/schema.d.ts.map +1 -0
- package/dist/paints/schema.js +56 -0
- package/dist/paints/schema.js.map +1 -0
- package/dist/parse-path.d.ts +9 -1
- package/dist/parse-path.d.ts.map +1 -1
- package/dist/parse-path.js +39 -2
- package/dist/parse-path.js.map +1 -1
- package/dist/plugin-data/field.d.ts +47 -0
- package/dist/plugin-data/field.d.ts.map +1 -0
- package/dist/plugin-data/field.js +73 -0
- package/dist/plugin-data/field.js.map +1 -0
- package/dist/plugin-data/fields.d.ts +143 -0
- package/dist/plugin-data/fields.d.ts.map +1 -0
- package/dist/plugin-data/fields.js +168 -0
- package/dist/plugin-data/fields.js.map +1 -0
- package/dist/plugin-data/index.d.ts +3 -0
- package/dist/plugin-data/index.js +3 -0
- package/dist/polygon.d.ts +4 -2
- package/dist/polygon.d.ts.map +1 -1
- package/dist/polygon.js +17 -2
- package/dist/polygon.js.map +1 -1
- package/dist/preview.d.ts +12 -2
- package/dist/preview.d.ts.map +1 -0
- package/dist/preview.js +62 -1
- package/dist/preview.js.map +1 -0
- package/dist/{primitives2.d.ts → primitives/index.d.ts} +4 -3
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +2 -0
- package/dist/primitives/schema.d.ts +18 -0
- package/dist/primitives/schema.d.ts.map +1 -0
- package/dist/primitives/schema.js +19 -0
- package/dist/primitives/schema.js.map +1 -0
- package/dist/random.js +24 -1
- package/dist/random.js.map +1 -0
- package/dist/resize.d.ts +6 -4
- package/dist/resize.d.ts.map +1 -1
- package/dist/resize.js +287 -2
- package/dist/resize.js.map +1 -0
- package/dist/scaling/index.d.ts +3 -0
- package/dist/scaling/index.js +3 -0
- package/dist/scaling/node.d.ts +6 -0
- package/dist/scaling/node.d.ts.map +1 -0
- package/dist/scaling/node.js +148 -0
- package/dist/scaling/node.js.map +1 -0
- package/dist/scaling/tree.d.ts +7 -0
- package/dist/scaling/tree.d.ts.map +1 -0
- package/dist/scaling/tree.js +47 -0
- package/dist/scaling/tree.js.map +1 -0
- package/dist/shaders/index.d.ts +4 -0
- package/dist/shaders/index.js +4 -0
- package/dist/shaders/model.d.ts +41 -0
- package/dist/shaders/model.d.ts.map +1 -0
- package/dist/shaders/model.js +71 -0
- package/dist/shaders/model.js.map +1 -0
- package/dist/shaders/schema.d.ts +41 -0
- package/dist/shaders/schema.d.ts.map +1 -0
- package/dist/shaders/schema.js +36 -0
- package/dist/shaders/schema.js.map +1 -0
- package/dist/shaders/still.d.ts +18 -0
- package/dist/shaders/still.d.ts.map +1 -0
- package/dist/shaders/still.js +36 -0
- package/dist/shaders/still.js.map +1 -0
- package/dist/shape-with-text/fit.d.ts +28 -0
- package/dist/shape-with-text/fit.d.ts.map +1 -0
- package/dist/shape-with-text/fit.js +271 -0
- package/dist/shape-with-text/fit.js.map +1 -0
- package/dist/shape-with-text/geometry.d.ts +20 -0
- package/dist/shape-with-text/geometry.d.ts.map +1 -0
- package/dist/shape-with-text/geometry.js +539 -0
- package/dist/shape-with-text/geometry.js.map +1 -0
- package/dist/shape-with-text/index.d.ts +4 -0
- package/dist/shape-with-text/index.js +4 -0
- package/dist/shape-with-text/kinds.d.ts +20 -0
- package/dist/shape-with-text/kinds.d.ts.map +1 -0
- package/dist/shape-with-text/kinds.js +86 -0
- package/dist/shape-with-text/kinds.js.map +1 -0
- package/dist/shared-styles.d.ts +51 -0
- package/dist/shared-styles.d.ts.map +1 -0
- package/dist/shared-styles.js +186 -0
- package/dist/shared-styles.js.map +1 -0
- package/dist/slots/authoring.d.ts +27 -0
- package/dist/slots/authoring.d.ts.map +1 -0
- package/dist/slots/authoring.js +77 -0
- package/dist/slots/authoring.js.map +1 -0
- package/dist/slots/content.d.ts +41 -0
- package/dist/slots/content.d.ts.map +1 -0
- package/dist/slots/content.js +105 -0
- package/dist/slots/content.js.map +1 -0
- package/dist/slots/frames.d.ts +40 -0
- package/dist/slots/frames.d.ts.map +1 -0
- package/dist/slots/frames.js +118 -0
- package/dist/slots/frames.js.map +1 -0
- package/dist/slots/index.d.ts +5 -0
- package/dist/slots/index.js +5 -0
- package/dist/slots/limits.d.ts +14 -0
- package/dist/slots/limits.d.ts.map +1 -0
- package/dist/slots/limits.js +28 -0
- package/dist/slots/limits.js.map +1 -0
- package/dist/snap.d.ts +21 -2
- package/dist/snap.d.ts.map +1 -0
- package/dist/snap.js +109 -1
- package/dist/snap.js.map +1 -0
- package/dist/source-metadata.js +10 -1
- package/dist/source-metadata.js.map +1 -0
- package/dist/statuses/impact.d.ts +18 -0
- package/dist/statuses/impact.d.ts.map +1 -0
- package/dist/statuses/impact.js +33 -0
- package/dist/statuses/impact.js.map +1 -0
- package/dist/statuses/index.d.ts +5 -0
- package/dist/statuses/index.js +5 -0
- package/dist/statuses/node.d.ts +22 -0
- package/dist/statuses/node.d.ts.map +1 -0
- package/dist/statuses/node.js +47 -0
- package/dist/statuses/node.js.map +1 -0
- package/dist/statuses/schema.d.ts +59 -0
- package/dist/statuses/schema.d.ts.map +1 -0
- package/dist/statuses/schema.js +27 -0
- package/dist/statuses/schema.js.map +1 -0
- package/dist/statuses/workflow.d.ts +120 -0
- package/dist/statuses/workflow.d.ts.map +1 -0
- package/dist/statuses/workflow.js +135 -0
- package/dist/statuses/workflow.js.map +1 -0
- package/dist/{text-direction.d.ts → text/direction.d.ts} +2 -2
- package/dist/text/direction.d.ts.map +1 -0
- package/dist/{text-direction.js → text/direction.js} +1 -1
- package/dist/text/direction.js.map +1 -0
- package/dist/text/index.d.ts +7 -0
- package/dist/text/index.js +7 -0
- package/dist/text/lengths.d.ts +24 -0
- package/dist/text/lengths.d.ts.map +1 -0
- package/dist/text/lengths.js +49 -0
- package/dist/text/lengths.js.map +1 -0
- package/dist/text/lists.d.ts +44 -0
- package/dist/text/lists.d.ts.map +1 -0
- package/dist/text/lists.js +100 -0
- package/dist/text/lists.js.map +1 -0
- package/dist/text/overflow.d.ts +11 -0
- package/dist/text/overflow.d.ts.map +1 -0
- package/dist/text/overflow.js +13 -0
- package/dist/text/overflow.js.map +1 -0
- package/dist/text/paragraphs.d.ts +62 -0
- package/dist/text/paragraphs.d.ts.map +1 -0
- package/dist/text/paragraphs.js +166 -0
- package/dist/text/paragraphs.js.map +1 -0
- package/dist/{text-picture.d.ts → text/picture.d.ts} +3 -4
- package/dist/text/picture.d.ts.map +1 -0
- package/dist/text/picture.js +38 -0
- package/dist/text/picture.js.map +1 -0
- package/dist/text/references.d.ts +21 -0
- package/dist/text/references.d.ts.map +1 -0
- package/dist/text/references.js +43 -0
- package/dist/text/references.js.map +1 -0
- package/dist/text/schema.d.ts +10 -0
- package/dist/text/schema.d.ts.map +1 -0
- package/dist/text/schema.js +11 -0
- package/dist/text/schema.js.map +1 -0
- package/dist/transfer/apply.d.ts +9 -0
- package/dist/transfer/apply.d.ts.map +1 -0
- package/dist/transfer/apply.js +65 -0
- package/dist/transfer/apply.js.map +1 -0
- package/dist/transfer/copied.d.ts +14 -0
- package/dist/transfer/copied.d.ts.map +1 -0
- package/dist/transfer/copied.js +52 -0
- package/dist/transfer/copied.js.map +1 -0
- package/dist/transfer/history.d.ts +8 -0
- package/dist/transfer/history.d.ts.map +1 -0
- package/dist/transfer/history.js +32 -0
- package/dist/transfer/history.js.map +1 -0
- package/dist/transfer/identity.js +12 -0
- package/dist/transfer/identity.js.map +1 -0
- package/dist/transfer/index.d.ts +8 -0
- package/dist/transfer/index.js +8 -0
- package/dist/transfer/nodes.d.ts +14 -0
- package/dist/transfer/nodes.d.ts.map +1 -0
- package/dist/transfer/nodes.js +78 -0
- package/dist/transfer/nodes.js.map +1 -0
- package/dist/transfer/plan.d.ts +29 -0
- package/dist/transfer/plan.d.ts.map +1 -0
- package/dist/transfer/plan.js +106 -0
- package/dist/transfer/plan.js.map +1 -0
- package/dist/transfer/references.js +10 -0
- package/dist/transfer/references.js.map +1 -0
- package/dist/transfer/remove.d.ts +8 -0
- package/dist/transfer/remove.d.ts.map +1 -0
- package/dist/transfer/remove.js +34 -0
- package/dist/transfer/remove.js.map +1 -0
- package/dist/transfer/validation.js +39 -0
- package/dist/transfer/validation.js.map +1 -0
- package/dist/transfer/variables.d.ts +15 -0
- package/dist/transfer/variables.d.ts.map +1 -0
- package/dist/transfer/variables.js +52 -0
- package/dist/transfer/variables.js.map +1 -0
- package/dist/types.d.ts +195 -2007
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +89 -2
- package/dist/types.js.map +1 -0
- package/dist/undo.d.ts +93 -2
- package/dist/undo.d.ts.map +1 -0
- package/dist/undo.js +235 -1
- package/dist/undo.js.map +1 -0
- package/dist/variables/bindings.d.ts +83 -0
- package/dist/variables/bindings.d.ts.map +1 -0
- package/dist/variables/bindings.js +314 -0
- package/dist/variables/bindings.js.map +1 -0
- package/dist/variables/corners.d.ts +12 -0
- package/dist/variables/corners.d.ts.map +1 -0
- package/dist/variables/corners.js +38 -0
- package/dist/variables/corners.js.map +1 -0
- package/dist/variables/fields.d.ts +43 -0
- package/dist/variables/fields.d.ts.map +1 -0
- package/dist/variables/fields.js +104 -0
- package/dist/variables/fields.js.map +1 -0
- package/dist/variables/formula/check.d.ts +14 -0
- package/dist/variables/formula/check.d.ts.map +1 -0
- package/dist/variables/formula/check.js +73 -0
- package/dist/variables/formula/check.js.map +1 -0
- package/dist/variables/formula/evaluate.d.ts +7 -0
- package/dist/variables/formula/evaluate.d.ts.map +1 -0
- package/dist/variables/formula/evaluate.js +30 -0
- package/dist/variables/formula/evaluate.js.map +1 -0
- package/dist/variables/formula/index.d.ts +21 -0
- package/dist/variables/formula/index.d.ts.map +1 -0
- package/dist/variables/formula/index.js +77 -0
- package/dist/variables/formula/index.js.map +1 -0
- package/dist/variables/formula/parse.js +141 -0
- package/dist/variables/formula/parse.js.map +1 -0
- package/dist/variables/formula/print.d.ts +25 -0
- package/dist/variables/formula/print.d.ts.map +1 -0
- package/dist/variables/formula/print.js +105 -0
- package/dist/variables/formula/print.js.map +1 -0
- package/dist/variables/formula/schema.d.ts +7 -0
- package/dist/variables/formula/schema.d.ts.map +1 -0
- package/dist/variables/formula/schema.js +62 -0
- package/dist/variables/formula/schema.js.map +1 -0
- package/dist/variables/formula/signatures.d.ts +9 -0
- package/dist/variables/formula/signatures.d.ts.map +1 -0
- package/dist/variables/formula/signatures.js +238 -0
- package/dist/variables/formula/signatures.js.map +1 -0
- package/dist/variables/formula/tokens.d.ts +26 -0
- package/dist/variables/formula/tokens.d.ts.map +1 -0
- package/dist/variables/formula/tokens.js +82 -0
- package/dist/variables/formula/tokens.js.map +1 -0
- package/dist/variables/formula/tree.d.ts +22 -0
- package/dist/variables/formula/tree.d.ts.map +1 -0
- package/dist/variables/formula/tree.js +35 -0
- package/dist/variables/formula/tree.js.map +1 -0
- package/dist/variables/index.d.ts +41 -0
- package/dist/variables/index.d.ts.map +1 -0
- package/dist/variables/index.js +238 -0
- package/dist/variables/index.js.map +1 -0
- package/dist/variables/resolution.d.ts +39 -0
- package/dist/variables/resolution.d.ts.map +1 -0
- package/dist/variables/resolution.js +154 -0
- package/dist/variables/resolution.js.map +1 -0
- package/dist/variables/schema.d.ts +40 -0
- package/dist/variables/schema.d.ts.map +1 -0
- package/dist/variables/schema.js +32 -0
- package/dist/variables/schema.js.map +1 -0
- package/dist/variables/text.d.ts +16 -0
- package/dist/variables/text.d.ts.map +1 -0
- package/dist/variables/text.js +49 -0
- package/dist/variables/text.js.map +1 -0
- package/dist/variables/token.d.ts +18 -0
- package/dist/variables/token.d.ts.map +1 -0
- package/dist/variables/token.js +39 -0
- package/dist/variables/token.js.map +1 -0
- package/dist/variables/units.js +19 -0
- package/dist/variables/units.js.map +1 -0
- package/dist/variables/value.d.ts +12 -0
- package/dist/variables/value.d.ts.map +1 -0
- package/dist/variables/value.js +70 -0
- package/dist/variables/value.js.map +1 -0
- package/dist/vector-network.d.ts +65 -2
- package/dist/vector-network.d.ts.map +1 -0
- package/dist/vector-network.js +375 -2
- package/dist/vector-network.js.map +1 -0
- package/package.json +303 -137
- package/src/arrow-caps.ts +279 -62
- package/src/behaviours/index.ts +5 -0
- package/src/behaviours/kinds.ts +51 -34
- package/src/behaviours/layers.ts +5 -3
- package/src/behaviours/model.ts +25 -22
- package/src/behaviours/schema.ts +64 -13
- package/src/behaviours/spec.ts +11 -50
- package/src/bindings.ts +11 -2
- package/src/checkpoint.ts +252 -5
- package/src/clipping.ts +112 -0
- package/src/color/index.ts +1 -0
- package/src/color/schema.ts +10 -0
- package/src/comments/document.ts +1 -1
- package/src/comments/index.ts +5 -0
- package/src/comments/schema.ts +51 -0
- package/src/comments/threads.ts +1 -1
- package/src/components/exposure.ts +1 -1
- package/src/components/index.ts +8 -0
- package/src/components/properties.ts +94 -4
- package/src/components/variants.ts +52 -31
- package/src/connectors/controls.ts +229 -0
- package/src/connectors/create.ts +48 -0
- package/src/connectors/elbow.ts +235 -0
- package/src/connectors/gaps.ts +72 -0
- package/src/connectors/hit.ts +49 -0
- package/src/connectors/index.ts +28 -0
- package/src/connectors/label.ts +238 -0
- package/src/connectors/layout.ts +280 -0
- package/src/connectors/pieces.ts +141 -0
- package/src/connectors/route.ts +148 -0
- package/src/connectors/sides.ts +94 -0
- package/src/connectors/sublayers.ts +203 -0
- package/src/coordinate.ts +10 -3
- package/src/copy.ts +71 -31
- package/src/css/blend.ts +27 -0
- package/src/css/index.ts +2 -0
- package/src/css/text.ts +84 -0
- package/src/cubic.ts +14 -0
- package/src/export-format.ts +30 -1
- package/src/fields/appearance.ts +35 -0
- package/src/fields/index.ts +4 -0
- package/src/fields/layout.ts +48 -0
- package/src/fields/text.ts +32 -1
- package/src/fig-compression.ts +9 -0
- package/src/figjam/index.ts +2 -0
- package/src/figjam/palette.ts +473 -0
- package/src/figjam/text.ts +83 -0
- package/src/font-style.ts +58 -14
- package/src/generated/index.ts +76 -0
- package/src/generated/kind.ts +24 -0
- package/src/generated/shape-with-text.ts +157 -0
- package/src/generated/sticky.ts +213 -0
- package/src/geometry.ts +102 -312
- package/src/gradient.ts +14 -0
- package/src/graph.ts +849 -0
- package/src/group-bounds.ts +59 -12
- package/src/guides.ts +6 -1
- package/src/hit-test.ts +118 -74
- package/src/icons/index.ts +3 -0
- package/src/icons/model.ts +9 -0
- package/src/icons/schema.ts +19 -3
- package/src/ids.ts +34 -0
- package/src/images.ts +71 -8
- package/src/index.ts +2 -976
- package/src/instances/assignments.ts +116 -0
- package/src/instances/content-size.ts +23 -2
- package/src/instances/copies.ts +7 -10
- package/src/instances/cycles.ts +1 -1
- package/src/instances/fields.ts +47 -92
- package/src/{instances.ts → instances/index.ts} +69 -44
- package/src/instances/kept-overrides.ts +280 -0
- package/src/instances/main-component.ts +55 -1
- package/src/{instance-overrides.ts → instances/overrides.ts} +58 -2
- package/src/instances/placement.ts +1 -1
- package/src/instances/source-walk.ts +3 -9
- package/src/instances/swap.ts +451 -0
- package/src/instances/sync.ts +166 -177
- package/src/instances/vector-geometry.ts +3 -3
- package/src/layout/aspect-ratio.ts +1 -1
- package/src/layout/sizing.ts +1 -1
- package/src/layout/writes.ts +59 -0
- package/src/matrix.ts +1 -1
- package/src/mutation-impact.ts +1 -1
- package/src/node-defaults.ts +43 -3
- package/src/outline/flatten.ts +190 -0
- package/src/outline/heads.ts +52 -0
- package/src/outline/hit.ts +369 -0
- package/src/outline/index.ts +4 -0
- package/src/outline/point.ts +59 -0
- package/src/outline/shapes.ts +207 -0
- package/src/paints/index.ts +1 -0
- package/src/paints/schema.ts +67 -0
- package/src/parse-path.ts +49 -4
- package/src/plugin-data/fields.ts +69 -77
- package/src/plugin-data/index.ts +2 -0
- package/src/polygon.ts +17 -0
- package/src/preview.ts +1 -1
- package/src/{primitives.ts → primitives/index.ts} +2 -0
- package/src/primitives/schema.ts +14 -0
- package/src/resize.ts +32 -6
- package/src/scaling/node.ts +10 -6
- package/src/scaling/tree.ts +2 -1
- package/src/shaders/index.ts +3 -0
- package/src/shaders/schema.ts +3 -3
- package/src/shape-with-text/fit.ts +154 -0
- package/src/shape-with-text/geometry.ts +496 -0
- package/src/shape-with-text/index.ts +10 -0
- package/src/shape-with-text/kinds.ts +86 -0
- package/src/shared-styles.ts +169 -17
- package/src/slots/authoring.ts +1 -1
- package/src/slots/content.ts +10 -5
- package/src/slots/frames.ts +12 -10
- package/src/slots/index.ts +4 -0
- package/src/slots/limits.ts +1 -1
- package/src/snap.ts +3 -1
- package/src/statuses/impact.ts +38 -0
- package/src/statuses/index.ts +4 -0
- package/src/statuses/node.ts +63 -0
- package/src/statuses/schema.ts +39 -0
- package/src/statuses/workflow.ts +121 -0
- package/src/text/index.ts +3 -0
- package/src/text/lengths.ts +44 -0
- package/src/text/overflow.ts +12 -0
- package/src/text/picture.ts +0 -4
- package/src/text/schema.ts +7 -0
- package/src/transfer/apply.ts +1 -1
- package/src/transfer/copied.ts +72 -0
- package/src/transfer/history.ts +1 -1
- package/src/transfer/index.ts +1 -0
- package/src/transfer/nodes.ts +18 -19
- package/src/transfer/plan.ts +1 -1
- package/src/transfer/remove.ts +1 -1
- package/src/transfer/validation.ts +1 -1
- package/src/transfer/variables.ts +7 -6
- package/src/types.ts +246 -13
- package/src/undo.ts +64 -2
- package/src/variables/bindings.ts +166 -66
- package/src/variables/corners.ts +39 -0
- package/src/variables/fields.ts +83 -0
- package/src/variables/formula/check.ts +99 -0
- package/src/variables/formula/evaluate.ts +33 -0
- package/src/variables/formula/index.ts +129 -0
- package/src/variables/formula/parse.ts +160 -0
- package/src/variables/formula/print.ts +167 -0
- package/src/variables/formula/schema.ts +77 -0
- package/src/variables/formula/signatures.ts +266 -0
- package/src/variables/formula/tokens.ts +114 -0
- package/src/variables/formula/tree.ts +53 -0
- package/src/{variables.ts → variables/index.ts} +86 -146
- package/src/variables/resolution.ts +293 -0
- package/src/variables/schema.ts +31 -0
- package/src/variables/text.ts +51 -0
- package/src/variables/token.ts +27 -1
- package/src/variables/value.ts +92 -0
- package/src/vector-network.ts +263 -22
- package/dist/chunks/asset-keys.js.map +0 -1
- package/dist/chunks/behaviours/kinds.js.map +0 -1
- package/dist/chunks/behaviours/layers.js +0 -611
- package/dist/chunks/behaviours/layers.js.map +0 -1
- package/dist/chunks/behaviours/spec.js.map +0 -1
- package/dist/chunks/bindings.js +0 -18
- package/dist/chunks/bindings.js.map +0 -1
- package/dist/chunks/buffered-events.js.map +0 -1
- package/dist/chunks/checkpoint.js +0 -78
- package/dist/chunks/checkpoint.js.map +0 -1
- package/dist/chunks/color/contrast.js.map +0 -1
- package/dist/chunks/color/index.js +0 -1662
- package/dist/chunks/color/index.js.map +0 -1
- package/dist/chunks/comments/document.js.map +0 -1
- package/dist/chunks/comments/list.js.map +0 -1
- package/dist/chunks/comments/merge.js.map +0 -1
- package/dist/chunks/components/exposure.js +0 -2291
- package/dist/chunks/components/exposure.js.map +0 -1
- package/dist/chunks/components/variants.js +0 -32
- package/dist/chunks/components/variants.js.map +0 -1
- package/dist/chunks/coordinate.js +0 -385
- package/dist/chunks/coordinate.js.map +0 -1
- package/dist/chunks/css/grid.js.map +0 -1
- package/dist/chunks/css/index.js +0 -160
- package/dist/chunks/css/index.js.map +0 -1
- package/dist/chunks/events.js.map +0 -1
- package/dist/chunks/fields/geometry.js.map +0 -1
- package/dist/chunks/font-style.js +0 -96
- package/dist/chunks/font-style.js.map +0 -1
- package/dist/chunks/group-bounds.js.map +0 -1
- package/dist/chunks/icons/glyph.js.map +0 -1
- package/dist/chunks/index.js +0 -2430
- package/dist/chunks/index.js.map +0 -1
- package/dist/color.d.ts +0 -78
- package/dist/color.d.ts.map +0 -1
- package/dist/color.js +0 -3
- package/dist/constants2.d.ts +0 -11
- package/dist/constants2.d.ts.map +0 -1
- package/dist/css.d.ts +0 -39
- package/dist/css.d.ts.map +0 -1
- package/dist/css.js +0 -3
- package/dist/images2.d.ts +0 -16
- package/dist/images2.d.ts.map +0 -1
- package/dist/instances.d.ts +0 -2
- package/dist/instances.js +0 -2
- package/dist/layout.d.ts +0 -2
- package/dist/matrix2.d.ts +0 -16
- package/dist/matrix2.d.ts.map +0 -1
- package/dist/primitives.d.ts +0 -2
- package/dist/primitives.js +0 -0
- package/dist/primitives2.d.ts.map +0 -1
- package/dist/text-direction.d.ts.map +0 -1
- package/dist/text-direction.js.map +0 -1
- package/dist/text-picture.d.ts.map +0 -1
- package/dist/text-picture.js +0 -2
- package/dist/text.d.ts +0 -2
- package/dist/text.js +0 -3
- package/dist/types2.d.ts +0 -2
- package/dist/undo2.d.ts +0 -73
- package/dist/undo2.d.ts.map +0 -1
- package/dist/variables.d.ts +0 -2
- package/dist/variables.js +0 -2
- /package/dist/{chunks/asset-keys.js → asset-keys.js} +0 -0
- /package/dist/{chunks/buffered-events.js → buffered-events.js} +0 -0
- /package/dist/{chunks/events.js → events.js} +0 -0
- /package/dist/{chunks/fields → fields}/geometry.js +0 -0
package/dist/types.d.ts
CHANGED
|
@@ -1,1994 +1,8 @@
|
|
|
1
|
-
import { Color,
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Formats a node's export settings may persist. Each id must name a Core IO
|
|
8
|
-
* export adapter that supports node export; labels and options come from that
|
|
9
|
-
* adapter, so this list only decides what the Export panel offers.
|
|
10
|
-
*/
|
|
11
|
-
declare const EXPORT_FORMAT_IDS: readonly ["png", "jpg", "webp", "svg", "pdf", "pptx"];
|
|
12
|
-
type ExportFormatId = (typeof EXPORT_FORMAT_IDS)[number];
|
|
13
|
-
declare function isExportFormatId(value: unknown): value is ExportFormatId;
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region src/mutation-impact.d.ts
|
|
16
|
-
interface SceneMutationImpact {
|
|
17
|
-
changedNodeIds: Set<string>;
|
|
18
|
-
previousParentIds: Set<string>;
|
|
19
|
-
currentParentIds: Set<string>;
|
|
20
|
-
createdNodeIds: Set<string>;
|
|
21
|
-
deletedNodeIds: Set<string>;
|
|
22
|
-
}
|
|
23
|
-
declare function createSceneMutationImpact(): SceneMutationImpact;
|
|
24
|
-
type MutationImpactListener = (impact: SceneMutationImpact) => void;
|
|
25
|
-
interface CollectedSceneMutation<T> {
|
|
26
|
-
result: T;
|
|
27
|
-
impact: SceneMutationImpact;
|
|
28
|
-
}
|
|
29
|
-
/** Records into `impact` the nodes and parent containers the graph's edits touch, until unbound. */
|
|
30
|
-
declare function recordSceneMutations(graph: SceneGraph, impact: SceneMutationImpact, shouldRecord?: () => boolean): () => void;
|
|
31
|
-
/** Collects the actual graph nodes and parent containers touched by an operation. */
|
|
32
|
-
declare function collectSceneMutation<T>(graph: SceneGraph, operation: () => T | Promise<T>): Promise<CollectedSceneMutation<T>>;
|
|
33
|
-
declare function mutationLayoutScopeIds(impact: SceneMutationImpact): string[];
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region src/variables.d.ts
|
|
36
|
-
declare function addVariable(graph: SceneGraph, variable: Variable): void;
|
|
37
|
-
declare function removeVariable(graph: SceneGraph, id: string): void;
|
|
38
|
-
declare function addCollection(graph: SceneGraph, collection: VariableCollection): void;
|
|
39
|
-
declare function createVariable(graph: SceneGraph, generateId: () => string, name: string, type: VariableType, collectionId: string, value?: VariableValue): Variable;
|
|
40
|
-
declare function createCollection(graph: SceneGraph, generateId: () => string, name: string): VariableCollection;
|
|
41
|
-
declare function removeCollection(graph: SceneGraph, id: string): void;
|
|
42
|
-
declare function getActiveModeId(graph: SceneGraph, collectionId: string): string;
|
|
43
|
-
/**
|
|
44
|
-
* What a node without an explicit mode falls back to: the mode the editor shows (`active`), or
|
|
45
|
-
* the collection's default (`default`), which is what a saved document means to other tools.
|
|
46
|
-
*/
|
|
47
|
-
type VariableModeFallback = 'active' | 'default';
|
|
48
|
-
declare function getNodeVariableModeId(graph: SceneGraph, nodeId: string, collectionId: string, fallback?: VariableModeFallback): string;
|
|
49
|
-
declare function setActiveMode(graph: SceneGraph, collectionId: string, modeId: string): void;
|
|
50
|
-
declare function addMode(graph: SceneGraph, collectionId: string, modeId: string, name: string, sourceMode?: string): void;
|
|
51
|
-
/** Add a mode with a new ID from `generateId`; undo and redo replay it with `addMode`. */
|
|
52
|
-
declare function createMode(graph: SceneGraph, generateId: () => string, collectionId: string, name: string, sourceMode?: string): string | undefined;
|
|
53
|
-
declare function removeMode(graph: SceneGraph, collectionId: string, modeId: string): void;
|
|
54
|
-
declare function renameMode(graph: SceneGraph, collectionId: string, modeId: string, name: string): void;
|
|
55
|
-
declare function setDefaultMode(graph: SceneGraph, collectionId: string, modeId: string): void;
|
|
56
|
-
/** Figma has no default-mode field: the first mode is the default. */
|
|
57
|
-
declare function modesDefaultFirst(collection: VariableCollection): VariableCollectionMode[];
|
|
58
|
-
declare function resolveVariable(graph: SceneGraph, variableId: string, modeId?: string, visited?: Set<string>): VariableValue | undefined;
|
|
59
|
-
declare function resolveColorVariable(graph: SceneGraph, variableId: string): Color | undefined;
|
|
60
|
-
declare function resolveNumberVariable(graph: SceneGraph, variableId: string): number | undefined;
|
|
61
|
-
declare function resolveColorVariableForNode(graph: SceneGraph, nodeId: string, variableId: string, fallback?: VariableModeFallback): Color | undefined;
|
|
62
|
-
declare function resolveNumberVariableForNode(graph: SceneGraph, nodeId: string, variableId: string, fallback?: VariableModeFallback): number | undefined;
|
|
63
|
-
/** A variable's value in the mode a node is in, aliases followed. */
|
|
64
|
-
declare function resolveVariableForNode(graph: SceneGraph, nodeId: string, variableId: string, fallback?: VariableModeFallback): VariableValue | undefined;
|
|
65
|
-
declare function resolveStringVariableForNode(graph: SceneGraph, nodeId: string, variableId: string, fallback?: VariableModeFallback): string | undefined;
|
|
66
|
-
declare function getVariablesForCollection(graph: SceneGraph, collectionId: string): Variable[];
|
|
67
|
-
declare function getVariablesByType(graph: SceneGraph, type: VariableType): Variable[];
|
|
68
|
-
declare function bindVariable(graph: SceneGraph, nodeId: string, field: string, variableId: string): void;
|
|
69
|
-
declare function unbindVariable(graph: SceneGraph, nodeId: string, field: string): void;
|
|
70
|
-
//#endregion
|
|
71
|
-
//#region src/variables/fields.d.ts
|
|
72
|
-
declare function isNumericVariableBindingField(field: string): boolean;
|
|
73
|
-
//#endregion
|
|
74
|
-
//#region src/variables/bindings.d.ts
|
|
75
|
-
/** New declarations belong to the outermost occurrence, bounded by a component definition. */
|
|
76
|
-
declare function variableBindingOwner(graph: SceneGraph, node: SceneNode): SceneNode;
|
|
77
|
-
declare function assignVariableBindingUnits(graph: SceneGraph, node: SceneNode, field: string): void;
|
|
78
|
-
/**
|
|
79
|
-
* The values a node's numeric bindings resolve to in its mode, in scene units, for the fields
|
|
80
|
-
* whose stored value differs. A width or height an instance overrides keeps its own value.
|
|
81
|
-
*/
|
|
82
|
-
declare function resolvedNumericBindings(graph: SceneGraph, node: SceneNode, fallback?: VariableModeFallback): Partial<SceneNode>;
|
|
83
|
-
/**
|
|
84
|
-
* The text a variable bound to text content shows: a string as it is, and a number or boolean
|
|
85
|
-
* as Figma writes it, since Figma lets either be text content.
|
|
86
|
-
*/
|
|
87
|
-
declare function variableText(value: VariableValue | undefined): string | undefined;
|
|
88
|
-
/**
|
|
89
|
-
* The text and visibility a node's string and boolean bindings resolve to in its mode, for the
|
|
90
|
-
* fields whose stored value differs. Text or visibility an instance overrides, which typing in a
|
|
91
|
-
* layer or toggling its eye records, keeps its own value, as an overridden width or height does.
|
|
92
|
-
* A bound font family is left as stored: changing it needs the font loaded, which resolving a
|
|
93
|
-
* binding cannot do.
|
|
94
|
-
*/
|
|
95
|
-
declare function resolvedValueBindings(graph: SceneGraph, node: SceneNode, fallback?: VariableModeFallback): Partial<SceneNode>;
|
|
96
|
-
/**
|
|
97
|
-
* The runs a text's character bindings resolve to in its mode, when a bound number differs from
|
|
98
|
-
* what its characters hold. Bound font families and styles are left as stored, as the text's own.
|
|
99
|
-
*/
|
|
100
|
-
declare function resolvedRunBindings(graph: SceneGraph, node: SceneNode, fallback?: VariableModeFallback): Pick<Partial<SceneNode>, 'styleRuns'>;
|
|
101
|
-
/** The fills and strokes a node's color bindings resolve to in its mode, when it has any. */
|
|
102
|
-
declare function resolvedPaintBindings(graph: SceneGraph, node: SceneNode, fallback?: VariableModeFallback): Pick<Partial<SceneNode>, 'fills' | 'strokes'>;
|
|
103
|
-
/**
|
|
104
|
-
* The layers a reconcile looks at: those bound to these variables, directly or through a variable
|
|
105
|
-
* aliasing them, or the layers in these subtrees. Without a scope, every layer.
|
|
106
|
-
*/
|
|
107
|
-
type BindingScope = {
|
|
108
|
-
variables: Iterable<string>;
|
|
109
|
-
} | {
|
|
110
|
-
subtrees: Iterable<string>;
|
|
111
|
-
};
|
|
112
|
-
/** These variables and every variable that aliases one of them, at any depth and in any mode. */
|
|
113
|
-
declare function variablesResolvingThrough(graph: SceneGraph, ids: Iterable<string>): Set<string>;
|
|
114
|
-
/**
|
|
115
|
-
* The collections whose variables the layers in these subtrees resolve: those they bind, and
|
|
116
|
-
* those the bound variables alias, so a mode set on the subtrees can change what they show.
|
|
117
|
-
*/
|
|
118
|
-
declare function collectionsBoundIn(graph: SceneGraph, roots: Iterable<string>): Set<string>;
|
|
119
|
-
/**
|
|
120
|
-
* The layers a change to these variables reaches: those binding one of them, or a variable that
|
|
121
|
-
* aliases one, on the layer itself or on its characters.
|
|
122
|
-
*/
|
|
123
|
-
declare function layersUsingVariables(graph: SceneGraph, ids: Iterable<string>): SceneNode[];
|
|
124
|
-
/**
|
|
125
|
-
* Resolve live numeric, text, and visibility bindings, numbers in scene units, without authoring
|
|
126
|
-
* instance overrides. A scope limits it to the layers a change can reach, so layers whose saved
|
|
127
|
-
* values differ from their bindings elsewhere in the document are left as saved.
|
|
128
|
-
*/
|
|
129
|
-
declare function reconcileVariableBindings(graph: SceneGraph, scope?: BindingScope): string[];
|
|
130
|
-
//#endregion
|
|
131
|
-
//#region src/variables/token.d.ts
|
|
132
|
-
/** `rem` tokens are stored in canvas pixels and shown against this root font size. */
|
|
133
|
-
declare const ROOT_FONT_SIZE_PX = 16;
|
|
134
|
-
/** The stored number for a value typed in a unit: `1.5` in `rem` is 24 canvas pixels. */
|
|
135
|
-
declare function tokenNumberFromUnit(value: number, unit: TokenUnit): number;
|
|
136
|
-
/** A stored number as it reads in its unit: 24 canvas pixels in `rem` is `1.5`. */
|
|
137
|
-
declare function tokenNumberInUnit(value: number, unit: TokenUnit): number;
|
|
138
|
-
//#endregion
|
|
139
|
-
//#region src/plugin-data/field.d.ts
|
|
140
|
-
/** The plugin id OpenPencil keeps its own state under, on nodes and in `.fig` files. */
|
|
141
|
-
declare const OPEN_PENCIL_PLUGIN_ID = "open-pencil";
|
|
142
|
-
/**
|
|
143
|
-
* What a field holds:
|
|
144
|
-
* - `content` belongs to the node like its fills do and exists only as plugin data, so it
|
|
145
|
-
* travels with a component copied into a library or another document;
|
|
146
|
-
* - `format` repeats a node or variable field for files that have no slot for it, where the
|
|
147
|
-
* node field is what counts;
|
|
148
|
-
* - `bookkeeping` records where a node or document came from and stays behind.
|
|
149
|
-
*/
|
|
150
|
-
type PluginDataRole = 'content' | 'format' | 'bookkeeping';
|
|
151
|
-
/** One OpenPencil plugin-data key. */
|
|
152
|
-
interface PluginDataKey {
|
|
153
|
-
readonly key: string;
|
|
154
|
-
readonly role: PluginDataRole;
|
|
155
|
-
}
|
|
156
|
-
/** A plugin-data key and how its string value is read and written. */
|
|
157
|
-
interface PluginDataField<T> extends PluginDataKey {
|
|
158
|
-
/** The stored value, or `undefined` when it is missing or not a valid value. */
|
|
159
|
-
decode(value: string | null | undefined): T | undefined;
|
|
160
|
-
encode(value: T): string;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* A value stored as JSON. Invalid JSON and a wrong shape both read as missing: plugin data
|
|
164
|
-
* comes from files anyone can edit, so a bad entry is ignored rather than thrown on.
|
|
165
|
-
*/
|
|
166
|
-
declare function jsonPluginDataField<T>(key: string, role: PluginDataRole, schema: v.GenericSchema<unknown, T>): PluginDataField<T>;
|
|
167
|
-
/** A value stored as one of a fixed set of plain strings. */
|
|
168
|
-
declare function textPluginDataField<const T extends string>(key: string, role: PluginDataRole, values: readonly T[]): PluginDataField<T>;
|
|
169
|
-
declare function isPluginDataEntry(entry: PluginDataEntry, field: PluginDataKey): boolean;
|
|
170
|
-
declare function hasPluginData(entries: readonly PluginDataEntry[] | undefined, field: PluginDataKey): boolean;
|
|
171
|
-
declare function readPluginData<T>(entries: readonly PluginDataEntry[] | undefined, field: PluginDataField<T>): T | undefined;
|
|
172
|
-
/** Every valid value of a field kept as several entries under one key. */
|
|
173
|
-
declare function readAllPluginData<T>(entries: readonly PluginDataEntry[] | undefined, field: PluginDataField<T>): T[];
|
|
174
|
-
declare function pluginDataEntry<T>(field: PluginDataField<T>, value: T): PluginDataEntry;
|
|
175
|
-
/** Entries other than those of `fields`; other plugins' entries are always kept. */
|
|
176
|
-
declare function withoutPluginData(entries: readonly PluginDataEntry[], fields: readonly PluginDataKey[]): PluginDataEntry[];
|
|
177
|
-
/** Entries with `field` set to `value`, appended last; `undefined` removes the field. */
|
|
178
|
-
declare function withPluginData<T>(entries: readonly PluginDataEntry[], field: PluginDataField<T>, value: T | undefined): PluginDataEntry[];
|
|
179
|
-
/** Entries with every entry of `field` replaced by one per value. */
|
|
180
|
-
declare function withAllPluginData<T>(entries: readonly PluginDataEntry[], field: PluginDataField<T>, values: readonly T[]): PluginDataEntry[];
|
|
181
|
-
//#endregion
|
|
182
|
-
//#region src/color/okhcl.d.ts
|
|
183
|
-
interface OkHCLColor {
|
|
184
|
-
h: number;
|
|
185
|
-
c: number;
|
|
186
|
-
l: number;
|
|
187
|
-
a?: number;
|
|
188
|
-
}
|
|
189
|
-
interface OkHCLPayload {
|
|
190
|
-
version: 1;
|
|
191
|
-
kind: 'fill' | 'stroke';
|
|
192
|
-
index: number;
|
|
193
|
-
color: OkHCLColor;
|
|
194
|
-
}
|
|
195
|
-
/** Colour spaces a document's stored numbers can be in. */
|
|
196
|
-
type OkHCLColorSpace = 'srgb' | 'display-p3';
|
|
197
|
-
/** Coordinates in `colorSpace`, so callers can store colours in the document's profile. */
|
|
198
|
-
declare function okhclToRGBA(color: OkHCLColor, colorSpace?: OkHCLColorSpace): Color;
|
|
199
|
-
/** Reads `color` as coordinates in `colorSpace`, the inverse of {@link okhclToRGBA}. */
|
|
200
|
-
declare function rgbaToOkHCL(color: Color, colorSpace?: OkHCLColorSpace): OkHCLColor;
|
|
201
|
-
declare function serializeOkHCLPayload(payload: OkHCLPayload): string;
|
|
202
|
-
declare function parseOkHCLPayload(value: string): OkHCLPayload | null;
|
|
203
|
-
declare function setNodeFillOkHCL(node: SceneNode, index: number, color: OkHCLColor, colorSpace?: OkHCLColorSpace): Partial<SceneNode>;
|
|
204
|
-
declare function setNodeStrokeOkHCL(node: SceneNode, index: number, color: OkHCLColor, colorSpace?: OkHCLColorSpace): Partial<SceneNode>;
|
|
205
|
-
declare function clearNodeFillOkHCL(node: SceneNode, index: number): Partial<SceneNode>;
|
|
206
|
-
declare function clearNodeStrokeOkHCL(node: SceneNode, index: number): Partial<SceneNode>;
|
|
207
|
-
declare function getNodeOkHCLPayloads(node: SceneNode): OkHCLPayload[];
|
|
208
|
-
declare function getFillOkHCL(node: SceneNode, index: number): OkHCLPayload | null;
|
|
209
|
-
declare function getStrokeOkHCL(node: SceneNode, index: number): OkHCLPayload | null;
|
|
210
|
-
//#endregion
|
|
211
|
-
//#region src/plugin-data/fields.d.ts
|
|
212
|
-
/** Token fields Figma has no slot for, with mode ids as the file spells them. */
|
|
213
|
-
interface StoredToken {
|
|
214
|
-
unit?: TokenUnit;
|
|
215
|
-
expressions?: Record<string, {
|
|
216
|
-
css: string;
|
|
217
|
-
resolved: number;
|
|
218
|
-
}>;
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Every plugin-data entry OpenPencil writes under {@link OPEN_PENCIL_PLUGIN_ID}: state Figma's
|
|
222
|
-
* format has no field for. Add a key here, never as a string elsewhere, so reading and writing
|
|
223
|
-
* it share one schema.
|
|
224
|
-
*/
|
|
225
|
-
declare const OPEN_PENCIL_PLUGIN_DATA: {
|
|
226
|
-
/** A text node's direction, on TEXT nodes. */
|
|
227
|
-
textDirection: PluginDataField<"AUTO" | "LTR" | "RTL">;
|
|
228
|
-
/** An auto-layout frame's direction. */
|
|
229
|
-
layoutDirection: PluginDataField<"AUTO" | "LTR" | "RTL">;
|
|
230
|
-
/** Marks a component set Figma would read as a plain frame. */
|
|
231
|
-
nodeType: PluginDataField<"COMPONENT_SET">;
|
|
232
|
-
/** Variable bindings by field path, including those Figma cannot store natively. */
|
|
233
|
-
boundVariables: PluginDataField<{
|
|
234
|
-
[k: string]: string;
|
|
235
|
-
}>;
|
|
236
|
-
exportSettings: PluginDataField<ExportSetting[]>;
|
|
237
|
-
/** The node-local rect a TEXT_PATH layout maps onto, which Kiwi has no field for. */
|
|
238
|
-
textPathBox: PluginDataField<Rect>;
|
|
239
|
-
/** The library asset a node was inserted from. */
|
|
240
|
-
librarySource: PluginDataField<LibraryAssetSource>;
|
|
241
|
-
/** Libraries enabled for the document, on the DOCUMENT node. */
|
|
242
|
-
enabledLibraries: PluginDataField<EnabledLibraryBinding[]>;
|
|
243
|
-
/** The library this document publishes as, on the DOCUMENT node. */
|
|
244
|
-
sourceLibraryPublication: PluginDataField<SourceLibraryPublication>;
|
|
245
|
-
/** Canvas comment threads, deleted ones included, on the DOCUMENT node. */
|
|
246
|
-
comments: PluginDataField<CommentThread[]>;
|
|
247
|
-
/** Unit and CSS expressions, on each VARIABLE. */
|
|
248
|
-
token: PluginDataField<StoredToken>;
|
|
249
|
-
/** Mode conditions by mode id, on each VARIABLE_SET. */
|
|
250
|
-
modeConditions: PluginDataField<{
|
|
251
|
-
[x: string]: string;
|
|
252
|
-
}>;
|
|
253
|
-
/** The attribute that switches manual modes, on each VARIABLE_SET. */
|
|
254
|
-
modeAttribute: PluginDataField<string>;
|
|
255
|
-
/** One entry per paint picked in OkHCL, so the picker reopens on the same coordinates. */
|
|
256
|
-
okhcl: PluginDataField<OkHCLPayload>;
|
|
257
|
-
/** How a main component or component set behaves as a control in preview. */
|
|
258
|
-
behaviour: PluginDataField<{
|
|
259
|
-
kind: "button" | "textField" | "textarea" | "numberField" | "toggle" | "switch" | "checkbox" | "radio" | "radioGroup" | "toggleGroup" | "slider" | "progress" | "tabs" | "collapsible" | "accordion";
|
|
260
|
-
booleans: {
|
|
261
|
-
[x: string]: {
|
|
262
|
-
propertyId: string;
|
|
263
|
-
on?: string | undefined;
|
|
264
|
-
off?: string | undefined;
|
|
265
|
-
};
|
|
266
|
-
};
|
|
267
|
-
texts: {
|
|
268
|
-
[x: string]: {
|
|
269
|
-
propertyId: string;
|
|
270
|
-
};
|
|
271
|
-
};
|
|
272
|
-
numbers: {
|
|
273
|
-
[x: string]: {
|
|
274
|
-
min: number;
|
|
275
|
-
max: number;
|
|
276
|
-
step: number;
|
|
277
|
-
default: number;
|
|
278
|
-
};
|
|
279
|
-
};
|
|
280
|
-
parts: {
|
|
281
|
-
[x: string]: string;
|
|
282
|
-
};
|
|
283
|
-
states?: {
|
|
284
|
-
rest?: string | undefined;
|
|
285
|
-
hover?: string | undefined;
|
|
286
|
-
pressed?: string | undefined;
|
|
287
|
-
focus?: string | undefined;
|
|
288
|
-
disabled?: string | undefined;
|
|
289
|
-
propertyId: string;
|
|
290
|
-
} | undefined;
|
|
291
|
-
}>;
|
|
292
|
-
/** The icon a frame draws, such as `lucide:home`, on the frame its paths are in. */
|
|
293
|
-
icon: PluginDataField<{
|
|
294
|
-
name: string;
|
|
295
|
-
glyph?: string | undefined;
|
|
296
|
-
}>;
|
|
297
|
-
/** Which of an icon path's paints its icon's color sets, on each path the source drew in it. */
|
|
298
|
-
iconTint: PluginDataField<("fill" | "stroke")[]>;
|
|
299
|
-
/** One entry per paint that draws a shader, matched to its image paint by the frame's hash. */
|
|
300
|
-
shader: PluginDataField<{
|
|
301
|
-
image: string;
|
|
302
|
-
preset: {
|
|
303
|
-
components: ShaderComponent[];
|
|
304
|
-
structureVersion?: number | undefined;
|
|
305
|
-
};
|
|
306
|
-
frame?: {
|
|
307
|
-
width: number;
|
|
308
|
-
height: number;
|
|
309
|
-
preset: string;
|
|
310
|
-
} | undefined;
|
|
311
|
-
}>;
|
|
312
|
-
};
|
|
313
|
-
/**
|
|
314
|
-
* A node's plugin data that is part of its content, in a stable order: OpenPencil's content
|
|
315
|
-
* fields and every other plugin's entries, which the node carries wherever it goes. Format
|
|
316
|
-
* copies of node fields and bookkeeping are left out.
|
|
317
|
-
*/
|
|
318
|
-
declare function contentPluginData(entries: readonly PluginDataEntry[]): PluginDataEntry[];
|
|
319
|
-
//#endregion
|
|
320
|
-
//#region src/scaling/node.d.ts
|
|
321
|
-
declare function scaleNodeChanges(node: SceneNode, scale: number, scalePosition: boolean): Partial<SceneNode>;
|
|
322
|
-
//#endregion
|
|
323
|
-
//#region src/scaling/tree.d.ts
|
|
324
|
-
/** Scale a node tree from the root node's top-left, matching Figma's Scale tool. */
|
|
325
|
-
declare function rescaleNodeTree(graph: SceneGraph, rootId: string, scale: number): void;
|
|
326
|
-
//#endregion
|
|
327
|
-
//#region src/fields/geometry.d.ts
|
|
328
|
-
/** Placement/orientation only; dimensions are a separate geometry contract. */
|
|
329
|
-
declare const TRANSFORM_FIELDS: readonly ["x", "y", "rotation", "flipX", "flipY"];
|
|
330
|
-
declare const SIZE_FIELDS: readonly ["width", "height"];
|
|
331
|
-
//#endregion
|
|
332
|
-
//#region src/fields/text.d.ts
|
|
333
|
-
/** Fields shared by shaping, paragraph measurement, and auto-width invalidation. */
|
|
334
|
-
declare const TEXT_METRIC_FIELDS: readonly ["text", "fontSize", "fontFamily", "fontWeight", "italic", "letterSpacing", "styleRuns", "fontVariations", "fontFeatures", "textParagraphs", "listSpacing", "paragraphSpacing", "paragraphIndent", "hangingList"];
|
|
335
|
-
declare const TEXT_SHAPING_FIELDS: readonly ["text", "fontSize", "fontFamily", "fontWeight", "italic", "letterSpacing", "styleRuns", "fontVariations", "fontFeatures", "textParagraphs", "listSpacing", "paragraphSpacing", "paragraphIndent", "hangingList", "lineHeight", "textCase", "textDirection", "textAlignHorizontal", "textAlignVertical"];
|
|
336
|
-
declare const TEXT_LAYOUT_FIELDS: readonly ["width", "height", "textAutoResize", "maxLines"];
|
|
337
|
-
//#endregion
|
|
338
|
-
//#region src/transfer/plan.d.ts
|
|
339
|
-
interface GraphTransferInput {
|
|
340
|
-
source: SceneGraph;
|
|
341
|
-
rootIds: readonly string[];
|
|
342
|
-
dependencyPageIds: readonly string[];
|
|
343
|
-
target: SceneGraph;
|
|
344
|
-
parentId: string;
|
|
345
|
-
}
|
|
346
|
-
/** Preflight a self-contained fragment; allocation does not insert anything into the target. */
|
|
347
|
-
declare function prepareGraphTransfer(input: GraphTransferInput): {
|
|
348
|
-
activeModes: Map<string, string>;
|
|
349
|
-
images: Map<string, Uint8Array<ArrayBuffer>>;
|
|
350
|
-
variables: Variable[];
|
|
351
|
-
collections: VariableCollection[];
|
|
352
|
-
nodeIds: Map<string, string>;
|
|
353
|
-
rootIds: string[];
|
|
354
|
-
dependencyPageIds: string[];
|
|
355
|
-
nodes: {
|
|
356
|
-
id: string;
|
|
357
|
-
type: NodeType;
|
|
358
|
-
parentId: string;
|
|
359
|
-
props: Partial<SceneNode>;
|
|
360
|
-
}[];
|
|
361
|
-
};
|
|
362
|
-
//#endregion
|
|
363
|
-
//#region src/transfer/apply.d.ts
|
|
364
|
-
type GraphTransferPlan = ReturnType<typeof prepareGraphTransfer>;
|
|
365
|
-
/** Revalidate at insertion time. Event-delivery failures after commit are not rollback failures. */
|
|
366
|
-
declare function applyGraphTransfer(target: SceneGraph, input: GraphTransferPlan): void;
|
|
367
|
-
//#endregion
|
|
368
|
-
//#region src/transfer/remove.d.ts
|
|
369
|
-
/** Refuse to remove transferred content that has acquired external dependents. */
|
|
370
|
-
declare function removeGraphTransfer(graph: SceneGraph, plan: GraphTransferPlan): void;
|
|
371
|
-
//#endregion
|
|
372
|
-
//#region src/transfer/history.d.ts
|
|
373
|
-
/** Capture post-placement state for redo; this does not authorize deleting shared resources. */
|
|
374
|
-
declare function captureTransferredState(graph: SceneGraph, original: GraphTransferPlan): GraphTransferPlan;
|
|
375
|
-
//#endregion
|
|
376
|
-
//#region src/transfer/variables.d.ts
|
|
377
|
-
interface VariableTransferReferences {
|
|
378
|
-
variables: ReadonlyMap<string, string>;
|
|
379
|
-
collections: ReadonlyMap<string, string>;
|
|
380
|
-
modes: ReadonlyMap<string, string>;
|
|
381
|
-
}
|
|
382
|
-
/** Prepare isolated resource copies; never mutate the source or destination graph. */
|
|
383
|
-
declare function prepareVariableTransfer(variables: readonly Variable[], collections: readonly VariableCollection[], references: VariableTransferReferences): {
|
|
384
|
-
variables: Variable[];
|
|
385
|
-
collections: VariableCollection[];
|
|
386
|
-
};
|
|
387
|
-
//#endregion
|
|
388
|
-
//#region src/transfer/nodes.d.ts
|
|
389
|
-
interface NodeTransferReferences extends VariableTransferReferences {
|
|
390
|
-
nodes: ReadonlyMap<string, string>;
|
|
391
|
-
styles: ReadonlyMap<string, string>;
|
|
392
|
-
properties: ReadonlyMap<string, string>;
|
|
393
|
-
propertyTypes: ReadonlyMap<string, ComponentPropertyType>;
|
|
394
|
-
}
|
|
395
|
-
/** Prepare runtime references without rewriting original format identities or ordinary text. */
|
|
396
|
-
declare function prepareNodeTransfer(source: SceneNode, refs: NodeTransferReferences): Partial<SceneNode>;
|
|
397
|
-
//#endregion
|
|
398
|
-
//#region src/instance-overrides.d.ts
|
|
399
|
-
type InstanceOverrideField = string;
|
|
400
|
-
interface InstanceOverrideState {
|
|
401
|
-
self: Map<InstanceOverrideField, unknown>;
|
|
402
|
-
descendants: Map<string, Map<InstanceOverrideField, unknown>>;
|
|
403
|
-
}
|
|
404
|
-
declare function createInstanceOverrideState(): InstanceOverrideState;
|
|
405
|
-
interface SerializedOverrideValue {
|
|
406
|
-
defined: boolean;
|
|
407
|
-
value?: unknown;
|
|
408
|
-
}
|
|
409
|
-
interface SerializedInstanceOverrideState {
|
|
410
|
-
self: Array<[InstanceOverrideField, SerializedOverrideValue]>;
|
|
411
|
-
descendants: Array<[string, Array<[InstanceOverrideField, SerializedOverrideValue]>]>;
|
|
412
|
-
}
|
|
413
|
-
declare function serializeInstanceOverrideState(state: InstanceOverrideState): SerializedInstanceOverrideState;
|
|
414
|
-
declare function deserializeInstanceOverrideState(state: unknown): InstanceOverrideState;
|
|
415
|
-
declare function cloneInstanceOverrideState(state: InstanceOverrideState): InstanceOverrideState;
|
|
416
|
-
interface InstanceOverrideReferenceMapper {
|
|
417
|
-
node: (id: string) => string;
|
|
418
|
-
variable: (id: string) => string;
|
|
419
|
-
}
|
|
420
|
-
/** Remap runtime identities only; ordinary strings and source-format payloads stay opaque. */
|
|
421
|
-
declare function remapInstanceOverrideState(state: InstanceOverrideState, references: InstanceOverrideReferenceMapper): InstanceOverrideState;
|
|
422
|
-
declare function getInstanceOverride(state: InstanceOverrideState, instanceId: string, nodeId: string, field: InstanceOverrideField): unknown;
|
|
423
|
-
declare function setInstanceOverride(state: InstanceOverrideState, instanceId: string, nodeId: string, field: InstanceOverrideField, value?: unknown): void;
|
|
424
|
-
declare function deleteInstanceOverride(state: InstanceOverrideState, instanceId: string, nodeId: string, field: InstanceOverrideField): boolean;
|
|
425
|
-
declare function clearInstanceOverrides(state: InstanceOverrideState): void;
|
|
426
|
-
declare function forEachInstanceOverride(state: InstanceOverrideState, callback: (nodeId: string, field: InstanceOverrideField, value: unknown) => void): void;
|
|
427
|
-
//#endregion
|
|
428
|
-
//#region src/asset-keys.d.ts
|
|
429
|
-
/**
|
|
430
|
-
* A key shaped as Figma's asset keys, 40 hex digits, derived from `seed` so the same seed always
|
|
431
|
-
* gives the same key. The Figma clipboard names variables and collections by key; one made in
|
|
432
|
-
* OpenPencil has none, so copying it gives it this one, and copying it again gives the same.
|
|
433
|
-
*/
|
|
434
|
-
declare function derivedAssetKey(seed: string): string;
|
|
435
|
-
/**
|
|
436
|
-
* A version shaped as Figma's asset versions, `session:local`, derived from `content` so that
|
|
437
|
-
* copying an unchanged asset again gives the same version and copying a changed one gives another.
|
|
438
|
-
* Figma keeps the first value it pasted for a key and version, so a version that stayed the same
|
|
439
|
-
* across an edit would bring the old value back.
|
|
440
|
-
*/
|
|
441
|
-
declare function derivedAssetVersion(content: string): string;
|
|
442
|
-
//#endregion
|
|
443
|
-
//#region src/components/properties.d.ts
|
|
444
|
-
interface ComponentPropertyTarget {
|
|
445
|
-
node: SceneNode;
|
|
446
|
-
field: ComponentPropertyReferenceField;
|
|
447
|
-
source: SceneNode;
|
|
448
|
-
}
|
|
449
|
-
declare function componentPropertyOwners(graph: SceneGraph, instance: SceneNode): SceneNode[];
|
|
450
|
-
declare function componentPropertyDefinitions(graph: SceneGraph, instance: SceneNode): ComponentPropertyDefinition[];
|
|
451
|
-
declare function resolveComponentPropertyValue(graph: SceneGraph, value: string): SceneNode | null;
|
|
452
|
-
declare function findComponentPropertyTarget(graph: SceneGraph, instance: SceneNode, propertyId: string): ComponentPropertyTarget | null;
|
|
453
|
-
declare function findComponentPropertyTargets(graph: SceneGraph, instance: SceneNode, propertyId: string): ComponentPropertyTarget[];
|
|
454
|
-
declare function applyComponentPropertyValue(graph: SceneGraph, instanceId: string, definition: ComponentPropertyDefinition, value: string): SceneNode | null;
|
|
455
|
-
declare function removeComponentProperty(graph: SceneGraph, ownerId: string, propertyId: string): boolean;
|
|
456
|
-
/** A new component property ID, in the `prop:` form the editor, plugin API, and design JSX share. */
|
|
457
|
-
declare function createComponentPropertyId(): string;
|
|
458
|
-
//#endregion
|
|
459
|
-
//#region src/components/variants.d.ts
|
|
460
|
-
/** Variants in reading order on the canvas: top to bottom, then left to right, then by name. */
|
|
461
|
-
declare function compareCanvasPosition(a: SceneNode, b: SceneNode): number;
|
|
462
|
-
/**
|
|
463
|
-
* A component set's default variant, the one an instance starts as: the variant in its
|
|
464
|
-
* top-left corner, as Figma defines it.
|
|
465
|
-
*/
|
|
466
|
-
declare function defaultVariant(graph: SceneGraph, set: SceneNode): SceneNode | undefined;
|
|
467
|
-
/**
|
|
468
|
-
* The value a variant property starts at: its recorded default when that is one of its options,
|
|
469
|
-
* or else the default variant's, since a document may leave the recorded default empty.
|
|
470
|
-
*/
|
|
471
|
-
declare function variantDefaultValue(graph: SceneGraph, set: SceneNode, property: {
|
|
472
|
-
name: string;
|
|
473
|
-
defaultValue: string;
|
|
474
|
-
variantOptions?: string[];
|
|
475
|
-
}): string;
|
|
476
|
-
/**
|
|
477
|
-
* The variant with every property at its default value: the recorded defaults when they name a
|
|
478
|
-
* variant, else the default variant, as a document that leaves them out draws it.
|
|
479
|
-
*/
|
|
480
|
-
declare function restingVariant(graph: SceneGraph, set: SceneNode): SceneNode | undefined;
|
|
481
|
-
//#endregion
|
|
482
|
-
//#region src/slots/frames.d.ts
|
|
483
|
-
/** The slot property a frame holds the content of, if it is a slot. */
|
|
484
|
-
declare function slotPropertyId(node: SceneNode): string | undefined;
|
|
485
|
-
/**
|
|
486
|
-
* Whether this slot frame's children belong to its instance rather than its component: the
|
|
487
|
-
* nearest enclosing instance assigns the slot. Such content is never synced from the component.
|
|
488
|
-
*/
|
|
489
|
-
declare function ownsSlotContent(graph: SceneGraph, node: SceneNode, propertyId?: string | undefined): boolean;
|
|
490
|
-
/** An instance's slot frames, without entering nested instances, whose slots are their own. */
|
|
491
|
-
declare function instanceSlotFrames(graph: SceneGraph, instance: SceneNode): SceneNode[];
|
|
492
|
-
/** One slot's owned content, parked while the instance it belongs to is rebuilt. */
|
|
493
|
-
interface ParkedSlot {
|
|
494
|
-
/** Names of the nested instances leading to the slot's owner; empty for the instance itself. */
|
|
495
|
-
path: string[];
|
|
496
|
-
/** The slot property's name, which the replacement must share. */
|
|
497
|
-
name: string;
|
|
498
|
-
/** Content layer ids, in layer order. */
|
|
499
|
-
content: string[];
|
|
500
|
-
}
|
|
501
|
-
/** Owned slot content parked under an instance while its component changes. */
|
|
502
|
-
interface ParkedSlotContent {
|
|
503
|
-
slots: ParkedSlot[];
|
|
504
|
-
/** The instance's own slot assignments the content was parked from. */
|
|
505
|
-
propertyIds: string[];
|
|
506
|
-
}
|
|
507
|
-
/**
|
|
508
|
-
* Park the slot content an instance and the instances nested in it own, by slot name and the
|
|
509
|
-
* nested instance's name path, directly under the instance, so its component can be replaced.
|
|
510
|
-
* Figma keeps that content when a variant switch or swap leads to slots of the same names.
|
|
511
|
-
*/
|
|
512
|
-
declare function detachOwnedSlotContent(graph: SceneGraph, instance: SceneNode): ParkedSlotContent;
|
|
513
|
-
/** Move parked content into the slots of the same names and paths, and reassign them. */
|
|
514
|
-
declare function restoreOwnedSlotContent(graph: SceneGraph, instance: SceneNode, parked: ParkedSlotContent): void;
|
|
515
|
-
//#endregion
|
|
516
|
-
//#region src/instances/main-component.d.ts
|
|
517
|
-
/**
|
|
518
|
-
* The main component an instance shows. An instance nested in another instance points at the
|
|
519
|
-
* instance it was cloned from, so follow those links to the component.
|
|
520
|
-
*/
|
|
521
|
-
declare function instanceMainComponent(graph: SceneGraph, instance: SceneNode): SceneNode | undefined;
|
|
522
|
-
//#endregion
|
|
523
|
-
//#region src/instances/cycles.d.ts
|
|
524
|
-
/**
|
|
525
|
-
* Whether moving `nodeId` under `parentId` would make a component contain itself: its layers,
|
|
526
|
-
* followed through instances into their components, reach a component at or above the parent.
|
|
527
|
-
* Both components and instances above the parent count: an instance's layers are its
|
|
528
|
-
* component's, so a swap inside one may not bring that component back in.
|
|
529
|
-
*/
|
|
530
|
-
declare function createsComponentCycle(graph: SceneGraph, nodeId: string, parentId: string): boolean;
|
|
531
|
-
/** Whether placing this definition's instance under `parentId` would make a component contain itself. */
|
|
532
|
-
declare function canCreateInstance(graph: SceneGraph, componentId: string, parentId: string): boolean;
|
|
533
|
-
/**
|
|
534
|
-
* `parentId`, or its nearest ancestor that can hold these layers or instances of these
|
|
535
|
-
* components without a component containing itself. Figma pastes an instance next to its own
|
|
536
|
-
* component, not in it.
|
|
537
|
-
*/
|
|
538
|
-
declare function cycleSafeParent(graph: SceneGraph, parentId: string, nodeIds: readonly string[]): string;
|
|
539
|
-
//#endregion
|
|
540
|
-
//#region src/components/exposure.d.ts
|
|
541
|
-
/**
|
|
542
|
-
* Instances a component can expose: those in its own layers, not inside another instance,
|
|
543
|
-
* whose content belongs to that instance's component.
|
|
544
|
-
*/
|
|
545
|
-
declare function exposableInstances(graph: SceneGraph, componentId: string): SceneNode[];
|
|
546
|
-
/**
|
|
547
|
-
* The layers of an instance that stand for exposed nested instances of its component, in
|
|
548
|
-
* layer order. Each is matched to its source the way instance sync matches children.
|
|
549
|
-
*/
|
|
550
|
-
declare function exposedInstances(graph: SceneGraph, instance: SceneNode): SceneNode[];
|
|
551
|
-
/** Why Figma refuses to expose an instance, or null when it may be exposed. */
|
|
552
|
-
type InstanceExposureIssue = 'not-in-component' | 'not-primary' | 'nothing-to-expose';
|
|
553
|
-
/**
|
|
554
|
-
* Whether an instance may be exposed, under Figma's rules: it sits in a component's own layers
|
|
555
|
-
* (an instance's copy follows its source) and its component has properties or exposes nested
|
|
556
|
-
* instances itself.
|
|
557
|
-
*/
|
|
558
|
-
declare function instanceExposureIssue(graph: SceneGraph, instance: SceneNode): InstanceExposureIssue | null;
|
|
559
|
-
//#endregion
|
|
560
|
-
//#region src/slots/content.d.ts
|
|
561
|
-
/**
|
|
562
|
-
* Where layers may be added, moved, or removed under a parent:
|
|
563
|
-
* - `free`: outside any instance, or inside a component definition;
|
|
564
|
-
* - `slot`: inside a slot of an instance, whose content the instance owns or can claim;
|
|
565
|
-
* - `locked`: anywhere else inside an instance, whose layers come from its component.
|
|
566
|
-
*/
|
|
567
|
-
type SlotScope = {
|
|
568
|
-
kind: 'free';
|
|
569
|
-
} | {
|
|
570
|
-
kind: 'slot';
|
|
571
|
-
frame: SceneNode;
|
|
572
|
-
instance: SceneNode;
|
|
573
|
-
propertyId: string;
|
|
574
|
-
} | {
|
|
575
|
-
kind: 'locked';
|
|
576
|
-
instance: SceneNode;
|
|
577
|
-
};
|
|
578
|
-
declare function slotScope(graph: SceneGraph, parentId: string): SlotScope;
|
|
579
|
-
/**
|
|
580
|
-
* Make the instance own its slot's content, as Figma does on the first edit: the layers
|
|
581
|
-
* stay where they are, but stop following the component. Overrides the instance held for
|
|
582
|
-
* them become their own values, or move to the nested instance they belong to.
|
|
583
|
-
*/
|
|
584
|
-
declare function claimSlotContent(graph: SceneGraph, scope: Extract<SlotScope, {
|
|
585
|
-
kind: 'slot';
|
|
586
|
-
}>): void;
|
|
587
|
-
/** Return the slot to its component's content: the instance stops owning it. */
|
|
588
|
-
declare function resetSlotContent(graph: SceneGraph, scope: Extract<SlotScope, {
|
|
589
|
-
kind: 'slot';
|
|
590
|
-
}>): void;
|
|
591
|
-
/** Remove everything from the slot; the instance keeps owning it, now empty. */
|
|
592
|
-
declare function clearSlotContent(graph: SceneGraph, scope: Extract<SlotScope, {
|
|
593
|
-
kind: 'slot';
|
|
594
|
-
}>): void;
|
|
595
|
-
//#endregion
|
|
596
|
-
//#region src/slots/authoring.d.ts
|
|
597
|
-
/** The settings a new slot starts with: no limits, any layer allowed. */
|
|
598
|
-
declare const DEFAULT_SLOT_SETTINGS: SlotSettings;
|
|
599
|
-
/**
|
|
600
|
-
* The main component a layer belongs to, which defines the slots inside it. Layers of an
|
|
601
|
-
* instance are not authored there, so a layer under an instance has none.
|
|
602
|
-
*/
|
|
603
|
-
declare function slotOwner(graph: SceneGraph, node: SceneNode): SceneNode | undefined;
|
|
604
|
-
/** Whether a frame inside a main component can become a slot. */
|
|
605
|
-
declare function canCreateSlot(graph: SceneGraph, node: SceneNode): boolean;
|
|
606
|
-
/**
|
|
607
|
-
* Make a frame of a main component a slot: define a SLOT property, named after the frame, on
|
|
608
|
-
* the component and bind the frame's children to it. Instances pick up the slot on their next
|
|
609
|
-
* sync.
|
|
610
|
-
*/
|
|
611
|
-
declare function createSlotProperty(graph: SceneGraph, frameId: string, id: string): ComponentPropertyDefinition | null;
|
|
612
|
-
/** What a slot's settings panel can change. */
|
|
613
|
-
type SlotPropertyPatch = Partial<Pick<ComponentPropertyDefinition, 'name' | 'description' | 'preferredValues'>> & {
|
|
614
|
-
slotSettings?: Partial<SlotSettings>;
|
|
615
|
-
};
|
|
616
|
-
/** Change a slot property's name, description, preferred components, or limits. */
|
|
617
|
-
declare function updateSlotProperty(graph: SceneGraph, ownerId: string, propertyId: string, patch: SlotPropertyPatch): boolean;
|
|
618
|
-
//#endregion
|
|
619
|
-
//#region src/slots/limits.d.ts
|
|
620
|
-
/** A limit a slot's content breaks, named as Figma's `SlotNode.limitViolations` names them. */
|
|
621
|
-
type SlotLimitViolation = 'BELOW_MIN' | 'ABOVE_MAX' | 'HAS_NON_PREFERRED';
|
|
622
|
-
/** Whether a component is among a slot's preferred values, by id, key, or library key. */
|
|
623
|
-
declare function isPreferredComponent(component: SceneNode | undefined, preferredValues?: readonly string[]): boolean;
|
|
624
|
-
/** Content layers a preferred-only slot does not allow: anything but preferred instances. */
|
|
625
|
-
declare function nonPreferredLayers(graph: SceneGraph, definition: ComponentPropertyDefinition, content: readonly SceneNode[]): SceneNode[];
|
|
626
|
-
/** The limits a slot's content breaks; below-minimum and above-maximum exclude each other. */
|
|
627
|
-
declare function slotLimitViolations(graph: SceneGraph, definition: ComponentPropertyDefinition, content: readonly SceneNode[]): SlotLimitViolation[];
|
|
628
|
-
//#endregion
|
|
629
|
-
//#region src/behaviours/kinds.d.ts
|
|
630
|
-
/** The controls a main component can behave as, in the order the picker lists them. */
|
|
631
|
-
declare const BEHAVIOUR_KINDS: readonly ["button", "textField", "textarea", "numberField", "toggle", "switch", "checkbox", "radio", "radioGroup", "toggleGroup", "slider", "progress", "tabs", "collapsible", "accordion"];
|
|
632
|
-
type BehaviourKind = (typeof BEHAVIOUR_KINDS)[number];
|
|
633
|
-
/**
|
|
634
|
-
* The interaction states a control can show, each drawn as a value of one variant property:
|
|
635
|
-
* at rest, under the pointer, while pressed, focused from the keyboard, and disabled.
|
|
636
|
-
*/
|
|
637
|
-
declare const INTERACTION_STATES: readonly ["rest", "hover", "pressed", "focus", "disabled"];
|
|
638
|
-
type InteractionState = (typeof INTERACTION_STATES)[number];
|
|
639
|
-
/**
|
|
640
|
-
* How a behaviour value is held. A boolean is a variant or boolean property of the component,
|
|
641
|
-
* and text is a text property. Figma has no number property, so a number is the behaviour's
|
|
642
|
-
* own (min, max, step, default); a choice is which item of a slot is active, the first by
|
|
643
|
-
* default.
|
|
644
|
-
*/
|
|
645
|
-
type BehaviourValueType = 'boolean' | 'text' | 'number' | 'choice';
|
|
646
|
-
/** A value of the control: its state, which preview reads and changes. */
|
|
647
|
-
interface BehaviourValueContract {
|
|
648
|
-
id: string;
|
|
649
|
-
type: BehaviourValueType;
|
|
650
|
-
/** Whether a boolean or text value must be bound before the behaviour is complete. */
|
|
651
|
-
required: boolean;
|
|
652
|
-
}
|
|
653
|
-
/**
|
|
654
|
-
* A Reka UI subcomponent of the control, which is a slot of the component: the behaviour binds
|
|
655
|
-
* it to one of the component's slot properties, never to a layer found by name.
|
|
656
|
-
*/
|
|
657
|
-
interface BehaviourPartContract {
|
|
658
|
-
id: string;
|
|
659
|
-
required: boolean;
|
|
660
|
-
/**
|
|
661
|
-
* Whether the slot holds the control's items, each an instance with its own behaviour (a
|
|
662
|
-
* radio, a toggle, a collapsible), which the control turns on and off.
|
|
663
|
-
*/
|
|
664
|
-
items?: boolean;
|
|
665
|
-
/**
|
|
666
|
-
* The Reka UI part each child of the slot is, when the slot holds repeated parts: a tab list's
|
|
667
|
-
* triggers, the tabs' content panels, or a group's items.
|
|
668
|
-
*/
|
|
669
|
-
children?: string;
|
|
670
|
-
}
|
|
671
|
-
interface BehaviourContract {
|
|
672
|
-
values: BehaviourValueContract[];
|
|
673
|
-
parts: BehaviourPartContract[];
|
|
674
|
-
}
|
|
675
|
-
/**
|
|
676
|
-
* The behaviours OpenPencil knows, after Reka UI's primitives. Their states are drawn as the
|
|
677
|
-
* component's variants and properties; their subcomponents (thumb, range, trigger, …) are the
|
|
678
|
-
* component's slots, and the component itself is the control's root.
|
|
679
|
-
*/
|
|
680
|
-
declare const BEHAVIOUR_CONTRACTS: Readonly<Record<BehaviourKind, BehaviourContract>>;
|
|
681
|
-
declare function behaviourContract(kind: BehaviourKind): BehaviourContract;
|
|
682
|
-
//#endregion
|
|
683
|
-
//#region src/icons/schema.d.ts
|
|
684
|
-
/** An icon's name in its set, `prefix:name`, as Iconify names icons. */
|
|
685
|
-
declare const ICON_NAME: RegExp;
|
|
686
|
-
declare const iconSchema: v.ObjectSchema<{
|
|
687
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
|
|
688
|
-
/** A fingerprint of the glyph as placed, to tell when its paths were edited; see `iconGlyph`. */
|
|
689
|
-
readonly glyph: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
690
|
-
}, undefined>;
|
|
691
|
-
/** An icon a frame draws. */
|
|
692
|
-
type Icon = v.InferOutput<typeof iconSchema>;
|
|
693
|
-
declare const ICON_PAINTS: readonly ["fill", "stroke"];
|
|
694
|
-
type IconPaint = (typeof ICON_PAINTS)[number];
|
|
695
|
-
declare const iconTintSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<readonly ["fill", "stroke"], undefined>, undefined>, v.MinLengthAction<("fill" | "stroke")[], 1, undefined>]>;
|
|
696
|
-
//#endregion
|
|
697
|
-
//#region src/icons/model.d.ts
|
|
698
|
-
/** The icon a frame draws, or null when it is not an icon or its data is unreadable. */
|
|
699
|
-
declare function readIcon(node: SceneNode): Icon | null;
|
|
700
|
-
/** The node's plugin data with the icon set, or removed when null. */
|
|
701
|
-
declare function withIcon(node: SceneNode, icon: Icon | null): SceneNode['pluginData'];
|
|
702
|
-
/** The layer name an icon is placed with: its name in the set, such as `cat` for `mdi:cat`. */
|
|
703
|
-
declare function iconLayerName(name: string): string;
|
|
704
|
-
/**
|
|
705
|
-
* Whether `layerName` is the name an icon `name` was placed with, rather than one someone gave
|
|
706
|
-
* it: `cat`, or `Icon / mdi:cat` as icons were named before.
|
|
707
|
-
*/
|
|
708
|
-
declare function isPlacedIconName(layerName: string, name: string): boolean;
|
|
709
|
-
/** The names of the icons among `nodes`, each once, in the order they are first met. */
|
|
710
|
-
declare function iconNames(nodes: Iterable<SceneNode>): string[];
|
|
711
|
-
/** The paints of an icon path that its icon's color sets; none when it keeps its own colors. */
|
|
712
|
-
declare function readIconTint(node: SceneNode): readonly IconPaint[];
|
|
713
|
-
/** The path's plugin data with its tinted paints, or removed when there are none. */
|
|
714
|
-
declare function withIconTint(node: SceneNode, paints: readonly IconPaint[]): SceneNode['pluginData'];
|
|
715
|
-
//#endregion
|
|
716
|
-
//#region src/icons/glyph.d.ts
|
|
717
|
-
/** What reading an icon's paths needs of a graph. */
|
|
718
|
-
interface IconGraph {
|
|
719
|
-
getChildren(id: string): SceneNode[];
|
|
720
|
-
}
|
|
721
|
-
/**
|
|
722
|
-
* A fingerprint of what an icon frame draws: which paths it holds and their shapes, stroke ends,
|
|
723
|
-
* and paints. Resizing the icon, however unevenly, or changing its color leaves it unchanged;
|
|
724
|
-
* editing points, rotating or fading a path, adding or removing one, or changing a color of the
|
|
725
|
-
* icon's own changes it. Moving a whole path or changing its stroke weight does not count, since
|
|
726
|
-
* resizing changes those by rounded amounts too.
|
|
727
|
-
*/
|
|
728
|
-
declare function iconGlyph(graph: IconGraph, frame: SceneNode): string;
|
|
729
|
-
/**
|
|
730
|
-
* Whether an icon frame no longer draws the glyph it was placed with: its paths were edited,
|
|
731
|
-
* added, or removed. An icon placed before glyphs were recorded counts as unedited.
|
|
732
|
-
*/
|
|
733
|
-
declare function isIconModified(graph: IconGraph, frame: SceneNode): boolean;
|
|
734
|
-
//#endregion
|
|
735
|
-
//#region src/shaders/schema.d.ts
|
|
736
|
-
/** One effect of a shader preset, as the `shaders` library names it, with the effects it holds. */
|
|
737
|
-
interface ShaderComponent {
|
|
738
|
-
type: string;
|
|
739
|
-
id?: string;
|
|
740
|
-
props?: Record<string, unknown>;
|
|
741
|
-
children?: ShaderComponent[];
|
|
742
|
-
}
|
|
743
|
-
/**
|
|
744
|
-
* A shader as the `shaders` library describes it and shaders.com exports it: a tree of effects,
|
|
745
|
-
* drawn first to last.
|
|
746
|
-
*/
|
|
747
|
-
declare const shaderPresetSchema: v.ObjectSchema<{
|
|
748
|
-
readonly components: v.SchemaWithPipe<readonly [v.ArraySchema<v.GenericSchema<unknown, ShaderComponent>, undefined>, v.MinLengthAction<ShaderComponent[], 1, undefined>]>;
|
|
749
|
-
readonly structureVersion: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
750
|
-
}, undefined>;
|
|
751
|
-
type ShaderPreset = v.InferOutput<typeof shaderPresetSchema>;
|
|
752
|
-
/**
|
|
753
|
-
* A paint that draws a shader. The paint itself is an image fill of the shader's still frame, so
|
|
754
|
-
* every format and renderer that reads images shows it; this entry says which image it is, the
|
|
755
|
-
* preset that draws it, and the layer size and preset the frame was rendered for, which is
|
|
756
|
-
* missing until it is first rendered.
|
|
757
|
-
*/
|
|
758
|
-
declare const shaderPaintSchema: v.ObjectSchema<{
|
|
759
|
-
readonly image: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
|
|
760
|
-
readonly preset: v.ObjectSchema<{
|
|
761
|
-
readonly components: v.SchemaWithPipe<readonly [v.ArraySchema<v.GenericSchema<unknown, ShaderComponent>, undefined>, v.MinLengthAction<ShaderComponent[], 1, undefined>]>;
|
|
762
|
-
readonly structureVersion: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
763
|
-
}, undefined>;
|
|
764
|
-
readonly frame: v.OptionalSchema<v.ObjectSchema<{
|
|
765
|
-
readonly width: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
766
|
-
readonly height: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
767
|
-
/** The preset's key (`shaderPresetKey`) when the frame was rendered. */
|
|
768
|
-
readonly preset: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
|
|
769
|
-
}, undefined>, undefined>;
|
|
770
|
-
}, undefined>;
|
|
771
|
-
type ShaderPaint = v.InferOutput<typeof shaderPaintSchema>;
|
|
772
|
-
//#endregion
|
|
773
|
-
//#region src/shaders/model.d.ts
|
|
774
|
-
/** What shader paints read of a node. */
|
|
775
|
-
type ShaderNode = Pick<SceneNode, 'fills' | 'strokes' | 'pluginData'>;
|
|
776
|
-
/** Every shader a node's fills and strokes draw, whether or not a paint still shows it. */
|
|
777
|
-
declare function readShaderPaints(node: Pick<SceneNode, 'pluginData'>): ShaderPaint[];
|
|
778
|
-
/**
|
|
779
|
-
* The shader a fill or stroke of `node` draws: an image paint whose image is a shader's frame.
|
|
780
|
-
* Null for any other paint, including one whose image was replaced, which then draws as the
|
|
781
|
-
* image it holds.
|
|
782
|
-
*/
|
|
783
|
-
declare function shaderOfPaint(node: Pick<SceneNode, 'pluginData'>, paint: Fill): ShaderPaint | null;
|
|
784
|
-
/** Whether any paint of `node` draws a shader. */
|
|
785
|
-
declare function hasShaderPaint(node: ShaderNode): boolean;
|
|
786
|
-
/**
|
|
787
|
-
* The node's plugin data with `shaders` set by their image, keeping only shaders a fill or
|
|
788
|
-
* stroke of `paints` still shows, so removing or replacing a paint leaves no entry behind.
|
|
789
|
-
*/
|
|
790
|
-
declare function withShaderPaints(node: Pick<SceneNode, 'pluginData'>, paints: readonly Fill[], shaders?: readonly ShaderPaint[]): SceneNode['pluginData'];
|
|
791
|
-
/**
|
|
792
|
-
* A new paint that draws `preset`, and the shader entry it shows. Its image names a frame not yet
|
|
793
|
-
* rendered, unique to this paint, so no other paint's entry claims it until the frame is drawn.
|
|
794
|
-
*/
|
|
795
|
-
declare function createShaderPaint(preset: ShaderPreset): {
|
|
796
|
-
paint: Fill;
|
|
797
|
-
shader: ShaderPaint;
|
|
798
|
-
};
|
|
799
|
-
/** A short key that tells one preset from another, which a rendered frame records. */
|
|
800
|
-
declare function shaderPresetKey(preset: ShaderPreset): string;
|
|
801
|
-
/**
|
|
802
|
-
* Whether a shader's frame was rendered for its preset at the size `node` has now, so undoing a
|
|
803
|
-
* preset change after reopening the document does not keep a frame of the newer preset.
|
|
804
|
-
*/
|
|
805
|
-
declare function isShaderFrameCurrent(shader: ShaderPaint, size: {
|
|
806
|
-
width: number;
|
|
807
|
-
height: number;
|
|
808
|
-
}): boolean;
|
|
809
|
-
//#endregion
|
|
810
|
-
//#region src/shaders/still.d.ts
|
|
811
|
-
/** The pixels a frame for a layer of `size` is drawn at. */
|
|
812
|
-
declare function shaderFramePixels(size: Size): Size;
|
|
813
|
-
interface ShaderFrameEncoding {
|
|
814
|
-
type: 'image/jpeg' | 'image/png';
|
|
815
|
-
/** For `canvas.toBlob` and `toDataURL`; PNG takes none. */
|
|
816
|
-
quality?: number;
|
|
817
|
-
}
|
|
818
|
-
/**
|
|
819
|
-
* The encoding a frame with these RGBA pixels is stored in: JPEG when every pixel is opaque, which
|
|
820
|
-
* is about 25 times smaller than PNG for a shader, and PNG when any pixel lets the layer behind
|
|
821
|
-
* show through, which JPEG cannot keep.
|
|
822
|
-
*/
|
|
823
|
-
declare function shaderFrameEncoding(rgba: ArrayLike<number>): ShaderFrameEncoding;
|
|
824
|
-
//#endregion
|
|
825
|
-
//#region src/behaviours/layers.d.ts
|
|
826
|
-
/** Whether an instance's main component, or its set, has a behaviour. */
|
|
827
|
-
declare function hasBehaviour(graph: SceneGraph, node: SceneNode): boolean;
|
|
828
|
-
/**
|
|
829
|
-
* A layer's path below a root: the names of the layers down to it, with the position among
|
|
830
|
-
* same-named siblings when names repeat. It stays the same when a variant switch rebuilds an
|
|
831
|
-
* instance's layers, so it identifies controls and keeps their DOM in place.
|
|
832
|
-
*/
|
|
833
|
-
declare function layerPath(graph: SceneGraph, rootId: string, nodeId: string): string;
|
|
834
|
-
/** The layer at `path` below a root, the inverse of `layerPath`. */
|
|
835
|
-
declare function findLayerByPath(graph: SceneGraph, rootId: string, path: string): SceneNode | undefined;
|
|
836
|
-
//#endregion
|
|
837
|
-
//#region src/behaviours/schema.d.ts
|
|
838
|
-
declare const BooleanBinding: v.ObjectSchema<{
|
|
839
|
-
readonly propertyId: v.StringSchema<undefined>;
|
|
840
|
-
/** For a variant property: the values that mean on and off. */
|
|
841
|
-
readonly on: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
842
|
-
readonly off: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
843
|
-
}, undefined>;
|
|
844
|
-
/** Whether a number value's range can be stepped through: `max` above `min`, a positive step. */
|
|
845
|
-
declare function isNumberRange(settings: {
|
|
846
|
-
min: number;
|
|
847
|
-
max: number;
|
|
848
|
-
step: number;
|
|
849
|
-
}): boolean;
|
|
850
|
-
declare const NumberSettings: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
851
|
-
readonly min: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
852
|
-
readonly max: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
853
|
-
readonly step: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
854
|
-
readonly default: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
855
|
-
}, undefined>, v.CheckAction<{
|
|
856
|
-
min: number;
|
|
857
|
-
max: number;
|
|
858
|
-
step: number;
|
|
859
|
-
default: number;
|
|
860
|
-
}, "A number value needs max above min and a positive step">]>;
|
|
861
|
-
declare const InteractionStates: v.ObjectSchema<{
|
|
862
|
-
readonly rest: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
863
|
-
readonly hover: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
864
|
-
readonly pressed: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
865
|
-
readonly focus: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
866
|
-
readonly disabled: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
867
|
-
readonly propertyId: v.StringSchema<undefined>;
|
|
868
|
-
}, undefined>;
|
|
869
|
-
declare const behaviourSchema: v.ObjectSchema<{
|
|
870
|
-
readonly kind: v.PicklistSchema<readonly ["button", "textField", "textarea", "numberField", "toggle", "switch", "checkbox", "radio", "radioGroup", "toggleGroup", "slider", "progress", "tabs", "collapsible", "accordion"], undefined>;
|
|
871
|
-
/** Boolean values, by value id, bound to component properties. */
|
|
872
|
-
readonly booleans: v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
|
|
873
|
-
readonly propertyId: v.StringSchema<undefined>;
|
|
874
|
-
/** For a variant property: the values that mean on and off. */
|
|
875
|
-
readonly on: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
876
|
-
readonly off: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
877
|
-
}, undefined>, undefined>;
|
|
878
|
-
/** Text values, by value id, bound to text properties. */
|
|
879
|
-
readonly texts: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
|
|
880
|
-
readonly propertyId: v.StringSchema<undefined>;
|
|
881
|
-
}, undefined>, undefined>, {}>;
|
|
882
|
-
/** Number values, by value id: the range the behaviour keeps itself. */
|
|
883
|
-
readonly numbers: v.RecordSchema<v.StringSchema<undefined>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
884
|
-
readonly min: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
885
|
-
readonly max: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
886
|
-
readonly step: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
887
|
-
readonly default: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
888
|
-
}, undefined>, v.CheckAction<{
|
|
889
|
-
min: number;
|
|
890
|
-
max: number;
|
|
891
|
-
step: number;
|
|
892
|
-
default: number;
|
|
893
|
-
}, "A number value needs max above min and a positive step">]>, undefined>;
|
|
894
|
-
/** Parts, by part id, bound to slot properties. */
|
|
895
|
-
readonly parts: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
|
|
896
|
-
readonly states: v.OptionalSchema<v.ObjectSchema<{
|
|
897
|
-
readonly rest: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
898
|
-
readonly hover: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
899
|
-
readonly pressed: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
900
|
-
readonly focus: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
901
|
-
readonly disabled: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
902
|
-
readonly propertyId: v.StringSchema<undefined>;
|
|
903
|
-
}, undefined>, undefined>;
|
|
904
|
-
}, undefined>;
|
|
905
|
-
/** How a main component behaves as a control, as kept in its plugin data. */
|
|
906
|
-
type Behaviour = v.InferOutput<typeof behaviourSchema>;
|
|
907
|
-
type BehaviourBooleanBinding = v.InferOutput<typeof BooleanBinding>;
|
|
908
|
-
type BehaviourNumberSettings = v.InferOutput<typeof NumberSettings>;
|
|
909
|
-
type BehaviourInteractionStates = v.InferOutput<typeof InteractionStates>;
|
|
910
|
-
//#endregion
|
|
911
|
-
//#region src/behaviours/model.d.ts
|
|
912
|
-
declare const DEFAULT_NUMBER_SETTINGS: BehaviourNumberSettings;
|
|
913
|
-
/** A boolean value's binding, if the behaviour has one. */
|
|
914
|
-
declare function booleanBinding(behaviour: Behaviour, valueId: string): BehaviourBooleanBinding | undefined;
|
|
915
|
-
/** The slot property a part is bound to, if any. */
|
|
916
|
-
declare function partBinding(behaviour: Behaviour, partId: string): string | undefined;
|
|
917
|
-
/** The text property a text value is bound to, if any. */
|
|
918
|
-
declare function textBinding(behaviour: Behaviour, valueId: string): string | undefined;
|
|
919
|
-
/** A number value's range, if the behaviour has one. */
|
|
920
|
-
declare function numberSettings(behaviour: Behaviour, valueId: string): BehaviourNumberSettings | undefined;
|
|
921
|
-
/** A new behaviour of a kind, its number values at their defaults and nothing bound. */
|
|
922
|
-
declare function emptyBehaviour(kind: BehaviourKind): Behaviour;
|
|
923
|
-
/**
|
|
924
|
-
* The node that keeps the behaviour: a component set for its variants, otherwise the main
|
|
925
|
-
* component itself.
|
|
926
|
-
*/
|
|
927
|
-
declare function behaviourOwner(graph: SceneGraph, node: SceneNode): SceneNode | undefined;
|
|
928
|
-
/** The behaviour a component or component set keeps, or null when it has none or it is unreadable. */
|
|
929
|
-
declare function readBehaviour(owner: SceneNode): Behaviour | null;
|
|
930
|
-
/** The owner's plugin data with the behaviour set, or removed when null. */
|
|
931
|
-
declare function withBehaviour(owner: SceneNode, behaviour: Behaviour | null): SceneNode['pluginData'];
|
|
932
|
-
/** Component properties the behaviour can bind to: the owner's, and a set's variants' own. */
|
|
933
|
-
declare function behaviourProperties(graph: SceneGraph, owner: SceneNode): ComponentPropertyDefinition[];
|
|
934
|
-
/**
|
|
935
|
-
* Required values and parts that are unbound, or bound to a property the component no longer
|
|
936
|
-
* has, by value or part id; `states` when the interaction states lost their variant property.
|
|
937
|
-
*/
|
|
938
|
-
declare function missingBindings(graph: SceneGraph, owner: SceneNode, behaviour: Behaviour): string[];
|
|
939
|
-
/**
|
|
940
|
-
* Interaction states for a variant property, each mapped to the value whose name means it, such
|
|
941
|
-
* as `Hover` or `Pressed`; states without such a value are left unset.
|
|
942
|
-
*/
|
|
943
|
-
declare function guessInteractionStates(propertyId: string, values: readonly string[]): BehaviourInteractionStates;
|
|
944
|
-
/**
|
|
945
|
-
* The behaviour with every component property id it binds renamed by `rename`, for formats that
|
|
946
|
-
* give properties new ids on write, such as `.fig` with its GUIDs.
|
|
947
|
-
*/
|
|
948
|
-
declare function renameBehaviourProperties(behaviour: Behaviour, rename: (propertyId: string) => string): Behaviour;
|
|
949
|
-
//#endregion
|
|
950
|
-
//#region src/behaviours/spec.d.ts
|
|
951
|
-
/**
|
|
952
|
-
* A behaviour as scripts, tools, and JSX write it: component properties and slots by name, not
|
|
953
|
-
* by id. Values are boolean or text values by their contract id; numbers are a slider's or
|
|
954
|
-
* number field's own range.
|
|
955
|
-
*/
|
|
956
|
-
declare const behaviourSpecSchema: v.ObjectSchema<{
|
|
957
|
-
readonly kind: v.PicklistSchema<readonly ["button", "textField", "textarea", "numberField", "toggle", "switch", "checkbox", "radio", "radioGroup", "toggleGroup", "slider", "progress", "tabs", "collapsible", "accordion"], undefined>;
|
|
958
|
-
readonly values: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnionSchema<[v.StringSchema<undefined>, v.ObjectSchema<{
|
|
959
|
-
readonly property: v.StringSchema<undefined>;
|
|
960
|
-
readonly on: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
961
|
-
readonly off: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
962
|
-
}, undefined>], undefined>, undefined>, undefined>;
|
|
963
|
-
readonly numbers: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
|
|
964
|
-
readonly min: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
965
|
-
readonly max: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
966
|
-
readonly step: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
967
|
-
readonly default: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
968
|
-
}, undefined>, undefined>, undefined>;
|
|
969
|
-
readonly parts: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>, undefined>;
|
|
970
|
-
readonly states: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.ObjectSchema<{
|
|
971
|
-
readonly rest: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
972
|
-
readonly hover: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
973
|
-
readonly pressed: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
974
|
-
readonly focus: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
975
|
-
readonly disabled: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
976
|
-
readonly property: v.StringSchema<undefined>;
|
|
977
|
-
}, undefined>], undefined>, undefined>;
|
|
978
|
-
}, undefined>;
|
|
979
|
-
type BehaviourSpec = v.InferOutput<typeof behaviourSpecSchema>;
|
|
980
|
-
/**
|
|
981
|
-
* The variant values that likely mean on and off: names such as On, True, or Checked first,
|
|
982
|
-
* then the values in order.
|
|
983
|
-
*/
|
|
984
|
-
declare function guessOnOff(options: readonly string[], explicit?: {
|
|
985
|
-
on?: string;
|
|
986
|
-
off?: string;
|
|
987
|
-
}): {
|
|
988
|
-
on?: string;
|
|
989
|
-
off?: string;
|
|
990
|
-
};
|
|
991
|
-
/**
|
|
992
|
-
* The stored behaviour for a spec, with names resolved to the owner's property and slot ids. A
|
|
993
|
-
* name the component lacks, a value the kind does not have, or a variant value the property
|
|
994
|
-
* does not offer fails with a message naming what exists.
|
|
995
|
-
*/
|
|
996
|
-
declare function behaviourFromSpec(graph: SceneGraph, owner: SceneNode, spec: BehaviourSpec): Behaviour;
|
|
997
|
-
/** The spec a stored behaviour reads as, with ids back to names; unresolved bindings are left out. */
|
|
998
|
-
declare function behaviourToSpec(graph: SceneGraph, owner: SceneNode, behaviour: Behaviour): BehaviourSpec;
|
|
999
|
-
//#endregion
|
|
1000
|
-
//#region src/comments/document.d.ts
|
|
1001
|
-
/**
|
|
1002
|
-
* A document's comment threads, deleted ones included. Comments are part of the document: they
|
|
1003
|
-
* live in OpenPencil's plugin data on the document node, so they travel with the `.fig` file,
|
|
1004
|
-
* its storage copy and a collaboration room, and Figma or an older OpenPencil open the file as
|
|
1005
|
-
* before.
|
|
1006
|
-
*/
|
|
1007
|
-
declare function readComments(graph: SceneGraph): CommentThread[];
|
|
1008
|
-
/**
|
|
1009
|
-
* Stores the threads on the document node. This is a document change, so the document asks to
|
|
1010
|
-
* be saved, but not an undo step: undoing a layer edit never takes back a comment.
|
|
1011
|
-
*/
|
|
1012
|
-
declare function writeComments(graph: SceneGraph, threads: readonly CommentThread[]): void;
|
|
1013
|
-
/**
|
|
1014
|
-
* `entries` holding the comments of `live` instead of their own. Undo and redo restore the
|
|
1015
|
-
* document node with this, so they leave comments as they are now.
|
|
1016
|
-
*/
|
|
1017
|
-
declare function withLiveComments(entries: readonly PluginDataEntry[], live: readonly PluginDataEntry[]): PluginDataEntry[];
|
|
1018
|
-
//#endregion
|
|
1019
|
-
//#region src/comments/list.d.ts
|
|
1020
|
-
declare const COMMENT_SORTS: readonly ["newest", "oldest"];
|
|
1021
|
-
type CommentSort = (typeof COMMENT_SORTS)[number];
|
|
1022
|
-
interface CommentListOptions {
|
|
1023
|
-
query: string;
|
|
1024
|
-
showResolved: boolean;
|
|
1025
|
-
/** Only threads on `pageId`. */
|
|
1026
|
-
onlyPage: boolean;
|
|
1027
|
-
pageId: string;
|
|
1028
|
-
/** Only threads `author` started or replied to. */
|
|
1029
|
-
onlyMine: boolean;
|
|
1030
|
-
author: string;
|
|
1031
|
-
sort: CommentSort;
|
|
1032
|
-
}
|
|
1033
|
-
/**
|
|
1034
|
-
* Each thread's number, counted in the order threads were started, as Figma numbers them in its
|
|
1035
|
-
* list. Deleted threads keep their place so the numbers people refer to do not shift.
|
|
1036
|
-
*/
|
|
1037
|
-
declare function commentThreadNumbers(threads: readonly CommentThread[]): Map<string, number>;
|
|
1038
|
-
/** The threads the comments list shows for its search, filters and order. */
|
|
1039
|
-
declare function listCommentThreads(threads: readonly CommentThread[], options: CommentListOptions): CommentThread[];
|
|
1040
|
-
//#endregion
|
|
1041
|
-
//#region src/comments/merge.d.ts
|
|
1042
|
-
/**
|
|
1043
|
-
* Two copies of a document's comments become one. Nothing is lost: threads and replies are
|
|
1044
|
-
* joined by id, and for a thread both copies changed, the newer edit wins while replies from
|
|
1045
|
-
* both are kept. Deleted threads and replies stay deleted.
|
|
1046
|
-
*/
|
|
1047
|
-
declare function mergeCommentThreads(local: readonly CommentThread[], remote: readonly CommentThread[]): CommentThread[];
|
|
1048
|
-
/**
|
|
1049
|
-
* Whether `local` holds anything `remote` lacks: a thread or reply it does not have, a newer edit,
|
|
1050
|
-
* or a deletion. Merging is then needed; otherwise `remote` already says everything.
|
|
1051
|
-
*/
|
|
1052
|
-
declare function hasNewerComments(local: readonly CommentThread[], remote: readonly CommentThread[]): boolean;
|
|
1053
|
-
//#endregion
|
|
1054
|
-
//#region src/comments/threads.d.ts
|
|
1055
|
-
/** Who writes a comment: their name and, in a collaboration room, their color. */
|
|
1056
|
-
interface CommentAuthor {
|
|
1057
|
-
name: string;
|
|
1058
|
-
color?: Color;
|
|
1059
|
-
}
|
|
1060
|
-
/** When a comment is written or changed, as stored: an ISO timestamp. */
|
|
1061
|
-
declare function commentTimestamp(): string;
|
|
1062
|
-
/** Oldest first, the order threads and replies are shown and numbered in. */
|
|
1063
|
-
declare function byCreatedAt(a: {
|
|
1064
|
-
createdAt: string;
|
|
1065
|
-
}, b: {
|
|
1066
|
-
createdAt: string;
|
|
1067
|
-
}): number;
|
|
1068
|
-
/** A thread's replies, without the deleted ones kept as tombstones. */
|
|
1069
|
-
declare function liveReplies(thread: CommentThread): CommentReply[];
|
|
1070
|
-
/** Whether `author` started the thread or replied to it, as Figma's "Only your threads" counts. */
|
|
1071
|
-
declare function takesPartInThread(thread: CommentThread, author: string): boolean;
|
|
1072
|
-
/** The thread with `id`, unless it is missing or deleted. */
|
|
1073
|
-
declare function findLiveCommentThread(threads: readonly CommentThread[], id: string): CommentThread | undefined;
|
|
1074
|
-
/**
|
|
1075
|
-
* Where a pin at a canvas point is kept: on the top-level layer under it, or on `node`'s when
|
|
1076
|
-
* given, so it follows that layer; on the canvas when nothing is there.
|
|
1077
|
-
*/
|
|
1078
|
-
declare function commentAnchor(graph: SceneGraph, pageId: string, at: Vector, node?: SceneNode): {
|
|
1079
|
-
nodeId: string | null;
|
|
1080
|
-
nodeName: string | null;
|
|
1081
|
-
offsetX: number;
|
|
1082
|
-
offsetY: number;
|
|
1083
|
-
x: number;
|
|
1084
|
-
y: number;
|
|
1085
|
-
};
|
|
1086
|
-
/** Where a thread's pin is now: on its layer while that layer exists, else where it was left. */
|
|
1087
|
-
declare function commentPosition(graph: SceneGraph, thread: CommentThread): Vector;
|
|
1088
|
-
/** A new thread pinned at a canvas point of a page. */
|
|
1089
|
-
declare function createCommentThread(graph: SceneGraph, options: {
|
|
1090
|
-
pageId: string;
|
|
1091
|
-
at: Vector;
|
|
1092
|
-
/** Pin it on this layer's top-level layer rather than on whatever is at `at`. */
|
|
1093
|
-
node?: SceneNode;
|
|
1094
|
-
author: CommentAuthor;
|
|
1095
|
-
text: string;
|
|
1096
|
-
now: string;
|
|
1097
|
-
}): CommentThread;
|
|
1098
|
-
declare function createCommentReply(author: CommentAuthor, text: string, now: string): CommentReply;
|
|
1099
|
-
/** The threads with one changed and marked as edited at `now`, for merging with other copies. */
|
|
1100
|
-
declare function editCommentThread(threads: readonly CommentThread[], id: string, now: string, edit: (thread: CommentThread) => CommentThread): CommentThread[];
|
|
1101
|
-
/** A reply ends up in the thread and reopens it, as answering a resolved comment does. */
|
|
1102
|
-
declare function replyToCommentThread(thread: CommentThread, reply: CommentReply): CommentThread;
|
|
1103
|
-
declare function resolveCommentThread(thread: CommentThread, resolved: boolean, now: string): CommentThread;
|
|
1104
|
-
/** Deleted threads and replies stay as tombstones, so a stale copy cannot bring them back. */
|
|
1105
|
-
declare function deleteCommentThread(thread: CommentThread): CommentThread;
|
|
1106
|
-
declare function deleteCommentReply(thread: CommentThread, replyId: string): CommentThread;
|
|
1107
|
-
//#endregion
|
|
1108
|
-
//#region src/copy.d.ts
|
|
1109
|
-
/** Generic over the paint shape so a stroke keeps its own fields while the paint deep-copies. */
|
|
1110
|
-
declare function copyFill<T extends Fill>(f: T): T;
|
|
1111
|
-
declare function copyStroke(s: Stroke): Stroke;
|
|
1112
|
-
declare function copyEffect(e: Effect): Effect;
|
|
1113
|
-
declare function copyStyleRun(r: StyleRun): StyleRun;
|
|
1114
|
-
/** Record immutable lineage for an internal deep copy without sharing mutable values. */
|
|
1115
|
-
declare function markCopySource<T extends object>(source: T, copy: T): T;
|
|
1116
|
-
/** Compare internal deep copies in O(1) without traversing large paint or text payloads. */
|
|
1117
|
-
declare function hasSameCopySource(left: object, right: object): boolean;
|
|
1118
|
-
declare function copyFills(fills: Fill[]): Fill[];
|
|
1119
|
-
declare function copyStrokes(strokes: Stroke[]): Stroke[];
|
|
1120
|
-
declare function copyEffects(effects: Effect[]): Effect[];
|
|
1121
|
-
declare function copyLayoutGrids(grids: LayoutGrid[]): LayoutGrid[];
|
|
1122
|
-
declare function copyStyleRuns(runs: StyleRun[]): StyleRun[];
|
|
1123
|
-
declare function copyGeometryPaths(paths: GeometryPath[]): GeometryPath[];
|
|
1124
|
-
/**
|
|
1125
|
-
* Affine-transform every coordinate pair in a path command blob (returns a
|
|
1126
|
-
* copy): (x, y) → (m00·x + m01·y + tx, m10·x + m11·y + ty).
|
|
1127
|
-
* Command layout: 1=move/2=line (1 pair), 3=quad (2 pairs), 4=cubic (3 pairs)
|
|
1128
|
-
* — font-glyph blobs are quad-heavy, so skipping command 3 desyncs the walk.
|
|
1129
|
-
*/
|
|
1130
|
-
declare function transformGeometryBlob(blob: Uint8Array, m00: number, m01: number, m10: number, m11: number, tx?: number, ty?: number): Uint8Array;
|
|
1131
|
-
declare function transformGeometryPaths(paths: GeometryPath[], m00: number, m01: number, m10: number, m11: number, tx?: number, ty?: number): GeometryPath[];
|
|
1132
|
-
/**
|
|
1133
|
-
* Scale path command blob coordinates by (sx, sy).
|
|
1134
|
-
* Identity scale returns a deep copy (same as copyGeometryPaths).
|
|
1135
|
-
*/
|
|
1136
|
-
declare function scaleGeometryPaths(paths: GeometryPath[], sx: number, sy: number): GeometryPath[];
|
|
1137
|
-
/** Deep-copy path-text glyphs (fresh commandsBlob buffers). */
|
|
1138
|
-
declare function copyDerivedGlyphs(glyphs: DerivedTextGlyph[] | null): DerivedTextGlyph[] | null;
|
|
1139
|
-
/**
|
|
1140
|
-
* Build the init props for a deep-copy clone of `src`.
|
|
1141
|
-
* Shares logic between SceneGraph.cloneTree and instance child cloning.
|
|
1142
|
-
* Explicitly deep-copies all mutable object/array fields that `...rest`
|
|
1143
|
-
* would otherwise share by reference. When adding a mutable SceneNode field,
|
|
1144
|
-
* add its copy behavior here or document why sharing is intentional.
|
|
1145
|
-
*/
|
|
1146
|
-
type NodeCloneMode = 'deep' | 'fig-import';
|
|
1147
|
-
declare function cloneNodeProps(src: SceneNode, componentId: string | null, mode?: NodeCloneMode): Partial<SceneNode>;
|
|
1148
|
-
//#endregion
|
|
1149
|
-
//#region src/node-defaults.d.ts
|
|
1150
|
-
declare function createDefaultSourceMetadata(): SourceMetadata;
|
|
1151
|
-
/** Where Figma aligns a new node's strokes: centered on lines and vectors, outside text, else inside. */
|
|
1152
|
-
declare function defaultStrokeAlign(type: NodeType): SceneNode['strokeAlign'];
|
|
1153
|
-
/**
|
|
1154
|
-
* Weight and alignment a stroke added to `node` takes: its first stroke's, or what the node keeps
|
|
1155
|
-
* with none. Adding a stroke from the panel and from the plugin API both go through here.
|
|
1156
|
-
*/
|
|
1157
|
-
declare function newStrokeGeometry(node: Pick<SceneNode, 'strokes' | 'strokeWeight' | 'strokeAlign'>): Pick<SceneNode['strokes'][number], 'weight' | 'align'>;
|
|
1158
|
-
declare function createDefaultNode(generateId: () => string, type: NodeType, overrides?: Partial<SceneNode>): SceneNode;
|
|
1159
|
-
/** Containers whose bounds follow their children and that set no coordinate space, as in Figma. */
|
|
1160
|
-
declare const FITTED_CONTAINER_TYPES: ReadonlySet<NodeType>;
|
|
1161
|
-
declare const CONTAINER_TYPES: Set<NodeType>;
|
|
1162
|
-
//#endregion
|
|
1163
|
-
//#region src/instances/fields.d.ts
|
|
1164
|
-
declare const INSTANCE_SYNC_TEXT_PROPS: readonly ["name", "text", "fontSize", "fontWeight", "fontFamily", "italic", "textDirection", "letterSpacing", "lineHeight", "textCase", "textDecoration", "textDecorationStyle", "textDecorationThickness", "textUnderlineOffset", "textDecorationFills", "textDecorationSkipInk", "textAlignHorizontal", "textAlignVertical", "textAutoResize", "textTruncation", "maxLines", "leadingTrim", "paragraphSpacing", "paragraphIndent", "listSpacing", "hangingList", "fontVariations", "fontFeatures", "styleRuns", "textParagraphs"];
|
|
1165
|
-
declare const INSTANCE_SYNC_PROPS: (keyof SceneNode)[];
|
|
1166
|
-
/**
|
|
1167
|
-
* Where a component's layer sits and how it is shaped, which Figma refuses to override in an
|
|
1168
|
-
* instance ("This property cannot be overridden in an instance"), so its copies always follow.
|
|
1169
|
-
* A layer in an auto layout flow takes its position from the layout instead.
|
|
1170
|
-
*/
|
|
1171
|
-
declare const INSTANCE_FOLLOWED_FIELDS: readonly ["x", "y", "rotation", "flipX", "flipY", "horizontalConstraint", "verticalConstraint", "layoutPositioning", "counterAxisAlignContent", "isMask", "maskType", "arcData", "pointCount", "starInnerRadius"];
|
|
1172
|
-
/** Fields an edit to a layer inside an instance records as that instance's override. */
|
|
1173
|
-
declare const INSTANCE_OVERRIDE_FIELDS: readonly [...(keyof SceneNode)[], "name", "text", "fontSize", "fontWeight", "fontFamily", "italic", "textDirection", "letterSpacing", "lineHeight", "textCase", "textDecoration", "textDecorationStyle", "textDecorationThickness", "textUnderlineOffset", "textDecorationFills", "textDecorationSkipInk", "textAlignHorizontal", "textAlignVertical", "textAutoResize", "textTruncation", "maxLines", "leadingTrim", "paragraphSpacing", "paragraphIndent", "listSpacing", "hangingList", "fontVariations", "fontFeatures", "styleRuns", "textParagraphs", "layoutGrow", "layoutAlignSelf", "locked", "visible"];
|
|
1174
|
-
/** Fields a component's layer gives the copies of it in every instance. */
|
|
1175
|
-
declare const INSTANCE_SYNC_FIELDS: readonly [...(keyof SceneNode)[], "name", "text", "fontSize", "fontWeight", "fontFamily", "italic", "textDirection", "letterSpacing", "lineHeight", "textCase", "textDecoration", "textDecorationStyle", "textDecorationThickness", "textUnderlineOffset", "textDecorationFills", "textDecorationSkipInk", "textAlignHorizontal", "textAlignVertical", "textAutoResize", "textTruncation", "maxLines", "leadingTrim", "paragraphSpacing", "paragraphIndent", "listSpacing", "hangingList", "fontVariations", "fontFeatures", "styleRuns", "textParagraphs", "layoutGrow", "layoutAlignSelf", "locked", "visible", "x", "y", "rotation", "flipX", "flipY", "horizontalConstraint", "verticalConstraint", "layoutPositioning", "counterAxisAlignContent", "isMask", "maskType", "arcData", "pointCount", "starInnerRadius"];
|
|
1176
|
-
//#endregion
|
|
1177
|
-
//#region src/instances.d.ts
|
|
1178
|
-
declare function copyInstanceComponentProps(component: SceneNode): Partial<SceneNode>;
|
|
1179
|
-
declare function createInstance(graph: SceneGraph, componentId: string, parentId: string, overrides?: Partial<SceneNode>): SceneNode | null;
|
|
1180
|
-
declare function populateInstanceChildren(graph: SceneGraph, instanceId: string, componentId: string, mode?: NodeCloneMode): void;
|
|
1181
|
-
interface SwapInstanceOptions {
|
|
1182
|
-
/**
|
|
1183
|
-
* Keep the instance's name even when it is its old component's. A swap otherwise renames such
|
|
1184
|
-
* an instance after the new component, as Figma does; a view that only shows another variant,
|
|
1185
|
-
* such as preview, keeps names so layer paths stay the same.
|
|
1186
|
-
*/
|
|
1187
|
-
keepName?: boolean;
|
|
1188
|
-
}
|
|
1189
|
-
declare function swapInstanceComponent(graph: SceneGraph, instanceId: string, componentId: string, { keepName }?: SwapInstanceOptions): void;
|
|
1190
|
-
declare function syncInstances(graph: SceneGraph, componentId: string): void;
|
|
1191
|
-
/**
|
|
1192
|
-
* Syncs each component's instances, in order, as one edit: the copies they remove stay
|
|
1193
|
-
* restorable together for as long as undo keeps that edit.
|
|
1194
|
-
*/
|
|
1195
|
-
declare function syncInstancesTogether(graph: SceneGraph, componentIds: Iterable<string>): void;
|
|
1196
|
-
/** Syncs one instance from its component, as `syncInstances` does for every instance. */
|
|
1197
|
-
declare function syncInstance(graph: SceneGraph, instanceId: string): void;
|
|
1198
|
-
declare function detachInstance(graph: SceneGraph, instanceId: string): void;
|
|
1199
|
-
declare function getMainComponent(graph: SceneGraph, instanceId: string): SceneNode | undefined;
|
|
1200
|
-
declare function getInstances(graph: SceneGraph, componentId: string): SceneNode[];
|
|
1201
|
-
/** Nearest INSTANCE at or above `nodeId` — self, parent, grandparent, etc. */
|
|
1202
|
-
declare function findInstanceAncestor(graph: SceneGraph, nodeId: string): SceneNode | undefined;
|
|
1203
|
-
/**
|
|
1204
|
-
* True when a node field is protected from instance synchronization.
|
|
1205
|
-
*/
|
|
1206
|
-
declare function hasInstanceOverride(graph: SceneGraph, nodeId: string, field: string): boolean;
|
|
1207
|
-
declare function recordInstanceOverride(graph: SceneGraph, nodeId: string, fields: Iterable<string>): void;
|
|
1208
|
-
//#endregion
|
|
1209
|
-
//#region src/snap.d.ts
|
|
1210
|
-
interface SnapGuide {
|
|
1211
|
-
axis: 'x' | 'y';
|
|
1212
|
-
position: number;
|
|
1213
|
-
from: number;
|
|
1214
|
-
to: number;
|
|
1215
|
-
}
|
|
1216
|
-
interface SnapResult {
|
|
1217
|
-
dx: number;
|
|
1218
|
-
dy: number;
|
|
1219
|
-
guides: SnapGuide[];
|
|
1220
|
-
}
|
|
1221
|
-
declare function computeSnap(movingIds: Set<string>, movingBounds: Rect, allNodes: SceneNode[], threshold?: number): SnapResult;
|
|
1222
|
-
declare function computeSelectionBounds(nodes: SceneNode[]): Rect | null;
|
|
1223
|
-
//#endregion
|
|
1224
|
-
//#region src/export-scale.d.ts
|
|
1225
|
-
/**
|
|
1226
|
-
* Bounds for export scale multipliers. A huge multiplier would allocate an
|
|
1227
|
-
* enormous canvas and crash the renderer, so clamp at every boundary the value
|
|
1228
|
-
* can enter from: the UI (edits) and the file format (imported/plugin .fig data).
|
|
1229
|
-
*/
|
|
1230
|
-
declare const MIN_EXPORT_SCALE = 0.01;
|
|
1231
|
-
declare const MAX_EXPORT_SCALE = 1024;
|
|
1232
|
-
declare function clampExportScale(scale: number): number;
|
|
1233
|
-
/** Accept a scale only if it is finite and within bounds (no silent clamping). */
|
|
1234
|
-
declare function isValidExportScale(scale: number): boolean;
|
|
1235
|
-
//#endregion
|
|
1236
|
-
//#region src/coordinate.d.ts
|
|
1237
|
-
declare function getWorldMatrix(node: SceneNode, graph: Pick<SceneGraph, 'getNode'>): Mat3;
|
|
1238
|
-
declare function getAxisAlignedWorldBounds(node: SceneNode, graph: Pick<SceneGraph, 'getNode'>): Rect;
|
|
1239
|
-
/** World matrix of a parent; the document root and a missing parent are the identity. */
|
|
1240
|
-
declare function getParentWorldMatrix(parent: SceneNode | undefined, graph: Pick<SceneGraph, 'getNode' | 'rootId'>): Mat3;
|
|
1241
|
-
/**
|
|
1242
|
-
* Axis-aligned box of `nodes` in `parentId`'s own axes: where a group, frame, or boolean operation
|
|
1243
|
-
* made from them sits. Each node's corners are mapped through the parent's inverse world matrix,
|
|
1244
|
-
* so a rotated or flipped parent gets a box in its own axes and the nodes keep their drawn places
|
|
1245
|
-
* once they move into the container.
|
|
1246
|
-
*/
|
|
1247
|
-
declare function getAxisAlignedBoundsInParent(nodes: readonly SceneNode[], parentId: string, graph: Pick<SceneGraph, 'getNode' | 'rootId'>): Rect;
|
|
1248
|
-
declare function getAbsolutePosition(node: SceneNode, graph: SceneGraph): Vector;
|
|
1249
|
-
declare function getAbsoluteRotation(node: SceneNode, graph: SceneGraph): number;
|
|
1250
|
-
declare function getAbsolutePositionFull(node: SceneNode, graph: SceneGraph): {
|
|
1251
|
-
x: number;
|
|
1252
|
-
y: number;
|
|
1253
|
-
boundX: number;
|
|
1254
|
-
boundY: number;
|
|
1255
|
-
width: number;
|
|
1256
|
-
height: number;
|
|
1257
|
-
rotation: number;
|
|
1258
|
-
centerX: number;
|
|
1259
|
-
centerY: number;
|
|
1260
|
-
};
|
|
1261
|
-
/** Lines retain their origin pivot; other shapes rotate around their center. */
|
|
1262
|
-
declare function getNodeRotationOrigin(node: SceneNode): Vector;
|
|
1263
|
-
/** Position can be applied separately by renderers before setting up local opacity layers. */
|
|
1264
|
-
declare function getNodeLocalMatrix(n: SceneNode, position?: Vector): Mat3;
|
|
1265
|
-
declare function getNodeWorldBounds(node: SceneNode): Rect;
|
|
1266
|
-
/**
|
|
1267
|
-
* World-space positions of the 8 selection handles. `localRect` overrides the
|
|
1268
|
-
* node-local box the handles sit on — text-on-path draws its handles on the
|
|
1269
|
-
* glyph-fitted path box, not node bounds, so its hit-test must pass that box
|
|
1270
|
-
* or the visible handles are ~25px off and unclickable. Defaults to full node
|
|
1271
|
-
* bounds.
|
|
1272
|
-
*/
|
|
1273
|
-
declare function getWorldHandles(node: SceneNode, graph: Pick<SceneGraph, 'getNode'>, localRect?: Rect): {
|
|
1274
|
-
nw: {
|
|
1275
|
-
x: number;
|
|
1276
|
-
y: number;
|
|
1277
|
-
};
|
|
1278
|
-
n: {
|
|
1279
|
-
x: number;
|
|
1280
|
-
y: number;
|
|
1281
|
-
};
|
|
1282
|
-
ne: {
|
|
1283
|
-
x: number;
|
|
1284
|
-
y: number;
|
|
1285
|
-
};
|
|
1286
|
-
e: {
|
|
1287
|
-
x: number;
|
|
1288
|
-
y: number;
|
|
1289
|
-
};
|
|
1290
|
-
se: {
|
|
1291
|
-
x: number;
|
|
1292
|
-
y: number;
|
|
1293
|
-
};
|
|
1294
|
-
s: {
|
|
1295
|
-
x: number;
|
|
1296
|
-
y: number;
|
|
1297
|
-
};
|
|
1298
|
-
sw: {
|
|
1299
|
-
x: number;
|
|
1300
|
-
y: number;
|
|
1301
|
-
};
|
|
1302
|
-
w: {
|
|
1303
|
-
x: number;
|
|
1304
|
-
y: number;
|
|
1305
|
-
};
|
|
1306
|
-
};
|
|
1307
|
-
type LocalTransform = Pick<SceneNode, 'x' | 'y' | 'rotation' | 'flipX' | 'flipY'>;
|
|
1308
|
-
/**
|
|
1309
|
-
* Local transform that draws `node` with the given world matrix once it sits under a parent
|
|
1310
|
-
* whose world matrix is `parentWorld`. Keeps the node's own `flipX` when the matrix allows it.
|
|
1311
|
-
*/
|
|
1312
|
-
declare function localTransformFromWorld(node: SceneNode, world: Mat3, parentWorld: Mat3): LocalTransform | null;
|
|
1313
|
-
declare function isTranslationOnly(matrix: Mat3): boolean;
|
|
1314
|
-
/**
|
|
1315
|
-
* Maps a node's parent space into its container's: through the groups and booleans around it,
|
|
1316
|
-
* which set no coordinate space of their own. Figma's plugin API reports `x`, `y`, and
|
|
1317
|
-
* `relativeTransform` of their children in the container's space. The identity when the parent is
|
|
1318
|
-
* not a group.
|
|
1319
|
-
*/
|
|
1320
|
-
declare function getParentToContainerMatrix(node: SceneNode, graph: Pick<SceneGraph, 'getNode'>): Mat3;
|
|
1321
|
-
//#endregion
|
|
1322
|
-
//#region src/layout/aspect-ratio.d.ts
|
|
1323
|
-
type AspectRatioNode = Pick<SceneNode, 'type' | 'targetAspectRatio' | 'textAutoResize'>;
|
|
1324
|
-
/** The value Figma's `lockAspectRatio()` stores: the size the layer has when it is locked. */
|
|
1325
|
-
declare function lockedAspectRatioTarget(width: number, height: number): Vector;
|
|
1326
|
-
/** Whether the lock can change: a layer inside an instance keeps its component's, as in Figma. */
|
|
1327
|
-
declare function aspectRatioLockEditable(graph: SceneGraph, node: SceneNode): boolean;
|
|
1328
|
-
/**
|
|
1329
|
-
* The width-to-height ratio a resize keeps, or `null` when the layer's proportions are free.
|
|
1330
|
-
* Text that sizes itself to its content keeps the lock without following it, as in Figma.
|
|
1331
|
-
*/
|
|
1332
|
-
declare function enforcedAspectRatio(node: AspectRatioNode): number | null;
|
|
1333
|
-
/**
|
|
1334
|
-
* A resize that ignores a locked ratio, such as Figma's plugin `resize()` or a Control-drag,
|
|
1335
|
-
* keeps the lock and stores the new size as the ratio to keep.
|
|
1336
|
-
*/
|
|
1337
|
-
declare function recapturedAspectRatio(node: Pick<SceneNode, 'targetAspectRatio'>, width: number, height: number): Partial<Pick<SceneNode, 'targetAspectRatio'>>;
|
|
1338
|
-
/** The size that keeps `ratio` when one axis is set to `value`. */
|
|
1339
|
-
declare function sizeKeepingAspectRatio(ratio: number, axis: 'width' | 'height', value: number): {
|
|
1340
|
-
width: number;
|
|
1341
|
-
height: number;
|
|
1342
|
-
};
|
|
1343
|
-
//#endregion
|
|
1344
|
-
//#region src/layout/guides.d.ts
|
|
1345
|
-
interface LayoutGuideLine {
|
|
1346
|
-
axis: 'x' | 'y';
|
|
1347
|
-
position: number;
|
|
1348
|
-
}
|
|
1349
|
-
/** Figma's Auto count, as its archive stores it: as many sections as fit. */
|
|
1350
|
-
declare const AUTO_LAYOUT_GRID_COUNT = 2147483647;
|
|
1351
|
-
/** Whether a guide's count is Auto: the archive's value, or the plugin API's `Infinity` or `null`. */
|
|
1352
|
-
declare function isAutoGridCount(count: number | null | undefined): boolean;
|
|
1353
|
-
/**
|
|
1354
|
-
* A guide's count, set in Figma's plugin shape (`count`) or read from a file (`numSections`); an
|
|
1355
|
-
* edit's `count` wins over the count the file had. Auto is {@link AUTO_LAYOUT_GRID_COUNT}.
|
|
1356
|
-
*/
|
|
1357
|
-
declare function layoutGridCount(grid: LayoutGrid): number;
|
|
1358
|
-
interface LayoutGuideSection {
|
|
1359
|
-
axis: 'x' | 'y';
|
|
1360
|
-
start: number;
|
|
1361
|
-
end: number;
|
|
1362
|
-
}
|
|
1363
|
-
declare function layoutGuideSections(node: Pick<SceneNode, 'width' | 'height'>, grid: LayoutGrid): LayoutGuideSection[];
|
|
1364
|
-
declare function layoutGuideLines(node: Pick<SceneNode, 'width' | 'height'>, grid: LayoutGrid): LayoutGuideLine[];
|
|
1365
|
-
//#endregion
|
|
1366
|
-
//#region src/layout/keywords.d.ts
|
|
1367
|
-
/**
|
|
1368
|
-
* Auto layout as the formats that author it spell it: flexbox keywords from CSS, design JSX,
|
|
1369
|
-
* and `.pen` files. Each format keeps its own syntax and defaults; what a keyword means for the
|
|
1370
|
-
* scene graph is decided here once, so `space-between` or `baseline` cannot mean one thing in
|
|
1371
|
-
* one format and fall back to start in another.
|
|
1372
|
-
*/
|
|
1373
|
-
type AutoLayoutDirection = 'HORIZONTAL' | 'VERTICAL';
|
|
1374
|
-
/** The stack direction a `flex-direction`-like keyword names, or `undefined` for any other. */
|
|
1375
|
-
declare function parseAutoLayoutDirection(value: string | undefined): AutoLayoutDirection | undefined;
|
|
1376
|
-
/**
|
|
1377
|
-
* Primary axis alignment from a `justify-content` keyword. Auto layout has no
|
|
1378
|
-
* `space-around` or `space-evenly`, so those, like unknown keywords, give `undefined`.
|
|
1379
|
-
*/
|
|
1380
|
-
declare function parsePrimaryAxisAlign(value: string | undefined): LayoutAlign | undefined;
|
|
1381
|
-
/** Cross axis alignment of a stack's children from an `align-items` keyword. */
|
|
1382
|
-
declare function parseCounterAxisAlign(value: string | undefined): LayoutCounterAlign | undefined;
|
|
1383
|
-
/** One child's cross axis alignment from an `align-self` keyword; `auto` follows the parent. */
|
|
1384
|
-
declare function parseLayoutAlignSelf(value: string | undefined): LayoutAlignSelf | undefined;
|
|
1385
|
-
type PaddingFields = Pick<SceneNode, 'paddingTop' | 'paddingRight' | 'paddingBottom' | 'paddingLeft'>;
|
|
1386
|
-
/** Padding from one to four values in CSS shorthand order: top, right, bottom, left. */
|
|
1387
|
-
declare function paddingFromShorthand(values: readonly number[]): PaddingFields;
|
|
1388
|
-
//#endregion
|
|
1389
|
-
//#region src/layout/sizing.d.ts
|
|
1390
|
-
/**
|
|
1391
|
-
* How a node sizes along one screen axis, as Figma's `layoutSizingHorizontal` and
|
|
1392
|
-
* `layoutSizingVertical` report it. Fill is stored on the child, the way Figma stores it:
|
|
1393
|
-
* along the parent's primary axis as `layoutGrow`, across it as `layoutAlignSelf: 'STRETCH'`.
|
|
1394
|
-
* A grid lays its children out like a horizontal stack. Hug is stored on the node itself:
|
|
1395
|
-
* `primaryAxisSizing` and `counterAxisSizing` for an auto-layout frame, `textAutoResize`
|
|
1396
|
-
* for text.
|
|
1397
|
-
*/
|
|
1398
|
-
type LayoutSizingAxis = 'HORIZONTAL' | 'VERTICAL';
|
|
1399
|
-
type AutoLayoutMode = Exclude<SceneNode['layoutMode'], 'NONE'>;
|
|
1400
|
-
/** The node's sizing along `axis`: fill from its parent, else its own hug, else fixed. */
|
|
1401
|
-
declare function layoutSizing(graph: SceneGraph, node: SceneNode, axis: LayoutSizingAxis): LayoutSizing;
|
|
1402
|
-
/** `layoutSizing` for code that holds the parent rather than the graph. */
|
|
1403
|
-
declare function layoutSizingInParent(parentNode: SceneNode | undefined, node: SceneNode, axis: LayoutSizingAxis): LayoutSizing;
|
|
1404
|
-
/** The sizings this node accepts on either axis, in Figma's order. */
|
|
1405
|
-
declare function layoutSizingOptions(graph: SceneGraph, node: SceneNode): LayoutSizing[];
|
|
1406
|
-
/** Figma's reason for refusing `value` on this node, or `undefined` when it applies. */
|
|
1407
|
-
declare function layoutSizingError(graph: SceneGraph, node: SceneNode, value: LayoutSizing): string | undefined;
|
|
1408
|
-
/** The text auto-resize that hugs the content along the axes given. */
|
|
1409
|
-
declare function textAutoResizeFor(hugsWidth: boolean, hugsHeight: boolean): TextAutoResize;
|
|
1410
|
-
/**
|
|
1411
|
-
* The fields that set the node's sizing along `axis` to `value`, as Figma's setter writes
|
|
1412
|
-
* them. A value Figma refuses yields no updates; `layoutSizingError` says why.
|
|
1413
|
-
*/
|
|
1414
|
-
declare function layoutSizingUpdates(graph: SceneGraph, node: SceneNode, axis: LayoutSizingAxis, value: LayoutSizing): Partial<SceneNode>;
|
|
1415
|
-
/**
|
|
1416
|
-
* The fields that make a child fill `axis` of a parent laid out as `parentLayout`, for a node
|
|
1417
|
-
* an importer builds before it joins the graph. Under a parent without auto layout, such as a
|
|
1418
|
-
* staging parent the node leaves when placed, both are set, so it fills whichever axis its
|
|
1419
|
-
* eventual parent stacks along.
|
|
1420
|
-
*/
|
|
1421
|
-
declare function fillSizingFields(parentLayout: SceneNode['layoutMode'], axis: LayoutSizingAxis): Partial<Pick<SceneNode, 'layoutGrow' | 'layoutAlignSelf'>>;
|
|
1422
|
-
/** An auto-layout frame's own sizing when it hugs or fixes its width and height. */
|
|
1423
|
-
declare function autoLayoutSizingFields(direction: AutoLayoutMode, width: 'FIXED' | 'HUG', height: 'FIXED' | 'HUG'): Pick<SceneNode, 'primaryAxisSizing' | 'counterAxisSizing'>;
|
|
1424
|
-
//#endregion
|
|
1425
|
-
//#region src/text/paragraphs.d.ts
|
|
1426
|
-
/** The style of a paragraph with no entry: not in a list. */
|
|
1427
|
-
declare const PLAIN_PARAGRAPH: Readonly<TextParagraphStyle>;
|
|
1428
|
-
/** Figma nests list items at most this deep. */
|
|
1429
|
-
declare const MAX_LIST_INDENTATION = 5;
|
|
1430
|
-
/** A paragraph's characters: `start` to `end`, not counting the newline that ends it. */
|
|
1431
|
-
interface TextParagraphRange {
|
|
1432
|
-
start: number;
|
|
1433
|
-
end: number;
|
|
1434
|
-
}
|
|
1435
|
-
/** The paragraphs of `text`: one per line ending at a newline, and one after the last. */
|
|
1436
|
-
declare function textParagraphRanges(text: string): TextParagraphRange[];
|
|
1437
|
-
/** The paragraph holding character `index`; a newline belongs to the paragraph it ends. */
|
|
1438
|
-
declare function paragraphIndexAt(text: string, index: number): number;
|
|
1439
|
-
declare function paragraphStyleAt(paragraphs: readonly TextParagraphStyle[], paragraph: number): TextParagraphStyle;
|
|
1440
|
-
declare const TEXT_PARAGRAPH_SPACING_FIELDS: readonly TextParagraphSpacingField[];
|
|
1441
|
-
/** A paragraph's spacing: its own value, or the text's when it sets none. */
|
|
1442
|
-
declare function paragraphSpacingAt(node: Pick<SceneNode, 'textParagraphs' | TextParagraphSpacingField>, paragraph: number, field: TextParagraphSpacingField): number;
|
|
1443
|
-
/** Whether a paragraph sets any spacing of its own. */
|
|
1444
|
-
declare function hasParagraphSpacing(style: TextParagraphStyle): boolean;
|
|
1445
|
-
/** A paragraph style with its own `field` set, or following the text again for `undefined`. */
|
|
1446
|
-
declare function withParagraphSpacing(style: TextParagraphStyle, field: TextParagraphSpacingField, value: number | undefined): TextParagraphStyle;
|
|
1447
|
-
/** Every paragraph's `field`, or `null` when they differ. */
|
|
1448
|
-
declare function sharedParagraphSpacing(node: Pick<SceneNode, 'text' | 'textParagraphs' | TextParagraphSpacingField>, field: TextParagraphSpacingField, first?: number, last?: number): number | null;
|
|
1449
|
-
/** Paragraph styles with no paragraph setting its own `field`, as setting the text's does. */
|
|
1450
|
-
declare function paragraphStylesWithoutSpacing(paragraphs: readonly TextParagraphStyle[], field: TextParagraphSpacingField): TextParagraphStyle[];
|
|
1451
|
-
/** Whether any paragraph of the node is a list item. */
|
|
1452
|
-
declare function hasTextList(node: Pick<SceneNode, 'textParagraphs'>): boolean;
|
|
1453
|
-
/**
|
|
1454
|
-
* Paragraph styles for `count` paragraphs, without the plain paragraphs at the end, so text
|
|
1455
|
-
* without lists, indentation, or paragraph spacing of its own keeps none.
|
|
1456
|
-
*/
|
|
1457
|
-
declare function trimParagraphStyles(paragraphs: readonly TextParagraphStyle[], count: number): TextParagraphStyle[];
|
|
1458
|
-
/** How many paragraphs `text` has: one more than its newlines. */
|
|
1459
|
-
declare function paragraphCount(text: string): number;
|
|
1460
|
-
/**
|
|
1461
|
-
* Paragraph styles after replacing `text[start, end)` with `inserted`, as Figma keeps them: the
|
|
1462
|
-
* paragraph the edit starts in keeps its style, paragraphs a deleted newline joins to it are
|
|
1463
|
-
* dropped, and paragraphs an inserted newline starts take its style.
|
|
1464
|
-
*/
|
|
1465
|
-
declare function paragraphStylesAfterEdit(paragraphs: readonly TextParagraphStyle[], text: string, start: number, end: number, inserted: string): TextParagraphStyle[];
|
|
1466
|
-
/**
|
|
1467
|
-
* Paragraph styles with every paragraph that `text[start, end)` touches changed by `change`,
|
|
1468
|
-
* as a range setter changes whole paragraphs.
|
|
1469
|
-
*/
|
|
1470
|
-
declare function paragraphStylesInRange(paragraphs: readonly TextParagraphStyle[], text: string, start: number, end: number, change: (style: TextParagraphStyle) => TextParagraphStyle): TextParagraphStyle[];
|
|
1471
|
-
/**
|
|
1472
|
-
* A paragraph style with its list type set. A list item is nested at least one level, and a
|
|
1473
|
-
* paragraph leaving a list keeps no indentation.
|
|
1474
|
-
*/
|
|
1475
|
-
declare function withListType(style: TextParagraphStyle, listType: TextListType): TextParagraphStyle;
|
|
1476
|
-
/** A paragraph style with its nesting set, kept in the range a list item allows. */
|
|
1477
|
-
declare function withIndentation(style: TextParagraphStyle, indentation: number): TextParagraphStyle;
|
|
1478
|
-
/**
|
|
1479
|
-
* Paragraph styles after `before` became `after` through one edit, found as the text between
|
|
1480
|
-
* their common start and end, for editors that replace the text rather than report the edit.
|
|
1481
|
-
*/
|
|
1482
|
-
declare function paragraphStylesAfterTextChange(paragraphs: readonly TextParagraphStyle[], before: string, after: string): TextParagraphStyle[];
|
|
1483
|
-
//#endregion
|
|
1484
|
-
//#region src/text/lists.d.ts
|
|
1485
|
-
/** How an ordered item's number is written at its nesting level. */
|
|
1486
|
-
type ListNumberFormat = 'DECIMAL' | 'LOWER_ALPHA' | 'LOWER_ROMAN';
|
|
1487
|
-
/** A list item paragraph and what marks it. */
|
|
1488
|
-
interface TextListItem extends TextParagraphRange {
|
|
1489
|
-
paragraph: number;
|
|
1490
|
-
listType: 'ORDERED' | 'UNORDERED';
|
|
1491
|
-
/** Nesting level, from 1. */
|
|
1492
|
-
level: number;
|
|
1493
|
-
/** The item's number among the items of its list at its level, from 1. */
|
|
1494
|
-
ordinal: number;
|
|
1495
|
-
/** The marker drawn before the item: a bullet, or its number and a period. */
|
|
1496
|
-
marker: string;
|
|
1497
|
-
/** Whether the item starts a new count at its level. */
|
|
1498
|
-
startsList: boolean;
|
|
1499
|
-
/**
|
|
1500
|
-
* The paragraph that starts the group of list items this item belongs to. A list group runs
|
|
1501
|
-
* from a list item that follows a plain paragraph, or that starts a top-level list, and its
|
|
1502
|
-
* first character styles every marker and indent in it.
|
|
1503
|
-
*/
|
|
1504
|
-
groupStart: number;
|
|
1505
|
-
}
|
|
1506
|
-
/** The marker of an unordered item, at every level. */
|
|
1507
|
-
declare const LIST_BULLET = "•";
|
|
1508
|
-
/** Ordered items count in decimal, then letters, then roman numerals, repeating as they nest. */
|
|
1509
|
-
declare function listNumberFormat(level: number): ListNumberFormat;
|
|
1510
|
-
/** An ordered item's number as its level writes it, without the period. */
|
|
1511
|
-
declare function formatListNumber(ordinal: number, format: ListNumberFormat): string;
|
|
1512
|
-
/**
|
|
1513
|
-
* The list items of a text, numbered as Figma numbers them: each level counts its own items,
|
|
1514
|
-
* a deeper item leaves the count above it running, a shallower one restarts the counts below
|
|
1515
|
-
* it, and a plain paragraph or an item of the other list type restarts the count.
|
|
1516
|
-
*/
|
|
1517
|
-
declare function textListItems(text: string, paragraphs: readonly TextParagraphStyle[]): TextListItem[];
|
|
1518
|
-
/**
|
|
1519
|
-
* Digits in the largest number of a top-level ordered item. Figma widens the indent of every
|
|
1520
|
-
* ordered item by the extra digits, so a list's numbers line up past nine.
|
|
1521
|
-
*/
|
|
1522
|
-
declare function topLevelNumberDigits(items: readonly TextListItem[]): number;
|
|
1523
|
-
//#endregion
|
|
1524
|
-
//#region src/text/references.d.ts
|
|
1525
|
-
/** What a text's runs refer to outside the text: the variables they bind and the styles they use. */
|
|
1526
|
-
interface StyleRunReferences {
|
|
1527
|
-
variables: string[];
|
|
1528
|
-
styles: string[];
|
|
1529
|
-
}
|
|
1530
|
-
/** The variables and styles a text's runs refer to, which copies and transfers carry with it. */
|
|
1531
|
-
declare function styleRunReferences(runs: readonly StyleRun[]): StyleRunReferences;
|
|
1532
|
-
/**
|
|
1533
|
-
* Runs whose variables, styles, and linked layers are renamed, as a copy into another document
|
|
1534
|
-
* renames them. Layers are renamed only when given, since a link may name a layer left behind.
|
|
1535
|
-
*/
|
|
1536
|
-
declare function remapStyleRunReferences(runs: readonly StyleRun[], rename: {
|
|
1537
|
-
variable: (id: string) => string;
|
|
1538
|
-
style: (id: string) => string;
|
|
1539
|
-
node?: (id: string) => string;
|
|
1540
|
-
}): StyleRun[];
|
|
1541
|
-
//#endregion
|
|
1542
|
-
//#region src/group-bounds.d.ts
|
|
1543
|
-
type Placement = Pick<SceneNode, 'x' | 'y' | 'width' | 'height'>;
|
|
1544
|
-
/** What `fitEnclosingGroups` changed, so a caller can undo and redo it. */
|
|
1545
|
-
interface GroupFit {
|
|
1546
|
-
before: Map<string, Placement>;
|
|
1547
|
-
after: Map<string, Placement>;
|
|
1548
|
-
/** Emptied groups, outermost last, with their index in their parent. */
|
|
1549
|
-
removed: Array<{
|
|
1550
|
-
node: SceneNode;
|
|
1551
|
-
index: number;
|
|
1552
|
-
}>;
|
|
1553
|
-
}
|
|
1554
|
-
interface GroupFitOptions {
|
|
1555
|
-
/**
|
|
1556
|
-
* The box of a boolean operation's result in its parent's space, which Figma sizes a boolean to,
|
|
1557
|
-
* or null to fit its operands. Measuring needs path operations, so the renderer supplies it.
|
|
1558
|
-
*/
|
|
1559
|
-
booleanBounds?: (node: SceneNode) => Rect | null;
|
|
1560
|
-
}
|
|
1561
|
-
/**
|
|
1562
|
-
* Refits the groups and booleans around these parents to their children, keeping every child where
|
|
1563
|
-
* it is on the canvas, and removes groups left empty, as Figma does after a layer inside one moves,
|
|
1564
|
-
* resizes, or leaves. Rotated or flipped containers keep their bounds. Returns null when nothing
|
|
1565
|
-
* changed.
|
|
1566
|
-
*/
|
|
1567
|
-
declare function fitEnclosingGroups(graph: SceneGraph, parentIds: Iterable<string>, options?: GroupFitOptions): GroupFit | null;
|
|
1568
|
-
/** Reapplies a fit after `undoGroupFit`. */
|
|
1569
|
-
declare function redoGroupFit(graph: SceneGraph, fit: GroupFit): void;
|
|
1570
|
-
/** Brings back the groups a fit removed and their earlier bounds. */
|
|
1571
|
-
declare function undoGroupFit(graph: SceneGraph, fit: GroupFit): void;
|
|
1572
|
-
//#endregion
|
|
1573
|
-
//#region src/geometry.d.ts
|
|
1574
|
-
declare function degToRad(degrees: number): number;
|
|
1575
|
-
declare function radToDeg(radians: number): number;
|
|
1576
|
-
declare function rotatePoint(px: number, py: number, cx: number, cy: number, rad: number): Vector;
|
|
1577
|
-
declare function rotatedCorners(cx: number, cy: number, hw: number, hh: number, rotationDeg: number): [Vector, Vector, Vector, Vector];
|
|
1578
|
-
declare function rotatedBBox(x: number, y: number, w: number, h: number, rotationDeg: number): {
|
|
1579
|
-
left: number;
|
|
1580
|
-
right: number;
|
|
1581
|
-
top: number;
|
|
1582
|
-
bottom: number;
|
|
1583
|
-
centerX: number;
|
|
1584
|
-
centerY: number;
|
|
1585
|
-
};
|
|
1586
|
-
interface VisualBounds {
|
|
1587
|
-
minX: number;
|
|
1588
|
-
minY: number;
|
|
1589
|
-
maxX: number;
|
|
1590
|
-
maxY: number;
|
|
1591
|
-
}
|
|
1592
|
-
declare function computeBounds(items: Iterable<Rect>): Rect;
|
|
1593
|
-
declare function polygonVertices(node: {
|
|
1594
|
-
width: number;
|
|
1595
|
-
height: number;
|
|
1596
|
-
pointCount: number;
|
|
1597
|
-
type: string;
|
|
1598
|
-
starInnerRadius: number;
|
|
1599
|
-
}): Vector[];
|
|
1600
|
-
/** A layer's stroke join and miter limit, for the tips mitered path corners reach. */
|
|
1601
|
-
interface StrokeCorners {
|
|
1602
|
-
strokeJoin?: StrokeJoin;
|
|
1603
|
-
strokeMiterLimit?: number;
|
|
1604
|
-
}
|
|
1605
|
-
declare function strokeOverflow(strokes?: Stroke[], fallbackCap?: StrokeCap, network?: VectorNetwork | null, corners?: StrokeCorners): number;
|
|
1606
|
-
declare function effectOverflow(effects?: Effect[]): {
|
|
1607
|
-
left: number;
|
|
1608
|
-
right: number;
|
|
1609
|
-
top: number;
|
|
1610
|
-
bottom: number;
|
|
1611
|
-
};
|
|
1612
|
-
declare function computeAbsoluteBounds(nodes: Iterable<{
|
|
1613
|
-
id: string;
|
|
1614
|
-
width: number;
|
|
1615
|
-
height: number;
|
|
1616
|
-
}>, getAbsolutePosition: (id: string) => Vector): Rect;
|
|
1617
|
-
declare function computeVisualBounds(nodes: Iterable<{
|
|
1618
|
-
id: string;
|
|
1619
|
-
width: number;
|
|
1620
|
-
height: number;
|
|
1621
|
-
rotation?: number;
|
|
1622
|
-
strokes?: Stroke[];
|
|
1623
|
-
strokeCap?: StrokeCap;
|
|
1624
|
-
vectorNetwork?: VectorNetwork | null;
|
|
1625
|
-
effects?: Effect[];
|
|
1626
|
-
} & StrokeCorners>, getAbsolutePosition: (id: string) => Vector): Rect;
|
|
1627
|
-
interface VisualBoundsNode {
|
|
1628
|
-
id: string;
|
|
1629
|
-
width: number;
|
|
1630
|
-
height: number;
|
|
1631
|
-
rotation?: number;
|
|
1632
|
-
flipX?: boolean;
|
|
1633
|
-
flipY?: boolean;
|
|
1634
|
-
strokes?: Stroke[];
|
|
1635
|
-
strokeCap?: StrokeCap;
|
|
1636
|
-
vectorNetwork?: VectorNetwork | null;
|
|
1637
|
-
effects?: Effect[];
|
|
1638
|
-
fillGeometry?: Array<{
|
|
1639
|
-
commandsBlob: Uint8Array;
|
|
1640
|
-
}>;
|
|
1641
|
-
strokeGeometry?: Array<{
|
|
1642
|
-
commandsBlob: Uint8Array;
|
|
1643
|
-
}>;
|
|
1644
|
-
childIds?: string[];
|
|
1645
|
-
visible?: boolean;
|
|
1646
|
-
type?: string;
|
|
1647
|
-
clipsContent?: boolean;
|
|
1648
|
-
fontSize?: number;
|
|
1649
|
-
textDecoration?: string;
|
|
1650
|
-
textUnderlineOffset?: number | null;
|
|
1651
|
-
textDecorationThickness?: number | null;
|
|
1652
|
-
}
|
|
1653
|
-
declare function unionVisualBounds(a: VisualBounds | null, b: VisualBounds | null): VisualBounds | null;
|
|
1654
|
-
declare function intersectVisualBounds(a: VisualBounds, b: VisualBounds): VisualBounds | null;
|
|
1655
|
-
/**
|
|
1656
|
-
* Coordinate pairs per path blob command: 0=close, 1=move, 2=line,
|
|
1657
|
-
* 3=quad (glyph-derived blobs are quad-heavy), 4=cubic. Unknown → null so
|
|
1658
|
-
* walkers stop instead of desyncing into coordinate bytes.
|
|
1659
|
-
*/
|
|
1660
|
-
declare function geometryCommandCoordCount(command: number): number | null;
|
|
1661
|
-
declare function geometryBlobBounds(paths: Array<{
|
|
1662
|
-
commandsBlob: Uint8Array;
|
|
1663
|
-
}>): Rect | null;
|
|
1664
|
-
declare function nodeVisualBounds(node: VisualBoundsNode, getAbsolutePosition: (id: string) => Vector): VisualBounds;
|
|
1665
|
-
declare function computeDescendantVisualBounds(nodeIds: string[], getNode: (id: string) => VisualBoundsNode | undefined, getAbsolutePosition: (id: string) => Vector): VisualBounds | null;
|
|
1666
|
-
/**
|
|
1667
|
-
* Clip a subject polygon against a convex polygon (e.g. the 4 canvas-space
|
|
1668
|
-
* corners of a rotated clipping ancestor).
|
|
1669
|
-
*
|
|
1670
|
-
* Uses Sutherland–Hodgman polygon clipping with centroid-based interior
|
|
1671
|
-
* detection, making it robust to either winding order of the clip polygon.
|
|
1672
|
-
* Returns the clipped polygon, or null if the subject is fully outside the
|
|
1673
|
-
* clip polygon. When `clipCorners` has fewer than 3 points the subject is
|
|
1674
|
-
* returned unchanged (no clipping).
|
|
1675
|
-
*
|
|
1676
|
-
* Preserving the polygon (rather than collapsing to an AABB) lets callers
|
|
1677
|
-
* chain multiple clips without reintroducing corners removed by an inner clip.
|
|
1678
|
-
*/
|
|
1679
|
-
declare function clipPolygon(subject: Vector[], clipCorners: Vector[]): Vector[] | null;
|
|
1680
|
-
/**
|
|
1681
|
-
* Clip an axis-aligned VisualBounds rectangle against a convex polygon
|
|
1682
|
-
* (e.g. the 4 canvas-space corners of a rotated clipping ancestor).
|
|
1683
|
-
*
|
|
1684
|
-
* Returns the AABB of the intersection, or null if the bounds are fully
|
|
1685
|
-
* outside the clip polygon. Delegates to {@link clipPolygon}.
|
|
1686
|
-
*
|
|
1687
|
-
* For a non-rotated clip (axis-aligned corners) the result is identical
|
|
1688
|
-
* to `intersectVisualBounds`.
|
|
1689
|
-
*/
|
|
1690
|
-
declare function clipBoundsToPolygon(bounds: VisualBounds, clipCorners: Vector[]): VisualBounds | null;
|
|
1691
|
-
//#endregion
|
|
1692
|
-
//#region src/font-style.d.ts
|
|
1693
|
-
interface FontFamilyStyle {
|
|
1694
|
-
family: string;
|
|
1695
|
-
style: string;
|
|
1696
|
-
}
|
|
1697
|
-
interface ParsedFontStyle {
|
|
1698
|
-
weight: number;
|
|
1699
|
-
italic: boolean;
|
|
1700
|
-
}
|
|
1701
|
-
declare const FONT_WEIGHT_NAMES: Record<number, string>;
|
|
1702
|
-
declare function normalizeFontStyleName(style: string): string;
|
|
1703
|
-
declare function parseFontStyle(style: string | undefined): ParsedFontStyle;
|
|
1704
|
-
declare function styleToWeight(style: string | undefined): number;
|
|
1705
|
-
declare function normalizeFontFamily(family: string): string;
|
|
1706
|
-
declare function styleToVariant(style: string): string;
|
|
1707
|
-
declare function weightToStyle(weight: number, italic?: boolean): string;
|
|
1708
|
-
//#endregion
|
|
1709
|
-
//#region src/shared-styles.d.ts
|
|
1710
|
-
declare const STYLE_REF_KEYS: {
|
|
1711
|
-
readonly fill: "fillStyleId";
|
|
1712
|
-
readonly stroke: "strokeStyleId";
|
|
1713
|
-
readonly text: "textStyleId";
|
|
1714
|
-
readonly effect: "effectStyleId";
|
|
1715
|
-
readonly grid: "gridStyleId";
|
|
1716
|
-
};
|
|
1717
|
-
/** The fields a text style gives what uses it; changing one leaves the style. */
|
|
1718
|
-
declare const SHARED_TEXT_STYLE_FIELDS: readonly ["fontFamily", "fontWeight", "italic", "fontSize", "lineHeight", "letterSpacing", "textDecoration", "textCase", "fontFeatures"];
|
|
1719
|
-
declare function sharedStyleRefKey(kind: SharedStyleKind): (typeof STYLE_REF_KEYS)[SharedStyleKind];
|
|
1720
|
-
declare function sharedStyleTypeForKind(kind: SharedStyleKind): SharedStyleType;
|
|
1721
|
-
declare function getSharedStyles(graph: SceneGraph, kind: SharedStyleKind): SharedStyle[];
|
|
1722
|
-
declare function styleDetachmentChanges(node: SceneNode, changes: Partial<SceneNode>): Partial<SceneNode>;
|
|
1723
|
-
//#endregion
|
|
1724
|
-
//#region src/buffered-events.d.ts
|
|
1725
|
-
declare class CommittedGraphEventError extends AggregateError {
|
|
1726
|
-
readonly committed = true;
|
|
1727
|
-
constructor(errors: readonly unknown[]);
|
|
1728
|
-
}
|
|
1729
|
-
/** Stable emitter identity with synchronous, nestable event buffering. */
|
|
1730
|
-
declare class BufferedSceneEmitter implements Emitter<SceneGraphEvents> {
|
|
1731
|
-
private readonly delegate;
|
|
1732
|
-
private readonly buffers;
|
|
1733
|
-
get events(): Emitter<SceneGraphEvents>['events'];
|
|
1734
|
-
set events(events: Emitter<SceneGraphEvents>['events']);
|
|
1735
|
-
on<K extends keyof SceneGraphEvents>(event: K, listener: SceneGraphEvents[K]): import("nanoevents").Unsubscribe;
|
|
1736
|
-
emit<K extends keyof SceneGraphEvents>(event: K, ...args: Parameters<SceneGraphEvents[K]>): void;
|
|
1737
|
-
/** Buffers events, not mutations. Callers own rollback if the action throws. */
|
|
1738
|
-
batch<T>(action: () => T): T;
|
|
1739
|
-
}
|
|
1740
|
-
//#endregion
|
|
1741
|
-
//#region src/hit-test.d.ts
|
|
1742
|
-
declare function hitTest(graph: SceneGraph, px: number, py: number, scopeId?: string): SceneNode | null;
|
|
1743
|
-
declare function hitTestDeep(graph: SceneGraph, px: number, py: number, scopeId?: string, pad?: number): SceneNode | null;
|
|
1744
|
-
/**
|
|
1745
|
-
* The layer a click selects, as in Figma. It walks from the scope down to the deepest layer under
|
|
1746
|
-
* the point and stops at the first layer that is not open. Top-level frames and sections with
|
|
1747
|
-
* layers and component sets are open, and so is every ancestor of the selection, so clicks reach
|
|
1748
|
-
* the siblings of selected layers. Where every layer under the point is open, a container opened
|
|
1749
|
-
* by the selection is selected, so is a top-level frame with auto layout, and a plain top-level
|
|
1750
|
-
* frame or a section is not.
|
|
1751
|
-
*/
|
|
1752
|
-
declare function hitTestSelectable(graph: SceneGraph, px: number, py: number, scopeId: string, selectedIds: ReadonlySet<string>, pad?: number): SceneNode | null;
|
|
1753
|
-
/** Whether a click looks into this container rather than selecting it; see `hitTestSelectable`. */
|
|
1754
|
-
declare function isOpenContainer(graph: SceneGraph, nodeId: string): boolean;
|
|
1755
|
-
/**
|
|
1756
|
-
* The innermost open container under the point when every layer there is open: a marquee starting
|
|
1757
|
-
* here selects that container's layers, as in Figma.
|
|
1758
|
-
*/
|
|
1759
|
-
declare function hitTestOpenContainer(graph: SceneGraph, px: number, py: number, scopeId: string): SceneNode | null;
|
|
1760
|
-
/** Whether the point lies inside the node's rotated and flipped bounds. */
|
|
1761
|
-
declare function isPointInNode(graph: SceneGraph, nodeId: string, px: number, py: number): boolean;
|
|
1762
|
-
interface DropTargetOptions {
|
|
1763
|
-
/**
|
|
1764
|
-
* Set when the dropped layers are all main components: the component sets they come from.
|
|
1765
|
-
* Components then go only into frames, sections, instances, and those sets.
|
|
1766
|
-
*/
|
|
1767
|
-
componentSetIds?: ReadonlySet<string>;
|
|
1768
|
-
}
|
|
1769
|
-
/**
|
|
1770
|
-
* The topmost unlocked frame, section, component, or instance under the point, in its rotated
|
|
1771
|
-
* shape and inside its clipping ancestors. Groups and component sets are looked through but never
|
|
1772
|
-
* returned, except that a set takes dropped components; locked layers and their contents are
|
|
1773
|
-
* skipped.
|
|
1774
|
-
*/
|
|
1775
|
-
declare function hitTestDropTarget(graph: SceneGraph, px: number, py: number, excludeIds: ReadonlySet<string>, scopeId?: string, options?: DropTargetOptions): SceneNode | null;
|
|
1776
|
-
//#endregion
|
|
1777
|
-
//#region src/preview.d.ts
|
|
1778
|
-
type NodePreviewObserver = (node: SceneNode, changes: Partial<SceneNode>) => void;
|
|
1779
|
-
type PreviewGraph = {
|
|
1780
|
-
nodes: Map<string, SceneNode>;
|
|
1781
|
-
positionPreviewVersion: number;
|
|
1782
|
-
clearAbsPosCache: () => void;
|
|
1783
|
-
};
|
|
1784
|
-
declare function updateNodePreview(graph: PreviewGraph, id: string, changes: Partial<SceneNode>, beforeUpdate?: NodePreviewObserver): Partial<SceneNode> | null;
|
|
1785
|
-
//#endregion
|
|
1786
|
-
//#region src/vector-network.d.ts
|
|
1787
|
-
/** Concatenate vector networks while preserving independent geometry. */
|
|
1788
|
-
declare function mergeVectorNetworks(networks: readonly VectorNetwork[]): VectorNetwork;
|
|
1789
|
-
/**
|
|
1790
|
-
* Map a VectorNetwork through an affine matrix: vertices as points,
|
|
1791
|
-
* tangents as direction vectors (linear part only, no translation).
|
|
1792
|
-
* Returns a deep copy; the input is not mutated.
|
|
1793
|
-
*/
|
|
1794
|
-
declare function transformVectorNetwork(m: Mat3, vn: VectorNetwork): VectorNetwork;
|
|
1795
|
-
/** Structural equality of two VectorNetworks (order-sensitive, exact values). */
|
|
1796
|
-
declare function vectorNetworksEqual(a: VectorNetwork, b: VectorNetwork): boolean;
|
|
1797
|
-
/** Deep-copy a VectorNetwork, stripping any Vue Proxy wrappers. */
|
|
1798
|
-
declare function cloneVectorNetwork(vn: VectorNetwork): VectorNetwork;
|
|
1799
|
-
/**
|
|
1800
|
-
* Validate a VectorNetwork structure, returning an array of error messages.
|
|
1801
|
-
* Empty array means the network is valid.
|
|
1802
|
-
*/
|
|
1803
|
-
declare function validateVectorNetwork(value: unknown): string[];
|
|
1804
|
-
type NormalizableVectorNetwork = Omit<VectorNetwork, 'regions'> & {
|
|
1805
|
-
regions?: VectorNetwork['regions'];
|
|
1806
|
-
};
|
|
1807
|
-
/**
|
|
1808
|
-
* Ensure every segment has tangentStart/tangentEnd and a regions array.
|
|
1809
|
-
* Missing tangents default to {x:0, y:0} (straight line segments).
|
|
1810
|
-
* Use at system boundaries where input may come from JSON/MCP.
|
|
1811
|
-
*/
|
|
1812
|
-
declare function normalizeVectorNetwork(vn: NormalizableVectorNetwork): VectorNetwork;
|
|
1813
|
-
//#endregion
|
|
1814
|
-
//#region src/checkpoint.d.ts
|
|
1815
|
-
/** Capture rollback state without changing graph or surviving object identities. */
|
|
1816
|
-
declare function captureGraphCheckpoint(graph: SceneGraph): {
|
|
1817
|
-
nodes: Map<string, SceneNode>;
|
|
1818
|
-
variables: Map<string, Variable>;
|
|
1819
|
-
assertPropertiesOnly: () => void;
|
|
1820
|
-
restore: () => void;
|
|
1821
|
-
};
|
|
1822
|
-
//#endregion
|
|
1823
|
-
//#region src/index.d.ts
|
|
1824
|
-
/**
|
|
1825
|
-
* Sets the session part of the IDs this process mints, as in Figma's `sessionID:localID` GUIDs.
|
|
1826
|
-
* Every process starts in a random session, so layers that the editor, the CLI, or MCP add to
|
|
1827
|
-
* copies of one file never share IDs. Tests and fixtures that need the same IDs on every run
|
|
1828
|
-
* set a fixed session or give the graph its own generator. Returns the previous session.
|
|
1829
|
-
*/
|
|
1830
|
-
declare function setIdSession(sessionId: number): number;
|
|
1831
|
-
declare function generateId(): string;
|
|
1832
|
-
declare class SceneGraph {
|
|
1833
|
-
private readonly idGenerator;
|
|
1834
|
-
nodes: Map<string, SceneNode>;
|
|
1835
|
-
images: Map<string, Uint8Array<ArrayBufferLike>>;
|
|
1836
|
-
variables: Map<string, Variable>;
|
|
1837
|
-
variableCollections: Map<string, VariableCollection>;
|
|
1838
|
-
activeMode: Map<string, string>;
|
|
1839
|
-
rootId: string;
|
|
1840
|
-
figKiwiVersion: number | null;
|
|
1841
|
-
/** Deflated kiwi schema bytes from the original .fig file, preserved for roundtrip fidelity. */
|
|
1842
|
-
figSchemaDeflated: Uint8Array | null;
|
|
1843
|
-
documentColorSpace: DocumentColorSpace;
|
|
1844
|
-
enabledLibraries: Map<string, EnabledLibraryBinding>;
|
|
1845
|
-
readonly emitter: BufferedSceneEmitter;
|
|
1846
|
-
private absPosCache;
|
|
1847
|
-
private previewMutationDepth;
|
|
1848
|
-
private previewObservers;
|
|
1849
|
-
private readonly changeObservers;
|
|
1850
|
-
private sourceMetadataPreservationDepth;
|
|
1851
|
-
private importedStateApplicationDepth;
|
|
1852
|
-
private importedIdGenerator;
|
|
1853
|
-
private layoutMutationDepth;
|
|
1854
|
-
private derivedLayoutDepth;
|
|
1855
|
-
positionPreviewVersion: number;
|
|
1856
|
-
instanceIndex: Map<string, Set<string>>;
|
|
1857
|
-
constructor(idGenerator?: () => string);
|
|
1858
|
-
addPage(name: string): SceneNode;
|
|
1859
|
-
getPages(includeInternal?: boolean): SceneNode[];
|
|
1860
|
-
getAllNodes(): Iterable<SceneNode>;
|
|
1861
|
-
getNode(id: string): SceneNode | undefined;
|
|
1862
|
-
onNodeEvents(handlers: SceneGraphEventHandlers): () => void;
|
|
1863
|
-
/**
|
|
1864
|
-
* Tells `observer` about each node an edit adds and, before it changes, each node it is about
|
|
1865
|
-
* to change, so a recorder can keep the node as it was. Unlike node events these are never
|
|
1866
|
-
* buffered. Graph methods report the nodes they change; code that writes into a node directly
|
|
1867
|
-
* reports it with `willChangeNode` first.
|
|
1868
|
-
*/
|
|
1869
|
-
observeNodeChanges(observer: NodeChangeObserver): () => void;
|
|
1870
|
-
/** Tells `observeNodeChanges` observers that `node` is about to change. */
|
|
1871
|
-
willChangeNode(node: SceneNode | undefined): void;
|
|
1872
|
-
countDescendants(nodeId: string): number;
|
|
1873
|
-
addVariable(variable: Variable): void;
|
|
1874
|
-
removeVariable(id: string): void;
|
|
1875
|
-
addCollection(collection: VariableCollection): void;
|
|
1876
|
-
createVariable(name: string, type: VariableType, collectionId: string, value?: VariableValue): Variable;
|
|
1877
|
-
createCollection(name: string): VariableCollection;
|
|
1878
|
-
createMode(collectionId: string, name: string, sourceModeId?: string): string | undefined;
|
|
1879
|
-
removeCollection(id: string): void;
|
|
1880
|
-
getActiveModeId(collectionId: string): string;
|
|
1881
|
-
getNodeVariableModeId(nodeId: string, collectionId: string): string;
|
|
1882
|
-
setActiveMode(collectionId: string, modeId: string): void;
|
|
1883
|
-
addMode(collectionId: string, modeId: string, name: string, sourceMode?: string): void;
|
|
1884
|
-
removeMode(collectionId: string, modeId: string): void;
|
|
1885
|
-
renameMode(collectionId: string, modeId: string, name: string): void;
|
|
1886
|
-
setDefaultMode(collectionId: string, modeId: string): void;
|
|
1887
|
-
resolveVariable(variableId: string, modeId?: string, visited?: Set<string>): VariableValue | undefined;
|
|
1888
|
-
resolveColorVariable(variableId: string): Color | undefined;
|
|
1889
|
-
resolveNumberVariable(variableId: string): number | undefined;
|
|
1890
|
-
resolveColorVariableForNode(nodeId: string, variableId: string, fallback?: VariableModeFallback): Color | undefined;
|
|
1891
|
-
resolveNumberVariableForNode(nodeId: string, variableId: string, fallback?: VariableModeFallback): number | undefined;
|
|
1892
|
-
resolveVariableForNode(nodeId: string, variableId: string, fallback?: VariableModeFallback): VariableValue | undefined;
|
|
1893
|
-
resolveStringVariableForNode(nodeId: string, variableId: string, fallback?: VariableModeFallback): string | undefined;
|
|
1894
|
-
getVariablesForCollection(collectionId: string): Variable[];
|
|
1895
|
-
getVariablesByType(type: VariableType): Variable[];
|
|
1896
|
-
bindVariable(nodeId: string, field: string, variableId: string): void;
|
|
1897
|
-
unbindVariable(nodeId: string, field: string): void;
|
|
1898
|
-
getChildren(id: string): SceneNode[];
|
|
1899
|
-
isContainer(id: string): boolean;
|
|
1900
|
-
isDescendant(childId: string, ancestorId: string): boolean;
|
|
1901
|
-
/**
|
|
1902
|
-
* The node itself or its nearest ancestor that matches. The walk visits at most as many nodes
|
|
1903
|
-
* as the graph holds, so a parent cycle in bad data cannot hang it.
|
|
1904
|
-
*/
|
|
1905
|
-
closest(id: string, match: (node: SceneNode) => boolean): SceneNode | undefined;
|
|
1906
|
-
/**
|
|
1907
|
-
* The page a node is on: the node itself for a page, its nearest page ancestor otherwise, and
|
|
1908
|
-
* null for the document root or a node on no page.
|
|
1909
|
-
*/
|
|
1910
|
-
pageOf(id: string): string | null;
|
|
1911
|
-
clearAbsPosCache(): void;
|
|
1912
|
-
getAbsolutePosition(id: string): Vector;
|
|
1913
|
-
getAbsoluteBounds(id: string): Rect;
|
|
1914
|
-
/**
|
|
1915
|
-
* An ID no entity uses; `issued` also excludes IDs handed out earlier in the same creation.
|
|
1916
|
-
* A generator that returns more taken IDs than the graph holds must be repeating itself, so
|
|
1917
|
-
* it counts as exhausted then; a fixed cap would reject a sequence walking past a large import.
|
|
1918
|
-
*/
|
|
1919
|
-
private generateEntityId;
|
|
1920
|
-
private entityIdCount;
|
|
1921
|
-
private isEntityIdTaken;
|
|
1922
|
-
private registerNode;
|
|
1923
|
-
/** Publish synchronous graph events only after the supplied mutation succeeds. */
|
|
1924
|
-
withBufferedEvents<T>(action: () => T): T;
|
|
1925
|
-
createNode(type: NodeType, parentId: string, overrides?: Partial<SceneNode>): SceneNode;
|
|
1926
|
-
createNodeWithId(id: string, type: NodeType, parentId: string | null, overrides?: Partial<SceneNode>): SceneNode;
|
|
1927
|
-
static TEXT_PICTURE_KEYS: ReadonlySet<string>;
|
|
1928
|
-
static GLYPH_AFFECTING_KEYS: ReadonlySet<string>;
|
|
1929
|
-
static LAYOUT_AFFECTING_KEYS: ReadonlySet<string>;
|
|
1930
|
-
runPreviewUpdates(fn: () => void, beforeUpdate?: NodePreviewObserver): void;
|
|
1931
|
-
preserveSourceMetadataDuring<T>(fn: () => T): T;
|
|
1932
|
-
get isPreservingSourceMetadata(): boolean;
|
|
1933
|
-
applyImportedStateDuring<T>(fn: () => T, idGenerator?: () => string): T;
|
|
1934
|
-
get isApplyingImportedState(): boolean;
|
|
1935
|
-
/**
|
|
1936
|
-
* Lays out what the document already holds: a page as it loads, or again once its fonts
|
|
1937
|
-
* arrive. What this writes derives from the document; an edit's own layout is not this.
|
|
1938
|
-
*/
|
|
1939
|
-
applyDerivedLayoutDuring(fn: () => void): void;
|
|
1940
|
-
get isApplyingDerivedLayout(): boolean;
|
|
1941
|
-
withLayoutMutations(fn: () => void): void;
|
|
1942
|
-
get isApplyingLayout(): boolean;
|
|
1943
|
-
updateNodePositionPreview(id: string, x: number, y: number): void;
|
|
1944
|
-
updateNodePreview(id: string, changes: Partial<SceneNode>): void;
|
|
1945
|
-
updateNode(id: string, changes: Partial<SceneNode>): void;
|
|
1946
|
-
/** Replay captured properties without dropping explicit undefined values or absent keys. */
|
|
1947
|
-
restoreNodeProperties(id: string, changes: Partial<SceneNode>, absent: readonly (keyof SceneNode)[]): void;
|
|
1948
|
-
private applyNodeChanges;
|
|
1949
|
-
reparentNode(nodeId: string, newParentId: string): void;
|
|
1950
|
-
private parentWorldMatrix;
|
|
1951
|
-
reorderChild(nodeId: string, parentId: string, insertIndex: number): void;
|
|
1952
|
-
insertChildAt(childId: string, parentId: string, index: number): void;
|
|
1953
|
-
deleteNode(id: string): void;
|
|
1954
|
-
hitTest(px: number, py: number, scopeId?: string): SceneNode | null;
|
|
1955
|
-
/** `pad`, in canvas units, grows each shape's box, as Figma takes clicks just outside one. */
|
|
1956
|
-
hitTestDeep(px: number, py: number, scopeId?: string, pad?: number): SceneNode | null;
|
|
1957
|
-
hitTestSelectable(px: number, py: number, scopeId: string, selectedIds: ReadonlySet<string>, pad?: number): SceneNode | null;
|
|
1958
|
-
hitTestOpenContainer(px: number, py: number, scopeId: string): SceneNode | null;
|
|
1959
|
-
isOpenContainer(nodeId: string): boolean;
|
|
1960
|
-
isPointInNode(nodeId: string, px: number, py: number): boolean;
|
|
1961
|
-
hitTestDropTarget(px: number, py: number, excludeIds: ReadonlySet<string>, scopeId?: string, options?: DropTargetOptions): SceneNode | null;
|
|
1962
|
-
cloneTree(sourceId: string, parentId: string, overrides?: Partial<SceneNode>): SceneNode | null;
|
|
1963
|
-
createInstance(componentId: string, parentId: string, overrides?: Partial<SceneNode>): SceneNode | null;
|
|
1964
|
-
populateInstanceChildren(instanceId: string, componentId: string, mode?: NodeCloneMode): void;
|
|
1965
|
-
swapInstanceComponent(instanceId: string, componentId: string, options?: SwapInstanceOptions): void;
|
|
1966
|
-
syncInstances(componentId: string): void;
|
|
1967
|
-
syncInstancesTogether(componentIds: Iterable<string>): void;
|
|
1968
|
-
syncInstance(instanceId: string): void;
|
|
1969
|
-
detachInstance(instanceId: string): void;
|
|
1970
|
-
getMainComponent(instanceId: string): SceneNode | undefined;
|
|
1971
|
-
getInstances(componentId: string): SceneNode[];
|
|
1972
|
-
flattenTree(parentId?: string, depth?: number): Array<{
|
|
1973
|
-
node: SceneNode;
|
|
1974
|
-
depth: number;
|
|
1975
|
-
}>;
|
|
1976
|
-
}
|
|
1977
|
-
//#endregion
|
|
1978
|
-
//#region src/guides.d.ts
|
|
1979
|
-
interface CanvasGuide {
|
|
1980
|
-
id: string;
|
|
1981
|
-
axis: 'x' | 'y';
|
|
1982
|
-
position: number;
|
|
1983
|
-
figGuid?: GUID;
|
|
1984
|
-
}
|
|
1985
|
-
/**
|
|
1986
|
-
* The layers on a page that carry guides, which a frame anywhere in the tree can, as in Figma.
|
|
1987
|
-
* The graph keeps the set current from its node events, so drawing and hit-testing guides do not
|
|
1988
|
-
* walk the page's whole tree on every frame.
|
|
1989
|
-
*/
|
|
1990
|
-
declare function guideOwnersOnPage(graph: SceneGraph, pageId: string): SceneNode[];
|
|
1991
|
-
//#endregion
|
|
1
|
+
import { Color, Matrix, Rect, Vector } from "./primitives/index.js";
|
|
2
|
+
import { ExportFormatId } from "./export-format.js";
|
|
3
|
+
import { CanvasGuide } from "./guides.js";
|
|
4
|
+
import { InstanceOverrideState } from "./instances/overrides.js";
|
|
5
|
+
import { ShapeWithTextType } from "./shape-with-text/kinds.js";
|
|
1992
6
|
//#region src/types.d.ts
|
|
1993
7
|
interface SceneGraphEvents {
|
|
1994
8
|
'node:created': (node: SceneNode) => void;
|
|
@@ -2014,6 +28,8 @@ interface NodeChangeObserver {
|
|
|
2014
28
|
created: (node: SceneNode) => void;
|
|
2015
29
|
}
|
|
2016
30
|
type DocumentColorSpace = 'srgb' | 'display-p3';
|
|
31
|
+
/** What a document is for, as Figma keeps design files and FigJam boards apart. */
|
|
32
|
+
type DocumentKind = 'design' | 'board';
|
|
2017
33
|
interface FigmaSourcePayload {
|
|
2018
34
|
rawSize: Vector | null;
|
|
2019
35
|
rawTransform: Matrix | null;
|
|
@@ -2051,6 +67,10 @@ interface VectorSegment {
|
|
|
2051
67
|
interface VectorRegion {
|
|
2052
68
|
windingRule: WindingRule;
|
|
2053
69
|
loops: number[][];
|
|
70
|
+
/** The region's own paints. Without them it draws the layer's fills, as in Figma. */
|
|
71
|
+
fills?: Fill[];
|
|
72
|
+
/** The shared fill style the region's paints come from. */
|
|
73
|
+
fillStyleId?: string;
|
|
2054
74
|
}
|
|
2055
75
|
interface VectorNetwork {
|
|
2056
76
|
vertices: VectorVertex[];
|
|
@@ -2060,14 +80,10 @@ interface VectorNetwork {
|
|
|
2060
80
|
interface GeometryPath {
|
|
2061
81
|
windingRule: WindingRule;
|
|
2062
82
|
commandsBlob: Uint8Array;
|
|
2063
|
-
/** Resolved paints for geometry using a format-specific style override. */
|
|
2064
|
-
fills?: Fill[];
|
|
2065
|
-
/** Shared fill style attached to this geometry region, when available. */
|
|
2066
|
-
fillStyleId?: string;
|
|
2067
83
|
}
|
|
2068
|
-
type NodeType = 'CANVAS' | 'FRAME' | 'RECTANGLE' | 'ROUNDED_RECTANGLE' | 'ELLIPSE' | 'TEXT' | 'LINE' | 'STAR' | 'POLYGON' | 'VECTOR' | 'BOOLEAN_OPERATION' | 'GROUP' | 'SECTION' | 'COMPONENT' | 'COMPONENT_SET' | 'INSTANCE' | 'CONNECTOR' | 'SHAPE_WITH_TEXT';
|
|
84
|
+
type NodeType = 'CANVAS' | 'FRAME' | 'RECTANGLE' | 'ROUNDED_RECTANGLE' | 'ELLIPSE' | 'TEXT' | 'LINE' | 'STAR' | 'POLYGON' | 'VECTOR' | 'BOOLEAN_OPERATION' | 'GROUP' | 'SECTION' | 'COMPONENT' | 'COMPONENT_SET' | 'INSTANCE' | 'CONNECTOR' | 'SHAPE_WITH_TEXT' | 'STICKY';
|
|
2069
85
|
type FillType = 'SOLID' | 'GRADIENT_LINEAR' | 'GRADIENT_RADIAL' | 'GRADIENT_ANGULAR' | 'GRADIENT_DIAMOND' | 'IMAGE' | 'VIDEO' | 'PATTERN' | 'NOISE' | 'CUSTOM';
|
|
2070
|
-
type BlendMode = 'NORMAL' | 'DARKEN' | 'MULTIPLY' | 'COLOR_BURN' | 'LIGHTEN' | 'SCREEN' | 'COLOR_DODGE' | 'OVERLAY' | 'SOFT_LIGHT' | 'HARD_LIGHT' | 'DIFFERENCE' | 'EXCLUSION' | 'HUE' | 'SATURATION' | 'COLOR' | 'LUMINOSITY' | 'PASS_THROUGH';
|
|
86
|
+
type BlendMode = 'NORMAL' | 'DARKEN' | 'MULTIPLY' | 'LINEAR_BURN' | 'COLOR_BURN' | 'LIGHTEN' | 'SCREEN' | 'LINEAR_DODGE' | 'COLOR_DODGE' | 'OVERLAY' | 'SOFT_LIGHT' | 'HARD_LIGHT' | 'DIFFERENCE' | 'EXCLUSION' | 'HUE' | 'SATURATION' | 'COLOR' | 'LUMINOSITY' | 'PASS_THROUGH';
|
|
2071
87
|
type ImageScaleMode = 'FILL' | 'FIT' | 'CROP' | 'TILE';
|
|
2072
88
|
type NoiseType = 'MULTITONE' | 'MONOTONE' | 'DUOTONE';
|
|
2073
89
|
type PatternTileType = 'RECTANGULAR' | 'HORIZONTAL_HEXAGONAL' | 'VERTICAL_HEXAGONAL';
|
|
@@ -2087,7 +103,10 @@ interface Fill {
|
|
|
2087
103
|
gradientTransform?: GradientTransform;
|
|
2088
104
|
imageHash?: string;
|
|
2089
105
|
imageScaleMode?: ImageScaleMode;
|
|
106
|
+
/** A crop's image-space window; Fill, Fit and Tile ignore it. */
|
|
2090
107
|
imageTransform?: GradientTransform;
|
|
108
|
+
/** Clockwise turn of a Fill, Fit or Tile image, in multiples of 90°; a crop holds its own. */
|
|
109
|
+
imageRotation?: number;
|
|
2091
110
|
sourceNodeId?: string;
|
|
2092
111
|
scale?: number;
|
|
2093
112
|
spacing?: number;
|
|
@@ -2100,7 +119,7 @@ interface Fill {
|
|
|
2100
119
|
noiseSize?: Vector;
|
|
2101
120
|
customEffectId?: string;
|
|
2102
121
|
}
|
|
2103
|
-
type StrokeCap = 'NONE' | 'ROUND' | 'SQUARE' | 'ARROW_LINES' | 'ARROW_EQUILATERAL';
|
|
122
|
+
type StrokeCap = 'NONE' | 'ROUND' | 'SQUARE' | 'ARROW_LINES' | 'ARROW_EQUILATERAL' | 'TRIANGLE_FILLED' | 'DIAMOND_FILLED' | 'CIRCLE_FILLED';
|
|
2104
123
|
type StrokeJoin = 'MITER' | 'BEVEL' | 'ROUND';
|
|
2105
124
|
type SharedStyleType = 'FILL' | 'TEXT' | 'EFFECT' | 'GRID';
|
|
2106
125
|
type SharedStyleKind = 'fill' | 'stroke' | 'text' | 'effect' | 'grid';
|
|
@@ -2146,6 +165,37 @@ interface Effect {
|
|
|
2146
165
|
}
|
|
2147
166
|
type ConstraintType = 'MIN' | 'CENTER' | 'MAX' | 'STRETCH' | 'SCALE';
|
|
2148
167
|
type TextAutoResize = 'NONE' | 'HEIGHT' | 'WIDTH_AND_HEIGHT' | 'TRUNCATE';
|
|
168
|
+
/** Where a connector end attaches to a layer: a side, the side Figma picks, or a fixed point. */
|
|
169
|
+
type ConnectorMagnet = 'NONE' | 'AUTO' | 'AUTO_HORIZONTAL' | 'TOP' | 'RIGHT' | 'BOTTOM' | 'LEFT' | 'CENTER' | 'EDGE' | 'ABSOLUTE';
|
|
170
|
+
/**
|
|
171
|
+
* One end of a connector. Bound to a layer, it follows the layer by `magnet`, or by `position`
|
|
172
|
+
* in the layer's own axes when the magnet is `NONE`. Free, `nodeId` is null and `position` is in
|
|
173
|
+
* the connector's parent's axes.
|
|
174
|
+
*/
|
|
175
|
+
interface ConnectorEndpoint {
|
|
176
|
+
nodeId: string | null;
|
|
177
|
+
magnet: ConnectorMagnet;
|
|
178
|
+
position: Vector;
|
|
179
|
+
}
|
|
180
|
+
type ConnectorLineType = 'ELBOWED' | 'STRAIGHT' | 'CURVED';
|
|
181
|
+
/**
|
|
182
|
+
* A segment of an elbow connector that was dragged into place: the line it runs along, through
|
|
183
|
+
* `position`, in the connector's own axes. `position` lies midway along the segment as last drawn.
|
|
184
|
+
*/
|
|
185
|
+
interface ConnectorControlPoint {
|
|
186
|
+
position: Vector;
|
|
187
|
+
direction: 'HORIZONTAL' | 'VERTICAL';
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Where a connector's label was dragged along its line: `offset` of the way from the middle of
|
|
191
|
+
* the line towards one end, by length, on the line or to one side of it. `ABOVE` is the side to
|
|
192
|
+
* the left of the line's direction.
|
|
193
|
+
*/
|
|
194
|
+
interface ConnectorLabelPosition {
|
|
195
|
+
section: 'MIDDLE_TO_START' | 'MIDDLE_TO_END';
|
|
196
|
+
offset: number;
|
|
197
|
+
offAxis: 'NONE' | 'ABOVE' | 'BELOW';
|
|
198
|
+
}
|
|
2149
199
|
type TextAlignVertical = 'TOP' | 'CENTER' | 'BOTTOM';
|
|
2150
200
|
type TextCase = 'ORIGINAL' | 'UPPER' | 'LOWER' | 'TITLE';
|
|
2151
201
|
type TextDecoration = 'NONE' | 'UNDERLINE' | 'STRIKETHROUGH';
|
|
@@ -2185,9 +235,19 @@ declare const TEXT_BINDABLE_FIELDS: readonly ["fontFamily", "fontSize", "fontSty
|
|
|
2185
235
|
type TextBindableField = (typeof TEXT_BINDABLE_FIELDS)[number];
|
|
2186
236
|
/** Variable IDs bound to text fields, by field. */
|
|
2187
237
|
type TextBoundVariables = Partial<Record<TextBindableField, string>>;
|
|
238
|
+
/**
|
|
239
|
+
* A line height or letter spacing as Figma keeps it: pixels, or a percent of the font size that
|
|
240
|
+
* follows the size when it changes.
|
|
241
|
+
*/
|
|
242
|
+
interface TextLength {
|
|
243
|
+
value: number;
|
|
244
|
+
unit: 'PIXELS' | 'PERCENT';
|
|
245
|
+
}
|
|
2188
246
|
interface CharacterStyleOverride {
|
|
2189
247
|
fontWeight?: number;
|
|
2190
248
|
italic?: boolean;
|
|
249
|
+
/** The characters' face by its font's own name for it; `null` is the face their weight picks. */
|
|
250
|
+
fontStyle?: string | null;
|
|
2191
251
|
textDecoration?: TextDecoration;
|
|
2192
252
|
textDecorationStyle?: TextDecorationStyle;
|
|
2193
253
|
textDecorationThickness?: number | null;
|
|
@@ -2196,10 +256,13 @@ interface CharacterStyleOverride {
|
|
|
2196
256
|
textUnderlineOffset?: number | null;
|
|
2197
257
|
fontSize?: number;
|
|
2198
258
|
fontFamily?: string;
|
|
2199
|
-
letterSpacing?:
|
|
2200
|
-
|
|
259
|
+
letterSpacing?: TextLength;
|
|
260
|
+
/** `null` is automatic, from the font. */
|
|
261
|
+
lineHeight?: TextLength | null;
|
|
2201
262
|
fills?: Fill[];
|
|
2202
263
|
fontVariations?: FontVariation[];
|
|
264
|
+
/** Whether the characters' optical size follows their font size, in place of the text's own. */
|
|
265
|
+
opticalSizeFromFontSize?: boolean;
|
|
2203
266
|
fontFeatures?: FontFeature[];
|
|
2204
267
|
textLanguage?: string | null;
|
|
2205
268
|
textCase?: TextCase;
|
|
@@ -2247,9 +310,35 @@ interface PluginDataEntry {
|
|
|
2247
310
|
key: string;
|
|
2248
311
|
value: string;
|
|
2249
312
|
}
|
|
313
|
+
/** A fixed width or height in pixels an export is scaled to, instead of a multiplier. */
|
|
314
|
+
interface ExportSize {
|
|
315
|
+
type: 'WIDTH' | 'HEIGHT';
|
|
316
|
+
value: number;
|
|
317
|
+
}
|
|
318
|
+
/** The colour profile an export is written in; the document's own unless set. */
|
|
319
|
+
type ExportColorProfile = 'DOCUMENT' | 'SRGB' | 'DISPLAY_P3_V4';
|
|
320
|
+
/**
|
|
321
|
+
* One export a layer keeps. The options past `scale` and `format` are Figma's and read as Figma's
|
|
322
|
+
* defaults when left out.
|
|
323
|
+
*/
|
|
2250
324
|
interface ExportSetting {
|
|
2251
325
|
scale: number;
|
|
2252
326
|
format: ExportFormatId;
|
|
327
|
+
/** Appended to the file name. */
|
|
328
|
+
suffix?: string;
|
|
329
|
+
/** A size that replaces `scale`. */
|
|
330
|
+
size?: ExportSize;
|
|
331
|
+
/** Only the layer, without what overlaps it (default true). */
|
|
332
|
+
contentsOnly?: boolean;
|
|
333
|
+
/** The layer's box rather than everything it draws, for text (default false). */
|
|
334
|
+
useAbsoluteBounds?: boolean;
|
|
335
|
+
colorProfile?: ExportColorProfile;
|
|
336
|
+
/** SVG: text as outlines rather than `<text>` (default true). */
|
|
337
|
+
svgOutlineText?: boolean;
|
|
338
|
+
/** SVG: every layer's name as its element's `id` (default false). */
|
|
339
|
+
svgIdAttribute?: boolean;
|
|
340
|
+
/** SVG: strokes as strokes where possible rather than masked outlines (default true). */
|
|
341
|
+
svgSimplifyStroke?: boolean;
|
|
2253
342
|
}
|
|
2254
343
|
interface PluginRelaunchDataEntry {
|
|
2255
344
|
pluginId: string;
|
|
@@ -2265,8 +354,11 @@ interface PluginRelaunchDataEntry {
|
|
|
2265
354
|
interface TextPathData {
|
|
2266
355
|
network: VectorNetwork;
|
|
2267
356
|
normalizedSize: Vector;
|
|
357
|
+
/** Where on the start segment the text starts, from 0 at its start to 1 at its end. */
|
|
2268
358
|
tValue: number;
|
|
2269
359
|
forward: boolean;
|
|
360
|
+
/** The segment the text starts on, which Figma marks in the network blob; 0 when unmarked. */
|
|
361
|
+
startSegment?: number;
|
|
2270
362
|
}
|
|
2271
363
|
interface DerivedTextGlyph {
|
|
2272
364
|
/** UTF-16 source-text cluster start, when supplied by the shaping source. */
|
|
@@ -2290,6 +382,13 @@ interface DerivedTextGlyph {
|
|
|
2290
382
|
*/
|
|
2291
383
|
scaleX?: number;
|
|
2292
384
|
scaleY?: number;
|
|
385
|
+
/**
|
|
386
|
+
* The code points of the emoji this glyph stands for, sequence and all. Its outline is only a
|
|
387
|
+
* placeholder square a 1 em wide; the emoji's image is drawn there instead, as Figma does.
|
|
388
|
+
*/
|
|
389
|
+
emojiCodePoints?: number[];
|
|
390
|
+
/** The image set Figma draws the emoji from, when the file names one other than Apple's. */
|
|
391
|
+
emojiImageSet?: 'NOTO';
|
|
2293
392
|
}
|
|
2294
393
|
interface SymbolLink {
|
|
2295
394
|
uri: string;
|
|
@@ -2405,6 +504,11 @@ interface SceneNode {
|
|
|
2405
504
|
fontFamily: string;
|
|
2406
505
|
fontWeight: number;
|
|
2407
506
|
italic: boolean;
|
|
507
|
+
/**
|
|
508
|
+
* The face by the name its font gives it ("Semi Bold", "Book", "Condensed Bold"), which Figma
|
|
509
|
+
* finds a font's face by; `null` is the face the weight and slant pick in the family.
|
|
510
|
+
*/
|
|
511
|
+
fontStyle: string | null;
|
|
2408
512
|
textAlignHorizontal: 'LEFT' | 'CENTER' | 'RIGHT' | 'JUSTIFIED';
|
|
2409
513
|
textDirection: TextDirection;
|
|
2410
514
|
textLanguage: string | null;
|
|
@@ -2418,8 +522,9 @@ interface SceneNode {
|
|
|
2418
522
|
textDecorationSkipInk: boolean;
|
|
2419
523
|
textUnderlineOffset: number | null;
|
|
2420
524
|
leadingTrim: LeadingTrim;
|
|
2421
|
-
|
|
2422
|
-
|
|
525
|
+
/** `null` is automatic, from the font. */
|
|
526
|
+
lineHeight: TextLength | null;
|
|
527
|
+
letterSpacing: TextLength;
|
|
2423
528
|
maxLines: number | null;
|
|
2424
529
|
/**
|
|
2425
530
|
* One entry per paragraph of `text`, in order. Missing entries are plain paragraphs, so text
|
|
@@ -2436,6 +541,11 @@ interface SceneNode {
|
|
|
2436
541
|
hangingList: boolean;
|
|
2437
542
|
styleRuns: StyleRun[];
|
|
2438
543
|
fontVariations: FontVariation[];
|
|
544
|
+
/**
|
|
545
|
+
* Whether a variable font's optical size follows the font size, as Figma's "Set optical size
|
|
546
|
+
* automatically" does by default; when it does not, the `opsz` in `fontVariations` applies.
|
|
547
|
+
*/
|
|
548
|
+
opticalSizeFromFontSize: boolean;
|
|
2439
549
|
fontFeatures: FontFeature[];
|
|
2440
550
|
horizontalConstraint: ConstraintType;
|
|
2441
551
|
verticalConstraint: ConstraintType;
|
|
@@ -2486,6 +596,24 @@ interface SceneNode {
|
|
|
2486
596
|
* when the ratio was locked, not a reduced ratio. Null leaves the proportions free.
|
|
2487
597
|
*/
|
|
2488
598
|
targetAspectRatio: Vector | null;
|
|
599
|
+
/** A connector's ends and the line between them; null on other layers. */
|
|
600
|
+
connectorStart: ConnectorEndpoint | null;
|
|
601
|
+
connectorEnd: ConnectorEndpoint | null;
|
|
602
|
+
connectorLineType: ConnectorLineType;
|
|
603
|
+
connectorStartCap: StrokeCap;
|
|
604
|
+
connectorEndCap: StrokeCap;
|
|
605
|
+
/**
|
|
606
|
+
* An elbow connector's segments between its first and last, in order, once one was dragged;
|
|
607
|
+
* empty while it routes itself. Kept, unused, while the line is straight or curved.
|
|
608
|
+
*/
|
|
609
|
+
connectorControlPoints: ConnectorControlPoint[];
|
|
610
|
+
/**
|
|
611
|
+
* A curved connector's two cubic control points, in the connector's own axes, once its curve
|
|
612
|
+
* was dragged; null while it curves by itself. Kept, unused, while the line is not curved.
|
|
613
|
+
*/
|
|
614
|
+
connectorCurveHandles: [Vector, Vector] | null;
|
|
615
|
+
/** Where a connector's label was dragged to; null while it sits midway along the line. */
|
|
616
|
+
connectorLabelPosition: ConnectorLabelPosition | null;
|
|
2489
617
|
isMask: boolean;
|
|
2490
618
|
maskType: MaskType;
|
|
2491
619
|
maskIsOutline: boolean;
|
|
@@ -2502,6 +630,15 @@ interface SceneNode {
|
|
|
2502
630
|
autoRename: boolean;
|
|
2503
631
|
pointCount: number;
|
|
2504
632
|
starInnerRadius: number;
|
|
633
|
+
/** The FigJam kind a SHAPE_WITH_TEXT draws; its label is the node's own text. */
|
|
634
|
+
shapeWithTextType: ShapeWithTextType;
|
|
635
|
+
/** The height a shape with text was given; it grows past it to fit its label. 0 is unset. */
|
|
636
|
+
shapeUserHeight: number;
|
|
637
|
+
/**
|
|
638
|
+
* Whether a shape with text keeps its height and cuts its label off with "…" instead of growing,
|
|
639
|
+
* as FigJam does once the shape's height was set.
|
|
640
|
+
*/
|
|
641
|
+
shapeTruncates: boolean;
|
|
2505
642
|
componentId: string | null;
|
|
2506
643
|
instanceOverrides: InstanceOverrideState;
|
|
2507
644
|
componentPropertyDefinitions: ComponentPropertyDefinition[];
|
|
@@ -2534,6 +671,12 @@ interface SceneNode {
|
|
|
2534
671
|
componentScale: number;
|
|
2535
672
|
variableModes: VariableModeMap;
|
|
2536
673
|
exportSettings: ExportSetting[];
|
|
674
|
+
/**
|
|
675
|
+
* The id of the status a team gave the layer, a state of the document's workflow such as Ready
|
|
676
|
+
* for dev. It stays while the layer sits where it cannot show one; `effectiveStatus` tells
|
|
677
|
+
* whether it shows.
|
|
678
|
+
*/
|
|
679
|
+
status: string | null;
|
|
2537
680
|
pluginData: PluginDataEntry[];
|
|
2538
681
|
pluginRelaunchData: PluginRelaunchDataEntry[];
|
|
2539
682
|
internalOnly: boolean;
|
|
@@ -2541,6 +684,12 @@ interface SceneNode {
|
|
|
2541
684
|
flipY: boolean;
|
|
2542
685
|
textPicture: Uint8Array | null;
|
|
2543
686
|
derivedTextGlyphs: DerivedTextGlyph[] | null;
|
|
687
|
+
/**
|
|
688
|
+
* How far a text's lines reach down from its top: measured at its width when its text or width
|
|
689
|
+
* changes, or read from the lines a file saved, and never saved itself. A fixed-size box does not
|
|
690
|
+
* clip them, as in Figma, so its visual bounds reach this far. Null when not known.
|
|
691
|
+
*/
|
|
692
|
+
derivedTextHeight: number | null;
|
|
2544
693
|
/** Format-neutral layout path for text-on-path nodes. */
|
|
2545
694
|
textPathData: TextPathData | null;
|
|
2546
695
|
/** Node-local box that maps textPathData into the node coordinate space. */
|
|
@@ -2577,9 +726,44 @@ interface ComponentPropertyDefinition {
|
|
|
2577
726
|
slotSettings?: SlotSettings;
|
|
2578
727
|
}
|
|
2579
728
|
type VariableType = 'COLOR' | 'FLOAT' | 'STRING' | 'BOOLEAN';
|
|
2580
|
-
|
|
729
|
+
interface VariableAlias {
|
|
2581
730
|
aliasId: string;
|
|
2582
|
-
}
|
|
731
|
+
}
|
|
732
|
+
/** Figma's two-argument color expression; opacity is a percentage, not an alpha multiplier. */
|
|
733
|
+
interface VariableColorExpression {
|
|
734
|
+
expression: 'COMPOSE_COLOR';
|
|
735
|
+
color: Color | VariableAlias;
|
|
736
|
+
opacity: number | VariableAlias;
|
|
737
|
+
}
|
|
738
|
+
type VariableLiteral = Color | number | string | boolean;
|
|
739
|
+
/** The arithmetic, comparison, logic and conversions a formula combines values with. */
|
|
740
|
+
declare const VARIABLE_FORMULA_OPERATORS: readonly ["add", "subtract", "multiply", "divide", "negate", "equal", "notEqual", "less", "lessOrEqual", "greater", "greaterOrEqual", "and", "or", "not", "text", "truthy", "if"];
|
|
741
|
+
type VariableFormulaOperator = (typeof VARIABLE_FORMULA_OPERATORS)[number];
|
|
742
|
+
interface VariableFormulaOperation {
|
|
743
|
+
operator: VariableFormulaOperator;
|
|
744
|
+
operands: VariableFormulaNode[];
|
|
745
|
+
}
|
|
746
|
+
type VariableFormulaNode = VariableLiteral | VariableAlias | VariableFormulaOperation;
|
|
747
|
+
interface VariableFormula {
|
|
748
|
+
expression: 'FORMULA';
|
|
749
|
+
type: VariableType;
|
|
750
|
+
value: VariableFormulaNode;
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* An imported expression OpenPencil cannot evaluate, kept as the file wrote it so saving writes it
|
|
754
|
+
* back. `references` holds one entry per alias in `value`, in the order the format walks them, and
|
|
755
|
+
* `null` where the alias names a variable this document does not have. `modes` holds the mode id of
|
|
756
|
+
* each mode key in `value`, in the same walk order.
|
|
757
|
+
*/
|
|
758
|
+
interface VariableUnsupportedExpression {
|
|
759
|
+
expression: 'UNSUPPORTED';
|
|
760
|
+
/** The function name the file gives, such as `VAR_MODE_LOOKUP`. */
|
|
761
|
+
function: string;
|
|
762
|
+
value: Record<string, unknown>;
|
|
763
|
+
references: (string | null)[];
|
|
764
|
+
modes: string[];
|
|
765
|
+
}
|
|
766
|
+
type VariableValue = VariableLiteral | VariableAlias | VariableColorExpression | VariableFormula | VariableUnsupportedExpression;
|
|
2583
767
|
type VariableModeMap = Record<string, string>;
|
|
2584
768
|
/** Property pickers a variable is offered in, as Figma names them. */
|
|
2585
769
|
declare const VARIABLE_SCOPES: readonly ["ALL_SCOPES", "TEXT_CONTENT", "CORNER_RADIUS", "WIDTH_HEIGHT", "GAP", "ALL_FILLS", "FRAME_FILL", "SHAPE_FILL", "TEXT_FILL", "STROKE", "STROKE_FLOAT", "EFFECT_FLOAT", "EFFECT_COLOR", "OPACITY", "FONT_STYLE", "FONT_FAMILY", "FONT_SIZE", "LINE_HEIGHT", "LETTER_SPACING", "PARAGRAPH_SPACING", "PARAGRAPH_INDENT", "FONT_VARIATIONS", "TRANSFORM"];
|
|
@@ -2592,10 +776,14 @@ type CodeSyntaxPlatform = (typeof CODE_SYNTAX_PLATFORMS)[number];
|
|
|
2592
776
|
*/
|
|
2593
777
|
declare const TOKEN_UNITS: readonly ["none", "px", "rem", "%", "ms", "s", "deg"];
|
|
2594
778
|
type TokenUnit = (typeof TOKEN_UNITS)[number];
|
|
2595
|
-
/**
|
|
779
|
+
/**
|
|
780
|
+
* CSS written in place of a number mode's value, such as `clamp(1rem, 4vw, 1.5rem)`. While the
|
|
781
|
+
* mode holds a plain number, `resolved` records it, so a number later edited elsewhere, Figma
|
|
782
|
+
* included, shows the CSS no longer describes it.
|
|
783
|
+
*/
|
|
2596
784
|
interface TokenExpression {
|
|
2597
785
|
css: string;
|
|
2598
|
-
resolved
|
|
786
|
+
resolved?: number;
|
|
2599
787
|
}
|
|
2600
788
|
interface Variable {
|
|
2601
789
|
id: string;
|
|
@@ -2662,5 +850,5 @@ declare function isLibraryCollection(collection: Pick<VariableCollection, 'key'>
|
|
|
2662
850
|
declare const MODE_ATTRIBUTE_PATTERN: RegExp;
|
|
2663
851
|
declare function isModeAttributeName(name: string): boolean;
|
|
2664
852
|
//#endregion
|
|
2665
|
-
export { AUTO_LAYOUT_GRID_COUNT, ArcData, AutoLayoutDirection, AxisSizingMode, BEHAVIOUR_CONTRACTS, BEHAVIOUR_KINDS, Behaviour, BehaviourBooleanBinding, BehaviourContract, BehaviourInteractionStates, BehaviourKind, BehaviourNumberSettings, BehaviourPartContract, BehaviourSpec, BehaviourValueContract, BehaviourValueType, BindingScope, BlendMode, CODE_SYNTAX_PLATFORMS, COMMENT_SORTS, CONTAINER_TYPES, CanvasGuide, CharacterStyleOverride, CodeSyntaxPlatform, CollectedSceneMutation, CommentAuthor, CommentListOptions, CommentReply, CommentSort, CommentThread, CommittedGraphEventError, ComponentPropertyDefinition, ComponentPropertyReference, ComponentPropertyReferenceField, ComponentPropertyTarget, ComponentPropertyType, ConstraintType, DEFAULT_NUMBER_SETTINGS, DEFAULT_SLOT_SETTINGS, DerivedTextGlyph, DocumentColorSpace, DropTargetOptions, EXPORT_FORMAT_IDS, Effect, EnabledLibraryBinding, ExportFormatId, ExportSetting, FITTED_CONTAINER_TYPES, FONT_WEIGHT_NAMES, FigmaLayoutMetadata, FigmaSourcePayload, Fill, FillType, FontFamilyStyle, FontFeature, FontVariation, GeometryPath, GradientStop, GradientTransform, GraphTransferInput, GraphTransferPlan, GridPosition, GridTrack, GridTrackSizing, GroupFit, GroupFitOptions, HandleMirroring, HyperlinkTarget, ICON_NAME, ICON_PAINTS, INSTANCE_FOLLOWED_FIELDS, INSTANCE_OVERRIDE_FIELDS, INSTANCE_SYNC_FIELDS, INSTANCE_SYNC_PROPS, INSTANCE_SYNC_TEXT_PROPS, INTERACTION_STATES, Icon, IconPaint, ImageScaleMode, InstanceExposureIssue, InstanceOverrideField, InstanceOverrideReferenceMapper, InstanceOverrideState, InteractionState, LIST_BULLET, LayoutAlign, LayoutAlignSelf, LayoutCounterAlign, LayoutDirection, LayoutGrid, LayoutGuideLine, LayoutGuideSection, LayoutMode, LayoutSizing, LayoutSizingAxis, LayoutWrap, LeadingTrim, LibraryAssetIdentity, LibraryAssetSource, ListNumberFormat, MAX_EXPORT_SCALE, MAX_LIST_INDENTATION, MIN_EXPORT_SCALE, MODE_ATTRIBUTE_PATTERN, MaskType, MutationImpactListener, NodeChangeObserver, NodeCloneMode, NodePreviewObserver, NodeTransferReferences, NodeType, NoiseType, NormalizableVectorNetwork, NumericNodeProperty, OPEN_PENCIL_PLUGIN_DATA, OPEN_PENCIL_PLUGIN_ID, OkHCLColor, OkHCLColorSpace, OkHCLPayload, PLAIN_PARAGRAPH, ParkedSlotContent, ParsedFontStyle, PatternAlignment, PatternTileType, PluginDataEntry, PluginDataField, PluginDataKey, PluginDataRole, PluginRelaunchDataEntry, ROOT_FONT_SIZE_PX, SHARED_TEXT_STYLE_FIELDS, SIZE_FIELDS, SceneGraph, SceneGraphEventHandlers, SceneGraphEvents, SceneMutationImpact, SceneNode, SerializedInstanceOverrideState, SerializedOverrideValue, ShaderComponent, ShaderFrameEncoding, ShaderPaint, ShaderPreset, SharedStyle, SharedStyleKind, SharedStyleType, SlotLimitViolation, SlotPropertyPatch, SlotScope, SlotSettings, SnapGuide, SnapResult, SourceLibraryPublication, SourceMetadata, StoredToken, Stroke, StrokeCap, StrokeCorners, StrokeJoin, StyleRun, StyleRunReferences, SwapInstanceOptions, SymbolLink, TEXT_BINDABLE_FIELDS, TEXT_LAYOUT_FIELDS, TEXT_METRIC_FIELDS, TEXT_PARAGRAPH_SPACING_FIELDS, TEXT_SHAPING_FIELDS, TOKEN_UNITS, TRANSFORM_FIELDS, TextAlignVertical, TextAutoResize, TextBindableField, TextBoundVariables, TextCase, TextDecoration, TextDecorationStyle, TextDirection, TextListItem, TextListType, TextParagraphRange, TextParagraphSpacingField, TextParagraphStyle, TextPathData, TokenExpression, TokenUnit, VARIABLE_SCOPES, Variable, VariableCollection, VariableCollectionMode, VariableModeFallback, VariableModeMap, VariableScope, VariableTransferReferences, VariableType, VariableValue, VariantPropSpec, VectorNetwork, VectorRegion, VectorSegment, VectorVertex, VisualBounds, VisualBoundsNode, WindingRule, addCollection, addMode, addVariable, applyComponentPropertyValue, applyGraphTransfer, aspectRatioLockEditable, assignVariableBindingUnits, autoLayoutSizingFields, behaviourContract, behaviourFromSpec, behaviourOwner, behaviourProperties, behaviourSpecSchema, behaviourToSpec, bindVariable, booleanBinding, byCreatedAt, canCreateInstance, canCreateSlot, captureGraphCheckpoint, captureTransferredState, claimSlotContent, clampExportScale, clearInstanceOverrides, clearNodeFillOkHCL, clearNodeStrokeOkHCL, clearSlotContent, clipBoundsToPolygon, clipPolygon, cloneInstanceOverrideState, cloneNodeProps, cloneVectorNetwork, collectSceneMutation, collectionsBoundIn, commentAnchor, commentPosition, commentThreadNumbers, commentTimestamp, compareCanvasPosition, componentPropertyDefinitions, componentPropertyOwners, computeAbsoluteBounds, computeBounds, computeDescendantVisualBounds, computeSelectionBounds, computeSnap, computeVisualBounds, contentPluginData, copyDerivedGlyphs, copyEffect, copyEffects, copyFill, copyFills, copyGeometryPaths, copyInstanceComponentProps, copyLayoutGrids, copyStroke, copyStrokes, copyStyleRun, copyStyleRuns, createCollection, createCommentReply, createCommentThread, createComponentPropertyId, createDefaultNode, createDefaultSourceMetadata, createInstance, createInstanceOverrideState, createMode, createSceneMutationImpact, createShaderPaint, createSlotProperty, createVariable, createsComponentCycle, cycleSafeParent, defaultStrokeAlign, defaultVariant, degToRad, deleteCommentReply, deleteCommentThread, deleteInstanceOverride, derivedAssetKey, derivedAssetVersion, deserializeInstanceOverrideState, detachInstance, detachOwnedSlotContent, editCommentThread, effectOverflow, emptyBehaviour, enforcedAspectRatio, exposableInstances, exposedInstances, fillSizingFields, findComponentPropertyTarget, findComponentPropertyTargets, findInstanceAncestor, findLayerByPath, findLiveCommentThread, fitEnclosingGroups, forEachInstanceOverride, formatListNumber, generateId, geometryBlobBounds, geometryCommandCoordCount, getAbsolutePosition, getAbsolutePositionFull, getAbsoluteRotation, getActiveModeId, getAxisAlignedBoundsInParent, getAxisAlignedWorldBounds, getFillOkHCL, getInstanceOverride, getInstances, getMainComponent, getNodeLocalMatrix, getNodeOkHCLPayloads, getNodeRotationOrigin, getNodeVariableModeId, getNodeWorldBounds, getParentToContainerMatrix, getParentWorldMatrix, getSharedStyles, getStrokeOkHCL, getVariablesByType, getVariablesForCollection, getWorldHandles, getWorldMatrix, guessInteractionStates, guessOnOff, guideOwnersOnPage, hasBehaviour, hasInstanceOverride, hasNewerComments, hasParagraphSpacing, hasPluginData, hasSameCopySource, hasShaderPaint, hasTextList, hitTest, hitTestDeep, hitTestDropTarget, hitTestOpenContainer, hitTestSelectable, iconGlyph, iconLayerName, iconNames, iconSchema, iconTintSchema, instanceExposureIssue, instanceMainComponent, instanceSlotFrames, intersectVisualBounds, isAutoGridCount, isExportFormatId, isIconModified, isLibraryCollection, isModeAttributeName, isNumberRange, isNumericVariableBindingField, isOpenContainer, isPlacedIconName, isPluginDataEntry, isPointInNode, isPreferredComponent, isShaderFrameCurrent, isTranslationOnly, isValidExportScale, jsonPluginDataField, layerPath, layersUsingVariables, layoutGridCount, layoutGuideLines, layoutGuideSections, layoutSizing, layoutSizingError, layoutSizingInParent, layoutSizingOptions, layoutSizingUpdates, listCommentThreads, listNumberFormat, liveReplies, localTransformFromWorld, lockedAspectRatioTarget, markCopySource, mergeCommentThreads, mergeVectorNetworks, missingBindings, modesDefaultFirst, mutationLayoutScopeIds, newStrokeGeometry, nodeVisualBounds, nonPreferredLayers, normalizeFontFamily, normalizeFontStyleName, normalizeVectorNetwork, numberSettings, okhclToRGBA, ownsSlotContent, paddingFromShorthand, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, parseAutoLayoutDirection, parseCounterAxisAlign, parseFontStyle, parseLayoutAlignSelf, parseOkHCLPayload, parsePrimaryAxisAlign, partBinding, pluginDataEntry, polygonVertices, populateInstanceChildren, prepareGraphTransfer, prepareNodeTransfer, prepareVariableTransfer, radToDeg, readAllPluginData, readBehaviour, readComments, readIcon, readIconTint, readPluginData, readShaderPaints, recapturedAspectRatio, reconcileVariableBindings, recordInstanceOverride, recordSceneMutations, redoGroupFit, remapInstanceOverrideState, remapStyleRunReferences, removeCollection, removeComponentProperty, removeGraphTransfer, removeMode, removeVariable, renameBehaviourProperties, renameMode, replyToCommentThread, rescaleNodeTree, resetSlotContent, resolveColorVariable, resolveColorVariableForNode, resolveCommentThread, resolveComponentPropertyValue, resolveNumberVariable, resolveNumberVariableForNode, resolveStringVariableForNode, resolveVariable, resolveVariableForNode, resolvedNumericBindings, resolvedPaintBindings, resolvedRunBindings, resolvedValueBindings, restingVariant, restoreOwnedSlotContent, rgbaToOkHCL, rotatePoint, rotatedBBox, rotatedCorners, scaleGeometryPaths, scaleNodeChanges, serializeInstanceOverrideState, serializeOkHCLPayload, setActiveMode, setDefaultMode, setIdSession, setInstanceOverride, setNodeFillOkHCL, setNodeStrokeOkHCL, shaderFrameEncoding, shaderFramePixels, shaderOfPaint, shaderPaintSchema, shaderPresetKey, shaderPresetSchema, sharedParagraphSpacing, sharedStyleRefKey, sharedStyleTypeForKind, sizeKeepingAspectRatio, slotLimitViolations, slotOwner, slotPropertyId, slotScope, strokeOverflow, styleDetachmentChanges, styleRunReferences, styleToVariant, styleToWeight, swapInstanceComponent, syncInstance, syncInstances, syncInstancesTogether, takesPartInThread, textAutoResizeFor, textBinding, textListItems, textParagraphRanges, textPluginDataField, tokenNumberFromUnit, tokenNumberInUnit, topLevelNumberDigits, transformGeometryBlob, transformGeometryPaths, transformVectorNetwork, trimParagraphStyles, unbindVariable, undoGroupFit, unionVisualBounds, updateNodePreview, updateSlotProperty, validateVectorNetwork, variableBindingOwner, variableText, variablesResolvingThrough, variantDefaultValue, vectorNetworksEqual, weightToStyle, withAllPluginData, withBehaviour, withIcon, withIconTint, withIndentation, withListType, withLiveComments, withParagraphSpacing, withPluginData, withShaderPaints, withoutPluginData, writeComments };
|
|
853
|
+
export { ArcData, AxisSizingMode, BlendMode, CODE_SYNTAX_PLATFORMS, CharacterStyleOverride, CodeSyntaxPlatform, CommentReply, CommentThread, ComponentPropertyDefinition, ComponentPropertyReference, ComponentPropertyReferenceField, ComponentPropertyType, ConnectorControlPoint, ConnectorEndpoint, ConnectorLabelPosition, ConnectorLineType, ConnectorMagnet, ConstraintType, DerivedTextGlyph, DocumentColorSpace, DocumentKind, Effect, EnabledLibraryBinding, ExportColorProfile, ExportSetting, ExportSize, FigmaLayoutMetadata, FigmaSourcePayload, Fill, FillType, FontFeature, FontVariation, GeometryPath, GradientStop, GradientTransform, GridPosition, GridTrack, GridTrackSizing, HandleMirroring, HyperlinkTarget, ImageScaleMode, LayoutAlign, LayoutAlignSelf, LayoutCounterAlign, LayoutDirection, LayoutGrid, LayoutMode, LayoutSizing, LayoutWrap, LeadingTrim, LibraryAssetIdentity, LibraryAssetSource, MODE_ATTRIBUTE_PATTERN, MaskType, NodeChangeObserver, NodeType, NoiseType, NumericNodeProperty, PatternAlignment, PatternTileType, PluginDataEntry, PluginRelaunchDataEntry, SceneGraphEventHandlers, SceneGraphEvents, SceneNode, SharedStyle, SharedStyleKind, SharedStyleType, SlotSettings, SourceLibraryPublication, SourceMetadata, Stroke, StrokeCap, StrokeJoin, StyleRun, SymbolLink, TEXT_BINDABLE_FIELDS, TOKEN_UNITS, TextAlignVertical, TextAutoResize, TextBindableField, TextBoundVariables, TextCase, TextDecoration, TextDecorationStyle, TextDirection, TextLength, TextListType, TextParagraphSpacingField, TextParagraphStyle, TextPathData, TokenExpression, TokenUnit, VARIABLE_FORMULA_OPERATORS, VARIABLE_SCOPES, Variable, VariableAlias, VariableCollection, VariableCollectionMode, VariableColorExpression, VariableFormula, VariableFormulaNode, VariableFormulaOperation, VariableFormulaOperator, VariableLiteral, VariableModeMap, VariableScope, VariableType, VariableUnsupportedExpression, VariableValue, VariantPropSpec, VectorNetwork, VectorRegion, VectorSegment, VectorVertex, WindingRule, isLibraryCollection, isModeAttributeName };
|
|
2666
854
|
//# sourceMappingURL=types.d.ts.map
|