@open-pencil/scene-graph 0.16.0 → 0.17.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 +35 -14
- package/dist/arrow-caps.d.ts.map +1 -1
- package/dist/arrow-caps.js +286 -55
- package/dist/arrow-caps.js.map +1 -1
- package/dist/asset-keys.d.ts +17 -0
- package/dist/asset-keys.d.ts.map +1 -0
- package/dist/asset-keys.js.map +1 -0
- package/dist/behaviours/index.d.ts +6 -0
- package/dist/behaviours/index.js +6 -0
- package/dist/behaviours/kinds.d.ts +62 -0
- package/dist/behaviours/kinds.d.ts.map +1 -0
- package/dist/{chunks/behaviours → behaviours}/kinds.js +76 -75
- package/dist/behaviours/kinds.js.map +1 -0
- package/dist/behaviours/layers.d.ts +16 -0
- package/dist/behaviours/layers.d.ts.map +1 -0
- package/dist/behaviours/layers.js +43 -0
- package/dist/behaviours/layers.js.map +1 -0
- package/dist/behaviours/model.d.ts +48 -0
- package/dist/behaviours/model.d.ts.map +1 -0
- package/dist/behaviours/model.js +156 -0
- package/dist/behaviours/model.js.map +1 -0
- package/dist/behaviours/schema.d.ts +228 -0
- package/dist/behaviours/schema.d.ts.map +1 -0
- package/dist/behaviours/schema.js +86 -0
- package/dist/behaviours/schema.js.map +1 -0
- package/dist/behaviours/spec.d.ts +26 -0
- package/dist/behaviours/spec.d.ts.map +1 -0
- package/dist/{chunks/behaviours → behaviours}/spec.js +6 -29
- package/dist/behaviours/spec.js.map +1 -0
- package/dist/bindings.js +26 -0
- package/dist/bindings.js.map +1 -0
- package/dist/buffered-events.d.ts +21 -0
- package/dist/buffered-events.d.ts.map +1 -0
- package/dist/buffered-events.js.map +1 -0
- package/dist/checkpoint.d.ts +42 -0
- package/dist/checkpoint.d.ts.map +1 -0
- package/dist/checkpoint.js +249 -0
- package/dist/checkpoint.js.map +1 -0
- package/dist/clipping.d.ts +31 -0
- package/dist/clipping.d.ts.map +1 -0
- package/dist/clipping.js +125 -0
- package/dist/clipping.js.map +1 -0
- package/dist/color/contrast.d.ts +17 -0
- package/dist/color/contrast.d.ts.map +1 -0
- package/dist/{chunks/color → color}/contrast.js +2 -24
- package/dist/color/contrast.js.map +1 -0
- package/dist/color/index.d.ts +38 -0
- package/dist/color/index.d.ts.map +1 -0
- package/dist/color/index.js +110 -0
- package/dist/color/index.js.map +1 -0
- package/dist/color/management.d.ts +32 -0
- package/dist/color/management.d.ts.map +1 -0
- package/dist/color/management.js +187 -0
- package/dist/color/management.js.map +1 -0
- package/dist/color/normalize.d.ts +6 -0
- package/dist/color/normalize.d.ts.map +1 -0
- package/dist/color/normalize.js +15 -0
- package/dist/color/normalize.js.map +1 -0
- package/dist/color/okhcl.d.ts +33 -0
- package/dist/color/okhcl.d.ts.map +1 -0
- package/dist/color/okhcl.js +146 -0
- package/dist/color/okhcl.js.map +1 -0
- package/dist/color/schema.d.ts +11 -0
- package/dist/color/schema.d.ts.map +1 -0
- package/dist/color/schema.js +13 -0
- package/dist/color/schema.js.map +1 -0
- package/dist/comments/document.d.ts +23 -0
- package/dist/comments/document.d.ts.map +1 -0
- package/dist/{chunks/comments → comments}/document.js +2 -1
- package/dist/comments/document.js.map +1 -0
- package/dist/comments/index.d.ts +6 -0
- package/dist/comments/index.js +6 -0
- package/dist/comments/list.d.ts +25 -0
- package/dist/comments/list.d.ts.map +1 -0
- package/dist/comments/list.js +33 -0
- package/dist/comments/list.js.map +1 -0
- package/dist/comments/merge.d.ts +16 -0
- package/dist/comments/merge.d.ts.map +1 -0
- package/dist/{chunks/comments → comments}/merge.js +1 -1
- package/dist/comments/merge.js.map +1 -0
- package/dist/comments/schema.d.ts +8 -0
- package/dist/comments/schema.d.ts.map +1 -0
- package/dist/comments/schema.js +50 -0
- package/dist/comments/schema.js.map +1 -0
- package/dist/comments/threads.d.ts +59 -0
- package/dist/comments/threads.d.ts.map +1 -0
- package/dist/{chunks/comments/list.js → comments/threads.js} +3 -53
- package/dist/comments/threads.js.map +1 -0
- package/dist/components/exposure.d.ts +24 -0
- package/dist/components/exposure.d.ts.map +1 -0
- package/dist/components/exposure.js +51 -0
- package/dist/components/exposure.js.map +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +4 -0
- package/dist/components/properties.d.ts +32 -0
- package/dist/components/properties.d.ts.map +1 -0
- package/dist/components/properties.js +180 -0
- package/dist/components/properties.js.map +1 -0
- package/dist/components/variants.d.ts +33 -0
- package/dist/components/variants.d.ts.map +1 -0
- package/dist/components/variants.js +58 -0
- package/dist/components/variants.js.map +1 -0
- package/dist/connectors/controls.d.ts +34 -0
- package/dist/connectors/controls.d.ts.map +1 -0
- package/dist/connectors/controls.js +196 -0
- package/dist/connectors/controls.js.map +1 -0
- package/dist/connectors/create.d.ts +23 -0
- package/dist/connectors/create.d.ts.map +1 -0
- package/dist/connectors/create.js +33 -0
- package/dist/connectors/create.js.map +1 -0
- package/dist/connectors/elbow.js +191 -0
- package/dist/connectors/elbow.js.map +1 -0
- package/dist/connectors/gaps.d.ts +10 -0
- package/dist/connectors/gaps.d.ts.map +1 -0
- package/dist/connectors/gaps.js +86 -0
- package/dist/connectors/gaps.js.map +1 -0
- package/dist/connectors/hit.d.ts +11 -0
- package/dist/connectors/hit.d.ts.map +1 -0
- package/dist/connectors/hit.js +47 -0
- package/dist/connectors/hit.js.map +1 -0
- package/dist/connectors/index.d.ts +11 -0
- package/dist/connectors/index.js +11 -0
- package/dist/connectors/label.d.ts +32 -0
- package/dist/connectors/label.d.ts.map +1 -0
- package/dist/connectors/label.js +213 -0
- package/dist/connectors/label.js.map +1 -0
- package/dist/connectors/layout.d.ts +46 -0
- package/dist/connectors/layout.d.ts.map +1 -0
- package/dist/connectors/layout.js +234 -0
- package/dist/connectors/layout.js.map +1 -0
- package/dist/connectors/pieces.d.ts +22 -0
- package/dist/connectors/pieces.d.ts.map +1 -0
- package/dist/connectors/pieces.js +156 -0
- package/dist/connectors/pieces.js.map +1 -0
- package/dist/connectors/route.d.ts +23 -0
- package/dist/connectors/route.d.ts.map +1 -0
- package/dist/connectors/route.js +107 -0
- package/dist/connectors/route.js.map +1 -0
- package/dist/connectors/sides.d.ts +23 -0
- package/dist/connectors/sides.d.ts.map +1 -0
- package/dist/connectors/sides.js +98 -0
- package/dist/connectors/sides.js.map +1 -0
- package/dist/connectors/sublayers.d.ts +76 -0
- package/dist/connectors/sublayers.d.ts.map +1 -0
- package/dist/connectors/sublayers.js +208 -0
- package/dist/connectors/sublayers.js.map +1 -0
- package/dist/constants.d.ts +11 -2
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +25 -1
- package/dist/constants.js.map +1 -0
- package/dist/coordinate.d.ts +94 -2
- package/dist/coordinate.d.ts.map +1 -0
- package/dist/coordinate.js +268 -1
- package/dist/coordinate.js.map +1 -0
- package/dist/copy.d.ts +49 -2
- package/dist/copy.d.ts.map +1 -0
- package/dist/copy.js +264 -2
- package/dist/copy.js.map +1 -0
- package/dist/css/blend.d.ts +11 -0
- package/dist/css/blend.d.ts.map +1 -0
- package/dist/css/blend.js +30 -0
- package/dist/css/blend.js.map +1 -0
- package/dist/css/grid.d.ts +7 -0
- package/dist/css/grid.d.ts.map +1 -0
- package/dist/{chunks/css → css}/grid.js +2 -33
- package/dist/css/grid.js.map +1 -0
- package/dist/css/index.d.ts +7 -0
- package/dist/css/index.js +7 -0
- package/dist/css/layout.d.ts +17 -0
- package/dist/css/layout.d.ts.map +1 -0
- package/dist/css/layout.js +45 -0
- package/dist/css/layout.js.map +1 -0
- package/dist/css/shadows.d.ts +10 -0
- package/dist/css/shadows.d.ts.map +1 -0
- package/dist/css/shadows.js +64 -0
- package/dist/css/shadows.js.map +1 -0
- package/dist/css/text.d.ts +22 -0
- package/dist/css/text.d.ts.map +1 -0
- package/dist/css/text.js +76 -0
- package/dist/css/text.js.map +1 -0
- package/dist/css/values.d.ts +14 -0
- package/dist/css/values.d.ts.map +1 -0
- package/dist/css/values.js +36 -0
- package/dist/css/values.js.map +1 -0
- package/dist/cubic.d.ts +7 -0
- package/dist/cubic.d.ts.map +1 -0
- package/dist/cubic.js +17 -0
- package/dist/cubic.js.map +1 -0
- package/dist/events.js.map +1 -0
- package/dist/export-format.d.ts +25 -0
- package/dist/export-format.d.ts.map +1 -0
- package/dist/export-format.js +47 -0
- package/dist/export-format.js.map +1 -0
- package/dist/export-scale.d.ts +14 -0
- package/dist/export-scale.d.ts.map +1 -0
- package/dist/export-scale.js +19 -0
- package/dist/export-scale.js.map +1 -0
- package/dist/fields/appearance.d.ts +9 -0
- package/dist/fields/appearance.d.ts.map +1 -0
- package/dist/fields/appearance.js +36 -0
- package/dist/fields/appearance.js.map +1 -0
- package/dist/fields/geometry.d.ts +7 -0
- package/dist/fields/geometry.d.ts.map +1 -0
- package/dist/fields/geometry.js.map +1 -0
- package/dist/fields/index.d.ts +5 -0
- package/dist/fields/index.js +5 -0
- package/dist/fields/layout.d.ts +10 -0
- package/dist/fields/layout.d.ts.map +1 -0
- package/dist/fields/layout.js +49 -0
- package/dist/fields/layout.js.map +1 -0
- package/dist/fields/text.d.ts +11 -0
- package/dist/fields/text.d.ts.map +1 -0
- package/dist/fields/text.js +64 -0
- package/dist/fields/text.js.map +1 -0
- package/dist/fig-compression.d.ts +11 -0
- package/dist/fig-compression.d.ts.map +1 -0
- package/dist/fig-compression.js +15 -0
- package/dist/fig-compression.js.map +1 -0
- package/dist/figjam/index.d.ts +3 -0
- package/dist/figjam/index.js +3 -0
- package/dist/figjam/palette.d.ts +270 -0
- package/dist/figjam/palette.d.ts.map +1 -0
- package/dist/figjam/palette.js +439 -0
- package/dist/figjam/palette.js.map +1 -0
- package/dist/figjam/text.d.ts +70 -0
- package/dist/figjam/text.d.ts.map +1 -0
- package/dist/figjam/text.js +95 -0
- package/dist/figjam/text.js.map +1 -0
- package/dist/font-style.d.ts +46 -0
- package/dist/font-style.d.ts.map +1 -0
- package/dist/font-style.js +127 -0
- package/dist/font-style.js.map +1 -0
- package/dist/generated/index.d.ts +44 -0
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/index.js +58 -0
- package/dist/generated/index.js.map +1 -0
- package/dist/generated/kind.d.ts +27 -0
- package/dist/generated/kind.d.ts.map +1 -0
- package/dist/generated/shape-with-text.d.ts +43 -0
- package/dist/generated/shape-with-text.d.ts.map +1 -0
- package/dist/generated/shape-with-text.js +135 -0
- package/dist/generated/shape-with-text.js.map +1 -0
- package/dist/generated/sticky.d.ts +128 -0
- package/dist/generated/sticky.d.ts.map +1 -0
- package/dist/generated/sticky.js +233 -0
- package/dist/generated/sticky.js.map +1 -0
- package/dist/geometry.d.ts +89 -2
- package/dist/geometry.d.ts.map +1 -0
- package/dist/geometry.js +306 -2
- package/dist/geometry.js.map +1 -0
- package/dist/gradient.d.ts +9 -2
- package/dist/gradient.d.ts.map +1 -1
- package/dist/gradient.js +13 -1
- package/dist/gradient.js.map +1 -1
- package/dist/graph.d.ts +178 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +625 -0
- package/dist/graph.js.map +1 -0
- package/dist/group-bounds.d.ts +42 -0
- package/dist/group-bounds.d.ts.map +1 -0
- package/dist/{chunks/group-bounds.js → group-bounds.js} +56 -14
- package/dist/group-bounds.js.map +1 -0
- package/dist/guides.d.ts +21 -2
- package/dist/guides.d.ts.map +1 -0
- package/dist/guides.js +5 -1
- package/dist/guides.js.map +1 -1
- package/dist/hit-test.d.ts +48 -2
- package/dist/hit-test.d.ts.map +1 -0
- package/dist/hit-test.js +75 -57
- package/dist/hit-test.js.map +1 -1
- package/dist/icons/glyph.d.ts +22 -0
- package/dist/icons/glyph.d.ts.map +1 -0
- package/dist/{chunks/icons → icons}/glyph.js +2 -40
- package/dist/icons/glyph.js.map +1 -0
- package/dist/icons/index.d.ts +4 -0
- package/dist/icons/index.js +4 -0
- package/dist/icons/model.d.ts +29 -0
- package/dist/icons/model.d.ts.map +1 -0
- package/dist/icons/model.js +51 -0
- package/dist/icons/model.js.map +1 -0
- package/dist/icons/schema.d.ts +31 -0
- package/dist/icons/schema.d.ts.map +1 -0
- package/dist/icons/schema.js +28 -0
- package/dist/icons/schema.js.map +1 -0
- package/dist/ids.d.ts +12 -0
- package/dist/ids.d.ts.map +1 -0
- package/dist/ids.js +31 -0
- package/dist/ids.js.map +1 -0
- package/dist/images.d.ts +39 -2
- package/dist/images.d.ts.map +1 -0
- package/dist/images.js +67 -9
- package/dist/images.js.map +1 -1
- package/dist/index.d.ts +5 -7
- package/dist/index.js +5 -23
- package/dist/instances/assignments.js +89 -0
- package/dist/instances/assignments.js.map +1 -0
- package/dist/instances/content-size.js +60 -0
- package/dist/instances/content-size.js.map +1 -0
- package/dist/instances/copies.js +161 -0
- package/dist/instances/copies.js.map +1 -0
- package/dist/instances/cycles.d.ts +20 -0
- package/dist/instances/cycles.d.ts.map +1 -0
- package/dist/instances/cycles.js +53 -0
- package/dist/instances/cycles.js.map +1 -0
- package/dist/instances/fields.d.ts +18 -0
- package/dist/instances/fields.d.ts.map +1 -0
- package/dist/instances/fields.js +90 -0
- package/dist/instances/fields.js.map +1 -0
- package/dist/instances/index.d.ts +38 -0
- package/dist/instances/index.d.ts.map +1 -0
- package/dist/instances/index.js +180 -0
- package/dist/instances/index.js.map +1 -0
- package/dist/instances/kept-overrides.js +204 -0
- package/dist/instances/kept-overrides.js.map +1 -0
- package/dist/instances/main-component.d.ts +13 -0
- package/dist/instances/main-component.d.ts.map +1 -0
- package/dist/instances/main-component.js +50 -0
- package/dist/instances/main-component.js.map +1 -0
- package/dist/instances/overrides.d.ts +51 -0
- package/dist/instances/overrides.d.ts.map +1 -0
- package/dist/instances/overrides.js +158 -0
- package/dist/instances/overrides.js.map +1 -0
- package/dist/instances/placement.js +30 -0
- package/dist/instances/placement.js.map +1 -0
- package/dist/instances/source-walk.js +31 -0
- package/dist/instances/source-walk.js.map +1 -0
- package/dist/instances/swap.js +288 -0
- package/dist/instances/swap.js.map +1 -0
- package/dist/instances/sync.js +327 -0
- package/dist/instances/sync.js.map +1 -0
- package/dist/instances/vector-geometry.js +70 -0
- package/dist/instances/vector-geometry.js.map +1 -0
- package/dist/layout/aspect-ratio.d.ts +27 -0
- package/dist/layout/aspect-ratio.d.ts.map +1 -0
- package/dist/layout/aspect-ratio.js +45 -0
- package/dist/layout/aspect-ratio.js.map +1 -0
- package/dist/layout/guides.d.ts +25 -0
- package/dist/layout/guides.d.ts.map +1 -0
- package/dist/layout/guides.js +105 -0
- package/dist/layout/guides.js.map +1 -0
- package/dist/layout/index.d.ts +5 -0
- package/dist/{layout.js → layout/index.js} +4 -3
- package/dist/layout/keywords.d.ts +26 -0
- package/dist/layout/keywords.d.ts.map +1 -0
- package/dist/layout/keywords.js +59 -0
- package/dist/layout/keywords.js.map +1 -0
- package/dist/layout/sizing.d.ts +40 -0
- package/dist/layout/sizing.d.ts.map +1 -0
- package/dist/layout/sizing.js +122 -0
- package/dist/layout/sizing.js.map +1 -0
- package/dist/layout/writes.js +55 -0
- package/dist/layout/writes.js.map +1 -0
- package/dist/matrix.d.ts +16 -2
- package/dist/matrix.d.ts.map +1 -0
- package/dist/matrix.js +119 -1
- package/dist/matrix.js.map +1 -0
- package/dist/mutation-impact.d.ts +23 -0
- package/dist/mutation-impact.d.ts.map +1 -0
- package/dist/mutation-impact.js +67 -0
- package/dist/mutation-impact.js.map +1 -0
- package/dist/node-defaults.d.ts +22 -2
- package/dist/node-defaults.d.ts.map +1 -0
- package/dist/node-defaults.js +254 -2
- package/dist/node-defaults.js.map +1 -0
- package/dist/outline/flatten.d.ts +15 -0
- package/dist/outline/flatten.d.ts.map +1 -0
- package/dist/outline/flatten.js +189 -0
- package/dist/outline/flatten.js.map +1 -0
- package/dist/outline/heads.js +34 -0
- package/dist/outline/heads.js.map +1 -0
- package/dist/outline/hit.d.ts +21 -0
- package/dist/outline/hit.d.ts.map +1 -0
- package/dist/outline/hit.js +276 -0
- package/dist/outline/hit.js.map +1 -0
- package/dist/outline/index.d.ts +5 -0
- package/dist/outline/index.js +5 -0
- package/dist/outline/point.d.ts +16 -0
- package/dist/outline/point.d.ts.map +1 -0
- package/dist/outline/point.js +42 -0
- package/dist/outline/point.js.map +1 -0
- package/dist/outline/shapes.d.ts +35 -0
- package/dist/outline/shapes.d.ts.map +1 -0
- package/dist/outline/shapes.js +181 -0
- package/dist/outline/shapes.js.map +1 -0
- package/dist/paints/index.d.ts +2 -0
- package/dist/paints/index.js +2 -0
- package/dist/paints/schema.d.ts +77 -0
- package/dist/paints/schema.d.ts.map +1 -0
- package/dist/paints/schema.js +56 -0
- package/dist/paints/schema.js.map +1 -0
- package/dist/parse-path.d.ts +9 -1
- package/dist/parse-path.d.ts.map +1 -1
- package/dist/parse-path.js +39 -2
- package/dist/parse-path.js.map +1 -1
- package/dist/plugin-data/field.d.ts +47 -0
- package/dist/plugin-data/field.d.ts.map +1 -0
- package/dist/plugin-data/field.js +73 -0
- package/dist/plugin-data/field.js.map +1 -0
- package/dist/plugin-data/fields.d.ts +143 -0
- package/dist/plugin-data/fields.d.ts.map +1 -0
- package/dist/plugin-data/fields.js +168 -0
- package/dist/plugin-data/fields.js.map +1 -0
- package/dist/plugin-data/index.d.ts +3 -0
- package/dist/plugin-data/index.js +3 -0
- package/dist/polygon.d.ts +4 -2
- package/dist/polygon.d.ts.map +1 -1
- package/dist/polygon.js +17 -2
- package/dist/polygon.js.map +1 -1
- package/dist/preview.d.ts +12 -2
- package/dist/preview.d.ts.map +1 -0
- package/dist/preview.js +62 -1
- package/dist/preview.js.map +1 -0
- package/dist/{primitives2.d.ts → primitives/index.d.ts} +4 -3
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +2 -0
- package/dist/primitives/schema.d.ts +18 -0
- package/dist/primitives/schema.d.ts.map +1 -0
- package/dist/primitives/schema.js +19 -0
- package/dist/primitives/schema.js.map +1 -0
- package/dist/random.js +24 -1
- package/dist/random.js.map +1 -0
- package/dist/resize.d.ts +6 -4
- package/dist/resize.d.ts.map +1 -1
- package/dist/resize.js +287 -2
- package/dist/resize.js.map +1 -0
- package/dist/scaling/index.d.ts +3 -0
- package/dist/scaling/index.js +3 -0
- package/dist/scaling/node.d.ts +6 -0
- package/dist/scaling/node.d.ts.map +1 -0
- package/dist/scaling/node.js +148 -0
- package/dist/scaling/node.js.map +1 -0
- package/dist/scaling/tree.d.ts +7 -0
- package/dist/scaling/tree.d.ts.map +1 -0
- package/dist/scaling/tree.js +47 -0
- package/dist/scaling/tree.js.map +1 -0
- package/dist/shaders/index.d.ts +4 -0
- package/dist/shaders/index.js +4 -0
- package/dist/shaders/model.d.ts +41 -0
- package/dist/shaders/model.d.ts.map +1 -0
- package/dist/shaders/model.js +71 -0
- package/dist/shaders/model.js.map +1 -0
- package/dist/shaders/schema.d.ts +41 -0
- package/dist/shaders/schema.d.ts.map +1 -0
- package/dist/shaders/schema.js +36 -0
- package/dist/shaders/schema.js.map +1 -0
- package/dist/shaders/still.d.ts +18 -0
- package/dist/shaders/still.d.ts.map +1 -0
- package/dist/shaders/still.js +36 -0
- package/dist/shaders/still.js.map +1 -0
- package/dist/shape-with-text/fit.d.ts +28 -0
- package/dist/shape-with-text/fit.d.ts.map +1 -0
- package/dist/shape-with-text/fit.js +271 -0
- package/dist/shape-with-text/fit.js.map +1 -0
- package/dist/shape-with-text/geometry.d.ts +20 -0
- package/dist/shape-with-text/geometry.d.ts.map +1 -0
- package/dist/shape-with-text/geometry.js +539 -0
- package/dist/shape-with-text/geometry.js.map +1 -0
- package/dist/shape-with-text/index.d.ts +4 -0
- package/dist/shape-with-text/index.js +4 -0
- package/dist/shape-with-text/kinds.d.ts +20 -0
- package/dist/shape-with-text/kinds.d.ts.map +1 -0
- package/dist/shape-with-text/kinds.js +86 -0
- package/dist/shape-with-text/kinds.js.map +1 -0
- package/dist/shared-styles.d.ts +51 -0
- package/dist/shared-styles.d.ts.map +1 -0
- package/dist/shared-styles.js +186 -0
- package/dist/shared-styles.js.map +1 -0
- package/dist/slots/authoring.d.ts +27 -0
- package/dist/slots/authoring.d.ts.map +1 -0
- package/dist/slots/authoring.js +77 -0
- package/dist/slots/authoring.js.map +1 -0
- package/dist/slots/content.d.ts +41 -0
- package/dist/slots/content.d.ts.map +1 -0
- package/dist/slots/content.js +105 -0
- package/dist/slots/content.js.map +1 -0
- package/dist/slots/frames.d.ts +40 -0
- package/dist/slots/frames.d.ts.map +1 -0
- package/dist/slots/frames.js +118 -0
- package/dist/slots/frames.js.map +1 -0
- package/dist/slots/index.d.ts +5 -0
- package/dist/slots/index.js +5 -0
- package/dist/slots/limits.d.ts +14 -0
- package/dist/slots/limits.d.ts.map +1 -0
- package/dist/slots/limits.js +28 -0
- package/dist/slots/limits.js.map +1 -0
- package/dist/snap.d.ts +21 -2
- package/dist/snap.d.ts.map +1 -0
- package/dist/snap.js +109 -1
- package/dist/snap.js.map +1 -0
- package/dist/source-metadata.js +10 -1
- package/dist/source-metadata.js.map +1 -0
- package/dist/statuses/impact.d.ts +18 -0
- package/dist/statuses/impact.d.ts.map +1 -0
- package/dist/statuses/impact.js +33 -0
- package/dist/statuses/impact.js.map +1 -0
- package/dist/statuses/index.d.ts +5 -0
- package/dist/statuses/index.js +5 -0
- package/dist/statuses/node.d.ts +22 -0
- package/dist/statuses/node.d.ts.map +1 -0
- package/dist/statuses/node.js +47 -0
- package/dist/statuses/node.js.map +1 -0
- package/dist/statuses/schema.d.ts +59 -0
- package/dist/statuses/schema.d.ts.map +1 -0
- package/dist/statuses/schema.js +27 -0
- package/dist/statuses/schema.js.map +1 -0
- package/dist/statuses/workflow.d.ts +120 -0
- package/dist/statuses/workflow.d.ts.map +1 -0
- package/dist/statuses/workflow.js +135 -0
- package/dist/statuses/workflow.js.map +1 -0
- package/dist/{text-direction.d.ts → text/direction.d.ts} +2 -2
- package/dist/text/direction.d.ts.map +1 -0
- package/dist/{text-direction.js → text/direction.js} +1 -1
- package/dist/text/direction.js.map +1 -0
- package/dist/text/index.d.ts +7 -0
- package/dist/text/index.js +7 -0
- package/dist/text/lengths.d.ts +24 -0
- package/dist/text/lengths.d.ts.map +1 -0
- package/dist/text/lengths.js +49 -0
- package/dist/text/lengths.js.map +1 -0
- package/dist/text/lists.d.ts +44 -0
- package/dist/text/lists.d.ts.map +1 -0
- package/dist/text/lists.js +100 -0
- package/dist/text/lists.js.map +1 -0
- package/dist/text/overflow.d.ts +11 -0
- package/dist/text/overflow.d.ts.map +1 -0
- package/dist/text/overflow.js +13 -0
- package/dist/text/overflow.js.map +1 -0
- package/dist/text/paragraphs.d.ts +62 -0
- package/dist/text/paragraphs.d.ts.map +1 -0
- package/dist/text/paragraphs.js +166 -0
- package/dist/text/paragraphs.js.map +1 -0
- package/dist/{text-picture.d.ts → text/picture.d.ts} +3 -4
- package/dist/text/picture.d.ts.map +1 -0
- package/dist/text/picture.js +38 -0
- package/dist/text/picture.js.map +1 -0
- package/dist/text/references.d.ts +21 -0
- package/dist/text/references.d.ts.map +1 -0
- package/dist/text/references.js +43 -0
- package/dist/text/references.js.map +1 -0
- package/dist/text/schema.d.ts +10 -0
- package/dist/text/schema.d.ts.map +1 -0
- package/dist/text/schema.js +11 -0
- package/dist/text/schema.js.map +1 -0
- package/dist/transfer/apply.d.ts +9 -0
- package/dist/transfer/apply.d.ts.map +1 -0
- package/dist/transfer/apply.js +65 -0
- package/dist/transfer/apply.js.map +1 -0
- package/dist/transfer/copied.d.ts +14 -0
- package/dist/transfer/copied.d.ts.map +1 -0
- package/dist/transfer/copied.js +52 -0
- package/dist/transfer/copied.js.map +1 -0
- package/dist/transfer/history.d.ts +8 -0
- package/dist/transfer/history.d.ts.map +1 -0
- package/dist/transfer/history.js +32 -0
- package/dist/transfer/history.js.map +1 -0
- package/dist/transfer/identity.js +12 -0
- package/dist/transfer/identity.js.map +1 -0
- package/dist/transfer/index.d.ts +8 -0
- package/dist/transfer/index.js +8 -0
- package/dist/transfer/nodes.d.ts +14 -0
- package/dist/transfer/nodes.d.ts.map +1 -0
- package/dist/transfer/nodes.js +78 -0
- package/dist/transfer/nodes.js.map +1 -0
- package/dist/transfer/plan.d.ts +29 -0
- package/dist/transfer/plan.d.ts.map +1 -0
- package/dist/transfer/plan.js +106 -0
- package/dist/transfer/plan.js.map +1 -0
- package/dist/transfer/references.js +10 -0
- package/dist/transfer/references.js.map +1 -0
- package/dist/transfer/remove.d.ts +8 -0
- package/dist/transfer/remove.d.ts.map +1 -0
- package/dist/transfer/remove.js +34 -0
- package/dist/transfer/remove.js.map +1 -0
- package/dist/transfer/validation.js +39 -0
- package/dist/transfer/validation.js.map +1 -0
- package/dist/transfer/variables.d.ts +15 -0
- package/dist/transfer/variables.d.ts.map +1 -0
- package/dist/transfer/variables.js +52 -0
- package/dist/transfer/variables.js.map +1 -0
- package/dist/types.d.ts +195 -2007
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +89 -2
- package/dist/types.js.map +1 -0
- package/dist/undo.d.ts +93 -2
- package/dist/undo.d.ts.map +1 -0
- package/dist/undo.js +235 -1
- package/dist/undo.js.map +1 -0
- package/dist/variables/bindings.d.ts +83 -0
- package/dist/variables/bindings.d.ts.map +1 -0
- package/dist/variables/bindings.js +314 -0
- package/dist/variables/bindings.js.map +1 -0
- package/dist/variables/corners.d.ts +12 -0
- package/dist/variables/corners.d.ts.map +1 -0
- package/dist/variables/corners.js +38 -0
- package/dist/variables/corners.js.map +1 -0
- package/dist/variables/fields.d.ts +43 -0
- package/dist/variables/fields.d.ts.map +1 -0
- package/dist/variables/fields.js +104 -0
- package/dist/variables/fields.js.map +1 -0
- package/dist/variables/formula/check.d.ts +14 -0
- package/dist/variables/formula/check.d.ts.map +1 -0
- package/dist/variables/formula/check.js +73 -0
- package/dist/variables/formula/check.js.map +1 -0
- package/dist/variables/formula/evaluate.d.ts +7 -0
- package/dist/variables/formula/evaluate.d.ts.map +1 -0
- package/dist/variables/formula/evaluate.js +30 -0
- package/dist/variables/formula/evaluate.js.map +1 -0
- package/dist/variables/formula/index.d.ts +21 -0
- package/dist/variables/formula/index.d.ts.map +1 -0
- package/dist/variables/formula/index.js +77 -0
- package/dist/variables/formula/index.js.map +1 -0
- package/dist/variables/formula/parse.js +141 -0
- package/dist/variables/formula/parse.js.map +1 -0
- package/dist/variables/formula/print.d.ts +25 -0
- package/dist/variables/formula/print.d.ts.map +1 -0
- package/dist/variables/formula/print.js +105 -0
- package/dist/variables/formula/print.js.map +1 -0
- package/dist/variables/formula/schema.d.ts +7 -0
- package/dist/variables/formula/schema.d.ts.map +1 -0
- package/dist/variables/formula/schema.js +62 -0
- package/dist/variables/formula/schema.js.map +1 -0
- package/dist/variables/formula/signatures.d.ts +9 -0
- package/dist/variables/formula/signatures.d.ts.map +1 -0
- package/dist/variables/formula/signatures.js +238 -0
- package/dist/variables/formula/signatures.js.map +1 -0
- package/dist/variables/formula/tokens.d.ts +26 -0
- package/dist/variables/formula/tokens.d.ts.map +1 -0
- package/dist/variables/formula/tokens.js +82 -0
- package/dist/variables/formula/tokens.js.map +1 -0
- package/dist/variables/formula/tree.d.ts +22 -0
- package/dist/variables/formula/tree.d.ts.map +1 -0
- package/dist/variables/formula/tree.js +35 -0
- package/dist/variables/formula/tree.js.map +1 -0
- package/dist/variables/index.d.ts +41 -0
- package/dist/variables/index.d.ts.map +1 -0
- package/dist/variables/index.js +238 -0
- package/dist/variables/index.js.map +1 -0
- package/dist/variables/resolution.d.ts +39 -0
- package/dist/variables/resolution.d.ts.map +1 -0
- package/dist/variables/resolution.js +154 -0
- package/dist/variables/resolution.js.map +1 -0
- package/dist/variables/schema.d.ts +40 -0
- package/dist/variables/schema.d.ts.map +1 -0
- package/dist/variables/schema.js +32 -0
- package/dist/variables/schema.js.map +1 -0
- package/dist/variables/text.d.ts +16 -0
- package/dist/variables/text.d.ts.map +1 -0
- package/dist/variables/text.js +49 -0
- package/dist/variables/text.js.map +1 -0
- package/dist/variables/token.d.ts +18 -0
- package/dist/variables/token.d.ts.map +1 -0
- package/dist/variables/token.js +39 -0
- package/dist/variables/token.js.map +1 -0
- package/dist/variables/units.js +19 -0
- package/dist/variables/units.js.map +1 -0
- package/dist/variables/value.d.ts +12 -0
- package/dist/variables/value.d.ts.map +1 -0
- package/dist/variables/value.js +70 -0
- package/dist/variables/value.js.map +1 -0
- package/dist/vector-network.d.ts +65 -2
- package/dist/vector-network.d.ts.map +1 -0
- package/dist/vector-network.js +375 -2
- package/dist/vector-network.js.map +1 -0
- package/package.json +303 -137
- package/src/arrow-caps.ts +279 -62
- package/src/behaviours/index.ts +5 -0
- package/src/behaviours/kinds.ts +51 -34
- package/src/behaviours/layers.ts +5 -3
- package/src/behaviours/model.ts +25 -22
- package/src/behaviours/schema.ts +64 -13
- package/src/behaviours/spec.ts +11 -50
- package/src/bindings.ts +11 -2
- package/src/checkpoint.ts +252 -5
- package/src/clipping.ts +112 -0
- package/src/color/index.ts +1 -0
- package/src/color/schema.ts +10 -0
- package/src/comments/document.ts +1 -1
- package/src/comments/index.ts +5 -0
- package/src/comments/schema.ts +51 -0
- package/src/comments/threads.ts +1 -1
- package/src/components/exposure.ts +1 -1
- package/src/components/index.ts +8 -0
- package/src/components/properties.ts +94 -4
- package/src/components/variants.ts +52 -31
- package/src/connectors/controls.ts +229 -0
- package/src/connectors/create.ts +48 -0
- package/src/connectors/elbow.ts +235 -0
- package/src/connectors/gaps.ts +72 -0
- package/src/connectors/hit.ts +49 -0
- package/src/connectors/index.ts +28 -0
- package/src/connectors/label.ts +238 -0
- package/src/connectors/layout.ts +280 -0
- package/src/connectors/pieces.ts +141 -0
- package/src/connectors/route.ts +148 -0
- package/src/connectors/sides.ts +94 -0
- package/src/connectors/sublayers.ts +203 -0
- package/src/coordinate.ts +10 -3
- package/src/copy.ts +71 -31
- package/src/css/blend.ts +27 -0
- package/src/css/index.ts +2 -0
- package/src/css/text.ts +84 -0
- package/src/cubic.ts +14 -0
- package/src/export-format.ts +30 -1
- package/src/fields/appearance.ts +35 -0
- package/src/fields/index.ts +4 -0
- package/src/fields/layout.ts +48 -0
- package/src/fields/text.ts +32 -1
- package/src/fig-compression.ts +9 -0
- package/src/figjam/index.ts +2 -0
- package/src/figjam/palette.ts +473 -0
- package/src/figjam/text.ts +83 -0
- package/src/font-style.ts +58 -14
- package/src/generated/index.ts +76 -0
- package/src/generated/kind.ts +24 -0
- package/src/generated/shape-with-text.ts +157 -0
- package/src/generated/sticky.ts +213 -0
- package/src/geometry.ts +102 -312
- package/src/gradient.ts +14 -0
- package/src/graph.ts +849 -0
- package/src/group-bounds.ts +59 -12
- package/src/guides.ts +6 -1
- package/src/hit-test.ts +118 -74
- package/src/icons/index.ts +3 -0
- package/src/icons/model.ts +9 -0
- package/src/icons/schema.ts +19 -3
- package/src/ids.ts +34 -0
- package/src/images.ts +71 -8
- package/src/index.ts +2 -976
- package/src/instances/assignments.ts +116 -0
- package/src/instances/content-size.ts +23 -2
- package/src/instances/copies.ts +7 -10
- package/src/instances/cycles.ts +1 -1
- package/src/instances/fields.ts +47 -92
- package/src/{instances.ts → instances/index.ts} +69 -44
- package/src/instances/kept-overrides.ts +280 -0
- package/src/instances/main-component.ts +55 -1
- package/src/{instance-overrides.ts → instances/overrides.ts} +58 -2
- package/src/instances/placement.ts +1 -1
- package/src/instances/source-walk.ts +3 -9
- package/src/instances/swap.ts +451 -0
- package/src/instances/sync.ts +166 -177
- package/src/instances/vector-geometry.ts +3 -3
- package/src/layout/aspect-ratio.ts +1 -1
- package/src/layout/sizing.ts +1 -1
- package/src/layout/writes.ts +59 -0
- package/src/matrix.ts +1 -1
- package/src/mutation-impact.ts +1 -1
- package/src/node-defaults.ts +43 -3
- package/src/outline/flatten.ts +190 -0
- package/src/outline/heads.ts +52 -0
- package/src/outline/hit.ts +369 -0
- package/src/outline/index.ts +4 -0
- package/src/outline/point.ts +59 -0
- package/src/outline/shapes.ts +207 -0
- package/src/paints/index.ts +1 -0
- package/src/paints/schema.ts +67 -0
- package/src/parse-path.ts +49 -4
- package/src/plugin-data/fields.ts +69 -77
- package/src/plugin-data/index.ts +2 -0
- package/src/polygon.ts +17 -0
- package/src/preview.ts +1 -1
- package/src/{primitives.ts → primitives/index.ts} +2 -0
- package/src/primitives/schema.ts +14 -0
- package/src/resize.ts +32 -6
- package/src/scaling/node.ts +10 -6
- package/src/scaling/tree.ts +2 -1
- package/src/shaders/index.ts +3 -0
- package/src/shaders/schema.ts +3 -3
- package/src/shape-with-text/fit.ts +154 -0
- package/src/shape-with-text/geometry.ts +496 -0
- package/src/shape-with-text/index.ts +10 -0
- package/src/shape-with-text/kinds.ts +86 -0
- package/src/shared-styles.ts +169 -17
- package/src/slots/authoring.ts +1 -1
- package/src/slots/content.ts +10 -5
- package/src/slots/frames.ts +12 -10
- package/src/slots/index.ts +4 -0
- package/src/slots/limits.ts +1 -1
- package/src/snap.ts +3 -1
- package/src/statuses/impact.ts +38 -0
- package/src/statuses/index.ts +4 -0
- package/src/statuses/node.ts +63 -0
- package/src/statuses/schema.ts +39 -0
- package/src/statuses/workflow.ts +121 -0
- package/src/text/index.ts +3 -0
- package/src/text/lengths.ts +44 -0
- package/src/text/overflow.ts +12 -0
- package/src/text/picture.ts +0 -4
- package/src/text/schema.ts +7 -0
- package/src/transfer/apply.ts +1 -1
- package/src/transfer/copied.ts +72 -0
- package/src/transfer/history.ts +1 -1
- package/src/transfer/index.ts +1 -0
- package/src/transfer/nodes.ts +18 -19
- package/src/transfer/plan.ts +1 -1
- package/src/transfer/remove.ts +1 -1
- package/src/transfer/validation.ts +1 -1
- package/src/transfer/variables.ts +7 -6
- package/src/types.ts +246 -13
- package/src/undo.ts +64 -2
- package/src/variables/bindings.ts +166 -66
- package/src/variables/corners.ts +39 -0
- package/src/variables/fields.ts +83 -0
- package/src/variables/formula/check.ts +99 -0
- package/src/variables/formula/evaluate.ts +33 -0
- package/src/variables/formula/index.ts +129 -0
- package/src/variables/formula/parse.ts +160 -0
- package/src/variables/formula/print.ts +167 -0
- package/src/variables/formula/schema.ts +77 -0
- package/src/variables/formula/signatures.ts +266 -0
- package/src/variables/formula/tokens.ts +114 -0
- package/src/variables/formula/tree.ts +53 -0
- package/src/{variables.ts → variables/index.ts} +86 -146
- package/src/variables/resolution.ts +293 -0
- package/src/variables/schema.ts +31 -0
- package/src/variables/text.ts +51 -0
- package/src/variables/token.ts +27 -1
- package/src/variables/value.ts +92 -0
- package/src/vector-network.ts +263 -22
- package/dist/chunks/asset-keys.js.map +0 -1
- package/dist/chunks/behaviours/kinds.js.map +0 -1
- package/dist/chunks/behaviours/layers.js +0 -611
- package/dist/chunks/behaviours/layers.js.map +0 -1
- package/dist/chunks/behaviours/spec.js.map +0 -1
- package/dist/chunks/bindings.js +0 -18
- package/dist/chunks/bindings.js.map +0 -1
- package/dist/chunks/buffered-events.js.map +0 -1
- package/dist/chunks/checkpoint.js +0 -78
- package/dist/chunks/checkpoint.js.map +0 -1
- package/dist/chunks/color/contrast.js.map +0 -1
- package/dist/chunks/color/index.js +0 -1662
- package/dist/chunks/color/index.js.map +0 -1
- package/dist/chunks/comments/document.js.map +0 -1
- package/dist/chunks/comments/list.js.map +0 -1
- package/dist/chunks/comments/merge.js.map +0 -1
- package/dist/chunks/components/exposure.js +0 -2291
- package/dist/chunks/components/exposure.js.map +0 -1
- package/dist/chunks/components/variants.js +0 -32
- package/dist/chunks/components/variants.js.map +0 -1
- package/dist/chunks/coordinate.js +0 -385
- package/dist/chunks/coordinate.js.map +0 -1
- package/dist/chunks/css/grid.js.map +0 -1
- package/dist/chunks/css/index.js +0 -160
- package/dist/chunks/css/index.js.map +0 -1
- package/dist/chunks/events.js.map +0 -1
- package/dist/chunks/fields/geometry.js.map +0 -1
- package/dist/chunks/font-style.js +0 -96
- package/dist/chunks/font-style.js.map +0 -1
- package/dist/chunks/group-bounds.js.map +0 -1
- package/dist/chunks/icons/glyph.js.map +0 -1
- package/dist/chunks/index.js +0 -2430
- package/dist/chunks/index.js.map +0 -1
- package/dist/color.d.ts +0 -78
- package/dist/color.d.ts.map +0 -1
- package/dist/color.js +0 -3
- package/dist/constants2.d.ts +0 -11
- package/dist/constants2.d.ts.map +0 -1
- package/dist/css.d.ts +0 -39
- package/dist/css.d.ts.map +0 -1
- package/dist/css.js +0 -3
- package/dist/images2.d.ts +0 -16
- package/dist/images2.d.ts.map +0 -1
- package/dist/instances.d.ts +0 -2
- package/dist/instances.js +0 -2
- package/dist/layout.d.ts +0 -2
- package/dist/matrix2.d.ts +0 -16
- package/dist/matrix2.d.ts.map +0 -1
- package/dist/primitives.d.ts +0 -2
- package/dist/primitives.js +0 -0
- package/dist/primitives2.d.ts.map +0 -1
- package/dist/text-direction.d.ts.map +0 -1
- package/dist/text-direction.js.map +0 -1
- package/dist/text-picture.d.ts.map +0 -1
- package/dist/text-picture.js +0 -2
- package/dist/text.d.ts +0 -2
- package/dist/text.js +0 -3
- package/dist/types2.d.ts +0 -2
- package/dist/undo2.d.ts +0 -73
- package/dist/undo2.d.ts.map +0 -1
- package/dist/variables.d.ts +0 -2
- package/dist/variables.js +0 -2
- /package/dist/{chunks/asset-keys.js → asset-keys.js} +0 -0
- /package/dist/{chunks/buffered-events.js → buffered-events.js} +0 -0
- /package/dist/{chunks/events.js → events.js} +0 -0
- /package/dist/{chunks/fields → fields}/geometry.js +0 -0
|
@@ -0,0 +1,539 @@
|
|
|
1
|
+
import { databaseCap } from "./fit.js";
|
|
2
|
+
//#region src/shape-with-text/geometry.ts
|
|
3
|
+
/** Bezier handle length for a quarter ellipse. */
|
|
4
|
+
const KAPPA = .5522847498;
|
|
5
|
+
function polygon(points) {
|
|
6
|
+
const commands = points.map(([x, y], index) => ({
|
|
7
|
+
type: index === 0 ? "M" : "L",
|
|
8
|
+
x,
|
|
9
|
+
y
|
|
10
|
+
}));
|
|
11
|
+
commands.push({ type: "Z" });
|
|
12
|
+
return commands;
|
|
13
|
+
}
|
|
14
|
+
function line(from, to) {
|
|
15
|
+
return [{
|
|
16
|
+
type: "M",
|
|
17
|
+
x: from[0],
|
|
18
|
+
y: from[1]
|
|
19
|
+
}, {
|
|
20
|
+
type: "L",
|
|
21
|
+
x: to[0],
|
|
22
|
+
y: to[1]
|
|
23
|
+
}];
|
|
24
|
+
}
|
|
25
|
+
function curve(x1, y1, x2, y2, x, y) {
|
|
26
|
+
return {
|
|
27
|
+
type: "C",
|
|
28
|
+
x1,
|
|
29
|
+
y1,
|
|
30
|
+
x2,
|
|
31
|
+
y2,
|
|
32
|
+
x,
|
|
33
|
+
y
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function ellipse(x, y, w, h) {
|
|
37
|
+
const rx = w / 2;
|
|
38
|
+
const ry = h / 2;
|
|
39
|
+
const cx = x + rx;
|
|
40
|
+
const cy = y + ry;
|
|
41
|
+
const kx = rx * KAPPA;
|
|
42
|
+
const ky = ry * KAPPA;
|
|
43
|
+
return [
|
|
44
|
+
{
|
|
45
|
+
type: "M",
|
|
46
|
+
x: cx,
|
|
47
|
+
y
|
|
48
|
+
},
|
|
49
|
+
curve(cx + kx, y, x + w, cy - ky, x + w, cy),
|
|
50
|
+
curve(x + w, cy + ky, cx + kx, y + h, cx, y + h),
|
|
51
|
+
curve(cx - kx, y + h, x, cy + ky, x, cy),
|
|
52
|
+
curve(x, cy - ky, cx - kx, y, cx, y),
|
|
53
|
+
{ type: "Z" }
|
|
54
|
+
];
|
|
55
|
+
}
|
|
56
|
+
function roundedRect(w, h, radius) {
|
|
57
|
+
const r = Math.max(0, Math.min(radius, w / 2, h / 2));
|
|
58
|
+
const k = r * .4477152502;
|
|
59
|
+
return [
|
|
60
|
+
{
|
|
61
|
+
type: "M",
|
|
62
|
+
x: r,
|
|
63
|
+
y: 0
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
type: "L",
|
|
67
|
+
x: w - r,
|
|
68
|
+
y: 0
|
|
69
|
+
},
|
|
70
|
+
curve(w - k, 0, w, k, w, r),
|
|
71
|
+
{
|
|
72
|
+
type: "L",
|
|
73
|
+
x: w,
|
|
74
|
+
y: h - r
|
|
75
|
+
},
|
|
76
|
+
curve(w, h - k, w - k, h, w - r, h),
|
|
77
|
+
{
|
|
78
|
+
type: "L",
|
|
79
|
+
x: r,
|
|
80
|
+
y: h
|
|
81
|
+
},
|
|
82
|
+
curve(k, h, 0, h - k, 0, h - r),
|
|
83
|
+
{
|
|
84
|
+
type: "L",
|
|
85
|
+
x: 0,
|
|
86
|
+
y: r
|
|
87
|
+
},
|
|
88
|
+
curve(0, k, k, 0, r, 0),
|
|
89
|
+
{ type: "Z" }
|
|
90
|
+
];
|
|
91
|
+
}
|
|
92
|
+
/** A page with a wavy bottom edge, the flowchart "document" symbol. */
|
|
93
|
+
function documentPage(x, y, w, h) {
|
|
94
|
+
const wave = h * .1;
|
|
95
|
+
const base = y + h - wave;
|
|
96
|
+
return [
|
|
97
|
+
{
|
|
98
|
+
type: "M",
|
|
99
|
+
x,
|
|
100
|
+
y
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
type: "L",
|
|
104
|
+
x: x + w,
|
|
105
|
+
y
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
type: "L",
|
|
109
|
+
x: x + w,
|
|
110
|
+
y: base
|
|
111
|
+
},
|
|
112
|
+
curve(x + w * .8, base - wave * 1.2, x + w * .7, base - wave * 1.2, x + w * .5, base),
|
|
113
|
+
curve(x + w * .3, base + wave, x + w * .2, base + wave, x, base),
|
|
114
|
+
{ type: "Z" }
|
|
115
|
+
];
|
|
116
|
+
}
|
|
117
|
+
function star(w, h) {
|
|
118
|
+
const points = [];
|
|
119
|
+
for (let i = 0; i < 10; i++) {
|
|
120
|
+
const angle = -Math.PI / 2 + i * Math.PI / 5;
|
|
121
|
+
const radius = i % 2 === 0 ? 1 : .382;
|
|
122
|
+
points.push([w / 2 + Math.cos(angle) * radius * w / 2, h / 2 + Math.sin(angle) * radius * h / 2 + h * .05]);
|
|
123
|
+
}
|
|
124
|
+
return points;
|
|
125
|
+
}
|
|
126
|
+
/** A point on the ellipse filling the box, at `angle` radians clockwise from the right. */
|
|
127
|
+
function onEllipse(w, h, angle) {
|
|
128
|
+
return [w / 2 + Math.cos(angle) * w / 2, h / 2 + Math.sin(angle) * h / 2];
|
|
129
|
+
}
|
|
130
|
+
/** A plain box with stroke-only inner lines. */
|
|
131
|
+
function boxWithLines(w, h, details) {
|
|
132
|
+
return {
|
|
133
|
+
outline: polygon([
|
|
134
|
+
[0, 0],
|
|
135
|
+
[w, 0],
|
|
136
|
+
[w, h],
|
|
137
|
+
[0, h]
|
|
138
|
+
]),
|
|
139
|
+
details
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/** A rounded box with a tail below its left side; the tail joins the bottom edge. */
|
|
143
|
+
function speechBubble(w, h) {
|
|
144
|
+
const body = h * .8;
|
|
145
|
+
const box = roundedRect(w, body, Math.min(w, body) * .2);
|
|
146
|
+
const tail = [
|
|
147
|
+
{
|
|
148
|
+
type: "L",
|
|
149
|
+
x: w * .38,
|
|
150
|
+
y: body
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
type: "L",
|
|
154
|
+
x: w * .18,
|
|
155
|
+
y: h
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
type: "L",
|
|
159
|
+
x: w * .22,
|
|
160
|
+
y: body
|
|
161
|
+
}
|
|
162
|
+
];
|
|
163
|
+
return [
|
|
164
|
+
...box.slice(0, 5),
|
|
165
|
+
...tail,
|
|
166
|
+
...box.slice(5)
|
|
167
|
+
];
|
|
168
|
+
}
|
|
169
|
+
const plain = (outline) => ({
|
|
170
|
+
outline,
|
|
171
|
+
details: []
|
|
172
|
+
});
|
|
173
|
+
/** How far a parallelogram's sides lean: FigJam leans them with the height, not the width. */
|
|
174
|
+
function parallelogramSlant(w, h) {
|
|
175
|
+
return Math.min(h * .43, w * .45);
|
|
176
|
+
}
|
|
177
|
+
/** Each kind's outline and inner lines for a `w` × `h` box, `min` being its shorter side. */
|
|
178
|
+
const BUILDERS = {
|
|
179
|
+
SQUARE: (w, h) => plain(polygon([
|
|
180
|
+
[0, 0],
|
|
181
|
+
[w, 0],
|
|
182
|
+
[w, h],
|
|
183
|
+
[0, h]
|
|
184
|
+
])),
|
|
185
|
+
ELLIPSE: (w, h) => plain(ellipse(0, 0, w, h)),
|
|
186
|
+
DIAMOND: (w, h) => plain(polygon([
|
|
187
|
+
[w / 2, 0],
|
|
188
|
+
[w, h / 2],
|
|
189
|
+
[w / 2, h],
|
|
190
|
+
[0, h / 2]
|
|
191
|
+
])),
|
|
192
|
+
TRIANGLE_UP: (w, h) => plain(polygon([
|
|
193
|
+
[w / 2, 0],
|
|
194
|
+
[w, h],
|
|
195
|
+
[0, h]
|
|
196
|
+
])),
|
|
197
|
+
TRIANGLE_DOWN: (w, h) => plain(polygon([
|
|
198
|
+
[0, 0],
|
|
199
|
+
[w, 0],
|
|
200
|
+
[w / 2, h]
|
|
201
|
+
])),
|
|
202
|
+
ROUNDED_RECTANGLE: (w, h, min) => plain(roundedRect(w, h, min * .4)),
|
|
203
|
+
PARALLELOGRAM_RIGHT: (w, h) => {
|
|
204
|
+
const s = parallelogramSlant(w, h);
|
|
205
|
+
return plain(polygon([
|
|
206
|
+
[s, 0],
|
|
207
|
+
[w, 0],
|
|
208
|
+
[w - s, h],
|
|
209
|
+
[0, h]
|
|
210
|
+
]));
|
|
211
|
+
},
|
|
212
|
+
PARALLELOGRAM_LEFT: (w, h) => {
|
|
213
|
+
const s = parallelogramSlant(w, h);
|
|
214
|
+
return plain(polygon([
|
|
215
|
+
[0, 0],
|
|
216
|
+
[w - s, 0],
|
|
217
|
+
[w, h],
|
|
218
|
+
[s, h]
|
|
219
|
+
]));
|
|
220
|
+
},
|
|
221
|
+
ENG_DATABASE: (w, h) => {
|
|
222
|
+
const ry = databaseCap(w, h);
|
|
223
|
+
const kx = w / 2 * KAPPA;
|
|
224
|
+
const ky = ry * KAPPA;
|
|
225
|
+
return {
|
|
226
|
+
outline: [
|
|
227
|
+
{
|
|
228
|
+
type: "M",
|
|
229
|
+
x: 0,
|
|
230
|
+
y: ry
|
|
231
|
+
},
|
|
232
|
+
curve(0, ry - ky, w / 2 - kx, 0, w / 2, 0),
|
|
233
|
+
curve(w / 2 + kx, 0, w, ry - ky, w, ry),
|
|
234
|
+
{
|
|
235
|
+
type: "L",
|
|
236
|
+
x: w,
|
|
237
|
+
y: h - ry
|
|
238
|
+
},
|
|
239
|
+
curve(w, h - ry + ky, w / 2 + kx, h, w / 2, h),
|
|
240
|
+
curve(w / 2 - kx, h, 0, h - ry + ky, 0, h - ry),
|
|
241
|
+
{ type: "Z" }
|
|
242
|
+
],
|
|
243
|
+
details: [
|
|
244
|
+
{
|
|
245
|
+
type: "M",
|
|
246
|
+
x: 0,
|
|
247
|
+
y: ry
|
|
248
|
+
},
|
|
249
|
+
curve(0, ry + ky, w / 2 - kx, ry * 2, w / 2, ry * 2),
|
|
250
|
+
curve(w / 2 + kx, ry * 2, w, ry + ky, w, ry)
|
|
251
|
+
]
|
|
252
|
+
};
|
|
253
|
+
},
|
|
254
|
+
ENG_QUEUE: (w, h) => {
|
|
255
|
+
const rx = Math.min(w * .15, h * .25);
|
|
256
|
+
const kx = rx * KAPPA;
|
|
257
|
+
const ky = h / 2 * KAPPA;
|
|
258
|
+
return {
|
|
259
|
+
outline: [
|
|
260
|
+
{
|
|
261
|
+
type: "M",
|
|
262
|
+
x: rx,
|
|
263
|
+
y: 0
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
type: "L",
|
|
267
|
+
x: w - rx,
|
|
268
|
+
y: 0
|
|
269
|
+
},
|
|
270
|
+
curve(w - rx + kx, 0, w, h / 2 - ky, w, h / 2),
|
|
271
|
+
curve(w, h / 2 + ky, w - rx + kx, h, w - rx, h),
|
|
272
|
+
{
|
|
273
|
+
type: "L",
|
|
274
|
+
x: rx,
|
|
275
|
+
y: h
|
|
276
|
+
},
|
|
277
|
+
curve(rx - kx, h, 0, h / 2 + ky, 0, h / 2),
|
|
278
|
+
curve(0, h / 2 - ky, rx - kx, 0, rx, 0),
|
|
279
|
+
{ type: "Z" }
|
|
280
|
+
],
|
|
281
|
+
details: [
|
|
282
|
+
{
|
|
283
|
+
type: "M",
|
|
284
|
+
x: w - rx,
|
|
285
|
+
y: 0
|
|
286
|
+
},
|
|
287
|
+
curve(w - rx - kx, 0, w - rx * 2, h / 2 - ky, w - rx * 2, h / 2),
|
|
288
|
+
curve(w - rx * 2, h / 2 + ky, w - rx - kx, h, w - rx, h)
|
|
289
|
+
]
|
|
290
|
+
};
|
|
291
|
+
},
|
|
292
|
+
ENG_FILE: (w, h, min) => {
|
|
293
|
+
const f = min * .25;
|
|
294
|
+
return {
|
|
295
|
+
outline: polygon([
|
|
296
|
+
[0, 0],
|
|
297
|
+
[w - f, 0],
|
|
298
|
+
[w, f],
|
|
299
|
+
[w, h],
|
|
300
|
+
[0, h]
|
|
301
|
+
]),
|
|
302
|
+
details: [...line([w - f, 0], [w - f, f]), {
|
|
303
|
+
type: "L",
|
|
304
|
+
x: w,
|
|
305
|
+
y: f
|
|
306
|
+
}]
|
|
307
|
+
};
|
|
308
|
+
},
|
|
309
|
+
ENG_FOLDER: (w, h) => {
|
|
310
|
+
const tab = Math.min(h * .18, w * .2);
|
|
311
|
+
return plain(polygon([
|
|
312
|
+
[0, 0],
|
|
313
|
+
[w * .4, 0],
|
|
314
|
+
[w * .4 + tab, tab],
|
|
315
|
+
[w, tab],
|
|
316
|
+
[w, h],
|
|
317
|
+
[0, h]
|
|
318
|
+
]));
|
|
319
|
+
},
|
|
320
|
+
TRAPEZOID: (w, h) => {
|
|
321
|
+
const s = Math.min(w * .2, h);
|
|
322
|
+
return plain(polygon([
|
|
323
|
+
[s, 0],
|
|
324
|
+
[w - s, 0],
|
|
325
|
+
[w, h],
|
|
326
|
+
[0, h]
|
|
327
|
+
]));
|
|
328
|
+
},
|
|
329
|
+
PREDEFINED_PROCESS: (w, h) => {
|
|
330
|
+
const e = Math.min(w * .1, h * .5);
|
|
331
|
+
return boxWithLines(w, h, [...line([e, 0], [e, h]), ...line([w - e, 0], [w - e, h])]);
|
|
332
|
+
},
|
|
333
|
+
SHIELD: (w, h) => plain([
|
|
334
|
+
{
|
|
335
|
+
type: "M",
|
|
336
|
+
x: 0,
|
|
337
|
+
y: 0
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
type: "L",
|
|
341
|
+
x: w,
|
|
342
|
+
y: 0
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
type: "L",
|
|
346
|
+
x: w,
|
|
347
|
+
y: h * .45
|
|
348
|
+
},
|
|
349
|
+
curve(w, h * .75, w * .75, h * .9, w / 2, h),
|
|
350
|
+
curve(w * .25, h * .9, 0, h * .75, 0, h * .45),
|
|
351
|
+
{ type: "Z" }
|
|
352
|
+
]),
|
|
353
|
+
DOCUMENT_SINGLE: (w, h) => plain(documentPage(0, 0, w, h)),
|
|
354
|
+
DOCUMENT_MULTIPLE: (w, h, min) => {
|
|
355
|
+
const o = min * .06;
|
|
356
|
+
return {
|
|
357
|
+
outline: documentPage(0, o * 2, w - o * 2, h - o * 2),
|
|
358
|
+
details: [
|
|
359
|
+
...line([o, o * 2], [o, o]),
|
|
360
|
+
{
|
|
361
|
+
type: "L",
|
|
362
|
+
x: w - o,
|
|
363
|
+
y: o
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
type: "L",
|
|
367
|
+
x: w - o,
|
|
368
|
+
y: h - o * 2
|
|
369
|
+
},
|
|
370
|
+
...line([o * 2, o], [o * 2, 0]),
|
|
371
|
+
{
|
|
372
|
+
type: "L",
|
|
373
|
+
x: w,
|
|
374
|
+
y: 0
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
type: "L",
|
|
378
|
+
x: w,
|
|
379
|
+
y: h - o * 3
|
|
380
|
+
}
|
|
381
|
+
]
|
|
382
|
+
};
|
|
383
|
+
},
|
|
384
|
+
MANUAL_INPUT: (w, h) => plain(polygon([
|
|
385
|
+
[0, h * .25],
|
|
386
|
+
[w, 0],
|
|
387
|
+
[w, h],
|
|
388
|
+
[0, h]
|
|
389
|
+
])),
|
|
390
|
+
HEXAGON: (w, h) => {
|
|
391
|
+
const s = Math.min(w * .25, h * .5);
|
|
392
|
+
return plain(polygon([
|
|
393
|
+
[s, 0],
|
|
394
|
+
[w - s, 0],
|
|
395
|
+
[w, h / 2],
|
|
396
|
+
[w - s, h],
|
|
397
|
+
[s, h],
|
|
398
|
+
[0, h / 2]
|
|
399
|
+
]));
|
|
400
|
+
},
|
|
401
|
+
CHEVRON: (w, h) => {
|
|
402
|
+
const p = Math.min(w * .25, h * .5);
|
|
403
|
+
return plain(polygon([
|
|
404
|
+
[0, 0],
|
|
405
|
+
[w - p, 0],
|
|
406
|
+
[w, h / 2],
|
|
407
|
+
[w - p, h],
|
|
408
|
+
[0, h],
|
|
409
|
+
[p, h / 2]
|
|
410
|
+
]));
|
|
411
|
+
},
|
|
412
|
+
PENTAGON: (w, h) => plain(polygon([
|
|
413
|
+
[w / 2, 0],
|
|
414
|
+
[w, h * .38],
|
|
415
|
+
[w * .81, h],
|
|
416
|
+
[w * .19, h],
|
|
417
|
+
[0, h * .38]
|
|
418
|
+
])),
|
|
419
|
+
OCTAGON: (w, h, min) => {
|
|
420
|
+
const c = min * .29;
|
|
421
|
+
return plain(polygon([
|
|
422
|
+
[c, 0],
|
|
423
|
+
[w - c, 0],
|
|
424
|
+
[w, c],
|
|
425
|
+
[w, h - c],
|
|
426
|
+
[w - c, h],
|
|
427
|
+
[c, h],
|
|
428
|
+
[0, h - c],
|
|
429
|
+
[0, c]
|
|
430
|
+
]));
|
|
431
|
+
},
|
|
432
|
+
STAR: (w, h) => plain(polygon(star(w, h))),
|
|
433
|
+
PLUS: (w, h) => {
|
|
434
|
+
const a = w / 3;
|
|
435
|
+
const b = h / 3;
|
|
436
|
+
return plain(polygon([
|
|
437
|
+
[a, 0],
|
|
438
|
+
[a * 2, 0],
|
|
439
|
+
[a * 2, b],
|
|
440
|
+
[w, b],
|
|
441
|
+
[w, b * 2],
|
|
442
|
+
[a * 2, b * 2],
|
|
443
|
+
[a * 2, h],
|
|
444
|
+
[a, h],
|
|
445
|
+
[a, b * 2],
|
|
446
|
+
[0, b * 2],
|
|
447
|
+
[0, b],
|
|
448
|
+
[a, b]
|
|
449
|
+
]));
|
|
450
|
+
},
|
|
451
|
+
ARROW_RIGHT: (w, h) => {
|
|
452
|
+
const head = Math.min(w * .4, h * .5);
|
|
453
|
+
return plain(polygon([
|
|
454
|
+
[0, h * .25],
|
|
455
|
+
[w - head, h * .25],
|
|
456
|
+
[w - head, 0],
|
|
457
|
+
[w, h / 2],
|
|
458
|
+
[w - head, h],
|
|
459
|
+
[w - head, h * .75],
|
|
460
|
+
[0, h * .75]
|
|
461
|
+
]));
|
|
462
|
+
},
|
|
463
|
+
ARROW_LEFT: (w, h) => {
|
|
464
|
+
const head = Math.min(w * .4, h * .5);
|
|
465
|
+
return plain(polygon([
|
|
466
|
+
[w, h * .25],
|
|
467
|
+
[head, h * .25],
|
|
468
|
+
[head, 0],
|
|
469
|
+
[0, h / 2],
|
|
470
|
+
[head, h],
|
|
471
|
+
[head, h * .75],
|
|
472
|
+
[w, h * .75]
|
|
473
|
+
]));
|
|
474
|
+
},
|
|
475
|
+
SUMMING_JUNCTION: (w, h) => {
|
|
476
|
+
const q = Math.PI / 4;
|
|
477
|
+
return {
|
|
478
|
+
outline: ellipse(0, 0, w, h),
|
|
479
|
+
details: [...line(onEllipse(w, h, -q), onEllipse(w, h, Math.PI - q)), ...line(onEllipse(w, h, q), onEllipse(w, h, Math.PI + q))]
|
|
480
|
+
};
|
|
481
|
+
},
|
|
482
|
+
OR: (w, h) => ({
|
|
483
|
+
outline: ellipse(0, 0, w, h),
|
|
484
|
+
details: [...line([w / 2, 0], [w / 2, h]), ...line([0, h / 2], [w, h / 2])]
|
|
485
|
+
}),
|
|
486
|
+
SPEECH_BUBBLE: (w, h) => plain(speechBubble(w, h)),
|
|
487
|
+
INTERNAL_STORAGE: (w, h, min) => {
|
|
488
|
+
const e = min * .15;
|
|
489
|
+
return boxWithLines(w, h, [...line([e, 0], [e, h]), ...line([0, e], [w, e])]);
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
/**
|
|
493
|
+
* The outline with each straight corner rounded to `radius` (FigJam rounds them all to its corner
|
|
494
|
+
* radius), shortened where an edge is too short for it. Outlines with curves keep their shape.
|
|
495
|
+
*/
|
|
496
|
+
function roundCorners(commands, radius) {
|
|
497
|
+
if (radius <= 0 || commands.some((command) => command.type === "C")) return commands;
|
|
498
|
+
const points = [];
|
|
499
|
+
for (const command of commands) if (command.type !== "Z") points.push([command.x, command.y]);
|
|
500
|
+
if (points.length < 3) return commands;
|
|
501
|
+
const rounded = [];
|
|
502
|
+
points.forEach((vertex, index) => {
|
|
503
|
+
const before = points[(index + points.length - 1) % points.length];
|
|
504
|
+
const after = points[(index + 1) % points.length];
|
|
505
|
+
const toward = (to) => {
|
|
506
|
+
const length = Math.hypot(to[0] - vertex[0], to[1] - vertex[1]);
|
|
507
|
+
const t = length > 0 ? Math.min(radius, length / 2) / length : 0;
|
|
508
|
+
return [vertex[0] + (to[0] - vertex[0]) * t, vertex[1] + (to[1] - vertex[1]) * t];
|
|
509
|
+
};
|
|
510
|
+
const [inX, inY] = toward(before);
|
|
511
|
+
const [outX, outY] = toward(after);
|
|
512
|
+
rounded.push({
|
|
513
|
+
type: index === 0 ? "M" : "L",
|
|
514
|
+
x: inX,
|
|
515
|
+
y: inY
|
|
516
|
+
});
|
|
517
|
+
rounded.push(curve(inX + (vertex[0] - inX) * KAPPA, inY + (vertex[1] - inY) * KAPPA, outX + (vertex[0] - outX) * KAPPA, outY + (vertex[1] - outY) * KAPPA, outX, outY));
|
|
518
|
+
});
|
|
519
|
+
rounded.push({ type: "Z" });
|
|
520
|
+
return rounded;
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* The outline and inner lines of a shape of `type` filling a `width` × `height` box. Outlines
|
|
524
|
+
* made only of straight segments have their corners rounded to `cornerRadius`; outlines with
|
|
525
|
+
* curves, such as a rounded rectangle, keep their own shape.
|
|
526
|
+
*/
|
|
527
|
+
function shapeWithTextGeometry(type, width, height, cornerRadius = 0) {
|
|
528
|
+
const w = Math.max(0, width);
|
|
529
|
+
const h = Math.max(0, height);
|
|
530
|
+
const geometry = BUILDERS[type](w, h, Math.min(w, h));
|
|
531
|
+
return {
|
|
532
|
+
...geometry,
|
|
533
|
+
outline: roundCorners(geometry.outline, cornerRadius)
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
//#endregion
|
|
537
|
+
export { parallelogramSlant, shapeWithTextGeometry };
|
|
538
|
+
|
|
539
|
+
//# sourceMappingURL=geometry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry.js","names":[],"sources":["../../src/shape-with-text/geometry.ts"],"sourcesContent":["import type { PolygonOutlineCommand } from '../polygon'\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\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) => 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 ENG_FOLDER: (w, h) => {\n const tab = Math.min(h * 0.18, w * 0.2)\n return plain(\n polygon([\n [0, 0],\n [w * 0.4, 0],\n [w * 0.4 + tab, tab],\n [w, tab],\n [w, h],\n [0, h]\n ])\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) => plain(documentPage(0, 0, w, h)),\n DOCUMENT_MULTIPLE: (w, h, min) => {\n const o = min * 0.06\n return {\n outline: documentPage(0, o * 2, w - o * 2, h - o * 2),\n details: [\n ...line([o, o * 2], [o, o]),\n { type: 'L', x: w - o, y: o },\n { type: 'L', x: w - o, y: h - o * 2 },\n ...line([o * 2, o], [o * 2, 0]),\n { type: 'L', x: w, y: 0 },\n { type: 'L', x: w, y: h - o * 3 }\n ]\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 const rounded: PolygonOutlineCommand[] = []\n points.forEach((vertex, index) => {\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: index === 0 ? 'M' : 'L', 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))\n return { ...geometry, outline: roundCorners(geometry.outline, cornerRadius) }\n}\n"],"mappings":";;;AAYA,MAAM,QAAQ;AAId,SAAS,QAAQ,QAA0C;CACzD,MAAM,WAAoC,OAAO,KAAK,CAAC,GAAG,IA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,OAAO,MAAM,CAAC;EAClF;EACA,MAAM,CAAC,KAAK,OAAO,OAAO,MAAM;EAChC,MAAM,CAAC,MAAM,QAAQ,OAAO,KAAK;EACjC,QAAQ,KAAK;GAAE,MAAM,UAAU,IAAI,MAAM;GAAK,GAAG;GAAK,GAAG;EAAI,CAAC;EAC9D,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,CAAC;CACpD,OAAO;EAAE,GAAG;EAAU,SAAS,aAAa,SAAS,SAAS,YAAY;CAAE;AAC9E"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SHAPE_WITH_TEXT_GROUPS, SHAPE_WITH_TEXT_TYPES, ShapeWithTextType, isShapeWithTextType } from "./kinds.js";
|
|
2
|
+
import { ShapeWithTextGeometry, parallelogramSlant, shapeWithTextGeometry } from "./geometry.js";
|
|
3
|
+
import { LabelBox, LabelMeasure, databaseCap, fitShapeWithTextHeight, shapeWithTextGrows, shapeWithTextLabelBox } from "./fit.js";
|
|
4
|
+
export { type LabelBox, type LabelMeasure, SHAPE_WITH_TEXT_GROUPS, SHAPE_WITH_TEXT_TYPES, ShapeWithTextGeometry, ShapeWithTextType, databaseCap, fitShapeWithTextHeight, isShapeWithTextType, parallelogramSlant, shapeWithTextGeometry, shapeWithTextGrows, shapeWithTextLabelBox };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { databaseCap, fitShapeWithTextHeight, shapeWithTextGrows, shapeWithTextLabelBox } from "./fit.js";
|
|
2
|
+
import { SHAPE_WITH_TEXT_GROUPS, SHAPE_WITH_TEXT_TYPES, isShapeWithTextType } from "./kinds.js";
|
|
3
|
+
import { parallelogramSlant, shapeWithTextGeometry } from "./geometry.js";
|
|
4
|
+
export { SHAPE_WITH_TEXT_GROUPS, SHAPE_WITH_TEXT_TYPES, databaseCap, fitShapeWithTextHeight, isShapeWithTextType, parallelogramSlant, shapeWithTextGeometry, shapeWithTextGrows, shapeWithTextLabelBox };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/shape-with-text/kinds.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* FigJam's shape-with-text kinds, as Figma names them in `.fig` files and in its plugin API
|
|
4
|
+
* (`ShapeWithTextNode.shapeType`). Each kind is drawn from its size here, so rendering, hit
|
|
5
|
+
* testing, export and connectors share one outline.
|
|
6
|
+
*/
|
|
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;
|
|
10
|
+
/**
|
|
11
|
+
* The kinds as FigJam's Shapes panel offers them, in its order: Basic, then Flowchart. Together
|
|
12
|
+
* they are every kind.
|
|
13
|
+
*/
|
|
14
|
+
declare const SHAPE_WITH_TEXT_GROUPS: {
|
|
15
|
+
readonly basic: readonly ["SQUARE", "ELLIPSE", "DIAMOND", "TRIANGLE_UP", "TRIANGLE_DOWN", "ROUNDED_RECTANGLE", "PENTAGON", "OCTAGON", "PLUS", "ARROW_LEFT", "ARROW_RIGHT", "CHEVRON", "STAR", "SPEECH_BUBBLE"];
|
|
16
|
+
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
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { SHAPE_WITH_TEXT_GROUPS, SHAPE_WITH_TEXT_TYPES, ShapeWithTextType, isShapeWithTextType };
|
|
20
|
+
//# sourceMappingURL=kinds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kinds.d.ts","names":[],"sources":["../../src/shape-with-text/kinds.ts"],"mappings":";;;;;;cAKa;KAiCD,4BAA4B;iBAIxB,oBAAoB,iBAAiB,SAAS;;;;;cAQjD;WAAA;WAAA"}
|