@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
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
} from '@pairdraw/dom-css/export'
|
|
17
17
|
import {
|
|
18
18
|
isLibraryCollection,
|
|
19
|
+
type ColorProfile,
|
|
19
20
|
type SceneGraph,
|
|
20
21
|
type TokenUnit,
|
|
21
22
|
type Variable,
|
|
@@ -39,6 +40,8 @@ import { namesFont, readCSSTokenValue, type CSSTokenValue } from './values'
|
|
|
39
40
|
export interface CSSTokenReadOptions {
|
|
40
41
|
/** The stylesheet's file name, for issues. */
|
|
41
42
|
file?: string
|
|
43
|
+
/** The document's profile: a color that names its space converts into it. */
|
|
44
|
+
profile?: ColorProfile
|
|
42
45
|
/**
|
|
43
46
|
* What a numeric CSS expression such as `clamp(1rem, 4vw, 1.5rem)` comes to in `unit`, with
|
|
44
47
|
* the custom properties in scope by name (`--space`). A browser computes it; without one, an
|
|
@@ -106,9 +109,9 @@ class CSSTokenReader {
|
|
|
106
109
|
group(name: string): Group {
|
|
107
110
|
const found = this.groups.get(name)
|
|
108
111
|
if (found) return found
|
|
109
|
-
const existing =
|
|
110
|
-
|
|
111
|
-
|
|
112
|
+
const existing = this.graph
|
|
113
|
+
.getLiveCollections()
|
|
114
|
+
.find((collection) => collection.name === name && !isLibraryCollection(collection))
|
|
112
115
|
const defaultName =
|
|
113
116
|
existing?.modes.find((mode) => mode.modeId === existing.defaultModeId)?.name ?? 'Default'
|
|
114
117
|
const group: Group = {
|
|
@@ -245,7 +248,7 @@ class CSSTokenReader {
|
|
|
245
248
|
const property = cssTokenProperty(token)
|
|
246
249
|
const value = property && scope.get(property)
|
|
247
250
|
if (!value) continue
|
|
248
|
-
const read = readCSSTokenValue(value)
|
|
251
|
+
const read = readCSSTokenValue(value, { profile: this.options.profile })
|
|
249
252
|
if (read.kind === 'number') return read.unit
|
|
250
253
|
if (read.kind === 'expression' && read.unit) return read.unit
|
|
251
254
|
}
|
|
@@ -282,10 +285,17 @@ class CSSTokenReader {
|
|
|
282
285
|
): ReadToken {
|
|
283
286
|
const existing = this.existingVariable(name, group)
|
|
284
287
|
const tokenName = this.tokenName(name, group)
|
|
285
|
-
const value = readCSSTokenValue(css, {
|
|
288
|
+
const value = readCSSTokenValue(css, {
|
|
289
|
+
font: namesFont(name),
|
|
290
|
+
profile: this.options.profile
|
|
291
|
+
})
|
|
286
292
|
let fields: TokenFields
|
|
287
293
|
if (value.kind === 'reference') fields = this.alias(value.name)
|
|
288
|
-
else if (value.kind === 'color')
|
|
294
|
+
else if (value.kind === 'color')
|
|
295
|
+
fields = {
|
|
296
|
+
type: 'color',
|
|
297
|
+
value: colorTokenValue(value.color, this.options.profile)
|
|
298
|
+
}
|
|
289
299
|
else if (value.kind === 'number')
|
|
290
300
|
fields = { ...numberToken(value.value, value.unit), unit: value.unit }
|
|
291
301
|
else if (value.kind === 'string') fields = { type: 'string', value: value.value }
|
|
@@ -389,7 +399,10 @@ export function readCSSDesignTokens(
|
|
|
389
399
|
} catch {
|
|
390
400
|
return { collections: [], composites: [], issues: [{ kind: 'invalid-file', file }] }
|
|
391
401
|
}
|
|
392
|
-
const reader = new CSSTokenReader(graph, knownTokens(graph), file,
|
|
402
|
+
const reader = new CSSTokenReader(graph, knownTokens(graph), file, {
|
|
403
|
+
...options,
|
|
404
|
+
profile: options.profile ?? graph.documentColorSpace
|
|
405
|
+
})
|
|
393
406
|
reader.read(sheet)
|
|
394
407
|
const issues: DesignTokenReadIssue[] = [
|
|
395
408
|
...sheet.skipped.map((rule): DesignTokenReadIssue => ({ kind: 'unsupported-css', file, rule })),
|
|
@@ -107,6 +107,8 @@ export function patchTokenStylesheet(
|
|
|
107
107
|
const wanted = wantedScopes(generated)
|
|
108
108
|
const base = wanted.get('')?.values ?? new Map<string, string>()
|
|
109
109
|
const known = knownTokens(graph)
|
|
110
|
+
// A color that names its own space converts into the profile, and a written one comes from it.
|
|
111
|
+
const profile = graph.documentColorSpace
|
|
110
112
|
|
|
111
113
|
/**
|
|
112
114
|
* What a scope should declare for a property. A mode writes only what differs from its default,
|
|
@@ -136,13 +138,13 @@ export function patchTokenStylesheet(
|
|
|
136
138
|
const want = expected(key, declaration.name)
|
|
137
139
|
if (want === undefined) continue
|
|
138
140
|
const font = namesFont(declaration.name)
|
|
139
|
-
const previous = readCSSTokenValue(declaration.value, { font })
|
|
140
|
-
const next = readCSSTokenValue(want, { font })
|
|
141
|
+
const previous = readCSSTokenValue(declaration.value, { font, profile })
|
|
142
|
+
const next = readCSSTokenValue(want, { font, profile })
|
|
141
143
|
if (sameCSSTokenValue(previous, next)) continue
|
|
142
144
|
edits.push({
|
|
143
145
|
start: declaration.start,
|
|
144
146
|
end: declaration.end,
|
|
145
|
-
text: rewriteCSSTokenValue(previous, next, want)
|
|
147
|
+
text: rewriteCSSTokenValue(previous, next, want, profile)
|
|
146
148
|
})
|
|
147
149
|
updated++
|
|
148
150
|
}
|
|
@@ -160,7 +162,10 @@ export function patchTokenStylesheet(
|
|
|
160
162
|
const from = key === '' ? undefined : inherited.get(name)
|
|
161
163
|
if (from === undefined) return false
|
|
162
164
|
const font = namesFont(name)
|
|
163
|
-
return sameCSSTokenValue(
|
|
165
|
+
return sameCSSTokenValue(
|
|
166
|
+
readCSSTokenValue(from, { font, profile }),
|
|
167
|
+
readCSSTokenValue(value, { font, profile })
|
|
168
|
+
)
|
|
164
169
|
}
|
|
165
170
|
|
|
166
171
|
let added = 0
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { converter, formatHex, formatHex8 } from 'culori'
|
|
1
|
+
import { converter, formatHex, formatHex8, parse } from 'culori'
|
|
2
2
|
|
|
3
3
|
import { cssTokenProperty, cssValueTokens } from '@pairdraw/dom-css/export'
|
|
4
|
-
import type { TokenUnit } from '@pairdraw/scene-graph'
|
|
5
|
-
import {
|
|
4
|
+
import type { ColorProfile, TokenUnit } from '@pairdraw/scene-graph'
|
|
5
|
+
import {
|
|
6
|
+
colorToCSS,
|
|
7
|
+
parseDisplayableColor,
|
|
8
|
+
SRGB_SYNTAX_MODES,
|
|
9
|
+
tryParseColor
|
|
10
|
+
} from '@pairdraw/scene-graph/color'
|
|
6
11
|
import type { Color } from '@pairdraw/scene-graph/primitives'
|
|
7
12
|
import { tokenNumberFromUnit, tokenNumberInUnit } from '@pairdraw/scene-graph/variables'
|
|
8
13
|
|
|
@@ -114,12 +119,26 @@ function firstFamily(css: string): string | undefined {
|
|
|
114
119
|
return family || undefined
|
|
115
120
|
}
|
|
116
121
|
|
|
122
|
+
/**
|
|
123
|
+
* A CSS color in the document's profile: hex, `rgb()`, `hsl()` and `hwb()` give their numbers as
|
|
124
|
+
* the document's own, as an imported stylesheet writes them, and a color that names its space,
|
|
125
|
+
* such as `oklch()` or `color(display-p3 …)`, is converted into that profile.
|
|
126
|
+
*/
|
|
127
|
+
function readColor(value: string, profile: ColorProfile): Color | null {
|
|
128
|
+
const parsed = parse(value)
|
|
129
|
+
if (!parsed || SRGB_SYNTAX_MODES.has(parsed.mode)) return parseDisplayableColor(value)
|
|
130
|
+
return tryParseColor(value, profile)
|
|
131
|
+
}
|
|
132
|
+
|
|
117
133
|
/**
|
|
118
134
|
* A custom property's value as a token: a color, a number in a token unit, a quoted string, a
|
|
119
135
|
* font family where the property names fonts, a `var()` reference, a numeric expression, or
|
|
120
136
|
* something no variable holds, such as a shadow.
|
|
121
137
|
*/
|
|
122
|
-
export function readCSSTokenValue(
|
|
138
|
+
export function readCSSTokenValue(
|
|
139
|
+
css: string,
|
|
140
|
+
{ font = false, profile = 'srgb' }: { font?: boolean; profile?: ColorProfile } = {}
|
|
141
|
+
): CSSTokenValue {
|
|
123
142
|
const value = css.trim()
|
|
124
143
|
const tokens = cssValueTokens(value)
|
|
125
144
|
const [only] = tokens
|
|
@@ -137,7 +156,7 @@ export function readCSSTokenValue(css: string, { font = false } = {}): CSSTokenV
|
|
|
137
156
|
)
|
|
138
157
|
if (color) return { kind: 'color', color, notation: 'hsl-channels' }
|
|
139
158
|
}
|
|
140
|
-
const color =
|
|
159
|
+
const color = readColor(value, profile)
|
|
141
160
|
if (color) return { kind: 'color', color, notation: notationOf(value) }
|
|
142
161
|
const expression = readExpression(value)
|
|
143
162
|
if (expression) return expression
|
|
@@ -211,8 +230,16 @@ const toOklab = converter('oklab')
|
|
|
211
230
|
const toOklch = converter('oklch')
|
|
212
231
|
|
|
213
232
|
/** A color written in a notation: `oklch(0.7 0.19 41)`, `#ff5b2e`, `16 100% 59%`. */
|
|
214
|
-
export function formatCSSColor(
|
|
215
|
-
|
|
233
|
+
export function formatCSSColor(
|
|
234
|
+
color: Color,
|
|
235
|
+
notation: ColorNotation,
|
|
236
|
+
profile: ColorProfile = 'srgb'
|
|
237
|
+
): string {
|
|
238
|
+
// The components sit in the document's profile, so the notation is derived from that space.
|
|
239
|
+
const rgb =
|
|
240
|
+
profile === 'display-p3'
|
|
241
|
+
? { mode: 'p3' as const, r: color.r, g: color.g, b: color.b, alpha: color.a }
|
|
242
|
+
: { mode: 'rgb' as const, r: color.r, g: color.g, b: color.b, alpha: color.a }
|
|
216
243
|
const a = alphaSuffix(color.a)
|
|
217
244
|
switch (notation) {
|
|
218
245
|
case 'rgb':
|
|
@@ -255,10 +282,11 @@ export function formatCSSColor(color: Color, notation: ColorNotation): string {
|
|
|
255
282
|
export function rewriteCSSTokenValue(
|
|
256
283
|
previous: CSSTokenValue,
|
|
257
284
|
next: CSSTokenValue,
|
|
258
|
-
nextCSS: string
|
|
285
|
+
nextCSS: string,
|
|
286
|
+
profile: ColorProfile = 'srgb'
|
|
259
287
|
): string {
|
|
260
288
|
if (previous.kind === 'color' && next.kind === 'color' && previous.notation !== 'other')
|
|
261
|
-
return formatCSSColor(next.color, previous.notation)
|
|
289
|
+
return formatCSSColor(next.color, previous.notation, profile)
|
|
262
290
|
if (
|
|
263
291
|
previous.kind === 'number' &&
|
|
264
292
|
next.kind === 'number' &&
|
|
@@ -5,11 +5,12 @@ import {
|
|
|
5
5
|
TOKEN_UNITS,
|
|
6
6
|
VARIABLE_SCOPES,
|
|
7
7
|
type CodeSyntaxPlatform,
|
|
8
|
+
type DocumentColorSpace,
|
|
8
9
|
type TokenUnit,
|
|
9
10
|
type VariableScope,
|
|
10
11
|
type VariableType
|
|
11
12
|
} from '@pairdraw/scene-graph'
|
|
12
|
-
import {
|
|
13
|
+
import { tryParseColor } from '@pairdraw/scene-graph/color'
|
|
13
14
|
import { parseCSSNumber } from '@pairdraw/scene-graph/css'
|
|
14
15
|
import type { Color } from '@pairdraw/scene-graph/primitives'
|
|
15
16
|
import { ROOT_FONT_SIZE_PX } from '@pairdraw/scene-graph/variables'
|
|
@@ -53,12 +54,13 @@ const colorObjectSchema = v.object({
|
|
|
53
54
|
})
|
|
54
55
|
|
|
55
56
|
/**
|
|
56
|
-
* A DTCG color in
|
|
57
|
-
*
|
|
58
|
-
*
|
|
57
|
+
* A DTCG color as components in `profile`, the importing document's. The 2025.10 object form names
|
|
58
|
+
* its space; it is written as CSS and read as CSS colors are: an sRGB one keeps its numbers, as
|
|
59
|
+
* Figma takes hex, and one in another space, such as Display P3, is converted into `profile`.
|
|
60
|
+
* Earlier drafts wrote any CSS color string, which reads the same way.
|
|
59
61
|
*/
|
|
60
|
-
export function decodeColor(value: unknown): Color | null {
|
|
61
|
-
if (typeof value === 'string') return
|
|
62
|
+
export function decodeColor(value: unknown, profile: DocumentColorSpace): Color | null {
|
|
63
|
+
if (typeof value === 'string') return tryParseColor(value, profile)
|
|
62
64
|
const parsed = v.safeParse(colorObjectSchema, value)
|
|
63
65
|
if (!parsed.success) return null
|
|
64
66
|
const { colorSpace, components, alpha = 1, hex } = parsed.output
|
|
@@ -66,8 +68,8 @@ export function decodeColor(value: unknown): Color | null {
|
|
|
66
68
|
const open = PREDEFINED_SPACES.has(colorSpace)
|
|
67
69
|
? `color(${colorSpace} ${parts.join(' ')}`
|
|
68
70
|
: FUNCTION_SPACES[colorSpace]?.(parts)
|
|
69
|
-
if (!open) return hex ?
|
|
70
|
-
return
|
|
71
|
+
if (!open) return hex ? tryParseColor(hex, profile) : null
|
|
72
|
+
return tryParseColor(`${open} / ${alpha})`, profile)
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
const dimensionSchema = v.object({ value: v.number(), unit: v.picklist(['px', 'rem']) })
|
|
@@ -210,11 +212,11 @@ function valueInUnit(literal: Literal, unit: TokenUnit | undefined): Literal['va
|
|
|
210
212
|
}
|
|
211
213
|
|
|
212
214
|
/** A literal in the shape its type takes, with the unit it was written in. */
|
|
213
|
-
function decodeLiteral(token: ReadToken): Literal | null {
|
|
215
|
+
function decodeLiteral(token: ReadToken, profile: DocumentColorSpace): Literal | null {
|
|
214
216
|
const { value } = token
|
|
215
217
|
switch (token.type) {
|
|
216
218
|
case 'color': {
|
|
217
|
-
const color = decodeColor(value)
|
|
219
|
+
const color = decodeColor(value, profile)
|
|
218
220
|
return color && { value: color }
|
|
219
221
|
}
|
|
220
222
|
case 'dimension':
|
|
@@ -250,7 +252,10 @@ function impliedScopes(token: ReadToken): VariableScope[] | undefined {
|
|
|
250
252
|
}
|
|
251
253
|
|
|
252
254
|
/** A token as a variable value and Pairdraw's own token fields. */
|
|
253
|
-
export function decodeVariableToken(
|
|
255
|
+
export function decodeVariableToken(
|
|
256
|
+
token: ReadToken,
|
|
257
|
+
profile: DocumentColorSpace
|
|
258
|
+
): DecodedVariable | DecodeFailure {
|
|
254
259
|
const type = variableTypeOf(token)
|
|
255
260
|
if (type === 'unsupported-type' || type === 'invalid-value') return type
|
|
256
261
|
const own = v.safeParse(ownFieldsSchema, token.extensions[PAIRDRAW_EXTENSION])
|
|
@@ -267,7 +272,7 @@ export function decodeVariableToken(token: ReadToken): DecodedVariable | DecodeF
|
|
|
267
272
|
name: figma.success ? figma.output.targetVariableName : undefined
|
|
268
273
|
}
|
|
269
274
|
} else {
|
|
270
|
-
const literal = decodeLiteral(token)
|
|
275
|
+
const literal = decodeLiteral(token, profile)
|
|
271
276
|
if (!literal) return 'invalid-value'
|
|
272
277
|
unit ??= literal.unit === 'px' ? undefined : literal.unit
|
|
273
278
|
value = { kind: 'literal', value: valueInUnit(literal, unit) }
|
|
@@ -103,7 +103,7 @@ function variableToken(
|
|
|
103
103
|
formula = printFormula(value.value, (id) => tokenReference(context.references.get(id) ?? []), {
|
|
104
104
|
type: (id) => context.graph.variables.get(id)?.type
|
|
105
105
|
})
|
|
106
|
-
$value = literalTokenValue(variable, resolved)
|
|
106
|
+
$value = literalTokenValue(variable, resolved, context.graph.documentColorSpace)
|
|
107
107
|
} else if (typeof value === 'object' && 'expression' in value) {
|
|
108
108
|
context.issues.push({ kind: 'unsupported-expression', ...where })
|
|
109
109
|
return undefined
|
|
@@ -122,7 +122,7 @@ function variableToken(
|
|
|
122
122
|
targetVariableSetName: targetCollection.name
|
|
123
123
|
}
|
|
124
124
|
} else {
|
|
125
|
-
$value = literalTokenValue(variable, value)
|
|
125
|
+
$value = literalTokenValue(variable, value, context.graph.documentColorSpace)
|
|
126
126
|
}
|
|
127
127
|
if (variable.type === 'BOOLEAN') figma['com.figma.type'] = 'boolean'
|
|
128
128
|
const $extensions = { ...figma, ...pairdrawFields(variable, mode.modeId, formula) }
|
|
@@ -190,7 +190,7 @@ function resolverDocument(collections: readonly CollectionFiles[], stylesPath: s
|
|
|
190
190
|
*/
|
|
191
191
|
export function exportDesignTokens(graph: SceneGraph): DesignTokenExport {
|
|
192
192
|
const issues: DesignTokenIssue[] = []
|
|
193
|
-
const collections =
|
|
193
|
+
const collections = graph.getLiveCollections()
|
|
194
194
|
const references = new Map<string, string[]>()
|
|
195
195
|
const collectionOf = new Map<string, VariableCollection>()
|
|
196
196
|
const placedByCollection = new Map<string, Array<{ variable: Variable; path: string[] }>>()
|
|
@@ -49,6 +49,27 @@ export {
|
|
|
49
49
|
type DesignSystemSourceFile
|
|
50
50
|
} from './project'
|
|
51
51
|
export { patchTokenStylesheet, syncTokenStylesheet, type TokenStylesheetSync } from './css/sync'
|
|
52
|
+
export {
|
|
53
|
+
driftNeedsChoice,
|
|
54
|
+
planTokenSync,
|
|
55
|
+
tokenSnapshot,
|
|
56
|
+
trackTokenDrift,
|
|
57
|
+
type TokenDrift,
|
|
58
|
+
type TokenDriftKind,
|
|
59
|
+
type TokenSync,
|
|
60
|
+
type TokenSyncBase,
|
|
61
|
+
type TokenSyncChoice,
|
|
62
|
+
type TokenSyncResolution
|
|
63
|
+
} from './sync/drift'
|
|
64
|
+
export { readTokenSourceFiles } from './sync/files'
|
|
65
|
+
export {
|
|
66
|
+
syncedTokenSources,
|
|
67
|
+
syncTokenFiles,
|
|
68
|
+
syncTokensIntoGraph,
|
|
69
|
+
tokenSourceForFiles,
|
|
70
|
+
type TokenFilesSync,
|
|
71
|
+
type TokenSourceLink
|
|
72
|
+
} from './sync/apply'
|
|
52
73
|
export {
|
|
53
74
|
applyTokenImport,
|
|
54
75
|
importTokensIntoGraph,
|
|
@@ -5,7 +5,10 @@ import type { SceneGraph, VariableValue } from '@pairdraw/scene-graph'
|
|
|
5
5
|
import type { PlannedCollection, PlannedValue, TokenImportPlan } from './index'
|
|
6
6
|
|
|
7
7
|
/** The value a planned one sets, or undefined where it points at a variable the import adds. */
|
|
8
|
-
function plannedValue(
|
|
8
|
+
export function plannedValue(
|
|
9
|
+
plan: TokenImportPlan,
|
|
10
|
+
value: PlannedValue
|
|
11
|
+
): VariableValue | undefined {
|
|
9
12
|
if (value.kind === 'literal') return value.value
|
|
10
13
|
const { target } = value
|
|
11
14
|
if (target.kind === 'variable') return { aliasId: target.variableId }
|
|
@@ -125,9 +125,9 @@ export function defaultTokenImportOptions(
|
|
|
125
125
|
bundle: DesignTokenBundle
|
|
126
126
|
): TokenImportOptions {
|
|
127
127
|
// A library's collections belong to it, so tokens of the same name make one of the file's.
|
|
128
|
-
const existing =
|
|
129
|
-
(
|
|
130
|
-
|
|
128
|
+
const existing = graph
|
|
129
|
+
.getLiveCollections()
|
|
130
|
+
.filter((collection) => !isLibraryCollection(collection))
|
|
131
131
|
const claimed = new Set<string>()
|
|
132
132
|
return {
|
|
133
133
|
collections: bundle.collections.map((collection): CollectionImportChoice => {
|
|
@@ -193,7 +193,7 @@ interface PlannerIndexes {
|
|
|
193
193
|
function indexesOf(planner: Planner): PlannerIndexes {
|
|
194
194
|
if (planner.indexes) return planner.indexes
|
|
195
195
|
const variables = new Map<string, Variable[]>()
|
|
196
|
-
for (const variable of planner.graph.
|
|
196
|
+
for (const variable of planner.graph.getLiveVariables())
|
|
197
197
|
variables.set(variable.name, [...(variables.get(variable.name) ?? []), variable])
|
|
198
198
|
const planned = new Map<string, { index: number; variables: Map<string, number> }>()
|
|
199
199
|
planner.collections.forEach((collection, index) => {
|
|
@@ -325,7 +325,8 @@ function planVariables(
|
|
|
325
325
|
const rows: Array<{ variable: PlannedVariable; decoded: Array<DecodedVariable | undefined> }> = []
|
|
326
326
|
const existingByName = variablesByName(planner.graph, planner.existingByCollection[index])
|
|
327
327
|
for (const [name, tokens] of tokensByName(collection, modeIndexes)) {
|
|
328
|
-
const
|
|
328
|
+
const profile = planner.graph.documentColorSpace
|
|
329
|
+
const decoded = tokens.map((token) => (token ? decodeVariableToken(token, profile) : undefined))
|
|
329
330
|
const failure = decoded.find((entry) => typeof entry === 'string')
|
|
330
331
|
const usable = decoded.map((entry) => (typeof entry === 'string' ? undefined : entry))
|
|
331
332
|
if (usable.every((entry) => entry === undefined)) {
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { isEqual, isPlainObject } from 'es-toolkit/predicate'
|
|
2
2
|
import * as v from 'valibot'
|
|
3
3
|
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
DocumentColorSpace,
|
|
6
|
+
Effect,
|
|
7
|
+
SceneGraph,
|
|
8
|
+
SceneNode,
|
|
9
|
+
TextLength
|
|
10
|
+
} from '@pairdraw/scene-graph'
|
|
5
11
|
import type { Color } from '@pairdraw/scene-graph/primitives'
|
|
6
12
|
import { getSharedStyles } from '@pairdraw/scene-graph/shared-styles'
|
|
7
13
|
import { percentLength, pixelLength, textLengthSchema } from '@pairdraw/scene-graph/text'
|
|
@@ -178,15 +184,24 @@ function recordedTarget(
|
|
|
178
184
|
}
|
|
179
185
|
|
|
180
186
|
/** One shadow of a shadow token, or the shadows a referenced shadow token holds. */
|
|
181
|
-
function shadowEffects(
|
|
187
|
+
function shadowEffects(
|
|
188
|
+
raw: unknown,
|
|
189
|
+
resolve: Resolve,
|
|
190
|
+
profile: DocumentColorSpace,
|
|
191
|
+
depth = 0
|
|
192
|
+
): Effect[] | null {
|
|
182
193
|
const path = referencePath(raw)
|
|
183
194
|
if (path) {
|
|
184
195
|
const resolved = depth < 16 ? resolve(path) : undefined
|
|
185
|
-
return resolved?.kind === 'token'
|
|
196
|
+
return resolved?.kind === 'token'
|
|
197
|
+
? shadowList(resolved.token.value, resolve, profile, depth + 1)
|
|
198
|
+
: null
|
|
186
199
|
}
|
|
187
200
|
if (!isPlainObject(raw)) return null
|
|
188
201
|
const color = fieldValue<Color>(raw.color, resolve, (value) =>
|
|
189
|
-
isPlainObject(value) && typeof value.r === 'number'
|
|
202
|
+
isPlainObject(value) && typeof value.r === 'number'
|
|
203
|
+
? (value as Color)
|
|
204
|
+
: decodeColor(value, profile)
|
|
190
205
|
)
|
|
191
206
|
const length = (key: string) => fieldValue(raw[key], resolve, pixels) ?? 0
|
|
192
207
|
if (!color) return null
|
|
@@ -203,11 +218,16 @@ function shadowEffects(raw: unknown, resolve: Resolve, depth = 0): Effect[] | nu
|
|
|
203
218
|
]
|
|
204
219
|
}
|
|
205
220
|
|
|
206
|
-
function shadowList(
|
|
221
|
+
function shadowList(
|
|
222
|
+
value: unknown,
|
|
223
|
+
resolve: Resolve,
|
|
224
|
+
profile: DocumentColorSpace,
|
|
225
|
+
depth = 0
|
|
226
|
+
): Effect[] | null {
|
|
207
227
|
const entries = Array.isArray(value) ? value : [value]
|
|
208
228
|
const effects: Effect[] = []
|
|
209
229
|
for (const entry of entries) {
|
|
210
|
-
const shadows = shadowEffects(entry, resolve, depth)
|
|
230
|
+
const shadows = shadowEffects(entry, resolve, profile, depth)
|
|
211
231
|
if (!shadows) return null
|
|
212
232
|
effects.push(...shadows)
|
|
213
233
|
}
|
|
@@ -229,12 +249,16 @@ function replaceShadows(exact: readonly Effect[], shadows: readonly Effect[]): E
|
|
|
229
249
|
}
|
|
230
250
|
|
|
231
251
|
/** A shadow token as effects, preferring the exact effects Pairdraw wrote. */
|
|
232
|
-
function effectFields(
|
|
252
|
+
function effectFields(
|
|
253
|
+
token: ReadToken,
|
|
254
|
+
resolve: Resolve,
|
|
255
|
+
profile: DocumentColorSpace
|
|
256
|
+
): Partial<SceneNode> | null {
|
|
233
257
|
const own = v.safeParse(ownEffectsSchema, token.extensions[PAIRDRAW_EXTENSION])
|
|
234
258
|
// Extension effects that do not read fall back to the token's own shadows.
|
|
235
259
|
const exact = own.success ? tryParseFigmaEffects(own.output.effects) : null
|
|
236
|
-
if (exact && isEqual(token.value, shadowTokenValue(exact))) return { effects: exact }
|
|
237
|
-
const shadows = shadowList(token.value, resolve)
|
|
260
|
+
if (exact && isEqual(token.value, shadowTokenValue(exact, profile))) return { effects: exact }
|
|
261
|
+
const shadows = shadowList(token.value, resolve, profile)
|
|
238
262
|
if (!shadows) return null
|
|
239
263
|
return { effects: exact ? replaceShadows(exact, shadows) : shadows }
|
|
240
264
|
}
|
|
@@ -256,7 +280,10 @@ export function planStyles(
|
|
|
256
280
|
skipped.push({ name: token.name, collection: undefined, reason: 'unsupported-type' })
|
|
257
281
|
continue
|
|
258
282
|
}
|
|
259
|
-
const fields =
|
|
283
|
+
const fields =
|
|
284
|
+
kind === 'TEXT'
|
|
285
|
+
? textFields(token, resolve)
|
|
286
|
+
: effectFields(token, resolve, graph.documentColorSpace)
|
|
260
287
|
if (!fields) {
|
|
261
288
|
skipped.push({ name: token.name, collection: undefined, reason: 'invalid-value' })
|
|
262
289
|
continue
|
|
@@ -171,15 +171,48 @@ function manifestChoice(
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
|
|
174
|
+
/**
|
|
175
|
+
* The stylesheets a project folder's tokens come from: the one `components.json` names, or every
|
|
176
|
+
* stylesheet that declares custom properties. Paths that leave the folder and JavaScript config
|
|
177
|
+
* are reported, not read.
|
|
178
|
+
*/
|
|
179
|
+
export function designSystemStylesheets(folder: DesignSystemFolder): {
|
|
180
|
+
stylesheets: DesignSystemSourceFile[]
|
|
181
|
+
issues: DesignSystemIssue[]
|
|
182
|
+
manifestPath?: string
|
|
183
|
+
} {
|
|
184
|
+
const issues = [...folder.issues]
|
|
185
|
+
const files = confineFiles(folder, issues)
|
|
186
|
+
const manifest = manifestChoice(files, issues)
|
|
187
|
+
return {
|
|
188
|
+
stylesheets: stylesheets(files, manifest.stylesheet, issues),
|
|
189
|
+
issues,
|
|
190
|
+
manifestPath: manifest.path
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* One stylesheet of a project as a token bundle, read against the document as it is now. A
|
|
196
|
+
* shadcn/ui `:root` and `.dark` pair becomes Light and Dark modes; the bundle's issues are noted.
|
|
197
|
+
*/
|
|
198
|
+
export function readDesignSystemStylesheet(
|
|
175
199
|
graph: SceneGraph,
|
|
176
|
-
pageId: string,
|
|
177
200
|
file: DesignSystemSourceFile,
|
|
178
201
|
issues: DesignSystemIssue[]
|
|
179
|
-
):
|
|
202
|
+
): DesignTokenBundle {
|
|
180
203
|
const bundle = readCSSDesignTokens(graph, file.text, { file: file.path })
|
|
181
204
|
renameShadcnModes(bundle)
|
|
182
205
|
for (const issue of bundle.issues) addIssue(issues, issue)
|
|
206
|
+
return bundle
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function importStylesheetFile(
|
|
210
|
+
graph: SceneGraph,
|
|
211
|
+
pageId: string,
|
|
212
|
+
file: DesignSystemSourceFile,
|
|
213
|
+
issues: DesignSystemIssue[]
|
|
214
|
+
): { collectionIds: string[]; variableIds: string[] } {
|
|
215
|
+
const bundle = readDesignSystemStylesheet(graph, file, issues)
|
|
183
216
|
const plan = planTokenImport(graph, bundle, defaultTokenImportOptions(graph, bundle))
|
|
184
217
|
for (const skip of plan.skipped) {
|
|
185
218
|
addIssue(issues, {
|
|
@@ -201,20 +234,18 @@ export function importDesignSystemFiles(
|
|
|
201
234
|
graph: SceneGraph,
|
|
202
235
|
folder: DesignSystemFolder
|
|
203
236
|
): DesignSystemImportResult {
|
|
204
|
-
const issues =
|
|
205
|
-
|
|
206
|
-
const manifest = manifestChoice(files, issues)
|
|
207
|
-
if (manifest.path || folder.componentsPath) {
|
|
237
|
+
const { stylesheets: files, issues, manifestPath } = designSystemStylesheets(folder)
|
|
238
|
+
if (manifestPath || folder.componentsPath) {
|
|
208
239
|
addIssue(issues, {
|
|
209
240
|
kind: 'components-not-imported',
|
|
210
|
-
path:
|
|
241
|
+
path: manifestPath ?? folder.componentsPath ?? 'components.json'
|
|
211
242
|
})
|
|
212
243
|
}
|
|
213
244
|
|
|
214
245
|
const pageId = graph.getPages()[0]?.id ?? graph.rootId
|
|
215
246
|
const collectionIds: string[] = []
|
|
216
247
|
const variableIds: string[] = []
|
|
217
|
-
for (const file of
|
|
248
|
+
for (const file of files) {
|
|
218
249
|
const imported = importStylesheetFile(graph, pageId, file, issues)
|
|
219
250
|
collectionIds.push(...imported.collectionIds)
|
|
220
251
|
variableIds.push(...imported.variableIds)
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { countBy } from 'es-toolkit/array'
|
|
2
2
|
import { isEmptyObject, isPlainObject } from 'es-toolkit/predicate'
|
|
3
3
|
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
ColorProfile,
|
|
6
|
+
Effect,
|
|
7
|
+
SceneGraph,
|
|
8
|
+
SceneNode,
|
|
9
|
+
ShaderEffect,
|
|
10
|
+
ShadowEffect
|
|
11
|
+
} from '@pairdraw/scene-graph'
|
|
5
12
|
import { lineHeightPixels, textLengthPixels } from '@pairdraw/scene-graph/text'
|
|
6
13
|
|
|
7
14
|
import { toFigmaEffect } from '#core/figma-api/effects'
|
|
@@ -123,9 +130,9 @@ export function isShadow(effect: Effect): effect is ShadowEffect {
|
|
|
123
130
|
return effect.type === 'DROP_SHADOW' || effect.type === 'INNER_SHADOW'
|
|
124
131
|
}
|
|
125
132
|
|
|
126
|
-
function shadowValue(effect: ShadowEffect) {
|
|
133
|
+
function shadowValue(effect: ShadowEffect, profile: ColorProfile) {
|
|
127
134
|
return {
|
|
128
|
-
color: colorTokenValue(effect.color),
|
|
135
|
+
color: colorTokenValue(effect.color, profile),
|
|
129
136
|
offsetX: dimensionTokenValue(effect.offset.x),
|
|
130
137
|
offsetY: dimensionTokenValue(effect.offset.y),
|
|
131
138
|
blur: dimensionTokenValue(effect.radius),
|
|
@@ -135,10 +142,10 @@ function shadowValue(effect: ShadowEffect) {
|
|
|
135
142
|
}
|
|
136
143
|
|
|
137
144
|
/** A shadow token's `$value`: the visible shadows of `effects`, or undefined when there are none. */
|
|
138
|
-
export function shadowTokenValue(effects: readonly Effect[]) {
|
|
145
|
+
export function shadowTokenValue(effects: readonly Effect[], profile: ColorProfile = 'srgb') {
|
|
139
146
|
const values = effects
|
|
140
147
|
.filter((effect): effect is ShadowEffect => isShadow(effect) && effect.visible)
|
|
141
|
-
.map(shadowValue)
|
|
148
|
+
.map((effect) => shadowValue(effect, profile))
|
|
142
149
|
if (values.length === 0) return undefined
|
|
143
150
|
return values.length === 1 ? values[0] : values
|
|
144
151
|
}
|
|
@@ -148,8 +155,8 @@ export function shadowTokenValue(effects: readonly Effect[]) {
|
|
|
148
155
|
* blurs or hidden shadows, ride along whole in Pairdraw's extension, in the plugin API's shape;
|
|
149
156
|
* a style with no visible shadow has no token.
|
|
150
157
|
*/
|
|
151
|
-
function shadowToken(node: SceneNode): DesignToken | undefined {
|
|
152
|
-
const $value = shadowTokenValue(node.effects)
|
|
158
|
+
function shadowToken(node: SceneNode, profile: ColorProfile): DesignToken | undefined {
|
|
159
|
+
const $value = shadowTokenValue(node.effects, profile)
|
|
153
160
|
if ($value === undefined) return undefined
|
|
154
161
|
const exact = node.effects.every(
|
|
155
162
|
(effect) =>
|
|
@@ -167,7 +174,9 @@ function shadowToken(node: SceneNode): DesignToken | undefined {
|
|
|
167
174
|
$extensions: {
|
|
168
175
|
[PAIRDRAW_EXTENSION]: {
|
|
169
176
|
effects: node.effects
|
|
170
|
-
.filter(
|
|
177
|
+
.filter(
|
|
178
|
+
(effect): effect is Exclude<Effect, ShaderEffect> => effect.type !== 'SHADER'
|
|
179
|
+
)
|
|
171
180
|
.map(toFigmaEffect)
|
|
172
181
|
}
|
|
173
182
|
}
|
|
@@ -199,7 +208,9 @@ export function styleTokens(
|
|
|
199
208
|
)
|
|
200
209
|
const candidates = styles.flatMap((node) => {
|
|
201
210
|
const token =
|
|
202
|
-
node.sharedStyleType === 'TEXT'
|
|
211
|
+
node.sharedStyleType === 'TEXT'
|
|
212
|
+
? typographyToken(graph, node, references)
|
|
213
|
+
: shadowToken(node, graph.documentColorSpace)
|
|
203
214
|
if (!token) {
|
|
204
215
|
issues.push({ kind: 'unsupported-effect', style: node.name })
|
|
205
216
|
return []
|