@motion-proto/live-tokens 0.52.1 → 0.54.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/.claude/skills/live-tokens-adjust-shape-space/SKILL.md +28 -3
- package/.claude/skills/live-tokens-generate-theme/SKILL.md +16 -1
- package/CHANGELOG.md +89 -0
- package/bin/adjust.mjs +16 -39
- package/bin/generate-theme.mjs +21 -6
- package/dist-plugin/adjust/index.cjs +785 -21
- package/dist-plugin/adjust/index.d.cts +2 -1
- package/dist-plugin/adjust/index.d.ts +2 -1
- package/dist-plugin/adjust/index.js +47 -21
- package/dist-plugin/{chunk-6OZFXIQI.js → chunk-232GZGQU.js} +207 -12
- package/dist-plugin/chunk-NE6N66EE.js +753 -0
- package/dist-plugin/{chunk-JIGIIE5P.js → chunk-PB2JTK2H.js} +123 -0
- package/dist-plugin/generateColorsAndType/index.cjs +110 -31
- package/dist-plugin/generateColorsAndType/index.d.cts +6 -2
- package/dist-plugin/generateColorsAndType/index.d.ts +6 -2
- package/dist-plugin/generateColorsAndType/index.js +69 -772
- package/dist-plugin/{themeTypes-Dky03HL9.d.cts → index-DpTIRZ2H.d.cts} +49 -21
- package/dist-plugin/{themeTypes-Dky03HL9.d.ts → index-DpTIRZ2H.d.ts} +49 -21
- package/dist-plugin/index.cjs +1159 -85
- package/dist-plugin/index.js +102 -80
- package/dist-plugin/migrateData/index.cjs +956 -14
- package/dist-plugin/migrateData/index.js +10 -3
- package/package.json +6 -4
- package/src/editor/component-editor/scaffolding/ComponentFileManager.svelte +9 -23
- package/src/editor/component-editor/scaffolding/LinkedBlock.svelte +8 -8
- package/src/editor/core/components/adjustAliases.ts +65 -22
- package/src/editor/core/components/aliasKinds.ts +7 -2
- package/src/editor/core/components/componentConfigService.ts +1 -1
- package/src/editor/core/store/editorStore.ts +7 -197
- package/src/editor/core/store/editorTypes.ts +9 -30
- package/src/editor/core/themes/generateColorsAndType.ts +50 -1
- package/src/editor/core/themes/lookSummary.ts +3 -25
- package/src/editor/core/themes/migrateComponentConfig.ts +205 -0
- package/src/editor/core/themes/migrations/2026-05-19-sectiondivider-rich-gradient.ts +1 -1
- package/src/editor/core/themes/migrations/2026-05-20-sectiondivider-slim-variants.ts +1 -1
- package/src/editor/core/themes/migrations/2026-05-22-sectiondivider-intrinsics-to-css.ts +1 -1
- package/src/editor/core/themes/parsers/gradient.ts +211 -0
- package/src/editor/core/themes/parsers/shadow.ts +52 -0
- package/src/editor/core/themes/slices/gradients.ts +5 -58
- package/src/editor/core/themes/slices/shadows.ts +2 -38
- package/src/editor/core/themes/themeService.ts +22 -9
- package/src/editor/core/themes/themeTypes.ts +71 -21
- package/src/editor/docs/content/themes-workflow.md +9 -11
- package/src/editor/docs/content/where-themes-live.md +2 -2
- package/src/editor/docs/content.generated.ts +2 -2
- package/src/editor/index.ts +1 -0
- package/src/editor/styles/ui-editor.css +5 -2
- package/src/editor/ui/PaletteEditor.svelte +30 -15
- package/src/editor/ui/ThemePanel.svelte +24 -15
- package/src/editor/ui/Toggle.svelte +22 -22
- package/src/editor/ui/UIPillButton.svelte +1 -1
- package/src/editor/ui/UIReveal.svelte +47 -0
- package/src/editor/ui/UISquareButton.svelte +1 -1
- package/src/editor/ui/colors/ColorsTab.svelte +4 -5
- package/src/editor/ui/palette/OverridesPanel.svelte +4 -3
- package/src/editor/ui/palette/PaletteJumpButton.svelte +3 -3
- package/src/editor/ui/palette/ScaleCurveEditor.svelte +3 -2
- package/src/live-tokens/data/colors-and-type/autumn.json +5 -5
- package/src/live-tokens/data/colors-and-type/ocean.json +5 -5
- package/src/live-tokens/data/colors-and-type/spring-meadow.json +5 -5
- package/src/live-tokens/data/themes/autumn.json +82 -46
- package/src/live-tokens/data/themes/halloween.json +53 -52
- package/src/live-tokens/data/themes/midnight-study.json +151 -83
- package/src/live-tokens/data/themes/ocean.json +82 -46
- package/src/live-tokens/data/themes/royal-velvet.json +43 -42
- package/src/live-tokens/data/themes/spring-meadow.json +91 -57
- package/src/live-tokens/data/themes/sunset.json +101 -40
- package/src/system/components/FloatingTokenTags.css +6 -4
- package/src/system/internal/backgroundContrast.ts +2 -1
|
@@ -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,37 +690,38 @@ function makeDefaultGradients() {
|
|
|
643
690
|
}
|
|
644
691
|
];
|
|
645
692
|
}
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
const
|
|
657
|
-
if (
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
function
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
const
|
|
669
|
-
const
|
|
670
|
-
const
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
const
|
|
675
|
-
const opacity =
|
|
676
|
-
|
|
693
|
+
|
|
694
|
+
// src/editor/core/themes/parsers/shadow.ts
|
|
695
|
+
var SHADOW_VAR_NAMES = [
|
|
696
|
+
"--shadow-sm",
|
|
697
|
+
"--shadow-md",
|
|
698
|
+
"--shadow-lg",
|
|
699
|
+
"--shadow-xl",
|
|
700
|
+
"--shadow-2xl"
|
|
701
|
+
];
|
|
702
|
+
function computeAngleDistance(x, y) {
|
|
703
|
+
const distance = Math.round(Math.sqrt(x * x + y * y));
|
|
704
|
+
if (distance === 0) return { angle: 135, distance: 0 };
|
|
705
|
+
let angle = Math.atan2(y, -x) * (180 / Math.PI);
|
|
706
|
+
if (angle < 0) angle += 360;
|
|
707
|
+
return { angle: Math.round(angle), distance };
|
|
708
|
+
}
|
|
709
|
+
function shadowTokenCss(t) {
|
|
710
|
+
return `${t.x}px ${t.y}px ${t.blur}px ${t.spread}px hsla(${t.hue}, ${t.saturation}%, ${t.lightness}%, ${t.opacity})`;
|
|
711
|
+
}
|
|
712
|
+
function parseShadowCss(variable, raw) {
|
|
713
|
+
const m = raw.trim().match(/^(-?\d+)px\s+(-?\d+)px\s+(\d+)px\s+(-?\d+)px\s+hsla\(([\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)$/);
|
|
714
|
+
if (!m) return null;
|
|
715
|
+
const x = parseInt(m[1], 10);
|
|
716
|
+
const y = parseInt(m[2], 10);
|
|
717
|
+
const blur = parseInt(m[3], 10);
|
|
718
|
+
const spread = parseInt(m[4], 10);
|
|
719
|
+
const hue = Math.round(parseFloat(m[5]));
|
|
720
|
+
const saturation = Math.round(parseFloat(m[6]));
|
|
721
|
+
const lightness = Math.round(parseFloat(m[7]));
|
|
722
|
+
const opacity = parseFloat(m[8]);
|
|
723
|
+
const { angle, distance } = computeAngleDistance(x, y);
|
|
724
|
+
return { variable, x, y, blur, spread, opacity, hue, saturation, lightness, angle, distance };
|
|
677
725
|
}
|
|
678
726
|
|
|
679
727
|
// src/editor/core/palettes/contrast.ts
|
|
@@ -1745,6 +1793,34 @@ function applyCanvasGradient(canvas, scheme) {
|
|
|
1745
1793
|
canvas.gradientSize = "window";
|
|
1746
1794
|
return `on, ${labels[sky]} \u2192 ${labels[anchor]}`;
|
|
1747
1795
|
}
|
|
1796
|
+
var STOCK_SHADOW_GEOMETRY = {
|
|
1797
|
+
"--shadow-sm": [1, 1, 2],
|
|
1798
|
+
"--shadow-md": [3, 3, 6],
|
|
1799
|
+
"--shadow-lg": [5, 5, 9],
|
|
1800
|
+
"--shadow-xl": [6, 7, 13],
|
|
1801
|
+
"--shadow-2xl": [8, 9, 16]
|
|
1802
|
+
};
|
|
1803
|
+
var STOCK_SHADOW_COLOR = { spread: 0, hue: 237, saturation: 18, lightness: 3, opacity: 0.9 };
|
|
1804
|
+
var SHADOW_OPACITY_DEEP = 0.9;
|
|
1805
|
+
var SHADOW_OPACITY_SOFT = 0.2;
|
|
1806
|
+
var SHADOW_GROUND_DEEP = 0.5;
|
|
1807
|
+
var SHADOW_GROUND_SOFT = 0.9;
|
|
1808
|
+
function shadowOpacityForCanvas(canvasL) {
|
|
1809
|
+
const t = (canvasL - SHADOW_GROUND_DEEP) / (SHADOW_GROUND_SOFT - SHADOW_GROUND_DEEP);
|
|
1810
|
+
const ramp = Math.max(0, Math.min(1, t));
|
|
1811
|
+
const opacity = SHADOW_OPACITY_DEEP + ramp * (SHADOW_OPACITY_SOFT - SHADOW_OPACITY_DEEP);
|
|
1812
|
+
return Math.round(opacity * 100) / 100;
|
|
1813
|
+
}
|
|
1814
|
+
function shadowVars(carried, canvas) {
|
|
1815
|
+
const opacity = shadowOpacityForCanvas(canvas.l);
|
|
1816
|
+
const out = {};
|
|
1817
|
+
for (const variable of SHADOW_VAR_NAMES) {
|
|
1818
|
+
const [x, y, blur] = STOCK_SHADOW_GEOMETRY[variable];
|
|
1819
|
+
const base = parseShadowCss(variable, carried[variable] ?? "") ?? { x, y, blur, ...STOCK_SHADOW_COLOR };
|
|
1820
|
+
out[variable] = shadowTokenCss({ ...base, opacity });
|
|
1821
|
+
}
|
|
1822
|
+
return out;
|
|
1823
|
+
}
|
|
1748
1824
|
function buildColorsAndTypeFromSeeds(brief, carry = {}, now = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
1749
1825
|
const { seeds, slug } = validateBrief(brief);
|
|
1750
1826
|
const configs = {};
|
|
@@ -1769,6 +1845,7 @@ function buildColorsAndTypeFromSeeds(brief, carry = {}, now = (/* @__PURE__ */ n
|
|
|
1769
1845
|
Object.entries(carry.cssVariables ?? {}).filter(([k]) => !owned.has(k))
|
|
1770
1846
|
);
|
|
1771
1847
|
for (const t of gradients) cssVariables[t.variable] = formatGradientValue(t);
|
|
1848
|
+
Object.assign(cssVariables, shadowVars(carry.cssVariables ?? {}, seeds.Canvas));
|
|
1772
1849
|
const colorsAndType = {
|
|
1773
1850
|
name: brief.name.trim(),
|
|
1774
1851
|
createdAt: now,
|
|
@@ -1787,6 +1864,7 @@ function buildColorsAndTypeFromSeeds(brief, carry = {}, now = (/* @__PURE__ */ n
|
|
|
1787
1864
|
report: {
|
|
1788
1865
|
...report,
|
|
1789
1866
|
gradients: gradients === carry.gradients ? "carried" : "recipes",
|
|
1867
|
+
shadows: `opacity ${shadowOpacityForCanvas(seeds.Canvas.l)} for a canvas at L ${seeds.Canvas.l.toFixed(2)}`,
|
|
1790
1868
|
...canvasGradient ? { canvasGradient } : {}
|
|
1791
1869
|
}
|
|
1792
1870
|
};
|
|
@@ -1841,6 +1919,7 @@ function resolveDataDirs(opts = {}) {
|
|
|
1841
1919
|
}
|
|
1842
1920
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1843
1921
|
0 && (module.exports = {
|
|
1922
|
+
CURRENT_COMPONENT_SCHEMA_VERSION,
|
|
1844
1923
|
buildColorsAndTypeFromSeeds,
|
|
1845
1924
|
readLiveTokensConfig,
|
|
1846
1925
|
resolveDataDirs,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { F as FontSource,
|
|
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
|
/**
|
|
@@ -40,7 +41,8 @@ interface ColorsAndTypeBrief {
|
|
|
40
41
|
canvasGradient?: boolean;
|
|
41
42
|
}
|
|
42
43
|
/** Non-color content carried forward from the currently active colors and type
|
|
43
|
-
* so gradients,
|
|
44
|
+
* so gradients, shadow geometry, component aliases, and fonts survive
|
|
45
|
+
* regeneration. Shadow opacity is derived, not carried — see `shadowVars`. */
|
|
44
46
|
interface CarryForward {
|
|
45
47
|
cssVariables?: Record<string, string>;
|
|
46
48
|
fontSources?: FontSource[];
|
|
@@ -67,6 +69,8 @@ interface GenerateColorsAndTypeReport {
|
|
|
67
69
|
* 'on, <sky> → <anchor>' or a 'skipped — …' explanation when the Canvas
|
|
68
70
|
* anchors at the ramp edge and leaves no room. */
|
|
69
71
|
canvasGradient?: string;
|
|
72
|
+
/** The derived shadow opacity and the canvas lightness it came from. */
|
|
73
|
+
shadows: string;
|
|
70
74
|
}
|
|
71
75
|
interface GenerateColorsAndTypeResult {
|
|
72
76
|
colorsAndType: ColorsAndType;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { F as FontSource,
|
|
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
|
/**
|
|
@@ -40,7 +41,8 @@ interface ColorsAndTypeBrief {
|
|
|
40
41
|
canvasGradient?: boolean;
|
|
41
42
|
}
|
|
42
43
|
/** Non-color content carried forward from the currently active colors and type
|
|
43
|
-
* so gradients,
|
|
44
|
+
* so gradients, shadow geometry, component aliases, and fonts survive
|
|
45
|
+
* regeneration. Shadow opacity is derived, not carried — see `shadowVars`. */
|
|
44
46
|
interface CarryForward {
|
|
45
47
|
cssVariables?: Record<string, string>;
|
|
46
48
|
fontSources?: FontSource[];
|
|
@@ -67,6 +69,8 @@ interface GenerateColorsAndTypeReport {
|
|
|
67
69
|
* 'on, <sky> → <anchor>' or a 'skipped — …' explanation when the Canvas
|
|
68
70
|
* anchors at the ramp edge and leaves no room. */
|
|
69
71
|
canvasGradient?: string;
|
|
72
|
+
/** The derived shadow opacity and the canvas lightness it came from. */
|
|
73
|
+
shadows: string;
|
|
70
74
|
}
|
|
71
75
|
interface GenerateColorsAndTypeResult {
|
|
72
76
|
colorsAndType: ColorsAndType;
|