@pairdraw/core 0.19.2 → 0.21.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/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 +46 -0
- package/dist/canvas/noise/shader.d.ts.map +1 -0
- package/dist/canvas/noise/shader.js +166 -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 +74 -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/renderer/chunks/index.d.ts +1 -1
- package/dist/canvas/renderer/colors.d.ts +20 -5
- package/dist/canvas/renderer/colors.d.ts.map +1 -1
- package/dist/canvas/renderer/colors.js +48 -42
- package/dist/canvas/renderer/colors.js.map +1 -1
- package/dist/canvas/renderer/document-surface.d.ts +25 -0
- package/dist/canvas/renderer/document-surface.d.ts.map +1 -0
- package/dist/canvas/renderer/document-surface.js +46 -0
- package/dist/canvas/renderer/document-surface.js.map +1 -0
- package/dist/canvas/renderer/fonts.d.ts.map +1 -1
- package/dist/canvas/renderer/fonts.js +6 -4
- 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 +10 -3
- package/dist/canvas/renderer/lifecycle.js.map +1 -1
- package/dist/canvas/renderer/methods.d.ts.map +1 -1
- package/dist/canvas/renderer/methods.js +1 -0
- package/dist/canvas/renderer/methods.js.map +1 -1
- package/dist/canvas/renderer/pipeline.d.ts.map +1 -1
- package/dist/canvas/renderer/pipeline.js +36 -3
- 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/retained-backing.d.ts.map +1 -1
- package/dist/canvas/renderer/retained-backing.js +2 -1
- package/dist/canvas/renderer/retained-backing.js.map +1 -1
- 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/tiles/surface-pool.d.ts.map +1 -1
- package/dist/canvas/renderer/tiles/surface-pool.js +2 -7
- package/dist/canvas/renderer/tiles/surface-pool.js.map +1 -1
- package/dist/canvas/renderer/types.d.ts +18 -3
- 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 +42 -4
- package/dist/canvas/renderer.d.ts.map +1 -1
- package/dist/canvas/renderer.js +57 -5
- 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 +45 -12
- package/dist/canvas/scene.js.map +1 -1
- package/dist/canvas/shaders/effect.d.ts.map +1 -1
- package/dist/canvas/shaders/effect.js +2 -1
- package/dist/canvas/shaders/effect.js.map +1 -1
- package/dist/canvas/shadows/shape.d.ts.map +1 -1
- package/dist/canvas/shadows/shape.js +4 -2
- package/dist/canvas/shadows/shape.js.map +1 -1
- package/dist/canvas/shadows/silhouette.js +1 -1
- package/dist/canvas/shadows.d.ts.map +1 -1
- package/dist/canvas/shadows.js +4 -2
- package/dist/canvas/shadows.js.map +1 -1
- package/dist/canvas/text/decorations.d.ts +2 -2
- package/dist/canvas/text/decorations.d.ts.map +1 -1
- package/dist/canvas/text/decorations.js +5 -5
- package/dist/canvas/text/decorations.js.map +1 -1
- package/dist/canvas/text/index.js +1 -1
- package/dist/canvas/text/index.js.map +1 -1
- package/dist/canvas/text/paragraph/index.d.ts +2 -2
- package/dist/canvas/text/paragraph/index.d.ts.map +1 -1
- package/dist/canvas/text/paragraph/index.js +16 -5
- package/dist/canvas/text/paragraph/index.js.map +1 -1
- package/dist/canvas/text/renderer.d.ts +2 -1
- package/dist/canvas/text/renderer.d.ts.map +1 -1
- package/dist/canvas/text/shape.js +4 -4
- package/dist/canvas/text/shape.js.map +1 -1
- package/dist/canvas/texture.d.ts +20 -0
- package/dist/canvas/texture.d.ts.map +1 -0
- package/dist/canvas/texture.js +101 -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/renderer.d.ts.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/clipboard/assets.d.ts.map +1 -1
- package/dist/editor/clipboard/assets.js +3 -3
- package/dist/editor/clipboard/assets.js.map +1 -1
- package/dist/editor/clipboard/component-matches.d.ts +13 -0
- package/dist/editor/clipboard/component-matches.d.ts.map +1 -0
- package/dist/editor/clipboard/component-matches.js +50 -0
- package/dist/editor/clipboard/component-matches.js.map +1 -0
- package/dist/editor/clipboard/dependencies.d.ts +7 -0
- package/dist/editor/clipboard/dependencies.d.ts.map +1 -1
- package/dist/editor/clipboard/dependencies.js +5 -0
- package/dist/editor/clipboard/dependencies.js.map +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.d.ts.map +1 -1
- package/dist/editor/clipboard.js +48 -19
- package/dist/editor/clipboard.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/properties.d.ts.map +1 -1
- package/dist/editor/components/properties.js +3 -3
- package/dist/editor/components/properties.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 +26 -2
- package/dist/editor/create.d.ts.map +1 -1
- package/dist/editor/create.js +16 -60
- 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 +171 -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 +9 -2
- 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 +4 -2
- 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/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 +4 -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/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 +4 -0
- package/dist/editor/selection.d.ts +5 -0
- package/dist/editor/selection.d.ts.map +1 -1
- package/dist/editor/shapes/pencil.js +1 -1
- package/dist/editor/structure/state.d.ts.map +1 -1
- package/dist/editor/structure/state.js +2 -2
- package/dist/editor/structure/state.js.map +1 -1
- package/dist/editor/text.d.ts.map +1 -1
- package/dist/editor/text.js +2 -2
- package/dist/editor/text.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 +5 -1
- package/dist/editor/types.d.ts.map +1 -1
- package/dist/editor/variables.js +3 -3
- 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.js +3 -0
- 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/fresh-read.d.ts +15 -0
- package/dist/figma-api/fresh-read.d.ts.map +1 -0
- package/dist/figma-api/fresh-read.js +54 -0
- package/dist/figma-api/fresh-read.js.map +1 -0
- package/dist/figma-api/graph-ref.d.ts +9 -0
- package/dist/figma-api/graph-ref.d.ts.map +1 -0
- package/dist/figma-api/graph-ref.js +14 -0
- package/dist/figma-api/graph-ref.js.map +1 -0
- package/dist/figma-api/index.d.ts +11 -1
- package/dist/figma-api/index.d.ts.map +1 -1
- package/dist/figma-api/index.js +16 -4
- 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/pending-layout.d.ts +3 -3
- package/dist/figma-api/pending-layout.d.ts.map +1 -1
- package/dist/figma-api/pending-layout.js +7 -3
- package/dist/figma-api/pending-layout.js.map +1 -1
- package/dist/figma-api/pending-sync.d.ts +1 -1
- package/dist/figma-api/pending-sync.d.ts.map +1 -1
- package/dist/figma-api/pending-sync.js +3 -1
- package/dist/figma-api/pending-sync.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 +2 -1
- package/dist/figma-api/proxy.js.map +1 -1
- package/dist/figma-api/reactions.d.ts +59 -15
- package/dist/figma-api/reactions.d.ts.map +1 -1
- package/dist/figma-api/reactions.js +160 -32
- package/dist/figma-api/reactions.js.map +1 -1
- package/dist/figma-api/render-bounds.js +1 -1
- package/dist/figma-api/surface.d.ts +6 -3
- package/dist/figma-api/surface.d.ts.map +1 -1
- package/dist/figma-api/surface.js +6 -2
- package/dist/figma-api/surface.js.map +1 -1
- package/dist/figma-api/transform.d.ts +1 -1
- package/dist/figma-api/variables/index.d.ts.map +1 -1
- package/dist/figma-api/variables/index.js +2 -2
- package/dist/figma-api/variables/index.js.map +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/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/css/known.js +1 -1
- package/dist/io/formats/design-tokens/css/known.js.map +1 -1
- package/dist/io/formats/design-tokens/css/read.d.ts +3 -1
- package/dist/io/formats/design-tokens/css/read.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/css/read.js +11 -5
- package/dist/io/formats/design-tokens/css/read.js.map +1 -1
- package/dist/io/formats/design-tokens/css/sync.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/css/sync.js +17 -4
- package/dist/io/formats/design-tokens/css/sync.js.map +1 -1
- package/dist/io/formats/design-tokens/css/values.d.ts +6 -5
- package/dist/io/formats/design-tokens/css/values.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/css/values.js +24 -8
- package/dist/io/formats/design-tokens/css/values.js.map +1 -1
- package/dist/io/formats/design-tokens/decode.d.ts +7 -6
- package/dist/io/formats/design-tokens/decode.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/decode.js +14 -13
- package/dist/io/formats/design-tokens/decode.js.map +1 -1
- package/dist/io/formats/design-tokens/export.js +3 -3
- package/dist/io/formats/design-tokens/export.js.map +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/plan/index.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/plan/index.js +4 -3
- package/dist/io/formats/design-tokens/plan/index.js.map +1 -1
- package/dist/io/formats/design-tokens/plan/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/plan/styles.js +9 -9
- package/dist/io/formats/design-tokens/plan/styles.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 +4 -4
- package/dist/io/formats/design-tokens/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/styles.js +7 -7
- 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/design-tokens/values.d.ts +10 -5
- package/dist/io/formats/design-tokens/values.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/values.js +13 -7
- package/dist/io/formats/design-tokens/values.js.map +1 -1
- 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.js +1 -0
- package/dist/io/formats/drawio/index.js.map +1 -1
- package/dist/io/formats/drawio/placement.d.ts +1 -1
- package/dist/io/formats/drawio/warnings.js +2 -2
- package/dist/io/formats/drawio/warnings.js.map +1 -1
- package/dist/io/formats/fig/export/index.d.ts.map +1 -1
- package/dist/io/formats/fig/export/index.js +15 -3
- package/dist/io/formats/fig/export/index.js.map +1 -1
- package/dist/io/formats/fig/export/patch/index.d.ts.map +1 -1
- package/dist/io/formats/fig/export/patch/index.js +7 -1
- package/dist/io/formats/fig/export/patch/index.js.map +1 -1
- package/dist/io/formats/fig/export/setup.d.ts +7 -2
- package/dist/io/formats/fig/export/setup.d.ts.map +1 -1
- package/dist/io/formats/fig/export/setup.js +12 -13
- package/dist/io/formats/fig/export/setup.js.map +1 -1
- package/dist/io/formats/fig/export/variables.d.ts.map +1 -1
- package/dist/io/formats/fig/export/variables.js +9 -7
- package/dist/io/formats/fig/export/variables.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/vectors.d.ts +2 -1
- package/dist/io/formats/html/vectors.d.ts.map +1 -1
- package/dist/io/formats/html/vectors.js +4 -2
- package/dist/io/formats/html/vectors.js.map +1 -1
- package/dist/io/formats/mermaid/layers.js +2 -2
- package/dist/io/formats/mermaid/layers.js.map +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/export.d.ts.map +1 -1
- package/dist/io/formats/pdf/export.js +1 -0
- package/dist/io/formats/pdf/export.js.map +1 -1
- package/dist/io/formats/pdf/prepare.d.ts +4 -4
- package/dist/io/formats/pdf/prepare.d.ts.map +1 -1
- package/dist/io/formats/pdf/prepare.js +2 -2
- package/dist/io/formats/pdf/prepare.js.map +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 +35 -5
- 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/pptx/style.js +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 +1 -1
- package/dist/io/formats/raster/render.d.ts.map +1 -1
- package/dist/io/formats/raster/render.js +13 -4
- package/dist/io/formats/raster/render.js.map +1 -1
- package/dist/io/formats/svg/defs.d.ts +10 -8
- package/dist/io/formats/svg/defs.d.ts.map +1 -1
- package/dist/io/formats/svg/defs.js +13 -64
- 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 +11 -2
- package/dist/io/formats/svg/export.d.ts.map +1 -1
- package/dist/io/formats/svg/export.js +177 -37
- package/dist/io/formats/svg/export.js.map +1 -1
- package/dist/io/formats/svg/filter.d.ts +30 -0
- package/dist/io/formats/svg/filter.d.ts.map +1 -0
- package/dist/io/formats/svg/filter.js +48 -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/import.d.ts +4 -2
- package/dist/io/formats/svg/import.d.ts.map +1 -1
- package/dist/io/formats/svg/import.js +2 -1
- package/dist/io/formats/svg/import.js.map +1 -1
- 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/export.d.ts.map +1 -1
- package/dist/io/formats/svg/text/export.js +8 -8
- package/dist/io/formats/svg/text/export.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 +8 -5
- 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 +41 -11
- package/dist/io/formats.js.map +1 -1
- package/dist/io/subgraph.d.ts.map +1 -1
- package/dist/io/subgraph.js +1 -1
- package/dist/io/subgraph.js.map +1 -1
- package/dist/io/types.d.ts +20 -5
- package/dist/io/types.d.ts.map +1 -1
- package/dist/kiwi/fig/parse/transfer.d.ts +1 -1
- package/dist/kiwi/fig/session/options.d.ts +3 -0
- package/dist/kiwi/fig/session/options.d.ts.map +1 -1
- package/dist/kiwi/fig/session/options.js +4 -0
- package/dist/kiwi/fig/session/options.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/yoga-helpers.d.ts +2 -1
- package/dist/layout/yoga-helpers.d.ts.map +1 -1
- package/dist/layout/yoga-helpers.js +7 -1
- 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 +26 -2
- package/dist/layout.js.map +1 -1
- package/dist/lint/fixes.d.ts.map +1 -1
- package/dist/lint/fixes.js +10 -4
- 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 +12 -0
- package/dist/lint/linter.d.ts.map +1 -1
- package/dist/lint/linter.js +112 -10
- 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/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/types.d.ts +25 -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/comments.d.ts +4 -1
- package/dist/pairdraw-api/comments.d.ts.map +1 -1
- package/dist/pairdraw-api/comments.js +5 -0
- package/dist/pairdraw-api/comments.js.map +1 -1
- 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 +48 -4
- package/dist/pairdraw-api/index.d.ts.map +1 -1
- package/dist/pairdraw-api/index.js +59 -6
- package/dist/pairdraw-api/index.js.map +1 -1
- package/dist/pairdraw-api/nodes.d.ts +13 -2
- 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/analyze-commands.js +1 -1
- package/dist/rpc/read-commands.d.ts +2 -2
- package/dist/rpc/read-commands.js +2 -2
- package/dist/rpc/read-commands.js.map +1 -1
- package/dist/rpc/variables-command.js +2 -2
- package/dist/rpc/variables-command.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 +60 -1
- package/dist/text/font/manager.js.map +1 -1
- package/dist/text/font/provider.d.ts +15 -0
- package/dist/text/font/provider.d.ts.map +1 -0
- package/dist/text/font/provider.js +18 -0
- package/dist/text/font/provider.js.map +1 -0
- package/dist/text/font/readiness.d.ts +32 -0
- package/dist/text/font/readiness.d.ts.map +1 -0
- package/dist/text/font/{status.js → readiness.js} +8 -4
- package/dist/text/font/readiness.js.map +1 -0
- package/dist/text/index.d.ts +12 -9
- package/dist/text/index.js +6 -3
- package/dist/text/prepare.d.ts +9 -4
- package/dist/text/prepare.d.ts.map +1 -1
- package/dist/text/prepare.js +9 -4
- package/dist/text/prepare.js.map +1 -1
- 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/colors.js +1 -1
- 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 +192 -0
- package/dist/tools/analyze/responsive/index.js.map +1 -0
- package/dist/tools/analyze/responsive/widths.d.ts +27 -0
- package/dist/tools/analyze/responsive/widths.d.ts.map +1 -0
- package/dist/tools/analyze/responsive/widths.js +49 -0
- package/dist/tools/analyze/responsive/widths.js.map +1 -0
- package/dist/tools/analyze.d.ts +3 -1
- package/dist/tools/analyze.js +3 -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/tokens.d.ts.map +1 -1
- package/dist/tools/codegen/tokens.js +2 -2
- package/dist/tools/codegen/tokens.js.map +1 -1
- package/dist/tools/codegen.d.ts +2 -1
- package/dist/tools/codegen.js +2 -1
- package/dist/tools/comments.d.ts.map +1 -1
- package/dist/tools/comments.js +2 -2
- package/dist/tools/comments.js.map +1 -1
- package/dist/tools/component-catalog.d.ts.map +1 -1
- package/dist/tools/component-catalog.js +5 -3
- package/dist/tools/component-catalog.js.map +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.d.ts.map +1 -1
- package/dist/tools/create/html.js +2 -3
- 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 +1 -0
- package/dist/tools/create/mermaid.js.map +1 -1
- package/dist/tools/create/svg.js +5 -1
- package/dist/tools/create/svg.js.map +1 -1
- package/dist/tools/create/vector.js +2 -2
- package/dist/tools/create/vector.js.map +1 -1
- package/dist/tools/css/shorthand.d.ts +20 -0
- package/dist/tools/css/shorthand.d.ts.map +1 -0
- package/dist/tools/css/shorthand.js +54 -0
- package/dist/tools/css/shorthand.js.map +1 -0
- package/dist/tools/describe/index.js +2 -2
- package/dist/tools/describe/index.js.map +1 -1
- package/dist/tools/describe/issues.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/html-host.d.ts.map +1 -1
- package/dist/tools/html-host.js +5 -3
- package/dist/tools/html-host.js.map +1 -1
- package/dist/tools/image-ai/apply.d.ts.map +1 -1
- package/dist/tools/image-ai/apply.js +1 -3
- package/dist/tools/image-ai/apply.js.map +1 -1
- package/dist/tools/image-ai/generate.d.ts.map +1 -1
- package/dist/tools/image-ai/generate.js +2 -0
- package/dist/tools/image-ai/generate.js.map +1 -1
- package/dist/tools/image-ai/service.d.ts.map +1 -1
- package/dist/tools/image-ai/service.js +5 -3
- package/dist/tools/image-ai/service.js.map +1 -1
- package/dist/tools/index.d.ts +3 -1
- package/dist/tools/index.js +3 -1
- package/dist/tools/modify/effects.js +1 -1
- package/dist/tools/modify/effects.js.map +1 -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/geometry.d.ts.map +1 -1
- package/dist/tools/modify/geometry.js +14 -3
- package/dist/tools/modify/geometry.js.map +1 -1
- package/dist/tools/modify/layout.d.ts.map +1 -1
- package/dist/tools/modify/layout.js +35 -8
- package/dist/tools/modify/layout.js.map +1 -1
- package/dist/tools/modify/matching.d.ts.map +1 -1
- package/dist/tools/modify/matching.js +10 -10
- package/dist/tools/modify/matching.js.map +1 -1
- package/dist/tools/modify/paint.d.ts.map +1 -1
- package/dist/tools/modify/paint.js +56 -4
- package/dist/tools/modify/paint.js.map +1 -1
- package/dist/tools/modify/reactions.d.ts.map +1 -1
- package/dist/tools/modify/reactions.js +2 -2
- 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 +29 -8
- 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/prompts/codegen.js +1 -1
- package/dist/tools/prompts/codegen.js.map +1 -1
- package/dist/tools/read/css.d.ts +14 -0
- package/dist/tools/read/css.d.ts.map +1 -0
- package/dist/tools/read/css.js +306 -0
- package/dist/tools/read/css.js.map +1 -0
- 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 +1 -0
- package/dist/tools/read/libraries.js.map +1 -1
- package/dist/tools/read/reactions.js +1 -1
- package/dist/tools/read/reactions.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 -5
- package/dist/tools/read/space.js.map +1 -1
- package/dist/tools/read.d.ts +2 -1
- package/dist/tools/read.js +2 -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 +5 -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 +24 -6
- package/dist/tools/schema.d.ts.map +1 -1
- package/dist/tools/schema.js +10 -6
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/script/host.d.ts.map +1 -1
- package/dist/tools/script/host.js +5 -3
- package/dist/tools/script/host.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 +8 -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/variables/collections.js +1 -1
- package/dist/tools/variables/collections.js.map +1 -1
- package/dist/tools/variables/values.d.ts.map +1 -1
- package/dist/tools/variables/values.js +4 -4
- package/dist/tools/variables/values.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/vectorize.d.ts.map +1 -1
- package/dist/tools/vector/vectorize.js +7 -4
- 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 +21 -0
- package/dist/tools/video-host.js.map +1 -0
- package/dist/vector/point-transform.d.ts +1 -1
- package/dist/vector/vectorize/svg/gradients.d.ts +2 -2
- package/dist/vector/vectorize/svg/gradients.d.ts.map +1 -1
- package/dist/vector/vectorize/svg/gradients.js +5 -5
- package/dist/vector/vectorize/svg/gradients.js.map +1 -1
- package/dist/vector/vectorize/svg/to-vectors.d.ts +3 -1
- package/dist/vector/vectorize/svg/to-vectors.d.ts.map +1 -1
- package/dist/vector/vectorize/svg/to-vectors.js +13 -12
- package/dist/vector/vectorize/svg/to-vectors.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 +169 -0
- package/src/canvas/noise/table.ts +91 -0
- package/src/canvas/noise/tile.ts +95 -0
- package/src/canvas/overlays/auto-layout-hover.ts +47 -65
- package/src/canvas/renderer/colors.ts +76 -50
- package/src/canvas/renderer/document-surface.ts +53 -0
- package/src/canvas/renderer/fonts.ts +6 -4
- package/src/canvas/renderer/lifecycle.ts +10 -4
- package/src/canvas/renderer/methods.ts +1 -0
- package/src/canvas/renderer/pipeline.ts +40 -4
- package/src/canvas/renderer/play-scenes.ts +51 -0
- package/src/canvas/renderer/retained-backing.ts +2 -1
- package/src/canvas/renderer/tiles/cache.ts +54 -1
- package/src/canvas/renderer/tiles/controller.ts +30 -1
- package/src/canvas/renderer/tiles/surface-pool.ts +9 -7
- package/src/canvas/renderer/types.ts +18 -2
- package/src/canvas/renderer.ts +76 -14
- package/src/canvas/scene.ts +69 -12
- package/src/canvas/shaders/effect.ts +2 -1
- package/src/canvas/shadows/shape.ts +4 -2
- package/src/canvas/shadows.ts +5 -2
- package/src/canvas/text/decorations.ts +15 -5
- package/src/canvas/text/index.ts +9 -1
- package/src/canvas/text/paragraph/index.ts +16 -6
- package/src/canvas/text/renderer.ts +2 -1
- package/src/canvas/text/shape.ts +4 -4
- package/src/canvas/texture.ts +137 -0
- package/src/clipboard.ts +23 -10
- package/src/constants.ts +6 -0
- 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/assets.ts +6 -2
- package/src/editor/clipboard/component-matches.ts +65 -0
- package/src/editor/clipboard/dependencies.ts +22 -1
- package/src/editor/clipboard/export.ts +24 -7
- package/src/editor/clipboard.ts +74 -20
- package/src/editor/components/instances.ts +31 -0
- package/src/editor/components/properties.ts +3 -2
- package/src/editor/create.ts +25 -69
- 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 +208 -0
- package/src/editor/fonts.ts +19 -0
- package/src/editor/history/atomic-tool.ts +32 -3
- package/src/editor/history/capture.ts +19 -0
- package/src/editor/history/document-change.ts +5 -17
- package/src/editor/history/edit.ts +11 -1
- package/src/editor/history/subtree.ts +13 -2
- package/src/editor/index.ts +11 -0
- package/src/editor/pages.ts +40 -29
- package/src/editor/play/states.ts +1 -1
- package/src/editor/read-only/actions.ts +4 -0
- package/src/editor/render-requests.ts +83 -0
- package/src/editor/selection/overlays.ts +1 -0
- package/src/editor/structure/state.ts +2 -1
- package/src/editor/text.ts +2 -1
- package/src/editor/tool-registry.ts +2 -1
- package/src/editor/types.ts +4 -0
- package/src/editor/variables.ts +3 -3
- 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 +7 -0
- 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/fresh-read.ts +57 -0
- package/src/figma-api/graph-ref.ts +13 -0
- package/src/figma-api/index.ts +22 -4
- package/src/figma-api/overrides.ts +295 -3
- package/src/figma-api/paints.ts +24 -9
- package/src/figma-api/pending-layout.ts +7 -3
- package/src/figma-api/pending-sync.ts +4 -1
- package/src/figma-api/proxy.ts +8 -2
- package/src/figma-api/reactions.ts +212 -33
- package/src/figma-api/surface.ts +6 -2
- package/src/figma-api/variables/index.ts +5 -4
- package/src/global.d.ts +26 -0
- package/src/io/formats/boolean-path.ts +60 -0
- package/src/io/formats/design-tokens/css/known.ts +1 -1
- package/src/io/formats/design-tokens/css/read.ts +20 -7
- package/src/io/formats/design-tokens/css/sync.ts +9 -4
- package/src/io/formats/design-tokens/css/values.ts +37 -9
- package/src/io/formats/design-tokens/decode.ts +17 -12
- package/src/io/formats/design-tokens/export.ts +3 -3
- 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/plan/index.ts +6 -5
- package/src/io/formats/design-tokens/plan/styles.ts +37 -10
- package/src/io/formats/design-tokens/project.ts +40 -9
- package/src/io/formats/design-tokens/styles.ts +20 -9
- package/src/io/formats/design-tokens/sync/apply.ts +130 -0
- package/src/io/formats/design-tokens/sync/drift.ts +589 -0
- package/src/io/formats/design-tokens/sync/files.ts +40 -0
- package/src/io/formats/design-tokens/values.ts +15 -8
- 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 +2 -0
- package/src/io/formats/drawio/warnings.ts +2 -2
- package/src/io/formats/fig/export/index.ts +36 -3
- package/src/io/formats/fig/export/patch/index.ts +12 -1
- package/src/io/formats/fig/export/setup.ts +25 -15
- package/src/io/formats/fig/export/variables.ts +17 -6
- 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/vectors.ts +9 -2
- package/src/io/formats/mermaid/layers.ts +2 -2
- package/src/io/formats/pdf/document.ts +14 -4
- package/src/io/formats/pdf/export.ts +1 -0
- package/src/io/formats/pdf/prepare.ts +6 -6
- package/src/io/formats/pen/imports.ts +5 -6
- package/src/io/formats/pen/index.ts +41 -7
- 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 +24 -5
- package/src/io/formats/svg/defs.ts +24 -80
- package/src/io/formats/svg/effects.ts +131 -0
- package/src/io/formats/svg/export.ts +295 -49
- package/src/io/formats/svg/filter.ts +57 -0
- package/src/io/formats/svg/grain.ts +249 -0
- package/src/io/formats/svg/import.ts +6 -3
- package/src/io/formats/svg/strokes.ts +2 -2
- package/src/io/formats/svg/text/export.ts +10 -8
- package/src/io/formats/svg/text/layout.ts +15 -5
- 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 +66 -11
- package/src/io/subgraph.ts +4 -1
- package/src/io/types.ts +29 -10
- package/src/kiwi/fig/session/options.ts +4 -1
- package/src/layout/auto-layout-handles.ts +396 -0
- package/src/layout/yoga-helpers.ts +8 -0
- package/src/layout.ts +49 -1
- package/src/lint/fixes.ts +12 -3
- package/src/lint/index.ts +3 -1
- package/src/lint/linter.ts +108 -11
- package/src/lint/presets.ts +2 -0
- package/src/lint/rules/design-memory.ts +97 -0
- package/src/lint/rules/index.ts +6 -1
- package/src/lint/rules/no-unbound-token-values.ts +73 -0
- package/src/lint/types.ts +32 -0
- package/src/node/video.ts +196 -0
- package/src/pairdraw-api/comments.ts +6 -0
- package/src/pairdraw-api/design-memory.ts +61 -0
- package/src/pairdraw-api/index.ts +88 -9
- 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/read-commands.ts +4 -4
- package/src/rpc/variables-command.ts +2 -2
- package/src/text/font/features.ts +27 -0
- package/src/text/font/manager.ts +79 -1
- package/src/text/font/provider.ts +26 -0
- package/src/text/font/{status.ts → readiness.ts} +13 -9
- package/src/text/index.ts +4 -1
- package/src/text/prepare.ts +9 -4
- package/src/text/replace-fonts.ts +171 -0
- package/src/tools/analyze/responsive/index.ts +257 -0
- package/src/tools/analyze/responsive/widths.ts +63 -0
- package/src/tools/analyze.ts +4 -0
- package/src/tools/codegen/token-sync.ts +98 -0
- package/src/tools/codegen/tokens.ts +4 -2
- package/src/tools/codegen.ts +1 -0
- package/src/tools/comments.ts +6 -4
- package/src/tools/component-catalog.ts +5 -3
- package/src/tools/create/components.ts +4 -0
- package/src/tools/create/html.ts +1 -3
- package/src/tools/create/icons.ts +2 -1
- package/src/tools/create/mermaid.ts +1 -0
- package/src/tools/create/svg.ts +5 -1
- package/src/tools/create/vector.ts +2 -2
- package/src/tools/css/shorthand.ts +64 -0
- package/src/tools/describe/index.ts +2 -8
- package/src/tools/design-memory.ts +72 -0
- package/src/tools/html-host.ts +5 -3
- package/src/tools/image-ai/apply.ts +0 -2
- package/src/tools/image-ai/generate.ts +2 -0
- package/src/tools/image-ai/service.ts +5 -3
- package/src/tools/index.ts +3 -0
- package/src/tools/modify/effects.ts +1 -1
- package/src/tools/modify/fonts.ts +34 -0
- package/src/tools/modify/geometry.ts +16 -3
- package/src/tools/modify/layout.ts +47 -13
- package/src/tools/modify/matching.ts +14 -11
- package/src/tools/modify/paint.ts +85 -5
- package/src/tools/modify/reactions.ts +16 -8
- package/src/tools/modify/text.ts +56 -15
- package/src/tools/modify/update.ts +46 -2
- package/src/tools/modify.ts +1 -0
- package/src/tools/prompts/codegen.md +2 -1
- package/src/tools/read/css.ts +365 -0
- package/src/tools/read/fonts.ts +24 -2
- package/src/tools/read/libraries.ts +1 -0
- package/src/tools/read/reactions.ts +3 -2
- package/src/tools/read/space.ts +3 -4
- package/src/tools/read.ts +1 -0
- package/src/tools/registry/core.ts +5 -2
- package/src/tools/registry/extended.ts +28 -1
- package/src/tools/schema.ts +42 -9
- package/src/tools/script/host.ts +6 -3
- package/src/tools/stock-photo.ts +1 -0
- package/src/tools/structure/basic.ts +1 -0
- package/src/tools/structure/batch.ts +12 -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/variables/collections.ts +1 -1
- package/src/tools/variables/values.ts +16 -5
- package/src/tools/vector/boolean.ts +4 -0
- package/src/tools/vector/vectorize.ts +11 -4
- package/src/tools/vector/video.ts +228 -0
- package/src/tools/vector.ts +1 -0
- package/src/tools/video-host.ts +20 -0
- package/src/vector/vectorize/svg/gradients.ts +8 -5
- package/src/vector/vectorize/svg/to-vectors.ts +48 -14
- package/dist/text/font/status.d.ts +0 -28
- package/dist/text/font/status.d.ts.map +0 -1
- package/dist/text/font/status.js.map +0 -1
|
@@ -3,18 +3,30 @@ import * as v from "valibot";
|
|
|
3
3
|
//#region src/figma-api/reactions.d.ts
|
|
4
4
|
declare const reactionSchema: v.StrictObjectSchema<{
|
|
5
5
|
readonly trigger: v.VariantSchema<"type", [v.StrictObjectSchema<{
|
|
6
|
-
readonly type: v.
|
|
6
|
+
readonly type: v.PicklistSchema<["ON_CLICK", "ON_HOVER", "ON_PRESS"], undefined>;
|
|
7
7
|
}, undefined>, v.StrictObjectSchema<{
|
|
8
8
|
readonly type: v.LiteralSchema<"AFTER_TIMEOUT", undefined>;
|
|
9
9
|
readonly timeout: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
10
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
11
|
+
readonly type: v.PicklistSchema<["MOUSE_ENTER", "MOUSE_LEAVE"], undefined>;
|
|
12
|
+
readonly delay: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>, 0>;
|
|
13
|
+
readonly deprecatedVersion: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
10
14
|
}, undefined>], undefined>;
|
|
11
15
|
readonly actions: v.SchemaWithPipe<readonly [v.ArraySchema<v.VariantSchema<"type", [v.StrictObjectSchema<{
|
|
12
16
|
readonly type: v.LiteralSchema<"NODE", undefined>;
|
|
13
|
-
readonly destinationId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.DescriptionAction<string,
|
|
14
|
-
readonly
|
|
17
|
+
readonly destinationId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.DescriptionAction<string, string>]>, undefined>;
|
|
18
|
+
readonly variantProperties: v.OptionalSchema<v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>, v.MinEntriesAction<{
|
|
19
|
+
[x: string]: string;
|
|
20
|
+
}, 1, undefined>, v.DescriptionAction<{
|
|
21
|
+
[x: string]: string;
|
|
22
|
+
}, string>]>, undefined>;
|
|
23
|
+
readonly navigation: v.PicklistSchema<("OVERLAY" | "NAVIGATE" | "CHANGE_TO" | "SCROLL_TO")[], undefined>;
|
|
15
24
|
readonly transition: v.OptionalSchema<v.StrictObjectSchema<{
|
|
16
|
-
readonly type: v.PicklistSchema<("INSTANT" | "DISSOLVE")[], undefined>;
|
|
25
|
+
readonly type: v.PicklistSchema<("INSTANT" | "DISSOLVE" | "SMART_ANIMATE")[], undefined>;
|
|
17
26
|
readonly duration: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
27
|
+
readonly easing: v.OptionalSchema<v.StrictObjectSchema<{
|
|
28
|
+
readonly type: v.PicklistSchema<readonly ["EASE_OUT", "EASE_IN", "EASE_IN_AND_OUT", "LINEAR"], undefined>;
|
|
29
|
+
}, undefined>, undefined>;
|
|
18
30
|
}, undefined>, {
|
|
19
31
|
readonly type: "INSTANT";
|
|
20
32
|
readonly duration: 0;
|
|
@@ -26,11 +38,17 @@ declare const reactionSchema: v.StrictObjectSchema<{
|
|
|
26
38
|
readonly type: v.LiteralSchema<"CLOSE", undefined>;
|
|
27
39
|
}, undefined>], undefined>, undefined>, v.MinLengthAction<({
|
|
28
40
|
type: "NODE";
|
|
29
|
-
destinationId
|
|
30
|
-
|
|
41
|
+
destinationId?: string | undefined;
|
|
42
|
+
variantProperties?: {
|
|
43
|
+
[x: string]: string;
|
|
44
|
+
} | undefined;
|
|
45
|
+
navigation: "OVERLAY" | "NAVIGATE" | "CHANGE_TO" | "SCROLL_TO";
|
|
31
46
|
transition: {
|
|
32
|
-
type: "INSTANT" | "DISSOLVE";
|
|
47
|
+
type: "INSTANT" | "DISSOLVE" | "SMART_ANIMATE";
|
|
33
48
|
duration: number;
|
|
49
|
+
easing?: {
|
|
50
|
+
type: "EASE_OUT" | "EASE_IN" | "EASE_IN_AND_OUT" | "LINEAR";
|
|
51
|
+
} | undefined;
|
|
34
52
|
};
|
|
35
53
|
overlayRelativePosition: "CENTER" | "TOP_LEFT" | "TOP_CENTER" | "TOP_RIGHT" | "BOTTOM_LEFT" | "BOTTOM_CENTER" | "BOTTOM_RIGHT";
|
|
36
54
|
} | {
|
|
@@ -42,18 +60,30 @@ declare const reactionSchema: v.StrictObjectSchema<{
|
|
|
42
60
|
/** The plugin shape as a contract, for a tool that takes connections as arguments. */
|
|
43
61
|
declare const figmaReactionsSchema: v.ArraySchema<v.StrictObjectSchema<{
|
|
44
62
|
readonly trigger: v.VariantSchema<"type", [v.StrictObjectSchema<{
|
|
45
|
-
readonly type: v.
|
|
63
|
+
readonly type: v.PicklistSchema<["ON_CLICK", "ON_HOVER", "ON_PRESS"], undefined>;
|
|
46
64
|
}, undefined>, v.StrictObjectSchema<{
|
|
47
65
|
readonly type: v.LiteralSchema<"AFTER_TIMEOUT", undefined>;
|
|
48
66
|
readonly timeout: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
67
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
68
|
+
readonly type: v.PicklistSchema<["MOUSE_ENTER", "MOUSE_LEAVE"], undefined>;
|
|
69
|
+
readonly delay: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>, 0>;
|
|
70
|
+
readonly deprecatedVersion: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
49
71
|
}, undefined>], undefined>;
|
|
50
72
|
readonly actions: v.SchemaWithPipe<readonly [v.ArraySchema<v.VariantSchema<"type", [v.StrictObjectSchema<{
|
|
51
73
|
readonly type: v.LiteralSchema<"NODE", undefined>;
|
|
52
|
-
readonly destinationId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.DescriptionAction<string,
|
|
53
|
-
readonly
|
|
74
|
+
readonly destinationId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.DescriptionAction<string, string>]>, undefined>;
|
|
75
|
+
readonly variantProperties: v.OptionalSchema<v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>, v.MinEntriesAction<{
|
|
76
|
+
[x: string]: string;
|
|
77
|
+
}, 1, undefined>, v.DescriptionAction<{
|
|
78
|
+
[x: string]: string;
|
|
79
|
+
}, string>]>, undefined>;
|
|
80
|
+
readonly navigation: v.PicklistSchema<("OVERLAY" | "NAVIGATE" | "CHANGE_TO" | "SCROLL_TO")[], undefined>;
|
|
54
81
|
readonly transition: v.OptionalSchema<v.StrictObjectSchema<{
|
|
55
|
-
readonly type: v.PicklistSchema<("INSTANT" | "DISSOLVE")[], undefined>;
|
|
82
|
+
readonly type: v.PicklistSchema<("INSTANT" | "DISSOLVE" | "SMART_ANIMATE")[], undefined>;
|
|
56
83
|
readonly duration: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
84
|
+
readonly easing: v.OptionalSchema<v.StrictObjectSchema<{
|
|
85
|
+
readonly type: v.PicklistSchema<readonly ["EASE_OUT", "EASE_IN", "EASE_IN_AND_OUT", "LINEAR"], undefined>;
|
|
86
|
+
}, undefined>, undefined>;
|
|
57
87
|
}, undefined>, {
|
|
58
88
|
readonly type: "INSTANT";
|
|
59
89
|
readonly duration: 0;
|
|
@@ -65,11 +95,17 @@ declare const figmaReactionsSchema: v.ArraySchema<v.StrictObjectSchema<{
|
|
|
65
95
|
readonly type: v.LiteralSchema<"CLOSE", undefined>;
|
|
66
96
|
}, undefined>], undefined>, undefined>, v.MinLengthAction<({
|
|
67
97
|
type: "NODE";
|
|
68
|
-
destinationId
|
|
69
|
-
|
|
98
|
+
destinationId?: string | undefined;
|
|
99
|
+
variantProperties?: {
|
|
100
|
+
[x: string]: string;
|
|
101
|
+
} | undefined;
|
|
102
|
+
navigation: "OVERLAY" | "NAVIGATE" | "CHANGE_TO" | "SCROLL_TO";
|
|
70
103
|
transition: {
|
|
71
|
-
type: "INSTANT" | "DISSOLVE";
|
|
104
|
+
type: "INSTANT" | "DISSOLVE" | "SMART_ANIMATE";
|
|
72
105
|
duration: number;
|
|
106
|
+
easing?: {
|
|
107
|
+
type: "EASE_OUT" | "EASE_IN" | "EASE_IN_AND_OUT" | "LINEAR";
|
|
108
|
+
} | undefined;
|
|
73
109
|
};
|
|
74
110
|
overlayRelativePosition: "CENTER" | "TOP_LEFT" | "TOP_CENTER" | "TOP_RIGHT" | "BOTTOM_LEFT" | "BOTTOM_CENTER" | "BOTTOM_RIGHT";
|
|
75
111
|
} | {
|
|
@@ -87,10 +123,18 @@ declare function toFigmaReaction(reaction: PrototypeReaction): FigmaReaction;
|
|
|
87
123
|
/** The validation context: where the reactions live, and what they may point at. */
|
|
88
124
|
interface ReactionContext {
|
|
89
125
|
graph: SceneGraph;
|
|
90
|
-
/** The
|
|
126
|
+
/** The layer the reactions are on, which a Change to or Scroll to destination must suit. */
|
|
127
|
+
nodeId: string;
|
|
128
|
+
/** The page the layer is on; a navigation's destination must be a top-level frame on it. */
|
|
91
129
|
pageId: string;
|
|
92
130
|
/** The reactions the layer has now, whose ids this keeps by position. */
|
|
93
131
|
previous?: readonly PrototypeReaction[];
|
|
132
|
+
/**
|
|
133
|
+
* An instance's main component's reactions: a reaction kept under one of their ids that an
|
|
134
|
+
* edit changed, from what the layer held at its place and from the main's, becomes the
|
|
135
|
+
* instance's own, with an id of its own.
|
|
136
|
+
*/
|
|
137
|
+
inherited?: readonly PrototypeReaction[];
|
|
94
138
|
}
|
|
95
139
|
/**
|
|
96
140
|
* `value` as the layer's prototype reactions, or an error naming what Pairdraw cannot play.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactions.d.ts","names":[],"sources":["../../src/figma-api/reactions.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"reactions.d.ts","names":[],"sources":["../../src/figma-api/reactions.ts"],"mappings":";;;cAoHM,gBAAc,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAQP,sBAAoB,EAAA,YAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAGrB,gBAAgB,EAAE,mBAAmB;KACrC,uBAAuB;KACvB,sBAAsB;;iBAGlB,gBAAgB,UAAU,oBAAoB;;UAsC7C;EACf,OAAO;;EAEP;;EAEA;;EAEA,oBAAoB;;;;;;EAMpB,qBAAqB;;;;;;;;iBASP,oBAAoB,gBAAgB,SAAS,kBAAkB"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { issuePath } from "./effects.js";
|
|
2
|
+
import { asInstanceEdit, sameReaction } from "../prototype/reactions.js";
|
|
3
|
+
import { PROTOTYPE_EASINGS } from "@pairdraw/scene-graph/constants";
|
|
2
4
|
import { generateId } from "@pairdraw/scene-graph";
|
|
3
5
|
import * as v from "valibot";
|
|
6
|
+
import { variantSetsAround } from "@pairdraw/scene-graph/components";
|
|
7
|
+
import { parseVariantName } from "@pairdraw/scene-graph/variant-name";
|
|
4
8
|
//#region src/figma-api/reactions.ts
|
|
5
9
|
/**
|
|
6
10
|
* Triggers Figma's plugin API offers that a prototype in Pairdraw cannot start from, and the
|
|
7
|
-
* message it gets instead.
|
|
11
|
+
* message it gets instead.
|
|
8
12
|
*/
|
|
9
13
|
const UNSUPPORTED_TRIGGERS = {
|
|
10
14
|
ON_DRAG: true,
|
|
11
|
-
ON_HOVER: true,
|
|
12
|
-
ON_PRESS: true,
|
|
13
|
-
MOUSE_ENTER: true,
|
|
14
|
-
MOUSE_LEAVE: true,
|
|
15
15
|
MOUSE_UP: true,
|
|
16
16
|
MOUSE_DOWN: true,
|
|
17
17
|
ON_KEY_DOWN: true
|
|
@@ -33,14 +33,29 @@ const overlayPositionSchema = v.picklist([
|
|
|
33
33
|
"BOTTOM_CENTER",
|
|
34
34
|
"BOTTOM_RIGHT"
|
|
35
35
|
]);
|
|
36
|
+
/** Figma's easing presets, which play has; a spring or a custom curve is refused. */
|
|
37
|
+
const easingSchema = v.strictObject({ type: v.picklist(PROTOTYPE_EASINGS) });
|
|
36
38
|
const transitionSchema = v.strictObject({
|
|
37
|
-
type: v.picklist([
|
|
38
|
-
|
|
39
|
+
type: v.picklist([
|
|
40
|
+
"INSTANT",
|
|
41
|
+
"DISSOLVE",
|
|
42
|
+
"SMART_ANIMATE"
|
|
43
|
+
]),
|
|
44
|
+
duration: secondsSchema,
|
|
45
|
+
easing: v.optional(easingSchema)
|
|
39
46
|
});
|
|
47
|
+
/** A variant's values for its set's properties, as `{ State: 'Hover', Size: 'Large' }`. */
|
|
48
|
+
const variantPropertiesSchema = v.pipe(v.record(v.string(), v.string()), v.minEntries(1), v.description("CHANGE_TO: the values of the variant to change to, in the layer's nearest component set, such as { State: \"Hover\" }. Name every property of a set whose variants share values, as a partial match is refused. Resolved to the variant, so get_reactions reads it back as a destinationId."));
|
|
40
49
|
const nodeActionSchema = v.strictObject({
|
|
41
50
|
type: v.literal("NODE"),
|
|
42
|
-
destinationId: v.pipe(v.string(), v.minLength(1), v.description("
|
|
43
|
-
|
|
51
|
+
destinationId: v.optional(v.pipe(v.string(), v.minLength(1), v.description("NAVIGATE/OVERLAY: a top-level frame on the page; CHANGE_TO: a variant of the set the layer is a variant of, an instance of, or inside; SCROLL_TO: a layer in the layer's top-level frame. Omit only for CHANGE_TO, and name the variant with variantProperties."))),
|
|
52
|
+
variantProperties: v.optional(variantPropertiesSchema),
|
|
53
|
+
navigation: v.picklist([
|
|
54
|
+
"NAVIGATE",
|
|
55
|
+
"OVERLAY",
|
|
56
|
+
"CHANGE_TO",
|
|
57
|
+
"SCROLL_TO"
|
|
58
|
+
]),
|
|
44
59
|
transition: v.optional(transitionSchema, {
|
|
45
60
|
type: "INSTANT",
|
|
46
61
|
duration: 0
|
|
@@ -52,10 +67,22 @@ const actionSchema = v.variant("type", [
|
|
|
52
67
|
v.strictObject({ type: v.literal("BACK") }),
|
|
53
68
|
v.strictObject({ type: v.literal("CLOSE") })
|
|
54
69
|
]);
|
|
55
|
-
const triggerSchema = v.variant("type", [
|
|
56
|
-
type: v.
|
|
57
|
-
|
|
58
|
-
|
|
70
|
+
const triggerSchema = v.variant("type", [
|
|
71
|
+
v.strictObject({ type: v.picklist([
|
|
72
|
+
"ON_CLICK",
|
|
73
|
+
"ON_HOVER",
|
|
74
|
+
"ON_PRESS"
|
|
75
|
+
]) }),
|
|
76
|
+
v.strictObject({
|
|
77
|
+
type: v.literal("AFTER_TIMEOUT"),
|
|
78
|
+
timeout: secondsSchema
|
|
79
|
+
}),
|
|
80
|
+
v.strictObject({
|
|
81
|
+
type: v.picklist(["MOUSE_ENTER", "MOUSE_LEAVE"]),
|
|
82
|
+
delay: v.optional(secondsSchema, 0),
|
|
83
|
+
deprecatedVersion: v.optional(v.boolean())
|
|
84
|
+
})
|
|
85
|
+
]);
|
|
59
86
|
const reactionSchema = v.strictObject({
|
|
60
87
|
trigger: triggerSchema,
|
|
61
88
|
actions: v.pipe(v.array(actionSchema), v.minLength(1))
|
|
@@ -66,26 +93,51 @@ const figmaReactionsSchema = reactionsSchema;
|
|
|
66
93
|
/** `reaction` in the plugin shape: the trigger and every action, named as Figma names them. */
|
|
67
94
|
function toFigmaReaction(reaction) {
|
|
68
95
|
return {
|
|
69
|
-
trigger: reaction.trigger
|
|
70
|
-
type: "AFTER_TIMEOUT",
|
|
71
|
-
timeout: reaction.trigger.delay
|
|
72
|
-
} : { type: "ON_CLICK" },
|
|
96
|
+
trigger: toFigmaTrigger(reaction.trigger),
|
|
73
97
|
actions: reaction.actions.map(toFigmaAction)
|
|
74
98
|
};
|
|
75
99
|
}
|
|
100
|
+
function toFigmaTrigger({ type, delay }) {
|
|
101
|
+
if (type === "AFTER_TIMEOUT") return {
|
|
102
|
+
type,
|
|
103
|
+
timeout: delay
|
|
104
|
+
};
|
|
105
|
+
if (type === "MOUSE_ENTER" || type === "MOUSE_LEAVE") return {
|
|
106
|
+
type,
|
|
107
|
+
delay
|
|
108
|
+
};
|
|
109
|
+
return { type };
|
|
110
|
+
}
|
|
76
111
|
function toFigmaAction(action) {
|
|
77
112
|
if (action.type !== "NODE") return { type: action.type };
|
|
78
113
|
return {
|
|
79
114
|
type: "NODE",
|
|
80
115
|
destinationId: action.nodeId ?? "",
|
|
81
116
|
navigation: action.navigation,
|
|
82
|
-
transition:
|
|
83
|
-
type: action.transition.type,
|
|
84
|
-
duration: action.transition.duration
|
|
85
|
-
},
|
|
117
|
+
transition: toFigmaTransition(action.transition),
|
|
86
118
|
overlayRelativePosition: action.overlayPosition
|
|
87
119
|
};
|
|
88
120
|
}
|
|
121
|
+
function toFigmaTransition({ type, duration, easing }) {
|
|
122
|
+
return easing ? {
|
|
123
|
+
type,
|
|
124
|
+
duration,
|
|
125
|
+
easing: { type: easing }
|
|
126
|
+
} : {
|
|
127
|
+
type,
|
|
128
|
+
duration
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function fromFigmaTransition({ type, duration, easing }) {
|
|
132
|
+
return easing ? {
|
|
133
|
+
type,
|
|
134
|
+
duration,
|
|
135
|
+
easing: easing.type
|
|
136
|
+
} : {
|
|
137
|
+
type,
|
|
138
|
+
duration
|
|
139
|
+
};
|
|
140
|
+
}
|
|
89
141
|
/**
|
|
90
142
|
* `value` as the layer's prototype reactions, or an error naming what Pairdraw cannot play.
|
|
91
143
|
* Accepts Figma's plugin shape only: a trigger Figma offers but playback does not start from,
|
|
@@ -101,36 +153,112 @@ function parseFigmaReactions(value, context) {
|
|
|
101
153
|
throw new Error(`Property "reactions" failed validation: ${issue.message} at ${issuePath(issue.path) || "reactions"}`);
|
|
102
154
|
}
|
|
103
155
|
return result.output.map((reaction, index) => {
|
|
104
|
-
|
|
156
|
+
const parsed = {
|
|
105
157
|
id: context.previous?.[index]?.id ?? generateId(),
|
|
106
158
|
trigger: toTrigger(reaction.trigger),
|
|
107
159
|
actions: reaction.actions.map((action) => toAction(action, context, index))
|
|
108
160
|
};
|
|
161
|
+
const held = context.previous?.[index];
|
|
162
|
+
if (held && sameReaction(held, parsed)) return parsed;
|
|
163
|
+
return asInstanceEdit(parsed, context.inherited ?? []);
|
|
109
164
|
});
|
|
110
165
|
}
|
|
111
166
|
function toTrigger(trigger) {
|
|
167
|
+
const type = trigger.type;
|
|
168
|
+
if (trigger.type === "AFTER_TIMEOUT") return {
|
|
169
|
+
type,
|
|
170
|
+
delay: trigger.timeout
|
|
171
|
+
};
|
|
112
172
|
return {
|
|
113
|
-
type
|
|
114
|
-
delay:
|
|
173
|
+
type,
|
|
174
|
+
delay: "delay" in trigger ? trigger.delay : 0
|
|
115
175
|
};
|
|
116
176
|
}
|
|
117
177
|
function toAction(action, context, reactionIndex) {
|
|
118
178
|
if (action.type !== "NODE") return { type: action.type };
|
|
119
|
-
|
|
179
|
+
const destinationId = resolveDestinationId(action, context, reactionIndex);
|
|
180
|
+
assertDestination({
|
|
181
|
+
...action,
|
|
182
|
+
destinationId
|
|
183
|
+
}, context, reactionIndex);
|
|
120
184
|
return {
|
|
121
185
|
type: "NODE",
|
|
122
|
-
nodeId:
|
|
186
|
+
nodeId: destinationId,
|
|
123
187
|
navigation: action.navigation,
|
|
124
|
-
transition: action.transition,
|
|
188
|
+
transition: fromFigmaTransition(action.transition),
|
|
125
189
|
overlayPosition: action.navigation === "OVERLAY" ? action.overlayRelativePosition : "CENTER"
|
|
126
190
|
};
|
|
127
191
|
}
|
|
128
|
-
/**
|
|
129
|
-
|
|
192
|
+
/**
|
|
193
|
+
* The layer a NODE action points at: its `destinationId`, or for a Change to, the variant of the
|
|
194
|
+
* layer's set whose `variantProperties` it names.
|
|
195
|
+
*/
|
|
196
|
+
function resolveDestinationId(action, context, index) {
|
|
197
|
+
const at = `reactions[${index}]`;
|
|
198
|
+
const { destinationId, variantProperties, navigation } = action;
|
|
199
|
+
if (destinationId && variantProperties) throw failure(`${at} names both destinationId and variantProperties; give one`);
|
|
200
|
+
if (variantProperties) {
|
|
201
|
+
if (navigation !== "CHANGE_TO") throw failure(`${at}: variantProperties is for CHANGE_TO only, not ${navigation}`);
|
|
202
|
+
return variantByProperties(variantProperties, context, at);
|
|
203
|
+
}
|
|
204
|
+
if (!destinationId) throw failure(navigation === "CHANGE_TO" ? `${at} must name the variant it Changes to, in destinationId or variantProperties` : `${at} must name the layer it goes to, in destinationId`);
|
|
205
|
+
return destinationId;
|
|
206
|
+
}
|
|
207
|
+
/** The id of the variant of the sets around the layer whose properties are `properties`. */
|
|
208
|
+
function variantByProperties(properties, context, at) {
|
|
209
|
+
const sets = variantSetsAround(context.graph, context.nodeId);
|
|
210
|
+
const nearest = sets.at(0);
|
|
211
|
+
if (!nearest) throw failure(`${at}: only a variant, an instance of one, or a layer inside one can Change to another variant`);
|
|
212
|
+
const wanted = Object.entries(properties).map(([name, value]) => `${name}=${value}`).join(", ");
|
|
213
|
+
for (const set of sets) {
|
|
214
|
+
const matches = context.graph.getChildren(set.id).filter((child) => {
|
|
215
|
+
if (child.type !== "COMPONENT") return false;
|
|
216
|
+
const values = {
|
|
217
|
+
...parseVariantName(child.name),
|
|
218
|
+
...child.componentPropertyValues
|
|
219
|
+
};
|
|
220
|
+
return Object.entries(properties).every(([name, value]) => values[name] === value);
|
|
221
|
+
});
|
|
222
|
+
if (matches.length === 1) return matches[0].id;
|
|
223
|
+
if (matches.length > 1) {
|
|
224
|
+
const names = matches.map((match) => `"${match.name}"`).join(", ");
|
|
225
|
+
throw failure(`${at}: ${wanted} matches ${matches.length} variants of ${set.name} (${names}); name every property of the variant`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
throw failure(`${at}: no variant of ${nearest.name} with ${wanted}`);
|
|
229
|
+
}
|
|
230
|
+
function failure(message) {
|
|
231
|
+
return /* @__PURE__ */ new Error(`Property "reactions" failed validation: ${message}`);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* A destination play can show: a navigation's is a frame at the top of the layer's page, a Change
|
|
235
|
+
* to's a variant of a set the layer belongs to, and a Scroll to's a layer in the layer's
|
|
236
|
+
* top-level frame.
|
|
237
|
+
*/
|
|
238
|
+
function assertDestination(action, context, index) {
|
|
239
|
+
const { destinationId, navigation } = action;
|
|
130
240
|
const destination = context.graph.getNode(destinationId);
|
|
131
241
|
const at = `reactions[${index}]`;
|
|
132
|
-
if (!destination) throw
|
|
133
|
-
if (
|
|
242
|
+
if (!destination) throw failure(`no layer ${destinationId} at ${at}.actions[0].destinationId`);
|
|
243
|
+
if (navigation === "CHANGE_TO") return assertVariant(destination, context, at);
|
|
244
|
+
if (navigation === "SCROLL_TO") return assertScrollTarget(destination, context, at);
|
|
245
|
+
if (destination.type !== "FRAME" || destination.parentId !== context.pageId) throw failure(`${at} must navigate to a top-level frame on the same page, not ${destination.type} "${destination.name}"`);
|
|
246
|
+
}
|
|
247
|
+
function assertVariant(destination, context, at) {
|
|
248
|
+
const sets = variantSetsAround(context.graph, context.nodeId);
|
|
249
|
+
const nearest = sets.at(0);
|
|
250
|
+
if (!nearest) throw failure(`${at}: only a variant, an instance of one, or a layer inside one can Change to another variant`);
|
|
251
|
+
const inSet = sets.some((set) => set.id === destination.parentId);
|
|
252
|
+
if (destination.type !== "COMPONENT" || !inSet) throw failure(`${at} must Change to a variant of ${nearest.name}, not ${destination.type} "${destination.name}"`);
|
|
253
|
+
}
|
|
254
|
+
/** The page's direct child a layer sits in, which play shows as one screen. */
|
|
255
|
+
function topLevelOf(graph, nodeId, pageId) {
|
|
256
|
+
return graph.closest(nodeId, (node) => node.parentId === pageId);
|
|
257
|
+
}
|
|
258
|
+
function assertScrollTarget(destination, context, at) {
|
|
259
|
+
const { graph, nodeId, pageId } = context;
|
|
260
|
+
const top = topLevelOf(graph, nodeId, pageId);
|
|
261
|
+
if (!top || destination.id === top.id || !graph.isDescendant(destination.id, top.id)) throw failure(`${at} must Scroll to a layer inside the same top-level frame, not ${destination.type} "${destination.name}"`);
|
|
134
262
|
}
|
|
135
263
|
/** Figma's first unsupported trigger or action kind in `value`, if it has one. */
|
|
136
264
|
function unsupportedKind(value) {
|
|
@@ -140,7 +268,7 @@ function unsupportedKind(value) {
|
|
|
140
268
|
const trigger = reaction.trigger;
|
|
141
269
|
if (trigger && typeof trigger === "object" && "type" in trigger) {
|
|
142
270
|
const type = trigger.type;
|
|
143
|
-
if (typeof type === "string" && type in UNSUPPORTED_TRIGGERS) return `a prototype starts from ON_CLICK or AFTER_TIMEOUT, not ${type}`;
|
|
271
|
+
if (typeof type === "string" && type in UNSUPPORTED_TRIGGERS) return `a prototype starts from ON_CLICK, ON_HOVER, ON_PRESS, MOUSE_ENTER, MOUSE_LEAVE or AFTER_TIMEOUT, not ${type}`;
|
|
144
272
|
}
|
|
145
273
|
const actions = reaction.actions;
|
|
146
274
|
if (!Array.isArray(actions)) continue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactions.js","names":[],"sources":["../../src/figma-api/reactions.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport { generateId } from '@pairdraw/scene-graph'\nimport type {\n PrototypeAction,\n PrototypeNavigationType,\n PrototypeOverlayPositionType,\n PrototypeReaction,\n PrototypeTransitionType,\n PrototypeTriggerType,\n SceneGraph\n} from '@pairdraw/scene-graph'\n\nimport { issuePath } from '#core/figma-api/effects'\n\n/**\n * Triggers Figma's plugin API offers that a prototype in Pairdraw cannot start from, and the\n * message it gets instead. Only a click and a timeout play.\n */\nconst UNSUPPORTED_TRIGGERS: Record<string, true> = {\n ON_DRAG: true,\n ON_HOVER: true,\n ON_PRESS: true,\n MOUSE_ENTER: true,\n MOUSE_LEAVE: true,\n MOUSE_UP: true,\n MOUSE_DOWN: true,\n ON_KEY_DOWN: true\n}\n\n/** Actions Figma's plugin API offers that a prototype in Pairdraw cannot run. */\nconst UNSUPPORTED_ACTIONS: Record<string, true> = {\n URL: true,\n SET_VARIABLE: true,\n CONDITIONAL: true,\n SET_VARIABLE_MODE: true\n}\n\n// No `v.finite()` action: the MCP tool contract turns this schema into JSON Schema, which\n// has no notion of infinities, and JSON numbers are always finite anyway.\nconst secondsSchema = v.pipe(v.number(), v.minValue(0))\n\nconst overlayPositionSchema = v.picklist([\n 'CENTER',\n 'TOP_LEFT',\n 'TOP_CENTER',\n 'TOP_RIGHT',\n 'BOTTOM_LEFT',\n 'BOTTOM_CENTER',\n 'BOTTOM_RIGHT'\n] satisfies PrototypeOverlayPositionType[])\n\nconst transitionSchema = v.strictObject({\n type: v.picklist(['INSTANT', 'DISSOLVE'] satisfies PrototypeTransitionType[]),\n duration: secondsSchema\n})\n\nconst nodeActionSchema = v.strictObject({\n type: v.literal('NODE'),\n destinationId: v.pipe(v.string(), v.minLength(1), v.description('Top-level frame on the page.')),\n navigation: v.picklist(['NAVIGATE', 'OVERLAY'] satisfies PrototypeNavigationType[]),\n transition: v.optional(transitionSchema, { type: 'INSTANT', duration: 0 }),\n overlayRelativePosition: v.optional(overlayPositionSchema, 'CENTER')\n})\n\nconst actionSchema = v.variant('type', [\n nodeActionSchema,\n v.strictObject({ type: v.literal('BACK') }),\n v.strictObject({ type: v.literal('CLOSE') })\n])\n\nconst triggerSchema = v.variant('type', [\n v.strictObject({ type: v.literal('ON_CLICK') }),\n v.strictObject({ type: v.literal('AFTER_TIMEOUT'), timeout: secondsSchema })\n])\n\nconst reactionSchema = v.strictObject({\n trigger: triggerSchema,\n actions: v.pipe(v.array(actionSchema), v.minLength(1))\n})\n\nconst reactionsSchema = v.array(reactionSchema)\n\n/** The plugin shape as a contract, for a tool that takes connections as arguments. */\nexport const figmaReactionsSchema = reactionsSchema\n\n/** A reaction as Figma's plugin API reads and writes it (`Reaction` in `@figma/plugin-typings`). */\nexport type FigmaReaction = v.InferOutput<typeof reactionSchema>\nexport type FigmaReactionTrigger = FigmaReaction['trigger']\nexport type FigmaReactionAction = FigmaReaction['actions'][number]\n\n/** `reaction` in the plugin shape: the trigger and every action, named as Figma names them. */\nexport function toFigmaReaction(reaction: PrototypeReaction): FigmaReaction {\n const trigger: FigmaReactionTrigger =\n reaction.trigger.type === 'AFTER_TIMEOUT'\n ? { type: 'AFTER_TIMEOUT', timeout: reaction.trigger.delay }\n : { type: 'ON_CLICK' }\n return { trigger, actions: reaction.actions.map(toFigmaAction) }\n}\n\nfunction toFigmaAction(action: PrototypeAction): FigmaReactionAction {\n if (action.type !== 'NODE') return { type: action.type }\n return {\n type: 'NODE',\n destinationId: action.nodeId ?? '',\n navigation: action.navigation,\n transition: { type: action.transition.type, duration: action.transition.duration },\n overlayRelativePosition: action.overlayPosition\n }\n}\n\n/** The validation context: where the reactions live, and what they may point at. */\nexport interface ReactionContext {\n graph: SceneGraph\n /** The page the layer is on; a destination must be a top-level frame on it. */\n pageId: string\n /** The reactions the layer has now, whose ids this keeps by position. */\n previous?: readonly PrototypeReaction[]\n}\n\n/**\n * `value` as the layer's prototype reactions, or an error naming what Pairdraw cannot play.\n * Accepts Figma's plugin shape only: a trigger Figma offers but playback does not start from,\n * an action, transition, navigation or overlay spot outside the model, and a destination that\n * is not a top-level frame on the layer's page are refused rather than kept unplayable.\n */\nexport function parseFigmaReactions(value: unknown, context: ReactionContext): PrototypeReaction[] {\n const unsupported = unsupportedKind(value)\n if (unsupported) throw new Error(`Property \"reactions\" failed validation: ${unsupported}`)\n const result = v.safeParse(reactionsSchema, value)\n if (!result.success) {\n const [issue] = result.issues\n throw new Error(\n `Property \"reactions\" failed validation: ${issue.message} at ${issuePath(issue.path) || 'reactions'}`\n )\n }\n return result.output.map((reaction, index) => {\n const id = context.previous?.[index]?.id ?? generateId()\n return {\n id,\n trigger: toTrigger(reaction.trigger),\n actions: reaction.actions.map((action) => toAction(action, context, index))\n }\n })\n}\n\nfunction toTrigger(trigger: FigmaReactionTrigger): PrototypeReaction['trigger'] {\n const type: PrototypeTriggerType = trigger.type\n return { type, delay: trigger.type === 'AFTER_TIMEOUT' ? trigger.timeout : 0 }\n}\n\nfunction toAction(\n action: FigmaReactionAction,\n context: ReactionContext,\n reactionIndex: number\n): PrototypeAction {\n if (action.type !== 'NODE') return { type: action.type }\n assertDestination(action.destinationId, context, reactionIndex)\n return {\n type: 'NODE',\n nodeId: action.destinationId,\n navigation: action.navigation,\n transition: action.transition,\n // Only an overlay uses the spot; Figma keeps CENTER on a navigation.\n overlayPosition: action.navigation === 'OVERLAY' ? action.overlayRelativePosition : 'CENTER'\n }\n}\n\n/** A destination must be a frame at the top of the layer's page, as the play can only show one. */\nfunction assertDestination(destinationId: string, context: ReactionContext, index: number): void {\n const destination = context.graph.getNode(destinationId)\n const at = `reactions[${index}]`\n if (!destination) {\n throw new Error(\n `Property \"reactions\" failed validation: no layer ${destinationId} at ${at}.actions[0].destinationId`\n )\n }\n if (destination.type !== 'FRAME' || destination.parentId !== context.pageId) {\n throw new Error(\n `Property \"reactions\" failed validation: ${at} must navigate to a top-level frame on the same page, not ${destination.type} \"${destination.name}\"`\n )\n }\n}\n\n/** Figma's first unsupported trigger or action kind in `value`, if it has one. */\nfunction unsupportedKind(value: unknown): string | null {\n if (!Array.isArray(value)) return null\n const reactions = value.filter(\n (reaction): reaction is Record<string, unknown> =>\n Boolean(reaction) && typeof reaction === 'object'\n )\n for (const reaction of reactions) {\n const trigger = reaction.trigger\n if (trigger && typeof trigger === 'object' && 'type' in trigger) {\n const type = trigger.type\n if (typeof type === 'string' && type in UNSUPPORTED_TRIGGERS) {\n return `a prototype starts from ON_CLICK or AFTER_TIMEOUT, not ${type}`\n }\n }\n const actions = reaction.actions\n if (!Array.isArray(actions)) continue\n for (const action of actions) {\n if (action && typeof action === 'object' && 'type' in action) {\n const type = action.type\n if (typeof type === 'string' && type in UNSUPPORTED_ACTIONS) {\n return `an action is NODE, BACK or CLOSE, not ${type}`\n }\n }\n }\n }\n return null\n}\n"],"mappings":";;;;;;;;AAmBA,MAAM,uBAA6C;CACjD,SAAS;CACT,UAAU;CACV,UAAU;CACV,aAAa;CACb,aAAa;CACb,UAAU;CACV,YAAY;CACZ,aAAa;AACf;;AAGA,MAAM,sBAA4C;CAChD,KAAK;CACL,cAAc;CACd,aAAa;CACb,mBAAmB;AACrB;AAIA,MAAM,gBAAgB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,SAAS,CAAC,CAAC;AAEtD,MAAM,wBAAwB,EAAE,SAAS;CACvC;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAA0C;AAE1C,MAAM,mBAAmB,EAAE,aAAa;CACtC,MAAM,EAAE,SAAS,CAAC,WAAW,UAAU,CAAqC;CAC5E,UAAU;AACZ,CAAC;AAED,MAAM,mBAAmB,EAAE,aAAa;CACtC,MAAM,EAAE,QAAQ,MAAM;CACtB,eAAe,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,YAAY,8BAA8B,CAAC;CAC/F,YAAY,EAAE,SAAS,CAAC,YAAY,SAAS,CAAqC;CAClF,YAAY,EAAE,SAAS,kBAAkB;EAAE,MAAM;EAAW,UAAU;CAAE,CAAC;CACzE,yBAAyB,EAAE,SAAS,uBAAuB,QAAQ;AACrE,CAAC;AAED,MAAM,eAAe,EAAE,QAAQ,QAAQ;CACrC;CACA,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,MAAM,EAAE,CAAC;CAC1C,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,OAAO,EAAE,CAAC;AAC7C,CAAC;AAED,MAAM,gBAAgB,EAAE,QAAQ,QAAQ,CACtC,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,U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O,WAAW,YAAY,UAAU,QAAQ;GAC5D,MAAM,OAAO,OAAO;GACpB,IAAI,OAAO,SAAS,YAAY,QAAQ,qBACtC,OAAO,yCAAyC;EAEpD;CAEJ;CACA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"reactions.js","names":[],"sources":["../../src/figma-api/reactions.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport { generateId } from '@pairdraw/scene-graph'\nimport type {\n PrototypeAction,\n PrototypeNavigationType,\n PrototypeOverlayPositionType,\n PrototypeReaction,\n PrototypeTransition,\n PrototypeTransitionType,\n PrototypeTriggerType,\n SceneGraph,\n SceneNode\n} from '@pairdraw/scene-graph'\nimport { variantSetsAround } from '@pairdraw/scene-graph/components'\nimport { PROTOTYPE_EASINGS } from '@pairdraw/scene-graph/constants'\nimport { parseVariantName } from '@pairdraw/scene-graph/variant-name'\n\nimport { issuePath } from '#core/figma-api/effects'\nimport { asInstanceEdit, sameReaction } from '#core/prototype/reactions'\n\n/**\n * Triggers Figma's plugin API offers that a prototype in Pairdraw cannot start from, and the\n * message it gets instead.\n */\nconst UNSUPPORTED_TRIGGERS: Record<string, true> = {\n ON_DRAG: true,\n MOUSE_UP: true,\n MOUSE_DOWN: true,\n ON_KEY_DOWN: true\n}\n\n/** Actions Figma's plugin API offers that a prototype in Pairdraw cannot run. */\nconst UNSUPPORTED_ACTIONS: Record<string, true> = {\n URL: true,\n SET_VARIABLE: true,\n CONDITIONAL: true,\n SET_VARIABLE_MODE: true\n}\n\n// No `v.finite()` action: the MCP tool contract turns this schema into JSON Schema, which\n// has no notion of infinities, and JSON numbers are always finite anyway.\nconst secondsSchema = v.pipe(v.number(), v.minValue(0))\n\nconst overlayPositionSchema = v.picklist([\n 'CENTER',\n 'TOP_LEFT',\n 'TOP_CENTER',\n 'TOP_RIGHT',\n 'BOTTOM_LEFT',\n 'BOTTOM_CENTER',\n 'BOTTOM_RIGHT'\n] satisfies PrototypeOverlayPositionType[])\n\n/** Figma's easing presets, which play has; a spring or a custom curve is refused. */\nconst easingSchema = v.strictObject({ type: v.picklist(PROTOTYPE_EASINGS) })\n\nconst transitionSchema = v.strictObject({\n type: v.picklist(['INSTANT', 'DISSOLVE', 'SMART_ANIMATE'] satisfies PrototypeTransitionType[]),\n duration: secondsSchema,\n easing: v.optional(easingSchema)\n})\n\n/** A variant's values for its set's properties, as `{ State: 'Hover', Size: 'Large' }`. */\nconst variantPropertiesSchema = v.pipe(\n v.record(v.string(), v.string()),\n v.minEntries(1),\n v.description(\n \"CHANGE_TO: the values of the variant to change to, in the layer's nearest component set, \" +\n 'such as { State: \"Hover\" }. Name every property of a set whose variants share values, as ' +\n 'a partial match is refused. Resolved to the variant, so get_reactions reads it back as ' +\n 'a destinationId.'\n )\n)\n\nconst nodeActionSchema = v.strictObject({\n type: v.literal('NODE'),\n destinationId: v.optional(\n v.pipe(\n v.string(),\n v.minLength(1),\n v.description(\n 'NAVIGATE/OVERLAY: a top-level frame on the page; CHANGE_TO: a variant of the set the ' +\n \"layer is a variant of, an instance of, or inside; SCROLL_TO: a layer in the layer's \" +\n 'top-level frame. Omit only for CHANGE_TO, and name the variant with variantProperties.'\n )\n )\n ),\n variantProperties: v.optional(variantPropertiesSchema),\n navigation: v.picklist([\n 'NAVIGATE',\n 'OVERLAY',\n 'CHANGE_TO',\n 'SCROLL_TO'\n ] satisfies PrototypeNavigationType[]),\n transition: v.optional(transitionSchema, { type: 'INSTANT', duration: 0 }),\n overlayRelativePosition: v.optional(overlayPositionSchema, 'CENTER')\n})\n\nconst actionSchema = v.variant('type', [\n nodeActionSchema,\n v.strictObject({ type: v.literal('BACK') }),\n v.strictObject({ type: v.literal('CLOSE') })\n])\n\nconst triggerSchema = v.variant('type', [\n v.strictObject({ type: v.picklist(['ON_CLICK', 'ON_HOVER', 'ON_PRESS']) }),\n v.strictObject({ type: v.literal('AFTER_TIMEOUT'), timeout: secondsSchema }),\n v.strictObject({\n type: v.picklist(['MOUSE_ENTER', 'MOUSE_LEAVE']),\n delay: v.optional(secondsSchema, 0),\n // Figma's plugin API reads it; play treats both versions alike.\n deprecatedVersion: v.optional(v.boolean())\n })\n])\n\nconst reactionSchema = v.strictObject({\n trigger: triggerSchema,\n actions: v.pipe(v.array(actionSchema), v.minLength(1))\n})\n\nconst reactionsSchema = v.array(reactionSchema)\n\n/** The plugin shape as a contract, for a tool that takes connections as arguments. */\nexport const figmaReactionsSchema = reactionsSchema\n\n/** A reaction as Figma's plugin API reads and writes it (`Reaction` in `@figma/plugin-typings`). */\nexport type FigmaReaction = v.InferOutput<typeof reactionSchema>\nexport type FigmaReactionTrigger = FigmaReaction['trigger']\nexport type FigmaReactionAction = FigmaReaction['actions'][number]\n\n/** `reaction` in the plugin shape: the trigger and every action, named as Figma names them. */\nexport function toFigmaReaction(reaction: PrototypeReaction): FigmaReaction {\n return { trigger: toFigmaTrigger(reaction.trigger), actions: reaction.actions.map(toFigmaAction) }\n}\n\nfunction toFigmaTrigger({ type, delay }: PrototypeReaction['trigger']): FigmaReactionTrigger {\n if (type === 'AFTER_TIMEOUT') return { type, timeout: delay }\n if (type === 'MOUSE_ENTER' || type === 'MOUSE_LEAVE') return { type, delay }\n return { type }\n}\n\nfunction toFigmaAction(action: PrototypeAction): FigmaReactionAction {\n if (action.type !== 'NODE') return { type: action.type }\n return {\n type: 'NODE',\n destinationId: action.nodeId ?? '',\n navigation: action.navigation,\n transition: toFigmaTransition(action.transition),\n overlayRelativePosition: action.overlayPosition\n }\n}\n\nfunction toFigmaTransition({\n type,\n duration,\n easing\n}: PrototypeTransition): v.InferOutput<typeof transitionSchema> {\n return easing ? { type, duration, easing: { type: easing } } : { type, duration }\n}\n\nfunction fromFigmaTransition({\n type,\n duration,\n easing\n}: v.InferOutput<typeof transitionSchema>): PrototypeTransition {\n return easing ? { type, duration, easing: easing.type } : { type, duration }\n}\n\n/** The validation context: where the reactions live, and what they may point at. */\nexport interface ReactionContext {\n graph: SceneGraph\n /** The layer the reactions are on, which a Change to or Scroll to destination must suit. */\n nodeId: string\n /** The page the layer is on; a navigation's destination must be a top-level frame on it. */\n pageId: string\n /** The reactions the layer has now, whose ids this keeps by position. */\n previous?: readonly PrototypeReaction[]\n /**\n * An instance's main component's reactions: a reaction kept under one of their ids that an\n * edit changed, from what the layer held at its place and from the main's, becomes the\n * instance's own, with an id of its own.\n */\n inherited?: readonly PrototypeReaction[]\n}\n\n/**\n * `value` as the layer's prototype reactions, or an error naming what Pairdraw cannot play.\n * Accepts Figma's plugin shape only: a trigger Figma offers but playback does not start from,\n * an action, transition, navigation or overlay spot outside the model, and a destination that\n * is not a top-level frame on the layer's page are refused rather than kept unplayable.\n */\nexport function parseFigmaReactions(value: unknown, context: ReactionContext): PrototypeReaction[] {\n const unsupported = unsupportedKind(value)\n if (unsupported) throw new Error(`Property \"reactions\" failed validation: ${unsupported}`)\n const result = v.safeParse(reactionsSchema, value)\n if (!result.success) {\n const [issue] = result.issues\n throw new Error(\n `Property \"reactions\" failed validation: ${issue.message} at ${issuePath(issue.path) || 'reactions'}`\n )\n }\n return result.output.map((reaction, index) => {\n const id = context.previous?.[index]?.id ?? generateId()\n const parsed: PrototypeReaction = {\n id,\n trigger: toTrigger(reaction.trigger),\n actions: reaction.actions.map((action) => toAction(action, context, index))\n }\n // One the layer already held unchanged stays as it was, a copy of the main's included, so\n // writing reactions back as read never re-ids a copy whose main was edited since.\n const held = context.previous?.[index]\n if (held && sameReaction(held, parsed)) return parsed\n return asInstanceEdit(parsed, context.inherited ?? [])\n })\n}\n\nfunction toTrigger(trigger: FigmaReactionTrigger): PrototypeReaction['trigger'] {\n const type: PrototypeTriggerType = trigger.type\n if (trigger.type === 'AFTER_TIMEOUT') return { type, delay: trigger.timeout }\n return { type, delay: 'delay' in trigger ? trigger.delay : 0 }\n}\n\nfunction toAction(\n action: FigmaReactionAction,\n context: ReactionContext,\n reactionIndex: number\n): PrototypeAction {\n if (action.type !== 'NODE') return { type: action.type }\n const destinationId = resolveDestinationId(action, context, reactionIndex)\n assertDestination({ ...action, destinationId }, context, reactionIndex)\n return {\n type: 'NODE',\n nodeId: destinationId,\n navigation: action.navigation,\n transition: fromFigmaTransition(action.transition),\n // Only an overlay uses the spot; Figma keeps CENTER on a navigation.\n overlayPosition: action.navigation === 'OVERLAY' ? action.overlayRelativePosition : 'CENTER'\n }\n}\n\n/**\n * The layer a NODE action points at: its `destinationId`, or for a Change to, the variant of the\n * layer's set whose `variantProperties` it names.\n */\nfunction resolveDestinationId(\n action: v.InferOutput<typeof nodeActionSchema>,\n context: ReactionContext,\n index: number\n): string {\n const at = `reactions[${index}]`\n const { destinationId, variantProperties, navigation } = action\n if (destinationId && variantProperties) {\n throw failure(`${at} names both destinationId and variantProperties; give one`)\n }\n if (variantProperties) {\n if (navigation !== 'CHANGE_TO') {\n throw failure(`${at}: variantProperties is for CHANGE_TO only, not ${navigation}`)\n }\n return variantByProperties(variantProperties, context, at)\n }\n if (!destinationId) {\n throw failure(\n navigation === 'CHANGE_TO'\n ? `${at} must name the variant it Changes to, in destinationId or variantProperties`\n : `${at} must name the layer it goes to, in destinationId`\n )\n }\n return destinationId\n}\n\n/** The id of the variant of the sets around the layer whose properties are `properties`. */\nfunction variantByProperties(\n properties: Record<string, string>,\n context: ReactionContext,\n at: string\n): string {\n const sets = variantSetsAround(context.graph, context.nodeId)\n const nearest = sets.at(0)\n if (!nearest) {\n throw failure(\n `${at}: only a variant, an instance of one, or a layer inside one can Change to another variant`\n )\n }\n const wanted = Object.entries(properties)\n .map(([name, value]) => `${name}=${value}`)\n .join(', ')\n for (const set of sets) {\n const matches = context.graph.getChildren(set.id).filter((child) => {\n if (child.type !== 'COMPONENT') return false\n const values = { ...parseVariantName(child.name), ...child.componentPropertyValues }\n return Object.entries(properties).every(([name, value]) => values[name] === value)\n })\n if (matches.length === 1) return matches[0].id\n // A set can hold variants a partial map matches equally: refuse rather than pick one.\n if (matches.length > 1) {\n const names = matches.map((match) => `\"${match.name}\"`).join(', ')\n throw failure(\n `${at}: ${wanted} matches ${matches.length} variants of ${set.name} (${names}); name every property of the variant`\n )\n }\n }\n throw failure(`${at}: no variant of ${nearest.name} with ${wanted}`)\n}\n\nfunction failure(message: string): Error {\n return new Error(`Property \"reactions\" failed validation: ${message}`)\n}\n\n/**\n * A destination play can show: a navigation's is a frame at the top of the layer's page, a Change\n * to's a variant of a set the layer belongs to, and a Scroll to's a layer in the layer's\n * top-level frame.\n */\nfunction assertDestination(\n action: Pick<v.InferOutput<typeof nodeActionSchema>, 'navigation'> & { destinationId: string },\n context: ReactionContext,\n index: number\n): void {\n const { destinationId, navigation } = action\n const destination = context.graph.getNode(destinationId)\n const at = `reactions[${index}]`\n if (!destination) throw failure(`no layer ${destinationId} at ${at}.actions[0].destinationId`)\n if (navigation === 'CHANGE_TO') return assertVariant(destination, context, at)\n if (navigation === 'SCROLL_TO') return assertScrollTarget(destination, context, at)\n if (destination.type !== 'FRAME' || destination.parentId !== context.pageId) {\n throw failure(\n `${at} must navigate to a top-level frame on the same page, not ${destination.type} \"${destination.name}\"`\n )\n }\n}\n\nfunction assertVariant(destination: SceneNode, context: ReactionContext, at: string): void {\n const sets = variantSetsAround(context.graph, context.nodeId)\n const nearest = sets.at(0)\n if (!nearest) {\n throw failure(\n `${at}: only a variant, an instance of one, or a layer inside one can Change to another variant`\n )\n }\n const inSet = sets.some((set) => set.id === destination.parentId)\n if (destination.type !== 'COMPONENT' || !inSet) {\n throw failure(\n `${at} must Change to a variant of ${nearest.name}, not ${destination.type} \"${destination.name}\"`\n )\n }\n}\n\n/** The page's direct child a layer sits in, which play shows as one screen. */\nfunction topLevelOf(graph: SceneGraph, nodeId: string, pageId: string): SceneNode | undefined {\n return graph.closest(nodeId, (node) => node.parentId === pageId)\n}\n\nfunction assertScrollTarget(destination: SceneNode, context: ReactionContext, at: string): void {\n const { graph, nodeId, pageId } = context\n const top = topLevelOf(graph, nodeId, pageId)\n if (!top || destination.id === top.id || !graph.isDescendant(destination.id, top.id)) {\n throw failure(\n `${at} must Scroll to a layer inside the same top-level frame, not ${destination.type} \"${destination.name}\"`\n )\n }\n}\n\n/** Figma's first unsupported trigger or action kind in `value`, if it has one. */\nfunction unsupportedKind(value: unknown): string | null {\n if (!Array.isArray(value)) return null\n const reactions = value.filter(\n (reaction): reaction is Record<string, unknown> =>\n Boolean(reaction) && typeof reaction === 'object'\n )\n for (const reaction of reactions) {\n const trigger = reaction.trigger\n if (trigger && typeof trigger === 'object' && 'type' in trigger) {\n const type = trigger.type\n if (typeof type === 'string' && type in UNSUPPORTED_TRIGGERS) {\n return `a prototype starts from ON_CLICK, ON_HOVER, ON_PRESS, MOUSE_ENTER, MOUSE_LEAVE or AFTER_TIMEOUT, not ${type}`\n }\n }\n const actions = reaction.actions\n if (!Array.isArray(actions)) continue\n for (const action of actions) {\n if (action && typeof action === 'object' && 'type' in action) {\n const type = action.type\n if (typeof type === 'string' && type in UNSUPPORTED_ACTIONS) {\n return `an action is NODE, BACK or CLOSE, not ${type}`\n }\n }\n }\n }\n return null\n}\n"],"mappings":";;;;;;;;;;;;AAyBA,MAAM,uBAA6C;CACjD,SAAS;CACT,UAAU;CACV,YAAY;CACZ,aAAa;AACf;;AAGA,MAAM,sBAA4C;CAChD,KAAK;CACL,cAAc;CACd,aAAa;CACb,mBAAmB;AACrB;AAIA,MAAM,gBAAgB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,SAAS,CAAC,CAAC;AAEtD,MAAM,wBAAwB,EAAE,SAAS;CACvC;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAA0C;;AAG1C,MAAM,eAAe,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,iBAAiB,EAAE,CAAC;AAE3E,MAAM,mBAAmB,EAAE,aAAa;CACtC,MAAM,EAAE,SAAS;EAAC;EAAW;EAAY;CAAe,CAAqC;CAC7F,UAAU;CACV,QAAQ,EAAE,SAAS,YAAY;AACjC,CAAC;;AAGD,MAAM,0BAA0B,EAAE,KAChC,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,G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AQ;GACrB,IAAI,OAAO,SAAS,YAAY,QAAQ,sBACtC,OAAO,wGAAwG;EAEnH;EACA,MAAM,UAAU,SAAS;EACzB,IAAI,CAAC,MAAM,QAAQ,OAAO,GAAG;EAC7B,KAAK,MAAM,UAAU,SACnB,IAAI,UAAU,OAAO,WAAW,YAAY,UAAU,QAAQ;GAC5D,MAAM,OAAO,OAAO;GACpB,IAAI,OAAO,SAAS,YAAY,QAAQ,qBACtC,OAAO,yCAAyC;EAEpD;CAEJ;CACA,OAAO;AACT"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getWorldMatrix } from "@pairdraw/scene-graph/coordinate";
|
|
2
2
|
import { geometryBlobBounds, intersectVisualBounds, strokeOverflow, unionVisualBounds } from "@pairdraw/scene-graph/geometry";
|
|
3
|
-
import { textLinesReach } from "@pairdraw/scene-graph/text";
|
|
4
3
|
import Matrix from "@pairdraw/scene-graph/matrix";
|
|
4
|
+
import { textLinesReach } from "@pairdraw/scene-graph/text";
|
|
5
5
|
//#region src/figma-api/render-bounds.ts
|
|
6
6
|
const INTRINSIC_CONTAINER_TYPES = /* @__PURE__ */ new Set([
|
|
7
7
|
"FRAME",
|
|
@@ -5,14 +5,17 @@
|
|
|
5
5
|
* A feature Figma has no API for goes on `pairdraw`, never on these lists; entries only leave.
|
|
6
6
|
*/
|
|
7
7
|
/** Members a host or tool wires up on `figma`, which scripts do not write against. */
|
|
8
|
-
declare const FIGMA_API_HOST_MEMBERS: readonly ["graph", "wrapNode", "currentPageId", "groupFitOptions", "setRenderer", "theme", "exportImage", "icons", "rasterCodec", "changeBaseline"];
|
|
8
|
+
declare const FIGMA_API_HOST_MEMBERS: readonly ["graph", "wrapNode", "currentPageId", "groupFitOptions", "setRenderer", "theme", "exportImage", "exportGraphImage", "icons", "rasterCodec", "changeBaseline"];
|
|
9
9
|
/**
|
|
10
10
|
* Members named as in Figma whose types do not match Figma's yet, mostly because node proxies do
|
|
11
11
|
* not implement every Figma node type; remove one when it matches.
|
|
12
12
|
*/
|
|
13
13
|
declare const FIGMA_API_INCOMPLETE_MEMBERS: readonly ["createComponentFromNode", "createPage", "currentPage", "getNodeById", "getNodeByIdAsync", "mixed", "root", "ui", "variables", "viewport"];
|
|
14
|
-
/**
|
|
15
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Members hosts read or write beyond Figma's Plugin API: the `JSON.stringify` hook, and node
|
|
16
|
+
* fields stored in `.fig` that the installed typings do not name.
|
|
17
|
+
*/
|
|
18
|
+
declare const SERIALIZATION_MEMBERS: readonly ["toJSON", "scrollBehavior"];
|
|
16
19
|
//#endregion
|
|
17
20
|
export { FIGMA_API_HOST_MEMBERS, FIGMA_API_INCOMPLETE_MEMBERS, SERIALIZATION_MEMBERS };
|
|
18
21
|
//# sourceMappingURL=surface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface.d.ts","names":[],"sources":["../../src/figma-api/surface.ts"],"mappings":";;;;;;;cAOa;;;;;cAiBA
|
|
1
|
+
{"version":3,"file":"surface.d.ts","names":[],"sources":["../../src/figma-api/surface.ts"],"mappings":";;;;;;;cAOa;;;;;cAkBA;;;;;cAiBA"}
|
|
@@ -13,6 +13,7 @@ const FIGMA_API_HOST_MEMBERS = [
|
|
|
13
13
|
"setRenderer",
|
|
14
14
|
"theme",
|
|
15
15
|
"exportImage",
|
|
16
|
+
"exportGraphImage",
|
|
16
17
|
"icons",
|
|
17
18
|
"rasterCodec",
|
|
18
19
|
"changeBaseline"
|
|
@@ -33,8 +34,11 @@ const FIGMA_API_INCOMPLETE_MEMBERS = [
|
|
|
33
34
|
"variables",
|
|
34
35
|
"viewport"
|
|
35
36
|
];
|
|
36
|
-
/**
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Members hosts read or write beyond Figma's Plugin API: the `JSON.stringify` hook, and node
|
|
39
|
+
* fields stored in `.fig` that the installed typings do not name.
|
|
40
|
+
*/
|
|
41
|
+
const SERIALIZATION_MEMBERS = ["toJSON", "scrollBehavior"];
|
|
38
42
|
//#endregion
|
|
39
43
|
export { FIGMA_API_HOST_MEMBERS, FIGMA_API_INCOMPLETE_MEMBERS, SERIALIZATION_MEMBERS };
|
|
40
44
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface.js","names":[],"sources":["../../src/figma-api/surface.ts"],"sourcesContent":["/**\n * What `figma` and its objects have beyond Figma's Plugin API. `compatibility.ts` checks the\n * types against these lists and `tests/figma-api/surface.test.ts` checks what scripts can reach.\n * A feature Figma has no API for goes on `pairdraw`, never on these lists; entries only leave.\n */\n\n/** Members a host or tool wires up on `figma`, which scripts do not write against. */\nexport const FIGMA_API_HOST_MEMBERS = [\n 'graph',\n 'wrapNode',\n 'currentPageId',\n 'groupFitOptions',\n 'setRenderer',\n 'theme',\n 'exportImage',\n 'icons',\n 'rasterCodec',\n 'changeBaseline'\n] as const\n\n/**\n * Members named as in Figma whose types do not match Figma's yet, mostly because node proxies do\n * not implement every Figma node type; remove one when it matches.\n */\nexport const FIGMA_API_INCOMPLETE_MEMBERS = [\n 'createComponentFromNode',\n 'createPage',\n 'currentPage',\n 'getNodeById',\n 'getNodeByIdAsync',\n 'mixed',\n 'root',\n 'ui',\n 'variables',\n 'viewport'\n] as const\n\n
|
|
1
|
+
{"version":3,"file":"surface.js","names":[],"sources":["../../src/figma-api/surface.ts"],"sourcesContent":["/**\n * What `figma` and its objects have beyond Figma's Plugin API. `compatibility.ts` checks the\n * types against these lists and `tests/figma-api/surface.test.ts` checks what scripts can reach.\n * A feature Figma has no API for goes on `pairdraw`, never on these lists; entries only leave.\n */\n\n/** Members a host or tool wires up on `figma`, which scripts do not write against. */\nexport const FIGMA_API_HOST_MEMBERS = [\n 'graph',\n 'wrapNode',\n 'currentPageId',\n 'groupFitOptions',\n 'setRenderer',\n 'theme',\n 'exportImage',\n 'exportGraphImage',\n 'icons',\n 'rasterCodec',\n 'changeBaseline'\n] as const\n\n/**\n * Members named as in Figma whose types do not match Figma's yet, mostly because node proxies do\n * not implement every Figma node type; remove one when it matches.\n */\nexport const FIGMA_API_INCOMPLETE_MEMBERS = [\n 'createComponentFromNode',\n 'createPage',\n 'currentPage',\n 'getNodeById',\n 'getNodeByIdAsync',\n 'mixed',\n 'root',\n 'ui',\n 'variables',\n 'viewport'\n] as const\n\n/**\n * Members hosts read or write beyond Figma's Plugin API: the `JSON.stringify` hook, and node\n * fields stored in `.fig` that the installed typings do not name.\n */\nexport const SERIALIZATION_MEMBERS = ['toJSON', 'scrollBehavior'] as const\n"],"mappings":";;;;;;;AAOA,MAAa,yBAAyB;CACpC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;AAMA,MAAa,+BAA+B;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;AAMA,MAAa,wBAAwB,CAAC,UAAU,gBAAgB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SceneGraph, SceneNode } from "@pairdraw/scene-graph";
|
|
2
1
|
import { Mat3 } from "@pairdraw/scene-graph/matrix";
|
|
2
|
+
import { SceneGraph, SceneNode } from "@pairdraw/scene-graph";
|
|
3
3
|
//#region src/figma-api/transform.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* A node's transform into its container's space, which Figma's plugin API reports as
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/figma-api/variables/index.ts"],"mappings":";;;;;;cAgBM;KACM,oCAAoC;;KAiB3C;WACM;WACA;IAAmB,QAAQ;;;;cAIzB;;EAGC,YAAA,OAAO;EAInB,gBAAgB,aAAa;EAIvB,qBAAqB,aAAa,QAAQ;EAIhD,0BAA0B,aAAa;EAMjC,+BAA+B,aAAa,QAAQ;EAI1D,kBAAkB,OAAO,4BAA4B;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/figma-api/variables/index.ts"],"mappings":";;;;;;cAgBM;KACM,oCAAoC;;KAiB3C;WACM;WACA;IAAmB,QAAQ;;;;cAIzB;;EAGC,YAAA,OAAO;EAInB,gBAAgB,aAAa;EAIvB,qBAAqB,aAAa,QAAQ;EAIhD,0BAA0B,aAAa;EAMjC,+BAA+B,aAAa,QAAQ;EAI1D,kBAAkB,OAAO,4BAA4B;EAQ/C,uBAAuB,OAAO,4BAA4B,QAAQ;EAIxE,+BAA+B;EAMzB,oCAAoC,QAAQ;;EAKlD,eACE,cACA;aAAuB;cACvB,cAAc,4BACb;EAkBH,yBAAyB,eAAe;EAIxC,oBAAoB;aAAqB;MAAe;EAIlD,6BAA6B,qBAAqB,QAAQ;;;;;EAWhE,yBAAyB,UAAU,iBACjC,OAAO,GACP,iBACA;aAAqB;aACpB;IAAM;MAAkB,QAAQ"}
|
|
@@ -38,13 +38,13 @@ var FigmaVariablesAPI = class {
|
|
|
38
38
|
}
|
|
39
39
|
getLocalVariables(type) {
|
|
40
40
|
const wanted = type === void 0 ? void 0 : assertType("getLocalVariables", type);
|
|
41
|
-
return
|
|
41
|
+
return this.#graph.getLiveVariables().filter((variable) => wanted === void 0 || variable.type === wanted).map((variable) => new FigmaVariable(this.#graph, variable.id));
|
|
42
42
|
}
|
|
43
43
|
async getLocalVariablesAsync(type) {
|
|
44
44
|
return this.getLocalVariables(type);
|
|
45
45
|
}
|
|
46
46
|
getLocalVariableCollections() {
|
|
47
|
-
return
|
|
47
|
+
return this.#graph.getLiveCollections().map((collection) => new FigmaVariableCollection(this.#graph, collection.id));
|
|
48
48
|
}
|
|
49
49
|
async getLocalVariableCollectionsAsync() {
|
|
50
50
|
return this.getLocalVariableCollections();
|