@pairdraw/core 0.18.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/effects.d.ts +5 -11
- package/dist/canvas/effects.d.ts.map +1 -1
- package/dist/canvas/effects.js +25 -30
- package/dist/canvas/effects.js.map +1 -1
- package/dist/canvas/labels/hit-test.d.ts +5 -0
- package/dist/canvas/labels/hit-test.d.ts.map +1 -1
- package/dist/canvas/labels/hit-test.js +1 -1
- package/dist/canvas/labels/hit-test.js.map +1 -1
- package/dist/canvas/labels/paragraph-cache.d.ts.map +1 -1
- package/dist/canvas/labels/paragraph-cache.js +3 -2
- package/dist/canvas/labels/paragraph-cache.js.map +1 -1
- package/dist/canvas/labels/selection.js +3 -2
- package/dist/canvas/labels/selection.js.map +1 -1
- package/dist/canvas/labels/style.d.ts +1 -1
- package/dist/canvas/node-edit-overlay.js +2 -2
- package/dist/canvas/node-edit-overlay.js.map +1 -1
- package/dist/canvas/overlays/index.d.ts +2 -2
- package/dist/canvas/overlays/index.js +2 -2
- package/dist/canvas/overlays/selection.d.ts +1 -2
- package/dist/canvas/overlays/selection.d.ts.map +1 -1
- package/dist/canvas/overlays/selection.js +4 -37
- package/dist/canvas/overlays/selection.js.map +1 -1
- package/dist/canvas/region-hatch.js +3 -2
- package/dist/canvas/region-hatch.js.map +1 -1
- package/dist/canvas/renderer/colors.d.ts.map +1 -1
- package/dist/canvas/renderer/colors.js +36 -18
- package/dist/canvas/renderer/colors.js.map +1 -1
- package/dist/canvas/renderer/font-waiters.d.ts +9 -0
- package/dist/canvas/renderer/font-waiters.d.ts.map +1 -0
- package/dist/canvas/renderer/font-waiters.js +26 -0
- package/dist/canvas/renderer/font-waiters.js.map +1 -0
- package/dist/canvas/renderer/fonts.d.ts +4 -2
- package/dist/canvas/renderer/fonts.d.ts.map +1 -1
- package/dist/canvas/renderer/fonts.js +23 -9
- package/dist/canvas/renderer/fonts.js.map +1 -1
- package/dist/canvas/renderer/lifecycle.d.ts.map +1 -1
- package/dist/canvas/renderer/lifecycle.js +6 -9
- package/dist/canvas/renderer/lifecycle.js.map +1 -1
- package/dist/canvas/renderer/methods.d.ts +4 -5
- package/dist/canvas/renderer/methods.d.ts.map +1 -1
- package/dist/canvas/renderer/methods.js +1 -4
- package/dist/canvas/renderer/methods.js.map +1 -1
- package/dist/canvas/renderer/paints.d.ts.map +1 -1
- package/dist/canvas/renderer/paints.js +0 -6
- package/dist/canvas/renderer/paints.js.map +1 -1
- package/dist/canvas/renderer/pipeline.d.ts.map +1 -1
- package/dist/canvas/renderer/pipeline.js +20 -2
- package/dist/canvas/renderer/pipeline.js.map +1 -1
- package/dist/canvas/renderer/retained-backing.js +4 -4
- package/dist/canvas/renderer/retained-backing.js.map +1 -1
- package/dist/canvas/renderer/state.js +1 -1
- package/dist/canvas/renderer/state.js.map +1 -1
- package/dist/canvas/renderer/tiles/controller.d.ts +2 -0
- package/dist/canvas/renderer/tiles/controller.d.ts.map +1 -1
- package/dist/canvas/renderer/tiles/controller.js +8 -0
- package/dist/canvas/renderer/tiles/controller.js.map +1 -1
- package/dist/canvas/renderer/tiles/surface-pool.js +1 -1
- package/dist/canvas/renderer/tiles/surface-pool.js.map +1 -1
- package/dist/canvas/renderer/visual-bounds.d.ts.map +1 -1
- package/dist/canvas/renderer/visual-bounds.js +7 -5
- package/dist/canvas/renderer/visual-bounds.js.map +1 -1
- package/dist/canvas/renderer.d.ts +22 -7
- package/dist/canvas/renderer.d.ts.map +1 -1
- package/dist/canvas/renderer.js +46 -11
- package/dist/canvas/renderer.js.map +1 -1
- package/dist/canvas/rulers.d.ts +8 -1
- package/dist/canvas/rulers.d.ts.map +1 -1
- package/dist/canvas/rulers.js +30 -5
- package/dist/canvas/rulers.js.map +1 -1
- package/dist/canvas/scene.d.ts +2 -1
- package/dist/canvas/scene.d.ts.map +1 -1
- package/dist/canvas/scene.js +30 -18
- package/dist/canvas/scene.js.map +1 -1
- package/dist/canvas/shadows/shape.js +1 -1
- package/dist/canvas/shadows/shape.js.map +1 -1
- package/dist/canvas/shadows/silhouette.d.ts.map +1 -1
- package/dist/canvas/shadows/silhouette.js +4 -2
- package/dist/canvas/shadows/silhouette.js.map +1 -1
- package/dist/canvas/shadows.d.ts.map +1 -1
- package/dist/canvas/shadows.js +3 -2
- package/dist/canvas/shadows.js.map +1 -1
- package/dist/canvas/text/derived.d.ts +1 -2
- package/dist/canvas/text/derived.d.ts.map +1 -1
- package/dist/canvas/text/derived.js +1 -7
- package/dist/canvas/text/derived.js.map +1 -1
- package/dist/canvas/text/emoji/index.js +1 -1
- package/dist/canvas/text/emoji/raster.d.ts.map +1 -1
- package/dist/canvas/text/emoji/raster.js +14 -10
- package/dist/canvas/text/emoji/raster.js.map +1 -1
- package/dist/canvas/text/font-families.d.ts.map +1 -1
- package/dist/canvas/text/font-families.js +5 -2
- package/dist/canvas/text/font-families.js.map +1 -1
- package/dist/canvas/text/index.d.ts +1 -3
- package/dist/canvas/text/index.d.ts.map +1 -1
- package/dist/canvas/text/index.js +1 -8
- package/dist/canvas/text/index.js.map +1 -1
- package/dist/canvas/text/layout/build.d.ts.map +1 -1
- package/dist/canvas/text/layout/build.js +25 -9
- package/dist/canvas/text/layout/build.js.map +1 -1
- package/dist/canvas/text/layout/index.d.ts.map +1 -1
- package/dist/canvas/text/layout/index.js +8 -4
- package/dist/canvas/text/layout/index.js.map +1 -1
- package/dist/canvas/text/layout/lines.js +5 -3
- package/dist/canvas/text/layout/lines.js.map +1 -1
- package/dist/canvas/text/paragraph/index.d.ts +5 -0
- package/dist/canvas/text/paragraph/index.d.ts.map +1 -1
- package/dist/canvas/text/paragraph/index.js +16 -7
- package/dist/canvas/text/paragraph/index.js.map +1 -1
- package/dist/canvas/text/paragraph/inputs.d.ts +1 -1
- package/dist/canvas/text/paragraph/inputs.d.ts.map +1 -1
- package/dist/canvas/text/paragraph/inputs.js +9 -2
- package/dist/canvas/text/paragraph/inputs.js.map +1 -1
- package/dist/canvas/text/placed.js +1 -1
- package/dist/canvas/text/shape.d.ts +4 -3
- package/dist/canvas/text/shape.d.ts.map +1 -1
- package/dist/canvas/text/shape.js +9 -22
- package/dist/canvas/text/shape.js.map +1 -1
- package/dist/constants.d.ts +6 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +6 -2
- package/dist/constants.js.map +1 -1
- package/dist/editor/bridges/clipboard.d.ts +1 -0
- package/dist/editor/bridges/clipboard.js +1 -0
- package/dist/editor/bridges/clipboard.js.map +1 -1
- package/dist/editor/bridges/components.d.ts +2 -0
- package/dist/editor/bridges/components.d.ts.map +1 -1
- package/dist/editor/bridges/components.js +2 -0
- package/dist/editor/bridges/components.js.map +1 -1
- package/dist/editor/bridges/frames.d.ts +4 -3
- package/dist/editor/bridges/frames.d.ts.map +1 -1
- package/dist/editor/bridges/frames.js +6 -4
- package/dist/editor/bridges/frames.js.map +1 -1
- package/dist/editor/bridges/structure.d.ts +1 -0
- package/dist/editor/bridges/structure.d.ts.map +1 -1
- package/dist/editor/bridges/structure.js +1 -0
- package/dist/editor/bridges/structure.js.map +1 -1
- package/dist/editor/clipboard/detach.js +2 -2
- package/dist/editor/clipboard/detach.js.map +1 -1
- package/dist/editor/clipboard/paste/properties.js +1 -1
- package/dist/editor/clipboard/paste/target.js +2 -2
- package/dist/editor/clipboard/paste/target.js.map +1 -1
- package/dist/editor/clipboard/snapshot.d.ts +3 -0
- package/dist/editor/clipboard/snapshot.d.ts.map +1 -1
- package/dist/editor/clipboard/snapshot.js +2 -0
- package/dist/editor/clipboard/snapshot.js.map +1 -1
- package/dist/editor/clipboard/variables.d.ts.map +1 -1
- package/dist/editor/clipboard/variables.js +14 -1
- package/dist/editor/clipboard/variables.js.map +1 -1
- package/dist/editor/clipboard.d.ts +1 -0
- package/dist/editor/clipboard.d.ts.map +1 -1
- package/dist/editor/clipboard.js +122 -16
- package/dist/editor/clipboard.js.map +1 -1
- package/dist/editor/component-sync.d.ts +10 -1
- package/dist/editor/component-sync.d.ts.map +1 -1
- package/dist/editor/component-sync.js +25 -8
- package/dist/editor/component-sync.js.map +1 -1
- package/dist/editor/components/authoring/text-edit.d.ts.map +1 -1
- package/dist/editor/components/authoring/text-edit.js +11 -2
- package/dist/editor/components/authoring/text-edit.js.map +1 -1
- package/dist/editor/components/authoring/visibility-edit.d.ts.map +1 -1
- package/dist/editor/components/authoring/visibility-edit.js +7 -3
- package/dist/editor/components/authoring/visibility-edit.js.map +1 -1
- package/dist/editor/components/instances.d.ts +2 -0
- package/dist/editor/components/instances.d.ts.map +1 -1
- package/dist/editor/components/instances.js +37 -7
- package/dist/editor/components/instances.js.map +1 -1
- package/dist/editor/components/properties.d.ts.map +1 -1
- package/dist/editor/components/properties.js +3 -0
- package/dist/editor/components/properties.js.map +1 -1
- package/dist/editor/components/slots/authoring.js +2 -1
- package/dist/editor/components/slots/authoring.js.map +1 -1
- package/dist/editor/components.d.ts +2 -0
- package/dist/editor/components.d.ts.map +1 -1
- package/dist/editor/create.d.ts +17 -3
- package/dist/editor/create.d.ts.map +1 -1
- package/dist/editor/create.js +43 -6
- package/dist/editor/create.js.map +1 -1
- package/dist/editor/guides.d.ts.map +1 -1
- package/dist/editor/guides.js +20 -13
- package/dist/editor/guides.js.map +1 -1
- package/dist/editor/history/document-change.d.ts +19 -3
- package/dist/editor/history/document-change.d.ts.map +1 -1
- package/dist/editor/history/document-change.js +94 -8
- package/dist/editor/history/document-change.js.map +1 -1
- package/dist/editor/history/edit.d.ts.map +1 -1
- package/dist/editor/history/edit.js +56 -12
- package/dist/editor/history/edit.js.map +1 -1
- package/dist/editor/history/position.js +1 -4
- package/dist/editor/history/position.js.map +1 -1
- package/dist/editor/history/sources.d.ts +14 -0
- package/dist/editor/history/sources.d.ts.map +1 -0
- package/dist/editor/history/sources.js +24 -0
- package/dist/editor/history/sources.js.map +1 -0
- package/dist/editor/index.d.ts +2 -2
- package/dist/editor/index.js +1 -1
- package/dist/editor/layout-mode.d.ts.map +1 -1
- package/dist/editor/layout-mode.js +16 -1
- package/dist/editor/layout-mode.js.map +1 -1
- package/dist/editor/node-preview.d.ts.map +1 -1
- package/dist/editor/node-preview.js +26 -7
- package/dist/editor/node-preview.js.map +1 -1
- package/dist/editor/nodes.d.ts.map +1 -1
- package/dist/editor/nodes.js +33 -10
- package/dist/editor/nodes.js.map +1 -1
- package/dist/editor/nudge.d.ts.map +1 -1
- package/dist/editor/nudge.js +12 -2
- package/dist/editor/nudge.js.map +1 -1
- package/dist/editor/pages.d.ts +2 -1
- package/dist/editor/pages.d.ts.map +1 -1
- package/dist/editor/pages.js +94 -15
- package/dist/editor/pages.js.map +1 -1
- package/dist/editor/play/states.d.ts.map +1 -1
- package/dist/editor/play/states.js +0 -5
- package/dist/editor/play/states.js.map +1 -1
- package/dist/editor/read-only/actions.js +3 -0
- package/dist/editor/read-only/actions.js.map +1 -1
- package/dist/editor/selection/hit-test.d.ts +2 -1
- package/dist/editor/selection/hit-test.d.ts.map +1 -1
- package/dist/editor/selection/hit-test.js +29 -4
- package/dist/editor/selection/hit-test.js.map +1 -1
- package/dist/editor/selection.d.ts +2 -2
- package/dist/editor/selection.d.ts.map +1 -1
- package/dist/editor/shapes/pen.js +6 -2
- package/dist/editor/shapes/pen.js.map +1 -1
- package/dist/editor/shapes.d.ts.map +1 -1
- package/dist/editor/shapes.js +2 -1
- package/dist/editor/shapes.js.map +1 -1
- package/dist/editor/structure/auto-layout-wrap.d.ts.map +1 -1
- package/dist/editor/structure/auto-layout-wrap.js +12 -0
- package/dist/editor/structure/auto-layout-wrap.js.map +1 -1
- package/dist/editor/structure/boolean.js +1 -1
- package/dist/editor/structure/group/bounds.d.ts +4 -2
- package/dist/editor/structure/group/bounds.d.ts.map +1 -1
- package/dist/editor/structure/group/bounds.js +17 -4
- package/dist/editor/structure/group/bounds.js.map +1 -1
- package/dist/editor/structure/rename.d.ts +2 -3
- package/dist/editor/structure/rename.d.ts.map +1 -1
- package/dist/editor/structure/rename.js +2 -5
- package/dist/editor/structure/rename.js.map +1 -1
- package/dist/editor/structure/reorder.d.ts.map +1 -1
- package/dist/editor/structure/reorder.js +20 -9
- package/dist/editor/structure/reorder.js.map +1 -1
- package/dist/editor/structure/state.js +1 -1
- package/dist/editor/structure.d.ts +1 -0
- package/dist/editor/structure.d.ts.map +1 -1
- package/dist/editor/structure.js +76 -20
- package/dist/editor/structure.js.map +1 -1
- package/dist/editor/text/hyperlink.d.ts.map +1 -1
- package/dist/editor/text/hyperlink.js +1 -1
- package/dist/editor/text/hyperlink.js.map +1 -1
- package/dist/editor/text/name.d.ts +13 -5
- package/dist/editor/text/name.d.ts.map +1 -1
- package/dist/editor/text/name.js +47 -17
- package/dist/editor/text/name.js.map +1 -1
- package/dist/editor/text/pending-layout.d.ts +2 -1
- package/dist/editor/text/pending-layout.d.ts.map +1 -1
- package/dist/editor/text/pending-layout.js +33 -6
- package/dist/editor/text/pending-layout.js.map +1 -1
- package/dist/editor/text/selection-style.d.ts +1 -0
- package/dist/editor/text/selection-style.d.ts.map +1 -1
- package/dist/editor/text/selection-style.js +16 -4
- package/dist/editor/text/selection-style.js.map +1 -1
- package/dist/editor/text.d.ts +5 -0
- package/dist/editor/text.d.ts.map +1 -1
- package/dist/editor/text.js +70 -3
- package/dist/editor/text.js.map +1 -1
- package/dist/editor/types.d.ts +18 -1
- package/dist/editor/types.d.ts.map +1 -1
- package/dist/editor/undo.d.ts.map +1 -1
- package/dist/editor/undo.js +14 -2
- package/dist/editor/undo.js.map +1 -1
- package/dist/editor/variable-bindings.d.ts.map +1 -1
- package/dist/editor/variable-bindings.js +21 -2
- package/dist/editor/variable-bindings.js.map +1 -1
- package/dist/editor/variables.d.ts +1 -1
- package/dist/editor/variables.d.ts.map +1 -1
- package/dist/editor/variables.js +7 -8
- package/dist/editor/variables.js.map +1 -1
- package/dist/editor/viewport.d.ts +11 -2
- package/dist/editor/viewport.d.ts.map +1 -1
- package/dist/editor/viewport.js +61 -21
- package/dist/editor/viewport.js.map +1 -1
- package/dist/editor/views/actions.d.ts.map +1 -1
- package/dist/editor/views/actions.js +13 -5
- package/dist/editor/views/actions.js.map +1 -1
- package/dist/editor/views/present.d.ts +6 -4
- package/dist/editor/views/present.d.ts.map +1 -1
- package/dist/editor/views/present.js +12 -10
- package/dist/editor/views/present.js.map +1 -1
- package/dist/editor/views/types.d.ts +11 -5
- package/dist/editor/views/types.d.ts.map +1 -1
- package/dist/figma-api/accessor-utils.d.ts.map +1 -1
- package/dist/figma-api/accessor-utils.js +4 -1
- package/dist/figma-api/accessor-utils.js.map +1 -1
- package/dist/figma-api/accessors/basic.d.ts.map +1 -1
- package/dist/figma-api/accessors/basic.js +41 -21
- package/dist/figma-api/accessors/basic.js.map +1 -1
- package/dist/figma-api/accessors/layout.d.ts.map +1 -1
- package/dist/figma-api/accessors/layout.js +37 -7
- package/dist/figma-api/accessors/layout.js.map +1 -1
- package/dist/figma-api/accessors/reactions.d.ts +11 -0
- package/dist/figma-api/accessors/reactions.d.ts.map +1 -0
- package/dist/figma-api/accessors/reactions.js +30 -0
- package/dist/figma-api/accessors/reactions.js.map +1 -0
- package/dist/figma-api/accessors/strokes.d.ts.map +1 -1
- package/dist/figma-api/accessors/strokes.js +12 -4
- package/dist/figma-api/accessors/strokes.js.map +1 -1
- package/dist/figma-api/accessors/text/index.d.ts.map +1 -1
- package/dist/figma-api/accessors/text/index.js +3 -1
- package/dist/figma-api/accessors/text/index.js.map +1 -1
- package/dist/figma-api/accessors/vector.d.ts.map +1 -1
- package/dist/figma-api/accessors/vector.js +1 -1
- package/dist/figma-api/accessors/vector.js.map +1 -1
- package/dist/figma-api/accessors/visual.d.ts +6 -5
- package/dist/figma-api/accessors/visual.d.ts.map +1 -1
- package/dist/figma-api/accessors/visual.js +20 -17
- package/dist/figma-api/accessors/visual.js.map +1 -1
- package/dist/figma-api/components.d.ts.map +1 -1
- package/dist/figma-api/components.js +2 -1
- package/dist/figma-api/components.js.map +1 -1
- package/dist/figma-api/finite.d.ts +27 -0
- package/dist/figma-api/finite.d.ts.map +1 -0
- package/dist/figma-api/finite.js +69 -0
- package/dist/figma-api/finite.js.map +1 -0
- package/dist/figma-api/fonts/list.d.ts +13 -0
- package/dist/figma-api/fonts/list.d.ts.map +1 -0
- package/dist/figma-api/fonts/list.js +25 -0
- package/dist/figma-api/fonts/list.js.map +1 -0
- package/dist/figma-api/index.d.ts +21 -3
- package/dist/figma-api/index.d.ts.map +1 -1
- package/dist/figma-api/index.js +58 -13
- package/dist/figma-api/index.js.map +1 -1
- package/dist/figma-api/overrides.d.ts +6 -1
- package/dist/figma-api/overrides.d.ts.map +1 -1
- package/dist/figma-api/overrides.js +2 -2
- package/dist/figma-api/overrides.js.map +1 -1
- package/dist/figma-api/pending-layout.d.ts +12 -2
- package/dist/figma-api/pending-layout.d.ts.map +1 -1
- package/dist/figma-api/pending-layout.js +41 -1
- package/dist/figma-api/pending-layout.js.map +1 -1
- package/dist/figma-api/pending-sync.d.ts +19 -0
- package/dist/figma-api/pending-sync.d.ts.map +1 -0
- package/dist/figma-api/pending-sync.js +52 -0
- package/dist/figma-api/pending-sync.js.map +1 -0
- package/dist/figma-api/proxy.d.ts +15 -2
- package/dist/figma-api/proxy.d.ts.map +1 -1
- package/dist/figma-api/proxy.js +23 -3
- package/dist/figma-api/proxy.js.map +1 -1
- package/dist/figma-api/reactions.d.ts +104 -0
- package/dist/figma-api/reactions.d.ts.map +1 -0
- package/dist/figma-api/reactions.js +157 -0
- package/dist/figma-api/reactions.js.map +1 -0
- package/dist/figma-api/render-bounds.d.ts.map +1 -1
- package/dist/figma-api/render-bounds.js +4 -4
- package/dist/figma-api/render-bounds.js.map +1 -1
- package/dist/figma-api/serialization.js +2 -2
- package/dist/figma-api/serialization.js.map +1 -1
- package/dist/figma-api/slots.d.ts +7 -1
- package/dist/figma-api/slots.d.ts.map +1 -1
- package/dist/figma-api/slots.js +12 -4
- package/dist/figma-api/slots.js.map +1 -1
- package/dist/figma-api/strokes.d.ts +5 -2
- package/dist/figma-api/strokes.d.ts.map +1 -1
- package/dist/figma-api/strokes.js +12 -19
- package/dist/figma-api/strokes.js.map +1 -1
- package/dist/figma-api/text/bindings.js +1 -1
- package/dist/figma-api/text/index.d.ts +2 -3
- package/dist/figma-api/text/index.d.ts.map +1 -1
- package/dist/figma-api/text/index.js +2 -12
- package/dist/figma-api/text/index.js.map +1 -1
- package/dist/figma-api/variables/bindings.js +1 -1
- package/dist/figma-api/variables/variable.d.ts.map +1 -1
- package/dist/figma-api/variables/variable.js +2 -2
- package/dist/figma-api/variables/variable.js.map +1 -1
- package/dist/geometry/figma.d.ts +6 -1
- package/dist/geometry/figma.d.ts.map +1 -1
- package/dist/geometry/figma.js +8 -1
- package/dist/geometry/figma.js.map +1 -1
- package/dist/geometry/index.d.ts +2 -2
- package/dist/geometry/index.js +2 -2
- package/dist/icons/api.d.ts +3 -2
- package/dist/icons/api.d.ts.map +1 -1
- package/dist/icons/api.js +12 -12
- package/dist/icons/api.js.map +1 -1
- package/dist/icons/provider.d.ts +4 -3
- package/dist/icons/provider.d.ts.map +1 -1
- package/dist/icons/provider.js +6 -13
- package/dist/icons/provider.js.map +1 -1
- package/dist/icons/schema.d.ts +33 -1
- package/dist/icons/schema.d.ts.map +1 -1
- package/dist/icons/schema.js +30 -1
- package/dist/icons/schema.js.map +1 -1
- package/dist/icons/svg/presentation.d.ts +8 -1
- package/dist/icons/svg/presentation.d.ts.map +1 -1
- package/dist/icons/svg/presentation.js +21 -3
- package/dist/icons/svg/presentation.js.map +1 -1
- package/dist/icons/svg/text.js +1 -1
- package/dist/icons/svg/text.js.map +1 -1
- package/dist/icons/svg.d.ts +8 -3
- package/dist/icons/svg.d.ts.map +1 -1
- package/dist/icons/svg.js +15 -13
- package/dist/icons/svg.js.map +1 -1
- package/dist/icons/types.d.ts +1 -19
- package/dist/icons/types.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/io/formats/design-tokens/apply.d.ts +1 -1
- package/dist/io/formats/design-tokens/css/read.js +1 -1
- package/dist/io/formats/design-tokens/decode.js +1 -1
- package/dist/io/formats/design-tokens/plan/index.js +4 -2
- package/dist/io/formats/design-tokens/plan/index.js.map +1 -1
- package/dist/io/formats/design-tokens/plan/styles.d.ts +9 -1
- package/dist/io/formats/design-tokens/plan/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/plan/styles.js +23 -3
- package/dist/io/formats/design-tokens/plan/styles.js.map +1 -1
- package/dist/io/formats/design-tokens/styles.d.ts +9 -1
- package/dist/io/formats/design-tokens/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/styles.js +41 -4
- package/dist/io/formats/design-tokens/styles.js.map +1 -1
- package/dist/io/formats/design-tokens/types.d.ts +5 -0
- package/dist/io/formats/design-tokens/types.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/types.js +1 -0
- package/dist/io/formats/design-tokens/types.js.map +1 -1
- package/dist/io/formats/fig/export/setup.d.ts.map +1 -1
- package/dist/io/formats/fig/export/setup.js +8 -4
- package/dist/io/formats/fig/export/setup.js.map +1 -1
- package/dist/io/formats/fig/export/variables.d.ts.map +1 -1
- package/dist/io/formats/fig/export/variables.js +2 -2
- package/dist/io/formats/fig/export/variables.js.map +1 -1
- package/dist/io/formats/fig/index.d.ts +2 -2
- package/dist/io/formats/fig/index.js +2 -2
- package/dist/io/formats/fig/read.d.ts +9 -2
- package/dist/io/formats/fig/read.d.ts.map +1 -1
- package/dist/io/formats/fig/read.js +44 -20
- package/dist/io/formats/fig/read.js.map +1 -1
- package/dist/io/formats/html/index.d.ts.map +1 -1
- package/dist/io/formats/html/index.js +2 -6
- package/dist/io/formats/html/index.js.map +1 -1
- package/dist/io/formats/pdf/dom.d.ts.map +1 -1
- package/dist/io/formats/pdf/dom.js +65 -1
- package/dist/io/formats/pdf/dom.js.map +1 -1
- package/dist/io/formats/pdf/prepare.js +1 -1
- package/dist/io/formats/pen/fonts.d.ts +14 -0
- package/dist/io/formats/pen/fonts.d.ts.map +1 -0
- package/dist/io/formats/pen/fonts.js +39 -0
- package/dist/io/formats/pen/fonts.js.map +1 -0
- package/dist/io/formats/pen/index.d.ts.map +1 -1
- package/dist/io/formats/pen/index.js +25 -6
- package/dist/io/formats/pen/index.js.map +1 -1
- package/dist/io/formats/raster/headless.d.ts +2 -2
- package/dist/io/formats/raster/headless.d.ts.map +1 -1
- package/dist/io/formats/raster/headless.js +24 -13
- package/dist/io/formats/raster/headless.js.map +1 -1
- package/dist/io/formats/raster/index.d.ts +2 -2
- package/dist/io/formats/raster/index.js +2 -2
- package/dist/io/formats/raster/render.d.ts +7 -1
- package/dist/io/formats/raster/render.d.ts.map +1 -1
- package/dist/io/formats/raster/render.js +40 -6
- package/dist/io/formats/raster/render.js.map +1 -1
- package/dist/io/formats/svg/export.d.ts.map +1 -1
- package/dist/io/formats/svg/export.js +28 -24
- package/dist/io/formats/svg/export.js.map +1 -1
- package/dist/io/formats/svg/paths.d.ts +8 -2
- package/dist/io/formats/svg/paths.d.ts.map +1 -1
- package/dist/io/formats/svg/paths.js +11 -3
- package/dist/io/formats/svg/paths.js.map +1 -1
- package/dist/io/formats/svg/strokes.d.ts.map +1 -1
- package/dist/io/formats/svg/strokes.js +2 -5
- package/dist/io/formats/svg/strokes.js.map +1 -1
- package/dist/io/formats/svg/text/export.d.ts.map +1 -1
- package/dist/io/formats/svg/text/export.js +19 -1
- package/dist/io/formats/svg/text/export.js.map +1 -1
- package/dist/io/formats/svg/text/import.d.ts.map +1 -1
- package/dist/io/formats/svg/text/import.js +2 -1
- package/dist/io/formats/svg/text/import.js.map +1 -1
- package/dist/io/subgraph.d.ts.map +1 -1
- package/dist/io/subgraph.js +5 -2
- package/dist/io/subgraph.js.map +1 -1
- package/dist/kiwi/fig/population/client.d.ts.map +1 -1
- package/dist/kiwi/fig/population/client.js +63 -45
- package/dist/kiwi/fig/population/client.js.map +1 -1
- package/dist/kiwi/fig/population/delta.d.ts +34 -3
- package/dist/kiwi/fig/population/delta.d.ts.map +1 -1
- package/dist/kiwi/fig/population/delta.js +99 -16
- package/dist/kiwi/fig/population/delta.js.map +1 -1
- package/dist/kiwi/fig/population/edits.d.ts +51 -0
- package/dist/kiwi/fig/population/edits.d.ts.map +1 -0
- package/dist/kiwi/fig/population/edits.js +169 -0
- package/dist/kiwi/fig/population/edits.js.map +1 -0
- package/dist/kiwi/fig/session/archive/access.d.ts +3 -0
- package/dist/kiwi/fig/session/archive/access.d.ts.map +1 -1
- package/dist/kiwi/fig/session/archive/access.js +8 -1
- package/dist/kiwi/fig/session/archive/access.js.map +1 -1
- package/dist/kiwi/fig/session/archive/changes.d.ts +2 -1
- package/dist/kiwi/fig/session/archive/changes.d.ts.map +1 -1
- package/dist/kiwi/fig/session/archive/changes.js +12 -5
- package/dist/kiwi/fig/session/archive/changes.js.map +1 -1
- package/dist/kiwi/fig/session/document-state.d.ts +7 -1
- package/dist/kiwi/fig/session/document-state.d.ts.map +1 -1
- package/dist/kiwi/fig/session/document-state.js +16 -2
- package/dist/kiwi/fig/session/document-state.js.map +1 -1
- package/dist/kiwi/fig/session/protocol.d.ts +31 -3
- package/dist/kiwi/fig/session/protocol.d.ts.map +1 -1
- package/dist/kiwi/fig/session/worker.js +33 -8
- package/dist/kiwi/fig/session/worker.js.map +1 -1
- package/dist/layout/apply.d.ts +6 -1
- package/dist/layout/apply.d.ts.map +1 -1
- package/dist/layout/apply.js +39 -14
- package/dist/layout/apply.js.map +1 -1
- package/dist/layout/arrange/boxes.d.ts.map +1 -1
- package/dist/layout/arrange/boxes.js +31 -0
- package/dist/layout/arrange/boxes.js.map +1 -1
- package/dist/layout/flow-edges.d.ts +26 -0
- package/dist/layout/flow-edges.d.ts.map +1 -0
- package/dist/layout/flow-edges.js +105 -0
- package/dist/layout/flow-edges.js.map +1 -0
- package/dist/layout/grid.d.ts.map +1 -1
- package/dist/layout/grid.js +9 -5
- package/dist/layout/grid.js.map +1 -1
- package/dist/layout/text-auto-resize.d.ts.map +1 -1
- package/dist/layout/text-auto-resize.js +9 -4
- package/dist/layout/text-auto-resize.js.map +1 -1
- package/dist/layout/text-measurement.d.ts +15 -1
- package/dist/layout/text-measurement.d.ts.map +1 -1
- package/dist/layout/text-measurement.js +40 -4
- package/dist/layout/text-measurement.js.map +1 -1
- package/dist/layout/variables.d.ts +1 -1
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +35 -35
- package/dist/layout.js.map +1 -1
- package/dist/library/asset-keys.d.ts +3 -2
- package/dist/library/asset-keys.d.ts.map +1 -1
- package/dist/library/asset-keys.js +4 -3
- package/dist/library/asset-keys.js.map +1 -1
- package/dist/library/copied-references.d.ts +8 -3
- package/dist/library/copied-references.d.ts.map +1 -1
- package/dist/library/copied-references.js +15 -5
- package/dist/library/copied-references.js.map +1 -1
- package/dist/library/materialize.js +1 -1
- package/dist/library/materialize.js.map +1 -1
- package/dist/library/schema.js.map +1 -1
- package/dist/library/snapshot.d.ts.map +1 -1
- package/dist/library/snapshot.js +10 -2
- package/dist/library/snapshot.js.map +1 -1
- package/dist/pairdraw-api/variables.d.ts.map +1 -1
- package/dist/pairdraw-api/variables.js +0 -2
- package/dist/pairdraw-api/variables.js.map +1 -1
- package/dist/profiler/hud-controller.d.ts +4 -3
- package/dist/profiler/hud-controller.d.ts.map +1 -1
- package/dist/profiler/hud-controller.js +7 -5
- package/dist/profiler/hud-controller.js.map +1 -1
- package/dist/profiler/hud-renderer.d.ts +5 -2
- package/dist/profiler/hud-renderer.d.ts.map +1 -1
- package/dist/profiler/hud-renderer.js +8 -5
- package/dist/profiler/hud-renderer.js.map +1 -1
- package/dist/profiler/render-profiler.d.ts +3 -2
- package/dist/profiler/render-profiler.d.ts.map +1 -1
- package/dist/profiler/render-profiler.js +3 -2
- package/dist/profiler/render-profiler.js.map +1 -1
- package/dist/text/character-style.d.ts +11 -1
- package/dist/text/character-style.d.ts.map +1 -1
- package/dist/text/character-style.js +27 -5
- package/dist/text/character-style.js.map +1 -1
- package/dist/text/coverage.d.ts.map +1 -1
- package/dist/text/coverage.js +15 -16
- package/dist/text/coverage.js.map +1 -1
- package/dist/text/editor.d.ts.map +1 -1
- package/dist/text/editor.js +3 -8
- package/dist/text/editor.js.map +1 -1
- package/dist/text/fallbacks.d.ts +19 -2
- package/dist/text/fallbacks.d.ts.map +1 -1
- package/dist/text/fallbacks.js +63 -12
- package/dist/text/fallbacks.js.map +1 -1
- package/dist/text/font/catalog.d.ts +4 -0
- package/dist/text/font/catalog.d.ts.map +1 -1
- package/dist/text/font/catalog.js +8 -0
- package/dist/text/font/catalog.js.map +1 -1
- package/dist/text/font/collection.d.ts +13 -0
- package/dist/text/font/collection.d.ts.map +1 -0
- package/dist/text/font/collection.js +51 -0
- package/dist/text/font/collection.js.map +1 -0
- package/dist/text/font/faces.d.ts +2 -1
- package/dist/text/font/faces.d.ts.map +1 -1
- package/dist/text/font/faces.js +9 -5
- package/dist/text/font/faces.js.map +1 -1
- package/dist/text/font/glyphs.d.ts +14 -3
- package/dist/text/font/glyphs.d.ts.map +1 -1
- package/dist/text/font/glyphs.js +22 -5
- package/dist/text/font/glyphs.js.map +1 -1
- package/dist/text/font/local.js +2 -2
- package/dist/text/font/local.js.map +1 -1
- package/dist/text/font/manager.d.ts +36 -0
- package/dist/text/font/manager.d.ts.map +1 -1
- package/dist/text/font/manager.js +139 -19
- package/dist/text/font/manager.js.map +1 -1
- package/dist/text/font/style.d.ts +7 -2
- package/dist/text/font/style.d.ts.map +1 -1
- package/dist/text/font/style.js +31 -3
- package/dist/text/font/style.js.map +1 -1
- package/dist/text/index.d.ts +5 -4
- package/dist/text/index.js +5 -4
- package/dist/text/outlines.d.ts.map +1 -1
- package/dist/text/outlines.js +70 -70
- package/dist/text/outlines.js.map +1 -1
- package/dist/text/prepare.d.ts.map +1 -1
- package/dist/text/prepare.js +7 -1
- package/dist/text/prepare.js.map +1 -1
- package/dist/text/style-runs.d.ts +14 -2
- package/dist/text/style-runs.d.ts.map +1 -1
- package/dist/text/style-runs.js +22 -14
- package/dist/text/style-runs.js.map +1 -1
- package/dist/tools/analyze/overlaps/helpers.d.ts.map +1 -1
- package/dist/tools/analyze/overlaps/helpers.js +9 -1
- package/dist/tools/analyze/overlaps/helpers.js.map +1 -1
- package/dist/tools/analyze/overlaps/index.d.ts.map +1 -1
- package/dist/tools/analyze/overlaps/index.js +27 -5
- package/dist/tools/analyze/overlaps/index.js.map +1 -1
- package/dist/tools/codegen/component-map.js +3 -3
- package/dist/tools/codegen/component-map.js.map +1 -1
- package/dist/tools/create/basic.d.ts.map +1 -1
- package/dist/tools/create/basic.js +5 -4
- package/dist/tools/create/basic.js.map +1 -1
- package/dist/tools/create/html.d.ts.map +1 -1
- package/dist/tools/create/html.js +4 -2
- package/dist/tools/create/html.js.map +1 -1
- package/dist/tools/create/icons.d.ts.map +1 -1
- package/dist/tools/create/icons.js +3 -1
- package/dist/tools/create/icons.js.map +1 -1
- package/dist/tools/create/mermaid.d.ts.map +1 -1
- package/dist/tools/create/mermaid.js +2 -0
- package/dist/tools/create/mermaid.js.map +1 -1
- package/dist/tools/create/render.d.ts.map +1 -1
- package/dist/tools/create/render.js +2 -0
- package/dist/tools/create/render.js.map +1 -1
- package/dist/tools/create/script.js +3 -1
- package/dist/tools/create/script.js.map +1 -1
- package/dist/tools/create/svg.d.ts.map +1 -1
- package/dist/tools/create/svg.js +4 -1
- package/dist/tools/create/svg.js.map +1 -1
- package/dist/tools/create/vector.d.ts.map +1 -1
- package/dist/tools/create/vector.js +4 -4
- package/dist/tools/create/vector.js.map +1 -1
- package/dist/tools/image-ai/apply.js +1 -1
- package/dist/tools/image-ai/generate.d.ts.map +1 -1
- package/dist/tools/image-ai/generate.js +3 -0
- package/dist/tools/image-ai/generate.js.map +1 -1
- package/dist/tools/modify/matching.js +1 -1
- package/dist/tools/modify/reactions.d.ts +6 -0
- package/dist/tools/modify/reactions.d.ts.map +1 -0
- package/dist/tools/modify/reactions.js +35 -0
- package/dist/tools/modify/reactions.js.map +1 -0
- package/dist/tools/modify.d.ts +2 -1
- package/dist/tools/modify.js +2 -1
- package/dist/tools/read/components.js +20 -22
- package/dist/tools/read/components.js.map +1 -1
- package/dist/tools/read/fonts.js +1 -1
- package/dist/tools/read/fonts.js.map +1 -1
- package/dist/tools/read/libraries.d.ts.map +1 -1
- package/dist/tools/read/libraries.js +2 -0
- package/dist/tools/read/libraries.js.map +1 -1
- package/dist/tools/read/nodes.d.ts.map +1 -1
- package/dist/tools/read/nodes.js +38 -16
- package/dist/tools/read/nodes.js.map +1 -1
- package/dist/tools/read/pages.d.ts.map +1 -1
- package/dist/tools/read/pages.js +4 -3
- package/dist/tools/read/pages.js.map +1 -1
- package/dist/tools/read/query.js +1 -0
- package/dist/tools/read/query.js.map +1 -1
- package/dist/tools/read/reactions.d.ts +6 -0
- package/dist/tools/read/reactions.d.ts.map +1 -0
- package/dist/tools/read/reactions.js +24 -0
- package/dist/tools/read/reactions.js.map +1 -0
- package/dist/tools/read/space.js +1 -1
- package/dist/tools/read.d.ts +2 -1
- package/dist/tools/read.js +2 -1
- package/dist/tools/registry/extended.d.ts.map +1 -1
- package/dist/tools/registry/extended.js +4 -0
- package/dist/tools/registry/extended.js.map +1 -1
- package/dist/tools/schema.d.ts +6 -0
- package/dist/tools/schema.d.ts.map +1 -1
- package/dist/tools/schema.js +53 -9
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/stock-photo/apply.js +8 -9
- package/dist/tools/stock-photo/apply.js.map +1 -1
- package/dist/tools/structure/batch.d.ts.map +1 -1
- package/dist/tools/structure/batch.js +85 -90
- package/dist/tools/structure/batch.js.map +1 -1
- package/dist/vector/fill-geometry.d.ts +4 -1
- package/dist/vector/fill-geometry.d.ts.map +1 -1
- package/dist/vector/fill-geometry.js +8 -5
- package/dist/vector/fill-geometry.js.map +1 -1
- package/dist/vector/index.js +1 -1
- package/dist/vector/index.js.map +1 -1
- package/dist/vector/path-helpers.d.ts +1 -1
- package/dist/vector/path-helpers.d.ts.map +1 -1
- package/dist/vector/path-helpers.js +24 -7
- package/dist/vector/path-helpers.js.map +1 -1
- package/dist/vector/placement.js +1 -1
- package/dist/vector/placement.js.map +1 -1
- package/dist/vector/vectorize/preprocess.js +1 -1
- package/dist/vector/vectorize/preprocess.js.map +1 -1
- package/package.json +10 -10
- package/src/canvas/effects.ts +29 -33
- package/src/canvas/labels/hit-test.ts +6 -2
- package/src/canvas/labels/paragraph-cache.ts +2 -1
- package/src/canvas/labels/selection.ts +3 -3
- package/src/canvas/node-edit-overlay.ts +3 -2
- package/src/canvas/overlays/index.ts +0 -1
- package/src/canvas/overlays/selection.ts +4 -52
- package/src/canvas/region-hatch.ts +7 -2
- package/src/canvas/renderer/colors.ts +41 -26
- package/src/canvas/renderer/font-waiters.ts +25 -0
- package/src/canvas/renderer/fonts.ts +40 -17
- package/src/canvas/renderer/lifecycle.ts +8 -10
- package/src/canvas/renderer/methods.ts +9 -13
- package/src/canvas/renderer/paints.ts +0 -10
- package/src/canvas/renderer/pipeline.ts +29 -3
- package/src/canvas/renderer/retained-backing.ts +4 -4
- package/src/canvas/renderer/state.ts +1 -1
- package/src/canvas/renderer/tiles/controller.ts +8 -0
- package/src/canvas/renderer/tiles/surface-pool.ts +1 -1
- package/src/canvas/renderer/visual-bounds.ts +7 -6
- package/src/canvas/renderer.ts +39 -11
- package/src/canvas/rulers.ts +55 -26
- package/src/canvas/scene.ts +37 -16
- package/src/canvas/shadows/shape.ts +1 -1
- package/src/canvas/shadows/silhouette.ts +4 -2
- package/src/canvas/shadows.ts +4 -2
- package/src/canvas/text/derived.ts +0 -9
- package/src/canvas/text/emoji/raster.ts +14 -10
- package/src/canvas/text/font-families.ts +6 -0
- package/src/canvas/text/index.ts +0 -8
- package/src/canvas/text/layout/build.ts +35 -18
- package/src/canvas/text/layout/index.ts +15 -6
- package/src/canvas/text/layout/lines.ts +10 -4
- package/src/canvas/text/paragraph/index.ts +17 -8
- package/src/canvas/text/paragraph/inputs.ts +4 -2
- package/src/canvas/text/shape.ts +20 -31
- package/src/constants.ts +6 -1
- package/src/editor/bridges/clipboard.ts +1 -0
- package/src/editor/bridges/components.ts +2 -0
- package/src/editor/bridges/frames.ts +6 -4
- package/src/editor/bridges/structure.ts +1 -0
- package/src/editor/clipboard/detach.ts +3 -3
- package/src/editor/clipboard/paste/target.ts +2 -2
- package/src/editor/clipboard/snapshot.ts +7 -0
- package/src/editor/clipboard/variables.ts +20 -0
- package/src/editor/clipboard.ts +133 -14
- package/src/editor/component-sync.ts +28 -7
- package/src/editor/components/authoring/text-edit.ts +15 -2
- package/src/editor/components/authoring/visibility-edit.ts +11 -3
- package/src/editor/components/instances.ts +61 -11
- package/src/editor/components/properties.ts +10 -0
- package/src/editor/components/slots/authoring.ts +4 -1
- package/src/editor/create.ts +58 -8
- package/src/editor/guides.ts +27 -12
- package/src/editor/history/document-change.ts +115 -7
- package/src/editor/history/edit.ts +62 -14
- package/src/editor/history/position.ts +1 -4
- package/src/editor/history/sources.ts +25 -0
- package/src/editor/index.ts +3 -1
- package/src/editor/layout-mode.ts +20 -1
- package/src/editor/node-preview.ts +44 -8
- package/src/editor/nodes.ts +52 -12
- package/src/editor/nudge.ts +16 -2
- package/src/editor/pages.ts +100 -17
- package/src/editor/play/states.ts +0 -7
- package/src/editor/read-only/actions.ts +4 -0
- package/src/editor/selection/hit-test.ts +37 -4
- package/src/editor/shapes/pen.ts +6 -3
- package/src/editor/shapes.ts +2 -1
- package/src/editor/structure/auto-layout-wrap.ts +26 -0
- package/src/editor/structure/group/bounds.ts +22 -4
- package/src/editor/structure/rename.ts +2 -6
- package/src/editor/structure/reorder.ts +26 -8
- package/src/editor/structure.ts +88 -24
- package/src/editor/text/hyperlink.ts +2 -1
- package/src/editor/text/name.ts +51 -15
- package/src/editor/text/pending-layout.ts +42 -4
- package/src/editor/text/selection-style.ts +17 -3
- package/src/editor/text.ts +86 -4
- package/src/editor/types.ts +19 -0
- package/src/editor/undo.ts +21 -2
- package/src/editor/variable-bindings.ts +22 -2
- package/src/editor/variables.ts +10 -6
- package/src/editor/viewport.ts +55 -21
- package/src/editor/views/actions.ts +17 -7
- package/src/editor/views/present.ts +20 -11
- package/src/editor/views/types.ts +11 -5
- package/src/figma-api/accessor-utils.ts +4 -1
- package/src/figma-api/accessors/basic.ts +54 -18
- package/src/figma-api/accessors/layout.ts +46 -7
- package/src/figma-api/accessors/reactions.ts +29 -0
- package/src/figma-api/accessors/strokes.ts +28 -8
- package/src/figma-api/accessors/text/index.ts +4 -0
- package/src/figma-api/accessors/vector.ts +3 -1
- package/src/figma-api/accessors/visual.ts +25 -28
- package/src/figma-api/components.ts +9 -7
- package/src/figma-api/finite.ts +102 -0
- package/src/figma-api/fonts/list.ts +24 -0
- package/src/figma-api/index.ts +82 -12
- package/src/figma-api/overrides.ts +1 -1
- package/src/figma-api/pending-layout.ts +50 -1
- package/src/figma-api/pending-sync.ts +61 -0
- package/src/figma-api/proxy.ts +35 -2
- package/src/figma-api/reactions.ts +212 -0
- package/src/figma-api/render-bounds.ts +13 -4
- package/src/figma-api/serialization.ts +2 -2
- package/src/figma-api/slots.ts +12 -3
- package/src/figma-api/strokes.ts +16 -12
- package/src/figma-api/text/index.ts +9 -15
- package/src/figma-api/variables/variable.ts +3 -2
- package/src/geometry/figma.ts +9 -0
- package/src/geometry/index.ts +1 -0
- package/src/global.d.ts +6 -0
- package/src/icons/api.ts +27 -16
- package/src/icons/provider.ts +9 -20
- package/src/icons/schema.ts +31 -0
- package/src/icons/svg/presentation.ts +27 -3
- package/src/icons/svg/text.ts +1 -1
- package/src/icons/svg.ts +21 -19
- package/src/icons/types.ts +0 -14
- package/src/io/formats/design-tokens/plan/index.ts +7 -1
- package/src/io/formats/design-tokens/plan/styles.ts +40 -4
- package/src/io/formats/design-tokens/styles.ts +60 -3
- package/src/io/formats/design-tokens/types.ts +3 -0
- package/src/io/formats/fig/export/setup.ts +16 -14
- package/src/io/formats/fig/export/variables.ts +7 -8
- package/src/io/formats/fig/index.ts +1 -0
- package/src/io/formats/fig/read.ts +66 -23
- package/src/io/formats/html/index.ts +2 -6
- package/src/io/formats/pdf/dom.ts +96 -3
- package/src/io/formats/pen/fonts.ts +45 -0
- package/src/io/formats/pen/index.ts +30 -6
- package/src/io/formats/raster/headless.ts +31 -12
- package/src/io/formats/raster/index.ts +3 -0
- package/src/io/formats/raster/render.ts +62 -6
- package/src/io/formats/svg/export.ts +24 -25
- package/src/io/formats/svg/paths.ts +11 -2
- package/src/io/formats/svg/strokes.ts +8 -2
- package/src/io/formats/svg/text/export.ts +23 -0
- package/src/io/formats/svg/text/import.ts +2 -1
- package/src/io/subgraph.ts +3 -1
- package/src/kiwi/fig/population/client.ts +77 -43
- package/src/kiwi/fig/population/delta.ts +141 -18
- package/src/kiwi/fig/population/edits.ts +235 -0
- package/src/kiwi/fig/session/archive/access.ts +15 -0
- package/src/kiwi/fig/session/archive/changes.ts +27 -6
- package/src/kiwi/fig/session/document-state.ts +23 -1
- package/src/kiwi/fig/session/protocol.ts +26 -1
- package/src/kiwi/fig/session/worker.ts +38 -11
- package/src/layout/apply.ts +52 -10
- package/src/layout/arrange/boxes.ts +36 -0
- package/src/layout/flow-edges.ts +139 -0
- package/src/layout/grid.ts +14 -4
- package/src/layout/text-auto-resize.ts +13 -4
- package/src/layout/text-measurement.ts +46 -3
- package/src/layout.ts +60 -66
- package/src/library/asset-keys.ts +4 -3
- package/src/library/copied-references.ts +29 -5
- package/src/library/materialize.ts +1 -1
- package/src/library/schema.ts +1 -1
- package/src/library/snapshot.ts +11 -2
- package/src/pairdraw-api/variables.ts +1 -3
- package/src/profiler/hud-controller.ts +8 -6
- package/src/profiler/hud-renderer.ts +9 -6
- package/src/profiler/render-profiler.ts +4 -3
- package/src/text/character-style.ts +29 -9
- package/src/text/coverage.ts +17 -18
- package/src/text/editor.ts +3 -8
- package/src/text/fallbacks.ts +82 -15
- package/src/text/font/catalog.ts +10 -0
- package/src/text/font/collection.ts +60 -0
- package/src/text/font/faces.ts +9 -5
- package/src/text/font/glyphs.ts +29 -4
- package/src/text/font/local.ts +2 -2
- package/src/text/font/manager.ts +170 -32
- package/src/text/font/style.ts +52 -3
- package/src/text/index.ts +1 -0
- package/src/text/outlines.ts +105 -89
- package/src/text/prepare.ts +17 -0
- package/src/text/style-runs.ts +43 -16
- package/src/tools/analyze/overlaps/helpers.ts +18 -1
- package/src/tools/analyze/overlaps/index.ts +37 -6
- package/src/tools/codegen/component-map.ts +3 -3
- package/src/tools/create/basic.ts +6 -4
- package/src/tools/create/html.ts +3 -1
- package/src/tools/create/icons.ts +3 -1
- package/src/tools/create/mermaid.ts +2 -0
- package/src/tools/create/render.ts +2 -0
- package/src/tools/create/script.ts +5 -1
- package/src/tools/create/svg.ts +4 -1
- package/src/tools/create/vector.ts +4 -4
- package/src/tools/image-ai/generate.ts +3 -0
- package/src/tools/modify/reactions.ts +40 -0
- package/src/tools/modify.ts +1 -0
- package/src/tools/read/components.ts +28 -25
- package/src/tools/read/fonts.ts +1 -1
- package/src/tools/read/libraries.ts +3 -0
- package/src/tools/read/nodes.ts +47 -17
- package/src/tools/read/pages.ts +7 -4
- package/src/tools/read/query.ts +2 -0
- package/src/tools/read/reactions.ts +21 -0
- package/src/tools/read.ts +1 -0
- package/src/tools/registry/extended.ts +4 -0
- package/src/tools/schema.ts +68 -12
- package/src/tools/stock-photo/apply.ts +17 -5
- package/src/tools/structure/batch.ts +82 -101
- package/src/vector/fill-geometry.ts +11 -5
- package/src/vector/index.ts +1 -1
- package/src/vector/path-helpers.ts +34 -8
- package/src/vector/placement.ts +1 -1
- package/src/vector/vectorize/preprocess.ts +1 -1
|
@@ -10,12 +10,14 @@ import {
|
|
|
10
10
|
computeConstrainedResizeChanges,
|
|
11
11
|
createResizeSnapshot,
|
|
12
12
|
scaledGeometryChanges,
|
|
13
|
+
shapeGeometryChanges,
|
|
13
14
|
type ResizeSnapshot
|
|
14
15
|
} from '@pairdraw/scene-graph/resize'
|
|
15
16
|
import { rescaleNodeTree } from '@pairdraw/scene-graph/scaling'
|
|
16
17
|
import { slotPropertyId } from '@pairdraw/scene-graph/slots'
|
|
17
18
|
|
|
18
19
|
import { assertNodeEditable } from '#core/editor/capabilities'
|
|
20
|
+
import { namedByText } from '#core/editor/text/name'
|
|
19
21
|
import {
|
|
20
22
|
prepareFollowedFieldEdit,
|
|
21
23
|
fitGroupsAround,
|
|
@@ -28,7 +30,8 @@ import {
|
|
|
28
30
|
type ProxyThis
|
|
29
31
|
} from '#core/figma-api/accessor-utils'
|
|
30
32
|
import { invalid, numberProblem } from '#core/figma-api/accessors/text/messages'
|
|
31
|
-
import {
|
|
33
|
+
import { finiteNumber, finiteTransform } from '#core/figma-api/finite'
|
|
34
|
+
import { flushPendingLayout, flushPendingLayoutBefore } from '#core/figma-api/pending-layout'
|
|
32
35
|
import type { NodeProxyHost } from '#core/figma-api/proxy'
|
|
33
36
|
import { computeAbsoluteRenderBounds } from '#core/figma-api/render-bounds'
|
|
34
37
|
import {
|
|
@@ -40,6 +43,7 @@ import {
|
|
|
40
43
|
import type { FigmaTransform } from '#core/figma-api/types'
|
|
41
44
|
import { syncVariantName } from '#core/figma-api/variants'
|
|
42
45
|
import { figmaRotation } from '#core/geometry/figma'
|
|
46
|
+
import { restoredHuggedSize } from '#core/layout/apply'
|
|
43
47
|
import { computeAccurateBounds } from '#core/vector/curve-math'
|
|
44
48
|
|
|
45
49
|
const TRANSFORM_FIELDS: ReadonlySet<string> = new Set(NODE_TRANSFORM_FIELDS)
|
|
@@ -87,6 +91,8 @@ function setTransform(
|
|
|
87
91
|
assertEditable(target, internals)
|
|
88
92
|
const scene = graph(target, internals)
|
|
89
93
|
const node = raw(target, internals)
|
|
94
|
+
// Placed against its frame as the script's edits leave it, as Figma lays them out as it runs.
|
|
95
|
+
flushPendingLayoutBefore(scene, node)
|
|
90
96
|
setContainerTransform(scene, node, change(containerTransform(node, scene)))
|
|
91
97
|
fitGroupsAround(scene, node.parentId, hostFitOptions(target, internals))
|
|
92
98
|
}
|
|
@@ -112,7 +118,12 @@ export function installBasicNodeProxyAccessors(
|
|
|
112
118
|
return raw(this, internals).name
|
|
113
119
|
},
|
|
114
120
|
set(this: ProxyThis, value: string) {
|
|
115
|
-
|
|
121
|
+
// Naming a layer whose name followed its text stops it following, as in Figma.
|
|
122
|
+
const node = raw(this, internals)
|
|
123
|
+
updateNode(this, internals, {
|
|
124
|
+
name: value,
|
|
125
|
+
...(namedByText(node) ? { autoRename: false } : {})
|
|
126
|
+
})
|
|
116
127
|
// A variant's name holds its values, which the set's value lists follow.
|
|
117
128
|
syncVariantName(graph(this, internals), raw(this, internals))
|
|
118
129
|
}
|
|
@@ -128,14 +139,15 @@ export function installBasicNodeProxyAccessors(
|
|
|
128
139
|
flushPendingLayout(graph(this, internals))
|
|
129
140
|
return containerTransform(raw(this, internals), graph(this, internals))[2]
|
|
130
141
|
},
|
|
131
|
-
set(this: ProxyThis, value:
|
|
142
|
+
set(this: ProxyThis, value: unknown) {
|
|
143
|
+
const x = finiteNumber(value, 'x')
|
|
132
144
|
prepareFollowedFieldEdit(
|
|
133
145
|
graph(this, internals),
|
|
134
146
|
raw(this, internals),
|
|
135
147
|
'x',
|
|
136
148
|
'relative-transform'
|
|
137
149
|
)
|
|
138
|
-
setTransform(this, internals, (matrix) => withOrigin(matrix,
|
|
150
|
+
setTransform(this, internals, (matrix) => withOrigin(matrix, x, matrix[5]))
|
|
139
151
|
}
|
|
140
152
|
},
|
|
141
153
|
y: {
|
|
@@ -143,14 +155,15 @@ export function installBasicNodeProxyAccessors(
|
|
|
143
155
|
flushPendingLayout(graph(this, internals))
|
|
144
156
|
return containerTransform(raw(this, internals), graph(this, internals))[5]
|
|
145
157
|
},
|
|
146
|
-
set(this: ProxyThis, value:
|
|
158
|
+
set(this: ProxyThis, value: unknown) {
|
|
159
|
+
const y = finiteNumber(value, 'y')
|
|
147
160
|
prepareFollowedFieldEdit(
|
|
148
161
|
graph(this, internals),
|
|
149
162
|
raw(this, internals),
|
|
150
163
|
'y',
|
|
151
164
|
'relative-transform'
|
|
152
165
|
)
|
|
153
|
-
setTransform(this, internals, (matrix) => withOrigin(matrix, matrix[2],
|
|
166
|
+
setTransform(this, internals, (matrix) => withOrigin(matrix, matrix[2], y))
|
|
154
167
|
}
|
|
155
168
|
},
|
|
156
169
|
width: {
|
|
@@ -175,14 +188,15 @@ export function installBasicNodeProxyAccessors(
|
|
|
175
188
|
return figmaRotation(containerTransform(node, graph(this, internals)))
|
|
176
189
|
},
|
|
177
190
|
// Figma turns a node counterclockwise about its top-left corner.
|
|
178
|
-
set(this: ProxyThis, value:
|
|
191
|
+
set(this: ProxyThis, value: unknown) {
|
|
192
|
+
const rotation = finiteNumber(value, 'rotation')
|
|
179
193
|
prepareFollowedFieldEdit(
|
|
180
194
|
graph(this, internals),
|
|
181
195
|
raw(this, internals),
|
|
182
196
|
'rotation',
|
|
183
197
|
'relative-transform'
|
|
184
198
|
)
|
|
185
|
-
setTransform(this, internals, (matrix) => withFigmaRotation(matrix,
|
|
199
|
+
setTransform(this, internals, (matrix) => withFigmaRotation(matrix, rotation))
|
|
186
200
|
}
|
|
187
201
|
},
|
|
188
202
|
relativeTransform: {
|
|
@@ -205,15 +219,25 @@ export function installBasicNodeProxyAccessors(
|
|
|
205
219
|
}
|
|
206
220
|
return figmaTransform(containerTransform(node, scene))
|
|
207
221
|
},
|
|
208
|
-
set(this: ProxyThis, value:
|
|
222
|
+
set(this: ProxyThis, value: unknown) {
|
|
223
|
+
const { first, second } = finiteTransform(value)
|
|
209
224
|
prepareFollowedFieldEdit(
|
|
210
225
|
graph(this, internals),
|
|
211
226
|
raw(this, internals),
|
|
212
227
|
'relativeTransform',
|
|
213
228
|
'relative-transform'
|
|
214
229
|
)
|
|
215
|
-
|
|
216
|
-
|
|
230
|
+
setTransform(this, internals, () => [
|
|
231
|
+
first[0],
|
|
232
|
+
first[1],
|
|
233
|
+
first[2],
|
|
234
|
+
second[0],
|
|
235
|
+
second[1],
|
|
236
|
+
second[2],
|
|
237
|
+
0,
|
|
238
|
+
0,
|
|
239
|
+
1
|
|
240
|
+
])
|
|
217
241
|
}
|
|
218
242
|
},
|
|
219
243
|
absoluteTransform: {
|
|
@@ -245,13 +269,21 @@ export function installBasicNodeProxyAccessors(
|
|
|
245
269
|
resizeWithoutConstraints(this: ProxyThis, width: number, height: number): void {
|
|
246
270
|
resizeNode(this, internals, width, height, false)
|
|
247
271
|
},
|
|
248
|
-
rescale(this: ProxyThis,
|
|
272
|
+
rescale(this: ProxyThis, value: unknown): void {
|
|
273
|
+
const scale = finiteNumber(value, 'scale', 'rescale')
|
|
249
274
|
assertEditable(this, internals)
|
|
250
275
|
const scene = graph(this, internals)
|
|
251
276
|
const node = raw(this, internals)
|
|
277
|
+
flushPendingLayoutBefore(scene, node, { placesChildren: true })
|
|
252
278
|
if (node.parentId && findInstanceAncestor(scene, node.parentId))
|
|
253
279
|
throw new Error('This property cannot be overridden in an instance: size')
|
|
254
280
|
rescaleNodeTree(scene, node.id, scale)
|
|
281
|
+
// Its Hug frames' constrained layers are scaled with them, so the next hug moves them from the
|
|
282
|
+
// scaled size, not again from the size they had before.
|
|
283
|
+
for (const scaled of [node, ...descendants(scene, node)]) {
|
|
284
|
+
const current = scene.getNode(scaled.id)
|
|
285
|
+
if (current) restoredHuggedSize(current)
|
|
286
|
+
}
|
|
255
287
|
}
|
|
256
288
|
})
|
|
257
289
|
}
|
|
@@ -262,12 +294,14 @@ function descendants(scene: SceneGraph, node: SceneNode): SceneNode[] {
|
|
|
262
294
|
}
|
|
263
295
|
|
|
264
296
|
/**
|
|
265
|
-
* A
|
|
266
|
-
* a path to stroke, the saved stroke outline goes and the
|
|
267
|
-
* when the path is set; without one, the outline is all that
|
|
297
|
+
* A layer's geometry for its new size, as Figma's resize does. A vector's path scales to the new
|
|
298
|
+
* size; the stroke keeps its weight: with a path to stroke, the saved stroke outline goes and the
|
|
299
|
+
* stroke draws from the scaled path, as when the path is set; without one, the outline is all that
|
|
300
|
+
* draws the stroke, so it scales. Any other layer draws from its live box, so the saved outlines
|
|
301
|
+
* a file gave it follow the new box the same way.
|
|
268
302
|
*/
|
|
269
|
-
function
|
|
270
|
-
if (node.type !== 'VECTOR') return
|
|
303
|
+
function resizedNodeGeometry(node: SceneNode, width: number, height: number): Partial<SceneNode> {
|
|
304
|
+
if (node.type !== 'VECTOR') return shapeGeometryChanges(node, width, height)
|
|
271
305
|
// A side at zero keeps the path along it, as in Figma, so the next resize scales the path from
|
|
272
306
|
// its own extent and gets the shape back.
|
|
273
307
|
const bounds = node.vectorNetwork ? computeAccurateBounds(node.vectorNetwork) : null
|
|
@@ -360,6 +394,8 @@ function resizeNode(
|
|
|
360
394
|
assertEditable(target, internals)
|
|
361
395
|
const scene = graph(target, internals)
|
|
362
396
|
const node = raw(target, internals)
|
|
397
|
+
// As for a move; a constrained resize also places the children from the node's own size.
|
|
398
|
+
flushPendingLayoutBefore(scene, node, { placesChildren: constrained })
|
|
363
399
|
const { width, height } = resizedSize(node, requestedWidth, requestedHeight, constrained)
|
|
364
400
|
// Figma has no size for a layer inside an instance: the resize does nothing, and records nothing.
|
|
365
401
|
if (node.parentId && findInstanceAncestor(scene, node.parentId)) return
|
|
@@ -370,7 +406,7 @@ function resizeNode(
|
|
|
370
406
|
constrained || node.type === 'INSTANCE'
|
|
371
407
|
? new Map(descendants(scene, node).map((child) => [child.id, createResizeSnapshot(child)]))
|
|
372
408
|
: new Map<string, ResizeSnapshot>()
|
|
373
|
-
const geometry =
|
|
409
|
+
const geometry = resizedNodeGeometry(node, width, height)
|
|
374
410
|
// A locked ratio does not hold here; it takes the new size, as in Figma.
|
|
375
411
|
const recaptured = recapturedAspectRatio(node, width, height)
|
|
376
412
|
const changed = { width: width !== size.width, height: height !== size.height }
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
type NodeProxyInternals,
|
|
22
22
|
type ProxyThis
|
|
23
23
|
} from '#core/figma-api/accessor-utils'
|
|
24
|
+
import { finiteNumber, finiteOrNull, layoutGrowChoice } from '#core/figma-api/finite'
|
|
24
25
|
|
|
25
26
|
/** A guide in Figma's plugin shape, whether it was set that way or read from a file. */
|
|
26
27
|
function figmaLayoutGrid(grid: LayoutGrid): Readonly<LayoutGrid> {
|
|
@@ -77,8 +78,8 @@ export function installLayoutNodeProxyAccessors(
|
|
|
77
78
|
},
|
|
78
79
|
primaryAxisAlignItems: mappedAccessor(internals, 'primaryAxisAlign'),
|
|
79
80
|
counterAxisAlignItems: mappedAccessor(internals, 'counterAxisAlign'),
|
|
80
|
-
itemSpacing:
|
|
81
|
-
counterAxisSpacing:
|
|
81
|
+
itemSpacing: numberAccessor(internals, 'itemSpacing'),
|
|
82
|
+
counterAxisSpacing: numberAccessor(internals, 'counterAxisSpacing'),
|
|
82
83
|
paddingTop: simpleAccessor(internals, 'paddingTop'),
|
|
83
84
|
paddingRight: simpleAccessor(internals, 'paddingRight'),
|
|
84
85
|
paddingBottom: simpleAccessor(internals, 'paddingBottom'),
|
|
@@ -103,7 +104,14 @@ export function installLayoutNodeProxyAccessors(
|
|
|
103
104
|
itemReverseZIndex: simpleAccessor(internals, 'itemReverseZIndex'),
|
|
104
105
|
strokesIncludedInLayout: simpleAccessor(internals, 'strokesIncludedInLayout'),
|
|
105
106
|
layoutPositioning: mappedAccessor(internals, 'layoutPositioning'),
|
|
106
|
-
layoutGrow:
|
|
107
|
+
layoutGrow: {
|
|
108
|
+
get(this: ProxyThis): number {
|
|
109
|
+
return raw(this, internals).layoutGrow
|
|
110
|
+
},
|
|
111
|
+
set(this: ProxyThis, value: unknown) {
|
|
112
|
+
updateNode(this, internals, { layoutGrow: layoutGrowChoice(value) })
|
|
113
|
+
}
|
|
114
|
+
},
|
|
107
115
|
layoutAlign: {
|
|
108
116
|
get(this: ProxyThis): string {
|
|
109
117
|
const node = raw(this, internals)
|
|
@@ -134,10 +142,10 @@ export function installLayoutNodeProxyAccessors(
|
|
|
134
142
|
})
|
|
135
143
|
}
|
|
136
144
|
},
|
|
137
|
-
minWidth:
|
|
138
|
-
maxWidth:
|
|
139
|
-
minHeight:
|
|
140
|
-
maxHeight:
|
|
145
|
+
minWidth: sizeLimitAccessor(internals, 'minWidth'),
|
|
146
|
+
maxWidth: sizeLimitAccessor(internals, 'maxWidth'),
|
|
147
|
+
minHeight: sizeLimitAccessor(internals, 'minHeight'),
|
|
148
|
+
maxHeight: sizeLimitAccessor(internals, 'maxHeight'),
|
|
141
149
|
targetAspectRatio: {
|
|
142
150
|
get(this: ProxyThis): Vector | null {
|
|
143
151
|
const target = raw(this, internals).targetAspectRatio
|
|
@@ -218,6 +226,37 @@ function layoutSizingAccessor(
|
|
|
218
226
|
}
|
|
219
227
|
}
|
|
220
228
|
|
|
229
|
+
type SizeLimitField = 'minWidth' | 'maxWidth' | 'minHeight' | 'maxHeight'
|
|
230
|
+
|
|
231
|
+
type NumberField = 'itemSpacing' | 'counterAxisSpacing'
|
|
232
|
+
|
|
233
|
+
/** A minimum or maximum size, which a layer may also leave unset. */
|
|
234
|
+
function sizeLimitAccessor(
|
|
235
|
+
internals: NodeProxyInternals,
|
|
236
|
+
field: SizeLimitField
|
|
237
|
+
): PropertyDescriptor {
|
|
238
|
+
return {
|
|
239
|
+
get(this: ProxyThis): number | null {
|
|
240
|
+
return raw(this, internals)[field]
|
|
241
|
+
},
|
|
242
|
+
set(this: ProxyThis, value: unknown) {
|
|
243
|
+
updateNode(this, internals, { [field]: finiteOrNull(value, field) })
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/** A number field that refuses NaN and Infinity, as Figma's setters do. */
|
|
249
|
+
function numberAccessor(internals: NodeProxyInternals, field: NumberField): PropertyDescriptor {
|
|
250
|
+
return {
|
|
251
|
+
get(this: ProxyThis): number {
|
|
252
|
+
return raw(this, internals)[field]
|
|
253
|
+
},
|
|
254
|
+
set(this: ProxyThis, value: unknown) {
|
|
255
|
+
updateNode(this, internals, { [field]: finiteNumber(value, field) })
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
221
260
|
function simpleAccessor(internals: NodeProxyInternals, field: keyof SceneNode): PropertyDescriptor {
|
|
222
261
|
return {
|
|
223
262
|
get(this: ProxyThis): unknown {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { PrototypeReaction } from '@pairdraw/scene-graph'
|
|
2
|
+
|
|
3
|
+
import type { NodeProxyInternals, ProxyThis } from '#core/figma-api/accessor-utils'
|
|
4
|
+
import { graph, raw, updateNode } from '#core/figma-api/accessor-utils'
|
|
5
|
+
import { parseFigmaReactions, toFigmaReaction, type FigmaReaction } from '#core/figma-api/reactions'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* `reactions` on every layer, in Figma's plugin shape. Pairdraw keeps them on the layer's
|
|
9
|
+
* `prototypeReactions`; a write goes through the same validation as the tool, so a trigger,
|
|
10
|
+
* action, transition, navigation or destination the play cannot show is refused.
|
|
11
|
+
*/
|
|
12
|
+
export function installReactionAccessors(prototype: object, internals: NodeProxyInternals): void {
|
|
13
|
+
Object.defineProperties(prototype, {
|
|
14
|
+
reactions: {
|
|
15
|
+
get(this: ProxyThis): readonly FigmaReaction[] {
|
|
16
|
+
return Object.freeze(raw(this, internals).prototypeReactions.map(toFigmaReaction))
|
|
17
|
+
},
|
|
18
|
+
set(this: ProxyThis, value: readonly FigmaReaction[]) {
|
|
19
|
+
const node = raw(this, internals)
|
|
20
|
+
const sceneGraph = graph(this, internals)
|
|
21
|
+
const pageId = sceneGraph.pageOf(node.id) ?? ''
|
|
22
|
+
const previous: readonly PrototypeReaction[] = node.prototypeReactions
|
|
23
|
+
updateNode(this, internals, {
|
|
24
|
+
prototypeReactions: parseFigmaReactions(value, { graph: sceneGraph, pageId, previous })
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
}
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
type NodeProxyInternals,
|
|
10
10
|
type ProxyThis
|
|
11
11
|
} from '#core/figma-api/accessor-utils'
|
|
12
|
+
import { dashPatternValues, finiteNumber } from '#core/figma-api/finite'
|
|
12
13
|
import {
|
|
13
14
|
setIndependentStrokeWeight,
|
|
14
15
|
setStrokeAlign,
|
|
@@ -25,13 +26,26 @@ function graph(target: ProxyThis, internals: NodeProxyInternals): SceneGraph {
|
|
|
25
26
|
return target[internals.graph] as SceneGraph
|
|
26
27
|
}
|
|
27
28
|
|
|
29
|
+
/** The plugin API's name for each independent weight, which its refusals are worded with. */
|
|
30
|
+
const WEIGHT_PROPERTIES: Record<IndependentWeightField, string> = {
|
|
31
|
+
borderTopWeight: 'strokeTopWeight',
|
|
32
|
+
borderRightWeight: 'strokeRightWeight',
|
|
33
|
+
borderBottomWeight: 'strokeBottomWeight',
|
|
34
|
+
borderLeftWeight: 'strokeLeftWeight'
|
|
35
|
+
}
|
|
36
|
+
|
|
28
37
|
function independentWeight(internals: NodeProxyInternals, field: IndependentWeightField) {
|
|
29
38
|
return {
|
|
30
39
|
get(this: ProxyThis): number {
|
|
31
40
|
return raw(this, internals)[field]
|
|
32
41
|
},
|
|
33
|
-
set(this: ProxyThis, value:
|
|
34
|
-
setIndependentStrokeWeight(
|
|
42
|
+
set(this: ProxyThis, value: unknown) {
|
|
43
|
+
setIndependentStrokeWeight(
|
|
44
|
+
graph(this, internals),
|
|
45
|
+
nodeId(this, internals),
|
|
46
|
+
field,
|
|
47
|
+
finiteNumber(value, WEIGHT_PROPERTIES[field])
|
|
48
|
+
)
|
|
35
49
|
}
|
|
36
50
|
}
|
|
37
51
|
}
|
|
@@ -46,8 +60,12 @@ export function installStrokeNodeProxyAccessors(
|
|
|
46
60
|
get(this: ProxyThis): number {
|
|
47
61
|
return newStrokeGeometry(raw(strokeOwner(this, internals), internals)).weight
|
|
48
62
|
},
|
|
49
|
-
set(this: ProxyThis, value:
|
|
50
|
-
setStrokeWeight(
|
|
63
|
+
set(this: ProxyThis, value: unknown) {
|
|
64
|
+
setStrokeWeight(
|
|
65
|
+
graph(this, internals),
|
|
66
|
+
raw(strokeOwner(this, internals), internals),
|
|
67
|
+
finiteNumber(value, 'strokeWeight')
|
|
68
|
+
)
|
|
51
69
|
}
|
|
52
70
|
},
|
|
53
71
|
strokeAlign: {
|
|
@@ -62,8 +80,10 @@ export function installStrokeNodeProxyAccessors(
|
|
|
62
80
|
get(this: ProxyThis): readonly number[] {
|
|
63
81
|
return Object.freeze([...raw(strokeOwner(this, internals), internals).dashPattern])
|
|
64
82
|
},
|
|
65
|
-
set(this: ProxyThis, value:
|
|
66
|
-
updateNode(strokeOwner(this, internals), internals, {
|
|
83
|
+
set(this: ProxyThis, value: unknown) {
|
|
84
|
+
updateNode(strokeOwner(this, internals), internals, {
|
|
85
|
+
dashPattern: dashPatternValues(value)
|
|
86
|
+
})
|
|
67
87
|
}
|
|
68
88
|
},
|
|
69
89
|
strokeCap: {
|
|
@@ -97,8 +117,8 @@ export function installStrokeNodeProxyAccessors(
|
|
|
97
117
|
get(this: ProxyThis): number {
|
|
98
118
|
return raw(this, internals).strokeMiterLimit
|
|
99
119
|
},
|
|
100
|
-
set(this: ProxyThis, value:
|
|
101
|
-
updateNode(this, internals, { strokeMiterLimit: value })
|
|
120
|
+
set(this: ProxyThis, value: unknown) {
|
|
121
|
+
updateNode(this, internals, { strokeMiterLimit: finiteNumber(value, 'strokeMiterLimit') })
|
|
102
122
|
}
|
|
103
123
|
},
|
|
104
124
|
strokeTopWeight: independentWeight(internals, 'borderTopWeight'),
|
|
@@ -5,8 +5,10 @@ import type {
|
|
|
5
5
|
TextParagraphSpacingField
|
|
6
6
|
} from '@pairdraw/scene-graph'
|
|
7
7
|
|
|
8
|
+
import { renameTextLayer } from '#core/editor/text/name'
|
|
8
9
|
import {
|
|
9
10
|
graph,
|
|
11
|
+
nodeId,
|
|
10
12
|
raw,
|
|
11
13
|
updateNode,
|
|
12
14
|
type NodeProxyInternals,
|
|
@@ -110,6 +112,8 @@ export function installTextNodeProxyAccessors(
|
|
|
110
112
|
const textParagraphs = paragraphStylesForCharacters(raw(this, internals), value)
|
|
111
113
|
const styleRuns = styleRunsForCharacters(raw(this, internals), value)
|
|
112
114
|
updateNode(this, internals, { text: value, textParagraphs, styleRuns })
|
|
115
|
+
// A text layer that was never renamed follows its characters, as in Figma.
|
|
116
|
+
renameTextLayer(graph(this, internals), nodeId(this, internals), value)
|
|
113
117
|
}
|
|
114
118
|
},
|
|
115
119
|
// The new font replaces every character's, so only it has to be loaded, as in Figma.
|
|
@@ -133,7 +133,9 @@ function setGeometry(
|
|
|
133
133
|
? transformVectorNetwork([1, 0, -bounds.x, 0, 1, -bounds.y, 0, 0, 1], network)
|
|
134
134
|
: structuredClone(EMPTY_NETWORK)
|
|
135
135
|
const normalizedGeometry =
|
|
136
|
-
fillGeometry.length > 0
|
|
136
|
+
fillGeometry.length > 0
|
|
137
|
+
? regenerateFillGeometry(normalized, fillGeometry, node.cornerRadius)
|
|
138
|
+
: []
|
|
137
139
|
|
|
138
140
|
updateNode(target, internals, {
|
|
139
141
|
x: hasGeometry ? node.x + bounds.x : node.x,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SceneNode, ShadowEffect, Stroke } from '@pairdraw/scene-graph'
|
|
2
2
|
import { newStrokeGeometry } from '@pairdraw/scene-graph/node-defaults'
|
|
3
|
-
import { independentCornerChanges
|
|
3
|
+
import { independentCornerChanges } from '@pairdraw/scene-graph/variables'
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
graph,
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
type ProxyThis
|
|
12
12
|
} from '#core/figma-api/accessor-utils'
|
|
13
13
|
import { parseFigmaEffects, toFigmaEffect, type FigmaEffect } from '#core/figma-api/effects'
|
|
14
|
+
import { finiteNumber } from '#core/figma-api/finite'
|
|
14
15
|
import { parseFigmaPaints, toFigmaPaint, type FigmaPaint } from '#core/figma-api/paints'
|
|
15
16
|
import { getTextStyle } from '#core/figma-api/text/style'
|
|
16
17
|
import { paintBindings, setPaintBindings } from '#core/figma-api/variables/bindings'
|
|
@@ -43,24 +44,19 @@ function styleReference(
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
/**
|
|
46
|
-
* `node`'s fills as Figma's plugin API reads them,
|
|
47
|
-
* variable
|
|
47
|
+
* `node`'s fills as Figma's plugin API reads them, each carrying the variable it is bound to. A
|
|
48
|
+
* bound paint reads as it stores its color and opacity, which its variable writes into it when it
|
|
49
|
+
* binds and whenever the color it gives the layer changes, as in Figma.
|
|
48
50
|
*/
|
|
49
|
-
export function figmaFills(
|
|
51
|
+
export function figmaFills(node: SceneNode): FigmaPaint[] {
|
|
50
52
|
const bound = paintBindings(node, 'fills')
|
|
51
|
-
|
|
52
|
-
? (resolvedPaintBindings(sceneGraph, node).fills ?? node.fills)
|
|
53
|
-
: node.fills
|
|
54
|
-
return fills.map((fill, index) => toFigmaPaint(fill, bound.get(index)))
|
|
53
|
+
return node.fills.map((fill, index) => toFigmaPaint(fill, bound.get(index)))
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
/** `node`'s strokes as Figma's plugin API reads them, as {@link figmaFills} reads fills. */
|
|
58
|
-
export function figmaStrokes(
|
|
57
|
+
export function figmaStrokes(node: SceneNode): FigmaPaint[] {
|
|
59
58
|
const bound = paintBindings(node, 'strokes')
|
|
60
|
-
|
|
61
|
-
? (resolvedPaintBindings(sceneGraph, node).strokes ?? node.strokes)
|
|
62
|
-
: node.strokes
|
|
63
|
-
return strokes.map((stroke, index) => toFigmaPaint(stroke, bound.get(index)))
|
|
59
|
+
return node.strokes.map((stroke, index) => toFigmaPaint(stroke, bound.get(index)))
|
|
64
60
|
}
|
|
65
61
|
|
|
66
62
|
export function installVisualNodeProxyAccessors(
|
|
@@ -73,7 +69,7 @@ export function installVisualNodeProxyAccessors(
|
|
|
73
69
|
// Text reads mixed while its characters are filled differently, and setting it fills them all.
|
|
74
70
|
get(this: ProxyThis): readonly FigmaPaint[] | symbol {
|
|
75
71
|
const node = raw(this, internals)
|
|
76
|
-
if (node.type !== 'TEXT') return Object.freeze(figmaFills(
|
|
72
|
+
if (node.type !== 'TEXT') return Object.freeze(figmaFills(node))
|
|
77
73
|
const fills = getTextStyle(node, 'fills', mixed)
|
|
78
74
|
// Text styles read for scripts already give Figma's paints.
|
|
79
75
|
return typeof fills === 'symbol' ? fills : Object.freeze(fills as FigmaPaint[])
|
|
@@ -92,7 +88,7 @@ export function installVisualNodeProxyAccessors(
|
|
|
92
88
|
strokes: {
|
|
93
89
|
get(this: ProxyThis): readonly FigmaPaint[] {
|
|
94
90
|
const owner = raw(strokeOwner(this, internals), internals)
|
|
95
|
-
return Object.freeze(figmaStrokes(
|
|
91
|
+
return Object.freeze(figmaStrokes(owner))
|
|
96
92
|
},
|
|
97
93
|
// Figma paints carry no geometry; a stroke takes the node's weight and alignment, which
|
|
98
94
|
// outlast its strokes.
|
|
@@ -139,8 +135,8 @@ export function installVisualNodeProxyAccessors(
|
|
|
139
135
|
get(this: ProxyThis): number {
|
|
140
136
|
return raw(this, internals).opacity
|
|
141
137
|
},
|
|
142
|
-
set(this: ProxyThis, value:
|
|
143
|
-
updateNode(this, internals, { opacity: value })
|
|
138
|
+
set(this: ProxyThis, value: unknown) {
|
|
139
|
+
updateNode(this, internals, { opacity: finiteNumber(value, 'opacity') })
|
|
144
140
|
}
|
|
145
141
|
},
|
|
146
142
|
visible: {
|
|
@@ -186,14 +182,15 @@ export function installVisualNodeProxyAccessors(
|
|
|
186
182
|
)
|
|
187
183
|
return agree ? topLeftRadius : mixed
|
|
188
184
|
},
|
|
189
|
-
set(this: ProxyThis, value:
|
|
185
|
+
set(this: ProxyThis, value: unknown) {
|
|
190
186
|
if (value === mixed) return
|
|
187
|
+
const radius = finiteNumber(value, 'cornerRadius')
|
|
191
188
|
updateNode(this, internals, {
|
|
192
|
-
cornerRadius:
|
|
193
|
-
topLeftRadius:
|
|
194
|
-
topRightRadius:
|
|
195
|
-
bottomRightRadius:
|
|
196
|
-
bottomLeftRadius:
|
|
189
|
+
cornerRadius: radius,
|
|
190
|
+
topLeftRadius: radius,
|
|
191
|
+
topRightRadius: radius,
|
|
192
|
+
bottomRightRadius: radius,
|
|
193
|
+
bottomLeftRadius: radius,
|
|
197
194
|
independentCorners: false
|
|
198
195
|
})
|
|
199
196
|
}
|
|
@@ -206,8 +203,8 @@ export function installVisualNodeProxyAccessors(
|
|
|
206
203
|
get(this: ProxyThis): number {
|
|
207
204
|
return raw(this, internals).cornerSmoothing
|
|
208
205
|
},
|
|
209
|
-
set(this: ProxyThis, value:
|
|
210
|
-
updateNode(this, internals, { cornerSmoothing: value })
|
|
206
|
+
set(this: ProxyThis, value: unknown) {
|
|
207
|
+
updateNode(this, internals, { cornerSmoothing: finiteNumber(value, 'cornerSmoothing') })
|
|
211
208
|
}
|
|
212
209
|
}
|
|
213
210
|
})
|
|
@@ -221,10 +218,10 @@ function cornerAccessor(
|
|
|
221
218
|
get(this: ProxyThis): number {
|
|
222
219
|
return raw(this, internals)[field]
|
|
223
220
|
},
|
|
224
|
-
set(this: ProxyThis, value:
|
|
221
|
+
set(this: ProxyThis, value: unknown) {
|
|
225
222
|
updateNode(this, internals, {
|
|
226
223
|
...independentCornerChanges(raw(this, internals)),
|
|
227
|
-
[field]: value
|
|
224
|
+
[field]: finiteNumber(value, field)
|
|
228
225
|
})
|
|
229
226
|
}
|
|
230
227
|
}
|
|
@@ -339,13 +339,15 @@ export function installComponentPropertyAccessors(
|
|
|
339
339
|
componentPropertyReferences: {
|
|
340
340
|
get(this: ProxyThis) {
|
|
341
341
|
const node = raw(this, internals)
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
342
|
+
// Any layer in a component or instance, and a component itself, has references, as in
|
|
343
|
+
// Figma (desktop 126); anything else, a placed instance included, has none.
|
|
344
|
+
const holder = node.parentId
|
|
345
|
+
? graph(this, internals).closest(
|
|
346
|
+
node.parentId,
|
|
347
|
+
(ancestor) => ancestor.type === 'COMPONENT' || ancestor.type === 'INSTANCE'
|
|
348
|
+
)
|
|
349
|
+
: undefined
|
|
350
|
+
if (node.type !== 'COMPONENT' && !holder) return null
|
|
349
351
|
// References name properties by key, `Name#id`, as componentPropertyDefinitions does.
|
|
350
352
|
const definitions = referableDefinitions(graph(this, internals), node)
|
|
351
353
|
return Object.fromEntries(
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/** Figma's refusal for a value a plugin setter cannot take, worded as its own setters do. */
|
|
2
|
+
export function invalidSetterValue(method: string, property: string, problem: string): Error {
|
|
3
|
+
return new Error(`in ${method}: Property "${property}" failed validation: ${problem}`)
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A number a layer field takes. NaN and Infinity would break the layer's bounds and its page's,
|
|
8
|
+
* so a setter refuses them with Figma's message instead of writing them.
|
|
9
|
+
*/
|
|
10
|
+
export function finiteNumber(value: unknown, property: string, method = `set_${property}`): number {
|
|
11
|
+
if (typeof value !== 'number' || !Number.isFinite(value))
|
|
12
|
+
throw invalidSetterValue(method, property, `Expected number, received ${String(value)}`)
|
|
13
|
+
return value
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** A number that may also be absent, as a minimum or maximum size is. */
|
|
17
|
+
export function finiteOrNull(
|
|
18
|
+
value: unknown,
|
|
19
|
+
property: string,
|
|
20
|
+
method = `set_${property}`
|
|
21
|
+
): number | null {
|
|
22
|
+
return value === null ? null : finiteNumber(value, property, method)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Figma grows a layer to fill its auto layout with 1 and keeps its size with 0. */
|
|
26
|
+
export function layoutGrowChoice(value: unknown): 0 | 1 {
|
|
27
|
+
if (value !== 0 && value !== 1)
|
|
28
|
+
throw invalidSetterValue(
|
|
29
|
+
'set_layoutGrow',
|
|
30
|
+
'layoutGrow',
|
|
31
|
+
'Expected one of the following, but none matched:\n Invalid input: expected 0\n Invalid input: expected 1'
|
|
32
|
+
)
|
|
33
|
+
return value
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** A dash pattern's numbers, refused one by one with the index Figma reports. */
|
|
37
|
+
export function dashPatternValues(
|
|
38
|
+
value: unknown,
|
|
39
|
+
method = 'set_dashPattern',
|
|
40
|
+
property = 'dashPattern'
|
|
41
|
+
): number[] {
|
|
42
|
+
if (!Array.isArray(value))
|
|
43
|
+
throw invalidSetterValue(
|
|
44
|
+
method,
|
|
45
|
+
property,
|
|
46
|
+
`Expected array, received ${value === null ? 'null' : typeof value}`
|
|
47
|
+
)
|
|
48
|
+
return value.map((dash, index) => {
|
|
49
|
+
if (typeof dash !== 'number' || !Number.isFinite(dash))
|
|
50
|
+
throw invalidSetterValue(
|
|
51
|
+
method,
|
|
52
|
+
property,
|
|
53
|
+
`Expected number, received ${String(dash)} at index ${index}`
|
|
54
|
+
)
|
|
55
|
+
return dash
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface TransformRows {
|
|
60
|
+
first: [number, number, number]
|
|
61
|
+
second: [number, number, number]
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function isIndexedObject(value: unknown): value is Record<string, unknown> {
|
|
65
|
+
return typeof value === 'object' && value !== null
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** A row or the pair of rows, given as an array or as an object keyed by index. */
|
|
69
|
+
function indexedValues(value: unknown, length: number): unknown[] | null {
|
|
70
|
+
if (Array.isArray(value)) return value
|
|
71
|
+
if (!isIndexedObject(value)) return null
|
|
72
|
+
return Array.from({ length }, (_, index) => value[String(index)])
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Figma takes a relative transform as two rows of three numbers, each row and the pair given as an
|
|
77
|
+
* array or as an object keyed by index. Both are read here, with the path of a wrong value in the
|
|
78
|
+
* message.
|
|
79
|
+
*/
|
|
80
|
+
export function finiteTransform(
|
|
81
|
+
value: unknown,
|
|
82
|
+
method = 'set_relativeTransform',
|
|
83
|
+
property = 'relativeTransform'
|
|
84
|
+
): TransformRows {
|
|
85
|
+
const rows = indexedValues(value, 2)
|
|
86
|
+
if (!rows) throw invalidSetterValue(method, property, 'Expected an array of 2 rows')
|
|
87
|
+
const read = (row: unknown, index: number): [number, number, number] => {
|
|
88
|
+
const cells = indexedValues(row, 3)
|
|
89
|
+
if (!cells) throw invalidSetterValue(method, property, `Expected an array of 3 at [${index}]`)
|
|
90
|
+
const numbers = cells.map((cell, cellIndex) => {
|
|
91
|
+
if (typeof cell !== 'number' || !Number.isFinite(cell))
|
|
92
|
+
throw invalidSetterValue(
|
|
93
|
+
method,
|
|
94
|
+
property,
|
|
95
|
+
`Expected number, received ${String(cell)} at [${index}][${cellIndex}]`
|
|
96
|
+
)
|
|
97
|
+
return cell
|
|
98
|
+
})
|
|
99
|
+
return [numbers[0], numbers[1], numbers[2]]
|
|
100
|
+
}
|
|
101
|
+
return { first: read(rows[0], 0), second: read(rows[1], 1) }
|
|
102
|
+
}
|