@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
package/src/editor/create.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { createNanoEvents } from 'nanoevents'
|
|
|
3
3
|
import type { Emitter } from 'nanoevents'
|
|
4
4
|
|
|
5
5
|
import { SceneGraph, type SceneNode } from '@pairdraw/scene-graph'
|
|
6
|
-
import { UndoManager } from '@pairdraw/scene-graph/undo'
|
|
6
|
+
import { UndoManager, type UndoHistory } from '@pairdraw/scene-graph/undo'
|
|
7
7
|
|
|
8
8
|
import type { SkiaRenderer } from '#core/canvas/renderer'
|
|
9
9
|
import { prefetchFigmaSchema } from '#core/clipboard'
|
|
@@ -72,20 +72,36 @@ import type {
|
|
|
72
72
|
EditorEventName,
|
|
73
73
|
EditorEvents,
|
|
74
74
|
EditorOptions,
|
|
75
|
-
EditorState
|
|
75
|
+
EditorState,
|
|
76
|
+
ViewportInsets
|
|
76
77
|
} from './types'
|
|
77
78
|
import { createUndoActions } from './undo'
|
|
78
79
|
import { createVariableActions } from './variables'
|
|
79
80
|
import { createVectorizeActions } from './vectorize'
|
|
80
|
-
import { createViewportActions } from './viewport'
|
|
81
|
+
import { createViewportActions, NO_VIEWPORT_INSETS } from './viewport'
|
|
81
82
|
import { createCanvasViewActions, offeredTool, resolveEditorProfile } from './views'
|
|
82
83
|
|
|
83
84
|
export { createDefaultEditorState } from './state'
|
|
84
85
|
|
|
86
|
+
/** A canvas with no chrome reports nothing, which is the same as none covering it. */
|
|
87
|
+
function resolveViewportInsets(options?: EditorOptions): () => ViewportInsets {
|
|
88
|
+
return options?.getViewportInsets ?? (() => NO_VIEWPORT_INSETS)
|
|
89
|
+
}
|
|
90
|
+
|
|
85
91
|
export function createEditor(options?: EditorOptions) {
|
|
86
92
|
let _graph = options?.graph ?? new SceneGraph()
|
|
87
93
|
const skipInitialGraphSetup = options?.skipInitialGraphSetup ?? false
|
|
88
|
-
const undo = new UndoManager({
|
|
94
|
+
const undo = new UndoManager({
|
|
95
|
+
onChange: () => emitEditorEvent('history:changed'),
|
|
96
|
+
// A step owns the edited-field marks its edit added, so undo takes them back and redo
|
|
97
|
+
// marks them again. The marks are the graph's, and the document can be replaced.
|
|
98
|
+
marks: {
|
|
99
|
+
take: () => _graph.takeSourceMarks(),
|
|
100
|
+
add: (id, fields) => _graph.addSourceMarks(id, fields),
|
|
101
|
+
remove: (id, fields) => _graph.removeSourceMarks(id, fields),
|
|
102
|
+
preserve: (run) => _graph.preserveSourceMetadataDuring(run)
|
|
103
|
+
}
|
|
104
|
+
})
|
|
89
105
|
const _loadFont = options?.loadFont ?? fontManager.loadFont.bind(fontManager)
|
|
90
106
|
const _getViewportSize =
|
|
91
107
|
options?.getViewportSize ??
|
|
@@ -93,6 +109,7 @@ export function createEditor(options?: EditorOptions) {
|
|
|
93
109
|
if (IS_BROWSER) return { width: window.innerWidth, height: window.innerHeight }
|
|
94
110
|
return { width: 800, height: 600 }
|
|
95
111
|
})
|
|
112
|
+
const _getViewportInsets = resolveViewportInsets(options)
|
|
96
113
|
let _ck: CanvasKit | null = null
|
|
97
114
|
let _renderer: SkiaRenderer | null = null
|
|
98
115
|
const _renderers = new Set<SkiaRenderer>()
|
|
@@ -104,9 +121,23 @@ export function createEditor(options?: EditorOptions) {
|
|
|
104
121
|
if (event === 'settled') pendingTextLayout.relayoutReady(_renderer)
|
|
105
122
|
events.emit('font:resolution-changed', event, snapshot)
|
|
106
123
|
})
|
|
107
|
-
const stopFontLoadEvents = fontManager.onFaceLoaded((family, style) =>
|
|
124
|
+
const stopFontLoadEvents = fontManager.onFaceLoaded((family, style) => {
|
|
125
|
+
// Text measured in a substitute takes its own face's size once a face of its family loads.
|
|
126
|
+
pendingTextLayout.relayoutSubstituted(_renderer, family)
|
|
108
127
|
events.emit('font:loaded', family, style)
|
|
109
|
-
)
|
|
128
|
+
})
|
|
129
|
+
// Text blocked while its fonts were prepared is missing from the tiles drawn meanwhile.
|
|
130
|
+
const stopUnblockEvents = fontManager.onNodesUnblocked((nodeIds) => {
|
|
131
|
+
let redrawn = false
|
|
132
|
+
for (const renderer of _renderers) {
|
|
133
|
+
for (const id of nodeIds) {
|
|
134
|
+
if (!_graph.getNode(id)) continue
|
|
135
|
+
renderer.invalidateNodePicture(id)
|
|
136
|
+
redrawn = true
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (redrawn) requestRender()
|
|
140
|
+
})
|
|
110
141
|
|
|
111
142
|
void prefetchFigmaSchema()
|
|
112
143
|
|
|
@@ -232,7 +263,8 @@ export function createEditor(options?: EditorOptions) {
|
|
|
232
263
|
runLayoutForNode,
|
|
233
264
|
requestRender
|
|
234
265
|
})
|
|
235
|
-
const { scheduleComponentSync } =
|
|
266
|
+
const { scheduleComponentSync, flushComponentSync, isSyncingComponents } =
|
|
267
|
+
createComponentSyncScheduler(() => _graph, requestRender)
|
|
236
268
|
|
|
237
269
|
const { subscribeToGraph, unsubscribeFromGraph } = createGraphEventSubscription({
|
|
238
270
|
getGraph: () => _graph,
|
|
@@ -266,6 +298,7 @@ export function createEditor(options?: EditorOptions) {
|
|
|
266
298
|
loadFont: _loadFont,
|
|
267
299
|
resolveFigmaClipboardImages: options?.resolveFigmaClipboardImages ?? null,
|
|
268
300
|
getViewportSize: _getViewportSize,
|
|
301
|
+
getViewportInsets: _getViewportInsets,
|
|
269
302
|
getUserName: () => options?.getUserName?.() ?? '',
|
|
270
303
|
icons: options?.icons ?? defaultIcons,
|
|
271
304
|
getCk: () => _ck,
|
|
@@ -393,9 +426,21 @@ export function createEditor(options?: EditorOptions) {
|
|
|
393
426
|
if (_renderers.size === 0) releaseTextMeasurer()
|
|
394
427
|
}
|
|
395
428
|
|
|
429
|
+
/** Each graph's committed history, kept aside while another graph is open in this editor. */
|
|
430
|
+
const histories = new WeakMap<SceneGraph, UndoHistory>()
|
|
431
|
+
|
|
396
432
|
function replaceGraph(newGraph: SceneGraph) {
|
|
397
433
|
nodes.cancelNodePreviews()
|
|
398
|
-
|
|
434
|
+
if (newGraph !== _graph) {
|
|
435
|
+
// Undo steps name layers by id and act on whichever graph is open, so history stays with
|
|
436
|
+
// the graph it was recorded on: a document opened in this editor starts with its own,
|
|
437
|
+
// instead of undoing the last document's layers that share an id.
|
|
438
|
+
histories.set(_graph, undo.takeHistory())
|
|
439
|
+
undo.adoptHistory(histories.get(newGraph))
|
|
440
|
+
// Menus show the new graph's history; a step still being recorded keeps its own notice,
|
|
441
|
+
// which is how it learns another write happened beside it.
|
|
442
|
+
if (!undo.isRecording) emitEditorEvent('history:changed')
|
|
443
|
+
}
|
|
399
444
|
_graph = newGraph
|
|
400
445
|
state.documentKind = _graph.documentKind
|
|
401
446
|
setActiveTool(offeredTool(state, state.activeTool))
|
|
@@ -426,6 +471,7 @@ export function createEditor(options?: EditorOptions) {
|
|
|
426
471
|
interactiveEdits.clear()
|
|
427
472
|
stopFontResolutionEvents()
|
|
428
473
|
stopFontLoadEvents()
|
|
474
|
+
stopUnblockEvents()
|
|
429
475
|
unsubscribeFromGraph()
|
|
430
476
|
}
|
|
431
477
|
|
|
@@ -438,6 +484,8 @@ export function createEditor(options?: EditorOptions) {
|
|
|
438
484
|
get graph() {
|
|
439
485
|
return _graph
|
|
440
486
|
},
|
|
487
|
+
/** Instances are being brought in line with their components: results, not edits. */
|
|
488
|
+
isSyncingComponents,
|
|
441
489
|
get renderer() {
|
|
442
490
|
return _renderer
|
|
443
491
|
},
|
|
@@ -458,6 +506,7 @@ export function createEditor(options?: EditorOptions) {
|
|
|
458
506
|
// Lifecycle
|
|
459
507
|
beginInteractiveEdit,
|
|
460
508
|
isInteractiveEditing: () => interactiveEdits.size > 0,
|
|
509
|
+
flushComponentSync,
|
|
461
510
|
requestRender,
|
|
462
511
|
requestRefresh,
|
|
463
512
|
textSelectionChanged,
|
|
@@ -496,6 +545,7 @@ export function createEditor(options?: EditorOptions) {
|
|
|
496
545
|
nodes.updateNodeWithUndo(target, next, label)
|
|
497
546
|
),
|
|
498
547
|
getTextSelectionStyle: textSelectionStyle.selectionStyle,
|
|
548
|
+
layerChanges: textSelectionStyle.layerChanges,
|
|
499
549
|
|
|
500
550
|
// Alignment (align, flip, rotate)
|
|
501
551
|
...alignment,
|
package/src/editor/guides.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { uniq } from 'es-toolkit/array'
|
|
|
2
2
|
|
|
3
3
|
import type { CanvasGuide } from '@pairdraw/scene-graph/guides'
|
|
4
4
|
|
|
5
|
+
import { captureSources, restoreSources } from './history/sources'
|
|
5
6
|
import type { EditorContext } from './types'
|
|
6
7
|
|
|
7
8
|
function owner(ctx: EditorContext, ownerId: string) {
|
|
@@ -24,6 +25,30 @@ function newGuideId(): string {
|
|
|
24
25
|
return `guide:${crypto.randomUUID()}`
|
|
25
26
|
}
|
|
26
27
|
|
|
28
|
+
/** Applies a guide edit and records its undo with the source marks each side captured. */
|
|
29
|
+
function commitGuides(
|
|
30
|
+
ctx: EditorContext,
|
|
31
|
+
ownerId: string,
|
|
32
|
+
label: string,
|
|
33
|
+
before: CanvasGuide[],
|
|
34
|
+
after: CanvasGuide[]
|
|
35
|
+
): void {
|
|
36
|
+
const sourcesBefore = captureSources(ctx.graph, [ownerId])
|
|
37
|
+
replaceGuides(ctx, ownerId, after)
|
|
38
|
+
const sourcesAfter = captureSources(ctx.graph, [ownerId])
|
|
39
|
+
ctx.undo.push({
|
|
40
|
+
label,
|
|
41
|
+
forward: () => {
|
|
42
|
+
replaceGuides(ctx, ownerId, after)
|
|
43
|
+
restoreSources(ctx.graph, sourcesAfter)
|
|
44
|
+
},
|
|
45
|
+
inverse: () => {
|
|
46
|
+
replaceGuides(ctx, ownerId, before)
|
|
47
|
+
restoreSources(ctx.graph, sourcesBefore)
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
|
|
27
52
|
export function createGuideActions(ctx: EditorContext) {
|
|
28
53
|
function addGuide(ownerId: string, axis: CanvasGuide['axis'], position: number): string | null {
|
|
29
54
|
const node = owner(ctx, ownerId)
|
|
@@ -31,12 +56,7 @@ export function createGuideActions(ctx: EditorContext) {
|
|
|
31
56
|
const guide: CanvasGuide = { id: newGuideId(), axis, position }
|
|
32
57
|
const before = structuredClone(node.guides)
|
|
33
58
|
const after = [...before, guide]
|
|
34
|
-
|
|
35
|
-
ctx.undo.push({
|
|
36
|
-
label: 'Add guide',
|
|
37
|
-
forward: () => replaceGuides(ctx, ownerId, after),
|
|
38
|
-
inverse: () => replaceGuides(ctx, ownerId, before)
|
|
39
|
-
})
|
|
59
|
+
commitGuides(ctx, ownerId, 'Add guide', before, after)
|
|
40
60
|
return guide.id
|
|
41
61
|
}
|
|
42
62
|
|
|
@@ -48,12 +68,7 @@ export function createGuideActions(ctx: EditorContext) {
|
|
|
48
68
|
const before = structuredClone(node.guides)
|
|
49
69
|
const after = structuredClone(node.guides)
|
|
50
70
|
after[index].position = position
|
|
51
|
-
|
|
52
|
-
ctx.undo.push({
|
|
53
|
-
label: 'Move guide',
|
|
54
|
-
forward: () => replaceGuides(ctx, ownerId, after),
|
|
55
|
-
inverse: () => replaceGuides(ctx, ownerId, before)
|
|
56
|
-
})
|
|
71
|
+
commitGuides(ctx, ownerId, 'Move guide', before, after)
|
|
57
72
|
return true
|
|
58
73
|
}
|
|
59
74
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { compact, isEqual, uniq, xor } from 'es-toolkit'
|
|
1
|
+
import { compact, isEqual, isPlainObject, uniq, xor } from 'es-toolkit'
|
|
2
2
|
|
|
3
3
|
import type {
|
|
4
4
|
FigmaSourcePayload,
|
|
@@ -244,13 +244,70 @@ function restoreRecords<T extends object>(
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
/**
|
|
247
|
-
*
|
|
248
|
-
*
|
|
247
|
+
* A layer or record as it was before an edit, with what someone else changed on it while the edit
|
|
248
|
+
* waited, field by field: a field the edit had left alone takes the other writer's value, and one
|
|
249
|
+
* the edit had changed keeps the edit's, so its undo restores what it changed. Fields that map
|
|
250
|
+
* keys to values, such as variable bindings or a variable's values by mode, are adopted one level
|
|
251
|
+
* in, so independent entries of one field both survive.
|
|
252
|
+
*/
|
|
253
|
+
function adoptChanges<T extends object>(baseline: T, atPause: T, live: T, depth = 1): T {
|
|
254
|
+
const adopted = { ...baseline }
|
|
255
|
+
for (const key of new Set([...Object.keys(atPause), ...Object.keys(live)])) {
|
|
256
|
+
const paused: unknown = Reflect.get(atPause, key)
|
|
257
|
+
const now: unknown = Reflect.get(live, key)
|
|
258
|
+
const base: unknown = Reflect.get(baseline, key)
|
|
259
|
+
const pausedHas = Object.hasOwn(atPause, key)
|
|
260
|
+
const liveHas = Object.hasOwn(live, key)
|
|
261
|
+
if (pausedHas === liveHas && isEqual(paused, now)) continue
|
|
262
|
+
if (Object.hasOwn(baseline, key) === pausedHas && isEqual(base, paused)) {
|
|
263
|
+
if (liveHas) Reflect.set(adopted, key, structuredClone(now))
|
|
264
|
+
else Reflect.deleteProperty(adopted, key)
|
|
265
|
+
} else if (depth > 0 && isPlainObject(base) && isPlainObject(paused) && isPlainObject(now)) {
|
|
266
|
+
Reflect.set(adopted, key, adoptChanges(base, paused, now, depth - 1))
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return adopted
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/** As `adoptChanges` for a map of records, dropping a record someone else removed meanwhile. */
|
|
273
|
+
function adoptRecords<T extends object>(
|
|
274
|
+
baseline: Map<string, T>,
|
|
275
|
+
atPause: Map<string, T>,
|
|
276
|
+
live: ReadonlyMap<string, T>
|
|
277
|
+
): void {
|
|
278
|
+
for (const [id, paused] of atPause) {
|
|
279
|
+
const before = baseline.get(id)
|
|
280
|
+
if (!before) continue
|
|
281
|
+
const now = live.get(id)
|
|
282
|
+
if (!now) baseline.delete(id)
|
|
283
|
+
else if (isEqual(before, paused)) baseline.set(id, structuredClone(now))
|
|
284
|
+
else baseline.set(id, adoptChanges(before, paused, now))
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/** What an edit changed in the document, once it is done; see `recordDocumentChange`. */
|
|
289
|
+
export interface DocumentChangeRecorder {
|
|
290
|
+
/** Stops recording and returns what the edit changed. */
|
|
291
|
+
finish: () => DocumentChange
|
|
292
|
+
/** Treats what changes until `resume` as someone else's, as when the edit waits. */
|
|
293
|
+
pause: () => void
|
|
294
|
+
/** The wait ended: what changed meanwhile stays out of the edit's step. */
|
|
295
|
+
resume: () => void
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Starts recording an edit made from `pageId`. Call `finish` once the edit is done, also when it
|
|
300
|
+
* failed, to stop recording and get what the edit changed.
|
|
249
301
|
*
|
|
250
302
|
* The page is copied up front, so values written into its layers in place are kept too. Another
|
|
251
303
|
* page, or the document node, is copied the first time the edit is about to change it.
|
|
304
|
+
*
|
|
305
|
+
* While the edit waits (`pause`/`resume`, or `SceneGraph.waitOutsideEdit`), what changes is
|
|
306
|
+
* someone else's: a layer first touched meanwhile is not recorded, and one the edit had already
|
|
307
|
+
* copied is taken in from its new state field by field on resume, so an undo of the edit leaves
|
|
308
|
+
* the other writer's change alone.
|
|
252
309
|
*/
|
|
253
|
-
export function
|
|
310
|
+
export function recordDocumentChange(graph: SceneGraph, pageId: string): DocumentChangeRecorder {
|
|
254
311
|
const captured = new Map<string, SceneNode>()
|
|
255
312
|
const capturedPages = new Set([pageId])
|
|
256
313
|
const created = new Set<string>()
|
|
@@ -259,9 +316,49 @@ export function captureDocumentChange(graph: SceneGraph, pageId: string): () =>
|
|
|
259
316
|
const collections = structuredClone(graph.variableCollections)
|
|
260
317
|
const impact = createSceneMutationImpact()
|
|
261
318
|
const unbindEvents = recordSceneMutations(graph, impact)
|
|
319
|
+
let pausedDepth = 0
|
|
320
|
+
let layersAtPause = new Map<string, SceneNode>()
|
|
321
|
+
let variablesAtPause: Map<string, Variable> | null = null
|
|
322
|
+
let collectionsAtPause: Map<string, VariableCollection> | null = null
|
|
323
|
+
|
|
324
|
+
function pause(): void {
|
|
325
|
+
pausedDepth += 1
|
|
326
|
+
if (pausedDepth > 1) return
|
|
327
|
+
layersAtPause = new Map()
|
|
328
|
+
variablesAtPause = structuredClone(graph.variables)
|
|
329
|
+
collectionsAtPause = structuredClone(graph.variableCollections)
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
function resume(): void {
|
|
333
|
+
if (pausedDepth === 0) return
|
|
334
|
+
pausedDepth -= 1
|
|
335
|
+
if (pausedDepth > 0) return
|
|
336
|
+
for (const [id, atPause] of layersAtPause) {
|
|
337
|
+
const before = captured.get(id)
|
|
338
|
+
if (!before) continue
|
|
339
|
+
const live = graph.getNode(id)
|
|
340
|
+
// A layer someone else removed meanwhile is not the edit's to put back.
|
|
341
|
+
if (!live) captured.delete(id)
|
|
342
|
+
else captured.set(id, adoptChanges(before, atPause, live))
|
|
343
|
+
}
|
|
344
|
+
if (variablesAtPause) adoptRecords(variables, variablesAtPause, graph.variables)
|
|
345
|
+
if (collectionsAtPause) adoptRecords(collections, collectionsAtPause, graph.variableCollections)
|
|
346
|
+
layersAtPause = new Map()
|
|
347
|
+
variablesAtPause = null
|
|
348
|
+
collectionsAtPause = null
|
|
349
|
+
}
|
|
350
|
+
|
|
262
351
|
const unobserve = graph.observeNodeChanges({
|
|
263
|
-
created: (node) =>
|
|
352
|
+
created: (node) => {
|
|
353
|
+
if (pausedDepth === 0) created.add(node.id)
|
|
354
|
+
},
|
|
264
355
|
before: (node) => {
|
|
356
|
+
// While the edit waits, layers belong to whoever else changes them.
|
|
357
|
+
if (pausedDepth > 0) {
|
|
358
|
+
const before = captured.get(node.id)
|
|
359
|
+
if (before && !layersAtPause.has(node.id)) layersAtPause.set(node.id, captureNode(node))
|
|
360
|
+
return
|
|
361
|
+
}
|
|
265
362
|
if (captured.has(node.id) || created.has(node.id)) return
|
|
266
363
|
const page = pageOf(graph.nodes, node.id)
|
|
267
364
|
if (page && !capturedPages.has(page)) {
|
|
@@ -269,10 +366,14 @@ export function captureDocumentChange(graph: SceneGraph, pageId: string): () =>
|
|
|
269
366
|
capturePage(graph, page, captured)
|
|
270
367
|
}
|
|
271
368
|
if (!captured.has(node.id)) captured.set(node.id, captureNode(node))
|
|
272
|
-
}
|
|
369
|
+
},
|
|
370
|
+
pause,
|
|
371
|
+
resume
|
|
273
372
|
})
|
|
274
373
|
|
|
275
|
-
|
|
374
|
+
const finish = (): DocumentChange => {
|
|
375
|
+
resume()
|
|
376
|
+
pausedDepth = 0
|
|
276
377
|
unobserve()
|
|
277
378
|
unbindEvents()
|
|
278
379
|
const change: DocumentChange = {
|
|
@@ -312,6 +413,13 @@ export function captureDocumentChange(graph: SceneGraph, pageId: string): () =>
|
|
|
312
413
|
change.children.before.sort(byDepth(captured))
|
|
313
414
|
return change
|
|
314
415
|
}
|
|
416
|
+
|
|
417
|
+
return { finish, pause, resume }
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/** The change of one edit; `recordDocumentChange` when the edit can also wait. */
|
|
421
|
+
export function captureDocumentChange(graph: SceneGraph, pageId: string): () => DocumentChange {
|
|
422
|
+
return recordDocumentChange(graph, pageId).finish
|
|
315
423
|
}
|
|
316
424
|
|
|
317
425
|
/** Where a layer sits: its page and the page's child holding it, null for a page or the root. */
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { SceneGraph } from '@pairdraw/scene-graph'
|
|
2
|
-
import type { UndoManager } from '@pairdraw/scene-graph/undo'
|
|
2
|
+
import type { UndoEntry, UndoManager } from '@pairdraw/scene-graph/undo'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
applyDocumentChange,
|
|
6
|
-
captureDocumentChange,
|
|
7
6
|
isEmptyDocumentChange,
|
|
7
|
+
recordDocumentChange,
|
|
8
8
|
restoreDocumentChange,
|
|
9
|
-
type DocumentChange
|
|
9
|
+
type DocumentChange,
|
|
10
|
+
type DocumentChangeRecorder
|
|
10
11
|
} from '#core/editor/history/document-change'
|
|
11
12
|
import type { EditorContext } from '#core/editor/types'
|
|
12
13
|
|
|
@@ -56,9 +57,56 @@ function unchanged(pageId: string): DocumentChange {
|
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
|
|
60
|
+
/**
|
|
61
|
+
* The undo step of a recorded change. Built outside the edit's own scope, so the step keeps only
|
|
62
|
+
* the change: not the edit's recording state, nor its options, whose `onRecorded` can hold the
|
|
63
|
+
* step before it and so every step back to the first, past the history limit.
|
|
64
|
+
*/
|
|
65
|
+
function changeStep(ctx: EditorContext, label: string, change: DocumentChange): UndoEntry {
|
|
66
|
+
return {
|
|
67
|
+
label,
|
|
68
|
+
forward: () => restoreDocumentChange(ctx, change, 'after'),
|
|
69
|
+
inverse: () => restoreDocumentChange(ctx, change, 'before')
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
59
73
|
/** How many edits that await are running in each history. */
|
|
60
74
|
const runningEdits = new WeakMap<UndoManager, number>()
|
|
61
75
|
|
|
76
|
+
/** The recorders of edits still open in each editor, which anyone else's edit waits outside. */
|
|
77
|
+
const openRecorders = new WeakMap<EditorContext, Set<DocumentChangeRecorder>>()
|
|
78
|
+
|
|
79
|
+
function keepOpenRecorder(ctx: EditorContext, recorder: DocumentChangeRecorder): void {
|
|
80
|
+
let recorders = openRecorders.get(ctx)
|
|
81
|
+
if (!recorders) {
|
|
82
|
+
recorders = new Set()
|
|
83
|
+
openRecorders.set(ctx, recorders)
|
|
84
|
+
}
|
|
85
|
+
recorders.add(recorder)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function releaseOpenRecorder(ctx: EditorContext, recorder: DocumentChangeRecorder): void {
|
|
89
|
+
const recorders = openRecorders.get(ctx)
|
|
90
|
+
if (!recorders) return
|
|
91
|
+
recorders.delete(recorder)
|
|
92
|
+
if (recorders.size === 0) openRecorders.delete(ctx)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Runs a separate edit, or an undo or redo, while the edits that are still open treat what it
|
|
97
|
+
* changes as someone else's: their steps leave it alone. The edit is synchronous, so nothing it
|
|
98
|
+
* runs interleaves with their awaits.
|
|
99
|
+
*/
|
|
100
|
+
function withOpenEditsPaused<T>(ctx: EditorContext, run: () => T, own?: DocumentChangeRecorder): T {
|
|
101
|
+
const recorders = [...(openRecorders.get(ctx) ?? [])].filter((recorder) => recorder !== own)
|
|
102
|
+
for (const recorder of recorders) recorder.pause()
|
|
103
|
+
try {
|
|
104
|
+
return run()
|
|
105
|
+
} finally {
|
|
106
|
+
for (const recorder of recorders) recorder.resume()
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
62
110
|
/**
|
|
63
111
|
* Watches, while an edit awaits, for writes it does not own: a step recorded, undone, or redone,
|
|
64
112
|
* another edit or a batch open, or text being edited. They land in the edit's change, so rolling
|
|
@@ -105,12 +153,14 @@ function rollBack(ctx: EditorContext, graph: SceneGraph, change: DocumentChange)
|
|
|
105
153
|
function begin(ctx: EditorContext, options: RecordEditOptions, awaits = false) {
|
|
106
154
|
const graph = ctx.graph
|
|
107
155
|
const pageId = options.pageId ?? ctx.state.currentPageId
|
|
108
|
-
const
|
|
156
|
+
const recorder = recordDocumentChange(graph, pageId)
|
|
157
|
+
if (awaits) keepOpenRecorder(ctx, recorder)
|
|
109
158
|
// A synchronous edit runs alone; one that awaits shares the document while it waits.
|
|
110
159
|
const othersWrote = awaits ? watchOtherWrites(ctx) : () => false
|
|
111
|
-
|
|
160
|
+
const finish = (failed: boolean) => {
|
|
161
|
+
if (awaits) releaseOpenRecorder(ctx, recorder)
|
|
112
162
|
const others = othersWrote()
|
|
113
|
-
const change = finish()
|
|
163
|
+
const change = recorder.finish()
|
|
114
164
|
const empty = isEmptyDocumentChange(change)
|
|
115
165
|
if (
|
|
116
166
|
failed &&
|
|
@@ -125,16 +175,13 @@ function begin(ctx: EditorContext, options: RecordEditOptions, awaits = false) {
|
|
|
125
175
|
}
|
|
126
176
|
// An edit that changed nothing, such as a read-only script, leaves no empty step behind.
|
|
127
177
|
if (options.push !== false && !empty) {
|
|
128
|
-
const entry =
|
|
129
|
-
label: options.label,
|
|
130
|
-
forward: () => restoreDocumentChange(ctx, change, 'after'),
|
|
131
|
-
inverse: () => restoreDocumentChange(ctx, change, 'before')
|
|
132
|
-
}
|
|
178
|
+
const entry = changeStep(ctx, options.label, change)
|
|
133
179
|
if (options.ownStep) ctx.undo.pushStep(entry)
|
|
134
180
|
else ctx.undo.push(entry)
|
|
135
181
|
}
|
|
136
182
|
options.onRecorded?.(change)
|
|
137
183
|
}
|
|
184
|
+
return { finish, recorder }
|
|
138
185
|
}
|
|
139
186
|
|
|
140
187
|
/**
|
|
@@ -144,10 +191,11 @@ function begin(ctx: EditorContext, options: RecordEditOptions, awaits = false) {
|
|
|
144
191
|
* edit, and joins a batch open around it.
|
|
145
192
|
*/
|
|
146
193
|
export function recordEdit<T>(ctx: EditorContext, options: RecordEditOptions, run: () => T): T {
|
|
147
|
-
const finish = begin(ctx, options)
|
|
194
|
+
const { finish, recorder } = begin(ctx, options)
|
|
148
195
|
let failed = true
|
|
149
196
|
try {
|
|
150
|
-
|
|
197
|
+
// An edit that awaits meanwhile keeps what this one changes out of its step.
|
|
198
|
+
const result = withOpenEditsPaused(ctx, run, recorder)
|
|
151
199
|
failed = false
|
|
152
200
|
return result
|
|
153
201
|
} finally {
|
|
@@ -171,7 +219,7 @@ export async function recordEditAsync<T>(
|
|
|
171
219
|
run: () => Promise<T>
|
|
172
220
|
): Promise<T> {
|
|
173
221
|
// Capturing can throw; the edit opens only once it has, so a failure never leaves it open.
|
|
174
|
-
const finish = begin(ctx, { ...options, ownStep: true }, true)
|
|
222
|
+
const { finish } = begin(ctx, { ...options, ownStep: true }, true)
|
|
175
223
|
const close = ctx.undo.openEdit()
|
|
176
224
|
let failed = true
|
|
177
225
|
try {
|
|
@@ -46,8 +46,5 @@ export function commitPositionChange(
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
function applyPositions(ctx: EditorContext, positions: Map<string, Vector>): void {
|
|
49
|
-
for (const [id, pos] of positions)
|
|
50
|
-
ctx.graph.updateNode(id, pos)
|
|
51
|
-
ctx.runLayoutForNode(id)
|
|
52
|
-
}
|
|
49
|
+
for (const [id, pos] of positions) ctx.graph.updateNode(id, pos)
|
|
53
50
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
2
|
+
|
|
3
|
+
/** A node's source metadata as it stood at one point, by node id. */
|
|
4
|
+
export type SourceSnapshots = Map<string, SceneNode['source']>
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The source marks of these layers. A recorded edit restores them with the values it restores,
|
|
8
|
+
* so undoing the last edit leaves a layer as it was, its edited-field marks included.
|
|
9
|
+
*/
|
|
10
|
+
export function captureSources(graph: SceneGraph, ids: Iterable<string>): SourceSnapshots {
|
|
11
|
+
const sources: SourceSnapshots = new Map()
|
|
12
|
+
for (const id of ids) {
|
|
13
|
+
const node = graph.getNode(id)
|
|
14
|
+
if (node) sources.set(id, structuredClone(node.source))
|
|
15
|
+
}
|
|
16
|
+
return sources
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Puts the marks back without touching values, so the graph does not mark them again. */
|
|
20
|
+
export function restoreSources(graph: SceneGraph, sources: SourceSnapshots | undefined): void {
|
|
21
|
+
if (!sources) return
|
|
22
|
+
graph.preserveSourceMetadataDuring(() => {
|
|
23
|
+
for (const [id, source] of sources) graph.restoreNodeProperties(id, { source }, [])
|
|
24
|
+
})
|
|
25
|
+
}
|
package/src/editor/index.ts
CHANGED
|
@@ -16,6 +16,8 @@ export function createLayoutModeActions(
|
|
|
16
16
|
const node = ctx.graph.getNode(id)
|
|
17
17
|
if (!node || node.layoutMode === mode) return
|
|
18
18
|
const preview = beginNodePreview(mode === 'NONE' ? 'Remove auto layout' : 'Add auto layout')
|
|
19
|
+
// A group is only its children's bounds; a flow needs a frame to own it, as Figma converts.
|
|
20
|
+
if (node.type === 'GROUP' && mode !== 'NONE') preview.update(id, { type: 'FRAME' })
|
|
19
21
|
preview.update(id, layoutModeUpdates(ctx, node, id, mode))
|
|
20
22
|
preview.commit()
|
|
21
23
|
}
|
|
@@ -61,7 +63,24 @@ function layoutModeUpdates(
|
|
|
61
63
|
const updates: Partial<SceneNode> = { layoutMode: mode }
|
|
62
64
|
if (mode === 'GRID' && node.layoutMode !== 'GRID') {
|
|
63
65
|
applyGridDefaults(ctx, node, id, updates)
|
|
64
|
-
} else if (mode
|
|
66
|
+
} else if (mode === 'NONE') {
|
|
67
|
+
// A frame with no flow cannot wrap, align or space one, and the format stores none of it, so
|
|
68
|
+
// the frame gives them all up rather than reopening with them dropped.
|
|
69
|
+
Object.assign(updates, {
|
|
70
|
+
itemSpacing: 0,
|
|
71
|
+
paddingTop: 0,
|
|
72
|
+
paddingRight: 0,
|
|
73
|
+
paddingBottom: 0,
|
|
74
|
+
paddingLeft: 0,
|
|
75
|
+
primaryAxisSizing: 'FIXED',
|
|
76
|
+
counterAxisSizing: 'FIXED',
|
|
77
|
+
layoutWrap: 'NO_WRAP',
|
|
78
|
+
primaryAxisAlign: 'MIN',
|
|
79
|
+
counterAxisAlign: 'MIN',
|
|
80
|
+
counterAxisSpacing: 0,
|
|
81
|
+
layoutDirection: 'AUTO'
|
|
82
|
+
})
|
|
83
|
+
} else if (node.layoutMode === 'NONE') {
|
|
65
84
|
Object.assign(updates, autoLayoutDefaults())
|
|
66
85
|
}
|
|
67
86
|
return updates
|