@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.js","names":[],"sources":["../../src/shape-with-text/document.ts"],"sourcesContent":["import { pointAt, subPiece, type ConnectorPiece } from '../connectors/pieces'\nimport type { PolygonOutlineCommand } from '../polygon'\nimport type { Vector } from '../primitives'\n\n/**\n * How far above the bottom a document's wave meets its left and right sides, and how far its\n * crest rises, as FigJam draws it at every size. Below FigJam's least height the wave shrinks\n * with the page.\n */\nconst WAVE_LEFT = 16\nconst WAVE_RIGHT = 15\nconst WAVE_CREST = 31\nconst LEAST_HEIGHT = 80\n/** Bezier handle length for a quarter circle. */\nconst KAPPA = 0.5522847498\n/** Steps that measure a stretch of curve, and halvings that find where a length ends. */\nconst LENGTH_STEPS = 32\nconst SEARCH_STEPS = 30\nconst UP: Vector = { x: 0, y: -1 }\n\nfunction piece(from: Vector, c1: Vector, c2: Vector, to: Vector): ConnectorPiece {\n return {\n from,\n to,\n handleFrom: { x: c1.x - from.x, y: c1.y - from.y },\n handleTo: { x: c2.x - to.x, y: c2.y - to.y }\n }\n}\n\nfunction reversed(curve: ConnectorPiece): ConnectorPiece {\n return { from: curve.to, to: curve.from, handleFrom: curve.handleTo, handleTo: curve.handleFrom }\n}\n\n/** The bottom wave, right to left: up from the right side to its crest, down to its trough, up to the left side. */\nfunction wave(w: number, h: number): ConnectorPiece[] {\n const scale = Math.min(1, h / LEAST_HEIGHT)\n const left = { x: 0, y: h - WAVE_LEFT * scale }\n const trough = { x: (w * 13) / 48, y: h }\n const crest = { x: (w * 17) / 24, y: h - WAVE_CREST * scale }\n const right = { x: w, y: h - WAVE_RIGHT * scale }\n return [\n piece(right, right, { x: w * 0.854555, y: crest.y }, crest),\n piece(crest, { x: w * 0.5625, y: crest.y }, { x: w * 0.413004, y: h }, trough),\n piece(trough, { x: (w * 13) / 96, y: h }, left, left)\n ]\n}\n\nfunction unit(v: Vector): Vector {\n const length = Math.hypot(v.x, v.y)\n return length > 0 ? { x: v.x / length, y: v.y / length } : { x: 0, y: 0 }\n}\n\n/** The direction a curve leaves its start in, past handles of no length. */\nfunction leaving(curve: ConnectorPiece): Vector {\n const { from, to, handleFrom, handleTo } = curve\n const c1 = { x: from.x + handleFrom.x, y: from.y + handleFrom.y }\n const c2 = { x: to.x + handleTo.x, y: to.y + handleTo.y }\n for (const point of [c1, c2, to]) {\n const direction = unit({ x: point.x - from.x, y: point.y - from.y })\n if (direction.x !== 0 || direction.y !== 0) return direction\n }\n return { x: 0, y: 0 }\n}\n\n/** The length of a curve from its start to `t`. */\nfunction lengthTo(curve: ConnectorPiece, t: number): number {\n let length = 0\n let last = curve.from\n for (let step = 1; step <= LENGTH_STEPS; step++) {\n const point = pointAt(curve, (t * step) / LENGTH_STEPS)\n length += Math.hypot(point.x - last.x, point.y - last.y)\n last = point\n }\n return length\n}\n\n/** The parameter at `distance` along a curve from its start, by its length. */\nfunction parameterAt(curve: ConnectorPiece, distance: number): number {\n let low = 0\n let high = 1\n for (let step = 0; step < SEARCH_STEPS; step++) {\n const middle = (low + high) / 2\n if (lengthTo(curve, middle) < distance) low = middle\n else high = middle\n }\n return (low + high) / 2\n}\n\n/**\n * How far a corner of `radius` trims each side of a vertex whose sides leave it along `a` and\n * `b`, and how long its handles are. FigJam fits a circle to a blunt corner; a sharp one it trims\n * by the radius alone, with a quarter circle's handles.\n */\nfunction corner(a: Vector, b: Vector, radius: number): { trim: number; handle: number } {\n const angle = Math.acos(Math.max(-1, Math.min(1, a.x * b.x + a.y * b.y)))\n if (angle <= Math.PI / 2) return { trim: radius, handle: radius * KAPPA }\n return {\n trim: radius / Math.tan(angle / 2),\n handle: (4 / 3) * Math.tan((Math.PI - angle) / 4) * radius\n }\n}\n\nfunction curveTo(c1: Vector, c2: Vector, to: Vector): PolygonOutlineCommand {\n return { type: 'C', x1: c1.x, y1: c1.y, x2: c2.x, y2: c2.y, x: to.x, y: to.y }\n}\n\nfunction pieceTo(curve: ConnectorPiece): PolygonOutlineCommand {\n const { from, to, handleFrom, handleTo } = curve\n return curveTo(\n { x: from.x + handleFrom.x, y: from.y + handleFrom.y },\n { x: to.x + handleTo.x, y: to.y + handleTo.y },\n to\n )\n}\n\n/**\n * A single document as FigJam draws it: a page whose bottom is a wave of fixed height, every\n * corner rounded to `radius`, those where the wave meets the sides included.\n */\nexport function documentOutline(w: number, h: number, radius: number): PolygonOutlineCommand[] {\n const [fromRight, middle, toLeft] = wave(w, h)\n const r = Math.max(0, Math.min(radius, w / 2, h / 2))\n const k = r * (1 - KAPPA)\n const rightSide = fromRight.from\n const leftSide = toLeft.to\n const intoLeft = reversed(toLeft)\n\n // Each bottom corner trims the side and the wave by the same length, the side no further than\n // its top corner.\n const right = corner(UP, leaving(fromRight), r)\n const left = corner(UP, leaving(intoLeft), r)\n const rightTrim = Math.min(right.trim, (rightSide.y - r) / 2)\n const leftTrim = Math.min(left.trim, (leftSide.y - r) / 2)\n // A corner trimmed short of its radius shortens its handles with it.\n const rightHandle = right.trim > 0 ? (right.handle * rightTrim) / right.trim : 0\n const leftHandle = left.trim > 0 ? (left.handle * leftTrim) / left.trim : 0\n const first = r > 0 ? subPiece(fromRight, parameterAt(fromRight, rightTrim), 1) : fromRight\n const last = r > 0 ? subPiece(toLeft, 0, 1 - parameterAt(intoLeft, leftTrim)) : toLeft\n const rightEnd = { x: w, y: rightSide.y - rightTrim }\n const leftEnd = { x: 0, y: leftSide.y - leftTrim }\n\n const commands: PolygonOutlineCommand[] = [\n { type: 'M', x: r, y: 0 },\n { type: 'L', x: w - r, y: 0 },\n curveTo({ x: w - k, y: 0 }, { x: w, y: k }, { x: w, y: r }),\n { type: 'L', x: rightEnd.x, y: rightEnd.y }\n ]\n if (r > 0) {\n const back = unit({ x: -first.handleFrom.x, y: -first.handleFrom.y })\n commands.push(\n curveTo(\n { x: w, y: rightEnd.y + rightHandle },\n { x: first.from.x + back.x * rightHandle, y: first.from.y + back.y * rightHandle },\n first.from\n )\n )\n }\n commands.push(pieceTo(first), pieceTo(middle), pieceTo(last))\n if (r > 0) {\n const on = unit({ x: -last.handleTo.x, y: -last.handleTo.y })\n commands.push(\n curveTo(\n { x: last.to.x + on.x * leftHandle, y: last.to.y + on.y * leftHandle },\n { x: 0, y: leftEnd.y + leftHandle },\n leftEnd\n )\n )\n }\n commands.push(\n { type: 'L', x: 0, y: r },\n curveTo({ x: 0, y: k }, { x: k, y: 0 }, { x: r, y: 0 }),\n { type: 'Z' }\n )\n return commands\n}\n"],"mappings":";;;;;;;AASA,MAAM,YAAY;AAClB,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,MAAM,eAAe;;AAErB,MAAM,QAAQ;;AAEd,MAAM,eAAe;AACrB,MAAM,eAAe;AACrB,MAAM,KAAa;CAAE,GAAG;CAAG,GAAG;AAAG;AAEjC,SAAS,MAAM,MAAc,IAAY,IAAY,IAA4B;CAC/E,OAAO;EACL;EACA;EACA,YAAY;GAAE,GAAG,GAAG,IAAI,KAAK;GAAG,GAAG,GAAG,IAAI,KAAK;EAAE;EACjD,UAAU;GAAE,GAAG,GAAG,IAAI,GAAG;GAAG,GAAG,GAAG,IAAI,GAAG;EAAE;CAC7C;AACF;AAEA,SAAS,SAAS,OAAuC;CACvD,OAAO;EAAE,MAAM,MAAM;EAAI,IAAI,MAAM;EAAM,YAAY,MAAM;EAAU,UAAU,MAAM;CAAW;AAClG;;AAGA,SAAS,KAAK,GAAW,GAA6B;CACpD,MAAM,QAAQ,KAAK,IAAI,GAAG,IAAI,YAAY;CAC1C,MAAM,OAAO;EAAE,GAAG;EAAG,GAA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GAAG;GAAE,GAAG;GAAG,GAAG;EAAE,GAAG;GAAE,GAAG;GAAG,GAAG;EAAE,CAAC;EAC1D;GAAE,MAAM;GAAK,GAAG,SAAS;GAAG,GAAG,SAAS;EAAE;CAC5C;CACA,IAAI,IAAI,GAAG;EACT,MAAM,OAAO,KAAK;GAAE,GAAG,CAAC,MAAM,WAAW;GAAG,GAAG,CAAC,MAAM,WAAW;EAAE,CAAC;EACpE,SAAS,KACP,QACE;GAAE,GAAG;GAAG,GAAG,SAAS,IAAI;EAAY,GACpC;GAAE,GAAG,MAAM,KAAK,IAAI,KAAK,IAAI;GAAa,GAAG,MAAM,KAAK,IAAI,KAAK,IAAI;EAAY,GACjF,MAAM,IACR,CACF;CACF;CACA,SAAS,KAAK,QAAQ,KAAK,GAAG,QAAQ,MAAM,GAAG,QAAQ,IAAI,CAAC;CAC5D,IAAI,IAAI,GAAG;EACT,MAAM,KAAK,KAAK;GAAE,GAAG,CAAC,KAAK,SAAS;GAAG,GAAG,CAAC,KAAK,SAAS;EAAE,CAAC;EAC5D,SAAS,KACP,QACE;GAAE,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI;GAAY,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI;EAAW,GACrE;GAAE,GAAG;GAAG,GAAG,QAAQ,IAAI;EAAW,GAClC,OACF,CACF;CACF;CACA,SAAS,KACP;EAAE,MAAM;EAAK,GAAG;EAAG,GAAG;CAAE,GACxB,QAAQ;EAAE,GAAG;EAAG,GAAG;CAAE,GAAG;EAAE,GAAG;EAAG,GAAG;CAAE,GAAG;EAAE,GAAG;EAAG,GAAG;CAAE,CAAC,GACtD,EAAE,MAAM,IAAI,CACd;CACA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"document.js","names":[],"sources":["../../src/shape-with-text/document.ts"],"sourcesContent":["import { pointAt, subPiece, type ConnectorPiece } from '../connectors/pieces'\nimport { KAPPA } from '../geometry'\nimport { cubicTo, type PolygonOutlineCommand } from '../polygon'\nimport type { Vector } from '../primitives'\n\n/**\n * How far above the bottom a document's wave meets its left and right sides, and how far its\n * crest rises, as FigJam draws it at every size. Below FigJam's least height the wave shrinks\n * with the page.\n */\nconst WAVE_LEFT = 16\nconst WAVE_RIGHT = 15\nconst WAVE_CREST = 31\nconst LEAST_HEIGHT = 80\n/** Steps that measure a stretch of curve, and halvings that find where a length ends. */\nconst LENGTH_STEPS = 32\nconst SEARCH_STEPS = 30\nconst UP: Vector = { x: 0, y: -1 }\n\nfunction piece(from: Vector, c1: Vector, c2: Vector, to: Vector): ConnectorPiece {\n return {\n from,\n to,\n handleFrom: { x: c1.x - from.x, y: c1.y - from.y },\n handleTo: { x: c2.x - to.x, y: c2.y - to.y }\n }\n}\n\nfunction reversed(curve: ConnectorPiece): ConnectorPiece {\n return { from: curve.to, to: curve.from, handleFrom: curve.handleTo, handleTo: curve.handleFrom }\n}\n\n/** The bottom wave, right to left: up from the right side to its crest, down to its trough, up to the left side. */\nfunction wave(w: number, h: number): ConnectorPiece[] {\n const scale = Math.min(1, h / LEAST_HEIGHT)\n const left = { x: 0, y: h - WAVE_LEFT * scale }\n const trough = { x: (w * 13) / 48, y: h }\n const crest = { x: (w * 17) / 24, y: h - WAVE_CREST * scale }\n const right = { x: w, y: h - WAVE_RIGHT * scale }\n return [\n piece(right, right, { x: w * 0.854555, y: crest.y }, crest),\n piece(crest, { x: w * 0.5625, y: crest.y }, { x: w * 0.413004, y: h }, trough),\n piece(trough, { x: (w * 13) / 96, y: h }, left, left)\n ]\n}\n\nfunction unit(v: Vector): Vector {\n const length = Math.hypot(v.x, v.y)\n return length > 0 ? { x: v.x / length, y: v.y / length } : { x: 0, y: 0 }\n}\n\n/** The direction a curve leaves its start in, past handles of no length. */\nfunction leaving(curve: ConnectorPiece): Vector {\n const { from, to, handleFrom, handleTo } = curve\n const c1 = { x: from.x + handleFrom.x, y: from.y + handleFrom.y }\n const c2 = { x: to.x + handleTo.x, y: to.y + handleTo.y }\n for (const point of [c1, c2, to]) {\n const direction = unit({ x: point.x - from.x, y: point.y - from.y })\n if (direction.x !== 0 || direction.y !== 0) return direction\n }\n return { x: 0, y: 0 }\n}\n\n/** The length of a curve from its start to `t`. */\nfunction lengthTo(curve: ConnectorPiece, t: number): number {\n let length = 0\n let last = curve.from\n for (let step = 1; step <= LENGTH_STEPS; step++) {\n const point = pointAt(curve, (t * step) / LENGTH_STEPS)\n length += Math.hypot(point.x - last.x, point.y - last.y)\n last = point\n }\n return length\n}\n\n/** The parameter at `distance` along a curve from its start, by its length. */\nfunction parameterAt(curve: ConnectorPiece, distance: number): number {\n let low = 0\n let high = 1\n for (let step = 0; step < SEARCH_STEPS; step++) {\n const middle = (low + high) / 2\n if (lengthTo(curve, middle) < distance) low = middle\n else high = middle\n }\n return (low + high) / 2\n}\n\n/**\n * How far a corner of `radius` trims each side of a vertex whose sides leave it along `a` and\n * `b`, and how long its handles are. FigJam fits a circle to a blunt corner; a sharp one it trims\n * by the radius alone, with a quarter circle's handles.\n */\nfunction corner(a: Vector, b: Vector, radius: number): { trim: number; handle: number } {\n const angle = Math.acos(Math.max(-1, Math.min(1, a.x * b.x + a.y * b.y)))\n if (angle <= Math.PI / 2) return { trim: radius, handle: radius * KAPPA }\n return {\n trim: radius / Math.tan(angle / 2),\n handle: (4 / 3) * Math.tan((Math.PI - angle) / 4) * radius\n }\n}\n\nfunction pieceTo(curve: ConnectorPiece): PolygonOutlineCommand {\n const { from, to, handleFrom, handleTo } = curve\n return cubicTo(\n { x: from.x + handleFrom.x, y: from.y + handleFrom.y },\n { x: to.x + handleTo.x, y: to.y + handleTo.y },\n to\n )\n}\n\n/**\n * A single document as FigJam draws it: a page whose bottom is a wave of fixed height, every\n * corner rounded to `radius`, those where the wave meets the sides included.\n */\nexport function documentOutline(w: number, h: number, radius: number): PolygonOutlineCommand[] {\n const [fromRight, middle, toLeft] = wave(w, h)\n const r = Math.max(0, Math.min(radius, w / 2, h / 2))\n const k = r * (1 - KAPPA)\n const rightSide = fromRight.from\n const leftSide = toLeft.to\n const intoLeft = reversed(toLeft)\n\n // Each bottom corner trims the side and the wave by the same length, the side no further than\n // its top corner.\n const right = corner(UP, leaving(fromRight), r)\n const left = corner(UP, leaving(intoLeft), r)\n const rightTrim = Math.min(right.trim, (rightSide.y - r) / 2)\n const leftTrim = Math.min(left.trim, (leftSide.y - r) / 2)\n // A corner trimmed short of its radius shortens its handles with it.\n const rightHandle = right.trim > 0 ? (right.handle * rightTrim) / right.trim : 0\n const leftHandle = left.trim > 0 ? (left.handle * leftTrim) / left.trim : 0\n const first = r > 0 ? subPiece(fromRight, parameterAt(fromRight, rightTrim), 1) : fromRight\n const last = r > 0 ? subPiece(toLeft, 0, 1 - parameterAt(intoLeft, leftTrim)) : toLeft\n const rightEnd = { x: w, y: rightSide.y - rightTrim }\n const leftEnd = { x: 0, y: leftSide.y - leftTrim }\n\n const commands: PolygonOutlineCommand[] = [\n { type: 'M', x: r, y: 0 },\n { type: 'L', x: w - r, y: 0 },\n cubicTo({ x: w - k, y: 0 }, { x: w, y: k }, { x: w, y: r }),\n { type: 'L', x: rightEnd.x, y: rightEnd.y }\n ]\n if (r > 0) {\n const back = unit({ x: -first.handleFrom.x, y: -first.handleFrom.y })\n commands.push(\n cubicTo(\n { x: w, y: rightEnd.y + rightHandle },\n { x: first.from.x + back.x * rightHandle, y: first.from.y + back.y * rightHandle },\n first.from\n )\n )\n }\n commands.push(pieceTo(first), pieceTo(middle), pieceTo(last))\n if (r > 0) {\n const on = unit({ x: -last.handleTo.x, y: -last.handleTo.y })\n commands.push(\n cubicTo(\n { x: last.to.x + on.x * leftHandle, y: last.to.y + on.y * leftHandle },\n { x: 0, y: leftEnd.y + leftHandle },\n leftEnd\n )\n )\n }\n commands.push(\n { type: 'L', x: 0, y: r },\n cubicTo({ x: 0, y: k }, { x: k, y: 0 }, { x: r, y: 0 }),\n { type: 'Z' }\n )\n return commands\n}\n"],"mappings":";;;;;;;;;AAUA,MAAM,YAAY;AAClB,MAAM,aAAa;AACnB,MAA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CACF;CACF;CACA,SAAS,KACP;EAAE,MAAM;EAAK,GAAG;EAAG,GAAG;CAAE,GACxB,QAAQ;EAAE,GAAG;EAAG,GAAG;CAAE,GAAG;EAAE,GAAG;EAAG,GAAG;CAAE,GAAG;EAAE,GAAG;EAAG,GAAG;CAAE,CAAC,GACtD,EAAE,MAAM,IAAI,CACd;CACA,OAAO;AACT"}
|
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
import { ShapeWithTextType } from "./kinds.js";
|
|
2
|
-
//#region src/shape-with-text/fit.d.ts
|
|
3
2
|
/** The height of a database's elliptical cap: FigJam keeps it 24 px tall at any size. */
|
|
4
|
-
declare function databaseCap(w: number, h: number): number;
|
|
5
|
-
interface LabelBox {
|
|
3
|
+
export declare function databaseCap(w: number, h: number): number;
|
|
4
|
+
export interface LabelBox {
|
|
6
5
|
x: number;
|
|
7
6
|
y: number;
|
|
8
7
|
width: number;
|
|
9
8
|
height: number;
|
|
10
9
|
}
|
|
11
10
|
/** Where a shape's label sits inside its `width` × `height` box. */
|
|
12
|
-
declare function shapeWithTextLabelBox(type: ShapeWithTextType, width: number, height: number): LabelBox;
|
|
11
|
+
export declare function shapeWithTextLabelBox(type: ShapeWithTextType, width: number, height: number): LabelBox;
|
|
13
12
|
/** Measures a label wrapped at `maxWidth`; its height is what the wrapped lines take. */
|
|
14
|
-
type LabelMeasure = (maxWidth: number) => {
|
|
13
|
+
export type LabelMeasure = (maxWidth: number) => {
|
|
15
14
|
width: number;
|
|
16
15
|
height: number;
|
|
17
16
|
};
|
|
18
17
|
/** Whether a kind grows for its label; FigJam keeps summing junctions and ors round. */
|
|
19
|
-
declare function shapeWithTextGrows(type: ShapeWithTextType): boolean;
|
|
18
|
+
export declare function shapeWithTextGrows(type: ShapeWithTextType): boolean;
|
|
20
19
|
/**
|
|
21
20
|
* The height a `width`-wide shape of `type` takes for its label, as FigJam fits it: the height it
|
|
22
21
|
* was given while the label fits its label box, else the smallest whole height whose label box
|
|
23
22
|
* holds the label. FigJam never widens a shape for its label; a word too long for it breaks.
|
|
24
23
|
*/
|
|
25
|
-
declare function fitShapeWithTextHeight(type: ShapeWithTextType, width: number, height: number, measure: LabelMeasure): number;
|
|
26
|
-
//#endregion
|
|
27
|
-
export { LabelBox, LabelMeasure, databaseCap, fitShapeWithTextHeight, shapeWithTextGrows, shapeWithTextLabelBox };
|
|
24
|
+
export declare function fitShapeWithTextHeight(type: ShapeWithTextType, width: number, height: number, measure: LabelMeasure): number;
|
|
28
25
|
//# sourceMappingURL=fit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fit.d.ts","names":[],"sources":["../../src/shape-with-text/fit.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"fit.d.ts","names":[],"sources":["../../src/shape-with-text/fit.ts"],"mappings":";;wBAGgB,YAAY,WAAW;iBAItB;EACf;EACA;EACA;EACA;;;wBAgFc,sBACd,MAAM,mBACN,eACA,iBACC;;YAkBS,gBAAgB;EAAuB;EAAe;;;wBAKlD,mBAAmB,MAAM;;;;;;wBASzB,uBACd,MAAM,mBACN,eACA,gBACA,SAAS"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/shape-with-text/fit.ts
|
|
2
2
|
/** The height of a database's elliptical cap: FigJam keeps it 24 px tall at any size. */
|
|
3
3
|
function databaseCap(w, h) {
|
|
4
4
|
return Math.min(24, h * .25, w * .25);
|
|
@@ -265,7 +265,6 @@ function fitShapeWithTextHeight(type, width, height, measure) {
|
|
|
265
265
|
}
|
|
266
266
|
return Math.ceil(high);
|
|
267
267
|
}
|
|
268
|
-
//#endregion
|
|
269
268
|
export { databaseCap, fitShapeWithTextHeight, shapeWithTextGrows, shapeWithTextLabelBox };
|
|
270
269
|
|
|
271
270
|
//# sourceMappingURL=fit.js.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { ShapeWithTextType } from "./kinds.js";
|
|
2
|
-
import { SceneNode } from "../types.js";
|
|
3
1
|
import { PolygonOutlineCommand } from "../polygon.js";
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { SceneNode } from "../types.js";
|
|
3
|
+
import { ShapeWithTextType } from "./kinds.js";
|
|
4
|
+
export interface ShapeWithTextGeometry {
|
|
6
5
|
/** The closed outline that is filled and stroked, and that connectors attach to. */
|
|
7
6
|
outline: PolygonOutlineCommand[];
|
|
8
7
|
/** Inner lines that are stroked only, such as a database's front rim. */
|
|
@@ -12,21 +11,19 @@ interface ShapeWithTextGeometry {
|
|
|
12
11
|
* The band FigJam cuts out of a shape's fill along its outline and inner lines when no stroke
|
|
13
12
|
* draws them, so a database still shows its rim: half of it insets the outline.
|
|
14
13
|
*/
|
|
15
|
-
declare const SHAPE_WITH_TEXT_LINE_GAP = 3;
|
|
14
|
+
export declare const SHAPE_WITH_TEXT_LINE_GAP = 3;
|
|
16
15
|
/** How far a parallelogram's sides lean: FigJam leans them with the height, not the width. */
|
|
17
|
-
declare function parallelogramSlant(w: number, h: number): number;
|
|
16
|
+
export declare function parallelogramSlant(w: number, h: number): number;
|
|
18
17
|
/**
|
|
19
18
|
* The outline and inner lines of a shape of `type` filling a `width` × `height` box. Outlines
|
|
20
19
|
* made only of straight segments have their corners rounded to `cornerRadius`; outlines with
|
|
21
20
|
* curves, such as a rounded rectangle, keep their own shape.
|
|
22
21
|
*/
|
|
23
|
-
declare function shapeWithTextGeometry(type: ShapeWithTextType, width: number, height: number, cornerRadius?: number): ShapeWithTextGeometry;
|
|
22
|
+
export declare function shapeWithTextGeometry(type: ShapeWithTextType, width: number, height: number, cornerRadius?: number): ShapeWithTextGeometry;
|
|
24
23
|
/**
|
|
25
24
|
* Whether the shape's fill has its outline and inner lines cut out of it, as FigJam draws a shape
|
|
26
25
|
* with inner lines, such as a database, when no stroke draws them: it has inner lines and no
|
|
27
26
|
* visible stroke.
|
|
28
27
|
*/
|
|
29
|
-
declare function shapeWithTextCutsFill(node: Pick<SceneNode, 'type' | 'shapeWithTextType' | 'width' | 'height' | 'strokes'>): boolean;
|
|
30
|
-
//#endregion
|
|
31
|
-
export { SHAPE_WITH_TEXT_LINE_GAP, ShapeWithTextGeometry, parallelogramSlant, shapeWithTextCutsFill, shapeWithTextGeometry };
|
|
28
|
+
export declare function shapeWithTextCutsFill(node: Pick<SceneNode, 'type' | 'shapeWithTextType' | 'width' | 'height' | 'strokes'>): boolean;
|
|
32
29
|
//# sourceMappingURL=geometry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry.d.ts","names":[],"sources":["../../src/shape-with-text/geometry.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"geometry.d.ts","names":[],"sources":["../../src/shape-with-text/geometry.ts"],"mappings":";;;iBAOiB;;EAEf,SAAS;;EAET,SAAS;;;;;;qBAOE;;wBAyIG,mBAAmB,WAAW;;;;;;wBAmY9B,sBACd,MAAM,mBACN,eACA,gBACA,wBACC;;;;;;wBAYa,sBACd,MAAM,KAAK"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { drawsStroke } from "../geometry.js";
|
|
2
|
-
import { databaseCap } from "./fit.js";
|
|
1
|
+
import { KAPPA, drawsStroke } from "../geometry.js";
|
|
3
2
|
import { documentOutline } from "./document.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const KAPPA = .5522847498;
|
|
3
|
+
import { databaseCap } from "./fit.js";
|
|
4
|
+
// src/shape-with-text/geometry.ts
|
|
7
5
|
/**
|
|
8
6
|
* The band FigJam cuts out of a shape's fill along its outline and inner lines when no stroke
|
|
9
7
|
* draws them, so a database still shows its rim: half of it insets the outline.
|
|
@@ -69,7 +67,7 @@ function ellipse(x, y, w, h) {
|
|
|
69
67
|
}
|
|
70
68
|
function roundedRect(w, h, radius) {
|
|
71
69
|
const r = Math.max(0, Math.min(radius, w / 2, h / 2));
|
|
72
|
-
const k = r *
|
|
70
|
+
const k = r * (1 - KAPPA);
|
|
73
71
|
return [
|
|
74
72
|
{
|
|
75
73
|
type: "M",
|
|
@@ -595,7 +593,6 @@ function shapeWithTextCutsFill(node) {
|
|
|
595
593
|
if (node.strokes.some((stroke) => stroke.opacity > 0 && drawsStroke(node, stroke))) return false;
|
|
596
594
|
return shapeWithTextGeometry(node.shapeWithTextType, node.width, node.height).details.length > 0;
|
|
597
595
|
}
|
|
598
|
-
//#endregion
|
|
599
596
|
export { SHAPE_WITH_TEXT_LINE_GAP, parallelogramSlant, shapeWithTextCutsFill, shapeWithTextGeometry };
|
|
600
597
|
|
|
601
598
|
//# sourceMappingURL=geometry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry.js","names":[],"sources":["../../src/shape-with-text/geometry.ts"],"sourcesContent":["import { drawsStroke } from '../geometry'\nimport type { PolygonOutlineCommand } from '../polygon'\nimport type { SceneNode } from '../types'\nimport { documentOutline } from './document'\nimport { databaseCap } from './fit'\nimport type { ShapeWithTextType } from './kinds'\n\nexport interface ShapeWithTextGeometry {\n /** The closed outline that is filled and stroked, and that connectors attach to. */\n outline: PolygonOutlineCommand[]\n /** Inner lines that are stroked only, such as a database's front rim. */\n details: PolygonOutlineCommand[]\n}\n\n/** Bezier handle length for a quarter ellipse. */\nconst KAPPA = 0.5522847498\n\n/**\n * The band FigJam cuts out of a shape's fill along its outline and inner lines when no stroke\n * draws them, so a database still shows its rim: half of it insets the outline.\n */\nexport const SHAPE_WITH_TEXT_LINE_GAP = 3\n\n/** A folder's tab: its height, and how far its base reaches past the middle of the box. */\nconst FOLDER_TAB_HEIGHT = 44\nconst FOLDER_TAB_OVERHANG = 13\n/** How far the tab's sides lean in over its full height. */\nconst FOLDER_TAB_SLANT = 18\n/** How far a multiple document's front page sits right of and below its back page. */\nconst DOCUMENT_OFFSET = 16\n\ntype Point = readonly [number, number]\n\nfunction polygon(points: Point[]): PolygonOutlineCommand[] {\n const commands: PolygonOutlineCommand[] = points.map(([x, y], index) => ({\n type: index === 0 ? 'M' : 'L',\n x,\n y\n }))\n commands.push({ type: 'Z' })\n return commands\n}\n\nfunction line(from: Point, to: Point): PolygonOutlineCommand[] {\n return [\n { type: 'M', x: from[0], y: from[1] },\n { type: 'L', x: to[0], y: to[1] }\n ]\n}\n\nfunction curve(x1: number, y1: number, x2: number, y2: number, x: number, y: number) {\n return { type: 'C', x1, y1, x2, y2, x, y } as const\n}\n\nfunction ellipse(x: number, y: number, w: number, h: number): PolygonOutlineCommand[] {\n const rx = w / 2\n const ry = h / 2\n const cx = x + rx\n const cy = y + ry\n const kx = rx * KAPPA\n const ky = ry * KAPPA\n return [\n { type: 'M', x: cx, y },\n curve(cx + kx, y, x + w, cy - ky, x + w, cy),\n curve(x + w, cy + ky, cx + kx, y + h, cx, y + h),\n curve(cx - kx, y + h, x, cy + ky, x, cy),\n curve(x, cy - ky, cx - kx, y, cx, y),\n { type: 'Z' }\n ]\n}\n\nfunction roundedRect(w: number, h: number, radius: number): PolygonOutlineCommand[] {\n const r = Math.max(0, Math.min(radius, w / 2, h / 2))\n const k = r * (1 - KAPPA)\n return [\n { type: 'M', x: r, y: 0 },\n { type: 'L', x: w - r, y: 0 },\n curve(w - k, 0, w, k, w, r),\n { type: 'L', x: w, y: h - r },\n curve(w, h - k, w - k, h, w - r, h),\n { type: 'L', x: r, y: h },\n curve(k, h, 0, h - k, 0, h - r),\n { type: 'L', x: 0, y: r },\n curve(0, k, k, 0, r, 0),\n { type: 'Z' }\n ]\n}\n\n/** A page with a wavy bottom edge, the flowchart \"document\" symbol. */\nfunction documentPage(x: number, y: number, w: number, h: number): PolygonOutlineCommand[] {\n const wave = h * 0.1\n const base = y + h - wave\n return [\n { type: 'M', x, y },\n { type: 'L', x: x + w, y },\n { type: 'L', x: x + w, y: base },\n curve(x + w * 0.8, base - wave * 1.2, x + w * 0.7, base - wave * 1.2, x + w * 0.5, base),\n curve(x + w * 0.3, base + wave, x + w * 0.2, base + wave, x, base),\n { type: 'Z' }\n ]\n}\n\nfunction star(w: number, h: number): Point[] {\n const points: Point[] = []\n for (let i = 0; i < 10; i++) {\n const angle = -Math.PI / 2 + (i * Math.PI) / 5\n const radius = i % 2 === 0 ? 1 : 0.382\n points.push([\n w / 2 + (Math.cos(angle) * radius * w) / 2,\n h / 2 + (Math.sin(angle) * radius * h) / 2 + h * 0.05\n ])\n }\n return points\n}\n\n/** A point on the ellipse filling the box, at `angle` radians clockwise from the right. */\nfunction onEllipse(w: number, h: number, angle: number): Point {\n return [w / 2 + (Math.cos(angle) * w) / 2, h / 2 + (Math.sin(angle) * h) / 2]\n}\n\n/** A plain box with stroke-only inner lines. */\nfunction boxWithLines(\n w: number,\n h: number,\n details: PolygonOutlineCommand[]\n): ShapeWithTextGeometry {\n return {\n outline: polygon([\n [0, 0],\n [w, 0],\n [w, h],\n [0, h]\n ]),\n details\n }\n}\n\n/** A rounded box with a tail below its left side; the tail joins the bottom edge. */\nfunction speechBubble(w: number, h: number): PolygonOutlineCommand[] {\n const body = h * 0.8\n const box = roundedRect(w, body, Math.min(w, body) * 0.2)\n // The fifth command draws the bottom edge leftwards; the tail goes just before it.\n const tail: PolygonOutlineCommand[] = [\n { type: 'L', x: w * 0.38, y: body },\n { type: 'L', x: w * 0.18, y: h },\n { type: 'L', x: w * 0.22, y: body }\n ]\n return [...box.slice(0, 5), ...tail, ...box.slice(5)]\n}\n\nconst plain = (outline: PolygonOutlineCommand[]): ShapeWithTextGeometry => ({\n outline,\n details: []\n})\n\ntype Builder = (w: number, h: number, min: number, radius: number) => ShapeWithTextGeometry\n\n/** How far a parallelogram's sides lean: FigJam leans them with the height, not the width. */\nexport function parallelogramSlant(w: number, h: number): number {\n return Math.min(h * 0.43, w * 0.45)\n}\n\n/** Each kind's outline and inner lines for a `w` × `h` box, `min` being its shorter side. */\nconst BUILDERS: Record<ShapeWithTextType, Builder> = {\n SQUARE: (w, h) =>\n plain(\n polygon([\n [0, 0],\n [w, 0],\n [w, h],\n [0, h]\n ])\n ),\n ELLIPSE: (w, h) => plain(ellipse(0, 0, w, h)),\n DIAMOND: (w, h) =>\n plain(\n polygon([\n [w / 2, 0],\n [w, h / 2],\n [w / 2, h],\n [0, h / 2]\n ])\n ),\n TRIANGLE_UP: (w, h) =>\n plain(\n polygon([\n [w / 2, 0],\n [w, h],\n [0, h]\n ])\n ),\n TRIANGLE_DOWN: (w, h) =>\n plain(\n polygon([\n [0, 0],\n [w, 0],\n [w / 2, h]\n ])\n ),\n // FigJam rounds the ends to 0.4 of the shorter side, as its saved outlines show.\n ROUNDED_RECTANGLE: (w, h, min) => plain(roundedRect(w, h, min * 0.4)),\n PARALLELOGRAM_RIGHT: (w, h) => {\n const s = parallelogramSlant(w, h)\n return plain(\n polygon([\n [s, 0],\n [w, 0],\n [w - s, h],\n [0, h]\n ])\n )\n },\n PARALLELOGRAM_LEFT: (w, h) => {\n const s = parallelogramSlant(w, h)\n return plain(\n polygon([\n [0, 0],\n [w - s, 0],\n [w, h],\n [s, h]\n ])\n )\n },\n ENG_DATABASE: (w, h) => {\n const ry = databaseCap(w, h)\n const kx = (w / 2) * KAPPA\n const ky = ry * KAPPA\n return {\n outline: [\n { type: 'M', x: 0, y: ry },\n curve(0, ry - ky, w / 2 - kx, 0, w / 2, 0),\n curve(w / 2 + kx, 0, w, ry - ky, w, ry),\n { type: 'L', x: w, y: h - ry },\n curve(w, h - ry + ky, w / 2 + kx, h, w / 2, h),\n curve(w / 2 - kx, h, 0, h - ry + ky, 0, h - ry),\n { type: 'Z' }\n ],\n details: [\n { type: 'M', x: 0, y: ry },\n curve(0, ry + ky, w / 2 - kx, ry * 2, w / 2, ry * 2),\n curve(w / 2 + kx, ry * 2, w, ry + ky, w, ry)\n ]\n }\n },\n ENG_QUEUE: (w, h) => {\n const rx = Math.min(w * 0.15, h * 0.25)\n const kx = rx * KAPPA\n const ky = (h / 2) * KAPPA\n return {\n outline: [\n { type: 'M', x: rx, y: 0 },\n { type: 'L', x: w - rx, y: 0 },\n curve(w - rx + kx, 0, w, h / 2 - ky, w, h / 2),\n curve(w, h / 2 + ky, w - rx + kx, h, w - rx, h),\n { type: 'L', x: rx, y: h },\n curve(rx - kx, h, 0, h / 2 + ky, 0, h / 2),\n curve(0, h / 2 - ky, rx - kx, 0, rx, 0),\n { type: 'Z' }\n ],\n details: [\n { type: 'M', x: w - rx, y: 0 },\n curve(w - rx - kx, 0, w - rx * 2, h / 2 - ky, w - rx * 2, h / 2),\n curve(w - rx * 2, h / 2 + ky, w - rx - kx, h, w - rx, h)\n ]\n }\n },\n ENG_FILE: (w, h, min) => {\n const f = min * 0.25\n return {\n outline: polygon([\n [0, 0],\n [w - f, 0],\n [w, f],\n [w, h],\n [0, h]\n ]),\n details: [...line([w - f, 0], [w - f, f]), { type: 'L', x: w, y: f }]\n }\n },\n // A tab on the left of the box above a body; the line between them is the body's top edge.\n // The corners where tab and body meet stay sharp.\n ENG_FOLDER: (w, h, _min, radius) => {\n const tab = Math.min(FOLDER_TAB_HEIGHT, h)\n const base = Math.min(w / 2 + FOLDER_TAB_OVERHANG, w)\n const slant = Math.min((FOLDER_TAB_SLANT * tab) / FOLDER_TAB_HEIGHT, base / 2)\n return {\n outline: roundedPolygon(\n [\n [0, h],\n [0, tab],\n [slant, 0],\n [base - slant, 0],\n [base, tab],\n [w, tab],\n [w, h]\n ],\n [radius, 0, radius, radius, 0, radius, radius]\n ),\n details: line([0, tab], [base, tab])\n }\n },\n TRAPEZOID: (w, h) => {\n const s = Math.min(w * 0.2, h)\n return plain(\n polygon([\n [s, 0],\n [w - s, 0],\n [w, h],\n [0, h]\n ])\n )\n },\n PREDEFINED_PROCESS: (w, h) => {\n const e = Math.min(w * 0.1, h * 0.5)\n return boxWithLines(w, h, [...line([e, 0], [e, h]), ...line([w - e, 0], [w - e, h])])\n },\n SHIELD: (w, h) =>\n plain([\n { type: 'M', x: 0, y: 0 },\n { type: 'L', x: w, y: 0 },\n { type: 'L', x: w, y: h * 0.45 },\n curve(w, h * 0.75, w * 0.75, h * 0.9, w / 2, h),\n curve(w * 0.25, h * 0.9, 0, h * 0.75, 0, h * 0.45),\n { type: 'Z' }\n ]),\n DOCUMENT_SINGLE: (w, h, _min, radius) => plain(documentOutline(w, h, radius)),\n // A back page with a front page over its lower right; the front page's top and left edges,\n // where it lies over the back one, are the inner lines.\n DOCUMENT_MULTIPLE: (w, h, _min, radius) => {\n const o = Math.min(DOCUMENT_OFFSET, w / 4, h / 4)\n const front = documentPage(o, o, w - o, h - o)\n const wave = front.filter((command) => command.type === 'C')\n const base = wave.at(-1)?.y ?? h\n // The back page ends on the front page's left side, sloping down to it.\n const join = Math.min(h - 2 * o, base)\n const outline = roundedPolygon(\n [\n [0, 0],\n [w - o, 0],\n [w - o, o],\n [w, o],\n [w, base],\n [o, base],\n [o, join],\n [0, join - o / 4]\n ],\n [radius, radius, 0, radius, 0, 0, 0, radius]\n )\n // The straight edge along the bottom becomes the front page's wave.\n const bottom = outline.findIndex(\n (command) => command.type === 'L' && command.x === o && command.y === base\n )\n return {\n outline: [...outline.slice(0, bottom), ...wave, ...outline.slice(bottom + 1)],\n details: [...line([w - o, o], [o, o]), { type: 'L', x: o, y: join }]\n }\n },\n MANUAL_INPUT: (w, h) =>\n plain(\n polygon([\n [0, h * 0.25],\n [w, 0],\n [w, h],\n [0, h]\n ])\n ),\n HEXAGON: (w, h) => {\n const s = Math.min(w * 0.25, h * 0.5)\n return plain(\n polygon([\n [s, 0],\n [w - s, 0],\n [w, h / 2],\n [w - s, h],\n [s, h],\n [0, h / 2]\n ])\n )\n },\n CHEVRON: (w, h) => {\n const p = Math.min(w * 0.25, h * 0.5)\n return plain(\n polygon([\n [0, 0],\n [w - p, 0],\n [w, h / 2],\n [w - p, h],\n [0, h],\n [p, h / 2]\n ])\n )\n },\n PENTAGON: (w, h) =>\n plain(\n polygon([\n [w / 2, 0],\n [w, h * 0.38],\n [w * 0.81, h],\n [w * 0.19, h],\n [0, h * 0.38]\n ])\n ),\n OCTAGON: (w, h, min) => {\n const c = min * 0.29\n return plain(\n polygon([\n [c, 0],\n [w - c, 0],\n [w, c],\n [w, h - c],\n [w - c, h],\n [c, h],\n [0, h - c],\n [0, c]\n ])\n )\n },\n STAR: (w, h) => plain(polygon(star(w, h))),\n PLUS: (w, h) => {\n const a = w / 3\n const b = h / 3\n return plain(\n polygon([\n [a, 0],\n [a * 2, 0],\n [a * 2, b],\n [w, b],\n [w, b * 2],\n [a * 2, b * 2],\n [a * 2, h],\n [a, h],\n [a, b * 2],\n [0, b * 2],\n [0, b],\n [a, b]\n ])\n )\n },\n ARROW_RIGHT: (w, h) => {\n const head = Math.min(w * 0.4, h * 0.5)\n return plain(\n polygon([\n [0, h * 0.25],\n [w - head, h * 0.25],\n [w - head, 0],\n [w, h / 2],\n [w - head, h],\n [w - head, h * 0.75],\n [0, h * 0.75]\n ])\n )\n },\n ARROW_LEFT: (w, h) => {\n const head = Math.min(w * 0.4, h * 0.5)\n return plain(\n polygon([\n [w, h * 0.25],\n [head, h * 0.25],\n [head, 0],\n [0, h / 2],\n [head, h],\n [head, h * 0.75],\n [w, h * 0.75]\n ])\n )\n },\n SUMMING_JUNCTION: (w, h) => {\n const q = Math.PI / 4\n return {\n outline: ellipse(0, 0, w, h),\n details: [\n ...line(onEllipse(w, h, -q), onEllipse(w, h, Math.PI - q)),\n ...line(onEllipse(w, h, q), onEllipse(w, h, Math.PI + q))\n ]\n }\n },\n OR: (w, h) => ({\n outline: ellipse(0, 0, w, h),\n details: [...line([w / 2, 0], [w / 2, h]), ...line([0, h / 2], [w, h / 2])]\n }),\n SPEECH_BUBBLE: (w, h) => plain(speechBubble(w, h)),\n INTERNAL_STORAGE: (w, h, min) => {\n const e = min * 0.15\n return boxWithLines(w, h, [...line([e, 0], [e, h]), ...line([0, e], [w, e])])\n }\n}\n\n/**\n * The outline with each straight corner rounded to `radius` (FigJam rounds them all to its corner\n * radius), shortened where an edge is too short for it. Outlines with curves keep their shape.\n */\nfunction roundCorners(commands: PolygonOutlineCommand[], radius: number): PolygonOutlineCommand[] {\n if (radius <= 0 || commands.some((command) => command.type === 'C')) return commands\n const points: Point[] = []\n for (const command of commands) if (command.type !== 'Z') points.push([command.x, command.y])\n if (points.length < 3) return commands\n return roundedPolygon(\n points,\n points.map(() => radius)\n )\n}\n\n/**\n * The closed polygon through `points` with the corner at each rounded to its own radius in\n * `radii`, shortened where an edge is too short for it; a corner with radius 0 stays sharp.\n */\nfunction roundedPolygon(points: Point[], radii: number[]): PolygonOutlineCommand[] {\n const rounded: PolygonOutlineCommand[] = []\n points.forEach((vertex, index) => {\n const radius = radii[index] ?? 0\n const type = index === 0 ? 'M' : 'L'\n if (radius <= 0) {\n rounded.push({ type, x: vertex[0], y: vertex[1] })\n return\n }\n const before = points[(index + points.length - 1) % points.length]\n const after = points[(index + 1) % points.length]\n const toward = (to: Point): Point => {\n const length = Math.hypot(to[0] - vertex[0], to[1] - vertex[1])\n const t = length > 0 ? Math.min(radius, length / 2) / length : 0\n return [vertex[0] + (to[0] - vertex[0]) * t, vertex[1] + (to[1] - vertex[1]) * t]\n }\n const [inX, inY] = toward(before)\n const [outX, outY] = toward(after)\n rounded.push({ type, x: inX, y: inY })\n rounded.push(\n curve(\n inX + (vertex[0] - inX) * KAPPA,\n inY + (vertex[1] - inY) * KAPPA,\n outX + (vertex[0] - outX) * KAPPA,\n outY + (vertex[1] - outY) * KAPPA,\n outX,\n outY\n )\n )\n })\n rounded.push({ type: 'Z' })\n return rounded\n}\n\n/**\n * The outline and inner lines of a shape of `type` filling a `width` × `height` box. Outlines\n * made only of straight segments have their corners rounded to `cornerRadius`; outlines with\n * curves, such as a rounded rectangle, keep their own shape.\n */\nexport function shapeWithTextGeometry(\n type: ShapeWithTextType,\n width: number,\n height: number,\n cornerRadius = 0\n): ShapeWithTextGeometry {\n const w = Math.max(0, width)\n const h = Math.max(0, height)\n const geometry = BUILDERS[type](w, h, Math.min(w, h), cornerRadius)\n return { ...geometry, outline: roundCorners(geometry.outline, cornerRadius) }\n}\n\n/**\n * Whether the shape's fill has its outline and inner lines cut out of it, as FigJam draws a shape\n * with inner lines, such as a database, when no stroke draws them: it has inner lines and no\n * visible stroke.\n */\nexport function shapeWithTextCutsFill(\n node: Pick<SceneNode, 'type' | 'shapeWithTextType' | 'width' | 'height' | 'strokes'>\n): boolean {\n if (node.strokes.some((stroke) => stroke.opacity > 0 && drawsStroke(node, stroke))) return false\n return shapeWithTextGeometry(node.shapeWithTextType, node.width, node.height).details.length > 0\n}\n"],"mappings":";;;;;AAeA,MAAM,QAAQ;;;;;AAMd,MAAa,2BAA2B;;AAGxC,MAAM,oBAAoB;AAC1B,MAAM,sBAAsB;;AAE5B,MAAM,mBAAmB;;AAEzB,MAAM,kBAAkB;AAIxB,SAAS,QAAQ,QAA0C;CACzD,MAAM,WAAoC,OAAO,KAAK,CAAC,GAAG,IAAI,WAAW;EACvE,MAAM,UAAU,IAAI,MAAM;EAC1B;EACA;CACF,EAAE;CACF,SAAS,KAAK,EAAE,MAAM,IAAI,CAAC;CAC3B,OAAO;AACT;AAEA,SAAS,KAAK,MAAa,IAAoC;CAC7D,OAAO,CACL;EAAE,MAAM;EAAK,GAAG,KAAK;EAAI,GAAG,KAAK;CAAG,GACpC;EAAE,MAAM;EAAK,GAAG,GAAG;EAAI,GAAG,GAAG;CAAG,CAClC;AACF;AAEA,SAAS,MAAM,IAAY,IAAY,IAAY,IAAY,GAAW,GAAW;CACnF,OAAO;EAAE,MAAM;EAAK;EAAI;EAAI;EAAI;EAAI;EAAG;CAAE;AAC3C;AAEA,SAAS,QAAQ,GAAW,GAAW,GAAW,GAAoC;CACpF,MAAM,KAAK,IAAI;CACf,MAAM,KAAK,IAAI;CACf,MAAM,KAAK,IAAI;CACf,MAAM,KAAK,IAAI;CACf,MAAM,KAAK,KAAK;CAChB,MAAM,KAAK,KAAK;CAChB,OAAO;EACL;GAAE,MAAM;GAAK,GAAG;GAAI;EAAE;EACtB,MAAM,KAAK,IAAI,GAAG,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,EAAE;EAC3C,MAAM,IAAI,GAAG,KAAK,IAAI,KAAK,IAAI,IAAI,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,GAAG,KAAK,OAAO,EAAE;GAC9D,MAAM,IAAI,SAAS,IAAI,KAAK,IAAI,QAAQ,SAAS,CAAC,IAAI,SAAS;GAC/D,OAAO,CAAC,OAAO,MAAM,GAAG,KAAK,OAAO,MAAM,GAAG,OAAO,MAAM,GAAG,KAAK,OAAO,MAAM,CAAC;EAClF;EACA,MAAM,CAAC,KAAK,OAAO,OAAO,MAAM;EAChC,MAAM,CAAC,MAAM,QAAQ,OAAO,KAAK;EACjC,QAAQ,KAAK;GAAE;GAAM,GAAG;GAAK,GAAG;EAAI,CAAC;EACrC,QAAQ,KACN,MACE,OAAO,OAAO,KAAK,OAAO,OAC1B,OAAO,OAAO,KAAK,OAAO,OAC1B,QAAQ,OAAO,KAAK,QAAQ,OAC5B,QAAQ,OAAO,KAAK,QAAQ,OAC5B,MACA,IACF,CACF;CACF,CAAC;CACD,QAAQ,KAAK,EAAE,MAAM,IAAI,CAAC;CAC1B,OAAO;AACT;;;;;;AAOA,SAAgB,sBACd,MACA,OACA,QACA,eAAe,GACQ;CACvB,MAAM,IAAI,KAAK,IAAI,GAAG,KAAK;CAC3B,MAAM,IAAI,KAAK,IAAI,GAAG,MAAM;CAC5B,MAAM,WAAW,SAAS,KAAK,CAAC,GAAG,GAAG,KAAK,IAAI,GAAG,CAAC,GAAG,YAAY;CAClE,OAAO;EAAE,GAAG;EAAU,SAAS,aAAa,SAAS,SAAS,YAAY;CAAE;AAC9E;;;;;;AAOA,SAAgB,sBACd,MACS;CACT,IAAI,KAAK,QAAQ,MAAM,WAAW,OAAO,UAAU,KAAK,YAAY,MAAM,MAAM,CAAC,GAAG,OAAO;CAC3F,OAAO,sBAAsB,KAAK,mBAAmB,KAAK,OAAO,KAAK,MAAM,CAAC,CAAC,QAAQ,SAAS;AACjG"}
|
|
1
|
+
{"version":3,"file":"geometry.js","names":[],"sources":["../../src/shape-with-text/geometry.ts"],"sourcesContent":["import { drawsStroke, KAPPA } from '../geometry'\nimport type { PolygonOutlineCommand } from '../polygon'\nimport type { SceneNode } from '../types'\nimport { documentOutline } from './document'\nimport { databaseCap } from './fit'\nimport type { ShapeWithTextType } from './kinds'\n\nexport interface ShapeWithTextGeometry {\n /** The closed outline that is filled and stroked, and that connectors attach to. */\n outline: PolygonOutlineCommand[]\n /** Inner lines that are stroked only, such as a database's front rim. */\n details: PolygonOutlineCommand[]\n}\n\n/**\n * The band FigJam cuts out of a shape's fill along its outline and inner lines when no stroke\n * draws them, so a database still shows its rim: half of it insets the outline.\n */\nexport const SHAPE_WITH_TEXT_LINE_GAP = 3\n\n/** A folder's tab: its height, and how far its base reaches past the middle of the box. */\nconst FOLDER_TAB_HEIGHT = 44\nconst FOLDER_TAB_OVERHANG = 13\n/** How far the tab's sides lean in over its full height. */\nconst FOLDER_TAB_SLANT = 18\n/** How far a multiple document's front page sits right of and below its back page. */\nconst DOCUMENT_OFFSET = 16\n\ntype Point = readonly [number, number]\n\nfunction polygon(points: Point[]): PolygonOutlineCommand[] {\n const commands: PolygonOutlineCommand[] = points.map(([x, y], index) => ({\n type: index === 0 ? 'M' : 'L',\n x,\n y\n }))\n commands.push({ type: 'Z' })\n return commands\n}\n\nfunction line(from: Point, to: Point): PolygonOutlineCommand[] {\n return [\n { type: 'M', x: from[0], y: from[1] },\n { type: 'L', x: to[0], y: to[1] }\n ]\n}\n\nfunction curve(x1: number, y1: number, x2: number, y2: number, x: number, y: number) {\n return { type: 'C', x1, y1, x2, y2, x, y } as const\n}\n\nfunction ellipse(x: number, y: number, w: number, h: number): PolygonOutlineCommand[] {\n const rx = w / 2\n const ry = h / 2\n const cx = x + rx\n const cy = y + ry\n const kx = rx * KAPPA\n const ky = ry * KAPPA\n return [\n { type: 'M', x: cx, y },\n curve(cx + kx, y, x + w, cy - ky, x + w, cy),\n curve(x + w, cy + ky, cx + kx, y + h, cx, y + h),\n curve(cx - kx, y + h, x, cy + ky, x, cy),\n curve(x, cy - ky, cx - kx, y, cx, y),\n { type: 'Z' }\n ]\n}\n\nfunction roundedRect(w: number, h: number, radius: number): PolygonOutlineCommand[] {\n const r = Math.max(0, Math.min(radius, w / 2, h / 2))\n const k = r * (1 - KAPPA)\n return [\n { type: 'M', x: r, y: 0 },\n { type: 'L', x: w - r, y: 0 },\n curve(w - k, 0, w, k, w, r),\n { type: 'L', x: w, y: h - r },\n curve(w, h - k, w - k, h, w - r, h),\n { type: 'L', x: r, y: h },\n curve(k, h, 0, h - k, 0, h - r),\n { type: 'L', x: 0, y: r },\n curve(0, k, k, 0, r, 0),\n { type: 'Z' }\n ]\n}\n\n/** A page with a wavy bottom edge, the flowchart \"document\" symbol. */\nfunction documentPage(x: number, y: number, w: number, h: number): PolygonOutlineCommand[] {\n const wave = h * 0.1\n const base = y + h - wave\n return [\n { type: 'M', x, y },\n { type: 'L', x: x + w, y },\n { type: 'L', x: x + w, y: base },\n curve(x + w * 0.8, base - wave * 1.2, x + w * 0.7, base - wave * 1.2, x + w * 0.5, base),\n curve(x + w * 0.3, base + wave, x + w * 0.2, base + wave, x, base),\n { type: 'Z' }\n ]\n}\n\nfunction star(w: number, h: number): Point[] {\n const points: Point[] = []\n for (let i = 0; i < 10; i++) {\n const angle = -Math.PI / 2 + (i * Math.PI) / 5\n const radius = i % 2 === 0 ? 1 : 0.382\n points.push([\n w / 2 + (Math.cos(angle) * radius * w) / 2,\n h / 2 + (Math.sin(angle) * radius * h) / 2 + h * 0.05\n ])\n }\n return points\n}\n\n/** A point on the ellipse filling the box, at `angle` radians clockwise from the right. */\nfunction onEllipse(w: number, h: number, angle: number): Point {\n return [w / 2 + (Math.cos(angle) * w) / 2, h / 2 + (Math.sin(angle) * h) / 2]\n}\n\n/** A plain box with stroke-only inner lines. */\nfunction boxWithLines(\n w: number,\n h: number,\n details: PolygonOutlineCommand[]\n): ShapeWithTextGeometry {\n return {\n outline: polygon([\n [0, 0],\n [w, 0],\n [w, h],\n [0, h]\n ]),\n details\n }\n}\n\n/** A rounded box with a tail below its left side; the tail joins the bottom edge. */\nfunction speechBubble(w: number, h: number): PolygonOutlineCommand[] {\n const body = h * 0.8\n const box = roundedRect(w, body, Math.min(w, body) * 0.2)\n // The fifth command draws the bottom edge leftwards; the tail goes just before it.\n const tail: PolygonOutlineCommand[] = [\n { type: 'L', x: w * 0.38, y: body },\n { type: 'L', x: w * 0.18, y: h },\n { type: 'L', x: w * 0.22, y: body }\n ]\n return [...box.slice(0, 5), ...tail, ...box.slice(5)]\n}\n\nconst plain = (outline: PolygonOutlineCommand[]): ShapeWithTextGeometry => ({\n outline,\n details: []\n})\n\ntype Builder = (w: number, h: number, min: number, radius: number) => ShapeWithTextGeometry\n\n/** How far a parallelogram's sides lean: FigJam leans them with the height, not the width. */\nexport function parallelogramSlant(w: number, h: number): number {\n return Math.min(h * 0.43, w * 0.45)\n}\n\n/** Each kind's outline and inner lines for a `w` × `h` box, `min` being its shorter side. */\nconst BUILDERS: Record<ShapeWithTextType, Builder> = {\n SQUARE: (w, h) =>\n plain(\n polygon([\n [0, 0],\n [w, 0],\n [w, h],\n [0, h]\n ])\n ),\n ELLIPSE: (w, h) => plain(ellipse(0, 0, w, h)),\n DIAMOND: (w, h) =>\n plain(\n polygon([\n [w / 2, 0],\n [w, h / 2],\n [w / 2, h],\n [0, h / 2]\n ])\n ),\n TRIANGLE_UP: (w, h) =>\n plain(\n polygon([\n [w / 2, 0],\n [w, h],\n [0, h]\n ])\n ),\n TRIANGLE_DOWN: (w, h) =>\n plain(\n polygon([\n [0, 0],\n [w, 0],\n [w / 2, h]\n ])\n ),\n // FigJam rounds the ends to 0.4 of the shorter side, as its saved outlines show.\n ROUNDED_RECTANGLE: (w, h, min) => plain(roundedRect(w, h, min * 0.4)),\n PARALLELOGRAM_RIGHT: (w, h) => {\n const s = parallelogramSlant(w, h)\n return plain(\n polygon([\n [s, 0],\n [w, 0],\n [w - s, h],\n [0, h]\n ])\n )\n },\n PARALLELOGRAM_LEFT: (w, h) => {\n const s = parallelogramSlant(w, h)\n return plain(\n polygon([\n [0, 0],\n [w - s, 0],\n [w, h],\n [s, h]\n ])\n )\n },\n ENG_DATABASE: (w, h) => {\n const ry = databaseCap(w, h)\n const kx = (w / 2) * KAPPA\n const ky = ry * KAPPA\n return {\n outline: [\n { type: 'M', x: 0, y: ry },\n curve(0, ry - ky, w / 2 - kx, 0, w / 2, 0),\n curve(w / 2 + kx, 0, w, ry - ky, w, ry),\n { type: 'L', x: w, y: h - ry },\n curve(w, h - ry + ky, w / 2 + kx, h, w / 2, h),\n curve(w / 2 - kx, h, 0, h - ry + ky, 0, h - ry),\n { type: 'Z' }\n ],\n details: [\n { type: 'M', x: 0, y: ry },\n curve(0, ry + ky, w / 2 - kx, ry * 2, w / 2, ry * 2),\n curve(w / 2 + kx, ry * 2, w, ry + ky, w, ry)\n ]\n }\n },\n ENG_QUEUE: (w, h) => {\n const rx = Math.min(w * 0.15, h * 0.25)\n const kx = rx * KAPPA\n const ky = (h / 2) * KAPPA\n return {\n outline: [\n { type: 'M', x: rx, y: 0 },\n { type: 'L', x: w - rx, y: 0 },\n curve(w - rx + kx, 0, w, h / 2 - ky, w, h / 2),\n curve(w, h / 2 + ky, w - rx + kx, h, w - rx, h),\n { type: 'L', x: rx, y: h },\n curve(rx - kx, h, 0, h / 2 + ky, 0, h / 2),\n curve(0, h / 2 - ky, rx - kx, 0, rx, 0),\n { type: 'Z' }\n ],\n details: [\n { type: 'M', x: w - rx, y: 0 },\n curve(w - rx - kx, 0, w - rx * 2, h / 2 - ky, w - rx * 2, h / 2),\n curve(w - rx * 2, h / 2 + ky, w - rx - kx, h, w - rx, h)\n ]\n }\n },\n ENG_FILE: (w, h, min) => {\n const f = min * 0.25\n return {\n outline: polygon([\n [0, 0],\n [w - f, 0],\n [w, f],\n [w, h],\n [0, h]\n ]),\n details: [...line([w - f, 0], [w - f, f]), { type: 'L', x: w, y: f }]\n }\n },\n // A tab on the left of the box above a body; the line between them is the body's top edge.\n // The corners where tab and body meet stay sharp.\n ENG_FOLDER: (w, h, _min, radius) => {\n const tab = Math.min(FOLDER_TAB_HEIGHT, h)\n const base = Math.min(w / 2 + FOLDER_TAB_OVERHANG, w)\n const slant = Math.min((FOLDER_TAB_SLANT * tab) / FOLDER_TAB_HEIGHT, base / 2)\n return {\n outline: roundedPolygon(\n [\n [0, h],\n [0, tab],\n [slant, 0],\n [base - slant, 0],\n [base, tab],\n [w, tab],\n [w, h]\n ],\n [radius, 0, radius, radius, 0, radius, radius]\n ),\n details: line([0, tab], [base, tab])\n }\n },\n TRAPEZOID: (w, h) => {\n const s = Math.min(w * 0.2, h)\n return plain(\n polygon([\n [s, 0],\n [w - s, 0],\n [w, h],\n [0, h]\n ])\n )\n },\n PREDEFINED_PROCESS: (w, h) => {\n const e = Math.min(w * 0.1, h * 0.5)\n return boxWithLines(w, h, [...line([e, 0], [e, h]), ...line([w - e, 0], [w - e, h])])\n },\n SHIELD: (w, h) =>\n plain([\n { type: 'M', x: 0, y: 0 },\n { type: 'L', x: w, y: 0 },\n { type: 'L', x: w, y: h * 0.45 },\n curve(w, h * 0.75, w * 0.75, h * 0.9, w / 2, h),\n curve(w * 0.25, h * 0.9, 0, h * 0.75, 0, h * 0.45),\n { type: 'Z' }\n ]),\n DOCUMENT_SINGLE: (w, h, _min, radius) => plain(documentOutline(w, h, radius)),\n // A back page with a front page over its lower right; the front page's top and left edges,\n // where it lies over the back one, are the inner lines.\n DOCUMENT_MULTIPLE: (w, h, _min, radius) => {\n const o = Math.min(DOCUMENT_OFFSET, w / 4, h / 4)\n const front = documentPage(o, o, w - o, h - o)\n const wave = front.filter((command) => command.type === 'C')\n const base = wave.at(-1)?.y ?? h\n // The back page ends on the front page's left side, sloping down to it.\n const join = Math.min(h - 2 * o, base)\n const outline = roundedPolygon(\n [\n [0, 0],\n [w - o, 0],\n [w - o, o],\n [w, o],\n [w, base],\n [o, base],\n [o, join],\n [0, join - o / 4]\n ],\n [radius, radius, 0, radius, 0, 0, 0, radius]\n )\n // The straight edge along the bottom becomes the front page's wave.\n const bottom = outline.findIndex(\n (command) => command.type === 'L' && command.x === o && command.y === base\n )\n return {\n outline: [...outline.slice(0, bottom), ...wave, ...outline.slice(bottom + 1)],\n details: [...line([w - o, o], [o, o]), { type: 'L', x: o, y: join }]\n }\n },\n MANUAL_INPUT: (w, h) =>\n plain(\n polygon([\n [0, h * 0.25],\n [w, 0],\n [w, h],\n [0, h]\n ])\n ),\n HEXAGON: (w, h) => {\n const s = Math.min(w * 0.25, h * 0.5)\n return plain(\n polygon([\n [s, 0],\n [w - s, 0],\n [w, h / 2],\n [w - s, h],\n [s, h],\n [0, h / 2]\n ])\n )\n },\n CHEVRON: (w, h) => {\n const p = Math.min(w * 0.25, h * 0.5)\n return plain(\n polygon([\n [0, 0],\n [w - p, 0],\n [w, h / 2],\n [w - p, h],\n [0, h],\n [p, h / 2]\n ])\n )\n },\n PENTAGON: (w, h) =>\n plain(\n polygon([\n [w / 2, 0],\n [w, h * 0.38],\n [w * 0.81, h],\n [w * 0.19, h],\n [0, h * 0.38]\n ])\n ),\n OCTAGON: (w, h, min) => {\n const c = min * 0.29\n return plain(\n polygon([\n [c, 0],\n [w - c, 0],\n [w, c],\n [w, h - c],\n [w - c, h],\n [c, h],\n [0, h - c],\n [0, c]\n ])\n )\n },\n STAR: (w, h) => plain(polygon(star(w, h))),\n PLUS: (w, h) => {\n const a = w / 3\n const b = h / 3\n return plain(\n polygon([\n [a, 0],\n [a * 2, 0],\n [a * 2, b],\n [w, b],\n [w, b * 2],\n [a * 2, b * 2],\n [a * 2, h],\n [a, h],\n [a, b * 2],\n [0, b * 2],\n [0, b],\n [a, b]\n ])\n )\n },\n ARROW_RIGHT: (w, h) => {\n const head = Math.min(w * 0.4, h * 0.5)\n return plain(\n polygon([\n [0, h * 0.25],\n [w - head, h * 0.25],\n [w - head, 0],\n [w, h / 2],\n [w - head, h],\n [w - head, h * 0.75],\n [0, h * 0.75]\n ])\n )\n },\n ARROW_LEFT: (w, h) => {\n const head = Math.min(w * 0.4, h * 0.5)\n return plain(\n polygon([\n [w, h * 0.25],\n [head, h * 0.25],\n [head, 0],\n [0, h / 2],\n [head, h],\n [head, h * 0.75],\n [w, h * 0.75]\n ])\n )\n },\n SUMMING_JUNCTION: (w, h) => {\n const q = Math.PI / 4\n return {\n outline: ellipse(0, 0, w, h),\n details: [\n ...line(onEllipse(w, h, -q), onEllipse(w, h, Math.PI - q)),\n ...line(onEllipse(w, h, q), onEllipse(w, h, Math.PI + q))\n ]\n }\n },\n OR: (w, h) => ({\n outline: ellipse(0, 0, w, h),\n details: [...line([w / 2, 0], [w / 2, h]), ...line([0, h / 2], [w, h / 2])]\n }),\n SPEECH_BUBBLE: (w, h) => plain(speechBubble(w, h)),\n INTERNAL_STORAGE: (w, h, min) => {\n const e = min * 0.15\n return boxWithLines(w, h, [...line([e, 0], [e, h]), ...line([0, e], [w, e])])\n }\n}\n\n/**\n * The outline with each straight corner rounded to `radius` (FigJam rounds them all to its corner\n * radius), shortened where an edge is too short for it. Outlines with curves keep their shape.\n */\nfunction roundCorners(commands: PolygonOutlineCommand[], radius: number): PolygonOutlineCommand[] {\n if (radius <= 0 || commands.some((command) => command.type === 'C')) return commands\n const points: Point[] = []\n for (const command of commands) if (command.type !== 'Z') points.push([command.x, command.y])\n if (points.length < 3) return commands\n return roundedPolygon(\n points,\n points.map(() => radius)\n )\n}\n\n/**\n * The closed polygon through `points` with the corner at each rounded to its own radius in\n * `radii`, shortened where an edge is too short for it; a corner with radius 0 stays sharp.\n */\nfunction roundedPolygon(points: Point[], radii: number[]): PolygonOutlineCommand[] {\n const rounded: PolygonOutlineCommand[] = []\n points.forEach((vertex, index) => {\n const radius = radii[index] ?? 0\n const type = index === 0 ? 'M' : 'L'\n if (radius <= 0) {\n rounded.push({ type, x: vertex[0], y: vertex[1] })\n return\n }\n const before = points[(index + points.length - 1) % points.length]\n const after = points[(index + 1) % points.length]\n const toward = (to: Point): Point => {\n const length = Math.hypot(to[0] - vertex[0], to[1] - vertex[1])\n const t = length > 0 ? Math.min(radius, length / 2) / length : 0\n return [vertex[0] + (to[0] - vertex[0]) * t, vertex[1] + (to[1] - vertex[1]) * t]\n }\n const [inX, inY] = toward(before)\n const [outX, outY] = toward(after)\n rounded.push({ type, x: inX, y: inY })\n rounded.push(\n curve(\n inX + (vertex[0] - inX) * KAPPA,\n inY + (vertex[1] - inY) * KAPPA,\n outX + (vertex[0] - outX) * KAPPA,\n outY + (vertex[1] - outY) * KAPPA,\n outX,\n outY\n )\n )\n })\n rounded.push({ type: 'Z' })\n return rounded\n}\n\n/**\n * The outline and inner lines of a shape of `type` filling a `width` × `height` box. Outlines\n * made only of straight segments have their corners rounded to `cornerRadius`; outlines with\n * curves, such as a rounded rectangle, keep their own shape.\n */\nexport function shapeWithTextGeometry(\n type: ShapeWithTextType,\n width: number,\n height: number,\n cornerRadius = 0\n): ShapeWithTextGeometry {\n const w = Math.max(0, width)\n const h = Math.max(0, height)\n const geometry = BUILDERS[type](w, h, Math.min(w, h), cornerRadius)\n return { ...geometry, outline: roundCorners(geometry.outline, cornerRadius) }\n}\n\n/**\n * Whether the shape's fill has its outline and inner lines cut out of it, as FigJam draws a shape\n * with inner lines, such as a database, when no stroke draws them: it has inner lines and no\n * visible stroke.\n */\nexport function shapeWithTextCutsFill(\n node: Pick<SceneNode, 'type' | 'shapeWithTextType' | 'width' | 'height' | 'strokes'>\n): boolean {\n if (node.strokes.some((stroke) => stroke.opacity > 0 && drawsStroke(node, stroke))) return false\n return shapeWithTextGeometry(node.shapeWithTextType, node.width, node.height).details.length > 0\n}\n"],"mappings":";;;;;;;;AAkBA,MAAa,2BAA2B;;AAGxC,MAAM,oBAAoB;AAC1B,MAAM,sBAAsB;;AAE5B,MAAM,mBAAmB;;AAEzB,MAAM,kBAAkB;AAIxB,SAAS,QAAQ,QAA0C;CACzD,MAAM,WAAoC,OAAO,KAAK,CAAC,GAAG,IAAI,WAAW;EACvE,MAAM,UAAU,IAAI,MAAM;EAC1B;EACA;CACF,EAAE;CACF,SAAS,KAAK,EAAE,MAAM,IAAI,CAAC;CAC3B,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AK,EAAE,MAAM,IAAI,CAAC;CAC1B,OAAO;AACT;;;;;;AAOA,SAAgB,sBACd,MACA,OACA,QACA,eAAe,GACQ;CACvB,MAAM,IAAI,KAAK,IAAI,GAAG,KAAK;CAC3B,MAAM,IAAI,KAAK,IAAI,GAAG,MAAM;CAC5B,MAAM,WAAW,SAAS,KAAK,CAAC,GAAG,GAAG,KAAK,IAAI,GAAG,CAAC,GAAG,YAAY;CAClE,OAAO;EAAE,GAAG;EAAU,SAAS,aAAa,SAAS,SAAS,YAAY;CAAE;AAC9E;;;;;;AAOA,SAAgB,sBACd,MACS;CACT,IAAI,KAAK,QAAQ,MAAM,WAAW,OAAO,UAAU,KAAK,YAAY,MAAM,MAAM,CAAC,GAAG,OAAO;CAC3F,OAAO,sBAAsB,KAAK,mBAAmB,KAAK,OAAO,KAAK,MAAM,CAAC,CAAC,QAAQ,SAAS;AACjG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { databaseCap, fitShapeWithTextHeight, shapeWithTextGrows, shapeWithTextLabelBox } from "./fit.js";
|
|
2
1
|
import { SHAPE_WITH_TEXT_GROUPS, SHAPE_WITH_TEXT_TYPES, isShapeWithTextType } from "./kinds.js";
|
|
3
2
|
import { SHAPE_WITH_TEXT_LINE_GAP, parallelogramSlant, shapeWithTextCutsFill, shapeWithTextGeometry } from "./geometry.js";
|
|
3
|
+
import { databaseCap, fitShapeWithTextHeight, shapeWithTextGrows, shapeWithTextLabelBox } from "./fit.js";
|
|
4
4
|
export { SHAPE_WITH_TEXT_GROUPS, SHAPE_WITH_TEXT_LINE_GAP, SHAPE_WITH_TEXT_TYPES, databaseCap, fitShapeWithTextHeight, isShapeWithTextType, parallelogramSlant, shapeWithTextCutsFill, shapeWithTextGeometry, shapeWithTextGrows, shapeWithTextLabelBox };
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
//#region src/shape-with-text/kinds.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* FigJam's shape-with-text kinds, as Figma names them in `.fig` files and in its plugin API
|
|
4
3
|
* (`ShapeWithTextNode.shapeType`). Each kind is drawn from its size here, so rendering, hit
|
|
5
4
|
* testing, export and connectors share one outline.
|
|
6
5
|
*/
|
|
7
|
-
declare const SHAPE_WITH_TEXT_TYPES: readonly ["SQUARE", "ELLIPSE", "DIAMOND", "TRIANGLE_UP", "TRIANGLE_DOWN", "ROUNDED_RECTANGLE", "PARALLELOGRAM_RIGHT", "PARALLELOGRAM_LEFT", "ENG_DATABASE", "ENG_QUEUE", "ENG_FILE", "ENG_FOLDER", "TRAPEZOID", "PREDEFINED_PROCESS", "SHIELD", "DOCUMENT_SINGLE", "DOCUMENT_MULTIPLE", "MANUAL_INPUT", "HEXAGON", "CHEVRON", "PENTAGON", "OCTAGON", "STAR", "PLUS", "ARROW_LEFT", "ARROW_RIGHT", "SUMMING_JUNCTION", "OR", "SPEECH_BUBBLE", "INTERNAL_STORAGE"];
|
|
8
|
-
type ShapeWithTextType = (typeof SHAPE_WITH_TEXT_TYPES)[number];
|
|
9
|
-
declare function isShapeWithTextType(value: unknown): value is ShapeWithTextType;
|
|
6
|
+
export declare const SHAPE_WITH_TEXT_TYPES: readonly ["SQUARE", "ELLIPSE", "DIAMOND", "TRIANGLE_UP", "TRIANGLE_DOWN", "ROUNDED_RECTANGLE", "PARALLELOGRAM_RIGHT", "PARALLELOGRAM_LEFT", "ENG_DATABASE", "ENG_QUEUE", "ENG_FILE", "ENG_FOLDER", "TRAPEZOID", "PREDEFINED_PROCESS", "SHIELD", "DOCUMENT_SINGLE", "DOCUMENT_MULTIPLE", "MANUAL_INPUT", "HEXAGON", "CHEVRON", "PENTAGON", "OCTAGON", "STAR", "PLUS", "ARROW_LEFT", "ARROW_RIGHT", "SUMMING_JUNCTION", "OR", "SPEECH_BUBBLE", "INTERNAL_STORAGE"];
|
|
7
|
+
export type ShapeWithTextType = (typeof SHAPE_WITH_TEXT_TYPES)[number];
|
|
8
|
+
export declare function isShapeWithTextType(value: unknown): value is ShapeWithTextType;
|
|
10
9
|
/**
|
|
11
10
|
* The kinds as FigJam's Shapes panel offers them, in its order: Basic, then Flowchart. Together
|
|
12
11
|
* they are every kind.
|
|
13
12
|
*/
|
|
14
|
-
declare const SHAPE_WITH_TEXT_GROUPS: {
|
|
13
|
+
export declare const SHAPE_WITH_TEXT_GROUPS: {
|
|
15
14
|
readonly basic: readonly ["SQUARE", "ELLIPSE", "DIAMOND", "TRIANGLE_UP", "TRIANGLE_DOWN", "ROUNDED_RECTANGLE", "PENTAGON", "OCTAGON", "PLUS", "ARROW_LEFT", "ARROW_RIGHT", "CHEVRON", "STAR", "SPEECH_BUBBLE"];
|
|
16
15
|
readonly flowchart: readonly ["PARALLELOGRAM_RIGHT", "PARALLELOGRAM_LEFT", "ENG_DATABASE", "ENG_QUEUE", "ENG_FILE", "ENG_FOLDER", "DOCUMENT_SINGLE", "DOCUMENT_MULTIPLE", "PREDEFINED_PROCESS", "SHIELD", "TRAPEZOID", "MANUAL_INPUT", "HEXAGON", "INTERNAL_STORAGE", "OR", "SUMMING_JUNCTION"];
|
|
17
16
|
};
|
|
18
|
-
//#endregion
|
|
19
|
-
export { SHAPE_WITH_TEXT_GROUPS, SHAPE_WITH_TEXT_TYPES, ShapeWithTextType, isShapeWithTextType };
|
|
20
17
|
//# sourceMappingURL=kinds.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kinds.d.ts","names":[],"sources":["../../src/shape-with-text/kinds.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"kinds.d.ts","names":[],"sources":["../../src/shape-with-text/kinds.ts"],"mappings":";;;;;qBAKa;YAiCD,4BAA4B;wBAIxB,oBAAoB,iBAAiB,SAAS;;;;;qBAQjD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/shape-with-text/kinds.ts
|
|
2
2
|
/**
|
|
3
3
|
* FigJam's shape-with-text kinds, as Figma names them in `.fig` files and in its plugin API
|
|
4
4
|
* (`ShapeWithTextNode.shapeType`). Each kind is drawn from its size here, so rendering, hit
|
|
@@ -80,7 +80,6 @@ const SHAPE_WITH_TEXT_GROUPS = {
|
|
|
80
80
|
"SUMMING_JUNCTION"
|
|
81
81
|
]
|
|
82
82
|
};
|
|
83
|
-
//#endregion
|
|
84
83
|
export { SHAPE_WITH_TEXT_GROUPS, SHAPE_WITH_TEXT_TYPES, isShapeWithTextType };
|
|
85
84
|
|
|
86
85
|
//# sourceMappingURL=kinds.js.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { SceneNode, SharedStyleType } from "./types.js";
|
|
2
|
-
//#region src/shared-style-index.d.ts
|
|
3
2
|
type NodeMap = ReadonlyMap<string, SceneNode>;
|
|
4
|
-
declare class SharedStyleIndex {
|
|
3
|
+
export declare class SharedStyleIndex {
|
|
5
4
|
private readonly nodes;
|
|
6
5
|
private readonly nodeIdsByStyleId;
|
|
7
6
|
private indexed;
|
|
@@ -16,6 +15,5 @@ declare class SharedStyleIndex {
|
|
|
16
15
|
private add;
|
|
17
16
|
private remove;
|
|
18
17
|
}
|
|
19
|
-
|
|
20
|
-
export { SharedStyleIndex };
|
|
18
|
+
export {};
|
|
21
19
|
//# sourceMappingURL=shared-style-index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-style-index.d.ts","names":[],"sources":["../src/shared-style-index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"shared-style-index.d.ts","names":[],"sources":["../src/shared-style-index.ts"],"mappings":";KAEK,UAAU,oBAAoB;qBAiBtB;mBAIkB;mBAHZ;UACT;EAEqB,YAAA,aAAa;EAE1C,UAAU,iBAAiB,MAAM,kBAAkB;EAcnD,MAAM,MAAM;EAMZ,QAAQ,MAAM;EAMd,WAAW,MAAM,WAAW,SAAS,QAAQ;EAQ7C,UAAU,MAAM,WAAW;EAM3B;UAIQ;UAYA;UAaA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/shared-style-index.ts
|
|
2
2
|
const INDEX_KEYS = /* @__PURE__ */ new Set(["source", "sharedStyleType"]);
|
|
3
3
|
function restyles(changes) {
|
|
4
4
|
for (const key of INDEX_KEYS) if (key in changes) return true;
|
|
@@ -66,7 +66,6 @@ var SharedStyleIndex = class {
|
|
|
66
66
|
if (ids.size === 0) this.nodeIdsByStyleId.delete(key);
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
|
-
//#endregion
|
|
70
69
|
export { SharedStyleIndex };
|
|
71
70
|
|
|
72
71
|
//# sourceMappingURL=shared-style-index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-style-index.js","names":[],"sources":["../src/shared-style-index.ts"],"sourcesContent":["import type { SceneNode, SharedStyleType } from './types'\n\ntype NodeMap = ReadonlyMap<string, SceneNode>\n\nconst INDEX_KEYS: ReadonlySet<string> = new Set(['source', 'sharedStyleType'])\n\nfunction restyles(changes: Partial<SceneNode>): boolean {\n for (const key of INDEX_KEYS) {\n if (key in changes) {\n return true\n }\n }\n return false\n}\n\nfunction styleKey(node: SceneNode): string | null {\n return node.sharedStyleType && node.source.id ? node.source.id : null\n}\n\nexport class SharedStyleIndex {\n private readonly nodeIdsByStyleId = new Map<string, Set<string>>()\n private indexed: NodeMap | null = null\n\n constructor(private readonly nodes: () => NodeMap) {}\n\n styleNode(styleId: string, type: SharedStyleType): SceneNode | undefined {\n if (!styleId) {\n return undefined\n }\n const nodes = this.current()\n for (const id of this.nodeIdsByStyleId.get(styleId) ?? []) {\n const node = nodes.get(id)\n if (node?.sharedStyleType === type && node.source.id === styleId) {\n return node\n }\n }\n return undefined\n }\n\n added(node: SceneNode): void {\n if (this.indexed) {\n this.add(node)\n }\n }\n\n removed(node: SceneNode): void {\n if (this.indexed) {\n this.remove(node)\n }\n }\n\n willChange(node: SceneNode, changes: Partial<SceneNode>): boolean {\n const restyled = restyles(changes)\n if (restyled) {\n this.removed(node)\n }\n return restyled\n }\n\n didChange(node: SceneNode, restyled: boolean): void {\n if (restyled) {\n this.added(node)\n }\n }\n\n invalidate(): void {\n this.indexed = null\n }\n\n private current(): NodeMap {\n const nodes = this.nodes()\n if (this.indexed !== nodes) {\n this.nodeIdsByStyleId.clear()\n for (const node of nodes.values()) {\n this.add(node)\n }\n this.indexed = nodes\n }\n return nodes\n }\n\n private add(node: SceneNode): void {\n const key = styleKey(node)\n if (!key) {\n return\n }\n let ids = this.nodeIdsByStyleId.get(key)\n if (!ids) {\n ids = new Set()\n this.nodeIdsByStyleId.set(key, ids)\n }\n ids.add(node.id)\n }\n\n private remove(node: SceneNode): void {\n const key = styleKey(node)\n const ids = key ? this.nodeIdsByStyleId.get(key) : undefined\n if (!key || !ids) {\n return\n }\n ids.delete(node.id)\n if (ids.size === 0) {\n this.nodeIdsByStyleId.delete(key)\n }\n }\n}\n"],"mappings":";AAIA,MAAM,6BAAkC,IAAI,IAAI,CAAC,UAAU,iBAAiB,CAAC;AAE7E,SAAS,SAAS,SAAsC;CACtD,KAAK,MAAM,OAAO,YAChB,IAAI,OAAO,SACT,OAAO;CAGX,OAAO;AACT;AAEA,SAAS,SAAS,MAAgC;CAChD,OAAO,KAAK,mBAAmB,KAAK,OAAO,KAAK,KAAK,OAAO,KAAK;AACnE;AAEA,IAAa,mBAAb,MAA8B;CAIC;
|
|
1
|
+
{"version":3,"file":"shared-style-index.js","names":[],"sources":["../src/shared-style-index.ts"],"sourcesContent":["import type { SceneNode, SharedStyleType } from './types'\n\ntype NodeMap = ReadonlyMap<string, SceneNode>\n\nconst INDEX_KEYS: ReadonlySet<string> = new Set(['source', 'sharedStyleType'])\n\nfunction restyles(changes: Partial<SceneNode>): boolean {\n for (const key of INDEX_KEYS) {\n if (key in changes) {\n return true\n }\n }\n return false\n}\n\nfunction styleKey(node: SceneNode): string | null {\n return node.sharedStyleType && node.source.id ? node.source.id : null\n}\n\nexport class SharedStyleIndex {\n private readonly nodeIdsByStyleId = new Map<string, Set<string>>()\n private indexed: NodeMap | null = null\n\n constructor(private readonly nodes: () => NodeMap) {}\n\n styleNode(styleId: string, type: SharedStyleType): SceneNode | undefined {\n if (!styleId) {\n return undefined\n }\n const nodes = this.current()\n for (const id of this.nodeIdsByStyleId.get(styleId) ?? []) {\n const node = nodes.get(id)\n if (node?.sharedStyleType === type && node.source.id === styleId) {\n return node\n }\n }\n return undefined\n }\n\n added(node: SceneNode): void {\n if (this.indexed) {\n this.add(node)\n }\n }\n\n removed(node: SceneNode): void {\n if (this.indexed) {\n this.remove(node)\n }\n }\n\n willChange(node: SceneNode, changes: Partial<SceneNode>): boolean {\n const restyled = restyles(changes)\n if (restyled) {\n this.removed(node)\n }\n return restyled\n }\n\n didChange(node: SceneNode, restyled: boolean): void {\n if (restyled) {\n this.added(node)\n }\n }\n\n invalidate(): void {\n this.indexed = null\n }\n\n private current(): NodeMap {\n const nodes = this.nodes()\n if (this.indexed !== nodes) {\n this.nodeIdsByStyleId.clear()\n for (const node of nodes.values()) {\n this.add(node)\n }\n this.indexed = nodes\n }\n return nodes\n }\n\n private add(node: SceneNode): void {\n const key = styleKey(node)\n if (!key) {\n return\n }\n let ids = this.nodeIdsByStyleId.get(key)\n if (!ids) {\n ids = new Set()\n this.nodeIdsByStyleId.set(key, ids)\n }\n ids.add(node.id)\n }\n\n private remove(node: SceneNode): void {\n const key = styleKey(node)\n const ids = key ? this.nodeIdsByStyleId.get(key) : undefined\n if (!key || !ids) {\n return\n }\n ids.delete(node.id)\n if (ids.size === 0) {\n this.nodeIdsByStyleId.delete(key)\n }\n }\n}\n"],"mappings":";AAIA,MAAM,6BAAkC,IAAI,IAAI,CAAC,UAAU,iBAAiB,CAAC;AAE7E,SAAS,SAAS,SAAsC;CACtD,KAAK,MAAM,OAAO,YAChB,IAAI,OAAO,SACT,OAAO;CAGX,OAAO;AACT;AAEA,SAAS,SAAS,MAAgC;CAChD,OAAO,KAAK,mBAAmB,KAAK,OAAO,KAAK,KAAK,OAAO,KAAK;AACnE;AAEA,IAAa,mBAAb,MAA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MAAM,MAAM,KAAK,iBAAiB,IAAI,GAAG,IAAI,KAAA;EACnD,IAAI,CAAC,OAAO,CAAC,KACX;EAEF,IAAI,OAAO,KAAK,EAAE;EAClB,IAAI,IAAI,SAAS,GACf,KAAK,iBAAiB,OAAO,GAAG;CAEpC;AACF"}
|
package/dist/shared-styles.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SceneGraph } from "./graph.js";
|
|
2
2
|
import { CharacterStyleOverride, SceneNode, SharedStyle, SharedStyleKind, SharedStyleType } from "./types.js";
|
|
3
|
-
//#region src/shared-styles.d.ts
|
|
4
3
|
declare const STYLE_REF_KEYS: {
|
|
5
4
|
readonly fill: "fillStyleId";
|
|
6
5
|
readonly stroke: "strokeStyleId";
|
|
@@ -9,13 +8,13 @@ declare const STYLE_REF_KEYS: {
|
|
|
9
8
|
readonly grid: "gridStyleId";
|
|
10
9
|
};
|
|
11
10
|
/** The fields that link a layer to its shared styles. */
|
|
12
|
-
declare const STYLE_LINK_FIELDS: ("fillStyleId" | "strokeStyleId" | "textStyleId" | "effectStyleId" | "gridStyleId")[];
|
|
11
|
+
export declare const STYLE_LINK_FIELDS: ("fillStyleId" | "strokeStyleId" | "textStyleId" | "effectStyleId" | "gridStyleId")[];
|
|
13
12
|
/** The shared styles a layer uses: its own, its text ranges', and its vector regions'. */
|
|
14
|
-
declare function referencedStyleIds(node: SceneNode): string[];
|
|
13
|
+
export declare function referencedStyleIds(node: SceneNode): string[];
|
|
15
14
|
/** The fields a text style gives what uses it; changing one leaves the style. */
|
|
16
|
-
declare const SHARED_TEXT_STYLE_FIELDS: readonly ["fontFamily", "fontWeight", "italic", "fontStyle", "fontSize", "lineHeight", "letterSpacing", "textDecoration", "textCase", "fontFeatures"];
|
|
15
|
+
export declare const SHARED_TEXT_STYLE_FIELDS: readonly ["fontFamily", "fontWeight", "italic", "fontStyle", "fontSize", "lineHeight", "letterSpacing", "textDecoration", "textCase", "fontFeatures"];
|
|
17
16
|
/** The fields each kind of shared style gives what uses it; changing one leaves the style. */
|
|
18
|
-
declare const SHARED_STYLE_FIELDS: {
|
|
17
|
+
export declare const SHARED_STYLE_FIELDS: {
|
|
19
18
|
readonly fill: readonly ["fills"];
|
|
20
19
|
readonly stroke: readonly ["strokes"];
|
|
21
20
|
readonly text: readonly ["fontFamily", "fontWeight", "italic", "fontStyle", "fontSize", "lineHeight", "letterSpacing", "textDecoration", "textCase", "fontFeatures", "paragraphSpacing", "paragraphIndent", "listSpacing"];
|
|
@@ -23,31 +22,30 @@ declare const SHARED_STYLE_FIELDS: {
|
|
|
23
22
|
readonly grid: readonly ["layoutGrids"];
|
|
24
23
|
};
|
|
25
24
|
/** The fields that pick a text's face, which its style name names. */
|
|
26
|
-
declare const FACE_KEYS: readonly ["fontFamily", "fontWeight", "italic"];
|
|
25
|
+
export declare const FACE_KEYS: readonly ["fontFamily", "fontWeight", "italic"];
|
|
27
26
|
/**
|
|
28
27
|
* The face name of characters with `style` over the text: their own, none where they set another
|
|
29
28
|
* face without one (as ranges from HTML or `.pen` do), else the text's.
|
|
30
29
|
*/
|
|
31
|
-
declare function rangeFontStyle(node: Pick<SceneNode, 'fontStyle'>, style: CharacterStyleOverride): string | null;
|
|
32
|
-
declare function sharedStyleRefKey(kind: SharedStyleKind): (typeof STYLE_REF_KEYS)[SharedStyleKind];
|
|
33
|
-
declare function sharedStyleTypeForKind(kind: SharedStyleKind): SharedStyleType;
|
|
30
|
+
export declare function rangeFontStyle(node: Pick<SceneNode, 'fontStyle'>, style: CharacterStyleOverride): string | null;
|
|
31
|
+
export declare function sharedStyleRefKey(kind: SharedStyleKind): (typeof STYLE_REF_KEYS)[SharedStyleKind];
|
|
32
|
+
export declare function sharedStyleTypeForKind(kind: SharedStyleKind): SharedStyleType;
|
|
34
33
|
/** The document's shared style layers, by the source ID layers link them by. */
|
|
35
|
-
declare function sharedStyleLayers(graph: SceneGraph): Map<string, SceneNode>;
|
|
36
|
-
declare function getSharedStyles(graph: SceneGraph, kind: SharedStyleKind): SharedStyle[];
|
|
37
|
-
declare function styleDetachmentChanges(node: SceneNode, changes: Partial<SceneNode>): Partial<SceneNode>;
|
|
34
|
+
export declare function sharedStyleLayers(graph: SceneGraph): Map<string, SceneNode>;
|
|
35
|
+
export declare function getSharedStyles(graph: SceneGraph, kind: SharedStyleKind): SharedStyle[];
|
|
36
|
+
export declare function styleDetachmentChanges(node: SceneNode, changes: Partial<SceneNode>): Partial<SceneNode>;
|
|
38
37
|
/** A new local style's ID, in the shape Figma gives one: `S:` and a 40-digit hex key. */
|
|
39
|
-
declare function newSharedStyleId(): string;
|
|
38
|
+
export declare function newSharedStyleId(): string;
|
|
40
39
|
/** The page that holds the document's styles out of view, as a `.fig` file keeps them; made once. */
|
|
41
|
-
declare function internalCanvas(graph: SceneGraph): SceneNode;
|
|
40
|
+
export declare function internalCanvas(graph: SceneGraph): SceneNode;
|
|
42
41
|
/**
|
|
43
42
|
* What a layer takes from a shared style it starts using: the style's fields and the reference
|
|
44
43
|
* that keeps it attached. Without the style's node, the reference alone.
|
|
45
44
|
*/
|
|
46
|
-
declare function sharedStylePatch(kind: SharedStyleKind, target: SceneNode, styleId: string, style: SceneNode | null): Partial<SceneNode>;
|
|
45
|
+
export declare function sharedStylePatch(kind: SharedStyleKind, target: SceneNode, styleId: string, style: SceneNode | null): Partial<SceneNode>;
|
|
47
46
|
/** Whether a text style sets `field`, so a text or range starting to use it lets its binding go. */
|
|
48
|
-
declare function isTextStyleField(field: string): boolean;
|
|
47
|
+
export declare function isTextStyleField(field: string): boolean;
|
|
49
48
|
/** A layer leaving a shared style: it keeps the style's values, without the reference. */
|
|
50
|
-
declare function sharedStyleDetachPatch(kind: SharedStyleKind): Partial<SceneNode>;
|
|
51
|
-
|
|
52
|
-
export { FACE_KEYS, SHARED_STYLE_FIELDS, SHARED_TEXT_STYLE_FIELDS, STYLE_LINK_FIELDS, getSharedStyles, internalCanvas, isTextStyleField, newSharedStyleId, rangeFontStyle, referencedStyleIds, sharedStyleDetachPatch, sharedStyleLayers, sharedStylePatch, sharedStyleRefKey, sharedStyleTypeForKind, styleDetachmentChanges };
|
|
49
|
+
export declare function sharedStyleDetachPatch(kind: SharedStyleKind): Partial<SceneNode>;
|
|
50
|
+
export {};
|
|
53
51
|
//# sourceMappingURL=shared-styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-styles.d.ts","names":[],"sources":["../src/shared-styles.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"shared-styles.d.ts","names":[],"sources":["../src/shared-styles.ts"],"mappings":";;cAoBM;;;;;;;;qBASO;;wBAGG,mBAAmB,MAAM;;qBAiB5B;;qBAwBA;;;;;;;;qBASA;;;;;wBAUG,eACd,MAAM,KAAK,yBACX,OAAO;wBAMO,kBAAkB,MAAM,0BAA0B,gBAAgB;wBAIlE,uBAAuB,MAAM,kBAAkB;;wBAK/C,kBAAkB,OAAO,aAAa,YAAY;wBAOlD,gBAAgB,OAAO,YAAY,MAAM,kBAAkB;wBAuB3D,uBACd,MAAM,WACN,SAAS,QAAQ,aAChB,QAAQ;;wBAmBK;;wBAOA,eAAe,OAAO,aAAa;;;;;wBAmCnC,iBACd,MAAM,iBACN,QAAQ,WACR,iBACA,OAAO,mBACN,QAAQ;;wBA0BK,iBAAiB;;wBAKjB,uBAAuB,MAAM,kBAAkB,QAAQ"}
|
package/dist/shared-styles.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { compact, isEqual, omit, pick } from "es-toolkit";
|
|
2
|
+
import { randomHex } from "@open-pencil/std/random";
|
|
1
3
|
import { BLACK } from "./constants.js";
|
|
2
|
-
import { newStrokeGeometry } from "./node-defaults.js";
|
|
3
4
|
import { copyEffects, copyFills, copyLayoutGrids } from "./copy.js";
|
|
4
|
-
import {
|
|
5
|
+
import { newStrokeGeometry } from "./node-defaults.js";
|
|
5
6
|
import { scaledTextStyleLengths } from "./scaling/node.js";
|
|
7
|
+
import { STROKE_LINE_KEYS } from "./strokes.js";
|
|
6
8
|
import { styleRunReferences } from "./text/references.js";
|
|
7
|
-
|
|
8
|
-
import { randomHex } from "@open-pencil/std/random";
|
|
9
|
-
//#region src/shared-styles.ts
|
|
9
|
+
// src/shared-styles.ts
|
|
10
10
|
const STYLE_REF_KEYS = {
|
|
11
11
|
fill: "fillStyleId",
|
|
12
12
|
stroke: "strokeStyleId",
|
|
@@ -188,7 +188,6 @@ function isTextStyleField(field) {
|
|
|
188
188
|
function sharedStyleDetachPatch(kind) {
|
|
189
189
|
return { [STYLE_REF_KEYS[kind]]: null };
|
|
190
190
|
}
|
|
191
|
-
//#endregion
|
|
192
191
|
export { FACE_KEYS, SHARED_STYLE_FIELDS, SHARED_TEXT_STYLE_FIELDS, STYLE_LINK_FIELDS, getSharedStyles, internalCanvas, isTextStyleField, newSharedStyleId, rangeFontStyle, referencedStyleIds, sharedStyleDetachPatch, sharedStyleLayers, sharedStylePatch, sharedStyleRefKey, sharedStyleTypeForKind, styleDetachmentChanges };
|
|
193
192
|
|
|
194
193
|
//# sourceMappingURL=shared-styles.js.map
|
package/dist/slides/drop.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Vector } from "../primitives/index.js";
|
|
2
1
|
import { SceneGraph } from "../graph.js";
|
|
3
|
-
|
|
2
|
+
import { Vector } from "../primitives/index.js";
|
|
4
3
|
/** Where moved slides go: beside a slide, or as a new section before another one or at the end. */
|
|
5
|
-
type SlidePlacement = {
|
|
4
|
+
export type SlidePlacement = {
|
|
6
5
|
type: 'beside';
|
|
7
6
|
slideId: string;
|
|
8
7
|
side: 'before' | 'after';
|
|
@@ -11,13 +10,13 @@ type SlidePlacement = {
|
|
|
11
10
|
before: string | null;
|
|
12
11
|
};
|
|
13
12
|
/** The line that shows where a drop lands, in canvas units. */
|
|
14
|
-
interface SlideDropLine {
|
|
13
|
+
export interface SlideDropLine {
|
|
15
14
|
x: number;
|
|
16
15
|
y: number;
|
|
17
16
|
length: number;
|
|
18
17
|
direction: 'HORIZONTAL' | 'VERTICAL';
|
|
19
18
|
}
|
|
20
|
-
interface SlideDrop {
|
|
19
|
+
export interface SlideDrop {
|
|
21
20
|
placement: SlidePlacement;
|
|
22
21
|
line: SlideDropLine;
|
|
23
22
|
}
|
|
@@ -26,7 +25,5 @@ interface SlideDrop {
|
|
|
26
25
|
* beside its nearest slide; between sections, above the first, or below the last, as a new section
|
|
27
26
|
* there. Null on a page without a deck.
|
|
28
27
|
*/
|
|
29
|
-
declare function slideDropAt(graph: SceneGraph, pageId: string, point: Vector): SlideDrop | null;
|
|
30
|
-
//#endregion
|
|
31
|
-
export { SlideDrop, SlideDropLine, SlidePlacement, slideDropAt };
|
|
28
|
+
export declare function slideDropAt(graph: SceneGraph, pageId: string, point: Vector): SlideDrop | null;
|
|
32
29
|
//# sourceMappingURL=drop.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drop.d.ts","names":[],"sources":["../../src/slides/drop.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"drop.d.ts","names":[],"sources":["../../src/slides/drop.ts"],"mappings":";;;YAKY;EACN;EAAgB;EAAiB;;EACjC;EAAiB;;;iBAGN;EACf;EACA;EACA;EACA;;iBAGe;EACf,WAAW;EACX,MAAM;;;;;;;wBA8CQ,YAAY,OAAO,YAAY,gBAAgB,OAAO,SAAS"}
|
package/dist/slides/drop.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/slides/drop.ts
|
|
2
2
|
function boxOf(graph, node) {
|
|
3
3
|
const { x, y } = graph.getAbsolutePosition(node.id);
|
|
4
4
|
return {
|
|
@@ -75,7 +75,6 @@ function slideDropAt(graph, pageId, point) {
|
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
//#endregion
|
|
79
78
|
export { slideDropAt };
|
|
80
79
|
|
|
81
80
|
//# sourceMappingURL=drop.js.map
|