@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copied.js","names":[],"sources":["../../src/transfer/copied.ts"],"sourcesContent":["import { isEqual, mapValues } from 'es-toolkit'\n\nimport { componentPropertyDefinitions } from '../components/properties'\nimport type { SceneGraph } from '../graph'\nimport { remapInstanceOverrideState } from '../instances/overrides'\nimport { remapStyleRunReferences } from '../text/references'\nimport type { ComponentPropertyDefinition, SceneNode } from '../types'\n\n/** How a layer's references to other layers are resolved anew. */\nexport interface ReferenceResolvers {\n /** The component a reference names now; `previous` is the one the layer named, if any. */\n component: (id: string, previous: string | null) => string\n /** The layer an override names now; `component` is the one its instance now draws. */\n layer: (id: string, component: string | null) => string\n /** The layer a connector's end follows now. */\n endpoint: (id: string) => string\n /**\n * The layer a text link names now. Without it links keep naming their layers, as Figma's\n * duplicate and paste do (desktop 126); copies into another document, which lacks those\n * layers, pass it.\n */\n link?: (id: string) => string\n variable: (id: string) => string\n}\n\n/** Copies placed in another document, whose text links must follow the copy. */\nexport interface CopiedReferenceOptions {\n followTextLinks?: boolean\n}\n\nfunction swapPropertyIds(definitions: readonly ComponentPropertyDefinition[]): string[] {\n return definitions\n .filter((definition) => definition.type === 'INSTANCE_SWAP')\n .map((definition) => definition.id)\n}\n\n/** The instance-swap properties `nodes` define, whose values name components. */\nexport function instanceSwapPropertyIds(nodes: Iterable<SceneNode>): Set<string> {\n return new Set([...nodes].flatMap((node) => swapPropertyIds(node.componentPropertyDefinitions)))\n}\n\n/**\n * `node`'s references to other layers, resolved anew: its main component, the layers its\n * overrides change and the components they swap in, the components its instance-swap properties\n * default to or are set to, and the layers its connector ends follow. `previous` is the layer\n * whose references these replace, so a resolver can keep what it already pointed at. Only the\n * fields whose references change are returned: every write is an update collaboration sends.\n */\nexport function resolvedReferences(\n node: SceneNode,\n previous: SceneNode,\n resolve: ReferenceResolvers,\n swapProperties: ReadonlySet<string>\n): Partial<SceneNode> {\n const changes: Partial<SceneNode> = {}\n const componentId = node.componentId\n ? resolve.component(node.componentId, previous.componentId)\n : null\n if (componentId !== node.componentId) changes.componentId = componentId\n const overrides = remapInstanceOverrideState(node.instanceOverrides, {\n node: (id) => resolve.layer(id, componentId),\n variable: resolve.variable\n })\n if (!isEqual(overrides, node.instanceOverrides)) changes.instanceOverrides = overrides\n const previousDefaults = new Map(\n previous.componentPropertyDefinitions.map((definition) => [\n definition.id,\n definition.defaultValue\n ])\n )\n const definitions = node.componentPropertyDefinitions.map((definition) =>\n definition.type === 'INSTANCE_SWAP' && definition.defaultValue\n ? {\n ...definition,\n defaultValue: resolve.component(\n definition.defaultValue,\n previousDefaults.get(definition.id) ?? null\n )\n }\n : definition\n )\n if (!isEqual(definitions, node.componentPropertyDefinitions))\n changes.componentPropertyDefinitions = definitions\n const assignments = mapValues(node.componentPropertyAssignments, (value, id) =>\n swapProperties.has(id)\n ? resolve.component(value, previous.componentPropertyAssignments[id] ?? null)\n : value\n )\n if (!isEqual(assignments, node.componentPropertyAssignments))\n changes.componentPropertyAssignments = assignments\n for (const field of ['connectorStart', 'connectorEnd'] as const) {\n const endpoint = node[field]\n const nodeId = endpoint?.nodeId ? resolve.endpoint(endpoint.nodeId) : null\n if (endpoint && nodeId && nodeId !== endpoint.nodeId) changes[field] = { ...endpoint, nodeId }\n }\n if (resolve.link) {\n const styleRuns = remapStyleRunReferences(node.styleRuns, {\n variable: (id) => id,\n style: (id) => id,\n node: resolve.link\n })\n if (!isEqual(styleRuns, node.styleRuns)) changes.styleRuns = styleRuns\n }\n return changes\n}\n\n/**\n * Points copied layers at one another, as `prepareNodeTransfer` does for a paste: an instance's\n * main component, the layers its overrides change and the components they swap in, the\n * components an instance-swap property defaults to or is set to, and the layers a connector's\n * ends follow. `mappedIds` maps each copied layer to its copy, such as a library copy or a design\n * JSX render folded into the layers it replaces; a reference outside the copy stays as it is, and\n * so do variable IDs, since the copies keep their source's variables. Text links follow the copy\n * only with `followTextLinks
|
|
1
|
+
{"version":3,"file":"copied.js","names":[],"sources":["../../src/transfer/copied.ts"],"sourcesContent":["import { isEqual, mapValues } from 'es-toolkit'\n\nimport { componentPropertyDefinitions } from '../components/properties'\nimport type { SceneGraph } from '../graph'\nimport { remapInstanceOverrideState } from '../instances/overrides'\nimport { remapStyleRunReferences } from '../text/references'\nimport type { ComponentPropertyDefinition, SceneNode } from '../types'\n\n/** How a layer's references to other layers are resolved anew. */\nexport interface ReferenceResolvers {\n /** The component a reference names now; `previous` is the one the layer named, if any. */\n component: (id: string, previous: string | null) => string\n /** The layer an override names now; `component` is the one its instance now draws. */\n layer: (id: string, component: string | null) => string\n /** The layer a connector's end follows now. */\n endpoint: (id: string) => string\n /**\n * The layer a text link names now. Without it links keep naming their layers, as Figma's\n * duplicate and paste do (desktop 126); copies into another document, which lacks those\n * layers, pass it.\n */\n link?: (id: string) => string\n variable: (id: string) => string\n}\n\n/** Copies placed in another document, whose text links must follow the copy. */\nexport interface CopiedReferenceOptions {\n followTextLinks?: boolean\n /**\n * Layers the target already holds in place of ones left out of the copy, by the ID each stands\n * for. References to them point there; the layers themselves are not copies and stay as they are.\n */\n aliases?: ReadonlyMap<string, string>\n}\n\nfunction swapPropertyIds(definitions: readonly ComponentPropertyDefinition[]): string[] {\n return definitions\n .filter((definition) => definition.type === 'INSTANCE_SWAP')\n .map((definition) => definition.id)\n}\n\n/** The instance-swap properties `nodes` define, whose values name components. */\nexport function instanceSwapPropertyIds(nodes: Iterable<SceneNode>): Set<string> {\n return new Set([...nodes].flatMap((node) => swapPropertyIds(node.componentPropertyDefinitions)))\n}\n\n/**\n * `node`'s references to other layers, resolved anew: its main component, the layers its\n * overrides change and the components they swap in, the components its instance-swap properties\n * default to or are set to, and the layers its connector ends follow. `previous` is the layer\n * whose references these replace, so a resolver can keep what it already pointed at. Only the\n * fields whose references change are returned: every write is an update collaboration sends.\n */\nexport function resolvedReferences(\n node: SceneNode,\n previous: SceneNode,\n resolve: ReferenceResolvers,\n swapProperties: ReadonlySet<string>\n): Partial<SceneNode> {\n const changes: Partial<SceneNode> = {}\n const componentId = node.componentId\n ? resolve.component(node.componentId, previous.componentId)\n : null\n if (componentId !== node.componentId) changes.componentId = componentId\n const overrides = remapInstanceOverrideState(node.instanceOverrides, {\n node: (id) => resolve.layer(id, componentId),\n variable: resolve.variable\n })\n if (!isEqual(overrides, node.instanceOverrides)) changes.instanceOverrides = overrides\n const previousDefaults = new Map(\n previous.componentPropertyDefinitions.map((definition) => [\n definition.id,\n definition.defaultValue\n ])\n )\n const definitions = node.componentPropertyDefinitions.map((definition) =>\n definition.type === 'INSTANCE_SWAP' && definition.defaultValue\n ? {\n ...definition,\n defaultValue: resolve.component(\n definition.defaultValue,\n previousDefaults.get(definition.id) ?? null\n )\n }\n : definition\n )\n if (!isEqual(definitions, node.componentPropertyDefinitions))\n changes.componentPropertyDefinitions = definitions\n const assignments = mapValues(node.componentPropertyAssignments, (value, id) =>\n swapProperties.has(id)\n ? resolve.component(value, previous.componentPropertyAssignments[id] ?? null)\n : value\n )\n if (!isEqual(assignments, node.componentPropertyAssignments))\n changes.componentPropertyAssignments = assignments\n for (const field of ['connectorStart', 'connectorEnd'] as const) {\n const endpoint = node[field]\n const nodeId = endpoint?.nodeId ? resolve.endpoint(endpoint.nodeId) : null\n if (endpoint && nodeId && nodeId !== endpoint.nodeId) changes[field] = { ...endpoint, nodeId }\n }\n if (resolve.link) {\n const styleRuns = remapStyleRunReferences(node.styleRuns, {\n variable: (id) => id,\n style: (id) => id,\n node: resolve.link\n })\n if (!isEqual(styleRuns, node.styleRuns)) changes.styleRuns = styleRuns\n }\n return changes\n}\n\n/**\n * Points copied layers at one another, as `prepareNodeTransfer` does for a paste: an instance's\n * main component, the layers its overrides change and the components they swap in, the\n * components an instance-swap property defaults to or is set to, and the layers a connector's\n * ends follow. `mappedIds` maps each copied layer to its copy, such as a library copy or a design\n * JSX render folded into the layers it replaces; a reference outside the copy stays as it is, and\n * so do variable IDs, since the copies keep their source's variables. Text links follow the copy\n * only with `followTextLinks`, and `aliases` points references at layers already there.\n */\nexport function remapCopiedReferences(\n graph: SceneGraph,\n mappedIds: ReadonlyMap<string, string>,\n options: CopiedReferenceOptions = {}\n): void {\n const mapped = (id: string) => mappedIds.get(id) ?? options.aliases?.get(id) ?? id\n const resolve: ReferenceResolvers = {\n component: mapped,\n layer: mapped,\n endpoint: mapped,\n link: options.followTextLinks ? mapped : undefined,\n variable: (id) => id\n }\n const copies = [...mappedIds.values()].flatMap((id) => graph.getNode(id) ?? [])\n const copiedSwaps = instanceSwapPropertyIds(copies)\n for (const node of copies) {\n // An instance's swap property may be defined on a component the copy leaves behind.\n const swapProperties = new Set([\n ...copiedSwaps,\n ...swapPropertyIds(componentPropertyDefinitions(graph, node))\n ])\n const changes = resolvedReferences(node, node, resolve, swapProperties)\n if (Object.keys(changes).length > 0) graph.updateNode(node.id, changes)\n }\n}\n"],"mappings":";;;;;AAmCA,SAAS,gBAAgB,aAA+D;CACtF,OAAO,YACJ,QAAQ,eAAe,WAAW,SAAS,eAAe,CAAC,CAC3D,KAAK,eAAe,WAAW,EAAE;AACtC;;AAGA,SAAgB,wBAAwB,OAAyC;CAC/E,OAAO,IAAI,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,SAAS,SAAS,gBAAgB,KAAK,4BAA4B,CAAC,CAAC;AACjG;;;;;;;;AASA,SAAgB,mBACd,MACA,UACA,SACA,gBACoB;CACpB,MAAM,UAA8B,CAAC;CACrC,MAAM,cAAc,KAAK,cACrB,QAAQ,UAAU,KAAK,aAAa,SAAS,WAAW,IACxD;CACJ,IAAI,gBAAgB,KAAK,aAAa,QAAQ,cAAc;CAC5D,MAAM,YAAY,2BAA2B,KAAK,mBAAmB;EACnE,OAAO,OAAO,QAAQ,MAAM,IAAI,WAAW;EAC3C,UAAU,QAAQ;CACpB,CAAC;CACD,IAAI,CAAC,QAAQ,WAAW,KAAK,iBAAiB,GAAG,QAAQ,oBAAoB;CAC7E,MAAM,mBAAmB,IAAI,IAC3B,SAAS,6BAA6B,KAAK,eAAe,CACxD,WAAW,IACX,WAAW,YACb,CAAC,CACH;CACA,MAAM,cAAc,KAAK,6BAA6B,KAAK,eACzD,WAAW,SAAS,mBAAmB,WAAW,eAC9C;EACE,GAAG;EACH,cAAc,QAAQ,UACpB,WAAW,cACX,iBAAiB,IAAI,WAAW,EAAE,KAAK,IACzC;CACF,IACA,UACN;CACA,IAAI,CAAC,QAAQ,aAAa,KAAK,4BAA4B,GACzD,QAAQ,+BAA+B;CACzC,MAAM,cAAc,UAAU,KAAK,+BAA+B,OAAO,OACvE,eAAe,IAAI,EAAE,IACjB,QAAQ,UAAU,OAAO,SAAS,6BAA6B,OAAO,IAAI,IAC1E,KACN;CACA,IAAI,CAAC,QAAQ,aAAa,KAAK,4BAA4B,GACzD,QAAQ,+BAA+B;CACzC,KAAK,MAAM,SAAS,CAAC,kBAAkB,cAAc,GAAY;EAC/D,MAAM,WAAW,KAAK;EACtB,MAAM,SAAS,UAAU,SAAS,QAAQ,SAAS,SAAS,MAAM,IAAI;EACtE,IAAI,YAAY,UAAU,WAAW,SAAS,QAAQ,QAAQ,SAAS;GAAE,GAAG;GAAU;EAAO;CAC/F;CACA,IAAI,QAAQ,MAAM;EAChB,MAAM,YAAY,wBAAwB,KAAK,WAAW;GACxD,WAAW,OAAO;GAClB,QAAQ,OAAO;GACf,MAAM,QAAQ;EAChB,CAAC;EACD,IAAI,CAAC,QAAQ,WAAW,KAAK,SAAS,GAAG,QAAQ,YAAY;CAC/D;CACA,OAAO;AACT;;;;;;;;;;AAWA,SAAgB,sBACd,OACA,WACA,UAAkC,CAAC,GAC7B;CACN,MAAM,UAAU,OAAe,UAAU,IAAI,EAAE,KAAK,QAAQ,SAAS,IAAI,EAAE,KAAK;CAChF,MAAM,UAA8B;EAClC,WAAW;EACX,OAAO;EACP,UAAU;EACV,MAAM,QAAQ,kBAAkB,SAAS,KAAA;EACzC,WAAW,OAAO;CACpB;CACA,MAAM,SAAS,CAAC,GAAG,UAAU,OAAO,CAAC,CAAC,CAAC,SAAS,OAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,CAAC;CAC9E,MAAM,cAAc,wBAAwB,MAAM;CAClD,KAAK,MAAM,QAAQ,QAAQ;EAMzB,MAAM,UAAU,mBAAmB,MAAM,MAAM,yBAAS,IAJ7B,IAAI,CAC7B,GAAG,aACH,GAAG,gBAAgB,6BAA6B,OAAO,IAAI,CAAC,CAC9D,CACqE,CAAC;EACtE,IAAI,OAAO,KAAK,OAAO,CAAC,CAAC,SAAS,GAAG,MAAM,WAAW,KAAK,IAAI,OAAO;CACxE;AACF"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { SceneGraph } from "../graph.js";
|
|
2
2
|
import { SceneNode } from "../types.js";
|
|
3
|
-
//#region src/transfer/dependencies.d.ts
|
|
4
3
|
/** What layers need from their document to draw the same in another one. */
|
|
5
|
-
interface LayerDependencies {
|
|
4
|
+
export interface LayerDependencies {
|
|
6
5
|
/** The variables the layers and their styles bind, and every variable those alias. */
|
|
7
6
|
variables: Set<string>;
|
|
8
7
|
/**
|
|
@@ -15,24 +14,25 @@ interface LayerDependencies {
|
|
|
15
14
|
/** The images the layers and their styles paint with. */
|
|
16
15
|
images: Set<string>;
|
|
17
16
|
}
|
|
18
|
-
/**
|
|
19
|
-
|
|
17
|
+
/**
|
|
18
|
+
* The variables a layer names: its own bindings, its characters', its overrides', and those its
|
|
19
|
+
* behaviour's transition, slide transition and animation follow.
|
|
20
|
+
*/
|
|
21
|
+
export declare function layerVariableIds(node: SceneNode): string[];
|
|
20
22
|
/**
|
|
21
23
|
* The images a layer paints with: its fills, strokes, vector regions, text decorations, and
|
|
22
|
-
* characters.
|
|
24
|
+
* characters, and the frames its Shader effects draw.
|
|
23
25
|
*/
|
|
24
|
-
declare function layerImageHashes(node: SceneNode): string[];
|
|
26
|
+
export declare function layerImageHashes(node: SceneNode): string[];
|
|
25
27
|
/**
|
|
26
28
|
* The variables, collections, styles, and images `layers` depend on, as a copy into another
|
|
27
29
|
* document must carry them: a style brings what it binds and paints with in turn, and a variable
|
|
28
30
|
* brings the variables it aliases.
|
|
29
31
|
*/
|
|
30
|
-
declare function layerDependencies(graph: SceneGraph, layers: Iterable<SceneNode>): LayerDependencies;
|
|
32
|
+
export declare function layerDependencies(graph: SceneGraph, layers: Iterable<SceneNode>): LayerDependencies;
|
|
31
33
|
/**
|
|
32
34
|
* These variables and every variable they alias, at any depth, with their collections and the
|
|
33
35
|
* collections a kept expression names a mode of.
|
|
34
36
|
*/
|
|
35
|
-
declare function variableDependencies(graph: SceneGraph, ids: Iterable<string>): Pick<LayerDependencies, 'variables' | 'collections'>;
|
|
36
|
-
//#endregion
|
|
37
|
-
export { LayerDependencies, layerDependencies, layerImageHashes, layerVariableIds, variableDependencies };
|
|
37
|
+
export declare function variableDependencies(graph: SceneGraph, ids: Iterable<string>): Pick<LayerDependencies, 'variables' | 'collections'>;
|
|
38
38
|
//# sourceMappingURL=dependencies.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.d.ts","names":[],"sources":["../../src/transfer/dependencies.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"dependencies.d.ts","names":[],"sources":["../../src/transfer/dependencies.ts"],"mappings":";;;iBAiBiB;;EAEf,WAAW;;;;;EAKX,aAAa;;EAEb,QAAQ;;EAER,QAAQ;;;;;;wBAOM,iBAAiB,MAAM;;;;;wBAoBvB,iBAAiB,MAAM;;;;;;wBAqBvB,kBACd,OAAO,YACP,QAAQ,SAAS,aAChB;;;;;wBA8Ba,qBACd,OAAO,YACP,KAAK,mBACJ,KAAK"}
|
|
@@ -1,33 +1,45 @@
|
|
|
1
|
+
import { appendAll } from "@open-pencil/std/arrays";
|
|
2
|
+
import { readBehaviour } from "../behaviours/model.js";
|
|
3
|
+
import { transitionVariableIds } from "../behaviours/transition.js";
|
|
4
|
+
import { imagePaintHashes } from "../images.js";
|
|
1
5
|
import { overriddenBindingField } from "../instances/overrides.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
6
|
+
import { keyframeVariableIds } from "../motion/variables.js";
|
|
7
|
+
import { shaderEffectImages } from "../shaders/model.js";
|
|
4
8
|
import { referencedStyleIds, sharedStyleLayers } from "../shared-styles.js";
|
|
9
|
+
import { slideVariableIds } from "../slides/motion.js";
|
|
10
|
+
import { styleRunReferences } from "../text/references.js";
|
|
11
|
+
import { isUnsupportedVariableValue, variableValueReferences } from "../variables/value.js";
|
|
5
12
|
import { regionFills } from "../vector-network.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
13
|
+
// src/transfer/dependencies.ts
|
|
14
|
+
/**
|
|
15
|
+
* The variables a layer names: its own bindings, its characters', its overrides', and those its
|
|
16
|
+
* behaviour's transition, slide transition and animation follow.
|
|
17
|
+
*/
|
|
10
18
|
function layerVariableIds(node) {
|
|
11
19
|
const { self, descendants } = node.instanceOverrides;
|
|
12
20
|
const overridden = [...self, ...[...descendants.values()].flatMap((fields) => [...fields])];
|
|
21
|
+
const behaviour = readBehaviour(node);
|
|
13
22
|
return [
|
|
14
23
|
...Object.values(node.boundVariables),
|
|
24
|
+
...behaviour ? transitionVariableIds(behaviour) : [],
|
|
25
|
+
...slideVariableIds(node),
|
|
26
|
+
...keyframeVariableIds(node),
|
|
15
27
|
...styleRunReferences(node.styleRuns).variables,
|
|
16
28
|
...overridden.flatMap(([field, value]) => typeof value === "string" && overriddenBindingField(field) !== null ? [value] : [])
|
|
17
29
|
];
|
|
18
30
|
}
|
|
19
31
|
/**
|
|
20
32
|
* The images a layer paints with: its fills, strokes, vector regions, text decorations, and
|
|
21
|
-
* characters.
|
|
33
|
+
* characters, and the frames its Shader effects draw.
|
|
22
34
|
*/
|
|
23
35
|
function layerImageHashes(node) {
|
|
24
|
-
return imagePaintHashes([
|
|
36
|
+
return [...imagePaintHashes([
|
|
25
37
|
...node.fills,
|
|
26
38
|
...node.strokes,
|
|
27
39
|
...regionFills(node.vectorNetwork),
|
|
28
40
|
...node.textDecorationFills,
|
|
29
41
|
...node.styleRuns.flatMap((run) => [...run.style.fills ?? [], ...run.style.textDecorationFills ?? []])
|
|
30
|
-
]);
|
|
42
|
+
]), ...shaderEffectImages(node.effects)];
|
|
31
43
|
}
|
|
32
44
|
/**
|
|
33
45
|
* The variables, collections, styles, and images `layers` depend on, as a copy into another
|
|
@@ -95,7 +107,6 @@ function variableDependencies(graph, ids) {
|
|
|
95
107
|
collections
|
|
96
108
|
};
|
|
97
109
|
}
|
|
98
|
-
//#endregion
|
|
99
110
|
export { layerDependencies, layerImageHashes, layerVariableIds, variableDependencies };
|
|
100
111
|
|
|
101
112
|
//# sourceMappingURL=dependencies.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.js","names":[],"sources":["../../src/transfer/dependencies.ts"],"sourcesContent":["import { appendAll } from '@open-pencil/std/arrays'\n\nimport type { SceneGraph } from '../graph'\nimport { imagePaintHashes } from '../images'\nimport { overriddenBindingField } from '../instances/overrides'\nimport { referencedStyleIds, sharedStyleLayers } from '../shared-styles'\nimport { styleRunReferences } from '../text/references'\nimport type { SceneNode } from '../types'\nimport { isUnsupportedVariableValue, variableValueReferences } from '../variables/value'\nimport { regionFills } from '../vector-network'\n\n/** What layers need from their document to draw the same in another one. */\nexport interface LayerDependencies {\n /** The variables the layers and their styles bind, and every variable those alias. */\n variables: Set<string>\n /**\n * The collections of those variables, those the layers set a mode of, and those a kept\n * expression names a mode of.\n */\n collections: Set<string>\n /** The shared styles the layers use, as the style layers that define them. */\n styles: SceneNode[]\n /** The images the layers and their styles paint with. */\n images: Set<string>\n}\n\n
|
|
1
|
+
{"version":3,"file":"dependencies.js","names":[],"sources":["../../src/transfer/dependencies.ts"],"sourcesContent":["import { appendAll } from '@open-pencil/std/arrays'\n\nimport { readBehaviour } from '../behaviours/model'\nimport { transitionVariableIds } from '../behaviours/transition'\nimport type { SceneGraph } from '../graph'\nimport { imagePaintHashes } from '../images'\nimport { overriddenBindingField } from '../instances/overrides'\nimport { keyframeVariableIds } from '../motion/variables'\nimport { shaderEffectImages } from '../shaders/model'\nimport { referencedStyleIds, sharedStyleLayers } from '../shared-styles'\nimport { slideVariableIds } from '../slides/motion'\nimport { styleRunReferences } from '../text/references'\nimport type { SceneNode } from '../types'\nimport { isUnsupportedVariableValue, variableValueReferences } from '../variables/value'\nimport { regionFills } from '../vector-network'\n\n/** What layers need from their document to draw the same in another one. */\nexport interface LayerDependencies {\n /** The variables the layers and their styles bind, and every variable those alias. */\n variables: Set<string>\n /**\n * The collections of those variables, those the layers set a mode of, and those a kept\n * expression names a mode of.\n */\n collections: Set<string>\n /** The shared styles the layers use, as the style layers that define them. */\n styles: SceneNode[]\n /** The images the layers and their styles paint with. */\n images: Set<string>\n}\n\n/**\n * The variables a layer names: its own bindings, its characters', its overrides', and those its\n * behaviour's transition, slide transition and animation follow.\n */\nexport function layerVariableIds(node: SceneNode): string[] {\n const { self, descendants } = node.instanceOverrides\n const overridden = [...self, ...[...descendants.values()].flatMap((fields) => [...fields])]\n const behaviour = readBehaviour(node)\n return [\n ...Object.values(node.boundVariables),\n ...(behaviour ? transitionVariableIds(behaviour) : []),\n ...slideVariableIds(node),\n ...keyframeVariableIds(node),\n ...styleRunReferences(node.styleRuns).variables,\n ...overridden.flatMap(([field, value]) =>\n typeof value === 'string' && overriddenBindingField(field) !== null ? [value] : []\n )\n ]\n}\n\n/**\n * The images a layer paints with: its fills, strokes, vector regions, text decorations, and\n * characters, and the frames its Shader effects draw.\n */\nexport function layerImageHashes(node: SceneNode): string[] {\n return [\n ...imagePaintHashes([\n ...node.fills,\n ...node.strokes,\n ...regionFills(node.vectorNetwork),\n ...node.textDecorationFills,\n ...node.styleRuns.flatMap((run) => [\n ...(run.style.fills ?? []),\n ...(run.style.textDecorationFills ?? [])\n ])\n ]),\n ...shaderEffectImages(node.effects)\n ]\n}\n\n/**\n * The variables, collections, styles, and images `layers` depend on, as a copy into another\n * document must carry them: a style brings what it binds and paints with in turn, and a variable\n * brings the variables it aliases.\n */\nexport function layerDependencies(\n graph: SceneGraph,\n layers: Iterable<SceneNode>\n): LayerDependencies {\n const collections = new Set<string>()\n const images = new Set<string>()\n const styles = new Map<string, SceneNode>()\n const pending: string[] = []\n let styleLayers: Map<string, SceneNode> | undefined\n const styleLayer = (id: string): SceneNode | undefined =>\n (styleLayers ??= sharedStyleLayers(graph)).get(id)\n const visit = (node: SceneNode): void => {\n for (const hash of layerImageHashes(node)) images.add(hash)\n appendAll(pending, layerVariableIds(node))\n for (const id of Object.keys(node.variableModes))\n if (graph.variableCollections.has(id)) collections.add(id)\n for (const id of referencedStyleIds(node)) {\n const style = styles.has(id) ? undefined : styleLayer(id)\n if (!style) continue\n styles.set(id, style)\n visit(style)\n }\n }\n for (const node of layers) visit(node)\n const resolved = variableDependencies(graph, pending)\n for (const id of resolved.collections) collections.add(id)\n return { variables: resolved.variables, collections, styles: [...styles.values()], images }\n}\n\n/**\n * These variables and every variable they alias, at any depth, with their collections and the\n * collections a kept expression names a mode of.\n */\nexport function variableDependencies(\n graph: SceneGraph,\n ids: Iterable<string>\n): Pick<LayerDependencies, 'variables' | 'collections'> {\n const pending = [...ids]\n const variables = new Set<string>()\n const collections = new Set<string>()\n let modeCollections: Map<string, string> | undefined\n const collectionOfMode = (modeId: string): string | undefined => {\n modeCollections ??= new Map(\n [...graph.variableCollections.values()].flatMap((collection) =>\n collection.modes.map((mode) => [mode.modeId, collection.id] as const)\n )\n )\n return modeCollections.get(modeId)\n }\n for (let id = pending.pop(); id !== undefined; id = pending.pop()) {\n if (variables.has(id)) continue\n const variable = graph.variables.get(id)\n if (!variable) continue\n variables.add(id)\n collections.add(variable.collectionId)\n for (const value of Object.values(variable.valuesByMode)) {\n appendAll(pending, variableValueReferences(value))\n // A kept expression can name a mode of a collection none of its aliases reach.\n if (!isUnsupportedVariableValue(value)) continue\n for (const modeId of value.modes) {\n const collection = collectionOfMode(modeId)\n if (collection) collections.add(collection)\n }\n }\n }\n return { variables, collections }\n}\n"],"mappings":"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"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { SceneGraph } from "../graph.js";
|
|
2
2
|
import { GraphTransferPlan } from "./apply.js";
|
|
3
|
-
//#region src/transfer/history.d.ts
|
|
4
3
|
/** Capture post-placement state for redo; this does not authorize deleting shared resources. */
|
|
5
|
-
declare function captureTransferredState(graph: SceneGraph, original: GraphTransferPlan): GraphTransferPlan;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { captureTransferredState };
|
|
4
|
+
export declare function captureTransferredState(graph: SceneGraph, original: GraphTransferPlan): GraphTransferPlan;
|
|
8
5
|
//# sourceMappingURL=history.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.d.ts","names":[],"sources":["../../src/transfer/history.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"history.d.ts","names":[],"sources":["../../src/transfer/history.ts"],"mappings":";;;wBAKgB,wBACd,OAAO,YACP,UAAU,oBACT"}
|
package/dist/transfer/history.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cloneNodeProps } from "../copy.js";
|
|
2
|
-
|
|
2
|
+
// src/transfer/history.ts
|
|
3
3
|
/** Capture post-placement state for redo; this does not authorize deleting shared resources. */
|
|
4
4
|
function captureTransferredState(graph, original) {
|
|
5
5
|
const requireValue = (value, kind, id) => {
|
|
@@ -10,6 +10,8 @@ function captureTransferredState(graph, original) {
|
|
|
10
10
|
nodeIds: new Map(original.nodeIds),
|
|
11
11
|
rootIds: [...original.rootIds],
|
|
12
12
|
dependencyPageIds: [...original.dependencyPageIds],
|
|
13
|
+
reused: structuredClone(original.reused),
|
|
14
|
+
joined: structuredClone(original.joined),
|
|
13
15
|
nodes: original.nodes.map((entry) => {
|
|
14
16
|
const node = requireValue(graph.getNode(entry.id), "node", entry.id);
|
|
15
17
|
if (!node.parentId) throw new Error(`Missing transferred parent ${entry.id}`);
|
|
@@ -25,7 +27,6 @@ function captureTransferredState(graph, original) {
|
|
|
25
27
|
images: new Map([...original.images.keys()].map((hash) => [hash, requireValue(graph.images.get(hash), "image", hash).slice()]))
|
|
26
28
|
};
|
|
27
29
|
}
|
|
28
|
-
//#endregion
|
|
29
30
|
export { captureTransferredState };
|
|
30
31
|
|
|
31
32
|
//# sourceMappingURL=history.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.js","names":[],"sources":["../../src/transfer/history.ts"],"sourcesContent":["import { cloneNodeProps } from '../copy'\nimport type { SceneGraph } from '../graph'\nimport type { GraphTransferPlan } from './apply'\n\n/** Capture post-placement state for redo; this does not authorize deleting shared resources. */\nexport function captureTransferredState(\n graph: SceneGraph,\n original: GraphTransferPlan\n): GraphTransferPlan {\n const requireValue = <T>(value: T | undefined, kind: string, id: string): T => {\n if (value === undefined) throw new Error(`Missing transferred ${kind} ${id}`)\n return value\n }\n return {\n nodeIds: new Map(original.nodeIds),\n rootIds: [...original.rootIds],\n dependencyPageIds: [...original.dependencyPageIds],\n nodes: original.nodes.map((entry) => {\n const node = requireValue(graph.getNode(entry.id), 'node', entry.id)\n if (!node.parentId) throw new Error(`Missing transferred parent ${entry.id}`)\n return {\n id: node.id,\n type: node.type,\n parentId: node.parentId,\n props: cloneNodeProps(node, null)\n }\n }),\n variables: original.variables.map((variable) =>\n structuredClone(requireValue(graph.variables.get(variable.id), 'variable', variable.id))\n ),\n collections: original.collections.map((collection) =>\n structuredClone(\n requireValue(graph.variableCollections.get(collection.id), 'collection', collection.id)\n )\n ),\n images: new Map(\n [...original.images.keys()].map((hash) => [\n hash,\n requireValue(graph.images.get(hash), 'image', hash).slice()\n ])\n )\n }\n}\n"],"mappings":";;;AAKA,SAAgB,wBACd,OACA,UACmB;CACnB,MAAM,gBAAmB,OAAsB,MAAc,OAAkB;EAC7E,IAAI,UAAU,KAAA,GAAW,MAAM,IAAI,MAAM,uBAAuB,KAAK,GAAG,IAAI;EAC5E,OAAO;CACT;CACA,OAAO;EACL,SAAS,IAAI,IAAI,SAAS,OAAO;EACjC,SAAS,CAAC,GAAG,SAAS,OAAO;EAC7B,mBAAmB,CAAC,GAAG,SAAS,iBAAiB;EACjD,OAAO,SAAS,MAAM,KAAK,UAAU;GACnC,MAAM,OAAO,aAAa,MAAM,QAAQ,MAAM,EAAE,GAAG,QAAQ,MAAM,EAAE;GACnE,IAAI,CAAC,KAAK,UAAU,MAAM,IAAI,MAAM,8BAA8B,MAAM,IAAI;GAC5E,OAAO;IACL,IAAI,KAAK;IACT,MAAM,KAAK;IACX,UAAU,KAAK;IACf,OAAO,eAAe,MAAM,IAAI;GAClC;EACF,CAAC;EACD,WAAW,SAAS,UAAU,KAAK,aACjC,gBAAgB,aAAa,MAAM,UAAU,IAAI,SAAS,EAAE,GAAG,YAAY,SAAS,EAAE,CAAC,CACzF;EACA,aAAa,SAAS,YAAY,KAAK,eACrC,gBACE,aAAa,MAAM,oBAAoB,IAAI,WAAW,EAAE,GAAG,cAAc,WAAW,EAAE,CACxF,CACF;EACA,QAAQ,IAAI,IACV,CAAC,GAAG,SAAS,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,CACxC,MACA,aAAa,MAAM,OAAO,IAAI,IAAI,GAAG,SAAS,IAAI,CAAC,CAAC,MAAM,CAC5D,CAAC,CACH;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"history.js","names":[],"sources":["../../src/transfer/history.ts"],"sourcesContent":["import { cloneNodeProps } from '../copy'\nimport type { SceneGraph } from '../graph'\nimport type { GraphTransferPlan } from './apply'\n\n/** Capture post-placement state for redo; this does not authorize deleting shared resources. */\nexport function captureTransferredState(\n graph: SceneGraph,\n original: GraphTransferPlan\n): GraphTransferPlan {\n const requireValue = <T>(value: T | undefined, kind: string, id: string): T => {\n if (value === undefined) throw new Error(`Missing transferred ${kind} ${id}`)\n return value\n }\n return {\n nodeIds: new Map(original.nodeIds),\n rootIds: [...original.rootIds],\n dependencyPageIds: [...original.dependencyPageIds],\n reused: structuredClone(original.reused),\n joined: structuredClone(original.joined),\n nodes: original.nodes.map((entry) => {\n const node = requireValue(graph.getNode(entry.id), 'node', entry.id)\n if (!node.parentId) throw new Error(`Missing transferred parent ${entry.id}`)\n return {\n id: node.id,\n type: node.type,\n parentId: node.parentId,\n props: cloneNodeProps(node, null)\n }\n }),\n variables: original.variables.map((variable) =>\n structuredClone(requireValue(graph.variables.get(variable.id), 'variable', variable.id))\n ),\n collections: original.collections.map((collection) =>\n structuredClone(\n requireValue(graph.variableCollections.get(collection.id), 'collection', collection.id)\n )\n ),\n images: new Map(\n [...original.images.keys()].map((hash) => [\n hash,\n requireValue(graph.images.get(hash), 'image', hash).slice()\n ])\n )\n }\n}\n"],"mappings":";;;AAKA,SAAgB,wBACd,OACA,UACmB;CACnB,MAAM,gBAAmB,OAAsB,MAAc,OAAkB;EAC7E,IAAI,UAAU,KAAA,GAAW,MAAM,IAAI,MAAM,uBAAuB,KAAK,GAAG,IAAI;EAC5E,OAAO;CACT;CACA,OAAO;EACL,SAAS,IAAI,IAAI,SAAS,OAAO;EACjC,SAAS,CAAC,GAAG,SAAS,OAAO;EAC7B,mBAAmB,CAAC,GAAG,SAAS,iBAAiB;EACjD,QAAQ,gBAAgB,SAAS,MAAM;EACvC,QAAQ,gBAAgB,SAAS,MAAM;EACvC,OAAO,SAAS,MAAM,KAAK,UAAU;GACnC,MAAM,OAAO,aAAa,MAAM,QAAQ,MAAM,EAAE,GAAG,QAAQ,MAAM,EAAE;GACnE,IAAI,CAAC,KAAK,UAAU,MAAM,IAAI,MAAM,8BAA8B,MAAM,IAAI;GAC5E,OAAO;IACL,IAAI,KAAK;IACT,MAAM,KAAK;IACX,UAAU,KAAK;IACf,OAAO,eAAe,MAAM,IAAI;GAClC;EACF,CAAC;EACD,WAAW,SAAS,UAAU,KAAK,aACjC,gBAAgB,aAAa,MAAM,UAAU,IAAI,SAAS,EAAE,GAAG,YAAY,SAAS,EAAE,CAAC,CACzF;EACA,aAAa,SAAS,YAAY,KAAK,eACrC,gBACE,aAAa,MAAM,oBAAoB,IAAI,WAAW,EAAE,GAAG,cAAc,WAAW,EAAE,CACxF,CACF;EACA,QAAQ,IAAI,IACV,CAAC,GAAG,SAAS,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,CACxC,MACA,aAAa,MAAM,OAAO,IAAI,IAAI,GAAG,SAAS,IAAI,CAAC,CAAC,MAAM,CAC5D,CAAC,CACH;CACF;AACF"}
|
|
@@ -1,12 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
function variableIdentityReferences(variables, collections) {
|
|
1
|
+
// src/transfer/identity.ts
|
|
2
|
+
function variableIdentityReferences(variables, collections, heldVariableIds = []) {
|
|
3
3
|
return {
|
|
4
|
-
variables: new Map(variables.map((variable) =>
|
|
4
|
+
variables: new Map([...variables.map((variable) => variable.id), ...heldVariableIds].map((id) => [id, id])),
|
|
5
5
|
collections: new Map(collections.map((collection) => [collection.id, collection.id])),
|
|
6
6
|
modes: new Map(collections.flatMap((collection) => collection.modes.map((mode) => [mode.modeId, mode.modeId])))
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* The target's collections a plan reuses, each listing only the variables the plan adds to it,
|
|
11
|
+
* as a plan's own collections list theirs, so the plan validates as one self-contained fragment.
|
|
12
|
+
*/
|
|
13
|
+
function heldTransferCollections(target, plan) {
|
|
14
|
+
for (const id of plan.reused.variables) if (!target.variables.has(id)) throw new Error(`Missing reused transfer variable ${id}`);
|
|
15
|
+
return plan.reused.collections.map((id) => {
|
|
16
|
+
const collection = target.variableCollections.get(id);
|
|
17
|
+
if (!collection) throw new Error(`Missing reused transfer collection ${id}`);
|
|
18
|
+
return {
|
|
19
|
+
...structuredClone(collection),
|
|
20
|
+
variableIds: plan.joined.filter((entry) => entry.collectionId === id).map((entry) => entry.variableId)
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export { heldTransferCollections, variableIdentityReferences };
|
|
11
25
|
|
|
12
26
|
//# sourceMappingURL=identity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.js","names":[],"sources":["../../src/transfer/identity.ts"],"sourcesContent":["import type { Variable, VariableCollection } from '../types'\n\nexport function variableIdentityReferences(\n variables: readonly Variable[],\n collections: readonly VariableCollection[]\n) {\n return {\n variables: new Map(variables.map((variable) =>
|
|
1
|
+
{"version":3,"file":"identity.js","names":[],"sources":["../../src/transfer/identity.ts"],"sourcesContent":["import type { SceneGraph } from '../graph'\nimport type { Variable, VariableCollection } from '../types'\n\nexport function variableIdentityReferences(\n variables: readonly Variable[],\n collections: readonly VariableCollection[],\n heldVariableIds: readonly string[] = []\n) {\n return {\n variables: new Map(\n [...variables.map((variable) => variable.id), ...heldVariableIds].map((id) => [id, id])\n ),\n collections: new Map(collections.map((collection) => [collection.id, collection.id])),\n modes: new Map(\n collections.flatMap((collection) =>\n collection.modes.map((mode) => [mode.modeId, mode.modeId] as const)\n )\n )\n }\n}\n\n/** The target's library resources a transfer reuses, and the variables it adds to them. */\nexport interface HeldTransferResources {\n reused: { collections: string[]; variables: string[]; styles: string[] }\n joined: Array<{ collectionId: string; variableId: string }>\n}\n\n/**\n * The target's collections a plan reuses, each listing only the variables the plan adds to it,\n * as a plan's own collections list theirs, so the plan validates as one self-contained fragment.\n */\nexport function heldTransferCollections(\n target: SceneGraph,\n plan: HeldTransferResources\n): VariableCollection[] {\n for (const id of plan.reused.variables)\n if (!target.variables.has(id)) throw new Error(`Missing reused transfer variable ${id}`)\n return plan.reused.collections.map((id) => {\n const collection = target.variableCollections.get(id)\n if (!collection) throw new Error(`Missing reused transfer collection ${id}`)\n return {\n ...structuredClone(collection),\n variableIds: plan.joined\n .filter((entry) => entry.collectionId === id)\n .map((entry) => entry.variableId)\n }\n })\n}\n"],"mappings":";AAGA,SAAgB,2BACd,WACA,aACA,kBAAqC,CAAC,GACtC;CACA,OAAO;EACL,WAAW,IAAI,IACb,CAAC,GAAG,UAAU,KAAK,aAAa,SAAS,EAAE,GAAG,GAAG,eAAe,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC,CACxF;EACA,aAAa,IAAI,IAAI,YAAY,KAAK,eAAe,CAAC,WAAW,IAAI,WAAW,EAAE,CAAC,CAAC;EACpF,OAAO,IAAI,IACT,YAAY,SAAS,eACnB,WAAW,MAAM,KAAK,SAAS,CAAC,KAAK,QAAQ,KAAK,MAAM,CAAU,CACpE,CACF;CACF;AACF;;;;;AAYA,SAAgB,wBACd,QACA,MACsB;CACtB,KAAK,MAAM,MAAM,KAAK,OAAO,WAC3B,IAAI,CAAC,OAAO,UAAU,IAAI,EAAE,GAAG,MAAM,IAAI,MAAM,oCAAoC,IAAI;CACzF,OAAO,KAAK,OAAO,YAAY,KAAK,OAAO;EACzC,MAAM,aAAa,OAAO,oBAAoB,IAAI,EAAE;EACpD,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,sCAAsC,IAAI;EAC3E,OAAO;GACL,GAAG,gBAAgB,UAAU;GAC7B,aAAa,KAAK,OACf,QAAQ,UAAU,MAAM,iBAAiB,EAAE,CAAC,CAC5C,KAAK,UAAU,MAAM,UAAU;EACpC;CACF,CAAC;AACH"}
|
package/dist/transfer/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { GraphTransferInput, prepareGraphTransfer } from "./plan.js";
|
|
2
|
-
import { GraphTransferPlan, applyGraphTransfer } from "./apply.js";
|
|
3
1
|
import { removeGraphTransfer } from "./remove.js";
|
|
4
2
|
import { captureTransferredState } from "./history.js";
|
|
5
|
-
import {
|
|
3
|
+
import { GraphTransferPlan, applyGraphTransfer } from "./apply.js";
|
|
4
|
+
import { GraphTransferInput, prepareGraphTransfer } from "./plan.js";
|
|
6
5
|
import { NodeTransferReferences, prepareNodeTransfer } from "./nodes.js";
|
|
6
|
+
import { VariableTransferReferences, copyVariableTables, prepareVariableTransfer } from "./variables.js";
|
|
7
7
|
import { CopiedReferenceOptions, ReferenceResolvers, instanceSwapPropertyIds, remapCopiedReferences, resolvedReferences } from "./copied.js";
|
|
8
8
|
import { LayerDependencies, layerDependencies, layerImageHashes, layerVariableIds, variableDependencies } from "./dependencies.js";
|
|
9
9
|
import { ResourceReferences, remappedResourceReferences } from "./resources.js";
|
|
10
|
-
|
|
10
|
+
import { LibraryReuse, libraryModeOf, matchLibraryResources, withoutLibraryKey } from "./library.js";
|
|
11
|
+
export { type CopiedReferenceOptions, type GraphTransferInput, type GraphTransferPlan, type LayerDependencies, type LibraryReuse, type NodeTransferReferences, type ReferenceResolvers, type ResourceReferences, type VariableTransferReferences, applyGraphTransfer, captureTransferredState, copyVariableTables, instanceSwapPropertyIds, layerDependencies, layerImageHashes, layerVariableIds, libraryModeOf, matchLibraryResources, prepareGraphTransfer, prepareNodeTransfer, prepareVariableTransfer, remapCopiedReferences, remappedResourceReferences, removeGraphTransfer, resolvedReferences, variableDependencies, withoutLibraryKey };
|
package/dist/transfer/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { instanceSwapPropertyIds, remapCopiedReferences, resolvedReferences } from "./copied.js";
|
|
2
|
-
import { remappedResourceReferences } from "./resources.js";
|
|
3
|
-
import { prepareNodeTransfer } from "./nodes.js";
|
|
4
1
|
import { removeGraphTransfer } from "./remove.js";
|
|
5
2
|
import { captureTransferredState } from "./history.js";
|
|
6
|
-
import { copyVariableTables, prepareVariableTransfer } from "./variables.js";
|
|
7
3
|
import { applyGraphTransfer } from "./apply.js";
|
|
8
4
|
import { prepareGraphTransfer } from "./plan.js";
|
|
5
|
+
import { prepareNodeTransfer } from "./nodes.js";
|
|
6
|
+
import { copyVariableTables, prepareVariableTransfer } from "./variables.js";
|
|
7
|
+
import { instanceSwapPropertyIds, remapCopiedReferences, resolvedReferences } from "./copied.js";
|
|
9
8
|
import { layerDependencies, layerImageHashes, layerVariableIds, variableDependencies } from "./dependencies.js";
|
|
10
|
-
|
|
9
|
+
import { remappedResourceReferences } from "./resources.js";
|
|
10
|
+
import { libraryModeOf, matchLibraryResources, withoutLibraryKey } from "./library.js";
|
|
11
|
+
export { applyGraphTransfer, captureTransferredState, copyVariableTables, instanceSwapPropertyIds, layerDependencies, layerImageHashes, layerVariableIds, libraryModeOf, matchLibraryResources, prepareGraphTransfer, prepareNodeTransfer, prepareVariableTransfer, remapCopiedReferences, remappedResourceReferences, removeGraphTransfer, resolvedReferences, variableDependencies, withoutLibraryKey };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SceneGraph } from "../graph.js";
|
|
2
|
+
import { SceneNode, Variable, VariableCollection, VariableCollectionMode } from "../types.js";
|
|
3
|
+
/** A library asset's identity: its key and the version references by key carry with it. */
|
|
4
|
+
interface LibraryIdentity {
|
|
5
|
+
key?: string;
|
|
6
|
+
version?: string;
|
|
7
|
+
}
|
|
8
|
+
/** A copy without the library key and version it came with: the document's own. */
|
|
9
|
+
export declare function withoutLibraryKey<T extends LibraryIdentity>(item: T): T;
|
|
10
|
+
/** The library mode a mode stands for: the one it came from, or else itself. */
|
|
11
|
+
export declare function libraryModeOf(mode: VariableCollectionMode): string;
|
|
12
|
+
/**
|
|
13
|
+
* How a transfer meets the copies the target already holds of the library resources it brings,
|
|
14
|
+
* so that a document keeps one copy of each library asset, as Figma does: a pasted layer binds
|
|
15
|
+
* to the copy the document has, which the reader would otherwise find twice under one key.
|
|
16
|
+
*/
|
|
17
|
+
export interface LibraryReuse {
|
|
18
|
+
/** Source collections the target holds, by the target collection holding them. */
|
|
19
|
+
collections: Map<string, string>;
|
|
20
|
+
/** Modes of those collections, by the target mode each stands for. */
|
|
21
|
+
modes: Map<string, string>;
|
|
22
|
+
/** Source variables the target holds, by the target variable. */
|
|
23
|
+
variables: Map<string, string>;
|
|
24
|
+
/** Source styles the target holds, by the style ID layers name the target's copy with. */
|
|
25
|
+
styles: Map<string, string>;
|
|
26
|
+
/**
|
|
27
|
+
* Library resources the target holds a copy of that cannot take this one's place, such as a
|
|
28
|
+
* collection whose modes do not pair: the transfer makes them its own, without their key.
|
|
29
|
+
*/
|
|
30
|
+
local: Set<string>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Matches the library resources a transfer brings against the copies the target holds.
|
|
34
|
+
* `targetStyles` is the target's `sharedStyleLayers` when the caller has it already; the target
|
|
35
|
+
* is searched for styles only when the transfer brings one.
|
|
36
|
+
*/
|
|
37
|
+
export declare function matchLibraryResources(target: SceneGraph, source: {
|
|
38
|
+
collections: Iterable<VariableCollection>;
|
|
39
|
+
variables: Iterable<Variable>;
|
|
40
|
+
styles: Iterable<SceneNode>;
|
|
41
|
+
}, targetStyles?: ReadonlyMap<string, SceneNode>): LibraryReuse;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=library.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"library.d.ts","names":[],"sources":["../../src/transfer/library.ts"],"mappings":";;;UAKU;EACR;EACA;;;wBAac,kBAAkB,UAAU,iBAAiB,MAAM,IAAI;;wBA6CvD,cAAc,MAAM;;;;;;iBAqCnB;;EAEf,aAAa;;EAEb,OAAO;;EAEP,WAAW;;EAEX,QAAQ;;;;;EAKR,OAAO;;;;;;;wBAQO,sBACd,QAAQ,YACR;EACE,aAAa,SAAS;EACtB,WAAW,SAAS;EACpB,QAAQ,SAAS;GAEnB,eAAe,oBAAoB,aAClC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { sharedStyleLayers } from "../shared-styles.js";
|
|
2
|
+
// src/transfer/library.ts
|
|
3
|
+
function sameAsset(a, b) {
|
|
4
|
+
return !!a.key && a.key === b.key && a.version === b.version;
|
|
5
|
+
}
|
|
6
|
+
/** One string per library asset, to index copies by; none for an asset without a key. */
|
|
7
|
+
function assetId({ key, version }) {
|
|
8
|
+
return key ? `${key}\u0000${version ?? ""}` : void 0;
|
|
9
|
+
}
|
|
10
|
+
/** A copy without the library key and version it came with: the document's own. */
|
|
11
|
+
function withoutLibraryKey(item) {
|
|
12
|
+
const copy = { ...item };
|
|
13
|
+
delete copy.key;
|
|
14
|
+
delete copy.version;
|
|
15
|
+
return copy;
|
|
16
|
+
}
|
|
17
|
+
/** The library key and version a style taken from a library keeps from its file. */
|
|
18
|
+
function styleLibraryIdentity(style) {
|
|
19
|
+
const { key, version } = style.source.fig.rawNodeFields;
|
|
20
|
+
return {
|
|
21
|
+
key: typeof key === "string" ? key : void 0,
|
|
22
|
+
version: typeof version === "string" ? version : void 0
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function matchLibraryStyles(target, sourceStyles, targetStyles) {
|
|
26
|
+
const incoming = [...sourceStyles].flatMap((style) => {
|
|
27
|
+
const key = assetId(styleLibraryIdentity(style));
|
|
28
|
+
return key && style.source.id ? [{
|
|
29
|
+
key,
|
|
30
|
+
id: style.source.id
|
|
31
|
+
}] : [];
|
|
32
|
+
});
|
|
33
|
+
const styles = /* @__PURE__ */ new Map();
|
|
34
|
+
if (incoming.length === 0) return styles;
|
|
35
|
+
const unmatched = new Set(incoming.map((style) => style.key));
|
|
36
|
+
const copies = /* @__PURE__ */ new Map();
|
|
37
|
+
for (const style of (targetStyles ?? sharedStyleLayers(target)).values()) {
|
|
38
|
+
const key = assetId(styleLibraryIdentity(style));
|
|
39
|
+
if (!key || !unmatched.delete(key)) continue;
|
|
40
|
+
if (style.source.id) copies.set(key, style.source.id);
|
|
41
|
+
if (unmatched.size === 0) break;
|
|
42
|
+
}
|
|
43
|
+
for (const { key, id } of incoming) {
|
|
44
|
+
const copyId = copies.get(key);
|
|
45
|
+
if (copyId) styles.set(id, copyId);
|
|
46
|
+
}
|
|
47
|
+
return styles;
|
|
48
|
+
}
|
|
49
|
+
/** The library mode a mode stands for: the one it came from, or else itself. */
|
|
50
|
+
function libraryModeOf(mode) {
|
|
51
|
+
return mode.libraryModeId ?? mode.modeId;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Which of `copy`'s modes each of `collection`'s stands for, or undefined when one has none. A mode
|
|
55
|
+
* takes the copy's mode that came from the same library mode; where there is none, as in a copy
|
|
56
|
+
* made before modes kept that link, an unpaired mode with its name, as `pairModes` in Core's
|
|
57
|
+
* library import pairs them.
|
|
58
|
+
*/
|
|
59
|
+
function pairedModes(collection, copy) {
|
|
60
|
+
const unpaired = new Map(copy.modes.map((mode) => [mode.modeId, mode]));
|
|
61
|
+
const paired = /* @__PURE__ */ new Map();
|
|
62
|
+
const pair = (mode, match) => {
|
|
63
|
+
const found = [...unpaired.values()].find(match);
|
|
64
|
+
if (!found) return;
|
|
65
|
+
unpaired.delete(found.modeId);
|
|
66
|
+
paired.set(mode.modeId, found.modeId);
|
|
67
|
+
};
|
|
68
|
+
for (const mode of collection.modes) pair(mode, (candidate) => candidate.libraryModeId === libraryModeOf(mode));
|
|
69
|
+
for (const mode of collection.modes) if (!paired.has(mode.modeId)) pair(mode, (candidate) => candidate.name === mode.name);
|
|
70
|
+
return paired.size === collection.modes.length ? paired : void 0;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Matches the library resources a transfer brings against the copies the target holds.
|
|
74
|
+
* `targetStyles` is the target's `sharedStyleLayers` when the caller has it already; the target
|
|
75
|
+
* is searched for styles only when the transfer brings one.
|
|
76
|
+
*/
|
|
77
|
+
function matchLibraryResources(target, source, targetStyles) {
|
|
78
|
+
const reuse = {
|
|
79
|
+
collections: /* @__PURE__ */ new Map(),
|
|
80
|
+
modes: /* @__PURE__ */ new Map(),
|
|
81
|
+
variables: /* @__PURE__ */ new Map(),
|
|
82
|
+
styles: /* @__PURE__ */ new Map(),
|
|
83
|
+
local: /* @__PURE__ */ new Set()
|
|
84
|
+
};
|
|
85
|
+
const claimed = /* @__PURE__ */ new Set();
|
|
86
|
+
const firstCopy = (item) => {
|
|
87
|
+
const identity = assetId(item);
|
|
88
|
+
if (!identity) return true;
|
|
89
|
+
if (claimed.has(identity)) {
|
|
90
|
+
reuse.local.add(item.id);
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
claimed.add(identity);
|
|
94
|
+
return true;
|
|
95
|
+
};
|
|
96
|
+
const collections = [...target.variableCollections.values()];
|
|
97
|
+
for (const collection of source.collections) {
|
|
98
|
+
if (!firstCopy(collection)) continue;
|
|
99
|
+
const copy = collections.find((candidate) => sameAsset(candidate, collection));
|
|
100
|
+
if (!copy) continue;
|
|
101
|
+
const modes = copy.deleted ? void 0 : pairedModes(collection, copy);
|
|
102
|
+
if (!modes) {
|
|
103
|
+
reuse.local.add(collection.id);
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
reuse.collections.set(collection.id, copy.id);
|
|
107
|
+
for (const [mode, targetMode] of modes) reuse.modes.set(mode, targetMode);
|
|
108
|
+
}
|
|
109
|
+
const variables = [...target.variables.values()];
|
|
110
|
+
for (const variable of source.variables) {
|
|
111
|
+
if (!firstCopy(variable)) continue;
|
|
112
|
+
const copy = variables.find((candidate) => sameAsset(candidate, variable));
|
|
113
|
+
if (!copy) continue;
|
|
114
|
+
if (reuse.collections.get(variable.collectionId) === copy.collectionId && !copy.deleted) reuse.variables.set(variable.id, copy.id);
|
|
115
|
+
else reuse.local.add(variable.id);
|
|
116
|
+
}
|
|
117
|
+
reuse.styles = matchLibraryStyles(target, source.styles, targetStyles);
|
|
118
|
+
return reuse;
|
|
119
|
+
}
|
|
120
|
+
export { libraryModeOf, matchLibraryResources, withoutLibraryKey };
|
|
121
|
+
|
|
122
|
+
//# sourceMappingURL=library.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"library.js","names":[],"sources":["../../src/transfer/library.ts"],"sourcesContent":["import type { SceneGraph } from '../graph'\nimport { sharedStyleLayers } from '../shared-styles'\nimport type { SceneNode, Variable, VariableCollection, VariableCollectionMode } from '../types'\n\n/** A library asset's identity: its key and the version references by key carry with it. */\ninterface LibraryIdentity {\n key?: string\n version?: string\n}\n\nfunction sameAsset(a: LibraryIdentity, b: LibraryIdentity): boolean {\n return !!a.key && a.key === b.key && a.version === b.version\n}\n\n/** One string per library asset, to index copies by; none for an asset without a key. */\nfunction assetId({ key, version }: LibraryIdentity): string | undefined {\n return key ? `${key}\\u0000${version ?? ''}` : undefined\n}\n\n/** A copy without the library key and version it came with: the document's own. */\nexport function withoutLibraryKey<T extends LibraryIdentity>(item: T): T {\n const copy = { ...item }\n delete copy.key\n delete copy.version\n return copy\n}\n\n/** The library key and version a style taken from a library keeps from its file. */\nfunction styleLibraryIdentity(style: SceneNode): LibraryIdentity {\n const { key, version } = style.source.fig.rawNodeFields\n return {\n key: typeof key === 'string' ? key : undefined,\n version: typeof version === 'string' ? version : undefined\n }\n}\n\nfunction matchLibraryStyles(\n target: SceneGraph,\n sourceStyles: Iterable<SceneNode>,\n targetStyles?: ReadonlyMap<string, SceneNode>\n): Map<string, string> {\n const incoming = [...sourceStyles].flatMap((style) => {\n const key = assetId(styleLibraryIdentity(style))\n return key && style.source.id ? [{ key, id: style.source.id }] : []\n })\n const styles = new Map<string, string>()\n if (incoming.length === 0) return styles\n\n const unmatched = new Set(incoming.map((style) => style.key))\n const copies = new Map<string, string>()\n for (const style of (targetStyles ?? sharedStyleLayers(target)).values()) {\n const key = assetId(styleLibraryIdentity(style))\n if (!key || !unmatched.delete(key)) continue\n // Older documents can hold duplicates. Use the first matching copy, as before.\n if (style.source.id) copies.set(key, style.source.id)\n if (unmatched.size === 0) break\n }\n for (const { key, id } of incoming) {\n const copyId = copies.get(key)\n if (copyId) styles.set(id, copyId)\n }\n return styles\n}\n\n/** The library mode a mode stands for: the one it came from, or else itself. */\nexport function libraryModeOf(mode: VariableCollectionMode): string {\n return mode.libraryModeId ?? mode.modeId\n}\n\n/**\n * Which of `copy`'s modes each of `collection`'s stands for, or undefined when one has none. A mode\n * takes the copy's mode that came from the same library mode; where there is none, as in a copy\n * made before modes kept that link, an unpaired mode with its name, as `pairModes` in Core's\n * library import pairs them.\n */\nfunction pairedModes(\n collection: VariableCollection,\n copy: VariableCollection\n): Map<string, string> | undefined {\n const unpaired = new Map(copy.modes.map((mode) => [mode.modeId, mode]))\n const paired = new Map<string, string>()\n const pair = (\n mode: VariableCollectionMode,\n match: (candidate: VariableCollectionMode) => boolean\n ) => {\n const found = [...unpaired.values()].find(match)\n if (!found) return\n unpaired.delete(found.modeId)\n paired.set(mode.modeId, found.modeId)\n }\n for (const mode of collection.modes)\n pair(mode, (candidate) => candidate.libraryModeId === libraryModeOf(mode))\n for (const mode of collection.modes)\n if (!paired.has(mode.modeId)) pair(mode, (candidate) => candidate.name === mode.name)\n return paired.size === collection.modes.length ? paired : undefined\n}\n\n/**\n * How a transfer meets the copies the target already holds of the library resources it brings,\n * so that a document keeps one copy of each library asset, as Figma does: a pasted layer binds\n * to the copy the document has, which the reader would otherwise find twice under one key.\n */\nexport interface LibraryReuse {\n /** Source collections the target holds, by the target collection holding them. */\n collections: Map<string, string>\n /** Modes of those collections, by the target mode each stands for. */\n modes: Map<string, string>\n /** Source variables the target holds, by the target variable. */\n variables: Map<string, string>\n /** Source styles the target holds, by the style ID layers name the target's copy with. */\n styles: Map<string, string>\n /**\n * Library resources the target holds a copy of that cannot take this one's place, such as a\n * collection whose modes do not pair: the transfer makes them its own, without their key.\n */\n local: Set<string>\n}\n\n/**\n * Matches the library resources a transfer brings against the copies the target holds.\n * `targetStyles` is the target's `sharedStyleLayers` when the caller has it already; the target\n * is searched for styles only when the transfer brings one.\n */\nexport function matchLibraryResources(\n target: SceneGraph,\n source: {\n collections: Iterable<VariableCollection>\n variables: Iterable<Variable>\n styles: Iterable<SceneNode>\n },\n targetStyles?: ReadonlyMap<string, SceneNode>\n): LibraryReuse {\n const reuse: LibraryReuse = {\n collections: new Map(),\n modes: new Map(),\n variables: new Map(),\n styles: new Map(),\n local: new Set()\n }\n // A transfer can bring one library asset twice, as a file 0.17 saved can hold it: the first\n // copy is the library's, and the others become the document's own.\n const claimed = new Set<string>()\n const firstCopy = (item: LibraryIdentity & { id: string }): boolean => {\n const identity = assetId(item)\n if (!identity) return true\n if (claimed.has(identity)) {\n reuse.local.add(item.id)\n return false\n }\n claimed.add(identity)\n return true\n }\n const collections = [...target.variableCollections.values()]\n for (const collection of source.collections) {\n if (!firstCopy(collection)) continue\n const copy = collections.find((candidate) => sameAsset(candidate, collection))\n if (!copy) continue\n const modes = copy.deleted ? undefined : pairedModes(collection, copy)\n if (!modes) {\n reuse.local.add(collection.id)\n continue\n }\n reuse.collections.set(collection.id, copy.id)\n for (const [mode, targetMode] of modes) reuse.modes.set(mode, targetMode)\n }\n const variables = [...target.variables.values()]\n for (const variable of source.variables) {\n if (!firstCopy(variable)) continue\n const copy = variables.find((candidate) => sameAsset(candidate, variable))\n if (!copy) continue\n if (reuse.collections.get(variable.collectionId) === copy.collectionId && !copy.deleted)\n reuse.variables.set(variable.id, copy.id)\n else reuse.local.add(variable.id)\n }\n reuse.styles = matchLibraryStyles(target, source.styles, targetStyles)\n return reuse\n}\n"],"mappings":"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"}
|
package/dist/transfer/nodes.d.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { ComponentPropertyType, SceneNode } from "../types.js";
|
|
2
2
|
import { VariableTransferReferences } from "./variables.js";
|
|
3
|
-
|
|
4
|
-
interface NodeTransferReferences extends VariableTransferReferences {
|
|
3
|
+
export interface NodeTransferReferences extends VariableTransferReferences {
|
|
5
4
|
nodes: ReadonlyMap<string, string>;
|
|
6
5
|
styles: ReadonlyMap<string, string>;
|
|
7
6
|
properties: ReadonlyMap<string, string>;
|
|
8
7
|
propertyTypes: ReadonlyMap<string, ComponentPropertyType>;
|
|
9
8
|
}
|
|
10
9
|
/** Prepare runtime references without rewriting original format identities or ordinary text. */
|
|
11
|
-
declare function prepareNodeTransfer(source: SceneNode, refs: NodeTransferReferences): Partial<SceneNode>;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { NodeTransferReferences, prepareNodeTransfer };
|
|
10
|
+
export declare function prepareNodeTransfer(source: SceneNode, refs: NodeTransferReferences): Partial<SceneNode>;
|
|
14
11
|
//# sourceMappingURL=nodes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.d.ts","names":[],"sources":["../../src/transfer/nodes.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"nodes.d.ts","names":[],"sources":["../../src/transfer/nodes.ts"],"mappings":";;iBA+CiB,+BAA+B;EAC9C,OAAO;EACP,QAAQ;EACR,YAAY;EACZ,eAAe,oBAAoB;;;wBAIrB,oBACd,QAAQ,WACR,MAAM,yBACL,QAAQ"}
|
package/dist/transfer/nodes.js
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readBehaviour, withBehaviour } from "../behaviours/model.js";
|
|
2
|
+
import { mapTransitionVariables, transitionVariableIds } from "../behaviours/transition.js";
|
|
2
3
|
import { cloneNodeProps } from "../copy.js";
|
|
3
|
-
import {
|
|
4
|
+
import { overriddenBindingField, remapInstanceOverrideState } from "../instances/overrides.js";
|
|
5
|
+
import { keyframeVariableIds, mapKeyframeVariables } from "../motion/variables.js";
|
|
4
6
|
import { referencedStyleIds } from "../shared-styles.js";
|
|
7
|
+
import { mapSlideVariables, slideVariableIds } from "../slides/motion.js";
|
|
8
|
+
import { styleRunReferences } from "../text/references.js";
|
|
5
9
|
import { requireTransferReference } from "./references.js";
|
|
6
10
|
import { remappedResourceReferences } from "./resources.js";
|
|
7
|
-
|
|
11
|
+
// src/transfer/nodes.ts
|
|
8
12
|
function semanticTransferReferences(node) {
|
|
9
13
|
const runs = styleRunReferences(node.styleRuns);
|
|
14
|
+
const behaviour = readBehaviour(node);
|
|
10
15
|
return [
|
|
11
16
|
...node.componentId ? [node.componentId] : [],
|
|
12
17
|
...Object.values(node.boundVariables),
|
|
18
|
+
...behaviour ? transitionVariableIds(behaviour) : [],
|
|
19
|
+
...slideVariableIds(node),
|
|
20
|
+
...keyframeVariableIds(node),
|
|
13
21
|
...runs.variables,
|
|
14
22
|
...referencedStyleIds(node),
|
|
15
23
|
...Object.entries(node.componentPropertyAssignments).flatMap(([id, value]) => [id, value]),
|
|
@@ -63,10 +71,13 @@ function prepareNodeTransfer(source, refs) {
|
|
|
63
71
|
}] : [];
|
|
64
72
|
});
|
|
65
73
|
result.componentPropertyAssignments = values(source.componentPropertyAssignments);
|
|
74
|
+
const behaviour = readBehaviour(source);
|
|
75
|
+
if (behaviour && transitionVariableIds(behaviour).length > 0) result.pluginData = withBehaviour(source, mapTransitionVariables(behaviour, (id) => refs.variables.get(id)));
|
|
76
|
+
if (slideVariableIds(source).length > 0) Object.assign(result, mapSlideVariables(source, (id) => refs.variables.get(id)));
|
|
77
|
+
if (keyframeVariableIds(source).length > 0) Object.assign(result, mapKeyframeVariables(source, (id) => refs.variables.get(id)));
|
|
66
78
|
result.componentPropertyValues = { ...source.componentPropertyValues };
|
|
67
79
|
return result;
|
|
68
80
|
}
|
|
69
|
-
//#endregion
|
|
70
81
|
export { prepareNodeTransfer, semanticTransferReferences };
|
|
71
82
|
|
|
72
83
|
//# sourceMappingURL=nodes.js.map
|