@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
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process'
|
|
2
|
+
import { once } from 'node:events'
|
|
3
|
+
import { rmSync } from 'node:fs'
|
|
4
|
+
import { mkdtemp, readFile, rm, stat } from 'node:fs/promises'
|
|
5
|
+
import { tmpdir } from 'node:os'
|
|
6
|
+
import { join } from 'node:path'
|
|
7
|
+
|
|
8
|
+
import type { VideoFormat, VideoHostEncoder, VideoSink } from '#core/io/formats/video'
|
|
9
|
+
|
|
10
|
+
/** The encoder and settings ffmpeg records each format with: H.264 and VP9 in 4:2:0. */
|
|
11
|
+
const ENCODERS = {
|
|
12
|
+
mp4: {
|
|
13
|
+
encoder: 'libx264',
|
|
14
|
+
args: ['-c:v', 'libx264', '-preset', 'medium', '-crf', '20', '-movflags', '+faststart']
|
|
15
|
+
},
|
|
16
|
+
webm: { encoder: 'libvpx-vp9', args: ['-c:v', 'libvpx-vp9', '-b:v', '0', '-crf', '32'] }
|
|
17
|
+
} as const
|
|
18
|
+
|
|
19
|
+
/** The tail of ffmpeg's error output a failure reports. */
|
|
20
|
+
const STDERR_TAIL = 2000
|
|
21
|
+
|
|
22
|
+
/** Folders of ffmpeg sinks still running in this process, removed when it is interrupted. */
|
|
23
|
+
const temporaryDirs = new Set<string>()
|
|
24
|
+
let cleanupInstalled = false
|
|
25
|
+
|
|
26
|
+
function cleanupTemporaryDirs(): void {
|
|
27
|
+
for (const dir of temporaryDirs) rmSync(dir, { recursive: true, force: true })
|
|
28
|
+
temporaryDirs.clear()
|
|
29
|
+
removeCleanupListeners()
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function interrupted(signal: 'SIGINT' | 'SIGTERM'): void {
|
|
33
|
+
cleanupTemporaryDirs()
|
|
34
|
+
// With our listener gone, the same signal takes its default path, so the exit code stays.
|
|
35
|
+
process.kill(process.pid, signal)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const onInterrupt = () => interrupted('SIGINT')
|
|
39
|
+
const onTerminate = () => interrupted('SIGTERM')
|
|
40
|
+
|
|
41
|
+
function installCleanupListeners(): void {
|
|
42
|
+
if (cleanupInstalled) return
|
|
43
|
+
cleanupInstalled = true
|
|
44
|
+
process.once('exit', cleanupTemporaryDirs)
|
|
45
|
+
process.once('SIGINT', onInterrupt)
|
|
46
|
+
process.once('SIGTERM', onTerminate)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function removeCleanupListeners(): void {
|
|
50
|
+
if (!cleanupInstalled) return
|
|
51
|
+
cleanupInstalled = false
|
|
52
|
+
process.off('exit', cleanupTemporaryDirs)
|
|
53
|
+
process.off('SIGINT', onInterrupt)
|
|
54
|
+
process.off('SIGTERM', onTerminate)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function trackTemporaryDir(dir: string): void {
|
|
58
|
+
temporaryDirs.add(dir)
|
|
59
|
+
installCleanupListeners()
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function releaseTemporaryDir(dir: string): void {
|
|
63
|
+
temporaryDirs.delete(dir)
|
|
64
|
+
if (temporaryDirs.size === 0) removeCleanupListeners()
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** The encoders `command` lists, or none when it cannot run. */
|
|
68
|
+
function listEncoders(command: string): Promise<string> {
|
|
69
|
+
return new Promise((resolve) => {
|
|
70
|
+
const child = spawn(command, ['-hide_banner', '-encoders'], {
|
|
71
|
+
stdio: ['ignore', 'pipe', 'ignore']
|
|
72
|
+
})
|
|
73
|
+
let output = ''
|
|
74
|
+
child.stdout.setEncoding('utf8')
|
|
75
|
+
child.stdout.on('data', (chunk: string) => {
|
|
76
|
+
output += chunk
|
|
77
|
+
})
|
|
78
|
+
child.on('error', () => resolve(''))
|
|
79
|
+
child.on('close', (code) => resolve(code === 0 ? output : ''))
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Encodes recorded frames with an ffmpeg on the machine, for hosts without WebCodecs such as the
|
|
85
|
+
* CLI: raw RGBA frames go to its input as they come, and the file is read back when it ends.
|
|
86
|
+
* A missing `command`, or one without libx264 or libvpx-vp9, supports nothing.
|
|
87
|
+
*/
|
|
88
|
+
export function createFFmpegEncoder(command = 'ffmpeg'): VideoHostEncoder {
|
|
89
|
+
let encoders: Promise<string> | null = null
|
|
90
|
+
|
|
91
|
+
return {
|
|
92
|
+
async supports(format: VideoFormat) {
|
|
93
|
+
if (format === 'gif') return false
|
|
94
|
+
encoders ??= listEncoders(command)
|
|
95
|
+
return (await encoders).includes(ENCODERS[format].encoder)
|
|
96
|
+
},
|
|
97
|
+
async create(format, options): Promise<VideoSink> {
|
|
98
|
+
if (format === 'gif') throw new Error('ffmpeg records MP4 and WebM, not GIF')
|
|
99
|
+
const dir = await mkdtemp(join(tmpdir(), 'pairdraw-ffmpeg-'))
|
|
100
|
+
trackTemporaryDir(dir)
|
|
101
|
+
const output = join(dir, `video.${format}`)
|
|
102
|
+
let byteLength = 0
|
|
103
|
+
const state = {
|
|
104
|
+
/** finish or cancel ran, so no frame may follow. */
|
|
105
|
+
ended: false,
|
|
106
|
+
/** ffmpeg stopped reading, which a dying ffmpeg does before it exits. */
|
|
107
|
+
inputClosed: false
|
|
108
|
+
}
|
|
109
|
+
const child = spawn(
|
|
110
|
+
command,
|
|
111
|
+
[
|
|
112
|
+
'-hide_banner',
|
|
113
|
+
'-loglevel',
|
|
114
|
+
'error',
|
|
115
|
+
'-f',
|
|
116
|
+
'rawvideo',
|
|
117
|
+
'-pix_fmt',
|
|
118
|
+
'rgba',
|
|
119
|
+
'-s',
|
|
120
|
+
`${options.width}x${options.height}`,
|
|
121
|
+
'-r',
|
|
122
|
+
String(options.fps),
|
|
123
|
+
'-i',
|
|
124
|
+
'pipe:0',
|
|
125
|
+
...ENCODERS[format].args,
|
|
126
|
+
'-pix_fmt',
|
|
127
|
+
'yuv420p',
|
|
128
|
+
'-y',
|
|
129
|
+
output
|
|
130
|
+
],
|
|
131
|
+
{ stdio: ['pipe', 'ignore', 'pipe'] }
|
|
132
|
+
)
|
|
133
|
+
let stderr = ''
|
|
134
|
+
// ffmpeg stopping early closes its input; the frame that finds it closed reports why.
|
|
135
|
+
child.stdin.on('error', () => {
|
|
136
|
+
state.inputClosed = true
|
|
137
|
+
})
|
|
138
|
+
child.stderr.setEncoding('utf8')
|
|
139
|
+
child.stderr.on('data', (chunk: string) => {
|
|
140
|
+
stderr = (stderr + chunk).slice(-STDERR_TAIL)
|
|
141
|
+
})
|
|
142
|
+
const exited = new Promise<number | null>((resolve) => {
|
|
143
|
+
child.on('error', () => resolve(-1))
|
|
144
|
+
child.on('close', (code) => resolve(code))
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
const failure = () =>
|
|
148
|
+
new Error(`ffmpeg could not encode the video: ${stderr.trim() || 'it stopped'}`)
|
|
149
|
+
/** Waits for ffmpeg to exit, so its error output is complete, then reports it. */
|
|
150
|
+
const failed = async (): Promise<never> => {
|
|
151
|
+
await exited
|
|
152
|
+
throw failure()
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return {
|
|
156
|
+
async add(image) {
|
|
157
|
+
if (state.ended) throw new Error('The recording has ended')
|
|
158
|
+
if (state.inputClosed) await failed()
|
|
159
|
+
if (!child.stdin.write(image.data)) {
|
|
160
|
+
// `once` drops its listeners whichever way the wait ends; ffmpeg exiting ends it too.
|
|
161
|
+
const drained = once(child.stdin, 'drain').then(() => true)
|
|
162
|
+
const ok = await Promise.race([drained, exited.then(() => false)]).catch(() => false)
|
|
163
|
+
if (!ok || state.inputClosed) await failed()
|
|
164
|
+
}
|
|
165
|
+
byteLength = (await stat(output).catch(() => null))?.size ?? byteLength
|
|
166
|
+
},
|
|
167
|
+
async finish() {
|
|
168
|
+
if (state.ended) throw new Error('The recording has ended')
|
|
169
|
+
state.ended = true
|
|
170
|
+
child.stdin.end()
|
|
171
|
+
const code = await exited
|
|
172
|
+
try {
|
|
173
|
+
if (code !== 0) throw failure()
|
|
174
|
+
return new Uint8Array(await readFile(output))
|
|
175
|
+
} finally {
|
|
176
|
+
await rm(dir, { recursive: true, force: true })
|
|
177
|
+
releaseTemporaryDir(dir)
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
async cancel() {
|
|
181
|
+
if (!state.ended) {
|
|
182
|
+
state.ended = true
|
|
183
|
+
child.kill('SIGKILL')
|
|
184
|
+
}
|
|
185
|
+
await exited
|
|
186
|
+
// Whatever ended the recording, its folder goes with it.
|
|
187
|
+
await rm(dir, { recursive: true, force: true })
|
|
188
|
+
releaseTemporaryDir(dir)
|
|
189
|
+
},
|
|
190
|
+
get byteLength() {
|
|
191
|
+
return byteLength
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -111,6 +111,11 @@ export class CommentHandle {
|
|
|
111
111
|
return commentPosition(this.graph, this.thread)
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
/** The area the person circled, in canvas units relative to the pin; null for a clicked pin. */
|
|
115
|
+
get region(): CommentThread['region'] {
|
|
116
|
+
return this.thread.region ?? null
|
|
117
|
+
}
|
|
118
|
+
|
|
114
119
|
get replies(): { id: string; author: string; text: string; createdAt: string }[] {
|
|
115
120
|
return liveReplies(this.thread).map(({ id, author, text, createdAt }) => ({
|
|
116
121
|
id,
|
|
@@ -151,6 +156,7 @@ export class CommentHandle {
|
|
|
151
156
|
page: this.page,
|
|
152
157
|
node: this.node,
|
|
153
158
|
position: this.position,
|
|
159
|
+
region: this.region,
|
|
154
160
|
replies: this.replies
|
|
155
161
|
}
|
|
156
162
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { SceneGraph } from '@pairdraw/scene-graph'
|
|
2
|
+
import {
|
|
3
|
+
addDesignDecision,
|
|
4
|
+
cachedDesignMemory,
|
|
5
|
+
pinDesignExample,
|
|
6
|
+
writeDesignMemory,
|
|
7
|
+
type DesignMemory,
|
|
8
|
+
type DesignMemoryGroup
|
|
9
|
+
} from '@pairdraw/scene-graph/design-memory'
|
|
10
|
+
|
|
11
|
+
import { checkDesignValues, currentDesignRules, type DesignValueVerdict } from '#core/design-memory'
|
|
12
|
+
|
|
13
|
+
import { nodeOf, type NodeRef } from './behaviours'
|
|
14
|
+
|
|
15
|
+
const NO_MEMORY =
|
|
16
|
+
'This document has no design memory; the person creates one in the Design panel with nothing selected.'
|
|
17
|
+
|
|
18
|
+
function memoryOf(graph: SceneGraph): DesignMemory {
|
|
19
|
+
const memory = cachedDesignMemory(graph)
|
|
20
|
+
if (!memory) throw new Error(NO_MEMORY)
|
|
21
|
+
return memory
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Judges values before they are used: `ok`, `warn`, `refuse`, or `invalid`, with the nearest allowed. */
|
|
25
|
+
export function checkProposedDesignValues(
|
|
26
|
+
graph: SceneGraph,
|
|
27
|
+
proposal: Partial<Record<DesignMemoryGroup, readonly (string | number)[]>>
|
|
28
|
+
): DesignValueVerdict[] {
|
|
29
|
+
return checkDesignValues(currentDesignRules(graph, memoryOf(graph)), proposal)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Writes down a decision an agent made, and pins `example` as a layer that shows it. Agents add
|
|
34
|
+
* to the memory but never change what it allows: only the person does that.
|
|
35
|
+
*/
|
|
36
|
+
export function recordDesignDecision(
|
|
37
|
+
graph: SceneGraph,
|
|
38
|
+
text: string,
|
|
39
|
+
example?: NodeRef
|
|
40
|
+
): { decisions: number; examples: number } {
|
|
41
|
+
let memory = memoryOf(graph)
|
|
42
|
+
const decisions = memory.decisions.length
|
|
43
|
+
memory = addDesignDecision(memory, text, 'agent')
|
|
44
|
+
if (memory.decisions.length === decisions) {
|
|
45
|
+
throw new Error(
|
|
46
|
+
text.trim()
|
|
47
|
+
? 'The design memory holds as many decisions as it can; ask the person to remove some.'
|
|
48
|
+
: 'A decision needs text.'
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
if (example !== undefined) {
|
|
52
|
+
const nodeId = nodeOf(graph, example).id
|
|
53
|
+
memory = pinDesignExample(memory, nodeId)
|
|
54
|
+
if (!memory.examples.some((pinned) => pinned.nodeId === nodeId))
|
|
55
|
+
throw new Error(
|
|
56
|
+
'The design memory holds as many examples as it can; ask the person to unpin some.'
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
writeDesignMemory(graph, memory)
|
|
60
|
+
return { decisions: memory.decisions.length, examples: memory.examples.length }
|
|
61
|
+
}
|
|
@@ -6,12 +6,18 @@ import {
|
|
|
6
6
|
type BehaviourSpec
|
|
7
7
|
} from '@pairdraw/scene-graph/behaviours'
|
|
8
8
|
import type { OkHCLColor, OkHCLPayload } from '@pairdraw/scene-graph/color'
|
|
9
|
+
import type { DesignMemoryGroup } from '@pairdraw/scene-graph/design-memory'
|
|
9
10
|
import { parseVariableFormula } from '@pairdraw/scene-graph/variables'
|
|
10
11
|
|
|
12
|
+
import {
|
|
13
|
+
describeDesignMemory,
|
|
14
|
+
type DesignMemoryReport,
|
|
15
|
+
type DesignValueVerdict
|
|
16
|
+
} from '#core/design-memory'
|
|
11
17
|
import { exposeInstanceSwap } from '#core/figma-api/components'
|
|
12
18
|
import type { FigmaAPI, FigmaNodeProxy } from '#core/figma-api/index'
|
|
13
19
|
import { writeVariableValue } from '#core/figma-api/variables'
|
|
14
|
-
import {
|
|
20
|
+
import { readFontReadiness, type FontReadiness } from '#core/text/font/readiness'
|
|
15
21
|
|
|
16
22
|
import {
|
|
17
23
|
getBehaviour,
|
|
@@ -29,22 +35,32 @@ import {
|
|
|
29
35
|
type CommentHandle,
|
|
30
36
|
type NewComment
|
|
31
37
|
} from './comments'
|
|
38
|
+
import { checkProposedDesignValues, recordDesignDecision } from './design-memory'
|
|
32
39
|
import {
|
|
33
40
|
readFillOkHCL,
|
|
34
41
|
readLayoutDirection,
|
|
35
42
|
readStrokeOkHCL,
|
|
36
43
|
readTextDirection,
|
|
37
44
|
writeFillOkHCL,
|
|
45
|
+
writeFontFeatures,
|
|
38
46
|
writeLayoutDirection,
|
|
47
|
+
writeRangeFontFeatures,
|
|
39
48
|
writeStrokeOkHCL,
|
|
40
49
|
writeTextDirection
|
|
41
50
|
} from './nodes'
|
|
42
51
|
import { getStatus, listStatuses, setStatus, type StatusInfo } from './statuses'
|
|
43
52
|
import { bindVariable, unbindVariable, type VariableRef } from './variables'
|
|
53
|
+
import {
|
|
54
|
+
createVariationSet,
|
|
55
|
+
getVariationSet,
|
|
56
|
+
listVariationSets,
|
|
57
|
+
type VariationSetHandle
|
|
58
|
+
} from './variations'
|
|
44
59
|
|
|
45
60
|
export { BehaviourHandle, type NodeRef } from './behaviours'
|
|
46
61
|
export type { StatusInfo } from './statuses'
|
|
47
62
|
export type { VariableRef } from './variables'
|
|
63
|
+
export { VariationSetHandle, type VariationSetInfo } from './variations'
|
|
48
64
|
export {
|
|
49
65
|
CommentHandle,
|
|
50
66
|
DEFAULT_COMMENT_AUTHOR,
|
|
@@ -74,15 +90,13 @@ export class PairdrawAPI {
|
|
|
74
90
|
modeName?: string
|
|
75
91
|
): VariableLiteral {
|
|
76
92
|
const graph = this.figma.graph
|
|
77
|
-
const collections =
|
|
78
|
-
(item) => item.name === collectionName
|
|
79
|
-
)
|
|
93
|
+
const collections = graph.getLiveCollections().filter((item) => item.name === collectionName)
|
|
80
94
|
const collection = collections.at(0)
|
|
81
95
|
if (!collection || collections.length !== 1)
|
|
82
96
|
throw new Error(`Unknown or ambiguous collection: ${collectionName}`)
|
|
83
|
-
const variables =
|
|
84
|
-
(
|
|
85
|
-
|
|
97
|
+
const variables = graph
|
|
98
|
+
.getLiveVariables()
|
|
99
|
+
.filter((item) => item.collectionId === collection.id && item.name === variableName)
|
|
86
100
|
const variable = variables.at(0)
|
|
87
101
|
if (!variable || variables.length !== 1)
|
|
88
102
|
throw new Error(`Unknown or ambiguous variable: ${variableName}`)
|
|
@@ -176,6 +190,56 @@ export class PairdrawAPI {
|
|
|
176
190
|
setStatus(this.figma.graph, node, status)
|
|
177
191
|
}
|
|
178
192
|
|
|
193
|
+
/**
|
|
194
|
+
* The document's design memory: the colors, fonts, sizes, spacing and radii agents may use,
|
|
195
|
+
* whether an off-system value is refused or warned about, the decisions written down, and the
|
|
196
|
+
* layers pinned as examples. Null when the document has none.
|
|
197
|
+
*/
|
|
198
|
+
get designMemory(): DesignMemoryReport | null {
|
|
199
|
+
return describeDesignMemory(this.figma.graph)
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Judge values before using them, such as `{ colors: ['#FF00AA'], spacing: [13] }`: each comes
|
|
204
|
+
* back `ok`, `warn`, `refuse` or `invalid`, with the nearest allowed value.
|
|
205
|
+
*/
|
|
206
|
+
checkDesignValues(
|
|
207
|
+
proposal: Partial<Record<DesignMemoryGroup, readonly (string | number)[]>>
|
|
208
|
+
): DesignValueVerdict[] {
|
|
209
|
+
return checkProposedDesignValues(this.figma.graph, proposal)
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Write a decision down in the design memory, optionally pinning a layer that shows it as an
|
|
214
|
+
* example. The memory's allowed values stay as the person set them.
|
|
215
|
+
*/
|
|
216
|
+
recordDesignDecision(text: string, example?: NodeRef): { decisions: number; examples: number } {
|
|
217
|
+
return recordDesignDecision(this.figma.graph, text, example)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Copy a layer `count` times (1 to 8) into a section of variations beside it, made the first
|
|
222
|
+
* time; `labels` name what each version tries, as in `V2 · Calmer palette`. On a version, it
|
|
223
|
+
* copies that version into its set. The original does not change.
|
|
224
|
+
*/
|
|
225
|
+
createVariations(
|
|
226
|
+
node: NodeRef,
|
|
227
|
+
options: { count: number; labels?: readonly string[] }
|
|
228
|
+
): { set: VariationSetHandle; versions: FigmaNodeProxy[] } {
|
|
229
|
+
const { set, created } = createVariationSet(this.figma, node, options)
|
|
230
|
+
return { set, versions: created }
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/** The set of variations a layer belongs to, from its section, a version or a layer inside one. */
|
|
234
|
+
getVariations(node: NodeRef): VariationSetHandle | null {
|
|
235
|
+
return getVariationSet(this.figma, node)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** The sets of variations on the current page. */
|
|
239
|
+
get variations(): VariationSetHandle[] {
|
|
240
|
+
return listVariationSets(this.figma, this.figma.currentPageId)
|
|
241
|
+
}
|
|
242
|
+
|
|
179
243
|
/**
|
|
180
244
|
* Expose a swap on instances as one INSTANCE_SWAP property, offering the candidate components;
|
|
181
245
|
* returns the layer that holds the property.
|
|
@@ -200,8 +264,8 @@ export class PairdrawAPI {
|
|
|
200
264
|
* Whether the current page's fonts are faithfully available: requested faces, where each
|
|
201
265
|
* loaded from, substitutions, why an installed face could not load, and the layers affected.
|
|
202
266
|
*/
|
|
203
|
-
getFontStatus():
|
|
204
|
-
return
|
|
267
|
+
getFontStatus(): FontReadiness {
|
|
268
|
+
return readFontReadiness(this.figma.graph, this.figma.currentPageId)
|
|
205
269
|
}
|
|
206
270
|
|
|
207
271
|
/** A fill's OkHCL color, which the color picker keeps beside its RGB, or null. */
|
|
@@ -239,4 +303,19 @@ export class PairdrawAPI {
|
|
|
239
303
|
setTextDirection(node: NodeRef, direction: string): void {
|
|
240
304
|
writeTextDirection(this.figma.graph, node, direction)
|
|
241
305
|
}
|
|
306
|
+
|
|
307
|
+
/** Merges OpenType feature toggles into the text's own, keeping the tags it does not name. */
|
|
308
|
+
setFontFeatures(node: NodeRef, features: Record<string, boolean>): void {
|
|
309
|
+
writeFontFeatures(this.figma.graph, node, features)
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/** Merges OpenType feature toggles into a text range's own, keeping its other features. */
|
|
313
|
+
setRangeFontFeatures(
|
|
314
|
+
node: NodeRef,
|
|
315
|
+
start: number,
|
|
316
|
+
end: number,
|
|
317
|
+
features: Record<string, boolean>
|
|
318
|
+
): void {
|
|
319
|
+
writeRangeFontFeatures(this.figma.graph, node, start, end, features)
|
|
320
|
+
}
|
|
242
321
|
}
|
|
@@ -12,6 +12,9 @@ import {
|
|
|
12
12
|
import { recordInstanceOverride } from '@pairdraw/scene-graph/instances'
|
|
13
13
|
|
|
14
14
|
import { assertNodeEditable } from '#core/editor/capabilities'
|
|
15
|
+
import { openTypeFeaturesPatch } from '#core/figma-api/accessors/text/opentype'
|
|
16
|
+
import { assertTextRange } from '#core/figma-api/text/style'
|
|
17
|
+
import { styleRunsWithPatch } from '#core/text/character-style'
|
|
15
18
|
|
|
16
19
|
import { nodeOf, type NodeRef } from './behaviours'
|
|
17
20
|
|
|
@@ -82,3 +85,38 @@ export function readTextDirection(graph: SceneGraph, ref: NodeRef): TextDirectio
|
|
|
82
85
|
export function writeTextDirection(graph: SceneGraph, ref: NodeRef, value: string): void {
|
|
83
86
|
editNode(graph, nodeOf(graph, ref), { textDirection: direction(value) })
|
|
84
87
|
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Merges OpenType features into a text's own: the given tags replace their entries, the rest
|
|
91
|
+
* stay, as the panel's feature switches do. Figma's plugin API only reads a node's features;
|
|
92
|
+
* this is the write path the tools and the panel share.
|
|
93
|
+
*/
|
|
94
|
+
export function writeFontFeatures(
|
|
95
|
+
graph: SceneGraph,
|
|
96
|
+
ref: NodeRef,
|
|
97
|
+
features: Record<string, boolean>
|
|
98
|
+
): void {
|
|
99
|
+
const node = nodeOf(graph, ref)
|
|
100
|
+
const merged = new Map(node.fontFeatures.map((feature) => [feature.tag, feature.enabled]))
|
|
101
|
+
for (const [tag, enabled] of Object.entries(features)) merged.set(tag.toUpperCase(), enabled)
|
|
102
|
+
editNode(graph, node, {
|
|
103
|
+
fontFeatures: [...merged].map(([tag, enabled]) => ({ tag, enabled }))
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Merges OpenType features into a text range's own, keeping the features its characters already
|
|
109
|
+
* had. Figma's plugin API has no range feature setter, so this lives on `pairdraw`.
|
|
110
|
+
*/
|
|
111
|
+
export function writeRangeFontFeatures(
|
|
112
|
+
graph: SceneGraph,
|
|
113
|
+
ref: NodeRef,
|
|
114
|
+
start: number,
|
|
115
|
+
end: number,
|
|
116
|
+
features: Record<string, boolean>
|
|
117
|
+
): void {
|
|
118
|
+
const node = nodeOf(graph, ref)
|
|
119
|
+
assertTextRange('setRangeFontFeatures', node, start, end)
|
|
120
|
+
const patch = openTypeFeaturesPatch('setRangeFontFeatures', node, start, features)
|
|
121
|
+
editNode(graph, node, { styleRuns: styleRunsWithPatch(node, start, end, patch) })
|
|
122
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { pick } from 'es-toolkit'
|
|
2
|
+
|
|
3
|
+
import type { SceneNode } from '@pairdraw/scene-graph'
|
|
4
|
+
import {
|
|
5
|
+
applyVariation,
|
|
6
|
+
discardVariations,
|
|
7
|
+
variationSetOf,
|
|
8
|
+
variationSetsOnPage,
|
|
9
|
+
type VariationSetView
|
|
10
|
+
} from '@pairdraw/scene-graph/variations'
|
|
11
|
+
|
|
12
|
+
import { createVariations, type VariationRequest } from '#core/editor/variations/create'
|
|
13
|
+
import { assertVariationPickable } from '#core/editor/variations/pick'
|
|
14
|
+
import type { FigmaAPI, FigmaNodeProxy } from '#core/figma-api/index'
|
|
15
|
+
|
|
16
|
+
import { nodeOf, type NodeRef } from './behaviours'
|
|
17
|
+
|
|
18
|
+
/** A layer of a set as `toJSON` and the tools report it: the node's id and name. */
|
|
19
|
+
export type VariationLayerInfo = Pick<SceneNode, 'id' | 'name'>
|
|
20
|
+
|
|
21
|
+
/** A set of variations as `toJSON` and the tools report it. */
|
|
22
|
+
export interface VariationSetInfo {
|
|
23
|
+
id: string
|
|
24
|
+
original: VariationLayerInfo | null
|
|
25
|
+
versions: VariationLayerInfo[]
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const info = (node: VariationLayerInfo): VariationLayerInfo => pick(node, ['id', 'name'])
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A set of variations: copies of a layer side by side in a section beside it. `id` is the
|
|
32
|
+
* section's; reading a set that was used or discarded throws.
|
|
33
|
+
*/
|
|
34
|
+
export class VariationSetHandle {
|
|
35
|
+
constructor(
|
|
36
|
+
private readonly figma: FigmaAPI,
|
|
37
|
+
readonly id: string
|
|
38
|
+
) {}
|
|
39
|
+
|
|
40
|
+
private get view(): VariationSetView {
|
|
41
|
+
const view = variationSetOf(this.figma.graph, this.id)
|
|
42
|
+
if (view?.section.id !== this.id) throw new Error(`Variations ${this.id} are gone`)
|
|
43
|
+
return view
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** The layer the versions vary, or null when it was deleted. */
|
|
47
|
+
get original(): FigmaNodeProxy | null {
|
|
48
|
+
const { original } = this.view
|
|
49
|
+
return original ? this.figma.wrapNode(original.id) : null
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The versions, in their order in the section. */
|
|
53
|
+
get versions(): FigmaNodeProxy[] {
|
|
54
|
+
return this.view.versions.map((version) => this.figma.wrapNode(version.id))
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Make the original look like `version`, keeping its id, name, and place, and remove the set;
|
|
59
|
+
* returns the original.
|
|
60
|
+
*/
|
|
61
|
+
use(version: NodeRef): FigmaNodeProxy {
|
|
62
|
+
const node = nodeOf(this.figma.graph, version)
|
|
63
|
+
if (node.parentId !== this.view.section.id) {
|
|
64
|
+
throw new Error(`${node.name} is not one of these variations`)
|
|
65
|
+
}
|
|
66
|
+
assertVariationPickable(this.figma.graph, node.id)
|
|
67
|
+
return this.figma.wrapNode(applyVariation(this.figma.graph, node.id).originalId)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Remove the set and every version in it; the original stays as it is. */
|
|
71
|
+
discard(): void {
|
|
72
|
+
discardVariations(this.figma.graph, this.view.section.id)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
toJSON(): VariationSetInfo {
|
|
76
|
+
const { section, original, versions } = this.view
|
|
77
|
+
return {
|
|
78
|
+
id: section.id,
|
|
79
|
+
original: original ? info(original) : null,
|
|
80
|
+
versions: versions.map(info)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Copy a layer into its set of variations, made beside it the first time. */
|
|
86
|
+
export function createVariationSet(
|
|
87
|
+
figma: FigmaAPI,
|
|
88
|
+
node: NodeRef,
|
|
89
|
+
request: VariationRequest
|
|
90
|
+
): { set: VariationSetHandle; created: FigmaNodeProxy[] } {
|
|
91
|
+
const made = createVariations(figma.graph, nodeOf(figma.graph, node).id, request)
|
|
92
|
+
return {
|
|
93
|
+
set: new VariationSetHandle(figma, made.sectionId),
|
|
94
|
+
created: made.versions.map((version) => figma.wrapNode(version.id))
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** The set a layer belongs to: its section, a version, or a layer inside one; else null. */
|
|
99
|
+
export function getVariationSet(figma: FigmaAPI, node: NodeRef): VariationSetHandle | null {
|
|
100
|
+
const view = variationSetOf(figma.graph, nodeOf(figma.graph, node).id)
|
|
101
|
+
return view ? new VariationSetHandle(figma, view.section.id) : null
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** The sets on a page. */
|
|
105
|
+
export function listVariationSets(figma: FigmaAPI, pageId: string): VariationSetHandle[] {
|
|
106
|
+
return variationSetsOnPage(figma.graph, pageId).map(
|
|
107
|
+
(view) => new VariationSetHandle(figma, view.section.id)
|
|
108
|
+
)
|
|
109
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { PrototypeEasingType } from '@pairdraw/scene-graph'
|
|
2
|
+
import { DEFAULT_PROTOTYPE_EASING, PROTOTYPE_EASING_CURVES } from '@pairdraw/scene-graph/constants'
|
|
3
|
+
|
|
4
|
+
/** Bisection steps that solve a curve's x for its t; 32 halvings are far below a pixel. */
|
|
5
|
+
const BISECTION_STEPS = 32
|
|
6
|
+
|
|
7
|
+
function bezier(t: number, p1: number, p2: number): number {
|
|
8
|
+
return 3 * (1 - t) * (1 - t) * t * p1 + 3 * (1 - t) * t * t * p2 + t * t * t
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* How far along a transition eased by `easing` is at `progress` of its time, from 0 to 1; no
|
|
13
|
+
* easing eases as Figma's default does. The player and a recording both read it, so they move
|
|
14
|
+
* alike.
|
|
15
|
+
*/
|
|
16
|
+
export function easingAt(easing: PrototypeEasingType | undefined, progress: number): number {
|
|
17
|
+
if (progress <= 0) return 0
|
|
18
|
+
if (progress >= 1) return 1
|
|
19
|
+
const [x1, y1, x2, y2] = PROTOTYPE_EASING_CURVES[easing ?? DEFAULT_PROTOTYPE_EASING]
|
|
20
|
+
if (x1 === y1 && x2 === y2) return progress
|
|
21
|
+
// x(t) rises monotonically, so bisection finds the t whose x is `progress`.
|
|
22
|
+
let low = 0
|
|
23
|
+
let high = 1
|
|
24
|
+
for (let index = 0; index < BISECTION_STEPS; index++) {
|
|
25
|
+
const middle = (low + high) / 2
|
|
26
|
+
if (bezier(middle, x1, x2) < progress) low = middle
|
|
27
|
+
else high = middle
|
|
28
|
+
}
|
|
29
|
+
return bezier((low + high) / 2, y1, y2)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** `easing` as a CSS timing function, for a transition the browser animates. */
|
|
33
|
+
export function easingCSS(easing: PrototypeEasingType | undefined): string {
|
|
34
|
+
const [x1, y1, x2, y2] = PROTOTYPE_EASING_CURVES[easing ?? DEFAULT_PROTOTYPE_EASING]
|
|
35
|
+
if (x1 === y1 && x2 === y2) return 'linear'
|
|
36
|
+
return `cubic-bezier(${x1}, ${y1}, ${x2}, ${y2})`
|
|
37
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The frames a navigation can point at: the page's top-level frames, in page order. Figma links to
|
|
5
|
+
* frames and components at the top of the page, not to layers inside them, so the list stays flat.
|
|
6
|
+
*/
|
|
7
|
+
export function framesOnPage(graph: SceneGraph, pageId: string): SceneNode[] {
|
|
8
|
+
return graph.getChildren(pageId).filter((node) => node.type === 'FRAME')
|
|
9
|
+
}
|