@pairdraw/scene-graph 0.0.0-stage → 0.16.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/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 +28 -0
- package/dist/checkpoint.d.ts.map +1 -0
- package/dist/checkpoint.js +246 -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 +364 -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 +325 -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,33 @@
|
|
|
1
|
+
import { effectiveStatus } from "./node.js";
|
|
2
|
+
import { findStatusState } from "./workflow.js";
|
|
3
|
+
import { groupBy } from "es-toolkit";
|
|
4
|
+
//#region src/statuses/impact.ts
|
|
5
|
+
/**
|
|
6
|
+
* What replacing the `current` workflow with `next` does to the layers that show a status, where
|
|
7
|
+
* `moves` sends the layers in a state `next` drops to another state or clears theirs with null.
|
|
8
|
+
* Renamed and moved states both read here as the name people will see change.
|
|
9
|
+
*/
|
|
10
|
+
function statusWorkflowImpact(graph, current, next, moves) {
|
|
11
|
+
const changes = [];
|
|
12
|
+
for (const node of graph.getAllNodes()) {
|
|
13
|
+
const id = effectiveStatus(graph, node);
|
|
14
|
+
if (id === null) continue;
|
|
15
|
+
const from = findStatusState(current, id)?.name;
|
|
16
|
+
if (from === void 0) continue;
|
|
17
|
+
const target = moves[id];
|
|
18
|
+
const to = target === null ? null : findStatusState(next, target ?? id)?.name ?? null;
|
|
19
|
+
if (to !== from) changes.push({
|
|
20
|
+
from,
|
|
21
|
+
to
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
const groups = groupBy(changes, (change) => `${change.from}\0${change.to ?? ""}`);
|
|
25
|
+
return Object.values(groups).map((group) => ({
|
|
26
|
+
...group[0],
|
|
27
|
+
count: group.length
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { statusWorkflowImpact };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=impact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impact.js","names":[],"sources":["../../src/statuses/impact.ts"],"sourcesContent":["import { groupBy } from 'es-toolkit'\n\nimport type { SceneGraph } from '../graph'\nimport { effectiveStatus } from './node'\nimport type { StatusWorkflow } from './schema'\nimport { findStatusState } from './workflow'\n\n/** A group of layers that would show another state, or none when `to` is null. */\nexport interface StatusWorkflowImpact {\n from: string\n to: string | null\n count: number\n}\n\n/**\n * What replacing the `current` workflow with `next` does to the layers that show a status, where\n * `moves` sends the layers in a state `next` drops to another state or clears theirs with null.\n * Renamed and moved states both read here as the name people will see change.\n */\nexport function statusWorkflowImpact(\n graph: SceneGraph,\n current: StatusWorkflow,\n next: StatusWorkflow,\n moves: Readonly<Partial<Record<string, string | null>>>\n): StatusWorkflowImpact[] {\n const changes: { from: string; to: string | null }[] = []\n for (const node of graph.getAllNodes()) {\n const id = effectiveStatus(graph, node)\n if (id === null) continue\n const from = findStatusState(current, id)?.name\n if (from === undefined) continue\n const target = moves[id]\n const to = target === null ? null : (findStatusState(next, target ?? id)?.name ?? null)\n if (to !== from) changes.push({ from, to })\n }\n const groups = groupBy(changes, (change) => `${change.from}\\0${change.to ?? ''}`)\n return Object.values(groups).map((group) => ({ ...group[0], count: group.length }))\n}\n"],"mappings":";;;;;;;;;AAmBA,SAAgB,qBACd,OACA,SACA,MACA,OACwB;CACxB,MAAM,UAAiD,CAAC;CACxD,KAAK,MAAM,QAAQ,MAAM,YAAY,GAAG;EACtC,MAAM,KAAK,gBAAgB,OAAO,IAAI;EACtC,IAAI,OAAO,MAAM;EACjB,MAAM,OAAO,gBAAgB,SAAS,EAAE,CAAC,EAAE;EAC3C,IAAI,SAAS,KAAA,GAAW;EACxB,MAAM,SAAS,MAAM;EACrB,MAAM,KAAK,WAAW,OAAO,OAAQ,gBAAgB,MAAM,UAAU,EAAE,CAAC,EAAE,QAAQ;EAClF,IAAI,OAAO,MAAM,QAAQ,KAAK;GAAE;GAAM;EAAG,CAAC;CAC5C;CACA,MAAM,SAAS,QAAQ,UAAU,WAAW,GAAG,OAAO,KAAK,IAAI,OAAO,MAAM,IAAI;CAChF,OAAO,OAAO,OAAO,MAAM,CAAC,CAAC,KAAK,WAAW;EAAE,GAAG,MAAM;EAAI,OAAO,MAAM;CAAO,EAAE;AACpF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FIGMA_DEV_STATUSES, FigmaDevStatus, StatusState, StatusWorkflow, nodeStatusSchema, statusWorkflowSchema } from "./schema.js";
|
|
2
|
+
import { StatusWorkflowImpact, statusWorkflowImpact } from "./impact.js";
|
|
3
|
+
import { STATUS_NODE_TYPES, StatusPlacement, effectiveStatus, statusPlacement } from "./node.js";
|
|
4
|
+
import { FIGMA_STATUS_STATE_IDS, STATUS_WORKFLOW_PRESETS, StatusWorkflowPreset, cachedStatusWorkflow, figmaDevStatusOf, findStatusState, readStatusWorkflow, shownStatusState, writeStatusWorkflow } from "./workflow.js";
|
|
5
|
+
export { FIGMA_DEV_STATUSES, FIGMA_STATUS_STATE_IDS, FigmaDevStatus, STATUS_NODE_TYPES, STATUS_WORKFLOW_PRESETS, StatusPlacement, StatusState, StatusWorkflow, StatusWorkflowImpact, StatusWorkflowPreset, cachedStatusWorkflow, effectiveStatus, figmaDevStatusOf, findStatusState, nodeStatusSchema, readStatusWorkflow, shownStatusState, statusPlacement, statusWorkflowImpact, statusWorkflowSchema, writeStatusWorkflow };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FIGMA_DEV_STATUSES, nodeStatusSchema, statusWorkflowSchema } from "./schema.js";
|
|
2
|
+
import { STATUS_NODE_TYPES, effectiveStatus, statusPlacement } from "./node.js";
|
|
3
|
+
import { FIGMA_STATUS_STATE_IDS, STATUS_WORKFLOW_PRESETS, cachedStatusWorkflow, figmaDevStatusOf, findStatusState, readStatusWorkflow, shownStatusState, writeStatusWorkflow } from "./workflow.js";
|
|
4
|
+
import { statusWorkflowImpact } from "./impact.js";
|
|
5
|
+
export { FIGMA_DEV_STATUSES, FIGMA_STATUS_STATE_IDS, STATUS_NODE_TYPES, STATUS_WORKFLOW_PRESETS, cachedStatusWorkflow, effectiveStatus, figmaDevStatusOf, findStatusState, nodeStatusSchema, readStatusWorkflow, shownStatusState, statusPlacement, statusWorkflowImpact, statusWorkflowSchema, writeStatusWorkflow };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SceneGraph } from "../graph.js";
|
|
2
|
+
import { NodeType, SceneNode } from "../types.js";
|
|
3
|
+
//#region src/statuses/node.d.ts
|
|
4
|
+
/** Layers Figma lets carry a status, `DevStatusMixin` in the Plugin API. */
|
|
5
|
+
declare const STATUS_NODE_TYPES: ReadonlySet<NodeType>;
|
|
6
|
+
/**
|
|
7
|
+
* Whether a layer can show a status where it is, and if not, why:
|
|
8
|
+
* - `type`: the kind of layer never has one;
|
|
9
|
+
* - `parent`: it is not directly on a page or in a section;
|
|
10
|
+
* - `ancestor`: a section around it shows a status of its own.
|
|
11
|
+
*/
|
|
12
|
+
type StatusPlacement = 'ok' | 'type' | 'parent' | 'ancestor';
|
|
13
|
+
declare function statusPlacement(graph: SceneGraph, node: SceneNode): StatusPlacement;
|
|
14
|
+
/**
|
|
15
|
+
* The state id a layer shows. As in Figma, a status stays stored while the layer sits where it
|
|
16
|
+
* cannot show one, inside a frame or in a section showing its own, and shows again once the
|
|
17
|
+
* layer is back on a page or in a plain section.
|
|
18
|
+
*/
|
|
19
|
+
declare function effectiveStatus(graph: SceneGraph, node: SceneNode): string | null;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { STATUS_NODE_TYPES, StatusPlacement, effectiveStatus, statusPlacement };
|
|
22
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","names":[],"sources":["../../src/statuses/node.ts"],"mappings":";;;;cAIa,mBAAmB,YAAY;;;;;;;KAgBhC;iBA2BI,gBAAgB,OAAO,YAAY,MAAM,YAAY;;;;;;iBAYrD,gBAAgB,OAAO,YAAY,MAAM"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//#region src/statuses/node.ts
|
|
2
|
+
/** Layers Figma lets carry a status, `DevStatusMixin` in the Plugin API. */
|
|
3
|
+
const STATUS_NODE_TYPES = /* @__PURE__ */ new Set([
|
|
4
|
+
"SECTION",
|
|
5
|
+
"FRAME",
|
|
6
|
+
"COMPONENT",
|
|
7
|
+
"COMPONENT_SET",
|
|
8
|
+
"INSTANCE"
|
|
9
|
+
]);
|
|
10
|
+
const STATUS_PARENT_TYPES = /* @__PURE__ */ new Set(["CANVAS", "SECTION"]);
|
|
11
|
+
function isPlacedForStatus(graph, node) {
|
|
12
|
+
const parent = node.parentId ? graph.getNode(node.parentId) : void 0;
|
|
13
|
+
return STATUS_NODE_TYPES.has(node.type) && parent !== void 0 && STATUS_PARENT_TYPES.has(parent.type);
|
|
14
|
+
}
|
|
15
|
+
/** The layer and its ancestors below the page, outermost first. */
|
|
16
|
+
function sectionChain(graph, node) {
|
|
17
|
+
const chain = [];
|
|
18
|
+
graph.closest(node.id, (current) => {
|
|
19
|
+
if (current.type === "CANVAS" || current.id === graph.rootId) return true;
|
|
20
|
+
chain.push(current);
|
|
21
|
+
return false;
|
|
22
|
+
});
|
|
23
|
+
return chain.reverse();
|
|
24
|
+
}
|
|
25
|
+
/** The outermost layer from `node` up whose status shows; it hides every status inside it. */
|
|
26
|
+
function showingStatusOwner(graph, node) {
|
|
27
|
+
return sectionChain(graph, node).find((current) => current.status !== null && isPlacedForStatus(graph, current));
|
|
28
|
+
}
|
|
29
|
+
function statusPlacement(graph, node) {
|
|
30
|
+
if (!STATUS_NODE_TYPES.has(node.type)) return "type";
|
|
31
|
+
if (!isPlacedForStatus(graph, node)) return "parent";
|
|
32
|
+
const owner = showingStatusOwner(graph, node);
|
|
33
|
+
return owner && owner.id !== node.id ? "ancestor" : "ok";
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The state id a layer shows. As in Figma, a status stays stored while the layer sits where it
|
|
37
|
+
* cannot show one, inside a frame or in a section showing its own, and shows again once the
|
|
38
|
+
* layer is back on a page or in a plain section.
|
|
39
|
+
*/
|
|
40
|
+
function effectiveStatus(graph, node) {
|
|
41
|
+
if (!node.status) return null;
|
|
42
|
+
return showingStatusOwner(graph, node)?.id === node.id ? node.status : null;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { STATUS_NODE_TYPES, effectiveStatus, statusPlacement };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","names":[],"sources":["../../src/statuses/node.ts"],"sourcesContent":["import type { SceneGraph } from '../graph'\nimport type { NodeType, SceneNode } from '../types'\n\n/** Layers Figma lets carry a status, `DevStatusMixin` in the Plugin API. */\nexport const STATUS_NODE_TYPES: ReadonlySet<NodeType> = new Set<NodeType>([\n 'SECTION',\n 'FRAME',\n 'COMPONENT',\n 'COMPONENT_SET',\n 'INSTANCE'\n])\n\nconst STATUS_PARENT_TYPES: ReadonlySet<NodeType> = new Set<NodeType>(['CANVAS', 'SECTION'])\n\n/**\n * Whether a layer can show a status where it is, and if not, why:\n * - `type`: the kind of layer never has one;\n * - `parent`: it is not directly on a page or in a section;\n * - `ancestor`: a section around it shows a status of its own.\n */\nexport type StatusPlacement = 'ok' | 'type' | 'parent' | 'ancestor'\n\nfunction isPlacedForStatus(graph: SceneGraph, node: SceneNode): boolean {\n const parent = node.parentId ? graph.getNode(node.parentId) : undefined\n return (\n STATUS_NODE_TYPES.has(node.type) && parent !== undefined && STATUS_PARENT_TYPES.has(parent.type)\n )\n}\n\n/** The layer and its ancestors below the page, outermost first. */\nfunction sectionChain(graph: SceneGraph, node: SceneNode): SceneNode[] {\n const chain: SceneNode[] = []\n graph.closest(node.id, (current) => {\n if (current.type === 'CANVAS' || current.id === graph.rootId) return true\n chain.push(current)\n return false\n })\n return chain.reverse()\n}\n\n/** The outermost layer from `node` up whose status shows; it hides every status inside it. */\nfunction showingStatusOwner(graph: SceneGraph, node: SceneNode): SceneNode | undefined {\n return sectionChain(graph, node).find(\n (current) => current.status !== null && isPlacedForStatus(graph, current)\n )\n}\n\nexport function statusPlacement(graph: SceneGraph, node: SceneNode): StatusPlacement {\n if (!STATUS_NODE_TYPES.has(node.type)) return 'type'\n if (!isPlacedForStatus(graph, node)) return 'parent'\n const owner = showingStatusOwner(graph, node)\n return owner && owner.id !== node.id ? 'ancestor' : 'ok'\n}\n\n/**\n * The state id a layer shows. As in Figma, a status stays stored while the layer sits where it\n * cannot show one, inside a frame or in a section showing its own, and shows again once the\n * layer is back on a page or in a plain section.\n */\nexport function effectiveStatus(graph: SceneGraph, node: SceneNode): string | null {\n if (!node.status) return null\n return showingStatusOwner(graph, node)?.id === node.id ? node.status : null\n}\n"],"mappings":";;AAIA,MAAa,oCAA2C,IAAI,IAAc;CACxE;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAM,sCAA6C,IAAI,IAAc,CAAC,UAAU,SAAS,CAAC;AAU1F,SAAS,kBAAkB,OAAmB,MAA0B;CACtE,MAAM,SAAS,KAAK,WAAW,MAAM,QAAQ,KAAK,QAAQ,IAAI,KAAA;CAC9D,OACE,kBAAkB,IAAI,KAAK,IAAI,KAAK,WAAW,KAAA,KAAa,oBAAoB,IAAI,OAAO,IAAI;AAEnG;;AAGA,SAAS,aAAa,OAAmB,MAA8B;CACrE,MAAM,QAAqB,CAAC;CAC5B,MAAM,QAAQ,KAAK,KAAK,YAAY;EAClC,IAAI,QAAQ,SAAS,YAAY,QAAQ,OAAO,MAAM,QAAQ,OAAO;EACrE,MAAM,KAAK,OAAO;EAClB,OAAO;CACT,CAAC;CACD,OAAO,MAAM,QAAQ;AACvB;;AAGA,SAAS,mBAAmB,OAAmB,MAAwC;CACrF,OAAO,aAAa,OAAO,IAAI,CAAC,CAAC,MAC9B,YAAY,QAAQ,WAAW,QAAQ,kBAAkB,OAAO,OAAO,CAC1E;AACF;AAEA,SAAgB,gBAAgB,OAAmB,MAAkC;CACnF,IAAI,CAAC,kBAAkB,IAAI,KAAK,IAAI,GAAG,OAAO;CAC9C,IAAI,CAAC,kBAAkB,OAAO,IAAI,GAAG,OAAO;CAC5C,MAAM,QAAQ,mBAAmB,OAAO,IAAI;CAC5C,OAAO,SAAS,MAAM,OAAO,KAAK,KAAK,aAAa;AACtD;;;;;;AAOA,SAAgB,gBAAgB,OAAmB,MAAgC;CACjF,IAAI,CAAC,KAAK,QAAQ,OAAO;CACzB,OAAO,mBAAmB,OAAO,IAAI,CAAC,EAAE,OAAO,KAAK,KAAK,KAAK,SAAS;AACzE"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
//#region src/statuses/schema.d.ts
|
|
3
|
+
/** Figma's own statuses, `DevStatus['type']` in the Plugin API. */
|
|
4
|
+
declare const FIGMA_DEV_STATUSES: readonly ["READY_FOR_DEV", "COMPLETED"];
|
|
5
|
+
type FigmaDevStatus = (typeof FIGMA_DEV_STATUSES)[number];
|
|
6
|
+
declare const statusStateSchema: v.ObjectSchema<{
|
|
7
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
|
|
8
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, 100, undefined>]>;
|
|
9
|
+
readonly color: v.ObjectSchema<{
|
|
10
|
+
readonly r: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
11
|
+
readonly g: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
12
|
+
readonly b: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
13
|
+
readonly a: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
14
|
+
}, undefined>;
|
|
15
|
+
}, undefined>;
|
|
16
|
+
/** One status a document's layers can be in. */
|
|
17
|
+
type StatusState = v.InferOutput<typeof statusStateSchema>;
|
|
18
|
+
/** A document's statuses, in the order menus list them. */
|
|
19
|
+
declare const statusWorkflowSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
20
|
+
/** The preset the states started from, so the editor can name it while they still match. */
|
|
21
|
+
readonly preset: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
22
|
+
readonly states: v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
|
|
23
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
|
|
24
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, 100, undefined>]>;
|
|
25
|
+
readonly color: v.ObjectSchema<{
|
|
26
|
+
readonly r: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
27
|
+
readonly g: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
28
|
+
readonly b: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
29
|
+
readonly a: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
30
|
+
}, undefined>;
|
|
31
|
+
}, undefined>, undefined>, v.MinLengthAction<{
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
color: {
|
|
35
|
+
r: number;
|
|
36
|
+
g: number;
|
|
37
|
+
b: number;
|
|
38
|
+
a: number;
|
|
39
|
+
};
|
|
40
|
+
}[], 1, undefined>]>;
|
|
41
|
+
}, undefined>, v.CheckAction<{
|
|
42
|
+
preset?: string | undefined;
|
|
43
|
+
states: {
|
|
44
|
+
id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
color: {
|
|
47
|
+
r: number;
|
|
48
|
+
g: number;
|
|
49
|
+
b: number;
|
|
50
|
+
a: number;
|
|
51
|
+
};
|
|
52
|
+
}[];
|
|
53
|
+
}, "Status ids must be unique">]>;
|
|
54
|
+
type StatusWorkflow = v.InferOutput<typeof statusWorkflowSchema>;
|
|
55
|
+
/** A layer's status: the id of a state in the document's workflow. */
|
|
56
|
+
declare const nodeStatusSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
|
|
57
|
+
//#endregion
|
|
58
|
+
export { FIGMA_DEV_STATUSES, FigmaDevStatus, StatusState, StatusWorkflow, nodeStatusSchema, statusWorkflowSchema };
|
|
59
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","names":[],"sources":["../../src/statuses/schema.ts"],"mappings":";;;cAGa;KACD,yBAAyB;cAS/B,mBAAiB,EAAA;;;;;;;;;;;KAOX,cAAc,EAAE,mBAAmB;;cAGlC,sBAAoB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAYrB,iBAAiB,EAAE,mBAAmB;;cAGrC,kBAAgB,EAAA,yBAAA,EAAA,yBAAA,EAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
//#region src/statuses/schema.ts
|
|
3
|
+
/** Figma's own statuses, `DevStatus['type']` in the Plugin API. */
|
|
4
|
+
const FIGMA_DEV_STATUSES = ["READY_FOR_DEV", "COMPLETED"];
|
|
5
|
+
const colorSchema = v.object({
|
|
6
|
+
r: v.pipe(v.number(), v.minValue(0), v.maxValue(1)),
|
|
7
|
+
g: v.pipe(v.number(), v.minValue(0), v.maxValue(1)),
|
|
8
|
+
b: v.pipe(v.number(), v.minValue(0), v.maxValue(1)),
|
|
9
|
+
a: v.pipe(v.number(), v.minValue(0), v.maxValue(1))
|
|
10
|
+
});
|
|
11
|
+
const statusStateSchema = v.object({
|
|
12
|
+
id: v.pipe(v.string(), v.nonEmpty()),
|
|
13
|
+
name: v.pipe(v.string(), v.trim(), v.nonEmpty(), v.maxLength(100)),
|
|
14
|
+
color: colorSchema
|
|
15
|
+
});
|
|
16
|
+
/** A document's statuses, in the order menus list them. */
|
|
17
|
+
const statusWorkflowSchema = v.pipe(v.object({
|
|
18
|
+
/** The preset the states started from, so the editor can name it while they still match. */
|
|
19
|
+
preset: v.optional(v.string()),
|
|
20
|
+
states: v.pipe(v.array(statusStateSchema), v.minLength(1))
|
|
21
|
+
}), v.check(({ states }) => new Set(states.map((state) => state.id)).size === states.length, "Status ids must be unique"));
|
|
22
|
+
/** A layer's status: the id of a state in the document's workflow. */
|
|
23
|
+
const nodeStatusSchema = v.pipe(v.string(), v.nonEmpty());
|
|
24
|
+
//#endregion
|
|
25
|
+
export { FIGMA_DEV_STATUSES, nodeStatusSchema, statusWorkflowSchema };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","names":[],"sources":["../../src/statuses/schema.ts"],"sourcesContent":["import * as v from 'valibot'\n\n/** Figma's own statuses, `DevStatus['type']` in the Plugin API. */\nexport const FIGMA_DEV_STATUSES = ['READY_FOR_DEV', 'COMPLETED'] as const\nexport type FigmaDevStatus = (typeof FIGMA_DEV_STATUSES)[number]\n\nconst colorSchema = v.object({\n r: v.pipe(v.number(), v.minValue(0), v.maxValue(1)),\n g: v.pipe(v.number(), v.minValue(0), v.maxValue(1)),\n b: v.pipe(v.number(), v.minValue(0), v.maxValue(1)),\n a: v.pipe(v.number(), v.minValue(0), v.maxValue(1))\n})\n\nconst statusStateSchema = v.object({\n id: v.pipe(v.string(), v.nonEmpty()),\n name: v.pipe(v.string(), v.trim(), v.nonEmpty(), v.maxLength(100)),\n color: colorSchema\n})\n\n/** One status a document's layers can be in. */\nexport type StatusState = v.InferOutput<typeof statusStateSchema>\n\n/** A document's statuses, in the order menus list them. */\nexport const statusWorkflowSchema = v.pipe(\n v.object({\n /** The preset the states started from, so the editor can name it while they still match. */\n preset: v.optional(v.string()),\n states: v.pipe(v.array(statusStateSchema), v.minLength(1))\n }),\n v.check(\n ({ states }) => new Set(states.map((state) => state.id)).size === states.length,\n 'Status ids must be unique'\n )\n)\n\nexport type StatusWorkflow = v.InferOutput<typeof statusWorkflowSchema>\n\n/** A layer's status: the id of a state in the document's workflow. */\nexport const nodeStatusSchema = v.pipe(v.string(), v.nonEmpty())\n"],"mappings":";;;AAGA,MAAa,qBAAqB,CAAC,iBAAiB,WAAW;AAG/D,MAAM,cAAc,EAAE,OAAO;CAC3B,GAAG,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;CAClD,GAAG,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;CAClD,GAAG,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;CAClD,GAAG,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,oBAAoB,EAAE,OAAO;CACjC,IAAI,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,SAAS,CAAC;CACnC,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,SAAS,GAAG,EAAE,UAAU,GAAG,CAAC;CACjE,OAAO;AACT,CAAC;;AAMD,MAAa,uBAAuB,EAAE,KACpC,EAAE,OAAO;;CAEP,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC;CAC7B,QAAQ,EAAE,KAAK,EAAE,MAAM,iBAAiB,GAAG,EAAE,UAAU,CAAC,CAAC;AAC3D,CAAC,GACD,EAAE,OACC,EAAE,aAAa,IAAI,IAAI,OAAO,KAAK,UAAU,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,OAAO,QACzE,2BACF,CACF;;AAKA,MAAa,mBAAmB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,SAAS,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Color } from "../primitives/index.js";
|
|
2
|
+
import { SceneGraph } from "../graph.js";
|
|
3
|
+
import { SceneNode } from "../types.js";
|
|
4
|
+
import { FigmaDevStatus, StatusState, StatusWorkflow } from "./schema.js";
|
|
5
|
+
//#region src/statuses/workflow.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* The states Figma shows, by fixed id. Teams rename them as they like, but a `.fig` file's
|
|
8
|
+
* Ready for dev and Completed always read back as these, without the document's workflow.
|
|
9
|
+
*/
|
|
10
|
+
declare const FIGMA_STATUS_STATE_IDS: {
|
|
11
|
+
readonly READY_FOR_DEV: "ready-for-dev";
|
|
12
|
+
readonly COMPLETED: "completed";
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Workflows to start from. Their states keep fixed ids, so a document using a preset, or no
|
|
16
|
+
* workflow of its own, reads the same states back.
|
|
17
|
+
*/
|
|
18
|
+
declare const STATUS_WORKFLOW_PRESETS: {
|
|
19
|
+
readonly handoff: {
|
|
20
|
+
readonly preset: "handoff";
|
|
21
|
+
readonly states: [{
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
color: {
|
|
25
|
+
r: number;
|
|
26
|
+
g: number;
|
|
27
|
+
b: number;
|
|
28
|
+
a: number;
|
|
29
|
+
};
|
|
30
|
+
}, {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
color: {
|
|
34
|
+
r: number;
|
|
35
|
+
g: number;
|
|
36
|
+
b: number;
|
|
37
|
+
a: number;
|
|
38
|
+
};
|
|
39
|
+
}];
|
|
40
|
+
};
|
|
41
|
+
readonly simple: {
|
|
42
|
+
readonly preset: "simple";
|
|
43
|
+
readonly states: [{
|
|
44
|
+
readonly id: "draft";
|
|
45
|
+
readonly name: "Draft";
|
|
46
|
+
readonly color: Color;
|
|
47
|
+
}, {
|
|
48
|
+
readonly id: "in-progress";
|
|
49
|
+
readonly name: "In progress";
|
|
50
|
+
readonly color: Color;
|
|
51
|
+
}, {
|
|
52
|
+
readonly name: "Done";
|
|
53
|
+
readonly color: Color;
|
|
54
|
+
readonly id: string;
|
|
55
|
+
}];
|
|
56
|
+
};
|
|
57
|
+
readonly review: {
|
|
58
|
+
readonly preset: "review";
|
|
59
|
+
readonly states: [{
|
|
60
|
+
readonly id: "draft";
|
|
61
|
+
readonly name: "Draft";
|
|
62
|
+
readonly color: Color;
|
|
63
|
+
}, {
|
|
64
|
+
readonly id: "in-review";
|
|
65
|
+
readonly name: "In review";
|
|
66
|
+
readonly color: Color;
|
|
67
|
+
}, {
|
|
68
|
+
readonly id: "changes-requested";
|
|
69
|
+
readonly name: "Changes requested";
|
|
70
|
+
readonly color: Color;
|
|
71
|
+
}, {
|
|
72
|
+
readonly id: "approved";
|
|
73
|
+
readonly name: "Approved";
|
|
74
|
+
readonly color: Color;
|
|
75
|
+
}, {
|
|
76
|
+
id: string;
|
|
77
|
+
name: string;
|
|
78
|
+
color: {
|
|
79
|
+
r: number;
|
|
80
|
+
g: number;
|
|
81
|
+
b: number;
|
|
82
|
+
a: number;
|
|
83
|
+
};
|
|
84
|
+
}, {
|
|
85
|
+
readonly name: "Shipped";
|
|
86
|
+
readonly id: string;
|
|
87
|
+
readonly color: {
|
|
88
|
+
r: number;
|
|
89
|
+
g: number;
|
|
90
|
+
b: number;
|
|
91
|
+
a: number;
|
|
92
|
+
};
|
|
93
|
+
}];
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
type StatusWorkflowPreset = keyof typeof STATUS_WORKFLOW_PRESETS;
|
|
97
|
+
/**
|
|
98
|
+
* The document's statuses. A document that never chose any has Figma's own, so a `.fig` file's
|
|
99
|
+
* Ready for dev and Completed read as statuses without setup.
|
|
100
|
+
*/
|
|
101
|
+
declare function readStatusWorkflow(graph: SceneGraph): StatusWorkflow;
|
|
102
|
+
/** Stores the workflow on the document node, as an undoable document change. */
|
|
103
|
+
declare function writeStatusWorkflow(graph: SceneGraph, workflow: StatusWorkflow): void;
|
|
104
|
+
/**
|
|
105
|
+
* The state `stateId` names: the workflow's own, or Figma's when the workflow has no such state,
|
|
106
|
+
* as a `.fig` file's Ready for dev reads in a document whose team removed it.
|
|
107
|
+
*/
|
|
108
|
+
declare function findStatusState(workflow: StatusWorkflow, stateId: string): StatusState | undefined;
|
|
109
|
+
/** The Figma status a state shows as in Figma and the Plugin API's `devStatus`, if any. */
|
|
110
|
+
declare function figmaDevStatusOf(stateId: string): FigmaDevStatus | null;
|
|
111
|
+
/**
|
|
112
|
+
* The document's statuses, read once per change to the document node: canvas labels ask for
|
|
113
|
+
* them on every frame.
|
|
114
|
+
*/
|
|
115
|
+
declare function cachedStatusWorkflow(graph: SceneGraph): StatusWorkflow;
|
|
116
|
+
/** The state a layer shows, if any. */
|
|
117
|
+
declare function shownStatusState(graph: SceneGraph, node: SceneNode): StatusState | null;
|
|
118
|
+
//#endregion
|
|
119
|
+
export { FIGMA_STATUS_STATE_IDS, STATUS_WORKFLOW_PRESETS, StatusWorkflowPreset, cachedStatusWorkflow, figmaDevStatusOf, findStatusState, readStatusWorkflow, shownStatusState, writeStatusWorkflow };
|
|
120
|
+
//# sourceMappingURL=workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.d.ts","names":[],"sources":["../../src/statuses/workflow.ts"],"mappings":";;;;;;;;;cAca;WAAA;WAAA;;;;;;cAqBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuBD,oCAAoC;;;;;iBAMhC,mBAAmB,OAAO,aAAa;;iBAQvC,oBAAoB,OAAO,YAAY,UAAU;;;;;iBAYjD,gBACd,UAAU,gBACV,kBACC;;iBAQa,iBAAiB,kBAAkB;;;;;iBAYnC,qBAAqB,OAAO,aAAa;;iBAUzC,iBAAiB,OAAO,YAAY,MAAM,YAAY"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { readPluginData, withPluginData } from "../plugin-data/field.js";
|
|
2
|
+
import { PAIRDRAW_PLUGIN_DATA } from "../plugin-data/fields.js";
|
|
3
|
+
import { parseColor } from "../color/index.js";
|
|
4
|
+
import { effectiveStatus } from "./node.js";
|
|
5
|
+
//#region src/statuses/workflow.ts
|
|
6
|
+
const { statuses } = PAIRDRAW_PLUGIN_DATA;
|
|
7
|
+
/**
|
|
8
|
+
* The states Figma shows, by fixed id. Teams rename them as they like, but a `.fig` file's
|
|
9
|
+
* Ready for dev and Completed always read back as these, without the document's workflow.
|
|
10
|
+
*/
|
|
11
|
+
const FIGMA_STATUS_STATE_IDS = {
|
|
12
|
+
READY_FOR_DEV: "ready-for-dev",
|
|
13
|
+
COMPLETED: "completed"
|
|
14
|
+
};
|
|
15
|
+
const READY_FOR_DEV = {
|
|
16
|
+
id: FIGMA_STATUS_STATE_IDS.READY_FOR_DEV,
|
|
17
|
+
name: "Ready for dev",
|
|
18
|
+
color: parseColor("#14ae5c")
|
|
19
|
+
};
|
|
20
|
+
const COMPLETED = {
|
|
21
|
+
id: FIGMA_STATUS_STATE_IDS.COMPLETED,
|
|
22
|
+
name: "Completed",
|
|
23
|
+
color: parseColor("#8a8a8a")
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Workflows to start from. Their states keep fixed ids, so a document using a preset, or no
|
|
27
|
+
* workflow of its own, reads the same states back.
|
|
28
|
+
*/
|
|
29
|
+
const STATUS_WORKFLOW_PRESETS = {
|
|
30
|
+
handoff: {
|
|
31
|
+
preset: "handoff",
|
|
32
|
+
states: [READY_FOR_DEV, COMPLETED]
|
|
33
|
+
},
|
|
34
|
+
simple: {
|
|
35
|
+
preset: "simple",
|
|
36
|
+
states: [
|
|
37
|
+
{
|
|
38
|
+
id: "draft",
|
|
39
|
+
name: "Draft",
|
|
40
|
+
color: parseColor("#b3b3b3")
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: "in-progress",
|
|
44
|
+
name: "In progress",
|
|
45
|
+
color: parseColor("#0d99ff")
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
...COMPLETED,
|
|
49
|
+
name: "Done",
|
|
50
|
+
color: parseColor("#14ae5c")
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
review: {
|
|
55
|
+
preset: "review",
|
|
56
|
+
states: [
|
|
57
|
+
{
|
|
58
|
+
id: "draft",
|
|
59
|
+
name: "Draft",
|
|
60
|
+
color: parseColor("#b3b3b3")
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: "in-review",
|
|
64
|
+
name: "In review",
|
|
65
|
+
color: parseColor("#9747ff")
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: "changes-requested",
|
|
69
|
+
name: "Changes requested",
|
|
70
|
+
color: parseColor("#f24822")
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: "approved",
|
|
74
|
+
name: "Approved",
|
|
75
|
+
color: parseColor("#0d99ff")
|
|
76
|
+
},
|
|
77
|
+
READY_FOR_DEV,
|
|
78
|
+
{
|
|
79
|
+
...COMPLETED,
|
|
80
|
+
name: "Shipped"
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* The document's statuses. A document that never chose any has Figma's own, so a `.fig` file's
|
|
87
|
+
* Ready for dev and Completed read as statuses without setup.
|
|
88
|
+
*/
|
|
89
|
+
function readStatusWorkflow(graph) {
|
|
90
|
+
return readPluginData(graph.getNode(graph.rootId)?.pluginData, statuses) ?? STATUS_WORKFLOW_PRESETS.handoff;
|
|
91
|
+
}
|
|
92
|
+
/** Stores the workflow on the document node, as an undoable document change. */
|
|
93
|
+
function writeStatusWorkflow(graph, workflow) {
|
|
94
|
+
const root = graph.getNode(graph.rootId);
|
|
95
|
+
if (!root) return;
|
|
96
|
+
graph.updateNode(root.id, { pluginData: withPluginData(root.pluginData, statuses, structuredClone(workflow)) });
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The state `stateId` names: the workflow's own, or Figma's when the workflow has no such state,
|
|
100
|
+
* as a `.fig` file's Ready for dev reads in a document whose team removed it.
|
|
101
|
+
*/
|
|
102
|
+
function findStatusState(workflow, stateId) {
|
|
103
|
+
return workflow.states.find((state) => state.id === stateId) ?? STATUS_WORKFLOW_PRESETS.handoff.states.find((state) => state.id === stateId);
|
|
104
|
+
}
|
|
105
|
+
/** The Figma status a state shows as in Figma and the Plugin API's `devStatus`, if any. */
|
|
106
|
+
function figmaDevStatusOf(stateId) {
|
|
107
|
+
if (stateId === FIGMA_STATUS_STATE_IDS.READY_FOR_DEV) return "READY_FOR_DEV";
|
|
108
|
+
if (stateId === FIGMA_STATUS_STATE_IDS.COMPLETED) return "COMPLETED";
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
const WORKFLOWS = /* @__PURE__ */ new WeakMap();
|
|
112
|
+
/**
|
|
113
|
+
* The document's statuses, read once per change to the document node: canvas labels ask for
|
|
114
|
+
* them on every frame.
|
|
115
|
+
*/
|
|
116
|
+
function cachedStatusWorkflow(graph) {
|
|
117
|
+
const entries = graph.getNode(graph.rootId)?.pluginData;
|
|
118
|
+
const known = WORKFLOWS.get(graph);
|
|
119
|
+
if (known && known.entries === entries) return known.workflow;
|
|
120
|
+
const workflow = readStatusWorkflow(graph);
|
|
121
|
+
WORKFLOWS.set(graph, {
|
|
122
|
+
entries,
|
|
123
|
+
workflow
|
|
124
|
+
});
|
|
125
|
+
return workflow;
|
|
126
|
+
}
|
|
127
|
+
/** The state a layer shows, if any. */
|
|
128
|
+
function shownStatusState(graph, node) {
|
|
129
|
+
const id = effectiveStatus(graph, node);
|
|
130
|
+
return id === null ? null : findStatusState(cachedStatusWorkflow(graph), id) ?? null;
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
133
|
+
export { FIGMA_STATUS_STATE_IDS, STATUS_WORKFLOW_PRESETS, cachedStatusWorkflow, figmaDevStatusOf, findStatusState, readStatusWorkflow, shownStatusState, writeStatusWorkflow };
|
|
134
|
+
|
|
135
|
+
//# sourceMappingURL=workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.js","names":[],"sources":["../../src/statuses/workflow.ts"],"sourcesContent":["import { parseColor } from '../color'\nimport type { SceneGraph } from '../graph'\nimport { readPluginData, withPluginData } from '../plugin-data/field'\nimport { PAIRDRAW_PLUGIN_DATA } from '../plugin-data/fields'\nimport type { SceneNode } from '../types'\nimport { effectiveStatus } from './node'\nimport type { FigmaDevStatus, StatusState, StatusWorkflow } from './schema'\n\nconst { statuses } = PAIRDRAW_PLUGIN_DATA\n\n/**\n * The states Figma shows, by fixed id. Teams rename them as they like, but a `.fig` file's\n * Ready for dev and Completed always read back as these, without the document's workflow.\n */\nexport const FIGMA_STATUS_STATE_IDS = {\n READY_FOR_DEV: 'ready-for-dev',\n COMPLETED: 'completed'\n} as const satisfies Record<FigmaDevStatus, string>\n\nconst READY_FOR_DEV: StatusState = {\n id: FIGMA_STATUS_STATE_IDS.READY_FOR_DEV,\n name: 'Ready for dev',\n color: parseColor('#14ae5c')\n}\n\nconst COMPLETED: StatusState = {\n id: FIGMA_STATUS_STATE_IDS.COMPLETED,\n name: 'Completed',\n color: parseColor('#8a8a8a')\n}\n\n/**\n * Workflows to start from. Their states keep fixed ids, so a document using a preset, or no\n * workflow of its own, reads the same states back.\n */\nexport const STATUS_WORKFLOW_PRESETS = {\n handoff: { preset: 'handoff', states: [READY_FOR_DEV, COMPLETED] },\n simple: {\n preset: 'simple',\n states: [\n { id: 'draft', name: 'Draft', color: parseColor('#b3b3b3') },\n { id: 'in-progress', name: 'In progress', color: parseColor('#0d99ff') },\n { ...COMPLETED, name: 'Done', color: parseColor('#14ae5c') }\n ]\n },\n review: {\n preset: 'review',\n states: [\n { id: 'draft', name: 'Draft', color: parseColor('#b3b3b3') },\n { id: 'in-review', name: 'In review', color: parseColor('#9747ff') },\n { id: 'changes-requested', name: 'Changes requested', color: parseColor('#f24822') },\n { id: 'approved', name: 'Approved', color: parseColor('#0d99ff') },\n READY_FOR_DEV,\n { ...COMPLETED, name: 'Shipped' }\n ]\n }\n} as const satisfies Record<string, StatusWorkflow>\n\nexport type StatusWorkflowPreset = keyof typeof STATUS_WORKFLOW_PRESETS\n\n/**\n * The document's statuses. A document that never chose any has Figma's own, so a `.fig` file's\n * Ready for dev and Completed read as statuses without setup.\n */\nexport function readStatusWorkflow(graph: SceneGraph): StatusWorkflow {\n return (\n readPluginData(graph.getNode(graph.rootId)?.pluginData, statuses) ??\n STATUS_WORKFLOW_PRESETS.handoff\n )\n}\n\n/** Stores the workflow on the document node, as an undoable document change. */\nexport function writeStatusWorkflow(graph: SceneGraph, workflow: StatusWorkflow): void {\n const root = graph.getNode(graph.rootId)\n if (!root) return\n graph.updateNode(root.id, {\n pluginData: withPluginData(root.pluginData, statuses, structuredClone(workflow))\n })\n}\n\n/**\n * The state `stateId` names: the workflow's own, or Figma's when the workflow has no such state,\n * as a `.fig` file's Ready for dev reads in a document whose team removed it.\n */\nexport function findStatusState(\n workflow: StatusWorkflow,\n stateId: string\n): StatusState | undefined {\n return (\n workflow.states.find((state) => state.id === stateId) ??\n STATUS_WORKFLOW_PRESETS.handoff.states.find((state) => state.id === stateId)\n )\n}\n\n/** The Figma status a state shows as in Figma and the Plugin API's `devStatus`, if any. */\nexport function figmaDevStatusOf(stateId: string): FigmaDevStatus | null {\n if (stateId === FIGMA_STATUS_STATE_IDS.READY_FOR_DEV) return 'READY_FOR_DEV'\n if (stateId === FIGMA_STATUS_STATE_IDS.COMPLETED) return 'COMPLETED'\n return null\n}\n\nconst WORKFLOWS = new WeakMap<SceneGraph, { entries: unknown; workflow: StatusWorkflow }>()\n\n/**\n * The document's statuses, read once per change to the document node: canvas labels ask for\n * them on every frame.\n */\nexport function cachedStatusWorkflow(graph: SceneGraph): StatusWorkflow {\n const entries = graph.getNode(graph.rootId)?.pluginData\n const known = WORKFLOWS.get(graph)\n if (known && known.entries === entries) return known.workflow\n const workflow = readStatusWorkflow(graph)\n WORKFLOWS.set(graph, { entries, workflow })\n return workflow\n}\n\n/** The state a layer shows, if any. */\nexport function shownStatusState(graph: SceneGraph, node: SceneNode): StatusState | null {\n const id = effectiveStatus(graph, node)\n return id === null ? null : (findStatusState(cachedStatusWorkflow(graph), id) ?? null)\n}\n"],"mappings":";;;;;AAQA,MAAM,EAAE,aAAa;;;;;AAMrB,MAAa,yBAAyB;CACpC,eAAe;CACf,WAAW;AACb;AAEA,MAAM,gBAA6B;CACjC,IAAI,uBAAuB;CAC3B,MAAM;CACN,OAAO,WAAW,SAAS;AAC7B;AAEA,MAAM,YAAyB;CAC7B,IAAI,uBAAuB;CAC3B,MAAM;CACN,OAAO,WAAW,SAAS;AAC7B;;;;;AAMA,MAAa,0BAA0B;CACrC,SAAS;EAAE,QAAQ;EAAW,QAAQ,CAAC,eAAe,SAAS;CAAE;CACjE,QAAQ;EACN,QAAQ;EACR,QAAQ;GACN;IAAE,IAAI;IAAS,MAAM;IAAS,OAAO,WAAW,SAAS;GAAE;GAC3D;IAAE,IAAI;IAAe,MAAM;IAAe,OAAO,WAAW,SAAS;GAAE;GACvE;IAAE,GAAG;IAAW,MAAM;IAAQ,OAAO,WAAW,SAAS;GAAE;EAC7D;CACF;CACA,QAAQ;EACN,QAAQ;EACR,QAAQ;GACN;IAAE,IAAI;IAAS,MAAM;IAAS,OAAO,WAAW,SAAS;GAAE;GAC3D;IAAE,IAAI;IAAa,MAAM;IAAa,OAAO,WAAW,SAAS;GAAE;GACnE;IAAE,IAAI;IAAqB,MAAM;IAAqB,OAAO,WAAW,SAAS;GAAE;GACnF;IAAE,IAAI;IAAY,MAAM;IAAY,OAAO,WAAW,SAAS;GAAE;GACjE;GACA;IAAE,GAAG;IAAW,MAAM;GAAU;EAClC;CACF;AACF;;;;;AAQA,SAAgB,mBAAmB,OAAmC;CACpE,OACE,eAAe,MAAM,QAAQ,MAAM,MAAM,CAAC,EAAE,YAAY,QAAQ,KAChE,wBAAwB;AAE5B;;AAGA,SAAgB,oBAAoB,OAAmB,UAAgC;CACrF,MAAM,OAAO,MAAM,QAAQ,MAAM,MAAM;CACvC,IAAI,CAAC,MAAM;CACX,MAAM,WAAW,KAAK,IAAI,EACxB,YAAY,eAAe,KAAK,YAAY,UAAU,gBAAgB,QAAQ,CAAC,EACjF,CAAC;AACH;;;;;AAMA,SAAgB,gBACd,UACA,SACyB;CACzB,OACE,SAAS,OAAO,MAAM,UAAU,MAAM,OAAO,OAAO,KACpD,wBAAwB,QAAQ,OAAO,MAAM,UAAU,MAAM,OAAO,OAAO;AAE/E;;AAGA,SAAgB,iBAAiB,SAAwC;CACvE,IAAI,YAAY,uBAAuB,eAAe,OAAO;CAC7D,IAAI,YAAY,uBAAuB,WAAW,OAAO;CACzD,OAAO;AACT;AAEA,MAAM,4BAAY,IAAI,QAAoE;;;;;AAM1F,SAAgB,qBAAqB,OAAmC;CACtE,MAAM,UAAU,MAAM,QAAQ,MAAM,MAAM,CAAC,EAAE;CAC7C,MAAM,QAAQ,UAAU,IAAI,KAAK;CACjC,IAAI,SAAS,MAAM,YAAY,SAAS,OAAO,MAAM;CACrD,MAAM,WAAW,mBAAmB,KAAK;CACzC,UAAU,IAAI,OAAO;EAAE;EAAS;CAAS,CAAC;CAC1C,OAAO;AACT;;AAGA,SAAgB,iBAAiB,OAAmB,MAAqC;CACvF,MAAM,KAAK,gBAAgB,OAAO,IAAI;CACtC,OAAO,OAAO,OAAO,OAAQ,gBAAgB,qBAAqB,KAAK,GAAG,EAAE,KAAK;AACnF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LayoutDirection, SceneNode, TextDirection } from "../types.js";
|
|
2
|
+
//#region src/text/direction.d.ts
|
|
3
|
+
declare function detectTextDirection(text: string): Exclude<TextDirection, 'AUTO'>;
|
|
4
|
+
declare function resolveTextDirection(direction: TextDirection, text: string): Exclude<TextDirection, 'AUTO'>;
|
|
5
|
+
declare function resolveNodeTextDirection(node: Pick<SceneNode, 'textDirection' | 'text'>): 'LTR' | 'RTL';
|
|
6
|
+
declare function resolveNodeLayoutDirection(node: {
|
|
7
|
+
layoutDirection?: LayoutDirection;
|
|
8
|
+
}, inheritedDirection?: Exclude<LayoutDirection, 'AUTO'>): Exclude<LayoutDirection, 'AUTO'>;
|
|
9
|
+
declare function isLogicalTextAlignStart(node: Pick<SceneNode, 'textAlignHorizontal' | 'textDirection' | 'text'>): boolean;
|
|
10
|
+
declare function isLogicalTextAlignEnd(node: Pick<SceneNode, 'textAlignHorizontal' | 'textDirection' | 'text'>): boolean;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { detectTextDirection, isLogicalTextAlignEnd, isLogicalTextAlignStart, resolveNodeLayoutDirection, resolveNodeTextDirection, resolveTextDirection };
|
|
13
|
+
//# sourceMappingURL=direction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direction.d.ts","names":[],"sources":["../../src/text/direction.ts"],"mappings":";;iBAMgB,oBAAoB,eAAe,QAAQ;iBAQ3C,qBACd,WAAW,eACX,eACC,QAAQ;iBAIK,yBACd,MAAM,KAAK;iBAKG,2BACd;EAAQ,kBAAkB;GAC1B,qBAAoB,QAAQ,2BAC3B,QAAQ;iBAMK,wBACd,MAAM,KAAK;iBASG,sBACd,MAAM,KAAK"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/text/direction.ts
|
|
2
|
+
const RTL_CHAR_RE = /\p{Script=Arabic}|\p{Script=Hebrew}|\p{Script=Syriac}|\p{Script=Thaana}|\p{Script=Nko}|\p{Script=Adlam}/u;
|
|
3
|
+
const LTR_CHAR_RE = /\p{Script=Latin}|\p{Script=Cyrillic}|\p{Script=Greek}/u;
|
|
4
|
+
function detectTextDirection(text) {
|
|
5
|
+
for (const char of text) {
|
|
6
|
+
if (RTL_CHAR_RE.test(char)) return "RTL";
|
|
7
|
+
if (LTR_CHAR_RE.test(char)) return "LTR";
|
|
8
|
+
}
|
|
9
|
+
return "LTR";
|
|
10
|
+
}
|
|
11
|
+
function resolveTextDirection(direction, text) {
|
|
12
|
+
return direction === "AUTO" ? detectTextDirection(text) : direction;
|
|
13
|
+
}
|
|
14
|
+
function resolveNodeTextDirection(node) {
|
|
15
|
+
return resolveTextDirection(node.textDirection, node.text);
|
|
16
|
+
}
|
|
17
|
+
function resolveNodeLayoutDirection(node, inheritedDirection = "LTR") {
|
|
18
|
+
return !node.layoutDirection || node.layoutDirection === "AUTO" ? inheritedDirection : node.layoutDirection;
|
|
19
|
+
}
|
|
20
|
+
function isLogicalTextAlignStart(node) {
|
|
21
|
+
const direction = resolveNodeTextDirection(node);
|
|
22
|
+
return direction === "LTR" && node.textAlignHorizontal === "LEFT" || direction === "RTL" && node.textAlignHorizontal === "RIGHT";
|
|
23
|
+
}
|
|
24
|
+
function isLogicalTextAlignEnd(node) {
|
|
25
|
+
const direction = resolveNodeTextDirection(node);
|
|
26
|
+
return direction === "LTR" && node.textAlignHorizontal === "RIGHT" || direction === "RTL" && node.textAlignHorizontal === "LEFT";
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { detectTextDirection, isLogicalTextAlignEnd, isLogicalTextAlignStart, resolveNodeLayoutDirection, resolveNodeTextDirection, resolveTextDirection };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=direction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direction.js","names":[],"sources":["../../src/text/direction.ts"],"sourcesContent":["import type { LayoutDirection, SceneNode, TextDirection } from '../types'\n\nconst RTL_CHAR_RE =\n /\\p{Script=Arabic}|\\p{Script=Hebrew}|\\p{Script=Syriac}|\\p{Script=Thaana}|\\p{Script=Nko}|\\p{Script=Adlam}/u\nconst LTR_CHAR_RE = /\\p{Script=Latin}|\\p{Script=Cyrillic}|\\p{Script=Greek}/u\n\nexport function detectTextDirection(text: string): Exclude<TextDirection, 'AUTO'> {\n for (const char of text) {\n if (RTL_CHAR_RE.test(char)) return 'RTL'\n if (LTR_CHAR_RE.test(char)) return 'LTR'\n }\n return 'LTR'\n}\n\nexport function resolveTextDirection(\n direction: TextDirection,\n text: string\n): Exclude<TextDirection, 'AUTO'> {\n return direction === 'AUTO' ? detectTextDirection(text) : direction\n}\n\nexport function resolveNodeTextDirection(\n node: Pick<SceneNode, 'textDirection' | 'text'>\n): 'LTR' | 'RTL' {\n return resolveTextDirection(node.textDirection, node.text)\n}\n\nexport function resolveNodeLayoutDirection(\n node: { layoutDirection?: LayoutDirection },\n inheritedDirection: Exclude<LayoutDirection, 'AUTO'> = 'LTR'\n): Exclude<LayoutDirection, 'AUTO'> {\n return !node.layoutDirection || node.layoutDirection === 'AUTO'\n ? inheritedDirection\n : node.layoutDirection\n}\n\nexport function isLogicalTextAlignStart(\n node: Pick<SceneNode, 'textAlignHorizontal' | 'textDirection' | 'text'>\n): boolean {\n const direction = resolveNodeTextDirection(node)\n return (\n (direction === 'LTR' && node.textAlignHorizontal === 'LEFT') ||\n (direction === 'RTL' && node.textAlignHorizontal === 'RIGHT')\n )\n}\n\nexport function isLogicalTextAlignEnd(\n node: Pick<SceneNode, 'textAlignHorizontal' | 'textDirection' | 'text'>\n): boolean {\n const direction = resolveNodeTextDirection(node)\n return (\n (direction === 'LTR' && node.textAlignHorizontal === 'RIGHT') ||\n (direction === 'RTL' && node.textAlignHorizontal === 'LEFT')\n )\n}\n"],"mappings":";AAEA,MAAM,cACJ;AACF,MAAM,cAAc;AAEpB,SAAgB,oBAAoB,MAA8C;CAChF,KAAK,MAAM,QAAQ,MAAM;EACvB,IAAI,YAAY,KAAK,IAAI,GAAG,OAAO;EACnC,IAAI,YAAY,KAAK,IAAI,GAAG,OAAO;CACrC;CACA,OAAO;AACT;AAEA,SAAgB,qBACd,WACA,MACgC;CAChC,OAAO,cAAc,SAAS,oBAAoB,IAAI,IAAI;AAC5D;AAEA,SAAgB,yBACd,MACe;CACf,OAAO,qBAAqB,KAAK,eAAe,KAAK,IAAI;AAC3D;AAEA,SAAgB,2BACd,MACA,qBAAuD,OACrB;CAClC,OAAO,CAAC,KAAK,mBAAmB,KAAK,oBAAoB,SACrD,qBACA,KAAK;AACX;AAEA,SAAgB,wBACd,MACS;CACT,MAAM,YAAY,yBAAyB,IAAI;CAC/C,OACG,cAAc,SAAS,KAAK,wBAAwB,UACpD,cAAc,SAAS,KAAK,wBAAwB;AAEzD;AAEA,SAAgB,sBACd,MACS;CACT,MAAM,YAAY,yBAAyB,IAAI;CAC/C,OACG,cAAc,SAAS,KAAK,wBAAwB,WACpD,cAAc,SAAS,KAAK,wBAAwB;AAEzD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MAX_LIST_INDENTATION, PLAIN_PARAGRAPH, TEXT_PARAGRAPH_SPACING_FIELDS, TextParagraphRange, hasParagraphSpacing, hasTextList, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, sharedParagraphSpacing, textParagraphRanges, trimParagraphStyles, withIndentation, withListType, withParagraphSpacing } from "./paragraphs.js";
|
|
2
|
+
import { LIST_BULLET, ListNumberFormat, TextListItem, formatListNumber, listNumberFormat, textListItems, topLevelNumberDigits } from "./lists.js";
|
|
3
|
+
import { StyleRunReferences, remapStyleRunReferences, styleRunReferences } from "./references.js";
|
|
4
|
+
import { NO_LETTER_SPACING, formatTextLength, lineHeightPixels, percentLength, pixelLength, scaledTextLength, textLengthPixels } from "./lengths.js";
|
|
5
|
+
import { textLinesOverflow } from "./overflow.js";
|
|
6
|
+
import { textLengthSchema } from "./schema.js";
|
|
7
|
+
export { LIST_BULLET, ListNumberFormat, MAX_LIST_INDENTATION, NO_LETTER_SPACING, PLAIN_PARAGRAPH, StyleRunReferences, TEXT_PARAGRAPH_SPACING_FIELDS, TextListItem, TextParagraphRange, formatListNumber, formatTextLength, hasParagraphSpacing, hasTextList, lineHeightPixels, listNumberFormat, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, percentLength, pixelLength, remapStyleRunReferences, scaledTextLength, sharedParagraphSpacing, styleRunReferences, textLengthPixels, textLengthSchema, textLinesOverflow, textListItems, textParagraphRanges, topLevelNumberDigits, trimParagraphStyles, withIndentation, withListType, withParagraphSpacing };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { NO_LETTER_SPACING, formatTextLength, lineHeightPixels, percentLength, pixelLength, scaledTextLength, textLengthPixels } from "./lengths.js";
|
|
2
|
+
import { textLinesOverflow } from "./overflow.js";
|
|
3
|
+
import { MAX_LIST_INDENTATION, PLAIN_PARAGRAPH, TEXT_PARAGRAPH_SPACING_FIELDS, hasParagraphSpacing, hasTextList, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, sharedParagraphSpacing, textParagraphRanges, trimParagraphStyles, withIndentation, withListType, withParagraphSpacing } from "./paragraphs.js";
|
|
4
|
+
import { LIST_BULLET, formatListNumber, listNumberFormat, textListItems, topLevelNumberDigits } from "./lists.js";
|
|
5
|
+
import { remapStyleRunReferences, styleRunReferences } from "./references.js";
|
|
6
|
+
import { textLengthSchema } from "./schema.js";
|
|
7
|
+
export { LIST_BULLET, MAX_LIST_INDENTATION, NO_LETTER_SPACING, PLAIN_PARAGRAPH, TEXT_PARAGRAPH_SPACING_FIELDS, formatListNumber, formatTextLength, hasParagraphSpacing, hasTextList, lineHeightPixels, listNumberFormat, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, percentLength, pixelLength, remapStyleRunReferences, scaledTextLength, sharedParagraphSpacing, styleRunReferences, textLengthPixels, textLengthSchema, textLinesOverflow, textListItems, textParagraphRanges, topLevelNumberDigits, trimParagraphStyles, withIndentation, withListType, withParagraphSpacing };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TextLength } from "../types.js";
|
|
2
|
+
//#region src/text/lengths.d.ts
|
|
3
|
+
/** No letter spacing, as a new text has it and as Figma writes it. */
|
|
4
|
+
declare const NO_LETTER_SPACING: TextLength;
|
|
5
|
+
/** `length` in pixels at `fontSize`. */
|
|
6
|
+
declare function textLengthPixels(length: TextLength, fontSize: number): number;
|
|
7
|
+
/** A line height in pixels at `fontSize`, or null when it is automatic. */
|
|
8
|
+
declare function lineHeightPixels(lineHeight: TextLength | null, fontSize: number): number | null;
|
|
9
|
+
/** A length in pixels, as a bound number variable and most authored formats give one. */
|
|
10
|
+
declare function pixelLength(value: number): TextLength;
|
|
11
|
+
/** A length as a percent of the font size. */
|
|
12
|
+
declare function percentLength(value: number): TextLength;
|
|
13
|
+
/** `length` scaled by `factor`: pixels scale, a percent already follows the font size. */
|
|
14
|
+
declare function scaledTextLength(length: TextLength, factor: number): TextLength;
|
|
15
|
+
/** `length` as people read it: `24px` or `150%`. */
|
|
16
|
+
declare function formatTextLength(length: TextLength): string;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { NO_LETTER_SPACING, formatTextLength, lineHeightPixels, percentLength, pixelLength, scaledTextLength, textLengthPixels };
|
|
19
|
+
//# sourceMappingURL=lengths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lengths.d.ts","names":[],"sources":["../../src/text/lengths.ts"],"mappings":";;;cAGa,mBAAmB;;iBAGhB,iBAAiB,QAAQ,YAAY;;iBAKrC,iBAAiB,YAAY,mBAAmB;;iBAKhD,YAAY,gBAAgB;;iBAK5B,cAAc,gBAAgB;;iBAK9B,iBAAiB,QAAQ,YAAY,iBAAiB;;iBAKtD,iBAAiB,QAAQ"}
|