@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
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { pick } from 'es-toolkit'
|
|
2
|
+
|
|
3
|
+
import type { SceneNode } from '@pairdraw/scene-graph'
|
|
4
|
+
import {
|
|
5
|
+
applyVariation,
|
|
6
|
+
discardVariations,
|
|
7
|
+
variationSetOf,
|
|
8
|
+
variationSetsOnPage,
|
|
9
|
+
type VariationSetView
|
|
10
|
+
} from '@pairdraw/scene-graph/variations'
|
|
11
|
+
|
|
12
|
+
import { createVariations, type VariationRequest } from '#core/editor/variations/create'
|
|
13
|
+
import { assertVariationPickable } from '#core/editor/variations/pick'
|
|
14
|
+
import type { FigmaAPI, FigmaNodeProxy } from '#core/figma-api/index'
|
|
15
|
+
|
|
16
|
+
import { nodeOf, type NodeRef } from './behaviours'
|
|
17
|
+
|
|
18
|
+
/** A layer of a set as `toJSON` and the tools report it: the node's id and name. */
|
|
19
|
+
export type VariationLayerInfo = Pick<SceneNode, 'id' | 'name'>
|
|
20
|
+
|
|
21
|
+
/** A set of variations as `toJSON` and the tools report it. */
|
|
22
|
+
export interface VariationSetInfo {
|
|
23
|
+
id: string
|
|
24
|
+
original: VariationLayerInfo | null
|
|
25
|
+
versions: VariationLayerInfo[]
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const info = (node: VariationLayerInfo): VariationLayerInfo => pick(node, ['id', 'name'])
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A set of variations: copies of a layer side by side in a section beside it. `id` is the
|
|
32
|
+
* section's; reading a set that was used or discarded throws.
|
|
33
|
+
*/
|
|
34
|
+
export class VariationSetHandle {
|
|
35
|
+
constructor(
|
|
36
|
+
private readonly figma: FigmaAPI,
|
|
37
|
+
readonly id: string
|
|
38
|
+
) {}
|
|
39
|
+
|
|
40
|
+
private get view(): VariationSetView {
|
|
41
|
+
const view = variationSetOf(this.figma.graph, this.id)
|
|
42
|
+
if (view?.section.id !== this.id) throw new Error(`Variations ${this.id} are gone`)
|
|
43
|
+
return view
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** The layer the versions vary, or null when it was deleted. */
|
|
47
|
+
get original(): FigmaNodeProxy | null {
|
|
48
|
+
const { original } = this.view
|
|
49
|
+
return original ? this.figma.wrapNode(original.id) : null
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The versions, in their order in the section. */
|
|
53
|
+
get versions(): FigmaNodeProxy[] {
|
|
54
|
+
return this.view.versions.map((version) => this.figma.wrapNode(version.id))
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Make the original look like `version`, keeping its id, name, and place, and remove the set;
|
|
59
|
+
* returns the original.
|
|
60
|
+
*/
|
|
61
|
+
use(version: NodeRef): FigmaNodeProxy {
|
|
62
|
+
const node = nodeOf(this.figma.graph, version)
|
|
63
|
+
if (node.parentId !== this.view.section.id) {
|
|
64
|
+
throw new Error(`${node.name} is not one of these variations`)
|
|
65
|
+
}
|
|
66
|
+
assertVariationPickable(this.figma.graph, node.id)
|
|
67
|
+
return this.figma.wrapNode(applyVariation(this.figma.graph, node.id).originalId)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Remove the set and every version in it; the original stays as it is. */
|
|
71
|
+
discard(): void {
|
|
72
|
+
discardVariations(this.figma.graph, this.view.section.id)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
toJSON(): VariationSetInfo {
|
|
76
|
+
const { section, original, versions } = this.view
|
|
77
|
+
return {
|
|
78
|
+
id: section.id,
|
|
79
|
+
original: original ? info(original) : null,
|
|
80
|
+
versions: versions.map(info)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Copy a layer into its set of variations, made beside it the first time. */
|
|
86
|
+
export function createVariationSet(
|
|
87
|
+
figma: FigmaAPI,
|
|
88
|
+
node: NodeRef,
|
|
89
|
+
request: VariationRequest
|
|
90
|
+
): { set: VariationSetHandle; created: FigmaNodeProxy[] } {
|
|
91
|
+
const made = createVariations(figma.graph, nodeOf(figma.graph, node).id, request)
|
|
92
|
+
return {
|
|
93
|
+
set: new VariationSetHandle(figma, made.sectionId),
|
|
94
|
+
created: made.versions.map((version) => figma.wrapNode(version.id))
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** The set a layer belongs to: its section, a version, or a layer inside one; else null. */
|
|
99
|
+
export function getVariationSet(figma: FigmaAPI, node: NodeRef): VariationSetHandle | null {
|
|
100
|
+
const view = variationSetOf(figma.graph, nodeOf(figma.graph, node).id)
|
|
101
|
+
return view ? new VariationSetHandle(figma, view.section.id) : null
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** The sets on a page. */
|
|
105
|
+
export function listVariationSets(figma: FigmaAPI, pageId: string): VariationSetHandle[] {
|
|
106
|
+
return variationSetsOnPage(figma.graph, pageId).map(
|
|
107
|
+
(view) => new VariationSetHandle(figma, view.section.id)
|
|
108
|
+
)
|
|
109
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { PrototypeEasingType } from '@pairdraw/scene-graph'
|
|
2
|
+
import { DEFAULT_PROTOTYPE_EASING, PROTOTYPE_EASING_CURVES } from '@pairdraw/scene-graph/constants'
|
|
3
|
+
|
|
4
|
+
/** Bisection steps that solve a curve's x for its t; 32 halvings are far below a pixel. */
|
|
5
|
+
const BISECTION_STEPS = 32
|
|
6
|
+
|
|
7
|
+
function bezier(t: number, p1: number, p2: number): number {
|
|
8
|
+
return 3 * (1 - t) * (1 - t) * t * p1 + 3 * (1 - t) * t * t * p2 + t * t * t
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* How far along a transition eased by `easing` is at `progress` of its time, from 0 to 1; no
|
|
13
|
+
* easing eases as Figma's default does. The player and a recording both read it, so they move
|
|
14
|
+
* alike.
|
|
15
|
+
*/
|
|
16
|
+
export function easingAt(easing: PrototypeEasingType | undefined, progress: number): number {
|
|
17
|
+
if (progress <= 0) return 0
|
|
18
|
+
if (progress >= 1) return 1
|
|
19
|
+
const [x1, y1, x2, y2] = PROTOTYPE_EASING_CURVES[easing ?? DEFAULT_PROTOTYPE_EASING]
|
|
20
|
+
if (x1 === y1 && x2 === y2) return progress
|
|
21
|
+
// x(t) rises monotonically, so bisection finds the t whose x is `progress`.
|
|
22
|
+
let low = 0
|
|
23
|
+
let high = 1
|
|
24
|
+
for (let index = 0; index < BISECTION_STEPS; index++) {
|
|
25
|
+
const middle = (low + high) / 2
|
|
26
|
+
if (bezier(middle, x1, x2) < progress) low = middle
|
|
27
|
+
else high = middle
|
|
28
|
+
}
|
|
29
|
+
return bezier((low + high) / 2, y1, y2)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** `easing` as a CSS timing function, for a transition the browser animates. */
|
|
33
|
+
export function easingCSS(easing: PrototypeEasingType | undefined): string {
|
|
34
|
+
const [x1, y1, x2, y2] = PROTOTYPE_EASING_CURVES[easing ?? DEFAULT_PROTOTYPE_EASING]
|
|
35
|
+
if (x1 === y1 && x2 === y2) return 'linear'
|
|
36
|
+
return `cubic-bezier(${x1}, ${y1}, ${x2}, ${y2})`
|
|
37
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The frames a navigation can point at: the page's top-level frames, in page order. Figma links to
|
|
5
|
+
* frames and components at the top of the page, not to layers inside them, so the list stays flat.
|
|
6
|
+
*/
|
|
7
|
+
export function framesOnPage(graph: SceneGraph, pageId: string): SceneNode[] {
|
|
8
|
+
return graph.getChildren(pageId).filter((node) => node.type === 'FRAME')
|
|
9
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
2
|
+
import {
|
|
3
|
+
clippingMasks,
|
|
4
|
+
isPointInNode,
|
|
5
|
+
isPointMaskedOut,
|
|
6
|
+
showsPaint
|
|
7
|
+
} from '@pairdraw/scene-graph/hit-test'
|
|
8
|
+
import { drawnChildIds } from '@pairdraw/scene-graph/layout'
|
|
9
|
+
import type { Vector } from '@pairdraw/scene-graph/primitives'
|
|
10
|
+
|
|
11
|
+
import { liftedChildIds, scrollShiftX, scrollShiftY } from '#core/prototype/scroll'
|
|
12
|
+
|
|
13
|
+
const NOT_SCROLLED: ReadonlyMap<string, Vector> = new Map()
|
|
14
|
+
|
|
15
|
+
/** Every layer may take the pointer. */
|
|
16
|
+
const ANY_LAYER = (): boolean => true
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The deepest layer under a point inside `rootId` that takes the pointer, as a prototype finds
|
|
20
|
+
* it: one `takes` accepts, over its whole box, so a button's background takes its click as its
|
|
21
|
+
* label does, and one that shows a paint there, so a filled sheet laid over a button keeps the
|
|
22
|
+
* click from it. A layer that does neither, such as an unfilled frame laid over a screen, lets
|
|
23
|
+
* the pointer through to what lies under it. A clipping frame and a mask hide what lies outside
|
|
24
|
+
* them; hidden layers and masks take nothing. The root itself when no layer takes the point and
|
|
25
|
+
* it lies over the root, and null outside it. A frame play scrolled finds its layers where they
|
|
26
|
+
* are drawn, `scroll` offsets in.
|
|
27
|
+
*/
|
|
28
|
+
export function playHitTest(
|
|
29
|
+
graph: SceneGraph,
|
|
30
|
+
rootId: string,
|
|
31
|
+
x: number,
|
|
32
|
+
y: number,
|
|
33
|
+
scroll: ReadonlyMap<string, Vector> = NOT_SCROLLED,
|
|
34
|
+
takes: (node: SceneNode) => boolean = ANY_LAYER
|
|
35
|
+
): SceneNode | null {
|
|
36
|
+
const root = graph.getNode(rootId)
|
|
37
|
+
if (!root) return null
|
|
38
|
+
const hit = deepestIn(graph, root, x, y, scroll, takes)
|
|
39
|
+
return hit ?? (isPointInNode(graph, rootId, x, y) ? root : null)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function deepestIn(
|
|
43
|
+
graph: SceneGraph,
|
|
44
|
+
parent: SceneNode,
|
|
45
|
+
x: number,
|
|
46
|
+
y: number,
|
|
47
|
+
scroll: ReadonlyMap<string, Vector>,
|
|
48
|
+
takes: (node: SceneNode) => boolean
|
|
49
|
+
): SceneNode | null {
|
|
50
|
+
if (parent.clipsContent && !isPointInNode(graph, parent.id, x, y)) return null
|
|
51
|
+
// The layers of a scrolled frame are drawn moved up and left by its offset, except the ones
|
|
52
|
+
// that stay put; their point moves with the offset they skip.
|
|
53
|
+
const offset = scroll.get(parent.id)
|
|
54
|
+
const innerX = x + (offset?.x ?? 0)
|
|
55
|
+
const innerY = y + (offset?.y ?? 0)
|
|
56
|
+
const drawn = liftedChildIds(graph, drawnChildIds(parent), offset)
|
|
57
|
+
const masks = clippingMasks(graph, drawn)
|
|
58
|
+
for (let index = drawn.length - 1; index >= 0; index--) {
|
|
59
|
+
const child = graph.getNode(drawn[index])
|
|
60
|
+
if (!child?.visible || child.internalOnly || child.isMask) continue
|
|
61
|
+
if (isPointMaskedOut(graph, masks[index], innerX, innerY)) continue
|
|
62
|
+
const childX = innerX - scrollShiftX(child, offset)
|
|
63
|
+
const childY = innerY - scrollShiftY(child, offset)
|
|
64
|
+
const hit = deepestIn(graph, child, childX, childY, scroll, takes)
|
|
65
|
+
if (hit) return hit
|
|
66
|
+
const captures = takes(child) || showsPaint(child)
|
|
67
|
+
if (captures && isPointInNode(graph, child.id, childX, childY)) return child
|
|
68
|
+
}
|
|
69
|
+
return null
|
|
70
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export { easingAt, easingCSS } from './easing'
|
|
2
|
+
export { framesOnPage } from './frames'
|
|
3
|
+
export { playHitTest } from './hit'
|
|
4
|
+
export {
|
|
5
|
+
hasPointerTriggers,
|
|
6
|
+
pathChanges,
|
|
7
|
+
pointerPath,
|
|
8
|
+
pointerLeftTrigger,
|
|
9
|
+
pointerReactions,
|
|
10
|
+
revertFor,
|
|
11
|
+
type PlayPointerReaction,
|
|
12
|
+
type PlayRevert
|
|
13
|
+
} from './pointer'
|
|
14
|
+
export { asInstanceEdit, effectiveReactions, sameReaction } from './reactions'
|
|
15
|
+
export {
|
|
16
|
+
changeTarget,
|
|
17
|
+
createPlayScene,
|
|
18
|
+
type PlayChange,
|
|
19
|
+
type PlayScene,
|
|
20
|
+
type PlaySceneView
|
|
21
|
+
} from './scene'
|
|
22
|
+
export { scrollRange, scrollsInPlay, type ScrollChange } from './scroll'
|
|
23
|
+
export { snapshotPlayFrame } from './snapshot'
|
|
24
|
+
export {
|
|
25
|
+
createSmartAnimation,
|
|
26
|
+
type PlayFrame,
|
|
27
|
+
type SmartAnimation
|
|
28
|
+
} from './smart-animate/animation'
|
|
29
|
+
export { matchLayers, type LayerMatch } from './smart-animate/match'
|
|
30
|
+
export {
|
|
31
|
+
PLAY_SCENE_LIMIT,
|
|
32
|
+
createPlayScenes,
|
|
33
|
+
type PlayScenes,
|
|
34
|
+
type PlayStep,
|
|
35
|
+
type PlayTimeout
|
|
36
|
+
} from './scenes'
|
|
37
|
+
export {
|
|
38
|
+
primaryAction,
|
|
39
|
+
reactionAt,
|
|
40
|
+
restartSession,
|
|
41
|
+
shownFrame,
|
|
42
|
+
startFrame,
|
|
43
|
+
startSession,
|
|
44
|
+
step,
|
|
45
|
+
timeoutReactions,
|
|
46
|
+
topFrameOf,
|
|
47
|
+
type PlayClick,
|
|
48
|
+
type PlaySession
|
|
49
|
+
} from './session'
|
|
50
|
+
export {
|
|
51
|
+
animationFor,
|
|
52
|
+
DISSOLVE_EASING,
|
|
53
|
+
DISSOLVE_EASING_CSS,
|
|
54
|
+
dissolveEasing,
|
|
55
|
+
frameAt,
|
|
56
|
+
planTimeline,
|
|
57
|
+
sessionDrawKey,
|
|
58
|
+
TimelineError,
|
|
59
|
+
transitionMs,
|
|
60
|
+
type PlayAnimation,
|
|
61
|
+
type Timeline,
|
|
62
|
+
type TimelineClick,
|
|
63
|
+
type TimelineErrorReason,
|
|
64
|
+
type TimelineFrame,
|
|
65
|
+
type TimelineOptions,
|
|
66
|
+
type TimelineSegment,
|
|
67
|
+
type TimelineSmartSegment,
|
|
68
|
+
type TimelineStep
|
|
69
|
+
} from './timeline'
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
PrototypeTransition,
|
|
3
|
+
PrototypeTriggerType,
|
|
4
|
+
SceneGraph,
|
|
5
|
+
SceneNode
|
|
6
|
+
} from '@pairdraw/scene-graph'
|
|
7
|
+
import type { Vector } from '@pairdraw/scene-graph/primitives'
|
|
8
|
+
|
|
9
|
+
import { playHitTest } from './hit'
|
|
10
|
+
import { effectiveReactions } from './reactions'
|
|
11
|
+
import type { PlayStep } from './scenes'
|
|
12
|
+
import { primaryAction, type PlayClick, type PlaySession } from './session'
|
|
13
|
+
|
|
14
|
+
/** The triggers the pointer runs by moving over a layer or pressing on it, rather than clicking. */
|
|
15
|
+
const POINTER_TRIGGERS: ReadonlySet<PrototypeTriggerType> = new Set<PrototypeTriggerType>([
|
|
16
|
+
'ON_HOVER',
|
|
17
|
+
'ON_PRESS',
|
|
18
|
+
'MOUSE_ENTER',
|
|
19
|
+
'MOUSE_LEAVE'
|
|
20
|
+
])
|
|
21
|
+
|
|
22
|
+
/** A reaction the pointer runs, with the delay a Mouse enter or Mouse leave waits first. */
|
|
23
|
+
export interface PlayPointerReaction extends PlayClick {
|
|
24
|
+
delayMs: number
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* How to undo a While hovering or While pressing reaction once the pointer leaves or lifts, and
|
|
29
|
+
* the layer whose leaving undoes it: the layer the reaction ran from, or the instance it
|
|
30
|
+
* switched when that layer went with the switch. A Change to switches back with the transition
|
|
31
|
+
* it switched with, as Figma's does.
|
|
32
|
+
*/
|
|
33
|
+
export type PlayRevert =
|
|
34
|
+
| {
|
|
35
|
+
kind: 'change'
|
|
36
|
+
watchId: string
|
|
37
|
+
rootId: string
|
|
38
|
+
instanceId: string
|
|
39
|
+
from: string
|
|
40
|
+
to: string
|
|
41
|
+
transition: PrototypeTransition | null
|
|
42
|
+
}
|
|
43
|
+
| { kind: 'overlay'; watchId: string; frameId: string }
|
|
44
|
+
| { kind: 'back'; watchId: string; frameId: string }
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The layers under a point inside `rootId`, from the frame down to the deepest one `takes` the
|
|
48
|
+
* pointer, any layer unless told otherwise; none outside.
|
|
49
|
+
*/
|
|
50
|
+
export function pointerPath(
|
|
51
|
+
graph: SceneGraph,
|
|
52
|
+
rootId: string,
|
|
53
|
+
x: number,
|
|
54
|
+
y: number,
|
|
55
|
+
scroll?: ReadonlyMap<string, Vector>,
|
|
56
|
+
takes?: (node: SceneNode) => boolean
|
|
57
|
+
): string[] {
|
|
58
|
+
const path: string[] = []
|
|
59
|
+
const deepest = playHitTest(graph, rootId, x, y, scroll, takes)
|
|
60
|
+
if (!deepest) return path
|
|
61
|
+
graph.closest(deepest.id, (node) => {
|
|
62
|
+
path.unshift(node.id)
|
|
63
|
+
return node.id === rootId
|
|
64
|
+
})
|
|
65
|
+
return path
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** The layers a pointer left, innermost first, and those it entered, outermost first. */
|
|
69
|
+
export function pathChanges(
|
|
70
|
+
before: readonly string[],
|
|
71
|
+
after: readonly string[]
|
|
72
|
+
): { left: string[]; entered: string[] } {
|
|
73
|
+
let shared = 0
|
|
74
|
+
while (shared < before.length && shared < after.length && before[shared] === after[shared]) {
|
|
75
|
+
shared += 1
|
|
76
|
+
}
|
|
77
|
+
return { left: before.slice(shared).reverse(), entered: after.slice(shared) }
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Whether the pointer has left the layer a While hovering reaction ran from: its path in the
|
|
82
|
+
* frame the action opened a variant on, so an overlay covering the pointer does not count.
|
|
83
|
+
*/
|
|
84
|
+
export function pointerLeftTrigger(basePath: readonly string[], triggerId: string): boolean {
|
|
85
|
+
return !basePath.includes(triggerId)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Whether any layer of `rootId` reacts to the pointer moving over or pressing on it, an instance
|
|
90
|
+
* by its variant; a frame without one is not hit-tested as the pointer moves.
|
|
91
|
+
*/
|
|
92
|
+
export function hasPointerTriggers(graph: SceneGraph, rootId: string): boolean {
|
|
93
|
+
const reacts = (id: string): boolean => {
|
|
94
|
+
const node = graph.getNode(id)
|
|
95
|
+
if (!node) return false
|
|
96
|
+
const own = effectiveReactions(graph, node).some((reaction) =>
|
|
97
|
+
POINTER_TRIGGERS.has(reaction.trigger.type)
|
|
98
|
+
)
|
|
99
|
+
return own || node.childIds.some(reacts)
|
|
100
|
+
}
|
|
101
|
+
return reacts(rootId)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** A layer's reactions to `trigger`, an instance's from the variant it shows, first action each. */
|
|
105
|
+
export function pointerReactions(
|
|
106
|
+
graph: SceneGraph,
|
|
107
|
+
nodeId: string,
|
|
108
|
+
trigger: PrototypeTriggerType
|
|
109
|
+
): PlayPointerReaction[] {
|
|
110
|
+
const node = graph.getNode(nodeId)
|
|
111
|
+
if (!node) return []
|
|
112
|
+
return effectiveReactions(graph, node).flatMap((reaction) => {
|
|
113
|
+
const action = reaction.trigger.type === trigger ? primaryAction(reaction) : null
|
|
114
|
+
if (!action) return []
|
|
115
|
+
const transition = action.type === 'NODE' ? action.transition : null
|
|
116
|
+
return [{ sourceId: nodeId, action, transition, delayMs: reaction.trigger.delay * 1000 }]
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* How to undo what a While hovering or While pressing reaction did: a Change to switches back, an
|
|
122
|
+
* overlay it opened closes, a navigation goes back. Null when it changed nothing. `shown` is the
|
|
123
|
+
* graph play shows the frame from after it ran.
|
|
124
|
+
*/
|
|
125
|
+
export function revertFor(
|
|
126
|
+
before: PlaySession,
|
|
127
|
+
done: PlayStep,
|
|
128
|
+
{ sourceId, action, transition }: PlayClick,
|
|
129
|
+
shown: SceneGraph
|
|
130
|
+
): PlayRevert | null {
|
|
131
|
+
if (done.changed) {
|
|
132
|
+
const { rootId, instanceId, from, to } = done.changed
|
|
133
|
+
// A layer inside the instance went with the switch; leaving the instance undoes it then.
|
|
134
|
+
const watchId = shown.getNode(sourceId) ? sourceId : instanceId
|
|
135
|
+
return { kind: 'change', watchId, rootId, instanceId, from, to, transition }
|
|
136
|
+
}
|
|
137
|
+
if (action.type !== 'NODE' || !action.nodeId) return null
|
|
138
|
+
const after = done.session
|
|
139
|
+
if (action.navigation === 'OVERLAY' && after.overlays.length > before.overlays.length) {
|
|
140
|
+
return { kind: 'overlay', watchId: sourceId, frameId: action.nodeId }
|
|
141
|
+
}
|
|
142
|
+
if (action.navigation === 'NAVIGATE' && after.frameId !== before.frameId) {
|
|
143
|
+
return { kind: 'back', watchId: sourceId, frameId: action.nodeId }
|
|
144
|
+
}
|
|
145
|
+
return null
|
|
146
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { isEqual, omit } from 'es-toolkit'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
generateId,
|
|
5
|
+
type PrototypeReaction,
|
|
6
|
+
type SceneGraph,
|
|
7
|
+
type SceneNode
|
|
8
|
+
} from '@pairdraw/scene-graph'
|
|
9
|
+
import {
|
|
10
|
+
findInstanceAncestor,
|
|
11
|
+
instanceMainComponent,
|
|
12
|
+
walkInstanceSources
|
|
13
|
+
} from '@pairdraw/scene-graph/instances'
|
|
14
|
+
|
|
15
|
+
/** Whether two reactions do the same thing, whatever their ids. */
|
|
16
|
+
export function sameReaction(a: PrototypeReaction, b: PrototypeReaction): boolean {
|
|
17
|
+
return isEqual(omit(a, ['id']), omit(b, ['id']))
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The reactions play runs on a layer. An instance runs its main component's, so an interaction
|
|
22
|
+
* set once on a variant works on every instance of it, and the instance's own reactions replace
|
|
23
|
+
* the main's of the same trigger, as in Figma. A reaction an instance holds under one of its
|
|
24
|
+
* main's ids is Figma's copy of it, which gives way to the main's as edited. Any other layer runs
|
|
25
|
+
* its own.
|
|
26
|
+
*/
|
|
27
|
+
export function effectiveReactions(graph: SceneGraph, node: SceneNode): PrototypeReaction[] {
|
|
28
|
+
return reactionsWithInherited(node, inheritedReactions(graph, node))
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A layer's reactions with the ones it inherits: the inherited reactions run unless the layer
|
|
33
|
+
* overrides their trigger. Figma's copy of a main's interaction keeps the main's id; the main's
|
|
34
|
+
* own, as edited, runs.
|
|
35
|
+
*/
|
|
36
|
+
export function reactionsWithInherited(
|
|
37
|
+
node: SceneNode,
|
|
38
|
+
inherited: readonly PrototypeReaction[]
|
|
39
|
+
): PrototypeReaction[] {
|
|
40
|
+
if (inherited.length === 0) return node.prototypeReactions
|
|
41
|
+
const own = node.prototypeReactions.filter(
|
|
42
|
+
(reaction) => !inherited.some((main) => main.id === reaction.id)
|
|
43
|
+
)
|
|
44
|
+
return [
|
|
45
|
+
...own,
|
|
46
|
+
...inherited.filter(
|
|
47
|
+
(reaction) => !own.some((mine) => mine.trigger.type === reaction.trigger.type)
|
|
48
|
+
)
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The reactions a layer takes from its component: an instance root from the component it shows,
|
|
54
|
+
* a layer inside an instance from the component layer it was copied from.
|
|
55
|
+
*/
|
|
56
|
+
function inheritedReactions(graph: SceneGraph, node: SceneNode): PrototypeReaction[] {
|
|
57
|
+
if (node.type === 'INSTANCE') {
|
|
58
|
+
return instanceMainComponent(graph, node)?.prototypeReactions ?? []
|
|
59
|
+
}
|
|
60
|
+
const source = componentLayer(graph, node)
|
|
61
|
+
return source && source.id !== node.id ? source.prototypeReactions : []
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The component layer a copy stands for, followed through nested instances to the main that
|
|
66
|
+
* finally holds it. A nested copy points at the layer one level up, not at the main's layer.
|
|
67
|
+
*/
|
|
68
|
+
export function componentLayer(graph: SceneGraph, node: SceneNode): SceneNode | undefined {
|
|
69
|
+
return followComponentLayer(graph, node, (instance, copyId) =>
|
|
70
|
+
copiedSource(graph, instance, copyId)
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* A resolver for the component layers copies stand for, which reads each instance's copy-to-main
|
|
76
|
+
* map once. Arm many layers of one frame with it instead of calling `componentLayer` per layer,
|
|
77
|
+
* which searches an instance for every copy.
|
|
78
|
+
*/
|
|
79
|
+
export function componentLayerResolver(
|
|
80
|
+
graph: SceneGraph
|
|
81
|
+
): (node: SceneNode) => SceneNode | undefined {
|
|
82
|
+
const sourcesByInstance = new Map<string, Map<string, SceneNode>>()
|
|
83
|
+
const resolved = new Map<string, SceneNode | undefined>()
|
|
84
|
+
const sourcesOf = (instance: SceneNode): Map<string, SceneNode> => {
|
|
85
|
+
const cached = sourcesByInstance.get(instance.id)
|
|
86
|
+
if (cached) return cached
|
|
87
|
+
const sources = new Map<string, SceneNode>()
|
|
88
|
+
walkInstanceSources(
|
|
89
|
+
graph,
|
|
90
|
+
instance,
|
|
91
|
+
(source, copy) => {
|
|
92
|
+
sources.set(copy.id, source)
|
|
93
|
+
return true
|
|
94
|
+
},
|
|
95
|
+
true
|
|
96
|
+
)
|
|
97
|
+
sourcesByInstance.set(instance.id, sources)
|
|
98
|
+
return sources
|
|
99
|
+
}
|
|
100
|
+
return (node) => {
|
|
101
|
+
if (resolved.has(node.id)) return resolved.get(node.id)
|
|
102
|
+
const layer = followComponentLayer(graph, node, (instance, copyId) =>
|
|
103
|
+
sourcesOf(instance).get(copyId)
|
|
104
|
+
)
|
|
105
|
+
resolved.set(node.id, layer)
|
|
106
|
+
return layer
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Walks a copy up to its main layer, one instance at a time, using `sourceOf` to map each step. */
|
|
111
|
+
function followComponentLayer(
|
|
112
|
+
graph: SceneGraph,
|
|
113
|
+
node: SceneNode,
|
|
114
|
+
sourceOf: (instance: SceneNode, copyId: string) => SceneNode | undefined
|
|
115
|
+
): SceneNode | undefined {
|
|
116
|
+
const seen = new Set<string>()
|
|
117
|
+
let current = node
|
|
118
|
+
for (;;) {
|
|
119
|
+
if (seen.has(current.id)) return undefined
|
|
120
|
+
seen.add(current.id)
|
|
121
|
+
const owner = current.parentId ? findInstanceAncestor(graph, current.parentId) : undefined
|
|
122
|
+
if (!owner) return current
|
|
123
|
+
if (!instanceMainComponent(graph, owner)) return undefined
|
|
124
|
+
const source = sourceOf(owner, current.id)
|
|
125
|
+
if (!source || source.id === current.id) return undefined
|
|
126
|
+
current = source
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** The component layer that an instance's copy of `copyId` stands for. */
|
|
131
|
+
function copiedSource(
|
|
132
|
+
graph: SceneGraph,
|
|
133
|
+
instance: SceneNode,
|
|
134
|
+
copyId: string
|
|
135
|
+
): SceneNode | undefined {
|
|
136
|
+
let source: SceneNode | undefined
|
|
137
|
+
walkInstanceSources(
|
|
138
|
+
graph,
|
|
139
|
+
instance,
|
|
140
|
+
(candidate, copy) => {
|
|
141
|
+
if (copy.id !== copyId) return true
|
|
142
|
+
source = candidate
|
|
143
|
+
return false
|
|
144
|
+
},
|
|
145
|
+
true
|
|
146
|
+
)
|
|
147
|
+
return source
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* The instance's own reactions without the copies of `previousMain`'s: those under one of its ids,
|
|
152
|
+
* or equal to one. Figma writes a main component's interactions onto each instance too; once play
|
|
153
|
+
* shows another variant, those copies would keep running the old variant's interactions over the
|
|
154
|
+
* new one's.
|
|
155
|
+
*/
|
|
156
|
+
export function withoutInheritedCopies(
|
|
157
|
+
own: readonly PrototypeReaction[],
|
|
158
|
+
previousMain: SceneNode | undefined
|
|
159
|
+
): PrototypeReaction[] {
|
|
160
|
+
const inherited = previousMain?.prototypeReactions ?? []
|
|
161
|
+
return own.filter(
|
|
162
|
+
(reaction) => !inherited.some((main) => main.id === reaction.id || sameReaction(main, reaction))
|
|
163
|
+
)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* The reaction an instance keeps after an edit. Figma's copy of a main's interaction keeps the
|
|
168
|
+
* main's id, which play reads as the main's; edited to do something else, it takes an id of its
|
|
169
|
+
* own and becomes the instance's override, which play runs.
|
|
170
|
+
*/
|
|
171
|
+
export function asInstanceEdit(
|
|
172
|
+
reaction: PrototypeReaction,
|
|
173
|
+
inherited: readonly PrototypeReaction[]
|
|
174
|
+
): PrototypeReaction {
|
|
175
|
+
const main = inherited.find((candidate) => candidate.id === reaction.id)
|
|
176
|
+
if (!main || sameReaction(main, reaction)) return reaction
|
|
177
|
+
return { ...reaction, id: generateId() }
|
|
178
|
+
}
|