@open-pencil/scene-graph 0.17.0 → 0.18.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arrow-caps.d.ts +14 -17
- package/dist/arrow-caps.d.ts.map +1 -1
- package/dist/arrow-caps.js +1 -2
- package/dist/asset-keys.d.ts +5 -8
- package/dist/asset-keys.d.ts.map +1 -1
- package/dist/asset-keys.js +2 -3
- package/dist/behaviours/index.d.ts +6 -4
- package/dist/behaviours/index.js +6 -4
- package/dist/behaviours/kinds.d.ts +38 -15
- package/dist/behaviours/kinds.d.ts.map +1 -1
- package/dist/behaviours/kinds.js +134 -12
- package/dist/behaviours/kinds.js.map +1 -1
- package/dist/behaviours/layers.d.ts +3 -6
- package/dist/behaviours/layers.d.ts.map +1 -1
- package/dist/behaviours/layers.js +1 -2
- package/dist/behaviours/listing.d.ts +58 -0
- package/dist/behaviours/listing.d.ts.map +1 -0
- package/dist/behaviours/listing.js +98 -0
- package/dist/behaviours/listing.js.map +1 -0
- package/dist/behaviours/model.d.ts +19 -16
- package/dist/behaviours/model.d.ts.map +1 -1
- package/dist/behaviours/model.js +14 -6
- package/dist/behaviours/model.js.map +1 -1
- package/dist/behaviours/schema.d.ts +150 -17
- package/dist/behaviours/schema.d.ts.map +1 -1
- package/dist/behaviours/schema.js +19 -5
- package/dist/behaviours/schema.js.map +1 -1
- package/dist/behaviours/spec.d.ts +3 -6
- package/dist/behaviours/spec.d.ts.map +1 -1
- package/dist/behaviours/spec.js +7 -4
- package/dist/behaviours/spec.js.map +1 -1
- package/dist/behaviours/transition.d.ts +20 -0
- package/dist/behaviours/transition.d.ts.map +1 -0
- package/dist/behaviours/transition.js +35 -0
- package/dist/behaviours/transition.js.map +1 -0
- package/dist/bindings.js +2 -3
- package/dist/blur.d.ts +35 -0
- package/dist/blur.d.ts.map +1 -0
- package/dist/blur.js +69 -0
- package/dist/blur.js.map +1 -0
- package/dist/buffered-events.d.ts +3 -6
- package/dist/buffered-events.d.ts.map +1 -1
- package/dist/buffered-events.js +1 -2
- package/dist/buffered-events.js.map +1 -1
- package/dist/checkpoint.d.ts +3 -6
- package/dist/checkpoint.d.ts.map +1 -1
- package/dist/checkpoint.js +4 -3
- package/dist/checkpoint.js.map +1 -1
- package/dist/clipping.d.ts +4 -7
- package/dist/clipping.d.ts.map +1 -1
- package/dist/clipping.js +4 -16
- package/dist/clipping.js.map +1 -1
- package/dist/color/contrast.d.ts +4 -7
- package/dist/color/contrast.d.ts.map +1 -1
- package/dist/color/contrast.js +2 -3
- package/dist/color/index.d.ts +21 -20
- package/dist/color/index.d.ts.map +1 -1
- package/dist/color/index.js +16 -27
- package/dist/color/index.js.map +1 -1
- package/dist/color/management.d.ts +50 -25
- package/dist/color/management.d.ts.map +1 -1
- package/dist/color/management.js +155 -151
- package/dist/color/management.js.map +1 -1
- package/dist/color/normalize.d.ts +1 -4
- package/dist/color/normalize.d.ts.map +1 -1
- package/dist/color/normalize.js +1 -2
- package/dist/color/okhcl.d.ts +36 -21
- package/dist/color/okhcl.d.ts.map +1 -1
- package/dist/color/okhcl.js +57 -42
- package/dist/color/okhcl.js.map +1 -1
- package/dist/color/schema.d.ts +6 -4
- package/dist/color/schema.d.ts.map +1 -1
- package/dist/color/schema.js +12 -4
- package/dist/color/schema.js.map +1 -1
- package/dist/comments/document.d.ts +3 -6
- package/dist/comments/document.d.ts.map +1 -1
- package/dist/comments/document.js +1 -2
- package/dist/comments/index.js +2 -2
- package/dist/comments/list.d.ts +5 -8
- package/dist/comments/list.d.ts.map +1 -1
- package/dist/comments/list.js +1 -2
- package/dist/comments/merge.d.ts +2 -5
- package/dist/comments/merge.d.ts.map +1 -1
- package/dist/comments/merge.js +1 -2
- package/dist/comments/schema.d.ts +2 -5
- package/dist/comments/schema.d.ts.map +1 -1
- package/dist/comments/schema.js +1 -2
- package/dist/comments/threads.d.ts +16 -19
- package/dist/comments/threads.d.ts.map +1 -1
- package/dist/comments/threads.js +8 -3
- package/dist/comments/threads.js.map +1 -1
- package/dist/components/exposure.d.ts +4 -7
- package/dist/components/exposure.d.ts.map +1 -1
- package/dist/components/exposure.js +1 -2
- package/dist/components/properties.d.ts +13 -16
- package/dist/components/properties.d.ts.map +1 -1
- package/dist/components/properties.js +3 -4
- package/dist/components/variants.d.ts +5 -8
- package/dist/components/variants.d.ts.map +1 -1
- package/dist/components/variants.js +1 -2
- package/dist/connectors/controls.d.ts +6 -9
- package/dist/connectors/controls.d.ts.map +1 -1
- package/dist/connectors/controls.js +2 -3
- package/dist/connectors/create.d.ts +3 -6
- package/dist/connectors/create.d.ts.map +1 -1
- package/dist/connectors/create.js +2 -3
- package/dist/connectors/elbow.js +0 -1
- package/dist/connectors/gaps.d.ts +1 -4
- package/dist/connectors/gaps.d.ts.map +1 -1
- package/dist/connectors/gaps.js +1 -2
- package/dist/connectors/hit.d.ts +1 -4
- package/dist/connectors/hit.d.ts.map +1 -1
- package/dist/connectors/hit.js +3 -4
- package/dist/connectors/index.d.ts +3 -3
- package/dist/connectors/index.js +6 -6
- package/dist/connectors/label.d.ts +4 -7
- package/dist/connectors/label.d.ts.map +1 -1
- package/dist/connectors/label.js +1 -2
- package/dist/connectors/layout.d.ts +8 -10
- package/dist/connectors/layout.d.ts.map +1 -1
- package/dist/connectors/layout.js +12 -10
- package/dist/connectors/layout.js.map +1 -1
- package/dist/connectors/pieces.d.ts +2 -5
- package/dist/connectors/pieces.d.ts.map +1 -1
- package/dist/connectors/pieces.js +3 -4
- package/dist/connectors/pieces.js.map +1 -1
- package/dist/connectors/route.d.ts +2 -5
- package/dist/connectors/route.d.ts.map +1 -1
- package/dist/connectors/route.js +4 -5
- package/dist/connectors/sides.d.ts +3 -6
- package/dist/connectors/sides.d.ts.map +1 -1
- package/dist/connectors/sides.js +2 -3
- package/dist/connectors/sublayers.d.ts +21 -24
- package/dist/connectors/sublayers.d.ts.map +1 -1
- package/dist/connectors/sublayers.js +3 -3
- package/dist/connectors/sublayers.js.map +1 -1
- package/dist/constants.d.ts +13 -16
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -2
- package/dist/constraints.d.ts +6 -8
- package/dist/constraints.d.ts.map +1 -1
- package/dist/constraints.js +3 -3
- package/dist/constraints.js.map +1 -1
- package/dist/coordinate.d.ts +27 -29
- package/dist/coordinate.d.ts.map +1 -1
- package/dist/coordinate.js +19 -38
- package/dist/coordinate.js.map +1 -1
- package/dist/copy.d.ts +36 -24
- package/dist/copy.d.ts.map +1 -1
- package/dist/copy.js +33 -4
- package/dist/copy.js.map +1 -1
- package/dist/corners.d.ts +9 -9
- package/dist/corners.d.ts.map +1 -1
- package/dist/corners.js +4 -3
- package/dist/corners.js.map +1 -1
- package/dist/css/blend.d.ts +1 -4
- package/dist/css/blend.d.ts.map +1 -1
- package/dist/css/blend.js +1 -2
- package/dist/css/grid.d.ts +1 -4
- package/dist/css/grid.d.ts.map +1 -1
- package/dist/css/grid.js +3 -4
- package/dist/css/index.d.ts +2 -1
- package/dist/css/index.js +3 -2
- package/dist/css/layout.d.ts +7 -10
- package/dist/css/layout.d.ts.map +1 -1
- package/dist/css/layout.js +2 -3
- package/dist/css/motion.d.ts +9 -0
- package/dist/css/motion.d.ts.map +1 -0
- package/dist/css/motion.js +59 -0
- package/dist/css/motion.js.map +1 -0
- package/dist/css/shadows.d.ts +4 -6
- package/dist/css/shadows.d.ts.map +1 -1
- package/dist/css/shadows.js +9 -9
- package/dist/css/shadows.js.map +1 -1
- package/dist/css/text.d.ts +8 -11
- package/dist/css/text.d.ts.map +1 -1
- package/dist/css/text.js +1 -2
- package/dist/css/transform.d.ts +6 -9
- package/dist/css/transform.d.ts.map +1 -1
- package/dist/css/transform.js +2 -3
- package/dist/css/values.d.ts +11 -13
- package/dist/css/values.d.ts.map +1 -1
- package/dist/css/values.js +5 -6
- package/dist/css/values.js.map +1 -1
- package/dist/cubic.d.ts +11 -5
- package/dist/cubic.d.ts.map +1 -1
- package/dist/cubic.js +71 -3
- package/dist/cubic.js.map +1 -1
- package/dist/events.js +1 -2
- package/dist/export-format.d.ts +5 -8
- package/dist/export-format.d.ts.map +1 -1
- package/dist/export-format.js +4 -3
- package/dist/export-format.js.map +1 -1
- package/dist/export-scale.d.ts +4 -7
- package/dist/export-scale.d.ts.map +1 -1
- package/dist/export-scale.js +1 -2
- package/dist/fields/appearance.d.ts +3 -6
- package/dist/fields/appearance.d.ts.map +1 -1
- package/dist/fields/appearance.js +1 -2
- package/dist/fields/geometry.d.ts +2 -5
- package/dist/fields/geometry.d.ts.map +1 -1
- package/dist/fields/geometry.js +1 -2
- package/dist/fields/index.d.ts +2 -2
- package/dist/fields/index.js +3 -3
- package/dist/fields/layout.d.ts +5 -6
- package/dist/fields/layout.d.ts.map +1 -1
- package/dist/fields/layout.js +10 -3
- package/dist/fields/layout.js.map +1 -1
- package/dist/fields/text.d.ts +5 -8
- package/dist/fields/text.d.ts.map +1 -1
- package/dist/fields/text.js +1 -2
- package/dist/fig-compression.d.ts +3 -6
- package/dist/fig-compression.d.ts.map +1 -1
- package/dist/fig-compression.js +1 -2
- package/dist/figjam/index.js +1 -1
- package/dist/figjam/palette.d.ts +21 -23
- package/dist/figjam/palette.d.ts.map +1 -1
- package/dist/figjam/palette.js +3 -4
- package/dist/figjam/text.d.ts +10 -13
- package/dist/figjam/text.d.ts.map +1 -1
- package/dist/figjam/text.js +1 -2
- package/dist/font-style.d.ts +18 -18
- package/dist/font-style.d.ts.map +1 -1
- package/dist/font-style.js +12 -8
- package/dist/font-style.js.map +1 -1
- package/dist/generated/index.d.ts +35 -15
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/generated/index.js +50 -12
- package/dist/generated/index.js.map +1 -1
- package/dist/generated/kind.d.ts +17 -6
- package/dist/generated/kind.d.ts.map +1 -1
- package/dist/generated/shape-with-text.d.ts +10 -13
- package/dist/generated/shape-with-text.d.ts.map +1 -1
- package/dist/generated/shape-with-text.js +3 -3
- package/dist/generated/shape-with-text.js.map +1 -1
- package/dist/generated/spec.d.ts +45 -0
- package/dist/generated/spec.d.ts.map +1 -0
- package/dist/generated/spec.js +281 -0
- package/dist/generated/spec.js.map +1 -0
- package/dist/generated/sticky.d.ts +23 -26
- package/dist/generated/sticky.d.ts.map +1 -1
- package/dist/generated/sticky.js +4 -4
- package/dist/generated/sticky.js.map +1 -1
- package/dist/geometry.d.ts +47 -68
- package/dist/geometry.d.ts.map +1 -1
- package/dist/geometry.js +53 -77
- package/dist/geometry.js.map +1 -1
- package/dist/gradient.d.ts +15 -18
- package/dist/gradient.d.ts.map +1 -1
- package/dist/gradient.js +1 -2
- package/dist/graph.d.ts +33 -11
- package/dist/graph.d.ts.map +1 -1
- package/dist/graph.js +85 -28
- package/dist/graph.js.map +1 -1
- package/dist/group-bounds.d.ts +15 -14
- package/dist/group-bounds.d.ts.map +1 -1
- package/dist/group-bounds.js +41 -12
- package/dist/group-bounds.js.map +1 -1
- package/dist/guides.d.ts +5 -8
- package/dist/guides.d.ts.map +1 -1
- package/dist/guides.js +2 -3
- package/dist/hit-test.d.ts +20 -12
- package/dist/hit-test.d.ts.map +1 -1
- package/dist/hit-test.js +69 -38
- package/dist/hit-test.js.map +1 -1
- package/dist/icons/fit.d.ts +2 -4
- package/dist/icons/fit.d.ts.map +1 -1
- package/dist/icons/fit.js +1 -2
- package/dist/icons/glyph.d.ts +3 -5
- package/dist/icons/glyph.d.ts.map +1 -1
- package/dist/icons/glyph.js +3 -4
- package/dist/icons/index.d.ts +1 -1
- package/dist/icons/index.js +2 -2
- package/dist/icons/model.d.ts +8 -11
- package/dist/icons/model.d.ts.map +1 -1
- package/dist/icons/model.js +1 -2
- package/dist/icons/schema.d.ts +8 -11
- package/dist/icons/schema.d.ts.map +1 -1
- package/dist/icons/schema.js +1 -2
- package/dist/ids.d.ts +2 -5
- package/dist/ids.d.ts.map +1 -1
- package/dist/ids.js +3 -4
- package/dist/images.d.ts +20 -21
- package/dist/images.d.ts.map +1 -1
- package/dist/images.js +7 -6
- package/dist/images.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/instances/assignments.js +1 -2
- package/dist/instances/content-marks.js +98 -0
- package/dist/instances/content-marks.js.map +1 -0
- package/dist/instances/content-size.js +2 -3
- package/dist/instances/copies.js +2 -3
- package/dist/instances/cycles.d.ts +3 -6
- package/dist/instances/cycles.d.ts.map +1 -1
- package/dist/instances/cycles.js +1 -2
- package/dist/instances/deleted.d.ts +23 -0
- package/dist/instances/deleted.d.ts.map +1 -0
- package/dist/instances/deleted.js +82 -0
- package/dist/instances/deleted.js.map +1 -0
- package/dist/instances/fields.d.ts +5 -8
- package/dist/instances/fields.d.ts.map +1 -1
- package/dist/instances/fields.js +11 -7
- package/dist/instances/fields.js.map +1 -1
- package/dist/instances/index.d.ts +21 -20
- package/dist/instances/index.d.ts.map +1 -1
- package/dist/instances/index.js +116 -20
- package/dist/instances/index.js.map +1 -1
- package/dist/instances/kept-overrides.js +4 -5
- package/dist/instances/lookup.d.ts +17 -0
- package/dist/instances/lookup.d.ts.map +1 -0
- package/dist/instances/lookup.js +48 -0
- package/dist/instances/lookup.js.map +1 -0
- package/dist/instances/main-component.d.ts +2 -5
- package/dist/instances/main-component.d.ts.map +1 -1
- package/dist/instances/main-component.js +1 -2
- package/dist/instances/matching.js +1 -2
- package/dist/instances/overrides.d.ts +23 -26
- package/dist/instances/overrides.d.ts.map +1 -1
- package/dist/instances/overrides.js +1 -2
- package/dist/instances/placement.js +3 -4
- package/dist/instances/protection.js +3 -4
- package/dist/instances/source-walk.js +1 -2
- package/dist/instances/swap.js +7 -8
- package/dist/instances/sync.js +91 -18
- package/dist/instances/sync.js.map +1 -1
- package/dist/instances/vector-geometry.js +2 -3
- package/dist/layout/aspect-ratio.d.ts +7 -9
- package/dist/layout/aspect-ratio.d.ts.map +1 -1
- package/dist/layout/aspect-ratio.js +1 -2
- package/dist/layout/flow.d.ts +13 -0
- package/dist/layout/flow.d.ts.map +1 -0
- package/dist/layout/flow.js +35 -0
- package/dist/layout/flow.js.map +1 -0
- package/dist/layout/guides.d.ts +13 -16
- package/dist/layout/guides.d.ts.map +1 -1
- package/dist/layout/guides.js +4 -5
- package/dist/layout/guides.js.map +1 -1
- package/dist/layout/index.d.ts +6 -4
- package/dist/layout/index.js +7 -5
- package/dist/layout/keywords.d.ts +7 -9
- package/dist/layout/keywords.d.ts.map +1 -1
- package/dist/layout/keywords.js +8 -3
- package/dist/layout/keywords.js.map +1 -1
- package/dist/layout/limits.d.ts +13 -16
- package/dist/layout/limits.d.ts.map +1 -1
- package/dist/layout/limits.js +1 -2
- package/dist/layout/sizing.d.ts +18 -12
- package/dist/layout/sizing.d.ts.map +1 -1
- package/dist/layout/sizing.js +18 -3
- package/dist/layout/sizing.js.map +1 -1
- package/dist/layout/spacing.d.ts +7 -4
- package/dist/layout/spacing.d.ts.map +1 -1
- package/dist/layout/spacing.js +11 -3
- package/dist/layout/spacing.js.map +1 -1
- package/dist/layout/stacking.d.ts +8 -0
- package/dist/layout/stacking.d.ts.map +1 -0
- package/dist/layout/stacking.js +12 -0
- package/dist/layout/stacking.js.map +1 -0
- package/dist/layout/strokes.d.ts +1 -4
- package/dist/layout/strokes.d.ts.map +1 -1
- package/dist/layout/strokes.js +1 -2
- package/dist/layout/writes.js +1 -2
- package/dist/layout/writes.js.map +1 -1
- package/dist/masks.d.ts +4 -7
- package/dist/masks.d.ts.map +1 -1
- package/dist/masks.js +1 -2
- package/dist/matrix.d.ts +3 -4
- package/dist/matrix.d.ts.map +1 -1
- package/dist/matrix.js +11 -3
- package/dist/matrix.js.map +1 -1
- package/dist/mesh/geometry.d.ts +80 -0
- package/dist/mesh/geometry.d.ts.map +1 -0
- package/dist/mesh/geometry.js +430 -0
- package/dist/mesh/geometry.js.map +1 -0
- package/dist/mesh/index.d.ts +4 -0
- package/dist/mesh/index.js +4 -0
- package/dist/mesh/model.d.ts +25 -0
- package/dist/mesh/model.d.ts.map +1 -0
- package/dist/mesh/model.js +39 -0
- package/dist/mesh/model.js.map +1 -0
- package/dist/mesh/schema.d.ts +188 -0
- package/dist/mesh/schema.d.ts.map +1 -0
- package/dist/mesh/schema.js +55 -0
- package/dist/mesh/schema.js.map +1 -0
- package/dist/motion/apply.d.ts +42 -0
- package/dist/motion/apply.d.ts.map +1 -0
- package/dist/motion/apply.js +98 -0
- package/dist/motion/apply.js.map +1 -0
- package/dist/motion/edit.d.ts +53 -0
- package/dist/motion/edit.d.ts.map +1 -0
- package/dist/motion/edit.js +125 -0
- package/dist/motion/edit.js.map +1 -0
- package/dist/motion/effects.js +86 -0
- package/dist/motion/effects.js.map +1 -0
- package/dist/motion/evaluate.d.ts +33 -0
- package/dist/motion/evaluate.d.ts.map +1 -0
- package/dist/motion/evaluate.js +160 -0
- package/dist/motion/evaluate.js.map +1 -0
- package/dist/motion/fields.d.ts +69 -0
- package/dist/motion/fields.d.ts.map +1 -0
- package/dist/motion/fields.js +132 -0
- package/dist/motion/fields.js.map +1 -0
- package/dist/motion/index.d.ts +16 -0
- package/dist/motion/index.js +15 -0
- package/dist/motion/keyable.d.ts +32 -0
- package/dist/motion/keyable.d.ts.map +1 -0
- package/dist/motion/keyable.js +120 -0
- package/dist/motion/keyable.js.map +1 -0
- package/dist/motion/outline.d.ts +35 -0
- package/dist/motion/outline.d.ts.map +1 -0
- package/dist/motion/outline.js +59 -0
- package/dist/motion/outline.js.map +1 -0
- package/dist/motion/presets/index.d.ts +20 -0
- package/dist/motion/presets/index.d.ts.map +1 -0
- package/dist/motion/presets/index.js +166 -0
- package/dist/motion/presets/index.js.map +1 -0
- package/dist/motion/presets/settings.d.ts +43 -0
- package/dist/motion/presets/settings.d.ts.map +1 -0
- package/dist/motion/presets/settings.js +254 -0
- package/dist/motion/presets/settings.js.map +1 -0
- package/dist/motion/presets/stagger.d.ts +69 -0
- package/dist/motion/presets/stagger.d.ts.map +1 -0
- package/dist/motion/presets/stagger.js +185 -0
- package/dist/motion/presets/stagger.js.map +1 -0
- package/dist/motion/schema.d.ts +185 -0
- package/dist/motion/schema.d.ts.map +1 -0
- package/dist/motion/schema.js +62 -0
- package/dist/motion/schema.js.map +1 -0
- package/dist/motion/segment.d.ts +25 -0
- package/dist/motion/segment.d.ts.map +1 -0
- package/dist/motion/segment.js +73 -0
- package/dist/motion/segment.js.map +1 -0
- package/dist/motion/spec.d.ts +26 -0
- package/dist/motion/spec.d.ts.map +1 -0
- package/dist/motion/spec.js +175 -0
- package/dist/motion/spec.js.map +1 -0
- package/dist/motion/timeline.d.ts +16 -0
- package/dist/motion/timeline.d.ts.map +1 -0
- package/dist/motion/timeline.js +53 -0
- package/dist/motion/timeline.js.map +1 -0
- package/dist/motion/types.d.ts +49 -0
- package/dist/motion/types.d.ts.map +1 -0
- package/dist/motion/variables.d.ts +9 -0
- package/dist/motion/variables.d.ts.map +1 -0
- package/dist/motion/variables.js +25 -0
- package/dist/motion/variables.js.map +1 -0
- package/dist/mutation-impact.d.ts +9 -10
- package/dist/mutation-impact.d.ts.map +1 -1
- package/dist/mutation-impact.js +19 -9
- package/dist/mutation-impact.js.map +1 -1
- package/dist/node-defaults.d.ts +15 -14
- package/dist/node-defaults.d.ts.map +1 -1
- package/dist/node-defaults.js +153 -55
- package/dist/node-defaults.js.map +1 -1
- package/dist/order-keys.d.ts +8 -9
- package/dist/order-keys.d.ts.map +1 -1
- package/dist/order-keys.js +10 -2
- package/dist/order-keys.js.map +1 -1
- package/dist/outline/flatten.d.ts +3 -6
- package/dist/outline/flatten.d.ts.map +1 -1
- package/dist/outline/flatten.js +3 -4
- package/dist/outline/heads.js +1 -2
- package/dist/outline/hit.d.ts +2 -5
- package/dist/outline/hit.d.ts.map +1 -1
- package/dist/outline/hit.js +5 -6
- package/dist/outline/index.js +3 -3
- package/dist/outline/point.d.ts +4 -7
- package/dist/outline/point.d.ts.map +1 -1
- package/dist/outline/point.js +2 -3
- package/dist/outline/shapes.d.ts +4 -7
- package/dist/outline/shapes.d.ts.map +1 -1
- package/dist/outline/shapes.js +2 -3
- package/dist/paints/index.d.ts +5 -3
- package/dist/paints/index.js +5 -3
- package/dist/paints/pattern.d.ts +6 -5
- package/dist/paints/pattern.d.ts.map +1 -1
- package/dist/paints/pattern.js +34 -3
- package/dist/paints/pattern.js.map +1 -1
- package/dist/paints/schema.d.ts +4 -7
- package/dist/paints/schema.d.ts.map +1 -1
- package/dist/paints/schema.js +3 -4
- package/dist/paints/shows.d.ts +4 -4
- package/dist/paints/shows.d.ts.map +1 -1
- package/dist/paints/shows.js +9 -3
- package/dist/paints/shows.js.map +1 -1
- package/dist/paints/solid.d.ts +8 -0
- package/dist/paints/solid.d.ts.map +1 -0
- package/dist/paints/solid.js +17 -0
- package/dist/paints/solid.js.map +1 -0
- package/dist/paints/stills.d.ts +74 -0
- package/dist/paints/stills.d.ts.map +1 -0
- package/dist/paints/stills.js +117 -0
- package/dist/paints/stills.js.map +1 -0
- package/dist/parse-path.d.ts +12 -9
- package/dist/parse-path.d.ts.map +1 -1
- package/dist/parse-path.js +13 -3
- package/dist/parse-path.js.map +1 -1
- package/dist/paths/arc.d.ts +6 -9
- package/dist/paths/arc.d.ts.map +1 -1
- package/dist/paths/arc.js +1 -2
- package/dist/paths/index.d.ts +1 -1
- package/dist/paths/index.js +1 -1
- package/dist/paths/network.d.ts +13 -16
- package/dist/paths/network.d.ts.map +1 -1
- package/dist/paths/network.js +1 -2
- package/dist/paths/sink.d.ts +5 -8
- package/dist/paths/sink.d.ts.map +1 -1
- package/dist/paths/sink.js +1 -2
- package/dist/paths/smooth-corners.d.ts +3 -6
- package/dist/paths/smooth-corners.d.ts.map +1 -1
- package/dist/paths/smooth-corners.js +1 -2
- package/dist/plugin-data/field.d.ts +15 -18
- package/dist/plugin-data/field.d.ts.map +1 -1
- package/dist/plugin-data/field.js +3 -2
- package/dist/plugin-data/field.js.map +1 -1
- package/dist/plugin-data/fields.d.ts +104 -11
- package/dist/plugin-data/fields.d.ts.map +1 -1
- package/dist/plugin-data/fields.js +43 -13
- package/dist/plugin-data/fields.js.map +1 -1
- package/dist/plugin-data/index.d.ts +2 -2
- package/dist/plugin-data/index.js +2 -2
- package/dist/polygon.d.ts +8 -8
- package/dist/polygon.d.ts.map +1 -1
- package/dist/polygon.js +7 -7
- package/dist/polygon.js.map +1 -1
- package/dist/preview.d.ts +3 -5
- package/dist/preview.d.ts.map +1 -1
- package/dist/preview.js +2 -3
- package/dist/primitives/index.d.ts +7 -9
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +1 -2
- package/dist/primitives/schema.d.ts +3 -6
- package/dist/primitives/schema.d.ts.map +1 -1
- package/dist/primitives/schema.js +1 -2
- package/dist/resize.d.ts +19 -14
- package/dist/resize.d.ts.map +1 -1
- package/dist/resize.js +38 -8
- package/dist/resize.js.map +1 -1
- package/dist/scaling/index.d.ts +2 -2
- package/dist/scaling/index.js +2 -2
- package/dist/scaling/node.d.ts +2 -4
- package/dist/scaling/node.d.ts.map +1 -1
- package/dist/scaling/node.js +30 -11
- package/dist/scaling/node.js.map +1 -1
- package/dist/scaling/snapshot.d.ts +5 -8
- package/dist/scaling/snapshot.d.ts.map +1 -1
- package/dist/scaling/snapshot.js +1 -2
- package/dist/scaling/tree.d.ts +6 -9
- package/dist/scaling/tree.d.ts.map +1 -1
- package/dist/scaling/tree.js +2 -3
- package/dist/shaders/index.d.ts +2 -3
- package/dist/shaders/index.js +2 -3
- package/dist/shaders/model.d.ts +54 -21
- package/dist/shaders/model.d.ts.map +1 -1
- package/dist/shaders/model.js +103 -35
- package/dist/shaders/model.js.map +1 -1
- package/dist/shaders/schema.d.ts +16 -9
- package/dist/shaders/schema.d.ts.map +1 -1
- package/dist/shaders/schema.js +12 -3
- package/dist/shaders/schema.js.map +1 -1
- package/dist/shape-with-text/document.js +264 -0
- package/dist/shape-with-text/document.js.map +1 -0
- package/dist/shape-with-text/fit.d.ts +6 -9
- package/dist/shape-with-text/fit.d.ts.map +1 -1
- package/dist/shape-with-text/fit.js +1 -2
- package/dist/shape-with-text/geometry.d.ts +16 -7
- package/dist/shape-with-text/geometry.d.ts.map +1 -1
- package/dist/shape-with-text/geometry.js +105 -46
- package/dist/shape-with-text/geometry.js.map +1 -1
- package/dist/shape-with-text/index.d.ts +2 -2
- package/dist/shape-with-text/index.js +3 -3
- package/dist/shape-with-text/kinds.d.ts +4 -7
- package/dist/shape-with-text/kinds.d.ts.map +1 -1
- package/dist/shape-with-text/kinds.js +1 -2
- package/dist/shared-style-index.d.ts +19 -0
- package/dist/shared-style-index.d.ts.map +1 -0
- package/dist/shared-style-index.js +71 -0
- package/dist/shared-style-index.js.map +1 -0
- package/dist/shared-styles.d.ts +18 -20
- package/dist/shared-styles.d.ts.map +1 -1
- package/dist/shared-styles.js +20 -12
- package/dist/shared-styles.js.map +1 -1
- package/dist/slides/drop.d.ts +29 -0
- package/dist/slides/drop.d.ts.map +1 -0
- package/dist/slides/drop.js +80 -0
- package/dist/slides/drop.js.map +1 -0
- package/dist/slides/index.d.ts +56 -0
- package/dist/slides/index.d.ts.map +1 -0
- package/dist/slides/index.js +137 -0
- package/dist/slides/index.js.map +1 -0
- package/dist/slides/motion.d.ts +71 -0
- package/dist/slides/motion.d.ts.map +1 -0
- package/dist/slides/motion.js +167 -0
- package/dist/slides/motion.js.map +1 -0
- package/dist/slides/playback.d.ts +62 -0
- package/dist/slides/playback.d.ts.map +1 -0
- package/dist/slides/playback.js +220 -0
- package/dist/slides/playback.js.map +1 -0
- package/dist/slides/types.d.ts +59 -0
- package/dist/slides/types.d.ts.map +1 -0
- package/dist/slides/types.js +38 -0
- package/dist/slides/types.js.map +1 -0
- package/dist/slots/authoring.d.ts +6 -9
- package/dist/slots/authoring.d.ts.map +1 -1
- package/dist/slots/authoring.js +2 -3
- package/dist/slots/content.d.ts +5 -8
- package/dist/slots/content.d.ts.map +1 -1
- package/dist/slots/content.js +4 -5
- package/dist/slots/frames.d.ts +7 -9
- package/dist/slots/frames.d.ts.map +1 -1
- package/dist/slots/frames.js +3 -4
- package/dist/slots/frames.js.map +1 -1
- package/dist/slots/index.js +1 -1
- package/dist/slots/limits.d.ts +4 -7
- package/dist/slots/limits.d.ts.map +1 -1
- package/dist/slots/limits.js +1 -2
- package/dist/snap.d.ts +4 -7
- package/dist/snap.d.ts.map +1 -1
- package/dist/snap.js +7 -8
- package/dist/source-metadata.d.ts +1 -4
- package/dist/source-metadata.d.ts.map +1 -1
- package/dist/source-metadata.js +1 -2
- package/dist/specs/index.d.ts +3 -0
- package/dist/specs/index.js +3 -0
- package/dist/specs/model.d.ts +20 -0
- package/dist/specs/model.d.ts.map +1 -0
- package/dist/specs/model.js +32 -0
- package/dist/specs/model.js.map +1 -0
- package/dist/specs/schema.d.ts +24 -0
- package/dist/specs/schema.d.ts.map +1 -0
- package/dist/specs/schema.js +32 -0
- package/dist/specs/schema.js.map +1 -0
- package/dist/statuses/impact.d.ts +2 -5
- package/dist/statuses/impact.d.ts.map +1 -1
- package/dist/statuses/impact.js +2 -3
- package/dist/statuses/index.d.ts +1 -1
- package/dist/statuses/index.js +2 -2
- package/dist/statuses/node.d.ts +4 -7
- package/dist/statuses/node.d.ts.map +1 -1
- package/dist/statuses/node.js +1 -2
- package/dist/statuses/schema.d.ts +7 -9
- package/dist/statuses/schema.d.ts.map +1 -1
- package/dist/statuses/schema.js +1 -2
- package/dist/statuses/workflow.d.ts +9 -12
- package/dist/statuses/workflow.d.ts.map +1 -1
- package/dist/statuses/workflow.js +2 -3
- package/dist/strokes.d.ts +8 -10
- package/dist/strokes.d.ts.map +1 -1
- package/dist/strokes.js +2 -3
- package/dist/text/auto-resize.d.ts +4 -6
- package/dist/text/auto-resize.d.ts.map +1 -1
- package/dist/text/auto-resize.js +1 -2
- package/dist/text/direction.d.ts +10 -10
- package/dist/text/direction.d.ts.map +1 -1
- package/dist/text/direction.js +13 -14
- package/dist/text/direction.js.map +1 -1
- package/dist/text/index.d.ts +3 -2
- package/dist/text/index.js +6 -5
- package/dist/text/lengths.d.ts +9 -12
- package/dist/text/lengths.d.ts.map +1 -1
- package/dist/text/lengths.js +1 -2
- package/dist/text/lists.d.ts +17 -13
- package/dist/text/lists.d.ts.map +1 -1
- package/dist/text/lists.js +15 -4
- package/dist/text/lists.js.map +1 -1
- package/dist/text/name.d.ts +19 -0
- package/dist/text/name.d.ts.map +1 -0
- package/dist/text/name.js +37 -0
- package/dist/text/name.js.map +1 -0
- package/dist/text/overflow.d.ts +5 -7
- package/dist/text/overflow.d.ts.map +1 -1
- package/dist/text/overflow.js +1 -2
- package/dist/text/paragraphs.d.ts +20 -23
- package/dist/text/paragraphs.d.ts.map +1 -1
- package/dist/text/paragraphs.js +8 -5
- package/dist/text/paragraphs.js.map +1 -1
- package/dist/text/path.js +1 -2
- package/dist/text/picture.d.ts +3 -6
- package/dist/text/picture.d.ts.map +1 -1
- package/dist/text/picture.js +2 -3
- package/dist/text/references.d.ts +3 -6
- package/dist/text/references.d.ts.map +1 -1
- package/dist/text/references.js +2 -4
- package/dist/text/references.js.map +1 -1
- package/dist/text/runs.d.ts +6 -9
- package/dist/text/runs.d.ts.map +1 -1
- package/dist/text/runs.js +1 -2
- package/dist/text/schema.d.ts +1 -4
- package/dist/text/schema.d.ts.map +1 -1
- package/dist/text/schema.js +1 -2
- package/dist/thumbnail.d.ts +20 -0
- package/dist/thumbnail.d.ts.map +1 -0
- package/dist/thumbnail.js +46 -0
- package/dist/thumbnail.js.map +1 -0
- package/dist/transfer/apply.d.ts +2 -5
- package/dist/transfer/apply.d.ts.map +1 -1
- package/dist/transfer/apply.js +16 -6
- package/dist/transfer/apply.js.map +1 -1
- package/dist/transfer/copied.d.ts +11 -9
- package/dist/transfer/copied.d.ts.map +1 -1
- package/dist/transfer/copied.js +5 -6
- package/dist/transfer/copied.js.map +1 -1
- package/dist/transfer/dependencies.d.ts +10 -10
- package/dist/transfer/dependencies.d.ts.map +1 -1
- package/dist/transfer/dependencies.js +21 -10
- package/dist/transfer/dependencies.js.map +1 -1
- package/dist/transfer/history.d.ts +1 -4
- package/dist/transfer/history.d.ts.map +1 -1
- package/dist/transfer/history.js +3 -2
- package/dist/transfer/history.js.map +1 -1
- package/dist/transfer/identity.js +19 -5
- package/dist/transfer/identity.js.map +1 -1
- package/dist/transfer/index.d.ts +5 -4
- package/dist/transfer/index.js +6 -5
- package/dist/transfer/library.d.ts +43 -0
- package/dist/transfer/library.d.ts.map +1 -0
- package/dist/transfer/library.js +122 -0
- package/dist/transfer/library.js.map +1 -0
- package/dist/transfer/nodes.d.ts +2 -5
- package/dist/transfer/nodes.d.ts.map +1 -1
- package/dist/transfer/nodes.js +15 -4
- package/dist/transfer/nodes.js.map +1 -1
- package/dist/transfer/plan.d.ts +11 -5
- package/dist/transfer/plan.d.ts.map +1 -1
- package/dist/transfer/plan.js +52 -8
- package/dist/transfer/plan.js.map +1 -1
- package/dist/transfer/references.js +1 -2
- package/dist/transfer/remove.d.ts +1 -4
- package/dist/transfer/remove.d.ts.map +1 -1
- package/dist/transfer/remove.js +8 -3
- package/dist/transfer/remove.js.map +1 -1
- package/dist/transfer/resources.d.ts +2 -5
- package/dist/transfer/resources.d.ts.map +1 -1
- package/dist/transfer/resources.js +3 -4
- package/dist/transfer/validation.js +9 -6
- package/dist/transfer/validation.js.map +1 -1
- package/dist/transfer/variables.d.ts +3 -6
- package/dist/transfer/variables.d.ts.map +1 -1
- package/dist/transfer/variables.js +4 -4
- package/dist/transfer/variables.js.map +1 -1
- package/dist/types.d.ts +261 -134
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +47 -3
- package/dist/types.js.map +1 -1
- package/dist/undo.d.ts +5 -8
- package/dist/undo.d.ts.map +1 -1
- package/dist/undo.js +9 -3
- package/dist/undo.js.map +1 -1
- package/dist/variables/bindings.d.ts +29 -25
- package/dist/variables/bindings.d.ts.map +1 -1
- package/dist/variables/bindings.js +184 -55
- package/dist/variables/bindings.js.map +1 -1
- package/dist/variables/corners.d.ts +1 -4
- package/dist/variables/corners.d.ts.map +1 -1
- package/dist/variables/corners.js +1 -2
- package/dist/variables/easing.d.ts +53 -0
- package/dist/variables/easing.d.ts.map +1 -0
- package/dist/variables/easing.js +321 -0
- package/dist/variables/easing.js.map +1 -0
- package/dist/variables/fields.d.ts +21 -14
- package/dist/variables/fields.d.ts.map +1 -1
- package/dist/variables/fields.js +24 -6
- package/dist/variables/fields.js.map +1 -1
- package/dist/variables/formula/check.d.ts +2 -5
- package/dist/variables/formula/check.d.ts.map +1 -1
- package/dist/variables/formula/check.js +2 -3
- package/dist/variables/formula/evaluate.d.ts +1 -4
- package/dist/variables/formula/evaluate.d.ts.map +1 -1
- package/dist/variables/formula/evaluate.js +3 -4
- package/dist/variables/formula/index.d.ts +8 -8
- package/dist/variables/formula/index.d.ts.map +1 -1
- package/dist/variables/formula/index.js +29 -13
- package/dist/variables/formula/index.js.map +1 -1
- package/dist/variables/formula/parse.js +5 -6
- package/dist/variables/formula/print.d.ts +2 -5
- package/dist/variables/formula/print.d.ts.map +1 -1
- package/dist/variables/formula/print.js +4 -5
- package/dist/variables/formula/schema.d.ts +2 -5
- package/dist/variables/formula/schema.d.ts.map +1 -1
- package/dist/variables/formula/schema.js +6 -7
- package/dist/variables/formula/signatures.d.ts +4 -7
- package/dist/variables/formula/signatures.d.ts.map +1 -1
- package/dist/variables/formula/signatures.js +1 -2
- package/dist/variables/formula/signatures.js.map +1 -1
- package/dist/variables/formula/tokens.d.ts +5 -8
- package/dist/variables/formula/tokens.d.ts.map +1 -1
- package/dist/variables/formula/tokens.js +1 -2
- package/dist/variables/formula/tree.d.ts +8 -11
- package/dist/variables/formula/tree.d.ts.map +1 -1
- package/dist/variables/formula/tree.js +1 -2
- package/dist/variables/formula/tree.js.map +1 -1
- package/dist/variables/index.d.ts +42 -27
- package/dist/variables/index.d.ts.map +1 -1
- package/dist/variables/index.js +78 -29
- package/dist/variables/index.js.map +1 -1
- package/dist/variables/lookup.d.ts +11 -7
- package/dist/variables/lookup.d.ts.map +1 -1
- package/dist/variables/lookup.js +25 -4
- package/dist/variables/lookup.js.map +1 -1
- package/dist/variables/motion.d.ts +43 -0
- package/dist/variables/motion.d.ts.map +1 -0
- package/dist/variables/motion.js +106 -0
- package/dist/variables/motion.js.map +1 -0
- package/dist/variables/paints.d.ts +25 -19
- package/dist/variables/paints.d.ts.map +1 -1
- package/dist/variables/paints.js +28 -15
- package/dist/variables/paints.js.map +1 -1
- package/dist/variables/resolution.d.ts +22 -19
- package/dist/variables/resolution.d.ts.map +1 -1
- package/dist/variables/resolution.js +23 -14
- package/dist/variables/resolution.js.map +1 -1
- package/dist/variables/schema.d.ts +62 -7
- package/dist/variables/schema.d.ts.map +1 -1
- package/dist/variables/schema.js +39 -5
- package/dist/variables/schema.js.map +1 -1
- package/dist/variables/style-bindings.d.ts +21 -0
- package/dist/variables/style-bindings.d.ts.map +1 -0
- package/dist/variables/style-bindings.js +82 -0
- package/dist/variables/style-bindings.js.map +1 -0
- package/dist/variables/subtree.js +1 -2
- package/dist/variables/text.d.ts +2 -5
- package/dist/variables/text.d.ts.map +1 -1
- package/dist/variables/text.js +3 -4
- package/dist/variables/token.d.ts +5 -8
- package/dist/variables/token.d.ts.map +1 -1
- package/dist/variables/token.js +1 -2
- package/dist/variables/units.js +3 -5
- package/dist/variables/units.js.map +1 -1
- package/dist/variables/value.d.ts +4 -7
- package/dist/variables/value.d.ts.map +1 -1
- package/dist/variables/value.js +4 -5
- package/dist/variant-name.d.ts +2 -5
- package/dist/variant-name.d.ts.map +1 -1
- package/dist/variant-name.js +1 -2
- package/dist/variant-properties.d.ts +4 -7
- package/dist/variant-properties.d.ts.map +1 -1
- package/dist/variant-properties.js +2 -3
- package/dist/vector-network.d.ts +17 -20
- package/dist/vector-network.d.ts.map +1 -1
- package/dist/vector-network.js +4 -5
- package/package.json +42 -5
- package/src/behaviours/index.ts +2 -0
- package/src/behaviours/kinds.ts +108 -2
- package/src/behaviours/listing.ts +142 -0
- package/src/behaviours/model.ts +23 -2
- package/src/behaviours/schema.ts +19 -2
- package/src/behaviours/spec.ts +5 -0
- package/src/behaviours/transition.ts +46 -0
- package/src/blur.ts +88 -0
- package/src/checkpoint.ts +2 -0
- package/src/clipping.ts +3 -4
- package/src/color/index.ts +15 -24
- package/src/color/management.ts +144 -168
- package/src/color/okhcl.ts +62 -43
- package/src/color/schema.ts +13 -0
- package/src/comments/threads.ts +8 -1
- package/src/connectors/layout.ts +10 -3
- package/src/connectors/sublayers.ts +2 -1
- package/src/constraints.ts +2 -1
- package/src/coordinate.ts +17 -25
- package/src/copy.ts +38 -0
- package/src/corners.ts +3 -0
- package/src/css/index.ts +1 -0
- package/src/css/motion.ts +51 -0
- package/src/css/shadows.ts +7 -6
- package/src/css/values.ts +7 -3
- package/src/cubic.ts +57 -1
- package/src/export-format.ts +11 -1
- package/src/fields/layout.ts +9 -0
- package/src/font-style.ts +20 -7
- package/src/generated/index.ts +58 -9
- package/src/generated/kind.ts +16 -2
- package/src/generated/shape-with-text.ts +1 -0
- package/src/generated/spec.ts +243 -0
- package/src/generated/sticky.ts +2 -1
- package/src/geometry.ts +52 -89
- package/src/graph.ts +93 -15
- package/src/group-bounds.ts +54 -13
- package/src/hit-test.ts +78 -33
- package/src/images.ts +4 -1
- package/src/instances/content-marks.ts +124 -0
- package/src/instances/deleted.ts +115 -0
- package/src/instances/fields.ts +9 -3
- package/src/instances/index.ts +165 -17
- package/src/instances/lookup.ts +61 -0
- package/src/instances/sync.ts +108 -11
- package/src/layout/flow.ts +36 -0
- package/src/layout/index.ts +2 -0
- package/src/layout/keywords.ts +7 -1
- package/src/layout/sizing.ts +30 -0
- package/src/layout/spacing.ts +12 -0
- package/src/layout/stacking.ts +14 -0
- package/src/matrix.ts +11 -1
- package/src/mesh/geometry.ts +422 -0
- package/src/mesh/index.ts +3 -0
- package/src/mesh/model.ts +50 -0
- package/src/mesh/schema.ts +81 -0
- package/src/motion/apply.ts +156 -0
- package/src/motion/edit.ts +148 -0
- package/src/motion/effects.ts +166 -0
- package/src/motion/evaluate.ts +181 -0
- package/src/motion/fields.ts +136 -0
- package/src/motion/index.ts +13 -0
- package/src/motion/keyable.ts +141 -0
- package/src/motion/outline.ts +72 -0
- package/src/motion/presets/index.ts +257 -0
- package/src/motion/presets/settings.ts +221 -0
- package/src/motion/presets/stagger.ts +242 -0
- package/src/motion/schema.ts +66 -0
- package/src/motion/segment.ts +83 -0
- package/src/motion/spec.ts +225 -0
- package/src/motion/timeline.ts +48 -0
- package/src/motion/types.ts +45 -0
- package/src/motion/variables.ts +33 -0
- package/src/mutation-impact.ts +23 -7
- package/src/node-defaults.ts +152 -53
- package/src/order-keys.ts +16 -2
- package/src/paints/index.ts +2 -0
- package/src/paints/pattern.ts +55 -0
- package/src/paints/shows.ts +9 -0
- package/src/paints/solid.ts +10 -0
- package/src/paints/stills.ts +186 -0
- package/src/parse-path.ts +15 -0
- package/src/plugin-data/field.ts +3 -0
- package/src/plugin-data/fields.ts +54 -4
- package/src/polygon.ts +6 -4
- package/src/resize.ts +32 -20
- package/src/scaling/index.ts +1 -1
- package/src/scaling/node.ts +43 -6
- package/src/shaders/index.ts +0 -1
- package/src/shaders/model.ts +133 -45
- package/src/shaders/schema.ts +13 -1
- package/src/shape-with-text/document.ts +170 -0
- package/src/shape-with-text/geometry.ts +98 -29
- package/src/shared-style-index.ts +106 -0
- package/src/shared-styles.ts +21 -14
- package/src/slides/drop.ts +94 -0
- package/src/slides/index.ts +133 -0
- package/src/slides/motion.ts +203 -0
- package/src/slides/playback.ts +242 -0
- package/src/slides/types.ts +94 -0
- package/src/slots/frames.ts +2 -3
- package/src/specs/index.ts +2 -0
- package/src/specs/model.ts +40 -0
- package/src/specs/schema.ts +43 -0
- package/src/text/direction.ts +13 -23
- package/src/text/index.ts +1 -0
- package/src/text/lists.ts +20 -7
- package/src/text/name.ts +39 -0
- package/src/text/paragraphs.ts +10 -3
- package/src/text/references.ts +3 -3
- package/src/thumbnail.ts +52 -0
- package/src/transfer/apply.ts +16 -3
- package/src/transfer/copied.ts +7 -2
- package/src/transfer/dependencies.ts +27 -12
- package/src/transfer/history.ts +2 -0
- package/src/transfer/identity.ts +34 -2
- package/src/transfer/index.ts +6 -0
- package/src/transfer/library.ts +177 -0
- package/src/transfer/nodes.ts +28 -0
- package/src/transfer/plan.ts +96 -10
- package/src/transfer/remove.ts +6 -2
- package/src/transfer/validation.ts +15 -7
- package/src/transfer/variables.ts +8 -2
- package/src/types.ts +182 -15
- package/src/undo.ts +10 -1
- package/src/variables/bindings.ts +292 -51
- package/src/variables/easing.ts +281 -0
- package/src/variables/fields.ts +30 -3
- package/src/variables/formula/index.ts +33 -14
- package/src/variables/formula/signatures.ts +6 -2
- package/src/variables/formula/tree.ts +3 -3
- package/src/variables/index.ts +90 -37
- package/src/variables/lookup.ts +25 -2
- package/src/variables/motion.ts +151 -0
- package/src/variables/paints.ts +29 -7
- package/src/variables/resolution.ts +26 -6
- package/src/variables/schema.ts +41 -0
- package/src/variables/style-bindings.ts +137 -0
- package/src/variables/units.ts +2 -3
- package/dist/shaders/still.d.ts +0 -18
- package/dist/shaders/still.d.ts.map +0 -1
- package/dist/shaders/still.js +0 -36
- package/dist/shaders/still.js.map +0 -1
- package/src/shaders/still.ts +0 -41
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { BEHAVIOUR_KINDS, hasInvalidState } from "./kinds.js";
|
|
2
1
|
import * as v from "valibot";
|
|
3
|
-
|
|
2
|
+
import { easingSchema, motionSpecSchema } from "../variables/schema.js";
|
|
3
|
+
import { BEHAVIOUR_KINDS, hasInvalidState } from "./kinds.js";
|
|
4
|
+
// src/behaviours/schema.ts
|
|
4
5
|
const booleanBindingSchema = v.object({
|
|
5
6
|
propertyId: v.string(),
|
|
6
7
|
/** For a variant property: the values that mean on and off. */
|
|
@@ -30,6 +31,17 @@ const interactionStatesSchema = v.object({
|
|
|
30
31
|
propertyId: v.string(),
|
|
31
32
|
...interactionStateValues
|
|
32
33
|
});
|
|
34
|
+
/**
|
|
35
|
+
* How a control moves between its states: a duration in seconds and an easing, each its own value
|
|
36
|
+
* or, while the variable exists, a TIMING or EASING variable's, as Figma keeps a transition's
|
|
37
|
+
* duration and easing beside the variables they follow.
|
|
38
|
+
*/
|
|
39
|
+
const transitionSchema = v.object({
|
|
40
|
+
duration: v.pipe(v.number(), v.finite(), v.minValue(0)),
|
|
41
|
+
easing: easingSchema,
|
|
42
|
+
durationVariableId: v.optional(v.string()),
|
|
43
|
+
easingVariableId: v.optional(v.string())
|
|
44
|
+
});
|
|
33
45
|
const storedBehaviourSchema = v.object({
|
|
34
46
|
kind: v.picklist(BEHAVIOUR_KINDS),
|
|
35
47
|
/** Boolean values, by value id, bound to component properties. */
|
|
@@ -40,7 +52,8 @@ const storedBehaviourSchema = v.object({
|
|
|
40
52
|
numbers: v.record(v.string(), numberSettingsSchema),
|
|
41
53
|
/** Parts, by part id, bound to slot properties. */
|
|
42
54
|
parts: v.record(v.string(), v.string()),
|
|
43
|
-
states: v.optional(interactionStatesSchema)
|
|
55
|
+
states: v.optional(interactionStatesSchema),
|
|
56
|
+
transition: v.optional(transitionSchema)
|
|
44
57
|
});
|
|
45
58
|
/** The behaviour without an invalid state when its kind of control has none. */
|
|
46
59
|
function withoutUnsupportedStates(behaviour) {
|
|
@@ -78,9 +91,10 @@ const behaviourSpecSchema = v.object({
|
|
|
78
91
|
states: v.optional(v.union([v.string(), v.object({
|
|
79
92
|
property: v.string(),
|
|
80
93
|
...interactionStateValues
|
|
81
|
-
})]))
|
|
94
|
+
})])),
|
|
95
|
+
/** How the control moves between states, as `motionSpecSchema` writes it. */
|
|
96
|
+
transition: v.optional(motionSpecSchema)
|
|
82
97
|
});
|
|
83
|
-
//#endregion
|
|
84
98
|
export { behaviourSchema, behaviourSpecSchema, interactionStateValues, isNumberRange };
|
|
85
99
|
|
|
86
100
|
//# sourceMappingURL=schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","names":[],"sources":["../../src/behaviours/schema.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport { BEHAVIOUR_KINDS, hasInvalidState, type InteractionState } from './kinds'\n\nconst booleanBindingSchema = v.object({\n propertyId: v.string(),\n /** For a variant property: the values that mean on and off. */\n on: v.optional(v.string()),\n off: v.optional(v.string())\n})\n\n/** Whether a number value's range can be stepped through: `max` above `min`, a positive step. */\nexport function isNumberRange(settings: { min: number; max: number; step: number }): boolean {\n return settings.max > settings.min && settings.step > 0\n}\n\nconst numberSettingsSchema = v.pipe(\n v.object({\n min: v.pipe(v.number(), v.finite()),\n max: v.pipe(v.number(), v.finite()),\n step: v.pipe(v.number(), v.finite()),\n default: v.pipe(v.number(), v.finite())\n }),\n v.check(\n (settings) => isNumberRange(settings),\n 'A number value needs max above min and a positive step'\n )\n)\n\n/** Each interaction state's variant value, by state; a state left out shows the rest value. */\nexport const interactionStateValues = {\n rest: v.optional(v.string()),\n hover: v.optional(v.string()),\n pressed: v.optional(v.string()),\n focus: v.optional(v.string()),\n disabled: v.optional(v.string()),\n invalid: v.optional(v.string())\n} satisfies Record<InteractionState, unknown>\n\nconst interactionStatesSchema = v.object({ propertyId: v.string(), ...interactionStateValues })\n\nconst storedBehaviourSchema = v.object({\n kind: v.picklist(BEHAVIOUR_KINDS),\n /** Boolean values, by value id, bound to component properties. */\n booleans: v.record(v.string(), booleanBindingSchema),\n /** Text values, by value id, bound to text properties. */\n texts: v.optional(v.record(v.string(), v.object({ propertyId: v.string() })), {}),\n /** Number values, by value id: the range the behaviour keeps itself. */\n numbers: v.record(v.string(), numberSettingsSchema),\n /** Parts, by part id, bound to slot properties. */\n parts: v.record(v.string(), v.string()),\n states: v.optional(interactionStatesSchema)\n})\n\ntype StoredBehaviour = v.InferOutput<typeof storedBehaviourSchema>\n\n/** The behaviour without an invalid state when its kind of control has none. */\nfunction withoutUnsupportedStates(behaviour: StoredBehaviour): StoredBehaviour {\n if (behaviour.states?.invalid === undefined || hasInvalidState(behaviour.kind)) return behaviour\n const { invalid: _invalid, ...states } = behaviour.states\n return { ...behaviour, states }\n}\n\n/**\n * A stored behaviour. An invalid state on a kind of control that has none, such as a button,\n * is dropped as it is read, so nothing draws or exports it; the rest of the behaviour stays.\n */\nexport const behaviourSchema = v.pipe(storedBehaviourSchema, v.transform(withoutUnsupportedStates))\n\n/** How a main component behaves as a control, as kept in its plugin data. */\nexport type Behaviour = StoredBehaviour\nexport type BehaviourBooleanBinding = v.InferOutput<typeof booleanBindingSchema>\nexport type BehaviourNumberSettings = v.InferOutput<typeof numberSettingsSchema>\nexport type BehaviourInteractionStates = v.InferOutput<typeof interactionStatesSchema>\n\n/**\n * A behaviour as scripts, tools, and JSX write it: component properties and slots by name, not\n * by id. Values are boolean or text values by their contract id; numbers are a slider's or\n * number field's own range.\n */\nexport const behaviourSpecSchema = v.object({\n kind: v.picklist(BEHAVIOUR_KINDS),\n values: v.optional(\n v.record(\n v.string(),\n v.union([\n v.string(),\n v.object({ property: v.string(), on: v.optional(v.string()), off: v.optional(v.string()) })\n ])\n )\n ),\n numbers: v.optional(\n v.record(\n v.string(),\n v.object({\n min: v.optional(v.number()),\n max: v.optional(v.number()),\n step: v.optional(v.number()),\n default: v.optional(v.number())\n })\n )\n ),\n parts: v.optional(v.record(v.string(), v.string())),\n states: v.optional(\n v.union([v.string(), v.object({ property: v.string(), ...interactionStateValues })])\n )\n})\n\nexport type BehaviourSpec = v.InferOutput<typeof behaviourSpecSchema>\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.js","names":[],"sources":["../../src/behaviours/schema.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport { easingSchema, motionSpecSchema } from '../variables/schema'\nimport { BEHAVIOUR_KINDS, hasInvalidState, type InteractionState } from './kinds'\n\nconst booleanBindingSchema = v.object({\n propertyId: v.string(),\n /** For a variant property: the values that mean on and off. */\n on: v.optional(v.string()),\n off: v.optional(v.string())\n})\n\n/** Whether a number value's range can be stepped through: `max` above `min`, a positive step. */\nexport function isNumberRange(settings: { min: number; max: number; step: number }): boolean {\n return settings.max > settings.min && settings.step > 0\n}\n\nconst numberSettingsSchema = v.pipe(\n v.object({\n min: v.pipe(v.number(), v.finite()),\n max: v.pipe(v.number(), v.finite()),\n step: v.pipe(v.number(), v.finite()),\n default: v.pipe(v.number(), v.finite())\n }),\n v.check(\n (settings) => isNumberRange(settings),\n 'A number value needs max above min and a positive step'\n )\n)\n\n/** Each interaction state's variant value, by state; a state left out shows the rest value. */\nexport const interactionStateValues = {\n rest: v.optional(v.string()),\n hover: v.optional(v.string()),\n pressed: v.optional(v.string()),\n focus: v.optional(v.string()),\n disabled: v.optional(v.string()),\n invalid: v.optional(v.string())\n} satisfies Record<InteractionState, unknown>\n\nconst interactionStatesSchema = v.object({ propertyId: v.string(), ...interactionStateValues })\n\n/**\n * How a control moves between its states: a duration in seconds and an easing, each its own value\n * or, while the variable exists, a TIMING or EASING variable's, as Figma keeps a transition's\n * duration and easing beside the variables they follow.\n */\nconst transitionSchema = v.object({\n duration: v.pipe(v.number(), v.finite(), v.minValue(0)),\n easing: easingSchema,\n durationVariableId: v.optional(v.string()),\n easingVariableId: v.optional(v.string())\n})\n\nconst storedBehaviourSchema = v.object({\n kind: v.picklist(BEHAVIOUR_KINDS),\n /** Boolean values, by value id, bound to component properties. */\n booleans: v.record(v.string(), booleanBindingSchema),\n /** Text values, by value id, bound to text properties. */\n texts: v.optional(v.record(v.string(), v.object({ propertyId: v.string() })), {}),\n /** Number values, by value id: the range the behaviour keeps itself. */\n numbers: v.record(v.string(), numberSettingsSchema),\n /** Parts, by part id, bound to slot properties. */\n parts: v.record(v.string(), v.string()),\n states: v.optional(interactionStatesSchema),\n transition: v.optional(transitionSchema)\n})\n\ntype StoredBehaviour = v.InferOutput<typeof storedBehaviourSchema>\n\n/** The behaviour without an invalid state when its kind of control has none. */\nfunction withoutUnsupportedStates(behaviour: StoredBehaviour): StoredBehaviour {\n if (behaviour.states?.invalid === undefined || hasInvalidState(behaviour.kind)) return behaviour\n const { invalid: _invalid, ...states } = behaviour.states\n return { ...behaviour, states }\n}\n\n/**\n * A stored behaviour. An invalid state on a kind of control that has none, such as a button,\n * is dropped as it is read, so nothing draws or exports it; the rest of the behaviour stays.\n */\nexport const behaviourSchema = v.pipe(storedBehaviourSchema, v.transform(withoutUnsupportedStates))\n\n/** How a main component behaves as a control, as kept in its plugin data. */\nexport type Behaviour = StoredBehaviour\nexport type BehaviourBooleanBinding = v.InferOutput<typeof booleanBindingSchema>\nexport type BehaviourNumberSettings = v.InferOutput<typeof numberSettingsSchema>\nexport type BehaviourInteractionStates = v.InferOutput<typeof interactionStatesSchema>\nexport type BehaviourTransition = v.InferOutput<typeof transitionSchema>\n\n/**\n * A behaviour as scripts, tools, and JSX write it: component properties and slots by name, not\n * by id. Values are boolean or text values by their contract id; numbers are a slider's or\n * number field's own range.\n */\nexport const behaviourSpecSchema = v.object({\n kind: v.picklist(BEHAVIOUR_KINDS),\n values: v.optional(\n v.record(\n v.string(),\n v.union([\n v.string(),\n v.object({ property: v.string(), on: v.optional(v.string()), off: v.optional(v.string()) })\n ])\n )\n ),\n numbers: v.optional(\n v.record(\n v.string(),\n v.object({\n min: v.optional(v.number()),\n max: v.optional(v.number()),\n step: v.optional(v.number()),\n default: v.optional(v.number())\n })\n )\n ),\n parts: v.optional(v.record(v.string(), v.string())),\n states: v.optional(\n v.union([v.string(), v.object({ property: v.string(), ...interactionStateValues })])\n ),\n /** How the control moves between states, as `motionSpecSchema` writes it. */\n transition: v.optional(motionSpecSchema)\n})\n\nexport type BehaviourSpec = v.InferOutput<typeof behaviourSpecSchema>\n"],"mappings":";;;;AAKA,MAAM,uBAAuB,EAAE,OAAO;CACpC,YAAY,EAAE,OAAO;;CAErB,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC;CACzB,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC;AAC5B,CAAC;;AAGD,SAAgB,cAAc,UAA+D;CAC3F,OAAO,SAAS,MAAM,SAAS,OAAO,SAAS,OAAO;AACxD;AAEA,MAAM,uBAAuB,EAAE,KAC7B,EAAE,OAAO;CACP,KAAK,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC;CACl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../types.js";
|
|
3
3
|
import { Behaviour, BehaviourSpec } from "./schema.js";
|
|
4
|
-
//#region src/behaviours/spec.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* The variant values that likely mean on and off: names such as On, True, or Checked first,
|
|
7
6
|
* then the values in order.
|
|
8
7
|
*/
|
|
9
|
-
declare function guessOnOff(options: readonly string[], explicit?: {
|
|
8
|
+
export declare function guessOnOff(options: readonly string[], explicit?: {
|
|
10
9
|
on?: string;
|
|
11
10
|
off?: string;
|
|
12
11
|
}): {
|
|
@@ -18,9 +17,7 @@ declare function guessOnOff(options: readonly string[], explicit?: {
|
|
|
18
17
|
* name the component lacks, a value the kind does not have, or a variant value the property
|
|
19
18
|
* does not offer fails with a message naming what exists.
|
|
20
19
|
*/
|
|
21
|
-
declare function behaviourFromSpec(graph: SceneGraph, owner: SceneNode, spec: BehaviourSpec): Behaviour;
|
|
20
|
+
export declare function behaviourFromSpec(graph: SceneGraph, owner: SceneNode, spec: BehaviourSpec): Behaviour;
|
|
22
21
|
/** The spec a stored behaviour reads as, with ids back to names; unresolved bindings are left out. */
|
|
23
|
-
declare function behaviourToSpec(graph: SceneGraph, owner: SceneNode, behaviour: Behaviour): BehaviourSpec;
|
|
24
|
-
//#endregion
|
|
25
|
-
export { behaviourFromSpec, behaviourToSpec, guessOnOff };
|
|
22
|
+
export declare function behaviourToSpec(graph: SceneGraph, owner: SceneNode, behaviour: Behaviour): BehaviourSpec;
|
|
26
23
|
//# sourceMappingURL=spec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.d.ts","names":[],"sources":["../../src/behaviours/spec.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"spec.d.ts","names":[],"sources":["../../src/behaviours/spec.ts"],"mappings":";;;;;;;wBAsBgB,WACd,4BACA;EAAY;EAAa;;EACtB;EAAa;;;;;;;wBAyFF,kBACd,OAAO,YACP,OAAO,WACP,MAAM,gBACL;;wBAkCa,gBACd,OAAO,YACP,OAAO,WACP,WAAW,YACV"}
|
package/dist/behaviours/spec.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { omitBy } from "es-toolkit/object";
|
|
2
|
+
import { motionFromSpec, motionToSpec } from "../variables/motion.js";
|
|
1
3
|
import { behaviourContract, hasInvalidState } from "./kinds.js";
|
|
2
|
-
import { isNumberRange } from "./schema.js";
|
|
3
4
|
import { behaviourProperties, emptyBehaviour, guessInteractionStates, textBinding } from "./model.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
5
|
+
import { isNumberRange } from "./schema.js";
|
|
6
|
+
import { defaultTransition } from "./transition.js";
|
|
7
|
+
// src/behaviours/spec.ts
|
|
6
8
|
/** Variant values that usually mean on, compared case-insensitively. */
|
|
7
9
|
const ON_NAMES = [
|
|
8
10
|
"on",
|
|
@@ -112,6 +114,7 @@ function behaviourFromSpec(graph, owner, spec) {
|
|
|
112
114
|
behaviour.parts[partId] = id;
|
|
113
115
|
}
|
|
114
116
|
if (spec.states !== void 0) resolveStates(behaviour, properties, spec.states);
|
|
117
|
+
if (spec.transition) behaviour.transition = motionFromSpec(graph, spec.transition, defaultTransition());
|
|
115
118
|
return behaviour;
|
|
116
119
|
}
|
|
117
120
|
function stripUndefined(record) {
|
|
@@ -150,9 +153,9 @@ function behaviourToSpec(graph, owner, behaviour) {
|
|
|
150
153
|
}),
|
|
151
154
|
property: statesName
|
|
152
155
|
};
|
|
156
|
+
if (behaviour.transition) spec.transition = motionToSpec(graph, behaviour.transition);
|
|
153
157
|
return spec;
|
|
154
158
|
}
|
|
155
|
-
//#endregion
|
|
156
159
|
export { behaviourFromSpec, behaviourToSpec, guessOnOff };
|
|
157
160
|
|
|
158
161
|
//# sourceMappingURL=spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.js","names":[],"sources":["../../src/behaviours/spec.ts"],"sourcesContent":["import { omitBy } from 'es-toolkit/object'\n\nimport type { SceneGraph } from '../graph'\nimport type { ComponentPropertyDefinition, SceneNode } from '../types'\nimport { behaviourContract, hasInvalidState } from './kinds'\nimport { behaviourProperties, emptyBehaviour, guessInteractionStates, textBinding } from './model'\nimport { isNumberRange, type Behaviour, type BehaviourSpec } from './schema'\n\n/** Variant values that usually mean on, compared case-insensitively. */\nconst ON_NAMES = ['on', 'true', 'yes', 'checked', 'pressed', 'open', 'selected', 'active']\nconst OFF_NAMES = ['off', 'false', 'no', 'unchecked', 'closed', 'default', 'inactive']\n\nfunction named(names: readonly string[], options: readonly string[]): string | undefined {\n return options.find((option) => names.includes(option.trim().toLowerCase()))\n}\n\n/**\n * The variant values that likely mean on and off: names such as On, True, or Checked first,\n * then the values in order.\n */\nexport function guessOnOff(\n options: readonly string[],\n explicit: { on?: string; off?: string } = {}\n): { on?: string; off?: string } {\n const on = explicit.on ?? named(ON_NAMES, options) ?? options[0]\n const off = explicit.off ?? named(OFF_NAMES, options) ?? options.find((option) => option !== on)\n return { on, off }\n}\n\nfunction findProperty(\n properties: readonly ComponentPropertyDefinition[],\n name: string,\n types: readonly ComponentPropertyDefinition['type'][],\n what: string\n): ComponentPropertyDefinition {\n const found = properties.find((item) => item.name === name && types.includes(item.type))\n if (found) return found\n const available = properties.filter((item) => types.includes(item.type)).map((item) => item.name)\n throw new Error(\n `${what} needs a ${types.join(' or ')} property named \"${name}\"; the component has ${\n available.length ? available.map((item) => `\"${item}\"`).join(', ') : 'none'\n }`\n )\n}\n\ntype ValueBinding = NonNullable<BehaviourSpec['values']>[string]\ntype StatesSpec = NonNullable<BehaviourSpec['states']>\n\nfunction listed(items: readonly { id: string }[]): string {\n return items.map((item) => `\"${item.id}\"`).join(', ')\n}\n\n/** Bind a boolean or text value to the property named in its binding. */\nfunction resolveValue(\n behaviour: Behaviour,\n properties: readonly ComponentPropertyDefinition[],\n valueId: string,\n binding: ValueBinding\n): void {\n const contract = behaviourContract(behaviour.kind)\n const bindable = contract.values.filter((item) => item.type === 'boolean' || item.type === 'text')\n const value = bindable.find((item) => item.id === valueId)\n if (!value)\n throw new Error(\n `A ${behaviour.kind} has no boolean or text value \"${valueId}\"; it has ${listed(bindable)}`\n )\n const name = typeof binding === 'string' ? binding : binding.property\n if (value.type === 'text') {\n behaviour.texts[valueId] = { propertyId: findProperty(properties, name, ['TEXT'], valueId).id }\n return\n }\n const definition = findProperty(properties, name, ['VARIANT', 'BOOLEAN'], valueId)\n if (definition.type === 'BOOLEAN') {\n behaviour.booleans[valueId] = { propertyId: definition.id }\n return\n }\n const options = definition.variantOptions ?? []\n const explicit: { on?: string; off?: string } = typeof binding === 'string' ? {} : binding\n const { on, off } = guessOnOff(options, explicit)\n for (const choice of [on, off])\n if (choice !== undefined && !options.includes(choice))\n throw new Error(`\"${definition.name}\" has no value \"${choice}\"; it has ${options.join(', ')}`)\n behaviour.booleans[valueId] = { propertyId: definition.id, on, off }\n}\n\nfunction resolveStates(\n behaviour: Behaviour,\n properties: readonly ComponentPropertyDefinition[],\n states: StatesSpec\n): void {\n const name = typeof states === 'string' ? states : states.property\n const definition = findProperty(properties, name, ['VARIANT'], 'states')\n const guessed = guessInteractionStates(\n behaviour.kind,\n definition.id,\n definition.variantOptions ?? []\n )\n if (typeof states === 'string') {\n behaviour.states = guessed\n return\n }\n const { property: _property, ...values } = states\n if (values.invalid !== undefined && !hasInvalidState(behaviour.kind))\n throw new Error(`A ${behaviour.kind} has no invalid state`)\n behaviour.states = { ...guessed, ...stripUndefined(values) }\n}\n\n/**\n * The stored behaviour for a spec, with names resolved to the owner's property and slot ids. A\n * name the component lacks, a value the kind does not have, or a variant value the property\n * does not offer fails with a message naming what exists.\n */\nexport function behaviourFromSpec(\n graph: SceneGraph,\n owner: SceneNode,\n spec: BehaviourSpec\n): Behaviour {\n const contract = behaviourContract(spec.kind)\n const properties = behaviourProperties(graph, owner)\n const behaviour = emptyBehaviour(spec.kind)\n for (const [valueId, binding] of Object.entries(spec.values ?? {}))\n resolveValue(behaviour, properties, valueId, binding)\n const numbers = contract.values.filter((item) => item.type === 'number')\n for (const [valueId, settings] of Object.entries(spec.numbers ?? {})) {\n if (!numbers.some((item) => item.id === valueId))\n throw new Error(`A ${spec.kind} has no number value \"${valueId}\"; it has ${listed(numbers)}`)\n const range = { ...behaviour.numbers[valueId], ...stripUndefined(settings) }\n if (!isNumberRange(range))\n throw new Error(`\"${valueId}\" needs max above min and a positive step`)\n behaviour.numbers[valueId] = range\n }\n for (const [partId, slotName] of Object.entries(spec.parts ?? {})) {\n if (!contract.parts.some((item) => item.id === partId))\n throw new Error(`A ${spec.kind} has no part \"${partId}\"; it has ${listed(contract.parts)}`)\n const id = findProperty(properties, slotName, ['SLOT'], partId).id\n const taken = Object.entries(behaviour.parts).find(([, slot]) => slot === id)?.[0]\n if (taken) throw new Error(`\"${slotName}\" is already the ${taken}; a slot draws one part`)\n behaviour.parts[partId] = id\n }\n if (spec.states !== undefined) resolveStates(behaviour, properties, spec.states)\n return behaviour\n}\n\nfunction stripUndefined<T extends Record<string, unknown>>(record: T): Partial<T> {\n return omitBy(record, (value) => value === undefined)\n}\n\n/** The spec a stored behaviour reads as, with ids back to names; unresolved bindings are left out. */\nexport function behaviourToSpec(\n graph: SceneGraph,\n owner: SceneNode,\n behaviour: Behaviour\n): BehaviourSpec {\n const properties = behaviourProperties(graph, owner)\n const nameOf = (id: string | undefined) => properties.find((item) => item.id === id)?.name\n const values: NonNullable<BehaviourSpec['values']> = {}\n for (const [valueId, binding] of Object.entries(behaviour.booleans)) {\n const name = nameOf(binding.propertyId)\n if (name)\n values[valueId] =\n binding.on || binding.off ? { property: name, on: binding.on, off: binding.off } : name\n }\n for (const valueId of Object.keys(behaviour.texts)) {\n const name = nameOf(textBinding(behaviour, valueId))\n if (name) values[valueId] = name\n }\n const parts = Object.fromEntries(\n Object.entries(behaviour.parts).flatMap(([partId, id]) => {\n const name = nameOf(id)\n return name ? [[partId, name]] : []\n })\n )\n const statesName = nameOf(behaviour.states?.propertyId)\n const spec: BehaviourSpec = { kind: behaviour.kind }\n if (Object.keys(values).length) spec.values = values\n if (Object.keys(behaviour.numbers).length) spec.numbers = structuredClone(behaviour.numbers)\n if (Object.keys(parts).length) spec.parts = parts\n if (behaviour.states && statesName)\n spec.states = {\n ...stripUndefined({ ...behaviour.states, propertyId: undefined }),\n property: statesName\n }\n return spec\n}\n"],"mappings":";;;;;;AASA,MAAM,WAAW;CAAC;CAAM;CAAQ;CAAO;CAAW;CAAW;CAAQ;CAAY;AAAQ;AACzF,MAAM,YAAY;CAAC;CAAO;CAAS;CAAM;CAAa;CAAU;CAAW;AAAU;AAErF,SAAS,MAAM,OAA0B,SAAgD;CACvF,OAAO,QAAQ,MAAM,WAAW,MAAM,SAAS,OAAO,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC;AAC7E;;;;;AAMA,SAAgB,WACd,SACA,WAA0C,CAAC,GACZ;CAC/B,MAAM,KAAK,SAAS,MAAM,MAAM,UAAU,OAAO,KAAK,QAAQ;CAE9D,OAAO;EAAE;EAAI,KADD,SAAS,OAAO,MAAM,WAAW,OAAO,KAAK,QAAQ,MAAM,WAAW,WAAW,EAAE;CAC9E;AACnB;AAEA,SAAS,aACP,YACA,MACA,OACA,MAC6B;CAC7B,MAAM,QAAQ,WAAW,MAAM,SAAS,KAAK,SAAS,QAAQ,MAAM,SAAS,KAAK,IAAI,CAAC;CACvF,IAAI,OAAO,OAAO;CAClB,MAAM,YAAY,WAAW,QAAQ,SAAS,MAAM,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS,KAAK,IAAI;CAChG,MAAM,IAAI,MACR,GAAG,KAAK,WAAW,MAAM,KAAK,MAAM,EAAE,mBAAmB,KAAK,uBAC5D,UAAU,SAAS,UAAU,KAAK,SAAS,IAAI,KAAK,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,QAEzE;AACF;AAKA,SAAS,OAAO,OAA0C;CACxD,OAAO,MAAM,KAAK,SAAS,IAAI,KAAK,GAAG,EAAE,CAAC,CAAC,KAAK,IAAI;AACtD;;AAGA,SAAS,aACP,W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IAAI,OAAO,KAAK,MAAM,CAAC,CAAC,QAAQ,KAAK,SAAS;CAC9C,IAAI,OAAO,KAAK,UAAU,OAAO,CAAC,CAAC,QAAQ,KAAK,UAAU,gBAAgB,UAAU,OAAO;CAC3F,IAAI,OAAO,KAAK,KAAK,CAAC,CAAC,QAAQ,KAAK,QAAQ;CAC5C,IAAI,UAAU,UAAU,YACtB,KAAK,SAAS;EACZ,GAAG,eAAe;GAAE,GAAG,UAAU;GAAQ,YAAY,KAAA;EAAU,CAAC;EAChE,UAAU;CACZ;CACF,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"spec.js","names":[],"sources":["../../src/behaviours/spec.ts"],"sourcesContent":["import { omitBy } from 'es-toolkit/object'\n\nimport type { SceneGraph } from '../graph'\nimport type { ComponentPropertyDefinition, SceneNode } from '../types'\nimport { motionFromSpec, motionToSpec } from '../variables/motion'\nimport { behaviourContract, hasInvalidState } from './kinds'\nimport { behaviourProperties, emptyBehaviour, guessInteractionStates, textBinding } from './model'\nimport { isNumberRange, type Behaviour, type BehaviourSpec } from './schema'\nimport { defaultTransition } from './transition'\n\n/** Variant values that usually mean on, compared case-insensitively. */\nconst ON_NAMES = ['on', 'true', 'yes', 'checked', 'pressed', 'open', 'selected', 'active']\nconst OFF_NAMES = ['off', 'false', 'no', 'unchecked', 'closed', 'default', 'inactive']\n\nfunction named(names: readonly string[], options: readonly string[]): string | undefined {\n return options.find((option) => names.includes(option.trim().toLowerCase()))\n}\n\n/**\n * The variant values that likely mean on and off: names such as On, True, or Checked first,\n * then the values in order.\n */\nexport function guessOnOff(\n options: readonly string[],\n explicit: { on?: string; off?: string } = {}\n): { on?: string; off?: string } {\n const on = explicit.on ?? named(ON_NAMES, options) ?? options[0]\n const off = explicit.off ?? named(OFF_NAMES, options) ?? options.find((option) => option !== on)\n return { on, off }\n}\n\nfunction findProperty(\n properties: readonly ComponentPropertyDefinition[],\n name: string,\n types: readonly ComponentPropertyDefinition['type'][],\n what: string\n): ComponentPropertyDefinition {\n const found = properties.find((item) => item.name === name && types.includes(item.type))\n if (found) return found\n const available = properties.filter((item) => types.includes(item.type)).map((item) => item.name)\n throw new Error(\n `${what} needs a ${types.join(' or ')} property named \"${name}\"; the component has ${\n available.length ? available.map((item) => `\"${item}\"`).join(', ') : 'none'\n }`\n )\n}\n\ntype ValueBinding = NonNullable<BehaviourSpec['values']>[string]\ntype StatesSpec = NonNullable<BehaviourSpec['states']>\n\nfunction listed(items: readonly { id: string }[]): string {\n return items.map((item) => `\"${item.id}\"`).join(', ')\n}\n\n/** Bind a boolean or text value to the property named in its binding. */\nfunction resolveValue(\n behaviour: Behaviour,\n properties: readonly ComponentPropertyDefinition[],\n valueId: string,\n binding: ValueBinding\n): void {\n const contract = behaviourContract(behaviour.kind)\n const bindable = contract.values.filter((item) => item.type === 'boolean' || item.type === 'text')\n const value = bindable.find((item) => item.id === valueId)\n if (!value)\n throw new Error(\n `A ${behaviour.kind} has no boolean or text value \"${valueId}\"; it has ${listed(bindable)}`\n )\n const name = typeof binding === 'string' ? binding : binding.property\n if (value.type === 'text') {\n behaviour.texts[valueId] = { propertyId: findProperty(properties, name, ['TEXT'], valueId).id }\n return\n }\n const definition = findProperty(properties, name, ['VARIANT', 'BOOLEAN'], valueId)\n if (definition.type === 'BOOLEAN') {\n behaviour.booleans[valueId] = { propertyId: definition.id }\n return\n }\n const options = definition.variantOptions ?? []\n const explicit: { on?: string; off?: string } = typeof binding === 'string' ? {} : binding\n const { on, off } = guessOnOff(options, explicit)\n for (const choice of [on, off])\n if (choice !== undefined && !options.includes(choice))\n throw new Error(`\"${definition.name}\" has no value \"${choice}\"; it has ${options.join(', ')}`)\n behaviour.booleans[valueId] = { propertyId: definition.id, on, off }\n}\n\nfunction resolveStates(\n behaviour: Behaviour,\n properties: readonly ComponentPropertyDefinition[],\n states: StatesSpec\n): void {\n const name = typeof states === 'string' ? states : states.property\n const definition = findProperty(properties, name, ['VARIANT'], 'states')\n const guessed = guessInteractionStates(\n behaviour.kind,\n definition.id,\n definition.variantOptions ?? []\n )\n if (typeof states === 'string') {\n behaviour.states = guessed\n return\n }\n const { property: _property, ...values } = states\n if (values.invalid !== undefined && !hasInvalidState(behaviour.kind))\n throw new Error(`A ${behaviour.kind} has no invalid state`)\n behaviour.states = { ...guessed, ...stripUndefined(values) }\n}\n\n/**\n * The stored behaviour for a spec, with names resolved to the owner's property and slot ids. A\n * name the component lacks, a value the kind does not have, or a variant value the property\n * does not offer fails with a message naming what exists.\n */\nexport function behaviourFromSpec(\n graph: SceneGraph,\n owner: SceneNode,\n spec: BehaviourSpec\n): Behaviour {\n const contract = behaviourContract(spec.kind)\n const properties = behaviourProperties(graph, owner)\n const behaviour = emptyBehaviour(spec.kind)\n for (const [valueId, binding] of Object.entries(spec.values ?? {}))\n resolveValue(behaviour, properties, valueId, binding)\n const numbers = contract.values.filter((item) => item.type === 'number')\n for (const [valueId, settings] of Object.entries(spec.numbers ?? {})) {\n if (!numbers.some((item) => item.id === valueId))\n throw new Error(`A ${spec.kind} has no number value \"${valueId}\"; it has ${listed(numbers)}`)\n const range = { ...behaviour.numbers[valueId], ...stripUndefined(settings) }\n if (!isNumberRange(range))\n throw new Error(`\"${valueId}\" needs max above min and a positive step`)\n behaviour.numbers[valueId] = range\n }\n for (const [partId, slotName] of Object.entries(spec.parts ?? {})) {\n if (!contract.parts.some((item) => item.id === partId))\n throw new Error(`A ${spec.kind} has no part \"${partId}\"; it has ${listed(contract.parts)}`)\n const id = findProperty(properties, slotName, ['SLOT'], partId).id\n const taken = Object.entries(behaviour.parts).find(([, slot]) => slot === id)?.[0]\n if (taken) throw new Error(`\"${slotName}\" is already the ${taken}; a slot draws one part`)\n behaviour.parts[partId] = id\n }\n if (spec.states !== undefined) resolveStates(behaviour, properties, spec.states)\n if (spec.transition)\n behaviour.transition = motionFromSpec(graph, spec.transition, defaultTransition())\n return behaviour\n}\n\nfunction stripUndefined<T extends Record<string, unknown>>(record: T): Partial<T> {\n return omitBy(record, (value) => value === undefined)\n}\n\n/** The spec a stored behaviour reads as, with ids back to names; unresolved bindings are left out. */\nexport function behaviourToSpec(\n graph: SceneGraph,\n owner: SceneNode,\n behaviour: Behaviour\n): BehaviourSpec {\n const properties = behaviourProperties(graph, owner)\n const nameOf = (id: string | undefined) => properties.find((item) => item.id === id)?.name\n const values: NonNullable<BehaviourSpec['values']> = {}\n for (const [valueId, binding] of Object.entries(behaviour.booleans)) {\n const name = nameOf(binding.propertyId)\n if (name)\n values[valueId] =\n binding.on || binding.off ? { property: name, on: binding.on, off: binding.off } : name\n }\n for (const valueId of Object.keys(behaviour.texts)) {\n const name = nameOf(textBinding(behaviour, valueId))\n if (name) values[valueId] = name\n }\n const parts = Object.fromEntries(\n Object.entries(behaviour.parts).flatMap(([partId, id]) => {\n const name = nameOf(id)\n return name ? [[partId, name]] : []\n })\n )\n const statesName = nameOf(behaviour.states?.propertyId)\n const spec: BehaviourSpec = { kind: behaviour.kind }\n if (Object.keys(values).length) spec.values = values\n if (Object.keys(behaviour.numbers).length) spec.numbers = structuredClone(behaviour.numbers)\n if (Object.keys(parts).length) spec.parts = parts\n if (behaviour.states && statesName)\n spec.states = {\n ...stripUndefined({ ...behaviour.states, propertyId: undefined }),\n property: statesName\n }\n if (behaviour.transition) spec.transition = motionToSpec(graph, behaviour.transition)\n return spec\n}\n"],"mappings":";;;;;;;;AAWA,MAAM,WAAW;CAAC;CAAM;CAAQ;CAAO;CAAW;CAAW;CAAQ;CAAY;AAAQ;AACzF,MAAM,YAAY;CAAC;CAAO;CAAS;CAAM;CAAa;CAAU;CAAW;AAAU;AAErF,SAAS,MAAM,OAA0B,SAAgD;CACvF,OAAO,QAAQ,MAAM,WAAW,MAAM,SAAS,OAAO,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC;AAC7E;;;;;AAMA,SAAgB,WACd,SACA,WAA0C,CAAC,GACZ;CAC/B,MAAM,KAAK,SAAS,MAAM,MAAM,UAAU,OAAO,KAAK,QAAQ;CAE9D,OAAO;EAAE;EAA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.js";
|
|
3
|
+
import { Behaviour, BehaviourTransition } from "./schema.js";
|
|
4
|
+
/** What a control's state change plays: a duration in seconds and an easing. */
|
|
5
|
+
export type ResolvedTransition = ResolvedMotion;
|
|
6
|
+
/** The transition a behaviour starts with when one is added: Figma's Smart animate default. */
|
|
7
|
+
export declare function defaultTransition(): BehaviourTransition;
|
|
8
|
+
/**
|
|
9
|
+
* The transition `node` plays, an instance of the behaviour's component: each variable read in the
|
|
10
|
+
* modes the node is in, and the behaviour's own value where the variable is gone or gives nothing.
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveTransition(graph: SceneGraph, behaviour: Behaviour, nodeId: string): ResolvedTransition | undefined;
|
|
13
|
+
/** The variables a behaviour's transition follows. */
|
|
14
|
+
export declare function transitionVariableIds(behaviour: Behaviour): string[];
|
|
15
|
+
/**
|
|
16
|
+
* The behaviour with its transition following other variables, as a copy into another document
|
|
17
|
+
* or a file's own IDs name them; a variable `map` gives nothing for is let go, keeping the value.
|
|
18
|
+
*/
|
|
19
|
+
export declare function mapTransitionVariables(behaviour: Behaviour, map: (variableId: string) => string | undefined): Behaviour;
|
|
20
|
+
//# sourceMappingURL=transition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transition.d.ts","names":[],"sources":["../../src/behaviours/transition.ts"],"mappings":";;;;YAWY,qBAAqB;;wBAGjB,qBAAqB;;;;;wBAQrB,kBACd,OAAO,YACP,WAAW,WACX,iBACC;;wBAKa,sBAAsB,WAAW;;;;;wBAQjC,uBACd,WAAW,WACX,MAAM,4CACL"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { easingPreset } from "../variables/easing.js";
|
|
2
|
+
import { mapMotionVariables, motionVariableIds, resolveMotion } from "../variables/motion.js";
|
|
3
|
+
// src/behaviours/transition.ts
|
|
4
|
+
/** The transition a behaviour starts with when one is added: Figma's Smart animate default. */
|
|
5
|
+
function defaultTransition() {
|
|
6
|
+
return {
|
|
7
|
+
duration: .3,
|
|
8
|
+
easing: easingPreset("OUT_CUBIC")
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The transition `node` plays, an instance of the behaviour's component: each variable read in the
|
|
13
|
+
* modes the node is in, and the behaviour's own value where the variable is gone or gives nothing.
|
|
14
|
+
*/
|
|
15
|
+
function resolveTransition(graph, behaviour, nodeId) {
|
|
16
|
+
return behaviour.transition && resolveMotion(graph, behaviour.transition, nodeId);
|
|
17
|
+
}
|
|
18
|
+
/** The variables a behaviour's transition follows. */
|
|
19
|
+
function transitionVariableIds(behaviour) {
|
|
20
|
+
return behaviour.transition ? motionVariableIds(behaviour.transition) : [];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The behaviour with its transition following other variables, as a copy into another document
|
|
24
|
+
* or a file's own IDs name them; a variable `map` gives nothing for is let go, keeping the value.
|
|
25
|
+
*/
|
|
26
|
+
function mapTransitionVariables(behaviour, map) {
|
|
27
|
+
if (!behaviour.transition) return behaviour;
|
|
28
|
+
return {
|
|
29
|
+
...behaviour,
|
|
30
|
+
transition: mapMotionVariables(behaviour.transition, map)
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export { defaultTransition, mapTransitionVariables, resolveTransition, transitionVariableIds };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=transition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transition.js","names":[],"sources":["../../src/behaviours/transition.ts"],"sourcesContent":["import type { SceneGraph } from '../graph'\nimport { easingPreset } from '../variables/easing'\nimport {\n mapMotionVariables,\n motionVariableIds,\n resolveMotion,\n type ResolvedMotion\n} from '../variables/motion'\nimport type { Behaviour, BehaviourTransition } from './schema'\n\n/** What a control's state change plays: a duration in seconds and an easing. */\nexport type ResolvedTransition = ResolvedMotion\n\n/** The transition a behaviour starts with when one is added: Figma's Smart animate default. */\nexport function defaultTransition(): BehaviourTransition {\n return { duration: 0.3, easing: easingPreset('OUT_CUBIC') }\n}\n\n/**\n * The transition `node` plays, an instance of the behaviour's component: each variable read in the\n * modes the node is in, and the behaviour's own value where the variable is gone or gives nothing.\n */\nexport function resolveTransition(\n graph: SceneGraph,\n behaviour: Behaviour,\n nodeId: string\n): ResolvedTransition | undefined {\n return behaviour.transition && resolveMotion(graph, behaviour.transition, nodeId)\n}\n\n/** The variables a behaviour's transition follows. */\nexport function transitionVariableIds(behaviour: Behaviour): string[] {\n return behaviour.transition ? motionVariableIds(behaviour.transition) : []\n}\n\n/**\n * The behaviour with its transition following other variables, as a copy into another document\n * or a file's own IDs name them; a variable `map` gives nothing for is let go, keeping the value.\n */\nexport function mapTransitionVariables(\n behaviour: Behaviour,\n map: (variableId: string) => string | undefined\n): Behaviour {\n if (!behaviour.transition) return behaviour\n return { ...behaviour, transition: mapMotionVariables(behaviour.transition, map) }\n}\n"],"mappings":";;;;AAcA,SAAgB,oBAAyC;CACvD,OAAO;EAAE,UAAU;EAAK,QAAQ,aAAa,WAAW;CAAE;AAC5D;;;;;AAMA,SAAgB,kBACd,OACA,WACA,QACgC;CAChC,OAAO,UAAU,cAAc,cAAc,OAAO,UAAU,YAAY,MAAM;AAClF;;AAGA,SAAgB,sBAAsB,WAAgC;CACpE,OAAO,UAAU,aAAa,kBAAkB,UAAU,UAAU,IAAI,CAAC;AAC3E;;;;;AAMA,SAAgB,uBACd,WACA,KACW;CACX,IAAI,CAAC,UAAU,YAAY,OAAO;CAClC,OAAO;EAAE,GAAG;EAAW,YAAY,mBAAmB,UAAU,YAAY,GAAG;CAAE;AACnF"}
|
package/dist/bindings.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { effectBindableProperties, effectBindingTarget } from "./variables/fields.js";
|
|
2
1
|
import { omit } from "es-toolkit/object";
|
|
3
|
-
|
|
2
|
+
import { effectBindableProperties, effectBindingTarget } from "./variables/fields.js";
|
|
3
|
+
// src/bindings.ts
|
|
4
4
|
/** Whether an effect binding names a property its effect still has: a blur binds only radius. */
|
|
5
5
|
function bindsEffectProperty(node, key) {
|
|
6
6
|
const target = effectBindingTarget(key);
|
|
@@ -20,7 +20,6 @@ function removeStaleBindings(node, field, changes) {
|
|
|
20
20
|
node.boundVariables = omit(node.boundVariables, stale);
|
|
21
21
|
changes.boundVariables = { ...node.boundVariables };
|
|
22
22
|
}
|
|
23
|
-
//#endregion
|
|
24
23
|
export { removeStaleBindings };
|
|
25
24
|
|
|
26
25
|
//# sourceMappingURL=bindings.js.map
|
package/dist/blur.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Effect } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The blur radius Figma draws: a negative one, which only a bound variable can give, draws as no
|
|
4
|
+
* blur, though the layer keeps the value.
|
|
5
|
+
*/
|
|
6
|
+
export declare function drawnBlurRadius(radius: number): number;
|
|
7
|
+
/**
|
|
8
|
+
* The widest radius an effect blurs by: its radius, or the larger end of a progressive blur,
|
|
9
|
+
* which can start wider than it ends. Bounds and padding that must hold the whole blur use it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function widestBlurRadius(effect: Pick<Effect, 'radius' | 'progressive'>): number;
|
|
12
|
+
/**
|
|
13
|
+
* The Gaussian sigma that draws a Figma blur radius as Figma does. Measured on Figma 126 exports,
|
|
14
|
+
* layer blur, both shadows, and background blur fall off as a Gaussian of 0.43 × radius; Figma's
|
|
15
|
+
* SVG export writes radius / 2, which is wider (`packages/core/tests/canvas/blur.test.ts`).
|
|
16
|
+
*/
|
|
17
|
+
export declare function blurSigma(radius: number): number;
|
|
18
|
+
/**
|
|
19
|
+
* How far past what it blurs a Gaussian of `sigma` leaves ink on screen: where Skia's kernel
|
|
20
|
+
* ends, and one more pixel holds its rounding.
|
|
21
|
+
*/
|
|
22
|
+
export declare function kernelReach(sigma: number): number;
|
|
23
|
+
/** How far past what it blurs a Figma blur of `radius` leaves ink on screen (`kernelReach`). */
|
|
24
|
+
export declare function blurReach(radius: number): number;
|
|
25
|
+
/**
|
|
26
|
+
* How far past its shape a drop shadow of `radius` and colour alpha `alpha` leaves ink on
|
|
27
|
+
* screen. Skia blurs the shape into an 8-bit mask and scales it by `alpha`, so a mask level shows
|
|
28
|
+
* once `alpha` times it rounds to a level: an opaque or half-opaque shadow shows its faintest
|
|
29
|
+
* level, out to where the kernel ends, and a fainter one ends sooner. Measured on CPU raster, the
|
|
30
|
+
* ink ends at 3.0 sigma for alpha 1 and 0.5, 2.4 for 0.25, and 2.1 for 0.1.
|
|
31
|
+
*/
|
|
32
|
+
export declare function shadowReach(radius: number, alpha: number): number;
|
|
33
|
+
/** The Figma blur radius that draws a Gaussian of `sigma`, the inverse of `blurSigma`. */
|
|
34
|
+
export declare function blurRadiusForSigma(sigma: number): number;
|
|
35
|
+
//# sourceMappingURL=blur.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blur.d.ts","names":[],"sources":["../src/blur.ts"],"mappings":";;;;;wBAMgB,gBAAgB;;;;;wBAQhB,iBAAiB,QAAQ,KAAK;;;;;;wBAW9B,UAAU;;;;;wBAWV,YAAY;;wBAKZ,UAAU;;;;;;;;wBAiCV,YAAY,gBAAgB;;wBAW5B,mBAAmB"}
|
package/dist/blur.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// src/blur.ts
|
|
2
|
+
/**
|
|
3
|
+
* The blur radius Figma draws: a negative one, which only a bound variable can give, draws as no
|
|
4
|
+
* blur, though the layer keeps the value.
|
|
5
|
+
*/
|
|
6
|
+
function drawnBlurRadius(radius) {
|
|
7
|
+
return Math.max(0, radius);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The widest radius an effect blurs by: its radius, or the larger end of a progressive blur,
|
|
11
|
+
* which can start wider than it ends. Bounds and padding that must hold the whole blur use it.
|
|
12
|
+
*/
|
|
13
|
+
function widestBlurRadius(effect) {
|
|
14
|
+
return Math.max(effect.radius, effect.progressive?.startRadius ?? effect.radius);
|
|
15
|
+
}
|
|
16
|
+
const BLUR_SIGMA_PER_RADIUS = .43;
|
|
17
|
+
/**
|
|
18
|
+
* The Gaussian sigma that draws a Figma blur radius as Figma does. Measured on Figma 126 exports,
|
|
19
|
+
* layer blur, both shadows, and background blur fall off as a Gaussian of 0.43 × radius; Figma's
|
|
20
|
+
* SVG export writes radius / 2, which is wider (`packages/core/tests/canvas/blur.test.ts`).
|
|
21
|
+
*/
|
|
22
|
+
function blurSigma(radius) {
|
|
23
|
+
return drawnBlurRadius(radius) * BLUR_SIGMA_PER_RADIUS;
|
|
24
|
+
}
|
|
25
|
+
/** Skia's Gaussian kernels end at 3 sigma. */
|
|
26
|
+
const KERNEL_SIGMAS = 3;
|
|
27
|
+
/**
|
|
28
|
+
* How far past what it blurs a Gaussian of `sigma` leaves ink on screen: where Skia's kernel
|
|
29
|
+
* ends, and one more pixel holds its rounding.
|
|
30
|
+
*/
|
|
31
|
+
function kernelReach(sigma) {
|
|
32
|
+
return sigma > 0 ? Math.ceil(KERNEL_SIGMAS * sigma) + 1 : 0;
|
|
33
|
+
}
|
|
34
|
+
/** How far past what it blurs a Figma blur of `radius` leaves ink on screen (`kernelReach`). */
|
|
35
|
+
function blurReach(radius) {
|
|
36
|
+
return kernelReach(blurSigma(radius));
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The distance, in sigmas, past a straight edge blurred by a Gaussian at which the edge's share
|
|
40
|
+
* drops to `share`: the inverse of the normal tail Q, by Abramowitz and Stegun 26.2.23, which is
|
|
41
|
+
* within 0.00045 of it.
|
|
42
|
+
*/
|
|
43
|
+
function gaussianTailDistance(share) {
|
|
44
|
+
if (share <= 0) return Number.POSITIVE_INFINITY;
|
|
45
|
+
if (share >= .5) return 0;
|
|
46
|
+
const s = Math.sqrt(-2 * Math.log(share));
|
|
47
|
+
return s - (2.515517 + .802853 * s + .010328 * s * s) / (1 + 1.432788 * s + .189269 * s * s + .001308 * s * s * s);
|
|
48
|
+
}
|
|
49
|
+
const COLOR_LEVELS = 255;
|
|
50
|
+
/**
|
|
51
|
+
* How far past its shape a drop shadow of `radius` and colour alpha `alpha` leaves ink on
|
|
52
|
+
* screen. Skia blurs the shape into an 8-bit mask and scales it by `alpha`, so a mask level shows
|
|
53
|
+
* once `alpha` times it rounds to a level: an opaque or half-opaque shadow shows its faintest
|
|
54
|
+
* level, out to where the kernel ends, and a fainter one ends sooner. Measured on CPU raster, the
|
|
55
|
+
* ink ends at 3.0 sigma for alpha 1 and 0.5, 2.4 for 0.25, and 2.1 for 0.1.
|
|
56
|
+
*/
|
|
57
|
+
function shadowReach(radius, alpha) {
|
|
58
|
+
const sigma = blurSigma(radius);
|
|
59
|
+
const faintestShownLevel = Math.ceil(.5 / Math.max(alpha, 1 / COLOR_LEVELS));
|
|
60
|
+
const sigmas = Math.min(KERNEL_SIGMAS, gaussianTailDistance((faintestShownLevel - 1) / COLOR_LEVELS));
|
|
61
|
+
return Math.ceil(sigmas * sigma) + 1;
|
|
62
|
+
}
|
|
63
|
+
/** The Figma blur radius that draws a Gaussian of `sigma`, the inverse of `blurSigma`. */
|
|
64
|
+
function blurRadiusForSigma(sigma) {
|
|
65
|
+
return Math.max(0, sigma) / BLUR_SIGMA_PER_RADIUS;
|
|
66
|
+
}
|
|
67
|
+
export { blurRadiusForSigma, blurReach, blurSigma, drawnBlurRadius, kernelReach, shadowReach, widestBlurRadius };
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=blur.js.map
|
package/dist/blur.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blur.js","names":[],"sources":["../src/blur.ts"],"sourcesContent":["import type { Effect } from './types'\n\n/**\n * The blur radius Figma draws: a negative one, which only a bound variable can give, draws as no\n * blur, though the layer keeps the value.\n */\nexport function drawnBlurRadius(radius: number): number {\n return Math.max(0, radius)\n}\n\n/**\n * The widest radius an effect blurs by: its radius, or the larger end of a progressive blur,\n * which can start wider than it ends. Bounds and padding that must hold the whole blur use it.\n */\nexport function widestBlurRadius(effect: Pick<Effect, 'radius' | 'progressive'>): number {\n return Math.max(effect.radius, effect.progressive?.startRadius ?? effect.radius)\n}\n\nconst BLUR_SIGMA_PER_RADIUS = 0.43\n\n/**\n * The Gaussian sigma that draws a Figma blur radius as Figma does. Measured on Figma 126 exports,\n * layer blur, both shadows, and background blur fall off as a Gaussian of 0.43 × radius; Figma's\n * SVG export writes radius / 2, which is wider (`packages/core/tests/canvas/blur.test.ts`).\n */\nexport function blurSigma(radius: number): number {\n return drawnBlurRadius(radius) * BLUR_SIGMA_PER_RADIUS\n}\n\n/** Skia's Gaussian kernels end at 3 sigma. */\nconst KERNEL_SIGMAS = 3\n\n/**\n * How far past what it blurs a Gaussian of `sigma` leaves ink on screen: where Skia's kernel\n * ends, and one more pixel holds its rounding.\n */\nexport function kernelReach(sigma: number): number {\n return sigma > 0 ? Math.ceil(KERNEL_SIGMAS * sigma) + 1 : 0\n}\n\n/** How far past what it blurs a Figma blur of `radius` leaves ink on screen (`kernelReach`). */\nexport function blurReach(radius: number): number {\n return kernelReach(blurSigma(radius))\n}\n\n/**\n * The distance, in sigmas, past a straight edge blurred by a Gaussian at which the edge's share\n * drops to `share`: the inverse of the normal tail Q, by Abramowitz and Stegun 26.2.23, which is\n * within 0.00045 of it.\n */\nfunction gaussianTailDistance(share: number): number {\n if (share <= 0) {\n return Number.POSITIVE_INFINITY\n }\n if (share >= 0.5) {\n return 0\n }\n const s = Math.sqrt(-2 * Math.log(share))\n return (\n s -\n (2.515517 + 0.802853 * s + 0.010328 * s * s) /\n (1 + 1.432788 * s + 0.189269 * s * s + 0.001308 * s * s * s)\n )\n}\n\nconst COLOR_LEVELS = 255\n\n/**\n * How far past its shape a drop shadow of `radius` and colour alpha `alpha` leaves ink on\n * screen. Skia blurs the shape into an 8-bit mask and scales it by `alpha`, so a mask level shows\n * once `alpha` times it rounds to a level: an opaque or half-opaque shadow shows its faintest\n * level, out to where the kernel ends, and a fainter one ends sooner. Measured on CPU raster, the\n * ink ends at 3.0 sigma for alpha 1 and 0.5, 2.4 for 0.25, and 2.1 for 0.1.\n */\nexport function shadowReach(radius: number, alpha: number): number {\n const sigma = blurSigma(radius)\n const faintestShownLevel = Math.ceil(0.5 / Math.max(alpha, 1 / COLOR_LEVELS))\n const sigmas = Math.min(\n KERNEL_SIGMAS,\n gaussianTailDistance((faintestShownLevel - 1) / COLOR_LEVELS)\n )\n return Math.ceil(sigmas * sigma) + 1\n}\n\n/** The Figma blur radius that draws a Gaussian of `sigma`, the inverse of `blurSigma`. */\nexport function blurRadiusForSigma(sigma: number): number {\n return Math.max(0, sigma) / BLUR_SIGMA_PER_RADIUS\n}\n"],"mappings":";;;;;AAMA,SAAgB,gBAAgB,QAAwB;CACtD,OAAO,KAAK,IAAI,GAAG,MAAM;AAC3B;;;;;AAMA,SAAgB,iBAAiB,QAAwD;CACvF,OAAO,KAAK,IAAI,OAAO,QAAQ,OAAO,aAAa,eAAe,OAAO,MAAM;AACjF;AAEA,MAAM,wBAAwB;;;;;;AAO9B,SAAgB,UAAU,QAAwB;CAChD,OAAO,gBAAgB,MAAM,IAAI;AACnC;;AAGA,MAAM,gBAAgB;;;;;AAMtB,SAAgB,YAAY,OAAuB;CACjD,OAAO,QAAQ,IAAI,KAAK,KAAK,gBAAgB,KAAK,IAAI,IAAI;AAC5D;;AAGA,SAAgB,UAAU,QAAwB;CAChD,OAAO,YAAY,UAAU,MAAM,CAAC;AACtC;;;;;;AAOA,SAAS,qBAAqB,OAAuB;CACnD,IAAI,SAAS,GACX,OAAO,OAAO;CAEhB,IAAI,SAAS,IACX,OAAO;CAET,MAAM,IAAI,KAAK,KAAK,KAAK,KAAK,IAAI,KAAK,CAAC;CACxC,OACE,KACC,WAAW,UAAW,IAAI,UAAW,IAAI,MACvC,IAAI,WAAW,IAAI,UAAW,IAAI,IAAI,UAAW,IAAI,IAAI;AAEhE;AAEA,MAAM,eAAe;;;;;;;;AASrB,SAAgB,YAAY,QAAgB,OAAuB;CACjE,MAAM,QAAQ,UAAU,MAAM;CAC9B,MAAM,qBAAqB,KAAK,KAAK,KAAM,KAAK,IAAI,OAAO,IAAI,YAAY,CAAC;CAC5E,MAAM,SAAS,KAAK,IAClB,eACA,sBAAsB,qBAAqB,KAAK,YAAY,CAC9D;CACA,OAAO,KAAK,KAAK,SAAS,KAAK,IAAI;AACrC;;AAGA,SAAgB,mBAAmB,OAAuB;CACxD,OAAO,KAAK,IAAI,GAAG,KAAK,IAAI;AAC9B"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { SceneGraphEvents } from "./types.js";
|
|
2
1
|
import { Emitter } from "nanoevents";
|
|
3
|
-
|
|
4
|
-
declare class CommittedGraphEventError extends AggregateError {
|
|
2
|
+
import { SceneGraphEvents } from "./types.js";
|
|
3
|
+
export declare class CommittedGraphEventError extends AggregateError {
|
|
5
4
|
readonly committed = true;
|
|
6
5
|
constructor(errors: readonly unknown[]);
|
|
7
6
|
}
|
|
8
7
|
/** Stable emitter identity with synchronous, nestable event buffering. */
|
|
9
|
-
declare class BufferedSceneEmitter implements Emitter<SceneGraphEvents> {
|
|
8
|
+
export declare class BufferedSceneEmitter implements Emitter<SceneGraphEvents> {
|
|
10
9
|
private readonly delegate;
|
|
11
10
|
private readonly buffers;
|
|
12
11
|
get events(): Emitter<SceneGraphEvents>['events'];
|
|
@@ -16,6 +15,4 @@ declare class BufferedSceneEmitter implements Emitter<SceneGraphEvents> {
|
|
|
16
15
|
/** Buffers events, not mutations. Callers own rollback if the action throws. */
|
|
17
16
|
batch<T>(action: () => T): T;
|
|
18
17
|
}
|
|
19
|
-
//#endregion
|
|
20
|
-
export { BufferedSceneEmitter, CommittedGraphEventError };
|
|
21
18
|
//# sourceMappingURL=buffered-events.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffered-events.d.ts","names":[],"sources":["../src/buffered-events.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"buffered-events.d.ts","names":[],"sources":["../src/buffered-events.ts"],"mappings":";;qBAIa,iCAAiC;WACnC;EAEG,YAAA;;;qBAOD,gCAAgC,QAAQ;mBAClC;mBACA;MAEb,UAAU,QAAQ;MAIlB,OAAO,QAAQ,QAAQ;EAI3B,GAAG,gBAAgB,kBAAkB,OAAO,GAAG,UAAU,iBAAiB,0BAAE;EAI5E,KAAK,gBAAgB,kBAAkB,OAAO,MAAM,MAAM,WAAW,iBAAiB;;EAOtF,MAAM,GAAG,cAAc,IAAI"}
|
package/dist/buffered-events.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createNanoEvents } from "nanoevents";
|
|
2
|
-
|
|
2
|
+
// src/buffered-events.ts
|
|
3
3
|
var CommittedGraphEventError = class extends AggregateError {
|
|
4
4
|
committed = true;
|
|
5
5
|
constructor(errors) {
|
|
@@ -51,7 +51,6 @@ var BufferedSceneEmitter = class {
|
|
|
51
51
|
return result;
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
-
//#endregion
|
|
55
54
|
export { BufferedSceneEmitter, CommittedGraphEventError };
|
|
56
55
|
|
|
57
56
|
//# sourceMappingURL=buffered-events.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffered-events.js","names":[],"sources":["../src/buffered-events.ts"],"sourcesContent":["import { createNanoEvents, type Emitter } from 'nanoevents'\n\nimport type { SceneGraphEvents } from './types'\n\nexport class CommittedGraphEventError extends AggregateError {\n readonly committed = true\n\n constructor(errors: readonly unknown[]) {\n super(errors, 'Committed graph event delivery failed')\n this.name = 'CommittedGraphEventError'\n }\n}\n\n/** Stable emitter identity with synchronous, nestable event buffering. */\nexport class BufferedSceneEmitter implements Emitter<SceneGraphEvents> {\n private readonly delegate = createNanoEvents<SceneGraphEvents>()\n private readonly buffers: Array<Array<() => void>> = []\n\n get events(): Emitter<SceneGraphEvents>['events'] {\n return this.delegate.events\n }\n\n set events(events: Emitter<SceneGraphEvents>['events']) {\n this.delegate.events = events\n }\n\n on<K extends keyof SceneGraphEvents>(event: K, listener: SceneGraphEvents[K]) {\n return this.delegate.on(event, listener)\n }\n\n emit<K extends keyof SceneGraphEvents>(event: K, ...args: Parameters<SceneGraphEvents[K]>): void {\n const buffer = this.buffers.at(-1)\n if (buffer) buffer.push(() => this.delegate.emit(event, ...args))\n else this.delegate.emit(event, ...args)\n }\n\n /** Buffers events, not mutations. Callers own rollback if the action throws. */\n batch<T>(action: () => T): T {\n const pending: Array<() => void> = []\n this.buffers.push(pending)\n let result: T\n try {\n result = action()\n } catch (error) {\n this.buffers.pop()\n throw error\n }\n this.buffers.pop()\n const outer = this.buffers.at(-1)\n // One edit can publish more events than an engine takes arguments.\n if (outer) for (const publish of pending) outer.push(publish)\n else {\n const errors: unknown[] = []\n for (const publish of pending) {\n try {\n publish()\n } catch (error) {\n errors.push(error)\n }\n }\n if (errors.length) throw new CommittedGraphEventError(errors)\n }\n return result\n }\n}\n"],"mappings":";;AAIA,IAAa,2BAAb,cAA8C,eAAe;
|
|
1
|
+
{"version":3,"file":"buffered-events.js","names":[],"sources":["../src/buffered-events.ts"],"sourcesContent":["import { createNanoEvents, type Emitter } from 'nanoevents'\n\nimport type { SceneGraphEvents } from './types'\n\nexport class CommittedGraphEventError extends AggregateError {\n readonly committed = true\n\n constructor(errors: readonly unknown[]) {\n super(errors, 'Committed graph event delivery failed')\n this.name = 'CommittedGraphEventError'\n }\n}\n\n/** Stable emitter identity with synchronous, nestable event buffering. */\nexport class BufferedSceneEmitter implements Emitter<SceneGraphEvents> {\n private readonly delegate = createNanoEvents<SceneGraphEvents>()\n private readonly buffers: Array<Array<() => void>> = []\n\n get events(): Emitter<SceneGraphEvents>['events'] {\n return this.delegate.events\n }\n\n set events(events: Emitter<SceneGraphEvents>['events']) {\n this.delegate.events = events\n }\n\n on<K extends keyof SceneGraphEvents>(event: K, listener: SceneGraphEvents[K]) {\n return this.delegate.on(event, listener)\n }\n\n emit<K extends keyof SceneGraphEvents>(event: K, ...args: Parameters<SceneGraphEvents[K]>): void {\n const buffer = this.buffers.at(-1)\n if (buffer) buffer.push(() => this.delegate.emit(event, ...args))\n else this.delegate.emit(event, ...args)\n }\n\n /** Buffers events, not mutations. Callers own rollback if the action throws. */\n batch<T>(action: () => T): T {\n const pending: Array<() => void> = []\n this.buffers.push(pending)\n let result: T\n try {\n result = action()\n } catch (error) {\n this.buffers.pop()\n throw error\n }\n this.buffers.pop()\n const outer = this.buffers.at(-1)\n // One edit can publish more events than an engine takes arguments.\n if (outer) for (const publish of pending) outer.push(publish)\n else {\n const errors: unknown[] = []\n for (const publish of pending) {\n try {\n publish()\n } catch (error) {\n errors.push(error)\n }\n }\n if (errors.length) throw new CommittedGraphEventError(errors)\n }\n return result\n }\n}\n"],"mappings":";;AAIA,IAAa,2BAAb,cAA8C,eAAe;CAClD,YAAY;CAErB,YAAY,QAA4B;EACtC,MAAM,QAAQ,uCAAuC;EACrD,KAAK,OAAO;CACd;AACF;;AAGA,IAAa,uBAAb,MAAuE;CACpD,WAAW,iBAAmC;CAC9C,UAAoC,CAAC;CAEtD,IAAI,SAA8C;EAChD,OAAO,KAAK,SAAS;CACvB;CAEA,IAAI,OAAO,QAA6C;EACtD,KAAK,SAAS,SAAS;CACzB;CAEA,GAAqC,OAAU,UAA+B;EAC5E,OAAO,KAAK,SAAS,GAAG,OAAO,QAAQ;CACzC;CAEA,KAAuC,OAAU,GAAG,MAA6C;EAC/F,MAAM,SAAS,KAAK,QAAQ,GAAG,EAAE;EACjC,IAAI,QAAQ,OAAO,WAAW,KAAK,SAAS,KAAK,OAAO,GAAG,IAAI,CAAC;OAC3D,KAAK,SAAS,KAAK,OAAO,GAAG,IAAI;CACxC;;CAGA,MAAS,QAAoB;EAC3B,MAAM,UAA6B,CAAC;EACpC,KAAK,QAAQ,KAAK,OAAO;EACzB,IAAI;EACJ,IAAI;GACF,SAAS,OAAO;EAClB,SAAS,OAAO;GACd,KAAK,QAAQ,IAAI;GACjB,MAAM;EACR;EACA,KAAK,QAAQ,IAAI;EACjB,MAAM,QAAQ,KAAK,QAAQ,GAAG,EAAE;EAEhC,IAAI,OAAO,KAAK,MAAM,WAAW,SAAS,MAAM,KAAK,OAAO;OACvD;GACH,MAAM,SAAoB,CAAC;GAC3B,KAAK,MAAM,WAAW,SACpB,IAAI;IACF,QAAQ;GACV,SAAS,OAAO;IACd,OAAO,KAAK,KAAK;GACnB;GAEF,IAAI,OAAO,QAAQ,MAAM,IAAI,yBAAyB,MAAM;EAC9D;EACA,OAAO;CACT;AACF"}
|
package/dist/checkpoint.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { SceneGraph } from "./graph.js";
|
|
2
2
|
import { SceneNode, Variable, VariableCollection } from "./types.js";
|
|
3
|
-
//#region src/checkpoint.d.ts
|
|
4
3
|
/** Capture rollback state without changing graph or surviving object identities. */
|
|
5
|
-
declare function captureGraphCheckpoint(graph: SceneGraph): {
|
|
4
|
+
export declare function captureGraphCheckpoint(graph: SceneGraph): {
|
|
6
5
|
nodes: Map<string, SceneNode>;
|
|
7
6
|
variables: Map<string, Variable>;
|
|
8
7
|
assertPropertiesOnly: () => void;
|
|
@@ -14,7 +13,7 @@ declare function captureGraphCheckpoint(graph: SceneGraph): {
|
|
|
14
13
|
* to change (`SceneGraph.observeNodeChanges`), together with its ancestors below the page, which
|
|
15
14
|
* keep instance override maps the graph writes into in place.
|
|
16
15
|
*/
|
|
17
|
-
interface TouchedCheckpoint {
|
|
16
|
+
export interface TouchedCheckpoint {
|
|
18
17
|
/** Copies of the reported nodes and their ancestors below the page, as they were before. */
|
|
19
18
|
readonly nodes: ReadonlyMap<string, SceneNode>;
|
|
20
19
|
/** Nodes the graph reported changing or creating. */
|
|
@@ -36,7 +35,5 @@ interface TouchedCheckpoint {
|
|
|
36
35
|
* directly calls `SceneGraph.willChangeNode` first, and a node event without such a report fails
|
|
37
36
|
* the edit.
|
|
38
37
|
*/
|
|
39
|
-
declare function captureTouchedCheckpoint(graph: SceneGraph): TouchedCheckpoint;
|
|
40
|
-
//#endregion
|
|
41
|
-
export { TouchedCheckpoint, captureGraphCheckpoint, captureTouchedCheckpoint };
|
|
38
|
+
export declare function captureTouchedCheckpoint(graph: SceneGraph): TouchedCheckpoint;
|
|
42
39
|
//# sourceMappingURL=checkpoint.d.ts.map
|
package/dist/checkpoint.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoint.d.ts","names":[],"sources":["../src/checkpoint.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkpoint.d.ts","names":[],"sources":["../src/checkpoint.ts"],"mappings":";;;wBA+BgB,uBAAuB,OAAO;;;;;;;;;;;;iBAsJ7B;;WAEN,OAAO,oBAAoB;;WAE3B,UAAU;;WAEV,WAAW,oBAAoB;WAC/B,qBAAqB,oBAAoB;;EAElD;;EAEA;;EAEA;;;;;;;;;wBAUc,yBAAyB,OAAO,aAAa"}
|
package/dist/checkpoint.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createSceneMutationImpact, recordSceneMutations } from "./mutation-impact.js";
|
|
2
1
|
import { isEqual } from "es-toolkit";
|
|
3
|
-
|
|
2
|
+
import { createSceneMutationImpact, recordSceneMutations } from "./mutation-impact.js";
|
|
3
|
+
// src/checkpoint.ts
|
|
4
4
|
const NODE_COUNT_ERROR = "Atomic tools must not create or remove nodes or variables";
|
|
5
5
|
const NODE_IDENTITY_ERROR = "Atomic tools must not change node hierarchy or identity";
|
|
6
6
|
const VARIABLE_IDENTITY_ERROR = "Atomic tools must not change variable identity";
|
|
@@ -56,6 +56,7 @@ function captureGraphCheckpoint(graph) {
|
|
|
56
56
|
graph.figSchemaDeflated = structuredClone(snapshot.figSchemaDeflated);
|
|
57
57
|
graph.documentColorSpace = snapshot.documentColorSpace;
|
|
58
58
|
graph.clearAbsPosCache();
|
|
59
|
+
graph.sharedStyleIndex.invalidate();
|
|
59
60
|
for (const [id, node] of failedNodes) if (!graph.nodes.has(id)) graph.emitter.emit("node:deleted", id, node.parentId);
|
|
60
61
|
for (const [id, node] of graph.nodes) if (failedNodes.has(id)) graph.emitter.emit("node:updated", id, node);
|
|
61
62
|
else graph.emitter.emit("node:created", node);
|
|
@@ -244,6 +245,7 @@ function captureTouchedCheckpoint(graph) {
|
|
|
244
245
|
graph.figSchemaDeflated = figSchemaDeflated;
|
|
245
246
|
graph.documentColorSpace = documentColorSpace;
|
|
246
247
|
graph.clearAbsPosCache();
|
|
248
|
+
graph.sharedStyleIndex.invalidate();
|
|
247
249
|
const touched = /* @__PURE__ */ new Set([
|
|
248
250
|
...nodes.keys(),
|
|
249
251
|
...created,
|
|
@@ -273,7 +275,6 @@ function captureTouchedCheckpoint(graph) {
|
|
|
273
275
|
stop
|
|
274
276
|
};
|
|
275
277
|
}
|
|
276
|
-
//#endregion
|
|
277
278
|
export { captureGraphCheckpoint, captureTouchedCheckpoint };
|
|
278
279
|
|
|
279
280
|
//# sourceMappingURL=checkpoint.js.map
|