@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
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { FigmaFont } from '#core/figma-api/fonts/names'
|
|
2
|
+
import { fontManager } from '#core/text/font/manager'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Every face a script can set, as Figma's `listAvailableFontsAsync` lists them: each family's
|
|
6
|
+
* faces as far as they are known, from its installed, bundled, or web fonts. Listing families can
|
|
7
|
+
* forget the faces found so far (the first request for local fonts does), so a family whose faces
|
|
8
|
+
* were found before, or a font is loaded from, is looked up again. A web family nobody has looked
|
|
9
|
+
* up is listed as `Regular`, since its faces take a request each.
|
|
10
|
+
*/
|
|
11
|
+
export async function listFigmaFonts(): Promise<FigmaFont[]> {
|
|
12
|
+
const found = new Set(fontManager.familiesWithFoundFaces())
|
|
13
|
+
const families = await fontManager.listFamilyOptions()
|
|
14
|
+
await Promise.all(
|
|
15
|
+
families
|
|
16
|
+
.filter(({ family }) => found.has(family) || fontManager.isLoaded(family))
|
|
17
|
+
.map(({ family }) => fontManager.familyFaces(family).catch(() => null))
|
|
18
|
+
)
|
|
19
|
+
return families.flatMap(({ family }) => {
|
|
20
|
+
const faces = fontManager.familyFacesSync(family)
|
|
21
|
+
const styles = faces?.length ? faces.map(({ style }) => style) : ['Regular']
|
|
22
|
+
return styles.map((style) => ({ fontName: { family, style } }))
|
|
23
|
+
})
|
|
24
|
+
}
|
package/src/figma-api/index.ts
CHANGED
|
@@ -22,6 +22,7 @@ import { fontManager } from '#core/text/font/manager'
|
|
|
22
22
|
|
|
23
23
|
import { componentFromNode } from './components'
|
|
24
24
|
import { flattenSceneNodes } from './flatten'
|
|
25
|
+
import { listFigmaFonts } from './fonts/list'
|
|
25
26
|
import { loadFigmaFont } from './fonts/load'
|
|
26
27
|
import type { FigmaFontNameInput } from './fonts/names'
|
|
27
28
|
import { variationAxisTags } from './fonts/variations'
|
|
@@ -44,7 +45,17 @@ import type {
|
|
|
44
45
|
FigmaVectorNode
|
|
45
46
|
} from './node-types'
|
|
46
47
|
import { startPendingLayout } from './pending-layout'
|
|
47
|
-
import {
|
|
48
|
+
import { flushPendingComponentSync, startPendingComponentSync } from './pending-sync'
|
|
49
|
+
import {
|
|
50
|
+
FigmaNodeProxy,
|
|
51
|
+
INTERNAL_ID,
|
|
52
|
+
loadPage,
|
|
53
|
+
MIXED,
|
|
54
|
+
pageOfNode,
|
|
55
|
+
setPageHost,
|
|
56
|
+
type FigmaFont,
|
|
57
|
+
type NodeProxyHost
|
|
58
|
+
} from './proxy'
|
|
48
59
|
import { newShapeWithText } from './shape-with-text'
|
|
49
60
|
import type { ExportImageOptions } from './types'
|
|
50
61
|
import { figmaUtil } from './util'
|
|
@@ -53,15 +64,66 @@ import { combineComponentsAsVariants } from './variants'
|
|
|
53
64
|
|
|
54
65
|
const noop = () => undefined
|
|
55
66
|
|
|
67
|
+
/** A view of the document: its centre point and its zoom. */
|
|
68
|
+
export interface FigmaViewport {
|
|
69
|
+
center: Vector
|
|
70
|
+
zoom: number
|
|
71
|
+
}
|
|
72
|
+
|
|
56
73
|
/** What a host passes to `FigmaAPI` beyond the document. */
|
|
57
74
|
export interface FigmaAPIOptions {
|
|
58
75
|
/** Fetches the HTTP(S) URLs `figma.createImageAsync` loads; the global `fetch` by default. */
|
|
59
76
|
fetch?: images.ImageFetch
|
|
77
|
+
/**
|
|
78
|
+
* Loads a page's layers, for a host that loads pages as they are visited, as the editor does a
|
|
79
|
+
* file it opens: `page.loadAsync`, `figma.loadAllPagesAsync`, and `setCurrentPageAsync` call
|
|
80
|
+
* it, as they load pages in Figma's dynamic-page mode. Without one every page is in memory.
|
|
81
|
+
*/
|
|
82
|
+
loadPage?: (pageId: string) => Promise<void>
|
|
83
|
+
/** The page holding a layer not loaded yet, which `getNodeByIdAsync` loads to find it. */
|
|
84
|
+
pageOfNode?: (nodeId: string) => Promise<string | null>
|
|
85
|
+
/**
|
|
86
|
+
* Runs when a script puts the API on another page, so a host can show that page too. The host
|
|
87
|
+
* owns which page is on screen, and a plugin that switches page expects to see it switched.
|
|
88
|
+
*/
|
|
89
|
+
onPageChange?: (pageId: string) => void | Promise<void>
|
|
90
|
+
/**
|
|
91
|
+
* Runs when a script moves the viewport, so a host can show the same view. A host owns the
|
|
92
|
+
* viewport on screen, and a plugin that pans or zooms expects to see the result.
|
|
93
|
+
*/
|
|
94
|
+
onViewportChange?: (viewport: FigmaViewport) => void
|
|
95
|
+
/**
|
|
96
|
+
* The page the host already shows. Seeded here rather than assigned after construction, so a
|
|
97
|
+
* plain tool call does not ask the host to switch to the page it is already on.
|
|
98
|
+
*/
|
|
99
|
+
pageId?: string
|
|
100
|
+
/**
|
|
101
|
+
* The view the host already shows, seeded for the same reason: a tool that only reads or draws
|
|
102
|
+
* must not move the viewport of whoever is looking at the document.
|
|
103
|
+
*/
|
|
104
|
+
viewport?: FigmaViewport
|
|
105
|
+
/**
|
|
106
|
+
* Runs when a script sets the page selection, so a host can select those layers too. The host
|
|
107
|
+
* owns which layers are selected on screen, and a plugin that selects expects to see them selected.
|
|
108
|
+
*/
|
|
109
|
+
onSelectionChange?: (ids: readonly string[], pageId: string) => void
|
|
110
|
+
/**
|
|
111
|
+
* The selection the host already shows, seeded for the same reason as the page and the viewport:
|
|
112
|
+
* a tool that only reads must not reselect what is already selected.
|
|
113
|
+
*/
|
|
114
|
+
selection?: readonly string[]
|
|
115
|
+
/**
|
|
116
|
+
* Brings instances in line with the component edits made so far, for a host that syncs them
|
|
117
|
+
* after edits itself, as the editor does; reading a layer calls it first. Without one the API
|
|
118
|
+
* records edits and syncs their instances itself.
|
|
119
|
+
*/
|
|
120
|
+
flushComponentSync?: () => void
|
|
60
121
|
}
|
|
61
122
|
|
|
62
123
|
export { FigmaNodeProxy } from './proxy'
|
|
63
124
|
export { getPageBackgrounds, setPageBackgrounds } from './page-backgrounds'
|
|
64
125
|
export { flushPendingLayout } from './pending-layout'
|
|
126
|
+
export { flushPendingComponentSync } from './pending-sync'
|
|
65
127
|
export type { FigmaEffect } from './effects'
|
|
66
128
|
export type { ExportImageOptions } from './types'
|
|
67
129
|
export {
|
|
@@ -103,6 +165,25 @@ export type { FigmaVariationSettings } from './fonts/variations'
|
|
|
103
165
|
|
|
104
166
|
// TODO(figma-api): Implement the full official PluginAPI interface once our compatibility
|
|
105
167
|
// layer covers all required node-specific return types and unsupported APIs are modeled explicitly.
|
|
168
|
+
/** What a plugin keeps in `figma.clientStorage`: JSON values, copied in and out. */
|
|
169
|
+
const clientStorageValues = new Map<string, unknown>()
|
|
170
|
+
|
|
171
|
+
const clientStorage: ClientStorageAPI = {
|
|
172
|
+
async getAsync(key: string): Promise<unknown> {
|
|
173
|
+
const value = clientStorageValues.get(key)
|
|
174
|
+
return value === undefined ? undefined : structuredClone(value)
|
|
175
|
+
},
|
|
176
|
+
async setAsync(key: string, value: unknown): Promise<void> {
|
|
177
|
+
clientStorageValues.set(key, structuredClone(value))
|
|
178
|
+
},
|
|
179
|
+
async deleteAsync(key: string): Promise<void> {
|
|
180
|
+
clientStorageValues.delete(key)
|
|
181
|
+
},
|
|
182
|
+
async keysAsync(): Promise<string[]> {
|
|
183
|
+
return [...clientStorageValues.keys()]
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
106
187
|
export class FigmaAPI implements NodeProxyHost {
|
|
107
188
|
readonly graph: SceneGraph
|
|
108
189
|
private _currentPageId: string
|
|
@@ -118,17 +199,43 @@ export class FigmaAPI implements NodeProxyHost {
|
|
|
118
199
|
readonly util: UtilAPI = figmaUtil
|
|
119
200
|
/** The document's variables and collections, as Figma's `figma.variables`. */
|
|
120
201
|
readonly variables: FigmaVariablesAPI
|
|
202
|
+
/** Values a plugin keeps for its next run, as Figma's `figma.clientStorage`. */
|
|
203
|
+
readonly clientStorage: ClientStorageAPI = clientStorage
|
|
121
204
|
|
|
122
205
|
/** How `createImageAsync` fetches HTTP(S) URLs; a host passes one that gets past CORS. */
|
|
123
206
|
readonly #fetch: images.ImageFetch
|
|
207
|
+
readonly #onPageChange: ((pageId: string) => void | Promise<void>) | undefined
|
|
208
|
+
readonly #onViewportChange: ((viewport: FigmaViewport) => void) | undefined
|
|
209
|
+
readonly #onSelectionChange: ((ids: readonly string[], pageId: string) => void) | undefined
|
|
210
|
+
/** The last host page switch, so `setCurrentPageAsync` can wait for it. */
|
|
211
|
+
#pageChange: Promise<void> = Promise.resolve()
|
|
212
|
+
/** Counts page switches, so a switch whose page loads after a later one does not undo it. */
|
|
213
|
+
#pageSwitch = 0
|
|
124
214
|
|
|
125
215
|
constructor(graph: SceneGraph, options: FigmaAPIOptions = {}) {
|
|
126
216
|
this.graph = graph
|
|
127
217
|
this.#fetch = options.fetch ?? ((input, init) => fetch(input, init))
|
|
218
|
+
if (options.loadPage)
|
|
219
|
+
setPageHost(this, { load: options.loadPage, pageOfNode: options.pageOfNode })
|
|
220
|
+
this.#onPageChange = options.onPageChange
|
|
221
|
+
this.#onViewportChange = options.onViewportChange
|
|
222
|
+
this.#onSelectionChange = options.onSelectionChange
|
|
128
223
|
this.variables = new FigmaVariablesAPI(graph)
|
|
129
224
|
startPendingLayout(graph)
|
|
130
|
-
|
|
131
|
-
this._currentPageId =
|
|
225
|
+
startPendingComponentSync(graph, options.flushComponentSync)
|
|
226
|
+
this._currentPageId = pageIdToStart(graph, options.pageId)
|
|
227
|
+
if (options.viewport) {
|
|
228
|
+
this._viewport = {
|
|
229
|
+
x: options.viewport.center.x,
|
|
230
|
+
y: options.viewport.center.y,
|
|
231
|
+
zoom: options.viewport.zoom
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
// Seeded here, not assigned through the setter, so a tool that only reads does not ask the
|
|
235
|
+
// host to select the layers it is already showing.
|
|
236
|
+
this._selection = (options.selection ?? []).flatMap((id) =>
|
|
237
|
+
this.graph.getNode(id) ? [this.wrapNode(id)] : []
|
|
238
|
+
)
|
|
132
239
|
}
|
|
133
240
|
|
|
134
241
|
setRenderer(renderer: SkiaRenderer | null): void {
|
|
@@ -159,7 +266,12 @@ export class FigmaAPI implements NodeProxyHost {
|
|
|
159
266
|
Object.defineProperty(proxy, 'selection', {
|
|
160
267
|
get: () => this._selection,
|
|
161
268
|
set: (nodes: FigmaNodeProxy[]) => {
|
|
269
|
+
const next = nodes.map((node) => node[INTERNAL_ID])
|
|
270
|
+
const current = this._selection.map((node) => node[INTERNAL_ID])
|
|
162
271
|
this._selection = nodes
|
|
272
|
+
if (next.length === current.length && next.every((id, index) => id === current[index]))
|
|
273
|
+
return
|
|
274
|
+
this.#onSelectionChange?.(next, this._currentPageId)
|
|
163
275
|
},
|
|
164
276
|
enumerable: true,
|
|
165
277
|
configurable: true
|
|
@@ -178,17 +290,32 @@ export class FigmaAPI implements NodeProxyHost {
|
|
|
178
290
|
}
|
|
179
291
|
|
|
180
292
|
set currentPage(page: FigmaNodeProxy) {
|
|
181
|
-
|
|
293
|
+
const pageId = page[INTERNAL_ID]
|
|
294
|
+
this.#pageSwitch++
|
|
295
|
+
if (pageId === this._currentPageId) return
|
|
296
|
+
this._currentPageId = pageId
|
|
297
|
+
this.#pageChange = Promise.resolve(this.#onPageChange?.(pageId))
|
|
182
298
|
}
|
|
183
299
|
|
|
184
300
|
getNodeById(id: string): FigmaNodeProxy | null {
|
|
301
|
+
flushPendingComponentSync(this.graph)
|
|
185
302
|
const node = this.graph.getNode(id)
|
|
186
303
|
return node ? this.wrapNode(id) : null
|
|
187
304
|
}
|
|
188
305
|
|
|
189
|
-
/**
|
|
306
|
+
/** As in Figma's dynamic-page mode, a layer on a page not loaded yet loads that page. */
|
|
190
307
|
async getNodeByIdAsync(id: string): Promise<FigmaNodeProxy | null> {
|
|
191
|
-
|
|
308
|
+
const node = this.getNodeById(id)
|
|
309
|
+
// A page asked for by id is its own holder, and one whose layers are not in yet loads first.
|
|
310
|
+
const unloadedPage = node?.type === 'CANVAS' && this.graph.getChildren(id).length === 0
|
|
311
|
+
if (node && !unloadedPage) return node
|
|
312
|
+
const pageId = node
|
|
313
|
+
? id
|
|
314
|
+
: ((await pageOfNode(this, id)) ??
|
|
315
|
+
(this.graph.getPages().some((page) => page.id === id) ? id : null))
|
|
316
|
+
if (!pageId) return null
|
|
317
|
+
await loadPage(this, pageId)
|
|
318
|
+
return this.getNodeById(id) ?? node
|
|
192
319
|
}
|
|
193
320
|
|
|
194
321
|
/**
|
|
@@ -203,8 +330,16 @@ export class FigmaAPI implements NodeProxyHost {
|
|
|
203
330
|
if (this._rawNode(page).type !== 'CANVAS') {
|
|
204
331
|
return Promise.reject(new Error('figma.setCurrentPageAsync expects a PageNode'))
|
|
205
332
|
}
|
|
206
|
-
|
|
207
|
-
|
|
333
|
+
const pageId = this._nodeId(page)
|
|
334
|
+
const pageSwitch = ++this.#pageSwitch
|
|
335
|
+
return loadPage(this, pageId).then(() => {
|
|
336
|
+
if (pageSwitch !== this.#pageSwitch) return undefined
|
|
337
|
+
if (this.graph.getNode(pageId)?.type !== 'CANVAS')
|
|
338
|
+
throw new Error('in setCurrentPageAsync: The page was removed while it loaded')
|
|
339
|
+
this._currentPageId = pageId
|
|
340
|
+
this.#pageChange = Promise.resolve(this.#onPageChange?.(pageId))
|
|
341
|
+
return this.#pageChange
|
|
342
|
+
})
|
|
208
343
|
}
|
|
209
344
|
|
|
210
345
|
// --- Node Creation ---
|
|
@@ -497,9 +632,7 @@ export class FigmaAPI implements NodeProxyHost {
|
|
|
497
632
|
|
|
498
633
|
private _viewport = { x: 0, y: 0, zoom: 1 }
|
|
499
634
|
|
|
500
|
-
get viewport(): {
|
|
501
|
-
center: Vector
|
|
502
|
-
zoom: number
|
|
635
|
+
get viewport(): FigmaViewport & {
|
|
503
636
|
scrollAndZoomIntoView: (nodes: readonly { absoluteBoundingBox: Rect }[]) => void
|
|
504
637
|
} {
|
|
505
638
|
return {
|
|
@@ -515,13 +648,26 @@ export class FigmaAPI implements NodeProxyHost {
|
|
|
515
648
|
const viewW = IS_BROWSER ? window.innerWidth : 1280
|
|
516
649
|
const viewH = IS_BROWSER ? window.innerHeight : 720
|
|
517
650
|
const zoom = Math.min(viewW / contentW, viewH / contentH, 1)
|
|
651
|
+
// A script scrolling to its own result must not move the view someone else is looking at:
|
|
652
|
+
// only `viewport` and a page switch do that.
|
|
518
653
|
this._viewport = { x: b.x + b.width / 2, y: b.y + b.height / 2, zoom }
|
|
519
654
|
}
|
|
520
655
|
}
|
|
521
656
|
}
|
|
522
657
|
|
|
523
|
-
set viewport(v:
|
|
524
|
-
this.
|
|
658
|
+
set viewport(v: FigmaViewport) {
|
|
659
|
+
this._showViewport({ x: v.center.x, y: v.center.y, zoom: v.zoom })
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* Moves the viewport and puts the host on the same view. A tool that scrolls nodes into view
|
|
664
|
+
* does not call this: only a viewport a writer asks for moves the view of whoever is looking.
|
|
665
|
+
*/
|
|
666
|
+
private _showViewport(next: { x: number; y: number; zoom: number }): void {
|
|
667
|
+
const current = this._viewport
|
|
668
|
+
this._viewport = next
|
|
669
|
+
if (current.x === next.x && current.y === next.y && current.zoom === next.zoom) return
|
|
670
|
+
this.#onViewportChange?.({ center: { x: next.x, y: next.y }, zoom: next.zoom })
|
|
525
671
|
}
|
|
526
672
|
|
|
527
673
|
createImage(data: Uint8Array): Image {
|
|
@@ -559,10 +705,9 @@ export class FigmaAPI implements NodeProxyHost {
|
|
|
559
705
|
return variation ? variationAxisTags(variation.axes) : null
|
|
560
706
|
}
|
|
561
707
|
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
return []
|
|
708
|
+
/** Every face a script can set, by family; see {@link listFigmaFonts}. */
|
|
709
|
+
listAvailableFontsAsync(): Promise<FigmaFont[]> {
|
|
710
|
+
return listFigmaFonts()
|
|
566
711
|
}
|
|
567
712
|
|
|
568
713
|
base64Encode(data: Uint8Array): string {
|
|
@@ -587,9 +732,9 @@ export class FigmaAPI implements NodeProxyHost {
|
|
|
587
732
|
if (message) this.notify(message)
|
|
588
733
|
}
|
|
589
734
|
|
|
590
|
-
/**
|
|
735
|
+
/** Loads every page's layers, one after another, for a host that loads them as visited. */
|
|
591
736
|
async loadAllPagesAsync(): Promise<void> {
|
|
592
|
-
|
|
737
|
+
for (const page of this.graph.getPages()) await loadPage(this, page.id)
|
|
593
738
|
}
|
|
594
739
|
|
|
595
740
|
commitUndo(): void {
|
|
@@ -607,3 +752,9 @@ export class FigmaAPI implements NodeProxyHost {
|
|
|
607
752
|
/** The document as it was before the current AI run first edited `pageId`, or null if unedited. */
|
|
608
753
|
changeBaseline?: (pageId: string) => SceneGraph | null
|
|
609
754
|
}
|
|
755
|
+
|
|
756
|
+
/** The page an API starts on: the one the host shows, else the document's first page. */
|
|
757
|
+
function pageIdToStart(graph: SceneGraph, pageId?: string): string {
|
|
758
|
+
const pages = graph.getPages()
|
|
759
|
+
return pageId ?? (pages.length > 0 ? pages[0].id : graph.rootId)
|
|
760
|
+
}
|
|
@@ -226,7 +226,7 @@ function withoutEdits(graph: SceneGraph, state: InstanceOverrideState): Instance
|
|
|
226
226
|
* Figma's `resetOverrides`: the instance and every instance inside it go back to their
|
|
227
227
|
* components, keeping the values their component properties set.
|
|
228
228
|
*/
|
|
229
|
-
function resetInstanceOverrides(graph: SceneGraph, root: SceneNode): void {
|
|
229
|
+
export function resetInstanceOverrides(graph: SceneGraph, root: SceneNode): void {
|
|
230
230
|
// A layer put in place of a component's layer goes, and the sync brings that layer back.
|
|
231
231
|
const replaced: string[] = []
|
|
232
232
|
const collect = (node: SceneNode) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SceneGraph } from '@pairdraw/scene-graph'
|
|
1
|
+
import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
2
2
|
import {
|
|
3
3
|
createSceneMutationImpact,
|
|
4
4
|
recordSceneMutations,
|
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
|
|
8
8
|
import { createLayoutRunner } from '#core/layout/mutations'
|
|
9
9
|
|
|
10
|
+
import { flushPendingComponentSync } from './pending-sync'
|
|
11
|
+
|
|
10
12
|
interface PendingLayout {
|
|
11
13
|
impact: SceneMutationImpact
|
|
12
14
|
flushing: boolean
|
|
@@ -40,6 +42,8 @@ export function startPendingLayout(graph: SceneGraph): void {
|
|
|
40
42
|
|
|
41
43
|
/** Lays out the edits recorded since the last geometry read. */
|
|
42
44
|
export function flushPendingLayout(graph: SceneGraph): void {
|
|
45
|
+
// Instances lay out what their components hold now.
|
|
46
|
+
flushPendingComponentSync(graph)
|
|
43
47
|
const pending = pendingByGraph.get(graph)
|
|
44
48
|
if (!pending || pending.flushing || pending.impact.changedNodeIds.size === 0) return
|
|
45
49
|
const impact = structuredClone(pending.impact)
|
|
@@ -55,3 +59,48 @@ export function flushPendingLayout(graph: SceneGraph): void {
|
|
|
55
59
|
pending.flushing = false
|
|
56
60
|
}
|
|
57
61
|
}
|
|
62
|
+
|
|
63
|
+
/** Whether a frame resizing would move or stretch the layer: a constraint other than left or top. */
|
|
64
|
+
function followsFrameSize(node: SceneNode): boolean {
|
|
65
|
+
return node.horizontalConstraint !== 'MIN' || node.verticalConstraint !== 'MIN'
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** The layer and the layers above it, up to but not including its page. */
|
|
69
|
+
function layoutChain(graph: SceneGraph, id: string): string[] {
|
|
70
|
+
const chain: string[] = []
|
|
71
|
+
for (let node = graph.getNode(id); node && node.type !== 'CANVAS';) {
|
|
72
|
+
chain.push(node.id)
|
|
73
|
+
node = node.parentId ? graph.getNode(node.parentId) : undefined
|
|
74
|
+
}
|
|
75
|
+
return chain
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Whether laying out the recorded edits could reach the layer: an edit sits in the same frame as
|
|
80
|
+
* the layer, at any depth, since a layer that grows makes every Hug frame around it grow. Edits
|
|
81
|
+
* in another top-level frame share only the page with it, and leave it where it is.
|
|
82
|
+
*/
|
|
83
|
+
function editsReach(graph: SceneGraph, impact: SceneMutationImpact, node: SceneNode): boolean {
|
|
84
|
+
const above = new Set(layoutChain(graph, node.id))
|
|
85
|
+
const edited = [...impact.changedNodeIds, ...impact.currentParentIds, ...impact.previousParentIds]
|
|
86
|
+
return edited.some((id) => layoutChain(graph, id).some((current) => above.has(current)))
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Lays out the recorded edits before a script moves or sizes `node`, when that layout could change
|
|
91
|
+
* where it lands, as Figma lays out a script's edits while it runs: the layer follows its frame's
|
|
92
|
+
* size, or a resize places its children from its own size. A layer pinned left and top, or one
|
|
93
|
+
* an auto layout places, lands the same either way, so its edits wait for the next read: a script
|
|
94
|
+
* that builds many layers lays out once rather than once per layer.
|
|
95
|
+
*/
|
|
96
|
+
export function flushPendingLayoutBefore(
|
|
97
|
+
graph: SceneGraph,
|
|
98
|
+
node: SceneNode,
|
|
99
|
+
{ placesChildren = false }: { placesChildren?: boolean } = {}
|
|
100
|
+
): void {
|
|
101
|
+
const pending = pendingByGraph.get(graph)
|
|
102
|
+
if (!pending || pending.flushing || pending.impact.changedNodeIds.size === 0) return
|
|
103
|
+
const depends =
|
|
104
|
+
followsFrameSize(node) || (placesChildren && graph.getChildren(node.id).some(followsFrameSize))
|
|
105
|
+
if (depends && editsReach(graph, pending.impact, node)) flushPendingLayout(graph)
|
|
106
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { SceneGraph } from '@pairdraw/scene-graph'
|
|
2
|
+
import {
|
|
3
|
+
createSceneMutationImpact,
|
|
4
|
+
recordSceneMutations
|
|
5
|
+
} from '@pairdraw/scene-graph/mutation-impact'
|
|
6
|
+
|
|
7
|
+
import { syncComponentsHolding } from '#core/editor/component-sync'
|
|
8
|
+
|
|
9
|
+
const syncByGraph = new WeakMap<SceneGraph, () => void>()
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Makes reading a layer bring instances in line with the component edits made before it, as Figma
|
|
13
|
+
* does at once: a script that recolors a component and then reads an instance sees the new color.
|
|
14
|
+
* A host that already syncs instances after edits, such as the editor, passes its own `flush`,
|
|
15
|
+
* which also lays out and redraws what it synced. Without one the graph records its edits itself,
|
|
16
|
+
* for its lifetime, as `startPendingLayout` does.
|
|
17
|
+
*/
|
|
18
|
+
export function startPendingComponentSync(graph: SceneGraph, flush?: () => void): void {
|
|
19
|
+
if (flush) {
|
|
20
|
+
syncByGraph.set(graph, flush)
|
|
21
|
+
return
|
|
22
|
+
}
|
|
23
|
+
if (syncByGraph.has(graph)) return
|
|
24
|
+
const impact = createSceneMutationImpact()
|
|
25
|
+
let syncing = false
|
|
26
|
+
// Syncing writes the instances it updates, which are results, not edits; so do loading and layout.
|
|
27
|
+
recordSceneMutations(
|
|
28
|
+
graph,
|
|
29
|
+
impact,
|
|
30
|
+
() => !syncing && !graph.isApplyingImportedState && !graph.isApplyingLayout
|
|
31
|
+
)
|
|
32
|
+
syncByGraph.set(graph, () => {
|
|
33
|
+
if (syncing || impact.changedNodeIds.size === 0) return
|
|
34
|
+
const changed = [...impact.changedNodeIds]
|
|
35
|
+
const leftParents = [...impact.previousParentIds]
|
|
36
|
+
for (const recorded of Object.values(impact)) recorded.clear()
|
|
37
|
+
syncing = true
|
|
38
|
+
try {
|
|
39
|
+
syncComponentsHolding(graph, [...changed, ...leftParents])
|
|
40
|
+
} catch (error) {
|
|
41
|
+
// The edits are still unsynced, so the next read tries again, as pending layout does.
|
|
42
|
+
for (const id of changed) impact.changedNodeIds.add(id)
|
|
43
|
+
for (const id of leftParents) impact.previousParentIds.add(id)
|
|
44
|
+
throw error
|
|
45
|
+
} finally {
|
|
46
|
+
syncing = false
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Syncs the instances of the components edited since, before a read; given the layer about to be
|
|
53
|
+
* read or written, only when it is in an instance, as only those layers change. Edits inside a
|
|
54
|
+
* component then sync once, when an instance is next read, not once per edit.
|
|
55
|
+
*/
|
|
56
|
+
export function flushPendingComponentSync(graph: SceneGraph, layerId?: string): void {
|
|
57
|
+
const flush = syncByGraph.get(graph)
|
|
58
|
+
if (!flush) return
|
|
59
|
+
if (layerId !== undefined && !graph.closest(layerId, (node) => node.type === 'INSTANCE')) return
|
|
60
|
+
flush()
|
|
61
|
+
}
|
package/src/figma-api/proxy.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { prepareFollowedFieldEdit, fitGroupsAround } from './accessor-utils'
|
|
|
21
21
|
import { installBasicNodeProxyAccessors } from './accessors/basic'
|
|
22
22
|
import { installConnectorNodeProxyAccessors } from './accessors/connector'
|
|
23
23
|
import { installLayoutNodeProxyAccessors } from './accessors/layout'
|
|
24
|
+
import { installReactionAccessors } from './accessors/reactions'
|
|
24
25
|
import { installShapeNodeProxyAccessors } from './accessors/shape'
|
|
25
26
|
import { installStickyNodeProxyAccessors, pluginChildren } from './accessors/sticky'
|
|
26
27
|
import { installStrokeNodeProxyAccessors } from './accessors/strokes'
|
|
@@ -43,7 +44,9 @@ import type { FigmaFrameNode, FigmaInstanceNode } from './node-types'
|
|
|
43
44
|
import { installInstanceOverrideAccessors, type FigmaInstanceOverride } from './overrides'
|
|
44
45
|
import { getPageBackgrounds, setPageBackgrounds } from './page-backgrounds'
|
|
45
46
|
import { parseFigmaPaints, toFigmaPaint, type FigmaPaint } from './paints'
|
|
47
|
+
import { flushPendingComponentSync } from './pending-sync'
|
|
46
48
|
import { installPluginDataMethods, type PluginDataMethods } from './plugin-data'
|
|
49
|
+
import type { FigmaReaction } from './reactions'
|
|
47
50
|
import { nodeProxyToJSON } from './serialization'
|
|
48
51
|
import { installShapeWithTextAccessors } from './shape-with-text'
|
|
49
52
|
import { installSlotAccessors, prepareSlotMove, prepareSlotRemoval } from './slots'
|
|
@@ -61,6 +64,31 @@ export const INTERNAL_ID = Symbol('id')
|
|
|
61
64
|
export const INTERNAL_GRAPH = Symbol('graph')
|
|
62
65
|
export const INTERNAL_API = Symbol('api')
|
|
63
66
|
|
|
67
|
+
/** How a host loads pages as they are visited; see `FigmaAPIOptions`. */
|
|
68
|
+
export interface PageHost {
|
|
69
|
+
load: (pageId: string) => Promise<void>
|
|
70
|
+
pageOfNode?: (nodeId: string) => Promise<string | null>
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* How each API loads a page's layers, a host's hook kept off `figma`, which has only Figma's
|
|
75
|
+
* members. Without one every page is in memory.
|
|
76
|
+
*/
|
|
77
|
+
const pageHosts = new WeakMap<NodeProxyHost, PageHost>()
|
|
78
|
+
|
|
79
|
+
export function setPageHost(api: NodeProxyHost, host: PageHost): void {
|
|
80
|
+
pageHosts.set(api, host)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function loadPage(api: NodeProxyHost, pageId: string): Promise<void> {
|
|
84
|
+
return pageHosts.get(api)?.load(pageId) ?? Promise.resolve()
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** The page holding a layer not loaded yet, which loading that page brings in. */
|
|
88
|
+
export function pageOfNode(api: NodeProxyHost, nodeId: string): Promise<string | null> {
|
|
89
|
+
return pageHosts.get(api)?.pageOfNode?.(nodeId) ?? Promise.resolve(null)
|
|
90
|
+
}
|
|
91
|
+
|
|
64
92
|
export interface NodeProxyHost {
|
|
65
93
|
wrapNode(id: string): FigmaNodeProxy
|
|
66
94
|
readonly currentPageId: string
|
|
@@ -171,6 +199,8 @@ export class FigmaNodeProxy {
|
|
|
171
199
|
declare readonly boundVariables: VariableNodeMembers['boundVariables']
|
|
172
200
|
declare setBoundVariable: VariableNodeMembers['setBoundVariable']
|
|
173
201
|
declare readonly overrides: FigmaInstanceOverride[] | undefined
|
|
202
|
+
/** Prototype connections, in Figma's plugin shape; refused when the play cannot run them. */
|
|
203
|
+
declare reactions: readonly FigmaReaction[]
|
|
174
204
|
/** A sticky note's body or a shape's label, a sticky's author line, and whether it is wide. */
|
|
175
205
|
declare readonly text: FigmaNodeProxy | undefined
|
|
176
206
|
declare readonly authorName: string | undefined
|
|
@@ -273,9 +303,9 @@ export class FigmaNodeProxy {
|
|
|
273
303
|
if (type === 'VECTOR') installVectorNodeProxyAccessors(this, internals, MIXED)
|
|
274
304
|
if (type) installShapeNodeProxyAccessors(this, internals, type)
|
|
275
305
|
// Figma loads a page's layers on demand in dynamic-page mode and has `loadAsync` on pages
|
|
276
|
-
// alone
|
|
306
|
+
// alone, as the editor loads a page's layers when it is first visited.
|
|
277
307
|
if (type === 'CANVAS')
|
|
278
|
-
Object.defineProperty(this, 'loadAsync', { value: () =>
|
|
308
|
+
Object.defineProperty(this, 'loadAsync', { value: () => loadPage(api, id) })
|
|
279
309
|
}
|
|
280
310
|
|
|
281
311
|
private _update(changes: Partial<SceneNode>): void {
|
|
@@ -287,6 +317,7 @@ export class FigmaNodeProxy {
|
|
|
287
317
|
}
|
|
288
318
|
|
|
289
319
|
private _raw(): SceneNode {
|
|
320
|
+
flushPendingComponentSync(this[INTERNAL_GRAPH], this[INTERNAL_ID])
|
|
290
321
|
const n = this[INTERNAL_GRAPH].getNode(this[INTERNAL_ID])
|
|
291
322
|
if (!n) throw new Error(`Node ${this[INTERNAL_ID]} has been removed`)
|
|
292
323
|
return n
|
|
@@ -403,6 +434,7 @@ export class FigmaNodeProxy {
|
|
|
403
434
|
}
|
|
404
435
|
|
|
405
436
|
get children(): FigmaNodeProxy[] {
|
|
437
|
+
flushPendingComponentSync(this[INTERNAL_GRAPH], this[INTERNAL_ID])
|
|
406
438
|
return pluginChildren(this[INTERNAL_GRAPH], this[INTERNAL_ID]).map((c) =>
|
|
407
439
|
this[INTERNAL_API].wrapNode(c.id)
|
|
408
440
|
)
|
|
@@ -561,6 +593,7 @@ installTextNodeProxyAccessors(FigmaNodeProxy.prototype, proxyInternals, MIXED)
|
|
|
561
593
|
installTextRangeMethods(FigmaNodeProxy.prototype, proxyInternals, MIXED)
|
|
562
594
|
installLayoutNodeProxyAccessors(FigmaNodeProxy.prototype, proxyInternals)
|
|
563
595
|
installVariableModeNodeProxyAccessors(FigmaNodeProxy.prototype, proxyInternals)
|
|
596
|
+
installReactionAccessors(FigmaNodeProxy.prototype, proxyInternals)
|
|
564
597
|
installPluginDataMethods(FigmaNodeProxy.prototype, proxyInternals)
|
|
565
598
|
installComponentPropertyAccessors(FigmaNodeProxy.prototype, proxyInternals)
|
|
566
599
|
installInstanceOverrideAccessors(FigmaNodeProxy.prototype, proxyInternals)
|