@motion-proto/live-tokens 0.52.1 → 0.53.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.
Files changed (60) hide show
  1. package/.claude/skills/live-tokens-adjust-shape-space/SKILL.md +7 -1
  2. package/CHANGELOG.md +63 -0
  3. package/bin/adjust.mjs +16 -39
  4. package/bin/generate-theme.mjs +20 -6
  5. package/dist-plugin/adjust/index.cjs +781 -21
  6. package/dist-plugin/adjust/index.d.cts +2 -1
  7. package/dist-plugin/adjust/index.d.ts +2 -1
  8. package/dist-plugin/adjust/index.js +43 -21
  9. package/dist-plugin/{chunk-6OZFXIQI.js → chunk-232GZGQU.js} +207 -12
  10. package/dist-plugin/chunk-NE6N66EE.js +753 -0
  11. package/dist-plugin/{chunk-JIGIIE5P.js → chunk-PB2JTK2H.js} +123 -0
  12. package/dist-plugin/generateColorsAndType/index.cjs +48 -32
  13. package/dist-plugin/generateColorsAndType/index.d.cts +2 -1
  14. package/dist-plugin/generateColorsAndType/index.d.ts +2 -1
  15. package/dist-plugin/generateColorsAndType/index.js +7 -773
  16. package/dist-plugin/{themeTypes-Dky03HL9.d.cts → index-DpTIRZ2H.d.cts} +49 -21
  17. package/dist-plugin/{themeTypes-Dky03HL9.d.ts → index-DpTIRZ2H.d.ts} +49 -21
  18. package/dist-plugin/index.cjs +1159 -85
  19. package/dist-plugin/index.js +102 -80
  20. package/dist-plugin/migrateData/index.cjs +956 -14
  21. package/dist-plugin/migrateData/index.js +10 -3
  22. package/package.json +6 -4
  23. package/src/editor/component-editor/scaffolding/ComponentFileManager.svelte +9 -23
  24. package/src/editor/component-editor/scaffolding/LinkedBlock.svelte +8 -8
  25. package/src/editor/core/components/adjustAliases.ts +49 -22
  26. package/src/editor/core/components/aliasKinds.ts +7 -2
  27. package/src/editor/core/components/componentConfigService.ts +1 -1
  28. package/src/editor/core/store/editorStore.ts +7 -197
  29. package/src/editor/core/store/editorTypes.ts +9 -30
  30. package/src/editor/core/themes/lookSummary.ts +3 -25
  31. package/src/editor/core/themes/migrateComponentConfig.ts +205 -0
  32. package/src/editor/core/themes/migrations/2026-05-19-sectiondivider-rich-gradient.ts +1 -1
  33. package/src/editor/core/themes/migrations/2026-05-20-sectiondivider-slim-variants.ts +1 -1
  34. package/src/editor/core/themes/migrations/2026-05-22-sectiondivider-intrinsics-to-css.ts +1 -1
  35. package/src/editor/core/themes/parsers/gradient.ts +211 -0
  36. package/src/editor/core/themes/slices/gradients.ts +5 -58
  37. package/src/editor/core/themes/themeService.ts +22 -9
  38. package/src/editor/core/themes/themeTypes.ts +71 -21
  39. package/src/editor/docs/content/themes-workflow.md +9 -11
  40. package/src/editor/docs/content/where-themes-live.md +2 -2
  41. package/src/editor/docs/content.generated.ts +2 -2
  42. package/src/editor/index.ts +1 -0
  43. package/src/editor/styles/ui-editor.css +5 -2
  44. package/src/editor/ui/PaletteEditor.svelte +30 -15
  45. package/src/editor/ui/ThemePanel.svelte +24 -15
  46. package/src/editor/ui/Toggle.svelte +22 -22
  47. package/src/editor/ui/UIPillButton.svelte +1 -1
  48. package/src/editor/ui/UIReveal.svelte +47 -0
  49. package/src/editor/ui/UISquareButton.svelte +1 -1
  50. package/src/editor/ui/colors/ColorsTab.svelte +4 -5
  51. package/src/editor/ui/palette/OverridesPanel.svelte +4 -3
  52. package/src/editor/ui/palette/PaletteJumpButton.svelte +3 -3
  53. package/src/editor/ui/palette/ScaleCurveEditor.svelte +3 -2
  54. package/src/live-tokens/data/themes/autumn.json +77 -41
  55. package/src/live-tokens/data/themes/halloween.json +53 -52
  56. package/src/live-tokens/data/themes/midnight-study.json +136 -68
  57. package/src/live-tokens/data/themes/ocean.json +77 -41
  58. package/src/live-tokens/data/themes/royal-velvet.json +43 -42
  59. package/src/live-tokens/data/themes/spring-meadow.json +86 -52
  60. package/src/live-tokens/data/themes/sunset.json +101 -40
