@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
package/src/figma-api/paints.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
import { mapValues, pickBy } from 'es-toolkit/object'
|
|
2
|
+
import { isEmptyObject } from 'es-toolkit/predicate'
|
|
1
3
|
import * as v from 'valibot'
|
|
2
4
|
|
|
3
|
-
import type {
|
|
5
|
+
import type {
|
|
6
|
+
BlendMode,
|
|
7
|
+
Fill,
|
|
8
|
+
GradientTransform,
|
|
9
|
+
ImageFilters as SceneImageFilters,
|
|
10
|
+
ImageScaleMode
|
|
11
|
+
} from '@pairdraw/scene-graph'
|
|
4
12
|
import { BLACK } from '@pairdraw/scene-graph/constants'
|
|
5
13
|
import { gradientTransformRows, IDENTITY_GRADIENT_TRANSFORM } from '@pairdraw/scene-graph/gradient'
|
|
6
14
|
import type { Color, Vector } from '@pairdraw/scene-graph/primitives'
|
|
@@ -34,13 +42,10 @@ const GRADIENT_TYPES = [
|
|
|
34
42
|
|
|
35
43
|
const SCALE_MODES = ['FILL', 'FIT', 'CROP', 'TILE'] as const satisfies readonly ImageScaleMode[]
|
|
36
44
|
|
|
37
|
-
type ImageFilters =
|
|
38
|
-
'exposure' | 'contrast' | 'saturation' | 'temperature' | 'tint' | 'highlights' | 'shadows',
|
|
39
|
-
number
|
|
40
|
-
>
|
|
45
|
+
type ImageFilters = Required<SceneImageFilters>
|
|
41
46
|
|
|
42
|
-
/**
|
|
43
|
-
const
|
|
47
|
+
/** Figma reads every slider a paint or a script leaves out at 0. */
|
|
48
|
+
const UNADJUSTED_FILTERS: ImageFilters = {
|
|
44
49
|
exposure: 0,
|
|
45
50
|
contrast: 0,
|
|
46
51
|
saturation: 0,
|
|
@@ -300,6 +305,15 @@ function sceneTransform(
|
|
|
300
305
|
return { m00, m01, m02, m10, m11, m12 }
|
|
301
306
|
}
|
|
302
307
|
|
|
308
|
+
function sceneFilters(filters: Partial<ImageFilters> | undefined): Pick<Fill, 'filters'> {
|
|
309
|
+
const moved = pickBy(filters ?? {}, Boolean)
|
|
310
|
+
return isEmptyObject(moved) ? {} : { filters: moved }
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
function figmaFilters(filters: SceneImageFilters | undefined): ImageFilters {
|
|
314
|
+
return mapValues(UNADJUSTED_FILTERS, (unadjusted, slider) => filters?.[slider] ?? unadjusted)
|
|
315
|
+
}
|
|
316
|
+
|
|
303
317
|
function sceneFill(paint: ParsedPaint, site: PaintSite): Fill {
|
|
304
318
|
const base = {
|
|
305
319
|
visible: paint.visible ?? true,
|
|
@@ -325,7 +339,8 @@ function sceneFill(paint: ParsedPaint, site: PaintSite): Fill {
|
|
|
325
339
|
...(hash !== null && { imageHash: hash }),
|
|
326
340
|
...(imageTransform && { imageTransform }),
|
|
327
341
|
...(paint.rotation !== undefined && { imageRotation: paint.rotation }),
|
|
328
|
-
...(paint.scalingFactor !== undefined && { scale: paint.scalingFactor })
|
|
342
|
+
...(paint.scalingFactor !== undefined && { scale: paint.scalingFactor }),
|
|
343
|
+
...sceneFilters(paint.filters)
|
|
329
344
|
}
|
|
330
345
|
}
|
|
331
346
|
return {
|
|
@@ -377,7 +392,7 @@ function figmaMediaPaint(paint: Fill, type: 'IMAGE' | 'VIDEO', base: ReadBase):
|
|
|
377
392
|
scaleMode,
|
|
378
393
|
scalingFactor: scaleMode === 'TILE' ? (paint.scale ?? 1) : 1,
|
|
379
394
|
...(!crop && { rotation: paint.imageRotation ?? 0 }),
|
|
380
|
-
filters:
|
|
395
|
+
filters: figmaFilters(paint.filters)
|
|
381
396
|
}
|
|
382
397
|
const transform = rows(crop ? paint.imageTransform : undefined)
|
|
383
398
|
const hash = paint.imageHash ?? null
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
|
|
8
8
|
import { createLayoutRunner } from '#core/layout/mutations'
|
|
9
9
|
|
|
10
|
+
import { underlyingGraph } from './graph-ref'
|
|
10
11
|
import { flushPendingComponentSync } from './pending-sync'
|
|
11
12
|
|
|
12
13
|
interface PendingLayout {
|
|
@@ -32,7 +33,8 @@ function mergeImpact(into: SceneMutationImpact, from: SceneMutationImpact): void
|
|
|
32
33
|
* one recorder for its lifetime, kept across APIs: a script that failed before its tool laid
|
|
33
34
|
* out its edits leaves them for the next read to lay out.
|
|
34
35
|
*/
|
|
35
|
-
export function startPendingLayout(
|
|
36
|
+
export function startPendingLayout(source: SceneGraph): void {
|
|
37
|
+
const graph = underlyingGraph(source)
|
|
36
38
|
if (pendingByGraph.has(graph)) return
|
|
37
39
|
const pending: PendingLayout = { impact: createSceneMutationImpact(), flushing: false }
|
|
38
40
|
pendingByGraph.set(graph, pending)
|
|
@@ -41,7 +43,8 @@ export function startPendingLayout(graph: SceneGraph): void {
|
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
/** Lays out the edits recorded since the last geometry read. */
|
|
44
|
-
export function flushPendingLayout(
|
|
46
|
+
export function flushPendingLayout(source: SceneGraph): void {
|
|
47
|
+
const graph = underlyingGraph(source)
|
|
45
48
|
// Instances lay out what their components hold now.
|
|
46
49
|
flushPendingComponentSync(graph)
|
|
47
50
|
const pending = pendingByGraph.get(graph)
|
|
@@ -94,10 +97,11 @@ function editsReach(graph: SceneGraph, impact: SceneMutationImpact, node: SceneN
|
|
|
94
97
|
* that builds many layers lays out once rather than once per layer.
|
|
95
98
|
*/
|
|
96
99
|
export function flushPendingLayoutBefore(
|
|
97
|
-
|
|
100
|
+
source: SceneGraph,
|
|
98
101
|
node: SceneNode,
|
|
99
102
|
{ placesChildren = false }: { placesChildren?: boolean } = {}
|
|
100
103
|
): void {
|
|
104
|
+
const graph = underlyingGraph(source)
|
|
101
105
|
const pending = pendingByGraph.get(graph)
|
|
102
106
|
if (!pending || pending.flushing || pending.impact.changedNodeIds.size === 0) return
|
|
103
107
|
const depends =
|
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
|
|
7
7
|
import { syncComponentsHolding } from '#core/editor/component-sync'
|
|
8
8
|
|
|
9
|
+
import { underlyingGraph } from './graph-ref'
|
|
10
|
+
|
|
9
11
|
const syncByGraph = new WeakMap<SceneGraph, () => void>()
|
|
10
12
|
|
|
11
13
|
/**
|
|
@@ -53,7 +55,8 @@ export function startPendingComponentSync(graph: SceneGraph, flush?: () => void)
|
|
|
53
55
|
* read or written, only when it is in an instance, as only those layers change. Edits inside a
|
|
54
56
|
* component then sync once, when an instance is next read, not once per edit.
|
|
55
57
|
*/
|
|
56
|
-
export function flushPendingComponentSync(
|
|
58
|
+
export function flushPendingComponentSync(source: SceneGraph, layerId?: string): void {
|
|
59
|
+
const graph = underlyingGraph(source)
|
|
57
60
|
const flush = syncByGraph.get(graph)
|
|
58
61
|
if (!flush) return
|
|
59
62
|
if (layerId !== undefined && !graph.closest(layerId, (node) => node.type === 'INSTANCE')) return
|
package/src/figma-api/proxy.ts
CHANGED
|
@@ -5,7 +5,9 @@ import type {
|
|
|
5
5
|
SceneNode,
|
|
6
6
|
NodeType,
|
|
7
7
|
LayoutGrid,
|
|
8
|
-
LayoutMode
|
|
8
|
+
LayoutMode,
|
|
9
|
+
OverflowDirection,
|
|
10
|
+
ScrollBehavior
|
|
9
11
|
} from '@pairdraw/scene-graph'
|
|
10
12
|
import { attachedConnectors } from '@pairdraw/scene-graph/connectors'
|
|
11
13
|
import type { GroupFitOptions } from '@pairdraw/scene-graph/group-bounds'
|
|
@@ -40,6 +42,7 @@ import { installVisualNodeProxyAccessors } from './accessors/visual'
|
|
|
40
42
|
import { installComponentPropertyAccessors } from './components'
|
|
41
43
|
import { installDevStatusAccessors, type FigmaDevStatusValue } from './dev-status'
|
|
42
44
|
import type { FigmaFontName } from './fonts/names'
|
|
45
|
+
import { underlyingGraph } from './graph-ref'
|
|
43
46
|
import type { FigmaFrameNode, FigmaInstanceNode } from './node-types'
|
|
44
47
|
import { installInstanceOverrideAccessors, type FigmaInstanceOverride } from './overrides'
|
|
45
48
|
import { getPageBackgrounds, setPageBackgrounds } from './page-backgrounds'
|
|
@@ -141,6 +144,8 @@ export class FigmaNodeProxy {
|
|
|
141
144
|
declare devStatus: FigmaDevStatusValue | undefined
|
|
142
145
|
declare blendMode: string
|
|
143
146
|
declare clipsContent: boolean
|
|
147
|
+
declare overflowDirection: OverflowDirection
|
|
148
|
+
declare scrollBehavior: ScrollBehavior
|
|
144
149
|
declare cornerRadius: number | typeof MIXED
|
|
145
150
|
declare topLeftRadius: number
|
|
146
151
|
declare topRightRadius: number
|
|
@@ -236,6 +241,7 @@ export class FigmaNodeProxy {
|
|
|
236
241
|
declare textStyleId: string | symbol
|
|
237
242
|
declare fillStyleId: string | symbol
|
|
238
243
|
declare textDecoration: SceneNode['textDecoration'] | symbol
|
|
244
|
+
declare readonly openTypeFeatures: Record<string, boolean> | symbol
|
|
239
245
|
declare maxLines: number | null
|
|
240
246
|
declare listSpacing: number | symbol
|
|
241
247
|
declare paragraphSpacing: number | symbol
|
|
@@ -296,7 +302,7 @@ export class FigmaNodeProxy {
|
|
|
296
302
|
|
|
297
303
|
constructor(id: string, graph: SceneGraph, api: NodeProxyHost) {
|
|
298
304
|
this[INTERNAL_ID] = id
|
|
299
|
-
this[INTERNAL_GRAPH] = graph
|
|
305
|
+
this[INTERNAL_GRAPH] = underlyingGraph(graph)
|
|
300
306
|
this[INTERNAL_API] = api
|
|
301
307
|
const type = graph.getNode(id)?.type
|
|
302
308
|
const internals = { id: INTERNAL_ID, graph: INTERNAL_GRAPH, api: INTERNAL_API }
|
|
@@ -6,23 +6,25 @@ import type {
|
|
|
6
6
|
PrototypeNavigationType,
|
|
7
7
|
PrototypeOverlayPositionType,
|
|
8
8
|
PrototypeReaction,
|
|
9
|
+
PrototypeTransition,
|
|
9
10
|
PrototypeTransitionType,
|
|
10
11
|
PrototypeTriggerType,
|
|
11
|
-
SceneGraph
|
|
12
|
+
SceneGraph,
|
|
13
|
+
SceneNode
|
|
12
14
|
} from '@pairdraw/scene-graph'
|
|
15
|
+
import { variantSetsAround } from '@pairdraw/scene-graph/components'
|
|
16
|
+
import { PROTOTYPE_EASINGS } from '@pairdraw/scene-graph/constants'
|
|
17
|
+
import { parseVariantName } from '@pairdraw/scene-graph/variant-name'
|
|
13
18
|
|
|
14
19
|
import { issuePath } from '#core/figma-api/effects'
|
|
20
|
+
import { asInstanceEdit, sameReaction } from '#core/prototype/reactions'
|
|
15
21
|
|
|
16
22
|
/**
|
|
17
23
|
* Triggers Figma's plugin API offers that a prototype in Pairdraw cannot start from, and the
|
|
18
|
-
* message it gets instead.
|
|
24
|
+
* message it gets instead.
|
|
19
25
|
*/
|
|
20
26
|
const UNSUPPORTED_TRIGGERS: Record<string, true> = {
|
|
21
27
|
ON_DRAG: true,
|
|
22
|
-
ON_HOVER: true,
|
|
23
|
-
ON_PRESS: true,
|
|
24
|
-
MOUSE_ENTER: true,
|
|
25
|
-
MOUSE_LEAVE: true,
|
|
26
28
|
MOUSE_UP: true,
|
|
27
29
|
MOUSE_DOWN: true,
|
|
28
30
|
ON_KEY_DOWN: true
|
|
@@ -50,15 +52,47 @@ const overlayPositionSchema = v.picklist([
|
|
|
50
52
|
'BOTTOM_RIGHT'
|
|
51
53
|
] satisfies PrototypeOverlayPositionType[])
|
|
52
54
|
|
|
55
|
+
/** Figma's easing presets, which play has; a spring or a custom curve is refused. */
|
|
56
|
+
const easingSchema = v.strictObject({ type: v.picklist(PROTOTYPE_EASINGS) })
|
|
57
|
+
|
|
53
58
|
const transitionSchema = v.strictObject({
|
|
54
|
-
type: v.picklist(['INSTANT', 'DISSOLVE'] satisfies PrototypeTransitionType[]),
|
|
55
|
-
duration: secondsSchema
|
|
59
|
+
type: v.picklist(['INSTANT', 'DISSOLVE', 'SMART_ANIMATE'] satisfies PrototypeTransitionType[]),
|
|
60
|
+
duration: secondsSchema,
|
|
61
|
+
easing: v.optional(easingSchema)
|
|
56
62
|
})
|
|
57
63
|
|
|
64
|
+
/** A variant's values for its set's properties, as `{ State: 'Hover', Size: 'Large' }`. */
|
|
65
|
+
const variantPropertiesSchema = v.pipe(
|
|
66
|
+
v.record(v.string(), v.string()),
|
|
67
|
+
v.minEntries(1),
|
|
68
|
+
v.description(
|
|
69
|
+
"CHANGE_TO: the values of the variant to change to, in the layer's nearest component set, " +
|
|
70
|
+
'such as { State: "Hover" }. Name every property of a set whose variants share values, as ' +
|
|
71
|
+
'a partial match is refused. Resolved to the variant, so get_reactions reads it back as ' +
|
|
72
|
+
'a destinationId.'
|
|
73
|
+
)
|
|
74
|
+
)
|
|
75
|
+
|
|
58
76
|
const nodeActionSchema = v.strictObject({
|
|
59
77
|
type: v.literal('NODE'),
|
|
60
|
-
destinationId: v.
|
|
61
|
-
|
|
78
|
+
destinationId: v.optional(
|
|
79
|
+
v.pipe(
|
|
80
|
+
v.string(),
|
|
81
|
+
v.minLength(1),
|
|
82
|
+
v.description(
|
|
83
|
+
'NAVIGATE/OVERLAY: a top-level frame on the page; CHANGE_TO: a variant of the set the ' +
|
|
84
|
+
"layer is a variant of, an instance of, or inside; SCROLL_TO: a layer in the layer's " +
|
|
85
|
+
'top-level frame. Omit only for CHANGE_TO, and name the variant with variantProperties.'
|
|
86
|
+
)
|
|
87
|
+
)
|
|
88
|
+
),
|
|
89
|
+
variantProperties: v.optional(variantPropertiesSchema),
|
|
90
|
+
navigation: v.picklist([
|
|
91
|
+
'NAVIGATE',
|
|
92
|
+
'OVERLAY',
|
|
93
|
+
'CHANGE_TO',
|
|
94
|
+
'SCROLL_TO'
|
|
95
|
+
] satisfies PrototypeNavigationType[]),
|
|
62
96
|
transition: v.optional(transitionSchema, { type: 'INSTANT', duration: 0 }),
|
|
63
97
|
overlayRelativePosition: v.optional(overlayPositionSchema, 'CENTER')
|
|
64
98
|
})
|
|
@@ -70,8 +104,14 @@ const actionSchema = v.variant('type', [
|
|
|
70
104
|
])
|
|
71
105
|
|
|
72
106
|
const triggerSchema = v.variant('type', [
|
|
73
|
-
v.strictObject({ type: v.
|
|
74
|
-
v.strictObject({ type: v.literal('AFTER_TIMEOUT'), timeout: secondsSchema })
|
|
107
|
+
v.strictObject({ type: v.picklist(['ON_CLICK', 'ON_HOVER', 'ON_PRESS']) }),
|
|
108
|
+
v.strictObject({ type: v.literal('AFTER_TIMEOUT'), timeout: secondsSchema }),
|
|
109
|
+
v.strictObject({
|
|
110
|
+
type: v.picklist(['MOUSE_ENTER', 'MOUSE_LEAVE']),
|
|
111
|
+
delay: v.optional(secondsSchema, 0),
|
|
112
|
+
// Figma's plugin API reads it; play treats both versions alike.
|
|
113
|
+
deprecatedVersion: v.optional(v.boolean())
|
|
114
|
+
})
|
|
75
115
|
])
|
|
76
116
|
|
|
77
117
|
const reactionSchema = v.strictObject({
|
|
@@ -91,11 +131,13 @@ export type FigmaReactionAction = FigmaReaction['actions'][number]
|
|
|
91
131
|
|
|
92
132
|
/** `reaction` in the plugin shape: the trigger and every action, named as Figma names them. */
|
|
93
133
|
export function toFigmaReaction(reaction: PrototypeReaction): FigmaReaction {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return {
|
|
134
|
+
return { trigger: toFigmaTrigger(reaction.trigger), actions: reaction.actions.map(toFigmaAction) }
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function toFigmaTrigger({ type, delay }: PrototypeReaction['trigger']): FigmaReactionTrigger {
|
|
138
|
+
if (type === 'AFTER_TIMEOUT') return { type, timeout: delay }
|
|
139
|
+
if (type === 'MOUSE_ENTER' || type === 'MOUSE_LEAVE') return { type, delay }
|
|
140
|
+
return { type }
|
|
99
141
|
}
|
|
100
142
|
|
|
101
143
|
function toFigmaAction(action: PrototypeAction): FigmaReactionAction {
|
|
@@ -104,18 +146,42 @@ function toFigmaAction(action: PrototypeAction): FigmaReactionAction {
|
|
|
104
146
|
type: 'NODE',
|
|
105
147
|
destinationId: action.nodeId ?? '',
|
|
106
148
|
navigation: action.navigation,
|
|
107
|
-
transition:
|
|
149
|
+
transition: toFigmaTransition(action.transition),
|
|
108
150
|
overlayRelativePosition: action.overlayPosition
|
|
109
151
|
}
|
|
110
152
|
}
|
|
111
153
|
|
|
154
|
+
function toFigmaTransition({
|
|
155
|
+
type,
|
|
156
|
+
duration,
|
|
157
|
+
easing
|
|
158
|
+
}: PrototypeTransition): v.InferOutput<typeof transitionSchema> {
|
|
159
|
+
return easing ? { type, duration, easing: { type: easing } } : { type, duration }
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function fromFigmaTransition({
|
|
163
|
+
type,
|
|
164
|
+
duration,
|
|
165
|
+
easing
|
|
166
|
+
}: v.InferOutput<typeof transitionSchema>): PrototypeTransition {
|
|
167
|
+
return easing ? { type, duration, easing: easing.type } : { type, duration }
|
|
168
|
+
}
|
|
169
|
+
|
|
112
170
|
/** The validation context: where the reactions live, and what they may point at. */
|
|
113
171
|
export interface ReactionContext {
|
|
114
172
|
graph: SceneGraph
|
|
115
|
-
/** The
|
|
173
|
+
/** The layer the reactions are on, which a Change to or Scroll to destination must suit. */
|
|
174
|
+
nodeId: string
|
|
175
|
+
/** The page the layer is on; a navigation's destination must be a top-level frame on it. */
|
|
116
176
|
pageId: string
|
|
117
177
|
/** The reactions the layer has now, whose ids this keeps by position. */
|
|
118
178
|
previous?: readonly PrototypeReaction[]
|
|
179
|
+
/**
|
|
180
|
+
* An instance's main component's reactions: a reaction kept under one of their ids that an
|
|
181
|
+
* edit changed, from what the layer held at its place and from the main's, becomes the
|
|
182
|
+
* instance's own, with an id of its own.
|
|
183
|
+
*/
|
|
184
|
+
inherited?: readonly PrototypeReaction[]
|
|
119
185
|
}
|
|
120
186
|
|
|
121
187
|
/**
|
|
@@ -136,17 +202,23 @@ export function parseFigmaReactions(value: unknown, context: ReactionContext): P
|
|
|
136
202
|
}
|
|
137
203
|
return result.output.map((reaction, index) => {
|
|
138
204
|
const id = context.previous?.[index]?.id ?? generateId()
|
|
139
|
-
|
|
205
|
+
const parsed: PrototypeReaction = {
|
|
140
206
|
id,
|
|
141
207
|
trigger: toTrigger(reaction.trigger),
|
|
142
208
|
actions: reaction.actions.map((action) => toAction(action, context, index))
|
|
143
209
|
}
|
|
210
|
+
// One the layer already held unchanged stays as it was, a copy of the main's included, so
|
|
211
|
+
// writing reactions back as read never re-ids a copy whose main was edited since.
|
|
212
|
+
const held = context.previous?.[index]
|
|
213
|
+
if (held && sameReaction(held, parsed)) return parsed
|
|
214
|
+
return asInstanceEdit(parsed, context.inherited ?? [])
|
|
144
215
|
})
|
|
145
216
|
}
|
|
146
217
|
|
|
147
218
|
function toTrigger(trigger: FigmaReactionTrigger): PrototypeReaction['trigger'] {
|
|
148
219
|
const type: PrototypeTriggerType = trigger.type
|
|
149
|
-
|
|
220
|
+
if (trigger.type === 'AFTER_TIMEOUT') return { type, delay: trigger.timeout }
|
|
221
|
+
return { type, delay: 'delay' in trigger ? trigger.delay : 0 }
|
|
150
222
|
}
|
|
151
223
|
|
|
152
224
|
function toAction(
|
|
@@ -155,29 +227,136 @@ function toAction(
|
|
|
155
227
|
reactionIndex: number
|
|
156
228
|
): PrototypeAction {
|
|
157
229
|
if (action.type !== 'NODE') return { type: action.type }
|
|
158
|
-
|
|
230
|
+
const destinationId = resolveDestinationId(action, context, reactionIndex)
|
|
231
|
+
assertDestination({ ...action, destinationId }, context, reactionIndex)
|
|
159
232
|
return {
|
|
160
233
|
type: 'NODE',
|
|
161
|
-
nodeId:
|
|
234
|
+
nodeId: destinationId,
|
|
162
235
|
navigation: action.navigation,
|
|
163
|
-
transition: action.transition,
|
|
236
|
+
transition: fromFigmaTransition(action.transition),
|
|
164
237
|
// Only an overlay uses the spot; Figma keeps CENTER on a navigation.
|
|
165
238
|
overlayPosition: action.navigation === 'OVERLAY' ? action.overlayRelativePosition : 'CENTER'
|
|
166
239
|
}
|
|
167
240
|
}
|
|
168
241
|
|
|
169
|
-
/**
|
|
170
|
-
|
|
171
|
-
|
|
242
|
+
/**
|
|
243
|
+
* The layer a NODE action points at: its `destinationId`, or for a Change to, the variant of the
|
|
244
|
+
* layer's set whose `variantProperties` it names.
|
|
245
|
+
*/
|
|
246
|
+
function resolveDestinationId(
|
|
247
|
+
action: v.InferOutput<typeof nodeActionSchema>,
|
|
248
|
+
context: ReactionContext,
|
|
249
|
+
index: number
|
|
250
|
+
): string {
|
|
172
251
|
const at = `reactions[${index}]`
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
252
|
+
const { destinationId, variantProperties, navigation } = action
|
|
253
|
+
if (destinationId && variantProperties) {
|
|
254
|
+
throw failure(`${at} names both destinationId and variantProperties; give one`)
|
|
255
|
+
}
|
|
256
|
+
if (variantProperties) {
|
|
257
|
+
if (navigation !== 'CHANGE_TO') {
|
|
258
|
+
throw failure(`${at}: variantProperties is for CHANGE_TO only, not ${navigation}`)
|
|
259
|
+
}
|
|
260
|
+
return variantByProperties(variantProperties, context, at)
|
|
261
|
+
}
|
|
262
|
+
if (!destinationId) {
|
|
263
|
+
throw failure(
|
|
264
|
+
navigation === 'CHANGE_TO'
|
|
265
|
+
? `${at} must name the variant it Changes to, in destinationId or variantProperties`
|
|
266
|
+
: `${at} must name the layer it goes to, in destinationId`
|
|
267
|
+
)
|
|
268
|
+
}
|
|
269
|
+
return destinationId
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/** The id of the variant of the sets around the layer whose properties are `properties`. */
|
|
273
|
+
function variantByProperties(
|
|
274
|
+
properties: Record<string, string>,
|
|
275
|
+
context: ReactionContext,
|
|
276
|
+
at: string
|
|
277
|
+
): string {
|
|
278
|
+
const sets = variantSetsAround(context.graph, context.nodeId)
|
|
279
|
+
const nearest = sets.at(0)
|
|
280
|
+
if (!nearest) {
|
|
281
|
+
throw failure(
|
|
282
|
+
`${at}: only a variant, an instance of one, or a layer inside one can Change to another variant`
|
|
176
283
|
)
|
|
177
284
|
}
|
|
285
|
+
const wanted = Object.entries(properties)
|
|
286
|
+
.map(([name, value]) => `${name}=${value}`)
|
|
287
|
+
.join(', ')
|
|
288
|
+
for (const set of sets) {
|
|
289
|
+
const matches = context.graph.getChildren(set.id).filter((child) => {
|
|
290
|
+
if (child.type !== 'COMPONENT') return false
|
|
291
|
+
const values = { ...parseVariantName(child.name), ...child.componentPropertyValues }
|
|
292
|
+
return Object.entries(properties).every(([name, value]) => values[name] === value)
|
|
293
|
+
})
|
|
294
|
+
if (matches.length === 1) return matches[0].id
|
|
295
|
+
// A set can hold variants a partial map matches equally: refuse rather than pick one.
|
|
296
|
+
if (matches.length > 1) {
|
|
297
|
+
const names = matches.map((match) => `"${match.name}"`).join(', ')
|
|
298
|
+
throw failure(
|
|
299
|
+
`${at}: ${wanted} matches ${matches.length} variants of ${set.name} (${names}); name every property of the variant`
|
|
300
|
+
)
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
throw failure(`${at}: no variant of ${nearest.name} with ${wanted}`)
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function failure(message: string): Error {
|
|
307
|
+
return new Error(`Property "reactions" failed validation: ${message}`)
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* A destination play can show: a navigation's is a frame at the top of the layer's page, a Change
|
|
312
|
+
* to's a variant of a set the layer belongs to, and a Scroll to's a layer in the layer's
|
|
313
|
+
* top-level frame.
|
|
314
|
+
*/
|
|
315
|
+
function assertDestination(
|
|
316
|
+
action: Pick<v.InferOutput<typeof nodeActionSchema>, 'navigation'> & { destinationId: string },
|
|
317
|
+
context: ReactionContext,
|
|
318
|
+
index: number
|
|
319
|
+
): void {
|
|
320
|
+
const { destinationId, navigation } = action
|
|
321
|
+
const destination = context.graph.getNode(destinationId)
|
|
322
|
+
const at = `reactions[${index}]`
|
|
323
|
+
if (!destination) throw failure(`no layer ${destinationId} at ${at}.actions[0].destinationId`)
|
|
324
|
+
if (navigation === 'CHANGE_TO') return assertVariant(destination, context, at)
|
|
325
|
+
if (navigation === 'SCROLL_TO') return assertScrollTarget(destination, context, at)
|
|
178
326
|
if (destination.type !== 'FRAME' || destination.parentId !== context.pageId) {
|
|
179
|
-
throw
|
|
180
|
-
|
|
327
|
+
throw failure(
|
|
328
|
+
`${at} must navigate to a top-level frame on the same page, not ${destination.type} "${destination.name}"`
|
|
329
|
+
)
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
function assertVariant(destination: SceneNode, context: ReactionContext, at: string): void {
|
|
334
|
+
const sets = variantSetsAround(context.graph, context.nodeId)
|
|
335
|
+
const nearest = sets.at(0)
|
|
336
|
+
if (!nearest) {
|
|
337
|
+
throw failure(
|
|
338
|
+
`${at}: only a variant, an instance of one, or a layer inside one can Change to another variant`
|
|
339
|
+
)
|
|
340
|
+
}
|
|
341
|
+
const inSet = sets.some((set) => set.id === destination.parentId)
|
|
342
|
+
if (destination.type !== 'COMPONENT' || !inSet) {
|
|
343
|
+
throw failure(
|
|
344
|
+
`${at} must Change to a variant of ${nearest.name}, not ${destination.type} "${destination.name}"`
|
|
345
|
+
)
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/** The page's direct child a layer sits in, which play shows as one screen. */
|
|
350
|
+
function topLevelOf(graph: SceneGraph, nodeId: string, pageId: string): SceneNode | undefined {
|
|
351
|
+
return graph.closest(nodeId, (node) => node.parentId === pageId)
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
function assertScrollTarget(destination: SceneNode, context: ReactionContext, at: string): void {
|
|
355
|
+
const { graph, nodeId, pageId } = context
|
|
356
|
+
const top = topLevelOf(graph, nodeId, pageId)
|
|
357
|
+
if (!top || destination.id === top.id || !graph.isDescendant(destination.id, top.id)) {
|
|
358
|
+
throw failure(
|
|
359
|
+
`${at} must Scroll to a layer inside the same top-level frame, not ${destination.type} "${destination.name}"`
|
|
181
360
|
)
|
|
182
361
|
}
|
|
183
362
|
}
|
|
@@ -194,7 +373,7 @@ function unsupportedKind(value: unknown): string | null {
|
|
|
194
373
|
if (trigger && typeof trigger === 'object' && 'type' in trigger) {
|
|
195
374
|
const type = trigger.type
|
|
196
375
|
if (typeof type === 'string' && type in UNSUPPORTED_TRIGGERS) {
|
|
197
|
-
return `a prototype starts from ON_CLICK or AFTER_TIMEOUT, not ${type}`
|
|
376
|
+
return `a prototype starts from ON_CLICK, ON_HOVER, ON_PRESS, MOUSE_ENTER, MOUSE_LEAVE or AFTER_TIMEOUT, not ${type}`
|
|
198
377
|
}
|
|
199
378
|
}
|
|
200
379
|
const actions = reaction.actions
|
package/src/figma-api/surface.ts
CHANGED
|
@@ -13,6 +13,7 @@ export 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'
|
|
@@ -35,5 +36,8 @@ export const FIGMA_API_INCOMPLETE_MEMBERS = [
|
|
|
35
36
|
'viewport'
|
|
36
37
|
] as const
|
|
37
38
|
|
|
38
|
-
/**
|
|
39
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Members hosts read or write beyond Figma's Plugin API: the `JSON.stringify` hook, and node
|
|
41
|
+
* fields stored in `.fig` that the installed typings do not name.
|
|
42
|
+
*/
|
|
43
|
+
export const SERIALIZATION_MEMBERS = ['toJSON', 'scrollBehavior'] as const
|
|
@@ -65,7 +65,8 @@ export class FigmaVariablesAPI {
|
|
|
65
65
|
|
|
66
66
|
getLocalVariables(type?: FigmaVariableResolvedType): FigmaVariable[] {
|
|
67
67
|
const wanted = type === undefined ? undefined : assertType('getLocalVariables', type)
|
|
68
|
-
return
|
|
68
|
+
return this.#graph
|
|
69
|
+
.getLiveVariables()
|
|
69
70
|
.filter((variable) => wanted === undefined || variable.type === wanted)
|
|
70
71
|
.map((variable) => new FigmaVariable(this.#graph, variable.id))
|
|
71
72
|
}
|
|
@@ -75,9 +76,9 @@ export class FigmaVariablesAPI {
|
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
getLocalVariableCollections(): FigmaVariableCollection[] {
|
|
78
|
-
return
|
|
79
|
-
(
|
|
80
|
-
|
|
79
|
+
return this.#graph
|
|
80
|
+
.getLiveCollections()
|
|
81
|
+
.map((collection) => new FigmaVariableCollection(this.#graph, collection.id))
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
async getLocalVariableCollectionsAsync(): Promise<FigmaVariableCollection[]> {
|
package/src/global.d.ts
CHANGED
|
@@ -25,3 +25,29 @@ declare module 'opencc-js/dict/TSCharacters' {
|
|
|
25
25
|
declare module 'svg2pdf.js/dist/svg2pdf.es.min.js' {
|
|
26
26
|
export * from 'svg2pdf.js'
|
|
27
27
|
}
|
|
28
|
+
|
|
29
|
+
/** gifenc ships no types; these are the parts the prototype recorder uses. */
|
|
30
|
+
declare module 'gifenc' {
|
|
31
|
+
type Palette = number[][]
|
|
32
|
+
interface GIFFrameOptions {
|
|
33
|
+
palette?: Palette
|
|
34
|
+
/** Milliseconds; GIF stores hundredths of a second. */
|
|
35
|
+
delay?: number
|
|
36
|
+
/** 0 repeats forever, -1 plays once. */
|
|
37
|
+
repeat?: number
|
|
38
|
+
}
|
|
39
|
+
interface GIFEncoderInstance {
|
|
40
|
+
writeFrame(index: Uint8Array, width: number, height: number, options?: GIFFrameOptions): void
|
|
41
|
+
finish(): void
|
|
42
|
+
bytes(): Uint8Array
|
|
43
|
+
bytesView(): Uint8Array
|
|
44
|
+
}
|
|
45
|
+
export function GIFEncoder(): GIFEncoderInstance
|
|
46
|
+
export function quantize(rgba: Uint8Array, maxColors: number): Palette
|
|
47
|
+
export function applyPalette(rgba: Uint8Array, palette: Palette): Uint8Array
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** gifenc's ES build is the same module as its root, which Node loads as CJS. */
|
|
51
|
+
declare module 'gifenc/dist/gifenc.esm.js' {
|
|
52
|
+
export * from 'gifenc'
|
|
53
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { CanvasKit } from 'canvaskit-wasm'
|
|
2
|
+
|
|
3
|
+
import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
4
|
+
|
|
5
|
+
import type { SkiaRenderer } from '#core/canvas'
|
|
6
|
+
import { makeBooleanOperationPath } from '#core/canvas/boolean'
|
|
7
|
+
|
|
8
|
+
import { headlessRenderer } from './raster/headless'
|
|
9
|
+
|
|
10
|
+
/** Writes a boolean operation's live result path as SVG path data, or null when it has none. */
|
|
11
|
+
export type BooleanPathResolver = (graph: SceneGraph, node: SceneNode) => string | null
|
|
12
|
+
|
|
13
|
+
/** One resolver per renderer: a host's live one, or the offscreen renderer built for a CanvasKit. */
|
|
14
|
+
const resolvers = new WeakMap<SkiaRenderer, BooleanPathResolver>()
|
|
15
|
+
const pendingByCanvasKit = new WeakMap<CanvasKit, Promise<BooleanPathResolver>>()
|
|
16
|
+
let pending: Promise<BooleanPathResolver> | null = null
|
|
17
|
+
|
|
18
|
+
function resolverFor(renderer: SkiaRenderer): BooleanPathResolver {
|
|
19
|
+
const cached = resolvers.get(renderer)
|
|
20
|
+
if (cached) return cached
|
|
21
|
+
const resolver: BooleanPathResolver = (graph, node) => {
|
|
22
|
+
const path = makeBooleanOperationPath(renderer, node, graph)
|
|
23
|
+
if (!path) return null
|
|
24
|
+
const data = path.toSVGString()
|
|
25
|
+
path.delete()
|
|
26
|
+
return data
|
|
27
|
+
}
|
|
28
|
+
resolvers.set(renderer, resolver)
|
|
29
|
+
return resolver
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A resolver that recomputes boolean geometry from the graph, through the same path operation the
|
|
34
|
+
* canvas draws, so an export follows edits to the operands instead of a stored copy. A host that
|
|
35
|
+
* already draws the document passes its CanvasKit and renderer, so the export never loads a
|
|
36
|
+
* second CanvasKit; without them the offscreen renderer loads its own, as the CLI and MCP do.
|
|
37
|
+
*/
|
|
38
|
+
export function booleanPathResolver(
|
|
39
|
+
canvasKit?: CanvasKit,
|
|
40
|
+
renderer?: SkiaRenderer
|
|
41
|
+
): Promise<BooleanPathResolver> {
|
|
42
|
+
if (renderer) return Promise.resolve(resolverFor(renderer))
|
|
43
|
+
if (canvasKit) {
|
|
44
|
+
let forKit = pendingByCanvasKit.get(canvasKit)
|
|
45
|
+
if (!forKit) {
|
|
46
|
+
forKit = headlessRenderer(canvasKit).then(({ renderer }) => resolverFor(renderer))
|
|
47
|
+
pendingByCanvasKit.set(canvasKit, forKit)
|
|
48
|
+
}
|
|
49
|
+
return forKit
|
|
50
|
+
}
|
|
51
|
+
pending ??= headlessRenderer().then(({ renderer }) => resolverFor(renderer))
|
|
52
|
+
return pending
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Whether an export has to compute boolean geometry: a boolean contains no stored result path. */
|
|
56
|
+
export function needsBooleanPaths(graph: SceneGraph): boolean {
|
|
57
|
+
return [...graph.getAllNodes()].some(
|
|
58
|
+
(node) => node.type === 'BOOLEAN_OPERATION' && node.fillGeometry.length === 0
|
|
59
|
+
)
|
|
60
|
+
}
|
|
@@ -47,7 +47,7 @@ export function knownTokens(graph: SceneGraph): KnownTokens {
|
|
|
47
47
|
byCSSName.set(name, { variable, collection, library: isLibraryCollection(collection) })
|
|
48
48
|
}
|
|
49
49
|
const byCondition = new Map<string, KnownMode>()
|
|
50
|
-
for (const collection of graph.
|
|
50
|
+
for (const collection of graph.getLiveCollections()) {
|
|
51
51
|
if (isLibraryCollection(collection)) continue
|
|
52
52
|
for (const mode of collection.modes) {
|
|
53
53
|
if (mode.modeId === collection.defaultModeId) continue
|