@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
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { layerMotionAt, trackValueAt } from "./evaluate.js";
|
|
2
|
+
import { presetTracks } from "./presets/index.js";
|
|
3
|
+
// src/motion/keyable.ts
|
|
4
|
+
/**
|
|
5
|
+
* The fields Motion shows a layer with at the playhead and keys when they change, as Figma's
|
|
6
|
+
* Motion panel lists them: where the layer is, how it turns and scales, its size, and opacity.
|
|
7
|
+
*/
|
|
8
|
+
const KEYABLE_FIELDS = [
|
|
9
|
+
"x",
|
|
10
|
+
"y",
|
|
11
|
+
"rotation",
|
|
12
|
+
"scaleX",
|
|
13
|
+
"scaleY",
|
|
14
|
+
"width",
|
|
15
|
+
"height",
|
|
16
|
+
"opacity",
|
|
17
|
+
"cornerRadius"
|
|
18
|
+
];
|
|
19
|
+
const own = (field) => ({
|
|
20
|
+
address: field,
|
|
21
|
+
operation: "SET",
|
|
22
|
+
shown: (_, track) => track,
|
|
23
|
+
stored: (_, shown) => shown,
|
|
24
|
+
rest: (node) => node[field]
|
|
25
|
+
});
|
|
26
|
+
const SPECS = {
|
|
27
|
+
x: {
|
|
28
|
+
address: "motion/translationX",
|
|
29
|
+
operation: "OFFSET",
|
|
30
|
+
shown: (node, track) => node.x + track,
|
|
31
|
+
stored: (node, shown) => shown - node.x,
|
|
32
|
+
rest: () => 0
|
|
33
|
+
},
|
|
34
|
+
y: {
|
|
35
|
+
address: "motion/translationY",
|
|
36
|
+
operation: "OFFSET",
|
|
37
|
+
shown: (node, track) => node.y + track,
|
|
38
|
+
stored: (node, shown) => shown - node.y,
|
|
39
|
+
rest: () => 0
|
|
40
|
+
},
|
|
41
|
+
rotation: {
|
|
42
|
+
address: "motion/rotation",
|
|
43
|
+
operation: "OFFSET",
|
|
44
|
+
shown: (node, track) => node.rotation - track,
|
|
45
|
+
stored: (node, shown) => node.rotation - shown,
|
|
46
|
+
rest: () => 0
|
|
47
|
+
},
|
|
48
|
+
scaleX: {
|
|
49
|
+
address: "motion/scaleX",
|
|
50
|
+
operation: "SCALE",
|
|
51
|
+
shown: (_, track) => track,
|
|
52
|
+
stored: (_, shown) => shown,
|
|
53
|
+
rest: () => 1
|
|
54
|
+
},
|
|
55
|
+
scaleY: {
|
|
56
|
+
address: "motion/scaleY",
|
|
57
|
+
operation: "SCALE",
|
|
58
|
+
shown: (_, track) => track,
|
|
59
|
+
stored: (_, shown) => shown,
|
|
60
|
+
rest: () => 1
|
|
61
|
+
},
|
|
62
|
+
width: own("width"),
|
|
63
|
+
height: own("height"),
|
|
64
|
+
opacity: own("opacity"),
|
|
65
|
+
cornerRadius: own("cornerRadius")
|
|
66
|
+
};
|
|
67
|
+
/** The keyable field a track address keys, or null for a field Motion does not show. */
|
|
68
|
+
function keyableFieldOf(address) {
|
|
69
|
+
return KEYABLE_FIELDS.find((field) => SPECS[field].address === address) ?? null;
|
|
70
|
+
}
|
|
71
|
+
/** The track address a keyable field keys. */
|
|
72
|
+
function keyableAddress(field) {
|
|
73
|
+
return SPECS[field].address;
|
|
74
|
+
}
|
|
75
|
+
const float = (value) => value?.type === "FLOAT" ? value.value : null;
|
|
76
|
+
/** What a keyable field shows at `time`: the layer's own value with its track applied. */
|
|
77
|
+
function keyableValueAt(node, field, time, graph) {
|
|
78
|
+
const spec = SPECS[field];
|
|
79
|
+
const track = float(layerMotionAt(node, time, graph).get(spec.address)) ?? spec.rest(node);
|
|
80
|
+
return spec.shown(node, track);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A track value for `address` with the layer's presets taken off as they stand at `time`: what
|
|
84
|
+
* the layer's own track must hold so that, with its presets applied after it, the field shows
|
|
85
|
+
* `value`. A preset that sets the field outright leaves nothing to take off.
|
|
86
|
+
*/
|
|
87
|
+
function beforePresets(node, address, value, time) {
|
|
88
|
+
let own = value;
|
|
89
|
+
for (const preset of node.motionPresets.toReversed()) {
|
|
90
|
+
const track = presetTracks(preset)[address];
|
|
91
|
+
const at = track ? float(trackValueAt(track, time) ?? void 0) : null;
|
|
92
|
+
if (!track || at === null) continue;
|
|
93
|
+
if (track.operation === "OFFSET") own -= at;
|
|
94
|
+
else if (track.operation === "SCALE" && at !== 0) own /= at;
|
|
95
|
+
}
|
|
96
|
+
return own;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* What keying a field to `shown` at `time` stores: the track, how it applies, and the field at
|
|
100
|
+
* rest. A preset playing then keeps applying to what is stored, so the layer shows `shown`.
|
|
101
|
+
*/
|
|
102
|
+
function keyableTrackValue(node, field, shown, time = 0) {
|
|
103
|
+
const spec = SPECS[field];
|
|
104
|
+
const stored = beforePresets(node, spec.address, spec.stored(node, shown), time);
|
|
105
|
+
return {
|
|
106
|
+
address: spec.address,
|
|
107
|
+
operation: spec.operation,
|
|
108
|
+
value: {
|
|
109
|
+
type: "FLOAT",
|
|
110
|
+
value: stored
|
|
111
|
+
},
|
|
112
|
+
rest: {
|
|
113
|
+
type: "FLOAT",
|
|
114
|
+
value: spec.rest(node)
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
export { KEYABLE_FIELDS, keyableAddress, keyableFieldOf, keyableTrackValue, keyableValueAt };
|
|
119
|
+
|
|
120
|
+
//# sourceMappingURL=keyable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyable.js","names":[],"sources":["../../src/motion/keyable.ts"],"sourcesContent":["import type { SceneGraph } from '../graph'\nimport type { SceneNode } from '../types'\nimport { layerMotionAt, trackValueAt } from './evaluate'\nimport { presetTracks } from './presets'\nimport type { KeyframeOperation, KeyframeTrack, KeyframeValue } from './types'\n\n/**\n * The fields Motion shows a layer with at the playhead and keys when they change, as Figma's\n * Motion panel lists them: where the layer is, how it turns and scales, its size, and opacity.\n */\nexport const KEYABLE_FIELDS = [\n 'x',\n 'y',\n 'rotation',\n 'scaleX',\n 'scaleY',\n 'width',\n 'height',\n 'opacity',\n 'cornerRadius'\n] as const\nexport type KeyableField = (typeof KEYABLE_FIELDS)[number]\n\ninterface KeyableSpec {\n address: string\n operation: KeyframeOperation\n /** What the field shows with the track's value applied to the layer's own. */\n shown: (node: SceneNode, track: number) => number\n /** The track's value for a field shown as `shown`. */\n stored: (node: SceneNode, shown: number) => number\n /** The track's value while nothing animates the field. */\n rest: (node: SceneNode) => number\n}\n\nconst own = (field: 'width' | 'height' | 'opacity' | 'cornerRadius'): KeyableSpec => ({\n address: field,\n operation: 'SET',\n shown: (_, track) => track,\n stored: (_, shown) => shown,\n rest: (node) => node[field]\n})\n\n// Position and rotation key offsets on top of the layer's own, as Figma's tracks do; a rotation\n// track turns counterclockwise, the other way from a layer's own rotation.\nconst SPECS: Record<KeyableField, KeyableSpec> = {\n x: {\n address: 'motion/translationX',\n operation: 'OFFSET',\n shown: (node, track) => node.x + track,\n stored: (node, shown) => shown - node.x,\n rest: () => 0\n },\n y: {\n address: 'motion/translationY',\n operation: 'OFFSET',\n shown: (node, track) => node.y + track,\n stored: (node, shown) => shown - node.y,\n rest: () => 0\n },\n rotation: {\n address: 'motion/rotation',\n operation: 'OFFSET',\n shown: (node, track) => node.rotation - track,\n stored: (node, shown) => node.rotation - shown,\n rest: () => 0\n },\n scaleX: {\n address: 'motion/scaleX',\n operation: 'SCALE',\n shown: (_, track) => track,\n stored: (_, shown) => shown,\n rest: () => 1\n },\n scaleY: {\n address: 'motion/scaleY',\n operation: 'SCALE',\n shown: (_, track) => track,\n stored: (_, shown) => shown,\n rest: () => 1\n },\n width: own('width'),\n height: own('height'),\n opacity: own('opacity'),\n cornerRadius: own('cornerRadius')\n}\n\n/** The keyable field a track address keys, or null for a field Motion does not show. */\nexport function keyableFieldOf(address: string): KeyableField | null {\n return KEYABLE_FIELDS.find((field) => SPECS[field].address === address) ?? null\n}\n\n/** The track address a keyable field keys. */\nexport function keyableAddress(field: KeyableField): string {\n return SPECS[field].address\n}\n\nconst float = (value: KeyframeValue | undefined) => (value?.type === 'FLOAT' ? value.value : null)\n\n/** What a keyable field shows at `time`: the layer's own value with its track applied. */\nexport function keyableValueAt(\n node: SceneNode,\n field: KeyableField,\n time: number,\n graph?: SceneGraph\n): number {\n const spec = SPECS[field]\n const track = float(layerMotionAt(node, time, graph).get(spec.address)) ?? spec.rest(node)\n return spec.shown(node, track)\n}\n\n/**\n * A track value for `address` with the layer's presets taken off as they stand at `time`: what\n * the layer's own track must hold so that, with its presets applied after it, the field shows\n * `value`. A preset that sets the field outright leaves nothing to take off.\n */\nfunction beforePresets(node: SceneNode, address: string, value: number, time: number): number {\n let own = value\n for (const preset of node.motionPresets.toReversed()) {\n const track = presetTracks(preset)[address] as KeyframeTrack | undefined\n const at = track ? float(trackValueAt(track, time) ?? undefined) : null\n if (!track || at === null) continue\n if (track.operation === 'OFFSET') own -= at\n else if (track.operation === 'SCALE' && at !== 0) own /= at\n }\n return own\n}\n\n/**\n * What keying a field to `shown` at `time` stores: the track, how it applies, and the field at\n * rest. A preset playing then keeps applying to what is stored, so the layer shows `shown`.\n */\nexport function keyableTrackValue(node: SceneNode, field: KeyableField, shown: number, time = 0) {\n const spec = SPECS[field]\n const stored = beforePresets(node, spec.address, spec.stored(node, shown), time)\n return {\n address: spec.address,\n operation: spec.operation,\n value: { type: 'FLOAT' as const, value: stored },\n rest: { type: 'FLOAT' as const, value: spec.rest(node) }\n }\n}\n"],"mappings":";;;;;;;AAUA,MAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAcA,MAAM,OAAO,WAAyE;CACpF,SAAS;CACT,WAAW;CACX,QAAQ,GAAG,UAAU;CACrB,SAAS,GAAG,UAAU;CACtB,OAAO,SAAS,KAAK;AACvB;AAIA,MAAM,QAA2C;CAC/C,GAAG;EACD,SAAS;EACT,WAAW;EACX,QAAQ,MAAM,UAAU,KAAK,IAAI;EACjC,SAAS,MAAM,UAAU,QAAQ,KAAK;EACtC,YAAY;CACd;CACA,GAAG;EACD,SAAS;EACT,WAAW;EACX,QAAQ,MAAM,UAAU,KAAK,IAAI;EACjC,SAAS,MAAM,UAAU,QAAQ,KAAK;EACtC,YAAY;CACd;CACA,UAAU;EACR,SAAS;EACT,WAAW;EACX,QAAQ,MAAM,UAAU,KAAK,WAAW;EACxC,SAAS,MAAM,UAAU,KAAK,WAAW;EACzC,YAAY;CACd;CACA,QAAQ;EACN,SAAS;EACT,WAAW;EACX,QAAQ,GAAG,UAAU;EACrB,SAAS,GAAG,UAAU;EACtB,YAAY;CACd;CACA,QAAQ;EACN,SAAS;EACT,WAAW;EACX,QAAQ,GAAG,UAAU;EACrB,SAAS,GAAG,UAAU;EACtB,YAAY;CACd;CACA,OAAO,IAAI,OAAO;CAClB,QAAQ,IAAI,QAAQ;CACpB,SAAS,IAAI,SAAS;CACtB,cAAc,IAAI,cAAc;AAClC;;AAGA,SAAgB,eAAe,SAAsC;CACnE,OAAO,eAAe,MAAM,UAAU,MAAM,MAAM,CAAC,YAAY,OAAO,KAAK;AAC7E;;AAGA,SAAgB,eAAe,OAA6B;CAC1D,OAAO,MAAM,MAAM,CAAC;AACtB;AAEA,MAAM,SAAS,UAAsC,OAAO,SAAS,UAAU,MAAM,QAAQ;;AAG7F,SAAgB,eACd,MACA,OACA,MACA,OACQ;CACR,MAAM,OAAO,MAAM;CACnB,MAAM,QAAQ,MAAM,cAAc,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,KAAK,KAAK,KAAK,IAAI;CACzF,OAAO,KAAK,MAAM,MAAM,KAAK;AAC/B;;;;;;AAOA,SAAS,cAAc,MAAiB,SAAiB,OAAe,MAAsB;CAC5F,IAAI,MAAM;CACV,KAAK,MAAM,UAAU,KAAK,cAAc,WAAW,GAAG;EACpD,MAAM,QAAQ,aAAa,MAAM,CAAC,CAAC;EACnC,MAAM,KAAK,QAAQ,MAAM,aAAa,OAAO,IAAI,KAAK,KAAA,CAAS,IAAI;EACnE,IAAI,CAAC,SAAS,OAAO,MAAM;EAC3B,IAAI,MAAM,cAAc,UAAU,OAAO;OACpC,IAAI,MAAM,cAAc,WAAW,OAAO,GAAG,OAAO;CAC3D;CACA,OAAO;AACT;;;;;AAMA,SAAgB,kBAAkB,MAAiB,OAAqB,OAAe,OAAO,GAAG;CAC/F,MAAM,OAAO,MAAM;CACnB,MAAM,SAAS,cAAc,MAAM,KAAK,SAAS,KAAK,OAAO,MAAM,KAAK,GAAG,IAAI;CAC/E,OAAO;EACL,SAAS,KAAK;EACd,WAAW,KAAK;EAChB,OAAO;GAAE,MAAM;GAAkB,OAAO;EAAO;EAC/C,MAAM;GAAE,MAAM;GAAkB,OAAO,KAAK,KAAK,IAAI;EAAE;CACzD;AACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SceneGraph } from "../graph.js";
|
|
2
|
+
import { SceneNode } from "../types.js";
|
|
3
|
+
import { MotionPreset } from "./presets/settings.js";
|
|
4
|
+
import { KeyframeTrack } from "./types.js";
|
|
5
|
+
/** When something plays on a timeline, in seconds from its start. */
|
|
6
|
+
export interface MotionSpan {
|
|
7
|
+
start: number;
|
|
8
|
+
end: number;
|
|
9
|
+
}
|
|
10
|
+
/** A preset a layer applies, where it sits among the layer's presets, and when it plays. */
|
|
11
|
+
export interface MotionOutlinePreset extends MotionSpan {
|
|
12
|
+
preset: MotionPreset;
|
|
13
|
+
index: number;
|
|
14
|
+
}
|
|
15
|
+
/** A field a layer keys, by the address its track is kept under. */
|
|
16
|
+
export interface MotionOutlineTrack extends MotionSpan {
|
|
17
|
+
address: string;
|
|
18
|
+
track: KeyframeTrack;
|
|
19
|
+
}
|
|
20
|
+
/** A layer that moves on a timeline, with what moves it and when it moves at all. */
|
|
21
|
+
export interface MotionOutlineLayer extends MotionSpan {
|
|
22
|
+
node: SceneNode;
|
|
23
|
+
presets: MotionOutlinePreset[];
|
|
24
|
+
tracks: MotionOutlineTrack[];
|
|
25
|
+
}
|
|
26
|
+
/** When a preset plays: from its offset for its duration, its kind's default if it sets none. */
|
|
27
|
+
export declare function presetSpan(preset: MotionPreset): MotionSpan;
|
|
28
|
+
/** A layer's motion as a timeline shows it: its presets, keyed fields, and when it moves at all. */
|
|
29
|
+
export declare function motionLayerOutline(node: SceneNode): MotionOutlineLayer;
|
|
30
|
+
/**
|
|
31
|
+
* The layers under `rootId` that move on its timeline, each with its presets and keyed fields,
|
|
32
|
+
* topmost first as a layers list shows them. The root itself is left out: it holds the timeline.
|
|
33
|
+
*/
|
|
34
|
+
export declare function motionOutline(graph: SceneGraph, rootId: string): MotionOutlineLayer[];
|
|
35
|
+
//# sourceMappingURL=outline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outline.d.ts","names":[],"sources":["../../src/motion/outline.ts"],"mappings":";;;;;iBAOiB;EACf;EACA;;;iBAIe,4BAA4B;EAC3C,QAAQ;EACR;;;iBAIe,2BAA2B;EAC1C;EACA,OAAO;;;iBAIQ,2BAA2B;EAC1C,MAAM;EACN,SAAS;EACT,QAAQ;;;wBAIM,WAAW,QAAQ,eAAe;;wBAKlC,mBAAmB,MAAM,YAAY;;;;;wBAwBrC,cAAc,OAAO,YAAY,iBAAiB"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { numberOf } from "./presets/settings.js";
|
|
2
|
+
import { hasMotion } from "./timeline.js";
|
|
3
|
+
// src/motion/outline.ts
|
|
4
|
+
/** When a preset plays: from its offset for its duration, its kind's default if it sets none. */
|
|
5
|
+
function presetSpan(preset) {
|
|
6
|
+
return {
|
|
7
|
+
start: preset.offset,
|
|
8
|
+
end: preset.offset + numberOf(preset, "duration")
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/** A layer's motion as a timeline shows it: its presets, keyed fields, and when it moves at all. */
|
|
12
|
+
function motionLayerOutline(node) {
|
|
13
|
+
const presets = node.motionPresets.map((preset, index) => ({
|
|
14
|
+
preset,
|
|
15
|
+
index,
|
|
16
|
+
...presetSpan(preset)
|
|
17
|
+
}));
|
|
18
|
+
const tracks = Object.entries(node.keyframeTracks).flatMap(([address, track]) => {
|
|
19
|
+
const first = track.keyframes.at(0);
|
|
20
|
+
const last = track.keyframes.at(-1);
|
|
21
|
+
return first && last ? [{
|
|
22
|
+
address,
|
|
23
|
+
track,
|
|
24
|
+
start: first.time,
|
|
25
|
+
end: last.time
|
|
26
|
+
}] : [];
|
|
27
|
+
});
|
|
28
|
+
let start = 1e400;
|
|
29
|
+
let end = -1e400;
|
|
30
|
+
for (const span of [...presets, ...tracks]) {
|
|
31
|
+
start = Math.min(start, span.start);
|
|
32
|
+
end = Math.max(end, span.end);
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
node,
|
|
36
|
+
presets,
|
|
37
|
+
tracks,
|
|
38
|
+
start,
|
|
39
|
+
end
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The layers under `rootId` that move on its timeline, each with its presets and keyed fields,
|
|
44
|
+
* topmost first as a layers list shows them. The root itself is left out: it holds the timeline.
|
|
45
|
+
*/
|
|
46
|
+
function motionOutline(graph, rootId) {
|
|
47
|
+
const layers = [];
|
|
48
|
+
const visit = (id) => {
|
|
49
|
+
const node = graph.getNode(id);
|
|
50
|
+
if (!node) return;
|
|
51
|
+
if (hasMotion(node)) layers.push(motionLayerOutline(node));
|
|
52
|
+
for (const child of node.childIds.toReversed()) visit(child);
|
|
53
|
+
};
|
|
54
|
+
for (const child of graph.getNode(rootId)?.childIds.toReversed() ?? []) visit(child);
|
|
55
|
+
return layers;
|
|
56
|
+
}
|
|
57
|
+
export { motionLayerOutline, motionOutline, presetSpan };
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=outline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outline.js","names":[],"sources":["../../src/motion/outline.ts"],"sourcesContent":["import type { SceneGraph } from '../graph'\nimport type { SceneNode } from '../types'\nimport { numberOf, type MotionPreset } from './presets/settings'\nimport { hasMotion } from './timeline'\nimport type { KeyframeTrack } from './types'\n\n/** When something plays on a timeline, in seconds from its start. */\nexport interface MotionSpan {\n start: number\n end: number\n}\n\n/** A preset a layer applies, where it sits among the layer's presets, and when it plays. */\nexport interface MotionOutlinePreset extends MotionSpan {\n preset: MotionPreset\n index: number\n}\n\n/** A field a layer keys, by the address its track is kept under. */\nexport interface MotionOutlineTrack extends MotionSpan {\n address: string\n track: KeyframeTrack\n}\n\n/** A layer that moves on a timeline, with what moves it and when it moves at all. */\nexport interface MotionOutlineLayer extends MotionSpan {\n node: SceneNode\n presets: MotionOutlinePreset[]\n tracks: MotionOutlineTrack[]\n}\n\n/** When a preset plays: from its offset for its duration, its kind's default if it sets none. */\nexport function presetSpan(preset: MotionPreset): MotionSpan {\n return { start: preset.offset, end: preset.offset + numberOf(preset, 'duration') }\n}\n\n/** A layer's motion as a timeline shows it: its presets, keyed fields, and when it moves at all. */\nexport function motionLayerOutline(node: SceneNode): MotionOutlineLayer {\n const presets = node.motionPresets.map((preset, index) => ({\n preset,\n index,\n ...presetSpan(preset)\n }))\n const tracks = Object.entries(node.keyframeTracks).flatMap(([address, track]) => {\n const first = track.keyframes.at(0)\n const last = track.keyframes.at(-1)\n return first && last ? [{ address, track, start: first.time, end: last.time }] : []\n })\n let start = Infinity\n let end = -Infinity\n for (const span of [...presets, ...tracks]) {\n start = Math.min(start, span.start)\n end = Math.max(end, span.end)\n }\n return { node, presets, tracks, start, end }\n}\n\n/**\n * The layers under `rootId` that move on its timeline, each with its presets and keyed fields,\n * topmost first as a layers list shows them. The root itself is left out: it holds the timeline.\n */\nexport function motionOutline(graph: SceneGraph, rootId: string): MotionOutlineLayer[] {\n const layers: MotionOutlineLayer[] = []\n const visit = (id: string) => {\n const node = graph.getNode(id)\n if (!node) return\n if (hasMotion(node)) layers.push(motionLayerOutline(node))\n for (const child of node.childIds.toReversed()) visit(child)\n }\n for (const child of graph.getNode(rootId)?.childIds.toReversed() ?? []) visit(child)\n return layers\n}\n"],"mappings":";;;;AAgCA,SAAgB,WAAW,QAAkC;CAC3D,OAAO;EAAE,OAAO,OAAO;EAAQ,KAAK,OAAO,SAAS,SAAS,QAAQ,UAAU;CAAE;AACnF;;AAGA,SAAgB,mBAAmB,MAAqC;CACtE,MAAM,UAAU,KAAK,cAAc,KAAK,QAAQ,WAAW;EACzD;EACA;EACA,GAAG,WAAW,MAAM;CACtB,EAAE;CACF,MAAM,SAAS,OAAO,QAAQ,KAAK,cAAc,CAAC,CAAC,SAAS,CAAC,SAAS,WAAW;EAC/E,MAAM,QAAQ,MAAM,UAAU,GAAG,CAAC;EAClC,MAAM,OAAO,MAAM,UAAU,GAAG,EAAE;EAClC,OAAO,SAAS,OAAO,CAAC;GAAE;GAAS;GAAO,OAAO,MAAM;GAAM,KAAK,KAAK;EAAK,CAAC,IAAI,CAAC;CACpF,CAAC;CACD,IAAI,QAAQ;CACZ,IAAI,MAAM;CACV,KAAK,MAAM,QAAQ,CAAC,GAAG,SAAS,GAAG,MAAM,GAAG;EAC1C,QAAQ,KAAK,IAAI,OAAO,KAAK,KAAK;EAClC,MAAM,KAAK,IAAI,KAAK,KAAK,GAAG;CAC9B;CACA,OAAO;EAAE;EAAM;EAAS;EAAQ;EAAO;CAAI;AAC7C;;;;;AAMA,SAAgB,cAAc,OAAmB,QAAsC;CACrF,MAAM,SAA+B,CAAC;CACtC,MAAM,SAAS,OAAe;EAC5B,MAAM,OAAO,MAAM,QAAQ,EAAE;EAC7B,IAAI,CAAC,MAAM;EACX,IAAI,UAAU,IAAI,GAAG,OAAO,KAAK,mBAAmB,IAAI,CAAC;EACzD,KAAK,MAAM,SAAS,KAAK,SAAS,WAAW,GAAG,MAAM,KAAK;CAC7D;CACA,KAAK,MAAM,SAAS,MAAM,QAAQ,MAAM,CAAC,EAAE,SAAS,WAAW,KAAK,CAAC,GAAG,MAAM,KAAK;CACnF,OAAO;AACT"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SceneNode } from "../../types.js";
|
|
2
|
+
import { KeyframeTrack } from "../types.js";
|
|
3
|
+
import { STAGGER_PIECE_REST, StaggerGrouping, StaggerPieceMotion, combinedPieceMotion, staggerClips, staggerEnd, staggerGrouping, staggerOrigin, staggerPieceAt, staggerPieceSpan, staggerPieces, staggerSteps } from "./stagger.js";
|
|
4
|
+
import { MOTION_PRESET_KINDS, MOTION_PRESET_STYLE_IDS, MotionPreset, MotionPresetKind, MotionPresetSetting, MotionPresetSettingSpec, MotionPresetSettingType, motionPresetSettings, presetDirection, presetEasing, presetSetting } from "./settings.js";
|
|
5
|
+
/**
|
|
6
|
+
* The keyframe tracks a preset plays on a layer, by the address each animates, as Figma's
|
|
7
|
+
* presets move, fade, scale, turn, resize, and trim paths (live 2026-12-01). A text stagger
|
|
8
|
+
* plays no track: it moves a text's pieces one after another (`staggerPieceAt`).
|
|
9
|
+
*/
|
|
10
|
+
export declare function presetTracks(preset: MotionPreset): Record<string, KeyframeTrack>;
|
|
11
|
+
/** The tracks a layer plays, by address: its own first, then each preset's, in order. */
|
|
12
|
+
export declare function layerTracks(node: Pick<SceneNode, 'keyframeTracks' | 'motionPresets'>): [string, KeyframeTrack][];
|
|
13
|
+
/**
|
|
14
|
+
* Whether a layer's timeline trims its strokes, by a track or a preset: the canvas then strokes
|
|
15
|
+
* the part of its path the trim keeps, centred on the path, rather than any outline saved for
|
|
16
|
+
* the whole stroke.
|
|
17
|
+
*/
|
|
18
|
+
export declare function trimsPath(node: Pick<SceneNode, 'keyframeTracks' | 'motionPresets'>): boolean;
|
|
19
|
+
export { MOTION_PRESET_KINDS, MOTION_PRESET_STYLE_IDS, type MotionPreset, type MotionPresetKind, type MotionPresetSetting, type MotionPresetSettingSpec, type MotionPresetSettingType, STAGGER_PIECE_REST, StaggerGrouping, StaggerPieceMotion, combinedPieceMotion, motionPresetSettings, presetDirection, presetEasing, presetSetting, staggerClips, staggerEnd, staggerGrouping, staggerOrigin, staggerPieceAt, staggerPieceSpan, staggerPieces, staggerSteps };
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/motion/presets/index.ts"],"mappings":";;;;;;;;;wBAyOgB,aAAa,QAAQ,eAAe,eAAe;;wBAKnD,YACd,MAAM,KAAK,0DACD;;;;;;wBAYI,UAAU,MAAM,KAAK"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { MOTION_PRESET_KINDS, MOTION_PRESET_STYLE_IDS, motionPresetSettings, numberOf, presetDirection, presetEasing, presetSetting, textOf } from "./settings.js";
|
|
2
|
+
import { STAGGER_PIECE_REST, combinedPieceMotion, staggerClips, staggerEnd, staggerGrouping, staggerOrigin, staggerPieceAt, staggerPieceSpan, staggerPieces, staggerSteps } from "./stagger.js";
|
|
3
|
+
// src/motion/presets/index.ts
|
|
4
|
+
/** A track from `from` to `to` over the preset's duration, starting at its offset. */
|
|
5
|
+
function span(preset, operation, from, to) {
|
|
6
|
+
const easing = presetEasing(preset);
|
|
7
|
+
const start = preset.offset;
|
|
8
|
+
return {
|
|
9
|
+
operation,
|
|
10
|
+
keyframes: [{
|
|
11
|
+
time: start,
|
|
12
|
+
value: from,
|
|
13
|
+
easing
|
|
14
|
+
}, {
|
|
15
|
+
time: start + numberOf(preset, "duration"),
|
|
16
|
+
value: to,
|
|
17
|
+
easing
|
|
18
|
+
}]
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const float = (value) => ({
|
|
22
|
+
type: "FLOAT",
|
|
23
|
+
value
|
|
24
|
+
});
|
|
25
|
+
const vector = (x, y) => ({
|
|
26
|
+
type: "VECTOR",
|
|
27
|
+
value: {
|
|
28
|
+
x,
|
|
29
|
+
y
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
function positionTracks(preset) {
|
|
33
|
+
const type = textOf(preset, "type");
|
|
34
|
+
if (type === "custom") {
|
|
35
|
+
const axis = textOf(preset, "axis");
|
|
36
|
+
return { "motion/translation": span(preset, "OFFSET", vector(axis === "y" ? 0 : numberOf(preset, "startX"), axis === "x" ? 0 : numberOf(preset, "startY")), vector(axis === "y" ? 0 : numberOf(preset, "endX"), axis === "x" ? 0 : numberOf(preset, "endY"))) };
|
|
37
|
+
}
|
|
38
|
+
const way = presetDirection(textOf(preset, "direction"));
|
|
39
|
+
const distance = numberOf(preset, "distance");
|
|
40
|
+
const away = vector(way.x * distance, way.y * distance);
|
|
41
|
+
const home = vector(0, 0);
|
|
42
|
+
return { "motion/translation": type === "slide_out" ? span(preset, "OFFSET", home, away) : span(preset, "OFFSET", away, home) };
|
|
43
|
+
}
|
|
44
|
+
/** The opacities a fade goes between: its own for a custom one, else from or to its amount. */
|
|
45
|
+
function fadeRange(preset) {
|
|
46
|
+
const type = textOf(preset, "type");
|
|
47
|
+
if (type === "custom") return [numberOf(preset, "startFrame") / 100, numberOf(preset, "endFrame") / 100];
|
|
48
|
+
const amount = numberOf(preset, "amount") / 100;
|
|
49
|
+
return type === "fadeOut" ? [1, amount] : [amount, 1];
|
|
50
|
+
}
|
|
51
|
+
function opacityTracks(preset) {
|
|
52
|
+
const [from, to] = fadeRange(preset);
|
|
53
|
+
return { opacity: span(preset, "SCALE", float(from), float(to)) };
|
|
54
|
+
}
|
|
55
|
+
/** The scales a custom scale goes between, on the axes it names. */
|
|
56
|
+
function customScaleRange(preset) {
|
|
57
|
+
const percent = (name) => numberOf(preset, name) / 100;
|
|
58
|
+
const axis = textOf(preset, "axis");
|
|
59
|
+
if (axis === "w") return [vector(percent("wStartWithDivider"), 1), vector(percent("wEndWithoutDivider"), 1)];
|
|
60
|
+
if (axis === "h") return [vector(1, percent("hStartWithDivider")), vector(1, percent("hEndWithoutDivider"))];
|
|
61
|
+
return [vector(percent("wStartWithDivider"), percent("hStartWithoutDivider")), vector(percent("wEndWithDivider"), percent("hEndWithoutDivider"))];
|
|
62
|
+
}
|
|
63
|
+
function scaleTracks(preset) {
|
|
64
|
+
const type = textOf(preset, "type");
|
|
65
|
+
if (type === "custom") {
|
|
66
|
+
const [from, to] = customScaleRange(preset);
|
|
67
|
+
return { "motion/scale": span(preset, "SCALE", from, to) };
|
|
68
|
+
}
|
|
69
|
+
const amount = numberOf(preset, "amount") / 100;
|
|
70
|
+
const scaled = vector(amount, amount);
|
|
71
|
+
const whole = vector(1, 1);
|
|
72
|
+
return { "motion/scale": type === "scaleOut" ? span(preset, "SCALE", whole, scaled) : span(preset, "SCALE", scaled, whole) };
|
|
73
|
+
}
|
|
74
|
+
function rotationTracks(preset) {
|
|
75
|
+
const type = textOf(preset, "type");
|
|
76
|
+
if (type === "custom") return { "motion/rotation": span(preset, "OFFSET", float(numberOf(preset, "start")), float(numberOf(preset, "end"))) };
|
|
77
|
+
const turn = textOf(preset, "direction") === "counterClockwise" ? -1 : 1;
|
|
78
|
+
const amount = numberOf(preset, "amount") * turn;
|
|
79
|
+
return { "motion/rotation": type === "rotateOut" ? span(preset, "OFFSET", float(0), float(-amount)) : span(preset, "OFFSET", float(amount), float(0)) };
|
|
80
|
+
}
|
|
81
|
+
function sizeTracks(preset) {
|
|
82
|
+
const type = textOf(preset, "type");
|
|
83
|
+
if (type === "custom") {
|
|
84
|
+
const axis = textOf(preset, "axis");
|
|
85
|
+
const percent = (name) => float(numberOf(preset, name) / 100);
|
|
86
|
+
const tracks = {};
|
|
87
|
+
if (axis !== "y") tracks.width = span(preset, "SCALE", percent("startWidth"), percent("endWidth"));
|
|
88
|
+
if (axis !== "x") tracks.height = span(preset, "SCALE", percent("startHeight"), percent("endHeight"));
|
|
89
|
+
return tracks;
|
|
90
|
+
}
|
|
91
|
+
const amount = float(numberOf(preset, "amount"));
|
|
92
|
+
const none = float(0);
|
|
93
|
+
const grow = (from, to) => span(preset, "OFFSET", from, to);
|
|
94
|
+
return type === "resize_out" ? {
|
|
95
|
+
width: grow(none, amount),
|
|
96
|
+
height: grow(none, amount)
|
|
97
|
+
} : {
|
|
98
|
+
width: grow(amount, none),
|
|
99
|
+
height: grow(amount, none)
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/** The trims a custom path preset goes between, on the ends its axis names, in percent. */
|
|
103
|
+
function customTrims(preset) {
|
|
104
|
+
const percent = (name) => float(numberOf(preset, name) / 100);
|
|
105
|
+
const axis = textOf(preset, "axis");
|
|
106
|
+
if (axis === "pathTrimEnd") return { "motion/trimEnd": span(preset, "SET", percent("pathEndStartWithDivider"), percent("pathEndEndFrame")) };
|
|
107
|
+
if (axis === "combined") return {
|
|
108
|
+
"motion/trimStart": span(preset, "SET", percent("pathStartStartFrame"), percent("pathStartEndWithDivider")),
|
|
109
|
+
"motion/trimEnd": span(preset, "SET", percent("pathEndStartWithoutDivider"), percent("pathEndEndFrame"))
|
|
110
|
+
};
|
|
111
|
+
return { "motion/trimStart": span(preset, "SET", percent("pathStartStartFrame"), percent("pathStartEndWithoutDivider")) };
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* How a path preset trims a layer's strokes, as Figma's do (live 2026-12-01): drawing reveals
|
|
115
|
+
* the path from its start, or its end in reverse; erasing hides it the same ways; travelling
|
|
116
|
+
* moves a `segment` percent of it along.
|
|
117
|
+
*/
|
|
118
|
+
function pathTracks(preset) {
|
|
119
|
+
const type = textOf(preset, "type");
|
|
120
|
+
if (type === "custom") return customTrims(preset);
|
|
121
|
+
const reverse = textOf(preset, "direction") === "reverse";
|
|
122
|
+
const move = (from, to) => span(preset, "SET", float(from), float(to));
|
|
123
|
+
if (type === "travel") {
|
|
124
|
+
const segment = numberOf(preset, "segment") / 100;
|
|
125
|
+
return reverse ? {
|
|
126
|
+
"motion/trimStart": move(1 - segment, 0),
|
|
127
|
+
"motion/trimEnd": move(1, segment)
|
|
128
|
+
} : {
|
|
129
|
+
"motion/trimStart": move(0, 1 - segment),
|
|
130
|
+
"motion/trimEnd": move(segment, 1)
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
if (type === "erase") return reverse ? { "motion/trimEnd": move(1, 0) } : { "motion/trimStart": move(0, 1) };
|
|
134
|
+
return reverse ? { "motion/trimStart": move(1, 0) } : { "motion/trimEnd": move(0, 1) };
|
|
135
|
+
}
|
|
136
|
+
const GENERATORS = {
|
|
137
|
+
position: positionTracks,
|
|
138
|
+
opacity: opacityTracks,
|
|
139
|
+
scale: scaleTracks,
|
|
140
|
+
rotation: rotationTracks,
|
|
141
|
+
size: sizeTracks,
|
|
142
|
+
path: pathTracks
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* The keyframe tracks a preset plays on a layer, by the address each animates, as Figma's
|
|
146
|
+
* presets move, fade, scale, turn, resize, and trim paths (live 2026-12-01). A text stagger
|
|
147
|
+
* plays no track: it moves a text's pieces one after another (`staggerPieceAt`).
|
|
148
|
+
*/
|
|
149
|
+
function presetTracks(preset) {
|
|
150
|
+
return GENERATORS[preset.kind]?.(preset) ?? {};
|
|
151
|
+
}
|
|
152
|
+
/** The tracks a layer plays, by address: its own first, then each preset's, in order. */
|
|
153
|
+
function layerTracks(node) {
|
|
154
|
+
return [...Object.entries(node.keyframeTracks), ...node.motionPresets.flatMap((preset) => Object.entries(presetTracks(preset)))];
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Whether a layer's timeline trims its strokes, by a track or a preset: the canvas then strokes
|
|
158
|
+
* the part of its path the trim keeps, centred on the path, rather than any outline saved for
|
|
159
|
+
* the whole stroke.
|
|
160
|
+
*/
|
|
161
|
+
function trimsPath(node) {
|
|
162
|
+
return layerTracks(node).some(([address, track]) => address.startsWith("motion/trim") && track.keyframes.length > 0);
|
|
163
|
+
}
|
|
164
|
+
export { MOTION_PRESET_KINDS, MOTION_PRESET_STYLE_IDS, STAGGER_PIECE_REST, combinedPieceMotion, layerTracks, motionPresetSettings, presetDirection, presetEasing, presetSetting, presetTracks, staggerClips, staggerEnd, staggerGrouping, staggerOrigin, staggerPieceAt, staggerPieceSpan, staggerPieces, staggerSteps, trimsPath };
|
|
165
|
+
|
|
166
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/motion/presets/index.ts"],"sourcesContent":["import type { SceneNode } from '#scene-graph/types'\n\nimport type { KeyframeOperation, KeyframeTrack, KeyframeValue } from '../types'\nimport {\n presetDirection,\n numberOf,\n presetEasing,\n textOf,\n type MotionPreset,\n type MotionPresetKind\n} from './settings'\n\nexport * from './stagger'\nexport {\n MOTION_PRESET_KINDS,\n MOTION_PRESET_STYLE_IDS,\n motionPresetSettings,\n presetDirection,\n presetEasing,\n presetSetting,\n type MotionPreset,\n type MotionPresetKind,\n type MotionPresetSetting,\n type MotionPresetSettingSpec,\n type MotionPresetSettingType\n} from './settings'\n\n/** A track from `from` to `to` over the preset's duration, starting at its offset. */\nfunction span(\n preset: MotionPreset,\n operation: KeyframeOperation,\n from: KeyframeValue,\n to: KeyframeValue\n): KeyframeTrack {\n const easing = presetEasing(preset)\n const start = preset.offset\n return {\n operation,\n keyframes: [\n { time: start, value: from, easing },\n { time: start + numberOf(preset, 'duration'), value: to, easing }\n ]\n }\n}\n\nconst float = (value: number): KeyframeValue => ({ type: 'FLOAT', value })\nconst vector = (x: number, y: number): KeyframeValue => ({ type: 'VECTOR', value: { x, y } })\n\nfunction positionTracks(preset: MotionPreset): Record<string, KeyframeTrack> {\n const type = textOf(preset, 'type')\n if (type === 'custom') {\n const axis = textOf(preset, 'axis')\n const start = vector(\n axis === 'y' ? 0 : numberOf(preset, 'startX'),\n axis === 'x' ? 0 : numberOf(preset, 'startY')\n )\n const end = vector(\n axis === 'y' ? 0 : numberOf(preset, 'endX'),\n axis === 'x' ? 0 : numberOf(preset, 'endY')\n )\n return { 'motion/translation': span(preset, 'OFFSET', start, end) }\n }\n const way = presetDirection(textOf(preset, 'direction'))\n const distance = numberOf(preset, 'distance')\n const away = vector(way.x * distance, way.y * distance)\n const home = vector(0, 0)\n const tracks =\n type === 'slide_out' ? span(preset, 'OFFSET', home, away) : span(preset, 'OFFSET', away, home)\n return { 'motion/translation': tracks }\n}\n\n/** The opacities a fade goes between: its own for a custom one, else from or to its amount. */\nfunction fadeRange(preset: MotionPreset): [number, number] {\n const type = textOf(preset, 'type')\n if (type === 'custom')\n return [numberOf(preset, 'startFrame') / 100, numberOf(preset, 'endFrame') / 100]\n const amount = numberOf(preset, 'amount') / 100\n return type === 'fadeOut' ? [1, amount] : [amount, 1]\n}\n\nfunction opacityTracks(preset: MotionPreset): Record<string, KeyframeTrack> {\n const [from, to] = fadeRange(preset)\n return { opacity: span(preset, 'SCALE', float(from), float(to)) }\n}\n\n/** The scales a custom scale goes between, on the axes it names. */\nfunction customScaleRange(preset: MotionPreset): [KeyframeValue, KeyframeValue] {\n const percent = (name: string) => numberOf(preset, name) / 100\n const axis = textOf(preset, 'axis')\n if (axis === 'w')\n return [vector(percent('wStartWithDivider'), 1), vector(percent('wEndWithoutDivider'), 1)]\n if (axis === 'h')\n return [vector(1, percent('hStartWithDivider')), vector(1, percent('hEndWithoutDivider'))]\n return [\n vector(percent('wStartWithDivider'), percent('hStartWithoutDivider')),\n vector(percent('wEndWithDivider'), percent('hEndWithoutDivider'))\n ]\n}\n\nfunction scaleTracks(preset: MotionPreset): Record<string, KeyframeTrack> {\n const type = textOf(preset, 'type')\n if (type === 'custom') {\n const [from, to] = customScaleRange(preset)\n return { 'motion/scale': span(preset, 'SCALE', from, to) }\n }\n const amount = numberOf(preset, 'amount') / 100\n const scaled = vector(amount, amount)\n const whole = vector(1, 1)\n return {\n 'motion/scale':\n type === 'scaleOut'\n ? span(preset, 'SCALE', whole, scaled)\n : span(preset, 'SCALE', scaled, whole)\n }\n}\n\nfunction rotationTracks(preset: MotionPreset): Record<string, KeyframeTrack> {\n const type = textOf(preset, 'type')\n if (type === 'custom')\n return {\n 'motion/rotation': span(\n preset,\n 'OFFSET',\n float(numberOf(preset, 'start')),\n float(numberOf(preset, 'end'))\n )\n }\n // Figma's angles turn counterclockwise; a clockwise turn comes from a positive one.\n const turn = textOf(preset, 'direction') === 'counterClockwise' ? -1 : 1\n const amount = numberOf(preset, 'amount') * turn\n return {\n 'motion/rotation':\n type === 'rotateOut'\n ? span(preset, 'OFFSET', float(0), float(-amount))\n : span(preset, 'OFFSET', float(amount), float(0))\n }\n}\n\nfunction sizeTracks(preset: MotionPreset): Record<string, KeyframeTrack> {\n const type = textOf(preset, 'type')\n if (type === 'custom') {\n const axis = textOf(preset, 'axis')\n const percent = (name: string) => float(numberOf(preset, name) / 100)\n const tracks: Record<string, KeyframeTrack> = {}\n if (axis !== 'y')\n tracks.width = span(preset, 'SCALE', percent('startWidth'), percent('endWidth'))\n if (axis !== 'x')\n tracks.height = span(preset, 'SCALE', percent('startHeight'), percent('endHeight'))\n return tracks\n }\n const amount = float(numberOf(preset, 'amount'))\n const none = float(0)\n const grow = (from: KeyframeValue, to: KeyframeValue) => span(preset, 'OFFSET', from, to)\n return type === 'resize_out'\n ? { width: grow(none, amount), height: grow(none, amount) }\n : { width: grow(amount, none), height: grow(amount, none) }\n}\n\n/** The trims a custom path preset goes between, on the ends its axis names, in percent. */\nfunction customTrims(preset: MotionPreset): Record<string, KeyframeTrack> {\n const percent = (name: string) => float(numberOf(preset, name) / 100)\n const axis = textOf(preset, 'axis')\n if (axis === 'pathTrimEnd')\n return {\n 'motion/trimEnd': span(\n preset,\n 'SET',\n percent('pathEndStartWithDivider'),\n percent('pathEndEndFrame')\n )\n }\n if (axis === 'combined')\n return {\n 'motion/trimStart': span(\n preset,\n 'SET',\n percent('pathStartStartFrame'),\n percent('pathStartEndWithDivider')\n ),\n 'motion/trimEnd': span(\n preset,\n 'SET',\n percent('pathEndStartWithoutDivider'),\n percent('pathEndEndFrame')\n )\n }\n return {\n 'motion/trimStart': span(\n preset,\n 'SET',\n percent('pathStartStartFrame'),\n percent('pathStartEndWithoutDivider')\n )\n }\n}\n\n/**\n * How a path preset trims a layer's strokes, as Figma's do (live 2026-12-01): drawing reveals\n * the path from its start, or its end in reverse; erasing hides it the same ways; travelling\n * moves a `segment` percent of it along.\n */\nfunction pathTracks(preset: MotionPreset): Record<string, KeyframeTrack> {\n const type = textOf(preset, 'type')\n if (type === 'custom') return customTrims(preset)\n const reverse = textOf(preset, 'direction') === 'reverse'\n const move = (from: number, to: number) => span(preset, 'SET', float(from), float(to))\n if (type === 'travel') {\n const segment = numberOf(preset, 'segment') / 100\n return reverse\n ? { 'motion/trimStart': move(1 - segment, 0), 'motion/trimEnd': move(1, segment) }\n : { 'motion/trimStart': move(0, 1 - segment), 'motion/trimEnd': move(segment, 1) }\n }\n if (type === 'erase')\n return reverse ? { 'motion/trimEnd': move(1, 0) } : { 'motion/trimStart': move(0, 1) }\n return reverse ? { 'motion/trimStart': move(1, 0) } : { 'motion/trimEnd': move(0, 1) }\n}\n\nconst GENERATORS: Partial<\n Record<MotionPresetKind, (preset: MotionPreset) => Record<string, KeyframeTrack>>\n> = {\n position: positionTracks,\n opacity: opacityTracks,\n scale: scaleTracks,\n rotation: rotationTracks,\n size: sizeTracks,\n path: pathTracks\n}\n\n/**\n * The keyframe tracks a preset plays on a layer, by the address each animates, as Figma's\n * presets move, fade, scale, turn, resize, and trim paths (live 2026-12-01). A text stagger\n * plays no track: it moves a text's pieces one after another (`staggerPieceAt`).\n */\nexport function presetTracks(preset: MotionPreset): Record<string, KeyframeTrack> {\n return GENERATORS[preset.kind]?.(preset) ?? {}\n}\n\n/** The tracks a layer plays, by address: its own first, then each preset's, in order. */\nexport function layerTracks(\n node: Pick<SceneNode, 'keyframeTracks' | 'motionPresets'>\n): [string, KeyframeTrack][] {\n return [\n ...Object.entries(node.keyframeTracks),\n ...node.motionPresets.flatMap((preset) => Object.entries(presetTracks(preset)))\n ]\n}\n\n/**\n * Whether a layer's timeline trims its strokes, by a track or a preset: the canvas then strokes\n * the part of its path the trim keeps, centred on the path, rather than any outline saved for\n * the whole stroke.\n */\nexport function trimsPath(node: Pick<SceneNode, 'keyframeTracks' | 'motionPresets'>): boolean {\n return layerTracks(node).some(\n ([address, track]) => address.startsWith('motion/trim') && track.keyframes.length > 0\n )\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Vector } from "../../primitives/index.js";
|
|
2
|
+
import { Easing } from "../../types.js";
|
|
3
|
+
/** Figma's motion presets, by the names their definitions end with. */
|
|
4
|
+
export declare const MOTION_PRESET_KINDS: readonly ["position", "scale", "rotation", "size", "opacity", "path", "text_stagger"];
|
|
5
|
+
export type MotionPresetKind = (typeof MOTION_PRESET_KINDS)[number];
|
|
6
|
+
/** A preset setting's value: a choice or text, a number, a switch, or an easing. */
|
|
7
|
+
export type MotionPresetSetting = string | number | boolean | Easing;
|
|
8
|
+
/**
|
|
9
|
+
* A preset a layer applies, as Figma's motion presets are: its kind, the settings it was given
|
|
10
|
+
* by name, and when it starts on the timeline. Settings it was not given take the preset's
|
|
11
|
+
* defaults.
|
|
12
|
+
*/
|
|
13
|
+
export interface MotionPreset {
|
|
14
|
+
/** The applied preset's own ID, as Figma's preset instance has one, which the plugin API names. */
|
|
15
|
+
id?: string;
|
|
16
|
+
kind: MotionPresetKind;
|
|
17
|
+
settings: Record<string, MotionPresetSetting>;
|
|
18
|
+
/** Seconds into the timeline the preset starts, as its `delay`. */
|
|
19
|
+
offset: number;
|
|
20
|
+
}
|
|
21
|
+
/** What a preset setting takes, as Figma's catalogue of presets declares it. */
|
|
22
|
+
export type MotionPresetSettingType = 'number' | 'boolean' | 'easing' | readonly string[];
|
|
23
|
+
/** A preset setting as Figma's catalogue declares it: what it takes, its default, and its unit. */
|
|
24
|
+
export interface MotionPresetSettingSpec {
|
|
25
|
+
type: MotionPresetSettingType;
|
|
26
|
+
default: MotionPresetSetting;
|
|
27
|
+
/** The unit the catalogue gives it: `px`, `%`, `°`, or `s`. */
|
|
28
|
+
unit?: string;
|
|
29
|
+
}
|
|
30
|
+
/** The settings a preset takes, by name, with their defaults: its own, then its timing. */
|
|
31
|
+
export declare function motionPresetSettings(kind: MotionPresetKind): Record<string, MotionPresetSettingSpec>;
|
|
32
|
+
/** The style ID Figma's plugin API gives each preset, as `figma.motion.figmaAnimationStyles()` lists it. */
|
|
33
|
+
export declare const MOTION_PRESET_STYLE_IDS: Record<MotionPresetKind, string>;
|
|
34
|
+
/** A preset's setting: its own, or the preset's default. */
|
|
35
|
+
export declare function presetSetting(preset: MotionPreset, name: string): MotionPresetSetting | undefined;
|
|
36
|
+
/** A preset's easing: its own, or Figma's default, Ease out. */
|
|
37
|
+
export declare function presetEasing(preset: MotionPreset): Easing;
|
|
38
|
+
/**
|
|
39
|
+
* The way a position preset's direction moves a layer from its place, by the sides it names:
|
|
40
|
+
* `left`, `top_right`, and so on; Left when it names none.
|
|
41
|
+
*/
|
|
42
|
+
export declare function presetDirection(name: string): Vector;
|
|
43
|
+
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.d.ts","names":[],"sources":["../../../src/motion/presets/settings.ts"],"mappings":";;;qBAKa;YASD,2BAA2B;;YAG3B,kDAAkD;;;;;;iBAO7C;;EAEf;EACA,MAAM;EACN,UAAU,eAAe;;EAEzB;;;YAIU;;iBAGK;EACf,MAAM;EACN,SAAS;;EAET;;;wBA+Hc,qBACd,MAAM,mBACL,eAAe;;qBAKL,yBAAyB,OAAO;;wBAc7B,cAAc,QAAQ,cAAc,eAAe;;wBAcnD,aAAa,QAAQ,eAAe;;;;;wBAYpC,gBAAgB,eAAe"}
|