@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
|
@@ -9,7 +9,10 @@ import type {
|
|
|
9
9
|
} from '@pairdraw/scene-graph'
|
|
10
10
|
import { findInstanceAncestor, isReplacedLayer } from '@pairdraw/scene-graph/instances'
|
|
11
11
|
import {
|
|
12
|
+
overriddenAssignmentId,
|
|
13
|
+
overriddenBindingField,
|
|
12
14
|
overriddenVariableModeCollection,
|
|
15
|
+
REPLACED_LAYER_OVERRIDE,
|
|
13
16
|
type InstanceOverrideState
|
|
14
17
|
} from '@pairdraw/scene-graph/instances/overrides'
|
|
15
18
|
|
|
@@ -150,11 +153,79 @@ function figmaFields(fields: Iterable<string>, skipped: Set<string>): string[] {
|
|
|
150
153
|
* instance links to the component's instance it copies, until a swap points it at a component;
|
|
151
154
|
* the enclosing instance then keeps the layer it copied.
|
|
152
155
|
*/
|
|
153
|
-
function componentLayer(
|
|
156
|
+
function componentLayer(
|
|
157
|
+
graph: SceneGraph,
|
|
158
|
+
node: SceneNode,
|
|
159
|
+
owner: SceneNode | undefined
|
|
160
|
+
): SceneNode | undefined {
|
|
154
161
|
const linked = node.componentId ? graph.getNode(node.componentId) : undefined
|
|
155
|
-
if (node.type !== 'INSTANCE' || linked?.type === 'INSTANCE')
|
|
162
|
+
if (node.type !== 'INSTANCE' || linked?.type === 'INSTANCE') {
|
|
163
|
+
return linked ? resolveCopiedLayer(graph, linked) : linked
|
|
164
|
+
}
|
|
156
165
|
const source = owner?.instanceOverrides.descendants.get(node.id)?.get('sourceComponentId')
|
|
157
|
-
|
|
166
|
+
if (typeof source === 'string') return graph.getNode(source)
|
|
167
|
+
return componentLayerByName(graph, node, owner)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* A copy inside a nested instance links to the enclosing component's copy, which in turn links
|
|
172
|
+
* to the nested component's layer. Follow that chain to the layer an edit belongs to.
|
|
173
|
+
*/
|
|
174
|
+
function resolveCopiedLayer(graph: SceneGraph, linked: SceneNode): SceneNode {
|
|
175
|
+
let target = linked
|
|
176
|
+
for (let depth = 0; depth < 32 && target.componentId; depth++) {
|
|
177
|
+
const parent = target.parentId ? graph.getNode(target.parentId) : undefined
|
|
178
|
+
if (parent?.type !== 'INSTANCE') break
|
|
179
|
+
const next = graph.getNode(target.componentId)
|
|
180
|
+
if (!next) break
|
|
181
|
+
target = next
|
|
182
|
+
}
|
|
183
|
+
return target
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* A copy made by cloning carries no link to its source, so match the path from its instance to
|
|
188
|
+
* the instance's component by sibling position and name.
|
|
189
|
+
*/
|
|
190
|
+
function componentLayerByName(
|
|
191
|
+
graph: SceneGraph,
|
|
192
|
+
node: SceneNode,
|
|
193
|
+
owner: SceneNode | undefined
|
|
194
|
+
): SceneNode | undefined {
|
|
195
|
+
if (owner?.type !== 'INSTANCE' || !owner.componentId) return undefined
|
|
196
|
+
const path: SceneNode[] = []
|
|
197
|
+
let current: SceneNode | undefined = node
|
|
198
|
+
while (current && current.id !== owner.id) {
|
|
199
|
+
path.unshift(current)
|
|
200
|
+
current = current.parentId ? graph.getNode(current.parentId) : undefined
|
|
201
|
+
}
|
|
202
|
+
if (!current) return undefined
|
|
203
|
+
let source = graph.getNode(owner.componentId)
|
|
204
|
+
// A nested instance copies the enclosing component's nested instance, so follow its link to
|
|
205
|
+
// the component that instance actually shows.
|
|
206
|
+
while (source?.type === 'INSTANCE' && source.componentId)
|
|
207
|
+
source = graph.getNode(source.componentId)
|
|
208
|
+
for (const step of path) {
|
|
209
|
+
if (!source) return undefined
|
|
210
|
+
source = matchingComponentChild(graph, source, step)
|
|
211
|
+
}
|
|
212
|
+
return source
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** The component child a copy at the same place shows, preferring its sibling position. */
|
|
216
|
+
function matchingComponentChild(
|
|
217
|
+
graph: SceneGraph,
|
|
218
|
+
source: SceneNode,
|
|
219
|
+
step: SceneNode
|
|
220
|
+
): SceneNode | undefined {
|
|
221
|
+
const siblings = graph.getChildren(source.id)
|
|
222
|
+
const index = step.parentId ? graph.getNode(step.parentId)?.childIds.indexOf(step.id) : -1
|
|
223
|
+
const atIndex = index !== undefined && index >= 0 ? siblings[index] : undefined
|
|
224
|
+
if (atIndex?.type === step.type) return atIndex
|
|
225
|
+
return (
|
|
226
|
+
siblings.find((sibling) => sibling.type === step.type && sibling.name === step.name) ??
|
|
227
|
+
siblings.find((sibling) => sibling.type === step.type)
|
|
228
|
+
)
|
|
158
229
|
}
|
|
159
230
|
|
|
160
231
|
/** Figma keeps stroke weight and alignment on the layer, so a paint differs by its colour alone. */
|
|
@@ -222,6 +293,227 @@ function withoutEdits(graph: SceneGraph, state: InstanceOverrideState): Instance
|
|
|
222
293
|
return { self: new Map(), descendants }
|
|
223
294
|
}
|
|
224
295
|
|
|
296
|
+
/** Every instance at or below `root`, deepest first, as pushing each one's edits needs them. */
|
|
297
|
+
function instancesDeepestFirst(graph: SceneGraph, root: SceneNode): SceneNode[] {
|
|
298
|
+
const result: SceneNode[] = []
|
|
299
|
+
const visit = (node: SceneNode): void => {
|
|
300
|
+
for (const child of graph.getChildren(node.id)) visit(child)
|
|
301
|
+
if (node.type === 'INSTANCE') result.push(node)
|
|
302
|
+
}
|
|
303
|
+
visit(root)
|
|
304
|
+
return result
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/** The main component an instance's own edits belong to, if it can take them. */
|
|
308
|
+
function pushableMainComponent(
|
|
309
|
+
graph: SceneGraph,
|
|
310
|
+
instance: SceneNode,
|
|
311
|
+
canEditMain: ((componentId: string) => boolean) | undefined
|
|
312
|
+
): SceneNode | null {
|
|
313
|
+
let component = instance.componentId ? graph.getNode(instance.componentId) : undefined
|
|
314
|
+
// A nested copy's link points at the enclosing component's nested instance, not at the
|
|
315
|
+
// component that instance shows, so follow it to the main component the edits belong to.
|
|
316
|
+
while (component?.type === 'INSTANCE' && component.componentId) {
|
|
317
|
+
component = graph.getNode(component.componentId)
|
|
318
|
+
}
|
|
319
|
+
if (component?.type !== 'COMPONENT') return null
|
|
320
|
+
if (canEditMain && !canEditMain(component.id)) return null
|
|
321
|
+
return component
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Applies one recorded override field from an instance layer to the component layer it copies.
|
|
326
|
+
* Returns whether the field was a text pushed into a component property's default.
|
|
327
|
+
*/
|
|
328
|
+
function pushOverrideField(
|
|
329
|
+
graph: SceneGraph,
|
|
330
|
+
target: SceneNode,
|
|
331
|
+
source: SceneNode,
|
|
332
|
+
field: string
|
|
333
|
+
): boolean {
|
|
334
|
+
// A source link is bookkeeping for sync; a replaced layer is a structural edit, not a field.
|
|
335
|
+
if (field === 'sourceComponentId' || field === REPLACED_LAYER_OVERRIDE) return false
|
|
336
|
+
// Assigning a component property belongs to the instance, not to the main component.
|
|
337
|
+
if (overriddenAssignmentId(field) !== null) return false
|
|
338
|
+
const collection = overriddenVariableModeCollection(field)
|
|
339
|
+
if (collection !== null) {
|
|
340
|
+
const modes = Object.hasOwn(source.variableModes, collection)
|
|
341
|
+
? { ...target.variableModes, [collection]: source.variableModes[collection] }
|
|
342
|
+
: omit(target.variableModes, [collection])
|
|
343
|
+
graph.updateNode(target.id, { variableModes: modes })
|
|
344
|
+
return false
|
|
345
|
+
}
|
|
346
|
+
const binding = overriddenBindingField(field)
|
|
347
|
+
if (binding !== null) {
|
|
348
|
+
const bindings = Object.hasOwn(source.boundVariables, binding)
|
|
349
|
+
? {
|
|
350
|
+
...target.boundVariables,
|
|
351
|
+
[binding]: structuredClone(source.boundVariables[binding])
|
|
352
|
+
}
|
|
353
|
+
: omit(target.boundVariables, [binding])
|
|
354
|
+
graph.updateNode(target.id, { boundVariables: bindings })
|
|
355
|
+
return false
|
|
356
|
+
}
|
|
357
|
+
const value = Reflect.get(source, field)
|
|
358
|
+
if (value === undefined) return false
|
|
359
|
+
const defaulted =
|
|
360
|
+
field === 'text' && typeof value === 'string'
|
|
361
|
+
? pushBoundTextDefault(graph, target, value)
|
|
362
|
+
: false
|
|
363
|
+
graph.updateNode(target.id, { [field]: structuredClone(value) })
|
|
364
|
+
return defaulted
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/** The override state after a push: property values stay, but a text pushed as a default goes. */
|
|
368
|
+
function clearedAfterPush(
|
|
369
|
+
graph: SceneGraph,
|
|
370
|
+
state: InstanceOverrideState,
|
|
371
|
+
defaulted: Set<string>
|
|
372
|
+
): InstanceOverrideState {
|
|
373
|
+
const cleared = withoutEdits(graph, state)
|
|
374
|
+
const descendants = new Map(cleared.descendants)
|
|
375
|
+
for (const nodeId of defaulted) {
|
|
376
|
+
const fields = descendants.get(nodeId)
|
|
377
|
+
if (!fields) continue
|
|
378
|
+
fields.delete('text')
|
|
379
|
+
if (fields.size === 0) descendants.delete(nodeId)
|
|
380
|
+
}
|
|
381
|
+
return { self: cleared.self, descendants }
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* A text layer bound to a text property shows the property's default on the main component.
|
|
386
|
+
* Pushing the edit moves that default with it, so the canvas and the property panel agree.
|
|
387
|
+
* Returns whether the field was pushed as a default.
|
|
388
|
+
*/
|
|
389
|
+
function pushBoundTextDefault(graph: SceneGraph, target: SceneNode, text: string): boolean {
|
|
390
|
+
const propertyId = target.componentPropertyReferences.find(
|
|
391
|
+
(reference) => reference.field === 'TEXT'
|
|
392
|
+
)?.propertyId
|
|
393
|
+
if (!propertyId) return false
|
|
394
|
+
const owner = graph.closest(
|
|
395
|
+
target.parentId ?? target.id,
|
|
396
|
+
(node) =>
|
|
397
|
+
(node.type === 'COMPONENT' || node.type === 'COMPONENT_SET') &&
|
|
398
|
+
node.componentPropertyDefinitions.some((definition) => definition.id === propertyId)
|
|
399
|
+
)
|
|
400
|
+
const definition = owner?.componentPropertyDefinitions.find((item) => item.id === propertyId)
|
|
401
|
+
if (!owner || !definition) return false
|
|
402
|
+
if (definition.defaultValue !== text)
|
|
403
|
+
graph.updateNode(owner.id, {
|
|
404
|
+
componentPropertyDefinitions: owner.componentPropertyDefinitions.map((item) =>
|
|
405
|
+
item.id === propertyId ? { ...item, defaultValue: text } : item
|
|
406
|
+
)
|
|
407
|
+
})
|
|
408
|
+
// Every other definition layer the property drives follows the new default, as editing the
|
|
409
|
+
// default does. A nested instance's copies belong to their own component and are left to sync.
|
|
410
|
+
const visit = (node: SceneNode): void => {
|
|
411
|
+
for (const child of graph.getChildren(node.id)) {
|
|
412
|
+
if (child.type === 'INSTANCE') continue
|
|
413
|
+
if (
|
|
414
|
+
child.type === 'TEXT' &&
|
|
415
|
+
child.componentPropertyReferences.some(
|
|
416
|
+
(reference) => reference.propertyId === propertyId && reference.field === 'TEXT'
|
|
417
|
+
)
|
|
418
|
+
)
|
|
419
|
+
graph.updateNode(child.id, { text })
|
|
420
|
+
visit(child)
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
visit(owner)
|
|
424
|
+
return true
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Whether pushing `root`'s changes can reach every main component they belong to. Pushing is
|
|
429
|
+
* refused for a library component, whose main is read-only.
|
|
430
|
+
*/
|
|
431
|
+
export function canPushInstanceOverrides(
|
|
432
|
+
graph: SceneGraph,
|
|
433
|
+
root: SceneNode,
|
|
434
|
+
canEditMain?: (componentId: string) => boolean
|
|
435
|
+
): boolean {
|
|
436
|
+
if (root.type !== 'INSTANCE') return false
|
|
437
|
+
let found = false
|
|
438
|
+
for (const instance of instancesDeepestFirst(graph, root)) {
|
|
439
|
+
if (
|
|
440
|
+
instance.instanceOverrides.self.size === 0 &&
|
|
441
|
+
instance.instanceOverrides.descendants.size === 0
|
|
442
|
+
)
|
|
443
|
+
continue
|
|
444
|
+
if (!pushableMainComponent(graph, instance, canEditMain)) return false
|
|
445
|
+
found = true
|
|
446
|
+
}
|
|
447
|
+
return found
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Figma's Push changes to main component: writes the edits of `root` and the instances inside
|
|
452
|
+
* it to their own main components, then clears those edits so every instance follows. A
|
|
453
|
+
* nested instance's edits go to its nested main; the outer main then picks them up by sync.
|
|
454
|
+
* Returns false, changing nothing, when a main component is missing or read-only.
|
|
455
|
+
*/
|
|
456
|
+
export function pushInstanceOverrides(
|
|
457
|
+
graph: SceneGraph,
|
|
458
|
+
root: SceneNode,
|
|
459
|
+
canEditMain?: (componentId: string) => boolean
|
|
460
|
+
): boolean {
|
|
461
|
+
if (!canPushInstanceOverrides(graph, root, canEditMain)) return false
|
|
462
|
+
const instances = instancesDeepestFirst(graph, root).filter(
|
|
463
|
+
(instance) =>
|
|
464
|
+
instance.instanceOverrides.self.size > 0 || instance.instanceOverrides.descendants.size > 0
|
|
465
|
+
)
|
|
466
|
+
const components: string[] = []
|
|
467
|
+
const defaulted = new Set<string>()
|
|
468
|
+
for (const instance of instances) {
|
|
469
|
+
const main = pushableMainComponent(graph, instance, canEditMain)
|
|
470
|
+
if (!main) return false
|
|
471
|
+
if (!components.includes(main.id)) components.push(main.id)
|
|
472
|
+
const state = instance.instanceOverrides
|
|
473
|
+
for (const [field] of state.self) {
|
|
474
|
+
pushOverrideField(graph, main, instance, field)
|
|
475
|
+
}
|
|
476
|
+
for (const [nodeId, fields] of state.descendants) {
|
|
477
|
+
const node = graph.getNode(nodeId)
|
|
478
|
+
if (!node) continue
|
|
479
|
+
const owner = node.parentId ? findInstanceAncestor(graph, node.parentId) : undefined
|
|
480
|
+
const target = componentLayer(graph, node, owner)
|
|
481
|
+
if (!target) continue
|
|
482
|
+
for (const [field] of fields) {
|
|
483
|
+
if (pushOverrideField(graph, target, node, field)) defaulted.add(nodeId)
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
for (const instance of instances) {
|
|
488
|
+
graph.updateNode(instance.id, {
|
|
489
|
+
instanceOverrides: clearedAfterPush(graph, instance.instanceOverrides, defaulted)
|
|
490
|
+
})
|
|
491
|
+
}
|
|
492
|
+
// Deepest main first, then every component holding an instance of one: an outer main syncs
|
|
493
|
+
// the nested instance the inner main changed, and so on up to the page.
|
|
494
|
+
graph.syncInstancesTogether(followingComponents(graph, components))
|
|
495
|
+
return true
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
/** The pushed mains and every component whose instances show one of them, deepest first. */
|
|
499
|
+
function followingComponents(graph: SceneGraph, components: string[]): string[] {
|
|
500
|
+
const order: string[] = []
|
|
501
|
+
const seen = new Set<string>()
|
|
502
|
+
const visit = (id: string): void => {
|
|
503
|
+
if (seen.has(id)) return
|
|
504
|
+
seen.add(id)
|
|
505
|
+
order.push(id)
|
|
506
|
+
for (const instance of graph.getInstances(id)) {
|
|
507
|
+
const holder = instance.parentId
|
|
508
|
+
? graph.closest(instance.parentId, (node) => node.type === 'COMPONENT')
|
|
509
|
+
: undefined
|
|
510
|
+
if (holder) visit(holder.id)
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
for (const id of components) visit(id)
|
|
514
|
+
return order
|
|
515
|
+
}
|
|
516
|
+
|
|
225
517
|
/**
|
|
226
518
|
* Figma's `resetOverrides`: the instance and every instance inside it go back to their
|
|
227
519
|
* components, keeping the values their component properties set.
|
package/src/figma-api/paints.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
import { mapValues, pickBy } from 'es-toolkit/object'
|
|
2
|
+
import { isEmptyObject } from 'es-toolkit/predicate'
|
|
1
3
|
import * as v from 'valibot'
|
|
2
4
|
|
|
3
|
-
import type {
|
|
5
|
+
import type {
|
|
6
|
+
BlendMode,
|
|
7
|
+
Fill,
|
|
8
|
+
GradientTransform,
|
|
9
|
+
ImageFilters as SceneImageFilters,
|
|
10
|
+
ImageScaleMode
|
|
11
|
+
} from '@pairdraw/scene-graph'
|
|
4
12
|
import { BLACK } from '@pairdraw/scene-graph/constants'
|
|
5
13
|
import { gradientTransformRows, IDENTITY_GRADIENT_TRANSFORM } from '@pairdraw/scene-graph/gradient'
|
|
6
14
|
import type { Color, Vector } from '@pairdraw/scene-graph/primitives'
|
|
@@ -34,13 +42,10 @@ const GRADIENT_TYPES = [
|
|
|
34
42
|
|
|
35
43
|
const SCALE_MODES = ['FILL', 'FIT', 'CROP', 'TILE'] as const satisfies readonly ImageScaleMode[]
|
|
36
44
|
|
|
37
|
-
type ImageFilters =
|
|
38
|
-
'exposure' | 'contrast' | 'saturation' | 'temperature' | 'tint' | 'highlights' | 'shadows',
|
|
39
|
-
number
|
|
40
|
-
>
|
|
45
|
+
type ImageFilters = Required<SceneImageFilters>
|
|
41
46
|
|
|
42
|
-
/**
|
|
43
|
-
const
|
|
47
|
+
/** Figma reads every slider a paint or a script leaves out at 0. */
|
|
48
|
+
const UNADJUSTED_FILTERS: ImageFilters = {
|
|
44
49
|
exposure: 0,
|
|
45
50
|
contrast: 0,
|
|
46
51
|
saturation: 0,
|
|
@@ -300,6 +305,15 @@ function sceneTransform(
|
|
|
300
305
|
return { m00, m01, m02, m10, m11, m12 }
|
|
301
306
|
}
|
|
302
307
|
|
|
308
|
+
function sceneFilters(filters: Partial<ImageFilters> | undefined): Pick<Fill, 'filters'> {
|
|
309
|
+
const moved = pickBy(filters ?? {}, Boolean)
|
|
310
|
+
return isEmptyObject(moved) ? {} : { filters: moved }
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
function figmaFilters(filters: SceneImageFilters | undefined): ImageFilters {
|
|
314
|
+
return mapValues(UNADJUSTED_FILTERS, (unadjusted, slider) => filters?.[slider] ?? unadjusted)
|
|
315
|
+
}
|
|
316
|
+
|
|
303
317
|
function sceneFill(paint: ParsedPaint, site: PaintSite): Fill {
|
|
304
318
|
const base = {
|
|
305
319
|
visible: paint.visible ?? true,
|
|
@@ -325,7 +339,8 @@ function sceneFill(paint: ParsedPaint, site: PaintSite): Fill {
|
|
|
325
339
|
...(hash !== null && { imageHash: hash }),
|
|
326
340
|
...(imageTransform && { imageTransform }),
|
|
327
341
|
...(paint.rotation !== undefined && { imageRotation: paint.rotation }),
|
|
328
|
-
...(paint.scalingFactor !== undefined && { scale: paint.scalingFactor })
|
|
342
|
+
...(paint.scalingFactor !== undefined && { scale: paint.scalingFactor }),
|
|
343
|
+
...sceneFilters(paint.filters)
|
|
329
344
|
}
|
|
330
345
|
}
|
|
331
346
|
return {
|
|
@@ -377,7 +392,7 @@ function figmaMediaPaint(paint: Fill, type: 'IMAGE' | 'VIDEO', base: ReadBase):
|
|
|
377
392
|
scaleMode,
|
|
378
393
|
scalingFactor: scaleMode === 'TILE' ? (paint.scale ?? 1) : 1,
|
|
379
394
|
...(!crop && { rotation: paint.imageRotation ?? 0 }),
|
|
380
|
-
filters:
|
|
395
|
+
filters: figmaFilters(paint.filters)
|
|
381
396
|
}
|
|
382
397
|
const transform = rows(crop ? paint.imageTransform : undefined)
|
|
383
398
|
const hash = paint.imageHash ?? null
|
package/src/figma-api/proxy.ts
CHANGED
|
@@ -5,7 +5,9 @@ import type {
|
|
|
5
5
|
SceneNode,
|
|
6
6
|
NodeType,
|
|
7
7
|
LayoutGrid,
|
|
8
|
-
LayoutMode
|
|
8
|
+
LayoutMode,
|
|
9
|
+
OverflowDirection,
|
|
10
|
+
ScrollBehavior
|
|
9
11
|
} from '@pairdraw/scene-graph'
|
|
10
12
|
import { attachedConnectors } from '@pairdraw/scene-graph/connectors'
|
|
11
13
|
import type { GroupFitOptions } from '@pairdraw/scene-graph/group-bounds'
|
|
@@ -141,6 +143,8 @@ export class FigmaNodeProxy {
|
|
|
141
143
|
declare devStatus: FigmaDevStatusValue | undefined
|
|
142
144
|
declare blendMode: string
|
|
143
145
|
declare clipsContent: boolean
|
|
146
|
+
declare overflowDirection: OverflowDirection
|
|
147
|
+
declare scrollBehavior: ScrollBehavior
|
|
144
148
|
declare cornerRadius: number | typeof MIXED
|
|
145
149
|
declare topLeftRadius: number
|
|
146
150
|
declare topRightRadius: number
|
|
@@ -236,6 +240,7 @@ export class FigmaNodeProxy {
|
|
|
236
240
|
declare textStyleId: string | symbol
|
|
237
241
|
declare fillStyleId: string | symbol
|
|
238
242
|
declare textDecoration: SceneNode['textDecoration'] | symbol
|
|
243
|
+
declare readonly openTypeFeatures: Record<string, boolean> | symbol
|
|
239
244
|
declare maxLines: number | null
|
|
240
245
|
declare listSpacing: number | symbol
|
|
241
246
|
declare paragraphSpacing: number | symbol
|
|
@@ -6,23 +6,24 @@ import type {
|
|
|
6
6
|
PrototypeNavigationType,
|
|
7
7
|
PrototypeOverlayPositionType,
|
|
8
8
|
PrototypeReaction,
|
|
9
|
+
PrototypeTransition,
|
|
9
10
|
PrototypeTransitionType,
|
|
10
11
|
PrototypeTriggerType,
|
|
11
|
-
SceneGraph
|
|
12
|
+
SceneGraph,
|
|
13
|
+
SceneNode
|
|
12
14
|
} from '@pairdraw/scene-graph'
|
|
15
|
+
import { variantSetsAround } from '@pairdraw/scene-graph/components'
|
|
16
|
+
import { PROTOTYPE_EASINGS } from '@pairdraw/scene-graph/constants'
|
|
13
17
|
|
|
14
18
|
import { issuePath } from '#core/figma-api/effects'
|
|
19
|
+
import { asInstanceEdit, sameReaction } from '#core/prototype/reactions'
|
|
15
20
|
|
|
16
21
|
/**
|
|
17
22
|
* Triggers Figma's plugin API offers that a prototype in Pairdraw cannot start from, and the
|
|
18
|
-
* message it gets instead.
|
|
23
|
+
* message it gets instead.
|
|
19
24
|
*/
|
|
20
25
|
const UNSUPPORTED_TRIGGERS: Record<string, true> = {
|
|
21
26
|
ON_DRAG: true,
|
|
22
|
-
ON_HOVER: true,
|
|
23
|
-
ON_PRESS: true,
|
|
24
|
-
MOUSE_ENTER: true,
|
|
25
|
-
MOUSE_LEAVE: true,
|
|
26
27
|
MOUSE_UP: true,
|
|
27
28
|
MOUSE_DOWN: true,
|
|
28
29
|
ON_KEY_DOWN: true
|
|
@@ -50,15 +51,32 @@ const overlayPositionSchema = v.picklist([
|
|
|
50
51
|
'BOTTOM_RIGHT'
|
|
51
52
|
] satisfies PrototypeOverlayPositionType[])
|
|
52
53
|
|
|
54
|
+
/** Figma's easing presets, which play has; a spring or a custom curve is refused. */
|
|
55
|
+
const easingSchema = v.strictObject({ type: v.picklist(PROTOTYPE_EASINGS) })
|
|
56
|
+
|
|
53
57
|
const transitionSchema = v.strictObject({
|
|
54
|
-
type: v.picklist(['INSTANT', 'DISSOLVE'] satisfies PrototypeTransitionType[]),
|
|
55
|
-
duration: secondsSchema
|
|
58
|
+
type: v.picklist(['INSTANT', 'DISSOLVE', 'SMART_ANIMATE'] satisfies PrototypeTransitionType[]),
|
|
59
|
+
duration: secondsSchema,
|
|
60
|
+
easing: v.optional(easingSchema)
|
|
56
61
|
})
|
|
57
62
|
|
|
58
63
|
const nodeActionSchema = v.strictObject({
|
|
59
64
|
type: v.literal('NODE'),
|
|
60
|
-
destinationId: v.pipe(
|
|
61
|
-
|
|
65
|
+
destinationId: v.pipe(
|
|
66
|
+
v.string(),
|
|
67
|
+
v.minLength(1),
|
|
68
|
+
v.description(
|
|
69
|
+
'NAVIGATE/OVERLAY: a top-level frame on the page; CHANGE_TO: a variant of the set the ' +
|
|
70
|
+
"layer is a variant of, an instance of, or inside; SCROLL_TO: a layer in the layer's " +
|
|
71
|
+
'top-level frame.'
|
|
72
|
+
)
|
|
73
|
+
),
|
|
74
|
+
navigation: v.picklist([
|
|
75
|
+
'NAVIGATE',
|
|
76
|
+
'OVERLAY',
|
|
77
|
+
'CHANGE_TO',
|
|
78
|
+
'SCROLL_TO'
|
|
79
|
+
] satisfies PrototypeNavigationType[]),
|
|
62
80
|
transition: v.optional(transitionSchema, { type: 'INSTANT', duration: 0 }),
|
|
63
81
|
overlayRelativePosition: v.optional(overlayPositionSchema, 'CENTER')
|
|
64
82
|
})
|
|
@@ -70,8 +88,14 @@ const actionSchema = v.variant('type', [
|
|
|
70
88
|
])
|
|
71
89
|
|
|
72
90
|
const triggerSchema = v.variant('type', [
|
|
73
|
-
v.strictObject({ type: v.
|
|
74
|
-
v.strictObject({ type: v.literal('AFTER_TIMEOUT'), timeout: secondsSchema })
|
|
91
|
+
v.strictObject({ type: v.picklist(['ON_CLICK', 'ON_HOVER', 'ON_PRESS']) }),
|
|
92
|
+
v.strictObject({ type: v.literal('AFTER_TIMEOUT'), timeout: secondsSchema }),
|
|
93
|
+
v.strictObject({
|
|
94
|
+
type: v.picklist(['MOUSE_ENTER', 'MOUSE_LEAVE']),
|
|
95
|
+
delay: v.optional(secondsSchema, 0),
|
|
96
|
+
// Figma's plugin API reads it; play treats both versions alike.
|
|
97
|
+
deprecatedVersion: v.optional(v.boolean())
|
|
98
|
+
})
|
|
75
99
|
])
|
|
76
100
|
|
|
77
101
|
const reactionSchema = v.strictObject({
|
|
@@ -91,11 +115,13 @@ export type FigmaReactionAction = FigmaReaction['actions'][number]
|
|
|
91
115
|
|
|
92
116
|
/** `reaction` in the plugin shape: the trigger and every action, named as Figma names them. */
|
|
93
117
|
export function toFigmaReaction(reaction: PrototypeReaction): FigmaReaction {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return {
|
|
118
|
+
return { trigger: toFigmaTrigger(reaction.trigger), actions: reaction.actions.map(toFigmaAction) }
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function toFigmaTrigger({ type, delay }: PrototypeReaction['trigger']): FigmaReactionTrigger {
|
|
122
|
+
if (type === 'AFTER_TIMEOUT') return { type, timeout: delay }
|
|
123
|
+
if (type === 'MOUSE_ENTER' || type === 'MOUSE_LEAVE') return { type, delay }
|
|
124
|
+
return { type }
|
|
99
125
|
}
|
|
100
126
|
|
|
101
127
|
function toFigmaAction(action: PrototypeAction): FigmaReactionAction {
|
|
@@ -104,18 +130,42 @@ function toFigmaAction(action: PrototypeAction): FigmaReactionAction {
|
|
|
104
130
|
type: 'NODE',
|
|
105
131
|
destinationId: action.nodeId ?? '',
|
|
106
132
|
navigation: action.navigation,
|
|
107
|
-
transition:
|
|
133
|
+
transition: toFigmaTransition(action.transition),
|
|
108
134
|
overlayRelativePosition: action.overlayPosition
|
|
109
135
|
}
|
|
110
136
|
}
|
|
111
137
|
|
|
138
|
+
function toFigmaTransition({
|
|
139
|
+
type,
|
|
140
|
+
duration,
|
|
141
|
+
easing
|
|
142
|
+
}: PrototypeTransition): v.InferOutput<typeof transitionSchema> {
|
|
143
|
+
return easing ? { type, duration, easing: { type: easing } } : { type, duration }
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function fromFigmaTransition({
|
|
147
|
+
type,
|
|
148
|
+
duration,
|
|
149
|
+
easing
|
|
150
|
+
}: v.InferOutput<typeof transitionSchema>): PrototypeTransition {
|
|
151
|
+
return easing ? { type, duration, easing: easing.type } : { type, duration }
|
|
152
|
+
}
|
|
153
|
+
|
|
112
154
|
/** The validation context: where the reactions live, and what they may point at. */
|
|
113
155
|
export interface ReactionContext {
|
|
114
156
|
graph: SceneGraph
|
|
115
|
-
/** The
|
|
157
|
+
/** The layer the reactions are on, which a Change to or Scroll to destination must suit. */
|
|
158
|
+
nodeId: string
|
|
159
|
+
/** The page the layer is on; a navigation's destination must be a top-level frame on it. */
|
|
116
160
|
pageId: string
|
|
117
161
|
/** The reactions the layer has now, whose ids this keeps by position. */
|
|
118
162
|
previous?: readonly PrototypeReaction[]
|
|
163
|
+
/**
|
|
164
|
+
* An instance's main component's reactions: a reaction kept under one of their ids that an
|
|
165
|
+
* edit changed, from what the layer held at its place and from the main's, becomes the
|
|
166
|
+
* instance's own, with an id of its own.
|
|
167
|
+
*/
|
|
168
|
+
inherited?: readonly PrototypeReaction[]
|
|
119
169
|
}
|
|
120
170
|
|
|
121
171
|
/**
|
|
@@ -136,17 +186,23 @@ export function parseFigmaReactions(value: unknown, context: ReactionContext): P
|
|
|
136
186
|
}
|
|
137
187
|
return result.output.map((reaction, index) => {
|
|
138
188
|
const id = context.previous?.[index]?.id ?? generateId()
|
|
139
|
-
|
|
189
|
+
const parsed: PrototypeReaction = {
|
|
140
190
|
id,
|
|
141
191
|
trigger: toTrigger(reaction.trigger),
|
|
142
192
|
actions: reaction.actions.map((action) => toAction(action, context, index))
|
|
143
193
|
}
|
|
194
|
+
// One the layer already held unchanged stays as it was, a copy of the main's included, so
|
|
195
|
+
// writing reactions back as read never re-ids a copy whose main was edited since.
|
|
196
|
+
const held = context.previous?.[index]
|
|
197
|
+
if (held && sameReaction(held, parsed)) return parsed
|
|
198
|
+
return asInstanceEdit(parsed, context.inherited ?? [])
|
|
144
199
|
})
|
|
145
200
|
}
|
|
146
201
|
|
|
147
202
|
function toTrigger(trigger: FigmaReactionTrigger): PrototypeReaction['trigger'] {
|
|
148
203
|
const type: PrototypeTriggerType = trigger.type
|
|
149
|
-
|
|
204
|
+
if (trigger.type === 'AFTER_TIMEOUT') return { type, delay: trigger.timeout }
|
|
205
|
+
return { type, delay: 'delay' in trigger ? trigger.delay : 0 }
|
|
150
206
|
}
|
|
151
207
|
|
|
152
208
|
function toAction(
|
|
@@ -155,29 +211,71 @@ function toAction(
|
|
|
155
211
|
reactionIndex: number
|
|
156
212
|
): PrototypeAction {
|
|
157
213
|
if (action.type !== 'NODE') return { type: action.type }
|
|
158
|
-
assertDestination(action
|
|
214
|
+
assertDestination(action, context, reactionIndex)
|
|
159
215
|
return {
|
|
160
216
|
type: 'NODE',
|
|
161
217
|
nodeId: action.destinationId,
|
|
162
218
|
navigation: action.navigation,
|
|
163
|
-
transition: action.transition,
|
|
219
|
+
transition: fromFigmaTransition(action.transition),
|
|
164
220
|
// Only an overlay uses the spot; Figma keeps CENTER on a navigation.
|
|
165
221
|
overlayPosition: action.navigation === 'OVERLAY' ? action.overlayRelativePosition : 'CENTER'
|
|
166
222
|
}
|
|
167
223
|
}
|
|
168
224
|
|
|
169
|
-
|
|
170
|
-
|
|
225
|
+
function failure(message: string): Error {
|
|
226
|
+
return new Error(`Property "reactions" failed validation: ${message}`)
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* A destination play can show: a navigation's is a frame at the top of the layer's page, a Change
|
|
231
|
+
* to's a variant of a set the layer belongs to, and a Scroll to's a layer in the layer's
|
|
232
|
+
* top-level frame.
|
|
233
|
+
*/
|
|
234
|
+
function assertDestination(
|
|
235
|
+
action: v.InferOutput<typeof nodeActionSchema>,
|
|
236
|
+
context: ReactionContext,
|
|
237
|
+
index: number
|
|
238
|
+
): void {
|
|
239
|
+
const { destinationId, navigation } = action
|
|
171
240
|
const destination = context.graph.getNode(destinationId)
|
|
172
241
|
const at = `reactions[${index}]`
|
|
173
|
-
if (!destination) {
|
|
174
|
-
|
|
175
|
-
|
|
242
|
+
if (!destination) throw failure(`no layer ${destinationId} at ${at}.actions[0].destinationId`)
|
|
243
|
+
if (navigation === 'CHANGE_TO') return assertVariant(destination, context, at)
|
|
244
|
+
if (navigation === 'SCROLL_TO') return assertScrollTarget(destination, context, at)
|
|
245
|
+
if (destination.type !== 'FRAME' || destination.parentId !== context.pageId) {
|
|
246
|
+
throw failure(
|
|
247
|
+
`${at} must navigate to a top-level frame on the same page, not ${destination.type} "${destination.name}"`
|
|
176
248
|
)
|
|
177
249
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function assertVariant(destination: SceneNode, context: ReactionContext, at: string): void {
|
|
253
|
+
const sets = variantSetsAround(context.graph, context.nodeId)
|
|
254
|
+
const nearest = sets.at(0)
|
|
255
|
+
if (!nearest) {
|
|
256
|
+
throw failure(
|
|
257
|
+
`${at}: only a variant, an instance of one, or a layer inside one can Change to another variant`
|
|
258
|
+
)
|
|
259
|
+
}
|
|
260
|
+
const inSet = sets.some((set) => set.id === destination.parentId)
|
|
261
|
+
if (destination.type !== 'COMPONENT' || !inSet) {
|
|
262
|
+
throw failure(
|
|
263
|
+
`${at} must Change to a variant of ${nearest.name}, not ${destination.type} "${destination.name}"`
|
|
264
|
+
)
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/** The page's direct child a layer sits in, which play shows as one screen. */
|
|
269
|
+
function topLevelOf(graph: SceneGraph, nodeId: string, pageId: string): SceneNode | undefined {
|
|
270
|
+
return graph.closest(nodeId, (node) => node.parentId === pageId)
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
function assertScrollTarget(destination: SceneNode, context: ReactionContext, at: string): void {
|
|
274
|
+
const { graph, nodeId, pageId } = context
|
|
275
|
+
const top = topLevelOf(graph, nodeId, pageId)
|
|
276
|
+
if (!top || destination.id === top.id || !graph.isDescendant(destination.id, top.id)) {
|
|
277
|
+
throw failure(
|
|
278
|
+
`${at} must Scroll to a layer inside the same top-level frame, not ${destination.type} "${destination.name}"`
|
|
181
279
|
)
|
|
182
280
|
}
|
|
183
281
|
}
|
|
@@ -194,7 +292,7 @@ function unsupportedKind(value: unknown): string | null {
|
|
|
194
292
|
if (trigger && typeof trigger === 'object' && 'type' in trigger) {
|
|
195
293
|
const type = trigger.type
|
|
196
294
|
if (typeof type === 'string' && type in UNSUPPORTED_TRIGGERS) {
|
|
197
|
-
return `a prototype starts from ON_CLICK or AFTER_TIMEOUT, not ${type}`
|
|
295
|
+
return `a prototype starts from ON_CLICK, ON_HOVER, ON_PRESS, MOUSE_ENTER, MOUSE_LEAVE or AFTER_TIMEOUT, not ${type}`
|
|
198
296
|
}
|
|
199
297
|
}
|
|
200
298
|
const actions = reaction.actions
|