@open-pencil/scene-graph 0.16.0-beta.3 → 0.17.0-beta.1
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 +289 -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 +56 -0
- package/dist/behaviours/kinds.d.ts.map +1 -0
- 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 +42 -0
- package/dist/behaviours/layers.js.map +1 -0
- package/dist/behaviours/model.d.ts +45 -0
- package/dist/behaviours/model.d.ts.map +1 -0
- package/dist/behaviours/model.js +149 -0
- package/dist/behaviours/model.js.map +1 -0
- package/dist/behaviours/schema.d.ts +114 -0
- package/dist/behaviours/schema.d.ts.map +1 -0
- package/dist/behaviours/schema.js +71 -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 +4 -28
- package/dist/behaviours/spec.js.map +1 -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 +13 -0
- package/dist/checkpoint.d.ts.map +1 -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 +20 -0
- package/dist/components/properties.d.ts.map +1 -0
- package/dist/components/properties.js +125 -0
- package/dist/components/properties.js.map +1 -0
- package/dist/components/variants.d.ts +27 -0
- package/dist/components/variants.d.ts.map +1 -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 +53 -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 +159 -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 +270 -2
- package/dist/copy.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 +6 -0
- package/dist/css/index.js +6 -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/events.js.map +1 -0
- package/dist/export-format.d.ts +12 -0
- package/dist/export-format.d.ts.map +1 -0
- package/dist/export-format.js +22 -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 +63 -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 +259 -0
- package/dist/figjam/palette.d.ts.map +1 -0
- package/dist/figjam/palette.js +411 -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 +38 -0
- package/dist/generated/shape-with-text.d.ts.map +1 -0
- package/dist/generated/shape-with-text.js +118 -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 +105 -2
- package/dist/geometry.d.ts.map +1 -0
- package/dist/geometry.js +374 -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 +177 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +613 -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 +19 -2
- package/dist/guides.d.ts.map +1 -0
- 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 +34 -29
- 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 +82 -0
- package/dist/instances/fields.js.map +1 -0
- package/dist/instances/index.d.ts +40 -0
- package/dist/instances/index.d.ts.map +1 -0
- package/dist/instances/index.js +174 -0
- package/dist/instances/index.js.map +1 -0
- package/dist/instances/main-component.d.ts +11 -0
- package/dist/instances/main-component.d.ts.map +1 -0
- package/dist/instances/main-component.js +42 -0
- package/dist/instances/main-component.js.map +1 -0
- package/dist/instances/overrides.d.ts +48 -0
- package/dist/instances/overrides.d.ts.map +1 -0
- package/dist/instances/overrides.js +142 -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/sync.js +275 -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/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 +142 -0
- package/dist/plugin-data/fields.d.ts.map +1 -0
- package/dist/plugin-data/fields.js +153 -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 +38 -0
- package/dist/shared-styles.d.ts.map +1 -0
- package/dist/shared-styles.js +125 -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 +103 -0
- package/dist/slots/content.js.map +1 -0
- package/dist/slots/frames.d.ts +38 -0
- package/dist/slots/frames.d.ts.map +1 -0
- package/dist/slots/frames.js +113 -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 +19 -0
- package/dist/text/lengths.d.ts.map +1 -0
- package/dist/text/lengths.js +40 -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} +2 -2
- package/dist/text/picture.d.ts.map +1 -0
- package/dist/text/picture.js +41 -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 +74 -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 +169 -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 +60 -0
- package/dist/variables/bindings.d.ts.map +1 -0
- package/dist/variables/bindings.js +224 -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 +25 -0
- package/dist/variables/fields.d.ts.map +1 -0
- package/dist/variables/fields.js +69 -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 +223 -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 +297 -137
- package/src/arrow-caps.ts +282 -62
- package/src/behaviours/index.ts +5 -0
- package/src/behaviours/layers.ts +1 -1
- package/src/behaviours/model.ts +3 -11
- package/src/behaviours/schema.ts +44 -9
- package/src/behaviours/spec.ts +4 -49
- package/src/checkpoint.ts +1 -1
- 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 +2 -2
- package/src/components/variants.ts +1 -1
- 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 +60 -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 +144 -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 +63 -17
- package/src/css/index.ts +1 -0
- package/src/css/text.ts +84 -0
- package/src/export-format.ts +1 -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 +29 -0
- package/src/fig-compression.ts +9 -0
- package/src/figjam/index.ts +2 -0
- package/src/figjam/palette.ts +445 -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 +131 -0
- package/src/generated/sticky.ts +213 -0
- package/src/geometry.ts +40 -130
- package/src/gradient.ts +14 -0
- package/src/graph.ts +825 -0
- package/src/group-bounds.ts +59 -12
- package/src/guides.ts +1 -1
- package/src/hit-test.ts +52 -21
- 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 +39 -92
- package/src/{instances.ts → instances/index.ts} +13 -15
- package/src/instances/main-component.ts +43 -1
- package/src/{instance-overrides.ts → instances/overrides.ts} +31 -1
- package/src/instances/placement.ts +1 -1
- package/src/instances/source-walk.ts +3 -9
- package/src/instances/sync.ts +30 -140
- 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 +41 -2
- 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 +54 -75
- 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 +89 -18
- package/src/slots/authoring.ts +1 -1
- package/src/slots/content.ts +8 -5
- package/src/slots/frames.ts +3 -3
- 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 +34 -0
- package/src/text/overflow.ts +12 -0
- 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 +11 -14
- 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 +218 -13
- package/src/undo.ts +64 -2
- package/src/variables/bindings.ts +44 -55
- package/src/variables/corners.ts +39 -0
- package/src/variables/fields.ts +38 -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} +52 -145
- 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.map +0 -1
- package/dist/chunks/buffered-events.js.map +0 -1
- 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.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/behaviours → behaviours}/kinds.js +0 -0
- /package/dist/{chunks/bindings.js → bindings.js} +0 -0
- /package/dist/{chunks/buffered-events.js → buffered-events.js} +0 -0
- /package/dist/{chunks/checkpoint.js → checkpoint.js} +0 -0
- /package/dist/{chunks/components → components}/variants.js +0 -0
- /package/dist/{chunks/events.js → events.js} +0 -0
- /package/dist/{chunks/fields → fields}/geometry.js +0 -0
package/dist/arrow-caps.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Vector } from "./
|
|
1
|
+
import { Vector } from "./primitives/index.js";
|
|
2
2
|
import { Stroke, StrokeCap, VectorNetwork } from "./types.js";
|
|
3
3
|
//#region src/arrow-caps.d.ts
|
|
4
|
-
type ArrowCapKind = 'ARROW_LINES' | 'ARROW_EQUILATERAL';
|
|
4
|
+
type ArrowCapKind = 'ARROW_LINES' | 'ARROW_EQUILATERAL' | 'TRIANGLE_FILLED' | 'DIAMOND_FILLED' | 'CIRCLE_FILLED';
|
|
5
5
|
interface ArrowEndpoint {
|
|
6
6
|
x: number;
|
|
7
7
|
y: number;
|
|
@@ -15,11 +15,9 @@ interface ArrowWing {
|
|
|
15
15
|
}
|
|
16
16
|
declare function isArrowCap(cap: string | undefined): cap is ArrowCapKind;
|
|
17
17
|
/**
|
|
18
|
-
* Worst-case reach of an arrow head past the path
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* so heads are not cropped by caches, exports, or culling. Vertex-level caps
|
|
22
|
-
* in the network count even when no stroke or node cap is an arrow.
|
|
18
|
+
* Worst-case reach of an arrow head past the path. Used to widen visual bounds and render
|
|
19
|
+
* margins so heads are not cropped by caches, exports, or culling. Vertex-level caps in the
|
|
20
|
+
* network count even when no stroke or node cap is an arrow.
|
|
23
21
|
*/
|
|
24
22
|
declare function arrowCapOverflow(strokes?: Stroke[], fallbackCap?: StrokeCap, network?: VectorNetwork | null): number;
|
|
25
23
|
/**
|
|
@@ -30,15 +28,38 @@ declare function arrowCapOverflow(strokes?: Stroke[], fallbackCap?: StrokeCap, n
|
|
|
30
28
|
*/
|
|
31
29
|
declare function collectArrowEndpoints(network: VectorNetwork, fallbackCap: StrokeCap): ArrowEndpoint[];
|
|
32
30
|
/**
|
|
33
|
-
* Points of a filled equilateral arrow head: tip first, then the two base
|
|
34
|
-
*
|
|
35
|
-
* along the path.
|
|
31
|
+
* Points of a filled equilateral arrow head: tip first, then the two base corners. The tip sits
|
|
32
|
+
* exactly on the endpoint and the head sweeps back along the path.
|
|
36
33
|
*/
|
|
37
34
|
declare function equilateralArrowPoints(x: number, y: number, angle: number, weight: number): [Vector, Vector, Vector];
|
|
38
|
-
/** The two
|
|
35
|
+
/** The two wings of an open (lines-style) arrow head, each from the tip to its end. */
|
|
39
36
|
declare function arrowLinesSegments(x: number, y: number, angle: number, weight: number): [ArrowWing, ArrowWing];
|
|
40
|
-
/**
|
|
41
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Points of a filled triangle head: its base across the end, narrowing back along the path to
|
|
39
|
+
* the shaft's width, in drawing order.
|
|
40
|
+
*/
|
|
41
|
+
declare function triangleCapPoints(x: number, y: number, angle: number, weight: number): [Vector, Vector, Vector, Vector];
|
|
42
|
+
/** Points of a filled diamond head centred on the end, in drawing order. */
|
|
43
|
+
declare function diamondCapPoints(x: number, y: number, angle: number, weight: number): [Vector, Vector, Vector, Vector];
|
|
44
|
+
/** Radius of a filled circle head, centred on the end. */
|
|
45
|
+
declare function circleCapRadius(weight: number): number;
|
|
46
|
+
/** Whether any open end of `network` carries a head the line stops short of. */
|
|
47
|
+
declare function hasTrimmedShaft(network: VectorNetwork, fallbackCap: StrokeCap): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The network with its line pulled back from each open end that carries a triangle or
|
|
50
|
+
* equilateral head, as Figma draws it, so the line's own cap stays inside the head.
|
|
51
|
+
*/
|
|
52
|
+
declare function trimArrowShafts(network: VectorNetwork, fallbackCap: StrokeCap, weight: number): VectorNetwork;
|
|
53
|
+
/**
|
|
54
|
+
* Where Figma strokes a LINE running from its origin to (`width`, `height`): a full weight to one
|
|
55
|
+
* side, toward its local negative y, whatever the stroke's alignment. Under a cap both ends come in
|
|
56
|
+
* by half a weight, so the cap or head ends where the line does; an equilateral arrow already
|
|
57
|
+
* comes to its point at the end, so it stays there.
|
|
58
|
+
*/
|
|
59
|
+
declare function lineStrokeEnds(width: number, height: number, weight: number, cap: StrokeCap | undefined, insetPastMiddle?: boolean): {
|
|
60
|
+
start: Vector;
|
|
61
|
+
end: Vector;
|
|
62
|
+
};
|
|
42
63
|
//#endregion
|
|
43
|
-
export { ArrowCapKind, ArrowEndpoint, ArrowWing, arrowCapOverflow, arrowLinesSegments, collectArrowEndpoints, equilateralArrowPoints, isArrowCap,
|
|
64
|
+
export { ArrowCapKind, ArrowEndpoint, ArrowWing, arrowCapOverflow, arrowLinesSegments, circleCapRadius, collectArrowEndpoints, diamondCapPoints, equilateralArrowPoints, hasTrimmedShaft, isArrowCap, lineStrokeEnds, triangleCapPoints, trimArrowShafts };
|
|
44
65
|
//# sourceMappingURL=arrow-caps.d.ts.map
|
package/dist/arrow-caps.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow-caps.d.ts","names":[],"sources":["../src/arrow-caps.ts"],"mappings":";;;KAGY;
|
|
1
|
+
{"version":3,"file":"arrow-caps.d.ts","names":[],"sources":["../src/arrow-caps.ts"],"mappings":";;;KAGY;UAOK;EACf;EACA;;EAEA;EACA,KAAK;;UAGU;EACf,MAAM;EACN,IAAI;;iBAmCU,WAAW,0BAA0B,OAAO;;;;;;iBAS5C,iBACd,UAAU,UACV,cAAc,WACd,UAAU;;;;;;;iBA6CI,sBACd,SAAS,eACT,aAAa,YACZ;;;;;iBA4Ba,uBACd,WACA,WACA,eACA,kBACE,QAAQ,QAAQ;;iBAaJ,mBACd,WACA,WACA,eACA,kBACE,WAAW;;;;;iBAmBC,kBACd,WACA,WACA,eACA,kBACE,QAAQ,QAAQ,QAAQ;;iBAeZ,iBACd,WACA,WACA,eACA,kBACE,QAAQ,QAAQ,QAAQ;;iBAYZ,gBAAgB;;iBAShB,gBAAgB,SAAS,eAAe,aAAa;;;;;iBAUrD,gBACd,SAAS,eACT,aAAa,WACb,iBACC;;;;;;;iBAmGa,eACd,eACA,gBACA,gBACA,KAAK,uBAEL;EACG,OAAO;EAAQ,KAAK"}
|
package/dist/arrow-caps.js
CHANGED
|
@@ -1,26 +1,69 @@
|
|
|
1
1
|
//#region src/arrow-caps.ts
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Arrow heads relative to stroke weight, from the stroke outlines Figma gives for them. The
|
|
4
|
+
* triangle heads run 5 back from the end and spread to 5/√3 on either side: the equilateral
|
|
5
|
+
* arrow comes to its point at the end, and the filled triangle has its base across it. The
|
|
6
|
+
* diamond reaches 5/√3 from the end every way, and the circle has radius 8/3. A line arrow's
|
|
7
|
+
* wings meet at the end and run 4.5 back at 45°, stroked at the line's weight with round ends.
|
|
8
|
+
*/
|
|
9
|
+
const TRIANGLE_HEAD_DEPTH = 5;
|
|
10
|
+
const TRIANGLE_HEAD_HALF_WIDTH = 5 / Math.sqrt(3);
|
|
11
|
+
const CIRCLE_HEAD_RADIUS = 8 / 3;
|
|
12
|
+
const WING_LENGTH = 4.5;
|
|
13
|
+
const WING_SWEEP = Math.PI / 4;
|
|
14
|
+
/** How far a line stops short of its end under a triangle head: half a weight inside its base. */
|
|
15
|
+
const SHAFT_TRIM = 4.5;
|
|
16
|
+
/**
|
|
17
|
+
* The furthest any head reaches past its line's box. On a line shorter than its head, a triangle
|
|
18
|
+
* reaches back from the end to its base corners, and a line arrow's wings their full length.
|
|
19
|
+
*/
|
|
20
|
+
const HEAD_REACH = Math.max(5, Math.hypot(TRIANGLE_HEAD_DEPTH, TRIANGLE_HEAD_HALF_WIDTH), CIRCLE_HEAD_RADIUS);
|
|
21
|
+
const ARROW_CAPS = /* @__PURE__ */ new Set([
|
|
22
|
+
"ARROW_LINES",
|
|
23
|
+
"ARROW_EQUILATERAL",
|
|
24
|
+
"TRIANGLE_FILLED",
|
|
25
|
+
"DIAMOND_FILLED",
|
|
26
|
+
"CIRCLE_FILLED"
|
|
27
|
+
]);
|
|
5
28
|
function isArrowCap(cap) {
|
|
6
|
-
return cap
|
|
29
|
+
return cap !== void 0 && ARROW_CAPS.has(cap);
|
|
7
30
|
}
|
|
8
31
|
/**
|
|
9
|
-
* Worst-case reach of an arrow head past the path
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* so heads are not cropped by caches, exports, or culling. Vertex-level caps
|
|
13
|
-
* in the network count even when no stroke or node cap is an arrow.
|
|
32
|
+
* Worst-case reach of an arrow head past the path. Used to widen visual bounds and render
|
|
33
|
+
* margins so heads are not cropped by caches, exports, or culling. Vertex-level caps in the
|
|
34
|
+
* network count even when no stroke or node cap is an arrow.
|
|
14
35
|
*/
|
|
15
36
|
function arrowCapOverflow(strokes, fallbackCap, network) {
|
|
16
37
|
const networkHasArrow = network?.vertices.some((vertex) => isArrowCap(vertex.strokeCap)) ?? false;
|
|
17
38
|
let overflow = 0;
|
|
18
39
|
for (const stroke of strokes ?? []) {
|
|
19
40
|
if (!stroke.visible) continue;
|
|
20
|
-
if (networkHasArrow || isArrowCap(stroke.cap ?? fallbackCap)) overflow = Math.max(overflow,
|
|
41
|
+
if (networkHasArrow || isArrowCap(stroke.cap ?? fallbackCap)) overflow = Math.max(overflow, HEAD_REACH * stroke.weight);
|
|
21
42
|
}
|
|
22
43
|
return overflow;
|
|
23
44
|
}
|
|
45
|
+
/** The open ends of `network` that carry a head: vertices used by exactly one segment. */
|
|
46
|
+
function openArrowEnds(network, fallbackCap) {
|
|
47
|
+
const degrees = Array.from({ length: network.vertices.length }, () => 0);
|
|
48
|
+
for (const segment of network.segments) {
|
|
49
|
+
degrees[segment.start]++;
|
|
50
|
+
degrees[segment.end]++;
|
|
51
|
+
}
|
|
52
|
+
const ends = [];
|
|
53
|
+
network.segments.forEach((segment, index) => {
|
|
54
|
+
for (const side of ["start", "end"]) {
|
|
55
|
+
const vertex = network.vertices[segment[side]];
|
|
56
|
+
if (degrees[segment[side]] !== 1) continue;
|
|
57
|
+
const cap = vertex.strokeCap ?? fallbackCap;
|
|
58
|
+
if (isArrowCap(cap)) ends.push({
|
|
59
|
+
segment: index,
|
|
60
|
+
side,
|
|
61
|
+
cap
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
return ends;
|
|
66
|
+
}
|
|
24
67
|
/**
|
|
25
68
|
* Finds the open path ends that should carry an arrow head: vertices used by
|
|
26
69
|
* exactly one segment, with a per-vertex cap override falling back to the
|
|
@@ -28,18 +71,10 @@ function arrowCapOverflow(strokes, fallbackCap, network) {
|
|
|
28
71
|
* terminal bezier tangent when the segment is curved.
|
|
29
72
|
*/
|
|
30
73
|
function collectArrowEndpoints(network, fallbackCap) {
|
|
31
|
-
const degrees = Array.from({ length: network.vertices.length }, () => 0);
|
|
32
|
-
for (const segment of network.segments) {
|
|
33
|
-
degrees[segment.start]++;
|
|
34
|
-
degrees[segment.end]++;
|
|
35
|
-
}
|
|
36
74
|
const endpoints = [];
|
|
37
|
-
for (const segment
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
const vertex = network.vertices[vertexIndex];
|
|
41
|
-
const cap = vertex.strokeCap ?? fallbackCap;
|
|
42
|
-
if (!isArrowCap(cap)) continue;
|
|
75
|
+
for (const { segment: index, side, cap } of openArrowEnds(network, fallbackCap)) {
|
|
76
|
+
const segment = network.segments[index];
|
|
77
|
+
const vertex = network.vertices[segment[side]];
|
|
43
78
|
const tangent = side === "start" ? segment.tangentStart : segment.tangentEnd;
|
|
44
79
|
let controlX;
|
|
45
80
|
let controlY;
|
|
@@ -64,37 +99,32 @@ function collectArrowEndpoints(network, fallbackCap) {
|
|
|
64
99
|
return endpoints;
|
|
65
100
|
}
|
|
66
101
|
/**
|
|
67
|
-
* Points of a filled equilateral arrow head: tip first, then the two base
|
|
68
|
-
*
|
|
69
|
-
* along the path.
|
|
102
|
+
* Points of a filled equilateral arrow head: tip first, then the two base corners. The tip sits
|
|
103
|
+
* exactly on the endpoint and the head sweeps back along the path.
|
|
70
104
|
*/
|
|
71
105
|
function equilateralArrowPoints(x, y, angle, weight) {
|
|
72
|
-
const
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
const
|
|
76
|
-
const perpX = -dirY;
|
|
77
|
-
const perpY = dirX;
|
|
78
|
-
const baseX = x - depth * dirX;
|
|
79
|
-
const baseY = y - depth * dirY;
|
|
106
|
+
const { dir, perp } = headAxes(angle);
|
|
107
|
+
const half = TRIANGLE_HEAD_HALF_WIDTH * weight;
|
|
108
|
+
const baseX = x - TRIANGLE_HEAD_DEPTH * weight * dir.x;
|
|
109
|
+
const baseY = y - TRIANGLE_HEAD_DEPTH * weight * dir.y;
|
|
80
110
|
return [
|
|
81
111
|
{
|
|
82
112
|
x,
|
|
83
113
|
y
|
|
84
114
|
},
|
|
85
115
|
{
|
|
86
|
-
x: baseX -
|
|
87
|
-
y: baseY -
|
|
116
|
+
x: baseX - half * perp.x,
|
|
117
|
+
y: baseY - half * perp.y
|
|
88
118
|
},
|
|
89
119
|
{
|
|
90
|
-
x: baseX +
|
|
91
|
-
y: baseY +
|
|
120
|
+
x: baseX + half * perp.x,
|
|
121
|
+
y: baseY + half * perp.y
|
|
92
122
|
}
|
|
93
123
|
];
|
|
94
124
|
}
|
|
95
|
-
/** The two
|
|
125
|
+
/** The two wings of an open (lines-style) arrow head, each from the tip to its end. */
|
|
96
126
|
function arrowLinesSegments(x, y, angle, weight) {
|
|
97
|
-
const wingLength =
|
|
127
|
+
const wingLength = WING_LENGTH * weight;
|
|
98
128
|
const tip = {
|
|
99
129
|
x,
|
|
100
130
|
y
|
|
@@ -108,24 +138,228 @@ function arrowLinesSegments(x, y, angle, weight) {
|
|
|
108
138
|
});
|
|
109
139
|
return [makeWing(angle + Math.PI - WING_SWEEP), makeWing(angle + Math.PI + WING_SWEEP)];
|
|
110
140
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
141
|
+
function headAxes(angle) {
|
|
142
|
+
const dir = {
|
|
143
|
+
x: Math.cos(angle),
|
|
144
|
+
y: Math.sin(angle)
|
|
145
|
+
};
|
|
146
|
+
return {
|
|
147
|
+
dir,
|
|
148
|
+
perp: {
|
|
149
|
+
x: -dir.y,
|
|
150
|
+
y: dir.x
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Points of a filled triangle head: its base across the end, narrowing back along the path to
|
|
156
|
+
* the shaft's width, in drawing order.
|
|
157
|
+
*/
|
|
158
|
+
function triangleCapPoints(x, y, angle, weight) {
|
|
159
|
+
const { dir, perp } = headAxes(angle);
|
|
160
|
+
const back = {
|
|
161
|
+
x: x - TRIANGLE_HEAD_DEPTH * weight * dir.x,
|
|
162
|
+
y: y - TRIANGLE_HEAD_DEPTH * weight * dir.y
|
|
163
|
+
};
|
|
164
|
+
const at = (point, side) => ({
|
|
165
|
+
x: point.x + side * perp.x,
|
|
166
|
+
y: point.y + side * perp.y
|
|
167
|
+
});
|
|
168
|
+
const half = TRIANGLE_HEAD_HALF_WIDTH * weight;
|
|
169
|
+
return [
|
|
170
|
+
at(back, weight / 2),
|
|
171
|
+
at({
|
|
172
|
+
x,
|
|
173
|
+
y
|
|
174
|
+
}, half),
|
|
175
|
+
at({
|
|
176
|
+
x,
|
|
177
|
+
y
|
|
178
|
+
}, -half),
|
|
179
|
+
at(back, -weight / 2)
|
|
180
|
+
];
|
|
181
|
+
}
|
|
182
|
+
/** Points of a filled diamond head centred on the end, in drawing order. */
|
|
183
|
+
function diamondCapPoints(x, y, angle, weight) {
|
|
184
|
+
const { dir, perp } = headAxes(angle);
|
|
185
|
+
const reach = TRIANGLE_HEAD_HALF_WIDTH * weight;
|
|
186
|
+
return [
|
|
187
|
+
{
|
|
188
|
+
x: x + reach * dir.x,
|
|
189
|
+
y: y + reach * dir.y
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
x: x + reach * perp.x,
|
|
193
|
+
y: y + reach * perp.y
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
x: x - reach * dir.x,
|
|
197
|
+
y: y - reach * dir.y
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
x: x - reach * perp.x,
|
|
201
|
+
y: y - reach * perp.y
|
|
202
|
+
}
|
|
203
|
+
];
|
|
204
|
+
}
|
|
205
|
+
/** Radius of a filled circle head, centred on the end. */
|
|
206
|
+
function circleCapRadius(weight) {
|
|
207
|
+
return CIRCLE_HEAD_RADIUS * weight;
|
|
208
|
+
}
|
|
209
|
+
function trimsShaft(cap) {
|
|
210
|
+
return cap === "TRIANGLE_FILLED" || cap === "ARROW_EQUILATERAL";
|
|
211
|
+
}
|
|
212
|
+
/** Whether any open end of `network` carries a head the line stops short of. */
|
|
213
|
+
function hasTrimmedShaft(network, fallbackCap) {
|
|
214
|
+
return network.vertices.some((vertex) => trimsShaft(vertex.strokeCap ?? fallbackCap));
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* The network with its line pulled back from each open end that carries a triangle or
|
|
218
|
+
* equilateral head, as Figma draws it, so the line's own cap stays inside the head.
|
|
219
|
+
*/
|
|
220
|
+
function trimArrowShafts(network, fallbackCap, weight) {
|
|
221
|
+
const trimmed = structuredClone(network);
|
|
222
|
+
for (const { segment, side, cap } of openArrowEnds(network, fallbackCap)) {
|
|
223
|
+
if (!trimsShaft(cap)) continue;
|
|
224
|
+
trimSegmentEnd(trimmed, trimmed.segments[segment], side === "end", SHAFT_TRIM * weight);
|
|
225
|
+
}
|
|
226
|
+
return trimmed;
|
|
227
|
+
}
|
|
228
|
+
function cubicAt([a, b, c, d], t) {
|
|
229
|
+
const u = 1 - t;
|
|
230
|
+
return {
|
|
231
|
+
x: u * u * u * a.x + 3 * u * u * t * b.x + 3 * u * t * t * c.x + t * t * t * d.x,
|
|
232
|
+
y: u * u * u * a.y + 3 * u * u * t * b.y + 3 * u * t * t * c.y + t * t * t * d.y
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
function lerp(a, b, t) {
|
|
236
|
+
return {
|
|
237
|
+
x: a.x + (b.x - a.x) * t,
|
|
238
|
+
y: a.y + (b.y - a.y) * t
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
/** The part of a cubic from its start to `t`, by de Casteljau. */
|
|
242
|
+
function cubicHead([a, b, c, d], t) {
|
|
243
|
+
const ab = lerp(a, b, t);
|
|
244
|
+
const bc = lerp(b, c, t);
|
|
245
|
+
const cd = lerp(c, d, t);
|
|
246
|
+
const abc = lerp(ab, bc, t);
|
|
247
|
+
return [
|
|
248
|
+
a,
|
|
249
|
+
ab,
|
|
250
|
+
abc,
|
|
251
|
+
lerp(abc, lerp(bc, cd, t), t)
|
|
252
|
+
];
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Pulls one end of `segment` back along it until it lies `distance` from where it was, keeping
|
|
256
|
+
* the rest of the curve where it is.
|
|
257
|
+
*/
|
|
258
|
+
function trimSegmentEnd(network, segment, atEnd, distance) {
|
|
259
|
+
const start = network.vertices[segment.start];
|
|
260
|
+
const end = network.vertices[segment.end];
|
|
261
|
+
const from = atEnd ? start : end;
|
|
262
|
+
const to = atEnd ? end : start;
|
|
263
|
+
const out = atEnd ? segment.tangentStart : segment.tangentEnd;
|
|
264
|
+
const back = atEnd ? segment.tangentEnd : segment.tangentStart;
|
|
265
|
+
const cubic = [
|
|
266
|
+
{
|
|
267
|
+
x: from.x,
|
|
268
|
+
y: from.y
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
x: from.x + out.x,
|
|
272
|
+
y: from.y + out.y
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
x: to.x + back.x,
|
|
276
|
+
y: to.y + back.y
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
x: to.x,
|
|
280
|
+
y: to.y
|
|
281
|
+
}
|
|
282
|
+
];
|
|
283
|
+
const length = Math.hypot(to.x - from.x, to.y - from.y);
|
|
284
|
+
if (length <= distance) return;
|
|
285
|
+
const index = atEnd ? segment.end : segment.start;
|
|
286
|
+
if (out.x === 0 && out.y === 0 && back.x === 0 && back.y === 0) {
|
|
287
|
+
const keep = (length - distance) / length;
|
|
288
|
+
const vertex = network.vertices[index];
|
|
289
|
+
network.vertices[index] = {
|
|
290
|
+
...vertex,
|
|
291
|
+
x: from.x + (to.x - from.x) * keep,
|
|
292
|
+
y: from.y + (to.y - from.y) * keep
|
|
293
|
+
};
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
let low = 0;
|
|
297
|
+
let high = 1;
|
|
298
|
+
for (let step = 0; step < 40; step++) {
|
|
299
|
+
const t = (low + high) / 2;
|
|
300
|
+
const point = cubicAt(cubic, t);
|
|
301
|
+
if (Math.hypot(point.x - to.x, point.y - to.y) > distance) low = t;
|
|
302
|
+
else high = t;
|
|
303
|
+
}
|
|
304
|
+
const [, c1, c2, tip] = cubicHead(cubic, low);
|
|
305
|
+
network.vertices[index] = {
|
|
306
|
+
...network.vertices[index],
|
|
307
|
+
x: tip.x,
|
|
308
|
+
y: tip.y
|
|
309
|
+
};
|
|
310
|
+
const kept = {
|
|
311
|
+
x: c1.x - from.x,
|
|
312
|
+
y: c1.y - from.y
|
|
313
|
+
};
|
|
314
|
+
const trimmedBack = {
|
|
315
|
+
x: c2.x - tip.x,
|
|
316
|
+
y: c2.y - tip.y
|
|
317
|
+
};
|
|
318
|
+
if (atEnd) {
|
|
319
|
+
segment.tangentStart = kept;
|
|
320
|
+
segment.tangentEnd = trimmedBack;
|
|
321
|
+
} else {
|
|
322
|
+
segment.tangentEnd = kept;
|
|
323
|
+
segment.tangentStart = trimmedBack;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Where Figma strokes a LINE running from its origin to (`width`, `height`): a full weight to one
|
|
328
|
+
* side, toward its local negative y, whatever the stroke's alignment. Under a cap both ends come in
|
|
329
|
+
* by half a weight, so the cap or head ends where the line does; an equilateral arrow already
|
|
330
|
+
* comes to its point at the end, so it stays there.
|
|
331
|
+
*/
|
|
332
|
+
function lineStrokeEnds(width, height, weight, cap, insetPastMiddle = false) {
|
|
333
|
+
const length = Math.hypot(width, height);
|
|
334
|
+
if (length === 0) return {
|
|
335
|
+
start: {
|
|
336
|
+
x: 0,
|
|
337
|
+
y: 0
|
|
338
|
+
},
|
|
339
|
+
end: {
|
|
340
|
+
x: 0,
|
|
341
|
+
y: 0
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
const ux = width / length;
|
|
345
|
+
const uy = height / length;
|
|
346
|
+
const inset = cap === void 0 || cap === "NONE" || cap === "ARROW_EQUILATERAL" ? 0 : (insetPastMiddle ? weight : Math.min(weight, length)) / 2;
|
|
347
|
+
const offset = {
|
|
348
|
+
x: uy * weight / 2,
|
|
349
|
+
y: -ux * weight / 2
|
|
350
|
+
};
|
|
351
|
+
return {
|
|
352
|
+
start: {
|
|
353
|
+
x: ux * inset + offset.x,
|
|
354
|
+
y: uy * inset + offset.y
|
|
355
|
+
},
|
|
356
|
+
end: {
|
|
357
|
+
x: width - ux * inset + offset.x,
|
|
358
|
+
y: height - uy * inset + offset.y
|
|
359
|
+
}
|
|
360
|
+
};
|
|
127
361
|
}
|
|
128
362
|
//#endregion
|
|
129
|
-
export { arrowCapOverflow, arrowLinesSegments, collectArrowEndpoints, equilateralArrowPoints, isArrowCap,
|
|
363
|
+
export { arrowCapOverflow, arrowLinesSegments, circleCapRadius, collectArrowEndpoints, diamondCapPoints, equilateralArrowPoints, hasTrimmedShaft, isArrowCap, lineStrokeEnds, triangleCapPoints, trimArrowShafts };
|
|
130
364
|
|
|
131
365
|
//# sourceMappingURL=arrow-caps.js.map
|
package/dist/arrow-caps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow-caps.js","names":[],"sources":["../src/arrow-caps.ts"],"sourcesContent":["import type { Vector } from './primitives'\nimport type { Stroke, StrokeCap, VectorNetwork } from './types'\n\nexport type ArrowCapKind = 'ARROW_LINES' | 'ARROW_EQUILATERAL'\n\nexport interface ArrowEndpoint {\n x: number\n y: number\n /** Direction the arrow points, in radians, away from the path. */\n angle: number\n cap: ArrowCapKind\n}\n\nexport interface ArrowWing {\n from: Vector\n to: Vector\n}\n\n/** Arrow head side length relative to stroke weight, tuned to match Figma. */\nconst ARROW_SIDE_PER_WEIGHT = 4\nconst WING_SWEEP = Math.PI / 6\n\nexport function isArrowCap(cap: string | undefined): cap is ArrowCapKind {\n return cap === 'ARROW_LINES' || cap === 'ARROW_EQUILATERAL'\n}\n\n/**\n * Worst-case reach of an arrow head past the path: a head's base corners sit\n * one full head side from the tip, and line-arrow wings are stroked at the\n * shaft weight on top of that. Used to widen visual bounds and render margins\n * so heads are not cropped by caches, exports, or culling. Vertex-level caps\n * in the network count even when no stroke or node cap is an arrow.\n */\nexport function arrowCapOverflow(\n strokes?: Stroke[],\n fallbackCap?: StrokeCap,\n network?: VectorNetwork | null\n): number {\n const networkHasArrow = network?.vertices.some((vertex) => isArrowCap(vertex.strokeCap)) ?? false\n let overflow = 0\n for (const stroke of strokes ?? []) {\n if (!stroke.visible) continue\n if (networkHasArrow || isArrowCap(stroke.cap ?? fallbackCap)) {\n overflow = Math.max(overflow, (ARROW_SIDE_PER_WEIGHT + 0.5) * stroke.weight)\n }\n }\n return overflow\n}\n\n/**\n * Finds the open path ends that should carry an arrow head: vertices used by\n * exactly one segment, with a per-vertex cap override falling back to the\n * stroke cap. The returned angle points away from the path, following the\n * terminal bezier tangent when the segment is curved.\n */\nexport function collectArrowEndpoints(\n network: VectorNetwork,\n fallbackCap: StrokeCap\n): ArrowEndpoint[] {\n const degrees = Array.from({ length: network.vertices.length }, () => 0)\n for (const segment of network.segments) {\n degrees[segment.start]++\n degrees[segment.end]++\n }\n\n const endpoints: ArrowEndpoint[] = []\n for (const segment of network.segments) {\n for (const side of ['start', 'end'] as const) {\n const vertexIndex = segment[side]\n if (degrees[vertexIndex] !== 1) continue\n const vertex = network.vertices[vertexIndex]\n const cap = (vertex.strokeCap as StrokeCap | undefined) ?? fallbackCap\n if (!isArrowCap(cap)) continue\n\n const tangent = side === 'start' ? segment.tangentStart : segment.tangentEnd\n let controlX: number\n let controlY: number\n if (Math.abs(tangent.x) > 0.001 || Math.abs(tangent.y) > 0.001) {\n controlX = vertex.x + tangent.x\n controlY = vertex.y + tangent.y\n } else {\n const other = network.vertices[side === 'start' ? segment.end : segment.start]\n controlX = other.x\n controlY = other.y\n }\n const dx = vertex.x - controlX\n const dy = vertex.y - controlY\n if (dx === 0 && dy === 0) continue\n endpoints.push({ x: vertex.x, y: vertex.y, angle: Math.atan2(dy, dx), cap })\n }\n }\n return endpoints\n}\n\n/**\n * Points of a filled equilateral arrow head: tip first, then the two base\n * corners. The tip sits exactly on the endpoint and the head sweeps back\n * along the path.\n */\nexport function equilateralArrowPoints(\n x: number,\n y: number,\n angle: number,\n weight: number\n): [Vector, Vector, Vector] {\n const halfBase = (ARROW_SIDE_PER_WEIGHT / 2) * weight\n const depth = halfBase * Math.sqrt(3)\n const dirX = Math.cos(angle)\n const dirY = Math.sin(angle)\n const perpX = -dirY\n const perpY = dirX\n const baseX = x - depth * dirX\n const baseY = y - depth * dirY\n return [\n { x, y },\n { x: baseX - halfBase * perpX, y: baseY - halfBase * perpY },\n { x: baseX + halfBase * perpX, y: baseY + halfBase * perpY }\n ]\n}\n\n/** The two stroked wings of an open (lines-style) arrow head. */\nexport function arrowLinesSegments(\n x: number,\n y: number,\n angle: number,\n weight: number\n): [ArrowWing, ArrowWing] {\n const wingLength = ARROW_SIDE_PER_WEIGHT * weight\n const tip = { x, y }\n const makeWing = (wingAngle: number): ArrowWing => ({\n from: tip,\n to: { x: x + wingLength * Math.cos(wingAngle), y: y + wingLength * Math.sin(wingAngle) }\n })\n return [makeWing(angle + Math.PI - WING_SWEEP), makeWing(angle + Math.PI + WING_SWEEP)]\n}\n\n/** Arrow endpoints for a LINE node, whose local geometry runs (0,0) → (width,height). */\nexport function lineArrowEndpoints(width: number, height: number, cap: StrokeCap): ArrowEndpoint[] {\n if (!isArrowCap(cap)) return []\n if (width === 0 && height === 0) return []\n const angle = Math.atan2(height, width)\n return [\n { x: 0, y: 0, angle: Math.atan2(-height, -width), cap },\n { x: width, y: height, angle, cap }\n ]\n}\n"],"mappings":";;AAmBA,MAAM,wBAAwB;AAC9B,MAAM,aAAa,KAAK,KAAK;AAE7B,SAAgB,WAAW,KAA8C;CACvE,OAAO,QAAQ,iBAAiB,QAAQ;AAC1C;;;;;;;;AASA,SAAgB,iBACd,SACA,aACA,SACQ;CACR,MAAM,kBAAkB,SAAS,SAAS,MAAM,WAAW,WAAW,OAAO,SAAS,CAAC,KAAK;CAC5F,IAAI,WAAW;CACf,KAAK,MAAM,UAAU,WAAW,CA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ector } from './primitives'\nimport type { Stroke, StrokeCap, VectorNetwork } from './types'\n\nexport type ArrowCapKind =\n | 'ARROW_LINES'\n | 'ARROW_EQUILATERAL'\n | 'TRIANGLE_FILLED'\n | 'DIAMOND_FILLED'\n | 'CIRCLE_FILLED'\n\nexport interface ArrowEndpoint {\n x: number\n y: number\n /** Direction the arrow points, in radians, away from the path. */\n angle: number\n cap: ArrowCapKind\n}\n\nexport interface ArrowWing {\n from: Vector\n to: Vector\n}\n\n/**\n * Arrow heads relative to stroke weight, from the stroke outlines Figma gives for them. The\n * triangle heads run 5 back from the end and spread to 5/√3 on either side: the equilateral\n * arrow comes to its point at the end, and the filled triangle has its base across it. The\n * diamond reaches 5/√3 from the end every way, and the circle has radius 8/3. A line arrow's\n * wings meet at the end and run 4.5 back at 45°, stroked at the line's weight with round ends.\n */\nconst TRIANGLE_HEAD_DEPTH = 5\nconst TRIANGLE_HEAD_HALF_WIDTH = 5 / Math.sqrt(3)\nconst CIRCLE_HEAD_RADIUS = 8 / 3\nconst WING_LENGTH = 4.5\nconst WING_SWEEP = Math.PI / 4\n/** How far a line stops short of its end under a triangle head: half a weight inside its base. */\nconst SHAFT_TRIM = TRIANGLE_HEAD_DEPTH - 0.5\n/**\n * The furthest any head reaches past its line's box. On a line shorter than its head, a triangle\n * reaches back from the end to its base corners, and a line arrow's wings their full length.\n */\nconst HEAD_REACH = Math.max(\n WING_LENGTH + 0.5,\n Math.hypot(TRIANGLE_HEAD_DEPTH, TRIANGLE_HEAD_HALF_WIDTH),\n CIRCLE_HEAD_RADIUS\n)\n\nconst ARROW_CAPS: ReadonlySet<string> = new Set<ArrowCapKind>([\n 'ARROW_LINES',\n 'ARROW_EQUILATERAL',\n 'TRIANGLE_FILLED',\n 'DIAMOND_FILLED',\n 'CIRCLE_FILLED'\n])\n\nexport function isArrowCap(cap: string | undefined): cap is ArrowCapKind {\n return cap !== undefined && ARROW_CAPS.has(cap)\n}\n\n/**\n * Worst-case reach of an arrow head past the path. Used to widen visual bounds and render\n * margins so heads are not cropped by caches, exports, or culling. Vertex-level caps in the\n * network count even when no stroke or node cap is an arrow.\n */\nexport function arrowCapOverflow(\n strokes?: Stroke[],\n fallbackCap?: StrokeCap,\n network?: VectorNetwork | null\n): number {\n const networkHasArrow = network?.vertices.some((vertex) => isArrowCap(vertex.strokeCap)) ?? false\n let overflow = 0\n for (const stroke of strokes ?? []) {\n if (!stroke.visible) continue\n if (networkHasArrow || isArrowCap(stroke.cap ?? fallbackCap)) {\n overflow = Math.max(overflow, HEAD_REACH * stroke.weight)\n }\n }\n return overflow\n}\n\n/** An open path end that carries a head: its segment and which end of it, and its cap. */\ninterface OpenArrowEnd {\n segment: number\n side: 'start' | 'end'\n cap: ArrowCapKind\n}\n\n/** The open ends of `network` that carry a head: vertices used by exactly one segment. */\nfunction openArrowEnds(network: VectorNetwork, fallbackCap: StrokeCap): OpenArrowEnd[] {\n const degrees = Array.from({ length: network.vertices.length }, () => 0)\n for (const segment of network.segments) {\n degrees[segment.start]++\n degrees[segment.end]++\n }\n const ends: OpenArrowEnd[] = []\n network.segments.forEach((segment, index) => {\n for (const side of ['start', 'end'] as const) {\n const vertex = network.vertices[segment[side]]\n if (degrees[segment[side]] !== 1) continue\n const cap = (vertex.strokeCap as StrokeCap | undefined) ?? fallbackCap\n if (isArrowCap(cap)) ends.push({ segment: index, side, cap })\n }\n })\n return ends\n}\n\n/**\n * Finds the open path ends that should carry an arrow head: vertices used by\n * exactly one segment, with a per-vertex cap override falling back to the\n * stroke cap. The returned angle points away from the path, following the\n * terminal bezier tangent when the segment is curved.\n */\nexport function collectArrowEndpoints(\n network: VectorNetwork,\n fallbackCap: StrokeCap\n): ArrowEndpoint[] {\n const endpoints: ArrowEndpoint[] = []\n for (const { segment: index, side, cap } of openArrowEnds(network, fallbackCap)) {\n const segment = network.segments[index]\n const vertex = network.vertices[segment[side]]\n const tangent = side === 'start' ? segment.tangentStart : segment.tangentEnd\n let controlX: number\n let controlY: number\n if (Math.abs(tangent.x) > 0.001 || Math.abs(tangent.y) > 0.001) {\n controlX = vertex.x + tangent.x\n controlY = vertex.y + tangent.y\n } else {\n const other = network.vertices[side === 'start' ? segment.end : segment.start]\n controlX = other.x\n controlY = other.y\n }\n const dx = vertex.x - controlX\n const dy = vertex.y - controlY\n if (dx === 0 && dy === 0) continue\n endpoints.push({ x: vertex.x, y: vertex.y, angle: Math.atan2(dy, dx), cap })\n }\n return endpoints\n}\n\n/**\n * Points of a filled equilateral arrow head: tip first, then the two base corners. The tip sits\n * exactly on the endpoint and the head sweeps back along the path.\n */\nexport function equilateralArrowPoints(\n x: number,\n y: number,\n angle: number,\n weight: number\n): [Vector, Vector, Vector] {\n const { dir, perp } = headAxes(angle)\n const half = TRIANGLE_HEAD_HALF_WIDTH * weight\n const baseX = x - TRIANGLE_HEAD_DEPTH * weight * dir.x\n const baseY = y - TRIANGLE_HEAD_DEPTH * weight * dir.y\n return [\n { x, y },\n { x: baseX - half * perp.x, y: baseY - half * perp.y },\n { x: baseX + half * perp.x, y: baseY + half * perp.y }\n ]\n}\n\n/** The two wings of an open (lines-style) arrow head, each from the tip to its end. */\nexport function arrowLinesSegments(\n x: number,\n y: number,\n angle: number,\n weight: number\n): [ArrowWing, ArrowWing] {\n const wingLength = WING_LENGTH * weight\n const tip = { x, y }\n const makeWing = (wingAngle: number): ArrowWing => ({\n from: tip,\n to: { x: x + wingLength * Math.cos(wingAngle), y: y + wingLength * Math.sin(wingAngle) }\n })\n return [makeWing(angle + Math.PI - WING_SWEEP), makeWing(angle + Math.PI + WING_SWEEP)]\n}\n\nfunction headAxes(angle: number) {\n const dir = { x: Math.cos(angle), y: Math.sin(angle) }\n return { dir, perp: { x: -dir.y, y: dir.x } }\n}\n\n/**\n * Points of a filled triangle head: its base across the end, narrowing back along the path to\n * the shaft's width, in drawing order.\n */\nexport function triangleCapPoints(\n x: number,\n y: number,\n angle: number,\n weight: number\n): [Vector, Vector, Vector, Vector] {\n const { dir, perp } = headAxes(angle)\n const back = {\n x: x - TRIANGLE_HEAD_DEPTH * weight * dir.x,\n y: y - TRIANGLE_HEAD_DEPTH * weight * dir.y\n }\n const at = (point: Vector, side: number) => ({\n x: point.x + side * perp.x,\n y: point.y + side * perp.y\n })\n const half = TRIANGLE_HEAD_HALF_WIDTH * weight\n return [at(back, weight / 2), at({ x, y }, half), at({ x, y }, -half), at(back, -weight / 2)]\n}\n\n/** Points of a filled diamond head centred on the end, in drawing order. */\nexport function diamondCapPoints(\n x: number,\n y: number,\n angle: number,\n weight: number\n): [Vector, Vector, Vector, Vector] {\n const { dir, perp } = headAxes(angle)\n const reach = TRIANGLE_HEAD_HALF_WIDTH * weight\n return [\n { x: x + reach * dir.x, y: y + reach * dir.y },\n { x: x + reach * perp.x, y: y + reach * perp.y },\n { x: x - reach * dir.x, y: y - reach * dir.y },\n { x: x - reach * perp.x, y: y - reach * perp.y }\n ]\n}\n\n/** Radius of a filled circle head, centred on the end. */\nexport function circleCapRadius(weight: number): number {\n return CIRCLE_HEAD_RADIUS * weight\n}\n\nfunction trimsShaft(cap: StrokeCap | undefined): boolean {\n return cap === 'TRIANGLE_FILLED' || cap === 'ARROW_EQUILATERAL'\n}\n\n/** Whether any open end of `network` carries a head the line stops short of. */\nexport function hasTrimmedShaft(network: VectorNetwork, fallbackCap: StrokeCap): boolean {\n return network.vertices.some((vertex) =>\n trimsShaft((vertex.strokeCap as StrokeCap | undefined) ?? fallbackCap)\n )\n}\n\n/**\n * The network with its line pulled back from each open end that carries a triangle or\n * equilateral head, as Figma draws it, so the line's own cap stays inside the head.\n */\nexport function trimArrowShafts(\n network: VectorNetwork,\n fallbackCap: StrokeCap,\n weight: number\n): VectorNetwork {\n const trimmed = structuredClone(network)\n // By segment and side, not position: an open path's two ends may meet at one point.\n for (const { segment, side, cap } of openArrowEnds(network, fallbackCap)) {\n if (!trimsShaft(cap)) continue\n trimSegmentEnd(trimmed, trimmed.segments[segment], side === 'end', SHAFT_TRIM * weight)\n }\n return trimmed\n}\n\ntype Cubic = [Vector, Vector, Vector, Vector]\n\nfunction cubicAt([a, b, c, d]: Cubic, t: number): Vector {\n const u = 1 - t\n return {\n x: u * u * u * a.x + 3 * u * u * t * b.x + 3 * u * t * t * c.x + t * t * t * d.x,\n y: u * u * u * a.y + 3 * u * u * t * b.y + 3 * u * t * t * c.y + t * t * t * d.y\n }\n}\n\nfunction lerp(a: Vector, b: Vector, t: number): Vector {\n return { x: a.x + (b.x - a.x) * t, y: a.y + (b.y - a.y) * t }\n}\n\n/** The part of a cubic from its start to `t`, by de Casteljau. */\nfunction cubicHead([a, b, c, d]: Cubic, t: number): Cubic {\n const ab = lerp(a, b, t)\n const bc = lerp(b, c, t)\n const cd = lerp(c, d, t)\n const abc = lerp(ab, bc, t)\n const bcd = lerp(bc, cd, t)\n return [a, ab, abc, lerp(abc, bcd, t)]\n}\n\n/**\n * Pulls one end of `segment` back along it until it lies `distance` from where it was, keeping\n * the rest of the curve where it is.\n */\nfunction trimSegmentEnd(\n network: VectorNetwork,\n segment: VectorNetwork['segments'][number],\n atEnd: boolean,\n distance: number\n) {\n const start = network.vertices[segment.start]\n const end = network.vertices[segment.end]\n // Oriented so the trimmed end comes last.\n const from = atEnd ? start : end\n const to = atEnd ? end : start\n const out = atEnd ? segment.tangentStart : segment.tangentEnd\n const back = atEnd ? segment.tangentEnd : segment.tangentStart\n const cubic: Cubic = [\n { x: from.x, y: from.y },\n { x: from.x + out.x, y: from.y + out.y },\n { x: to.x + back.x, y: to.y + back.y },\n { x: to.x, y: to.y }\n ]\n const length = Math.hypot(to.x - from.x, to.y - from.y)\n if (length <= distance) return\n const index = atEnd ? segment.end : segment.start\n const isStraight = out.x === 0 && out.y === 0 && back.x === 0 && back.y === 0\n if (isStraight) {\n // A straight segment stays straight, so the corner before it keeps its radius.\n const keep = (length - distance) / length\n const vertex = network.vertices[index]\n network.vertices[index] = {\n ...vertex,\n x: from.x + (to.x - from.x) * keep,\n y: from.y + (to.y - from.y) * keep\n }\n return\n }\n let low = 0\n let high = 1\n for (let step = 0; step < 40; step++) {\n const t = (low + high) / 2\n const point = cubicAt(cubic, t)\n if (Math.hypot(point.x - to.x, point.y - to.y) > distance) low = t\n else high = t\n }\n const [, c1, c2, tip] = cubicHead(cubic, low)\n network.vertices[index] = { ...network.vertices[index], x: tip.x, y: tip.y }\n const kept = { x: c1.x - from.x, y: c1.y - from.y }\n const trimmedBack = { x: c2.x - tip.x, y: c2.y - tip.y }\n if (atEnd) {\n segment.tangentStart = kept\n segment.tangentEnd = trimmedBack\n } else {\n segment.tangentEnd = kept\n segment.tangentStart = trimmedBack\n }\n}\n\n/**\n * Where Figma strokes a LINE running from its origin to (`width`, `height`): a full weight to one\n * side, toward its local negative y, whatever the stroke's alignment. Under a cap both ends come in\n * by half a weight, so the cap or head ends where the line does; an equilateral arrow already\n * comes to its point at the end, so it stays there.\n */\nexport function lineStrokeEnds(\n width: number,\n height: number,\n weight: number,\n cap: StrokeCap | undefined,\n // Flatten insets a full half weight even past the middle, reversing a short line (live-measured).\n insetPastMiddle = false\n): { start: Vector; end: Vector } {\n const length = Math.hypot(width, height)\n if (length === 0) return { start: { x: 0, y: 0 }, end: { x: 0, y: 0 } }\n const ux = width / length\n const uy = height / length\n const inset =\n cap === undefined || cap === 'NONE' || cap === 'ARROW_EQUILATERAL'\n ? 0\n : (insetPastMiddle ? weight : Math.min(weight, length)) / 2\n const offset = { x: (uy * weight) / 2, y: (-ux * weight) / 2 }\n return {\n start: { x: ux * inset + offset.x, y: uy * inset + offset.y },\n end: { x: width - ux * inset + offset.x, y: height - uy * inset + offset.y }\n }\n}\n"],"mappings":";;;;;;;;AA8BA,MAAM,sBAAsB;AAC5B,MAAM,2BAA2B,IAAI,KAAK,KAAK,CAAC;AAChD,MAAM,qBAAqB,IAAI;AAC/B,MAAM,cAAc;AACpB,MAAM,aAAa,KAAK,KAAK;;AAE7B,MAAM,aAAa;;;;;AAKnB,MAAM,aAAa,KAAK,IACtB,GACA,KAAK,MAAM,qBAAqB,wBAAwB,GACx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0,0 +1,17 @@
|
|
|
1
|
+
//#region src/asset-keys.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* A key shaped as Figma's asset keys, 40 hex digits, derived from `seed` so the same seed always
|
|
4
|
+
* gives the same key. The Figma clipboard names variables and collections by key; one made in
|
|
5
|
+
* OpenPencil has none, so copying it gives it this one, and copying it again gives the same.
|
|
6
|
+
*/
|
|
7
|
+
declare function derivedAssetKey(seed: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* A version shaped as Figma's asset versions, `session:local`, derived from `content` so that
|
|
10
|
+
* copying an unchanged asset again gives the same version and copying a changed one gives another.
|
|
11
|
+
* Figma keeps the first value it pasted for a key and version, so a version that stayed the same
|
|
12
|
+
* across an edit would bring the old value back.
|
|
13
|
+
*/
|
|
14
|
+
declare function derivedAssetVersion(content: string): string;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { derivedAssetKey, derivedAssetVersion };
|
|
17
|
+
//# sourceMappingURL=asset-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-keys.d.ts","names":[],"sources":["../src/asset-keys.ts"],"mappings":";;;;;;iBAQgB,gBAAgB;;;;;;;iBAahB,oBAAoB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-keys.js","names":[],"sources":["../src/asset-keys.ts"],"sourcesContent":["import { sha1 } from '@noble/hashes/legacy.js'\nimport { bytesToHex, utf8ToBytes } from '@noble/hashes/utils.js'\n\n/**\n * A key shaped as Figma's asset keys, 40 hex digits, derived from `seed` so the same seed always\n * gives the same key. The Figma clipboard names variables and collections by key; one made in\n * OpenPencil has none, so copying it gives it this one, and copying it again gives the same.\n */\nexport function derivedAssetKey(seed: string): string {\n return bytesToHex(sha1(utf8ToBytes(seed)))\n}\n\n/** Largest part of a Figma GUID, which Figma reads as a signed 32-bit integer. */\nconst MAX_GUID_PART = 0x7fffffff\n\n/**\n * A version shaped as Figma's asset versions, `session:local`, derived from `content` so that\n * copying an unchanged asset again gives the same version and copying a changed one gives another.\n * Figma keeps the first value it pasted for a key and version, so a version that stayed the same\n * across an edit would bring the old value back.\n */\nexport function derivedAssetVersion(content: string): string {\n const view = new DataView(sha1(utf8ToBytes(content)).buffer)\n return `${view.getUint32(0) & MAX_GUID_PART}:${view.getUint32(4) & MAX_GUID_PART}`\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,gBAAgB,MAAsB;CACpD,OAAO,WAAW,KAAK,YAAY,IAAI,CAAC,CAAC;AAC3C;;AAGA,MAAM,gBAAgB;;;;;;;AAQtB,SAAgB,oBAAoB,SAAyB;CAC3D,MAAM,OAAO,IAAI,SAAS,KAAK,YAAY,OAAO,CAAC,CAAC,CAAC,MAAM;CAC3D,OAAO,GAAG,KAAK,UAAU,CAAC,IAAI,cAAc,GAAG,KAAK,UAAU,CAAC,IAAI;AACrE"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BEHAVIOUR_CONTRACTS, BEHAVIOUR_KINDS, BehaviourContract, BehaviourKind, BehaviourPartContract, BehaviourValueContract, BehaviourValueType, INTERACTION_STATES, InteractionState, behaviourContract } from "./kinds.js";
|
|
2
|
+
import { findLayerByPath, hasBehaviour, layerPath } from "./layers.js";
|
|
3
|
+
import { Behaviour, BehaviourBooleanBinding, BehaviourInteractionStates, BehaviourNumberSettings, BehaviourSpec, behaviourSchema, behaviourSpecSchema, interactionStateValues, isNumberRange } from "./schema.js";
|
|
4
|
+
import { DEFAULT_NUMBER_SETTINGS, behaviourOwner, behaviourProperties, booleanBinding, emptyBehaviour, guessInteractionStates, missingBindings, numberSettings, partBinding, readBehaviour, renameBehaviourProperties, textBinding, withBehaviour } from "./model.js";
|
|
5
|
+
import { behaviourFromSpec, behaviourToSpec, guessOnOff } from "./spec.js";
|
|
6
|
+
export { BEHAVIOUR_CONTRACTS, BEHAVIOUR_KINDS, Behaviour, BehaviourBooleanBinding, BehaviourContract, BehaviourInteractionStates, BehaviourKind, BehaviourNumberSettings, BehaviourPartContract, BehaviourSpec, BehaviourValueContract, BehaviourValueType, DEFAULT_NUMBER_SETTINGS, INTERACTION_STATES, InteractionState, behaviourContract, behaviourFromSpec, behaviourOwner, behaviourProperties, behaviourSchema, behaviourSpecSchema, behaviourToSpec, booleanBinding, emptyBehaviour, findLayerByPath, guessInteractionStates, guessOnOff, hasBehaviour, interactionStateValues, isNumberRange, layerPath, missingBindings, numberSettings, partBinding, readBehaviour, renameBehaviourProperties, textBinding, withBehaviour };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BEHAVIOUR_CONTRACTS, BEHAVIOUR_KINDS, INTERACTION_STATES, behaviourContract } from "./kinds.js";
|
|
2
|
+
import { behaviourSchema, behaviourSpecSchema, interactionStateValues, isNumberRange } from "./schema.js";
|
|
3
|
+
import { DEFAULT_NUMBER_SETTINGS, behaviourOwner, behaviourProperties, booleanBinding, emptyBehaviour, guessInteractionStates, missingBindings, numberSettings, partBinding, readBehaviour, renameBehaviourProperties, textBinding, withBehaviour } from "./model.js";
|
|
4
|
+
import { findLayerByPath, hasBehaviour, layerPath } from "./layers.js";
|
|
5
|
+
import { behaviourFromSpec, behaviourToSpec, guessOnOff } from "./spec.js";
|
|
6
|
+
export { BEHAVIOUR_CONTRACTS, BEHAVIOUR_KINDS, DEFAULT_NUMBER_SETTINGS, INTERACTION_STATES, behaviourContract, behaviourFromSpec, behaviourOwner, behaviourProperties, behaviourSchema, behaviourSpecSchema, behaviourToSpec, booleanBinding, emptyBehaviour, findLayerByPath, guessInteractionStates, guessOnOff, hasBehaviour, interactionStateValues, isNumberRange, layerPath, missingBindings, numberSettings, partBinding, readBehaviour, renameBehaviourProperties, textBinding, withBehaviour };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//#region src/behaviours/kinds.d.ts
|
|
2
|
+
/** The controls a main component can behave as, in the order the picker lists them. */
|
|
3
|
+
declare const BEHAVIOUR_KINDS: readonly ["button", "textField", "textarea", "numberField", "toggle", "switch", "checkbox", "radio", "radioGroup", "toggleGroup", "slider", "progress", "tabs", "collapsible", "accordion"];
|
|
4
|
+
type BehaviourKind = (typeof BEHAVIOUR_KINDS)[number];
|
|
5
|
+
/**
|
|
6
|
+
* The interaction states a control can show, each drawn as a value of one variant property:
|
|
7
|
+
* at rest, under the pointer, while pressed, focused from the keyboard, and disabled.
|
|
8
|
+
*/
|
|
9
|
+
declare const INTERACTION_STATES: readonly ["rest", "hover", "pressed", "focus", "disabled"];
|
|
10
|
+
type InteractionState = (typeof INTERACTION_STATES)[number];
|
|
11
|
+
/**
|
|
12
|
+
* How a behaviour value is held. A boolean is a variant or boolean property of the component,
|
|
13
|
+
* and text is a text property. Figma has no number property, so a number is the behaviour's
|
|
14
|
+
* own (min, max, step, default); a choice is which item of a slot is active, the first by
|
|
15
|
+
* default.
|
|
16
|
+
*/
|
|
17
|
+
type BehaviourValueType = 'boolean' | 'text' | 'number' | 'choice';
|
|
18
|
+
/** A value of the control: its state, which preview reads and changes. */
|
|
19
|
+
interface BehaviourValueContract {
|
|
20
|
+
id: string;
|
|
21
|
+
type: BehaviourValueType;
|
|
22
|
+
/** Whether a boolean or text value must be bound before the behaviour is complete. */
|
|
23
|
+
required: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A Reka UI subcomponent of the control, which is a slot of the component: the behaviour binds
|
|
27
|
+
* it to one of the component's slot properties, never to a layer found by name.
|
|
28
|
+
*/
|
|
29
|
+
interface BehaviourPartContract {
|
|
30
|
+
id: string;
|
|
31
|
+
required: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Whether the slot holds the control's items, each an instance with its own behaviour (a
|
|
34
|
+
* radio, a toggle, a collapsible), which the control turns on and off.
|
|
35
|
+
*/
|
|
36
|
+
items?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* The Reka UI part each child of the slot is, when the slot holds repeated parts: a tab list's
|
|
39
|
+
* triggers, the tabs' content panels, or a group's items.
|
|
40
|
+
*/
|
|
41
|
+
children?: string;
|
|
42
|
+
}
|
|
43
|
+
interface BehaviourContract {
|
|
44
|
+
values: BehaviourValueContract[];
|
|
45
|
+
parts: BehaviourPartContract[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The behaviours OpenPencil knows, after Reka UI's primitives. Their states are drawn as the
|
|
49
|
+
* component's variants and properties; their subcomponents (thumb, range, trigger, …) are the
|
|
50
|
+
* component's slots, and the component itself is the control's root.
|
|
51
|
+
*/
|
|
52
|
+
declare const BEHAVIOUR_CONTRACTS: Readonly<Record<BehaviourKind, BehaviourContract>>;
|
|
53
|
+
declare function behaviourContract(kind: BehaviourKind): BehaviourContract;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { BEHAVIOUR_CONTRACTS, BEHAVIOUR_KINDS, BehaviourContract, BehaviourKind, BehaviourPartContract, BehaviourValueContract, BehaviourValueType, INTERACTION_STATES, InteractionState, behaviourContract };
|
|
56
|
+
//# sourceMappingURL=kinds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kinds.d.ts","names":[],"sources":["../../src/behaviours/kinds.ts"],"mappings":";;cACa;KAkBD,wBAAwB;;;;;cAMvB;KAED,2BAA2B;;;;;;;KAQ3B;;UAGK;EACf;EACA,MAAM;;EAEN;;;;;;UAOe;EACf;EACA;;;;;EAKA;;;;;EAKA;;UAGe;EACf,QAAQ;EACR,OAAO;;;;;;;cAqBI,qBAAqB,SAAS,OAAO,eAAe;iBA+FjD,kBAAkB,MAAM,gBAAgB"}
|