@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,185 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
/** An easing as a transition's is written: CSS, a name, as stored, or an Easing variable. */
|
|
3
|
+
export declare const easingSpecSchema: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.ObjectSchema<{
|
|
4
|
+
readonly variable: v.StringSchema<undefined>;
|
|
5
|
+
}, undefined>, v.ObjectSchema<{
|
|
6
|
+
readonly easing: v.PicklistSchema<readonly ["IN_CUBIC", "OUT_CUBIC", "INOUT_CUBIC", "LINEAR", "IN_BACK_CUBIC", "OUT_BACK_CUBIC", "INOUT_BACK_CUBIC", "CUSTOM_CUBIC", "SPRING", "GENTLE_SPRING", "CUSTOM_SPRING", "SPRING_PRESET_ONE", "SPRING_PRESET_TWO", "SPRING_PRESET_THREE", "HOLD", "EASE_IN"], undefined>;
|
|
7
|
+
readonly bezier: v.OptionalSchema<v.ObjectSchema<{
|
|
8
|
+
readonly x1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
9
|
+
readonly y1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
10
|
+
readonly x2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
11
|
+
readonly y2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
12
|
+
}, undefined>, undefined>;
|
|
13
|
+
readonly spring: v.OptionalSchema<v.ObjectSchema<{
|
|
14
|
+
readonly stiffness: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
15
|
+
readonly damping: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
16
|
+
readonly mass: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.GtValueAction<number, 0, undefined>]>;
|
|
17
|
+
readonly type: v.OptionalSchema<v.PicklistSchema<["NORMALIZED", "PHYSICAL"], undefined>, undefined>;
|
|
18
|
+
readonly platform: v.OptionalSchema<v.PicklistSchema<["IOS_WEB", "ANDROID"], undefined>, undefined>;
|
|
19
|
+
}, undefined>, undefined>;
|
|
20
|
+
}, undefined>], undefined>, undefined>;
|
|
21
|
+
/**
|
|
22
|
+
* A keyframe as scripts and JSX write it: when, in seconds, the value it reaches (a number, a
|
|
23
|
+
* color such as `#3366FF`, an `{ x, y }` pair, or a switch), and how the stretch arriving at it
|
|
24
|
+
* eases, as a transition's easing is written.
|
|
25
|
+
*/
|
|
26
|
+
export declare const keyframeSpecSchema: v.ObjectSchema<{
|
|
27
|
+
readonly time: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
28
|
+
readonly value: v.UnionSchema<[v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.StringSchema<undefined>, v.ObjectSchema<{
|
|
29
|
+
readonly x: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
30
|
+
readonly y: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
31
|
+
}, undefined>, v.BooleanSchema<undefined>], undefined>;
|
|
32
|
+
readonly easing: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.ObjectSchema<{
|
|
33
|
+
readonly variable: v.StringSchema<undefined>;
|
|
34
|
+
}, undefined>, v.ObjectSchema<{
|
|
35
|
+
readonly easing: v.PicklistSchema<readonly ["IN_CUBIC", "OUT_CUBIC", "INOUT_CUBIC", "LINEAR", "IN_BACK_CUBIC", "OUT_BACK_CUBIC", "INOUT_BACK_CUBIC", "CUSTOM_CUBIC", "SPRING", "GENTLE_SPRING", "CUSTOM_SPRING", "SPRING_PRESET_ONE", "SPRING_PRESET_TWO", "SPRING_PRESET_THREE", "HOLD", "EASE_IN"], undefined>;
|
|
36
|
+
readonly bezier: v.OptionalSchema<v.ObjectSchema<{
|
|
37
|
+
readonly x1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
38
|
+
readonly y1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
39
|
+
readonly x2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
40
|
+
readonly y2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
41
|
+
}, undefined>, undefined>;
|
|
42
|
+
readonly spring: v.OptionalSchema<v.ObjectSchema<{
|
|
43
|
+
readonly stiffness: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
44
|
+
readonly damping: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
45
|
+
readonly mass: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.GtValueAction<number, 0, undefined>]>;
|
|
46
|
+
readonly type: v.OptionalSchema<v.PicklistSchema<["NORMALIZED", "PHYSICAL"], undefined>, undefined>;
|
|
47
|
+
readonly platform: v.OptionalSchema<v.PicklistSchema<["IOS_WEB", "ANDROID"], undefined>, undefined>;
|
|
48
|
+
}, undefined>, undefined>;
|
|
49
|
+
}, undefined>], undefined>, undefined>;
|
|
50
|
+
}, undefined>;
|
|
51
|
+
export type KeyframeSpec = v.InferOutput<typeof keyframeSpecSchema>;
|
|
52
|
+
/**
|
|
53
|
+
* A field's keyframes, or with how they meet the field's own value: `set` replaces it, `offset`
|
|
54
|
+
* adds to it, `scale` multiplies it. Without one, a field takes the operation Figma gives it.
|
|
55
|
+
*/
|
|
56
|
+
export declare const keyframeTrackSpecSchema: v.UnionSchema<[v.ArraySchema<v.ObjectSchema<{
|
|
57
|
+
readonly time: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
58
|
+
readonly value: v.UnionSchema<[v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.StringSchema<undefined>, v.ObjectSchema<{
|
|
59
|
+
readonly x: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
60
|
+
readonly y: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
61
|
+
}, undefined>, v.BooleanSchema<undefined>], undefined>;
|
|
62
|
+
readonly easing: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.ObjectSchema<{
|
|
63
|
+
readonly variable: v.StringSchema<undefined>;
|
|
64
|
+
}, undefined>, v.ObjectSchema<{
|
|
65
|
+
readonly easing: v.PicklistSchema<readonly ["IN_CUBIC", "OUT_CUBIC", "INOUT_CUBIC", "LINEAR", "IN_BACK_CUBIC", "OUT_BACK_CUBIC", "INOUT_BACK_CUBIC", "CUSTOM_CUBIC", "SPRING", "GENTLE_SPRING", "CUSTOM_SPRING", "SPRING_PRESET_ONE", "SPRING_PRESET_TWO", "SPRING_PRESET_THREE", "HOLD", "EASE_IN"], undefined>;
|
|
66
|
+
readonly bezier: v.OptionalSchema<v.ObjectSchema<{
|
|
67
|
+
readonly x1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
68
|
+
readonly y1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
69
|
+
readonly x2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
70
|
+
readonly y2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
71
|
+
}, undefined>, undefined>;
|
|
72
|
+
readonly spring: v.OptionalSchema<v.ObjectSchema<{
|
|
73
|
+
readonly stiffness: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
74
|
+
readonly damping: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
75
|
+
readonly mass: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.GtValueAction<number, 0, undefined>]>;
|
|
76
|
+
readonly type: v.OptionalSchema<v.PicklistSchema<["NORMALIZED", "PHYSICAL"], undefined>, undefined>;
|
|
77
|
+
readonly platform: v.OptionalSchema<v.PicklistSchema<["IOS_WEB", "ANDROID"], undefined>, undefined>;
|
|
78
|
+
}, undefined>, undefined>;
|
|
79
|
+
}, undefined>], undefined>, undefined>;
|
|
80
|
+
}, undefined>, undefined>, v.ObjectSchema<{
|
|
81
|
+
readonly operation: v.PicklistSchema<["set", "offset", "scale"], undefined>;
|
|
82
|
+
readonly keyframes: v.ArraySchema<v.ObjectSchema<{
|
|
83
|
+
readonly time: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
84
|
+
readonly value: v.UnionSchema<[v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.StringSchema<undefined>, v.ObjectSchema<{
|
|
85
|
+
readonly x: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
86
|
+
readonly y: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
87
|
+
}, undefined>, v.BooleanSchema<undefined>], undefined>;
|
|
88
|
+
readonly easing: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.ObjectSchema<{
|
|
89
|
+
readonly variable: v.StringSchema<undefined>;
|
|
90
|
+
}, undefined>, v.ObjectSchema<{
|
|
91
|
+
readonly easing: v.PicklistSchema<readonly ["IN_CUBIC", "OUT_CUBIC", "INOUT_CUBIC", "LINEAR", "IN_BACK_CUBIC", "OUT_BACK_CUBIC", "INOUT_BACK_CUBIC", "CUSTOM_CUBIC", "SPRING", "GENTLE_SPRING", "CUSTOM_SPRING", "SPRING_PRESET_ONE", "SPRING_PRESET_TWO", "SPRING_PRESET_THREE", "HOLD", "EASE_IN"], undefined>;
|
|
92
|
+
readonly bezier: v.OptionalSchema<v.ObjectSchema<{
|
|
93
|
+
readonly x1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
94
|
+
readonly y1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
95
|
+
readonly x2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
96
|
+
readonly y2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
97
|
+
}, undefined>, undefined>;
|
|
98
|
+
readonly spring: v.OptionalSchema<v.ObjectSchema<{
|
|
99
|
+
readonly stiffness: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
100
|
+
readonly damping: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
101
|
+
readonly mass: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.GtValueAction<number, 0, undefined>]>;
|
|
102
|
+
readonly type: v.OptionalSchema<v.PicklistSchema<["NORMALIZED", "PHYSICAL"], undefined>, undefined>;
|
|
103
|
+
readonly platform: v.OptionalSchema<v.PicklistSchema<["IOS_WEB", "ANDROID"], undefined>, undefined>;
|
|
104
|
+
}, undefined>, undefined>;
|
|
105
|
+
}, undefined>], undefined>, undefined>;
|
|
106
|
+
}, undefined>, undefined>;
|
|
107
|
+
}, undefined>], undefined>;
|
|
108
|
+
export type KeyframeTrackSpec = v.InferOutput<typeof keyframeTrackSpecSchema>;
|
|
109
|
+
/**
|
|
110
|
+
* A layer's keyframes by what they animate: a layer field (`opacity`), a motion field by its
|
|
111
|
+
* name (`translationX`, `rotation`, `scale`), or a paint's or effect's field by its address
|
|
112
|
+
* (`fills/0/color`, `effects/0/radius`).
|
|
113
|
+
*/
|
|
114
|
+
export declare const keyframesSpecSchema: v.RecordSchema<v.StringSchema<undefined>, v.UnionSchema<[v.ArraySchema<v.ObjectSchema<{
|
|
115
|
+
readonly time: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
116
|
+
readonly value: v.UnionSchema<[v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.StringSchema<undefined>, v.ObjectSchema<{
|
|
117
|
+
readonly x: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
118
|
+
readonly y: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
119
|
+
}, undefined>, v.BooleanSchema<undefined>], undefined>;
|
|
120
|
+
readonly easing: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.ObjectSchema<{
|
|
121
|
+
readonly variable: v.StringSchema<undefined>;
|
|
122
|
+
}, undefined>, v.ObjectSchema<{
|
|
123
|
+
readonly easing: v.PicklistSchema<readonly ["IN_CUBIC", "OUT_CUBIC", "INOUT_CUBIC", "LINEAR", "IN_BACK_CUBIC", "OUT_BACK_CUBIC", "INOUT_BACK_CUBIC", "CUSTOM_CUBIC", "SPRING", "GENTLE_SPRING", "CUSTOM_SPRING", "SPRING_PRESET_ONE", "SPRING_PRESET_TWO", "SPRING_PRESET_THREE", "HOLD", "EASE_IN"], undefined>;
|
|
124
|
+
readonly bezier: v.OptionalSchema<v.ObjectSchema<{
|
|
125
|
+
readonly x1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
126
|
+
readonly y1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
127
|
+
readonly x2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
128
|
+
readonly y2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
129
|
+
}, undefined>, undefined>;
|
|
130
|
+
readonly spring: v.OptionalSchema<v.ObjectSchema<{
|
|
131
|
+
readonly stiffness: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
132
|
+
readonly damping: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
133
|
+
readonly mass: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.GtValueAction<number, 0, undefined>]>;
|
|
134
|
+
readonly type: v.OptionalSchema<v.PicklistSchema<["NORMALIZED", "PHYSICAL"], undefined>, undefined>;
|
|
135
|
+
readonly platform: v.OptionalSchema<v.PicklistSchema<["IOS_WEB", "ANDROID"], undefined>, undefined>;
|
|
136
|
+
}, undefined>, undefined>;
|
|
137
|
+
}, undefined>], undefined>, undefined>;
|
|
138
|
+
}, undefined>, undefined>, v.ObjectSchema<{
|
|
139
|
+
readonly operation: v.PicklistSchema<["set", "offset", "scale"], undefined>;
|
|
140
|
+
readonly keyframes: v.ArraySchema<v.ObjectSchema<{
|
|
141
|
+
readonly time: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
142
|
+
readonly value: v.UnionSchema<[v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.StringSchema<undefined>, v.ObjectSchema<{
|
|
143
|
+
readonly x: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
144
|
+
readonly y: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
145
|
+
}, undefined>, v.BooleanSchema<undefined>], undefined>;
|
|
146
|
+
readonly easing: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.ObjectSchema<{
|
|
147
|
+
readonly variable: v.StringSchema<undefined>;
|
|
148
|
+
}, undefined>, v.ObjectSchema<{
|
|
149
|
+
readonly easing: v.PicklistSchema<readonly ["IN_CUBIC", "OUT_CUBIC", "INOUT_CUBIC", "LINEAR", "IN_BACK_CUBIC", "OUT_BACK_CUBIC", "INOUT_BACK_CUBIC", "CUSTOM_CUBIC", "SPRING", "GENTLE_SPRING", "CUSTOM_SPRING", "SPRING_PRESET_ONE", "SPRING_PRESET_TWO", "SPRING_PRESET_THREE", "HOLD", "EASE_IN"], undefined>;
|
|
150
|
+
readonly bezier: v.OptionalSchema<v.ObjectSchema<{
|
|
151
|
+
readonly x1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
152
|
+
readonly y1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
153
|
+
readonly x2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
154
|
+
readonly y2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
155
|
+
}, undefined>, undefined>;
|
|
156
|
+
readonly spring: v.OptionalSchema<v.ObjectSchema<{
|
|
157
|
+
readonly stiffness: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
158
|
+
readonly damping: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
159
|
+
readonly mass: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.GtValueAction<number, 0, undefined>]>;
|
|
160
|
+
readonly type: v.OptionalSchema<v.PicklistSchema<["NORMALIZED", "PHYSICAL"], undefined>, undefined>;
|
|
161
|
+
readonly platform: v.OptionalSchema<v.PicklistSchema<["IOS_WEB", "ANDROID"], undefined>, undefined>;
|
|
162
|
+
}, undefined>, undefined>;
|
|
163
|
+
}, undefined>], undefined>, undefined>;
|
|
164
|
+
}, undefined>, undefined>;
|
|
165
|
+
}, undefined>], undefined>, undefined>;
|
|
166
|
+
export type KeyframesSpec = v.InferOutput<typeof keyframesSpecSchema>;
|
|
167
|
+
/** How a frame's timeline plays, each setting left out keeping its default. */
|
|
168
|
+
export declare const timelineSpecSchema: v.ObjectSchema<{
|
|
169
|
+
readonly duration: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.GtValueAction<number, 0, undefined>]>, undefined>;
|
|
170
|
+
readonly autoplay: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
171
|
+
readonly loop: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
172
|
+
readonly muted: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
173
|
+
}, undefined>;
|
|
174
|
+
export type TimelineSpec = v.InferOutput<typeof timelineSpecSchema>;
|
|
175
|
+
/**
|
|
176
|
+
* A preset a layer applies: its kind, when it starts in seconds, and the settings it changes
|
|
177
|
+
* from the preset's defaults, an easing written as a transition's is.
|
|
178
|
+
*/
|
|
179
|
+
export declare const presetSpecSchema: v.ObjectSchema<{
|
|
180
|
+
readonly kind: v.PicklistSchema<readonly ["position", "scale", "rotation", "size", "opacity", "path", "text_stagger"], undefined>;
|
|
181
|
+
readonly offset: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
182
|
+
readonly settings: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
|
|
183
|
+
}, undefined>;
|
|
184
|
+
export type PresetSpec = v.InferOutput<typeof presetSpecSchema>;
|
|
185
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","names":[],"sources":["../../src/motion/schema.ts"],"mappings":";;qBAOa,kBAAgB,EAAA,eAAA,EAAA,aAAA,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;qBAOhB,oBAAkB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;YAUnB,eAAe,EAAE,mBAAmB;;;;;qBAMnC,yBAAuB,EAAA,aAAA,EAAA,YAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAOxB,oBAAoB,EAAE,mBAAmB;;;;;;qBAOxC,qBAAmB,EAAA,aAAA,EAAA,yBAAA,EAAA,aAAA,EAAA,YAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YACpB,gBAAgB,EAAE,mBAAmB;;qBAGpC,oBAAkB,EAAA;;;;;;YAMnB,eAAe,EAAE,mBAAmB;;;;;qBAMnC,kBAAgB,EAAA;;;;;YAKjB,aAAa,EAAE,mBAAmB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { motionSpecSchema } from "../variables/schema.js";
|
|
3
|
+
import { MOTION_PRESET_KINDS } from "./presets/settings.js";
|
|
4
|
+
// src/motion/schema.ts
|
|
5
|
+
const finiteSchema = v.pipe(v.number(), v.finite());
|
|
6
|
+
/** An easing as a transition's is written: CSS, a name, as stored, or an Easing variable. */
|
|
7
|
+
const easingSpecSchema = motionSpecSchema.entries.easing;
|
|
8
|
+
/**
|
|
9
|
+
* A keyframe as scripts and JSX write it: when, in seconds, the value it reaches (a number, a
|
|
10
|
+
* color such as `#3366FF`, an `{ x, y }` pair, or a switch), and how the stretch arriving at it
|
|
11
|
+
* eases, as a transition's easing is written.
|
|
12
|
+
*/
|
|
13
|
+
const keyframeSpecSchema = v.object({
|
|
14
|
+
time: v.pipe(finiteSchema, v.minValue(0)),
|
|
15
|
+
value: v.union([
|
|
16
|
+
finiteSchema,
|
|
17
|
+
v.string(),
|
|
18
|
+
v.object({
|
|
19
|
+
x: finiteSchema,
|
|
20
|
+
y: finiteSchema
|
|
21
|
+
}),
|
|
22
|
+
v.boolean()
|
|
23
|
+
]),
|
|
24
|
+
easing: easingSpecSchema
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* A field's keyframes, or with how they meet the field's own value: `set` replaces it, `offset`
|
|
28
|
+
* adds to it, `scale` multiplies it. Without one, a field takes the operation Figma gives it.
|
|
29
|
+
*/
|
|
30
|
+
const keyframeTrackSpecSchema = v.union([v.array(keyframeSpecSchema), v.object({
|
|
31
|
+
operation: v.picklist([
|
|
32
|
+
"set",
|
|
33
|
+
"offset",
|
|
34
|
+
"scale"
|
|
35
|
+
]),
|
|
36
|
+
keyframes: v.array(keyframeSpecSchema)
|
|
37
|
+
})]);
|
|
38
|
+
/**
|
|
39
|
+
* A layer's keyframes by what they animate: a layer field (`opacity`), a motion field by its
|
|
40
|
+
* name (`translationX`, `rotation`, `scale`), or a paint's or effect's field by its address
|
|
41
|
+
* (`fills/0/color`, `effects/0/radius`).
|
|
42
|
+
*/
|
|
43
|
+
const keyframesSpecSchema = v.record(v.string(), keyframeTrackSpecSchema);
|
|
44
|
+
/** How a frame's timeline plays, each setting left out keeping its default. */
|
|
45
|
+
const timelineSpecSchema = v.object({
|
|
46
|
+
duration: v.optional(v.pipe(finiteSchema, v.gtValue(0))),
|
|
47
|
+
autoplay: v.optional(v.boolean()),
|
|
48
|
+
loop: v.optional(v.boolean()),
|
|
49
|
+
muted: v.optional(v.boolean())
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* A preset a layer applies: its kind, when it starts in seconds, and the settings it changes
|
|
53
|
+
* from the preset's defaults, an easing written as a transition's is.
|
|
54
|
+
*/
|
|
55
|
+
const presetSpecSchema = v.object({
|
|
56
|
+
kind: v.picklist(MOTION_PRESET_KINDS),
|
|
57
|
+
offset: v.optional(v.pipe(finiteSchema, v.minValue(0))),
|
|
58
|
+
settings: v.optional(v.record(v.string(), v.unknown()))
|
|
59
|
+
});
|
|
60
|
+
export { easingSpecSchema, keyframeSpecSchema, keyframeTrackSpecSchema, keyframesSpecSchema, presetSpecSchema, timelineSpecSchema };
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","names":[],"sources":["../../src/motion/schema.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport { motionSpecSchema } from '../variables/schema'\nimport { MOTION_PRESET_KINDS } from './presets'\n\nconst finiteSchema = v.pipe(v.number(), v.finite())\n/** An easing as a transition's is written: CSS, a name, as stored, or an Easing variable. */\nexport const easingSpecSchema = motionSpecSchema.entries.easing\n\n/**\n * A keyframe as scripts and JSX write it: when, in seconds, the value it reaches (a number, a\n * color such as `#3366FF`, an `{ x, y }` pair, or a switch), and how the stretch arriving at it\n * eases, as a transition's easing is written.\n */\nexport const keyframeSpecSchema = v.object({\n time: v.pipe(finiteSchema, v.minValue(0)),\n value: v.union([\n finiteSchema,\n v.string(),\n v.object({ x: finiteSchema, y: finiteSchema }),\n v.boolean()\n ]),\n easing: easingSpecSchema\n})\nexport type KeyframeSpec = v.InferOutput<typeof keyframeSpecSchema>\n\n/**\n * A field's keyframes, or with how they meet the field's own value: `set` replaces it, `offset`\n * adds to it, `scale` multiplies it. Without one, a field takes the operation Figma gives it.\n */\nexport const keyframeTrackSpecSchema = v.union([\n v.array(keyframeSpecSchema),\n v.object({\n operation: v.picklist(['set', 'offset', 'scale']),\n keyframes: v.array(keyframeSpecSchema)\n })\n])\nexport type KeyframeTrackSpec = v.InferOutput<typeof keyframeTrackSpecSchema>\n\n/**\n * A layer's keyframes by what they animate: a layer field (`opacity`), a motion field by its\n * name (`translationX`, `rotation`, `scale`), or a paint's or effect's field by its address\n * (`fills/0/color`, `effects/0/radius`).\n */\nexport const keyframesSpecSchema = v.record(v.string(), keyframeTrackSpecSchema)\nexport type KeyframesSpec = v.InferOutput<typeof keyframesSpecSchema>\n\n/** How a frame's timeline plays, each setting left out keeping its default. */\nexport const timelineSpecSchema = v.object({\n duration: v.optional(v.pipe(finiteSchema, v.gtValue(0))),\n autoplay: v.optional(v.boolean()),\n loop: v.optional(v.boolean()),\n muted: v.optional(v.boolean())\n})\nexport type TimelineSpec = v.InferOutput<typeof timelineSpecSchema>\n\n/**\n * A preset a layer applies: its kind, when it starts in seconds, and the settings it changes\n * from the preset's defaults, an easing written as a transition's is.\n */\nexport const presetSpecSchema = v.object({\n kind: v.picklist(MOTION_PRESET_KINDS),\n offset: v.optional(v.pipe(finiteSchema, v.minValue(0))),\n settings: v.optional(v.record(v.string(), v.unknown()))\n})\nexport type PresetSpec = v.InferOutput<typeof presetSpecSchema>\n"],"mappings":";;;;AAKA,MAAM,eAAe,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC;;AAElD,MAAa,mBAAmB,iBAAiB,QAAQ;;;;;;AAOzD,MAAa,qBAAqB,EAAE,OAAO;CACzC,MAAM,EAAE,KAAK,cAAc,EAAE,SAAS,CAAC,CAAC;CACxC,OAAO,EAAE,MAAM;EACb;EACA,EAAE,OAAO;EACT,EAAE,OAAO;GAAE,GAAG;GAAc,GAAG;EAAa,CAAC;EAC7C,EAAE,QAAQ;CACZ,CAAC;CACD,QAAQ;AACV,CAAC;;;;;AAOD,MAAa,0BAA0B,EAAE,MAAM,CAC7C,EAAE,MAAM,kBAAkB,GAC1B,EAAE,OAAO;CACP,WAAW,EAAE,SAAS;EAAC;EAAO;EAAU;CAAO,CAAC;CAChD,WAAW,EAAE,MAAM,kBAAkB;AACvC,CAAC,CACH,CAAC;;;;;;AAQD,MAAa,sBAAsB,EAAE,OAAO,EAAE,OAAO,GAAG,uBAAuB;;AAI/E,MAAa,qBAAqB,EAAE,OAAO;CACzC,UAAU,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC;CACvD,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC;CAChC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC;CAC5B,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC;AAC/B,CAAC;;;;;AAOD,MAAa,mBAAmB,EAAE,OAAO;CACvC,MAAM,EAAE,SAAS,mBAAmB;CACpC,QAAQ,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,SAAS,CAAC,CAAC,CAAC;CACtD,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Easing } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* How far along a segment of `duration` seconds the value is `seconds` in, from 0 to 1, by the
|
|
4
|
+
* easing of the keyframe it arrives at; a spring or a back curve may pass 1 on its way.
|
|
5
|
+
*/
|
|
6
|
+
export declare function segmentProgress(easing: Easing, seconds: number, duration: number): number;
|
|
7
|
+
/**
|
|
8
|
+
* A spring between keyframes as an oscillator over the stretch's own progress, from 0 at its
|
|
9
|
+
* start to 1 at its end: its natural frequency and damping ratio in those units. It eases the
|
|
10
|
+
* stretch exactly as `segmentProgress` does, so an export can write it as a function. Null for an
|
|
11
|
+
* easing that is not a spring.
|
|
12
|
+
*/
|
|
13
|
+
export declare function segmentSpring(easing: Easing, duration: number): {
|
|
14
|
+
natural: number;
|
|
15
|
+
ratio: number;
|
|
16
|
+
} | null;
|
|
17
|
+
/**
|
|
18
|
+
* Where a spring stretch is at `progress` through it, from the oscillator `segmentSpring` gives:
|
|
19
|
+
* the same position `segmentProgress` reaches, as a function of progress alone.
|
|
20
|
+
*/
|
|
21
|
+
export declare function springStretchPosition(spring: {
|
|
22
|
+
natural: number;
|
|
23
|
+
ratio: number;
|
|
24
|
+
}, progress: number): number;
|
|
25
|
+
//# sourceMappingURL=segment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segment.d.ts","names":[],"sources":["../../src/motion/segment.ts"],"mappings":";;;;;wBAmCgB,gBAAgB,QAAQ,QAAQ,iBAAiB;;;;;;;wBAkBjD,cACd,QAAQ,QACR;EACG;EAAiB;;;;;;wBAeN,sBACd;EAAU;EAAiB;GAC3B"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { bezierPosition, easingBezier, easingSpring, settleSpan, springBounce, springPosition } from "../variables/easing.js";
|
|
2
|
+
// src/motion/segment.ts
|
|
3
|
+
/**
|
|
4
|
+
* How far a spring fitted into a segment is `seconds` in: a spring with the easing's bounce,
|
|
5
|
+
* sped up or slowed down so it settles exactly when the segment ends, as Figma fits its springs
|
|
6
|
+
* between keyframes.
|
|
7
|
+
*/
|
|
8
|
+
function segmentSpringPosition(easing, seconds, duration) {
|
|
9
|
+
const spring = easingSpring(easing);
|
|
10
|
+
if (!spring) return seconds / duration;
|
|
11
|
+
const ratio = 1 - springBounce(spring);
|
|
12
|
+
if (!(ratio > 0)) return springPosition({
|
|
13
|
+
...spring,
|
|
14
|
+
damping: Math.max(0, spring.damping)
|
|
15
|
+
}, seconds);
|
|
16
|
+
const frequency = settleSpan(ratio) / duration;
|
|
17
|
+
return springPosition({
|
|
18
|
+
stiffness: frequency * frequency,
|
|
19
|
+
damping: 2 * ratio * frequency,
|
|
20
|
+
mass: 1
|
|
21
|
+
}, seconds);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* How far along a segment of `duration` seconds the value is `seconds` in, from 0 to 1, by the
|
|
25
|
+
* easing of the keyframe it arrives at; a spring or a back curve may pass 1 on its way.
|
|
26
|
+
*/
|
|
27
|
+
function segmentProgress(easing, seconds, duration) {
|
|
28
|
+
if (seconds >= duration) return 1;
|
|
29
|
+
if (seconds <= 0) return 0;
|
|
30
|
+
if (easing.easing === "HOLD") return 0;
|
|
31
|
+
if (easingSpring(easing)) return segmentSpringPosition(easing, seconds, duration);
|
|
32
|
+
const bezier = easingBezier(easing);
|
|
33
|
+
const progress = seconds / duration;
|
|
34
|
+
if (!bezier || bezier.x1 === bezier.y1 && bezier.x2 === bezier.y2) return progress;
|
|
35
|
+
return bezierPosition(bezier, progress);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A spring between keyframes as an oscillator over the stretch's own progress, from 0 at its
|
|
39
|
+
* start to 1 at its end: its natural frequency and damping ratio in those units. It eases the
|
|
40
|
+
* stretch exactly as `segmentProgress` does, so an export can write it as a function. Null for an
|
|
41
|
+
* easing that is not a spring.
|
|
42
|
+
*/
|
|
43
|
+
function segmentSpring(easing, duration) {
|
|
44
|
+
const spring = easingSpring(easing);
|
|
45
|
+
if (!spring) return null;
|
|
46
|
+
const ratio = 1 - springBounce(spring);
|
|
47
|
+
if (ratio > 0) return {
|
|
48
|
+
natural: settleSpan(ratio),
|
|
49
|
+
ratio
|
|
50
|
+
};
|
|
51
|
+
const mass = spring.mass > 0 ? spring.mass : 1;
|
|
52
|
+
return {
|
|
53
|
+
natural: Math.sqrt(Math.max(0, spring.stiffness) / mass) * duration,
|
|
54
|
+
ratio: 0
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Where a spring stretch is at `progress` through it, from the oscillator `segmentSpring` gives:
|
|
59
|
+
* the same position `segmentProgress` reaches, as a function of progress alone.
|
|
60
|
+
*/
|
|
61
|
+
function springStretchPosition(spring, progress) {
|
|
62
|
+
if (progress >= 1) return 1;
|
|
63
|
+
if (progress <= 0) return 0;
|
|
64
|
+
const { natural, ratio } = spring;
|
|
65
|
+
return springPosition({
|
|
66
|
+
stiffness: natural * natural,
|
|
67
|
+
damping: 2 * ratio * natural,
|
|
68
|
+
mass: 1
|
|
69
|
+
}, progress);
|
|
70
|
+
}
|
|
71
|
+
export { segmentProgress, segmentSpring, springStretchPosition };
|
|
72
|
+
|
|
73
|
+
//# sourceMappingURL=segment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segment.js","names":[],"sources":["../../src/motion/segment.ts"],"sourcesContent":["import type { Easing } from '../types'\nimport {\n bezierPosition,\n easingBezier,\n easingSpring,\n springBounce,\n settleSpan,\n springPosition\n} from '../variables/easing'\n\n/**\n * How far a spring fitted into a segment is `seconds` in: a spring with the easing's bounce,\n * sped up or slowed down so it settles exactly when the segment ends, as Figma fits its springs\n * between keyframes.\n */\nfunction segmentSpringPosition(easing: Easing, seconds: number, duration: number): number {\n const spring = easingSpring(easing)\n if (!spring) return seconds / duration\n const ratio = 1 - springBounce(spring)\n // An undamped spring never settles, so there is no span to fit: it swings at its own\n // frequency, without growing, and the segment ends on its value.\n if (!(ratio > 0))\n return springPosition({ ...spring, damping: Math.max(0, spring.damping) }, seconds)\n // Fitted, the spring settles as the segment ends: its span at a frequency of 1, over the time.\n const frequency = settleSpan(ratio) / duration\n return springPosition(\n { stiffness: frequency * frequency, damping: 2 * ratio * frequency, mass: 1 },\n seconds\n )\n}\n\n/**\n * How far along a segment of `duration` seconds the value is `seconds` in, from 0 to 1, by the\n * easing of the keyframe it arrives at; a spring or a back curve may pass 1 on its way.\n */\nexport function segmentProgress(easing: Easing, seconds: number, duration: number): number {\n if (seconds >= duration) return 1\n if (seconds <= 0) return 0\n if (easing.easing === 'HOLD') return 0\n if (easingSpring(easing)) return segmentSpringPosition(easing, seconds, duration)\n const bezier = easingBezier(easing)\n const progress = seconds / duration\n // A curve along the diagonal is linear: exact, without solving it.\n if (!bezier || (bezier.x1 === bezier.y1 && bezier.x2 === bezier.y2)) return progress\n return bezierPosition(bezier, progress)\n}\n\n/**\n * A spring between keyframes as an oscillator over the stretch's own progress, from 0 at its\n * start to 1 at its end: its natural frequency and damping ratio in those units. It eases the\n * stretch exactly as `segmentProgress` does, so an export can write it as a function. Null for an\n * easing that is not a spring.\n */\nexport function segmentSpring(\n easing: Easing,\n duration: number\n): { natural: number; ratio: number } | null {\n const spring = easingSpring(easing)\n if (!spring) return null\n const ratio = 1 - springBounce(spring)\n // Fitted, it settles as the stretch ends: its settling span at a frequency of 1.\n if (ratio > 0) return { natural: settleSpan(ratio), ratio }\n // Undamped, it swings at its own frequency, in the stretch's seconds.\n const mass = spring.mass > 0 ? spring.mass : 1\n return { natural: Math.sqrt(Math.max(0, spring.stiffness) / mass) * duration, ratio: 0 }\n}\n\n/**\n * Where a spring stretch is at `progress` through it, from the oscillator `segmentSpring` gives:\n * the same position `segmentProgress` reaches, as a function of progress alone.\n */\nexport function springStretchPosition(\n spring: { natural: number; ratio: number },\n progress: number\n): number {\n if (progress >= 1) return 1\n if (progress <= 0) return 0\n const { natural, ratio } = spring\n return springPosition(\n { stiffness: natural * natural, damping: 2 * ratio * natural, mass: 1 },\n progress\n )\n}\n"],"mappings":";;;;;;;AAeA,SAAS,sBAAsB,QAAgB,SAAiB,UAA0B;CACxF,MAAM,SAAS,aAAa,MAAM;CAClC,IAAI,CAAC,QAAQ,OAAO,UAAU;CAC9B,MAAM,QAAQ,IAAI,aAAa,MAAM;CAGrC,IAAI,EAAE,QAAQ,IACZ,OAAO,eAAe;EAAE,GAAG;EAAQ,SAAS,KAAK,IAAI,GAAG,OAAO,OAAO;CAAE,GAAG,OAAO;CAEpF,MAAM,YAAY,WAAW,KAAK,IAAI;CACtC,OAAO,eACL;EAAE,WAAW,YAAY;EAAW,SAAS,IAAI,QAAQ;EAAW,MAAM;CAAE,GAC5E,OACF;AACF;;;;;AAMA,SAAgB,gBAAgB,QAAgB,SAAiB,UAA0B;CACzF,IAAI,WAAW,UAAU,OAAO;CAChC,IAAI,WAAW,GAAG,OAAO;CACzB,IAAI,OAAO,WAAW,QAAQ,OAAO;CACrC,IAAI,aAAa,MAAM,GAAG,OAAO,sBAAsB,QAAQ,SAAS,QAAQ;CAChF,MAAM,SAAS,aAAa,MAAM;CAClC,MAAM,WAAW,UAAU;CAE3B,IAAI,CAAC,UAAW,OAAO,OAAO,OAAO,MAAM,OAAO,OAAO,OAAO,IAAK,OAAO;CAC5E,OAAO,eAAe,QAAQ,QAAQ;AACxC;;;;;;;AAQA,SAAgB,cACd,QACA,UAC2C;CAC3C,MAAM,SAAS,aAAa,MAAM;CAClC,IAAI,CAAC,QAAQ,OAAO;CACpB,MAAM,QAAQ,IAAI,aAAa,MAAM;CAErC,IAAI,QAAQ,GAAG,OAAO;EAAE,SAAS,WAAW,KAAK;EAAG;CAAM;CAE1D,MAAM,OAAO,OAAO,OAAO,IAAI,OAAO,OAAO;CAC7C,OAAO;EAAE,SAAS,KAAK,KAAK,KAAK,IAAI,GAAG,OAAO,SAAS,IAAI,IAAI,IAAI;EAAU,OAAO;CAAE;AACzF;;;;;AAMA,SAAgB,sBACd,QACA,UACQ;CACR,IAAI,YAAY,GAAG,OAAO;CAC1B,IAAI,YAAY,GAAG,OAAO;CAC1B,MAAM,EAAE,SAAS,UAAU;CAC3B,OAAO,eACL;EAAE,WAAW,UAAU;EAAS,SAAS,IAAI,QAAQ;EAAS,MAAM;CAAE,GACtE,QACF;AACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SceneGraph } from "../graph.js";
|
|
2
|
+
import { Easing, SceneNode } from "../types.js";
|
|
3
|
+
import { MotionTarget } from "./fields.js";
|
|
4
|
+
import { MotionPreset } from "./presets/settings.js";
|
|
5
|
+
import { KeyframeSpec, KeyframesSpec, PresetSpec, TimelineSpec } from "./schema.js";
|
|
6
|
+
import { KeyframeOperation, KeyframeTrack, MotionTimeline } from "./types.js";
|
|
7
|
+
/** The operation Figma gives a track on `target`: moves and turns add, scales multiply. */
|
|
8
|
+
export declare function defaultKeyframeOperation(target: MotionTarget): KeyframeOperation;
|
|
9
|
+
/** A layer's keyframe tracks from a spec, by address, each in time order. */
|
|
10
|
+
export declare function keyframeTracksFromSpec(graph: SceneGraph, spec: KeyframesSpec): Record<string, KeyframeTrack>;
|
|
11
|
+
/**
|
|
12
|
+
* An easing as a spec writes it most simply: a preset by its name, a custom curve as CSS, and a
|
|
13
|
+
* spring as stored.
|
|
14
|
+
*/
|
|
15
|
+
export declare function easingToSpec(easing: Easing): NonNullable<KeyframeSpec['easing']>;
|
|
16
|
+
/** A layer's keyframe tracks as a spec writes them: operations only where they differ from Figma's. */
|
|
17
|
+
export declare function keyframeTracksToSpec(graph: SceneGraph, tracks: Record<string, KeyframeTrack>): KeyframesSpec;
|
|
18
|
+
/** A frame's timeline from a spec: what it sets over the defaults. */
|
|
19
|
+
export declare function timelineFromSpec(spec: TimelineSpec): MotionTimeline;
|
|
20
|
+
/** A frame's timeline as a spec writes it: only what differs from the defaults. */
|
|
21
|
+
export declare function timelineToSpec(timeline: SceneNode['timeline']): TimelineSpec | undefined;
|
|
22
|
+
/** A layer's presets from a spec. */
|
|
23
|
+
export declare function presetsFromSpec(graph: SceneGraph, specs: PresetSpec[]): MotionPreset[];
|
|
24
|
+
/** A layer's presets as a spec writes them: settings only where given, easings written simply. */
|
|
25
|
+
export declare function presetsToSpec(presets: MotionPreset[]): PresetSpec[];
|
|
26
|
+
//# sourceMappingURL=spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec.d.ts","names":[],"sources":["../../src/motion/spec.ts"],"mappings":";;;;;;;wBA0BgB,yBAAyB,QAAQ,eAAe;;wBAgEhD,uBACd,OAAO,YACP,MAAM,gBACL,eAAe;;;;;wBAsBF,aAAa,QAAQ,SAAS,YAAY;;wBAqB1C,qBACd,OAAO,YACP,QAAQ,eAAe,iBACtB;;wBAkBa,iBAAiB,MAAM,eAAe;;wBAKtC,eAAe,UAAU,wBAAwB;;wBAkCjD,gBAAgB,OAAO,YAAY,OAAO,eAAe;;wBAczD,cAAc,SAAS,iBAAiB"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { parseColor } from "../color/management.js";
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
import { omitBy } from "es-toolkit";
|
|
4
|
+
import { colorToHex8 } from "../color/index.js";
|
|
5
|
+
import { motionFromSpec, motionToSpec } from "../variables/motion.js";
|
|
6
|
+
import { motionAddress, motionTarget } from "./fields.js";
|
|
7
|
+
import { motionPresetSettings } from "./presets/settings.js";
|
|
8
|
+
import { easingSpecSchema } from "./schema.js";
|
|
9
|
+
import { DEFAULT_MOTION_TIMELINE, defaultKeyframeEasing } from "./timeline.js";
|
|
10
|
+
// src/motion/spec.ts
|
|
11
|
+
/** The operation Figma gives a track on `target`: moves and turns add, scales multiply. */
|
|
12
|
+
function defaultKeyframeOperation(target) {
|
|
13
|
+
if (target.kind !== "motion") return "SET";
|
|
14
|
+
if (target.field.startsWith("scale")) return "SCALE";
|
|
15
|
+
if (target.field.startsWith("translation") || target.field.startsWith("rotation")) return "OFFSET";
|
|
16
|
+
return "SET";
|
|
17
|
+
}
|
|
18
|
+
/** What a spec's key names: a motion field by its own name, or any track address. */
|
|
19
|
+
function targetOfKey(key) {
|
|
20
|
+
const target = motionTarget(key) ?? motionTarget(`motion/${key}`);
|
|
21
|
+
if (!target) throw new Error(`"${key}" is not a field keyframes animate`);
|
|
22
|
+
return target;
|
|
23
|
+
}
|
|
24
|
+
/** How a spec names a track's address: a motion field by its own name. */
|
|
25
|
+
function keyOfAddress(address) {
|
|
26
|
+
return address.startsWith("motion/") ? address.slice(7) : address;
|
|
27
|
+
}
|
|
28
|
+
function valueOfSpec(value, target, graph, key) {
|
|
29
|
+
if (typeof value === "number") return {
|
|
30
|
+
type: "FLOAT",
|
|
31
|
+
value
|
|
32
|
+
};
|
|
33
|
+
if (typeof value === "boolean") return {
|
|
34
|
+
type: "BOOLEAN",
|
|
35
|
+
value
|
|
36
|
+
};
|
|
37
|
+
if (typeof value === "string") {
|
|
38
|
+
if (target.kind === "node" || target.kind === "motion" || target.field !== "color") throw new Error(`"${key}" takes numbers, not "${value}"`);
|
|
39
|
+
return {
|
|
40
|
+
type: "COLOR",
|
|
41
|
+
value: parseColor(value, graph.documentColorSpace)
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (!(target.kind === "motion" && (target.field === "translation" || target.field === "scale"))) throw new Error(`"${key}" takes numbers, not an { x, y } pair`);
|
|
45
|
+
return {
|
|
46
|
+
type: "VECTOR",
|
|
47
|
+
value: {
|
|
48
|
+
x: value.x,
|
|
49
|
+
y: value.y
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function valueToSpec(value) {
|
|
54
|
+
if (value.type === "COLOR") return colorToHex8(value.value);
|
|
55
|
+
if (value.type === "VECTOR") return {
|
|
56
|
+
x: value.value.x,
|
|
57
|
+
y: value.value.y
|
|
58
|
+
};
|
|
59
|
+
return value.value;
|
|
60
|
+
}
|
|
61
|
+
function keyframeOfSpec(graph, spec, target, key) {
|
|
62
|
+
const eased = motionFromSpec(graph, { easing: spec.easing }, {
|
|
63
|
+
duration: 0,
|
|
64
|
+
easing: defaultKeyframeEasing()
|
|
65
|
+
});
|
|
66
|
+
return {
|
|
67
|
+
time: spec.time,
|
|
68
|
+
value: valueOfSpec(spec.value, target, graph, key),
|
|
69
|
+
easing: eased.easing,
|
|
70
|
+
...eased.easingVariableId && { easingVariableId: eased.easingVariableId }
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/** A layer's keyframe tracks from a spec, by address, each in time order. */
|
|
74
|
+
function keyframeTracksFromSpec(graph, spec) {
|
|
75
|
+
const tracks = {};
|
|
76
|
+
for (const [key, track] of Object.entries(spec)) {
|
|
77
|
+
const target = targetOfKey(key);
|
|
78
|
+
const list = Array.isArray(track) ? track : track.keyframes;
|
|
79
|
+
const operation = Array.isArray(track) ? defaultKeyframeOperation(target) : track.operation.toUpperCase();
|
|
80
|
+
tracks[motionAddress(target)] = {
|
|
81
|
+
operation,
|
|
82
|
+
keyframes: list.map((keyframe) => keyframeOfSpec(graph, keyframe, target, key)).toSorted((a, b) => a.time - b.time)
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return tracks;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* An easing as a spec writes it most simply: a preset by its name, a custom curve as CSS, and a
|
|
89
|
+
* spring as stored.
|
|
90
|
+
*/
|
|
91
|
+
function easingToSpec(easing) {
|
|
92
|
+
const { bezier } = easing;
|
|
93
|
+
if (easing.easing === "CUSTOM_CUBIC" && bezier) return `cubic-bezier(${bezier.x1}, ${bezier.y1}, ${bezier.x2}, ${bezier.y2})`;
|
|
94
|
+
if (easing.easing === "CUSTOM_SPRING" && easing.spring) return structuredClone(easing);
|
|
95
|
+
return easing.easing;
|
|
96
|
+
}
|
|
97
|
+
const sameEasing = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
98
|
+
function keyframeToSpec(graph, keyframe) {
|
|
99
|
+
const { easing } = motionToSpec(graph, {
|
|
100
|
+
duration: 0,
|
|
101
|
+
...keyframe
|
|
102
|
+
});
|
|
103
|
+
const spec = {
|
|
104
|
+
time: keyframe.time,
|
|
105
|
+
value: valueToSpec(keyframe.value)
|
|
106
|
+
};
|
|
107
|
+
if (typeof easing === "object" && "variable" in easing) spec.easing = easing;
|
|
108
|
+
else if (!sameEasing(keyframe.easing, defaultKeyframeEasing())) spec.easing = easingToSpec(keyframe.easing);
|
|
109
|
+
return spec;
|
|
110
|
+
}
|
|
111
|
+
/** A layer's keyframe tracks as a spec writes them: operations only where they differ from Figma's. */
|
|
112
|
+
function keyframeTracksToSpec(graph, tracks) {
|
|
113
|
+
const spec = {};
|
|
114
|
+
for (const [address, track] of Object.entries(tracks)) {
|
|
115
|
+
const target = motionTarget(address);
|
|
116
|
+
if (!target || track.keyframes.length === 0) continue;
|
|
117
|
+
const keyframes = track.keyframes.map((keyframe) => keyframeToSpec(graph, keyframe));
|
|
118
|
+
spec[keyOfAddress(address)] = track.operation === defaultKeyframeOperation(target) ? keyframes : {
|
|
119
|
+
operation: track.operation.toLowerCase(),
|
|
120
|
+
keyframes
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
return spec;
|
|
124
|
+
}
|
|
125
|
+
/** A frame's timeline from a spec: what it sets over the defaults. */
|
|
126
|
+
function timelineFromSpec(spec) {
|
|
127
|
+
return {
|
|
128
|
+
...DEFAULT_MOTION_TIMELINE,
|
|
129
|
+
...omitBy(spec, (value) => value === void 0)
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/** A frame's timeline as a spec writes it: only what differs from the defaults. */
|
|
133
|
+
function timelineToSpec(timeline) {
|
|
134
|
+
if (!timeline) return void 0;
|
|
135
|
+
const spec = {};
|
|
136
|
+
for (const [key, value] of Object.entries(timeline)) if (value !== void 0 && value !== DEFAULT_MOTION_TIMELINE[key]) spec[key] = value;
|
|
137
|
+
return Object.keys(spec).length > 0 ? spec : void 0;
|
|
138
|
+
}
|
|
139
|
+
function presetSettingOfSpec(graph, kind, name, value) {
|
|
140
|
+
const settings = motionPresetSettings(kind);
|
|
141
|
+
if (!Object.hasOwn(settings, name)) throw new Error(`The ${kind} preset has no setting "${name}"`);
|
|
142
|
+
const setting = settings[name];
|
|
143
|
+
if (setting.type === "easing") {
|
|
144
|
+
const easing = v.parse(easingSpecSchema, value);
|
|
145
|
+
return motionFromSpec(graph, { easing }, {
|
|
146
|
+
duration: 0,
|
|
147
|
+
easing: defaultKeyframeEasing()
|
|
148
|
+
}).easing;
|
|
149
|
+
}
|
|
150
|
+
const expected = Array.isArray(setting.type) ? "string" : setting.type;
|
|
151
|
+
if (typeof value !== expected || Array.isArray(setting.type) && !setting.type.includes(value)) throw new Error(`The ${kind} preset's "${name}" takes ${String(setting.type)}`);
|
|
152
|
+
return value;
|
|
153
|
+
}
|
|
154
|
+
/** A layer's presets from a spec. */
|
|
155
|
+
function presetsFromSpec(graph, specs) {
|
|
156
|
+
return specs.map((spec) => ({
|
|
157
|
+
kind: spec.kind,
|
|
158
|
+
offset: spec.offset ?? 0,
|
|
159
|
+
settings: Object.fromEntries(Object.entries(spec.settings ?? {}).map(([name, value]) => [name, presetSettingOfSpec(graph, spec.kind, name, value)]))
|
|
160
|
+
}));
|
|
161
|
+
}
|
|
162
|
+
/** A layer's presets as a spec writes them: settings only where given, easings written simply. */
|
|
163
|
+
function presetsToSpec(presets) {
|
|
164
|
+
return presets.map((preset) => {
|
|
165
|
+
const settings = Object.fromEntries(Object.entries(preset.settings).map(([name, value]) => [name, typeof value === "object" ? easingToSpec(value) : value]));
|
|
166
|
+
return {
|
|
167
|
+
kind: preset.kind,
|
|
168
|
+
...preset.offset > 0 && { offset: preset.offset },
|
|
169
|
+
...Object.keys(settings).length > 0 && { settings }
|
|
170
|
+
};
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
export { defaultKeyframeOperation, easingToSpec, keyframeTracksFromSpec, keyframeTracksToSpec, presetsFromSpec, presetsToSpec, timelineFromSpec, timelineToSpec };
|
|
174
|
+
|
|
175
|
+
//# sourceMappingURL=spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec.js","names":[],"sources":["../../src/motion/spec.ts"],"sourcesContent":["import { omitBy } from 'es-toolkit'\nimport * as v from 'valibot'\n\nimport { colorToHex8, parseColor } from '../color'\nimport type { SceneGraph } from '../graph'\nimport type { Easing, SceneNode } from '../types'\nimport { motionFromSpec, motionToSpec, type Motion } from '../variables/motion'\nimport { motionAddress, motionTarget, type MotionTarget } from './fields'\nimport { motionPresetSettings, type MotionPreset, type MotionPresetSetting } from './presets'\nimport {\n easingSpecSchema,\n type KeyframeSpec,\n type KeyframesSpec,\n type PresetSpec,\n type TimelineSpec\n} from './schema'\nimport { defaultKeyframeEasing, DEFAULT_MOTION_TIMELINE } from './timeline'\nimport type {\n Keyframe,\n KeyframeOperation,\n KeyframeTrack,\n KeyframeValue,\n MotionTimeline\n} from './types'\n\n/** The operation Figma gives a track on `target`: moves and turns add, scales multiply. */\nexport function defaultKeyframeOperation(target: MotionTarget): KeyframeOperation {\n if (target.kind !== 'motion') return 'SET'\n if (target.field.startsWith('scale')) return 'SCALE'\n if (target.field.startsWith('translation') || target.field.startsWith('rotation')) return 'OFFSET'\n return 'SET'\n}\n\n/** What a spec's key names: a motion field by its own name, or any track address. */\nfunction targetOfKey(key: string): MotionTarget {\n const target = motionTarget(key) ?? motionTarget(`motion/${key}`)\n if (!target) throw new Error(`\"${key}\" is not a field keyframes animate`)\n return target\n}\n\n/** How a spec names a track's address: a motion field by its own name. */\nfunction keyOfAddress(address: string): string {\n return address.startsWith('motion/') ? address.slice('motion/'.length) : address\n}\n\nfunction valueOfSpec(\n value: KeyframeSpec['value'],\n target: MotionTarget,\n graph: SceneGraph,\n key: string\n): KeyframeValue {\n if (typeof value === 'number') return { type: 'FLOAT', value }\n if (typeof value === 'boolean') return { type: 'BOOLEAN', value }\n if (typeof value === 'string') {\n if (target.kind === 'node' || target.kind === 'motion' || target.field !== 'color')\n throw new Error(`\"${key}\" takes numbers, not \"${value}\"`)\n return { type: 'COLOR', value: parseColor(value, graph.documentColorSpace) }\n }\n const pair =\n target.kind === 'motion' && (target.field === 'translation' || target.field === 'scale')\n if (!pair) throw new Error(`\"${key}\" takes numbers, not an { x, y } pair`)\n return { type: 'VECTOR', value: { x: value.x, y: value.y } }\n}\n\nfunction valueToSpec(value: KeyframeValue): KeyframeSpec['value'] {\n if (value.type === 'COLOR') return colorToHex8(value.value)\n if (value.type === 'VECTOR') return { x: value.value.x, y: value.value.y }\n return value.value\n}\n\nfunction keyframeOfSpec(\n graph: SceneGraph,\n spec: KeyframeSpec,\n target: MotionTarget,\n key: string\n): Keyframe {\n const eased = motionFromSpec<Motion>(\n graph,\n { easing: spec.easing },\n { duration: 0, easing: defaultKeyframeEasing() }\n )\n return {\n time: spec.time,\n value: valueOfSpec(spec.value, target, graph, key),\n easing: eased.easing,\n ...(eased.easingVariableId && { easingVariableId: eased.easingVariableId })\n }\n}\n\n/** A layer's keyframe tracks from a spec, by address, each in time order. */\nexport function keyframeTracksFromSpec(\n graph: SceneGraph,\n spec: KeyframesSpec\n): Record<string, KeyframeTrack> {\n const tracks: Record<string, KeyframeTrack> = {}\n for (const [key, track] of Object.entries(spec)) {\n const target = targetOfKey(key)\n const list = Array.isArray(track) ? track : track.keyframes\n const operation = Array.isArray(track)\n ? defaultKeyframeOperation(target)\n : (track.operation.toUpperCase() as KeyframeOperation)\n tracks[motionAddress(target)] = {\n operation,\n keyframes: list\n .map((keyframe) => keyframeOfSpec(graph, keyframe, target, key))\n .toSorted((a, b) => a.time - b.time)\n }\n }\n return tracks\n}\n\n/**\n * An easing as a spec writes it most simply: a preset by its name, a custom curve as CSS, and a\n * spring as stored.\n */\nexport function easingToSpec(easing: Easing): NonNullable<KeyframeSpec['easing']> {\n const { bezier } = easing\n if (easing.easing === 'CUSTOM_CUBIC' && bezier)\n return `cubic-bezier(${bezier.x1}, ${bezier.y1}, ${bezier.x2}, ${bezier.y2})`\n if (easing.easing === 'CUSTOM_SPRING' && easing.spring) return structuredClone(easing)\n return easing.easing\n}\n\nconst sameEasing = (a: Easing, b: Easing) => JSON.stringify(a) === JSON.stringify(b)\n\nfunction keyframeToSpec(graph: SceneGraph, keyframe: Keyframe): KeyframeSpec {\n const { easing } = motionToSpec(graph, { duration: 0, ...keyframe })\n const spec: KeyframeSpec = { time: keyframe.time, value: valueToSpec(keyframe.value) }\n // The default curve goes without saying, unless a variable gives it.\n if (typeof easing === 'object' && 'variable' in easing) spec.easing = easing\n else if (!sameEasing(keyframe.easing, defaultKeyframeEasing()))\n spec.easing = easingToSpec(keyframe.easing)\n return spec\n}\n\n/** A layer's keyframe tracks as a spec writes them: operations only where they differ from Figma's. */\nexport function keyframeTracksToSpec(\n graph: SceneGraph,\n tracks: Record<string, KeyframeTrack>\n): KeyframesSpec {\n const spec: KeyframesSpec = {}\n for (const [address, track] of Object.entries(tracks)) {\n const target = motionTarget(address)\n if (!target || track.keyframes.length === 0) continue\n const keyframes = track.keyframes.map((keyframe) => keyframeToSpec(graph, keyframe))\n spec[keyOfAddress(address)] =\n track.operation === defaultKeyframeOperation(target)\n ? keyframes\n : {\n operation: track.operation.toLowerCase() as 'set' | 'offset' | 'scale',\n keyframes\n }\n }\n return spec\n}\n\n/** A frame's timeline from a spec: what it sets over the defaults. */\nexport function timelineFromSpec(spec: TimelineSpec): MotionTimeline {\n return { ...DEFAULT_MOTION_TIMELINE, ...omitBy(spec, (value) => value === undefined) }\n}\n\n/** A frame's timeline as a spec writes it: only what differs from the defaults. */\nexport function timelineToSpec(timeline: SceneNode['timeline']): TimelineSpec | undefined {\n if (!timeline) return undefined\n const spec: Record<string, number | boolean> = {}\n for (const [key, value] of Object.entries(timeline)) {\n if (value !== undefined && value !== DEFAULT_MOTION_TIMELINE[key as keyof MotionTimeline])\n spec[key] = value\n }\n return Object.keys(spec).length > 0 ? spec : undefined\n}\n\nfunction presetSettingOfSpec(\n graph: SceneGraph,\n kind: MotionPreset['kind'],\n name: string,\n value: unknown\n): MotionPresetSetting {\n const settings = motionPresetSettings(kind)\n if (!Object.hasOwn(settings, name)) throw new Error(`The ${kind} preset has no setting \"${name}\"`)\n const setting = settings[name]\n if (setting.type === 'easing') {\n const easing = v.parse(easingSpecSchema, value)\n return motionFromSpec<Motion>(\n graph,\n { easing },\n { duration: 0, easing: defaultKeyframeEasing() }\n ).easing\n }\n const expected = Array.isArray(setting.type) ? 'string' : setting.type\n if (typeof value !== expected || (Array.isArray(setting.type) && !setting.type.includes(value)))\n throw new Error(`The ${kind} preset's \"${name}\" takes ${String(setting.type)}`)\n return value as MotionPresetSetting\n}\n\n/** A layer's presets from a spec. */\nexport function presetsFromSpec(graph: SceneGraph, specs: PresetSpec[]): MotionPreset[] {\n return specs.map((spec) => ({\n kind: spec.kind,\n offset: spec.offset ?? 0,\n settings: Object.fromEntries(\n Object.entries(spec.settings ?? {}).map(([name, value]) => [\n name,\n presetSettingOfSpec(graph, spec.kind, name, value)\n ])\n )\n }))\n}\n\n/** A layer's presets as a spec writes them: settings only where given, easings written simply. */\nexport function presetsToSpec(presets: MotionPreset[]): PresetSpec[] {\n return presets.map((preset) => {\n const settings = Object.fromEntries(\n Object.entries(preset.settings).map(([name, value]) => [\n name,\n typeof value === 'object' ? easingToSpec(value) : value\n ])\n )\n return {\n kind: preset.kind,\n ...(preset.offset > 0 && { offset: preset.offset }),\n ...(Object.keys(settings).length > 0 && { settings })\n }\n })\n}\n"],"mappings":"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"}
|