@pairdraw/core 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/boolean.d.ts +6 -1
- package/dist/canvas/boolean.d.ts.map +1 -1
- package/dist/canvas/boolean.js +10 -2
- package/dist/canvas/boolean.js.map +1 -1
- package/dist/canvas/color-space.d.ts +45 -0
- package/dist/canvas/color-space.d.ts.map +1 -0
- package/dist/canvas/color-space.js +39 -0
- package/dist/canvas/color-space.js.map +1 -0
- package/dist/canvas/fills.d.ts +10 -10
- package/dist/canvas/fills.d.ts.map +1 -1
- package/dist/canvas/fills.js +116 -62
- package/dist/canvas/fills.js.map +1 -1
- package/dist/canvas/flatten.d.ts +11 -3
- package/dist/canvas/flatten.d.ts.map +1 -1
- package/dist/canvas/flatten.js +62 -4
- package/dist/canvas/flatten.js.map +1 -1
- package/dist/canvas/index.d.ts +2 -1
- package/dist/canvas/index.js +2 -1
- package/dist/canvas/layout-grids.d.ts +5 -2
- package/dist/canvas/layout-grids.d.ts.map +1 -1
- package/dist/canvas/layout-grids.js +7 -2
- package/dist/canvas/layout-grids.js.map +1 -1
- package/dist/canvas/noise/render.d.ts +17 -4
- package/dist/canvas/noise/render.d.ts.map +1 -1
- package/dist/canvas/noise/render.js +21 -6
- package/dist/canvas/noise/render.js.map +1 -1
- package/dist/canvas/noise/shader.d.ts +4 -4
- package/dist/canvas/noise/shader.d.ts.map +1 -1
- package/dist/canvas/noise/shader.js +5 -6
- package/dist/canvas/noise/shader.js.map +1 -1
- package/dist/canvas/overlays/annotations.d.ts +19 -0
- package/dist/canvas/overlays/annotations.d.ts.map +1 -0
- package/dist/canvas/overlays/annotations.js +110 -0
- package/dist/canvas/overlays/annotations.js.map +1 -0
- package/dist/canvas/overlays/auto-layout-hover.d.ts +11 -1
- package/dist/canvas/overlays/auto-layout-hover.d.ts.map +1 -1
- package/dist/canvas/overlays/auto-layout-hover.js +25 -1
- package/dist/canvas/overlays/auto-layout-hover.js.map +1 -1
- package/dist/canvas/overlays/feedback.js +1 -1
- package/dist/canvas/overlays/feedback.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/measurement.d.ts +7 -1
- package/dist/canvas/overlays/measurement.d.ts.map +1 -1
- package/dist/canvas/overlays/measurement.js +42 -4
- package/dist/canvas/overlays/measurement.js.map +1 -1
- package/dist/canvas/overlays/presence.d.ts.map +1 -1
- package/dist/canvas/overlays/presence.js +21 -24
- package/dist/canvas/overlays/presence.js.map +1 -1
- package/dist/canvas/renderer/colors.d.ts +7 -1
- package/dist/canvas/renderer/colors.d.ts.map +1 -1
- package/dist/canvas/renderer/colors.js +9 -1
- package/dist/canvas/renderer/colors.js.map +1 -1
- package/dist/canvas/renderer/document-surface.d.ts +15 -6
- package/dist/canvas/renderer/document-surface.d.ts.map +1 -1
- package/dist/canvas/renderer/document-surface.js +1 -0
- package/dist/canvas/renderer/document-surface.js.map +1 -1
- package/dist/canvas/renderer/lifecycle.d.ts.map +1 -1
- package/dist/canvas/renderer/lifecycle.js +2 -2
- package/dist/canvas/renderer/lifecycle.js.map +1 -1
- package/dist/canvas/renderer/methods.d.ts +1 -0
- package/dist/canvas/renderer/methods.d.ts.map +1 -1
- package/dist/canvas/renderer/methods.js +4 -1
- package/dist/canvas/renderer/methods.js.map +1 -1
- package/dist/canvas/renderer/overlay-pass.d.ts.map +1 -1
- package/dist/canvas/renderer/overlay-pass.js +6 -1
- package/dist/canvas/renderer/overlay-pass.js.map +1 -1
- package/dist/canvas/renderer/pipeline.d.ts.map +1 -1
- package/dist/canvas/renderer/pipeline.js +7 -0
- package/dist/canvas/renderer/pipeline.js.map +1 -1
- package/dist/canvas/renderer/types.d.ts +10 -0
- package/dist/canvas/renderer/types.d.ts.map +1 -1
- package/dist/canvas/renderer.d.ts +10 -2
- package/dist/canvas/renderer.d.ts.map +1 -1
- package/dist/canvas/renderer.js +15 -3
- package/dist/canvas/renderer.js.map +1 -1
- package/dist/canvas/scene.d.ts.map +1 -1
- package/dist/canvas/scene.js +9 -9
- package/dist/canvas/scene.js.map +1 -1
- package/dist/canvas/shaders/compile.d.ts +3 -1
- package/dist/canvas/shaders/compile.d.ts.map +1 -1
- package/dist/canvas/shaders/compile.js +12 -3
- package/dist/canvas/shaders/compile.js.map +1 -1
- package/dist/canvas/shaders/draw.d.ts.map +1 -1
- package/dist/canvas/shaders/draw.js +10 -3
- package/dist/canvas/shaders/draw.js.map +1 -1
- package/dist/canvas/shaders/effect.d.ts.map +1 -1
- package/dist/canvas/shaders/effect.js +6 -16
- package/dist/canvas/shaders/effect.js.map +1 -1
- package/dist/clipboard/pairdraw.d.ts.map +1 -1
- package/dist/clipboard/pairdraw.js +1 -0
- package/dist/clipboard/pairdraw.js.map +1 -1
- package/dist/editor/bridges/clipboard.d.ts +2 -0
- package/dist/editor/bridges/clipboard.d.ts.map +1 -1
- package/dist/editor/bridges/clipboard.js +1 -0
- package/dist/editor/bridges/clipboard.js.map +1 -1
- package/dist/editor/bridges/components.d.ts +14 -7
- package/dist/editor/bridges/components.d.ts.map +1 -1
- package/dist/editor/bridges/components.js +6 -0
- package/dist/editor/bridges/components.js.map +1 -1
- package/dist/editor/bridges/structure.d.ts +1 -1
- package/dist/editor/bridges/structure.d.ts.map +1 -1
- package/dist/editor/bridges/undo.d.ts +1 -1
- package/dist/editor/clipboard/code.d.ts +32 -0
- package/dist/editor/clipboard/code.d.ts.map +1 -0
- package/dist/editor/clipboard/code.js +30 -0
- package/dist/editor/clipboard/code.js.map +1 -0
- package/dist/editor/clipboard/export.js +2 -2
- package/dist/editor/clipboard/export.js.map +1 -1
- package/dist/editor/clipboard/paste/dependencies.d.ts +14 -0
- package/dist/editor/clipboard/paste/dependencies.d.ts.map +1 -0
- package/dist/editor/clipboard/paste/dependencies.js +0 -0
- package/dist/editor/clipboard/paste/run.d.ts +14 -0
- package/dist/editor/clipboard/paste/run.d.ts.map +1 -0
- package/dist/editor/clipboard/paste/run.js +47 -0
- package/dist/editor/clipboard/paste/run.js.map +1 -0
- package/dist/editor/clipboard/styled.d.ts +2 -8
- package/dist/editor/clipboard/styled.d.ts.map +1 -1
- package/dist/editor/clipboard/styled.js +2 -32
- package/dist/editor/clipboard/styled.js.map +1 -1
- package/dist/editor/clipboard.d.ts +2 -0
- package/dist/editor/clipboard.d.ts.map +1 -1
- package/dist/editor/clipboard.js +34 -0
- package/dist/editor/clipboard.js.map +1 -1
- package/dist/editor/components/instances.d.ts +5 -0
- package/dist/editor/components/instances.d.ts.map +1 -1
- package/dist/editor/components/instances.js +69 -4
- package/dist/editor/components/instances.js.map +1 -1
- package/dist/editor/components/slots/index.d.ts.map +1 -1
- package/dist/editor/components/slots/index.js +7 -0
- package/dist/editor/components/slots/index.js.map +1 -1
- package/dist/editor/components.d.ts +6 -0
- package/dist/editor/components.d.ts.map +1 -1
- package/dist/editor/components.js +14 -2
- package/dist/editor/components.js.map +1 -1
- package/dist/editor/create.d.ts +30 -3
- package/dist/editor/create.d.ts.map +1 -1
- package/dist/editor/create.js +11 -2
- package/dist/editor/create.js.map +1 -1
- package/dist/editor/design-tokens.d.ts +1 -1
- package/dist/editor/design-tokens.d.ts.map +1 -1
- package/dist/editor/design-tokens.js +4 -18
- package/dist/editor/design-tokens.js.map +1 -1
- package/dist/editor/image-edit.d.ts.map +1 -1
- package/dist/editor/image-edit.js +1 -2
- package/dist/editor/image-edit.js.map +1 -1
- package/dist/editor/index.d.ts +4 -4
- package/dist/editor/index.js +1 -1
- package/dist/editor/layout-mode.d.ts +3 -1
- package/dist/editor/layout-mode.d.ts.map +1 -1
- package/dist/editor/layout-mode.js +97 -2
- package/dist/editor/layout-mode.js.map +1 -1
- package/dist/editor/nodes.d.ts +2 -0
- package/dist/editor/nodes.d.ts.map +1 -1
- package/dist/editor/nodes.js +22 -7
- package/dist/editor/nodes.js.map +1 -1
- package/dist/editor/read-only/actions.js +6 -0
- package/dist/editor/read-only/actions.js.map +1 -1
- package/dist/editor/selection/overlays.d.ts +1 -0
- package/dist/editor/selection/overlays.d.ts.map +1 -1
- package/dist/editor/selection/overlays.js +7 -0
- package/dist/editor/selection/overlays.js.map +1 -1
- package/dist/editor/selection/read.d.ts +8 -0
- package/dist/editor/selection.d.ts +9 -0
- package/dist/editor/selection.d.ts.map +1 -1
- package/dist/editor/state/shared.js +1 -0
- package/dist/editor/state/shared.js.map +1 -1
- package/dist/editor/state/view.d.ts.map +1 -1
- package/dist/editor/state/view.js +2 -0
- package/dist/editor/state/view.js.map +1 -1
- package/dist/editor/structure/boolean.d.ts +1 -1
- package/dist/editor/structure/boolean.d.ts.map +1 -1
- package/dist/editor/structure/boolean.js +20 -1
- package/dist/editor/structure/boolean.js.map +1 -1
- package/dist/editor/structure/container-wrap.d.ts +8 -2
- package/dist/editor/structure/container-wrap.d.ts.map +1 -1
- package/dist/editor/structure/container-wrap.js +17 -5
- package/dist/editor/structure/container-wrap.js.map +1 -1
- package/dist/editor/structure/flatten.d.ts.map +1 -1
- package/dist/editor/structure/flatten.js +8 -7
- package/dist/editor/structure/flatten.js.map +1 -1
- package/dist/editor/structure/group/ungroup.d.ts.map +1 -1
- package/dist/editor/structure/group/ungroup.js +2 -0
- package/dist/editor/structure/group/ungroup.js.map +1 -1
- package/dist/editor/structure/outline-stroke.d.ts.map +1 -1
- package/dist/editor/structure/outline-stroke.js +5 -0
- package/dist/editor/structure/outline-stroke.js.map +1 -1
- package/dist/editor/structure.d.ts +1 -1
- package/dist/editor/structure.d.ts.map +1 -1
- package/dist/editor/styles.d.ts +26 -0
- package/dist/editor/styles.d.ts.map +1 -0
- package/dist/editor/styles.js +127 -0
- package/dist/editor/styles.js.map +1 -0
- 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 +10 -2
- package/dist/editor/text/selection-style.js.map +1 -1
- package/dist/editor/tool-registry.d.ts.map +1 -1
- package/dist/editor/tool-registry.js +6 -0
- package/dist/editor/tool-registry.js.map +1 -1
- package/dist/editor/types.d.ts +14 -2
- package/dist/editor/types.d.ts.map +1 -1
- package/dist/editor/variable-bindings.d.ts.map +1 -1
- package/dist/editor/variable-bindings.js +6 -1
- package/dist/editor/variable-bindings.js.map +1 -1
- package/dist/figma-api/accessors/basic.d.ts.map +1 -1
- package/dist/figma-api/accessors/basic.js +22 -1
- package/dist/figma-api/accessors/basic.js.map +1 -1
- package/dist/figma-api/accessors/shape.js +1 -1
- package/dist/figma-api/accessors/text/index.js +1 -1
- package/dist/figma-api/accessors/text/ranges.js +1 -1
- package/dist/figma-api/accessors/text/references.js +1 -1
- package/dist/figma-api/accessors/variables.js +1 -1
- package/dist/figma-api/accessors/vector.d.ts.map +1 -1
- package/dist/figma-api/accessors/vector.js +8 -22
- package/dist/figma-api/accessors/vector.js.map +1 -1
- package/dist/figma-api/accessors/visual.js +1 -1
- package/dist/figma-api/compatibility.d.ts +1 -1
- package/dist/figma-api/compatibility.d.ts.map +1 -1
- package/dist/figma-api/component-scope.d.ts +14 -0
- package/dist/figma-api/component-scope.d.ts.map +1 -0
- package/dist/figma-api/component-scope.js +28 -0
- package/dist/figma-api/component-scope.js.map +1 -0
- package/dist/figma-api/components.d.ts.map +1 -1
- package/dist/figma-api/components.js +26 -2
- package/dist/figma-api/components.js.map +1 -1
- package/dist/figma-api/flatten.js +3 -3
- package/dist/figma-api/flatten.js.map +1 -1
- package/dist/figma-api/index.d.ts +77 -6
- package/dist/figma-api/index.d.ts.map +1 -1
- package/dist/figma-api/index.js +188 -2
- package/dist/figma-api/index.js.map +1 -1
- package/dist/figma-api/node-types.d.ts +2 -1
- package/dist/figma-api/node-types.d.ts.map +1 -1
- package/dist/figma-api/overrides.d.ts +26 -1
- package/dist/figma-api/overrides.d.ts.map +1 -1
- package/dist/figma-api/overrides.js +157 -10
- package/dist/figma-api/overrides.js.map +1 -1
- package/dist/figma-api/proxy.d.ts +2 -0
- package/dist/figma-api/proxy.d.ts.map +1 -1
- package/dist/figma-api/proxy.js +10 -2
- package/dist/figma-api/proxy.js.map +1 -1
- package/dist/figma-api/reactions.d.ts +61 -5
- package/dist/figma-api/reactions.d.ts.map +1 -1
- package/dist/figma-api/reactions.js +144 -11
- package/dist/figma-api/reactions.js.map +1 -1
- package/dist/figma-api/shape-with-text.js +1 -1
- package/dist/figma-api/slots.d.ts +3 -1
- package/dist/figma-api/slots.d.ts.map +1 -1
- package/dist/figma-api/slots.js +9 -8
- package/dist/figma-api/slots.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/io/formats/code/detect.d.ts +23 -0
- package/dist/io/formats/code/detect.d.ts.map +1 -0
- package/dist/io/formats/code/detect.js +46 -0
- package/dist/io/formats/code/detect.js.map +1 -0
- package/dist/io/formats/code/index.d.ts +5 -0
- package/dist/io/formats/code/index.js +5 -0
- package/dist/io/formats/code/read.d.ts +45 -0
- package/dist/io/formats/code/read.d.ts.map +1 -0
- package/dist/io/formats/code/read.js +86 -0
- package/dist/io/formats/code/read.js.map +1 -0
- package/dist/io/formats/code/stylesheet.d.ts +13 -0
- package/dist/io/formats/code/stylesheet.d.ts.map +1 -0
- package/dist/io/formats/code/stylesheet.js +21 -0
- package/dist/io/formats/code/stylesheet.js.map +1 -0
- package/dist/io/formats/code/tokens.d.ts +18 -0
- package/dist/io/formats/code/tokens.d.ts.map +1 -0
- package/dist/io/formats/code/tokens.js +135 -0
- package/dist/io/formats/code/tokens.js.map +1 -0
- package/dist/io/formats/design-tokens/apply.d.ts +7 -3
- package/dist/io/formats/design-tokens/apply.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/apply.js.map +1 -1
- package/dist/io/formats/drawio/warnings.d.ts +17 -2
- package/dist/io/formats/drawio/warnings.d.ts.map +1 -1
- package/dist/io/formats/drawio/warnings.js +14 -7
- package/dist/io/formats/drawio/warnings.js.map +1 -1
- package/dist/io/formats/fig/export/patch/fields.js +5 -0
- package/dist/io/formats/fig/export/patch/fields.js.map +1 -1
- package/dist/io/formats/fig/export/patch/index.d.ts.map +1 -1
- package/dist/io/formats/fig/export/patch/index.js +20 -20
- package/dist/io/formats/fig/export/patch/index.js.map +1 -1
- package/dist/io/formats/fig/export/setup.d.ts.map +1 -1
- package/dist/io/formats/fig/export/setup.js +5 -1
- package/dist/io/formats/fig/export/setup.js.map +1 -1
- package/dist/io/formats/fig/index.d.ts +3 -2
- package/dist/io/formats/fig/index.js +2 -2
- package/dist/io/formats/fig/read.d.ts.map +1 -1
- package/dist/io/formats/fig/read.js +5 -2
- package/dist/io/formats/fig/read.js.map +1 -1
- package/dist/io/formats/html/index.d.ts +1 -0
- package/dist/io/formats/html/index.d.ts.map +1 -1
- package/dist/io/formats/html/index.js +5 -3
- package/dist/io/formats/html/index.js.map +1 -1
- package/dist/io/formats/html/layers.d.ts +3 -1
- package/dist/io/formats/html/layers.d.ts.map +1 -1
- package/dist/io/formats/html/layers.js +6 -1
- package/dist/io/formats/html/layers.js.map +1 -1
- package/dist/io/formats/pdf/export.d.ts.map +1 -1
- package/dist/io/formats/pdf/export.js +7 -3
- package/dist/io/formats/pdf/export.js.map +1 -1
- package/dist/io/formats/pdf/plan.d.ts +3 -0
- package/dist/io/formats/pdf/plan.d.ts.map +1 -1
- package/dist/io/formats/pdf/plan.js +60 -36
- package/dist/io/formats/pdf/plan.js.map +1 -1
- package/dist/io/formats/pen/index.d.ts.map +1 -1
- package/dist/io/formats/pen/index.js +13 -4
- package/dist/io/formats/pen/index.js.map +1 -1
- package/dist/io/formats/raster/headless.d.ts.map +1 -1
- package/dist/io/formats/raster/headless.js +3 -2
- 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 +10 -2
- package/dist/io/formats/raster/render.d.ts.map +1 -1
- package/dist/io/formats/raster/render.js +35 -9
- package/dist/io/formats/raster/render.js.map +1 -1
- package/dist/io/formats/svg/defs.d.ts.map +1 -1
- package/dist/io/formats/svg/defs.js +19 -1
- package/dist/io/formats/svg/defs.js.map +1 -1
- package/dist/io/formats/svg/export.d.ts +5 -2
- package/dist/io/formats/svg/export.d.ts.map +1 -1
- package/dist/io/formats/svg/export.js +59 -10
- package/dist/io/formats/svg/export.js.map +1 -1
- package/dist/io/formats/svg/index.d.ts +2 -2
- package/dist/io/formats/svg/index.js +2 -2
- package/dist/io/formats/svg/text/layout.d.ts.map +1 -1
- package/dist/io/formats/svg/text/layout.js +4 -2
- package/dist/io/formats/svg/text/layout.js.map +1 -1
- package/dist/io/formats/video/record.d.ts.map +1 -1
- package/dist/io/formats/video/record.js +24 -9
- package/dist/io/formats/video/record.js.map +1 -1
- package/dist/io/formats.d.ts.map +1 -1
- package/dist/io/formats.js +30 -17
- package/dist/io/formats.js.map +1 -1
- package/dist/io/index.d.ts +2 -2
- package/dist/io/types.d.ts +11 -2
- 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 +2 -1
- package/dist/kiwi/fig/population/client.js.map +1 -1
- package/dist/kiwi/fig/session/document-state.d.ts +46 -2
- package/dist/kiwi/fig/session/document-state.d.ts.map +1 -1
- package/dist/kiwi/fig/session/document-state.js +113 -5
- package/dist/kiwi/fig/session/document-state.js.map +1 -1
- package/dist/kiwi/fig/session/options.d.ts +4 -0
- package/dist/kiwi/fig/session/options.d.ts.map +1 -1
- package/dist/kiwi/fig/session/options.js.map +1 -1
- package/dist/layout/apply.d.ts.map +1 -1
- package/dist/layout/apply.js +8 -4
- package/dist/layout/apply.js.map +1 -1
- package/dist/layout/auto-layout-handles.js +1 -1
- package/dist/layout/auto-layout-handles.js.map +1 -1
- package/dist/layout/axis-sizing.d.ts.map +1 -1
- package/dist/layout/axis-sizing.js +1 -1
- package/dist/layout/axis-sizing.js.map +1 -1
- package/dist/layout/derived.d.ts.map +1 -1
- package/dist/layout/derived.js +1 -1
- package/dist/layout/derived.js.map +1 -1
- package/dist/layout/effective-generated-text.js +1 -1
- package/dist/layout/effective-generated-text.js.map +1 -1
- package/dist/layout/grid.d.ts +3 -1
- package/dist/layout/grid.d.ts.map +1 -1
- package/dist/layout/grid.js +57 -16
- package/dist/layout/grid.js.map +1 -1
- package/dist/layout.d.ts +1 -1
- package/dist/layout.js +6 -5
- package/dist/layout.js.map +1 -1
- package/dist/node/fs.d.ts.map +1 -1
- package/dist/node/fs.js +28 -7
- package/dist/node/fs.js.map +1 -1
- package/dist/prototype/easing.d.ts +13 -5
- package/dist/prototype/easing.d.ts.map +1 -1
- package/dist/prototype/easing.js +46 -6
- package/dist/prototype/easing.js.map +1 -1
- package/dist/prototype/scenes.d.ts +31 -0
- package/dist/prototype/scenes.d.ts.map +1 -1
- package/dist/prototype/scenes.js +220 -31
- package/dist/prototype/scenes.js.map +1 -1
- package/dist/prototype/session.d.ts.map +1 -1
- package/dist/prototype/session.js +1 -0
- package/dist/prototype/session.js.map +1 -1
- package/dist/prototype/smart-animate/animation.d.ts +2 -1
- package/dist/prototype/smart-animate/animation.d.ts.map +1 -1
- package/dist/prototype/smart-animate/animation.js +2 -2
- package/dist/prototype/smart-animate/animation.js.map +1 -1
- package/dist/prototype/timeline.d.ts +10 -1
- package/dist/prototype/timeline.d.ts.map +1 -1
- package/dist/prototype/timeline.js +69 -23
- package/dist/prototype/timeline.js.map +1 -1
- package/dist/prototype/variables.d.ts +23 -0
- package/dist/prototype/variables.d.ts.map +1 -0
- package/dist/prototype/variables.js +237 -0
- package/dist/prototype/variables.js.map +1 -0
- package/dist/rpc/read-commands.d.ts +5 -0
- package/dist/rpc/read-commands.d.ts.map +1 -1
- package/dist/rpc/read-commands.js +4 -1
- package/dist/rpc/read-commands.js.map +1 -1
- package/dist/text/character-style.d.ts +8 -1
- package/dist/text/character-style.d.ts.map +1 -1
- package/dist/text/character-style.js +39 -1
- package/dist/text/character-style.js.map +1 -1
- package/dist/text/index.d.ts +2 -2
- package/dist/text/index.js +2 -2
- package/dist/tools/create/basic.js +3 -4
- package/dist/tools/create/basic.js.map +1 -1
- package/dist/tools/create/behaviours.js +1 -1
- package/dist/tools/create/code.d.ts +6 -0
- package/dist/tools/create/code.d.ts.map +1 -0
- package/dist/tools/create/code.js +68 -0
- package/dist/tools/create/code.js.map +1 -0
- package/dist/tools/create/html.d.ts.map +1 -1
- package/dist/tools/create/html.js +9 -57
- package/dist/tools/create/html.js.map +1 -1
- package/dist/tools/create/icons.js +1 -1
- package/dist/tools/create/inputs.d.ts +11 -0
- package/dist/tools/create/inputs.d.ts.map +1 -0
- package/dist/tools/create/inputs.js +15 -0
- package/dist/tools/create/inputs.js.map +1 -0
- package/dist/tools/create/mermaid.d.ts.map +1 -1
- package/dist/tools/create/mermaid.js +5 -6
- package/dist/tools/create/mermaid.js.map +1 -1
- package/dist/tools/create/place.d.ts +30 -0
- package/dist/tools/create/place.d.ts.map +1 -0
- package/dist/tools/create/place.js +70 -0
- package/dist/tools/create/place.js.map +1 -0
- package/dist/tools/create/render.js +1 -1
- package/dist/tools/create/svg.js +1 -1
- package/dist/tools/create/vector.js +1 -1
- package/dist/tools/create.d.ts +2 -1
- package/dist/tools/create.js +2 -1
- package/dist/tools/css/gradient.d.ts +28 -0
- package/dist/tools/css/gradient.d.ts.map +1 -0
- package/dist/tools/css/gradient.js +118 -0
- package/dist/tools/css/gradient.js.map +1 -0
- package/dist/tools/image-ai/generate.js +1 -1
- package/dist/tools/modify/geometry.js +5 -5
- package/dist/tools/modify/geometry.js.map +1 -1
- package/dist/tools/modify/layout.d.ts.map +1 -1
- package/dist/tools/modify/layout.js +7 -1
- package/dist/tools/modify/layout.js.map +1 -1
- package/dist/tools/modify/matching.js +1 -1
- package/dist/tools/modify/overrides.d.ts +6 -0
- package/dist/tools/modify/overrides.d.ts.map +1 -0
- package/dist/tools/modify/overrides.js +27 -0
- package/dist/tools/modify/overrides.js.map +1 -0
- package/dist/tools/modify/paint.d.ts.map +1 -1
- package/dist/tools/modify/paint.js +84 -39
- package/dist/tools/modify/paint.js.map +1 -1
- package/dist/tools/modify/text.d.ts +2 -1
- package/dist/tools/modify/text.d.ts.map +1 -1
- package/dist/tools/modify/text.js +79 -8
- package/dist/tools/modify/text.js.map +1 -1
- package/dist/tools/modify/update.d.ts.map +1 -1
- package/dist/tools/modify/update.js +18 -2
- package/dist/tools/modify/update.js.map +1 -1
- package/dist/tools/modify.d.ts +3 -2
- package/dist/tools/modify.js +3 -2
- package/dist/tools/read/css.d.ts.map +1 -1
- package/dist/tools/read/css.js +29 -12
- package/dist/tools/read/css.js.map +1 -1
- package/dist/tools/read/libraries.js +1 -1
- package/dist/tools/read/nodes.d.ts.map +1 -1
- package/dist/tools/read/nodes.js +19 -5
- package/dist/tools/read/nodes.js.map +1 -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/text-range.d.ts +11 -0
- package/dist/tools/text-range.d.ts.map +1 -0
- package/dist/tools/text-range.js +26 -0
- package/dist/tools/text-range.js.map +1 -0
- package/dist/tools/variables/bindings.js +1 -1
- package/dist/tools/variables/bindings.js.map +1 -1
- package/dist/tools/variables/unbind.js +1 -1
- package/dist/tools/variables/unbind.js.map +1 -1
- package/dist/tools/vector/path.d.ts.map +1 -1
- package/dist/tools/vector/path.js +7 -21
- package/dist/tools/vector/path.js.map +1 -1
- package/dist/vector/rebase.d.ts +17 -0
- package/dist/vector/rebase.d.ts.map +1 -0
- package/dist/vector/rebase.js +32 -0
- package/dist/vector/rebase.js.map +1 -0
- package/package.json +14 -9
- package/src/canvas/boolean.ts +12 -1
- package/src/canvas/color-space.ts +73 -0
- package/src/canvas/fills.ts +130 -83
- package/src/canvas/flatten.ts +92 -7
- package/src/canvas/index.ts +9 -0
- package/src/canvas/layout-grids.ts +15 -2
- package/src/canvas/noise/render.ts +35 -7
- package/src/canvas/noise/shader.ts +8 -10
- package/src/canvas/overlays/annotations.ts +117 -0
- package/src/canvas/overlays/auto-layout-hover.ts +41 -1
- package/src/canvas/overlays/feedback.ts +7 -2
- package/src/canvas/overlays/index.ts +1 -1
- package/src/canvas/overlays/measurement.ts +49 -3
- package/src/canvas/overlays/presence.ts +35 -32
- package/src/canvas/renderer/colors.ts +14 -0
- package/src/canvas/renderer/document-surface.ts +16 -6
- package/src/canvas/renderer/lifecycle.ts +2 -2
- package/src/canvas/renderer/methods.ts +4 -0
- package/src/canvas/renderer/overlay-pass.ts +4 -0
- package/src/canvas/renderer/pipeline.ts +8 -0
- package/src/canvas/renderer/types.ts +8 -0
- package/src/canvas/renderer.ts +21 -2
- package/src/canvas/scene.ts +15 -7
- package/src/canvas/shaders/compile.ts +14 -3
- package/src/canvas/shaders/draw.ts +11 -4
- package/src/canvas/shaders/effect.ts +6 -18
- package/src/clipboard/pairdraw.ts +1 -0
- package/src/editor/bridges/clipboard.ts +1 -0
- package/src/editor/bridges/components.ts +10 -0
- package/src/editor/clipboard/code.ts +50 -0
- package/src/editor/clipboard/export.ts +2 -2
- package/src/editor/clipboard/paste/dependencies.ts +18 -0
- package/src/editor/clipboard/paste/run.ts +64 -0
- package/src/editor/clipboard/styled.ts +4 -52
- package/src/editor/clipboard.ts +40 -0
- package/src/editor/components/instances.ts +92 -4
- package/src/editor/components/slots/index.ts +7 -0
- package/src/editor/components.ts +16 -2
- package/src/editor/create.ts +15 -1
- package/src/editor/design-tokens.ts +3 -23
- package/src/editor/image-edit.ts +5 -2
- package/src/editor/index.ts +1 -0
- package/src/editor/layout-mode.ts +131 -3
- package/src/editor/nodes.ts +30 -5
- package/src/editor/read-only/actions.ts +6 -0
- package/src/editor/selection/overlays.ts +8 -0
- package/src/editor/state/shared.ts +1 -0
- package/src/editor/state/view.ts +2 -0
- package/src/editor/structure/boolean.ts +29 -1
- package/src/editor/structure/container-wrap.ts +20 -4
- package/src/editor/structure/flatten.ts +15 -8
- package/src/editor/structure/group/ungroup.ts +2 -0
- package/src/editor/structure/outline-stroke.ts +5 -0
- package/src/editor/styles.ts +203 -0
- package/src/editor/text/selection-style.ts +18 -1
- package/src/editor/tool-registry.ts +2 -0
- package/src/editor/types.ts +14 -0
- package/src/editor/variable-bindings.ts +11 -0
- package/src/figma-api/accessors/basic.ts +33 -1
- package/src/figma-api/accessors/vector.ts +6 -13
- package/src/figma-api/compatibility.ts +1 -0
- package/src/figma-api/component-scope.ts +36 -0
- package/src/figma-api/components.ts +24 -0
- package/src/figma-api/flatten.ts +7 -3
- package/src/figma-api/index.ts +302 -6
- package/src/figma-api/node-types.ts +1 -0
- package/src/figma-api/overrides.ts +192 -5
- package/src/figma-api/proxy.ts +16 -1
- package/src/figma-api/reactions.ts +163 -12
- package/src/figma-api/slots.ts +10 -9
- package/src/io/formats/code/detect.ts +67 -0
- package/src/io/formats/code/index.ts +17 -0
- package/src/io/formats/code/read.ts +143 -0
- package/src/io/formats/code/stylesheet.ts +24 -0
- package/src/io/formats/code/tokens.ts +159 -0
- package/src/io/formats/design-tokens/apply.ts +3 -2
- package/src/io/formats/drawio/warnings.ts +27 -8
- package/src/io/formats/fig/export/patch/fields.ts +11 -0
- package/src/io/formats/fig/export/patch/index.ts +23 -19
- package/src/io/formats/fig/export/setup.ts +8 -1
- package/src/io/formats/fig/index.ts +6 -0
- package/src/io/formats/fig/read.ts +11 -2
- package/src/io/formats/html/index.ts +9 -3
- package/src/io/formats/html/layers.ts +7 -0
- package/src/io/formats/pdf/export.ts +19 -7
- package/src/io/formats/pdf/plan.ts +71 -32
- package/src/io/formats/pen/index.ts +14 -6
- package/src/io/formats/raster/headless.ts +3 -1
- package/src/io/formats/raster/index.ts +2 -0
- package/src/io/formats/raster/render.ts +49 -9
- package/src/io/formats/svg/defs.ts +27 -1
- package/src/io/formats/svg/export.ts +75 -13
- package/src/io/formats/svg/index.ts +1 -0
- package/src/io/formats/svg/text/layout.ts +5 -3
- package/src/io/formats/video/record.ts +33 -9
- package/src/io/formats.ts +45 -19
- package/src/io/index.ts +1 -0
- package/src/io/types.ts +10 -0
- package/src/kiwi/fig/population/client.ts +6 -1
- package/src/kiwi/fig/session/document-state.ts +195 -5
- package/src/kiwi/fig/session/options.ts +2 -0
- package/src/layout/apply.ts +12 -4
- package/src/layout/auto-layout-handles.ts +1 -1
- package/src/layout/axis-sizing.ts +3 -1
- package/src/layout/derived.ts +3 -1
- package/src/layout/effective-generated-text.ts +1 -1
- package/src/layout/grid.ts +91 -21
- package/src/layout.ts +16 -3
- package/src/node/fs.ts +32 -7
- package/src/prototype/easing.ts +79 -7
- package/src/prototype/scenes.ts +244 -15
- package/src/prototype/session.ts +1 -0
- package/src/prototype/smart-animate/animation.ts +4 -3
- package/src/prototype/timeline.ts +118 -26
- package/src/prototype/variables.ts +189 -0
- package/src/rpc/read-commands.ts +19 -1
- package/src/text/character-style.ts +47 -0
- package/src/text/index.ts +1 -1
- package/src/tools/create/basic.ts +2 -3
- package/src/tools/create/code.ts +85 -0
- package/src/tools/create/html.ts +9 -46
- package/src/tools/create/inputs.ts +12 -0
- package/src/tools/create/mermaid.ts +6 -6
- package/src/tools/create/place.ts +80 -0
- package/src/tools/create.ts +1 -0
- package/src/tools/css/gradient.ts +147 -0
- package/src/tools/modify/geometry.ts +5 -5
- package/src/tools/modify/layout.ts +19 -0
- package/src/tools/modify/overrides.ts +35 -0
- package/src/tools/modify/paint.ts +124 -54
- package/src/tools/modify/text.ts +91 -7
- package/src/tools/modify/update.ts +23 -2
- package/src/tools/modify.ts +9 -1
- package/src/tools/read/css.ts +46 -12
- package/src/tools/read/nodes.ts +26 -4
- package/src/tools/registry/extended.ts +6 -0
- package/src/tools/text-range.ts +29 -0
- package/src/tools/variables/bindings.ts +4 -1
- package/src/tools/variables/unbind.ts +4 -1
- package/src/tools/vector/path.ts +11 -13
- package/src/vector/rebase.ts +33 -0
package/src/io/formats.ts
CHANGED
|
@@ -11,7 +11,12 @@ import { exportFigFile, parseFigFile } from './formats/fig'
|
|
|
11
11
|
import type { PDFPageSpec } from './formats/pdf/plan'
|
|
12
12
|
import { penFormat } from './formats/pen'
|
|
13
13
|
import type { PPTXExportOptions } from './formats/pptx'
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
headlessRenderNodes,
|
|
16
|
+
renderNodesToImage,
|
|
17
|
+
sliceRegion,
|
|
18
|
+
type RasterExportFormat
|
|
19
|
+
} from './formats/raster'
|
|
15
20
|
import { extractExportGraph, findPageId } from './subgraph'
|
|
16
21
|
import type {
|
|
17
22
|
ExportRequest,
|
|
@@ -49,16 +54,21 @@ function ensureSingleNode(target: ExportRequest['target']): string | null {
|
|
|
49
54
|
return null
|
|
50
55
|
}
|
|
51
56
|
|
|
57
|
+
/** A page's top-level layers that draw: a slice names an export region, not page content. */
|
|
58
|
+
function drawingPageChildren(graph: SceneGraph, page: { childIds: readonly string[] }): string[] {
|
|
59
|
+
return page.childIds.filter((id) => graph.getNode(id)?.type !== 'SLICE')
|
|
60
|
+
}
|
|
61
|
+
|
|
52
62
|
function resolveExportNodes(request: ExportRequest): { pageId: string; nodeIds: string[] } | null {
|
|
53
63
|
switch (request.target.scope) {
|
|
54
64
|
case 'document': {
|
|
55
65
|
const page = request.graph.getPages()[0]
|
|
56
|
-
return { pageId: page.id, nodeIds:
|
|
66
|
+
return { pageId: page.id, nodeIds: drawingPageChildren(request.graph, page) }
|
|
57
67
|
}
|
|
58
68
|
case 'page': {
|
|
59
69
|
const page = request.graph.getNode(request.target.pageId)
|
|
60
70
|
if (!page) return null
|
|
61
|
-
return { pageId: page.id, nodeIds:
|
|
71
|
+
return { pageId: page.id, nodeIds: drawingPageChildren(request.graph, page) }
|
|
62
72
|
}
|
|
63
73
|
case 'selection': {
|
|
64
74
|
const first = request.target.nodeIds[0]
|
|
@@ -88,6 +98,12 @@ async function renderRaster(
|
|
|
88
98
|
const target = resolveExportNodes(request)
|
|
89
99
|
if (!target) return null
|
|
90
100
|
const scale = options.scale ?? 1
|
|
101
|
+
const renderOptions = {
|
|
102
|
+
scale,
|
|
103
|
+
format: options.format,
|
|
104
|
+
quality: options.quality,
|
|
105
|
+
trimTransparent: request.target.scope === 'page' || request.target.scope === 'document'
|
|
106
|
+
}
|
|
91
107
|
|
|
92
108
|
if (context?.canvasKit && context.renderer) {
|
|
93
109
|
return renderNodesToImage(
|
|
@@ -96,21 +112,17 @@ async function renderRaster(
|
|
|
96
112
|
request.graph,
|
|
97
113
|
target.pageId,
|
|
98
114
|
target.nodeIds,
|
|
99
|
-
|
|
100
|
-
scale,
|
|
101
|
-
format: options.format,
|
|
102
|
-
quality: options.quality,
|
|
103
|
-
trimTransparent: request.target.scope === 'page' || request.target.scope === 'document'
|
|
104
|
-
}
|
|
115
|
+
renderOptions
|
|
105
116
|
)
|
|
106
117
|
}
|
|
107
118
|
|
|
108
|
-
return headlessRenderNodes(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
119
|
+
return headlessRenderNodes(
|
|
120
|
+
request.graph,
|
|
121
|
+
target.pageId,
|
|
122
|
+
target.nodeIds,
|
|
123
|
+
renderOptions,
|
|
124
|
+
context?.canvasKit
|
|
125
|
+
)
|
|
114
126
|
}
|
|
115
127
|
|
|
116
128
|
function rasterFormat<F extends RasterExportFormat>(format: F): IOFormatAdapter<Lowercase<F>> {
|
|
@@ -314,14 +326,20 @@ export const mermaidFormat: IOFormatAdapter<'mermaid'> = {
|
|
|
314
326
|
async function writeDrawIO(graph: SceneGraph, target: DrawIOExportTarget): Promise<ExportResult> {
|
|
315
327
|
const { writeDrawIOFile } = await import('@pairdraw/drawio')
|
|
316
328
|
const { sceneGraphToDrawIO } = await import('./formats/drawio')
|
|
317
|
-
const {
|
|
318
|
-
|
|
329
|
+
const { drawioWriteWarnings, drawioWriteWarningText } = await import('./formats/drawio/warnings')
|
|
330
|
+
const warningDetails = drawioWriteWarnings(graph)
|
|
331
|
+
const written: ExportResult = {
|
|
319
332
|
format: 'drawio',
|
|
320
333
|
mimeType: 'application/vnd.jgraph.mxfile',
|
|
321
334
|
extension: 'drawio',
|
|
322
335
|
data: writeDrawIOFile(sceneGraphToDrawIO(graph, target)),
|
|
323
|
-
encoding: 'utf8'
|
|
324
|
-
|
|
336
|
+
encoding: 'utf8'
|
|
337
|
+
}
|
|
338
|
+
if (warningDetails.length === 0) return written
|
|
339
|
+
return {
|
|
340
|
+
...written,
|
|
341
|
+
warnings: warningDetails.map(drawioWriteWarningText),
|
|
342
|
+
warningDetails
|
|
325
343
|
}
|
|
326
344
|
}
|
|
327
345
|
|
|
@@ -400,6 +418,14 @@ async function pdfPageSpecs(
|
|
|
400
418
|
}
|
|
401
419
|
const target = resolveExportNodes(request)
|
|
402
420
|
if (!target) throw new Error('Nothing to export')
|
|
421
|
+
if (sliceRegion(request.graph, target.nodeIds)) {
|
|
422
|
+
const { planPDFPages } = await import('./formats/pdf/plan')
|
|
423
|
+
return planPDFPages(request.graph, {
|
|
424
|
+
mode: 'single',
|
|
425
|
+
ids: target.nodeIds,
|
|
426
|
+
currentPageId: target.pageId
|
|
427
|
+
})
|
|
428
|
+
}
|
|
403
429
|
return [target]
|
|
404
430
|
}
|
|
405
431
|
|
package/src/io/index.ts
CHANGED
package/src/io/types.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { CanvasKit } from 'canvaskit-wasm'
|
|
2
2
|
|
|
3
3
|
import type { TailwindStylesheetLoader } from '@pairdraw/dom-css/export'
|
|
4
|
+
import type { PenWriteWarning } from '@pairdraw/pen'
|
|
4
5
|
import type { SceneGraph } from '@pairdraw/scene-graph'
|
|
5
6
|
import type { RenderColorSpace } from '@pairdraw/scene-graph/color'
|
|
6
7
|
|
|
7
8
|
import type { SkiaRenderer } from '#core/canvas'
|
|
8
9
|
import type { IconProvider } from '#core/icons'
|
|
9
10
|
|
|
11
|
+
import type { DrawioWriteWarning } from './formats/drawio/warnings'
|
|
10
12
|
import type { RasterExportFormat } from './formats/raster'
|
|
11
13
|
|
|
12
14
|
export type IOFormatRole = 'native-document' | 'interchange-document' | 'derived-export'
|
|
@@ -154,8 +156,16 @@ export interface ExportResult {
|
|
|
154
156
|
assets?: ExportAsset[]
|
|
155
157
|
/** What the format could not hold, such as the variables draw.io has no model for. */
|
|
156
158
|
warnings?: string[]
|
|
159
|
+
/** The same facts as kinds, for a host that shows them in its own language. */
|
|
160
|
+
warningDetails?: WriteDocumentWarning[]
|
|
157
161
|
}
|
|
158
162
|
|
|
163
|
+
/**
|
|
164
|
+
* What a writer could not put in its file, as facts: the pen and draw.io writers name their own
|
|
165
|
+
* kinds, and a host translates them instead of printing the English `warnings` sentences.
|
|
166
|
+
*/
|
|
167
|
+
export type WriteDocumentWarning = PenWriteWarning | DrawioWriteWarning
|
|
168
|
+
|
|
159
169
|
export interface HTMLExportOptions {
|
|
160
170
|
html?: 'fragment' | 'standalone'
|
|
161
171
|
style?: 'inline' | 'tailwind'
|
|
@@ -3,7 +3,11 @@ import { randomHex } from '@pairdraw/scene-graph/random'
|
|
|
3
3
|
|
|
4
4
|
import { releaseFigArchive } from '#core/kiwi/fig/session/archive/access'
|
|
5
5
|
import { archiveChanges, trackArchiveChanges } from '#core/kiwi/fig/session/archive/changes'
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
normalizeSlotContentOwners,
|
|
8
|
+
releaseReaderRecovery,
|
|
9
|
+
updateReaderRecovery
|
|
10
|
+
} from '#core/kiwi/fig/session/document-state'
|
|
7
11
|
import type { FigSessionRequest, FigSessionResponse } from '#core/kiwi/fig/session/protocol'
|
|
8
12
|
|
|
9
13
|
import { beginFigPopulation, type FigPopulation, type FigPopulationRebase } from './delta'
|
|
@@ -279,6 +283,7 @@ export function createPopulationWorkerClient(
|
|
|
279
283
|
return request.resolve(null)
|
|
280
284
|
}
|
|
281
285
|
|
|
286
|
+
normalizeSlotContentOwners(graph)
|
|
282
287
|
forgetSettledEdits(edits.revision)
|
|
283
288
|
// The worker built what it sent without the edits made meanwhile; it takes this thread's
|
|
284
289
|
// state where they met, and the instances it built from components edited since.
|
|
@@ -3,7 +3,9 @@ import {
|
|
|
3
3
|
figCheckpointRecords,
|
|
4
4
|
type FigSessionCheckpoint
|
|
5
5
|
} from '@pairdraw/fig'
|
|
6
|
-
import type {
|
|
6
|
+
import type { GUID } from '@pairdraw/kiwi/fig'
|
|
7
|
+
import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
8
|
+
import { dropDuplicateSlotContentAssignments } from '@pairdraw/scene-graph/slots'
|
|
7
9
|
|
|
8
10
|
import { figArchive } from '#core/kiwi/fig/session/archive/access'
|
|
9
11
|
import { readerSessionOptions, type FigReaderDiagnostic } from '#core/kiwi/fig/session/options'
|
|
@@ -32,6 +34,22 @@ export function registerReaderRecovery(
|
|
|
32
34
|
states.set(graph, { bytes, checkpoint, diagnostics: [] })
|
|
33
35
|
}
|
|
34
36
|
|
|
37
|
+
const outsideDiagnostics = new WeakMap<SceneGraph, FigReaderDiagnostic[]>()
|
|
38
|
+
|
|
39
|
+
/** Records a diagnostic on a graph whose reader state is gone or was never kept. */
|
|
40
|
+
export function recordReaderDiagnostic(graph: SceneGraph, diagnostic: FigReaderDiagnostic): void {
|
|
41
|
+
const log = outsideDiagnostics.get(graph)
|
|
42
|
+
if (log) log.push(diagnostic)
|
|
43
|
+
else outsideDiagnostics.set(graph, [diagnostic])
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Keeps one owner per slot-content frame on a graph read from outside Pairdraw. */
|
|
47
|
+
export function normalizeSlotContentOwners(graph: SceneGraph): void {
|
|
48
|
+
for (const conflict of dropDuplicateSlotContentAssignments(graph)) {
|
|
49
|
+
recordReaderDiagnostic(graph, { kind: 'duplicate-slot-content', diagnostic: conflict })
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
35
53
|
export function registerReaderSession(
|
|
36
54
|
bytes: ArrayBuffer,
|
|
37
55
|
session: ReturnType<typeof createFigDocumentSession>,
|
|
@@ -40,9 +58,170 @@ export function registerReaderSession(
|
|
|
40
58
|
states.set(session.graph, { bytes, session, diagnostics })
|
|
41
59
|
}
|
|
42
60
|
|
|
61
|
+
/** Whether this graph still holds a live reader session (its decoded records). */
|
|
62
|
+
export function readerSessionHeld(graph: SceneGraph): boolean {
|
|
63
|
+
return states.get(graph)?.session !== undefined
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Drop the decoded records of a graph whose pages are in it, keeping the archive bytes and the
|
|
68
|
+
* checkpoint so a save or an explicit page population can open a fresh session from them. The
|
|
69
|
+
* session holds every record of the file decoded, which is the largest part of an open document.
|
|
70
|
+
*/
|
|
71
|
+
export function releaseReaderRecords(graph: SceneGraph): void {
|
|
72
|
+
const state = states.get(graph)
|
|
73
|
+
if (!state?.session) return
|
|
74
|
+
const session = state.session
|
|
75
|
+
const everyPageLoaded = session.pages.every((page) => session.loadedPageIds.has(page.id))
|
|
76
|
+
state.checkpoint = session.checkpoint()
|
|
77
|
+
state.session = undefined
|
|
78
|
+
// With every page already in the graph there is nothing left to read; without this a fallback
|
|
79
|
+
// write sees the missing session as pending pages and clones the whole document.
|
|
80
|
+
if (everyPageLoaded) state.complete = true
|
|
81
|
+
}
|
|
82
|
+
|
|
43
83
|
/** Records skipped while opening, recovering, or exporting this graph's document. */
|
|
44
|
-
|
|
45
|
-
|
|
84
|
+
/** One kind of reader diagnostic and how many records it affected. */
|
|
85
|
+
export interface ReaderDiagnosticCount {
|
|
86
|
+
kind: FigReaderDiagnostic['kind']
|
|
87
|
+
count: number
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** The reader diagnostics of `graph`, counted by kind and sorted, for reports. */
|
|
91
|
+
export function readerDiagnosticCounts(graph: SceneGraph): ReaderDiagnosticCount[] {
|
|
92
|
+
const counts = new Map<FigReaderDiagnostic['kind'], number>()
|
|
93
|
+
for (const entry of readerDiagnostics(graph))
|
|
94
|
+
counts.set(entry.kind, (counts.get(entry.kind) ?? 0) + 1)
|
|
95
|
+
return [...counts]
|
|
96
|
+
.map(([kind, count]) => ({ kind, count }))
|
|
97
|
+
.sort((left, right) => left.kind.localeCompare(right.kind))
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export type ReaderDiagnosticReason =
|
|
101
|
+
| 'missing-target'
|
|
102
|
+
| 'ambiguous-target'
|
|
103
|
+
| 'library-not-loaded'
|
|
104
|
+
| 'stale-target'
|
|
105
|
+
|
|
106
|
+
/** A reader record as reported: a skipped part, or a saved path that names other content. */
|
|
107
|
+
export type ReaderDiagnostic =
|
|
108
|
+
| Exclude<FigReaderDiagnostic, { kind: 'property' }>
|
|
109
|
+
| {
|
|
110
|
+
kind: 'property'
|
|
111
|
+
diagnostic: Omit<
|
|
112
|
+
Extract<FigReaderDiagnostic, { kind: 'property' }>['diagnostic'],
|
|
113
|
+
'reason'
|
|
114
|
+
> & { reason: ReaderDiagnosticReason }
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** What the reader could not use, gathered under the component the records belong to. */
|
|
118
|
+
export interface ReaderDiagnosticComponent {
|
|
119
|
+
id: string | null
|
|
120
|
+
name: string
|
|
121
|
+
count: number
|
|
122
|
+
reasons: ReaderDiagnosticReason[]
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** The main component a diagnostic belongs to, where the record names one. */
|
|
126
|
+
function diagnosticComponentId(entry: ReaderDiagnostic): string | null {
|
|
127
|
+
const diagnostic = entry.diagnostic as {
|
|
128
|
+
mainComponentId?: string | null
|
|
129
|
+
componentId?: string
|
|
130
|
+
}
|
|
131
|
+
return diagnostic.mainComponentId ?? diagnostic.componentId ?? null
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Reader diagnostics grouped by the component whose records were skipped, largest first, for a
|
|
136
|
+
* notice that names components instead of counting parts. `kinds` narrows the report to what a
|
|
137
|
+
* person can act on; the library reason needs a missing target on a layer carrying a library key.
|
|
138
|
+
*/
|
|
139
|
+
export function readerDiagnosticComponents(
|
|
140
|
+
graph: SceneGraph,
|
|
141
|
+
kinds?: ReadonlySet<FigReaderDiagnostic['kind']>
|
|
142
|
+
): readonly ReaderDiagnosticComponent[] {
|
|
143
|
+
const components = new Map<string, ReaderDiagnosticComponent>()
|
|
144
|
+
for (const entry of readerDiagnostics(graph)) {
|
|
145
|
+
if (kinds && !kinds.has(entry.kind)) continue
|
|
146
|
+
if ((entry.diagnostic as { reason?: ReaderDiagnosticReason }).reason === 'stale-target')
|
|
147
|
+
continue
|
|
148
|
+
const owner = componentOwnerOf(graph, diagnosticComponentId(entry))
|
|
149
|
+
const diagnostic = entry.diagnostic as {
|
|
150
|
+
path?: readonly GUID[]
|
|
151
|
+
reason?: ReaderDiagnosticReason | 'missing-target' | 'ambiguous-target'
|
|
152
|
+
targetAbsent?: boolean
|
|
153
|
+
}
|
|
154
|
+
const reason = diagnosticReason(graph, diagnostic, owner)
|
|
155
|
+
const key = owner.id ?? owner.name
|
|
156
|
+
const current = components.get(key) ?? { id: owner.id, name: owner.name, count: 0, reasons: [] }
|
|
157
|
+
current.count++
|
|
158
|
+
if (!current.reasons.includes(reason)) current.reasons.push(reason)
|
|
159
|
+
components.set(key, current)
|
|
160
|
+
}
|
|
161
|
+
return [...components.values()].sort(
|
|
162
|
+
(left, right) => right.count - left.count || left.name.localeCompare(right.name)
|
|
163
|
+
)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
interface DiagnosticOwner {
|
|
167
|
+
id: string | null
|
|
168
|
+
name: string
|
|
169
|
+
node: SceneNode | undefined
|
|
170
|
+
component: SceneNode | undefined
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** The component set a variant belongs to, or the component itself, with a name to show. */
|
|
174
|
+
function componentOwnerOf(graph: SceneGraph, componentId: string | null): DiagnosticOwner {
|
|
175
|
+
const component = componentId === null ? undefined : graph.getNode(componentId)
|
|
176
|
+
const parent = component?.parentId ? graph.getNode(component.parentId) : undefined
|
|
177
|
+
const node =
|
|
178
|
+
component?.type === 'COMPONENT' && parent?.type === 'COMPONENT_SET' ? parent : component
|
|
179
|
+
return {
|
|
180
|
+
id: node?.id ?? componentId,
|
|
181
|
+
name: node?.name ?? componentId ?? 'Unknown component',
|
|
182
|
+
node,
|
|
183
|
+
component
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function diagnosticReason(
|
|
188
|
+
graph: SceneGraph,
|
|
189
|
+
diagnostic: {
|
|
190
|
+
path?: readonly GUID[]
|
|
191
|
+
reason?: ReaderDiagnosticReason | 'missing-target' | 'ambiguous-target'
|
|
192
|
+
targetAbsent?: boolean
|
|
193
|
+
},
|
|
194
|
+
owner: DiagnosticOwner
|
|
195
|
+
): ReaderDiagnosticReason {
|
|
196
|
+
const absent =
|
|
197
|
+
diagnostic.targetAbsent === true ||
|
|
198
|
+
(diagnostic.path?.some(
|
|
199
|
+
(guid) => graph.getNode(`${guid.sessionID}:${guid.localID}`) === undefined
|
|
200
|
+
) ??
|
|
201
|
+
false)
|
|
202
|
+
if (absent && (owner.node?.sourceLibraryKey ?? owner.component?.sourceLibraryKey))
|
|
203
|
+
return 'library-not-loaded'
|
|
204
|
+
return diagnostic.reason === 'ambiguous-target' ? 'ambiguous-target' : 'missing-target'
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export function readerDiagnostics(graph: SceneGraph): readonly ReaderDiagnostic[] {
|
|
208
|
+
return [...(states.get(graph)?.diagnostics ?? []), ...(outsideDiagnostics.get(graph) ?? [])].map(
|
|
209
|
+
(entry) => {
|
|
210
|
+
if (entry.kind !== 'property') return entry
|
|
211
|
+
const diagnostic = entry.diagnostic
|
|
212
|
+
if (
|
|
213
|
+
diagnostic.reason !== 'missing-target' ||
|
|
214
|
+
diagnostic.path.length === 0 ||
|
|
215
|
+
!diagnostic.path.every(
|
|
216
|
+
(guid) => graph.getNode(`${guid.sessionID}:${guid.localID}`) !== undefined
|
|
217
|
+
)
|
|
218
|
+
)
|
|
219
|
+
return entry
|
|
220
|
+
// The path names layers the file holds, just not under the instance that saved it: stale
|
|
221
|
+
// saved state, not a part the reader lost. It stays in the raw report and out of the notice.
|
|
222
|
+
return { ...entry, diagnostic: { ...diagnostic, reason: 'stale-target' as const } }
|
|
223
|
+
}
|
|
224
|
+
)
|
|
46
225
|
}
|
|
47
226
|
|
|
48
227
|
export function isReaderPagePending(graph: SceneGraph, pageId: string): boolean {
|
|
@@ -119,8 +298,18 @@ function releaseLoadedReader(state: ReaderState): void {
|
|
|
119
298
|
*/
|
|
120
299
|
export function populateFigInternalPages(graph: SceneGraph): boolean {
|
|
121
300
|
const state = states.get(graph)
|
|
122
|
-
|
|
123
|
-
|
|
301
|
+
if (!state || state.complete) return false
|
|
302
|
+
let session = state.session
|
|
303
|
+
if (!session) {
|
|
304
|
+
// The records are released; read them back for the internal pages a full write needs, on this
|
|
305
|
+
// graph, so a released document does not turn every fallback write into a full clone.
|
|
306
|
+
if (!state.checkpoint || !state.bytes) return false
|
|
307
|
+
session = createFigDocumentSession(state.bytes, readerSessionOptions(state.diagnostics), {
|
|
308
|
+
graph,
|
|
309
|
+
checkpoint: state.checkpoint
|
|
310
|
+
})
|
|
311
|
+
state.session = session
|
|
312
|
+
}
|
|
124
313
|
let changed = false
|
|
125
314
|
for (const page of session.pages) {
|
|
126
315
|
if (!page.internalOnly || session.loadedPageIds.has(page.id)) continue
|
|
@@ -186,6 +375,7 @@ export function recoverReaderPage(graph: SceneGraph, pageId: string): boolean {
|
|
|
186
375
|
const populated = !session.loadedPageIds.has(page.id)
|
|
187
376
|
// The layers come from the opened file, as they do through the population worker's delta.
|
|
188
377
|
graph.applyImportedStateDuring(() => session.loadPage(page.id))
|
|
378
|
+
normalizeSlotContentOwners(graph)
|
|
189
379
|
releaseLoadedReader(state)
|
|
190
380
|
return populated
|
|
191
381
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DocumentAssemblyOptions } from '@pairdraw/fig'
|
|
2
|
+
import type { DuplicateSlotContentAssignment } from '@pairdraw/scene-graph/slots'
|
|
2
3
|
|
|
3
4
|
type Handler<K extends keyof DocumentAssemblyOptions> = NonNullable<DocumentAssemblyOptions[K]>
|
|
4
5
|
|
|
@@ -13,6 +14,7 @@ export type FigReaderDiagnostic =
|
|
|
13
14
|
}
|
|
14
15
|
| { kind: 'component'; diagnostic: Parameters<Handler<'onMissingComponent'>>[0] }
|
|
15
16
|
| { kind: 'slot-content'; diagnostic: Parameters<Handler<'onMissingSlotContent'>>[0] }
|
|
17
|
+
| { kind: 'duplicate-slot-content'; diagnostic: DuplicateSlotContentAssignment }
|
|
16
18
|
| { kind: 'variable-type'; diagnostic: Parameters<Handler<'onUnsupportedVariableType'>>[0] }
|
|
17
19
|
|
|
18
20
|
/** Each sink's entries, so a record reported again is not listed twice. */
|
package/src/layout/apply.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { layoutConstrainedChildRect, shapeGeometryChanges } from '@pairdraw/scen
|
|
|
7
7
|
|
|
8
8
|
import { keepsSavedFrameSize, keepsSavedLayout, usesDetachedDerivedLayout } from './derived'
|
|
9
9
|
import { laidOutFlowBox } from './flow-edges'
|
|
10
|
+
import { gridChildBox } from './grid'
|
|
10
11
|
import { contentInsetsSize } from './strokes'
|
|
11
12
|
|
|
12
13
|
export type ComputeLayoutFn = (graph: SceneGraph, frameId: string) => void
|
|
@@ -111,6 +112,7 @@ function constrainChildren(
|
|
|
111
112
|
computeLayout: ComputeLayoutFn
|
|
112
113
|
): void {
|
|
113
114
|
for (const child of graph.getChildren(frame.id)) {
|
|
115
|
+
if (child.type === 'SLICE') continue
|
|
114
116
|
if (frame.layoutMode !== 'NONE' && child.layoutPositioning !== 'ABSOLUTE') continue
|
|
115
117
|
const size = { width: child.width, height: child.height }
|
|
116
118
|
writeLayoutGeometry(
|
|
@@ -122,7 +124,8 @@ function constrainChildren(
|
|
|
122
124
|
frame,
|
|
123
125
|
child.horizontalConstraint,
|
|
124
126
|
child.verticalConstraint,
|
|
125
|
-
enforcedAspectRatio(child)
|
|
127
|
+
enforcedAspectRatio(child),
|
|
128
|
+
child
|
|
126
129
|
),
|
|
127
130
|
computeLayout,
|
|
128
131
|
undefined,
|
|
@@ -260,8 +263,12 @@ function computedChildPosition(
|
|
|
260
263
|
keepsSaved: boolean
|
|
261
264
|
): number {
|
|
262
265
|
if (preservesImportedGeometry) return child[axis]
|
|
266
|
+
const layer = gridChildBox(yogaChild) ?? yogaChild
|
|
263
267
|
const computed =
|
|
264
|
-
origin +
|
|
268
|
+
origin +
|
|
269
|
+
(axis === 'x'
|
|
270
|
+
? yogaChild.getComputedLeft() + (layer === yogaChild ? 0 : layer.getComputedLeft())
|
|
271
|
+
: yogaChild.getComputedTop() + (layer === yogaChild ? 0 : layer.getComputedTop()))
|
|
265
272
|
if (child.type === 'INSTANCE' || !keepsSaved) return computed
|
|
266
273
|
return child.derivedLayout?.[axis] ?? computed
|
|
267
274
|
}
|
|
@@ -289,7 +296,8 @@ function computedChildSize(
|
|
|
289
296
|
) {
|
|
290
297
|
return child[axis]
|
|
291
298
|
}
|
|
292
|
-
const
|
|
299
|
+
const layer = gridChildBox(yogaChild) ?? yogaChild
|
|
300
|
+
const computed = axis === 'width' ? layer.getComputedWidth() : layer.getComputedHeight()
|
|
293
301
|
if (child.type === 'TEXT' && child.source.format === 'fig') {
|
|
294
302
|
return computed > 0 ? computed : child[axis]
|
|
295
303
|
}
|
|
@@ -389,7 +397,7 @@ export function applyYogaLayout(
|
|
|
389
397
|
const keepsSaved = keepsSavedLayout(graph, frame)
|
|
390
398
|
applyFrameSize(graph, frame, yogaNode, keepsSaved, computeLayout)
|
|
391
399
|
|
|
392
|
-
const children = graph.getChildren(frame.id)
|
|
400
|
+
const children = graph.getChildren(frame.id).filter((child) => child.type !== 'SLICE')
|
|
393
401
|
const box = laidOutFlowBox(yogaNode, frame)
|
|
394
402
|
let yogaIndex = 0
|
|
395
403
|
for (const child of children) {
|
|
@@ -225,7 +225,7 @@ export function measureAutoLayoutHandles(
|
|
|
225
225
|
): AutoLayoutHandleLayout | null {
|
|
226
226
|
if (!node || (node.layoutMode !== 'HORIZONTAL' && node.layoutMode !== 'VERTICAL')) return null
|
|
227
227
|
const laidOut = children.filter(
|
|
228
|
-
(child) => child.visible && child.layoutPositioning !== 'ABSOLUTE'
|
|
228
|
+
(child) => child.visible && child.type !== 'SLICE' && child.layoutPositioning !== 'ABSOLUTE'
|
|
229
229
|
)
|
|
230
230
|
const padding: AutoLayoutPaddingHandle[] = []
|
|
231
231
|
const sides: AutoLayoutPaddingSide[] = ['top', 'right', 'bottom', 'left']
|
|
@@ -47,7 +47,9 @@ export function heldHugAxis(graph: SceneGraph, frame: SceneNode): 'width' | 'hei
|
|
|
47
47
|
if (frame.layoutMode !== 'HORIZONTAL' && frame.layoutMode !== 'VERTICAL') return null
|
|
48
48
|
const flow = graph
|
|
49
49
|
.getChildren(frame.id)
|
|
50
|
-
.filter(
|
|
50
|
+
.filter(
|
|
51
|
+
(child) => child.visible && child.type !== 'SLICE' && child.layoutPositioning !== 'ABSOLUTE'
|
|
52
|
+
)
|
|
51
53
|
const holds =
|
|
52
54
|
flow.length > 0 &&
|
|
53
55
|
flow.every(
|
package/src/layout/derived.ts
CHANGED
|
@@ -30,7 +30,9 @@ function graphState<T>(states: WeakMap<SceneGraph, T>, graph: SceneGraph, create
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
function flowOf(graph: SceneGraph, node: SceneNode): SceneNode[] {
|
|
33
|
-
return graph
|
|
33
|
+
return graph
|
|
34
|
+
.getChildren(node.id)
|
|
35
|
+
.filter((child) => child.type !== 'SLICE' && child.layoutPositioning !== 'ABSOLUTE')
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
/**
|
|
@@ -82,7 +82,7 @@ function stretchesCrossAxis(child: SceneNode, parent: SceneNode): boolean {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
function participatesInIntrinsicSize(node: SceneNode): boolean {
|
|
85
|
-
return node.visible && node.layoutPositioning !== 'ABSOLUTE'
|
|
85
|
+
return node.visible && node.type !== 'SLICE' && node.layoutPositioning !== 'ABSOLUTE'
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
function intrinsicSize(
|