@pairdraw/core 0.17.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/outline-stroke.d.ts.map +1 -1
- package/dist/canvas/outline-stroke.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/prototype.d.ts +2 -5
- package/dist/canvas/overlays/prototype.d.ts.map +1 -1
- package/dist/canvas/overlays/prototype.js +3 -19
- package/dist/canvas/overlays/prototype.js.map +1 -1
- 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 +25 -10
- 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 +26 -7
- package/dist/canvas/renderer.d.ts.map +1 -1
- package/dist/canvas/renderer.js +50 -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 +90 -54
- 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 +4 -3
- package/dist/canvas/text/font-families.d.ts.map +1 -1
- package/dist/canvas/text/font-families.js +13 -9
- 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 +2 -9
- 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 +18 -9
- 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 +3 -3
- package/dist/canvas/text/placed.js.map +1 -1
- package/dist/canvas/text/renderer.d.ts +2 -0
- package/dist/canvas/text/renderer.d.ts.map +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/design-jsx/renderer.d.ts.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/bridges/undo.d.ts +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 +18 -4
- 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 +63 -10
- package/dist/figma-api/index.d.ts.map +1 -1
- package/dist/figma-api/index.js +104 -17
- 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 +12 -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/connectors.js +2 -14
- package/dist/geometry/connectors.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 +3 -3
- package/dist/geometry/index.js +2 -2
- package/dist/geometry/scene.d.ts +3 -1
- package/dist/geometry/scene.d.ts.map +1 -1
- package/dist/geometry/scene.js +16 -1
- package/dist/geometry/scene.js.map +1 -1
- package/dist/geometry/types.d.ts +7 -1
- package/dist/geometry/types.d.ts.map +1 -1
- 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/drawio/export.d.ts.map +1 -1
- package/dist/io/formats/drawio/export.js +10 -0
- package/dist/io/formats/drawio/export.js.map +1 -1
- package/dist/io/formats/drawio/index.d.ts.map +1 -1
- package/dist/io/formats/drawio/index.js +32 -1
- package/dist/io/formats/drawio/index.js.map +1 -1
- package/dist/io/formats/drawio/shapes.d.ts +10 -5
- package/dist/io/formats/drawio/shapes.d.ts.map +1 -1
- package/dist/io/formats/drawio/shapes.js +10 -6
- package/dist/io/formats/drawio/shapes.js.map +1 -1
- package/dist/io/formats/drawio/warnings.d.ts +11 -0
- package/dist/io/formats/drawio/warnings.d.ts.map +1 -0
- package/dist/io/formats/drawio/warnings.js +23 -0
- package/dist/io/formats/drawio/warnings.js.map +1 -0
- 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 +10 -1
- package/dist/io/formats/pdf/dom.d.ts.map +1 -1
- package/dist/io/formats/pdf/dom.js +96 -2
- package/dist/io/formats/pdf/dom.js.map +1 -1
- package/dist/io/formats/pdf/export.js +3 -2
- package/dist/io/formats/pdf/export.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 +3 -3
- package/dist/io/formats/raster/headless.d.ts.map +1 -1
- package/dist/io/formats/raster/headless.js +25 -14
- 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 +8 -2
- package/dist/io/formats/raster/render.d.ts.map +1 -1
- package/dist/io/formats/raster/render.js +42 -8
- 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/formats.d.ts.map +1 -1
- package/dist/io/formats.js +3 -1
- package/dist/io/formats.js.map +1 -1
- package/dist/io/registry.d.ts +2 -0
- package/dist/io/registry.d.ts.map +1 -1
- package/dist/io/registry.js +5 -0
- package/dist/io/registry.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/io/types.d.ts +2 -0
- package/dist/io/types.d.ts.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 +11 -2
- package/dist/library/snapshot.js.map +1 -1
- package/dist/lint/linter.d.ts.map +1 -1
- package/dist/lint/linter.js +11 -2
- package/dist/lint/linter.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/rpc/variables-command.d.ts.map +1 -1
- package/dist/rpc/variables-command.js +4 -2
- package/dist/rpc/variables-command.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 +16 -14
- 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 +26 -3
- package/dist/text/fallbacks.d.ts.map +1 -1
- package/dist/text/fallbacks.js +135 -18
- 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 +50 -6
- package/dist/text/font/manager.d.ts.map +1 -1
- package/dist/text/font/manager.js +178 -32
- 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 +71 -71
- package/dist/text/outlines.js.map +1 -1
- package/dist/text/path/caret.d.ts +2 -4
- package/dist/text/path/caret.d.ts.map +1 -1
- package/dist/text/path/caret.js.map +1 -1
- package/dist/text/prepare.d.ts +5 -1
- package/dist/text/prepare.d.ts.map +1 -1
- package/dist/text/prepare.js +26 -3
- 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/text/web-font/assets.d.ts.map +1 -1
- package/dist/text/web-font/assets.js +13 -21
- package/dist/text/web-font/assets.js.map +1 -1
- package/dist/text/web-font/resolver.d.ts.map +1 -1
- package/dist/text/web-font/resolver.js +4 -1
- package/dist/text/web-font/resolver.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/components.d.ts +2 -1
- package/dist/tools/create/components.d.ts.map +1 -1
- package/dist/tools/create/components.js +27 -1
- package/dist/tools/create/components.js.map +1 -1
- package/dist/tools/create/html.d.ts.map +1 -1
- package/dist/tools/create/html.js +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 +14 -6
- 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 +13 -10
- package/dist/tools/create/vector.js.map +1 -1
- package/dist/tools/create.d.ts +2 -2
- package/dist/tools/create.js +2 -2
- 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/effects.d.ts.map +1 -1
- package/dist/tools/modify/effects.js +5 -3
- package/dist/tools/modify/effects.js.map +1 -1
- package/dist/tools/modify/matching.d.ts.map +1 -1
- package/dist/tools/modify/matching.js +9 -6
- package/dist/tools/modify/matching.js.map +1 -1
- package/dist/tools/modify/paint.d.ts.map +1 -1
- package/dist/tools/modify/paint.js +7 -5
- package/dist/tools/modify/paint.js.map +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/text.d.ts.map +1 -1
- package/dist/tools/modify/text.js +28 -8
- package/dist/tools/modify/text.js.map +1 -1
- 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 +18 -4
- 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 +6 -1
- package/dist/tools/registry/extended.js.map +1 -1
- package/dist/tools/schema.d.ts +30 -5
- package/dist/tools/schema.d.ts.map +1 -1
- package/dist/tools/schema.js +125 -7
- 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 +86 -90
- package/dist/tools/structure/batch.js.map +1 -1
- package/dist/tools/variables/values.d.ts.map +1 -1
- package/dist/tools/variables/values.js +4 -2
- package/dist/tools/variables/values.js.map +1 -1
- package/dist/tools/vector/export.d.ts.map +1 -1
- package/dist/tools/vector/export.js +5 -2
- package/dist/tools/vector/export.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/outline-stroke.ts +2 -6
- package/src/canvas/overlays/index.ts +0 -1
- package/src/canvas/overlays/prototype.ts +5 -27
- 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 +42 -18
- 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 +43 -11
- package/src/canvas/rulers.ts +55 -26
- package/src/canvas/scene.ts +127 -77
- 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 +14 -7
- package/src/canvas/text/index.ts +3 -9
- 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 +19 -10
- package/src/canvas/text/paragraph/inputs.ts +4 -2
- package/src/canvas/text/placed.ts +2 -2
- package/src/canvas/text/renderer.ts +2 -0
- 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 +170 -19
- 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 +16 -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/connectors.ts +2 -12
- package/src/geometry/figma.ts +9 -0
- package/src/geometry/index.ts +2 -1
- package/src/geometry/scene.ts +19 -0
- package/src/geometry/types.ts +8 -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/drawio/export.ts +11 -0
- package/src/io/formats/drawio/index.ts +36 -1
- package/src/io/formats/drawio/shapes.ts +13 -9
- package/src/io/formats/drawio/warnings.ts +27 -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 +125 -3
- package/src/io/formats/pdf/export.ts +3 -2
- 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 +40 -14
- package/src/io/formats/raster/index.ts +3 -0
- package/src/io/formats/raster/render.ts +66 -8
- 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/formats.ts +3 -1
- package/src/io/registry.ts +12 -0
- package/src/io/subgraph.ts +3 -1
- package/src/io/types.ts +2 -0
- 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 +12 -2
- package/src/lint/linter.ts +12 -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/rpc/variables-command.ts +6 -5
- package/src/text/character-style.ts +29 -9
- package/src/text/coverage.ts +29 -15
- package/src/text/editor.ts +3 -8
- package/src/text/fallbacks.ts +163 -22
- 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 +220 -49
- package/src/text/font/style.ts +52 -3
- package/src/text/index.ts +1 -0
- package/src/text/outlines.ts +106 -90
- package/src/text/path/caret.ts +3 -4
- package/src/text/prepare.ts +51 -2
- package/src/text/style-runs.ts +43 -16
- package/src/text/web-font/assets.ts +11 -15
- package/src/text/web-font/resolver.ts +7 -1
- 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/components.ts +33 -0
- package/src/tools/create/html.ts +3 -1
- package/src/tools/create/icons.ts +16 -6
- 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 +20 -10
- package/src/tools/create.ts +1 -0
- package/src/tools/image-ai/generate.ts +3 -0
- package/src/tools/modify/effects.ts +11 -4
- package/src/tools/modify/matching.ts +10 -6
- package/src/tools/modify/paint.ts +13 -5
- package/src/tools/modify/reactions.ts +40 -0
- package/src/tools/modify/text.ts +53 -20
- 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 +24 -4
- package/src/tools/read/nodes.ts +47 -17
- package/src/tools/read/pages.ts +7 -3
- 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 +6 -0
- package/src/tools/schema.ts +166 -6
- package/src/tools/stock-photo/apply.ts +17 -5
- package/src/tools/structure/batch.ts +84 -98
- package/src/tools/variables/values.ts +6 -3
- package/src/tools/vector/export.ts +5 -1
- 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
package/dist/tools/read/nodes.js
CHANGED
|
@@ -19,11 +19,27 @@ function nodeToTreeEntry(node, level, maxDepth, typeFilter) {
|
|
|
19
19
|
if (children.length > 0) entry.children = children;
|
|
20
20
|
return entry;
|
|
21
21
|
}
|
|
22
|
+
/** The current page's tree; the answer that never needs a page load. */
|
|
23
|
+
function currentPageTree(figma, depth, typeFilter) {
|
|
24
|
+
const page = figma.currentPage;
|
|
25
|
+
const children = [];
|
|
26
|
+
for (const child of page.children) {
|
|
27
|
+
const entry = nodeToTreeEntry(child, 1, depth, typeFilter);
|
|
28
|
+
if (entry) children.push(entry);
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
page: page.name,
|
|
32
|
+
children
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function typeFilterOf(nodeTypes) {
|
|
36
|
+
return nodeTypes && nodeTypes.length > 0 ? new Set(nodeTypes) : void 0;
|
|
37
|
+
}
|
|
22
38
|
const getPageTree = defineTool({
|
|
23
39
|
name: "get_page_tree",
|
|
24
40
|
description: "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.",
|
|
25
41
|
execution: {
|
|
26
|
-
kind: "
|
|
42
|
+
kind: "async",
|
|
27
43
|
mutation: "none"
|
|
28
44
|
},
|
|
29
45
|
input: v.strictObject({
|
|
@@ -31,25 +47,28 @@ const getPageTree = defineTool({
|
|
|
31
47
|
root_id: v.optional(v.pipe(v.string(), v.description("Return only this node subtree instead of the whole current page"))),
|
|
32
48
|
node_types: v.optional(v.pipe(v.array(v.string()), v.minLength(1), v.description("Keep only these node types and their ancestors, for example FRAME or TEXT")))
|
|
33
49
|
}),
|
|
34
|
-
|
|
35
|
-
const typeFilter =
|
|
50
|
+
executeSync: (figma, { depth, root_id, node_types }) => {
|
|
51
|
+
const typeFilter = typeFilterOf(node_types);
|
|
36
52
|
if (root_id !== void 0) {
|
|
37
53
|
const root = figma.getNodeById(root_id);
|
|
38
|
-
if (!root) return
|
|
54
|
+
if (!root) return void 0;
|
|
55
|
+
if (figma.graph.getNode(root.id)?.type === "CANVAS") return void 0;
|
|
39
56
|
return {
|
|
40
57
|
root: root.id,
|
|
41
58
|
tree: nodeToTreeEntry(root, 1, depth, typeFilter)
|
|
42
59
|
};
|
|
43
60
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
61
|
+
return currentPageTree(figma, depth, typeFilter);
|
|
62
|
+
},
|
|
63
|
+
execute: async (figma, { depth, root_id, node_types }) => {
|
|
64
|
+
const typeFilter = typeFilterOf(node_types);
|
|
65
|
+
if (root_id === void 0) return currentPageTree(figma, depth, typeFilter);
|
|
66
|
+
const loaded = figma.getNodeById(root_id) ?? await figma.getNodeByIdAsync(root_id);
|
|
67
|
+
if (!loaded) return { error: `Node "${root_id}" not found` };
|
|
68
|
+
if (figma.graph.getNode(loaded.id)?.type === "CANVAS") await loaded.loadAsync();
|
|
50
69
|
return {
|
|
51
|
-
|
|
52
|
-
|
|
70
|
+
root: loaded.id,
|
|
71
|
+
tree: nodeToTreeEntry(loaded, 1, depth, typeFilter)
|
|
53
72
|
};
|
|
54
73
|
}
|
|
55
74
|
});
|
|
@@ -57,17 +76,20 @@ const getNode = defineTool({
|
|
|
57
76
|
name: "get_node",
|
|
58
77
|
description: "Get detailed properties of a node by ID. Use depth to limit child recursion (0 = node only, 1 = direct children, etc). Default: unlimited.",
|
|
59
78
|
execution: {
|
|
60
|
-
kind: "
|
|
79
|
+
kind: "async",
|
|
61
80
|
mutation: "none"
|
|
62
81
|
},
|
|
63
82
|
input: v.strictObject({
|
|
64
83
|
id: nodeIdInputSchema,
|
|
65
84
|
depth: v.optional(toolNumber(v.pipe(v.number(), v.description("Max depth of children to include (0 = no children). Default: unlimited"))))
|
|
66
85
|
}),
|
|
67
|
-
|
|
86
|
+
executeSync: (figma, { id, depth }) => {
|
|
68
87
|
const node = figma.getNodeById(id);
|
|
69
|
-
|
|
70
|
-
|
|
88
|
+
return node ? nodeToResult(node, depth) : void 0;
|
|
89
|
+
},
|
|
90
|
+
execute: async (figma, { id, depth }) => {
|
|
91
|
+
const loaded = figma.getNodeById(id) ?? await figma.getNodeByIdAsync(id);
|
|
92
|
+
return loaded ? nodeToResult(loaded, depth) : { error: `Node "${id}" not found` };
|
|
71
93
|
}
|
|
72
94
|
});
|
|
73
95
|
const findNodes = defineTool({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.js","names":[],"sources":["../../../src/tools/read/nodes.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport type { FigmaNodeProxy } from '#core/figma-api'\nimport {\n toolNumber,\n nodeIdInputSchema,\n defineTool,\n nodeSummary,\n nodeToResult\n} from '#core/tools/schema'\n\ninterface TreeEntry {\n id: string\n type: string\n name: string\n w: number\n h: number\n text?: string\n children?: TreeEntry[]\n}\n\nfunction nodeToTreeEntry(\n node: FigmaNodeProxy,\n level: number,\n maxDepth?: number,\n typeFilter?: Set<string>\n): TreeEntry | null {\n const children: TreeEntry[] = []\n if ((maxDepth === undefined || level < maxDepth) && node.children.length > 0) {\n for (const child of node.children) {\n const entry = nodeToTreeEntry(child, level + 1, maxDepth, typeFilter)\n if (entry) children.push(entry)\n }\n }\n\n const matches = !typeFilter || typeFilter.has(node.type)\n if (!matches && children.length === 0) return null\n\n const entry: TreeEntry = {\n id: node.id,\n type: node.type,\n name: node.name,\n w: node.width,\n h: node.height\n }\n if (node.type === 'TEXT') entry.text = node.characters\n if (children.length > 0) entry.children = children\n return entry\n}\n\nexport const getPageTree = defineTool({\n name: 'get_page_tree',\n description:\n '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.',\n execution: { kind: '
|
|
1
|
+
{"version":3,"file":"nodes.js","names":[],"sources":["../../../src/tools/read/nodes.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport type { FigmaAPI, FigmaNodeProxy } from '#core/figma-api'\nimport {\n toolNumber,\n nodeIdInputSchema,\n defineTool,\n nodeSummary,\n nodeToResult\n} from '#core/tools/schema'\n\ninterface TreeEntry {\n id: string\n type: string\n name: string\n w: number\n h: number\n text?: string\n children?: TreeEntry[]\n}\n\nfunction nodeToTreeEntry(\n node: FigmaNodeProxy,\n level: number,\n maxDepth?: number,\n typeFilter?: Set<string>\n): TreeEntry | null {\n const children: TreeEntry[] = []\n if ((maxDepth === undefined || level < maxDepth) && node.children.length > 0) {\n for (const child of node.children) {\n const entry = nodeToTreeEntry(child, level + 1, maxDepth, typeFilter)\n if (entry) children.push(entry)\n }\n }\n\n const matches = !typeFilter || typeFilter.has(node.type)\n if (!matches && children.length === 0) return null\n\n const entry: TreeEntry = {\n id: node.id,\n type: node.type,\n name: node.name,\n w: node.width,\n h: node.height\n }\n if (node.type === 'TEXT') entry.text = node.characters\n if (children.length > 0) entry.children = children\n return entry\n}\n\n/** The current page's tree; the answer that never needs a page load. */\nfunction currentPageTree(\n figma: FigmaAPI,\n depth: number | undefined,\n typeFilter: Set<string> | undefined\n) {\n const page = figma.currentPage\n const children: TreeEntry[] = []\n for (const child of page.children) {\n const entry = nodeToTreeEntry(child, 1, depth, typeFilter)\n if (entry) children.push(entry)\n }\n return { page: page.name, children }\n}\n\nfunction typeFilterOf(nodeTypes: readonly string[] | undefined): Set<string> | undefined {\n return nodeTypes && nodeTypes.length > 0 ? new Set(nodeTypes) : undefined\n}\n\nexport const getPageTree = defineTool({\n name: 'get_page_tree',\n description:\n '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.',\n execution: { kind: 'async', mutation: 'none' },\n input: v.strictObject({\n depth: v.optional(\n toolNumber(\n v.pipe(\n v.number(),\n v.minValue(1),\n v.description(\n 'Max nesting depth to return (1 = returned root nodes only). Default: unlimited'\n )\n )\n )\n ),\n root_id: v.optional(\n v.pipe(\n v.string(),\n v.description('Return only this node subtree instead of the whole current page')\n )\n ),\n node_types: v.optional(\n v.pipe(\n v.array(v.string()),\n v.minLength(1),\n v.description('Keep only these node types and their ancestors, for example FRAME or TEXT')\n )\n )\n }),\n executeSync: (figma, { depth, root_id, node_types }) => {\n const typeFilter = typeFilterOf(node_types)\n if (root_id !== undefined) {\n const root = figma.getNodeById(root_id)\n if (!root) return undefined\n // A page root exists before its layers load; only the async path can answer it.\n if (figma.graph.getNode(root.id)?.type === 'CANVAS') return undefined\n return { root: root.id, tree: nodeToTreeEntry(root, 1, depth, typeFilter) }\n\n }\n return currentPageTree(figma, depth, typeFilter)\n },\n execute: async (figma, { depth, root_id, node_types }) => {\n const typeFilter = typeFilterOf(node_types)\n if (root_id === undefined) return currentPageTree(figma, depth, typeFilter)\n const root = figma.getNodeById(root_id)\n // A layer on a page not yet visited loads that page, as in Figma's dynamic-page mode.\n const loaded = root ?? (await figma.getNodeByIdAsync(root_id))\n if (!loaded) return { error: `Node \"${root_id}\" not found` }\n // A page root exists before its layers load; read them first.\n if (figma.graph.getNode(loaded.id)?.type === 'CANVAS') await loaded.loadAsync()\n return { root: loaded.id, tree: nodeToTreeEntry(loaded, 1, depth, typeFilter) }\n }\n})\n\nexport const getNode = defineTool({\n name: 'get_node',\n description:\n 'Get detailed properties of a node by ID. Use depth to limit child recursion (0 = node only, 1 = direct children, etc). Default: unlimited.',\n execution: { kind: 'async', mutation: 'none' },\n input: v.strictObject({\n id: nodeIdInputSchema,\n depth: v.optional(\n toolNumber(\n v.pipe(\n v.number(),\n v.description('Max depth of children to include (0 = no children). Default: unlimited')\n )\n )\n )\n }),\n executeSync: (figma, { id, depth }) => {\n const node = figma.getNodeById(id)\n return node ? nodeToResult(node, depth) : undefined\n },\n execute: async (figma, { id, depth }) => {\n const node = figma.getNodeById(id)\n // A layer on a page not yet visited loads that page, as in Figma's dynamic-page mode.\n const loaded = node ?? (await figma.getNodeByIdAsync(id))\n return loaded ? nodeToResult(loaded, depth) : { error: `Node \"${id}\" not found` }\n }\n})\n\nexport const findNodes = defineTool({\n name: 'find_nodes',\n description: 'Find nodes by name pattern and/or type.',\n execution: { kind: 'sync', mutation: 'none' },\n input: v.strictObject({\n name: v.optional(\n v.pipe(v.string(), v.description('Name substring to match (case-insensitive)'))\n ),\n type: v.optional(\n v.pipe(\n v.picklist([\n 'FRAME',\n 'RECTANGLE',\n 'ELLIPSE',\n 'TEXT',\n 'LINE',\n 'STAR',\n 'POLYGON',\n 'SECTION',\n 'GROUP',\n 'COMPONENT',\n 'INSTANCE',\n 'VECTOR'\n ]),\n v.description('Node type filter')\n )\n )\n }),\n execute: (figma, args) => {\n const page = figma.currentPage\n const matches = page.findAll((node) => {\n if (args.type && node.type !== args.type) return false\n if (args.name && !node.name.toLowerCase().includes(args.name.toLowerCase())) return false\n return true\n })\n return { count: matches.length, nodes: matches.map(nodeSummary) }\n }\n})\n"],"mappings":";;;AAqBA,SAAS,gBACP,MACA,OACA,UACA,YACkB;CAClB,MAAM,WAAwB,CAAC;CAC/B,KAAK,aAAa,KAAA,KAAa,QAAQ,aAAa,KAAK,SAAS,SAAS,GACzE,KAAK,MAAM,SAAS,KAAK,UAAU;EACjC,MAAM,QAAQ,gBAAgB,OAAO,QAAQ,GAAG,UAAU,UAAU;EACpE,IAAI,OAAO,SAAS,KAAK,KAAK;CAChC;CAIF,IAAI,EADY,CAAC,cAAc,WAAW,IAAI,KAAK,IAAI,MACvC,SAAS,WAAW,GAAG,OAAO;CAE9C,MAAM,QAAmB;EACvB,IAAI,KAAK;EACT,MAAM,KAAK;EACX,MAAM,KAAK;EACX,GAAG,KAAK;EACR,GAAG,KAAK;CACV;CACA,IAAI,KAAK,SAAS,QAAQ,MAAM,OAAO,KAAK;CAC5C,IAAI,SAAS,SAAS,GAAG,MAAM,WAAW;CAC1C,OAAO;AACT;;AAGA,SAAS,gBACP,OACA,OACA,YACA;CACA,MAAM,OAAO,MAAM;CACnB,MAAM,WAAwB,CAAC;CAC/B,KAAK,MAAM,SAAS,KAAK,UAAU;EACjC,MAAM,QAAQ,gBAAgB,OAAO,GAAG,OAAO,UAAU;EACzD,IAAI,OAAO,SAAS,KAAK,KAAK;CAChC;CACA,OAAO;EAAE,MAAM,KAAK;EAAM;CAAS;AACrC;AAEA,SAAS,aAAa,WAAmE;CACvF,OAAO,aAAa,UAAU,SAAS,IAAI,IAAI,IAAI,SAAS,IAAI,KAAA;AAClE;AAEA,MAAa,cAAc,WAAW;CACpC,MAAM;CACN,aACE;CACF,WAAW;EAAE,MAAM;EAAS,UAAU;CAAO;CAC7C,OAAO,EAAE,aAAa;EACpB,OAAO,EAAE,SACP,WACE,EAAE,KACA,EAAE,OAAO,GACT,EAAE,SAAS,CAAC,GACZ,EAAE,YACA,gFACF,CACF,CACF,CACF;EACA,SAAS,EAAE,SACT,EAAE,KACA,EAAE,OAAO,GACT,EAAE,YAAY,iEAAiE,CACjF,CACF;EACA,YAAY,EAAE,SACZ,EAAE,KACA,EAAE,MAAM,EAAE,OAAO,CAAC,GAClB,EAAE,UAAU,CAAC,GACb,EAAE,YAAY,2EAA2E,CAC3F,CACF;CACF,CAAC;CACD,cAAc,OAAO,EAAE,OAAO,SAAS,iBAAiB;EACtD,MAAM,aAAa,aAAa,UAAU;EAC1C,IAAI,YAAY,KAAA,GAAW;GACzB,MAAM,OAAO,MAAM,YAAY,OAAO;GACtC,IAAI,CAAC,MAAM,OAAO,KAAA;GAElB,IAAI,MAAM,MAAM,QAAQ,KAAK,EAAE,CAAC,EAAE,SAAS,UAAU,OAAO,KAAA;GAC5D,OAAO;IAAE,MAAM,KAAK;IAAI,MAAM,gBAAgB,MAAM,GAAG,OAAO,UAAU;GAAE;EAE5E;EACA,OAAO,gBAAgB,OAAO,OAAO,UAAU;CACjD;CACA,SAAS,OAAO,OAAO,EAAE,OAAO,SAAS,iBAAiB;EACxD,MAAM,aAAa,aAAa,UAAU;EAC1C,IAAI,YAAY,KAAA,GAAW,OAAO,gBAAgB,OAAO,OAAO,UAAU;EAG1E,MAAM,SAFO,MAAM,YAAY,OAEb,KAAM,MAAM,MAAM,iBAAiB,OAAO;EAC5D,IAAI,CAAC,QAAQ,OAAO,EAAE,OAAO,SAAS,QAAQ,aAAa;EAE3D,IAAI,MAAM,MAAM,QAAQ,OAAO,EAAE,CAAC,EAAE,SAAS,UAAU,MAAM,OAAO,UAAU;EAC9E,OAAO;GAAE,MAAM,OAAO;GAAI,MAAM,gBAAgB,QAAQ,GAAG,OAAO,UAAU;EAAE;CAChF;AACF,CAAC;AAED,MAAa,UAAU,WAAW;CAChC,MAAM;CACN,aACE;CACF,WAAW;EAAE,MAAM;EAAS,UAAU;CAAO;CAC7C,OAAO,EAAE,aAAa;EACpB,IAAI;EACJ,OAAO,EAAE,SACP,WACE,EAAE,KACA,EAAE,OAAO,GACT,EAAE,YAAY,wEAAwE,CACxF,CACF,CACF;CACF,CAAC;CACD,cAAc,OAAO,EAAE,IAAI,YAAY;EACrC,MAAM,OAAO,MAAM,YAAY,EAAE;EACjC,OAAO,OAAO,aAAa,MAAM,KAAK,IAAI,KAAA;CAC5C;CACA,SAAS,OAAO,OAAO,EAAE,IAAI,YAAY;EAGvC,MAAM,SAFO,MAAM,YAAY,EAEb,KAAM,MAAM,MAAM,iBAAiB,EAAE;EACvD,OAAO,SAAS,aAAa,QAAQ,KAAK,IAAI,EAAE,OAAO,SAAS,GAAG,aAAa;CAClF;AACF,CAAC;AAED,MAAa,YAAY,WAAW;CAClC,MAAM;CACN,aAAa;CACb,WAAW;EAAE,MAAM;EAAQ,UAAU;CAAO;CAC5C,OAAO,EAAE,aAAa;EACpB,MAAM,EAAE,SACN,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,YAAY,4CAA4C,CAAC,CAChF;EACA,MAAM,EAAE,SACN,EAAE,KACA,EAAE,SAAS;GACT;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAAC,GACD,EAAE,YAAY,kBAAkB,CAClC,CACF;CACF,CAAC;CACD,UAAU,OAAO,SAAS;EAExB,MAAM,UADO,MAAM,YACE,SAAS,SAAS;GACrC,IAAI,KAAK,QAAQ,KAAK,SAAS,KAAK,MAAM,OAAO;GACjD,IAAI,KAAK,QAAQ,CAAC,KAAK,KAAK,YAAY,CAAC,CAAC,SAAS,KAAK,KAAK,YAAY,CAAC,GAAG,OAAO;GACpF,OAAO;EACT,CAAC;EACD,OAAO;GAAE,OAAO,QAAQ;GAAQ,OAAO,QAAQ,IAAI,WAAW;EAAE;CAClE;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages.d.ts","names":[],"sources":["../../../src/tools/read/pages.ts"],"mappings":";;cAMa,WAAA;cAcA,YAAA;
|
|
1
|
+
{"version":3,"file":"pages.d.ts","names":[],"sources":["../../../src/tools/read/pages.ts"],"mappings":";;cAMa,WAAA;cAcA,YAAA;cAqBA,gBAAA;cAUA,YAAA"}
|
package/dist/tools/read/pages.js
CHANGED
|
@@ -25,13 +25,14 @@ const switchPage = defineTool({
|
|
|
25
25
|
name: "switch_page",
|
|
26
26
|
description: "Switch to a different page by name or ID.",
|
|
27
27
|
execution: {
|
|
28
|
-
kind: "
|
|
28
|
+
kind: "async",
|
|
29
29
|
mutation: "view"
|
|
30
30
|
},
|
|
31
31
|
input: v.strictObject({ page: v.pipe(v.string(), v.description("Page name or ID")) }),
|
|
32
|
-
execute: (figma, { page }) => {
|
|
32
|
+
execute: async (figma, { page }) => {
|
|
33
33
|
const target = figma.root.children.find((candidate) => candidate.name === page) ?? figma.getNodeById(page);
|
|
34
|
-
if (!target) return { error: `Page "${page}" not found` };
|
|
34
|
+
if (!target || figma.graph.getNode(target.id)?.type !== "CANVAS") return { error: `Page "${page}" not found` };
|
|
35
|
+
await target.loadAsync();
|
|
35
36
|
figma.currentPage = target;
|
|
36
37
|
return {
|
|
37
38
|
page: target.name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages.js","names":[],"sources":["../../../src/tools/read/pages.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport { computeBounds } from '@pairdraw/scene-graph/geometry'\n\nimport { defineTool } from '#core/tools/schema'\n\nexport const listPages = defineTool({\n name: 'list_pages',\n description: 'List all pages in the document.',\n execution: { kind: 'sync', mutation: 'none' },\n input: v.strictObject({}),\n execute: (figma) => {\n const pages = figma.root.children\n return {\n current: figma.currentPage.name,\n pages: pages.map((page) => ({ id: page.id, name: page.name }))\n }\n }\n})\n\nexport const switchPage = defineTool({\n name: 'switch_page',\n\n description: 'Switch to a different page by name or ID.',\n execution: { kind: '
|
|
1
|
+
{"version":3,"file":"pages.js","names":[],"sources":["../../../src/tools/read/pages.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport { computeBounds } from '@pairdraw/scene-graph/geometry'\n\nimport { defineTool } from '#core/tools/schema'\n\nexport const listPages = defineTool({\n name: 'list_pages',\n description: 'List all pages in the document.',\n execution: { kind: 'sync', mutation: 'none' },\n input: v.strictObject({}),\n execute: (figma) => {\n const pages = figma.root.children\n return {\n current: figma.currentPage.name,\n pages: pages.map((page) => ({ id: page.id, name: page.name }))\n }\n }\n})\n\nexport const switchPage = defineTool({\n name: 'switch_page',\n\n description: 'Switch to a different page by name or ID.',\n execution: { kind: 'async', mutation: 'view' },\n input: v.strictObject({\n page: v.pipe(v.string(), v.description('Page name or ID'))\n }),\n execute: async (figma, { page }) => {\n const target =\n figma.root.children.find((candidate) => candidate.name === page) ?? figma.getNodeById(page)\n if (!target || figma.graph.getNode(target.id)?.type !== 'CANVAS')\n return { error: `Page \"${page}\" not found` }\n // A page not yet visited has its layers loaded first, so the calls after see them. The host\n // switch it may start is not waited for, since preparing the page on screen can take seconds.\n await target.loadAsync()\n figma.currentPage = target\n return { page: target.name, id: target.id }\n }\n})\n\nexport const getCurrentPage = defineTool({\n name: 'get_current_page',\n description: 'Get the current page name and ID.',\n execution: { kind: 'sync', mutation: 'none' },\n input: v.strictObject({}),\n execute: (figma) => {\n return { id: figma.currentPage.id, name: figma.currentPage.name }\n }\n})\n\nexport const pageBounds = defineTool({\n name: 'page_bounds',\n description: 'Get bounding box of all objects on the current page.',\n execution: { kind: 'sync', mutation: 'none' },\n exposure: { webmcp: false },\n input: v.strictObject({}),\n execute: (figma) => {\n return computeBounds(figma.currentPage.children.map((child) => child.absoluteBoundingBox))\n }\n})\n"],"mappings":";;;;AAMA,MAAa,YAAY,WAAW;CAClC,MAAM;CACN,aAAa;CACb,WAAW;EAAE,MAAM;EAAQ,UAAU;CAAO;CAC5C,OAAO,EAAE,aAAa,CAAC,CAAC;CACxB,UAAU,UAAU;EAClB,MAAM,QAAQ,MAAM,KAAK;EACzB,OAAO;GACL,SAAS,MAAM,YAAY;GAC3B,OAAO,MAAM,KAAK,UAAU;IAAE,IAAI,KAAK;IAAI,MAAM,KAAK;GAAK,EAAE;EAC/D;CACF;AACF,CAAC;AAED,MAAa,aAAa,WAAW;CACnC,MAAM;CAEN,aAAa;CACb,WAAW;EAAE,MAAM;EAAS,UAAU;CAAO;CAC7C,OAAO,EAAE,aAAa,EACpB,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,YAAY,iBAAiB,CAAC,EAC3D,CAAC;CACD,SAAS,OAAO,OAAO,EAAE,WAAW;EAClC,MAAM,SACJ,MAAM,KAAK,SAAS,MAAM,cAAc,UAAU,SAAS,IAAI,KAAK,MAAM,YAAY,IAAI;EAC5F,IAAI,CAAC,UAAU,MAAM,MAAM,QAAQ,OAAO,EAAE,CAAC,EAAE,SAAS,UACtD,OAAO,EAAE,OAAO,SAAS,KAAK,aAAa;EAG7C,MAAM,OAAO,UAAU;EACvB,MAAM,cAAc;EACpB,OAAO;GAAE,MAAM,OAAO;GAAM,IAAI,OAAO;EAAG;CAC5C;AACF,CAAC;AAED,MAAa,iBAAiB,WAAW;CACvC,MAAM;CACN,aAAa;CACb,WAAW;EAAE,MAAM;EAAQ,UAAU;CAAO;CAC5C,OAAO,EAAE,aAAa,CAAC,CAAC;CACxB,UAAU,UAAU;EAClB,OAAO;GAAE,IAAI,MAAM,YAAY;GAAI,MAAM,MAAM,YAAY;EAAK;CAClE;AACF,CAAC;AAED,MAAa,aAAa,WAAW;CACnC,MAAM;CACN,aAAa;CACb,WAAW;EAAE,MAAM;EAAQ,UAAU;CAAO;CAC5C,UAAU,EAAE,QAAQ,MAAM;CAC1B,OAAO,EAAE,aAAa,CAAC,CAAC;CACxB,UAAU,UAAU;EAClB,OAAO,cAAc,MAAM,YAAY,SAAS,KAAK,UAAU,MAAM,mBAAmB,CAAC;CAC3F;AACF,CAAC"}
|
package/dist/tools/read/query.js
CHANGED
|
@@ -26,6 +26,7 @@ Examples:
|
|
|
26
26
|
limit: v.optional(toolNumber(v.pipe(v.number(), v.description("Max results (default: 1000)"))))
|
|
27
27
|
}),
|
|
28
28
|
execute: async (figma, args) => {
|
|
29
|
+
if (args.page !== void 0) await figma.root.children.find((page) => page.name === args.page)?.loadAsync();
|
|
29
30
|
try {
|
|
30
31
|
const nodes = await queryByXPath(figma.graph, args.selector, {
|
|
31
32
|
page: args.page ?? figma.currentPage.name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","names":[],"sources":["../../../src/tools/read/query.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport { toolNumber, defineTool } from '#core/tools/schema'\nimport { queryByXPath } from '#core/xpath'\n\nexport const queryNodes = defineTool({\n name: 'query_nodes',\n description: `Query nodes using XPath selectors. Returns id, name, and type, plus text for TEXT nodes. Node types are element names (FRAME, TEXT, RECTANGLE, ELLIPSE, etc.). Attributes: id, name, width, height, x, y, visible, opacity, cornerRadius, fontSize, fontFamily, fontWeight, layoutMode, itemSpacing, paddingTop/Right/Bottom/Left, strokeWeight, rotation, locked, blendMode, text, lineHeight, letterSpacing.\n\nExamples:\n//FRAME — all frames\n//FRAME[@width < 300] — frames narrower than 300px\n//COMPONENT[starts-with(@name, 'Button')] — components starting with \"Button\"\n//SECTION/FRAME — direct frame children of sections\n//SECTION//TEXT — all text nodes inside sections\n//*[@cornerRadius > 0] — any node with corner radius\n//TEXT[contains(@text, 'Hello')] — text nodes containing \"Hello\"\n//*[@id='1:2']//TEXT[not(ancestor-or-self::*[@visible='false'])] — visible text inside a frame, in layer order`,\n execution: { kind: 'async', mutation: 'none' },\n exposure: { webmcp: false },\n input: v.strictObject({\n selector: v.pipe(v.string(), v.description('XPath selector')),\n page: v.optional(v.pipe(v.string(), v.description('Page name (default: current page)'))),\n limit: v.optional(toolNumber(v.pipe(v.number(), v.description('Max results (default: 1000)'))))\n }),\n execute: async (figma, args) => {\n try {\n const nodes = await queryByXPath(figma.graph, args.selector, {\n page: args.page ?? figma.currentPage.name,\n limit: args.limit\n })\n return {\n count: nodes.length,\n nodes: nodes.map((node) => ({\n id: node.id,\n name: node.name,\n type: node.type,\n ...(node.type === 'TEXT' ? { text: node.text } : {})\n }))\n }\n } catch (err) {\n return { error: `XPath error: ${err instanceof Error ? err.message : String(err)}` }\n }\n }\n})\n"],"mappings":";;;;AAKA,MAAa,aAAa,WAAW;CACnC,MAAM;CACN,aAAa;;;;;;;;;;;CAWb,WAAW;EAAE,MAAM;EAAS,UAAU;CAAO;CAC7C,UAAU,EAAE,QAAQ,MAAM;CAC1B,OAAO,EAAE,aAAa;EACpB,UAAU,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,YAAY,gBAAgB,CAAC;EAC5D,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,YAAY,mCAAmC,CAAC,CAAC;EACvF,OAAO,EAAE,SAAS,WAAW,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,YAAY,6BAA6B,CAAC,CAAC,CAAC;CAChG,CAAC;CACD,SAAS,OAAO,OAAO,SAAS;EAC9B,IAAI;GACF,MAAM,QAAQ,MAAM,aAAa,MAAM,OAAO,KAAK,UAAU;IAC3D,MAAM,KAAK,QAAQ,MAAM,YAAY;IACrC,OAAO,KAAK;GACd,CAAC;GACD,OAAO;IACL,OAAO,MAAM;IACb,OAAO,MAAM,KAAK,UAAU;KAC1B,IAAI,KAAK;KACT,MAAM,KAAK;KACX,MAAM,KAAK;KACX,GAAI,KAAK,SAAS,SAAS,EAAE,MAAM,KAAK,KAAK,IAAI,CAAC;IACpD,EAAE;GACJ;EACF,SAAS,KAAK;GACZ,OAAO,EAAE,OAAO,gBAAgB,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,IAAI;EACrF;CACF;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"query.js","names":[],"sources":["../../../src/tools/read/query.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport { toolNumber, defineTool } from '#core/tools/schema'\nimport { queryByXPath } from '#core/xpath'\n\nexport const queryNodes = defineTool({\n name: 'query_nodes',\n description: `Query nodes using XPath selectors. Returns id, name, and type, plus text for TEXT nodes. Node types are element names (FRAME, TEXT, RECTANGLE, ELLIPSE, etc.). Attributes: id, name, width, height, x, y, visible, opacity, cornerRadius, fontSize, fontFamily, fontWeight, layoutMode, itemSpacing, paddingTop/Right/Bottom/Left, strokeWeight, rotation, locked, blendMode, text, lineHeight, letterSpacing.\n\nExamples:\n//FRAME — all frames\n//FRAME[@width < 300] — frames narrower than 300px\n//COMPONENT[starts-with(@name, 'Button')] — components starting with \"Button\"\n//SECTION/FRAME — direct frame children of sections\n//SECTION//TEXT — all text nodes inside sections\n//*[@cornerRadius > 0] — any node with corner radius\n//TEXT[contains(@text, 'Hello')] — text nodes containing \"Hello\"\n//*[@id='1:2']//TEXT[not(ancestor-or-self::*[@visible='false'])] — visible text inside a frame, in layer order`,\n execution: { kind: 'async', mutation: 'none' },\n exposure: { webmcp: false },\n input: v.strictObject({\n selector: v.pipe(v.string(), v.description('XPath selector')),\n page: v.optional(v.pipe(v.string(), v.description('Page name (default: current page)'))),\n limit: v.optional(toolNumber(v.pipe(v.number(), v.description('Max results (default: 1000)'))))\n }),\n execute: async (figma, args) => {\n if (args.page !== undefined)\n await figma.root.children.find((page) => page.name === args.page)?.loadAsync()\n try {\n const nodes = await queryByXPath(figma.graph, args.selector, {\n page: args.page ?? figma.currentPage.name,\n limit: args.limit\n })\n return {\n count: nodes.length,\n nodes: nodes.map((node) => ({\n id: node.id,\n name: node.name,\n type: node.type,\n ...(node.type === 'TEXT' ? { text: node.text } : {})\n }))\n }\n } catch (err) {\n return { error: `XPath error: ${err instanceof Error ? err.message : String(err)}` }\n }\n }\n})\n"],"mappings":";;;;AAKA,MAAa,aAAa,WAAW;CACnC,MAAM;CACN,aAAa;;;;;;;;;;;CAWb,WAAW;EAAE,MAAM;EAAS,UAAU;CAAO;CAC7C,UAAU,EAAE,QAAQ,MAAM;CAC1B,OAAO,EAAE,aAAa;EACpB,UAAU,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,YAAY,gBAAgB,CAAC;EAC5D,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,YAAY,mCAAmC,CAAC,CAAC;EACvF,OAAO,EAAE,SAAS,WAAW,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,YAAY,6BAA6B,CAAC,CAAC,CAAC;CAChG,CAAC;CACD,SAAS,OAAO,OAAO,SAAS;EAC9B,IAAI,KAAK,SAAS,KAAA,GAChB,MAAM,MAAM,KAAK,SAAS,MAAM,SAAS,KAAK,SAAS,KAAK,IAAI,CAAC,EAAE,UAAU;EAC/E,IAAI;GACF,MAAM,QAAQ,MAAM,aAAa,MAAM,OAAO,KAAK,UAAU;IAC3D,MAAM,KAAK,QAAQ,MAAM,YAAY;IACrC,OAAO,KAAK;GACd,CAAC;GACD,OAAO;IACL,OAAO,MAAM;IACb,OAAO,MAAM,KAAK,UAAU;KAC1B,IAAI,KAAK;KACT,MAAM,KAAK;KACX,MAAM,KAAK;KACX,GAAI,KAAK,SAAS,SAAS,EAAE,MAAM,KAAK,KAAK,IAAI,CAAC;IACpD,EAAE;GACJ;EACF,SAAS,KAAK;GACZ,OAAO,EAAE,OAAO,gBAAgB,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,IAAI;EACrF;CACF;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactions.d.ts","names":[],"sources":["../../../src/tools/read/reactions.ts"],"mappings":";;cAIa,cAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineTool, nodeIdInputSchema, nodeNotFound } from "../schema.js";
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
//#region src/tools/read/reactions.ts
|
|
4
|
+
const getReactions = defineTool({
|
|
5
|
+
name: "get_reactions",
|
|
6
|
+
description: "Get the prototype connections on a layer, in Figma's plugin shape: each trigger and its actions, with a NODE action naming the destination frame. Empty when the layer connects to nothing.",
|
|
7
|
+
execution: {
|
|
8
|
+
kind: "sync",
|
|
9
|
+
mutation: "none"
|
|
10
|
+
},
|
|
11
|
+
input: v.strictObject({ id: nodeIdInputSchema }),
|
|
12
|
+
execute: (figma, { id }) => {
|
|
13
|
+
const node = figma.getNodeById(id);
|
|
14
|
+
if (!node) return nodeNotFound(id);
|
|
15
|
+
return {
|
|
16
|
+
id,
|
|
17
|
+
reactions: node.reactions
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
//#endregion
|
|
22
|
+
export { getReactions };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=reactions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactions.js","names":[],"sources":["../../../src/tools/read/reactions.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport { defineTool, nodeIdInputSchema, nodeNotFound } from '#core/tools/schema'\n\nexport const getReactions = defineTool({\n name: 'get_reactions',\n\n description:\n \"Get the prototype connections on a layer, in Figma's plugin shape: each trigger and its \" +\n 'actions, with a NODE action naming the destination frame. Empty when the layer connects ' +\n 'to nothing.',\n execution: { kind: 'sync', mutation: 'none' },\n input: v.strictObject({\n id: nodeIdInputSchema\n }),\n execute: (figma, { id }) => {\n const node = figma.getNodeById(id)\n if (!node) return nodeNotFound(id)\n return { id, reactions: node.reactions }\n }\n})\n"],"mappings":";;;AAIA,MAAa,eAAe,WAAW;CACrC,MAAM;CAEN,aACE;CAGF,WAAW;EAAE,MAAM;EAAQ,UAAU;CAAO;CAC5C,OAAO,EAAE,aAAa,EACpB,IAAI,kBACN,CAAC;CACD,UAAU,OAAO,EAAE,SAAS;EAC1B,MAAM,OAAO,MAAM,YAAY,EAAE;EACjC,IAAI,CAAC,MAAM,OAAO,aAAa,EAAE;EACjC,OAAO;GAAE;GAAI,WAAW,KAAK;EAAU;CACzC;AACF,CAAC"}
|
package/dist/tools/read/space.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { findPageId } from "../../io/subgraph.js";
|
|
2
|
-
import { defineTool, toolNumber } from "../schema.js";
|
|
3
2
|
import { flushPendingLayout } from "../../figma-api/pending-layout.js";
|
|
3
|
+
import { defineTool, toolNumber } from "../schema.js";
|
|
4
4
|
import { getAxisAlignedBoundsInParent } from "@pairdraw/scene-graph/coordinate";
|
|
5
5
|
import { computeBounds } from "@pairdraw/scene-graph/geometry";
|
|
6
6
|
import * as v from "valibot";
|
package/dist/tools/read.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { diffJSX, getJSX } from "./read/jsx.js";
|
|
|
5
5
|
import { findNodes, getNode, getPageTree } from "./read/nodes.js";
|
|
6
6
|
import { getCurrentPage, listPages, pageBounds, switchPage } from "./read/pages.js";
|
|
7
7
|
import { queryNodes } from "./read/query.js";
|
|
8
|
+
import { getReactions } from "./read/reactions.js";
|
|
8
9
|
import { getSelection, selectNodes } from "./read/selection.js";
|
|
9
10
|
import { findEmptySpaceTool } from "./read/space.js";
|
|
10
|
-
export { diffJSX, findEmptySpaceTool, findNodes, getComponents, getCurrentPage, getFontStatus, getJSX, getNode, getPageTree, getSelection, insertLibraryComponent, listAvailableFonts, listFonts, listLibraries, listPages, pageBounds, queryNodes, selectNodes, switchPage };
|
|
11
|
+
export { diffJSX, findEmptySpaceTool, findNodes, getComponents, getCurrentPage, getFontStatus, getJSX, getNode, getPageTree, getReactions, getSelection, insertLibraryComponent, listAvailableFonts, listFonts, listLibraries, listPages, pageBounds, queryNodes, selectNodes, switchPage };
|
package/dist/tools/read.js
CHANGED
|
@@ -6,5 +6,6 @@ import { diffJSX, getJSX } from "./read/jsx.js";
|
|
|
6
6
|
import { findNodes, getNode, getPageTree } from "./read/nodes.js";
|
|
7
7
|
import { getCurrentPage, listPages, pageBounds, switchPage } from "./read/pages.js";
|
|
8
8
|
import { queryNodes } from "./read/query.js";
|
|
9
|
+
import { getReactions } from "./read/reactions.js";
|
|
9
10
|
import { getSelection, selectNodes } from "./read/selection.js";
|
|
10
|
-
export { diffJSX, findEmptySpaceTool, findNodes, getComponents, getCurrentPage, getFontStatus, getJSX, getNode, getPageTree, getSelection, insertLibraryComponent, listAvailableFonts, listFonts, listLibraries, listPages, pageBounds, queryNodes, selectNodes, switchPage };
|
|
11
|
+
export { diffJSX, findEmptySpaceTool, findNodes, getComponents, getCurrentPage, getFontStatus, getJSX, getNode, getPageTree, getReactions, getSelection, insertLibraryComponent, listAvailableFonts, listFonts, listLibraries, listPages, pageBounds, queryNodes, selectNodes, switchPage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extended.d.ts","names":[],"sources":["../../../src/tools/registry/extended.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"extended.d.ts","names":[],"sources":["../../../src/tools/registry/extended.ts"],"mappings":";;;;;;cAoIa,gBAAgB"}
|
|
@@ -11,7 +11,7 @@ import { designToComponentMap } from "../codegen/component-map.js";
|
|
|
11
11
|
import { addComment, getComments, replyToComment, resolveComment } from "../comments.js";
|
|
12
12
|
import { createPage, createShape, createSlice } from "../create/basic.js";
|
|
13
13
|
import { createSlot, getBehaviour, setBehaviour } from "../create/behaviours.js";
|
|
14
|
-
import { combineAsVariants, createComponent, createInstance, exposeInstanceSwap } from "../create/components.js";
|
|
14
|
+
import { combineAsVariants, createComponent, createInstance, detachInstance, exposeInstanceSwap } from "../create/components.js";
|
|
15
15
|
import { fetchIconsTool, insertIcon, searchIconsTool } from "../create/icons.js";
|
|
16
16
|
import { script } from "../create/script.js";
|
|
17
17
|
import { importMermaid } from "../create/mermaid.js";
|
|
@@ -28,6 +28,7 @@ import { setConstraints } from "../modify/layout.js";
|
|
|
28
28
|
import { setFont, setFontRange, setTextResize } from "../modify/text.js";
|
|
29
29
|
import { replaceMatchingProperties } from "../modify/matching.js";
|
|
30
30
|
import { setImageFill } from "../modify/paint.js";
|
|
31
|
+
import { setReactions } from "../modify/reactions.js";
|
|
31
32
|
import { setBlend, setLocked, setStrokeAlign, setVisible } from "../modify/state.js";
|
|
32
33
|
import { getComponents } from "../read/components.js";
|
|
33
34
|
import { insertLibraryComponent, listLibraries } from "../read/libraries.js";
|
|
@@ -35,6 +36,7 @@ import { getFontStatus, listAvailableFonts, listFonts } from "../read/fonts.js";
|
|
|
35
36
|
import { getPageTree } from "../read/nodes.js";
|
|
36
37
|
import { getCurrentPage, listPages, pageBounds, switchPage } from "../read/pages.js";
|
|
37
38
|
import { queryNodes } from "../read/query.js";
|
|
39
|
+
import { getReactions } from "../read/reactions.js";
|
|
38
40
|
import { selectNodes } from "../read/selection.js";
|
|
39
41
|
import { cloneNode, nodeBounds, nodeMove, renameNode } from "../structure/basic.js";
|
|
40
42
|
import { flattenNodes, groupNodes, nodeToComponent, ungroupNode } from "../structure/hierarchy.js";
|
|
@@ -59,6 +61,7 @@ import { createVariable, deleteVariable, setVariable } from "../variables/values
|
|
|
59
61
|
*/
|
|
60
62
|
const EXTENDED_TOOLS = [
|
|
61
63
|
getPageTree,
|
|
64
|
+
getReactions,
|
|
62
65
|
getCurrentPage,
|
|
63
66
|
listPages,
|
|
64
67
|
selectNodes,
|
|
@@ -86,6 +89,7 @@ const EXTENDED_TOOLS = [
|
|
|
86
89
|
combineAsVariants,
|
|
87
90
|
createComponent,
|
|
88
91
|
createInstance,
|
|
92
|
+
detachInstance,
|
|
89
93
|
exposeInstanceSwap,
|
|
90
94
|
createSlot,
|
|
91
95
|
getBehaviour,
|
|
@@ -102,6 +106,7 @@ const EXTENDED_TOOLS = [
|
|
|
102
106
|
removeBackground,
|
|
103
107
|
replaceBackground,
|
|
104
108
|
setEffects,
|
|
109
|
+
setReactions,
|
|
105
110
|
setOpacity,
|
|
106
111
|
setFont,
|
|
107
112
|
setVisible,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extended.js","names":[],"sources":["../../../src/tools/registry/extended.ts"],"sourcesContent":["import {\n analyzeClusters,\n analyzeColors,\n analyzeOverlaps,\n analyzeSpacing,\n analyzeTypography,\n diffApply,\n diffShow,\n lint,\n lintFix\n} from '#core/tools/analyze'\nimport { designToComponentMap, designToTokens, importDesignTokens } from '#core/tools/codegen'\nimport { addComment, getComments, replyToComment, resolveComment } from '#core/tools/comments'\nimport {\n createComponent,\n createInstance,\n createPage,\n createConnectorTool,\n createShape,\n createSlice,\n createVector,\n exposeInstanceSwap,\n combineAsVariants,\n createSlot,\n fetchIconsTool,\n getBehaviour,\n importHTML,\n importMermaid,\n importSVG,\n insertIcon,\n script,\n searchIconsTool,\n setBehaviour\n} from '#core/tools/create'\nimport {\n generateImage,\n generateSVG,\n removeBackground,\n replaceBackground\n} from '#core/tools/image-ai'\nimport {\n setBlend,\n setConstraints,\n setEffects,\n setFont,\n setFontRange,\n setImageFill,\n setLocked,\n setMinMax,\n replaceMatchingProperties,\n rescale,\n setOpacity,\n setRotation,\n setStrokeAlign,\n setTextResize,\n setVisible\n} from '#core/tools/modify'\nimport {\n findEmptySpaceTool,\n getComponents,\n getCurrentPage,\n getFontStatus,\n getPageTree,\n insertLibraryComponent,\n listAvailableFonts,\n listFonts,\n listLibraries,\n listPages,\n pageBounds,\n queryNodes,\n selectNodes,\n switchPage\n} from '#core/tools/read'\nimport type { ToolDef } from '#core/tools/schema'\nimport { getStatuses, setStatus } from '#core/tools/statuses'\nimport {\n arrangeNodes,\n cloneNode,\n flattenNodes,\n groupNodes,\n nodeAncestors,\n nodeBindings,\n nodeBounds,\n nodeChildren,\n nodeMove,\n nodeReplaceWith,\n nodeToComponent,\n nodeTree,\n renameNode,\n ungroupNode\n} from '#core/tools/structure'\nimport { getStyle } from '#core/tools/styles'\nimport {\n bindVariable,\n createCollection,\n createVariable,\n deleteCollection,\n deleteVariable,\n findVariables,\n getCollection,\n getVariable,\n listCollections,\n listVariables,\n setVariable,\n unbindVariable\n} from '#core/tools/variables'\nimport {\n booleanExclude,\n booleanIntersect,\n booleanSubtract,\n booleanUnion,\n exportHTML,\n exportImage,\n exportPDF,\n exportSVG,\n pathFlip,\n pathGet,\n pathMove,\n pathScale,\n pathSet,\n vectorizeImage,\n viewportGet,\n viewportSet\n} from '#core/tools/vector'\n\n/**\n * Extended tools not in CORE_TOOLS — variables, vector ops, analysis,\n * codegen, advanced structure, path manipulation, etc.\n */\nexport const EXTENDED_TOOLS: ToolDef[] = [\n // Read (advanced)\n getPageTree,\n getCurrentPage,\n listPages,\n selectNodes,\n queryNodes,\n getComponents,\n listLibraries,\n insertLibraryComponent,\n switchPage,\n pageBounds,\n findEmptySpaceTool,\n getComments,\n addComment,\n replyToComment,\n resolveComment,\n getStatuses,\n setStatus,\n getFontStatus,\n listFonts,\n listAvailableFonts,\n // Style directions\n getStyle,\n // Create (advanced)\n createShape,\n searchIconsTool,\n insertIcon,\n fetchIconsTool,\n combineAsVariants,\n createComponent,\n createInstance,\n exposeInstanceSwap,\n createSlot,\n getBehaviour,\n setBehaviour,\n createPage,\n createVector,\n createSlice,\n createConnectorTool,\n importSVG,\n importMermaid,\n importHTML,\n // Image AI, run on the services the user set up in the app\n generateImage,\n generateSVG,\n removeBackground,\n replaceBackground,\n // Modify (advanced)\n setEffects,\n setOpacity,\n setFont,\n setVisible,\n setConstraints,\n setRotation,\n setMinMax,\n setFontRange,\n setTextResize,\n setBlend,\n setLocked,\n setStrokeAlign,\n setImageFill,\n replaceMatchingProperties,\n rescale,\n // Structure (advanced)\n cloneNode,\n nodeMove,\n renameNode,\n groupNodes,\n ungroupNode,\n flattenNodes,\n nodeToComponent,\n nodeBounds,\n nodeAncestors,\n nodeChildren,\n nodeTree,\n nodeBindings,\n nodeReplaceWith,\n arrangeNodes,\n // Variables\n listVariables,\n listCollections,\n getVariable,\n findVariables,\n createVariable,\n setVariable,\n deleteVariable,\n bindVariable,\n unbindVariable,\n getCollection,\n createCollection,\n deleteCollection,\n // Vector & export\n booleanUnion,\n booleanSubtract,\n booleanIntersect,\n booleanExclude,\n pathGet,\n pathSet,\n pathScale,\n pathFlip,\n pathMove,\n vectorizeImage,\n viewportGet,\n viewportSet,\n exportSVG,\n exportPDF,\n exportImage,\n exportHTML,\n // Analyze & diff\n analyzeColors,\n analyzeTypography,\n lint,\n lintFix,\n analyzeSpacing,\n analyzeClusters,\n analyzeOverlaps,\n diffShow,\n diffApply,\n // Code on canvas\n script,\n // Codegen\n designToTokens,\n importDesignTokens,\n designToComponentMap\n]\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"extended.js","names":[],"sources":["../../../src/tools/registry/extended.ts"],"sourcesContent":["import {\n analyzeClusters,\n analyzeColors,\n analyzeOverlaps,\n analyzeSpacing,\n analyzeTypography,\n diffApply,\n diffShow,\n lint,\n lintFix\n} from '#core/tools/analyze'\nimport { designToComponentMap, designToTokens, importDesignTokens } from '#core/tools/codegen'\nimport { addComment, getComments, replyToComment, resolveComment } from '#core/tools/comments'\nimport {\n createComponent,\n createInstance,\n createPage,\n createConnectorTool,\n createShape,\n createSlice,\n createVector,\n detachInstance,\n exposeInstanceSwap,\n combineAsVariants,\n createSlot,\n fetchIconsTool,\n getBehaviour,\n importHTML,\n importMermaid,\n importSVG,\n insertIcon,\n script,\n searchIconsTool,\n setBehaviour\n} from '#core/tools/create'\nimport {\n generateImage,\n generateSVG,\n removeBackground,\n replaceBackground\n} from '#core/tools/image-ai'\nimport {\n setBlend,\n setConstraints,\n setEffects,\n setFont,\n setFontRange,\n setImageFill,\n setLocked,\n setMinMax,\n replaceMatchingProperties,\n rescale,\n setOpacity,\n setReactions,\n setRotation,\n setStrokeAlign,\n setTextResize,\n setVisible\n} from '#core/tools/modify'\nimport {\n findEmptySpaceTool,\n getComponents,\n getCurrentPage,\n getFontStatus,\n getPageTree,\n getReactions,\n insertLibraryComponent,\n listAvailableFonts,\n listFonts,\n listLibraries,\n listPages,\n pageBounds,\n queryNodes,\n selectNodes,\n switchPage\n} from '#core/tools/read'\nimport type { ToolDef } from '#core/tools/schema'\nimport { getStatuses, setStatus } from '#core/tools/statuses'\nimport {\n arrangeNodes,\n cloneNode,\n flattenNodes,\n groupNodes,\n nodeAncestors,\n nodeBindings,\n nodeBounds,\n nodeChildren,\n nodeMove,\n nodeReplaceWith,\n nodeToComponent,\n nodeTree,\n renameNode,\n ungroupNode\n} from '#core/tools/structure'\nimport { getStyle } from '#core/tools/styles'\nimport {\n bindVariable,\n createCollection,\n createVariable,\n deleteCollection,\n deleteVariable,\n findVariables,\n getCollection,\n getVariable,\n listCollections,\n listVariables,\n setVariable,\n unbindVariable\n} from '#core/tools/variables'\nimport {\n booleanExclude,\n booleanIntersect,\n booleanSubtract,\n booleanUnion,\n exportHTML,\n exportImage,\n exportPDF,\n exportSVG,\n pathFlip,\n pathGet,\n pathMove,\n pathScale,\n pathSet,\n vectorizeImage,\n viewportGet,\n viewportSet\n} from '#core/tools/vector'\n\n/**\n * Extended tools not in CORE_TOOLS — variables, vector ops, analysis,\n * codegen, advanced structure, path manipulation, etc.\n */\nexport const EXTENDED_TOOLS: ToolDef[] = [\n // Read (advanced)\n getPageTree,\n getReactions,\n getCurrentPage,\n listPages,\n selectNodes,\n queryNodes,\n getComponents,\n listLibraries,\n insertLibraryComponent,\n switchPage,\n pageBounds,\n findEmptySpaceTool,\n getComments,\n addComment,\n replyToComment,\n resolveComment,\n getStatuses,\n setStatus,\n getFontStatus,\n listFonts,\n listAvailableFonts,\n // Style directions\n getStyle,\n // Create (advanced)\n createShape,\n searchIconsTool,\n insertIcon,\n fetchIconsTool,\n combineAsVariants,\n createComponent,\n createInstance,\n detachInstance,\n exposeInstanceSwap,\n createSlot,\n getBehaviour,\n setBehaviour,\n createPage,\n createVector,\n createSlice,\n createConnectorTool,\n importSVG,\n importMermaid,\n importHTML,\n // Image AI, run on the services the user set up in the app\n generateImage,\n generateSVG,\n removeBackground,\n replaceBackground,\n // Modify (advanced)\n setEffects,\n setReactions,\n setOpacity,\n setFont,\n setVisible,\n setConstraints,\n setRotation,\n setMinMax,\n setFontRange,\n setTextResize,\n setBlend,\n setLocked,\n setStrokeAlign,\n setImageFill,\n replaceMatchingProperties,\n rescale,\n // Structure (advanced)\n cloneNode,\n nodeMove,\n renameNode,\n groupNodes,\n ungroupNode,\n flattenNodes,\n nodeToComponent,\n nodeBounds,\n nodeAncestors,\n nodeChildren,\n nodeTree,\n nodeBindings,\n nodeReplaceWith,\n arrangeNodes,\n // Variables\n listVariables,\n listCollections,\n getVariable,\n findVariables,\n createVariable,\n setVariable,\n deleteVariable,\n bindVariable,\n unbindVariable,\n getCollection,\n createCollection,\n deleteCollection,\n // Vector & export\n booleanUnion,\n booleanSubtract,\n booleanIntersect,\n booleanExclude,\n pathGet,\n pathSet,\n pathScale,\n pathFlip,\n pathMove,\n vectorizeImage,\n viewportGet,\n viewportSet,\n exportSVG,\n exportPDF,\n exportImage,\n exportHTML,\n // Analyze & diff\n analyzeColors,\n analyzeTypography,\n lint,\n lintFix,\n analyzeSpacing,\n analyzeClusters,\n analyzeOverlaps,\n diffShow,\n diffApply,\n // Code on canvas\n script,\n // Codegen\n designToTokens,\n importDesignTokens,\n designToComponentMap\n]\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoIA,MAAa,iBAA4B;CAEvC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CAEA;CACA;CACA;AACF"}
|
package/dist/tools/schema.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { FigmaNodeProxy } from "../figma-api/proxy.js";
|
|
|
3
3
|
import { FigmaAPI } from "../figma-api/index.js";
|
|
4
4
|
import { SceneNode } from "@pairdraw/scene-graph";
|
|
5
5
|
import * as v from "valibot";
|
|
6
|
+
import { Color } from "@pairdraw/scene-graph/primitives";
|
|
6
7
|
//#region src/tools/schema.d.ts
|
|
7
8
|
type ToolCapability = 'document:read' | 'document:write' | 'filesystem:read' | 'filesystem:write' | 'network:access' | 'code:execute' | 'settings:read' | 'settings:write';
|
|
8
9
|
type ToolExecution = {
|
|
@@ -34,6 +35,11 @@ interface ToolDef extends ToolMetadata {
|
|
|
34
35
|
*/
|
|
35
36
|
loadFonts: (figma: FigmaAPI, args: Record<string, unknown>) => Promise<void>;
|
|
36
37
|
execute: (figma: FigmaAPI, args: Record<string, unknown>) => unknown;
|
|
38
|
+
/**
|
|
39
|
+
* The synchronous answer of a read whose `execute` may load a page first, or `undefined`
|
|
40
|
+
* when answering would load. Hosts that cannot wait refuse on `undefined` before any load.
|
|
41
|
+
*/
|
|
42
|
+
executeSync?: (figma: FigmaAPI, args: Record<string, unknown>) => unknown;
|
|
37
43
|
}
|
|
38
44
|
type ToolDefinitionMetadata = Omit<ToolMetadata, 'exposure' | 'capabilities' | 'availability'> & Partial<Pick<ToolMetadata, 'exposure' | 'capabilities' | 'availability'>>;
|
|
39
45
|
declare function defineTool<P extends v.ObjectEntries, R>(def: ToolDefinitionMetadata & {
|
|
@@ -44,12 +50,14 @@ declare function defineTool<P extends v.ObjectEntries, R>(def: ToolDefinitionMet
|
|
|
44
50
|
/** The fonts a call's text edits need loaded first; text edits refuse unloaded fonts. */
|
|
45
51
|
fonts?: (figma: FigmaAPI, args: v.InferOutput<v.StrictObjectSchema<P, undefined>>) => FigmaFontNameInput[];
|
|
46
52
|
execute: (figma: FigmaAPI, args: v.InferOutput<v.StrictObjectSchema<P, undefined>>) => R;
|
|
53
|
+
executeSync?: (figma: FigmaAPI, args: v.InferOutput<v.StrictObjectSchema<P, undefined>>) => unknown;
|
|
47
54
|
}): ToolDef;
|
|
48
55
|
/**
|
|
49
|
-
* Every tool run goes through here, so a wrong call from AI chat, the CLI,
|
|
50
|
-
* tool and lists each problem with its argument
|
|
51
|
-
* the
|
|
52
|
-
* strict objects, so a misspelled or mis-nested
|
|
56
|
+
* Every tool run goes through here, so a wrong call from AI chat, the CLI, WebMCP, and MCP names
|
|
57
|
+
* the tool and lists each problem with its argument. An unknown or missing argument names the
|
|
58
|
+
* arguments the tool takes, and a picklist names the values it accepts, read from the schema, so
|
|
59
|
+
* the caller does not have to guess. Inputs are strict objects, so a misspelled or mis-nested
|
|
60
|
+
* argument fails here instead of being dropped.
|
|
53
61
|
*/
|
|
54
62
|
declare function parseToolArgs<S extends v.GenericSchema>(name: string, schema: S, args: unknown): v.InferOutput<S>;
|
|
55
63
|
declare function toolChangesDocument(def: Pick<ToolDef, 'execution'>): boolean;
|
|
@@ -78,6 +86,23 @@ declare function nodeSummary(node: FigmaNodeProxy): {
|
|
|
78
86
|
name: string;
|
|
79
87
|
type: string;
|
|
80
88
|
};
|
|
89
|
+
/**
|
|
90
|
+
* A tool colour, refusing text that would otherwise land as black: `set_fill { color: "#GGG" }`
|
|
91
|
+
* used to paint black and report success. Read through `tryParseColor`, since a published schema
|
|
92
|
+
* cannot express what the parser accepts.
|
|
93
|
+
*/
|
|
94
|
+
declare function parseToolColor(value: string): Color | {
|
|
95
|
+
error: string;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* A colour the caller may leave out. Missing stays missing; text that is not a colour is the
|
|
99
|
+
* same refusal `parseToolColor` gives, so each tool does not repeat that check.
|
|
100
|
+
*/
|
|
101
|
+
declare function parseOptionalToolColor(value: string | undefined): {
|
|
102
|
+
color: Color | undefined;
|
|
103
|
+
} | {
|
|
104
|
+
error: string;
|
|
105
|
+
};
|
|
81
106
|
declare const nodeIdInputSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Node ID">]>;
|
|
82
107
|
declare const nodeInputSchema: v.StrictObjectSchema<{
|
|
83
108
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Node ID">]>;
|
|
@@ -97,5 +122,5 @@ declare const positionInputs: {
|
|
|
97
122
|
/** Reuse a native number schema for both numeric and numeric-string agent inputs. */
|
|
98
123
|
declare function toolNumber(schema?: v.GenericSchema<number, number>): v.UnionSchema<[v.SchemaWithPipe<readonly [v.GenericSchema<number, number>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, number, undefined>]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Expected a nonblank numeric string">, v.DescriptionAction<string, string>, v.TransformAction<any, number>, v.SchemaWithPipe<readonly [v.GenericSchema<number, number>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, number, undefined>]>]>], undefined>;
|
|
99
124
|
//#endregion
|
|
100
|
-
export { NodeNotFoundError, ToolCapability, ToolDef, ToolExecution, ToolExposure, ToolInterface, defineTool, getRawNodeOrError, isAtomicTool, isToolExposed, nodeComparisonInputSchema, nodeIdInputSchema, nodeInputSchema, nodeNotFound, nodeSummary, nodeToResult, nodeTraversalInput, parseToolArgs, positionInputs, requireNode, requireNodes, toolChangesDocument, toolFailure, toolNumber };
|
|
125
|
+
export { NodeNotFoundError, ToolCapability, ToolDef, ToolExecution, ToolExposure, ToolInterface, defineTool, getRawNodeOrError, isAtomicTool, isToolExposed, nodeComparisonInputSchema, nodeIdInputSchema, nodeInputSchema, nodeNotFound, nodeSummary, nodeToResult, nodeTraversalInput, parseOptionalToolColor, parseToolArgs, parseToolColor, positionInputs, requireNode, requireNodes, toolChangesDocument, toolFailure, toolNumber };
|
|
101
126
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","names":[],"sources":["../../src/tools/schema.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.d.ts","names":[],"sources":["../../src/tools/schema.ts"],"mappings":";;;;;;;KAgBY;KAUA;EACN;EAAc;;EACd;EAAe;;KAET;KACA,eAAe,QAAQ,OAAO;UAEhC;EACR;EACA;EACA,WAAW;;EAEX,UAAU;EACV,uBAAuB;EACvB;;UAGe,gBAAgB;EAC/B,OAAO,EAAE,mBAAmB,EAAE;;WAErB;;;;;;EAMT,YAAY,OAAO,UAAU,MAAM,4BAA4B;EAC/D,UAAU,OAAO,UAAU,MAAM;;;;;EAKjC,eAAe,OAAO,UAAU,MAAM;;KAGnC,yBAAyB,KAAK,8DACjC,QAAQ,KAAK;iBAEC,WAAW,UAAU,EAAE,eAAe,GACpD,KAAK;EACH,OAAO,EAAE,mBAAmB;EAC5B,WAAW,iBAAiB,UAAU;IAAyB;;;EAE/D,SACE,OAAO,UACP,MAAM,EAAE,YAAY,EAAE,mBAAmB,mBACtC;EACL,UAAU,OAAO,UAAU,MAAM,EAAE,YAAY,EAAE,mBAAmB,mBAAmB;EACvF,eACE,OAAO,UACP,MAAM,EAAE,YAAY,EAAE,mBAAmB;IAG5C;;;;;;;;iBAiCa,cAAc,UAAU,EAAE,eACxC,cACA,QAAQ,GACR,gBACC,EAAE,YAAY;iBA6HD,oBAAoB,KAAK,KAAK;iBAI9B,cAAc,KAAK,KAAK,sBAAsB,QAAQ;iBAItD,aAAa,KAAK;cAIrB,0BAA0B;EACzB,YAAA;;iBAME,YAAY,OAAO,UAAU,aAAa,WAAW;iBAMrD,aAAa,OAAO,UAAU,KAAK,wBAAwB;;iBAW3D,YAAY;EAAmB;;iBAI/B,aAAa;EAAe;;iBAI5B,kBACd,OAAO,UACP;EACG,MAAM;;EAAgB;;iBAKX,aAAa,MAAM,gBAAgB,oBAAoB;iBAIvD,YAAY,MAAM;EAAmB;EAAY;EAAc;;;;;;;iBAS/D,eAAe,gBAAgB;EAAU;;;;;;iBAYzC,uBACd;EACG,OAAO;;EAAwB;;cAOvB,mBAAiB,EAAA,yBAAA,EAAA,yBAAA,EAAA;cACjB,iBAAe,EAAA;;;cACf,2BAAyB,EAAA;;;;iBAKtB,mBAAmB,2BAAwB,EAAA;;;;cAM9C;;;;;iBAMG,WAAW,SAAQ,EAAE,gCAA0C,EAAA,aAAA,EAAA,yBAAA,EAAA,+BAAA,EAAA,2CAAA,EAAA,6CAAA,EAAA,yBAAA,EAAA,yBAAA,EAAA,2DAAA,EAAA,mCAAA,EAAA,8BAAA,EAAA,yBAAA,EAAA,+BAAA,EAAA,2CAAA,EAAA"}
|
package/dist/tools/schema.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { tryParseColor } from "@pairdraw/scene-graph/color";
|
|
1
2
|
import * as v from "valibot";
|
|
2
3
|
//#region src/tools/schema.ts
|
|
3
4
|
/**
|
|
@@ -22,19 +23,118 @@ function defineTool(def) {
|
|
|
22
23
|
if (!parsed.success) return;
|
|
23
24
|
for (const font of fonts(figma, parsed.output)) await figma.loadFontAsync(font);
|
|
24
25
|
},
|
|
25
|
-
execute: (figma, args) => def.execute(figma, parseToolArgs(def.name, def.input, args))
|
|
26
|
+
execute: (figma, args) => def.execute(figma, parseToolArgs(def.name, def.input, args)),
|
|
27
|
+
executeSync: def.executeSync ? (figma, args) => def.executeSync?.(figma, parseToolArgs(def.name, def.input, args)) : void 0
|
|
26
28
|
};
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
|
-
* Every tool run goes through here, so a wrong call from AI chat, the CLI,
|
|
30
|
-
* tool and lists each problem with its argument
|
|
31
|
-
* the
|
|
32
|
-
* strict objects, so a misspelled or mis-nested
|
|
31
|
+
* Every tool run goes through here, so a wrong call from AI chat, the CLI, WebMCP, and MCP names
|
|
32
|
+
* the tool and lists each problem with its argument. An unknown or missing argument names the
|
|
33
|
+
* arguments the tool takes, and a picklist names the values it accepts, read from the schema, so
|
|
34
|
+
* the caller does not have to guess. Inputs are strict objects, so a misspelled or mis-nested
|
|
35
|
+
* argument fails here instead of being dropped.
|
|
33
36
|
*/
|
|
34
37
|
function parseToolArgs(name, schema, args) {
|
|
35
38
|
const result = v.safeParse(schema, args);
|
|
36
39
|
if (result.success) return result.output;
|
|
37
|
-
throw new Error(
|
|
40
|
+
throw new Error(formatToolArgumentError(name, schema, result.issues));
|
|
41
|
+
}
|
|
42
|
+
/** One refusal for every surface: the tool, then each problem with where it is. */
|
|
43
|
+
function formatToolArgumentError(name, schema, issues) {
|
|
44
|
+
return `Invalid arguments for ${name}:\n${issues.flatMap((issue) => branchIssues(schema, issue)).map(({ keys, issue }) => {
|
|
45
|
+
const place = keys.length > 0 ? `\n → at ${placeOf(keys)}` : "";
|
|
46
|
+
return `× ${formatToolArgIssue(schema, keys, issue)}${place}`;
|
|
47
|
+
}).join("\n")}`;
|
|
48
|
+
}
|
|
49
|
+
function schemaParts(schema) {
|
|
50
|
+
return typeof schema === "object" && schema !== null ? schema : {};
|
|
51
|
+
}
|
|
52
|
+
/** The schema a wrapper such as `optional` or `pipe` holds, down to the one with the rules. */
|
|
53
|
+
function unwrappedSchema(schema) {
|
|
54
|
+
let current = schema;
|
|
55
|
+
for (;;) {
|
|
56
|
+
const wrapped = schemaParts(current).wrapped;
|
|
57
|
+
if (!wrapped) return current;
|
|
58
|
+
current = wrapped;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function issueKeys(issue) {
|
|
62
|
+
const keys = [];
|
|
63
|
+
for (const item of issue.path ?? []) {
|
|
64
|
+
if (!("key" in item)) continue;
|
|
65
|
+
if (typeof item.key === "string" || typeof item.key === "number") keys.push(item.key);
|
|
66
|
+
}
|
|
67
|
+
return keys;
|
|
68
|
+
}
|
|
69
|
+
/** `operations[0].props`: an index reads as part of its array, a name follows a dot. */
|
|
70
|
+
function placeOf(keys) {
|
|
71
|
+
return keys.reduce((place, key) => {
|
|
72
|
+
if (typeof key === "number") return `${place}[${key}]`;
|
|
73
|
+
return place ? `${place}.${key}` : key;
|
|
74
|
+
}, "");
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* `v.union` reports one issue for every branch, which reads as "Expected Object but received
|
|
78
|
+
* Object". Re-check the value against each branch and keep the one that got furthest: the branch
|
|
79
|
+
* whose own problems name the field the caller has to fix.
|
|
80
|
+
*/
|
|
81
|
+
function branchIssues(schema, issue) {
|
|
82
|
+
const keys = issueKeys(issue);
|
|
83
|
+
if (issue.type !== "union") return [{
|
|
84
|
+
keys,
|
|
85
|
+
issue
|
|
86
|
+
}];
|
|
87
|
+
const union = schemaAtPath(schema, keys);
|
|
88
|
+
const options = union ? schemaParts(union).options : void 0;
|
|
89
|
+
if (!options || options.length === 0) return [{
|
|
90
|
+
keys,
|
|
91
|
+
issue
|
|
92
|
+
}];
|
|
93
|
+
let best = null;
|
|
94
|
+
for (const option of options) {
|
|
95
|
+
const parsed = v.safeParse(option, issue.input);
|
|
96
|
+
if (parsed.success) continue;
|
|
97
|
+
if (!best || parsed.issues.length < best.length) best = parsed.issues;
|
|
98
|
+
}
|
|
99
|
+
if (!best || best.length === 0) return [{
|
|
100
|
+
keys,
|
|
101
|
+
issue
|
|
102
|
+
}];
|
|
103
|
+
return best.map((nested) => ({
|
|
104
|
+
keys: [...keys, ...issueKeys(nested)],
|
|
105
|
+
issue: nested
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
function schemaAtPath(root, keys) {
|
|
109
|
+
let current = unwrappedSchema(root);
|
|
110
|
+
for (const key of keys) {
|
|
111
|
+
const parts = schemaParts(current);
|
|
112
|
+
const name = String(key);
|
|
113
|
+
const next = parts.entries && name in parts.entries ? parts.entries[name] : parts.item;
|
|
114
|
+
if (!next) return null;
|
|
115
|
+
current = unwrappedSchema(next);
|
|
116
|
+
}
|
|
117
|
+
return current;
|
|
118
|
+
}
|
|
119
|
+
function formatToolArgIssue(schema, keys, issue) {
|
|
120
|
+
const key = keys.at(-1);
|
|
121
|
+
if (key !== void 0 && (issue.type === "object" || issue.type === "strict_object")) {
|
|
122
|
+
if (issue.expected === "never") {
|
|
123
|
+
const parent = schemaAtPath(schema, keys.slice(0, -1));
|
|
124
|
+
const accepted = parent ? Object.keys(schemaParts(parent).entries ?? {}) : [];
|
|
125
|
+
return accepted.length > 0 ? `Unknown argument "${key}". Accepted: ${accepted.join(", ")}` : `Unknown argument "${key}"`;
|
|
126
|
+
}
|
|
127
|
+
if (issue.received === "undefined") return `Missing required argument "${key}"`;
|
|
128
|
+
}
|
|
129
|
+
if (issue.type === "picklist" && key !== void 0) {
|
|
130
|
+
const resolved = schemaAtPath(schema, keys);
|
|
131
|
+
const options = resolved ? schemaParts(resolved).options : void 0;
|
|
132
|
+
if (options && options.length > 0) {
|
|
133
|
+
const accepted = options.map((option) => JSON.stringify(option)).join(", ");
|
|
134
|
+
return `Invalid value ${issue.received} for argument "${key}". Accepted: ${accepted}`;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return issue.message;
|
|
38
138
|
}
|
|
39
139
|
function toolChangesDocument(def) {
|
|
40
140
|
return def.execution.mutation === "properties" || def.execution.mutation === "document";
|
|
@@ -86,6 +186,24 @@ function nodeSummary(node) {
|
|
|
86
186
|
type: node.type
|
|
87
187
|
};
|
|
88
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* A tool colour, refusing text that would otherwise land as black: `set_fill { color: "#GGG" }`
|
|
191
|
+
* used to paint black and report success. Read through `tryParseColor`, since a published schema
|
|
192
|
+
* cannot express what the parser accepts.
|
|
193
|
+
*/
|
|
194
|
+
function parseToolColor(value) {
|
|
195
|
+
return tryParseColor(value) ?? { error: `"${value}" is not a color; use a hex value, a color name, or a color function` };
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* A colour the caller may leave out. Missing stays missing; text that is not a colour is the
|
|
199
|
+
* same refusal `parseToolColor` gives, so each tool does not repeat that check.
|
|
200
|
+
*/
|
|
201
|
+
function parseOptionalToolColor(value) {
|
|
202
|
+
if (value === void 0) return { color: void 0 };
|
|
203
|
+
const parsed = parseToolColor(value);
|
|
204
|
+
if ("error" in parsed) return parsed;
|
|
205
|
+
return { color: parsed };
|
|
206
|
+
}
|
|
89
207
|
const nodeIdInputSchema = v.pipe(v.string(), v.description("Node ID"));
|
|
90
208
|
const nodeInputSchema = v.strictObject({ id: nodeIdInputSchema });
|
|
91
209
|
const nodeComparisonInputSchema = v.strictObject({
|
|
@@ -108,6 +226,6 @@ function toolNumber(schema = v.number()) {
|
|
|
108
226
|
return v.union([finite, v.pipe(v.string(), v.regex(/\S/, "Expected a nonblank numeric string"), v.description(v.getDescription(schema) ?? "Numeric value"), v.transform(Number), finite)]);
|
|
109
227
|
}
|
|
110
228
|
//#endregion
|
|
111
|
-
export { NodeNotFoundError, defineTool, getRawNodeOrError, isAtomicTool, isToolExposed, nodeComparisonInputSchema, nodeIdInputSchema, nodeInputSchema, nodeNotFound, nodeSummary, nodeToResult, nodeTraversalInput, parseToolArgs, positionInputs, requireNode, requireNodes, toolChangesDocument, toolFailure, toolNumber };
|
|
229
|
+
export { NodeNotFoundError, defineTool, getRawNodeOrError, isAtomicTool, isToolExposed, nodeComparisonInputSchema, nodeIdInputSchema, nodeInputSchema, nodeNotFound, nodeSummary, nodeToResult, nodeTraversalInput, parseOptionalToolColor, parseToolArgs, parseToolColor, positionInputs, requireNode, requireNodes, toolChangesDocument, toolFailure, toolNumber };
|
|
112
230
|
|
|
113
231
|
//# sourceMappingURL=schema.js.map
|