@@ -9,6 +9,126 @@ function sanitizeFileName(name) {
9
9
  return name.toLowerCase().trim().replace(/\s+/g, "-").replace(/[^a-z0-9\-_]/g, "").replace(/-+/g, "-").replace(/^[-_]+|-+$/g, "") || "unnamed";
10
10
  }
11
11
 
12
+ // src/editor/core/themes/parsers/colorOpacity.ts
13
+ var COLOR_OPACITY_RE = /^color-mix\(in srgb,\s*var\((--[a-z0-9-]+)\)\s+(\d+)%,\s*transparent\)$/i;
14
+ function parseColorOpacity(value) {
15
+ const m = value.trim().match(COLOR_OPACITY_RE);
16
+ if (!m) return null;
17
+ return { name: m[1], opacity: parseInt(m[2], 10) };
18
+ }
19
+ function formatColorOpacity(name, opacity) {
20
+ return `color-mix(in srgb, var(${name}) ${opacity}%, transparent)`;
21
+ }
22
+
23
+ // src/editor/core/themes/parsers/gradient.ts
24
+ var RADIAL_BASE_PX = 100;
25
+ function formatStopColor(s) {
26
+ const opacity = s.opacity ?? 100;
27
+ if (s.color.startsWith("--")) {
28
+ return opacity >= 100 ? `var(${s.color})` : formatColorOpacity(s.color, opacity);
29
+ }
30
+ return opacity >= 100 ? s.color : `color-mix(in srgb, ${s.color} ${opacity}%, transparent)`;
31
+ }
32
+ function formatGradientStops(stops) {
33
+ return stops.map((s) => `${formatStopColor(s)} ${s.position}%`).join(", ");
34
+ }
35
+ function formatRadialShape(v) {
36
+ const ax = v.aspectX ?? 1;
37
+ const ay = v.aspectY ?? 1;
38
+ if (ax === 1 && ay === 1) {
39
+ return v.radius && v.radius > 0 ? `circle ${v.radius}px` : "circle";
40
+ }
41
+ const base = v.radius && v.radius > 0 ? v.radius : RADIAL_BASE_PX;
42
+ return `ellipse ${(base * ax).toFixed(2)}px ${(base * ay).toFixed(2)}px`;
43
+ }
44
+ function formatGradientValue(v) {
45
+ if (v.type === "none") return "transparent";
46
+ if (v.type === "solid") {
47
+ const first = v.stops[0];
48
+ return first ? formatStopColor(first) : "transparent";
49
+ }
50
+ const stops = formatGradientStops(v.stops);
51
+ if (v.type === "linear") return `linear-gradient(${v.angle}deg, ${stops})`;
52
+ return `radial-gradient(${formatRadialShape(v)} at ${v.centerX ?? 50}% 50%, ${stops})`;
53
+ }
54
+ var NUM = String.raw`-?\d+(?:\.\d+)?`;
55
+ var LINEAR_RE = new RegExp(String.raw`^linear-gradient\(\s*(${NUM})deg\s*,\s*(.+)\)$`, "i");
56
+ var RADIAL_RE = new RegExp(
57
+ String.raw`^radial-gradient\(\s*(circle|circle\s+${NUM}px|ellipse\s+${NUM}px\s+${NUM}px)\s+at\s+(${NUM})%\s+50%\s*,\s*(.+)\)$`,
58
+ "i"
59
+ );
60
+ var STOP_RE = new RegExp(String.raw`^(.*?)\s+(${NUM})%$`);
61
+ var CIRCLE_RADIUS_RE = new RegExp(String.raw`^circle\s+(${NUM})px$`, "i");
62
+ var ELLIPSE_RE = new RegExp(String.raw`^ellipse\s+(${NUM})px\s+(${NUM})px$`, "i");
63
+ var VAR_RE = /^var\((--[a-z0-9-]+)\)$/i;
64
+ function splitTopLevel(s) {
65
+ const parts = [];
66
+ let depth = 0;
67
+ let start = 0;
68
+ for (let i = 0; i < s.length; i++) {
69
+ const c = s[i];
70
+ if (c === "(") depth++;
71
+ else if (c === ")") depth--;
72
+ else if (c === "," && depth === 0) {
73
+ parts.push(s.slice(start, i));
74
+ start = i + 1;
75
+ }
76
+ }
77
+ parts.push(s.slice(start));
78
+ return parts;
79
+ }
80
+ function parseStop(raw) {
81
+ const m = raw.trim().match(STOP_RE);
82
+ if (!m) return null;
83
+ const position = parseFloat(m[2]);
84
+ const color = m[1].trim();
85
+ const opacity = parseColorOpacity(color);
86
+ if (opacity) return { position, color: opacity.name, opacity: opacity.opacity };
87
+ const token = color.match(VAR_RE);
88
+ return { position, color: token ? token[1] : color };
89
+ }
90
+ function parseStops(raw) {
91
+ const stops = [];
92
+ for (const part of splitTopLevel(raw)) {
93
+ const stop = parseStop(part);
94
+ if (!stop) return null;
95
+ stops.push(stop);
96
+ }
97
+ return stops.length > 0 ? stops : null;
98
+ }
99
+ function parseRadialShape(raw) {
100
+ const shape = raw.trim();
101
+ if (/^circle$/i.test(shape)) return {};
102
+ const circle = shape.match(CIRCLE_RADIUS_RE);
103
+ if (circle) return { radius: parseFloat(circle[1]) };
104
+ const ellipse = shape.match(ELLIPSE_RE);
105
+ if (!ellipse) return null;
106
+ const ax = parseFloat(ellipse[1]) / RADIAL_BASE_PX;
107
+ const ay = parseFloat(ellipse[2]) / RADIAL_BASE_PX;
108
+ return { ...ax === 1 ? {} : { aspectX: ax }, ...ay === 1 ? {} : { aspectY: ay } };
109
+ }
110
+ function parseGradientValue(value) {
111
+ const css = value.trim();
112
+ const linear = css.match(LINEAR_RE);
113
+ if (linear) {
114
+ const stops2 = parseStops(linear[2]);
115
+ return stops2 && { type: "linear", angle: parseFloat(linear[1]), stops: stops2 };
116
+ }
117
+ const radial = css.match(RADIAL_RE);
118
+ if (!radial) return null;
119
+ const shape = parseRadialShape(radial[1]);
120
+ const stops = parseStops(radial[3]);
121
+ if (!shape || !stops) return null;
122
+ const centerX = parseFloat(radial[2]);
123
+ return {
124
+ type: "radial",
125
+ angle: 0,
126
+ ...shape,
127
+ ...centerX === 50 ? {} : { centerX },
128
+ stops
129
+ };
130
+ }
131
+
12
132
  // src/editor/ui/curveEngine.ts
