@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,400 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
PrototypeAction,
|
|
3
|
+
PrototypeEasingType,
|
|
4
|
+
PrototypeOverlayPositionType,
|
|
5
|
+
PrototypeTransitionType,
|
|
6
|
+
SceneGraph,
|
|
7
|
+
SceneNode
|
|
8
|
+
} from '@pairdraw/scene-graph'
|
|
9
|
+
|
|
10
|
+
import { easingAt } from './easing'
|
|
11
|
+
import {
|
|
12
|
+
primaryAction,
|
|
13
|
+
shownFrame,
|
|
14
|
+
startSession,
|
|
15
|
+
step,
|
|
16
|
+
timeoutReactions,
|
|
17
|
+
topFrameOf,
|
|
18
|
+
type PlaySession
|
|
19
|
+
} from './session'
|
|
20
|
+
|
|
21
|
+
/** A scripted click: the layer clicked, and when, in milliseconds from the start of play. */
|
|
22
|
+
export interface TimelineClick {
|
|
23
|
+
atMs: number
|
|
24
|
+
nodeId: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface TimelineOptions {
|
|
28
|
+
/** The top-level frame play starts from. */
|
|
29
|
+
startFrameId: string
|
|
30
|
+
/** Clicks to run as play goes, in time order. */
|
|
31
|
+
clicks?: readonly TimelineClick[]
|
|
32
|
+
/** Where the timeline stops when the flow goes on longer. */
|
|
33
|
+
maxMs: number
|
|
34
|
+
/** How long the last frame stays once nothing else happens. */
|
|
35
|
+
tailMs: number
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** A stretch of play that moves from one screen to the next over a transition's own length. */
|
|
39
|
+
interface TimelineTransition {
|
|
40
|
+
from: PlaySession
|
|
41
|
+
to: PlaySession
|
|
42
|
+
startMs: number
|
|
43
|
+
endMs: number
|
|
44
|
+
/** The transition's own length, which keeps its pace when a later step cuts it short. */
|
|
45
|
+
fadeMs: number
|
|
46
|
+
easing?: PrototypeEasingType
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* A stretch of play: one screen held still, a crossfade from one screen to the next, or a Smart
|
|
51
|
+
* animate between them.
|
|
52
|
+
*/
|
|
53
|
+
export type TimelineSegment =
|
|
54
|
+
| { kind: 'hold'; session: PlaySession; startMs: number; endMs: number }
|
|
55
|
+
| ({ kind: 'dissolve' } & TimelineTransition)
|
|
56
|
+
| ({ kind: 'smart' } & TimelineTransition)
|
|
57
|
+
|
|
58
|
+
/** A Smart animate stretch of a timeline. */
|
|
59
|
+
export type TimelineSmartSegment = Extract<TimelineSegment, { kind: 'smart' }>
|
|
60
|
+
|
|
61
|
+
/** One step play took: when, the frame it shows afterwards, what started it, and how it moved. */
|
|
62
|
+
export interface TimelineStep {
|
|
63
|
+
atMs: number
|
|
64
|
+
frameId: string
|
|
65
|
+
trigger: 'AFTER_TIMEOUT' | 'ON_CLICK'
|
|
66
|
+
transition: PrototypeTransitionType
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface Timeline {
|
|
70
|
+
segments: TimelineSegment[]
|
|
71
|
+
durationMs: number
|
|
72
|
+
/** Clicks the walk never ran: past the cap, or on a layer whose hit runs no reaction. */
|
|
73
|
+
skippedClicks: TimelineClick[]
|
|
74
|
+
/** Play came back to the screen it started on, so the clip repeats seamlessly. */
|
|
75
|
+
loops: boolean
|
|
76
|
+
/** The flow went on past `maxMs`, where the timeline stops. */
|
|
77
|
+
truncated: boolean
|
|
78
|
+
steps: TimelineStep[]
|
|
79
|
+
/** Where each overlay frame play opened sits over the screen, from the action that opened it. */
|
|
80
|
+
overlayPositions: Record<string, PrototypeOverlayPositionType>
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* What a timeline shows at a moment: one screen, two mid-crossfade with `mix` of the second, or a
|
|
85
|
+
* Smart animate `progress` of the way through its time, which its animation eases.
|
|
86
|
+
*/
|
|
87
|
+
export type TimelineFrame =
|
|
88
|
+
| { session: PlaySession }
|
|
89
|
+
| { from: PlaySession; to: PlaySession; mix: number }
|
|
90
|
+
| { smart: TimelineSmartSegment; progress: number }
|
|
91
|
+
|
|
92
|
+
/** Why a flow cannot be played: the start frame has nothing to follow, or anything else. */
|
|
93
|
+
export type TimelineErrorReason = 'nothing-to-follow' | 'invalid'
|
|
94
|
+
|
|
95
|
+
/** A flow that cannot be played as asked, with a message naming the frame or click at fault. */
|
|
96
|
+
export class TimelineError extends Error {
|
|
97
|
+
override name = 'TimelineError'
|
|
98
|
+
constructor(
|
|
99
|
+
message: string,
|
|
100
|
+
readonly reason: TimelineErrorReason = 'invalid'
|
|
101
|
+
) {
|
|
102
|
+
super(message)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Steps a timeline may take before it is refused, which stops cycles that take no time. */
|
|
107
|
+
const MAX_TIMELINE_STEPS = 10_000
|
|
108
|
+
|
|
109
|
+
/** How long an action's transition runs, in milliseconds; a cut takes none. */
|
|
110
|
+
export function transitionMs(action: PrototypeAction): number {
|
|
111
|
+
if (action.type !== 'NODE' || action.transition.type === 'INSTANT') return 0
|
|
112
|
+
return Math.max(0, action.transition.duration * 1000)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** How play shows a step: a cut, a crossfade, or Smart animate. */
|
|
116
|
+
export type PlayAnimation = 'cut' | 'dissolve' | 'smart'
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* How play animates `action` from `session`: a cut when it takes no time; Smart animate for a
|
|
120
|
+
* Smart animate Change to, or a navigation between screens while no overlay is open, as Figma
|
|
121
|
+
* has no Smart animate for overlays; a crossfade otherwise.
|
|
122
|
+
*/
|
|
123
|
+
export function animationFor(session: PlaySession, action: PrototypeAction): PlayAnimation {
|
|
124
|
+
if (transitionMs(action) === 0 || action.type !== 'NODE') return 'cut'
|
|
125
|
+
if (action.transition.type !== 'SMART_ANIMATE') return 'dissolve'
|
|
126
|
+
if (action.navigation === 'CHANGE_TO') return 'smart'
|
|
127
|
+
return action.navigation === 'NAVIGATE' && session.overlays.length === 0 ? 'smart' : 'dissolve'
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* The curve a dissolve fades along, CSS `ease-out`, which Figma's dissolve uses by default: the
|
|
132
|
+
* x and y of its two cubic Bézier control points. The player draws its crossfade with
|
|
133
|
+
* `DISSOLVE_EASING_CSS` and a recording samples `dissolveEasing`, so both fade alike.
|
|
134
|
+
*/
|
|
135
|
+
export const DISSOLVE_EASING = { x1: 0, y1: 0, x2: 0.58, y2: 1 } as const
|
|
136
|
+
|
|
137
|
+
/** `DISSOLVE_EASING` as a CSS timing function. */
|
|
138
|
+
export const DISSOLVE_EASING_CSS = `cubic-bezier(${DISSOLVE_EASING.x1}, ${DISSOLVE_EASING.y1}, ${DISSOLVE_EASING.x2}, ${DISSOLVE_EASING.y2})`
|
|
139
|
+
|
|
140
|
+
/** The share of the new screen a dissolve shows at `progress` of the way, along `DISSOLVE_EASING`. */
|
|
141
|
+
export function dissolveEasing(progress: number): number {
|
|
142
|
+
return easingAt('EASE_OUT', progress)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* What play draws, as a key two sessions share when they look alike: the base frame and its
|
|
147
|
+
* overlays. History only matters to Back. State that changes what a frame shows extends it here,
|
|
148
|
+
* and the recorder's screen cache follows.
|
|
149
|
+
*/
|
|
150
|
+
export function sessionDrawKey(session: PlaySession): string {
|
|
151
|
+
return [session.frameId, ...session.overlays].join(' ')
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function nameOf(graph: SceneGraph, id: string): string {
|
|
155
|
+
return graph.getNode(id)?.name ?? id
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function seconds(ms: number): string {
|
|
159
|
+
return `${(ms / 1000).toFixed(2)} s`
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** Whether `node` sits in `frameId`, or is that frame. */
|
|
163
|
+
function isInside(graph: SceneGraph, node: SceneNode, frameId: string): boolean {
|
|
164
|
+
let current: SceneNode | undefined = node
|
|
165
|
+
while (current) {
|
|
166
|
+
if (current.id === frameId) return true
|
|
167
|
+
current = current.parentId ? graph.getNode(current.parentId) : undefined
|
|
168
|
+
}
|
|
169
|
+
return false
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The action a click on `nodeId` runs, as a click on the canvas resolves one: the layer or its
|
|
174
|
+
* nearest ancestor inside the shown frame with an `ON_CLICK` reaction. Throws when the layer is not
|
|
175
|
+
* on the shown frame; null when nothing there reacts to a click.
|
|
176
|
+
*/
|
|
177
|
+
function clickAction(
|
|
178
|
+
graph: SceneGraph,
|
|
179
|
+
session: PlaySession,
|
|
180
|
+
click: TimelineClick,
|
|
181
|
+
index: number
|
|
182
|
+
): PrototypeAction | null {
|
|
183
|
+
const shown = shownFrame(session)
|
|
184
|
+
const node = graph.getNode(click.nodeId)
|
|
185
|
+
if (!node || !isInside(graph, node, shown)) {
|
|
186
|
+
throw new TimelineError(
|
|
187
|
+
`click ${index + 1}: '${node?.name ?? click.nodeId}' is not on the shown frame '${nameOf(graph, shown)}' at ${seconds(click.atMs)}`
|
|
188
|
+
)
|
|
189
|
+
}
|
|
190
|
+
let current: SceneNode | undefined = node
|
|
191
|
+
while (current) {
|
|
192
|
+
const reaction = current.prototypeReactions.find(
|
|
193
|
+
(candidate) => candidate.trigger.type === 'ON_CLICK'
|
|
194
|
+
)
|
|
195
|
+
const action = reaction ? primaryAction(reaction) : null
|
|
196
|
+
if (action) return action
|
|
197
|
+
if (current.id === shown) return null
|
|
198
|
+
current = current.parentId ? graph.getNode(current.parentId) : undefined
|
|
199
|
+
}
|
|
200
|
+
return null
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
interface ArmedTimer {
|
|
204
|
+
atMs: number
|
|
205
|
+
action: PrototypeAction
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** The shown frame's After delay reactions, each due `delay` after the frame finished entering. */
|
|
209
|
+
function armTimers(graph: SceneGraph, session: PlaySession, readyMs: number): ArmedTimer[] {
|
|
210
|
+
return timeoutReactions(graph, session)
|
|
211
|
+
.map(({ action, delayMs }) => ({ atMs: readyMs + delayMs, action }))
|
|
212
|
+
.toSorted((a, b) => a.atMs - b.atMs)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** Play at its start frame, which must be a top-level frame with something to follow. */
|
|
216
|
+
function startWalk(graph: SceneGraph, options: TimelineOptions): { walk: Walk; start: SceneNode } {
|
|
217
|
+
const start = graph.getNode(options.startFrameId)
|
|
218
|
+
if (!start || topFrameOf(graph, start)?.id !== start.id) {
|
|
219
|
+
throw new TimelineError(`'${start?.name ?? options.startFrameId}' is not a top-level frame`)
|
|
220
|
+
}
|
|
221
|
+
const session = startSession(start.id)
|
|
222
|
+
const walk: Walk = {
|
|
223
|
+
graph,
|
|
224
|
+
session,
|
|
225
|
+
readyMs: 0,
|
|
226
|
+
timers: armTimers(graph, session, 0),
|
|
227
|
+
clicks: (options.clicks ?? []).toSorted((a, b) => a.atMs - b.atMs),
|
|
228
|
+
clickIndex: 0,
|
|
229
|
+
skippedClicks: [],
|
|
230
|
+
segments: [],
|
|
231
|
+
steps: [],
|
|
232
|
+
overlayPositions: {}
|
|
233
|
+
}
|
|
234
|
+
if (walk.timers.length === 0 && walk.clicks.length === 0) {
|
|
235
|
+
throw new TimelineError(
|
|
236
|
+
`'${start.name}' has no After delay interaction to follow`,
|
|
237
|
+
'nothing-to-follow'
|
|
238
|
+
)
|
|
239
|
+
}
|
|
240
|
+
return { walk, start }
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/** Play in progress on the virtual clock: what is shown, since when, and what is due next. */
|
|
244
|
+
interface Walk {
|
|
245
|
+
graph: SceneGraph
|
|
246
|
+
session: PlaySession
|
|
247
|
+
/** When the shown screen finished entering; its After delays count from here. */
|
|
248
|
+
readyMs: number
|
|
249
|
+
timers: ArmedTimer[]
|
|
250
|
+
clicks: TimelineClick[]
|
|
251
|
+
clickIndex: number
|
|
252
|
+
skippedClicks: TimelineClick[]
|
|
253
|
+
segments: TimelineSegment[]
|
|
254
|
+
steps: TimelineStep[]
|
|
255
|
+
overlayPositions: Record<string, PrototypeOverlayPositionType>
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
interface WalkEvent {
|
|
259
|
+
atMs: number
|
|
260
|
+
action: PrototypeAction | null
|
|
261
|
+
trigger: TimelineStep['trigger']
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/** Holds the shown screen from when it finished entering until `endMs`. */
|
|
265
|
+
function hold(walk: Walk, endMs: number): void {
|
|
266
|
+
if (endMs > walk.readyMs) {
|
|
267
|
+
walk.segments.push({ kind: 'hold', session: walk.session, startMs: walk.readyMs, endMs })
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/** The earliest due timer or click, taken off its queue; null when nothing else will happen. */
|
|
272
|
+
function takeNextEvent(walk: Walk): WalkEvent | null {
|
|
273
|
+
const timer = walk.timers.at(0)
|
|
274
|
+
const click = walk.clicks.at(walk.clickIndex)
|
|
275
|
+
if (timer && (!click || timer.atMs <= click.atMs)) {
|
|
276
|
+
walk.timers = walk.timers.slice(1)
|
|
277
|
+
return { atMs: timer.atMs, action: timer.action, trigger: 'AFTER_TIMEOUT' }
|
|
278
|
+
}
|
|
279
|
+
if (!click) return null
|
|
280
|
+
const action = clickAction(walk.graph, walk.session, click, walk.clickIndex)
|
|
281
|
+
walk.clickIndex += 1
|
|
282
|
+
if (!action) walk.skippedClicks.push(click)
|
|
283
|
+
return { atMs: click.atMs, action, trigger: 'ON_CLICK' }
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/** The earliest event's time without taking it, or infinity when nothing else will happen. */
|
|
287
|
+
function nextEventAt(walk: Walk): number {
|
|
288
|
+
const timerAt = walk.timers.at(0)?.atMs ?? Number.POSITIVE_INFINITY
|
|
289
|
+
const clickAt = walk.clicks.at(walk.clickIndex)?.atMs ?? Number.POSITIVE_INFINITY
|
|
290
|
+
return Math.min(timerAt, clickAt)
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/** Runs `action` at `atMs`, recording the hold before it, its crossfade, and the step. */
|
|
294
|
+
function advance(walk: Walk, event: WalkEvent & { action: PrototypeAction }, next: PlaySession) {
|
|
295
|
+
const { atMs, action } = event
|
|
296
|
+
// A step while a transition still runs cuts it short where it is.
|
|
297
|
+
const running = walk.segments.at(-1)
|
|
298
|
+
if (running && running.kind !== 'hold' && running.endMs > atMs) running.endMs = atMs
|
|
299
|
+
hold(walk, atMs)
|
|
300
|
+
const durationMs = transitionMs(action)
|
|
301
|
+
const animation = animationFor(walk.session, action)
|
|
302
|
+
if (animation !== 'cut') {
|
|
303
|
+
walk.segments.push({
|
|
304
|
+
kind: animation === 'smart' ? 'smart' : 'dissolve',
|
|
305
|
+
from: walk.session,
|
|
306
|
+
to: next,
|
|
307
|
+
startMs: atMs,
|
|
308
|
+
endMs: atMs + durationMs,
|
|
309
|
+
fadeMs: durationMs,
|
|
310
|
+
...(action.type === 'NODE' && action.transition.easing
|
|
311
|
+
? { easing: action.transition.easing }
|
|
312
|
+
: {})
|
|
313
|
+
})
|
|
314
|
+
}
|
|
315
|
+
walk.steps.push({
|
|
316
|
+
atMs,
|
|
317
|
+
frameId: shownFrame(next),
|
|
318
|
+
trigger: event.trigger,
|
|
319
|
+
transition: durationMs > 0 && action.type === 'NODE' ? action.transition.type : 'INSTANT'
|
|
320
|
+
})
|
|
321
|
+
if (action.type === 'NODE' && action.navigation === 'OVERLAY' && action.nodeId) {
|
|
322
|
+
walk.overlayPositions[action.nodeId] = action.overlayPosition
|
|
323
|
+
}
|
|
324
|
+
walk.session = next
|
|
325
|
+
walk.readyMs = atMs + durationMs
|
|
326
|
+
walk.timers = armTimers(walk.graph, next, walk.readyMs)
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
function finish(walk: Walk, durationMs: number, end: 'ends' | 'loops' | 'truncated'): Timeline {
|
|
330
|
+
return {
|
|
331
|
+
segments: walk.segments,
|
|
332
|
+
durationMs,
|
|
333
|
+
loops: end === 'loops',
|
|
334
|
+
truncated: end === 'truncated',
|
|
335
|
+
steps: walk.steps,
|
|
336
|
+
overlayPositions: walk.overlayPositions,
|
|
337
|
+
skippedClicks: [...walk.skippedClicks, ...walk.clicks.slice(walk.clickIndex)]
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Plays a prototype on a virtual clock, from `startFrameId`, following its After delay
|
|
343
|
+
* reactions and the scripted clicks as the player would, without waiting for real time. Each delay
|
|
344
|
+
* counts from when the transition into its frame ends, as in Figma. The walk stops when play
|
|
345
|
+
* returns to the screen it started on (`loops`), when nothing else will happen (the last screen is
|
|
346
|
+
* held `tailMs`), or at `maxMs` (`truncated`).
|
|
347
|
+
*/
|
|
348
|
+
export function planTimeline(graph: SceneGraph, options: TimelineOptions): Timeline {
|
|
349
|
+
const { walk, start } = startWalk(graph, options)
|
|
350
|
+
const startKey = sessionDrawKey(walk.session)
|
|
351
|
+
|
|
352
|
+
for (let taken = 0; taken <= MAX_TIMELINE_STEPS; taken++) {
|
|
353
|
+
const dueAt = nextEventAt(walk)
|
|
354
|
+
if (dueAt >= options.maxMs) {
|
|
355
|
+
const endMs = Math.min(walk.readyMs + options.tailMs, options.maxMs)
|
|
356
|
+
// More is due past the cap, or the cap falls before the last transition has ended.
|
|
357
|
+
const truncated = dueAt !== Number.POSITIVE_INFINITY || walk.readyMs > options.maxMs
|
|
358
|
+
hold(walk, truncated ? options.maxMs : endMs)
|
|
359
|
+
// With no time left to hold it, the last screen still ends the timeline.
|
|
360
|
+
if (!truncated && endMs <= walk.readyMs) {
|
|
361
|
+
walk.segments.push({
|
|
362
|
+
kind: 'hold',
|
|
363
|
+
session: walk.session,
|
|
364
|
+
startMs: walk.readyMs,
|
|
365
|
+
endMs: walk.readyMs
|
|
366
|
+
})
|
|
367
|
+
}
|
|
368
|
+
return truncated ? finish(walk, options.maxMs, 'truncated') : finish(walk, endMs, 'ends')
|
|
369
|
+
}
|
|
370
|
+
const event = takeNextEvent(walk)
|
|
371
|
+
const action = event?.action
|
|
372
|
+
if (!event || !action) continue
|
|
373
|
+
const next = step(graph, walk.session, action)
|
|
374
|
+
if (next === walk.session) continue
|
|
375
|
+
advance(walk, { ...event, action }, next)
|
|
376
|
+
|
|
377
|
+
if (sessionDrawKey(next) === startKey && walk.clickIndex >= walk.clicks.length) {
|
|
378
|
+
if (walk.readyMs === 0) {
|
|
379
|
+
throw new TimelineError(`The flow loops back to '${start.name}' at once`)
|
|
380
|
+
}
|
|
381
|
+
if (walk.readyMs > options.maxMs) return finish(walk, options.maxMs, 'truncated')
|
|
382
|
+
return finish(walk, walk.readyMs, 'loops')
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
throw new TimelineError(`The flow takes more than ${MAX_TIMELINE_STEPS} steps`)
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/** What the timeline shows at `atMs`; past its end, the last screen it shows. */
|
|
389
|
+
export function frameAt(timeline: Timeline, atMs: number): TimelineFrame {
|
|
390
|
+
for (const segment of timeline.segments) {
|
|
391
|
+
if (atMs >= segment.endMs) continue
|
|
392
|
+
if (segment.kind === 'hold') return { session: segment.session }
|
|
393
|
+
const progress = (atMs - segment.startMs) / segment.fadeMs
|
|
394
|
+
if (segment.kind === 'smart') return { smart: segment, progress }
|
|
395
|
+
return { from: segment.from, to: segment.to, mix: easingAt(segment.easing, progress) }
|
|
396
|
+
}
|
|
397
|
+
const last = timeline.segments.at(-1)
|
|
398
|
+
if (!last) throw new TimelineError('The timeline is empty')
|
|
399
|
+
return { session: last.kind === 'hold' ? last.session : last.to }
|
|
400
|
+
}
|
package/src/rpc/index.ts
CHANGED
package/src/rpc/read-commands.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { sumBy } from 'es-toolkit'
|
|
2
2
|
|
|
3
|
-
import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
3
|
+
import type { BooleanOperation, MaskType, SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
4
4
|
|
|
5
|
+
import { shapeDetailFields } from '#core/figma-api/shape-details'
|
|
5
6
|
import { ELLIPSIS } from '#core/text/ellipsis'
|
|
6
7
|
import type { DocumentFontStatus } from '#core/text/font/status'
|
|
7
8
|
import { prepareGraphFonts } from '#core/text/prepare'
|
|
@@ -20,6 +21,28 @@ function walkNodes(graph: SceneGraph, rootId: string, fn: (node: SceneNode) => b
|
|
|
20
21
|
return true
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
/** A page picked by its ID, `page_id`, or by its name, `page`; the ID wins when both are given. */
|
|
25
|
+
export interface PageArgs {
|
|
26
|
+
page?: string
|
|
27
|
+
page_id?: string
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** The pages `args` picks: the one it names, none when it names a missing page, else `fallback`. */
|
|
31
|
+
function pickedPages(graph: SceneGraph, args: PageArgs, fallback: SceneNode[]): SceneNode[] {
|
|
32
|
+
const pages = graph.getPages()
|
|
33
|
+
if (args.page_id) return pages.filter((page) => page.id === args.page_id)
|
|
34
|
+
if (args.page) return pages.filter((page) => page.name === args.page).slice(0, 1)
|
|
35
|
+
return fallback
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function missingPageError(graph: SceneGraph, args: PageArgs): string {
|
|
39
|
+
const pages = graph.getPages()
|
|
40
|
+
const [label, available] = args.page_id
|
|
41
|
+
? [args.page_id, pages.map((page) => page.id)]
|
|
42
|
+
: [args.page ?? '', pages.map((page) => page.name)]
|
|
43
|
+
return `Page "${label}" not found. Available: ${available.join(', ')}`
|
|
44
|
+
}
|
|
45
|
+
|
|
23
46
|
function countDescendants(graph: SceneGraph, rootId: string): number {
|
|
24
47
|
let count = 0
|
|
25
48
|
walkNodes(graph, rootId, () => {
|
|
@@ -106,8 +129,7 @@ export const pagesCommand: RPCCommand<void, PageItem[]> = {
|
|
|
106
129
|
|
|
107
130
|
// ── tree ──
|
|
108
131
|
|
|
109
|
-
export interface TreeArgs {
|
|
110
|
-
page?: string
|
|
132
|
+
export interface TreeArgs extends PageArgs {
|
|
111
133
|
depth?: number
|
|
112
134
|
}
|
|
113
135
|
|
|
@@ -152,13 +174,9 @@ export interface TreeResult {
|
|
|
152
174
|
export const treeCommand: RPCCommand<TreeArgs, TreeResult | { error: string }> = {
|
|
153
175
|
name: 'tree',
|
|
154
176
|
execute: (graph, args) => {
|
|
155
|
-
const pages = graph.getPages()
|
|
156
177
|
const maxDepth = args.depth ?? Infinity
|
|
157
|
-
const page = args
|
|
158
|
-
if (!page)
|
|
159
|
-
return {
|
|
160
|
-
error: `Page "${args.page}" not found. Available: ${pages.map((p) => p.name).join(', ')}`
|
|
161
|
-
}
|
|
178
|
+
const page = pickedPages(graph, args, graph.getPages().slice(0, 1)).at(0)
|
|
179
|
+
if (!page) return { error: missingPageError(graph, args) }
|
|
162
180
|
|
|
163
181
|
return {
|
|
164
182
|
page: { id: page.id, name: page.name, type: page.type },
|
|
@@ -171,10 +189,9 @@ export const treeCommand: RPCCommand<TreeArgs, TreeResult | { error: string }> =
|
|
|
171
189
|
|
|
172
190
|
// ── find ──
|
|
173
191
|
|
|
174
|
-
export interface FindArgs {
|
|
192
|
+
export interface FindArgs extends PageArgs {
|
|
175
193
|
name?: string
|
|
176
194
|
type?: string
|
|
177
|
-
page?: string
|
|
178
195
|
limit?: number
|
|
179
196
|
}
|
|
180
197
|
|
|
@@ -189,7 +206,6 @@ export interface FindNodeResult {
|
|
|
189
206
|
export const findCommand: RPCCommand<FindArgs, FindNodeResult[]> = {
|
|
190
207
|
name: 'find',
|
|
191
208
|
execute: (graph, args) => {
|
|
192
|
-
const pages = graph.getPages()
|
|
193
209
|
const max = args.limit ?? 100
|
|
194
210
|
const namePattern = args.name?.toLowerCase()
|
|
195
211
|
const typeFilter = args.type?.toUpperCase()
|
|
@@ -216,12 +232,7 @@ export const findCommand: RPCCommand<FindArgs, FindNodeResult[]> = {
|
|
|
216
232
|
}
|
|
217
233
|
}
|
|
218
234
|
|
|
219
|
-
|
|
220
|
-
const page = pages.find((p) => p.name === args.page)
|
|
221
|
-
if (page) searchPage(page)
|
|
222
|
-
} else {
|
|
223
|
-
for (const page of pages) searchPage(page)
|
|
224
|
-
}
|
|
235
|
+
for (const page of pickedPages(graph, args, graph.getPages())) searchPage(page)
|
|
225
236
|
|
|
226
237
|
return results
|
|
227
238
|
}
|
|
@@ -229,9 +240,8 @@ export const findCommand: RPCCommand<FindArgs, FindNodeResult[]> = {
|
|
|
229
240
|
|
|
230
241
|
// ── query (xpath) ──
|
|
231
242
|
|
|
232
|
-
export interface QueryArgs {
|
|
243
|
+
export interface QueryArgs extends PageArgs {
|
|
233
244
|
selector: string
|
|
234
|
-
page?: string
|
|
235
245
|
limit?: number
|
|
236
246
|
}
|
|
237
247
|
|
|
@@ -251,6 +261,7 @@ export const queryCommand: RPCCommand<QueryArgs, QueryNodeResult[] | { error: st
|
|
|
251
261
|
try {
|
|
252
262
|
const nodes = await queryByXPath(graph, args.selector, {
|
|
253
263
|
page: args.page,
|
|
264
|
+
pageId: args.page_id,
|
|
254
265
|
limit: args.limit
|
|
255
266
|
})
|
|
256
267
|
return nodes.map((n) => ({
|
|
@@ -289,7 +300,14 @@ export interface NodeResult {
|
|
|
289
300
|
fills: unknown[]
|
|
290
301
|
strokes: unknown[]
|
|
291
302
|
effects: unknown[]
|
|
292
|
-
cornerRadius
|
|
303
|
+
cornerRadius?: number
|
|
304
|
+
topLeftRadius?: number
|
|
305
|
+
topRightRadius?: number
|
|
306
|
+
bottomRightRadius?: number
|
|
307
|
+
bottomLeftRadius?: number
|
|
308
|
+
isMask?: boolean
|
|
309
|
+
maskType?: MaskType
|
|
310
|
+
booleanOperation?: BooleanOperation
|
|
293
311
|
blendMode: string
|
|
294
312
|
layoutMode: string
|
|
295
313
|
layoutDirection: string
|
|
@@ -315,7 +333,6 @@ export const nodeCommand: RPCCommand<NodeArgs, NodeResult | { error: string }> =
|
|
|
315
333
|
const variable = graph.variables.get(varId)
|
|
316
334
|
boundVars[field] = variable?.name ?? varId
|
|
317
335
|
}
|
|
318
|
-
|
|
319
336
|
return {
|
|
320
337
|
id: node.id,
|
|
321
338
|
name: node.name,
|
|
@@ -328,7 +345,7 @@ export const nodeCommand: RPCCommand<NodeArgs, NodeResult | { error: string }> =
|
|
|
328
345
|
fills: node.fills,
|
|
329
346
|
strokes: node.strokes,
|
|
330
347
|
effects: node.effects,
|
|
331
|
-
|
|
348
|
+
...shapeDetailFields(node),
|
|
332
349
|
blendMode: node.blendMode,
|
|
333
350
|
layoutMode: node.layoutMode,
|
|
334
351
|
layoutDirection: node.layoutDirection,
|
package/src/text/font/faces.ts
CHANGED
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
type ParsedFontStyle
|
|
8
8
|
} from '@pairdraw/scene-graph/font-style'
|
|
9
9
|
|
|
10
|
+
import { fontAxes } from './variation'
|
|
11
|
+
|
|
10
12
|
/** A weight, upright or italic. */
|
|
11
13
|
export interface FaceWeight {
|
|
12
14
|
weight: number
|
|
@@ -92,3 +94,23 @@ export function fontFaceFromFigmaFontName(fontName: {
|
|
|
92
94
|
export function fontFaceRenderFamily(family: string, style: string): string {
|
|
93
95
|
return `__pairdraw_font__${family.replace(/[^a-z0-9_-]+/giu, '_')}__${style.replace(/[^a-z0-9_-]+/giu, '_')}`
|
|
94
96
|
}
|
|
97
|
+
|
|
98
|
+
/** What a font file is registered with in the page's `document.fonts`. */
|
|
99
|
+
export interface BrowserFaceDescriptors {
|
|
100
|
+
weight: string
|
|
101
|
+
style: 'normal' | 'italic'
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The page face for a font file loaded as `style`. A variable font covers its whole `wght` range,
|
|
106
|
+
* so text at any weight draws from the font's own instance; registered at the one weight `style`
|
|
107
|
+
* names, every other weight would fall back to that instance, synthesized bold or not at all.
|
|
108
|
+
*/
|
|
109
|
+
export function browserFaceDescriptors(style: string, data: ArrayBuffer): BrowserFaceDescriptors {
|
|
110
|
+
const { weight, italic } = parseFontStyle(style)
|
|
111
|
+
const wght = fontAxes(data)?.find((axis) => axis.tag === 'wght')
|
|
112
|
+
return {
|
|
113
|
+
weight: wght ? `${wght.min} ${wght.max}` : String(weight),
|
|
114
|
+
style: italic ? 'italic' : 'normal'
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { uniq } from 'es-toolkit/array'
|
|
2
|
+
|
|
3
|
+
import { fontTableView } from './variation'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The OpenType feature tags a font's GSUB table lists, in the table's own order, or `null` for a
|
|
7
|
+
* font without one. The panel offers a feature only when the font actually has it, as Figma does.
|
|
8
|
+
*/
|
|
9
|
+
export function fontFeatureTags(data: ArrayBuffer): string[] | null {
|
|
10
|
+
const gsub = fontTableView(data, 'GSUB')
|
|
11
|
+
if (!gsub || gsub.byteLength < 14) return null
|
|
12
|
+
// GSUB header: version (4), ScriptList offset (2), FeatureList offset (2), LookupList offset (2);
|
|
13
|
+
// version 1.1 adds a FeatureVariations offset (4). The FeatureList offset is at byte 6 either way.
|
|
14
|
+
const featureListOffset = gsub.getUint16(6)
|
|
15
|
+
if (featureListOffset + 2 > gsub.byteLength) return null
|
|
16
|
+
const count = gsub.getUint16(featureListOffset)
|
|
17
|
+
const tags: string[] = []
|
|
18
|
+
for (let index = 0; index < count; index++) {
|
|
19
|
+
// Each FeatureRecord: a 4-byte tag and a 2-byte offset to its feature table.
|
|
20
|
+
const record = featureListOffset + 2 + index * 6
|
|
21
|
+
if (record + 4 > gsub.byteLength) break
|
|
22
|
+
let tag = ''
|
|
23
|
+
for (let c = 0; c < 4; c++) tag += String.fromCharCode(gsub.getUint8(record + c))
|
|
24
|
+
tags.push(tag.toUpperCase())
|
|
25
|
+
}
|
|
26
|
+
return uniq(tags)
|
|
27
|
+
}
|