@motion-proto/live-tokens 0.50.0 → 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.
- package/.claude/skills/live-tokens-adjust-shape-space/SKILL.md +7 -1
- package/CHANGELOG.md +108 -0
- package/bin/adjust.mjs +16 -39
- package/bin/generate-theme.mjs +20 -6
- package/dist-plugin/adjust/index.cjs +781 -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 +43 -21
- package/dist-plugin/{chunk-6OZFXIQI.js → chunk-232GZGQU.js} +207 -12
- package/dist-plugin/chunk-NE6N66EE.js +753 -0
- package/dist-plugin/{chunk-76TFDTJO.js → chunk-PB2JTK2H.js} +179 -128
- package/dist-plugin/{chunk-44RSTAII.js → chunk-TKZBVIW5.js} +33 -5
- package/dist-plugin/chunk-YR6GPXW2.js +129 -0
- package/dist-plugin/generateColorsAndType/index.cjs +135 -63
- package/dist-plugin/generateColorsAndType/index.d.cts +2 -1
- package/dist-plugin/generateColorsAndType/index.d.ts +2 -1
- package/dist-plugin/generateColorsAndType/index.js +28 -784
- package/dist-plugin/{themeTypes-DSwKq-bj.d.ts → index-DpTIRZ2H.d.cts} +67 -26
- package/dist-plugin/{themeTypes-DSwKq-bj.d.cts → index-DpTIRZ2H.d.ts} +67 -26
- package/dist-plugin/index.cjs +1254 -140
- package/dist-plugin/index.js +106 -82
- package/dist-plugin/migrateData/index.cjs +956 -14
- package/dist-plugin/migrateData/index.js +10 -3
- package/dist-plugin/tokensCssMigrations/index.cjs +71 -5
- package/dist-plugin/tokensCssMigrations/index.d.cts +20 -9
- package/dist-plugin/tokensCssMigrations/index.d.ts +20 -9
- package/dist-plugin/tokensCssMigrations/index.js +4 -1
- package/package.json +8 -4
- package/src/editor/component-editor/NotificationEditor.svelte +6 -0
- 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 +49 -22
- package/src/editor/core/components/aliasKinds.ts +7 -2
- package/src/editor/core/components/componentConfigService.ts +1 -1
- package/src/editor/core/palettes/oklch.ts +3 -137
- package/src/editor/core/palettes/paletteDerivation.ts +79 -37
- 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 +18 -8
- 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/slices/gradients.ts +5 -58
- package/src/editor/core/themes/themeService.ts +22 -9
- package/src/editor/core/themes/themeTypes.ts +89 -27
- package/src/editor/docs/content/editing-tokens.md +6 -2
- 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 +3 -3
- package/src/editor/index.ts +1 -0
- package/src/editor/styles/ui-editor.css +5 -2
- package/src/editor/ui/BezierCurveEditor.svelte +90 -67
- package/src/editor/ui/PaletteEditor.svelte +180 -59
- package/src/editor/ui/ThemePanel.svelte +24 -15
- package/src/editor/ui/Toggle.svelte +36 -24
- 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/ColorStory.svelte +12 -8
- package/src/editor/ui/colors/ColorsTab.svelte +4 -5
- package/src/editor/ui/curveEngine.ts +101 -21
- package/src/editor/ui/palette/OverridesPanel.svelte +23 -8
- package/src/editor/ui/palette/PaletteBase.svelte +17 -78
- package/src/editor/ui/palette/PaletteJumpButton.svelte +3 -3
- package/src/editor/ui/palette/ScaleCurveEditor.svelte +110 -20
- package/src/editor/ui/palette/curveSummary.ts +20 -0
- package/src/editor/ui/palette/dockMagnify.ts +5 -13
- package/src/editor/ui/palette/paletteMath.ts +7 -4
- package/src/live-tokens/data/colors-and-type/autumn.json +528 -528
- package/src/live-tokens/data/colors-and-type/default.json +247 -247
- package/src/live-tokens/data/colors-and-type/halloween.json +532 -532
- package/src/live-tokens/data/colors-and-type/midnight-study.json +538 -538
- package/src/live-tokens/data/colors-and-type/ocean.json +521 -521
- package/src/live-tokens/data/colors-and-type/royal-velvet.json +532 -532
- package/src/live-tokens/data/colors-and-type/spring-meadow.json +504 -504
- package/src/live-tokens/data/colors-and-type/sunset.json +531 -531
- package/src/live-tokens/data/themes/autumn.json +604 -568
- package/src/live-tokens/data/themes/halloween.json +584 -583
- package/src/live-tokens/data/themes/midnight-study.json +673 -605
- package/src/live-tokens/data/themes/ocean.json +597 -561
- package/src/live-tokens/data/themes/royal-velvet.json +574 -573
- package/src/live-tokens/data/themes/spring-meadow.json +590 -556
- package/src/live-tokens/data/themes/sunset.json +632 -571
- package/src/live-tokens/data/tokens.generated.css +282 -282
- package/src/system/components/FloatingTokenTags.css +0 -1
- package/src/system/internal/backgroundContrast.ts +7 -0
- package/src/system/internal/oklch.ts +189 -0
- package/src/system/styles/tokens.css +283 -283
|
@@ -4,18 +4,28 @@ import {
|
|
|
4
4
|
PALETTE_SPECS,
|
|
5
5
|
PALETTE_STEPS,
|
|
6
6
|
SCALES,
|
|
7
|
-
|
|
8
|
-
hexToOklch,
|
|
7
|
+
formatGradientValue,
|
|
9
8
|
makeAnchor,
|
|
10
|
-
oklchToHex,
|
|
11
9
|
palettesToVars,
|
|
10
|
+
resmoothAutoCurve,
|
|
12
11
|
sanitizeFileName,
|
|
13
12
|
scaleCurveDefaults,
|
|
14
13
|
scaleStepToX,
|
|
15
14
|
scaleToCssVar,
|
|
16
15
|
setCurveAnchor,
|
|
17
16
|
syncBaseAnchor
|
|
18
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-PB2JTK2H.js";
|
|
18
|
+
import {
|
|
19
|
+
CURRENT_COLORS_AND_TYPE_SCHEMA_VERSION,
|
|
20
|
+
CURRENT_COMPONENT_SCHEMA_VERSION
|
|
21
|
+
} from "../chunk-NE6N66EE.js";
|
|
22
|
+
import {
|
|
23
|
+
cssColorToOklch,
|
|
24
|
+
gamutClamp,
|
|
25
|
+
hexToOklch,
|
|
26
|
+
oklchToHex,
|
|
27
|
+
oklchToHexClamped
|
|
28
|
+
} from "../chunk-YR6GPXW2.js";
|
|
19
29
|
import {
|
|
20
30
|
readLiveTokensConfig,
|
|
21
31
|
resolveDataDirs
|
|
@@ -75,38 +85,6 @@ function makeDefaultGradients() {
|
|
|
75
85
|
}
|
|
76
86
|
];
|
|
77
87
|
}
|
|
78
|
-
function formatGradientStop(s) {
|
|
79
|
-
return `${formatGradientStopColor(s)} ${s.position}%`;
|
|
80
|
-
}
|
|
81
|
-
function formatGradientValue(v) {
|
|
82
|
-
if (v.type === "none") return "transparent";
|
|
83
|
-
if (v.type === "solid") {
|
|
84
|
-
const first = v.stops[0];
|
|
85
|
-
if (!first) return "transparent";
|
|
86
|
-
return formatGradientStopColor(first);
|
|
87
|
-
}
|
|
88
|
-
const stops = v.stops.map(formatGradientStop).join(", ");
|
|
89
|
-
if (v.type === "linear") return `linear-gradient(${v.angle}deg, ${stops})`;
|
|
90
|
-
const cx = v.centerX ?? 50;
|
|
91
|
-
return `radial-gradient(${formatRadialShape(v)} at ${cx}% 50%, ${stops})`;
|
|
92
|
-
}
|
|
93
|
-
var DEFAULT_RADIAL_BASE_PX = 100;
|
|
94
|
-
function formatRadialShape(v) {
|
|
95
|
-
const ax = v.aspectX ?? 1;
|
|
96
|
-
const ay = v.aspectY ?? 1;
|
|
97
|
-
if (ax === 1 && ay === 1) {
|
|
98
|
-
return v.radius && v.radius > 0 ? `circle ${v.radius}px` : "circle";
|
|
99
|
-
}
|
|
100
|
-
const base = v.radius && v.radius > 0 ? v.radius : DEFAULT_RADIAL_BASE_PX;
|
|
101
|
-
const rx = base * ax;
|
|
102
|
-
const ry = base * ay;
|
|
103
|
-
return `ellipse ${rx.toFixed(2)}px ${ry.toFixed(2)}px`;
|
|
104
|
-
}
|
|
105
|
-
function formatGradientStopColor(s) {
|
|
106
|
-
const base = s.color.startsWith("--") ? `var(${s.color})` : s.color;
|
|
107
|
-
const opacity = s.opacity ?? 100;
|
|
108
|
-
return opacity >= 100 ? base : `color-mix(in srgb, ${base} ${opacity}%, transparent)`;
|
|
109
|
-
}
|
|
110
88
|
|
|
111
89
|
// src/editor/core/palettes/contrast.ts
|
|
112
90
|
var AA_BODY = 4.5;
|
|
@@ -188,7 +166,7 @@ function findLForContrast(opts) {
|
|
|
188
166
|
}
|
|
189
167
|
|
|
190
168
|
// src/editor/ui/palette/paletteMath.ts
|
|
191
|
-
var DEFAULT_NEUTRAL_LIGHTNESS = () => [makeAnchor(0, 92
|
|
169
|
+
var DEFAULT_NEUTRAL_LIGHTNESS = () => resmoothAutoCurve([makeAnchor(0, 92), makeAnchor(100, 3)]);
|
|
192
170
|
function defaultPaletteConfig(opts) {
|
|
193
171
|
const cfg = {
|
|
194
172
|
baseColor: opts.baseColor,
|
|
@@ -212,746 +190,6 @@ function defaultScaleCurvesObject(scheme = "dark") {
|
|
|
212
190
|
};
|
|
213
191
|
}
|
|
214
192
|
|
|
215
|
-
// src/editor/core/themes/migrations/2026-04-24-legacy-keys-and-bg-to-canvas.ts
|
|
216
|
-
var LEGACY_KEY_RENAMES = {
|
|
217
|
-
"--empty": "--page-bg",
|
|
218
|
-
"--empty-attachment": "--page-bg-attachment",
|
|
219
|
-
// Orphan exports dropped from tokens.css; no new home — silently discard.
|
|
220
|
-
"--border-neutral": null,
|
|
221
|
-
// Shadow cleanup: these five tokens were removed (low/zero consumers,
|
|
222
|
-
// aesthetic drift). Dialog migrated onto --shadow-2xl; focus rings moved
|
|
223
|
-
// to their own --ring-focus-* namespace, which themes don't carry by
|
|
224
|
-
// default — tokens.css provides the canonical values.
|
|
225
|
-
"--shadow-app": null,
|
|
226
|
-
"--shadow-card": null,
|
|
227
|
-
"--shadow-overlay": null,
|
|
228
|
-
"--shadow-focus": null,
|
|
229
|
-
"--shadow-glow-green": null
|
|
230
|
-
};
|
|
231
|
-
var BG_TO_CANVAS_PREFIXES = ["--color-bg-", "--surface-bg", "--border-bg", "--text-bg"];
|
|
232
|
-
function migrateBgToCanvas(rawVars) {
|
|
233
|
-
for (const oldKey of Object.keys(rawVars)) {
|
|
234
|
-
for (const prefix of BG_TO_CANVAS_PREFIXES) {
|
|
235
|
-
if (!oldKey.startsWith(prefix)) continue;
|
|
236
|
-
const suffix = oldKey.slice(prefix.length);
|
|
237
|
-
if (suffix && !suffix.startsWith("-")) continue;
|
|
238
|
-
const newKey = prefix.replace("-bg", "-canvas") + suffix;
|
|
239
|
-
if (newKey === oldKey) continue;
|
|
240
|
-
const value = rawVars[oldKey];
|
|
241
|
-
delete rawVars[oldKey];
|
|
242
|
-
if (!(newKey in rawVars)) rawVars[newKey] = value;
|
|
243
|
-
break;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
function migrateLegacyKeys(rawVars) {
|
|
248
|
-
for (const [oldKey, newKey] of Object.entries(LEGACY_KEY_RENAMES)) {
|
|
249
|
-
if (!(oldKey in rawVars)) continue;
|
|
250
|
-
const value = rawVars[oldKey];
|
|
251
|
-
delete rawVars[oldKey];
|
|
252
|
-
if (newKey && !(newKey in rawVars)) rawVars[newKey] = value;
|
|
253
|
-
}
|
|
254
|
-
migrateBgToCanvas(rawVars);
|
|
255
|
-
}
|
|
256
|
-
var colorsAndTypeMigration_2026_04_24_legacyKeysAndBgToCanvas = {
|
|
257
|
-
id: "2026-04-24-legacy-keys-and-bg-to-canvas",
|
|
258
|
-
fromVersion: 0,
|
|
259
|
-
toVersion: 1,
|
|
260
|
-
appliesTo: "colors-and-type",
|
|
261
|
-
apply(rawVars) {
|
|
262
|
-
const out = { ...rawVars };
|
|
263
|
-
migrateLegacyKeys(out);
|
|
264
|
-
return out;
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
// src/editor/core/themes/migrations/2026-04-24-component-prefix-and-suffix-renames.ts
|
|
269
|
-
var COMPONENT_PREFIX_RENAMES = {
|
|
270
|
-
"--segment-": "--segmentedcontrol-",
|
|
271
|
-
"--collapsible-": "--collapsiblesection-",
|
|
272
|
-
"--progress-": "--progressbar-",
|
|
273
|
-
"--section-divider-": "--sectiondivider-",
|
|
274
|
-
"--radio-": "--radiobutton-",
|
|
275
|
-
"--inline-edit-": "--inlineeditactions-"
|
|
276
|
-
};
|
|
277
|
-
var COMPONENT_SUFFIX_RENAMES = {
|
|
278
|
-
progressbar: [["-track-bg", "-track-surface"]],
|
|
279
|
-
inlineeditactions: [
|
|
280
|
-
["-bg-hover", "-hover-surface"],
|
|
281
|
-
["-bg", "-surface"]
|
|
282
|
-
]
|
|
283
|
-
};
|
|
284
|
-
var componentMigration_2026_04_24_prefixAndSuffixRenames = {
|
|
285
|
-
id: "2026-04-24-component-prefix-and-suffix-renames",
|
|
286
|
-
fromVersion: 0,
|
|
287
|
-
toVersion: 1,
|
|
288
|
-
appliesTo: "component-config",
|
|
289
|
-
apply(rawVars, meta) {
|
|
290
|
-
const component = meta.component ?? "";
|
|
291
|
-
const out = {};
|
|
292
|
-
const suffixRules = COMPONENT_SUFFIX_RENAMES[component] ?? [];
|
|
293
|
-
for (const [oldKey, value] of Object.entries(rawVars)) {
|
|
294
|
-
let key = oldKey;
|
|
295
|
-
if (key === "--detail-nav-bg") key = "--detailnav-surface";
|
|
296
|
-
for (const [oldPrefix, newPrefix] of Object.entries(COMPONENT_PREFIX_RENAMES)) {
|
|
297
|
-
if (key.startsWith(oldPrefix)) {
|
|
298
|
-
key = newPrefix + key.slice(oldPrefix.length);
|
|
299
|
-
break;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
for (const [oldSuffix, newSuffix] of suffixRules) {
|
|
303
|
-
if (key.endsWith(oldSuffix)) {
|
|
304
|
-
key = key.slice(0, -oldSuffix.length) + newSuffix;
|
|
305
|
-
break;
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
if (!(key in out)) out[key] = value;
|
|
309
|
-
}
|
|
310
|
-
return out;
|
|
311
|
-
}
|
|
312
|
-
};
|
|
313
|
-
|
|
314
|
-
// src/editor/core/themes/migrations/2026-04-27-segmentedcontrol-disabled-flatten.ts
|
|
315
|
-
var OPTION_DISABLED_PREFIX = "--segmentedcontrol-option-disabled-";
|
|
316
|
-
var DISABLED_PREFIX = "--segmentedcontrol-disabled-";
|
|
317
|
-
var SELECTED_DISABLED_PREFIX = "--segmentedcontrol-selected-disabled-";
|
|
318
|
-
var SELECTED_HOVER_PREFIX = "--segmentedcontrol-selected-hover-";
|
|
319
|
-
var componentMigration_2026_04_27_segmentedcontrolDisabledFlatten = {
|
|
320
|
-
id: "2026-04-27-segmentedcontrol-disabled-flatten",
|
|
321
|
-
fromVersion: 1,
|
|
322
|
-
toVersion: 2,
|
|
323
|
-
appliesTo: "component-config",
|
|
324
|
-
apply(rawVars, meta) {
|
|
325
|
-
if (meta.component !== "segmentedcontrol") return { ...rawVars };
|
|
326
|
-
const out = {};
|
|
327
|
-
for (const [oldKey, value] of Object.entries(rawVars)) {
|
|
328
|
-
let key = oldKey;
|
|
329
|
-
if (key.startsWith(SELECTED_DISABLED_PREFIX)) continue;
|
|
330
|
-
if (key.startsWith(SELECTED_HOVER_PREFIX)) continue;
|
|
331
|
-
if (key.startsWith(OPTION_DISABLED_PREFIX)) {
|
|
332
|
-
key = DISABLED_PREFIX + key.slice(OPTION_DISABLED_PREFIX.length);
|
|
333
|
-
}
|
|
334
|
-
if (!(key in out)) out[key] = value;
|
|
335
|
-
}
|
|
336
|
-
return out;
|
|
337
|
-
}
|
|
338
|
-
};
|
|
339
|
-
|
|
340
|
-
// src/editor/core/themes/migrations/2026-05-08-collapsiblesection-variant-namespace.ts
|
|
341
|
-
var PREFIX = "--collapsiblesection-";
|
|
342
|
-
var STATE_NAMES = /* @__PURE__ */ new Set(["default", "hover", "active", "expanded"]);
|
|
343
|
-
var componentMigration_2026_05_08_collapsiblesectionVariantNamespace = {
|
|
344
|
-
id: "2026-05-08-collapsiblesection-variant-namespace",
|
|
345
|
-
fromVersion: 2,
|
|
346
|
-
toVersion: 3,
|
|
347
|
-
appliesTo: "component-config",
|
|
348
|
-
apply(rawVars, meta) {
|
|
349
|
-
if (meta.component !== "collapsiblesection") return { ...rawVars };
|
|
350
|
-
const out = {};
|
|
351
|
-
for (const [oldKey, value] of Object.entries(rawVars)) {
|
|
352
|
-
let key = oldKey;
|
|
353
|
-
if (key.startsWith(PREFIX)) {
|
|
354
|
-
const tail = key.slice(PREFIX.length);
|
|
355
|
-
const firstSegment = tail.split("-", 1)[0];
|
|
356
|
-
if (STATE_NAMES.has(firstSegment)) {
|
|
357
|
-
key = `${PREFIX}container-${tail}`;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
if (!(key in out)) out[key] = value;
|
|
361
|
-
}
|
|
362
|
-
return out;
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
|
-
|
|
366
|
-
// src/editor/core/themes/migrations/2026-05-08-collapsiblesection-frame-and-cleanup.ts
|
|
367
|
-
var PFX = "--collapsiblesection-";
|
|
368
|
-
var componentMigration_2026_05_08_collapsiblesectionFrameAndCleanup = {
|
|
369
|
-
id: "2026-05-08-collapsiblesection-frame-and-cleanup",
|
|
370
|
-
fromVersion: 3,
|
|
371
|
-
toVersion: 4,
|
|
372
|
-
appliesTo: "component-config",
|
|
373
|
-
apply(rawVars, meta) {
|
|
374
|
-
if (meta.component !== "collapsiblesection") return { ...rawVars };
|
|
375
|
-
const out = {};
|
|
376
|
-
for (const prop of ["surface", "border", "border-width", "radius"]) {
|
|
377
|
-
const src = `${PFX}container-default-${prop}`;
|
|
378
|
-
if (src in rawVars) {
|
|
379
|
-
out[`${PFX}container-frame-${prop}`] = rawVars[src];
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
for (const [key, value] of Object.entries(rawVars)) {
|
|
383
|
-
if (/^--collapsiblesection-chromeless-(default|hover|active)-(border|border-width|radius)$/.test(key)) continue;
|
|
384
|
-
if (/^--collapsiblesection-container-(hover|active)-(border|border-width|radius)$/.test(key)) continue;
|
|
385
|
-
if (/^--collapsiblesection-container-default-(border|border-width|radius)$/.test(key)) continue;
|
|
386
|
-
if (/^--collapsiblesection-divider-(default|hover|active)-radius$/.test(key)) continue;
|
|
387
|
-
if (/^--collapsiblesection-(chromeless|divider|container)-expanded-(border|border-width|radius)$/.test(key)) continue;
|
|
388
|
-
if (/^--collapsiblesection-(chromeless|divider)-expanded-surface$/.test(key)) continue;
|
|
389
|
-
if (!(key in out)) out[key] = value;
|
|
390
|
-
}
|
|
391
|
-
return out;
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
|
|
395
|
-
// src/editor/core/themes/migrations/2026-05-10-sectiondivider-gradient-stops.ts
|
|
396
|
-
var PFX2 = "--sectiondivider-";
|
|
397
|
-
var VARIANTS = ["canvas", "neutral", "alternate", "primary", "accent", "special"];
|
|
398
|
-
var OLD_STOP_RE = /^--sectiondivider-(canvas|neutral|alternate|primary|accent|special)-gradient-stop-\d+$/;
|
|
399
|
-
var componentMigration_2026_05_10_sectiondividerGradientStops = {
|
|
400
|
-
id: "2026-05-10-sectiondivider-gradient-stops",
|
|
401
|
-
fromVersion: 4,
|
|
402
|
-
toVersion: 5,
|
|
403
|
-
appliesTo: "component-config",
|
|
404
|
-
apply(rawVars, meta) {
|
|
405
|
-
if (meta.component !== "sectiondivider") return { ...rawVars };
|
|
406
|
-
const out = {};
|
|
407
|
-
for (const [key, value] of Object.entries(rawVars)) {
|
|
408
|
-
if (OLD_STOP_RE.test(key)) continue;
|
|
409
|
-
out[key] = value;
|
|
410
|
-
}
|
|
411
|
-
const setIfMissing = (key, fallback) => {
|
|
412
|
-
if (!(key in out)) out[key] = fallback;
|
|
413
|
-
};
|
|
414
|
-
for (const v of VARIANTS) {
|
|
415
|
-
const old1 = rawVars[`${PFX2}${v}-gradient-stop-1`];
|
|
416
|
-
const old2 = rawVars[`${PFX2}${v}-gradient-stop-2`];
|
|
417
|
-
const old4 = rawVars[`${PFX2}${v}-gradient-stop-4`];
|
|
418
|
-
setIfMissing(`${PFX2}${v}-gradient-angle`, "--gradient-angle-diagonal");
|
|
419
|
-
setIfMissing(`${PFX2}${v}-gradient-stop-1-color`, old1 ?? `--surface-${v}-highest`);
|
|
420
|
-
setIfMissing(`${PFX2}${v}-gradient-stop-1-position`, "--gradient-stop-start");
|
|
421
|
-
setIfMissing(`${PFX2}${v}-gradient-stop-2-color`, old2 ?? `--surface-${v}-higher`);
|
|
422
|
-
setIfMissing(`${PFX2}${v}-gradient-stop-2-position`, "--gradient-stop-mid");
|
|
423
|
-
setIfMissing(`${PFX2}${v}-gradient-stop-3-color`, old4 ?? `--surface-${v}`);
|
|
424
|
-
setIfMissing(`${PFX2}${v}-gradient-stop-3-position`, "--gradient-stop-end");
|
|
425
|
-
}
|
|
426
|
-
return out;
|
|
427
|
-
}
|
|
428
|
-
};
|
|
429
|
-
|
|
430
|
-
// src/editor/core/themes/migrations/2026-05-13-primary-to-brand.ts
|
|
431
|
-
var PALETTE_STEPS2 = ["100", "200", "300", "400", "500", "600", "700", "800", "850", "900", "950"];
|
|
432
|
-
var SURFACE_SUFFIXES = ["lowest", "lower", "low", "high", "higher", "highest"];
|
|
433
|
-
var BORDER_SUFFIXES = ["faint", "subtle", "medium", "strong"];
|
|
434
|
-
var TEXT_SUFFIXES = ["secondary", "tertiary", "muted", "disabled"];
|
|
435
|
-
var RENAME_MAP = (() => {
|
|
436
|
-
const m = {};
|
|
437
|
-
for (const step of PALETTE_STEPS2) m[`--color-primary-${step}`] = `--color-brand-${step}`;
|
|
438
|
-
m["--surface-primary"] = "--surface-brand";
|
|
439
|
-
for (const suf of SURFACE_SUFFIXES) m[`--surface-primary-${suf}`] = `--surface-brand-${suf}`;
|
|
440
|
-
m["--border-primary"] = "--border-brand";
|
|
441
|
-
for (const suf of BORDER_SUFFIXES) m[`--border-primary-${suf}`] = `--border-brand-${suf}`;
|
|
442
|
-
m["--text-primary-color"] = "--text-brand";
|
|
443
|
-
for (const suf of TEXT_SUFFIXES) m[`--text-primary-${suf}`] = `--text-brand-${suf}`;
|
|
444
|
-
return m;
|
|
445
|
-
})();
|
|
446
|
-
function renameToken(name) {
|
|
447
|
-
return RENAME_MAP[name] ?? name;
|
|
448
|
-
}
|
|
449
|
-
function renameKeys(rawVars) {
|
|
450
|
-
const out = {};
|
|
451
|
-
for (const [k, v] of Object.entries(rawVars)) {
|
|
452
|
-
out[renameToken(k)] = v;
|
|
453
|
-
}
|
|
454
|
-
return out;
|
|
455
|
-
}
|
|
456
|
-
function renameKeysAndValues(rawVars) {
|
|
457
|
-
const out = {};
|
|
458
|
-
for (const [k, v] of Object.entries(rawVars)) {
|
|
459
|
-
out[renameToken(k)] = renameToken(v);
|
|
460
|
-
}
|
|
461
|
-
return out;
|
|
462
|
-
}
|
|
463
|
-
var colorsAndTypeMigration_2026_05_13_primaryToBrand = {
|
|
464
|
-
id: "2026-05-13-primary-to-brand-theme",
|
|
465
|
-
fromVersion: 1,
|
|
466
|
-
toVersion: 2,
|
|
467
|
-
appliesTo: "colors-and-type",
|
|
468
|
-
apply: renameKeys
|
|
469
|
-
};
|
|
470
|
-
var componentMigration_2026_05_13_primaryToBrand = {
|
|
471
|
-
id: "2026-05-13-primary-to-brand-component",
|
|
472
|
-
fromVersion: 5,
|
|
473
|
-
toVersion: 6,
|
|
474
|
-
appliesTo: "component-config",
|
|
475
|
-
apply: renameKeysAndValues
|
|
476
|
-
};
|
|
477
|
-
|
|
478
|
-
// src/editor/core/themes/migrations/2026-05-19-collapsiblesection-drop-frame-surface.ts
|
|
479
|
-
function dropFrameSurface(rawVars, meta) {
|
|
480
|
-
if (meta.component !== "collapsiblesection") return rawVars;
|
|
481
|
-
const { "--collapsiblesection-container-frame-surface": _drop, ...rest } = rawVars;
|
|
482
|
-
return rest;
|
|
483
|
-
}
|
|
484
|
-
var componentMigration_2026_05_19_collapsiblesectionDropFrameSurface = {
|
|
485
|
-
id: "2026-05-19-collapsiblesection-drop-frame-surface",
|
|
486
|
-
fromVersion: 6,
|
|
487
|
-
toVersion: 7,
|
|
488
|
-
appliesTo: "component-config",
|
|
489
|
-
apply: dropFrameSurface
|
|
490
|
-
};
|
|
491
|
-
|
|
492
|
-
// src/editor/core/themes/migrations/2026-05-19-sectiondivider-rich-gradient.ts
|
|
493
|
-
var FLAT_RE = /^--sectiondivider-(canvas|neutral|alternate|primary|accent|special)-gradient-(angle|stop-[123]-(color|position))$/;
|
|
494
|
-
var componentMigration_2026_05_19_sectiondividerRichGradient = {
|
|
495
|
-
id: "2026-05-19-sectiondivider-rich-gradient",
|
|
496
|
-
fromVersion: 7,
|
|
497
|
-
toVersion: 8,
|
|
498
|
-
appliesTo: "component-config",
|
|
499
|
-
apply(rawVars, meta) {
|
|
500
|
-
if (meta.component !== "sectiondivider") return { ...rawVars };
|
|
501
|
-
const out = {};
|
|
502
|
-
for (const [key, value] of Object.entries(rawVars)) {
|
|
503
|
-
if (FLAT_RE.test(key)) continue;
|
|
504
|
-
out[key] = value;
|
|
505
|
-
}
|
|
506
|
-
return out;
|
|
507
|
-
}
|
|
508
|
-
};
|
|
509
|
-
|
|
510
|
-
// src/editor/core/themes/migrations/2026-05-20-sectiondivider-slim-variants.ts
|
|
511
|
-
var VARIANTS2 = ["lg", "md", "sm"];
|
|
512
|
-
var SUFFIX_RENAMES = [
|
|
513
|
-
[/-title-border-width$/, "-title-outline-width"],
|
|
514
|
-
[/-title-stroke-color$/, "-title-outline-color"],
|
|
515
|
-
[
|
|
516
|
-
/^--sectiondivider-(canvas|neutral|alternate|primary|accent|special)-padding$/,
|
|
517
|
-
"--sectiondivider-$1-spacing"
|
|
518
|
-
]
|
|
519
|
-
];
|
|
520
|
-
function renameKeySuffix(key) {
|
|
521
|
-
for (const [re, repl] of SUFFIX_RENAMES) {
|
|
522
|
-
if (re.test(key)) return key.replace(re, repl);
|
|
523
|
-
}
|
|
524
|
-
return key;
|
|
525
|
-
}
|
|
526
|
-
function splitFamilyKey(key) {
|
|
527
|
-
const m = key.match(/^--sectiondivider-(canvas|neutral|alternate|primary|accent|special)-(.+)$/);
|
|
528
|
-
if (!m) return null;
|
|
529
|
-
return { family: m[1], suffix: m[2] };
|
|
530
|
-
}
|
|
531
|
-
var componentMigration_2026_05_20_sectiondividerSlimVariants = {
|
|
532
|
-
id: "2026-05-20-sectiondivider-slim-variants",
|
|
533
|
-
fromVersion: 8,
|
|
534
|
-
toVersion: 9,
|
|
535
|
-
appliesTo: "component-config",
|
|
536
|
-
apply(rawVars, meta) {
|
|
537
|
-
if (meta.component !== "sectiondivider") return { ...rawVars };
|
|
538
|
-
const out = {};
|
|
539
|
-
const canvasValues = {};
|
|
540
|
-
for (const [rawKey, value] of Object.entries(rawVars)) {
|
|
541
|
-
const key = renameKeySuffix(rawKey);
|
|
542
|
-
const parts = splitFamilyKey(key);
|
|
543
|
-
if (!parts) {
|
|
544
|
-
out[key] = value;
|
|
545
|
-
continue;
|
|
546
|
-
}
|
|
547
|
-
if (parts.family !== "canvas") continue;
|
|
548
|
-
canvasValues[parts.suffix] = value;
|
|
549
|
-
}
|
|
550
|
-
for (const suffix of Object.keys(canvasValues)) {
|
|
551
|
-
for (const v of VARIANTS2) {
|
|
552
|
-
out[`--sectiondivider-${v}-${suffix}`] = canvasValues[suffix];
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
return out;
|
|
556
|
-
}
|
|
557
|
-
};
|
|
558
|
-
|
|
559
|
-
// src/editor/core/themes/migrations/2026-05-21-sectiondivider-spacing-to-padding.ts
|
|
560
|
-
var componentMigration_2026_05_21_sectiondividerSpacingToPadding = {
|
|
561
|
-
id: "2026-05-21-sectiondivider-spacing-to-padding",
|
|
562
|
-
fromVersion: 9,
|
|
563
|
-
toVersion: 10,
|
|
564
|
-
appliesTo: "component-config",
|
|
565
|
-
apply(rawVars, meta) {
|
|
566
|
-
if (meta.component !== "sectiondivider") return { ...rawVars };
|
|
567
|
-
const out = {};
|
|
568
|
-
for (const [key, value] of Object.entries(rawVars)) {
|
|
569
|
-
const renamed = key.replace(
|
|
570
|
-
/^--sectiondivider-(lg|md|sm)-spacing$/,
|
|
571
|
-
"--sectiondivider-$1-padding"
|
|
572
|
-
);
|
|
573
|
-
out[renamed] = value;
|
|
574
|
-
}
|
|
575
|
-
return out;
|
|
576
|
-
}
|
|
577
|
-
};
|
|
578
|
-
|
|
579
|
-
// src/editor/core/themes/migrations/2026-05-22-sectiondivider-intrinsics-to-css.ts
|
|
580
|
-
var componentMigration_2026_05_22_sectiondividerIntrinsicsToCss = {
|
|
581
|
-
id: "2026-05-22-sectiondivider-intrinsics-to-css",
|
|
582
|
-
fromVersion: 10,
|
|
583
|
-
toVersion: 11,
|
|
584
|
-
appliesTo: "component-config",
|
|
585
|
-
apply(rawVars, meta) {
|
|
586
|
-
if (meta.component !== "sectiondivider") return { ...rawVars };
|
|
587
|
-
const VARIANTS4 = ["lg", "md", "sm"];
|
|
588
|
-
const prefix = "--sectiondivider-";
|
|
589
|
-
const dropped = /* @__PURE__ */ new Set();
|
|
590
|
-
for (const v of VARIANTS4) {
|
|
591
|
-
dropped.add(`${prefix}${v}-show-eyebrow`);
|
|
592
|
-
dropped.add(`${prefix}${v}-show-description`);
|
|
593
|
-
dropped.add(`${prefix}${v}-show-hairline`);
|
|
594
|
-
dropped.add(`${prefix}${v}-hairline`);
|
|
595
|
-
dropped.add(`${prefix}${v}-eyebrow-uppercase`);
|
|
596
|
-
}
|
|
597
|
-
const out = {};
|
|
598
|
-
for (const [key, value] of Object.entries(rawVars)) {
|
|
599
|
-
if (dropped.has(key)) continue;
|
|
600
|
-
out[key] = value;
|
|
601
|
-
}
|
|
602
|
-
for (const v of VARIANTS4) {
|
|
603
|
-
const showEyebrow = rawVars[`${prefix}${v}-show-eyebrow`];
|
|
604
|
-
if (showEyebrow !== void 0) {
|
|
605
|
-
out[`${prefix}${v}-eyebrow-display`] = showEyebrow === "1" ? "block" : "none";
|
|
606
|
-
}
|
|
607
|
-
const showDesc = rawVars[`${prefix}${v}-show-description`];
|
|
608
|
-
if (showDesc !== void 0) {
|
|
609
|
-
out[`${prefix}${v}-description-display`] = showDesc === "1" ? "flex" : "none";
|
|
610
|
-
}
|
|
611
|
-
const showHair = rawVars[`${prefix}${v}-show-hairline`];
|
|
612
|
-
const oldHair = rawVars[`${prefix}${v}-hairline`];
|
|
613
|
-
const oldHairIsPos = typeof oldHair === "string" && oldHair !== "" && oldHair !== "off";
|
|
614
|
-
let newHair;
|
|
615
|
-
if (showHair === "") newHair = "none";
|
|
616
|
-
else if (showHair === "1") newHair = oldHairIsPos ? oldHair : "above-label";
|
|
617
|
-
else if (oldHair !== void 0) newHair = oldHairIsPos ? oldHair : "none";
|
|
618
|
-
if (newHair !== void 0) {
|
|
619
|
-
out[`${prefix}${v}-hairline`] = newHair;
|
|
620
|
-
}
|
|
621
|
-
const upper = rawVars[`${prefix}${v}-eyebrow-uppercase`];
|
|
622
|
-
if (upper !== void 0) {
|
|
623
|
-
out[`${prefix}${v}-eyebrow-text-transform`] = upper === "1" ? "uppercase" : "none";
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
return out;
|
|
627
|
-
}
|
|
628
|
-
};
|
|
629
|
-
|
|
630
|
-
// src/editor/core/themes/migrations/2026-05-24-segmentedcontrol-divider-inset.ts
|
|
631
|
-
var componentMigration_2026_05_24_segmentedcontrolDividerInset = {
|
|
632
|
-
id: "2026-05-24-segmentedcontrol-divider-inset",
|
|
633
|
-
fromVersion: 11,
|
|
634
|
-
toVersion: 12,
|
|
635
|
-
appliesTo: "component-config",
|
|
636
|
-
apply(rawVars, meta) {
|
|
637
|
-
if (meta.component !== "segmentedcontrol") return { ...rawVars };
|
|
638
|
-
const out = {};
|
|
639
|
-
for (const [key, value] of Object.entries(rawVars)) {
|
|
640
|
-
if (key === "--segmentedcontrol-divider-height") continue;
|
|
641
|
-
out[key] = value;
|
|
642
|
-
}
|
|
643
|
-
return out;
|
|
644
|
-
}
|
|
645
|
-
};
|
|
646
|
-
|
|
647
|
-
// src/editor/core/themes/migrations/2026-05-24-promote-state-shared-tokens.ts
|
|
648
|
-
var BUTTON_VARIANTS = ["primary", "secondary", "outline", "success", "danger", "warning"];
|
|
649
|
-
var BUTTON_STATES = ["hover", "disabled"];
|
|
650
|
-
var BUTTON_PROPS = ["padding", "radius", "border-width"];
|
|
651
|
-
var buttonDeadKeys = new Set(
|
|
652
|
-
BUTTON_VARIANTS.flatMap(
|
|
653
|
-
(v) => BUTTON_STATES.flatMap(
|
|
654
|
-
(s) => BUTTON_PROPS.map((p) => `--button-${v}-${s}-${p}`)
|
|
655
|
-
)
|
|
656
|
-
)
|
|
657
|
-
);
|
|
658
|
-
var segmentedcontrolDeadKeys = /* @__PURE__ */ new Set([
|
|
659
|
-
"--segmentedcontrol-selected-icon-size",
|
|
660
|
-
"--segmentedcontrol-option-hover-icon-size",
|
|
661
|
-
"--segmentedcontrol-disabled-icon-size"
|
|
662
|
-
]);
|
|
663
|
-
var componentMigration_2026_05_24_promoteStateSharedTokens = {
|
|
664
|
-
id: "2026-05-24-promote-state-shared-tokens",
|
|
665
|
-
fromVersion: 12,
|
|
666
|
-
toVersion: 13,
|
|
667
|
-
appliesTo: "component-config",
|
|
668
|
-
apply(rawVars, meta) {
|
|
669
|
-
const dead = meta.component === "button" ? buttonDeadKeys : meta.component === "segmentedcontrol" ? segmentedcontrolDeadKeys : null;
|
|
670
|
-
if (!dead) return { ...rawVars };
|
|
671
|
-
const out = {};
|
|
672
|
-
for (const [key, value] of Object.entries(rawVars)) {
|
|
673
|
-
if (dead.has(key)) continue;
|
|
674
|
-
out[key] = value;
|
|
675
|
-
}
|
|
676
|
-
return out;
|
|
677
|
-
}
|
|
678
|
-
};
|
|
679
|
-
|
|
680
|
-
// src/editor/core/themes/migrations/2026-05-24-progressbar-collapse-variants.ts
|
|
681
|
-
var PRIMARY_PREFIX = "--progressbar-primary-";
|
|
682
|
-
var NEW_PREFIX = "--progressbar-";
|
|
683
|
-
var DROP_PREFIXES = [
|
|
684
|
-
"--progressbar-success-",
|
|
685
|
-
"--progressbar-warning-",
|
|
686
|
-
"--progressbar-danger-",
|
|
687
|
-
"--progressbar-info-"
|
|
688
|
-
];
|
|
689
|
-
var componentMigration_2026_05_24_progressbarCollapseVariants = {
|
|
690
|
-
id: "2026-05-24-progressbar-collapse-variants",
|
|
691
|
-
fromVersion: 13,
|
|
692
|
-
toVersion: 14,
|
|
693
|
-
appliesTo: "component-config",
|
|
694
|
-
apply(rawVars, meta) {
|
|
695
|
-
if (meta.component !== "progressbar") return { ...rawVars };
|
|
696
|
-
const out = {};
|
|
697
|
-
for (const [oldKey, value] of Object.entries(rawVars)) {
|
|
698
|
-
if (DROP_PREFIXES.some((p) => oldKey.startsWith(p))) continue;
|
|
699
|
-
const key = oldKey.startsWith(PRIMARY_PREFIX) ? NEW_PREFIX + oldKey.slice(PRIMARY_PREFIX.length) : oldKey;
|
|
700
|
-
if (!(key in out)) out[key] = value;
|
|
701
|
-
}
|
|
702
|
-
return out;
|
|
703
|
-
}
|
|
704
|
-
};
|
|
705
|
-
|
|
706
|
-
// src/editor/core/themes/migrations/2026-05-24-collapsiblesection-drop-active-state.ts
|
|
707
|
-
function dropActiveState(rawVars, meta) {
|
|
708
|
-
if (meta.component !== "collapsiblesection") return rawVars;
|
|
709
|
-
const re = /^--collapsiblesection-(chromeless|divider|container)-active-/;
|
|
710
|
-
const out = {};
|
|
711
|
-
for (const [key, value] of Object.entries(rawVars)) {
|
|
712
|
-
if (re.test(key)) continue;
|
|
713
|
-
out[key] = value;
|
|
714
|
-
}
|
|
715
|
-
return out;
|
|
716
|
-
}
|
|
717
|
-
var componentMigration_2026_05_24_collapsiblesectionDropActiveState = {
|
|
718
|
-
id: "2026-05-24-collapsiblesection-drop-active-state",
|
|
719
|
-
fromVersion: 14,
|
|
720
|
-
toVersion: 15,
|
|
721
|
-
appliesTo: "component-config",
|
|
722
|
-
apply: dropActiveState
|
|
723
|
-
};
|
|
724
|
-
|
|
725
|
-
// src/editor/core/themes/migrations/2026-05-25-cornerbadge-flatten-variants.ts
|
|
726
|
-
var VARIANTS3 = ["primary", "accent", "neutral", "alternate", "canvas", "special", "success", "warning", "danger", "info"];
|
|
727
|
-
var RE = new RegExp(`^--corner-badge-(${VARIANTS3.join("|")})-(.+)$`);
|
|
728
|
-
var CURRENT_COLOR_PROPS = /* @__PURE__ */ new Set(["surface", "border", "text"]);
|
|
729
|
-
function flattenVariants(rawVars, meta) {
|
|
730
|
-
if (meta.component !== "cornerbadge") return rawVars;
|
|
731
|
-
const out = {};
|
|
732
|
-
const collected = /* @__PURE__ */ new Map();
|
|
733
|
-
for (const [key, value] of Object.entries(rawVars)) {
|
|
734
|
-
const m = key.match(RE);
|
|
735
|
-
if (m) {
|
|
736
|
-
const prop = m[2];
|
|
737
|
-
if (CURRENT_COLOR_PROPS.has(prop)) {
|
|
738
|
-
out[key] = value;
|
|
739
|
-
continue;
|
|
740
|
-
}
|
|
741
|
-
if (!collected.has(prop)) collected.set(prop, value);
|
|
742
|
-
continue;
|
|
743
|
-
}
|
|
744
|
-
out[key] = value;
|
|
745
|
-
}
|
|
746
|
-
for (const [prop, value] of collected) {
|
|
747
|
-
const flatKey = `--corner-badge-${prop}`;
|
|
748
|
-
if (!(flatKey in out)) out[flatKey] = value;
|
|
749
|
-
}
|
|
750
|
-
return out;
|
|
751
|
-
}
|
|
752
|
-
var componentMigration_2026_05_25_cornerbadgeFlattenVariants = {
|
|
753
|
-
id: "2026-05-25-cornerbadge-flatten-variants",
|
|
754
|
-
fromVersion: 15,
|
|
755
|
-
toVersion: 16,
|
|
756
|
-
appliesTo: "component-config",
|
|
757
|
-
apply: flattenVariants
|
|
758
|
-
};
|
|
759
|
-
|
|
760
|
-
// src/editor/core/themes/migrations/2026-05-26-drop-overlay-extra-stops.ts
|
|
761
|
-
var DROPPED_TO_KEPT = {
|
|
762
|
-
"--overlay-lowest": "--overlay-low",
|
|
763
|
-
"--overlay-lower": "--overlay-low",
|
|
764
|
-
"--overlay-higher": "--overlay-high",
|
|
765
|
-
"--overlay-highest": "--overlay-high"
|
|
766
|
-
};
|
|
767
|
-
var colorsAndTypeMigration_2026_05_26_dropOverlayExtraStops = {
|
|
768
|
-
id: "2026-05-26-drop-overlay-extra-stops-theme",
|
|
769
|
-
fromVersion: 2,
|
|
770
|
-
toVersion: 3,
|
|
771
|
-
appliesTo: "colors-and-type",
|
|
772
|
-
apply(rawVars) {
|
|
773
|
-
const out = {};
|
|
774
|
-
for (const [key, value] of Object.entries(rawVars)) {
|
|
775
|
-
if (key in DROPPED_TO_KEPT) continue;
|
|
776
|
-
out[key] = value;
|
|
777
|
-
}
|
|
778
|
-
return out;
|
|
779
|
-
}
|
|
780
|
-
};
|
|
781
|
-
var componentMigration_2026_05_26_dropOverlayExtraStops = {
|
|
782
|
-
id: "2026-05-26-drop-overlay-extra-stops-component",
|
|
783
|
-
fromVersion: 16,
|
|
784
|
-
toVersion: 17,
|
|
785
|
-
appliesTo: "component-config",
|
|
786
|
-
apply(rawVars) {
|
|
787
|
-
const out = {};
|
|
788
|
-
for (const [key, value] of Object.entries(rawVars)) {
|
|
789
|
-
out[key] = DROPPED_TO_KEPT[value] ?? value;
|
|
790
|
-
}
|
|
791
|
-
return out;
|
|
792
|
-
}
|
|
793
|
-
};
|
|
794
|
-
|
|
795
|
-
// src/editor/core/themes/migrations/2026-05-29-tabbar-indicator-thickness-to-per-state-width.ts
|
|
796
|
-
var TABBAR_STATES = ["default", "hover", "active", "disabled"];
|
|
797
|
-
var OLD_KEY = "--tabbar-bar-indicator-thickness";
|
|
798
|
-
var FALLBACK = "--border-width-2";
|
|
799
|
-
var componentMigration_2026_05_29_tabbarIndicatorThicknessToPerStateWidth = {
|
|
800
|
-
id: "2026-05-29-tabbar-indicator-thickness-to-per-state-width",
|
|
801
|
-
fromVersion: 17,
|
|
802
|
-
toVersion: 18,
|
|
803
|
-
appliesTo: "component-config",
|
|
804
|
-
apply(rawVars, meta) {
|
|
805
|
-
if (meta.component !== "tabbar") return { ...rawVars };
|
|
806
|
-
const seed = rawVars[OLD_KEY] ?? FALLBACK;
|
|
807
|
-
const out = {};
|
|
808
|
-
for (const [key, value] of Object.entries(rawVars)) {
|
|
809
|
-
if (key === OLD_KEY) continue;
|
|
810
|
-
out[key] = value;
|
|
811
|
-
}
|
|
812
|
-
for (const state of TABBAR_STATES) {
|
|
813
|
-
const newKey = `--tabbar-${state}-indicator-border-width`;
|
|
814
|
-
if (!(newKey in out)) out[newKey] = seed;
|
|
815
|
-
}
|
|
816
|
-
return out;
|
|
817
|
-
}
|
|
818
|
-
};
|
|
819
|
-
|
|
820
|
-
// src/editor/core/themes/migrations/2026-05-29-segmentedcontrol-small-divider-rename.ts
|
|
821
|
-
var RENAMES = {
|
|
822
|
-
"--segmentedcontrol-divider-small-thickness": "--segmentedcontrol-small-divider-thickness",
|
|
823
|
-
"--segmentedcontrol-divider-small-inset": "--segmentedcontrol-small-divider-inset"
|
|
824
|
-
};
|
|
825
|
-
var componentMigration_2026_05_29_segmentedcontrolSmallDividerRename = {
|
|
826
|
-
id: "2026-05-29-segmentedcontrol-small-divider-rename",
|
|
827
|
-
fromVersion: 18,
|
|
828
|
-
toVersion: 19,
|
|
829
|
-
appliesTo: "component-config",
|
|
830
|
-
apply(rawVars, meta) {
|
|
831
|
-
if (meta.component !== "segmentedcontrol") return { ...rawVars };
|
|
832
|
-
const out = {};
|
|
833
|
-
for (const [key, value] of Object.entries(rawVars)) {
|
|
834
|
-
out[RENAMES[key] ?? key] = value;
|
|
835
|
-
}
|
|
836
|
-
return out;
|
|
837
|
-
}
|
|
838
|
-
};
|
|
839
|
-
|
|
840
|
-
// src/editor/core/themes/migrations/2026-05-29-toggle-derive-track-from-thumb.ts
|
|
841
|
-
var componentMigration_2026_05_29_toggleDeriveTrackFromThumb = {
|
|
842
|
-
id: "2026-05-29-toggle-derive-track-from-thumb",
|
|
843
|
-
fromVersion: 19,
|
|
844
|
-
toVersion: 20,
|
|
845
|
-
appliesTo: "component-config",
|
|
846
|
-
apply(rawVars, meta) {
|
|
847
|
-
if (meta.component !== "toggle") return { ...rawVars };
|
|
848
|
-
const out = {};
|
|
849
|
-
for (const [key, value] of Object.entries(rawVars)) {
|
|
850
|
-
if (key === "--toggle-track-width" || key === "--toggle-track-thickness") continue;
|
|
851
|
-
out[key] = value;
|
|
852
|
-
}
|
|
853
|
-
if (!("--toggle-track-padding" in out)) {
|
|
854
|
-
out["--toggle-track-padding"] = "--space-2";
|
|
855
|
-
}
|
|
856
|
-
return out;
|
|
857
|
-
}
|
|
858
|
-
};
|
|
859
|
-
|
|
860
|
-
// src/editor/core/themes/migrations/2026-08-13-drop-legacy-shape-space-keys.ts
|
|
861
|
-
var DROPPED = /* @__PURE__ */ new Set([
|
|
862
|
-
"--badge-trait-radius",
|
|
863
|
-
"--badge-trait-padding",
|
|
864
|
-
"--sectiondivider-padding",
|
|
865
|
-
"--dialog-primary-default-radius",
|
|
866
|
-
"--dialog-primary-default-padding",
|
|
867
|
-
"--dialog-primary-hover-radius",
|
|
868
|
-
"--dialog-primary-hover-padding",
|
|
869
|
-
"--dialog-secondary-default-radius",
|
|
870
|
-
"--dialog-secondary-default-padding",
|
|
871
|
-
"--dialog-secondary-hover-radius",
|
|
872
|
-
"--dialog-secondary-hover-padding"
|
|
873
|
-
]);
|
|
874
|
-
var colorsAndTypeMigration_2026_08_13_dropLegacyShapeSpaceKeys = {
|
|
875
|
-
id: "2026-08-13-drop-legacy-shape-space-keys",
|
|
876
|
-
fromVersion: 3,
|
|
877
|
-
toVersion: 4,
|
|
878
|
-
appliesTo: "colors-and-type",
|
|
879
|
-
apply(rawVars) {
|
|
880
|
-
const out = {};
|
|
881
|
-
for (const [key, value] of Object.entries(rawVars)) {
|
|
882
|
-
if (DROPPED.has(key)) continue;
|
|
883
|
-
out[key] = value;
|
|
884
|
-
}
|
|
885
|
-
return out;
|
|
886
|
-
}
|
|
887
|
-
};
|
|
888
|
-
|
|
889
|
-
// src/editor/core/themes/migrations/2026-08-15-line-height-scale-rename.ts
|
|
890
|
-
var RENAMED = {
|
|
891
|
-
"--line-height-xs": "--line-height-none",
|
|
892
|
-
"--line-height-sm": "--line-height-tighter",
|
|
893
|
-
"--line-height-md": "--line-height-normal",
|
|
894
|
-
"--line-height-lg": "--line-height-relaxed",
|
|
895
|
-
"--line-height-xl": "--line-height-relaxed"
|
|
896
|
-
};
|
|
897
|
-
var REFERENCE = /--line-height-(?:xs|sm|md|lg|xl)(?![\w-])/g;
|
|
898
|
-
function renameValues(rawVars) {
|
|
899
|
-
const out = {};
|
|
900
|
-
for (const [key, value] of Object.entries(rawVars)) {
|
|
901
|
-
out[key] = typeof value === "string" ? value.replace(REFERENCE, (name) => RENAMED[name]) : value;
|
|
902
|
-
}
|
|
903
|
-
return out;
|
|
904
|
-
}
|
|
905
|
-
var colorsAndTypeMigration_2026_08_15_lineHeightScaleRename = {
|
|
906
|
-
id: "2026-08-15-line-height-scale-rename-colors-and-type",
|
|
907
|
-
fromVersion: 4,
|
|
908
|
-
toVersion: 5,
|
|
909
|
-
appliesTo: "colors-and-type",
|
|
910
|
-
apply: renameValues
|
|
911
|
-
};
|
|
912
|
-
var componentMigration_2026_08_15_lineHeightScaleRename = {
|
|
913
|
-
id: "2026-08-15-line-height-scale-rename-component",
|
|
914
|
-
fromVersion: 20,
|
|
915
|
-
toVersion: 21,
|
|
916
|
-
appliesTo: "component-config",
|
|
917
|
-
apply: renameValues
|
|
918
|
-
};
|
|
919
|
-
|
|
920
|
-
// src/editor/core/themes/migrations/index.ts
|
|
921
|
-
var MIGRATIONS = [
|
|
922
|
-
colorsAndTypeMigration_2026_04_24_legacyKeysAndBgToCanvas,
|
|
923
|
-
colorsAndTypeMigration_2026_05_13_primaryToBrand,
|
|
924
|
-
componentMigration_2026_04_24_prefixAndSuffixRenames,
|
|
925
|
-
componentMigration_2026_04_27_segmentedcontrolDisabledFlatten,
|
|
926
|
-
componentMigration_2026_05_08_collapsiblesectionVariantNamespace,
|
|
927
|
-
componentMigration_2026_05_08_collapsiblesectionFrameAndCleanup,
|
|
928
|
-
componentMigration_2026_05_10_sectiondividerGradientStops,
|
|
929
|
-
componentMigration_2026_05_13_primaryToBrand,
|
|
930
|
-
componentMigration_2026_05_19_collapsiblesectionDropFrameSurface,
|
|
931
|
-
componentMigration_2026_05_19_sectiondividerRichGradient,
|
|
932
|
-
componentMigration_2026_05_20_sectiondividerSlimVariants,
|
|
933
|
-
componentMigration_2026_05_21_sectiondividerSpacingToPadding,
|
|
934
|
-
componentMigration_2026_05_22_sectiondividerIntrinsicsToCss,
|
|
935
|
-
componentMigration_2026_05_24_segmentedcontrolDividerInset,
|
|
936
|
-
componentMigration_2026_05_24_promoteStateSharedTokens,
|
|
937
|
-
componentMigration_2026_05_24_progressbarCollapseVariants,
|
|
938
|
-
componentMigration_2026_05_24_collapsiblesectionDropActiveState,
|
|
939
|
-
componentMigration_2026_05_25_cornerbadgeFlattenVariants,
|
|
940
|
-
colorsAndTypeMigration_2026_05_26_dropOverlayExtraStops,
|
|
941
|
-
componentMigration_2026_05_26_dropOverlayExtraStops,
|
|
942
|
-
componentMigration_2026_05_29_tabbarIndicatorThicknessToPerStateWidth,
|
|
943
|
-
componentMigration_2026_05_29_segmentedcontrolSmallDividerRename,
|
|
944
|
-
componentMigration_2026_05_29_toggleDeriveTrackFromThumb,
|
|
945
|
-
colorsAndTypeMigration_2026_08_13_dropLegacyShapeSpaceKeys,
|
|
946
|
-
colorsAndTypeMigration_2026_08_15_lineHeightScaleRename,
|
|
947
|
-
componentMigration_2026_08_15_lineHeightScaleRename
|
|
948
|
-
];
|
|
949
|
-
function countFor(kind) {
|
|
950
|
-
return MIGRATIONS.filter((m) => m.appliesTo === kind).length;
|
|
951
|
-
}
|
|
952
|
-
var CURRENT_COLORS_AND_TYPE_SCHEMA_VERSION = countFor("colors-and-type");
|
|
953
|
-
var CURRENT_COMPONENT_SCHEMA_VERSION = countFor("component-config");
|
|
954
|
-
|
|
955
193
|
// src/editor/core/themes/generateColorsAndType.ts
|
|
956
194
|
var HEX_RE = /^#[0-9a-f]{6}$/i;
|
|
957
195
|
var HARMONY_MODES = [
|
|
@@ -1055,12 +293,16 @@ function surfaceVars() {
|
|
|
1055
293
|
"--page-bg"
|
|
1056
294
|
];
|
|
1057
295
|
}
|
|
296
|
+
function varToHex(value) {
|
|
297
|
+
const parsed = value ? cssColorToOklch(value) : null;
|
|
298
|
+
return parsed ? oklchToHexClamped(parsed.l, parsed.c, parsed.h) : null;
|
|
299
|
+
}
|
|
1058
300
|
function worstSurface(textHex, vars) {
|
|
1059
301
|
let against = "";
|
|
1060
302
|
let ratio = Infinity;
|
|
1061
303
|
for (const surfVar of surfaceVars()) {
|
|
1062
|
-
const surfHex = vars[surfVar];
|
|
1063
|
-
if (!surfHex
|
|
304
|
+
const surfHex = varToHex(vars[surfVar]);
|
|
305
|
+
if (!surfHex) continue;
|
|
1064
306
|
const r = contrastRatio(textHex, surfHex);
|
|
1065
307
|
if (r < ratio) {
|
|
1066
308
|
ratio = r;
|
|
@@ -1088,17 +330,18 @@ function runContrastGate(configs, scheme) {
|
|
|
1088
330
|
const vars = palettesToVars(configs);
|
|
1089
331
|
let anyFixed = false;
|
|
1090
332
|
for (const def of defs) {
|
|
1091
|
-
const
|
|
1092
|
-
if (!
|
|
333
|
+
const text = cssColorToOklch(vars[def.textVar] ?? "");
|
|
334
|
+
if (!text) continue;
|
|
335
|
+
const textHex = oklchToHexClamped(text.l, text.c, text.h);
|
|
1093
336
|
const worst = worstSurface(textHex, vars);
|
|
1094
337
|
if (worst.ratio >= def.floor) continue;
|
|
1095
338
|
const cfg = configs[def.paletteLabel];
|
|
1096
339
|
const seed = cfg.baseColor;
|
|
1097
340
|
const solved = findLForContrast({
|
|
1098
|
-
against: vars[worst.against],
|
|
341
|
+
against: varToHex(vars[worst.against]) ?? "#000000",
|
|
1099
342
|
ratio: def.target,
|
|
1100
343
|
direction,
|
|
1101
|
-
c:
|
|
344
|
+
c: text.c,
|
|
1102
345
|
h: seed.h,
|
|
1103
346
|
lMax: Math.min(1, 2 * seed.l)
|
|
1104
347
|
});
|
|
@@ -1110,7 +353,7 @@ function runContrastGate(configs, scheme) {
|
|
|
1110
353
|
}
|
|
1111
354
|
const finalVars = palettesToVars(configs);
|
|
1112
355
|
const checks = defs.map((def) => {
|
|
1113
|
-
const worst = worstSurface(finalVars[def.textVar] ?? "#000000", finalVars);
|
|
356
|
+
const worst = worstSurface(varToHex(finalVars[def.textVar]) ?? "#000000", finalVars);
|
|
1114
357
|
return {
|
|
1115
358
|
textVar: def.textVar,
|
|
1116
359
|
floor: def.floor,
|
|
@@ -1214,6 +457,7 @@ function buildColorsAndTypeFromSeeds(brief, carry = {}, now = (/* @__PURE__ */ n
|
|
|
1214
457
|
};
|
|
1215
458
|
}
|
|
1216
459
|
export {
|
|
460
|
+
CURRENT_COMPONENT_SCHEMA_VERSION,
|
|
1217
461
|
buildColorsAndTypeFromSeeds,
|
|
1218
462
|
readLiveTokensConfig,
|
|
1219
463
|
resolveDataDirs,
|