@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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
figArchiveComponentUsePages,
|
|
3
|
+
figArchiveRecordPages,
|
|
3
4
|
patchFigArchive,
|
|
4
5
|
type FigArchiveRecordInfo,
|
|
5
6
|
type FigPatchedArchiveInput,
|
|
@@ -21,6 +22,8 @@ export interface FigArchiveAccess {
|
|
|
21
22
|
info(): Promise<FigArchiveRecordInfo>
|
|
22
23
|
/** Archive GUIDs of the pages whose instances use these components. */
|
|
23
24
|
componentPages(componentIds: string[]): Promise<string[]>
|
|
25
|
+
/** The archive GUID of the page each record is on, `null` for one on no page. */
|
|
26
|
+
recordPages(recordIds: string[]): Promise<(string | null)[]>
|
|
24
27
|
patch(patch: FigRecordPatch, input: FigPatchedArchiveInput): Promise<Uint8Array>
|
|
25
28
|
/** The document closed: release whatever holds the archive. */
|
|
26
29
|
close(): void
|
|
@@ -51,6 +54,8 @@ export function createFigArchiveOperations(bytes: ArrayBuffer, info: () => FigAr
|
|
|
51
54
|
original: () => new Uint8Array(bytes.slice(0)),
|
|
52
55
|
info,
|
|
53
56
|
componentPages: (componentIds: string[]) => figArchiveComponentUsePages(bytes, componentIds),
|
|
57
|
+
recordPages: (recordIds: string[]) =>
|
|
58
|
+
figArchiveRecordPages(bytes, recordIds).map((pageId) => pageId ?? null),
|
|
54
59
|
patch: async (patch: FigRecordPatch, input: FigPatchedArchiveInput) =>
|
|
55
60
|
patchFigArchive(bytes, patch, input, await loadFigDataCompressor(input.compressionLevel))
|
|
56
61
|
}
|
|
@@ -65,6 +70,7 @@ export function localFigArchive(
|
|
|
65
70
|
original: async () => operations.original(),
|
|
66
71
|
info: async () => operations.info(),
|
|
67
72
|
componentPages: async (componentIds) => operations.componentPages(componentIds),
|
|
73
|
+
recordPages: async (recordIds) => operations.recordPages(recordIds),
|
|
68
74
|
patch: (patch, input) => operations.patch(patch, input),
|
|
69
75
|
close: () => undefined
|
|
70
76
|
}
|
|
@@ -77,6 +83,7 @@ type ArchiveResponse = Extract<
|
|
|
77
83
|
| 'original-archive-result'
|
|
78
84
|
| 'archive-info-result'
|
|
79
85
|
| 'component-pages-result'
|
|
86
|
+
| 'record-pages-result'
|
|
80
87
|
| 'patch-archive-result'
|
|
81
88
|
| 'archive-error'
|
|
82
89
|
}
|
|
@@ -86,6 +93,7 @@ const ARCHIVE_RESPONSES = new Set<FigSessionResponse['type']>([
|
|
|
86
93
|
'original-archive-result',
|
|
87
94
|
'archive-info-result',
|
|
88
95
|
'component-pages-result',
|
|
96
|
+
'record-pages-result',
|
|
89
97
|
'patch-archive-result',
|
|
90
98
|
'archive-error'
|
|
91
99
|
])
|
|
@@ -181,6 +189,13 @@ export function workerFigArchive(
|
|
|
181
189
|
(response) => response.pageIds,
|
|
182
190
|
(access) => access.componentPages(componentIds)
|
|
183
191
|
),
|
|
192
|
+
recordPages: (recordIds) =>
|
|
193
|
+
ask(
|
|
194
|
+
{ type: 'record-pages', recordIds },
|
|
195
|
+
'record-pages-result',
|
|
196
|
+
(response) => response.pageIds,
|
|
197
|
+
(access) => access.recordPages(recordIds)
|
|
198
|
+
),
|
|
184
199
|
patch: (patch, input) =>
|
|
185
200
|
ask(
|
|
186
201
|
{ type: 'patch-archive', patch, input },
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mapValues, omitBy } from 'es-toolkit/object'
|
|
2
|
+
import { isEqual, isPlainObject } from 'es-toolkit/predicate'
|
|
2
3
|
|
|
3
4
|
import type {
|
|
4
5
|
DocumentColorSpace,
|
|
@@ -35,7 +36,7 @@ interface ArchiveChanges {
|
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
/** The document's own settings, which its record holds rather than any layer. */
|
|
38
|
-
interface SettingsSnapshot {
|
|
39
|
+
export interface SettingsSnapshot {
|
|
39
40
|
colorSpace: DocumentColorSpace
|
|
40
41
|
kind: DocumentKind
|
|
41
42
|
libraries: Array<[string, EnabledLibraryBinding]>
|
|
@@ -49,7 +50,7 @@ interface CollectionsSnapshot {
|
|
|
49
50
|
|
|
50
51
|
const changes = new WeakMap<SceneGraph, ArchiveChanges>()
|
|
51
52
|
|
|
52
|
-
function settingsSnapshot(graph: SceneGraph): SettingsSnapshot {
|
|
53
|
+
export function settingsSnapshot(graph: SceneGraph): SettingsSnapshot {
|
|
53
54
|
return structuredClone({
|
|
54
55
|
colorSpace: graph.documentColorSpace,
|
|
55
56
|
kind: graph.documentKind,
|
|
@@ -86,8 +87,14 @@ export function trackArchiveChanges(graph: SceneGraph): void {
|
|
|
86
87
|
collections: collectionsSnapshot(graph),
|
|
87
88
|
settings: settingsSnapshot(graph)
|
|
88
89
|
}
|
|
90
|
+
// What a copy takes from its component is saved with the component, not as the copy's edit.
|
|
89
91
|
const touch = (id: string) => {
|
|
90
|
-
if (
|
|
92
|
+
if (
|
|
93
|
+
!graph.isApplyingImportedState &&
|
|
94
|
+
!graph.isApplyingDerivedLayout &&
|
|
95
|
+
!graph.isApplyingComponentDerived
|
|
96
|
+
)
|
|
97
|
+
entry.touched.add(id)
|
|
91
98
|
}
|
|
92
99
|
const edits = () => !graph.isApplyingImportedState && !graph.isApplyingDerivedLayout
|
|
93
100
|
graph.observeNodeChanges({
|
|
@@ -127,18 +134,32 @@ export interface ArchiveChangeSummary {
|
|
|
127
134
|
documentChanged: boolean
|
|
128
135
|
}
|
|
129
136
|
|
|
137
|
+
/** A value without its unset keys: a field set to `undefined` and one removed are the same. */
|
|
138
|
+
function withoutUnset(value: unknown): unknown {
|
|
139
|
+
if (Array.isArray(value)) return value.map(withoutUnset)
|
|
140
|
+
if (!isPlainObject(value)) return value
|
|
141
|
+
return mapValues(
|
|
142
|
+
omitBy(value, (field) => field === undefined),
|
|
143
|
+
withoutUnset
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
|
|
130
147
|
export function archiveChanges(graph: SceneGraph): ArchiveChangeSummary | undefined {
|
|
131
148
|
const entry = changes.get(graph)
|
|
132
149
|
if (!entry) return undefined
|
|
133
150
|
const changedVariables = new Set<string>()
|
|
134
151
|
for (const [id, variable] of graph.variables)
|
|
135
|
-
if (!isEqual(entry.variables.get(id), variable))
|
|
152
|
+
if (!isEqual(withoutUnset(entry.variables.get(id)), withoutUnset(variable)))
|
|
153
|
+
changedVariables.add(id)
|
|
136
154
|
for (const id of entry.variables.keys()) if (!graph.variables.has(id)) changedVariables.add(id)
|
|
137
155
|
return {
|
|
138
156
|
touched: entry.touched,
|
|
139
157
|
resourceIds: entry.resourceIds,
|
|
140
158
|
changedVariables,
|
|
141
|
-
collectionsChanged: !isEqual(
|
|
159
|
+
collectionsChanged: !isEqual(
|
|
160
|
+
withoutUnset(entry.collections),
|
|
161
|
+
withoutUnset(collectionsSnapshot(graph))
|
|
162
|
+
),
|
|
142
163
|
documentChanged: !isEqual(entry.settings, settingsSnapshot(graph))
|
|
143
164
|
}
|
|
144
165
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createFigDocumentSession,
|
|
3
|
+
figCheckpointRecords,
|
|
4
|
+
type FigSessionCheckpoint
|
|
5
|
+
} from '@pairdraw/fig'
|
|
2
6
|
import type { SceneGraph } from '@pairdraw/scene-graph'
|
|
3
7
|
|
|
8
|
+
import { figArchive } from '#core/kiwi/fig/session/archive/access'
|
|
4
9
|
import { readerSessionOptions, type FigReaderDiagnostic } from '#core/kiwi/fig/session/options'
|
|
5
10
|
|
|
6
11
|
/**
|
|
@@ -52,6 +57,23 @@ export function isReaderPagePending(graph: SceneGraph, pageId: string): boolean
|
|
|
52
57
|
: !checkpoint.loadedPageIds.includes(sourceId)
|
|
53
58
|
}
|
|
54
59
|
|
|
60
|
+
/**
|
|
61
|
+
* The page holding a layer of the file while that page has not loaded, so a layer named by its
|
|
62
|
+
* ID, as a link to it names it, is found by loading its page. A layer's ID is its record's GUID;
|
|
63
|
+
* the archive answers which page holds it, in the reader's worker when there is one.
|
|
64
|
+
*/
|
|
65
|
+
export async function pendingReaderPageOfNode(
|
|
66
|
+
graph: SceneGraph,
|
|
67
|
+
nodeId: string
|
|
68
|
+
): Promise<string | null> {
|
|
69
|
+
const archive = figArchive(graph)
|
|
70
|
+
const checkpoint = readerCheckpoint(graph)
|
|
71
|
+
if (!archive || !checkpoint || states.get(graph)?.complete) return null
|
|
72
|
+
const [pageGuid] = await archive.recordPages([nodeId])
|
|
73
|
+
const pageId = pageGuid ? figCheckpointRecords(checkpoint).get(pageGuid) : undefined
|
|
74
|
+
return pageId && isReaderPagePending(graph, pageId) ? pageId : null
|
|
75
|
+
}
|
|
76
|
+
|
|
55
77
|
/** Where the reader stands: which records became which layers, and which pages it loaded. */
|
|
56
78
|
export function readerCheckpoint(graph: SceneGraph): FigSessionCheckpoint | undefined {
|
|
57
79
|
const state = states.get(graph)
|
|
@@ -5,14 +5,16 @@ import type {
|
|
|
5
5
|
FigSessionCheckpoint
|
|
6
6
|
} from '@pairdraw/fig'
|
|
7
7
|
import type { FigPageManifestEntry } from '@pairdraw/kiwi/fig'
|
|
8
|
+
import type { SceneNode } from '@pairdraw/scene-graph'
|
|
8
9
|
|
|
9
10
|
import type { ParseFigFileOptions } from '#core/io/formats/fig/read'
|
|
10
11
|
import type { SerializedSceneGraph } from '#core/kiwi/fig/parse/transfer'
|
|
11
12
|
import type { FigPopulationDelta } from '#core/kiwi/fig/population/delta'
|
|
13
|
+
import type { FigGraphEdits } from '#core/kiwi/fig/population/edits'
|
|
12
14
|
|
|
13
15
|
export interface FigSessionOpenRequest {
|
|
14
16
|
type: 'open'
|
|
15
|
-
/** The file, transferred
|
|
17
|
+
/** The file, transferred: the worker reads it and keeps it as the original archive. */
|
|
16
18
|
buffer: ArrayBuffer
|
|
17
19
|
options?: Pick<ParseFigFileOptions, 'populate'>
|
|
18
20
|
port: MessagePort
|
|
@@ -25,6 +27,12 @@ export interface FigSessionPopulateRequest {
|
|
|
25
27
|
pageId: string
|
|
26
28
|
}
|
|
27
29
|
|
|
30
|
+
/** Edits made on the main thread since the last batch, for the worker's copy of the graph. */
|
|
31
|
+
export interface FigSessionEditsRequest {
|
|
32
|
+
type: 'edits'
|
|
33
|
+
edits: FigGraphEdits
|
|
34
|
+
}
|
|
35
|
+
|
|
28
36
|
export interface FigSessionOriginalArchiveRequest {
|
|
29
37
|
type: 'original-archive'
|
|
30
38
|
requestId: string
|
|
@@ -42,6 +50,13 @@ export interface FigSessionComponentPagesRequest {
|
|
|
42
50
|
componentIds: string[]
|
|
43
51
|
}
|
|
44
52
|
|
|
53
|
+
export interface FigSessionRecordPagesRequest {
|
|
54
|
+
type: 'record-pages'
|
|
55
|
+
requestId: string
|
|
56
|
+
/** Archive GUIDs of the records, as `session:local`. */
|
|
57
|
+
recordIds: string[]
|
|
58
|
+
}
|
|
59
|
+
|
|
45
60
|
export interface FigSessionPatchArchiveRequest {
|
|
46
61
|
type: 'patch-archive'
|
|
47
62
|
requestId: string
|
|
@@ -65,9 +80,11 @@ export interface FigSessionDisposeRequest {
|
|
|
65
80
|
|
|
66
81
|
export type FigSessionRequest =
|
|
67
82
|
| FigSessionPopulateRequest
|
|
83
|
+
| FigSessionEditsRequest
|
|
68
84
|
| FigSessionOriginalArchiveRequest
|
|
69
85
|
| FigSessionArchiveInfoRequest
|
|
70
86
|
| FigSessionComponentPagesRequest
|
|
87
|
+
| FigSessionRecordPagesRequest
|
|
71
88
|
| FigSessionPatchArchiveRequest
|
|
72
89
|
| FigSessionRetireRequest
|
|
73
90
|
| FigSessionCancelRequest
|
|
@@ -81,6 +98,8 @@ export type FigSessionResponse =
|
|
|
81
98
|
checkpoint?: FigSessionCheckpoint
|
|
82
99
|
/** Taken while the records are decoded, for writing the archive back later. */
|
|
83
100
|
archiveInfo?: FigArchiveRecordInfo
|
|
101
|
+
/** A copy of the archive, transferred, for the main thread to recover pages from. */
|
|
102
|
+
archive?: ArrayBuffer
|
|
84
103
|
error?: string
|
|
85
104
|
}
|
|
86
105
|
| {
|
|
@@ -91,12 +110,18 @@ export type FigSessionResponse =
|
|
|
91
110
|
checkpoint?: FigSessionCheckpoint
|
|
92
111
|
delta: FigPopulationDelta
|
|
93
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Some of a page load's new layers, each after its parent, sent ahead of its result so the main
|
|
115
|
+
* thread applies a large page piece by piece.
|
|
116
|
+
*/
|
|
117
|
+
| { type: 'population-chunk'; requestId: string; created: SceneNode[] }
|
|
94
118
|
/** A page load is still advancing; sent at most once a second while it runs. */
|
|
95
119
|
| { type: 'population-progress'; requestId: string }
|
|
96
120
|
| { type: 'population-error'; requestId?: string; error: string }
|
|
97
121
|
| { type: 'original-archive-result'; requestId: string; bytes: Uint8Array }
|
|
98
122
|
| { type: 'archive-info-result'; requestId: string; info: FigArchiveRecordInfo }
|
|
99
123
|
| { type: 'component-pages-result'; requestId: string; pageIds: string[] }
|
|
124
|
+
| { type: 'record-pages-result'; requestId: string; pageIds: (string | null)[] }
|
|
100
125
|
| { type: 'patch-archive-result'; requestId: string; bytes: Uint8Array }
|
|
101
126
|
| { type: 'archive-error'; requestId: string; error: string }
|
|
102
127
|
| { type: 'disposed' }
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
serializeSceneGraph,
|
|
5
5
|
serializedSceneGraphTransferList
|
|
6
6
|
} from '#core/kiwi/fig/parse/transfer'
|
|
7
|
+
import { applyFigGraphEdits } from '#core/kiwi/fig/population/edits'
|
|
7
8
|
import { createFigArchiveOperations } from '#core/kiwi/fig/session/archive/access'
|
|
8
9
|
import type {
|
|
9
10
|
FigSessionOpenRequest,
|
|
@@ -18,6 +19,8 @@ let port: MessagePort | undefined
|
|
|
18
19
|
|
|
19
20
|
/** How often a page load reports that it is still advancing. */
|
|
20
21
|
const PROGRESS_INTERVAL_MS = 1000
|
|
22
|
+
/** New layers per piece of a page load: copying and applying one takes the main thread ~50 ms. */
|
|
23
|
+
const POPULATION_CHUNK_LAYERS = 1000
|
|
21
24
|
|
|
22
25
|
function respond(message: FigSessionResponse, transfer: Transferable[] = []): void {
|
|
23
26
|
port?.postMessage(message, transfer)
|
|
@@ -33,17 +36,31 @@ function populate(request: Extract<FigSessionRequest, { type: 'populate' }>): vo
|
|
|
33
36
|
reportedAt = now
|
|
34
37
|
respond({ type: 'population-progress', requestId })
|
|
35
38
|
})
|
|
39
|
+
// Sent in pieces, so the main thread copies and applies a large page in tasks short enough
|
|
40
|
+
// for the editor to keep responding between them.
|
|
41
|
+
const { created, ...changes } = result.delta
|
|
42
|
+
for (let start = 0; start < created.length; start += POPULATION_CHUNK_LAYERS) {
|
|
43
|
+
respond({
|
|
44
|
+
type: 'population-chunk',
|
|
45
|
+
requestId,
|
|
46
|
+
created: created.slice(start, start + POPULATION_CHUNK_LAYERS).map(([, node]) => node)
|
|
47
|
+
})
|
|
48
|
+
}
|
|
36
49
|
respond({
|
|
37
50
|
type: 'population-result',
|
|
38
|
-
requestId
|
|
51
|
+
requestId,
|
|
39
52
|
baseRevision: request.baseRevision,
|
|
40
|
-
|
|
53
|
+
populated: result.populated,
|
|
54
|
+
checkpoint: result.checkpoint,
|
|
55
|
+
delta: { ...changes, created: [] }
|
|
41
56
|
})
|
|
42
57
|
}
|
|
43
58
|
|
|
44
59
|
type ArchiveRequest = Extract<
|
|
45
60
|
FigSessionRequest,
|
|
46
|
-
{
|
|
61
|
+
{
|
|
62
|
+
type: 'original-archive' | 'archive-info' | 'component-pages' | 'record-pages' | 'patch-archive'
|
|
63
|
+
}
|
|
47
64
|
>
|
|
48
65
|
|
|
49
66
|
async function answerArchiveRequest(request: ArchiveRequest): Promise<void> {
|
|
@@ -58,6 +75,9 @@ async function answerArchiveRequest(request: ArchiveRequest): Promise<void> {
|
|
|
58
75
|
} else if (request.type === 'component-pages') {
|
|
59
76
|
const pageIds = archive.componentPages(request.componentIds)
|
|
60
77
|
respond({ type: 'component-pages-result', requestId, pageIds })
|
|
78
|
+
} else if (request.type === 'record-pages') {
|
|
79
|
+
const pageIds = archive.recordPages(request.recordIds)
|
|
80
|
+
respond({ type: 'record-pages-result', requestId, pageIds })
|
|
61
81
|
} else {
|
|
62
82
|
const bytes = await archive.patch(request.patch, request.input)
|
|
63
83
|
port?.postMessage({ type: 'patch-archive-result', requestId, bytes }, [bytes.buffer])
|
|
@@ -77,6 +97,7 @@ function handleRequest(request: FigSessionRequest): void {
|
|
|
77
97
|
request.type === 'original-archive' ||
|
|
78
98
|
request.type === 'archive-info' ||
|
|
79
99
|
request.type === 'component-pages' ||
|
|
100
|
+
request.type === 'record-pages' ||
|
|
80
101
|
request.type === 'patch-archive'
|
|
81
102
|
) {
|
|
82
103
|
void answerArchiveRequest(request)
|
|
@@ -96,6 +117,10 @@ function handleRequest(request: FigSessionRequest): void {
|
|
|
96
117
|
session = undefined
|
|
97
118
|
return
|
|
98
119
|
}
|
|
120
|
+
if (request.type === 'edits') {
|
|
121
|
+
if (session) applyFigGraphEdits(session.graph, request.edits)
|
|
122
|
+
return
|
|
123
|
+
}
|
|
99
124
|
populate(request)
|
|
100
125
|
} catch (error) {
|
|
101
126
|
respond({
|
|
@@ -111,27 +136,29 @@ self.onmessage = async (event: MessageEvent<FigSessionOpenRequest>) => {
|
|
|
111
136
|
port = request.port
|
|
112
137
|
port.onmessage = (message: MessageEvent<FigSessionRequest>) => handleRequest(message.data)
|
|
113
138
|
port.start()
|
|
114
|
-
// The worker copies the archive itself, so the main thread sends the file once.
|
|
115
|
-
const archiveBytes = request.buffer.slice(0)
|
|
116
139
|
try {
|
|
117
140
|
await loadFigDataDecompressor()
|
|
118
141
|
const opened = openReaderSession(request.buffer, request.options?.populate)
|
|
119
142
|
const archiveInfo = opened.session.archiveRecordInfo()
|
|
120
|
-
archive = createFigArchiveOperations(
|
|
143
|
+
archive = createFigArchiveOperations(request.buffer, () => archiveInfo)
|
|
121
144
|
respond({ type: 'page-manifest', pages: opened.pages })
|
|
122
145
|
const graph = serializeSceneGraph(opened.graph)
|
|
123
|
-
|
|
146
|
+
const keepsSession =
|
|
124
147
|
request.options?.populate === 'first-page' || request.options?.populate === 'none'
|
|
125
|
-
|
|
126
|
-
|
|
148
|
+
session = keepsSession ? opened : undefined
|
|
149
|
+
const mainThreadArchive = keepsSession ? request.buffer.slice(0) : undefined
|
|
127
150
|
respond(
|
|
128
151
|
{
|
|
129
152
|
type: 'graph',
|
|
130
153
|
graph,
|
|
131
154
|
checkpoint: opened.checkpoint(),
|
|
132
|
-
archiveInfo
|
|
155
|
+
archiveInfo,
|
|
156
|
+
archive: mainThreadArchive
|
|
133
157
|
},
|
|
134
|
-
|
|
158
|
+
[
|
|
159
|
+
...serializedSceneGraphTransferList(graph),
|
|
160
|
+
...(mainThreadArchive ? [mainThreadArchive] : [])
|
|
161
|
+
]
|
|
135
162
|
)
|
|
136
163
|
} catch (error) {
|
|
137
164
|
respond({ type: 'graph', error: error instanceof Error ? error.message : String(error) })
|
package/src/layout/apply.ts
CHANGED
|
@@ -2,9 +2,11 @@ import type { Node as YogaNode } from 'yoga-layout'
|
|
|
2
2
|
|
|
3
3
|
import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
4
4
|
import { enforcedAspectRatio } from '@pairdraw/scene-graph/layout'
|
|
5
|
-
import {
|
|
5
|
+
import type { Vector } from '@pairdraw/scene-graph/primitives'
|
|
6
|
+
import { layoutConstrainedChildRect, shapeGeometryChanges } from '@pairdraw/scene-graph/resize'
|
|
6
7
|
|
|
7
8
|
import { keepsSavedLayout, usesDetachedDerivedLayout } from './derived'
|
|
9
|
+
import { laidOutFlowBox } from './flow-edges'
|
|
8
10
|
|
|
9
11
|
export type ComputeLayoutFn = (graph: SceneGraph, frameId: string) => void
|
|
10
12
|
|
|
@@ -47,22 +49,44 @@ function writeLayoutGeometry(
|
|
|
47
49
|
const value = geometry[key]
|
|
48
50
|
if (value !== undefined && value !== node[key]) changes[key] = value
|
|
49
51
|
}
|
|
50
|
-
|
|
52
|
+
const resized = changes.width !== undefined || changes.height !== undefined
|
|
53
|
+
const outlines = resized
|
|
54
|
+
? shapeGeometryChanges(node, changes.width ?? node.width, changes.height ?? node.height)
|
|
55
|
+
: {}
|
|
56
|
+
if (Object.keys(changes).length + Object.keys(outlines).length > 0) {
|
|
57
|
+
graph.updateNode(id, { ...changes, ...outlines })
|
|
58
|
+
}
|
|
51
59
|
if (!CONSTRAINT_PARENT_TYPES.has(node.type)) return
|
|
52
60
|
// Laying out what a file holds, as a page opens or its fonts arrive, resizes a frame only where
|
|
53
61
|
// our layout differs from the one the file saved; its children keep the places it saved.
|
|
54
62
|
if (graph.isApplyingDerivedLayout && !constrained) return
|
|
55
63
|
if (from.width !== node.width || from.height !== node.height) {
|
|
56
64
|
constrainChildren(graph, node, from, computeLayout)
|
|
65
|
+
rememberPlacedSize(node)
|
|
57
66
|
}
|
|
58
67
|
}
|
|
59
68
|
|
|
60
69
|
/**
|
|
61
|
-
* The size each Hug frame
|
|
62
|
-
* frame's entry goes with it and a restored one starts afresh.
|
|
70
|
+
* The size each Hug frame's constrained children were last placed for by layout. Keyed by the
|
|
71
|
+
* node, so a deleted frame's entry goes with it and a restored one starts afresh.
|
|
63
72
|
*/
|
|
64
73
|
const huggedSizes = new WeakMap<SceneNode, { width: number; height: number }>()
|
|
65
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Records a frame's size as the one its constrained children were placed for, after a rescale
|
|
77
|
+
* scaled them with it: the next hug moves them from the scaled size, not twice from the old one.
|
|
78
|
+
*/
|
|
79
|
+
export function restoredHuggedSize(frame: SceneNode): void {
|
|
80
|
+
if (huggedSizes.has(frame)) huggedSizes.set(frame, { width: frame.width, height: frame.height })
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function rememberPlacedSize(frame: SceneNode): void {
|
|
84
|
+
const placed = huggedSizes.get(frame)
|
|
85
|
+
if (!placed) return
|
|
86
|
+
placed.width = frame.width
|
|
87
|
+
placed.height = frame.height
|
|
88
|
+
}
|
|
89
|
+
|
|
66
90
|
const CONSTRAINT_PARENT_TYPES: ReadonlySet<SceneNode['type']> = new Set([
|
|
67
91
|
'FRAME',
|
|
68
92
|
'COMPONENT',
|
|
@@ -165,11 +189,13 @@ function computedChildPosition(
|
|
|
165
189
|
child: SceneNode,
|
|
166
190
|
yogaChild: YogaNode,
|
|
167
191
|
axis: 'x' | 'y',
|
|
192
|
+
origin: number,
|
|
168
193
|
preservesImportedGeometry: boolean,
|
|
169
194
|
keepsSaved: boolean
|
|
170
195
|
): number {
|
|
171
196
|
if (preservesImportedGeometry) return child[axis]
|
|
172
|
-
const computed =
|
|
197
|
+
const computed =
|
|
198
|
+
origin + (axis === 'x' ? yogaChild.getComputedLeft() : yogaChild.getComputedTop())
|
|
173
199
|
if (child.type === 'INSTANCE' || !keepsSaved) return computed
|
|
174
200
|
return child.derivedLayout?.[axis] ?? computed
|
|
175
201
|
}
|
|
@@ -210,6 +236,7 @@ function updateChildFromYoga(
|
|
|
210
236
|
frame: SceneNode,
|
|
211
237
|
child: SceneNode,
|
|
212
238
|
yogaChild: YogaNode,
|
|
239
|
+
origin: Vector,
|
|
213
240
|
keepsSaved: boolean,
|
|
214
241
|
computeLayout: ComputeLayoutFn
|
|
215
242
|
): void {
|
|
@@ -224,8 +251,22 @@ function updateChildFromYoga(
|
|
|
224
251
|
graph,
|
|
225
252
|
child.id,
|
|
226
253
|
{
|
|
227
|
-
x: computedChildPosition(
|
|
228
|
-
|
|
254
|
+
x: computedChildPosition(
|
|
255
|
+
child,
|
|
256
|
+
yogaChild,
|
|
257
|
+
'x',
|
|
258
|
+
origin.x,
|
|
259
|
+
preservesImportedPosition,
|
|
260
|
+
keepsSaved
|
|
261
|
+
),
|
|
262
|
+
y: computedChildPosition(
|
|
263
|
+
child,
|
|
264
|
+
yogaChild,
|
|
265
|
+
'y',
|
|
266
|
+
origin.y,
|
|
267
|
+
preservesImportedPosition,
|
|
268
|
+
keepsSaved
|
|
269
|
+
),
|
|
229
270
|
width: computedChildSize(
|
|
230
271
|
child,
|
|
231
272
|
yogaChild,
|
|
@@ -283,13 +324,14 @@ export function applyYogaLayout(
|
|
|
283
324
|
applyFrameSize(graph, frame, yogaNode, keepsSaved, computeLayout)
|
|
284
325
|
|
|
285
326
|
const children = graph.getChildren(frame.id)
|
|
327
|
+
const box = laidOutFlowBox(yogaNode, frame)
|
|
286
328
|
let yogaIndex = 0
|
|
287
329
|
for (const child of children) {
|
|
288
|
-
if (yogaIndex >=
|
|
289
|
-
const yogaChild =
|
|
330
|
+
if (yogaIndex >= box.node.getChildCount()) continue
|
|
331
|
+
const yogaChild = box.node.getChild(yogaIndex)
|
|
290
332
|
yogaIndex++
|
|
291
333
|
|
|
292
|
-
updateChildFromYoga(graph, frame, child, yogaChild, keepsSaved, computeLayout)
|
|
334
|
+
updateChildFromYoga(graph, frame, child, yogaChild, box.origin, keepsSaved, computeLayout)
|
|
293
335
|
|
|
294
336
|
if (!child.visible) continue
|
|
295
337
|
if (preservesImportedInstanceInternals(child)) continue
|
|
@@ -243,7 +243,43 @@ function layoutOptions(input: ArrangeInput): Record<string, string> {
|
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
+
/**
|
|
247
|
+
* SPOrE's importer moves a box whose centre another box already has with an unseeded
|
|
248
|
+
* `Math.random()`, and SPOrE ignores `elk.randomSeed`, so a pile would spread differently on every
|
|
249
|
+
* run (ElkGraphImporter.java, eclipse-elk/elk b715fb1, lines 166-172). Doing that move here,
|
|
250
|
+
* deterministically, means ELK never reaches it. Remove once elkjs seeds it
|
|
251
|
+
* (https://github.com/eclipse-elk/elk/issues/1211). `NUDGE` is the first
|
|
252
|
+
* move's length in pixels.
|
|
253
|
+
*/
|
|
254
|
+
const NUDGE = 0.5
|
|
255
|
+
/** Each further move turns by the golden angle, so the moved centres do not fall on one line. */
|
|
256
|
+
const GOLDEN_ANGLE = Math.PI * (3 - Math.sqrt(5))
|
|
257
|
+
|
|
258
|
+
/** Gives every box in each container, at every level, a centre of its own. */
|
|
259
|
+
function separateCentres(container: ElkNode): void {
|
|
260
|
+
const repeats = new Map<string, number>()
|
|
261
|
+
for (const node of container.children ?? []) {
|
|
262
|
+
separateCentres(node)
|
|
263
|
+
const x = (node.x ?? 0) + (node.width ?? 0) / 2
|
|
264
|
+
const y = (node.y ?? 0) + (node.height ?? 0) / 2
|
|
265
|
+
const key = `${x},${y}`
|
|
266
|
+
const repeat = repeats.get(key) ?? 0
|
|
267
|
+
repeats.set(key, repeat + 1)
|
|
268
|
+
if (repeat === 0) continue
|
|
269
|
+
const distance = NUDGE * Math.sqrt(repeat)
|
|
270
|
+
node.x = (node.x ?? 0) + distance * Math.cos(repeat * GOLDEN_ANGLE)
|
|
271
|
+
node.y = (node.y ?? 0) + distance * Math.sin(repeat * GOLDEN_ANGLE)
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/** The graph ELK lays `input` out from. */
|
|
246
276
|
function elkGraph(input: ArrangeInput): ElkNode {
|
|
277
|
+
const root = elkHierarchy(input)
|
|
278
|
+
if (input.layout === 'spread' || input.layout === 'compact') separateCentres(root)
|
|
279
|
+
return root
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function elkHierarchy(input: ArrangeInput): ElkNode {
|
|
247
283
|
const flow = input.layout === 'flow'
|
|
248
284
|
const [outSide, inSide] = FLOW_SIDES[input.direction ?? 'TB']
|
|
249
285
|
const options = layoutOptions(input)
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Align,
|
|
3
|
+
Edge,
|
|
4
|
+
FlexDirection,
|
|
5
|
+
Gutter,
|
|
6
|
+
Justify,
|
|
7
|
+
Wrap,
|
|
8
|
+
type Node as YogaNode
|
|
9
|
+
} from 'yoga-layout'
|
|
10
|
+
|
|
11
|
+
import type { SceneNode } from '@pairdraw/scene-graph'
|
|
12
|
+
import { isGeneratedFrame } from '@pairdraw/scene-graph/generated'
|
|
13
|
+
import type { Vector } from '@pairdraw/scene-graph/primitives'
|
|
14
|
+
|
|
15
|
+
import { createYogaNode, mapAlign, mapJustify } from './yoga-helpers'
|
|
16
|
+
|
|
17
|
+
type Side = 'top' | 'right' | 'bottom' | 'left'
|
|
18
|
+
|
|
19
|
+
const PHYSICAL_EDGE: Record<Side, Edge> = {
|
|
20
|
+
top: Edge.Top,
|
|
21
|
+
right: Edge.Right,
|
|
22
|
+
bottom: Edge.Bottom,
|
|
23
|
+
left: Edge.Left
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const SIDES = Object.keys(PHYSICAL_EDGE) as Side[]
|
|
27
|
+
|
|
28
|
+
// Space between takes the place of the gap in Figma's auto layout. A generated frame keeps it
|
|
29
|
+
// as the least space between its sublayers, as a sticky note keeps its author clear of a long body.
|
|
30
|
+
function primaryAxisSpacing(frame: SceneNode): number {
|
|
31
|
+
return frame.primaryAxisAlign === 'SPACE_BETWEEN' && !isGeneratedFrame(frame)
|
|
32
|
+
? 0
|
|
33
|
+
: frame.itemSpacing
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** The space Figma puts between children along the main axis. */
|
|
37
|
+
export function primaryAxisGap(frame: SceneNode): number {
|
|
38
|
+
return Math.max(0, primaryAxisSpacing(frame))
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Yoga lays a negative gap out as none, so siblings overlap through negative trailing margins.
|
|
42
|
+
// Figma keeps the overlap inside each wrapped row too; only the space between rows stays >= 0.
|
|
43
|
+
export function siblingOverlap(frame: SceneNode): number {
|
|
44
|
+
return Math.max(0, -primaryAxisSpacing(frame))
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** A frame's padding on each side, without the share of its own stroke inside its box. */
|
|
48
|
+
function layoutPadding(frame: SceneNode): Record<Side, number> {
|
|
49
|
+
return {
|
|
50
|
+
top: frame.paddingTop,
|
|
51
|
+
right: frame.paddingRight,
|
|
52
|
+
bottom: frame.paddingBottom,
|
|
53
|
+
left: frame.paddingLeft
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// The side a frame's flow ends on, which takes back the overlap of a negative gap.
|
|
58
|
+
function trailingSide(frame: SceneNode, direction: 'LTR' | 'RTL'): Side {
|
|
59
|
+
if (frame.layoutMode !== 'HORIZONTAL') return 'bottom'
|
|
60
|
+
return direction === 'RTL' ? 'left' : 'right'
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** How an auto layout frame lines up its children: axis, wrapping, alignment, and gaps. */
|
|
64
|
+
export function setFlexFlow(yogaNode: YogaNode, frame: SceneNode): void {
|
|
65
|
+
const horizontal = frame.layoutMode === 'HORIZONTAL'
|
|
66
|
+
yogaNode.setFlexDirection(horizontal ? FlexDirection.Row : FlexDirection.Column)
|
|
67
|
+
yogaNode.setFlexWrap(frame.layoutWrap === 'WRAP' ? Wrap.Wrap : Wrap.NoWrap)
|
|
68
|
+
yogaNode.setJustifyContent(mapJustify(frame.primaryAxisAlign))
|
|
69
|
+
yogaNode.setAlignItems(mapAlign(frame.counterAxisAlign))
|
|
70
|
+
if (frame.layoutWrap === 'WRAP' && frame.counterAxisAlignContent === 'SPACE_BETWEEN') {
|
|
71
|
+
yogaNode.setAlignContent(Align.SpaceBetween)
|
|
72
|
+
}
|
|
73
|
+
const primaryGap = primaryAxisGap(frame)
|
|
74
|
+
yogaNode.setGap(Gutter.Column, horizontal ? primaryGap : frame.counterAxisSpacing)
|
|
75
|
+
yogaNode.setGap(Gutter.Row, horizontal ? frame.counterAxisSpacing : primaryGap)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Yoga clamps negative padding, while Figma lets it grow the box its children are laid out in past
|
|
79
|
+
// the frame's edges: they align, stretch, grow, and wrap within it. Such a frame lays its children
|
|
80
|
+
// out in an inner flow box that takes the negative padding as its margins.
|
|
81
|
+
function laysOutInFlowBox(frame: SceneNode): boolean {
|
|
82
|
+
return (
|
|
83
|
+
frame.layoutMode !== 'GRID' && Object.values(layoutPadding(frame)).some((length) => length < 0)
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** The Yoga node a frame's children go into: the frame's own, or its flow box. */
|
|
88
|
+
export function insertFlowBox(yogaFrame: YogaNode, frame: SceneNode): YogaNode {
|
|
89
|
+
if (!laysOutInFlowBox(frame)) return yogaFrame
|
|
90
|
+
const box = createYogaNode()
|
|
91
|
+
setFlexFlow(box, frame)
|
|
92
|
+
box.setFlexGrow(1)
|
|
93
|
+
box.setFlexShrink(1)
|
|
94
|
+
yogaFrame.setFlexWrap(Wrap.NoWrap)
|
|
95
|
+
yogaFrame.setJustifyContent(Justify.FlexStart)
|
|
96
|
+
yogaFrame.setAlignItems(Align.Stretch)
|
|
97
|
+
yogaFrame.setAlignContent(Align.FlexStart)
|
|
98
|
+
yogaFrame.setGap(Gutter.All, 0)
|
|
99
|
+
yogaFrame.insertChild(box, 0)
|
|
100
|
+
return box
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** The laid-out Yoga node holding a frame's children, and where it sits in the frame. */
|
|
104
|
+
export function laidOutFlowBox(
|
|
105
|
+
yogaFrame: YogaNode,
|
|
106
|
+
frame: SceneNode
|
|
107
|
+
): { node: YogaNode; origin: Vector } {
|
|
108
|
+
if (!laysOutInFlowBox(frame) || yogaFrame.getChildCount() === 0) {
|
|
109
|
+
return { node: yogaFrame, origin: { x: 0, y: 0 } }
|
|
110
|
+
}
|
|
111
|
+
const box = yogaFrame.getChild(0)
|
|
112
|
+
return { node: box, origin: { x: box.getComputedLeft(), y: box.getComputedTop() } }
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Lays out what Yoga clamps: each in-flow child gives up a negative gap's overlap after it, and the
|
|
117
|
+
* frame takes it back on its trailing side, so a hugging frame ends at its last child; a negative
|
|
118
|
+
* side becomes a margin of the flow box. Margins go on physical edges, as a child reads logical
|
|
119
|
+
* ones in its own direction.
|
|
120
|
+
*/
|
|
121
|
+
export function setFlowEdges(
|
|
122
|
+
yogaFrame: YogaNode,
|
|
123
|
+
box: YogaNode,
|
|
124
|
+
frame: SceneNode,
|
|
125
|
+
flow: readonly YogaNode[],
|
|
126
|
+
direction: 'LTR' | 'RTL'
|
|
127
|
+
): void {
|
|
128
|
+
const overlap = flow.length > 1 ? siblingOverlap(frame) : 0
|
|
129
|
+
const padding = layoutPadding(frame)
|
|
130
|
+
if (overlap === 0 && box === yogaFrame) return
|
|
131
|
+
const trailing = trailingSide(frame, direction)
|
|
132
|
+
padding[trailing] += overlap
|
|
133
|
+
for (const side of SIDES) {
|
|
134
|
+
yogaFrame.setPadding(PHYSICAL_EDGE[side], Math.max(0, padding[side]))
|
|
135
|
+
if (box !== yogaFrame) box.setMargin(PHYSICAL_EDGE[side], Math.min(0, padding[side]))
|
|
136
|
+
}
|
|
137
|
+
if (overlap === 0) return
|
|
138
|
+
for (const child of flow) child.setMargin(PHYSICAL_EDGE[trailing], -overlap)
|
|
139
|
+
}
|