@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
package/dist/layout/limits.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { GridTrack } from "../types.js";
|
|
2
|
-
//#region src/layout/limits.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Bounds for the numbers layout computes with and for the values it writes back.
|
|
5
4
|
*
|
|
@@ -10,31 +9,29 @@ import { GridTrack } from "../types.js";
|
|
|
10
9
|
* clamps to these bounds, and tool schemas reject values outside them.
|
|
11
10
|
*/
|
|
12
11
|
/** The largest size or position, in pixels, that a layout value may carry. */
|
|
13
|
-
declare const MAX_LAYOUT_LENGTH = 1000000;
|
|
12
|
+
export declare const MAX_LAYOUT_LENGTH = 1000000;
|
|
14
13
|
/** The largest gap, padding, or stroke a layout value may carry, in pixels. */
|
|
15
|
-
declare const MAX_LAYOUT_SPACING = 100000;
|
|
14
|
+
export declare const MAX_LAYOUT_SPACING = 100000;
|
|
16
15
|
/** The largest number of tracks one grid template may name. */
|
|
17
|
-
declare const MAX_GRID_TRACKS = 1000;
|
|
16
|
+
export declare const MAX_GRID_TRACKS = 1000;
|
|
18
17
|
/** The last grid line a placement may name; line 0 leaves placement to auto-flow. */
|
|
19
|
-
declare const MAX_GRID_LINE = 1000;
|
|
18
|
+
export declare const MAX_GRID_LINE = 1000;
|
|
20
19
|
/** The most tracks one grid item may span. */
|
|
21
|
-
declare const MAX_GRID_SPAN = 1000;
|
|
20
|
+
export declare const MAX_GRID_SPAN = 1000;
|
|
22
21
|
/** The largest rotation, in degrees, a layout or transform may carry. */
|
|
23
|
-
declare const MAX_LAYOUT_ANGLE = 360000;
|
|
22
|
+
export declare const MAX_LAYOUT_ANGLE = 360000;
|
|
24
23
|
/** The largest font size, in pixels, text may be set in. */
|
|
25
|
-
declare const MAX_FONT_SIZE = 10000;
|
|
24
|
+
export declare const MAX_FONT_SIZE = 10000;
|
|
26
25
|
/** The largest ratio a layout factor, such as a flex grow share, may carry. */
|
|
27
|
-
declare const MAX_LAYOUT_FACTOR = 1000;
|
|
26
|
+
export declare const MAX_LAYOUT_FACTOR = 1000;
|
|
28
27
|
/** The largest line height or letter spacing, in pixels or percent, a text may carry. */
|
|
29
|
-
declare const MAX_TEXT_LENGTH = 10000;
|
|
28
|
+
export declare const MAX_TEXT_LENGTH = 10000;
|
|
30
29
|
/** A length that cannot be negative, such as a size, padding, gap, or radius. */
|
|
31
|
-
declare function clampLayoutLength(value: number, max?: number): number;
|
|
30
|
+
export declare function clampLayoutLength(value: number, max?: number): number;
|
|
32
31
|
/** A coordinate that may be negative, such as a position. */
|
|
33
|
-
declare function clampLayoutPosition(value: number, max?: number): number;
|
|
32
|
+
export declare function clampLayoutPosition(value: number, max?: number): number;
|
|
34
33
|
/** A font size in pixels, at least one and at most `MAX_FONT_SIZE`; fractions are kept. */
|
|
35
|
-
declare function clampFontSize(value: number): number;
|
|
34
|
+
export declare function clampFontSize(value: number): number;
|
|
36
35
|
/** A grid template's tracks, with at most `MAX_GRID_TRACKS` of them and no negative sizes. */
|
|
37
|
-
declare function clampGridTracks(tracks: readonly GridTrack[]): GridTrack[];
|
|
38
|
-
//#endregion
|
|
39
|
-
export { MAX_FONT_SIZE, MAX_GRID_LINE, MAX_GRID_SPAN, MAX_GRID_TRACKS, MAX_LAYOUT_ANGLE, MAX_LAYOUT_FACTOR, MAX_LAYOUT_LENGTH, MAX_LAYOUT_SPACING, MAX_TEXT_LENGTH, clampFontSize, clampGridTracks, clampLayoutLength, clampLayoutPosition };
|
|
36
|
+
export declare function clampGridTracks(tracks: readonly GridTrack[]): GridTrack[];
|
|
40
37
|
//# sourceMappingURL=limits.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limits.d.ts","names":[],"sources":["../../src/layout/limits.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"limits.d.ts","names":[],"sources":["../../src/layout/limits.ts"],"mappings":";;;;;;;;;;;qBAaa;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;wBAGG,kBAAkB,eAAe;;wBAMjC,oBAAoB,eAAe;;wBAMnC,cAAc;;wBAMd,gBAAgB,iBAAiB,cAAc"}
|
package/dist/layout/limits.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/layout/limits.ts
|
|
2
2
|
/**
|
|
3
3
|
* Bounds for the numbers layout computes with and for the values it writes back.
|
|
4
4
|
*
|
|
@@ -48,7 +48,6 @@ function clampGridTracks(tracks) {
|
|
|
48
48
|
value: clampLayoutLength(track.value)
|
|
49
49
|
}));
|
|
50
50
|
}
|
|
51
|
-
//#endregion
|
|
52
51
|
export { MAX_FONT_SIZE, MAX_GRID_LINE, MAX_GRID_SPAN, MAX_GRID_TRACKS, MAX_LAYOUT_ANGLE, MAX_LAYOUT_FACTOR, MAX_LAYOUT_LENGTH, MAX_LAYOUT_SPACING, MAX_TEXT_LENGTH, clampFontSize, clampGridTracks, clampLayoutLength, clampLayoutPosition };
|
|
53
52
|
|
|
54
53
|
//# sourceMappingURL=limits.js.map
|
package/dist/layout/sizing.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SceneGraph } from "../graph.js";
|
|
2
2
|
import { LayoutSizing, SceneNode, TextAutoResize } from "../types.js";
|
|
3
|
-
//#region src/layout/sizing.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* How a node sizes along one screen axis, as Figma's `layoutSizingHorizontal` and
|
|
6
5
|
* `layoutSizingVertical` report it. Fill is stored on the child, the way Figma stores it:
|
|
@@ -9,32 +8,39 @@ import { LayoutSizing, SceneNode, TextAutoResize } from "../types.js";
|
|
|
9
8
|
* `primaryAxisSizing` and `counterAxisSizing` for an auto-layout frame, `textAutoResize`
|
|
10
9
|
* for text.
|
|
11
10
|
*/
|
|
12
|
-
type LayoutSizingAxis = 'HORIZONTAL' | 'VERTICAL';
|
|
11
|
+
export type LayoutSizingAxis = 'HORIZONTAL' | 'VERTICAL';
|
|
13
12
|
type AutoLayoutMode = Exclude<SceneNode['layoutMode'], 'NONE'>;
|
|
14
13
|
/** The node's sizing along `axis`: fill from its parent, else its own hug, else fixed. */
|
|
15
|
-
declare function layoutSizing(graph: SceneGraph, node: SceneNode, axis: LayoutSizingAxis): LayoutSizing;
|
|
14
|
+
export declare function layoutSizing(graph: SceneGraph, node: SceneNode, axis: LayoutSizingAxis): LayoutSizing;
|
|
16
15
|
/** `layoutSizing` for code that holds the parent rather than the graph. */
|
|
17
|
-
declare function layoutSizingInParent(parentNode: SceneNode | undefined, node: SceneNode, axis: LayoutSizingAxis): LayoutSizing;
|
|
16
|
+
export declare function layoutSizingInParent(parentNode: SceneNode | undefined, node: SceneNode, axis: LayoutSizingAxis): LayoutSizing;
|
|
18
17
|
/** The sizings this node accepts on either axis, in Figma's order. */
|
|
19
|
-
declare function layoutSizingOptions(graph: SceneGraph, node: SceneNode): LayoutSizing[];
|
|
18
|
+
export declare function layoutSizingOptions(graph: SceneGraph, node: SceneNode): LayoutSizing[];
|
|
20
19
|
/** Figma's reason for refusing `value` on this node, or `undefined` when it applies. */
|
|
21
|
-
declare function layoutSizingError(graph: SceneGraph, node: SceneNode, value: LayoutSizing): string | undefined;
|
|
20
|
+
export declare function layoutSizingError(graph: SceneGraph, node: SceneNode, value: LayoutSizing): string | undefined;
|
|
22
21
|
/** The text auto-resize that hugs the content along the axes given. */
|
|
23
|
-
declare function textAutoResizeFor(hugsWidth: boolean, hugsHeight: boolean): TextAutoResize;
|
|
22
|
+
export declare function textAutoResizeFor(hugsWidth: boolean, hugsHeight: boolean): TextAutoResize;
|
|
24
23
|
/**
|
|
25
24
|
* The fields that set the node's sizing along `axis` to `value`, as Figma's setter writes
|
|
26
25
|
* them. A value Figma refuses yields no updates; `layoutSizingError` says why.
|
|
27
26
|
*/
|
|
28
|
-
declare function layoutSizingUpdates(graph: SceneGraph, node: SceneNode, axis: LayoutSizingAxis, value: LayoutSizing): Partial<SceneNode>;
|
|
27
|
+
export declare function layoutSizingUpdates(graph: SceneGraph, node: SceneNode, axis: LayoutSizingAxis, value: LayoutSizing): Partial<SceneNode>;
|
|
29
28
|
/**
|
|
30
29
|
* The fields that make a child fill `axis` of a parent laid out as `parentLayout`, for a node
|
|
31
30
|
* an importer builds before it joins the graph. Under a parent without auto layout, such as a
|
|
32
31
|
* staging parent the node leaves when placed, both are set, so it fills whichever axis its
|
|
33
32
|
* eventual parent stacks along.
|
|
34
33
|
*/
|
|
35
|
-
declare function fillSizingFields(parentLayout: SceneNode['layoutMode'], axis: LayoutSizingAxis): Partial<Pick<SceneNode, 'layoutGrow' | 'layoutAlignSelf'>>;
|
|
34
|
+
export declare function fillSizingFields(parentLayout: SceneNode['layoutMode'], axis: LayoutSizingAxis): Partial<Pick<SceneNode, 'layoutGrow' | 'layoutAlignSelf'>>;
|
|
36
35
|
/** An auto-layout frame's own sizing when it hugs or fixes its width and height. */
|
|
37
|
-
declare function autoLayoutSizingFields(direction: AutoLayoutMode, width: 'FIXED' | 'HUG', height: 'FIXED' | 'HUG'): Pick<SceneNode, 'primaryAxisSizing' | 'counterAxisSizing'>;
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
export declare function autoLayoutSizingFields(direction: AutoLayoutMode, width: 'FIXED' | 'HUG', height: 'FIXED' | 'HUG'): Pick<SceneNode, 'primaryAxisSizing' | 'counterAxisSizing'>;
|
|
37
|
+
/**
|
|
38
|
+
* The axes a frame hugs but keeps its size on, as Figma keeps them. With nothing in its flow,
|
|
39
|
+
* no visible layer that is not placed absolutely, it keeps every axis it hugs: a new frame keeps
|
|
40
|
+
* the size it was made at, and one that loses its last layer keeps the size it hugged to. On the
|
|
41
|
+
* counter axis it also keeps its size when every child in its flow fills that axis and none has
|
|
42
|
+
* content of its own to hug.
|
|
43
|
+
*/
|
|
44
|
+
export declare function heldHugAxes(graph: SceneGraph, frame: SceneNode): ('width' | 'height')[];
|
|
45
|
+
export {};
|
|
40
46
|
//# sourceMappingURL=sizing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sizing.d.ts","names":[],"sources":["../../src/layout/sizing.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sizing.d.ts","names":[],"sources":["../../src/layout/sizing.ts"],"mappings":";;;;;;;;;;YAYY;KAEP,iBAAiB,QAAQ;;wBAgDd,aACd,OAAO,YACP,MAAM,WACN,MAAM,mBACL;;wBAKa,qBACd,YAAY,uBACZ,MAAM,WACN,MAAM,mBACL;;wBASa,oBAAoB,OAAO,YAAY,MAAM,YAAY;;wBAOzD,kBACd,OAAO,YACP,MAAM,WACN,OAAO;;wBAoBO,kBAAkB,oBAAoB,sBAAsB;;;;;wBAyB5D,oBACd,OAAO,YACP,MAAM,WACN,MAAM,kBACN,OAAO,eACN,QAAQ;;;;;;;wBA+BK,iBACd,cAAc,yBACd,MAAM,mBACL,QAAQ,KAAK;;wBAMA,uBACd,WAAW,gBACX,wBACA,0BACC,KAAK;;;;;;;;wBAeQ,YAAY,OAAO,YAAY,OAAO"}
|
package/dist/layout/sizing.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { flowChildren } from "./flow.js";
|
|
2
|
+
// src/layout/sizing.ts
|
|
2
3
|
function primaryAxis(mode) {
|
|
3
4
|
return mode === "VERTICAL" ? "VERTICAL" : "HORIZONTAL";
|
|
4
5
|
}
|
|
@@ -115,7 +116,21 @@ function autoLayoutSizingFields(direction, width, height) {
|
|
|
115
116
|
counterAxisSizing: horizontal ? height : width
|
|
116
117
|
};
|
|
117
118
|
}
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
/**
|
|
120
|
+
* The axes a frame hugs but keeps its size on, as Figma keeps them. With nothing in its flow,
|
|
121
|
+
* no visible layer that is not placed absolutely, it keeps every axis it hugs: a new frame keeps
|
|
122
|
+
* the size it was made at, and one that loses its last layer keeps the size it hugged to. On the
|
|
123
|
+
* counter axis it also keeps its size when every child in its flow fills that axis and none has
|
|
124
|
+
* content of its own to hug.
|
|
125
|
+
*/
|
|
126
|
+
function heldHugAxes(graph, frame) {
|
|
127
|
+
if (frame.layoutMode !== "HORIZONTAL" && frame.layoutMode !== "VERTICAL") return [];
|
|
128
|
+
const [primary, counter] = frame.layoutMode === "HORIZONTAL" ? ["width", "height"] : ["height", "width"];
|
|
129
|
+
const hugged = [...frame.primaryAxisSizing === "HUG" ? [primary] : [], ...frame.counterAxisSizing === "HUG" ? [counter] : []];
|
|
130
|
+
const flow = flowChildren(graph, frame);
|
|
131
|
+
if (flow.length === 0) return hugged;
|
|
132
|
+
return flow.every((child) => child.layoutMode === "NONE" && child.type !== "TEXT" && (child.layoutAlignSelf === "STRETCH" || child.layoutAlignSelf === "AUTO" && frame.counterAxisAlign === "STRETCH")) && frame.counterAxisSizing === "HUG" ? [counter] : [];
|
|
133
|
+
}
|
|
134
|
+
export { autoLayoutSizingFields, fillSizingFields, heldHugAxes, layoutSizing, layoutSizingError, layoutSizingInParent, layoutSizingOptions, layoutSizingUpdates, textAutoResizeFor };
|
|
120
135
|
|
|
121
136
|
//# sourceMappingURL=sizing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sizing.js","names":[],"sources":["../../src/layout/sizing.ts"],"sourcesContent":["import type { SceneGraph } from '../graph'\nimport type { LayoutSizing, SceneNode, TextAutoResize } from '../types'\n\n/**\n * How a node sizes along one screen axis, as Figma's `layoutSizingHorizontal` and\n * `layoutSizingVertical` report it. Fill is stored on the child, the way Figma stores it:\n * along the parent's primary axis as `layoutGrow`, across it as `layoutAlignSelf: 'STRETCH'`.\n * A grid lays its children out like a horizontal stack. Hug is stored on the node itself:\n * `primaryAxisSizing` and `counterAxisSizing` for an auto-layout frame, `textAutoResize`\n * for text.\n */\nexport type LayoutSizingAxis = 'HORIZONTAL' | 'VERTICAL'\n\ntype AutoLayoutMode = Exclude<SceneNode['layoutMode'], 'NONE'>\n\nfunction primaryAxis(mode: AutoLayoutMode): LayoutSizingAxis {\n return mode === 'VERTICAL' ? 'VERTICAL' : 'HORIZONTAL'\n}\n\n/** The auto-layout parent that sizes a node's fill, or `undefined` when nothing does. */\nfunction fillingParent(parent: SceneNode | undefined, node: SceneNode): SceneNode | undefined {\n if (!parent || parent.layoutMode === 'NONE' || node.layoutPositioning === 'ABSOLUTE')\n return undefined\n return parent\n}\n\nfunction graphParent(graph: SceneGraph, node: SceneNode): SceneNode | undefined {\n return node.parentId ? graph.getNode(node.parentId) : undefined\n}\n\nfunction fills(parent: SceneNode, node: SceneNode, axis: LayoutSizingAxis): boolean {\n if (parent.layoutMode === 'NONE') return false\n if (axis === primaryAxis(parent.layoutMode)) return node.layoutGrow > 0\n if (node.layoutAlignSelf === 'STRETCH') return true\n return (\n node.layoutAlignSelf === 'AUTO' &&\n parent.layoutMode !== 'GRID' &&\n parent.counterAxisAlign === 'STRETCH'\n )\n}\n\nfunction ownSizingField(\n node: SceneNode,\n axis: LayoutSizingAxis\n): 'primaryAxisSizing' | 'counterAxisSizing' | undefined {\n if (node.layoutMode === 'NONE') return undefined\n return axis === primaryAxis(node.layoutMode) ? 'primaryAxisSizing' : 'counterAxisSizing'\n}\n\nfunction textHugs(autoResize: TextAutoResize, axis: LayoutSizingAxis): boolean {\n if (autoResize === 'WIDTH_AND_HEIGHT') return true\n return axis === 'VERTICAL' && autoResize === 'HEIGHT'\n}\n\nfunction hugs(node: SceneNode, axis: LayoutSizingAxis): boolean {\n if (node.type === 'TEXT') return textHugs(node.textAutoResize, axis)\n const field = ownSizingField(node, axis)\n return field !== undefined && node[field] === 'HUG'\n}\n\n/** The node's sizing along `axis`: fill from its parent, else its own hug, else fixed. */\nexport function layoutSizing(\n graph: SceneGraph,\n node: SceneNode,\n axis: LayoutSizingAxis\n): LayoutSizing {\n return layoutSizingInParent(graphParent(graph, node), node, axis)\n}\n\n/** `layoutSizing` for code that holds the parent rather than the graph. */\nexport function layoutSizingInParent(\n parentNode: SceneNode | undefined,\n node: SceneNode,\n axis: LayoutSizingAxis\n): LayoutSizing {\n const parent = fillingParent(parentNode, node)\n if (parent && fills(parent, node, axis)) return 'FILL'\n // Figma reports text outside auto-layout as fixed, though it still resizes to its content.\n if (hugs(node, axis) && (parent || node.layoutMode !== 'NONE')) return 'HUG'\n return 'FIXED'\n}\n\n/** The sizings this node accepts on either axis, in Figma's order. */\nexport function layoutSizingOptions(graph: SceneGraph, node: SceneNode): LayoutSizing[] {\n return (['FIXED', 'HUG', 'FILL'] as const).filter(\n (value) => layoutSizingError(graph, node, value) === undefined\n )\n}\n\n/** Figma's reason for refusing `value` on this node, or `undefined` when it applies. */\nexport function layoutSizingError(\n graph: SceneGraph,\n node: SceneNode,\n value: LayoutSizing\n): string | undefined {\n const parent = graphParent(graph, node)\n const inAutoLayout = parent !== undefined && parent.layoutMode !== 'NONE'\n if (!inAutoLayout && node.layoutMode === 'NONE') {\n return 'node must be an auto-layout frame or a child of an auto-layout frame'\n }\n if (value === 'FILL') {\n if (!inAutoLayout) return 'FILL can only be set on children of auto-layout frames'\n if (node.layoutPositioning === 'ABSOLUTE') {\n return 'FILL cannot be set on absolute positioned auto-layout children'\n }\n }\n if (value === 'HUG' && node.layoutMode === 'NONE' && node.type !== 'TEXT') {\n return 'HUG can only be set on auto-layout frames or text children of auto-layout frames'\n }\n return undefined\n}\n\n/** The text auto-resize that hugs the content along the axes given. */\nexport function textAutoResizeFor(hugsWidth: boolean, hugsHeight: boolean): TextAutoResize {\n if (hugsWidth && hugsHeight) return 'WIDTH_AND_HEIGHT'\n return hugsHeight ? 'HEIGHT' : 'NONE'\n}\n\nfunction textSizingUpdates(\n graph: SceneGraph,\n node: SceneNode,\n axis: LayoutSizingAxis,\n value: LayoutSizing\n): Partial<SceneNode> {\n const other: LayoutSizingAxis = axis === 'HORIZONTAL' ? 'VERTICAL' : 'HORIZONTAL'\n const hugsAxis = value === 'HUG'\n const hugsOther = layoutSizing(graph, node, other) === 'HUG'\n const autoResize =\n axis === 'HORIZONTAL'\n ? textAutoResizeFor(hugsAxis, hugsOther)\n : textAutoResizeFor(hugsOther, hugsAxis)\n return autoResize === node.textAutoResize ? {} : { textAutoResize: autoResize }\n}\n\n/**\n * The fields that set the node's sizing along `axis` to `value`, as Figma's setter writes\n * them. A value Figma refuses yields no updates; `layoutSizingError` says why.\n */\nexport function layoutSizingUpdates(\n graph: SceneGraph,\n node: SceneNode,\n axis: LayoutSizingAxis,\n value: LayoutSizing\n): Partial<SceneNode> {\n if (layoutSizingError(graph, node, value) !== undefined) return {}\n const updates: Partial<SceneNode> = {}\n const parent = fillingParent(graphParent(graph, node), node)\n if (parent && parent.layoutMode !== 'NONE') {\n const fill = value === 'FILL'\n if (axis === primaryAxis(parent.layoutMode)) {\n if (fill !== node.layoutGrow > 0) updates.layoutGrow = fill ? 1 : 0\n } else if (fill && node.layoutAlignSelf !== 'STRETCH') {\n updates.layoutAlignSelf = 'STRETCH'\n } else if (!fill && fills(parent, node, axis)) {\n // A flex parent set to stretch its children stretches this one too unless it opts out.\n const inheritsStretch = parent.layoutMode !== 'GRID' && parent.counterAxisAlign === 'STRETCH'\n updates.layoutAlignSelf = inheritsStretch ? 'MIN' : 'AUTO'\n }\n }\n const field = ownSizingField(node, axis)\n if (field) {\n const own = value === 'HUG' ? 'HUG' : 'FIXED'\n if (node[field] !== own) updates[field] = own\n }\n if (node.type === 'TEXT') Object.assign(updates, textSizingUpdates(graph, node, axis, value))\n return updates\n}\n\n/**\n * The fields that make a child fill `axis` of a parent laid out as `parentLayout`, for a node\n * an importer builds before it joins the graph. Under a parent without auto layout, such as a\n * staging parent the node leaves when placed, both are set, so it fills whichever axis its\n * eventual parent stacks along.\n */\nexport function fillSizingFields(\n parentLayout: SceneNode['layoutMode'],\n axis: LayoutSizingAxis\n): Partial<Pick<SceneNode, 'layoutGrow' | 'layoutAlignSelf'>> {\n if (parentLayout === 'NONE') return { layoutGrow: 1, layoutAlignSelf: 'STRETCH' }\n return axis === primaryAxis(parentLayout) ? { layoutGrow: 1 } : { layoutAlignSelf: 'STRETCH' }\n}\n\n/** An auto-layout frame's own sizing when it hugs or fixes its width and height. */\nexport function autoLayoutSizingFields(\n direction: AutoLayoutMode,\n width: 'FIXED' | 'HUG',\n height: 'FIXED' | 'HUG'\n): Pick<SceneNode, 'primaryAxisSizing' | 'counterAxisSizing'> {\n const horizontal = primaryAxis(direction) === 'HORIZONTAL'\n return {\n primaryAxisSizing: horizontal ? width : height,\n counterAxisSizing: horizontal ? height : width\n }\n}\n"],"mappings":";AAeA,SAAS,YAAY,MAAwC;CAC3D,OAAO,SAAS,aAAa,aAAa;AAC5C;;AAGA,SAAS,cAAc,QAA+B,MAAwC;CAC5F,IAAI,CAAC,UAAU,OAAO,eAAe,UAAU,KAAK,sBAAsB,YACxE,OAAO,KAAA;CACT,OAAO;AACT;AAEA,SAAS,YAAY,OAAmB,MAAwC;CAC9E,OAAO,KAAK,WAAW,MAAM,QAAQ,KAAK,QAAQ,IAAI,KAAA;AACxD;AAEA,SAAS,MAAM,QA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Q;EACtC,IAAI,KAAK,WAAW,KAAK,QAAQ,SAAS;CAC5C;CACA,IAAI,KAAK,SAAS,QAAQ,OAAO,OAAO,SAAS,kBAAkB,OAAO,MAAM,MAAM,KAAK,CAAC;CAC5F,OAAO;AACT;;;;;;;AAQA,SAAgB,iBACd,cACA,MAC4D;CAC5D,IAAI,iBAAiB,QAAQ,OAAO;EAAE,YAAY;EAAG,iBAAiB;CAAU;CAChF,OAAO,SAAS,YAAY,YAAY,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,iBAAiB,UAAU;AAC/F;;AAGA,SAAgB,uBACd,WACA,OACA,QAC4D;CAC5D,MAAM,aAAa,YAAY,SAAS,MAAM;CAC9C,OAAO;EACL,mBAAmB,aAAa,QAAQ;EACxC,mBAAmB,aAAa,SAAS;CAC3C;AACF"}
|
|
1
|
+
{"version":3,"file":"sizing.js","names":[],"sources":["../../src/layout/sizing.ts"],"sourcesContent":["import type { SceneGraph } from '../graph'\nimport type { LayoutSizing, SceneNode, TextAutoResize } from '../types'\nimport { flowChildren } from './flow'\n\n/**\n * How a node sizes along one screen axis, as Figma's `layoutSizingHorizontal` and\n * `layoutSizingVertical` report it. Fill is stored on the child, the way Figma stores it:\n * along the parent's primary axis as `layoutGrow`, across it as `layoutAlignSelf: 'STRETCH'`.\n * A grid lays its children out like a horizontal stack. Hug is stored on the node itself:\n * `primaryAxisSizing` and `counterAxisSizing` for an auto-layout frame, `textAutoResize`\n * for text.\n */\nexport type LayoutSizingAxis = 'HORIZONTAL' | 'VERTICAL'\n\ntype AutoLayoutMode = Exclude<SceneNode['layoutMode'], 'NONE'>\n\nfunction primaryAxis(mode: AutoLayoutMode): LayoutSizingAxis {\n return mode === 'VERTICAL' ? 'VERTICAL' : 'HORIZONTAL'\n}\n\n/** The auto-layout parent that sizes a node's fill, or `undefined` when nothing does. */\nfunction fillingParent(parent: SceneNode | undefined, node: SceneNode): SceneNode | undefined {\n if (!parent || parent.layoutMode === 'NONE' || node.layoutPositioning === 'ABSOLUTE')\n return undefined\n return parent\n}\n\nfunction graphParent(graph: SceneGraph, node: SceneNode): SceneNode | undefined {\n return node.parentId ? graph.getNode(node.parentId) : undefined\n}\n\nfunction fills(parent: SceneNode, node: SceneNode, axis: LayoutSizingAxis): boolean {\n if (parent.layoutMode === 'NONE') return false\n if (axis === primaryAxis(parent.layoutMode)) return node.layoutGrow > 0\n if (node.layoutAlignSelf === 'STRETCH') return true\n return (\n node.layoutAlignSelf === 'AUTO' &&\n parent.layoutMode !== 'GRID' &&\n parent.counterAxisAlign === 'STRETCH'\n )\n}\n\nfunction ownSizingField(\n node: SceneNode,\n axis: LayoutSizingAxis\n): 'primaryAxisSizing' | 'counterAxisSizing' | undefined {\n if (node.layoutMode === 'NONE') return undefined\n return axis === primaryAxis(node.layoutMode) ? 'primaryAxisSizing' : 'counterAxisSizing'\n}\n\nfunction textHugs(autoResize: TextAutoResize, axis: LayoutSizingAxis): boolean {\n if (autoResize === 'WIDTH_AND_HEIGHT') return true\n return axis === 'VERTICAL' && autoResize === 'HEIGHT'\n}\n\nfunction hugs(node: SceneNode, axis: LayoutSizingAxis): boolean {\n if (node.type === 'TEXT') return textHugs(node.textAutoResize, axis)\n const field = ownSizingField(node, axis)\n return field !== undefined && node[field] === 'HUG'\n}\n\n/** The node's sizing along `axis`: fill from its parent, else its own hug, else fixed. */\nexport function layoutSizing(\n graph: SceneGraph,\n node: SceneNode,\n axis: LayoutSizingAxis\n): LayoutSizing {\n return layoutSizingInParent(graphParent(graph, node), node, axis)\n}\n\n/** `layoutSizing` for code that holds the parent rather than the graph. */\nexport function layoutSizingInParent(\n parentNode: SceneNode | undefined,\n node: SceneNode,\n axis: LayoutSizingAxis\n): LayoutSizing {\n const parent = fillingParent(parentNode, node)\n if (parent && fills(parent, node, axis)) return 'FILL'\n // Figma reports text outside auto-layout as fixed, though it still resizes to its content.\n if (hugs(node, axis) && (parent || node.layoutMode !== 'NONE')) return 'HUG'\n return 'FIXED'\n}\n\n/** The sizings this node accepts on either axis, in Figma's order. */\nexport function layoutSizingOptions(graph: SceneGraph, node: SceneNode): LayoutSizing[] {\n return (['FIXED', 'HUG', 'FILL'] as const).filter(\n (value) => layoutSizingError(graph, node, value) === undefined\n )\n}\n\n/** Figma's reason for refusing `value` on this node, or `undefined` when it applies. */\nexport function layoutSizingError(\n graph: SceneGraph,\n node: SceneNode,\n value: LayoutSizing\n): string | undefined {\n const parent = graphParent(graph, node)\n const inAutoLayout = parent !== undefined && parent.layoutMode !== 'NONE'\n if (!inAutoLayout && node.layoutMode === 'NONE') {\n return 'node must be an auto-layout frame or a child of an auto-layout frame'\n }\n if (value === 'FILL') {\n if (!inAutoLayout) return 'FILL can only be set on children of auto-layout frames'\n if (node.layoutPositioning === 'ABSOLUTE') {\n return 'FILL cannot be set on absolute positioned auto-layout children'\n }\n }\n if (value === 'HUG' && node.layoutMode === 'NONE' && node.type !== 'TEXT') {\n return 'HUG can only be set on auto-layout frames or text children of auto-layout frames'\n }\n return undefined\n}\n\n/** The text auto-resize that hugs the content along the axes given. */\nexport function textAutoResizeFor(hugsWidth: boolean, hugsHeight: boolean): TextAutoResize {\n if (hugsWidth && hugsHeight) return 'WIDTH_AND_HEIGHT'\n return hugsHeight ? 'HEIGHT' : 'NONE'\n}\n\nfunction textSizingUpdates(\n graph: SceneGraph,\n node: SceneNode,\n axis: LayoutSizingAxis,\n value: LayoutSizing\n): Partial<SceneNode> {\n const other: LayoutSizingAxis = axis === 'HORIZONTAL' ? 'VERTICAL' : 'HORIZONTAL'\n const hugsAxis = value === 'HUG'\n const hugsOther = layoutSizing(graph, node, other) === 'HUG'\n const autoResize =\n axis === 'HORIZONTAL'\n ? textAutoResizeFor(hugsAxis, hugsOther)\n : textAutoResizeFor(hugsOther, hugsAxis)\n return autoResize === node.textAutoResize ? {} : { textAutoResize: autoResize }\n}\n\n/**\n * The fields that set the node's sizing along `axis` to `value`, as Figma's setter writes\n * them. A value Figma refuses yields no updates; `layoutSizingError` says why.\n */\nexport function layoutSizingUpdates(\n graph: SceneGraph,\n node: SceneNode,\n axis: LayoutSizingAxis,\n value: LayoutSizing\n): Partial<SceneNode> {\n if (layoutSizingError(graph, node, value) !== undefined) return {}\n const updates: Partial<SceneNode> = {}\n const parent = fillingParent(graphParent(graph, node), node)\n if (parent && parent.layoutMode !== 'NONE') {\n const fill = value === 'FILL'\n if (axis === primaryAxis(parent.layoutMode)) {\n if (fill !== node.layoutGrow > 0) updates.layoutGrow = fill ? 1 : 0\n } else if (fill && node.layoutAlignSelf !== 'STRETCH') {\n updates.layoutAlignSelf = 'STRETCH'\n } else if (!fill && fills(parent, node, axis)) {\n // A flex parent set to stretch its children stretches this one too unless it opts out.\n const inheritsStretch = parent.layoutMode !== 'GRID' && parent.counterAxisAlign === 'STRETCH'\n updates.layoutAlignSelf = inheritsStretch ? 'MIN' : 'AUTO'\n }\n }\n const field = ownSizingField(node, axis)\n if (field) {\n const own = value === 'HUG' ? 'HUG' : 'FIXED'\n if (node[field] !== own) updates[field] = own\n }\n if (node.type === 'TEXT') Object.assign(updates, textSizingUpdates(graph, node, axis, value))\n return updates\n}\n\n/**\n * The fields that make a child fill `axis` of a parent laid out as `parentLayout`, for a node\n * an importer builds before it joins the graph. Under a parent without auto layout, such as a\n * staging parent the node leaves when placed, both are set, so it fills whichever axis its\n * eventual parent stacks along.\n */\nexport function fillSizingFields(\n parentLayout: SceneNode['layoutMode'],\n axis: LayoutSizingAxis\n): Partial<Pick<SceneNode, 'layoutGrow' | 'layoutAlignSelf'>> {\n if (parentLayout === 'NONE') return { layoutGrow: 1, layoutAlignSelf: 'STRETCH' }\n return axis === primaryAxis(parentLayout) ? { layoutGrow: 1 } : { layoutAlignSelf: 'STRETCH' }\n}\n\n/** An auto-layout frame's own sizing when it hugs or fixes its width and height. */\nexport function autoLayoutSizingFields(\n direction: AutoLayoutMode,\n width: 'FIXED' | 'HUG',\n height: 'FIXED' | 'HUG'\n): Pick<SceneNode, 'primaryAxisSizing' | 'counterAxisSizing'> {\n const horizontal = primaryAxis(direction) === 'HORIZONTAL'\n return {\n primaryAxisSizing: horizontal ? width : height,\n counterAxisSizing: horizontal ? height : width\n }\n}\n\n/**\n * The axes a frame hugs but keeps its size on, as Figma keeps them. With nothing in its flow,\n * no visible layer that is not placed absolutely, it keeps every axis it hugs: a new frame keeps\n * the size it was made at, and one that loses its last layer keeps the size it hugged to. On the\n * counter axis it also keeps its size when every child in its flow fills that axis and none has\n * content of its own to hug.\n */\nexport function heldHugAxes(graph: SceneGraph, frame: SceneNode): ('width' | 'height')[] {\n if (frame.layoutMode !== 'HORIZONTAL' && frame.layoutMode !== 'VERTICAL') return []\n const [primary, counter] =\n frame.layoutMode === 'HORIZONTAL'\n ? (['width', 'height'] as const)\n : (['height', 'width'] as const)\n const hugged = [\n ...(frame.primaryAxisSizing === 'HUG' ? [primary] : []),\n ...(frame.counterAxisSizing === 'HUG' ? [counter] : [])\n ]\n const flow = flowChildren(graph, frame)\n if (flow.length === 0) return hugged\n const filled = flow.every(\n (child) =>\n child.layoutMode === 'NONE' &&\n child.type !== 'TEXT' &&\n (child.layoutAlignSelf === 'STRETCH' ||\n (child.layoutAlignSelf === 'AUTO' && frame.counterAxisAlign === 'STRETCH'))\n )\n return filled && frame.counterAxisSizing === 'HUG' ? [counter] : []\n}\n"],"mappings":";;AAgBA,SAAS,YAAY,MAAwC;CAC3D,OAAO,SAAS,aAAa,aAAa;AAC5C;;AAGA,SAAS,cAAc,QAA+B,MAAwC;CAC5F,IAAI,CAAC,UAAU,OAAO,eAAe,UAAU,KAAK,sBAAsB,YACxE,OAAO,KAAA;CACT,OAAO;AACT;AAEA,SAAS,YAAY,OAAmB,MAAwC;CAC9E,OAAO,KAAK,WAAW,MAAM,QAAQ,KAAK,QAAQ,IAAI,KAAA;AACxD;AAEA,SAAS,MAAM,QAAmB,MAAiB,MAAiC;CAClF,IAAI,OAAO,eAAe,QAAQ,OAAO;CACzC,IAAI,SAAS,YAAY,OAAO,UAAU,GAAG,OAAO,KAAK,a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AAO,MAAM,MAAM,KAAK,CAAC;CAC5F,OAAO;AACT;;;;;;;AAQA,SAAgB,iBACd,cACA,MAC4D;CAC5D,IAAI,iBAAiB,QAAQ,OAAO;EAAE,YAAY;EAAG,iBAAiB;CAAU;CAChF,OAAO,SAAS,YAAY,YAAY,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,iBAAiB,UAAU;AAC/F;;AAGA,SAAgB,uBACd,WACA,OACA,QAC4D;CAC5D,MAAM,aAAa,YAAY,SAAS,MAAM;CAC9C,OAAO;EACL,mBAAmB,aAAa,QAAQ;EACxC,mBAAmB,aAAa,SAAS;CAC3C;AACF;;;;;;;;AASA,SAAgB,YAAY,OAAmB,OAA0C;CACvF,IAAI,MAAM,eAAe,gBAAgB,MAAM,eAAe,YAAY,OAAO,CAAC;CAClF,MAAM,CAAC,SAAS,WACd,MAAM,eAAe,eAChB,CAAC,SAAS,QAAQ,IAClB,CAAC,UAAU,OAAO;CACzB,MAAM,SAAS,CACb,GAAI,MAAM,sBAAsB,QAAQ,CAAC,OAAO,IAAI,CAAC,GACrD,GAAI,MAAM,sBAAsB,QAAQ,CAAC,OAAO,IAAI,CAAC,CACvD;CACA,MAAM,OAAO,aAAa,OAAO,KAAK;CACtC,IAAI,KAAK,WAAW,GAAG,OAAO;CAQ9B,OAPe,KAAK,OACjB,UACC,MAAM,eAAe,UACrB,MAAM,SAAS,WACd,MAAM,oBAAoB,aACxB,MAAM,oBAAoB,UAAU,MAAM,qBAAqB,UAE1D,KAAK,MAAM,sBAAsB,QAAQ,CAAC,OAAO,IAAI,CAAC;AACpE"}
|
package/dist/layout/spacing.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { SceneNode } from "../types.js";
|
|
2
|
-
//#region src/layout/spacing.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* The space between wrapped lines of an auto layout. A frame without its own follows the item
|
|
5
4
|
* spacing, as Figma's `counterAxisSpacing: null` does.
|
|
6
5
|
*/
|
|
7
|
-
declare function counterAxisSpacingOf(node: Pick<SceneNode, 'counterAxisSpacing' | 'itemSpacing'>): number;
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
export declare function counterAxisSpacingOf(node: Pick<SceneNode, 'counterAxisSpacing' | 'itemSpacing'>): number;
|
|
7
|
+
/**
|
|
8
|
+
* The space an auto layout keeps between its items along its axis. Space between takes the place
|
|
9
|
+
* of the gap, as in Figma. A generated frame keeps it as the least space between its sublayers,
|
|
10
|
+
* as a sticky note keeps its author clear of a long body.
|
|
11
|
+
*/
|
|
12
|
+
export declare function primaryAxisSpacingOf(node: Pick<SceneNode, 'type' | 'primaryAxisAlign' | 'itemSpacing'>): number;
|
|
10
13
|
//# sourceMappingURL=spacing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spacing.d.ts","names":[],"sources":["../../src/layout/spacing.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"spacing.d.ts","names":[],"sources":["../../src/layout/spacing.ts"],"mappings":";;;;;wBAOgB,qBACd,MAAM,KAAK;;;;;;wBAUG,qBACd,MAAM,KAAK"}
|
package/dist/layout/spacing.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { isGeneratedFrame } from "../generated/index.js";
|
|
2
|
+
// src/layout/spacing.ts
|
|
2
3
|
/**
|
|
3
4
|
* The space between wrapped lines of an auto layout. A frame without its own follows the item
|
|
4
5
|
* spacing, as Figma's `counterAxisSpacing: null` does.
|
|
@@ -6,7 +7,14 @@
|
|
|
6
7
|
function counterAxisSpacingOf(node) {
|
|
7
8
|
return node.counterAxisSpacing ?? node.itemSpacing;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* The space an auto layout keeps between its items along its axis. Space between takes the place
|
|
12
|
+
* of the gap, as in Figma. A generated frame keeps it as the least space between its sublayers,
|
|
13
|
+
* as a sticky note keeps its author clear of a long body.
|
|
14
|
+
*/
|
|
15
|
+
function primaryAxisSpacingOf(node) {
|
|
16
|
+
return node.primaryAxisAlign === "SPACE_BETWEEN" && !isGeneratedFrame(node) ? 0 : node.itemSpacing;
|
|
17
|
+
}
|
|
18
|
+
export { counterAxisSpacingOf, primaryAxisSpacingOf };
|
|
11
19
|
|
|
12
20
|
//# sourceMappingURL=spacing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spacing.js","names":[],"sources":["../../src/layout/spacing.ts"],"sourcesContent":["import type { SceneNode } from '../types'\n\n/**\n * The space between wrapped lines of an auto layout. A frame without its own follows the item\n * spacing, as Figma's `counterAxisSpacing: null` does.\n */\nexport function counterAxisSpacingOf(\n node: Pick<SceneNode, 'counterAxisSpacing' | 'itemSpacing'>\n): number {\n return node.counterAxisSpacing ?? node.itemSpacing\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"spacing.js","names":[],"sources":["../../src/layout/spacing.ts"],"sourcesContent":["import { isGeneratedFrame } from '../generated'\nimport type { SceneNode } from '../types'\n\n/**\n * The space between wrapped lines of an auto layout. A frame without its own follows the item\n * spacing, as Figma's `counterAxisSpacing: null` does.\n */\nexport function counterAxisSpacingOf(\n node: Pick<SceneNode, 'counterAxisSpacing' | 'itemSpacing'>\n): number {\n return node.counterAxisSpacing ?? node.itemSpacing\n}\n\n/**\n * The space an auto layout keeps between its items along its axis. Space between takes the place\n * of the gap, as in Figma. A generated frame keeps it as the least space between its sublayers,\n * as a sticky note keeps its author clear of a long body.\n */\nexport function primaryAxisSpacingOf(\n node: Pick<SceneNode, 'type' | 'primaryAxisAlign' | 'itemSpacing'>\n): number {\n return node.primaryAxisAlign === 'SPACE_BETWEEN' && !isGeneratedFrame(node) ? 0 : node.itemSpacing\n}\n"],"mappings":";;;;;;AAOA,SAAgB,qBACd,MACQ;CACR,OAAO,KAAK,sBAAsB,KAAK;AACzC;;;;;;AAOA,SAAgB,qBACd,MACQ;CACR,OAAO,KAAK,qBAAqB,mBAAmB,CAAC,iBAAiB,IAAI,IAAI,IAAI,KAAK;AACzF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SceneNode } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* A layer's children in the order they are drawn, the first at the bottom. An auto layout frame
|
|
4
|
+
* that stacks its first layer on top (`itemReverseZIndex`, Figma's "first on top" and Sketch's
|
|
5
|
+
* stack layering) draws them last to first; the flag means nothing outside auto layout.
|
|
6
|
+
*/
|
|
7
|
+
export declare function paintOrder(node: Pick<SceneNode, 'childIds' | 'itemReverseZIndex' | 'layoutMode'>): readonly string[];
|
|
8
|
+
//# sourceMappingURL=stacking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stacking.d.ts","names":[],"sources":["../../src/layout/stacking.ts"],"mappings":";;;;;;wBAOgB,WACd,MAAM,KAAK"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/layout/stacking.ts
|
|
2
|
+
/**
|
|
3
|
+
* A layer's children in the order they are drawn, the first at the bottom. An auto layout frame
|
|
4
|
+
* that stacks its first layer on top (`itemReverseZIndex`, Figma's "first on top" and Sketch's
|
|
5
|
+
* stack layering) draws them last to first; the flag means nothing outside auto layout.
|
|
6
|
+
*/
|
|
7
|
+
function paintOrder(node) {
|
|
8
|
+
return node.itemReverseZIndex && node.layoutMode !== "NONE" ? node.childIds.toReversed() : node.childIds;
|
|
9
|
+
}
|
|
10
|
+
export { paintOrder };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=stacking.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stacking.js","names":[],"sources":["../../src/layout/stacking.ts"],"sourcesContent":["import type { SceneNode } from '../types'\n\n/**\n * A layer's children in the order they are drawn, the first at the bottom. An auto layout frame\n * that stacks its first layer on top (`itemReverseZIndex`, Figma's \"first on top\" and Sketch's\n * stack layering) draws them last to first; the flag means nothing outside auto layout.\n */\nexport function paintOrder(\n node: Pick<SceneNode, 'childIds' | 'itemReverseZIndex' | 'layoutMode'>\n): readonly string[] {\n return node.itemReverseZIndex && node.layoutMode !== 'NONE'\n ? node.childIds.toReversed()\n : node.childIds\n}\n"],"mappings":";;;;;;AAOA,SAAgB,WACd,MACmB;CACnB,OAAO,KAAK,qBAAqB,KAAK,eAAe,SACjD,KAAK,SAAS,WAAW,IACzB,KAAK;AACX"}
|
package/dist/layout/strokes.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { SceneNode } from "../types.js";
|
|
2
|
-
//#region src/layout/strokes.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* The stroke a frame counts inside its padding, per side: its visible INSIDE strokes when its
|
|
5
4
|
* strokes are included in layout, as Figma lays it out and as a CSS border takes room.
|
|
6
5
|
*/
|
|
7
|
-
declare function includedStrokeWeights(node: SceneNode): Record<'top' | 'right' | 'bottom' | 'left', number>;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { includedStrokeWeights };
|
|
6
|
+
export declare function includedStrokeWeights(node: SceneNode): Record<'top' | 'right' | 'bottom' | 'left', number>;
|
|
10
7
|
//# sourceMappingURL=strokes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strokes.d.ts","names":[],"sources":["../../src/layout/strokes.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"strokes.d.ts","names":[],"sources":["../../src/layout/strokes.ts"],"mappings":";;;;;wBAMgB,sBACd,MAAM,YACL"}
|
package/dist/layout/strokes.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/layout/strokes.ts
|
|
2
2
|
/**
|
|
3
3
|
* The stroke a frame counts inside its padding, per side: its visible INSIDE strokes when its
|
|
4
4
|
* strokes are included in layout, as Figma lays it out and as a CSS border takes room.
|
|
@@ -24,7 +24,6 @@ function includedStrokeWeights(node) {
|
|
|
24
24
|
left: node.borderLeftWeight
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
//#endregion
|
|
28
27
|
export { includedStrokeWeights };
|
|
29
28
|
|
|
30
29
|
//# sourceMappingURL=strokes.js.map
|
package/dist/layout/writes.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SIZE_FIELDS, TRANSFORM_FIELDS } from "../fields/geometry.js";
|
|
2
|
-
|
|
2
|
+
// src/layout/writes.ts
|
|
3
3
|
/** The layout results a format keeps apart from what it saved once an edit moves or sizes. */
|
|
4
4
|
const EDITED_GEOMETRY_FIELDS = /* @__PURE__ */ new Set([...TRANSFORM_FIELDS, ...SIZE_FIELDS]);
|
|
5
5
|
/**
|
|
@@ -49,7 +49,6 @@ var LayoutWrites = class {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
//#endregion
|
|
53
52
|
export { LayoutWrites };
|
|
54
53
|
|
|
55
54
|
//# sourceMappingURL=writes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writes.js","names":[],"sources":["../../src/layout/writes.ts"],"sourcesContent":["import { SIZE_FIELDS, TRANSFORM_FIELDS } from '../fields/geometry'\nimport type { SceneNode } from '../types'\n\n/** The layout results a format keeps apart from what it saved once an edit moves or sizes. */\nconst EDITED_GEOMETRY_FIELDS: ReadonlySet<keyof SceneNode> = new Set([\n ...TRANSFORM_FIELDS,\n ...SIZE_FIELDS\n])\n\ninterface LayerWrites {\n before: Partial<SceneNode>\n changed: Set<keyof SceneNode>\n /** Geometry an edit's layout wrote, rather than layout of what the document already holds. */\n edited: Set<keyof SceneNode>\n}\n\n/**\n * What one layout run writes to each layer: the values before its first write, and the keys it\n * actually changed. Layout passes can size a layer and size it back, such as a frame laid out on\n * its own and then by its parent, so a key that changed and came back is left out of the update.\n */\nexport class LayoutWrites {\n private readonly layers = new Map<string, LayerWrites>()\n\n /** Call before `changes` are applied to `node`; `edit` when an edit's layout writes them. */\n record(node: SceneNode, changes: Partial<SceneNode>, edit: boolean): void {\n let layer = this.layers.get(node.id)\n if (!layer) {\n layer = { before: {}, changed: new Set(), edited: new Set() }\n this.layers.set(node.id, layer)\n }\n for (const key of Object.keys(changes) as (keyof SceneNode)[]) {\n if (!Object.hasOwn(layer.before, key)) Object.assign(layer.before, { [key]: node[key] })\n if (!Object.is(node[key], changes[key])) layer.changed.add(key)\n if (edit && EDITED_GEOMETRY_FIELDS.has(key)) layer.edited.add(key)\n }\n }\n\n /**\n * Each written layer's update: the values layout changed and kept, and values it wrote as they\n * already were, which a preview's commit writes to publish what it showed. With it come the\n * geometry fields of that update an edit's layout wrote, which count as edited.\n */\n *updates(\n getNode: (id: string) => SceneNode | undefined\n ): Generator<[SceneNode, Partial<SceneNode>, (keyof SceneNode)[]]> {\n for (const [id, { before, changed, edited }] of this.layers) {\n const node = getNode(id)\n if (!node) continue\n const changes: Partial<SceneNode> = {}\n for (const key of Object.keys(before) as (keyof SceneNode)[]) {\n if (changed.has(key) && Object.is(node[key], before[key])) continue\n Object.assign(changes, { [key]: node[key] })\n }\n const keys = Object.keys(changes) as (keyof SceneNode)[]\n if (keys.length > 0) yield [node, changes, keys.filter((key) => edited.has(key))]\n }\n }\n}\n"],"mappings":";;;AAIA,MAAM,yCAAuD,IAAI,IAAI,CACnE,GAAG,kBACH,GAAG,WACL,CAAC;;;;;;AAcD,IAAa,eAAb,MAA0B;
|
|
1
|
+
{"version":3,"file":"writes.js","names":[],"sources":["../../src/layout/writes.ts"],"sourcesContent":["import { SIZE_FIELDS, TRANSFORM_FIELDS } from '../fields/geometry'\nimport type { SceneNode } from '../types'\n\n/** The layout results a format keeps apart from what it saved once an edit moves or sizes. */\nconst EDITED_GEOMETRY_FIELDS: ReadonlySet<keyof SceneNode> = new Set([\n ...TRANSFORM_FIELDS,\n ...SIZE_FIELDS\n])\n\ninterface LayerWrites {\n before: Partial<SceneNode>\n changed: Set<keyof SceneNode>\n /** Geometry an edit's layout wrote, rather than layout of what the document already holds. */\n edited: Set<keyof SceneNode>\n}\n\n/**\n * What one layout run writes to each layer: the values before its first write, and the keys it\n * actually changed. Layout passes can size a layer and size it back, such as a frame laid out on\n * its own and then by its parent, so a key that changed and came back is left out of the update.\n */\nexport class LayoutWrites {\n private readonly layers = new Map<string, LayerWrites>()\n\n /** Call before `changes` are applied to `node`; `edit` when an edit's layout writes them. */\n record(node: SceneNode, changes: Partial<SceneNode>, edit: boolean): void {\n let layer = this.layers.get(node.id)\n if (!layer) {\n layer = { before: {}, changed: new Set(), edited: new Set() }\n this.layers.set(node.id, layer)\n }\n for (const key of Object.keys(changes) as (keyof SceneNode)[]) {\n if (!Object.hasOwn(layer.before, key)) Object.assign(layer.before, { [key]: node[key] })\n if (!Object.is(node[key], changes[key])) layer.changed.add(key)\n if (edit && EDITED_GEOMETRY_FIELDS.has(key)) layer.edited.add(key)\n }\n }\n\n /**\n * Each written layer's update: the values layout changed and kept, and values it wrote as they\n * already were, which a preview's commit writes to publish what it showed. With it come the\n * geometry fields of that update an edit's layout wrote, which count as edited.\n */\n *updates(\n getNode: (id: string) => SceneNode | undefined\n ): Generator<[SceneNode, Partial<SceneNode>, (keyof SceneNode)[]]> {\n for (const [id, { before, changed, edited }] of this.layers) {\n const node = getNode(id)\n if (!node) continue\n const changes: Partial<SceneNode> = {}\n for (const key of Object.keys(before) as (keyof SceneNode)[]) {\n if (changed.has(key) && Object.is(node[key], before[key])) continue\n Object.assign(changes, { [key]: node[key] })\n }\n const keys = Object.keys(changes) as (keyof SceneNode)[]\n if (keys.length > 0) yield [node, changes, keys.filter((key) => edited.has(key))]\n }\n }\n}\n"],"mappings":";;;AAIA,MAAM,yCAAuD,IAAI,IAAI,CACnE,GAAG,kBACH,GAAG,WACL,CAAC;;;;;;AAcD,IAAa,eAAb,MAA0B;CACP,yBAAS,IAAI,IAAyB;;CAGvD,OAAO,MAAiB,SAA6B,MAAqB;EACxE,IAAI,QAAQ,KAAK,OAAO,IAAI,KAAK,EAAE;EACnC,IAAI,CAAC,OAAO;GACV,QAAQ;IAAE,QAAQ,CAAC;IAAG,yBAAS,IAAI,IAAI;IAAG,wBAAQ,IAAI,IAAI;GAAE;GAC5D,KAAK,OAAO,IAAI,KAAK,IAAI,KAAK;EAChC;EACA,KAAK,MAAM,OAAO,OAAO,KAAK,OAAO,GAA0B;GAC7D,IAAI,CAAC,OAAO,OAAO,MAAM,QAAQ,GAAG,GAAG,OAAO,OAAO,MAAM,QAAQ,GAAG,MAAM,KAAK,KAAK,CAAC;GACvF,IAAI,CAAC,OAAO,GAAG,KAAK,MAAM,QAAQ,IAAI,GAAG,MAAM,QAAQ,IAAI,GAAG;GAC9D,IAAI,QAAQ,uBAAuB,IAAI,GAAG,GAAG,MAAM,OAAO,IAAI,GAAG;EACnE;CACF;;;;;;CAOA,CAAC,QACC,SACiE;EACjE,KAAK,MAAM,CAAC,IAAI,EAAE,QAAQ,SAAS,aAAa,KAAK,QAAQ;GAC3D,MAAM,OAAO,QAAQ,EAAE;GACvB,IAAI,CAAC,MAAM;GACX,MAAM,UAA8B,CAAC;GACrC,KAAK,MAAM,OAAO,OAAO,KAAK,MAAM,GAA0B;IAC5D,IAAI,QAAQ,IAAI,GAAG,KAAK,OAAO,GAAG,KAAK,MAAM,OAAO,IAAI,GAAG;IAC3D,OAAO,OAAO,SAAS,GAAG,MAAM,KAAK,KAAK,CAAC;GAC7C;GACA,MAAM,OAAO,OAAO,KAAK,OAAO;GAChC,IAAI,KAAK,SAAS,GAAG,MAAM;IAAC;IAAM;IAAS,KAAK,QAAQ,QAAQ,OAAO,IAAI,GAAG,CAAC;GAAC;EAClF;CACF;AACF"}
|
package/dist/masks.d.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { SceneNode } from "./types.js";
|
|
2
|
-
//#region src/masks.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* The layer as it masks: an outline mask masks with its shape alone, so Figma ignores how opaque
|
|
5
4
|
* its fills are, and the canvas and hit testing take them as opaque.
|
|
6
5
|
*/
|
|
7
|
-
declare function asMaskShape(node: SceneNode): SceneNode;
|
|
6
|
+
export declare function asMaskShape(node: SceneNode): SceneNode;
|
|
8
7
|
/** Whether a layer masks its siblings: a mask that is shown, since a hidden mask masks nothing. */
|
|
9
|
-
declare function isVisibleMask(node: Pick<SceneNode, 'visible' | 'isMask'>): boolean;
|
|
8
|
+
export declare function isVisibleMask(node: Pick<SceneNode, 'visible' | 'isMask'>): boolean;
|
|
10
9
|
/**
|
|
11
10
|
* A run of masks and the siblings they mask, as indices into the children: the masks are
|
|
12
11
|
* `[start, maskedStart)` and what they mask `[maskedStart, end)`, which may be empty.
|
|
13
12
|
*/
|
|
14
|
-
interface MaskRun {
|
|
13
|
+
export interface MaskRun {
|
|
15
14
|
readonly start: number;
|
|
16
15
|
readonly maskedStart: number;
|
|
17
16
|
readonly end: number;
|
|
@@ -22,7 +21,5 @@ interface MaskRun {
|
|
|
22
21
|
* a run of its own; a sibling that is hidden or a hidden mask is masked like any other (Figma
|
|
23
22
|
* desktop, live). Children before the first mask are not in any run.
|
|
24
23
|
*/
|
|
25
|
-
declare function maskRuns<T>(children: readonly T[], isMask: (child: T) => boolean): MaskRun[];
|
|
26
|
-
//#endregion
|
|
27
|
-
export { MaskRun, asMaskShape, isVisibleMask, maskRuns };
|
|
24
|
+
export declare function maskRuns<T>(children: readonly T[], isMask: (child: T) => boolean): MaskRun[];
|
|
28
25
|
//# sourceMappingURL=masks.d.ts.map
|
package/dist/masks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masks.d.ts","names":[],"sources":["../src/masks.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"masks.d.ts","names":[],"sources":["../src/masks.ts"],"mappings":";;;;;wBAMgB,YAAY,MAAM,YAAY;;wBAS9B,cAAc,MAAM,KAAK;;;;;iBAQxB;WACN;WACA;WACA;;;;;;;;wBASK,SAAS,GAAG,mBAAmB,KAAK,SAAS,OAAO,gBAAgB"}
|
package/dist/masks.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/masks.ts
|
|
2
2
|
/**
|
|
3
3
|
* The layer as it masks: an outline mask masks with its shape alone, so Figma ignores how opaque
|
|
4
4
|
* its fills are, and the canvas and hit testing take them as opaque.
|
|
@@ -47,7 +47,6 @@ function maskRuns(children, isMask) {
|
|
|
47
47
|
}
|
|
48
48
|
return runs;
|
|
49
49
|
}
|
|
50
|
-
//#endregion
|
|
51
50
|
export { asMaskShape, isVisibleMask, maskRuns };
|
|
52
51
|
|
|
53
52
|
//# sourceMappingURL=masks.js.map
|
package/dist/matrix.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Matrix as Matrix$1, Vector } from "./primitives/index.js";
|
|
2
|
-
|
|
3
|
-
type Mat3 = number[];
|
|
2
|
+
export type Mat3 = number[];
|
|
4
3
|
declare const Matrix: {
|
|
5
4
|
identity: () => Mat3;
|
|
6
5
|
multiply: (...ms: Mat3[]) => Mat3;
|
|
@@ -11,7 +10,7 @@ declare const Matrix: {
|
|
|
11
10
|
mapPoints: (matrix: Mat3, ptArr: number[]) => number[];
|
|
12
11
|
mapPoint: (m: Mat3, p: Vector) => Vector;
|
|
13
12
|
fromAffine: (t: Matrix$1) => Mat3;
|
|
13
|
+
toAffine: ([m00, m01, m02, m10, m11, m12]: Mat3) => Matrix$1;
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
export { Mat3, Matrix as default };
|
|
15
|
+
export { Matrix as default };
|
|
17
16
|
//# sourceMappingURL=matrix.d.ts.map
|
package/dist/matrix.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matrix.d.ts","names":[],"sources":["../src/matrix.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"matrix.d.ts","names":["AffineTransform"],"sources":["../src/matrix.ts"],"mappings":";YAEY;cA4HN;EA1He,gBAAA;EAmBI,cAAA,IAAA,WAAS;EAOV,aAAA,YAAM,eAAe;EAEnB,UAAA,iBAAM,aAAA,gBAAmB;EAmB/B,SAAA,YAAM,YAAY,aAAA,gBAAmB;EAiBtC,SAAA,GAAA,SAAO;EA0BC,YAAA,QAAA,MAAI;EAeV,WAAA,GAAA,MAAI,GAAK,WAAS;EAMhB,aAAA,GAAAA,aAAkB;EAES,YAAA,KAAA,KAAA,KAAA,KAAA,KAAA,MAAA,SAAOA"}
|
package/dist/matrix.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/matrix.ts
|
|
2
2
|
const identity = () => [
|
|
3
3
|
1,
|
|
4
4
|
0,
|
|
@@ -116,6 +116,14 @@ const fromAffine = (t) => [
|
|
|
116
116
|
0,
|
|
117
117
|
1
|
|
118
118
|
];
|
|
119
|
+
const toAffine = ([m00, m01, m02, m10, m11, m12]) => ({
|
|
120
|
+
m00,
|
|
121
|
+
m01,
|
|
122
|
+
m02,
|
|
123
|
+
m10,
|
|
124
|
+
m11,
|
|
125
|
+
m12
|
|
126
|
+
});
|
|
119
127
|
const Matrix = {
|
|
120
128
|
identity,
|
|
121
129
|
multiply,
|
|
@@ -125,9 +133,9 @@ const Matrix = {
|
|
|
125
133
|
invert,
|
|
126
134
|
mapPoints,
|
|
127
135
|
mapPoint,
|
|
128
|
-
fromAffine
|
|
136
|
+
fromAffine,
|
|
137
|
+
toAffine
|
|
129
138
|
};
|
|
130
|
-
//#endregion
|
|
131
139
|
export { Matrix as default };
|
|
132
140
|
|
|
133
141
|
//# sourceMappingURL=matrix.js.map
|
package/dist/matrix.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matrix.js","names":[],"sources":["../src/matrix.ts"],"sourcesContent":["import type { Matrix as AffineTransform, Vector } from './primitives'\n\nexport type Mat3 = number[]\n\nconst identity = (): Mat3 => [1, 0, 0, 0, 1, 0, 0, 0, 1]\n\nconst multiply2 = (m1: Mat3, m2: Mat3): Mat3 => {\n // row-major general 3x3 multiply: out = m1 * m2\n return [\n m1[0] * m2[0] + m1[1] * m2[3] + m1[2] * m2[6],\n m1[0] * m2[1] + m1[1] * m2[4] + m1[2] * m2[7],\n m1[0] * m2[2] + m1[1] * m2[5] + m1[2] * m2[8],\n\n m1[3] * m2[0] + m1[4] * m2[3] + m1[5] * m2[6],\n m1[3] * m2[1] + m1[4] * m2[4] + m1[5] * m2[7],\n m1[3] * m2[2] + m1[4] * m2[5] + m1[5] * m2[8],\n\n m1[6] * m2[0] + m1[7] * m2[3] + m1[8] * m2[6],\n m1[6] * m2[1] + m1[7] * m2[4] + m1[8] * m2[7],\n m1[6] * m2[2] + m1[7] * m2[5] + m1[8] * m2[8]\n ]\n}\n\nconst multiply = (...ms: Mat3[]): Mat3 => {\n if (ms.length === 0) return identity()\n let out = ms[0].slice()\n for (let i = 1; i < ms.length; i++) out = multiply2(out, ms[i])\n return out\n}\n\nconst translated = (dx: number, dy: number): Mat3 => [1, 0, dx, 0, 1, dy, 0, 0, 1]\n\nconst rotated = (radians: number, px = 0, py = 0): Mat3 => {\n const s = Math.sin(radians)\n const c = Math.cos(radians)\n // exactly like ck.Matrix.rotated\n return [\n c,\n -s,\n s * py + (1 - c) * px,\n\n s,\n c,\n -s * px + (1 - c) * py,\n\n 0,\n 0,\n 1\n ]\n}\n\nconst scaled = (sx: number, sy: number, px = 0, py = 0): Mat3 => {\n // match ck.Matrix.scaled\n return [\n sx,\n 0,\n px - sx * px,\n\n 0,\n sy,\n py - sy * py,\n\n 0,\n 0,\n 1\n ]\n}\n\nconst invert = (m: Mat3): Mat3 | null => {\n // match ck.Matrix.invert (Sarrus)\n const det =\n m[0] * m[4] * m[8] +\n m[1] * m[5] * m[6] +\n m[2] * m[3] * m[7] -\n m[2] * m[4] * m[6] -\n m[1] * m[3] * m[8] -\n m[0] * m[5] * m[7]\n if (!det) return null\n\n return [\n (m[4] * m[8] - m[5] * m[7]) / det,\n (m[2] * m[7] - m[1] * m[8]) / det,\n (m[1] * m[5] - m[2] * m[4]) / det,\n\n (m[5] * m[6] - m[3] * m[8]) / det,\n (m[0] * m[8] - m[2] * m[6]) / det,\n (m[2] * m[3] - m[0] * m[5]) / det,\n\n (m[3] * m[7] - m[4] * m[6]) / det,\n (m[1] * m[6] - m[0] * m[7]) / det,\n (m[0] * m[4] - m[1] * m[3]) / det\n ]\n}\n\nconst mapPoints = (matrix: Mat3, ptArr: number[]): number[] => {\n if (ptArr.length % 2) throw new Error('mapPoints requires even length [x,y,...].')\n const out = ptArr.slice()\n for (let i = 0; i < out.length; i += 2) {\n const x = out[i]\n const y = out[i + 1]\n const denom = matrix[6] * x + matrix[7] * y + matrix[8]\n const xTrans = matrix[0] * x + matrix[1] * y + matrix[2]\n const yTrans = matrix[3] * x + matrix[4] * y + matrix[5]\n out[i] = xTrans / denom\n out[i + 1] = yTrans / denom\n }\n return out\n}\n\nconst mapPoint = (m: Mat3, p: Vector): Vector => {\n const arr = mapPoints(m, [p.x, p.y])\n return { x: arr[0], y: arr[1] }\n}\n\n/** A 2 × 3 affine transform, as Figma stores gradient and image transforms, as a 3 × 3 matrix. */\nconst fromAffine = (t: AffineTransform): Mat3 => [t.m00, t.m01, t.m02, t.m10, t.m11, t.m12, 0, 0, 1]\n\nconst Matrix = {\n identity,\n multiply,\n translated,\n rotated,\n scaled,\n invert,\n mapPoints,\n mapPoint,\n fromAffine\n}\nexport default Matrix\n"],"mappings":";AAIA,MAAM,iBAAuB;CAAC;CAAG;CAAG;CAAG;CAAG;CAAG;CAAG;CAAG;CAAG;AAAC;AAEvD,MAAM,aAAa,IAAU,OAAmB;CAE9C,OAAO;EACL,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG;EAC3C,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG;EAC3C,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG;EAE3C,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAA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,EAAE,GAAG,EAAE,CAAC,CAAC;CACnC,OAAO;EAAE,GAAG,IAAI;EAAI,GAAG,IAAI;CAAG;AAChC;;AAGA,MAAM,cAAc,MAA6B;CAAC,EAAE;CAAK,EAAE;CAAK,EAAE;CAAK,EAAE;CAAK,EAAE;CAAK,EAAE;CAAK;CAAG;CAAG;AAAC;AAEnG,MAAM,SAAS;CACb;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
|
|
1
|
+
{"version":3,"file":"matrix.js","names":[],"sources":["../src/matrix.ts"],"sourcesContent":["import type { Matrix as AffineTransform, Vector } from './primitives'\n\nexport type Mat3 = number[]\n\nconst identity = (): Mat3 => [1, 0, 0, 0, 1, 0, 0, 0, 1]\n\nconst multiply2 = (m1: Mat3, m2: Mat3): Mat3 => {\n // row-major general 3x3 multiply: out = m1 * m2\n return [\n m1[0] * m2[0] + m1[1] * m2[3] + m1[2] * m2[6],\n m1[0] * m2[1] + m1[1] * m2[4] + m1[2] * m2[7],\n m1[0] * m2[2] + m1[1] * m2[5] + m1[2] * m2[8],\n\n m1[3] * m2[0] + m1[4] * m2[3] + m1[5] * m2[6],\n m1[3] * m2[1] + m1[4] * m2[4] + m1[5] * m2[7],\n m1[3] * m2[2] + m1[4] * m2[5] + m1[5] * m2[8],\n\n m1[6] * m2[0] + m1[7] * m2[3] + m1[8] * m2[6],\n m1[6] * m2[1] + m1[7] * m2[4] + m1[8] * m2[7],\n m1[6] * m2[2] + m1[7] * m2[5] + m1[8] * m2[8]\n ]\n}\n\nconst multiply = (...ms: Mat3[]): Mat3 => {\n if (ms.length === 0) return identity()\n let out = ms[0].slice()\n for (let i = 1; i < ms.length; i++) out = multiply2(out, ms[i])\n return out\n}\n\nconst translated = (dx: number, dy: number): Mat3 => [1, 0, dx, 0, 1, dy, 0, 0, 1]\n\nconst rotated = (radians: number, px = 0, py = 0): Mat3 => {\n const s = Math.sin(radians)\n const c = Math.cos(radians)\n // exactly like ck.Matrix.rotated\n return [\n c,\n -s,\n s * py + (1 - c) * px,\n\n s,\n c,\n -s * px + (1 - c) * py,\n\n 0,\n 0,\n 1\n ]\n}\n\nconst scaled = (sx: number, sy: number, px = 0, py = 0): Mat3 => {\n // match ck.Matrix.scaled\n return [\n sx,\n 0,\n px - sx * px,\n\n 0,\n sy,\n py - sy * py,\n\n 0,\n 0,\n 1\n ]\n}\n\nconst invert = (m: Mat3): Mat3 | null => {\n // match ck.Matrix.invert (Sarrus)\n const det =\n m[0] * m[4] * m[8] +\n m[1] * m[5] * m[6] +\n m[2] * m[3] * m[7] -\n m[2] * m[4] * m[6] -\n m[1] * m[3] * m[8] -\n m[0] * m[5] * m[7]\n if (!det) return null\n\n return [\n (m[4] * m[8] - m[5] * m[7]) / det,\n (m[2] * m[7] - m[1] * m[8]) / det,\n (m[1] * m[5] - m[2] * m[4]) / det,\n\n (m[5] * m[6] - m[3] * m[8]) / det,\n (m[0] * m[8] - m[2] * m[6]) / det,\n (m[2] * m[3] - m[0] * m[5]) / det,\n\n (m[3] * m[7] - m[4] * m[6]) / det,\n (m[1] * m[6] - m[0] * m[7]) / det,\n (m[0] * m[4] - m[1] * m[3]) / det\n ]\n}\n\nconst mapPoints = (matrix: Mat3, ptArr: number[]): number[] => {\n if (ptArr.length % 2) throw new Error('mapPoints requires even length [x,y,...].')\n const out = ptArr.slice()\n for (let i = 0; i < out.length; i += 2) {\n const x = out[i]\n const y = out[i + 1]\n const denom = matrix[6] * x + matrix[7] * y + matrix[8]\n const xTrans = matrix[0] * x + matrix[1] * y + matrix[2]\n const yTrans = matrix[3] * x + matrix[4] * y + matrix[5]\n out[i] = xTrans / denom\n out[i + 1] = yTrans / denom\n }\n return out\n}\n\nconst mapPoint = (m: Mat3, p: Vector): Vector => {\n const arr = mapPoints(m, [p.x, p.y])\n return { x: arr[0], y: arr[1] }\n}\n\n/** A 2 × 3 affine transform, as Figma stores gradient and image transforms, as a 3 × 3 matrix. */\nconst fromAffine = (t: AffineTransform): Mat3 => [t.m00, t.m01, t.m02, t.m10, t.m11, t.m12, 0, 0, 1]\n\nconst toAffine = ([m00, m01, m02, m10, m11, m12]: Mat3): AffineTransform => ({\n m00,\n m01,\n m02,\n m10,\n m11,\n m12\n})\n\nconst Matrix = {\n identity,\n multiply,\n translated,\n rotated,\n scaled,\n invert,\n mapPoints,\n mapPoint,\n fromAffine,\n toAffine\n}\nexport default Matrix\n"],"mappings":";AAIA,MAAM,iBAAuB;CAAC;CAAG;CAAG;CAAG;CAAG;CAAG;CAAG;CAAG;CAAG;AAAC;AAEvD,MAAM,aAAa,IAAU,OAAmB;CAE9C,OAAO;EACL,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG;EAC3C,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG;EAC3C,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG;EAE3C,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG;EAC3C,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG;EAC3C,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG;EAE3C,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG;EAC3C,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG;EAC3C,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG;CAC7C;AACF;AAEA,MAAM,YAAY,GAAG,OAAqB;CACxC,IAAI,GAAG,WAAW,GAAG,OAAO,SAAS;CACrC,IAAI,MAAM,GAAG,EAAE,CAAC,MAAM;CACtB,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,QAAQ,KAAK,MAAM,UAAU,KAAK,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,KAAK,EAAE,KAAK,EAAE,MAAM;GAC7B,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM;CAChC;AACF;AAEA,MAAM,aAAa,QAAc,UAA8B;CAC7D,IAAI,MAAM,SAAS,GAAG,MAAM,IAAI,MAAM,2CAA2C;CACjF,MAAM,MAAM,MAAM,MAAM;CACxB,KAAK,IAAI,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK,GAAG;EACtC,MAAM,IAAI,IAAI;EACd,MAAM,IAAI,IAAI,IAAI;EAClB,MAAM,QAAQ,OAAO,KAAK,IAAI,OAAO,KAAK,IAAI,OAAO;EACrD,MAAM,SAAS,OAAO,KAAK,IAAI,OAAO,KAAK,IAAI,OAAO;EACtD,MAAM,SAAS,OAAO,KAAK,IAAI,OAAO,KAAK,IAAI,OAAO;EACtD,IAAI,KAAK,SAAS;EAClB,IAAI,IAAI,KAAK,SAAS;CACxB;CACA,OAAO;AACT;AAEA,MAAM,YAAY,GAAS,MAAsB;CAC/C,MAAM,MAAM,UAAU,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;CACnC,OAAO;EAAE,GAAG,IAAI;EAAI,GAAG,IAAI;CAAG;AAChC;;AAGA,MAAM,cAAc,MAA6B;CAAC,EAAE;CAAK,EAAE;CAAK,EAAE;CAAK,EAAE;CAAK,EAAE;CAAK,EAAE;CAAK;CAAG;CAAG;AAAC;AAEnG,MAAM,YAAY,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,UAAiC;CAC3E;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,SAAS;CACb;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Color, Vector } from "../primitives/index.js";
|
|
2
|
+
import { MeshGradient, MeshPoint, MeshSide } from "./schema.js";
|
|
3
|
+
/**
|
|
4
|
+
* How a mesh gradient is drawn, as pen.dev draws its `mesh_gradient` (measured against its
|
|
5
|
+
* exports): each cell is a Coons patch of its four cubic Bézier edges, and its corner colours
|
|
6
|
+
* blend in smoothstep steps along both axes, so a colour changes slowest at the points. Colours
|
|
7
|
+
* blend as stored, in the document's colour space.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MESH_SIDES: readonly ["left", "right", "top", "bottom"];
|
|
10
|
+
/** The handle on the other side of the point along the same axis. */
|
|
11
|
+
export declare function oppositeMeshSide(side: MeshSide): MeshSide;
|
|
12
|
+
/** Where the point at `column`, `row` is in `points`. */
|
|
13
|
+
export declare function meshIndex(mesh: Pick<MeshGradient, 'columns'>, column: number, row: number): number;
|
|
14
|
+
/** The column and row of the point at `index`. */
|
|
15
|
+
export declare function meshCell(mesh: Pick<MeshGradient, 'columns'>, index: number): {
|
|
16
|
+
column: number;
|
|
17
|
+
row: number;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The handle a point has towards a side when none is set: a quarter of the default spacing of
|
|
21
|
+
* the grid, whatever the point's position, as pen.dev chooses.
|
|
22
|
+
*/
|
|
23
|
+
export declare function meshAutoHandle(mesh: Pick<MeshGradient, 'columns' | 'rows'>, side: MeshSide): {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
};
|
|
27
|
+
/** The handle of the point at `index` towards `side`, as an offset from the point. */
|
|
28
|
+
export declare function meshHandle(mesh: MeshGradient, index: number, side: MeshSide): Vector;
|
|
29
|
+
/** The sides of the point at `index` that have a neighbour, and so a handle. */
|
|
30
|
+
export declare function meshPointSides(mesh: Pick<MeshGradient, 'columns' | 'rows'>, index: number): ("left" | "right" | "top" | "bottom")[];
|
|
31
|
+
/** Where (`u`, `v`) of the cell at `column`, `row` lands in the layer, from 0 to 1 across it. */
|
|
32
|
+
export declare function meshCellPoint(mesh: MeshGradient, column: number, row: number, u: number, v: number): Vector;
|
|
33
|
+
/** The colour at (`u`, `v`) of the cell at `column`, `row`. */
|
|
34
|
+
export declare function meshCellColor(mesh: MeshGradient, column: number, row: number, u: number, v: number): Color;
|
|
35
|
+
/** Triangles that draw a mesh, in the layer's unit square, with a colour per vertex. */
|
|
36
|
+
export interface MeshTessellation {
|
|
37
|
+
/** x, y per vertex. */
|
|
38
|
+
positions: Float32Array;
|
|
39
|
+
/** r, g, b, a per vertex. */
|
|
40
|
+
colors: Float32Array;
|
|
41
|
+
/** Three vertices per triangle. */
|
|
42
|
+
indices: number[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The mesh as triangles, each cell split into `steps` × `steps` quads; fewer when the mesh is too
|
|
46
|
+
* large to fit 16-bit indices.
|
|
47
|
+
*/
|
|
48
|
+
export declare function tessellateMesh(mesh: MeshGradient, steps: number): MeshTessellation;
|
|
49
|
+
/** A mesh of straight, evenly spaced points with automatic handles, coloured by `colorAt`. */
|
|
50
|
+
export declare function uniformMesh(columns: number, rows: number, colorAt: (column: number, row: number) => Color): MeshGradient;
|
|
51
|
+
/**
|
|
52
|
+
* The mesh with `columns` × `rows` points that draws as `mesh` does: each new point sits on the
|
|
53
|
+
* surface, takes the colour drawn there, and has handles along the surface, so bends survive.
|
|
54
|
+
* Growing a grid keeps its look; shrinking it averages detail away. A uniform mesh stays uniform.
|
|
55
|
+
*/
|
|
56
|
+
export declare function resampleMesh(mesh: MeshGradient, columns: number, rows: number): MeshGradient;
|
|
57
|
+
/**
|
|
58
|
+
* `point` as the point at `index` may be: one on an edge of the layer stays on it, and its handles
|
|
59
|
+
* along that edge stay on it too, so the mesh always covers the whole layer. Corners stay put.
|
|
60
|
+
*/
|
|
61
|
+
export declare function constrainMeshPoint(mesh: Pick<MeshGradient, 'columns' | 'rows'>, index: number, point: MeshPoint): MeshPoint;
|
|
62
|
+
/** `mesh` with point `index` at `position`, kept on its edge as `constrainMeshPoint` keeps it. */
|
|
63
|
+
export declare function withMeshPointAt(mesh: MeshGradient, index: number, position: Vector): MeshGradient;
|
|
64
|
+
/**
|
|
65
|
+
* `mesh` with the handle of point `index` towards `side` at `offset`. With `mirror`, the handle on
|
|
66
|
+
* the other side turns to point the opposite way and keeps its own length, as a smooth point's
|
|
67
|
+
* handles do in vector editing.
|
|
68
|
+
*/
|
|
69
|
+
export declare function withMeshHandle(mesh: MeshGradient, index: number, side: MeshSide, offset: Vector, mirror: boolean): MeshGradient;
|
|
70
|
+
/** `mesh` with point `index` coloured `color`. */
|
|
71
|
+
export declare function withMeshColor(mesh: MeshGradient, index: number, color: Color): MeshGradient;
|
|
72
|
+
/** `mesh` with point `index` back where a uniform grid puts it, keeping its handles. */
|
|
73
|
+
export declare function withMeshPositionReset(mesh: MeshGradient, index: number): MeshGradient;
|
|
74
|
+
/** `mesh` with point `index`'s handles back to automatic. */
|
|
75
|
+
export declare function withMeshCurveReset(mesh: MeshGradient, index: number): MeshGradient;
|
|
76
|
+
/** Where the handle of point `index` towards `side` ends, in the layer's unit square. */
|
|
77
|
+
export declare function meshHandleEnd(mesh: MeshGradient, index: number, side: MeshSide): Vector;
|
|
78
|
+
/** The mesh a paint becomes when switched to a mesh gradient: 3 × 3, uniform. */
|
|
79
|
+
export declare function defaultMeshGradient(): MeshGradient;
|
|
80
|
+
//# sourceMappingURL=geometry.d.ts.map
|