@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/generated/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { CONNECTOR_KIND } from "../connectors/sublayers.js";
|
|
2
2
|
import { SHAPE_WITH_TEXT_CORNER_RADIUS, SHAPE_WITH_TEXT_KIND, SHAPE_WITH_TEXT_LABEL_LAYOUT, SHAPE_WITH_TEXT_SIZE, buildShapeWithTextLabel, createShapeWithText, shapeWithTextFrameFields, shapeWithTextKindFields, shapeWithTextLabel, shapeWithTextLabelFields } from "./shape-with-text.js";
|
|
3
|
+
import { SPEC_CODE_FONT_FAMILY, SPEC_CODE_FONT_SIZE, SPEC_FONT_FAMILY, SPEC_FONT_SIZE, SPEC_FONT_WEIGHT, SPEC_KIND, SPEC_WIDTH, specBlockLayer, specBlockText, specCodeFrameFields, specFrameFields, specHeadingFields, specRuleFields, specTableCellFields, specTableFields, specTableRowFields, specTableSwatchFields, specTableTextFields, specTextFields } from "./spec.js";
|
|
3
4
|
import { DEFAULT_STICKY_COLOR, STICKY_AUTHOR_FONT_SIZE, STICKY_BODY_FONT_SIZE, STICKY_COLORS, STICKY_FONT_FAMILY, STICKY_FONT_WEIGHT, STICKY_KIND, STICKY_SIZE, STICKY_SUBLAYER_LAYOUT, STICKY_WIDE_WIDTH, buildStickySublayers, createSticky, isWideSticky, stickyFrameFields, stickyScale, stickyShadows, stickySublayers, stickyTextFields, stickyWidth } from "./sticky.js";
|
|
4
|
-
|
|
5
|
+
// src/generated/index.ts
|
|
5
6
|
/**
|
|
6
7
|
* Layers Figma generates from a template, which it calls immutable frames: their sublayers come
|
|
7
8
|
* from the type and its settings, and a user edits them only through the frame. A sticky note's
|
|
@@ -14,7 +15,8 @@ import { DEFAULT_STICKY_COLOR, STICKY_AUTHOR_FONT_SIZE, STICKY_BODY_FONT_SIZE, S
|
|
|
14
15
|
const GENERATED_FRAME_KINDS = {
|
|
15
16
|
SHAPE_WITH_TEXT: SHAPE_WITH_TEXT_KIND,
|
|
16
17
|
STICKY: STICKY_KIND,
|
|
17
|
-
CONNECTOR: CONNECTOR_KIND
|
|
18
|
+
CONNECTOR: CONNECTOR_KIND,
|
|
19
|
+
SPEC: SPEC_KIND
|
|
18
20
|
};
|
|
19
21
|
const GENERATED_FRAME_TYPES = new Set(Object.keys(GENERATED_FRAME_KINDS));
|
|
20
22
|
/** What a generated frame's type says about it, or undefined for any other layer. */
|
|
@@ -24,13 +26,33 @@ function generatedFrameKind(node) {
|
|
|
24
26
|
function isGeneratedFrame(node) {
|
|
25
27
|
return GENERATED_FRAME_TYPES.has(node.type);
|
|
26
28
|
}
|
|
27
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Whether `child` of the generated frame `frame` is a layer of its own, which the frame embeds
|
|
31
|
+
* rather than draws (`GeneratedFrameKind.embeds`).
|
|
32
|
+
*/
|
|
33
|
+
function embedsLayer(frame, child) {
|
|
34
|
+
return generatedFrameKind(frame)?.embeds?.(child) ?? false;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The generated frame a layer belongs to, if it is one of the sublayers the frame draws: none for
|
|
38
|
+
* a layer in or under one the frame embeds.
|
|
39
|
+
*/
|
|
28
40
|
function generatedFrameOwner(graph, node) {
|
|
29
|
-
|
|
41
|
+
if (!node.parentId) return void 0;
|
|
42
|
+
let child = node;
|
|
43
|
+
const frame = graph.closest(node.parentId, (candidate) => {
|
|
44
|
+
if (isGeneratedFrame(candidate)) return true;
|
|
45
|
+
child = candidate;
|
|
46
|
+
return false;
|
|
47
|
+
});
|
|
48
|
+
return frame && !embedsLayer(frame, child) ? frame : void 0;
|
|
30
49
|
}
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
50
|
+
/**
|
|
51
|
+
* The text a generated frame edits in place: a sticky note's body, a connector's label, or the
|
|
52
|
+
* block of a spec that holds `sublayer`.
|
|
53
|
+
*/
|
|
54
|
+
function generatedFrameText(graph, node, sublayer) {
|
|
55
|
+
return generatedFrameKind(node)?.text(graph, node, sublayer);
|
|
34
56
|
}
|
|
35
57
|
/**
|
|
36
58
|
* `changes` with what a width or height in them also sets on a generated frame
|
|
@@ -58,11 +80,17 @@ function layerMoves(node) {
|
|
|
58
80
|
function layerRotates(node) {
|
|
59
81
|
return !DECK_TYPES.has(node.type) && (generatedFrameKind(node)?.rotates ?? true);
|
|
60
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Whether a layer's auto layout is the person's to arrange, with its outlines and spacing
|
|
85
|
+
* handles: not a generated frame's, which places its own sublayers, nor a deck's rows and grid.
|
|
86
|
+
*/
|
|
87
|
+
function layoutIsArranged(node) {
|
|
88
|
+
return !DECK_TYPES.has(node.type) && !generatedFrameKind(node);
|
|
89
|
+
}
|
|
61
90
|
/** Whether a layer's resize handles and W and H fields resize it freely. */
|
|
62
91
|
function layerResizes(node) {
|
|
63
92
|
return !DECK_TYPES.has(node.type) && (generatedFrameKind(node)?.resizes ?? true);
|
|
64
93
|
}
|
|
65
|
-
|
|
66
|
-
export { DECK_TYPES, DEFAULT_STICKY_COLOR, GENERATED_FRAME_TYPES, SHAPE_WITH_TEXT_CORNER_RADIUS, SHAPE_WITH_TEXT_KIND, SHAPE_WITH_TEXT_LABEL_LAYOUT, SHAPE_WITH_TEXT_SIZE, STICKY_AUTHOR_FONT_SIZE, STICKY_BODY_FONT_SIZE, STICKY_COLORS, STICKY_FONT_FAMILY, STICKY_FONT_WEIGHT, STICKY_KIND, STICKY_SIZE, STICKY_SUBLAYER_LAYOUT, STICKY_WIDE_WIDTH, buildShapeWithTextLabel, buildStickySublayers, createShapeWithText, createSticky, generatedFrameKind, generatedFrameOwner, generatedFrameText, isGeneratedFrame, isWideSticky, layerMoves, layerResizes, layerRotates, shapeWithTextFrameFields, shapeWithTextKindFields, shapeWithTextLabel, shapeWithTextLabelFields, stickyFrameFields, stickyScale, stickyShadows, stickySublayers, stickyTextFields, stickyWidth, withGeneratedFrameSize };
|
|
94
|
+
export { DECK_TYPES, DEFAULT_STICKY_COLOR, GENERATED_FRAME_TYPES, SHAPE_WITH_TEXT_CORNER_RADIUS, SHAPE_WITH_TEXT_KIND, SHAPE_WITH_TEXT_LABEL_LAYOUT, SHAPE_WITH_TEXT_SIZE, SPEC_CODE_FONT_FAMILY, SPEC_CODE_FONT_SIZE, SPEC_FONT_FAMILY, SPEC_FONT_SIZE, SPEC_FONT_WEIGHT, SPEC_KIND, SPEC_WIDTH, STICKY_AUTHOR_FONT_SIZE, STICKY_BODY_FONT_SIZE, STICKY_COLORS, STICKY_FONT_FAMILY, STICKY_FONT_WEIGHT, STICKY_KIND, STICKY_SIZE, STICKY_SUBLAYER_LAYOUT, STICKY_WIDE_WIDTH, buildShapeWithTextLabel, buildStickySublayers, createShapeWithText, createSticky, embedsLayer, generatedFrameKind, generatedFrameOwner, generatedFrameText, isGeneratedFrame, isWideSticky, layerMoves, layerResizes, layerRotates, layoutIsArranged, shapeWithTextFrameFields, shapeWithTextKindFields, shapeWithTextLabel, shapeWithTextLabelFields, specBlockLayer, specBlockText, specCodeFrameFields, specFrameFields, specHeadingFields, specRuleFields, specTableCellFields, specTableFields, specTableRowFields, specTableSwatchFields, specTableTextFields, specTextFields, stickyFrameFields, stickyScale, stickyShadows, stickySublayers, stickyTextFields, stickyWidth, withGeneratedFrameSize };
|
|
67
95
|
|
|
68
96
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/generated/index.ts"],"sourcesContent":["import { CONNECTOR_KIND } from '../connectors/sublayers'\nimport type { SceneGraph } from '../graph'\nimport type { NodeType, SceneNode } from '../types'\nimport type { GeneratedFrameKind } from './kind'\nimport { SHAPE_WITH_TEXT_KIND } from './shape-with-text'\nimport { STICKY_KIND } from './sticky'\n\n/**\n * Layers Figma generates from a template, which it calls immutable frames: their sublayers come\n * from the type and its settings, and a user edits them only through the frame. A sticky note's\n * body and author are such sublayers. They are real children here, so layout, drawing and text\n * editing treat them as any other layer, but nothing may add, move or remove them.\n *\n * Each type is described once, here; the editor and file formats ask it instead of testing for\n * the type.\n */\nconst GENERATED_FRAME_KINDS = {\n SHAPE_WITH_TEXT: SHAPE_WITH_TEXT_KIND,\n STICKY: STICKY_KIND,\n CONNECTOR: CONNECTOR_KIND\n} satisfies Partial<Record<NodeType, GeneratedFrameKind>>\n\n/** The layer types that are generated frames, for tables that must cover each of them. */\nexport type GeneratedFrameType = keyof typeof GENERATED_FRAME_KINDS\n\nexport const GENERATED_FRAME_TYPES: ReadonlySet<NodeType> = new Set(\n Object.keys(GENERATED_FRAME_KINDS) as GeneratedFrameType[]\n)\n\n/** What a generated frame's type says about it, or undefined for any other layer. */\nexport function generatedFrameKind(node: Pick<SceneNode, 'type'>): GeneratedFrameKind | undefined {\n return isGeneratedFrame(node) ? GENERATED_FRAME_KINDS[node.type] : undefined\n}\n\nexport function isGeneratedFrame<N extends Pick<SceneNode, 'type'>>(\n node: N\n): node is N & { type: GeneratedFrameType } {\n return GENERATED_FRAME_TYPES.has(node.type)\n}\n\n
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/generated/index.ts"],"sourcesContent":["import { CONNECTOR_KIND } from '../connectors/sublayers'\nimport type { SceneGraph } from '../graph'\nimport type { NodeType, SceneNode } from '../types'\nimport type { GeneratedFrameKind } from './kind'\nimport { SHAPE_WITH_TEXT_KIND } from './shape-with-text'\nimport { SPEC_KIND } from './spec'\nimport { STICKY_KIND } from './sticky'\n\n/**\n * Layers Figma generates from a template, which it calls immutable frames: their sublayers come\n * from the type and its settings, and a user edits them only through the frame. A sticky note's\n * body and author are such sublayers. They are real children here, so layout, drawing and text\n * editing treat them as any other layer, but nothing may add, move or remove them.\n *\n * Each type is described once, here; the editor and file formats ask it instead of testing for\n * the type.\n */\nconst GENERATED_FRAME_KINDS = {\n SHAPE_WITH_TEXT: SHAPE_WITH_TEXT_KIND,\n STICKY: STICKY_KIND,\n CONNECTOR: CONNECTOR_KIND,\n SPEC: SPEC_KIND\n} satisfies Partial<Record<NodeType, GeneratedFrameKind>>\n\n/** The layer types that are generated frames, for tables that must cover each of them. */\nexport type GeneratedFrameType = keyof typeof GENERATED_FRAME_KINDS\n\nexport const GENERATED_FRAME_TYPES: ReadonlySet<NodeType> = new Set(\n Object.keys(GENERATED_FRAME_KINDS) as GeneratedFrameType[]\n)\n\n/** What a generated frame's type says about it, or undefined for any other layer. */\nexport function generatedFrameKind(node: Pick<SceneNode, 'type'>): GeneratedFrameKind | undefined {\n return isGeneratedFrame(node) ? GENERATED_FRAME_KINDS[node.type] : undefined\n}\n\nexport function isGeneratedFrame<N extends Pick<SceneNode, 'type'>>(\n node: N\n): node is N & { type: GeneratedFrameType } {\n return GENERATED_FRAME_TYPES.has(node.type)\n}\n\n/**\n * Whether `child` of the generated frame `frame` is a layer of its own, which the frame embeds\n * rather than draws (`GeneratedFrameKind.embeds`).\n */\nexport function embedsLayer(frame: SceneNode, child: SceneNode): boolean {\n return generatedFrameKind(frame)?.embeds?.(child) ?? false\n}\n\n/**\n * The generated frame a layer belongs to, if it is one of the sublayers the frame draws: none for\n * a layer in or under one the frame embeds.\n */\nexport function generatedFrameOwner(graph: SceneGraph, node: SceneNode): SceneNode | undefined {\n if (!node.parentId) return undefined\n // The frame's child the layer is or sits in, which tells whether the frame embeds it.\n let child = node\n const frame = graph.closest(node.parentId, (candidate) => {\n if (isGeneratedFrame(candidate)) return true\n child = candidate\n return false\n })\n return frame && !embedsLayer(frame, child) ? frame : undefined\n}\n\n/**\n * The text a generated frame edits in place: a sticky note's body, a connector's label, or the\n * block of a spec that holds `sublayer`.\n */\nexport function generatedFrameText(\n graph: SceneGraph,\n node: SceneNode,\n sublayer?: SceneNode\n): SceneNode | undefined {\n return generatedFrameKind(node)?.text(graph, node, sublayer)\n}\n\n/**\n * `changes` with what a width or height in them also sets on a generated frame\n * (`GeneratedFrameKind.sized`); fields `changes` sets itself, such as an undo restoring them, win.\n */\nexport function withGeneratedFrameSize(\n node: SceneNode,\n changes: Partial<SceneNode>\n): Partial<SceneNode> {\n const kind = generatedFrameKind(node)\n if (!kind?.sized || (changes.width === undefined && changes.height === undefined)) return changes\n return { ...kind.sized(changes, node), ...changes }\n}\n\n/** A deck's slides, and the rows and grid that lay them out: their size and place are the deck's. */\nexport const DECK_TYPES: ReadonlySet<NodeType> = new Set<NodeType>([\n 'SLIDE',\n 'SLIDE_ROW',\n 'SLIDE_GRID'\n])\n\n/** Whether a layer is placed by its X and Y: any but a deck's slides, rows, and grid. */\nexport function layerMoves(node: Pick<SceneNode, 'type'>): boolean {\n return !DECK_TYPES.has(node.type)\n}\n\n/** Whether a layer turns: any layer but a generated frame that stays upright, or a deck's slides. */\nexport function layerRotates(node: Pick<SceneNode, 'type'>): boolean {\n return !DECK_TYPES.has(node.type) && (generatedFrameKind(node)?.rotates ?? true)\n}\n\n/**\n * Whether a layer's auto layout is the person's to arrange, with its outlines and spacing\n * handles: not a generated frame's, which places its own sublayers, nor a deck's rows and grid.\n */\nexport function layoutIsArranged(node: Pick<SceneNode, 'type'>): boolean {\n return !DECK_TYPES.has(node.type) && !generatedFrameKind(node)\n}\n\n/** Whether a layer's resize handles and W and H fields resize it freely. */\nexport function layerResizes(node: Pick<SceneNode, 'type'>): boolean {\n return !DECK_TYPES.has(node.type) && (generatedFrameKind(node)?.resizes ?? true)\n}\n\nexport type { GeneratedFrameKind } from './kind'\nexport * from './shape-with-text'\nexport * from './spec'\nexport * from './sticky'\n"],"mappings":";;;;;;;;;;;;;;AAiBA,MAAM,wBAAwB;CAC5B,iBAAiB;CACjB,QAAQ;CACR,WAAW;CACX,MAAM;AACR;AAKA,MAAa,wBAA+C,IAAI,IAC9D,OAAO,KAAK,qBAAqB,CACnC;;AAGA,SAAgB,mBAAmB,MAA+D;CAChG,OAAO,iBAAiB,IAAI,IAAI,sBAAsB,KAAK,QAAQ,KAAA;AACrE;AAEA,SAAgB,iBACd,MAC0C;CAC1C,OAAO,sBAAsB,IAAI,KAAK,IAAI;AAC5C;;;;;AAMA,SAAgB,YAAY,OAAkB,OAA2B;CACvE,OAAO,mBAAmB,KAAK,CAAC,EAAE,SAAS,KAAK,KAAK;AACvD;;;;;AAMA,SAAgB,oBAAoB,OAAmB,MAAwC;CAC7F,IAAI,CAAC,KAAK,UAAU,OAAO,KAAA;CAE3B,IAAI,QAAQ;CACZ,MAAM,QAAQ,MAAM,QAAQ,KAAK,WAAW,cAAc;EACxD,IAAI,iBAAiB,SAAS,GAAG,OAAO;EACxC,QAAQ;EACR,OAAO;CACT,CAAC;CACD,OAAO,SAAS,CAAC,YAAY,OAAO,KAAK,IAAI,QAAQ,KAAA;AACvD;;;;;AAMA,SAAgB,mBACd,OACA,MACA,UACuB;CACvB,OAAO,mBAAmB,IAAI,CAAC,EAAE,KAAK,OAAO,MAAM,QAAQ;AAC7D;;;;;AAMA,SAAgB,uBACd,MACA,SACoB;CACpB,MAAM,OAAO,mBAAmB,IAAI;CACpC,IAAI,CAAC,MAAM,SAAU,QAAQ,UAAU,KAAA,KAAa,QAAQ,WAAW,KAAA,GAAY,OAAO;CAC1F,OAAO;EAAE,GAAG,KAAK,MAAM,SAAS,IAAI;EAAG,GAAG;CAAQ;AACpD;;AAGA,MAAa,6BAAoC,IAAI,IAAc;CACjE;CACA;CACA;AACF,CAAC;;AAGD,SAAgB,WAAW,MAAwC;CACjE,OAAO,CAAC,WAAW,IAAI,KAAK,IAAI;AAClC;;AAGA,SAAgB,aAAa,MAAwC;CACnE,OAAO,CAAC,WAAW,IAAI,KAAK,IAAI,MAAM,mBAAmB,IAAI,CAAC,EAAE,WAAW;AAC7E;;;;;AAMA,SAAgB,iBAAiB,MAAwC;CACvE,OAAO,CAAC,WAAW,IAAI,KAAK,IAAI,KAAK,CAAC,mBAAmB,IAAI;AAC/D;;AAGA,SAAgB,aAAa,MAAwC;CACnE,OAAO,CAAC,WAAW,IAAI,KAAK,IAAI,MAAM,mBAAmB,IAAI,CAAC,EAAE,WAAW;AAC7E"}
|
package/dist/generated/kind.d.ts
CHANGED
|
@@ -1,27 +1,38 @@
|
|
|
1
1
|
import { SceneGraph } from "../graph.js";
|
|
2
2
|
import { SceneNode } from "../types.js";
|
|
3
|
-
//#region src/generated/kind.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* What the editor and file formats need to know about one type of generated frame, so they ask
|
|
6
5
|
* the type rather than test for it. Each type defines one in its own module.
|
|
7
6
|
*/
|
|
8
|
-
interface GeneratedFrameKind {
|
|
7
|
+
export interface GeneratedFrameKind {
|
|
9
8
|
/** Whether the frame still has its template's layers; one that lost them is a plain frame. */
|
|
10
9
|
complete(graph: SceneGraph, frame: SceneNode): boolean;
|
|
11
|
-
/**
|
|
12
|
-
|
|
10
|
+
/**
|
|
11
|
+
* The text a user types into in place: on double-click or Enter, and as a script's `text`. A
|
|
12
|
+
* frame with several texts, such as a spec's blocks, gives the one holding `sublayer`, the
|
|
13
|
+
* sublayer a double-click landed on, and its first without one.
|
|
14
|
+
*/
|
|
15
|
+
text(graph: SceneGraph, frame: SceneNode, sublayer?: SceneNode): SceneNode | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Whether `child`, one of the frame's own children, is a layer of its own rather than one the
|
|
18
|
+
* frame draws: selected, drilled into, and edited as anywhere else, as a spec's instance is.
|
|
19
|
+
*/
|
|
20
|
+
embeds?(child: SceneNode): boolean;
|
|
13
21
|
/** Whether the frame turns; FigJam keeps sticky notes upright. */
|
|
14
22
|
rotates: boolean;
|
|
15
23
|
/** Whether the frame's resize handles and W and H fields resize it freely. */
|
|
16
24
|
resizes: boolean;
|
|
17
25
|
/** Whether it takes its name from its text until the user names it, as a sticky note does. */
|
|
18
26
|
namedByText: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* What a double-click into its text selects: all of it, as FigJam selects a note's body, or
|
|
29
|
+
* a caret where the click landed, as in a document.
|
|
30
|
+
*/
|
|
31
|
+
textSelection: 'all' | 'caret';
|
|
19
32
|
/**
|
|
20
33
|
* What a width or height set on `frame` from outside layout also sets on it, such as the height
|
|
21
34
|
* a shape with text was given, which layout grows it from.
|
|
22
35
|
*/
|
|
23
36
|
sized?(changes: Partial<SceneNode>, frame: SceneNode): Partial<SceneNode>;
|
|
24
37
|
}
|
|
25
|
-
//#endregion
|
|
26
|
-
export { GeneratedFrameKind };
|
|
27
38
|
//# sourceMappingURL=kind.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kind.d.ts","names":[],"sources":["../../src/generated/kind.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"kind.d.ts","names":[],"sources":["../../src/generated/kind.ts"],"mappings":";;;;;;iBAOiB;;EAEf,SAAS,OAAO,YAAY,OAAO;;;;;;EAMnC,KAAK,OAAO,YAAY,OAAO,WAAW,WAAW,YAAY;;;;;EAKjE,QAAQ,OAAO;;EAEf;;EAEA;;EAEA;;;;;EAKA;;;;;EAKA,OAAO,SAAS,QAAQ,YAAY,OAAO,YAAY,QAAQ"}
|
|
@@ -2,13 +2,12 @@ import { SceneGraph } from "../graph.js";
|
|
|
2
2
|
import { ShapeWithTextType } from "../shape-with-text/kinds.js";
|
|
3
3
|
import { SceneNode } from "../types.js";
|
|
4
4
|
import { GeneratedFrameKind } from "./kind.js";
|
|
5
|
-
//#region src/generated/shape-with-text.d.ts
|
|
6
5
|
/** FigJam makes a shape with text 176 px square, from its tool and from its plugin API. */
|
|
7
|
-
declare const SHAPE_WITH_TEXT_SIZE = 176;
|
|
6
|
+
export declare const SHAPE_WITH_TEXT_SIZE = 176;
|
|
8
7
|
/** FigJam rounds every corner of a shape by 6 px, but a rounded rectangle's. */
|
|
9
|
-
declare const SHAPE_WITH_TEXT_CORNER_RADIUS = 6;
|
|
8
|
+
export declare const SHAPE_WITH_TEXT_CORNER_RADIUS = 6;
|
|
10
9
|
/** How the label sits in its shape: as wide as the label box, as tall as its text. */
|
|
11
|
-
declare const SHAPE_WITH_TEXT_LABEL_LAYOUT: {
|
|
10
|
+
export declare const SHAPE_WITH_TEXT_LABEL_LAYOUT: {
|
|
12
11
|
readonly textAutoResize: "HEIGHT";
|
|
13
12
|
readonly layoutAlignSelf: "STRETCH";
|
|
14
13
|
};
|
|
@@ -17,27 +16,25 @@ declare const SHAPE_WITH_TEXT_LABEL_LAYOUT: {
|
|
|
17
16
|
* kind, which the padding leaves free. The padding follows the kind and size, so it is set again
|
|
18
17
|
* whenever either changes.
|
|
19
18
|
*/
|
|
20
|
-
declare function shapeWithTextFrameFields(kind: ShapeWithTextType, width: number, height: number): Partial<SceneNode>;
|
|
19
|
+
export declare function shapeWithTextFrameFields(kind: ShapeWithTextType, width: number, height: number): Partial<SceneNode>;
|
|
21
20
|
/**
|
|
22
21
|
* What turning a shape into `kind` changes, keeping its size, as FigJam's shape switcher does: the
|
|
23
22
|
* label area, and the corners a rounded rectangle leaves go back to FigJam's 6.
|
|
24
23
|
*/
|
|
25
|
-
declare function shapeWithTextKindFields(shape: Pick<SceneNode, 'shapeWithTextType' | 'width' | 'height'>, kind: ShapeWithTextType): Partial<SceneNode>;
|
|
24
|
+
export declare function shapeWithTextKindFields(shape: Pick<SceneNode, 'shapeWithTextType' | 'width' | 'height'>, kind: ShapeWithTextType): Partial<SceneNode>;
|
|
26
25
|
/** The label's text style as FigJam starts it: Inter Medium at its Small size, black at 80%. */
|
|
27
|
-
declare function shapeWithTextLabelFields(): Partial<SceneNode>;
|
|
26
|
+
export declare function shapeWithTextLabelFields(): Partial<SceneNode>;
|
|
28
27
|
/** A shape's label: its one text sublayer. */
|
|
29
|
-
declare function shapeWithTextLabel(graph: SceneGraph, shape: SceneNode): SceneNode | null;
|
|
28
|
+
export declare function shapeWithTextLabel(graph: SceneGraph, shape: SceneNode): SceneNode | null;
|
|
30
29
|
/**
|
|
31
30
|
* A shape with text edits its label in place, turns and resizes freely, and, as in FigJam, takes
|
|
32
31
|
* its name from its label until it is named. A height set on it by a resize, a field or a script
|
|
33
32
|
* is the height it was given, which layout grows it from when its label needs more room; once
|
|
34
33
|
* that height changes, FigJam keeps it and truncates the label instead.
|
|
35
34
|
*/
|
|
36
|
-
declare const SHAPE_WITH_TEXT_KIND: GeneratedFrameKind;
|
|
35
|
+
export declare const SHAPE_WITH_TEXT_KIND: GeneratedFrameKind;
|
|
37
36
|
/** Adds the label to a SHAPE_WITH_TEXT the caller created, styled as FigJam generates it. */
|
|
38
|
-
declare function buildShapeWithTextLabel(graph: SceneGraph, shape: SceneNode, props?: Partial<SceneNode>): SceneNode;
|
|
37
|
+
export declare function buildShapeWithTextLabel(graph: SceneGraph, shape: SceneNode, props?: Partial<SceneNode>): SceneNode;
|
|
39
38
|
/** A new shape with text and its label; the caller lays it out to grow it to its text. */
|
|
40
|
-
declare function createShapeWithText(graph: SceneGraph, parentId: string, props?: Partial<SceneNode>, label?: Partial<SceneNode>): SceneNode;
|
|
41
|
-
//#endregion
|
|
42
|
-
export { SHAPE_WITH_TEXT_CORNER_RADIUS, SHAPE_WITH_TEXT_KIND, SHAPE_WITH_TEXT_LABEL_LAYOUT, SHAPE_WITH_TEXT_SIZE, buildShapeWithTextLabel, createShapeWithText, shapeWithTextFrameFields, shapeWithTextKindFields, shapeWithTextLabel, shapeWithTextLabelFields };
|
|
39
|
+
export declare function createShapeWithText(graph: SceneGraph, parentId: string, props?: Partial<SceneNode>, label?: Partial<SceneNode>): SceneNode;
|
|
43
40
|
//# sourceMappingURL=shape-with-text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shape-with-text.d.ts","names":[],"sources":["../../src/generated/shape-with-text.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"shape-with-text.d.ts","names":[],"sources":["../../src/generated/shape-with-text.ts"],"mappings":";;;;;qBAUa;;qBAEA;;qBAWA;;;;;;;;;wBAUG,yBACd,MAAM,mBACN,eACA,iBACC,QAAQ;;;;;wBAwBK,wBACd,OAAO,KAAK,sDACZ,MAAM,oBACL,QAAQ;;wBAWK,4BAA4B,QAAQ;;wBAcpC,mBAAmB,OAAO,YAAY,OAAO,YAAY;;;;;;;qBAc5D,sBAAsB;;wBAcnB,wBACd,OAAO,YACP,OAAO,WACP,QAAO,QAAQ,aACd;;wBAea,oBACd,OAAO,YACP,kBACA,QAAO,QAAQ,YACf,QAAO,QAAQ,aACd"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BLACK } from "../constants.js";
|
|
2
|
-
import { lineHeightPixels } from "../text/lengths.js";
|
|
3
2
|
import { FIGJAM_TYPEFACES, figJamTextSizeFields } from "../figjam/text.js";
|
|
4
3
|
import { shapeWithTextLabelBox } from "../shape-with-text/fit.js";
|
|
5
|
-
|
|
4
|
+
import { lineHeightPixels } from "../text/lengths.js";
|
|
5
|
+
// src/generated/shape-with-text.ts
|
|
6
6
|
/** FigJam makes a shape with text 176 px square, from its tool and from its plugin API. */
|
|
7
7
|
const SHAPE_WITH_TEXT_SIZE = 176;
|
|
8
8
|
/** FigJam rounds every corner of a shape by 6 px, but a rounded rectangle's. */
|
|
@@ -92,6 +92,7 @@ const SHAPE_WITH_TEXT_KIND = {
|
|
|
92
92
|
rotates: true,
|
|
93
93
|
resizes: true,
|
|
94
94
|
namedByText: true,
|
|
95
|
+
textSelection: "all",
|
|
95
96
|
sized: ({ height }, shape) => height === void 0 || height === shape.height ? {} : {
|
|
96
97
|
shapeUserHeight: height,
|
|
97
98
|
shapeTruncates: true
|
|
@@ -129,7 +130,6 @@ function createShapeWithText(graph, parentId, props = {}, label = {}) {
|
|
|
129
130
|
buildShapeWithTextLabel(graph, shape, label);
|
|
130
131
|
return shape;
|
|
131
132
|
}
|
|
132
|
-
//#endregion
|
|
133
133
|
export { SHAPE_WITH_TEXT_CORNER_RADIUS, SHAPE_WITH_TEXT_KIND, SHAPE_WITH_TEXT_LABEL_LAYOUT, SHAPE_WITH_TEXT_SIZE, buildShapeWithTextLabel, createShapeWithText, shapeWithTextFrameFields, shapeWithTextKindFields, shapeWithTextLabel, shapeWithTextLabelFields };
|
|
134
134
|
|
|
135
135
|
//# sourceMappingURL=shape-with-text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shape-with-text.js","names":[],"sources":["../../src/generated/shape-with-text.ts"],"sourcesContent":["import { BLACK } from '../constants'\nimport { FIGJAM_TYPEFACES, figJamTextSizeFields } from '../figjam/text'\nimport type { SceneGraph } from '../index'\nimport { shapeWithTextLabelBox } from '../shape-with-text/fit'\nimport type { ShapeWithTextType } from '../shape-with-text/kinds'\nimport { lineHeightPixels } from '../text/lengths'\nimport type { Fill, SceneNode } from '../types'\nimport type { GeneratedFrameKind } from './kind'\n\n/** FigJam makes a shape with text 176 px square, from its tool and from its plugin API. */\nexport const SHAPE_WITH_TEXT_SIZE = 176\n/** FigJam rounds every corner of a shape by 6 px, but a rounded rectangle's. */\nexport const SHAPE_WITH_TEXT_CORNER_RADIUS = 6\n\n/**\n * FigJam keeps a rounded rectangle's corner radius at 0.4 of its shorter side, through resizes,\n * measured in FigJam; Figma draws the shape from that radius.\n */\nconst ROUNDED_RECTANGLE_RADIUS = 0.4\n\nconst LABEL_FILL: Fill = { type: 'SOLID', color: { ...BLACK }, opacity: 0.8, visible: true }\n\n/** How the label sits in its shape: as wide as the label box, as tall as its text. */\nexport const SHAPE_WITH_TEXT_LABEL_LAYOUT = {\n textAutoResize: 'HEIGHT',\n layoutAlignSelf: 'STRETCH'\n} as const satisfies Partial<SceneNode>\n\n/**\n * The shape's own layout: a vertical auto layout that centres the label in the label box of its\n * kind, which the padding leaves free. The padding follows the kind and size, so it is set again\n * whenever either changes.\n */\nexport function shapeWithTextFrameFields(\n kind: ShapeWithTextType,\n width: number,\n height: number\n): Partial<SceneNode> {\n const box = shapeWithTextLabelBox(kind, width, height)\n return {\n layoutMode: 'VERTICAL',\n primaryAxisAlign: 'CENTER',\n counterAxisAlign: 'CENTER',\n primaryAxisSizing: 'FIXED',\n counterAxisSizing: 'FIXED',\n itemSpacing: 0,\n paddingTop: box.y,\n paddingRight: Math.max(0, width - box.x - box.width),\n paddingBottom: Math.max(0, height - box.y - box.height),\n paddingLeft: box.x,\n clipsContent: false,\n ...(kind === 'ROUNDED_RECTANGLE'\n ? { cornerRadius: ROUNDED_RECTANGLE_RADIUS * Math.min(width, height) }\n : {})\n }\n}\n\n/**\n * What turning a shape into `kind` changes, keeping its size, as FigJam's shape switcher does: the\n * label area, and the corners a rounded rectangle leaves go back to FigJam's 6.\n */\nexport function shapeWithTextKindFields(\n shape: Pick<SceneNode, 'shapeWithTextType' | 'width' | 'height'>,\n kind: ShapeWithTextType\n): Partial<SceneNode> {\n const leavesRounded =\n shape.shapeWithTextType === 'ROUNDED_RECTANGLE' && kind !== shape.shapeWithTextType\n return {\n shapeWithTextType: kind,\n ...(leavesRounded ? { cornerRadius: SHAPE_WITH_TEXT_CORNER_RADIUS } : {}),\n ...shapeWithTextFrameFields(kind, shape.width, shape.height)\n }\n}\n\n/** The label's text style as FigJam starts it: Inter Medium at its Small size, black at 80%. */\nexport function shapeWithTextLabelFields(): Partial<SceneNode> {\n return {\n name: 'Text',\n fontFamily: FIGJAM_TYPEFACES.simple.fontFamily,\n fontWeight: FIGJAM_TYPEFACES.simple.fontWeight,\n ...figJamTextSizeFields('small'),\n textAlignHorizontal: 'CENTER',\n textAlignVertical: 'TOP',\n fills: [{ ...LABEL_FILL, color: { ...LABEL_FILL.color } }],\n ...SHAPE_WITH_TEXT_LABEL_LAYOUT\n }\n}\n\n/** A shape's label: its one text sublayer. */\nexport function shapeWithTextLabel(graph: SceneGraph, shape: SceneNode): SceneNode | null {\n if (shape.type !== 'SHAPE_WITH_TEXT') return null\n const children = graph.getChildren(shape.id)\n if (children.length !== 1) return null\n const [label] = children\n return label.type === 'TEXT' ? label : null\n}\n\n/**\n * A shape with text edits its label in place, turns and resizes freely, and, as in FigJam, takes\n * its name from its label until it is named. A height set on it by a resize, a field or a script\n * is the height it was given, which layout grows it from when its label needs more room; once\n * that height changes, FigJam keeps it and truncates the label instead.\n */\nexport const SHAPE_WITH_TEXT_KIND: GeneratedFrameKind = {\n complete: (graph, frame) => shapeWithTextLabel(graph, frame) !== null,\n text: (graph, frame) => shapeWithTextLabel(graph, frame) ?? undefined,\n rotates: true,\n resizes: true,\n namedByText: true,\n sized: ({ height }, shape) =>\n height === undefined || height === shape.height\n ? {}\n : { shapeUserHeight: height, shapeTruncates: true }\n}\n\n/** Adds the label to a SHAPE_WITH_TEXT the caller created, styled as FigJam generates it. */\nexport function buildShapeWithTextLabel(\n graph: SceneGraph,\n shape: SceneNode,\n props: Partial<SceneNode> = {}\n): SceneNode {\n const box = shapeWithTextLabelBox(shape.shapeWithTextType, shape.width, shape.height)\n const fields = shapeWithTextLabelFields()\n return graph.createNode('TEXT', shape.id, {\n ...fields,\n x: box.x,\n y: box.y,\n width: box.width,\n height: lineHeightPixels(fields.lineHeight ?? null, fields.fontSize ?? 0) ?? undefined,\n text: '',\n ...props\n })\n}\n\n/** A new shape with text and its label; the caller lays it out to grow it to its text. */\nexport function createShapeWithText(\n graph: SceneGraph,\n parentId: string,\n props: Partial<SceneNode> = {},\n label: Partial<SceneNode> = {}\n): SceneNode {\n const kind = props.shapeWithTextType ?? 'SQUARE'\n const width = props.width ?? SHAPE_WITH_TEXT_SIZE\n const height = props.height ?? SHAPE_WITH_TEXT_SIZE\n const shape = graph.createNode('SHAPE_WITH_TEXT', parentId, {\n name: 'Shape with text',\n cornerRadius: SHAPE_WITH_TEXT_CORNER_RADIUS,\n ...props,\n shapeWithTextType: kind,\n width,\n height,\n shapeUserHeight: props.shapeUserHeight ?? height,\n ...shapeWithTextFrameFields(kind, width, height)\n })\n buildShapeWithTextLabel(graph, shape, label)\n return shape\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"shape-with-text.js","names":[],"sources":["../../src/generated/shape-with-text.ts"],"sourcesContent":["import { BLACK } from '../constants'\nimport { FIGJAM_TYPEFACES, figJamTextSizeFields } from '../figjam/text'\nimport type { SceneGraph } from '../index'\nimport { shapeWithTextLabelBox } from '../shape-with-text/fit'\nimport type { ShapeWithTextType } from '../shape-with-text/kinds'\nimport { lineHeightPixels } from '../text/lengths'\nimport type { Fill, SceneNode } from '../types'\nimport type { GeneratedFrameKind } from './kind'\n\n/** FigJam makes a shape with text 176 px square, from its tool and from its plugin API. */\nexport const SHAPE_WITH_TEXT_SIZE = 176\n/** FigJam rounds every corner of a shape by 6 px, but a rounded rectangle's. */\nexport const SHAPE_WITH_TEXT_CORNER_RADIUS = 6\n\n/**\n * FigJam keeps a rounded rectangle's corner radius at 0.4 of its shorter side, through resizes,\n * measured in FigJam; Figma draws the shape from that radius.\n */\nconst ROUNDED_RECTANGLE_RADIUS = 0.4\n\nconst LABEL_FILL: Fill = { type: 'SOLID', color: { ...BLACK }, opacity: 0.8, visible: true }\n\n/** How the label sits in its shape: as wide as the label box, as tall as its text. */\nexport const SHAPE_WITH_TEXT_LABEL_LAYOUT = {\n textAutoResize: 'HEIGHT',\n layoutAlignSelf: 'STRETCH'\n} as const satisfies Partial<SceneNode>\n\n/**\n * The shape's own layout: a vertical auto layout that centres the label in the label box of its\n * kind, which the padding leaves free. The padding follows the kind and size, so it is set again\n * whenever either changes.\n */\nexport function shapeWithTextFrameFields(\n kind: ShapeWithTextType,\n width: number,\n height: number\n): Partial<SceneNode> {\n const box = shapeWithTextLabelBox(kind, width, height)\n return {\n layoutMode: 'VERTICAL',\n primaryAxisAlign: 'CENTER',\n counterAxisAlign: 'CENTER',\n primaryAxisSizing: 'FIXED',\n counterAxisSizing: 'FIXED',\n itemSpacing: 0,\n paddingTop: box.y,\n paddingRight: Math.max(0, width - box.x - box.width),\n paddingBottom: Math.max(0, height - box.y - box.height),\n paddingLeft: box.x,\n clipsContent: false,\n ...(kind === 'ROUNDED_RECTANGLE'\n ? { cornerRadius: ROUNDED_RECTANGLE_RADIUS * Math.min(width, height) }\n : {})\n }\n}\n\n/**\n * What turning a shape into `kind` changes, keeping its size, as FigJam's shape switcher does: the\n * label area, and the corners a rounded rectangle leaves go back to FigJam's 6.\n */\nexport function shapeWithTextKindFields(\n shape: Pick<SceneNode, 'shapeWithTextType' | 'width' | 'height'>,\n kind: ShapeWithTextType\n): Partial<SceneNode> {\n const leavesRounded =\n shape.shapeWithTextType === 'ROUNDED_RECTANGLE' && kind !== shape.shapeWithTextType\n return {\n shapeWithTextType: kind,\n ...(leavesRounded ? { cornerRadius: SHAPE_WITH_TEXT_CORNER_RADIUS } : {}),\n ...shapeWithTextFrameFields(kind, shape.width, shape.height)\n }\n}\n\n/** The label's text style as FigJam starts it: Inter Medium at its Small size, black at 80%. */\nexport function shapeWithTextLabelFields(): Partial<SceneNode> {\n return {\n name: 'Text',\n fontFamily: FIGJAM_TYPEFACES.simple.fontFamily,\n fontWeight: FIGJAM_TYPEFACES.simple.fontWeight,\n ...figJamTextSizeFields('small'),\n textAlignHorizontal: 'CENTER',\n textAlignVertical: 'TOP',\n fills: [{ ...LABEL_FILL, color: { ...LABEL_FILL.color } }],\n ...SHAPE_WITH_TEXT_LABEL_LAYOUT\n }\n}\n\n/** A shape's label: its one text sublayer. */\nexport function shapeWithTextLabel(graph: SceneGraph, shape: SceneNode): SceneNode | null {\n if (shape.type !== 'SHAPE_WITH_TEXT') return null\n const children = graph.getChildren(shape.id)\n if (children.length !== 1) return null\n const [label] = children\n return label.type === 'TEXT' ? label : null\n}\n\n/**\n * A shape with text edits its label in place, turns and resizes freely, and, as in FigJam, takes\n * its name from its label until it is named. A height set on it by a resize, a field or a script\n * is the height it was given, which layout grows it from when its label needs more room; once\n * that height changes, FigJam keeps it and truncates the label instead.\n */\nexport const SHAPE_WITH_TEXT_KIND: GeneratedFrameKind = {\n complete: (graph, frame) => shapeWithTextLabel(graph, frame) !== null,\n text: (graph, frame) => shapeWithTextLabel(graph, frame) ?? undefined,\n rotates: true,\n resizes: true,\n namedByText: true,\n textSelection: 'all',\n sized: ({ height }, shape) =>\n height === undefined || height === shape.height\n ? {}\n : { shapeUserHeight: height, shapeTruncates: true }\n}\n\n/** Adds the label to a SHAPE_WITH_TEXT the caller created, styled as FigJam generates it. */\nexport function buildShapeWithTextLabel(\n graph: SceneGraph,\n shape: SceneNode,\n props: Partial<SceneNode> = {}\n): SceneNode {\n const box = shapeWithTextLabelBox(shape.shapeWithTextType, shape.width, shape.height)\n const fields = shapeWithTextLabelFields()\n return graph.createNode('TEXT', shape.id, {\n ...fields,\n x: box.x,\n y: box.y,\n width: box.width,\n height: lineHeightPixels(fields.lineHeight ?? null, fields.fontSize ?? 0) ?? undefined,\n text: '',\n ...props\n })\n}\n\n/** A new shape with text and its label; the caller lays it out to grow it to its text. */\nexport function createShapeWithText(\n graph: SceneGraph,\n parentId: string,\n props: Partial<SceneNode> = {},\n label: Partial<SceneNode> = {}\n): SceneNode {\n const kind = props.shapeWithTextType ?? 'SQUARE'\n const width = props.width ?? SHAPE_WITH_TEXT_SIZE\n const height = props.height ?? SHAPE_WITH_TEXT_SIZE\n const shape = graph.createNode('SHAPE_WITH_TEXT', parentId, {\n name: 'Shape with text',\n cornerRadius: SHAPE_WITH_TEXT_CORNER_RADIUS,\n ...props,\n shapeWithTextType: kind,\n width,\n height,\n shapeUserHeight: props.shapeUserHeight ?? height,\n ...shapeWithTextFrameFields(kind, width, height)\n })\n buildShapeWithTextLabel(graph, shape, label)\n return shape\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { SceneGraph } from "../graph.js";
|
|
2
|
+
import { Color } from "../primitives/index.js";
|
|
3
|
+
import { SpecBlockKind } from "../specs/schema.js";
|
|
4
|
+
import { SceneNode } from "../types.js";
|
|
5
|
+
import { GeneratedFrameKind } from "./kind.js";
|
|
6
|
+
/**
|
|
7
|
+
* A spec as OpenPencil draws it: a white page of fixed width that grows to fit its blocks, one
|
|
8
|
+
* sublayer per block of its Markdown, stacked by a vertical auto layout.
|
|
9
|
+
*/
|
|
10
|
+
export declare const SPEC_WIDTH = 720;
|
|
11
|
+
export declare const SPEC_FONT_FAMILY = "Inter";
|
|
12
|
+
export declare const SPEC_FONT_SIZE = 16;
|
|
13
|
+
export declare const SPEC_FONT_WEIGHT = 400;
|
|
14
|
+
export declare const SPEC_CODE_FONT_FAMILY = "Roboto Mono";
|
|
15
|
+
export declare const SPEC_CODE_FONT_SIZE = 14;
|
|
16
|
+
/** The spec's own fields: the page, its padding, and the auto layout that stacks its blocks. */
|
|
17
|
+
export declare function specFrameFields(): Partial<SceneNode>;
|
|
18
|
+
/** A prose block's text: as wide as the page allows and as tall as its text. */
|
|
19
|
+
export declare function specTextFields(kind: SpecBlockKind): Partial<SceneNode>;
|
|
20
|
+
/** A heading's own style, which its text is set in and its Markdown is written relative to. */
|
|
21
|
+
export declare function specHeadingFields(level: number): Pick<SceneNode, 'fontSize' | 'fontWeight' | 'lineHeight'>;
|
|
22
|
+
/** The frame a code block's text sits in. */
|
|
23
|
+
export declare function specCodeFrameFields(): Partial<SceneNode>;
|
|
24
|
+
/** A `::tokens` table: rows stacked as wide as the page, in a rounded outline. */
|
|
25
|
+
export declare function specTableFields(): Partial<SceneNode>;
|
|
26
|
+
/** A row of a table, its cells side by side; the header row is shaded as code is. */
|
|
27
|
+
export declare function specTableRowFields(header: boolean): Partial<SceneNode>;
|
|
28
|
+
/** A cell of a table: an equal share of its row, its contents side by side. */
|
|
29
|
+
export declare function specTableCellFields(): Partial<SceneNode>;
|
|
30
|
+
/** A cell's words; a header's are muted and a value's set in the code face. */
|
|
31
|
+
export declare function specTableTextFields(cell: 'header' | 'name' | 'value'): Partial<SceneNode>;
|
|
32
|
+
/** The swatch before a colour's value in a table. */
|
|
33
|
+
export declare function specTableSwatchFields(color: Color): Partial<SceneNode>;
|
|
34
|
+
/** A horizontal rule: a hairline as wide as the page. */
|
|
35
|
+
export declare function specRuleFields(): Partial<SceneNode>;
|
|
36
|
+
/** The spec's sublayer that `node` is or sits in. */
|
|
37
|
+
export declare function specBlockLayer(graph: SceneGraph, spec: SceneNode, node: SceneNode): SceneNode | undefined;
|
|
38
|
+
/** The text of a spec's block typed into in place, or none for blocks drawn otherwise. */
|
|
39
|
+
export declare function specBlockText(graph: SceneGraph, layer: SceneNode): SceneNode | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* A spec is edited block by block, in the text of the block a double-click lands on; it resizes
|
|
42
|
+
* only in width, its height following its blocks.
|
|
43
|
+
*/
|
|
44
|
+
export declare const SPEC_KIND: GeneratedFrameKind;
|
|
45
|
+
//# sourceMappingURL=spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec.d.ts","names":[],"sources":["../../src/generated/spec.ts"],"mappings":";;;;;;;;;qBAYa;qBAMA;qBACA;qBACA;qBACA;qBACA;;wBAgCG,mBAAmB,QAAQ;;wBAoB3B,eAAe,MAAM,gBAAgB,QAAQ;;wBAoB7C,kBACd,gBACC,KAAK;;wBAMQ,uBAAuB,QAAQ;;wBAsB/B,mBAAmB,QAAQ;;wBAe3B,mBAAmB,kBAAkB,QAAQ;;wBAa7C,uBAAuB,QAAQ;;wBAiB/B,oBAAoB,oCAAoC,QAAQ;;wBAYhE,sBAAsB,OAAO,QAAQ,QAAQ;;wBAW7C,kBAAkB,QAAQ;;wBAa1B,eACd,OAAO,YACP,MAAM,WACN,MAAM,YACL;;wBAKa,cAAc,OAAO,YAAY,OAAO,YAAY;;;;;qBASvD,WAAW"}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { readSpecBlock } from "../specs/model.js";
|
|
2
|
+
import { percentLength } from "../text/lengths.js";
|
|
3
|
+
// src/generated/spec.ts
|
|
4
|
+
/**
|
|
5
|
+
* A spec as OpenPencil draws it: a white page of fixed width that grows to fit its blocks, one
|
|
6
|
+
* sublayer per block of its Markdown, stacked by a vertical auto layout.
|
|
7
|
+
*/
|
|
8
|
+
const SPEC_WIDTH = 720;
|
|
9
|
+
const SPEC_PADDING_X = 56;
|
|
10
|
+
const SPEC_PADDING_Y = 48;
|
|
11
|
+
const SPEC_BLOCK_GAP = 16;
|
|
12
|
+
const SPEC_RADIUS = 16;
|
|
13
|
+
const SPEC_FONT_FAMILY = "Inter";
|
|
14
|
+
const SPEC_FONT_SIZE = 16;
|
|
15
|
+
const SPEC_FONT_WEIGHT = 400;
|
|
16
|
+
const SPEC_CODE_FONT_FAMILY = "Roboto Mono";
|
|
17
|
+
const SPEC_CODE_FONT_SIZE = 14;
|
|
18
|
+
const SPEC_CODE_PADDING = 16;
|
|
19
|
+
const SPEC_CODE_RADIUS = 8;
|
|
20
|
+
const INK = {
|
|
21
|
+
r: .118,
|
|
22
|
+
g: .118,
|
|
23
|
+
b: .118,
|
|
24
|
+
a: 1
|
|
25
|
+
};
|
|
26
|
+
const MUTED_INK = {
|
|
27
|
+
r: .459,
|
|
28
|
+
g: .459,
|
|
29
|
+
b: .459,
|
|
30
|
+
a: 1
|
|
31
|
+
};
|
|
32
|
+
const CODE_BACKGROUND = {
|
|
33
|
+
r: .96,
|
|
34
|
+
g: .96,
|
|
35
|
+
b: .96,
|
|
36
|
+
a: 1
|
|
37
|
+
};
|
|
38
|
+
const RULE = {
|
|
39
|
+
r: .9,
|
|
40
|
+
g: .9,
|
|
41
|
+
b: .9,
|
|
42
|
+
a: 1
|
|
43
|
+
};
|
|
44
|
+
const WHITE = {
|
|
45
|
+
r: 1,
|
|
46
|
+
g: 1,
|
|
47
|
+
b: 1,
|
|
48
|
+
a: 1
|
|
49
|
+
};
|
|
50
|
+
function solid(color) {
|
|
51
|
+
return {
|
|
52
|
+
type: "SOLID",
|
|
53
|
+
color: { ...color },
|
|
54
|
+
opacity: 1,
|
|
55
|
+
visible: true
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function hairline() {
|
|
59
|
+
return {
|
|
60
|
+
...solid(RULE),
|
|
61
|
+
weight: 1,
|
|
62
|
+
align: "INSIDE"
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function shadow(y, radius, alpha) {
|
|
66
|
+
return {
|
|
67
|
+
type: "DROP_SHADOW",
|
|
68
|
+
color: {
|
|
69
|
+
r: 0,
|
|
70
|
+
g: 0,
|
|
71
|
+
b: 0,
|
|
72
|
+
a: alpha
|
|
73
|
+
},
|
|
74
|
+
offset: {
|
|
75
|
+
x: 0,
|
|
76
|
+
y
|
|
77
|
+
},
|
|
78
|
+
radius,
|
|
79
|
+
spread: 0,
|
|
80
|
+
visible: true,
|
|
81
|
+
blendMode: "NORMAL",
|
|
82
|
+
showShadowBehindNode: false
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/** The spec's own fields: the page, its padding, and the auto layout that stacks its blocks. */
|
|
86
|
+
function specFrameFields() {
|
|
87
|
+
return {
|
|
88
|
+
layoutMode: "VERTICAL",
|
|
89
|
+
primaryAxisAlign: "MIN",
|
|
90
|
+
counterAxisAlign: "MIN",
|
|
91
|
+
primaryAxisSizing: "HUG",
|
|
92
|
+
counterAxisSizing: "FIXED",
|
|
93
|
+
itemSpacing: SPEC_BLOCK_GAP,
|
|
94
|
+
paddingTop: SPEC_PADDING_Y,
|
|
95
|
+
paddingBottom: SPEC_PADDING_Y,
|
|
96
|
+
paddingLeft: SPEC_PADDING_X,
|
|
97
|
+
paddingRight: SPEC_PADDING_X,
|
|
98
|
+
cornerRadius: SPEC_RADIUS,
|
|
99
|
+
clipsContent: false,
|
|
100
|
+
fills: [solid(WHITE)],
|
|
101
|
+
effects: [shadow(1, 3, .08), shadow(4, 12, .06)]
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/** A prose block's text: as wide as the page allows and as tall as its text. */
|
|
105
|
+
function specTextFields(kind) {
|
|
106
|
+
const code = kind === "code" || kind === "raw";
|
|
107
|
+
return {
|
|
108
|
+
fontFamily: code ? SPEC_CODE_FONT_FAMILY : SPEC_FONT_FAMILY,
|
|
109
|
+
fontWeight: 400,
|
|
110
|
+
fontSize: code ? 14 : 16,
|
|
111
|
+
lineHeight: percentLength(150),
|
|
112
|
+
textAlignHorizontal: "LEFT",
|
|
113
|
+
textAlignVertical: "TOP",
|
|
114
|
+
textAutoResize: "HEIGHT",
|
|
115
|
+
layoutAlignSelf: "STRETCH",
|
|
116
|
+
fills: [solid(kind === "raw" || kind === "quote" ? MUTED_INK : INK)],
|
|
117
|
+
italic: kind === "quote"
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/** Heading sizes by level, 1 to 6; levels past the list take the last. */
|
|
121
|
+
const HEADING_SIZES = [
|
|
122
|
+
32,
|
|
123
|
+
24,
|
|
124
|
+
20,
|
|
125
|
+
17,
|
|
126
|
+
16,
|
|
127
|
+
16
|
|
128
|
+
];
|
|
129
|
+
/** A heading's own style, which its text is set in and its Markdown is written relative to. */
|
|
130
|
+
function specHeadingFields(level) {
|
|
131
|
+
return {
|
|
132
|
+
fontSize: HEADING_SIZES[Math.min(Math.max(level, 1), HEADING_SIZES.length) - 1],
|
|
133
|
+
fontWeight: level <= 2 ? 700 : 600,
|
|
134
|
+
lineHeight: percentLength(130)
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/** The frame a code block's text sits in. */
|
|
138
|
+
function specCodeFrameFields() {
|
|
139
|
+
return {
|
|
140
|
+
layoutMode: "VERTICAL",
|
|
141
|
+
primaryAxisSizing: "HUG",
|
|
142
|
+
counterAxisSizing: "FIXED",
|
|
143
|
+
layoutAlignSelf: "STRETCH",
|
|
144
|
+
paddingTop: SPEC_CODE_PADDING,
|
|
145
|
+
paddingBottom: SPEC_CODE_PADDING,
|
|
146
|
+
paddingLeft: SPEC_CODE_PADDING,
|
|
147
|
+
paddingRight: SPEC_CODE_PADDING,
|
|
148
|
+
cornerRadius: SPEC_CODE_RADIUS,
|
|
149
|
+
clipsContent: true,
|
|
150
|
+
fills: [solid(CODE_BACKGROUND)]
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
const SPEC_TABLE_CELL_PADDING_X = 12;
|
|
154
|
+
const SPEC_TABLE_CELL_PADDING_Y = 8;
|
|
155
|
+
const SPEC_TABLE_FONT_SIZE = 14;
|
|
156
|
+
const SPEC_TABLE_SWATCH = 14;
|
|
157
|
+
/** A `::tokens` table: rows stacked as wide as the page, in a rounded outline. */
|
|
158
|
+
function specTableFields() {
|
|
159
|
+
return {
|
|
160
|
+
layoutMode: "VERTICAL",
|
|
161
|
+
primaryAxisSizing: "HUG",
|
|
162
|
+
counterAxisSizing: "FIXED",
|
|
163
|
+
layoutAlignSelf: "STRETCH",
|
|
164
|
+
itemSpacing: 0,
|
|
165
|
+
cornerRadius: SPEC_CODE_RADIUS,
|
|
166
|
+
clipsContent: true,
|
|
167
|
+
fills: [],
|
|
168
|
+
strokes: [hairline()]
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
/** A row of a table, its cells side by side; the header row is shaded as code is. */
|
|
172
|
+
function specTableRowFields(header) {
|
|
173
|
+
return {
|
|
174
|
+
layoutMode: "HORIZONTAL",
|
|
175
|
+
primaryAxisSizing: "FIXED",
|
|
176
|
+
counterAxisSizing: "HUG",
|
|
177
|
+
counterAxisAlign: "CENTER",
|
|
178
|
+
layoutAlignSelf: "STRETCH",
|
|
179
|
+
itemSpacing: 0,
|
|
180
|
+
fills: header ? [solid(CODE_BACKGROUND)] : []
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
/** A cell of a table: an equal share of its row, its contents side by side. */
|
|
184
|
+
function specTableCellFields() {
|
|
185
|
+
return {
|
|
186
|
+
layoutMode: "HORIZONTAL",
|
|
187
|
+
primaryAxisSizing: "FIXED",
|
|
188
|
+
counterAxisSizing: "HUG",
|
|
189
|
+
counterAxisAlign: "CENTER",
|
|
190
|
+
layoutGrow: 1,
|
|
191
|
+
itemSpacing: 8,
|
|
192
|
+
paddingTop: SPEC_TABLE_CELL_PADDING_Y,
|
|
193
|
+
paddingBottom: SPEC_TABLE_CELL_PADDING_Y,
|
|
194
|
+
paddingLeft: SPEC_TABLE_CELL_PADDING_X,
|
|
195
|
+
paddingRight: SPEC_TABLE_CELL_PADDING_X,
|
|
196
|
+
fills: []
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
/** A cell's words; a header's are muted and a value's set in the code face. */
|
|
200
|
+
function specTableTextFields(cell) {
|
|
201
|
+
return {
|
|
202
|
+
fontFamily: cell === "value" ? SPEC_CODE_FONT_FAMILY : SPEC_FONT_FAMILY,
|
|
203
|
+
fontWeight: cell === "header" ? 600 : 400,
|
|
204
|
+
fontSize: SPEC_TABLE_FONT_SIZE,
|
|
205
|
+
lineHeight: percentLength(150),
|
|
206
|
+
textAutoResize: "WIDTH_AND_HEIGHT",
|
|
207
|
+
fills: [solid(cell === "header" ? MUTED_INK : INK)]
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
/** The swatch before a colour's value in a table. */
|
|
211
|
+
function specTableSwatchFields(color) {
|
|
212
|
+
return {
|
|
213
|
+
width: SPEC_TABLE_SWATCH,
|
|
214
|
+
height: SPEC_TABLE_SWATCH,
|
|
215
|
+
cornerRadius: 3,
|
|
216
|
+
fills: [{
|
|
217
|
+
type: "SOLID",
|
|
218
|
+
color: {
|
|
219
|
+
...color,
|
|
220
|
+
a: 1
|
|
221
|
+
},
|
|
222
|
+
opacity: color.a,
|
|
223
|
+
visible: true
|
|
224
|
+
}],
|
|
225
|
+
strokes: [hairline()]
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
/** A horizontal rule: a hairline as wide as the page. */
|
|
229
|
+
function specRuleFields() {
|
|
230
|
+
return {
|
|
231
|
+
height: 1,
|
|
232
|
+
layoutAlignSelf: "STRETCH",
|
|
233
|
+
fills: [solid(RULE)]
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
/** The text a block's sublayer is edited through: the sublayer itself or the text inside it. */
|
|
237
|
+
function blockText(graph, layer) {
|
|
238
|
+
if (layer.type === "TEXT") return layer;
|
|
239
|
+
return graph.getChildren(layer.id).find((child) => child.type === "TEXT");
|
|
240
|
+
}
|
|
241
|
+
const PROSE = /* @__PURE__ */ new Set([
|
|
242
|
+
"heading",
|
|
243
|
+
"paragraph",
|
|
244
|
+
"list",
|
|
245
|
+
"quote",
|
|
246
|
+
"code"
|
|
247
|
+
]);
|
|
248
|
+
/** The spec's sublayer that `node` is or sits in. */
|
|
249
|
+
function specBlockLayer(graph, spec, node) {
|
|
250
|
+
return graph.closest(node.id, (candidate) => candidate.parentId === spec.id);
|
|
251
|
+
}
|
|
252
|
+
/** The text of a spec's block typed into in place, or none for blocks drawn otherwise. */
|
|
253
|
+
function specBlockText(graph, layer) {
|
|
254
|
+
const block = readSpecBlock(layer);
|
|
255
|
+
return block && PROSE.has(block.kind) ? blockText(graph, layer) : void 0;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* A spec is edited block by block, in the text of the block a double-click lands on; it resizes
|
|
259
|
+
* only in width, its height following its blocks.
|
|
260
|
+
*/
|
|
261
|
+
const SPEC_KIND = {
|
|
262
|
+
complete: () => true,
|
|
263
|
+
text: (graph, frame, sublayer) => {
|
|
264
|
+
if (sublayer) {
|
|
265
|
+
const layer = specBlockLayer(graph, frame, sublayer);
|
|
266
|
+
return layer ? specBlockText(graph, layer) : void 0;
|
|
267
|
+
}
|
|
268
|
+
for (const layer of graph.getChildren(frame.id)) {
|
|
269
|
+
const text = specBlockText(graph, layer);
|
|
270
|
+
if (text) return text;
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
embeds: (child) => readSpecBlock(child)?.kind === "instance",
|
|
274
|
+
rotates: true,
|
|
275
|
+
resizes: true,
|
|
276
|
+
namedByText: false,
|
|
277
|
+
textSelection: "caret"
|
|
278
|
+
};
|
|
279
|
+
export { SPEC_CODE_FONT_FAMILY, SPEC_CODE_FONT_SIZE, SPEC_FONT_FAMILY, SPEC_FONT_SIZE, SPEC_FONT_WEIGHT, SPEC_KIND, SPEC_WIDTH, specBlockLayer, specBlockText, specCodeFrameFields, specFrameFields, specHeadingFields, specRuleFields, specTableCellFields, specTableFields, specTableRowFields, specTableSwatchFields, specTableTextFields, specTextFields };
|
|
280
|
+
|
|
281
|
+
//# sourceMappingURL=spec.js.map
|