@uni-design-system/uni-core 4.0.0 → 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 +1441 -857
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +1418 -858
- 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.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 +8 -2
- 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/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/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/package.json +5 -1
- 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,234 +239,530 @@ var RGBToHSL = ({ red, green, blue }) => {
|
|
|
174
239
|
lightness: 100 * (2 * l - s) / 2
|
|
175
240
|
};
|
|
176
241
|
};
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
var
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
};
|
|
189
|
-
//#endregion
|
|
190
|
-
//#region src/concepts/gradient/gradient.helper.ts
|
|
191
|
-
function gradient(config) {
|
|
192
|
-
return ``;
|
|
193
|
-
}
|
|
194
|
-
//#endregion
|
|
195
|
-
//#region src/concepts/layout/layout.helper.ts
|
|
196
|
-
function getDeviceSize(height, width) {
|
|
197
|
-
if (!height || !width) return "md";
|
|
198
|
-
const max = Math.max(height, width);
|
|
199
|
-
if (max <= 600) return "xs";
|
|
200
|
-
if (max <= 960) return "sm";
|
|
201
|
-
if (max <= 1264) return "md";
|
|
202
|
-
if (max <= 1904) return "lg";
|
|
203
|
-
return "xl";
|
|
204
|
-
}
|
|
205
|
-
function getDeviceOrientation(height, width) {
|
|
206
|
-
if (!height || !width) return "landscape";
|
|
207
|
-
return height > width ? "portrait" : "landscape";
|
|
208
|
-
}
|
|
209
|
-
//#endregion
|
|
210
|
-
//#region src/concepts/shadow/shadow.utils.ts
|
|
211
|
-
var GetBoxShadow = ({ offset, blur, opacity }) => {
|
|
212
|
-
return `0 ${offset}px ${blur}px rgba(0,0,0,0.${opacity})`;
|
|
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
|
+
};
|
|
213
254
|
};
|
|
214
|
-
var
|
|
215
|
-
|
|
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
|
+
};
|
|
216
292
|
};
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
var
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
offset: 1,
|
|
228
|
-
blur: 3,
|
|
229
|
-
opacity: 12
|
|
230
|
-
}
|
|
231
|
-
},
|
|
232
|
-
raised: {
|
|
233
|
-
umbra: {
|
|
234
|
-
offset: 3,
|
|
235
|
-
blur: 6,
|
|
236
|
-
opacity: 23
|
|
237
|
-
},
|
|
238
|
-
penumbra: {
|
|
239
|
-
offset: 3,
|
|
240
|
-
blur: 6,
|
|
241
|
-
opacity: 16
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
focussed: {
|
|
245
|
-
umbra: {
|
|
246
|
-
offset: 6,
|
|
247
|
-
blur: 6,
|
|
248
|
-
opacity: 23
|
|
249
|
-
},
|
|
250
|
-
penumbra: {
|
|
251
|
-
offset: 10,
|
|
252
|
-
blur: 20,
|
|
253
|
-
opacity: 19
|
|
254
|
-
}
|
|
255
|
-
},
|
|
256
|
-
navigation: {
|
|
257
|
-
umbra: {
|
|
258
|
-
offset: 10,
|
|
259
|
-
blur: 10,
|
|
260
|
-
opacity: 22
|
|
261
|
-
},
|
|
262
|
-
penumbra: {
|
|
263
|
-
offset: 14,
|
|
264
|
-
blur: 28,
|
|
265
|
-
opacity: 25
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
modal: {
|
|
269
|
-
umbra: {
|
|
270
|
-
offset: 15,
|
|
271
|
-
blur: 12,
|
|
272
|
-
opacity: 22
|
|
273
|
-
},
|
|
274
|
-
penumbra: {
|
|
275
|
-
offset: 19,
|
|
276
|
-
blur: 38,
|
|
277
|
-
opacity: 30
|
|
278
|
-
}
|
|
279
|
-
}
|
|
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);
|
|
280
303
|
};
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
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);
|
|
287
310
|
};
|
|
288
311
|
//#endregion
|
|
289
|
-
//#region src/concepts/
|
|
290
|
-
var
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
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
|
+
};
|
|
298
325
|
};
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
light: "#F4F4F5",
|
|
309
|
-
onLight: "#18181B",
|
|
310
|
-
onLightVariant: "rgba(24, 24, 27, 0.6)",
|
|
311
|
-
dark: "#18181B",
|
|
312
|
-
onDark: "rgba(255, 255, 255, 0.85)",
|
|
313
|
-
background: "#FFFFFF",
|
|
314
|
-
disabled: "rgba(24, 24, 27, 0.08)",
|
|
315
|
-
onDisabled: "rgba(24, 24, 27, 0.4)"
|
|
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
|
+
};
|
|
316
335
|
};
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
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
|
+
};
|
|
330
357
|
};
|
|
331
|
-
//#endregion
|
|
332
|
-
//#region src/concepts/typography/typeface.helpers.ts
|
|
333
|
-
var px = (value) => `${value}px`;
|
|
334
358
|
/**
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
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.
|
|
338
362
|
*/
|
|
339
|
-
var
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
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))
|
|
347
392
|
});
|
|
348
|
-
var toTypefaces = (typography) => Object.fromEntries(Object.entries(typography).map(([role, style]) => [role, toTypeface(style)]));
|
|
349
393
|
//#endregion
|
|
350
|
-
//#region src/concepts/
|
|
351
|
-
var
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
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
|
|
373
435
|
};
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
sm: 12,
|
|
381
|
-
md: 16,
|
|
382
|
-
lg: 20,
|
|
383
|
-
xl: 24,
|
|
384
|
-
xxl: 28
|
|
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
|
|
385
442
|
},
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
sm: 18,
|
|
390
|
-
md: 24,
|
|
391
|
-
lg: 30,
|
|
392
|
-
xl: 36,
|
|
393
|
-
xxl: 42
|
|
443
|
+
warn: {
|
|
444
|
+
hue: 55,
|
|
445
|
+
chroma: .18
|
|
394
446
|
},
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
sm: 12,
|
|
399
|
-
md: 16,
|
|
400
|
-
lg: 20,
|
|
401
|
-
xl: 24,
|
|
402
|
-
xxl: 28
|
|
447
|
+
success: {
|
|
448
|
+
hue: 152,
|
|
449
|
+
chroma: .16
|
|
403
450
|
}
|
|
404
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);
|
|
752
|
+
//#endregion
|
|
753
|
+
//#region src/concepts/elevation/zIndex.ts
|
|
754
|
+
var Z_INDEX = {
|
|
755
|
+
dropdown: 1e3,
|
|
756
|
+
sticky: 1020,
|
|
757
|
+
fixed: 1030,
|
|
758
|
+
backdrop: 1040,
|
|
759
|
+
dialog: 1050,
|
|
760
|
+
popover: 1060,
|
|
761
|
+
tooltip: 1070,
|
|
762
|
+
overlay: 1080
|
|
763
|
+
};
|
|
764
|
+
//#endregion
|
|
765
|
+
//#region src/concepts/theme/themes/base.theme.ts
|
|
405
766
|
var BaseTypography = {
|
|
406
767
|
"display-large": {
|
|
407
768
|
fontFamily: "Red Hat Display",
|
|
@@ -533,684 +894,851 @@ var BaseTypography = {
|
|
|
533
894
|
fontSize: 14,
|
|
534
895
|
lineHeight: 22,
|
|
535
896
|
fontStyle: "italic"
|
|
536
|
-
}
|
|
537
|
-
};
|
|
538
|
-
var BaseTheme = {
|
|
539
|
-
id: "BaseTheme",
|
|
540
|
-
name: "Base Theme",
|
|
541
|
-
colors: {
|
|
542
|
-
primary: "#6750A4",
|
|
543
|
-
"on-primary": "#FFFFFF",
|
|
544
|
-
"primary-container": "#EADDFF",
|
|
545
|
-
"on-primary-container": "#21005E",
|
|
546
|
-
secondary: "#625B71",
|
|
547
|
-
"on-secondary": "#FFFFFF",
|
|
548
|
-
"secondary-container": "#E8DEF8",
|
|
549
|
-
"on-secondary-container": "#1E192B",
|
|
550
|
-
tertiary: "#7D5260",
|
|
551
|
-
"on-tertiary": "#FFFFFF",
|
|
552
|
-
"tertiary-container": "#FFD8E4",
|
|
553
|
-
"on-tertiary-container": "#370B1E",
|
|
554
|
-
error: "#B3261E",
|
|
555
|
-
"on-error": "#FFFFFF",
|
|
556
|
-
"error-container": "#F9DEDC",
|
|
557
|
-
"on-error-container": "#370B1E",
|
|
558
|
-
background: "#FFFBFE",
|
|
559
|
-
"on-background": "#1C1B1F",
|
|
560
|
-
surface: "#FFFBFE",
|
|
561
|
-
"on-surface": "#1C1B1F",
|
|
562
|
-
"surface-variant": "#E7E0EC",
|
|
563
|
-
"on-surface-variant": "#49454E",
|
|
564
|
-
outline: "#79747E",
|
|
565
|
-
shadow: "#000000",
|
|
566
|
-
"surface-tint": "#6750A4",
|
|
567
|
-
"inverse-surface": "#313033",
|
|
568
|
-
"on-inverse-surface": "#F4EFF4",
|
|
569
|
-
"on-inverse-surface-primary": "#D0BCFF",
|
|
570
|
-
scrim: "#000000",
|
|
571
|
-
transparent: "rgba(0,0,0,0)",
|
|
572
|
-
ghost: "rgba(0,0,0,0)",
|
|
573
|
-
quaternary: "#79747E",
|
|
574
|
-
"on-quaternary": "#FFFFFF",
|
|
575
|
-
warn: "#B3261E",
|
|
576
|
-
"on-warn": "#FFFFFF",
|
|
577
|
-
success: "#2E7D32",
|
|
578
|
-
"on-success": "#FFFFFF",
|
|
579
|
-
disabled: "rgba(0,0,0,0.12)",
|
|
580
|
-
"on-disabled": "rgba(0,0,0,0.38)",
|
|
581
|
-
"on-primary-container-variant": "rgba(0,0,0,0.4)",
|
|
582
|
-
"on-primary-container-border": "#6750A4",
|
|
583
|
-
"on-secondary-container-variant": "rgba(0,0,0,0.4)",
|
|
584
|
-
"on-secondary-container-border": "#625B71",
|
|
585
|
-
"on-tertiary-container-variant": "rgba(0,0,0,0.4)",
|
|
586
|
-
"on-tertiary-container-border": "#7D5260",
|
|
587
|
-
"warn-container": "#F9DEDC",
|
|
588
|
-
"on-warn-container": "#8C1D18",
|
|
589
|
-
"on-warn-container-variant": "rgba(0,0,0,0.4)",
|
|
590
|
-
"on-warn-container-border": "#8C1D18",
|
|
591
|
-
"success-container": "#C6F0CD",
|
|
592
|
-
"on-success-container": "#1E5128",
|
|
593
|
-
"on-success-container-variant": "rgba(0,0,0,0.4)",
|
|
594
|
-
"on-success-container-border": "#1E5128",
|
|
595
|
-
"disabled-container": "#F2F2F2",
|
|
596
|
-
"on-disabled-container": "rgba(0,0,0,0.38)",
|
|
597
|
-
"inverse-container": "#313033",
|
|
598
|
-
"on-inverse-container": "#F4EFF4",
|
|
599
|
-
"primary-surface": genericLightTheme.background,
|
|
600
|
-
"on-primary-surface": genericLightTheme.onLight,
|
|
601
|
-
"on-primary-surface-variant": genericLightTheme.primary,
|
|
602
|
-
"secondary-surface": "#F3EDF7",
|
|
603
|
-
"on-secondary-surface": "#1C1B1F",
|
|
604
|
-
"on-secondary-surface-variant": "#6750A4",
|
|
605
|
-
"tertiary-surface": "#F2F2F2",
|
|
606
|
-
"on-tertiary-surface": "#1C1B1F",
|
|
607
|
-
"on-tertiary-surface-variant": "#6750A4",
|
|
608
|
-
"quaternary-surface": "#E8DEF8",
|
|
609
|
-
"on-quaternary-surface": "#1C1B1F",
|
|
610
|
-
"on-quaternary-surface-variant": "#6750A4",
|
|
611
|
-
"disabled-surface": "rgba(0,0,0,0.12)",
|
|
612
|
-
"on-disabled-surface": "rgba(0,0,0,0.5)",
|
|
613
|
-
"on-disabled-surface-variant": "rgba(0,0,0,0.4)",
|
|
614
|
-
"on-inverse-surface-variant": "#D0BCFF",
|
|
615
|
-
"on-background-variant": "#959595"
|
|
616
|
-
},
|
|
617
|
-
typography: BaseTypography,
|
|
618
|
-
borders: {
|
|
619
|
-
primary: `1px solid ${genericLightTheme.primary}`,
|
|
620
|
-
secondary: `1px solid ${genericLightTheme.secondary}`,
|
|
621
|
-
tertiary: `1px solid ${genericLightTheme.tertiary}`,
|
|
622
|
-
quaternary: `1px solid ${genericLightTheme.quaternary}`,
|
|
623
|
-
warn: `1px solid ${genericLightTheme.warn}`,
|
|
624
|
-
success: `1px solid ${genericLightTheme.secondary}`,
|
|
625
|
-
light: `1px solid ${genericLightTheme.light}`,
|
|
626
|
-
dark: `1px solid ${genericLightTheme.dark}`,
|
|
627
|
-
dotted: `1px dotted ${genericLightTheme.dark}`
|
|
628
|
-
},
|
|
629
|
-
shadows: {
|
|
630
|
-
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",
|
|
631
|
-
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;",
|
|
632
|
-
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",
|
|
633
|
-
warn: "0 0 5px rgba(255, 0, 0, 0.5), inset 0 0 5px rgba(255, 0, 0, 0.3)"
|
|
634
897
|
},
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
sm: "8px",
|
|
640
|
-
md: "16px",
|
|
641
|
-
lg: "32px",
|
|
642
|
-
xl: "64px"
|
|
643
|
-
},
|
|
644
|
-
thicknesses: {
|
|
645
|
-
thin: 1,
|
|
646
|
-
standard: 2,
|
|
647
|
-
thick: 4
|
|
898
|
+
badge: {
|
|
899
|
+
fontFamily: "Red Hat Display",
|
|
900
|
+
fontSize: 16,
|
|
901
|
+
lineHeight: 24
|
|
648
902
|
},
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
md: "24px",
|
|
655
|
-
lg: "32px",
|
|
656
|
-
max: "999px"
|
|
903
|
+
tag: {
|
|
904
|
+
fontFamily: "Red Hat Display",
|
|
905
|
+
fontSize: 15,
|
|
906
|
+
lineHeight: 20,
|
|
907
|
+
fontWeight: 600
|
|
657
908
|
},
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
xl: 30,
|
|
722
|
-
xxl: 36
|
|
723
|
-
}
|
|
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)"
|
|
724
972
|
}
|
|
725
|
-
},
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
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"
|
|
732
1029
|
},
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
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
|
+
}
|
|
737
1074
|
},
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
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"
|
|
748
1095
|
},
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
1096
|
+
xl: {
|
|
1097
|
+
height: 48,
|
|
1098
|
+
borderRadius: 24,
|
|
1099
|
+
fontSize: 24,
|
|
1100
|
+
padding: "0 22px"
|
|
1101
|
+
}
|
|
754
1102
|
}
|
|
755
1103
|
},
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
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
|
+
}
|
|
768
1134
|
},
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
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
|
+
}
|
|
773
1164
|
}
|
|
774
1165
|
},
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
elevation: "md"
|
|
782
|
-
} },
|
|
783
|
-
checkbox: { options: { size: 20 } },
|
|
784
|
-
dialog: { options: {
|
|
785
|
-
borderRadius: "lg",
|
|
786
|
-
color: "primary-surface",
|
|
787
|
-
border: "quaternary",
|
|
788
|
-
padding: "sm",
|
|
789
|
-
elevation: "dialog",
|
|
790
|
-
backdrop: {
|
|
791
|
-
background: "rgba(255, 255, 255, 0.6)",
|
|
792
|
-
backdropFilter: "blur(2px)"
|
|
793
|
-
}
|
|
794
|
-
} },
|
|
795
|
-
dialogHeader: { options: {
|
|
796
|
-
borderRadius: "max",
|
|
797
|
-
color: "primary",
|
|
798
|
-
height: 48,
|
|
799
|
-
textRole: "title-large",
|
|
800
|
-
textAlign: "center",
|
|
801
|
-
closeButtonIcon: "close",
|
|
802
|
-
closeButtonSize: "md"
|
|
803
|
-
} },
|
|
804
|
-
dropdown: { options: {
|
|
805
|
-
border: "none",
|
|
806
|
-
borderRadius: "xxs",
|
|
807
|
-
color: "primary-surface",
|
|
808
|
-
shadow: "menu"
|
|
809
|
-
} },
|
|
810
|
-
footer: { options: {
|
|
811
|
-
height: 52,
|
|
812
|
-
color: "primary",
|
|
813
|
-
logoHeight: 18.6,
|
|
814
|
-
logoPadding: "md"
|
|
815
|
-
} },
|
|
816
|
-
input: { options: {
|
|
817
|
-
typeFace: "input",
|
|
818
|
-
color: "primary-surface",
|
|
819
|
-
textColor: "on-primary-surface",
|
|
820
|
-
disabledColor: "disabled-surface",
|
|
821
|
-
disabledTextColor: "on-disabled-surface",
|
|
822
|
-
border: "light",
|
|
823
|
-
borderRadius: "xs",
|
|
824
|
-
errorShadow: "warn",
|
|
825
|
-
errorBorder: "warn",
|
|
826
|
-
height: 32,
|
|
827
|
-
paddingLeft: "sm",
|
|
828
|
-
focusOutline: `2px solid ${genericLightTheme.primary}`,
|
|
829
|
-
focusOutlineOffset: 2
|
|
830
|
-
} },
|
|
831
|
-
multiSelectDropdown: { options: {
|
|
832
|
-
textRole: "input",
|
|
833
|
-
textColor: "on-primary-surface",
|
|
834
|
-
dividerBorder: "light",
|
|
835
|
-
searchInputBorder: "light",
|
|
836
|
-
searchInputBorderRadius: "xxs",
|
|
837
|
-
focusOutline: `2px solid ${genericLightTheme.primary}`,
|
|
838
|
-
focusOutlineOffset: 2
|
|
839
|
-
} },
|
|
840
|
-
badge: { options: { borderRadius: "xxs" } },
|
|
841
|
-
button: {
|
|
842
|
-
fixed: {
|
|
843
|
-
position: "relative",
|
|
844
|
-
overflow: "hidden",
|
|
845
|
-
outline: "0",
|
|
846
|
-
border: "0",
|
|
847
|
-
cursor: "pointer",
|
|
848
|
-
fontFamily: "Euphemia, sans-serif",
|
|
849
|
-
transition: "all 0.28s ease"
|
|
1166
|
+
progressGauge: {
|
|
1167
|
+
fixed: { textFill: c["on-background"] },
|
|
1168
|
+
variants: {
|
|
1169
|
+
primary: {
|
|
1170
|
+
backgroundColor: "#b3d4ea",
|
|
1171
|
+
color: c.primary
|
|
850
1172
|
},
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
color: "currentcolor"
|
|
855
|
-
},
|
|
856
|
-
primary: {
|
|
857
|
-
backgroundColor: genericLightTheme.primary,
|
|
858
|
-
color: genericLightTheme.onDark
|
|
859
|
-
},
|
|
860
|
-
secondary: {
|
|
861
|
-
backgroundColor: genericLightTheme.secondary,
|
|
862
|
-
color: genericLightTheme.onDark
|
|
863
|
-
},
|
|
864
|
-
tertiary: {
|
|
865
|
-
backgroundColor: genericLightTheme.tertiary,
|
|
866
|
-
color: genericLightTheme.onDark
|
|
867
|
-
},
|
|
868
|
-
warn: {
|
|
869
|
-
backgroundColor: genericLightTheme.warn,
|
|
870
|
-
color: genericLightTheme.onDark
|
|
871
|
-
},
|
|
872
|
-
disabled: {
|
|
873
|
-
backgroundColor: `${genericLightTheme.disabled} !important`,
|
|
874
|
-
color: "#fff !important"
|
|
875
|
-
},
|
|
876
|
-
success: {
|
|
877
|
-
backgroundColor: genericLightTheme.success,
|
|
878
|
-
color: genericLightTheme.onDark
|
|
879
|
-
}
|
|
1173
|
+
secondary: {
|
|
1174
|
+
backgroundColor: "#b3e7c2",
|
|
1175
|
+
color: c.secondary
|
|
880
1176
|
},
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
borderRadius: 11,
|
|
885
|
-
fontSize: 12,
|
|
886
|
-
padding: "0 12px",
|
|
887
|
-
fontFamily: "Euphemia Bold, sans-serif",
|
|
888
|
-
fontWeight: 600
|
|
889
|
-
},
|
|
890
|
-
md: {
|
|
891
|
-
height: 26,
|
|
892
|
-
borderRadius: 13,
|
|
893
|
-
fontSize: 16,
|
|
894
|
-
padding: "0 16px"
|
|
895
|
-
},
|
|
896
|
-
lg: {
|
|
897
|
-
height: 36,
|
|
898
|
-
borderRadius: 18,
|
|
899
|
-
fontSize: 18,
|
|
900
|
-
padding: "0 18px"
|
|
901
|
-
},
|
|
902
|
-
xl: {
|
|
903
|
-
height: 48,
|
|
904
|
-
borderRadius: 24,
|
|
905
|
-
fontSize: 24,
|
|
906
|
-
padding: "0 22px"
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
},
|
|
910
|
-
iconButton: {
|
|
911
|
-
colors: {
|
|
912
|
-
ghost: {
|
|
913
|
-
backgroundColor: "transparent",
|
|
914
|
-
color: "currentcolor"
|
|
915
|
-
},
|
|
916
|
-
primary: {
|
|
917
|
-
backgroundColor: genericLightTheme.primary,
|
|
918
|
-
color: genericLightTheme.onDark
|
|
919
|
-
},
|
|
920
|
-
secondary: {
|
|
921
|
-
backgroundColor: genericLightTheme.secondary,
|
|
922
|
-
color: genericLightTheme.onDark
|
|
923
|
-
},
|
|
924
|
-
tertiary: {
|
|
925
|
-
backgroundColor: genericLightTheme.tertiary,
|
|
926
|
-
color: genericLightTheme.onDark
|
|
927
|
-
},
|
|
928
|
-
warn: {
|
|
929
|
-
backgroundColor: genericLightTheme.warn,
|
|
930
|
-
color: genericLightTheme.onDark
|
|
931
|
-
},
|
|
932
|
-
success: {
|
|
933
|
-
backgroundColor: genericLightTheme.success,
|
|
934
|
-
color: genericLightTheme.onDark
|
|
935
|
-
},
|
|
936
|
-
disabled: {
|
|
937
|
-
backgroundColor: "transparent !important",
|
|
938
|
-
color: "rgba(0,0,0,0.25) !important"
|
|
939
|
-
}
|
|
1177
|
+
tertiary: {
|
|
1178
|
+
backgroundColor: "#ffe2b3",
|
|
1179
|
+
color: c.tertiary
|
|
940
1180
|
},
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
},
|
|
949
|
-
md: {
|
|
950
|
-
height: 26,
|
|
951
|
-
minHeight: 26,
|
|
952
|
-
width: 26,
|
|
953
|
-
minWidth: 26,
|
|
954
|
-
fontSize: 22
|
|
955
|
-
},
|
|
956
|
-
lg: {
|
|
957
|
-
height: 36,
|
|
958
|
-
minHeight: 36,
|
|
959
|
-
width: 36,
|
|
960
|
-
minWidth: 36,
|
|
961
|
-
fontSize: 30
|
|
962
|
-
},
|
|
963
|
-
xl: {
|
|
964
|
-
height: 40,
|
|
965
|
-
minHeight: 40,
|
|
966
|
-
width: 40,
|
|
967
|
-
minWidth: 40,
|
|
968
|
-
fontSize: 34
|
|
969
|
-
}
|
|
1181
|
+
warn: {
|
|
1182
|
+
backgroundColor: "#ffc2b3",
|
|
1183
|
+
color: c.warn
|
|
1184
|
+
},
|
|
1185
|
+
success: {
|
|
1186
|
+
backgroundColor: "#b3e7c2",
|
|
1187
|
+
color: c.success
|
|
970
1188
|
}
|
|
971
1189
|
},
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
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
|
|
995
1216
|
},
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1217
|
+
warn: {
|
|
1218
|
+
borderColor: c.warn,
|
|
1219
|
+
backgroundColor: c.background
|
|
1220
|
+
},
|
|
1221
|
+
success: {
|
|
1222
|
+
borderColor: c.success,
|
|
1223
|
+
backgroundColor: c.background
|
|
1001
1224
|
}
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1225
|
+
}
|
|
1226
|
+
},
|
|
1227
|
+
cardHeader: {
|
|
1228
|
+
fixed: { padding: "12px 24px" },
|
|
1229
|
+
variants: {
|
|
1230
|
+
primary: {
|
|
1231
|
+
backgroundColor: c.primary,
|
|
1232
|
+
color: c["on-primary"]
|
|
1009
1233
|
},
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
backgroundColor: genericLightTheme.background
|
|
1026
|
-
},
|
|
1027
|
-
success: {
|
|
1028
|
-
borderColor: genericLightTheme.success,
|
|
1029
|
-
backgroundColor: genericLightTheme.background
|
|
1030
|
-
}
|
|
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"]
|
|
1031
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
|
|
1615
|
+
//#region src/concepts/gradient/gradient.helper.ts
|
|
1616
|
+
function gradient(config) {
|
|
1617
|
+
return ``;
|
|
1618
|
+
}
|
|
1619
|
+
//#endregion
|
|
1620
|
+
//#region src/concepts/layout/layout.helper.ts
|
|
1621
|
+
function getDeviceSize(height, width) {
|
|
1622
|
+
if (!height || !width) return "md";
|
|
1623
|
+
const max = Math.max(height, width);
|
|
1624
|
+
if (max <= 600) return "xs";
|
|
1625
|
+
if (max <= 960) return "sm";
|
|
1626
|
+
if (max <= 1264) return "md";
|
|
1627
|
+
if (max <= 1904) return "lg";
|
|
1628
|
+
return "xl";
|
|
1629
|
+
}
|
|
1630
|
+
function getDeviceOrientation(height, width) {
|
|
1631
|
+
if (!height || !width) return "landscape";
|
|
1632
|
+
return height > width ? "portrait" : "landscape";
|
|
1633
|
+
}
|
|
1634
|
+
//#endregion
|
|
1635
|
+
//#region src/concepts/shadow/shadow.utils.ts
|
|
1636
|
+
var GetBoxShadow = ({ offset, blur, opacity }) => {
|
|
1637
|
+
return `0 ${offset}px ${blur}px rgba(0,0,0,0.${opacity})`;
|
|
1638
|
+
};
|
|
1639
|
+
var GetBoxShadows = ({ umbra, penumbra }) => {
|
|
1640
|
+
return GetBoxShadow(umbra) + ", " + GetBoxShadow(penumbra);
|
|
1641
|
+
};
|
|
1642
|
+
//#endregion
|
|
1643
|
+
//#region src/concepts/shadow/shadow.records.ts
|
|
1644
|
+
var ShadowMap = {
|
|
1645
|
+
pressed: {
|
|
1646
|
+
umbra: {
|
|
1647
|
+
offset: 1,
|
|
1648
|
+
blur: 2,
|
|
1649
|
+
opacity: 24
|
|
1032
1650
|
},
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
tertiary: {
|
|
1045
|
-
backgroundColor: genericLightTheme.tertiary,
|
|
1046
|
-
color: genericLightTheme.onDark
|
|
1047
|
-
},
|
|
1048
|
-
warn: {
|
|
1049
|
-
backgroundColor: genericLightTheme.warn,
|
|
1050
|
-
color: genericLightTheme.onDark
|
|
1051
|
-
},
|
|
1052
|
-
success: {
|
|
1053
|
-
backgroundColor: genericLightTheme.success,
|
|
1054
|
-
color: genericLightTheme.onDark
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1651
|
+
penumbra: {
|
|
1652
|
+
offset: 1,
|
|
1653
|
+
blur: 3,
|
|
1654
|
+
opacity: 12
|
|
1655
|
+
}
|
|
1656
|
+
},
|
|
1657
|
+
raised: {
|
|
1658
|
+
umbra: {
|
|
1659
|
+
offset: 3,
|
|
1660
|
+
blur: 6,
|
|
1661
|
+
opacity: 23
|
|
1057
1662
|
},
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
offset:
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
currentPageBorderRadius: "xs"
|
|
1100
|
-
} },
|
|
1101
|
-
snackbar: { options: {
|
|
1102
|
-
bottomPosition: 40,
|
|
1103
|
-
transitionDelay: "0.35s",
|
|
1104
|
-
autoCloseDelay: 35e3
|
|
1105
|
-
} },
|
|
1106
|
-
symbol: { options: {
|
|
1107
|
-
fill: 0,
|
|
1108
|
-
weight: 400,
|
|
1109
|
-
grade: 0,
|
|
1110
|
-
opticalSize: 24
|
|
1111
|
-
} },
|
|
1112
|
-
toggle: { options: { size: 20 } },
|
|
1113
|
-
tooltip: { options: {
|
|
1114
|
-
border: void 0,
|
|
1115
|
-
borderRadius: "xs",
|
|
1116
|
-
shadow: "raised",
|
|
1117
|
-
color: "inverse-surface",
|
|
1118
|
-
typeface: "label"
|
|
1119
|
-
} }
|
|
1663
|
+
penumbra: {
|
|
1664
|
+
offset: 3,
|
|
1665
|
+
blur: 6,
|
|
1666
|
+
opacity: 16
|
|
1667
|
+
}
|
|
1668
|
+
},
|
|
1669
|
+
focussed: {
|
|
1670
|
+
umbra: {
|
|
1671
|
+
offset: 6,
|
|
1672
|
+
blur: 6,
|
|
1673
|
+
opacity: 23
|
|
1674
|
+
},
|
|
1675
|
+
penumbra: {
|
|
1676
|
+
offset: 10,
|
|
1677
|
+
blur: 20,
|
|
1678
|
+
opacity: 19
|
|
1679
|
+
}
|
|
1680
|
+
},
|
|
1681
|
+
navigation: {
|
|
1682
|
+
umbra: {
|
|
1683
|
+
offset: 10,
|
|
1684
|
+
blur: 10,
|
|
1685
|
+
opacity: 22
|
|
1686
|
+
},
|
|
1687
|
+
penumbra: {
|
|
1688
|
+
offset: 14,
|
|
1689
|
+
blur: 28,
|
|
1690
|
+
opacity: 25
|
|
1691
|
+
}
|
|
1692
|
+
},
|
|
1693
|
+
modal: {
|
|
1694
|
+
umbra: {
|
|
1695
|
+
offset: 15,
|
|
1696
|
+
blur: 12,
|
|
1697
|
+
opacity: 22
|
|
1698
|
+
},
|
|
1699
|
+
penumbra: {
|
|
1700
|
+
offset: 19,
|
|
1701
|
+
blur: 38,
|
|
1702
|
+
opacity: 30
|
|
1703
|
+
}
|
|
1120
1704
|
}
|
|
1121
1705
|
};
|
|
1706
|
+
var ShadowCssMap = {
|
|
1707
|
+
pressed: GetBoxShadows(ShadowMap["pressed"]),
|
|
1708
|
+
raised: GetBoxShadows(ShadowMap["raised"]),
|
|
1709
|
+
focussed: GetBoxShadows(ShadowMap["focussed"]),
|
|
1710
|
+
navigation: GetBoxShadows(ShadowMap["navigation"]),
|
|
1711
|
+
modal: GetBoxShadows(ShadowMap["modal"])
|
|
1712
|
+
};
|
|
1713
|
+
//#endregion
|
|
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%"
|
|
1723
|
+
};
|
|
1122
1724
|
//#endregion
|
|
1123
1725
|
//#region src/concepts/theme/themes/dark.theme.ts
|
|
1124
|
-
var
|
|
1125
|
-
...
|
|
1726
|
+
var darkColors = generatePalette({
|
|
1727
|
+
...BASE_PALETTE_CONFIG,
|
|
1728
|
+
mode: "dark"
|
|
1729
|
+
});
|
|
1730
|
+
var DarkTheme = createTheme({
|
|
1126
1731
|
id: "DarkTheme",
|
|
1127
1732
|
name: "Dark Theme",
|
|
1128
|
-
colors:
|
|
1129
|
-
|
|
1130
|
-
"on-primary": "#371E73",
|
|
1131
|
-
"primary-container": "#4F378B",
|
|
1132
|
-
"on-primary-container": "#EADDFF",
|
|
1133
|
-
secondary: "#CCC2DC",
|
|
1134
|
-
"on-secondary": "#332D41",
|
|
1135
|
-
"secondary-container": "#4A4458",
|
|
1136
|
-
"on-secondary-container": "#E8DEF8",
|
|
1137
|
-
tertiary: "#EFB8C8",
|
|
1138
|
-
"on-tertiary": "#492532",
|
|
1139
|
-
"tertiary-container": "#633B48",
|
|
1140
|
-
"on-tertiary-container": "#FFD8E4",
|
|
1141
|
-
error: "#F2B8B5",
|
|
1142
|
-
"on-error": "#601410",
|
|
1143
|
-
"error-container": "#8C1D18",
|
|
1144
|
-
"on-error-container": "#F9DEDC",
|
|
1145
|
-
background: "#1C1B1F",
|
|
1146
|
-
"on-background": "#E6E1E5",
|
|
1147
|
-
surface: "#1C1B1F",
|
|
1148
|
-
"on-surface": "#E6E1E5",
|
|
1149
|
-
"surface-variant": "#49454F",
|
|
1150
|
-
"on-surface-variant": "#CAC4D0",
|
|
1151
|
-
outline: "#938F99",
|
|
1152
|
-
shadow: "#000000",
|
|
1153
|
-
"surface-tint": "#D0BCFF",
|
|
1154
|
-
"inverse-surface": "#E6E1E5",
|
|
1155
|
-
"inverse-on-surface": "#313033",
|
|
1156
|
-
"inverse-on-surface-primary": "#6750A4",
|
|
1157
|
-
"on-inverse-surface": "#313033",
|
|
1158
|
-
"on-inverse-surface-primary": "#6750A4",
|
|
1159
|
-
scrim: "#000000",
|
|
1160
|
-
transparent: "rgba(0,0,0,0)",
|
|
1161
|
-
ghost: "rgba(0,0,0,0)",
|
|
1162
|
-
quaternary: "#938F99",
|
|
1163
|
-
"on-quaternary": "#1C1B1F",
|
|
1164
|
-
warn: "#F2B8B5",
|
|
1165
|
-
"on-warn": "#601410",
|
|
1166
|
-
success: "#7FD98F",
|
|
1167
|
-
"on-success": "#00390F",
|
|
1168
|
-
disabled: "rgba(255,255,255,0.12)",
|
|
1169
|
-
"on-disabled": "rgba(255,255,255,0.38)",
|
|
1170
|
-
"on-primary-container-variant": "rgba(255,255,255,0.4)",
|
|
1171
|
-
"on-primary-container-border": "#EADDFF",
|
|
1172
|
-
"on-secondary-container-variant": "rgba(255,255,255,0.4)",
|
|
1173
|
-
"on-secondary-container-border": "#E8DEF8",
|
|
1174
|
-
"on-tertiary-container-variant": "rgba(255,255,255,0.4)",
|
|
1175
|
-
"on-tertiary-container-border": "#FFD8E4",
|
|
1176
|
-
"warn-container": "#8C1D18",
|
|
1177
|
-
"on-warn-container": "#F9DEDC",
|
|
1178
|
-
"on-warn-container-variant": "rgba(255,255,255,0.4)",
|
|
1179
|
-
"on-warn-container-border": "#F9DEDC",
|
|
1180
|
-
"success-container": "#1E5128",
|
|
1181
|
-
"on-success-container": "#C6F0CD",
|
|
1182
|
-
"on-success-container-variant": "rgba(255,255,255,0.4)",
|
|
1183
|
-
"on-success-container-border": "#C6F0CD",
|
|
1184
|
-
"disabled-container": "#2B2930",
|
|
1185
|
-
"on-disabled-container": "rgba(255,255,255,0.38)",
|
|
1186
|
-
"inverse-container": "#E6E1E5",
|
|
1187
|
-
"on-inverse-container": "#313033",
|
|
1188
|
-
"primary-surface": "#1C1B1F",
|
|
1189
|
-
"on-primary-surface": "#E6E1E5",
|
|
1190
|
-
"on-primary-surface-variant": "#D0BCFF",
|
|
1191
|
-
"secondary-surface": "#211F26",
|
|
1192
|
-
"on-secondary-surface": "#E6E1E5",
|
|
1193
|
-
"on-secondary-surface-variant": "#D0BCFF",
|
|
1194
|
-
"tertiary-surface": "#2B2930",
|
|
1195
|
-
"on-tertiary-surface": "#E6E1E5",
|
|
1196
|
-
"on-tertiary-surface-variant": "#D0BCFF",
|
|
1197
|
-
"quaternary-surface": "#36343B",
|
|
1198
|
-
"on-quaternary-surface": "#E6E1E5",
|
|
1199
|
-
"on-quaternary-surface-variant": "#D0BCFF",
|
|
1200
|
-
"disabled-surface": "rgba(255,255,255,0.12)",
|
|
1201
|
-
"on-disabled-surface": "rgba(255,255,255,0.5)",
|
|
1202
|
-
"on-disabled-surface-variant": "rgba(255,255,255,0.4)",
|
|
1203
|
-
"on-inverse-surface-variant": "#6750A4",
|
|
1204
|
-
"on-background-variant": "#8F8C93"
|
|
1205
|
-
}
|
|
1206
|
-
};
|
|
1733
|
+
colors: darkColors
|
|
1734
|
+
});
|
|
1207
1735
|
//#endregion
|
|
1208
1736
|
//#region src/concepts/theme/themes/light.theme.ts
|
|
1209
|
-
var LightTheme = {
|
|
1210
|
-
...BaseTheme,
|
|
1737
|
+
var LightTheme = createTheme({
|
|
1211
1738
|
id: "LightTheme",
|
|
1212
|
-
name: "Light Theme"
|
|
1213
|
-
|
|
1739
|
+
name: "Light Theme",
|
|
1740
|
+
colors: lightColors
|
|
1741
|
+
});
|
|
1214
1742
|
//#endregion
|
|
1215
1743
|
//#region src/concepts/theme/theme.records.ts
|
|
1216
1744
|
var UniThemes = {
|
|
@@ -1219,6 +1747,38 @@ var UniThemes = {
|
|
|
1219
1747
|
};
|
|
1220
1748
|
var DefaultThemeId = Object.keys(UniThemes)[0];
|
|
1221
1749
|
//#endregion
|
|
1750
|
+
//#region src/concepts/typography/typography.records.ts
|
|
1751
|
+
var FontWeightMap = {
|
|
1752
|
+
thin: 100,
|
|
1753
|
+
"extra-light": 200,
|
|
1754
|
+
light: 200,
|
|
1755
|
+
normal: 400,
|
|
1756
|
+
medium: 500,
|
|
1757
|
+
"semi-bold": 600,
|
|
1758
|
+
bold: 700,
|
|
1759
|
+
"extra-bold": 800,
|
|
1760
|
+
black: 900,
|
|
1761
|
+
"extra-black": 950
|
|
1762
|
+
};
|
|
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
|
|
1222
1782
|
//#region src/utils/getValue.ts
|
|
1223
1783
|
function getValue(data, path, defaultValue) {
|
|
1224
1784
|
const value = path.split(/[.[\]]/).filter(Boolean).reduce((value, key) => value?.[key], data);
|
|
@@ -1236,27 +1796,42 @@ var debounce = (callback, timeout) => {
|
|
|
1236
1796
|
};
|
|
1237
1797
|
};
|
|
1238
1798
|
//#endregion
|
|
1799
|
+
exports.BASE_PALETTE_CONFIG = BASE_PALETTE_CONFIG;
|
|
1239
1800
|
exports.BaseTheme = BaseTheme;
|
|
1801
|
+
exports.CategoryChroma = CategoryChroma;
|
|
1240
1802
|
exports.CategoryLightness = CategoryLightness;
|
|
1241
1803
|
exports.CategorySaturation = CategorySaturation;
|
|
1242
1804
|
exports.DarkTheme = DarkTheme;
|
|
1243
1805
|
exports.DefaultThemeId = DefaultThemeId;
|
|
1244
1806
|
exports.FontWeightMap = FontWeightMap;
|
|
1245
1807
|
exports.HSLAToString = HSLAToString;
|
|
1808
|
+
exports.HSLToHex = HSLToHex;
|
|
1809
|
+
exports.HSLToRGB = HSLToRGB;
|
|
1246
1810
|
exports.LightTheme = LightTheme;
|
|
1247
1811
|
exports.RGBToHSL = RGBToHSL;
|
|
1248
1812
|
exports.RGBToString = RGBToString;
|
|
1249
1813
|
exports.RoleHues = RoleHues;
|
|
1250
1814
|
exports.ShadowCssMap = ShadowCssMap;
|
|
1251
1815
|
exports.ShadowMap = ShadowMap;
|
|
1816
|
+
exports.ShapeRadii = ShapeRadii;
|
|
1252
1817
|
exports.UniThemes = UniThemes;
|
|
1253
1818
|
exports.Z_INDEX = Z_INDEX;
|
|
1819
|
+
exports.classifyScheme = classifyScheme;
|
|
1254
1820
|
exports.collapseFadeOut = collapseFadeOut;
|
|
1821
|
+
exports.contrastRatio = contrastRatio;
|
|
1822
|
+
exports.createTheme = createTheme;
|
|
1823
|
+
exports.createThemeFromPalette = createThemeFromPalette;
|
|
1255
1824
|
exports.cycle = cycle;
|
|
1825
|
+
exports.darkColors = darkColors;
|
|
1256
1826
|
exports.debounce = debounce;
|
|
1827
|
+
exports.emitThemeFile = emitThemeFile;
|
|
1257
1828
|
exports.expandFadeIn = expandFadeIn;
|
|
1258
1829
|
exports.fadeIn = fadeIn;
|
|
1259
1830
|
exports.fadeOut = fadeOut;
|
|
1831
|
+
exports.generateColors = generateColors;
|
|
1832
|
+
exports.generatePalette = generatePalette;
|
|
1833
|
+
exports.generateThemes = generateThemes;
|
|
1834
|
+
exports.generateUniThemes = generateUniThemes;
|
|
1260
1835
|
exports.getAnalogousHues = getAnalogousHues;
|
|
1261
1836
|
exports.getComplimentaryHue = getComplimentaryHue;
|
|
1262
1837
|
exports.getDeviceOrientation = getDeviceOrientation;
|
|
@@ -1265,8 +1840,17 @@ exports.getSplitComplimentaryHues = getSplitComplimentaryHues;
|
|
|
1265
1840
|
exports.getTriadicHues = getTriadicHues;
|
|
1266
1841
|
exports.getValue = getValue;
|
|
1267
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;
|
|
1268
1849
|
exports.randomRangeValue = randomRangeValue;
|
|
1850
|
+
exports.relativeLuminance = relativeLuminance;
|
|
1269
1851
|
exports.removeInputPlatformStyling = removeInputPlatformStyling;
|
|
1852
|
+
exports.rgbToHex = rgbToHex;
|
|
1853
|
+
exports.schemeHues = schemeHues;
|
|
1270
1854
|
exports.toTypeface = toTypeface;
|
|
1271
1855
|
exports.toTypefaces = toTypefaces;
|
|
1272
1856
|
exports.uniColor = uniColor;
|