@pairdraw/core 0.17.0 → 0.19.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/effects.d.ts +5 -11
- package/dist/canvas/effects.d.ts.map +1 -1
- package/dist/canvas/effects.js +25 -30
- package/dist/canvas/effects.js.map +1 -1
- package/dist/canvas/labels/hit-test.d.ts +5 -0
- package/dist/canvas/labels/hit-test.d.ts.map +1 -1
- package/dist/canvas/labels/hit-test.js +1 -1
- package/dist/canvas/labels/hit-test.js.map +1 -1
- package/dist/canvas/labels/paragraph-cache.d.ts.map +1 -1
- package/dist/canvas/labels/paragraph-cache.js +3 -2
- package/dist/canvas/labels/paragraph-cache.js.map +1 -1
- package/dist/canvas/labels/selection.js +3 -2
- package/dist/canvas/labels/selection.js.map +1 -1
- package/dist/canvas/labels/style.d.ts +1 -1
- package/dist/canvas/node-edit-overlay.js +2 -2
- package/dist/canvas/node-edit-overlay.js.map +1 -1
- package/dist/canvas/outline-stroke.d.ts.map +1 -1
- package/dist/canvas/outline-stroke.js.map +1 -1
- package/dist/canvas/overlays/index.d.ts +2 -2
- package/dist/canvas/overlays/index.js +2 -2
- package/dist/canvas/overlays/prototype.d.ts +2 -5
- package/dist/canvas/overlays/prototype.d.ts.map +1 -1
- package/dist/canvas/overlays/prototype.js +3 -19
- package/dist/canvas/overlays/prototype.js.map +1 -1
- package/dist/canvas/overlays/selection.d.ts +1 -2
- package/dist/canvas/overlays/selection.d.ts.map +1 -1
- package/dist/canvas/overlays/selection.js +4 -37
- package/dist/canvas/overlays/selection.js.map +1 -1
- package/dist/canvas/region-hatch.js +3 -2
- package/dist/canvas/region-hatch.js.map +1 -1
- package/dist/canvas/renderer/colors.d.ts.map +1 -1
- package/dist/canvas/renderer/colors.js +36 -18
- package/dist/canvas/renderer/colors.js.map +1 -1
- package/dist/canvas/renderer/font-waiters.d.ts +9 -0
- package/dist/canvas/renderer/font-waiters.d.ts.map +1 -0
- package/dist/canvas/renderer/font-waiters.js +26 -0
- package/dist/canvas/renderer/font-waiters.js.map +1 -0
- package/dist/canvas/renderer/fonts.d.ts +4 -2
- package/dist/canvas/renderer/fonts.d.ts.map +1 -1
- package/dist/canvas/renderer/fonts.js +25 -10
- package/dist/canvas/renderer/fonts.js.map +1 -1
- package/dist/canvas/renderer/lifecycle.d.ts.map +1 -1
- package/dist/canvas/renderer/lifecycle.js +6 -9
- package/dist/canvas/renderer/lifecycle.js.map +1 -1
- package/dist/canvas/renderer/methods.d.ts +4 -5
- package/dist/canvas/renderer/methods.d.ts.map +1 -1
- package/dist/canvas/renderer/methods.js +1 -4
- package/dist/canvas/renderer/methods.js.map +1 -1
- package/dist/canvas/renderer/paints.d.ts.map +1 -1
- package/dist/canvas/renderer/paints.js +0 -6
- package/dist/canvas/renderer/paints.js.map +1 -1
- package/dist/canvas/renderer/pipeline.d.ts.map +1 -1
- package/dist/canvas/renderer/pipeline.js +20 -2
- package/dist/canvas/renderer/pipeline.js.map +1 -1
- package/dist/canvas/renderer/retained-backing.js +4 -4
- package/dist/canvas/renderer/retained-backing.js.map +1 -1
- package/dist/canvas/renderer/state.js +1 -1
- package/dist/canvas/renderer/state.js.map +1 -1
- package/dist/canvas/renderer/tiles/controller.d.ts +2 -0
- package/dist/canvas/renderer/tiles/controller.d.ts.map +1 -1
- package/dist/canvas/renderer/tiles/controller.js +8 -0
- package/dist/canvas/renderer/tiles/controller.js.map +1 -1
- package/dist/canvas/renderer/tiles/surface-pool.js +1 -1
- package/dist/canvas/renderer/tiles/surface-pool.js.map +1 -1
- package/dist/canvas/renderer/visual-bounds.d.ts.map +1 -1
- package/dist/canvas/renderer/visual-bounds.js +7 -5
- package/dist/canvas/renderer/visual-bounds.js.map +1 -1
- package/dist/canvas/renderer.d.ts +26 -7
- package/dist/canvas/renderer.d.ts.map +1 -1
- package/dist/canvas/renderer.js +50 -11
- package/dist/canvas/renderer.js.map +1 -1
- package/dist/canvas/rulers.d.ts +8 -1
- package/dist/canvas/rulers.d.ts.map +1 -1
- package/dist/canvas/rulers.js +30 -5
- package/dist/canvas/rulers.js.map +1 -1
- package/dist/canvas/scene.d.ts +2 -1
- package/dist/canvas/scene.d.ts.map +1 -1
- package/dist/canvas/scene.js +90 -54
- package/dist/canvas/scene.js.map +1 -1
- package/dist/canvas/shadows/shape.js +1 -1
- package/dist/canvas/shadows/shape.js.map +1 -1
- package/dist/canvas/shadows/silhouette.d.ts.map +1 -1
- package/dist/canvas/shadows/silhouette.js +4 -2
- package/dist/canvas/shadows/silhouette.js.map +1 -1
- package/dist/canvas/shadows.d.ts.map +1 -1
- package/dist/canvas/shadows.js +3 -2
- package/dist/canvas/shadows.js.map +1 -1
- package/dist/canvas/text/derived.d.ts +1 -2
- package/dist/canvas/text/derived.d.ts.map +1 -1
- package/dist/canvas/text/derived.js +1 -7
- package/dist/canvas/text/derived.js.map +1 -1
- package/dist/canvas/text/emoji/index.js +1 -1
- package/dist/canvas/text/emoji/raster.d.ts.map +1 -1
- package/dist/canvas/text/emoji/raster.js +14 -10
- package/dist/canvas/text/emoji/raster.js.map +1 -1
- package/dist/canvas/text/font-families.d.ts +4 -3
- package/dist/canvas/text/font-families.d.ts.map +1 -1
- package/dist/canvas/text/font-families.js +13 -9
- package/dist/canvas/text/font-families.js.map +1 -1
- package/dist/canvas/text/index.d.ts +1 -3
- package/dist/canvas/text/index.d.ts.map +1 -1
- package/dist/canvas/text/index.js +2 -9
- package/dist/canvas/text/index.js.map +1 -1
- package/dist/canvas/text/layout/build.d.ts.map +1 -1
- package/dist/canvas/text/layout/build.js +25 -9
- package/dist/canvas/text/layout/build.js.map +1 -1
- package/dist/canvas/text/layout/index.d.ts.map +1 -1
- package/dist/canvas/text/layout/index.js +8 -4
- package/dist/canvas/text/layout/index.js.map +1 -1
- package/dist/canvas/text/layout/lines.js +5 -3
- package/dist/canvas/text/layout/lines.js.map +1 -1
- package/dist/canvas/text/paragraph/index.d.ts +5 -0
- package/dist/canvas/text/paragraph/index.d.ts.map +1 -1
- package/dist/canvas/text/paragraph/index.js +18 -9
- package/dist/canvas/text/paragraph/index.js.map +1 -1
- package/dist/canvas/text/paragraph/inputs.d.ts +1 -1
- package/dist/canvas/text/paragraph/inputs.d.ts.map +1 -1
- package/dist/canvas/text/paragraph/inputs.js +9 -2
- package/dist/canvas/text/paragraph/inputs.js.map +1 -1
- package/dist/canvas/text/placed.js +3 -3
- package/dist/canvas/text/placed.js.map +1 -1
- package/dist/canvas/text/renderer.d.ts +2 -0
- package/dist/canvas/text/renderer.d.ts.map +1 -1
- package/dist/canvas/text/shape.d.ts +4 -3
- package/dist/canvas/text/shape.d.ts.map +1 -1
- package/dist/canvas/text/shape.js +9 -22
- package/dist/canvas/text/shape.js.map +1 -1
- package/dist/constants.d.ts +6 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +6 -2
- package/dist/constants.js.map +1 -1
- package/dist/design-jsx/renderer.d.ts.map +1 -1
- package/dist/editor/bridges/clipboard.d.ts +1 -0
- package/dist/editor/bridges/clipboard.js +1 -0
- package/dist/editor/bridges/clipboard.js.map +1 -1
- package/dist/editor/bridges/components.d.ts +2 -0
- package/dist/editor/bridges/components.d.ts.map +1 -1
- package/dist/editor/bridges/components.js +2 -0
- package/dist/editor/bridges/components.js.map +1 -1
- package/dist/editor/bridges/frames.d.ts +4 -3
- package/dist/editor/bridges/frames.d.ts.map +1 -1
- package/dist/editor/bridges/frames.js +6 -4
- package/dist/editor/bridges/frames.js.map +1 -1
- package/dist/editor/bridges/structure.d.ts +1 -0
- package/dist/editor/bridges/structure.d.ts.map +1 -1
- package/dist/editor/bridges/structure.js +1 -0
- package/dist/editor/bridges/structure.js.map +1 -1
- package/dist/editor/bridges/undo.d.ts +1 -1
- package/dist/editor/clipboard/detach.js +2 -2
- package/dist/editor/clipboard/detach.js.map +1 -1
- package/dist/editor/clipboard/paste/properties.js +1 -1
- package/dist/editor/clipboard/paste/target.js +2 -2
- package/dist/editor/clipboard/paste/target.js.map +1 -1
- package/dist/editor/clipboard/snapshot.d.ts +3 -0
- package/dist/editor/clipboard/snapshot.d.ts.map +1 -1
- package/dist/editor/clipboard/snapshot.js +2 -0
- package/dist/editor/clipboard/snapshot.js.map +1 -1
- package/dist/editor/clipboard/variables.d.ts.map +1 -1
- package/dist/editor/clipboard/variables.js +14 -1
- package/dist/editor/clipboard/variables.js.map +1 -1
- package/dist/editor/clipboard.d.ts +1 -0
- package/dist/editor/clipboard.d.ts.map +1 -1
- package/dist/editor/clipboard.js +122 -16
- package/dist/editor/clipboard.js.map +1 -1
- package/dist/editor/component-sync.d.ts +10 -1
- package/dist/editor/component-sync.d.ts.map +1 -1
- package/dist/editor/component-sync.js +25 -8
- package/dist/editor/component-sync.js.map +1 -1
- package/dist/editor/components/authoring/text-edit.d.ts.map +1 -1
- package/dist/editor/components/authoring/text-edit.js +11 -2
- package/dist/editor/components/authoring/text-edit.js.map +1 -1
- package/dist/editor/components/authoring/visibility-edit.d.ts.map +1 -1
- package/dist/editor/components/authoring/visibility-edit.js +7 -3
- package/dist/editor/components/authoring/visibility-edit.js.map +1 -1
- package/dist/editor/components/instances.d.ts +2 -0
- package/dist/editor/components/instances.d.ts.map +1 -1
- package/dist/editor/components/instances.js +37 -7
- package/dist/editor/components/instances.js.map +1 -1
- package/dist/editor/components/properties.d.ts.map +1 -1
- package/dist/editor/components/properties.js +3 -0
- package/dist/editor/components/properties.js.map +1 -1
- package/dist/editor/components/slots/authoring.js +2 -1
- package/dist/editor/components/slots/authoring.js.map +1 -1
- package/dist/editor/components.d.ts +2 -0
- package/dist/editor/components.d.ts.map +1 -1
- package/dist/editor/create.d.ts +18 -4
- package/dist/editor/create.d.ts.map +1 -1
- package/dist/editor/create.js +43 -6
- package/dist/editor/create.js.map +1 -1
- package/dist/editor/guides.d.ts.map +1 -1
- package/dist/editor/guides.js +20 -13
- package/dist/editor/guides.js.map +1 -1
- package/dist/editor/history/document-change.d.ts +19 -3
- package/dist/editor/history/document-change.d.ts.map +1 -1
- package/dist/editor/history/document-change.js +94 -8
- package/dist/editor/history/document-change.js.map +1 -1
- package/dist/editor/history/edit.d.ts.map +1 -1
- package/dist/editor/history/edit.js +56 -12
- package/dist/editor/history/edit.js.map +1 -1
- package/dist/editor/history/position.js +1 -4
- package/dist/editor/history/position.js.map +1 -1
- package/dist/editor/history/sources.d.ts +14 -0
- package/dist/editor/history/sources.d.ts.map +1 -0
- package/dist/editor/history/sources.js +24 -0
- package/dist/editor/history/sources.js.map +1 -0
- package/dist/editor/index.d.ts +2 -2
- package/dist/editor/index.js +1 -1
- package/dist/editor/layout-mode.d.ts.map +1 -1
- package/dist/editor/layout-mode.js +16 -1
- package/dist/editor/layout-mode.js.map +1 -1
- package/dist/editor/node-preview.d.ts.map +1 -1
- package/dist/editor/node-preview.js +26 -7
- package/dist/editor/node-preview.js.map +1 -1
- package/dist/editor/nodes.d.ts.map +1 -1
- package/dist/editor/nodes.js +33 -10
- package/dist/editor/nodes.js.map +1 -1
- package/dist/editor/nudge.d.ts.map +1 -1
- package/dist/editor/nudge.js +12 -2
- package/dist/editor/nudge.js.map +1 -1
- package/dist/editor/pages.d.ts +2 -1
- package/dist/editor/pages.d.ts.map +1 -1
- package/dist/editor/pages.js +94 -15
- package/dist/editor/pages.js.map +1 -1
- package/dist/editor/play/states.d.ts.map +1 -1
- package/dist/editor/play/states.js +0 -5
- package/dist/editor/play/states.js.map +1 -1
- package/dist/editor/read-only/actions.js +3 -0
- package/dist/editor/read-only/actions.js.map +1 -1
- package/dist/editor/selection/hit-test.d.ts +2 -1
- package/dist/editor/selection/hit-test.d.ts.map +1 -1
- package/dist/editor/selection/hit-test.js +29 -4
- package/dist/editor/selection/hit-test.js.map +1 -1
- package/dist/editor/selection.d.ts +2 -2
- package/dist/editor/selection.d.ts.map +1 -1
- package/dist/editor/shapes/pen.js +6 -2
- package/dist/editor/shapes/pen.js.map +1 -1
- package/dist/editor/shapes.d.ts.map +1 -1
- package/dist/editor/shapes.js +2 -1
- package/dist/editor/shapes.js.map +1 -1
- package/dist/editor/structure/auto-layout-wrap.d.ts.map +1 -1
- package/dist/editor/structure/auto-layout-wrap.js +12 -0
- package/dist/editor/structure/auto-layout-wrap.js.map +1 -1
- package/dist/editor/structure/boolean.js +1 -1
- package/dist/editor/structure/group/bounds.d.ts +4 -2
- package/dist/editor/structure/group/bounds.d.ts.map +1 -1
- package/dist/editor/structure/group/bounds.js +17 -4
- package/dist/editor/structure/group/bounds.js.map +1 -1
- package/dist/editor/structure/rename.d.ts +2 -3
- package/dist/editor/structure/rename.d.ts.map +1 -1
- package/dist/editor/structure/rename.js +2 -5
- package/dist/editor/structure/rename.js.map +1 -1
- package/dist/editor/structure/reorder.d.ts.map +1 -1
- package/dist/editor/structure/reorder.js +20 -9
- package/dist/editor/structure/reorder.js.map +1 -1
- package/dist/editor/structure/state.js +1 -1
- package/dist/editor/structure.d.ts +1 -0
- package/dist/editor/structure.d.ts.map +1 -1
- package/dist/editor/structure.js +76 -20
- package/dist/editor/structure.js.map +1 -1
- package/dist/editor/text/hyperlink.d.ts.map +1 -1
- package/dist/editor/text/hyperlink.js +1 -1
- package/dist/editor/text/hyperlink.js.map +1 -1
- package/dist/editor/text/name.d.ts +13 -5
- package/dist/editor/text/name.d.ts.map +1 -1
- package/dist/editor/text/name.js +47 -17
- package/dist/editor/text/name.js.map +1 -1
- package/dist/editor/text/pending-layout.d.ts +2 -1
- package/dist/editor/text/pending-layout.d.ts.map +1 -1
- package/dist/editor/text/pending-layout.js +33 -6
- package/dist/editor/text/pending-layout.js.map +1 -1
- package/dist/editor/text/selection-style.d.ts +1 -0
- package/dist/editor/text/selection-style.d.ts.map +1 -1
- package/dist/editor/text/selection-style.js +16 -4
- package/dist/editor/text/selection-style.js.map +1 -1
- package/dist/editor/text.d.ts +5 -0
- package/dist/editor/text.d.ts.map +1 -1
- package/dist/editor/text.js +70 -3
- package/dist/editor/text.js.map +1 -1
- package/dist/editor/types.d.ts +18 -1
- package/dist/editor/types.d.ts.map +1 -1
- package/dist/editor/undo.d.ts.map +1 -1
- package/dist/editor/undo.js +14 -2
- package/dist/editor/undo.js.map +1 -1
- package/dist/editor/variable-bindings.d.ts.map +1 -1
- package/dist/editor/variable-bindings.js +21 -2
- package/dist/editor/variable-bindings.js.map +1 -1
- package/dist/editor/variables.d.ts +1 -1
- package/dist/editor/variables.d.ts.map +1 -1
- package/dist/editor/variables.js +7 -8
- package/dist/editor/variables.js.map +1 -1
- package/dist/editor/viewport.d.ts +11 -2
- package/dist/editor/viewport.d.ts.map +1 -1
- package/dist/editor/viewport.js +61 -21
- package/dist/editor/viewport.js.map +1 -1
- package/dist/editor/views/actions.d.ts.map +1 -1
- package/dist/editor/views/actions.js +13 -5
- package/dist/editor/views/actions.js.map +1 -1
- package/dist/editor/views/present.d.ts +6 -4
- package/dist/editor/views/present.d.ts.map +1 -1
- package/dist/editor/views/present.js +12 -10
- package/dist/editor/views/present.js.map +1 -1
- package/dist/editor/views/types.d.ts +11 -5
- package/dist/editor/views/types.d.ts.map +1 -1
- package/dist/figma-api/accessor-utils.d.ts.map +1 -1
- package/dist/figma-api/accessor-utils.js +4 -1
- package/dist/figma-api/accessor-utils.js.map +1 -1
- package/dist/figma-api/accessors/basic.d.ts.map +1 -1
- package/dist/figma-api/accessors/basic.js +41 -21
- package/dist/figma-api/accessors/basic.js.map +1 -1
- package/dist/figma-api/accessors/layout.d.ts.map +1 -1
- package/dist/figma-api/accessors/layout.js +37 -7
- package/dist/figma-api/accessors/layout.js.map +1 -1
- package/dist/figma-api/accessors/reactions.d.ts +11 -0
- package/dist/figma-api/accessors/reactions.d.ts.map +1 -0
- package/dist/figma-api/accessors/reactions.js +30 -0
- package/dist/figma-api/accessors/reactions.js.map +1 -0
- package/dist/figma-api/accessors/strokes.d.ts.map +1 -1
- package/dist/figma-api/accessors/strokes.js +12 -4
- package/dist/figma-api/accessors/strokes.js.map +1 -1
- package/dist/figma-api/accessors/text/index.d.ts.map +1 -1
- package/dist/figma-api/accessors/text/index.js +3 -1
- package/dist/figma-api/accessors/text/index.js.map +1 -1
- package/dist/figma-api/accessors/vector.d.ts.map +1 -1
- package/dist/figma-api/accessors/vector.js +1 -1
- package/dist/figma-api/accessors/vector.js.map +1 -1
- package/dist/figma-api/accessors/visual.d.ts +6 -5
- package/dist/figma-api/accessors/visual.d.ts.map +1 -1
- package/dist/figma-api/accessors/visual.js +20 -17
- package/dist/figma-api/accessors/visual.js.map +1 -1
- package/dist/figma-api/components.d.ts.map +1 -1
- package/dist/figma-api/components.js +2 -1
- package/dist/figma-api/components.js.map +1 -1
- package/dist/figma-api/finite.d.ts +27 -0
- package/dist/figma-api/finite.d.ts.map +1 -0
- package/dist/figma-api/finite.js +69 -0
- package/dist/figma-api/finite.js.map +1 -0
- package/dist/figma-api/fonts/list.d.ts +13 -0
- package/dist/figma-api/fonts/list.d.ts.map +1 -0
- package/dist/figma-api/fonts/list.js +25 -0
- package/dist/figma-api/fonts/list.js.map +1 -0
- package/dist/figma-api/index.d.ts +63 -10
- package/dist/figma-api/index.d.ts.map +1 -1
- package/dist/figma-api/index.js +104 -17
- package/dist/figma-api/index.js.map +1 -1
- package/dist/figma-api/overrides.d.ts +6 -1
- package/dist/figma-api/overrides.d.ts.map +1 -1
- package/dist/figma-api/overrides.js +2 -2
- package/dist/figma-api/overrides.js.map +1 -1
- package/dist/figma-api/pending-layout.d.ts +12 -2
- package/dist/figma-api/pending-layout.d.ts.map +1 -1
- package/dist/figma-api/pending-layout.js +41 -1
- package/dist/figma-api/pending-layout.js.map +1 -1
- package/dist/figma-api/pending-sync.d.ts +19 -0
- package/dist/figma-api/pending-sync.d.ts.map +1 -0
- package/dist/figma-api/pending-sync.js +52 -0
- package/dist/figma-api/pending-sync.js.map +1 -0
- package/dist/figma-api/proxy.d.ts +15 -2
- package/dist/figma-api/proxy.d.ts.map +1 -1
- package/dist/figma-api/proxy.js +23 -3
- package/dist/figma-api/proxy.js.map +1 -1
- package/dist/figma-api/reactions.d.ts +104 -0
- package/dist/figma-api/reactions.d.ts.map +1 -0
- package/dist/figma-api/reactions.js +157 -0
- package/dist/figma-api/reactions.js.map +1 -0
- package/dist/figma-api/render-bounds.d.ts.map +1 -1
- package/dist/figma-api/render-bounds.js +4 -4
- package/dist/figma-api/render-bounds.js.map +1 -1
- package/dist/figma-api/serialization.js +12 -2
- package/dist/figma-api/serialization.js.map +1 -1
- package/dist/figma-api/slots.d.ts +7 -1
- package/dist/figma-api/slots.d.ts.map +1 -1
- package/dist/figma-api/slots.js +12 -4
- package/dist/figma-api/slots.js.map +1 -1
- package/dist/figma-api/strokes.d.ts +5 -2
- package/dist/figma-api/strokes.d.ts.map +1 -1
- package/dist/figma-api/strokes.js +12 -19
- package/dist/figma-api/strokes.js.map +1 -1
- package/dist/figma-api/text/bindings.js +1 -1
- package/dist/figma-api/text/index.d.ts +2 -3
- package/dist/figma-api/text/index.d.ts.map +1 -1
- package/dist/figma-api/text/index.js +2 -12
- package/dist/figma-api/text/index.js.map +1 -1
- package/dist/figma-api/variables/bindings.js +1 -1
- package/dist/figma-api/variables/variable.d.ts.map +1 -1
- package/dist/figma-api/variables/variable.js +2 -2
- package/dist/figma-api/variables/variable.js.map +1 -1
- package/dist/geometry/connectors.js +2 -14
- package/dist/geometry/connectors.js.map +1 -1
- package/dist/geometry/figma.d.ts +6 -1
- package/dist/geometry/figma.d.ts.map +1 -1
- package/dist/geometry/figma.js +8 -1
- package/dist/geometry/figma.js.map +1 -1
- package/dist/geometry/index.d.ts +3 -3
- package/dist/geometry/index.js +2 -2
- package/dist/geometry/scene.d.ts +3 -1
- package/dist/geometry/scene.d.ts.map +1 -1
- package/dist/geometry/scene.js +16 -1
- package/dist/geometry/scene.js.map +1 -1
- package/dist/geometry/types.d.ts +7 -1
- package/dist/geometry/types.d.ts.map +1 -1
- package/dist/icons/api.d.ts +3 -2
- package/dist/icons/api.d.ts.map +1 -1
- package/dist/icons/api.js +12 -12
- package/dist/icons/api.js.map +1 -1
- package/dist/icons/provider.d.ts +4 -3
- package/dist/icons/provider.d.ts.map +1 -1
- package/dist/icons/provider.js +6 -13
- package/dist/icons/provider.js.map +1 -1
- package/dist/icons/schema.d.ts +33 -1
- package/dist/icons/schema.d.ts.map +1 -1
- package/dist/icons/schema.js +30 -1
- package/dist/icons/schema.js.map +1 -1
- package/dist/icons/svg/presentation.d.ts +8 -1
- package/dist/icons/svg/presentation.d.ts.map +1 -1
- package/dist/icons/svg/presentation.js +21 -3
- package/dist/icons/svg/presentation.js.map +1 -1
- package/dist/icons/svg/text.js +1 -1
- package/dist/icons/svg/text.js.map +1 -1
- package/dist/icons/svg.d.ts +8 -3
- package/dist/icons/svg.d.ts.map +1 -1
- package/dist/icons/svg.js +15 -13
- package/dist/icons/svg.js.map +1 -1
- package/dist/icons/types.d.ts +1 -19
- package/dist/icons/types.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/io/formats/design-tokens/css/read.js +1 -1
- package/dist/io/formats/design-tokens/decode.js +1 -1
- package/dist/io/formats/design-tokens/plan/index.js +4 -2
- package/dist/io/formats/design-tokens/plan/index.js.map +1 -1
- package/dist/io/formats/design-tokens/plan/styles.d.ts +9 -1
- package/dist/io/formats/design-tokens/plan/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/plan/styles.js +23 -3
- package/dist/io/formats/design-tokens/plan/styles.js.map +1 -1
- package/dist/io/formats/design-tokens/styles.d.ts +9 -1
- package/dist/io/formats/design-tokens/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/styles.js +41 -4
- package/dist/io/formats/design-tokens/styles.js.map +1 -1
- package/dist/io/formats/design-tokens/types.d.ts +5 -0
- package/dist/io/formats/design-tokens/types.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/types.js +1 -0
- package/dist/io/formats/design-tokens/types.js.map +1 -1
- package/dist/io/formats/drawio/export.d.ts.map +1 -1
- package/dist/io/formats/drawio/export.js +10 -0
- package/dist/io/formats/drawio/export.js.map +1 -1
- package/dist/io/formats/drawio/index.d.ts.map +1 -1
- package/dist/io/formats/drawio/index.js +32 -1
- package/dist/io/formats/drawio/index.js.map +1 -1
- package/dist/io/formats/drawio/shapes.d.ts +10 -5
- package/dist/io/formats/drawio/shapes.d.ts.map +1 -1
- package/dist/io/formats/drawio/shapes.js +10 -6
- package/dist/io/formats/drawio/shapes.js.map +1 -1
- package/dist/io/formats/drawio/warnings.d.ts +11 -0
- package/dist/io/formats/drawio/warnings.d.ts.map +1 -0
- package/dist/io/formats/drawio/warnings.js +23 -0
- package/dist/io/formats/drawio/warnings.js.map +1 -0
- package/dist/io/formats/fig/export/setup.d.ts.map +1 -1
- package/dist/io/formats/fig/export/setup.js +8 -4
- package/dist/io/formats/fig/export/setup.js.map +1 -1
- package/dist/io/formats/fig/export/variables.d.ts.map +1 -1
- package/dist/io/formats/fig/export/variables.js +2 -2
- package/dist/io/formats/fig/export/variables.js.map +1 -1
- package/dist/io/formats/fig/index.d.ts +2 -2
- package/dist/io/formats/fig/index.js +2 -2
- package/dist/io/formats/fig/read.d.ts +9 -2
- package/dist/io/formats/fig/read.d.ts.map +1 -1
- package/dist/io/formats/fig/read.js +44 -20
- package/dist/io/formats/fig/read.js.map +1 -1
- package/dist/io/formats/html/index.d.ts.map +1 -1
- package/dist/io/formats/html/index.js +2 -6
- package/dist/io/formats/html/index.js.map +1 -1
- package/dist/io/formats/pdf/dom.d.ts +10 -1
- package/dist/io/formats/pdf/dom.d.ts.map +1 -1
- package/dist/io/formats/pdf/dom.js +96 -2
- package/dist/io/formats/pdf/dom.js.map +1 -1
- package/dist/io/formats/pdf/export.js +3 -2
- package/dist/io/formats/pdf/export.js.map +1 -1
- package/dist/io/formats/pdf/prepare.js +1 -1
- package/dist/io/formats/pen/fonts.d.ts +14 -0
- package/dist/io/formats/pen/fonts.d.ts.map +1 -0
- package/dist/io/formats/pen/fonts.js +39 -0
- package/dist/io/formats/pen/fonts.js.map +1 -0
- package/dist/io/formats/pen/index.d.ts.map +1 -1
- package/dist/io/formats/pen/index.js +25 -6
- package/dist/io/formats/pen/index.js.map +1 -1
- package/dist/io/formats/raster/headless.d.ts +3 -3
- package/dist/io/formats/raster/headless.d.ts.map +1 -1
- package/dist/io/formats/raster/headless.js +25 -14
- package/dist/io/formats/raster/headless.js.map +1 -1
- package/dist/io/formats/raster/index.d.ts +2 -2
- package/dist/io/formats/raster/index.js +2 -2
- package/dist/io/formats/raster/render.d.ts +8 -2
- package/dist/io/formats/raster/render.d.ts.map +1 -1
- package/dist/io/formats/raster/render.js +42 -8
- package/dist/io/formats/raster/render.js.map +1 -1
- package/dist/io/formats/svg/export.d.ts.map +1 -1
- package/dist/io/formats/svg/export.js +28 -24
- package/dist/io/formats/svg/export.js.map +1 -1
- package/dist/io/formats/svg/paths.d.ts +8 -2
- package/dist/io/formats/svg/paths.d.ts.map +1 -1
- package/dist/io/formats/svg/paths.js +11 -3
- package/dist/io/formats/svg/paths.js.map +1 -1
- package/dist/io/formats/svg/strokes.d.ts.map +1 -1
- package/dist/io/formats/svg/strokes.js +2 -5
- package/dist/io/formats/svg/strokes.js.map +1 -1
- package/dist/io/formats/svg/text/export.d.ts.map +1 -1
- package/dist/io/formats/svg/text/export.js +19 -1
- package/dist/io/formats/svg/text/export.js.map +1 -1
- package/dist/io/formats/svg/text/import.d.ts.map +1 -1
- package/dist/io/formats/svg/text/import.js +2 -1
- package/dist/io/formats/svg/text/import.js.map +1 -1
- package/dist/io/formats.d.ts.map +1 -1
- package/dist/io/formats.js +3 -1
- package/dist/io/formats.js.map +1 -1
- package/dist/io/registry.d.ts +2 -0
- package/dist/io/registry.d.ts.map +1 -1
- package/dist/io/registry.js +5 -0
- package/dist/io/registry.js.map +1 -1
- package/dist/io/subgraph.d.ts.map +1 -1
- package/dist/io/subgraph.js +5 -2
- package/dist/io/subgraph.js.map +1 -1
- package/dist/io/types.d.ts +2 -0
- package/dist/io/types.d.ts.map +1 -1
- package/dist/kiwi/fig/population/client.d.ts.map +1 -1
- package/dist/kiwi/fig/population/client.js +63 -45
- package/dist/kiwi/fig/population/client.js.map +1 -1
- package/dist/kiwi/fig/population/delta.d.ts +34 -3
- package/dist/kiwi/fig/population/delta.d.ts.map +1 -1
- package/dist/kiwi/fig/population/delta.js +99 -16
- package/dist/kiwi/fig/population/delta.js.map +1 -1
- package/dist/kiwi/fig/population/edits.d.ts +51 -0
- package/dist/kiwi/fig/population/edits.d.ts.map +1 -0
- package/dist/kiwi/fig/population/edits.js +169 -0
- package/dist/kiwi/fig/population/edits.js.map +1 -0
- package/dist/kiwi/fig/session/archive/access.d.ts +3 -0
- package/dist/kiwi/fig/session/archive/access.d.ts.map +1 -1
- package/dist/kiwi/fig/session/archive/access.js +8 -1
- package/dist/kiwi/fig/session/archive/access.js.map +1 -1
- package/dist/kiwi/fig/session/archive/changes.d.ts +2 -1
- package/dist/kiwi/fig/session/archive/changes.d.ts.map +1 -1
- package/dist/kiwi/fig/session/archive/changes.js +12 -5
- package/dist/kiwi/fig/session/archive/changes.js.map +1 -1
- package/dist/kiwi/fig/session/document-state.d.ts +7 -1
- package/dist/kiwi/fig/session/document-state.d.ts.map +1 -1
- package/dist/kiwi/fig/session/document-state.js +16 -2
- package/dist/kiwi/fig/session/document-state.js.map +1 -1
- package/dist/kiwi/fig/session/protocol.d.ts +31 -3
- package/dist/kiwi/fig/session/protocol.d.ts.map +1 -1
- package/dist/kiwi/fig/session/worker.js +33 -8
- package/dist/kiwi/fig/session/worker.js.map +1 -1
- package/dist/layout/apply.d.ts +6 -1
- package/dist/layout/apply.d.ts.map +1 -1
- package/dist/layout/apply.js +39 -14
- package/dist/layout/apply.js.map +1 -1
- package/dist/layout/arrange/boxes.d.ts.map +1 -1
- package/dist/layout/arrange/boxes.js +31 -0
- package/dist/layout/arrange/boxes.js.map +1 -1
- package/dist/layout/flow-edges.d.ts +26 -0
- package/dist/layout/flow-edges.d.ts.map +1 -0
- package/dist/layout/flow-edges.js +105 -0
- package/dist/layout/flow-edges.js.map +1 -0
- package/dist/layout/grid.d.ts.map +1 -1
- package/dist/layout/grid.js +9 -5
- package/dist/layout/grid.js.map +1 -1
- package/dist/layout/text-auto-resize.d.ts.map +1 -1
- package/dist/layout/text-auto-resize.js +9 -4
- package/dist/layout/text-auto-resize.js.map +1 -1
- package/dist/layout/text-measurement.d.ts +15 -1
- package/dist/layout/text-measurement.d.ts.map +1 -1
- package/dist/layout/text-measurement.js +40 -4
- package/dist/layout/text-measurement.js.map +1 -1
- package/dist/layout/variables.d.ts +1 -1
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +35 -35
- package/dist/layout.js.map +1 -1
- package/dist/library/asset-keys.d.ts +3 -2
- package/dist/library/asset-keys.d.ts.map +1 -1
- package/dist/library/asset-keys.js +4 -3
- package/dist/library/asset-keys.js.map +1 -1
- package/dist/library/copied-references.d.ts +8 -3
- package/dist/library/copied-references.d.ts.map +1 -1
- package/dist/library/copied-references.js +15 -5
- package/dist/library/copied-references.js.map +1 -1
- package/dist/library/materialize.js +1 -1
- package/dist/library/materialize.js.map +1 -1
- package/dist/library/schema.js.map +1 -1
- package/dist/library/snapshot.d.ts.map +1 -1
- package/dist/library/snapshot.js +11 -2
- package/dist/library/snapshot.js.map +1 -1
- package/dist/lint/linter.d.ts.map +1 -1
- package/dist/lint/linter.js +11 -2
- package/dist/lint/linter.js.map +1 -1
- package/dist/pairdraw-api/variables.d.ts.map +1 -1
- package/dist/pairdraw-api/variables.js +0 -2
- package/dist/pairdraw-api/variables.js.map +1 -1
- package/dist/profiler/hud-controller.d.ts +4 -3
- package/dist/profiler/hud-controller.d.ts.map +1 -1
- package/dist/profiler/hud-controller.js +7 -5
- package/dist/profiler/hud-controller.js.map +1 -1
- package/dist/profiler/hud-renderer.d.ts +5 -2
- package/dist/profiler/hud-renderer.d.ts.map +1 -1
- package/dist/profiler/hud-renderer.js +8 -5
- package/dist/profiler/hud-renderer.js.map +1 -1
- package/dist/profiler/render-profiler.d.ts +3 -2
- package/dist/profiler/render-profiler.d.ts.map +1 -1
- package/dist/profiler/render-profiler.js +3 -2
- package/dist/profiler/render-profiler.js.map +1 -1
- package/dist/rpc/variables-command.d.ts.map +1 -1
- package/dist/rpc/variables-command.js +4 -2
- package/dist/rpc/variables-command.js.map +1 -1
- package/dist/text/character-style.d.ts +11 -1
- package/dist/text/character-style.d.ts.map +1 -1
- package/dist/text/character-style.js +27 -5
- package/dist/text/character-style.js.map +1 -1
- package/dist/text/coverage.d.ts.map +1 -1
- package/dist/text/coverage.js +16 -14
- package/dist/text/coverage.js.map +1 -1
- package/dist/text/editor.d.ts.map +1 -1
- package/dist/text/editor.js +3 -8
- package/dist/text/editor.js.map +1 -1
- package/dist/text/fallbacks.d.ts +26 -3
- package/dist/text/fallbacks.d.ts.map +1 -1
- package/dist/text/fallbacks.js +135 -18
- package/dist/text/fallbacks.js.map +1 -1
- package/dist/text/font/catalog.d.ts +4 -0
- package/dist/text/font/catalog.d.ts.map +1 -1
- package/dist/text/font/catalog.js +8 -0
- package/dist/text/font/catalog.js.map +1 -1
- package/dist/text/font/collection.d.ts +13 -0
- package/dist/text/font/collection.d.ts.map +1 -0
- package/dist/text/font/collection.js +51 -0
- package/dist/text/font/collection.js.map +1 -0
- package/dist/text/font/faces.d.ts +2 -1
- package/dist/text/font/faces.d.ts.map +1 -1
- package/dist/text/font/faces.js +9 -5
- package/dist/text/font/faces.js.map +1 -1
- package/dist/text/font/glyphs.d.ts +14 -3
- package/dist/text/font/glyphs.d.ts.map +1 -1
- package/dist/text/font/glyphs.js +22 -5
- package/dist/text/font/glyphs.js.map +1 -1
- package/dist/text/font/local.js +2 -2
- package/dist/text/font/local.js.map +1 -1
- package/dist/text/font/manager.d.ts +50 -6
- package/dist/text/font/manager.d.ts.map +1 -1
- package/dist/text/font/manager.js +178 -32
- package/dist/text/font/manager.js.map +1 -1
- package/dist/text/font/style.d.ts +7 -2
- package/dist/text/font/style.d.ts.map +1 -1
- package/dist/text/font/style.js +31 -3
- package/dist/text/font/style.js.map +1 -1
- package/dist/text/index.d.ts +5 -4
- package/dist/text/index.js +5 -4
- package/dist/text/outlines.d.ts.map +1 -1
- package/dist/text/outlines.js +71 -71
- package/dist/text/outlines.js.map +1 -1
- package/dist/text/path/caret.d.ts +2 -4
- package/dist/text/path/caret.d.ts.map +1 -1
- package/dist/text/path/caret.js.map +1 -1
- package/dist/text/prepare.d.ts +5 -1
- package/dist/text/prepare.d.ts.map +1 -1
- package/dist/text/prepare.js +26 -3
- package/dist/text/prepare.js.map +1 -1
- package/dist/text/style-runs.d.ts +14 -2
- package/dist/text/style-runs.d.ts.map +1 -1
- package/dist/text/style-runs.js +22 -14
- package/dist/text/style-runs.js.map +1 -1
- package/dist/text/web-font/assets.d.ts.map +1 -1
- package/dist/text/web-font/assets.js +13 -21
- package/dist/text/web-font/assets.js.map +1 -1
- package/dist/text/web-font/resolver.d.ts.map +1 -1
- package/dist/text/web-font/resolver.js +4 -1
- package/dist/text/web-font/resolver.js.map +1 -1
- package/dist/tools/analyze/overlaps/helpers.d.ts.map +1 -1
- package/dist/tools/analyze/overlaps/helpers.js +9 -1
- package/dist/tools/analyze/overlaps/helpers.js.map +1 -1
- package/dist/tools/analyze/overlaps/index.d.ts.map +1 -1
- package/dist/tools/analyze/overlaps/index.js +27 -5
- package/dist/tools/analyze/overlaps/index.js.map +1 -1
- package/dist/tools/codegen/component-map.js +3 -3
- package/dist/tools/codegen/component-map.js.map +1 -1
- package/dist/tools/create/basic.d.ts.map +1 -1
- package/dist/tools/create/basic.js +5 -4
- package/dist/tools/create/basic.js.map +1 -1
- package/dist/tools/create/components.d.ts +2 -1
- package/dist/tools/create/components.d.ts.map +1 -1
- package/dist/tools/create/components.js +27 -1
- package/dist/tools/create/components.js.map +1 -1
- package/dist/tools/create/html.d.ts.map +1 -1
- package/dist/tools/create/html.js +4 -2
- package/dist/tools/create/html.js.map +1 -1
- package/dist/tools/create/icons.d.ts.map +1 -1
- package/dist/tools/create/icons.js +14 -6
- package/dist/tools/create/icons.js.map +1 -1
- package/dist/tools/create/mermaid.d.ts.map +1 -1
- package/dist/tools/create/mermaid.js +2 -0
- package/dist/tools/create/mermaid.js.map +1 -1
- package/dist/tools/create/render.d.ts.map +1 -1
- package/dist/tools/create/render.js +2 -0
- package/dist/tools/create/render.js.map +1 -1
- package/dist/tools/create/script.js +3 -1
- package/dist/tools/create/script.js.map +1 -1
- package/dist/tools/create/svg.d.ts.map +1 -1
- package/dist/tools/create/svg.js +4 -1
- package/dist/tools/create/svg.js.map +1 -1
- package/dist/tools/create/vector.d.ts.map +1 -1
- package/dist/tools/create/vector.js +13 -10
- package/dist/tools/create/vector.js.map +1 -1
- package/dist/tools/create.d.ts +2 -2
- package/dist/tools/create.js +2 -2
- package/dist/tools/image-ai/apply.js +1 -1
- package/dist/tools/image-ai/generate.d.ts.map +1 -1
- package/dist/tools/image-ai/generate.js +3 -0
- package/dist/tools/image-ai/generate.js.map +1 -1
- package/dist/tools/modify/effects.d.ts.map +1 -1
- package/dist/tools/modify/effects.js +5 -3
- package/dist/tools/modify/effects.js.map +1 -1
- package/dist/tools/modify/matching.d.ts.map +1 -1
- package/dist/tools/modify/matching.js +9 -6
- package/dist/tools/modify/matching.js.map +1 -1
- package/dist/tools/modify/paint.d.ts.map +1 -1
- package/dist/tools/modify/paint.js +7 -5
- package/dist/tools/modify/paint.js.map +1 -1
- package/dist/tools/modify/reactions.d.ts +6 -0
- package/dist/tools/modify/reactions.d.ts.map +1 -0
- package/dist/tools/modify/reactions.js +35 -0
- package/dist/tools/modify/reactions.js.map +1 -0
- package/dist/tools/modify/text.d.ts.map +1 -1
- package/dist/tools/modify/text.js +28 -8
- package/dist/tools/modify/text.js.map +1 -1
- package/dist/tools/modify.d.ts +2 -1
- package/dist/tools/modify.js +2 -1
- package/dist/tools/read/components.js +20 -22
- package/dist/tools/read/components.js.map +1 -1
- package/dist/tools/read/fonts.js +1 -1
- package/dist/tools/read/fonts.js.map +1 -1
- package/dist/tools/read/libraries.d.ts.map +1 -1
- package/dist/tools/read/libraries.js +18 -4
- package/dist/tools/read/libraries.js.map +1 -1
- package/dist/tools/read/nodes.d.ts.map +1 -1
- package/dist/tools/read/nodes.js +38 -16
- package/dist/tools/read/nodes.js.map +1 -1
- package/dist/tools/read/pages.d.ts.map +1 -1
- package/dist/tools/read/pages.js +4 -3
- package/dist/tools/read/pages.js.map +1 -1
- package/dist/tools/read/query.js +1 -0
- package/dist/tools/read/query.js.map +1 -1
- package/dist/tools/read/reactions.d.ts +6 -0
- package/dist/tools/read/reactions.d.ts.map +1 -0
- package/dist/tools/read/reactions.js +24 -0
- package/dist/tools/read/reactions.js.map +1 -0
- package/dist/tools/read/space.js +1 -1
- package/dist/tools/read.d.ts +2 -1
- package/dist/tools/read.js +2 -1
- package/dist/tools/registry/extended.d.ts.map +1 -1
- package/dist/tools/registry/extended.js +6 -1
- package/dist/tools/registry/extended.js.map +1 -1
- package/dist/tools/schema.d.ts +30 -5
- package/dist/tools/schema.d.ts.map +1 -1
- package/dist/tools/schema.js +125 -7
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/stock-photo/apply.js +8 -9
- package/dist/tools/stock-photo/apply.js.map +1 -1
- package/dist/tools/structure/batch.d.ts.map +1 -1
- package/dist/tools/structure/batch.js +86 -90
- package/dist/tools/structure/batch.js.map +1 -1
- package/dist/tools/variables/values.d.ts.map +1 -1
- package/dist/tools/variables/values.js +4 -2
- package/dist/tools/variables/values.js.map +1 -1
- package/dist/tools/vector/export.d.ts.map +1 -1
- package/dist/tools/vector/export.js +5 -2
- package/dist/tools/vector/export.js.map +1 -1
- package/dist/vector/fill-geometry.d.ts +4 -1
- package/dist/vector/fill-geometry.d.ts.map +1 -1
- package/dist/vector/fill-geometry.js +8 -5
- package/dist/vector/fill-geometry.js.map +1 -1
- package/dist/vector/index.js +1 -1
- package/dist/vector/index.js.map +1 -1
- package/dist/vector/path-helpers.d.ts +1 -1
- package/dist/vector/path-helpers.d.ts.map +1 -1
- package/dist/vector/path-helpers.js +24 -7
- package/dist/vector/path-helpers.js.map +1 -1
- package/dist/vector/placement.js +1 -1
- package/dist/vector/placement.js.map +1 -1
- package/dist/vector/vectorize/preprocess.js +1 -1
- package/dist/vector/vectorize/preprocess.js.map +1 -1
- package/package.json +10 -10
- package/src/canvas/effects.ts +29 -33
- package/src/canvas/labels/hit-test.ts +6 -2
- package/src/canvas/labels/paragraph-cache.ts +2 -1
- package/src/canvas/labels/selection.ts +3 -3
- package/src/canvas/node-edit-overlay.ts +3 -2
- package/src/canvas/outline-stroke.ts +2 -6
- package/src/canvas/overlays/index.ts +0 -1
- package/src/canvas/overlays/prototype.ts +5 -27
- package/src/canvas/overlays/selection.ts +4 -52
- package/src/canvas/region-hatch.ts +7 -2
- package/src/canvas/renderer/colors.ts +41 -26
- package/src/canvas/renderer/font-waiters.ts +25 -0
- package/src/canvas/renderer/fonts.ts +42 -18
- package/src/canvas/renderer/lifecycle.ts +8 -10
- package/src/canvas/renderer/methods.ts +9 -13
- package/src/canvas/renderer/paints.ts +0 -10
- package/src/canvas/renderer/pipeline.ts +29 -3
- package/src/canvas/renderer/retained-backing.ts +4 -4
- package/src/canvas/renderer/state.ts +1 -1
- package/src/canvas/renderer/tiles/controller.ts +8 -0
- package/src/canvas/renderer/tiles/surface-pool.ts +1 -1
- package/src/canvas/renderer/visual-bounds.ts +7 -6
- package/src/canvas/renderer.ts +43 -11
- package/src/canvas/rulers.ts +55 -26
- package/src/canvas/scene.ts +127 -77
- package/src/canvas/shadows/shape.ts +1 -1
- package/src/canvas/shadows/silhouette.ts +4 -2
- package/src/canvas/shadows.ts +4 -2
- package/src/canvas/text/derived.ts +0 -9
- package/src/canvas/text/emoji/raster.ts +14 -10
- package/src/canvas/text/font-families.ts +14 -7
- package/src/canvas/text/index.ts +3 -9
- package/src/canvas/text/layout/build.ts +35 -18
- package/src/canvas/text/layout/index.ts +15 -6
- package/src/canvas/text/layout/lines.ts +10 -4
- package/src/canvas/text/paragraph/index.ts +19 -10
- package/src/canvas/text/paragraph/inputs.ts +4 -2
- package/src/canvas/text/placed.ts +2 -2
- package/src/canvas/text/renderer.ts +2 -0
- package/src/canvas/text/shape.ts +20 -31
- package/src/constants.ts +6 -1
- package/src/editor/bridges/clipboard.ts +1 -0
- package/src/editor/bridges/components.ts +2 -0
- package/src/editor/bridges/frames.ts +6 -4
- package/src/editor/bridges/structure.ts +1 -0
- package/src/editor/clipboard/detach.ts +3 -3
- package/src/editor/clipboard/paste/target.ts +2 -2
- package/src/editor/clipboard/snapshot.ts +7 -0
- package/src/editor/clipboard/variables.ts +20 -0
- package/src/editor/clipboard.ts +133 -14
- package/src/editor/component-sync.ts +28 -7
- package/src/editor/components/authoring/text-edit.ts +15 -2
- package/src/editor/components/authoring/visibility-edit.ts +11 -3
- package/src/editor/components/instances.ts +61 -11
- package/src/editor/components/properties.ts +10 -0
- package/src/editor/components/slots/authoring.ts +4 -1
- package/src/editor/create.ts +58 -8
- package/src/editor/guides.ts +27 -12
- package/src/editor/history/document-change.ts +115 -7
- package/src/editor/history/edit.ts +62 -14
- package/src/editor/history/position.ts +1 -4
- package/src/editor/history/sources.ts +25 -0
- package/src/editor/index.ts +3 -1
- package/src/editor/layout-mode.ts +20 -1
- package/src/editor/node-preview.ts +44 -8
- package/src/editor/nodes.ts +52 -12
- package/src/editor/nudge.ts +16 -2
- package/src/editor/pages.ts +100 -17
- package/src/editor/play/states.ts +0 -7
- package/src/editor/read-only/actions.ts +4 -0
- package/src/editor/selection/hit-test.ts +37 -4
- package/src/editor/shapes/pen.ts +6 -3
- package/src/editor/shapes.ts +2 -1
- package/src/editor/structure/auto-layout-wrap.ts +26 -0
- package/src/editor/structure/group/bounds.ts +22 -4
- package/src/editor/structure/rename.ts +2 -6
- package/src/editor/structure/reorder.ts +26 -8
- package/src/editor/structure.ts +88 -24
- package/src/editor/text/hyperlink.ts +2 -1
- package/src/editor/text/name.ts +51 -15
- package/src/editor/text/pending-layout.ts +42 -4
- package/src/editor/text/selection-style.ts +17 -3
- package/src/editor/text.ts +86 -4
- package/src/editor/types.ts +19 -0
- package/src/editor/undo.ts +21 -2
- package/src/editor/variable-bindings.ts +22 -2
- package/src/editor/variables.ts +10 -6
- package/src/editor/viewport.ts +55 -21
- package/src/editor/views/actions.ts +17 -7
- package/src/editor/views/present.ts +20 -11
- package/src/editor/views/types.ts +11 -5
- package/src/figma-api/accessor-utils.ts +4 -1
- package/src/figma-api/accessors/basic.ts +54 -18
- package/src/figma-api/accessors/layout.ts +46 -7
- package/src/figma-api/accessors/reactions.ts +29 -0
- package/src/figma-api/accessors/strokes.ts +28 -8
- package/src/figma-api/accessors/text/index.ts +4 -0
- package/src/figma-api/accessors/vector.ts +3 -1
- package/src/figma-api/accessors/visual.ts +25 -28
- package/src/figma-api/components.ts +9 -7
- package/src/figma-api/finite.ts +102 -0
- package/src/figma-api/fonts/list.ts +24 -0
- package/src/figma-api/index.ts +170 -19
- package/src/figma-api/overrides.ts +1 -1
- package/src/figma-api/pending-layout.ts +50 -1
- package/src/figma-api/pending-sync.ts +61 -0
- package/src/figma-api/proxy.ts +35 -2
- package/src/figma-api/reactions.ts +212 -0
- package/src/figma-api/render-bounds.ts +13 -4
- package/src/figma-api/serialization.ts +16 -2
- package/src/figma-api/slots.ts +12 -3
- package/src/figma-api/strokes.ts +16 -12
- package/src/figma-api/text/index.ts +9 -15
- package/src/figma-api/variables/variable.ts +3 -2
- package/src/geometry/connectors.ts +2 -12
- package/src/geometry/figma.ts +9 -0
- package/src/geometry/index.ts +2 -1
- package/src/geometry/scene.ts +19 -0
- package/src/geometry/types.ts +8 -0
- package/src/global.d.ts +6 -0
- package/src/icons/api.ts +27 -16
- package/src/icons/provider.ts +9 -20
- package/src/icons/schema.ts +31 -0
- package/src/icons/svg/presentation.ts +27 -3
- package/src/icons/svg/text.ts +1 -1
- package/src/icons/svg.ts +21 -19
- package/src/icons/types.ts +0 -14
- package/src/io/formats/design-tokens/plan/index.ts +7 -1
- package/src/io/formats/design-tokens/plan/styles.ts +40 -4
- package/src/io/formats/design-tokens/styles.ts +60 -3
- package/src/io/formats/design-tokens/types.ts +3 -0
- package/src/io/formats/drawio/export.ts +11 -0
- package/src/io/formats/drawio/index.ts +36 -1
- package/src/io/formats/drawio/shapes.ts +13 -9
- package/src/io/formats/drawio/warnings.ts +27 -0
- package/src/io/formats/fig/export/setup.ts +16 -14
- package/src/io/formats/fig/export/variables.ts +7 -8
- package/src/io/formats/fig/index.ts +1 -0
- package/src/io/formats/fig/read.ts +66 -23
- package/src/io/formats/html/index.ts +2 -6
- package/src/io/formats/pdf/dom.ts +125 -3
- package/src/io/formats/pdf/export.ts +3 -2
- package/src/io/formats/pen/fonts.ts +45 -0
- package/src/io/formats/pen/index.ts +30 -6
- package/src/io/formats/raster/headless.ts +40 -14
- package/src/io/formats/raster/index.ts +3 -0
- package/src/io/formats/raster/render.ts +66 -8
- package/src/io/formats/svg/export.ts +24 -25
- package/src/io/formats/svg/paths.ts +11 -2
- package/src/io/formats/svg/strokes.ts +8 -2
- package/src/io/formats/svg/text/export.ts +23 -0
- package/src/io/formats/svg/text/import.ts +2 -1
- package/src/io/formats.ts +3 -1
- package/src/io/registry.ts +12 -0
- package/src/io/subgraph.ts +3 -1
- package/src/io/types.ts +2 -0
- package/src/kiwi/fig/population/client.ts +77 -43
- package/src/kiwi/fig/population/delta.ts +141 -18
- package/src/kiwi/fig/population/edits.ts +235 -0
- package/src/kiwi/fig/session/archive/access.ts +15 -0
- package/src/kiwi/fig/session/archive/changes.ts +27 -6
- package/src/kiwi/fig/session/document-state.ts +23 -1
- package/src/kiwi/fig/session/protocol.ts +26 -1
- package/src/kiwi/fig/session/worker.ts +38 -11
- package/src/layout/apply.ts +52 -10
- package/src/layout/arrange/boxes.ts +36 -0
- package/src/layout/flow-edges.ts +139 -0
- package/src/layout/grid.ts +14 -4
- package/src/layout/text-auto-resize.ts +13 -4
- package/src/layout/text-measurement.ts +46 -3
- package/src/layout.ts +60 -66
- package/src/library/asset-keys.ts +4 -3
- package/src/library/copied-references.ts +29 -5
- package/src/library/materialize.ts +1 -1
- package/src/library/schema.ts +1 -1
- package/src/library/snapshot.ts +12 -2
- package/src/lint/linter.ts +12 -2
- package/src/pairdraw-api/variables.ts +1 -3
- package/src/profiler/hud-controller.ts +8 -6
- package/src/profiler/hud-renderer.ts +9 -6
- package/src/profiler/render-profiler.ts +4 -3
- package/src/rpc/variables-command.ts +6 -5
- package/src/text/character-style.ts +29 -9
- package/src/text/coverage.ts +29 -15
- package/src/text/editor.ts +3 -8
- package/src/text/fallbacks.ts +163 -22
- package/src/text/font/catalog.ts +10 -0
- package/src/text/font/collection.ts +60 -0
- package/src/text/font/faces.ts +9 -5
- package/src/text/font/glyphs.ts +29 -4
- package/src/text/font/local.ts +2 -2
- package/src/text/font/manager.ts +220 -49
- package/src/text/font/style.ts +52 -3
- package/src/text/index.ts +1 -0
- package/src/text/outlines.ts +106 -90
- package/src/text/path/caret.ts +3 -4
- package/src/text/prepare.ts +51 -2
- package/src/text/style-runs.ts +43 -16
- package/src/text/web-font/assets.ts +11 -15
- package/src/text/web-font/resolver.ts +7 -1
- package/src/tools/analyze/overlaps/helpers.ts +18 -1
- package/src/tools/analyze/overlaps/index.ts +37 -6
- package/src/tools/codegen/component-map.ts +3 -3
- package/src/tools/create/basic.ts +6 -4
- package/src/tools/create/components.ts +33 -0
- package/src/tools/create/html.ts +3 -1
- package/src/tools/create/icons.ts +16 -6
- package/src/tools/create/mermaid.ts +2 -0
- package/src/tools/create/render.ts +2 -0
- package/src/tools/create/script.ts +5 -1
- package/src/tools/create/svg.ts +4 -1
- package/src/tools/create/vector.ts +20 -10
- package/src/tools/create.ts +1 -0
- package/src/tools/image-ai/generate.ts +3 -0
- package/src/tools/modify/effects.ts +11 -4
- package/src/tools/modify/matching.ts +10 -6
- package/src/tools/modify/paint.ts +13 -5
- package/src/tools/modify/reactions.ts +40 -0
- package/src/tools/modify/text.ts +53 -20
- package/src/tools/modify.ts +1 -0
- package/src/tools/read/components.ts +28 -25
- package/src/tools/read/fonts.ts +1 -1
- package/src/tools/read/libraries.ts +24 -4
- package/src/tools/read/nodes.ts +47 -17
- package/src/tools/read/pages.ts +7 -3
- package/src/tools/read/query.ts +2 -0
- package/src/tools/read/reactions.ts +21 -0
- package/src/tools/read.ts +1 -0
- package/src/tools/registry/extended.ts +6 -0
- package/src/tools/schema.ts +166 -6
- package/src/tools/stock-photo/apply.ts +17 -5
- package/src/tools/structure/batch.ts +84 -98
- package/src/tools/variables/values.ts +6 -3
- package/src/tools/vector/export.ts +5 -1
- package/src/vector/fill-geometry.ts +11 -5
- package/src/vector/index.ts +1 -1
- package/src/vector/path-helpers.ts +34 -8
- package/src/vector/placement.ts +1 -1
- package/src/vector/vectorize/preprocess.ts +1 -1
|
@@ -4,14 +4,15 @@ import { randomHex } from '@pairdraw/scene-graph/random'
|
|
|
4
4
|
import { releaseFigArchive } from '#core/kiwi/fig/session/archive/access'
|
|
5
5
|
import { archiveChanges, trackArchiveChanges } from '#core/kiwi/fig/session/archive/changes'
|
|
6
6
|
import { updateReaderRecovery, releaseReaderRecovery } from '#core/kiwi/fig/session/document-state'
|
|
7
|
-
import type { FigSessionResponse } from '#core/kiwi/fig/session/protocol'
|
|
7
|
+
import type { FigSessionRequest, FigSessionResponse } from '#core/kiwi/fig/session/protocol'
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { beginFigPopulation, type FigPopulation, type FigPopulationRebase } from './delta'
|
|
10
|
+
import { trackFigGraphEdits } from './edits'
|
|
10
11
|
|
|
11
12
|
/** The responses this client acts on, taken from the session protocol itself. */
|
|
12
13
|
type WorkerResult = Extract<
|
|
13
14
|
FigSessionResponse,
|
|
14
|
-
{ type: 'population-result' | 'population-error' | 'population-progress' }
|
|
15
|
+
{ type: 'population-result' | 'population-chunk' | 'population-error' | 'population-progress' }
|
|
15
16
|
>
|
|
16
17
|
|
|
17
18
|
const MAX_FIG_POPULATION_WORKER_NODES = 200_000
|
|
@@ -171,40 +172,48 @@ export function createPopulationWorkerClient(
|
|
|
171
172
|
revision: number
|
|
172
173
|
startedAt: number
|
|
173
174
|
timeout: ReturnType<typeof setTimeout>
|
|
175
|
+
/** The page's new layers applied so far, as their pieces arrived. */
|
|
176
|
+
population: FigPopulation
|
|
174
177
|
}
|
|
175
178
|
>()
|
|
176
|
-
let revision = 0
|
|
177
179
|
let stale = false
|
|
178
180
|
let disposed = false
|
|
179
|
-
let applyingDelta = false
|
|
180
181
|
/** Answer every load in flight with null, so its page loads on the main thread instead. */
|
|
181
182
|
const settlePending = () => {
|
|
182
183
|
for (const request of pending.values()) {
|
|
183
184
|
clearTimeout(request.timeout)
|
|
184
185
|
request.abort?.()
|
|
186
|
+
// The page loads again on the main thread, from the start.
|
|
187
|
+
applyLoaded(() => request.population.rollback())
|
|
185
188
|
request.resolve(null)
|
|
186
189
|
}
|
|
187
190
|
pending.clear()
|
|
188
191
|
}
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
// user divergence. Only real user edits invalidate the worker.
|
|
193
|
-
if (applyingDelta || stale || graph.isApplyingLayout) return
|
|
194
|
-
revision++
|
|
195
|
-
stale = true
|
|
196
|
-
emitTelemetry({ event: 'stale', reason: 'graph-mutation' })
|
|
197
|
-
// A load in flight can no longer apply, however long the worker keeps reporting progress.
|
|
198
|
-
settlePending()
|
|
192
|
+
const post = (message: FigSessionRequest) => {
|
|
193
|
+
if (port) port.postMessage(message)
|
|
194
|
+
else worker.postMessage(message, [])
|
|
199
195
|
}
|
|
200
|
-
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
196
|
+
// Edits reach the worker's copy of the graph, so pages keep loading there once it is edited.
|
|
197
|
+
const edits = trackFigGraphEdits(graph, (batch) => {
|
|
198
|
+
post({ type: 'edits', edits: batch })
|
|
199
|
+
forgetSettledEdits(batch.revision)
|
|
200
|
+
})
|
|
201
|
+
/** Batches up to the oldest load in flight, or all of them with none, are not needed. */
|
|
202
|
+
const forgetSettledEdits = (newest: number) => {
|
|
203
|
+
let oldest = newest
|
|
204
|
+
for (const request of pending.values()) oldest = Math.min(oldest, request.revision)
|
|
205
|
+
edits.forget(oldest)
|
|
204
206
|
}
|
|
207
|
+
const releaseSubscription = () => edits.stop()
|
|
208
|
+
/**
|
|
209
|
+
* Applies what a page load brings, or takes back: it is the worker's own, so it is not sent
|
|
210
|
+
* back, and it arrives from outside any edit open now, such as a script's awaiting tool call,
|
|
211
|
+
* so no undo step takes it in.
|
|
212
|
+
*/
|
|
213
|
+
const applyLoaded = <T>(apply: () => T): T => graph.runOutsideEdits(() => edits.ignoring(apply))
|
|
205
214
|
/**
|
|
206
|
-
* Stop loading pages here. A
|
|
207
|
-
* worker keeps serving the archive;
|
|
215
|
+
* Stop loading pages here. A load the worker reports failing only retires its session, so the
|
|
216
|
+
* worker keeps serving the archive; a stuck or crashed worker is stopped.
|
|
208
217
|
*/
|
|
209
218
|
const fail = (emit = true, stop = true) => {
|
|
210
219
|
stale = true
|
|
@@ -215,16 +224,21 @@ export function createPopulationWorkerClient(
|
|
|
215
224
|
else port?.postMessage({ type: 'retire' })
|
|
216
225
|
populationWorkers.delete(graph)
|
|
217
226
|
}
|
|
218
|
-
unbind = graph.onNodeEvents({
|
|
219
|
-
created: invalidate,
|
|
220
|
-
updated: invalidate,
|
|
221
|
-
deleted: invalidate,
|
|
222
|
-
reparented: invalidate,
|
|
223
|
-
reordered: invalidate
|
|
224
|
-
})
|
|
225
227
|
const watchForStall = () => setTimeout(() => fail(), FIG_POPULATION_WORKER_STALL_MS)
|
|
226
228
|
const receive = (result: WorkerResult) => {
|
|
227
229
|
if (result.type === 'population-error') return fail(true, false)
|
|
230
|
+
if (result.type === 'population-chunk') {
|
|
231
|
+
const request = pending.get(result.requestId)
|
|
232
|
+
if (!request) return
|
|
233
|
+
clearTimeout(request.timeout)
|
|
234
|
+
request.timeout = watchForStall()
|
|
235
|
+
try {
|
|
236
|
+
applyLoaded(() => request.population.add(result.created))
|
|
237
|
+
} catch {
|
|
238
|
+
fail()
|
|
239
|
+
}
|
|
240
|
+
return
|
|
241
|
+
}
|
|
228
242
|
if (result.type === 'population-progress') {
|
|
229
243
|
const request = pending.get(result.requestId)
|
|
230
244
|
if (!request) return
|
|
@@ -236,29 +250,48 @@ export function createPopulationWorkerClient(
|
|
|
236
250
|
if (!request) return
|
|
237
251
|
clearTimeout(request.timeout)
|
|
238
252
|
request.abort?.()
|
|
239
|
-
|
|
240
|
-
|
|
253
|
+
if (stale || result.baseRevision !== request.revision) {
|
|
254
|
+
pending.delete(result.requestId)
|
|
241
255
|
emitTelemetry({ event: 'stale', reason: 'graph-mutation' })
|
|
256
|
+
applyLoaded(() => request.population.rollback())
|
|
242
257
|
return request.resolve(null)
|
|
243
258
|
}
|
|
244
|
-
|
|
259
|
+
|
|
245
260
|
const applyStartedAt = performance.now()
|
|
261
|
+
let rebase: FigPopulationRebase
|
|
246
262
|
try {
|
|
247
|
-
|
|
263
|
+
// Edits not sent yet are among those the worker did not see. The load stays pending until
|
|
264
|
+
// they are read, so sending them keeps the batches it needs.
|
|
265
|
+
edits.flush()
|
|
266
|
+
const edited = edits.changedSince(request.revision)
|
|
267
|
+
pending.delete(result.requestId)
|
|
268
|
+
// The page arrives from outside any edit open now, such as a script's awaiting tool call,
|
|
269
|
+
// so no undo step takes it in.
|
|
270
|
+
rebase = applyLoaded(() => {
|
|
271
|
+
request.population.add(result.delta.created.map(([, node]) => node))
|
|
272
|
+
return request.population.finish(result.delta, edited)
|
|
273
|
+
})
|
|
248
274
|
if (result.checkpoint) updateReaderRecovery(graph, result.checkpoint)
|
|
249
275
|
} catch {
|
|
250
|
-
|
|
276
|
+
pending.delete(result.requestId)
|
|
277
|
+
applyLoaded(() => request.population.rollback())
|
|
251
278
|
fail()
|
|
252
279
|
return request.resolve(null)
|
|
253
|
-
} finally {
|
|
254
|
-
applyingDelta = false
|
|
255
280
|
}
|
|
281
|
+
|
|
282
|
+
forgetSettledEdits(edits.revision)
|
|
283
|
+
// The worker built what it sent without the edits made meanwhile; it takes this thread's
|
|
284
|
+
// state where they met, and the instances it built from components edited since.
|
|
285
|
+
edits.send(rebase.diverged)
|
|
286
|
+
graph.runOutsideEdits(() => {
|
|
287
|
+
for (const id of rebase.staleInstances) graph.syncInstance(id)
|
|
288
|
+
})
|
|
256
289
|
request.resolve(result.populated)
|
|
257
290
|
emitTelemetry({
|
|
258
291
|
event: 'populate',
|
|
259
292
|
durationMs: performance.now() - request.startedAt,
|
|
260
293
|
applyMs: performance.now() - applyStartedAt,
|
|
261
|
-
created:
|
|
294
|
+
created: request.population.created,
|
|
262
295
|
updated: result.delta.updated.length,
|
|
263
296
|
deleted: result.delta.deleted.length
|
|
264
297
|
})
|
|
@@ -275,14 +308,15 @@ export function createPopulationWorkerClient(
|
|
|
275
308
|
signal?.throwIfAborted()
|
|
276
309
|
if (stale) return Promise.resolve(null)
|
|
277
310
|
const requestId = randomHex()
|
|
278
|
-
|
|
311
|
+
// Sent first, so the worker loads the page into a graph with every edit made so far.
|
|
312
|
+
const baseRevision = edits.revision
|
|
279
313
|
return new Promise((resolve, reject) => {
|
|
280
314
|
const abort = () => {
|
|
281
315
|
const request = pending.get(requestId)
|
|
282
316
|
if (!request) return
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
317
|
+
// The worker loads the page into its copy all the same. Its layers still apply here
|
|
318
|
+
// when they arrive, so both graphs stay alike and later pages keep loading there.
|
|
319
|
+
request.resolve = () => undefined
|
|
286
320
|
reject(new DOMException('Aborted', 'AbortError'))
|
|
287
321
|
}
|
|
288
322
|
signal?.addEventListener('abort', abort, { once: true })
|
|
@@ -291,10 +325,10 @@ export function createPopulationWorkerClient(
|
|
|
291
325
|
abort: () => signal?.removeEventListener('abort', abort),
|
|
292
326
|
revision: baseRevision,
|
|
293
327
|
startedAt: performance.now(),
|
|
294
|
-
timeout: watchForStall()
|
|
328
|
+
timeout: watchForStall(),
|
|
329
|
+
population: beginFigPopulation(graph)
|
|
295
330
|
})
|
|
296
|
-
|
|
297
|
-
else worker.postMessage({ type: 'populate', requestId, baseRevision, pageId }, [])
|
|
331
|
+
post({ type: 'populate', requestId, baseRevision, pageId })
|
|
298
332
|
})
|
|
299
333
|
},
|
|
300
334
|
terminate() {
|
|
@@ -6,7 +6,6 @@ export interface FigPopulationDelta {
|
|
|
6
6
|
created: Array<[string, SceneNode]>
|
|
7
7
|
updated: Array<[string, Partial<SceneNode>]>
|
|
8
8
|
deleted: string[]
|
|
9
|
-
instanceIndex: Array<[string, string[]]>
|
|
10
9
|
populatedRootIds: string[]
|
|
11
10
|
}
|
|
12
11
|
|
|
@@ -92,6 +91,11 @@ export function installFigMutationJournal(graph: SceneGraph): FigMutationJournal
|
|
|
92
91
|
}
|
|
93
92
|
}
|
|
94
93
|
|
|
94
|
+
/**
|
|
95
|
+
* What a page load changed in `graph`, holding the graph's own layers and values rather than
|
|
96
|
+
* copies: the worker sends it, and sending copies it. Apply it in the same thread only to a copy
|
|
97
|
+
* (`structuredClone`), or the two graphs share layers.
|
|
98
|
+
*/
|
|
95
99
|
export function buildFigPopulationDelta(
|
|
96
100
|
graph: SceneGraph,
|
|
97
101
|
journal: FigMutationJournal,
|
|
@@ -103,37 +107,156 @@ export function buildFigPopulationDelta(
|
|
|
103
107
|
if (!current || journal.deleted.has(id)) continue
|
|
104
108
|
const changes: Partial<SceneNode> = {}
|
|
105
109
|
for (const key of Object.keys(previous) as (keyof SceneNode)[]) {
|
|
106
|
-
if (!isEqual(previous[key], current[key]))
|
|
107
|
-
Object.assign(changes, { [key]: structuredClone(current[key]) })
|
|
110
|
+
if (!isEqual(previous[key], current[key])) Object.assign(changes, { [key]: current[key] })
|
|
108
111
|
}
|
|
109
112
|
if (Object.keys(changes).length > 0) updated.push([id, changes])
|
|
110
113
|
}
|
|
111
114
|
const created = [...journal.created]
|
|
112
115
|
.map((id) => graph.getNode(id))
|
|
113
116
|
.filter((node) => node !== undefined)
|
|
114
|
-
.map((node) => [node.id,
|
|
117
|
+
.map((node) => [node.id, node] as [string, SceneNode])
|
|
115
118
|
return {
|
|
116
119
|
created,
|
|
117
120
|
updated,
|
|
118
121
|
deleted: [...journal.deleted],
|
|
119
|
-
instanceIndex: [...graph.instanceIndex].map(([id, ids]) => [id, [...ids]]),
|
|
120
122
|
populatedRootIds: [...populatedRootIds]
|
|
121
123
|
}
|
|
122
124
|
}
|
|
123
125
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
/** Where a page load applied over edits made while it loaded differs from what it brought. */
|
|
127
|
+
export interface FigPopulationRebase {
|
|
128
|
+
/** Layers whose state here is not the loaded one: the worker takes this thread's state. */
|
|
129
|
+
diverged: string[]
|
|
130
|
+
/** New instances of components edited while the page loaded, built from them as they were. */
|
|
131
|
+
staleInstances: string[]
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** The components holding `ids`, or being them. */
|
|
135
|
+
function componentsHolding(graph: SceneGraph, ids: Iterable<string>): Set<string> {
|
|
136
|
+
const components = new Set<string>()
|
|
137
|
+
for (const id of ids) {
|
|
138
|
+
let node = graph.getNode(id)
|
|
139
|
+
while (node) {
|
|
140
|
+
if (node.type === 'COMPONENT') components.add(node.id)
|
|
141
|
+
node = node.parentId ? graph.getNode(node.parentId) : undefined
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return components
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* A page load applied as it arrives: the worker sends a large page's new layers in pieces, each
|
|
149
|
+
* applied in its own task so the editor keeps responding, then the changes to layers already
|
|
150
|
+
* here. `edited` holds the layers this thread changed after the load began; the load did not see
|
|
151
|
+
* those edits, so they win: fields of an edited layer stay as edited, a layer removed meanwhile
|
|
152
|
+
* keeps the new layers out, and the new layers still join an edited parent.
|
|
153
|
+
*/
|
|
154
|
+
export function beginFigPopulation(graph: SceneGraph): FigPopulation {
|
|
155
|
+
const diverged: string[] = []
|
|
156
|
+
const created: string[] = []
|
|
157
|
+
const createdIds = new Set<string>()
|
|
158
|
+
return {
|
|
159
|
+
/** How many new layers it has added. */
|
|
160
|
+
get created(): number {
|
|
161
|
+
return created.length
|
|
162
|
+
},
|
|
163
|
+
/** Adds new layers, each after its parent. */
|
|
164
|
+
add(nodes: Iterable<SceneNode>): void {
|
|
165
|
+
graph.applyImportedStateDuring(() => {
|
|
166
|
+
for (const node of nodes) {
|
|
167
|
+
if (graph.getNode(node.id) || (node.parentId && !graph.getNode(node.parentId))) {
|
|
168
|
+
diverged.push(node.id)
|
|
169
|
+
continue
|
|
170
|
+
}
|
|
171
|
+
graph.createNodeWithId(node.id, node.type, node.parentId, node)
|
|
172
|
+
created.push(node.id)
|
|
173
|
+
createdIds.add(node.id)
|
|
174
|
+
}
|
|
175
|
+
})
|
|
176
|
+
},
|
|
177
|
+
finish(
|
|
178
|
+
changes: Pick<FigPopulationDelta, 'updated' | 'deleted'>,
|
|
179
|
+
edited: ReadonlySet<string> = new Set()
|
|
180
|
+
): FigPopulationRebase {
|
|
181
|
+
graph.applyImportedStateDuring(() => {
|
|
182
|
+
for (const [id, fields] of changes.updated) {
|
|
183
|
+
if (!edited.has(id)) {
|
|
184
|
+
graph.updateNode(id, fields)
|
|
185
|
+
continue
|
|
186
|
+
}
|
|
187
|
+
diverged.push(id)
|
|
188
|
+
const node = graph.getNode(id)
|
|
189
|
+
// Only new layers still here under this parent: one moved or removed since is not.
|
|
190
|
+
const joining = fields.childIds?.filter(
|
|
191
|
+
(childId) =>
|
|
192
|
+
createdIds.has(childId) &&
|
|
193
|
+
graph.getNode(childId)?.parentId === id &&
|
|
194
|
+
!node?.childIds.includes(childId)
|
|
195
|
+
)
|
|
196
|
+
if (node && joining?.length) {
|
|
197
|
+
graph.updateNode(id, { childIds: [...node.childIds, ...joining] })
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
for (const id of changes.deleted) {
|
|
201
|
+
if (edited.has(id)) diverged.push(id)
|
|
202
|
+
else graph.deleteNode(id)
|
|
203
|
+
}
|
|
204
|
+
})
|
|
205
|
+
const editedComponents =
|
|
206
|
+
edited.size > 0 ? componentsHolding(graph, edited) : new Set<string>()
|
|
207
|
+
const staleInstances = created.filter((id) => {
|
|
208
|
+
const node = graph.getNode(id)
|
|
209
|
+
return (
|
|
210
|
+
node?.type === 'INSTANCE' && !!node.componentId && editedComponents.has(node.componentId)
|
|
211
|
+
)
|
|
212
|
+
})
|
|
213
|
+
return { diverged, staleInstances }
|
|
214
|
+
},
|
|
215
|
+
/**
|
|
216
|
+
* Removes the layers added so far, for a load that will not finish. A layer someone put
|
|
217
|
+
* inside one of them meanwhile is not the load's: it moves out to the nearest layer that
|
|
218
|
+
* stays, keeping its place on the canvas, before the load's layer goes.
|
|
219
|
+
*/
|
|
220
|
+
rollback(): void {
|
|
221
|
+
graph.applyImportedStateDuring(() => {
|
|
222
|
+
for (const id of created.toReversed()) {
|
|
223
|
+
const node = graph.getNode(id)
|
|
224
|
+
if (!node) continue
|
|
225
|
+
const parentId = node.parentId
|
|
226
|
+
for (const childId of node.childIds.filter((childId) => !createdIds.has(childId))) {
|
|
227
|
+
if (parentId) graph.reparentNode(childId, parentId)
|
|
228
|
+
}
|
|
229
|
+
graph.deleteNode(id)
|
|
230
|
+
}
|
|
231
|
+
})
|
|
232
|
+
created.length = 0
|
|
233
|
+
createdIds.clear()
|
|
128
234
|
}
|
|
129
|
-
for (const [id, changes] of delta.updated) graph.updateNode(id, changes)
|
|
130
|
-
for (const id of delta.deleted) graph.deleteNode(id)
|
|
131
|
-
})
|
|
132
|
-
graph.instanceIndex.clear()
|
|
133
|
-
for (const node of graph.getAllNodes()) {
|
|
134
|
-
if (node.type !== 'INSTANCE' || !node.componentId) continue
|
|
135
|
-
const ids = graph.instanceIndex.get(node.componentId) ?? new Set<string>()
|
|
136
|
-
ids.add(node.id)
|
|
137
|
-
graph.instanceIndex.set(node.componentId, ids)
|
|
138
235
|
}
|
|
139
236
|
}
|
|
237
|
+
|
|
238
|
+
/** A page load's new layers, applied as its pieces arrive and taken back if it fails. */
|
|
239
|
+
export interface FigPopulation {
|
|
240
|
+
/** How many new layers it has added. */
|
|
241
|
+
readonly created: number
|
|
242
|
+
/** Adds new layers, each after its parent. */
|
|
243
|
+
add(nodes: Iterable<SceneNode>): void
|
|
244
|
+
/** Applies the changes to layers already here, keeping the edits made meanwhile. */
|
|
245
|
+
finish(
|
|
246
|
+
changes: Pick<FigPopulationDelta, 'updated' | 'deleted'>,
|
|
247
|
+
edited?: ReadonlySet<string>
|
|
248
|
+
): FigPopulationRebase
|
|
249
|
+
/** Removes the layers added so far, keeping layers someone put inside them meanwhile. */
|
|
250
|
+
rollback(): void
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/** Applies a whole page load at once, as a caller without pieces does. */
|
|
254
|
+
export function applyFigPopulationDelta(
|
|
255
|
+
graph: SceneGraph,
|
|
256
|
+
delta: FigPopulationDelta,
|
|
257
|
+
edited: ReadonlySet<string> = new Set()
|
|
258
|
+
): FigPopulationRebase {
|
|
259
|
+
const population = beginFigPopulation(graph)
|
|
260
|
+
population.add(delta.created.map(([, node]) => node))
|
|
261
|
+
return population.finish(delta, edited)
|
|
262
|
+
}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { isEqual } from 'es-toolkit/predicate'
|
|
2
|
+
|
|
3
|
+
import type { SceneGraph, SceneNode, Variable, VariableCollection } from '@pairdraw/scene-graph'
|
|
4
|
+
|
|
5
|
+
import { settingsSnapshot, type SettingsSnapshot } from '#core/kiwi/fig/session/archive/changes'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* What edits on the main thread changed since the last batch, as the main thread now has it, for
|
|
9
|
+
* the reader worker's copy of the graph: pages keep loading there after the document is edited.
|
|
10
|
+
*/
|
|
11
|
+
export interface FigGraphEdits {
|
|
12
|
+
revision: number
|
|
13
|
+
/** Whole copies of the layers added or changed, with their ancestors below the page. */
|
|
14
|
+
nodes: SceneNode[]
|
|
15
|
+
/** Layers the main thread no longer has. */
|
|
16
|
+
removed: string[]
|
|
17
|
+
/** A variable or collection the main thread no longer has is null. */
|
|
18
|
+
variables: Array<[string, Variable | null]>
|
|
19
|
+
collections: Array<[string, VariableCollection | null]>
|
|
20
|
+
settings?: SettingsSnapshot
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface FigGraphEditTracker {
|
|
24
|
+
/** The revision of the last batch sent, after sending what is pending. */
|
|
25
|
+
readonly revision: number
|
|
26
|
+
/** Sends what changed since the last batch, if anything did. */
|
|
27
|
+
flush(): void
|
|
28
|
+
/** Layers changed in batches after `revision`, including those sent with `send`. */
|
|
29
|
+
changedSince(revision: number): Set<string>
|
|
30
|
+
/** Forgets the layers of batches up to `revision`, which no page load is waiting on. */
|
|
31
|
+
forget(revision: number): void
|
|
32
|
+
/** Writes `fn` makes are the worker's own, such as a page it loaded, and are not sent. */
|
|
33
|
+
ignoring<T>(fn: () => T): T
|
|
34
|
+
/** Sends the main thread's state of `ids` in the next batch, as an edit would. */
|
|
35
|
+
send(ids: Iterable<string>): void
|
|
36
|
+
stop(): void
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** The page under the document holds no override maps an edit writes into in place. */
|
|
40
|
+
function withAncestorsBelowPage(graph: SceneGraph, ids: Iterable<string>): Set<string> {
|
|
41
|
+
const result = new Set<string>()
|
|
42
|
+
for (const id of ids) {
|
|
43
|
+
result.add(id)
|
|
44
|
+
let parentId = graph.getNode(id)?.parentId
|
|
45
|
+
while (parentId && !result.has(parentId)) {
|
|
46
|
+
const parent = graph.getNode(parentId)
|
|
47
|
+
if (!parent || parent.type === 'CANVAS' || parent.id === graph.rootId) break
|
|
48
|
+
result.add(parentId)
|
|
49
|
+
parentId = parent.parentId
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return result
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function depthOf(graph: SceneGraph, node: SceneNode): number {
|
|
56
|
+
let depth = 0
|
|
57
|
+
let parentId = node.parentId
|
|
58
|
+
while (parentId) {
|
|
59
|
+
depth++
|
|
60
|
+
parentId = graph.getNode(parentId)?.parentId ?? null
|
|
61
|
+
}
|
|
62
|
+
return depth
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Sends `graph`'s edits to the reader worker as they happen, once per task. Layout a page gets
|
|
67
|
+
* as it loads or as its fonts arrive is not sent: the worker's copy never had it, and it reaches
|
|
68
|
+
* every layer of a page. Layout an edit causes is, as it is part of the edit.
|
|
69
|
+
*
|
|
70
|
+
* Variables and collections have no change observers here, so each batch diffs them against the
|
|
71
|
+
* state the last batch carried, as the archive tracker does.
|
|
72
|
+
*/
|
|
73
|
+
export function trackFigGraphEdits(
|
|
74
|
+
graph: SceneGraph,
|
|
75
|
+
post: (edits: FigGraphEdits) => void
|
|
76
|
+
): FigGraphEditTracker {
|
|
77
|
+
let revision = 0
|
|
78
|
+
let ignored = 0
|
|
79
|
+
let scheduled = false
|
|
80
|
+
let settings = settingsSnapshot(graph)
|
|
81
|
+
let variables = new Map(graph.variables)
|
|
82
|
+
let collections = new Map(graph.variableCollections)
|
|
83
|
+
const pendingNodes = new Set<string>()
|
|
84
|
+
const sent: Array<{ revision: number; ids: Set<string> }> = []
|
|
85
|
+
const skip = () => ignored > 0 || graph.isApplyingDerivedLayout
|
|
86
|
+
|
|
87
|
+
function schedule() {
|
|
88
|
+
if (scheduled) return
|
|
89
|
+
scheduled = true
|
|
90
|
+
queueMicrotask(flush)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function changedRecords<T>(
|
|
94
|
+
previous: ReadonlyMap<string, T>,
|
|
95
|
+
current: ReadonlyMap<string, T>
|
|
96
|
+
): Array<[string, T | null]> {
|
|
97
|
+
const changed: Array<[string, T | null]> = []
|
|
98
|
+
for (const [id, record] of current) {
|
|
99
|
+
if (!isEqual(previous.get(id), record)) changed.push([id, record])
|
|
100
|
+
}
|
|
101
|
+
for (const id of previous.keys()) {
|
|
102
|
+
if (!current.has(id)) changed.push([id, null])
|
|
103
|
+
}
|
|
104
|
+
return changed
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function flush() {
|
|
108
|
+
scheduled = false
|
|
109
|
+
const nextSettings = settingsSnapshot(graph)
|
|
110
|
+
const settingsChanged = !isEqual(settings, nextSettings)
|
|
111
|
+
const variableChanges = changedRecords(variables, graph.variables)
|
|
112
|
+
const collectionChanges = changedRecords(collections, graph.variableCollections)
|
|
113
|
+
if (
|
|
114
|
+
pendingNodes.size === 0 &&
|
|
115
|
+
variableChanges.length === 0 &&
|
|
116
|
+
collectionChanges.length === 0 &&
|
|
117
|
+
!settingsChanged
|
|
118
|
+
) {
|
|
119
|
+
return
|
|
120
|
+
}
|
|
121
|
+
const ids = withAncestorsBelowPage(graph, pendingNodes)
|
|
122
|
+
const nodes: SceneNode[] = []
|
|
123
|
+
const removed: string[] = []
|
|
124
|
+
for (const id of ids) {
|
|
125
|
+
const node = graph.getNode(id)
|
|
126
|
+
if (node) nodes.push(node)
|
|
127
|
+
else removed.push(id)
|
|
128
|
+
}
|
|
129
|
+
// A parent is added before the layers in it.
|
|
130
|
+
const depths = new Map(nodes.map((node) => [node.id, depthOf(graph, node)]))
|
|
131
|
+
nodes.sort((a, b) => (depths.get(a.id) ?? 0) - (depths.get(b.id) ?? 0))
|
|
132
|
+
revision++
|
|
133
|
+
post({
|
|
134
|
+
revision,
|
|
135
|
+
nodes,
|
|
136
|
+
removed,
|
|
137
|
+
variables: variableChanges,
|
|
138
|
+
collections: collectionChanges,
|
|
139
|
+
...(settingsChanged ? { settings: nextSettings } : {})
|
|
140
|
+
})
|
|
141
|
+
settings = nextSettings
|
|
142
|
+
variables = new Map(graph.variables)
|
|
143
|
+
collections = new Map(graph.variableCollections)
|
|
144
|
+
sent.push({ revision, ids })
|
|
145
|
+
pendingNodes.clear()
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const touch = (id: string) => {
|
|
149
|
+
if (skip()) return
|
|
150
|
+
pendingNodes.add(id)
|
|
151
|
+
schedule()
|
|
152
|
+
}
|
|
153
|
+
const stopObserving = graph.observeNodeChanges({
|
|
154
|
+
before: (node) => touch(node.id),
|
|
155
|
+
created: (node) => touch(node.id)
|
|
156
|
+
})
|
|
157
|
+
// Variables, collections, and settings change without node events here; each batch diffs them
|
|
158
|
+
// against the state the last one carried. A page load flushes before it asks the worker, so
|
|
159
|
+
// edits made since the last batch reach it even when no layer changed.
|
|
160
|
+
|
|
161
|
+
return {
|
|
162
|
+
get revision() {
|
|
163
|
+
flush()
|
|
164
|
+
return revision
|
|
165
|
+
},
|
|
166
|
+
flush,
|
|
167
|
+
changedSince(since) {
|
|
168
|
+
const changed = new Set<string>()
|
|
169
|
+
for (const batch of sent) {
|
|
170
|
+
if (batch.revision <= since) continue
|
|
171
|
+
for (const id of batch.ids) changed.add(id)
|
|
172
|
+
}
|
|
173
|
+
return changed
|
|
174
|
+
},
|
|
175
|
+
forget(through) {
|
|
176
|
+
while (sent.length > 0 && sent[0].revision <= through) sent.shift()
|
|
177
|
+
},
|
|
178
|
+
ignoring(fn) {
|
|
179
|
+
ignored++
|
|
180
|
+
try {
|
|
181
|
+
return fn()
|
|
182
|
+
} finally {
|
|
183
|
+
ignored--
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
send(ids) {
|
|
187
|
+
for (const id of ids) pendingNodes.add(id)
|
|
188
|
+
if (pendingNodes.size > 0) schedule()
|
|
189
|
+
},
|
|
190
|
+
stop: stopObserving
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Brings the reader worker's graph to the main thread's state of what `edits` changed. They are
|
|
196
|
+
* edits there too, so pages that load afterwards reconcile their instances with them, as a page
|
|
197
|
+
* loading into an edited graph does on the main thread.
|
|
198
|
+
*/
|
|
199
|
+
export function applyFigGraphEdits(graph: SceneGraph, edits: FigGraphEdits): void {
|
|
200
|
+
graph.preserveSourceMetadataDuring(() => {
|
|
201
|
+
for (const node of edits.nodes) {
|
|
202
|
+
const current = graph.getNode(node.id)
|
|
203
|
+
if (!current) {
|
|
204
|
+
graph.createNodeWithId(node.id, node.type, node.parentId, node)
|
|
205
|
+
continue
|
|
206
|
+
}
|
|
207
|
+
const absent = (Object.keys(current) as (keyof SceneNode)[]).filter((key) => !(key in node))
|
|
208
|
+
graph.restoreNodeProperties(node.id, node, absent)
|
|
209
|
+
}
|
|
210
|
+
// A layer moved out of a removed one is already where the main thread has it; every removed
|
|
211
|
+
// layer drops such links before any is removed, since removing one removes what it holds.
|
|
212
|
+
for (const id of edits.removed) {
|
|
213
|
+
const node = graph.getNode(id)
|
|
214
|
+
if (!node) continue
|
|
215
|
+
const stillInside = node.childIds.filter((childId) => graph.getNode(childId)?.parentId === id)
|
|
216
|
+
if (stillInside.length !== node.childIds.length) {
|
|
217
|
+
graph.restoreNodeProperties(id, { childIds: stillInside }, [])
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
for (const id of edits.removed) graph.deleteNode(id)
|
|
221
|
+
for (const [id, variable] of edits.variables) {
|
|
222
|
+
if (variable) graph.variables.set(id, variable)
|
|
223
|
+
else graph.variables.delete(id)
|
|
224
|
+
}
|
|
225
|
+
for (const [id, collection] of edits.collections) {
|
|
226
|
+
if (collection) graph.variableCollections.set(id, collection)
|
|
227
|
+
else graph.variableCollections.delete(id)
|
|
228
|
+
}
|
|
229
|
+
if (edits.settings) {
|
|
230
|
+
graph.documentColorSpace = edits.settings.colorSpace
|
|
231
|
+
graph.documentKind = edits.settings.kind
|
|
232
|
+
graph.enabledLibraries = new Map(edits.settings.libraries)
|
|
233
|
+
}
|
|
234
|
+
})
|
|
235
|
+
}
|