@pairdraw/core 0.18.0 → 0.19.0-beta.1
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/canvas/effects.d.ts +5 -11
- package/dist/canvas/effects.d.ts.map +1 -1
- package/dist/canvas/effects.js +25 -30
- package/dist/canvas/effects.js.map +1 -1
- package/dist/canvas/labels/hit-test.d.ts +5 -0
- package/dist/canvas/labels/hit-test.d.ts.map +1 -1
- package/dist/canvas/labels/hit-test.js +1 -1
- package/dist/canvas/labels/hit-test.js.map +1 -1
- package/dist/canvas/labels/paragraph-cache.d.ts.map +1 -1
- package/dist/canvas/labels/paragraph-cache.js +3 -2
- package/dist/canvas/labels/paragraph-cache.js.map +1 -1
- package/dist/canvas/labels/selection.js +3 -2
- package/dist/canvas/labels/selection.js.map +1 -1
- package/dist/canvas/labels/style.d.ts +1 -1
- package/dist/canvas/node-edit-overlay.js +2 -2
- package/dist/canvas/node-edit-overlay.js.map +1 -1
- package/dist/canvas/overlays/index.d.ts +2 -2
- package/dist/canvas/overlays/index.js +2 -2
- package/dist/canvas/overlays/selection.d.ts +1 -2
- package/dist/canvas/overlays/selection.d.ts.map +1 -1
- package/dist/canvas/overlays/selection.js +4 -37
- package/dist/canvas/overlays/selection.js.map +1 -1
- package/dist/canvas/region-hatch.js +3 -2
- package/dist/canvas/region-hatch.js.map +1 -1
- package/dist/canvas/renderer/colors.d.ts.map +1 -1
- package/dist/canvas/renderer/colors.js +36 -18
- package/dist/canvas/renderer/colors.js.map +1 -1
- package/dist/canvas/renderer/font-waiters.d.ts +9 -0
- package/dist/canvas/renderer/font-waiters.d.ts.map +1 -0
- package/dist/canvas/renderer/font-waiters.js +26 -0
- package/dist/canvas/renderer/font-waiters.js.map +1 -0
- package/dist/canvas/renderer/fonts.d.ts +4 -2
- package/dist/canvas/renderer/fonts.d.ts.map +1 -1
- package/dist/canvas/renderer/fonts.js +23 -9
- package/dist/canvas/renderer/fonts.js.map +1 -1
- package/dist/canvas/renderer/lifecycle.d.ts.map +1 -1
- package/dist/canvas/renderer/lifecycle.js +6 -9
- package/dist/canvas/renderer/lifecycle.js.map +1 -1
- package/dist/canvas/renderer/methods.d.ts +4 -5
- package/dist/canvas/renderer/methods.d.ts.map +1 -1
- package/dist/canvas/renderer/methods.js +1 -4
- package/dist/canvas/renderer/methods.js.map +1 -1
- package/dist/canvas/renderer/paints.d.ts.map +1 -1
- package/dist/canvas/renderer/paints.js +0 -6
- package/dist/canvas/renderer/paints.js.map +1 -1
- package/dist/canvas/renderer/pipeline.d.ts.map +1 -1
- package/dist/canvas/renderer/pipeline.js +20 -2
- package/dist/canvas/renderer/pipeline.js.map +1 -1
- package/dist/canvas/renderer/retained-backing.js +4 -4
- package/dist/canvas/renderer/retained-backing.js.map +1 -1
- package/dist/canvas/renderer/state.js +1 -1
- package/dist/canvas/renderer/state.js.map +1 -1
- package/dist/canvas/renderer/tiles/controller.d.ts +2 -0
- package/dist/canvas/renderer/tiles/controller.d.ts.map +1 -1
- package/dist/canvas/renderer/tiles/controller.js +8 -0
- package/dist/canvas/renderer/tiles/controller.js.map +1 -1
- package/dist/canvas/renderer/tiles/surface-pool.js +1 -1
- package/dist/canvas/renderer/tiles/surface-pool.js.map +1 -1
- package/dist/canvas/renderer/visual-bounds.d.ts.map +1 -1
- package/dist/canvas/renderer/visual-bounds.js +7 -5
- package/dist/canvas/renderer/visual-bounds.js.map +1 -1
- package/dist/canvas/renderer.d.ts +22 -7
- package/dist/canvas/renderer.d.ts.map +1 -1
- package/dist/canvas/renderer.js +46 -11
- package/dist/canvas/renderer.js.map +1 -1
- package/dist/canvas/rulers.d.ts +8 -1
- package/dist/canvas/rulers.d.ts.map +1 -1
- package/dist/canvas/rulers.js +30 -5
- package/dist/canvas/rulers.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 +30 -18
- package/dist/canvas/scene.js.map +1 -1
- package/dist/canvas/shadows/shape.js +1 -1
- package/dist/canvas/shadows/shape.js.map +1 -1
- package/dist/canvas/shadows/silhouette.d.ts.map +1 -1
- package/dist/canvas/shadows/silhouette.js +4 -2
- package/dist/canvas/shadows/silhouette.js.map +1 -1
- package/dist/canvas/shadows.d.ts.map +1 -1
- package/dist/canvas/shadows.js +3 -2
- package/dist/canvas/shadows.js.map +1 -1
- package/dist/canvas/text/derived.d.ts +1 -2
- package/dist/canvas/text/derived.d.ts.map +1 -1
- package/dist/canvas/text/derived.js +1 -7
- package/dist/canvas/text/derived.js.map +1 -1
- package/dist/canvas/text/emoji/index.js +1 -1
- package/dist/canvas/text/emoji/raster.d.ts.map +1 -1
- package/dist/canvas/text/emoji/raster.js +14 -10
- package/dist/canvas/text/emoji/raster.js.map +1 -1
- package/dist/canvas/text/font-families.d.ts.map +1 -1
- package/dist/canvas/text/font-families.js +5 -2
- package/dist/canvas/text/font-families.js.map +1 -1
- package/dist/canvas/text/index.d.ts +1 -3
- package/dist/canvas/text/index.d.ts.map +1 -1
- package/dist/canvas/text/index.js +1 -8
- package/dist/canvas/text/index.js.map +1 -1
- package/dist/canvas/text/layout/build.d.ts.map +1 -1
- package/dist/canvas/text/layout/build.js +25 -9
- package/dist/canvas/text/layout/build.js.map +1 -1
- package/dist/canvas/text/layout/index.d.ts.map +1 -1
- package/dist/canvas/text/layout/index.js +8 -4
- package/dist/canvas/text/layout/index.js.map +1 -1
- package/dist/canvas/text/layout/lines.js +5 -3
- package/dist/canvas/text/layout/lines.js.map +1 -1
- package/dist/canvas/text/paragraph/index.d.ts +5 -0
- package/dist/canvas/text/paragraph/index.d.ts.map +1 -1
- package/dist/canvas/text/paragraph/index.js +16 -7
- package/dist/canvas/text/paragraph/index.js.map +1 -1
- package/dist/canvas/text/paragraph/inputs.d.ts +1 -1
- package/dist/canvas/text/paragraph/inputs.d.ts.map +1 -1
- package/dist/canvas/text/paragraph/inputs.js +9 -2
- package/dist/canvas/text/paragraph/inputs.js.map +1 -1
- package/dist/canvas/text/placed.js +1 -1
- package/dist/canvas/text/shape.d.ts +4 -3
- package/dist/canvas/text/shape.d.ts.map +1 -1
- package/dist/canvas/text/shape.js +9 -22
- package/dist/canvas/text/shape.js.map +1 -1
- package/dist/constants.d.ts +6 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +6 -2
- package/dist/constants.js.map +1 -1
- package/dist/editor/bridges/clipboard.d.ts +1 -0
- package/dist/editor/bridges/clipboard.js +1 -0
- package/dist/editor/bridges/clipboard.js.map +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/frames.d.ts +4 -3
- package/dist/editor/bridges/frames.d.ts.map +1 -1
- package/dist/editor/bridges/frames.js +6 -4
- package/dist/editor/bridges/frames.js.map +1 -1
- package/dist/editor/bridges/structure.d.ts +1 -0
- package/dist/editor/bridges/structure.d.ts.map +1 -1
- package/dist/editor/bridges/structure.js +1 -0
- package/dist/editor/bridges/structure.js.map +1 -1
- package/dist/editor/clipboard/detach.js +2 -2
- package/dist/editor/clipboard/detach.js.map +1 -1
- package/dist/editor/clipboard/paste/properties.js +1 -1
- package/dist/editor/clipboard/paste/target.js +2 -2
- package/dist/editor/clipboard/paste/target.js.map +1 -1
- package/dist/editor/clipboard/snapshot.d.ts +3 -0
- package/dist/editor/clipboard/snapshot.d.ts.map +1 -1
- package/dist/editor/clipboard/snapshot.js +2 -0
- package/dist/editor/clipboard/snapshot.js.map +1 -1
- package/dist/editor/clipboard/variables.d.ts.map +1 -1
- package/dist/editor/clipboard/variables.js +14 -1
- package/dist/editor/clipboard/variables.js.map +1 -1
- package/dist/editor/clipboard.d.ts +1 -0
- package/dist/editor/clipboard.d.ts.map +1 -1
- package/dist/editor/clipboard.js +122 -16
- package/dist/editor/clipboard.js.map +1 -1
- package/dist/editor/component-sync.d.ts +10 -1
- package/dist/editor/component-sync.d.ts.map +1 -1
- package/dist/editor/component-sync.js +25 -8
- package/dist/editor/component-sync.js.map +1 -1
- package/dist/editor/components/authoring/text-edit.d.ts.map +1 -1
- package/dist/editor/components/authoring/text-edit.js +11 -2
- package/dist/editor/components/authoring/text-edit.js.map +1 -1
- package/dist/editor/components/authoring/visibility-edit.d.ts.map +1 -1
- package/dist/editor/components/authoring/visibility-edit.js +7 -3
- package/dist/editor/components/authoring/visibility-edit.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 +37 -7
- 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 -0
- package/dist/editor/components/properties.js.map +1 -1
- package/dist/editor/components/slots/authoring.js +2 -1
- package/dist/editor/components/slots/authoring.js.map +1 -1
- package/dist/editor/components.d.ts +2 -0
- package/dist/editor/components.d.ts.map +1 -1
- package/dist/editor/create.d.ts +17 -3
- package/dist/editor/create.d.ts.map +1 -1
- package/dist/editor/create.js +43 -6
- package/dist/editor/create.js.map +1 -1
- package/dist/editor/guides.d.ts.map +1 -1
- package/dist/editor/guides.js +20 -13
- package/dist/editor/guides.js.map +1 -1
- package/dist/editor/history/document-change.d.ts +19 -3
- package/dist/editor/history/document-change.d.ts.map +1 -1
- package/dist/editor/history/document-change.js +94 -8
- package/dist/editor/history/document-change.js.map +1 -1
- package/dist/editor/history/edit.d.ts.map +1 -1
- package/dist/editor/history/edit.js +56 -12
- package/dist/editor/history/edit.js.map +1 -1
- package/dist/editor/history/position.js +1 -4
- package/dist/editor/history/position.js.map +1 -1
- package/dist/editor/history/sources.d.ts +14 -0
- package/dist/editor/history/sources.d.ts.map +1 -0
- package/dist/editor/history/sources.js +24 -0
- package/dist/editor/history/sources.js.map +1 -0
- package/dist/editor/index.d.ts +2 -2
- package/dist/editor/index.js +1 -1
- package/dist/editor/layout-mode.d.ts.map +1 -1
- package/dist/editor/layout-mode.js +16 -1
- package/dist/editor/layout-mode.js.map +1 -1
- package/dist/editor/node-preview.d.ts.map +1 -1
- package/dist/editor/node-preview.js +26 -7
- package/dist/editor/node-preview.js.map +1 -1
- package/dist/editor/nodes.d.ts.map +1 -1
- package/dist/editor/nodes.js +33 -10
- package/dist/editor/nodes.js.map +1 -1
- package/dist/editor/nudge.d.ts.map +1 -1
- package/dist/editor/nudge.js +12 -2
- package/dist/editor/nudge.js.map +1 -1
- package/dist/editor/pages.d.ts +2 -1
- package/dist/editor/pages.d.ts.map +1 -1
- package/dist/editor/pages.js +94 -15
- package/dist/editor/pages.js.map +1 -1
- package/dist/editor/play/states.d.ts.map +1 -1
- package/dist/editor/play/states.js +0 -5
- package/dist/editor/play/states.js.map +1 -1
- package/dist/editor/read-only/actions.js +3 -0
- package/dist/editor/read-only/actions.js.map +1 -1
- package/dist/editor/selection/hit-test.d.ts +2 -1
- package/dist/editor/selection/hit-test.d.ts.map +1 -1
- package/dist/editor/selection/hit-test.js +29 -4
- package/dist/editor/selection/hit-test.js.map +1 -1
- package/dist/editor/selection.d.ts +2 -2
- package/dist/editor/selection.d.ts.map +1 -1
- package/dist/editor/shapes/pen.js +6 -2
- package/dist/editor/shapes/pen.js.map +1 -1
- package/dist/editor/shapes.d.ts.map +1 -1
- package/dist/editor/shapes.js +2 -1
- package/dist/editor/shapes.js.map +1 -1
- package/dist/editor/structure/auto-layout-wrap.d.ts.map +1 -1
- package/dist/editor/structure/auto-layout-wrap.js +12 -0
- package/dist/editor/structure/auto-layout-wrap.js.map +1 -1
- package/dist/editor/structure/boolean.js +1 -1
- package/dist/editor/structure/group/bounds.d.ts +4 -2
- package/dist/editor/structure/group/bounds.d.ts.map +1 -1
- package/dist/editor/structure/group/bounds.js +17 -4
- package/dist/editor/structure/group/bounds.js.map +1 -1
- package/dist/editor/structure/rename.d.ts +2 -3
- package/dist/editor/structure/rename.d.ts.map +1 -1
- package/dist/editor/structure/rename.js +2 -5
- package/dist/editor/structure/rename.js.map +1 -1
- package/dist/editor/structure/reorder.d.ts.map +1 -1
- package/dist/editor/structure/reorder.js +20 -9
- package/dist/editor/structure/reorder.js.map +1 -1
- package/dist/editor/structure/state.js +1 -1
- package/dist/editor/structure.d.ts +1 -0
- package/dist/editor/structure.d.ts.map +1 -1
- package/dist/editor/structure.js +76 -20
- package/dist/editor/structure.js.map +1 -1
- package/dist/editor/text/hyperlink.d.ts.map +1 -1
- package/dist/editor/text/hyperlink.js +1 -1
- package/dist/editor/text/hyperlink.js.map +1 -1
- package/dist/editor/text/name.d.ts +13 -5
- package/dist/editor/text/name.d.ts.map +1 -1
- package/dist/editor/text/name.js +47 -17
- package/dist/editor/text/name.js.map +1 -1
- package/dist/editor/text/pending-layout.d.ts +2 -1
- package/dist/editor/text/pending-layout.d.ts.map +1 -1
- package/dist/editor/text/pending-layout.js +33 -6
- package/dist/editor/text/pending-layout.js.map +1 -1
- package/dist/editor/text/selection-style.d.ts +1 -0
- package/dist/editor/text/selection-style.d.ts.map +1 -1
- package/dist/editor/text/selection-style.js +16 -4
- package/dist/editor/text/selection-style.js.map +1 -1
- package/dist/editor/text.d.ts +5 -0
- package/dist/editor/text.d.ts.map +1 -1
- package/dist/editor/text.js +70 -3
- package/dist/editor/text.js.map +1 -1
- package/dist/editor/types.d.ts +18 -1
- package/dist/editor/types.d.ts.map +1 -1
- package/dist/editor/undo.d.ts.map +1 -1
- package/dist/editor/undo.js +14 -2
- package/dist/editor/undo.js.map +1 -1
- package/dist/editor/variable-bindings.d.ts.map +1 -1
- package/dist/editor/variable-bindings.js +21 -2
- package/dist/editor/variable-bindings.js.map +1 -1
- package/dist/editor/variables.d.ts +1 -1
- package/dist/editor/variables.d.ts.map +1 -1
- package/dist/editor/variables.js +7 -8
- package/dist/editor/variables.js.map +1 -1
- package/dist/editor/viewport.d.ts +11 -2
- package/dist/editor/viewport.d.ts.map +1 -1
- package/dist/editor/viewport.js +61 -21
- package/dist/editor/viewport.js.map +1 -1
- package/dist/editor/views/actions.d.ts.map +1 -1
- package/dist/editor/views/actions.js +13 -5
- package/dist/editor/views/actions.js.map +1 -1
- package/dist/editor/views/present.d.ts +6 -4
- package/dist/editor/views/present.d.ts.map +1 -1
- package/dist/editor/views/present.js +12 -10
- package/dist/editor/views/present.js.map +1 -1
- package/dist/editor/views/types.d.ts +11 -5
- package/dist/editor/views/types.d.ts.map +1 -1
- package/dist/figma-api/accessor-utils.d.ts.map +1 -1
- package/dist/figma-api/accessor-utils.js +4 -1
- package/dist/figma-api/accessor-utils.js.map +1 -1
- package/dist/figma-api/accessors/basic.d.ts.map +1 -1
- package/dist/figma-api/accessors/basic.js +41 -21
- package/dist/figma-api/accessors/basic.js.map +1 -1
- package/dist/figma-api/accessors/layout.d.ts.map +1 -1
- package/dist/figma-api/accessors/layout.js +37 -7
- package/dist/figma-api/accessors/layout.js.map +1 -1
- package/dist/figma-api/accessors/reactions.d.ts +11 -0
- package/dist/figma-api/accessors/reactions.d.ts.map +1 -0
- package/dist/figma-api/accessors/reactions.js +30 -0
- package/dist/figma-api/accessors/reactions.js.map +1 -0
- package/dist/figma-api/accessors/strokes.d.ts.map +1 -1
- package/dist/figma-api/accessors/strokes.js +12 -4
- package/dist/figma-api/accessors/strokes.js.map +1 -1
- package/dist/figma-api/accessors/text/index.d.ts.map +1 -1
- package/dist/figma-api/accessors/text/index.js +3 -1
- package/dist/figma-api/accessors/text/index.js.map +1 -1
- package/dist/figma-api/accessors/vector.d.ts.map +1 -1
- package/dist/figma-api/accessors/vector.js +1 -1
- package/dist/figma-api/accessors/vector.js.map +1 -1
- package/dist/figma-api/accessors/visual.d.ts +6 -5
- package/dist/figma-api/accessors/visual.d.ts.map +1 -1
- package/dist/figma-api/accessors/visual.js +20 -17
- package/dist/figma-api/accessors/visual.js.map +1 -1
- package/dist/figma-api/components.d.ts.map +1 -1
- package/dist/figma-api/components.js +2 -1
- package/dist/figma-api/components.js.map +1 -1
- package/dist/figma-api/finite.d.ts +27 -0
- package/dist/figma-api/finite.d.ts.map +1 -0
- package/dist/figma-api/finite.js +69 -0
- package/dist/figma-api/finite.js.map +1 -0
- package/dist/figma-api/fonts/list.d.ts +13 -0
- package/dist/figma-api/fonts/list.d.ts.map +1 -0
- package/dist/figma-api/fonts/list.js +25 -0
- package/dist/figma-api/fonts/list.js.map +1 -0
- package/dist/figma-api/index.d.ts +21 -3
- package/dist/figma-api/index.d.ts.map +1 -1
- package/dist/figma-api/index.js +58 -13
- package/dist/figma-api/index.js.map +1 -1
- package/dist/figma-api/overrides.d.ts +6 -1
- package/dist/figma-api/overrides.d.ts.map +1 -1
- package/dist/figma-api/overrides.js +2 -2
- package/dist/figma-api/overrides.js.map +1 -1
- package/dist/figma-api/pending-layout.d.ts +12 -2
- package/dist/figma-api/pending-layout.d.ts.map +1 -1
- package/dist/figma-api/pending-layout.js +41 -1
- package/dist/figma-api/pending-layout.js.map +1 -1
- package/dist/figma-api/pending-sync.d.ts +19 -0
- package/dist/figma-api/pending-sync.d.ts.map +1 -0
- package/dist/figma-api/pending-sync.js +52 -0
- package/dist/figma-api/pending-sync.js.map +1 -0
- package/dist/figma-api/proxy.d.ts +15 -2
- package/dist/figma-api/proxy.d.ts.map +1 -1
- package/dist/figma-api/proxy.js +23 -3
- package/dist/figma-api/proxy.js.map +1 -1
- package/dist/figma-api/reactions.d.ts +104 -0
- package/dist/figma-api/reactions.d.ts.map +1 -0
- package/dist/figma-api/reactions.js +157 -0
- package/dist/figma-api/reactions.js.map +1 -0
- package/dist/figma-api/render-bounds.d.ts.map +1 -1
- package/dist/figma-api/render-bounds.js +4 -4
- package/dist/figma-api/render-bounds.js.map +1 -1
- package/dist/figma-api/serialization.js +2 -2
- package/dist/figma-api/serialization.js.map +1 -1
- package/dist/figma-api/slots.d.ts +7 -1
- package/dist/figma-api/slots.d.ts.map +1 -1
- package/dist/figma-api/slots.js +12 -4
- package/dist/figma-api/slots.js.map +1 -1
- package/dist/figma-api/strokes.d.ts +5 -2
- package/dist/figma-api/strokes.d.ts.map +1 -1
- package/dist/figma-api/strokes.js +12 -19
- package/dist/figma-api/strokes.js.map +1 -1
- package/dist/figma-api/text/bindings.js +1 -1
- package/dist/figma-api/text/index.d.ts +2 -3
- package/dist/figma-api/text/index.d.ts.map +1 -1
- package/dist/figma-api/text/index.js +2 -12
- package/dist/figma-api/text/index.js.map +1 -1
- package/dist/figma-api/variables/bindings.js +1 -1
- package/dist/figma-api/variables/variable.d.ts.map +1 -1
- package/dist/figma-api/variables/variable.js +2 -2
- package/dist/figma-api/variables/variable.js.map +1 -1
- package/dist/geometry/figma.d.ts +6 -1
- package/dist/geometry/figma.d.ts.map +1 -1
- package/dist/geometry/figma.js +8 -1
- package/dist/geometry/figma.js.map +1 -1
- package/dist/geometry/index.d.ts +2 -2
- package/dist/geometry/index.js +2 -2
- package/dist/icons/api.d.ts +3 -2
- package/dist/icons/api.d.ts.map +1 -1
- package/dist/icons/api.js +12 -12
- package/dist/icons/api.js.map +1 -1
- package/dist/icons/provider.d.ts +4 -3
- package/dist/icons/provider.d.ts.map +1 -1
- package/dist/icons/provider.js +6 -13
- package/dist/icons/provider.js.map +1 -1
- package/dist/icons/schema.d.ts +33 -1
- package/dist/icons/schema.d.ts.map +1 -1
- package/dist/icons/schema.js +30 -1
- package/dist/icons/schema.js.map +1 -1
- package/dist/icons/svg/presentation.d.ts +8 -1
- package/dist/icons/svg/presentation.d.ts.map +1 -1
- package/dist/icons/svg/presentation.js +21 -3
- package/dist/icons/svg/presentation.js.map +1 -1
- package/dist/icons/svg/text.js +1 -1
- package/dist/icons/svg/text.js.map +1 -1
- package/dist/icons/svg.d.ts +8 -3
- package/dist/icons/svg.d.ts.map +1 -1
- package/dist/icons/svg.js +15 -13
- package/dist/icons/svg.js.map +1 -1
- package/dist/icons/types.d.ts +1 -19
- package/dist/icons/types.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/io/formats/design-tokens/css/read.js +1 -1
- package/dist/io/formats/design-tokens/decode.js +1 -1
- package/dist/io/formats/design-tokens/plan/index.js +4 -2
- package/dist/io/formats/design-tokens/plan/index.js.map +1 -1
- package/dist/io/formats/design-tokens/plan/styles.d.ts +9 -1
- package/dist/io/formats/design-tokens/plan/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/plan/styles.js +23 -3
- package/dist/io/formats/design-tokens/plan/styles.js.map +1 -1
- package/dist/io/formats/design-tokens/styles.d.ts +9 -1
- package/dist/io/formats/design-tokens/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/styles.js +41 -4
- package/dist/io/formats/design-tokens/styles.js.map +1 -1
- package/dist/io/formats/design-tokens/types.d.ts +5 -0
- package/dist/io/formats/design-tokens/types.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/types.js +1 -0
- package/dist/io/formats/design-tokens/types.js.map +1 -1
- package/dist/io/formats/fig/export/setup.d.ts.map +1 -1
- package/dist/io/formats/fig/export/setup.js +8 -4
- 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 +2 -2
- package/dist/io/formats/fig/export/variables.js.map +1 -1
- package/dist/io/formats/fig/index.d.ts +2 -2
- package/dist/io/formats/fig/index.js +2 -2
- package/dist/io/formats/fig/read.d.ts +9 -2
- package/dist/io/formats/fig/read.d.ts.map +1 -1
- package/dist/io/formats/fig/read.js +44 -20
- package/dist/io/formats/fig/read.js.map +1 -1
- package/dist/io/formats/html/index.d.ts.map +1 -1
- package/dist/io/formats/html/index.js +2 -6
- package/dist/io/formats/html/index.js.map +1 -1
- package/dist/io/formats/pdf/dom.d.ts.map +1 -1
- package/dist/io/formats/pdf/dom.js +65 -1
- package/dist/io/formats/pdf/dom.js.map +1 -1
- package/dist/io/formats/pdf/prepare.js +1 -1
- package/dist/io/formats/pen/fonts.d.ts +14 -0
- package/dist/io/formats/pen/fonts.d.ts.map +1 -0
- package/dist/io/formats/pen/fonts.js +39 -0
- package/dist/io/formats/pen/fonts.js.map +1 -0
- package/dist/io/formats/pen/index.d.ts.map +1 -1
- package/dist/io/formats/pen/index.js +25 -6
- package/dist/io/formats/pen/index.js.map +1 -1
- package/dist/io/formats/raster/headless.d.ts +2 -2
- package/dist/io/formats/raster/headless.d.ts.map +1 -1
- package/dist/io/formats/raster/headless.js +24 -13
- 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/index.js +2 -2
- package/dist/io/formats/raster/render.d.ts +7 -1
- package/dist/io/formats/raster/render.d.ts.map +1 -1
- package/dist/io/formats/raster/render.js +40 -6
- package/dist/io/formats/raster/render.js.map +1 -1
- package/dist/io/formats/svg/export.d.ts.map +1 -1
- package/dist/io/formats/svg/export.js +28 -24
- package/dist/io/formats/svg/export.js.map +1 -1
- package/dist/io/formats/svg/paths.d.ts +8 -2
- package/dist/io/formats/svg/paths.d.ts.map +1 -1
- package/dist/io/formats/svg/paths.js +11 -3
- package/dist/io/formats/svg/paths.js.map +1 -1
- package/dist/io/formats/svg/strokes.d.ts.map +1 -1
- package/dist/io/formats/svg/strokes.js +2 -5
- 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 +19 -1
- package/dist/io/formats/svg/text/export.js.map +1 -1
- package/dist/io/formats/svg/text/import.d.ts.map +1 -1
- package/dist/io/formats/svg/text/import.js +2 -1
- package/dist/io/formats/svg/text/import.js.map +1 -1
- package/dist/io/subgraph.d.ts.map +1 -1
- package/dist/io/subgraph.js +5 -2
- package/dist/io/subgraph.js.map +1 -1
- package/dist/kiwi/fig/population/client.d.ts.map +1 -1
- package/dist/kiwi/fig/population/client.js +63 -45
- package/dist/kiwi/fig/population/client.js.map +1 -1
- package/dist/kiwi/fig/population/delta.d.ts +34 -3
- package/dist/kiwi/fig/population/delta.d.ts.map +1 -1
- package/dist/kiwi/fig/population/delta.js +99 -16
- package/dist/kiwi/fig/population/delta.js.map +1 -1
- package/dist/kiwi/fig/population/edits.d.ts +51 -0
- package/dist/kiwi/fig/population/edits.d.ts.map +1 -0
- package/dist/kiwi/fig/population/edits.js +169 -0
- package/dist/kiwi/fig/population/edits.js.map +1 -0
- package/dist/kiwi/fig/session/archive/access.d.ts +3 -0
- package/dist/kiwi/fig/session/archive/access.d.ts.map +1 -1
- package/dist/kiwi/fig/session/archive/access.js +8 -1
- package/dist/kiwi/fig/session/archive/access.js.map +1 -1
- package/dist/kiwi/fig/session/archive/changes.d.ts +2 -1
- package/dist/kiwi/fig/session/archive/changes.d.ts.map +1 -1
- package/dist/kiwi/fig/session/archive/changes.js +12 -5
- package/dist/kiwi/fig/session/archive/changes.js.map +1 -1
- package/dist/kiwi/fig/session/document-state.d.ts +7 -1
- package/dist/kiwi/fig/session/document-state.d.ts.map +1 -1
- package/dist/kiwi/fig/session/document-state.js +16 -2
- package/dist/kiwi/fig/session/document-state.js.map +1 -1
- package/dist/kiwi/fig/session/protocol.d.ts +31 -3
- package/dist/kiwi/fig/session/protocol.d.ts.map +1 -1
- package/dist/kiwi/fig/session/worker.js +33 -8
- package/dist/kiwi/fig/session/worker.js.map +1 -1
- package/dist/layout/apply.d.ts +6 -1
- package/dist/layout/apply.d.ts.map +1 -1
- package/dist/layout/apply.js +39 -14
- package/dist/layout/apply.js.map +1 -1
- package/dist/layout/arrange/boxes.d.ts.map +1 -1
- package/dist/layout/arrange/boxes.js +31 -0
- package/dist/layout/arrange/boxes.js.map +1 -1
- package/dist/layout/flow-edges.d.ts +26 -0
- package/dist/layout/flow-edges.d.ts.map +1 -0
- package/dist/layout/flow-edges.js +105 -0
- package/dist/layout/flow-edges.js.map +1 -0
- package/dist/layout/grid.d.ts.map +1 -1
- package/dist/layout/grid.js +9 -5
- package/dist/layout/grid.js.map +1 -1
- package/dist/layout/text-auto-resize.d.ts.map +1 -1
- package/dist/layout/text-auto-resize.js +9 -4
- package/dist/layout/text-auto-resize.js.map +1 -1
- package/dist/layout/text-measurement.d.ts +15 -1
- package/dist/layout/text-measurement.d.ts.map +1 -1
- package/dist/layout/text-measurement.js +40 -4
- package/dist/layout/text-measurement.js.map +1 -1
- package/dist/layout/variables.d.ts +1 -1
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +35 -35
- package/dist/layout.js.map +1 -1
- package/dist/library/asset-keys.d.ts +3 -2
- package/dist/library/asset-keys.d.ts.map +1 -1
- package/dist/library/asset-keys.js +4 -3
- package/dist/library/asset-keys.js.map +1 -1
- package/dist/library/copied-references.d.ts +8 -3
- package/dist/library/copied-references.d.ts.map +1 -1
- package/dist/library/copied-references.js +15 -5
- package/dist/library/copied-references.js.map +1 -1
- package/dist/library/materialize.js +1 -1
- package/dist/library/materialize.js.map +1 -1
- package/dist/library/schema.js.map +1 -1
- package/dist/library/snapshot.d.ts.map +1 -1
- package/dist/library/snapshot.js +10 -2
- package/dist/library/snapshot.js.map +1 -1
- package/dist/pairdraw-api/variables.d.ts.map +1 -1
- package/dist/pairdraw-api/variables.js +0 -2
- package/dist/pairdraw-api/variables.js.map +1 -1
- package/dist/profiler/hud-controller.d.ts +4 -3
- package/dist/profiler/hud-controller.d.ts.map +1 -1
- package/dist/profiler/hud-controller.js +7 -5
- package/dist/profiler/hud-controller.js.map +1 -1
- package/dist/profiler/hud-renderer.d.ts +5 -2
- package/dist/profiler/hud-renderer.d.ts.map +1 -1
- package/dist/profiler/hud-renderer.js +8 -5
- package/dist/profiler/hud-renderer.js.map +1 -1
- package/dist/profiler/render-profiler.d.ts +3 -2
- package/dist/profiler/render-profiler.d.ts.map +1 -1
- package/dist/profiler/render-profiler.js +3 -2
- package/dist/profiler/render-profiler.js.map +1 -1
- package/dist/text/character-style.d.ts +11 -1
- package/dist/text/character-style.d.ts.map +1 -1
- package/dist/text/character-style.js +27 -5
- package/dist/text/character-style.js.map +1 -1
- package/dist/text/coverage.d.ts.map +1 -1
- package/dist/text/coverage.js +15 -16
- package/dist/text/coverage.js.map +1 -1
- package/dist/text/editor.d.ts.map +1 -1
- package/dist/text/editor.js +3 -8
- package/dist/text/editor.js.map +1 -1
- package/dist/text/fallbacks.d.ts +19 -2
- package/dist/text/fallbacks.d.ts.map +1 -1
- package/dist/text/fallbacks.js +63 -12
- package/dist/text/fallbacks.js.map +1 -1
- package/dist/text/font/catalog.d.ts +4 -0
- package/dist/text/font/catalog.d.ts.map +1 -1
- package/dist/text/font/catalog.js +8 -0
- package/dist/text/font/catalog.js.map +1 -1
- package/dist/text/font/collection.d.ts +13 -0
- package/dist/text/font/collection.d.ts.map +1 -0
- package/dist/text/font/collection.js +51 -0
- package/dist/text/font/collection.js.map +1 -0
- package/dist/text/font/faces.d.ts +2 -1
- package/dist/text/font/faces.d.ts.map +1 -1
- package/dist/text/font/faces.js +9 -5
- package/dist/text/font/faces.js.map +1 -1
- package/dist/text/font/glyphs.d.ts +14 -3
- package/dist/text/font/glyphs.d.ts.map +1 -1
- package/dist/text/font/glyphs.js +22 -5
- package/dist/text/font/glyphs.js.map +1 -1
- package/dist/text/font/local.js +2 -2
- package/dist/text/font/local.js.map +1 -1
- package/dist/text/font/manager.d.ts +36 -0
- package/dist/text/font/manager.d.ts.map +1 -1
- package/dist/text/font/manager.js +139 -19
- package/dist/text/font/manager.js.map +1 -1
- package/dist/text/font/style.d.ts +7 -2
- package/dist/text/font/style.d.ts.map +1 -1
- package/dist/text/font/style.js +31 -3
- package/dist/text/font/style.js.map +1 -1
- package/dist/text/index.d.ts +5 -4
- package/dist/text/index.js +5 -4
- package/dist/text/outlines.d.ts.map +1 -1
- package/dist/text/outlines.js +70 -70
- package/dist/text/outlines.js.map +1 -1
- package/dist/text/prepare.d.ts.map +1 -1
- package/dist/text/prepare.js +7 -1
- package/dist/text/prepare.js.map +1 -1
- package/dist/text/style-runs.d.ts +14 -2
- package/dist/text/style-runs.d.ts.map +1 -1
- package/dist/text/style-runs.js +22 -14
- package/dist/text/style-runs.js.map +1 -1
- package/dist/tools/analyze/overlaps/helpers.d.ts.map +1 -1
- package/dist/tools/analyze/overlaps/helpers.js +9 -1
- package/dist/tools/analyze/overlaps/helpers.js.map +1 -1
- package/dist/tools/analyze/overlaps/index.d.ts.map +1 -1
- package/dist/tools/analyze/overlaps/index.js +27 -5
- package/dist/tools/analyze/overlaps/index.js.map +1 -1
- package/dist/tools/codegen/component-map.js +3 -3
- package/dist/tools/codegen/component-map.js.map +1 -1
- package/dist/tools/create/basic.d.ts.map +1 -1
- package/dist/tools/create/basic.js +5 -4
- package/dist/tools/create/basic.js.map +1 -1
- package/dist/tools/create/html.d.ts.map +1 -1
- package/dist/tools/create/html.js +4 -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 +3 -1
- package/dist/tools/create/icons.js.map +1 -1
- package/dist/tools/create/mermaid.d.ts.map +1 -1
- package/dist/tools/create/mermaid.js +2 -0
- package/dist/tools/create/mermaid.js.map +1 -1
- package/dist/tools/create/render.d.ts.map +1 -1
- package/dist/tools/create/render.js +2 -0
- package/dist/tools/create/render.js.map +1 -1
- package/dist/tools/create/script.js +3 -1
- package/dist/tools/create/script.js.map +1 -1
- package/dist/tools/create/svg.d.ts.map +1 -1
- package/dist/tools/create/svg.js +4 -1
- package/dist/tools/create/svg.js.map +1 -1
- package/dist/tools/create/vector.d.ts.map +1 -1
- package/dist/tools/create/vector.js +4 -4
- package/dist/tools/create/vector.js.map +1 -1
- package/dist/tools/image-ai/apply.js +1 -1
- package/dist/tools/image-ai/generate.d.ts.map +1 -1
- package/dist/tools/image-ai/generate.js +3 -0
- package/dist/tools/image-ai/generate.js.map +1 -1
- package/dist/tools/modify/matching.js +1 -1
- package/dist/tools/modify/reactions.d.ts +6 -0
- package/dist/tools/modify/reactions.d.ts.map +1 -0
- package/dist/tools/modify/reactions.js +35 -0
- package/dist/tools/modify/reactions.js.map +1 -0
- package/dist/tools/modify.d.ts +2 -1
- package/dist/tools/modify.js +2 -1
- package/dist/tools/read/components.js +20 -22
- package/dist/tools/read/components.js.map +1 -1
- package/dist/tools/read/fonts.js +1 -1
- package/dist/tools/read/fonts.js.map +1 -1
- package/dist/tools/read/libraries.d.ts.map +1 -1
- package/dist/tools/read/libraries.js +2 -0
- package/dist/tools/read/libraries.js.map +1 -1
- package/dist/tools/read/nodes.d.ts.map +1 -1
- package/dist/tools/read/nodes.js +38 -16
- package/dist/tools/read/nodes.js.map +1 -1
- package/dist/tools/read/pages.d.ts.map +1 -1
- package/dist/tools/read/pages.js +4 -3
- package/dist/tools/read/pages.js.map +1 -1
- package/dist/tools/read/query.js +1 -0
- package/dist/tools/read/query.js.map +1 -1
- package/dist/tools/read/reactions.d.ts +6 -0
- package/dist/tools/read/reactions.d.ts.map +1 -0
- package/dist/tools/read/reactions.js +24 -0
- package/dist/tools/read/reactions.js.map +1 -0
- package/dist/tools/read/space.js +1 -1
- package/dist/tools/read.d.ts +2 -1
- package/dist/tools/read.js +2 -1
- package/dist/tools/registry/extended.d.ts.map +1 -1
- package/dist/tools/registry/extended.js +4 -0
- package/dist/tools/registry/extended.js.map +1 -1
- package/dist/tools/schema.d.ts +6 -0
- package/dist/tools/schema.d.ts.map +1 -1
- package/dist/tools/schema.js +53 -9
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/stock-photo/apply.js +8 -9
- package/dist/tools/stock-photo/apply.js.map +1 -1
- package/dist/tools/structure/batch.d.ts.map +1 -1
- package/dist/tools/structure/batch.js +85 -90
- package/dist/tools/structure/batch.js.map +1 -1
- package/dist/vector/fill-geometry.d.ts +4 -1
- package/dist/vector/fill-geometry.d.ts.map +1 -1
- package/dist/vector/fill-geometry.js +8 -5
- package/dist/vector/fill-geometry.js.map +1 -1
- package/dist/vector/index.js +1 -1
- package/dist/vector/index.js.map +1 -1
- package/dist/vector/path-helpers.d.ts +1 -1
- package/dist/vector/path-helpers.d.ts.map +1 -1
- package/dist/vector/path-helpers.js +24 -7
- package/dist/vector/path-helpers.js.map +1 -1
- package/dist/vector/placement.js +1 -1
- package/dist/vector/placement.js.map +1 -1
- package/dist/vector/vectorize/preprocess.js +1 -1
- package/dist/vector/vectorize/preprocess.js.map +1 -1
- package/package.json +10 -10
- package/src/canvas/effects.ts +29 -33
- package/src/canvas/labels/hit-test.ts +6 -2
- package/src/canvas/labels/paragraph-cache.ts +2 -1
- package/src/canvas/labels/selection.ts +3 -3
- package/src/canvas/node-edit-overlay.ts +3 -2
- package/src/canvas/overlays/index.ts +0 -1
- package/src/canvas/overlays/selection.ts +4 -52
- package/src/canvas/region-hatch.ts +7 -2
- package/src/canvas/renderer/colors.ts +41 -26
- package/src/canvas/renderer/font-waiters.ts +25 -0
- package/src/canvas/renderer/fonts.ts +40 -17
- package/src/canvas/renderer/lifecycle.ts +8 -10
- package/src/canvas/renderer/methods.ts +9 -13
- package/src/canvas/renderer/paints.ts +0 -10
- package/src/canvas/renderer/pipeline.ts +29 -3
- package/src/canvas/renderer/retained-backing.ts +4 -4
- package/src/canvas/renderer/state.ts +1 -1
- package/src/canvas/renderer/tiles/controller.ts +8 -0
- package/src/canvas/renderer/tiles/surface-pool.ts +1 -1
- package/src/canvas/renderer/visual-bounds.ts +7 -6
- package/src/canvas/renderer.ts +39 -11
- package/src/canvas/rulers.ts +55 -26
- package/src/canvas/scene.ts +37 -16
- package/src/canvas/shadows/shape.ts +1 -1
- package/src/canvas/shadows/silhouette.ts +4 -2
- package/src/canvas/shadows.ts +4 -2
- package/src/canvas/text/derived.ts +0 -9
- package/src/canvas/text/emoji/raster.ts +14 -10
- package/src/canvas/text/font-families.ts +6 -0
- package/src/canvas/text/index.ts +0 -8
- package/src/canvas/text/layout/build.ts +35 -18
- package/src/canvas/text/layout/index.ts +15 -6
- package/src/canvas/text/layout/lines.ts +10 -4
- package/src/canvas/text/paragraph/index.ts +17 -8
- package/src/canvas/text/paragraph/inputs.ts +4 -2
- package/src/canvas/text/shape.ts +20 -31
- package/src/constants.ts +6 -1
- package/src/editor/bridges/clipboard.ts +1 -0
- package/src/editor/bridges/components.ts +2 -0
- package/src/editor/bridges/frames.ts +6 -4
- package/src/editor/bridges/structure.ts +1 -0
- package/src/editor/clipboard/detach.ts +3 -3
- package/src/editor/clipboard/paste/target.ts +2 -2
- package/src/editor/clipboard/snapshot.ts +7 -0
- package/src/editor/clipboard/variables.ts +20 -0
- package/src/editor/clipboard.ts +133 -14
- package/src/editor/component-sync.ts +28 -7
- package/src/editor/components/authoring/text-edit.ts +15 -2
- package/src/editor/components/authoring/visibility-edit.ts +11 -3
- package/src/editor/components/instances.ts +61 -11
- package/src/editor/components/properties.ts +10 -0
- package/src/editor/components/slots/authoring.ts +4 -1
- package/src/editor/create.ts +58 -8
- package/src/editor/guides.ts +27 -12
- package/src/editor/history/document-change.ts +115 -7
- package/src/editor/history/edit.ts +62 -14
- package/src/editor/history/position.ts +1 -4
- package/src/editor/history/sources.ts +25 -0
- package/src/editor/index.ts +3 -1
- package/src/editor/layout-mode.ts +20 -1
- package/src/editor/node-preview.ts +44 -8
- package/src/editor/nodes.ts +52 -12
- package/src/editor/nudge.ts +16 -2
- package/src/editor/pages.ts +100 -17
- package/src/editor/play/states.ts +0 -7
- package/src/editor/read-only/actions.ts +4 -0
- package/src/editor/selection/hit-test.ts +37 -4
- package/src/editor/shapes/pen.ts +6 -3
- package/src/editor/shapes.ts +2 -1
- package/src/editor/structure/auto-layout-wrap.ts +26 -0
- package/src/editor/structure/group/bounds.ts +22 -4
- package/src/editor/structure/rename.ts +2 -6
- package/src/editor/structure/reorder.ts +26 -8
- package/src/editor/structure.ts +88 -24
- package/src/editor/text/hyperlink.ts +2 -1
- package/src/editor/text/name.ts +51 -15
- package/src/editor/text/pending-layout.ts +42 -4
- package/src/editor/text/selection-style.ts +17 -3
- package/src/editor/text.ts +86 -4
- package/src/editor/types.ts +19 -0
- package/src/editor/undo.ts +21 -2
- package/src/editor/variable-bindings.ts +22 -2
- package/src/editor/variables.ts +10 -6
- package/src/editor/viewport.ts +55 -21
- package/src/editor/views/actions.ts +17 -7
- package/src/editor/views/present.ts +20 -11
- package/src/editor/views/types.ts +11 -5
- package/src/figma-api/accessor-utils.ts +4 -1
- package/src/figma-api/accessors/basic.ts +54 -18
- package/src/figma-api/accessors/layout.ts +46 -7
- package/src/figma-api/accessors/reactions.ts +29 -0
- package/src/figma-api/accessors/strokes.ts +28 -8
- package/src/figma-api/accessors/text/index.ts +4 -0
- package/src/figma-api/accessors/vector.ts +3 -1
- package/src/figma-api/accessors/visual.ts +25 -28
- package/src/figma-api/components.ts +9 -7
- package/src/figma-api/finite.ts +102 -0
- package/src/figma-api/fonts/list.ts +24 -0
- package/src/figma-api/index.ts +82 -12
- package/src/figma-api/overrides.ts +1 -1
- package/src/figma-api/pending-layout.ts +50 -1
- package/src/figma-api/pending-sync.ts +61 -0
- package/src/figma-api/proxy.ts +35 -2
- package/src/figma-api/reactions.ts +212 -0
- package/src/figma-api/render-bounds.ts +13 -4
- package/src/figma-api/serialization.ts +2 -2
- package/src/figma-api/slots.ts +12 -3
- package/src/figma-api/strokes.ts +16 -12
- package/src/figma-api/text/index.ts +9 -15
- package/src/figma-api/variables/variable.ts +3 -2
- package/src/geometry/figma.ts +9 -0
- package/src/geometry/index.ts +1 -0
- package/src/global.d.ts +6 -0
- package/src/icons/api.ts +27 -16
- package/src/icons/provider.ts +9 -20
- package/src/icons/schema.ts +31 -0
- package/src/icons/svg/presentation.ts +27 -3
- package/src/icons/svg/text.ts +1 -1
- package/src/icons/svg.ts +21 -19
- package/src/icons/types.ts +0 -14
- package/src/io/formats/design-tokens/plan/index.ts +7 -1
- package/src/io/formats/design-tokens/plan/styles.ts +40 -4
- package/src/io/formats/design-tokens/styles.ts +60 -3
- package/src/io/formats/design-tokens/types.ts +3 -0
- package/src/io/formats/fig/export/setup.ts +16 -14
- package/src/io/formats/fig/export/variables.ts +7 -8
- package/src/io/formats/fig/index.ts +1 -0
- package/src/io/formats/fig/read.ts +66 -23
- package/src/io/formats/html/index.ts +2 -6
- package/src/io/formats/pdf/dom.ts +96 -3
- package/src/io/formats/pen/fonts.ts +45 -0
- package/src/io/formats/pen/index.ts +30 -6
- package/src/io/formats/raster/headless.ts +31 -12
- package/src/io/formats/raster/index.ts +3 -0
- package/src/io/formats/raster/render.ts +62 -6
- package/src/io/formats/svg/export.ts +24 -25
- package/src/io/formats/svg/paths.ts +11 -2
- package/src/io/formats/svg/strokes.ts +8 -2
- package/src/io/formats/svg/text/export.ts +23 -0
- package/src/io/formats/svg/text/import.ts +2 -1
- package/src/io/subgraph.ts +3 -1
- package/src/kiwi/fig/population/client.ts +77 -43
- package/src/kiwi/fig/population/delta.ts +141 -18
- package/src/kiwi/fig/population/edits.ts +235 -0
- package/src/kiwi/fig/session/archive/access.ts +15 -0
- package/src/kiwi/fig/session/archive/changes.ts +27 -6
- package/src/kiwi/fig/session/document-state.ts +23 -1
- package/src/kiwi/fig/session/protocol.ts +26 -1
- package/src/kiwi/fig/session/worker.ts +38 -11
- package/src/layout/apply.ts +52 -10
- package/src/layout/arrange/boxes.ts +36 -0
- package/src/layout/flow-edges.ts +139 -0
- package/src/layout/grid.ts +14 -4
- package/src/layout/text-auto-resize.ts +13 -4
- package/src/layout/text-measurement.ts +46 -3
- package/src/layout.ts +60 -66
- package/src/library/asset-keys.ts +4 -3
- package/src/library/copied-references.ts +29 -5
- package/src/library/materialize.ts +1 -1
- package/src/library/schema.ts +1 -1
- package/src/library/snapshot.ts +11 -2
- package/src/pairdraw-api/variables.ts +1 -3
- package/src/profiler/hud-controller.ts +8 -6
- package/src/profiler/hud-renderer.ts +9 -6
- package/src/profiler/render-profiler.ts +4 -3
- package/src/text/character-style.ts +29 -9
- package/src/text/coverage.ts +17 -18
- package/src/text/editor.ts +3 -8
- package/src/text/fallbacks.ts +82 -15
- package/src/text/font/catalog.ts +10 -0
- package/src/text/font/collection.ts +60 -0
- package/src/text/font/faces.ts +9 -5
- package/src/text/font/glyphs.ts +29 -4
- package/src/text/font/local.ts +2 -2
- package/src/text/font/manager.ts +170 -32
- package/src/text/font/style.ts +52 -3
- package/src/text/index.ts +1 -0
- package/src/text/outlines.ts +105 -89
- package/src/text/prepare.ts +17 -0
- package/src/text/style-runs.ts +43 -16
- package/src/tools/analyze/overlaps/helpers.ts +18 -1
- package/src/tools/analyze/overlaps/index.ts +37 -6
- package/src/tools/codegen/component-map.ts +3 -3
- package/src/tools/create/basic.ts +6 -4
- package/src/tools/create/html.ts +3 -1
- package/src/tools/create/icons.ts +3 -1
- package/src/tools/create/mermaid.ts +2 -0
- package/src/tools/create/render.ts +2 -0
- package/src/tools/create/script.ts +5 -1
- package/src/tools/create/svg.ts +4 -1
- package/src/tools/create/vector.ts +4 -4
- package/src/tools/image-ai/generate.ts +3 -0
- package/src/tools/modify/reactions.ts +40 -0
- package/src/tools/modify.ts +1 -0
- package/src/tools/read/components.ts +28 -25
- package/src/tools/read/fonts.ts +1 -1
- package/src/tools/read/libraries.ts +3 -0
- package/src/tools/read/nodes.ts +47 -17
- package/src/tools/read/pages.ts +7 -4
- package/src/tools/read/query.ts +2 -0
- package/src/tools/read/reactions.ts +21 -0
- package/src/tools/read.ts +1 -0
- package/src/tools/registry/extended.ts +4 -0
- package/src/tools/schema.ts +68 -12
- package/src/tools/stock-photo/apply.ts +17 -5
- package/src/tools/structure/batch.ts +82 -101
- package/src/vector/fill-geometry.ts +11 -5
- package/src/vector/index.ts +1 -1
- package/src/vector/path-helpers.ts +34 -8
- package/src/vector/placement.ts +1 -1
- package/src/vector/vectorize/preprocess.ts +1 -1
|
@@ -4,6 +4,7 @@ import type { VectorNetwork } from '@pairdraw/scene-graph'
|
|
|
4
4
|
import { parseSVGPath } from '@pairdraw/scene-graph/parse-path'
|
|
5
5
|
import { transformVectorNetwork } from '@pairdraw/scene-graph/vector-network'
|
|
6
6
|
|
|
7
|
+
import { prepareSlotInsertion } from '#core/figma-api/slots'
|
|
7
8
|
import {
|
|
8
9
|
defineTool,
|
|
9
10
|
nodeSummary,
|
|
@@ -78,6 +79,8 @@ export const createVector = defineTool({
|
|
|
78
79
|
if ('error' in fill) return fill
|
|
79
80
|
const stroke = parseOptionalToolColor(args.stroke)
|
|
80
81
|
if ('error' in stroke) return stroke
|
|
82
|
+
const parent = args.parent_id ? figma.getNodeById(args.parent_id) : null
|
|
83
|
+
if (parent) prepareSlotInsertion(figma.graph, parent.id, 'create_vector')
|
|
81
84
|
|
|
82
85
|
const node = figma.createVector()
|
|
83
86
|
node.x = args.x
|
|
@@ -104,10 +107,7 @@ export const createVector = defineTool({
|
|
|
104
107
|
]
|
|
105
108
|
})
|
|
106
109
|
}
|
|
107
|
-
if (
|
|
108
|
-
const parent = figma.getNodeById(args.parent_id)
|
|
109
|
-
if (parent) parent.appendChild(node)
|
|
110
|
-
}
|
|
110
|
+
if (parent) parent.appendChild(node)
|
|
111
111
|
return nodeSummary(node)
|
|
112
112
|
}
|
|
113
113
|
})
|
|
@@ -5,6 +5,7 @@ import { imageSize } from '@pairdraw/scene-graph/images'
|
|
|
5
5
|
import type { Size } from '@pairdraw/scene-graph/primitives'
|
|
6
6
|
|
|
7
7
|
import { storeImage } from '#core/figma-api/images'
|
|
8
|
+
import { prepareSlotInsertion } from '#core/figma-api/slots'
|
|
8
9
|
import { importSVG } from '#core/tools/create/svg'
|
|
9
10
|
import { defineTool, nodeNotFound, toolFailure, toolNumber } from '#core/tools/schema'
|
|
10
11
|
import { vectorizableImageFill } from '#core/vector/vectorize'
|
|
@@ -131,6 +132,7 @@ export const generateImage = defineTool({
|
|
|
131
132
|
}
|
|
132
133
|
const parentId = args.parent_id ?? figma.currentPage.id
|
|
133
134
|
if (!target && !graph.getNode(parentId)) return { error: `Parent "${parentId}" not found` }
|
|
135
|
+
if (!target) prepareSlotInsertion(graph, parentId, 'generate_image')
|
|
134
136
|
const service = getImageAIService(graph)
|
|
135
137
|
if (!service) return { error: IMAGE_AI_UNAVAILABLE }
|
|
136
138
|
|
|
@@ -170,6 +172,7 @@ export const generateSVG = defineTool({
|
|
|
170
172
|
const graph = figma.graph
|
|
171
173
|
const parentId = args.parent_id ?? figma.currentPage.id
|
|
172
174
|
if (!graph.getNode(parentId)) return { error: `Parent "${parentId}" not found` }
|
|
175
|
+
prepareSlotInsertion(graph, parentId, 'generate_svg')
|
|
173
176
|
const service = getImageAIService(graph)
|
|
174
177
|
if (!service) return { error: IMAGE_AI_UNAVAILABLE }
|
|
175
178
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as v from 'valibot'
|
|
2
|
+
|
|
3
|
+
import { figmaReactionsSchema } from '#core/figma-api/reactions'
|
|
4
|
+
import { defineTool, nodeIdInputSchema, nodeNotFound, toolFailure } from '#core/tools/schema'
|
|
5
|
+
|
|
6
|
+
/** Connections in Figma's plugin shape, which the layer's `reactions` reads and writes. */
|
|
7
|
+
const reactionsInputSchema = v.pipe(
|
|
8
|
+
figmaReactionsSchema,
|
|
9
|
+
v.description(
|
|
10
|
+
"Prototype connections in Figma's plugin shape: [{ trigger: { type: 'ON_CLICK' } | " +
|
|
11
|
+
"{ type: 'AFTER_TIMEOUT', timeout: seconds }, actions: [{ type: 'NODE', " +
|
|
12
|
+
"destinationId: '<top-level frame id on the same page>', navigation: 'NAVIGATE' | " +
|
|
13
|
+
"'OVERLAY', transition: { type: 'INSTANT' | 'DISSOLVE', duration: seconds }, " +
|
|
14
|
+
"overlayRelativePosition?: 'CENTER' | ... } | { type: 'BACK' } | { type: 'CLOSE' }] }]"
|
|
15
|
+
)
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
export const setReactions = defineTool({
|
|
19
|
+
name: 'set_reactions',
|
|
20
|
+
|
|
21
|
+
description:
|
|
22
|
+
'Replace the prototype connections on a layer. Use get_reactions to read them back, and ' +
|
|
23
|
+
'point a NODE action at a top-level frame on the same page. Refuses a trigger, action, ' +
|
|
24
|
+
'transition, navigation or destination the prototype play cannot run.',
|
|
25
|
+
execution: { kind: 'sync', mutation: 'properties' },
|
|
26
|
+
input: v.strictObject({
|
|
27
|
+
id: nodeIdInputSchema,
|
|
28
|
+
reactions: reactionsInputSchema
|
|
29
|
+
}),
|
|
30
|
+
execute: (figma, { id, reactions }) => {
|
|
31
|
+
const node = figma.getNodeById(id)
|
|
32
|
+
if (!node) return nodeNotFound(id)
|
|
33
|
+
try {
|
|
34
|
+
node.reactions = reactions
|
|
35
|
+
} catch (error) {
|
|
36
|
+
return toolFailure(error)
|
|
37
|
+
}
|
|
38
|
+
return { id, reactions: node.reactions }
|
|
39
|
+
}
|
|
40
|
+
})
|
package/src/tools/modify.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { rescale, setMinMax, setOpacity, setRadius, setRotation } from './modify
|
|
|
3
3
|
export { setConstraints, setLayout, setLayoutChild } from './modify/layout'
|
|
4
4
|
export { replaceMatchingProperties } from './modify/matching'
|
|
5
5
|
export { setFill, setImageFill, setStroke } from './modify/paint'
|
|
6
|
+
export { setReactions } from './modify/reactions'
|
|
6
7
|
export { setBlend, setLocked, setStrokeAlign, setVisible } from './modify/state'
|
|
7
8
|
export { setFont, setFontRange, setText, setTextProperties, setTextResize } from './modify/text'
|
|
8
9
|
export { updateNode } from './modify/update'
|
|
@@ -102,10 +102,37 @@ export const getComponents = defineTool({
|
|
|
102
102
|
const nameFilter = args.name?.toLowerCase()
|
|
103
103
|
const documentComponents: DocumentComponentResult[] = []
|
|
104
104
|
const componentSlots = slotReader(figma.graph)
|
|
105
|
+
const catalog = getComponentCatalog(figma.graph)
|
|
106
|
+
const libraryAssets =
|
|
107
|
+
source !== 'document' && catalog
|
|
108
|
+
? await catalog.listComponents({
|
|
109
|
+
name: args.name,
|
|
110
|
+
libraryId: args.library_id,
|
|
111
|
+
enabledOnly: true
|
|
112
|
+
})
|
|
113
|
+
: []
|
|
114
|
+
const libraryComponents: LibraryComponentResult[] = libraryAssets.map(
|
|
115
|
+
({ libraryId, libraryName, revisionId, enabled, priority, asset }) => ({
|
|
116
|
+
libraryId,
|
|
117
|
+
libraryName,
|
|
118
|
+
revisionId,
|
|
119
|
+
assetKey: asset.key,
|
|
120
|
+
name: asset.name,
|
|
121
|
+
type: asset.type,
|
|
122
|
+
description: asset.description,
|
|
123
|
+
source: 'library' as const,
|
|
124
|
+
enabled,
|
|
125
|
+
priority
|
|
126
|
+
})
|
|
127
|
+
)
|
|
128
|
+
// Library components sort ahead of the document's, so when they fill the list no page loads.
|
|
129
|
+
const libraryFilled = libraryComponents.filter(({ priority }) => priority > -1).length >= limit
|
|
105
130
|
|
|
106
|
-
if (source !== 'libraries') {
|
|
131
|
+
if (source !== 'libraries' && !libraryFilled) {
|
|
107
132
|
for (const page of figma.root.children) {
|
|
108
133
|
if (documentComponents.length >= limit) break
|
|
134
|
+
// Pages load as the search reaches them, so a short list loads only the pages it needs.
|
|
135
|
+
await page.loadAsync()
|
|
109
136
|
page.findAll((node) => {
|
|
110
137
|
if (documentComponents.length >= limit) return false
|
|
111
138
|
if (node.type !== 'COMPONENT' && node.type !== 'COMPONENT_SET') return false
|
|
@@ -124,30 +151,6 @@ export const getComponents = defineTool({
|
|
|
124
151
|
}
|
|
125
152
|
}
|
|
126
153
|
|
|
127
|
-
const catalog = getComponentCatalog(figma.graph)
|
|
128
|
-
const libraryComponents: LibraryComponentResult[] = []
|
|
129
|
-
if (source !== 'document' && catalog) {
|
|
130
|
-
const assets = await catalog.listComponents({
|
|
131
|
-
name: args.name,
|
|
132
|
-
libraryId: args.library_id,
|
|
133
|
-
enabledOnly: true
|
|
134
|
-
})
|
|
135
|
-
libraryComponents.push(
|
|
136
|
-
...assets.map(({ libraryId, libraryName, revisionId, enabled, priority, asset }) => ({
|
|
137
|
-
libraryId,
|
|
138
|
-
libraryName,
|
|
139
|
-
revisionId,
|
|
140
|
-
assetKey: asset.key,
|
|
141
|
-
name: asset.name,
|
|
142
|
-
type: asset.type,
|
|
143
|
-
description: asset.description,
|
|
144
|
-
source: 'library' as const,
|
|
145
|
-
enabled,
|
|
146
|
-
priority
|
|
147
|
-
}))
|
|
148
|
-
)
|
|
149
|
-
}
|
|
150
|
-
|
|
151
154
|
const components = [...libraryComponents, ...documentComponents]
|
|
152
155
|
.sort((left, right) => {
|
|
153
156
|
const leftPriority = 'priority' in left ? left.priority : -1
|
package/src/tools/read/fonts.ts
CHANGED
|
@@ -53,7 +53,7 @@ export const listFonts = defineTool({
|
|
|
53
53
|
export const listAvailableFonts = defineTool({
|
|
54
54
|
name: 'list_available_fonts',
|
|
55
55
|
description:
|
|
56
|
-
'List font families the host can render
|
|
56
|
+
'List font families the host can render: installed, bundled, and online families. ' +
|
|
57
57
|
'Use this to discover what fonts are available to set on a text node — distinct from list_fonts ' +
|
|
58
58
|
'which only reports families currently used in the page.',
|
|
59
59
|
execution: { kind: 'async', mutation: 'none' },
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { groupBy, isPlainObject } from 'es-toolkit'
|
|
2
2
|
import * as v from 'valibot'
|
|
3
3
|
|
|
4
|
+
import { prepareSlotInsertion } from '#core/figma-api/slots'
|
|
4
5
|
import { getComponentCatalog } from '#core/tools/component-catalog'
|
|
5
6
|
import { toolNumber, defineTool } from '#core/tools/schema'
|
|
6
7
|
|
|
@@ -60,6 +61,8 @@ export const insertLibraryComponent = defineTool({
|
|
|
60
61
|
)
|
|
61
62
|
}),
|
|
62
63
|
execute: async (figma, args) => {
|
|
64
|
+
if (args.parent_id)
|
|
65
|
+
prepareSlotInsertion(figma.graph, args.parent_id, 'insert_library_component')
|
|
63
66
|
const catalog = getComponentCatalog(figma.graph)
|
|
64
67
|
if (!catalog) throw new Error('No component library catalog is configured')
|
|
65
68
|
let variantValues: Record<string, string> | undefined
|
package/src/tools/read/nodes.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as v from 'valibot'
|
|
2
2
|
|
|
3
|
-
import type { FigmaNodeProxy } from '#core/figma-api'
|
|
3
|
+
import type { FigmaAPI, FigmaNodeProxy } from '#core/figma-api'
|
|
4
4
|
import {
|
|
5
5
|
toolNumber,
|
|
6
6
|
nodeIdInputSchema,
|
|
@@ -48,11 +48,30 @@ function nodeToTreeEntry(
|
|
|
48
48
|
return entry
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/** The current page's tree; the answer that never needs a page load. */
|
|
52
|
+
function currentPageTree(
|
|
53
|
+
figma: FigmaAPI,
|
|
54
|
+
depth: number | undefined,
|
|
55
|
+
typeFilter: Set<string> | undefined
|
|
56
|
+
) {
|
|
57
|
+
const page = figma.currentPage
|
|
58
|
+
const children: TreeEntry[] = []
|
|
59
|
+
for (const child of page.children) {
|
|
60
|
+
const entry = nodeToTreeEntry(child, 1, depth, typeFilter)
|
|
61
|
+
if (entry) children.push(entry)
|
|
62
|
+
}
|
|
63
|
+
return { page: page.name, children }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function typeFilterOf(nodeTypes: readonly string[] | undefined): Set<string> | undefined {
|
|
67
|
+
return nodeTypes && nodeTypes.length > 0 ? new Set(nodeTypes) : undefined
|
|
68
|
+
}
|
|
69
|
+
|
|
51
70
|
export const getPageTree = defineTool({
|
|
52
71
|
name: 'get_page_tree',
|
|
53
72
|
description:
|
|
54
73
|
'Get the node tree of the current page. Returns lightweight hierarchy: id, type, name, size, and text for TEXT nodes. Use depth, root_id, or node_types to keep large pages small. Use get_node for full properties of a specific node.',
|
|
55
|
-
execution: { kind: '
|
|
74
|
+
execution: { kind: 'async', mutation: 'none' },
|
|
56
75
|
input: v.strictObject({
|
|
57
76
|
depth: v.optional(
|
|
58
77
|
toolNumber(
|
|
@@ -79,22 +98,28 @@ export const getPageTree = defineTool({
|
|
|
79
98
|
)
|
|
80
99
|
)
|
|
81
100
|
}),
|
|
82
|
-
|
|
83
|
-
const typeFilter =
|
|
84
|
-
|
|
101
|
+
executeSync: (figma, { depth, root_id, node_types }) => {
|
|
102
|
+
const typeFilter = typeFilterOf(node_types)
|
|
85
103
|
if (root_id !== undefined) {
|
|
86
104
|
const root = figma.getNodeById(root_id)
|
|
87
|
-
if (!root) return
|
|
105
|
+
if (!root) return undefined
|
|
106
|
+
// A page root exists before its layers load; only the async path can answer it.
|
|
107
|
+
if (figma.graph.getNode(root.id)?.type === 'CANVAS') return undefined
|
|
88
108
|
return { root: root.id, tree: nodeToTreeEntry(root, 1, depth, typeFilter) }
|
|
89
|
-
}
|
|
90
109
|
|
|
91
|
-
const page = figma.currentPage
|
|
92
|
-
const children: TreeEntry[] = []
|
|
93
|
-
for (const child of page.children) {
|
|
94
|
-
const entry = nodeToTreeEntry(child, 1, depth, typeFilter)
|
|
95
|
-
if (entry) children.push(entry)
|
|
96
110
|
}
|
|
97
|
-
return
|
|
111
|
+
return currentPageTree(figma, depth, typeFilter)
|
|
112
|
+
},
|
|
113
|
+
execute: async (figma, { depth, root_id, node_types }) => {
|
|
114
|
+
const typeFilter = typeFilterOf(node_types)
|
|
115
|
+
if (root_id === undefined) return currentPageTree(figma, depth, typeFilter)
|
|
116
|
+
const root = figma.getNodeById(root_id)
|
|
117
|
+
// A layer on a page not yet visited loads that page, as in Figma's dynamic-page mode.
|
|
118
|
+
const loaded = root ?? (await figma.getNodeByIdAsync(root_id))
|
|
119
|
+
if (!loaded) return { error: `Node "${root_id}" not found` }
|
|
120
|
+
// A page root exists before its layers load; read them first.
|
|
121
|
+
if (figma.graph.getNode(loaded.id)?.type === 'CANVAS') await loaded.loadAsync()
|
|
122
|
+
return { root: loaded.id, tree: nodeToTreeEntry(loaded, 1, depth, typeFilter) }
|
|
98
123
|
}
|
|
99
124
|
})
|
|
100
125
|
|
|
@@ -102,7 +127,7 @@ export const getNode = defineTool({
|
|
|
102
127
|
name: 'get_node',
|
|
103
128
|
description:
|
|
104
129
|
'Get detailed properties of a node by ID. Use depth to limit child recursion (0 = node only, 1 = direct children, etc). Default: unlimited.',
|
|
105
|
-
execution: { kind: '
|
|
130
|
+
execution: { kind: 'async', mutation: 'none' },
|
|
106
131
|
input: v.strictObject({
|
|
107
132
|
id: nodeIdInputSchema,
|
|
108
133
|
depth: v.optional(
|
|
@@ -114,10 +139,15 @@ export const getNode = defineTool({
|
|
|
114
139
|
)
|
|
115
140
|
)
|
|
116
141
|
}),
|
|
117
|
-
|
|
142
|
+
executeSync: (figma, { id, depth }) => {
|
|
143
|
+
const node = figma.getNodeById(id)
|
|
144
|
+
return node ? nodeToResult(node, depth) : undefined
|
|
145
|
+
},
|
|
146
|
+
execute: async (figma, { id, depth }) => {
|
|
118
147
|
const node = figma.getNodeById(id)
|
|
119
|
-
|
|
120
|
-
|
|
148
|
+
// A layer on a page not yet visited loads that page, as in Figma's dynamic-page mode.
|
|
149
|
+
const loaded = node ?? (await figma.getNodeByIdAsync(id))
|
|
150
|
+
return loaded ? nodeToResult(loaded, depth) : { error: `Node "${id}" not found` }
|
|
121
151
|
}
|
|
122
152
|
})
|
|
123
153
|
|
package/src/tools/read/pages.ts
CHANGED
|
@@ -22,15 +22,18 @@ export const switchPage = defineTool({
|
|
|
22
22
|
name: 'switch_page',
|
|
23
23
|
|
|
24
24
|
description: 'Switch to a different page by name or ID.',
|
|
25
|
-
execution: { kind: '
|
|
25
|
+
execution: { kind: 'async', mutation: 'view' },
|
|
26
26
|
input: v.strictObject({
|
|
27
27
|
page: v.pipe(v.string(), v.description('Page name or ID'))
|
|
28
28
|
}),
|
|
29
|
-
execute: (figma, { page }) => {
|
|
29
|
+
execute: async (figma, { page }) => {
|
|
30
30
|
const target =
|
|
31
31
|
figma.root.children.find((candidate) => candidate.name === page) ?? figma.getNodeById(page)
|
|
32
|
-
if (!target
|
|
33
|
-
|
|
32
|
+
if (!target || figma.graph.getNode(target.id)?.type !== 'CANVAS')
|
|
33
|
+
return { error: `Page "${page}" not found` }
|
|
34
|
+
// A page not yet visited has its layers loaded first, so the calls after see them. The host
|
|
35
|
+
// switch it may start is not waited for, since preparing the page on screen can take seconds.
|
|
36
|
+
await target.loadAsync()
|
|
34
37
|
figma.currentPage = target
|
|
35
38
|
return { page: target.name, id: target.id }
|
|
36
39
|
}
|
package/src/tools/read/query.ts
CHANGED
|
@@ -24,6 +24,8 @@ Examples:
|
|
|
24
24
|
limit: v.optional(toolNumber(v.pipe(v.number(), v.description('Max results (default: 1000)'))))
|
|
25
25
|
}),
|
|
26
26
|
execute: async (figma, args) => {
|
|
27
|
+
if (args.page !== undefined)
|
|
28
|
+
await figma.root.children.find((page) => page.name === args.page)?.loadAsync()
|
|
27
29
|
try {
|
|
28
30
|
const nodes = await queryByXPath(figma.graph, args.selector, {
|
|
29
31
|
page: args.page ?? figma.currentPage.name,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as v from 'valibot'
|
|
2
|
+
|
|
3
|
+
import { defineTool, nodeIdInputSchema, nodeNotFound } from '#core/tools/schema'
|
|
4
|
+
|
|
5
|
+
export const getReactions = defineTool({
|
|
6
|
+
name: 'get_reactions',
|
|
7
|
+
|
|
8
|
+
description:
|
|
9
|
+
"Get the prototype connections on a layer, in Figma's plugin shape: each trigger and its " +
|
|
10
|
+
'actions, with a NODE action naming the destination frame. Empty when the layer connects ' +
|
|
11
|
+
'to nothing.',
|
|
12
|
+
execution: { kind: 'sync', mutation: 'none' },
|
|
13
|
+
input: v.strictObject({
|
|
14
|
+
id: nodeIdInputSchema
|
|
15
|
+
}),
|
|
16
|
+
execute: (figma, { id }) => {
|
|
17
|
+
const node = figma.getNodeById(id)
|
|
18
|
+
if (!node) return nodeNotFound(id)
|
|
19
|
+
return { id, reactions: node.reactions }
|
|
20
|
+
}
|
|
21
|
+
})
|
package/src/tools/read.ts
CHANGED
|
@@ -5,5 +5,6 @@ export { diffJSX, getJSX } from './read/jsx'
|
|
|
5
5
|
export { findNodes, getNode, getPageTree } from './read/nodes'
|
|
6
6
|
export { getCurrentPage, listPages, pageBounds, switchPage } from './read/pages'
|
|
7
7
|
export { queryNodes } from './read/query'
|
|
8
|
+
export { getReactions } from './read/reactions'
|
|
8
9
|
export { getSelection, selectNodes } from './read/selection'
|
|
9
10
|
export { findEmptySpaceTool } from './read/space'
|
|
@@ -51,6 +51,7 @@ import {
|
|
|
51
51
|
replaceMatchingProperties,
|
|
52
52
|
rescale,
|
|
53
53
|
setOpacity,
|
|
54
|
+
setReactions,
|
|
54
55
|
setRotation,
|
|
55
56
|
setStrokeAlign,
|
|
56
57
|
setTextResize,
|
|
@@ -62,6 +63,7 @@ import {
|
|
|
62
63
|
getCurrentPage,
|
|
63
64
|
getFontStatus,
|
|
64
65
|
getPageTree,
|
|
66
|
+
getReactions,
|
|
65
67
|
insertLibraryComponent,
|
|
66
68
|
listAvailableFonts,
|
|
67
69
|
listFonts,
|
|
@@ -131,6 +133,7 @@ import {
|
|
|
131
133
|
export const EXTENDED_TOOLS: ToolDef[] = [
|
|
132
134
|
// Read (advanced)
|
|
133
135
|
getPageTree,
|
|
136
|
+
getReactions,
|
|
134
137
|
getCurrentPage,
|
|
135
138
|
listPages,
|
|
136
139
|
selectNodes,
|
|
@@ -179,6 +182,7 @@ export const EXTENDED_TOOLS: ToolDef[] = [
|
|
|
179
182
|
replaceBackground,
|
|
180
183
|
// Modify (advanced)
|
|
181
184
|
setEffects,
|
|
185
|
+
setReactions,
|
|
182
186
|
setOpacity,
|
|
183
187
|
setFont,
|
|
184
188
|
setVisible,
|
package/src/tools/schema.ts
CHANGED
|
@@ -52,6 +52,11 @@ export interface ToolDef extends ToolMetadata {
|
|
|
52
52
|
*/
|
|
53
53
|
loadFonts: (figma: FigmaAPI, args: Record<string, unknown>) => Promise<void>
|
|
54
54
|
execute: (figma: FigmaAPI, args: Record<string, unknown>) => unknown
|
|
55
|
+
/**
|
|
56
|
+
* The synchronous answer of a read whose `execute` may load a page first, or `undefined`
|
|
57
|
+
* when answering would load. Hosts that cannot wait refuse on `undefined` before any load.
|
|
58
|
+
*/
|
|
59
|
+
executeSync?: (figma: FigmaAPI, args: Record<string, unknown>) => unknown
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
type ToolDefinitionMetadata = Omit<ToolMetadata, 'exposure' | 'capabilities' | 'availability'> &
|
|
@@ -67,6 +72,10 @@ export function defineTool<P extends v.ObjectEntries, R>(
|
|
|
67
72
|
args: v.InferOutput<v.StrictObjectSchema<P, undefined>>
|
|
68
73
|
) => FigmaFontNameInput[]
|
|
69
74
|
execute: (figma: FigmaAPI, args: v.InferOutput<v.StrictObjectSchema<P, undefined>>) => R
|
|
75
|
+
executeSync?: (
|
|
76
|
+
figma: FigmaAPI,
|
|
77
|
+
args: v.InferOutput<v.StrictObjectSchema<P, undefined>>
|
|
78
|
+
) => unknown
|
|
70
79
|
}
|
|
71
80
|
): ToolDef {
|
|
72
81
|
const { fonts } = def
|
|
@@ -87,7 +96,10 @@ export function defineTool<P extends v.ObjectEntries, R>(
|
|
|
87
96
|
if (!parsed.success) return
|
|
88
97
|
for (const font of fonts(figma, parsed.output)) await figma.loadFontAsync(font)
|
|
89
98
|
},
|
|
90
|
-
execute: (figma, args) => def.execute(figma, parseToolArgs(def.name, def.input, args))
|
|
99
|
+
execute: (figma, args) => def.execute(figma, parseToolArgs(def.name, def.input, args)),
|
|
100
|
+
executeSync: def.executeSync
|
|
101
|
+
? (figma, args) => def.executeSync?.(figma, parseToolArgs(def.name, def.input, args))
|
|
102
|
+
: undefined
|
|
91
103
|
}
|
|
92
104
|
}
|
|
93
105
|
|
|
@@ -114,11 +126,12 @@ function formatToolArgumentError(
|
|
|
114
126
|
schema: v.GenericSchema,
|
|
115
127
|
issues: readonly v.BaseIssue<unknown>[]
|
|
116
128
|
): string {
|
|
117
|
-
const problems = issues
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
129
|
+
const problems = issues
|
|
130
|
+
.flatMap((issue) => branchIssues(schema, issue))
|
|
131
|
+
.map(({ keys, issue }) => {
|
|
132
|
+
const place = keys.length > 0 ? `\n → at ${placeOf(keys)}` : ''
|
|
133
|
+
return `× ${formatToolArgIssue(schema, keys, issue)}${place}`
|
|
134
|
+
})
|
|
122
135
|
return `Invalid arguments for ${name}:\n${problems.join('\n')}`
|
|
123
136
|
}
|
|
124
137
|
|
|
@@ -144,23 +157,66 @@ function unwrappedSchema(schema: v.GenericSchema): v.GenericSchema {
|
|
|
144
157
|
}
|
|
145
158
|
}
|
|
146
159
|
|
|
147
|
-
|
|
148
|
-
|
|
160
|
+
type ArgumentKey = string | number
|
|
161
|
+
|
|
162
|
+
function issueKeys(issue: v.BaseIssue<unknown>): ArgumentKey[] {
|
|
163
|
+
const keys: ArgumentKey[] = []
|
|
164
|
+
for (const item of issue.path ?? []) {
|
|
165
|
+
if (!('key' in item)) continue
|
|
166
|
+
if (typeof item.key === 'string' || typeof item.key === 'number') keys.push(item.key)
|
|
167
|
+
}
|
|
168
|
+
return keys
|
|
149
169
|
}
|
|
150
170
|
|
|
151
|
-
|
|
171
|
+
/** `operations[0].props`: an index reads as part of its array, a name follows a dot. */
|
|
172
|
+
function placeOf(keys: readonly ArgumentKey[]): string {
|
|
173
|
+
return keys.reduce<string>((place, key) => {
|
|
174
|
+
if (typeof key === 'number') return `${place}[${key}]`
|
|
175
|
+
return place ? `${place}.${key}` : key
|
|
176
|
+
}, '')
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* `v.union` reports one issue for every branch, which reads as "Expected Object but received
|
|
181
|
+
* Object". Re-check the value against each branch and keep the one that got furthest: the branch
|
|
182
|
+
* whose own problems name the field the caller has to fix.
|
|
183
|
+
*/
|
|
184
|
+
function branchIssues(
|
|
185
|
+
schema: v.GenericSchema,
|
|
186
|
+
issue: v.BaseIssue<unknown>
|
|
187
|
+
): { keys: ArgumentKey[]; issue: v.BaseIssue<unknown> }[] {
|
|
188
|
+
const keys = issueKeys(issue)
|
|
189
|
+
if (issue.type !== 'union') return [{ keys, issue }]
|
|
190
|
+
const union = schemaAtPath(schema, keys)
|
|
191
|
+
const options = union ? schemaParts(union).options : undefined
|
|
192
|
+
if (!options || options.length === 0) return [{ keys, issue }]
|
|
193
|
+
let best: readonly v.BaseIssue<unknown>[] | null = null
|
|
194
|
+
for (const option of options) {
|
|
195
|
+
const parsed = v.safeParse(option as v.GenericSchema, issue.input)
|
|
196
|
+
if (parsed.success) continue
|
|
197
|
+
if (!best || parsed.issues.length < best.length) best = parsed.issues
|
|
198
|
+
}
|
|
199
|
+
if (!best || best.length === 0) return [{ keys, issue }]
|
|
200
|
+
return best.map((nested) => ({ keys: [...keys, ...issueKeys(nested)], issue: nested }))
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function schemaAtPath(root: v.GenericSchema, keys: readonly ArgumentKey[]): v.GenericSchema | null {
|
|
152
204
|
let current = unwrappedSchema(root)
|
|
153
205
|
for (const key of keys) {
|
|
154
206
|
const parts = schemaParts(current)
|
|
155
|
-
const
|
|
207
|
+
const name = String(key)
|
|
208
|
+
const next = parts.entries && name in parts.entries ? parts.entries[name] : parts.item
|
|
156
209
|
if (!next) return null
|
|
157
210
|
current = unwrappedSchema(next)
|
|
158
211
|
}
|
|
159
212
|
return current
|
|
160
213
|
}
|
|
161
214
|
|
|
162
|
-
function formatToolArgIssue(
|
|
163
|
-
|
|
215
|
+
function formatToolArgIssue(
|
|
216
|
+
schema: v.GenericSchema,
|
|
217
|
+
keys: readonly ArgumentKey[],
|
|
218
|
+
issue: v.BaseIssue<unknown>
|
|
219
|
+
): string {
|
|
164
220
|
const key = keys.at(-1)
|
|
165
221
|
if (key !== undefined && (issue.type === 'object' || issue.type === 'strict_object')) {
|
|
166
222
|
if (issue.expected === 'never') {
|
|
@@ -69,7 +69,11 @@ export async function applyPhoto(
|
|
|
69
69
|
|
|
70
70
|
let results: StockPhotoResult[]
|
|
71
71
|
try {
|
|
72
|
-
|
|
72
|
+
// The download is not part of an enclosing edit: what someone else changes meanwhile stays
|
|
73
|
+
// out of its undo step.
|
|
74
|
+
results = await figma.graph.waitOutsideEdit(
|
|
75
|
+
provider.search(req.query, { perPage, orientation, targetDim })
|
|
76
|
+
)
|
|
73
77
|
} catch (err) {
|
|
74
78
|
return { id: req.id, error: err instanceof Error ? err.message : String(err) }
|
|
75
79
|
}
|
|
@@ -79,9 +83,13 @@ export async function applyPhoto(
|
|
|
79
83
|
|
|
80
84
|
let imageBytes: Uint8Array
|
|
81
85
|
try {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
86
|
+
imageBytes = await figma.graph.waitOutsideEdit(
|
|
87
|
+
(async () => {
|
|
88
|
+
const response = await fetch(photo.url)
|
|
89
|
+
if (!response.ok) throw new Error(`Download ${response.status}`)
|
|
90
|
+
return new Uint8Array(await response.arrayBuffer())
|
|
91
|
+
})()
|
|
92
|
+
)
|
|
85
93
|
} catch (err) {
|
|
86
94
|
return { id: req.id, error: `Download: ${err instanceof Error ? err.message : String(err)}` }
|
|
87
95
|
}
|
|
@@ -89,7 +97,11 @@ export async function applyPhoto(
|
|
|
89
97
|
const imageHash = storeImage(figma.graph, imageBytes)
|
|
90
98
|
node.fills = [{ type: 'IMAGE', imageHash, scaleMode: 'FILL' }]
|
|
91
99
|
// A missed report does not undo the photo the document already shows.
|
|
92
|
-
|
|
100
|
+
if (provider.reportUse) {
|
|
101
|
+
await figma.graph.waitOutsideEdit(
|
|
102
|
+
Promise.resolve(provider.reportUse(photo)).catch(() => undefined)
|
|
103
|
+
)
|
|
104
|
+
}
|
|
93
105
|
|
|
94
106
|
return {
|
|
95
107
|
id: node.id,
|