@uni-design-system/uni-core 3.0.2 → 5.0.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/LICENSE +21 -0
- package/dist/cjs/index.cjs +1490 -767
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +1464 -768
- package/dist/esm/index.js.map +1 -1
- package/dist/types/concepts/color/color.factory.d.ts +48 -0
- package/dist/types/concepts/color/color.factory.d.ts.map +1 -0
- package/dist/types/concepts/color/color.helper.d.ts +15 -0
- package/dist/types/concepts/color/color.helper.d.ts.map +1 -1
- package/dist/types/concepts/color/color.records.d.ts +9 -0
- package/dist/types/concepts/color/color.records.d.ts.map +1 -1
- package/dist/types/concepts/color/color.types.d.ts +2 -2
- package/dist/types/concepts/color/color.types.d.ts.map +1 -1
- package/dist/types/concepts/color/color.utils.d.ts +17 -0
- package/dist/types/concepts/color/color.utils.d.ts.map +1 -1
- package/dist/types/concepts/color/index.d.ts +1 -0
- package/dist/types/concepts/color/index.d.ts.map +1 -1
- package/dist/types/concepts/component/component.types.d.ts +9 -3
- package/dist/types/concepts/component/component.types.d.ts.map +1 -1
- package/dist/types/concepts/generation/generation.spec.d.ts +2 -0
- package/dist/types/concepts/generation/generation.spec.d.ts.map +1 -0
- package/dist/types/concepts/generation/generation.types.d.ts +59 -0
- package/dist/types/concepts/generation/generation.types.d.ts.map +1 -0
- package/dist/types/concepts/generation/index.d.ts +6 -0
- package/dist/types/concepts/generation/index.d.ts.map +1 -0
- package/dist/types/concepts/generation/oklch.helper.d.ts +22 -0
- package/dist/types/concepts/generation/oklch.helper.d.ts.map +1 -0
- package/dist/types/concepts/generation/palette.factory.d.ts +23 -0
- package/dist/types/concepts/generation/palette.factory.d.ts.map +1 -0
- package/dist/types/concepts/generation/theme-file.emitter.d.ts +26 -0
- package/dist/types/concepts/generation/theme-file.emitter.d.ts.map +1 -0
- package/dist/types/concepts/generation/theme.generator.d.ts +30 -0
- package/dist/types/concepts/generation/theme.generator.d.ts.map +1 -0
- package/dist/types/concepts/index.d.ts +1 -0
- package/dist/types/concepts/index.d.ts.map +1 -1
- package/dist/types/concepts/size/size.types.d.ts +1 -0
- package/dist/types/concepts/size/size.types.d.ts.map +1 -1
- package/dist/types/concepts/style/index.d.ts +1 -0
- package/dist/types/concepts/style/index.d.ts.map +1 -1
- package/dist/types/concepts/style/inputs.constants.d.ts +3 -0
- package/dist/types/concepts/style/inputs.constants.d.ts.map +1 -0
- package/dist/types/concepts/style/style.types.d.ts +3 -1
- package/dist/types/concepts/style/style.types.d.ts.map +1 -1
- package/dist/types/concepts/theme/theme.model.d.ts +14 -14
- package/dist/types/concepts/theme/theme.model.d.ts.map +1 -1
- package/dist/types/concepts/theme/theme.types.d.ts +2 -0
- package/dist/types/concepts/theme/theme.types.d.ts.map +1 -1
- package/dist/types/concepts/theme/themes/base.theme.d.ts +44 -1
- package/dist/types/concepts/theme/themes/base.theme.d.ts.map +1 -1
- package/dist/types/concepts/theme/themes/dark.theme.d.ts +3 -2
- package/dist/types/concepts/theme/themes/dark.theme.d.ts.map +1 -1
- package/dist/types/concepts/theme/themes/light.theme.d.ts +1 -2
- package/dist/types/concepts/theme/themes/light.theme.d.ts.map +1 -1
- package/dist/types/concepts/typography/index.d.ts +1 -0
- package/dist/types/concepts/typography/index.d.ts.map +1 -1
- package/dist/types/concepts/typography/typeface.helpers.d.ts +9 -0
- package/dist/types/concepts/typography/typeface.helpers.d.ts.map +1 -0
- package/package.json +6 -2
- package/dist/types/concepts/theme/themes/square.theme.d.ts +0 -3
- package/dist/types/concepts/theme/themes/square.theme.d.ts.map +0 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -30,6 +30,11 @@ var collapseFadeOut = {
|
|
|
30
30
|
};
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region src/concepts/color/color.records.ts
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated HSL saturation ranges are superseded by the perceptual OKLCH
|
|
35
|
+
* chroma model inside `concepts/generation` (see `generateThemes`). Kept for
|
|
36
|
+
* legacy callers of `uniColor`; removal follows the changeset major process.
|
|
37
|
+
*/
|
|
33
38
|
var CategorySaturation = {
|
|
34
39
|
jewel: {
|
|
35
40
|
low: 73,
|
|
@@ -56,6 +61,10 @@ var CategorySaturation = {
|
|
|
56
61
|
high: 0
|
|
57
62
|
}
|
|
58
63
|
};
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated HSL lightness ranges are superseded by the perceptual OKLCH
|
|
66
|
+
* tone slots inside `concepts/generation` (see `generateThemes`).
|
|
67
|
+
*/
|
|
59
68
|
var CategoryLightness = {
|
|
60
69
|
jewel: {
|
|
61
70
|
low: 56,
|
|
@@ -131,6 +140,11 @@ var RoleHues = {
|
|
|
131
140
|
};
|
|
132
141
|
//#endregion
|
|
133
142
|
//#region src/concepts/color/color.utils.ts
|
|
143
|
+
/**
|
|
144
|
+
* @deprecated Randomized generation is superseded by the deterministic OKLCH
|
|
145
|
+
* engine in `concepts/generation` — same input, same theme. Seeded "surprise
|
|
146
|
+
* me" behavior belongs in the consumer (playground), not the engine.
|
|
147
|
+
*/
|
|
134
148
|
var randomRangeValue = ({ low, high }) => {
|
|
135
149
|
low = Math.ceil(low);
|
|
136
150
|
high = Math.floor(high);
|
|
@@ -145,6 +159,52 @@ var getAnalogousHues = (hue) => [cycle(hue + 30), cycle(hue + 60)];
|
|
|
145
159
|
var getComplimentaryHue = (hue) => cycle(hue + 180);
|
|
146
160
|
var getTriadicHues = (hue) => [cycle(hue + 120), cycle(hue - 120)];
|
|
147
161
|
var getSplitComplimentaryHues = (hue) => [cycle(hue + 150), cycle(hue - 150)];
|
|
162
|
+
/**
|
|
163
|
+
* Derive the primary/secondary/tertiary hues from a seed hue using the color
|
|
164
|
+
* wheel relationships in {@link ColorScheme}. Pure angle math — works in any
|
|
165
|
+
* hue space (HSL historically, OKLCH in the generation engine).
|
|
166
|
+
*/
|
|
167
|
+
var schemeHues = (hue, scheme) => {
|
|
168
|
+
switch (scheme) {
|
|
169
|
+
case "monochromatic": return {
|
|
170
|
+
primary: hue,
|
|
171
|
+
secondary: hue,
|
|
172
|
+
tertiary: hue
|
|
173
|
+
};
|
|
174
|
+
case "analogous": {
|
|
175
|
+
const [a, b] = getAnalogousHues(hue);
|
|
176
|
+
return {
|
|
177
|
+
primary: hue,
|
|
178
|
+
secondary: a,
|
|
179
|
+
tertiary: b
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
case "complimentary": {
|
|
183
|
+
const [a] = getAnalogousHues(hue);
|
|
184
|
+
return {
|
|
185
|
+
primary: hue,
|
|
186
|
+
secondary: getComplimentaryHue(hue),
|
|
187
|
+
tertiary: a
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
case "splitComplimentary": {
|
|
191
|
+
const [a, b] = getSplitComplimentaryHues(hue);
|
|
192
|
+
return {
|
|
193
|
+
primary: hue,
|
|
194
|
+
secondary: a,
|
|
195
|
+
tertiary: b
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
case "triadic": {
|
|
199
|
+
const [a, b] = getTriadicHues(hue);
|
|
200
|
+
return {
|
|
201
|
+
primary: hue,
|
|
202
|
+
secondary: a,
|
|
203
|
+
tertiary: b
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
};
|
|
148
208
|
//#endregion
|
|
149
209
|
//#region src/concepts/color/color.helper.ts
|
|
150
210
|
function HSLAToString({ hue, saturation, lightness, alpha = 1 }) {
|
|
@@ -153,6 +213,11 @@ function HSLAToString({ hue, saturation, lightness, alpha = 1 }) {
|
|
|
153
213
|
function RGBToString({ red, green, blue }) {
|
|
154
214
|
return `rgb(${red}, ${green}, ${blue})`;
|
|
155
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* @deprecated Random HSL generation produces non-deterministic, perceptually
|
|
218
|
+
* uneven colors. Use the OKLCH engine (`generateThemes` in
|
|
219
|
+
* `concepts/generation`) or `generatePalette` instead.
|
|
220
|
+
*/
|
|
156
221
|
function uniColor({ role, category, alpha = 1 }) {
|
|
157
222
|
return HSLAToString({
|
|
158
223
|
hue: randomRangeValue(RoleHues[role]),
|
|
@@ -174,6 +239,516 @@ var RGBToHSL = ({ red, green, blue }) => {
|
|
|
174
239
|
lightness: 100 * (2 * l - s) / 2
|
|
175
240
|
};
|
|
176
241
|
};
|
|
242
|
+
var clamp$2 = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
243
|
+
var toHex2 = (value) => clamp$2(Math.round(value), 0, 255).toString(16).padStart(2, "0");
|
|
244
|
+
var rgbToHex = ({ red, green, blue }) => `#${toHex2(red)}${toHex2(green)}${toHex2(blue)}`.toUpperCase();
|
|
245
|
+
var hexToRgb = (hex) => {
|
|
246
|
+
let h = hex.replace("#", "").trim();
|
|
247
|
+
if (h.length === 3) h = h.split("").map((c) => c + c).join("");
|
|
248
|
+
const int = parseInt(h, 16);
|
|
249
|
+
return {
|
|
250
|
+
red: int >> 16 & 255,
|
|
251
|
+
green: int >> 8 & 255,
|
|
252
|
+
blue: int & 255
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
var HSLToRGB = ({ hue = 0, saturation = 0, lightness = 0 }) => {
|
|
256
|
+
const s = clamp$2(saturation, 0, 100) / 100;
|
|
257
|
+
const l = clamp$2(lightness, 0, 100) / 100;
|
|
258
|
+
const c = (1 - Math.abs(2 * l - 1)) * s;
|
|
259
|
+
const hp = (hue % 360 + 360) % 360 / 60;
|
|
260
|
+
const x = c * (1 - Math.abs(hp % 2 - 1));
|
|
261
|
+
const [r1, g1, b1] = hp < 1 ? [
|
|
262
|
+
c,
|
|
263
|
+
x,
|
|
264
|
+
0
|
|
265
|
+
] : hp < 2 ? [
|
|
266
|
+
x,
|
|
267
|
+
c,
|
|
268
|
+
0
|
|
269
|
+
] : hp < 3 ? [
|
|
270
|
+
0,
|
|
271
|
+
c,
|
|
272
|
+
x
|
|
273
|
+
] : hp < 4 ? [
|
|
274
|
+
0,
|
|
275
|
+
x,
|
|
276
|
+
c
|
|
277
|
+
] : hp < 5 ? [
|
|
278
|
+
x,
|
|
279
|
+
0,
|
|
280
|
+
c
|
|
281
|
+
] : [
|
|
282
|
+
c,
|
|
283
|
+
0,
|
|
284
|
+
x
|
|
285
|
+
];
|
|
286
|
+
const m = l - c / 2;
|
|
287
|
+
return {
|
|
288
|
+
red: (r1 + m) * 255,
|
|
289
|
+
green: (g1 + m) * 255,
|
|
290
|
+
blue: (b1 + m) * 255
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
/** Build an sRGB hex string straight from HSL channel values. */
|
|
294
|
+
var HSLToHex = (hsl) => rgbToHex(HSLToRGB(hsl));
|
|
295
|
+
var hexToHSL = (hex) => RGBToHSL(hexToRgb(hex));
|
|
296
|
+
/** WCAG relative luminance of an sRGB color (0 = black, 1 = white). */
|
|
297
|
+
var relativeLuminance = ({ red, green, blue }) => {
|
|
298
|
+
const channel = (value) => {
|
|
299
|
+
const v = value / 255;
|
|
300
|
+
return v <= .03928 ? v / 12.92 : Math.pow((v + .055) / 1.055, 2.4);
|
|
301
|
+
};
|
|
302
|
+
return .2126 * channel(red) + .7152 * channel(green) + .0722 * channel(blue);
|
|
303
|
+
};
|
|
304
|
+
/** WCAG contrast ratio between two colors (1:1 – 21:1). Accepts RGB or hex. */
|
|
305
|
+
var contrastRatio = (a, b) => {
|
|
306
|
+
const la = relativeLuminance(typeof a === "string" ? hexToRgb(a) : a);
|
|
307
|
+
const lb = relativeLuminance(typeof b === "string" ? hexToRgb(b) : b);
|
|
308
|
+
const [hi, lo] = la > lb ? [la, lb] : [lb, la];
|
|
309
|
+
return (hi + .05) / (lo + .05);
|
|
310
|
+
};
|
|
311
|
+
//#endregion
|
|
312
|
+
//#region src/concepts/generation/oklch.helper.ts
|
|
313
|
+
var clamp$1 = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
314
|
+
var srgbToLinear = (channel) => channel <= .04045 ? channel / 12.92 : Math.pow((channel + .055) / 1.055, 2.4);
|
|
315
|
+
var linearToSrgb = (channel) => channel <= .0031308 ? 12.92 * channel : 1.055 * Math.pow(channel, 1 / 2.4) - .055;
|
|
316
|
+
var linearRgbToOklab = ({ r, g, b }) => {
|
|
317
|
+
const l = Math.cbrt(.4122214708 * r + .5363325363 * g + .0514459929 * b);
|
|
318
|
+
const m = Math.cbrt(.2119034982 * r + .6806995451 * g + .1073969566 * b);
|
|
319
|
+
const s = Math.cbrt(.0883024619 * r + .2817188376 * g + .6299787005 * b);
|
|
320
|
+
return {
|
|
321
|
+
l: .2104542553 * l + .793617785 * m - .0040720468 * s,
|
|
322
|
+
a: 1.9779984951 * l - 2.428592205 * m + .4505937099 * s,
|
|
323
|
+
b: .0259040371 * l + .7827717662 * m - .808675766 * s
|
|
324
|
+
};
|
|
325
|
+
};
|
|
326
|
+
var oklabToLinearRgb = (l, a, b) => {
|
|
327
|
+
const l_ = Math.pow(l + .3963377774 * a + .2158037573 * b, 3);
|
|
328
|
+
const m_ = Math.pow(l - .1055613458 * a - .0638541728 * b, 3);
|
|
329
|
+
const s_ = Math.pow(l - .0894841775 * a - 1.291485548 * b, 3);
|
|
330
|
+
return {
|
|
331
|
+
r: 4.0767416621 * l_ - 3.3077115913 * m_ + .2309699292 * s_,
|
|
332
|
+
g: -1.2684380046 * l_ + 2.6097574011 * m_ - .3413193965 * s_,
|
|
333
|
+
b: -.0041960863 * l_ - .7034186147 * m_ + 1.707614701 * s_
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
var oklchToLinearRgb = ({ l, c, h }) => {
|
|
337
|
+
const rad = h * Math.PI / 180;
|
|
338
|
+
return oklabToLinearRgb(l, c * Math.cos(rad), c * Math.sin(rad));
|
|
339
|
+
};
|
|
340
|
+
var GAMUT_EPSILON = 1e-4;
|
|
341
|
+
var inSrgbGamut = ({ r, g, b }) => r >= -GAMUT_EPSILON && r <= 1 + GAMUT_EPSILON && g >= -GAMUT_EPSILON && g <= 1 + GAMUT_EPSILON && b >= -GAMUT_EPSILON && b <= 1 + GAMUT_EPSILON;
|
|
342
|
+
/** Parse a hex color (`#RGB` or `#RRGGBB`) into OKLCH. */
|
|
343
|
+
var hexToOklch = (hex) => {
|
|
344
|
+
const { red, green, blue } = hexToRgb(hex);
|
|
345
|
+
const { l, a, b } = linearRgbToOklab({
|
|
346
|
+
r: srgbToLinear(red / 255),
|
|
347
|
+
g: srgbToLinear(green / 255),
|
|
348
|
+
b: srgbToLinear(blue / 255)
|
|
349
|
+
});
|
|
350
|
+
const c = Math.hypot(a, b);
|
|
351
|
+
const h = c < 1e-6 ? 0 : Math.atan2(b, a) * 180 / Math.PI;
|
|
352
|
+
return {
|
|
353
|
+
l,
|
|
354
|
+
c,
|
|
355
|
+
h: h < 0 ? h + 360 : h
|
|
356
|
+
};
|
|
357
|
+
};
|
|
358
|
+
/**
|
|
359
|
+
* Render OKLCH as an sRGB hex string. Out-of-gamut colors are mapped back
|
|
360
|
+
* into sRGB by reducing chroma only — lightness and hue are preserved, so
|
|
361
|
+
* vivid seeds desaturate gracefully instead of shifting hue or clipping.
|
|
362
|
+
*/
|
|
363
|
+
var oklchToHex = (color) => {
|
|
364
|
+
const target = {
|
|
365
|
+
l: clamp$1(color.l, 0, 1),
|
|
366
|
+
c: Math.max(color.c, 0),
|
|
367
|
+
h: color.h
|
|
368
|
+
};
|
|
369
|
+
let rgb = oklchToLinearRgb(target);
|
|
370
|
+
if (!inSrgbGamut(rgb)) {
|
|
371
|
+
let low = 0;
|
|
372
|
+
let high = target.c;
|
|
373
|
+
for (let i = 0; i < 24; i++) {
|
|
374
|
+
const mid = (low + high) / 2;
|
|
375
|
+
if (inSrgbGamut(oklchToLinearRgb({
|
|
376
|
+
...target,
|
|
377
|
+
c: mid
|
|
378
|
+
}))) low = mid;
|
|
379
|
+
else high = mid;
|
|
380
|
+
}
|
|
381
|
+
rgb = oklchToLinearRgb({
|
|
382
|
+
...target,
|
|
383
|
+
c: low
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
return rgbToHex(toSrgb255(rgb));
|
|
387
|
+
};
|
|
388
|
+
var toSrgb255 = ({ r, g, b }) => ({
|
|
389
|
+
red: 255 * linearToSrgb(clamp$1(r, 0, 1)),
|
|
390
|
+
green: 255 * linearToSrgb(clamp$1(g, 0, 1)),
|
|
391
|
+
blue: 255 * linearToSrgb(clamp$1(b, 0, 1))
|
|
392
|
+
});
|
|
393
|
+
//#endregion
|
|
394
|
+
//#region src/concepts/generation/palette.factory.ts
|
|
395
|
+
var toneMap = (dark) => dark ? {
|
|
396
|
+
accent: .78,
|
|
397
|
+
container: .42,
|
|
398
|
+
roleSurface: .26,
|
|
399
|
+
background: .18,
|
|
400
|
+
surface: .21,
|
|
401
|
+
surfaceVariant: .32,
|
|
402
|
+
outline: .66,
|
|
403
|
+
onSurface: .93,
|
|
404
|
+
mutedText: .76,
|
|
405
|
+
inverse: .93,
|
|
406
|
+
onInverse: .25,
|
|
407
|
+
onDeep: .2,
|
|
408
|
+
onLight: .985,
|
|
409
|
+
grey: .72,
|
|
410
|
+
disabledContainer: .3
|
|
411
|
+
} : {
|
|
412
|
+
accent: .55,
|
|
413
|
+
container: .9,
|
|
414
|
+
roleSurface: .97,
|
|
415
|
+
background: .995,
|
|
416
|
+
surface: .985,
|
|
417
|
+
surfaceVariant: .94,
|
|
418
|
+
outline: .6,
|
|
419
|
+
onSurface: .25,
|
|
420
|
+
mutedText: .48,
|
|
421
|
+
inverse: .3,
|
|
422
|
+
onInverse: .97,
|
|
423
|
+
onDeep: .24,
|
|
424
|
+
onLight: .985,
|
|
425
|
+
grey: .5,
|
|
426
|
+
disabledContainer: .96
|
|
427
|
+
};
|
|
428
|
+
var CategoryChroma = {
|
|
429
|
+
jewel: .17,
|
|
430
|
+
pastel: .055,
|
|
431
|
+
earth: .08,
|
|
432
|
+
neutral: .03,
|
|
433
|
+
florescent: .26,
|
|
434
|
+
shades: 0
|
|
435
|
+
};
|
|
436
|
+
/** Dark-mode accents cap chroma so they don't vibrate on dark surfaces. */
|
|
437
|
+
var DARK_ACCENT_CHROMA_CAP = .16;
|
|
438
|
+
var SemanticColors = {
|
|
439
|
+
error: {
|
|
440
|
+
hue: 27,
|
|
441
|
+
chroma: .2
|
|
442
|
+
},
|
|
443
|
+
warn: {
|
|
444
|
+
hue: 55,
|
|
445
|
+
chroma: .18
|
|
446
|
+
},
|
|
447
|
+
success: {
|
|
448
|
+
hue: 152,
|
|
449
|
+
chroma: .16
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
var clamp = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
453
|
+
/**
|
|
454
|
+
* Generate a complete {@link Colors} token set in OKLCH. Same contract as
|
|
455
|
+
* `generatePalette` (which delegates here), plus soft brand targets and a
|
|
456
|
+
* contrast-check sink for {@link ContrastReport} consumers.
|
|
457
|
+
*/
|
|
458
|
+
var generateColors = (config) => {
|
|
459
|
+
const { seed, scheme, category, mode = "light", accentSaturationFloor = 18, brand = {}, targets = {}, checks } = config;
|
|
460
|
+
const dark = mode === "dark";
|
|
461
|
+
const t = toneMap(dark);
|
|
462
|
+
const anchor = hexToOklch(brand.primary ?? targets.primary ?? seed);
|
|
463
|
+
const hues = schemeHues(anchor.h, scheme);
|
|
464
|
+
const chromaFloor = accentSaturationFloor / 100 * .28;
|
|
465
|
+
let accentC = Math.max(CategoryChroma[category], chromaFloor);
|
|
466
|
+
if (dark) accentC = Math.min(accentC, DARK_ACCENT_CHROMA_CAP);
|
|
467
|
+
const containerC = Math.max(CategoryChroma[category] * .45, accentC * .35);
|
|
468
|
+
const surfaceC = Math.min(CategoryChroma[category], .012);
|
|
469
|
+
const tone = (hue, c, l) => oklchToHex({
|
|
470
|
+
l,
|
|
471
|
+
c,
|
|
472
|
+
h: hue
|
|
473
|
+
});
|
|
474
|
+
/**
|
|
475
|
+
* The WCAG guard-rail: walk the foreground's OKLCH lightness away from the
|
|
476
|
+
* background until the pair meets `target` (≤ 50 steps). Hue is never
|
|
477
|
+
* touched; chroma only shrinks as a last resort when L runs out of room.
|
|
478
|
+
*/
|
|
479
|
+
const ensureContrast = (fg, bg, target) => {
|
|
480
|
+
const out = { ...fg };
|
|
481
|
+
let hex = oklchToHex(out);
|
|
482
|
+
if (contrastRatio(hex, bg) >= target) return out;
|
|
483
|
+
const bgY = relativeLuminance(hexToRgb(bg));
|
|
484
|
+
const darkCeiling = (bgY + .05) / .05;
|
|
485
|
+
const lightCeiling = 1.05 / (bgY + .05);
|
|
486
|
+
let lighten = relativeLuminance(hexToRgb(hex)) >= bgY;
|
|
487
|
+
if (lighten && lightCeiling < target && darkCeiling >= target) lighten = false;
|
|
488
|
+
if (!lighten && darkCeiling < target && lightCeiling >= target) lighten = true;
|
|
489
|
+
const step = lighten ? .015 : -.015;
|
|
490
|
+
for (let i = 0; i < 50 && contrastRatio(hex, bg) < target; i++) {
|
|
491
|
+
if (step > 0 && out.l < .995 || step < 0 && out.l > .02) out.l = clamp(out.l + step, 0, 1);
|
|
492
|
+
else out.c = Math.max(0, out.c - .02);
|
|
493
|
+
hex = oklchToHex(out);
|
|
494
|
+
}
|
|
495
|
+
return out;
|
|
496
|
+
};
|
|
497
|
+
/** Guard-railed token: adjust toward `target` contrast, then record the pair. */
|
|
498
|
+
const contrasted = (fg, bgHex, target) => oklchToHex(ensureContrast(fg, bgHex, target));
|
|
499
|
+
const record = (foreground, background, foregroundColor, backgroundColor, required) => {
|
|
500
|
+
if (!checks) return;
|
|
501
|
+
const ratio = contrastRatio(foregroundColor, backgroundColor);
|
|
502
|
+
checks.push({
|
|
503
|
+
mode,
|
|
504
|
+
foreground,
|
|
505
|
+
background,
|
|
506
|
+
foregroundColor,
|
|
507
|
+
backgroundColor,
|
|
508
|
+
ratio: Math.round(ratio * 100) / 100,
|
|
509
|
+
required,
|
|
510
|
+
pass: ratio >= required,
|
|
511
|
+
level: ratio < required ? "fail" : ratio >= 7 ? "AAA" : "AA"
|
|
512
|
+
});
|
|
513
|
+
};
|
|
514
|
+
const background = tone(anchor.h, surfaceC, t.background);
|
|
515
|
+
const surface = tone(anchor.h, surfaceC, t.surface);
|
|
516
|
+
const surfaceVariant = tone(anchor.h, surfaceC, t.surfaceVariant);
|
|
517
|
+
const onColor = (hue, bg, c) => {
|
|
518
|
+
const deep = {
|
|
519
|
+
l: t.onDeep,
|
|
520
|
+
c: Math.min(c, .05),
|
|
521
|
+
h: hue
|
|
522
|
+
};
|
|
523
|
+
const light = {
|
|
524
|
+
l: t.onLight,
|
|
525
|
+
c: Math.min(c, .02),
|
|
526
|
+
h: hue
|
|
527
|
+
};
|
|
528
|
+
return contrasted(contrastRatio(oklchToHex(deep), bg) >= contrastRatio(oklchToHex(light), bg) ? deep : light, bg, 4.5);
|
|
529
|
+
};
|
|
530
|
+
const adaptPinForDark = (hex) => {
|
|
531
|
+
const pin = hexToOklch(hex);
|
|
532
|
+
pin.l = Math.max(pin.l, .6);
|
|
533
|
+
return oklchToHex(ensureContrast(pin, background, 3));
|
|
534
|
+
};
|
|
535
|
+
/**
|
|
536
|
+
* Resolve a role's base color: hard pins are verbatim in light mode and
|
|
537
|
+
* lightness-lifted in dark; soft targets and generated tones are pulled to
|
|
538
|
+
* ≥ 4.5:1 as standalone ink on `background` and `surface` (§3.6).
|
|
539
|
+
*/
|
|
540
|
+
const baseFor = (name, hue, c) => {
|
|
541
|
+
const pinned = brand[name];
|
|
542
|
+
if (pinned) return dark ? adaptPinForDark(pinned) : pinned;
|
|
543
|
+
const target = targets[name];
|
|
544
|
+
let base;
|
|
545
|
+
if (target) {
|
|
546
|
+
base = hexToOklch(target);
|
|
547
|
+
if (dark) {
|
|
548
|
+
base.c = Math.min(base.c, DARK_ACCENT_CHROMA_CAP);
|
|
549
|
+
base.l = Math.max(base.l, t.accent - .08);
|
|
550
|
+
}
|
|
551
|
+
} else base = {
|
|
552
|
+
l: t.accent,
|
|
553
|
+
c,
|
|
554
|
+
h: hue
|
|
555
|
+
};
|
|
556
|
+
return oklchToHex(ensureContrast(ensureContrast(base, background, 4.5), surface, 4.5));
|
|
557
|
+
};
|
|
558
|
+
const disabled = dark ? "rgba(255,255,255,0.12)" : "rgba(0,0,0,0.12)";
|
|
559
|
+
const onDisabled = dark ? "rgba(255,255,255,0.38)" : "rgba(0,0,0,0.38)";
|
|
560
|
+
const role = (name, base, cC = containerC) => {
|
|
561
|
+
const { h, c } = hexToOklch(base);
|
|
562
|
+
const container = tone(h, cC, t.container);
|
|
563
|
+
const roleSurface = tone(h, surfaceC, t.roleSurface);
|
|
564
|
+
const onBase = onColor(h, base, c);
|
|
565
|
+
const onContainer = onColor(h, container, c);
|
|
566
|
+
const onContainerVariant = contrasted({
|
|
567
|
+
l: t.mutedText,
|
|
568
|
+
c: Math.min(cC, .06),
|
|
569
|
+
h
|
|
570
|
+
}, container, 4.5);
|
|
571
|
+
const borderHex = oklchToHex(ensureContrast(ensureContrast(hexToOklch(base), container, 3), surface, 3));
|
|
572
|
+
const onRoleSurface = onColor(h, roleSurface, surfaceC);
|
|
573
|
+
const onRoleSurfaceVariant = contrasted(hexToOklch(base), roleSurface, 4.5);
|
|
574
|
+
record(`on-${name}`, name, onBase, base, 4.5);
|
|
575
|
+
record(`on-${name}-container`, `${name}-container`, onContainer, container, 4.5);
|
|
576
|
+
record(`on-${name}-container-variant`, `${name}-container`, onContainerVariant, container, 4.5);
|
|
577
|
+
record(`on-${name}-container-border`, `${name}-container`, borderHex, container, 3);
|
|
578
|
+
record(`on-${name}-container-border`, "surface", borderHex, surface, 3);
|
|
579
|
+
record(`on-${name}-surface`, `${name}-surface`, onRoleSurface, roleSurface, 4.5);
|
|
580
|
+
record(`on-${name}-surface-variant`, `${name}-surface`, onRoleSurfaceVariant, roleSurface, 4.5);
|
|
581
|
+
record(name, "background", base, background, 4.5);
|
|
582
|
+
record(name, "surface", base, surface, 4.5);
|
|
583
|
+
return {
|
|
584
|
+
[name]: base,
|
|
585
|
+
[`on-${name}`]: onBase,
|
|
586
|
+
[`${name}-container`]: container,
|
|
587
|
+
[`on-${name}-container`]: onContainer,
|
|
588
|
+
[`on-${name}-container-variant`]: onContainerVariant,
|
|
589
|
+
[`on-${name}-container-border`]: borderHex,
|
|
590
|
+
[`${name}-surface`]: roleSurface,
|
|
591
|
+
[`on-${name}-surface`]: onRoleSurface,
|
|
592
|
+
[`on-${name}-surface-variant`]: onRoleSurfaceVariant
|
|
593
|
+
};
|
|
594
|
+
};
|
|
595
|
+
const primaryBase = baseFor("primary", hues.primary, accentC);
|
|
596
|
+
const secondaryBase = baseFor("secondary", hues.secondary, accentC);
|
|
597
|
+
const tertiaryBase = baseFor("tertiary", hues.tertiary, accentC);
|
|
598
|
+
const quaternaryGrey = brand.quaternary ? dark ? adaptPinForDark(brand.quaternary) : brand.quaternary : oklchToHex(ensureContrast({
|
|
599
|
+
l: t.grey,
|
|
600
|
+
c: surfaceC,
|
|
601
|
+
h: anchor.h
|
|
602
|
+
}, surface, 3));
|
|
603
|
+
const quaternarySurface = tone(anchor.h, surfaceC, t.roleSurface);
|
|
604
|
+
const onQuaternary = onColor(anchor.h, quaternaryGrey, surfaceC);
|
|
605
|
+
const onQuaternarySurface = onColor(anchor.h, quaternarySurface, surfaceC);
|
|
606
|
+
const onQuaternarySurfaceVariant = contrasted(hexToOklch(primaryBase), quaternarySurface, 4.5);
|
|
607
|
+
const onQuaternaryContainerVariant = contrasted({
|
|
608
|
+
l: t.mutedText,
|
|
609
|
+
c: Math.min(containerC, .06),
|
|
610
|
+
h: anchor.h
|
|
611
|
+
}, quaternarySurface, 4.5);
|
|
612
|
+
record("on-quaternary", "quaternary", onQuaternary, quaternaryGrey, 4.5);
|
|
613
|
+
record("on-quaternary-surface", "quaternary-surface", onQuaternarySurface, quaternarySurface, 4.5);
|
|
614
|
+
record("on-quaternary-surface-variant", "quaternary-surface", onQuaternarySurfaceVariant, quaternarySurface, 4.5);
|
|
615
|
+
const semantic = (name) => {
|
|
616
|
+
const { hue, chroma } = SemanticColors[name];
|
|
617
|
+
const base = baseFor(name, hue, dark ? Math.min(chroma, DARK_ACCENT_CHROMA_CAP) : chroma);
|
|
618
|
+
const { h } = hexToOklch(base);
|
|
619
|
+
const container = tone(h, containerC + .04, t.container);
|
|
620
|
+
const onBase = onColor(h, base, chroma);
|
|
621
|
+
const onContainer = onColor(h, container, chroma);
|
|
622
|
+
record(`on-${name}`, name, onBase, base, 4.5);
|
|
623
|
+
record(`on-${name}-container`, `${name}-container`, onContainer, container, 4.5);
|
|
624
|
+
record(name, "background", base, background, 4.5);
|
|
625
|
+
record(name, "surface", base, surface, 4.5);
|
|
626
|
+
return {
|
|
627
|
+
base,
|
|
628
|
+
container,
|
|
629
|
+
onBase,
|
|
630
|
+
onContainer,
|
|
631
|
+
h
|
|
632
|
+
};
|
|
633
|
+
};
|
|
634
|
+
const error = semantic("error");
|
|
635
|
+
const warn = semantic("warn");
|
|
636
|
+
const success = semantic("success");
|
|
637
|
+
const semanticExtras = (name, s) => {
|
|
638
|
+
const variant = contrasted({
|
|
639
|
+
l: t.mutedText,
|
|
640
|
+
c: .06,
|
|
641
|
+
h: s.h
|
|
642
|
+
}, s.container, 4.5);
|
|
643
|
+
const border = oklchToHex(ensureContrast(ensureContrast(hexToOklch(s.base), s.container, 3), surface, 3));
|
|
644
|
+
record(`on-${name}-container-variant`, `${name}-container`, variant, s.container, 4.5);
|
|
645
|
+
record(`on-${name}-container-border`, `${name}-container`, border, s.container, 3);
|
|
646
|
+
return {
|
|
647
|
+
variant,
|
|
648
|
+
border
|
|
649
|
+
};
|
|
650
|
+
};
|
|
651
|
+
const warnExtras = semanticExtras("warn", warn);
|
|
652
|
+
const successExtras = semanticExtras("success", success);
|
|
653
|
+
const onBackground = tone(anchor.h, surfaceC, t.onSurface);
|
|
654
|
+
const onBackgroundVariant = contrasted({
|
|
655
|
+
l: t.mutedText,
|
|
656
|
+
c: surfaceC,
|
|
657
|
+
h: anchor.h
|
|
658
|
+
}, background, 4.5);
|
|
659
|
+
const onSurface = tone(anchor.h, surfaceC, t.onSurface);
|
|
660
|
+
const onSurfaceVariant = contrasted({
|
|
661
|
+
l: dark ? t.mutedText : t.mutedText - .14,
|
|
662
|
+
c: surfaceC,
|
|
663
|
+
h: anchor.h
|
|
664
|
+
}, surfaceVariant, 4.5);
|
|
665
|
+
record("on-background", "background", onBackground, background, 4.5);
|
|
666
|
+
record("on-background-variant", "background", onBackgroundVariant, background, 4.5);
|
|
667
|
+
record("on-surface", "surface", onSurface, surface, 4.5);
|
|
668
|
+
record("on-surface-variant", "surface-variant", onSurfaceVariant, surfaceVariant, 4.5);
|
|
669
|
+
const inverseSurface = tone(anchor.h, surfaceC, t.inverse);
|
|
670
|
+
const onInverse = tone(anchor.h, surfaceC, t.onInverse);
|
|
671
|
+
const inversePrimary = contrasted(hexToOklch(primaryBase), inverseSurface, 4.5);
|
|
672
|
+
record("on-inverse-surface", "inverse-surface", onInverse, inverseSurface, 4.5);
|
|
673
|
+
record("on-inverse-surface-primary", "inverse-surface", inversePrimary, inverseSurface, 4.5);
|
|
674
|
+
record("on-inverse-container", "inverse-container", onInverse, inverseSurface, 4.5);
|
|
675
|
+
const outline = oklchToHex(ensureContrast(ensureContrast({
|
|
676
|
+
l: t.outline,
|
|
677
|
+
c: Math.min(surfaceC, .02),
|
|
678
|
+
h: hues.primary
|
|
679
|
+
}, surface, 3), background, 3));
|
|
680
|
+
record("outline", "surface", outline, surface, 3);
|
|
681
|
+
record("outline", "background", outline, background, 3);
|
|
682
|
+
return {
|
|
683
|
+
...role("primary", primaryBase),
|
|
684
|
+
...role("secondary", secondaryBase),
|
|
685
|
+
...role("tertiary", tertiaryBase),
|
|
686
|
+
quaternary: quaternaryGrey,
|
|
687
|
+
"on-quaternary": onQuaternary,
|
|
688
|
+
"quaternary-surface": quaternarySurface,
|
|
689
|
+
"on-quaternary-surface": onQuaternarySurface,
|
|
690
|
+
"on-quaternary-surface-variant": onQuaternarySurfaceVariant,
|
|
691
|
+
"on-quaternary-container-variant": onQuaternaryContainerVariant,
|
|
692
|
+
"on-quaternary-container-border": quaternaryGrey,
|
|
693
|
+
error: error.base,
|
|
694
|
+
"on-error": error.onBase,
|
|
695
|
+
"error-container": error.container,
|
|
696
|
+
"on-error-container": error.onContainer,
|
|
697
|
+
warn: warn.base,
|
|
698
|
+
"on-warn": warn.onBase,
|
|
699
|
+
"warn-container": warn.container,
|
|
700
|
+
"on-warn-container": warn.onContainer,
|
|
701
|
+
"on-warn-container-variant": warnExtras.variant,
|
|
702
|
+
"on-warn-container-border": warnExtras.border,
|
|
703
|
+
success: success.base,
|
|
704
|
+
"on-success": success.onBase,
|
|
705
|
+
"success-container": success.container,
|
|
706
|
+
"on-success-container": success.onContainer,
|
|
707
|
+
"on-success-container-variant": successExtras.variant,
|
|
708
|
+
"on-success-container-border": successExtras.border,
|
|
709
|
+
background,
|
|
710
|
+
"on-background": onBackground,
|
|
711
|
+
"on-background-variant": onBackgroundVariant,
|
|
712
|
+
surface,
|
|
713
|
+
"on-surface": onSurface,
|
|
714
|
+
"surface-variant": surfaceVariant,
|
|
715
|
+
"on-surface-variant": onSurfaceVariant,
|
|
716
|
+
"inverse-surface": inverseSurface,
|
|
717
|
+
"on-inverse-surface": onInverse,
|
|
718
|
+
"on-inverse-surface-primary": inversePrimary,
|
|
719
|
+
"on-inverse-surface-variant": inversePrimary,
|
|
720
|
+
"inverse-container": inverseSurface,
|
|
721
|
+
"on-inverse-container": onInverse,
|
|
722
|
+
outline,
|
|
723
|
+
shadow: "#000000",
|
|
724
|
+
scrim: "#000000",
|
|
725
|
+
"surface-tint": primaryBase,
|
|
726
|
+
transparent: "rgba(0,0,0,0)",
|
|
727
|
+
ghost: "rgba(0,0,0,0)",
|
|
728
|
+
disabled,
|
|
729
|
+
"on-disabled": onDisabled,
|
|
730
|
+
"disabled-container": tone(hues.primary, surfaceC, t.disabledContainer),
|
|
731
|
+
"on-disabled-container": onDisabled,
|
|
732
|
+
"disabled-surface": disabled,
|
|
733
|
+
"on-disabled-surface": dark ? "rgba(255,255,255,0.5)" : "rgba(0,0,0,0.5)",
|
|
734
|
+
"on-disabled-surface-variant": dark ? "rgba(255,255,255,0.4)" : "rgba(0,0,0,0.4)"
|
|
735
|
+
};
|
|
736
|
+
};
|
|
737
|
+
//#endregion
|
|
738
|
+
//#region src/concepts/color/color.factory.ts
|
|
739
|
+
/**
|
|
740
|
+
* Generate a complete {@link Colors} token set from a single seed color, a
|
|
741
|
+
* {@link ColorScheme} and a {@link ColorCategory}. Produces a light or dark
|
|
742
|
+
* variant of the same palette; `on-*` colors are driven to WCAG AA contrast
|
|
743
|
+
* so text stays legible for any seed.
|
|
744
|
+
*
|
|
745
|
+
* Delegates to the OKLCH engine in `concepts/generation` — all lightness and
|
|
746
|
+
* chroma math is perceptual, and every derived pair passes through the WCAG
|
|
747
|
+
* guard-rail. Accepts the engine's extended config, so callers may also pass
|
|
748
|
+
* soft `targets` (brand-faithful but guard-railed) and a `checks` sink. Use
|
|
749
|
+
* `generateThemes()` for the light+dark pair plus a {@link ContrastReport}.
|
|
750
|
+
*/
|
|
751
|
+
var generatePalette = (config) => generateColors(config);
|
|
177
752
|
//#endregion
|
|
178
753
|
//#region src/concepts/elevation/zIndex.ts
|
|
179
754
|
var Z_INDEX = {
|
|
@@ -187,6 +762,856 @@ var Z_INDEX = {
|
|
|
187
762
|
overlay: 1080
|
|
188
763
|
};
|
|
189
764
|
//#endregion
|
|
765
|
+
//#region src/concepts/theme/themes/base.theme.ts
|
|
766
|
+
var BaseTypography = {
|
|
767
|
+
"display-large": {
|
|
768
|
+
fontFamily: "Red Hat Display",
|
|
769
|
+
fontSize: 57,
|
|
770
|
+
lineHeight: 64,
|
|
771
|
+
fontWeight: "normal",
|
|
772
|
+
letterSpacing: -.25
|
|
773
|
+
},
|
|
774
|
+
"display-medium": {
|
|
775
|
+
fontFamily: "Red Hat Display",
|
|
776
|
+
fontSize: 45,
|
|
777
|
+
lineHeight: 52,
|
|
778
|
+
fontWeight: "normal"
|
|
779
|
+
},
|
|
780
|
+
"display-small": {
|
|
781
|
+
fontFamily: "Red Hat Display",
|
|
782
|
+
fontSize: 36,
|
|
783
|
+
lineHeight: 44,
|
|
784
|
+
fontWeight: "normal"
|
|
785
|
+
},
|
|
786
|
+
"headline-large": {
|
|
787
|
+
fontFamily: "Red Hat Display",
|
|
788
|
+
fontSize: 32,
|
|
789
|
+
lineHeight: 40,
|
|
790
|
+
fontWeight: "normal"
|
|
791
|
+
},
|
|
792
|
+
"headline-medium": {
|
|
793
|
+
fontFamily: "Red Hat Display",
|
|
794
|
+
fontSize: 28,
|
|
795
|
+
lineHeight: 36,
|
|
796
|
+
fontWeight: "normal"
|
|
797
|
+
},
|
|
798
|
+
"headline-small": {
|
|
799
|
+
fontFamily: "Red Hat Display",
|
|
800
|
+
fontSize: 24,
|
|
801
|
+
lineHeight: 32,
|
|
802
|
+
fontWeight: "normal"
|
|
803
|
+
},
|
|
804
|
+
"title-large": {
|
|
805
|
+
fontFamily: "Red Hat Display",
|
|
806
|
+
fontSize: 22,
|
|
807
|
+
lineHeight: 28,
|
|
808
|
+
fontWeight: "normal"
|
|
809
|
+
},
|
|
810
|
+
"title-medium": {
|
|
811
|
+
fontFamily: "Red Hat Display",
|
|
812
|
+
fontSize: 16,
|
|
813
|
+
lineHeight: 24,
|
|
814
|
+
fontWeight: "medium",
|
|
815
|
+
letterSpacing: .15
|
|
816
|
+
},
|
|
817
|
+
"title-small": {
|
|
818
|
+
fontFamily: "Red Hat Display",
|
|
819
|
+
fontWeight: "medium",
|
|
820
|
+
fontSize: 14,
|
|
821
|
+
lineHeight: 20,
|
|
822
|
+
letterSpacing: .1
|
|
823
|
+
},
|
|
824
|
+
"body-1-long": {
|
|
825
|
+
fontFamily: "Roboto",
|
|
826
|
+
fontSize: 16,
|
|
827
|
+
lineHeight: 22
|
|
828
|
+
},
|
|
829
|
+
"body-1-short": {
|
|
830
|
+
fontFamily: "Roboto",
|
|
831
|
+
fontSize: 16,
|
|
832
|
+
lineHeight: 24
|
|
833
|
+
},
|
|
834
|
+
"body-2-long": {
|
|
835
|
+
fontFamily: "Roboto",
|
|
836
|
+
fontSize: 14,
|
|
837
|
+
lineHeight: 18
|
|
838
|
+
},
|
|
839
|
+
"body-2-short": {
|
|
840
|
+
fontFamily: "Roboto",
|
|
841
|
+
fontSize: 14,
|
|
842
|
+
lineHeight: 20
|
|
843
|
+
},
|
|
844
|
+
"subtitle-1": {
|
|
845
|
+
fontFamily: "Red Hat Display",
|
|
846
|
+
fontSize: 16,
|
|
847
|
+
lineHeight: 24,
|
|
848
|
+
letterSpacing: .15
|
|
849
|
+
},
|
|
850
|
+
"subtitle-2": {
|
|
851
|
+
fontFamily: "Red Hat Display",
|
|
852
|
+
fontSize: 14,
|
|
853
|
+
lineHeight: 20,
|
|
854
|
+
fontWeight: "medium",
|
|
855
|
+
letterSpacing: .1
|
|
856
|
+
},
|
|
857
|
+
label: {
|
|
858
|
+
fontFamily: "Roboto",
|
|
859
|
+
fontSize: 14,
|
|
860
|
+
lineHeight: 20
|
|
861
|
+
},
|
|
862
|
+
button: {
|
|
863
|
+
fontFamily: "Red Hat Display",
|
|
864
|
+
fontSize: 14,
|
|
865
|
+
lineHeight: 20,
|
|
866
|
+
fontWeight: "medium",
|
|
867
|
+
textTransform: "capitalize"
|
|
868
|
+
},
|
|
869
|
+
caption: {
|
|
870
|
+
fontFamily: "Roboto",
|
|
871
|
+
fontSize: 12,
|
|
872
|
+
lineHeight: 18,
|
|
873
|
+
letterSpacing: .4
|
|
874
|
+
},
|
|
875
|
+
overline: {
|
|
876
|
+
fontFamily: "Red Hat Display",
|
|
877
|
+
fontSize: 10,
|
|
878
|
+
lineHeight: 18,
|
|
879
|
+
letterSpacing: 1.5,
|
|
880
|
+
textTransform: "uppercase"
|
|
881
|
+
},
|
|
882
|
+
paragraph: {
|
|
883
|
+
fontFamily: "Roboto",
|
|
884
|
+
fontSize: 16,
|
|
885
|
+
lineHeight: 24
|
|
886
|
+
},
|
|
887
|
+
quote: {
|
|
888
|
+
fontFamily: "Roboto",
|
|
889
|
+
fontSize: 16,
|
|
890
|
+
lineHeight: 24
|
|
891
|
+
},
|
|
892
|
+
note: {
|
|
893
|
+
fontFamily: "Roboto",
|
|
894
|
+
fontSize: 14,
|
|
895
|
+
lineHeight: 22,
|
|
896
|
+
fontStyle: "italic"
|
|
897
|
+
},
|
|
898
|
+
badge: {
|
|
899
|
+
fontFamily: "Red Hat Display",
|
|
900
|
+
fontSize: 16,
|
|
901
|
+
lineHeight: 24
|
|
902
|
+
},
|
|
903
|
+
tag: {
|
|
904
|
+
fontFamily: "Red Hat Display",
|
|
905
|
+
fontSize: 15,
|
|
906
|
+
lineHeight: 20,
|
|
907
|
+
fontWeight: 600
|
|
908
|
+
},
|
|
909
|
+
input: {
|
|
910
|
+
fontFamily: "Red Hat Display",
|
|
911
|
+
fontSize: 14,
|
|
912
|
+
lineHeight: 24
|
|
913
|
+
}
|
|
914
|
+
};
|
|
915
|
+
var BaseShadows = {
|
|
916
|
+
raised: "rgba(0, 0, 0, 0.2) 0px 2px 1px -1px, rgba(0, 0, 0, 0.14) 0px 1px 1px 0px, rgba(0, 0, 0, 0.12) 0px 1px 3px 0px",
|
|
917
|
+
menu: "rgba(0, 0, 0, 0.2) 0px 3px 3px -2px, rgba(0, 0, 0, 0.14) 0px 3px 4px 0px, rgba(0, 0, 0, 0.12) 0px 1px 8px 0px;",
|
|
918
|
+
dialog: "rgba(0, 0, 0, 0.2) 0px 3px 5px -1px, rgba(0, 0, 0, 0.14) 0px 6px 10px 0px, rgba(0, 0, 0, 0.12) 0px 1px 18px 0px",
|
|
919
|
+
warn: "0 0 5px rgba(255, 0, 0, 0.5), inset 0 0 5px rgba(255, 0, 0, 0.3)"
|
|
920
|
+
};
|
|
921
|
+
var BaseSpacing = {
|
|
922
|
+
none: "none",
|
|
923
|
+
xxs: "2px",
|
|
924
|
+
xs: "4px",
|
|
925
|
+
sm: "8px",
|
|
926
|
+
md: "16px",
|
|
927
|
+
lg: "32px",
|
|
928
|
+
xl: "64px"
|
|
929
|
+
};
|
|
930
|
+
var BaseThicknesses = {
|
|
931
|
+
thin: 1,
|
|
932
|
+
standard: 2,
|
|
933
|
+
thick: 4
|
|
934
|
+
};
|
|
935
|
+
var BaseRadii = {
|
|
936
|
+
none: "none",
|
|
937
|
+
xxs: "4px",
|
|
938
|
+
xs: "8px",
|
|
939
|
+
sm: "16px",
|
|
940
|
+
md: "24px",
|
|
941
|
+
lg: "32px",
|
|
942
|
+
max: "999px"
|
|
943
|
+
};
|
|
944
|
+
var buildBorders = (c) => ({
|
|
945
|
+
primary: `1px solid ${c.primary}`,
|
|
946
|
+
secondary: `1px solid ${c.secondary}`,
|
|
947
|
+
tertiary: `1px solid ${c.tertiary}`,
|
|
948
|
+
quaternary: `1px solid ${c.quaternary}`,
|
|
949
|
+
warn: `1px solid ${c.warn}`,
|
|
950
|
+
success: `1px solid ${c.success}`,
|
|
951
|
+
light: `1px solid ${c.outline}`,
|
|
952
|
+
dark: `1px solid ${c["on-background"]}`,
|
|
953
|
+
dotted: `1px dotted ${c["on-background"]}`
|
|
954
|
+
});
|
|
955
|
+
var buildComponents = (c) => ({
|
|
956
|
+
alert: { options: {
|
|
957
|
+
topPosition: 40,
|
|
958
|
+
borderRadius: "sm",
|
|
959
|
+
transitionSpeed: .35,
|
|
960
|
+
elevation: "md"
|
|
961
|
+
} },
|
|
962
|
+
checkbox: { options: { size: 20 } },
|
|
963
|
+
dialog: { options: {
|
|
964
|
+
borderRadius: "lg",
|
|
965
|
+
color: "primary-surface",
|
|
966
|
+
border: "quaternary",
|
|
967
|
+
padding: "sm",
|
|
968
|
+
elevation: "dialog",
|
|
969
|
+
backdrop: {
|
|
970
|
+
background: "rgba(255, 255, 255, 0.6)",
|
|
971
|
+
backdropFilter: "blur(2px)"
|
|
972
|
+
}
|
|
973
|
+
} },
|
|
974
|
+
dialogHeader: { options: {
|
|
975
|
+
borderRadius: "max",
|
|
976
|
+
color: "primary",
|
|
977
|
+
height: 48,
|
|
978
|
+
textRole: "title-large",
|
|
979
|
+
textAlign: "center",
|
|
980
|
+
closeButtonIcon: "close",
|
|
981
|
+
closeButtonSize: "md"
|
|
982
|
+
} },
|
|
983
|
+
dropdown: { options: {
|
|
984
|
+
border: "none",
|
|
985
|
+
borderRadius: "xxs",
|
|
986
|
+
color: "primary-surface",
|
|
987
|
+
shadow: "menu"
|
|
988
|
+
} },
|
|
989
|
+
footer: { options: {
|
|
990
|
+
height: 52,
|
|
991
|
+
color: "primary",
|
|
992
|
+
logoHeight: 18.6,
|
|
993
|
+
logoPadding: "md"
|
|
994
|
+
} },
|
|
995
|
+
input: { options: {
|
|
996
|
+
typeFace: "input",
|
|
997
|
+
color: "primary-surface",
|
|
998
|
+
textColor: "on-primary-surface",
|
|
999
|
+
disabledColor: "disabled-surface",
|
|
1000
|
+
disabledTextColor: "on-disabled-surface",
|
|
1001
|
+
border: "light",
|
|
1002
|
+
borderRadius: "xs",
|
|
1003
|
+
errorShadow: "warn",
|
|
1004
|
+
errorBorder: "warn",
|
|
1005
|
+
height: 32,
|
|
1006
|
+
paddingLeft: "sm",
|
|
1007
|
+
focusOutline: `2px solid ${c.primary}`,
|
|
1008
|
+
focusOutlineOffset: 2
|
|
1009
|
+
} },
|
|
1010
|
+
multiSelectDropdown: { options: {
|
|
1011
|
+
textRole: "input",
|
|
1012
|
+
textColor: "on-primary-surface",
|
|
1013
|
+
dividerBorder: "light",
|
|
1014
|
+
searchInputBorder: "light",
|
|
1015
|
+
searchInputBorderRadius: "xxs",
|
|
1016
|
+
focusOutline: `2px solid ${c.primary}`,
|
|
1017
|
+
focusOutlineOffset: 2
|
|
1018
|
+
} },
|
|
1019
|
+
badge: { options: { borderRadius: "xxs" } },
|
|
1020
|
+
button: {
|
|
1021
|
+
fixed: {
|
|
1022
|
+
position: "relative",
|
|
1023
|
+
overflow: "hidden",
|
|
1024
|
+
outline: "0",
|
|
1025
|
+
border: "0",
|
|
1026
|
+
cursor: "pointer",
|
|
1027
|
+
fontFamily: "Euphemia, sans-serif",
|
|
1028
|
+
transition: "all 0.28s ease"
|
|
1029
|
+
},
|
|
1030
|
+
variants: {
|
|
1031
|
+
ghost: {
|
|
1032
|
+
backgroundColor: "transparent",
|
|
1033
|
+
color: "currentcolor",
|
|
1034
|
+
"&:hover": { backgroundColor: "rgba(0,0,0,0.06)" }
|
|
1035
|
+
},
|
|
1036
|
+
primary: {
|
|
1037
|
+
backgroundColor: c.primary,
|
|
1038
|
+
color: c["on-primary"],
|
|
1039
|
+
border: "0",
|
|
1040
|
+
"&:hover": { filter: "brightness(0.92)" }
|
|
1041
|
+
},
|
|
1042
|
+
secondary: {
|
|
1043
|
+
backgroundColor: "transparent",
|
|
1044
|
+
color: c.secondary,
|
|
1045
|
+
border: `1px solid ${c.secondary}`,
|
|
1046
|
+
"&:hover": {
|
|
1047
|
+
backgroundColor: c.secondary,
|
|
1048
|
+
color: c["on-secondary"]
|
|
1049
|
+
}
|
|
1050
|
+
},
|
|
1051
|
+
tertiary: {
|
|
1052
|
+
backgroundColor: c.tertiary,
|
|
1053
|
+
color: c["on-tertiary"],
|
|
1054
|
+
border: "0",
|
|
1055
|
+
"&:hover": { filter: "brightness(0.92)" }
|
|
1056
|
+
},
|
|
1057
|
+
warn: {
|
|
1058
|
+
backgroundColor: c.warn,
|
|
1059
|
+
color: c["on-warn"],
|
|
1060
|
+
border: "0",
|
|
1061
|
+
"&:hover": { filter: "brightness(0.92)" }
|
|
1062
|
+
},
|
|
1063
|
+
success: {
|
|
1064
|
+
backgroundColor: c.success,
|
|
1065
|
+
color: c["on-success"],
|
|
1066
|
+
border: "0",
|
|
1067
|
+
"&:hover": { filter: "brightness(0.92)" }
|
|
1068
|
+
},
|
|
1069
|
+
disabled: {
|
|
1070
|
+
backgroundColor: `${c.disabled} !important`,
|
|
1071
|
+
color: `${c["on-disabled"]} !important`,
|
|
1072
|
+
border: "0"
|
|
1073
|
+
}
|
|
1074
|
+
},
|
|
1075
|
+
sizes: {
|
|
1076
|
+
sm: {
|
|
1077
|
+
height: 22,
|
|
1078
|
+
borderRadius: 11,
|
|
1079
|
+
fontSize: 12,
|
|
1080
|
+
padding: "0 12px",
|
|
1081
|
+
fontFamily: "Euphemia Bold, sans-serif",
|
|
1082
|
+
fontWeight: 600
|
|
1083
|
+
},
|
|
1084
|
+
md: {
|
|
1085
|
+
height: 26,
|
|
1086
|
+
borderRadius: 13,
|
|
1087
|
+
fontSize: 16,
|
|
1088
|
+
padding: "0 16px"
|
|
1089
|
+
},
|
|
1090
|
+
lg: {
|
|
1091
|
+
height: 36,
|
|
1092
|
+
borderRadius: 18,
|
|
1093
|
+
fontSize: 18,
|
|
1094
|
+
padding: "0 18px"
|
|
1095
|
+
},
|
|
1096
|
+
xl: {
|
|
1097
|
+
height: 48,
|
|
1098
|
+
borderRadius: 24,
|
|
1099
|
+
fontSize: 24,
|
|
1100
|
+
padding: "0 22px"
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
},
|
|
1104
|
+
iconButton: {
|
|
1105
|
+
variants: {
|
|
1106
|
+
ghost: {
|
|
1107
|
+
backgroundColor: "transparent",
|
|
1108
|
+
color: "currentcolor"
|
|
1109
|
+
},
|
|
1110
|
+
primary: {
|
|
1111
|
+
backgroundColor: c.primary,
|
|
1112
|
+
color: c["on-primary"]
|
|
1113
|
+
},
|
|
1114
|
+
secondary: {
|
|
1115
|
+
backgroundColor: c.secondary,
|
|
1116
|
+
color: c["on-secondary"]
|
|
1117
|
+
},
|
|
1118
|
+
tertiary: {
|
|
1119
|
+
backgroundColor: c.tertiary,
|
|
1120
|
+
color: c["on-tertiary"]
|
|
1121
|
+
},
|
|
1122
|
+
warn: {
|
|
1123
|
+
backgroundColor: c.warn,
|
|
1124
|
+
color: c["on-warn"]
|
|
1125
|
+
},
|
|
1126
|
+
success: {
|
|
1127
|
+
backgroundColor: c.success,
|
|
1128
|
+
color: c["on-success"]
|
|
1129
|
+
},
|
|
1130
|
+
disabled: {
|
|
1131
|
+
backgroundColor: "transparent !important",
|
|
1132
|
+
color: `${c["on-disabled"]} !important`
|
|
1133
|
+
}
|
|
1134
|
+
},
|
|
1135
|
+
sizes: {
|
|
1136
|
+
sm: {
|
|
1137
|
+
height: 22,
|
|
1138
|
+
minHeight: 22,
|
|
1139
|
+
width: 22,
|
|
1140
|
+
minWidth: 22,
|
|
1141
|
+
fontSize: 18
|
|
1142
|
+
},
|
|
1143
|
+
md: {
|
|
1144
|
+
height: 26,
|
|
1145
|
+
minHeight: 26,
|
|
1146
|
+
width: 26,
|
|
1147
|
+
minWidth: 26,
|
|
1148
|
+
fontSize: 22
|
|
1149
|
+
},
|
|
1150
|
+
lg: {
|
|
1151
|
+
height: 36,
|
|
1152
|
+
minHeight: 36,
|
|
1153
|
+
width: 36,
|
|
1154
|
+
minWidth: 36,
|
|
1155
|
+
fontSize: 30
|
|
1156
|
+
},
|
|
1157
|
+
xl: {
|
|
1158
|
+
height: 40,
|
|
1159
|
+
minHeight: 40,
|
|
1160
|
+
width: 40,
|
|
1161
|
+
minWidth: 40,
|
|
1162
|
+
fontSize: 34
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
},
|
|
1166
|
+
progressGauge: {
|
|
1167
|
+
fixed: { textFill: c["on-background"] },
|
|
1168
|
+
variants: {
|
|
1169
|
+
primary: {
|
|
1170
|
+
backgroundColor: "#b3d4ea",
|
|
1171
|
+
color: c.primary
|
|
1172
|
+
},
|
|
1173
|
+
secondary: {
|
|
1174
|
+
backgroundColor: "#b3e7c2",
|
|
1175
|
+
color: c.secondary
|
|
1176
|
+
},
|
|
1177
|
+
tertiary: {
|
|
1178
|
+
backgroundColor: "#ffe2b3",
|
|
1179
|
+
color: c.tertiary
|
|
1180
|
+
},
|
|
1181
|
+
warn: {
|
|
1182
|
+
backgroundColor: "#ffc2b3",
|
|
1183
|
+
color: c.warn
|
|
1184
|
+
},
|
|
1185
|
+
success: {
|
|
1186
|
+
backgroundColor: "#b3e7c2",
|
|
1187
|
+
color: c.success
|
|
1188
|
+
}
|
|
1189
|
+
},
|
|
1190
|
+
sizes: {
|
|
1191
|
+
sm: { height: "54px" },
|
|
1192
|
+
md: { height: "68px" },
|
|
1193
|
+
lg: { height: "82px" },
|
|
1194
|
+
xl: { height: "104px" }
|
|
1195
|
+
}
|
|
1196
|
+
},
|
|
1197
|
+
card: {
|
|
1198
|
+
fixed: {
|
|
1199
|
+
borderStyle: "solid",
|
|
1200
|
+
borderWidth: "1px",
|
|
1201
|
+
borderRadius: "8px",
|
|
1202
|
+
overflow: "hidden"
|
|
1203
|
+
},
|
|
1204
|
+
variants: {
|
|
1205
|
+
primary: {
|
|
1206
|
+
borderColor: c.primary,
|
|
1207
|
+
backgroundColor: c.background
|
|
1208
|
+
},
|
|
1209
|
+
secondary: {
|
|
1210
|
+
borderColor: c.secondary,
|
|
1211
|
+
backgroundColor: c.background
|
|
1212
|
+
},
|
|
1213
|
+
tertiary: {
|
|
1214
|
+
borderColor: c.tertiary,
|
|
1215
|
+
backgroundColor: c.background
|
|
1216
|
+
},
|
|
1217
|
+
warn: {
|
|
1218
|
+
borderColor: c.warn,
|
|
1219
|
+
backgroundColor: c.background
|
|
1220
|
+
},
|
|
1221
|
+
success: {
|
|
1222
|
+
borderColor: c.success,
|
|
1223
|
+
backgroundColor: c.background
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
},
|
|
1227
|
+
cardHeader: {
|
|
1228
|
+
fixed: { padding: "12px 24px" },
|
|
1229
|
+
variants: {
|
|
1230
|
+
primary: {
|
|
1231
|
+
backgroundColor: c.primary,
|
|
1232
|
+
color: c["on-primary"]
|
|
1233
|
+
},
|
|
1234
|
+
secondary: {
|
|
1235
|
+
backgroundColor: c.secondary,
|
|
1236
|
+
color: c["on-secondary"]
|
|
1237
|
+
},
|
|
1238
|
+
tertiary: {
|
|
1239
|
+
backgroundColor: c.tertiary,
|
|
1240
|
+
color: c["on-tertiary"]
|
|
1241
|
+
},
|
|
1242
|
+
warn: {
|
|
1243
|
+
backgroundColor: c.warn,
|
|
1244
|
+
color: c["on-warn"]
|
|
1245
|
+
},
|
|
1246
|
+
success: {
|
|
1247
|
+
backgroundColor: c.success,
|
|
1248
|
+
color: c["on-success"]
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
},
|
|
1252
|
+
cardContent: { fixed: { padding: "12px 24px" } },
|
|
1253
|
+
dataSearch: { options: {
|
|
1254
|
+
border: "light",
|
|
1255
|
+
borderRadius: "xs",
|
|
1256
|
+
color: "primary-surface",
|
|
1257
|
+
placeholderColor: "disabled"
|
|
1258
|
+
} },
|
|
1259
|
+
dataTable: { options: {
|
|
1260
|
+
color: "primary-surface",
|
|
1261
|
+
border: "light",
|
|
1262
|
+
borderRadius: "sm",
|
|
1263
|
+
elevation: void 0,
|
|
1264
|
+
headerPadding: "sm",
|
|
1265
|
+
footerPadding: "sm",
|
|
1266
|
+
thTextRole: "headline-small",
|
|
1267
|
+
thColor: "primary-container",
|
|
1268
|
+
thVerticalBorder: "dotted",
|
|
1269
|
+
thHorizontalBorder: "light",
|
|
1270
|
+
thPadding: "sm",
|
|
1271
|
+
tdTextRole: "title-small",
|
|
1272
|
+
tdColor: "primary-surface",
|
|
1273
|
+
tdStickyColor: "primary-container",
|
|
1274
|
+
tdPadding: "sm",
|
|
1275
|
+
tdVerticalBorder: "dotted",
|
|
1276
|
+
tdHorizontalBorder: "light",
|
|
1277
|
+
rowHoverColor: "primary-container",
|
|
1278
|
+
loadingOverlayColor: "scrim",
|
|
1279
|
+
loadingSpinnerColor: "primary",
|
|
1280
|
+
loadingSpinnerSize: 40
|
|
1281
|
+
} },
|
|
1282
|
+
notificationBadge: { options: {
|
|
1283
|
+
borderRadius: "sm",
|
|
1284
|
+
offset: -10
|
|
1285
|
+
} },
|
|
1286
|
+
paginator: { options: {
|
|
1287
|
+
gap: "xs",
|
|
1288
|
+
textRole: "label",
|
|
1289
|
+
inputBorder: "light",
|
|
1290
|
+
inputBorderRadius: "xs",
|
|
1291
|
+
pageBorderRadius: "xs",
|
|
1292
|
+
currentPageBorder: "light",
|
|
1293
|
+
currentPageBorderRadius: "xs"
|
|
1294
|
+
} },
|
|
1295
|
+
snackbar: { options: {
|
|
1296
|
+
bottomPosition: 40,
|
|
1297
|
+
transitionDelay: "0.35s",
|
|
1298
|
+
autoCloseDelay: 35e3
|
|
1299
|
+
} },
|
|
1300
|
+
symbol: { options: {
|
|
1301
|
+
fill: 0,
|
|
1302
|
+
weight: 400,
|
|
1303
|
+
grade: 0,
|
|
1304
|
+
opticalSize: 24
|
|
1305
|
+
} },
|
|
1306
|
+
toggle: { options: { size: 20 } },
|
|
1307
|
+
tooltip: { options: {
|
|
1308
|
+
border: void 0,
|
|
1309
|
+
borderRadius: "xs",
|
|
1310
|
+
shadow: "raised",
|
|
1311
|
+
color: "inverse-surface",
|
|
1312
|
+
typeface: "label"
|
|
1313
|
+
} }
|
|
1314
|
+
});
|
|
1315
|
+
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1316
|
+
var deepMerge = (base, override) => {
|
|
1317
|
+
if (!override) return base;
|
|
1318
|
+
const out = { ...base };
|
|
1319
|
+
for (const [key, value] of Object.entries(override)) out[key] = isRecord(value) && isRecord(out[key]) ? deepMerge(out[key], value) : value;
|
|
1320
|
+
return out;
|
|
1321
|
+
};
|
|
1322
|
+
var createTheme = ({ id, name, colors, icons = {}, radii = BaseRadii, shadows = BaseShadows, borders, components }) => ({
|
|
1323
|
+
id,
|
|
1324
|
+
name,
|
|
1325
|
+
colors,
|
|
1326
|
+
typography: BaseTypography,
|
|
1327
|
+
borders: deepMerge(buildBorders(colors), borders),
|
|
1328
|
+
radii,
|
|
1329
|
+
shadows,
|
|
1330
|
+
spacing: BaseSpacing,
|
|
1331
|
+
thicknesses: BaseThicknesses,
|
|
1332
|
+
icons,
|
|
1333
|
+
components: deepMerge(buildComponents(colors), components)
|
|
1334
|
+
});
|
|
1335
|
+
/**
|
|
1336
|
+
* Build a full {@link UniTheme} straight from a {@link PaletteConfig} — the
|
|
1337
|
+
* one-call path a theme builder uses to turn a brand color (or a seed +
|
|
1338
|
+
* scheme + category) into a complete, ready-to-apply theme.
|
|
1339
|
+
*/
|
|
1340
|
+
var createThemeFromPalette = (config) => createTheme({
|
|
1341
|
+
id: config.id ?? "CustomTheme",
|
|
1342
|
+
name: config.name ?? "Custom Theme",
|
|
1343
|
+
colors: generatePalette(config),
|
|
1344
|
+
icons: config.icons
|
|
1345
|
+
});
|
|
1346
|
+
/**
|
|
1347
|
+
* Seed for the shipped Light/Dark themes. Swap these three values (or call
|
|
1348
|
+
* `generatePalette` with your own) to reskin the entire system — every color
|
|
1349
|
+
* token is derived, so there is nothing else to hand-author.
|
|
1350
|
+
*/
|
|
1351
|
+
var BASE_PALETTE_CONFIG = {
|
|
1352
|
+
seed: "#4F46E5",
|
|
1353
|
+
scheme: "triadic",
|
|
1354
|
+
category: "neutral"
|
|
1355
|
+
};
|
|
1356
|
+
var lightColors = generatePalette({
|
|
1357
|
+
...BASE_PALETTE_CONFIG,
|
|
1358
|
+
mode: "light"
|
|
1359
|
+
});
|
|
1360
|
+
var BaseTheme = createTheme({
|
|
1361
|
+
id: "BaseTheme",
|
|
1362
|
+
name: "Base Theme",
|
|
1363
|
+
colors: lightColors
|
|
1364
|
+
});
|
|
1365
|
+
//#endregion
|
|
1366
|
+
//#region src/concepts/generation/theme.generator.ts
|
|
1367
|
+
/** Radii presets per shape language (PRD §3.5.A). Same keys as `BaseRadii`. */
|
|
1368
|
+
var ShapeRadii = {
|
|
1369
|
+
sharp: {
|
|
1370
|
+
none: "none",
|
|
1371
|
+
xxs: "0px",
|
|
1372
|
+
xs: "0px",
|
|
1373
|
+
sm: "0px",
|
|
1374
|
+
md: "0px",
|
|
1375
|
+
lg: "0px",
|
|
1376
|
+
max: "0px"
|
|
1377
|
+
},
|
|
1378
|
+
modern: {
|
|
1379
|
+
none: "none",
|
|
1380
|
+
xxs: "4px",
|
|
1381
|
+
xs: "8px",
|
|
1382
|
+
sm: "16px",
|
|
1383
|
+
md: "24px",
|
|
1384
|
+
lg: "32px",
|
|
1385
|
+
max: "999px"
|
|
1386
|
+
},
|
|
1387
|
+
playful: {
|
|
1388
|
+
none: "none",
|
|
1389
|
+
xxs: "8px",
|
|
1390
|
+
xs: "16px",
|
|
1391
|
+
sm: "24px",
|
|
1392
|
+
md: "32px",
|
|
1393
|
+
lg: "48px",
|
|
1394
|
+
max: "9999px"
|
|
1395
|
+
}
|
|
1396
|
+
};
|
|
1397
|
+
/** Shortest angular distance between two hue angles, in degrees (0–180). */
|
|
1398
|
+
var hueDistance = (a, b) => {
|
|
1399
|
+
const d = Math.abs(a - b) % 360;
|
|
1400
|
+
return d > 180 ? 360 - d : d;
|
|
1401
|
+
};
|
|
1402
|
+
/**
|
|
1403
|
+
* Classify 2–3 brand hues against {@link ColorScheme} by their angular
|
|
1404
|
+
* distances from the primary hue. Heuristic bands, widest match wins.
|
|
1405
|
+
*/
|
|
1406
|
+
var classifyScheme = (primaryHue, otherHues) => {
|
|
1407
|
+
const distances = otherHues.map((h) => hueDistance(primaryHue, h));
|
|
1408
|
+
if (distances.length === 0) return "analogous";
|
|
1409
|
+
if (distances.every((d) => d < 15)) return "monochromatic";
|
|
1410
|
+
if (distances.every((d) => d <= 65)) return "analogous";
|
|
1411
|
+
if (distances.some((d) => d >= 165)) return "complimentary";
|
|
1412
|
+
if (distances.length > 1 && distances.every((d) => d >= 130)) return "splitComplimentary";
|
|
1413
|
+
return "triadic";
|
|
1414
|
+
};
|
|
1415
|
+
/**
|
|
1416
|
+
* Infer a tonal category from the seed's own chroma, so an unstated "vibe"
|
|
1417
|
+
* preserves the brand's character — vivid stays vivid, muted stays muted.
|
|
1418
|
+
*/
|
|
1419
|
+
var inferCategory = (seedHex) => {
|
|
1420
|
+
const { c } = hexToOklch(seedHex);
|
|
1421
|
+
if (c >= .13) return "jewel";
|
|
1422
|
+
if (c >= .07) return "earth";
|
|
1423
|
+
if (c >= .03) return "pastel";
|
|
1424
|
+
return "neutral";
|
|
1425
|
+
};
|
|
1426
|
+
/**
|
|
1427
|
+
* The theme generation engine (PRD §3.3): brand seed(s) in, complete WCAG-AA
|
|
1428
|
+
* light+dark {@link Colors} pair out, with a machine-readable contrast report.
|
|
1429
|
+
* Pure and deterministic — identical input yields identical output.
|
|
1430
|
+
*/
|
|
1431
|
+
var generateThemes = (input) => {
|
|
1432
|
+
const seeds = (Array.isArray(input.seed) ? input.seed : [input.seed]).slice(0, 3);
|
|
1433
|
+
const [primary, secondary, tertiary] = seeds;
|
|
1434
|
+
const scheme = input.scheme ?? (seeds.length > 1 ? classifyScheme(hexToOklch(primary).h, seeds.slice(1).map((s) => hexToOklch(s).h)) : "analogous");
|
|
1435
|
+
const category = input.vibe ?? inferCategory(primary);
|
|
1436
|
+
const applyVibe = (hex) => {
|
|
1437
|
+
if (!input.vibe) return hex;
|
|
1438
|
+
const color = hexToOklch(hex);
|
|
1439
|
+
return oklchToHex({
|
|
1440
|
+
...color,
|
|
1441
|
+
c: Math.min(color.c, CategoryChroma[input.vibe])
|
|
1442
|
+
});
|
|
1443
|
+
};
|
|
1444
|
+
const targets = { primary: applyVibe(primary) };
|
|
1445
|
+
if (secondary) targets.secondary = applyVibe(secondary);
|
|
1446
|
+
if (tertiary) targets.tertiary = applyVibe(tertiary);
|
|
1447
|
+
const checks = [];
|
|
1448
|
+
const base = {
|
|
1449
|
+
seed: primary,
|
|
1450
|
+
scheme,
|
|
1451
|
+
category,
|
|
1452
|
+
targets,
|
|
1453
|
+
checks
|
|
1454
|
+
};
|
|
1455
|
+
const lightColors = generateColors({
|
|
1456
|
+
...base,
|
|
1457
|
+
mode: "light"
|
|
1458
|
+
});
|
|
1459
|
+
const darkColors = generateColors({
|
|
1460
|
+
...base,
|
|
1461
|
+
mode: "dark"
|
|
1462
|
+
});
|
|
1463
|
+
const worstRatio = checks.reduce((worst, check) => Math.min(worst, check.ratio), 21);
|
|
1464
|
+
return {
|
|
1465
|
+
lightColors,
|
|
1466
|
+
darkColors,
|
|
1467
|
+
radii: input.shape ? ShapeRadii[input.shape] : void 0,
|
|
1468
|
+
report: {
|
|
1469
|
+
checks,
|
|
1470
|
+
worstRatio,
|
|
1471
|
+
pass: checks.every((check) => check.pass)
|
|
1472
|
+
}
|
|
1473
|
+
};
|
|
1474
|
+
};
|
|
1475
|
+
/**
|
|
1476
|
+
* Convenience wrapper: {@link generateThemes} piped through `createTheme()`,
|
|
1477
|
+
* returning a registration-ready light/dark {@link UniTheme} pair.
|
|
1478
|
+
*/
|
|
1479
|
+
var generateUniThemes = (input) => {
|
|
1480
|
+
const { lightColors, darkColors, radii } = generateThemes(input);
|
|
1481
|
+
const name = input.name ?? "Brand";
|
|
1482
|
+
const id = name.replace(/\W+/g, "") || "Brand";
|
|
1483
|
+
return {
|
|
1484
|
+
light: createTheme({
|
|
1485
|
+
id: `${id}Light`,
|
|
1486
|
+
name: `${name} Light`,
|
|
1487
|
+
colors: lightColors,
|
|
1488
|
+
radii
|
|
1489
|
+
}),
|
|
1490
|
+
dark: createTheme({
|
|
1491
|
+
id: `${id}Dark`,
|
|
1492
|
+
name: `${name} Dark`,
|
|
1493
|
+
colors: darkColors,
|
|
1494
|
+
radii
|
|
1495
|
+
})
|
|
1496
|
+
};
|
|
1497
|
+
};
|
|
1498
|
+
//#endregion
|
|
1499
|
+
//#region src/concepts/generation/theme-file.emitter.ts
|
|
1500
|
+
var IDENT = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
1501
|
+
var asKey = (k) => IDENT.test(k) ? k : `'${k}'`;
|
|
1502
|
+
var recordLiteral = (record, indent) => Object.entries(record).map(([k, v]) => `${indent}${asKey(k)}: '${v}',`).join("\n");
|
|
1503
|
+
var bordersLiteral = () => [
|
|
1504
|
+
"/**",
|
|
1505
|
+
" * Named border primitives. These mirror the derived defaults — edit them, or",
|
|
1506
|
+
" * add your own under any token name and point component options (or the",
|
|
1507
|
+
" * `components` overrides below) at it. Every component deriving from a",
|
|
1508
|
+
" * shared token picks up the change.",
|
|
1509
|
+
" */",
|
|
1510
|
+
"const borders = (colors: Colors): Borders => ({",
|
|
1511
|
+
" primary: `1px solid ${colors.primary}`,",
|
|
1512
|
+
" secondary: `1px solid ${colors.secondary}`,",
|
|
1513
|
+
" tertiary: `1px solid ${colors.tertiary}`,",
|
|
1514
|
+
" quaternary: `1px solid ${colors.quaternary}`,",
|
|
1515
|
+
" warn: `1px solid ${colors.warn}`,",
|
|
1516
|
+
" success: `1px solid ${colors.success}`,",
|
|
1517
|
+
" light: `1px solid ${colors.outline}`,",
|
|
1518
|
+
" dark: `1px solid ${colors['on-background']}`,",
|
|
1519
|
+
" dotted: `1px dotted ${colors['on-background']}`,",
|
|
1520
|
+
"});"
|
|
1521
|
+
].join("\n");
|
|
1522
|
+
var themeExport = (exportName, displayName, colorsConst, radii) => [
|
|
1523
|
+
`export const ${exportName}: UniTheme = createTheme({`,
|
|
1524
|
+
` id: '${exportName}',`,
|
|
1525
|
+
` name: '${displayName}',`,
|
|
1526
|
+
` colors: ${colorsConst},`,
|
|
1527
|
+
` borders: borders(${colorsConst}),`,
|
|
1528
|
+
` components: components(${colorsConst}),`,
|
|
1529
|
+
...radii ? [" radii,"] : [],
|
|
1530
|
+
"});"
|
|
1531
|
+
].join("\n");
|
|
1532
|
+
/**
|
|
1533
|
+
* Render a static `uni-theme.ts` from a brand seed — the file the `ng add`
|
|
1534
|
+
* schematic writes and the MCP `generate_uni_theme` tool returns.
|
|
1535
|
+
*
|
|
1536
|
+
* The file is the system's **source of truth**: literal colors, the border
|
|
1537
|
+
* primitives spelled out, and a sparse `components` override section — so a
|
|
1538
|
+
* human (or an AI agent) can retheme by editing tokens in place, with no
|
|
1539
|
+
* runtime generation. Deterministic: same input, same file.
|
|
1540
|
+
*/
|
|
1541
|
+
var emitThemeFile = (input) => {
|
|
1542
|
+
const { darkMode = true, name = "Brand" } = input;
|
|
1543
|
+
const { lightColors, darkColors, radii, report } = generateThemes(input);
|
|
1544
|
+
const id = name.replace(/\W+/g, "") || "Brand";
|
|
1545
|
+
const regenerate = [
|
|
1546
|
+
`--brand=${(Array.isArray(input.seed) ? input.seed : [input.seed]).join(",")}`,
|
|
1547
|
+
input.vibe && `--vibe=${input.vibe}`,
|
|
1548
|
+
input.scheme && `--scheme=${input.scheme}`,
|
|
1549
|
+
input.shape && `--shape=${input.shape}`,
|
|
1550
|
+
!darkMode && "--dark-mode=false"
|
|
1551
|
+
].filter(Boolean).join(" ");
|
|
1552
|
+
const reportSummary = `${report.checks.length} contrast pairs checked · worst ${report.worstRatio}:1 · ${report.pass ? "all AA" : `${report.checks.filter((c) => !c.pass).length} failing`}`;
|
|
1553
|
+
const modes = [{
|
|
1554
|
+
exportName: `${id}Light`,
|
|
1555
|
+
displayName: `${name} Light`,
|
|
1556
|
+
colorsConst: "lightColors",
|
|
1557
|
+
colors: lightColors
|
|
1558
|
+
}, ...darkMode ? [{
|
|
1559
|
+
exportName: `${id}Dark`,
|
|
1560
|
+
displayName: `${name} Dark`,
|
|
1561
|
+
colorsConst: "darkColors",
|
|
1562
|
+
colors: darkColors
|
|
1563
|
+
}] : []];
|
|
1564
|
+
return {
|
|
1565
|
+
content: [
|
|
1566
|
+
"/**",
|
|
1567
|
+
` * ${name} theme for Uni — generated data, yours to edit.`,
|
|
1568
|
+
" *",
|
|
1569
|
+
` * Regenerate colors: ng add @uni-design-system/uni-angular ${regenerate}`,
|
|
1570
|
+
" * (or the `generate-uni-theme` MCP tool). Edits are never overwritten silently —",
|
|
1571
|
+
" * regeneration rewrites this file, so commit before regenerating.",
|
|
1572
|
+
` * ${reportSummary}.`,
|
|
1573
|
+
" */",
|
|
1574
|
+
"import {",
|
|
1575
|
+
" createTheme,",
|
|
1576
|
+
" type Borders,",
|
|
1577
|
+
" type Colors,",
|
|
1578
|
+
" type ComponentThemes,",
|
|
1579
|
+
" type UniTheme,",
|
|
1580
|
+
"} from '@uni-design-system/uni-core';",
|
|
1581
|
+
"",
|
|
1582
|
+
...modes.map(({ colorsConst, colors }) => `const ${colorsConst}: Colors = {\n${recordLiteral(colors, " ")}\n};\n`),
|
|
1583
|
+
bordersLiteral(),
|
|
1584
|
+
"",
|
|
1585
|
+
"/**",
|
|
1586
|
+
" * Sparse component overrides, deep-merged over Uni component defaults: only",
|
|
1587
|
+
" * what you write here changes. Point components at your own primitives, e.g.:",
|
|
1588
|
+
" * button: { variants: { secondary: { border: `2px dashed ${colors.tertiary}` } } },",
|
|
1589
|
+
" * input: { options: { borderRadius: 'max' } },",
|
|
1590
|
+
" */",
|
|
1591
|
+
"const components = (colors: Colors): ComponentThemes => ({});",
|
|
1592
|
+
"",
|
|
1593
|
+
...radii ? [
|
|
1594
|
+
`/** Shape language: '${input.shape}'. */`,
|
|
1595
|
+
`const radii = {\n${recordLiteral(radii, " ")}\n};`,
|
|
1596
|
+
""
|
|
1597
|
+
] : [],
|
|
1598
|
+
...modes.map(({ exportName, displayName, colorsConst }) => `${themeExport(exportName, displayName, colorsConst, !!radii)}\n`),
|
|
1599
|
+
"/** First key wins as the default theme when registered via UNI_THEMES. */",
|
|
1600
|
+
`export const ${id}Themes = { ${modes.map((m) => m.exportName).join(", ")} };`,
|
|
1601
|
+
""
|
|
1602
|
+
].join("\n"),
|
|
1603
|
+
providerSnippet: [
|
|
1604
|
+
`import { UNI_THEMES } from '@uni-design-system/uni-angular';`,
|
|
1605
|
+
`import { ${id}Themes } from './uni-theme';`,
|
|
1606
|
+
"",
|
|
1607
|
+
"// app.config.ts → providers:",
|
|
1608
|
+
`{ provide: UNI_THEMES, useValue: ${id}Themes },`
|
|
1609
|
+
].join("\n"),
|
|
1610
|
+
report,
|
|
1611
|
+
reportSummary
|
|
1612
|
+
};
|
|
1613
|
+
};
|
|
1614
|
+
//#endregion
|
|
190
1615
|
//#region src/concepts/gradient/gradient.helper.ts
|
|
191
1616
|
function gradient(config) {
|
|
192
1617
|
return ``;
|
|
@@ -286,781 +1711,34 @@ var ShadowCssMap = {
|
|
|
286
1711
|
modal: GetBoxShadows(ShadowMap["modal"])
|
|
287
1712
|
};
|
|
288
1713
|
//#endregion
|
|
289
|
-
//#region src/concepts/
|
|
290
|
-
var
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
onLight: "#18181B",
|
|
299
|
-
onLightVariant: "rgba(24, 24, 27, 0.6)",
|
|
300
|
-
dark: "#18181B",
|
|
301
|
-
onDark: "rgba(255, 255, 255, 0.85)",
|
|
302
|
-
background: "#FFFFFF",
|
|
303
|
-
disabled: "rgba(24, 24, 27, 0.08)",
|
|
304
|
-
onDisabled: "rgba(24, 24, 27, 0.4)"
|
|
305
|
-
};
|
|
306
|
-
//#endregion
|
|
307
|
-
//#region src/concepts/theme/themes/base.theme.ts
|
|
308
|
-
var BaseButton = {
|
|
309
|
-
borderRadius: 100,
|
|
310
|
-
color: "primary-container",
|
|
311
|
-
contentColor: "on-primary-container",
|
|
312
|
-
verticalPadding: {
|
|
313
|
-
xxs: 2,
|
|
314
|
-
xs: 5,
|
|
315
|
-
sm: 8,
|
|
316
|
-
md: 12,
|
|
317
|
-
lg: 16,
|
|
318
|
-
xl: 20,
|
|
319
|
-
xxl: 24
|
|
320
|
-
},
|
|
321
|
-
horizontalPadding: {
|
|
322
|
-
xxs: 4,
|
|
323
|
-
xs: 8,
|
|
324
|
-
sm: 12,
|
|
325
|
-
md: 18,
|
|
326
|
-
lg: 24,
|
|
327
|
-
xl: 30,
|
|
328
|
-
xxl: 36
|
|
329
|
-
}
|
|
330
|
-
};
|
|
331
|
-
var BaseContainer = {
|
|
332
|
-
color: "primary-container",
|
|
333
|
-
contentColor: "on-primary-container",
|
|
334
|
-
borderRadii: {
|
|
335
|
-
xxs: 4,
|
|
336
|
-
xs: 8,
|
|
337
|
-
sm: 12,
|
|
338
|
-
md: 16,
|
|
339
|
-
lg: 20,
|
|
340
|
-
xl: 24,
|
|
341
|
-
xxl: 28
|
|
342
|
-
},
|
|
343
|
-
horizontalPadding: {
|
|
344
|
-
xxs: 6,
|
|
345
|
-
xs: 12,
|
|
346
|
-
sm: 18,
|
|
347
|
-
md: 24,
|
|
348
|
-
lg: 30,
|
|
349
|
-
xl: 36,
|
|
350
|
-
xxl: 42
|
|
351
|
-
},
|
|
352
|
-
contentSpacing: {
|
|
353
|
-
xxs: 4,
|
|
354
|
-
xs: 8,
|
|
355
|
-
sm: 12,
|
|
356
|
-
md: 16,
|
|
357
|
-
lg: 20,
|
|
358
|
-
xl: 24,
|
|
359
|
-
xxl: 28
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
var BaseTheme = {
|
|
363
|
-
id: "BaseTheme",
|
|
364
|
-
name: "Base Theme",
|
|
365
|
-
colors: {
|
|
366
|
-
primary: "#6750A4",
|
|
367
|
-
"on-primary": "#FFFFFF",
|
|
368
|
-
"primary-container": "#EADDFF",
|
|
369
|
-
"on-primary-container": "#21005E",
|
|
370
|
-
secondary: "#625B71",
|
|
371
|
-
"on-secondary": "#FFFFFF",
|
|
372
|
-
"secondary-container": "#E8DEF8",
|
|
373
|
-
"on-secondary-container": "#1E192B",
|
|
374
|
-
tertiary: "#7D5260",
|
|
375
|
-
"on-tertiary": "#FFFFFF",
|
|
376
|
-
"tertiary-container": "#FFD8E4",
|
|
377
|
-
"on-tertiary-container": "#370B1E",
|
|
378
|
-
error: "#B3261E",
|
|
379
|
-
"on-error": "#FFFFFF",
|
|
380
|
-
"error-container": "#F9DEDC",
|
|
381
|
-
"on-error-container": "#370B1E",
|
|
382
|
-
background: "#FFFBFE",
|
|
383
|
-
"on-background": "#1C1B1F",
|
|
384
|
-
surface: "#FFFBFE",
|
|
385
|
-
"on-surface": "#1C1B1F",
|
|
386
|
-
"surface-variant": "#E7E0EC",
|
|
387
|
-
"on-surface-variant": "#49454E",
|
|
388
|
-
outline: "#79747E",
|
|
389
|
-
shadow: "#000000",
|
|
390
|
-
"surface-tint": "#6750A4",
|
|
391
|
-
"inverse-surface": "#313033",
|
|
392
|
-
"on-inverse-surface": "#F4EFF4",
|
|
393
|
-
"on-inverse-surface-primary": "#D0BCFF",
|
|
394
|
-
scrim: "#000000",
|
|
395
|
-
transparent: "rgba(0,0,0,0)",
|
|
396
|
-
"primary-surface": genericLightTheme.background,
|
|
397
|
-
"on-primary-surface": genericLightTheme.onLight,
|
|
398
|
-
"on-primary-surface-variant": genericLightTheme.primary
|
|
399
|
-
},
|
|
400
|
-
typography: {
|
|
401
|
-
"display-large": {
|
|
402
|
-
fontFamily: "Red Hat Display",
|
|
403
|
-
fontSize: 57,
|
|
404
|
-
lineHeight: 64,
|
|
405
|
-
fontWeight: "normal",
|
|
406
|
-
letterSpacing: -.25
|
|
407
|
-
},
|
|
408
|
-
"display-medium": {
|
|
409
|
-
fontFamily: "Red Hat Display",
|
|
410
|
-
fontSize: 45,
|
|
411
|
-
lineHeight: 52,
|
|
412
|
-
fontWeight: "normal"
|
|
413
|
-
},
|
|
414
|
-
"display-small": {
|
|
415
|
-
fontFamily: "Red Hat Display",
|
|
416
|
-
fontSize: 36,
|
|
417
|
-
lineHeight: 44,
|
|
418
|
-
fontWeight: "normal"
|
|
419
|
-
},
|
|
420
|
-
"headline-large": {
|
|
421
|
-
fontFamily: "Red Hat Display",
|
|
422
|
-
fontSize: 32,
|
|
423
|
-
lineHeight: 40,
|
|
424
|
-
fontWeight: "normal"
|
|
425
|
-
},
|
|
426
|
-
"headline-medium": {
|
|
427
|
-
fontFamily: "Red Hat Display",
|
|
428
|
-
fontSize: 28,
|
|
429
|
-
lineHeight: 36,
|
|
430
|
-
fontWeight: "normal"
|
|
431
|
-
},
|
|
432
|
-
"headline-small": {
|
|
433
|
-
fontFamily: "Red Hat Display",
|
|
434
|
-
fontSize: 24,
|
|
435
|
-
lineHeight: 32,
|
|
436
|
-
fontWeight: "normal"
|
|
437
|
-
},
|
|
438
|
-
"title-large": {
|
|
439
|
-
fontFamily: "Red Hat Display",
|
|
440
|
-
fontSize: 22,
|
|
441
|
-
lineHeight: 28,
|
|
442
|
-
fontWeight: "normal"
|
|
443
|
-
},
|
|
444
|
-
"title-medium": {
|
|
445
|
-
fontFamily: "Red Hat Display",
|
|
446
|
-
fontSize: 16,
|
|
447
|
-
lineHeight: 24,
|
|
448
|
-
fontWeight: "medium",
|
|
449
|
-
letterSpacing: .15
|
|
450
|
-
},
|
|
451
|
-
"title-small": {
|
|
452
|
-
fontFamily: "Red Hat Display",
|
|
453
|
-
fontWeight: "medium",
|
|
454
|
-
fontSize: 14,
|
|
455
|
-
lineHeight: 20,
|
|
456
|
-
letterSpacing: .1
|
|
457
|
-
},
|
|
458
|
-
"body-1-long": {
|
|
459
|
-
fontFamily: "Roboto",
|
|
460
|
-
fontSize: 16,
|
|
461
|
-
lineHeight: 22
|
|
462
|
-
},
|
|
463
|
-
"body-1-short": {
|
|
464
|
-
fontFamily: "Roboto",
|
|
465
|
-
fontSize: 16,
|
|
466
|
-
lineHeight: 24
|
|
467
|
-
},
|
|
468
|
-
"body-2-long": {
|
|
469
|
-
fontFamily: "Roboto",
|
|
470
|
-
fontSize: 14,
|
|
471
|
-
lineHeight: 18
|
|
472
|
-
},
|
|
473
|
-
"body-2-short": {
|
|
474
|
-
fontFamily: "Roboto",
|
|
475
|
-
fontSize: 14,
|
|
476
|
-
lineHeight: 20
|
|
477
|
-
},
|
|
478
|
-
"subtitle-1": {
|
|
479
|
-
fontFamily: "Red Hat Display",
|
|
480
|
-
fontSize: 16,
|
|
481
|
-
lineHeight: 24,
|
|
482
|
-
letterSpacing: .15
|
|
483
|
-
},
|
|
484
|
-
"subtitle-2": {
|
|
485
|
-
fontFamily: "Red Hat Display",
|
|
486
|
-
fontSize: 14,
|
|
487
|
-
lineHeight: 20,
|
|
488
|
-
fontWeight: "medium",
|
|
489
|
-
letterSpacing: .1
|
|
490
|
-
},
|
|
491
|
-
label: {
|
|
492
|
-
fontFamily: "Roboto",
|
|
493
|
-
fontSize: 14,
|
|
494
|
-
lineHeight: 20
|
|
495
|
-
},
|
|
496
|
-
button: {
|
|
497
|
-
fontFamily: "Red Hat Display",
|
|
498
|
-
fontSize: 14,
|
|
499
|
-
lineHeight: 20,
|
|
500
|
-
fontWeight: "medium",
|
|
501
|
-
textTransform: "capitalize"
|
|
502
|
-
},
|
|
503
|
-
caption: {
|
|
504
|
-
fontFamily: "Roboto",
|
|
505
|
-
fontSize: 12,
|
|
506
|
-
lineHeight: 18,
|
|
507
|
-
letterSpacing: .4
|
|
508
|
-
},
|
|
509
|
-
overline: {
|
|
510
|
-
fontFamily: "Red Hat Display",
|
|
511
|
-
fontSize: 10,
|
|
512
|
-
lineHeight: 18,
|
|
513
|
-
letterSpacing: 1.5,
|
|
514
|
-
textTransform: "uppercase"
|
|
515
|
-
},
|
|
516
|
-
paragraph: {
|
|
517
|
-
fontFamily: "Roboto",
|
|
518
|
-
fontSize: 16,
|
|
519
|
-
lineHeight: 24
|
|
520
|
-
},
|
|
521
|
-
quote: {
|
|
522
|
-
fontFamily: "Roboto",
|
|
523
|
-
fontSize: 16,
|
|
524
|
-
lineHeight: 24
|
|
525
|
-
},
|
|
526
|
-
note: {
|
|
527
|
-
fontFamily: "Roboto",
|
|
528
|
-
fontSize: 14,
|
|
529
|
-
lineHeight: 22,
|
|
530
|
-
fontStyle: "italic"
|
|
531
|
-
}
|
|
532
|
-
},
|
|
533
|
-
borders: {
|
|
534
|
-
primary: `1px solid ${genericLightTheme.primary}`,
|
|
535
|
-
secondary: `1px solid ${genericLightTheme.secondary}`,
|
|
536
|
-
tertiary: `1px solid ${genericLightTheme.tertiary}`,
|
|
537
|
-
quaternary: `1px solid ${genericLightTheme.quaternary}`,
|
|
538
|
-
warn: `1px solid ${genericLightTheme.warn}`,
|
|
539
|
-
success: `1px solid ${genericLightTheme.secondary}`,
|
|
540
|
-
light: `1px solid ${genericLightTheme.light}`,
|
|
541
|
-
dark: `1px solid ${genericLightTheme.dark}`,
|
|
542
|
-
dotted: `1px dotted ${genericLightTheme.dark}`
|
|
543
|
-
},
|
|
544
|
-
shadows: {
|
|
545
|
-
raised: "rgba(0, 0, 0, 0.2) 0px 2px 1px -1px, rgba(0, 0, 0, 0.14) 0px 1px 1px 0px, rgba(0, 0, 0, 0.12) 0px 1px 3px 0px",
|
|
546
|
-
menu: "rgba(0, 0, 0, 0.2) 0px 3px 3px -2px, rgba(0, 0, 0, 0.14) 0px 3px 4px 0px, rgba(0, 0, 0, 0.12) 0px 1px 8px 0px;",
|
|
547
|
-
dialog: "rgba(0, 0, 0, 0.2) 0px 3px 5px -1px, rgba(0, 0, 0, 0.14) 0px 6px 10px 0px, rgba(0, 0, 0, 0.12) 0px 1px 18px 0px",
|
|
548
|
-
warn: "0 0 5px rgba(255, 0, 0, 0.5), inset 0 0 5px rgba(255, 0, 0, 0.3)"
|
|
549
|
-
},
|
|
550
|
-
spacing: {
|
|
551
|
-
none: "none",
|
|
552
|
-
xxs: "2px",
|
|
553
|
-
xs: "4px",
|
|
554
|
-
sm: "8px",
|
|
555
|
-
md: "16px",
|
|
556
|
-
lg: "32px",
|
|
557
|
-
xl: "64px"
|
|
558
|
-
},
|
|
559
|
-
thicknesses: {
|
|
560
|
-
thin: 1,
|
|
561
|
-
standard: 2,
|
|
562
|
-
thick: 4
|
|
563
|
-
},
|
|
564
|
-
radii: {
|
|
565
|
-
none: "none",
|
|
566
|
-
xxs: "4px",
|
|
567
|
-
xs: "8px",
|
|
568
|
-
sm: "16px",
|
|
569
|
-
md: "24px",
|
|
570
|
-
lg: "32px",
|
|
571
|
-
max: "999px"
|
|
572
|
-
},
|
|
573
|
-
buttons: {
|
|
574
|
-
elevated: {
|
|
575
|
-
...BaseButton,
|
|
576
|
-
color: "surface",
|
|
577
|
-
contentColor: "on-surface",
|
|
578
|
-
shadowElevation: "raised"
|
|
579
|
-
},
|
|
580
|
-
filled: {
|
|
581
|
-
...BaseButton,
|
|
582
|
-
color: "primary"
|
|
583
|
-
},
|
|
584
|
-
"filled-secondary": {
|
|
585
|
-
...BaseButton,
|
|
586
|
-
color: "secondary",
|
|
587
|
-
contentColor: "on-secondary"
|
|
588
|
-
},
|
|
589
|
-
outlined: {
|
|
590
|
-
...BaseButton,
|
|
591
|
-
color: "transparent",
|
|
592
|
-
borderColor: "primary",
|
|
593
|
-
contentColor: "on-primary",
|
|
594
|
-
borderWidth: 1
|
|
595
|
-
},
|
|
596
|
-
text: {
|
|
597
|
-
...BaseButton,
|
|
598
|
-
color: "transparent",
|
|
599
|
-
contentColor: "on-surface"
|
|
600
|
-
},
|
|
601
|
-
icon: {
|
|
602
|
-
...BaseButton,
|
|
603
|
-
color: "transparent",
|
|
604
|
-
contentColor: "on-surface",
|
|
605
|
-
horizontalPadding: BaseButton.verticalPadding
|
|
606
|
-
},
|
|
607
|
-
"floating-action": {
|
|
608
|
-
...BaseButton,
|
|
609
|
-
color: "secondary",
|
|
610
|
-
contentColor: "on-secondary",
|
|
611
|
-
borderRadii: {
|
|
612
|
-
xxs: 3,
|
|
613
|
-
xs: 5,
|
|
614
|
-
sm: 8,
|
|
615
|
-
md: 12,
|
|
616
|
-
lg: 16,
|
|
617
|
-
xl: 12,
|
|
618
|
-
xxl: 20
|
|
619
|
-
},
|
|
620
|
-
shadowElevation: "navigation",
|
|
621
|
-
verticalPadding: {
|
|
622
|
-
xxs: 4,
|
|
623
|
-
xs: 8,
|
|
624
|
-
sm: 12,
|
|
625
|
-
md: 18,
|
|
626
|
-
lg: 24,
|
|
627
|
-
xl: 30,
|
|
628
|
-
xxl: 36
|
|
629
|
-
},
|
|
630
|
-
horizontalPadding: {
|
|
631
|
-
xxs: 4,
|
|
632
|
-
xs: 8,
|
|
633
|
-
sm: 12,
|
|
634
|
-
md: 18,
|
|
635
|
-
lg: 24,
|
|
636
|
-
xl: 30,
|
|
637
|
-
xxl: 36
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
},
|
|
641
|
-
containers: {
|
|
642
|
-
card: {
|
|
643
|
-
...BaseContainer,
|
|
644
|
-
color: "surface",
|
|
645
|
-
contentColor: "on-surface",
|
|
646
|
-
shadowMode: "interactive"
|
|
647
|
-
},
|
|
648
|
-
screen: {
|
|
649
|
-
...BaseContainer,
|
|
650
|
-
color: "background",
|
|
651
|
-
contentColor: "on-background"
|
|
652
|
-
},
|
|
653
|
-
modal: {
|
|
654
|
-
...BaseContainer,
|
|
655
|
-
borderRadii: {
|
|
656
|
-
xxs: 8,
|
|
657
|
-
xs: 16,
|
|
658
|
-
sm: 22,
|
|
659
|
-
md: 28,
|
|
660
|
-
lg: 32,
|
|
661
|
-
xl: 38,
|
|
662
|
-
xxl: 44
|
|
663
|
-
},
|
|
664
|
-
color: "surface",
|
|
665
|
-
contentColor: "on-surface",
|
|
666
|
-
shadowMode: "static",
|
|
667
|
-
shadowElevation: "modal",
|
|
668
|
-
maxWidth: 560
|
|
669
|
-
}
|
|
670
|
-
},
|
|
671
|
-
typefaces: {},
|
|
672
|
-
icons: {},
|
|
673
|
-
components: {
|
|
674
|
-
alert: { options: {
|
|
675
|
-
topPosition: 40,
|
|
676
|
-
borderRadius: "sm",
|
|
677
|
-
transitionSpeed: .35,
|
|
678
|
-
elevation: "md"
|
|
679
|
-
} },
|
|
680
|
-
checkbox: { options: { size: 20 } },
|
|
681
|
-
dialog: { options: {
|
|
682
|
-
borderRadius: "lg",
|
|
683
|
-
color: "primary-surface",
|
|
684
|
-
border: "quaternary",
|
|
685
|
-
padding: "sm",
|
|
686
|
-
elevation: "dialog",
|
|
687
|
-
backdrop: {
|
|
688
|
-
background: "rgba(255, 255, 255, 0.6)",
|
|
689
|
-
backdropFilter: "blur(2px)"
|
|
690
|
-
}
|
|
691
|
-
} },
|
|
692
|
-
dialogHeader: { options: {
|
|
693
|
-
borderRadius: "max",
|
|
694
|
-
color: "primary",
|
|
695
|
-
height: 48,
|
|
696
|
-
textRole: "title-large",
|
|
697
|
-
textAlign: "center",
|
|
698
|
-
closeButtonIcon: "close",
|
|
699
|
-
closeButtonSize: "md"
|
|
700
|
-
} },
|
|
701
|
-
dropdown: { options: {
|
|
702
|
-
border: "none",
|
|
703
|
-
borderRadius: "xxs",
|
|
704
|
-
color: "primary-surface",
|
|
705
|
-
shadow: "menu"
|
|
706
|
-
} },
|
|
707
|
-
footer: { options: {
|
|
708
|
-
height: 52,
|
|
709
|
-
color: "primary",
|
|
710
|
-
logoHeight: 18.6,
|
|
711
|
-
logoPadding: "md"
|
|
712
|
-
} },
|
|
713
|
-
input: { options: {
|
|
714
|
-
typeFace: "input",
|
|
715
|
-
color: "primary-surface",
|
|
716
|
-
textColor: "on-primary-surface",
|
|
717
|
-
disabledColor: "disabled-surface",
|
|
718
|
-
disabledTextColor: "on-disabled-surface",
|
|
719
|
-
border: "light",
|
|
720
|
-
borderRadius: "xs",
|
|
721
|
-
errorShadow: "warn",
|
|
722
|
-
errorBorder: "warn",
|
|
723
|
-
height: 32,
|
|
724
|
-
paddingLeft: "sm",
|
|
725
|
-
focusOutline: `2px solid ${genericLightTheme.primary}`,
|
|
726
|
-
focusOutlineOffset: 2
|
|
727
|
-
} },
|
|
728
|
-
multiSelectDropdown: { options: {
|
|
729
|
-
textRole: "input",
|
|
730
|
-
textColor: "on-primary-surface",
|
|
731
|
-
dividerBorder: "light",
|
|
732
|
-
searchInputBorder: "light",
|
|
733
|
-
searchInputBorderRadius: "xxs",
|
|
734
|
-
focusOutline: `2px solid ${genericLightTheme.primary}`,
|
|
735
|
-
focusOutlineOffset: 2
|
|
736
|
-
} },
|
|
737
|
-
badge: { options: { borderRadius: "xxs" } },
|
|
738
|
-
button: {
|
|
739
|
-
fixed: {
|
|
740
|
-
position: "relative",
|
|
741
|
-
overflow: "hidden",
|
|
742
|
-
outline: "0",
|
|
743
|
-
border: "0",
|
|
744
|
-
cursor: "pointer",
|
|
745
|
-
fontFamily: "Euphemia, sans-serif",
|
|
746
|
-
transition: "all 0.28s ease"
|
|
747
|
-
},
|
|
748
|
-
colors: {
|
|
749
|
-
ghost: {
|
|
750
|
-
backgroundColor: "transparent",
|
|
751
|
-
color: "currentcolor"
|
|
752
|
-
},
|
|
753
|
-
primary: {
|
|
754
|
-
backgroundColor: genericLightTheme.primary,
|
|
755
|
-
color: genericLightTheme.onDark
|
|
756
|
-
},
|
|
757
|
-
secondary: {
|
|
758
|
-
backgroundColor: genericLightTheme.secondary,
|
|
759
|
-
color: genericLightTheme.onDark
|
|
760
|
-
},
|
|
761
|
-
tertiary: {
|
|
762
|
-
backgroundColor: genericLightTheme.tertiary,
|
|
763
|
-
color: genericLightTheme.onDark
|
|
764
|
-
},
|
|
765
|
-
warn: {
|
|
766
|
-
backgroundColor: genericLightTheme.warn,
|
|
767
|
-
color: genericLightTheme.onDark
|
|
768
|
-
},
|
|
769
|
-
disabled: {
|
|
770
|
-
backgroundColor: `${genericLightTheme.disabled} !important`,
|
|
771
|
-
color: "#fff !important"
|
|
772
|
-
},
|
|
773
|
-
success: {
|
|
774
|
-
backgroundColor: genericLightTheme.success,
|
|
775
|
-
color: genericLightTheme.onDark
|
|
776
|
-
}
|
|
777
|
-
},
|
|
778
|
-
sizes: {
|
|
779
|
-
sm: {
|
|
780
|
-
height: 22,
|
|
781
|
-
borderRadius: 11,
|
|
782
|
-
fontSize: 12,
|
|
783
|
-
padding: "0 12px",
|
|
784
|
-
fontFamily: "Euphemia Bold, sans-serif",
|
|
785
|
-
fontWeight: 600
|
|
786
|
-
},
|
|
787
|
-
md: {
|
|
788
|
-
height: 26,
|
|
789
|
-
borderRadius: 13,
|
|
790
|
-
fontSize: 16,
|
|
791
|
-
padding: "0 16px"
|
|
792
|
-
},
|
|
793
|
-
lg: {
|
|
794
|
-
height: 36,
|
|
795
|
-
borderRadius: 18,
|
|
796
|
-
fontSize: 18,
|
|
797
|
-
padding: "0 18px"
|
|
798
|
-
},
|
|
799
|
-
xl: {
|
|
800
|
-
height: 48,
|
|
801
|
-
borderRadius: 24,
|
|
802
|
-
fontSize: 24,
|
|
803
|
-
padding: "0 22px"
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
},
|
|
807
|
-
iconButton: {
|
|
808
|
-
colors: {
|
|
809
|
-
ghost: {
|
|
810
|
-
backgroundColor: "transparent",
|
|
811
|
-
color: "currentcolor"
|
|
812
|
-
},
|
|
813
|
-
primary: {
|
|
814
|
-
backgroundColor: genericLightTheme.primary,
|
|
815
|
-
color: genericLightTheme.onDark
|
|
816
|
-
},
|
|
817
|
-
secondary: {
|
|
818
|
-
backgroundColor: genericLightTheme.secondary,
|
|
819
|
-
color: genericLightTheme.onDark
|
|
820
|
-
},
|
|
821
|
-
tertiary: {
|
|
822
|
-
backgroundColor: genericLightTheme.tertiary,
|
|
823
|
-
color: genericLightTheme.onDark
|
|
824
|
-
},
|
|
825
|
-
warn: {
|
|
826
|
-
backgroundColor: genericLightTheme.warn,
|
|
827
|
-
color: genericLightTheme.onDark
|
|
828
|
-
},
|
|
829
|
-
success: {
|
|
830
|
-
backgroundColor: genericLightTheme.success,
|
|
831
|
-
color: genericLightTheme.onDark
|
|
832
|
-
},
|
|
833
|
-
disabled: {
|
|
834
|
-
backgroundColor: "transparent !important",
|
|
835
|
-
color: "rgba(0,0,0,0.25) !important"
|
|
836
|
-
}
|
|
837
|
-
},
|
|
838
|
-
sizes: {
|
|
839
|
-
sm: {
|
|
840
|
-
height: 22,
|
|
841
|
-
minHeight: 22,
|
|
842
|
-
width: 22,
|
|
843
|
-
minWidth: 22,
|
|
844
|
-
fontSize: 18
|
|
845
|
-
},
|
|
846
|
-
md: {
|
|
847
|
-
height: 26,
|
|
848
|
-
minHeight: 26,
|
|
849
|
-
width: 26,
|
|
850
|
-
minWidth: 26,
|
|
851
|
-
fontSize: 22
|
|
852
|
-
},
|
|
853
|
-
lg: {
|
|
854
|
-
height: 36,
|
|
855
|
-
minHeight: 36,
|
|
856
|
-
width: 36,
|
|
857
|
-
minWidth: 36,
|
|
858
|
-
fontSize: 30
|
|
859
|
-
},
|
|
860
|
-
xl: {
|
|
861
|
-
height: 40,
|
|
862
|
-
minHeight: 40,
|
|
863
|
-
width: 40,
|
|
864
|
-
minWidth: 40,
|
|
865
|
-
fontSize: 34
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
},
|
|
869
|
-
progressGauge: {
|
|
870
|
-
fixed: { textFill: genericLightTheme.onLight },
|
|
871
|
-
colors: {
|
|
872
|
-
primary: {
|
|
873
|
-
backgroundColor: "#b3d4ea",
|
|
874
|
-
color: genericLightTheme.primary
|
|
875
|
-
},
|
|
876
|
-
secondary: {
|
|
877
|
-
backgroundColor: "#b3e7c2",
|
|
878
|
-
color: genericLightTheme.secondary
|
|
879
|
-
},
|
|
880
|
-
tertiary: {
|
|
881
|
-
backgroundColor: "#ffe2b3",
|
|
882
|
-
color: genericLightTheme.tertiary
|
|
883
|
-
},
|
|
884
|
-
warn: {
|
|
885
|
-
backgroundColor: "#ffc2b3",
|
|
886
|
-
color: genericLightTheme.warn
|
|
887
|
-
},
|
|
888
|
-
success: {
|
|
889
|
-
backgroundColor: "#b3e7c2",
|
|
890
|
-
color: genericLightTheme.success
|
|
891
|
-
}
|
|
892
|
-
},
|
|
893
|
-
sizes: {
|
|
894
|
-
sm: { height: "54px" },
|
|
895
|
-
md: { height: "68px" },
|
|
896
|
-
lg: { height: "82px" },
|
|
897
|
-
xl: { height: "104px" }
|
|
898
|
-
}
|
|
899
|
-
},
|
|
900
|
-
card: {
|
|
901
|
-
fixed: {
|
|
902
|
-
borderStyle: "solid",
|
|
903
|
-
borderWidth: "1px",
|
|
904
|
-
borderRadius: "8px",
|
|
905
|
-
overflow: "hidden"
|
|
906
|
-
},
|
|
907
|
-
colors: {
|
|
908
|
-
primary: {
|
|
909
|
-
borderColor: genericLightTheme.primary,
|
|
910
|
-
backgroundColor: genericLightTheme.background
|
|
911
|
-
},
|
|
912
|
-
secondary: {
|
|
913
|
-
borderColor: genericLightTheme.secondary,
|
|
914
|
-
backgroundColor: genericLightTheme.background
|
|
915
|
-
},
|
|
916
|
-
tertiary: {
|
|
917
|
-
borderColor: genericLightTheme.tertiary,
|
|
918
|
-
backgroundColor: genericLightTheme.background
|
|
919
|
-
},
|
|
920
|
-
warn: {
|
|
921
|
-
borderColor: genericLightTheme.warn,
|
|
922
|
-
backgroundColor: genericLightTheme.background
|
|
923
|
-
},
|
|
924
|
-
success: {
|
|
925
|
-
borderColor: genericLightTheme.success,
|
|
926
|
-
backgroundColor: genericLightTheme.background
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
},
|
|
930
|
-
cardHeader: {
|
|
931
|
-
fixed: { padding: "12px 24px" },
|
|
932
|
-
colors: {
|
|
933
|
-
primary: {
|
|
934
|
-
backgroundColor: genericLightTheme.primary,
|
|
935
|
-
color: genericLightTheme.onDark
|
|
936
|
-
},
|
|
937
|
-
secondary: {
|
|
938
|
-
backgroundColor: genericLightTheme.secondary,
|
|
939
|
-
color: genericLightTheme.onDark
|
|
940
|
-
},
|
|
941
|
-
tertiary: {
|
|
942
|
-
backgroundColor: genericLightTheme.tertiary,
|
|
943
|
-
color: genericLightTheme.onDark
|
|
944
|
-
},
|
|
945
|
-
warn: {
|
|
946
|
-
backgroundColor: genericLightTheme.warn,
|
|
947
|
-
color: genericLightTheme.onDark
|
|
948
|
-
},
|
|
949
|
-
success: {
|
|
950
|
-
backgroundColor: genericLightTheme.success,
|
|
951
|
-
color: genericLightTheme.onDark
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
},
|
|
955
|
-
cardContent: { fixed: { padding: "12px 24px" } },
|
|
956
|
-
dataSearch: { options: {
|
|
957
|
-
border: "light",
|
|
958
|
-
borderRadius: "xs",
|
|
959
|
-
color: "primary-surface",
|
|
960
|
-
placeholderColor: "disabled"
|
|
961
|
-
} },
|
|
962
|
-
dataTable: { options: {
|
|
963
|
-
color: "primary-surface",
|
|
964
|
-
border: "light",
|
|
965
|
-
borderRadius: "sm",
|
|
966
|
-
elevation: void 0,
|
|
967
|
-
headerPadding: "sm",
|
|
968
|
-
footerPadding: "sm",
|
|
969
|
-
thTextRole: "headline-small",
|
|
970
|
-
thColor: "primary-container",
|
|
971
|
-
thVerticalBorder: "dotted",
|
|
972
|
-
thHorizontalBorder: "light",
|
|
973
|
-
thPadding: "sm",
|
|
974
|
-
tdTextRole: "title-small",
|
|
975
|
-
tdColor: "primary-surface",
|
|
976
|
-
tdStickyColor: "primary-container",
|
|
977
|
-
tdPadding: "sm",
|
|
978
|
-
tdVerticalBorder: "dotted",
|
|
979
|
-
tdHorizontalBorder: "light",
|
|
980
|
-
rowHoverColor: "primary-container",
|
|
981
|
-
loadingOverlayColor: "scrim",
|
|
982
|
-
loadingSpinnerColor: "primary",
|
|
983
|
-
loadingSpinnerSize: 40
|
|
984
|
-
} },
|
|
985
|
-
notificationBadge: { options: {
|
|
986
|
-
borderRadius: "sm",
|
|
987
|
-
offset: -10
|
|
988
|
-
} },
|
|
989
|
-
paginator: { options: {
|
|
990
|
-
gap: "xs",
|
|
991
|
-
textRole: "label",
|
|
992
|
-
inputBorder: "light",
|
|
993
|
-
inputBorderRadius: "xs",
|
|
994
|
-
pageBorderRadius: "xs",
|
|
995
|
-
currentPageBorder: "light",
|
|
996
|
-
currentPageBorderRadius: "xs"
|
|
997
|
-
} },
|
|
998
|
-
snackbar: { options: {
|
|
999
|
-
bottomPosition: 40,
|
|
1000
|
-
transitionDelay: "0.35s",
|
|
1001
|
-
autoCloseDelay: 35e3
|
|
1002
|
-
} },
|
|
1003
|
-
symbol: { options: {
|
|
1004
|
-
fill: 0,
|
|
1005
|
-
weight: 400,
|
|
1006
|
-
grade: 0,
|
|
1007
|
-
opticalSize: 24
|
|
1008
|
-
} },
|
|
1009
|
-
toggle: { options: { size: 20 } },
|
|
1010
|
-
tooltip: { options: {
|
|
1011
|
-
border: void 0,
|
|
1012
|
-
borderRadius: "xs",
|
|
1013
|
-
shadow: "raised",
|
|
1014
|
-
color: "inverse-surface",
|
|
1015
|
-
typeface: "label"
|
|
1016
|
-
} }
|
|
1017
|
-
}
|
|
1714
|
+
//#region src/concepts/style/inputs.constants.ts
|
|
1715
|
+
var removeInputPlatformStyling = {
|
|
1716
|
+
appearance: "none",
|
|
1717
|
+
background: "none",
|
|
1718
|
+
border: "none",
|
|
1719
|
+
outline: "none",
|
|
1720
|
+
boxShadow: "none",
|
|
1721
|
+
padding: 0,
|
|
1722
|
+
width: "100%"
|
|
1018
1723
|
};
|
|
1019
1724
|
//#endregion
|
|
1020
1725
|
//#region src/concepts/theme/themes/dark.theme.ts
|
|
1021
|
-
var
|
|
1022
|
-
...
|
|
1726
|
+
var darkColors = generatePalette({
|
|
1727
|
+
...BASE_PALETTE_CONFIG,
|
|
1728
|
+
mode: "dark"
|
|
1729
|
+
});
|
|
1730
|
+
var DarkTheme = createTheme({
|
|
1023
1731
|
id: "DarkTheme",
|
|
1024
1732
|
name: "Dark Theme",
|
|
1025
|
-
colors:
|
|
1026
|
-
|
|
1027
|
-
"on-primary": "#371E73",
|
|
1028
|
-
"primary-container": "#4F378B",
|
|
1029
|
-
"on-primary-container": "#EADDFF",
|
|
1030
|
-
secondary: "#CCC2DC",
|
|
1031
|
-
"on-secondary": "#332D41",
|
|
1032
|
-
"secondary-container": "#4A4458",
|
|
1033
|
-
"on-secondary-container": "#E8DEF8",
|
|
1034
|
-
tertiary: "#EFB8C8",
|
|
1035
|
-
"on-tertiary": "#492532",
|
|
1036
|
-
"tertiary-container": "#633B48",
|
|
1037
|
-
"on-tertiary-container": "#FFD8E4",
|
|
1038
|
-
error: "#F2B8B5",
|
|
1039
|
-
"on-error": "#601410",
|
|
1040
|
-
"error-container": "#8C1D18",
|
|
1041
|
-
"on-error-container": "#F9DEDC",
|
|
1042
|
-
background: "#1C1B1F",
|
|
1043
|
-
"on-background": "#E6E1E5",
|
|
1044
|
-
surface: "#1C1B1F",
|
|
1045
|
-
"on-surface": "#E6E1E5",
|
|
1046
|
-
"surface-variant": "#49454F",
|
|
1047
|
-
"on-surface-variant": "#CAC4D0",
|
|
1048
|
-
outline: "#938F99",
|
|
1049
|
-
shadow: "#000000",
|
|
1050
|
-
"surface-tint": "#D0BCFF",
|
|
1051
|
-
"inverse-surface": "#E6E1E5",
|
|
1052
|
-
"inverse-on-surface": "#313033",
|
|
1053
|
-
"inverse-on-surface-primary": "#6750A4",
|
|
1054
|
-
transparent: "rgba(0,0,0,0)"
|
|
1055
|
-
}
|
|
1056
|
-
};
|
|
1733
|
+
colors: darkColors
|
|
1734
|
+
});
|
|
1057
1735
|
//#endregion
|
|
1058
1736
|
//#region src/concepts/theme/themes/light.theme.ts
|
|
1059
|
-
var LightTheme = {
|
|
1060
|
-
...BaseTheme,
|
|
1737
|
+
var LightTheme = createTheme({
|
|
1061
1738
|
id: "LightTheme",
|
|
1062
|
-
name: "Light Theme"
|
|
1063
|
-
|
|
1739
|
+
name: "Light Theme",
|
|
1740
|
+
colors: lightColors
|
|
1741
|
+
});
|
|
1064
1742
|
//#endregion
|
|
1065
1743
|
//#region src/concepts/theme/theme.records.ts
|
|
1066
1744
|
var UniThemes = {
|
|
@@ -1083,6 +1761,24 @@ var FontWeightMap = {
|
|
|
1083
1761
|
"extra-black": 950
|
|
1084
1762
|
};
|
|
1085
1763
|
//#endregion
|
|
1764
|
+
//#region src/concepts/typography/typeface.helpers.ts
|
|
1765
|
+
var px = (value) => `${value}px`;
|
|
1766
|
+
/**
|
|
1767
|
+
* Converts a TextStyle (numeric, design-token oriented) into a
|
|
1768
|
+
* TypeFaceDefinition (CSS-ready) so a theme's `typefaces` map can be
|
|
1769
|
+
* derived from its `typography` block instead of being duplicated.
|
|
1770
|
+
*/
|
|
1771
|
+
var toTypeface = (style) => ({
|
|
1772
|
+
fontFamily: style.fontFamily,
|
|
1773
|
+
fontSize: px(style.fontSize),
|
|
1774
|
+
lineHeight: px(style.lineHeight),
|
|
1775
|
+
...style.letterSpacing !== void 0 && { letterSpacing: px(style.letterSpacing) },
|
|
1776
|
+
...style.textTransform === "uppercase" && { textTransform: "uppercase" },
|
|
1777
|
+
...style.fontWeight !== void 0 && { fontWeight: style.fontWeight },
|
|
1778
|
+
...style.fontStyle && { fontStyle: style.fontStyle }
|
|
1779
|
+
});
|
|
1780
|
+
var toTypefaces = (typography) => Object.fromEntries(Object.entries(typography).map(([role, style]) => [role, toTypeface(style)]));
|
|
1781
|
+
//#endregion
|
|
1086
1782
|
//#region src/utils/getValue.ts
|
|
1087
1783
|
function getValue(data, path, defaultValue) {
|
|
1088
1784
|
const value = path.split(/[.[\]]/).filter(Boolean).reduce((value, key) => value?.[key], data);
|
|
@@ -1100,27 +1796,42 @@ var debounce = (callback, timeout) => {
|
|
|
1100
1796
|
};
|
|
1101
1797
|
};
|
|
1102
1798
|
//#endregion
|
|
1799
|
+
exports.BASE_PALETTE_CONFIG = BASE_PALETTE_CONFIG;
|
|
1103
1800
|
exports.BaseTheme = BaseTheme;
|
|
1801
|
+
exports.CategoryChroma = CategoryChroma;
|
|
1104
1802
|
exports.CategoryLightness = CategoryLightness;
|
|
1105
1803
|
exports.CategorySaturation = CategorySaturation;
|
|
1106
1804
|
exports.DarkTheme = DarkTheme;
|
|
1107
1805
|
exports.DefaultThemeId = DefaultThemeId;
|
|
1108
1806
|
exports.FontWeightMap = FontWeightMap;
|
|
1109
1807
|
exports.HSLAToString = HSLAToString;
|
|
1808
|
+
exports.HSLToHex = HSLToHex;
|
|
1809
|
+
exports.HSLToRGB = HSLToRGB;
|
|
1110
1810
|
exports.LightTheme = LightTheme;
|
|
1111
1811
|
exports.RGBToHSL = RGBToHSL;
|
|
1112
1812
|
exports.RGBToString = RGBToString;
|
|
1113
1813
|
exports.RoleHues = RoleHues;
|
|
1114
1814
|
exports.ShadowCssMap = ShadowCssMap;
|
|
1115
1815
|
exports.ShadowMap = ShadowMap;
|
|
1816
|
+
exports.ShapeRadii = ShapeRadii;
|
|
1116
1817
|
exports.UniThemes = UniThemes;
|
|
1117
1818
|
exports.Z_INDEX = Z_INDEX;
|
|
1819
|
+
exports.classifyScheme = classifyScheme;
|
|
1118
1820
|
exports.collapseFadeOut = collapseFadeOut;
|
|
1821
|
+
exports.contrastRatio = contrastRatio;
|
|
1822
|
+
exports.createTheme = createTheme;
|
|
1823
|
+
exports.createThemeFromPalette = createThemeFromPalette;
|
|
1119
1824
|
exports.cycle = cycle;
|
|
1825
|
+
exports.darkColors = darkColors;
|
|
1120
1826
|
exports.debounce = debounce;
|
|
1827
|
+
exports.emitThemeFile = emitThemeFile;
|
|
1121
1828
|
exports.expandFadeIn = expandFadeIn;
|
|
1122
1829
|
exports.fadeIn = fadeIn;
|
|
1123
1830
|
exports.fadeOut = fadeOut;
|
|
1831
|
+
exports.generateColors = generateColors;
|
|
1832
|
+
exports.generatePalette = generatePalette;
|
|
1833
|
+
exports.generateThemes = generateThemes;
|
|
1834
|
+
exports.generateUniThemes = generateUniThemes;
|
|
1124
1835
|
exports.getAnalogousHues = getAnalogousHues;
|
|
1125
1836
|
exports.getComplimentaryHue = getComplimentaryHue;
|
|
1126
1837
|
exports.getDeviceOrientation = getDeviceOrientation;
|
|
@@ -1129,7 +1840,19 @@ exports.getSplitComplimentaryHues = getSplitComplimentaryHues;
|
|
|
1129
1840
|
exports.getTriadicHues = getTriadicHues;
|
|
1130
1841
|
exports.getValue = getValue;
|
|
1131
1842
|
exports.gradient = gradient;
|
|
1843
|
+
exports.hexToHSL = hexToHSL;
|
|
1844
|
+
exports.hexToOklch = hexToOklch;
|
|
1845
|
+
exports.hexToRgb = hexToRgb;
|
|
1846
|
+
exports.inferCategory = inferCategory;
|
|
1847
|
+
exports.lightColors = lightColors;
|
|
1848
|
+
exports.oklchToHex = oklchToHex;
|
|
1132
1849
|
exports.randomRangeValue = randomRangeValue;
|
|
1850
|
+
exports.relativeLuminance = relativeLuminance;
|
|
1851
|
+
exports.removeInputPlatformStyling = removeInputPlatformStyling;
|
|
1852
|
+
exports.rgbToHex = rgbToHex;
|
|
1853
|
+
exports.schemeHues = schemeHues;
|
|
1854
|
+
exports.toTypeface = toTypeface;
|
|
1855
|
+
exports.toTypefaces = toTypefaces;
|
|
1133
1856
|
exports.uniColor = uniColor;
|
|
1134
1857
|
|
|
1135
1858
|
//# sourceMappingURL=index.cjs.map
|