@pairdraw/scene-graph 0.0.0-stage → 0.16.0
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/LICENSE +21 -0
- package/README.md +4 -2
- package/dist/agent-notes/index.d.ts +3 -0
- package/dist/agent-notes/index.js +3 -0
- package/dist/agent-notes/model.d.ts +23 -0
- package/dist/agent-notes/model.d.ts.map +1 -0
- package/dist/agent-notes/model.js +36 -0
- package/dist/agent-notes/model.js.map +1 -0
- package/dist/agent-notes/schema.d.ts +19 -0
- package/dist/agent-notes/schema.d.ts.map +1 -0
- package/dist/agent-notes/schema.js +17 -0
- package/dist/agent-notes/schema.js.map +1 -0
- package/dist/arrow-caps.d.ts +65 -0
- package/dist/arrow-caps.d.ts.map +1 -0
- package/dist/arrow-caps.js +365 -0
- package/dist/arrow-caps.js.map +1 -0
- package/dist/asset-keys.d.ts +17 -0
- package/dist/asset-keys.d.ts.map +1 -0
- package/dist/asset-keys.js +27 -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 +56 -0
- package/dist/behaviours/kinds.d.ts.map +1 -0
- package/dist/behaviours/kinds.js +273 -0
- 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 +42 -0
- package/dist/behaviours/layers.js.map +1 -0
- package/dist/behaviours/model.d.ts +45 -0
- package/dist/behaviours/model.d.ts.map +1 -0
- package/dist/behaviours/model.js +149 -0
- package/dist/behaviours/model.js.map +1 -0
- package/dist/behaviours/schema.d.ts +114 -0
- package/dist/behaviours/schema.d.ts.map +1 -0
- package/dist/behaviours/schema.js +71 -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/behaviours/spec.js +157 -0
- package/dist/behaviours/spec.js.map +1 -0
- package/dist/bindings.js +18 -0
- package/dist/bindings.js.map +1 -0
- package/dist/browser-node/index.d.ts +3 -0
- package/dist/browser-node/index.js +3 -0
- package/dist/browser-node/model.d.ts +18 -0
- package/dist/browser-node/model.d.ts.map +1 -0
- package/dist/browser-node/model.js +31 -0
- package/dist/browser-node/model.js.map +1 -0
- package/dist/browser-node/schema.d.ts +23 -0
- package/dist/browser-node/schema.d.ts.map +1 -0
- package/dist/browser-node/schema.js +44 -0
- package/dist/browser-node/schema.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 +57 -0
- package/dist/buffered-events.js.map +1 -0
- package/dist/checkpoint.d.ts +13 -0
- package/dist/checkpoint.d.ts.map +1 -0
- package/dist/checkpoint.js +78 -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 +20 -0
- package/dist/color/contrast.d.ts.map +1 -0
- package/dist/color/contrast.js +69 -0
- 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/comments/document.js +33 -0
- 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/comments/merge.js +58 -0
- 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/comments/threads.js +132 -0
- 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 +5 -0
- package/dist/components/index.js +5 -0
- package/dist/components/library-page.d.ts +11 -0
- package/dist/components/library-page.d.ts.map +1 -0
- package/dist/components/library-page.js +21 -0
- package/dist/components/library-page.js.map +1 -0
- package/dist/components/properties.d.ts +20 -0
- package/dist/components/properties.d.ts.map +1 -0
- package/dist/components/properties.js +125 -0
- package/dist/components/properties.js.map +1 -0
- package/dist/components/variants.d.ts +27 -0
- package/dist/components/variants.d.ts.map +1 -0
- package/dist/components/variants.js +32 -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 +53 -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 +159 -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 +209 -0
- package/dist/connectors/sublayers.js.map +1 -0
- package/dist/constants.d.ts +16 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +31 -0
- package/dist/constants.js.map +1 -0
- package/dist/coordinate.d.ts +99 -0
- package/dist/coordinate.d.ts.map +1 -0
- package/dist/coordinate.js +276 -0
- package/dist/coordinate.js.map +1 -0
- package/dist/copy.d.ts +45 -0
- package/dist/copy.d.ts.map +1 -0
- package/dist/copy.js +256 -0
- package/dist/copy.js.map +1 -0
- package/dist/css/grid.d.ts +7 -0
- package/dist/css/grid.d.ts.map +1 -0
- package/dist/css/grid.js +63 -0
- package/dist/css/grid.js.map +1 -0
- package/dist/css/index.d.ts +6 -0
- package/dist/css/index.js +6 -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/events.js +18 -0
- package/dist/events.js.map +1 -0
- package/dist/export-format.d.ts +19 -0
- package/dist/export-format.d.ts.map +1 -0
- package/dist/export-format.js +33 -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 +14 -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 +63 -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 +199 -0
- package/dist/figjam/palette.d.ts.map +1 -0
- package/dist/figjam/palette.js +277 -0
- package/dist/figjam/palette.js.map +1 -0
- package/dist/figjam/text.d.ts +68 -0
- package/dist/figjam/text.d.ts.map +1 -0
- package/dist/figjam/text.js +89 -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 +46 -0
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/index.js +62 -0
- package/dist/generated/index.js.map +1 -0
- package/dist/generated/kind.d.ts +29 -0
- package/dist/generated/kind.d.ts.map +1 -0
- package/dist/generated/shape-with-text.d.ts +38 -0
- package/dist/generated/shape-with-text.d.ts.map +1 -0
- package/dist/generated/shape-with-text.js +119 -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 +234 -0
- package/dist/generated/sticky.js.map +1 -0
- package/dist/geometry.d.ts +105 -0
- package/dist/geometry.d.ts.map +1 -0
- package/dist/geometry.js +374 -0
- package/dist/geometry.js.map +1 -0
- package/dist/gradient.d.ts +74 -0
- package/dist/gradient.d.ts.map +1 -0
- package/dist/gradient.js +211 -0
- package/dist/gradient.js.map +1 -0
- package/dist/graph.d.ts +186 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +630 -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/group-bounds.js +146 -0
- package/dist/group-bounds.js.map +1 -0
- package/dist/guides.d.ts +19 -0
- package/dist/guides.d.ts.map +1 -0
- package/dist/guides.js +39 -0
- package/dist/guides.js.map +1 -0
- package/dist/hit-test.d.ts +49 -0
- package/dist/hit-test.d.ts.map +1 -0
- package/dist/hit-test.js +315 -0
- package/dist/hit-test.js.map +1 -0
- package/dist/icons/glyph.d.ts +22 -0
- package/dist/icons/glyph.d.ts.map +1 -0
- package/dist/icons/glyph.js +109 -0
- 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 -0
- package/dist/images.d.ts.map +1 -0
- package/dist/images.js +85 -0
- package/dist/images.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- 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 +162 -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 +82 -0
- package/dist/instances/fields.js.map +1 -0
- package/dist/instances/index.d.ts +63 -0
- package/dist/instances/index.d.ts.map +1 -0
- package/dist/instances/index.js +305 -0
- package/dist/instances/index.js.map +1 -0
- package/dist/instances/main-component.d.ts +11 -0
- package/dist/instances/main-component.d.ts.map +1 -0
- package/dist/instances/main-component.js +42 -0
- package/dist/instances/main-component.js.map +1 -0
- package/dist/instances/modes.js +26 -0
- package/dist/instances/modes.js.map +1 -0
- package/dist/instances/overrides.d.ts +63 -0
- package/dist/instances/overrides.d.ts.map +1 -0
- package/dist/instances/overrides.js +164 -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/replacements.d.ts +19 -0
- package/dist/instances/replacements.d.ts.map +1 -0
- package/dist/instances/replacements.js +67 -0
- package/dist/instances/replacements.js.map +1 -0
- package/dist/instances/source-walk.js +31 -0
- package/dist/instances/source-walk.js.map +1 -0
- package/dist/instances/sync.js +305 -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/index.js +5 -0
- package/dist/layout/keywords.d.ts +26 -0
- package/dist/layout/keywords.d.ts.map +1 -0
- package/dist/layout/keywords.js +60 -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 -0
- package/dist/matrix.d.ts.map +1 -0
- package/dist/matrix.js +120 -0
- 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/naming.d.ts +9 -0
- package/dist/naming.d.ts.map +1 -0
- package/dist/naming.js +16 -0
- package/dist/naming.js.map +1 -0
- package/dist/node-defaults.d.ts +19 -0
- package/dist/node-defaults.d.ts.map +1 -0
- package/dist/node-defaults.js +243 -0
- package/dist/node-defaults.js.map +1 -0
- package/dist/order-keys.d.ts +39 -0
- package/dist/order-keys.d.ts.map +1 -0
- package/dist/order-keys.js +136 -0
- package/dist/order-keys.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 +103 -0
- package/dist/paints/schema.d.ts.map +1 -0
- package/dist/paints/schema.js +64 -0
- package/dist/paints/schema.js.map +1 -0
- package/dist/parse-path.d.ts +36 -0
- package/dist/parse-path.d.ts.map +1 -0
- package/dist/parse-path.js +200 -0
- package/dist/parse-path.js.map +1 -0
- package/dist/plugin-data/citation.d.ts +13 -0
- package/dist/plugin-data/citation.d.ts.map +1 -0
- package/dist/plugin-data/citation.js +23 -0
- package/dist/plugin-data/citation.js.map +1 -0
- 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 +79 -0
- package/dist/plugin-data/field.js.map +1 -0
- package/dist/plugin-data/fields.d.ts +220 -0
- package/dist/plugin-data/fields.d.ts.map +1 -0
- package/dist/plugin-data/fields.js +214 -0
- package/dist/plugin-data/fields.js.map +1 -0
- package/dist/plugin-data/index.d.ts +5 -0
- package/dist/plugin-data/index.js +5 -0
- package/dist/plugin-data/schema.d.ts +18 -0
- package/dist/plugin-data/schema.d.ts.map +1 -0
- package/dist/plugin-data/schema.js +29 -0
- package/dist/plugin-data/schema.js.map +1 -0
- package/dist/polygon.d.ts +55 -0
- package/dist/polygon.d.ts.map +1 -0
- package/dist/polygon.js +220 -0
- package/dist/polygon.js.map +1 -0
- package/dist/preview.d.ts +12 -0
- package/dist/preview.d.ts.map +1 -0
- package/dist/preview.js +63 -0
- package/dist/preview.js.map +1 -0
- package/dist/primitives/index.d.ts +43 -0
- 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.d.ts +7 -0
- package/dist/random.d.ts.map +1 -0
- package/dist/random.js +25 -0
- package/dist/random.js.map +1 -0
- package/dist/resize.d.ts +41 -0
- package/dist/resize.d.ts.map +1 -0
- package/dist/resize.js +288 -0
- 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 +150 -0
- package/dist/scaling/node.js.map +1 -0
- package/dist/scaling/tree.d.ts +22 -0
- package/dist/scaling/tree.d.ts.map +1 -0
- package/dist/scaling/tree.js +71 -0
- package/dist/scaling/tree.js.map +1 -0
- package/dist/script/index.d.ts +2 -0
- package/dist/script/index.js +2 -0
- package/dist/script/schema.d.ts +29 -0
- package/dist/script/schema.d.ts.map +1 -0
- package/dist/script/schema.js +51 -0
- package/dist/script/schema.js.map +1 -0
- package/dist/shaders/directives.d.ts +43 -0
- package/dist/shaders/directives.d.ts.map +1 -0
- package/dist/shaders/directives.js +293 -0
- package/dist/shaders/directives.js.map +1 -0
- package/dist/shaders/index.d.ts +5 -0
- package/dist/shaders/index.js +5 -0
- package/dist/shaders/model.d.ts +58 -0
- package/dist/shaders/model.d.ts.map +1 -0
- package/dist/shaders/model.js +109 -0
- package/dist/shaders/model.js.map +1 -0
- package/dist/shaders/schema.d.ts +86 -0
- package/dist/shaders/schema.d.ts.map +1 -0
- package/dist/shaders/schema.js +65 -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 +36 -0
- package/dist/shared-styles.d.ts.map +1 -0
- package/dist/shared-styles.js +116 -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 +74 -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 +103 -0
- package/dist/slots/content.js.map +1 -0
- package/dist/slots/frames.d.ts +38 -0
- package/dist/slots/frames.d.ts.map +1 -0
- package/dist/slots/frames.js +113 -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 +61 -0
- package/dist/snap.d.ts.map +1 -0
- package/dist/snap.js +264 -0
- package/dist/snap.js.map +1 -0
- package/dist/source-metadata.d.ts +6 -0
- package/dist/source-metadata.d.ts.map +1 -0
- package/dist/source-metadata.js +11 -0
- 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 +13 -0
- package/dist/text/direction.d.ts.map +1 -0
- package/dist/text/direction.js +31 -0
- 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 +19 -0
- package/dist/text/lengths.d.ts.map +1 -0
- package/dist/text/lengths.js +40 -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 +18 -0
- package/dist/text/picture.d.ts.map +1 -0
- package/dist/text/picture.js +41 -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/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 +7 -0
- package/dist/transfer/index.js +7 -0
- package/dist/transfer/nodes.d.ts +14 -0
- package/dist/transfer/nodes.d.ts.map +1 -0
- package/dist/transfer/nodes.js +82 -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 +910 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +89 -0
- package/dist/types.js.map +1 -0
- package/dist/undo.d.ts +93 -0
- package/dist/undo.d.ts.map +1 -0
- package/dist/undo.js +236 -0
- package/dist/undo.js.map +1 -0
- package/dist/variables/bindings.d.ts +66 -0
- package/dist/variables/bindings.d.ts.map +1 -0
- package/dist/variables/bindings.js +251 -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 +30 -0
- package/dist/variables/fields.d.ts.map +1 -0
- package/dist/variables/fields.js +89 -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 +246 -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 +21 -0
- package/dist/variables/text.d.ts.map +1 -0
- package/dist/variables/text.js +58 -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/variant-name.d.ts +6 -0
- package/dist/variant-name.d.ts.map +1 -0
- package/dist/variant-name.js +17 -0
- package/dist/variant-name.js.map +1 -0
- package/dist/variant-properties.d.ts +18 -0
- package/dist/variant-properties.d.ts.map +1 -0
- package/dist/variant-properties.js +74 -0
- package/dist/variant-properties.js.map +1 -0
- package/dist/vector-network.d.ts +48 -0
- package/dist/vector-network.d.ts.map +1 -0
- package/dist/vector-network.js +352 -0
- package/dist/vector-network.js.map +1 -0
- package/package.json +352 -4
- package/src/agent-notes/index.ts +2 -0
- package/src/agent-notes/model.ts +46 -0
- package/src/agent-notes/schema.ts +28 -0
- package/src/arrow-caps.ts +364 -0
- package/src/asset-keys.ts +25 -0
- package/src/behaviours/index.ts +5 -0
- package/src/behaviours/kinds.ts +185 -0
- package/src/behaviours/layers.ts +51 -0
- package/src/behaviours/model.ts +184 -0
- package/src/behaviours/schema.ts +93 -0
- package/src/behaviours/spec.ts +178 -0
- package/src/bindings.ts +20 -0
- package/src/browser-node/index.ts +2 -0
- package/src/browser-node/model.ts +35 -0
- package/src/browser-node/schema.ts +62 -0
- package/src/buffered-events.ts +64 -0
- package/src/checkpoint.ts +123 -0
- package/src/clipping.ts +112 -0
- package/src/color/contrast.ts +71 -0
- package/src/color/index.ts +89 -0
- package/src/color/management.ts +210 -0
- package/src/color/normalize.ts +7 -0
- package/src/color/okhcl.ts +201 -0
- package/src/color/schema.ts +10 -0
- package/src/comments/document.ts +51 -0
- package/src/comments/index.ts +5 -0
- package/src/comments/list.ts +52 -0
- package/src/comments/merge.ts +63 -0
- package/src/comments/schema.ts +51 -0
- package/src/comments/threads.ts +156 -0
- package/src/components/exposure.ts +61 -0
- package/src/components/index.ts +9 -0
- package/src/components/library-page.ts +17 -0
- package/src/components/properties.ts +241 -0
- package/src/components/variants.ts +53 -0
- 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 +60 -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 +144 -0
- package/src/connectors/route.ts +148 -0
- package/src/connectors/sides.ts +94 -0
- package/src/connectors/sublayers.ts +204 -0
- package/src/constants.ts +13 -0
- package/src/coordinate.ts +298 -0
- package/src/copy.ts +341 -0
- package/src/css/grid.ts +70 -0
- package/src/css/index.ts +10 -0
- package/src/css/layout.ts +53 -0
- package/src/css/shadows.ts +68 -0
- package/src/css/text.ts +84 -0
- package/src/css/values.ts +42 -0
- package/src/events.ts +21 -0
- package/src/export-format.ts +33 -0
- package/src/export-scale.ts +16 -0
- package/src/fields/appearance.ts +35 -0
- package/src/fields/geometry.ts +11 -0
- package/src/fields/index.ts +4 -0
- package/src/fields/layout.ts +48 -0
- package/src/fields/text.ts +64 -0
- package/src/fig-compression.ts +9 -0
- package/src/figjam/index.ts +2 -0
- package/src/figjam/palette.ts +308 -0
- package/src/figjam/text.ts +78 -0
- package/src/font-style.ts +121 -0
- package/src/generated/index.ts +81 -0
- package/src/generated/kind.ts +26 -0
- package/src/generated/shape-with-text.ts +132 -0
- package/src/generated/sticky.ts +214 -0
- package/src/geometry.ts +490 -0
- package/src/gradient.ts +275 -0
- package/src/graph.ts +842 -0
- package/src/group-bounds.ts +178 -0
- package/src/guides.ts +47 -0
- package/src/hit-test.ts +501 -0
- package/src/icons/glyph.ts +128 -0
- package/src/icons/index.ts +3 -0
- package/src/icons/model.ts +63 -0
- package/src/icons/schema.ts +34 -0
- package/src/ids.ts +34 -0
- package/src/images.ts +89 -0
- package/src/index.ts +4 -0
- package/src/instances/assignments.ts +116 -0
- package/src/instances/content-size.ts +84 -0
- package/src/instances/copies.ts +244 -0
- package/src/instances/cycles.ts +73 -0
- package/src/instances/fields.ts +90 -0
- package/src/instances/index.ts +467 -0
- package/src/instances/main-component.ts +61 -0
- package/src/instances/modes.ts +39 -0
- package/src/instances/overrides.ts +240 -0
- package/src/instances/placement.ts +29 -0
- package/src/instances/replacements.ts +80 -0
- package/src/instances/source-walk.ts +35 -0
- package/src/instances/sync.ts +556 -0
- package/src/instances/vector-geometry.ts +81 -0
- package/src/layout/aspect-ratio.ts +51 -0
- package/src/layout/guides.ts +132 -0
- package/src/layout/index.ts +4 -0
- package/src/layout/keywords.ts +74 -0
- package/src/layout/sizing.ts +196 -0
- package/src/layout/writes.ts +59 -0
- package/src/matrix.ts +116 -0
- package/src/mutation-impact.ts +85 -0
- package/src/naming.ts +11 -0
- package/src/node-defaults.ts +260 -0
- package/src/order-keys.ts +162 -0
- package/src/paints/index.ts +1 -0
- package/src/paints/schema.ts +72 -0
- package/src/parse-path.ts +244 -0
- package/src/plugin-data/citation.ts +27 -0
- package/src/plugin-data/field.ts +140 -0
- package/src/plugin-data/fields.ts +306 -0
- package/src/plugin-data/index.ts +3 -0
- package/src/plugin-data/schema.ts +35 -0
- package/src/polygon.ts +228 -0
- package/src/preview.ts +80 -0
- package/src/primitives/index.ts +44 -0
- package/src/primitives/schema.ts +14 -0
- package/src/random.ts +28 -0
- package/src/resize.ts +415 -0
- package/src/scaling/index.ts +9 -0
- package/src/scaling/node.ts +168 -0
- package/src/scaling/tree.ts +85 -0
- package/src/script/index.ts +1 -0
- package/src/script/schema.ts +65 -0
- package/src/shaders/directives.ts +366 -0
- package/src/shaders/index.ts +4 -0
- package/src/shaders/model.ts +147 -0
- package/src/shaders/schema.ts +84 -0
- package/src/shaders/still.ts +41 -0
- 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 +137 -0
- package/src/slots/authoring.ts +101 -0
- package/src/slots/content.ts +127 -0
- package/src/slots/frames.ts +160 -0
- package/src/slots/index.ts +4 -0
- package/src/slots/limits.ts +49 -0
- package/src/snap.ts +349 -0
- package/src/source-metadata.ts +8 -0
- 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/direction.ts +55 -0
- package/src/text/index.ts +6 -0
- package/src/text/lengths.ts +34 -0
- package/src/text/lists.ts +138 -0
- package/src/text/overflow.ts +12 -0
- package/src/text/paragraphs.ts +241 -0
- package/src/text/picture.ts +57 -0
- package/src/text/references.ts +50 -0
- package/src/text/schema.ts +7 -0
- package/src/transfer/apply.ts +84 -0
- package/src/transfer/history.ts +49 -0
- package/src/transfer/identity.ts +16 -0
- package/src/transfer/index.ts +6 -0
- package/src/transfer/nodes.ts +128 -0
- package/src/transfer/plan.ts +130 -0
- package/src/transfer/references.ts +9 -0
- package/src/transfer/remove.ts +39 -0
- package/src/transfer/validation.ts +59 -0
- package/src/transfer/variables.ts +83 -0
- package/src/types.ts +1205 -0
- package/src/undo.ts +285 -0
- package/src/variables/bindings.ts +310 -0
- package/src/variables/corners.ts +39 -0
- package/src/variables/fields.ts +109 -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/index.ts +400 -0
- package/src/variables/resolution.ts +293 -0
- package/src/variables/schema.ts +31 -0
- package/src/variables/text.ts +61 -0
- package/src/variables/token.ts +40 -0
- package/src/variables/units.ts +15 -0
- package/src/variables/value.ts +92 -0
- package/src/variant-name.ts +15 -0
- package/src/variant-properties.ts +98 -0
- package/src/vector-network.ts +489 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fit.js","names":[],"sources":["../../src/shape-with-text/fit.ts"],"sourcesContent":["import type { ShapeWithTextType } from './kinds'\n\n/** The height of a database's elliptical cap: FigJam keeps it 24 px tall at any size. */\nexport function databaseCap(w: number, h: number): number {\n return Math.min(24, h * 0.25, w * 0.25)\n}\n\nexport interface LabelBox {\n x: number\n y: number\n width: number\n height: number\n}\n\ntype Insets = readonly [left: number, top: number, right: number, bottom: number]\n\n/** The 16 px FigJam leaves around a label, 8 px on a shape less than 100 px on a side. */\nfunction labelPadding(width: number, height: number): number {\n return Math.min(width, height) < 100 ? 8 : 16\n}\n\n/** FigJam doubles some kinds' insets on a shape 300 px wide or more. */\nfunction wide(width: number): boolean {\n return width >= 300\n}\n\ntype InsetRule = (width: number, height: number, padding: number) => Insets\n\n/** A triangle's label sits under its middle, 4 px in from its sides; returns its top and bottom. */\nfunction triangleInsets(width: number, height: number): readonly [apex: number, base: number] {\n const lean = (4 * height) / width\n return [height / 2 + lean, 8 + lean]\n}\n\n/** The rectangle inscribed in an ellipse, its width rounded to a whole pixel. */\nconst ellipseInsets: InsetRule = (width, height) => {\n const label = Math.round(width / Math.SQRT2)\n const x = (width - label) / 2\n const y = (height - height * Math.sqrt(1 - (label / width) ** 2)) / 2\n return [x, y, x, y]\n}\n\n/**\n * The px FigJam leaves free on each side of a label in each kind, measured from its saved label\n * layouts. Insets that scale do so with the side they lie along.\n */\nconst LABEL_INSETS: Record<ShapeWithTextType, InsetRule> = {\n SQUARE: (_w, _h, p) => [p, p, p, p],\n ROUNDED_RECTANGLE: (w, _h, p) => {\n const inset = wide(w) ? p * 2 : p\n return [inset, inset, inset, inset]\n },\n ELLIPSE: ellipseInsets,\n SUMMING_JUNCTION: ellipseInsets,\n OR: ellipseInsets,\n DIAMOND: (w, h) => [w / 4 + 4, h / 4 + 4, w / 4 + 4, h / 4 + 4],\n TRIANGLE_UP: (w, h) => {\n const [apex, base] = triangleInsets(w, h)\n return [w / 4, apex, w / 4, base]\n },\n TRIANGLE_DOWN: (w, h) => {\n const [apex, base] = triangleInsets(w, h)\n return [w / 4, base, w / 4, apex]\n },\n PARALLELOGRAM_RIGHT: (w, _h, p) => [(13 * w) / 62 + 6, p, (13 * w) / 62 + 6, p],\n PARALLELOGRAM_LEFT: (w, _h, p) => [(13 * w) / 62 + 6, p, (13 * w) / 62 + 6, p],\n // Below the cap and its rim, above the bottom curve.\n ENG_DATABASE: (w, h, p) => [p, databaseCap(w, h) * 2 + p, p, databaseCap(w, h)],\n ENG_QUEUE: (_w, _h, p) => [24, p, 64, p],\n ENG_FILE: (_w, _h, p) => [p, 64, p, 64],\n ENG_FOLDER: (_w, _h, p) => [p, 60, p, p],\n TRAPEZOID: (w, _h, p) => [(16 * w) / 121, p, (16 * w) / 121, p],\n HEXAGON: (w, _h, p) => [(8 * w) / 121, p, (8 * w) / 121, p],\n PREDEFINED_PROCESS: (w) => (wide(w) ? [48, 24, 48, 24] : [32, 16, 32, 16]),\n INTERNAL_STORAGE: (w) => (wide(w) ? [40, 40, 24, 24] : [24, 24, 16, 16]),\n SHIELD: (_w, h, p) => [p, h * 0.075, p, h * 0.1977],\n DOCUMENT_SINGLE: (_w, _h, p) => [p, p, p, 28],\n DOCUMENT_MULTIPLE: (_w, _h, p) => [32, p, p, 28],\n MANUAL_INPUT: (_w, _h, p) => [p, 24, p, p],\n CHEVRON: (_w, _h, p) => [43, p, 43, p],\n PENTAGON: (w, h) => [w * 0.115, h * 0.27403, w * 0.115, h * 0.08454],\n OCTAGON: (w, h) => [w * 0.11466, h * 0.1193, w * 0.11466, h * 0.1193],\n STAR: (w, h) => [w * 0.19531, h * 0.3028, w * 0.19531, h * 0.109],\n PLUS: (_w, h, p) => [p, (h * 5) / 18, p, (h * 5) / 18],\n ARROW_LEFT: (_w, h, p) => [54, h * 0.25465, p, h * 0.25465],\n ARROW_RIGHT: (_w, h, p) => [p, h * 0.25465, 54, h * 0.25465],\n // Above the tail, an eighth of the shape and at most 32 px tall.\n SPEECH_BUBBLE: (w, h, p) => [p, p, p, p + Math.min(32, Math.min(w, h) / 8)]\n}\n\n/** Where a shape's label sits inside its `width` × `height` box. */\nexport function shapeWithTextLabelBox(\n type: ShapeWithTextType,\n width: number,\n height: number\n): LabelBox {\n const [left, top, right, bottom] = LABEL_INSETS[type](width, height, labelPadding(width, height))\n const x = insetWithin(left, right, width)\n const y = insetWithin(top, bottom, height)\n return {\n x,\n y,\n width: Math.max(0, width - x - right),\n height: Math.max(0, height - y - bottom)\n }\n}\n\n/** The inset before a label, its share of `size` when both insets do not fit in it. */\nfunction insetWithin(before: number, after: number, size: number): number {\n return before + after <= size ? before : (size * before) / (before + after)\n}\n\n/** Measures a label wrapped at `maxWidth`; its height is what the wrapped lines take. */\nexport type LabelMeasure = (maxWidth: number) => { width: number; height: number }\n\nconst LARGEST = 100_000\n\n/** Whether a kind grows for its label; FigJam keeps summing junctions and ors round. */\nexport function shapeWithTextGrows(type: ShapeWithTextType): boolean {\n return type !== 'SUMMING_JUNCTION' && type !== 'OR'\n}\n\n/**\n * The height a `width`-wide shape of `type` takes for its label, as FigJam fits it: the height it\n * was given while the label fits its label box, else the smallest whole height whose label box\n * holds the label. FigJam never widens a shape for its label; a word too long for it breaks.\n */\nexport function fitShapeWithTextHeight(\n type: ShapeWithTextType,\n width: number,\n height: number,\n measure: LabelMeasure\n): number {\n const fits = (h: number) => {\n const box = shapeWithTextLabelBox(type, width, h)\n return measure(box.width).height <= box.height\n }\n if (width <= 0 || height <= 0 || !shapeWithTextGrows(type) || fits(height)) return height\n let low = height\n let high = Math.max(height * 2, height + 16)\n while (!fits(high)) {\n low = high\n high *= 2\n if (high > LARGEST) return LARGEST\n }\n // The smallest whole height that fits, above a height that does not.\n low = Math.floor(low)\n while (high - low > 1) {\n const middle = Math.floor((low + high) / 2)\n if (fits(middle)) high = middle\n else low = middle\n }\n return Math.ceil(high)\n}\n"],"mappings":";;AAGA,SAAgB,YAAY,GAAW,GAAmB;CACxD,OAAO,KAAK,IAAI,IAAI,IAAI,KAAM,IAAI,GAAI;AACxC;;AAYA,SAAS,aAAa,OAAe,QAAwB;CAC3D,OAAO,KAAK,IAAI,OAAO,MAAM,IAAI,MAAM,IAAI;AAC7C;;AAGA,SAAS,KAAK,OAAwB;CACpC,OAAO,SAAS;AAClB;;AAKA,SAAS,eAAe,OAAe,QAAuD;CAC5F,MAAM,OAAQ,IAAI,SAAU;CAC5B,OAAO,CAAC,SAAS,IAAI,MAAM,IAAI,IAAI;AACrC;;AAGA,MAAM,iBAA4B,OAAO,WAAW;CAClD,MAAM,QAAQ,KAAK,MAAM,QAAQ,KAAK,KAAK;CAC3C,MAAM,KAAK,QAAQ,SAAS;CAC5B,MAAM,KAAK,SAAS,SAAS,KAAK,KAAK,KAAK,QAAQ,UAAU,CAAC,KAAK;CACpE,OAAO;EAAC;EAAG;EAAG;EAAG;CAAC;AACpB;;;;;AAMA,MAAM,eAAqD;CACzD,SAAS,IAAI,IAAI,MAAM;EAAC;EAAG;EAAG;EAAG;CAAC;CA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M,IAAI,YAAY,MAAM,OAAO,KAAK;CACxC,MAAM,IAAI,YAAY,KAAK,QAAQ,MAAM;CACzC,OAAO;EACL;EACA;EACA,OAAO,KAAK,IAAI,GAAG,QAAQ,IAAI,KAAK;EACpC,QAAQ,KAAK,IAAI,GAAG,SAAS,IAAI,MAAM;CACzC;AACF;;AAGA,SAAS,YAAY,QAAgB,OAAe,MAAsB;CACxE,OAAO,SAAS,SAAS,OAAO,SAAU,OAAO,UAAW,SAAS;AACvE;AAKA,MAAM,UAAU;;AAGhB,SAAgB,mBAAmB,MAAkC;CACnE,OAAO,SAAS,sBAAsB,SAAS;AACjD;;;;;;AAOA,SAAgB,uBACd,MACA,OACA,QACA,SACQ;CACR,MAAM,QAAQ,MAAc;EAC1B,MAAM,MAAM,sBAAsB,MAAM,OAAO,CAAC;EAChD,OAAO,QAAQ,IAAI,KAAK,CAAC,CAAC,UAAU,IAAI;CAC1C;CACA,IAAI,SAAS,KAAK,UAAU,KAAK,CAAC,mBAAmB,IAAI,KAAK,KAAK,MAAM,GAAG,OAAO;CACnF,IAAI,MAAM;CACV,IAAI,OAAO,KAAK,IAAI,SAAS,GAAG,SAAS,EAAE;CAC3C,OAAO,CAAC,KAAK,IAAI,GAAG;EAClB,MAAM;EACN,QAAQ;EACR,IAAI,OAAO,SAAS,OAAO;CAC7B;CAEA,MAAM,KAAK,MAAM,GAAG;CACpB,OAAO,OAAO,MAAM,GAAG;EACrB,MAAM,SAAS,KAAK,OAAO,MAAM,QAAQ,CAAC;EAC1C,IAAI,KAAK,MAAM,GAAG,OAAO;OACpB,MAAM;CACb;CACA,OAAO,KAAK,KAAK,IAAI;AACvB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ShapeWithTextType } from "./kinds.js";
|
|
2
|
+
import { PolygonOutlineCommand } from "../polygon.js";
|
|
3
|
+
//#region src/shape-with-text/geometry.d.ts
|
|
4
|
+
interface ShapeWithTextGeometry {
|
|
5
|
+
/** The closed outline that is filled and stroked, and that connectors attach to. */
|
|
6
|
+
outline: PolygonOutlineCommand[];
|
|
7
|
+
/** Inner lines that are stroked only, such as a database's front rim. */
|
|
8
|
+
details: PolygonOutlineCommand[];
|
|
9
|
+
}
|
|
10
|
+
/** How far a parallelogram's sides lean: FigJam leans them with the height, not the width. */
|
|
11
|
+
declare function parallelogramSlant(w: number, h: number): number;
|
|
12
|
+
/**
|
|
13
|
+
* The outline and inner lines of a shape of `type` filling a `width` × `height` box. Outlines
|
|
14
|
+
* made only of straight segments have their corners rounded to `cornerRadius`; outlines with
|
|
15
|
+
* curves, such as a rounded rectangle, keep their own shape.
|
|
16
|
+
*/
|
|
17
|
+
declare function shapeWithTextGeometry(type: ShapeWithTextType, width: number, height: number, cornerRadius?: number): ShapeWithTextGeometry;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { ShapeWithTextGeometry, parallelogramSlant, shapeWithTextGeometry };
|
|
20
|
+
//# sourceMappingURL=geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry.d.ts","names":[],"sources":["../../src/shape-with-text/geometry.ts"],"mappings":";;;UAIiB;;EAEf,SAAS;;EAET,SAAS;;;iBAqIK,mBAAmB,WAAW;;;;;;iBAwV9B,sBACd,MAAM,mBACN,eACA,gBACA,wBACC"}
|
|
@@ -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))\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M,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,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"}
|