@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
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { SceneGraph } from '@pairdraw/scene-graph'
|
|
2
|
+
|
|
3
|
+
/** `3 variables`, with the noun matching the count. */
|
|
4
|
+
function counted(count: number, one: string, many: string): string {
|
|
5
|
+
return `${count} ${count === 1 ? one : many}`
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* What a draw.io file cannot hold. draw.io has no variable model and no style that reads one, so
|
|
10
|
+
* a document that paints with variables arrives in draw.io as plain colours and comes back
|
|
11
|
+
* unbound. The writer names that loss instead of writing a file that looks complete.
|
|
12
|
+
*/
|
|
13
|
+
export function drawioDroppedWarnings(graph: SceneGraph): string[] {
|
|
14
|
+
const variables = graph.variables.size
|
|
15
|
+
if (variables === 0) return []
|
|
16
|
+
const names = [...graph.variableCollections.values()].map((collection) => collection.name)
|
|
17
|
+
const dropped = `draw.io has no variables: ${counted(variables, 'variable', 'variables')} in ${counted(names.length, 'collection', 'collections')} (${names.join(', ')}) not written`
|
|
18
|
+
const bound = [...graph.nodes.values()].filter(
|
|
19
|
+
(node) => Object.keys(node.boundVariables).length > 0
|
|
20
|
+
).length
|
|
21
|
+
if (bound === 0) return [dropped]
|
|
22
|
+
const users =
|
|
23
|
+
bound === 1
|
|
24
|
+
? '1 layer that uses one lost the binding'
|
|
25
|
+
: `${counted(bound, 'layer', 'layers')} that use them lost the binding`
|
|
26
|
+
return [`${dropped}, and ${users}`]
|
|
27
|
+
}
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
renameBehaviourProperties,
|
|
23
23
|
withBehaviour
|
|
24
24
|
} from '@pairdraw/scene-graph/behaviours'
|
|
25
|
-
import {
|
|
25
|
+
import { orderKeyBetween, siblingOrderKeys } from '@pairdraw/scene-graph/order-keys'
|
|
26
26
|
import type { GUID, Rect, Size } from '@pairdraw/scene-graph/primitives'
|
|
27
27
|
import { ownsSlotContent } from '@pairdraw/scene-graph/slots'
|
|
28
28
|
|
|
@@ -95,7 +95,12 @@ async function renderFigThumbnail(
|
|
|
95
95
|
): Promise<FigThumbnail> {
|
|
96
96
|
const frame = pageId ? thumbnailFrame(graph, pageId, THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT) : null
|
|
97
97
|
if (!pageId || !frame) return placeholderThumbnail()
|
|
98
|
-
|
|
98
|
+
// The preview is optional: a renderer that throws while drawing it must not fail the save,
|
|
99
|
+
// as a renderer that returns null already falls back to the placeholder.
|
|
100
|
+
const png = await renderFigThumbnailPNG(graph, pageId, options).catch((error: unknown) => {
|
|
101
|
+
console.warn('[.fig] Could not draw the file preview:', error)
|
|
102
|
+
return null
|
|
103
|
+
})
|
|
99
104
|
if (!png) return placeholderThumbnail()
|
|
100
105
|
const { minX, minY, maxX, maxY } = frame.bounds
|
|
101
106
|
return {
|
|
@@ -271,6 +276,9 @@ function buildCanvasEntries(
|
|
|
271
276
|
): { canvasEntries: CanvasExportEntry[]; internalCanvasGuid: GUID | null } {
|
|
272
277
|
const canvasEntries: CanvasExportEntry[] = []
|
|
273
278
|
let internalCanvasGuid: GUID | null = null
|
|
279
|
+
// Pages keep the keys they were read with while those stay in order; a page added or moved
|
|
280
|
+
// gets one between its neighbours', as Figma sorts pages by these keys.
|
|
281
|
+
const orderKeys = siblingOrderKeys(pages.map((page) => page.source.orderKey))
|
|
274
282
|
for (let p = 0; p < pages.length; p++) {
|
|
275
283
|
const page = pages[p]
|
|
276
284
|
const canvasGuid = (() => {
|
|
@@ -299,17 +307,11 @@ function buildCanvasEntries(
|
|
|
299
307
|
assignedGuidValues.add(`${canvasGuid.sessionID}:${canvasGuid.localID}`)
|
|
300
308
|
if (page.internalOnly) internalCanvasGuid = canvasGuid
|
|
301
309
|
|
|
302
|
-
const canvasNc = makeCanvasNodeChange(
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
{
|
|
308
|
-
backgroundOpacity: 1,
|
|
309
|
-
backgroundColor: { ...CANVAS_BG_COLOR },
|
|
310
|
-
backgroundEnabled: true
|
|
311
|
-
}
|
|
312
|
-
)
|
|
310
|
+
const canvasNc = makeCanvasNodeChange(canvasGuid, docGuid, orderKeys[p], page.name, {
|
|
311
|
+
backgroundOpacity: 1,
|
|
312
|
+
backgroundColor: { ...CANVAS_BG_COLOR },
|
|
313
|
+
backgroundEnabled: true
|
|
314
|
+
})
|
|
313
315
|
applyImportedCanvasFields(page, canvasNc)
|
|
314
316
|
if (page.internalOnly) canvasNc.internalOnly = true
|
|
315
317
|
canvasEntries.push({ page, canvasGuid, canvasNc })
|
|
@@ -329,7 +331,7 @@ function buildCanvasEntries(
|
|
|
329
331
|
canvasNc: makeCanvasNodeChange(
|
|
330
332
|
internalCanvasGuid,
|
|
331
333
|
docGuid,
|
|
332
|
-
|
|
334
|
+
orderKeyBetween(orderKeys.at(-1) ?? null, null),
|
|
333
335
|
'Internal Only Canvas',
|
|
334
336
|
{ internalOnly: true }
|
|
335
337
|
)
|
|
@@ -22,7 +22,6 @@ import type {
|
|
|
22
22
|
} from '@pairdraw/scene-graph'
|
|
23
23
|
import { fractionalPosition, orderKeyBetween } from '@pairdraw/scene-graph/order-keys'
|
|
24
24
|
import {
|
|
25
|
-
modesDefaultFirst,
|
|
26
25
|
isUnsupportedVariableValue,
|
|
27
26
|
foldFormula,
|
|
28
27
|
formulaValueType,
|
|
@@ -257,13 +256,13 @@ export function appendVariableNodeChanges(
|
|
|
257
256
|
phase: 'CREATED',
|
|
258
257
|
strokeAlign: 'CENTER',
|
|
259
258
|
strokeJoin: 'BEVEL',
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
),
|
|
259
|
+
// The saved array order is the file's own and round-trips as it was; the sort positions
|
|
260
|
+
// carry the listed order, which the reader shows and the default follows.
|
|
261
|
+
variableSetModes: modeSortPositions(collection.modes).map(({ mode, sortPosition }) => ({
|
|
262
|
+
id: modes.get(mode.modeId) ?? stringToGuid(mode.modeId),
|
|
263
|
+
name: mode.name,
|
|
264
|
+
sortPosition
|
|
265
|
+
})),
|
|
267
266
|
pluginData: collectionPluginDataNodeChange(collection, modeKey),
|
|
268
267
|
key: collection.key,
|
|
269
268
|
version: collection.version
|
|
@@ -3,6 +3,7 @@ export { exportFigFile, compressFigData, type FigFileExtrasOptions } from './wri
|
|
|
3
3
|
export { figThumbnailPageId } from './thumbnail-page'
|
|
4
4
|
export {
|
|
5
5
|
isReaderPagePending as isFigPagePending,
|
|
6
|
+
pendingReaderPageOfNode as pendingFigPageOfNode,
|
|
6
7
|
populateFigPage,
|
|
7
8
|
populateAllFigPages,
|
|
8
9
|
readerDiagnostics
|
|
@@ -52,16 +52,17 @@ async function parseFigFileMainThread(
|
|
|
52
52
|
return reader.graph
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
/** Takes `buffer`: it moves to the worker, which reads it and keeps it as the original archive. */
|
|
55
56
|
export async function parseFigFileViaWorker(
|
|
56
57
|
buffer: ArrayBuffer,
|
|
57
|
-
options: ParseFigFileOptions
|
|
58
|
+
options: ParseFigFileOptions,
|
|
59
|
+
createWorker: () => Worker = createFigSessionWorker
|
|
58
60
|
): Promise<SceneGraph> {
|
|
59
61
|
options.signal?.throwIfAborted()
|
|
60
62
|
// The worker loads its own; this thread patches the archive on save, which reads it again.
|
|
61
63
|
await loadFigDataDecompressor()
|
|
62
64
|
return new Promise((resolve, reject) => {
|
|
63
|
-
|
|
64
|
-
const worker = createFigSessionWorker()
|
|
65
|
+
const worker = createWorker()
|
|
65
66
|
const channel = new MessageChannel()
|
|
66
67
|
const abort = () => {
|
|
67
68
|
channel.port1.postMessage({ type: 'dispose' })
|
|
@@ -91,9 +92,10 @@ export async function parseFigFileViaWorker(
|
|
|
91
92
|
const register = fonts.length > 0 ? registerDocumentFonts(graph, fonts) : null
|
|
92
93
|
if (options.populate === 'first-page' || options.populate === 'none') {
|
|
93
94
|
cleanupAbort()
|
|
94
|
-
const { checkpoint, archiveInfo } = e.data
|
|
95
|
-
if (!checkpoint || !archiveInfo
|
|
96
|
-
|
|
95
|
+
const { checkpoint, archiveInfo, archive: bytes } = e.data
|
|
96
|
+
if (!checkpoint || !archiveInfo || !bytes) {
|
|
97
|
+
throw new Error('Missing reader checkpoint')
|
|
98
|
+
}
|
|
97
99
|
registerReaderRecovery(graph, bytes, checkpoint)
|
|
98
100
|
// The worker writes the archive back; without it the main thread does, from its copy.
|
|
99
101
|
const archive = workerFigArchive(channel.port1, worker, () =>
|
|
@@ -130,20 +132,56 @@ export async function parseFigFileViaWorker(
|
|
|
130
132
|
worker.terminate()
|
|
131
133
|
reject(new Error(err.message || 'Worker failed to parse .fig file'))
|
|
132
134
|
}
|
|
133
|
-
const workerBuffer = buffer.slice(0)
|
|
134
135
|
const request: FigSessionOpenRequest = {
|
|
135
136
|
type: 'open',
|
|
136
|
-
buffer
|
|
137
|
+
buffer,
|
|
137
138
|
options: { populate: options.populate },
|
|
138
139
|
port: channel.port2
|
|
139
140
|
}
|
|
140
|
-
worker.postMessage(request, [
|
|
141
|
+
worker.postMessage(request, [buffer, channel.port2])
|
|
141
142
|
})
|
|
142
143
|
}
|
|
143
144
|
|
|
144
|
-
|
|
145
|
+
/**
|
|
146
|
+
* Opens the file in a worker, which takes `buffer`. If the worker fails after taking it, the
|
|
147
|
+
* main thread reads the archive again with `readAgain`.
|
|
148
|
+
*/
|
|
149
|
+
export async function parseFigFileInWorker(
|
|
145
150
|
buffer: ArrayBuffer,
|
|
146
|
-
options: ParseFigFileOptions
|
|
151
|
+
options: ParseFigFileOptions,
|
|
152
|
+
readAgain: () => Promise<ArrayBuffer>,
|
|
153
|
+
createWorker: () => Worker = createFigSessionWorker
|
|
154
|
+
): Promise<SceneGraph> {
|
|
155
|
+
try {
|
|
156
|
+
return await parseFigFileViaWorker(buffer, options, createWorker)
|
|
157
|
+
} catch (error) {
|
|
158
|
+
if (options.signal?.aborted || error instanceof ReaderSemanticError) {
|
|
159
|
+
throw error
|
|
160
|
+
}
|
|
161
|
+
console.warn('Worker parsing failed, falling back to main thread:', error)
|
|
162
|
+
const archive = buffer.byteLength > 0 ? buffer : await readArchiveAgain(readAgain)
|
|
163
|
+
options.signal?.throwIfAborted()
|
|
164
|
+
return parseFigFileMainThread(archive, options)
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
async function readArchiveAgain(readAgain: () => Promise<ArrayBuffer>): Promise<ArrayBuffer> {
|
|
169
|
+
try {
|
|
170
|
+
return await readAgain()
|
|
171
|
+
} catch (cause) {
|
|
172
|
+
throw new Error('The file changed while it was opening. Open it again.', { cause })
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
interface FigFileSource {
|
|
177
|
+
buffer: ArrayBuffer
|
|
178
|
+
forWorker(): ArrayBuffer
|
|
179
|
+
readAgain(): Promise<ArrayBuffer>
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
async function parseFigSource(
|
|
183
|
+
source: FigFileSource,
|
|
184
|
+
options: ParseFigFileOptions
|
|
147
185
|
): Promise<SceneGraph> {
|
|
148
186
|
options.signal?.throwIfAborted()
|
|
149
187
|
// Loaded here even when a worker opens the file: recovering its pages later reads the archive
|
|
@@ -151,17 +189,20 @@ export async function parseFigFile(
|
|
|
151
189
|
await loadFigDataDecompressor()
|
|
152
190
|
options.signal?.throwIfAborted()
|
|
153
191
|
if (typeof Worker !== 'undefined' && IS_BROWSER) {
|
|
154
|
-
|
|
155
|
-
// The worker gets its own copy, so `buffer` is still whole for the fallback.
|
|
156
|
-
return await parseFigFileViaWorker(buffer, options)
|
|
157
|
-
} catch (error) {
|
|
158
|
-
if (options.signal?.aborted || error instanceof ReaderSemanticError) throw error
|
|
159
|
-
console.warn('Worker parsing failed, falling back to main thread:', error)
|
|
160
|
-
return parseFigFileMainThread(buffer, options)
|
|
161
|
-
}
|
|
192
|
+
return parseFigFileInWorker(source.forWorker(), options, () => source.readAgain())
|
|
162
193
|
}
|
|
163
|
-
options
|
|
164
|
-
|
|
194
|
+
return parseFigFileMainThread(source.buffer, options)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** Leaves `buffer` whole: the worker reads a copy of it. */
|
|
198
|
+
export async function parseFigFile(
|
|
199
|
+
buffer: ArrayBuffer,
|
|
200
|
+
options: ParseFigFileOptions = {}
|
|
201
|
+
): Promise<SceneGraph> {
|
|
202
|
+
return parseFigSource(
|
|
203
|
+
{ buffer, forWorker: () => buffer.slice(0), readAgain: async () => buffer },
|
|
204
|
+
options
|
|
205
|
+
)
|
|
165
206
|
}
|
|
166
207
|
|
|
167
208
|
export async function readFigFile(
|
|
@@ -170,6 +211,8 @@ export async function readFigFile(
|
|
|
170
211
|
): Promise<SceneGraph> {
|
|
171
212
|
options.signal?.throwIfAborted()
|
|
172
213
|
const buffer = await file.arrayBuffer()
|
|
173
|
-
|
|
174
|
-
|
|
214
|
+
return parseFigSource(
|
|
215
|
+
{ buffer, forWorker: () => buffer, readAgain: () => file.arrayBuffer() },
|
|
216
|
+
options
|
|
217
|
+
)
|
|
175
218
|
}
|
|
@@ -2,7 +2,7 @@ import { filename } from 'pathe/utils'
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
exportHTMLBundle,
|
|
5
|
-
|
|
5
|
+
sceneNodesToDesignDocument,
|
|
6
6
|
type DesignDocument
|
|
7
7
|
} from '@pairdraw/dom-css/export'
|
|
8
8
|
import type { SceneGraph } from '@pairdraw/scene-graph'
|
|
@@ -23,11 +23,7 @@ function designDocument(
|
|
|
23
23
|
includeLayerNames: options.layerNames ?? true,
|
|
24
24
|
includeSourceIds: options.layerIds ?? false
|
|
25
25
|
}
|
|
26
|
-
return
|
|
27
|
-
type: 'document',
|
|
28
|
-
sourceGraph: graph,
|
|
29
|
-
children: nodeIds.flatMap((id) => sceneNodeToDesignDocument(graph, id, projection).children)
|
|
30
|
-
}
|
|
26
|
+
return sceneNodesToDesignDocument(graph, nodeIds, projection)
|
|
31
27
|
}
|
|
32
28
|
|
|
33
29
|
/** `card.html` keeps its external files in `card.assets/` next to it, whatever the path style. */
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type * as HappyDOM from 'happy-dom'
|
|
2
|
+
import { toUint8Array } from 'js-base64'
|
|
3
|
+
import type { svg2pdf } from 'svg2pdf.js'
|
|
2
4
|
|
|
3
5
|
import { IS_BROWSER } from '#core/constants'
|
|
4
6
|
|
|
@@ -15,6 +17,77 @@ interface SVGParser {
|
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
|
|
20
|
+
/** The pixel size a data URI's image holds, as svg2pdf asks an `Image` for it. */
|
|
21
|
+
function imageSize(source: string): [number, number] {
|
|
22
|
+
const comma = source.indexOf(',')
|
|
23
|
+
if (comma === -1 || !source.slice(0, comma).includes(';base64')) {
|
|
24
|
+
throw new Error('Not a base64 data URI')
|
|
25
|
+
}
|
|
26
|
+
const bytes = toUint8Array(source.slice(comma + 1))
|
|
27
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)
|
|
28
|
+
const starts = (text: string, at = 0) =>
|
|
29
|
+
Array.from(text, (character, index) => bytes[at + index] === character.charCodeAt(0)).every(
|
|
30
|
+
Boolean
|
|
31
|
+
)
|
|
32
|
+
if (starts('\x89PNG')) return [view.getUint32(16), view.getUint32(20)]
|
|
33
|
+
if (starts('GIF8')) return [view.getUint16(6, true), view.getUint16(8, true)]
|
|
34
|
+
if (starts('RIFF') && starts('WEBP', 8)) {
|
|
35
|
+
const kind = String.fromCharCode(...bytes.subarray(12, 16))
|
|
36
|
+
if (kind === 'VP8X') {
|
|
37
|
+
return [
|
|
38
|
+
1 + (bytes[24] | (bytes[25] << 8) | (bytes[26] << 16)),
|
|
39
|
+
1 + (bytes[27] | (bytes[28] << 8) | (bytes[29] << 16))
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
if (kind === 'VP8 ')
|
|
43
|
+
return [view.getUint16(26, true) & 0x3fff, view.getUint16(28, true) & 0x3fff]
|
|
44
|
+
}
|
|
45
|
+
if (bytes[0] === 0xff && bytes[1] === 0xd8) {
|
|
46
|
+
for (let at = 2; at + 9 < bytes.length;) {
|
|
47
|
+
if (bytes[at] !== 0xff) {
|
|
48
|
+
at++
|
|
49
|
+
continue
|
|
50
|
+
}
|
|
51
|
+
const marker = bytes[at + 1]
|
|
52
|
+
const length = view.getUint16(at + 2)
|
|
53
|
+
// Start-of-frame markers carry the image's size; C4, C8, and CC are other segments.
|
|
54
|
+
if (
|
|
55
|
+
marker >= 0xc0 &&
|
|
56
|
+
marker <= 0xcf &&
|
|
57
|
+
marker !== 0xc4 &&
|
|
58
|
+
marker !== 0xc8 &&
|
|
59
|
+
marker !== 0xcc
|
|
60
|
+
) {
|
|
61
|
+
return [view.getUint16(at + 7), view.getUint16(at + 5)]
|
|
62
|
+
}
|
|
63
|
+
at += 2 + length
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
throw new Error('Unsupported image data')
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The `Image` svg2pdf asks for an image's size by name, for a host without one: it decodes only a
|
|
71
|
+
* base64 data URI's header, which is all the size needs.
|
|
72
|
+
*/
|
|
73
|
+
class HeadlessImage {
|
|
74
|
+
width = 0
|
|
75
|
+
height = 0
|
|
76
|
+
onload: (() => void) | null = null
|
|
77
|
+
onerror: ((error: unknown) => void) | null = null
|
|
78
|
+
|
|
79
|
+
set src(value: string) {
|
|
80
|
+
try {
|
|
81
|
+
const [width, height] = imageSize(value)
|
|
82
|
+
this.width = width
|
|
83
|
+
this.height = height
|
|
84
|
+
queueMicrotask(() => this.onload?.())
|
|
85
|
+
} catch (error) {
|
|
86
|
+
queueMicrotask(() => this.onerror?.(error))
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
18
91
|
/**
|
|
19
92
|
* The globals svg2pdf reads: it parses a page's stylesheets in a document it makes, and keeps the
|
|
20
93
|
* rules that are instances of the CSSOM classes.
|
|
@@ -23,15 +96,17 @@ interface SVG2PDFGlobals {
|
|
|
23
96
|
document?: unknown
|
|
24
97
|
CSSStyleSheet?: unknown
|
|
25
98
|
CSSStyleRule?: unknown
|
|
99
|
+
Image?: unknown
|
|
26
100
|
}
|
|
27
101
|
|
|
28
102
|
const SVG2PDF_GLOBALS = ['document', 'CSSStyleSheet', 'CSSStyleRule'] as const
|
|
29
103
|
|
|
30
|
-
type SVG2PDFGlobal = (typeof SVG2PDF_GLOBALS)[number]
|
|
104
|
+
type SVG2PDFGlobal = (typeof SVG2PDF_GLOBALS)[number] | 'Image'
|
|
31
105
|
|
|
32
106
|
function removeGlobal(scope: SVG2PDFGlobals, name: SVG2PDFGlobal): void {
|
|
33
107
|
if (name === 'document') delete scope.document
|
|
34
108
|
else if (name === 'CSSStyleSheet') delete scope.CSSStyleSheet
|
|
109
|
+
else if (name === 'Image') delete scope.Image
|
|
35
110
|
else delete scope.CSSStyleRule
|
|
36
111
|
}
|
|
37
112
|
|
|
@@ -71,15 +146,30 @@ async function withHappyDOM<T>(draw: (parse: SVGPageParser) => Promise<T>): Prom
|
|
|
71
146
|
const { Window } = (await import(/* @vite-ignore */ HAPPY_DOM)) as typeof HappyDOM
|
|
72
147
|
const dom = new Window()
|
|
73
148
|
const scope: SVG2PDFGlobals = globalThis
|
|
74
|
-
const values:
|
|
149
|
+
const values: Record<SVG2PDFGlobal, unknown> = {
|
|
75
150
|
document: dom.document,
|
|
76
151
|
CSSStyleSheet: dom.CSSStyleSheet,
|
|
77
|
-
CSSStyleRule: dom.CSSStyleRule
|
|
152
|
+
CSSStyleRule: dom.CSSStyleRule,
|
|
153
|
+
Image: HeadlessImage
|
|
78
154
|
}
|
|
79
155
|
// Each global replaced, with its descriptor before, so an accessor a host defines comes back as
|
|
80
156
|
// one and a global that could not be replaced is left as it was.
|
|
81
157
|
const replaced: Array<[SVG2PDFGlobal, PropertyDescriptor | undefined]> = []
|
|
158
|
+
let replacedImage: PropertyDescriptor | undefined
|
|
159
|
+
let hadImage = false
|
|
82
160
|
try {
|
|
161
|
+
// svg2pdf reads an image's size through a browser `Image`, which a CLI host lacks.
|
|
162
|
+
if (!('Image' in globalThis)) {
|
|
163
|
+
replacedImage = Object.getOwnPropertyDescriptor(globalThis, 'Image')
|
|
164
|
+
hadImage = false
|
|
165
|
+
Object.defineProperty(globalThis, 'Image', {
|
|
166
|
+
value: HeadlessImage,
|
|
167
|
+
configurable: true,
|
|
168
|
+
writable: true
|
|
169
|
+
})
|
|
170
|
+
} else {
|
|
171
|
+
hadImage = true
|
|
172
|
+
}
|
|
83
173
|
for (const name of SVG2PDF_GLOBALS) {
|
|
84
174
|
const previous = Object.getOwnPropertyDescriptor(globalThis, name)
|
|
85
175
|
Object.defineProperty(globalThis, name, {
|
|
@@ -96,6 +186,38 @@ async function withHappyDOM<T>(draw: (parse: SVGPageParser) => Promise<T>): Prom
|
|
|
96
186
|
if (previous) Object.defineProperty(globalThis, name, previous)
|
|
97
187
|
else removeGlobal(scope, name)
|
|
98
188
|
}
|
|
189
|
+
if (!hadImage) {
|
|
190
|
+
if (replacedImage) Object.defineProperty(globalThis, 'Image', replacedImage)
|
|
191
|
+
else removeGlobal(scope, 'Image')
|
|
192
|
+
}
|
|
99
193
|
await dom.happyDOM.close()
|
|
100
194
|
}
|
|
101
195
|
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Loads `svg2pdf.js`. Its package publishes a UMD build only, whose factory reads jsPDF from the
|
|
199
|
+
* global `jspdf` and, with no CommonJS `exports`, writes the function to the global `svg2pdf`; a
|
|
200
|
+
* bundler supplies both, a bare Node install supplies neither, and the module then fails on load.
|
|
201
|
+
* The two globals exist only while the import evaluates, and the function the module made keeps
|
|
202
|
+
* the jsPDF it read, so the rest of the export needs nothing from them.
|
|
203
|
+
*/
|
|
204
|
+
export async function loadSVG2PDF(jsPDF: unknown): Promise<typeof svg2pdf> {
|
|
205
|
+
const scope = globalThis as { jspdf?: unknown; svg2pdf?: { svg2pdf?: typeof svg2pdf } }
|
|
206
|
+
const previousJSPDF = Object.getOwnPropertyDescriptor(globalThis, 'jspdf')
|
|
207
|
+
const previousSVG2PDF = Object.getOwnPropertyDescriptor(globalThis, 'svg2pdf')
|
|
208
|
+
const set = (name: string, value: unknown): void => {
|
|
209
|
+
Object.defineProperty(globalThis, name, { value, configurable: true, writable: true })
|
|
210
|
+
}
|
|
211
|
+
set('jspdf', { jsPDF })
|
|
212
|
+
try {
|
|
213
|
+
const module = (await import('svg2pdf.js')) as { svg2pdf?: typeof svg2pdf }
|
|
214
|
+
const draw = module.svg2pdf ?? scope.svg2pdf?.svg2pdf
|
|
215
|
+
if (!draw) throw new Error('svg2pdf.js exported no svg2pdf function')
|
|
216
|
+
return draw
|
|
217
|
+
} finally {
|
|
218
|
+
if (previousJSPDF) Object.defineProperty(globalThis, 'jspdf', previousJSPDF)
|
|
219
|
+
else delete scope.jspdf
|
|
220
|
+
if (previousSVG2PDF) Object.defineProperty(globalThis, 'svg2pdf', previousSVG2PDF)
|
|
221
|
+
else delete scope.svg2pdf
|
|
222
|
+
}
|
|
223
|
+
}
|
|
@@ -3,7 +3,7 @@ import type { SceneGraph } from '@pairdraw/scene-graph'
|
|
|
3
3
|
import { computeContentBounds } from '#core/io/formats/raster'
|
|
4
4
|
import { renderNodesToSVG, type SVGExportOptions, type SVGTextLayout } from '#core/io/formats/svg'
|
|
5
5
|
|
|
6
|
-
import { withPDFDOM, type SVGPageParser } from './dom'
|
|
6
|
+
import { loadSVG2PDF, withPDFDOM, type SVGPageParser } from './dom'
|
|
7
7
|
import {
|
|
8
8
|
cutFontInstances,
|
|
9
9
|
embeddedFontAlias,
|
|
@@ -97,7 +97,8 @@ async function renderPages(
|
|
|
97
97
|
if (prepared.length === 0) return null
|
|
98
98
|
const first = prepared[0]
|
|
99
99
|
|
|
100
|
-
const
|
|
100
|
+
const { jsPDF } = await import('jspdf')
|
|
101
|
+
const svg2pdf = await loadSVG2PDF(jsPDF)
|
|
101
102
|
|
|
102
103
|
const doc = new jsPDF({
|
|
103
104
|
orientation: orientationOf(first),
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { PenFont } from '@pairdraw/pen'
|
|
2
|
+
import {
|
|
3
|
+
faceStyleKey,
|
|
4
|
+
parseFontStyle,
|
|
5
|
+
type FontFamilyStyle
|
|
6
|
+
} from '@pairdraw/scene-graph/font-style'
|
|
7
|
+
|
|
8
|
+
import { fontManager } from '#core/text/font/manager'
|
|
9
|
+
import { sfntFamilyNames } from '#core/text/font/variation'
|
|
10
|
+
import { sfntFont } from '#core/text/font/woff2'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Registers the fonts a `.pen` document bundles, each under the family and style its file names
|
|
14
|
+
* itself with, and returns those names by the `name` the document's text uses for it. pen.dev
|
|
15
|
+
* gives a bundled file a name of its own, such as `Geist-SemiBold`, which no font list knows; the
|
|
16
|
+
* text then reads as Geist SemiBold, as Figma and the font manager name it. A font whose file
|
|
17
|
+
* cannot be read keeps its name, and its text is substituted as a missing font is.
|
|
18
|
+
*/
|
|
19
|
+
export async function loadPenFonts(
|
|
20
|
+
fonts: readonly PenFont[],
|
|
21
|
+
read: (url: string) => Promise<Uint8Array | null>
|
|
22
|
+
): Promise<Map<string, FontFamilyStyle>> {
|
|
23
|
+
const faces = new Map<string, FontFamilyStyle>()
|
|
24
|
+
await Promise.all(
|
|
25
|
+
fonts.map(async ({ name, url }) => {
|
|
26
|
+
const bytes = await read(url)
|
|
27
|
+
if (!bytes) return
|
|
28
|
+
try {
|
|
29
|
+
const data = await sfntFont(bytes.slice().buffer)
|
|
30
|
+
const face = sfntFamilyNames(data)
|
|
31
|
+
if (!face) return
|
|
32
|
+
// Under the key drawing asks for, which spells `Italic` as `Regular Italic`; the text
|
|
33
|
+
// keeps the file's own style name, which exports carry.
|
|
34
|
+
const { weight, italic } = parseFontStyle(face.style)
|
|
35
|
+
const key = faceStyleKey({ fontWeight: weight, italic, fontStyle: face.style })
|
|
36
|
+
await fontManager.markLoaded(face.family, key, data)
|
|
37
|
+
faces.set(name, face)
|
|
38
|
+
} catch (error) {
|
|
39
|
+
// Its text stays in the font it names, substituted as a missing font is.
|
|
40
|
+
console.warn(`Bundled font "${name}" could not be read:`, error)
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
)
|
|
44
|
+
return faces
|
|
45
|
+
}
|
|
@@ -16,23 +16,45 @@ import { defaultIcons, drawIcon, type IconData, type IconProvider } from '#core/
|
|
|
16
16
|
import type { IOFormatAdapter, ReadDocumentInput } from '#core/io/types'
|
|
17
17
|
import { layoutAuthoredNodes } from '#core/layout'
|
|
18
18
|
|
|
19
|
+
import { loadPenFonts } from './fonts'
|
|
19
20
|
import { loadPenImports, readImportedImage, UnresolvedImports, type OpenedImport } from './imports'
|
|
20
21
|
|
|
21
22
|
/** The size icons are fetched at; each is scaled to the box it is drawn in. */
|
|
22
23
|
const PEN_ICON_SIZE = 24
|
|
23
24
|
|
|
25
|
+
/**
|
|
26
|
+
* The path a percent-encoded image URL names, decoded one step at a time: a step that would become
|
|
27
|
+
* a separator or a parent keeps its escape, so a URL cannot name a file outside its folder.
|
|
28
|
+
*/
|
|
29
|
+
function decodeAssetPath(url: string): string {
|
|
30
|
+
return url
|
|
31
|
+
.split('/')
|
|
32
|
+
.map((segment) => {
|
|
33
|
+
let decoded: string
|
|
34
|
+
try {
|
|
35
|
+
decoded = decodeURIComponent(segment)
|
|
36
|
+
} catch {
|
|
37
|
+
return segment
|
|
38
|
+
}
|
|
39
|
+
if (decoded === '.' || decoded === '..') return segment
|
|
40
|
+
return decoded.replaceAll('/', '%2F').replaceAll('\\', '%5C')
|
|
41
|
+
})
|
|
42
|
+
.join('/')
|
|
43
|
+
}
|
|
44
|
+
|
|
24
45
|
/**
|
|
25
46
|
* An image's bytes: a data URL decoded by the platform's own URL handling, an imported document's
|
|
26
47
|
* file beside that document, and any other file through the host; null when that fails.
|
|
27
48
|
*/
|
|
28
|
-
async function
|
|
49
|
+
async function loadPenFile(
|
|
29
50
|
url: string,
|
|
30
51
|
input: ReadDocumentInput,
|
|
31
52
|
opened: ReadonlyMap<string, OpenedImport>
|
|
32
53
|
): Promise<Uint8Array | null> {
|
|
33
54
|
try {
|
|
34
55
|
if (parseImportedImageURL(url)) return await readImportedImage(opened, url)
|
|
35
|
-
|
|
56
|
+
// pen.dev writes the path percent-encoded, as `My%20Design-assets/…`.
|
|
57
|
+
if (!isDataURL(url)) return (await input.readAsset?.(decodeAssetPath(url))) ?? null
|
|
36
58
|
// Through `URL`, which lowercases the scheme for runtimes that only fetch `data:`.
|
|
37
59
|
return new Uint8Array(await (await fetch(new URL(url))).arrayBuffer())
|
|
38
60
|
} catch {
|
|
@@ -52,7 +74,7 @@ async function loadPenShaders(
|
|
|
52
74
|
const shaders = new Map<string, string>()
|
|
53
75
|
await Promise.all(
|
|
54
76
|
urls.map(async (url) => {
|
|
55
|
-
const bytes = await
|
|
77
|
+
const bytes = await loadPenFile(url, input, opened)
|
|
56
78
|
if (bytes) shaders.set(url, new TextDecoder().decode(bytes))
|
|
57
79
|
})
|
|
58
80
|
)
|
|
@@ -67,7 +89,7 @@ async function loadPenImages(
|
|
|
67
89
|
const images = new Map<string, Uint8Array>()
|
|
68
90
|
await Promise.all(
|
|
69
91
|
urls.map(async (url) => {
|
|
70
|
-
const bytes = await
|
|
92
|
+
const bytes = await loadPenFile(url, input, opened)
|
|
71
93
|
if (bytes) images.set(url, bytes)
|
|
72
94
|
})
|
|
73
95
|
)
|
|
@@ -129,10 +151,11 @@ export const penFormat: IOFormatAdapter<'pen'> = {
|
|
|
129
151
|
const unresolved = new UnresolvedImports()
|
|
130
152
|
const { imports, opened } = await loadPenImports(doc, input, unresolved)
|
|
131
153
|
const assets = penAssets(withUsedImports(doc, imports))
|
|
132
|
-
const [images, shaders, icons] = await Promise.all([
|
|
154
|
+
const [images, shaders, icons, fonts] = await Promise.all([
|
|
133
155
|
loadPenImages(assets.images, input, opened),
|
|
134
156
|
loadPenShaders(assets.shaders, input, opened),
|
|
135
|
-
loadPenIcons(assets.icons, context?.icons ?? defaultIcons)
|
|
157
|
+
loadPenIcons(assets.icons, context?.icons ?? defaultIcons),
|
|
158
|
+
loadPenFonts(doc.fonts ?? [], (url) => loadPenFile(url, input, opened))
|
|
136
159
|
])
|
|
137
160
|
// A .pen file stores its layout intent, not the sizes and positions it implies; the hidden
|
|
138
161
|
// library page's components are laid out too, as instances of them copy their layers.
|
|
@@ -140,6 +163,7 @@ export const penFormat: IOFormatAdapter<'pen'> = {
|
|
|
140
163
|
images,
|
|
141
164
|
shaders,
|
|
142
165
|
icons,
|
|
166
|
+
fonts,
|
|
143
167
|
imports,
|
|
144
168
|
layout: (target) =>
|
|
145
169
|
layoutAuthoredNodes(
|