@pairdraw/core 0.19.1 → 0.20.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/ai/providers.d.ts +6 -0
- package/dist/ai/providers.d.ts.map +1 -1
- package/dist/ai/providers.js.map +1 -1
- package/dist/cache/resource.d.ts +8 -1
- package/dist/cache/resource.d.ts.map +1 -1
- package/dist/cache/resource.js +18 -0
- package/dist/cache/resource.js.map +1 -1
- package/dist/canvas/effects.d.ts +6 -4
- package/dist/canvas/effects.d.ts.map +1 -1
- package/dist/canvas/effects.js +37 -34
- package/dist/canvas/effects.js.map +1 -1
- package/dist/canvas/fills.d.ts.map +1 -1
- package/dist/canvas/fills.js +12 -8
- package/dist/canvas/fills.js.map +1 -1
- package/dist/canvas/images/adjustments.d.ts +18 -0
- package/dist/canvas/images/adjustments.d.ts.map +1 -0
- package/dist/canvas/images/adjustments.js +184 -0
- package/dist/canvas/images/adjustments.js.map +1 -0
- package/dist/canvas/images/previews.d.ts +1 -1
- package/dist/canvas/images/sampling.d.ts +13 -0
- package/dist/canvas/images/sampling.d.ts.map +1 -0
- package/dist/canvas/images/sampling.js +49 -0
- package/dist/canvas/images/sampling.js.map +1 -0
- package/dist/canvas/index.d.ts +2 -2
- package/dist/canvas/masks.d.ts +1 -1
- package/dist/canvas/masks.d.ts.map +1 -1
- package/dist/canvas/masks.js.map +1 -1
- package/dist/canvas/noise/render.d.ts +15 -0
- package/dist/canvas/noise/render.d.ts.map +1 -0
- package/dist/canvas/noise/render.js +56 -0
- package/dist/canvas/noise/render.js.map +1 -0
- package/dist/canvas/noise/shader.d.ts +43 -0
- package/dist/canvas/noise/shader.d.ts.map +1 -0
- package/dist/canvas/noise/shader.js +161 -0
- package/dist/canvas/noise/shader.js.map +1 -0
- package/dist/canvas/noise/table.d.ts +13 -0
- package/dist/canvas/noise/table.d.ts.map +1 -0
- package/dist/canvas/noise/table.js +408 -0
- package/dist/canvas/noise/table.js.map +1 -0
- package/dist/canvas/noise/tile.d.ts +22 -0
- package/dist/canvas/noise/tile.d.ts.map +1 -0
- package/dist/canvas/noise/tile.js +73 -0
- package/dist/canvas/noise/tile.js.map +1 -0
- package/dist/canvas/outline-stroke.js +1 -1
- package/dist/canvas/overlays/auto-layout-hover.d.ts.map +1 -1
- package/dist/canvas/overlays/auto-layout-hover.js +31 -71
- package/dist/canvas/overlays/auto-layout-hover.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/selection.d.ts +1 -2
- package/dist/canvas/overlays/selection.d.ts.map +1 -1
- package/dist/canvas/overlays/selection.js +2 -9
- package/dist/canvas/overlays/selection.js.map +1 -1
- package/dist/canvas/renderer/chunks/index.d.ts +1 -1
- package/dist/canvas/renderer/fonts.d.ts.map +1 -1
- package/dist/canvas/renderer/fonts.js +2 -0
- package/dist/canvas/renderer/fonts.js.map +1 -1
- package/dist/canvas/renderer/lifecycle.d.ts.map +1 -1
- package/dist/canvas/renderer/lifecycle.js +6 -0
- package/dist/canvas/renderer/lifecycle.js.map +1 -1
- package/dist/canvas/renderer/methods.d.ts +0 -1
- package/dist/canvas/renderer/methods.d.ts.map +1 -1
- package/dist/canvas/renderer/methods.js +1 -4
- package/dist/canvas/renderer/methods.js.map +1 -1
- package/dist/canvas/renderer/overlay-pass.d.ts.map +1 -1
- package/dist/canvas/renderer/overlay-pass.js +0 -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 +13 -2
- package/dist/canvas/renderer/pipeline.js.map +1 -1
- package/dist/canvas/renderer/play-scenes.d.ts +13 -0
- package/dist/canvas/renderer/play-scenes.d.ts.map +1 -0
- package/dist/canvas/renderer/play-scenes.js +40 -0
- package/dist/canvas/renderer/play-scenes.js.map +1 -0
- package/dist/canvas/renderer/tiles/cache.d.ts +19 -1
- package/dist/canvas/renderer/tiles/cache.d.ts.map +1 -1
- package/dist/canvas/renderer/tiles/cache.js +32 -1
- package/dist/canvas/renderer/tiles/cache.js.map +1 -1
- package/dist/canvas/renderer/tiles/controller.d.ts +11 -0
- package/dist/canvas/renderer/tiles/controller.d.ts.map +1 -1
- package/dist/canvas/renderer/tiles/controller.js +18 -1
- package/dist/canvas/renderer/tiles/controller.js.map +1 -1
- package/dist/canvas/renderer/tiles/index.d.ts +2 -2
- package/dist/canvas/renderer/tiles/planner.d.ts +1 -1
- package/dist/canvas/renderer/types.d.ts +18 -4
- package/dist/canvas/renderer/types.d.ts.map +1 -1
- package/dist/canvas/renderer/visual-bounds.d.ts +1 -1
- package/dist/canvas/renderer/visual-bounds.js +1 -1
- package/dist/canvas/renderer.d.ts +22 -3
- package/dist/canvas/renderer.d.ts.map +1 -1
- package/dist/canvas/renderer.js +29 -1
- package/dist/canvas/renderer.js.map +1 -1
- package/dist/canvas/scene.d.ts +2 -1
- package/dist/canvas/scene.d.ts.map +1 -1
- package/dist/canvas/scene.js +41 -9
- package/dist/canvas/scene.js.map +1 -1
- package/dist/canvas/shadows/silhouette.js +1 -1
- package/dist/canvas/texture.d.ts +20 -0
- package/dist/canvas/texture.d.ts.map +1 -0
- package/dist/canvas/texture.js +100 -0
- package/dist/canvas/texture.js.map +1 -0
- package/dist/clipboard.js +16 -5
- package/dist/clipboard.js.map +1 -1
- package/dist/constants.d.ts +5 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +5 -1
- package/dist/constants.js.map +1 -1
- package/dist/design-jsx/index.d.ts +2 -2
- package/dist/design-jsx/index.js +2 -2
- package/dist/design-jsx/renderer.d.ts +3 -2
- package/dist/design-jsx/renderer.d.ts.map +1 -1
- package/dist/design-jsx/renderer.js +2 -2
- package/dist/design-jsx/renderer.js.map +1 -1
- package/dist/design-memory/check.d.ts +90 -0
- package/dist/design-memory/check.d.ts.map +1 -0
- package/dist/design-memory/check.js +281 -0
- package/dist/design-memory/check.js.map +1 -0
- package/dist/design-memory/describe.d.ts +37 -0
- package/dist/design-memory/describe.d.ts.map +1 -0
- package/dist/design-memory/describe.js +52 -0
- package/dist/design-memory/describe.js.map +1 -0
- package/dist/design-memory/distil.d.ts +22 -0
- package/dist/design-memory/distil.d.ts.map +1 -0
- package/dist/design-memory/distil.js +54 -0
- package/dist/design-memory/distil.js.map +1 -0
- package/dist/design-memory/document.d.ts +12 -0
- package/dist/design-memory/document.d.ts.map +1 -0
- package/dist/design-memory/document.js +64 -0
- package/dist/design-memory/document.js.map +1 -0
- package/dist/design-memory/guard.d.ts +48 -0
- package/dist/design-memory/guard.d.ts.map +1 -0
- package/dist/design-memory/guard.js +105 -0
- package/dist/design-memory/guard.js.map +1 -0
- package/dist/design-memory/index.d.ts +9 -0
- package/dist/design-memory/index.js +9 -0
- package/dist/design-memory/refusal.d.ts +32 -0
- package/dist/design-memory/refusal.d.ts.map +1 -0
- package/dist/design-memory/refusal.js +68 -0
- package/dist/design-memory/refusal.js.map +1 -0
- package/dist/design-memory/rules.d.ts +63 -0
- package/dist/design-memory/rules.d.ts.map +1 -0
- package/dist/design-memory/rules.js +224 -0
- package/dist/design-memory/rules.js.map +1 -0
- package/dist/design-memory/values.d.ts +28 -0
- package/dist/design-memory/values.d.ts.map +1 -0
- package/dist/design-memory/values.js +160 -0
- package/dist/design-memory/values.js.map +1 -0
- package/dist/editor/alignment.js +1 -1
- package/dist/editor/bridges/components.d.ts +2 -0
- package/dist/editor/bridges/components.d.ts.map +1 -1
- package/dist/editor/bridges/components.js +2 -0
- package/dist/editor/bridges/components.js.map +1 -1
- package/dist/editor/bridges/undo.d.ts +1 -1
- package/dist/editor/clipboard/assets.js +1 -1
- package/dist/editor/clipboard/export.d.ts.map +1 -1
- package/dist/editor/clipboard/export.js +16 -2
- package/dist/editor/clipboard/export.js.map +1 -1
- package/dist/editor/clipboard/placement.d.ts +1 -1
- package/dist/editor/clipboard/placement.js +1 -1
- package/dist/editor/clipboard/snapshot.d.ts.map +1 -1
- package/dist/editor/clipboard/snapshot.js +12 -4
- package/dist/editor/clipboard/snapshot.js.map +1 -1
- package/dist/editor/clipboard.d.ts.map +1 -1
- package/dist/editor/clipboard.js +2 -7
- package/dist/editor/clipboard.js.map +1 -1
- package/dist/editor/color-space.d.ts.map +1 -1
- package/dist/editor/color-space.js +33 -38
- package/dist/editor/color-space.js.map +1 -1
- package/dist/editor/components/instances.d.ts +2 -0
- package/dist/editor/components/instances.d.ts.map +1 -1
- package/dist/editor/components/instances.js +22 -1
- package/dist/editor/components/instances.js.map +1 -1
- package/dist/editor/components.d.ts +2 -0
- package/dist/editor/components.d.ts.map +1 -1
- package/dist/editor/connectors/attach.js +1 -1
- package/dist/editor/create.d.ts +36 -8
- package/dist/editor/create.d.ts.map +1 -1
- package/dist/editor/create.js +26 -61
- package/dist/editor/create.js.map +1 -1
- package/dist/editor/design-memory.d.ts +11 -0
- package/dist/editor/design-memory.d.ts.map +1 -0
- package/dist/editor/design-memory.js +40 -0
- package/dist/editor/design-memory.js.map +1 -0
- package/dist/editor/design-tokens.d.ts +4 -0
- package/dist/editor/design-tokens.d.ts.map +1 -1
- package/dist/editor/design-tokens.js +30 -1
- package/dist/editor/design-tokens.js.map +1 -1
- package/dist/editor/document-colors.d.ts +23 -0
- package/dist/editor/document-colors.d.ts.map +1 -0
- package/dist/editor/document-colors.js +53 -0
- package/dist/editor/document-colors.js.map +1 -0
- package/dist/editor/eyedropper.d.ts +47 -0
- package/dist/editor/eyedropper.d.ts.map +1 -0
- package/dist/editor/eyedropper.js +168 -0
- package/dist/editor/eyedropper.js.map +1 -0
- package/dist/editor/fonts.d.ts +9 -0
- package/dist/editor/fonts.d.ts.map +1 -0
- package/dist/editor/fonts.js +14 -0
- package/dist/editor/fonts.js.map +1 -0
- package/dist/editor/history/atomic-tool.d.ts +9 -2
- package/dist/editor/history/atomic-tool.d.ts.map +1 -1
- package/dist/editor/history/atomic-tool.js +6 -0
- package/dist/editor/history/atomic-tool.js.map +1 -1
- package/dist/editor/history/capture.d.ts +13 -0
- package/dist/editor/history/capture.d.ts.map +1 -0
- package/dist/editor/history/capture.js +28 -0
- package/dist/editor/history/capture.js.map +1 -0
- package/dist/editor/history/document-change.d.ts.map +1 -1
- package/dist/editor/history/document-change.js +2 -22
- package/dist/editor/history/document-change.js.map +1 -1
- package/dist/editor/history/edit.d.ts +7 -0
- package/dist/editor/history/edit.d.ts.map +1 -1
- package/dist/editor/history/edit.js +6 -3
- package/dist/editor/history/edit.js.map +1 -1
- package/dist/editor/history/subtree.d.ts +9 -0
- package/dist/editor/history/subtree.d.ts.map +1 -1
- package/dist/editor/history/subtree.js +12 -2
- package/dist/editor/history/subtree.js.map +1 -1
- package/dist/editor/index.d.ts +4 -2
- package/dist/editor/index.js +4 -2
- package/dist/editor/nudge.js +1 -1
- package/dist/editor/nudge.js.map +1 -1
- package/dist/editor/pages.d.ts +7 -5
- package/dist/editor/pages.d.ts.map +1 -1
- package/dist/editor/pages.js +35 -25
- package/dist/editor/pages.js.map +1 -1
- package/dist/editor/play/states.d.ts +3 -1
- package/dist/editor/play/states.d.ts.map +1 -1
- package/dist/editor/play/states.js +1 -1
- package/dist/editor/play/states.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/render-requests.d.ts +18 -0
- package/dist/editor/render-requests.d.ts.map +1 -0
- package/dist/editor/render-requests.js +76 -0
- package/dist/editor/render-requests.js.map +1 -0
- package/dist/editor/scale/rescale.d.ts +1 -1
- package/dist/editor/selection/container.d.ts +2 -0
- package/dist/editor/selection/container.d.ts.map +1 -1
- package/dist/editor/selection/container.js +17 -1
- package/dist/editor/selection/container.js.map +1 -1
- package/dist/editor/selection/navigation.js +7 -4
- package/dist/editor/selection/navigation.js.map +1 -1
- package/dist/editor/selection/overlays.d.ts.map +1 -1
- package/dist/editor/selection/overlays.js +1 -1
- package/dist/editor/selection/overlays.js.map +1 -1
- package/dist/editor/selection/read.d.ts +6 -2
- package/dist/editor/selection.d.ts +9 -2
- package/dist/editor/selection.d.ts.map +1 -1
- package/dist/editor/shapes/with-text.d.ts.map +1 -1
- package/dist/editor/shapes/with-text.js +2 -5
- package/dist/editor/shapes/with-text.js.map +1 -1
- package/dist/editor/structure/auto-layout-wrap.js +1 -1
- package/dist/editor/structure/auto-layout-wrap.js.map +1 -1
- package/dist/editor/structure/boolean.d.ts +2 -3
- package/dist/editor/structure/boolean.d.ts.map +1 -1
- package/dist/editor/structure/boolean.js.map +1 -1
- package/dist/editor/structure/group/bounds.d.ts.map +1 -1
- package/dist/editor/structure/group/bounds.js +1 -3
- package/dist/editor/structure/group/bounds.js.map +1 -1
- package/dist/editor/structure/outline-stroke.js +3 -3
- package/dist/editor/structure/outline-stroke.js.map +1 -1
- package/dist/editor/structure/reorder.d.ts.map +1 -1
- package/dist/editor/structure/reorder.js +7 -14
- package/dist/editor/structure/reorder.js.map +1 -1
- package/dist/editor/structure/state.js +1 -1
- package/dist/editor/structure/state.js.map +1 -1
- package/dist/editor/structure.d.ts +1 -2
- package/dist/editor/structure.d.ts.map +1 -1
- package/dist/editor/structure.js +3 -3
- package/dist/editor/structure.js.map +1 -1
- package/dist/editor/tool-registry.d.ts.map +1 -1
- package/dist/editor/tool-registry.js +2 -1
- package/dist/editor/tool-registry.js.map +1 -1
- package/dist/editor/types.d.ts +9 -2
- package/dist/editor/types.d.ts.map +1 -1
- package/dist/editor/variables.d.ts.map +1 -1
- package/dist/editor/variables.js +57 -1
- package/dist/editor/variables.js.map +1 -1
- package/dist/editor/variations/create.d.ts +28 -0
- package/dist/editor/variations/create.d.ts.map +1 -0
- package/dist/editor/variations/create.js +176 -0
- package/dist/editor/variations/create.js.map +1 -0
- package/dist/editor/variations/pick.d.ts +16 -0
- package/dist/editor/variations/pick.d.ts.map +1 -0
- package/dist/editor/variations/pick.js +23 -0
- package/dist/editor/variations/pick.js.map +1 -0
- package/dist/editor/variations.d.ts +28 -0
- package/dist/editor/variations.d.ts.map +1 -0
- package/dist/editor/variations.js +88 -0
- package/dist/editor/variations.js.map +1 -0
- package/dist/figma-api/accessors/reactions.d.ts.map +1 -1
- package/dist/figma-api/accessors/reactions.js +4 -1
- package/dist/figma-api/accessors/reactions.js.map +1 -1
- package/dist/figma-api/accessors/text/index.d.ts.map +1 -1
- package/dist/figma-api/accessors/text/index.js +7 -1
- package/dist/figma-api/accessors/text/index.js.map +1 -1
- package/dist/figma-api/accessors/text/opentype.d.ts +17 -0
- package/dist/figma-api/accessors/text/opentype.d.ts.map +1 -0
- package/dist/figma-api/accessors/text/opentype.js +28 -0
- package/dist/figma-api/accessors/text/opentype.js.map +1 -0
- package/dist/figma-api/accessors/visual.d.ts.map +1 -1
- package/dist/figma-api/accessors/visual.js +33 -0
- package/dist/figma-api/accessors/visual.js.map +1 -1
- package/dist/figma-api/effects.d.ts +79 -3
- package/dist/figma-api/effects.d.ts.map +1 -1
- package/dist/figma-api/effects.js +150 -9
- package/dist/figma-api/effects.js.map +1 -1
- package/dist/figma-api/fonts/loaded.d.ts +3 -1
- package/dist/figma-api/fonts/loaded.d.ts.map +1 -1
- package/dist/figma-api/fonts/loaded.js +8 -1
- package/dist/figma-api/fonts/loaded.js.map +1 -1
- package/dist/figma-api/index.d.ts +18 -0
- package/dist/figma-api/index.d.ts.map +1 -1
- package/dist/figma-api/index.js +19 -1
- package/dist/figma-api/index.js.map +1 -1
- package/dist/figma-api/overrides.d.ts +13 -1
- package/dist/figma-api/overrides.d.ts.map +1 -1
- package/dist/figma-api/overrides.js +196 -4
- package/dist/figma-api/overrides.js.map +1 -1
- package/dist/figma-api/paints.d.ts +3 -3
- package/dist/figma-api/paints.d.ts.map +1 -1
- package/dist/figma-api/paints.js +14 -4
- package/dist/figma-api/paints.js.map +1 -1
- package/dist/figma-api/proxy.d.ts +4 -1
- package/dist/figma-api/proxy.d.ts.map +1 -1
- package/dist/figma-api/proxy.js +1 -1
- package/dist/figma-api/proxy.js.map +1 -1
- package/dist/figma-api/reactions.d.ts +41 -13
- package/dist/figma-api/reactions.d.ts.map +1 -1
- package/dist/figma-api/reactions.js +113 -31
- package/dist/figma-api/reactions.js.map +1 -1
- package/dist/figma-api/render-bounds.js +1 -1
- package/dist/figma-api/serialization.d.ts.map +1 -1
- package/dist/figma-api/serialization.js +2 -1
- package/dist/figma-api/serialization.js.map +1 -1
- package/dist/figma-api/shape-details.d.ts +26 -0
- package/dist/figma-api/shape-details.d.ts.map +1 -0
- package/dist/figma-api/shape-details.js +28 -0
- package/dist/figma-api/shape-details.js.map +1 -0
- package/dist/figma-api/shape-with-text.js +2 -5
- package/dist/figma-api/shape-with-text.js.map +1 -1
- package/dist/figma-api/surface.d.ts +7 -4
- package/dist/figma-api/surface.d.ts.map +1 -1
- package/dist/figma-api/surface.js +7 -2
- package/dist/figma-api/surface.js.map +1 -1
- package/dist/figma-api/transform.d.ts +1 -1
- package/dist/geometry/figma.d.ts +1 -1
- package/dist/geometry/image-crop.d.ts +1 -1
- package/dist/geometry/image-crop.js +1 -1
- package/dist/icons/svg.js +1 -1
- package/dist/icons/svg.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/io/formats/boolean-path.d.ts +19 -0
- package/dist/io/formats/boolean-path.d.ts.map +1 -0
- package/dist/io/formats/boolean-path.js +47 -0
- package/dist/io/formats/boolean-path.js.map +1 -0
- package/dist/io/formats/design-tokens/decode.js +1 -1
- package/dist/io/formats/design-tokens/index.d.ts +4 -1
- package/dist/io/formats/design-tokens/index.js +4 -1
- package/dist/io/formats/design-tokens/plan/changes.d.ts +5 -3
- package/dist/io/formats/design-tokens/plan/changes.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/plan/changes.js +1 -1
- package/dist/io/formats/design-tokens/plan/changes.js.map +1 -1
- package/dist/io/formats/design-tokens/project.d.ts +17 -2
- package/dist/io/formats/design-tokens/project.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/project.js +29 -8
- package/dist/io/formats/design-tokens/project.js.map +1 -1
- package/dist/io/formats/design-tokens/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/styles.js.map +1 -1
- package/dist/io/formats/design-tokens/sync/apply.d.ts +42 -0
- package/dist/io/formats/design-tokens/sync/apply.d.ts.map +1 -0
- package/dist/io/formats/design-tokens/sync/apply.js +73 -0
- package/dist/io/formats/design-tokens/sync/apply.js.map +1 -0
- package/dist/io/formats/design-tokens/sync/drift.d.ts +77 -0
- package/dist/io/formats/design-tokens/sync/drift.d.ts.map +1 -0
- package/dist/io/formats/design-tokens/sync/drift.js +391 -0
- package/dist/io/formats/design-tokens/sync/drift.js.map +1 -0
- package/dist/io/formats/design-tokens/sync/files.d.ts +15 -0
- package/dist/io/formats/design-tokens/sync/files.d.ts.map +1 -0
- package/dist/io/formats/design-tokens/sync/files.js +35 -0
- package/dist/io/formats/design-tokens/sync/files.js.map +1 -0
- package/dist/io/formats/drawio/edges.d.ts +7 -1
- package/dist/io/formats/drawio/edges.d.ts.map +1 -1
- package/dist/io/formats/drawio/edges.js +54 -1
- package/dist/io/formats/drawio/edges.js.map +1 -1
- package/dist/io/formats/drawio/export.d.ts.map +1 -1
- package/dist/io/formats/drawio/export.js +19 -2
- package/dist/io/formats/drawio/export.js.map +1 -1
- package/dist/io/formats/drawio/index.d.ts.map +1 -1
- package/dist/io/formats/drawio/index.js +2 -1
- package/dist/io/formats/drawio/index.js.map +1 -1
- package/dist/io/formats/drawio/label.js +1 -1
- package/dist/io/formats/drawio/paint.js +1 -1
- package/dist/io/formats/drawio/placement.d.ts +1 -1
- package/dist/io/formats/fig/export/patch/index.d.ts.map +1 -1
- package/dist/io/formats/fig/export/patch/index.js +5 -0
- package/dist/io/formats/fig/export/patch/index.js.map +1 -1
- package/dist/io/formats/fig/thumbnail-page.d.ts +3 -4
- package/dist/io/formats/fig/thumbnail-page.d.ts.map +1 -1
- package/dist/io/formats/fig/thumbnail-page.js.map +1 -1
- package/dist/io/formats/html/import.d.ts.map +1 -1
- package/dist/io/formats/html/import.js +3 -1
- package/dist/io/formats/html/import.js.map +1 -1
- package/dist/io/formats/html/index.d.ts +2 -2
- package/dist/io/formats/html/index.d.ts.map +1 -1
- package/dist/io/formats/html/index.js +6 -4
- package/dist/io/formats/html/index.js.map +1 -1
- package/dist/io/formats/html/layers.d.ts +7 -4
- package/dist/io/formats/html/layers.d.ts.map +1 -1
- package/dist/io/formats/html/layers.js +4 -1
- package/dist/io/formats/html/layers.js.map +1 -1
- package/dist/io/formats/html/vectors.d.ts +2 -1
- package/dist/io/formats/html/vectors.d.ts.map +1 -1
- package/dist/io/formats/html/vectors.js +3 -2
- package/dist/io/formats/html/vectors.js.map +1 -1
- package/dist/io/formats/mermaid/styles.js +1 -1
- package/dist/io/formats/pdf/document.d.ts +3 -1
- package/dist/io/formats/pdf/document.d.ts.map +1 -1
- package/dist/io/formats/pdf/document.js +6 -3
- package/dist/io/formats/pdf/document.js.map +1 -1
- package/dist/io/formats/pdf/dom.d.ts +6 -1
- package/dist/io/formats/pdf/dom.d.ts.map +1 -1
- package/dist/io/formats/pdf/dom.js +9 -22
- package/dist/io/formats/pdf/dom.js.map +1 -1
- package/dist/io/formats/pdf/export.js +1 -1
- package/dist/io/formats/pdf/export.js.map +1 -1
- package/dist/io/formats/pdf/prepare.d.ts +1 -1
- package/dist/io/formats/pen/imports.d.ts +4 -1
- package/dist/io/formats/pen/imports.d.ts.map +1 -1
- package/dist/io/formats/pen/imports.js.map +1 -1
- package/dist/io/formats/pen/index.d.ts.map +1 -1
- package/dist/io/formats/pen/index.js +31 -3
- package/dist/io/formats/pen/index.js.map +1 -1
- package/dist/io/formats/pptx/export.js +1 -1
- package/dist/io/formats/pptx/geometry.d.ts +1 -1
- package/dist/io/formats/raster/adjusted-images.d.ts +15 -0
- package/dist/io/formats/raster/adjusted-images.d.ts.map +1 -0
- package/dist/io/formats/raster/adjusted-images.js +118 -0
- package/dist/io/formats/raster/adjusted-images.js.map +1 -0
- package/dist/io/formats/raster/headless.d.ts +11 -1
- package/dist/io/formats/raster/headless.d.ts.map +1 -1
- package/dist/io/formats/raster/headless.js +4 -4
- 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/pixels.d.ts +7 -1
- package/dist/io/formats/raster/pixels.d.ts.map +1 -1
- package/dist/io/formats/raster/pixels.js.map +1 -1
- package/dist/io/formats/raster/render.d.ts.map +1 -1
- package/dist/io/formats/raster/render.js +4 -0
- package/dist/io/formats/raster/render.js.map +1 -1
- package/dist/io/formats/svg/defs.d.ts +5 -6
- package/dist/io/formats/svg/defs.d.ts.map +1 -1
- package/dist/io/formats/svg/defs.js +4 -54
- package/dist/io/formats/svg/defs.js.map +1 -1
- package/dist/io/formats/svg/effects.d.ts +16 -0
- package/dist/io/formats/svg/effects.d.ts.map +1 -0
- package/dist/io/formats/svg/effects.js +126 -0
- package/dist/io/formats/svg/effects.js.map +1 -0
- package/dist/io/formats/svg/export.d.ts +7 -1
- package/dist/io/formats/svg/export.d.ts.map +1 -1
- package/dist/io/formats/svg/export.js +224 -50
- package/dist/io/formats/svg/export.js.map +1 -1
- package/dist/io/formats/svg/filter.d.ts +27 -0
- package/dist/io/formats/svg/filter.d.ts.map +1 -0
- package/dist/io/formats/svg/filter.js +44 -0
- package/dist/io/formats/svg/filter.js.map +1 -0
- package/dist/io/formats/svg/grain.d.ts +26 -0
- package/dist/io/formats/svg/grain.d.ts.map +1 -0
- package/dist/io/formats/svg/grain.js +298 -0
- package/dist/io/formats/svg/grain.js.map +1 -0
- package/dist/io/formats/svg/strokes.d.ts +1 -1
- package/dist/io/formats/svg/strokes.d.ts.map +1 -1
- package/dist/io/formats/svg/strokes.js +1 -2
- package/dist/io/formats/svg/strokes.js.map +1 -1
- package/dist/io/formats/svg/text/import.js +1 -1
- package/dist/io/formats/svg/text/layout.d.ts +5 -2
- package/dist/io/formats/svg/text/layout.d.ts.map +1 -1
- package/dist/io/formats/svg/text/layout.js +6 -3
- package/dist/io/formats/svg/text/layout.js.map +1 -1
- package/dist/io/formats/video/composite.d.ts +18 -0
- package/dist/io/formats/video/composite.d.ts.map +1 -0
- package/dist/io/formats/video/composite.js +79 -0
- package/dist/io/formats/video/composite.js.map +1 -0
- package/dist/io/formats/video/formats.d.ts +29 -0
- package/dist/io/formats/video/formats.d.ts.map +1 -0
- package/dist/io/formats/video/formats.js +43 -0
- package/dist/io/formats/video/formats.js.map +1 -0
- package/dist/io/formats/video/gif.d.ts +13 -0
- package/dist/io/formats/video/gif.d.ts.map +1 -0
- package/dist/io/formats/video/gif.js +56 -0
- package/dist/io/formats/video/gif.js.map +1 -0
- package/dist/io/formats/video/index.d.ts +9 -0
- package/dist/io/formats/video/index.js +9 -0
- package/dist/io/formats/video/plan.d.ts +64 -0
- package/dist/io/formats/video/plan.d.ts.map +1 -0
- package/dist/io/formats/video/plan.js +90 -0
- package/dist/io/formats/video/plan.js.map +1 -0
- package/dist/io/formats/video/record.d.ts +36 -0
- package/dist/io/formats/video/record.d.ts.map +1 -0
- package/dist/io/formats/video/record.js +154 -0
- package/dist/io/formats/video/record.js.map +1 -0
- package/dist/io/formats/video/sink.d.ts +29 -0
- package/dist/io/formats/video/sink.d.ts.map +1 -0
- package/dist/io/formats/video/sink.js +16 -0
- package/dist/io/formats/video/sink.js.map +1 -0
- package/dist/io/formats/video/size.d.ts +19 -0
- package/dist/io/formats/video/size.d.ts.map +1 -0
- package/dist/io/formats/video/size.js +26 -0
- package/dist/io/formats/video/size.js.map +1 -0
- package/dist/io/formats/video/webcodecs.d.ts +18 -0
- package/dist/io/formats/video/webcodecs.d.ts.map +1 -0
- package/dist/io/formats/video/webcodecs.js +74 -0
- package/dist/io/formats/video/webcodecs.js.map +1 -0
- package/dist/io/formats.d.ts.map +1 -1
- package/dist/io/formats.js +40 -11
- package/dist/io/formats.js.map +1 -1
- package/dist/io/types.d.ts +19 -4
- package/dist/io/types.d.ts.map +1 -1
- package/dist/kiwi/fig/parse/transfer.d.ts +1 -1
- package/dist/layout/apply.d.ts.map +1 -1
- package/dist/layout/apply.js +50 -12
- package/dist/layout/apply.js.map +1 -1
- package/dist/layout/auto-layout-handles.d.ts +66 -0
- package/dist/layout/auto-layout-handles.d.ts.map +1 -0
- package/dist/layout/auto-layout-handles.js +291 -0
- package/dist/layout/auto-layout-handles.js.map +1 -0
- package/dist/layout/derived.d.ts +7 -1
- package/dist/layout/derived.d.ts.map +1 -1
- package/dist/layout/derived.js +11 -1
- package/dist/layout/derived.js.map +1 -1
- package/dist/layout/grid.d.ts +7 -2
- package/dist/layout/grid.d.ts.map +1 -1
- package/dist/layout/grid.js +27 -9
- package/dist/layout/grid.js.map +1 -1
- package/dist/layout/mutations.d.ts +1 -0
- package/dist/layout/mutations.d.ts.map +1 -1
- package/dist/layout/mutations.js +10 -0
- package/dist/layout/mutations.js.map +1 -1
- package/dist/layout/strokes.d.ts +9 -1
- package/dist/layout/strokes.d.ts.map +1 -1
- package/dist/layout/strokes.js +12 -1
- package/dist/layout/strokes.js.map +1 -1
- package/dist/layout/yoga-helpers.d.ts +3 -1
- package/dist/layout/yoga-helpers.d.ts.map +1 -1
- package/dist/layout/yoga-helpers.js +16 -2
- package/dist/layout/yoga-helpers.js.map +1 -1
- package/dist/layout.d.ts +3 -2
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +73 -39
- package/dist/layout.js.map +1 -1
- package/dist/lint/fixes.d.ts.map +1 -1
- package/dist/lint/fixes.js +9 -3
- package/dist/lint/fixes.js.map +1 -1
- package/dist/lint/index.d.ts +3 -2
- package/dist/lint/index.js +2 -1
- package/dist/lint/linter.d.ts +13 -0
- package/dist/lint/linter.d.ts.map +1 -1
- package/dist/lint/linter.js +123 -9
- package/dist/lint/linter.js.map +1 -1
- package/dist/lint/presets.d.ts.map +1 -1
- package/dist/lint/presets.js +2 -0
- package/dist/lint/presets.js.map +1 -1
- package/dist/lint/rules/design-memory.d.ts +15 -0
- package/dist/lint/rules/design-memory.d.ts.map +1 -0
- package/dist/lint/rules/design-memory.js +90 -0
- package/dist/lint/rules/design-memory.js.map +1 -0
- package/dist/lint/rules/effect-style-required.js +1 -0
- package/dist/lint/rules/effect-style-required.js.map +1 -1
- package/dist/lint/rules/index.d.ts +6 -5
- package/dist/lint/rules/index.d.ts.map +1 -1
- package/dist/lint/rules/index.js +6 -2
- package/dist/lint/rules/index.js.map +1 -1
- package/dist/lint/rules/no-unbound-token-values.d.ts +6 -0
- package/dist/lint/rules/no-unbound-token-values.d.ts.map +1 -0
- package/dist/lint/rules/no-unbound-token-values.js +79 -0
- package/dist/lint/rules/no-unbound-token-values.js.map +1 -0
- package/dist/lint/rules/text-style-required.js +1 -0
- package/dist/lint/rules/text-style-required.js.map +1 -1
- package/dist/lint/types.d.ts +32 -2
- package/dist/lint/types.d.ts.map +1 -1
- package/dist/node/video.d.ts +12 -0
- package/dist/node/video.d.ts.map +1 -0
- package/dist/node/video.js +206 -0
- package/dist/node/video.js.map +1 -0
- package/dist/pairdraw-api/design-memory.d.ts +19 -0
- package/dist/pairdraw-api/design-memory.d.ts.map +1 -0
- package/dist/pairdraw-api/design-memory.js +39 -0
- package/dist/pairdraw-api/design-memory.js.map +1 -0
- package/dist/pairdraw-api/index.d.ts +45 -1
- package/dist/pairdraw-api/index.d.ts.map +1 -1
- package/dist/pairdraw-api/index.js +55 -2
- package/dist/pairdraw-api/index.js.map +1 -1
- package/dist/pairdraw-api/nodes.d.ts +12 -1
- package/dist/pairdraw-api/nodes.d.ts.map +1 -1
- package/dist/pairdraw-api/nodes.js +28 -1
- package/dist/pairdraw-api/nodes.js.map +1 -1
- package/dist/pairdraw-api/variations.d.ts +48 -0
- package/dist/pairdraw-api/variations.d.ts.map +1 -0
- package/dist/pairdraw-api/variations.js +76 -0
- package/dist/pairdraw-api/variations.js.map +1 -0
- package/dist/prototype/easing.d.ts +13 -0
- package/dist/prototype/easing.d.ts.map +1 -0
- package/dist/prototype/easing.js +36 -0
- package/dist/prototype/easing.js.map +1 -0
- package/dist/prototype/frames.d.ts +10 -0
- package/dist/prototype/frames.d.ts.map +1 -0
- package/dist/prototype/frames.js +12 -0
- package/dist/prototype/frames.js.map +1 -0
- package/dist/prototype/hit.d.ts +17 -0
- package/dist/prototype/hit.d.ts.map +1 -0
- package/dist/prototype/hit.js +45 -0
- package/dist/prototype/hit.js.map +1 -0
- package/dist/prototype/index.d.ts +14 -0
- package/dist/prototype/index.js +14 -0
- package/dist/prototype/pointer.d.ts +63 -0
- package/dist/prototype/pointer.d.ts.map +1 -0
- package/dist/prototype/pointer.js +104 -0
- package/dist/prototype/pointer.js.map +1 -0
- package/dist/prototype/reactions.d.ts +45 -0
- package/dist/prototype/reactions.d.ts.map +1 -0
- package/dist/prototype/reactions.js +122 -0
- package/dist/prototype/reactions.js.map +1 -0
- package/dist/prototype/scene.d.ts +35 -0
- package/dist/prototype/scene.d.ts.map +1 -0
- package/dist/prototype/scene.js +86 -0
- package/dist/prototype/scene.js.map +1 -0
- package/dist/prototype/scenes.d.ts +81 -0
- package/dist/prototype/scenes.d.ts.map +1 -0
- package/dist/prototype/scenes.js +175 -0
- package/dist/prototype/scenes.js.map +1 -0
- package/dist/prototype/scroll.d.ts +48 -0
- package/dist/prototype/scroll.d.ts.map +1 -0
- package/dist/prototype/scroll.js +159 -0
- package/dist/prototype/scroll.js.map +1 -0
- package/dist/prototype/session.d.ts +71 -0
- package/dist/prototype/session.d.ts.map +1 -0
- package/dist/prototype/session.js +135 -0
- package/dist/prototype/session.js.map +1 -0
- package/dist/prototype/smart-animate/animation.d.ts +34 -0
- package/dist/prototype/smart-animate/animation.d.ts.map +1 -0
- package/dist/prototype/smart-animate/animation.js +212 -0
- package/dist/prototype/smart-animate/animation.js.map +1 -0
- package/dist/prototype/smart-animate/match.d.ts +24 -0
- package/dist/prototype/smart-animate/match.d.ts.map +1 -0
- package/dist/prototype/smart-animate/match.js +72 -0
- package/dist/prototype/smart-animate/match.js.map +1 -0
- package/dist/prototype/snapshot.d.ts +19 -0
- package/dist/prototype/snapshot.d.ts.map +1 -0
- package/dist/prototype/snapshot.js +56 -0
- package/dist/prototype/snapshot.js.map +1 -0
- package/dist/prototype/timeline.d.ts +132 -0
- package/dist/prototype/timeline.d.ts.map +1 -0
- package/dist/prototype/timeline.js +260 -0
- package/dist/prototype/timeline.js.map +1 -0
- package/dist/rpc/commands.d.ts +2 -2
- package/dist/rpc/index.d.ts +2 -2
- package/dist/rpc/read-commands.d.ts +18 -8
- package/dist/rpc/read-commands.d.ts.map +1 -1
- package/dist/rpc/read-commands.js +18 -9
- package/dist/rpc/read-commands.js.map +1 -1
- package/dist/text/font/faces.d.ts +12 -1
- package/dist/text/font/faces.d.ts.map +1 -1
- package/dist/text/font/faces.js +15 -1
- package/dist/text/font/faces.js.map +1 -1
- package/dist/text/font/features.d.ts +9 -0
- package/dist/text/font/features.d.ts.map +1 -0
- package/dist/text/font/features.js +27 -0
- package/dist/text/font/features.js.map +1 -0
- package/dist/text/font/manager.d.ts +12 -0
- package/dist/text/font/manager.d.ts.map +1 -1
- package/dist/text/font/manager.js +66 -12
- package/dist/text/font/manager.js.map +1 -1
- package/dist/text/index.d.ts +11 -9
- package/dist/text/index.js +4 -2
- package/dist/text/replace-fonts.d.ts +41 -0
- package/dist/text/replace-fonts.d.ts.map +1 -0
- package/dist/text/replace-fonts.js +121 -0
- package/dist/text/replace-fonts.js.map +1 -0
- package/dist/tools/analyze/responsive/index.d.ts +15 -0
- package/dist/tools/analyze/responsive/index.d.ts.map +1 -0
- package/dist/tools/analyze/responsive/index.js +203 -0
- package/dist/tools/analyze/responsive/index.js.map +1 -0
- package/dist/tools/analyze.d.ts +2 -1
- package/dist/tools/analyze.js +2 -1
- package/dist/tools/codegen/token-sync.d.ts +7 -0
- package/dist/tools/codegen/token-sync.d.ts.map +1 -0
- package/dist/tools/codegen/token-sync.js +85 -0
- package/dist/tools/codegen/token-sync.js.map +1 -0
- package/dist/tools/codegen/tokens.d.ts +1 -1
- package/dist/tools/codegen.d.ts +2 -1
- package/dist/tools/codegen.js +2 -1
- package/dist/tools/create/basic.js +1 -1
- package/dist/tools/create/behaviours.js +1 -1
- package/dist/tools/create/components.d.ts.map +1 -1
- package/dist/tools/create/components.js +4 -0
- package/dist/tools/create/components.js.map +1 -1
- package/dist/tools/create/html.js +3 -2
- package/dist/tools/create/html.js.map +1 -1
- package/dist/tools/create/icons.d.ts.map +1 -1
- package/dist/tools/create/icons.js +2 -1
- package/dist/tools/create/icons.js.map +1 -1
- package/dist/tools/create/mermaid.js +2 -1
- package/dist/tools/create/mermaid.js.map +1 -1
- package/dist/tools/create/render.js +1 -1
- package/dist/tools/create/svg.js +2 -1
- package/dist/tools/create/svg.js.map +1 -1
- package/dist/tools/create/vector.js +1 -1
- package/dist/tools/design-memory.d.ts +8 -0
- package/dist/tools/design-memory.d.ts.map +1 -0
- package/dist/tools/design-memory.js +68 -0
- package/dist/tools/design-memory.js.map +1 -0
- package/dist/tools/image-ai/generate.d.ts.map +1 -1
- package/dist/tools/image-ai/generate.js +3 -1
- package/dist/tools/image-ai/generate.js.map +1 -1
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.js +2 -1
- package/dist/tools/modify/fonts.d.ts +6 -0
- package/dist/tools/modify/fonts.d.ts.map +1 -0
- package/dist/tools/modify/fonts.js +27 -0
- package/dist/tools/modify/fonts.js.map +1 -0
- package/dist/tools/modify/layout.d.ts.map +1 -1
- package/dist/tools/modify/layout.js +1 -0
- package/dist/tools/modify/layout.js.map +1 -1
- package/dist/tools/modify/paint.js +1 -1
- package/dist/tools/modify/reactions.d.ts.map +1 -1
- package/dist/tools/modify/reactions.js +3 -3
- package/dist/tools/modify/reactions.js.map +1 -1
- package/dist/tools/modify/text.d.ts.map +1 -1
- package/dist/tools/modify/text.js +26 -5
- package/dist/tools/modify/text.js.map +1 -1
- package/dist/tools/modify/update.d.ts +10 -1
- package/dist/tools/modify/update.d.ts.map +1 -1
- package/dist/tools/modify/update.js +34 -3
- package/dist/tools/modify/update.js.map +1 -1
- package/dist/tools/modify.d.ts +2 -1
- package/dist/tools/modify.js +2 -1
- package/dist/tools/read/fonts.d.ts.map +1 -1
- package/dist/tools/read/fonts.js +17 -2
- package/dist/tools/read/fonts.js.map +1 -1
- package/dist/tools/read/libraries.js +2 -1
- package/dist/tools/read/libraries.js.map +1 -1
- package/dist/tools/read/nodes.d.ts.map +1 -1
- package/dist/tools/read/nodes.js.map +1 -1
- package/dist/tools/read/space.d.ts +3 -1
- package/dist/tools/read/space.d.ts.map +1 -1
- package/dist/tools/read/space.js +4 -3
- package/dist/tools/read/space.js.map +1 -1
- package/dist/tools/registry/core.d.ts +1 -1
- package/dist/tools/registry/core.d.ts.map +1 -1
- package/dist/tools/registry/core.js +3 -1
- package/dist/tools/registry/core.js.map +1 -1
- package/dist/tools/registry/extended.d.ts.map +1 -1
- package/dist/tools/registry/extended.js +16 -1
- package/dist/tools/registry/extended.js.map +1 -1
- package/dist/tools/schema.d.ts +18 -2
- package/dist/tools/schema.d.ts.map +1 -1
- package/dist/tools/schema.js +1 -1
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/stock-photo.js +1 -0
- package/dist/tools/stock-photo.js.map +1 -1
- package/dist/tools/structure/basic.d.ts.map +1 -1
- package/dist/tools/structure/basic.js +1 -0
- package/dist/tools/structure/basic.js.map +1 -1
- package/dist/tools/structure/batch.d.ts.map +1 -1
- package/dist/tools/structure/batch.js +22 -1
- package/dist/tools/structure/batch.js.map +1 -1
- package/dist/tools/structure/hierarchy.d.ts.map +1 -1
- package/dist/tools/structure/hierarchy.js +4 -0
- package/dist/tools/structure/hierarchy.js.map +1 -1
- package/dist/tools/structure/variations.d.ts +8 -0
- package/dist/tools/structure/variations.d.ts.map +1 -0
- package/dist/tools/structure/variations.js +106 -0
- package/dist/tools/structure/variations.js.map +1 -0
- package/dist/tools/structure.d.ts +2 -1
- package/dist/tools/structure.js +2 -1
- package/dist/tools/styles/types.d.ts +2 -4
- package/dist/tools/styles/types.d.ts.map +1 -1
- package/dist/tools/styles/types.js.map +1 -1
- package/dist/tools/vector/boolean.d.ts.map +1 -1
- package/dist/tools/vector/boolean.js +4 -0
- package/dist/tools/vector/boolean.js.map +1 -1
- package/dist/tools/vector/path.d.ts.map +1 -1
- package/dist/tools/vector/path.js +39 -7
- package/dist/tools/vector/path.js.map +1 -1
- package/dist/tools/vector/vectorize.js +1 -0
- package/dist/tools/vector/vectorize.js.map +1 -1
- package/dist/tools/vector/video.d.ts +6 -0
- package/dist/tools/vector/video.d.ts.map +1 -0
- package/dist/tools/vector/video.js +133 -0
- package/dist/tools/vector/video.js.map +1 -0
- package/dist/tools/vector.d.ts +2 -1
- package/dist/tools/vector.js +2 -1
- package/dist/tools/video-host.d.ts +12 -0
- package/dist/tools/video-host.d.ts.map +1 -0
- package/dist/tools/video-host.js +19 -0
- package/dist/tools/video-host.js.map +1 -0
- package/dist/vector/point-transform.d.ts +1 -1
- package/dist/vector/vectorize/svg/to-vectors.d.ts +1 -1
- package/dist/xpath.d.ts +3 -0
- package/dist/xpath.d.ts.map +1 -1
- package/dist/xpath.js +3 -1
- package/dist/xpath.js.map +1 -1
- package/package.json +31 -9
- package/src/ai/providers.ts +2 -0
- package/src/cache/resource.ts +24 -1
- package/src/canvas/effects.ts +47 -50
- package/src/canvas/fills.ts +19 -15
- package/src/canvas/images/adjustments.ts +203 -0
- package/src/canvas/images/sampling.ts +88 -0
- package/src/canvas/index.ts +1 -0
- package/src/canvas/masks.ts +1 -1
- package/src/canvas/noise/render.ts +75 -0
- package/src/canvas/noise/shader.ts +161 -0
- package/src/canvas/noise/table.ts +91 -0
- package/src/canvas/noise/tile.ts +94 -0
- package/src/canvas/overlays/auto-layout-hover.ts +47 -65
- package/src/canvas/overlays/index.ts +0 -1
- package/src/canvas/overlays/selection.ts +1 -12
- package/src/canvas/renderer/fonts.ts +2 -0
- package/src/canvas/renderer/lifecycle.ts +6 -0
- package/src/canvas/renderer/methods.ts +0 -9
- package/src/canvas/renderer/overlay-pass.ts +0 -1
- package/src/canvas/renderer/pipeline.ts +19 -2
- package/src/canvas/renderer/play-scenes.ts +51 -0
- package/src/canvas/renderer/tiles/cache.ts +54 -1
- package/src/canvas/renderer/tiles/controller.ts +30 -1
- package/src/canvas/renderer/types.ts +18 -3
- package/src/canvas/renderer.ts +40 -4
- package/src/canvas/scene.ts +65 -9
- package/src/canvas/texture.ts +136 -0
- package/src/clipboard.ts +23 -10
- package/src/constants.ts +6 -0
- package/src/design-jsx/index.ts +1 -1
- package/src/design-jsx/renderer.ts +1 -1
- package/src/design-memory/check.ts +376 -0
- package/src/design-memory/describe.ts +77 -0
- package/src/design-memory/distil.ts +69 -0
- package/src/design-memory/document.ts +80 -0
- package/src/design-memory/guard.ts +157 -0
- package/src/design-memory/index.ts +8 -0
- package/src/design-memory/refusal.ts +90 -0
- package/src/design-memory/rules.ts +274 -0
- package/src/design-memory/values.ts +179 -0
- package/src/editor/bridges/components.ts +2 -0
- package/src/editor/clipboard/export.ts +24 -7
- package/src/editor/clipboard/snapshot.ts +21 -4
- package/src/editor/clipboard.ts +4 -14
- package/src/editor/color-space.ts +47 -38
- package/src/editor/components/instances.ts +31 -0
- package/src/editor/create.ts +39 -71
- package/src/editor/design-memory.ts +39 -0
- package/src/editor/design-tokens.ts +41 -2
- package/src/editor/document-colors.ts +65 -0
- package/src/editor/eyedropper.ts +198 -0
- package/src/editor/fonts.ts +19 -0
- package/src/editor/history/atomic-tool.ts +29 -1
- package/src/editor/history/capture.ts +19 -0
- package/src/editor/history/document-change.ts +5 -17
- package/src/editor/history/edit.ts +16 -2
- package/src/editor/history/subtree.ts +13 -2
- package/src/editor/index.ts +11 -0
- package/src/editor/nudge.ts +1 -1
- package/src/editor/pages.ts +40 -29
- package/src/editor/play/states.ts +1 -1
- package/src/editor/read-only/actions.ts +6 -0
- package/src/editor/render-requests.ts +83 -0
- package/src/editor/selection/container.ts +24 -1
- package/src/editor/selection/navigation.ts +8 -6
- package/src/editor/selection/overlays.ts +1 -0
- package/src/editor/shapes/with-text.ts +2 -5
- package/src/editor/structure/auto-layout-wrap.ts +1 -1
- package/src/editor/structure/boolean.ts +1 -3
- package/src/editor/structure/group/bounds.ts +1 -5
- package/src/editor/structure/outline-stroke.ts +3 -3
- package/src/editor/structure/reorder.ts +8 -14
- package/src/editor/structure/state.ts +1 -1
- package/src/editor/structure.ts +5 -8
- package/src/editor/tool-registry.ts +2 -1
- package/src/editor/types.ts +8 -1
- package/src/editor/variables.ts +74 -2
- package/src/editor/variations/create.ts +235 -0
- package/src/editor/variations/pick.ts +35 -0
- package/src/editor/variations.ts +110 -0
- package/src/figma-api/accessors/reactions.ts +11 -1
- package/src/figma-api/accessors/text/index.ts +17 -1
- package/src/figma-api/accessors/text/opentype.ts +33 -0
- package/src/figma-api/accessors/visual.ts +55 -2
- package/src/figma-api/compatibility.ts +5 -2
- package/src/figma-api/effects.ts +143 -5
- package/src/figma-api/fonts/loaded.ts +9 -0
- package/src/figma-api/index.ts +35 -0
- package/src/figma-api/overrides.ts +295 -3
- package/src/figma-api/paints.ts +24 -9
- package/src/figma-api/proxy.ts +6 -1
- package/src/figma-api/reactions.ts +130 -32
- package/src/figma-api/serialization.ts +2 -1
- package/src/figma-api/shape-details.ts +50 -0
- package/src/figma-api/shape-with-text.ts +2 -5
- package/src/figma-api/surface.ts +7 -2
- package/src/global.d.ts +31 -0
- package/src/icons/svg.ts +3 -1
- package/src/io/formats/boolean-path.ts +60 -0
- package/src/io/formats/design-tokens/index.ts +21 -0
- package/src/io/formats/design-tokens/plan/changes.ts +4 -1
- package/src/io/formats/design-tokens/project.ts +40 -9
- package/src/io/formats/design-tokens/styles.ts +10 -2
- package/src/io/formats/design-tokens/sync/apply.ts +130 -0
- package/src/io/formats/design-tokens/sync/drift.ts +587 -0
- package/src/io/formats/design-tokens/sync/files.ts +40 -0
- package/src/io/formats/drawio/edges.ts +65 -0
- package/src/io/formats/drawio/export.ts +37 -14
- package/src/io/formats/drawio/index.ts +5 -1
- package/src/io/formats/fig/export/patch/index.ts +8 -0
- package/src/io/formats/fig/thumbnail-page.ts +4 -4
- package/src/io/formats/html/import.ts +9 -1
- package/src/io/formats/html/index.ts +14 -7
- package/src/io/formats/html/layers.ts +11 -2
- package/src/io/formats/html/vectors.ts +8 -2
- package/src/io/formats/pdf/document.ts +14 -4
- package/src/io/formats/pdf/dom.ts +10 -18
- package/src/io/formats/pdf/export.ts +1 -1
- package/src/io/formats/pen/imports.ts +5 -6
- package/src/io/formats/pen/index.ts +36 -5
- package/src/io/formats/raster/adjusted-images.ts +125 -0
- package/src/io/formats/raster/headless.ts +3 -3
- package/src/io/formats/raster/index.ts +6 -1
- package/src/io/formats/raster/pixels.ts +7 -0
- package/src/io/formats/raster/render.ts +12 -1
- package/src/io/formats/svg/defs.ts +14 -73
- package/src/io/formats/svg/effects.ts +131 -0
- package/src/io/formats/svg/export.ts +371 -64
- package/src/io/formats/svg/filter.ts +47 -0
- package/src/io/formats/svg/grain.ts +249 -0
- package/src/io/formats/svg/strokes.ts +2 -2
- package/src/io/formats/svg/text/layout.ts +13 -3
- package/src/io/formats/video/composite.ts +79 -0
- package/src/io/formats/video/formats.ts +77 -0
- package/src/io/formats/video/gif.ts +65 -0
- package/src/io/formats/video/index.ts +30 -0
- package/src/io/formats/video/plan.ts +116 -0
- package/src/io/formats/video/record.ts +227 -0
- package/src/io/formats/video/sink.ts +32 -0
- package/src/io/formats/video/size.ts +25 -0
- package/src/io/formats/video/webcodecs.ts +89 -0
- package/src/io/formats.ts +59 -11
- package/src/io/types.ts +29 -10
- package/src/layout/apply.ts +87 -21
- package/src/layout/auto-layout-handles.ts +396 -0
- package/src/layout/derived.ts +14 -0
- package/src/layout/grid.ts +33 -9
- package/src/layout/mutations.ts +13 -1
- package/src/layout/strokes.ts +12 -0
- package/src/layout/yoga-helpers.ts +18 -1
- package/src/layout.ts +96 -49
- package/src/lint/fixes.ts +12 -3
- package/src/lint/index.ts +3 -1
- package/src/lint/linter.ts +124 -12
- package/src/lint/presets.ts +2 -0
- package/src/lint/rules/design-memory.ts +97 -0
- package/src/lint/rules/effect-style-required.ts +2 -0
- package/src/lint/rules/index.ts +6 -1
- package/src/lint/rules/no-unbound-token-values.ts +73 -0
- package/src/lint/rules/text-style-required.ts +2 -0
- package/src/lint/types.ts +40 -0
- package/src/node/video.ts +196 -0
- package/src/pairdraw-api/design-memory.ts +61 -0
- package/src/pairdraw-api/index.ts +81 -0
- package/src/pairdraw-api/nodes.ts +38 -0
- package/src/pairdraw-api/variations.ts +109 -0
- package/src/prototype/easing.ts +37 -0
- package/src/prototype/frames.ts +9 -0
- package/src/prototype/hit.ts +70 -0
- package/src/prototype/index.ts +69 -0
- package/src/prototype/pointer.ts +146 -0
- package/src/prototype/reactions.ts +178 -0
- package/src/prototype/scene.ts +116 -0
- package/src/prototype/scenes.ts +256 -0
- package/src/prototype/scroll.ts +190 -0
- package/src/prototype/session.ts +188 -0
- package/src/prototype/smart-animate/animation.ts +267 -0
- package/src/prototype/smart-animate/match.ts +85 -0
- package/src/prototype/snapshot.ts +60 -0
- package/src/prototype/timeline.ts +400 -0
- package/src/rpc/index.ts +1 -0
- package/src/rpc/read-commands.ts +40 -23
- package/src/text/font/faces.ts +22 -0
- package/src/text/font/features.ts +27 -0
- package/src/text/font/manager.ts +88 -12
- package/src/text/index.ts +2 -0
- package/src/text/replace-fonts.ts +171 -0
- package/src/tools/analyze/responsive/index.ts +264 -0
- package/src/tools/analyze.ts +2 -0
- package/src/tools/codegen/token-sync.ts +98 -0
- package/src/tools/codegen.ts +1 -0
- package/src/tools/create/components.ts +4 -0
- package/src/tools/create/html.ts +1 -0
- package/src/tools/create/icons.ts +1 -0
- package/src/tools/create/mermaid.ts +1 -0
- package/src/tools/create/svg.ts +1 -0
- package/src/tools/design-memory.ts +72 -0
- package/src/tools/image-ai/generate.ts +2 -0
- package/src/tools/index.ts +1 -0
- package/src/tools/modify/fonts.ts +34 -0
- package/src/tools/modify/layout.ts +5 -0
- package/src/tools/modify/reactions.ts +15 -8
- package/src/tools/modify/text.ts +42 -5
- package/src/tools/modify/update.ts +46 -2
- package/src/tools/modify.ts +1 -0
- package/src/tools/read/fonts.ts +24 -2
- package/src/tools/read/libraries.ts +1 -0
- package/src/tools/read/nodes.ts +0 -1
- package/src/tools/read/space.ts +3 -2
- package/src/tools/registry/core.ts +3 -1
- package/src/tools/registry/extended.ts +28 -1
- package/src/tools/schema.ts +28 -4
- package/src/tools/stock-photo.ts +1 -0
- package/src/tools/structure/basic.ts +1 -0
- package/src/tools/structure/batch.ts +34 -1
- package/src/tools/structure/hierarchy.ts +4 -0
- package/src/tools/structure/variations.ts +118 -0
- package/src/tools/structure.ts +2 -0
- package/src/tools/styles/types.ts +3 -4
- package/src/tools/vector/boolean.ts +4 -0
- package/src/tools/vector/path.ts +30 -6
- package/src/tools/vector/vectorize.ts +1 -0
- package/src/tools/vector/video.ts +228 -0
- package/src/tools/vector.ts +1 -0
- package/src/tools/video-host.ts +18 -0
- package/src/xpath.ts +6 -1
|
@@ -8,13 +8,13 @@ import { computeContentBounds } from '#core/io/formats/raster'
|
|
|
8
8
|
import {
|
|
9
9
|
nextDefId,
|
|
10
10
|
formatSolidColor,
|
|
11
|
-
createFilterDef,
|
|
12
11
|
resolveFill,
|
|
13
12
|
solidFillOpacity,
|
|
14
13
|
SVG_STROKE_CAP,
|
|
15
14
|
SVG_STROKE_JOIN,
|
|
16
15
|
SVG_BLEND_MODE
|
|
17
16
|
} from './defs'
|
|
17
|
+
import { createFilterDef } from './effects'
|
|
18
18
|
import {
|
|
19
19
|
round,
|
|
20
20
|
geometryBlobToSVGPath,
|
|
@@ -32,6 +32,8 @@ export { geometryBlobToSVGPath, nodeOutlinePath, type OutlineNode } from './path
|
|
|
32
32
|
import type { SceneGraph, SceneNode, Fill, Stroke, VectorNetwork } from '@pairdraw/scene-graph'
|
|
33
33
|
import { looseSegments, regionSVGPaths } from '@pairdraw/scene-graph/vector-network'
|
|
34
34
|
|
|
35
|
+
import type { BooleanPathResolver } from '#core/io/formats/boolean-path'
|
|
36
|
+
|
|
35
37
|
import { arrowHeadElements, openPathElements, vectorArrowHeads } from './arrows'
|
|
36
38
|
import type { SVGExportContext, SVGFontAlias } from './defs'
|
|
37
39
|
import { svg, renderSVGNode } from './node'
|
|
@@ -56,6 +58,46 @@ function networkElements(
|
|
|
56
58
|
return [...regions, ...openPathElements(node, network, common, looseSegments)]
|
|
57
59
|
}
|
|
58
60
|
|
|
61
|
+
/** Paints one path's fill stack; a blended fill draws its stroke as a separate path. */
|
|
62
|
+
function vectorFillElements(
|
|
63
|
+
attrs: Record<string, string | number | undefined>,
|
|
64
|
+
visibleFills: Fill[],
|
|
65
|
+
strokeAttrs: Record<string, string | number | undefined>,
|
|
66
|
+
common: Record<string, string | number | undefined>,
|
|
67
|
+
node: SceneNode,
|
|
68
|
+
ctx: SVGExportContext
|
|
69
|
+
): SVGNode[] {
|
|
70
|
+
const elements: SVGNode[] = []
|
|
71
|
+
for (const [index, fill] of visibleFills.entries()) {
|
|
72
|
+
const fillAttr = resolveFill(fill, node, ctx)
|
|
73
|
+
if (!fillAttr) continue
|
|
74
|
+
const style = paintBlendStyle(fill)
|
|
75
|
+
const last = index === visibleFills.length - 1
|
|
76
|
+
const splitStroke = style !== undefined && last && common.stroke !== 'none'
|
|
77
|
+
const stroke = last && !splitStroke ? common.stroke : 'none'
|
|
78
|
+
elements.push(
|
|
79
|
+
svg('path', {
|
|
80
|
+
...attrs,
|
|
81
|
+
fill: fillAttr,
|
|
82
|
+
'fill-opacity': solidFillOpacity(fill, ctx.colorSpace),
|
|
83
|
+
style,
|
|
84
|
+
stroke
|
|
85
|
+
})
|
|
86
|
+
)
|
|
87
|
+
if (splitStroke) {
|
|
88
|
+
elements.push(
|
|
89
|
+
svg('path', {
|
|
90
|
+
d: attrs.d,
|
|
91
|
+
'fill-rule': attrs['fill-rule'],
|
|
92
|
+
fill: 'none',
|
|
93
|
+
...strokeAttrs
|
|
94
|
+
})
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return elements
|
|
99
|
+
}
|
|
100
|
+
|
|
59
101
|
function vectorShapeElements(
|
|
60
102
|
node: SceneNode,
|
|
61
103
|
common: Record<string, string | number | undefined>,
|
|
@@ -83,22 +125,32 @@ function vectorShapeElements(
|
|
|
83
125
|
elements.push(svg('path', { ...attrs, fill: 'none' }))
|
|
84
126
|
continue
|
|
85
127
|
}
|
|
86
|
-
|
|
87
|
-
const fillAttr = resolveFill(fill, node, ctx)
|
|
88
|
-
if (!fillAttr) continue
|
|
89
|
-
elements.push(
|
|
90
|
-
svg('path', {
|
|
91
|
-
...attrs,
|
|
92
|
-
fill: fillAttr,
|
|
93
|
-
'fill-opacity': solidFillOpacity(fill, ctx.colorSpace),
|
|
94
|
-
stroke: index === visibleFills.length - 1 ? common.stroke : 'none'
|
|
95
|
-
})
|
|
96
|
-
)
|
|
97
|
-
}
|
|
128
|
+
elements.push(...vectorFillElements(attrs, visibleFills, strokeAttrs, common, node, ctx))
|
|
98
129
|
}
|
|
99
130
|
} else if (node.vectorNetwork) {
|
|
100
131
|
elements.push(...networkElements(node, node.vectorNetwork, common))
|
|
101
132
|
}
|
|
133
|
+
elements.push(...vectorStrokeTail(node, strokeAttrs))
|
|
134
|
+
return withVectorFallback(elements, node, common)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** The empty vector's fallback shape, after both paints have contributed their elements. */
|
|
138
|
+
function withVectorFallback(
|
|
139
|
+
elements: SVGNode[],
|
|
140
|
+
node: SceneNode,
|
|
141
|
+
common: Record<string, string | number | undefined>
|
|
142
|
+
): SVGNode[] {
|
|
143
|
+
return elements.length > 0
|
|
144
|
+
? elements
|
|
145
|
+
: [svg('rect', { width: round(node.width), height: round(node.height), ...common })]
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** The stored stroke geometry and arrowheads both vector paints share after their outlines. */
|
|
149
|
+
function vectorStrokeTail(
|
|
150
|
+
node: SceneNode,
|
|
151
|
+
strokeAttrs: Record<string, string | number | undefined>
|
|
152
|
+
): SVGNode[] {
|
|
153
|
+
const elements: SVGNode[] = []
|
|
102
154
|
if (node.strokeGeometry.length > 0 && strokeAttrs.stroke && strokeAttrs.stroke !== 'none') {
|
|
103
155
|
for (const geo of node.strokeGeometry) {
|
|
104
156
|
const d = geometryBlobToSVGPath(geo.commandsBlob)
|
|
@@ -115,9 +167,34 @@ function vectorShapeElements(
|
|
|
115
167
|
}
|
|
116
168
|
}
|
|
117
169
|
if (node.vectorNetwork) elements.push(...vectorArrowHeads(node, node.vectorNetwork, strokeAttrs))
|
|
118
|
-
return elements
|
|
119
|
-
|
|
120
|
-
|
|
170
|
+
return elements
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** A vector layer's outlines as strokes alone, for a second stroke over the painted fills. */
|
|
174
|
+
function vectorStrokeElements(
|
|
175
|
+
node: SceneNode,
|
|
176
|
+
strokeAttrs: Record<string, string | number | undefined>
|
|
177
|
+
): SVGNode[] {
|
|
178
|
+
const elements: SVGNode[] = []
|
|
179
|
+
const common: Record<string, string | number | undefined> = { fill: 'none', ...strokeAttrs }
|
|
180
|
+
if (node.fillGeometry.length > 0) {
|
|
181
|
+
for (const geo of node.fillGeometry) {
|
|
182
|
+
const d = geometryBlobToSVGPath(geo.commandsBlob)
|
|
183
|
+
if (d) {
|
|
184
|
+
elements.push(
|
|
185
|
+
svg('path', {
|
|
186
|
+
d,
|
|
187
|
+
'fill-rule': geo.windingRule === 'EVENODD' ? 'evenodd' : undefined,
|
|
188
|
+
...common
|
|
189
|
+
})
|
|
190
|
+
)
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
} else if (node.vectorNetwork) {
|
|
194
|
+
elements.push(...networkElements(node, node.vectorNetwork, common))
|
|
195
|
+
}
|
|
196
|
+
elements.push(...vectorStrokeTail(node, strokeAttrs))
|
|
197
|
+
return withVectorFallback(elements, node, common)
|
|
121
198
|
}
|
|
122
199
|
|
|
123
200
|
/** A line's dashes stretched along it as the canvas lays them, half a dash at each end. */
|
|
@@ -135,7 +212,8 @@ function nodeShapeElements(
|
|
|
135
212
|
fillAttr: string | null,
|
|
136
213
|
fillOpacity: number | undefined,
|
|
137
214
|
strokeAttrs: Record<string, string | number | undefined>,
|
|
138
|
-
ctx: SVGExportContext
|
|
215
|
+
ctx: SVGExportContext,
|
|
216
|
+
stroke?: Stroke
|
|
139
217
|
): SVGNode[] {
|
|
140
218
|
const common: Record<string, string | number | undefined> = {
|
|
141
219
|
fill: fillAttr ?? 'none',
|
|
@@ -161,12 +239,12 @@ function nodeShapeElements(
|
|
|
161
239
|
|
|
162
240
|
case 'LINE': {
|
|
163
241
|
// Where the canvas strokes it: to one side of the line, with its caps inside its length.
|
|
164
|
-
const
|
|
242
|
+
const lineStroke = stroke ?? node.strokes.find((item) => item.visible)
|
|
165
243
|
const {
|
|
166
244
|
network,
|
|
167
245
|
from: start,
|
|
168
246
|
to: end
|
|
169
|
-
} = lineStrokePath(node,
|
|
247
|
+
} = lineStrokePath(node, lineStroke?.weight ?? 0, lineStroke?.cap ?? node.strokeCap)
|
|
170
248
|
return [
|
|
171
249
|
svg('line', {
|
|
172
250
|
x1: round(start.x),
|
|
@@ -175,9 +253,9 @@ function nodeShapeElements(
|
|
|
175
253
|
y2: round(end.y),
|
|
176
254
|
fill: 'none',
|
|
177
255
|
...strokeAttrs,
|
|
178
|
-
...lineDashAttrs(
|
|
256
|
+
...lineDashAttrs(lineStroke, Math.hypot(end.x - start.x, end.y - start.y))
|
|
179
257
|
}),
|
|
180
|
-
...arrowHeadElements(node, network,
|
|
258
|
+
...arrowHeadElements(node, network, lineStroke, strokeAttrs)
|
|
181
259
|
]
|
|
182
260
|
}
|
|
183
261
|
|
|
@@ -269,7 +347,7 @@ function buildGroupAttrs(
|
|
|
269
347
|
attrs.style = `mix-blend-mode: ${blend}`
|
|
270
348
|
}
|
|
271
349
|
|
|
272
|
-
const filterDef = createFilterDef(node
|
|
350
|
+
const filterDef = createFilterDef(node, ctx)
|
|
273
351
|
if (filterDef) {
|
|
274
352
|
ctx.defs.push(filterDef.node)
|
|
275
353
|
attrs.filter = `url(#${filterDef.id})`
|
|
@@ -285,17 +363,18 @@ function buildGroupAttrs(
|
|
|
285
363
|
}
|
|
286
364
|
|
|
287
365
|
function buildSVGStrokeAttrs(
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
366
|
+
stroke: Stroke,
|
|
367
|
+
node: SceneNode,
|
|
368
|
+
ctx: SVGExportContext
|
|
291
369
|
): Record<string, string | number | undefined> {
|
|
292
|
-
|
|
293
|
-
const stroke = visibleStrokes[0]
|
|
294
|
-
const cap = stroke.cap ?? nodeCap
|
|
370
|
+
const cap = stroke.cap ?? node.strokeCap
|
|
295
371
|
const attrs: Record<string, string | number | undefined> = {
|
|
296
372
|
// Opacity 1 keeps the color opaque. Display P3 must not also keep color alpha here, or a
|
|
297
373
|
// viewer multiplies it by stroke-opacity; the canvas paints stroke.opacity alone.
|
|
298
|
-
stroke:
|
|
374
|
+
stroke:
|
|
375
|
+
stroke.type === 'SOLID'
|
|
376
|
+
? formatSolidColor(stroke.color, 1, ctx.colorSpace)
|
|
377
|
+
: (resolveFill(stroke, node, ctx) ?? formatSolidColor(stroke.color, 1, ctx.colorSpace)),
|
|
299
378
|
'stroke-width': round(stroke.weight)
|
|
300
379
|
}
|
|
301
380
|
if (stroke.opacity < 1) attrs['stroke-opacity'] = round(stroke.opacity)
|
|
@@ -309,37 +388,102 @@ function buildSVGStrokeAttrs(
|
|
|
309
388
|
return attrs
|
|
310
389
|
}
|
|
311
390
|
|
|
391
|
+
/** The blend CSS a paint adds, when the canvas would not composite it source-over. */
|
|
392
|
+
function paintBlendStyle(fill: Fill | undefined): string | undefined {
|
|
393
|
+
const blend = fill?.blendMode ? SVG_BLEND_MODE[fill.blendMode] : undefined
|
|
394
|
+
return blend && blend !== 'normal' ? `mix-blend-mode: ${blend}` : undefined
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/** Adds a paint's blend mode to the elements that draw it. */
|
|
398
|
+
function withPaintBlend(elements: SVGNode[], fill: Fill | undefined): SVGNode[] {
|
|
399
|
+
const style = paintBlendStyle(fill)
|
|
400
|
+
if (style) for (const element of elements) element.attrs.style = style
|
|
401
|
+
return elements
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Draws the fill and the stroke as separate elements when the fill blends, so the stroke keeps the
|
|
406
|
+
* source-over canvas gives it instead of inheriting the fill's blend mode.
|
|
407
|
+
*/
|
|
408
|
+
function shapeWithPaint(
|
|
409
|
+
node: SceneNode,
|
|
410
|
+
fillAttr: string | null,
|
|
411
|
+
fillOpacity: number | undefined,
|
|
412
|
+
strokeAttrs: Record<string, string | number | undefined>,
|
|
413
|
+
fill: Fill | undefined,
|
|
414
|
+
ctx: SVGExportContext
|
|
415
|
+
): SVGNode[] {
|
|
416
|
+
const blends = paintBlendStyle(fill) !== undefined
|
|
417
|
+
if (!blends || !strokeAttrs.stroke) {
|
|
418
|
+
return withPaintBlend(nodeShapeElements(node, fillAttr, fillOpacity, strokeAttrs, ctx), fill)
|
|
419
|
+
}
|
|
420
|
+
return [
|
|
421
|
+
...withPaintBlend(nodeShapeElements(node, fillAttr, fillOpacity, {}, ctx), fill),
|
|
422
|
+
...nodeShapeElements(node, null, undefined, strokeAttrs, ctx)
|
|
423
|
+
]
|
|
424
|
+
}
|
|
425
|
+
|
|
312
426
|
function hasPathLevelFills(node: SceneNode): boolean {
|
|
313
427
|
return node.type === 'VECTOR' && node.fillGeometry.some((geometry) => geometry.fills?.length)
|
|
314
428
|
}
|
|
315
429
|
|
|
430
|
+
/** One stroke at its own weight over the fills: a centred one on the outline, an aligned one around it. */
|
|
431
|
+
function strokeElements(
|
|
432
|
+
node: SceneNode,
|
|
433
|
+
stroke: Stroke,
|
|
434
|
+
strokeAttrs: Record<string, string | number | undefined>,
|
|
435
|
+
ctx: SVGExportContext
|
|
436
|
+
): SVGNode[] {
|
|
437
|
+
const aligned = hasPathLevelFills(node) ? null : alignedStroke(node, stroke)
|
|
438
|
+
if (aligned) {
|
|
439
|
+
return [
|
|
440
|
+
...alignedStrokeElement(node, aligned, strokeAttrs, ctx),
|
|
441
|
+
...(node.type === 'SHAPE_WITH_TEXT'
|
|
442
|
+
? shapeWithTextDetailElements(node, strokeAttrs, ctx)
|
|
443
|
+
: [])
|
|
444
|
+
]
|
|
445
|
+
}
|
|
446
|
+
if (node.type === 'VECTOR') return vectorStrokeElements(node, strokeAttrs)
|
|
447
|
+
return nodeShapeElements(node, null, undefined, strokeAttrs, ctx, stroke)
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* The fills and the strokes over them. The first stroke joins the fill's own element as before;
|
|
452
|
+
* every later visible stroke is drawn in layer order, without painting the fill again.
|
|
453
|
+
*/
|
|
316
454
|
function buildShapeChildren(
|
|
317
455
|
node: SceneNode,
|
|
318
456
|
visibleFills: Fill[],
|
|
319
457
|
fillAttr: string | null,
|
|
320
458
|
fillOpacity: number | undefined,
|
|
321
|
-
strokeAttrs: Record<string, string | number | undefined
|
|
459
|
+
strokeAttrs: Record<string, string | number | undefined>[],
|
|
322
460
|
visibleStrokes: Stroke[],
|
|
323
461
|
ctx: SVGExportContext
|
|
324
462
|
): SVGNode[] {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
return fillAndStrokeElements(
|
|
328
|
-
node,
|
|
329
|
-
visibleFills,
|
|
330
|
-
fillAttr,
|
|
331
|
-
fillOpacity,
|
|
332
|
-
strokeAttrs,
|
|
333
|
-
visibleStrokes.length,
|
|
334
|
-
ctx
|
|
335
|
-
)
|
|
463
|
+
if (visibleStrokes.length === 0) {
|
|
464
|
+
return fillAndStrokeElements(node, visibleFills, fillAttr, fillOpacity, {}, 0, ctx)
|
|
336
465
|
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
466
|
+
const first = visibleStrokes[0]
|
|
467
|
+
const firstAttrs = strokeAttrs[0]
|
|
468
|
+
const elements = alignedStroke(node, first)
|
|
469
|
+
? // The fill goes as it is, and the stroke over it inside or outside the outline.
|
|
470
|
+
[
|
|
471
|
+
...fillAndStrokeElements(node, visibleFills, fillAttr, fillOpacity, {}, 0, ctx),
|
|
472
|
+
...strokeElements(node, first, firstAttrs, ctx)
|
|
473
|
+
]
|
|
474
|
+
: fillAndStrokeElements(
|
|
475
|
+
node,
|
|
476
|
+
visibleFills,
|
|
477
|
+
fillAttr,
|
|
478
|
+
fillOpacity,
|
|
479
|
+
firstAttrs,
|
|
480
|
+
visibleStrokes.length,
|
|
481
|
+
ctx
|
|
482
|
+
)
|
|
483
|
+
for (let index = 1; index < visibleStrokes.length; index++) {
|
|
484
|
+
elements.push(...strokeElements(node, visibleStrokes[index], strokeAttrs[index], ctx))
|
|
485
|
+
}
|
|
486
|
+
return elements
|
|
343
487
|
}
|
|
344
488
|
|
|
345
489
|
function fillAndStrokeElements(
|
|
@@ -367,11 +511,12 @@ function fillAndStrokeElements(
|
|
|
367
511
|
const ref = resolveFill(fill, node, ctx)
|
|
368
512
|
if (ref) {
|
|
369
513
|
elements.push(
|
|
370
|
-
...
|
|
514
|
+
...shapeWithPaint(
|
|
371
515
|
node,
|
|
372
516
|
ref,
|
|
373
517
|
solidFillOpacity(fill, ctx.colorSpace),
|
|
374
518
|
fill === visibleFills[visibleFills.length - 1] ? strokeAttrs : {},
|
|
519
|
+
fill,
|
|
375
520
|
ctx
|
|
376
521
|
)
|
|
377
522
|
)
|
|
@@ -382,7 +527,14 @@ function fillAndStrokeElements(
|
|
|
382
527
|
|
|
383
528
|
const hasFillOrStroke = fillAttr || visibleStrokeCount > 0
|
|
384
529
|
if (hasFillOrStroke && !isGroupLike(node)) {
|
|
385
|
-
return
|
|
530
|
+
return shapeWithPaint(
|
|
531
|
+
node,
|
|
532
|
+
fillAttr,
|
|
533
|
+
fillOpacity,
|
|
534
|
+
strokeAttrs,
|
|
535
|
+
visibleFills.length === 1 ? visibleFills[0] : undefined,
|
|
536
|
+
ctx
|
|
537
|
+
)
|
|
386
538
|
}
|
|
387
539
|
|
|
388
540
|
return []
|
|
@@ -404,6 +556,139 @@ function exportedFill(
|
|
|
404
556
|
}
|
|
405
557
|
}
|
|
406
558
|
|
|
559
|
+
/**
|
|
560
|
+
* A mask layer's definition: an alpha or luminance `<mask>`, or a `<clipPath>` for an outline
|
|
561
|
+
* mask. The rendered layer carries its own position, opacity, and filters into the mask.
|
|
562
|
+
*/
|
|
563
|
+
function maskWire(
|
|
564
|
+
mask: SceneNode,
|
|
565
|
+
ctx: SVGExportContext
|
|
566
|
+
): { attribute: 'mask' | 'clip-path'; id: string } {
|
|
567
|
+
const content = renderNode(mask, ctx)
|
|
568
|
+
if (mask.maskType === 'VECTOR') {
|
|
569
|
+
const id = nextDefId(ctx, 'clip')
|
|
570
|
+
ctx.defs.push(svg('clipPath', { id, clipPathUnits: 'userSpaceOnUse' }, content ?? undefined))
|
|
571
|
+
return { attribute: 'clip-path', id }
|
|
572
|
+
}
|
|
573
|
+
const id = nextDefId(ctx, 'mask')
|
|
574
|
+
const attrs: Record<string, string | number | undefined> = {
|
|
575
|
+
id,
|
|
576
|
+
maskContentUnits: 'userSpaceOnUse'
|
|
577
|
+
}
|
|
578
|
+
if (mask.maskType === 'ALPHA') attrs['mask-type'] = 'alpha'
|
|
579
|
+
ctx.defs.push(svg('mask', attrs, content ?? undefined))
|
|
580
|
+
return { attribute: 'mask', id }
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* The children as the canvas draws them: a run of visible masks masks the siblings that follow
|
|
585
|
+
* it, until the next mask, and the mask layers themselves never draw on their own.
|
|
586
|
+
*/
|
|
587
|
+
function maskedChildNodes(childNodes: SceneNode[], ctx: SVGExportContext): SVGNode[] {
|
|
588
|
+
const content: SVGNode[] = []
|
|
589
|
+
let masks: Array<{ attribute: 'mask' | 'clip-path'; id: string }> = []
|
|
590
|
+
let afterMask = false
|
|
591
|
+
for (const child of childNodes) {
|
|
592
|
+
if (child.visible && child.isMask) {
|
|
593
|
+
const wire = maskWire(child, ctx)
|
|
594
|
+
masks = afterMask ? [...masks, wire] : [wire]
|
|
595
|
+
afterMask = true
|
|
596
|
+
continue
|
|
597
|
+
}
|
|
598
|
+
const rendered = renderNode(child, ctx)
|
|
599
|
+
afterMask = false
|
|
600
|
+
if (!rendered) continue
|
|
601
|
+
let wrapped = rendered
|
|
602
|
+
for (const wire of masks) wrapped = svg('g', { [wire.attribute]: `url(#${wire.id})` }, wrapped)
|
|
603
|
+
content.push(wrapped)
|
|
604
|
+
}
|
|
605
|
+
return content
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/** A boolean's live result path in the paints its fills and strokes give it. */
|
|
609
|
+
function booleanPathElements(
|
|
610
|
+
node: SceneNode,
|
|
611
|
+
d: string,
|
|
612
|
+
visibleFills: Fill[],
|
|
613
|
+
fillAttr: string | null,
|
|
614
|
+
fillOpacity: number | undefined,
|
|
615
|
+
strokeAttrs: Array<Record<string, string | number | undefined>>,
|
|
616
|
+
visibleStrokes: Stroke[],
|
|
617
|
+
ctx: SVGExportContext
|
|
618
|
+
): SVGNode[] {
|
|
619
|
+
const common = { d, 'fill-rule': 'evenodd' as const }
|
|
620
|
+
// A centred first stroke joins the fill element, as a shape's does; every later stroke, and
|
|
621
|
+
// every inside or outside stroke, is drawn over the result outline on its own. An unset
|
|
622
|
+
// alignment strokes the centred way, as `alignedStroke` treats it.
|
|
623
|
+
const centered = (stroke: Stroke): boolean =>
|
|
624
|
+
stroke.align !== 'INSIDE' && stroke.align !== 'OUTSIDE'
|
|
625
|
+
const firstJoins = visibleStrokes.length > 0 && centered(visibleStrokes[0])
|
|
626
|
+
const joined = firstJoins ? strokeAttrs[0] : {}
|
|
627
|
+
const elements =
|
|
628
|
+
visibleFills.length <= 1
|
|
629
|
+
? [
|
|
630
|
+
svg('path', {
|
|
631
|
+
...common,
|
|
632
|
+
fill: fillAttr ?? 'none',
|
|
633
|
+
'fill-opacity': fillOpacity,
|
|
634
|
+
...joined
|
|
635
|
+
})
|
|
636
|
+
]
|
|
637
|
+
: visibleFills.map((fill, index) =>
|
|
638
|
+
svg('path', {
|
|
639
|
+
...common,
|
|
640
|
+
fill: resolveFill(fill, node, ctx) ?? 'none',
|
|
641
|
+
'fill-opacity': solidFillOpacity(fill, ctx.colorSpace),
|
|
642
|
+
...(index === visibleFills.length - 1 ? joined : {})
|
|
643
|
+
})
|
|
644
|
+
)
|
|
645
|
+
|
|
646
|
+
for (let index = firstJoins ? 1 : 0; index < visibleStrokes.length; index++) {
|
|
647
|
+
const stroke = visibleStrokes[index]
|
|
648
|
+
const attrs = strokeAttrs[index]
|
|
649
|
+
elements.push(
|
|
650
|
+
...(centered(stroke)
|
|
651
|
+
? [svg('path', { d, fill: 'none', ...attrs })]
|
|
652
|
+
: alignedStrokeElement(node, stroke, attrs, ctx, d))
|
|
653
|
+
)
|
|
654
|
+
}
|
|
655
|
+
return elements
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/** A boolean made in Pairdraw draws its computed result path instead of its operands. */
|
|
659
|
+
function renderBooleanNode(
|
|
660
|
+
node: SceneNode,
|
|
661
|
+
ctx: SVGExportContext,
|
|
662
|
+
paint: {
|
|
663
|
+
groupAttrs: Record<string, string | number | undefined>
|
|
664
|
+
visibleFills: Fill[]
|
|
665
|
+
fillAttr: string | null
|
|
666
|
+
fillOpacity: number | undefined
|
|
667
|
+
strokeAttrs: Array<Record<string, string | number | undefined>>
|
|
668
|
+
visibleStrokes: Stroke[]
|
|
669
|
+
}
|
|
670
|
+
): SVGNode | null {
|
|
671
|
+
if (node.type !== 'BOOLEAN_OPERATION' || node.fillGeometry.length > 0 || !ctx.booleanPath) {
|
|
672
|
+
return null
|
|
673
|
+
}
|
|
674
|
+
const d = ctx.booleanPath(ctx.graph, node)
|
|
675
|
+
if (!d) return null
|
|
676
|
+
return svg(
|
|
677
|
+
'g',
|
|
678
|
+
paint.groupAttrs,
|
|
679
|
+
...booleanPathElements(
|
|
680
|
+
node,
|
|
681
|
+
d,
|
|
682
|
+
paint.visibleFills,
|
|
683
|
+
paint.fillAttr,
|
|
684
|
+
paint.fillOpacity,
|
|
685
|
+
paint.strokeAttrs,
|
|
686
|
+
paint.visibleStrokes,
|
|
687
|
+
ctx
|
|
688
|
+
)
|
|
689
|
+
)
|
|
690
|
+
}
|
|
691
|
+
|
|
407
692
|
function renderNode(node: SceneNode, ctx: SVGExportContext): SVGNode | null {
|
|
408
693
|
if (!node.visible) return null
|
|
409
694
|
|
|
@@ -428,11 +713,20 @@ function renderNode(node: SceneNode, ctx: SVGExportContext): SVGNode | null {
|
|
|
428
713
|
// `currentColor` has no alpha. Display P3 normally bakes solid opacity into the color, which a
|
|
429
714
|
// tint throws away, so a tinted solid keeps `fill-opacity` in every color space.
|
|
430
715
|
const fillOpacity = ownFill ? solidFillOpacity(ownFill, ctx.colorSpace, tintedFill) : fill.opacity
|
|
431
|
-
const
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
716
|
+
const strokeAttrs = visibleStrokes.map((stroke) => {
|
|
717
|
+
const attrs = buildSVGStrokeAttrs(stroke, node, ctx)
|
|
718
|
+
return tint.includes('stroke') ? { ...attrs, stroke: CURRENT_COLOR } : attrs
|
|
719
|
+
})
|
|
720
|
+
|
|
721
|
+
const booleanDrawn = renderBooleanNode(node, ctx, {
|
|
722
|
+
groupAttrs,
|
|
723
|
+
visibleFills,
|
|
724
|
+
fillAttr,
|
|
725
|
+
fillOpacity,
|
|
726
|
+
strokeAttrs,
|
|
727
|
+
visibleStrokes
|
|
728
|
+
})
|
|
729
|
+
if (booleanDrawn) return booleanDrawn
|
|
436
730
|
|
|
437
731
|
const children: (SVGNode | null)[] = buildShapeChildren(
|
|
438
732
|
node,
|
|
@@ -444,12 +738,7 @@ function renderNode(node: SceneNode, ctx: SVGExportContext): SVGNode | null {
|
|
|
444
738
|
ctx
|
|
445
739
|
)
|
|
446
740
|
|
|
447
|
-
const
|
|
448
|
-
const childContent: SVGNode[] = []
|
|
449
|
-
for (const child of childNodes) {
|
|
450
|
-
const rendered = renderNode(child, ctx)
|
|
451
|
-
if (rendered) childContent.push(rendered)
|
|
452
|
-
}
|
|
741
|
+
const childContent = maskedChildNodes(ctx.graph.getChildren(node.id), ctx)
|
|
453
742
|
|
|
454
743
|
if (clipId && childContent.length > 0) {
|
|
455
744
|
children.push(svg('g', { 'clip-path': `url(#${clipId})` }, ...childContent))
|
|
@@ -491,6 +780,11 @@ export interface SVGExportOptions {
|
|
|
491
780
|
* file under. Text in an aliased face is written in that family at normal weight and style.
|
|
492
781
|
*/
|
|
493
782
|
fontAlias?: SVGFontAlias
|
|
783
|
+
/**
|
|
784
|
+
* The live result path of a boolean operation made in Pairdraw, which stores none. Left out,
|
|
785
|
+
* such a boolean draws its box and its operands, as an archive-less reader sees it.
|
|
786
|
+
*/
|
|
787
|
+
booleanPath?: BooleanPathResolver
|
|
494
788
|
}
|
|
495
789
|
|
|
496
790
|
export function renderNodesToSVG(
|
|
@@ -512,7 +806,8 @@ export function renderNodesToSVG(
|
|
|
512
806
|
graph,
|
|
513
807
|
colorSpace: options.colorSpace ?? 'srgb',
|
|
514
808
|
textLayout: options.textLayout,
|
|
515
|
-
fontAlias: options.fontAlias
|
|
809
|
+
fontAlias: options.fontAlias,
|
|
810
|
+
booleanPath: options.booleanPath
|
|
516
811
|
}
|
|
517
812
|
|
|
518
813
|
const contentNodes: SVGNode[] = []
|
|
@@ -568,10 +863,22 @@ export function renderNodeSVGElement(
|
|
|
568
863
|
{
|
|
569
864
|
idPrefix,
|
|
570
865
|
colorSpace = 'srgb',
|
|
571
|
-
tint
|
|
572
|
-
|
|
866
|
+
tint,
|
|
867
|
+
booleanPath
|
|
868
|
+
}: Pick<SVGExportContext, 'tint' | 'booleanPath'> & {
|
|
869
|
+
idPrefix: string
|
|
870
|
+
colorSpace?: RenderColorSpace
|
|
871
|
+
}
|
|
573
872
|
): SVGNode | null {
|
|
574
|
-
const ctx: SVGExportContext = {
|
|
873
|
+
const ctx: SVGExportContext = {
|
|
874
|
+
defs: [],
|
|
875
|
+
defIdCounter: 0,
|
|
876
|
+
graph,
|
|
877
|
+
colorSpace,
|
|
878
|
+
idPrefix,
|
|
879
|
+
tint,
|
|
880
|
+
booleanPath
|
|
881
|
+
}
|
|
575
882
|
const drawn = renderNode({ ...node, x: 0, y: 0, rotation: 0, opacity: 1 }, ctx)
|
|
576
883
|
if (!drawn) return null
|
|
577
884
|
// A straight line has no height or width, but its stroke still needs a viewport to draw in.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Color } from '@pairdraw/scene-graph/primitives'
|
|
2
|
+
|
|
3
|
+
import { formatColor, type SVGExportContext } from './defs'
|
|
4
|
+
import { svg, type SVGNode } from './node'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A flood's colour, opaque: its alpha goes in `flood-opacity`, which a Display P3 colour would
|
|
8
|
+
* otherwise carry a second time.
|
|
9
|
+
*/
|
|
10
|
+
export function floodColor(color: Color, colorSpace: SVGExportContext['colorSpace']): string {
|
|
11
|
+
return formatColor({ ...color, a: 1 }, 1, colorSpace)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** An SVG filter's primitives as they are added, each naming its result uniquely. */
|
|
15
|
+
export class FilterBuilder {
|
|
16
|
+
readonly primitives: SVGNode[] = []
|
|
17
|
+
private count = 0
|
|
18
|
+
|
|
19
|
+
constructor(
|
|
20
|
+
private readonly id: string,
|
|
21
|
+
private readonly ctx: SVGExportContext
|
|
22
|
+
) {}
|
|
23
|
+
|
|
24
|
+
/** A primitive with as many children as `children` holds. */
|
|
25
|
+
pushElement(
|
|
26
|
+
tag: string,
|
|
27
|
+
attrs: Record<string, string | number | undefined>,
|
|
28
|
+
children: SVGNode[]
|
|
29
|
+
) {
|
|
30
|
+
this.primitives.push(svg(tag, attrs, ...children))
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The colour space the export writes colours in. */
|
|
34
|
+
get colorSpace(): SVGExportContext['colorSpace'] {
|
|
35
|
+
return this.ctx.colorSpace
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** A new result name, unique in this filter. */
|
|
39
|
+
result(name: string): string {
|
|
40
|
+
this.count += 1
|
|
41
|
+
return `${this.id}_${name}${this.count}`
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
push(tag: string, attrs: Record<string, string | number | undefined>, ...children: SVGNode[]) {
|
|
45
|
+
this.primitives.push(svg(tag, attrs, ...children))
|
|
46
|
+
}
|
|
47
|
+
}
|