@open-pencil/scene-graph 0.18.0-beta.1 → 0.18.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arrow-caps.d.ts +14 -17
- package/dist/arrow-caps.d.ts.map +1 -1
- package/dist/arrow-caps.js +1 -2
- package/dist/asset-keys.d.ts +5 -8
- package/dist/asset-keys.d.ts.map +1 -1
- package/dist/asset-keys.js +2 -3
- package/dist/behaviours/index.d.ts +4 -3
- package/dist/behaviours/index.js +6 -5
- package/dist/behaviours/kinds.d.ts +38 -15
- package/dist/behaviours/kinds.d.ts.map +1 -1
- package/dist/behaviours/kinds.js +119 -4
- package/dist/behaviours/kinds.js.map +1 -1
- package/dist/behaviours/layers.d.ts +3 -6
- package/dist/behaviours/layers.d.ts.map +1 -1
- package/dist/behaviours/layers.js +1 -2
- package/dist/behaviours/listing.d.ts +58 -0
- package/dist/behaviours/listing.d.ts.map +1 -0
- package/dist/behaviours/listing.js +98 -0
- package/dist/behaviours/listing.js.map +1 -0
- package/dist/behaviours/model.d.ts +19 -16
- package/dist/behaviours/model.d.ts.map +1 -1
- package/dist/behaviours/model.js +14 -6
- package/dist/behaviours/model.js.map +1 -1
- package/dist/behaviours/schema.d.ts +16 -18
- package/dist/behaviours/schema.d.ts.map +1 -1
- package/dist/behaviours/schema.js +2 -3
- package/dist/behaviours/spec.d.ts +3 -6
- package/dist/behaviours/spec.d.ts.map +1 -1
- package/dist/behaviours/spec.js +4 -5
- package/dist/behaviours/transition.d.ts +6 -9
- package/dist/behaviours/transition.d.ts.map +1 -1
- package/dist/behaviours/transition.js +1 -2
- package/dist/bindings.js +2 -3
- package/dist/blur.d.ts +35 -0
- package/dist/blur.d.ts.map +1 -0
- package/dist/blur.js +69 -0
- package/dist/blur.js.map +1 -0
- package/dist/buffered-events.d.ts +3 -6
- package/dist/buffered-events.d.ts.map +1 -1
- package/dist/buffered-events.js +1 -2
- package/dist/buffered-events.js.map +1 -1
- package/dist/checkpoint.d.ts +3 -6
- package/dist/checkpoint.d.ts.map +1 -1
- package/dist/checkpoint.js +2 -3
- package/dist/clipping.d.ts +4 -7
- package/dist/clipping.d.ts.map +1 -1
- package/dist/clipping.js +4 -16
- package/dist/clipping.js.map +1 -1
- package/dist/color/contrast.d.ts +4 -7
- package/dist/color/contrast.d.ts.map +1 -1
- package/dist/color/contrast.js +2 -3
- package/dist/color/index.d.ts +13 -15
- package/dist/color/index.d.ts.map +1 -1
- package/dist/color/index.js +3 -4
- package/dist/color/management.d.ts +11 -14
- package/dist/color/management.d.ts.map +1 -1
- package/dist/color/management.js +2 -3
- package/dist/color/normalize.d.ts +1 -4
- package/dist/color/normalize.d.ts.map +1 -1
- package/dist/color/normalize.js +1 -2
- package/dist/color/okhcl.d.ts +16 -19
- package/dist/color/okhcl.d.ts.map +1 -1
- package/dist/color/okhcl.js +3 -4
- package/dist/color/schema.d.ts +4 -7
- package/dist/color/schema.d.ts.map +1 -1
- package/dist/color/schema.js +2 -3
- package/dist/comments/document.d.ts +3 -6
- package/dist/comments/document.d.ts.map +1 -1
- package/dist/comments/document.js +1 -2
- package/dist/comments/index.js +2 -2
- package/dist/comments/list.d.ts +5 -8
- package/dist/comments/list.d.ts.map +1 -1
- package/dist/comments/list.js +1 -2
- package/dist/comments/merge.d.ts +2 -5
- package/dist/comments/merge.d.ts.map +1 -1
- package/dist/comments/merge.js +1 -2
- package/dist/comments/schema.d.ts +2 -5
- package/dist/comments/schema.d.ts.map +1 -1
- package/dist/comments/schema.js +1 -2
- package/dist/comments/threads.d.ts +16 -19
- package/dist/comments/threads.d.ts.map +1 -1
- package/dist/comments/threads.js +8 -3
- package/dist/comments/threads.js.map +1 -1
- package/dist/components/exposure.d.ts +4 -7
- package/dist/components/exposure.d.ts.map +1 -1
- package/dist/components/exposure.js +1 -2
- package/dist/components/properties.d.ts +13 -16
- package/dist/components/properties.d.ts.map +1 -1
- package/dist/components/properties.js +3 -4
- package/dist/components/variants.d.ts +5 -8
- package/dist/components/variants.d.ts.map +1 -1
- package/dist/components/variants.js +1 -2
- package/dist/connectors/controls.d.ts +6 -9
- package/dist/connectors/controls.d.ts.map +1 -1
- package/dist/connectors/controls.js +2 -3
- package/dist/connectors/create.d.ts +3 -6
- package/dist/connectors/create.d.ts.map +1 -1
- package/dist/connectors/create.js +2 -3
- package/dist/connectors/elbow.js +0 -1
- package/dist/connectors/gaps.d.ts +1 -4
- package/dist/connectors/gaps.d.ts.map +1 -1
- package/dist/connectors/gaps.js +1 -2
- package/dist/connectors/hit.d.ts +1 -4
- package/dist/connectors/hit.d.ts.map +1 -1
- package/dist/connectors/hit.js +3 -4
- package/dist/connectors/index.d.ts +3 -3
- package/dist/connectors/index.js +6 -6
- package/dist/connectors/label.d.ts +4 -7
- package/dist/connectors/label.d.ts.map +1 -1
- package/dist/connectors/label.js +1 -2
- package/dist/connectors/layout.d.ts +8 -10
- package/dist/connectors/layout.d.ts.map +1 -1
- package/dist/connectors/layout.js +12 -10
- package/dist/connectors/layout.js.map +1 -1
- package/dist/connectors/pieces.d.ts +2 -5
- package/dist/connectors/pieces.d.ts.map +1 -1
- package/dist/connectors/pieces.js +3 -4
- package/dist/connectors/pieces.js.map +1 -1
- package/dist/connectors/route.d.ts +2 -5
- package/dist/connectors/route.d.ts.map +1 -1
- package/dist/connectors/route.js +4 -5
- package/dist/connectors/sides.d.ts +3 -6
- package/dist/connectors/sides.d.ts.map +1 -1
- package/dist/connectors/sides.js +2 -3
- package/dist/connectors/sublayers.d.ts +21 -24
- package/dist/connectors/sublayers.d.ts.map +1 -1
- package/dist/connectors/sublayers.js +3 -3
- package/dist/connectors/sublayers.js.map +1 -1
- package/dist/constants.d.ts +13 -16
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -2
- package/dist/constraints.d.ts +6 -8
- package/dist/constraints.d.ts.map +1 -1
- package/dist/constraints.js +1 -2
- package/dist/coordinate.d.ts +27 -29
- package/dist/coordinate.d.ts.map +1 -1
- package/dist/coordinate.js +19 -38
- package/dist/coordinate.js.map +1 -1
- package/dist/copy.d.ts +31 -25
- package/dist/copy.d.ts.map +1 -1
- package/dist/copy.js +13 -5
- package/dist/copy.js.map +1 -1
- package/dist/corners.d.ts +8 -10
- package/dist/corners.d.ts.map +1 -1
- package/dist/corners.js +1 -2
- package/dist/css/blend.d.ts +1 -4
- package/dist/css/blend.d.ts.map +1 -1
- package/dist/css/blend.js +1 -2
- package/dist/css/grid.d.ts +1 -4
- package/dist/css/grid.d.ts.map +1 -1
- package/dist/css/grid.js +4 -5
- package/dist/css/index.js +2 -2
- package/dist/css/layout.d.ts +7 -10
- package/dist/css/layout.d.ts.map +1 -1
- package/dist/css/layout.js +2 -3
- package/dist/css/motion.d.ts +2 -5
- package/dist/css/motion.d.ts.map +1 -1
- package/dist/css/motion.js +2 -3
- package/dist/css/shadows.d.ts +1 -4
- package/dist/css/shadows.d.ts.map +1 -1
- package/dist/css/shadows.js +3 -4
- package/dist/css/text.d.ts +8 -11
- package/dist/css/text.d.ts.map +1 -1
- package/dist/css/text.js +1 -2
- package/dist/css/transform.d.ts +6 -9
- package/dist/css/transform.d.ts.map +1 -1
- package/dist/css/transform.js +2 -3
- package/dist/css/values.d.ts +9 -12
- package/dist/css/values.d.ts.map +1 -1
- package/dist/css/values.js +2 -3
- package/dist/cubic.d.ts +11 -5
- package/dist/cubic.d.ts.map +1 -1
- package/dist/cubic.js +71 -3
- package/dist/cubic.js.map +1 -1
- package/dist/events.js +1 -2
- package/dist/export-format.d.ts +5 -8
- package/dist/export-format.d.ts.map +1 -1
- package/dist/export-format.js +4 -3
- package/dist/export-format.js.map +1 -1
- package/dist/export-scale.d.ts +4 -7
- package/dist/export-scale.d.ts.map +1 -1
- package/dist/export-scale.js +1 -2
- package/dist/fields/appearance.d.ts +3 -6
- package/dist/fields/appearance.d.ts.map +1 -1
- package/dist/fields/appearance.js +1 -2
- package/dist/fields/geometry.d.ts +2 -5
- package/dist/fields/geometry.d.ts.map +1 -1
- package/dist/fields/geometry.js +1 -2
- package/dist/fields/index.js +1 -1
- package/dist/fields/layout.d.ts +4 -7
- package/dist/fields/layout.d.ts.map +1 -1
- package/dist/fields/layout.js +1 -2
- package/dist/fields/text.d.ts +5 -8
- package/dist/fields/text.d.ts.map +1 -1
- package/dist/fields/text.js +1 -2
- package/dist/fig-compression.d.ts +3 -6
- package/dist/fig-compression.d.ts.map +1 -1
- package/dist/fig-compression.js +1 -2
- package/dist/figjam/index.js +1 -1
- package/dist/figjam/palette.d.ts +21 -23
- package/dist/figjam/palette.d.ts.map +1 -1
- package/dist/figjam/palette.js +3 -4
- package/dist/figjam/text.d.ts +10 -13
- package/dist/figjam/text.d.ts.map +1 -1
- package/dist/figjam/text.js +1 -2
- package/dist/font-style.d.ts +18 -18
- package/dist/font-style.d.ts.map +1 -1
- package/dist/font-style.js +5 -5
- package/dist/font-style.js.map +1 -1
- package/dist/generated/index.d.ts +32 -16
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/generated/index.js +37 -9
- package/dist/generated/index.js.map +1 -1
- package/dist/generated/kind.d.ts +17 -6
- package/dist/generated/kind.d.ts.map +1 -1
- package/dist/generated/shape-with-text.d.ts +10 -13
- package/dist/generated/shape-with-text.d.ts.map +1 -1
- package/dist/generated/shape-with-text.js +3 -3
- package/dist/generated/shape-with-text.js.map +1 -1
- package/dist/generated/spec.d.ts +45 -0
- package/dist/generated/spec.d.ts.map +1 -0
- package/dist/generated/spec.js +281 -0
- package/dist/generated/spec.js.map +1 -0
- package/dist/generated/sticky.d.ts +23 -26
- package/dist/generated/sticky.d.ts.map +1 -1
- package/dist/generated/sticky.js +4 -4
- package/dist/generated/sticky.js.map +1 -1
- package/dist/geometry.d.ts +43 -69
- package/dist/geometry.d.ts.map +1 -1
- package/dist/geometry.js +44 -76
- package/dist/geometry.js.map +1 -1
- package/dist/gradient.d.ts +15 -18
- package/dist/gradient.d.ts.map +1 -1
- package/dist/gradient.js +1 -2
- package/dist/graph.d.ts +4 -7
- package/dist/graph.d.ts.map +1 -1
- package/dist/graph.js +26 -19
- package/dist/graph.js.map +1 -1
- package/dist/group-bounds.d.ts +10 -12
- package/dist/group-bounds.d.ts.map +1 -1
- package/dist/group-bounds.js +5 -6
- package/dist/guides.d.ts +5 -8
- package/dist/guides.d.ts.map +1 -1
- package/dist/guides.js +2 -3
- package/dist/hit-test.d.ts +20 -12
- package/dist/hit-test.d.ts.map +1 -1
- package/dist/hit-test.js +51 -31
- package/dist/hit-test.js.map +1 -1
- package/dist/icons/fit.d.ts +2 -4
- package/dist/icons/fit.d.ts.map +1 -1
- package/dist/icons/fit.js +1 -2
- package/dist/icons/glyph.d.ts +3 -5
- package/dist/icons/glyph.d.ts.map +1 -1
- package/dist/icons/glyph.js +3 -4
- package/dist/icons/index.d.ts +1 -1
- package/dist/icons/index.js +2 -2
- package/dist/icons/model.d.ts +8 -11
- package/dist/icons/model.d.ts.map +1 -1
- package/dist/icons/model.js +1 -2
- package/dist/icons/schema.d.ts +8 -11
- package/dist/icons/schema.d.ts.map +1 -1
- package/dist/icons/schema.js +1 -2
- package/dist/ids.d.ts +2 -5
- package/dist/ids.d.ts.map +1 -1
- package/dist/ids.js +3 -4
- package/dist/images.d.ts +20 -21
- package/dist/images.d.ts.map +1 -1
- package/dist/images.js +7 -6
- package/dist/images.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/instances/assignments.js +1 -2
- package/dist/instances/content-marks.js +98 -0
- package/dist/instances/content-marks.js.map +1 -0
- package/dist/instances/content-size.js +3 -4
- package/dist/instances/copies.js +2 -3
- package/dist/instances/cycles.d.ts +3 -6
- package/dist/instances/cycles.d.ts.map +1 -1
- package/dist/instances/cycles.js +1 -2
- package/dist/instances/deleted.d.ts +23 -0
- package/dist/instances/deleted.d.ts.map +1 -0
- package/dist/instances/deleted.js +82 -0
- package/dist/instances/deleted.js.map +1 -0
- package/dist/instances/fields.d.ts +5 -8
- package/dist/instances/fields.d.ts.map +1 -1
- package/dist/instances/fields.js +9 -7
- package/dist/instances/fields.js.map +1 -1
- package/dist/instances/index.d.ts +21 -20
- package/dist/instances/index.d.ts.map +1 -1
- package/dist/instances/index.js +69 -12
- package/dist/instances/index.js.map +1 -1
- package/dist/instances/kept-overrides.js +4 -5
- package/dist/instances/lookup.d.ts +17 -0
- package/dist/instances/lookup.d.ts.map +1 -0
- package/dist/instances/lookup.js +48 -0
- package/dist/instances/lookup.js.map +1 -0
- package/dist/instances/main-component.d.ts +2 -5
- package/dist/instances/main-component.d.ts.map +1 -1
- package/dist/instances/main-component.js +1 -2
- package/dist/instances/matching.js +1 -2
- package/dist/instances/overrides.d.ts +23 -26
- package/dist/instances/overrides.d.ts.map +1 -1
- package/dist/instances/overrides.js +1 -2
- package/dist/instances/placement.js +3 -4
- package/dist/instances/protection.js +3 -4
- package/dist/instances/source-walk.js +1 -2
- package/dist/instances/swap.js +7 -8
- package/dist/instances/sync.js +27 -14
- package/dist/instances/sync.js.map +1 -1
- package/dist/instances/vector-geometry.js +2 -3
- package/dist/layout/aspect-ratio.d.ts +7 -9
- package/dist/layout/aspect-ratio.d.ts.map +1 -1
- package/dist/layout/aspect-ratio.js +1 -2
- package/dist/layout/flow.d.ts +3 -6
- package/dist/layout/flow.d.ts.map +1 -1
- package/dist/layout/flow.js +6 -5
- package/dist/layout/flow.js.map +1 -1
- package/dist/layout/guides.d.ts +13 -16
- package/dist/layout/guides.d.ts.map +1 -1
- package/dist/layout/guides.js +4 -5
- package/dist/layout/guides.js.map +1 -1
- package/dist/layout/index.d.ts +3 -2
- package/dist/layout/index.js +6 -5
- package/dist/layout/keywords.d.ts +7 -9
- package/dist/layout/keywords.d.ts.map +1 -1
- package/dist/layout/keywords.js +1 -2
- package/dist/layout/limits.d.ts +13 -16
- package/dist/layout/limits.d.ts.map +1 -1
- package/dist/layout/limits.js +1 -2
- package/dist/layout/sizing.d.ts +11 -13
- package/dist/layout/sizing.d.ts.map +1 -1
- package/dist/layout/sizing.js +1 -2
- package/dist/layout/spacing.d.ts +2 -5
- package/dist/layout/spacing.d.ts.map +1 -1
- package/dist/layout/spacing.js +1 -2
- package/dist/layout/stacking.d.ts +8 -0
- package/dist/layout/stacking.d.ts.map +1 -0
- package/dist/layout/stacking.js +12 -0
- package/dist/layout/stacking.js.map +1 -0
- package/dist/layout/strokes.d.ts +1 -4
- package/dist/layout/strokes.d.ts.map +1 -1
- package/dist/layout/strokes.js +1 -2
- package/dist/layout/writes.js +1 -2
- package/dist/layout/writes.js.map +1 -1
- package/dist/masks.d.ts +4 -7
- package/dist/masks.d.ts.map +1 -1
- package/dist/masks.js +1 -2
- package/dist/matrix.d.ts +3 -4
- package/dist/matrix.d.ts.map +1 -1
- package/dist/matrix.js +11 -3
- package/dist/matrix.js.map +1 -1
- package/dist/mesh/geometry.d.ts +21 -24
- package/dist/mesh/geometry.d.ts.map +1 -1
- package/dist/mesh/geometry.js +3 -14
- package/dist/mesh/geometry.js.map +1 -1
- package/dist/mesh/index.d.ts +1 -1
- package/dist/mesh/index.js +1 -1
- package/dist/mesh/model.d.ts +5 -8
- package/dist/mesh/model.d.ts.map +1 -1
- package/dist/mesh/model.js +2 -3
- package/dist/mesh/schema.d.ts +10 -13
- package/dist/mesh/schema.d.ts.map +1 -1
- package/dist/mesh/schema.js +3 -4
- package/dist/motion/apply.d.ts +42 -0
- package/dist/motion/apply.d.ts.map +1 -0
- package/dist/motion/apply.js +98 -0
- package/dist/motion/apply.js.map +1 -0
- package/dist/motion/edit.d.ts +53 -0
- package/dist/motion/edit.d.ts.map +1 -0
- package/dist/motion/edit.js +125 -0
- package/dist/motion/edit.js.map +1 -0
- package/dist/motion/effects.js +86 -0
- package/dist/motion/effects.js.map +1 -0
- package/dist/motion/evaluate.d.ts +33 -0
- package/dist/motion/evaluate.d.ts.map +1 -0
- package/dist/motion/evaluate.js +160 -0
- package/dist/motion/evaluate.js.map +1 -0
- package/dist/motion/fields.d.ts +69 -0
- package/dist/motion/fields.d.ts.map +1 -0
- package/dist/motion/fields.js +132 -0
- package/dist/motion/fields.js.map +1 -0
- package/dist/motion/index.d.ts +16 -0
- package/dist/motion/index.js +15 -0
- package/dist/motion/keyable.d.ts +32 -0
- package/dist/motion/keyable.d.ts.map +1 -0
- package/dist/motion/keyable.js +120 -0
- package/dist/motion/keyable.js.map +1 -0
- package/dist/motion/outline.d.ts +35 -0
- package/dist/motion/outline.d.ts.map +1 -0
- package/dist/motion/outline.js +59 -0
- package/dist/motion/outline.js.map +1 -0
- package/dist/motion/presets/index.d.ts +20 -0
- package/dist/motion/presets/index.d.ts.map +1 -0
- package/dist/motion/presets/index.js +166 -0
- package/dist/motion/presets/index.js.map +1 -0
- package/dist/motion/presets/settings.d.ts +43 -0
- package/dist/motion/presets/settings.d.ts.map +1 -0
- package/dist/motion/presets/settings.js +254 -0
- package/dist/motion/presets/settings.js.map +1 -0
- package/dist/motion/presets/stagger.d.ts +69 -0
- package/dist/motion/presets/stagger.d.ts.map +1 -0
- package/dist/motion/presets/stagger.js +185 -0
- package/dist/motion/presets/stagger.js.map +1 -0
- package/dist/motion/schema.d.ts +185 -0
- package/dist/motion/schema.d.ts.map +1 -0
- package/dist/motion/schema.js +62 -0
- package/dist/motion/schema.js.map +1 -0
- package/dist/motion/segment.d.ts +25 -0
- package/dist/motion/segment.d.ts.map +1 -0
- package/dist/motion/segment.js +73 -0
- package/dist/motion/segment.js.map +1 -0
- package/dist/motion/spec.d.ts +26 -0
- package/dist/motion/spec.d.ts.map +1 -0
- package/dist/motion/spec.js +175 -0
- package/dist/motion/spec.js.map +1 -0
- package/dist/motion/timeline.d.ts +16 -0
- package/dist/motion/timeline.d.ts.map +1 -0
- package/dist/motion/timeline.js +53 -0
- package/dist/motion/timeline.js.map +1 -0
- package/dist/motion/types.d.ts +49 -0
- package/dist/motion/types.d.ts.map +1 -0
- package/dist/motion/variables.d.ts +9 -0
- package/dist/motion/variables.d.ts.map +1 -0
- package/dist/motion/variables.js +25 -0
- package/dist/motion/variables.js.map +1 -0
- package/dist/mutation-impact.d.ts +7 -10
- package/dist/mutation-impact.d.ts.map +1 -1
- package/dist/mutation-impact.js +2 -3
- package/dist/node-defaults.d.ts +14 -15
- package/dist/node-defaults.d.ts.map +1 -1
- package/dist/node-defaults.js +133 -51
- package/dist/node-defaults.js.map +1 -1
- package/dist/order-keys.d.ts +8 -9
- package/dist/order-keys.d.ts.map +1 -1
- package/dist/order-keys.js +10 -2
- package/dist/order-keys.js.map +1 -1
- package/dist/outline/flatten.d.ts +3 -6
- package/dist/outline/flatten.d.ts.map +1 -1
- package/dist/outline/flatten.js +3 -4
- package/dist/outline/heads.js +1 -2
- package/dist/outline/hit.d.ts +2 -5
- package/dist/outline/hit.d.ts.map +1 -1
- package/dist/outline/hit.js +5 -6
- package/dist/outline/index.js +3 -3
- package/dist/outline/point.d.ts +4 -7
- package/dist/outline/point.d.ts.map +1 -1
- package/dist/outline/point.js +2 -3
- package/dist/outline/shapes.d.ts +4 -7
- package/dist/outline/shapes.d.ts.map +1 -1
- package/dist/outline/shapes.js +2 -3
- package/dist/paints/index.d.ts +2 -2
- package/dist/paints/index.js +4 -4
- package/dist/paints/pattern.d.ts +6 -9
- package/dist/paints/pattern.d.ts.map +1 -1
- package/dist/paints/pattern.js +1 -2
- package/dist/paints/schema.d.ts +4 -7
- package/dist/paints/schema.d.ts.map +1 -1
- package/dist/paints/schema.js +3 -4
- package/dist/paints/shows.d.ts +3 -6
- package/dist/paints/shows.d.ts.map +1 -1
- package/dist/paints/shows.js +1 -2
- package/dist/paints/solid.d.ts +1 -4
- package/dist/paints/solid.d.ts.map +1 -1
- package/dist/paints/solid.js +1 -2
- package/dist/paints/stills.d.ts +17 -17
- package/dist/paints/stills.d.ts.map +1 -1
- package/dist/paints/stills.js +22 -18
- package/dist/paints/stills.js.map +1 -1
- package/dist/parse-path.d.ts +12 -9
- package/dist/parse-path.d.ts.map +1 -1
- package/dist/parse-path.js +13 -3
- package/dist/parse-path.js.map +1 -1
- package/dist/paths/arc.d.ts +6 -9
- package/dist/paths/arc.d.ts.map +1 -1
- package/dist/paths/arc.js +1 -2
- package/dist/paths/index.d.ts +1 -1
- package/dist/paths/index.js +1 -1
- package/dist/paths/network.d.ts +13 -16
- package/dist/paths/network.d.ts.map +1 -1
- package/dist/paths/network.js +1 -2
- package/dist/paths/sink.d.ts +5 -8
- package/dist/paths/sink.d.ts.map +1 -1
- package/dist/paths/sink.js +1 -2
- package/dist/paths/smooth-corners.d.ts +3 -6
- package/dist/paths/smooth-corners.d.ts.map +1 -1
- package/dist/paths/smooth-corners.js +1 -2
- package/dist/plugin-data/field.d.ts +15 -18
- package/dist/plugin-data/field.d.ts.map +1 -1
- package/dist/plugin-data/field.js +1 -2
- package/dist/plugin-data/fields.d.ts +37 -11
- package/dist/plugin-data/fields.d.ts.map +1 -1
- package/dist/plugin-data/fields.js +35 -10
- package/dist/plugin-data/fields.js.map +1 -1
- package/dist/plugin-data/index.d.ts +2 -2
- package/dist/plugin-data/index.js +2 -2
- package/dist/polygon.d.ts +8 -8
- package/dist/polygon.d.ts.map +1 -1
- package/dist/polygon.js +7 -7
- package/dist/polygon.js.map +1 -1
- package/dist/preview.d.ts +3 -5
- package/dist/preview.d.ts.map +1 -1
- package/dist/preview.js +2 -3
- package/dist/primitives/index.d.ts +7 -9
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +1 -2
- package/dist/primitives/schema.d.ts +3 -6
- package/dist/primitives/schema.d.ts.map +1 -1
- package/dist/primitives/schema.js +1 -2
- package/dist/resize.d.ts +13 -15
- package/dist/resize.d.ts.map +1 -1
- package/dist/resize.js +5 -6
- package/dist/scaling/node.d.ts +2 -5
- package/dist/scaling/node.d.ts.map +1 -1
- package/dist/scaling/node.js +4 -5
- package/dist/scaling/snapshot.d.ts +5 -8
- package/dist/scaling/snapshot.d.ts.map +1 -1
- package/dist/scaling/snapshot.js +1 -2
- package/dist/scaling/tree.d.ts +6 -9
- package/dist/scaling/tree.d.ts.map +1 -1
- package/dist/scaling/tree.js +2 -3
- package/dist/shaders/index.d.ts +2 -2
- package/dist/shaders/index.js +2 -2
- package/dist/shaders/model.d.ts +54 -13
- package/dist/shaders/model.d.ts.map +1 -1
- package/dist/shaders/model.js +98 -7
- package/dist/shaders/model.js.map +1 -1
- package/dist/shaders/schema.d.ts +15 -8
- package/dist/shaders/schema.d.ts.map +1 -1
- package/dist/shaders/schema.js +11 -2
- package/dist/shaders/schema.js.map +1 -1
- package/dist/shape-with-text/document.js +9 -21
- package/dist/shape-with-text/document.js.map +1 -1
- package/dist/shape-with-text/fit.d.ts +6 -9
- package/dist/shape-with-text/fit.d.ts.map +1 -1
- package/dist/shape-with-text/fit.js +1 -2
- package/dist/shape-with-text/geometry.d.ts +7 -10
- package/dist/shape-with-text/geometry.d.ts.map +1 -1
- package/dist/shape-with-text/geometry.js +4 -7
- package/dist/shape-with-text/geometry.js.map +1 -1
- package/dist/shape-with-text/index.js +1 -1
- package/dist/shape-with-text/kinds.d.ts +4 -7
- package/dist/shape-with-text/kinds.d.ts.map +1 -1
- package/dist/shape-with-text/kinds.js +1 -2
- package/dist/shared-style-index.d.ts +2 -4
- package/dist/shared-style-index.d.ts.map +1 -1
- package/dist/shared-style-index.js +1 -2
- package/dist/shared-style-index.js.map +1 -1
- package/dist/shared-styles.d.ts +17 -19
- package/dist/shared-styles.d.ts.map +1 -1
- package/dist/shared-styles.js +5 -6
- package/dist/slides/drop.d.ts +5 -8
- package/dist/slides/drop.d.ts.map +1 -1
- package/dist/slides/drop.js +1 -2
- package/dist/slides/index.d.ts +19 -19
- package/dist/slides/index.d.ts.map +1 -1
- package/dist/slides/index.js +8 -5
- package/dist/slides/index.js.map +1 -1
- package/dist/slides/motion.d.ts +32 -16
- package/dist/slides/motion.d.ts.map +1 -1
- package/dist/slides/motion.js +30 -5
- package/dist/slides/motion.js.map +1 -1
- package/dist/slides/playback.d.ts +24 -21
- package/dist/slides/playback.d.ts.map +1 -1
- package/dist/slides/playback.js +45 -13
- package/dist/slides/playback.js.map +1 -1
- package/dist/slides/types.d.ts +8 -11
- package/dist/slides/types.d.ts.map +1 -1
- package/dist/slides/types.js +1 -2
- package/dist/slots/authoring.d.ts +6 -9
- package/dist/slots/authoring.d.ts.map +1 -1
- package/dist/slots/authoring.js +2 -3
- package/dist/slots/content.d.ts +5 -8
- package/dist/slots/content.d.ts.map +1 -1
- package/dist/slots/content.js +4 -5
- package/dist/slots/frames.d.ts +7 -9
- package/dist/slots/frames.d.ts.map +1 -1
- package/dist/slots/frames.js +3 -4
- package/dist/slots/frames.js.map +1 -1
- package/dist/slots/index.js +1 -1
- package/dist/slots/limits.d.ts +4 -7
- package/dist/slots/limits.d.ts.map +1 -1
- package/dist/slots/limits.js +1 -2
- package/dist/snap.d.ts +4 -7
- package/dist/snap.d.ts.map +1 -1
- package/dist/snap.js +7 -8
- package/dist/source-metadata.d.ts +1 -4
- package/dist/source-metadata.d.ts.map +1 -1
- package/dist/source-metadata.js +1 -2
- package/dist/specs/index.d.ts +3 -0
- package/dist/specs/index.js +3 -0
- package/dist/specs/model.d.ts +20 -0
- package/dist/specs/model.d.ts.map +1 -0
- package/dist/specs/model.js +32 -0
- package/dist/specs/model.js.map +1 -0
- package/dist/specs/schema.d.ts +24 -0
- package/dist/specs/schema.d.ts.map +1 -0
- package/dist/specs/schema.js +32 -0
- package/dist/specs/schema.js.map +1 -0
- package/dist/statuses/impact.d.ts +2 -5
- package/dist/statuses/impact.d.ts.map +1 -1
- package/dist/statuses/impact.js +2 -3
- package/dist/statuses/index.d.ts +1 -1
- package/dist/statuses/index.js +2 -2
- package/dist/statuses/node.d.ts +4 -7
- package/dist/statuses/node.d.ts.map +1 -1
- package/dist/statuses/node.js +1 -2
- package/dist/statuses/schema.d.ts +7 -9
- package/dist/statuses/schema.d.ts.map +1 -1
- package/dist/statuses/schema.js +1 -2
- package/dist/statuses/workflow.d.ts +9 -12
- package/dist/statuses/workflow.d.ts.map +1 -1
- package/dist/statuses/workflow.js +1 -2
- package/dist/strokes.d.ts +8 -10
- package/dist/strokes.d.ts.map +1 -1
- package/dist/strokes.js +2 -3
- package/dist/text/auto-resize.d.ts +4 -6
- package/dist/text/auto-resize.d.ts.map +1 -1
- package/dist/text/auto-resize.js +1 -2
- package/dist/text/direction.d.ts +5 -8
- package/dist/text/direction.d.ts.map +1 -1
- package/dist/text/direction.js +1 -2
- package/dist/text/index.d.ts +2 -2
- package/dist/text/index.js +5 -5
- package/dist/text/lengths.d.ts +9 -12
- package/dist/text/lengths.d.ts.map +1 -1
- package/dist/text/lengths.js +1 -2
- package/dist/text/lists.d.ts +17 -13
- package/dist/text/lists.d.ts.map +1 -1
- package/dist/text/lists.js +15 -4
- package/dist/text/lists.js.map +1 -1
- package/dist/text/name.d.ts +4 -7
- package/dist/text/name.d.ts.map +1 -1
- package/dist/text/name.js +1 -2
- package/dist/text/overflow.d.ts +5 -7
- package/dist/text/overflow.d.ts.map +1 -1
- package/dist/text/overflow.js +1 -2
- package/dist/text/paragraphs.d.ts +20 -23
- package/dist/text/paragraphs.d.ts.map +1 -1
- package/dist/text/paragraphs.js +8 -5
- package/dist/text/paragraphs.js.map +1 -1
- package/dist/text/path.js +1 -2
- package/dist/text/picture.d.ts +3 -6
- package/dist/text/picture.d.ts.map +1 -1
- package/dist/text/picture.js +2 -3
- package/dist/text/references.d.ts +3 -6
- package/dist/text/references.d.ts.map +1 -1
- package/dist/text/references.js +1 -2
- package/dist/text/runs.d.ts +6 -9
- package/dist/text/runs.d.ts.map +1 -1
- package/dist/text/runs.js +1 -2
- package/dist/text/schema.d.ts +1 -4
- package/dist/text/schema.d.ts.map +1 -1
- package/dist/text/schema.js +1 -2
- package/dist/thumbnail.d.ts +4 -7
- package/dist/thumbnail.d.ts.map +1 -1
- package/dist/thumbnail.js +1 -2
- package/dist/transfer/apply.d.ts +2 -5
- package/dist/transfer/apply.d.ts.map +1 -1
- package/dist/transfer/apply.js +2 -3
- package/dist/transfer/copied.d.ts +5 -8
- package/dist/transfer/copied.d.ts.map +1 -1
- package/dist/transfer/copied.js +3 -4
- package/dist/transfer/dependencies.d.ts +6 -9
- package/dist/transfer/dependencies.d.ts.map +1 -1
- package/dist/transfer/dependencies.js +13 -11
- package/dist/transfer/dependencies.js.map +1 -1
- package/dist/transfer/history.d.ts +1 -4
- package/dist/transfer/history.d.ts.map +1 -1
- package/dist/transfer/history.js +1 -2
- package/dist/transfer/identity.js +1 -2
- package/dist/transfer/index.d.ts +3 -3
- package/dist/transfer/index.js +6 -6
- package/dist/transfer/library.d.ts +5 -7
- package/dist/transfer/library.d.ts.map +1 -1
- package/dist/transfer/library.js +32 -12
- package/dist/transfer/library.js.map +1 -1
- package/dist/transfer/nodes.d.ts +2 -5
- package/dist/transfer/nodes.d.ts.map +1 -1
- package/dist/transfer/nodes.js +8 -6
- package/dist/transfer/nodes.js.map +1 -1
- package/dist/transfer/plan.d.ts +2 -5
- package/dist/transfer/plan.d.ts.map +1 -1
- package/dist/transfer/plan.js +2 -3
- package/dist/transfer/references.js +1 -2
- package/dist/transfer/remove.d.ts +1 -4
- package/dist/transfer/remove.d.ts.map +1 -1
- package/dist/transfer/remove.js +2 -3
- package/dist/transfer/resources.d.ts +2 -5
- package/dist/transfer/resources.d.ts.map +1 -1
- package/dist/transfer/resources.js +3 -4
- package/dist/transfer/validation.js +1 -2
- package/dist/transfer/variables.d.ts +3 -6
- package/dist/transfer/variables.d.ts.map +1 -1
- package/dist/transfer/variables.js +2 -3
- package/dist/types.d.ts +191 -142
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +15 -3
- package/dist/types.js.map +1 -1
- package/dist/undo.d.ts +5 -8
- package/dist/undo.d.ts.map +1 -1
- package/dist/undo.js +9 -3
- package/dist/undo.js.map +1 -1
- package/dist/variables/bindings.d.ts +24 -25
- package/dist/variables/bindings.d.ts.map +1 -1
- package/dist/variables/bindings.js +28 -23
- package/dist/variables/bindings.js.map +1 -1
- package/dist/variables/corners.d.ts +1 -4
- package/dist/variables/corners.d.ts.map +1 -1
- package/dist/variables/corners.js +1 -2
- package/dist/variables/easing.d.ts +24 -19
- package/dist/variables/easing.d.ts.map +1 -1
- package/dist/variables/easing.js +17 -17
- package/dist/variables/easing.js.map +1 -1
- package/dist/variables/fields.d.ts +21 -14
- package/dist/variables/fields.d.ts.map +1 -1
- package/dist/variables/fields.js +24 -6
- package/dist/variables/fields.js.map +1 -1
- package/dist/variables/formula/check.d.ts +2 -5
- package/dist/variables/formula/check.d.ts.map +1 -1
- package/dist/variables/formula/check.js +2 -3
- package/dist/variables/formula/evaluate.d.ts +1 -4
- package/dist/variables/formula/evaluate.d.ts.map +1 -1
- package/dist/variables/formula/evaluate.js +3 -4
- package/dist/variables/formula/index.d.ts +6 -8
- package/dist/variables/formula/index.d.ts.map +1 -1
- package/dist/variables/formula/index.js +4 -5
- package/dist/variables/formula/parse.js +5 -6
- package/dist/variables/formula/print.d.ts +2 -5
- package/dist/variables/formula/print.d.ts.map +1 -1
- package/dist/variables/formula/print.js +4 -5
- package/dist/variables/formula/schema.d.ts +2 -5
- package/dist/variables/formula/schema.d.ts.map +1 -1
- package/dist/variables/formula/schema.js +5 -6
- package/dist/variables/formula/signatures.d.ts +3 -6
- package/dist/variables/formula/signatures.d.ts.map +1 -1
- package/dist/variables/formula/signatures.js +1 -2
- package/dist/variables/formula/tokens.d.ts +5 -8
- package/dist/variables/formula/tokens.d.ts.map +1 -1
- package/dist/variables/formula/tokens.js +1 -2
- package/dist/variables/formula/tree.d.ts +6 -9
- package/dist/variables/formula/tree.d.ts.map +1 -1
- package/dist/variables/formula/tree.js +1 -2
- package/dist/variables/formula/tree.js.map +1 -1
- package/dist/variables/index.d.ts +30 -32
- package/dist/variables/index.d.ts.map +1 -1
- package/dist/variables/index.js +17 -18
- package/dist/variables/lookup.d.ts +11 -7
- package/dist/variables/lookup.d.ts.map +1 -1
- package/dist/variables/lookup.js +24 -3
- package/dist/variables/lookup.js.map +1 -1
- package/dist/variables/motion.d.ts +9 -12
- package/dist/variables/motion.d.ts.map +1 -1
- package/dist/variables/motion.js +3 -4
- package/dist/variables/paints.d.ts +18 -20
- package/dist/variables/paints.d.ts.map +1 -1
- package/dist/variables/paints.js +4 -5
- package/dist/variables/resolution.d.ts +22 -19
- package/dist/variables/resolution.d.ts.map +1 -1
- package/dist/variables/resolution.js +13 -5
- package/dist/variables/resolution.js.map +1 -1
- package/dist/variables/schema.d.ts +9 -12
- package/dist/variables/schema.d.ts.map +1 -1
- package/dist/variables/schema.js +3 -4
- package/dist/variables/style-bindings.d.ts +11 -13
- package/dist/variables/style-bindings.d.ts.map +1 -1
- package/dist/variables/style-bindings.js +2 -3
- package/dist/variables/subtree.js +1 -2
- package/dist/variables/text.d.ts +2 -5
- package/dist/variables/text.d.ts.map +1 -1
- package/dist/variables/text.js +3 -4
- package/dist/variables/token.d.ts +5 -8
- package/dist/variables/token.d.ts.map +1 -1
- package/dist/variables/token.js +1 -2
- package/dist/variables/units.js +3 -5
- package/dist/variables/units.js.map +1 -1
- package/dist/variables/value.d.ts +4 -7
- package/dist/variables/value.d.ts.map +1 -1
- package/dist/variables/value.js +4 -5
- package/dist/variant-name.d.ts +2 -5
- package/dist/variant-name.d.ts.map +1 -1
- package/dist/variant-name.js +1 -2
- package/dist/variant-properties.d.ts +4 -7
- package/dist/variant-properties.d.ts.map +1 -1
- package/dist/variant-properties.js +2 -3
- package/dist/vector-network.d.ts +17 -20
- package/dist/vector-network.d.ts.map +1 -1
- package/dist/vector-network.js +4 -5
- package/package.json +23 -5
- package/src/behaviours/index.ts +1 -0
- package/src/behaviours/kinds.ts +103 -1
- package/src/behaviours/listing.ts +142 -0
- package/src/behaviours/model.ts +21 -0
- package/src/blur.ts +88 -0
- package/src/clipping.ts +3 -4
- package/src/comments/threads.ts +8 -1
- package/src/connectors/layout.ts +10 -3
- package/src/connectors/sublayers.ts +2 -1
- package/src/coordinate.ts +17 -25
- package/src/copy.ts +15 -6
- package/src/cubic.ts +57 -1
- package/src/export-format.ts +11 -1
- package/src/font-style.ts +12 -4
- package/src/generated/index.ts +43 -6
- package/src/generated/kind.ts +16 -2
- package/src/generated/shape-with-text.ts +1 -0
- package/src/generated/spec.ts +243 -0
- package/src/generated/sticky.ts +2 -1
- package/src/geometry.ts +39 -88
- package/src/graph.ts +21 -6
- package/src/hit-test.ts +66 -26
- package/src/images.ts +4 -1
- package/src/instances/content-marks.ts +124 -0
- package/src/instances/deleted.ts +115 -0
- package/src/instances/fields.ts +7 -3
- package/src/instances/index.ts +94 -5
- package/src/instances/lookup.ts +61 -0
- package/src/instances/sync.ts +15 -0
- package/src/layout/flow.ts +5 -3
- package/src/layout/index.ts +1 -0
- package/src/layout/stacking.ts +14 -0
- package/src/matrix.ts +11 -1
- package/src/mesh/geometry.ts +2 -13
- package/src/motion/apply.ts +156 -0
- package/src/motion/edit.ts +148 -0
- package/src/motion/effects.ts +166 -0
- package/src/motion/evaluate.ts +181 -0
- package/src/motion/fields.ts +136 -0
- package/src/motion/index.ts +13 -0
- package/src/motion/keyable.ts +141 -0
- package/src/motion/outline.ts +72 -0
- package/src/motion/presets/index.ts +257 -0
- package/src/motion/presets/settings.ts +221 -0
- package/src/motion/presets/stagger.ts +242 -0
- package/src/motion/schema.ts +66 -0
- package/src/motion/segment.ts +83 -0
- package/src/motion/spec.ts +225 -0
- package/src/motion/timeline.ts +48 -0
- package/src/motion/types.ts +45 -0
- package/src/motion/variables.ts +33 -0
- package/src/node-defaults.ts +131 -49
- package/src/order-keys.ts +16 -2
- package/src/paints/stills.ts +16 -12
- package/src/parse-path.ts +15 -0
- package/src/plugin-data/fields.ts +40 -3
- package/src/polygon.ts +6 -4
- package/src/shaders/model.ts +124 -6
- package/src/shaders/schema.ts +12 -0
- package/src/shape-with-text/document.ts +7 -12
- package/src/shape-with-text/geometry.ts +1 -4
- package/src/slides/index.ts +8 -0
- package/src/slides/motion.ts +35 -1
- package/src/slides/playback.ts +51 -9
- package/src/slots/frames.ts +2 -3
- package/src/specs/index.ts +2 -0
- package/src/specs/model.ts +40 -0
- package/src/specs/schema.ts +43 -0
- package/src/text/lists.ts +20 -7
- package/src/text/paragraphs.ts +10 -3
- package/src/transfer/dependencies.ts +17 -11
- package/src/transfer/library.ts +36 -12
- package/src/transfer/nodes.ts +8 -0
- package/src/types.ts +71 -8
- package/src/undo.ts +10 -1
- package/src/variables/bindings.ts +33 -16
- package/src/variables/easing.ts +16 -17
- package/src/variables/fields.ts +30 -3
- package/src/variables/lookup.ts +24 -1
- package/src/variables/resolution.ts +15 -1
- package/src/variables/units.ts +2 -3
package/dist/slides/types.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Easing } from "../types.js";
|
|
2
|
-
//#region src/slides/types.d.ts
|
|
3
2
|
/** How a slide gives way to the next, by Figma's names for its slide transitions. */
|
|
4
|
-
declare const SLIDE_TRANSITION_STYLES: readonly ["NONE", "DISSOLVE", "SLIDE_FROM_LEFT", "SLIDE_FROM_RIGHT", "SLIDE_FROM_BOTTOM", "SLIDE_FROM_TOP", "PUSH_FROM_LEFT", "PUSH_FROM_RIGHT", "PUSH_FROM_BOTTOM", "PUSH_FROM_TOP", "MOVE_FROM_LEFT", "MOVE_FROM_RIGHT", "MOVE_FROM_TOP", "MOVE_FROM_BOTTOM", "SLIDE_OUT_TO_LEFT", "SLIDE_OUT_TO_RIGHT", "SLIDE_OUT_TO_TOP", "SLIDE_OUT_TO_BOTTOM", "MOVE_OUT_TO_LEFT", "MOVE_OUT_TO_RIGHT", "MOVE_OUT_TO_TOP", "MOVE_OUT_TO_BOTTOM", "SMART_ANIMATE"];
|
|
5
|
-
type SlideTransitionStyle = (typeof SLIDE_TRANSITION_STYLES)[number];
|
|
3
|
+
export declare const SLIDE_TRANSITION_STYLES: readonly ["NONE", "DISSOLVE", "SLIDE_FROM_LEFT", "SLIDE_FROM_RIGHT", "SLIDE_FROM_BOTTOM", "SLIDE_FROM_TOP", "PUSH_FROM_LEFT", "PUSH_FROM_RIGHT", "PUSH_FROM_BOTTOM", "PUSH_FROM_TOP", "MOVE_FROM_LEFT", "MOVE_FROM_RIGHT", "MOVE_FROM_TOP", "MOVE_FROM_BOTTOM", "SLIDE_OUT_TO_LEFT", "SLIDE_OUT_TO_RIGHT", "SLIDE_OUT_TO_TOP", "SLIDE_OUT_TO_BOTTOM", "MOVE_OUT_TO_LEFT", "MOVE_OUT_TO_RIGHT", "MOVE_OUT_TO_TOP", "MOVE_OUT_TO_BOTTOM", "SMART_ANIMATE"];
|
|
4
|
+
export type SlideTransitionStyle = (typeof SLIDE_TRANSITION_STYLES)[number];
|
|
6
5
|
/** What moves the deck on from a slide: a click, or `delay` seconds passing. */
|
|
7
|
-
type SlideTransitionTiming = {
|
|
6
|
+
export type SlideTransitionTiming = {
|
|
8
7
|
type: 'ON_CLICK';
|
|
9
8
|
} | {
|
|
10
9
|
type: 'AFTER_DELAY';
|
|
@@ -17,7 +16,7 @@ type SlideTransitionTiming = {
|
|
|
17
16
|
* duration and easing may follow TIMING and EASING variables, keeping their values beside them
|
|
18
17
|
* for when the variables are gone, as a behaviour's transition does.
|
|
19
18
|
*/
|
|
20
|
-
interface SlideTransition {
|
|
19
|
+
export interface SlideTransition {
|
|
21
20
|
style: SlideTransitionStyle;
|
|
22
21
|
/** In seconds; a spring easing settles in its own time instead. */
|
|
23
22
|
duration: number;
|
|
@@ -27,15 +26,15 @@ interface SlideTransition {
|
|
|
27
26
|
timing: SlideTransitionTiming;
|
|
28
27
|
}
|
|
29
28
|
/** How a layer comes onto or leaves its slide, by Figma's names: a slide moves from that side. */
|
|
30
|
-
declare const LAYER_ANIMATION_STYLES: readonly ["FADE", "SLIDE_FROM_LEFT", "SLIDE_FROM_RIGHT", "SLIDE_FROM_TOP", "SLIDE_FROM_BOTTOM"];
|
|
31
|
-
type LayerAnimationStyle = (typeof LAYER_ANIMATION_STYLES)[number];
|
|
29
|
+
export declare const LAYER_ANIMATION_STYLES: readonly ["FADE", "SLIDE_FROM_LEFT", "SLIDE_FROM_RIGHT", "SLIDE_FROM_TOP", "SLIDE_FROM_BOTTOM"];
|
|
30
|
+
export type LayerAnimationStyle = (typeof LAYER_ANIMATION_STYLES)[number];
|
|
32
31
|
/**
|
|
33
32
|
* A layer's animation on its slide: a step of the slide's build. Steps play in `order`; one that
|
|
34
33
|
* plays `ON_CLICK` waits for the presenter, one that plays `AFTER_PREVIOUS` follows the step before
|
|
35
34
|
* it. It lives on the layer so a copied layer or slide keeps it, and a layer has one at most, as in
|
|
36
35
|
* Figma.
|
|
37
36
|
*/
|
|
38
|
-
interface LayerAnimation {
|
|
37
|
+
export interface LayerAnimation {
|
|
39
38
|
style: LayerAnimationStyle;
|
|
40
39
|
/** `IN` brings the layer on, so it is hidden until its step; `OUT` takes it away. */
|
|
41
40
|
phase: 'IN' | 'OUT';
|
|
@@ -49,7 +48,7 @@ interface LayerAnimation {
|
|
|
49
48
|
order: number;
|
|
50
49
|
}
|
|
51
50
|
/** What a slide keeps besides its layers. */
|
|
52
|
-
interface SlideSettings {
|
|
51
|
+
export interface SlideSettings {
|
|
53
52
|
/** Whether presenting passes the slide by; a skipped slide has no number either. */
|
|
54
53
|
skipped: boolean;
|
|
55
54
|
/** The presenter's notes as plain text, a paragraph per line. */
|
|
@@ -57,6 +56,4 @@ interface SlideSettings {
|
|
|
57
56
|
/** How the deck moves on from the slide, or null when it was never set. */
|
|
58
57
|
transition: SlideTransition | null;
|
|
59
58
|
}
|
|
60
|
-
//#endregion
|
|
61
|
-
export { LAYER_ANIMATION_STYLES, LayerAnimation, LayerAnimationStyle, SLIDE_TRANSITION_STYLES, SlideSettings, SlideTransition, SlideTransitionStyle, SlideTransitionTiming };
|
|
62
59
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/slides/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/slides/types.ts"],"mappings":";;qBAGa;YAyBD,+BAA+B;;YAG/B;EACN;;EAEA;EACA;;EAEA;;;;;;;iBAQW;EACf,OAAO;;EAEP;EACA,QAAQ;EACR;EACA;EACA,QAAQ;;;qBAIG;YAOD,8BAA8B;;;;;;;iBAQzB;EACf,OAAO;;EAEP;EACA;;EAEA;EACA,QAAQ;EACR;EACA;;EAEA;;;iBAIe;;EAEf;;EAEA;;EAEA,YAAY"}
|
package/dist/slides/types.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/slides/types.ts
|
|
2
2
|
/** How a slide gives way to the next, by Figma's names for its slide transitions. */
|
|
3
3
|
const SLIDE_TRANSITION_STYLES = [
|
|
4
4
|
"NONE",
|
|
@@ -33,7 +33,6 @@ const LAYER_ANIMATION_STYLES = [
|
|
|
33
33
|
"SLIDE_FROM_TOP",
|
|
34
34
|
"SLIDE_FROM_BOTTOM"
|
|
35
35
|
];
|
|
36
|
-
//#endregion
|
|
37
36
|
export { LAYER_ANIMATION_STYLES, SLIDE_TRANSITION_STYLES };
|
|
38
37
|
|
|
39
38
|
//# sourceMappingURL=types.js.map
|
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
import { SceneGraph } from "../graph.js";
|
|
2
2
|
import { ComponentPropertyDefinition, SceneNode, SlotSettings } from "../types.js";
|
|
3
|
-
//#region src/slots/authoring.d.ts
|
|
4
3
|
/** The settings a new slot starts with: no limits, any layer allowed. */
|
|
5
|
-
declare const DEFAULT_SLOT_SETTINGS: SlotSettings;
|
|
4
|
+
export declare const DEFAULT_SLOT_SETTINGS: SlotSettings;
|
|
6
5
|
/**
|
|
7
6
|
* The main component or set that defines the slots inside a layer: the component the layer
|
|
8
7
|
* belongs to, or that component's set. Layers of an instance are not authored there, so a
|
|
9
8
|
* layer under an instance has none.
|
|
10
9
|
*/
|
|
11
|
-
declare function slotOwner(graph: SceneGraph, node: SceneNode): SceneNode | undefined;
|
|
10
|
+
export declare function slotOwner(graph: SceneGraph, node: SceneNode): SceneNode | undefined;
|
|
12
11
|
/** Whether a frame inside a main component can become a slot. */
|
|
13
|
-
declare function canCreateSlot(graph: SceneGraph, node: SceneNode): boolean;
|
|
12
|
+
export declare function canCreateSlot(graph: SceneGraph, node: SceneNode): boolean;
|
|
14
13
|
/**
|
|
15
14
|
* Make a frame of a main component a slot: define a SLOT property, named after the frame, on
|
|
16
15
|
* the component and bind the frame's children to it. Instances pick up the slot on their next
|
|
17
16
|
* sync.
|
|
18
17
|
*/
|
|
19
|
-
declare function createSlotProperty(graph: SceneGraph, frameId: string, id: string): ComponentPropertyDefinition | null;
|
|
18
|
+
export declare function createSlotProperty(graph: SceneGraph, frameId: string, id: string): ComponentPropertyDefinition | null;
|
|
20
19
|
/** What a slot's settings panel can change. */
|
|
21
|
-
type SlotPropertyPatch = Partial<Pick<ComponentPropertyDefinition, 'name' | 'description' | 'preferredValues'>> & {
|
|
20
|
+
export type SlotPropertyPatch = Partial<Pick<ComponentPropertyDefinition, 'name' | 'description' | 'preferredValues'>> & {
|
|
22
21
|
slotSettings?: Partial<SlotSettings>;
|
|
23
22
|
};
|
|
24
23
|
/** Change a slot property's name, description, preferred components, or limits. */
|
|
25
|
-
declare function updateSlotProperty(graph: SceneGraph, ownerId: string, propertyId: string, patch: SlotPropertyPatch): boolean;
|
|
26
|
-
//#endregion
|
|
27
|
-
export { DEFAULT_SLOT_SETTINGS, SlotPropertyPatch, canCreateSlot, createSlotProperty, slotOwner, updateSlotProperty };
|
|
24
|
+
export declare function updateSlotProperty(graph: SceneGraph, ownerId: string, propertyId: string, patch: SlotPropertyPatch): boolean;
|
|
28
25
|
//# sourceMappingURL=authoring.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authoring.d.ts","names":[],"sources":["../../src/slots/authoring.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"authoring.d.ts","names":[],"sources":["../../src/slots/authoring.ts"],"mappings":";;;qBAMa,uBAAuB;;;;;;wBAWpB,UAAU,OAAO,YAAY,MAAM,YAAY;;wBAW/C,cAAc,OAAO,YAAY,MAAM;;;;;;wBAiBvC,mBACd,OAAO,YACP,iBACA,aACC;;YAyBS,oBAAoB,QAC9B,KAAK;EACD,eAAe,QAAQ;;;wBAGb,mBACd,OAAO,YACP,iBACA,oBACA,OAAO"}
|
package/dist/slots/authoring.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { slotPropertyId } from "./frames.js";
|
|
2
1
|
import { propertyOwner } from "../components/properties.js";
|
|
3
|
-
|
|
2
|
+
import { slotPropertyId } from "./frames.js";
|
|
3
|
+
// src/slots/authoring.ts
|
|
4
4
|
/** The settings a new slot starts with: no limits, any layer allowed. */
|
|
5
5
|
const DEFAULT_SLOT_SETTINGS = {
|
|
6
6
|
allowPreferredValuesOnly: false,
|
|
@@ -73,7 +73,6 @@ function updateSlotProperty(graph, ownerId, propertyId, patch) {
|
|
|
73
73
|
graph.updateNode(owner.id, { componentPropertyDefinitions: owner.componentPropertyDefinitions.map((definition) => definition.id === propertyId ? next : definition) });
|
|
74
74
|
return true;
|
|
75
75
|
}
|
|
76
|
-
//#endregion
|
|
77
76
|
export { DEFAULT_SLOT_SETTINGS, canCreateSlot, createSlotProperty, slotOwner, updateSlotProperty };
|
|
78
77
|
|
|
79
78
|
//# sourceMappingURL=authoring.js.map
|
package/dist/slots/content.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SceneGraph } from "../graph.js";
|
|
2
2
|
import { SceneNode } from "../types.js";
|
|
3
|
-
//#region src/slots/content.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Where layers may be added, moved, or removed under a parent:
|
|
6
5
|
* - `free`: outside any instance, or inside a component definition;
|
|
@@ -8,7 +7,7 @@ import { SceneNode } from "../types.js";
|
|
|
8
7
|
* - `locked`: anywhere else inside an instance, whose layers come from its component, or inside a
|
|
9
8
|
* generated frame such as a sticky note, whose layers come from its template.
|
|
10
9
|
*/
|
|
11
|
-
type SlotScope = {
|
|
10
|
+
export type SlotScope = {
|
|
12
11
|
kind: 'free';
|
|
13
12
|
} | {
|
|
14
13
|
kind: 'slot';
|
|
@@ -19,23 +18,21 @@ type SlotScope = {
|
|
|
19
18
|
kind: 'locked';
|
|
20
19
|
owner: SceneNode;
|
|
21
20
|
};
|
|
22
|
-
declare function slotScope(graph: SceneGraph, parentId: string): SlotScope;
|
|
21
|
+
export declare function slotScope(graph: SceneGraph, parentId: string): SlotScope;
|
|
23
22
|
/**
|
|
24
23
|
* Make the instance own its slot's content, as Figma does on the first edit: the layers
|
|
25
24
|
* stay where they are, but stop following the component. Overrides the instance held for
|
|
26
25
|
* them become their own values, or move to the nested instance they belong to.
|
|
27
26
|
*/
|
|
28
|
-
declare function claimSlotContent(graph: SceneGraph, scope: Extract<SlotScope, {
|
|
27
|
+
export declare function claimSlotContent(graph: SceneGraph, scope: Extract<SlotScope, {
|
|
29
28
|
kind: 'slot';
|
|
30
29
|
}>): void;
|
|
31
30
|
/** Return the slot to its component's content: the instance stops owning it. */
|
|
32
|
-
declare function resetSlotContent(graph: SceneGraph, scope: Extract<SlotScope, {
|
|
31
|
+
export declare function resetSlotContent(graph: SceneGraph, scope: Extract<SlotScope, {
|
|
33
32
|
kind: 'slot';
|
|
34
33
|
}>): void;
|
|
35
34
|
/** Remove everything from the slot; the instance keeps owning it, now empty. */
|
|
36
|
-
declare function clearSlotContent(graph: SceneGraph, scope: Extract<SlotScope, {
|
|
35
|
+
export declare function clearSlotContent(graph: SceneGraph, scope: Extract<SlotScope, {
|
|
37
36
|
kind: 'slot';
|
|
38
37
|
}>): void;
|
|
39
|
-
//#endregion
|
|
40
|
-
export { SlotScope, claimSlotContent, clearSlotContent, resetSlotContent, slotScope };
|
|
41
38
|
//# sourceMappingURL=content.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.d.ts","names":[],"sources":["../../src/slots/content.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"content.d.ts","names":[],"sources":["../../src/slots/content.ts"],"mappings":";;;;;;;;;YAeY;EACN;;EACA;EAAc,OAAO;EAAW,UAAU;EAAW;;EACrD;EAAgB,OAAO;;wBAYb,UAAU,OAAO,YAAY,mBAAmB;;;;;;wBAmChD,iBACd,OAAO,YACP,OAAO,QAAQ;EAAa;;;wBA0Cd,iBACd,OAAO,YACP,OAAO,QAAQ;EAAa;;;wBAcd,iBACd,OAAO,YACP,OAAO,QAAQ;EAAa"}
|
package/dist/slots/content.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { getInstanceOverride, setInstanceOverride } from "../instances/overrides.js";
|
|
2
1
|
import { isGeneratedFrame } from "../generated/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import { applyBoundPaintColorsIn } from "../variables/paints.js";
|
|
2
|
+
import { getInstanceOverride, setInstanceOverride } from "../instances/overrides.js";
|
|
5
3
|
import { cloneChildrenWithMapping } from "../instances/sync.js";
|
|
6
|
-
|
|
4
|
+
import { applyBoundPaintColorsIn } from "../variables/paints.js";
|
|
5
|
+
import { ownsSlotContent, slotPropertyId } from "./frames.js";
|
|
6
|
+
// src/slots/content.ts
|
|
7
7
|
function parentOf(graph, node) {
|
|
8
8
|
return node.parentId ? graph.nodes.get(node.parentId) : void 0;
|
|
9
9
|
}
|
|
@@ -102,7 +102,6 @@ function clearSlotContent(graph, scope) {
|
|
|
102
102
|
claimSlotContent(graph, scope);
|
|
103
103
|
for (const childId of Array.from(scope.frame.childIds)) graph.deleteNode(childId);
|
|
104
104
|
}
|
|
105
|
-
//#endregion
|
|
106
105
|
export { claimSlotContent, clearSlotContent, resetSlotContent, slotScope };
|
|
107
106
|
|
|
108
107
|
//# sourceMappingURL=content.js.map
|
package/dist/slots/frames.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { SceneGraph } from "../graph.js";
|
|
2
2
|
import { SceneNode } from "../types.js";
|
|
3
|
-
//#region src/slots/frames.d.ts
|
|
4
3
|
/** The slot property a frame holds the content of, if it is a slot. */
|
|
5
|
-
declare function slotPropertyId(node: SceneNode): string | undefined;
|
|
4
|
+
export declare function slotPropertyId(node: SceneNode): string | undefined;
|
|
6
5
|
/**
|
|
7
6
|
* Whether this slot frame's children belong to its instance rather than its component: the
|
|
8
7
|
* nearest enclosing instance assigns the slot. Such content is never synced from the component.
|
|
9
8
|
*/
|
|
10
|
-
declare function ownsSlotContent(graph: SceneGraph, node: SceneNode, propertyId?: string | undefined): boolean;
|
|
9
|
+
export declare function ownsSlotContent(graph: SceneGraph, node: SceneNode, propertyId?: string | undefined): boolean;
|
|
11
10
|
/** An instance's slot frames, without entering nested instances, whose slots are their own. */
|
|
12
|
-
declare function instanceSlotFrames(graph: SceneGraph, instance: SceneNode): SceneNode[];
|
|
11
|
+
export declare function instanceSlotFrames(graph: SceneGraph, instance: SceneNode): SceneNode[];
|
|
13
12
|
/** One slot's owned content, parked while the instance it belongs to is rebuilt. */
|
|
14
13
|
interface ParkedSlot {
|
|
15
14
|
/** Names of the nested instances leading to the slot's owner; empty for the instance itself. */
|
|
@@ -22,7 +21,7 @@ interface ParkedSlot {
|
|
|
22
21
|
propertyId: string;
|
|
23
22
|
}
|
|
24
23
|
/** Owned slot content parked under an instance while its component changes. */
|
|
25
|
-
interface ParkedSlotContent {
|
|
24
|
+
export interface ParkedSlotContent {
|
|
26
25
|
slots: ParkedSlot[];
|
|
27
26
|
/** The instance's own slot assignments the content was parked from. */
|
|
28
27
|
propertyIds: string[];
|
|
@@ -32,9 +31,8 @@ interface ParkedSlotContent {
|
|
|
32
31
|
* nested instance's name path, directly under the instance, so its component can be replaced.
|
|
33
32
|
* Figma keeps that content when a variant switch or swap leads to slots of the same names.
|
|
34
33
|
*/
|
|
35
|
-
declare function detachOwnedSlotContent(graph: SceneGraph, instance: SceneNode): ParkedSlotContent;
|
|
34
|
+
export declare function detachOwnedSlotContent(graph: SceneGraph, instance: SceneNode): ParkedSlotContent;
|
|
36
35
|
/** Move parked content into the slots of the same names and paths, and reassign them. */
|
|
37
|
-
declare function restoreOwnedSlotContent(graph: SceneGraph, instance: SceneNode, parked: ParkedSlotContent): void;
|
|
38
|
-
|
|
39
|
-
export { ParkedSlotContent, detachOwnedSlotContent, instanceSlotFrames, ownsSlotContent, restoreOwnedSlotContent, slotPropertyId };
|
|
36
|
+
export declare function restoreOwnedSlotContent(graph: SceneGraph, instance: SceneNode, parked: ParkedSlotContent): void;
|
|
37
|
+
export {};
|
|
40
38
|
//# sourceMappingURL=frames.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frames.d.ts","names":[],"sources":["../../src/slots/frames.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"frames.d.ts","names":[],"sources":["../../src/slots/frames.ts"],"mappings":";;;wBAKgB,eAAe,MAAM;;;;;wBASrB,gBACd,OAAO,YACP,MAAM,WACN;;wBAkBc,mBAAmB,OAAO,YAAY,UAAU,YAAY;;UAelE;;EAER;;EAEA;;EAEA;EACA;EACA;;;iBAIe;EACf,OAAO;;EAEP;;;;;;;wBAoCc,uBAAuB,OAAO,YAAY,UAAU,YAAY;;wBA2BhE,wBACd,OAAO,YACP,UAAU,WACV,QAAQ"}
|
package/dist/slots/frames.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { instanceMainComponent } from "../instances/main-component.js";
|
|
2
|
-
|
|
2
|
+
// src/slots/frames.ts
|
|
3
3
|
/** The slot property a frame holds the content of, if it is a slot. */
|
|
4
4
|
function slotPropertyId(node) {
|
|
5
5
|
return node.componentPropertyReferences.find((reference) => reference.field === "SLOT_CONTENT")?.propertyId;
|
|
@@ -10,8 +10,8 @@ function slotPropertyId(node) {
|
|
|
10
10
|
*/
|
|
11
11
|
function ownsSlotContent(graph, node, propertyId = slotPropertyId(node)) {
|
|
12
12
|
if (!propertyId) return false;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
if (!node.parentId) return false;
|
|
14
|
+
const owner = graph.closest(node.parentId, (ancestor) => ancestor.type === "INSTANCE");
|
|
15
15
|
return !!owner && Object.hasOwn(owner.componentPropertyAssignments, propertyId);
|
|
16
16
|
}
|
|
17
17
|
/** The name of a slot property as the instance's component (or the component's set) defines it. */
|
|
@@ -112,7 +112,6 @@ function restoreOwnedSlotContent(graph, instance, parked) {
|
|
|
112
112
|
} });
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
//#endregion
|
|
116
115
|
export { detachOwnedSlotContent, instanceSlotFrames, ownsSlotContent, restoreOwnedSlotContent, slotPropertyId };
|
|
117
116
|
|
|
118
117
|
//# sourceMappingURL=frames.js.map
|
package/dist/slots/frames.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frames.js","names":[],"sources":["../../src/slots/frames.ts"],"sourcesContent":["import type { SceneGraph } from '../graph'\nimport { instanceMainComponent } from '../instances/main-component'\nimport type { SceneNode } from '../types'\n\n/** The slot property a frame holds the content of, if it is a slot. */\nexport function slotPropertyId(node: SceneNode): string | undefined {\n return node.componentPropertyReferences.find((reference) => reference.field === 'SLOT_CONTENT')\n ?.propertyId\n}\n\n/**\n * Whether this slot frame's children belong to its instance rather than its component: the\n * nearest enclosing instance assigns the slot. Such content is never synced from the component.\n */\nexport function ownsSlotContent(\n graph: SceneGraph,\n node: SceneNode,\n propertyId = slotPropertyId(node)\n): boolean {\n if (!propertyId) return false\n let owner = node.parentId ? graph.nodes.get(node.parentId) : undefined\n while (owner && owner.type !== 'INSTANCE')\n owner = owner.parentId ? graph.nodes.get(owner.parentId) : undefined\n return !!owner && Object.hasOwn(owner.componentPropertyAssignments, propertyId)\n}\n\n/** The name of a slot property as the instance's component (or the component's set) defines it. */\nfunction slotName(graph: SceneGraph, instance: SceneNode, propertyId: string) {\n const component = instanceMainComponent(graph, instance)\n const set = component?.parentId ? graph.nodes.get(component.parentId) : undefined\n return [component, set]\n .flatMap((node) => node?.componentPropertyDefinitions ?? [])\n .find((definition) => definition.id === propertyId && definition.type === 'SLOT')?.name\n}\n\n/** An instance's slot frames, without entering nested instances, whose slots are their own. */\nexport function instanceSlotFrames(graph: SceneGraph, instance: SceneNode): SceneNode[] {\n const frames: SceneNode[] = []\n const visit = (node: SceneNode): void => {\n for (const childId of node.childIds) {\n const child = graph.nodes.get(childId)\n if (!child) continue\n if (slotPropertyId(child)) frames.push(child)\n else if (child.type !== 'INSTANCE') visit(child)\n }\n }\n visit(instance)\n return frames\n}\n\n/** One slot's owned content, parked while the instance it belongs to is rebuilt. */\ninterface ParkedSlot {\n /** Names of the nested instances leading to the slot's owner; empty for the instance itself. */\n path: string[]\n /** The slot property's name, which the replacement must share. */\n name: string\n /** Content layer ids, in layer order. */\n content: string[]\n ownerId: string\n propertyId: string\n}\n\n/** Owned slot content parked under an instance while its component changes. */\nexport interface ParkedSlotContent {\n slots: ParkedSlot[]\n /** The instance's own slot assignments the content was parked from. */\n propertyIds: string[]\n}\n\n/** Instances directly inside this one: not inside another nested instance or a slot. */\nfunction nestedInstances(graph: SceneGraph, owner: SceneNode): SceneNode[] {\n const found: SceneNode[] = []\n const visit = (node: SceneNode): void => {\n for (const childId of node.childIds) {\n const child = graph.nodes.get(childId)\n if (!child || slotPropertyId(child)) continue\n if (child.type === 'INSTANCE') found.push(child)\n else visit(child)\n }\n }\n visit(owner)\n return found\n}\n\n/** The nested instance a name path leads to from `root`, matched by layer name as Figma does. */\nfunction instanceAtPath(\n graph: SceneGraph,\n root: SceneNode,\n path: readonly string[]\n): SceneNode | undefined {\n let current: SceneNode | undefined = root\n for (const name of path) {\n current = current && nestedInstances(graph, current).find((node) => node.name === name)\n }\n return current\n}\n\n/**\n * Park the slot content an instance and the instances nested in it own, by slot name and the\n * nested instance's name path, directly under the instance, so its component can be replaced.\n * Figma keeps that content when a variant switch or swap leads to slots of the same names.\n */\nexport function detachOwnedSlotContent(graph: SceneGraph, instance: SceneNode): ParkedSlotContent {\n const parked: ParkedSlotContent = { slots: [], propertyIds: [] }\n const visit = (owner: SceneNode, path: string[]): void => {\n for (const nested of nestedInstances(graph, owner)) visit(nested, [...path, nested.name])\n for (const frame of instanceSlotFrames(graph, owner)) {\n const propertyId = slotPropertyId(frame)\n if (!propertyId || !Object.hasOwn(owner.componentPropertyAssignments, propertyId)) continue\n if (owner.id === instance.id) parked.propertyIds.push(propertyId)\n const name = slotName(graph, owner, propertyId)\n const key = [...path, name].join('\\u0000')\n if (!name || parked.slots.some((slot) => [...slot.path, slot.name].join('\\u0000') === key))\n continue\n const content = [...frame.childIds]\n for (const id of content) graph.insertChildAt(id, instance.id, instance.childIds.length)\n parked.slots.push({ path, name, content, ownerId: owner.id, propertyId })\n }\n }\n visit(instance, [])\n return parked\n}\n\nfunction assignsOtherContent(owner: SceneNode, propertyId: string, slot: ParkedSlot): boolean {\n const parkedFromHere = owner.id === slot.ownerId && propertyId === slot.propertyId\n return !parkedFromHere && Object.hasOwn(owner.componentPropertyAssignments, propertyId)\n}\n\n/** Move parked content into the slots of the same names and paths, and reassign them. */\nexport function restoreOwnedSlotContent(\n graph: SceneGraph,\n instance: SceneNode,\n parked: ParkedSlotContent\n): void {\n if (parked.slots.length === 0 && parked.propertyIds.length === 0) return\n graph.updateNode(instance.id, {\n componentPropertyAssignments: Object.fromEntries(\n Object.entries(instance.componentPropertyAssignments).filter(\n ([id]) => !parked.propertyIds.includes(id)\n )\n )\n })\n for (const slot of parked.slots) {\n const owner = instanceAtPath(graph, instance, slot.path)\n const frame =\n owner &&\n instanceSlotFrames(graph, owner).find((candidate) => {\n const propertyId = slotPropertyId(candidate)\n return !!propertyId && slotName(graph, owner, propertyId) === slot.name\n })\n const propertyId = frame && slotPropertyId(frame)\n if (!owner || !frame || !propertyId || assignsOtherContent(owner, propertyId, slot)) {\n for (const id of slot.content) graph.deleteNode(id)\n continue\n }\n for (const id of Array.from(frame.childIds)) graph.deleteNode(id)\n for (const [index, id] of slot.content.entries()) graph.insertChildAt(id, frame.id, index)\n graph.updateNode(owner.id, {\n componentPropertyAssignments: { ...owner.componentPropertyAssignments, [propertyId]: '' }\n })\n }\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"frames.js","names":[],"sources":["../../src/slots/frames.ts"],"sourcesContent":["import type { SceneGraph } from '../graph'\nimport { instanceMainComponent } from '../instances/main-component'\nimport type { SceneNode } from '../types'\n\n/** The slot property a frame holds the content of, if it is a slot. */\nexport function slotPropertyId(node: SceneNode): string | undefined {\n return node.componentPropertyReferences.find((reference) => reference.field === 'SLOT_CONTENT')\n ?.propertyId\n}\n\n/**\n * Whether this slot frame's children belong to its instance rather than its component: the\n * nearest enclosing instance assigns the slot. Such content is never synced from the component.\n */\nexport function ownsSlotContent(\n graph: SceneGraph,\n node: SceneNode,\n propertyId = slotPropertyId(node)\n): boolean {\n if (!propertyId) return false\n if (!node.parentId) return false\n const owner = graph.closest(node.parentId, (ancestor) => ancestor.type === 'INSTANCE')\n return !!owner && Object.hasOwn(owner.componentPropertyAssignments, propertyId)\n}\n\n/** The name of a slot property as the instance's component (or the component's set) defines it. */\nfunction slotName(graph: SceneGraph, instance: SceneNode, propertyId: string) {\n const component = instanceMainComponent(graph, instance)\n const set = component?.parentId ? graph.nodes.get(component.parentId) : undefined\n return [component, set]\n .flatMap((node) => node?.componentPropertyDefinitions ?? [])\n .find((definition) => definition.id === propertyId && definition.type === 'SLOT')?.name\n}\n\n/** An instance's slot frames, without entering nested instances, whose slots are their own. */\nexport function instanceSlotFrames(graph: SceneGraph, instance: SceneNode): SceneNode[] {\n const frames: SceneNode[] = []\n const visit = (node: SceneNode): void => {\n for (const childId of node.childIds) {\n const child = graph.nodes.get(childId)\n if (!child) continue\n if (slotPropertyId(child)) frames.push(child)\n else if (child.type !== 'INSTANCE') visit(child)\n }\n }\n visit(instance)\n return frames\n}\n\n/** One slot's owned content, parked while the instance it belongs to is rebuilt. */\ninterface ParkedSlot {\n /** Names of the nested instances leading to the slot's owner; empty for the instance itself. */\n path: string[]\n /** The slot property's name, which the replacement must share. */\n name: string\n /** Content layer ids, in layer order. */\n content: string[]\n ownerId: string\n propertyId: string\n}\n\n/** Owned slot content parked under an instance while its component changes. */\nexport interface ParkedSlotContent {\n slots: ParkedSlot[]\n /** The instance's own slot assignments the content was parked from. */\n propertyIds: string[]\n}\n\n/** Instances directly inside this one: not inside another nested instance or a slot. */\nfunction nestedInstances(graph: SceneGraph, owner: SceneNode): SceneNode[] {\n const found: SceneNode[] = []\n const visit = (node: SceneNode): void => {\n for (const childId of node.childIds) {\n const child = graph.nodes.get(childId)\n if (!child || slotPropertyId(child)) continue\n if (child.type === 'INSTANCE') found.push(child)\n else visit(child)\n }\n }\n visit(owner)\n return found\n}\n\n/** The nested instance a name path leads to from `root`, matched by layer name as Figma does. */\nfunction instanceAtPath(\n graph: SceneGraph,\n root: SceneNode,\n path: readonly string[]\n): SceneNode | undefined {\n let current: SceneNode | undefined = root\n for (const name of path) {\n current = current && nestedInstances(graph, current).find((node) => node.name === name)\n }\n return current\n}\n\n/**\n * Park the slot content an instance and the instances nested in it own, by slot name and the\n * nested instance's name path, directly under the instance, so its component can be replaced.\n * Figma keeps that content when a variant switch or swap leads to slots of the same names.\n */\nexport function detachOwnedSlotContent(graph: SceneGraph, instance: SceneNode): ParkedSlotContent {\n const parked: ParkedSlotContent = { slots: [], propertyIds: [] }\n const visit = (owner: SceneNode, path: string[]): void => {\n for (const nested of nestedInstances(graph, owner)) visit(nested, [...path, nested.name])\n for (const frame of instanceSlotFrames(graph, owner)) {\n const propertyId = slotPropertyId(frame)\n if (!propertyId || !Object.hasOwn(owner.componentPropertyAssignments, propertyId)) continue\n if (owner.id === instance.id) parked.propertyIds.push(propertyId)\n const name = slotName(graph, owner, propertyId)\n const key = [...path, name].join('\\u0000')\n if (!name || parked.slots.some((slot) => [...slot.path, slot.name].join('\\u0000') === key))\n continue\n const content = [...frame.childIds]\n for (const id of content) graph.insertChildAt(id, instance.id, instance.childIds.length)\n parked.slots.push({ path, name, content, ownerId: owner.id, propertyId })\n }\n }\n visit(instance, [])\n return parked\n}\n\nfunction assignsOtherContent(owner: SceneNode, propertyId: string, slot: ParkedSlot): boolean {\n const parkedFromHere = owner.id === slot.ownerId && propertyId === slot.propertyId\n return !parkedFromHere && Object.hasOwn(owner.componentPropertyAssignments, propertyId)\n}\n\n/** Move parked content into the slots of the same names and paths, and reassign them. */\nexport function restoreOwnedSlotContent(\n graph: SceneGraph,\n instance: SceneNode,\n parked: ParkedSlotContent\n): void {\n if (parked.slots.length === 0 && parked.propertyIds.length === 0) return\n graph.updateNode(instance.id, {\n componentPropertyAssignments: Object.fromEntries(\n Object.entries(instance.componentPropertyAssignments).filter(\n ([id]) => !parked.propertyIds.includes(id)\n )\n )\n })\n for (const slot of parked.slots) {\n const owner = instanceAtPath(graph, instance, slot.path)\n const frame =\n owner &&\n instanceSlotFrames(graph, owner).find((candidate) => {\n const propertyId = slotPropertyId(candidate)\n return !!propertyId && slotName(graph, owner, propertyId) === slot.name\n })\n const propertyId = frame && slotPropertyId(frame)\n if (!owner || !frame || !propertyId || assignsOtherContent(owner, propertyId, slot)) {\n for (const id of slot.content) graph.deleteNode(id)\n continue\n }\n for (const id of Array.from(frame.childIds)) graph.deleteNode(id)\n for (const [index, id] of slot.content.entries()) graph.insertChildAt(id, frame.id, index)\n graph.updateNode(owner.id, {\n componentPropertyAssignments: { ...owner.componentPropertyAssignments, [propertyId]: '' }\n })\n }\n}\n"],"mappings":"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"}
|
package/dist/slots/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { detachOwnedSlotContent, instanceSlotFrames, ownsSlotContent, restoreOwnedSlotContent, slotPropertyId } from "./frames.js";
|
|
2
1
|
import { DEFAULT_SLOT_SETTINGS, canCreateSlot, createSlotProperty, slotOwner, updateSlotProperty } from "./authoring.js";
|
|
3
2
|
import { claimSlotContent, clearSlotContent, resetSlotContent, slotScope } from "./content.js";
|
|
3
|
+
import { detachOwnedSlotContent, instanceSlotFrames, ownsSlotContent, restoreOwnedSlotContent, slotPropertyId } from "./frames.js";
|
|
4
4
|
import { isPreferredComponent, nonPreferredLayers, slotLimitViolations } from "./limits.js";
|
|
5
5
|
export { DEFAULT_SLOT_SETTINGS, canCreateSlot, claimSlotContent, clearSlotContent, createSlotProperty, detachOwnedSlotContent, instanceSlotFrames, isPreferredComponent, nonPreferredLayers, ownsSlotContent, resetSlotContent, restoreOwnedSlotContent, slotLimitViolations, slotOwner, slotPropertyId, slotScope, updateSlotProperty };
|
package/dist/slots/limits.d.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { SceneGraph } from "../graph.js";
|
|
2
2
|
import { ComponentPropertyDefinition, SceneNode } from "../types.js";
|
|
3
|
-
//#region src/slots/limits.d.ts
|
|
4
3
|
/** A limit a slot's content breaks, named as Figma's `SlotNode.limitViolations` names them. */
|
|
5
|
-
type SlotLimitViolation = 'BELOW_MIN' | 'ABOVE_MAX' | 'HAS_NON_PREFERRED';
|
|
4
|
+
export type SlotLimitViolation = 'BELOW_MIN' | 'ABOVE_MAX' | 'HAS_NON_PREFERRED';
|
|
6
5
|
/** Whether a component is among a slot's preferred values, by id, key, or library key. */
|
|
7
|
-
declare function isPreferredComponent(component: SceneNode | undefined, preferredValues?: readonly string[]): boolean;
|
|
6
|
+
export declare function isPreferredComponent(component: SceneNode | undefined, preferredValues?: readonly string[]): boolean;
|
|
8
7
|
/** Content layers a preferred-only slot does not allow: anything but preferred instances. */
|
|
9
|
-
declare function nonPreferredLayers(graph: SceneGraph, definition: ComponentPropertyDefinition, content: readonly SceneNode[]): SceneNode[];
|
|
8
|
+
export declare function nonPreferredLayers(graph: SceneGraph, definition: ComponentPropertyDefinition, content: readonly SceneNode[]): SceneNode[];
|
|
10
9
|
/** The limits a slot's content breaks; below-minimum and above-maximum exclude each other. */
|
|
11
|
-
declare function slotLimitViolations(graph: SceneGraph, definition: ComponentPropertyDefinition, content: readonly SceneNode[]): SlotLimitViolation[];
|
|
12
|
-
//#endregion
|
|
13
|
-
export { SlotLimitViolation, isPreferredComponent, nonPreferredLayers, slotLimitViolations };
|
|
10
|
+
export declare function slotLimitViolations(graph: SceneGraph, definition: ComponentPropertyDefinition, content: readonly SceneNode[]): SlotLimitViolation[];
|
|
14
11
|
//# sourceMappingURL=limits.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limits.d.ts","names":[],"sources":["../../src/slots/limits.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"limits.d.ts","names":[],"sources":["../../src/slots/limits.ts"],"mappings":";;;YAIY;;wBAGI,qBACd,WAAW,uBACX;;wBASc,mBACd,OAAO,YACP,YAAY,6BACZ,kBAAkB,cACjB;;wBAaa,oBACd,OAAO,YACP,YAAY,6BACZ,kBAAkB,cACjB"}
|
package/dist/slots/limits.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/slots/limits.ts
|
|
2
2
|
/** Whether a component is among a slot's preferred values, by id, key, or library key. */
|
|
3
3
|
function isPreferredComponent(component, preferredValues = []) {
|
|
4
4
|
if (!component) return false;
|
|
@@ -22,7 +22,6 @@ function slotLimitViolations(graph, definition, content) {
|
|
|
22
22
|
if (nonPreferredLayers(graph, definition, content).length) violations.push("HAS_NON_PREFERRED");
|
|
23
23
|
return violations;
|
|
24
24
|
}
|
|
25
|
-
//#endregion
|
|
26
25
|
export { isPreferredComponent, nonPreferredLayers, slotLimitViolations };
|
|
27
26
|
|
|
28
27
|
//# sourceMappingURL=limits.js.map
|
package/dist/snap.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Rect } from "./primitives/index.js";
|
|
2
2
|
import { SceneNode } from "./types.js";
|
|
3
|
-
|
|
4
|
-
interface SnapGuide {
|
|
3
|
+
export interface SnapGuide {
|
|
5
4
|
axis: 'x' | 'y';
|
|
6
5
|
position: number;
|
|
7
6
|
from: number;
|
|
@@ -9,13 +8,11 @@ interface SnapGuide {
|
|
|
9
8
|
/** Points along the guide that lined up, marked with a cross: a guide through path vertices. */
|
|
10
9
|
marks?: number[];
|
|
11
10
|
}
|
|
12
|
-
interface SnapResult {
|
|
11
|
+
export interface SnapResult {
|
|
13
12
|
dx: number;
|
|
14
13
|
dy: number;
|
|
15
14
|
guides: SnapGuide[];
|
|
16
15
|
}
|
|
17
|
-
declare function computeSnap(movingIds: Set<string>, movingBounds: Rect, allNodes: SceneNode[], threshold?: number): SnapResult;
|
|
18
|
-
declare function computeSelectionBounds(nodes: SceneNode[]): Rect | null;
|
|
19
|
-
//#endregion
|
|
20
|
-
export { SnapGuide, SnapResult, computeSelectionBounds, computeSnap };
|
|
16
|
+
export declare function computeSnap(movingIds: Set<string>, movingBounds: Rect, allNodes: SceneNode[], threshold?: number): SnapResult;
|
|
17
|
+
export declare function computeSelectionBounds(nodes: SceneNode[]): Rect | null;
|
|
21
18
|
//# sourceMappingURL=snap.d.ts.map
|
package/dist/snap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snap.d.ts","names":[],"sources":["../src/snap.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"snap.d.ts","names":[],"sources":["../src/snap.ts"],"mappings":";;iBAMiB;EACf;EACA;EACA;EACA;;EAEA;;iBAGe;EACf;EACA;EACA,QAAQ;;wBASM,YACd,WAAW,aACX,cAAc,MACd,UAAU,aACV,qBACC;wBAoFa,uBAAuB,OAAO,cAAc"}
|
package/dist/snap.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { rotatedBBox } from "./geometry.js";
|
|
2
|
-
|
|
2
|
+
// src/snap.ts
|
|
3
3
|
const DEFAULT_SNAP_THRESHOLD = 5;
|
|
4
4
|
function getEdges(node) {
|
|
5
5
|
return rotatedBBox(node.x, node.y, node.width, node.height, node.rotation);
|
|
@@ -19,8 +19,8 @@ function computeSnap(movingIds, movingBounds, allNodes, threshold = DEFAULT_SNAP
|
|
|
19
19
|
bottom: movingBounds.y + movingBounds.height,
|
|
20
20
|
centerY: movingBounds.y + movingBounds.height / 2
|
|
21
21
|
};
|
|
22
|
-
let bestDx =
|
|
23
|
-
let bestDy =
|
|
22
|
+
let bestDx = 1e400;
|
|
23
|
+
let bestDy = 1e400;
|
|
24
24
|
const guides = [];
|
|
25
25
|
for (const target of targets) {
|
|
26
26
|
const t = getEdges(target);
|
|
@@ -86,10 +86,10 @@ function computeSnap(movingIds, movingBounds, allNodes, threshold = DEFAULT_SNAP
|
|
|
86
86
|
}
|
|
87
87
|
function computeSelectionBounds(nodes) {
|
|
88
88
|
if (nodes.length === 0) return null;
|
|
89
|
-
let minX =
|
|
90
|
-
let minY =
|
|
91
|
-
let maxX = -
|
|
92
|
-
let maxY = -
|
|
89
|
+
let minX = 1e400;
|
|
90
|
+
let minY = 1e400;
|
|
91
|
+
let maxX = -1e400;
|
|
92
|
+
let maxY = -1e400;
|
|
93
93
|
for (const n of nodes) {
|
|
94
94
|
const edges = getEdges(n);
|
|
95
95
|
minX = Math.min(minX, edges.left);
|
|
@@ -104,7 +104,6 @@ function computeSelectionBounds(nodes) {
|
|
|
104
104
|
height: maxY - minY
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
|
-
//#endregion
|
|
108
107
|
export { computeSelectionBounds, computeSnap };
|
|
109
108
|
|
|
110
109
|
//# sourceMappingURL=snap.js.map
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import { SceneNode } from "./types.js";
|
|
2
|
-
|
|
3
|
-
declare function markSourceFieldsEdited(node: SceneNode, changeKeys: string[]): void;
|
|
4
|
-
//#endregion
|
|
5
|
-
export { markSourceFieldsEdited };
|
|
2
|
+
export declare function markSourceFieldsEdited(node: SceneNode, changeKeys: string[]): void;
|
|
6
3
|
//# sourceMappingURL=source-metadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-metadata.d.ts","names":[],"sources":["../src/source-metadata.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"source-metadata.d.ts","names":[],"sources":["../src/source-metadata.ts"],"mappings":";wBAEgB,uBAAuB,MAAM,WAAW"}
|
package/dist/source-metadata.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
// src/source-metadata.ts
|
|
2
2
|
function markSourceFieldsEdited(node, changeKeys) {
|
|
3
3
|
if (changeKeys.length === 0) return;
|
|
4
4
|
const editedFields = new Set(node.source.editedFields);
|
|
5
5
|
for (const key of changeKeys) editedFields.add(key);
|
|
6
6
|
node.source.editedFields = [...editedFields];
|
|
7
7
|
}
|
|
8
|
-
//#endregion
|
|
9
8
|
export { markSourceFieldsEdited };
|
|
10
9
|
|
|
11
10
|
//# sourceMappingURL=source-metadata.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { joinSpecBlocks, readSpecBlock, specBlockLayers, withSpecBlock } from "./model.js";
|
|
2
|
+
import { MAX_SPEC_SOURCE_LENGTH, SPEC_BLOCK_KINDS, SpecBlock, SpecBlockKind, specBlockSchema } from "./schema.js";
|
|
3
|
+
export { MAX_SPEC_SOURCE_LENGTH, SPEC_BLOCK_KINDS, SpecBlock, SpecBlockKind, joinSpecBlocks, readSpecBlock, specBlockLayers, specBlockSchema, withSpecBlock };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { joinSpecBlocks, readSpecBlock, specBlockLayers, withSpecBlock } from "./model.js";
|
|
2
|
+
import { MAX_SPEC_SOURCE_LENGTH, SPEC_BLOCK_KINDS, specBlockSchema } from "./schema.js";
|
|
3
|
+
export { MAX_SPEC_SOURCE_LENGTH, SPEC_BLOCK_KINDS, joinSpecBlocks, readSpecBlock, specBlockLayers, specBlockSchema, withSpecBlock };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SceneGraph } from "../graph.js";
|
|
2
|
+
import { SceneNode } from "../types.js";
|
|
3
|
+
import { SpecBlock } from "./schema.js";
|
|
4
|
+
type WithPluginData = Pick<SceneNode, 'pluginData'>;
|
|
5
|
+
/** The block a spec's sublayer draws, or null for any other layer. */
|
|
6
|
+
export declare function readSpecBlock(node: WithPluginData): SpecBlock | null;
|
|
7
|
+
/** The sublayer's plugin data with the block it draws set. */
|
|
8
|
+
export declare function withSpecBlock(node: WithPluginData, block: SpecBlock): SceneNode['pluginData'];
|
|
9
|
+
/** A spec's sublayers with the blocks they draw, in order; a sublayer without one is left out. */
|
|
10
|
+
export declare function specBlockLayers(graph: SceneGraph, spec: SceneNode): {
|
|
11
|
+
layer: SceneNode;
|
|
12
|
+
block: SpecBlock;
|
|
13
|
+
}[];
|
|
14
|
+
/**
|
|
15
|
+
* Markdown written from blocks, a blank line apart and ending in a newline, as a spec writes
|
|
16
|
+
* its Markdown back after a block is edited.
|
|
17
|
+
*/
|
|
18
|
+
export declare function joinSpecBlocks(blocks: readonly Pick<SpecBlock, 'source'>[]): string;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","names":[],"sources":["../../src/specs/model.ts"],"mappings":";;;KAMK,iBAAiB,KAAK;;wBAGX,cAAc,MAAM,iBAAiB;;wBAKrC,cAAc,MAAM,gBAAgB,OAAO,YAAY;;wBAKvD,gBACd,OAAO,YACP,MAAM;EACH,OAAO;EAAW,OAAO;;;;;;wBAWd,eAAe,iBAAiB,KAAK"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { readPluginData, withPluginData } from "../plugin-data/field.js";
|
|
2
|
+
import { OPEN_PENCIL_PLUGIN_DATA } from "../plugin-data/fields.js";
|
|
3
|
+
// src/specs/model.ts
|
|
4
|
+
/** The block a spec's sublayer draws, or null for any other layer. */
|
|
5
|
+
function readSpecBlock(node) {
|
|
6
|
+
return readPluginData(node.pluginData, OPEN_PENCIL_PLUGIN_DATA.specBlock) ?? null;
|
|
7
|
+
}
|
|
8
|
+
/** The sublayer's plugin data with the block it draws set. */
|
|
9
|
+
function withSpecBlock(node, block) {
|
|
10
|
+
return withPluginData(node.pluginData, OPEN_PENCIL_PLUGIN_DATA.specBlock, block);
|
|
11
|
+
}
|
|
12
|
+
/** A spec's sublayers with the blocks they draw, in order; a sublayer without one is left out. */
|
|
13
|
+
function specBlockLayers(graph, spec) {
|
|
14
|
+
return graph.getChildren(spec.id).flatMap((layer) => {
|
|
15
|
+
const block = readSpecBlock(layer);
|
|
16
|
+
return block ? [{
|
|
17
|
+
layer,
|
|
18
|
+
block
|
|
19
|
+
}] : [];
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Markdown written from blocks, a blank line apart and ending in a newline, as a spec writes
|
|
24
|
+
* its Markdown back after a block is edited.
|
|
25
|
+
*/
|
|
26
|
+
function joinSpecBlocks(blocks) {
|
|
27
|
+
const sources = blocks.map((block) => block.source.replace(/(?:\n[ \t]*)+$/, "")).filter((source) => source.trim() !== "");
|
|
28
|
+
return sources.length > 0 ? `${sources.join("\n\n")}\n` : "";
|
|
29
|
+
}
|
|
30
|
+
export { joinSpecBlocks, readSpecBlock, specBlockLayers, withSpecBlock };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","names":[],"sources":["../../src/specs/model.ts"],"sourcesContent":["import type { SceneGraph } from '../graph'\nimport { readPluginData, withPluginData } from '../plugin-data/field'\nimport { OPEN_PENCIL_PLUGIN_DATA } from '../plugin-data/fields'\nimport type { SceneNode } from '../types'\nimport type { SpecBlock } from './schema'\n\ntype WithPluginData = Pick<SceneNode, 'pluginData'>\n\n/** The block a spec's sublayer draws, or null for any other layer. */\nexport function readSpecBlock(node: WithPluginData): SpecBlock | null {\n return readPluginData(node.pluginData, OPEN_PENCIL_PLUGIN_DATA.specBlock) ?? null\n}\n\n/** The sublayer's plugin data with the block it draws set. */\nexport function withSpecBlock(node: WithPluginData, block: SpecBlock): SceneNode['pluginData'] {\n return withPluginData(node.pluginData, OPEN_PENCIL_PLUGIN_DATA.specBlock, block)\n}\n\n/** A spec's sublayers with the blocks they draw, in order; a sublayer without one is left out. */\nexport function specBlockLayers(\n graph: SceneGraph,\n spec: SceneNode\n): { layer: SceneNode; block: SpecBlock }[] {\n return graph.getChildren(spec.id).flatMap((layer) => {\n const block = readSpecBlock(layer)\n return block ? [{ layer, block }] : []\n })\n}\n\n/**\n * Markdown written from blocks, a blank line apart and ending in a newline, as a spec writes\n * its Markdown back after a block is edited.\n */\nexport function joinSpecBlocks(blocks: readonly Pick<SpecBlock, 'source'>[]): string {\n // A block keeps its first line's indent and its last line's spaces, as code needs.\n const sources = blocks\n .map((block) => block.source.replace(/(?:\\n[ \\t]*)+$/, ''))\n .filter((source) => source.trim() !== '')\n return sources.length > 0 ? `${sources.join('\\n\\n')}\\n` : ''\n}\n"],"mappings":";;;;AASA,SAAgB,cAAc,MAAwC;CACpE,OAAO,eAAe,KAAK,YAAY,wBAAwB,SAAS,KAAK;AAC/E;;AAGA,SAAgB,cAAc,MAAsB,OAA2C;CAC7F,OAAO,eAAe,KAAK,YAAY,wBAAwB,WAAW,KAAK;AACjF;;AAGA,SAAgB,gBACd,OACA,MAC0C;CAC1C,OAAO,MAAM,YAAY,KAAK,EAAE,CAAC,CAAC,SAAS,UAAU;EACnD,MAAM,QAAQ,cAAc,KAAK;EACjC,OAAO,QAAQ,CAAC;GAAE;GAAO;EAAM,CAAC,IAAI,CAAC;CACvC,CAAC;AACH;;;;;AAMA,SAAgB,eAAe,QAAsD;CAEnF,MAAM,UAAU,OACb,KAAK,UAAU,MAAM,OAAO,QAAQ,kBAAkB,EAAE,CAAC,CAAC,CAC1D,QAAQ,WAAW,OAAO,KAAK,MAAM,EAAE;CAC1C,OAAO,QAAQ,SAAS,IAAI,GAAG,QAAQ,KAAK,MAAM,EAAE,MAAM;AAC5D"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
/** The longest Markdown a spec keeps, in UTF-16 code units. */
|
|
3
|
+
export declare const MAX_SPEC_SOURCE_LENGTH = 1000000;
|
|
4
|
+
/**
|
|
5
|
+
* What a spec's block is, which decides the layer it is drawn as:
|
|
6
|
+
* - prose (`heading`, `paragraph`, `list`, `quote`) is a text edited in place;
|
|
7
|
+
* - `code` is a text in a code frame; `rule` a line;
|
|
8
|
+
* - `instance` is an instance of the component its `::instance` names;
|
|
9
|
+
* - `tokens` is a table of the variables of the collection its `::tokens` names, by mode;
|
|
10
|
+
* - `raw` is Markdown a spec has no layer for, such as a table or an unknown component, shown
|
|
11
|
+
* as its source and kept as written.
|
|
12
|
+
*/
|
|
13
|
+
export declare const SPEC_BLOCK_KINDS: readonly ["heading", "paragraph", "list", "quote", "code", "rule", "instance", "tokens", "raw"];
|
|
14
|
+
export type SpecBlockKind = (typeof SPEC_BLOCK_KINDS)[number];
|
|
15
|
+
/**
|
|
16
|
+
* One block of a spec, on the sublayer that draws it: its kind and the Markdown it was written
|
|
17
|
+
* as. A spec's Markdown is its blocks' in order; a block typed into records its new Markdown.
|
|
18
|
+
*/
|
|
19
|
+
export interface SpecBlock {
|
|
20
|
+
kind: SpecBlockKind;
|
|
21
|
+
source: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const specBlockSchema: v.GenericSchema<unknown, SpecBlock>;
|
|
24
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","names":[],"sources":["../../src/specs/schema.ts"],"mappings":";;qBAGa;;;;;;;;;;qBAWA;YAYD,wBAAwB;;;;;iBAQnB;EACf,MAAM;EACN;;qBAGW,iBAAiB,EAAE,uBAAuB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
// src/specs/schema.ts
|
|
3
|
+
/** The longest Markdown a spec keeps, in UTF-16 code units. */
|
|
4
|
+
const MAX_SPEC_SOURCE_LENGTH = 1e6;
|
|
5
|
+
/**
|
|
6
|
+
* What a spec's block is, which decides the layer it is drawn as:
|
|
7
|
+
* - prose (`heading`, `paragraph`, `list`, `quote`) is a text edited in place;
|
|
8
|
+
* - `code` is a text in a code frame; `rule` a line;
|
|
9
|
+
* - `instance` is an instance of the component its `::instance` names;
|
|
10
|
+
* - `tokens` is a table of the variables of the collection its `::tokens` names, by mode;
|
|
11
|
+
* - `raw` is Markdown a spec has no layer for, such as a table or an unknown component, shown
|
|
12
|
+
* as its source and kept as written.
|
|
13
|
+
*/
|
|
14
|
+
const SPEC_BLOCK_KINDS = [
|
|
15
|
+
"heading",
|
|
16
|
+
"paragraph",
|
|
17
|
+
"list",
|
|
18
|
+
"quote",
|
|
19
|
+
"code",
|
|
20
|
+
"rule",
|
|
21
|
+
"instance",
|
|
22
|
+
"tokens",
|
|
23
|
+
"raw"
|
|
24
|
+
];
|
|
25
|
+
const sourceSchema = v.pipe(v.string(), v.maxLength(MAX_SPEC_SOURCE_LENGTH));
|
|
26
|
+
const specBlockSchema = v.object({
|
|
27
|
+
kind: v.picklist(SPEC_BLOCK_KINDS),
|
|
28
|
+
source: sourceSchema
|
|
29
|
+
});
|
|
30
|
+
export { MAX_SPEC_SOURCE_LENGTH, SPEC_BLOCK_KINDS, specBlockSchema };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=schema.js.map
|