@pairdraw/core 0.18.0 → 0.19.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/effects.d.ts +5 -11
- package/dist/canvas/effects.d.ts.map +1 -1
- package/dist/canvas/effects.js +25 -30
- package/dist/canvas/effects.js.map +1 -1
- package/dist/canvas/labels/hit-test.d.ts +5 -0
- package/dist/canvas/labels/hit-test.d.ts.map +1 -1
- package/dist/canvas/labels/hit-test.js +1 -1
- package/dist/canvas/labels/hit-test.js.map +1 -1
- package/dist/canvas/labels/paragraph-cache.d.ts.map +1 -1
- package/dist/canvas/labels/paragraph-cache.js +3 -2
- package/dist/canvas/labels/paragraph-cache.js.map +1 -1
- package/dist/canvas/labels/selection.js +3 -2
- package/dist/canvas/labels/selection.js.map +1 -1
- package/dist/canvas/labels/style.d.ts +1 -1
- package/dist/canvas/node-edit-overlay.js +2 -2
- package/dist/canvas/node-edit-overlay.js.map +1 -1
- package/dist/canvas/overlays/index.d.ts +2 -2
- package/dist/canvas/overlays/index.js +2 -2
- package/dist/canvas/overlays/selection.d.ts +1 -2
- package/dist/canvas/overlays/selection.d.ts.map +1 -1
- package/dist/canvas/overlays/selection.js +4 -37
- package/dist/canvas/overlays/selection.js.map +1 -1
- package/dist/canvas/region-hatch.js +3 -2
- package/dist/canvas/region-hatch.js.map +1 -1
- package/dist/canvas/renderer/colors.d.ts.map +1 -1
- package/dist/canvas/renderer/colors.js +36 -18
- package/dist/canvas/renderer/colors.js.map +1 -1
- package/dist/canvas/renderer/font-waiters.d.ts +9 -0
- package/dist/canvas/renderer/font-waiters.d.ts.map +1 -0
- package/dist/canvas/renderer/font-waiters.js +26 -0
- package/dist/canvas/renderer/font-waiters.js.map +1 -0
- package/dist/canvas/renderer/fonts.d.ts +4 -2
- package/dist/canvas/renderer/fonts.d.ts.map +1 -1
- package/dist/canvas/renderer/fonts.js +23 -9
- package/dist/canvas/renderer/fonts.js.map +1 -1
- package/dist/canvas/renderer/lifecycle.d.ts.map +1 -1
- package/dist/canvas/renderer/lifecycle.js +6 -9
- package/dist/canvas/renderer/lifecycle.js.map +1 -1
- package/dist/canvas/renderer/methods.d.ts +4 -5
- package/dist/canvas/renderer/methods.d.ts.map +1 -1
- package/dist/canvas/renderer/methods.js +1 -4
- package/dist/canvas/renderer/methods.js.map +1 -1
- package/dist/canvas/renderer/paints.d.ts.map +1 -1
- package/dist/canvas/renderer/paints.js +0 -6
- package/dist/canvas/renderer/paints.js.map +1 -1
- package/dist/canvas/renderer/pipeline.d.ts.map +1 -1
- package/dist/canvas/renderer/pipeline.js +20 -2
- package/dist/canvas/renderer/pipeline.js.map +1 -1
- package/dist/canvas/renderer/retained-backing.js +4 -4
- package/dist/canvas/renderer/retained-backing.js.map +1 -1
- package/dist/canvas/renderer/state.js +1 -1
- package/dist/canvas/renderer/state.js.map +1 -1
- package/dist/canvas/renderer/tiles/controller.d.ts +2 -0
- package/dist/canvas/renderer/tiles/controller.d.ts.map +1 -1
- package/dist/canvas/renderer/tiles/controller.js +8 -0
- package/dist/canvas/renderer/tiles/controller.js.map +1 -1
- package/dist/canvas/renderer/tiles/surface-pool.js +1 -1
- package/dist/canvas/renderer/tiles/surface-pool.js.map +1 -1
- package/dist/canvas/renderer/visual-bounds.d.ts.map +1 -1
- package/dist/canvas/renderer/visual-bounds.js +7 -5
- package/dist/canvas/renderer/visual-bounds.js.map +1 -1
- package/dist/canvas/renderer.d.ts +22 -7
- package/dist/canvas/renderer.d.ts.map +1 -1
- package/dist/canvas/renderer.js +46 -11
- package/dist/canvas/renderer.js.map +1 -1
- package/dist/canvas/rulers.d.ts +8 -1
- package/dist/canvas/rulers.d.ts.map +1 -1
- package/dist/canvas/rulers.js +30 -5
- package/dist/canvas/rulers.js.map +1 -1
- package/dist/canvas/scene.d.ts +2 -1
- package/dist/canvas/scene.d.ts.map +1 -1
- package/dist/canvas/scene.js +30 -18
- package/dist/canvas/scene.js.map +1 -1
- package/dist/canvas/shadows/shape.js +1 -1
- package/dist/canvas/shadows/shape.js.map +1 -1
- package/dist/canvas/shadows/silhouette.d.ts.map +1 -1
- package/dist/canvas/shadows/silhouette.js +4 -2
- package/dist/canvas/shadows/silhouette.js.map +1 -1
- package/dist/canvas/shadows.d.ts.map +1 -1
- package/dist/canvas/shadows.js +3 -2
- package/dist/canvas/shadows.js.map +1 -1
- package/dist/canvas/text/derived.d.ts +1 -2
- package/dist/canvas/text/derived.d.ts.map +1 -1
- package/dist/canvas/text/derived.js +1 -7
- package/dist/canvas/text/derived.js.map +1 -1
- package/dist/canvas/text/emoji/index.js +1 -1
- package/dist/canvas/text/emoji/raster.d.ts.map +1 -1
- package/dist/canvas/text/emoji/raster.js +14 -10
- package/dist/canvas/text/emoji/raster.js.map +1 -1
- package/dist/canvas/text/font-families.d.ts.map +1 -1
- package/dist/canvas/text/font-families.js +5 -2
- package/dist/canvas/text/font-families.js.map +1 -1
- package/dist/canvas/text/index.d.ts +1 -3
- package/dist/canvas/text/index.d.ts.map +1 -1
- package/dist/canvas/text/index.js +1 -8
- package/dist/canvas/text/index.js.map +1 -1
- package/dist/canvas/text/layout/build.d.ts.map +1 -1
- package/dist/canvas/text/layout/build.js +25 -9
- package/dist/canvas/text/layout/build.js.map +1 -1
- package/dist/canvas/text/layout/index.d.ts.map +1 -1
- package/dist/canvas/text/layout/index.js +8 -4
- package/dist/canvas/text/layout/index.js.map +1 -1
- package/dist/canvas/text/layout/lines.js +5 -3
- package/dist/canvas/text/layout/lines.js.map +1 -1
- package/dist/canvas/text/paragraph/index.d.ts +5 -0
- package/dist/canvas/text/paragraph/index.d.ts.map +1 -1
- package/dist/canvas/text/paragraph/index.js +16 -7
- package/dist/canvas/text/paragraph/index.js.map +1 -1
- package/dist/canvas/text/paragraph/inputs.d.ts +1 -1
- package/dist/canvas/text/paragraph/inputs.d.ts.map +1 -1
- package/dist/canvas/text/paragraph/inputs.js +9 -2
- package/dist/canvas/text/paragraph/inputs.js.map +1 -1
- package/dist/canvas/text/placed.js +1 -1
- package/dist/canvas/text/shape.d.ts +4 -3
- package/dist/canvas/text/shape.d.ts.map +1 -1
- package/dist/canvas/text/shape.js +9 -22
- package/dist/canvas/text/shape.js.map +1 -1
- package/dist/constants.d.ts +6 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +6 -2
- package/dist/constants.js.map +1 -1
- package/dist/editor/bridges/clipboard.d.ts +1 -0
- package/dist/editor/bridges/clipboard.js +1 -0
- package/dist/editor/bridges/clipboard.js.map +1 -1
- package/dist/editor/bridges/components.d.ts +2 -0
- package/dist/editor/bridges/components.d.ts.map +1 -1
- package/dist/editor/bridges/components.js +2 -0
- package/dist/editor/bridges/components.js.map +1 -1
- package/dist/editor/bridges/frames.d.ts +4 -3
- package/dist/editor/bridges/frames.d.ts.map +1 -1
- package/dist/editor/bridges/frames.js +6 -4
- package/dist/editor/bridges/frames.js.map +1 -1
- package/dist/editor/bridges/structure.d.ts +1 -0
- package/dist/editor/bridges/structure.d.ts.map +1 -1
- package/dist/editor/bridges/structure.js +1 -0
- package/dist/editor/bridges/structure.js.map +1 -1
- package/dist/editor/clipboard/detach.js +2 -2
- package/dist/editor/clipboard/detach.js.map +1 -1
- package/dist/editor/clipboard/paste/properties.js +1 -1
- package/dist/editor/clipboard/paste/target.js +2 -2
- package/dist/editor/clipboard/paste/target.js.map +1 -1
- package/dist/editor/clipboard/snapshot.d.ts +3 -0
- package/dist/editor/clipboard/snapshot.d.ts.map +1 -1
- package/dist/editor/clipboard/snapshot.js +2 -0
- package/dist/editor/clipboard/snapshot.js.map +1 -1
- package/dist/editor/clipboard/variables.d.ts.map +1 -1
- package/dist/editor/clipboard/variables.js +14 -1
- package/dist/editor/clipboard/variables.js.map +1 -1
- package/dist/editor/clipboard.d.ts +1 -0
- package/dist/editor/clipboard.d.ts.map +1 -1
- package/dist/editor/clipboard.js +122 -16
- package/dist/editor/clipboard.js.map +1 -1
- package/dist/editor/component-sync.d.ts +10 -1
- package/dist/editor/component-sync.d.ts.map +1 -1
- package/dist/editor/component-sync.js +25 -8
- package/dist/editor/component-sync.js.map +1 -1
- package/dist/editor/components/authoring/text-edit.d.ts.map +1 -1
- package/dist/editor/components/authoring/text-edit.js +11 -2
- package/dist/editor/components/authoring/text-edit.js.map +1 -1
- package/dist/editor/components/authoring/visibility-edit.d.ts.map +1 -1
- package/dist/editor/components/authoring/visibility-edit.js +7 -3
- package/dist/editor/components/authoring/visibility-edit.js.map +1 -1
- package/dist/editor/components/instances.d.ts +2 -0
- package/dist/editor/components/instances.d.ts.map +1 -1
- package/dist/editor/components/instances.js +37 -7
- package/dist/editor/components/instances.js.map +1 -1
- package/dist/editor/components/properties.d.ts.map +1 -1
- package/dist/editor/components/properties.js +3 -0
- package/dist/editor/components/properties.js.map +1 -1
- package/dist/editor/components/slots/authoring.js +2 -1
- package/dist/editor/components/slots/authoring.js.map +1 -1
- package/dist/editor/components.d.ts +2 -0
- package/dist/editor/components.d.ts.map +1 -1
- package/dist/editor/create.d.ts +17 -3
- package/dist/editor/create.d.ts.map +1 -1
- package/dist/editor/create.js +43 -6
- package/dist/editor/create.js.map +1 -1
- package/dist/editor/guides.d.ts.map +1 -1
- package/dist/editor/guides.js +20 -13
- package/dist/editor/guides.js.map +1 -1
- package/dist/editor/history/document-change.d.ts +19 -3
- package/dist/editor/history/document-change.d.ts.map +1 -1
- package/dist/editor/history/document-change.js +94 -8
- package/dist/editor/history/document-change.js.map +1 -1
- package/dist/editor/history/edit.d.ts.map +1 -1
- package/dist/editor/history/edit.js +56 -12
- package/dist/editor/history/edit.js.map +1 -1
- package/dist/editor/history/position.js +1 -4
- package/dist/editor/history/position.js.map +1 -1
- package/dist/editor/history/sources.d.ts +14 -0
- package/dist/editor/history/sources.d.ts.map +1 -0
- package/dist/editor/history/sources.js +24 -0
- package/dist/editor/history/sources.js.map +1 -0
- package/dist/editor/index.d.ts +2 -2
- package/dist/editor/index.js +1 -1
- package/dist/editor/layout-mode.d.ts.map +1 -1
- package/dist/editor/layout-mode.js +16 -1
- package/dist/editor/layout-mode.js.map +1 -1
- package/dist/editor/node-preview.d.ts.map +1 -1
- package/dist/editor/node-preview.js +26 -7
- package/dist/editor/node-preview.js.map +1 -1
- package/dist/editor/nodes.d.ts.map +1 -1
- package/dist/editor/nodes.js +33 -10
- package/dist/editor/nodes.js.map +1 -1
- package/dist/editor/nudge.d.ts.map +1 -1
- package/dist/editor/nudge.js +12 -2
- package/dist/editor/nudge.js.map +1 -1
- package/dist/editor/pages.d.ts +2 -1
- package/dist/editor/pages.d.ts.map +1 -1
- package/dist/editor/pages.js +94 -15
- package/dist/editor/pages.js.map +1 -1
- package/dist/editor/play/states.d.ts.map +1 -1
- package/dist/editor/play/states.js +0 -5
- package/dist/editor/play/states.js.map +1 -1
- package/dist/editor/read-only/actions.js +3 -0
- package/dist/editor/read-only/actions.js.map +1 -1
- package/dist/editor/selection/hit-test.d.ts +2 -1
- package/dist/editor/selection/hit-test.d.ts.map +1 -1
- package/dist/editor/selection/hit-test.js +29 -4
- package/dist/editor/selection/hit-test.js.map +1 -1
- package/dist/editor/selection.d.ts +2 -2
- package/dist/editor/selection.d.ts.map +1 -1
- package/dist/editor/shapes/pen.js +6 -2
- package/dist/editor/shapes/pen.js.map +1 -1
- package/dist/editor/shapes.d.ts.map +1 -1
- package/dist/editor/shapes.js +2 -1
- package/dist/editor/shapes.js.map +1 -1
- package/dist/editor/structure/auto-layout-wrap.d.ts.map +1 -1
- package/dist/editor/structure/auto-layout-wrap.js +12 -0
- package/dist/editor/structure/auto-layout-wrap.js.map +1 -1
- package/dist/editor/structure/boolean.js +1 -1
- package/dist/editor/structure/group/bounds.d.ts +4 -2
- package/dist/editor/structure/group/bounds.d.ts.map +1 -1
- package/dist/editor/structure/group/bounds.js +17 -4
- package/dist/editor/structure/group/bounds.js.map +1 -1
- package/dist/editor/structure/rename.d.ts +2 -3
- package/dist/editor/structure/rename.d.ts.map +1 -1
- package/dist/editor/structure/rename.js +2 -5
- package/dist/editor/structure/rename.js.map +1 -1
- package/dist/editor/structure/reorder.d.ts.map +1 -1
- package/dist/editor/structure/reorder.js +20 -9
- package/dist/editor/structure/reorder.js.map +1 -1
- package/dist/editor/structure/state.js +1 -1
- package/dist/editor/structure.d.ts +1 -0
- package/dist/editor/structure.d.ts.map +1 -1
- package/dist/editor/structure.js +76 -20
- package/dist/editor/structure.js.map +1 -1
- package/dist/editor/text/hyperlink.d.ts.map +1 -1
- package/dist/editor/text/hyperlink.js +1 -1
- package/dist/editor/text/hyperlink.js.map +1 -1
- package/dist/editor/text/name.d.ts +13 -5
- package/dist/editor/text/name.d.ts.map +1 -1
- package/dist/editor/text/name.js +47 -17
- package/dist/editor/text/name.js.map +1 -1
- package/dist/editor/text/pending-layout.d.ts +2 -1
- package/dist/editor/text/pending-layout.d.ts.map +1 -1
- package/dist/editor/text/pending-layout.js +33 -6
- package/dist/editor/text/pending-layout.js.map +1 -1
- package/dist/editor/text/selection-style.d.ts +1 -0
- package/dist/editor/text/selection-style.d.ts.map +1 -1
- package/dist/editor/text/selection-style.js +16 -4
- package/dist/editor/text/selection-style.js.map +1 -1
- package/dist/editor/text.d.ts +5 -0
- package/dist/editor/text.d.ts.map +1 -1
- package/dist/editor/text.js +70 -3
- package/dist/editor/text.js.map +1 -1
- package/dist/editor/types.d.ts +18 -1
- package/dist/editor/types.d.ts.map +1 -1
- package/dist/editor/undo.d.ts.map +1 -1
- package/dist/editor/undo.js +14 -2
- package/dist/editor/undo.js.map +1 -1
- package/dist/editor/variable-bindings.d.ts.map +1 -1
- package/dist/editor/variable-bindings.js +21 -2
- package/dist/editor/variable-bindings.js.map +1 -1
- package/dist/editor/variables.d.ts +1 -1
- package/dist/editor/variables.d.ts.map +1 -1
- package/dist/editor/variables.js +7 -8
- package/dist/editor/variables.js.map +1 -1
- package/dist/editor/viewport.d.ts +11 -2
- package/dist/editor/viewport.d.ts.map +1 -1
- package/dist/editor/viewport.js +61 -21
- package/dist/editor/viewport.js.map +1 -1
- package/dist/editor/views/actions.d.ts.map +1 -1
- package/dist/editor/views/actions.js +13 -5
- package/dist/editor/views/actions.js.map +1 -1
- package/dist/editor/views/present.d.ts +6 -4
- package/dist/editor/views/present.d.ts.map +1 -1
- package/dist/editor/views/present.js +12 -10
- package/dist/editor/views/present.js.map +1 -1
- package/dist/editor/views/types.d.ts +11 -5
- package/dist/editor/views/types.d.ts.map +1 -1
- package/dist/figma-api/accessor-utils.d.ts.map +1 -1
- package/dist/figma-api/accessor-utils.js +4 -1
- package/dist/figma-api/accessor-utils.js.map +1 -1
- package/dist/figma-api/accessors/basic.d.ts.map +1 -1
- package/dist/figma-api/accessors/basic.js +41 -21
- package/dist/figma-api/accessors/basic.js.map +1 -1
- package/dist/figma-api/accessors/layout.d.ts.map +1 -1
- package/dist/figma-api/accessors/layout.js +37 -7
- package/dist/figma-api/accessors/layout.js.map +1 -1
- package/dist/figma-api/accessors/reactions.d.ts +11 -0
- package/dist/figma-api/accessors/reactions.d.ts.map +1 -0
- package/dist/figma-api/accessors/reactions.js +30 -0
- package/dist/figma-api/accessors/reactions.js.map +1 -0
- package/dist/figma-api/accessors/strokes.d.ts.map +1 -1
- package/dist/figma-api/accessors/strokes.js +12 -4
- package/dist/figma-api/accessors/strokes.js.map +1 -1
- package/dist/figma-api/accessors/text/index.d.ts.map +1 -1
- package/dist/figma-api/accessors/text/index.js +3 -1
- package/dist/figma-api/accessors/text/index.js.map +1 -1
- package/dist/figma-api/accessors/vector.d.ts.map +1 -1
- package/dist/figma-api/accessors/vector.js +1 -1
- package/dist/figma-api/accessors/vector.js.map +1 -1
- package/dist/figma-api/accessors/visual.d.ts +6 -5
- package/dist/figma-api/accessors/visual.d.ts.map +1 -1
- package/dist/figma-api/accessors/visual.js +20 -17
- package/dist/figma-api/accessors/visual.js.map +1 -1
- package/dist/figma-api/components.d.ts.map +1 -1
- package/dist/figma-api/components.js +2 -1
- package/dist/figma-api/components.js.map +1 -1
- package/dist/figma-api/finite.d.ts +27 -0
- package/dist/figma-api/finite.d.ts.map +1 -0
- package/dist/figma-api/finite.js +69 -0
- package/dist/figma-api/finite.js.map +1 -0
- package/dist/figma-api/fonts/list.d.ts +13 -0
- package/dist/figma-api/fonts/list.d.ts.map +1 -0
- package/dist/figma-api/fonts/list.js +25 -0
- package/dist/figma-api/fonts/list.js.map +1 -0
- package/dist/figma-api/index.d.ts +21 -3
- package/dist/figma-api/index.d.ts.map +1 -1
- package/dist/figma-api/index.js +58 -13
- package/dist/figma-api/index.js.map +1 -1
- package/dist/figma-api/overrides.d.ts +6 -1
- package/dist/figma-api/overrides.d.ts.map +1 -1
- package/dist/figma-api/overrides.js +2 -2
- package/dist/figma-api/overrides.js.map +1 -1
- package/dist/figma-api/pending-layout.d.ts +12 -2
- package/dist/figma-api/pending-layout.d.ts.map +1 -1
- package/dist/figma-api/pending-layout.js +41 -1
- package/dist/figma-api/pending-layout.js.map +1 -1
- package/dist/figma-api/pending-sync.d.ts +19 -0
- package/dist/figma-api/pending-sync.d.ts.map +1 -0
- package/dist/figma-api/pending-sync.js +52 -0
- package/dist/figma-api/pending-sync.js.map +1 -0
- package/dist/figma-api/proxy.d.ts +15 -2
- package/dist/figma-api/proxy.d.ts.map +1 -1
- package/dist/figma-api/proxy.js +23 -3
- package/dist/figma-api/proxy.js.map +1 -1
- package/dist/figma-api/reactions.d.ts +104 -0
- package/dist/figma-api/reactions.d.ts.map +1 -0
- package/dist/figma-api/reactions.js +157 -0
- package/dist/figma-api/reactions.js.map +1 -0
- package/dist/figma-api/render-bounds.d.ts.map +1 -1
- package/dist/figma-api/render-bounds.js +4 -4
- package/dist/figma-api/render-bounds.js.map +1 -1
- package/dist/figma-api/serialization.js +2 -2
- package/dist/figma-api/serialization.js.map +1 -1
- package/dist/figma-api/slots.d.ts +7 -1
- package/dist/figma-api/slots.d.ts.map +1 -1
- package/dist/figma-api/slots.js +12 -4
- package/dist/figma-api/slots.js.map +1 -1
- package/dist/figma-api/strokes.d.ts +5 -2
- package/dist/figma-api/strokes.d.ts.map +1 -1
- package/dist/figma-api/strokes.js +12 -19
- package/dist/figma-api/strokes.js.map +1 -1
- package/dist/figma-api/text/bindings.js +1 -1
- package/dist/figma-api/text/index.d.ts +2 -3
- package/dist/figma-api/text/index.d.ts.map +1 -1
- package/dist/figma-api/text/index.js +2 -12
- package/dist/figma-api/text/index.js.map +1 -1
- package/dist/figma-api/variables/bindings.js +1 -1
- package/dist/figma-api/variables/variable.d.ts.map +1 -1
- package/dist/figma-api/variables/variable.js +2 -2
- package/dist/figma-api/variables/variable.js.map +1 -1
- package/dist/geometry/figma.d.ts +6 -1
- package/dist/geometry/figma.d.ts.map +1 -1
- package/dist/geometry/figma.js +8 -1
- package/dist/geometry/figma.js.map +1 -1
- package/dist/geometry/index.d.ts +2 -2
- package/dist/geometry/index.js +2 -2
- package/dist/icons/api.d.ts +3 -2
- package/dist/icons/api.d.ts.map +1 -1
- package/dist/icons/api.js +12 -12
- package/dist/icons/api.js.map +1 -1
- package/dist/icons/provider.d.ts +4 -3
- package/dist/icons/provider.d.ts.map +1 -1
- package/dist/icons/provider.js +6 -13
- package/dist/icons/provider.js.map +1 -1
- package/dist/icons/schema.d.ts +33 -1
- package/dist/icons/schema.d.ts.map +1 -1
- package/dist/icons/schema.js +30 -1
- package/dist/icons/schema.js.map +1 -1
- package/dist/icons/svg/presentation.d.ts +8 -1
- package/dist/icons/svg/presentation.d.ts.map +1 -1
- package/dist/icons/svg/presentation.js +21 -3
- package/dist/icons/svg/presentation.js.map +1 -1
- package/dist/icons/svg/text.js +1 -1
- package/dist/icons/svg/text.js.map +1 -1
- package/dist/icons/svg.d.ts +8 -3
- package/dist/icons/svg.d.ts.map +1 -1
- package/dist/icons/svg.js +15 -13
- package/dist/icons/svg.js.map +1 -1
- package/dist/icons/types.d.ts +1 -19
- package/dist/icons/types.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/io/formats/design-tokens/css/read.js +1 -1
- package/dist/io/formats/design-tokens/decode.js +1 -1
- package/dist/io/formats/design-tokens/plan/index.js +4 -2
- package/dist/io/formats/design-tokens/plan/index.js.map +1 -1
- package/dist/io/formats/design-tokens/plan/styles.d.ts +9 -1
- package/dist/io/formats/design-tokens/plan/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/plan/styles.js +23 -3
- package/dist/io/formats/design-tokens/plan/styles.js.map +1 -1
- package/dist/io/formats/design-tokens/styles.d.ts +9 -1
- package/dist/io/formats/design-tokens/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/styles.js +41 -4
- package/dist/io/formats/design-tokens/styles.js.map +1 -1
- package/dist/io/formats/design-tokens/types.d.ts +5 -0
- package/dist/io/formats/design-tokens/types.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/types.js +1 -0
- package/dist/io/formats/design-tokens/types.js.map +1 -1
- package/dist/io/formats/fig/export/setup.d.ts.map +1 -1
- package/dist/io/formats/fig/export/setup.js +8 -4
- package/dist/io/formats/fig/export/setup.js.map +1 -1
- package/dist/io/formats/fig/export/variables.d.ts.map +1 -1
- package/dist/io/formats/fig/export/variables.js +2 -2
- package/dist/io/formats/fig/export/variables.js.map +1 -1
- package/dist/io/formats/fig/index.d.ts +2 -2
- package/dist/io/formats/fig/index.js +2 -2
- package/dist/io/formats/fig/read.d.ts +9 -2
- package/dist/io/formats/fig/read.d.ts.map +1 -1
- package/dist/io/formats/fig/read.js +44 -20
- package/dist/io/formats/fig/read.js.map +1 -1
- package/dist/io/formats/html/index.d.ts.map +1 -1
- package/dist/io/formats/html/index.js +2 -6
- package/dist/io/formats/html/index.js.map +1 -1
- package/dist/io/formats/pdf/dom.d.ts.map +1 -1
- package/dist/io/formats/pdf/dom.js +65 -1
- package/dist/io/formats/pdf/dom.js.map +1 -1
- package/dist/io/formats/pdf/prepare.js +1 -1
- package/dist/io/formats/pen/fonts.d.ts +14 -0
- package/dist/io/formats/pen/fonts.d.ts.map +1 -0
- package/dist/io/formats/pen/fonts.js +39 -0
- package/dist/io/formats/pen/fonts.js.map +1 -0
- package/dist/io/formats/pen/index.d.ts.map +1 -1
- package/dist/io/formats/pen/index.js +25 -6
- package/dist/io/formats/pen/index.js.map +1 -1
- package/dist/io/formats/raster/headless.d.ts +2 -2
- package/dist/io/formats/raster/headless.d.ts.map +1 -1
- package/dist/io/formats/raster/headless.js +24 -13
- package/dist/io/formats/raster/headless.js.map +1 -1
- package/dist/io/formats/raster/index.d.ts +2 -2
- package/dist/io/formats/raster/index.js +2 -2
- package/dist/io/formats/raster/render.d.ts +7 -1
- package/dist/io/formats/raster/render.d.ts.map +1 -1
- package/dist/io/formats/raster/render.js +40 -6
- package/dist/io/formats/raster/render.js.map +1 -1
- package/dist/io/formats/svg/export.d.ts.map +1 -1
- package/dist/io/formats/svg/export.js +28 -24
- package/dist/io/formats/svg/export.js.map +1 -1
- package/dist/io/formats/svg/paths.d.ts +8 -2
- package/dist/io/formats/svg/paths.d.ts.map +1 -1
- package/dist/io/formats/svg/paths.js +11 -3
- package/dist/io/formats/svg/paths.js.map +1 -1
- package/dist/io/formats/svg/strokes.d.ts.map +1 -1
- package/dist/io/formats/svg/strokes.js +2 -5
- package/dist/io/formats/svg/strokes.js.map +1 -1
- package/dist/io/formats/svg/text/export.d.ts.map +1 -1
- package/dist/io/formats/svg/text/export.js +19 -1
- package/dist/io/formats/svg/text/export.js.map +1 -1
- package/dist/io/formats/svg/text/import.d.ts.map +1 -1
- package/dist/io/formats/svg/text/import.js +2 -1
- package/dist/io/formats/svg/text/import.js.map +1 -1
- package/dist/io/subgraph.d.ts.map +1 -1
- package/dist/io/subgraph.js +5 -2
- package/dist/io/subgraph.js.map +1 -1
- package/dist/kiwi/fig/population/client.d.ts.map +1 -1
- package/dist/kiwi/fig/population/client.js +63 -45
- package/dist/kiwi/fig/population/client.js.map +1 -1
- package/dist/kiwi/fig/population/delta.d.ts +34 -3
- package/dist/kiwi/fig/population/delta.d.ts.map +1 -1
- package/dist/kiwi/fig/population/delta.js +99 -16
- package/dist/kiwi/fig/population/delta.js.map +1 -1
- package/dist/kiwi/fig/population/edits.d.ts +51 -0
- package/dist/kiwi/fig/population/edits.d.ts.map +1 -0
- package/dist/kiwi/fig/population/edits.js +169 -0
- package/dist/kiwi/fig/population/edits.js.map +1 -0
- package/dist/kiwi/fig/session/archive/access.d.ts +3 -0
- package/dist/kiwi/fig/session/archive/access.d.ts.map +1 -1
- package/dist/kiwi/fig/session/archive/access.js +8 -1
- package/dist/kiwi/fig/session/archive/access.js.map +1 -1
- package/dist/kiwi/fig/session/archive/changes.d.ts +2 -1
- package/dist/kiwi/fig/session/archive/changes.d.ts.map +1 -1
- package/dist/kiwi/fig/session/archive/changes.js +12 -5
- package/dist/kiwi/fig/session/archive/changes.js.map +1 -1
- package/dist/kiwi/fig/session/document-state.d.ts +7 -1
- package/dist/kiwi/fig/session/document-state.d.ts.map +1 -1
- package/dist/kiwi/fig/session/document-state.js +16 -2
- package/dist/kiwi/fig/session/document-state.js.map +1 -1
- package/dist/kiwi/fig/session/protocol.d.ts +31 -3
- package/dist/kiwi/fig/session/protocol.d.ts.map +1 -1
- package/dist/kiwi/fig/session/worker.js +33 -8
- package/dist/kiwi/fig/session/worker.js.map +1 -1
- package/dist/layout/apply.d.ts +6 -1
- package/dist/layout/apply.d.ts.map +1 -1
- package/dist/layout/apply.js +39 -14
- package/dist/layout/apply.js.map +1 -1
- package/dist/layout/arrange/boxes.d.ts.map +1 -1
- package/dist/layout/arrange/boxes.js +31 -0
- package/dist/layout/arrange/boxes.js.map +1 -1
- package/dist/layout/flow-edges.d.ts +26 -0
- package/dist/layout/flow-edges.d.ts.map +1 -0
- package/dist/layout/flow-edges.js +105 -0
- package/dist/layout/flow-edges.js.map +1 -0
- package/dist/layout/grid.d.ts.map +1 -1
- package/dist/layout/grid.js +9 -5
- package/dist/layout/grid.js.map +1 -1
- package/dist/layout/text-auto-resize.d.ts.map +1 -1
- package/dist/layout/text-auto-resize.js +9 -4
- package/dist/layout/text-auto-resize.js.map +1 -1
- package/dist/layout/text-measurement.d.ts +15 -1
- package/dist/layout/text-measurement.d.ts.map +1 -1
- package/dist/layout/text-measurement.js +40 -4
- package/dist/layout/text-measurement.js.map +1 -1
- package/dist/layout/variables.d.ts +1 -1
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +35 -35
- package/dist/layout.js.map +1 -1
- package/dist/library/asset-keys.d.ts +3 -2
- package/dist/library/asset-keys.d.ts.map +1 -1
- package/dist/library/asset-keys.js +4 -3
- package/dist/library/asset-keys.js.map +1 -1
- package/dist/library/copied-references.d.ts +8 -3
- package/dist/library/copied-references.d.ts.map +1 -1
- package/dist/library/copied-references.js +15 -5
- package/dist/library/copied-references.js.map +1 -1
- package/dist/library/materialize.js +1 -1
- package/dist/library/materialize.js.map +1 -1
- package/dist/library/schema.js.map +1 -1
- package/dist/library/snapshot.d.ts.map +1 -1
- package/dist/library/snapshot.js +10 -2
- package/dist/library/snapshot.js.map +1 -1
- package/dist/pairdraw-api/variables.d.ts.map +1 -1
- package/dist/pairdraw-api/variables.js +0 -2
- package/dist/pairdraw-api/variables.js.map +1 -1
- package/dist/profiler/hud-controller.d.ts +4 -3
- package/dist/profiler/hud-controller.d.ts.map +1 -1
- package/dist/profiler/hud-controller.js +7 -5
- package/dist/profiler/hud-controller.js.map +1 -1
- package/dist/profiler/hud-renderer.d.ts +5 -2
- package/dist/profiler/hud-renderer.d.ts.map +1 -1
- package/dist/profiler/hud-renderer.js +8 -5
- package/dist/profiler/hud-renderer.js.map +1 -1
- package/dist/profiler/render-profiler.d.ts +3 -2
- package/dist/profiler/render-profiler.d.ts.map +1 -1
- package/dist/profiler/render-profiler.js +3 -2
- package/dist/profiler/render-profiler.js.map +1 -1
- package/dist/text/character-style.d.ts +11 -1
- package/dist/text/character-style.d.ts.map +1 -1
- package/dist/text/character-style.js +27 -5
- package/dist/text/character-style.js.map +1 -1
- package/dist/text/coverage.d.ts.map +1 -1
- package/dist/text/coverage.js +15 -16
- package/dist/text/coverage.js.map +1 -1
- package/dist/text/editor.d.ts.map +1 -1
- package/dist/text/editor.js +3 -8
- package/dist/text/editor.js.map +1 -1
- package/dist/text/fallbacks.d.ts +19 -2
- package/dist/text/fallbacks.d.ts.map +1 -1
- package/dist/text/fallbacks.js +63 -12
- package/dist/text/fallbacks.js.map +1 -1
- package/dist/text/font/catalog.d.ts +4 -0
- package/dist/text/font/catalog.d.ts.map +1 -1
- package/dist/text/font/catalog.js +8 -0
- package/dist/text/font/catalog.js.map +1 -1
- package/dist/text/font/collection.d.ts +13 -0
- package/dist/text/font/collection.d.ts.map +1 -0
- package/dist/text/font/collection.js +51 -0
- package/dist/text/font/collection.js.map +1 -0
- package/dist/text/font/faces.d.ts +2 -1
- package/dist/text/font/faces.d.ts.map +1 -1
- package/dist/text/font/faces.js +9 -5
- package/dist/text/font/faces.js.map +1 -1
- package/dist/text/font/glyphs.d.ts +14 -3
- package/dist/text/font/glyphs.d.ts.map +1 -1
- package/dist/text/font/glyphs.js +22 -5
- package/dist/text/font/glyphs.js.map +1 -1
- package/dist/text/font/local.js +2 -2
- package/dist/text/font/local.js.map +1 -1
- package/dist/text/font/manager.d.ts +36 -0
- package/dist/text/font/manager.d.ts.map +1 -1
- package/dist/text/font/manager.js +139 -19
- package/dist/text/font/manager.js.map +1 -1
- package/dist/text/font/style.d.ts +7 -2
- package/dist/text/font/style.d.ts.map +1 -1
- package/dist/text/font/style.js +31 -3
- package/dist/text/font/style.js.map +1 -1
- package/dist/text/index.d.ts +5 -4
- package/dist/text/index.js +5 -4
- package/dist/text/outlines.d.ts.map +1 -1
- package/dist/text/outlines.js +70 -70
- package/dist/text/outlines.js.map +1 -1
- package/dist/text/prepare.d.ts.map +1 -1
- package/dist/text/prepare.js +7 -1
- package/dist/text/prepare.js.map +1 -1
- package/dist/text/style-runs.d.ts +14 -2
- package/dist/text/style-runs.d.ts.map +1 -1
- package/dist/text/style-runs.js +22 -14
- package/dist/text/style-runs.js.map +1 -1
- package/dist/tools/analyze/overlaps/helpers.d.ts.map +1 -1
- package/dist/tools/analyze/overlaps/helpers.js +9 -1
- package/dist/tools/analyze/overlaps/helpers.js.map +1 -1
- package/dist/tools/analyze/overlaps/index.d.ts.map +1 -1
- package/dist/tools/analyze/overlaps/index.js +27 -5
- package/dist/tools/analyze/overlaps/index.js.map +1 -1
- package/dist/tools/codegen/component-map.js +3 -3
- package/dist/tools/codegen/component-map.js.map +1 -1
- package/dist/tools/create/basic.d.ts.map +1 -1
- package/dist/tools/create/basic.js +5 -4
- package/dist/tools/create/basic.js.map +1 -1
- package/dist/tools/create/html.d.ts.map +1 -1
- package/dist/tools/create/html.js +4 -2
- package/dist/tools/create/html.js.map +1 -1
- package/dist/tools/create/icons.d.ts.map +1 -1
- package/dist/tools/create/icons.js +3 -1
- package/dist/tools/create/icons.js.map +1 -1
- package/dist/tools/create/mermaid.d.ts.map +1 -1
- package/dist/tools/create/mermaid.js +2 -0
- package/dist/tools/create/mermaid.js.map +1 -1
- package/dist/tools/create/render.d.ts.map +1 -1
- package/dist/tools/create/render.js +2 -0
- package/dist/tools/create/render.js.map +1 -1
- package/dist/tools/create/script.js +3 -1
- package/dist/tools/create/script.js.map +1 -1
- package/dist/tools/create/svg.d.ts.map +1 -1
- package/dist/tools/create/svg.js +4 -1
- package/dist/tools/create/svg.js.map +1 -1
- package/dist/tools/create/vector.d.ts.map +1 -1
- package/dist/tools/create/vector.js +4 -4
- package/dist/tools/create/vector.js.map +1 -1
- package/dist/tools/image-ai/apply.js +1 -1
- package/dist/tools/image-ai/generate.d.ts.map +1 -1
- package/dist/tools/image-ai/generate.js +3 -0
- package/dist/tools/image-ai/generate.js.map +1 -1
- package/dist/tools/modify/matching.js +1 -1
- package/dist/tools/modify/reactions.d.ts +6 -0
- package/dist/tools/modify/reactions.d.ts.map +1 -0
- package/dist/tools/modify/reactions.js +35 -0
- package/dist/tools/modify/reactions.js.map +1 -0
- package/dist/tools/modify.d.ts +2 -1
- package/dist/tools/modify.js +2 -1
- package/dist/tools/read/components.js +20 -22
- package/dist/tools/read/components.js.map +1 -1
- package/dist/tools/read/fonts.js +1 -1
- package/dist/tools/read/fonts.js.map +1 -1
- package/dist/tools/read/libraries.d.ts.map +1 -1
- package/dist/tools/read/libraries.js +2 -0
- package/dist/tools/read/libraries.js.map +1 -1
- package/dist/tools/read/nodes.d.ts.map +1 -1
- package/dist/tools/read/nodes.js +38 -16
- package/dist/tools/read/nodes.js.map +1 -1
- package/dist/tools/read/pages.d.ts.map +1 -1
- package/dist/tools/read/pages.js +4 -3
- package/dist/tools/read/pages.js.map +1 -1
- package/dist/tools/read/query.js +1 -0
- package/dist/tools/read/query.js.map +1 -1
- package/dist/tools/read/reactions.d.ts +6 -0
- package/dist/tools/read/reactions.d.ts.map +1 -0
- package/dist/tools/read/reactions.js +24 -0
- package/dist/tools/read/reactions.js.map +1 -0
- package/dist/tools/read/space.js +1 -1
- package/dist/tools/read.d.ts +2 -1
- package/dist/tools/read.js +2 -1
- package/dist/tools/registry/extended.d.ts.map +1 -1
- package/dist/tools/registry/extended.js +4 -0
- package/dist/tools/registry/extended.js.map +1 -1
- package/dist/tools/schema.d.ts +6 -0
- package/dist/tools/schema.d.ts.map +1 -1
- package/dist/tools/schema.js +53 -9
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/stock-photo/apply.js +8 -9
- package/dist/tools/stock-photo/apply.js.map +1 -1
- package/dist/tools/structure/batch.d.ts.map +1 -1
- package/dist/tools/structure/batch.js +85 -90
- package/dist/tools/structure/batch.js.map +1 -1
- package/dist/vector/fill-geometry.d.ts +4 -1
- package/dist/vector/fill-geometry.d.ts.map +1 -1
- package/dist/vector/fill-geometry.js +8 -5
- package/dist/vector/fill-geometry.js.map +1 -1
- package/dist/vector/index.js +1 -1
- package/dist/vector/index.js.map +1 -1
- package/dist/vector/path-helpers.d.ts +1 -1
- package/dist/vector/path-helpers.d.ts.map +1 -1
- package/dist/vector/path-helpers.js +24 -7
- package/dist/vector/path-helpers.js.map +1 -1
- package/dist/vector/placement.js +1 -1
- package/dist/vector/placement.js.map +1 -1
- package/dist/vector/vectorize/preprocess.js +1 -1
- package/dist/vector/vectorize/preprocess.js.map +1 -1
- package/package.json +10 -10
- package/src/canvas/effects.ts +29 -33
- package/src/canvas/labels/hit-test.ts +6 -2
- package/src/canvas/labels/paragraph-cache.ts +2 -1
- package/src/canvas/labels/selection.ts +3 -3
- package/src/canvas/node-edit-overlay.ts +3 -2
- package/src/canvas/overlays/index.ts +0 -1
- package/src/canvas/overlays/selection.ts +4 -52
- package/src/canvas/region-hatch.ts +7 -2
- package/src/canvas/renderer/colors.ts +41 -26
- package/src/canvas/renderer/font-waiters.ts +25 -0
- package/src/canvas/renderer/fonts.ts +40 -17
- package/src/canvas/renderer/lifecycle.ts +8 -10
- package/src/canvas/renderer/methods.ts +9 -13
- package/src/canvas/renderer/paints.ts +0 -10
- package/src/canvas/renderer/pipeline.ts +29 -3
- package/src/canvas/renderer/retained-backing.ts +4 -4
- package/src/canvas/renderer/state.ts +1 -1
- package/src/canvas/renderer/tiles/controller.ts +8 -0
- package/src/canvas/renderer/tiles/surface-pool.ts +1 -1
- package/src/canvas/renderer/visual-bounds.ts +7 -6
- package/src/canvas/renderer.ts +39 -11
- package/src/canvas/rulers.ts +55 -26
- package/src/canvas/scene.ts +37 -16
- package/src/canvas/shadows/shape.ts +1 -1
- package/src/canvas/shadows/silhouette.ts +4 -2
- package/src/canvas/shadows.ts +4 -2
- package/src/canvas/text/derived.ts +0 -9
- package/src/canvas/text/emoji/raster.ts +14 -10
- package/src/canvas/text/font-families.ts +6 -0
- package/src/canvas/text/index.ts +0 -8
- package/src/canvas/text/layout/build.ts +35 -18
- package/src/canvas/text/layout/index.ts +15 -6
- package/src/canvas/text/layout/lines.ts +10 -4
- package/src/canvas/text/paragraph/index.ts +17 -8
- package/src/canvas/text/paragraph/inputs.ts +4 -2
- package/src/canvas/text/shape.ts +20 -31
- package/src/constants.ts +6 -1
- package/src/editor/bridges/clipboard.ts +1 -0
- package/src/editor/bridges/components.ts +2 -0
- package/src/editor/bridges/frames.ts +6 -4
- package/src/editor/bridges/structure.ts +1 -0
- package/src/editor/clipboard/detach.ts +3 -3
- package/src/editor/clipboard/paste/target.ts +2 -2
- package/src/editor/clipboard/snapshot.ts +7 -0
- package/src/editor/clipboard/variables.ts +20 -0
- package/src/editor/clipboard.ts +133 -14
- package/src/editor/component-sync.ts +28 -7
- package/src/editor/components/authoring/text-edit.ts +15 -2
- package/src/editor/components/authoring/visibility-edit.ts +11 -3
- package/src/editor/components/instances.ts +61 -11
- package/src/editor/components/properties.ts +10 -0
- package/src/editor/components/slots/authoring.ts +4 -1
- package/src/editor/create.ts +58 -8
- package/src/editor/guides.ts +27 -12
- package/src/editor/history/document-change.ts +115 -7
- package/src/editor/history/edit.ts +62 -14
- package/src/editor/history/position.ts +1 -4
- package/src/editor/history/sources.ts +25 -0
- package/src/editor/index.ts +3 -1
- package/src/editor/layout-mode.ts +20 -1
- package/src/editor/node-preview.ts +44 -8
- package/src/editor/nodes.ts +52 -12
- package/src/editor/nudge.ts +16 -2
- package/src/editor/pages.ts +100 -17
- package/src/editor/play/states.ts +0 -7
- package/src/editor/read-only/actions.ts +4 -0
- package/src/editor/selection/hit-test.ts +37 -4
- package/src/editor/shapes/pen.ts +6 -3
- package/src/editor/shapes.ts +2 -1
- package/src/editor/structure/auto-layout-wrap.ts +26 -0
- package/src/editor/structure/group/bounds.ts +22 -4
- package/src/editor/structure/rename.ts +2 -6
- package/src/editor/structure/reorder.ts +26 -8
- package/src/editor/structure.ts +88 -24
- package/src/editor/text/hyperlink.ts +2 -1
- package/src/editor/text/name.ts +51 -15
- package/src/editor/text/pending-layout.ts +42 -4
- package/src/editor/text/selection-style.ts +17 -3
- package/src/editor/text.ts +86 -4
- package/src/editor/types.ts +19 -0
- package/src/editor/undo.ts +21 -2
- package/src/editor/variable-bindings.ts +22 -2
- package/src/editor/variables.ts +10 -6
- package/src/editor/viewport.ts +55 -21
- package/src/editor/views/actions.ts +17 -7
- package/src/editor/views/present.ts +20 -11
- package/src/editor/views/types.ts +11 -5
- package/src/figma-api/accessor-utils.ts +4 -1
- package/src/figma-api/accessors/basic.ts +54 -18
- package/src/figma-api/accessors/layout.ts +46 -7
- package/src/figma-api/accessors/reactions.ts +29 -0
- package/src/figma-api/accessors/strokes.ts +28 -8
- package/src/figma-api/accessors/text/index.ts +4 -0
- package/src/figma-api/accessors/vector.ts +3 -1
- package/src/figma-api/accessors/visual.ts +25 -28
- package/src/figma-api/components.ts +9 -7
- package/src/figma-api/finite.ts +102 -0
- package/src/figma-api/fonts/list.ts +24 -0
- package/src/figma-api/index.ts +82 -12
- package/src/figma-api/overrides.ts +1 -1
- package/src/figma-api/pending-layout.ts +50 -1
- package/src/figma-api/pending-sync.ts +61 -0
- package/src/figma-api/proxy.ts +35 -2
- package/src/figma-api/reactions.ts +212 -0
- package/src/figma-api/render-bounds.ts +13 -4
- package/src/figma-api/serialization.ts +2 -2
- package/src/figma-api/slots.ts +12 -3
- package/src/figma-api/strokes.ts +16 -12
- package/src/figma-api/text/index.ts +9 -15
- package/src/figma-api/variables/variable.ts +3 -2
- package/src/geometry/figma.ts +9 -0
- package/src/geometry/index.ts +1 -0
- package/src/global.d.ts +6 -0
- package/src/icons/api.ts +27 -16
- package/src/icons/provider.ts +9 -20
- package/src/icons/schema.ts +31 -0
- package/src/icons/svg/presentation.ts +27 -3
- package/src/icons/svg/text.ts +1 -1
- package/src/icons/svg.ts +21 -19
- package/src/icons/types.ts +0 -14
- package/src/io/formats/design-tokens/plan/index.ts +7 -1
- package/src/io/formats/design-tokens/plan/styles.ts +40 -4
- package/src/io/formats/design-tokens/styles.ts +60 -3
- package/src/io/formats/design-tokens/types.ts +3 -0
- package/src/io/formats/fig/export/setup.ts +16 -14
- package/src/io/formats/fig/export/variables.ts +7 -8
- package/src/io/formats/fig/index.ts +1 -0
- package/src/io/formats/fig/read.ts +66 -23
- package/src/io/formats/html/index.ts +2 -6
- package/src/io/formats/pdf/dom.ts +96 -3
- package/src/io/formats/pen/fonts.ts +45 -0
- package/src/io/formats/pen/index.ts +30 -6
- package/src/io/formats/raster/headless.ts +31 -12
- package/src/io/formats/raster/index.ts +3 -0
- package/src/io/formats/raster/render.ts +62 -6
- package/src/io/formats/svg/export.ts +24 -25
- package/src/io/formats/svg/paths.ts +11 -2
- package/src/io/formats/svg/strokes.ts +8 -2
- package/src/io/formats/svg/text/export.ts +23 -0
- package/src/io/formats/svg/text/import.ts +2 -1
- package/src/io/subgraph.ts +3 -1
- package/src/kiwi/fig/population/client.ts +77 -43
- package/src/kiwi/fig/population/delta.ts +141 -18
- package/src/kiwi/fig/population/edits.ts +235 -0
- package/src/kiwi/fig/session/archive/access.ts +15 -0
- package/src/kiwi/fig/session/archive/changes.ts +27 -6
- package/src/kiwi/fig/session/document-state.ts +23 -1
- package/src/kiwi/fig/session/protocol.ts +26 -1
- package/src/kiwi/fig/session/worker.ts +38 -11
- package/src/layout/apply.ts +52 -10
- package/src/layout/arrange/boxes.ts +36 -0
- package/src/layout/flow-edges.ts +139 -0
- package/src/layout/grid.ts +14 -4
- package/src/layout/text-auto-resize.ts +13 -4
- package/src/layout/text-measurement.ts +46 -3
- package/src/layout.ts +60 -66
- package/src/library/asset-keys.ts +4 -3
- package/src/library/copied-references.ts +29 -5
- package/src/library/materialize.ts +1 -1
- package/src/library/schema.ts +1 -1
- package/src/library/snapshot.ts +11 -2
- package/src/pairdraw-api/variables.ts +1 -3
- package/src/profiler/hud-controller.ts +8 -6
- package/src/profiler/hud-renderer.ts +9 -6
- package/src/profiler/render-profiler.ts +4 -3
- package/src/text/character-style.ts +29 -9
- package/src/text/coverage.ts +17 -18
- package/src/text/editor.ts +3 -8
- package/src/text/fallbacks.ts +82 -15
- package/src/text/font/catalog.ts +10 -0
- package/src/text/font/collection.ts +60 -0
- package/src/text/font/faces.ts +9 -5
- package/src/text/font/glyphs.ts +29 -4
- package/src/text/font/local.ts +2 -2
- package/src/text/font/manager.ts +170 -32
- package/src/text/font/style.ts +52 -3
- package/src/text/index.ts +1 -0
- package/src/text/outlines.ts +105 -89
- package/src/text/prepare.ts +17 -0
- package/src/text/style-runs.ts +43 -16
- package/src/tools/analyze/overlaps/helpers.ts +18 -1
- package/src/tools/analyze/overlaps/index.ts +37 -6
- package/src/tools/codegen/component-map.ts +3 -3
- package/src/tools/create/basic.ts +6 -4
- package/src/tools/create/html.ts +3 -1
- package/src/tools/create/icons.ts +3 -1
- package/src/tools/create/mermaid.ts +2 -0
- package/src/tools/create/render.ts +2 -0
- package/src/tools/create/script.ts +5 -1
- package/src/tools/create/svg.ts +4 -1
- package/src/tools/create/vector.ts +4 -4
- package/src/tools/image-ai/generate.ts +3 -0
- package/src/tools/modify/reactions.ts +40 -0
- package/src/tools/modify.ts +1 -0
- package/src/tools/read/components.ts +28 -25
- package/src/tools/read/fonts.ts +1 -1
- package/src/tools/read/libraries.ts +3 -0
- package/src/tools/read/nodes.ts +47 -17
- package/src/tools/read/pages.ts +7 -4
- package/src/tools/read/query.ts +2 -0
- package/src/tools/read/reactions.ts +21 -0
- package/src/tools/read.ts +1 -0
- package/src/tools/registry/extended.ts +4 -0
- package/src/tools/schema.ts +68 -12
- package/src/tools/stock-photo/apply.ts +17 -5
- package/src/tools/structure/batch.ts +82 -101
- package/src/vector/fill-geometry.ts +11 -5
- package/src/vector/index.ts +1 -1
- package/src/vector/path-helpers.ts +34 -8
- package/src/vector/placement.ts +1 -1
- package/src/vector/vectorize/preprocess.ts +1 -1
package/src/editor/clipboard.ts
CHANGED
|
@@ -3,13 +3,15 @@ import { uniq } from 'es-toolkit'
|
|
|
3
3
|
import { parseFigmaClipboard } from '@pairdraw/fig/clipboard'
|
|
4
4
|
import { CommittedGraphEventError, type SceneNode } from '@pairdraw/scene-graph'
|
|
5
5
|
import { attachedConnectors } from '@pairdraw/scene-graph/connectors'
|
|
6
|
-
import { getAxisAlignedBoundsInParent } from '@pairdraw/scene-graph/coordinate'
|
|
7
|
-
import { cycleSafeParent } from '@pairdraw/scene-graph/instances'
|
|
6
|
+
import { getAxisAlignedBoundsInParent, getNodeLocalMatrix } from '@pairdraw/scene-graph/coordinate'
|
|
7
|
+
import { cycleSafeParent, recordInstanceOverride } from '@pairdraw/scene-graph/instances'
|
|
8
8
|
import type { Rect, Vector } from '@pairdraw/scene-graph/primitives'
|
|
9
|
+
import { slotPropertyId } from '@pairdraw/scene-graph/slots'
|
|
10
|
+
import { keepPastedBoundPaints, type AppliedBoundPaints } from '@pairdraw/scene-graph/variables'
|
|
9
11
|
|
|
10
12
|
import { parsePairdrawClipboard } from '#core/clipboard'
|
|
11
13
|
import { prepareClipboardImport } from '#core/clipboard/fig-import'
|
|
12
|
-
import { computeAllLayouts } from '#core/layout'
|
|
14
|
+
import { computeAllLayouts, layoutAuthoredNodes } from '#core/layout'
|
|
13
15
|
import { reconcileVariableLayouts } from '#core/layout/variables'
|
|
14
16
|
|
|
15
17
|
import { createClipboardAssetActions } from './clipboard/assets'
|
|
@@ -36,6 +38,8 @@ import { createStyledPasteActions } from './clipboard/styled'
|
|
|
36
38
|
import { replaceableInstanceLayers, replaceInstanceLayersWith } from './components/replace'
|
|
37
39
|
import { acceptsChildren, prepareSlotEdits } from './components/slots'
|
|
38
40
|
import { collectSubtrees, restoreSubtree, snapshotSubtree } from './history/subtree'
|
|
41
|
+
import { newLayerDefaults } from './shapes/defaults'
|
|
42
|
+
import { fitEnclosingGroupsWithUndo } from './structure/group/bounds'
|
|
39
43
|
import { loadBoundFonts } from './text/bound-fonts'
|
|
40
44
|
import type { EditorContext } from './types'
|
|
41
45
|
|
|
@@ -74,6 +78,11 @@ export function duplicateNode(
|
|
|
74
78
|
|
|
75
79
|
export function createClipboardActions(ctx: EditorContext) {
|
|
76
80
|
function duplicateSelected(selectedNodes: SceneNode[]) {
|
|
81
|
+
// One undo step for the copies and any slot they claim.
|
|
82
|
+
ctx.undo.runBatch('Duplicate', () => duplicateLayers(selectedNodes))
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function duplicateLayers(selectedNodes: SceneNode[]) {
|
|
77
86
|
const prevSelection = new Set(ctx.state.selectedIds)
|
|
78
87
|
const selectedSet = new Set(selectedNodes.map((n) => n.id))
|
|
79
88
|
const stackIndex = (node: SceneNode) =>
|
|
@@ -121,9 +130,19 @@ export function createClipboardActions(ctx: EditorContext) {
|
|
|
121
130
|
const stack = () => {
|
|
122
131
|
for (const { id, parentId, index } of stacking) ctx.graph.insertChildAt(id, parentId, index)
|
|
123
132
|
}
|
|
133
|
+
// Auto layout parents lay out again, so a copy joins the flow and a hugging parent resizes.
|
|
134
|
+
// Undo and redo do it too, because neither stores the parent's layout. Other parents, such
|
|
135
|
+
// as the page, are skipped: laying out a page reaches every frame on it.
|
|
136
|
+
const layoutParentIds = [...new Set(parents)].filter(
|
|
137
|
+
(id) => ctx.graph.getNode(id)?.layoutMode !== 'NONE'
|
|
138
|
+
)
|
|
139
|
+
const relayoutParents = () => {
|
|
140
|
+
for (const parentId of layoutParentIds) ctx.runLayoutForNode(parentId)
|
|
141
|
+
}
|
|
124
142
|
stack()
|
|
125
143
|
|
|
126
144
|
if (newRootIds.length > 0) {
|
|
145
|
+
relayoutParents()
|
|
127
146
|
ctx.setSelectedIds(new Set(newRootIds))
|
|
128
147
|
ctx.undo.push({
|
|
129
148
|
label: 'Duplicate',
|
|
@@ -135,10 +154,12 @@ export function createClipboardActions(ctx: EditorContext) {
|
|
|
135
154
|
restoreSubtree(ctx.graph, snapshot, parentId, allSnapshots)
|
|
136
155
|
}
|
|
137
156
|
stack()
|
|
157
|
+
relayoutParents()
|
|
138
158
|
ctx.setSelectedIds(new Set(newRootIds))
|
|
139
159
|
},
|
|
140
160
|
inverse: () => {
|
|
141
161
|
for (const id of newRootIds.slice().reverse()) ctx.graph.deleteNode(id)
|
|
162
|
+
relayoutParents()
|
|
142
163
|
ctx.setSelectedIds(prevSelection)
|
|
143
164
|
}
|
|
144
165
|
})
|
|
@@ -190,6 +211,8 @@ export function createClipboardActions(ctx: EditorContext) {
|
|
|
190
211
|
dependencies.nodes,
|
|
191
212
|
snapshot.placement,
|
|
192
213
|
snapshot.images,
|
|
214
|
+
// Records from another document name its variables and modes, not the pasted ones.
|
|
215
|
+
snapshot.sourceRootId === ctx.graph.rootId ? snapshot.appliedBoundPaints : new Map(),
|
|
193
216
|
dependencies.componentDependencies,
|
|
194
217
|
cursorPos,
|
|
195
218
|
{ ...options, resolveBindings: dependencies.resolveBindings }
|
|
@@ -207,6 +230,7 @@ export function createClipboardActions(ctx: EditorContext) {
|
|
|
207
230
|
pairdraw.nodes,
|
|
208
231
|
clipboardPlacement(ctx.graph, pairdraw.nodes),
|
|
209
232
|
pairdraw.images,
|
|
233
|
+
new Map(),
|
|
210
234
|
[],
|
|
211
235
|
cursorPos,
|
|
212
236
|
options
|
|
@@ -238,6 +262,13 @@ export function createClipboardActions(ctx: EditorContext) {
|
|
|
238
262
|
if (created.length === 0) return null
|
|
239
263
|
|
|
240
264
|
if (replacementTargets.length > 0) {
|
|
265
|
+
// The clipboard holds each layer as drawn on its canvas, and the import keeps that as
|
|
266
|
+
// the layer's transform in the target's frame: turn it back, as the in-app paste does.
|
|
267
|
+
const copied = created.flatMap((id) => {
|
|
268
|
+
const node = ctx.graph.getNode(id)
|
|
269
|
+
return node ? [getNodeLocalMatrix(node)] : []
|
|
270
|
+
})
|
|
271
|
+
placementActions.keepCanvasTransforms(created, copied)
|
|
241
272
|
replaceTargetsWithCreated(ctx, created, replacementTargets, prevSelection, operation)
|
|
242
273
|
} else {
|
|
243
274
|
placementActions.placeForeignPaste(created, pasteTarget, cursorPos)
|
|
@@ -260,10 +291,52 @@ export function createClipboardActions(ctx: EditorContext) {
|
|
|
260
291
|
}
|
|
261
292
|
}
|
|
262
293
|
|
|
294
|
+
/** The name Figma gives pasted text: its first line, as the layer lists it. */
|
|
295
|
+
const textLayerName = (text: string) => {
|
|
296
|
+
const firstLine = text.split('\n')[0]?.trim() ?? ''
|
|
297
|
+
return firstLine.length > 64 ? `${firstLine.slice(0, 63)}…` : firstLine
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Paste plain text from another app as a text layer holding it, centred on the point and inside
|
|
302
|
+
* the selected frame, in one undo step; false when the text has nothing to show.
|
|
303
|
+
*/
|
|
304
|
+
async function pastePlainText(text: string, cx?: number, cy?: number): Promise<boolean> {
|
|
305
|
+
const content = text.replace(/\r\n?/g, '\n')
|
|
306
|
+
const name = textLayerName(content)
|
|
307
|
+
if (!name) return false
|
|
308
|
+
const previousSelection = new Set(ctx.state.selectedIds)
|
|
309
|
+
const parentId = resolvePasteTarget(ctx)
|
|
310
|
+
if (!prepareSlotEdits(ctx, [parentId])) return false
|
|
311
|
+
const node = ctx.graph.createNode('TEXT', parentId, {
|
|
312
|
+
...newLayerDefaults('TEXT', ctx.state.theme),
|
|
313
|
+
name,
|
|
314
|
+
text: content,
|
|
315
|
+
textAutoResize: 'WIDTH_AND_HEIGHT',
|
|
316
|
+
x: 0,
|
|
317
|
+
y: 0
|
|
318
|
+
})
|
|
319
|
+
// Measured with its font loaded, so it takes its content's size and centres on that.
|
|
320
|
+
await fontActions.loadFontsForNodes([node.id])
|
|
321
|
+
layoutAuthoredNodes(ctx.graph, [node.id])
|
|
322
|
+
const cursorPos = cx !== undefined && cy !== undefined ? { x: cx, y: cy } : undefined
|
|
323
|
+
placementActions.placeForeignPaste([node.id], parentId, cursorPos)
|
|
324
|
+
if (ctx.state.snappingPreferences.pixelGrid) {
|
|
325
|
+
const placed = ctx.graph.getNode(node.id)
|
|
326
|
+
if (placed)
|
|
327
|
+
ctx.graph.updateNode(node.id, { x: Math.round(placed.x), y: Math.round(placed.y) })
|
|
328
|
+
}
|
|
329
|
+
ctx.setSelectedIds(new Set([node.id]))
|
|
330
|
+
pushCreatedNodesUndo([node.id], previousSelection, 'Paste text')
|
|
331
|
+
ctx.requestRender()
|
|
332
|
+
return true
|
|
333
|
+
}
|
|
334
|
+
|
|
263
335
|
function pastePairdrawNodes(
|
|
264
336
|
nodes: Array<SceneNode & { children?: SceneNode[] }>,
|
|
265
337
|
placement: ClipboardPlacement,
|
|
266
338
|
images: Map<string, Uint8Array>,
|
|
339
|
+
applied: AppliedBoundPaints,
|
|
267
340
|
dependencies: Array<SceneNode & { children?: SceneNode[] }> = [],
|
|
268
341
|
cursorPos?: Vector,
|
|
269
342
|
options: PasteNodesOptions = {}
|
|
@@ -317,6 +390,7 @@ export function createClipboardActions(ctx: EditorContext) {
|
|
|
317
390
|
}
|
|
318
391
|
ctx.graph.updateNode(id, { componentId: componentId ?? node.componentId, instanceOverrides })
|
|
319
392
|
}
|
|
393
|
+
keepPastedBoundPaints(ctx.graph, copiedIds, applied)
|
|
320
394
|
// Variables of this document can give the layers other values than the copied ones.
|
|
321
395
|
if (options.resolveBindings) {
|
|
322
396
|
const subtrees = [...dependencyRootIds, ...created]
|
|
@@ -409,36 +483,69 @@ export function createClipboardActions(ctx: EditorContext) {
|
|
|
409
483
|
return acceptsChildren(ctx, node.parentId ?? ctx.state.currentPageId)
|
|
410
484
|
}
|
|
411
485
|
|
|
486
|
+
/**
|
|
487
|
+
* Whether the layer is one an instance mirrors from its component. A slot's contents are the
|
|
488
|
+
* document's own, placed in the instance, so they delete like any other layer.
|
|
489
|
+
*/
|
|
490
|
+
function insideInstance(id: string): boolean {
|
|
491
|
+
let parentId = ctx.graph.getNode(id)?.parentId ?? null
|
|
492
|
+
while (parentId) {
|
|
493
|
+
const parent = ctx.graph.getNode(parentId)
|
|
494
|
+
if (!parent) return false
|
|
495
|
+
if (parent.type === 'INSTANCE') return true
|
|
496
|
+
if (slotPropertyId(parent)) return false
|
|
497
|
+
parentId = parent.parentId
|
|
498
|
+
}
|
|
499
|
+
return false
|
|
500
|
+
}
|
|
501
|
+
|
|
412
502
|
function deleteLayers(nodeIds: Iterable<string>, nextSelection?: ReadonlySet<string>) {
|
|
413
|
-
|
|
503
|
+
// Deleting a component child would take it out of every instance, so inside an instance it
|
|
504
|
+
// is a hide instead, recorded as an override: Figma reopens the file with it still hidden.
|
|
505
|
+
const requested: string[] = []
|
|
506
|
+
const hidden: Array<{ id: string; visible: boolean }> = []
|
|
507
|
+
for (const id of nodeIds) {
|
|
508
|
+
const node = ctx.graph.getNode(id)
|
|
509
|
+
if (!node || node.locked) continue
|
|
510
|
+
// No parent takes children inside an instance, but hiding one is the delete Figma offers.
|
|
511
|
+
if (insideInstance(id)) {
|
|
512
|
+
if (node.visible) hidden.push({ id, visible: node.visible })
|
|
513
|
+
} else if (deletable(id)) requested.push(id)
|
|
514
|
+
}
|
|
515
|
+
const hideLayers = () => {
|
|
516
|
+
for (const { id } of hidden) {
|
|
517
|
+
ctx.graph.updateNode(id, { visible: false })
|
|
518
|
+
recordInstanceOverride(ctx.graph, id, ['visible'])
|
|
519
|
+
}
|
|
520
|
+
}
|
|
414
521
|
// Connectors go with a layer they attach to, as in FigJam; one that stays keeps them.
|
|
415
522
|
const attached = attachedConnectors(ctx.graph, requested).map((node) => node.id)
|
|
416
|
-
const
|
|
417
|
-
id: string
|
|
418
|
-
parentId: string
|
|
419
|
-
index: number
|
|
420
|
-
subtree: Map<string, SceneNode>
|
|
421
|
-
}> = []
|
|
523
|
+
const targets: Array<{ id: string; parentId: string; index: number }> = []
|
|
422
524
|
for (const id of uniq([...requested, ...attached])) {
|
|
423
525
|
const node = ctx.graph.getNode(id)
|
|
424
526
|
if (!node || !deletable(id)) continue
|
|
425
527
|
const parentId = node.parentId ?? ctx.state.currentPageId
|
|
426
528
|
const parent = ctx.graph.getNode(parentId)
|
|
427
529
|
const index = parent?.childIds.indexOf(id) ?? -1
|
|
428
|
-
|
|
530
|
+
targets.push({ id, parentId, index })
|
|
429
531
|
}
|
|
430
|
-
if (
|
|
532
|
+
if (targets.length === 0 && hidden.length === 0) return
|
|
431
533
|
prepareSlotEdits(
|
|
432
534
|
ctx,
|
|
433
|
-
|
|
535
|
+
targets.map((entry) => entry.parentId)
|
|
434
536
|
)
|
|
435
|
-
|
|
537
|
+
// The slot edits above may change what a layer's subtree holds, so it is captured once, after.
|
|
538
|
+
const entries = targets.map((entry) => ({
|
|
539
|
+
...entry,
|
|
540
|
+
subtree: snapshotSubtree(ctx.graph, entry.id)
|
|
541
|
+
}))
|
|
436
542
|
|
|
437
543
|
const relayoutParents = () => {
|
|
438
544
|
for (const parentId of new Set(entries.map((entry) => entry.parentId))) {
|
|
439
545
|
ctx.runLayoutForNode(parentId)
|
|
440
546
|
}
|
|
441
547
|
}
|
|
548
|
+
hideLayers()
|
|
442
549
|
|
|
443
550
|
const prevSelection = new Set(ctx.state.selectedIds)
|
|
444
551
|
for (const { id } of entries) ctx.graph.deleteNode(id)
|
|
@@ -450,15 +557,26 @@ export function createClipboardActions(ctx: EditorContext) {
|
|
|
450
557
|
label: 'Delete',
|
|
451
558
|
forward: () => {
|
|
452
559
|
for (const { id } of entries) ctx.graph.deleteNode(id)
|
|
560
|
+
hideLayers()
|
|
453
561
|
relayoutParents()
|
|
454
562
|
ctx.setSelectedIds(new Set(selectionAfter))
|
|
455
563
|
},
|
|
456
564
|
inverse: () => {
|
|
457
565
|
restoreDeletedEntries(ctx, entries)
|
|
566
|
+
for (const { id, visible } of hidden) {
|
|
567
|
+
ctx.graph.updateNode(id, { visible })
|
|
568
|
+
recordInstanceOverride(ctx.graph, id, ['visible'])
|
|
569
|
+
}
|
|
458
570
|
relayoutParents()
|
|
459
571
|
ctx.setSelectedIds(prevSelection)
|
|
460
572
|
}
|
|
461
573
|
})
|
|
574
|
+
// Groups shrink to the layers left in them, and one left empty goes, in the same undo step,
|
|
575
|
+
// which `deleteNodes` batches.
|
|
576
|
+
fitEnclosingGroupsWithUndo(
|
|
577
|
+
ctx,
|
|
578
|
+
entries.map((entry) => entry.parentId)
|
|
579
|
+
)
|
|
462
580
|
ctx.setSelectedIds(new Set(selectionAfter))
|
|
463
581
|
}
|
|
464
582
|
|
|
@@ -487,6 +605,7 @@ export function createClipboardActions(ctx: EditorContext) {
|
|
|
487
605
|
...copyActions,
|
|
488
606
|
pasteSnapshot,
|
|
489
607
|
pasteFromHTML,
|
|
608
|
+
pastePlainText,
|
|
490
609
|
warnMissingImages,
|
|
491
610
|
deleteNodes,
|
|
492
611
|
deleteSelected,
|
|
@@ -59,6 +59,20 @@ function affectedPageIds(
|
|
|
59
59
|
return pageIds
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Brings the instances of every component holding one of `ids` in line with it, inner components
|
|
64
|
+
* first, and returns those components. A removed layer is found through the parent it left.
|
|
65
|
+
*/
|
|
66
|
+
export function syncComponentsHolding(graph: SceneGraph, ids: Iterable<string>): Set<string> {
|
|
67
|
+
const componentIds = new Set<string>()
|
|
68
|
+
for (const id of ids) {
|
|
69
|
+
const component = graph.closest(id, isComponent)
|
|
70
|
+
if (component) componentIds.add(component.id)
|
|
71
|
+
}
|
|
72
|
+
graph.syncInstancesTogether(componentSyncOrder(graph, componentIds))
|
|
73
|
+
return componentIds
|
|
74
|
+
}
|
|
75
|
+
|
|
62
76
|
/**
|
|
63
77
|
* Brings the instances of the components that contain `editedIds` up to date with them, nested
|
|
64
78
|
* components first, and lays out the pages that changed. `editedIds` are the layers an edit
|
|
@@ -71,13 +85,8 @@ export function syncEditedComponents(
|
|
|
71
85
|
computeLayouts: ComputeLayouts = computeAllLayouts
|
|
72
86
|
): boolean {
|
|
73
87
|
const ids = [...editedIds]
|
|
74
|
-
const componentIds =
|
|
75
|
-
for (const id of ids) {
|
|
76
|
-
const component = graph.closest(id, isComponent)
|
|
77
|
-
if (component) componentIds.add(component.id)
|
|
78
|
-
}
|
|
88
|
+
const componentIds = syncComponentsHolding(graph, ids)
|
|
79
89
|
if (componentIds.size === 0) return false
|
|
80
|
-
graph.syncInstancesTogether(componentSyncOrder(graph, componentIds))
|
|
81
90
|
const pageIds = affectedPageIds(graph, ids, componentIds)
|
|
82
91
|
if (pageIds.size === 0) computeLayouts(graph)
|
|
83
92
|
else for (const pageId of pageIds) computeLayouts(graph, pageId)
|
|
@@ -99,6 +108,12 @@ export function createComponentSyncScheduler(
|
|
|
99
108
|
isFlushingComponentSync = true
|
|
100
109
|
try {
|
|
101
110
|
if (syncEditedComponents(getGraph(), ids, computeLayouts)) requestRender()
|
|
111
|
+
} catch (error) {
|
|
112
|
+
// A sync that throws leaves its edits unsynced; the next read tries them again rather
|
|
113
|
+
// than showing stale instance layers. The set was cleared at flush start and nothing can
|
|
114
|
+
// schedule during this synchronous sync, so the ids go straight back.
|
|
115
|
+
pendingComponentSync = ids
|
|
116
|
+
throw error
|
|
102
117
|
} finally {
|
|
103
118
|
isFlushingComponentSync = false
|
|
104
119
|
}
|
|
@@ -118,5 +133,11 @@ export function createComponentSyncScheduler(
|
|
|
118
133
|
pendingComponentSync.add(nodeId)
|
|
119
134
|
}
|
|
120
135
|
|
|
121
|
-
return {
|
|
136
|
+
return {
|
|
137
|
+
scheduleComponentSync,
|
|
138
|
+
/** Brings instances in line with the component edits scheduled so far, now. */
|
|
139
|
+
flushComponentSync,
|
|
140
|
+
/** Instances are being brought in line with their components: results, not edits. */
|
|
141
|
+
isSyncingComponents: () => isFlushingComponentSync
|
|
142
|
+
}
|
|
122
143
|
}
|
|
@@ -6,6 +6,10 @@ import {
|
|
|
6
6
|
componentPropertyDefinitions,
|
|
7
7
|
findComponentPropertyTargets
|
|
8
8
|
} from '@pairdraw/scene-graph/components'
|
|
9
|
+
import {
|
|
10
|
+
restoreAssignmentOverrideState,
|
|
11
|
+
takeAssignmentOverrideState
|
|
12
|
+
} from '@pairdraw/scene-graph/instances'
|
|
9
13
|
import { cloneInstanceOverrideState } from '@pairdraw/scene-graph/instances/overrides'
|
|
10
14
|
|
|
11
15
|
import type { EditorContext } from '#core/editor/types'
|
|
@@ -96,6 +100,7 @@ function setInstanceValue(ctx: EditorContext, node: SceneNode, propertyId: strin
|
|
|
96
100
|
componentPropertyAssignments: { ...instance.componentPropertyAssignments },
|
|
97
101
|
instanceOverrides: cloneInstanceOverrideState(instance.instanceOverrides)
|
|
98
102
|
}
|
|
103
|
+
const beforeAssignment = takeAssignmentOverrideState(ctx.graph, instance.id)
|
|
99
104
|
// Other layers the property drives in this instance change and resize with it, and undo with it.
|
|
100
105
|
const others = findComponentPropertyTargets(ctx.graph, instance, propertyId).flatMap((target) =>
|
|
101
106
|
target.node.id !== node.id && target.node.type === 'TEXT' ? [target.node] : []
|
|
@@ -112,10 +117,18 @@ function setInstanceValue(ctx: EditorContext, node: SceneNode, propertyId: strin
|
|
|
112
117
|
componentPropertyAssignments: { ...instance.componentPropertyAssignments },
|
|
113
118
|
instanceOverrides: cloneInstanceOverrideState(instance.instanceOverrides)
|
|
114
119
|
}
|
|
120
|
+
const afterAssignment = takeAssignmentOverrideState(ctx.graph, instance.id)
|
|
115
121
|
apply(after, othersAfter)
|
|
116
122
|
ctx.undo.push({
|
|
117
123
|
label: 'Edit text',
|
|
118
|
-
forward: () =>
|
|
119
|
-
|
|
124
|
+
forward: () => {
|
|
125
|
+
apply(after, othersAfter)
|
|
126
|
+
if (afterAssignment) restoreAssignmentOverrideState(ctx.graph, afterAssignment)
|
|
127
|
+
},
|
|
128
|
+
inverse: () => {
|
|
129
|
+
apply(before, othersBefore)
|
|
130
|
+
// The edit recorded an override on the instance above this one; undo takes it back.
|
|
131
|
+
if (beforeAssignment) restoreAssignmentOverrideState(ctx.graph, beforeAssignment)
|
|
132
|
+
}
|
|
120
133
|
})
|
|
121
134
|
}
|
|
@@ -6,6 +6,10 @@ import {
|
|
|
6
6
|
componentPropertyDefinitions,
|
|
7
7
|
findComponentPropertyTargets
|
|
8
8
|
} from '@pairdraw/scene-graph/components'
|
|
9
|
+
import {
|
|
10
|
+
restoreAssignmentOverrideState,
|
|
11
|
+
takeAssignmentOverrideState
|
|
12
|
+
} from '@pairdraw/scene-graph/instances'
|
|
9
13
|
import { cloneInstanceOverrideState } from '@pairdraw/scene-graph/instances/overrides'
|
|
10
14
|
|
|
11
15
|
import { refitGroupsAroundLayers } from '#core/editor/structure/group/bounds'
|
|
@@ -54,17 +58,21 @@ export function applyBoundVisibilityEdit(
|
|
|
54
58
|
layers: layers.map((id) => [id, ctx.graph.getNode(id)?.visible ?? true] as const)
|
|
55
59
|
})
|
|
56
60
|
const before = snapshot()
|
|
61
|
+
const beforeAssignment = takeAssignmentOverrideState(ctx.graph, instance.id)
|
|
57
62
|
applyComponentPropertyValue(ctx.graph, instance.id, definition, String(visible))
|
|
58
63
|
const after = snapshot()
|
|
64
|
+
const afterAssignment = takeAssignmentOverrideState(ctx.graph, instance.id)
|
|
59
65
|
// The property already had the value, as when another layer it drives was just shown.
|
|
60
66
|
if (isEqual(before, after)) return true
|
|
61
67
|
refitGroupsAroundLayers(ctx, layers)
|
|
62
|
-
const apply = (values: typeof before) => {
|
|
68
|
+
const apply = (values: typeof before, assignment: typeof beforeAssignment) => {
|
|
63
69
|
ctx.graph.updateNode(instance.id, {
|
|
64
70
|
componentPropertyAssignments: { ...values.componentPropertyAssignments },
|
|
65
71
|
instanceOverrides: cloneInstanceOverrideState(values.instanceOverrides)
|
|
66
72
|
})
|
|
67
73
|
for (const [id, shown] of values.layers) ctx.graph.updateNode(id, { visible: shown })
|
|
74
|
+
// The edit recorded an override on the instance above this one; undo takes it back.
|
|
75
|
+
if (assignment) restoreAssignmentOverrideState(ctx.graph, assignment)
|
|
68
76
|
refitGroupsAroundLayers(ctx, layers)
|
|
69
77
|
ctx.runLayoutForNode(instance.id)
|
|
70
78
|
ctx.requestRender()
|
|
@@ -72,8 +80,8 @@ export function applyBoundVisibilityEdit(
|
|
|
72
80
|
ctx.runLayoutForNode(instance.id)
|
|
73
81
|
ctx.undo.push({
|
|
74
82
|
label: visible ? 'Show layer' : 'Hide layer',
|
|
75
|
-
forward: () => apply(after),
|
|
76
|
-
inverse: () => apply(before)
|
|
83
|
+
forward: () => apply(after, afterAssignment),
|
|
84
|
+
inverse: () => apply(before, beforeAssignment)
|
|
77
85
|
})
|
|
78
86
|
return true
|
|
79
87
|
}
|
|
@@ -1,20 +1,41 @@
|
|
|
1
1
|
import type { SceneNode } from '@pairdraw/scene-graph'
|
|
2
2
|
import { getAxisAlignedWorldBounds, getWorldMatrix } from '@pairdraw/scene-graph/coordinate'
|
|
3
3
|
import { canCreateInstance } from '@pairdraw/scene-graph/instances'
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
cloneInstanceOverrideState,
|
|
6
|
+
type InstanceOverrideState
|
|
7
|
+
} from '@pairdraw/scene-graph/instances/overrides'
|
|
5
8
|
import Matrix from '@pairdraw/scene-graph/matrix'
|
|
6
9
|
import type { Vector } from '@pairdraw/scene-graph/primitives'
|
|
7
10
|
|
|
8
11
|
import { prepareSlotEdits } from '#core/editor/components/slots'
|
|
12
|
+
import { recordSubtreeEdit } from '#core/editor/components/slots/history'
|
|
13
|
+
import { restoreSubtree, snapshotSubtree } from '#core/editor/history/subtree'
|
|
9
14
|
import type { EditorContext } from '#core/editor/types'
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
import {
|
|
16
|
+
instanceOverrides,
|
|
17
|
+
resetInstanceOverrides as resetInstanceOverridesInGraph
|
|
18
|
+
} from '#core/figma-api/overrides'
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The overrides of the instances an instance holds, down to the first instance on each branch:
|
|
22
|
+
* the ones detaching it hands their layers' overrides to.
|
|
23
|
+
*/
|
|
24
|
+
function nestedInstanceOverrides(
|
|
25
|
+
ctx: EditorContext,
|
|
26
|
+
instanceId: string
|
|
27
|
+
): Map<string, InstanceOverrideState> {
|
|
28
|
+
const states = new Map<string, InstanceOverrideState>()
|
|
29
|
+
const visit = (parentId: string): void => {
|
|
30
|
+
for (const child of ctx.graph.getChildren(parentId)) {
|
|
31
|
+
if (child.type === 'INSTANCE')
|
|
32
|
+
states.set(child.id, cloneInstanceOverrideState(child.instanceOverrides))
|
|
33
|
+
else visit(child.id)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
visit(instanceId)
|
|
37
|
+
return states
|
|
16
38
|
}
|
|
17
|
-
|
|
18
39
|
type DefaultInstancePlacement = {
|
|
19
40
|
local: Vector
|
|
20
41
|
world: Vector
|
|
@@ -82,13 +103,18 @@ export function createComponentInstanceActions(ctx: EditorContext) {
|
|
|
82
103
|
}
|
|
83
104
|
|
|
84
105
|
const instanceId = instance.id
|
|
85
|
-
const snapshot = createInstanceSnapshot(instance)
|
|
86
106
|
ctx.setSelectedIds(new Set([instanceId]))
|
|
107
|
+
// Redo restores the layers the instance had, ids included, so overrides and links it took
|
|
108
|
+
// keep their targets; creating an instance again would make new ones.
|
|
109
|
+
const subtree = snapshotSubtree(ctx.graph, instanceId)
|
|
87
110
|
|
|
88
111
|
ctx.undo.push({
|
|
89
112
|
label: 'Create instance',
|
|
90
113
|
forward: () => {
|
|
91
|
-
ctx.graph.
|
|
114
|
+
if (!ctx.graph.getNode(instanceId)) {
|
|
115
|
+
const root = subtree.get(instanceId)
|
|
116
|
+
if (root) restoreSubtree(ctx.graph, root, parentId, subtree)
|
|
117
|
+
}
|
|
92
118
|
ctx.setSelectedIds(new Set([instanceId]))
|
|
93
119
|
},
|
|
94
120
|
inverse: () => {
|
|
@@ -114,6 +140,7 @@ export function createComponentInstanceActions(ctx: EditorContext) {
|
|
|
114
140
|
|
|
115
141
|
const prevComponentId = selectedNode.componentId
|
|
116
142
|
const previousOverrides = cloneInstanceOverrideState(selectedNode.instanceOverrides)
|
|
143
|
+
const previousNestedOverrides = nestedInstanceOverrides(ctx, selectedNode.id)
|
|
117
144
|
|
|
118
145
|
ctx.graph.detachInstance(selectedNode.id)
|
|
119
146
|
ctx.setSelectedIds(new Set([selectedNode.id]))
|
|
@@ -130,9 +157,32 @@ export function createComponentInstanceActions(ctx: EditorContext) {
|
|
|
130
157
|
componentId: prevComponentId,
|
|
131
158
|
instanceOverrides: cloneInstanceOverrideState(previousOverrides)
|
|
132
159
|
})
|
|
160
|
+
// Detaching gave the instances it holds their layers' overrides; undoing takes them back.
|
|
161
|
+
for (const [id, overrides] of previousNestedOverrides)
|
|
162
|
+
ctx.graph.updateNode(id, { instanceOverrides: cloneInstanceOverrideState(overrides) })
|
|
133
163
|
}
|
|
134
164
|
})
|
|
135
165
|
}
|
|
136
166
|
|
|
137
|
-
|
|
167
|
+
/** Whether `id` is an instance holding any edit of its own, so Reset all changes has work. */
|
|
168
|
+
function instanceHasOverrides(id: string): boolean {
|
|
169
|
+
const node = ctx.graph.getNode(id)
|
|
170
|
+
return node?.type === 'INSTANCE' && instanceOverrides(ctx.graph, node).length > 0
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** Figma's Reset all changes: the instance and the ones inside it go back to their components. */
|
|
174
|
+
function resetInstanceOverridesFromSelection(id: string): void {
|
|
175
|
+
const node = ctx.graph.getNode(id)
|
|
176
|
+
if (node?.type !== 'INSTANCE') return
|
|
177
|
+
recordSubtreeEdit(ctx, 'Reset all changes', id, () =>
|
|
178
|
+
resetInstanceOverridesInGraph(ctx.graph, node)
|
|
179
|
+
)
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return {
|
|
183
|
+
createInstanceFromComponent,
|
|
184
|
+
detachInstance,
|
|
185
|
+
instanceHasOverrides,
|
|
186
|
+
resetInstanceOverrides: resetInstanceOverridesFromSelection
|
|
187
|
+
}
|
|
138
188
|
}
|
|
@@ -6,6 +6,10 @@ import {
|
|
|
6
6
|
resolveComponentPropertyValue,
|
|
7
7
|
type ComponentPropertyTarget
|
|
8
8
|
} from '@pairdraw/scene-graph/components'
|
|
9
|
+
import {
|
|
10
|
+
restoreAssignmentOverrideState,
|
|
11
|
+
takeAssignmentOverrideState
|
|
12
|
+
} from '@pairdraw/scene-graph/instances'
|
|
9
13
|
import {
|
|
10
14
|
cloneInstanceOverrideState,
|
|
11
15
|
setInstanceOverride
|
|
@@ -131,6 +135,9 @@ export function createComponentPropertyActions(
|
|
|
131
135
|
|
|
132
136
|
const previousAssignments = { ...instance.componentPropertyAssignments }
|
|
133
137
|
const previousOverrides = cloneInstanceOverrideState(instance.instanceOverrides)
|
|
138
|
+
// An assignment made through a nested instance records an override on the instance above
|
|
139
|
+
// it, so undo has to put that one back too.
|
|
140
|
+
const previousAssignmentOverride = takeAssignmentOverrideState(ctx.graph, instanceId)
|
|
134
141
|
|
|
135
142
|
// A property can drive several layers; undo restores each one to what it showed.
|
|
136
143
|
const assignedValue = instance.componentPropertyAssignments[propertyId]
|
|
@@ -158,6 +165,9 @@ export function createComponentPropertyActions(
|
|
|
158
165
|
componentPropertyAssignments: previousAssignments,
|
|
159
166
|
instanceOverrides: cloneInstanceOverrideState(previousOverrides)
|
|
160
167
|
})
|
|
168
|
+
if (previousAssignmentOverride) {
|
|
169
|
+
restoreAssignmentOverrideState(ctx.graph, previousAssignmentOverride)
|
|
170
|
+
}
|
|
161
171
|
restoredTargets.forEach((target, index) =>
|
|
162
172
|
restoreTarget(live, target, previousValues[index] ?? '')
|
|
163
173
|
)
|
|
@@ -119,11 +119,14 @@ export function createSlotAuthoringActions(ctx: EditorContext) {
|
|
|
119
119
|
const owner = ctx.graph.getNode(ownerId)
|
|
120
120
|
if (!owner) return
|
|
121
121
|
const frames = boundFrames(ctx, owner, propertyId)
|
|
122
|
+
// A set's slots are its variants': their instances hold the content.
|
|
123
|
+
const components = new Set([owner.id, ...owner.childIds])
|
|
122
124
|
const owning = [...ctx.graph.getAllNodes()]
|
|
123
125
|
.filter(
|
|
124
126
|
(node) =>
|
|
125
127
|
node.type === 'INSTANCE' &&
|
|
126
|
-
node.componentId
|
|
128
|
+
!!node.componentId &&
|
|
129
|
+
components.has(node.componentId) &&
|
|
127
130
|
Object.hasOwn(node.componentPropertyAssignments, propertyId)
|
|
128
131
|
)
|
|
129
132
|
.map((instance) => instance.id)
|