@pairdraw/scene-graph 0.0.0-stage → 0.16.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/LICENSE +21 -0
- package/README.md +4 -2
- package/dist/agent-notes/index.d.ts +3 -0
- package/dist/agent-notes/index.js +3 -0
- package/dist/agent-notes/model.d.ts +23 -0
- package/dist/agent-notes/model.d.ts.map +1 -0
- package/dist/agent-notes/model.js +36 -0
- package/dist/agent-notes/model.js.map +1 -0
- package/dist/agent-notes/schema.d.ts +19 -0
- package/dist/agent-notes/schema.d.ts.map +1 -0
- package/dist/agent-notes/schema.js +17 -0
- package/dist/agent-notes/schema.js.map +1 -0
- package/dist/arrow-caps.d.ts +65 -0
- package/dist/arrow-caps.d.ts.map +1 -0
- package/dist/arrow-caps.js +365 -0
- package/dist/arrow-caps.js.map +1 -0
- package/dist/asset-keys.d.ts +17 -0
- package/dist/asset-keys.d.ts.map +1 -0
- package/dist/asset-keys.js +27 -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 +273 -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/behaviours/spec.js +157 -0
- package/dist/behaviours/spec.js.map +1 -0
- package/dist/bindings.js +18 -0
- package/dist/bindings.js.map +1 -0
- package/dist/browser-node/index.d.ts +3 -0
- package/dist/browser-node/index.js +3 -0
- package/dist/browser-node/model.d.ts +18 -0
- package/dist/browser-node/model.d.ts.map +1 -0
- package/dist/browser-node/model.js +31 -0
- package/dist/browser-node/model.js.map +1 -0
- package/dist/browser-node/schema.d.ts +23 -0
- package/dist/browser-node/schema.d.ts.map +1 -0
- package/dist/browser-node/schema.js +44 -0
- package/dist/browser-node/schema.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 +57 -0
- package/dist/buffered-events.js.map +1 -0
- package/dist/checkpoint.d.ts +28 -0
- package/dist/checkpoint.d.ts.map +1 -0
- package/dist/checkpoint.js +246 -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 +20 -0
- package/dist/color/contrast.d.ts.map +1 -0
- package/dist/color/contrast.js +69 -0
- 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/comments/document.js +33 -0
- 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/comments/merge.js +58 -0
- 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/comments/threads.js +132 -0
- 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 +5 -0
- package/dist/components/index.js +5 -0
- package/dist/components/library-page.d.ts +11 -0
- package/dist/components/library-page.d.ts.map +1 -0
- package/dist/components/library-page.js +21 -0
- package/dist/components/library-page.js.map +1 -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 +32 -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 +209 -0
- package/dist/connectors/sublayers.js.map +1 -0
- package/dist/constants.d.ts +16 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +31 -0
- package/dist/constants.js.map +1 -0
- package/dist/coordinate.d.ts +99 -0
- package/dist/coordinate.d.ts.map +1 -0
- package/dist/coordinate.js +276 -0
- package/dist/coordinate.js.map +1 -0
- package/dist/copy.d.ts +45 -0
- package/dist/copy.d.ts.map +1 -0
- package/dist/copy.js +256 -0
- 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/css/grid.js +63 -0
- 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 +18 -0
- package/dist/events.js.map +1 -0
- package/dist/export-format.d.ts +19 -0
- package/dist/export-format.d.ts.map +1 -0
- package/dist/export-format.js +33 -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 +14 -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 +199 -0
- package/dist/figjam/palette.d.ts.map +1 -0
- package/dist/figjam/palette.js +277 -0
- package/dist/figjam/palette.js.map +1 -0
- package/dist/figjam/text.d.ts +68 -0
- package/dist/figjam/text.d.ts.map +1 -0
- package/dist/figjam/text.js +89 -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 +46 -0
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/index.js +62 -0
- package/dist/generated/index.js.map +1 -0
- package/dist/generated/kind.d.ts +29 -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 +119 -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 +234 -0
- package/dist/generated/sticky.js.map +1 -0
- package/dist/geometry.d.ts +105 -0
- package/dist/geometry.d.ts.map +1 -0
- package/dist/geometry.js +374 -0
- package/dist/geometry.js.map +1 -0
- package/dist/gradient.d.ts +74 -0
- package/dist/gradient.d.ts.map +1 -0
- package/dist/gradient.js +211 -0
- package/dist/gradient.js.map +1 -0
- package/dist/graph.d.ts +186 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +630 -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/group-bounds.js +146 -0
- package/dist/group-bounds.js.map +1 -0
- package/dist/guides.d.ts +19 -0
- package/dist/guides.d.ts.map +1 -0
- package/dist/guides.js +39 -0
- package/dist/guides.js.map +1 -0
- package/dist/hit-test.d.ts +49 -0
- package/dist/hit-test.d.ts.map +1 -0
- package/dist/hit-test.js +315 -0
- package/dist/hit-test.js.map +1 -0
- package/dist/icons/glyph.d.ts +22 -0
- package/dist/icons/glyph.d.ts.map +1 -0
- package/dist/icons/glyph.js +109 -0
- 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 -0
- package/dist/images.d.ts.map +1 -0
- package/dist/images.js +85 -0
- package/dist/images.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- 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 +162 -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 +63 -0
- package/dist/instances/index.d.ts.map +1 -0
- package/dist/instances/index.js +305 -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/modes.js +26 -0
- package/dist/instances/modes.js.map +1 -0
- package/dist/instances/overrides.d.ts +63 -0
- package/dist/instances/overrides.d.ts.map +1 -0
- package/dist/instances/overrides.js +164 -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/replacements.d.ts +19 -0
- package/dist/instances/replacements.d.ts.map +1 -0
- package/dist/instances/replacements.js +67 -0
- package/dist/instances/replacements.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 +305 -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/index.js +5 -0
- package/dist/layout/keywords.d.ts +26 -0
- package/dist/layout/keywords.d.ts.map +1 -0
- package/dist/layout/keywords.js +60 -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 -0
- package/dist/matrix.d.ts.map +1 -0
- package/dist/matrix.js +120 -0
- 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/naming.d.ts +9 -0
- package/dist/naming.d.ts.map +1 -0
- package/dist/naming.js +16 -0
- package/dist/naming.js.map +1 -0
- package/dist/node-defaults.d.ts +19 -0
- package/dist/node-defaults.d.ts.map +1 -0
- package/dist/node-defaults.js +243 -0
- package/dist/node-defaults.js.map +1 -0
- package/dist/order-keys.d.ts +39 -0
- package/dist/order-keys.d.ts.map +1 -0
- package/dist/order-keys.js +136 -0
- package/dist/order-keys.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 +103 -0
- package/dist/paints/schema.d.ts.map +1 -0
- package/dist/paints/schema.js +64 -0
- package/dist/paints/schema.js.map +1 -0
- package/dist/parse-path.d.ts +36 -0
- package/dist/parse-path.d.ts.map +1 -0
- package/dist/parse-path.js +200 -0
- package/dist/parse-path.js.map +1 -0
- package/dist/plugin-data/citation.d.ts +13 -0
- package/dist/plugin-data/citation.d.ts.map +1 -0
- package/dist/plugin-data/citation.js +23 -0
- package/dist/plugin-data/citation.js.map +1 -0
- 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 +79 -0
- package/dist/plugin-data/field.js.map +1 -0
- package/dist/plugin-data/fields.d.ts +220 -0
- package/dist/plugin-data/fields.d.ts.map +1 -0
- package/dist/plugin-data/fields.js +214 -0
- package/dist/plugin-data/fields.js.map +1 -0
- package/dist/plugin-data/index.d.ts +5 -0
- package/dist/plugin-data/index.js +5 -0
- package/dist/plugin-data/schema.d.ts +18 -0
- package/dist/plugin-data/schema.d.ts.map +1 -0
- package/dist/plugin-data/schema.js +29 -0
- package/dist/plugin-data/schema.js.map +1 -0
- package/dist/polygon.d.ts +55 -0
- package/dist/polygon.d.ts.map +1 -0
- package/dist/polygon.js +220 -0
- package/dist/polygon.js.map +1 -0
- package/dist/preview.d.ts +12 -0
- package/dist/preview.d.ts.map +1 -0
- package/dist/preview.js +63 -0
- package/dist/preview.js.map +1 -0
- package/dist/primitives/index.d.ts +43 -0
- 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.d.ts +7 -0
- package/dist/random.d.ts.map +1 -0
- package/dist/random.js +25 -0
- package/dist/random.js.map +1 -0
- package/dist/resize.d.ts +41 -0
- package/dist/resize.d.ts.map +1 -0
- package/dist/resize.js +288 -0
- 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 +150 -0
- package/dist/scaling/node.js.map +1 -0
- package/dist/scaling/tree.d.ts +22 -0
- package/dist/scaling/tree.d.ts.map +1 -0
- package/dist/scaling/tree.js +71 -0
- package/dist/scaling/tree.js.map +1 -0
- package/dist/script/index.d.ts +2 -0
- package/dist/script/index.js +2 -0
- package/dist/script/schema.d.ts +29 -0
- package/dist/script/schema.d.ts.map +1 -0
- package/dist/script/schema.js +51 -0
- package/dist/script/schema.js.map +1 -0
- package/dist/shaders/directives.d.ts +43 -0
- package/dist/shaders/directives.d.ts.map +1 -0
- package/dist/shaders/directives.js +293 -0
- package/dist/shaders/directives.js.map +1 -0
- package/dist/shaders/index.d.ts +5 -0
- package/dist/shaders/index.js +5 -0
- package/dist/shaders/model.d.ts +58 -0
- package/dist/shaders/model.d.ts.map +1 -0
- package/dist/shaders/model.js +109 -0
- package/dist/shaders/model.js.map +1 -0
- package/dist/shaders/schema.d.ts +86 -0
- package/dist/shaders/schema.d.ts.map +1 -0
- package/dist/shaders/schema.js +65 -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 +36 -0
- package/dist/shared-styles.d.ts.map +1 -0
- package/dist/shared-styles.js +116 -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 +74 -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 +61 -0
- package/dist/snap.d.ts.map +1 -0
- package/dist/snap.js +264 -0
- package/dist/snap.js.map +1 -0
- package/dist/source-metadata.d.ts +6 -0
- package/dist/source-metadata.d.ts.map +1 -0
- package/dist/source-metadata.js +11 -0
- 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 +13 -0
- package/dist/text/direction.d.ts.map +1 -0
- package/dist/text/direction.js +31 -0
- 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 +18 -0
- 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/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 +7 -0
- package/dist/transfer/index.js +7 -0
- package/dist/transfer/nodes.d.ts +14 -0
- package/dist/transfer/nodes.d.ts.map +1 -0
- package/dist/transfer/nodes.js +82 -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 +910 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +89 -0
- package/dist/types.js.map +1 -0
- package/dist/undo.d.ts +93 -0
- package/dist/undo.d.ts.map +1 -0
- package/dist/undo.js +236 -0
- package/dist/undo.js.map +1 -0
- package/dist/variables/bindings.d.ts +66 -0
- package/dist/variables/bindings.d.ts.map +1 -0
- package/dist/variables/bindings.js +251 -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 +30 -0
- package/dist/variables/fields.d.ts.map +1 -0
- package/dist/variables/fields.js +89 -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 +246 -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 +21 -0
- package/dist/variables/text.d.ts.map +1 -0
- package/dist/variables/text.js +58 -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/variant-name.d.ts +6 -0
- package/dist/variant-name.d.ts.map +1 -0
- package/dist/variant-name.js +17 -0
- package/dist/variant-name.js.map +1 -0
- package/dist/variant-properties.d.ts +18 -0
- package/dist/variant-properties.d.ts.map +1 -0
- package/dist/variant-properties.js +74 -0
- package/dist/variant-properties.js.map +1 -0
- package/dist/vector-network.d.ts +48 -0
- package/dist/vector-network.d.ts.map +1 -0
- package/dist/vector-network.js +352 -0
- package/dist/vector-network.js.map +1 -0
- package/package.json +364 -4
- package/src/agent-notes/index.ts +2 -0
- package/src/agent-notes/model.ts +46 -0
- package/src/agent-notes/schema.ts +28 -0
- package/src/arrow-caps.ts +364 -0
- package/src/asset-keys.ts +25 -0
- package/src/behaviours/index.ts +5 -0
- package/src/behaviours/kinds.ts +185 -0
- package/src/behaviours/layers.ts +51 -0
- package/src/behaviours/model.ts +184 -0
- package/src/behaviours/schema.ts +93 -0
- package/src/behaviours/spec.ts +178 -0
- package/src/bindings.ts +20 -0
- package/src/browser-node/index.ts +2 -0
- package/src/browser-node/model.ts +35 -0
- package/src/browser-node/schema.ts +62 -0
- package/src/buffered-events.ts +64 -0
- package/src/checkpoint.ts +325 -0
- package/src/clipping.ts +112 -0
- package/src/color/contrast.ts +71 -0
- package/src/color/index.ts +89 -0
- package/src/color/management.ts +210 -0
- package/src/color/normalize.ts +7 -0
- package/src/color/okhcl.ts +201 -0
- package/src/color/schema.ts +10 -0
- package/src/comments/document.ts +51 -0
- package/src/comments/index.ts +5 -0
- package/src/comments/list.ts +52 -0
- package/src/comments/merge.ts +63 -0
- package/src/comments/schema.ts +51 -0
- package/src/comments/threads.ts +156 -0
- package/src/components/exposure.ts +61 -0
- package/src/components/index.ts +9 -0
- package/src/components/library-page.ts +17 -0
- package/src/components/properties.ts +241 -0
- package/src/components/variants.ts +53 -0
- 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 +204 -0
- package/src/constants.ts +13 -0
- package/src/coordinate.ts +298 -0
- package/src/copy.ts +341 -0
- package/src/css/grid.ts +70 -0
- package/src/css/index.ts +10 -0
- package/src/css/layout.ts +53 -0
- package/src/css/shadows.ts +68 -0
- package/src/css/text.ts +84 -0
- package/src/css/values.ts +42 -0
- package/src/events.ts +21 -0
- package/src/export-format.ts +33 -0
- package/src/export-scale.ts +16 -0
- package/src/fields/appearance.ts +35 -0
- package/src/fields/geometry.ts +11 -0
- package/src/fields/index.ts +4 -0
- package/src/fields/layout.ts +48 -0
- package/src/fields/text.ts +64 -0
- package/src/fig-compression.ts +9 -0
- package/src/figjam/index.ts +2 -0
- package/src/figjam/palette.ts +308 -0
- package/src/figjam/text.ts +78 -0
- package/src/font-style.ts +121 -0
- package/src/generated/index.ts +81 -0
- package/src/generated/kind.ts +26 -0
- package/src/generated/shape-with-text.ts +132 -0
- package/src/generated/sticky.ts +214 -0
- package/src/geometry.ts +490 -0
- package/src/gradient.ts +275 -0
- package/src/graph.ts +842 -0
- package/src/group-bounds.ts +178 -0
- package/src/guides.ts +47 -0
- package/src/hit-test.ts +501 -0
- package/src/icons/glyph.ts +128 -0
- package/src/icons/index.ts +3 -0
- package/src/icons/model.ts +63 -0
- package/src/icons/schema.ts +34 -0
- package/src/ids.ts +34 -0
- package/src/images.ts +89 -0
- package/src/index.ts +4 -0
- package/src/instances/assignments.ts +116 -0
- package/src/instances/content-size.ts +84 -0
- package/src/instances/copies.ts +244 -0
- package/src/instances/cycles.ts +73 -0
- package/src/instances/fields.ts +90 -0
- package/src/instances/index.ts +467 -0
- package/src/instances/main-component.ts +61 -0
- package/src/instances/modes.ts +39 -0
- package/src/instances/overrides.ts +240 -0
- package/src/instances/placement.ts +29 -0
- package/src/instances/replacements.ts +80 -0
- package/src/instances/source-walk.ts +35 -0
- package/src/instances/sync.ts +556 -0
- package/src/instances/vector-geometry.ts +81 -0
- package/src/layout/aspect-ratio.ts +51 -0
- package/src/layout/guides.ts +132 -0
- package/src/layout/index.ts +4 -0
- package/src/layout/keywords.ts +74 -0
- package/src/layout/sizing.ts +196 -0
- package/src/layout/writes.ts +59 -0
- package/src/matrix.ts +116 -0
- package/src/mutation-impact.ts +85 -0
- package/src/naming.ts +11 -0
- package/src/node-defaults.ts +260 -0
- package/src/order-keys.ts +162 -0
- package/src/paints/index.ts +1 -0
- package/src/paints/schema.ts +72 -0
- package/src/parse-path.ts +244 -0
- package/src/plugin-data/citation.ts +27 -0
- package/src/plugin-data/field.ts +140 -0
- package/src/plugin-data/fields.ts +306 -0
- package/src/plugin-data/index.ts +3 -0
- package/src/plugin-data/schema.ts +35 -0
- package/src/polygon.ts +228 -0
- package/src/preview.ts +80 -0
- package/src/primitives/index.ts +44 -0
- package/src/primitives/schema.ts +14 -0
- package/src/random.ts +28 -0
- package/src/resize.ts +415 -0
- package/src/scaling/index.ts +9 -0
- package/src/scaling/node.ts +168 -0
- package/src/scaling/tree.ts +85 -0
- package/src/script/index.ts +1 -0
- package/src/script/schema.ts +65 -0
- package/src/shaders/directives.ts +366 -0
- package/src/shaders/index.ts +4 -0
- package/src/shaders/model.ts +147 -0
- package/src/shaders/schema.ts +84 -0
- package/src/shaders/still.ts +41 -0
- 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 +137 -0
- package/src/slots/authoring.ts +101 -0
- package/src/slots/content.ts +127 -0
- package/src/slots/frames.ts +160 -0
- package/src/slots/index.ts +4 -0
- package/src/slots/limits.ts +49 -0
- package/src/snap.ts +349 -0
- package/src/source-metadata.ts +8 -0
- 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/direction.ts +55 -0
- package/src/text/index.ts +6 -0
- package/src/text/lengths.ts +34 -0
- package/src/text/lists.ts +138 -0
- package/src/text/overflow.ts +12 -0
- package/src/text/paragraphs.ts +241 -0
- package/src/text/picture.ts +57 -0
- package/src/text/references.ts +50 -0
- package/src/text/schema.ts +7 -0
- package/src/transfer/apply.ts +84 -0
- package/src/transfer/history.ts +49 -0
- package/src/transfer/identity.ts +16 -0
- package/src/transfer/index.ts +6 -0
- package/src/transfer/nodes.ts +128 -0
- package/src/transfer/plan.ts +130 -0
- package/src/transfer/references.ts +9 -0
- package/src/transfer/remove.ts +39 -0
- package/src/transfer/validation.ts +59 -0
- package/src/transfer/variables.ts +83 -0
- package/src/types.ts +1205 -0
- package/src/undo.ts +285 -0
- package/src/variables/bindings.ts +310 -0
- package/src/variables/corners.ts +39 -0
- package/src/variables/fields.ts +109 -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/index.ts +400 -0
- package/src/variables/resolution.ts +293 -0
- package/src/variables/schema.ts +31 -0
- package/src/variables/text.ts +61 -0
- package/src/variables/token.ts +40 -0
- package/src/variables/units.ts +15 -0
- package/src/variables/value.ts +92 -0
- package/src/variant-name.ts +15 -0
- package/src/variant-properties.ts +98 -0
- package/src/vector-network.ts +489 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { sha1 } from "@noble/hashes/legacy.js";
|
|
2
|
+
import { bytesToHex, utf8ToBytes } from "@noble/hashes/utils.js";
|
|
3
|
+
//#region src/asset-keys.ts
|
|
4
|
+
/**
|
|
5
|
+
* A key shaped as Figma's asset keys, 40 hex digits, derived from `seed` so the same seed always
|
|
6
|
+
* gives the same key. The Figma clipboard names variables and collections by key; one made in
|
|
7
|
+
* Pairdraw has none, so copying it gives it this one, and copying it again gives the same.
|
|
8
|
+
*/
|
|
9
|
+
function derivedAssetKey(seed) {
|
|
10
|
+
return bytesToHex(sha1(utf8ToBytes(seed)));
|
|
11
|
+
}
|
|
12
|
+
/** Largest part of a Figma GUID, which Figma reads as a signed 32-bit integer. */
|
|
13
|
+
const MAX_GUID_PART = 2147483647;
|
|
14
|
+
/**
|
|
15
|
+
* A version shaped as Figma's asset versions, `session:local`, derived from `content` so that
|
|
16
|
+
* copying an unchanged asset again gives the same version and copying a changed one gives another.
|
|
17
|
+
* Figma keeps the first value it pasted for a key and version, so a version that stayed the same
|
|
18
|
+
* across an edit would bring the old value back.
|
|
19
|
+
*/
|
|
20
|
+
function derivedAssetVersion(content) {
|
|
21
|
+
const view = new DataView(sha1(utf8ToBytes(content)).buffer);
|
|
22
|
+
return `${view.getUint32(0) & MAX_GUID_PART}:${view.getUint32(4) & MAX_GUID_PART}`;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { derivedAssetKey, derivedAssetVersion };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=asset-keys.js.map
|
|
@@ -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 * Pairdraw 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 Pairdraw 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"}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
//#region src/behaviours/kinds.ts
|
|
2
|
+
/** The controls a main component can behave as, in the order the picker lists them. */
|
|
3
|
+
const BEHAVIOUR_KINDS = [
|
|
4
|
+
"button",
|
|
5
|
+
"textField",
|
|
6
|
+
"textarea",
|
|
7
|
+
"numberField",
|
|
8
|
+
"toggle",
|
|
9
|
+
"switch",
|
|
10
|
+
"checkbox",
|
|
11
|
+
"radio",
|
|
12
|
+
"radioGroup",
|
|
13
|
+
"toggleGroup",
|
|
14
|
+
"slider",
|
|
15
|
+
"progress",
|
|
16
|
+
"tabs",
|
|
17
|
+
"collapsible",
|
|
18
|
+
"accordion"
|
|
19
|
+
];
|
|
20
|
+
/**
|
|
21
|
+
* The interaction states a control can show, each drawn as a value of one variant property:
|
|
22
|
+
* at rest, under the pointer, while pressed, focused from the keyboard, and disabled.
|
|
23
|
+
*/
|
|
24
|
+
const INTERACTION_STATES = [
|
|
25
|
+
"rest",
|
|
26
|
+
"hover",
|
|
27
|
+
"pressed",
|
|
28
|
+
"focus",
|
|
29
|
+
"disabled"
|
|
30
|
+
];
|
|
31
|
+
/**
|
|
32
|
+
* A text field or textarea: its text is a text property, and `filled`, when bound, draws the
|
|
33
|
+
* empty field with its placeholder.
|
|
34
|
+
*/
|
|
35
|
+
const TEXT_INPUT = {
|
|
36
|
+
values: [
|
|
37
|
+
{
|
|
38
|
+
id: "value",
|
|
39
|
+
type: "text",
|
|
40
|
+
required: true
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: "filled",
|
|
44
|
+
type: "boolean",
|
|
45
|
+
required: false
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "disabled",
|
|
49
|
+
type: "boolean",
|
|
50
|
+
required: false
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
parts: []
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* The behaviours Pairdraw knows, after Reka UI's primitives. Their states are drawn as the
|
|
57
|
+
* component's variants and properties; their subcomponents (thumb, range, trigger, …) are the
|
|
58
|
+
* component's slots, and the component itself is the control's root.
|
|
59
|
+
*/
|
|
60
|
+
const BEHAVIOUR_CONTRACTS = {
|
|
61
|
+
button: {
|
|
62
|
+
values: [{
|
|
63
|
+
id: "disabled",
|
|
64
|
+
type: "boolean",
|
|
65
|
+
required: false
|
|
66
|
+
}],
|
|
67
|
+
parts: []
|
|
68
|
+
},
|
|
69
|
+
textField: TEXT_INPUT,
|
|
70
|
+
textarea: TEXT_INPUT,
|
|
71
|
+
numberField: {
|
|
72
|
+
values: [
|
|
73
|
+
{
|
|
74
|
+
id: "value",
|
|
75
|
+
type: "number",
|
|
76
|
+
required: false
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: "text",
|
|
80
|
+
type: "text",
|
|
81
|
+
required: true
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "disabled",
|
|
85
|
+
type: "boolean",
|
|
86
|
+
required: false
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
parts: [{
|
|
90
|
+
id: "increment",
|
|
91
|
+
required: false
|
|
92
|
+
}, {
|
|
93
|
+
id: "decrement",
|
|
94
|
+
required: false
|
|
95
|
+
}]
|
|
96
|
+
},
|
|
97
|
+
toggle: {
|
|
98
|
+
values: [{
|
|
99
|
+
id: "value",
|
|
100
|
+
type: "boolean",
|
|
101
|
+
required: true
|
|
102
|
+
}, {
|
|
103
|
+
id: "disabled",
|
|
104
|
+
type: "boolean",
|
|
105
|
+
required: false
|
|
106
|
+
}],
|
|
107
|
+
parts: []
|
|
108
|
+
},
|
|
109
|
+
switch: {
|
|
110
|
+
values: [{
|
|
111
|
+
id: "value",
|
|
112
|
+
type: "boolean",
|
|
113
|
+
required: true
|
|
114
|
+
}, {
|
|
115
|
+
id: "disabled",
|
|
116
|
+
type: "boolean",
|
|
117
|
+
required: false
|
|
118
|
+
}],
|
|
119
|
+
parts: [{
|
|
120
|
+
id: "thumb",
|
|
121
|
+
required: false
|
|
122
|
+
}]
|
|
123
|
+
},
|
|
124
|
+
checkbox: {
|
|
125
|
+
values: [{
|
|
126
|
+
id: "value",
|
|
127
|
+
type: "boolean",
|
|
128
|
+
required: true
|
|
129
|
+
}, {
|
|
130
|
+
id: "disabled",
|
|
131
|
+
type: "boolean",
|
|
132
|
+
required: false
|
|
133
|
+
}],
|
|
134
|
+
parts: [{
|
|
135
|
+
id: "indicator",
|
|
136
|
+
required: false
|
|
137
|
+
}]
|
|
138
|
+
},
|
|
139
|
+
radio: {
|
|
140
|
+
values: [{
|
|
141
|
+
id: "value",
|
|
142
|
+
type: "boolean",
|
|
143
|
+
required: true
|
|
144
|
+
}, {
|
|
145
|
+
id: "disabled",
|
|
146
|
+
type: "boolean",
|
|
147
|
+
required: false
|
|
148
|
+
}],
|
|
149
|
+
parts: [{
|
|
150
|
+
id: "indicator",
|
|
151
|
+
required: false
|
|
152
|
+
}]
|
|
153
|
+
},
|
|
154
|
+
radioGroup: {
|
|
155
|
+
values: [{
|
|
156
|
+
id: "disabled",
|
|
157
|
+
type: "boolean",
|
|
158
|
+
required: false
|
|
159
|
+
}],
|
|
160
|
+
parts: [{
|
|
161
|
+
id: "items",
|
|
162
|
+
required: true,
|
|
163
|
+
items: true,
|
|
164
|
+
children: "item"
|
|
165
|
+
}]
|
|
166
|
+
},
|
|
167
|
+
toggleGroup: {
|
|
168
|
+
values: [{
|
|
169
|
+
id: "disabled",
|
|
170
|
+
type: "boolean",
|
|
171
|
+
required: false
|
|
172
|
+
}],
|
|
173
|
+
parts: [{
|
|
174
|
+
id: "items",
|
|
175
|
+
required: true,
|
|
176
|
+
items: true,
|
|
177
|
+
children: "item"
|
|
178
|
+
}]
|
|
179
|
+
},
|
|
180
|
+
slider: {
|
|
181
|
+
values: [{
|
|
182
|
+
id: "value",
|
|
183
|
+
type: "number",
|
|
184
|
+
required: false
|
|
185
|
+
}, {
|
|
186
|
+
id: "disabled",
|
|
187
|
+
type: "boolean",
|
|
188
|
+
required: false
|
|
189
|
+
}],
|
|
190
|
+
parts: [
|
|
191
|
+
{
|
|
192
|
+
id: "track",
|
|
193
|
+
required: true
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
id: "range",
|
|
197
|
+
required: false
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
id: "thumb",
|
|
201
|
+
required: true
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
},
|
|
205
|
+
tabs: {
|
|
206
|
+
values: [{
|
|
207
|
+
id: "value",
|
|
208
|
+
type: "choice",
|
|
209
|
+
required: false
|
|
210
|
+
}],
|
|
211
|
+
parts: [{
|
|
212
|
+
id: "list",
|
|
213
|
+
required: true,
|
|
214
|
+
children: "trigger"
|
|
215
|
+
}, {
|
|
216
|
+
id: "panels",
|
|
217
|
+
required: false,
|
|
218
|
+
children: "content"
|
|
219
|
+
}]
|
|
220
|
+
},
|
|
221
|
+
progress: {
|
|
222
|
+
values: [{
|
|
223
|
+
id: "value",
|
|
224
|
+
type: "number",
|
|
225
|
+
required: false
|
|
226
|
+
}],
|
|
227
|
+
parts: [{
|
|
228
|
+
id: "track",
|
|
229
|
+
required: true
|
|
230
|
+
}, {
|
|
231
|
+
id: "indicator",
|
|
232
|
+
required: true
|
|
233
|
+
}]
|
|
234
|
+
},
|
|
235
|
+
collapsible: {
|
|
236
|
+
values: [{
|
|
237
|
+
id: "open",
|
|
238
|
+
type: "boolean",
|
|
239
|
+
required: false
|
|
240
|
+
}, {
|
|
241
|
+
id: "disabled",
|
|
242
|
+
type: "boolean",
|
|
243
|
+
required: false
|
|
244
|
+
}],
|
|
245
|
+
parts: [{
|
|
246
|
+
id: "trigger",
|
|
247
|
+
required: true
|
|
248
|
+
}, {
|
|
249
|
+
id: "content",
|
|
250
|
+
required: true
|
|
251
|
+
}]
|
|
252
|
+
},
|
|
253
|
+
accordion: {
|
|
254
|
+
values: [{
|
|
255
|
+
id: "disabled",
|
|
256
|
+
type: "boolean",
|
|
257
|
+
required: false
|
|
258
|
+
}],
|
|
259
|
+
parts: [{
|
|
260
|
+
id: "items",
|
|
261
|
+
required: true,
|
|
262
|
+
items: true,
|
|
263
|
+
children: "item"
|
|
264
|
+
}]
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
function behaviourContract(kind) {
|
|
268
|
+
return BEHAVIOUR_CONTRACTS[kind];
|
|
269
|
+
}
|
|
270
|
+
//#endregion
|
|
271
|
+
export { BEHAVIOUR_CONTRACTS, BEHAVIOUR_KINDS, INTERACTION_STATES, behaviourContract };
|
|
272
|
+
|
|
273
|
+
//# sourceMappingURL=kinds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kinds.js","names":[],"sources":["../../src/behaviours/kinds.ts"],"sourcesContent":["/** The controls a main component can behave as, in the order the picker lists them. */\nexport const BEHAVIOUR_KINDS = [\n 'button',\n 'textField',\n 'textarea',\n 'numberField',\n 'toggle',\n 'switch',\n 'checkbox',\n 'radio',\n 'radioGroup',\n 'toggleGroup',\n 'slider',\n 'progress',\n 'tabs',\n 'collapsible',\n 'accordion'\n] as const\n\nexport type BehaviourKind = (typeof BEHAVIOUR_KINDS)[number]\n\n/**\n * The interaction states a control can show, each drawn as a value of one variant property:\n * at rest, under the pointer, while pressed, focused from the keyboard, and disabled.\n */\nexport const INTERACTION_STATES = ['rest', 'hover', 'pressed', 'focus', 'disabled'] as const\n\nexport type InteractionState = (typeof INTERACTION_STATES)[number]\n\n/**\n * How a behaviour value is held. A boolean is a variant or boolean property of the component,\n * and text is a text property. Figma has no number property, so a number is the behaviour's\n * own (min, max, step, default); a choice is which item of a slot is active, the first by\n * default.\n */\nexport type BehaviourValueType = 'boolean' | 'text' | 'number' | 'choice'\n\n/** A value of the control: its state, which preview reads and changes. */\nexport interface BehaviourValueContract {\n id: string\n type: BehaviourValueType\n /** Whether a boolean or text value must be bound before the behaviour is complete. */\n required: boolean\n}\n\n/**\n * A Reka UI subcomponent of the control, which is a slot of the component: the behaviour binds\n * it to one of the component's slot properties, never to a layer found by name.\n */\nexport interface BehaviourPartContract {\n id: string\n required: boolean\n /**\n * Whether the slot holds the control's items, each an instance with its own behaviour (a\n * radio, a toggle, a collapsible), which the control turns on and off.\n */\n items?: boolean\n /**\n * The Reka UI part each child of the slot is, when the slot holds repeated parts: a tab list's\n * triggers, the tabs' content panels, or a group's items.\n */\n children?: string\n}\n\nexport interface BehaviourContract {\n values: BehaviourValueContract[]\n parts: BehaviourPartContract[]\n}\n\n/**\n * A text field or textarea: its text is a text property, and `filled`, when bound, draws the\n * empty field with its placeholder.\n */\nconst TEXT_INPUT: BehaviourContract = {\n values: [\n { id: 'value', type: 'text', required: true },\n { id: 'filled', type: 'boolean', required: false },\n { id: 'disabled', type: 'boolean', required: false }\n ],\n parts: []\n}\n\n/**\n * The behaviours Pairdraw knows, after Reka UI's primitives. Their states are drawn as the\n * component's variants and properties; their subcomponents (thumb, range, trigger, …) are the\n * component's slots, and the component itself is the control's root.\n */\nexport const BEHAVIOUR_CONTRACTS: Readonly<Record<BehaviourKind, BehaviourContract>> = {\n button: {\n values: [{ id: 'disabled', type: 'boolean', required: false }],\n parts: []\n },\n textField: TEXT_INPUT,\n textarea: TEXT_INPUT,\n numberField: {\n values: [\n { id: 'value', type: 'number', required: false },\n { id: 'text', type: 'text', required: true },\n { id: 'disabled', type: 'boolean', required: false }\n ],\n parts: [\n { id: 'increment', required: false },\n { id: 'decrement', required: false }\n ]\n },\n toggle: {\n values: [\n { id: 'value', type: 'boolean', required: true },\n { id: 'disabled', type: 'boolean', required: false }\n ],\n parts: []\n },\n switch: {\n values: [\n { id: 'value', type: 'boolean', required: true },\n { id: 'disabled', type: 'boolean', required: false }\n ],\n parts: [{ id: 'thumb', required: false }]\n },\n checkbox: {\n values: [\n { id: 'value', type: 'boolean', required: true },\n { id: 'disabled', type: 'boolean', required: false }\n ],\n parts: [{ id: 'indicator', required: false }]\n },\n radio: {\n values: [\n { id: 'value', type: 'boolean', required: true },\n { id: 'disabled', type: 'boolean', required: false }\n ],\n parts: [{ id: 'indicator', required: false }]\n },\n radioGroup: {\n values: [{ id: 'disabled', type: 'boolean', required: false }],\n parts: [{ id: 'items', required: true, items: true, children: 'item' }]\n },\n toggleGroup: {\n values: [{ id: 'disabled', type: 'boolean', required: false }],\n parts: [{ id: 'items', required: true, items: true, children: 'item' }]\n },\n slider: {\n values: [\n { id: 'value', type: 'number', required: false },\n { id: 'disabled', type: 'boolean', required: false }\n ],\n parts: [\n { id: 'track', required: true },\n { id: 'range', required: false },\n { id: 'thumb', required: true }\n ]\n },\n tabs: {\n values: [{ id: 'value', type: 'choice', required: false }],\n parts: [\n { id: 'list', required: true, children: 'trigger' },\n { id: 'panels', required: false, children: 'content' }\n ]\n },\n progress: {\n values: [{ id: 'value', type: 'number', required: false }],\n parts: [\n { id: 'track', required: true },\n { id: 'indicator', required: true }\n ]\n },\n collapsible: {\n values: [\n { id: 'open', type: 'boolean', required: false },\n { id: 'disabled', type: 'boolean', required: false }\n ],\n parts: [\n { id: 'trigger', required: true },\n { id: 'content', required: true }\n ]\n },\n accordion: {\n values: [{ id: 'disabled', type: 'boolean', required: false }],\n parts: [{ id: 'items', required: true, items: true, children: 'item' }]\n }\n}\n\nexport function behaviourContract(kind: BehaviourKind): BehaviourContract {\n return BEHAVIOUR_CONTRACTS[kind]\n}\n"],"mappings":";;AACA,MAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;AAQA,MAAa,qBAAqB;CAAC;CAAQ;CAAS;CAAW;CAAS;AAAU;;;;;AAgDlF,MAAM,aAAgC;CACpC,QAAQ;EACN;GAAE,IAAI;GAAS,MAAM;GAAQ,UAAU;EAAK;EAC5C;GAAE,IAAI;GAAU,MAAM;GAAW,UAAU;EAAM;EACjD;GAAE,IAAI;GAAY,MAAM;GAAW,UAAU;EAAM;CACrD;CACA,OAAO,CAAC;AACV;;;;;;AAOA,MAAa,sBAA0E;CACrF,QAAQ;EACN,QAAQ,CAAC;GAAE,IAAI;GAAY,MAAM;GAAW,UAAU;EAAM,CAAC;EAC7D,OAAO,CAAC;CACV;CACA,WAAW;CACX,UAAU;CACV,aAAa;EACX,QAAQ;GACN;IAAE,IAAI;IAAS,MAAM;IAAU,UAAU;GAAM;GAC/C;IAAE,IAAI;IAAQ,MAAM;IAAQ,UAAU;GAAK;GAC3C;IAAE,IAAI;IAAY,MAAM;IAAW,UAAU;GAAM;EACrD;EACA,OAAO,CACL;GAAE,IAAI;GAAa,UAAU;EAAM,GACnC;GAAE,IAAI;GAAa,UAAU;EAAM,CACrC;CACF;CACA,QAAQ;EACN,QAAQ,CACN;GAAE,IAAI;GAAS,MAAM;GAAW,UAAU;EAAK,GAC/C;GAAE,IAAI;GAAY,MAAM;GAAW,UAAU;EAAM,CACrD;EACA,OAAO,CAAC;CACV;CACA,QAAQ;EACN,QAAQ,CACN;GAAE,IAAI;GAAS,MAAM;GAAW,UAAU;EAAK,GAC/C;GAAE,IAAI;GAAY,MAAM;GAAW,UAAU;EAAM,CACrD;EACA,OAAO,CAAC;GAAE,IAAI;GAAS,UAAU;EAAM,CAAC;CAC1C;CACA,UAAU;EACR,QAAQ,CACN;GAAE,IAAI;GAAS,MAAM;GAAW,UAAU;EAAK,GAC/C;GAAE,IAAI;GAAY,MAAM;GAAW,UAAU;EAAM,CACrD;EACA,OAAO,CAAC;GAAE,IAAI;GAAa,UAAU;EAAM,CAAC;CAC9C;CACA,OAAO;EACL,QAAQ,CACN;GAAE,IAAI;GAAS,MAAM;GAAW,UAAU;EAAK,GAC/C;GAAE,IAAI;GAAY,MAAM;GAAW,UAAU;EAAM,CACrD;EACA,OAAO,CAAC;GAAE,IAAI;GAAa,UAAU;EAAM,CAAC;CAC9C;CACA,YAAY;EACV,QAAQ,CAAC;GAAE,IAAI;GAAY,MAAM;GAAW,UAAU;EAAM,CAAC;EAC7D,OAAO,CAAC;GAAE,IAAI;GAAS,UAAU;GAAM,OAAO;GAAM,UAAU;EAAO,CAAC;CACxE;CACA,aAAa;EACX,QAAQ,CAAC;GAAE,IAAI;GAAY,MAAM;GAAW,UAAU;EAAM,CAAC;EAC7D,OAAO,CAAC;GAAE,IAAI;GAAS,UAAU;GAAM,OAAO;GAAM,UAAU;EAAO,CAAC;CACxE;CACA,QAAQ;EACN,QAAQ,CACN;GAAE,IAAI;GAAS,MAAM;GAAU,UAAU;EAAM,GAC/C;GAAE,IAAI;GAAY,MAAM;GAAW,UAAU;EAAM,CACrD;EACA,OAAO;GACL;IAAE,IAAI;IAAS,UAAU;GAAK;GAC9B;IAAE,IAAI;IAAS,UAAU;GAAM;GAC/B;IAAE,IAAI;IAAS,UAAU;GAAK;EAChC;CACF;CACA,MAAM;EACJ,QAAQ,CAAC;GAAE,IAAI;GAAS,MAAM;GAAU,UAAU;EAAM,CAAC;EACzD,OAAO,CACL;GAAE,IAAI;GAAQ,UAAU;GAAM,UAAU;EAAU,GAClD;GAAE,IAAI;GAAU,UAAU;GAAO,UAAU;EAAU,CACvD;CACF;CACA,UAAU;EACR,QAAQ,CAAC;GAAE,IAAI;GAAS,MAAM;GAAU,UAAU;EAAM,CAAC;EACzD,OAAO,CACL;GAAE,IAAI;GAAS,UAAU;EAAK,GAC9B;GAAE,IAAI;GAAa,UAAU;EAAK,CACpC;CACF;CACA,aAAa;EACX,QAAQ,CACN;GAAE,IAAI;GAAQ,MAAM;GAAW,UAAU;EAAM,GAC/C;GAAE,IAAI;GAAY,MAAM;GAAW,UAAU;EAAM,CACrD;EACA,OAAO,CACL;GAAE,IAAI;GAAW,UAAU;EAAK,GAChC;GAAE,IAAI;GAAW,UAAU;EAAK,CAClC;CACF;CACA,WAAW;EACT,QAAQ,CAAC;GAAE,IAAI;GAAY,MAAM;GAAW,UAAU;EAAM,CAAC;EAC7D,OAAO,CAAC;GAAE,IAAI;GAAS,UAAU;GAAM,OAAO;GAAM,UAAU;EAAO,CAAC;CACxE;AACF;AAEA,SAAgB,kBAAkB,MAAwC;CACxE,OAAO,oBAAoB;AAC7B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SceneGraph } from "../graph.js";
|
|
2
|
+
import { SceneNode } from "../types.js";
|
|
3
|
+
//#region src/behaviours/layers.d.ts
|
|
4
|
+
/** Whether an instance's main component, or its set, has a behaviour. */
|
|
5
|
+
declare function hasBehaviour(graph: SceneGraph, node: SceneNode): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* A layer's path below a root: the names of the layers down to it, with the position among
|
|
8
|
+
* same-named siblings when names repeat. It stays the same when a variant switch rebuilds an
|
|
9
|
+
* instance's layers, so it identifies controls and keeps their DOM in place.
|
|
10
|
+
*/
|
|
11
|
+
declare function layerPath(graph: SceneGraph, rootId: string, nodeId: string): string;
|
|
12
|
+
/** The layer at `path` below a root, the inverse of `layerPath`. */
|
|
13
|
+
declare function findLayerByPath(graph: SceneGraph, rootId: string, path: string): SceneNode | undefined;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { findLayerByPath, hasBehaviour, layerPath };
|
|
16
|
+
//# sourceMappingURL=layers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layers.d.ts","names":[],"sources":["../../src/behaviours/layers.ts"],"mappings":";;;;iBAKgB,aAAa,OAAO,YAAY,MAAM;;;;;;iBAetC,UAAU,OAAO,YAAY,gBAAgB;;iBAgB7C,gBACd,OAAO,YACP,gBACA,eACC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { behaviourOwner, readBehaviour } from "./model.js";
|
|
2
|
+
//#region src/behaviours/layers.ts
|
|
3
|
+
/** Whether an instance's main component, or its set, has a behaviour. */
|
|
4
|
+
function hasBehaviour(graph, node) {
|
|
5
|
+
if (node.type !== "INSTANCE" || !node.componentId) return false;
|
|
6
|
+
const component = graph.getNode(node.componentId);
|
|
7
|
+
const owner = component && behaviourOwner(graph, component);
|
|
8
|
+
return !!owner && !!readBehaviour(owner);
|
|
9
|
+
}
|
|
10
|
+
/** A name as a path segment: `/` separates segments and `#` the twin index, so both are escaped. */
|
|
11
|
+
const pathName = (name) => name.replace(/[%/#]/g, (char) => encodeURIComponent(char));
|
|
12
|
+
/**
|
|
13
|
+
* A layer's path below a root: the names of the layers down to it, with the position among
|
|
14
|
+
* same-named siblings when names repeat. It stays the same when a variant switch rebuilds an
|
|
15
|
+
* instance's layers, so it identifies controls and keeps their DOM in place.
|
|
16
|
+
*/
|
|
17
|
+
function layerPath(graph, rootId, nodeId) {
|
|
18
|
+
const segments = [];
|
|
19
|
+
graph.closest(nodeId, (node) => {
|
|
20
|
+
if (node.id === rootId) return true;
|
|
21
|
+
const twins = node.parentId ? graph.getChildren(node.parentId).filter((child) => child.name === node.name) : [];
|
|
22
|
+
const index = twins.findIndex((child) => child.id === node.id);
|
|
23
|
+
segments.unshift(twins.length > 1 ? `${pathName(node.name)}#${index}` : pathName(node.name));
|
|
24
|
+
return false;
|
|
25
|
+
});
|
|
26
|
+
return segments.join("/");
|
|
27
|
+
}
|
|
28
|
+
/** The layer at `path` below a root, the inverse of `layerPath`. */
|
|
29
|
+
function findLayerByPath(graph, rootId, path) {
|
|
30
|
+
let current = graph.getNode(rootId);
|
|
31
|
+
for (const segment of path ? path.split("/") : []) {
|
|
32
|
+
if (!current) return void 0;
|
|
33
|
+
const hash = segment.lastIndexOf("#");
|
|
34
|
+
const name = hash === -1 ? segment : segment.slice(0, hash);
|
|
35
|
+
current = graph.getChildren(current.id).filter((child) => pathName(child.name) === name).at(hash === -1 ? 0 : Number(segment.slice(hash + 1)));
|
|
36
|
+
}
|
|
37
|
+
return current;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { findLayerByPath, hasBehaviour, layerPath };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=layers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layers.js","names":[],"sources":["../../src/behaviours/layers.ts"],"sourcesContent":["import type { SceneGraph } from '../graph'\nimport type { SceneNode } from '../types'\nimport { behaviourOwner, readBehaviour } from './model'\n\n/** Whether an instance's main component, or its set, has a behaviour. */\nexport function hasBehaviour(graph: SceneGraph, node: SceneNode): boolean {\n if (node.type !== 'INSTANCE' || !node.componentId) return false\n const component = graph.getNode(node.componentId)\n const owner = component && behaviourOwner(graph, component)\n return !!owner && !!readBehaviour(owner)\n}\n\n/** A name as a path segment: `/` separates segments and `#` the twin index, so both are escaped. */\nconst pathName = (name: string) => name.replace(/[%/#]/g, (char) => encodeURIComponent(char))\n\n/**\n * A layer's path below a root: the names of the layers down to it, with the position among\n * same-named siblings when names repeat. It stays the same when a variant switch rebuilds an\n * instance's layers, so it identifies controls and keeps their DOM in place.\n */\nexport function layerPath(graph: SceneGraph, rootId: string, nodeId: string): string {\n const segments: string[] = []\n // `closest` stops on a parent cycle in bad data, where a hand-written walk would not.\n graph.closest(nodeId, (node) => {\n if (node.id === rootId) return true\n const twins = node.parentId\n ? graph.getChildren(node.parentId).filter((child) => child.name === node.name)\n : []\n const index = twins.findIndex((child) => child.id === node.id)\n segments.unshift(twins.length > 1 ? `${pathName(node.name)}#${index}` : pathName(node.name))\n return false\n })\n return segments.join('/')\n}\n\n/** The layer at `path` below a root, the inverse of `layerPath`. */\nexport function findLayerByPath(\n graph: SceneGraph,\n rootId: string,\n path: string\n): SceneNode | undefined {\n let current = graph.getNode(rootId)\n for (const segment of path ? path.split('/') : []) {\n if (!current) return undefined\n const hash = segment.lastIndexOf('#')\n const name = hash === -1 ? segment : segment.slice(0, hash)\n const twins = graph.getChildren(current.id).filter((child) => pathName(child.name) === name)\n current = twins.at(hash === -1 ? 0 : Number(segment.slice(hash + 1)))\n }\n return current\n}\n"],"mappings":";;;AAKA,SAAgB,aAAa,OAAmB,MAA0B;CACxE,IAAI,KAAK,SAAS,cAAc,CAAC,KAAK,aAAa,OAAO;CAC1D,MAAM,YAAY,MAAM,QAAQ,KAAK,WAAW;CAChD,MAAM,QAAQ,aAAa,eAAe,OAAO,SAAS;CAC1D,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc,KAAK;AACzC;;AAGA,MAAM,YAAY,SAAiB,KAAK,QAAQ,WAAW,SAAS,mBAAmB,IAAI,CAAC;;;;;;AAO5F,SAAgB,UAAU,OAAmB,QAAgB,QAAwB;CACnF,MAAM,WAAqB,CAAC;CAE5B,MAAM,QAAQ,SAAS,SAAS;EAC9B,IAAI,KAAK,OAAO,QAAQ,OAAO;EAC/B,MAAM,QAAQ,KAAK,WACf,MAAM,YAAY,KAAK,QAAQ,CAAC,CAAC,QAAQ,UAAU,MAAM,SAAS,KAAK,IAAI,IAC3E,CAAC;EACL,MAAM,QAAQ,MAAM,WAAW,UAAU,MAAM,OAAO,KAAK,EAAE;EAC7D,SAAS,QAAQ,MAAM,SAAS,IAAI,GAAG,SAAS,KAAK,IAAI,EAAE,GAAG,UAAU,SAAS,KAAK,IAAI,CAAC;EAC3F,OAAO;CACT,CAAC;CACD,OAAO,SAAS,KAAK,GAAG;AAC1B;;AAGA,SAAgB,gBACd,OACA,QACA,MACuB;CACvB,IAAI,UAAU,MAAM,QAAQ,MAAM;CAClC,KAAK,MAAM,WAAW,OAAO,KAAK,MAAM,GAAG,IAAI,CAAC,GAAG;EACjD,IAAI,CAAC,SAAS,OAAO,KAAA;EACrB,MAAM,OAAO,QAAQ,YAAY,GAAG;EACpC,MAAM,OAAO,SAAS,KAAK,UAAU,QAAQ,MAAM,GAAG,IAAI;EAE1D,UADc,MAAM,YAAY,QAAQ,EAAE,CAAC,CAAC,QAAQ,UAAU,SAAS,MAAM,IAAI,MAAM,IACzE,CAAC,CAAC,GAAG,SAAS,KAAK,IAAI,OAAO,QAAQ,MAAM,OAAO,CAAC,CAAC,CAAC;CACtE;CACA,OAAO;AACT"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { SceneGraph } from "../graph.js";
|
|
2
|
+
import { ComponentPropertyDefinition, SceneNode } from "../types.js";
|
|
3
|
+
import { BehaviourKind } from "./kinds.js";
|
|
4
|
+
import { Behaviour, BehaviourBooleanBinding, BehaviourInteractionStates, BehaviourNumberSettings } from "./schema.js";
|
|
5
|
+
//#region src/behaviours/model.d.ts
|
|
6
|
+
declare const DEFAULT_NUMBER_SETTINGS: BehaviourNumberSettings;
|
|
7
|
+
/** A boolean value's binding, if the behaviour has one. */
|
|
8
|
+
declare function booleanBinding(behaviour: Behaviour, valueId: string): BehaviourBooleanBinding | undefined;
|
|
9
|
+
/** The slot property a part is bound to, if any. */
|
|
10
|
+
declare function partBinding(behaviour: Behaviour, partId: string): string | undefined;
|
|
11
|
+
/** The text property a text value is bound to, if any. */
|
|
12
|
+
declare function textBinding(behaviour: Behaviour, valueId: string): string | undefined;
|
|
13
|
+
/** A number value's range, if the behaviour has one. */
|
|
14
|
+
declare function numberSettings(behaviour: Behaviour, valueId: string): BehaviourNumberSettings | undefined;
|
|
15
|
+
/** A new behaviour of a kind, its number values at their defaults and nothing bound. */
|
|
16
|
+
declare function emptyBehaviour(kind: BehaviourKind): Behaviour;
|
|
17
|
+
/**
|
|
18
|
+
* The node that keeps the behaviour: a component set for its variants, otherwise the main
|
|
19
|
+
* component itself.
|
|
20
|
+
*/
|
|
21
|
+
declare function behaviourOwner(graph: SceneGraph, node: SceneNode): SceneNode | undefined;
|
|
22
|
+
/** The behaviour a component or component set keeps, or null when it has none or it is unreadable. */
|
|
23
|
+
declare function readBehaviour(owner: SceneNode): Behaviour | null;
|
|
24
|
+
/** The owner's plugin data with the behaviour set, or removed when null. */
|
|
25
|
+
declare function withBehaviour(owner: SceneNode, behaviour: Behaviour | null): SceneNode['pluginData'];
|
|
26
|
+
/** Component properties the behaviour can bind to: the owner's, and a set's variants' own. */
|
|
27
|
+
declare function behaviourProperties(graph: SceneGraph, owner: SceneNode): ComponentPropertyDefinition[];
|
|
28
|
+
/**
|
|
29
|
+
* Required values and parts that are unbound, or bound to a property the component no longer
|
|
30
|
+
* has, by value or part id; `states` when the interaction states lost their variant property.
|
|
31
|
+
*/
|
|
32
|
+
declare function missingBindings(graph: SceneGraph, owner: SceneNode, behaviour: Behaviour): string[];
|
|
33
|
+
/**
|
|
34
|
+
* Interaction states for a variant property, each mapped to the value whose name means it, such
|
|
35
|
+
* as `Hover` or `Pressed`; states without such a value are left unset.
|
|
36
|
+
*/
|
|
37
|
+
declare function guessInteractionStates(propertyId: string, values: readonly string[]): BehaviourInteractionStates;
|
|
38
|
+
/**
|
|
39
|
+
* The behaviour with every component property id it binds renamed by `rename`, for formats that
|
|
40
|
+
* give properties new ids on write, such as `.fig` with its GUIDs.
|
|
41
|
+
*/
|
|
42
|
+
declare function renameBehaviourProperties(behaviour: Behaviour, rename: (propertyId: string) => string): Behaviour;
|
|
43
|
+
//#endregion
|
|
44
|
+
export { DEFAULT_NUMBER_SETTINGS, behaviourOwner, behaviourProperties, booleanBinding, emptyBehaviour, guessInteractionStates, missingBindings, numberSettings, partBinding, readBehaviour, renameBehaviourProperties, textBinding, withBehaviour };
|
|
45
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","names":[],"sources":["../../src/behaviours/model.ts"],"mappings":";;;;;cAmBa,yBAAyB;;iBAQtB,eACd,WAAW,WACX,kBACC;;iBAKa,YAAY,WAAW,WAAW;;iBAKlC,YAAY,WAAW,WAAW;;iBAKlC,eACd,WAAW,WACX,kBACC;;iBAKa,eAAe,MAAM,gBAAgB;;;;;iBAcrC,eAAe,OAAO,YAAY,MAAM,YAAY;;iBAQpD,cAAc,OAAO,YAAY;;iBAKjC,cACd,OAAO,WACP,WAAW,mBACV;;iBAKa,oBACd,OAAO,YACP,OAAO,YACN;;;;;iBAiBa,gBACd,OAAO,YACP,OAAO,WACP,WAAW;;;;;iBAwCG,uBACd,oBACA,4BACC;;;;;iBAaa,0BACd,WAAW,WACX,SAAS,gCACR"}
|