@motion-proto/live-tokens 0.49.1 → 0.52.1
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/CHANGELOG.md +72 -0
- package/dist-plugin/adjust/index.d.cts +1 -1
- package/dist-plugin/adjust/index.d.ts +1 -1
- package/dist-plugin/{chunk-76TFDTJO.js → chunk-JIGIIE5P.js} +60 -132
- 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 +100 -33
- package/dist-plugin/generateColorsAndType/index.d.cts +1 -1
- package/dist-plugin/generateColorsAndType/index.d.ts +1 -1
- package/dist-plugin/generateColorsAndType/index.js +35 -14
- package/dist-plugin/index.cjs +95 -55
- package/dist-plugin/index.js +5 -3
- package/dist-plugin/{themeTypes-DSwKq-bj.d.cts → themeTypes-Dky03HL9.d.cts} +18 -5
- package/dist-plugin/{themeTypes-DSwKq-bj.d.ts → themeTypes-Dky03HL9.d.ts} +18 -5
- 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 -1
- package/src/editor/bootstrap.ts +2 -0
- package/src/editor/component-editor/ButtonEditor.svelte +1 -1
- package/src/editor/component-editor/CardEditor.svelte +5 -2
- package/src/editor/component-editor/IconButtonEditor.svelte +1 -1
- package/src/editor/component-editor/ImageEditor.svelte +1 -1
- package/src/editor/component-editor/NotificationEditor.svelte +6 -0
- package/src/editor/component-editor/SectionDividerEditor.svelte +4 -1
- package/src/editor/component-editor/SideNavigationEditor.svelte +6 -0
- package/src/editor/component-editor/TabBarEditor.svelte +1 -5
- package/src/editor/component-editor/scaffolding/ComponentEditorBase.svelte +8 -1
- package/src/editor/component-editor/scaffolding/ComponentFileManager.svelte +10 -32
- package/src/editor/component-editor/scaffolding/StateBlock.svelte +2 -0
- package/src/editor/component-editor/scaffolding/TypeEditor.svelte +3 -1
- package/src/editor/component-editor/scaffolding/types.ts +3 -0
- package/src/editor/core/components/componentConfigService.ts +25 -0
- package/src/editor/core/cssVarSync.ts +65 -7
- package/src/editor/core/fonts/fontLoader.ts +12 -3
- package/src/editor/core/fonts/fontWeightAvailability.ts +97 -0
- package/src/editor/core/palettes/oklch.ts +3 -137
- package/src/editor/core/palettes/paletteDerivation.ts +79 -37
- package/src/editor/core/preview/lookPreview.ts +23 -18
- package/src/editor/core/store/editorRenderer.ts +22 -7
- package/src/editor/core/store/editorStore.ts +31 -0
- package/src/editor/core/store/gradientSource.ts +5 -0
- package/src/editor/core/themes/colorsAndTypeService.ts +2 -12
- package/src/editor/core/themes/generateColorsAndType.ts +18 -8
- package/src/editor/core/themes/migrations/2026-05-20-sectiondivider-slim-variants.ts +4 -1
- package/src/editor/core/themes/migrations/2026-05-21-sectiondivider-spacing-to-padding.ts +4 -1
- package/src/editor/core/themes/migrations/2026-05-25-cornerbadge-flatten-variants.ts +8 -0
- package/src/editor/core/themes/slices/fonts.ts +4 -5
- package/src/editor/core/themes/themeDocumentSync.ts +66 -0
- package/src/editor/core/themes/themeInit.ts +7 -10
- package/src/editor/core/themes/themeService.ts +10 -3
- package/src/editor/core/themes/themeTypes.ts +18 -6
- package/src/editor/docs/content/editing-tokens.md +6 -2
- package/src/editor/docs/content/themes-workflow.md +14 -11
- package/src/editor/docs/content/where-themes-live.md +2 -2
- package/src/editor/docs/content.generated.ts +3 -3
- package/src/editor/ui/BezierCurveEditor.svelte +90 -67
- package/src/editor/ui/FileLoadList.svelte +1 -0
- package/src/editor/ui/FontStackEditor.svelte +1 -2
- package/src/editor/ui/GradientEditor.svelte +5 -1
- package/src/editor/ui/PaletteEditor.svelte +150 -44
- package/src/editor/ui/ProjectFontsSection.svelte +0 -5
- package/src/editor/ui/ThemePanel.svelte +206 -42
- package/src/editor/ui/Toggle.svelte +14 -2
- package/src/editor/ui/UIDialog.svelte +7 -1
- package/src/editor/ui/UIFontFamilySelector.svelte +13 -13
- package/src/editor/ui/UIFontSizeSelector.svelte +5 -5
- package/src/editor/ui/UIFontWeightSelector.svelte +52 -2
- package/src/editor/ui/UIOptionItem.svelte +14 -1
- package/src/editor/ui/UIPaddingSelector.svelte +4 -3
- package/src/editor/ui/UIPaletteSelector.svelte +20 -13
- package/src/editor/ui/UIRelinkConfirmDialog.svelte +18 -3
- package/src/editor/ui/UITextTransformSelector.svelte +5 -5
- package/src/editor/ui/UITokenSelector.svelte +29 -7
- package/src/editor/ui/colors/ColorStory.svelte +12 -8
- package/src/editor/ui/curveEngine.ts +101 -21
- package/src/editor/ui/palette/OverridesPanel.svelte +19 -5
- package/src/editor/ui/palette/PaletteBase.svelte +17 -78
- package/src/editor/ui/palette/ScaleCurveEditor.svelte +109 -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 +527 -527
- package/src/live-tokens/data/themes/halloween.json +531 -531
- package/src/live-tokens/data/themes/midnight-study.json +537 -537
- package/src/live-tokens/data/themes/ocean.json +520 -520
- package/src/live-tokens/data/themes/royal-velvet.json +531 -531
- package/src/live-tokens/data/themes/spring-meadow.json +516 -514
- package/src/live-tokens/data/themes/sunset.json +531 -531
- package/src/live-tokens/data/tokens.generated.css +282 -282
- package/src/system/components/Button.svelte +2 -1
- package/src/system/components/FloatingTokenTags.css +2 -2
- package/src/system/components/FloatingTokenTags.svelte +11 -0
- package/src/system/components/IconButton.svelte +2 -1
- package/src/system/components/Image.svelte +9 -3
- package/src/system/components/ImageLightbox.svelte +2 -0
- package/src/system/components/SectionDivider.svelte +20 -2
- package/src/system/components/SideNavigation.svelte +15 -1
- package/src/system/internal/backgroundContrast.ts +7 -0
- package/src/system/internal/oklch.ts +189 -0
- package/src/system/styles/fonts.css +6 -6
- package/src/system/styles/tokens.css +283 -283
|
@@ -37,7 +37,7 @@ __export(generateColorsAndType_exports, {
|
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(generateColorsAndType_exports);
|
|
39
39
|
|
|
40
|
-
// src/
|
|
40
|
+
// src/system/internal/oklch.ts
|
|
41
41
|
function srgbToLinear(c) {
|
|
42
42
|
return c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
|
|
43
43
|
}
|
|
@@ -131,6 +131,31 @@ function gamutClamp(l, c, h) {
|
|
|
131
131
|
}
|
|
132
132
|
return { l, c: lo, h };
|
|
133
133
|
}
|
|
134
|
+
function trim(value, decimals) {
|
|
135
|
+
return Number(value.toFixed(decimals)).toString();
|
|
136
|
+
}
|
|
137
|
+
function oklchToCss(l, c, h) {
|
|
138
|
+
const cs = trim(c, 4);
|
|
139
|
+
return `oklch(${trim(l, 4)} ${cs} ${cs === "0" ? "0" : trim(h, 2)})`;
|
|
140
|
+
}
|
|
141
|
+
function oklchToCssClamped(l, c, h) {
|
|
142
|
+
const g = gamutClamp(l, c, h);
|
|
143
|
+
return oklchToCss(g.l, g.c, g.h);
|
|
144
|
+
}
|
|
145
|
+
var OKLCH_RE = /^oklch\(\s*([\d.]+)(%?)\s+([\d.]+)(%?)\s+([\d.]+)(?:deg)?\s*\)$/i;
|
|
146
|
+
var HEX6_RE = /^#[0-9a-f]{6}$/i;
|
|
147
|
+
function parseOklchCss(value) {
|
|
148
|
+
const m = OKLCH_RE.exec(value.trim());
|
|
149
|
+
if (!m) return null;
|
|
150
|
+
const l = Number.parseFloat(m[1]) / (m[2] === "%" ? 100 : 1);
|
|
151
|
+
const c = Number.parseFloat(m[3]) * (m[4] === "%" ? 4e-3 : 1);
|
|
152
|
+
return { l, c, h: Number.parseFloat(m[5]) };
|
|
153
|
+
}
|
|
154
|
+
function cssColorToOklch(value) {
|
|
155
|
+
const raw = value.trim();
|
|
156
|
+
if (HEX6_RE.test(raw)) return hexToOklch(raw);
|
|
157
|
+
return parseOklchCss(raw);
|
|
158
|
+
}
|
|
134
159
|
|
|
135
160
|
// src/editor/ui/curveEngine.ts
|
|
136
161
|
function makeAnchor(x, y, tangentLen = 15) {
|
|
@@ -155,6 +180,15 @@ function tangentAnchor(x, y, prev, next) {
|
|
|
155
180
|
const outDx = next ? (next.x - x) * HANDLE_SPAN : 0;
|
|
156
181
|
return { x, y, inDx, inDy: m * inDx, outDx, outDy: m * outDx };
|
|
157
182
|
}
|
|
183
|
+
function isCornerAnchor(a) {
|
|
184
|
+
return a.inDx === 0 && a.inDy === 0 && a.outDx === 0 && a.outDy === 0;
|
|
185
|
+
}
|
|
186
|
+
function resmoothAutoCurve(anchors) {
|
|
187
|
+
if (anchors.length < 2) return anchors;
|
|
188
|
+
return anchors.map(
|
|
189
|
+
(a, i) => isCornerAnchor(a) ? a : tangentAnchor(a.x, a.y, anchors[i - 1] ?? null, anchors[i + 1] ?? null)
|
|
190
|
+
);
|
|
191
|
+
}
|
|
158
192
|
function evalBezier(p0x, p0y, c0x, c0y, c1x, c1y, p1x, p1y, t) {
|
|
159
193
|
const u = 1 - t, u2 = u * u, u3 = u2 * u;
|
|
160
194
|
const t2 = t * t, t3 = t2 * t;
|
|
@@ -250,37 +284,39 @@ var SCALES = [
|
|
|
250
284
|
];
|
|
251
285
|
var BW_GUARD_MIN_L = 0.17;
|
|
252
286
|
var BW_GUARD_MAX_L = 0.93;
|
|
253
|
-
var
|
|
254
|
-
var
|
|
287
|
+
var autoCurve = (...anchors) => resmoothAutoCurve(anchors);
|
|
288
|
+
var DEFAULT_PALETTE_LIGHTNESS = () => autoCurve(makeAnchor(0, 95), makeAnchor(100, 8));
|
|
289
|
+
var DEFAULT_PALETTE_SATURATION = () => autoCurve(makeAnchor(0, 100), makeAnchor(100, 100));
|
|
290
|
+
var wrapHue = (h) => (h % 360 + 360) % 360;
|
|
255
291
|
function scaleCurveDefaults(scheme = "dark") {
|
|
256
292
|
if (scheme === "light") {
|
|
257
293
|
return {
|
|
258
294
|
Surfaces: {
|
|
259
|
-
lightness: () =>
|
|
260
|
-
saturation: () =>
|
|
295
|
+
lightness: () => autoCurve(makeAnchor(0, 98), makeAnchor(100, 82)),
|
|
296
|
+
saturation: () => autoCurve(makeAnchor(0, 100), makeAnchor(100, 100))
|
|
261
297
|
},
|
|
262
298
|
Borders: {
|
|
263
|
-
lightness: () =>
|
|
264
|
-
saturation: () =>
|
|
299
|
+
lightness: () => autoCurve(makeAnchor(0, 92), makeAnchor(100, 45)),
|
|
300
|
+
saturation: () => autoCurve(makeAnchor(0, 100), makeAnchor(100, 100))
|
|
265
301
|
},
|
|
266
302
|
Text: {
|
|
267
|
-
lightness: () =>
|
|
268
|
-
saturation: () =>
|
|
303
|
+
lightness: () => autoCurve(makeAnchor(0, 30), makeAnchor(100, 120)),
|
|
304
|
+
saturation: () => autoCurve(makeAnchor(0, 100), makeAnchor(100, 15))
|
|
269
305
|
}
|
|
270
306
|
};
|
|
271
307
|
}
|
|
272
308
|
return {
|
|
273
309
|
Surfaces: {
|
|
274
|
-
lightness: () =>
|
|
275
|
-
saturation: () =>
|
|
310
|
+
lightness: () => autoCurve(makeAnchor(0, 15), makeAnchor(100, 47)),
|
|
311
|
+
saturation: () => autoCurve(makeAnchor(0, 100), makeAnchor(100, 100))
|
|
276
312
|
},
|
|
277
313
|
Borders: {
|
|
278
|
-
lightness: () =>
|
|
279
|
-
saturation: () =>
|
|
314
|
+
lightness: () => autoCurve(makeAnchor(0, 25), makeAnchor(100, 80)),
|
|
315
|
+
saturation: () => autoCurve(makeAnchor(0, 100), makeAnchor(100, 100))
|
|
280
316
|
},
|
|
281
317
|
Text: {
|
|
282
|
-
lightness: () =>
|
|
283
|
-
saturation: () =>
|
|
318
|
+
lightness: () => autoCurve(makeAnchor(0, 120), makeAnchor(100, 55)),
|
|
319
|
+
saturation: () => autoCurve(makeAnchor(0, 100), makeAnchor(100, 15))
|
|
284
320
|
}
|
|
285
321
|
};
|
|
286
322
|
}
|
|
@@ -299,14 +335,16 @@ function scaleStepToX(step, scale) {
|
|
|
299
335
|
return scale.steps.length > 1 ? idx / (scale.steps.length - 1) * 100 : 50;
|
|
300
336
|
}
|
|
301
337
|
function serializeDerivedValue(value) {
|
|
302
|
-
return value.kind === "raw" ? value.css :
|
|
338
|
+
return value.kind === "raw" ? value.css : oklchToCssClamped(value.l, value.c, value.h);
|
|
303
339
|
}
|
|
304
|
-
function computePaletteOklch(index, base, lightnessCurve, saturationCurve, curveOffset) {
|
|
305
|
-
const { c: baseC
|
|
340
|
+
function computePaletteOklch(index, base, lightnessCurve, saturationCurve, curveOffset, hueCurve) {
|
|
341
|
+
const { c: baseC } = base;
|
|
306
342
|
const xPos = stepIndexToX(index);
|
|
307
343
|
const targetL = Math.max(0, Math.min(100, sampleCurve(lightnessCurve, xPos) + (curveOffset.lightness ?? 0))) / 100;
|
|
308
344
|
const satMul = Math.max(0, Math.min(2, (sampleCurve(saturationCurve, xPos) + (curveOffset.saturation ?? 0)) / 100));
|
|
309
345
|
const targetC = baseC * satMul;
|
|
346
|
+
const hueDelta = (hueCurve ? sampleCurve(hueCurve, xPos) : 0) + (curveOffset.hue ?? 0);
|
|
347
|
+
const h = hueDelta === 0 ? base.h : wrapHue(base.h + hueDelta);
|
|
310
348
|
return gamutClamp(targetL, targetC, h);
|
|
311
349
|
}
|
|
312
350
|
function nearestPaletteStep(lightnessCurve, baseL) {
|
|
@@ -402,10 +440,12 @@ function syncBaseAnchor(cfg) {
|
|
|
402
440
|
const fresh = prev === void 0;
|
|
403
441
|
let lCurve = cfg.lightnessCurve;
|
|
404
442
|
let sCurve = cfg.saturationCurve;
|
|
443
|
+
let hCurve = cfg.hueCurve;
|
|
405
444
|
if (prev) {
|
|
406
445
|
const prevX = stepIndexToX(prev.step);
|
|
407
446
|
lCurve = liftCurveAnchor(lCurve, prevX, prev.displacedL);
|
|
408
447
|
sCurve = liftCurveAnchor(sCurve, prevX, prev.displacedS);
|
|
448
|
+
if (hCurve) hCurve = liftCurveAnchor(hCurve, prevX, prev.displacedH);
|
|
409
449
|
}
|
|
410
450
|
const step = nearestPaletteStep(lCurve, cfg.baseColor.l);
|
|
411
451
|
const x = stepIndexToX(step);
|
|
@@ -413,12 +453,19 @@ function syncBaseAnchor(cfg) {
|
|
|
413
453
|
const s = setCurveAnchor(sCurve, x, 100, fresh);
|
|
414
454
|
cfg.lightnessCurve = l.curve;
|
|
415
455
|
cfg.saturationCurve = s.curve;
|
|
456
|
+
const h = hCurve ? setCurveAnchor(hCurve, x, 0, fresh) : void 0;
|
|
457
|
+
if (h) cfg.hueCurve = h.curve;
|
|
416
458
|
cfg.anchorPlacement = {
|
|
417
459
|
step,
|
|
418
460
|
displacedL: l.displacedY,
|
|
419
461
|
displacedS: s.displacedY,
|
|
462
|
+
displacedH: h?.displacedY,
|
|
420
463
|
priorLightnessEndpoints: prev?.priorLightnessEndpoints ?? l.priorEndpoints,
|
|
421
|
-
priorSaturationEndpoints: prev?.priorSaturationEndpoints ?? s.priorEndpoints
|
|
464
|
+
priorSaturationEndpoints: prev?.priorSaturationEndpoints ?? s.priorEndpoints,
|
|
465
|
+
// No else-branch reading `prev?.priorHueEndpoints`: that could only fire
|
|
466
|
+
// if a placed hue curve later went absent, which RJC 7 (reset never
|
|
467
|
+
// deletes) never lets happen.
|
|
468
|
+
priorHueEndpoints: h ? prev?.priorHueEndpoints ?? h.priorEndpoints : void 0
|
|
422
469
|
};
|
|
423
470
|
}
|
|
424
471
|
function computeDerivedOklch(step, base, scaleTitle, scaleCurves, curveOffset) {
|
|
@@ -427,8 +474,10 @@ function computeDerivedOklch(step, base, scaleTitle, scaleCurves, curveOffset) {
|
|
|
427
474
|
const defs = defaultScaleCurves[scaleTitle];
|
|
428
475
|
const lCurve = scaleCurves[scaleTitle]?.lightness ?? defs.lightness();
|
|
429
476
|
const sCurve = scaleCurves[scaleTitle]?.saturation ?? defs.saturation();
|
|
477
|
+
const hCurve = scaleCurves[scaleTitle]?.hue;
|
|
430
478
|
const lOff = curveOffset[`${scaleTitle}-lightness`] ?? 0;
|
|
431
479
|
const sOff = curveOffset[`${scaleTitle}-saturation`] ?? 0;
|
|
480
|
+
const hOff = curveOffset[`${scaleTitle}-hue`] ?? 0;
|
|
432
481
|
const { l: baseL, c: baseC, h: baseH } = base;
|
|
433
482
|
let targetL;
|
|
434
483
|
if (scale.isText) {
|
|
@@ -439,7 +488,9 @@ function computeDerivedOklch(step, base, scaleTitle, scaleCurves, curveOffset) {
|
|
|
439
488
|
}
|
|
440
489
|
const satMul = Math.max(0, Math.min(2, (sampleCurve(sCurve, xPos) + sOff) / 100));
|
|
441
490
|
const targetC = baseC * satMul;
|
|
442
|
-
|
|
491
|
+
const hueDelta = (hCurve ? sampleCurve(hCurve, xPos) : 0) + hOff;
|
|
492
|
+
const targetH = hueDelta === 0 ? baseH : wrapHue(baseH + hueDelta);
|
|
493
|
+
return gamutClamp(targetL, targetC, targetH);
|
|
443
494
|
}
|
|
444
495
|
function scaleToCssVar(scaleTitle, stepName, cssNamespace) {
|
|
445
496
|
if (cssNamespace === null) return null;
|
|
@@ -468,7 +519,7 @@ function derivePaletteValues(spec, config) {
|
|
|
468
519
|
const saturationCurve = config.saturationCurve ?? DEFAULT_PALETTE_SATURATION();
|
|
469
520
|
PALETTE_STEPS.forEach((ps, index) => {
|
|
470
521
|
const k = paletteStepKey(ps.label);
|
|
471
|
-
const value = k in overrides ? { kind: "color", ...overrides[k] } : { kind: "color", ...computePaletteOklch(index, baseColor, lightnessCurve, saturationCurve, curveOffset) };
|
|
522
|
+
const value = k in overrides ? { kind: "color", ...overrides[k] } : { kind: "color", ...computePaletteOklch(index, baseColor, lightnessCurve, saturationCurve, curveOffset, config.hueCurve) };
|
|
472
523
|
out[`--color-${spec.cssNamespace}-${ps.label}`] = value;
|
|
473
524
|
});
|
|
474
525
|
for (const scale of SCALES) {
|
|
@@ -503,8 +554,8 @@ function derivePaletteValues(spec, config) {
|
|
|
503
554
|
);
|
|
504
555
|
const stopsCss = sortedStops.map((s) => {
|
|
505
556
|
const stopValue = out[`--color-${spec.cssNamespace}-${s.paletteLabel}`];
|
|
506
|
-
const
|
|
507
|
-
return `${
|
|
557
|
+
const css = stopValue ? serializeDerivedValue(stopValue) : "oklch(0 0 0)";
|
|
558
|
+
return `${css} ${s.position}%`;
|
|
508
559
|
}).join(", ");
|
|
509
560
|
let gradient;
|
|
510
561
|
switch (gradientStyle) {
|
|
@@ -705,7 +756,7 @@ function findLForContrast(opts) {
|
|
|
705
756
|
}
|
|
706
757
|
|
|
707
758
|
// src/editor/ui/palette/paletteMath.ts
|
|
708
|
-
var DEFAULT_NEUTRAL_LIGHTNESS = () => [makeAnchor(0, 92
|
|
759
|
+
var DEFAULT_NEUTRAL_LIGHTNESS = () => resmoothAutoCurve([makeAnchor(0, 92), makeAnchor(100, 3)]);
|
|
709
760
|
function defaultPaletteConfig(opts) {
|
|
710
761
|
const cfg = {
|
|
711
762
|
baseColor: opts.baseColor,
|
|
@@ -1034,7 +1085,10 @@ var VARIANTS2 = ["lg", "md", "sm"];
|
|
|
1034
1085
|
var SUFFIX_RENAMES = [
|
|
1035
1086
|
[/-title-border-width$/, "-title-outline-width"],
|
|
1036
1087
|
[/-title-stroke-color$/, "-title-outline-color"],
|
|
1037
|
-
[
|
|
1088
|
+
[
|
|
1089
|
+
/^--sectiondivider-(canvas|neutral|alternate|primary|accent|special)-padding$/,
|
|
1090
|
+
"--sectiondivider-$1-spacing"
|
|
1091
|
+
]
|
|
1038
1092
|
];
|
|
1039
1093
|
function renameKeySuffix(key) {
|
|
1040
1094
|
for (const [re, repl] of SUFFIX_RENAMES) {
|
|
@@ -1085,7 +1139,10 @@ var componentMigration_2026_05_21_sectiondividerSpacingToPadding = {
|
|
|
1085
1139
|
if (meta.component !== "sectiondivider") return { ...rawVars };
|
|
1086
1140
|
const out = {};
|
|
1087
1141
|
for (const [key, value] of Object.entries(rawVars)) {
|
|
1088
|
-
const renamed = key.replace(
|
|
1142
|
+
const renamed = key.replace(
|
|
1143
|
+
/^--sectiondivider-(lg|md|sm)-spacing$/,
|
|
1144
|
+
"--sectiondivider-$1-padding"
|
|
1145
|
+
);
|
|
1089
1146
|
out[renamed] = value;
|
|
1090
1147
|
}
|
|
1091
1148
|
return out;
|
|
@@ -1241,6 +1298,7 @@ var componentMigration_2026_05_24_collapsiblesectionDropActiveState = {
|
|
|
1241
1298
|
// src/editor/core/themes/migrations/2026-05-25-cornerbadge-flatten-variants.ts
|
|
1242
1299
|
var VARIANTS3 = ["primary", "accent", "neutral", "alternate", "canvas", "special", "success", "warning", "danger", "info"];
|
|
1243
1300
|
var RE = new RegExp(`^--corner-badge-(${VARIANTS3.join("|")})-(.+)$`);
|
|
1301
|
+
var CURRENT_COLOR_PROPS = /* @__PURE__ */ new Set(["surface", "border", "text"]);
|
|
1244
1302
|
function flattenVariants(rawVars, meta) {
|
|
1245
1303
|
if (meta.component !== "cornerbadge") return rawVars;
|
|
1246
1304
|
const out = {};
|
|
@@ -1249,6 +1307,10 @@ function flattenVariants(rawVars, meta) {
|
|
|
1249
1307
|
const m = key.match(RE);
|
|
1250
1308
|
if (m) {
|
|
1251
1309
|
const prop = m[2];
|
|
1310
|
+
if (CURRENT_COLOR_PROPS.has(prop)) {
|
|
1311
|
+
out[key] = value;
|
|
1312
|
+
continue;
|
|
1313
|
+
}
|
|
1252
1314
|
if (!collected.has(prop)) collected.set(prop, value);
|
|
1253
1315
|
continue;
|
|
1254
1316
|
}
|
|
@@ -1566,12 +1628,16 @@ function surfaceVars() {
|
|
|
1566
1628
|
"--page-bg"
|
|
1567
1629
|
];
|
|
1568
1630
|
}
|
|
1631
|
+
function varToHex(value) {
|
|
1632
|
+
const parsed = value ? cssColorToOklch(value) : null;
|
|
1633
|
+
return parsed ? oklchToHexClamped(parsed.l, parsed.c, parsed.h) : null;
|
|
1634
|
+
}
|
|
1569
1635
|
function worstSurface(textHex, vars) {
|
|
1570
1636
|
let against = "";
|
|
1571
1637
|
let ratio = Infinity;
|
|
1572
1638
|
for (const surfVar of surfaceVars()) {
|
|
1573
|
-
const surfHex = vars[surfVar];
|
|
1574
|
-
if (!surfHex
|
|
1639
|
+
const surfHex = varToHex(vars[surfVar]);
|
|
1640
|
+
if (!surfHex) continue;
|
|
1575
1641
|
const r = contrastRatio(textHex, surfHex);
|
|
1576
1642
|
if (r < ratio) {
|
|
1577
1643
|
ratio = r;
|
|
@@ -1599,17 +1665,18 @@ function runContrastGate(configs, scheme) {
|
|
|
1599
1665
|
const vars = palettesToVars(configs);
|
|
1600
1666
|
let anyFixed = false;
|
|
1601
1667
|
for (const def of defs) {
|
|
1602
|
-
const
|
|
1603
|
-
if (!
|
|
1668
|
+
const text = cssColorToOklch(vars[def.textVar] ?? "");
|
|
1669
|
+
if (!text) continue;
|
|
1670
|
+
const textHex = oklchToHexClamped(text.l, text.c, text.h);
|
|
1604
1671
|
const worst = worstSurface(textHex, vars);
|
|
1605
1672
|
if (worst.ratio >= def.floor) continue;
|
|
1606
1673
|
const cfg = configs[def.paletteLabel];
|
|
1607
1674
|
const seed = cfg.baseColor;
|
|
1608
1675
|
const solved = findLForContrast({
|
|
1609
|
-
against: vars[worst.against],
|
|
1676
|
+
against: varToHex(vars[worst.against]) ?? "#000000",
|
|
1610
1677
|
ratio: def.target,
|
|
1611
1678
|
direction,
|
|
1612
|
-
c:
|
|
1679
|
+
c: text.c,
|
|
1613
1680
|
h: seed.h,
|
|
1614
1681
|
lMax: Math.min(1, 2 * seed.l)
|
|
1615
1682
|
});
|
|
@@ -1621,7 +1688,7 @@ function runContrastGate(configs, scheme) {
|
|
|
1621
1688
|
}
|
|
1622
1689
|
const finalVars = palettesToVars(configs);
|
|
1623
1690
|
const checks = defs.map((def) => {
|
|
1624
|
-
const worst = worstSurface(finalVars[def.textVar] ?? "#000000", finalVars);
|
|
1691
|
+
const worst = worstSurface(varToHex(finalVars[def.textVar]) ?? "#000000", finalVars);
|
|
1625
1692
|
return {
|
|
1626
1693
|
textVar: def.textVar,
|
|
1627
1694
|
floor: def.floor,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FontSource, b as FontStack, G as GradientDiskToken, O as Oklch, H as HarmonyMode, C as ColorsAndType } from '../themeTypes-
|
|
1
|
+
import { F as FontSource, b as FontStack, G as GradientDiskToken, O as Oklch, H as HarmonyMode, C as ColorsAndType } from '../themeTypes-Dky03HL9.cjs';
|
|
2
2
|
export { r as readLiveTokensConfig, a as resolveDataDirs } from '../dataPaths-DBN0RPuT.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FontSource, b as FontStack, G as GradientDiskToken, O as Oklch, H as HarmonyMode, C as ColorsAndType } from '../themeTypes-
|
|
1
|
+
import { F as FontSource, b as FontStack, G as GradientDiskToken, O as Oklch, H as HarmonyMode, C as ColorsAndType } from '../themeTypes-Dky03HL9.js';
|
|
2
2
|
export { r as readLiveTokensConfig, a as resolveDataDirs } from '../dataPaths-DBN0RPuT.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -4,18 +4,23 @@ import {
|
|
|
4
4
|
PALETTE_SPECS,
|
|
5
5
|
PALETTE_STEPS,
|
|
6
6
|
SCALES,
|
|
7
|
-
gamutClamp,
|
|
8
|
-
hexToOklch,
|
|
9
7
|
makeAnchor,
|
|
10
|
-
oklchToHex,
|
|
11
8
|
palettesToVars,
|
|
9
|
+
resmoothAutoCurve,
|
|
12
10
|
sanitizeFileName,
|
|
13
11
|
scaleCurveDefaults,
|
|
14
12
|
scaleStepToX,
|
|
15
13
|
scaleToCssVar,
|
|
16
14
|
setCurveAnchor,
|
|
17
15
|
syncBaseAnchor
|
|
18
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-JIGIIE5P.js";
|
|
17
|
+
import {
|
|
18
|
+
cssColorToOklch,
|
|
19
|
+
gamutClamp,
|
|
20
|
+
hexToOklch,
|
|
21
|
+
oklchToHex,
|
|
22
|
+
oklchToHexClamped
|
|
23
|
+
} from "../chunk-YR6GPXW2.js";
|
|
19
24
|
import {
|
|
20
25
|
readLiveTokensConfig,
|
|
21
26
|
resolveDataDirs
|
|
@@ -188,7 +193,7 @@ function findLForContrast(opts) {
|
|
|
188
193
|
}
|
|
189
194
|
|
|
190
195
|
// src/editor/ui/palette/paletteMath.ts
|
|
191
|
-
var DEFAULT_NEUTRAL_LIGHTNESS = () => [makeAnchor(0, 92
|
|
196
|
+
var DEFAULT_NEUTRAL_LIGHTNESS = () => resmoothAutoCurve([makeAnchor(0, 92), makeAnchor(100, 3)]);
|
|
192
197
|
function defaultPaletteConfig(opts) {
|
|
193
198
|
const cfg = {
|
|
194
199
|
baseColor: opts.baseColor,
|
|
@@ -512,7 +517,10 @@ var VARIANTS2 = ["lg", "md", "sm"];
|
|
|
512
517
|
var SUFFIX_RENAMES = [
|
|
513
518
|
[/-title-border-width$/, "-title-outline-width"],
|
|
514
519
|
[/-title-stroke-color$/, "-title-outline-color"],
|
|
515
|
-
[
|
|
520
|
+
[
|
|
521
|
+
/^--sectiondivider-(canvas|neutral|alternate|primary|accent|special)-padding$/,
|
|
522
|
+
"--sectiondivider-$1-spacing"
|
|
523
|
+
]
|
|
516
524
|
];
|
|
517
525
|
function renameKeySuffix(key) {
|
|
518
526
|
for (const [re, repl] of SUFFIX_RENAMES) {
|
|
@@ -563,7 +571,10 @@ var componentMigration_2026_05_21_sectiondividerSpacingToPadding = {
|
|
|
563
571
|
if (meta.component !== "sectiondivider") return { ...rawVars };
|
|
564
572
|
const out = {};
|
|
565
573
|
for (const [key, value] of Object.entries(rawVars)) {
|
|
566
|
-
const renamed = key.replace(
|
|
574
|
+
const renamed = key.replace(
|
|
575
|
+
/^--sectiondivider-(lg|md|sm)-spacing$/,
|
|
576
|
+
"--sectiondivider-$1-padding"
|
|
577
|
+
);
|
|
567
578
|
out[renamed] = value;
|
|
568
579
|
}
|
|
569
580
|
return out;
|
|
@@ -719,6 +730,7 @@ var componentMigration_2026_05_24_collapsiblesectionDropActiveState = {
|
|
|
719
730
|
// src/editor/core/themes/migrations/2026-05-25-cornerbadge-flatten-variants.ts
|
|
720
731
|
var VARIANTS3 = ["primary", "accent", "neutral", "alternate", "canvas", "special", "success", "warning", "danger", "info"];
|
|
721
732
|
var RE = new RegExp(`^--corner-badge-(${VARIANTS3.join("|")})-(.+)$`);
|
|
733
|
+
var CURRENT_COLOR_PROPS = /* @__PURE__ */ new Set(["surface", "border", "text"]);
|
|
722
734
|
function flattenVariants(rawVars, meta) {
|
|
723
735
|
if (meta.component !== "cornerbadge") return rawVars;
|
|
724
736
|
const out = {};
|
|
@@ -727,6 +739,10 @@ function flattenVariants(rawVars, meta) {
|
|
|
727
739
|
const m = key.match(RE);
|
|
728
740
|
if (m) {
|
|
729
741
|
const prop = m[2];
|
|
742
|
+
if (CURRENT_COLOR_PROPS.has(prop)) {
|
|
743
|
+
out[key] = value;
|
|
744
|
+
continue;
|
|
745
|
+
}
|
|
730
746
|
if (!collected.has(prop)) collected.set(prop, value);
|
|
731
747
|
continue;
|
|
732
748
|
}
|
|
@@ -1044,12 +1060,16 @@ function surfaceVars() {
|
|
|
1044
1060
|
"--page-bg"
|
|
1045
1061
|
];
|
|
1046
1062
|
}
|
|
1063
|
+
function varToHex(value) {
|
|
1064
|
+
const parsed = value ? cssColorToOklch(value) : null;
|
|
1065
|
+
return parsed ? oklchToHexClamped(parsed.l, parsed.c, parsed.h) : null;
|
|
1066
|
+
}
|
|
1047
1067
|
function worstSurface(textHex, vars) {
|
|
1048
1068
|
let against = "";
|
|
1049
1069
|
let ratio = Infinity;
|
|
1050
1070
|
for (const surfVar of surfaceVars()) {
|
|
1051
|
-
const surfHex = vars[surfVar];
|
|
1052
|
-
if (!surfHex
|
|
1071
|
+
const surfHex = varToHex(vars[surfVar]);
|
|
1072
|
+
if (!surfHex) continue;
|
|
1053
1073
|
const r = contrastRatio(textHex, surfHex);
|
|
1054
1074
|
if (r < ratio) {
|
|
1055
1075
|
ratio = r;
|
|
@@ -1077,17 +1097,18 @@ function runContrastGate(configs, scheme) {
|
|
|
1077
1097
|
const vars = palettesToVars(configs);
|
|
1078
1098
|
let anyFixed = false;
|
|
1079
1099
|
for (const def of defs) {
|
|
1080
|
-
const
|
|
1081
|
-
if (!
|
|
1100
|
+
const text = cssColorToOklch(vars[def.textVar] ?? "");
|
|
1101
|
+
if (!text) continue;
|
|
1102
|
+
const textHex = oklchToHexClamped(text.l, text.c, text.h);
|
|
1082
1103
|
const worst = worstSurface(textHex, vars);
|
|
1083
1104
|
if (worst.ratio >= def.floor) continue;
|
|
1084
1105
|
const cfg = configs[def.paletteLabel];
|
|
1085
1106
|
const seed = cfg.baseColor;
|
|
1086
1107
|
const solved = findLForContrast({
|
|
1087
|
-
against: vars[worst.against],
|
|
1108
|
+
against: varToHex(vars[worst.against]) ?? "#000000",
|
|
1088
1109
|
ratio: def.target,
|
|
1089
1110
|
direction,
|
|
1090
|
-
c:
|
|
1111
|
+
c: text.c,
|
|
1091
1112
|
h: seed.h,
|
|
1092
1113
|
lMax: Math.min(1, 2 * seed.l)
|
|
1093
1114
|
});
|
|
@@ -1099,7 +1120,7 @@ function runContrastGate(configs, scheme) {
|
|
|
1099
1120
|
}
|
|
1100
1121
|
const finalVars = palettesToVars(configs);
|
|
1101
1122
|
const checks = defs.map((def) => {
|
|
1102
|
-
const worst = worstSurface(finalVars[def.textVar] ?? "#000000", finalVars);
|
|
1123
|
+
const worst = worstSurface(varToHex(finalVars[def.textVar]) ?? "#000000", finalVars);
|
|
1103
1124
|
return {
|
|
1104
1125
|
textVar: def.textVar,
|
|
1105
1126
|
floor: def.floor,
|