@pairdraw/core 0.19.2 → 0.21.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/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 +46 -0
- package/dist/canvas/noise/shader.d.ts.map +1 -0
- package/dist/canvas/noise/shader.js +166 -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 +74 -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/renderer/chunks/index.d.ts +1 -1
- package/dist/canvas/renderer/colors.d.ts +20 -5
- package/dist/canvas/renderer/colors.d.ts.map +1 -1
- package/dist/canvas/renderer/colors.js +48 -42
- package/dist/canvas/renderer/colors.js.map +1 -1
- package/dist/canvas/renderer/document-surface.d.ts +25 -0
- package/dist/canvas/renderer/document-surface.d.ts.map +1 -0
- package/dist/canvas/renderer/document-surface.js +46 -0
- package/dist/canvas/renderer/document-surface.js.map +1 -0
- package/dist/canvas/renderer/fonts.d.ts.map +1 -1
- package/dist/canvas/renderer/fonts.js +6 -4
- 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 +10 -3
- package/dist/canvas/renderer/lifecycle.js.map +1 -1
- package/dist/canvas/renderer/methods.d.ts.map +1 -1
- package/dist/canvas/renderer/methods.js +1 -0
- package/dist/canvas/renderer/methods.js.map +1 -1
- package/dist/canvas/renderer/pipeline.d.ts.map +1 -1
- package/dist/canvas/renderer/pipeline.js +36 -3
- 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/retained-backing.d.ts.map +1 -1
- package/dist/canvas/renderer/retained-backing.js +2 -1
- package/dist/canvas/renderer/retained-backing.js.map +1 -1
- 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/tiles/surface-pool.d.ts.map +1 -1
- package/dist/canvas/renderer/tiles/surface-pool.js +2 -7
- package/dist/canvas/renderer/tiles/surface-pool.js.map +1 -1
- package/dist/canvas/renderer/types.d.ts +18 -3
- 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 +42 -4
- package/dist/canvas/renderer.d.ts.map +1 -1
- package/dist/canvas/renderer.js +57 -5
- 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 +45 -12
- package/dist/canvas/scene.js.map +1 -1
- package/dist/canvas/shaders/effect.d.ts.map +1 -1
- package/dist/canvas/shaders/effect.js +2 -1
- package/dist/canvas/shaders/effect.js.map +1 -1
- package/dist/canvas/shadows/shape.d.ts.map +1 -1
- package/dist/canvas/shadows/shape.js +4 -2
- package/dist/canvas/shadows/shape.js.map +1 -1
- package/dist/canvas/shadows/silhouette.js +1 -1
- package/dist/canvas/shadows.d.ts.map +1 -1
- package/dist/canvas/shadows.js +4 -2
- package/dist/canvas/shadows.js.map +1 -1
- package/dist/canvas/text/decorations.d.ts +2 -2
- package/dist/canvas/text/decorations.d.ts.map +1 -1
- package/dist/canvas/text/decorations.js +5 -5
- package/dist/canvas/text/decorations.js.map +1 -1
- package/dist/canvas/text/index.js +1 -1
- package/dist/canvas/text/index.js.map +1 -1
- package/dist/canvas/text/paragraph/index.d.ts +2 -2
- package/dist/canvas/text/paragraph/index.d.ts.map +1 -1
- package/dist/canvas/text/paragraph/index.js +16 -5
- package/dist/canvas/text/paragraph/index.js.map +1 -1
- package/dist/canvas/text/renderer.d.ts +2 -1
- package/dist/canvas/text/renderer.d.ts.map +1 -1
- package/dist/canvas/text/shape.js +4 -4
- package/dist/canvas/text/shape.js.map +1 -1
- package/dist/canvas/texture.d.ts +20 -0
- package/dist/canvas/texture.d.ts.map +1 -0
- package/dist/canvas/texture.js +101 -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/renderer.d.ts.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/clipboard/assets.d.ts.map +1 -1
- package/dist/editor/clipboard/assets.js +3 -3
- package/dist/editor/clipboard/assets.js.map +1 -1
- package/dist/editor/clipboard/component-matches.d.ts +13 -0
- package/dist/editor/clipboard/component-matches.d.ts.map +1 -0
- package/dist/editor/clipboard/component-matches.js +50 -0
- package/dist/editor/clipboard/component-matches.js.map +1 -0
- package/dist/editor/clipboard/dependencies.d.ts +7 -0
- package/dist/editor/clipboard/dependencies.d.ts.map +1 -1
- package/dist/editor/clipboard/dependencies.js +5 -0
- package/dist/editor/clipboard/dependencies.js.map +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.d.ts.map +1 -1
- package/dist/editor/clipboard.js +48 -19
- package/dist/editor/clipboard.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/properties.d.ts.map +1 -1
- package/dist/editor/components/properties.js +3 -3
- package/dist/editor/components/properties.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 +26 -2
- package/dist/editor/create.d.ts.map +1 -1
- package/dist/editor/create.js +16 -60
- 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 +171 -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 +9 -2
- 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 +4 -2
- 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/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 +4 -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/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 +4 -0
- package/dist/editor/selection.d.ts +5 -0
- package/dist/editor/selection.d.ts.map +1 -1
- package/dist/editor/shapes/pencil.js +1 -1
- package/dist/editor/structure/state.d.ts.map +1 -1
- package/dist/editor/structure/state.js +2 -2
- package/dist/editor/structure/state.js.map +1 -1
- package/dist/editor/text.d.ts.map +1 -1
- package/dist/editor/text.js +2 -2
- package/dist/editor/text.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 +5 -1
- package/dist/editor/types.d.ts.map +1 -1
- package/dist/editor/variables.js +3 -3
- 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.js +3 -0
- 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/fresh-read.d.ts +15 -0
- package/dist/figma-api/fresh-read.d.ts.map +1 -0
- package/dist/figma-api/fresh-read.js +54 -0
- package/dist/figma-api/fresh-read.js.map +1 -0
- package/dist/figma-api/graph-ref.d.ts +9 -0
- package/dist/figma-api/graph-ref.d.ts.map +1 -0
- package/dist/figma-api/graph-ref.js +14 -0
- package/dist/figma-api/graph-ref.js.map +1 -0
- package/dist/figma-api/index.d.ts +11 -1
- package/dist/figma-api/index.d.ts.map +1 -1
- package/dist/figma-api/index.js +16 -4
- 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/pending-layout.d.ts +3 -3
- package/dist/figma-api/pending-layout.d.ts.map +1 -1
- package/dist/figma-api/pending-layout.js +7 -3
- package/dist/figma-api/pending-layout.js.map +1 -1
- package/dist/figma-api/pending-sync.d.ts +1 -1
- package/dist/figma-api/pending-sync.d.ts.map +1 -1
- package/dist/figma-api/pending-sync.js +3 -1
- package/dist/figma-api/pending-sync.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 +2 -1
- package/dist/figma-api/proxy.js.map +1 -1
- package/dist/figma-api/reactions.d.ts +59 -15
- package/dist/figma-api/reactions.d.ts.map +1 -1
- package/dist/figma-api/reactions.js +160 -32
- package/dist/figma-api/reactions.js.map +1 -1
- package/dist/figma-api/render-bounds.js +1 -1
- package/dist/figma-api/surface.d.ts +6 -3
- package/dist/figma-api/surface.d.ts.map +1 -1
- package/dist/figma-api/surface.js +6 -2
- package/dist/figma-api/surface.js.map +1 -1
- package/dist/figma-api/transform.d.ts +1 -1
- package/dist/figma-api/variables/index.d.ts.map +1 -1
- package/dist/figma-api/variables/index.js +2 -2
- package/dist/figma-api/variables/index.js.map +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/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/css/known.js +1 -1
- package/dist/io/formats/design-tokens/css/known.js.map +1 -1
- package/dist/io/formats/design-tokens/css/read.d.ts +3 -1
- package/dist/io/formats/design-tokens/css/read.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/css/read.js +11 -5
- package/dist/io/formats/design-tokens/css/read.js.map +1 -1
- package/dist/io/formats/design-tokens/css/sync.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/css/sync.js +17 -4
- package/dist/io/formats/design-tokens/css/sync.js.map +1 -1
- package/dist/io/formats/design-tokens/css/values.d.ts +6 -5
- package/dist/io/formats/design-tokens/css/values.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/css/values.js +24 -8
- package/dist/io/formats/design-tokens/css/values.js.map +1 -1
- package/dist/io/formats/design-tokens/decode.d.ts +7 -6
- package/dist/io/formats/design-tokens/decode.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/decode.js +14 -13
- package/dist/io/formats/design-tokens/decode.js.map +1 -1
- package/dist/io/formats/design-tokens/export.js +3 -3
- package/dist/io/formats/design-tokens/export.js.map +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/plan/index.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/plan/index.js +4 -3
- package/dist/io/formats/design-tokens/plan/index.js.map +1 -1
- package/dist/io/formats/design-tokens/plan/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/plan/styles.js +9 -9
- package/dist/io/formats/design-tokens/plan/styles.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 +4 -4
- package/dist/io/formats/design-tokens/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/styles.js +7 -7
- 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/design-tokens/values.d.ts +10 -5
- package/dist/io/formats/design-tokens/values.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/values.js +13 -7
- package/dist/io/formats/design-tokens/values.js.map +1 -1
- 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.js +1 -0
- package/dist/io/formats/drawio/index.js.map +1 -1
- package/dist/io/formats/drawio/placement.d.ts +1 -1
- package/dist/io/formats/drawio/warnings.js +2 -2
- package/dist/io/formats/drawio/warnings.js.map +1 -1
- package/dist/io/formats/fig/export/index.d.ts.map +1 -1
- package/dist/io/formats/fig/export/index.js +15 -3
- package/dist/io/formats/fig/export/index.js.map +1 -1
- package/dist/io/formats/fig/export/patch/index.d.ts.map +1 -1
- package/dist/io/formats/fig/export/patch/index.js +7 -1
- package/dist/io/formats/fig/export/patch/index.js.map +1 -1
- package/dist/io/formats/fig/export/setup.d.ts +7 -2
- package/dist/io/formats/fig/export/setup.d.ts.map +1 -1
- package/dist/io/formats/fig/export/setup.js +12 -13
- package/dist/io/formats/fig/export/setup.js.map +1 -1
- package/dist/io/formats/fig/export/variables.d.ts.map +1 -1
- package/dist/io/formats/fig/export/variables.js +9 -7
- package/dist/io/formats/fig/export/variables.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/vectors.d.ts +2 -1
- package/dist/io/formats/html/vectors.d.ts.map +1 -1
- package/dist/io/formats/html/vectors.js +4 -2
- package/dist/io/formats/html/vectors.js.map +1 -1
- package/dist/io/formats/mermaid/layers.js +2 -2
- package/dist/io/formats/mermaid/layers.js.map +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/export.d.ts.map +1 -1
- package/dist/io/formats/pdf/export.js +1 -0
- package/dist/io/formats/pdf/export.js.map +1 -1
- package/dist/io/formats/pdf/prepare.d.ts +4 -4
- package/dist/io/formats/pdf/prepare.d.ts.map +1 -1
- package/dist/io/formats/pdf/prepare.js +2 -2
- package/dist/io/formats/pdf/prepare.js.map +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 +35 -5
- 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/pptx/style.js +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 +1 -1
- package/dist/io/formats/raster/render.d.ts.map +1 -1
- package/dist/io/formats/raster/render.js +13 -4
- package/dist/io/formats/raster/render.js.map +1 -1
- package/dist/io/formats/svg/defs.d.ts +10 -8
- package/dist/io/formats/svg/defs.d.ts.map +1 -1
- package/dist/io/formats/svg/defs.js +13 -64
- 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 +11 -2
- package/dist/io/formats/svg/export.d.ts.map +1 -1
- package/dist/io/formats/svg/export.js +177 -37
- package/dist/io/formats/svg/export.js.map +1 -1
- package/dist/io/formats/svg/filter.d.ts +30 -0
- package/dist/io/formats/svg/filter.d.ts.map +1 -0
- package/dist/io/formats/svg/filter.js +48 -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/import.d.ts +4 -2
- package/dist/io/formats/svg/import.d.ts.map +1 -1
- package/dist/io/formats/svg/import.js +2 -1
- package/dist/io/formats/svg/import.js.map +1 -1
- 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/export.d.ts.map +1 -1
- package/dist/io/formats/svg/text/export.js +8 -8
- package/dist/io/formats/svg/text/export.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 +8 -5
- 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 +41 -11
- package/dist/io/formats.js.map +1 -1
- package/dist/io/subgraph.d.ts.map +1 -1
- package/dist/io/subgraph.js +1 -1
- package/dist/io/subgraph.js.map +1 -1
- package/dist/io/types.d.ts +20 -5
- package/dist/io/types.d.ts.map +1 -1
- package/dist/kiwi/fig/parse/transfer.d.ts +1 -1
- package/dist/kiwi/fig/session/options.d.ts +3 -0
- package/dist/kiwi/fig/session/options.d.ts.map +1 -1
- package/dist/kiwi/fig/session/options.js +4 -0
- package/dist/kiwi/fig/session/options.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/yoga-helpers.d.ts +2 -1
- package/dist/layout/yoga-helpers.d.ts.map +1 -1
- package/dist/layout/yoga-helpers.js +7 -1
- 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 +26 -2
- package/dist/layout.js.map +1 -1
- package/dist/lint/fixes.d.ts.map +1 -1
- package/dist/lint/fixes.js +10 -4
- 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 +12 -0
- package/dist/lint/linter.d.ts.map +1 -1
- package/dist/lint/linter.js +112 -10
- 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/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/types.d.ts +25 -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/comments.d.ts +4 -1
- package/dist/pairdraw-api/comments.d.ts.map +1 -1
- package/dist/pairdraw-api/comments.js +5 -0
- package/dist/pairdraw-api/comments.js.map +1 -1
- 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 +48 -4
- package/dist/pairdraw-api/index.d.ts.map +1 -1
- package/dist/pairdraw-api/index.js +59 -6
- package/dist/pairdraw-api/index.js.map +1 -1
- package/dist/pairdraw-api/nodes.d.ts +13 -2
- 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/analyze-commands.js +1 -1
- package/dist/rpc/read-commands.d.ts +2 -2
- package/dist/rpc/read-commands.js +2 -2
- package/dist/rpc/read-commands.js.map +1 -1
- package/dist/rpc/variables-command.js +2 -2
- package/dist/rpc/variables-command.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 +60 -1
- package/dist/text/font/manager.js.map +1 -1
- package/dist/text/font/provider.d.ts +15 -0
- package/dist/text/font/provider.d.ts.map +1 -0
- package/dist/text/font/provider.js +18 -0
- package/dist/text/font/provider.js.map +1 -0
- package/dist/text/font/readiness.d.ts +32 -0
- package/dist/text/font/readiness.d.ts.map +1 -0
- package/dist/text/font/{status.js → readiness.js} +8 -4
- package/dist/text/font/readiness.js.map +1 -0
- package/dist/text/index.d.ts +12 -9
- package/dist/text/index.js +6 -3
- package/dist/text/prepare.d.ts +9 -4
- package/dist/text/prepare.d.ts.map +1 -1
- package/dist/text/prepare.js +9 -4
- package/dist/text/prepare.js.map +1 -1
- 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/colors.js +1 -1
- 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 +192 -0
- package/dist/tools/analyze/responsive/index.js.map +1 -0
- package/dist/tools/analyze/responsive/widths.d.ts +27 -0
- package/dist/tools/analyze/responsive/widths.d.ts.map +1 -0
- package/dist/tools/analyze/responsive/widths.js +49 -0
- package/dist/tools/analyze/responsive/widths.js.map +1 -0
- package/dist/tools/analyze.d.ts +3 -1
- package/dist/tools/analyze.js +3 -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/tokens.d.ts.map +1 -1
- package/dist/tools/codegen/tokens.js +2 -2
- package/dist/tools/codegen/tokens.js.map +1 -1
- package/dist/tools/codegen.d.ts +2 -1
- package/dist/tools/codegen.js +2 -1
- package/dist/tools/comments.d.ts.map +1 -1
- package/dist/tools/comments.js +2 -2
- package/dist/tools/comments.js.map +1 -1
- package/dist/tools/component-catalog.d.ts.map +1 -1
- package/dist/tools/component-catalog.js +5 -3
- package/dist/tools/component-catalog.js.map +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.d.ts.map +1 -1
- package/dist/tools/create/html.js +2 -3
- 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 +1 -0
- package/dist/tools/create/mermaid.js.map +1 -1
- package/dist/tools/create/svg.js +5 -1
- package/dist/tools/create/svg.js.map +1 -1
- package/dist/tools/create/vector.js +2 -2
- package/dist/tools/create/vector.js.map +1 -1
- package/dist/tools/css/shorthand.d.ts +20 -0
- package/dist/tools/css/shorthand.d.ts.map +1 -0
- package/dist/tools/css/shorthand.js +54 -0
- package/dist/tools/css/shorthand.js.map +1 -0
- package/dist/tools/describe/index.js +2 -2
- package/dist/tools/describe/index.js.map +1 -1
- package/dist/tools/describe/issues.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/html-host.d.ts.map +1 -1
- package/dist/tools/html-host.js +5 -3
- package/dist/tools/html-host.js.map +1 -1
- package/dist/tools/image-ai/apply.d.ts.map +1 -1
- package/dist/tools/image-ai/apply.js +1 -3
- package/dist/tools/image-ai/apply.js.map +1 -1
- package/dist/tools/image-ai/generate.d.ts.map +1 -1
- package/dist/tools/image-ai/generate.js +2 -0
- package/dist/tools/image-ai/generate.js.map +1 -1
- package/dist/tools/image-ai/service.d.ts.map +1 -1
- package/dist/tools/image-ai/service.js +5 -3
- package/dist/tools/image-ai/service.js.map +1 -1
- package/dist/tools/index.d.ts +3 -1
- package/dist/tools/index.js +3 -1
- package/dist/tools/modify/effects.js +1 -1
- package/dist/tools/modify/effects.js.map +1 -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/geometry.d.ts.map +1 -1
- package/dist/tools/modify/geometry.js +14 -3
- package/dist/tools/modify/geometry.js.map +1 -1
- package/dist/tools/modify/layout.d.ts.map +1 -1
- package/dist/tools/modify/layout.js +35 -8
- package/dist/tools/modify/layout.js.map +1 -1
- package/dist/tools/modify/matching.d.ts.map +1 -1
- package/dist/tools/modify/matching.js +10 -10
- package/dist/tools/modify/matching.js.map +1 -1
- package/dist/tools/modify/paint.d.ts.map +1 -1
- package/dist/tools/modify/paint.js +56 -4
- package/dist/tools/modify/paint.js.map +1 -1
- package/dist/tools/modify/reactions.d.ts.map +1 -1
- package/dist/tools/modify/reactions.js +2 -2
- 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 +29 -8
- 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/prompts/codegen.js +1 -1
- package/dist/tools/prompts/codegen.js.map +1 -1
- package/dist/tools/read/css.d.ts +14 -0
- package/dist/tools/read/css.d.ts.map +1 -0
- package/dist/tools/read/css.js +306 -0
- package/dist/tools/read/css.js.map +1 -0
- 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 +1 -0
- package/dist/tools/read/libraries.js.map +1 -1
- package/dist/tools/read/reactions.js +1 -1
- package/dist/tools/read/reactions.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 -5
- package/dist/tools/read/space.js.map +1 -1
- package/dist/tools/read.d.ts +2 -1
- package/dist/tools/read.js +2 -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 +5 -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 +24 -6
- package/dist/tools/schema.d.ts.map +1 -1
- package/dist/tools/schema.js +10 -6
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/script/host.d.ts.map +1 -1
- package/dist/tools/script/host.js +5 -3
- package/dist/tools/script/host.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 +8 -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/variables/collections.js +1 -1
- package/dist/tools/variables/collections.js.map +1 -1
- package/dist/tools/variables/values.d.ts.map +1 -1
- package/dist/tools/variables/values.js +4 -4
- package/dist/tools/variables/values.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/vectorize.d.ts.map +1 -1
- package/dist/tools/vector/vectorize.js +7 -4
- 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 +21 -0
- package/dist/tools/video-host.js.map +1 -0
- package/dist/vector/point-transform.d.ts +1 -1
- package/dist/vector/vectorize/svg/gradients.d.ts +2 -2
- package/dist/vector/vectorize/svg/gradients.d.ts.map +1 -1
- package/dist/vector/vectorize/svg/gradients.js +5 -5
- package/dist/vector/vectorize/svg/gradients.js.map +1 -1
- package/dist/vector/vectorize/svg/to-vectors.d.ts +3 -1
- package/dist/vector/vectorize/svg/to-vectors.d.ts.map +1 -1
- package/dist/vector/vectorize/svg/to-vectors.js +13 -12
- package/dist/vector/vectorize/svg/to-vectors.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 +169 -0
- package/src/canvas/noise/table.ts +91 -0
- package/src/canvas/noise/tile.ts +95 -0
- package/src/canvas/overlays/auto-layout-hover.ts +47 -65
- package/src/canvas/renderer/colors.ts +76 -50
- package/src/canvas/renderer/document-surface.ts +53 -0
- package/src/canvas/renderer/fonts.ts +6 -4
- package/src/canvas/renderer/lifecycle.ts +10 -4
- package/src/canvas/renderer/methods.ts +1 -0
- package/src/canvas/renderer/pipeline.ts +40 -4
- package/src/canvas/renderer/play-scenes.ts +51 -0
- package/src/canvas/renderer/retained-backing.ts +2 -1
- package/src/canvas/renderer/tiles/cache.ts +54 -1
- package/src/canvas/renderer/tiles/controller.ts +30 -1
- package/src/canvas/renderer/tiles/surface-pool.ts +9 -7
- package/src/canvas/renderer/types.ts +18 -2
- package/src/canvas/renderer.ts +76 -14
- package/src/canvas/scene.ts +69 -12
- package/src/canvas/shaders/effect.ts +2 -1
- package/src/canvas/shadows/shape.ts +4 -2
- package/src/canvas/shadows.ts +5 -2
- package/src/canvas/text/decorations.ts +15 -5
- package/src/canvas/text/index.ts +9 -1
- package/src/canvas/text/paragraph/index.ts +16 -6
- package/src/canvas/text/renderer.ts +2 -1
- package/src/canvas/text/shape.ts +4 -4
- package/src/canvas/texture.ts +137 -0
- package/src/clipboard.ts +23 -10
- package/src/constants.ts +6 -0
- 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/assets.ts +6 -2
- package/src/editor/clipboard/component-matches.ts +65 -0
- package/src/editor/clipboard/dependencies.ts +22 -1
- package/src/editor/clipboard/export.ts +24 -7
- package/src/editor/clipboard.ts +74 -20
- package/src/editor/components/instances.ts +31 -0
- package/src/editor/components/properties.ts +3 -2
- package/src/editor/create.ts +25 -69
- 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 +208 -0
- package/src/editor/fonts.ts +19 -0
- package/src/editor/history/atomic-tool.ts +32 -3
- package/src/editor/history/capture.ts +19 -0
- package/src/editor/history/document-change.ts +5 -17
- package/src/editor/history/edit.ts +11 -1
- package/src/editor/history/subtree.ts +13 -2
- package/src/editor/index.ts +11 -0
- package/src/editor/pages.ts +40 -29
- package/src/editor/play/states.ts +1 -1
- package/src/editor/read-only/actions.ts +4 -0
- package/src/editor/render-requests.ts +83 -0
- package/src/editor/selection/overlays.ts +1 -0
- package/src/editor/structure/state.ts +2 -1
- package/src/editor/text.ts +2 -1
- package/src/editor/tool-registry.ts +2 -1
- package/src/editor/types.ts +4 -0
- package/src/editor/variables.ts +3 -3
- 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 +7 -0
- 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/fresh-read.ts +57 -0
- package/src/figma-api/graph-ref.ts +13 -0
- package/src/figma-api/index.ts +22 -4
- package/src/figma-api/overrides.ts +295 -3
- package/src/figma-api/paints.ts +24 -9
- package/src/figma-api/pending-layout.ts +7 -3
- package/src/figma-api/pending-sync.ts +4 -1
- package/src/figma-api/proxy.ts +8 -2
- package/src/figma-api/reactions.ts +212 -33
- package/src/figma-api/surface.ts +6 -2
- package/src/figma-api/variables/index.ts +5 -4
- package/src/global.d.ts +26 -0
- package/src/io/formats/boolean-path.ts +60 -0
- package/src/io/formats/design-tokens/css/known.ts +1 -1
- package/src/io/formats/design-tokens/css/read.ts +20 -7
- package/src/io/formats/design-tokens/css/sync.ts +9 -4
- package/src/io/formats/design-tokens/css/values.ts +37 -9
- package/src/io/formats/design-tokens/decode.ts +17 -12
- package/src/io/formats/design-tokens/export.ts +3 -3
- 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/plan/index.ts +6 -5
- package/src/io/formats/design-tokens/plan/styles.ts +37 -10
- package/src/io/formats/design-tokens/project.ts +40 -9
- package/src/io/formats/design-tokens/styles.ts +20 -9
- package/src/io/formats/design-tokens/sync/apply.ts +130 -0
- package/src/io/formats/design-tokens/sync/drift.ts +589 -0
- package/src/io/formats/design-tokens/sync/files.ts +40 -0
- package/src/io/formats/design-tokens/values.ts +15 -8
- 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 +2 -0
- package/src/io/formats/drawio/warnings.ts +2 -2
- package/src/io/formats/fig/export/index.ts +36 -3
- package/src/io/formats/fig/export/patch/index.ts +12 -1
- package/src/io/formats/fig/export/setup.ts +25 -15
- package/src/io/formats/fig/export/variables.ts +17 -6
- 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/vectors.ts +9 -2
- package/src/io/formats/mermaid/layers.ts +2 -2
- package/src/io/formats/pdf/document.ts +14 -4
- package/src/io/formats/pdf/export.ts +1 -0
- package/src/io/formats/pdf/prepare.ts +6 -6
- package/src/io/formats/pen/imports.ts +5 -6
- package/src/io/formats/pen/index.ts +41 -7
- 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 +24 -5
- package/src/io/formats/svg/defs.ts +24 -80
- package/src/io/formats/svg/effects.ts +131 -0
- package/src/io/formats/svg/export.ts +295 -49
- package/src/io/formats/svg/filter.ts +57 -0
- package/src/io/formats/svg/grain.ts +249 -0
- package/src/io/formats/svg/import.ts +6 -3
- package/src/io/formats/svg/strokes.ts +2 -2
- package/src/io/formats/svg/text/export.ts +10 -8
- package/src/io/formats/svg/text/layout.ts +15 -5
- 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 +66 -11
- package/src/io/subgraph.ts +4 -1
- package/src/io/types.ts +29 -10
- package/src/kiwi/fig/session/options.ts +4 -1
- package/src/layout/auto-layout-handles.ts +396 -0
- package/src/layout/yoga-helpers.ts +8 -0
- package/src/layout.ts +49 -1
- package/src/lint/fixes.ts +12 -3
- package/src/lint/index.ts +3 -1
- package/src/lint/linter.ts +108 -11
- package/src/lint/presets.ts +2 -0
- package/src/lint/rules/design-memory.ts +97 -0
- package/src/lint/rules/index.ts +6 -1
- package/src/lint/rules/no-unbound-token-values.ts +73 -0
- package/src/lint/types.ts +32 -0
- package/src/node/video.ts +196 -0
- package/src/pairdraw-api/comments.ts +6 -0
- package/src/pairdraw-api/design-memory.ts +61 -0
- package/src/pairdraw-api/index.ts +88 -9
- 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/read-commands.ts +4 -4
- package/src/rpc/variables-command.ts +2 -2
- package/src/text/font/features.ts +27 -0
- package/src/text/font/manager.ts +79 -1
- package/src/text/font/provider.ts +26 -0
- package/src/text/font/{status.ts → readiness.ts} +13 -9
- package/src/text/index.ts +4 -1
- package/src/text/prepare.ts +9 -4
- package/src/text/replace-fonts.ts +171 -0
- package/src/tools/analyze/responsive/index.ts +257 -0
- package/src/tools/analyze/responsive/widths.ts +63 -0
- package/src/tools/analyze.ts +4 -0
- package/src/tools/codegen/token-sync.ts +98 -0
- package/src/tools/codegen/tokens.ts +4 -2
- package/src/tools/codegen.ts +1 -0
- package/src/tools/comments.ts +6 -4
- package/src/tools/component-catalog.ts +5 -3
- package/src/tools/create/components.ts +4 -0
- package/src/tools/create/html.ts +1 -3
- package/src/tools/create/icons.ts +2 -1
- package/src/tools/create/mermaid.ts +1 -0
- package/src/tools/create/svg.ts +5 -1
- package/src/tools/create/vector.ts +2 -2
- package/src/tools/css/shorthand.ts +64 -0
- package/src/tools/describe/index.ts +2 -8
- package/src/tools/design-memory.ts +72 -0
- package/src/tools/html-host.ts +5 -3
- package/src/tools/image-ai/apply.ts +0 -2
- package/src/tools/image-ai/generate.ts +2 -0
- package/src/tools/image-ai/service.ts +5 -3
- package/src/tools/index.ts +3 -0
- package/src/tools/modify/effects.ts +1 -1
- package/src/tools/modify/fonts.ts +34 -0
- package/src/tools/modify/geometry.ts +16 -3
- package/src/tools/modify/layout.ts +47 -13
- package/src/tools/modify/matching.ts +14 -11
- package/src/tools/modify/paint.ts +85 -5
- package/src/tools/modify/reactions.ts +16 -8
- package/src/tools/modify/text.ts +56 -15
- package/src/tools/modify/update.ts +46 -2
- package/src/tools/modify.ts +1 -0
- package/src/tools/prompts/codegen.md +2 -1
- package/src/tools/read/css.ts +365 -0
- package/src/tools/read/fonts.ts +24 -2
- package/src/tools/read/libraries.ts +1 -0
- package/src/tools/read/reactions.ts +3 -2
- package/src/tools/read/space.ts +3 -4
- package/src/tools/read.ts +1 -0
- package/src/tools/registry/core.ts +5 -2
- package/src/tools/registry/extended.ts +28 -1
- package/src/tools/schema.ts +42 -9
- package/src/tools/script/host.ts +6 -3
- package/src/tools/stock-photo.ts +1 -0
- package/src/tools/structure/basic.ts +1 -0
- package/src/tools/structure/batch.ts +12 -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/variables/collections.ts +1 -1
- package/src/tools/variables/values.ts +16 -5
- package/src/tools/vector/boolean.ts +4 -0
- package/src/tools/vector/vectorize.ts +11 -4
- package/src/tools/vector/video.ts +228 -0
- package/src/tools/vector.ts +1 -0
- package/src/tools/video-host.ts +20 -0
- package/src/vector/vectorize/svg/gradients.ts +8 -5
- package/src/vector/vectorize/svg/to-vectors.ts +48 -14
- package/dist/text/font/status.d.ts +0 -28
- package/dist/text/font/status.d.ts.map +0 -1
- package/dist/text/font/status.js.map +0 -1
package/src/text/index.ts
CHANGED
|
@@ -2,12 +2,14 @@ export * from './editor'
|
|
|
2
2
|
export * from './style-runs'
|
|
3
3
|
export * from './case'
|
|
4
4
|
export * from './coverage'
|
|
5
|
+
export * from './font/features'
|
|
5
6
|
export * from './font/manager'
|
|
6
7
|
export * from './font/sources'
|
|
7
8
|
export * from './font/style'
|
|
8
9
|
export * from './font/variation'
|
|
9
10
|
export * from './font/woff2'
|
|
10
|
-
export * from './font/
|
|
11
|
+
export * from './font/provider'
|
|
12
|
+
export * from './font/readiness'
|
|
11
13
|
export * from './font/document'
|
|
12
14
|
export { setHarfBuzzSubsetLocator, type HarfBuzzSubsetLocator } from './font/harfbuzz'
|
|
13
15
|
export * from './fallbacks'
|
|
@@ -21,6 +23,7 @@ export * from './prepare'
|
|
|
21
23
|
export * from './font/faces'
|
|
22
24
|
export type { HostFontFamily } from './font/catalog'
|
|
23
25
|
export * from './font/names'
|
|
26
|
+
export * from './replace-fonts'
|
|
24
27
|
export {
|
|
25
28
|
probeGlyphOutlineCommands,
|
|
26
29
|
type GlyphOutlineProbe,
|
package/src/text/prepare.ts
CHANGED
|
@@ -16,7 +16,7 @@ import { collectGraphFontRequirements, collectNodeFontFaces } from '#core/text/r
|
|
|
16
16
|
import { missingGraphFontScripts } from '#core/text/requirements/resolved'
|
|
17
17
|
import { fontFaceDemand, fontResolver } from '#core/text/resolver'
|
|
18
18
|
|
|
19
|
-
import {
|
|
19
|
+
import { readFontReadiness, type FontReadiness } from './font/readiness'
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* The characters of a text its layout falls back to the emoji metrics font for: ones that may be
|
|
@@ -59,14 +59,19 @@ async function settleUnavailableFonts(
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
/**
|
|
63
|
+
* The one readiness read a caller needs: loads every face the document under `nodeIds` asks for,
|
|
64
|
+
* then reports what it can draw with. {@link readFontReadiness} reports the loaded state without
|
|
65
|
+
* loading, for a caller that only mirrors it in the UI.
|
|
66
|
+
*/
|
|
67
|
+
export async function resolveFontReadiness(
|
|
63
68
|
graph: SceneGraph,
|
|
64
69
|
nodeIds: readonly string[],
|
|
65
70
|
/** Characters a writer draws besides the text's own, which the fonts must map too. */
|
|
66
71
|
extraCharacters = '',
|
|
67
72
|
/** An output that draws once and cannot wait for a face to arrive; see `settleUnavailableFonts`. */
|
|
68
73
|
{ settleUnavailable = false }: { settleUnavailable?: boolean } = {}
|
|
69
|
-
): Promise<
|
|
74
|
+
): Promise<FontReadiness> {
|
|
70
75
|
const collected = collectGraphFontRequirements(graph, nodeIds)
|
|
71
76
|
const requirements = extraCharacters
|
|
72
77
|
? {
|
|
@@ -118,5 +123,5 @@ export async function prepareGraphFonts(
|
|
|
118
123
|
requirements.nodes.map(laidOutEmojiCharacters).join('')
|
|
119
124
|
if (emoji && !canDrawPlatformEmoji())
|
|
120
125
|
await fontManager.loadRemoteFont(NOTO_COLOR_EMOJI_FAMILY, 'Regular', emoji)
|
|
121
|
-
return
|
|
126
|
+
return readFontReadiness(graph, nodeIds)
|
|
122
127
|
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { uniqBy } from 'es-toolkit/array'
|
|
2
|
+
|
|
3
|
+
import type { CharacterStyleOverride, SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
4
|
+
|
|
5
|
+
import { fontManager, type FontManager } from './font/manager'
|
|
6
|
+
import { faceForStyle, textFaceName } from './font/names'
|
|
7
|
+
import { textFontFace } from './requirements/collect'
|
|
8
|
+
|
|
9
|
+
/** A face the document draws text in, named as its text names it. */
|
|
10
|
+
export interface DocumentFont {
|
|
11
|
+
family: string
|
|
12
|
+
style: string
|
|
13
|
+
/** True when the host has no face for it, so the text shows a substitute. */
|
|
14
|
+
missing: boolean
|
|
15
|
+
/** How many text layers draw at least one character in it. */
|
|
16
|
+
layerCount: number
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** A face by family and the style name its text gives it. */
|
|
20
|
+
export interface FontFaceReference {
|
|
21
|
+
family: string
|
|
22
|
+
style: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface FontReplacement {
|
|
26
|
+
from: FontFaceReference
|
|
27
|
+
to: FontFaceReference
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface FontReplacementCounts {
|
|
31
|
+
/** Text layers whose own face or one run changed. */
|
|
32
|
+
layers: number
|
|
33
|
+
/** Character runs that changed face. */
|
|
34
|
+
runs: number
|
|
35
|
+
/** Text styles that changed face. */
|
|
36
|
+
styles: number
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface FaceUse {
|
|
40
|
+
family: string
|
|
41
|
+
style: string
|
|
42
|
+
loadStyle: string
|
|
43
|
+
layerIds: Set<string>
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function faceKey(family: string, style: string): string {
|
|
47
|
+
return `${family}\0${style.toLocaleLowerCase()}`
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** The face a node's characters draw in, its own fields overridden by `style`. */
|
|
51
|
+
function faceOf(node: SceneNode, style: CharacterStyleOverride): FaceUse {
|
|
52
|
+
const face = textFontFace(node, style)
|
|
53
|
+
return {
|
|
54
|
+
family: face.family,
|
|
55
|
+
style: textFaceName(node, style),
|
|
56
|
+
loadStyle: face.style,
|
|
57
|
+
layerIds: new Set()
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Every face the document draws text in, missing ones first, counted per text layer. */
|
|
62
|
+
export function listDocumentFonts(
|
|
63
|
+
graph: SceneGraph,
|
|
64
|
+
manager: Pick<FontManager, 'loadedFontSource'> = fontManager
|
|
65
|
+
): DocumentFont[] {
|
|
66
|
+
const uses = new Map<string, FaceUse>()
|
|
67
|
+
const add = (node: SceneNode, style: CharacterStyleOverride) => {
|
|
68
|
+
const face = faceOf(node, style)
|
|
69
|
+
const key = faceKey(face.family, face.style)
|
|
70
|
+
const use = uses.get(key) ?? face
|
|
71
|
+
if (node.type === 'TEXT' && node.sharedStyleType !== 'TEXT') use.layerIds.add(node.id)
|
|
72
|
+
uses.set(key, use)
|
|
73
|
+
}
|
|
74
|
+
for (const node of graph.getAllNodes()) {
|
|
75
|
+
if (node.sharedStyleType === 'TEXT') add(node, {})
|
|
76
|
+
if (node.type !== 'TEXT') continue
|
|
77
|
+
add(node, {})
|
|
78
|
+
for (const run of node.styleRuns) add(node, run.style)
|
|
79
|
+
}
|
|
80
|
+
return uniqBy([...uses.values()], (use) => faceKey(use.family, use.style))
|
|
81
|
+
.map((use) => ({
|
|
82
|
+
family: use.family,
|
|
83
|
+
style: use.style,
|
|
84
|
+
missing: manager.loadedFontSource(use.family, use.loadStyle) === null,
|
|
85
|
+
layerCount: use.layerIds.size
|
|
86
|
+
}))
|
|
87
|
+
.sort(
|
|
88
|
+
(left, right) =>
|
|
89
|
+
Number(right.missing) - Number(left.missing) ||
|
|
90
|
+
left.family.localeCompare(right.family) ||
|
|
91
|
+
left.style.localeCompare(right.style)
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** The fields that draw characters in `face`, as its own font names its face. */
|
|
96
|
+
function faceFields(
|
|
97
|
+
face: FontFaceReference
|
|
98
|
+
): Pick<SceneNode, 'fontFamily' | 'fontWeight' | 'italic' | 'fontStyle'> {
|
|
99
|
+
const resolved = faceForStyle(face.family, face.style)
|
|
100
|
+
return {
|
|
101
|
+
fontFamily: face.family,
|
|
102
|
+
fontWeight: resolved.weight,
|
|
103
|
+
italic: resolved.italic,
|
|
104
|
+
fontStyle: resolved.style
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** A text's runs with every matching face swapped, and how many changed. */
|
|
109
|
+
function replacedRuns(
|
|
110
|
+
node: SceneNode,
|
|
111
|
+
targets: Map<string, FontFaceReference>
|
|
112
|
+
): { runs: SceneNode['styleRuns']; changed: number } {
|
|
113
|
+
let changed = 0
|
|
114
|
+
const runs = node.styleRuns.map((run) => {
|
|
115
|
+
const face = faceOf(node, run.style)
|
|
116
|
+
const to = targets.get(faceKey(face.family, face.style))
|
|
117
|
+
if (!to) return run
|
|
118
|
+
changed += 1
|
|
119
|
+
return { ...run, style: { ...run.style, ...faceFields(to) } }
|
|
120
|
+
})
|
|
121
|
+
return { runs, changed }
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Replaces every use of the given faces, layer by layer, run by run, and in text styles, so the
|
|
126
|
+
* document draws the same characters in the new faces. Other faces keep their runs untouched.
|
|
127
|
+
* Layers that use a replaced text style change with it; their reference stays. OpenType features
|
|
128
|
+
* and variation settings are kept as written; a target face that lacks them draws without them.
|
|
129
|
+
*/
|
|
130
|
+
export function replaceDocumentFonts(
|
|
131
|
+
graph: SceneGraph,
|
|
132
|
+
replacements: readonly FontReplacement[]
|
|
133
|
+
): FontReplacementCounts {
|
|
134
|
+
const targets = new Map<string, FontFaceReference>()
|
|
135
|
+
for (const { from, to } of replacements) {
|
|
136
|
+
const key = faceKey(from.family, from.style)
|
|
137
|
+
if (targets.has(key)) throw new Error(`Font "${from.family} ${from.style}" is replaced twice`)
|
|
138
|
+
targets.set(key, to)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const layerIds = new Set<string>()
|
|
142
|
+
let runs = 0
|
|
143
|
+
let styles = 0
|
|
144
|
+
for (const node of graph.getAllNodes()) {
|
|
145
|
+
if (node.sharedStyleType === 'TEXT') {
|
|
146
|
+
const face = faceOf(node, {})
|
|
147
|
+
const to = targets.get(faceKey(face.family, face.style))
|
|
148
|
+
if (to) {
|
|
149
|
+
graph.updateNode(node.id, faceFields(to))
|
|
150
|
+
styles += 1
|
|
151
|
+
}
|
|
152
|
+
if (node.internalOnly) continue
|
|
153
|
+
}
|
|
154
|
+
if (node.type !== 'TEXT') continue
|
|
155
|
+
|
|
156
|
+
const ownFace = faceOf(node, {})
|
|
157
|
+
const ownTarget = targets.get(faceKey(ownFace.family, ownFace.style))
|
|
158
|
+
if (ownTarget) {
|
|
159
|
+
graph.updateNode(node.id, faceFields(ownTarget))
|
|
160
|
+
layerIds.add(node.id)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const next = replacedRuns(node, targets)
|
|
164
|
+
if (next.changed > 0) {
|
|
165
|
+
runs += next.changed
|
|
166
|
+
layerIds.add(node.id)
|
|
167
|
+
graph.updateNode(node.id, { styleRuns: next.runs })
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return { layers: layerIds.size, runs, styles }
|
|
171
|
+
}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { fromUint8Array } from 'js-base64'
|
|
2
|
+
import * as v from 'valibot'
|
|
3
|
+
|
|
4
|
+
import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
5
|
+
import { computeAbsoluteBounds } from '@pairdraw/scene-graph/geometry'
|
|
6
|
+
|
|
7
|
+
import { measureTextForLayout } from '#core/layout'
|
|
8
|
+
import { collectNodeFontFaces } from '#core/text/requirements/collect'
|
|
9
|
+
import {
|
|
10
|
+
computeOverlaps,
|
|
11
|
+
type OverlapItem,
|
|
12
|
+
type OverlapSeverity
|
|
13
|
+
} from '#core/tools/analyze/overlaps'
|
|
14
|
+
import { layoutFrameAtWidth } from '#core/tools/analyze/responsive/widths'
|
|
15
|
+
import { defineTool, nodeIdInputSchema, toolNumber } from '#core/tools/schema'
|
|
16
|
+
import { boundedRasterScale, rasterScaleInputs } from '#core/tools/vector/export'
|
|
17
|
+
|
|
18
|
+
const DEFAULT_WIDTHS = [375, 768, 1280]
|
|
19
|
+
const DEFAULT_MAX_WARNINGS = 20
|
|
20
|
+
/** A layer is outside its frame, or text overflows its box, only past this many pixels. */
|
|
21
|
+
const TOLERANCE = 1
|
|
22
|
+
|
|
23
|
+
export type ResponsiveWarningKind =
|
|
24
|
+
| 'text-overflow'
|
|
25
|
+
| 'text-truncated'
|
|
26
|
+
| 'child-outside-frame'
|
|
27
|
+
| 'sibling-overlap'
|
|
28
|
+
|
|
29
|
+
export interface ResponsiveWarning {
|
|
30
|
+
kind: ResponsiveWarningKind
|
|
31
|
+
severity: OverlapSeverity | 'warning'
|
|
32
|
+
node_id: string
|
|
33
|
+
node_name: string
|
|
34
|
+
message: string
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface Collected {
|
|
38
|
+
warnings: ResponsiveWarning[]
|
|
39
|
+
/** Warnings dropped for this width because `max_warnings` was reached. */
|
|
40
|
+
dropped: number
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function isContainer(node: SceneNode): boolean {
|
|
44
|
+
return node.type === 'FRAME' || node.type === 'COMPONENT' || node.type === 'INSTANCE'
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function isVisible(node: SceneNode, graph: SceneGraph): boolean {
|
|
48
|
+
let current: SceneNode | undefined = node
|
|
49
|
+
while (current) {
|
|
50
|
+
if (!current.visible) return false
|
|
51
|
+
current = current.parentId ? graph.getNode(current.parentId) : undefined
|
|
52
|
+
}
|
|
53
|
+
return true
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function descendants(graph: SceneGraph, rootId: string): SceneNode[] {
|
|
57
|
+
const nodes: SceneNode[] = []
|
|
58
|
+
const stack = [...(graph.getNode(rootId)?.childIds ?? [])].reverse()
|
|
59
|
+
while (stack.length > 0) {
|
|
60
|
+
const node = graph.getNode(stack.pop() ?? '')
|
|
61
|
+
if (!node) continue
|
|
62
|
+
nodes.push(node)
|
|
63
|
+
for (let index = node.childIds.length - 1; index >= 0; index--) {
|
|
64
|
+
const childId = node.childIds[index]
|
|
65
|
+
if (childId) stack.push(childId)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return nodes
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Text whose measured height no longer fits the box it was given. */
|
|
72
|
+
function textWarnings(node: SceneNode): ResponsiveWarning[] {
|
|
73
|
+
if (node.type !== 'TEXT' || !node.text) return []
|
|
74
|
+
const truncates = node.textAutoResize === 'TRUNCATE' || node.textTruncation === 'ENDING'
|
|
75
|
+
const fixed = node.textAutoResize === 'NONE' || node.textAutoResize === 'TRUNCATE'
|
|
76
|
+
if (!fixed) return []
|
|
77
|
+
const measured = measureTextForLayout(node, node.width).height
|
|
78
|
+
if (measured <= node.height + TOLERANCE) return []
|
|
79
|
+
return [
|
|
80
|
+
truncates
|
|
81
|
+
? {
|
|
82
|
+
kind: 'text-truncated',
|
|
83
|
+
severity: 'info',
|
|
84
|
+
node_id: node.id,
|
|
85
|
+
node_name: node.name,
|
|
86
|
+
message: `Text is truncated: ${Math.round(measured)}px of text in a ${Math.round(node.height)}px box`
|
|
87
|
+
}
|
|
88
|
+
: {
|
|
89
|
+
kind: 'text-overflow',
|
|
90
|
+
severity: 'warning',
|
|
91
|
+
node_id: node.id,
|
|
92
|
+
node_name: node.name,
|
|
93
|
+
message: `Text overflows its box: ${Math.round(measured)}px of text in a ${Math.round(node.height)}px box`
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Direct children whose box reaches past the frame's own box. */
|
|
99
|
+
function outsideWarnings(graph: SceneGraph, frame: SceneNode): ResponsiveWarning[] {
|
|
100
|
+
const frameBounds = computeAbsoluteBounds([frame], graph)
|
|
101
|
+
const warnings: ResponsiveWarning[] = []
|
|
102
|
+
for (const childId of frame.childIds) {
|
|
103
|
+
const child = graph.getNode(childId)
|
|
104
|
+
if (!child || !isVisible(child, graph)) continue
|
|
105
|
+
const bounds = computeAbsoluteBounds([child], graph)
|
|
106
|
+
const outside =
|
|
107
|
+
bounds.x < frameBounds.x - TOLERANCE ||
|
|
108
|
+
bounds.y < frameBounds.y - TOLERANCE ||
|
|
109
|
+
bounds.x + bounds.width > frameBounds.x + frameBounds.width + TOLERANCE ||
|
|
110
|
+
bounds.y + bounds.height > frameBounds.y + frameBounds.height + TOLERANCE
|
|
111
|
+
if (!outside) continue
|
|
112
|
+
warnings.push({
|
|
113
|
+
kind: 'child-outside-frame',
|
|
114
|
+
severity: 'warning',
|
|
115
|
+
node_id: child.id,
|
|
116
|
+
node_name: child.name,
|
|
117
|
+
message: `${child.name} reaches outside the ${Math.round(frame.width)}px frame`
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
return warnings
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function laterSibling(graph: SceneGraph, item: OverlapItem): { later: string; earlier: string } {
|
|
124
|
+
const parentId = item.nodeA.parentId
|
|
125
|
+
const order = parentId ? (graph.getNode(parentId)?.childIds ?? []) : []
|
|
126
|
+
const a = order.indexOf(item.nodeA.id)
|
|
127
|
+
const b = order.indexOf(item.nodeB.id)
|
|
128
|
+
return b >= a
|
|
129
|
+
? { later: item.nodeB.id, earlier: item.nodeA.id }
|
|
130
|
+
: { later: item.nodeA.id, earlier: item.nodeB.id }
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function overlapWarnings(graph: SceneGraph, pageId: string, limit: number): ResponsiveWarning[] {
|
|
134
|
+
if (limit <= 0) return []
|
|
135
|
+
const result = computeOverlaps(graph, { scope: 'same-parent', page_id: pageId, limit })
|
|
136
|
+
const warnings: ResponsiveWarning[] = []
|
|
137
|
+
for (const item of result.overlaps) {
|
|
138
|
+
if (item.category !== 'sibling-overlap') continue
|
|
139
|
+
const { later, earlier } = laterSibling(graph, item)
|
|
140
|
+
const node = graph.getNode(later)
|
|
141
|
+
warnings.push({
|
|
142
|
+
kind: 'sibling-overlap',
|
|
143
|
+
severity: item.severity,
|
|
144
|
+
node_id: later,
|
|
145
|
+
node_name: node?.name ?? later,
|
|
146
|
+
message: `${node?.name ?? later} overlaps ${graph.getNode(earlier)?.name ?? earlier}`
|
|
147
|
+
})
|
|
148
|
+
if (warnings.length >= limit) break
|
|
149
|
+
}
|
|
150
|
+
return warnings
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function collectWarnings(
|
|
154
|
+
graph: SceneGraph,
|
|
155
|
+
frame: SceneNode,
|
|
156
|
+
pageId: string,
|
|
157
|
+
maxWarnings: number
|
|
158
|
+
): Collected {
|
|
159
|
+
const found: ResponsiveWarning[] = [
|
|
160
|
+
...outsideWarnings(graph, frame),
|
|
161
|
+
...descendants(graph, frame.id).flatMap((node) => textWarnings(node)),
|
|
162
|
+
...overlapWarnings(graph, pageId, maxWarnings)
|
|
163
|
+
]
|
|
164
|
+
return {
|
|
165
|
+
warnings: found.slice(0, maxWarnings),
|
|
166
|
+
dropped: Math.max(0, found.length - maxWarnings)
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** The width a copy is laid out at, never below one pixel. */
|
|
171
|
+
function clampWidth(width: number): number {
|
|
172
|
+
return Math.max(1, Math.round(width))
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export const checkResponsive = defineTool({
|
|
176
|
+
name: 'check_responsive',
|
|
177
|
+
|
|
178
|
+
description:
|
|
179
|
+
'Lay out and render a copy of a frame at several viewport widths without changing the document, and report text overflow, layers outside the frame, and overlapping siblings at each width. Auto-layout children reflow; children placed by free x/y keep their position, as constraints are not applied.',
|
|
180
|
+
execution: { kind: 'async', mutation: 'none' },
|
|
181
|
+
exposure: { webmcp: false },
|
|
182
|
+
input: v.strictObject({
|
|
183
|
+
id: nodeIdInputSchema,
|
|
184
|
+
widths: v.optional(
|
|
185
|
+
v.pipe(
|
|
186
|
+
v.array(toolNumber(v.pipe(v.number(), v.minValue(1), v.maxValue(4096)))),
|
|
187
|
+
v.minLength(1),
|
|
188
|
+
v.maxLength(12),
|
|
189
|
+
v.description(
|
|
190
|
+
'Viewport widths to test in the same units as the frame (default: 375, 768, 1280)'
|
|
191
|
+
)
|
|
192
|
+
)
|
|
193
|
+
),
|
|
194
|
+
max_warnings: v.optional(
|
|
195
|
+
toolNumber(
|
|
196
|
+
v.pipe(
|
|
197
|
+
v.number(),
|
|
198
|
+
v.minValue(0),
|
|
199
|
+
v.maxValue(200),
|
|
200
|
+
v.description('Warnings reported per width (default: 20)')
|
|
201
|
+
)
|
|
202
|
+
),
|
|
203
|
+
DEFAULT_MAX_WARNINGS
|
|
204
|
+
),
|
|
205
|
+
...rasterScaleInputs
|
|
206
|
+
}),
|
|
207
|
+
// Every face the frame draws text with must load before the copy is measured.
|
|
208
|
+
fonts: (figma, { id }) => {
|
|
209
|
+
const node = figma.graph.getNode(id)
|
|
210
|
+
return node ? descendants(figma.graph, node.id).flatMap(collectNodeFontFaces) : []
|
|
211
|
+
},
|
|
212
|
+
execute: async (figma, args) => {
|
|
213
|
+
const node = figma.graph.getNode(args.id)
|
|
214
|
+
if (!node) return { error: `Node "${args.id}" not found` }
|
|
215
|
+
if (!isContainer(node)) {
|
|
216
|
+
return { error: `Node "${args.id}" is a ${node.type}; check_responsive needs a frame` }
|
|
217
|
+
}
|
|
218
|
+
if (!figma.exportGraphImage) {
|
|
219
|
+
return { error: 'Responsive rendering is not available in this environment' }
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const widths = (args.widths ?? DEFAULT_WIDTHS).map(clampWidth)
|
|
223
|
+
const maxWarnings = args.max_warnings
|
|
224
|
+
const results = []
|
|
225
|
+
|
|
226
|
+
for (const width of widths) {
|
|
227
|
+
const laid = layoutFrameAtWidth(figma.graph, figma.currentPageId, node.id, width)
|
|
228
|
+
if (!laid) continue
|
|
229
|
+
const { graph: copy, pageId, frame: target } = laid
|
|
230
|
+
|
|
231
|
+
const { warnings, dropped } = collectWarnings(copy, target, pageId, maxWarnings)
|
|
232
|
+
const scale = boundedRasterScale(target.width, target.height, args.scale, args.maxEdge)
|
|
233
|
+
const bytes = await figma.exportGraphImage(copy, pageId, [node.id], {
|
|
234
|
+
scale,
|
|
235
|
+
format: 'PNG'
|
|
236
|
+
})
|
|
237
|
+
if (!bytes) return { error: `Width ${width} could not be rendered` }
|
|
238
|
+
|
|
239
|
+
results.push({
|
|
240
|
+
width,
|
|
241
|
+
height: Math.round(target.height),
|
|
242
|
+
mimeType: 'image/png',
|
|
243
|
+
base64: fromUint8Array(bytes),
|
|
244
|
+
byteLength: bytes.length,
|
|
245
|
+
warnings,
|
|
246
|
+
...(dropped > 0 ? { dropped_warnings: dropped } : {})
|
|
247
|
+
})
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
return {
|
|
251
|
+
id: node.id,
|
|
252
|
+
name: node.name,
|
|
253
|
+
widths: results,
|
|
254
|
+
warningCount: results.reduce((total, entry) => total + entry.warnings.length, 0)
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
})
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
2
|
+
|
|
3
|
+
import { extractExportGraph } from '#core/io/subgraph'
|
|
4
|
+
import { computeLayout, sizeAutoResizingText } from '#core/layout'
|
|
5
|
+
|
|
6
|
+
/** The narrower widths a responsive frame is rendered at, when they fit under its own. */
|
|
7
|
+
const NARROW_WIDTHS = [375, 768] as const
|
|
8
|
+
|
|
9
|
+
/** Below this a narrow render says nothing a phone-sized frame has not already shown. */
|
|
10
|
+
const MIN_NARROW_WIDTH = 240
|
|
11
|
+
|
|
12
|
+
/** A layout that misses the requested width by more than this was clamped, not reflowed. */
|
|
13
|
+
const CLAMP_TOLERANCE = 1
|
|
14
|
+
|
|
15
|
+
export interface FrameAtWidth {
|
|
16
|
+
/** A copy holding only the frame's subtree, laid out at `requested`. */
|
|
17
|
+
graph: SceneGraph
|
|
18
|
+
pageId: string
|
|
19
|
+
frame: SceneNode
|
|
20
|
+
/** The width the copy was asked for, rounded. */
|
|
21
|
+
requested: number
|
|
22
|
+
/** Whether the frame's own min or max width moved it away from `requested`. */
|
|
23
|
+
clamped: boolean
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The narrower widths to render a frame at: 375 and 768, each kept only when it is narrower
|
|
28
|
+
* than the frame and wide enough to be worth a render. Rounded, so a fractional width compares
|
|
29
|
+
* as its whole pixels.
|
|
30
|
+
*/
|
|
31
|
+
export function widthVariants(frameWidth: number): number[] {
|
|
32
|
+
const own = Math.round(frameWidth)
|
|
33
|
+
return NARROW_WIDTHS.filter((width) => width >= MIN_NARROW_WIDTH && width < own)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A copy of the frame and its subtree laid out at `width`, with auto-resizing text sized for it.
|
|
38
|
+
* The input graph is not touched. `clamped` reports that the frame's own min or max width held
|
|
39
|
+
* it away from the requested width, so a caller can drop a render it cannot label honestly.
|
|
40
|
+
*/
|
|
41
|
+
export function layoutFrameAtWidth(
|
|
42
|
+
graph: SceneGraph,
|
|
43
|
+
pageId: string,
|
|
44
|
+
frameId: string,
|
|
45
|
+
width: number
|
|
46
|
+
): FrameAtWidth | null {
|
|
47
|
+
const extracted = extractExportGraph(graph, { scope: 'node', nodeId: frameId })
|
|
48
|
+
const copy = extracted.graph
|
|
49
|
+
if (!copy.getNode(frameId)) return null
|
|
50
|
+
const requested = Math.max(1, Math.round(width))
|
|
51
|
+
copy.updateNode(frameId, { width: requested })
|
|
52
|
+
sizeAutoResizingText(copy, frameId)
|
|
53
|
+
computeLayout(copy, frameId)
|
|
54
|
+
const frame = copy.getNode(frameId)
|
|
55
|
+
if (!frame) return null
|
|
56
|
+
return {
|
|
57
|
+
graph: copy,
|
|
58
|
+
pageId: extracted.pageId ?? pageId,
|
|
59
|
+
frame,
|
|
60
|
+
requested,
|
|
61
|
+
clamped: Math.abs(frame.width - requested) > CLAMP_TOLERANCE
|
|
62
|
+
}
|
|
63
|
+
}
|
package/src/tools/analyze.ts
CHANGED
|
@@ -14,6 +14,10 @@ export { evalCode } from './analyze/eval'
|
|
|
14
14
|
export { lint, lintFix } from './analyze/lint'
|
|
15
15
|
export { compileScript, wrapEvalCode } from './analyze/eval/wrap'
|
|
16
16
|
export { analyzeOverlaps, computeOverlaps } from './analyze/overlaps'
|
|
17
|
+
export { checkResponsive } from './analyze/responsive'
|
|
18
|
+
export type { ResponsiveWarning, ResponsiveWarningKind } from './analyze/responsive'
|
|
19
|
+
export { layoutFrameAtWidth, widthVariants } from './analyze/responsive/widths'
|
|
20
|
+
export type { FrameAtWidth } from './analyze/responsive/widths'
|
|
17
21
|
export type {
|
|
18
22
|
AnalyzeOverlapsArgs,
|
|
19
23
|
AnalyzeOverlapsResult,
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as v from 'valibot'
|
|
2
|
+
|
|
3
|
+
import type { FigmaAPI } from '#core/figma-api'
|
|
4
|
+
import { analysisLimitInputSchema } from '#core/tools/analyze/schema'
|
|
5
|
+
import { defineTool } from '#core/tools/schema'
|
|
6
|
+
|
|
7
|
+
const sourceFilesSchema = v.pipe(
|
|
8
|
+
v.array(v.object({ path: v.string(), text: v.string() })),
|
|
9
|
+
v.minLength(1),
|
|
10
|
+
v.description(
|
|
11
|
+
'The linked code, each file with its path and text: stylesheets with CSS custom properties or a Tailwind v4 @theme (and components.json), or W3C design token JSON files'
|
|
12
|
+
)
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
export const tokenDrift = defineTool({
|
|
16
|
+
name: 'token_drift',
|
|
17
|
+
description:
|
|
18
|
+
'Compare design tokens in code with the document variables, without changing anything. Pass the stylesheets (CSS custom properties, Tailwind v4 @theme, shadcn/ui :root/.dark) or W3C design token files. Each finding names the collection, variable, and mode, the value in code and on the canvas, and its kind: code (changed in code since the last sync), canvas (changed on the canvas), conflict (changed on both, or never synced), added (new in code), missing (gone from code), or deleted (deleted on the canvas while the code still has it). With include_layers it also lists layers on the current page that use a raw color, radius, spacing, or font size a token holds without being bound to it.',
|
|
19
|
+
execution: { kind: 'async', mutation: 'none' },
|
|
20
|
+
input: v.strictObject({
|
|
21
|
+
files: sourceFilesSchema,
|
|
22
|
+
include_layers: v.optional(
|
|
23
|
+
v.pipe(
|
|
24
|
+
v.boolean(),
|
|
25
|
+
v.description('Also list layers on the current page with raw values a token holds')
|
|
26
|
+
),
|
|
27
|
+
false
|
|
28
|
+
),
|
|
29
|
+
limit: analysisLimitInputSchema
|
|
30
|
+
}),
|
|
31
|
+
execute: async (figma, args) => {
|
|
32
|
+
const { planTokenSync } = await import('#core/io/formats/design-tokens/sync/drift')
|
|
33
|
+
const { readTokenSourceFiles } = await import('#core/io/formats/design-tokens/sync/files')
|
|
34
|
+
const { tokenSourceForFiles } = await import('#core/io/formats/design-tokens/sync/apply')
|
|
35
|
+
const { bundles, issues } = readTokenSourceFiles(figma.graph, args.files)
|
|
36
|
+
const { drift } = planTokenSync(
|
|
37
|
+
figma.graph,
|
|
38
|
+
bundles,
|
|
39
|
+
tokenSourceForFiles(figma.graph, args.files)
|
|
40
|
+
)
|
|
41
|
+
const result = {
|
|
42
|
+
in_sync: drift.length === 0,
|
|
43
|
+
total: drift.length,
|
|
44
|
+
drift: drift.slice(0, args.limit),
|
|
45
|
+
issues
|
|
46
|
+
}
|
|
47
|
+
if (!args.include_layers) return result
|
|
48
|
+
return { ...result, layers: await unboundLayers(figma, args.limit) }
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
/** The lint rules that find raw values a token holds: colors, and radii, spacing, font sizes. */
|
|
53
|
+
const TOKEN_VALUE_RULES = ['no-hardcoded-colors', 'no-unbound-token-values']
|
|
54
|
+
|
|
55
|
+
/** Layers on the current page that hold a token's value without being bound to it. */
|
|
56
|
+
async function unboundLayers(figma: FigmaAPI, limit: number) {
|
|
57
|
+
const { createLinter } = await import('#core/lint')
|
|
58
|
+
const linter = createLinter({
|
|
59
|
+
rules: TOKEN_VALUE_RULES,
|
|
60
|
+
config: { rules: Object.fromEntries(TOKEN_VALUE_RULES.map((rule) => [rule, 'info'])) }
|
|
61
|
+
})
|
|
62
|
+
return linter
|
|
63
|
+
.lintGraph(figma.graph, [figma.currentPageId])
|
|
64
|
+
.messages.slice(0, limit)
|
|
65
|
+
.map(({ nodeId, nodeName, ruleId, message, fix }) => ({
|
|
66
|
+
nodeId,
|
|
67
|
+
name: nodeName,
|
|
68
|
+
rule: ruleId,
|
|
69
|
+
message,
|
|
70
|
+
...(fix ? { fix } : {})
|
|
71
|
+
}))
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const syncTokens = defineTool({
|
|
75
|
+
name: 'sync_tokens',
|
|
76
|
+
description:
|
|
77
|
+
'Bring design tokens from code into the document variables and remember the link, so later syncs and token_drift know which side changed. Pass the same files as token_drift. Values changed only in code and tokens new in code always come in. A token changed on the canvas or on both sides follows conflicts: skip (default) leaves it as it is for a person to review, code takes the value in code, canvas keeps the canvas value. Tokens gone from code keep their variables. Returns how many tokens came in and what was left.',
|
|
78
|
+
execution: { kind: 'async', mutation: 'document' },
|
|
79
|
+
input: v.strictObject({
|
|
80
|
+
files: sourceFilesSchema,
|
|
81
|
+
conflicts: v.optional(
|
|
82
|
+
v.pipe(
|
|
83
|
+
v.picklist(['skip', 'code', 'canvas']),
|
|
84
|
+
v.description('What a token changed on the canvas or on both sides takes (default skip)')
|
|
85
|
+
),
|
|
86
|
+
'skip'
|
|
87
|
+
),
|
|
88
|
+
limit: analysisLimitInputSchema
|
|
89
|
+
}),
|
|
90
|
+
execute: async (figma, args) => {
|
|
91
|
+
const { syncTokenFiles } = await import('#core/io/formats/design-tokens/sync/apply')
|
|
92
|
+
const { conflicts } = args
|
|
93
|
+
const result = syncTokenFiles(figma.graph, args.files, {
|
|
94
|
+
conflicts: conflicts === 'skip' ? undefined : conflicts
|
|
95
|
+
})
|
|
96
|
+
return { ...result, left: result.left.slice(0, args.limit) }
|
|
97
|
+
}
|
|
98
|
+
})
|
|
@@ -27,12 +27,14 @@ export async function exportTokenStylesheet(
|
|
|
27
27
|
): Promise<TokenExport> {
|
|
28
28
|
const query = options.collection?.toLowerCase()
|
|
29
29
|
const collectionIds = new Set(
|
|
30
|
-
|
|
30
|
+
graph
|
|
31
|
+
.getLiveCollections()
|
|
31
32
|
.filter((collection) => !query || collection.name.toLowerCase().includes(query))
|
|
32
33
|
.map((collection) => collection.id)
|
|
33
34
|
)
|
|
34
35
|
const ids = new Set(
|
|
35
|
-
|
|
36
|
+
graph
|
|
37
|
+
.getLiveVariables()
|
|
36
38
|
.filter((variable) => collectionIds.has(variable.collectionId))
|
|
37
39
|
.filter((variable) => !options.type || variable.type === options.type)
|
|
38
40
|
.map((variable) => variable.id)
|
package/src/tools/codegen.ts
CHANGED