@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/text/paragraphs.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { omit } from "es-toolkit";
|
|
2
|
+
// src/text/paragraphs.ts
|
|
2
3
|
/** The style of a paragraph with no entry: not in a list. */
|
|
3
4
|
const PLAIN_PARAGRAPH = Object.freeze({
|
|
4
5
|
listType: "NONE",
|
|
@@ -98,9 +99,11 @@ function paragraphStylesAfterEdit(paragraphs, text, start, end, inserted) {
|
|
|
98
99
|
const last = paragraphIndexAt(text, end);
|
|
99
100
|
const style = paragraphStyleAt(paragraphs, first);
|
|
100
101
|
const added = paragraphCount(inserted) - 1;
|
|
102
|
+
const opened = omit(style, ["checked"]);
|
|
101
103
|
return trimParagraphStyles([
|
|
102
104
|
...Array.from({ length: first }, (_, index) => paragraphStyleAt(paragraphs, index)),
|
|
103
|
-
|
|
105
|
+
style,
|
|
106
|
+
...Array.from({ length: added }, () => opened),
|
|
104
107
|
...paragraphs.slice(last + 1)
|
|
105
108
|
], paragraphCount(text) - (last - first) + added);
|
|
106
109
|
}
|
|
@@ -122,13 +125,14 @@ function paragraphStylesInRange(paragraphs, text, start, end, change) {
|
|
|
122
125
|
* paragraph leaving a list keeps no indentation.
|
|
123
126
|
*/
|
|
124
127
|
function withListType(style, listType) {
|
|
128
|
+
const kept = listType === "CHECKLIST" ? style : omit(style, ["checked"]);
|
|
125
129
|
if (listType === "NONE") return {
|
|
126
|
-
...
|
|
130
|
+
...kept,
|
|
127
131
|
listType,
|
|
128
132
|
indentation: 0
|
|
129
133
|
};
|
|
130
134
|
return {
|
|
131
|
-
...
|
|
135
|
+
...kept,
|
|
132
136
|
listType,
|
|
133
137
|
indentation: clampListIndentation(style.indentation)
|
|
134
138
|
};
|
|
@@ -160,7 +164,6 @@ function paragraphStylesAfterTextChange(paragraphs, before, after) {
|
|
|
160
164
|
while (suffix < shorter - prefix && before[before.length - 1 - suffix] === after[after.length - 1 - suffix]) suffix++;
|
|
161
165
|
return paragraphStylesAfterEdit(paragraphs, before, prefix, before.length - suffix, after.slice(prefix, after.length - suffix));
|
|
162
166
|
}
|
|
163
|
-
//#endregion
|
|
164
167
|
export { MAX_LIST_INDENTATION, PLAIN_PARAGRAPH, TEXT_PARAGRAPH_SPACING_FIELDS, hasParagraphSpacing, hasTextList, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, sharedParagraphSpacing, textParagraphRanges, trimParagraphStyles, withIndentation, withListType, withParagraphSpacing };
|
|
165
168
|
|
|
166
169
|
//# sourceMappingURL=paragraphs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paragraphs.js","names":[],"sources":["../../src/text/paragraphs.ts"],"sourcesContent":["import type {\n SceneNode,\n TextListType,\n TextParagraphSpacingField,\n TextParagraphStyle\n} from '../types'\n\n/** The style of a paragraph with no entry: not in a list. */\nexport const PLAIN_PARAGRAPH: Readonly<TextParagraphStyle> = Object.freeze({\n listType: 'NONE',\n indentation: 0\n})\n\n/** Figma nests list items at most this deep. */\nexport const MAX_LIST_INDENTATION = 5\n\n/** A paragraph's characters: `start` to `end`, not counting the newline that ends it. */\nexport interface TextParagraphRange {\n start: number\n end: number\n}\n\n/** The paragraphs of `text`: one per line ending at a newline, and one after the last. */\nexport function textParagraphRanges(text: string): TextParagraphRange[] {\n const ranges: TextParagraphRange[] = []\n let start = 0\n for (let index = text.indexOf('\\n'); index !== -1; index = text.indexOf('\\n', start)) {\n ranges.push({ start, end: index })\n start = index + 1\n }\n ranges.push({ start, end: text.length })\n return ranges\n}\n\n/** The paragraph holding character `index`; a newline belongs to the paragraph it ends. */\nexport function paragraphIndexAt(text: string, index: number): number {\n let paragraph = 0\n const end = Math.min(index, text.length)\n for (let at = text.indexOf('\\n'); at !== -1 && at < end; at = text.indexOf('\\n', at + 1)) {\n paragraph++\n }\n return paragraph\n}\n\nexport function paragraphStyleAt(\n paragraphs: readonly TextParagraphStyle[],\n paragraph: number\n): TextParagraphStyle {\n return paragraphs[paragraph] ?? PLAIN_PARAGRAPH\n}\n\nexport const TEXT_PARAGRAPH_SPACING_FIELDS: readonly TextParagraphSpacingField[] = [\n 'listSpacing',\n 'paragraphSpacing',\n 'paragraphIndent'\n]\n\n/** A paragraph's spacing: its own value, or the text's when it sets none. */\nexport function paragraphSpacingAt(\n node: Pick<SceneNode, 'textParagraphs' | TextParagraphSpacingField>,\n paragraph: number,\n field: TextParagraphSpacingField\n): number {\n return paragraphStyleAt(node.textParagraphs, paragraph)[field] ?? node[field]\n}\n\n/** Whether a paragraph sets any spacing of its own. */\nexport function hasParagraphSpacing(style: TextParagraphStyle): boolean {\n return TEXT_PARAGRAPH_SPACING_FIELDS.some((field) => style[field] !== undefined)\n}\n\n/** A paragraph style with its own `field` set, or following the text again for `undefined`. */\nexport function withParagraphSpacing(\n style: TextParagraphStyle,\n field: TextParagraphSpacingField,\n value: number | undefined\n): TextParagraphStyle {\n const { [field]: _previous, ...rest } = style\n return value === undefined ? rest : { ...rest, [field]: value }\n}\n\n/** Every paragraph's `field`, or `null` when they differ. */\nexport function sharedParagraphSpacing(\n node: Pick<SceneNode, 'text' | 'textParagraphs' | TextParagraphSpacingField>,\n field: TextParagraphSpacingField,\n first = 0,\n last = paragraphCount(node.text) - 1\n): number | null {\n const value = paragraphSpacingAt(node, first, field)\n for (let index = first + 1; index <= last; index++) {\n if (paragraphSpacingAt(node, index, field) !== value) return null\n }\n return value\n}\n\n/** Paragraph styles with no paragraph setting its own `field`, as setting the text's does. */\nexport function paragraphStylesWithoutSpacing(\n paragraphs: readonly TextParagraphStyle[],\n field: TextParagraphSpacingField\n): TextParagraphStyle[] {\n return trimParagraphStyles(\n paragraphs.map((style) => withParagraphSpacing(style, field, undefined)),\n paragraphs.length\n )\n}\n\n/** Whether any paragraph of the node is a list item. */\nexport function hasTextList(node: Pick<SceneNode, 'textParagraphs'>): boolean {\n return node.textParagraphs.some((paragraph) => paragraph.listType !== 'NONE')\n}\n\n/**\n * Paragraph styles for `count` paragraphs, without the plain paragraphs at the end, so text\n * without lists, indentation, or paragraph spacing of its own keeps none.\n */\nexport function trimParagraphStyles(\n paragraphs: readonly TextParagraphStyle[],\n count: number\n): TextParagraphStyle[] {\n const styles = paragraphs.slice(0, count).map((paragraph) => ({ ...paragraph }))\n while (styles.length > 0) {\n const last = styles[styles.length - 1]\n if (last.listType !== 'NONE' || last.indentation !== 0 || hasParagraphSpacing(last)) break\n styles.pop()\n }\n return styles\n}\n\n/** How many paragraphs `text` has: one more than its newlines. */\nexport function paragraphCount(text: string): number {\n let count = 1\n for (let at = text.indexOf('\\n'); at !== -1; at = text.indexOf('\\n', at + 1)) count++\n return count\n}\n\n/**\n * Paragraph styles after replacing `text[start, end)` with `inserted`, as Figma keeps them: the\n * paragraph the edit starts in keeps its style, paragraphs a deleted newline joins to it are\n * dropped, and paragraphs an inserted newline starts take its style.\n */\nexport function paragraphStylesAfterEdit(\n paragraphs: readonly TextParagraphStyle[],\n text: string,\n start: number,\n end: number,\n inserted: string\n): TextParagraphStyle[] {\n if (paragraphs.length === 0) return []\n const first = paragraphIndexAt(text, start)\n const last = paragraphIndexAt(text, end)\n const style = paragraphStyleAt(paragraphs, first)\n const added = paragraphCount(inserted) - 1\n const next = [\n ...Array.from({ length: first }, (_, index) => paragraphStyleAt(paragraphs, index)),\n ...Array.from({ length: added + 1 }, () => style),\n ...paragraphs.slice(last + 1)\n ]\n return trimParagraphStyles(next, paragraphCount(text) - (last - first) + added)\n}\n\n/**\n * Paragraph styles with every paragraph that `text[start, end)` touches changed by `change`,\n * as a range setter changes whole paragraphs.\n */\nexport function paragraphStylesInRange(\n paragraphs: readonly TextParagraphStyle[],\n text: string,\n start: number,\n end: number,\n change: (style: TextParagraphStyle) => TextParagraphStyle\n): TextParagraphStyle[] {\n const count = paragraphCount(text)\n const first = paragraphIndexAt(text, start)\n // An empty range still names the paragraph it sits in; a range ending right after a\n // newline does not reach into the next paragraph.\n const last = end > start ? paragraphIndexAt(text, end - 1) : first\n const next = Array.from({ length: count }, (_, index) => {\n const style = paragraphStyleAt(paragraphs, index)\n return index >= first && index <= last ? change(style) : style\n })\n return trimParagraphStyles(next, count)\n}\n\n/**\n * A paragraph style with its list type set. A list item is nested at least one level, and a\n * paragraph leaving a list keeps no indentation.\n */\nexport function withListType(\n style: TextParagraphStyle,\n listType: TextListType\n): TextParagraphStyle {\n if (listType === 'NONE') return { ...style, listType, indentation: 0 }\n return { ...style, listType, indentation: clampListIndentation(style.indentation) }\n}\n\n/** A paragraph style with its nesting set, kept in the range a list item allows. */\nexport function withIndentation(\n style: TextParagraphStyle,\n indentation: number\n): TextParagraphStyle {\n if (style.listType === 'NONE') {\n return {\n ...style,\n indentation: Math.max(0, Math.min(MAX_LIST_INDENTATION, Math.round(indentation)))\n }\n }\n return { ...style, indentation: clampListIndentation(indentation) }\n}\n\nfunction clampListIndentation(indentation: number): number {\n return Math.max(1, Math.min(MAX_LIST_INDENTATION, Math.round(indentation)))\n}\n\n/**\n * Paragraph styles after `before` became `after` through one edit, found as the text between\n * their common start and end, for editors that replace the text rather than report the edit.\n */\nexport function paragraphStylesAfterTextChange(\n paragraphs: readonly TextParagraphStyle[],\n before: string,\n after: string\n): TextParagraphStyle[] {\n if (paragraphs.length === 0 || before === after) return paragraphs.map((style) => ({ ...style }))\n let prefix = 0\n const shorter = Math.min(before.length, after.length)\n while (prefix < shorter && before[prefix] === after[prefix]) prefix++\n let suffix = 0\n while (\n suffix < shorter - prefix &&\n before[before.length - 1 - suffix] === after[after.length - 1 - suffix]\n ) {\n suffix++\n }\n return paragraphStylesAfterEdit(\n paragraphs,\n before,\n prefix,\n before.length - suffix,\n after.slice(prefix, after.length - suffix)\n )\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"paragraphs.js","names":[],"sources":["../../src/text/paragraphs.ts"],"sourcesContent":["import { omit } from 'es-toolkit'\n\nimport type {\n SceneNode,\n TextListType,\n TextParagraphSpacingField,\n TextParagraphStyle\n} from '../types'\n\n/** The style of a paragraph with no entry: not in a list. */\nexport const PLAIN_PARAGRAPH: Readonly<TextParagraphStyle> = Object.freeze({\n listType: 'NONE',\n indentation: 0\n})\n\n/** Figma nests list items at most this deep. */\nexport const MAX_LIST_INDENTATION = 5\n\n/** A paragraph's characters: `start` to `end`, not counting the newline that ends it. */\nexport interface TextParagraphRange {\n start: number\n end: number\n}\n\n/** The paragraphs of `text`: one per line ending at a newline, and one after the last. */\nexport function textParagraphRanges(text: string): TextParagraphRange[] {\n const ranges: TextParagraphRange[] = []\n let start = 0\n for (let index = text.indexOf('\\n'); index !== -1; index = text.indexOf('\\n', start)) {\n ranges.push({ start, end: index })\n start = index + 1\n }\n ranges.push({ start, end: text.length })\n return ranges\n}\n\n/** The paragraph holding character `index`; a newline belongs to the paragraph it ends. */\nexport function paragraphIndexAt(text: string, index: number): number {\n let paragraph = 0\n const end = Math.min(index, text.length)\n for (let at = text.indexOf('\\n'); at !== -1 && at < end; at = text.indexOf('\\n', at + 1)) {\n paragraph++\n }\n return paragraph\n}\n\nexport function paragraphStyleAt(\n paragraphs: readonly TextParagraphStyle[],\n paragraph: number\n): TextParagraphStyle {\n return paragraphs[paragraph] ?? PLAIN_PARAGRAPH\n}\n\nexport const TEXT_PARAGRAPH_SPACING_FIELDS: readonly TextParagraphSpacingField[] = [\n 'listSpacing',\n 'paragraphSpacing',\n 'paragraphIndent'\n]\n\n/** A paragraph's spacing: its own value, or the text's when it sets none. */\nexport function paragraphSpacingAt(\n node: Pick<SceneNode, 'textParagraphs' | TextParagraphSpacingField>,\n paragraph: number,\n field: TextParagraphSpacingField\n): number {\n return paragraphStyleAt(node.textParagraphs, paragraph)[field] ?? node[field]\n}\n\n/** Whether a paragraph sets any spacing of its own. */\nexport function hasParagraphSpacing(style: TextParagraphStyle): boolean {\n return TEXT_PARAGRAPH_SPACING_FIELDS.some((field) => style[field] !== undefined)\n}\n\n/** A paragraph style with its own `field` set, or following the text again for `undefined`. */\nexport function withParagraphSpacing(\n style: TextParagraphStyle,\n field: TextParagraphSpacingField,\n value: number | undefined\n): TextParagraphStyle {\n const { [field]: _previous, ...rest } = style\n return value === undefined ? rest : { ...rest, [field]: value }\n}\n\n/** Every paragraph's `field`, or `null` when they differ. */\nexport function sharedParagraphSpacing(\n node: Pick<SceneNode, 'text' | 'textParagraphs' | TextParagraphSpacingField>,\n field: TextParagraphSpacingField,\n first = 0,\n last = paragraphCount(node.text) - 1\n): number | null {\n const value = paragraphSpacingAt(node, first, field)\n for (let index = first + 1; index <= last; index++) {\n if (paragraphSpacingAt(node, index, field) !== value) return null\n }\n return value\n}\n\n/** Paragraph styles with no paragraph setting its own `field`, as setting the text's does. */\nexport function paragraphStylesWithoutSpacing(\n paragraphs: readonly TextParagraphStyle[],\n field: TextParagraphSpacingField\n): TextParagraphStyle[] {\n return trimParagraphStyles(\n paragraphs.map((style) => withParagraphSpacing(style, field, undefined)),\n paragraphs.length\n )\n}\n\n/** Whether any paragraph of the node is a list item. */\nexport function hasTextList(node: Pick<SceneNode, 'textParagraphs'>): boolean {\n return node.textParagraphs.some((paragraph) => paragraph.listType !== 'NONE')\n}\n\n/**\n * Paragraph styles for `count` paragraphs, without the plain paragraphs at the end, so text\n * without lists, indentation, or paragraph spacing of its own keeps none.\n */\nexport function trimParagraphStyles(\n paragraphs: readonly TextParagraphStyle[],\n count: number\n): TextParagraphStyle[] {\n const styles = paragraphs.slice(0, count).map((paragraph) => ({ ...paragraph }))\n while (styles.length > 0) {\n const last = styles[styles.length - 1]\n if (last.listType !== 'NONE' || last.indentation !== 0 || hasParagraphSpacing(last)) break\n styles.pop()\n }\n return styles\n}\n\n/** How many paragraphs `text` has: one more than its newlines. */\nexport function paragraphCount(text: string): number {\n let count = 1\n for (let at = text.indexOf('\\n'); at !== -1; at = text.indexOf('\\n', at + 1)) count++\n return count\n}\n\n/**\n * Paragraph styles after replacing `text[start, end)` with `inserted`, as Figma keeps them: the\n * paragraph the edit starts in keeps its style, paragraphs a deleted newline joins to it are\n * dropped, and paragraphs an inserted newline starts take its style.\n */\nexport function paragraphStylesAfterEdit(\n paragraphs: readonly TextParagraphStyle[],\n text: string,\n start: number,\n end: number,\n inserted: string\n): TextParagraphStyle[] {\n if (paragraphs.length === 0) return []\n const first = paragraphIndexAt(text, start)\n const last = paragraphIndexAt(text, end)\n const style = paragraphStyleAt(paragraphs, first)\n const added = paragraphCount(inserted) - 1\n // A paragraph a newline starts is a new item: a checklist's starts with its box open.\n const opened = omit(style, ['checked'])\n const next = [\n ...Array.from({ length: first }, (_, index) => paragraphStyleAt(paragraphs, index)),\n style,\n ...Array.from({ length: added }, () => opened),\n ...paragraphs.slice(last + 1)\n ]\n return trimParagraphStyles(next, paragraphCount(text) - (last - first) + added)\n}\n\n/**\n * Paragraph styles with every paragraph that `text[start, end)` touches changed by `change`,\n * as a range setter changes whole paragraphs.\n */\nexport function paragraphStylesInRange(\n paragraphs: readonly TextParagraphStyle[],\n text: string,\n start: number,\n end: number,\n change: (style: TextParagraphStyle) => TextParagraphStyle\n): TextParagraphStyle[] {\n const count = paragraphCount(text)\n const first = paragraphIndexAt(text, start)\n // An empty range still names the paragraph it sits in; a range ending right after a\n // newline does not reach into the next paragraph.\n const last = end > start ? paragraphIndexAt(text, end - 1) : first\n const next = Array.from({ length: count }, (_, index) => {\n const style = paragraphStyleAt(paragraphs, index)\n return index >= first && index <= last ? change(style) : style\n })\n return trimParagraphStyles(next, count)\n}\n\n/**\n * A paragraph style with its list type set. A list item is nested at least one level, and a\n * paragraph leaving a list keeps no indentation.\n */\nexport function withListType(\n style: TextParagraphStyle,\n listType: TextListType\n): TextParagraphStyle {\n // Only a checklist item keeps its tick.\n const kept = listType === 'CHECKLIST' ? style : omit(style, ['checked'])\n if (listType === 'NONE') return { ...kept, listType, indentation: 0 }\n return { ...kept, listType, indentation: clampListIndentation(style.indentation) }\n}\n\n/** A paragraph style with its nesting set, kept in the range a list item allows. */\nexport function withIndentation(\n style: TextParagraphStyle,\n indentation: number\n): TextParagraphStyle {\n if (style.listType === 'NONE') {\n return {\n ...style,\n indentation: Math.max(0, Math.min(MAX_LIST_INDENTATION, Math.round(indentation)))\n }\n }\n return { ...style, indentation: clampListIndentation(indentation) }\n}\n\nfunction clampListIndentation(indentation: number): number {\n return Math.max(1, Math.min(MAX_LIST_INDENTATION, Math.round(indentation)))\n}\n\n/**\n * Paragraph styles after `before` became `after` through one edit, found as the text between\n * their common start and end, for editors that replace the text rather than report the edit.\n */\nexport function paragraphStylesAfterTextChange(\n paragraphs: readonly TextParagraphStyle[],\n before: string,\n after: string\n): TextParagraphStyle[] {\n if (paragraphs.length === 0 || before === after) return paragraphs.map((style) => ({ ...style }))\n let prefix = 0\n const shorter = Math.min(before.length, after.length)\n while (prefix < shorter && before[prefix] === after[prefix]) prefix++\n let suffix = 0\n while (\n suffix < shorter - prefix &&\n before[before.length - 1 - suffix] === after[after.length - 1 - suffix]\n ) {\n suffix++\n }\n return paragraphStylesAfterEdit(\n paragraphs,\n before,\n prefix,\n before.length - suffix,\n after.slice(prefix, after.length - suffix)\n )\n}\n"],"mappings":"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"}
|
package/dist/text/path.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
// src/text/path.ts
|
|
2
2
|
function followsPath(node) {
|
|
3
3
|
const glyphs = node.derivedTextGlyphs ?? [];
|
|
4
4
|
if (glyphs.length === 0) return false;
|
|
5
5
|
return !!node.textPathData || !!node.textPathBox || glyphs.some((glyph) => (glyph.rotation ?? 0) !== 0);
|
|
6
6
|
}
|
|
7
|
-
//#endregion
|
|
8
7
|
export { followsPath };
|
|
9
8
|
|
|
10
9
|
//# sourceMappingURL=path.js.map
|
package/dist/text/picture.d.ts
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { SceneNode } from "../types.js";
|
|
2
|
-
//#region src/text/picture.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Invalidate cached Skia textPicture (Paragraph snapshot). Includes width/height
|
|
5
4
|
* because wrapping/layout depends on the box.
|
|
6
5
|
*/
|
|
7
|
-
declare const TEXT_PICTURE_KEYS: ReadonlySet<string>;
|
|
8
|
-
declare const GLYPH_AFFECTING_KEYS: ReadonlySet<string>;
|
|
6
|
+
export declare const TEXT_PICTURE_KEYS: ReadonlySet<string>;
|
|
7
|
+
export declare const GLYPH_AFFECTING_KEYS: ReadonlySet<string>;
|
|
9
8
|
/**
|
|
10
9
|
* Shared by SceneGraph.updateNode and updateNodePreview (drag hot path) so the
|
|
11
10
|
* two invalidation rules cannot drift. Glyphs are kept when the caller
|
|
12
11
|
* replaces them in the same update (resize supplies scaled copies).
|
|
13
12
|
*/
|
|
14
|
-
declare function textCacheInvalidationChanges(node: SceneNode, changes: Partial<SceneNode>): Partial<SceneNode>;
|
|
15
|
-
//#endregion
|
|
16
|
-
export { GLYPH_AFFECTING_KEYS, TEXT_PICTURE_KEYS, textCacheInvalidationChanges };
|
|
13
|
+
export declare function textCacheInvalidationChanges(node: SceneNode, changes: Partial<SceneNode>): Partial<SceneNode>;
|
|
17
14
|
//# sourceMappingURL=picture.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"picture.d.ts","names":[],"sources":["../../src/text/picture.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"picture.d.ts","names":[],"sources":["../../src/text/picture.ts"],"mappings":";;;;;qBASa,mBAAmB;qBAQnB,sBAAsB;;;;;;wBAOnB,6BACd,MAAM,WACN,SAAS,QAAQ,aAChB,QAAQ"}
|
package/dist/text/picture.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TEXT_LAYOUT_FIELDS, TEXT_SHAPING_FIELDS } from "../fields/text.js";
|
|
2
1
|
import { isEqual } from "es-toolkit/predicate";
|
|
3
|
-
|
|
2
|
+
import { TEXT_LAYOUT_FIELDS, TEXT_SHAPING_FIELDS } from "../fields/text.js";
|
|
3
|
+
// src/text/picture.ts
|
|
4
4
|
/**
|
|
5
5
|
* Invalidate cached Skia textPicture (Paragraph snapshot). Includes width/height
|
|
6
6
|
* because wrapping/layout depends on the box.
|
|
@@ -32,7 +32,6 @@ function textCacheInvalidationChanges(node, changes) {
|
|
|
32
32
|
}
|
|
33
33
|
return invalidated;
|
|
34
34
|
}
|
|
35
|
-
//#endregion
|
|
36
35
|
export { GLYPH_AFFECTING_KEYS, TEXT_PICTURE_KEYS, textCacheInvalidationChanges };
|
|
37
36
|
|
|
38
37
|
//# sourceMappingURL=picture.js.map
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import { StyleRun } from "../types.js";
|
|
2
|
-
//#region src/text/references.d.ts
|
|
3
2
|
/** What a text's runs refer to outside the text: the variables they bind and the styles they use. */
|
|
4
|
-
interface StyleRunReferences {
|
|
3
|
+
export interface StyleRunReferences {
|
|
5
4
|
variables: string[];
|
|
6
5
|
styles: string[];
|
|
7
6
|
}
|
|
8
7
|
/** The variables and styles a text's runs refer to, which copies and transfers carry with it. */
|
|
9
|
-
declare function styleRunReferences(runs: readonly StyleRun[]): StyleRunReferences;
|
|
8
|
+
export declare function styleRunReferences(runs: readonly StyleRun[]): StyleRunReferences;
|
|
10
9
|
/**
|
|
11
10
|
* Runs whose variables, styles, and linked layers are renamed, as a copy into another document
|
|
12
11
|
* renames them. Layers are renamed only when given, since a link may name a layer left behind.
|
|
13
12
|
*/
|
|
14
|
-
declare function remapStyleRunReferences(runs: readonly StyleRun[], rename: {
|
|
13
|
+
export declare function remapStyleRunReferences(runs: readonly StyleRun[], rename: {
|
|
15
14
|
variable: (id: string) => string;
|
|
16
15
|
style: (id: string) => string;
|
|
17
16
|
node?: (id: string) => string;
|
|
18
17
|
}): StyleRun[];
|
|
19
|
-
//#endregion
|
|
20
|
-
export { StyleRunReferences, remapStyleRunReferences, styleRunReferences };
|
|
21
18
|
//# sourceMappingURL=references.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"references.d.ts","names":[],"sources":["../../src/text/references.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"references.d.ts","names":[],"sources":["../../src/text/references.ts"],"mappings":";;iBAGiB;EACf;EACA;;;wBAIc,mBAAmB,eAAe,aAAa;;;;;wBAe/C,wBACd,eAAe,YACf;EACE,WAAW;EACX,QAAQ;EACR,QAAQ;IAET"}
|
package/dist/text/references.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/text/references.ts
|
|
1
|
+
// src/text/references.ts
|
|
3
2
|
/** The variables and styles a text's runs refer to, which copies and transfers carry with it. */
|
|
4
3
|
function styleRunReferences(runs) {
|
|
5
4
|
const variables = /* @__PURE__ */ new Set();
|
|
@@ -28,7 +27,7 @@ function remapStyleRunReferences(runs, rename) {
|
|
|
28
27
|
type: "NODE",
|
|
29
28
|
value: rename.node(hyperlink.value)
|
|
30
29
|
};
|
|
31
|
-
if (boundVariables) style.boundVariables =
|
|
30
|
+
if (boundVariables) style.boundVariables = Object.fromEntries(Object.entries(boundVariables).map(([field, id]) => [field, rename.variable(id)]));
|
|
32
31
|
if (textStyleId) style.textStyleId = rename.style(textStyleId);
|
|
33
32
|
if (fillStyleId) style.fillStyleId = rename.style(fillStyleId);
|
|
34
33
|
return {
|
|
@@ -37,7 +36,6 @@ function remapStyleRunReferences(runs, rename) {
|
|
|
37
36
|
};
|
|
38
37
|
});
|
|
39
38
|
}
|
|
40
|
-
//#endregion
|
|
41
39
|
export { remapStyleRunReferences, styleRunReferences };
|
|
42
40
|
|
|
43
41
|
//# sourceMappingURL=references.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"references.js","names":[],"sources":["../../src/text/references.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"references.js","names":[],"sources":["../../src/text/references.ts"],"sourcesContent":["import type { StyleRun } from '../types'\n\n/** What a text's runs refer to outside the text: the variables they bind and the styles they use. */\nexport interface StyleRunReferences {\n variables: string[]\n styles: string[]\n}\n\n/** The variables and styles a text's runs refer to, which copies and transfers carry with it. */\nexport function styleRunReferences(runs: readonly StyleRun[]): StyleRunReferences {\n const variables = new Set<string>()\n const styles = new Set<string>()\n for (const { style } of runs) {\n for (const id of Object.values(style.boundVariables ?? {})) if (id) variables.add(id)\n if (style.textStyleId) styles.add(style.textStyleId)\n if (style.fillStyleId) styles.add(style.fillStyleId)\n }\n return { variables: [...variables], styles: [...styles] }\n}\n\n/**\n * Runs whose variables, styles, and linked layers are renamed, as a copy into another document\n * renames them. Layers are renamed only when given, since a link may name a layer left behind.\n */\nexport function remapStyleRunReferences(\n runs: readonly StyleRun[],\n rename: {\n variable: (id: string) => string\n style: (id: string) => string\n node?: (id: string) => string\n }\n): StyleRun[] {\n return runs.map((run) => {\n const { boundVariables, textStyleId, fillStyleId, hyperlink } = run.style\n const linksLayer = hyperlink?.type === 'NODE' && rename.node !== undefined\n if (!boundVariables && !textStyleId && !fillStyleId && !linksLayer) return run\n const style = { ...run.style }\n if (hyperlink?.type === 'NODE' && rename.node) {\n style.hyperlink = { type: 'NODE', value: rename.node(hyperlink.value) }\n }\n if (boundVariables) {\n style.boundVariables = Object.fromEntries(\n Object.entries(boundVariables).map(([field, id]) => [field, rename.variable(id)])\n )\n }\n if (textStyleId) style.textStyleId = rename.style(textStyleId)\n if (fillStyleId) style.fillStyleId = rename.style(fillStyleId)\n return { ...run, style }\n })\n}\n"],"mappings":";;AASA,SAAgB,mBAAmB,MAA+C;CAChF,MAAM,4BAAY,IAAI,IAAY;CAClC,MAAM,yBAAS,IAAI,IAAY;CAC/B,KAAK,MAAM,EAAE,WAAW,MAAM;EAC5B,KAAK,MAAM,MAAM,OAAO,OAAO,MAAM,kBAAkB,CAAC,CAAC,GAAG,IAAI,IAAI,UAAU,IAAI,EAAE;EACpF,IAAI,MAAM,aAAa,OAAO,IAAI,MAAM,WAAW;EACnD,IAAI,MAAM,aAAa,OAAO,IAAI,MAAM,WAAW;CACrD;CACA,OAAO;EAAE,WAAW,CAAC,GAAG,SAAS;EAAG,QAAQ,CAAC,GAAG,MAAM;CAAE;AAC1D;;;;;AAMA,SAAgB,wBACd,MACA,QAKY;CACZ,OAAO,KAAK,KAAK,QAAQ;EACvB,MAAM,EAAE,gBAAgB,aAAa,aAAa,cAAc,IAAI;EACpE,MAAM,aAAa,WAAW,SAAS,UAAU,OAAO,SAAS,KAAA;EACjE,IAAI,CAAC,kBAAkB,CAAC,eAAe,CAAC,eAAe,CAAC,YAAY,OAAO;EAC3E,MAAM,QAAQ,EAAE,GAAG,IAAI,MAAM;EAC7B,IAAI,WAAW,SAAS,UAAU,OAAO,MACvC,MAAM,YAAY;GAAE,MAAM;GAAQ,OAAO,OAAO,KAAK,UAAU,KAAK;EAAE;EAExE,IAAI,gBACF,MAAM,iBAAiB,OAAO,YAC5B,OAAO,QAAQ,cAAc,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,OAAO,OAAO,SAAS,EAAE,CAAC,CAAC,CAClF;EAEF,IAAI,aAAa,MAAM,cAAc,OAAO,MAAM,WAAW;EAC7D,IAAI,aAAa,MAAM,cAAc,OAAO,MAAM,WAAW;EAC7D,OAAO;GAAE,GAAG;GAAK;EAAM;CACzB,CAAC;AACH"}
|
package/dist/text/runs.d.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { CharacterStyleOverride, SceneNode, StyleRun } from "../types.js";
|
|
2
|
-
//#region src/text/runs.d.ts
|
|
3
2
|
/** The run that styles `text[index]`, if one does. */
|
|
4
|
-
declare function styleRunAt(runs: readonly StyleRun[], index: number): StyleRun | undefined;
|
|
3
|
+
export declare function styleRunAt(runs: readonly StyleRun[], index: number): StyleRun | undefined;
|
|
5
4
|
/** The language `text[index]` is shaped in: its run's, or the text's own. */
|
|
6
|
-
declare function textLanguageAt(node: Pick<SceneNode, 'styleRuns' | 'textLanguage'>, index: number): string | null;
|
|
5
|
+
export declare function textLanguageAt(node: Pick<SceneNode, 'styleRuns' | 'textLanguage'>, index: number): string | null;
|
|
7
6
|
/**
|
|
8
7
|
* Adds `style` over `[start, start + length)` to runs built in text order, extending the last
|
|
9
8
|
* run instead when it ends at `start` with an equal style. An empty style or range adds nothing,
|
|
10
9
|
* since those characters keep the text's own style.
|
|
11
10
|
*/
|
|
12
|
-
declare function appendStyleRun(runs: StyleRun[], start: number, length: number, style: CharacterStyleOverride): void;
|
|
11
|
+
export declare function appendStyleRun(runs: StyleRun[], start: number, length: number, style: CharacterStyleOverride): void;
|
|
13
12
|
/** A stretch of text in one style: a run's, or the text's own where `style` is null. */
|
|
14
|
-
interface StyleRunPiece {
|
|
13
|
+
export interface StyleRunPiece {
|
|
15
14
|
start: number;
|
|
16
15
|
end: number;
|
|
17
16
|
style: CharacterStyleOverride | null;
|
|
@@ -21,9 +20,7 @@ interface StyleRunPiece {
|
|
|
21
20
|
* a run's part that an earlier run already covers, or that lies past the text, is left out.
|
|
22
21
|
* `boundary` moves each cut to where the text may be cut, such as out of a surrogate pair.
|
|
23
22
|
*/
|
|
24
|
-
declare function styleRunPieces(runs: readonly StyleRun[], length: number, boundary?: (index: number) => number): StyleRunPiece[];
|
|
23
|
+
export declare function styleRunPieces(runs: readonly StyleRun[], length: number, boundary?: (index: number) => number): StyleRunPiece[];
|
|
25
24
|
/** Each of the first `length` characters' overrides, merged from the runs over it in order. */
|
|
26
|
-
declare function characterOverrides(runs: readonly StyleRun[], length: number): CharacterStyleOverride[];
|
|
27
|
-
//#endregion
|
|
28
|
-
export { StyleRunPiece, appendStyleRun, characterOverrides, styleRunAt, styleRunPieces, textLanguageAt };
|
|
25
|
+
export declare function characterOverrides(runs: readonly StyleRun[], length: number): CharacterStyleOverride[];
|
|
29
26
|
//# sourceMappingURL=runs.d.ts.map
|
package/dist/text/runs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runs.d.ts","names":[],"sources":["../../src/text/runs.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"runs.d.ts","names":[],"sources":["../../src/text/runs.ts"],"mappings":";;wBAKgB,WAAW,eAAe,YAAY,gBAAgB;;wBAKtD,eACd,MAAM,KAAK,0CACX;;;;;;wBAWc,eACd,MAAM,YACN,eACA,gBACA,OAAO;;iBAUQ;EACf;EACA;EACA,OAAO;;;;;;;wBAQO,eACd,eAAe,YACf,gBACA,YAAW,2BACV;;wBAea,mBACd,eAAe,YACf,iBACC"}
|
package/dist/text/runs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isEqual } from "es-toolkit/predicate";
|
|
2
|
-
|
|
2
|
+
// src/text/runs.ts
|
|
3
3
|
/** The run that styles `text[index]`, if one does. */
|
|
4
4
|
function styleRunAt(runs, index) {
|
|
5
5
|
return runs.find((run) => index >= run.start && index < run.start + run.length);
|
|
@@ -66,7 +66,6 @@ function characterOverrides(runs, length) {
|
|
|
66
66
|
}
|
|
67
67
|
return styles;
|
|
68
68
|
}
|
|
69
|
-
//#endregion
|
|
70
69
|
export { appendStyleRun, characterOverrides, styleRunAt, styleRunPieces, textLanguageAt };
|
|
71
70
|
|
|
72
71
|
//# sourceMappingURL=runs.js.map
|
package/dist/text/schema.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
//#region src/text/schema.d.ts
|
|
3
2
|
/** A line height or letter spacing as files carry it: pixels, or a percent of the font size. */
|
|
4
|
-
declare const textLengthSchema: v.ObjectSchema<{
|
|
3
|
+
export declare const textLengthSchema: v.ObjectSchema<{
|
|
5
4
|
readonly value: v.NumberSchema<undefined>;
|
|
6
5
|
readonly unit: v.PicklistSchema<["PIXELS", "PERCENT"], undefined>;
|
|
7
6
|
}, undefined>;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { textLengthSchema };
|
|
10
7
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","names":[],"sources":["../../src/text/schema.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.d.ts","names":[],"sources":["../../src/text/schema.ts"],"mappings":";;qBAGa,kBAAgB,EAAA"}
|
package/dist/text/schema.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
|
|
2
|
+
// src/text/schema.ts
|
|
3
3
|
/** A line height or letter spacing as files carry it: pixels, or a percent of the font size. */
|
|
4
4
|
const textLengthSchema = v.object({
|
|
5
5
|
value: v.number(),
|
|
6
6
|
unit: v.picklist(["PIXELS", "PERCENT"])
|
|
7
7
|
});
|
|
8
|
-
//#endregion
|
|
9
8
|
export { textLengthSchema };
|
|
10
9
|
|
|
11
10
|
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SceneGraph } from "./graph.js";
|
|
2
|
+
import { SceneNode } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Whether `node` can be the document's thumbnail: a frame, section, or component placed straight
|
|
5
|
+
* on a page people see, or a slide.
|
|
6
|
+
*/
|
|
7
|
+
export declare function canBeDocumentThumbnail(graph: SceneGraph, node: SceneNode): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* The id stored as the document's thumbnail, whether or not that layer is loaded or can still be
|
|
10
|
+
* one: what undo restores.
|
|
11
|
+
*/
|
|
12
|
+
export declare function documentThumbnailId(graph: SceneGraph): string | null;
|
|
13
|
+
/**
|
|
14
|
+
* The layer chosen as the document's thumbnail, or null when there is none or it can no longer
|
|
15
|
+
* be one, such as after it was deleted or moved into another frame.
|
|
16
|
+
*/
|
|
17
|
+
export declare function documentThumbnail(graph: SceneGraph): SceneNode | null;
|
|
18
|
+
/** Chooses `nodeId` as the document's thumbnail, or goes back to the default with null. */
|
|
19
|
+
export declare function setDocumentThumbnail(graph: SceneGraph, nodeId: string | null): void;
|
|
20
|
+
//# sourceMappingURL=thumbnail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thumbnail.d.ts","names":[],"sources":["../src/thumbnail.ts"],"mappings":";;;;;;wBAmBgB,uBAAuB,OAAO,YAAY,MAAM;;;;;wBAWhD,oBAAoB,OAAO;;;;;wBAQ3B,kBAAkB,OAAO,aAAa;;wBAOtC,qBAAqB,OAAO,YAAY"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { readPluginData, withPluginData } from "./plugin-data/field.js";
|
|
2
|
+
import { OPEN_PENCIL_PLUGIN_DATA } from "./plugin-data/fields.js";
|
|
3
|
+
// src/thumbnail.ts
|
|
4
|
+
const { thumbnail } = OPEN_PENCIL_PLUGIN_DATA;
|
|
5
|
+
/** Layers that frame a picture of their own, as Figma lets frames and sections be thumbnails. */
|
|
6
|
+
const THUMBNAIL_TYPES = /* @__PURE__ */ new Set([
|
|
7
|
+
"FRAME",
|
|
8
|
+
"SECTION",
|
|
9
|
+
"COMPONENT",
|
|
10
|
+
"SLIDE"
|
|
11
|
+
]);
|
|
12
|
+
/**
|
|
13
|
+
* Whether `node` can be the document's thumbnail: a frame, section, or component placed straight
|
|
14
|
+
* on a page people see, or a slide.
|
|
15
|
+
*/
|
|
16
|
+
function canBeDocumentThumbnail(graph, node) {
|
|
17
|
+
if (!THUMBNAIL_TYPES.has(node.type)) return false;
|
|
18
|
+
if (node.type === "SLIDE") return true;
|
|
19
|
+
const parent = node.parentId ? graph.getNode(node.parentId) : void 0;
|
|
20
|
+
return parent?.type === "CANVAS" && !parent.internalOnly;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The id stored as the document's thumbnail, whether or not that layer is loaded or can still be
|
|
24
|
+
* one: what undo restores.
|
|
25
|
+
*/
|
|
26
|
+
function documentThumbnailId(graph) {
|
|
27
|
+
return readPluginData(graph.getNode(graph.rootId)?.pluginData, thumbnail) ?? null;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The layer chosen as the document's thumbnail, or null when there is none or it can no longer
|
|
31
|
+
* be one, such as after it was deleted or moved into another frame.
|
|
32
|
+
*/
|
|
33
|
+
function documentThumbnail(graph) {
|
|
34
|
+
const id = documentThumbnailId(graph);
|
|
35
|
+
const node = id ? graph.getNode(id) : void 0;
|
|
36
|
+
return node && canBeDocumentThumbnail(graph, node) ? node : null;
|
|
37
|
+
}
|
|
38
|
+
/** Chooses `nodeId` as the document's thumbnail, or goes back to the default with null. */
|
|
39
|
+
function setDocumentThumbnail(graph, nodeId) {
|
|
40
|
+
const root = graph.getNode(graph.rootId);
|
|
41
|
+
if (!root) return;
|
|
42
|
+
graph.updateNode(root.id, { pluginData: withPluginData(root.pluginData, thumbnail, nodeId ?? void 0) });
|
|
43
|
+
}
|
|
44
|
+
export { canBeDocumentThumbnail, documentThumbnail, documentThumbnailId, setDocumentThumbnail };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=thumbnail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thumbnail.js","names":[],"sources":["../src/thumbnail.ts"],"sourcesContent":["import type { SceneGraph } from './graph'\nimport { readPluginData, withPluginData } from './plugin-data/field'\nimport { OPEN_PENCIL_PLUGIN_DATA } from './plugin-data/fields'\nimport type { SceneNode } from './types'\n\nconst { thumbnail } = OPEN_PENCIL_PLUGIN_DATA\n\n/** Layers that frame a picture of their own, as Figma lets frames and sections be thumbnails. */\nconst THUMBNAIL_TYPES: ReadonlySet<SceneNode['type']> = new Set([\n 'FRAME',\n 'SECTION',\n 'COMPONENT',\n 'SLIDE'\n])\n\n/**\n * Whether `node` can be the document's thumbnail: a frame, section, or component placed straight\n * on a page people see, or a slide.\n */\nexport function canBeDocumentThumbnail(graph: SceneGraph, node: SceneNode): boolean {\n if (!THUMBNAIL_TYPES.has(node.type)) return false\n if (node.type === 'SLIDE') return true\n const parent = node.parentId ? graph.getNode(node.parentId) : undefined\n return parent?.type === 'CANVAS' && !parent.internalOnly\n}\n\n/**\n * The id stored as the document's thumbnail, whether or not that layer is loaded or can still be\n * one: what undo restores.\n */\nexport function documentThumbnailId(graph: SceneGraph): string | null {\n return readPluginData(graph.getNode(graph.rootId)?.pluginData, thumbnail) ?? null\n}\n\n/**\n * The layer chosen as the document's thumbnail, or null when there is none or it can no longer\n * be one, such as after it was deleted or moved into another frame.\n */\nexport function documentThumbnail(graph: SceneGraph): SceneNode | null {\n const id = documentThumbnailId(graph)\n const node = id ? graph.getNode(id) : undefined\n return node && canBeDocumentThumbnail(graph, node) ? node : null\n}\n\n/** Chooses `nodeId` as the document's thumbnail, or goes back to the default with null. */\nexport function setDocumentThumbnail(graph: SceneGraph, nodeId: string | null): void {\n const root = graph.getNode(graph.rootId)\n if (!root) return\n graph.updateNode(root.id, {\n pluginData: withPluginData(root.pluginData, thumbnail, nodeId ?? undefined)\n })\n}\n"],"mappings":";;;AAKA,MAAM,EAAE,cAAc;;AAGtB,MAAM,kCAAkD,IAAI,IAAI;CAC9D;CACA;CACA;CACA;AACF,CAAC;;;;;AAMD,SAAgB,uBAAuB,OAAmB,MAA0B;CAClF,IAAI,CAAC,gBAAgB,IAAI,KAAK,IAAI,GAAG,OAAO;CAC5C,IAAI,KAAK,SAAS,SAAS,OAAO;CAClC,MAAM,SAAS,KAAK,WAAW,MAAM,QAAQ,KAAK,QAAQ,IAAI,KAAA;CAC9D,OAAO,QAAQ,SAAS,YAAY,CAAC,OAAO;AAC9C;;;;;AAMA,SAAgB,oBAAoB,OAAkC;CACpE,OAAO,eAAe,MAAM,QAAQ,MAAM,MAAM,CAAC,EAAE,YAAY,SAAS,KAAK;AAC/E;;;;;AAMA,SAAgB,kBAAkB,OAAqC;CACrE,MAAM,KAAK,oBAAoB,KAAK;CACpC,MAAM,OAAO,KAAK,MAAM,QAAQ,EAAE,IAAI,KAAA;CACtC,OAAO,QAAQ,uBAAuB,OAAO,IAAI,IAAI,OAAO;AAC9D;;AAGA,SAAgB,qBAAqB,OAAmB,QAA6B;CACnF,MAAM,OAAO,MAAM,QAAQ,MAAM,MAAM;CACvC,IAAI,CAAC,MAAM;CACX,MAAM,WAAW,KAAK,IAAI,EACxB,YAAY,eAAe,KAAK,YAAY,WAAW,UAAU,KAAA,CAAS,EAC5E,CAAC;AACH"}
|
package/dist/transfer/apply.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { SceneGraph } from "../graph.js";
|
|
2
2
|
import { prepareGraphTransfer } from "./plan.js";
|
|
3
|
-
|
|
4
|
-
type GraphTransferPlan = ReturnType<typeof prepareGraphTransfer>;
|
|
3
|
+
export type GraphTransferPlan = ReturnType<typeof prepareGraphTransfer>;
|
|
5
4
|
/** Revalidate at insertion time. Event-delivery failures after commit are not rollback failures. */
|
|
6
|
-
declare function applyGraphTransfer(target: SceneGraph, input: GraphTransferPlan): void;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { GraphTransferPlan, applyGraphTransfer };
|
|
5
|
+
export declare function applyGraphTransfer(target: SceneGraph, input: GraphTransferPlan): void;
|
|
9
6
|
//# sourceMappingURL=apply.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply.d.ts","names":[],"sources":["../../src/transfer/apply.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"apply.d.ts","names":[],"sources":["../../src/transfer/apply.ts"],"mappings":";;YAQY,oBAAoB,kBAAkB;;wBAqDlC,mBAAmB,QAAQ,YAAY,OAAO"}
|
package/dist/transfer/apply.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isEqual } from "es-toolkit/predicate";
|
|
2
|
+
import { heldTransferCollections, variableIdentityReferences } from "./identity.js";
|
|
2
3
|
import { validateTransferReferences } from "./validation.js";
|
|
3
4
|
import { prepareVariableTransfer } from "./variables.js";
|
|
4
|
-
|
|
5
|
-
//#region src/transfer/apply.ts
|
|
5
|
+
// src/transfer/apply.ts
|
|
6
6
|
function validate(target, plan) {
|
|
7
7
|
validateTransferReferences(target, plan);
|
|
8
8
|
const reserved = /* @__PURE__ */ new Set([
|
|
@@ -14,7 +14,8 @@ function validate(target, plan) {
|
|
|
14
14
|
if (reserved.has(id)) throw new Error(`Transfer identity collision ${id}`);
|
|
15
15
|
reserved.add(id);
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
const collections = [...plan.collections, ...heldTransferCollections(target, plan)];
|
|
18
|
+
prepareVariableTransfer(plan.variables, collections, variableIdentityReferences(plan.variables, collections, plan.reused.variables));
|
|
18
19
|
for (const collection of plan.collections) claim(collection.id);
|
|
19
20
|
for (const variable of plan.variables) claim(variable.id);
|
|
20
21
|
const parents = new Set(target.nodes.keys());
|
|
@@ -31,6 +32,15 @@ function validate(target, plan) {
|
|
|
31
32
|
if (existing && !isEqual(existing, bytes)) throw new Error(`Transfer image collision ${hash}`);
|
|
32
33
|
}
|
|
33
34
|
}
|
|
35
|
+
/** Takes the variables a plan added out of the target's library collections again. */
|
|
36
|
+
function leaveHeldCollections(target, plan) {
|
|
37
|
+
for (const { collectionId, variableId } of plan.joined) {
|
|
38
|
+
const collection = target.variableCollections.get(collectionId);
|
|
39
|
+
if (!collection?.variableIds.includes(variableId)) continue;
|
|
40
|
+
target.willChangeCollection(collectionId);
|
|
41
|
+
collection.variableIds = collection.variableIds.filter((id) => id !== variableId);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
34
44
|
/** Revalidate at insertion time. Event-delivery failures after commit are not rollback failures. */
|
|
35
45
|
function applyGraphTransfer(target, input) {
|
|
36
46
|
const plan = structuredClone(input);
|
|
@@ -47,6 +57,7 @@ function applyGraphTransfer(target, input) {
|
|
|
47
57
|
});
|
|
48
58
|
} catch (error) {
|
|
49
59
|
for (const node of plan.nodes.toReversed()) if (target.getNode(node.id)) target.deleteNode(node.id);
|
|
60
|
+
leaveHeldCollections(target, plan);
|
|
50
61
|
for (const variable of plan.variables) target.variables.delete(variable.id);
|
|
51
62
|
for (const collection of plan.collections) target.variableCollections.delete(collection.id);
|
|
52
63
|
for (const hash of imageIds) target.images.delete(hash);
|
|
@@ -54,7 +65,6 @@ function applyGraphTransfer(target, input) {
|
|
|
54
65
|
}
|
|
55
66
|
});
|
|
56
67
|
}
|
|
57
|
-
|
|
58
|
-
export { applyGraphTransfer };
|
|
68
|
+
export { applyGraphTransfer, leaveHeldCollections };
|
|
59
69
|
|
|
60
70
|
//# sourceMappingURL=apply.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply.js","names":[],"sources":["../../src/transfer/apply.ts"],"sourcesContent":["import { isEqual } from 'es-toolkit/predicate'\n\nimport type { SceneGraph } from '../graph'\nimport { variableIdentityReferences } from './identity'\nimport type { prepareGraphTransfer } from './plan'\nimport { validateTransferReferences } from './validation'\nimport { prepareVariableTransfer } from './variables'\n\nexport type GraphTransferPlan = ReturnType<typeof prepareGraphTransfer>\n\nfunction validate(target: SceneGraph, plan: GraphTransferPlan): void {\n validateTransferReferences(target, plan)\n const reserved = new Set([\n ...target.nodes.keys(),\n ...target.variables.keys(),\n ...target.variableCollections.keys()\n ])\n const claim = (id: string): void => {\n if (reserved.has(id)) throw new Error(`Transfer identity collision ${id}`)\n reserved.add(id)\n }\n prepareVariableTransfer(\n plan.variables,\n
|
|
1
|
+
{"version":3,"file":"apply.js","names":[],"sources":["../../src/transfer/apply.ts"],"sourcesContent":["import { isEqual } from 'es-toolkit/predicate'\n\nimport type { SceneGraph } from '../graph'\nimport { heldTransferCollections, variableIdentityReferences } from './identity'\nimport type { prepareGraphTransfer } from './plan'\nimport { validateTransferReferences } from './validation'\nimport { prepareVariableTransfer } from './variables'\n\nexport type GraphTransferPlan = ReturnType<typeof prepareGraphTransfer>\n\nfunction validate(target: SceneGraph, plan: GraphTransferPlan): void {\n validateTransferReferences(target, plan)\n const reserved = new Set([\n ...target.nodes.keys(),\n ...target.variables.keys(),\n ...target.variableCollections.keys()\n ])\n const claim = (id: string): void => {\n if (reserved.has(id)) throw new Error(`Transfer identity collision ${id}`)\n reserved.add(id)\n }\n const collections = [...plan.collections, ...heldTransferCollections(target, plan)]\n prepareVariableTransfer(\n plan.variables,\n collections,\n variableIdentityReferences(plan.variables, collections, plan.reused.variables)\n )\n for (const collection of plan.collections) claim(collection.id)\n for (const variable of plan.variables) claim(variable.id)\n const parents = new Set(target.nodes.keys())\n for (const node of plan.nodes) {\n claim(node.id)\n if ('id' in node.props || 'parentId' in node.props || 'childIds' in node.props)\n throw new Error('Transfer props cannot override hierarchy identity')\n if (!parents.has(node.parentId)) throw new Error(`Missing transfer parent ${node.parentId}`)\n parents.add(node.id)\n }\n for (const id of [...plan.rootIds, ...plan.dependencyPageIds]) {\n if (!plan.nodes.some((node) => node.id === id)) throw new Error(`Missing transfer root ${id}`)\n }\n for (const node of plan.nodes) {\n if (node.props.componentId && !parents.has(node.props.componentId))\n throw new Error(`Missing transfer component ${node.props.componentId}`)\n }\n for (const [hash, bytes] of plan.images) {\n const existing = target.images.get(hash)\n if (existing && !isEqual(existing, bytes)) throw new Error(`Transfer image collision ${hash}`)\n }\n}\n\n/** Takes the variables a plan added out of the target's library collections again. */\nexport function leaveHeldCollections(target: SceneGraph, plan: GraphTransferPlan): void {\n for (const { collectionId, variableId } of plan.joined) {\n const collection = target.variableCollections.get(collectionId)\n if (!collection?.variableIds.includes(variableId)) continue\n target.willChangeCollection(collectionId)\n collection.variableIds = collection.variableIds.filter((id) => id !== variableId)\n }\n}\n\n/** Revalidate at insertion time. Event-delivery failures after commit are not rollback failures. */\nexport function applyGraphTransfer(target: SceneGraph, input: GraphTransferPlan): void {\n const plan = structuredClone(input)\n validate(target, plan)\n const imageIds = [...plan.images.keys()].filter((hash) => !target.images.has(hash))\n target.withBufferedEvents(() => {\n try {\n for (const collection of plan.collections) target.addCollection(collection)\n // Adding a variable lists it in its collection, the target's own included.\n for (const variable of plan.variables) target.addVariable(variable)\n for (const [hash, bytes] of plan.images)\n if (!target.images.has(hash)) target.images.set(hash, bytes)\n for (const node of plan.nodes)\n target.createNodeWithId(node.id, node.type, node.parentId, { ...node.props, childIds: [] })\n } catch (error) {\n for (const node of plan.nodes.toReversed())\n if (target.getNode(node.id)) target.deleteNode(node.id)\n leaveHeldCollections(target, plan)\n for (const variable of plan.variables) target.variables.delete(variable.id)\n for (const collection of plan.collections) target.variableCollections.delete(collection.id)\n for (const hash of imageIds) target.images.delete(hash)\n throw error\n }\n })\n}\n"],"mappings":"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"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { SceneGraph } from "../graph.js";
|
|
2
2
|
import { SceneNode } from "../types.js";
|
|
3
|
-
//#region src/transfer/copied.d.ts
|
|
4
3
|
/** How a layer's references to other layers are resolved anew. */
|
|
5
|
-
interface ReferenceResolvers {
|
|
4
|
+
export interface ReferenceResolvers {
|
|
6
5
|
/** The component a reference names now; `previous` is the one the layer named, if any. */
|
|
7
6
|
component: (id: string, previous: string | null) => string;
|
|
8
7
|
/** The layer an override names now; `component` is the one its instance now draws. */
|
|
@@ -18,11 +17,16 @@ interface ReferenceResolvers {
|
|
|
18
17
|
variable: (id: string) => string;
|
|
19
18
|
}
|
|
20
19
|
/** Copies placed in another document, whose text links must follow the copy. */
|
|
21
|
-
interface CopiedReferenceOptions {
|
|
20
|
+
export interface CopiedReferenceOptions {
|
|
22
21
|
followTextLinks?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Layers the target already holds in place of ones left out of the copy, by the ID each stands
|
|
24
|
+
* for. References to them point there; the layers themselves are not copies and stay as they are.
|
|
25
|
+
*/
|
|
26
|
+
aliases?: ReadonlyMap<string, string>;
|
|
23
27
|
}
|
|
24
28
|
/** The instance-swap properties `nodes` define, whose values name components. */
|
|
25
|
-
declare function instanceSwapPropertyIds(nodes: Iterable<SceneNode>): Set<string>;
|
|
29
|
+
export declare function instanceSwapPropertyIds(nodes: Iterable<SceneNode>): Set<string>;
|
|
26
30
|
/**
|
|
27
31
|
* `node`'s references to other layers, resolved anew: its main component, the layers its
|
|
28
32
|
* overrides change and the components they swap in, the components its instance-swap properties
|
|
@@ -30,7 +34,7 @@ declare function instanceSwapPropertyIds(nodes: Iterable<SceneNode>): Set<string
|
|
|
30
34
|
* whose references these replace, so a resolver can keep what it already pointed at. Only the
|
|
31
35
|
* fields whose references change are returned: every write is an update collaboration sends.
|
|
32
36
|
*/
|
|
33
|
-
declare function resolvedReferences(node: SceneNode, previous: SceneNode, resolve: ReferenceResolvers, swapProperties: ReadonlySet<string>): Partial<SceneNode>;
|
|
37
|
+
export declare function resolvedReferences(node: SceneNode, previous: SceneNode, resolve: ReferenceResolvers, swapProperties: ReadonlySet<string>): Partial<SceneNode>;
|
|
34
38
|
/**
|
|
35
39
|
* Points copied layers at one another, as `prepareNodeTransfer` does for a paste: an instance's
|
|
36
40
|
* main component, the layers its overrides change and the components they swap in, the
|
|
@@ -38,9 +42,7 @@ declare function resolvedReferences(node: SceneNode, previous: SceneNode, resolv
|
|
|
38
42
|
* ends follow. `mappedIds` maps each copied layer to its copy, such as a library copy or a design
|
|
39
43
|
* JSX render folded into the layers it replaces; a reference outside the copy stays as it is, and
|
|
40
44
|
* so do variable IDs, since the copies keep their source's variables. Text links follow the copy
|
|
41
|
-
* only with `followTextLinks
|
|
45
|
+
* only with `followTextLinks`, and `aliases` points references at layers already there.
|
|
42
46
|
*/
|
|
43
|
-
declare function remapCopiedReferences(graph: SceneGraph, mappedIds: ReadonlyMap<string, string>, options?: CopiedReferenceOptions): void;
|
|
44
|
-
//#endregion
|
|
45
|
-
export { CopiedReferenceOptions, ReferenceResolvers, instanceSwapPropertyIds, remapCopiedReferences, resolvedReferences };
|
|
47
|
+
export declare function remapCopiedReferences(graph: SceneGraph, mappedIds: ReadonlyMap<string, string>, options?: CopiedReferenceOptions): void;
|
|
46
48
|
//# sourceMappingURL=copied.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copied.d.ts","names":[],"sources":["../../src/transfer/copied.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"copied.d.ts","names":[],"sources":["../../src/transfer/copied.ts"],"mappings":";;;iBASiB;;EAEf,YAAY,YAAY;;EAExB,QAAQ,YAAY;;EAEpB,WAAW;;;;;;EAMX,QAAQ;EACR,WAAW;;;iBAII;EACf;;;;;EAKA,UAAU;;;wBAUI,wBAAwB,OAAO,SAAS,aAAa;;;;;;;;wBAWrD,mBACd,MAAM,WACN,UAAU,WACV,SAAS,oBACT,gBAAgB,sBACf,QAAQ;;;;;;;;;;wBA8DK,sBACd,OAAO,YACP,WAAW,6BACX,UAAS"}
|
package/dist/transfer/copied.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { isEqual, mapValues } from "es-toolkit";
|
|
2
|
+
import { componentPropertyDefinitions } from "../components/properties.js";
|
|
1
3
|
import { remapInstanceOverrideState } from "../instances/overrides.js";
|
|
2
4
|
import { remapStyleRunReferences } from "../text/references.js";
|
|
3
|
-
|
|
4
|
-
import { isEqual, mapValues } from "es-toolkit";
|
|
5
|
-
//#region src/transfer/copied.ts
|
|
5
|
+
// src/transfer/copied.ts
|
|
6
6
|
function swapPropertyIds(definitions) {
|
|
7
7
|
return definitions.filter((definition) => definition.type === "INSTANCE_SWAP").map((definition) => definition.id);
|
|
8
8
|
}
|
|
@@ -59,10 +59,10 @@ function resolvedReferences(node, previous, resolve, swapProperties) {
|
|
|
59
59
|
* ends follow. `mappedIds` maps each copied layer to its copy, such as a library copy or a design
|
|
60
60
|
* JSX render folded into the layers it replaces; a reference outside the copy stays as it is, and
|
|
61
61
|
* so do variable IDs, since the copies keep their source's variables. Text links follow the copy
|
|
62
|
-
* only with `followTextLinks
|
|
62
|
+
* only with `followTextLinks`, and `aliases` points references at layers already there.
|
|
63
63
|
*/
|
|
64
64
|
function remapCopiedReferences(graph, mappedIds, options = {}) {
|
|
65
|
-
const mapped = (id) => mappedIds.get(id) ?? id;
|
|
65
|
+
const mapped = (id) => mappedIds.get(id) ?? options.aliases?.get(id) ?? id;
|
|
66
66
|
const resolve = {
|
|
67
67
|
component: mapped,
|
|
68
68
|
layer: mapped,
|
|
@@ -77,7 +77,6 @@ function remapCopiedReferences(graph, mappedIds, options = {}) {
|
|
|
77
77
|
if (Object.keys(changes).length > 0) graph.updateNode(node.id, changes);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
//#endregion
|
|
81
80
|
export { instanceSwapPropertyIds, remapCopiedReferences, resolvedReferences };
|
|
82
81
|
|
|
83
82
|
//# sourceMappingURL=copied.js.map
|