@open-pencil/scene-graph 0.16.0 → 0.17.0-beta.1
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 +289 -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 +56 -0
- package/dist/behaviours/kinds.d.ts.map +1 -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/{chunks/behaviours → behaviours}/spec.js +4 -28
- package/dist/behaviours/spec.js.map +1 -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 +13 -0
- package/dist/checkpoint.d.ts.map +1 -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 +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.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 +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 +270 -2
- 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/{chunks/css → css}/grid.js +2 -33
- 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.map +1 -0
- package/dist/export-format.d.ts +12 -0
- package/dist/export-format.d.ts.map +1 -0
- package/dist/export-format.js +22 -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 +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 +259 -0
- package/dist/figjam/palette.d.ts.map +1 -0
- package/dist/figjam/palette.js +411 -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 +38 -0
- package/dist/generated/shape-with-text.d.ts.map +1 -0
- package/dist/generated/shape-with-text.js +118 -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 +105 -2
- package/dist/geometry.d.ts.map +1 -0
- package/dist/geometry.js +374 -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 +177 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +613 -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 +19 -2
- package/dist/guides.d.ts.map +1 -0
- 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 +34 -29
- 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 +82 -0
- package/dist/instances/fields.js.map +1 -0
- package/dist/instances/index.d.ts +40 -0
- package/dist/instances/index.d.ts.map +1 -0
- package/dist/instances/index.js +174 -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/overrides.d.ts +48 -0
- package/dist/instances/overrides.d.ts.map +1 -0
- package/dist/instances/overrides.js +142 -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/sync.js +275 -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/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 +142 -0
- package/dist/plugin-data/fields.d.ts.map +1 -0
- package/dist/plugin-data/fields.js +153 -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 +38 -0
- package/dist/shared-styles.d.ts.map +1 -0
- package/dist/shared-styles.js +125 -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 +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 +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 +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 → text/picture.d.ts} +2 -2
- 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/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 +74 -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 +169 -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 +60 -0
- package/dist/variables/bindings.d.ts.map +1 -0
- package/dist/variables/bindings.js +224 -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 +25 -0
- package/dist/variables/fields.d.ts.map +1 -0
- package/dist/variables/fields.js +69 -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 +223 -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 +297 -137
- package/src/arrow-caps.ts +282 -62
- package/src/behaviours/index.ts +5 -0
- package/src/behaviours/layers.ts +1 -1
- package/src/behaviours/model.ts +3 -11
- package/src/behaviours/schema.ts +44 -9
- package/src/behaviours/spec.ts +4 -49
- package/src/checkpoint.ts +1 -1
- 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 +2 -2
- package/src/components/variants.ts +1 -1
- 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 +203 -0
- package/src/coordinate.ts +10 -3
- package/src/copy.ts +63 -17
- package/src/css/index.ts +1 -0
- package/src/css/text.ts +84 -0
- package/src/export-format.ts +1 -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 +29 -0
- package/src/fig-compression.ts +9 -0
- package/src/figjam/index.ts +2 -0
- package/src/figjam/palette.ts +445 -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 +131 -0
- package/src/generated/sticky.ts +213 -0
- package/src/geometry.ts +40 -130
- package/src/gradient.ts +14 -0
- package/src/graph.ts +825 -0
- package/src/group-bounds.ts +59 -12
- package/src/guides.ts +1 -1
- package/src/hit-test.ts +52 -21
- 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 +39 -92
- package/src/{instances.ts → instances/index.ts} +13 -15
- package/src/instances/main-component.ts +43 -1
- package/src/{instance-overrides.ts → instances/overrides.ts} +31 -1
- package/src/instances/placement.ts +1 -1
- package/src/instances/source-walk.ts +3 -9
- package/src/instances/sync.ts +30 -140
- 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 +41 -2
- 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 +54 -75
- 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 +89 -18
- package/src/slots/authoring.ts +1 -1
- package/src/slots/content.ts +8 -5
- package/src/slots/frames.ts +3 -3
- 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 +34 -0
- package/src/text/overflow.ts +12 -0
- 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 +11 -14
- 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 +218 -13
- package/src/undo.ts +64 -2
- package/src/variables/bindings.ts +44 -55
- package/src/variables/corners.ts +39 -0
- package/src/variables/fields.ts +38 -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} +52 -145
- 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.map +0 -1
- package/dist/chunks/buffered-events.js.map +0 -1
- 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.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/behaviours → behaviours}/kinds.js +0 -0
- /package/dist/{chunks/bindings.js → bindings.js} +0 -0
- /package/dist/{chunks/buffered-events.js → buffered-events.js} +0 -0
- /package/dist/{chunks/checkpoint.js → checkpoint.js} +0 -0
- /package/dist/{chunks/components → components}/variants.js +0 -0
- /package/dist/{chunks/events.js → events.js} +0 -0
- /package/dist/{chunks/fields → fields}/geometry.js +0 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { BLACK } from '../constants'
|
|
2
|
+
import type { GeneratedFrameKind } from '../generated/kind'
|
|
3
|
+
import type { SceneGraph } from '../graph'
|
|
4
|
+
import type { Color, Vector } from '../primitives'
|
|
5
|
+
import { pixelLength } from '../text/lengths'
|
|
6
|
+
import type { ConnectorEndpoint, Fill, SceneNode, Stroke, VectorNetwork } from '../types'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A FigJam connector as Figma draws it by default: a grey line 4 px wide with rounded elbows, a
|
|
10
|
+
* round start, and an arrow at the end. Measured in FigJam.
|
|
11
|
+
*/
|
|
12
|
+
export const CONNECTOR_COLOR: Color = { r: 117 / 255, g: 117 / 255, b: 117 / 255, a: 1 }
|
|
13
|
+
export const CONNECTOR_STROKE_WEIGHT = 4
|
|
14
|
+
/** FigJam's line menu draws a connector Thin, at its default weight, or Thick, at twice it. */
|
|
15
|
+
export const CONNECTOR_THICK_STROKE_WEIGHT = 8
|
|
16
|
+
export const CONNECTOR_CORNER_RADIUS = 24
|
|
17
|
+
/** The face a connector's label starts in, as FigJam's: Inter Medium. */
|
|
18
|
+
export const CONNECTOR_LABEL_FONT = { family: 'Inter', weight: 500 } as const
|
|
19
|
+
|
|
20
|
+
/** The dash FigJam's line menu draws a connector with, longer for a thick line. Measured in FigJam. */
|
|
21
|
+
export function connectorDash(weight: number): number[] {
|
|
22
|
+
return weight >= CONNECTOR_THICK_STROKE_WEIGHT ? [40, 24] : [16, 10]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** How a connector's line is drawn: its colour, weight, and whether it is dashed. */
|
|
26
|
+
export interface ConnectorLineStyle {
|
|
27
|
+
color: Color
|
|
28
|
+
weight: number
|
|
29
|
+
dashed: boolean
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** The style a connector's line is drawn in. */
|
|
33
|
+
export function connectorLineStyle(line: Pick<SceneNode, 'strokes'>): ConnectorLineStyle {
|
|
34
|
+
const stroke = line.strokes.at(0) ?? connectorStroke()
|
|
35
|
+
return {
|
|
36
|
+
color: { ...stroke.color },
|
|
37
|
+
weight: stroke.weight,
|
|
38
|
+
dashed: (stroke.dashPattern?.length ?? 0) > 0
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* A connector's line restyled by `style`, each part left out kept, as FigJam's colour and line
|
|
44
|
+
* menus set it. A new weight or dash takes FigJam's dash for the weight, while a new colour alone
|
|
45
|
+
* keeps the dash the line has, even one of its own. The dash goes on the stroke, which draws with
|
|
46
|
+
* it, and on the line, which files keep.
|
|
47
|
+
*/
|
|
48
|
+
export function connectorLineStyleFields(
|
|
49
|
+
line: Pick<SceneNode, 'strokes'>,
|
|
50
|
+
style: Partial<ConnectorLineStyle>
|
|
51
|
+
): Partial<SceneNode> {
|
|
52
|
+
const current = connectorLineStyle(line)
|
|
53
|
+
const color = style.color ?? current.color
|
|
54
|
+
const weight = style.weight ?? current.weight
|
|
55
|
+
const dashed = style.dashed ?? current.dashed
|
|
56
|
+
const [stroke = connectorStroke()] = line.strokes
|
|
57
|
+
const restyled = style.weight !== undefined || style.dashed !== undefined
|
|
58
|
+
const kept = stroke.dashPattern?.length ? [...stroke.dashPattern] : connectorDash(weight)
|
|
59
|
+
const dashPattern = dashed ? (restyled ? connectorDash(weight) : kept) : []
|
|
60
|
+
return {
|
|
61
|
+
strokes: [{ ...stroke, color: { ...color }, weight, dashPattern: [...dashPattern] }],
|
|
62
|
+
strokeWeight: weight,
|
|
63
|
+
dashPattern
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function connectorStroke(color: Color = CONNECTOR_COLOR): Stroke {
|
|
68
|
+
return {
|
|
69
|
+
type: 'SOLID',
|
|
70
|
+
color: { ...color },
|
|
71
|
+
opacity: 1,
|
|
72
|
+
visible: true,
|
|
73
|
+
weight: CONNECTOR_STROKE_WEIGHT,
|
|
74
|
+
align: 'CENTER',
|
|
75
|
+
cap: 'ROUND',
|
|
76
|
+
join: 'ROUND'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface ConnectorSublayers {
|
|
81
|
+
/** The routed line, a vector whose ends carry the connector's caps. */
|
|
82
|
+
line: SceneNode
|
|
83
|
+
/** The plate behind the label, which the line breaks around. */
|
|
84
|
+
labelBackground: SceneNode
|
|
85
|
+
label: SceneNode
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** A connector's line, label plate, and label, in drawing order. */
|
|
89
|
+
export function connectorSublayers(
|
|
90
|
+
graph: SceneGraph,
|
|
91
|
+
connector: SceneNode
|
|
92
|
+
): ConnectorSublayers | null {
|
|
93
|
+
const children = graph.getChildren(connector.id)
|
|
94
|
+
if (children.length !== 3) return null
|
|
95
|
+
const [line, labelBackground, label] = children
|
|
96
|
+
if (line.type !== 'VECTOR' || label.type !== 'TEXT') return null
|
|
97
|
+
return { line, labelBackground, label }
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* FigJam keeps a connector's box to its route, so it never turns or resizes on its own; typing
|
|
102
|
+
* into it edits its label.
|
|
103
|
+
*/
|
|
104
|
+
export const CONNECTOR_KIND: GeneratedFrameKind = {
|
|
105
|
+
complete: (graph, frame) => connectorSublayers(graph, frame) !== null,
|
|
106
|
+
text: (graph, frame) => connectorSublayers(graph, frame)?.label,
|
|
107
|
+
rotates: false,
|
|
108
|
+
resizes: false,
|
|
109
|
+
namedByText: false
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function solid(color: Color, opacity = 1): Fill {
|
|
113
|
+
return { type: 'SOLID', color: { ...color }, opacity, visible: true }
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** Adds a connector's sublayers to a CONNECTOR the caller created; its route comes later. */
|
|
117
|
+
export function buildConnectorSublayers(
|
|
118
|
+
graph: SceneGraph,
|
|
119
|
+
connector: SceneNode,
|
|
120
|
+
overrides: Partial<Record<keyof ConnectorSublayers, Partial<SceneNode>>> = {}
|
|
121
|
+
): ConnectorSublayers {
|
|
122
|
+
const empty: VectorNetwork = { vertices: [], segments: [], regions: [] }
|
|
123
|
+
const line = graph.createNode('VECTOR', connector.id, {
|
|
124
|
+
name: 'Line',
|
|
125
|
+
vectorNetwork: empty,
|
|
126
|
+
fills: [],
|
|
127
|
+
strokes: [connectorStroke()],
|
|
128
|
+
strokeWeight: CONNECTOR_STROKE_WEIGHT,
|
|
129
|
+
cornerRadius: CONNECTOR_CORNER_RADIUS,
|
|
130
|
+
...overrides.line
|
|
131
|
+
})
|
|
132
|
+
const labelBackground = graph.createNode('RECTANGLE', connector.id, {
|
|
133
|
+
name: 'Label background',
|
|
134
|
+
fills: [solid({ r: 1, g: 1, b: 1, a: 1 })],
|
|
135
|
+
cornerRadius: 3,
|
|
136
|
+
visible: false,
|
|
137
|
+
...overrides.labelBackground
|
|
138
|
+
})
|
|
139
|
+
const label = graph.createNode('TEXT', connector.id, {
|
|
140
|
+
name: 'Label',
|
|
141
|
+
text: '',
|
|
142
|
+
fontFamily: CONNECTOR_LABEL_FONT.family,
|
|
143
|
+
fontWeight: CONNECTOR_LABEL_FONT.weight,
|
|
144
|
+
fontSize: 16,
|
|
145
|
+
lineHeight: pixelLength(24),
|
|
146
|
+
textAlignHorizontal: 'CENTER',
|
|
147
|
+
textAutoResize: 'WIDTH_AND_HEIGHT',
|
|
148
|
+
fills: [solid(BLACK)],
|
|
149
|
+
visible: false,
|
|
150
|
+
...overrides.label
|
|
151
|
+
})
|
|
152
|
+
return { line, labelBackground, label }
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Where a connector's line starts and ends, in its parent's axes: the ends a connector keeps when
|
|
157
|
+
* the layers it was attached to are gone.
|
|
158
|
+
*/
|
|
159
|
+
export function connectorRouteEnds(
|
|
160
|
+
graph: SceneGraph,
|
|
161
|
+
connector: SceneNode
|
|
162
|
+
): { start: Vector; end: Vector } | null {
|
|
163
|
+
const ends = connectorLineEnds(graph, connector)
|
|
164
|
+
if (!ends) return null
|
|
165
|
+
const at = (vertex: Vector) => ({
|
|
166
|
+
x: connector.x + ends.line.x + vertex.x,
|
|
167
|
+
y: connector.y + ends.line.y + vertex.y
|
|
168
|
+
})
|
|
169
|
+
return { start: at(ends.start), end: at(ends.end) }
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** A connector's line and where it starts and ends, in the line's own axes. */
|
|
173
|
+
export function connectorLineEnds(
|
|
174
|
+
graph: SceneGraph,
|
|
175
|
+
connector: SceneNode
|
|
176
|
+
): { line: SceneNode; start: Vector; end: Vector } | null {
|
|
177
|
+
const line = connectorSublayers(graph, connector)?.line
|
|
178
|
+
const vertices = line?.vectorNetwork?.vertices ?? []
|
|
179
|
+
const start = vertices.at(0)
|
|
180
|
+
const end = vertices.at(-1)
|
|
181
|
+
return line && start && end ? { line, start, end } : null
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** A free connector end at a point in the connector's parent's axes. */
|
|
185
|
+
export function freeEndpoint(x: number, y: number): ConnectorEndpoint {
|
|
186
|
+
return { nodeId: null, magnet: 'NONE', position: { x, y } }
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** A connector end bound to a layer, following it by `magnet`. */
|
|
190
|
+
export function boundEndpoint(
|
|
191
|
+
nodeId: string,
|
|
192
|
+
magnet: ConnectorEndpoint['magnet'] = 'AUTO'
|
|
193
|
+
): ConnectorEndpoint {
|
|
194
|
+
return { nodeId, magnet, position: { x: 0, y: 0 } }
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** The connector whose label `node` is, if it is one. */
|
|
198
|
+
export function labelledConnector(graph: SceneGraph, node: SceneNode): SceneNode | null {
|
|
199
|
+
if (node.type !== 'TEXT' || !node.parentId) return null
|
|
200
|
+
const owner = graph.getNode(node.parentId)
|
|
201
|
+
if (owner?.type !== 'CONNECTOR') return null
|
|
202
|
+
return connectorSublayers(graph, owner)?.label.id === node.id ? owner : null
|
|
203
|
+
}
|
package/src/coordinate.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { SceneGraph
|
|
1
|
+
import type { SceneGraph } from './graph'
|
|
2
2
|
import Matrix, { type Mat3 } from './matrix'
|
|
3
3
|
import { FITTED_CONTAINER_TYPES } from './node-defaults'
|
|
4
4
|
import type { Rect, Vector } from './primitives'
|
|
5
|
+
import type { SceneNode } from './types'
|
|
5
6
|
|
|
6
7
|
export function getWorldMatrix(node: SceneNode, graph: Pick<SceneGraph, 'getNode'>): Mat3 {
|
|
7
8
|
const chain: SceneNode[] = []
|
|
@@ -154,12 +155,18 @@ export function getAbsolutePositionFull(node: SceneNode, graph: SceneGraph) {
|
|
|
154
155
|
}
|
|
155
156
|
}
|
|
156
157
|
/** Lines retain their origin pivot; other shapes rotate around their center. */
|
|
157
|
-
export function getNodeRotationOrigin(node: SceneNode): Vector {
|
|
158
|
+
export function getNodeRotationOrigin(node: Pick<SceneNode, 'type' | 'width' | 'height'>): Vector {
|
|
158
159
|
return node.type === 'LINE' ? { x: 0, y: 0 } : { x: node.width / 2, y: node.height / 2 }
|
|
159
160
|
}
|
|
160
161
|
|
|
162
|
+
/** What places a layer in its parent: its position, size, reflection, turn, and pivot. */
|
|
163
|
+
export type NodePlacement = Pick<
|
|
164
|
+
SceneNode,
|
|
165
|
+
'type' | 'x' | 'y' | 'width' | 'height' | 'rotation' | 'flipX' | 'flipY'
|
|
166
|
+
>
|
|
167
|
+
|
|
161
168
|
/** Position can be applied separately by renderers before setting up local opacity layers. */
|
|
162
|
-
export function getNodeLocalMatrix(n:
|
|
169
|
+
export function getNodeLocalMatrix(n: NodePlacement, position: Vector = n) {
|
|
163
170
|
let matrix = Matrix.translated(position.x, position.y)
|
|
164
171
|
if (n.flipX || n.flipY) {
|
|
165
172
|
matrix = Matrix.multiply(
|
package/src/copy.ts
CHANGED
|
@@ -8,9 +8,13 @@
|
|
|
8
8
|
* no shared references between source and copy.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
import { geometryCommandCoordCount } from './geometry'
|
|
12
|
+
import { cloneInstanceOverrideState } from './instances/overrides'
|
|
13
|
+
import { createDefaultSourceMetadata } from './node-defaults'
|
|
11
14
|
import type {
|
|
12
15
|
ArcData,
|
|
13
16
|
ComponentPropertyDefinition,
|
|
17
|
+
ConnectorEndpoint,
|
|
14
18
|
Effect,
|
|
15
19
|
DerivedTextGlyph,
|
|
16
20
|
Fill,
|
|
@@ -19,12 +23,10 @@ import type {
|
|
|
19
23
|
LayoutGrid,
|
|
20
24
|
SceneNode,
|
|
21
25
|
Stroke,
|
|
22
|
-
StyleRun
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
import { createDefaultSourceMetadata } from './node-defaults'
|
|
27
|
-
import { cloneVectorNetwork } from './vector-network'
|
|
26
|
+
StyleRun,
|
|
27
|
+
VectorNetwork,
|
|
28
|
+
VectorRegion
|
|
29
|
+
} from './types'
|
|
28
30
|
|
|
29
31
|
// --- Individual copy functions ---
|
|
30
32
|
|
|
@@ -71,6 +73,8 @@ export function copyStyleRun(r: StyleRun): StyleRun {
|
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
if (r.style.hyperlink) copy.style.hyperlink = { ...r.style.hyperlink }
|
|
76
|
+
if (r.style.lineHeight) copy.style.lineHeight = { ...r.style.lineHeight }
|
|
77
|
+
if (r.style.letterSpacing) copy.style.letterSpacing = { ...r.style.letterSpacing }
|
|
74
78
|
if (r.style.boundVariables) copy.style.boundVariables = { ...r.style.boundVariables }
|
|
75
79
|
return copy
|
|
76
80
|
}
|
|
@@ -111,17 +115,32 @@ export function copyStyleRuns(runs: StyleRun[]): StyleRun[] {
|
|
|
111
115
|
return runs.map(copyStyleRun)
|
|
112
116
|
}
|
|
113
117
|
|
|
114
|
-
/**
|
|
115
|
-
function
|
|
118
|
+
/** A region, with new loops when given, keeping its own paints and fill style. */
|
|
119
|
+
export function copyVectorRegion(
|
|
120
|
+
region: VectorRegion,
|
|
121
|
+
loops = region.loops.map((loop) => [...loop])
|
|
122
|
+
): VectorRegion {
|
|
123
|
+
const copy: VectorRegion = { windingRule: region.windingRule, loops }
|
|
124
|
+
if (region.fills) copy.fills = copyFills(region.fills)
|
|
125
|
+
if (region.fillStyleId) copy.fillStyleId = region.fillStyleId
|
|
126
|
+
return copy
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Deep-copy a VectorNetwork, stripping any Vue Proxy wrappers. */
|
|
130
|
+
export function cloneVectorNetwork(vn: VectorNetwork): VectorNetwork {
|
|
116
131
|
return {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
132
|
+
vertices: vn.vertices.map((v) => ({ ...v })),
|
|
133
|
+
segments: vn.segments.map((s) => ({
|
|
134
|
+
...s,
|
|
135
|
+
tangentStart: { ...s.tangentStart },
|
|
136
|
+
tangentEnd: { ...s.tangentEnd }
|
|
137
|
+
})),
|
|
138
|
+
regions: vn.regions.map((r) => copyVectorRegion(r))
|
|
120
139
|
}
|
|
121
140
|
}
|
|
122
141
|
|
|
123
142
|
export function copyGeometryPaths(paths: GeometryPath[]): GeometryPath[] {
|
|
124
|
-
return paths.map((p) =>
|
|
143
|
+
return paths.map((p) => ({ windingRule: p.windingRule, commandsBlob: p.commandsBlob.slice() }))
|
|
125
144
|
}
|
|
126
145
|
|
|
127
146
|
/**
|
|
@@ -167,9 +186,10 @@ export function transformGeometryPaths(
|
|
|
167
186
|
tx = 0,
|
|
168
187
|
ty = 0
|
|
169
188
|
): GeometryPath[] {
|
|
170
|
-
return paths.map((g) =>
|
|
171
|
-
|
|
172
|
-
|
|
189
|
+
return paths.map((g) => ({
|
|
190
|
+
windingRule: g.windingRule,
|
|
191
|
+
commandsBlob: transformGeometryBlob(g.commandsBlob, m00, m01, m10, m11, tx, ty)
|
|
192
|
+
}))
|
|
173
193
|
}
|
|
174
194
|
|
|
175
195
|
/**
|
|
@@ -212,12 +232,22 @@ function copyPropertyDefs(
|
|
|
212
232
|
|
|
213
233
|
/** Deep-copy path-text glyphs (fresh commandsBlob buffers). */
|
|
214
234
|
export function copyDerivedGlyphs(glyphs: DerivedTextGlyph[] | null): DerivedTextGlyph[] | null {
|
|
215
|
-
return glyphs
|
|
235
|
+
return glyphs
|
|
236
|
+
? glyphs.map((g) => ({
|
|
237
|
+
...g,
|
|
238
|
+
commandsBlob: new Uint8Array(g.commandsBlob),
|
|
239
|
+
...(g.emojiCodePoints ? { emojiCodePoints: [...g.emojiCodePoints] } : {})
|
|
240
|
+
}))
|
|
241
|
+
: null
|
|
216
242
|
}
|
|
217
243
|
|
|
218
244
|
// --- Complex structure copy functions ---
|
|
219
245
|
// These replace structuredClone for known types, avoiding its ~24× overhead.
|
|
220
246
|
|
|
247
|
+
export function copyConnectorEndpoint(endpoint: ConnectorEndpoint): ConnectorEndpoint {
|
|
248
|
+
return { ...endpoint, position: { ...endpoint.position } }
|
|
249
|
+
}
|
|
250
|
+
|
|
221
251
|
function copyArcData(a: ArcData): ArcData {
|
|
222
252
|
return { startingAngle: a.startingAngle, endingAngle: a.endingAngle, innerRadius: a.innerRadius }
|
|
223
253
|
}
|
|
@@ -233,6 +263,14 @@ function copyArcData(a: ArcData): ArcData {
|
|
|
233
263
|
*/
|
|
234
264
|
export type NodeCloneMode = 'deep' | 'fig-import'
|
|
235
265
|
|
|
266
|
+
/** A text's line height and letter spacing, copied so a clone never shares them. */
|
|
267
|
+
function copyTextLengths(src: SceneNode): Pick<SceneNode, 'lineHeight' | 'letterSpacing'> {
|
|
268
|
+
return {
|
|
269
|
+
lineHeight: src.lineHeight && { ...src.lineHeight },
|
|
270
|
+
letterSpacing: { ...src.letterSpacing }
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
236
274
|
export function cloneNodeProps(
|
|
237
275
|
src: SceneNode,
|
|
238
276
|
componentId: string | null,
|
|
@@ -274,6 +312,7 @@ export function cloneNodeProps(
|
|
|
274
312
|
source: componentId === null ? structuredClone(src.source) : createDefaultSourceMetadata(),
|
|
275
313
|
dashPattern: copyOpt(src.dashPattern, (a) => [...a]),
|
|
276
314
|
fontVariations: copyOpt(src.fontVariations, (a) => a.map((v) => ({ ...v }))),
|
|
315
|
+
...copyTextLengths(src),
|
|
277
316
|
fontFeatures: copyOpt(src.fontFeatures, (a) => a.map((v) => ({ ...v }))),
|
|
278
317
|
textParagraphs: copyOpt(src.textParagraphs, (a) => a.map((v) => ({ ...v }))),
|
|
279
318
|
textDecorationFills: copyOpt(src.textDecorationFills, copyFills),
|
|
@@ -289,6 +328,8 @@ export function cloneNodeProps(
|
|
|
289
328
|
pluginData: copySpread(src.pluginData),
|
|
290
329
|
pluginRelaunchData: copySpread(src.pluginRelaunchData),
|
|
291
330
|
exportSettings: copySpread(src.exportSettings),
|
|
331
|
+
// Generated instance descendants have no status of their own.
|
|
332
|
+
status: componentId === null ? src.status : null,
|
|
292
333
|
componentPropertyValues: { ...src.componentPropertyValues },
|
|
293
334
|
derivedLayout: src.derivedLayout ? { ...src.derivedLayout } : null,
|
|
294
335
|
arcData: src.arcData ? copyArcData(src.arcData) : null,
|
|
@@ -300,6 +341,11 @@ export function cloneNodeProps(
|
|
|
300
341
|
textPathData: src.textPathData ? structuredClone(src.textPathData) : null,
|
|
301
342
|
textPathBox: src.textPathBox ? { ...src.textPathBox } : null,
|
|
302
343
|
gridPosition: src.gridPosition ? { ...src.gridPosition } : null,
|
|
303
|
-
targetAspectRatio: src.targetAspectRatio ? { ...src.targetAspectRatio } : null
|
|
344
|
+
targetAspectRatio: src.targetAspectRatio ? { ...src.targetAspectRatio } : null,
|
|
345
|
+
connectorStart: src.connectorStart ? copyConnectorEndpoint(src.connectorStart) : null,
|
|
346
|
+
connectorEnd: src.connectorEnd ? copyConnectorEndpoint(src.connectorEnd) : null,
|
|
347
|
+
connectorControlPoints: structuredClone(src.connectorControlPoints),
|
|
348
|
+
connectorCurveHandles: structuredClone(src.connectorCurveHandles),
|
|
349
|
+
connectorLabelPosition: src.connectorLabelPosition ? { ...src.connectorLabelPosition } : null
|
|
304
350
|
}
|
|
305
351
|
}
|
package/src/css/index.ts
CHANGED
package/src/css/text.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import valueParser from 'postcss-value-parser'
|
|
2
|
+
|
|
3
|
+
import { percentLength, pixelLength } from '../text/lengths'
|
|
4
|
+
import type { TextLength } from '../types'
|
|
5
|
+
import { parseCSSNumber } from './values'
|
|
6
|
+
|
|
7
|
+
/** A CSS escape: hex digits and one optional whitespace, an escaped line break, or any one character. */
|
|
8
|
+
const CSS_ESCAPE = /\\(?:([0-9a-fA-F]{1,6})(?:\r\n|[ \t\n\r\f])?|(?:\r\n|[\n\r\f])|([\s\S]))?/gu
|
|
9
|
+
|
|
10
|
+
/** The largest Unicode code point. */
|
|
11
|
+
const MAX_CODE_POINT = 0x10ffff
|
|
12
|
+
|
|
13
|
+
/** Text with its CSS escapes decoded; an escaped line break continues the line. */
|
|
14
|
+
function decodeCSSEscapes(text: string): string {
|
|
15
|
+
return text.replace(CSS_ESCAPE, (_escape, hex: string | undefined, char: string | undefined) => {
|
|
16
|
+
if (hex === undefined) return char ?? ''
|
|
17
|
+
const codePoint = Number.parseInt(hex, 16)
|
|
18
|
+
const surrogate = codePoint >= 0xd800 && codePoint <= 0xdfff
|
|
19
|
+
return codePoint === 0 || surrogate || codePoint > MAX_CODE_POINT
|
|
20
|
+
? '\uFFFD'
|
|
21
|
+
: String.fromCodePoint(codePoint)
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The index of the first unescaped `stop` character from `from`, or the text's length. */
|
|
26
|
+
function unescapedIndexOf(text: string, stop: string, from: number): number {
|
|
27
|
+
let index = from
|
|
28
|
+
while (index < text.length && text[index] !== stop) index += text[index] === '\\' ? 2 : 1
|
|
29
|
+
return index
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The first family of a CSS `font-family` list, without its quotes and escapes. A family is a quoted
|
|
34
|
+
* string or unquoted words, which join with single spaces; a quote opens a string only at the start
|
|
35
|
+
* of the family, so a name list such as draw.io's keeps `O'Reilly`. Null for an empty list.
|
|
36
|
+
*/
|
|
37
|
+
export function parseCSSFontFamily(value: string | undefined): string | null {
|
|
38
|
+
const text = value?.trimStart()
|
|
39
|
+
if (!text) return null
|
|
40
|
+
const quote = text[0]
|
|
41
|
+
if (quote === '"' || quote === "'") {
|
|
42
|
+
return decodeCSSEscapes(text.slice(1, unescapedIndexOf(text, quote, 1))) || null
|
|
43
|
+
}
|
|
44
|
+
const words = decodeCSSEscapes(text.slice(0, unescapedIndexOf(text, ',', 0)))
|
|
45
|
+
return words.trim().replace(/\s+/gu, ' ') || null
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** A CSS dimension's number and lowercase unit, or null. */
|
|
49
|
+
function dimension(value: string): { number: number; unit: string } | null {
|
|
50
|
+
const parsed = valueParser.unit(value)
|
|
51
|
+
if (!parsed) return null
|
|
52
|
+
const number = Number(parsed.number)
|
|
53
|
+
return Number.isFinite(number) ? { number, unit: parsed.unit.toLowerCase() } : null
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* A CSS `line-height` as a text length: a unitless multiple, `em`, or a percent follows the font size,
|
|
58
|
+
* as a percent does in Figma; pixels stay pixels; `normal` is automatic, a null. Undefined for a
|
|
59
|
+
* value it cannot read.
|
|
60
|
+
*/
|
|
61
|
+
export function parseCSSLineHeight(value: string | undefined): TextLength | null | undefined {
|
|
62
|
+
const trimmed = value?.trim()
|
|
63
|
+
if (!trimmed) return undefined
|
|
64
|
+
if (trimmed === 'normal') return null
|
|
65
|
+
const parsed = dimension(trimmed)
|
|
66
|
+
if (parsed?.unit === '' || parsed?.unit === 'em') return percentLength(parsed.number * 100)
|
|
67
|
+
if (parsed?.unit === '%') return percentLength(parsed.number)
|
|
68
|
+
const pixels = parseCSSNumber(trimmed)
|
|
69
|
+
return pixels === null ? undefined : pixelLength(pixels)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* A CSS `letter-spacing` as a text length: `em` is a percent of the font size, pixels stay pixels,
|
|
74
|
+
* and `normal` is none. Undefined for a value it cannot read.
|
|
75
|
+
*/
|
|
76
|
+
export function parseCSSLetterSpacing(value: string | undefined): TextLength | undefined {
|
|
77
|
+
const trimmed = value?.trim()
|
|
78
|
+
if (!trimmed) return undefined
|
|
79
|
+
if (trimmed === 'normal') return pixelLength(0)
|
|
80
|
+
const parsed = dimension(trimmed)
|
|
81
|
+
if (parsed?.unit === 'em') return percentLength(parsed.number * 100)
|
|
82
|
+
const pixels = parseCSSNumber(trimmed)
|
|
83
|
+
return pixels === null ? undefined : pixelLength(pixels)
|
|
84
|
+
}
|
package/src/export-format.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* export adapter that supports node export; labels and options come from that
|
|
4
4
|
* adapter, so this list only decides what the Export panel offers.
|
|
5
5
|
*/
|
|
6
|
-
export const EXPORT_FORMAT_IDS = ['png', 'jpg', 'webp', 'svg', 'pdf', 'pptx'] as const
|
|
6
|
+
export const EXPORT_FORMAT_IDS = ['png', 'jpg', 'webp', 'svg', 'pdf', 'pptx', 'drawio'] as const
|
|
7
7
|
|
|
8
8
|
export type ExportFormatId = (typeof EXPORT_FORMAT_IDS)[number]
|
|
9
9
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { SceneNode } from '../types'
|
|
2
|
+
|
|
3
|
+
/** What a layer is painted with, and how it blends. */
|
|
4
|
+
export const PAINT_FIELDS = [
|
|
5
|
+
'fills',
|
|
6
|
+
'strokes',
|
|
7
|
+
'effects',
|
|
8
|
+
'opacity',
|
|
9
|
+
'blendMode'
|
|
10
|
+
] as const satisfies readonly (keyof SceneNode)[]
|
|
11
|
+
|
|
12
|
+
/** How strokes are drawn, beside their paints. */
|
|
13
|
+
export const STROKE_FIELDS = [
|
|
14
|
+
'strokeWeight',
|
|
15
|
+
'strokeAlign',
|
|
16
|
+
'strokeCap',
|
|
17
|
+
'strokeJoin',
|
|
18
|
+
'strokeMiterLimit',
|
|
19
|
+
'dashPattern',
|
|
20
|
+
'independentStrokeWeights',
|
|
21
|
+
'borderTopWeight',
|
|
22
|
+
'borderRightWeight',
|
|
23
|
+
'borderBottomWeight',
|
|
24
|
+
'borderLeftWeight'
|
|
25
|
+
] as const satisfies readonly (keyof SceneNode)[]
|
|
26
|
+
|
|
27
|
+
export const CORNER_FIELDS = [
|
|
28
|
+
'cornerRadius',
|
|
29
|
+
'topLeftRadius',
|
|
30
|
+
'topRightRadius',
|
|
31
|
+
'bottomRightRadius',
|
|
32
|
+
'bottomLeftRadius',
|
|
33
|
+
'independentCorners',
|
|
34
|
+
'cornerSmoothing'
|
|
35
|
+
] as const satisfies readonly (keyof SceneNode)[]
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { SceneNode } from '../types'
|
|
2
|
+
import { SIZE_FIELDS, TRANSFORM_FIELDS } from './geometry'
|
|
3
|
+
|
|
4
|
+
/** How a frame lays out its children: auto layout and its grid tracks. */
|
|
5
|
+
export const AUTO_LAYOUT_FIELDS = [
|
|
6
|
+
'layoutMode',
|
|
7
|
+
'layoutDirection',
|
|
8
|
+
'layoutWrap',
|
|
9
|
+
'primaryAxisAlign',
|
|
10
|
+
'counterAxisAlign',
|
|
11
|
+
'counterAxisAlignContent',
|
|
12
|
+
'primaryAxisSizing',
|
|
13
|
+
'counterAxisSizing',
|
|
14
|
+
'itemSpacing',
|
|
15
|
+
'counterAxisSpacing',
|
|
16
|
+
'paddingTop',
|
|
17
|
+
'paddingRight',
|
|
18
|
+
'paddingBottom',
|
|
19
|
+
'paddingLeft',
|
|
20
|
+
'strokesIncludedInLayout',
|
|
21
|
+
'gridTemplateColumns',
|
|
22
|
+
'gridTemplateRows',
|
|
23
|
+
'gridColumnGap',
|
|
24
|
+
'gridRowGap'
|
|
25
|
+
] as const satisfies readonly (keyof SceneNode)[]
|
|
26
|
+
|
|
27
|
+
/** Size limits a layer keeps however it is resized. */
|
|
28
|
+
export const SIZE_CONSTRAINT_FIELDS = [
|
|
29
|
+
'minWidth',
|
|
30
|
+
'maxWidth',
|
|
31
|
+
'minHeight',
|
|
32
|
+
'maxHeight',
|
|
33
|
+
'targetAspectRatio'
|
|
34
|
+
] as const satisfies readonly (keyof SceneNode)[]
|
|
35
|
+
|
|
36
|
+
/** Fields whose change moves a layer or its children, so cached absolute positions go stale. */
|
|
37
|
+
export const LAYOUT_AFFECTING_KEYS: ReadonlySet<string> = new Set([
|
|
38
|
+
...TRANSFORM_FIELDS,
|
|
39
|
+
...SIZE_FIELDS,
|
|
40
|
+
...AUTO_LAYOUT_FIELDS,
|
|
41
|
+
'layoutPositioning',
|
|
42
|
+
'layoutGrow',
|
|
43
|
+
'layoutAlignSelf',
|
|
44
|
+
'horizontalConstraint',
|
|
45
|
+
'verticalConstraint',
|
|
46
|
+
'gridPosition',
|
|
47
|
+
...SIZE_CONSTRAINT_FIELDS
|
|
48
|
+
])
|
package/src/fields/text.ts
CHANGED
|
@@ -10,6 +10,7 @@ export const TEXT_METRIC_FIELDS = [
|
|
|
10
10
|
'letterSpacing',
|
|
11
11
|
'styleRuns',
|
|
12
12
|
'fontVariations',
|
|
13
|
+
'opticalSizeFromFontSize',
|
|
13
14
|
'fontFeatures',
|
|
14
15
|
'textParagraphs',
|
|
15
16
|
'listSpacing',
|
|
@@ -33,3 +34,31 @@ export const TEXT_LAYOUT_FIELDS = [
|
|
|
33
34
|
'textAutoResize',
|
|
34
35
|
'maxLines'
|
|
35
36
|
] as const satisfies readonly (keyof SceneNode)[]
|
|
37
|
+
|
|
38
|
+
export const TEXT_DECORATION_FIELDS = [
|
|
39
|
+
'textDecoration',
|
|
40
|
+
'textDecorationStyle',
|
|
41
|
+
'textDecorationThickness',
|
|
42
|
+
'textUnderlineOffset',
|
|
43
|
+
'textDecorationFills',
|
|
44
|
+
'textDecorationSkipInk'
|
|
45
|
+
] as const satisfies readonly (keyof SceneNode)[]
|
|
46
|
+
|
|
47
|
+
/** How text is styled, apart from its content and how its box sizes. */
|
|
48
|
+
export const TEXT_STYLE_FIELDS = [
|
|
49
|
+
'fontFamily',
|
|
50
|
+
'fontSize',
|
|
51
|
+
'fontWeight',
|
|
52
|
+
'italic',
|
|
53
|
+
'lineHeight',
|
|
54
|
+
'letterSpacing',
|
|
55
|
+
'paragraphSpacing',
|
|
56
|
+
'paragraphIndent',
|
|
57
|
+
'textAlignHorizontal',
|
|
58
|
+
'textAlignVertical',
|
|
59
|
+
'textCase',
|
|
60
|
+
...TEXT_DECORATION_FIELDS,
|
|
61
|
+
'fontFeatures',
|
|
62
|
+
'fontVariations',
|
|
63
|
+
'opticalSizeFromFontSize'
|
|
64
|
+
] as const satisfies readonly (keyof SceneNode)[]
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How tightly a document's `.fig` data is compressed when it is written: `fast` matches Figma's
|
|
3
|
+
* own saves, `smaller` and `smallest` trade save time for size. Figma opens all three.
|
|
4
|
+
*/
|
|
5
|
+
export const FIG_COMPRESSIONS = ['fast', 'smaller', 'smallest'] as const
|
|
6
|
+
|
|
7
|
+
export type FigCompression = (typeof FIG_COMPRESSIONS)[number]
|
|
8
|
+
|
|
9
|
+
export const DEFAULT_FIG_COMPRESSION: FigCompression = 'fast'
|