@pairdraw/core 0.19.1 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/providers.d.ts +6 -0
- package/dist/ai/providers.d.ts.map +1 -1
- package/dist/ai/providers.js.map +1 -1
- package/dist/cache/resource.d.ts +8 -1
- package/dist/cache/resource.d.ts.map +1 -1
- package/dist/cache/resource.js +18 -0
- package/dist/cache/resource.js.map +1 -1
- package/dist/canvas/effects.d.ts +6 -4
- package/dist/canvas/effects.d.ts.map +1 -1
- package/dist/canvas/effects.js +37 -34
- package/dist/canvas/effects.js.map +1 -1
- package/dist/canvas/fills.d.ts.map +1 -1
- package/dist/canvas/fills.js +12 -8
- package/dist/canvas/fills.js.map +1 -1
- package/dist/canvas/images/adjustments.d.ts +18 -0
- package/dist/canvas/images/adjustments.d.ts.map +1 -0
- package/dist/canvas/images/adjustments.js +184 -0
- package/dist/canvas/images/adjustments.js.map +1 -0
- package/dist/canvas/images/previews.d.ts +1 -1
- package/dist/canvas/images/sampling.d.ts +13 -0
- package/dist/canvas/images/sampling.d.ts.map +1 -0
- package/dist/canvas/images/sampling.js +49 -0
- package/dist/canvas/images/sampling.js.map +1 -0
- package/dist/canvas/index.d.ts +2 -2
- package/dist/canvas/masks.d.ts +1 -1
- package/dist/canvas/masks.d.ts.map +1 -1
- package/dist/canvas/masks.js.map +1 -1
- package/dist/canvas/noise/render.d.ts +15 -0
- package/dist/canvas/noise/render.d.ts.map +1 -0
- package/dist/canvas/noise/render.js +56 -0
- package/dist/canvas/noise/render.js.map +1 -0
- package/dist/canvas/noise/shader.d.ts +43 -0
- package/dist/canvas/noise/shader.d.ts.map +1 -0
- package/dist/canvas/noise/shader.js +161 -0
- package/dist/canvas/noise/shader.js.map +1 -0
- package/dist/canvas/noise/table.d.ts +13 -0
- package/dist/canvas/noise/table.d.ts.map +1 -0
- package/dist/canvas/noise/table.js +408 -0
- package/dist/canvas/noise/table.js.map +1 -0
- package/dist/canvas/noise/tile.d.ts +22 -0
- package/dist/canvas/noise/tile.d.ts.map +1 -0
- package/dist/canvas/noise/tile.js +73 -0
- package/dist/canvas/noise/tile.js.map +1 -0
- package/dist/canvas/outline-stroke.js +1 -1
- package/dist/canvas/overlays/auto-layout-hover.d.ts.map +1 -1
- package/dist/canvas/overlays/auto-layout-hover.js +31 -71
- package/dist/canvas/overlays/auto-layout-hover.js.map +1 -1
- package/dist/canvas/overlays/index.d.ts +2 -2
- package/dist/canvas/overlays/index.js +2 -2
- package/dist/canvas/overlays/selection.d.ts +1 -2
- package/dist/canvas/overlays/selection.d.ts.map +1 -1
- package/dist/canvas/overlays/selection.js +2 -9
- package/dist/canvas/overlays/selection.js.map +1 -1
- package/dist/canvas/renderer/chunks/index.d.ts +1 -1
- package/dist/canvas/renderer/fonts.d.ts.map +1 -1
- package/dist/canvas/renderer/fonts.js +2 -0
- package/dist/canvas/renderer/fonts.js.map +1 -1
- package/dist/canvas/renderer/lifecycle.d.ts.map +1 -1
- package/dist/canvas/renderer/lifecycle.js +6 -0
- package/dist/canvas/renderer/lifecycle.js.map +1 -1
- package/dist/canvas/renderer/methods.d.ts +0 -1
- package/dist/canvas/renderer/methods.d.ts.map +1 -1
- package/dist/canvas/renderer/methods.js +1 -4
- package/dist/canvas/renderer/methods.js.map +1 -1
- package/dist/canvas/renderer/overlay-pass.d.ts.map +1 -1
- package/dist/canvas/renderer/overlay-pass.js +0 -1
- package/dist/canvas/renderer/overlay-pass.js.map +1 -1
- package/dist/canvas/renderer/pipeline.d.ts.map +1 -1
- package/dist/canvas/renderer/pipeline.js +13 -2
- package/dist/canvas/renderer/pipeline.js.map +1 -1
- package/dist/canvas/renderer/play-scenes.d.ts +13 -0
- package/dist/canvas/renderer/play-scenes.d.ts.map +1 -0
- package/dist/canvas/renderer/play-scenes.js +40 -0
- package/dist/canvas/renderer/play-scenes.js.map +1 -0
- package/dist/canvas/renderer/tiles/cache.d.ts +19 -1
- package/dist/canvas/renderer/tiles/cache.d.ts.map +1 -1
- package/dist/canvas/renderer/tiles/cache.js +32 -1
- package/dist/canvas/renderer/tiles/cache.js.map +1 -1
- package/dist/canvas/renderer/tiles/controller.d.ts +11 -0
- package/dist/canvas/renderer/tiles/controller.d.ts.map +1 -1
- package/dist/canvas/renderer/tiles/controller.js +18 -1
- package/dist/canvas/renderer/tiles/controller.js.map +1 -1
- package/dist/canvas/renderer/tiles/index.d.ts +2 -2
- package/dist/canvas/renderer/tiles/planner.d.ts +1 -1
- package/dist/canvas/renderer/types.d.ts +18 -4
- package/dist/canvas/renderer/types.d.ts.map +1 -1
- package/dist/canvas/renderer/visual-bounds.d.ts +1 -1
- package/dist/canvas/renderer/visual-bounds.js +1 -1
- package/dist/canvas/renderer.d.ts +22 -3
- package/dist/canvas/renderer.d.ts.map +1 -1
- package/dist/canvas/renderer.js +29 -1
- package/dist/canvas/renderer.js.map +1 -1
- package/dist/canvas/scene.d.ts +2 -1
- package/dist/canvas/scene.d.ts.map +1 -1
- package/dist/canvas/scene.js +41 -9
- package/dist/canvas/scene.js.map +1 -1
- package/dist/canvas/shadows/silhouette.js +1 -1
- package/dist/canvas/texture.d.ts +20 -0
- package/dist/canvas/texture.d.ts.map +1 -0
- package/dist/canvas/texture.js +100 -0
- package/dist/canvas/texture.js.map +1 -0
- package/dist/clipboard.js +16 -5
- package/dist/clipboard.js.map +1 -1
- package/dist/constants.d.ts +5 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +5 -1
- package/dist/constants.js.map +1 -1
- package/dist/design-jsx/index.d.ts +2 -2
- package/dist/design-jsx/index.js +2 -2
- package/dist/design-jsx/renderer.d.ts +3 -2
- package/dist/design-jsx/renderer.d.ts.map +1 -1
- package/dist/design-jsx/renderer.js +2 -2
- package/dist/design-jsx/renderer.js.map +1 -1
- package/dist/design-memory/check.d.ts +90 -0
- package/dist/design-memory/check.d.ts.map +1 -0
- package/dist/design-memory/check.js +281 -0
- package/dist/design-memory/check.js.map +1 -0
- package/dist/design-memory/describe.d.ts +37 -0
- package/dist/design-memory/describe.d.ts.map +1 -0
- package/dist/design-memory/describe.js +52 -0
- package/dist/design-memory/describe.js.map +1 -0
- package/dist/design-memory/distil.d.ts +22 -0
- package/dist/design-memory/distil.d.ts.map +1 -0
- package/dist/design-memory/distil.js +54 -0
- package/dist/design-memory/distil.js.map +1 -0
- package/dist/design-memory/document.d.ts +12 -0
- package/dist/design-memory/document.d.ts.map +1 -0
- package/dist/design-memory/document.js +64 -0
- package/dist/design-memory/document.js.map +1 -0
- package/dist/design-memory/guard.d.ts +48 -0
- package/dist/design-memory/guard.d.ts.map +1 -0
- package/dist/design-memory/guard.js +105 -0
- package/dist/design-memory/guard.js.map +1 -0
- package/dist/design-memory/index.d.ts +9 -0
- package/dist/design-memory/index.js +9 -0
- package/dist/design-memory/refusal.d.ts +32 -0
- package/dist/design-memory/refusal.d.ts.map +1 -0
- package/dist/design-memory/refusal.js +68 -0
- package/dist/design-memory/refusal.js.map +1 -0
- package/dist/design-memory/rules.d.ts +63 -0
- package/dist/design-memory/rules.d.ts.map +1 -0
- package/dist/design-memory/rules.js +224 -0
- package/dist/design-memory/rules.js.map +1 -0
- package/dist/design-memory/values.d.ts +28 -0
- package/dist/design-memory/values.d.ts.map +1 -0
- package/dist/design-memory/values.js +160 -0
- package/dist/design-memory/values.js.map +1 -0
- package/dist/editor/alignment.js +1 -1
- package/dist/editor/bridges/components.d.ts +2 -0
- package/dist/editor/bridges/components.d.ts.map +1 -1
- package/dist/editor/bridges/components.js +2 -0
- package/dist/editor/bridges/components.js.map +1 -1
- package/dist/editor/bridges/undo.d.ts +1 -1
- package/dist/editor/clipboard/assets.js +1 -1
- package/dist/editor/clipboard/export.d.ts.map +1 -1
- package/dist/editor/clipboard/export.js +16 -2
- package/dist/editor/clipboard/export.js.map +1 -1
- package/dist/editor/clipboard/placement.d.ts +1 -1
- package/dist/editor/clipboard/placement.js +1 -1
- package/dist/editor/clipboard/snapshot.d.ts.map +1 -1
- package/dist/editor/clipboard/snapshot.js +12 -4
- package/dist/editor/clipboard/snapshot.js.map +1 -1
- package/dist/editor/clipboard.d.ts.map +1 -1
- package/dist/editor/clipboard.js +2 -7
- package/dist/editor/clipboard.js.map +1 -1
- package/dist/editor/color-space.d.ts.map +1 -1
- package/dist/editor/color-space.js +33 -38
- package/dist/editor/color-space.js.map +1 -1
- package/dist/editor/components/instances.d.ts +2 -0
- package/dist/editor/components/instances.d.ts.map +1 -1
- package/dist/editor/components/instances.js +22 -1
- package/dist/editor/components/instances.js.map +1 -1
- package/dist/editor/components.d.ts +2 -0
- package/dist/editor/components.d.ts.map +1 -1
- package/dist/editor/connectors/attach.js +1 -1
- package/dist/editor/create.d.ts +36 -8
- package/dist/editor/create.d.ts.map +1 -1
- package/dist/editor/create.js +26 -61
- package/dist/editor/create.js.map +1 -1
- package/dist/editor/design-memory.d.ts +11 -0
- package/dist/editor/design-memory.d.ts.map +1 -0
- package/dist/editor/design-memory.js +40 -0
- package/dist/editor/design-memory.js.map +1 -0
- package/dist/editor/design-tokens.d.ts +4 -0
- package/dist/editor/design-tokens.d.ts.map +1 -1
- package/dist/editor/design-tokens.js +30 -1
- package/dist/editor/design-tokens.js.map +1 -1
- package/dist/editor/document-colors.d.ts +23 -0
- package/dist/editor/document-colors.d.ts.map +1 -0
- package/dist/editor/document-colors.js +53 -0
- package/dist/editor/document-colors.js.map +1 -0
- package/dist/editor/eyedropper.d.ts +47 -0
- package/dist/editor/eyedropper.d.ts.map +1 -0
- package/dist/editor/eyedropper.js +168 -0
- package/dist/editor/eyedropper.js.map +1 -0
- package/dist/editor/fonts.d.ts +9 -0
- package/dist/editor/fonts.d.ts.map +1 -0
- package/dist/editor/fonts.js +14 -0
- package/dist/editor/fonts.js.map +1 -0
- package/dist/editor/history/atomic-tool.d.ts +9 -2
- package/dist/editor/history/atomic-tool.d.ts.map +1 -1
- package/dist/editor/history/atomic-tool.js +6 -0
- package/dist/editor/history/atomic-tool.js.map +1 -1
- package/dist/editor/history/capture.d.ts +13 -0
- package/dist/editor/history/capture.d.ts.map +1 -0
- package/dist/editor/history/capture.js +28 -0
- package/dist/editor/history/capture.js.map +1 -0
- package/dist/editor/history/document-change.d.ts.map +1 -1
- package/dist/editor/history/document-change.js +2 -22
- package/dist/editor/history/document-change.js.map +1 -1
- package/dist/editor/history/edit.d.ts +7 -0
- package/dist/editor/history/edit.d.ts.map +1 -1
- package/dist/editor/history/edit.js +6 -3
- package/dist/editor/history/edit.js.map +1 -1
- package/dist/editor/history/subtree.d.ts +9 -0
- package/dist/editor/history/subtree.d.ts.map +1 -1
- package/dist/editor/history/subtree.js +12 -2
- package/dist/editor/history/subtree.js.map +1 -1
- package/dist/editor/index.d.ts +4 -2
- package/dist/editor/index.js +4 -2
- package/dist/editor/nudge.js +1 -1
- package/dist/editor/nudge.js.map +1 -1
- package/dist/editor/pages.d.ts +7 -5
- package/dist/editor/pages.d.ts.map +1 -1
- package/dist/editor/pages.js +35 -25
- package/dist/editor/pages.js.map +1 -1
- package/dist/editor/play/states.d.ts +3 -1
- package/dist/editor/play/states.d.ts.map +1 -1
- package/dist/editor/play/states.js +1 -1
- package/dist/editor/play/states.js.map +1 -1
- package/dist/editor/read-only/actions.js +6 -0
- package/dist/editor/read-only/actions.js.map +1 -1
- package/dist/editor/render-requests.d.ts +18 -0
- package/dist/editor/render-requests.d.ts.map +1 -0
- package/dist/editor/render-requests.js +76 -0
- package/dist/editor/render-requests.js.map +1 -0
- package/dist/editor/scale/rescale.d.ts +1 -1
- package/dist/editor/selection/container.d.ts +2 -0
- package/dist/editor/selection/container.d.ts.map +1 -1
- package/dist/editor/selection/container.js +17 -1
- package/dist/editor/selection/container.js.map +1 -1
- package/dist/editor/selection/navigation.js +7 -4
- package/dist/editor/selection/navigation.js.map +1 -1
- package/dist/editor/selection/overlays.d.ts.map +1 -1
- package/dist/editor/selection/overlays.js +1 -1
- package/dist/editor/selection/overlays.js.map +1 -1
- package/dist/editor/selection/read.d.ts +6 -2
- package/dist/editor/selection.d.ts +9 -2
- package/dist/editor/selection.d.ts.map +1 -1
- package/dist/editor/shapes/with-text.d.ts.map +1 -1
- package/dist/editor/shapes/with-text.js +2 -5
- package/dist/editor/shapes/with-text.js.map +1 -1
- package/dist/editor/structure/auto-layout-wrap.js +1 -1
- package/dist/editor/structure/auto-layout-wrap.js.map +1 -1
- package/dist/editor/structure/boolean.d.ts +2 -3
- package/dist/editor/structure/boolean.d.ts.map +1 -1
- package/dist/editor/structure/boolean.js.map +1 -1
- package/dist/editor/structure/group/bounds.d.ts.map +1 -1
- package/dist/editor/structure/group/bounds.js +1 -3
- package/dist/editor/structure/group/bounds.js.map +1 -1
- package/dist/editor/structure/outline-stroke.js +3 -3
- package/dist/editor/structure/outline-stroke.js.map +1 -1
- package/dist/editor/structure/reorder.d.ts.map +1 -1
- package/dist/editor/structure/reorder.js +7 -14
- package/dist/editor/structure/reorder.js.map +1 -1
- package/dist/editor/structure/state.js +1 -1
- package/dist/editor/structure/state.js.map +1 -1
- package/dist/editor/structure.d.ts +1 -2
- package/dist/editor/structure.d.ts.map +1 -1
- package/dist/editor/structure.js +3 -3
- package/dist/editor/structure.js.map +1 -1
- package/dist/editor/tool-registry.d.ts.map +1 -1
- package/dist/editor/tool-registry.js +2 -1
- package/dist/editor/tool-registry.js.map +1 -1
- package/dist/editor/types.d.ts +9 -2
- package/dist/editor/types.d.ts.map +1 -1
- package/dist/editor/variables.d.ts.map +1 -1
- package/dist/editor/variables.js +57 -1
- package/dist/editor/variables.js.map +1 -1
- package/dist/editor/variations/create.d.ts +28 -0
- package/dist/editor/variations/create.d.ts.map +1 -0
- package/dist/editor/variations/create.js +176 -0
- package/dist/editor/variations/create.js.map +1 -0
- package/dist/editor/variations/pick.d.ts +16 -0
- package/dist/editor/variations/pick.d.ts.map +1 -0
- package/dist/editor/variations/pick.js +23 -0
- package/dist/editor/variations/pick.js.map +1 -0
- package/dist/editor/variations.d.ts +28 -0
- package/dist/editor/variations.d.ts.map +1 -0
- package/dist/editor/variations.js +88 -0
- package/dist/editor/variations.js.map +1 -0
- package/dist/figma-api/accessors/reactions.d.ts.map +1 -1
- package/dist/figma-api/accessors/reactions.js +4 -1
- package/dist/figma-api/accessors/reactions.js.map +1 -1
- package/dist/figma-api/accessors/text/index.d.ts.map +1 -1
- package/dist/figma-api/accessors/text/index.js +7 -1
- package/dist/figma-api/accessors/text/index.js.map +1 -1
- package/dist/figma-api/accessors/text/opentype.d.ts +17 -0
- package/dist/figma-api/accessors/text/opentype.d.ts.map +1 -0
- package/dist/figma-api/accessors/text/opentype.js +28 -0
- package/dist/figma-api/accessors/text/opentype.js.map +1 -0
- package/dist/figma-api/accessors/visual.d.ts.map +1 -1
- package/dist/figma-api/accessors/visual.js +33 -0
- package/dist/figma-api/accessors/visual.js.map +1 -1
- package/dist/figma-api/effects.d.ts +79 -3
- package/dist/figma-api/effects.d.ts.map +1 -1
- package/dist/figma-api/effects.js +150 -9
- package/dist/figma-api/effects.js.map +1 -1
- package/dist/figma-api/fonts/loaded.d.ts +3 -1
- package/dist/figma-api/fonts/loaded.d.ts.map +1 -1
- package/dist/figma-api/fonts/loaded.js +8 -1
- package/dist/figma-api/fonts/loaded.js.map +1 -1
- package/dist/figma-api/index.d.ts +18 -0
- package/dist/figma-api/index.d.ts.map +1 -1
- package/dist/figma-api/index.js +19 -1
- package/dist/figma-api/index.js.map +1 -1
- package/dist/figma-api/overrides.d.ts +13 -1
- package/dist/figma-api/overrides.d.ts.map +1 -1
- package/dist/figma-api/overrides.js +196 -4
- package/dist/figma-api/overrides.js.map +1 -1
- package/dist/figma-api/paints.d.ts +3 -3
- package/dist/figma-api/paints.d.ts.map +1 -1
- package/dist/figma-api/paints.js +14 -4
- package/dist/figma-api/paints.js.map +1 -1
- package/dist/figma-api/proxy.d.ts +4 -1
- package/dist/figma-api/proxy.d.ts.map +1 -1
- package/dist/figma-api/proxy.js +1 -1
- package/dist/figma-api/proxy.js.map +1 -1
- package/dist/figma-api/reactions.d.ts +41 -13
- package/dist/figma-api/reactions.d.ts.map +1 -1
- package/dist/figma-api/reactions.js +113 -31
- package/dist/figma-api/reactions.js.map +1 -1
- package/dist/figma-api/render-bounds.js +1 -1
- package/dist/figma-api/serialization.d.ts.map +1 -1
- package/dist/figma-api/serialization.js +2 -1
- package/dist/figma-api/serialization.js.map +1 -1
- package/dist/figma-api/shape-details.d.ts +26 -0
- package/dist/figma-api/shape-details.d.ts.map +1 -0
- package/dist/figma-api/shape-details.js +28 -0
- package/dist/figma-api/shape-details.js.map +1 -0
- package/dist/figma-api/shape-with-text.js +2 -5
- package/dist/figma-api/shape-with-text.js.map +1 -1
- package/dist/figma-api/surface.d.ts +7 -4
- package/dist/figma-api/surface.d.ts.map +1 -1
- package/dist/figma-api/surface.js +7 -2
- package/dist/figma-api/surface.js.map +1 -1
- package/dist/figma-api/transform.d.ts +1 -1
- package/dist/geometry/figma.d.ts +1 -1
- package/dist/geometry/image-crop.d.ts +1 -1
- package/dist/geometry/image-crop.js +1 -1
- package/dist/icons/svg.js +1 -1
- package/dist/icons/svg.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/io/formats/boolean-path.d.ts +19 -0
- package/dist/io/formats/boolean-path.d.ts.map +1 -0
- package/dist/io/formats/boolean-path.js +47 -0
- package/dist/io/formats/boolean-path.js.map +1 -0
- package/dist/io/formats/design-tokens/decode.js +1 -1
- package/dist/io/formats/design-tokens/index.d.ts +4 -1
- package/dist/io/formats/design-tokens/index.js +4 -1
- package/dist/io/formats/design-tokens/plan/changes.d.ts +5 -3
- package/dist/io/formats/design-tokens/plan/changes.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/plan/changes.js +1 -1
- package/dist/io/formats/design-tokens/plan/changes.js.map +1 -1
- package/dist/io/formats/design-tokens/project.d.ts +17 -2
- package/dist/io/formats/design-tokens/project.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/project.js +29 -8
- package/dist/io/formats/design-tokens/project.js.map +1 -1
- package/dist/io/formats/design-tokens/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/styles.js.map +1 -1
- package/dist/io/formats/design-tokens/sync/apply.d.ts +42 -0
- package/dist/io/formats/design-tokens/sync/apply.d.ts.map +1 -0
- package/dist/io/formats/design-tokens/sync/apply.js +73 -0
- package/dist/io/formats/design-tokens/sync/apply.js.map +1 -0
- package/dist/io/formats/design-tokens/sync/drift.d.ts +77 -0
- package/dist/io/formats/design-tokens/sync/drift.d.ts.map +1 -0
- package/dist/io/formats/design-tokens/sync/drift.js +391 -0
- package/dist/io/formats/design-tokens/sync/drift.js.map +1 -0
- package/dist/io/formats/design-tokens/sync/files.d.ts +15 -0
- package/dist/io/formats/design-tokens/sync/files.d.ts.map +1 -0
- package/dist/io/formats/design-tokens/sync/files.js +35 -0
- package/dist/io/formats/design-tokens/sync/files.js.map +1 -0
- package/dist/io/formats/drawio/edges.d.ts +7 -1
- package/dist/io/formats/drawio/edges.d.ts.map +1 -1
- package/dist/io/formats/drawio/edges.js +54 -1
- package/dist/io/formats/drawio/edges.js.map +1 -1
- package/dist/io/formats/drawio/export.d.ts.map +1 -1
- package/dist/io/formats/drawio/export.js +19 -2
- package/dist/io/formats/drawio/export.js.map +1 -1
- package/dist/io/formats/drawio/index.d.ts.map +1 -1
- package/dist/io/formats/drawio/index.js +2 -1
- package/dist/io/formats/drawio/index.js.map +1 -1
- package/dist/io/formats/drawio/label.js +1 -1
- package/dist/io/formats/drawio/paint.js +1 -1
- package/dist/io/formats/drawio/placement.d.ts +1 -1
- package/dist/io/formats/fig/export/patch/index.d.ts.map +1 -1
- package/dist/io/formats/fig/export/patch/index.js +5 -0
- package/dist/io/formats/fig/export/patch/index.js.map +1 -1
- package/dist/io/formats/fig/thumbnail-page.d.ts +3 -4
- package/dist/io/formats/fig/thumbnail-page.d.ts.map +1 -1
- package/dist/io/formats/fig/thumbnail-page.js.map +1 -1
- package/dist/io/formats/html/import.d.ts.map +1 -1
- package/dist/io/formats/html/import.js +3 -1
- package/dist/io/formats/html/import.js.map +1 -1
- package/dist/io/formats/html/index.d.ts +2 -2
- package/dist/io/formats/html/index.d.ts.map +1 -1
- package/dist/io/formats/html/index.js +6 -4
- package/dist/io/formats/html/index.js.map +1 -1
- package/dist/io/formats/html/layers.d.ts +7 -4
- package/dist/io/formats/html/layers.d.ts.map +1 -1
- package/dist/io/formats/html/layers.js +4 -1
- package/dist/io/formats/html/layers.js.map +1 -1
- package/dist/io/formats/html/vectors.d.ts +2 -1
- package/dist/io/formats/html/vectors.d.ts.map +1 -1
- package/dist/io/formats/html/vectors.js +3 -2
- package/dist/io/formats/html/vectors.js.map +1 -1
- package/dist/io/formats/mermaid/styles.js +1 -1
- package/dist/io/formats/pdf/document.d.ts +3 -1
- package/dist/io/formats/pdf/document.d.ts.map +1 -1
- package/dist/io/formats/pdf/document.js +6 -3
- package/dist/io/formats/pdf/document.js.map +1 -1
- package/dist/io/formats/pdf/dom.d.ts +6 -1
- package/dist/io/formats/pdf/dom.d.ts.map +1 -1
- package/dist/io/formats/pdf/dom.js +9 -22
- package/dist/io/formats/pdf/dom.js.map +1 -1
- package/dist/io/formats/pdf/export.js +1 -1
- package/dist/io/formats/pdf/export.js.map +1 -1
- package/dist/io/formats/pdf/prepare.d.ts +1 -1
- package/dist/io/formats/pen/imports.d.ts +4 -1
- package/dist/io/formats/pen/imports.d.ts.map +1 -1
- package/dist/io/formats/pen/imports.js.map +1 -1
- package/dist/io/formats/pen/index.d.ts.map +1 -1
- package/dist/io/formats/pen/index.js +31 -3
- package/dist/io/formats/pen/index.js.map +1 -1
- package/dist/io/formats/pptx/export.js +1 -1
- package/dist/io/formats/pptx/geometry.d.ts +1 -1
- package/dist/io/formats/raster/adjusted-images.d.ts +15 -0
- package/dist/io/formats/raster/adjusted-images.d.ts.map +1 -0
- package/dist/io/formats/raster/adjusted-images.js +118 -0
- package/dist/io/formats/raster/adjusted-images.js.map +1 -0
- package/dist/io/formats/raster/headless.d.ts +11 -1
- package/dist/io/formats/raster/headless.d.ts.map +1 -1
- package/dist/io/formats/raster/headless.js +4 -4
- package/dist/io/formats/raster/headless.js.map +1 -1
- package/dist/io/formats/raster/index.d.ts +2 -2
- package/dist/io/formats/raster/pixels.d.ts +7 -1
- package/dist/io/formats/raster/pixels.d.ts.map +1 -1
- package/dist/io/formats/raster/pixels.js.map +1 -1
- package/dist/io/formats/raster/render.d.ts.map +1 -1
- package/dist/io/formats/raster/render.js +4 -0
- package/dist/io/formats/raster/render.js.map +1 -1
- package/dist/io/formats/svg/defs.d.ts +5 -6
- package/dist/io/formats/svg/defs.d.ts.map +1 -1
- package/dist/io/formats/svg/defs.js +4 -54
- package/dist/io/formats/svg/defs.js.map +1 -1
- package/dist/io/formats/svg/effects.d.ts +16 -0
- package/dist/io/formats/svg/effects.d.ts.map +1 -0
- package/dist/io/formats/svg/effects.js +126 -0
- package/dist/io/formats/svg/effects.js.map +1 -0
- package/dist/io/formats/svg/export.d.ts +7 -1
- package/dist/io/formats/svg/export.d.ts.map +1 -1
- package/dist/io/formats/svg/export.js +224 -50
- package/dist/io/formats/svg/export.js.map +1 -1
- package/dist/io/formats/svg/filter.d.ts +27 -0
- package/dist/io/formats/svg/filter.d.ts.map +1 -0
- package/dist/io/formats/svg/filter.js +44 -0
- package/dist/io/formats/svg/filter.js.map +1 -0
- package/dist/io/formats/svg/grain.d.ts +26 -0
- package/dist/io/formats/svg/grain.d.ts.map +1 -0
- package/dist/io/formats/svg/grain.js +298 -0
- package/dist/io/formats/svg/grain.js.map +1 -0
- package/dist/io/formats/svg/strokes.d.ts +1 -1
- package/dist/io/formats/svg/strokes.d.ts.map +1 -1
- package/dist/io/formats/svg/strokes.js +1 -2
- package/dist/io/formats/svg/strokes.js.map +1 -1
- package/dist/io/formats/svg/text/import.js +1 -1
- package/dist/io/formats/svg/text/layout.d.ts +5 -2
- package/dist/io/formats/svg/text/layout.d.ts.map +1 -1
- package/dist/io/formats/svg/text/layout.js +6 -3
- package/dist/io/formats/svg/text/layout.js.map +1 -1
- package/dist/io/formats/video/composite.d.ts +18 -0
- package/dist/io/formats/video/composite.d.ts.map +1 -0
- package/dist/io/formats/video/composite.js +79 -0
- package/dist/io/formats/video/composite.js.map +1 -0
- package/dist/io/formats/video/formats.d.ts +29 -0
- package/dist/io/formats/video/formats.d.ts.map +1 -0
- package/dist/io/formats/video/formats.js +43 -0
- package/dist/io/formats/video/formats.js.map +1 -0
- package/dist/io/formats/video/gif.d.ts +13 -0
- package/dist/io/formats/video/gif.d.ts.map +1 -0
- package/dist/io/formats/video/gif.js +56 -0
- package/dist/io/formats/video/gif.js.map +1 -0
- package/dist/io/formats/video/index.d.ts +9 -0
- package/dist/io/formats/video/index.js +9 -0
- package/dist/io/formats/video/plan.d.ts +64 -0
- package/dist/io/formats/video/plan.d.ts.map +1 -0
- package/dist/io/formats/video/plan.js +90 -0
- package/dist/io/formats/video/plan.js.map +1 -0
- package/dist/io/formats/video/record.d.ts +36 -0
- package/dist/io/formats/video/record.d.ts.map +1 -0
- package/dist/io/formats/video/record.js +154 -0
- package/dist/io/formats/video/record.js.map +1 -0
- package/dist/io/formats/video/sink.d.ts +29 -0
- package/dist/io/formats/video/sink.d.ts.map +1 -0
- package/dist/io/formats/video/sink.js +16 -0
- package/dist/io/formats/video/sink.js.map +1 -0
- package/dist/io/formats/video/size.d.ts +19 -0
- package/dist/io/formats/video/size.d.ts.map +1 -0
- package/dist/io/formats/video/size.js +26 -0
- package/dist/io/formats/video/size.js.map +1 -0
- package/dist/io/formats/video/webcodecs.d.ts +18 -0
- package/dist/io/formats/video/webcodecs.d.ts.map +1 -0
- package/dist/io/formats/video/webcodecs.js +74 -0
- package/dist/io/formats/video/webcodecs.js.map +1 -0
- package/dist/io/formats.d.ts.map +1 -1
- package/dist/io/formats.js +40 -11
- package/dist/io/formats.js.map +1 -1
- package/dist/io/types.d.ts +19 -4
- package/dist/io/types.d.ts.map +1 -1
- package/dist/kiwi/fig/parse/transfer.d.ts +1 -1
- package/dist/layout/apply.d.ts.map +1 -1
- package/dist/layout/apply.js +50 -12
- package/dist/layout/apply.js.map +1 -1
- package/dist/layout/auto-layout-handles.d.ts +66 -0
- package/dist/layout/auto-layout-handles.d.ts.map +1 -0
- package/dist/layout/auto-layout-handles.js +291 -0
- package/dist/layout/auto-layout-handles.js.map +1 -0
- package/dist/layout/derived.d.ts +7 -1
- package/dist/layout/derived.d.ts.map +1 -1
- package/dist/layout/derived.js +11 -1
- package/dist/layout/derived.js.map +1 -1
- package/dist/layout/grid.d.ts +7 -2
- package/dist/layout/grid.d.ts.map +1 -1
- package/dist/layout/grid.js +27 -9
- package/dist/layout/grid.js.map +1 -1
- package/dist/layout/mutations.d.ts +1 -0
- package/dist/layout/mutations.d.ts.map +1 -1
- package/dist/layout/mutations.js +10 -0
- package/dist/layout/mutations.js.map +1 -1
- package/dist/layout/strokes.d.ts +9 -1
- package/dist/layout/strokes.d.ts.map +1 -1
- package/dist/layout/strokes.js +12 -1
- package/dist/layout/strokes.js.map +1 -1
- package/dist/layout/yoga-helpers.d.ts +3 -1
- package/dist/layout/yoga-helpers.d.ts.map +1 -1
- package/dist/layout/yoga-helpers.js +16 -2
- package/dist/layout/yoga-helpers.js.map +1 -1
- package/dist/layout.d.ts +3 -2
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +73 -39
- package/dist/layout.js.map +1 -1
- package/dist/lint/fixes.d.ts.map +1 -1
- package/dist/lint/fixes.js +9 -3
- package/dist/lint/fixes.js.map +1 -1
- package/dist/lint/index.d.ts +3 -2
- package/dist/lint/index.js +2 -1
- package/dist/lint/linter.d.ts +13 -0
- package/dist/lint/linter.d.ts.map +1 -1
- package/dist/lint/linter.js +123 -9
- package/dist/lint/linter.js.map +1 -1
- package/dist/lint/presets.d.ts.map +1 -1
- package/dist/lint/presets.js +2 -0
- package/dist/lint/presets.js.map +1 -1
- package/dist/lint/rules/design-memory.d.ts +15 -0
- package/dist/lint/rules/design-memory.d.ts.map +1 -0
- package/dist/lint/rules/design-memory.js +90 -0
- package/dist/lint/rules/design-memory.js.map +1 -0
- package/dist/lint/rules/effect-style-required.js +1 -0
- package/dist/lint/rules/effect-style-required.js.map +1 -1
- package/dist/lint/rules/index.d.ts +6 -5
- package/dist/lint/rules/index.d.ts.map +1 -1
- package/dist/lint/rules/index.js +6 -2
- package/dist/lint/rules/index.js.map +1 -1
- package/dist/lint/rules/no-unbound-token-values.d.ts +6 -0
- package/dist/lint/rules/no-unbound-token-values.d.ts.map +1 -0
- package/dist/lint/rules/no-unbound-token-values.js +79 -0
- package/dist/lint/rules/no-unbound-token-values.js.map +1 -0
- package/dist/lint/rules/text-style-required.js +1 -0
- package/dist/lint/rules/text-style-required.js.map +1 -1
- package/dist/lint/types.d.ts +32 -2
- package/dist/lint/types.d.ts.map +1 -1
- package/dist/node/video.d.ts +12 -0
- package/dist/node/video.d.ts.map +1 -0
- package/dist/node/video.js +206 -0
- package/dist/node/video.js.map +1 -0
- package/dist/pairdraw-api/design-memory.d.ts +19 -0
- package/dist/pairdraw-api/design-memory.d.ts.map +1 -0
- package/dist/pairdraw-api/design-memory.js +39 -0
- package/dist/pairdraw-api/design-memory.js.map +1 -0
- package/dist/pairdraw-api/index.d.ts +45 -1
- package/dist/pairdraw-api/index.d.ts.map +1 -1
- package/dist/pairdraw-api/index.js +55 -2
- package/dist/pairdraw-api/index.js.map +1 -1
- package/dist/pairdraw-api/nodes.d.ts +12 -1
- package/dist/pairdraw-api/nodes.d.ts.map +1 -1
- package/dist/pairdraw-api/nodes.js +28 -1
- package/dist/pairdraw-api/nodes.js.map +1 -1
- package/dist/pairdraw-api/variations.d.ts +48 -0
- package/dist/pairdraw-api/variations.d.ts.map +1 -0
- package/dist/pairdraw-api/variations.js +76 -0
- package/dist/pairdraw-api/variations.js.map +1 -0
- package/dist/prototype/easing.d.ts +13 -0
- package/dist/prototype/easing.d.ts.map +1 -0
- package/dist/prototype/easing.js +36 -0
- package/dist/prototype/easing.js.map +1 -0
- package/dist/prototype/frames.d.ts +10 -0
- package/dist/prototype/frames.d.ts.map +1 -0
- package/dist/prototype/frames.js +12 -0
- package/dist/prototype/frames.js.map +1 -0
- package/dist/prototype/hit.d.ts +17 -0
- package/dist/prototype/hit.d.ts.map +1 -0
- package/dist/prototype/hit.js +45 -0
- package/dist/prototype/hit.js.map +1 -0
- package/dist/prototype/index.d.ts +14 -0
- package/dist/prototype/index.js +14 -0
- package/dist/prototype/pointer.d.ts +63 -0
- package/dist/prototype/pointer.d.ts.map +1 -0
- package/dist/prototype/pointer.js +104 -0
- package/dist/prototype/pointer.js.map +1 -0
- package/dist/prototype/reactions.d.ts +45 -0
- package/dist/prototype/reactions.d.ts.map +1 -0
- package/dist/prototype/reactions.js +122 -0
- package/dist/prototype/reactions.js.map +1 -0
- package/dist/prototype/scene.d.ts +35 -0
- package/dist/prototype/scene.d.ts.map +1 -0
- package/dist/prototype/scene.js +86 -0
- package/dist/prototype/scene.js.map +1 -0
- package/dist/prototype/scenes.d.ts +81 -0
- package/dist/prototype/scenes.d.ts.map +1 -0
- package/dist/prototype/scenes.js +175 -0
- package/dist/prototype/scenes.js.map +1 -0
- package/dist/prototype/scroll.d.ts +48 -0
- package/dist/prototype/scroll.d.ts.map +1 -0
- package/dist/prototype/scroll.js +159 -0
- package/dist/prototype/scroll.js.map +1 -0
- package/dist/prototype/session.d.ts +71 -0
- package/dist/prototype/session.d.ts.map +1 -0
- package/dist/prototype/session.js +135 -0
- package/dist/prototype/session.js.map +1 -0
- package/dist/prototype/smart-animate/animation.d.ts +34 -0
- package/dist/prototype/smart-animate/animation.d.ts.map +1 -0
- package/dist/prototype/smart-animate/animation.js +212 -0
- package/dist/prototype/smart-animate/animation.js.map +1 -0
- package/dist/prototype/smart-animate/match.d.ts +24 -0
- package/dist/prototype/smart-animate/match.d.ts.map +1 -0
- package/dist/prototype/smart-animate/match.js +72 -0
- package/dist/prototype/smart-animate/match.js.map +1 -0
- package/dist/prototype/snapshot.d.ts +19 -0
- package/dist/prototype/snapshot.d.ts.map +1 -0
- package/dist/prototype/snapshot.js +56 -0
- package/dist/prototype/snapshot.js.map +1 -0
- package/dist/prototype/timeline.d.ts +132 -0
- package/dist/prototype/timeline.d.ts.map +1 -0
- package/dist/prototype/timeline.js +260 -0
- package/dist/prototype/timeline.js.map +1 -0
- package/dist/rpc/commands.d.ts +2 -2
- package/dist/rpc/index.d.ts +2 -2
- package/dist/rpc/read-commands.d.ts +18 -8
- package/dist/rpc/read-commands.d.ts.map +1 -1
- package/dist/rpc/read-commands.js +18 -9
- package/dist/rpc/read-commands.js.map +1 -1
- package/dist/text/font/faces.d.ts +12 -1
- package/dist/text/font/faces.d.ts.map +1 -1
- package/dist/text/font/faces.js +15 -1
- package/dist/text/font/faces.js.map +1 -1
- package/dist/text/font/features.d.ts +9 -0
- package/dist/text/font/features.d.ts.map +1 -0
- package/dist/text/font/features.js +27 -0
- package/dist/text/font/features.js.map +1 -0
- package/dist/text/font/manager.d.ts +12 -0
- package/dist/text/font/manager.d.ts.map +1 -1
- package/dist/text/font/manager.js +66 -12
- package/dist/text/font/manager.js.map +1 -1
- package/dist/text/index.d.ts +11 -9
- package/dist/text/index.js +4 -2
- package/dist/text/replace-fonts.d.ts +41 -0
- package/dist/text/replace-fonts.d.ts.map +1 -0
- package/dist/text/replace-fonts.js +121 -0
- package/dist/text/replace-fonts.js.map +1 -0
- package/dist/tools/analyze/responsive/index.d.ts +15 -0
- package/dist/tools/analyze/responsive/index.d.ts.map +1 -0
- package/dist/tools/analyze/responsive/index.js +203 -0
- package/dist/tools/analyze/responsive/index.js.map +1 -0
- package/dist/tools/analyze.d.ts +2 -1
- package/dist/tools/analyze.js +2 -1
- package/dist/tools/codegen/token-sync.d.ts +7 -0
- package/dist/tools/codegen/token-sync.d.ts.map +1 -0
- package/dist/tools/codegen/token-sync.js +85 -0
- package/dist/tools/codegen/token-sync.js.map +1 -0
- package/dist/tools/codegen/tokens.d.ts +1 -1
- package/dist/tools/codegen.d.ts +2 -1
- package/dist/tools/codegen.js +2 -1
- package/dist/tools/create/basic.js +1 -1
- package/dist/tools/create/behaviours.js +1 -1
- package/dist/tools/create/components.d.ts.map +1 -1
- package/dist/tools/create/components.js +4 -0
- package/dist/tools/create/components.js.map +1 -1
- package/dist/tools/create/html.js +3 -2
- package/dist/tools/create/html.js.map +1 -1
- package/dist/tools/create/icons.d.ts.map +1 -1
- package/dist/tools/create/icons.js +2 -1
- package/dist/tools/create/icons.js.map +1 -1
- package/dist/tools/create/mermaid.js +2 -1
- package/dist/tools/create/mermaid.js.map +1 -1
- package/dist/tools/create/render.js +1 -1
- package/dist/tools/create/svg.js +2 -1
- package/dist/tools/create/svg.js.map +1 -1
- package/dist/tools/create/vector.js +1 -1
- package/dist/tools/design-memory.d.ts +8 -0
- package/dist/tools/design-memory.d.ts.map +1 -0
- package/dist/tools/design-memory.js +68 -0
- package/dist/tools/design-memory.js.map +1 -0
- package/dist/tools/image-ai/generate.d.ts.map +1 -1
- package/dist/tools/image-ai/generate.js +3 -1
- package/dist/tools/image-ai/generate.js.map +1 -1
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.js +2 -1
- package/dist/tools/modify/fonts.d.ts +6 -0
- package/dist/tools/modify/fonts.d.ts.map +1 -0
- package/dist/tools/modify/fonts.js +27 -0
- package/dist/tools/modify/fonts.js.map +1 -0
- package/dist/tools/modify/layout.d.ts.map +1 -1
- package/dist/tools/modify/layout.js +1 -0
- package/dist/tools/modify/layout.js.map +1 -1
- package/dist/tools/modify/paint.js +1 -1
- package/dist/tools/modify/reactions.d.ts.map +1 -1
- package/dist/tools/modify/reactions.js +3 -3
- package/dist/tools/modify/reactions.js.map +1 -1
- package/dist/tools/modify/text.d.ts.map +1 -1
- package/dist/tools/modify/text.js +26 -5
- package/dist/tools/modify/text.js.map +1 -1
- package/dist/tools/modify/update.d.ts +10 -1
- package/dist/tools/modify/update.d.ts.map +1 -1
- package/dist/tools/modify/update.js +34 -3
- package/dist/tools/modify/update.js.map +1 -1
- package/dist/tools/modify.d.ts +2 -1
- package/dist/tools/modify.js +2 -1
- package/dist/tools/read/fonts.d.ts.map +1 -1
- package/dist/tools/read/fonts.js +17 -2
- package/dist/tools/read/fonts.js.map +1 -1
- package/dist/tools/read/libraries.js +2 -1
- package/dist/tools/read/libraries.js.map +1 -1
- package/dist/tools/read/nodes.d.ts.map +1 -1
- package/dist/tools/read/nodes.js.map +1 -1
- package/dist/tools/read/space.d.ts +3 -1
- package/dist/tools/read/space.d.ts.map +1 -1
- package/dist/tools/read/space.js +4 -3
- package/dist/tools/read/space.js.map +1 -1
- package/dist/tools/registry/core.d.ts +1 -1
- package/dist/tools/registry/core.d.ts.map +1 -1
- package/dist/tools/registry/core.js +3 -1
- package/dist/tools/registry/core.js.map +1 -1
- package/dist/tools/registry/extended.d.ts.map +1 -1
- package/dist/tools/registry/extended.js +16 -1
- package/dist/tools/registry/extended.js.map +1 -1
- package/dist/tools/schema.d.ts +18 -2
- package/dist/tools/schema.d.ts.map +1 -1
- package/dist/tools/schema.js +1 -1
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/stock-photo.js +1 -0
- package/dist/tools/stock-photo.js.map +1 -1
- package/dist/tools/structure/basic.d.ts.map +1 -1
- package/dist/tools/structure/basic.js +1 -0
- package/dist/tools/structure/basic.js.map +1 -1
- package/dist/tools/structure/batch.d.ts.map +1 -1
- package/dist/tools/structure/batch.js +22 -1
- package/dist/tools/structure/batch.js.map +1 -1
- package/dist/tools/structure/hierarchy.d.ts.map +1 -1
- package/dist/tools/structure/hierarchy.js +4 -0
- package/dist/tools/structure/hierarchy.js.map +1 -1
- package/dist/tools/structure/variations.d.ts +8 -0
- package/dist/tools/structure/variations.d.ts.map +1 -0
- package/dist/tools/structure/variations.js +106 -0
- package/dist/tools/structure/variations.js.map +1 -0
- package/dist/tools/structure.d.ts +2 -1
- package/dist/tools/structure.js +2 -1
- package/dist/tools/styles/types.d.ts +2 -4
- package/dist/tools/styles/types.d.ts.map +1 -1
- package/dist/tools/styles/types.js.map +1 -1
- package/dist/tools/vector/boolean.d.ts.map +1 -1
- package/dist/tools/vector/boolean.js +4 -0
- package/dist/tools/vector/boolean.js.map +1 -1
- package/dist/tools/vector/path.d.ts.map +1 -1
- package/dist/tools/vector/path.js +39 -7
- package/dist/tools/vector/path.js.map +1 -1
- package/dist/tools/vector/vectorize.js +1 -0
- package/dist/tools/vector/vectorize.js.map +1 -1
- package/dist/tools/vector/video.d.ts +6 -0
- package/dist/tools/vector/video.d.ts.map +1 -0
- package/dist/tools/vector/video.js +133 -0
- package/dist/tools/vector/video.js.map +1 -0
- package/dist/tools/vector.d.ts +2 -1
- package/dist/tools/vector.js +2 -1
- package/dist/tools/video-host.d.ts +12 -0
- package/dist/tools/video-host.d.ts.map +1 -0
- package/dist/tools/video-host.js +19 -0
- package/dist/tools/video-host.js.map +1 -0
- package/dist/vector/point-transform.d.ts +1 -1
- package/dist/vector/vectorize/svg/to-vectors.d.ts +1 -1
- package/dist/xpath.d.ts +3 -0
- package/dist/xpath.d.ts.map +1 -1
- package/dist/xpath.js +3 -1
- package/dist/xpath.js.map +1 -1
- package/package.json +31 -9
- package/src/ai/providers.ts +2 -0
- package/src/cache/resource.ts +24 -1
- package/src/canvas/effects.ts +47 -50
- package/src/canvas/fills.ts +19 -15
- package/src/canvas/images/adjustments.ts +203 -0
- package/src/canvas/images/sampling.ts +88 -0
- package/src/canvas/index.ts +1 -0
- package/src/canvas/masks.ts +1 -1
- package/src/canvas/noise/render.ts +75 -0
- package/src/canvas/noise/shader.ts +161 -0
- package/src/canvas/noise/table.ts +91 -0
- package/src/canvas/noise/tile.ts +94 -0
- package/src/canvas/overlays/auto-layout-hover.ts +47 -65
- package/src/canvas/overlays/index.ts +0 -1
- package/src/canvas/overlays/selection.ts +1 -12
- package/src/canvas/renderer/fonts.ts +2 -0
- package/src/canvas/renderer/lifecycle.ts +6 -0
- package/src/canvas/renderer/methods.ts +0 -9
- package/src/canvas/renderer/overlay-pass.ts +0 -1
- package/src/canvas/renderer/pipeline.ts +19 -2
- package/src/canvas/renderer/play-scenes.ts +51 -0
- package/src/canvas/renderer/tiles/cache.ts +54 -1
- package/src/canvas/renderer/tiles/controller.ts +30 -1
- package/src/canvas/renderer/types.ts +18 -3
- package/src/canvas/renderer.ts +40 -4
- package/src/canvas/scene.ts +65 -9
- package/src/canvas/texture.ts +136 -0
- package/src/clipboard.ts +23 -10
- package/src/constants.ts +6 -0
- package/src/design-jsx/index.ts +1 -1
- package/src/design-jsx/renderer.ts +1 -1
- package/src/design-memory/check.ts +376 -0
- package/src/design-memory/describe.ts +77 -0
- package/src/design-memory/distil.ts +69 -0
- package/src/design-memory/document.ts +80 -0
- package/src/design-memory/guard.ts +157 -0
- package/src/design-memory/index.ts +8 -0
- package/src/design-memory/refusal.ts +90 -0
- package/src/design-memory/rules.ts +274 -0
- package/src/design-memory/values.ts +179 -0
- package/src/editor/bridges/components.ts +2 -0
- package/src/editor/clipboard/export.ts +24 -7
- package/src/editor/clipboard/snapshot.ts +21 -4
- package/src/editor/clipboard.ts +4 -14
- package/src/editor/color-space.ts +47 -38
- package/src/editor/components/instances.ts +31 -0
- package/src/editor/create.ts +39 -71
- package/src/editor/design-memory.ts +39 -0
- package/src/editor/design-tokens.ts +41 -2
- package/src/editor/document-colors.ts +65 -0
- package/src/editor/eyedropper.ts +198 -0
- package/src/editor/fonts.ts +19 -0
- package/src/editor/history/atomic-tool.ts +29 -1
- package/src/editor/history/capture.ts +19 -0
- package/src/editor/history/document-change.ts +5 -17
- package/src/editor/history/edit.ts +16 -2
- package/src/editor/history/subtree.ts +13 -2
- package/src/editor/index.ts +11 -0
- package/src/editor/nudge.ts +1 -1
- package/src/editor/pages.ts +40 -29
- package/src/editor/play/states.ts +1 -1
- package/src/editor/read-only/actions.ts +6 -0
- package/src/editor/render-requests.ts +83 -0
- package/src/editor/selection/container.ts +24 -1
- package/src/editor/selection/navigation.ts +8 -6
- package/src/editor/selection/overlays.ts +1 -0
- package/src/editor/shapes/with-text.ts +2 -5
- package/src/editor/structure/auto-layout-wrap.ts +1 -1
- package/src/editor/structure/boolean.ts +1 -3
- package/src/editor/structure/group/bounds.ts +1 -5
- package/src/editor/structure/outline-stroke.ts +3 -3
- package/src/editor/structure/reorder.ts +8 -14
- package/src/editor/structure/state.ts +1 -1
- package/src/editor/structure.ts +5 -8
- package/src/editor/tool-registry.ts +2 -1
- package/src/editor/types.ts +8 -1
- package/src/editor/variables.ts +74 -2
- package/src/editor/variations/create.ts +235 -0
- package/src/editor/variations/pick.ts +35 -0
- package/src/editor/variations.ts +110 -0
- package/src/figma-api/accessors/reactions.ts +11 -1
- package/src/figma-api/accessors/text/index.ts +17 -1
- package/src/figma-api/accessors/text/opentype.ts +33 -0
- package/src/figma-api/accessors/visual.ts +55 -2
- package/src/figma-api/compatibility.ts +5 -2
- package/src/figma-api/effects.ts +143 -5
- package/src/figma-api/fonts/loaded.ts +9 -0
- package/src/figma-api/index.ts +35 -0
- package/src/figma-api/overrides.ts +295 -3
- package/src/figma-api/paints.ts +24 -9
- package/src/figma-api/proxy.ts +6 -1
- package/src/figma-api/reactions.ts +130 -32
- package/src/figma-api/serialization.ts +2 -1
- package/src/figma-api/shape-details.ts +50 -0
- package/src/figma-api/shape-with-text.ts +2 -5
- package/src/figma-api/surface.ts +7 -2
- package/src/global.d.ts +31 -0
- package/src/icons/svg.ts +3 -1
- package/src/io/formats/boolean-path.ts +60 -0
- package/src/io/formats/design-tokens/index.ts +21 -0
- package/src/io/formats/design-tokens/plan/changes.ts +4 -1
- package/src/io/formats/design-tokens/project.ts +40 -9
- package/src/io/formats/design-tokens/styles.ts +10 -2
- package/src/io/formats/design-tokens/sync/apply.ts +130 -0
- package/src/io/formats/design-tokens/sync/drift.ts +587 -0
- package/src/io/formats/design-tokens/sync/files.ts +40 -0
- package/src/io/formats/drawio/edges.ts +65 -0
- package/src/io/formats/drawio/export.ts +37 -14
- package/src/io/formats/drawio/index.ts +5 -1
- package/src/io/formats/fig/export/patch/index.ts +8 -0
- package/src/io/formats/fig/thumbnail-page.ts +4 -4
- package/src/io/formats/html/import.ts +9 -1
- package/src/io/formats/html/index.ts +14 -7
- package/src/io/formats/html/layers.ts +11 -2
- package/src/io/formats/html/vectors.ts +8 -2
- package/src/io/formats/pdf/document.ts +14 -4
- package/src/io/formats/pdf/dom.ts +10 -18
- package/src/io/formats/pdf/export.ts +1 -1
- package/src/io/formats/pen/imports.ts +5 -6
- package/src/io/formats/pen/index.ts +36 -5
- package/src/io/formats/raster/adjusted-images.ts +125 -0
- package/src/io/formats/raster/headless.ts +3 -3
- package/src/io/formats/raster/index.ts +6 -1
- package/src/io/formats/raster/pixels.ts +7 -0
- package/src/io/formats/raster/render.ts +12 -1
- package/src/io/formats/svg/defs.ts +14 -73
- package/src/io/formats/svg/effects.ts +131 -0
- package/src/io/formats/svg/export.ts +371 -64
- package/src/io/formats/svg/filter.ts +47 -0
- package/src/io/formats/svg/grain.ts +249 -0
- package/src/io/formats/svg/strokes.ts +2 -2
- package/src/io/formats/svg/text/layout.ts +13 -3
- package/src/io/formats/video/composite.ts +79 -0
- package/src/io/formats/video/formats.ts +77 -0
- package/src/io/formats/video/gif.ts +65 -0
- package/src/io/formats/video/index.ts +30 -0
- package/src/io/formats/video/plan.ts +116 -0
- package/src/io/formats/video/record.ts +227 -0
- package/src/io/formats/video/sink.ts +32 -0
- package/src/io/formats/video/size.ts +25 -0
- package/src/io/formats/video/webcodecs.ts +89 -0
- package/src/io/formats.ts +59 -11
- package/src/io/types.ts +29 -10
- package/src/layout/apply.ts +87 -21
- package/src/layout/auto-layout-handles.ts +396 -0
- package/src/layout/derived.ts +14 -0
- package/src/layout/grid.ts +33 -9
- package/src/layout/mutations.ts +13 -1
- package/src/layout/strokes.ts +12 -0
- package/src/layout/yoga-helpers.ts +18 -1
- package/src/layout.ts +96 -49
- package/src/lint/fixes.ts +12 -3
- package/src/lint/index.ts +3 -1
- package/src/lint/linter.ts +124 -12
- package/src/lint/presets.ts +2 -0
- package/src/lint/rules/design-memory.ts +97 -0
- package/src/lint/rules/effect-style-required.ts +2 -0
- package/src/lint/rules/index.ts +6 -1
- package/src/lint/rules/no-unbound-token-values.ts +73 -0
- package/src/lint/rules/text-style-required.ts +2 -0
- package/src/lint/types.ts +40 -0
- package/src/node/video.ts +196 -0
- package/src/pairdraw-api/design-memory.ts +61 -0
- package/src/pairdraw-api/index.ts +81 -0
- package/src/pairdraw-api/nodes.ts +38 -0
- package/src/pairdraw-api/variations.ts +109 -0
- package/src/prototype/easing.ts +37 -0
- package/src/prototype/frames.ts +9 -0
- package/src/prototype/hit.ts +70 -0
- package/src/prototype/index.ts +69 -0
- package/src/prototype/pointer.ts +146 -0
- package/src/prototype/reactions.ts +178 -0
- package/src/prototype/scene.ts +116 -0
- package/src/prototype/scenes.ts +256 -0
- package/src/prototype/scroll.ts +190 -0
- package/src/prototype/session.ts +188 -0
- package/src/prototype/smart-animate/animation.ts +267 -0
- package/src/prototype/smart-animate/match.ts +85 -0
- package/src/prototype/snapshot.ts +60 -0
- package/src/prototype/timeline.ts +400 -0
- package/src/rpc/index.ts +1 -0
- package/src/rpc/read-commands.ts +40 -23
- package/src/text/font/faces.ts +22 -0
- package/src/text/font/features.ts +27 -0
- package/src/text/font/manager.ts +88 -12
- package/src/text/index.ts +2 -0
- package/src/text/replace-fonts.ts +171 -0
- package/src/tools/analyze/responsive/index.ts +264 -0
- package/src/tools/analyze.ts +2 -0
- package/src/tools/codegen/token-sync.ts +98 -0
- package/src/tools/codegen.ts +1 -0
- package/src/tools/create/components.ts +4 -0
- package/src/tools/create/html.ts +1 -0
- package/src/tools/create/icons.ts +1 -0
- package/src/tools/create/mermaid.ts +1 -0
- package/src/tools/create/svg.ts +1 -0
- package/src/tools/design-memory.ts +72 -0
- package/src/tools/image-ai/generate.ts +2 -0
- package/src/tools/index.ts +1 -0
- package/src/tools/modify/fonts.ts +34 -0
- package/src/tools/modify/layout.ts +5 -0
- package/src/tools/modify/reactions.ts +15 -8
- package/src/tools/modify/text.ts +42 -5
- package/src/tools/modify/update.ts +46 -2
- package/src/tools/modify.ts +1 -0
- package/src/tools/read/fonts.ts +24 -2
- package/src/tools/read/libraries.ts +1 -0
- package/src/tools/read/nodes.ts +0 -1
- package/src/tools/read/space.ts +3 -2
- package/src/tools/registry/core.ts +3 -1
- package/src/tools/registry/extended.ts +28 -1
- package/src/tools/schema.ts +28 -4
- package/src/tools/stock-photo.ts +1 -0
- package/src/tools/structure/basic.ts +1 -0
- package/src/tools/structure/batch.ts +34 -1
- package/src/tools/structure/hierarchy.ts +4 -0
- package/src/tools/structure/variations.ts +118 -0
- package/src/tools/structure.ts +2 -0
- package/src/tools/styles/types.ts +3 -4
- package/src/tools/vector/boolean.ts +4 -0
- package/src/tools/vector/path.ts +30 -6
- package/src/tools/vector/vectorize.ts +1 -0
- package/src/tools/vector/video.ts +228 -0
- package/src/tools/vector.ts +1 -0
- package/src/tools/video-host.ts +18 -0
- package/src/xpath.ts +6 -1
|
@@ -26,7 +26,7 @@ export function createStructureStateActions(ctx: EditorContext) {
|
|
|
26
26
|
ctx.graph.updateNode(id, { visible: shown })
|
|
27
27
|
const parentId = ctx.graph.getNode(id)?.parentId
|
|
28
28
|
if (!parentId) return
|
|
29
|
-
ctx.
|
|
29
|
+
ctx.runLayoutForParents([parentId])
|
|
30
30
|
refitGroupsAroundLayers(ctx, [id])
|
|
31
31
|
}
|
|
32
32
|
const forward = () => {
|
package/src/editor/structure.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { pick } from 'es-toolkit'
|
|
2
2
|
|
|
3
|
-
import type { SceneNode } from '@pairdraw/scene-graph'
|
|
3
|
+
import type { BooleanOperation, SceneNode } from '@pairdraw/scene-graph'
|
|
4
4
|
import { TRANSFORM_FIELDS } from '@pairdraw/scene-graph/fields'
|
|
5
5
|
import { createsComponentCycle } from '@pairdraw/scene-graph/instances'
|
|
6
6
|
import { defaultNodeName } from '@pairdraw/scene-graph/node-defaults'
|
|
@@ -9,10 +9,7 @@ import { acceptingParent, acceptsChildren, prepareSlotEdits } from '#core/editor
|
|
|
9
9
|
import { fitEnclosingGroupsWithUndo } from '#core/editor/structure/group/bounds'
|
|
10
10
|
|
|
11
11
|
import { wrapInAutoLayout as wrapInAutoLayoutImpl } from './structure/auto-layout-wrap'
|
|
12
|
-
import {
|
|
13
|
-
booleanOperationSelected as booleanOperationSelectedImpl,
|
|
14
|
-
type BooleanOperation
|
|
15
|
-
} from './structure/boolean'
|
|
12
|
+
import { booleanOperationSelected as booleanOperationSelectedImpl } from './structure/boolean'
|
|
16
13
|
import { wrapSelectionInContainer as wrapSelectionInContainerImpl } from './structure/container-wrap'
|
|
17
14
|
import { flattenSelected as flattenSelectedImpl } from './structure/flatten'
|
|
18
15
|
import { ungroupSelected as ungroupImpl } from './structure/group/ungroup'
|
|
@@ -167,11 +164,11 @@ export function createStructureActions(ctx: EditorContext) {
|
|
|
167
164
|
})
|
|
168
165
|
.sort((a, b) => a.index - b.index)
|
|
169
166
|
if (origins.length === 0) return
|
|
170
|
-
const parentIds =
|
|
167
|
+
const parentIds = origins.map((origin) => origin.parentId)
|
|
171
168
|
const prevSelection = new Set(ctx.state.selectedIds)
|
|
172
169
|
const move = () => {
|
|
173
170
|
for (const { id } of origins) ctx.graph.reparentNode(id, pageId)
|
|
174
|
-
|
|
171
|
+
ctx.runLayoutForParents(parentIds)
|
|
175
172
|
ctx.setSelectedIds(new Set())
|
|
176
173
|
}
|
|
177
174
|
move()
|
|
@@ -185,7 +182,7 @@ export function createStructureActions(ctx: EditorContext) {
|
|
|
185
182
|
ctx.graph.insertChildAt(id, parentId, index)
|
|
186
183
|
ctx.graph.updateNode(id, place)
|
|
187
184
|
}
|
|
188
|
-
|
|
185
|
+
ctx.runLayoutForParents(parentIds)
|
|
189
186
|
ctx.setSelectedIds(new Set(prevSelection))
|
|
190
187
|
}
|
|
191
188
|
})
|
package/src/editor/types.ts
CHANGED
|
@@ -15,7 +15,7 @@ import type { SceneMutationImpact } from '@pairdraw/scene-graph/mutation-impact'
|
|
|
15
15
|
import type { Color, Rect, Vector } from '@pairdraw/scene-graph/primitives'
|
|
16
16
|
import type { ShapeWithTextType } from '@pairdraw/scene-graph/shape-with-text'
|
|
17
17
|
import type { SnapGuide } from '@pairdraw/scene-graph/snap'
|
|
18
|
-
import type { UndoManager } from '@pairdraw/scene-graph/undo'
|
|
18
|
+
import type { UndoEntry, UndoManager } from '@pairdraw/scene-graph/undo'
|
|
19
19
|
|
|
20
20
|
import type { GuideOverlayState } from '#core/canvas/guides/types'
|
|
21
21
|
import type { DesignIssueHighlight } from '#core/canvas/issues/types'
|
|
@@ -57,6 +57,8 @@ export type Tool =
|
|
|
57
57
|
| 'ZOOM'
|
|
58
58
|
/** Figma's K: handles scale layers with their text, strokes, effects, and spacing. */
|
|
59
59
|
| 'SCALE'
|
|
60
|
+
/** Figma's I: samples the colour the document shows at the pointer into the selection. */
|
|
61
|
+
| 'EYEDROPPER'
|
|
60
62
|
|
|
61
63
|
/** The gradient whose handles the canvas shows while its paint picker is open. */
|
|
62
64
|
export interface GradientEdit {
|
|
@@ -187,6 +189,8 @@ export interface EditorViewState {
|
|
|
187
189
|
autoLayoutHover: {
|
|
188
190
|
nodeId: string
|
|
189
191
|
kind: 'frame' | 'children' | 'spacing' | 'spacing-value' | 'padding' | 'padding-value'
|
|
192
|
+
/** For a gap: the flow axis whose spacing it edits. */
|
|
193
|
+
axis?: 'primary' | 'counter'
|
|
190
194
|
index?: number
|
|
191
195
|
side?: 'top' | 'right' | 'bottom' | 'left'
|
|
192
196
|
} | null
|
|
@@ -305,6 +309,8 @@ export interface EditorContext {
|
|
|
305
309
|
get graph(): SceneGraph
|
|
306
310
|
set graph(g: SceneGraph)
|
|
307
311
|
undo: UndoManager
|
|
312
|
+
/** Adds a step to the history of a graph that is not the open one, kept aside with it. */
|
|
313
|
+
parkStep: (graph: SceneGraph, entry: UndoEntry) => void
|
|
308
314
|
state: EditorState
|
|
309
315
|
loadFont: (
|
|
310
316
|
family: string,
|
|
@@ -336,6 +342,7 @@ export interface EditorContext {
|
|
|
336
342
|
setActiveTool: (tool: Tool) => void
|
|
337
343
|
setNavigationPhase: (phase: NavigationPhase, inputAt?: number) => void
|
|
338
344
|
runLayoutForNode: (id: string) => void
|
|
345
|
+
runLayoutForParents: (parentIds: Iterable<string>) => void
|
|
339
346
|
runMutationWithLayout: <T>(
|
|
340
347
|
operation: () => T | Promise<T>,
|
|
341
348
|
fallbackId?: string,
|
package/src/editor/variables.ts
CHANGED
|
@@ -9,7 +9,13 @@ import {
|
|
|
9
9
|
type VariableType,
|
|
10
10
|
type VariableValue
|
|
11
11
|
} from '@pairdraw/scene-graph'
|
|
12
|
-
import {
|
|
12
|
+
import { findInstanceAncestor } from '@pairdraw/scene-graph/instances'
|
|
13
|
+
import { cloneInstanceOverrideState } from '@pairdraw/scene-graph/instances/overrides'
|
|
14
|
+
import {
|
|
15
|
+
tokenExpressionForValue,
|
|
16
|
+
variableBindingOwner,
|
|
17
|
+
type BindingScope
|
|
18
|
+
} from '@pairdraw/scene-graph/variables'
|
|
13
19
|
|
|
14
20
|
import { reconcileVariableLayouts } from '#core/layout/variables'
|
|
15
21
|
|
|
@@ -168,6 +174,14 @@ export function createVariableActions(ctx: EditorContext) {
|
|
|
168
174
|
.map((vid) => ctx.graph.variables.get(vid))
|
|
169
175
|
.filter((v): v is Variable => v != null)
|
|
170
176
|
.map((v) => structuredClone(v))
|
|
177
|
+
const bindings = bindingSnapshots(snapshot.variableIds)
|
|
178
|
+
// The mode the collection showed and the one each layer chose, which the removal drops, so
|
|
179
|
+
// undo resolves the restored bindings to the values they had before it.
|
|
180
|
+
const activeMode = ctx.graph.activeMode.get(id)
|
|
181
|
+
const modeChoices = new Map<string, string>()
|
|
182
|
+
for (const node of ctx.graph.getAllNodes()) {
|
|
183
|
+
if (Object.hasOwn(node.variableModes, id)) modeChoices.set(node.id, node.variableModes[id])
|
|
184
|
+
}
|
|
171
185
|
ctx.graph.removeCollection(id)
|
|
172
186
|
ctx.undo.push({
|
|
173
187
|
label: 'Remove collection',
|
|
@@ -178,6 +192,15 @@ export function createVariableActions(ctx: EditorContext) {
|
|
|
178
192
|
inverse: () => {
|
|
179
193
|
ctx.graph.addCollection(snapshot)
|
|
180
194
|
for (const v of variables) ctx.graph.addVariable(v)
|
|
195
|
+
if (activeMode !== undefined) ctx.graph.setActiveMode(id, activeMode)
|
|
196
|
+
for (const [nodeId, modeId] of modeChoices) {
|
|
197
|
+
const node = ctx.graph.getNode(nodeId)
|
|
198
|
+
if (!node) continue
|
|
199
|
+
ctx.graph.updateNode(nodeId, {
|
|
200
|
+
variableModes: { ...node.variableModes, [id]: modeId }
|
|
201
|
+
})
|
|
202
|
+
}
|
|
203
|
+
restoreBindings(bindings)
|
|
181
204
|
refreshVariables(scope)
|
|
182
205
|
}
|
|
183
206
|
})
|
|
@@ -200,11 +223,58 @@ export function createVariableActions(ctx: EditorContext) {
|
|
|
200
223
|
ctx.requestRefresh()
|
|
201
224
|
}
|
|
202
225
|
|
|
226
|
+
/**
|
|
227
|
+
* The bindings removing these variables strips from layers, and the instance overrides it
|
|
228
|
+
* records, so undo can put both back. A layer keeps the value its variable last gave it.
|
|
229
|
+
*/
|
|
230
|
+
function bindingSnapshots(ids: Iterable<string>) {
|
|
231
|
+
const removed = new Set(ids)
|
|
232
|
+
const snapshots = []
|
|
233
|
+
for (const node of ctx.graph.getAllNodes()) {
|
|
234
|
+
const entries = Object.entries(node.boundVariables).filter(([, id]) => removed.has(id))
|
|
235
|
+
if (entries.length === 0) continue
|
|
236
|
+
const owner = variableBindingOwner(ctx.graph, node)
|
|
237
|
+
const nearest = findInstanceAncestor(ctx.graph, node.id)
|
|
238
|
+
snapshots.push({
|
|
239
|
+
nodeId: node.id,
|
|
240
|
+
boundVariables: Object.fromEntries(entries),
|
|
241
|
+
variableBindingScales: Object.fromEntries(
|
|
242
|
+
entries
|
|
243
|
+
.map(([field]) => field)
|
|
244
|
+
.filter((field) => field in node.variableBindingScales)
|
|
245
|
+
.map((field) => [field, node.variableBindingScales[field]])
|
|
246
|
+
),
|
|
247
|
+
owners: new Map(
|
|
248
|
+
[owner, ...(nearest ? [nearest] : [])].map((item) => [
|
|
249
|
+
item.id,
|
|
250
|
+
cloneInstanceOverrideState(item.instanceOverrides)
|
|
251
|
+
])
|
|
252
|
+
)
|
|
253
|
+
})
|
|
254
|
+
}
|
|
255
|
+
return snapshots
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function restoreBindings(snapshots: ReturnType<typeof bindingSnapshots>) {
|
|
259
|
+
for (const snapshot of snapshots) {
|
|
260
|
+
for (const [ownerId, state] of snapshot.owners) {
|
|
261
|
+
ctx.graph.updateNode(ownerId, { instanceOverrides: cloneInstanceOverrideState(state) })
|
|
262
|
+
}
|
|
263
|
+
const node = ctx.graph.getNode(snapshot.nodeId)
|
|
264
|
+
if (!node) continue
|
|
265
|
+
ctx.graph.updateNode(snapshot.nodeId, {
|
|
266
|
+
boundVariables: { ...node.boundVariables, ...snapshot.boundVariables },
|
|
267
|
+
variableBindingScales: { ...node.variableBindingScales, ...snapshot.variableBindingScales }
|
|
268
|
+
})
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
203
272
|
function removeVariable(id: string) {
|
|
204
273
|
const variable = ctx.graph.variables.get(id)
|
|
205
274
|
if (!variable) return
|
|
206
275
|
const snapshot = structuredClone(variable)
|
|
207
276
|
const order = [...(ctx.graph.variableCollections.get(variable.collectionId)?.variableIds ?? [])]
|
|
277
|
+
const bindings = bindingSnapshots([id])
|
|
208
278
|
ctx.graph.removeVariable(id)
|
|
209
279
|
ctx.undo.push({
|
|
210
280
|
label: 'Remove variable',
|
|
@@ -212,10 +282,12 @@ export function createVariableActions(ctx: EditorContext) {
|
|
|
212
282
|
ctx.graph.removeVariable(id)
|
|
213
283
|
refreshVariables({ variables: [id] })
|
|
214
284
|
},
|
|
215
|
-
// Undo puts the variable back where it was, not at the end of its collection
|
|
285
|
+
// Undo puts the variable back where it was, not at the end of its collection, with the
|
|
286
|
+
// bindings deleting it stripped.
|
|
216
287
|
inverse: () => {
|
|
217
288
|
ctx.graph.addVariable(structuredClone(snapshot))
|
|
218
289
|
placeVariables(snapshot.collectionId, order)
|
|
290
|
+
restoreBindings(bindings)
|
|
219
291
|
refreshVariables({ variables: [id] })
|
|
220
292
|
}
|
|
221
293
|
})
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
2
|
+
import { getAxisAlignedBoundsInParent } from '@pairdraw/scene-graph/coordinate'
|
|
3
|
+
import { findInstanceAncestor } from '@pairdraw/scene-graph/instances'
|
|
4
|
+
import type { Rect, Size } from '@pairdraw/scene-graph/primitives'
|
|
5
|
+
import { resolvedVariableModes } from '@pairdraw/scene-graph/variables'
|
|
6
|
+
import {
|
|
7
|
+
VARIATION_LABEL_MAX_LENGTH,
|
|
8
|
+
VARIATION_MAX_COUNT,
|
|
9
|
+
VARIATION_MAX_LAYERS,
|
|
10
|
+
copyVersion,
|
|
11
|
+
readVariationSet,
|
|
12
|
+
variationFingerprint,
|
|
13
|
+
variationSetForOriginal,
|
|
14
|
+
variationSetOf,
|
|
15
|
+
versionOf,
|
|
16
|
+
withVariationSet
|
|
17
|
+
} from '@pairdraw/scene-graph/variations'
|
|
18
|
+
|
|
19
|
+
import { getNodeEditCapability } from '#core/editor/capabilities'
|
|
20
|
+
import { findEmptySpace, rectsOverlap } from '#core/tools/read/space'
|
|
21
|
+
|
|
22
|
+
/** Room around the versions inside their section, and between them. */
|
|
23
|
+
export const VARIATION_SECTION_PADDING = 80
|
|
24
|
+
export const VARIATION_GAP = 80
|
|
25
|
+
|
|
26
|
+
export interface VariationRequest {
|
|
27
|
+
/** How many versions to make, 1 to {@link VARIATION_MAX_COUNT}. */
|
|
28
|
+
count: number
|
|
29
|
+
/** What each version tries, named in its layer: `V2 · Calmer palette`. */
|
|
30
|
+
labels?: readonly string[]
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface CreatedVariations {
|
|
34
|
+
sectionId: string
|
|
35
|
+
originalId: string
|
|
36
|
+
/** The versions this request made, in order. */
|
|
37
|
+
versions: SceneNode[]
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const SECTION_REFUSAL = 'A section cannot be varied; select a frame inside it'
|
|
41
|
+
|
|
42
|
+
const UNVARIED_TYPES: Partial<Record<SceneNode['type'], string>> = {
|
|
43
|
+
CANVAS: 'A page cannot be varied; select a layer on it',
|
|
44
|
+
SECTION: SECTION_REFUSAL,
|
|
45
|
+
COMPONENT_SET: 'A component set cannot be varied; select one of its variants'
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface VariationSource {
|
|
49
|
+
/** The layer the versions copy: the original, or one of its versions. */
|
|
50
|
+
source: SceneNode
|
|
51
|
+
original: SceneNode
|
|
52
|
+
/** The set the versions join, or undefined when the request makes it. */
|
|
53
|
+
section: SceneNode | undefined
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* What a request on `node` copies: the version holding it, or the layer itself; or why it
|
|
58
|
+
* cannot be varied.
|
|
59
|
+
*/
|
|
60
|
+
function variationSource(graph: SceneGraph, node: SceneNode): VariationSource | string {
|
|
61
|
+
const view = variationSetOf(graph, node.id)
|
|
62
|
+
if (view) {
|
|
63
|
+
const version = versionOf(graph, view, node.id)
|
|
64
|
+
if (!version) return SECTION_REFUSAL
|
|
65
|
+
if (!view.original) return 'The layer these are variations of is gone'
|
|
66
|
+
return { source: version, original: view.original, section: view.section }
|
|
67
|
+
}
|
|
68
|
+
const refusal = UNVARIED_TYPES[node.type]
|
|
69
|
+
if (refusal) return refusal
|
|
70
|
+
if (node.parentId && findInstanceAncestor(graph, node.parentId)) {
|
|
71
|
+
return 'A layer inside an instance cannot be varied; vary the instance or its main component'
|
|
72
|
+
}
|
|
73
|
+
if (!getNodeEditCapability(graph, node.id).editable) {
|
|
74
|
+
return `"${node.name}" belongs to a library and cannot be changed here`
|
|
75
|
+
}
|
|
76
|
+
return { source: node, original: node, section: variationSetForOriginal(graph, node.id)?.section }
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Why `nodeId` cannot be varied, or null when it can. */
|
|
80
|
+
export function variationRefusal(graph: SceneGraph, nodeId: string): string | null {
|
|
81
|
+
const node = graph.getNode(nodeId)
|
|
82
|
+
if (!node) return `Node "${nodeId}" not found`
|
|
83
|
+
const found = variationSource(graph, node)
|
|
84
|
+
return typeof found === 'string' ? found : null
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function checkRequest(graph: SceneGraph, source: SceneNode, request: VariationRequest) {
|
|
88
|
+
const { count, labels = [] } = request
|
|
89
|
+
if (!Number.isInteger(count) || count < 1 || count > VARIATION_MAX_COUNT) {
|
|
90
|
+
throw new Error(`Ask for 1 to ${VARIATION_MAX_COUNT} versions, not ${count}`)
|
|
91
|
+
}
|
|
92
|
+
if (labels.length > count) throw new Error(`${labels.length} labels for ${count} versions`)
|
|
93
|
+
const long = labels.find((label) => label.trim().length > VARIATION_LABEL_MAX_LENGTH)
|
|
94
|
+
if (long !== undefined) {
|
|
95
|
+
throw new Error(`Label "${long}" is longer than ${VARIATION_LABEL_MAX_LENGTH} characters`)
|
|
96
|
+
}
|
|
97
|
+
const layers = graph.countDescendants(source.id) + 1
|
|
98
|
+
if (layers * count > VARIATION_MAX_LAYERS) {
|
|
99
|
+
throw new Error(
|
|
100
|
+
`${count} copies of ${layers} layers make ${layers * count} layers, more than the ` +
|
|
101
|
+
`${VARIATION_MAX_LAYERS} one request may copy; ask for fewer versions or vary a smaller layer`
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function rowSize(width: number, height: number, count: number) {
|
|
107
|
+
return {
|
|
108
|
+
width: VARIATION_SECTION_PADDING * 2 + count * width + (count - 1) * VARIATION_GAP,
|
|
109
|
+
height: VARIATION_SECTION_PADDING * 2 + height
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** The page's top-level layers but `sectionId`, as boxes a section must stay clear of. */
|
|
114
|
+
function pageObstacles(graph: SceneGraph, pageId: string, sectionId?: string): Rect[] {
|
|
115
|
+
return graph
|
|
116
|
+
.getChildren(pageId)
|
|
117
|
+
.filter((node) => node.id !== sectionId)
|
|
118
|
+
.map((node) => getAxisAlignedBoundsInParent([node], pageId, graph))
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** The free spot of `size` nearest the original's top-level layer, right of it or below it. */
|
|
122
|
+
function spaceBeside(
|
|
123
|
+
graph: SceneGraph,
|
|
124
|
+
pageId: string,
|
|
125
|
+
original: SceneNode,
|
|
126
|
+
size: Size,
|
|
127
|
+
sectionId?: string
|
|
128
|
+
) {
|
|
129
|
+
const topLevel = graph.closest(original.id, (node) => node.parentId === pageId) ?? original
|
|
130
|
+
return findEmptySpace({
|
|
131
|
+
obstacles: pageObstacles(graph, pageId, sectionId),
|
|
132
|
+
...size,
|
|
133
|
+
anchor: getAxisAlignedBoundsInParent([topLevel], pageId, graph),
|
|
134
|
+
gap: VARIATION_GAP,
|
|
135
|
+
directions: ['right', 'below']
|
|
136
|
+
})
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Gives the section `size`. It grows where it is while that covers no other layer on the page,
|
|
141
|
+
* and otherwise moves to the free spot nearest the original, where a new set would go.
|
|
142
|
+
*/
|
|
143
|
+
function fitSection(graph: SceneGraph, section: SceneNode, original: SceneNode, size: Size) {
|
|
144
|
+
const pageId = section.parentId
|
|
145
|
+
if (!pageId) return
|
|
146
|
+
const grown = { x: section.x, y: section.y, ...size }
|
|
147
|
+
const covers = pageObstacles(graph, pageId, section.id).some((box) => rectsOverlap(grown, box, 0))
|
|
148
|
+
const space = covers ? spaceBeside(graph, pageId, original, size, section.id) : grown
|
|
149
|
+
graph.updateNode(section.id, { x: space.x, y: space.y, ...size })
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** A new marked section beside the original's top-level layer, sized for `count` copies. */
|
|
153
|
+
function createSection(graph: SceneGraph, original: SceneNode, source: SceneNode, count: number) {
|
|
154
|
+
const pageId = graph.pageOf(original.id)
|
|
155
|
+
if (!pageId) throw new Error(`"${original.name}" is on no page`)
|
|
156
|
+
const size = rowSize(source.width, source.height, count)
|
|
157
|
+
const space = spaceBeside(graph, pageId, original, size)
|
|
158
|
+
const section = graph.createNode('SECTION', pageId, {
|
|
159
|
+
name: `Variations · ${original.name}`,
|
|
160
|
+
x: space.x,
|
|
161
|
+
y: space.y,
|
|
162
|
+
...size,
|
|
163
|
+
// The copies show in the modes the original shows in from its ancestors.
|
|
164
|
+
variableModes: original.parentId ? resolvedVariableModes(graph, original.parentId) : {}
|
|
165
|
+
})
|
|
166
|
+
graph.updateNode(section.id, {
|
|
167
|
+
pluginData: withVariationSet(section, {
|
|
168
|
+
version: 1,
|
|
169
|
+
originalId: original.id,
|
|
170
|
+
originalFingerprint: variationFingerprint(graph, original.id)
|
|
171
|
+
})
|
|
172
|
+
})
|
|
173
|
+
return section
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function versionName(index: number, label: string | undefined): string {
|
|
177
|
+
const text = label?.trim()
|
|
178
|
+
return text ? `V${index} · ${text}` : `V${index}`
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Copies a layer `request.count` times into the section of variations beside it, made the first
|
|
183
|
+
* time, in a row after the versions already there. On a version, it copies that version into
|
|
184
|
+
* its own set. The original is not changed. The caller records the edit as one step.
|
|
185
|
+
*/
|
|
186
|
+
export function createVariations(
|
|
187
|
+
graph: SceneGraph,
|
|
188
|
+
nodeId: string,
|
|
189
|
+
request: VariationRequest
|
|
190
|
+
): CreatedVariations {
|
|
191
|
+
const node = graph.getNode(nodeId)
|
|
192
|
+
if (!node) throw new Error(`Node "${nodeId}" not found`)
|
|
193
|
+
const found = variationSource(graph, node)
|
|
194
|
+
if (typeof found === 'string') throw new Error(found)
|
|
195
|
+
const { source, original } = found
|
|
196
|
+
checkRequest(graph, source, request)
|
|
197
|
+
const section = found.section ?? createSection(graph, original, source, request.count)
|
|
198
|
+
const set = found.section ? readVariationSet(found.section) : null
|
|
199
|
+
if (set) {
|
|
200
|
+
// The newest versions start from the original as it is now.
|
|
201
|
+
const originalFingerprint = variationFingerprint(graph, original.id)
|
|
202
|
+
graph.updateNode(section.id, {
|
|
203
|
+
pluginData: withVariationSet(section, { ...set, originalFingerprint })
|
|
204
|
+
})
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const existing = graph.getChildren(section.id)
|
|
208
|
+
const right = Math.max(
|
|
209
|
+
VARIATION_SECTION_PADDING - VARIATION_GAP,
|
|
210
|
+
...existing.map((version) => version.x + version.width)
|
|
211
|
+
)
|
|
212
|
+
const versions: SceneNode[] = []
|
|
213
|
+
for (let index = 0; index < request.count; index++) {
|
|
214
|
+
const copy = copyVersion(graph, source.id, section.id, {
|
|
215
|
+
name: versionName(existing.length + index + 1, request.labels?.[index]),
|
|
216
|
+
x: right + VARIATION_GAP + index * (source.width + VARIATION_GAP),
|
|
217
|
+
y: VARIATION_SECTION_PADDING,
|
|
218
|
+
rotation: 0,
|
|
219
|
+
visible: true,
|
|
220
|
+
locked: false
|
|
221
|
+
})
|
|
222
|
+
if (!copy) continue
|
|
223
|
+
versions.push(copy)
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const last = versions.at(-1)
|
|
227
|
+
if (last) {
|
|
228
|
+
const bottom = Math.max(...graph.getChildren(section.id).map((v) => v.y + v.height))
|
|
229
|
+
fitSection(graph, section, original, {
|
|
230
|
+
width: Math.max(section.width, last.x + last.width + VARIATION_SECTION_PADDING),
|
|
231
|
+
height: Math.max(section.height, bottom + VARIATION_SECTION_PADDING)
|
|
232
|
+
})
|
|
233
|
+
}
|
|
234
|
+
return { sectionId: section.id, originalId: original.id, versions }
|
|
235
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { SceneGraph } from '@pairdraw/scene-graph'
|
|
2
|
+
import {
|
|
3
|
+
VariationError,
|
|
4
|
+
variationPickProblem,
|
|
5
|
+
variationToPick,
|
|
6
|
+
type VariationPickProblem,
|
|
7
|
+
type VariationSetView
|
|
8
|
+
} from '@pairdraw/scene-graph/variations'
|
|
9
|
+
|
|
10
|
+
import { assertNodeEditable, getNodeEditCapability } from '#core/editor/capabilities'
|
|
11
|
+
|
|
12
|
+
/** Why a version cannot replace its original, including an original a library owns. */
|
|
13
|
+
export type PickProblem = VariationPickProblem | 'original-not-editable'
|
|
14
|
+
|
|
15
|
+
/** Why `versionId` cannot replace the original of `view`, or null when it can. */
|
|
16
|
+
export function pickProblemOf(
|
|
17
|
+
graph: SceneGraph,
|
|
18
|
+
view: VariationSetView,
|
|
19
|
+
versionId: string
|
|
20
|
+
): PickProblem | null {
|
|
21
|
+
const problem = variationPickProblem(graph, view, versionId)
|
|
22
|
+
if (problem || !view.original) return problem
|
|
23
|
+
return getNodeEditCapability(graph, view.original.id).editable ? null : 'original-not-editable'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Throws the reason `versionId` cannot replace its original, before anything changes: a layer
|
|
28
|
+
* outside a set, the section itself, or an original that is gone, locked, inside an instance,
|
|
29
|
+
* of another type than the version, or owned by a library.
|
|
30
|
+
*/
|
|
31
|
+
export function assertVariationPickable(graph: SceneGraph, versionId: string): void {
|
|
32
|
+
const { view, problem } = variationToPick(graph, versionId)
|
|
33
|
+
if (problem) throw new VariationError(problem, versionId)
|
|
34
|
+
if (view.original) assertNodeEditable(graph, view.original.id)
|
|
35
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import {
|
|
2
|
+
applyVariation,
|
|
3
|
+
discardVariations as discardVariationSet,
|
|
4
|
+
originalChangedSince,
|
|
5
|
+
variationSetOf,
|
|
6
|
+
versionOf,
|
|
7
|
+
type VariationSetView
|
|
8
|
+
} from '@pairdraw/scene-graph/variations'
|
|
9
|
+
|
|
10
|
+
import { recordEdit } from './history/edit'
|
|
11
|
+
import type { EditorContext } from './types'
|
|
12
|
+
import {
|
|
13
|
+
createVariations,
|
|
14
|
+
variationRefusal,
|
|
15
|
+
type CreatedVariations,
|
|
16
|
+
type VariationRequest
|
|
17
|
+
} from './variations/create'
|
|
18
|
+
import { assertVariationPickable, pickProblemOf, type PickProblem } from './variations/pick'
|
|
19
|
+
|
|
20
|
+
/** A set of variations as panels show it, from wherever in it the selection is. */
|
|
21
|
+
export interface VariationSetState extends VariationSetView {
|
|
22
|
+
/** The version holding the layer asked about, or null for the section itself. */
|
|
23
|
+
version: VariationSetView['versions'][number] | null
|
|
24
|
+
/** Why that version cannot replace the original, or null when it can. */
|
|
25
|
+
pickProblem: PickProblem | null
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Sets of variations: copies of a layer side by side in a section beside it, one of which can
|
|
30
|
+
* replace it. Each command is one undo step.
|
|
31
|
+
*/
|
|
32
|
+
export function createVariationActions(ctx: EditorContext) {
|
|
33
|
+
/** The set `nodeId` belongs to, with the version holding it, or null outside every set. */
|
|
34
|
+
function getVariationSet(nodeId: string): VariationSetState | null {
|
|
35
|
+
const view = variationSetOf(ctx.graph, nodeId)
|
|
36
|
+
if (!view) return null
|
|
37
|
+
const version = versionOf(ctx.graph, view, nodeId)
|
|
38
|
+
return {
|
|
39
|
+
...view,
|
|
40
|
+
version,
|
|
41
|
+
pickProblem: version ? pickProblemOf(ctx.graph, view, version.id) : 'not-a-version'
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Whether the original of the set holding `nodeId` looks different from when its newest
|
|
47
|
+
* versions were made. It walks the original's layers, so panels ask when they show a set
|
|
48
|
+
* rather than on every edit.
|
|
49
|
+
*/
|
|
50
|
+
function isVariationOriginalChanged(nodeId: string): boolean {
|
|
51
|
+
const view = variationSetOf(ctx.graph, nodeId)
|
|
52
|
+
return view ? originalChangedSince(ctx.graph, view) : false
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Whether `nodeId` can be varied: copied into a set of variations beside it. */
|
|
56
|
+
function canCreateVariations(nodeId: string): boolean {
|
|
57
|
+
return variationRefusal(ctx.graph, nodeId) === null
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Copies `nodeId` into its set of variations, as `create_variations` does. */
|
|
61
|
+
function createVariationsOf(nodeId: string, request: VariationRequest): CreatedVariations {
|
|
62
|
+
const created = recordEdit(ctx, { label: 'Create variations', rollbackOnThrow: true }, () =>
|
|
63
|
+
createVariations(ctx.graph, nodeId, request)
|
|
64
|
+
)
|
|
65
|
+
ctx.requestRender()
|
|
66
|
+
return created
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** One plain copy of `nodeId` in its set, selected, for a person to change by hand. */
|
|
70
|
+
function duplicateAsVariation(nodeId: string): CreatedVariations {
|
|
71
|
+
const created = createVariationsOf(nodeId, { count: 1 })
|
|
72
|
+
ctx.setSelectedIds(new Set(created.versions.map((version) => version.id)))
|
|
73
|
+
return created
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Makes the original look like the version holding `versionId` and removes the set. */
|
|
77
|
+
function pickVariation(versionId: string): string {
|
|
78
|
+
assertVariationPickable(ctx.graph, versionId)
|
|
79
|
+
const originalId = recordEdit(ctx, { label: 'Use variation', rollbackOnThrow: true }, () => {
|
|
80
|
+
const picked = applyVariation(ctx.graph, versionId)
|
|
81
|
+
ctx.runLayoutForNode(picked.originalId)
|
|
82
|
+
return picked.originalId
|
|
83
|
+
})
|
|
84
|
+
ctx.setSelectedIds(new Set([originalId]))
|
|
85
|
+
ctx.requestRender()
|
|
86
|
+
return originalId
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Removes the set holding `nodeId` and selects its original, when it is still there. */
|
|
90
|
+
function discardVariations(nodeId: string): string | null {
|
|
91
|
+
const { originalId } = recordEdit(
|
|
92
|
+
ctx,
|
|
93
|
+
{ label: 'Discard variations', rollbackOnThrow: true },
|
|
94
|
+
() => discardVariationSet(ctx.graph, nodeId)
|
|
95
|
+
)
|
|
96
|
+
ctx.setSelectedIds(new Set(originalId ? [originalId] : []))
|
|
97
|
+
ctx.requestRender()
|
|
98
|
+
return originalId
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
getVariationSet,
|
|
103
|
+
isVariationOriginalChanged,
|
|
104
|
+
canCreateVariations,
|
|
105
|
+
createVariations: createVariationsOf,
|
|
106
|
+
duplicateAsVariation,
|
|
107
|
+
pickVariation,
|
|
108
|
+
discardVariations
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PrototypeReaction } from '@pairdraw/scene-graph'
|
|
2
|
+
import { instanceMainComponent } from '@pairdraw/scene-graph/instances'
|
|
2
3
|
|
|
3
4
|
import type { NodeProxyInternals, ProxyThis } from '#core/figma-api/accessor-utils'
|
|
4
5
|
import { graph, raw, updateNode } from '#core/figma-api/accessor-utils'
|
|
@@ -21,7 +22,16 @@ export function installReactionAccessors(prototype: object, internals: NodeProxy
|
|
|
21
22
|
const pageId = sceneGraph.pageOf(node.id) ?? ''
|
|
22
23
|
const previous: readonly PrototypeReaction[] = node.prototypeReactions
|
|
23
24
|
updateNode(this, internals, {
|
|
24
|
-
prototypeReactions: parseFigmaReactions(value, {
|
|
25
|
+
prototypeReactions: parseFigmaReactions(value, {
|
|
26
|
+
graph: sceneGraph,
|
|
27
|
+
nodeId: node.id,
|
|
28
|
+
pageId,
|
|
29
|
+
previous,
|
|
30
|
+
inherited:
|
|
31
|
+
node.type === 'INSTANCE'
|
|
32
|
+
? instanceMainComponent(sceneGraph, node)?.prototypeReactions
|
|
33
|
+
: undefined
|
|
34
|
+
})
|
|
25
35
|
})
|
|
26
36
|
}
|
|
27
37
|
}
|
|
@@ -14,7 +14,11 @@ import {
|
|
|
14
14
|
type NodeProxyInternals,
|
|
15
15
|
type ProxyThis
|
|
16
16
|
} from '#core/figma-api/accessor-utils'
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
assertFontLoaded,
|
|
19
|
+
assertTextFontsLoaded,
|
|
20
|
+
textHasMissingFont
|
|
21
|
+
} from '#core/figma-api/fonts/loaded'
|
|
18
22
|
import type { FigmaFontNameInput } from '#core/figma-api/fonts/names'
|
|
19
23
|
import {
|
|
20
24
|
getParagraphSpacing,
|
|
@@ -147,6 +151,11 @@ export function installTextNodeProxyAccessors(
|
|
|
147
151
|
textAlignHorizontal: field(internals, 'textAlignHorizontal'),
|
|
148
152
|
textAlignVertical: field(internals, 'textAlignVertical'),
|
|
149
153
|
textAutoResize: field(internals, 'textAutoResize'),
|
|
154
|
+
hasMissingFont: {
|
|
155
|
+
get(this: ProxyThis): boolean {
|
|
156
|
+
return textHasMissingFont(raw(this, internals))
|
|
157
|
+
}
|
|
158
|
+
},
|
|
150
159
|
// Figma's plugin API reads and writes these as { unit, value }; a bare object stored on the
|
|
151
160
|
// node instead of pixels would leave the text unmeasurable.
|
|
152
161
|
letterSpacing: characterStyle<FigmaLetterSpacing | number>(
|
|
@@ -181,6 +190,13 @@ export function installTextNodeProxyAccessors(
|
|
|
181
190
|
mixed,
|
|
182
191
|
(_node, textDecoration) => ({ textDecoration })
|
|
183
192
|
),
|
|
193
|
+
// Figma reads a text's explicitly set OpenType features; it has no setter for them, so
|
|
194
|
+
// this one is read-only and `pairdraw.setFontFeatures` writes them.
|
|
195
|
+
openTypeFeatures: {
|
|
196
|
+
get(this: ProxyThis): unknown {
|
|
197
|
+
return getTextStyle(raw(this, internals), 'openTypeFeatures', mixed)
|
|
198
|
+
}
|
|
199
|
+
},
|
|
184
200
|
maxLines: field(internals, 'maxLines'),
|
|
185
201
|
listSpacing: spacing(internals, 'listSpacing', mixed),
|
|
186
202
|
paragraphSpacing: spacing(internals, 'paragraphSpacing', mixed),
|