@pairdraw/core 0.21.1 → 0.22.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/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/images/previews.d.ts +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/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/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 +65 -9
- 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/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/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/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 +20 -13
- package/dist/io/formats.js.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/font/batch.d.ts +26 -0
- package/dist/text/font/batch.d.ts.map +1 -0
- package/dist/text/font/batch.js +31 -0
- package/dist/text/font/batch.js.map +1 -0
- package/dist/text/font/manager.d.ts.map +1 -1
- package/dist/text/font/manager.js +14 -1
- package/dist/text/font/manager.js.map +1 -1
- package/dist/text/index.d.ts +3 -2
- package/dist/text/index.js +3 -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/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/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/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/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/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 +35 -15
- 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/font/batch.ts +58 -0
- package/src/text/font/manager.ts +17 -1
- package/src/text/index.ts +2 -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/editor/state/view.ts
CHANGED
|
@@ -22,6 +22,7 @@ export function createDefaultEditorViewState(pageId: string): EditorViewState {
|
|
|
22
22
|
penCursorY: null,
|
|
23
23
|
pencilState: null,
|
|
24
24
|
autoLayoutHover: null,
|
|
25
|
+
layoutSpacingNodeId: null,
|
|
25
26
|
shapeHandleHover: null,
|
|
26
27
|
connectorTarget: null,
|
|
27
28
|
panX: 0,
|
|
@@ -51,6 +52,7 @@ export function copyEditorViewState(source: EditorViewState): EditorViewState {
|
|
|
51
52
|
penState: structuredClone(source.penState),
|
|
52
53
|
pencilState: structuredClone(source.pencilState),
|
|
53
54
|
autoLayoutHover: structuredClone(source.autoLayoutHover),
|
|
55
|
+
layoutSpacingNodeId: source.layoutSpacingNodeId,
|
|
54
56
|
shapeHandleHover: structuredClone(source.shapeHandleHover),
|
|
55
57
|
connectorTarget: structuredClone(source.connectorTarget),
|
|
56
58
|
pageColor: { ...source.pageColor },
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
type GroupFit,
|
|
7
7
|
type GroupFitOptions
|
|
8
8
|
} from '@pairdraw/scene-graph/group-bounds'
|
|
9
|
+
import { assertGroupPlacement, slotScope } from '@pairdraw/scene-graph/slots'
|
|
9
10
|
|
|
10
11
|
import { canMakeBooleanSourceNode, groupFitOptions } from '#core/canvas/boolean'
|
|
11
12
|
import { restoreSubtree, snapshotSubtree } from '#core/editor/history/subtree'
|
|
@@ -59,10 +60,37 @@ export function booleanOperationSelected(
|
|
|
59
60
|
selectedNodes: SceneNode[],
|
|
60
61
|
operation: BooleanOperation
|
|
61
62
|
) {
|
|
63
|
+
// Figma changes a selected boolean group in place instead of wrapping it in another boolean.
|
|
64
|
+
const existing = selectedNodes.length === 1 ? selectedNodes[0] : undefined
|
|
65
|
+
if (existing?.type === 'BOOLEAN_OPERATION') {
|
|
66
|
+
// The operation is part of the component's structure, not an instance override, so a copy
|
|
67
|
+
// inside a locked instance keeps the operation its component has.
|
|
68
|
+
if (existing.parentId && slotScope(ctx.graph, existing.parentId).kind === 'locked') return null
|
|
69
|
+
const before = existing.booleanOperation
|
|
70
|
+
if (before === undefined || before === operation) return null
|
|
71
|
+
const apply = (next: BooleanOperation) => {
|
|
72
|
+
ctx.graph.updateNode(existing.id, { booleanOperation: next })
|
|
73
|
+
ctx.runLayoutForNode(existing.id)
|
|
74
|
+
}
|
|
75
|
+
apply(operation)
|
|
76
|
+
ctx.undo.push({
|
|
77
|
+
label: operationLabel(operation),
|
|
78
|
+
forward: () => apply(operation),
|
|
79
|
+
inverse: () => apply(before)
|
|
80
|
+
})
|
|
81
|
+
return ctx.graph.getNode(existing.id) ?? null
|
|
82
|
+
}
|
|
83
|
+
|
|
62
84
|
const selection = selectedNodesInSharedParent(ctx, selectedNodes)
|
|
63
85
|
if (!selection || selection.topLevel.length < 2) return null
|
|
64
86
|
const { parentId, parent } = selection
|
|
65
87
|
if (selection.topLevel.some((node) => !canMakeBooleanSourceNode(node, ctx.graph))) return null
|
|
88
|
+
assertGroupPlacement(
|
|
89
|
+
ctx.graph,
|
|
90
|
+
parentId,
|
|
91
|
+
selection.topLevel.map((node) => node.id),
|
|
92
|
+
'boolean operation'
|
|
93
|
+
)
|
|
66
94
|
|
|
67
95
|
const operands = inStackOrder(ctx.graph, selection.topLevel, parentId)
|
|
68
96
|
const prevSelection = new Set(ctx.state.selectedIds)
|
|
@@ -124,7 +152,7 @@ export function booleanOperationSelected(
|
|
|
124
152
|
}
|
|
125
153
|
})
|
|
126
154
|
|
|
127
|
-
return booleanId
|
|
155
|
+
return ctx.graph.getNode(booleanId) ?? null
|
|
128
156
|
}
|
|
129
157
|
|
|
130
158
|
function operationLabel(operation: BooleanOperation) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
2
2
|
import { getAxisAlignedBoundsInParent } from '@pairdraw/scene-graph/coordinate'
|
|
3
3
|
import { groupBounds } from '@pairdraw/scene-graph/group-bounds'
|
|
4
|
+
import { slotScope } from '@pairdraw/scene-graph/slots'
|
|
4
5
|
|
|
5
6
|
import { prepareSlotEdits } from '#core/editor/components/slots'
|
|
6
7
|
import { nextNumberedName } from '#core/editor/structure/rename'
|
|
@@ -29,14 +30,26 @@ const NUMBERED_WHEN_WRAPPED: ReadonlySet<WrapContainerType> = new Set([
|
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* The parent these layers share when a new container may go there, or null when they are not
|
|
32
|
-
* siblings or sit in the locked part of an instance.
|
|
33
|
+
* siblings or sit in the locked part of an instance. Reads only: callers that need a slot
|
|
34
|
+
* claimed for the edit do it through `wrapParentId`.
|
|
33
35
|
*/
|
|
34
|
-
export function
|
|
36
|
+
export function wrappableParentId(ctx: EditorContext, nodes: readonly SceneNode[]): string | null {
|
|
35
37
|
const first = nodes.at(0)
|
|
36
38
|
if (!first) return null
|
|
37
39
|
const parentId = first.parentId ?? ctx.state.currentPageId
|
|
38
40
|
if (nodes.some((node) => (node.parentId ?? ctx.state.currentPageId) !== parentId)) return null
|
|
39
|
-
|
|
41
|
+
if (ctx.graph.getNode(parentId)?.type === 'SLICE') return null
|
|
42
|
+
if (slotScope(ctx.graph, parentId).kind === 'locked') return null
|
|
43
|
+
return parentId
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The parent that may take a new container, claiming an untouched slot first so the edit lands
|
|
48
|
+
* in content the instance owns. This mutates; capability checks use `wrappableParentId`.
|
|
49
|
+
*/
|
|
50
|
+
export function wrapParentId(ctx: EditorContext, nodes: readonly SceneNode[]): string | null {
|
|
51
|
+
const parentId = wrappableParentId(ctx, nodes)
|
|
52
|
+
return parentId && prepareSlotEdits(ctx, [parentId]) ? parentId : null
|
|
40
53
|
}
|
|
41
54
|
|
|
42
55
|
/**
|
|
@@ -117,7 +130,10 @@ export function wrapSelectionInContainer(
|
|
|
117
130
|
ctx.setSelectedIds(new Set([containerId]))
|
|
118
131
|
|
|
119
132
|
ctx.undo.push({
|
|
120
|
-
label:
|
|
133
|
+
label:
|
|
134
|
+
containerType === 'COMPONENT_SET'
|
|
135
|
+
? 'Combine as variants'
|
|
136
|
+
: `Create ${containerType.toLowerCase().replace('_', ' ')}`,
|
|
121
137
|
forward: () => {
|
|
122
138
|
const nodes = origPositions.flatMap((n) => ctx.graph.getNode(n.id) ?? [])
|
|
123
139
|
wrapNodes(ctx.graph, containerType, nodes, parentId, index, {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { SceneNode } from '@pairdraw/scene-graph'
|
|
2
|
+
import { assertGroupPlacement } from '@pairdraw/scene-graph/slots'
|
|
2
3
|
|
|
3
|
-
import { canMakeBooleanSourceNode } from '#core/canvas/boolean'
|
|
4
|
-
import { flattenNodesToVectorProps } from '#core/canvas/flatten'
|
|
4
|
+
import { canContainFlattenableChildren, canMakeBooleanSourceNode } from '#core/canvas/boolean'
|
|
5
|
+
import { flattenLayerToVectorProps, flattenNodesToVectorProps } from '#core/canvas/flatten'
|
|
5
6
|
import { restoreSubtree, snapshotSubtree } from '#core/editor/history/subtree'
|
|
6
7
|
import type { EditorContext } from '#core/editor/types'
|
|
7
8
|
|
|
@@ -24,25 +25,31 @@ export function flattenSelected(
|
|
|
24
25
|
const canFlattenNode =
|
|
25
26
|
options.canFlattenNode ?? ((node: SceneNode) => canMakeBooleanSourceNode(node, ctx.graph))
|
|
26
27
|
const vectorPropsFactory = options.vectorPropsFactory ?? flattenNodesToVectorProps
|
|
27
|
-
const renderer = ctx.getRenderer()
|
|
28
|
-
if (!renderer) return null
|
|
29
28
|
|
|
30
29
|
const selection = selectedNodesInSharedParent(ctx, selectedNodes)
|
|
31
30
|
if (!selection) return null
|
|
32
31
|
const { topLevel, parentId, parent } = selection
|
|
33
32
|
if (topLevel.some((node) => !canFlattenNode(node))) return null
|
|
34
|
-
|
|
35
33
|
const childIds = topLevel.map((node) => node.id)
|
|
34
|
+
assertGroupPlacement(ctx.graph, parentId, childIds, 'flatten')
|
|
35
|
+
const renderer = ctx.getRenderer()
|
|
36
|
+
if (!renderer) return null
|
|
36
37
|
const childSnapshots = childIds.map((id) => ({ id, subtree: snapshotSubtree(ctx.graph, id) }))
|
|
37
38
|
const prevSelection = new Set(ctx.state.selectedIds)
|
|
38
39
|
const firstIndex = Math.min(...childIds.map((id) => parent.childIds.indexOf(id)))
|
|
39
|
-
|
|
40
|
+
// One layer keeps its own appearance, as Figma's Flatten does; several become one silhouette
|
|
41
|
+
// painted with the topmost layer's fills, and a container keeps giving its children's shapes.
|
|
42
|
+
const vectorProps =
|
|
43
|
+
!options.vectorPropsFactory &&
|
|
44
|
+
topLevel.length === 1 &&
|
|
45
|
+
!canContainFlattenableChildren(topLevel[0])
|
|
46
|
+
? flattenLayerToVectorProps(renderer, ctx.graph, topLevel[0])
|
|
47
|
+
: vectorPropsFactory(renderer, ctx.graph, topLevel)
|
|
40
48
|
if (!vectorProps) return null
|
|
41
49
|
|
|
42
50
|
const vector = ctx.graph.createNode('VECTOR', parentId, {
|
|
43
51
|
...vectorProps,
|
|
44
|
-
name: label
|
|
45
|
-
strokes: []
|
|
52
|
+
name: label
|
|
46
53
|
})
|
|
47
54
|
const vectorSnapshot = structuredClone(vector)
|
|
48
55
|
ctx.graph.insertChildAt(vector.id, parentId, firstIndex)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
2
|
+
import { assertChildPlacement } from '@pairdraw/scene-graph/slots'
|
|
2
3
|
|
|
3
4
|
import type { EditorContext } from '#core/editor/types'
|
|
4
5
|
|
|
@@ -11,6 +12,7 @@ export function ungroupNode(graph: SceneGraph, nodeId: string): string[] | null
|
|
|
11
12
|
const node = graph.getNode(nodeId)
|
|
12
13
|
const parent = node?.parentId ? graph.getNode(node.parentId) : undefined
|
|
13
14
|
if (!node || !parent) return null
|
|
15
|
+
assertChildPlacement(graph, parent.id, 'ungroup')
|
|
14
16
|
const index = parent.childIds.indexOf(node.id)
|
|
15
17
|
const childIds = [...node.childIds]
|
|
16
18
|
childIds.forEach((id, i) => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SceneNode } from '@pairdraw/scene-graph'
|
|
2
|
+
import { assertChildPlacement, assertNodeMovable } from '@pairdraw/scene-graph/slots'
|
|
2
3
|
|
|
3
4
|
import {
|
|
4
5
|
layersToOutline,
|
|
@@ -58,6 +59,10 @@ export function outlineStrokeSelected(
|
|
|
58
59
|
const plan: Outlining[] = []
|
|
59
60
|
for (const node of layersToOutline(selectedNodes, ctx.graph)) {
|
|
60
61
|
const parent = node.parentId ? ctx.graph.getNode(node.parentId) : undefined
|
|
62
|
+
if (parent) {
|
|
63
|
+
assertChildPlacement(ctx.graph, parent.id, 'Outline stroke')
|
|
64
|
+
assertNodeMovable(ctx.graph, node.id, 'Outline stroke')
|
|
65
|
+
}
|
|
61
66
|
const outlined = parent ? outlineStrokeLayer(renderer, node, ctx.graph) : null
|
|
62
67
|
if (!parent || !outlined) continue
|
|
63
68
|
plan.push({
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { isNil } from 'es-toolkit'
|
|
2
|
+
|
|
3
|
+
import type { SceneNode, SharedStyleKind, SharedStyleType } from '@pairdraw/scene-graph'
|
|
4
|
+
import { hasInstanceOverride } from '@pairdraw/scene-graph/instances'
|
|
5
|
+
import {
|
|
6
|
+
SHARED_STYLE_FIELDS,
|
|
7
|
+
sharedStyleLayers,
|
|
8
|
+
sharedStyleRefKey,
|
|
9
|
+
sharedStyleTypeForKind
|
|
10
|
+
} from '@pairdraw/scene-graph/shared-styles'
|
|
11
|
+
|
|
12
|
+
import { styleNodeProps, styleNodeType } from '#core/io/formats/design-tokens/apply'
|
|
13
|
+
|
|
14
|
+
import type { NodeActions } from './nodes'
|
|
15
|
+
import type { EditorContext } from './types'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A new style node, which redo makes again with the same ids so layers stay attached. The one
|
|
19
|
+
* creator the token import and the style picker share.
|
|
20
|
+
*/
|
|
21
|
+
export function createStyleNode(
|
|
22
|
+
ctx: EditorContext,
|
|
23
|
+
type: SharedStyleType,
|
|
24
|
+
fields: Partial<SceneNode>
|
|
25
|
+
): SceneNode {
|
|
26
|
+
const node = ctx.graph.createNode(
|
|
27
|
+
styleNodeType({ kind: type }),
|
|
28
|
+
ctx.state.currentPageId,
|
|
29
|
+
styleNodeProps({ kind: type }, fields)
|
|
30
|
+
)
|
|
31
|
+
node.source.id = crypto.randomUUID()
|
|
32
|
+
const snapshot = structuredClone(node)
|
|
33
|
+
const parentId = node.parentId
|
|
34
|
+
ctx.undo.push({
|
|
35
|
+
label: 'Add style',
|
|
36
|
+
forward: () => {
|
|
37
|
+
ctx.graph.createNodeWithId(snapshot.id, snapshot.type, parentId, structuredClone(snapshot))
|
|
38
|
+
ctx.requestRender()
|
|
39
|
+
},
|
|
40
|
+
inverse: () => {
|
|
41
|
+
ctx.graph.deleteNode(snapshot.id)
|
|
42
|
+
ctx.requestRender()
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
return node
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const GRID_KINDS = new Set(['FRAME', 'COMPONENT', 'COMPONENT_SET', 'INSTANCE'])
|
|
49
|
+
|
|
50
|
+
/** Whether a layer can carry this kind of style at all, as the picker's own fields say. */
|
|
51
|
+
export function supportsStyleKind(node: SceneNode, kind: SharedStyleKind): boolean {
|
|
52
|
+
if (node.type === 'CANVAS') return false
|
|
53
|
+
if (kind === 'text') return node.type === 'TEXT'
|
|
54
|
+
if (kind === 'grid') return GRID_KINDS.has(node.type)
|
|
55
|
+
return true
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Whether the layer shows something of this kind, such as a fill or an effect to save. */
|
|
59
|
+
function carriesStyleKind(node: SceneNode, kind: SharedStyleKind): boolean {
|
|
60
|
+
return SHARED_STYLE_FIELDS[kind].some((field) => {
|
|
61
|
+
const value = node[field]
|
|
62
|
+
return Array.isArray(value) ? value.length > 0 : !isNil(value)
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** The layer a created style takes its fields from: the first selected one that shows the kind. */
|
|
67
|
+
function styleSource(layers: readonly SceneNode[], kind: SharedStyleKind): SceneNode | undefined {
|
|
68
|
+
return layers.find((layer) => supportsStyleKind(layer, kind) && carriesStyleKind(layer, kind))
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Turns what the selected layers show into one shared style and binds every layer that supports
|
|
73
|
+
* it, as one undo step. The style takes the first layer that shows the kind, so binding changes
|
|
74
|
+
* nothing the person can see; a name may carry `/` groups. Without such a layer nothing is made,
|
|
75
|
+
* as Figma hides creation without paints.
|
|
76
|
+
*/
|
|
77
|
+
function createStyleFromSelection(
|
|
78
|
+
ctx: EditorContext,
|
|
79
|
+
nodes: NodeActions,
|
|
80
|
+
kind: SharedStyleKind,
|
|
81
|
+
name: string
|
|
82
|
+
): SceneNode | null {
|
|
83
|
+
const layers = [...ctx.state.selectedIds]
|
|
84
|
+
.map((id) => ctx.graph.getNode(id))
|
|
85
|
+
.filter((node): node is SceneNode => node !== undefined)
|
|
86
|
+
const first = styleSource(layers, kind)
|
|
87
|
+
if (!first) return null
|
|
88
|
+
|
|
89
|
+
const fields: Partial<SceneNode> = {}
|
|
90
|
+
for (const key of SHARED_STYLE_FIELDS[kind]) {
|
|
91
|
+
Object.assign(fields, { [key]: structuredClone(first[key]) })
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return ctx.undo.runBatch('Create style', () => {
|
|
95
|
+
const style = createStyleNode(ctx, sharedStyleTypeForKind(kind), {
|
|
96
|
+
...fields,
|
|
97
|
+
name: name.trim() || first.name
|
|
98
|
+
})
|
|
99
|
+
const styleId = style.source.id
|
|
100
|
+
const refKey = sharedStyleRefKey(kind)
|
|
101
|
+
for (const layer of layers) {
|
|
102
|
+
if (!supportsStyleKind(layer, kind)) continue
|
|
103
|
+
nodes.updateNodeWithUndo(layer.id, { [refKey]: styleId }, `Apply ${kind} style`)
|
|
104
|
+
}
|
|
105
|
+
ctx.requestRender()
|
|
106
|
+
return style
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Makes shared styles from what a layer shows, as the style picker asks. */
|
|
111
|
+
export function createStyleActions(ctx: EditorContext, nodes: NodeActions) {
|
|
112
|
+
return {
|
|
113
|
+
createStyleFromSelection: (kind: SharedStyleKind, name: string) =>
|
|
114
|
+
createStyleFromSelection(ctx, nodes, kind, name),
|
|
115
|
+
/** Whether the selection holds something to save for this kind, so the picker can offer it. */
|
|
116
|
+
updateSharedStyle: (
|
|
117
|
+
styleId: string,
|
|
118
|
+
kind: SharedStyleKind,
|
|
119
|
+
changes: SharedStyleDefinitionChanges
|
|
120
|
+
) => updateSharedStyle(ctx, nodes, styleId, kind, changes),
|
|
121
|
+
canCreateStyle: (kind: SharedStyleKind) => {
|
|
122
|
+
const layers = [...ctx.state.selectedIds]
|
|
123
|
+
.map((id) => ctx.graph.getNode(id))
|
|
124
|
+
.filter((node): node is SceneNode => node !== undefined)
|
|
125
|
+
return styleSource(layers, kind) !== undefined
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** The fields an edit of a shared definition writes for its kind. */
|
|
131
|
+
export type SharedStyleDefinitionChanges = Partial<
|
|
132
|
+
Pick<
|
|
133
|
+
SceneNode,
|
|
134
|
+
| 'name'
|
|
135
|
+
| 'symbolDescription'
|
|
136
|
+
| 'fills'
|
|
137
|
+
| 'strokes'
|
|
138
|
+
| 'effects'
|
|
139
|
+
| 'layoutGrids'
|
|
140
|
+
| 'fontFamily'
|
|
141
|
+
| 'fontWeight'
|
|
142
|
+
| 'italic'
|
|
143
|
+
| 'fontStyle'
|
|
144
|
+
| 'fontSize'
|
|
145
|
+
| 'lineHeight'
|
|
146
|
+
| 'letterSpacing'
|
|
147
|
+
| 'textDecoration'
|
|
148
|
+
| 'textCase'
|
|
149
|
+
| 'fontFeatures'
|
|
150
|
+
| 'paragraphSpacing'
|
|
151
|
+
| 'paragraphIndent'
|
|
152
|
+
| 'listSpacing'
|
|
153
|
+
>
|
|
154
|
+
>
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Writes a shared style's definition and re-applies its fields to every layer linked to that style,
|
|
158
|
+
* as one undo step. A layer's own name and description never follow the style. A layer that detached
|
|
159
|
+
* (its reference cleared) is not touched. An instance field the person overrode keeps its value, as
|
|
160
|
+
* in Figma; the other fields still follow.
|
|
161
|
+
*/
|
|
162
|
+
function updateSharedStyle(
|
|
163
|
+
ctx: EditorContext,
|
|
164
|
+
nodes: NodeActions,
|
|
165
|
+
styleId: string,
|
|
166
|
+
kind: SharedStyleKind,
|
|
167
|
+
changes: SharedStyleDefinitionChanges
|
|
168
|
+
): { styleId: string; layerIds: string[] } | null {
|
|
169
|
+
const style = [...sharedStyleLayers(ctx.graph).values()].find(
|
|
170
|
+
(node) => node.source.id === styleId && node.sharedStyleType === sharedStyleTypeForKind(kind)
|
|
171
|
+
)
|
|
172
|
+
if (!style) return null
|
|
173
|
+
|
|
174
|
+
const fields = SHARED_STYLE_FIELDS[kind]
|
|
175
|
+
const patch: Partial<SceneNode> = {}
|
|
176
|
+
for (const field of fields) {
|
|
177
|
+
if (field in changes) Object.assign(patch, { [field]: structuredClone(changes[field]) })
|
|
178
|
+
}
|
|
179
|
+
if (changes.name !== undefined) patch.name = changes.name.trim() || style.name
|
|
180
|
+
if (changes.symbolDescription !== undefined) patch.symbolDescription = changes.symbolDescription
|
|
181
|
+
|
|
182
|
+
const reference = sharedStyleRefKey(kind)
|
|
183
|
+
const linked = [...ctx.graph.getAllNodes()].filter(
|
|
184
|
+
(node) => node.id !== style.id && node[reference] === styleId
|
|
185
|
+
)
|
|
186
|
+
ctx.undo.runBatch('Edit style', () => {
|
|
187
|
+
for (const layer of linked) {
|
|
188
|
+
// Naming the same reference keeps the node action from treating a definition reapply as a
|
|
189
|
+
// local paint edit.
|
|
190
|
+
const layerPatch: Partial<SceneNode> = { [reference]: styleId }
|
|
191
|
+
for (const field of fields) {
|
|
192
|
+
if (!(field in patch) || hasInstanceOverride(ctx.graph, layer.id, field)) continue
|
|
193
|
+
Object.assign(layerPatch, { [field]: structuredClone(patch[field]) })
|
|
194
|
+
}
|
|
195
|
+
// A rename or description edit changes no linked layer.
|
|
196
|
+
if (Object.keys(layerPatch).length === 1) continue
|
|
197
|
+
nodes.updateNodeWithUndo(layer.id, layerPatch, 'Update style layer')
|
|
198
|
+
}
|
|
199
|
+
nodes.updateNodeWithUndo(style.id, patch, 'Edit style')
|
|
200
|
+
})
|
|
201
|
+
ctx.requestRender()
|
|
202
|
+
return { styleId, layerIds: linked.map((node) => node.id) }
|
|
203
|
+
}
|
|
@@ -7,6 +7,7 @@ import type { EditorContext } from '#core/editor/types'
|
|
|
7
7
|
import {
|
|
8
8
|
characterStyles,
|
|
9
9
|
layerTextStyleChanges,
|
|
10
|
+
mixedTextStyleKeys,
|
|
10
11
|
shownTextStyle,
|
|
11
12
|
styleRunsWithPatch,
|
|
12
13
|
TEXT_STYLE_KEYS,
|
|
@@ -133,5 +134,21 @@ export function createTextSelectionStyle(
|
|
|
133
134
|
return layerTextStyleChanges(node, changes)
|
|
134
135
|
}
|
|
135
136
|
|
|
136
|
-
|
|
137
|
+
/** Whether the characters the panel would edit differ in this style, so the row shows Mixed. */
|
|
138
|
+
function isTextStyleMixed(id: string, key: string): boolean {
|
|
139
|
+
const node = ctx.graph.getNode(id)
|
|
140
|
+
if (!node) return false
|
|
141
|
+
const range = selectedRange(id)
|
|
142
|
+
const keys = range ? mixedTextStyleKeys(node, range[0], range[1]) : mixedTextStyleKeys(node)
|
|
143
|
+
return (keys as readonly string[]).includes(key)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return {
|
|
147
|
+
updateNode,
|
|
148
|
+
updateNodeWithUndo,
|
|
149
|
+
commitNodeUpdate,
|
|
150
|
+
selectionStyle,
|
|
151
|
+
layerChanges,
|
|
152
|
+
isTextStyleMixed
|
|
153
|
+
}
|
|
137
154
|
}
|
|
@@ -18,6 +18,7 @@ export const EDITOR_TOOLS: EditorToolDef[] = [
|
|
|
18
18
|
flyout: ['RECTANGLE', 'LINE', 'ELLIPSE', 'POLYGON', 'STAR']
|
|
19
19
|
},
|
|
20
20
|
{ key: 'PEN', label: 'Pen', shortcut: 'P', flyout: ['PEN', 'PENCIL'] },
|
|
21
|
+
{ key: 'SLICE', label: 'Slice', shortcut: 'S' },
|
|
21
22
|
{ key: 'TEXT', label: 'Text', shortcut: 'T' },
|
|
22
23
|
// Figma's S is Slice, and FigJam's sticky tool has no key in Figma Design.
|
|
23
24
|
{ key: 'STICKY', label: 'Sticky note', shortcut: '' },
|
|
@@ -36,6 +37,7 @@ export const TOOL_SHORTCUTS: Partial<Record<string, Tool>> = {
|
|
|
36
37
|
KeyA: 'FRAME',
|
|
37
38
|
'Shift+KeyS': 'SECTION',
|
|
38
39
|
KeyR: 'RECTANGLE',
|
|
40
|
+
KeyS: 'SLICE',
|
|
39
41
|
KeyO: 'ELLIPSE',
|
|
40
42
|
KeyL: 'LINE',
|
|
41
43
|
KeyT: 'TEXT',
|
package/src/editor/types.ts
CHANGED
|
@@ -40,6 +40,7 @@ export type Tool =
|
|
|
40
40
|
| 'SELECT'
|
|
41
41
|
| 'FRAME'
|
|
42
42
|
| 'SECTION'
|
|
43
|
+
| 'SLICE'
|
|
43
44
|
| 'RECTANGLE'
|
|
44
45
|
| 'ELLIPSE'
|
|
45
46
|
| 'LINE'
|
|
@@ -103,6 +104,10 @@ export interface EditorSharedState {
|
|
|
103
104
|
snappingPreferences: SnappingPreferences
|
|
104
105
|
/** Draw the pixel grid once zoomed in far enough, as Figma's View › Pixel grid; shown unless false. */
|
|
105
106
|
showPixelGrid?: boolean
|
|
107
|
+
/** Figma's View › Layout grids; false hides every layout grid while it is off. */
|
|
108
|
+
showLayoutGrids?: boolean
|
|
109
|
+
/** Figma's View › Annotations. */
|
|
110
|
+
showAnnotations?: boolean
|
|
106
111
|
/** The gradient being edited, whose handles the canvas draws and drags. */
|
|
107
112
|
gradientEdit?: GradientEdit | null
|
|
108
113
|
/** The image fill whose crop and framing the canvas edits, in place of the selection handles. */
|
|
@@ -194,6 +199,8 @@ export interface EditorViewState {
|
|
|
194
199
|
index?: number
|
|
195
200
|
side?: 'top' | 'right' | 'bottom' | 'left'
|
|
196
201
|
} | null
|
|
202
|
+
/** The flow layer a panel spacing control is showing the padding and gap bands of. */
|
|
203
|
+
layoutSpacingNodeId: string | null
|
|
197
204
|
shapeHandleHover: ShapeHandleHover | null
|
|
198
205
|
/** The layer a connector end being drawn or dragged would attach to, and by which magnet. */
|
|
199
206
|
connectorTarget: ConnectorTarget | null
|
|
@@ -229,6 +236,12 @@ export interface ClipboardImageResolution {
|
|
|
229
236
|
fetchAttempted: boolean
|
|
230
237
|
}
|
|
231
238
|
|
|
239
|
+
/** The pattern fills a paste received whose source layer is not in the document. */
|
|
240
|
+
export interface ClipboardPatternSources {
|
|
241
|
+
total: number
|
|
242
|
+
missing: number
|
|
243
|
+
}
|
|
244
|
+
|
|
232
245
|
export type FigmaClipboardImageResolver = (
|
|
233
246
|
fileKey: string,
|
|
234
247
|
hashes: string[]
|
|
@@ -251,6 +264,7 @@ export interface EditorEvents extends SceneGraphEvents {
|
|
|
251
264
|
'page:leaving': (pageId: string, nextPageId: string) => void
|
|
252
265
|
'guides:changed': (ownerId: string, guides: readonly CanvasGuide[]) => void
|
|
253
266
|
'clipboard:images-missing': (resolution: ClipboardImageResolution) => void
|
|
267
|
+
'clipboard:pattern-sources-missing': (resolution: ClipboardPatternSources) => void
|
|
254
268
|
/** Turning a main component back into a frame was asked for; the front end confirms it. */
|
|
255
269
|
'component:to-frame-requested': (componentId: string) => void
|
|
256
270
|
/** A text link to a web or mail address was followed; the front end opens it outside. */
|
|
@@ -3,8 +3,10 @@ import { copyFills, copyStrokes } from '@pairdraw/scene-graph/copy'
|
|
|
3
3
|
import { findInstanceAncestor, recordInstanceOverride } from '@pairdraw/scene-graph/instances'
|
|
4
4
|
import { cloneInstanceOverrideState } from '@pairdraw/scene-graph/instances/overrides'
|
|
5
5
|
import {
|
|
6
|
+
effectBindingTarget,
|
|
6
7
|
variableBindingOwner,
|
|
7
8
|
isNumericVariableBindingField,
|
|
9
|
+
layoutGridBindingTarget,
|
|
8
10
|
paintBindingTarget
|
|
9
11
|
} from '@pairdraw/scene-graph/variables'
|
|
10
12
|
|
|
@@ -51,6 +53,14 @@ export function createVariableBindingActions(ctx: EditorContext) {
|
|
|
51
53
|
target && targetPaint
|
|
52
54
|
? { ...target, color: { ...targetPaint.color }, opacity: targetPaint.opacity }
|
|
53
55
|
: null
|
|
56
|
+
// An effect or grid field lives in a list, so undoing has to put that list back, as a paint's
|
|
57
|
+
// colour does.
|
|
58
|
+
let listField: 'effects' | 'layoutGrids' | null = null
|
|
59
|
+
if (effectBindingTarget(path)) listField = 'effects'
|
|
60
|
+
else if (layoutGridBindingTarget(path)) listField = 'layoutGrids'
|
|
61
|
+
const previousList = listField
|
|
62
|
+
? structuredClone(listField === 'effects' ? node.effects : node.layoutGrids)
|
|
63
|
+
: null
|
|
54
64
|
const owner = variableBindingOwner(ctx.graph, node)
|
|
55
65
|
const nearest = findInstanceAncestor(ctx.graph, nodeId)
|
|
56
66
|
const owners = new Map(
|
|
@@ -100,6 +110,7 @@ export function createVariableBindingActions(ctx: EditorContext) {
|
|
|
100
110
|
Object.assign(paints[index], { color: { ...color }, opacity })
|
|
101
111
|
Object.assign(restored, { [list]: paints })
|
|
102
112
|
}
|
|
113
|
+
if (listField && previousList) Object.assign(restored, { [listField]: previousList })
|
|
103
114
|
ctx.graph.updateNode(nodeId, restored)
|
|
104
115
|
refreshBindings(nodeId)
|
|
105
116
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
1
|
+
import type { AnnotationPropertyName, SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
2
2
|
import { getAxisAlignedWorldBounds, getWorldMatrix } from '@pairdraw/scene-graph/coordinate'
|
|
3
3
|
import { TRANSFORM_FIELDS as NODE_TRANSFORM_FIELDS } from '@pairdraw/scene-graph/fields'
|
|
4
4
|
import { findInstanceAncestor, recordInstanceOverride } from '@pairdraw/scene-graph/instances'
|
|
@@ -17,6 +17,13 @@ import { rescaleNodeTree } from '@pairdraw/scene-graph/scaling'
|
|
|
17
17
|
import { slotPropertyId } from '@pairdraw/scene-graph/slots'
|
|
18
18
|
|
|
19
19
|
import { assertNodeEditable } from '#core/editor/capabilities'
|
|
20
|
+
|
|
21
|
+
interface AnnotationRead {
|
|
22
|
+
label?: string
|
|
23
|
+
labelMarkdown?: string
|
|
24
|
+
properties?: readonly { type: AnnotationPropertyName }[]
|
|
25
|
+
categoryId?: string
|
|
26
|
+
}
|
|
20
27
|
import { namedByText } from '#core/editor/text/name'
|
|
21
28
|
import {
|
|
22
29
|
prepareFollowedFieldEdit,
|
|
@@ -102,6 +109,31 @@ export function installBasicNodeProxyAccessors(
|
|
|
102
109
|
internals: NodeProxyInternals
|
|
103
110
|
): void {
|
|
104
111
|
Object.defineProperties(prototype, {
|
|
112
|
+
annotations: {
|
|
113
|
+
get(this: ProxyThis) {
|
|
114
|
+
return raw(this, internals).annotations.map((annotation) => {
|
|
115
|
+
const read: AnnotationRead = {
|
|
116
|
+
properties: annotation.properties.map((type) => ({ type }))
|
|
117
|
+
}
|
|
118
|
+
if (annotation.label) read.label = annotation.label
|
|
119
|
+
if (annotation.labelMarkdown) read.labelMarkdown = annotation.labelMarkdown
|
|
120
|
+
if (annotation.categoryId) read.categoryId = annotation.categoryId
|
|
121
|
+
return read
|
|
122
|
+
})
|
|
123
|
+
},
|
|
124
|
+
set(this: ProxyThis, value: readonly AnnotationRead[]) {
|
|
125
|
+
updateNode(this, internals, {
|
|
126
|
+
annotations: value.map((annotation) => ({
|
|
127
|
+
label: annotation.label ?? '',
|
|
128
|
+
labelMarkdown: annotation.labelMarkdown ?? annotation.label ?? '',
|
|
129
|
+
properties: (annotation.properties ?? []).map((property) => property.type),
|
|
130
|
+
categoryId: annotation.categoryId ?? null
|
|
131
|
+
}))
|
|
132
|
+
})
|
|
133
|
+
},
|
|
134
|
+
enumerable: true,
|
|
135
|
+
configurable: true
|
|
136
|
+
},
|
|
105
137
|
id: {
|
|
106
138
|
get(this: ProxyThis): string {
|
|
107
139
|
return nodeId(this, internals)
|
|
@@ -10,7 +10,6 @@ import { parsePluginVectorPath } from '@pairdraw/scene-graph/parse-path'
|
|
|
10
10
|
import {
|
|
11
11
|
mergeVectorNetworks,
|
|
12
12
|
normalizeVectorNetwork,
|
|
13
|
-
transformVectorNetwork,
|
|
14
13
|
validateVectorNetwork,
|
|
15
14
|
vectorNetworkPaths
|
|
16
15
|
} from '@pairdraw/scene-graph/vector-network'
|
|
@@ -25,8 +24,8 @@ import {
|
|
|
25
24
|
} from '#core/figma-api/accessor-utils'
|
|
26
25
|
import { parseFigmaPaints, toFigmaPaint, type FigmaPaint } from '#core/figma-api/paints'
|
|
27
26
|
import { geometryBlobToSVGPath } from '#core/io/formats/svg/paths'
|
|
28
|
-
import { computeAccurateBounds } from '#core/vector/curve-math'
|
|
29
27
|
import { regenerateFillGeometry } from '#core/vector/fill-geometry'
|
|
28
|
+
import { rebaseVectorNetwork } from '#core/vector/rebase'
|
|
30
29
|
|
|
31
30
|
export interface FigmaVectorPath {
|
|
32
31
|
readonly windingRule: WindingRule | 'NONE'
|
|
@@ -127,22 +126,16 @@ function setGeometry(
|
|
|
127
126
|
fillGeometry: GeometryPath[]
|
|
128
127
|
): void {
|
|
129
128
|
const node = raw(target, internals)
|
|
130
|
-
const
|
|
131
|
-
const hasGeometry = network.vertices.length > 0
|
|
132
|
-
const normalized = hasGeometry
|
|
133
|
-
? transformVectorNetwork([1, 0, -bounds.x, 0, 1, -bounds.y, 0, 0, 1], network)
|
|
134
|
-
: structuredClone(EMPTY_NETWORK)
|
|
129
|
+
const rebased = rebaseVectorNetwork(network, structuredClone(EMPTY_NETWORK))
|
|
135
130
|
const normalizedGeometry =
|
|
136
131
|
fillGeometry.length > 0
|
|
137
|
-
? regenerateFillGeometry(
|
|
132
|
+
? regenerateFillGeometry(rebased.vectorNetwork, fillGeometry, node.cornerRadius)
|
|
138
133
|
: []
|
|
139
134
|
|
|
140
135
|
updateNode(target, internals, {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
height: hasGeometry ? bounds.height : 0,
|
|
145
|
-
vectorNetwork: normalized,
|
|
136
|
+
...rebased,
|
|
137
|
+
x: node.x + rebased.x,
|
|
138
|
+
y: node.y + rebased.y,
|
|
146
139
|
fillGeometry: normalizedGeometry,
|
|
147
140
|
strokeGeometry: []
|
|
148
141
|
})
|