@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
|
@@ -0,0 +1,589 @@
|
|
|
1
|
+
import { compact } from 'es-toolkit/array'
|
|
2
|
+
import { isEmptyObject } from 'es-toolkit/predicate'
|
|
3
|
+
|
|
4
|
+
import { parseCSSName } from '@pairdraw/dom-css/export'
|
|
5
|
+
import type { SceneGraph, Variable, VariableValue } from '@pairdraw/scene-graph'
|
|
6
|
+
import { colorToHex8 } from '@pairdraw/scene-graph/color'
|
|
7
|
+
import type { TokenSource } from '@pairdraw/scene-graph/token-sources'
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
defaultTokenImportOptions,
|
|
11
|
+
planTokenImport,
|
|
12
|
+
type PlannedCollection,
|
|
13
|
+
type PlannedValue,
|
|
14
|
+
type PlannedVariable,
|
|
15
|
+
type TokenImportPlan
|
|
16
|
+
} from '#core/io/formats/design-tokens/plan'
|
|
17
|
+
import { plannedValue } from '#core/io/formats/design-tokens/plan/changes'
|
|
18
|
+
import type { DesignTokenBundle } from '#core/io/formats/design-tokens/read'
|
|
19
|
+
|
|
20
|
+
/** What linked code held at the last sync, and the token each variable then was. */
|
|
21
|
+
export type TokenSyncBase = Pick<TokenSource, 'snapshot' | 'names' | 'modes'>
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* How a token differs between linked code and the canvas, against what the code held at the last
|
|
25
|
+
* sync: changed in code only, on the canvas only, on both, new in code, no longer in code, or
|
|
26
|
+
* deleted on the canvas while the code still has it.
|
|
27
|
+
*/
|
|
28
|
+
export type TokenDriftKind = 'code' | 'canvas' | 'conflict' | 'added' | 'missing' | 'deleted'
|
|
29
|
+
|
|
30
|
+
export interface TokenDrift {
|
|
31
|
+
kind: TokenDriftKind
|
|
32
|
+
collection: string
|
|
33
|
+
variable: string
|
|
34
|
+
/** Null for a variable the code adds; a deleted variable keeps the id it had. */
|
|
35
|
+
variableId: string | null
|
|
36
|
+
/** Null where the whole variable is added, gone, or deleted. */
|
|
37
|
+
mode: string | null
|
|
38
|
+
modeId: string | null
|
|
39
|
+
/** The value as the code writes it, for people to read. */
|
|
40
|
+
code?: string
|
|
41
|
+
/** The value the canvas holds, for people to read. */
|
|
42
|
+
canvas?: string
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Which side a person keeps for a token that changed on the canvas, on both, or left the code. */
|
|
46
|
+
export type TokenSyncChoice = 'code' | 'canvas'
|
|
47
|
+
|
|
48
|
+
export interface TokenSyncResolution {
|
|
49
|
+
/**
|
|
50
|
+
* The imports that bring the code in, one per file, to apply in order. Values that already
|
|
51
|
+
* match are left alone, and nothing is deleted: a token gone from code keeps its variable.
|
|
52
|
+
*/
|
|
53
|
+
plans: TokenImportPlan[]
|
|
54
|
+
/** How many tokens the imports write: those changed or added only in code, and those chosen. */
|
|
55
|
+
applied: number
|
|
56
|
+
/** Drift nobody chose a side for, which the next sync reports again. */
|
|
57
|
+
undecided: TokenDrift[]
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface TokenSync {
|
|
61
|
+
/** In the order of the code's files, collections, and tokens; tokens gone from code last. */
|
|
62
|
+
drift: TokenDrift[]
|
|
63
|
+
/**
|
|
64
|
+
* Changes made only in code and tokens new in code always come in. A token changed or deleted
|
|
65
|
+
* on the canvas, or changed on both sides, takes the code only where `choose` picks the code;
|
|
66
|
+
* one gone from code stops being reported once a side is picked for it.
|
|
67
|
+
*/
|
|
68
|
+
resolve(choose?: (drift: TokenDrift) => TokenSyncChoice | undefined): TokenSyncResolution
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Drift a person decides: the canvas changed or deleted the token, or both sides changed it. */
|
|
72
|
+
export function driftNeedsChoice(drift: TokenDrift): boolean {
|
|
73
|
+
return drift.kind === 'canvas' || drift.kind === 'conflict' || drift.kind === 'deleted'
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Drift that needs nobody's choice: the code changed alone, or added the token. */
|
|
77
|
+
function followsCode(drift: TokenDrift): boolean {
|
|
78
|
+
return drift.kind === 'code' || drift.kind === 'added'
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function roundNumber(value: number): number {
|
|
82
|
+
// `.fig` stores numbers as float32, so a saved 0.1 must still read as 0.1.
|
|
83
|
+
return Math.round(value * 1e4) / 1e4
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* A value as sync compares it: colors to 8-bit channels, numbers to four decimals, aliases by
|
|
88
|
+
* target, and a CSS expression by its text, whatever number an engine computed for it.
|
|
89
|
+
*/
|
|
90
|
+
export function tokenValueSignature(value: VariableValue | undefined, expression?: string): string {
|
|
91
|
+
if (expression) return `=${expression.replaceAll(/\s+/g, ' ').trim()}`
|
|
92
|
+
if (value === undefined) return ''
|
|
93
|
+
if (typeof value === 'number') return String(roundNumber(value))
|
|
94
|
+
if (typeof value === 'string') return JSON.stringify(value)
|
|
95
|
+
if (typeof value === 'boolean') return String(value)
|
|
96
|
+
if ('aliasId' in value) return `@${value.aliasId}`
|
|
97
|
+
if ('r' in value) return colorToHex8(value)
|
|
98
|
+
return JSON.stringify(value)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function describeValue(
|
|
102
|
+
graph: SceneGraph,
|
|
103
|
+
value: VariableValue | undefined,
|
|
104
|
+
expression?: string
|
|
105
|
+
): string {
|
|
106
|
+
if (expression) return expression
|
|
107
|
+
if (value === undefined) return ''
|
|
108
|
+
if (typeof value === 'number') return String(roundNumber(value))
|
|
109
|
+
if (typeof value === 'string') return value
|
|
110
|
+
if (typeof value === 'boolean') return String(value)
|
|
111
|
+
if ('aliasId' in value) return `{${graph.variables.get(value.aliasId)?.name ?? value.aliasId}}`
|
|
112
|
+
if ('r' in value) return colorToHex8(value)
|
|
113
|
+
return JSON.stringify(value)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** The code's value for a planned mode, with an alias to a variable the import adds named. */
|
|
117
|
+
function codeValue(plan: TokenImportPlan, value: PlannedValue) {
|
|
118
|
+
const resolved = plannedValue(plan, value)
|
|
119
|
+
if (resolved !== undefined || value.kind !== 'alias' || value.target.kind !== 'planned')
|
|
120
|
+
return { value: resolved }
|
|
121
|
+
const { collection, variable } = value.target
|
|
122
|
+
return { value: undefined, added: plan.collections[collection]?.variables[variable]?.name }
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function codeSignature(plan: TokenImportPlan, value: PlannedValue, expression?: string) {
|
|
126
|
+
const code = codeValue(plan, value)
|
|
127
|
+
return code.added === undefined ? tokenValueSignature(code.value, expression) : `@+${code.added}`
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function describeCode(
|
|
131
|
+
graph: SceneGraph,
|
|
132
|
+
plan: TokenImportPlan,
|
|
133
|
+
value: PlannedValue,
|
|
134
|
+
expression?: string
|
|
135
|
+
) {
|
|
136
|
+
const code = codeValue(plan, value)
|
|
137
|
+
return code.added === undefined ? describeValue(graph, code.value, expression) : `{${code.added}}`
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function positionKey(collection: number, variable: number, mode?: number): string {
|
|
141
|
+
return mode === undefined ? `${collection}:${variable}` : `${collection}:${variable}:${mode}`
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** How a sync names a token across syncs: its collection and its name there. */
|
|
145
|
+
function tokenKey(collection: string, variable: string): string {
|
|
146
|
+
return `${collection}/${variable}`
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* The token a planned variable is in code. A token that states the code naming it, as a
|
|
151
|
+
* stylesheet's `var(--brand)` does, is named by that rather than by the variable's current name:
|
|
152
|
+
* a variable renamed on the canvas is still the code's `brand` on the next sync.
|
|
153
|
+
*/
|
|
154
|
+
function plannedTokenKey(collection: PlannedCollection, planned: PlannedVariable): string {
|
|
155
|
+
const codeName = parseCSSName(planned.codeSyntax?.WEB)
|
|
156
|
+
return tokenKey(collection.name, codeName ?? planned.name)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function syncPlan(graph: SceneGraph, bundle: DesignTokenBundle): TokenImportPlan {
|
|
160
|
+
const options = { ...defaultTokenImportOptions(graph, bundle), styles: false }
|
|
161
|
+
return planTokenImport(graph, bundle, options)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function driftKind(base: string | undefined, code: string, canvas: string): TokenDriftKind {
|
|
165
|
+
if (base === canvas) return 'code'
|
|
166
|
+
if (base === code) return 'canvas'
|
|
167
|
+
return 'conflict'
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** A variable and mode the code sets, with the code's value as sync compares it. */
|
|
171
|
+
interface Position {
|
|
172
|
+
key: string
|
|
173
|
+
variableId: string
|
|
174
|
+
modeId: string
|
|
175
|
+
collection: string
|
|
176
|
+
variable: string
|
|
177
|
+
mode: string
|
|
178
|
+
code: string
|
|
179
|
+
codeText: string
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** One file's plan, read once, and what in it never depends on the canvas's values. */
|
|
183
|
+
interface PreparedBundle {
|
|
184
|
+
plan: TokenImportPlan
|
|
185
|
+
positions: Position[]
|
|
186
|
+
/** Variables and modes the code adds, by plan position for whole variables. */
|
|
187
|
+
added: Array<{ drift: TokenDrift; at?: string }>
|
|
188
|
+
inCode: Set<string>
|
|
189
|
+
/** Token names the file declares, in any collection. */
|
|
190
|
+
names: Set<string>
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function prepareBundle(graph: SceneGraph, bundle: DesignTokenBundle): PreparedBundle {
|
|
194
|
+
const plan = syncPlan(graph, bundle)
|
|
195
|
+
const prepared: PreparedBundle = {
|
|
196
|
+
plan,
|
|
197
|
+
positions: [],
|
|
198
|
+
added: [],
|
|
199
|
+
inCode: new Set(),
|
|
200
|
+
names: new Set()
|
|
201
|
+
}
|
|
202
|
+
plan.collections.forEach((collection, c) => {
|
|
203
|
+
collection.variables.forEach((planned, v) => {
|
|
204
|
+
prepared.names.add(planned.name)
|
|
205
|
+
const variable = planned.existingId ? graph.variables.get(planned.existingId) : undefined
|
|
206
|
+
if (!variable) {
|
|
207
|
+
const at = planned.values.findIndex((value) => value !== undefined)
|
|
208
|
+
const first = planned.values.at(at)
|
|
209
|
+
prepared.added.push({
|
|
210
|
+
at: positionKey(c, v),
|
|
211
|
+
drift: {
|
|
212
|
+
kind: 'added',
|
|
213
|
+
collection: collection.name,
|
|
214
|
+
variable: planned.name,
|
|
215
|
+
variableId: null,
|
|
216
|
+
mode: null,
|
|
217
|
+
modeId: null,
|
|
218
|
+
code: first && describeCode(graph, plan, first, planned.expressions[at])
|
|
219
|
+
}
|
|
220
|
+
})
|
|
221
|
+
return
|
|
222
|
+
}
|
|
223
|
+
prepared.inCode.add(variable.id)
|
|
224
|
+
planned.values.forEach((value, m) => {
|
|
225
|
+
const target = collection.modes.at(m)?.target
|
|
226
|
+
if (!value || !target) return
|
|
227
|
+
const expression = planned.expressions[m]
|
|
228
|
+
const entry = {
|
|
229
|
+
collection: collection.name,
|
|
230
|
+
variable: variable.name,
|
|
231
|
+
variableId: variable.id,
|
|
232
|
+
mode: collection.modes[m].name,
|
|
233
|
+
code: describeCode(graph, plan, value, expression)
|
|
234
|
+
}
|
|
235
|
+
if (target.kind === 'new') {
|
|
236
|
+
prepared.added.push({ drift: { ...entry, kind: 'added', modeId: null } })
|
|
237
|
+
return
|
|
238
|
+
}
|
|
239
|
+
prepared.positions.push({
|
|
240
|
+
key: positionKey(c, v, m),
|
|
241
|
+
variableId: variable.id,
|
|
242
|
+
modeId: target.modeId,
|
|
243
|
+
collection: collection.name,
|
|
244
|
+
variable: variable.name,
|
|
245
|
+
mode: collection.modes[m].name,
|
|
246
|
+
code: codeSignature(plan, value, expression),
|
|
247
|
+
codeText: entry.code
|
|
248
|
+
})
|
|
249
|
+
})
|
|
250
|
+
})
|
|
251
|
+
})
|
|
252
|
+
return prepared
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** The canvas side of a position as sync compares it, recomputed only when its value changed. */
|
|
256
|
+
interface CanvasCache {
|
|
257
|
+
get(variable: Variable, modeId: string): { signature: string; text: string }
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function canvasCache(graph: SceneGraph): CanvasCache {
|
|
261
|
+
const seen = new Map<
|
|
262
|
+
string,
|
|
263
|
+
{ value: unknown; css: string | undefined; signature: string; text: string }
|
|
264
|
+
>()
|
|
265
|
+
return {
|
|
266
|
+
get(variable, modeId) {
|
|
267
|
+
const value = variable.valuesByMode[modeId]
|
|
268
|
+
const css = variable.expressions?.[modeId]?.css
|
|
269
|
+
const key = `${variable.id}:${modeId}`
|
|
270
|
+
const cached = seen.get(key)
|
|
271
|
+
// Values are replaced, not edited in place, so the same value means nothing changed. A
|
|
272
|
+
// value that is missing (undefined) is cached as such, so the entry must exist to match.
|
|
273
|
+
if (cached && seen.has(key) && cached.value === value && cached.css === css) return cached
|
|
274
|
+
const entry = {
|
|
275
|
+
value,
|
|
276
|
+
css,
|
|
277
|
+
signature: tokenValueSignature(value, css),
|
|
278
|
+
text: describeValue(graph, value, css)
|
|
279
|
+
}
|
|
280
|
+
seen.set(key, entry)
|
|
281
|
+
return entry
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/** The id a deleted variable had, where the last sync recorded the token under this name. */
|
|
287
|
+
function deletedIds(graph: SceneGraph, base: TokenSyncBase | undefined): Map<string, string> {
|
|
288
|
+
const ids = new Map<string, string>()
|
|
289
|
+
for (const [id, key] of Object.entries(base?.names ?? {}))
|
|
290
|
+
if (!graph.variables.has(id)) ids.set(key, id)
|
|
291
|
+
return ids
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
interface Classified {
|
|
295
|
+
drift: TokenDrift[]
|
|
296
|
+
/** Drift by plan position, for the import that follows. */
|
|
297
|
+
decisions: Map<string, TokenDrift>
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
function classifyBundle(
|
|
301
|
+
graph: SceneGraph,
|
|
302
|
+
prepared: PreparedBundle,
|
|
303
|
+
base: TokenSyncBase | undefined,
|
|
304
|
+
canvas: CanvasCache
|
|
305
|
+
): Classified {
|
|
306
|
+
const drift: TokenDrift[] = []
|
|
307
|
+
const decisions = new Map<string, TokenDrift>()
|
|
308
|
+
const deleted = deletedIds(graph, base)
|
|
309
|
+
for (const { drift: entry, at } of prepared.added) {
|
|
310
|
+
const id =
|
|
311
|
+
entry.variableId === null
|
|
312
|
+
? deleted.get(tokenKey(entry.collection, entry.variable))
|
|
313
|
+
: undefined
|
|
314
|
+
const found: TokenDrift = id ? { ...entry, kind: 'deleted', variableId: id } : entry
|
|
315
|
+
if (at) decisions.set(at, found)
|
|
316
|
+
// Kept deleted at an earlier sync: it stays deleted, and is not reported again.
|
|
317
|
+
if (id && isEmptyObject(base?.snapshot[id] ?? { kept: true })) continue
|
|
318
|
+
drift.push(found)
|
|
319
|
+
}
|
|
320
|
+
for (const position of prepared.positions) {
|
|
321
|
+
const variable = graph.variables.get(position.variableId)
|
|
322
|
+
if (!variable) continue
|
|
323
|
+
const current = canvas.get(variable, position.modeId)
|
|
324
|
+
if (current.signature === position.code) continue
|
|
325
|
+
const found: TokenDrift = {
|
|
326
|
+
kind: driftKind(
|
|
327
|
+
base?.snapshot[position.variableId]?.[position.modeId],
|
|
328
|
+
position.code,
|
|
329
|
+
current.signature
|
|
330
|
+
),
|
|
331
|
+
collection: position.collection,
|
|
332
|
+
variable: position.variable,
|
|
333
|
+
variableId: position.variableId,
|
|
334
|
+
mode: position.mode,
|
|
335
|
+
modeId: position.modeId,
|
|
336
|
+
code: position.codeText,
|
|
337
|
+
canvas: current.text
|
|
338
|
+
}
|
|
339
|
+
drift.push(found)
|
|
340
|
+
decisions.set(position.key, found)
|
|
341
|
+
}
|
|
342
|
+
return { drift, decisions }
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* The import that brings one file in for the decisions made: values that match, or whose canvas
|
|
347
|
+
* side is kept, are left alone, and a variable deleted on the canvas is not made again.
|
|
348
|
+
*/
|
|
349
|
+
function bundleImport(
|
|
350
|
+
graph: SceneGraph,
|
|
351
|
+
plan: TokenImportPlan,
|
|
352
|
+
decisions: ReadonlyMap<string, TokenDrift>,
|
|
353
|
+
useCode: (drift: TokenDrift) => boolean
|
|
354
|
+
): TokenImportPlan {
|
|
355
|
+
const next = structuredClone(plan)
|
|
356
|
+
const dropped = new Set<string>()
|
|
357
|
+
next.collections.forEach((collection, c) => {
|
|
358
|
+
collection.variables.forEach((planned, v) => {
|
|
359
|
+
const variable = planned.existingId ? graph.variables.get(planned.existingId) : undefined
|
|
360
|
+
if (!variable) {
|
|
361
|
+
const decision = decisions.get(positionKey(c, v))
|
|
362
|
+
if (decision?.kind === 'deleted' && !useCode(decision)) dropped.add(positionKey(c, v))
|
|
363
|
+
return
|
|
364
|
+
}
|
|
365
|
+
collection.modes.forEach((mode, m) => {
|
|
366
|
+
if (mode.target.kind !== 'existing') return
|
|
367
|
+
const decision = decisions.get(positionKey(c, v, m))
|
|
368
|
+
if (decision && (decision.kind === 'code' || useCode(decision))) return
|
|
369
|
+
planned.values[m] = undefined
|
|
370
|
+
// A value kept keeps its own expression, which the import writes back as it is.
|
|
371
|
+
planned.expressions[m] = variable.expressions?.[mode.target.modeId]?.css
|
|
372
|
+
})
|
|
373
|
+
})
|
|
374
|
+
})
|
|
375
|
+
return dropped.size > 0 ? withoutVariables(next, dropped) : next
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/** A plan without some of the variables it adds; aliases to them are left out too. */
|
|
379
|
+
function withoutVariables(plan: TokenImportPlan, dropped: ReadonlySet<string>): TokenImportPlan {
|
|
380
|
+
const moved = new Map<string, number>()
|
|
381
|
+
for (const [c, collection] of plan.collections.entries()) {
|
|
382
|
+
let kept = 0
|
|
383
|
+
for (const v of collection.variables.keys())
|
|
384
|
+
if (!dropped.has(positionKey(c, v))) moved.set(positionKey(c, v), kept++)
|
|
385
|
+
}
|
|
386
|
+
for (const [c, collection] of plan.collections.entries()) {
|
|
387
|
+
collection.variables = collection.variables.filter((_, v) => !dropped.has(positionKey(c, v)))
|
|
388
|
+
for (const variable of collection.variables) {
|
|
389
|
+
variable.values = variable.values.map((value) => {
|
|
390
|
+
if (value?.kind !== 'alias' || value.target.kind !== 'planned') return value
|
|
391
|
+
const index = moved.get(positionKey(value.target.collection, value.target.variable))
|
|
392
|
+
return index === undefined
|
|
393
|
+
? undefined
|
|
394
|
+
: { kind: 'alias', target: { ...value.target, variable: index } }
|
|
395
|
+
})
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
return plan
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Compares linked code, read into one token bundle per file, with the canvas, and plans bringing
|
|
403
|
+
* it in. Collections and modes match by name and variables by name within them, as an import
|
|
404
|
+
* does. Without a snapshot nobody knows which side changed, so every difference is a conflict.
|
|
405
|
+
*/
|
|
406
|
+
export function planTokenSync(
|
|
407
|
+
graph: SceneGraph,
|
|
408
|
+
bundles: readonly DesignTokenBundle[],
|
|
409
|
+
base?: TokenSyncBase
|
|
410
|
+
): TokenSync {
|
|
411
|
+
const prepared = bundles.map((bundle) => prepareBundle(graph, bundle))
|
|
412
|
+
const canvas = canvasCache(graph)
|
|
413
|
+
const classified = prepared.map((bundle) => classifyBundle(graph, bundle, base, canvas))
|
|
414
|
+
const drift = [
|
|
415
|
+
...classified.flatMap((entry) => entry.drift),
|
|
416
|
+
...goneFromCode(graph, prepared, base)
|
|
417
|
+
]
|
|
418
|
+
return {
|
|
419
|
+
drift,
|
|
420
|
+
resolve(choose = () => undefined) {
|
|
421
|
+
const choices = new Map(drift.map((entry) => [entry, choose(entry)]))
|
|
422
|
+
const useCode = (entry: TokenDrift) => choices.get(entry) === 'code'
|
|
423
|
+
return {
|
|
424
|
+
plans: prepared.map((bundle, index) =>
|
|
425
|
+
bundleImport(graph, bundle.plan, classified[index].decisions, useCode)
|
|
426
|
+
),
|
|
427
|
+
applied: drift.filter(
|
|
428
|
+
(entry) => followsCode(entry) || (entry.kind !== 'missing' && useCode(entry))
|
|
429
|
+
).length,
|
|
430
|
+
undecided: drift.filter((entry) => !followsCode(entry) && !choices.get(entry))
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Variables the last sync took from the code that no file declares now. A token counts as in
|
|
438
|
+
* code when any file declares its name, so light and dark values split across two stylesheets
|
|
439
|
+
* do not make each other's variables look gone.
|
|
440
|
+
*/
|
|
441
|
+
function goneFromCode(
|
|
442
|
+
graph: SceneGraph,
|
|
443
|
+
prepared: readonly PreparedBundle[],
|
|
444
|
+
base: TokenSyncBase | undefined
|
|
445
|
+
): TokenDrift[] {
|
|
446
|
+
const drift: TokenDrift[] = []
|
|
447
|
+
for (const variableId of Object.keys(base?.snapshot ?? {})) {
|
|
448
|
+
const variable = graph.variables.get(variableId)
|
|
449
|
+
if (!variable || prepared.some((bundle) => bundle.inCode.has(variableId))) continue
|
|
450
|
+
if (prepared.some((bundle) => bundle.names.has(variable.name))) continue
|
|
451
|
+
drift.push(missingDrift(graph, variable))
|
|
452
|
+
}
|
|
453
|
+
return drift
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Drift against the canvas as it is whenever asked, for a view that follows edits: the code is
|
|
458
|
+
* read and planned once, and a value unchanged since the last call is not compared again.
|
|
459
|
+
*/
|
|
460
|
+
export function trackTokenDrift(
|
|
461
|
+
graph: SceneGraph,
|
|
462
|
+
bundles: readonly DesignTokenBundle[],
|
|
463
|
+
base?: TokenSyncBase
|
|
464
|
+
): () => TokenDrift[] {
|
|
465
|
+
const prepared = bundles.map((bundle) => prepareBundle(graph, bundle))
|
|
466
|
+
const canvas = canvasCache(graph)
|
|
467
|
+
return () => [
|
|
468
|
+
...prepared.flatMap((bundle) => classifyBundle(graph, bundle, base, canvas).drift),
|
|
469
|
+
...goneFromCode(graph, prepared, base)
|
|
470
|
+
]
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
function missingDrift(graph: SceneGraph, variable: Variable): TokenDrift {
|
|
474
|
+
return {
|
|
475
|
+
kind: 'missing',
|
|
476
|
+
collection: graph.variableCollections.get(variable.collectionId)?.name ?? '',
|
|
477
|
+
variable: variable.name,
|
|
478
|
+
variableId: variable.id,
|
|
479
|
+
mode: null,
|
|
480
|
+
modeId: null
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
type Snapshot = Record<string, Record<string, string>>
|
|
485
|
+
type Names = Record<string, string>
|
|
486
|
+
|
|
487
|
+
/** What the code's plans hold for the variables they match, mode by mode, files adding up. */
|
|
488
|
+
function codeSnapshot(plans: readonly TokenImportPlan[], snapshot: Snapshot, names: Names) {
|
|
489
|
+
for (const plan of plans) {
|
|
490
|
+
for (const collection of plan.collections) {
|
|
491
|
+
for (const planned of collection.variables) {
|
|
492
|
+
if (!planned.existingId) continue
|
|
493
|
+
const modes = Object.hasOwn(snapshot, planned.existingId)
|
|
494
|
+
? snapshot[planned.existingId]
|
|
495
|
+
: {}
|
|
496
|
+
planned.values.forEach((value, m) => {
|
|
497
|
+
const target = collection.modes.at(m)?.target
|
|
498
|
+
if (!value || target?.kind !== 'existing') return
|
|
499
|
+
modes[target.modeId] = codeSignature(plan, value, planned.expressions[m])
|
|
500
|
+
})
|
|
501
|
+
snapshot[planned.existingId] = modes
|
|
502
|
+
names[planned.existingId] = plannedTokenKey(collection, planned)
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* A variable deleted on the canvas that the code still has stays recorded: with its last values
|
|
510
|
+
* while nobody decided, and with none once it was kept deleted, so it is not made again.
|
|
511
|
+
*/
|
|
512
|
+
function keepDeleted(
|
|
513
|
+
graph: SceneGraph,
|
|
514
|
+
plans: readonly TokenImportPlan[],
|
|
515
|
+
previous: TokenSyncBase,
|
|
516
|
+
waiting: ReadonlySet<string>,
|
|
517
|
+
record: { snapshot: Snapshot; names: Names }
|
|
518
|
+
) {
|
|
519
|
+
const declared = new Set(
|
|
520
|
+
plans.flatMap((plan) =>
|
|
521
|
+
plan.collections.flatMap((collection) =>
|
|
522
|
+
collection.variables.map((planned) => plannedTokenKey(collection, planned))
|
|
523
|
+
)
|
|
524
|
+
)
|
|
525
|
+
)
|
|
526
|
+
const current = new Set(Object.values(record.names))
|
|
527
|
+
for (const [id, key] of Object.entries(previous.names ?? {})) {
|
|
528
|
+
if (graph.variables.has(id) || current.has(key) || !declared.has(key)) continue
|
|
529
|
+
record.names[id] = key
|
|
530
|
+
record.snapshot[id] =
|
|
531
|
+
waiting.has(id) && Object.hasOwn(previous.snapshot, id) ? { ...previous.snapshot[id] } : {}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/** Drift left undecided keeps what the last sync recorded for it. */
|
|
536
|
+
function keepUndecided(
|
|
537
|
+
previous: TokenSyncBase,
|
|
538
|
+
undecided: readonly TokenDrift[],
|
|
539
|
+
record: { snapshot: Snapshot; names: Names }
|
|
540
|
+
) {
|
|
541
|
+
const before = previous.snapshot
|
|
542
|
+
for (const { variableId, modeId } of undecided) {
|
|
543
|
+
if (!variableId) continue
|
|
544
|
+
const kept = Object.hasOwn(before, variableId) ? before[variableId] : undefined
|
|
545
|
+
if (!modeId) {
|
|
546
|
+
// Gone from code or deleted on the canvas: it stays recorded, and so stays reported.
|
|
547
|
+
if (kept) record.snapshot[variableId] = { ...kept }
|
|
548
|
+
const name = previous.names?.[variableId]
|
|
549
|
+
if (name) record.names[variableId] = name
|
|
550
|
+
continue
|
|
551
|
+
}
|
|
552
|
+
const modes = Object.hasOwn(record.snapshot, variableId) ? record.snapshot[variableId] : {}
|
|
553
|
+
if (kept && Object.hasOwn(kept, modeId)) modes[modeId] = kept[modeId]
|
|
554
|
+
else Reflect.deleteProperty(modes, modeId)
|
|
555
|
+
record.snapshot[variableId] = modes
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* What the code holds now for the variables it matches, and the token each one is, to compare
|
|
561
|
+
* later syncs against. Files that set different modes of one variable add up. Drift left
|
|
562
|
+
* undecided keeps what `previous` had, so the next sync still sees both changes.
|
|
563
|
+
*/
|
|
564
|
+
export function tokenSnapshot(
|
|
565
|
+
graph: SceneGraph,
|
|
566
|
+
bundles: readonly DesignTokenBundle[],
|
|
567
|
+
previous: TokenSyncBase = { snapshot: {} },
|
|
568
|
+
undecided: readonly TokenDrift[] = []
|
|
569
|
+
): Required<TokenSyncBase> {
|
|
570
|
+
const record = { snapshot: {} as Snapshot, names: {} as Names, modes: modeNames(graph) }
|
|
571
|
+
const plans = bundles.map((bundle) => syncPlan(graph, bundle))
|
|
572
|
+
codeSnapshot(plans, record.snapshot, record.names)
|
|
573
|
+
const waiting = new Set(compact(undecided.map((entry) => entry.variableId)))
|
|
574
|
+
keepDeleted(graph, plans, previous, waiting, record)
|
|
575
|
+
keepUndecided(previous, undecided, record)
|
|
576
|
+
return record
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
/** Every collection's modes by id and name, to find them again when a format reassigns ids. */
|
|
580
|
+
function modeNames(graph: SceneGraph): Record<string, Record<string, string>> {
|
|
581
|
+
return Object.fromEntries(
|
|
582
|
+
graph
|
|
583
|
+
.getLiveCollections()
|
|
584
|
+
.map((collection) => [
|
|
585
|
+
collection.name,
|
|
586
|
+
Object.fromEntries(collection.modes.map((mode) => [mode.modeId, mode.name]))
|
|
587
|
+
])
|
|
588
|
+
)
|
|
589
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { partition } from 'es-toolkit/array'
|
|
2
|
+
import { posix } from 'pathe'
|
|
3
|
+
|
|
4
|
+
import type { SceneGraph } from '@pairdraw/scene-graph'
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
designSystemStylesheets,
|
|
8
|
+
readDesignSystemStylesheet,
|
|
9
|
+
type DesignSystemIssue
|
|
10
|
+
} from '#core/io/formats/design-tokens/project'
|
|
11
|
+
import {
|
|
12
|
+
readDesignTokens,
|
|
13
|
+
type DesignTokenBundle,
|
|
14
|
+
type DesignTokenSourceFile
|
|
15
|
+
} from '#core/io/formats/design-tokens/read'
|
|
16
|
+
|
|
17
|
+
/** Stylesheets and the shadcn/ui manifest that names one; every other file is DTCG tokens. */
|
|
18
|
+
function isStylesheetSide(path: string): boolean {
|
|
19
|
+
const name = posix.basename(path)
|
|
20
|
+
return name.endsWith('.css') || name === 'components.json'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Linked code read into token bundles against the document as it is now: one per stylesheet,
|
|
25
|
+
* picked as a project folder import picks them, and one for all DTCG token files together.
|
|
26
|
+
*/
|
|
27
|
+
export function readTokenSourceFiles(
|
|
28
|
+
graph: SceneGraph,
|
|
29
|
+
files: readonly DesignTokenSourceFile[]
|
|
30
|
+
): { bundles: DesignTokenBundle[]; issues: DesignSystemIssue[] } {
|
|
31
|
+
const [css, tokens] = partition(files, (file) => isStylesheetSide(file.path))
|
|
32
|
+
const { stylesheets, issues } = designSystemStylesheets({ files: css, issues: [] })
|
|
33
|
+
const bundles = stylesheets.map((file) => readDesignSystemStylesheet(graph, file, issues))
|
|
34
|
+
if (tokens.length > 0) {
|
|
35
|
+
const bundle = readDesignTokens(tokens)
|
|
36
|
+
issues.push(...bundle.issues)
|
|
37
|
+
bundles.push(bundle)
|
|
38
|
+
}
|
|
39
|
+
return { bundles, issues }
|
|
40
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { variableUnit } from '@pairdraw/dom-css/export'
|
|
2
|
-
import type { TokenUnit, Variable } from '@pairdraw/scene-graph'
|
|
3
|
-
import { colorToHex } from '@pairdraw/scene-graph/color'
|
|
2
|
+
import type { ColorProfile, TokenUnit, Variable } from '@pairdraw/scene-graph'
|
|
3
|
+
import { colorToHex, convertColor } from '@pairdraw/scene-graph/color'
|
|
4
4
|
import type { Color } from '@pairdraw/scene-graph/primitives'
|
|
5
5
|
|
|
6
6
|
import type { DesignTokenType } from './types'
|
|
@@ -31,13 +31,19 @@ export function variableTokenType(variable: Variable): DesignTokenType {
|
|
|
31
31
|
return 'number'
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
/**
|
|
35
|
-
|
|
34
|
+
/**
|
|
35
|
+
* A color as DTCG 2025.10 writes it: components in the document's profile, alpha, and the hex
|
|
36
|
+
* code tools display. The hex is the sRGB code of those components clamped to sRGB, which is the
|
|
37
|
+
* stored color in an sRGB document and an approximation in Display P3, where components can
|
|
38
|
+
* pass 1.
|
|
39
|
+
*/
|
|
40
|
+
export function colorTokenValue(color: Color, profile: ColorProfile = 'srgb') {
|
|
41
|
+
const shown = profile === 'srgb' ? color : convertColor(color, profile, 'srgb')
|
|
36
42
|
return {
|
|
37
|
-
colorSpace:
|
|
43
|
+
colorSpace: profile,
|
|
38
44
|
components: [trimNumber(color.r), trimNumber(color.g), trimNumber(color.b)],
|
|
39
45
|
alpha: trimNumber(color.a),
|
|
40
|
-
hex: colorToHex(
|
|
46
|
+
hex: colorToHex(shown).toLowerCase()
|
|
41
47
|
}
|
|
42
48
|
}
|
|
43
49
|
|
|
@@ -54,9 +60,10 @@ function durationTokenValue(value: number, unit: TokenUnit) {
|
|
|
54
60
|
/** A variable's own value in the shape its token type takes. */
|
|
55
61
|
export function literalTokenValue(
|
|
56
62
|
variable: Variable,
|
|
57
|
-
value: Color | number | string | boolean
|
|
63
|
+
value: Color | number | string | boolean,
|
|
64
|
+
profile: ColorProfile = 'srgb'
|
|
58
65
|
): unknown {
|
|
59
|
-
if (typeof value === 'object') return colorTokenValue(value)
|
|
66
|
+
if (typeof value === 'object') return colorTokenValue(value, profile)
|
|
60
67
|
if (typeof value === 'boolean') return value ? 1 : 0
|
|
61
68
|
if (typeof value === 'string') return value
|
|
62
69
|
const type = variableTokenType(variable)
|