@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
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
//#region src/variables/schema.d.ts
|
|
3
|
+
declare const variableAliasSchema: v.ObjectSchema<{
|
|
4
|
+
readonly aliasId: v.StringSchema<undefined>;
|
|
5
|
+
}, undefined>;
|
|
6
|
+
declare const variableColorExpressionSchema: v.ObjectSchema<{
|
|
7
|
+
readonly expression: v.LiteralSchema<"COMPOSE_COLOR", undefined>;
|
|
8
|
+
readonly color: v.UnionSchema<[v.ObjectSchema<{
|
|
9
|
+
readonly aliasId: v.StringSchema<undefined>;
|
|
10
|
+
}, undefined>, v.ObjectSchema<{
|
|
11
|
+
readonly r: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
12
|
+
readonly g: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
13
|
+
readonly b: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
14
|
+
readonly a: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
15
|
+
}, undefined>], undefined>;
|
|
16
|
+
readonly opacity: v.UnionSchema<[v.ObjectSchema<{
|
|
17
|
+
readonly aliasId: v.StringSchema<undefined>;
|
|
18
|
+
}, undefined>, v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>], undefined>;
|
|
19
|
+
}, undefined>;
|
|
20
|
+
/**
|
|
21
|
+
* A variable or collection as data from outside the process can hold it: the fields every
|
|
22
|
+
* reader relies on are checked, and the rest pass through as they are.
|
|
23
|
+
*/
|
|
24
|
+
declare const variableSchema: v.LooseObjectSchema<{
|
|
25
|
+
readonly id: v.StringSchema<undefined>;
|
|
26
|
+
readonly name: v.StringSchema<undefined>;
|
|
27
|
+
readonly type: v.StringSchema<undefined>;
|
|
28
|
+
readonly collectionId: v.StringSchema<undefined>;
|
|
29
|
+
readonly valuesByMode: v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>;
|
|
30
|
+
}, undefined>;
|
|
31
|
+
declare const variableCollectionSchema: v.LooseObjectSchema<{
|
|
32
|
+
readonly id: v.StringSchema<undefined>;
|
|
33
|
+
readonly name: v.StringSchema<undefined>;
|
|
34
|
+
readonly defaultModeId: v.StringSchema<undefined>;
|
|
35
|
+
readonly modes: v.ArraySchema<v.UnknownSchema, undefined>;
|
|
36
|
+
readonly variableIds: v.ArraySchema<v.UnknownSchema, undefined>;
|
|
37
|
+
}, undefined>;
|
|
38
|
+
//#endregion
|
|
39
|
+
export { variableAliasSchema, variableCollectionSchema, variableColorExpressionSchema, variableSchema };
|
|
40
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","names":[],"sources":["../../src/variables/schema.ts"],"mappings":";;cAKa,qBAAmB,EAAA;oBAAnB,EAAA;;cACA,+BAA6B,EAAA;;;;;;;;;;;;;;;;;;cAU7B,gBAAc,EAAA;;;;;;;cAQd,0BAAwB,EAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { finiteNumberSchema } from "../primitives/schema.js";
|
|
2
|
+
import { colorSchema } from "../color/schema.js";
|
|
3
|
+
import * as v from "valibot";
|
|
4
|
+
//#region src/variables/schema.ts
|
|
5
|
+
const variableAliasSchema = v.object({ aliasId: v.string() });
|
|
6
|
+
const variableColorExpressionSchema = v.object({
|
|
7
|
+
expression: v.literal("COMPOSE_COLOR"),
|
|
8
|
+
color: v.union([variableAliasSchema, colorSchema]),
|
|
9
|
+
opacity: v.union([variableAliasSchema, finiteNumberSchema])
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* A variable or collection as data from outside the process can hold it: the fields every
|
|
13
|
+
* reader relies on are checked, and the rest pass through as they are.
|
|
14
|
+
*/
|
|
15
|
+
const variableSchema = v.looseObject({
|
|
16
|
+
id: v.string(),
|
|
17
|
+
name: v.string(),
|
|
18
|
+
type: v.string(),
|
|
19
|
+
collectionId: v.string(),
|
|
20
|
+
valuesByMode: v.record(v.string(), v.unknown())
|
|
21
|
+
});
|
|
22
|
+
const variableCollectionSchema = v.looseObject({
|
|
23
|
+
id: v.string(),
|
|
24
|
+
name: v.string(),
|
|
25
|
+
defaultModeId: v.string(),
|
|
26
|
+
modes: v.array(v.unknown()),
|
|
27
|
+
variableIds: v.array(v.unknown())
|
|
28
|
+
});
|
|
29
|
+
//#endregion
|
|
30
|
+
export { variableAliasSchema, variableCollectionSchema, variableColorExpressionSchema, variableSchema };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","names":[],"sources":["../../src/variables/schema.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport { colorSchema } from '../color/schema'\nimport { finiteNumberSchema } from '../primitives/schema'\n\nexport const variableAliasSchema = v.object({ aliasId: v.string() })\nexport const variableColorExpressionSchema = v.object({\n expression: v.literal('COMPOSE_COLOR'),\n color: v.union([variableAliasSchema, colorSchema]),\n opacity: v.union([variableAliasSchema, finiteNumberSchema])\n})\n\n/**\n * A variable or collection as data from outside the process can hold it: the fields every\n * reader relies on are checked, and the rest pass through as they are.\n */\nexport const variableSchema = v.looseObject({\n id: v.string(),\n name: v.string(),\n type: v.string(),\n collectionId: v.string(),\n valuesByMode: v.record(v.string(), v.unknown())\n})\n\nexport const variableCollectionSchema = v.looseObject({\n id: v.string(),\n name: v.string(),\n defaultModeId: v.string(),\n modes: v.array(v.unknown()),\n variableIds: v.array(v.unknown())\n})\n"],"mappings":";;;;AAKA,MAAa,sBAAsB,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AACnE,MAAa,gCAAgC,EAAE,OAAO;CACpD,YAAY,EAAE,QAAQ,eAAe;CACrC,OAAO,EAAE,MAAM,CAAC,qBAAqB,WAAW,CAAC;CACjD,SAAS,EAAE,MAAM,CAAC,qBAAqB,kBAAkB,CAAC;AAC5D,CAAC;;;;;AAMD,MAAa,iBAAiB,EAAE,YAAY;CAC1C,IAAI,EAAE,OAAO;CACb,MAAM,EAAE,OAAO;CACf,MAAM,EAAE,OAAO;CACf,cAAc,EAAE,OAAO;CACvB,cAAc,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC;AAChD,CAAC;AAED,MAAa,2BAA2B,EAAE,YAAY;CACpD,IAAI,EAAE,OAAO;CACb,MAAM,EAAE,OAAO;CACf,eAAe,EAAE,OAAO;CACxB,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC;CAC1B,aAAa,EAAE,MAAM,EAAE,QAAQ,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { VariableValue } from "../types.js";
|
|
2
|
+
//#region src/variables/text.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The text a variable bound to text content shows: a string as it is, and a number or boolean
|
|
5
|
+
* as Figma writes it, since Figma lets either be text content. A formula's `text()` and a `+`
|
|
6
|
+
* that joins text write numbers the same way.
|
|
7
|
+
*/
|
|
8
|
+
declare function variableText(value: VariableValue | undefined): string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Whether Figma reads a value as true, as a formula's `truthy()` and a visibility binding do: a
|
|
11
|
+
* number other than 0, and text other than "", "false", "no" or "off".
|
|
12
|
+
*/
|
|
13
|
+
declare function variableTruthy(value: VariableValue | undefined): boolean | undefined;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { variableText, variableTruthy };
|
|
16
|
+
//# sourceMappingURL=text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","names":[],"sources":["../../src/variables/text.ts"],"mappings":";;;;;;;iBAOgB,aAAa,OAAO;;;;;iBAsCpB,eAAe,OAAO"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//#region src/variables/text.ts
|
|
2
|
+
/**
|
|
3
|
+
* The text a variable bound to text content shows: a string as it is, and a number or boolean
|
|
4
|
+
* as Figma writes it, since Figma lets either be text content. A formula's `text()` and a `+`
|
|
5
|
+
* that joins text write numbers the same way.
|
|
6
|
+
*/
|
|
7
|
+
function variableText(value) {
|
|
8
|
+
if (typeof value === "string") return value;
|
|
9
|
+
if (typeof value === "boolean") return String(value);
|
|
10
|
+
if (typeof value === "number" && Number.isFinite(value)) return numberText(value);
|
|
11
|
+
}
|
|
12
|
+
const INT32_MIN = -2147483648;
|
|
13
|
+
const INT32_MAX = 2147483647;
|
|
14
|
+
/** How near zero a value must be for Figma to write it as 0. */
|
|
15
|
+
const ZERO_TOLERANCE = 1e-6;
|
|
16
|
+
/**
|
|
17
|
+
* A number as Figma writes it as text, read at the 32-bit precision Figma stores: within a
|
|
18
|
+
* millionth of zero as 0, a whole number as that integer clamped to 32 bits, and anything else
|
|
19
|
+
* with two decimals, its sign kept and an exact tie rounded to even, as C's `%.2f` does (0.125
|
|
20
|
+
* is "0.12", 0.999 is "1.00", -0.004 is "-0.00", 2.0000002 is "2.00").
|
|
21
|
+
*/
|
|
22
|
+
function numberText(input) {
|
|
23
|
+
const value = Math.fround(input);
|
|
24
|
+
if (Math.abs(value) < ZERO_TOLERANCE) return "0";
|
|
25
|
+
if (Number.isInteger(value)) return String(Math.min(INT32_MAX, Math.max(INT32_MIN, value)));
|
|
26
|
+
const scaled = Math.abs(value) * 100;
|
|
27
|
+
const floor = Math.floor(scaled);
|
|
28
|
+
const cents = scaled - floor === .5 ? floor + floor % 2 : Math.round(scaled);
|
|
29
|
+
return `${value < 0 ? "-" : ""}${Math.floor(cents / 100)}.${String(cents % 100).padStart(2, "0")}`;
|
|
30
|
+
}
|
|
31
|
+
/** Text Figma reads as false besides the empty string, ignoring case and surrounding spaces. */
|
|
32
|
+
const FALSE_WORDS = /* @__PURE__ */ new Set([
|
|
33
|
+
"false",
|
|
34
|
+
"no",
|
|
35
|
+
"off"
|
|
36
|
+
]);
|
|
37
|
+
/**
|
|
38
|
+
* Whether Figma reads a value as true, as a formula's `truthy()` and a visibility binding do: a
|
|
39
|
+
* number other than 0, and text other than "", "false", "no" or "off".
|
|
40
|
+
*/
|
|
41
|
+
function variableTruthy(value) {
|
|
42
|
+
if (typeof value === "boolean") return value;
|
|
43
|
+
if (typeof value === "number") return value !== 0;
|
|
44
|
+
if (typeof value === "string") return value !== "" && !FALSE_WORDS.has(value.trim().toLowerCase());
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { variableText, variableTruthy };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","names":[],"sources":["../../src/variables/text.ts"],"sourcesContent":["import type { VariableValue } from '../types'\n\n/**\n * The text a variable bound to text content shows: a string as it is, and a number or boolean\n * as Figma writes it, since Figma lets either be text content. A formula's `text()` and a `+`\n * that joins text write numbers the same way.\n */\nexport function variableText(value: VariableValue | undefined): string | undefined {\n if (typeof value === 'string') return value\n if (typeof value === 'boolean') return String(value)\n if (typeof value === 'number' && Number.isFinite(value)) return numberText(value)\n return undefined\n}\n\nconst INT32_MIN = -2_147_483_648\nconst INT32_MAX = 2_147_483_647\n\n/** How near zero a value must be for Figma to write it as 0. */\nconst ZERO_TOLERANCE = 1e-6\n\n/**\n * A number as Figma writes it as text, read at the 32-bit precision Figma stores: within a\n * millionth of zero as 0, a whole number as that integer clamped to 32 bits, and anything else\n * with two decimals, its sign kept and an exact tie rounded to even, as C's `%.2f` does (0.125\n * is \"0.12\", 0.999 is \"1.00\", -0.004 is \"-0.00\", 2.0000002 is \"2.00\").\n */\nfunction numberText(input: number): string {\n const value = Math.fround(input)\n if (Math.abs(value) < ZERO_TOLERANCE) return '0'\n if (Number.isInteger(value)) return String(Math.min(INT32_MAX, Math.max(INT32_MIN, value)))\n const scaled = Math.abs(value) * 100\n const floor = Math.floor(scaled)\n const tie = scaled - floor === 0.5\n const cents = tie ? floor + (floor % 2) : Math.round(scaled)\n const sign = value < 0 ? '-' : ''\n return `${sign}${Math.floor(cents / 100)}.${String(cents % 100).padStart(2, '0')}`\n}\n\n/** Text Figma reads as false besides the empty string, ignoring case and surrounding spaces. */\nconst FALSE_WORDS = new Set(['false', 'no', 'off'])\n\n/**\n * Whether Figma reads a value as true, as a formula's `truthy()` and a visibility binding do: a\n * number other than 0, and text other than \"\", \"false\", \"no\" or \"off\".\n */\nexport function variableTruthy(value: VariableValue | undefined): boolean | undefined {\n if (typeof value === 'boolean') return value\n if (typeof value === 'number') return value !== 0\n if (typeof value === 'string') return value !== '' && !FALSE_WORDS.has(value.trim().toLowerCase())\n return undefined\n}\n"],"mappings":";;;;;;AAOA,SAAgB,aAAa,OAAsD;CACjF,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,IAAI,OAAO,UAAU,WAAW,OAAO,OAAO,KAAK;CACnD,IAAI,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,GAAG,OAAO,WAAW,KAAK;AAElF;AAEA,MAAM,YAAY;AAClB,MAAM,YAAY;;AAGlB,MAAM,iBAAiB;;;;;;;AAQvB,SAAS,WAAW,OAAuB;CACzC,MAAM,QAAQ,KAAK,OAAO,KAAK;CAC/B,IAAI,KAAK,IAAI,KAAK,IAAI,gBAAgB,OAAO;CAC7C,IAAI,OAAO,UAAU,KAAK,GAAG,OAAO,OAAO,KAAK,IAAI,WAAW,KAAK,IAAI,WAAW,KAAK,CAAC,CAAC;CAC1F,MAAM,SAAS,KAAK,IAAI,KAAK,IAAI;CACjC,MAAM,QAAQ,KAAK,MAAM,MAAM;CAE/B,MAAM,QADM,SAAS,UAAU,KACX,QAAS,QAAQ,IAAK,KAAK,MAAM,MAAM;CAE3D,OAAO,GADM,QAAQ,IAAI,MAAM,KACd,KAAK,MAAM,QAAQ,GAAG,EAAE,GAAG,OAAO,QAAQ,GAAG,CAAC,CAAC,SAAS,GAAG,GAAG;AACjF;;AAGA,MAAM,8BAAc,IAAI,IAAI;CAAC;CAAS;CAAM;AAAK,CAAC;;;;;AAMlD,SAAgB,eAAe,OAAuD;CACpF,IAAI,OAAO,UAAU,WAAW,OAAO;CACvC,IAAI,OAAO,UAAU,UAAU,OAAO,UAAU;CAChD,IAAI,OAAO,UAAU,UAAU,OAAO,UAAU,MAAM,CAAC,YAAY,IAAI,MAAM,KAAK,CAAC,CAAC,YAAY,CAAC;AAEnG"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TokenExpression, TokenUnit, Variable, VariableValue } from "../types.js";
|
|
2
|
+
//#region src/variables/token.d.ts
|
|
3
|
+
/** `rem` tokens are stored in canvas pixels and shown against this root font size. */
|
|
4
|
+
declare const ROOT_FONT_SIZE_PX = 16;
|
|
5
|
+
/** The stored number for a value typed in a unit: `1.5` in `rem` is 24 canvas pixels. */
|
|
6
|
+
declare function tokenNumberFromUnit(value: number, unit: TokenUnit): number;
|
|
7
|
+
/** A stored number as it reads in its unit: 24 canvas pixels in `rem` is `1.5`. */
|
|
8
|
+
declare function tokenNumberInUnit(value: number, unit: TokenUnit): number;
|
|
9
|
+
/**
|
|
10
|
+
* A CSS expression outlives edits to its mode's value, whatever the value becomes; it records the
|
|
11
|
+
* value only while that is a plain number.
|
|
12
|
+
*/
|
|
13
|
+
declare function tokenExpressionForValue(expression: TokenExpression | undefined, value: VariableValue): TokenExpression | undefined;
|
|
14
|
+
/** Keep a variable's CSS expression for one mode in step with that mode's new value. */
|
|
15
|
+
declare function updateTokenExpression(variable: Variable, modeId: string, value: VariableValue): void;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { ROOT_FONT_SIZE_PX, tokenExpressionForValue, tokenNumberFromUnit, tokenNumberInUnit, updateTokenExpression };
|
|
18
|
+
//# sourceMappingURL=token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.d.ts","names":[],"sources":["../../src/variables/token.ts"],"mappings":";;;cAMa;;iBAGG,oBAAoB,eAAe,MAAM;;iBAKzC,kBAAkB,eAAe,MAAM;;;;;iBAQvC,wBACd,YAAY,6BACZ,OAAO,gBACN;;iBAQa,sBAAsB,UAAU,UAAU,gBAAgB,OAAO"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { omit } from "es-toolkit/object";
|
|
2
|
+
import { isEmptyObject } from "es-toolkit/predicate";
|
|
3
|
+
//#region src/variables/token.ts
|
|
4
|
+
/** `rem` tokens are stored in canvas pixels and shown against this root font size. */
|
|
5
|
+
const ROOT_FONT_SIZE_PX = 16;
|
|
6
|
+
/** The stored number for a value typed in a unit: `1.5` in `rem` is 24 canvas pixels. */
|
|
7
|
+
function tokenNumberFromUnit(value, unit) {
|
|
8
|
+
return unit === "rem" ? value * 16 : value;
|
|
9
|
+
}
|
|
10
|
+
/** A stored number as it reads in its unit: 24 canvas pixels in `rem` is `1.5`. */
|
|
11
|
+
function tokenNumberInUnit(value, unit) {
|
|
12
|
+
return unit === "rem" ? value / 16 : value;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A CSS expression outlives edits to its mode's value, whatever the value becomes; it records the
|
|
16
|
+
* value only while that is a plain number.
|
|
17
|
+
*/
|
|
18
|
+
function tokenExpressionForValue(expression, value) {
|
|
19
|
+
if (!expression) return void 0;
|
|
20
|
+
return typeof value === "number" ? {
|
|
21
|
+
css: expression.css,
|
|
22
|
+
resolved: value
|
|
23
|
+
} : { css: expression.css };
|
|
24
|
+
}
|
|
25
|
+
/** Keep a variable's CSS expression for one mode in step with that mode's new value. */
|
|
26
|
+
function updateTokenExpression(variable, modeId, value) {
|
|
27
|
+
const expression = tokenExpressionForValue(variable.expressions?.[modeId], value);
|
|
28
|
+
const others = omit(variable.expressions ?? {}, [modeId]);
|
|
29
|
+
const expressions = expression ? {
|
|
30
|
+
...others,
|
|
31
|
+
[modeId]: expression
|
|
32
|
+
} : others;
|
|
33
|
+
if (isEmptyObject(expressions)) delete variable.expressions;
|
|
34
|
+
else variable.expressions = expressions;
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { ROOT_FONT_SIZE_PX, tokenExpressionForValue, tokenNumberFromUnit, tokenNumberInUnit, updateTokenExpression };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.js","names":[],"sources":["../../src/variables/token.ts"],"sourcesContent":["import { omit } from 'es-toolkit/object'\nimport { isEmptyObject } from 'es-toolkit/predicate'\n\nimport type { TokenExpression, TokenUnit, Variable, VariableValue } from '../types'\n\n/** `rem` tokens are stored in canvas pixels and shown against this root font size. */\nexport const ROOT_FONT_SIZE_PX = 16\n\n/** The stored number for a value typed in a unit: `1.5` in `rem` is 24 canvas pixels. */\nexport function tokenNumberFromUnit(value: number, unit: TokenUnit): number {\n return unit === 'rem' ? value * ROOT_FONT_SIZE_PX : value\n}\n\n/** A stored number as it reads in its unit: 24 canvas pixels in `rem` is `1.5`. */\nexport function tokenNumberInUnit(value: number, unit: TokenUnit): number {\n return unit === 'rem' ? value / ROOT_FONT_SIZE_PX : value\n}\n\n/**\n * A CSS expression outlives edits to its mode's value, whatever the value becomes; it records the\n * value only while that is a plain number.\n */\nexport function tokenExpressionForValue(\n expression: TokenExpression | undefined,\n value: VariableValue\n): TokenExpression | undefined {\n if (!expression) return undefined\n return typeof value === 'number'\n ? { css: expression.css, resolved: value }\n : { css: expression.css }\n}\n\n/** Keep a variable's CSS expression for one mode in step with that mode's new value. */\nexport function updateTokenExpression(variable: Variable, modeId: string, value: VariableValue) {\n const expression = tokenExpressionForValue(variable.expressions?.[modeId], value)\n const others = omit(variable.expressions ?? {}, [modeId])\n const expressions = expression ? { ...others, [modeId]: expression } : others\n if (isEmptyObject(expressions)) delete variable.expressions\n else variable.expressions = expressions\n}\n"],"mappings":";;;;AAMA,MAAa,oBAAoB;;AAGjC,SAAgB,oBAAoB,OAAe,MAAyB;CAC1E,OAAO,SAAS,QAAQ,QAAA,KAA4B;AACtD;;AAGA,SAAgB,kBAAkB,OAAe,MAAyB;CACxE,OAAO,SAAS,QAAQ,QAAA,KAA4B;AACtD;;;;;AAMA,SAAgB,wBACd,YACA,OAC6B;CAC7B,IAAI,CAAC,YAAY,OAAO,KAAA;CACxB,OAAO,OAAO,UAAU,WACpB;EAAE,KAAK,WAAW;EAAK,UAAU;CAAM,IACvC,EAAE,KAAK,WAAW,IAAI;AAC5B;;AAGA,SAAgB,sBAAsB,UAAoB,QAAgB,OAAsB;CAC9F,MAAM,aAAa,wBAAwB,SAAS,cAAc,SAAS,KAAK;CAChF,MAAM,SAAS,KAAK,SAAS,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC;CACxD,MAAM,cAAc,aAAa;EAAE,GAAG;GAAS,SAAS;CAAW,IAAI;CACvE,IAAI,cAAc,WAAW,GAAG,OAAO,SAAS;MAC3C,SAAS,cAAc;AAC9B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { NUMERIC_FIELDS } from "./fields.js";
|
|
2
|
+
//#region src/variables/units.ts
|
|
3
|
+
function scaleVariableBindingUnits(node, factor) {
|
|
4
|
+
const variableBindingScales = { ...node.variableBindingScales };
|
|
5
|
+
const variableAssignmentScales = { ...node.variableAssignmentScales };
|
|
6
|
+
for (const field of NUMERIC_FIELDS) {
|
|
7
|
+
if (field === "opacity" || field === "rotation") continue;
|
|
8
|
+
if (field in node.boundVariables) variableBindingScales[field] = (variableBindingScales[field] ?? 1) * factor;
|
|
9
|
+
if (node.type === "INSTANCE") variableAssignmentScales[field] = (variableAssignmentScales[field] ?? 1) * factor;
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
variableBindingScales,
|
|
13
|
+
variableAssignmentScales
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { scaleVariableBindingUnits };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=units.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"units.js","names":[],"sources":["../../src/variables/units.ts"],"sourcesContent":["import type { SceneNode } from '../types'\nimport { NUMERIC_FIELDS } from './fields'\n\nexport function scaleVariableBindingUnits(node: SceneNode, factor: number): Partial<SceneNode> {\n const variableBindingScales = { ...node.variableBindingScales }\n const variableAssignmentScales = { ...node.variableAssignmentScales }\n for (const field of NUMERIC_FIELDS) {\n if (field === 'opacity' || field === 'rotation') continue\n if (field in node.boundVariables)\n variableBindingScales[field] = (variableBindingScales[field] ?? 1) * factor\n if (node.type === 'INSTANCE')\n variableAssignmentScales[field] = (variableAssignmentScales[field] ?? 1) * factor\n }\n return { variableBindingScales, variableAssignmentScales }\n}\n"],"mappings":";;AAGA,SAAgB,0BAA0B,MAAiB,QAAoC;CAC7F,MAAM,wBAAwB,EAAE,GAAG,KAAK,sBAAsB;CAC9D,MAAM,2BAA2B,EAAE,GAAG,KAAK,yBAAyB;CACpE,KAAK,MAAM,SAAS,gBAAgB;EAClC,IAAI,UAAU,aAAa,UAAU,YAAY;EACjD,IAAI,SAAS,KAAK,gBAChB,sBAAsB,UAAU,sBAAsB,UAAU,KAAK;EACvE,IAAI,KAAK,SAAS,YAChB,yBAAyB,UAAU,yBAAyB,UAAU,KAAK;CAC/E;CACA,OAAO;EAAE;EAAuB;CAAyB;AAC3D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { VariableLiteral, VariableUnsupportedExpression, VariableValue } from "../types.js";
|
|
2
|
+
//#region src/variables/value.d.ts
|
|
3
|
+
declare function isUnsupportedVariableValue(value: VariableValue | undefined): value is VariableUnsupportedExpression;
|
|
4
|
+
/** All references in one definition, including color and opacity operands. */
|
|
5
|
+
declare function variableValueReferences(value: VariableValue): string[];
|
|
6
|
+
/** Clone a value while remapping its references for transfer to another document. */
|
|
7
|
+
declare function mapVariableValueReferences(value: VariableValue, map: (id: string) => string, mapMode?: (id: string) => string): VariableValue;
|
|
8
|
+
/** Resolve operands through the caller's mode context; formula failures retain their diagnostics for the caller. */
|
|
9
|
+
declare function resolveVariableValue(value: VariableValue, resolve: (id: string) => VariableLiteral | undefined): VariableLiteral | undefined;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { isUnsupportedVariableValue, mapVariableValueReferences, resolveVariableValue, variableValueReferences };
|
|
12
|
+
//# sourceMappingURL=value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value.d.ts","names":[],"sources":["../../src/variables/value.ts"],"mappings":";;iBASgB,2BACd,OAAO,4BACN,SAAS;;iBAKI,wBAAwB,OAAO;;iBAkB/B,2BACd,OAAO,eACP,MAAM,uBACN,WAAU,wBACT;;iBAsBa,qBACd,OAAO,eACP,UAAU,eAAe,8BACxB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { VariableFormulaError, mapFormulaReferences } from "./formula/tree.js";
|
|
2
|
+
import { formulaValueType } from "./formula/check.js";
|
|
3
|
+
import { evaluateVariableFormula } from "./formula/evaluate.js";
|
|
4
|
+
import { variableColorExpressionSchema } from "./schema.js";
|
|
5
|
+
import { compact } from "es-toolkit/array";
|
|
6
|
+
import * as v from "valibot";
|
|
7
|
+
//#region src/variables/value.ts
|
|
8
|
+
function isUnsupportedVariableValue(value) {
|
|
9
|
+
return typeof value === "object" && "expression" in value && value.expression === "UNSUPPORTED";
|
|
10
|
+
}
|
|
11
|
+
/** All references in one definition, including color and opacity operands. */
|
|
12
|
+
function variableValueReferences(value) {
|
|
13
|
+
if (isUnsupportedVariableValue(value)) return compact(value.references);
|
|
14
|
+
if (typeof value !== "object") return [];
|
|
15
|
+
if ("aliasId" in value) return [value.aliasId];
|
|
16
|
+
if ("expression" in value && value.expression === "FORMULA") {
|
|
17
|
+
const references = [];
|
|
18
|
+
mapFormulaReferences(value.value, (id) => {
|
|
19
|
+
references.push(id);
|
|
20
|
+
return id;
|
|
21
|
+
});
|
|
22
|
+
return references;
|
|
23
|
+
}
|
|
24
|
+
if ("expression" in value) return [...variableValueReferences(value.color), ...variableValueReferences(value.opacity)];
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
/** Clone a value while remapping its references for transfer to another document. */
|
|
28
|
+
function mapVariableValueReferences(value, map, mapMode = (id) => id) {
|
|
29
|
+
if (isUnsupportedVariableValue(value)) return {
|
|
30
|
+
...structuredClone(value),
|
|
31
|
+
references: value.references.map((id) => id === null ? null : map(id)),
|
|
32
|
+
modes: value.modes.map(mapMode)
|
|
33
|
+
};
|
|
34
|
+
if (typeof value !== "object") return value;
|
|
35
|
+
if ("aliasId" in value) return { aliasId: map(value.aliasId) };
|
|
36
|
+
if ("expression" in value && value.expression === "FORMULA") return {
|
|
37
|
+
...value,
|
|
38
|
+
value: mapFormulaReferences(value.value, map)
|
|
39
|
+
};
|
|
40
|
+
if ("expression" in value) return {
|
|
41
|
+
expression: value.expression,
|
|
42
|
+
color: "aliasId" in value.color ? { aliasId: map(value.color.aliasId) } : { ...value.color },
|
|
43
|
+
opacity: typeof value.opacity === "object" ? { aliasId: map(value.opacity.aliasId) } : value.opacity
|
|
44
|
+
};
|
|
45
|
+
return { ...value };
|
|
46
|
+
}
|
|
47
|
+
/** Resolve operands through the caller's mode context; formula failures retain their diagnostics for the caller. */
|
|
48
|
+
function resolveVariableValue(value, resolve) {
|
|
49
|
+
if (isUnsupportedVariableValue(value)) return void 0;
|
|
50
|
+
if (typeof value !== "object") return value;
|
|
51
|
+
if ("aliasId" in value) return resolve(value.aliasId);
|
|
52
|
+
if (!("expression" in value)) return value;
|
|
53
|
+
if (value.expression === "FORMULA") {
|
|
54
|
+
const result = evaluateVariableFormula(value.value, resolve);
|
|
55
|
+
if (formulaValueType(result) !== value.type) throw new VariableFormulaError("Wrong formula result type");
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
const expression = v.parse(variableColorExpressionSchema, value);
|
|
59
|
+
const color = "aliasId" in expression.color ? resolve(expression.color.aliasId) : expression.color;
|
|
60
|
+
const opacity = typeof expression.opacity === "object" ? resolve(expression.opacity.aliasId) : expression.opacity;
|
|
61
|
+
if (!color || typeof color !== "object" || !Object.values(color).every(Number.isFinite) || typeof opacity !== "number" || !Number.isFinite(opacity)) return void 0;
|
|
62
|
+
return {
|
|
63
|
+
...color,
|
|
64
|
+
a: Math.min(1, Math.max(0, opacity / 100))
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { isUnsupportedVariableValue, mapVariableValueReferences, resolveVariableValue, variableValueReferences };
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=value.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value.js","names":[],"sources":["../../src/variables/value.ts"],"sourcesContent":["import { compact } from 'es-toolkit/array'\nimport * as v from 'valibot'\n\nimport type { VariableLiteral, VariableValue, VariableUnsupportedExpression } from '../types'\nimport { formulaValueType } from './formula/check'\nimport { evaluateVariableFormula } from './formula/evaluate'\nimport { mapFormulaReferences, VariableFormulaError } from './formula/tree'\nimport { variableColorExpressionSchema } from './schema'\n\nexport function isUnsupportedVariableValue(\n value: VariableValue | undefined\n): value is VariableUnsupportedExpression {\n return typeof value === 'object' && 'expression' in value && value.expression === 'UNSUPPORTED'\n}\n\n/** All references in one definition, including color and opacity operands. */\nexport function variableValueReferences(value: VariableValue): string[] {\n if (isUnsupportedVariableValue(value)) return compact(value.references)\n if (typeof value !== 'object') return []\n if ('aliasId' in value) return [value.aliasId]\n if ('expression' in value && value.expression === 'FORMULA') {\n const references: string[] = []\n mapFormulaReferences(value.value, (id) => {\n references.push(id)\n return id\n })\n return references\n }\n if ('expression' in value)\n return [...variableValueReferences(value.color), ...variableValueReferences(value.opacity)]\n return []\n}\n\n/** Clone a value while remapping its references for transfer to another document. */\nexport function mapVariableValueReferences(\n value: VariableValue,\n map: (id: string) => string,\n mapMode: (id: string) => string = (id) => id\n): VariableValue {\n if (isUnsupportedVariableValue(value))\n return {\n ...structuredClone(value),\n references: value.references.map((id) => (id === null ? null : map(id))),\n modes: value.modes.map(mapMode)\n }\n if (typeof value !== 'object') return value\n if ('aliasId' in value) return { aliasId: map(value.aliasId) }\n if ('expression' in value && value.expression === 'FORMULA')\n return { ...value, value: mapFormulaReferences(value.value, map) }\n if ('expression' in value)\n return {\n expression: value.expression,\n color: 'aliasId' in value.color ? { aliasId: map(value.color.aliasId) } : { ...value.color },\n opacity:\n typeof value.opacity === 'object' ? { aliasId: map(value.opacity.aliasId) } : value.opacity\n }\n return { ...value }\n}\n\n/** Resolve operands through the caller's mode context; formula failures retain their diagnostics for the caller. */\nexport function resolveVariableValue(\n value: VariableValue,\n resolve: (id: string) => VariableLiteral | undefined\n): VariableLiteral | undefined {\n if (isUnsupportedVariableValue(value)) return undefined\n if (typeof value !== 'object') return value\n if ('aliasId' in value) return resolve(value.aliasId)\n if (!('expression' in value)) return value\n if (value.expression === 'FORMULA') {\n // Evaluation checks every node it visits, so drawing never walks the tree twice; files are\n // checked against the full schema where they are read.\n const result = evaluateVariableFormula(value.value, resolve)\n if (formulaValueType(result) !== value.type)\n throw new VariableFormulaError('Wrong formula result type')\n return result\n }\n const expression = v.parse(variableColorExpressionSchema, value)\n const color = 'aliasId' in expression.color ? resolve(expression.color.aliasId) : expression.color\n const opacity =\n typeof expression.opacity === 'object'\n ? resolve(expression.opacity.aliasId)\n : expression.opacity\n if (\n !color ||\n typeof color !== 'object' ||\n !Object.values(color).every(Number.isFinite) ||\n typeof opacity !== 'number' ||\n !Number.isFinite(opacity)\n )\n return undefined\n return { ...color, a: Math.min(1, Math.max(0, opacity / 100)) }\n}\n"],"mappings":";;;;;;;AASA,SAAgB,2BACd,OACwC;CACxC,OAAO,OAAO,UAAU,YAAY,gBAAgB,SAAS,MAAM,eAAe;AACpF;;AAGA,SAAgB,wBAAwB,OAAgC;CACtE,IAAI,2BAA2B,KAAK,GAAG,OAAO,QAAQ,MAAM,UAAU;CACtE,IAAI,OAAO,UAAU,UAAU,OAAO,CAAC;CACvC,IAAI,aAAa,OAAO,OAAO,CAAC,MAAM,OAAO;CAC7C,IAAI,gBAAgB,SAAS,MAAM,eAAe,WAAW;EAC3D,MAAM,aAAuB,CAAC;EAC9B,qBAAqB,MAAM,QAAQ,OAAO;GACxC,WAAW,KAAK,EAAE;GAClB,OAAO;EACT,CAAC;EACD,OAAO;CACT;CACA,IAAI,gBAAgB,OAClB,OAAO,CAAC,GAAG,wBAAwB,MAAM,KAAK,GAAG,GAAG,wBAAwB,MAAM,OAAO,CAAC;CAC5F,OAAO,CAAC;AACV;;AAGA,SAAgB,2BACd,OACA,KACA,WAAmC,OAAO,IAC3B;CACf,IAAI,2BAA2B,KAAK,GAClC,OAAO;EACL,GAAG,gBAAgB,KAAK;EACxB,YAAY,MAAM,WAAW,KAAK,OAAQ,OAAO,OAAO,OAAO,IAAI,EAAE,CAAE;EACvE,OAAO,MAAM,MAAM,IAAI,OAAO;CAChC;CACF,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,IAAI,aAAa,OAAO,OAAO,EAAE,SAAS,IAAI,MAAM,OAAO,EAAE;CAC7D,IAAI,gBAAgB,SAAS,MAAM,eAAe,WAChD,OAAO;EAAE,GAAG;EAAO,OAAO,qBAAqB,MAAM,OAAO,GAAG;CAAE;CACnE,IAAI,gBAAgB,OAClB,OAAO;EACL,YAAY,MAAM;EAClB,OAAO,aAAa,MAAM,QAAQ,EAAE,SAAS,IAAI,MAAM,MAAM,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM;EAC3F,SACE,OAAO,MAAM,YAAY,WAAW,EAAE,SAAS,IAAI,MAAM,QAAQ,OAAO,EAAE,IAAI,MAAM;CACxF;CACF,OAAO,EAAE,GAAG,MAAM;AACpB;;AAGA,SAAgB,qBACd,OACA,SAC6B;CAC7B,IAAI,2BAA2B,KAAK,GAAG,OAAO,KAAA;CAC9C,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,IAAI,aAAa,OAAO,OAAO,QAAQ,MAAM,OAAO;CACpD,IAAI,EAAE,gBAAgB,QAAQ,OAAO;CACrC,IAAI,MAAM,eAAe,WAAW;EAGlC,MAAM,SAAS,wBAAwB,MAAM,OAAO,OAAO;EAC3D,IAAI,iBAAiB,MAAM,MAAM,MAAM,MACrC,MAAM,IAAI,qBAAqB,2BAA2B;EAC5D,OAAO;CACT;CACA,MAAM,aAAa,EAAE,MAAM,+BAA+B,KAAK;CAC/D,MAAM,QAAQ,aAAa,WAAW,QAAQ,QAAQ,WAAW,MAAM,OAAO,IAAI,WAAW;CAC7F,MAAM,UACJ,OAAO,WAAW,YAAY,WAC1B,QAAQ,WAAW,QAAQ,OAAO,IAClC,WAAW;CACjB,IACE,CAAC,SACD,OAAO,UAAU,YACjB,CAAC,OAAO,OAAO,KAAK,CAAC,CAAC,MAAM,OAAO,QAAQ,KAC3C,OAAO,YAAY,YACnB,CAAC,OAAO,SAAS,OAAO,GAExB,OAAO,KAAA;CACT,OAAO;EAAE,GAAG;EAAO,GAAG,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,UAAU,GAAG,CAAC;CAAE;AAChE"}
|
package/dist/vector-network.d.ts
CHANGED
|
@@ -1,2 +1,65 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { Fill, GeometryPath, SceneNode, VectorNetwork } from "./types.js";
|
|
2
|
+
import { Mat3 } from "./matrix.js";
|
|
3
|
+
import { VectorPathWindingRule } from "./parse-path.js";
|
|
4
|
+
//#region src/vector-network.d.ts
|
|
5
|
+
/** Concatenate vector networks while preserving independent geometry. */
|
|
6
|
+
declare function mergeVectorNetworks(networks: readonly VectorNetwork[]): VectorNetwork;
|
|
7
|
+
/**
|
|
8
|
+
* Map a VectorNetwork through an affine matrix: vertices as points,
|
|
9
|
+
* tangents as direction vectors (linear part only, no translation).
|
|
10
|
+
* Returns a deep copy; the input is not mutated.
|
|
11
|
+
*/
|
|
12
|
+
declare function transformVectorNetwork(m: Mat3, vn: VectorNetwork): VectorNetwork;
|
|
13
|
+
/** Whether any region has paints of its own, which it draws instead of the layer's fills. */
|
|
14
|
+
declare function hasRegionFills(network: VectorNetwork | null): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Whether fill geometry is the regions' outlines, one each, as a file or an edit writes it. A
|
|
17
|
+
* pasted vector has none, and an import skips empty outlines; their regions draw traced.
|
|
18
|
+
*/
|
|
19
|
+
declare function fillGeometryMatchesRegions(fillGeometry: readonly GeometryPath[], network: VectorNetwork): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Whether a vector's regions draw different fills, each its own or else the layer's, which Figma
|
|
22
|
+
* reads as mixed (live-verified: regions with equal fills of their own read the layer's).
|
|
23
|
+
*/
|
|
24
|
+
declare function regionFillsDiffer(network: VectorNetwork | null, layerFills: readonly Fill[]): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* What else an edit that sets a vector's fills changes: every region draws them, its own paints
|
|
27
|
+
* and style dropped, as setting fills does in Figma (live-verified). Edit entry points apply it.
|
|
28
|
+
*/
|
|
29
|
+
declare function regionFillChanges(node: SceneNode, changes: Partial<SceneNode>): Pick<Partial<SceneNode>, 'vectorNetwork'>;
|
|
30
|
+
/** The paints regions carry of their own. */
|
|
31
|
+
declare function regionFills(network: VectorNetwork | null): Fill[];
|
|
32
|
+
/** Structural equality of two VectorNetworks (order-sensitive, exact values). */
|
|
33
|
+
declare function vectorNetworksEqual(a: VectorNetwork, b: VectorNetwork): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Validate a VectorNetwork structure, returning an array of error messages.
|
|
36
|
+
* Empty array means the network is valid.
|
|
37
|
+
*/
|
|
38
|
+
declare function validateVectorNetwork(value: unknown): string[];
|
|
39
|
+
type NormalizableVectorNetwork = Omit<VectorNetwork, 'regions'> & {
|
|
40
|
+
regions?: VectorNetwork['regions'];
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Ensure every segment has tangentStart/tangentEnd and a regions array.
|
|
44
|
+
* Missing tangents default to {x:0, y:0} (straight line segments).
|
|
45
|
+
* Use at system boundaries where input may come from JSON/MCP.
|
|
46
|
+
*/
|
|
47
|
+
declare function normalizeVectorNetwork(vn: NormalizableVectorNetwork): VectorNetwork;
|
|
48
|
+
declare function vectorNetworkToSVGPaths(network: VectorNetwork, decimals?: number | null): string[];
|
|
49
|
+
/** Each region of a vector network as path data, its loops traced in turn. */
|
|
50
|
+
declare function regionSVGPaths(network: VectorNetwork, decimals?: number | null): string[];
|
|
51
|
+
/** The segments of a vector network that no region encloses. */
|
|
52
|
+
declare function looseSegments({ segments, regions }: VectorNetwork): VectorNetwork['segments'];
|
|
53
|
+
/** A path of a vector network as Figma's `vectorPaths` gives it. */
|
|
54
|
+
interface VectorPath {
|
|
55
|
+
windingRule: VectorPathWindingRule;
|
|
56
|
+
data: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A vector network as Figma's `vectorPaths`: each region as a path with its winding rule, then
|
|
60
|
+
* the segments no region encloses as one open path, at full precision.
|
|
61
|
+
*/
|
|
62
|
+
declare function vectorNetworkPaths(network: VectorNetwork): VectorPath[];
|
|
63
|
+
//#endregion
|
|
64
|
+
export { NormalizableVectorNetwork, VectorPath, fillGeometryMatchesRegions, hasRegionFills, looseSegments, mergeVectorNetworks, normalizeVectorNetwork, regionFillChanges, regionFills, regionFillsDiffer, regionSVGPaths, transformVectorNetwork, validateVectorNetwork, vectorNetworkPaths, vectorNetworkToSVGPaths, vectorNetworksEqual };
|
|
65
|
+
//# sourceMappingURL=vector-network.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector-network.d.ts","names":[],"sources":["../src/vector-network.ts"],"mappings":";;;;;iBAgBgB,oBAAoB,mBAAmB,kBAAkB;;;;;;iBAuCzD,uBAAuB,GAAG,MAAM,IAAI,gBAAgB;;iBAqBpD,eAAe,SAAS;;;;;iBAQxB,2BACd,uBAAuB,gBACvB,SAAS;;;;;iBASK,kBACd,SAAS,sBACT,qBAAqB;;;;;iBAmBP,kBACd,MAAM,WACN,SAAS,QAAQ,aAChB,KAAK,QAAQ;;iBAQA,YAAY,SAAS,uBAAuB;;iBAK5C,oBAAoB,GAAG,eAAe,GAAG;;;;;iBAYzC,sBAAsB;KA6K1B,4BAA4B,KAAK;EAC3C,UAAU;;;;;;;iBAQI,uBAAuB,IAAI,4BAA4B;iBAwJvD,wBACd,SAAS,eACT;;iBAkBc,eAAe,SAAS,eAAe;;iBAQvC,gBAAgB,UAAU,WAAW,gBAAgB;;UAMpD;EACf,aAAa;EACb;;;;;;iBAOc,mBAAmB,SAAS,gBAAgB"}
|