@open-pencil/scene-graph 0.18.0-beta.1 → 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 +4 -3
- package/dist/behaviours/index.js +6 -5
- package/dist/behaviours/kinds.d.ts +38 -15
- package/dist/behaviours/kinds.d.ts.map +1 -1
- package/dist/behaviours/kinds.js +119 -4
- 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 +16 -18
- package/dist/behaviours/schema.d.ts.map +1 -1
- package/dist/behaviours/schema.js +2 -3
- package/dist/behaviours/spec.d.ts +3 -6
- package/dist/behaviours/spec.d.ts.map +1 -1
- package/dist/behaviours/spec.js +4 -5
- package/dist/behaviours/transition.d.ts +6 -9
- package/dist/behaviours/transition.d.ts.map +1 -1
- package/dist/behaviours/transition.js +1 -2
- 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 +2 -3
- 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 +13 -15
- package/dist/color/index.d.ts.map +1 -1
- package/dist/color/index.js +3 -4
- package/dist/color/management.d.ts +11 -14
- package/dist/color/management.d.ts.map +1 -1
- package/dist/color/management.js +2 -3
- 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 +16 -19
- package/dist/color/okhcl.d.ts.map +1 -1
- package/dist/color/okhcl.js +3 -4
- package/dist/color/schema.d.ts +4 -7
- package/dist/color/schema.d.ts.map +1 -1
- package/dist/color/schema.js +2 -3
- 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 +1 -2
- 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 +31 -25
- package/dist/copy.d.ts.map +1 -1
- package/dist/copy.js +13 -5
- package/dist/copy.js.map +1 -1
- package/dist/corners.d.ts +8 -10
- package/dist/corners.d.ts.map +1 -1
- package/dist/corners.js +1 -2
- 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 +4 -5
- package/dist/css/index.js +2 -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 +2 -5
- package/dist/css/motion.d.ts.map +1 -1
- package/dist/css/motion.js +2 -3
- package/dist/css/shadows.d.ts +1 -4
- package/dist/css/shadows.d.ts.map +1 -1
- package/dist/css/shadows.js +3 -4
- 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 +9 -12
- package/dist/css/values.d.ts.map +1 -1
- package/dist/css/values.js +2 -3
- 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.js +1 -1
- package/dist/fields/layout.d.ts +4 -7
- package/dist/fields/layout.d.ts.map +1 -1
- package/dist/fields/layout.js +1 -2
- 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 +5 -5
- package/dist/font-style.js.map +1 -1
- package/dist/generated/index.d.ts +32 -16
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/generated/index.js +37 -9
- 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 +43 -69
- package/dist/geometry.d.ts.map +1 -1
- package/dist/geometry.js +44 -76
- 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 +4 -7
- package/dist/graph.d.ts.map +1 -1
- package/dist/graph.js +26 -19
- package/dist/graph.js.map +1 -1
- package/dist/group-bounds.d.ts +10 -12
- package/dist/group-bounds.d.ts.map +1 -1
- package/dist/group-bounds.js +5 -6
- 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 +51 -31
- 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 +3 -4
- 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 +9 -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 +69 -12
- 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 +27 -14
- 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 +3 -6
- package/dist/layout/flow.d.ts.map +1 -1
- package/dist/layout/flow.js +6 -5
- package/dist/layout/flow.js.map +1 -1
- 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 +3 -2
- package/dist/layout/index.js +6 -5
- package/dist/layout/keywords.d.ts +7 -9
- package/dist/layout/keywords.d.ts.map +1 -1
- package/dist/layout/keywords.js +1 -2
- 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 +11 -13
- package/dist/layout/sizing.d.ts.map +1 -1
- package/dist/layout/sizing.js +1 -2
- package/dist/layout/spacing.d.ts +2 -5
- package/dist/layout/spacing.d.ts.map +1 -1
- package/dist/layout/spacing.js +1 -2
- 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 +21 -24
- package/dist/mesh/geometry.d.ts.map +1 -1
- package/dist/mesh/geometry.js +3 -14
- package/dist/mesh/geometry.js.map +1 -1
- package/dist/mesh/index.d.ts +1 -1
- package/dist/mesh/index.js +1 -1
- package/dist/mesh/model.d.ts +5 -8
- package/dist/mesh/model.d.ts.map +1 -1
- package/dist/mesh/model.js +2 -3
- package/dist/mesh/schema.d.ts +10 -13
- package/dist/mesh/schema.d.ts.map +1 -1
- package/dist/mesh/schema.js +3 -4
- 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 +7 -10
- package/dist/mutation-impact.d.ts.map +1 -1
- package/dist/mutation-impact.js +2 -3
- package/dist/node-defaults.d.ts +14 -15
- package/dist/node-defaults.d.ts.map +1 -1
- package/dist/node-defaults.js +133 -51
- 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 +2 -2
- package/dist/paints/index.js +4 -4
- package/dist/paints/pattern.d.ts +6 -9
- package/dist/paints/pattern.d.ts.map +1 -1
- package/dist/paints/pattern.js +1 -2
- 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 +3 -6
- package/dist/paints/shows.d.ts.map +1 -1
- package/dist/paints/shows.js +1 -2
- package/dist/paints/solid.d.ts +1 -4
- package/dist/paints/solid.d.ts.map +1 -1
- package/dist/paints/solid.js +1 -2
- package/dist/paints/stills.d.ts +17 -17
- package/dist/paints/stills.d.ts.map +1 -1
- package/dist/paints/stills.js +22 -18
- package/dist/paints/stills.js.map +1 -1
- 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 +1 -2
- package/dist/plugin-data/fields.d.ts +37 -11
- package/dist/plugin-data/fields.d.ts.map +1 -1
- package/dist/plugin-data/fields.js +35 -10
- 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 +13 -15
- package/dist/resize.d.ts.map +1 -1
- package/dist/resize.js +5 -6
- package/dist/scaling/node.d.ts +2 -5
- package/dist/scaling/node.d.ts.map +1 -1
- package/dist/scaling/node.js +4 -5
- 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 -2
- package/dist/shaders/index.js +2 -2
- package/dist/shaders/model.d.ts +54 -13
- package/dist/shaders/model.d.ts.map +1 -1
- package/dist/shaders/model.js +98 -7
- package/dist/shaders/model.js.map +1 -1
- package/dist/shaders/schema.d.ts +15 -8
- package/dist/shaders/schema.d.ts.map +1 -1
- package/dist/shaders/schema.js +11 -2
- package/dist/shaders/schema.js.map +1 -1
- package/dist/shape-with-text/document.js +9 -21
- package/dist/shape-with-text/document.js.map +1 -1
- 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 +7 -10
- package/dist/shape-with-text/geometry.d.ts.map +1 -1
- package/dist/shape-with-text/geometry.js +4 -7
- package/dist/shape-with-text/geometry.js.map +1 -1
- package/dist/shape-with-text/index.js +1 -1
- 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 +2 -4
- package/dist/shared-style-index.d.ts.map +1 -1
- package/dist/shared-style-index.js +1 -2
- package/dist/shared-style-index.js.map +1 -1
- package/dist/shared-styles.d.ts +17 -19
- package/dist/shared-styles.d.ts.map +1 -1
- package/dist/shared-styles.js +5 -6
- package/dist/slides/drop.d.ts +5 -8
- package/dist/slides/drop.d.ts.map +1 -1
- package/dist/slides/drop.js +1 -2
- package/dist/slides/index.d.ts +19 -19
- package/dist/slides/index.d.ts.map +1 -1
- package/dist/slides/index.js +8 -5
- package/dist/slides/index.js.map +1 -1
- package/dist/slides/motion.d.ts +32 -16
- package/dist/slides/motion.d.ts.map +1 -1
- package/dist/slides/motion.js +30 -5
- package/dist/slides/motion.js.map +1 -1
- package/dist/slides/playback.d.ts +24 -21
- package/dist/slides/playback.d.ts.map +1 -1
- package/dist/slides/playback.js +45 -13
- package/dist/slides/playback.js.map +1 -1
- package/dist/slides/types.d.ts +8 -11
- package/dist/slides/types.d.ts.map +1 -1
- package/dist/slides/types.js +1 -2
- 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 +1 -2
- 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 +5 -8
- package/dist/text/direction.d.ts.map +1 -1
- package/dist/text/direction.js +1 -2
- package/dist/text/index.d.ts +2 -2
- package/dist/text/index.js +5 -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 +4 -7
- package/dist/text/name.d.ts.map +1 -1
- package/dist/text/name.js +1 -2
- 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 +1 -2
- 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 +4 -7
- package/dist/thumbnail.d.ts.map +1 -1
- package/dist/thumbnail.js +1 -2
- package/dist/transfer/apply.d.ts +2 -5
- package/dist/transfer/apply.d.ts.map +1 -1
- package/dist/transfer/apply.js +2 -3
- package/dist/transfer/copied.d.ts +5 -8
- package/dist/transfer/copied.d.ts.map +1 -1
- package/dist/transfer/copied.js +3 -4
- package/dist/transfer/dependencies.d.ts +6 -9
- package/dist/transfer/dependencies.d.ts.map +1 -1
- package/dist/transfer/dependencies.js +13 -11
- 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 +1 -2
- package/dist/transfer/identity.js +1 -2
- package/dist/transfer/index.d.ts +3 -3
- package/dist/transfer/index.js +6 -6
- package/dist/transfer/library.d.ts +5 -7
- package/dist/transfer/library.d.ts.map +1 -1
- package/dist/transfer/library.js +32 -12
- package/dist/transfer/library.js.map +1 -1
- package/dist/transfer/nodes.d.ts +2 -5
- package/dist/transfer/nodes.d.ts.map +1 -1
- package/dist/transfer/nodes.js +8 -6
- package/dist/transfer/nodes.js.map +1 -1
- package/dist/transfer/plan.d.ts +2 -5
- package/dist/transfer/plan.d.ts.map +1 -1
- package/dist/transfer/plan.js +2 -3
- 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 +2 -3
- 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 +1 -2
- package/dist/transfer/variables.d.ts +3 -6
- package/dist/transfer/variables.d.ts.map +1 -1
- package/dist/transfer/variables.js +2 -3
- package/dist/types.d.ts +191 -142
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +15 -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 +24 -25
- package/dist/variables/bindings.d.ts.map +1 -1
- package/dist/variables/bindings.js +28 -23
- 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 +24 -19
- package/dist/variables/easing.d.ts.map +1 -1
- package/dist/variables/easing.js +17 -17
- package/dist/variables/easing.js.map +1 -1
- 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 +6 -8
- package/dist/variables/formula/index.d.ts.map +1 -1
- package/dist/variables/formula/index.js +4 -5
- 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 +5 -6
- package/dist/variables/formula/signatures.d.ts +3 -6
- package/dist/variables/formula/signatures.d.ts.map +1 -1
- package/dist/variables/formula/signatures.js +1 -2
- 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 +6 -9
- 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 +30 -32
- package/dist/variables/index.d.ts.map +1 -1
- package/dist/variables/index.js +17 -18
- package/dist/variables/lookup.d.ts +11 -7
- package/dist/variables/lookup.d.ts.map +1 -1
- package/dist/variables/lookup.js +24 -3
- package/dist/variables/lookup.js.map +1 -1
- package/dist/variables/motion.d.ts +9 -12
- package/dist/variables/motion.d.ts.map +1 -1
- package/dist/variables/motion.js +3 -4
- package/dist/variables/paints.d.ts +18 -20
- package/dist/variables/paints.d.ts.map +1 -1
- package/dist/variables/paints.js +4 -5
- package/dist/variables/resolution.d.ts +22 -19
- package/dist/variables/resolution.d.ts.map +1 -1
- package/dist/variables/resolution.js +13 -5
- package/dist/variables/resolution.js.map +1 -1
- package/dist/variables/schema.d.ts +9 -12
- package/dist/variables/schema.d.ts.map +1 -1
- package/dist/variables/schema.js +3 -4
- package/dist/variables/style-bindings.d.ts +11 -13
- package/dist/variables/style-bindings.d.ts.map +1 -1
- package/dist/variables/style-bindings.js +2 -3
- 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 +23 -5
- package/src/behaviours/index.ts +1 -0
- package/src/behaviours/kinds.ts +103 -1
- package/src/behaviours/listing.ts +142 -0
- package/src/behaviours/model.ts +21 -0
- package/src/blur.ts +88 -0
- package/src/clipping.ts +3 -4
- package/src/comments/threads.ts +8 -1
- package/src/connectors/layout.ts +10 -3
- package/src/connectors/sublayers.ts +2 -1
- package/src/coordinate.ts +17 -25
- package/src/copy.ts +15 -6
- package/src/cubic.ts +57 -1
- package/src/export-format.ts +11 -1
- package/src/font-style.ts +12 -4
- package/src/generated/index.ts +43 -6
- 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 +39 -88
- package/src/graph.ts +21 -6
- package/src/hit-test.ts +66 -26
- 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 +7 -3
- package/src/instances/index.ts +94 -5
- package/src/instances/lookup.ts +61 -0
- package/src/instances/sync.ts +15 -0
- package/src/layout/flow.ts +5 -3
- package/src/layout/index.ts +1 -0
- package/src/layout/stacking.ts +14 -0
- package/src/matrix.ts +11 -1
- package/src/mesh/geometry.ts +2 -13
- 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/node-defaults.ts +131 -49
- package/src/order-keys.ts +16 -2
- package/src/paints/stills.ts +16 -12
- package/src/parse-path.ts +15 -0
- package/src/plugin-data/fields.ts +40 -3
- package/src/polygon.ts +6 -4
- package/src/shaders/model.ts +124 -6
- package/src/shaders/schema.ts +12 -0
- package/src/shape-with-text/document.ts +7 -12
- package/src/shape-with-text/geometry.ts +1 -4
- package/src/slides/index.ts +8 -0
- package/src/slides/motion.ts +35 -1
- package/src/slides/playback.ts +51 -9
- 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/lists.ts +20 -7
- package/src/text/paragraphs.ts +10 -3
- package/src/transfer/dependencies.ts +17 -11
- package/src/transfer/library.ts +36 -12
- package/src/transfer/nodes.ts +8 -0
- package/src/types.ts +71 -8
- package/src/undo.ts +10 -1
- package/src/variables/bindings.ts +33 -16
- package/src/variables/easing.ts +16 -17
- package/src/variables/fields.ts +30 -3
- package/src/variables/lookup.ts +24 -1
- package/src/variables/resolution.ts +15 -1
- package/src/variables/units.ts +2 -3
package/dist/variables/fields.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { mapKeys } from "es-toolkit/object";
|
|
2
|
+
// src/variables/fields.ts
|
|
3
|
+
/**
|
|
4
|
+
* Bindable numeric fields measured in pixels: they scale with their layer, and design-to-code
|
|
5
|
+
* writes them as CSS lengths.
|
|
6
|
+
*/
|
|
7
|
+
const LENGTH_FIELDS = /* @__PURE__ */ new Set([
|
|
4
8
|
"width",
|
|
5
9
|
"height",
|
|
6
10
|
"minWidth",
|
|
@@ -9,7 +13,6 @@ const NUMERIC_FIELDS = /* @__PURE__ */ new Set([
|
|
|
9
13
|
"maxHeight",
|
|
10
14
|
"x",
|
|
11
15
|
"y",
|
|
12
|
-
"rotation",
|
|
13
16
|
"cornerRadius",
|
|
14
17
|
"topLeftRadius",
|
|
15
18
|
"topRightRadius",
|
|
@@ -32,6 +35,12 @@ const NUMERIC_FIELDS = /* @__PURE__ */ new Set([
|
|
|
32
35
|
"gridRowGap",
|
|
33
36
|
"gridColumnGap"
|
|
34
37
|
]);
|
|
38
|
+
/** Every numeric field a variable binds: the lengths, plus unitless opacity and rotation. */
|
|
39
|
+
const NUMERIC_FIELDS = /* @__PURE__ */ new Set([
|
|
40
|
+
"opacity",
|
|
41
|
+
"rotation",
|
|
42
|
+
...LENGTH_FIELDS
|
|
43
|
+
]);
|
|
35
44
|
function isNumericVariableBindingField(field) {
|
|
36
45
|
return NUMERIC_FIELDS.has(field);
|
|
37
46
|
}
|
|
@@ -90,6 +99,16 @@ function effectBindingTarget(field) {
|
|
|
90
99
|
property: match[2]
|
|
91
100
|
};
|
|
92
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* `bindings` with an effect inserted at `index`: each binding of an effect at or after it moves
|
|
104
|
+
* one place later, as its effect does.
|
|
105
|
+
*/
|
|
106
|
+
function withEffectBindingsShifted(bindings, index) {
|
|
107
|
+
return mapKeys(bindings, (_variable, field) => {
|
|
108
|
+
const target = effectBindingTarget(field);
|
|
109
|
+
return target && target.index >= index ? effectBindingField(target.index + 1, target.property) : field;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
93
112
|
/** The properties of an effect that bind: every shadow property, else only the radius. */
|
|
94
113
|
function effectBindableProperties(type) {
|
|
95
114
|
return type === "DROP_SHADOW" || type === "INNER_SHADOW" ? EFFECT_BINDING_PROPERTIES : BLUR_BINDING_PROPERTIES;
|
|
@@ -98,7 +117,6 @@ function effectBindableProperties(type) {
|
|
|
98
117
|
function effectBindingVariableType(property) {
|
|
99
118
|
return property === "color" ? "COLOR" : "FLOAT";
|
|
100
119
|
}
|
|
101
|
-
|
|
102
|
-
export { BOOLEAN_BINDING_FIELDS, EFFECT_BINDING_PROPERTIES, NUMERIC_FIELDS, STRING_BINDING_FIELDS, TEXT_CONTENT_VARIABLE_TYPES, VISIBILITY_VARIABLE_TYPES, effectBindableProperties, effectBindingField, effectBindingTarget, effectBindingVariableType, isNumericVariableBindingField, paintBindingTarget };
|
|
120
|
+
export { BOOLEAN_BINDING_FIELDS, EFFECT_BINDING_PROPERTIES, LENGTH_FIELDS, NUMERIC_FIELDS, STRING_BINDING_FIELDS, TEXT_CONTENT_VARIABLE_TYPES, VISIBILITY_VARIABLE_TYPES, effectBindableProperties, effectBindingField, effectBindingTarget, effectBindingVariableType, isNumericVariableBindingField, paintBindingTarget, withEffectBindingsShifted };
|
|
103
121
|
|
|
104
122
|
//# sourceMappingURL=fields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.js","names":[],"sources":["../../src/variables/fields.ts"],"sourcesContent":["import type { Effect, VariableType } from '../types'\n\nexport const
|
|
1
|
+
{"version":3,"file":"fields.js","names":[],"sources":["../../src/variables/fields.ts"],"sourcesContent":["import { mapKeys } from 'es-toolkit/object'\n\nimport type { Effect, VariableType } from '../types'\n\n/**\n * Bindable numeric fields measured in pixels: they scale with their layer, and design-to-code\n * writes them as CSS lengths.\n */\nexport const LENGTH_FIELDS: ReadonlySet<string> = new Set([\n 'width',\n 'height',\n 'minWidth',\n 'maxWidth',\n 'minHeight',\n 'maxHeight',\n 'x',\n 'y',\n 'cornerRadius',\n 'topLeftRadius',\n 'topRightRadius',\n 'bottomLeftRadius',\n 'bottomRightRadius',\n 'strokeWeight',\n 'borderTopWeight',\n 'borderBottomWeight',\n 'borderLeftWeight',\n 'borderRightWeight',\n 'fontSize',\n 'letterSpacing',\n 'lineHeight',\n 'paddingLeft',\n 'paddingRight',\n 'paddingTop',\n 'paddingBottom',\n 'itemSpacing',\n 'counterAxisSpacing',\n 'gridRowGap',\n 'gridColumnGap'\n])\n\n/** Every numeric field a variable binds: the lengths, plus unitless opacity and rotation. */\nexport const NUMERIC_FIELDS: ReadonlySet<string> = new Set([\n 'opacity',\n 'rotation',\n ...LENGTH_FIELDS\n])\n\nexport function isNumericVariableBindingField(field: string): boolean {\n return NUMERIC_FIELDS.has(field)\n}\n\n/** Text content and font family are the string-valued bindings a node accepts. */\nexport const STRING_BINDING_FIELDS: ReadonlySet<string> = new Set(['text', 'fontFamily'])\n\n/**\n * The variable types text content binds to: text, or a number shown as text, as Figma's layer\n * panel offers. Figma's plugin API takes text alone; font family stays text-only.\n */\nexport const TEXT_CONTENT_VARIABLE_TYPES = [\n 'STRING',\n 'FLOAT'\n] as const satisfies readonly VariableType[]\n\n/** Visibility is the only boolean-valued binding a node accepts. */\nexport const BOOLEAN_BINDING_FIELDS: ReadonlySet<string> = new Set(['visible'])\n\n/**\n * The variable types visibility binds to: a boolean, or text that shows the layer unless it reads\n * as false, as Figma's layer panel offers. Figma's plugin API takes booleans alone.\n */\nexport const VISIBILITY_VARIABLE_TYPES = [\n 'BOOLEAN',\n 'STRING'\n] as const satisfies readonly VariableType[]\n\n/** The paint lists whose colours bind to variables, one binding field per paint. */\nexport type PaintBindingList = 'fills' | 'strokes'\n\nconst PAINT_BINDING_FIELD = /^(fills|strokes)\\/(\\d+)\\/color$/\n\n/**\n * The paint a binding field names the colour of, such as the second fill for `fills/1/color`, or\n * null for a field that binds anything else.\n */\nexport function paintBindingTarget(\n field: string\n): { list: PaintBindingList; index: number } | null {\n if (!field.endsWith('/color')) return null\n const match = PAINT_BINDING_FIELD.exec(field)\n if (!match) return null\n return { list: match[1] === 'fills' ? 'fills' : 'strokes', index: Number(match[2]) }\n}\n\n/** The effect fields that bind to variables, in the order Figma's messages list them. */\nexport const EFFECT_BINDING_PROPERTIES = [\n 'color',\n 'radius',\n 'spread',\n 'offsetX',\n 'offsetY'\n] as const\n\nexport type EffectBindingProperty = (typeof EFFECT_BINDING_PROPERTIES)[number]\n\nconst EFFECT_BINDING_FIELD = /^effects\\/(\\d+)\\/(color|radius|spread|offsetX|offsetY)$/\n\nconst BLUR_BINDING_PROPERTIES = ['radius'] as const satisfies readonly EffectBindingProperty[]\n\n/** The node binding field for one property of the effect at `index`, such as `effects/0/radius`. */\nexport function effectBindingField(index: number, property: EffectBindingProperty): string {\n return `effects/${index}/${property}`\n}\n\n/**\n * The effect and property a binding field names, such as the second effect's blur for\n * `effects/1/radius`, or null for a field that binds anything else.\n */\nexport function effectBindingTarget(\n field: string\n): { index: number; property: EffectBindingProperty } | null {\n if (!field.startsWith('effects/')) return null\n const match = EFFECT_BINDING_FIELD.exec(field)\n if (!match) return null\n return { index: Number(match[1]), property: match[2] as EffectBindingProperty }\n}\n\n/**\n * `bindings` with an effect inserted at `index`: each binding of an effect at or after it moves\n * one place later, as its effect does.\n */\nexport function withEffectBindingsShifted(\n bindings: Readonly<Record<string, string>>,\n index: number\n): Record<string, string> {\n return mapKeys(bindings, (_variable, field) => {\n const target = effectBindingTarget(field)\n return target && target.index >= index\n ? effectBindingField(target.index + 1, target.property)\n : field\n })\n}\n\n/** The properties of an effect that bind: every shadow property, else only the radius. */\nexport function effectBindableProperties(type: Effect['type']): readonly EffectBindingProperty[] {\n return type === 'DROP_SHADOW' || type === 'INNER_SHADOW'\n ? EFFECT_BINDING_PROPERTIES\n : BLUR_BINDING_PROPERTIES\n}\n\n/** The variable type an effect property binds to: colour to COLOR, lengths to FLOAT. */\nexport function effectBindingVariableType(property: EffectBindingProperty): 'COLOR' | 'FLOAT' {\n return property === 'color' ? 'COLOR' : 'FLOAT'\n}\n"],"mappings":";;;;;;AAQA,MAAa,gCAAqC,IAAI,IAAI;CACxD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;AAGD,MAAa,iCAAsC,IAAI,IAAI;CACzD;CACA;CACA,GAAG;AACL,CAAC;AAED,SAAgB,8BAA8B,OAAwB;CACpE,OAAO,eAAe,IAAI,KAAK;AACjC;;AAGA,MAAa,wCAA6C,IAAI,IAAI,CAAC,QAAQ,YAAY,CAAC;;;;;AAMxF,MAAa,8BAA8B,CACzC,UACA,OACF;;AAGA,MAAa,yCAA8C,IAAI,IAAI,CAAC,SAAS,CAAC;;;;;AAM9E,MAAa,4BAA4B,CACvC,WACA,QACF;AAKA,MAAM,sBAAsB;;;;;AAM5B,SAAgB,mBACd,OACkD;CAClD,IAAI,CAAC,MAAM,SAAS,QAAQ,GAAG,OAAO;CACtC,MAAM,QAAQ,oBAAoB,KAAK,KAAK;CAC5C,IAAI,CAAC,OAAO,OAAO;CACnB,OAAO;EAAE,MAAM,MAAM,OAAO,UAAU,UAAU;EAAW,OAAO,OAAO,MAAM,EAAE;CAAE;AACrF;;AAGA,MAAa,4BAA4B;CACvC;CACA;CACA;CACA;CACA;AACF;AAIA,MAAM,uBAAuB;AAE7B,MAAM,0BAA0B,CAAC,QAAQ;;AAGzC,SAAgB,mBAAmB,OAAe,UAAyC;CACzF,OAAO,WAAW,MAAM,GAAG;AAC7B;;;;;AAMA,SAAgB,oBACd,OAC2D;CAC3D,IAAI,CAAC,MAAM,WAAW,UAAU,GAAG,OAAO;CAC1C,MAAM,QAAQ,qBAAqB,KAAK,KAAK;CAC7C,IAAI,CAAC,OAAO,OAAO;CACnB,OAAO;EAAE,OAAO,OAAO,MAAM,EAAE;EAAG,UAAU,MAAM;CAA4B;AAChF;;;;;AAMA,SAAgB,0BACd,UACA,OACwB;CACxB,OAAO,QAAQ,WAAW,WAAW,UAAU;EAC7C,MAAM,SAAS,oBAAoB,KAAK;EACxC,OAAO,UAAU,OAAO,SAAS,QAC7B,mBAAmB,OAAO,QAAQ,GAAG,OAAO,QAAQ,IACpD;CACN,CAAC;AACH;;AAGA,SAAgB,yBAAyB,MAAwD;CAC/F,OAAO,SAAS,iBAAiB,SAAS,iBACtC,4BACA;AACN;;AAGA,SAAgB,0BAA0B,UAAoD;CAC5F,OAAO,aAAa,UAAU,UAAU;AAC1C"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { VariableFormulaNode, VariableLiteral } from "../../types.js";
|
|
2
2
|
import { FormulaValueType } from "./signatures.js";
|
|
3
|
-
//#region src/variables/formula/check.d.ts
|
|
4
3
|
/** The type of a value a formula holds or a variable gives. */
|
|
5
|
-
declare function formulaValueType(value: VariableLiteral): FormulaValueType;
|
|
4
|
+
export declare function formulaValueType(value: VariableLiteral): FormulaValueType;
|
|
6
5
|
/**
|
|
7
6
|
* The type a formula gives, checking each operator's operands on the way. `reference` gives a
|
|
8
7
|
* variable's type, or nothing where it is not known, which any operand type then fits; the
|
|
9
8
|
* result is nothing when it depends on such a reference.
|
|
10
9
|
*/
|
|
11
|
-
declare function inferFormulaType(node: VariableFormulaNode, reference?: (id: string) => FormulaValueType | undefined): FormulaValueType | undefined;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { formulaValueType, inferFormulaType };
|
|
10
|
+
export declare function inferFormulaType(node: VariableFormulaNode, reference?: (id: string) => FormulaValueType | undefined): FormulaValueType | undefined;
|
|
14
11
|
//# sourceMappingURL=check.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.d.ts","names":[],"sources":["../../../src/variables/formula/check.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"check.d.ts","names":[],"sources":["../../../src/variables/formula/check.ts"],"mappings":";;;wBAmEgB,iBAAiB,OAAO,kBAAkB;;;;;;wBAa1C,iBACd,MAAM,qBACN,aAAY,eAAe,+BAC1B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { VariableFormulaError, foldFormula } from "./tree.js";
|
|
2
1
|
import { formulaArity, formulaNeeds, formulaOverloads, isFormulaCall } from "./signatures.js";
|
|
3
|
-
|
|
2
|
+
import { VariableFormulaError, foldFormula } from "./tree.js";
|
|
3
|
+
// src/variables/formula/check.ts
|
|
4
4
|
/** The types an operator can give when some operand types are unknown, written as `undefined`. */
|
|
5
5
|
function formulaResultTypes(operator, types) {
|
|
6
6
|
const results = [];
|
|
@@ -67,7 +67,6 @@ function inferFormulaType(node, reference = () => void 0) {
|
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
//#endregion
|
|
71
70
|
export { checkFormulaOperands, formulaResultTypes, formulaValueType, inferFormulaType };
|
|
72
71
|
|
|
73
72
|
//# sourceMappingURL=check.js.map
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { VariableFormulaNode, VariableLiteral } from "../../types.js";
|
|
2
|
-
//#region src/variables/formula/evaluate.d.ts
|
|
3
2
|
/** Every operand is evaluated, so `false and` or `if()` with an invalid operand still fails. */
|
|
4
|
-
declare function evaluateVariableFormula(node: VariableFormulaNode, resolve: (id: string) => VariableLiteral | undefined): VariableLiteral;
|
|
5
|
-
//#endregion
|
|
6
|
-
export { evaluateVariableFormula };
|
|
3
|
+
export declare function evaluateVariableFormula(node: VariableFormulaNode, resolve: (id: string) => VariableLiteral | undefined): VariableLiteral;
|
|
7
4
|
//# sourceMappingURL=evaluate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate.d.ts","names":[],"sources":["../../../src/variables/formula/evaluate.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"evaluate.d.ts","names":[],"sources":["../../../src/variables/formula/evaluate.ts"],"mappings":";;wBAcgB,wBACd,MAAM,qBACN,UAAU,eAAe,8BACxB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { VariableFormulaError, foldFormula } from "./tree.js";
|
|
2
|
-
import { applyFormulaOperator, isFormulaOperator } from "./signatures.js";
|
|
3
1
|
import { checkFormulaOperands, formulaValueType } from "./check.js";
|
|
4
|
-
|
|
2
|
+
import { applyFormulaOperator, isFormulaOperator } from "./signatures.js";
|
|
3
|
+
import { VariableFormulaError, foldFormula } from "./tree.js";
|
|
4
|
+
// src/variables/formula/evaluate.ts
|
|
5
5
|
/** A finite number, or any other value a formula holds; anything else is refused. */
|
|
6
6
|
function checked(value) {
|
|
7
7
|
if (typeof value !== "number") formulaValueType(value);
|
|
@@ -24,7 +24,6 @@ function evaluateVariableFormula(node, resolve) {
|
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
//#endregion
|
|
28
27
|
export { evaluateVariableFormula };
|
|
29
28
|
|
|
30
29
|
//# sourceMappingURL=evaluate.js.map
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
import { SceneGraph } from "../../graph.js";
|
|
2
2
|
import { VariableLiteral, VariableType, VariableValue } from "../../types.js";
|
|
3
3
|
import { FormulaFold, MAX_FORMULA_DEPTH, VariableFormulaError, foldFormula, isFormulaOperation, isFormulaReference } from "./tree.js";
|
|
4
|
-
import { FormulaValueType, formulaArity, formulaSymbol } from "./signatures.js";
|
|
5
4
|
import { PrintFormulaOptions, printFormula } from "./print.js";
|
|
5
|
+
import { FormulaValueType, formulaArity, formulaSymbol } from "./signatures.js";
|
|
6
6
|
import { FormulaToken, FormulaTokenKind, formulaTokenName, formulaTokens, readFormulaToken } from "./tokens.js";
|
|
7
7
|
import { evaluateVariableFormula } from "./evaluate.js";
|
|
8
8
|
import { formulaValueType, inferFormulaType } from "./check.js";
|
|
9
|
-
//#region src/variables/formula/index.d.ts
|
|
10
9
|
/** Qualified names disambiguate references; the stored formula uses stable IDs. */
|
|
11
|
-
declare function variableFormulaReference(graph: SceneGraph, id: string): string;
|
|
10
|
+
export declare function variableFormulaReference(graph: SceneGraph, id: string): string;
|
|
12
11
|
/** The formula's source text, with `{name}` for each reference, as the clipboard and scripts write it; text is quoted. */
|
|
13
|
-
declare function formatVariableFormula(graph: SceneGraph, value: VariableValue, options?: PrintFormulaOptions): string;
|
|
12
|
+
export declare function formatVariableFormula(graph: SceneGraph, value: VariableValue, options?: PrintFormulaOptions): string;
|
|
14
13
|
/** The type a formula computes a variable's value as; easings and timings have none. */
|
|
15
|
-
declare function formulaTypeOf(type: VariableType | undefined): FormulaValueType | undefined;
|
|
14
|
+
export declare function formulaTypeOf(type: VariableType | undefined): FormulaValueType | undefined;
|
|
16
15
|
/** Validate a draft without changing the document. Formulas operate on stored units. */
|
|
17
|
-
declare function parseVariableFormula(graph: SceneGraph, variableId: string, modeId: string, source: string): {
|
|
16
|
+
export declare function parseVariableFormula(graph: SceneGraph, variableId: string, modeId: string, source: string): {
|
|
18
17
|
value: VariableValue;
|
|
19
18
|
resolved: VariableLiteral;
|
|
20
19
|
};
|
|
21
|
-
|
|
22
|
-
export { type FormulaFold, type FormulaToken, type FormulaTokenKind, type FormulaValueType, MAX_FORMULA_DEPTH, type PrintFormulaOptions, VariableFormulaError, evaluateVariableFormula, foldFormula, formatVariableFormula, formulaArity, formulaSymbol, formulaTokenName, formulaTokens, formulaTypeOf, formulaValueType, inferFormulaType, isFormulaOperation, isFormulaReference, parseVariableFormula, printFormula, readFormulaToken, variableFormulaReference };
|
|
20
|
+
export { type FormulaFold, type FormulaToken, type FormulaTokenKind, type FormulaValueType, MAX_FORMULA_DEPTH, type PrintFormulaOptions, VariableFormulaError, evaluateVariableFormula, foldFormula, formulaArity, formulaSymbol, formulaTokenName, formulaTokens, formulaValueType, inferFormulaType, isFormulaOperation, isFormulaReference, printFormula, readFormulaToken };
|
|
23
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/variables/formula/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/variables/formula/index.ts"],"mappings":";;;;;;;;;wBAuCgB,yBAAyB,OAAO,YAAY;;wBAsB5C,sBACd,OAAO,YACP,OAAO,eACP,UAAU;;wBAiCI,cAAc,MAAM,2BAA2B;;wBAkB/C,qBACd,OAAO,YACP,oBACA,gBACA;EACG,OAAO;EAAe,UAAU"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isEasing } from "../easing.js";
|
|
2
2
|
import { formulaArity, formulaSymbol } from "./signatures.js";
|
|
3
3
|
import { formulaValueType, inferFormulaType } from "./check.js";
|
|
4
4
|
import { evaluateVariableFormula } from "./evaluate.js";
|
|
5
5
|
import { resolveVariableInModes } from "../resolution.js";
|
|
6
|
-
import { isEasing } from "../easing.js";
|
|
7
|
-
import { formulaTokenName, formulaTokens, readFormulaToken } from "./tokens.js";
|
|
8
6
|
import { parseFormulaSyntax } from "./parse.js";
|
|
7
|
+
import { formulaTokenName, formulaTokens, readFormulaToken } from "./tokens.js";
|
|
9
8
|
import { printFormula } from "./print.js";
|
|
10
|
-
|
|
9
|
+
import { MAX_FORMULA_DEPTH, VariableFormulaError, foldFormula, isFormulaOperation, isFormulaReference } from "./tree.js";
|
|
10
|
+
// src/variables/formula/index.ts
|
|
11
11
|
function qualifiedName(graph, id) {
|
|
12
12
|
const variable = graph.variables.get(id);
|
|
13
13
|
if (!variable) return void 0;
|
|
@@ -88,7 +88,6 @@ function parseVariableFormula(graph, variableId, modeId, source) {
|
|
|
88
88
|
resolved: resolveVariableInModes(graph, variableId, (collectionId) => collectionId === variable.collectionId ? modeId : graph.variableCollections.get(collectionId)?.defaultModeId ?? "", /* @__PURE__ */ new Set(), /* @__PURE__ */ new Map(), /* @__PURE__ */ new Map([[variableId, value]]))
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
-
//#endregion
|
|
92
91
|
export { MAX_FORMULA_DEPTH, VariableFormulaError, evaluateVariableFormula, foldFormula, formatVariableFormula, formulaArity, formulaSymbol, formulaTokenName, formulaTokens, formulaTypeOf, formulaValueType, inferFormulaType, isFormulaOperation, isFormulaReference, parseVariableFormula, printFormula, readFormulaToken, variableFormulaReference };
|
|
93
92
|
|
|
94
93
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { FORMULA_NON_ASSOCIATIVE, binaryFormulaOperator, formulaCallOperator, formulaPrecedence, prefixFormulaOperator } from "./signatures.js";
|
|
3
|
-
import { checkFormulaOperands } from "./check.js";
|
|
1
|
+
import * as v from "valibot";
|
|
4
2
|
import { tryParseColor } from "../../color/management.js";
|
|
3
|
+
import { checkFormulaOperands } from "./check.js";
|
|
4
|
+
import { FORMULA_NON_ASSOCIATIVE, binaryFormulaOperator, formulaCallOperator, formulaPrecedence, prefixFormulaOperator } from "./signatures.js";
|
|
5
5
|
import { formulaTokenName, formulaTokens } from "./tokens.js";
|
|
6
|
-
import
|
|
7
|
-
|
|
6
|
+
import { VariableFormulaError } from "./tree.js";
|
|
7
|
+
// src/variables/formula/parse.ts
|
|
8
8
|
/** Check what the editor may leave open while typing, which a saved formula cannot hold. */
|
|
9
9
|
function checkedTokens(source) {
|
|
10
10
|
const tokens = formulaTokens(source);
|
|
@@ -135,7 +135,6 @@ function parseFormulaSyntax(source, reference) {
|
|
|
135
135
|
if (extra) throw new VariableFormulaError(`Unexpected ${formulaTokenName(extra)}`);
|
|
136
136
|
return result;
|
|
137
137
|
}
|
|
138
|
-
//#endregion
|
|
139
138
|
export { parseFormulaSyntax };
|
|
140
139
|
|
|
141
140
|
//# sourceMappingURL=parse.js.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { VariableFormulaNode } from "../../types.js";
|
|
2
2
|
import { FormulaValueType } from "./signatures.js";
|
|
3
|
-
|
|
4
|
-
interface PrintFormulaOptions {
|
|
3
|
+
export interface PrintFormulaOptions {
|
|
5
4
|
/**
|
|
6
5
|
* Past this many characters, a formula breaks before each operator of its outermost chain of
|
|
7
6
|
* `or`, `and`, or `+` and `-`, with the lines after the first indented.
|
|
@@ -19,7 +18,5 @@ interface PrintFormulaOptions {
|
|
|
19
18
|
type?: (id: string) => FormulaValueType | undefined;
|
|
20
19
|
}
|
|
21
20
|
/** Print a formula with only the parentheses its precedence needs; `reference` spells a variable. */
|
|
22
|
-
declare function printFormula(node: VariableFormulaNode, reference: (id: string) => string, { width, display, type }?: PrintFormulaOptions): string;
|
|
23
|
-
//#endregion
|
|
24
|
-
export { PrintFormulaOptions, printFormula };
|
|
21
|
+
export declare function printFormula(node: VariableFormulaNode, reference: (id: string) => string, { width, display, type }?: PrintFormulaOptions): string;
|
|
25
22
|
//# sourceMappingURL=print.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"print.d.ts","names":[],"sources":["../../../src/variables/formula/print.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"print.d.ts","names":[],"sources":["../../../src/variables/formula/print.ts"],"mappings":";;iBAgCiB;;;;;EAKf;;;;;EAKA,WAAW;;;;;EAKX,QAAQ,eAAe;;;wBAkET,aACd,MAAM,qBACN,YAAY,yBACV,OAAO,SAAS,SAAQ"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { isFormulaOperation, isFormulaReference } from "./tree.js";
|
|
2
|
-
import { FORMULA_NON_ASSOCIATIVE, formulaArity, formulaPrecedence, formulaSymbol, isFormulaAssociative, isFormulaCall } from "./signatures.js";
|
|
3
|
-
import { inferFormulaType } from "./check.js";
|
|
4
1
|
import { colorToHex8 } from "../../color/index.js";
|
|
5
|
-
|
|
2
|
+
import { inferFormulaType } from "./check.js";
|
|
3
|
+
import { FORMULA_NON_ASSOCIATIVE, formulaArity, formulaPrecedence, formulaSymbol, isFormulaAssociative, isFormulaCall } from "./signatures.js";
|
|
4
|
+
import { isFormulaOperation, isFormulaReference } from "./tree.js";
|
|
5
|
+
// src/variables/formula/print.ts
|
|
6
6
|
const ATOM = 8;
|
|
7
7
|
/** A long formula breaks before these: `or`, `and`, and `+` and `-`. */
|
|
8
8
|
const BREAKABLE = new Set([
|
|
@@ -99,7 +99,6 @@ function printWith(reference, regroups, root, rootBreak) {
|
|
|
99
99
|
};
|
|
100
100
|
return print(root, 0, rootBreak).text;
|
|
101
101
|
}
|
|
102
|
-
//#endregion
|
|
103
102
|
export { printFormula };
|
|
104
103
|
|
|
105
104
|
//# sourceMappingURL=print.js.map
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { VariableFormula } from "../../types.js";
|
|
2
1
|
import * as v from "valibot";
|
|
3
|
-
|
|
4
|
-
declare const variableFormulaSchema: v.GenericSchema<unknown, VariableFormula>;
|
|
5
|
-
//#endregion
|
|
6
|
-
export { variableFormulaSchema };
|
|
2
|
+
import { VariableFormula } from "../../types.js";
|
|
3
|
+
export declare const variableFormulaSchema: v.GenericSchema<unknown, VariableFormula>;
|
|
7
4
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","names":[],"sources":["../../../src/variables/formula/schema.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.d.ts","names":[],"sources":["../../../src/variables/formula/schema.ts"],"mappings":";;qBAqEa,uBAAuB,EAAE,uBAAuB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import { formulaArity } from "./signatures.js";
|
|
3
|
-
import { inferFormulaType } from "./check.js";
|
|
1
|
+
import * as v from "valibot";
|
|
4
2
|
import { VARIABLE_FORMULA_OPERATORS } from "../../types.js";
|
|
5
3
|
import { variableAliasSchema } from "../schema.js";
|
|
6
|
-
import
|
|
7
|
-
|
|
4
|
+
import { inferFormulaType } from "./check.js";
|
|
5
|
+
import { formulaArity } from "./signatures.js";
|
|
6
|
+
import "./tree.js";
|
|
7
|
+
// src/variables/formula/schema.ts
|
|
8
8
|
const finiteNumberSchema = v.pipe(v.number(), v.finite());
|
|
9
9
|
const booleanSchema = v.boolean();
|
|
10
10
|
const stringSchema = v.string();
|
|
@@ -56,7 +56,6 @@ const variableFormulaSchema = v.pipe(v.object({
|
|
|
56
56
|
]),
|
|
57
57
|
value: nodeSchema(64, /* @__PURE__ */ new Map())
|
|
58
58
|
}), v.check(fitsType, "Formula operands do not fit their operators"));
|
|
59
|
-
//#endregion
|
|
60
59
|
export { variableFormulaSchema };
|
|
61
60
|
|
|
62
61
|
//# sourceMappingURL=schema.js.map
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { VariableFormulaOperator, VariableFormulaType } from "../../types.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare function formulaArity(operator: VariableFormulaOperator): number;
|
|
2
|
+
export type FormulaValueType = VariableFormulaType;
|
|
3
|
+
export declare function formulaArity(operator: VariableFormulaOperator): number;
|
|
5
4
|
/** How the operator is printed: its first spelling. */
|
|
6
|
-
declare function formulaSymbol(operator: VariableFormulaOperator): string;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { FormulaValueType, formulaArity, formulaSymbol };
|
|
5
|
+
export declare function formulaSymbol(operator: VariableFormulaOperator): string;
|
|
9
6
|
//# sourceMappingURL=signatures.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signatures.d.ts","names":[],"sources":["../../../src/variables/formula/signatures.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"signatures.d.ts","names":[],"sources":["../../../src/variables/formula/signatures.ts"],"mappings":";YASY,mBAAmB;wBAsMf,aAAa,UAAU;;wBAKvB,cAAc,UAAU"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { VariableFormulaError } from "./tree.js";
|
|
2
1
|
import { variableText, variableTruthy } from "../text.js";
|
|
2
|
+
import { VariableFormulaError } from "./tree.js";
|
|
3
3
|
const FLOAT_FLOAT = ["FLOAT", "FLOAT"];
|
|
4
4
|
const TEXT_TYPES = [
|
|
5
5
|
"FLOAT",
|
|
@@ -232,7 +232,6 @@ function formulaNeeds(operator) {
|
|
|
232
232
|
function applyFormulaOperator(operator, operands) {
|
|
233
233
|
return SIGNATURES[operator].apply(operands);
|
|
234
234
|
}
|
|
235
|
-
//#endregion
|
|
236
235
|
export { FORMULA_KEYWORDS, FORMULA_NON_ASSOCIATIVE, applyFormulaOperator, binaryFormulaOperator, formulaArity, formulaCallOperator, formulaNeeds, formulaOverloads, formulaPrecedence, formulaSymbol, isFormulaAssociative, isFormulaCall, isFormulaOperator, prefixFormulaOperator };
|
|
237
236
|
|
|
238
237
|
//# sourceMappingURL=signatures.js.map
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
//#region src/variables/formula/tokens.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* What a piece of formula text is. `reference` is a braced `{name}` and `string` a quoted
|
|
4
3
|
* `"text"`, either of which may still be open while it is typed; `name` is a bare word that
|
|
5
4
|
* names a variable; `function` is a call's name, such as `if`; `invalid` is any character the
|
|
6
5
|
* syntax has no place for.
|
|
7
6
|
*/
|
|
8
|
-
type FormulaTokenKind = 'number' | 'string' | 'color' | 'reference' | 'name' | 'function' | 'keyword' | 'bool' | 'operator' | 'paren' | 'comma' | 'invalid';
|
|
9
|
-
interface FormulaToken {
|
|
7
|
+
export type FormulaTokenKind = 'number' | 'string' | 'color' | 'reference' | 'name' | 'function' | 'keyword' | 'bool' | 'operator' | 'paren' | 'comma' | 'invalid';
|
|
8
|
+
export interface FormulaToken {
|
|
10
9
|
kind: FormulaTokenKind;
|
|
11
10
|
text: string;
|
|
12
11
|
from: number;
|
|
@@ -16,11 +15,9 @@ interface FormulaToken {
|
|
|
16
15
|
* The token that starts at `at`, which must not be whitespace. Reading never fails: text the
|
|
17
16
|
* syntax has no place for is an `invalid` token, so an editor can highlight what a parser rejects.
|
|
18
17
|
*/
|
|
19
|
-
declare function readFormulaToken(source: string, at: number): FormulaToken;
|
|
18
|
+
export declare function readFormulaToken(source: string, at: number): FormulaToken;
|
|
20
19
|
/** Every token of a formula, in order, without the whitespace between them. */
|
|
21
|
-
declare function formulaTokens(source: string): FormulaToken[];
|
|
20
|
+
export declare function formulaTokens(source: string): FormulaToken[];
|
|
22
21
|
/** The variable a reference or bare name gives, without braces or surrounding spaces. */
|
|
23
|
-
declare function formulaTokenName(token: FormulaToken): string;
|
|
24
|
-
//#endregion
|
|
25
|
-
export { FormulaToken, FormulaTokenKind, formulaTokenName, formulaTokens, readFormulaToken };
|
|
22
|
+
export declare function formulaTokenName(token: FormulaToken): string;
|
|
26
23
|
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","names":[],"sources":["../../../src/variables/formula/tokens.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","names":[],"sources":["../../../src/variables/formula/tokens.ts"],"mappings":";;;;;;YAQY;iBAcK;EACf,MAAM;EACN;EACA;EACA;;;;;;wBA4Cc,iBAAiB,gBAAgB,aAAa;;wBAuB9C,cAAc,iBAAiB;;wBAiB/B,iBAAiB,OAAO"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FORMULA_KEYWORDS, formulaCallOperator } from "./signatures.js";
|
|
2
|
-
|
|
2
|
+
// src/variables/formula/tokens.ts
|
|
3
3
|
const NUMBER = /(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?/y;
|
|
4
4
|
const WORD = /[\p{L}_$][\p{L}\p{N}_$]*/uy;
|
|
5
5
|
const OPERATOR = /<=|>=|==|!=|&&|\|\||[-+*/<>!]/y;
|
|
@@ -76,7 +76,6 @@ function formulaTokenName(token) {
|
|
|
76
76
|
if (token.kind !== "reference") return token.text;
|
|
77
77
|
return token.text.slice(1, token.text.endsWith("}") ? -1 : void 0).trim();
|
|
78
78
|
}
|
|
79
|
-
//#endregion
|
|
80
79
|
export { formulaTokenName, formulaTokens, readFormulaToken };
|
|
81
80
|
|
|
82
81
|
//# sourceMappingURL=tokens.js.map
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { VariableAlias, VariableFormulaLiteral, VariableFormulaNode, VariableFormulaOperation } from "../../types.js";
|
|
2
|
-
|
|
3
|
-
declare
|
|
4
|
-
declare class VariableFormulaError extends Error {
|
|
2
|
+
export declare const MAX_FORMULA_DEPTH = 64;
|
|
3
|
+
export declare class VariableFormulaError extends Error {
|
|
5
4
|
name: string;
|
|
6
5
|
}
|
|
7
|
-
declare function isFormulaOperation(node: VariableFormulaNode): node is VariableFormulaOperation;
|
|
8
|
-
declare function isFormulaReference(node: VariableFormulaNode): node is VariableAlias;
|
|
6
|
+
export declare function isFormulaOperation(node: VariableFormulaNode): node is VariableFormulaOperation;
|
|
7
|
+
export declare function isFormulaReference(node: VariableFormulaNode): node is VariableAlias;
|
|
9
8
|
/** What a fold makes of each kind of node; an operation gets its operands' results. */
|
|
10
|
-
interface FormulaFold<T> {
|
|
9
|
+
export interface FormulaFold<T> {
|
|
11
10
|
literal: (value: VariableFormulaLiteral) => T;
|
|
12
11
|
reference: (id: string) => T;
|
|
13
12
|
operation: (node: VariableFormulaOperation, operands: T[]) => T;
|
|
@@ -16,7 +15,5 @@ interface FormulaFold<T> {
|
|
|
16
15
|
* Walk a formula bottom-up, as evaluating, type checking, remapping and writing it to another
|
|
17
16
|
* format all do. A tree deeper than `MAX_FORMULA_DEPTH` is refused rather than walked.
|
|
18
17
|
*/
|
|
19
|
-
declare function foldFormula<T>(node: VariableFormulaNode, fold: FormulaFold<T>, depth?: number): T;
|
|
20
|
-
//#endregion
|
|
21
|
-
export { FormulaFold, MAX_FORMULA_DEPTH, VariableFormulaError, foldFormula, isFormulaOperation, isFormulaReference };
|
|
18
|
+
export declare function foldFormula<T>(node: VariableFormulaNode, fold: FormulaFold<T>, depth?: number): T;
|
|
22
19
|
//# sourceMappingURL=tree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.d.ts","names":[],"sources":["../../../src/variables/formula/tree.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tree.d.ts","names":[],"sources":["../../../src/variables/formula/tree.ts"],"mappings":";qBAOa;qBAGA,6BAA6B;EAC/B;;wBAGK,mBAAmB,MAAM,sBAAsB,QAAQ;wBAIvD,mBAAmB,MAAM,sBAAsB,QAAQ;;iBAKtD,YAAY;EAC3B,UAAU,OAAO,2BAA2B;EAC5C,YAAY,eAAe;EAC3B,YAAY,MAAM,0BAA0B,UAAU,QAAQ;;;;;;wBAOhD,YAAY,GAAG,MAAM,qBAAqB,MAAM,YAAY,IAAI,iBAAY"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/variables/formula/tree.ts
|
|
2
2
|
const MAX_FORMULA_DEPTH = 64;
|
|
3
3
|
const MAX_FORMULA_LENGTH = 4096;
|
|
4
4
|
var VariableFormulaError = class extends Error {
|
|
@@ -29,7 +29,6 @@ function mapFormulaReferences(node, map) {
|
|
|
29
29
|
})
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
//#endregion
|
|
33
32
|
export { MAX_FORMULA_DEPTH, MAX_FORMULA_LENGTH, VariableFormulaError, foldFormula, isFormulaOperation, isFormulaReference, mapFormulaReferences };
|
|
34
33
|
|
|
35
34
|
//# sourceMappingURL=tree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.js","names":[],"sources":["../../../src/variables/formula/tree.ts"],"sourcesContent":["import type {\n VariableAlias,\n VariableFormulaNode,\n VariableFormulaLiteral,\n VariableFormulaOperation\n} from '#scene-graph/types'\n\nexport const MAX_FORMULA_DEPTH = 64\nexport const MAX_FORMULA_LENGTH = 4096\n\nexport class VariableFormulaError extends Error {\n override name = 'VariableFormulaError'\n}\n\nexport function isFormulaOperation(node: VariableFormulaNode): node is VariableFormulaOperation {\n return typeof node === 'object' && 'operator' in node\n}\n\nexport function isFormulaReference(node: VariableFormulaNode): node is VariableAlias {\n return typeof node === 'object' && 'aliasId' in node\n}\n\n/** What a fold makes of each kind of node; an operation gets its operands' results. */\nexport interface FormulaFold<T> {\n literal: (value: VariableFormulaLiteral) => T\n reference: (id: string) => T\n operation: (node: VariableFormulaOperation, operands: T[]) => T\n}\n\n/**\n * Walk a formula bottom-up, as evaluating, type checking, remapping and writing it to another\n * format all do. A tree deeper than `MAX_FORMULA_DEPTH` is refused rather than walked.\n */\nexport function foldFormula<T>(node: VariableFormulaNode, fold: FormulaFold<T>, depth = 0): T {\n if (depth > MAX_FORMULA_DEPTH) throw new VariableFormulaError('Formula is too deeply nested')\n if (isFormulaOperation(node))\n return fold.operation(\n node,\n node.operands.map((operand) => foldFormula(operand, fold, depth + 1))\n )\n return isFormulaReference(node) ? fold.reference(node.aliasId) : fold.literal(node)\n}\n\nexport function mapFormulaReferences(\n node: VariableFormulaNode,\n map: (id: string) => string\n): VariableFormulaNode {\n return foldFormula<VariableFormulaNode>(node, {\n literal: (value) => (typeof value === 'object' ? { ...value } : value),\n reference: (id) => ({ aliasId: map(id) }),\n operation: ({ operator }, operands) => ({ operator, operands })\n })\n}\n"],"mappings":";AAOA,MAAa,oBAAoB;AACjC,MAAa,qBAAqB;AAElC,IAAa,uBAAb,cAA0C,MAAM;
|
|
1
|
+
{"version":3,"file":"tree.js","names":[],"sources":["../../../src/variables/formula/tree.ts"],"sourcesContent":["import type {\n VariableAlias,\n VariableFormulaNode,\n VariableFormulaLiteral,\n VariableFormulaOperation\n} from '#scene-graph/types'\n\nexport const MAX_FORMULA_DEPTH = 64\nexport const MAX_FORMULA_LENGTH = 4096\n\nexport class VariableFormulaError extends Error {\n override name = 'VariableFormulaError'\n}\n\nexport function isFormulaOperation(node: VariableFormulaNode): node is VariableFormulaOperation {\n return typeof node === 'object' && 'operator' in node\n}\n\nexport function isFormulaReference(node: VariableFormulaNode): node is VariableAlias {\n return typeof node === 'object' && 'aliasId' in node\n}\n\n/** What a fold makes of each kind of node; an operation gets its operands' results. */\nexport interface FormulaFold<T> {\n literal: (value: VariableFormulaLiteral) => T\n reference: (id: string) => T\n operation: (node: VariableFormulaOperation, operands: T[]) => T\n}\n\n/**\n * Walk a formula bottom-up, as evaluating, type checking, remapping and writing it to another\n * format all do. A tree deeper than `MAX_FORMULA_DEPTH` is refused rather than walked.\n */\nexport function foldFormula<T>(node: VariableFormulaNode, fold: FormulaFold<T>, depth = 0): T {\n if (depth > MAX_FORMULA_DEPTH) throw new VariableFormulaError('Formula is too deeply nested')\n if (isFormulaOperation(node))\n return fold.operation(\n node,\n node.operands.map((operand) => foldFormula(operand, fold, depth + 1))\n )\n return isFormulaReference(node) ? fold.reference(node.aliasId) : fold.literal(node)\n}\n\nexport function mapFormulaReferences(\n node: VariableFormulaNode,\n map: (id: string) => string\n): VariableFormulaNode {\n return foldFormula<VariableFormulaNode>(node, {\n literal: (value) => (typeof value === 'object' ? { ...value } : value),\n reference: (id) => ({ aliasId: map(id) }),\n operation: ({ operator }, operands) => ({ operator, operands })\n })\n}\n"],"mappings":";AAOA,MAAa,oBAAoB;AACjC,MAAa,qBAAqB;AAElC,IAAa,uBAAb,cAA0C,MAAM;CACrC,OAAO;AAClB;AAEA,SAAgB,mBAAmB,MAA6D;CAC9F,OAAO,OAAO,SAAS,YAAY,cAAc;AACnD;AAEA,SAAgB,mBAAmB,MAAkD;CACnF,OAAO,OAAO,SAAS,YAAY,aAAa;AAClD;;;;;AAaA,SAAgB,YAAe,MAA2B,MAAsB,QAAQ,GAAM;CAC5F,IAAI,QAAA,IAA2B,MAAM,IAAI,qBAAqB,8BAA8B;CAC5F,IAAI,mBAAmB,IAAI,GACzB,OAAO,KAAK,UACV,MACA,KAAK,SAAS,KAAK,YAAY,YAAY,SAAS,MAAM,QAAQ,CAAC,CAAC,CACtE;CACF,OAAO,mBAAmB,IAAI,IAAI,KAAK,UAAU,KAAK,OAAO,IAAI,KAAK,QAAQ,IAAI;AACpF;AAEA,SAAgB,qBACd,MACA,KACqB;CACrB,OAAO,YAAiC,MAAM;EAC5C,UAAU,UAAW,OAAO,UAAU,WAAW,EAAE,GAAG,MAAM,IAAI;EAChE,YAAY,QAAQ,EAAE,SAAS,IAAI,EAAE,EAAE;EACvC,YAAY,EAAE,YAAY,cAAc;GAAE;GAAU;EAAS;CAC/D,CAAC;AACH"}
|