@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
package/src/layout/apply.ts
CHANGED
|
@@ -5,8 +5,9 @@ import { enforcedAspectRatio } from '@pairdraw/scene-graph/layout'
|
|
|
5
5
|
import type { Vector } from '@pairdraw/scene-graph/primitives'
|
|
6
6
|
import { layoutConstrainedChildRect, shapeGeometryChanges } from '@pairdraw/scene-graph/resize'
|
|
7
7
|
|
|
8
|
-
import { keepsSavedLayout, usesDetachedDerivedLayout } from './derived'
|
|
8
|
+
import { keepsSavedFrameSize, keepsSavedLayout, usesDetachedDerivedLayout } from './derived'
|
|
9
9
|
import { laidOutFlowBox } from './flow-edges'
|
|
10
|
+
import { contentInsetsSize } from './strokes'
|
|
10
11
|
|
|
11
12
|
export type ComputeLayoutFn = (graph: SceneGraph, frameId: string) => void
|
|
12
13
|
|
|
@@ -47,7 +48,10 @@ function writeLayoutGeometry(
|
|
|
47
48
|
const changes: LayoutGeometry = {}
|
|
48
49
|
for (const key of ['x', 'y', 'width', 'height'] as const) {
|
|
49
50
|
const value = geometry[key]
|
|
50
|
-
|
|
51
|
+
// A container whose size no arithmetic can use makes Yoga answer NaN for a child's place
|
|
52
|
+
// (BASELINE alignment in a wrap is one); the layer stays where it was.
|
|
53
|
+
if (value === undefined || !Number.isFinite(value) || value === node[key]) continue
|
|
54
|
+
changes[key] = value
|
|
51
55
|
}
|
|
52
56
|
const resized = changes.width !== undefined || changes.height !== undefined
|
|
53
57
|
const outlines = resized
|
|
@@ -150,6 +154,74 @@ function hugStart(frame: SceneNode): { width: number; height: number } | null {
|
|
|
150
154
|
}
|
|
151
155
|
}
|
|
152
156
|
|
|
157
|
+
/**
|
|
158
|
+
* The smallest size a layout frame holds: what Yoga computed for it, or the room its padding and
|
|
159
|
+
* included inside strokes take, which Yoga's fixed size does not count. A saved frame nobody
|
|
160
|
+
* edited holds exactly what Yoga computed, so opening a file never grows it.
|
|
161
|
+
*/
|
|
162
|
+
function heldFrameSize(
|
|
163
|
+
frame: SceneNode,
|
|
164
|
+
yogaNode: YogaNode,
|
|
165
|
+
holdsSavedSize: boolean
|
|
166
|
+
): { width: number; height: number } {
|
|
167
|
+
const insets = holdsSavedSize ? null : contentInsetsSize(frame)
|
|
168
|
+
return {
|
|
169
|
+
width: Math.max(yogaNode.getComputedWidth(), insets?.width ?? 0),
|
|
170
|
+
height: Math.max(yogaNode.getComputedHeight(), insets?.height ?? 0)
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** A grid's size: automatic rows take their height, and a hugged axis takes what Yoga computed. */
|
|
175
|
+
function applyGridFrameSize(
|
|
176
|
+
graph: SceneGraph,
|
|
177
|
+
frame: SceneNode,
|
|
178
|
+
yogaNode: YogaNode,
|
|
179
|
+
computeLayout: ComputeLayoutFn
|
|
180
|
+
): void {
|
|
181
|
+
const updates: LayoutGeometry = {}
|
|
182
|
+
const holds = keepsSavedFrameSize(graph, frame)
|
|
183
|
+
const held = heldFrameSize(frame, yogaNode, holds)
|
|
184
|
+
if (frame.primaryAxisSizing === 'HUG') updates.width = held.width
|
|
185
|
+
else if (!holds && held.width > frame.width) updates.width = held.width
|
|
186
|
+
const automaticRows = frame.gridTemplateRows.length === 0
|
|
187
|
+
if (automaticRows || frame.counterAxisSizing === 'HUG') updates.height = held.height
|
|
188
|
+
else if (!holds && held.height > frame.height) updates.height = held.height
|
|
189
|
+
writeLayoutGeometry(graph, frame.id, updates, computeLayout)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/** The sizes a flex frame takes: a fixed one grows to its padding, and a hugged one hugs. */
|
|
193
|
+
function flexFrameSizeUpdates(
|
|
194
|
+
frame: SceneNode,
|
|
195
|
+
held: { width: number; height: number },
|
|
196
|
+
computed: (axis: 'width' | 'height') => number,
|
|
197
|
+
derived: Partial<Record<'width' | 'height', number>> | null,
|
|
198
|
+
keepsSavedSize: (axis: 'width' | 'height') => boolean,
|
|
199
|
+
holdsSavedSize: boolean
|
|
200
|
+
): LayoutGeometry {
|
|
201
|
+
const primary = frame.layoutMode === 'HORIZONTAL' ? 'width' : 'height'
|
|
202
|
+
const counter = primary === 'width' ? 'height' : 'width'
|
|
203
|
+
const updates: LayoutGeometry = {}
|
|
204
|
+
// The padding floor is an edit: a saved frame nobody touched keeps the size it has.
|
|
205
|
+
if (frame.primaryAxisSizing === 'FIXED' && !holdsSavedSize && held[primary] > frame[primary]) {
|
|
206
|
+
updates[primary] = held[primary]
|
|
207
|
+
}
|
|
208
|
+
if (frame.counterAxisSizing === 'FIXED' && !holdsSavedSize && held[counter] > frame[counter]) {
|
|
209
|
+
updates[counter] = held[counter]
|
|
210
|
+
}
|
|
211
|
+
if (frame.primaryAxisSizing === 'HUG') {
|
|
212
|
+
const floor = holdsSavedSize ? 0 : held[primary]
|
|
213
|
+
updates[primary] = Math.max(derived?.[primary] ?? computed(primary), floor)
|
|
214
|
+
}
|
|
215
|
+
if (frame.counterAxisSizing === 'HUG') {
|
|
216
|
+
const floor = holdsSavedSize ? 0 : held[counter]
|
|
217
|
+
updates[counter] = Math.max(
|
|
218
|
+
keepsSavedSize(counter) ? frame[counter] : (derived?.[counter] ?? computed(counter)),
|
|
219
|
+
floor
|
|
220
|
+
)
|
|
221
|
+
}
|
|
222
|
+
return updates
|
|
223
|
+
}
|
|
224
|
+
|
|
153
225
|
function applyFrameSize(
|
|
154
226
|
graph: SceneGraph,
|
|
155
227
|
frame: SceneNode,
|
|
@@ -158,31 +230,25 @@ function applyFrameSize(
|
|
|
158
230
|
computeLayout: ComputeLayoutFn
|
|
159
231
|
): void {
|
|
160
232
|
if (frame.layoutMode === 'GRID') {
|
|
161
|
-
|
|
162
|
-
writeLayoutGeometry(graph, frame.id, { height: yogaNode.getComputedHeight() }, computeLayout)
|
|
163
|
-
}
|
|
233
|
+
applyGridFrameSize(graph, frame, yogaNode, computeLayout)
|
|
164
234
|
return
|
|
165
235
|
}
|
|
166
236
|
|
|
167
237
|
const before = hugStart(frame)
|
|
168
|
-
if (!before) return
|
|
169
|
-
|
|
170
|
-
const updates: LayoutGeometry = {}
|
|
171
|
-
const derived = keepsSaved ? frame.derivedLayout : null
|
|
172
|
-
const primary = frame.layoutMode === 'HORIZONTAL' ? 'width' : 'height'
|
|
173
|
-
const counter = primary === 'width' ? 'height' : 'width'
|
|
174
238
|
const computed = (axis: 'width' | 'height') =>
|
|
175
239
|
axis === 'width' ? yogaNode.getComputedWidth() : yogaNode.getComputedHeight()
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
240
|
+
const holds = keepsSavedFrameSize(graph, frame)
|
|
241
|
+
const updates = flexFrameSizeUpdates(
|
|
242
|
+
frame,
|
|
243
|
+
heldFrameSize(frame, yogaNode, holds),
|
|
244
|
+
computed,
|
|
245
|
+
keepsSaved ? frame.derivedLayout : null,
|
|
246
|
+
(axis) => keepsSaved && preservesImportedHugCrossSize(graph, frame, axis),
|
|
247
|
+
holds
|
|
248
|
+
)
|
|
249
|
+
if (Object.keys(updates).length === 0) return
|
|
250
|
+
writeLayoutGeometry(graph, frame.id, updates, computeLayout, before ?? undefined)
|
|
251
|
+
if (before) huggedSizes.set(frame, { width: frame.width, height: frame.height })
|
|
186
252
|
}
|
|
187
253
|
|
|
188
254
|
function computedChildPosition(
|
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import type { SceneNode } from '@pairdraw/scene-graph'
|
|
2
|
+
import { isGeneratedFrame } from '@pairdraw/scene-graph/generated'
|
|
3
|
+
|
|
4
|
+
/** The side of a frame a padding handle edits. */
|
|
5
|
+
export type AutoLayoutPaddingSide = 'top' | 'right' | 'bottom' | 'left'
|
|
6
|
+
|
|
7
|
+
/** A rectangle in the frame's own coordinates, the space a handle occupies. */
|
|
8
|
+
export interface AutoLayoutHandleRect {
|
|
9
|
+
x: number
|
|
10
|
+
y: number
|
|
11
|
+
width: number
|
|
12
|
+
height: number
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface AutoLayoutPaddingHandle {
|
|
16
|
+
kind: 'padding'
|
|
17
|
+
side: AutoLayoutPaddingSide
|
|
18
|
+
rect: AutoLayoutHandleRect
|
|
19
|
+
value: number
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface AutoLayoutGapHandle {
|
|
23
|
+
kind: 'gap'
|
|
24
|
+
/** The gap the flow lays out, or the gap between wrapped lines. */
|
|
25
|
+
axis: 'primary' | 'counter'
|
|
26
|
+
/** The child the gap starts after, on the primary axis. */
|
|
27
|
+
index: number
|
|
28
|
+
rect: AutoLayoutHandleRect
|
|
29
|
+
value: number
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type AutoLayoutHandle = AutoLayoutPaddingHandle | AutoLayoutGapHandle
|
|
33
|
+
export type AutoLayoutHandleHit =
|
|
34
|
+
| Pick<AutoLayoutPaddingHandle, 'kind' | 'side'>
|
|
35
|
+
| Pick<AutoLayoutGapHandle, 'kind' | 'axis' | 'index'>
|
|
36
|
+
|
|
37
|
+
export interface AutoLayoutHandleLayout {
|
|
38
|
+
nodeId: string
|
|
39
|
+
layoutMode: 'HORIZONTAL' | 'VERTICAL'
|
|
40
|
+
/** False where no edit can land, such as a generated frame's own layout. */
|
|
41
|
+
editable: boolean
|
|
42
|
+
padding: AutoLayoutPaddingHandle[]
|
|
43
|
+
gaps: AutoLayoutGapHandle[]
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface AutoLayoutDragInput {
|
|
47
|
+
/** Pointer movement on screen, in pixels. */
|
|
48
|
+
dx: number
|
|
49
|
+
dy: number
|
|
50
|
+
zoom: number
|
|
51
|
+
/** Alt edits the opposite side on the dragged axis; with Shift, every side. */
|
|
52
|
+
alt: boolean
|
|
53
|
+
/** Shift moves padding or spacing by the large nudge. */
|
|
54
|
+
shift: boolean
|
|
55
|
+
/** The large nudge distance, as Settings → Editor sets it. */
|
|
56
|
+
bigNudge?: number
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface AutoLayoutDragChanges {
|
|
60
|
+
/** The new value of the dragged property, clamped to zero. */
|
|
61
|
+
value: number
|
|
62
|
+
changes: Partial<
|
|
63
|
+
Pick<
|
|
64
|
+
SceneNode,
|
|
65
|
+
| 'paddingTop'
|
|
66
|
+
| 'paddingRight'
|
|
67
|
+
| 'paddingBottom'
|
|
68
|
+
| 'paddingLeft'
|
|
69
|
+
| 'itemSpacing'
|
|
70
|
+
| 'counterAxisSpacing'
|
|
71
|
+
>
|
|
72
|
+
>
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** The gap between two neighbouring children, in the frame's coordinates. */
|
|
76
|
+
function primaryGapRects(
|
|
77
|
+
node: SceneNode,
|
|
78
|
+
children: readonly SceneNode[]
|
|
79
|
+
): Array<{ index: number; rect: AutoLayoutHandleRect }> {
|
|
80
|
+
if (children.length < 2 || node.itemSpacing <= 0 || node.primaryAxisAlign === 'SPACE_BETWEEN')
|
|
81
|
+
return []
|
|
82
|
+
const isRow = node.layoutMode === 'HORIZONTAL'
|
|
83
|
+
const rects: Array<{ index: number; rect: AutoLayoutHandleRect }> = []
|
|
84
|
+
for (let index = 0; index < children.length - 1; index++) {
|
|
85
|
+
const prev = children[index]
|
|
86
|
+
const next = children[index + 1]
|
|
87
|
+
const prevStart = isRow ? prev.x : prev.y
|
|
88
|
+
const prevEnd = isRow ? prev.x + prev.width : prev.y + prev.height
|
|
89
|
+
const nextStart = isRow ? next.x : next.y
|
|
90
|
+
const nextEnd = isRow ? next.x + next.width : next.y + next.height
|
|
91
|
+
// A reversed flow (RTL rows, for one) lays the next child before the previous one.
|
|
92
|
+
const start = nextStart >= prevStart ? prevEnd : nextEnd
|
|
93
|
+
const end = nextStart >= prevStart ? nextStart : prevStart
|
|
94
|
+
if (end <= start) continue
|
|
95
|
+
rects.push(
|
|
96
|
+
isRow
|
|
97
|
+
? {
|
|
98
|
+
index,
|
|
99
|
+
rect: {
|
|
100
|
+
x: start,
|
|
101
|
+
y: node.paddingTop,
|
|
102
|
+
width: end - start,
|
|
103
|
+
height: node.height - node.paddingTop - node.paddingBottom
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
: {
|
|
107
|
+
index,
|
|
108
|
+
rect: {
|
|
109
|
+
x: node.paddingLeft,
|
|
110
|
+
y: start,
|
|
111
|
+
width: node.width - node.paddingLeft - node.paddingRight,
|
|
112
|
+
height: end - start
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
return rects
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* The gap between wrapped lines, which a wrapping flow lays out with counterAxisSpacing. Lines are
|
|
122
|
+
* grouped by their position so a line with different item sizes still yields one gap.
|
|
123
|
+
*/
|
|
124
|
+
function counterGapRects(
|
|
125
|
+
node: SceneNode,
|
|
126
|
+
children: readonly SceneNode[]
|
|
127
|
+
): Array<{ index: number; rect: AutoLayoutHandleRect }> {
|
|
128
|
+
if (node.layoutWrap !== 'WRAP' || node.counterAxisSpacing <= 0 || children.length < 2) return []
|
|
129
|
+
const isRow = node.layoutMode === 'HORIZONTAL'
|
|
130
|
+
const lines: Array<{ start: number; end: number }> = []
|
|
131
|
+
for (const child of children) {
|
|
132
|
+
const start = isRow ? child.y : child.x
|
|
133
|
+
const end = isRow ? child.y + child.height : child.x + child.width
|
|
134
|
+
// A centered or baseline line aligns children with different sizes at different starts.
|
|
135
|
+
const line = lines.find((candidate) => start <= candidate.end && end >= candidate.start)
|
|
136
|
+
if (line) {
|
|
137
|
+
line.start = Math.min(line.start, start)
|
|
138
|
+
line.end = Math.max(line.end, end)
|
|
139
|
+
} else {
|
|
140
|
+
lines.push({ start, end })
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const sorted = lines.sort((left, right) => left.start - right.start)
|
|
144
|
+
const rects: Array<{ index: number; rect: AutoLayoutHandleRect }> = []
|
|
145
|
+
for (let index = 0; index < sorted.length - 1; index++) {
|
|
146
|
+
const previous = sorted[index]
|
|
147
|
+
const next = sorted[index + 1]
|
|
148
|
+
if (next.start <= previous.end) continue
|
|
149
|
+
rects.push(
|
|
150
|
+
isRow
|
|
151
|
+
? {
|
|
152
|
+
index,
|
|
153
|
+
rect: {
|
|
154
|
+
x: node.paddingLeft,
|
|
155
|
+
y: previous.end,
|
|
156
|
+
width: node.width - node.paddingLeft - node.paddingRight,
|
|
157
|
+
height: next.start - previous.end
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
: {
|
|
161
|
+
index,
|
|
162
|
+
rect: {
|
|
163
|
+
x: previous.end,
|
|
164
|
+
y: node.paddingTop,
|
|
165
|
+
width: next.start - previous.end,
|
|
166
|
+
height: node.height - node.paddingTop - node.paddingBottom
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
}
|
|
171
|
+
return rects
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** The padding and gap zones of an auto-layout frame, in its own coordinates. */
|
|
175
|
+
const PADDING_FIELD = {
|
|
176
|
+
top: 'paddingTop',
|
|
177
|
+
right: 'paddingRight',
|
|
178
|
+
bottom: 'paddingBottom',
|
|
179
|
+
left: 'paddingLeft'
|
|
180
|
+
} as const
|
|
181
|
+
|
|
182
|
+
function paddingValue(node: SceneNode, side: AutoLayoutPaddingSide): number {
|
|
183
|
+
return node[PADDING_FIELD[side]]
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** The band a padding side occupies, in the frame's coordinates. */
|
|
187
|
+
function paddingBand(
|
|
188
|
+
node: SceneNode,
|
|
189
|
+
side: AutoLayoutPaddingSide,
|
|
190
|
+
value: number
|
|
191
|
+
): AutoLayoutHandleRect {
|
|
192
|
+
switch (side) {
|
|
193
|
+
case 'top':
|
|
194
|
+
return { x: 0, y: 0, width: node.width, height: value }
|
|
195
|
+
case 'right':
|
|
196
|
+
return { x: node.width - value, y: 0, width: value, height: node.height }
|
|
197
|
+
case 'bottom':
|
|
198
|
+
return { x: 0, y: node.height - value, width: node.width, height: value }
|
|
199
|
+
case 'left':
|
|
200
|
+
return { x: 0, y: 0, width: value, height: node.height }
|
|
201
|
+
default:
|
|
202
|
+
throw new Error('Unknown padding side')
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** The frame edge a padding handle hugs, so the nearest of two meeting bands wins. */
|
|
207
|
+
function edgeDistance(handle: AutoLayoutPaddingHandle, x: number, y: number): number {
|
|
208
|
+
switch (handle.side) {
|
|
209
|
+
case 'top':
|
|
210
|
+
return y
|
|
211
|
+
case 'bottom':
|
|
212
|
+
return handle.rect.y + handle.rect.height - y
|
|
213
|
+
case 'left':
|
|
214
|
+
return x
|
|
215
|
+
case 'right':
|
|
216
|
+
return handle.rect.x + handle.rect.width - x
|
|
217
|
+
default:
|
|
218
|
+
throw new Error('Unknown padding side')
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export function measureAutoLayoutHandles(
|
|
223
|
+
node: SceneNode | undefined,
|
|
224
|
+
children: readonly SceneNode[]
|
|
225
|
+
): AutoLayoutHandleLayout | null {
|
|
226
|
+
if (!node || (node.layoutMode !== 'HORIZONTAL' && node.layoutMode !== 'VERTICAL')) return null
|
|
227
|
+
const laidOut = children.filter(
|
|
228
|
+
(child) => child.visible && child.layoutPositioning !== 'ABSOLUTE'
|
|
229
|
+
)
|
|
230
|
+
const padding: AutoLayoutPaddingHandle[] = []
|
|
231
|
+
const sides: AutoLayoutPaddingSide[] = ['top', 'right', 'bottom', 'left']
|
|
232
|
+
for (const side of sides) {
|
|
233
|
+
const value = paddingValue(node, side)
|
|
234
|
+
if (value <= 0) continue
|
|
235
|
+
padding.push({ kind: 'padding', side, rect: paddingBand(node, side, value), value })
|
|
236
|
+
}
|
|
237
|
+
const gaps: AutoLayoutGapHandle[] = [
|
|
238
|
+
...primaryGapRects(node, laidOut).map(({ index, rect }) => ({
|
|
239
|
+
kind: 'gap' as const,
|
|
240
|
+
axis: 'primary' as const,
|
|
241
|
+
index,
|
|
242
|
+
rect,
|
|
243
|
+
value: node.itemSpacing
|
|
244
|
+
})),
|
|
245
|
+
...counterGapRects(node, laidOut).map(({ index, rect }) => ({
|
|
246
|
+
kind: 'gap' as const,
|
|
247
|
+
axis: 'counter' as const,
|
|
248
|
+
index,
|
|
249
|
+
rect,
|
|
250
|
+
value: node.counterAxisSpacing
|
|
251
|
+
}))
|
|
252
|
+
]
|
|
253
|
+
return {
|
|
254
|
+
nodeId: node.id,
|
|
255
|
+
layoutMode: node.layoutMode,
|
|
256
|
+
editable: !isGeneratedFrame(node),
|
|
257
|
+
padding,
|
|
258
|
+
gaps
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function contains(rect: AutoLayoutHandleRect, x: number, y: number, grow = 0): boolean {
|
|
263
|
+
return (
|
|
264
|
+
x >= rect.x - grow &&
|
|
265
|
+
x <= rect.x + rect.width + grow &&
|
|
266
|
+
y >= rect.y - grow &&
|
|
267
|
+
y <= rect.y + rect.height + grow
|
|
268
|
+
)
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* The padding or gap handle under a point in the frame's coordinates. Padding wins where it meets a
|
|
273
|
+
* gap, and the nearest frame edge wins in a corner where two padding bands meet.
|
|
274
|
+
*/
|
|
275
|
+
export function hitAutoLayoutHandle(
|
|
276
|
+
layout: AutoLayoutHandleLayout | null,
|
|
277
|
+
x: number,
|
|
278
|
+
y: number
|
|
279
|
+
): AutoLayoutHandleHit | null {
|
|
280
|
+
if (!layout) return null
|
|
281
|
+
let nearest: AutoLayoutPaddingHandle | null = null
|
|
282
|
+
for (const handle of layout.padding) {
|
|
283
|
+
if (!contains(handle.rect, x, y)) continue
|
|
284
|
+
if (!nearest || edgeDistance(handle, x, y) <= edgeDistance(nearest, x, y)) nearest = handle
|
|
285
|
+
}
|
|
286
|
+
if (nearest) return { kind: 'padding', side: nearest.side }
|
|
287
|
+
for (const handle of layout.gaps) {
|
|
288
|
+
if (contains(handle.rect, x, y)) {
|
|
289
|
+
return { kind: 'gap', axis: handle.axis, index: handle.index }
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return null
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
function handleFor(
|
|
296
|
+
layout: AutoLayoutHandleLayout,
|
|
297
|
+
hit: AutoLayoutHandleHit
|
|
298
|
+
): AutoLayoutHandle | null {
|
|
299
|
+
if (hit.kind === 'padding') {
|
|
300
|
+
return layout.padding.find((handle) => handle.side === hit.side) ?? null
|
|
301
|
+
}
|
|
302
|
+
return (
|
|
303
|
+
layout.gaps.find((handle) => handle.axis === hit.axis && handle.index === hit.index) ?? null
|
|
304
|
+
)
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/** Movement along the axis a padding side grows in. */
|
|
308
|
+
function paddingDelta(side: AutoLayoutPaddingSide, dx: number, dy: number): number {
|
|
309
|
+
switch (side) {
|
|
310
|
+
case 'top':
|
|
311
|
+
return dy
|
|
312
|
+
case 'bottom':
|
|
313
|
+
return -dy
|
|
314
|
+
case 'left':
|
|
315
|
+
return dx
|
|
316
|
+
case 'right':
|
|
317
|
+
return -dx
|
|
318
|
+
default:
|
|
319
|
+
throw new Error('Unknown padding side')
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/** Movement across the gaps of a flow: primary along it, counter across it. */
|
|
324
|
+
function gapDelta(
|
|
325
|
+
layoutMode: 'HORIZONTAL' | 'VERTICAL',
|
|
326
|
+
axis: AutoLayoutGapHandle['axis'],
|
|
327
|
+
dx: number,
|
|
328
|
+
dy: number
|
|
329
|
+
): number {
|
|
330
|
+
const horizontal = layoutMode === 'HORIZONTAL'
|
|
331
|
+
if (axis === 'counter') return horizontal ? dy : dx
|
|
332
|
+
return horizontal ? dx : dy
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/** The rounded, non-negative value a drag would set for the grabbed handle. */
|
|
336
|
+
export function autoLayoutDragValue(
|
|
337
|
+
layout: AutoLayoutHandleLayout,
|
|
338
|
+
hit: AutoLayoutHandleHit,
|
|
339
|
+
input: AutoLayoutDragInput
|
|
340
|
+
): number {
|
|
341
|
+
const handle = handleFor(layout, hit)
|
|
342
|
+
if (!handle) return 0
|
|
343
|
+
const zoom = input.zoom > 0 ? input.zoom : 1
|
|
344
|
+
const delta =
|
|
345
|
+
handle.kind === 'padding'
|
|
346
|
+
? paddingDelta(handle.side, input.dx, input.dy)
|
|
347
|
+
: gapDelta(layout.layoutMode, handle.axis, input.dx, input.dy)
|
|
348
|
+
const raw = handle.value + delta / zoom
|
|
349
|
+
// Shift moves padding and spacing by the large nudge, as Settings → Editor sets it.
|
|
350
|
+
const step = input.bigNudge && input.bigNudge > 0 ? input.bigNudge : 10
|
|
351
|
+
return Math.max(0, input.shift ? Math.round(raw / step) * step : Math.round(raw))
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/** The properties a drag writes for the grabbed handle, with Alt and Shift expanding padding. */
|
|
355
|
+
export function autoLayoutDragChanges(
|
|
356
|
+
layout: AutoLayoutHandleLayout,
|
|
357
|
+
hit: AutoLayoutHandleHit,
|
|
358
|
+
input: AutoLayoutDragInput
|
|
359
|
+
): AutoLayoutDragChanges {
|
|
360
|
+
const value = autoLayoutDragValue(layout, hit, input)
|
|
361
|
+
if (hit.kind === 'padding') {
|
|
362
|
+
if (input.alt && input.shift) {
|
|
363
|
+
return {
|
|
364
|
+
value,
|
|
365
|
+
changes: {
|
|
366
|
+
paddingTop: value,
|
|
367
|
+
paddingRight: value,
|
|
368
|
+
paddingBottom: value,
|
|
369
|
+
paddingLeft: value
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
if (input.alt) {
|
|
374
|
+
switch (hit.side) {
|
|
375
|
+
case 'top':
|
|
376
|
+
case 'bottom':
|
|
377
|
+
return { value, changes: { paddingTop: value, paddingBottom: value } }
|
|
378
|
+
case 'left':
|
|
379
|
+
case 'right':
|
|
380
|
+
return { value, changes: { paddingLeft: value, paddingRight: value } }
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
switch (hit.side) {
|
|
384
|
+
case 'top':
|
|
385
|
+
return { value, changes: { paddingTop: value } }
|
|
386
|
+
case 'right':
|
|
387
|
+
return { value, changes: { paddingRight: value } }
|
|
388
|
+
case 'bottom':
|
|
389
|
+
return { value, changes: { paddingBottom: value } }
|
|
390
|
+
case 'left':
|
|
391
|
+
return { value, changes: { paddingLeft: value } }
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
if (hit.axis === 'counter') return { value, changes: { counterAxisSpacing: value } }
|
|
395
|
+
return { value, changes: { itemSpacing: value } }
|
|
396
|
+
}
|
package/src/layout/derived.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
2
2
|
import { LAYOUT_AFFECTING_KEYS } from '@pairdraw/scene-graph/fields'
|
|
3
|
+
import { takesOwnSize } from '@pairdraw/scene-graph/instances'
|
|
3
4
|
|
|
4
5
|
/** Edits that make saved geometry stale: layout fields, visibility, and text laid out again. */
|
|
5
6
|
const LAYOUT_EDIT_FIELDS: ReadonlySet<string> = new Set([
|
|
@@ -95,3 +96,16 @@ export function usesDetachedDerivedLayout(graph: SceneGraph, child: SceneNode):
|
|
|
95
96
|
keepsSavedLayout(graph, child)
|
|
96
97
|
)
|
|
97
98
|
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Whether layout holds a frame's saved size exactly: a frame read from a file whose flow and
|
|
102
|
+
* layout are still untouched by the user or a tool. Growing it to its padding belongs to an
|
|
103
|
+
* edit, so opening or re-laying out a file leaves the saved size alone.
|
|
104
|
+
*/
|
|
105
|
+
export function keepsSavedFrameSize(graph: SceneGraph, frame: SceneNode): boolean {
|
|
106
|
+
// An instance shows the size its main or an override gives it, as do the layers inside it; their
|
|
107
|
+
// own padding is not an edit this layout may grow them from.
|
|
108
|
+
if (frame.type === 'INSTANCE' || !takesOwnSize(graph, frame)) return true
|
|
109
|
+
const readFromFile = frame.source.format === 'fig' || frame.derivedLayout != null
|
|
110
|
+
return readFromFile && keepsSavedLayout(graph, frame)
|
|
111
|
+
}
|
package/src/layout/grid.ts
CHANGED
|
@@ -1,35 +1,59 @@
|
|
|
1
1
|
import { Direction, Display, Gutter, type Node as YogaNode } from 'yoga-layout'
|
|
2
2
|
|
|
3
|
-
import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
3
|
+
import type { GridTrack, SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
4
4
|
import { layoutSizing } from '@pairdraw/scene-graph/layout'
|
|
5
5
|
import { resolveNodeLayoutDirection } from '@pairdraw/scene-graph/text/direction'
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { ownAxisSizing } from './axis-sizing'
|
|
8
|
+
import { keepsSavedFrameSize } from './derived'
|
|
9
|
+
import { applyContentInsets, applyStrokeMargins, contentInsetsSize } from './strokes'
|
|
10
|
+
import {
|
|
11
|
+
applyMinMaxConstraints,
|
|
12
|
+
configureAbsoluteChild,
|
|
13
|
+
createYogaNode,
|
|
14
|
+
mapGridTrack
|
|
15
|
+
} from './yoga-helpers'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A grid frame that hugs an axis has no space to share out, so its fractional tracks take their
|
|
19
|
+
* content's size there and the frame keeps the smallest box around them, as Figma hugs a grid.
|
|
20
|
+
*/
|
|
21
|
+
export function gridTracksForAxis(node: SceneNode, axis: 'width' | 'height'): GridTrack[] {
|
|
22
|
+
const tracks = axis === 'width' ? node.gridTemplateColumns : node.gridTemplateRows
|
|
23
|
+
if (ownAxisSizing(node, axis) !== 'HUG') return tracks
|
|
24
|
+
return tracks.map((track) => (track.sizing === 'FR' ? { sizing: 'AUTO', value: 0 } : track))
|
|
25
|
+
}
|
|
9
26
|
|
|
10
27
|
function configureAsGrid(
|
|
28
|
+
graph: SceneGraph,
|
|
11
29
|
yogaNode: YogaNode,
|
|
12
30
|
node: SceneNode,
|
|
13
31
|
direction: Exclude<SceneNode['layoutDirection'], 'AUTO'>
|
|
14
32
|
): void {
|
|
15
33
|
yogaNode.setDisplay(Display.Grid)
|
|
16
34
|
yogaNode.setDirection(direction === 'RTL' ? Direction.RTL : Direction.LTR)
|
|
17
|
-
|
|
18
|
-
if (node
|
|
19
|
-
yogaNode.
|
|
35
|
+
const insets = keepsSavedFrameSize(graph, node) ? null : contentInsetsSize(node)
|
|
36
|
+
if (ownAxisSizing(node, 'width') !== 'HUG') {
|
|
37
|
+
yogaNode.setWidth(insets ? Math.max(node.width, insets.width) : node.width)
|
|
38
|
+
}
|
|
39
|
+
if (ownAxisSizing(node, 'height') !== 'HUG') {
|
|
40
|
+
if (node.gridTemplateRows.length > 0 || node.height > 0) {
|
|
41
|
+
yogaNode.setHeight(insets ? Math.max(node.height, insets.height) : node.height)
|
|
42
|
+
}
|
|
20
43
|
}
|
|
21
44
|
|
|
22
45
|
if (node.gridTemplateColumns.length > 0) {
|
|
23
|
-
yogaNode.setGridTemplateColumns(node.
|
|
46
|
+
yogaNode.setGridTemplateColumns(gridTracksForAxis(node, 'width').map(mapGridTrack))
|
|
24
47
|
}
|
|
25
48
|
if (node.gridTemplateRows.length > 0) {
|
|
26
|
-
yogaNode.setGridTemplateRows(node.
|
|
49
|
+
yogaNode.setGridTemplateRows(gridTracksForAxis(node, 'height').map(mapGridTrack))
|
|
27
50
|
}
|
|
28
51
|
|
|
29
52
|
yogaNode.setGap(Gutter.Column, node.gridColumnGap)
|
|
30
53
|
yogaNode.setGap(Gutter.Row, node.gridRowGap)
|
|
31
54
|
|
|
32
55
|
applyContentInsets(yogaNode, node)
|
|
56
|
+
applyMinMaxConstraints(yogaNode, node)
|
|
33
57
|
}
|
|
34
58
|
|
|
35
59
|
export function createGridChildNode(graph: SceneGraph, child: SceneNode): YogaNode {
|
|
@@ -70,7 +94,7 @@ export function buildGridTree(
|
|
|
70
94
|
): YogaNode {
|
|
71
95
|
const root = createYogaNode()
|
|
72
96
|
const direction = resolveNodeLayoutDirection(frame, inheritedDirection)
|
|
73
|
-
configureAsGrid(root, frame, direction)
|
|
97
|
+
configureAsGrid(graph, root, frame, direction)
|
|
74
98
|
|
|
75
99
|
const children = graph.getChildren(frame.id)
|
|
76
100
|
for (const child of children) {
|
package/src/layout/mutations.ts
CHANGED
|
@@ -27,6 +27,18 @@ export function createLayoutRunner(getGraph: () => SceneGraph) {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Lays out the parents whose children were added, removed, reordered, shown, or hidden. Only an
|
|
32
|
+
* auto layout places its children, so other parents are skipped: laying out a page reaches every
|
|
33
|
+
* frame on it. Hugging auto layout ancestors still follow, as `runLayoutForNode` walks up.
|
|
34
|
+
*/
|
|
35
|
+
function runLayoutForParents(parentIds: Iterable<string>) {
|
|
36
|
+
const graph = getGraph()
|
|
37
|
+
for (const id of uniq([...parentIds])) {
|
|
38
|
+
if (graph.getNode(id)?.layoutMode !== 'NONE') runLayoutForNode(id)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
30
42
|
function compactLayoutScope(impact: SceneMutationImpact): string[] {
|
|
31
43
|
const graph = getGraph()
|
|
32
44
|
const candidates = new Set(mutationLayoutScopeIds(impact).filter((id) => graph.getNode(id)))
|
|
@@ -87,5 +99,5 @@ export function createLayoutRunner(getGraph: () => SceneGraph) {
|
|
|
87
99
|
})
|
|
88
100
|
}
|
|
89
101
|
|
|
90
|
-
return { runLayoutForNode, runLayoutForImpact, runMutationWithLayout }
|
|
102
|
+
return { runLayoutForNode, runLayoutForParents, runLayoutForImpact, runMutationWithLayout }
|
|
91
103
|
}
|
package/src/layout/strokes.ts
CHANGED
|
@@ -73,6 +73,18 @@ export function applyContentInsets(yogaNode: YogaNode, node: SceneNode): void {
|
|
|
73
73
|
applyStrokeBorders(yogaNode, node)
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
/**
|
|
77
|
+
* The room a horizontal and vertical layout frame's padding and included inside strokes take,
|
|
78
|
+
* which is the smallest size it holds even when set smaller, as Figma grows such a frame.
|
|
79
|
+
*/
|
|
80
|
+
export function contentInsetsSize(node: SceneNode): { width: number; height: number } {
|
|
81
|
+
const inside = node.strokesIncludedInLayout ? strokeExtent(node, 'inside') : null
|
|
82
|
+
return {
|
|
83
|
+
width: node.paddingLeft + node.paddingRight + (inside ? inside[1] + inside[3] : 0),
|
|
84
|
+
height: node.paddingTop + node.paddingBottom + (inside ? inside[0] + inside[2] : 0)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
76
88
|
/**
|
|
77
89
|
* With strokes included in its parent's layout, the part of a child's stroke that falls outside
|
|
78
90
|
* its box takes room beside it, so neighbours and a hugging parent clear the stroke.
|