@pairdraw/core 0.19.2 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/providers.d.ts +6 -0
- package/dist/ai/providers.d.ts.map +1 -1
- package/dist/ai/providers.js.map +1 -1
- package/dist/cache/resource.d.ts +8 -1
- package/dist/cache/resource.d.ts.map +1 -1
- package/dist/cache/resource.js +18 -0
- package/dist/cache/resource.js.map +1 -1
- package/dist/canvas/effects.d.ts +6 -4
- package/dist/canvas/effects.d.ts.map +1 -1
- package/dist/canvas/effects.js +37 -34
- package/dist/canvas/effects.js.map +1 -1
- package/dist/canvas/fills.d.ts.map +1 -1
- package/dist/canvas/fills.js +12 -8
- package/dist/canvas/fills.js.map +1 -1
- package/dist/canvas/images/adjustments.d.ts +18 -0
- package/dist/canvas/images/adjustments.d.ts.map +1 -0
- package/dist/canvas/images/adjustments.js +184 -0
- package/dist/canvas/images/adjustments.js.map +1 -0
- package/dist/canvas/images/sampling.d.ts +13 -0
- package/dist/canvas/images/sampling.d.ts.map +1 -0
- package/dist/canvas/images/sampling.js +49 -0
- package/dist/canvas/images/sampling.js.map +1 -0
- package/dist/canvas/index.d.ts +2 -2
- package/dist/canvas/masks.d.ts +1 -1
- package/dist/canvas/masks.d.ts.map +1 -1
- package/dist/canvas/masks.js.map +1 -1
- package/dist/canvas/noise/render.d.ts +15 -0
- package/dist/canvas/noise/render.d.ts.map +1 -0
- package/dist/canvas/noise/render.js +56 -0
- package/dist/canvas/noise/render.js.map +1 -0
- package/dist/canvas/noise/shader.d.ts +43 -0
- package/dist/canvas/noise/shader.d.ts.map +1 -0
- package/dist/canvas/noise/shader.js +161 -0
- package/dist/canvas/noise/shader.js.map +1 -0
- package/dist/canvas/noise/table.d.ts +13 -0
- package/dist/canvas/noise/table.d.ts.map +1 -0
- package/dist/canvas/noise/table.js +408 -0
- package/dist/canvas/noise/table.js.map +1 -0
- package/dist/canvas/noise/tile.d.ts +22 -0
- package/dist/canvas/noise/tile.d.ts.map +1 -0
- package/dist/canvas/noise/tile.js +73 -0
- package/dist/canvas/noise/tile.js.map +1 -0
- package/dist/canvas/outline-stroke.js +1 -1
- package/dist/canvas/overlays/auto-layout-hover.d.ts.map +1 -1
- package/dist/canvas/overlays/auto-layout-hover.js +31 -71
- package/dist/canvas/overlays/auto-layout-hover.js.map +1 -1
- package/dist/canvas/renderer/chunks/index.d.ts +1 -1
- package/dist/canvas/renderer/lifecycle.d.ts.map +1 -1
- package/dist/canvas/renderer/lifecycle.js +6 -0
- package/dist/canvas/renderer/lifecycle.js.map +1 -1
- package/dist/canvas/renderer/pipeline.d.ts.map +1 -1
- package/dist/canvas/renderer/pipeline.js +13 -1
- package/dist/canvas/renderer/pipeline.js.map +1 -1
- package/dist/canvas/renderer/play-scenes.d.ts +13 -0
- package/dist/canvas/renderer/play-scenes.d.ts.map +1 -0
- package/dist/canvas/renderer/play-scenes.js +40 -0
- package/dist/canvas/renderer/play-scenes.js.map +1 -0
- package/dist/canvas/renderer/tiles/cache.d.ts +19 -1
- package/dist/canvas/renderer/tiles/cache.d.ts.map +1 -1
- package/dist/canvas/renderer/tiles/cache.js +32 -1
- package/dist/canvas/renderer/tiles/cache.js.map +1 -1
- package/dist/canvas/renderer/tiles/controller.d.ts +11 -0
- package/dist/canvas/renderer/tiles/controller.d.ts.map +1 -1
- package/dist/canvas/renderer/tiles/controller.js +18 -1
- package/dist/canvas/renderer/tiles/controller.js.map +1 -1
- package/dist/canvas/renderer/tiles/index.d.ts +2 -2
- package/dist/canvas/renderer/tiles/planner.d.ts +1 -1
- package/dist/canvas/renderer/types.d.ts +18 -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 +22 -2
- package/dist/canvas/renderer.d.ts.map +1 -1
- package/dist/canvas/renderer.js +29 -1
- package/dist/canvas/renderer.js.map +1 -1
- package/dist/canvas/scene.d.ts +2 -1
- package/dist/canvas/scene.d.ts.map +1 -1
- package/dist/canvas/scene.js +41 -9
- package/dist/canvas/scene.js.map +1 -1
- package/dist/canvas/shadows/silhouette.js +1 -1
- package/dist/canvas/texture.d.ts +20 -0
- package/dist/canvas/texture.d.ts.map +1 -0
- package/dist/canvas/texture.js +100 -0
- package/dist/canvas/texture.js.map +1 -0
- package/dist/clipboard.js +16 -5
- package/dist/clipboard.js.map +1 -1
- package/dist/constants.d.ts +5 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +5 -1
- package/dist/constants.js.map +1 -1
- package/dist/design-jsx/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/bridges/undo.d.ts +1 -1
- package/dist/editor/clipboard/assets.js +1 -1
- package/dist/editor/clipboard/export.d.ts.map +1 -1
- package/dist/editor/clipboard/export.js +16 -2
- package/dist/editor/clipboard/export.js.map +1 -1
- package/dist/editor/clipboard/placement.d.ts +1 -1
- package/dist/editor/clipboard/placement.js +1 -1
- package/dist/editor/components/instances.d.ts +2 -0
- package/dist/editor/components/instances.d.ts.map +1 -1
- package/dist/editor/components/instances.js +22 -1
- package/dist/editor/components/instances.js.map +1 -1
- package/dist/editor/components.d.ts +2 -0
- package/dist/editor/components.d.ts.map +1 -1
- package/dist/editor/connectors/attach.js +1 -1
- package/dist/editor/create.d.ts +27 -3
- 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 +168 -0
- package/dist/editor/eyedropper.js.map +1 -0
- package/dist/editor/fonts.d.ts +9 -0
- package/dist/editor/fonts.d.ts.map +1 -0
- package/dist/editor/fonts.js +14 -0
- package/dist/editor/fonts.js.map +1 -0
- package/dist/editor/history/atomic-tool.d.ts +9 -2
- package/dist/editor/history/atomic-tool.d.ts.map +1 -1
- package/dist/editor/history/atomic-tool.js +6 -0
- package/dist/editor/history/atomic-tool.js.map +1 -1
- package/dist/editor/history/capture.d.ts +13 -0
- package/dist/editor/history/capture.d.ts.map +1 -0
- package/dist/editor/history/capture.js +28 -0
- package/dist/editor/history/capture.js.map +1 -0
- package/dist/editor/history/document-change.d.ts.map +1 -1
- package/dist/editor/history/document-change.js +2 -22
- package/dist/editor/history/document-change.js.map +1 -1
- package/dist/editor/history/edit.d.ts +7 -0
- package/dist/editor/history/edit.d.ts.map +1 -1
- package/dist/editor/history/edit.js +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/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/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/index.d.ts +5 -0
- package/dist/figma-api/index.d.ts.map +1 -1
- package/dist/figma-api/index.js +6 -1
- package/dist/figma-api/index.js.map +1 -1
- package/dist/figma-api/overrides.d.ts +13 -1
- package/dist/figma-api/overrides.d.ts.map +1 -1
- package/dist/figma-api/overrides.js +196 -4
- package/dist/figma-api/overrides.js.map +1 -1
- package/dist/figma-api/paints.d.ts +3 -3
- package/dist/figma-api/paints.d.ts.map +1 -1
- package/dist/figma-api/paints.js +14 -4
- package/dist/figma-api/paints.js.map +1 -1
- package/dist/figma-api/proxy.d.ts +4 -1
- package/dist/figma-api/proxy.d.ts.map +1 -1
- package/dist/figma-api/proxy.js +1 -1
- package/dist/figma-api/proxy.js.map +1 -1
- package/dist/figma-api/reactions.d.ts +41 -13
- package/dist/figma-api/reactions.d.ts.map +1 -1
- package/dist/figma-api/reactions.js +113 -31
- package/dist/figma-api/reactions.js.map +1 -1
- package/dist/figma-api/render-bounds.js +1 -1
- package/dist/figma-api/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/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/decode.js +1 -1
- package/dist/io/formats/design-tokens/index.d.ts +4 -1
- package/dist/io/formats/design-tokens/index.js +4 -1
- package/dist/io/formats/design-tokens/plan/changes.d.ts +5 -3
- package/dist/io/formats/design-tokens/plan/changes.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/plan/changes.js +1 -1
- package/dist/io/formats/design-tokens/plan/changes.js.map +1 -1
- package/dist/io/formats/design-tokens/project.d.ts +17 -2
- package/dist/io/formats/design-tokens/project.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/project.js +29 -8
- package/dist/io/formats/design-tokens/project.js.map +1 -1
- package/dist/io/formats/design-tokens/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/styles.js.map +1 -1
- package/dist/io/formats/design-tokens/sync/apply.d.ts +42 -0
- package/dist/io/formats/design-tokens/sync/apply.d.ts.map +1 -0
- package/dist/io/formats/design-tokens/sync/apply.js +73 -0
- package/dist/io/formats/design-tokens/sync/apply.js.map +1 -0
- package/dist/io/formats/design-tokens/sync/drift.d.ts +77 -0
- package/dist/io/formats/design-tokens/sync/drift.d.ts.map +1 -0
- package/dist/io/formats/design-tokens/sync/drift.js +391 -0
- package/dist/io/formats/design-tokens/sync/drift.js.map +1 -0
- package/dist/io/formats/design-tokens/sync/files.d.ts +15 -0
- package/dist/io/formats/design-tokens/sync/files.d.ts.map +1 -0
- package/dist/io/formats/design-tokens/sync/files.js +35 -0
- package/dist/io/formats/design-tokens/sync/files.js.map +1 -0
- package/dist/io/formats/drawio/edges.d.ts +7 -1
- package/dist/io/formats/drawio/edges.d.ts.map +1 -1
- package/dist/io/formats/drawio/edges.js +54 -1
- package/dist/io/formats/drawio/edges.js.map +1 -1
- package/dist/io/formats/drawio/export.d.ts.map +1 -1
- package/dist/io/formats/drawio/export.js +19 -2
- package/dist/io/formats/drawio/export.js.map +1 -1
- package/dist/io/formats/drawio/index.js +1 -0
- package/dist/io/formats/drawio/index.js.map +1 -1
- package/dist/io/formats/drawio/label.js +1 -1
- package/dist/io/formats/drawio/paint.js +1 -1
- package/dist/io/formats/drawio/placement.d.ts +1 -1
- package/dist/io/formats/fig/export/patch/index.d.ts.map +1 -1
- package/dist/io/formats/fig/export/patch/index.js +5 -0
- package/dist/io/formats/fig/export/patch/index.js.map +1 -1
- package/dist/io/formats/fig/thumbnail-page.d.ts +3 -4
- package/dist/io/formats/fig/thumbnail-page.d.ts.map +1 -1
- package/dist/io/formats/fig/thumbnail-page.js.map +1 -1
- package/dist/io/formats/html/import.d.ts.map +1 -1
- package/dist/io/formats/html/import.js +3 -1
- package/dist/io/formats/html/import.js.map +1 -1
- package/dist/io/formats/html/index.d.ts +2 -2
- package/dist/io/formats/html/index.d.ts.map +1 -1
- package/dist/io/formats/html/index.js +6 -4
- package/dist/io/formats/html/index.js.map +1 -1
- package/dist/io/formats/html/vectors.d.ts +2 -1
- package/dist/io/formats/html/vectors.d.ts.map +1 -1
- package/dist/io/formats/html/vectors.js +3 -2
- package/dist/io/formats/html/vectors.js.map +1 -1
- package/dist/io/formats/mermaid/styles.js +1 -1
- package/dist/io/formats/pdf/document.d.ts +3 -1
- package/dist/io/formats/pdf/document.d.ts.map +1 -1
- package/dist/io/formats/pdf/document.js +6 -3
- package/dist/io/formats/pdf/document.js.map +1 -1
- package/dist/io/formats/pdf/prepare.d.ts +1 -1
- package/dist/io/formats/pen/imports.d.ts +4 -1
- package/dist/io/formats/pen/imports.d.ts.map +1 -1
- package/dist/io/formats/pen/imports.js.map +1 -1
- package/dist/io/formats/pen/index.d.ts.map +1 -1
- package/dist/io/formats/pen/index.js +31 -3
- package/dist/io/formats/pen/index.js.map +1 -1
- package/dist/io/formats/pptx/export.js +1 -1
- package/dist/io/formats/pptx/geometry.d.ts +1 -1
- package/dist/io/formats/raster/adjusted-images.d.ts +15 -0
- package/dist/io/formats/raster/adjusted-images.d.ts.map +1 -0
- package/dist/io/formats/raster/adjusted-images.js +118 -0
- package/dist/io/formats/raster/adjusted-images.js.map +1 -0
- package/dist/io/formats/raster/headless.d.ts +11 -1
- package/dist/io/formats/raster/headless.d.ts.map +1 -1
- package/dist/io/formats/raster/headless.js +4 -4
- package/dist/io/formats/raster/headless.js.map +1 -1
- package/dist/io/formats/raster/index.d.ts +2 -2
- package/dist/io/formats/raster/pixels.d.ts +7 -1
- package/dist/io/formats/raster/pixels.d.ts.map +1 -1
- package/dist/io/formats/raster/pixels.js.map +1 -1
- package/dist/io/formats/raster/render.d.ts.map +1 -1
- package/dist/io/formats/raster/render.js +4 -0
- package/dist/io/formats/raster/render.js.map +1 -1
- package/dist/io/formats/svg/defs.d.ts +5 -6
- package/dist/io/formats/svg/defs.d.ts.map +1 -1
- package/dist/io/formats/svg/defs.js +1 -53
- package/dist/io/formats/svg/defs.js.map +1 -1
- package/dist/io/formats/svg/effects.d.ts +16 -0
- package/dist/io/formats/svg/effects.d.ts.map +1 -0
- package/dist/io/formats/svg/effects.js +126 -0
- package/dist/io/formats/svg/effects.js.map +1 -0
- package/dist/io/formats/svg/export.d.ts +7 -1
- package/dist/io/formats/svg/export.d.ts.map +1 -1
- package/dist/io/formats/svg/export.js +174 -36
- package/dist/io/formats/svg/export.js.map +1 -1
- package/dist/io/formats/svg/filter.d.ts +27 -0
- package/dist/io/formats/svg/filter.d.ts.map +1 -0
- package/dist/io/formats/svg/filter.js +44 -0
- package/dist/io/formats/svg/filter.js.map +1 -0
- package/dist/io/formats/svg/grain.d.ts +26 -0
- package/dist/io/formats/svg/grain.d.ts.map +1 -0
- package/dist/io/formats/svg/grain.js +298 -0
- package/dist/io/formats/svg/grain.js.map +1 -0
- package/dist/io/formats/svg/strokes.d.ts +1 -1
- package/dist/io/formats/svg/strokes.d.ts.map +1 -1
- package/dist/io/formats/svg/strokes.js +1 -2
- package/dist/io/formats/svg/strokes.js.map +1 -1
- package/dist/io/formats/svg/text/import.js +1 -1
- package/dist/io/formats/svg/text/layout.d.ts +5 -2
- package/dist/io/formats/svg/text/layout.d.ts.map +1 -1
- package/dist/io/formats/svg/text/layout.js +6 -3
- package/dist/io/formats/svg/text/layout.js.map +1 -1
- package/dist/io/formats/video/composite.d.ts +18 -0
- package/dist/io/formats/video/composite.d.ts.map +1 -0
- package/dist/io/formats/video/composite.js +79 -0
- package/dist/io/formats/video/composite.js.map +1 -0
- package/dist/io/formats/video/formats.d.ts +29 -0
- package/dist/io/formats/video/formats.d.ts.map +1 -0
- package/dist/io/formats/video/formats.js +43 -0
- package/dist/io/formats/video/formats.js.map +1 -0
- package/dist/io/formats/video/gif.d.ts +13 -0
- package/dist/io/formats/video/gif.d.ts.map +1 -0
- package/dist/io/formats/video/gif.js +56 -0
- package/dist/io/formats/video/gif.js.map +1 -0
- package/dist/io/formats/video/index.d.ts +9 -0
- package/dist/io/formats/video/index.js +9 -0
- package/dist/io/formats/video/plan.d.ts +64 -0
- package/dist/io/formats/video/plan.d.ts.map +1 -0
- package/dist/io/formats/video/plan.js +90 -0
- package/dist/io/formats/video/plan.js.map +1 -0
- package/dist/io/formats/video/record.d.ts +36 -0
- package/dist/io/formats/video/record.d.ts.map +1 -0
- package/dist/io/formats/video/record.js +154 -0
- package/dist/io/formats/video/record.js.map +1 -0
- package/dist/io/formats/video/sink.d.ts +29 -0
- package/dist/io/formats/video/sink.d.ts.map +1 -0
- package/dist/io/formats/video/sink.js +16 -0
- package/dist/io/formats/video/sink.js.map +1 -0
- package/dist/io/formats/video/size.d.ts +19 -0
- package/dist/io/formats/video/size.d.ts.map +1 -0
- package/dist/io/formats/video/size.js +26 -0
- package/dist/io/formats/video/size.js.map +1 -0
- package/dist/io/formats/video/webcodecs.d.ts +18 -0
- package/dist/io/formats/video/webcodecs.d.ts.map +1 -0
- package/dist/io/formats/video/webcodecs.js +74 -0
- package/dist/io/formats/video/webcodecs.js.map +1 -0
- package/dist/io/formats.d.ts.map +1 -1
- package/dist/io/formats.js +40 -11
- package/dist/io/formats.js.map +1 -1
- package/dist/io/types.d.ts +19 -4
- package/dist/io/types.d.ts.map +1 -1
- package/dist/kiwi/fig/parse/transfer.d.ts +1 -1
- package/dist/layout/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.d.ts +3 -2
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +2 -1
- package/dist/layout.js.map +1 -1
- package/dist/lint/fixes.d.ts.map +1 -1
- package/dist/lint/fixes.js +9 -3
- package/dist/lint/fixes.js.map +1 -1
- package/dist/lint/index.d.ts +3 -2
- package/dist/lint/index.js +2 -1
- package/dist/lint/linter.d.ts +12 -0
- package/dist/lint/linter.d.ts.map +1 -1
- package/dist/lint/linter.js +110 -8
- 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/design-memory.d.ts +19 -0
- package/dist/pairdraw-api/design-memory.d.ts.map +1 -0
- package/dist/pairdraw-api/design-memory.js +39 -0
- package/dist/pairdraw-api/design-memory.js.map +1 -0
- package/dist/pairdraw-api/index.d.ts +45 -1
- package/dist/pairdraw-api/index.d.ts.map +1 -1
- package/dist/pairdraw-api/index.js +55 -2
- package/dist/pairdraw-api/index.js.map +1 -1
- package/dist/pairdraw-api/nodes.d.ts +12 -1
- package/dist/pairdraw-api/nodes.d.ts.map +1 -1
- package/dist/pairdraw-api/nodes.js +28 -1
- package/dist/pairdraw-api/nodes.js.map +1 -1
- package/dist/pairdraw-api/variations.d.ts +48 -0
- package/dist/pairdraw-api/variations.d.ts.map +1 -0
- package/dist/pairdraw-api/variations.js +76 -0
- package/dist/pairdraw-api/variations.js.map +1 -0
- package/dist/prototype/easing.d.ts +13 -0
- package/dist/prototype/easing.d.ts.map +1 -0
- package/dist/prototype/easing.js +36 -0
- package/dist/prototype/easing.js.map +1 -0
- package/dist/prototype/frames.d.ts +10 -0
- package/dist/prototype/frames.d.ts.map +1 -0
- package/dist/prototype/frames.js +12 -0
- package/dist/prototype/frames.js.map +1 -0
- package/dist/prototype/hit.d.ts +17 -0
- package/dist/prototype/hit.d.ts.map +1 -0
- package/dist/prototype/hit.js +45 -0
- package/dist/prototype/hit.js.map +1 -0
- package/dist/prototype/index.d.ts +14 -0
- package/dist/prototype/index.js +14 -0
- package/dist/prototype/pointer.d.ts +63 -0
- package/dist/prototype/pointer.d.ts.map +1 -0
- package/dist/prototype/pointer.js +104 -0
- package/dist/prototype/pointer.js.map +1 -0
- package/dist/prototype/reactions.d.ts +45 -0
- package/dist/prototype/reactions.d.ts.map +1 -0
- package/dist/prototype/reactions.js +122 -0
- package/dist/prototype/reactions.js.map +1 -0
- package/dist/prototype/scene.d.ts +35 -0
- package/dist/prototype/scene.d.ts.map +1 -0
- package/dist/prototype/scene.js +86 -0
- package/dist/prototype/scene.js.map +1 -0
- package/dist/prototype/scenes.d.ts +81 -0
- package/dist/prototype/scenes.d.ts.map +1 -0
- package/dist/prototype/scenes.js +175 -0
- package/dist/prototype/scenes.js.map +1 -0
- package/dist/prototype/scroll.d.ts +48 -0
- package/dist/prototype/scroll.d.ts.map +1 -0
- package/dist/prototype/scroll.js +159 -0
- package/dist/prototype/scroll.js.map +1 -0
- package/dist/prototype/session.d.ts +71 -0
- package/dist/prototype/session.d.ts.map +1 -0
- package/dist/prototype/session.js +135 -0
- package/dist/prototype/session.js.map +1 -0
- package/dist/prototype/smart-animate/animation.d.ts +34 -0
- package/dist/prototype/smart-animate/animation.d.ts.map +1 -0
- package/dist/prototype/smart-animate/animation.js +212 -0
- package/dist/prototype/smart-animate/animation.js.map +1 -0
- package/dist/prototype/smart-animate/match.d.ts +24 -0
- package/dist/prototype/smart-animate/match.d.ts.map +1 -0
- package/dist/prototype/smart-animate/match.js +72 -0
- package/dist/prototype/smart-animate/match.js.map +1 -0
- package/dist/prototype/snapshot.d.ts +19 -0
- package/dist/prototype/snapshot.d.ts.map +1 -0
- package/dist/prototype/snapshot.js +56 -0
- package/dist/prototype/snapshot.js.map +1 -0
- package/dist/prototype/timeline.d.ts +132 -0
- package/dist/prototype/timeline.d.ts.map +1 -0
- package/dist/prototype/timeline.js +260 -0
- package/dist/prototype/timeline.js.map +1 -0
- package/dist/rpc/read-commands.js +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/index.d.ts +10 -8
- package/dist/text/index.js +3 -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/responsive/index.d.ts +15 -0
- package/dist/tools/analyze/responsive/index.d.ts.map +1 -0
- package/dist/tools/analyze/responsive/index.js +203 -0
- package/dist/tools/analyze/responsive/index.js.map +1 -0
- package/dist/tools/analyze.d.ts +2 -1
- package/dist/tools/analyze.js +2 -1
- package/dist/tools/codegen/token-sync.d.ts +7 -0
- package/dist/tools/codegen/token-sync.d.ts.map +1 -0
- package/dist/tools/codegen/token-sync.js +85 -0
- package/dist/tools/codegen/token-sync.js.map +1 -0
- package/dist/tools/codegen/tokens.d.ts +1 -1
- package/dist/tools/codegen.d.ts +2 -1
- package/dist/tools/codegen.js +2 -1
- package/dist/tools/create/basic.js +1 -1
- package/dist/tools/create/behaviours.js +1 -1
- package/dist/tools/create/components.d.ts.map +1 -1
- package/dist/tools/create/components.js +4 -0
- package/dist/tools/create/components.js.map +1 -1
- package/dist/tools/create/html.js +3 -2
- package/dist/tools/create/html.js.map +1 -1
- package/dist/tools/create/icons.d.ts.map +1 -1
- package/dist/tools/create/icons.js +2 -1
- package/dist/tools/create/icons.js.map +1 -1
- package/dist/tools/create/mermaid.js +2 -1
- package/dist/tools/create/mermaid.js.map +1 -1
- package/dist/tools/create/render.js +1 -1
- package/dist/tools/create/svg.js +2 -1
- package/dist/tools/create/svg.js.map +1 -1
- package/dist/tools/create/vector.js +1 -1
- package/dist/tools/design-memory.d.ts +8 -0
- package/dist/tools/design-memory.d.ts.map +1 -0
- package/dist/tools/design-memory.js +68 -0
- package/dist/tools/design-memory.js.map +1 -0
- package/dist/tools/image-ai/generate.d.ts.map +1 -1
- package/dist/tools/image-ai/generate.js +3 -1
- package/dist/tools/image-ai/generate.js.map +1 -1
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.js +2 -1
- package/dist/tools/modify/fonts.d.ts +6 -0
- package/dist/tools/modify/fonts.d.ts.map +1 -0
- package/dist/tools/modify/fonts.js +27 -0
- package/dist/tools/modify/fonts.js.map +1 -0
- package/dist/tools/modify/paint.js +1 -1
- package/dist/tools/modify/reactions.d.ts.map +1 -1
- package/dist/tools/modify/reactions.js +3 -3
- package/dist/tools/modify/reactions.js.map +1 -1
- package/dist/tools/modify/text.d.ts.map +1 -1
- package/dist/tools/modify/text.js +26 -5
- package/dist/tools/modify/text.js.map +1 -1
- package/dist/tools/modify/update.d.ts +10 -1
- package/dist/tools/modify/update.d.ts.map +1 -1
- package/dist/tools/modify/update.js +34 -3
- package/dist/tools/modify/update.js.map +1 -1
- package/dist/tools/modify.d.ts +2 -1
- package/dist/tools/modify.js +2 -1
- package/dist/tools/read/fonts.d.ts.map +1 -1
- package/dist/tools/read/fonts.js +17 -2
- package/dist/tools/read/fonts.js.map +1 -1
- package/dist/tools/read/libraries.js +2 -1
- package/dist/tools/read/libraries.js.map +1 -1
- package/dist/tools/read/space.d.ts +3 -1
- package/dist/tools/read/space.d.ts.map +1 -1
- package/dist/tools/read/space.js +4 -3
- package/dist/tools/read/space.js.map +1 -1
- package/dist/tools/registry/core.d.ts +1 -1
- package/dist/tools/registry/core.d.ts.map +1 -1
- package/dist/tools/registry/core.js +3 -1
- package/dist/tools/registry/core.js.map +1 -1
- package/dist/tools/registry/extended.d.ts.map +1 -1
- package/dist/tools/registry/extended.js +16 -1
- package/dist/tools/registry/extended.js.map +1 -1
- package/dist/tools/schema.d.ts +18 -2
- package/dist/tools/schema.d.ts.map +1 -1
- package/dist/tools/schema.js +1 -1
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/stock-photo.js +1 -0
- package/dist/tools/stock-photo.js.map +1 -1
- package/dist/tools/structure/basic.d.ts.map +1 -1
- package/dist/tools/structure/basic.js +1 -0
- package/dist/tools/structure/basic.js.map +1 -1
- package/dist/tools/structure/batch.d.ts.map +1 -1
- package/dist/tools/structure/batch.js +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/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.js +1 -0
- package/dist/tools/vector/vectorize.js.map +1 -1
- package/dist/tools/vector/video.d.ts +6 -0
- package/dist/tools/vector/video.d.ts.map +1 -0
- package/dist/tools/vector/video.js +133 -0
- package/dist/tools/vector/video.js.map +1 -0
- package/dist/tools/vector.d.ts +2 -1
- package/dist/tools/vector.js +2 -1
- package/dist/tools/video-host.d.ts +12 -0
- package/dist/tools/video-host.d.ts.map +1 -0
- package/dist/tools/video-host.js +19 -0
- package/dist/tools/video-host.js.map +1 -0
- package/dist/vector/point-transform.d.ts +1 -1
- package/dist/vector/vectorize/svg/to-vectors.d.ts +1 -1
- package/package.json +31 -9
- package/src/ai/providers.ts +2 -0
- package/src/cache/resource.ts +24 -1
- package/src/canvas/effects.ts +47 -50
- package/src/canvas/fills.ts +19 -15
- package/src/canvas/images/adjustments.ts +203 -0
- package/src/canvas/images/sampling.ts +88 -0
- package/src/canvas/index.ts +1 -0
- package/src/canvas/masks.ts +1 -1
- package/src/canvas/noise/render.ts +75 -0
- package/src/canvas/noise/shader.ts +161 -0
- package/src/canvas/noise/table.ts +91 -0
- package/src/canvas/noise/tile.ts +94 -0
- package/src/canvas/overlays/auto-layout-hover.ts +47 -65
- package/src/canvas/renderer/lifecycle.ts +6 -0
- package/src/canvas/renderer/pipeline.ts +19 -1
- package/src/canvas/renderer/play-scenes.ts +51 -0
- package/src/canvas/renderer/tiles/cache.ts +54 -1
- package/src/canvas/renderer/tiles/controller.ts +30 -1
- package/src/canvas/renderer/types.ts +18 -2
- package/src/canvas/renderer.ts +40 -3
- package/src/canvas/scene.ts +65 -9
- package/src/canvas/texture.ts +136 -0
- package/src/clipboard.ts +23 -10
- package/src/constants.ts +6 -0
- package/src/design-memory/check.ts +376 -0
- package/src/design-memory/describe.ts +77 -0
- package/src/design-memory/distil.ts +69 -0
- package/src/design-memory/document.ts +80 -0
- package/src/design-memory/guard.ts +157 -0
- package/src/design-memory/index.ts +8 -0
- package/src/design-memory/refusal.ts +90 -0
- package/src/design-memory/rules.ts +274 -0
- package/src/design-memory/values.ts +179 -0
- package/src/editor/bridges/components.ts +2 -0
- package/src/editor/clipboard/export.ts +24 -7
- package/src/editor/components/instances.ts +31 -0
- 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 +198 -0
- package/src/editor/fonts.ts +19 -0
- package/src/editor/history/atomic-tool.ts +29 -1
- package/src/editor/history/capture.ts +19 -0
- package/src/editor/history/document-change.ts +5 -17
- package/src/editor/history/edit.ts +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/tool-registry.ts +2 -1
- package/src/editor/types.ts +4 -0
- 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/index.ts +10 -0
- package/src/figma-api/overrides.ts +295 -3
- package/src/figma-api/paints.ts +24 -9
- package/src/figma-api/proxy.ts +6 -1
- package/src/figma-api/reactions.ts +130 -32
- package/src/figma-api/surface.ts +6 -2
- package/src/global.d.ts +26 -0
- package/src/io/formats/boolean-path.ts +60 -0
- package/src/io/formats/design-tokens/index.ts +21 -0
- package/src/io/formats/design-tokens/plan/changes.ts +4 -1
- package/src/io/formats/design-tokens/project.ts +40 -9
- package/src/io/formats/design-tokens/styles.ts +10 -2
- package/src/io/formats/design-tokens/sync/apply.ts +130 -0
- package/src/io/formats/design-tokens/sync/drift.ts +587 -0
- package/src/io/formats/design-tokens/sync/files.ts +40 -0
- package/src/io/formats/drawio/edges.ts +65 -0
- package/src/io/formats/drawio/export.ts +37 -14
- package/src/io/formats/drawio/index.ts +2 -0
- package/src/io/formats/fig/export/patch/index.ts +8 -0
- package/src/io/formats/fig/thumbnail-page.ts +4 -4
- package/src/io/formats/html/import.ts +9 -1
- package/src/io/formats/html/index.ts +14 -7
- package/src/io/formats/html/vectors.ts +8 -2
- package/src/io/formats/pdf/document.ts +14 -4
- package/src/io/formats/pen/imports.ts +5 -6
- package/src/io/formats/pen/index.ts +36 -5
- package/src/io/formats/raster/adjusted-images.ts +125 -0
- package/src/io/formats/raster/headless.ts +3 -3
- package/src/io/formats/raster/index.ts +6 -1
- package/src/io/formats/raster/pixels.ts +7 -0
- package/src/io/formats/raster/render.ts +12 -1
- package/src/io/formats/svg/defs.ts +4 -72
- package/src/io/formats/svg/effects.ts +131 -0
- package/src/io/formats/svg/export.ts +278 -46
- package/src/io/formats/svg/filter.ts +47 -0
- package/src/io/formats/svg/grain.ts +249 -0
- package/src/io/formats/svg/strokes.ts +2 -2
- package/src/io/formats/svg/text/layout.ts +13 -3
- package/src/io/formats/video/composite.ts +79 -0
- package/src/io/formats/video/formats.ts +77 -0
- package/src/io/formats/video/gif.ts +65 -0
- package/src/io/formats/video/index.ts +30 -0
- package/src/io/formats/video/plan.ts +116 -0
- package/src/io/formats/video/record.ts +227 -0
- package/src/io/formats/video/sink.ts +32 -0
- package/src/io/formats/video/size.ts +25 -0
- package/src/io/formats/video/webcodecs.ts +89 -0
- package/src/io/formats.ts +59 -11
- package/src/io/types.ts +29 -10
- package/src/layout/auto-layout-handles.ts +396 -0
- package/src/layout.ts +2 -0
- package/src/lint/fixes.ts +12 -3
- package/src/lint/index.ts +3 -1
- package/src/lint/linter.ts +107 -10
- 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/design-memory.ts +61 -0
- package/src/pairdraw-api/index.ts +81 -0
- package/src/pairdraw-api/nodes.ts +38 -0
- package/src/pairdraw-api/variations.ts +109 -0
- package/src/prototype/easing.ts +37 -0
- package/src/prototype/frames.ts +9 -0
- package/src/prototype/hit.ts +70 -0
- package/src/prototype/index.ts +69 -0
- package/src/prototype/pointer.ts +146 -0
- package/src/prototype/reactions.ts +178 -0
- package/src/prototype/scene.ts +116 -0
- package/src/prototype/scenes.ts +256 -0
- package/src/prototype/scroll.ts +190 -0
- package/src/prototype/session.ts +188 -0
- package/src/prototype/smart-animate/animation.ts +267 -0
- package/src/prototype/smart-animate/match.ts +85 -0
- package/src/prototype/snapshot.ts +60 -0
- package/src/prototype/timeline.ts +400 -0
- package/src/text/font/features.ts +27 -0
- package/src/text/font/manager.ts +79 -1
- package/src/text/index.ts +2 -0
- package/src/text/replace-fonts.ts +171 -0
- package/src/tools/analyze/responsive/index.ts +264 -0
- package/src/tools/analyze.ts +2 -0
- package/src/tools/codegen/token-sync.ts +98 -0
- package/src/tools/codegen.ts +1 -0
- package/src/tools/create/components.ts +4 -0
- package/src/tools/create/html.ts +1 -0
- package/src/tools/create/icons.ts +1 -0
- package/src/tools/create/mermaid.ts +1 -0
- package/src/tools/create/svg.ts +1 -0
- package/src/tools/design-memory.ts +72 -0
- package/src/tools/image-ai/generate.ts +2 -0
- package/src/tools/index.ts +1 -0
- package/src/tools/modify/fonts.ts +34 -0
- package/src/tools/modify/reactions.ts +15 -8
- package/src/tools/modify/text.ts +42 -5
- package/src/tools/modify/update.ts +46 -2
- package/src/tools/modify.ts +1 -0
- package/src/tools/read/fonts.ts +24 -2
- package/src/tools/read/libraries.ts +1 -0
- package/src/tools/read/space.ts +3 -2
- package/src/tools/registry/core.ts +3 -1
- package/src/tools/registry/extended.ts +28 -1
- package/src/tools/schema.ts +28 -4
- package/src/tools/stock-photo.ts +1 -0
- package/src/tools/structure/basic.ts +1 -0
- package/src/tools/structure/batch.ts +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/vector/boolean.ts +4 -0
- package/src/tools/vector/vectorize.ts +1 -0
- package/src/tools/vector/video.ts +228 -0
- package/src/tools/vector.ts +1 -0
- package/src/tools/video-host.ts +18 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as v from 'valibot'
|
|
2
|
+
|
|
3
|
+
import { PairdrawAPI } from '#core/pairdraw-api'
|
|
4
|
+
import { defineTool, toolFailure } from '#core/tools/schema'
|
|
5
|
+
|
|
6
|
+
function valuesInput<T extends v.GenericSchema>(description: string, value: T) {
|
|
7
|
+
return v.optional(v.pipe(v.array(value), v.maxLength(64), v.description(description)))
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const getDesignMemory = defineTool({
|
|
11
|
+
name: 'get_design_memory',
|
|
12
|
+
description:
|
|
13
|
+
'Read the document’s design memory before you design in it: the colors, fonts, font sizes, ' +
|
|
14
|
+
'spacing and corner radii it allows (its variables and styles plus values the person added), ' +
|
|
15
|
+
'whether an edit with another value is refused or warned about, the decisions written down, ' +
|
|
16
|
+
'and frames pinned as examples to follow (read them with get_jsx or export_image). ' +
|
|
17
|
+
'Returns null when the document has none.',
|
|
18
|
+
execution: { kind: 'sync', mutation: 'none' },
|
|
19
|
+
input: v.strictObject({}),
|
|
20
|
+
execute: (figma) => ({ design_memory: new PairdrawAPI(figma).designMemory })
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
export const checkDesignValuesTool = defineTool({
|
|
24
|
+
name: 'check_design_values',
|
|
25
|
+
description:
|
|
26
|
+
'Check values against the document’s design memory before you use them: each comes back ' +
|
|
27
|
+
'ok, warn (allowed with a warning), refuse (an edit using it is undone) or invalid, with the ' +
|
|
28
|
+
'nearest allowed value and the variable that holds it.',
|
|
29
|
+
execution: { kind: 'sync', mutation: 'none' },
|
|
30
|
+
input: v.strictObject({
|
|
31
|
+
colors: valuesInput('CSS colors, such as #1A73E8', v.string()),
|
|
32
|
+
fonts: valuesInput('Font families', v.string()),
|
|
33
|
+
font_sizes: valuesInput('Font sizes in px', v.number()),
|
|
34
|
+
spacing: valuesInput('Gaps and padding in px', v.number()),
|
|
35
|
+
radius: valuesInput('Corner radii in px', v.number())
|
|
36
|
+
}),
|
|
37
|
+
execute: (figma, { colors, fonts, font_sizes, spacing, radius }) => {
|
|
38
|
+
try {
|
|
39
|
+
const verdicts = new PairdrawAPI(figma).checkDesignValues({
|
|
40
|
+
colors,
|
|
41
|
+
fonts,
|
|
42
|
+
fontSizes: font_sizes,
|
|
43
|
+
spacing,
|
|
44
|
+
radius
|
|
45
|
+
})
|
|
46
|
+
return { verdicts }
|
|
47
|
+
} catch (error) {
|
|
48
|
+
return toolFailure(error)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
export const recordDesignDecisionTool = defineTool({
|
|
54
|
+
name: 'record_design_decision',
|
|
55
|
+
description:
|
|
56
|
+
'Write a design decision down in the document’s design memory, such as “Cards use 16 px ' +
|
|
57
|
+
'padding and the Surface/Raised color”, so later work follows it; optionally pin a frame ' +
|
|
58
|
+
'that shows it as an example. It cannot change which values the memory allows: only the ' +
|
|
59
|
+
'person can.',
|
|
60
|
+
execution: { kind: 'sync', mutation: 'document' },
|
|
61
|
+
input: v.strictObject({
|
|
62
|
+
text: v.pipe(v.string(), v.description('The decision, at most 400 characters')),
|
|
63
|
+
example_node_id: v.optional(v.pipe(v.string(), v.description('A layer that shows it')))
|
|
64
|
+
}),
|
|
65
|
+
execute: (figma, { text, example_node_id }) => {
|
|
66
|
+
try {
|
|
67
|
+
return new PairdrawAPI(figma).recordDesignDecision(text, example_node_id)
|
|
68
|
+
} catch (error) {
|
|
69
|
+
return toolFailure(error)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
})
|
|
@@ -99,6 +99,7 @@ export const generateImage = defineTool({
|
|
|
99
99
|
description:
|
|
100
100
|
'Generate an image from a text prompt with the image service the user set up in Settings → Image services (BYOK). With id, the image fills that layer: it replaces the image the layer shows, or goes on top of its fills. Without id, it becomes a new rectangle layer at the image’s size (or the given width), beside the parent’s content unless x and y are given. It sends the prompt to that service with the user’s own key, costs them money, and takes a while, so call it only when the user asks for a generated image; prefer stock_photo for ordinary photography.',
|
|
101
101
|
execution: { kind: 'async', mutation: 'document' },
|
|
102
|
+
content: 'imported',
|
|
102
103
|
capabilities: ['document:write', 'network:access'],
|
|
103
104
|
input: v.strictObject({
|
|
104
105
|
prompt: promptInput('What the image shows, its style, and its mood, in English'),
|
|
@@ -163,6 +164,7 @@ export const generateSVG = defineTool({
|
|
|
163
164
|
description:
|
|
164
165
|
'Generate an illustration, icon, or logo mark from a text prompt as SVG with the vectorize service the user set up in Settings → Image services, and import it as editable vector layers, as import_svg does. The new frame goes beside the parent’s content unless x and y are given. It uses the user’s own key and takes a while, so call it only when the user asks for generated vector art; use insert_icon for standard icons.',
|
|
165
166
|
execution: { kind: 'async', mutation: 'document' },
|
|
167
|
+
content: 'imported',
|
|
166
168
|
capabilities: ['document:write', 'network:access'],
|
|
167
169
|
input: v.strictObject({
|
|
168
170
|
prompt: promptInput('What the artwork shows and its style, in English'),
|
package/src/tools/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ export type {
|
|
|
7
7
|
ComponentCatalogLibraryAsset
|
|
8
8
|
} from './component-catalog'
|
|
9
9
|
export { getHTMLToolHost, registerHTMLToolHost, type HTMLToolHost } from './html-host'
|
|
10
|
+
export { getVideoEncoder, registerVideoEncoder } from './video-host'
|
|
10
11
|
export { getScriptToolHost, registerScriptToolHost, type ScriptToolHost } from './script/host'
|
|
11
12
|
export { SCRIPT_EXAMPLES, type ScriptExampleName } from './script/examples'
|
|
12
13
|
export { ALL_TOOLS, CORE_TOOLS, EXTENDED_TOOLS } from './registry'
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as v from 'valibot'
|
|
2
|
+
|
|
3
|
+
import { replaceDocumentFonts } from '#core/text/replace-fonts'
|
|
4
|
+
import { defineTool } from '#core/tools/schema'
|
|
5
|
+
|
|
6
|
+
const faceInputSchema = v.strictObject({
|
|
7
|
+
family: v.pipe(v.string(), v.description('Font family, as list_fonts or a text node names it')),
|
|
8
|
+
style: v.pipe(v.string(), v.description('Face style, such as "Regular" or "Semi Bold"'))
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
const replacementInputSchema = v.strictObject({
|
|
12
|
+
from: faceInputSchema,
|
|
13
|
+
to: faceInputSchema
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export const replaceFonts = defineTool({
|
|
17
|
+
name: 'replace_fonts',
|
|
18
|
+
description:
|
|
19
|
+
'Replace font faces everywhere in the document: text layers, character runs, and text ' +
|
|
20
|
+
'styles. Other faces keep their runs. One undoable step. Run list_fonts with scope ' +
|
|
21
|
+
'"document" first to see the faces in use and which are missing.',
|
|
22
|
+
execution: { kind: 'sync', mutation: 'document' },
|
|
23
|
+
exposure: { webmcp: false },
|
|
24
|
+
input: v.strictObject({
|
|
25
|
+
replacements: v.pipe(
|
|
26
|
+
v.array(replacementInputSchema),
|
|
27
|
+
v.minLength(1),
|
|
28
|
+
v.description(
|
|
29
|
+
'Faces to swap, each { from: { family, style }, to: { family, style } }. A source face may appear once.'
|
|
30
|
+
)
|
|
31
|
+
)
|
|
32
|
+
}),
|
|
33
|
+
execute: (figma, args) => replaceDocumentFonts(figma.graph, args.replacements)
|
|
34
|
+
})
|
|
@@ -7,11 +7,18 @@ import { defineTool, nodeIdInputSchema, nodeNotFound, toolFailure } from '#core/
|
|
|
7
7
|
const reactionsInputSchema = v.pipe(
|
|
8
8
|
figmaReactionsSchema,
|
|
9
9
|
v.description(
|
|
10
|
-
"Prototype connections in Figma's plugin shape: [{ trigger: { type: 'ON_CLICK'
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"'
|
|
14
|
-
"
|
|
10
|
+
"Prototype connections in Figma's plugin shape: [{ trigger: { type: 'ON_CLICK' | " +
|
|
11
|
+
"'ON_HOVER' | 'ON_PRESS' } | { type: 'MOUSE_ENTER' | 'MOUSE_LEAVE', delay?: seconds } | " +
|
|
12
|
+
"{ type: 'AFTER_TIMEOUT', timeout: seconds }, actions: [{ type: 'NODE', destinationId, " +
|
|
13
|
+
"navigation: 'NAVIGATE' | 'OVERLAY' | 'CHANGE_TO' | 'SCROLL_TO', transition: { type: " +
|
|
14
|
+
"'INSTANT' | 'DISSOLVE' | 'SMART_ANIMATE', duration: seconds, easing?: { type: 'EASE_OUT' | " +
|
|
15
|
+
"'EASE_IN' | 'EASE_IN_AND_OUT' | 'LINEAR' } }, overlayRelativePosition?: 'CENTER' | ... } | " +
|
|
16
|
+
"{ type: 'BACK' } | { type: 'CLOSE' }] }]. NAVIGATE and OVERLAY point at a top-level frame " +
|
|
17
|
+
'on the same page; CHANGE_TO at another variant of the set the layer is a variant of, an ' +
|
|
18
|
+
'instance of, or inside (set it once on the main component variant and every instance ' +
|
|
19
|
+
"gets it); SCROLL_TO at a layer in the layer's top-level frame. ON_HOVER and ON_PRESS undo " +
|
|
20
|
+
'their action when the pointer leaves or lifts. SMART_ANIMATE moves the layers two frames or ' +
|
|
21
|
+
'variants share by name and place, and fades the rest; easing defaults to EASE_OUT.'
|
|
15
22
|
)
|
|
16
23
|
)
|
|
17
24
|
|
|
@@ -19,9 +26,9 @@ export const setReactions = defineTool({
|
|
|
19
26
|
name: 'set_reactions',
|
|
20
27
|
|
|
21
28
|
description:
|
|
22
|
-
'Replace the prototype connections on a layer. Use get_reactions to read them back
|
|
23
|
-
'
|
|
24
|
-
'
|
|
29
|
+
'Replace the prototype connections on a layer. Use get_reactions to read them back. ' +
|
|
30
|
+
'Refuses a trigger, action, transition, navigation or destination the prototype play ' +
|
|
31
|
+
'cannot run. Set overflow scrolling with update_node overflow_direction.',
|
|
25
32
|
execution: { kind: 'sync', mutation: 'properties' },
|
|
26
33
|
input: v.strictObject({
|
|
27
34
|
id: nodeIdInputSchema,
|
package/src/tools/modify/text.ts
CHANGED
|
@@ -102,6 +102,27 @@ const variationsInputSchema = v.optional(
|
|
|
102
102
|
)
|
|
103
103
|
)
|
|
104
104
|
|
|
105
|
+
/** OpenType features a text tool sets, by tag; tags left out keep their state. */
|
|
106
|
+
const fontFeaturesInputSchema = v.optional(
|
|
107
|
+
v.pipe(
|
|
108
|
+
v.objectWithRest({}, v.boolean()),
|
|
109
|
+
v.description(
|
|
110
|
+
'OpenType feature toggles by four-letter tag (e.g. {"TNUM": true, "LIGA": false, "SS02": true}); tags left out keep their state. Only features the font has take effect.'
|
|
111
|
+
)
|
|
112
|
+
)
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
/** Why a feature map cannot apply: a tag is not four letters, or a value is not a boolean. */
|
|
116
|
+
function badFeatureEntry(features: Record<string, boolean> | undefined): { error: string } | null {
|
|
117
|
+
for (const [tag, enabled] of Object.entries(features ?? {})) {
|
|
118
|
+
if (tag.length !== 4) return { error: `"${tag}" is not a four-letter OpenType feature tag` }
|
|
119
|
+
if (typeof enabled !== 'boolean') {
|
|
120
|
+
return { error: `Feature "${tag}" needs a boolean value, received ${typeof enabled}` }
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return null
|
|
124
|
+
}
|
|
125
|
+
|
|
105
126
|
/**
|
|
106
127
|
* The font a font tool gives text: what it names, the rest from `current`. Axes without a style
|
|
107
128
|
* leave the style out, for the nearest named style to be picked.
|
|
@@ -207,6 +228,7 @@ function rangeEdit(args: {
|
|
|
207
228
|
size?: number
|
|
208
229
|
style?: string
|
|
209
230
|
variations?: unknown
|
|
231
|
+
font_features?: Record<string, boolean>
|
|
210
232
|
color?: string
|
|
211
233
|
hyperlink?: string | null
|
|
212
234
|
}): RangeEdit | { error: string } {
|
|
@@ -215,12 +237,13 @@ function rangeEdit(args: {
|
|
|
215
237
|
!args.size &&
|
|
216
238
|
!args.style &&
|
|
217
239
|
!args.variations &&
|
|
240
|
+
!args.font_features &&
|
|
218
241
|
!args.color &&
|
|
219
242
|
args.hyperlink === undefined
|
|
220
243
|
) {
|
|
221
244
|
return {
|
|
222
245
|
error:
|
|
223
|
-
'set_font_range needs at least one of family, size, style, variations, color, or hyperlink'
|
|
246
|
+
'set_font_range needs at least one of family, size, style, variations, font_features, color, or hyperlink'
|
|
224
247
|
}
|
|
225
248
|
}
|
|
226
249
|
const hyperlink = requestedHyperlink(args.hyperlink)
|
|
@@ -233,7 +256,7 @@ function rangeEdit(args: {
|
|
|
233
256
|
export const setFontRange = defineTool({
|
|
234
257
|
name: 'set_font_range',
|
|
235
258
|
|
|
236
|
-
description: 'Set font properties, color, or a link for a text range.',
|
|
259
|
+
description: 'Set font properties, OpenType features, color, or a link for a text range.',
|
|
237
260
|
execution: { kind: 'sync', mutation: 'properties' },
|
|
238
261
|
input: v.strictObject({
|
|
239
262
|
id: nodeIdInputSchema,
|
|
@@ -243,6 +266,7 @@ export const setFontRange = defineTool({
|
|
|
243
266
|
size: v.optional(toolNumber(v.pipe(v.number(), v.minValue(1), v.description('Font size')))),
|
|
244
267
|
style: v.optional(v.pipe(v.string(), v.description('Font style'))),
|
|
245
268
|
variations: variationsInputSchema,
|
|
269
|
+
font_features: fontFeaturesInputSchema,
|
|
246
270
|
color: v.optional(v.pipe(v.string(), v.description('Text color (hex)'))),
|
|
247
271
|
hyperlink: hyperlinkInputSchema
|
|
248
272
|
}),
|
|
@@ -251,7 +275,8 @@ export const setFontRange = defineTool({
|
|
|
251
275
|
if (!node) return []
|
|
252
276
|
const font = args.family || args.style || args.variations ? rangeFont(node, args) : null
|
|
253
277
|
// A colour alone is a paint and lays nothing out, so text in a missing font can still take it.
|
|
254
|
-
|
|
278
|
+
// Features reshape glyphs, so they need the text's fonts as a size change does.
|
|
279
|
+
const laysOut = font !== null || args.size !== undefined || args.font_features !== undefined
|
|
255
280
|
return [...(font ? [font] : []), ...(laysOut ? textFonts(figma, args.id) : [])]
|
|
256
281
|
},
|
|
257
282
|
execute: (figma, args) => {
|
|
@@ -260,6 +285,8 @@ export const setFontRange = defineTool({
|
|
|
260
285
|
const { start, end } = args
|
|
261
286
|
const badTag = badVariationTag(args.variations)
|
|
262
287
|
if (badTag) return badTag
|
|
288
|
+
const badFeature = badFeatureEntry(args.font_features)
|
|
289
|
+
if (badFeature) return badFeature
|
|
263
290
|
const edit = rangeEdit(args)
|
|
264
291
|
if ('error' in edit) return edit
|
|
265
292
|
const { hyperlink, color } = edit
|
|
@@ -271,6 +298,9 @@ export const setFontRange = defineTool({
|
|
|
271
298
|
}
|
|
272
299
|
if (color) node.setRangeFills(start, end, [{ type: 'SOLID', color }])
|
|
273
300
|
if (hyperlink) node.setRangeHyperlink(start, end, hyperlink.link)
|
|
301
|
+
if (args.font_features) {
|
|
302
|
+
new PairdrawAPI(figma).setRangeFontFeatures(node, start, end, args.font_features)
|
|
303
|
+
}
|
|
274
304
|
} catch (error) {
|
|
275
305
|
return toolFailure(error)
|
|
276
306
|
}
|
|
@@ -307,7 +337,7 @@ export const setTextProperties = defineTool({
|
|
|
307
337
|
name: 'set_text_properties',
|
|
308
338
|
|
|
309
339
|
description:
|
|
310
|
-
'Set text layout properties: alignment, auto-resize, text case, decoration, truncation, and a link for the whole text.',
|
|
340
|
+
'Set text layout properties: alignment, auto-resize, text case, decoration, truncation, OpenType features, and a link for the whole text.',
|
|
311
341
|
execution: { kind: 'sync', mutation: 'properties' },
|
|
312
342
|
input: v.strictObject({
|
|
313
343
|
id: v.pipe(v.string(), v.description('Text node ID')),
|
|
@@ -332,7 +362,8 @@ export const setTextProperties = defineTool({
|
|
|
332
362
|
text_decoration: v.optional(
|
|
333
363
|
v.pipe(v.picklist(['NONE', 'UNDERLINE', 'STRIKETHROUGH']), v.description('Text decoration'))
|
|
334
364
|
),
|
|
335
|
-
hyperlink: hyperlinkInputSchema
|
|
365
|
+
hyperlink: hyperlinkInputSchema,
|
|
366
|
+
font_features: fontFeaturesInputSchema
|
|
336
367
|
}),
|
|
337
368
|
fonts: (figma, { id }) => textFonts(figma, id),
|
|
338
369
|
execute: (figma, args) => {
|
|
@@ -342,6 +373,8 @@ export const setTextProperties = defineTool({
|
|
|
342
373
|
// Refused before anything changes, so a bad address leaves the text as it was.
|
|
343
374
|
const hyperlink = requestedHyperlink(args.hyperlink)
|
|
344
375
|
if (hyperlink && 'error' in hyperlink) return hyperlink
|
|
376
|
+
const badFeature = badFeatureEntry(args.font_features)
|
|
377
|
+
if (badFeature) return badFeature
|
|
345
378
|
const updated: string[] = []
|
|
346
379
|
if (args.align_horizontal !== undefined) {
|
|
347
380
|
node.textAlignHorizontal = args.align_horizontal
|
|
@@ -363,6 +396,10 @@ export const setTextProperties = defineTool({
|
|
|
363
396
|
node.textDecoration = args.text_decoration
|
|
364
397
|
updated.push('textDecoration')
|
|
365
398
|
}
|
|
399
|
+
if (args.font_features) {
|
|
400
|
+
new PairdrawAPI(figma).setFontFeatures(node, args.font_features)
|
|
401
|
+
updated.push('fontFeatures')
|
|
402
|
+
}
|
|
366
403
|
if (hyperlink) {
|
|
367
404
|
try {
|
|
368
405
|
node.hyperlink = hyperlink.link
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as v from 'valibot'
|
|
2
2
|
|
|
3
3
|
import type { SceneNode } from '@pairdraw/scene-graph'
|
|
4
|
+
import { OVERFLOW_DIRECTIONS, SCROLL_BEHAVIORS } from '@pairdraw/scene-graph/constants'
|
|
4
5
|
import { styleDetachmentChanges } from '@pairdraw/scene-graph/shared-styles'
|
|
5
6
|
|
|
6
7
|
import { assertNodeEditable } from '#core/editor/capabilities'
|
|
@@ -32,11 +33,41 @@ function resized(node: FigmaNodeProxy, width = node.width, height = node.height)
|
|
|
32
33
|
return changed
|
|
33
34
|
}
|
|
34
35
|
|
|
36
|
+
const SCROLLING_TYPES: ReadonlySet<string> = new Set(['FRAME', 'COMPONENT', 'INSTANCE'])
|
|
37
|
+
|
|
38
|
+
/** Why a layer cannot take overflow scrolling, or null when it can, as Figma's frames take it. */
|
|
39
|
+
export function scrollRefusal(node: FigmaNodeProxy): string | null {
|
|
40
|
+
if (SCROLLING_TYPES.has(node.type)) return null
|
|
41
|
+
return `Only a frame, component or instance scrolls; ${node.type} "${node.name}" cannot.`
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Overflow scrolling in play, as Figma's `overflowDirection`. */
|
|
45
|
+
export function overflowDirectionInput() {
|
|
46
|
+
return v.pipe(
|
|
47
|
+
v.picklist(OVERFLOW_DIRECTIONS),
|
|
48
|
+
v.description(
|
|
49
|
+
'Overflow scrolling in prototype play (FRAME, COMPONENT, INSTANCE). A nested frame scrolls ' +
|
|
50
|
+
'only while it clips its content.'
|
|
51
|
+
)
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** How a layer moves while its parent frame scrolls in prototype play. */
|
|
56
|
+
export function scrollBehaviorInput() {
|
|
57
|
+
return v.pipe(
|
|
58
|
+
v.picklist(SCROLL_BEHAVIORS),
|
|
59
|
+
v.description(
|
|
60
|
+
'Scroll behavior in prototype play: SCROLLS moves with the content, FIXED stays in the ' +
|
|
61
|
+
"frame, STICKY_SCROLLS scrolls until it reaches the frame's top or left edge."
|
|
62
|
+
)
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
35
66
|
export const updateNode = defineTool({
|
|
36
67
|
name: 'update_node',
|
|
37
68
|
|
|
38
69
|
description:
|
|
39
|
-
'Update properties of an existing node: position, size, opacity, corner radius, visibility, text, font.',
|
|
70
|
+
'Update properties of an existing node: position, size, opacity, corner radius, visibility, text, font, overflow scrolling.',
|
|
40
71
|
execution: { kind: 'sync', mutation: 'properties' },
|
|
41
72
|
input: v.strictObject({
|
|
42
73
|
id: nodeIdInputSchema,
|
|
@@ -69,12 +100,17 @@ export const updateNode = defineTool({
|
|
|
69
100
|
v.pipe(v.number(), v.minValue(100), v.maxValue(900), v.description('Font weight (100-900)'))
|
|
70
101
|
)
|
|
71
102
|
),
|
|
72
|
-
name: v.optional(v.pipe(v.string(), v.description('Layer name')))
|
|
103
|
+
name: v.optional(v.pipe(v.string(), v.description('Layer name'))),
|
|
104
|
+
overflow_direction: v.optional(overflowDirectionInput()),
|
|
105
|
+
scroll_behavior: v.optional(scrollBehaviorInput())
|
|
73
106
|
}),
|
|
74
107
|
execute: (figma, args) => {
|
|
75
108
|
const node = figma.getNodeById(args.id)
|
|
76
109
|
if (!node) return nodeNotFound(args.id)
|
|
77
110
|
assertNodeEditable(figma.graph, args.id)
|
|
111
|
+
// Refused before anything is written, so the call changes all or nothing.
|
|
112
|
+
const refusal = args.overflow_direction === undefined ? null : scrollRefusal(node)
|
|
113
|
+
if (refusal) return { error: refusal }
|
|
78
114
|
// Written to the layer directly, since the plugin setters need a loaded font; an edit to a
|
|
79
115
|
// text style's field leaves the style, as the editor's updates do.
|
|
80
116
|
const editTypography = (changes: Partial<SceneNode>) => {
|
|
@@ -132,6 +168,14 @@ export const updateNode = defineTool({
|
|
|
132
168
|
editTypography({ fontWeight: args.font_weight })
|
|
133
169
|
updated.push('fontWeight')
|
|
134
170
|
}
|
|
171
|
+
if (args.overflow_direction !== undefined) {
|
|
172
|
+
node.overflowDirection = args.overflow_direction
|
|
173
|
+
updated.push('overflowDirection')
|
|
174
|
+
}
|
|
175
|
+
if (args.scroll_behavior !== undefined) {
|
|
176
|
+
node.scrollBehavior = args.scroll_behavior
|
|
177
|
+
updated.push('scrollBehavior')
|
|
178
|
+
}
|
|
135
179
|
return { id: args.id, updated }
|
|
136
180
|
}
|
|
137
181
|
})
|
package/src/tools/modify.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { setEffects } from './modify/effects'
|
|
2
|
+
export { replaceFonts } from './modify/fonts'
|
|
2
3
|
export { rescale, setMinMax, setOpacity, setRadius, setRotation } from './modify/geometry'
|
|
3
4
|
export { setConstraints, setLayout, setLayoutChild } from './modify/layout'
|
|
4
5
|
export { replaceMatchingProperties } from './modify/matching'
|
package/src/tools/read/fonts.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { uniq } from 'es-toolkit/array'
|
|
|
2
2
|
import * as v from 'valibot'
|
|
3
3
|
|
|
4
4
|
import { PairdrawAPI } from '#core/pairdraw-api'
|
|
5
|
+
import { listDocumentFonts } from '#core/text/replace-fonts'
|
|
5
6
|
import { defineTool } from '#core/tools/schema'
|
|
6
7
|
|
|
7
8
|
export const getFontStatus = defineTool({
|
|
@@ -18,13 +19,34 @@ export const getFontStatus = defineTool({
|
|
|
18
19
|
|
|
19
20
|
export const listFonts = defineTool({
|
|
20
21
|
name: 'list_fonts',
|
|
21
|
-
description:
|
|
22
|
+
description:
|
|
23
|
+
'List fonts used in the current page as families with their weights. Pass scope ' +
|
|
24
|
+
'"document" for every face used anywhere in the document, with whether the host has it ' +
|
|
25
|
+
'and how many text layers use it, missing faces first; use replace_fonts to swap one for ' +
|
|
26
|
+
'an available face.',
|
|
22
27
|
execution: { kind: 'sync', mutation: 'none' },
|
|
23
28
|
exposure: { webmcp: false },
|
|
24
29
|
input: v.strictObject({
|
|
25
|
-
family: v.optional(v.pipe(v.string(), v.description('Filter by family name (substring)')))
|
|
30
|
+
family: v.optional(v.pipe(v.string(), v.description('Filter by family name (substring)'))),
|
|
31
|
+
scope: v.optional(
|
|
32
|
+
v.pipe(
|
|
33
|
+
v.picklist(['page', 'document']),
|
|
34
|
+
v.description(
|
|
35
|
+
'page (default): families and weights of the current page. document: every face ' +
|
|
36
|
+
'across the document with missing and layerCount'
|
|
37
|
+
)
|
|
38
|
+
)
|
|
39
|
+
)
|
|
26
40
|
}),
|
|
27
41
|
execute: (figma, args) => {
|
|
42
|
+
if (args.scope === 'document') {
|
|
43
|
+
let fonts = listDocumentFonts(figma.graph)
|
|
44
|
+
if (args.family) {
|
|
45
|
+
const query = args.family.toLocaleLowerCase()
|
|
46
|
+
fonts = fonts.filter((font) => font.family.toLocaleLowerCase().includes(query))
|
|
47
|
+
}
|
|
48
|
+
return { count: fonts.length, fonts }
|
|
49
|
+
}
|
|
28
50
|
const fonts = new Map<string, Set<number>>()
|
|
29
51
|
const page = figma.currentPage
|
|
30
52
|
page.findAll((node) => {
|
|
@@ -49,6 +49,7 @@ export const insertLibraryComponent = defineTool({
|
|
|
49
49
|
'Insert a reusable component from an enabled library by stable library and asset identity.',
|
|
50
50
|
|
|
51
51
|
execution: { kind: 'async', mutation: 'document' },
|
|
52
|
+
content: 'imported',
|
|
52
53
|
input: v.strictObject({
|
|
53
54
|
library_id: v.pipe(v.string(), v.description('Library ID')),
|
|
54
55
|
revision_id: v.optional(v.pipe(v.string(), v.description('Pinned revision ID'))),
|
package/src/tools/read/space.ts
CHANGED
|
@@ -30,7 +30,8 @@ export interface EmptySpace extends Rect {
|
|
|
30
30
|
direction: SpaceDirection | null
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
/** Whether `rect` comes within `gap` of `obstacle`, or covers part of it when `gap` is 0. */
|
|
34
|
+
export function rectsOverlap(rect: Rect, obstacle: Rect, gap: number): boolean {
|
|
34
35
|
return (
|
|
35
36
|
rect.x < obstacle.x + obstacle.width + gap &&
|
|
36
37
|
rect.x + rect.width + gap > obstacle.x &&
|
|
@@ -67,7 +68,7 @@ function spaceToward(request: EmptySpaceRequest, anchor: Rect, direction: SpaceD
|
|
|
67
68
|
: { x: anchor.x, y: offset, width, height }
|
|
68
69
|
for (const offset of candidates) {
|
|
69
70
|
const rect = place(offset)
|
|
70
|
-
if (!obstacles.some((obstacle) =>
|
|
71
|
+
if (!obstacles.some((obstacle) => rectsOverlap(rect, obstacle, gap))) return rect
|
|
71
72
|
}
|
|
72
73
|
// Unreachable: the farthest candidate clears every obstacle along this axis.
|
|
73
74
|
return place(candidates[candidates.length - 1] ?? start)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { diffChanges, diffCreate, diffVisual, evalCode } from '#core/tools/analyze'
|
|
2
|
+
import { checkResponsive } from '#core/tools/analyze/responsive'
|
|
2
3
|
import { calc } from '#core/tools/calc'
|
|
3
4
|
import { render } from '#core/tools/create'
|
|
4
5
|
import { describe } from '#core/tools/describe'
|
|
@@ -19,7 +20,7 @@ import { batchUpdate, deleteNode, nodeResize, reparentNode } from '#core/tools/s
|
|
|
19
20
|
import { viewportZoomToFit } from '#core/tools/vector'
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
|
-
* Core tools registered by default in AI chat (
|
|
23
|
+
* Core tools registered by default in AI chat (27 tools, ~5K schema tokens).
|
|
23
24
|
* Covers 90%+ of design sessions: render, describe, modify, structure, and diff checks.
|
|
24
25
|
*/
|
|
25
26
|
export const CORE_TOOLS: ToolDef[] = [
|
|
@@ -52,6 +53,7 @@ export const CORE_TOOLS: ToolDef[] = [
|
|
|
52
53
|
diffCreate,
|
|
53
54
|
diffJSX,
|
|
54
55
|
diffVisual,
|
|
56
|
+
checkResponsive,
|
|
55
57
|
calc,
|
|
56
58
|
evalCode,
|
|
57
59
|
viewportZoomToFit
|
|
@@ -9,7 +9,13 @@ import {
|
|
|
9
9
|
lint,
|
|
10
10
|
lintFix
|
|
11
11
|
} from '#core/tools/analyze'
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
designToComponentMap,
|
|
14
|
+
designToTokens,
|
|
15
|
+
importDesignTokens,
|
|
16
|
+
syncTokens,
|
|
17
|
+
tokenDrift
|
|
18
|
+
} from '#core/tools/codegen'
|
|
13
19
|
import { addComment, getComments, replyToComment, resolveComment } from '#core/tools/comments'
|
|
14
20
|
import {
|
|
15
21
|
createComponent,
|
|
@@ -33,6 +39,11 @@ import {
|
|
|
33
39
|
searchIconsTool,
|
|
34
40
|
setBehaviour
|
|
35
41
|
} from '#core/tools/create'
|
|
42
|
+
import {
|
|
43
|
+
checkDesignValuesTool,
|
|
44
|
+
getDesignMemory,
|
|
45
|
+
recordDesignDecisionTool
|
|
46
|
+
} from '#core/tools/design-memory'
|
|
36
47
|
import {
|
|
37
48
|
generateImage,
|
|
38
49
|
generateSVG,
|
|
@@ -40,6 +51,7 @@ import {
|
|
|
40
51
|
replaceBackground
|
|
41
52
|
} from '#core/tools/image-ai'
|
|
42
53
|
import {
|
|
54
|
+
replaceFonts,
|
|
43
55
|
setBlend,
|
|
44
56
|
setConstraints,
|
|
45
57
|
setEffects,
|
|
@@ -79,8 +91,10 @@ import { getStatuses, setStatus } from '#core/tools/statuses'
|
|
|
79
91
|
import {
|
|
80
92
|
arrangeNodes,
|
|
81
93
|
cloneNode,
|
|
94
|
+
createVariationsTool,
|
|
82
95
|
flattenNodes,
|
|
83
96
|
groupNodes,
|
|
97
|
+
listVariations,
|
|
84
98
|
nodeAncestors,
|
|
85
99
|
nodeBindings,
|
|
86
100
|
nodeBounds,
|
|
@@ -89,6 +103,7 @@ import {
|
|
|
89
103
|
nodeReplaceWith,
|
|
90
104
|
nodeToComponent,
|
|
91
105
|
nodeTree,
|
|
106
|
+
pickVariation,
|
|
92
107
|
renameNode,
|
|
93
108
|
ungroupNode
|
|
94
109
|
} from '#core/tools/structure'
|
|
@@ -116,6 +131,7 @@ import {
|
|
|
116
131
|
exportImage,
|
|
117
132
|
exportPDF,
|
|
118
133
|
exportSVG,
|
|
134
|
+
exportVideo,
|
|
119
135
|
pathFlip,
|
|
120
136
|
pathGet,
|
|
121
137
|
pathMove,
|
|
@@ -150,6 +166,9 @@ export const EXTENDED_TOOLS: ToolDef[] = [
|
|
|
150
166
|
resolveComment,
|
|
151
167
|
getStatuses,
|
|
152
168
|
setStatus,
|
|
169
|
+
getDesignMemory,
|
|
170
|
+
checkDesignValuesTool,
|
|
171
|
+
recordDesignDecisionTool,
|
|
153
172
|
getFontStatus,
|
|
154
173
|
listFonts,
|
|
155
174
|
listAvailableFonts,
|
|
@@ -191,6 +210,7 @@ export const EXTENDED_TOOLS: ToolDef[] = [
|
|
|
191
210
|
setMinMax,
|
|
192
211
|
setFontRange,
|
|
193
212
|
setTextResize,
|
|
213
|
+
replaceFonts,
|
|
194
214
|
setBlend,
|
|
195
215
|
setLocked,
|
|
196
216
|
setStrokeAlign,
|
|
@@ -212,6 +232,10 @@ export const EXTENDED_TOOLS: ToolDef[] = [
|
|
|
212
232
|
nodeBindings,
|
|
213
233
|
nodeReplaceWith,
|
|
214
234
|
arrangeNodes,
|
|
235
|
+
// Variations: versions of a layer side by side, one of which can replace it
|
|
236
|
+
createVariationsTool,
|
|
237
|
+
listVariations,
|
|
238
|
+
pickVariation,
|
|
215
239
|
// Variables
|
|
216
240
|
listVariables,
|
|
217
241
|
listCollections,
|
|
@@ -241,6 +265,7 @@ export const EXTENDED_TOOLS: ToolDef[] = [
|
|
|
241
265
|
exportSVG,
|
|
242
266
|
exportPDF,
|
|
243
267
|
exportImage,
|
|
268
|
+
exportVideo,
|
|
244
269
|
exportHTML,
|
|
245
270
|
// Analyze & diff
|
|
246
271
|
analyzeColors,
|
|
@@ -257,5 +282,7 @@ export const EXTENDED_TOOLS: ToolDef[] = [
|
|
|
257
282
|
// Codegen
|
|
258
283
|
designToTokens,
|
|
259
284
|
importDesignTokens,
|
|
285
|
+
tokenDrift,
|
|
286
|
+
syncTokens,
|
|
260
287
|
designToComponentMap
|
|
261
288
|
]
|
package/src/tools/schema.ts
CHANGED
|
@@ -26,7 +26,15 @@ export type ToolCapability =
|
|
|
26
26
|
|
|
27
27
|
export type ToolExecution =
|
|
28
28
|
| { kind: 'sync'; mutation: 'none' | 'view' | 'properties' | 'document' }
|
|
29
|
-
| {
|
|
29
|
+
| {
|
|
30
|
+
kind: 'async'
|
|
31
|
+
mutation: 'none' | 'view' | 'document'
|
|
32
|
+
/**
|
|
33
|
+
* The call can run for a long time even when it only reads, such as recording a video, so
|
|
34
|
+
* bridges give it the deadline they give an edit.
|
|
35
|
+
*/
|
|
36
|
+
long?: boolean
|
|
37
|
+
}
|
|
30
38
|
|
|
31
39
|
export type ToolInterface = 'mcp' | 'ai' | 'webmcp'
|
|
32
40
|
export type ToolExposure = Partial<Record<ToolInterface, boolean>>
|
|
@@ -39,6 +47,16 @@ interface ToolMetadata {
|
|
|
39
47
|
exposure: ToolExposure
|
|
40
48
|
capabilities: readonly ToolCapability[]
|
|
41
49
|
availability: 'default' | 'eval'
|
|
50
|
+
/**
|
|
51
|
+
* What a call's values come from, for the document's design memory:
|
|
52
|
+
* - `imported`: outside content, such as a web page, an SVG, a photo or a library component,
|
|
53
|
+
* whose colors and type are its own, so the memory warns about them rather than refusing;
|
|
54
|
+
* - `copied`: the layers the call names, which it copies or converts with their values, such
|
|
55
|
+
* as a clone, a group or a boolean, so values those layers already had are not new.
|
|
56
|
+
* - `merged`: layers the call joins into one, which may take a paint from any of them, such as
|
|
57
|
+
* flatten and boolean operations; a value is only theirs when every named layer had it.
|
|
58
|
+
*/
|
|
59
|
+
content?: 'imported' | 'copied' | 'merged'
|
|
42
60
|
}
|
|
43
61
|
|
|
44
62
|
export interface ToolDef extends ToolMetadata {
|
|
@@ -51,7 +69,8 @@ export interface ToolDef extends ToolMetadata {
|
|
|
51
69
|
* synchronous tool still edits in one step.
|
|
52
70
|
*/
|
|
53
71
|
loadFonts: (figma: FigmaAPI, args: Record<string, unknown>) => Promise<void>
|
|
54
|
-
|
|
72
|
+
/** `signal` aborts a caller's cancelled request, which a long export checks while it runs. */
|
|
73
|
+
execute: (figma: FigmaAPI, args: Record<string, unknown>, signal?: AbortSignal) => unknown
|
|
55
74
|
/**
|
|
56
75
|
* The synchronous answer of a read whose `execute` may load a page first, or `undefined`
|
|
57
76
|
* when answering would load. Hosts that cannot wait refuse on `undefined` before any load.
|
|
@@ -71,7 +90,11 @@ export function defineTool<P extends v.ObjectEntries, R>(
|
|
|
71
90
|
figma: FigmaAPI,
|
|
72
91
|
args: v.InferOutput<v.StrictObjectSchema<P, undefined>>
|
|
73
92
|
) => FigmaFontNameInput[]
|
|
74
|
-
execute: (
|
|
93
|
+
execute: (
|
|
94
|
+
figma: FigmaAPI,
|
|
95
|
+
args: v.InferOutput<v.StrictObjectSchema<P, undefined>>,
|
|
96
|
+
signal?: AbortSignal
|
|
97
|
+
) => R
|
|
75
98
|
executeSync?: (
|
|
76
99
|
figma: FigmaAPI,
|
|
77
100
|
args: v.InferOutput<v.StrictObjectSchema<P, undefined>>
|
|
@@ -96,7 +119,8 @@ export function defineTool<P extends v.ObjectEntries, R>(
|
|
|
96
119
|
if (!parsed.success) return
|
|
97
120
|
for (const font of fonts(figma, parsed.output)) await figma.loadFontAsync(font)
|
|
98
121
|
},
|
|
99
|
-
execute: (figma, args) =>
|
|
122
|
+
execute: (figma, args, signal) =>
|
|
123
|
+
def.execute(figma, parseToolArgs(def.name, def.input, args), signal),
|
|
100
124
|
executeSync: def.executeSync
|
|
101
125
|
? (figma, args) => def.executeSync?.(figma, parseToolArgs(def.name, def.input, args))
|
|
102
126
|
: undefined
|