13
133
  function makeAnchor(x, y, tangentLen = 15) {
14
134
  return { x, y, inDx: -tangentLen, inDy: 0, outDx: tangentLen, outDy: 0 };
@@ -466,6 +586,9 @@ function reconcilePalettesFromCssVars(palettes, cssVars) {
466
586
  }
467
587
 
468
588
  export {
589
+ parseColorOpacity,
590
+ formatGradientValue,
591
+ parseGradientValue,
469
592
  sanitizeFileName,
470
593
  makeAnchor,
471
594
  resmoothAutoCurve,
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // vite-plugin/generateColorsAndType/index.ts
31
31
  var generateColorsAndType_exports = {};
32
32
  __export(generateColorsAndType_exports, {
33
+ CURRENT_COMPONENT_SCHEMA_VERSION: () => CURRENT_COMPONENT_SCHEMA_VERSION,
33
34
  buildColorsAndTypeFromSeeds: () => buildColorsAndTypeFromSeeds,
34
35
  readLiveTokensConfig: () => readLiveTokensConfig,
35
36
  resolveDataDirs: () => resolveDataDirs,
@@ -602,6 +603,52 @@ var canUndo = (0, import_store.derived)(historyTick, () => past.length > 0);
602
603
  var canRedo = (0, import_store.derived)(historyTick, () => future.length > 0);
603
604
  var dirty = (0, import_store.derived)(historyTick, () => past.length !== savedAtIndex);
604
605
 
606
+ // src/editor/core/themes/parsers/colorOpacity.ts
607
+ function formatColorOpacity(name, opacity) {
608
+ return `color-mix(in srgb, var(${name}) ${opacity}%, transparent)`;
609
+ }
610
+
611
+ // src/editor/core/themes/parsers/gradient.ts
612
+ var RADIAL_BASE_PX = 100;
613
+ function formatStopColor(s) {
614
+ const opacity = s.opacity ?? 100;
615
+ if (s.color.startsWith("--")) {
616
+ return opacity >= 100 ? `var(${s.color})` : formatColorOpacity(s.color, opacity);
617
+ }
618
+ return opacity >= 100 ? s.color : `color-mix(in srgb, ${s.color} ${opacity}%, transparent)`;
619
+ }
620
+ function formatGradientStops(stops) {
621
+ return stops.map((s) => `${formatStopColor(s)} ${s.position}%`).join(", ");
622
+ }
623
+ function formatRadialShape(v) {
624
+ const ax = v.aspectX ?? 1;
625
+ const ay = v.aspectY ?? 1;
626
+ if (ax === 1 && ay === 1) {
627
+ return v.radius && v.radius > 0 ? `circle ${v.radius}px` : "circle";
628
+ }
629
+ const base = v.radius && v.radius > 0 ? v.radius : RADIAL_BASE_PX;
630
+ return `ellipse ${(base * ax).toFixed(2)}px ${(base * ay).toFixed(2)}px`;
631
+ }
632
+ function formatGradientValue(v) {
633
+ if (v.type === "none") return "transparent";
634
+ if (v.type === "solid") {
635
+ const first = v.stops[0];
636
+ return first ? formatStopColor(first) : "transparent";
637
+ }
638
+ const stops = formatGradientStops(v.stops);
639
+ if (v.type === "linear") return `linear-gradient(${v.angle}deg, ${stops})`;
640
+ return `radial-gradient(${formatRadialShape(v)} at ${v.centerX ?? 50}% 50%, ${stops})`;
641
+ }
642
+ var NUM = String.raw`-?\d+(?:\.\d+)?`;
643
+ var LINEAR_RE = new RegExp(String.raw`^linear-gradient\(\s*(${NUM})deg\s*,\s*(.+)\)$`, "i");
644
+ var RADIAL_RE = new RegExp(
645
+ String.raw`^radial-gradient\(\s*(circle|circle\s+${NUM}px|ellipse\s+${NUM}px\s+${NUM}px)\s+at\s+(${NUM})%\s+50%\s*,\s*(.+)\)$`,
646
+ "i"
647
+ );
648
+ var STOP_RE = new RegExp(String.raw`^(.*?)\s+(${NUM})%$`);
649
+ var CIRCLE_RADIUS_RE = new RegExp(String.raw`^circle\s+(${NUM})px$`, "i");
650
+ var ELLIPSE_RE = new RegExp(String.raw`^ellipse\s+(${NUM})px\s+(${NUM})px$`, "i");
651
+
605
652
  // src/editor/core/themes/slices/gradients.ts
606
653
  function makeDefaultGradients() {
607
654
  return [
@@ -643,38 +690,6 @@ function makeDefaultGradients() {
643
690
  }
644
691
  ];
645
692
  }
646
- function formatGradientStop(s) {
647
- return `${formatGradientStopColor(s)} ${s.position}%`;
648
- }
649
- function formatGradientValue(v) {
650
- if (v.type === "none") return "transparent";
651
- if (v.type === "solid") {
652
- const first = v.stops[0];
653
- if (!first) return "transparent";
654
- return formatGradientStopColor(first);
655
- }
656
- const stops = v.stops.map(formatGradientStop).join(", ");
657
- if (v.type === "linear") return `linear-gradient(${v.angle}deg, ${stops})`;
658
- const cx = v.centerX ?? 50;
659
- return `radial-gradient(${formatRadialShape(v)} at ${cx}% 50%, ${stops})`;
660
- }
661
- var DEFAULT_RADIAL_BASE_PX = 100;
662
- function formatRadialShape(v) {
663
- const ax = v.aspectX ?? 1;
664
- const ay = v.aspectY ?? 1;
665
- if (ax === 1 && ay === 1) {
666
- return v.radius && v.radius > 0 ? `circle ${v.radius}px` : "circle";
667
- }
668
- const base = v.radius && v.radius > 0 ? v.radius : DEFAULT_RADIAL_BASE_PX;
669
- const rx = base * ax;
670
- const ry = base * ay;
671
- return `ellipse ${rx.toFixed(2)}px ${ry.toFixed(2)}px`;
672
- }
673
- function formatGradientStopColor(s) {
674
- const base = s.color.startsWith("--") ? `var(${s.color})` : s.color;
675
- const opacity = s.opacity ?? 100;
676
- return opacity >= 100 ? base : `color-mix(in srgb, ${base} ${opacity}%, transparent)`;
677
- }
678
693
 
679
694
  // src/editor/core/palettes/contrast.ts
680
695
  var AA_BODY = 4.5;
@@ -1841,6 +1856,7 @@ function resolveDataDirs(opts = {}) {
1841
1856
  }
1842
1857
  // Annotate the CommonJS export names for ESM import in node:
1843
1858
  0 && (module.exports = {
1859
+ CURRENT_COMPONENT_SCHEMA_VERSION,
1844
1860
  buildColorsAndTypeFromSeeds,
1845
1861
  readLiveTokensConfig,
1846
1862
  resolveDataDirs,
@@ -1,4 +1,5 @@
1
- import { F as FontSource, b as FontStack, G as GradientDiskToken, O as Oklch, H as HarmonyMode, C as ColorsAndType } from '../themeTypes-Dky03HL9.cjs';
1
+ import { F as FontSource, c as FontStack, G as GradientDiskToken, O as Oklch, H as HarmonyMode, a as ColorsAndType } from '../index-DpTIRZ2H.cjs';
2
+ export { C as CURRENT_COMPONENT_SCHEMA_VERSION } from '../index-DpTIRZ2H.cjs';
2
3
  export { r as readLiveTokensConfig, a as resolveDataDirs } from '../dataPaths-DBN0RPuT.cjs';
3
4
 
4
5
  /**
@@ -1,4 +1,5 @@
1
- import { F as FontSource, b as FontStack, G as GradientDiskToken, O as Oklch, H as HarmonyMode, C as ColorsAndType } from '../themeTypes-Dky03HL9.js';
1
+ import { F as FontSource, c as FontStack, G as GradientDiskToken, O as Oklch, H as HarmonyMode, a as ColorsAndType } from '../index-DpTIRZ2H.js';
2
+ export { C as CURRENT_COMPONENT_SCHEMA_VERSION } from '../index-DpTIRZ2H.js';
2
3
  export { r as readLiveTokensConfig, a as resolveDataDirs } from '../dataPaths-DBN0RPuT.js';
3
4
 
4
5
  /**