@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/types.ts
CHANGED
|
@@ -263,6 +263,22 @@ export interface EditorEvents extends SceneGraphEvents {
|
|
|
263
263
|
|
|
264
264
|
export type EditorEventName = keyof EditorEvents
|
|
265
265
|
|
|
266
|
+
/** Space the floating chrome covers on each side of the canvas, in screen pixels. */
|
|
267
|
+
export interface ViewportInsets {
|
|
268
|
+
top: number
|
|
269
|
+
right: number
|
|
270
|
+
bottom: number
|
|
271
|
+
left: number
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/** The canvas the floating chrome leaves, in screen pixels, from its top-left corner. */
|
|
275
|
+
export interface VisibleCanvas {
|
|
276
|
+
left: number
|
|
277
|
+
top: number
|
|
278
|
+
width: number
|
|
279
|
+
height: number
|
|
280
|
+
}
|
|
281
|
+
|
|
266
282
|
export interface EditorOptions {
|
|
267
283
|
graph?: SceneGraph
|
|
268
284
|
state?: EditorState
|
|
@@ -274,6 +290,8 @@ export interface EditorOptions {
|
|
|
274
290
|
) => Promise<ArrayBuffer | null>
|
|
275
291
|
resolveFigmaClipboardImages?: FigmaClipboardImageResolver
|
|
276
292
|
getViewportSize?: () => { width: number; height: number }
|
|
293
|
+
/** Space the floating chrome covers on the canvas's sides, in screen pixels. */
|
|
294
|
+
getViewportInsets?: () => ViewportInsets
|
|
277
295
|
/** The name of whoever is editing, which a sticky note they place is signed with. */
|
|
278
296
|
getUserName?: () => string
|
|
279
297
|
/** Where icons are searched and fetched; defaults to Iconify. */
|
|
@@ -296,6 +314,7 @@ export interface EditorContext {
|
|
|
296
314
|
) => Promise<ArrayBuffer | null>
|
|
297
315
|
resolveFigmaClipboardImages: FigmaClipboardImageResolver | null
|
|
298
316
|
getViewportSize: () => { width: number; height: number }
|
|
317
|
+
getViewportInsets: () => ViewportInsets
|
|
299
318
|
getUserName: () => string
|
|
300
319
|
icons: IconProvider
|
|
301
320
|
getCk: () => CanvasKit | null
|
package/src/editor/undo.ts
CHANGED
|
@@ -2,10 +2,12 @@ import { isEqual } from 'es-toolkit'
|
|
|
2
2
|
import { pick } from 'es-toolkit/object'
|
|
3
3
|
|
|
4
4
|
import type { SceneNode } from '@pairdraw/scene-graph'
|
|
5
|
+
import { fitEnclosingGroups, redoGroupFit, undoGroupFit } from '@pairdraw/scene-graph/group-bounds'
|
|
5
6
|
import type { Rect, Vector } from '@pairdraw/scene-graph/primitives'
|
|
6
7
|
import { createResizeSnapshot, type ResizeSnapshot } from '@pairdraw/scene-graph/resize'
|
|
7
8
|
import type { UndoEntry } from '@pairdraw/scene-graph/undo'
|
|
8
9
|
|
|
10
|
+
import { groupFitOptions } from '#core/canvas/boolean'
|
|
9
11
|
import { textAutoResizeChanges } from '#core/layout/text-auto-resize'
|
|
10
12
|
|
|
11
13
|
import { assertNodeEditable } from './capabilities'
|
|
@@ -114,10 +116,27 @@ export function createUndoActions(ctx: EditorContext) {
|
|
|
114
116
|
}
|
|
115
117
|
for (const id of places.keys()) ctx.runLayoutForNode(id)
|
|
116
118
|
}
|
|
119
|
+
// A group's box is its children's, so the drag moved it too; the step owns that box, or undo
|
|
120
|
+
// would take the layers back and leave the group where they were dropped.
|
|
121
|
+
const options = groupFitOptions(ctx.getRenderer(), ctx.graph)
|
|
122
|
+
const parents = new Set<string>()
|
|
123
|
+
for (const places of [originals, finals])
|
|
124
|
+
for (const place of places.values()) parents.add(place.parentId)
|
|
125
|
+
// A layer an auto layout frame places has no box of its own to give the groups above it.
|
|
126
|
+
const fits = [...parents]
|
|
127
|
+
.filter((parentId) => ctx.graph.getNode(parentId)?.layoutMode === 'NONE')
|
|
128
|
+
.map((parentId) => fitEnclosingGroups(ctx.graph, [parentId], options))
|
|
129
|
+
.filter((fit) => fit !== null)
|
|
117
130
|
ctx.undo.push({
|
|
118
131
|
label: 'Move',
|
|
119
|
-
forward: () =>
|
|
120
|
-
|
|
132
|
+
forward: () => {
|
|
133
|
+
place(finals)
|
|
134
|
+
for (const fit of fits) redoGroupFit(ctx.graph, fit)
|
|
135
|
+
},
|
|
136
|
+
inverse: () => {
|
|
137
|
+
for (const fit of fits) undoGroupFit(ctx.graph, fit)
|
|
138
|
+
place(originals)
|
|
139
|
+
}
|
|
121
140
|
})
|
|
122
141
|
}
|
|
123
142
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { SceneNode } from '@pairdraw/scene-graph'
|
|
2
|
-
import {
|
|
2
|
+
import { copyFills, copyStrokes } from '@pairdraw/scene-graph/copy'
|
|
3
|
+
import { findInstanceAncestor, recordInstanceOverride } from '@pairdraw/scene-graph/instances'
|
|
3
4
|
import { cloneInstanceOverrideState } from '@pairdraw/scene-graph/instances/overrides'
|
|
4
5
|
import {
|
|
5
6
|
variableBindingOwner,
|
|
6
|
-
isNumericVariableBindingField
|
|
7
|
+
isNumericVariableBindingField,
|
|
8
|
+
paintBindingTarget
|
|
7
9
|
} from '@pairdraw/scene-graph/variables'
|
|
8
10
|
|
|
9
11
|
import { reconcileVariableLayouts } from '#core/layout/variables'
|
|
@@ -42,6 +44,13 @@ export function createVariableBindingActions(ctx: EditorContext) {
|
|
|
42
44
|
variableBindingScales: { ...node.variableBindingScales },
|
|
43
45
|
...(restoresValue(path) ? { [path]: node[path as keyof SceneNode] } : {})
|
|
44
46
|
}
|
|
47
|
+
// Binding a paint gives it its variable's color, which undo takes back from that paint alone.
|
|
48
|
+
const target = paintBindingTarget(path)
|
|
49
|
+
const targetPaint = target ? node[target.list].at(target.index) : undefined
|
|
50
|
+
const previousPaint =
|
|
51
|
+
target && targetPaint
|
|
52
|
+
? { ...target, color: { ...targetPaint.color }, opacity: targetPaint.opacity }
|
|
53
|
+
: null
|
|
45
54
|
const owner = variableBindingOwner(ctx.graph, node)
|
|
46
55
|
const nearest = findInstanceAncestor(ctx.graph, nodeId)
|
|
47
56
|
const owners = new Map(
|
|
@@ -52,6 +61,10 @@ export function createVariableBindingActions(ctx: EditorContext) {
|
|
|
52
61
|
const apply = () => {
|
|
53
62
|
if (variableId === undefined) ctx.graph.unbindVariable(nodeId, path)
|
|
54
63
|
else ctx.graph.bindVariable(nodeId, path, variableId)
|
|
64
|
+
// The field a path names (`fills/0/color` names `fills`) is an instance override, as the
|
|
65
|
+
// file records it: an instance that draws a variable's colour keeps it when its component
|
|
66
|
+
// changes, and the live document has to name that field too.
|
|
67
|
+
recordInstanceOverride(ctx.graph, nodeId, [path.split('/')[0] ?? path])
|
|
55
68
|
refreshBindings(nodeId)
|
|
56
69
|
}
|
|
57
70
|
apply()
|
|
@@ -80,6 +93,13 @@ export function createVariableBindingActions(ctx: EditorContext) {
|
|
|
80
93
|
([field]) => field in restored.boundVariables
|
|
81
94
|
)
|
|
82
95
|
)
|
|
96
|
+
const current = ctx.graph.getNode(nodeId)
|
|
97
|
+
if (previousPaint && current?.[previousPaint.list].at(previousPaint.index)) {
|
|
98
|
+
const { list, index, color, opacity } = previousPaint
|
|
99
|
+
const paints = list === 'fills' ? copyFills(current.fills) : copyStrokes(current.strokes)
|
|
100
|
+
Object.assign(paints[index], { color: { ...color }, opacity })
|
|
101
|
+
Object.assign(restored, { [list]: paints })
|
|
102
|
+
}
|
|
83
103
|
ctx.graph.updateNode(nodeId, restored)
|
|
84
104
|
refreshBindings(nodeId)
|
|
85
105
|
}
|
package/src/editor/variables.ts
CHANGED
|
@@ -327,8 +327,10 @@ export function createVariableActions(ctx: EditorContext) {
|
|
|
327
327
|
function removeMode(collectionId: string, modeId: string) {
|
|
328
328
|
const collection = ctx.graph.variableCollections.get(collectionId)
|
|
329
329
|
if (!collection || collection.modes.length <= 1) return
|
|
330
|
-
const
|
|
331
|
-
|
|
330
|
+
const removedMode = collection.modes.find((m) => m.modeId === modeId)
|
|
331
|
+
if (!removedMode) return
|
|
332
|
+
const modeIndex = collection.modes.indexOf(removedMode)
|
|
333
|
+
const savedMode = structuredClone(removedMode)
|
|
332
334
|
const wasDefault = collection.defaultModeId === modeId
|
|
333
335
|
const valueSnapshots = new Map<string, VariableValue>()
|
|
334
336
|
for (const varId of collection.variableIds) {
|
|
@@ -345,11 +347,13 @@ export function createVariableActions(ctx: EditorContext) {
|
|
|
345
347
|
refreshVariables(collectionScope(collectionId))
|
|
346
348
|
},
|
|
347
349
|
inverse: () => {
|
|
348
|
-
ctx.graph.addMode(collectionId, modeId,
|
|
350
|
+
ctx.graph.addMode(collectionId, modeId, savedMode.name)
|
|
349
351
|
const col = ctx.graph.variableCollections.get(collectionId)
|
|
350
|
-
if (col
|
|
351
|
-
|
|
352
|
-
|
|
352
|
+
if (col) {
|
|
353
|
+
// The mode comes back as it was, its sort position included, so it keeps its place.
|
|
354
|
+
col.modes = col.modes
|
|
355
|
+
.filter((m) => m.modeId !== modeId)
|
|
356
|
+
.toSpliced(modeIndex, 0, structuredClone(savedMode))
|
|
353
357
|
}
|
|
354
358
|
for (const [varId, value] of valueSnapshots) {
|
|
355
359
|
const v = ctx.graph.variables.get(varId)
|
package/src/editor/viewport.ts
CHANGED
|
@@ -1,14 +1,34 @@
|
|
|
1
1
|
import { getAxisAlignedWorldBounds } from '@pairdraw/scene-graph/coordinate'
|
|
2
2
|
import { computeBounds, computeAbsoluteBounds } from '@pairdraw/scene-graph/geometry'
|
|
3
|
+
import type { Vector } from '@pairdraw/scene-graph/primitives'
|
|
3
4
|
|
|
4
5
|
import { ZOOM_DIVISOR, ZOOM_SCALE_MAX, ZOOM_SCALE_MIN } from '#core/constants'
|
|
5
6
|
import { emitNavigationTrace } from '#core/profiler'
|
|
6
7
|
|
|
7
|
-
import type { EditorContext } from './types'
|
|
8
|
+
import type { EditorContext, ViewportInsets, VisibleCanvas } from './types'
|
|
8
9
|
|
|
9
10
|
/** Space kept between revealed layers and the viewport edge. */
|
|
10
11
|
const REVEAL_MARGIN = 48
|
|
11
12
|
|
|
13
|
+
/** No floating chrome, for an editor whose canvas is bare. */
|
|
14
|
+
export const NO_VIEWPORT_INSETS: ViewportInsets = { top: 0, right: 0, bottom: 0, left: 0 }
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The part of the canvas no floating chrome covers. A rail on the left or a pill at the bottom sits
|
|
18
|
+
* above the canvas element, so fitting to the whole element hides content under it.
|
|
19
|
+
*/
|
|
20
|
+
export function visibleCanvas(ctx: EditorContext): VisibleCanvas {
|
|
21
|
+
const { width, height } = ctx.getViewportSize()
|
|
22
|
+
const insets = ctx.getViewportInsets()
|
|
23
|
+
const left = Math.min(Math.max(insets.left, 0), width)
|
|
24
|
+
const top = Math.min(Math.max(insets.top, 0), height)
|
|
25
|
+
const right = Math.min(Math.max(insets.right, 0), width - left)
|
|
26
|
+
const bottom = Math.min(Math.max(insets.bottom, 0), height - top)
|
|
27
|
+
const area = { left, top, width: width - left - right, height: height - top - bottom }
|
|
28
|
+
// Chrome that covers everything is no guide at all; the whole canvas is then the best guess.
|
|
29
|
+
return area.width > 0 && area.height > 0 ? area : { left: 0, top: 0, width, height }
|
|
30
|
+
}
|
|
31
|
+
|
|
12
32
|
export function createViewportActions(ctx: EditorContext) {
|
|
13
33
|
function currentViewport() {
|
|
14
34
|
return { panX: ctx.state.panX, panY: ctx.state.panY, zoom: ctx.state.zoom }
|
|
@@ -68,12 +88,12 @@ export function createViewportActions(ctx: EditorContext) {
|
|
|
68
88
|
const w = maxX - minX + padding * 2
|
|
69
89
|
const h = maxY - minY + padding * 2
|
|
70
90
|
|
|
71
|
-
const
|
|
72
|
-
const zoom = Math.max(0.02, Math.min(
|
|
91
|
+
const area = visibleCanvas(ctx)
|
|
92
|
+
const zoom = Math.max(0.02, Math.min(area.width / w, area.height / h, 1))
|
|
73
93
|
|
|
74
94
|
ctx.state.zoom = zoom
|
|
75
|
-
ctx.state.panX = (
|
|
76
|
-
ctx.state.panY = (
|
|
95
|
+
ctx.state.panX = area.left + (area.width - w * zoom) / 2 - minX * zoom + padding * zoom
|
|
96
|
+
ctx.state.panY = area.top + (area.height - h * zoom) / 2 - minY * zoom + padding * zoom
|
|
77
97
|
ctx.requestRepaint()
|
|
78
98
|
emitViewportChanged(previous)
|
|
79
99
|
}
|
|
@@ -88,11 +108,11 @@ export function createViewportActions(ctx: EditorContext) {
|
|
|
88
108
|
const height = maxY - minY
|
|
89
109
|
if (!(width > 0) || !(height > 0)) return
|
|
90
110
|
const previous = currentViewport()
|
|
91
|
-
const
|
|
92
|
-
const zoom = Math.max(0.02, Math.min(256, Math.min(
|
|
111
|
+
const area = visibleCanvas(ctx)
|
|
112
|
+
const zoom = Math.max(0.02, Math.min(256, Math.min(area.width / width, area.height / height)))
|
|
93
113
|
ctx.state.zoom = zoom
|
|
94
|
-
ctx.state.panX =
|
|
95
|
-
ctx.state.panY =
|
|
114
|
+
ctx.state.panX = area.left + area.width / 2 - (minX + width / 2) * zoom
|
|
115
|
+
ctx.state.panY = area.top + area.height / 2 - (minY + height / 2) * zoom
|
|
96
116
|
ctx.requestRepaint()
|
|
97
117
|
emitViewportChanged(previous)
|
|
98
118
|
}
|
|
@@ -100,10 +120,10 @@ export function createViewportActions(ctx: EditorContext) {
|
|
|
100
120
|
/** Put the world point (x, y) at the center of the viewport, at `zoom` (the current one by default). */
|
|
101
121
|
function centerOn(x: number, y: number, zoom = ctx.state.zoom) {
|
|
102
122
|
const previous = currentViewport()
|
|
103
|
-
const
|
|
123
|
+
const area = visibleCanvas(ctx)
|
|
104
124
|
const nextZoom = Math.max(0.02, Math.min(256, zoom))
|
|
105
|
-
const panX = width / 2 - x * nextZoom
|
|
106
|
-
const panY = height / 2 - y * nextZoom
|
|
125
|
+
const panX = area.left + area.width / 2 - x * nextZoom
|
|
126
|
+
const panY = area.top + area.height / 2 - y * nextZoom
|
|
107
127
|
// Remote cursors are finite but unbounded; a point that overflows leaves the view alone.
|
|
108
128
|
if (!Number.isFinite(panX) || !Number.isFinite(panY)) return
|
|
109
129
|
ctx.state.zoom = nextZoom
|
|
@@ -122,15 +142,15 @@ export function createViewportActions(ctx: EditorContext) {
|
|
|
122
142
|
}
|
|
123
143
|
|
|
124
144
|
function zoomToLevel(level: number) {
|
|
125
|
-
const
|
|
126
|
-
const centerX = (-ctx.state.panX +
|
|
127
|
-
const centerY = (-ctx.state.panY +
|
|
145
|
+
const area = visibleCanvas(ctx)
|
|
146
|
+
const centerX = (-ctx.state.panX + area.left + area.width / 2) / ctx.state.zoom
|
|
147
|
+
const centerY = (-ctx.state.panY + area.top + area.height / 2) / ctx.state.zoom
|
|
128
148
|
|
|
129
149
|
const previous = currentViewport()
|
|
130
150
|
ctx.state.zoom = Math.max(0.02, Math.min(256, level))
|
|
131
151
|
// Keep the world point at the center of the viewport where it was.
|
|
132
|
-
ctx.state.panX =
|
|
133
|
-
ctx.state.panY =
|
|
152
|
+
ctx.state.panX = area.left + area.width / 2 - centerX * ctx.state.zoom
|
|
153
|
+
ctx.state.panY = area.top + area.height / 2 - centerY * ctx.state.zoom
|
|
134
154
|
ctx.requestRepaint()
|
|
135
155
|
emitViewportChanged(previous)
|
|
136
156
|
}
|
|
@@ -159,10 +179,11 @@ export function createViewportActions(ctx: EditorContext) {
|
|
|
159
179
|
const nodes = nodeIds.map((id) => ctx.graph.getNode(id)).filter((node) => node !== undefined)
|
|
160
180
|
if (nodes.length === 0) return
|
|
161
181
|
const bounds = computeBounds(nodes.map((node) => getAxisAlignedWorldBounds(node, ctx.graph)))
|
|
162
|
-
const
|
|
182
|
+
const area = visibleCanvas(ctx)
|
|
163
183
|
const { zoom, panX, panY } = ctx.state
|
|
164
184
|
const fits =
|
|
165
|
-
bounds.width * zoom <= width - margin * 2 &&
|
|
185
|
+
bounds.width * zoom <= area.width - margin * 2 &&
|
|
186
|
+
bounds.height * zoom <= area.height - margin * 2
|
|
166
187
|
if (!fits) {
|
|
167
188
|
zoomToBounds(bounds.x, bounds.y, bounds.x + bounds.width, bounds.y + bounds.height)
|
|
168
189
|
return
|
|
@@ -172,12 +193,25 @@ export function createViewportActions(ctx: EditorContext) {
|
|
|
172
193
|
const right = left + bounds.width * zoom
|
|
173
194
|
const bottom = top + bounds.height * zoom
|
|
174
195
|
const visible =
|
|
175
|
-
left >=
|
|
196
|
+
left >= area.left + margin &&
|
|
197
|
+
top >= area.top + margin &&
|
|
198
|
+
right <= area.left + area.width - margin &&
|
|
199
|
+
bottom <= area.top + area.height - margin
|
|
176
200
|
if (visible) return
|
|
177
|
-
pan(
|
|
201
|
+
pan(
|
|
202
|
+
area.left + area.width / 2 - (left + right) / 2,
|
|
203
|
+
area.top + area.height / 2 - (top + bottom) / 2
|
|
204
|
+
)
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/** The middle of the canvas the floating chrome leaves, in canvas pixels from its top-left. */
|
|
208
|
+
function viewportCanvasCenter(): Vector {
|
|
209
|
+
const area = visibleCanvas(ctx)
|
|
210
|
+
return { x: area.left + area.width / 2, y: area.top + area.height / 2 }
|
|
178
211
|
}
|
|
179
212
|
|
|
180
213
|
return {
|
|
214
|
+
viewportCanvasCenter,
|
|
181
215
|
revealNodes,
|
|
182
216
|
screenToCanvas,
|
|
183
217
|
setZoomAroundPoint,
|
|
@@ -2,19 +2,27 @@ import type { EditorContext } from '#core/editor/types'
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
createPresentationActions,
|
|
5
|
-
|
|
5
|
+
currentPlace,
|
|
6
|
+
returnToPlace,
|
|
6
7
|
type PresentationViewport
|
|
7
8
|
} from './present'
|
|
8
9
|
import { EDIT_VIEW, resolveEditorProfile } from './profile'
|
|
9
10
|
import { createShaderModeActions } from './shader'
|
|
10
|
-
import type { CanvasView } from './types'
|
|
11
|
+
import type { CanvasView, ViewportPlace } from './types'
|
|
12
|
+
|
|
13
|
+
/** The place a view put the canvas aside from, for a view that fits or scrolls it. */
|
|
14
|
+
function returnPlace(view: CanvasView): ViewportPlace | null {
|
|
15
|
+
if (view.id === 'present') return view.returnTo
|
|
16
|
+
return view.id === 'play' ? view.returnTo : null
|
|
17
|
+
}
|
|
11
18
|
|
|
12
19
|
export function createCanvasViewActions(ctx: EditorContext, viewport: PresentationViewport) {
|
|
13
20
|
function setCanvasView(view: CanvasView): void {
|
|
14
21
|
const left = ctx.state.canvasView
|
|
15
22
|
ctx.state.canvasView = view
|
|
16
|
-
// However a presentation is left, the canvas returns to where it looked before it.
|
|
17
|
-
|
|
23
|
+
// However a preview or presentation is left, the canvas returns to where it looked before it.
|
|
24
|
+
const back = left.id === view.id ? null : returnPlace(left)
|
|
25
|
+
if (back) returnToPlace(ctx, back, viewport)
|
|
18
26
|
ctx.requestRepaint()
|
|
19
27
|
}
|
|
20
28
|
|
|
@@ -30,10 +38,10 @@ export function createCanvasViewActions(ctx: EditorContext, viewport: Presentati
|
|
|
30
38
|
function startPlay(): void {
|
|
31
39
|
if (ctx.state.canvasView.id === 'play') return
|
|
32
40
|
ctx.state.hoveredNodeId = null
|
|
33
|
-
setCanvasView({ id: 'play', revision: 0 })
|
|
41
|
+
setCanvasView({ id: 'play', revision: 0, returnTo: currentPlace(ctx) })
|
|
34
42
|
}
|
|
35
43
|
|
|
36
|
-
/** Go back to editing; the canvas draws every layer again. */
|
|
44
|
+
/** Go back to editing; the canvas draws every layer again where it looked before. */
|
|
37
45
|
function stopPlay(): void {
|
|
38
46
|
if (ctx.state.canvasView.id === 'play') setCanvasView(EDIT_VIEW)
|
|
39
47
|
}
|
|
@@ -46,7 +54,9 @@ export function createCanvasViewActions(ctx: EditorContext, viewport: Presentati
|
|
|
46
54
|
/** Put every control back as designed by running the islands afresh. */
|
|
47
55
|
function resetPlay(): void {
|
|
48
56
|
const view = ctx.state.canvasView
|
|
49
|
-
if (view.id === 'play')
|
|
57
|
+
if (view.id === 'play') {
|
|
58
|
+
ctx.state.canvasView = { id: 'play', revision: view.revision + 1, returnTo: view.returnTo }
|
|
59
|
+
}
|
|
50
60
|
}
|
|
51
61
|
|
|
52
62
|
// Another document's layers start from their designed state, not from the old islands'.
|
|
@@ -3,7 +3,7 @@ import type { Rect, Size } from '@pairdraw/scene-graph/primitives'
|
|
|
3
3
|
|
|
4
4
|
import { pageSlides } from '#core/editor/bridges/frames'
|
|
5
5
|
import type { EditorContext } from '#core/editor/types'
|
|
6
|
-
import type
|
|
6
|
+
import { visibleCanvas, type createViewportActions } from '#core/editor/viewport'
|
|
7
7
|
|
|
8
8
|
import type {
|
|
9
9
|
CanvasView,
|
|
@@ -64,30 +64,39 @@ export function presentationViewport(
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
/** The world point at the
|
|
67
|
+
/** The world point at the middle of the canvas the chrome leaves, as `centerOn` takes it back. */
|
|
68
68
|
function currentCenter(ctx: EditorContext): ViewportCenter {
|
|
69
|
-
const
|
|
69
|
+
const area = visibleCanvas(ctx)
|
|
70
70
|
const { panX, panY, zoom } = ctx.state
|
|
71
|
-
return {
|
|
71
|
+
return {
|
|
72
|
+
x: (area.left + area.width / 2 - panX) / zoom,
|
|
73
|
+
y: (area.top + area.height / 2 - panY) / zoom,
|
|
74
|
+
zoom
|
|
75
|
+
}
|
|
72
76
|
}
|
|
73
77
|
|
|
74
|
-
|
|
78
|
+
/** Where the canvas looked before a view replaces it, as the place to return to. */
|
|
79
|
+
export function currentPlace(ctx: EditorContext): ViewportPlace {
|
|
75
80
|
const { panX, panY, zoom } = ctx.state
|
|
76
81
|
return { panX, panY, zoom }
|
|
77
82
|
}
|
|
78
83
|
|
|
79
84
|
/**
|
|
80
|
-
* Puts the canvas back where it looked before
|
|
85
|
+
* Puts the canvas back where it looked before a view took it elsewhere: its pan and zoom, so the
|
|
81
86
|
* editor's canvas, back at its own size, shows what it showed.
|
|
82
87
|
*/
|
|
83
|
-
export function
|
|
88
|
+
export function returnToPlace(
|
|
84
89
|
ctx: EditorContext,
|
|
85
|
-
|
|
90
|
+
place: ViewportPlace,
|
|
86
91
|
viewport: PresentationViewport
|
|
87
92
|
): void {
|
|
88
|
-
const
|
|
89
|
-
const { panX, panY, zoom } =
|
|
90
|
-
viewport.centerOn(
|
|
93
|
+
const area = visibleCanvas(ctx)
|
|
94
|
+
const { panX, panY, zoom } = place
|
|
95
|
+
viewport.centerOn(
|
|
96
|
+
(area.left + area.width / 2 - panX) / zoom,
|
|
97
|
+
(area.top + area.height / 2 - panY) / zoom,
|
|
98
|
+
zoom
|
|
99
|
+
)
|
|
91
100
|
}
|
|
92
101
|
|
|
93
102
|
/**
|
|
@@ -41,6 +41,16 @@ export interface PresentView {
|
|
|
41
41
|
returnTo: ViewportPlace
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
/**
|
|
45
|
+
* A preview: the design running, its controls responding to the pointer. It keeps the pan and
|
|
46
|
+
* zoom the canvas had before it fitted its frame, so leaving it returns there.
|
|
47
|
+
*/
|
|
48
|
+
export interface PlayView {
|
|
49
|
+
id: 'play'
|
|
50
|
+
revision: number
|
|
51
|
+
returnTo: ViewportPlace
|
|
52
|
+
}
|
|
53
|
+
|
|
44
54
|
/**
|
|
45
55
|
* Shader Mode: one shader paint of a layer shown large on its own, to play, scrub, and tune. The
|
|
46
56
|
* paint is named by its image, which stays with the shader however the layer's paints move.
|
|
@@ -56,11 +66,7 @@ export interface ShaderView {
|
|
|
56
66
|
* controls respond to the pointer, that preview presented a slide at a time, or one shader in
|
|
57
67
|
* Shader Mode. Each pane has its own.
|
|
58
68
|
*/
|
|
59
|
-
export type CanvasView =
|
|
60
|
-
| { id: 'edit' }
|
|
61
|
-
| { id: 'play'; revision: number }
|
|
62
|
-
| PresentView
|
|
63
|
-
| ShaderView
|
|
69
|
+
export type CanvasView = { id: 'edit' } | PlayView | PresentView | ShaderView
|
|
64
70
|
|
|
65
71
|
/**
|
|
66
72
|
* How the editor behaves for a canvas, resolved from what the document is for and the view it
|
|
@@ -9,6 +9,7 @@ import { styleDetachmentChanges } from '@pairdraw/scene-graph/shared-styles'
|
|
|
9
9
|
import { claimSlotContent, slotScope } from '@pairdraw/scene-graph/slots'
|
|
10
10
|
|
|
11
11
|
import { assertNodeEditable } from '#core/editor/capabilities'
|
|
12
|
+
import { flushPendingComponentSync } from '#core/figma-api/pending-sync'
|
|
12
13
|
import type { NodeProxyHost } from '#core/figma-api/proxy'
|
|
13
14
|
import { textAutoResizeChanges } from '#core/layout/text-auto-resize'
|
|
14
15
|
|
|
@@ -30,7 +31,9 @@ export function graph(target: ProxyThis, internals: NodeProxyInternals): SceneGr
|
|
|
30
31
|
|
|
31
32
|
export function raw(target: ProxyThis, internals: NodeProxyInternals): SceneNode {
|
|
32
33
|
const id = nodeId(target, internals)
|
|
33
|
-
const
|
|
34
|
+
const scene = graph(target, internals)
|
|
35
|
+
flushPendingComponentSync(scene, id)
|
|
36
|
+
const node = scene.getNode(id)
|
|
34
37
|
if (!node) throw new Error(`Node ${id} has been removed`)
|
|
35
38
|
return node
|
|
36
39
|
}
|