@ramme-io/ui 5.3.1 → 5.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/ramme-ui.mjs +18 -6
- package/dist/components/ai/cardState.d.ts +7 -10
- package/dist/components/data-display/DataTable.d.ts +5 -0
- package/dist/components/data-display/DataTable.js +31 -29
- package/dist/components/data-display/_DataTableCards.js +31 -31
- package/dist/components/forms/SegmentedControl.js +14 -9
- package/dist/components/layout/AppShell.js +32 -32
- package/dist/components/layout/AppShell.print.test.d.ts +1 -0
- package/dist/components/ui/Avatar.d.ts +35 -6
- package/dist/components/ui/Avatar.js +54 -20
- package/dist/components/ui/Badge.d.ts +1 -1
- package/dist/components/ui/Icon.js +21 -11
- package/dist/contexts/ThemeContext.d.ts +6 -0
- package/dist/contexts/ThemeContext.js +90 -73
- package/dist/index.css +1 -1
- package/dist/index.js +117 -114
- package/dist/lib/hooks/useChartTheme.d.ts +21 -0
- package/dist/lib/hooks/useChartTheme.js +39 -22
- package/dist/lib/theme/ThemeGenerator.contrast.test.d.ts +1 -0
- package/dist/lib/theme/ThemeGenerator.logic.js +68 -67
- package/dist/lib/theme/themeUtils.d.ts +19 -3
- package/dist/lib/theme/themeUtils.js +96 -62
- package/dist/print-palette.test.d.ts +1 -0
- package/dist/wizardManifest.js +39 -7
- package/package.json +2 -2
- package/src/wizardManifest.ts +39 -7
- package/tailwind.preset.js +1 -0
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import { getContrastColor as S } from "./themeUtils.js";
|
|
2
|
+
function C(e, n, s) {
|
|
2
3
|
n /= 100, s /= 100;
|
|
3
|
-
const a = (t) => (t + e / 30) % 12,
|
|
4
|
+
const a = (t) => (t + e / 30) % 12, c = n * Math.min(s, 1 - s), i = (t) => s - c * Math.max(-1, Math.min(a(t) - 3, Math.min(9 - a(t), 1)));
|
|
4
5
|
return [
|
|
5
|
-
Math.round(
|
|
6
|
-
Math.round(
|
|
7
|
-
Math.round(
|
|
6
|
+
Math.round(i(0) * 255),
|
|
7
|
+
Math.round(i(8) * 255),
|
|
8
|
+
Math.round(i(4) * 255)
|
|
8
9
|
];
|
|
9
10
|
}
|
|
10
11
|
function d(e) {
|
|
11
|
-
const [n, s, a] =
|
|
12
|
+
const [n, s, a] = C(e.h, e.s, e.l);
|
|
12
13
|
return `${n} ${s} ${a}`;
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
+
function _(e) {
|
|
15
16
|
return `hsl(${e.h}, ${e.s}%, ${e.l}%)`;
|
|
16
17
|
}
|
|
17
18
|
function o(e, n, s) {
|
|
@@ -20,7 +21,7 @@ function o(e, n, s) {
|
|
|
20
21
|
function r(e, n) {
|
|
21
22
|
return Math.floor(Math.random() * (n - e + 1)) + e;
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
+
function M(e) {
|
|
24
25
|
return {
|
|
25
26
|
background: { h: e.background.h, s: o(e.background.s + 5, 0, 30), l: o(r(6, 14), 0, 100) },
|
|
26
27
|
foreground: { h: e.foreground.h, s: o(e.foreground.s, 0, 15), l: o(r(88, 96), 0, 100) },
|
|
@@ -33,7 +34,7 @@ function S(e) {
|
|
|
33
34
|
input: { h: e.background.h, s: o(e.background.s + 2, 0, 20), l: o(r(12, 20), 0, 100) }
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
|
-
const
|
|
37
|
+
const z = {
|
|
37
38
|
id: "cyberpunk",
|
|
38
39
|
name: "Cyberpunk",
|
|
39
40
|
description: "Neon-soaked digital dystopia with electric accents.",
|
|
@@ -54,7 +55,7 @@ const C = {
|
|
|
54
55
|
input: { h: 260, s: 10, l: 97 }
|
|
55
56
|
};
|
|
56
57
|
}
|
|
57
|
-
},
|
|
58
|
+
}, x = {
|
|
58
59
|
id: "nordic",
|
|
59
60
|
name: "Nordic",
|
|
60
61
|
description: "Cool, airy Scandinavian minimalism with subtle blues.",
|
|
@@ -75,7 +76,7 @@ const C = {
|
|
|
75
76
|
input: { h: e, s: 8, l: 98 }
|
|
76
77
|
};
|
|
77
78
|
}
|
|
78
|
-
},
|
|
79
|
+
}, T = {
|
|
79
80
|
id: "earthy",
|
|
80
81
|
name: "Earthy",
|
|
81
82
|
description: "Warm terracotta, forest greens, and natural tones.",
|
|
@@ -96,7 +97,7 @@ const C = {
|
|
|
96
97
|
input: { h: e, s: 10, l: 97 }
|
|
97
98
|
};
|
|
98
99
|
}
|
|
99
|
-
},
|
|
100
|
+
}, L = {
|
|
100
101
|
id: "corporate",
|
|
101
102
|
name: "Corporate High-Tech",
|
|
102
103
|
description: "Sleek, professional blues and crisp neutrals.",
|
|
@@ -117,7 +118,7 @@ const C = {
|
|
|
117
118
|
input: { h: 220, s: 6, l: 98 }
|
|
118
119
|
};
|
|
119
120
|
}
|
|
120
|
-
},
|
|
121
|
+
}, v = {
|
|
121
122
|
id: "minimalist",
|
|
122
123
|
name: "Minimalist",
|
|
123
124
|
description: "Monochrome elegance with a single accent pop.",
|
|
@@ -138,7 +139,7 @@ const C = {
|
|
|
138
139
|
input: { h: 0, s: 0, l: 99 }
|
|
139
140
|
};
|
|
140
141
|
}
|
|
141
|
-
},
|
|
142
|
+
}, I = {
|
|
142
143
|
id: "sunset",
|
|
143
144
|
name: "Sunset",
|
|
144
145
|
description: "Warm gradients from golden amber to dusky rose.",
|
|
@@ -159,7 +160,7 @@ const C = {
|
|
|
159
160
|
input: { h: e, s: 12, l: 98 }
|
|
160
161
|
};
|
|
161
162
|
}
|
|
162
|
-
},
|
|
163
|
+
}, j = {
|
|
163
164
|
id: "ocean",
|
|
164
165
|
name: "Ocean Depth",
|
|
165
166
|
description: "Deep teals, coral highlights, and aquatic mystery.",
|
|
@@ -181,14 +182,14 @@ const C = {
|
|
|
181
182
|
};
|
|
182
183
|
}
|
|
183
184
|
}, y = [
|
|
184
|
-
C,
|
|
185
185
|
z,
|
|
186
186
|
x,
|
|
187
187
|
T,
|
|
188
188
|
L,
|
|
189
189
|
v,
|
|
190
|
-
I
|
|
191
|
-
|
|
190
|
+
I,
|
|
191
|
+
j
|
|
192
|
+
], O = {
|
|
192
193
|
red: { h: 0, s: 80 },
|
|
193
194
|
crimson: { h: 348, s: 85 },
|
|
194
195
|
scarlet: { h: 10, s: 85 },
|
|
@@ -258,7 +259,7 @@ const C = {
|
|
|
258
259
|
neon: { h: 130, s: 95 },
|
|
259
260
|
electric: { h: 195, s: 95 },
|
|
260
261
|
fluorescent: { h: 100, s: 90 }
|
|
261
|
-
},
|
|
262
|
+
}, D = {
|
|
262
263
|
// Temperature
|
|
263
264
|
warm: { temperature: 0.8 },
|
|
264
265
|
hot: { temperature: 1 },
|
|
@@ -325,7 +326,7 @@ const C = {
|
|
|
325
326
|
quiet: { energy: -0.6 },
|
|
326
327
|
still: { energy: -0.7 },
|
|
327
328
|
minimal: { energy: -0.4 }
|
|
328
|
-
},
|
|
329
|
+
}, H = [
|
|
329
330
|
{ condition: (e) => e.energy > 0.5 && e.saturation > 0.3, fonts: { heading: "Orbitron", body: "Rajdhani" } },
|
|
330
331
|
{ condition: (e) => e.formality > 0.5, fonts: { heading: "Plus Jakarta Sans", body: "Inter" } },
|
|
331
332
|
{ condition: (e) => e.formality > 0.3 && e.temperature > 0, fonts: { heading: "Playfair Display", body: "Source Sans 3" } },
|
|
@@ -336,52 +337,52 @@ const C = {
|
|
|
336
337
|
{ condition: (e) => e.energy > 0.3, fonts: { heading: "Archivo Black", body: "DM Sans" } },
|
|
337
338
|
{ condition: (e) => e.brightness > 0.3, fonts: { heading: "Sora", body: "Nunito" } },
|
|
338
339
|
{ condition: (e) => e.brightness < -0.3, fonts: { heading: "Space Grotesk", body: "JetBrains Mono" } }
|
|
339
|
-
],
|
|
340
|
-
function
|
|
340
|
+
], N = { heading: "DM Sans", body: "Inter" };
|
|
341
|
+
function P(e) {
|
|
341
342
|
const n = e.toLowerCase(), s = { temperature: 0, brightness: 0, saturation: 0, formality: 0, energy: 0 };
|
|
342
343
|
let a = 0;
|
|
343
|
-
for (const [
|
|
344
|
-
if (n.includes(
|
|
345
|
-
for (const [t, h] of Object.entries(
|
|
344
|
+
for (const [c, i] of Object.entries(D))
|
|
345
|
+
if (n.includes(c)) {
|
|
346
|
+
for (const [t, h] of Object.entries(i))
|
|
346
347
|
s[t] += h;
|
|
347
348
|
a++;
|
|
348
349
|
}
|
|
349
350
|
if (a > 1)
|
|
350
|
-
for (const
|
|
351
|
-
s[
|
|
351
|
+
for (const c of Object.keys(s))
|
|
352
|
+
s[c] = o(s[c] / Math.sqrt(a), -1, 1);
|
|
352
353
|
return s;
|
|
353
354
|
}
|
|
354
355
|
function F(e) {
|
|
355
356
|
const n = e.toLowerCase(), s = [], a = /* @__PURE__ */ new Set();
|
|
356
|
-
for (const [
|
|
357
|
-
n.includes(
|
|
357
|
+
for (const [c, i] of Object.entries(O))
|
|
358
|
+
n.includes(c) && !a.has(i.h) && (s.push(i), a.add(i.h));
|
|
358
359
|
return s;
|
|
359
360
|
}
|
|
360
|
-
function
|
|
361
|
-
for (const n of
|
|
361
|
+
function $(e) {
|
|
362
|
+
for (const n of H)
|
|
362
363
|
if (n.condition(e)) return n.fonts;
|
|
363
|
-
return
|
|
364
|
+
return N;
|
|
364
365
|
}
|
|
365
|
-
function
|
|
366
|
+
function q(e, n) {
|
|
366
367
|
let s, a;
|
|
367
368
|
e.length > 0 ? (s = e[0].h, a = e[0].s) : (s = n.temperature > 0 ? r(0, 40) + Math.round(n.temperature * 20) : r(180, 260) + Math.round(n.temperature * 20), a = 65 + Math.round(n.saturation * 20));
|
|
368
|
-
let
|
|
369
|
+
let c, i;
|
|
369
370
|
if (e.length > 1)
|
|
370
|
-
|
|
371
|
+
c = e[1].h, i = e[1].s;
|
|
371
372
|
else {
|
|
372
|
-
const
|
|
373
|
-
|
|
373
|
+
const w = n.formality > 0 ? r(25, 45) : r(100, 140);
|
|
374
|
+
c = (s + w) % 360, i = o(a - 10 + r(-5, 5), 30, 90);
|
|
374
375
|
}
|
|
375
376
|
let t, h;
|
|
376
377
|
e.length > 2 ? (t = e[2].h, h = e[2].s) : (t = (s + 150 + r(-20, 20)) % 360, h = o(a + 10 + r(-5, 5), 40, 95));
|
|
377
378
|
const g = Math.round(n.saturation * 15);
|
|
378
|
-
a = o(a + g, 25, 100),
|
|
379
|
+
a = o(a + g, 25, 100), i = o(i + g, 20, 95), h = o(h + g, 25, 100);
|
|
379
380
|
const m = 52 + Math.round(n.brightness * 8), p = 50 + Math.round(n.brightness * 6), k = 54 + Math.round(n.brightness * 6), l = s, u = o(5 + Math.round(Math.abs(n.saturation) * 10), 0, 25), b = n.brightness > 0 ? r(97, 99) : r(94, 97);
|
|
380
381
|
return {
|
|
381
382
|
background: { h: l, s: u, l: b },
|
|
382
383
|
foreground: { h: l, s: o(u + 10, 0, 25), l: r(8, 15) },
|
|
383
384
|
primary: { h: s, s: a, l: o(m + r(-3, 3), 35, 65) },
|
|
384
|
-
secondary: { h:
|
|
385
|
+
secondary: { h: c, s: i, l: o(p + r(-3, 3), 35, 65) },
|
|
385
386
|
accent: { h: t, s: h, l: o(k + r(-3, 3), 40, 68) },
|
|
386
387
|
muted: { h: l, s: o(u + 3, 0, 15), l: r(91, 94) },
|
|
387
388
|
border: { h: l, s: o(u + 2, 0, 18), l: r(84, 88) },
|
|
@@ -389,37 +390,37 @@ function $(e, n) {
|
|
|
389
390
|
input: { h: l, s: o(u - 3, 0, 10), l: r(97, 99) }
|
|
390
391
|
};
|
|
391
392
|
}
|
|
392
|
-
function
|
|
393
|
+
function E(e) {
|
|
393
394
|
let n = 0;
|
|
394
395
|
for (let s = 0; s < e.length; s++)
|
|
395
396
|
n = e.charCodeAt(s) + ((n << 5) - n);
|
|
396
397
|
return (n % 360 + 360) % 360;
|
|
397
398
|
}
|
|
398
|
-
function
|
|
399
|
-
const n =
|
|
399
|
+
function W(e) {
|
|
400
|
+
const n = P(e), s = F(e);
|
|
400
401
|
if (s.length === 0) {
|
|
401
|
-
const f =
|
|
402
|
+
const f = E(e);
|
|
402
403
|
s.push({ h: f, s: 65 + r(-10, 10) });
|
|
403
404
|
}
|
|
404
|
-
const a =
|
|
405
|
+
const a = q(s, n), c = M(a), i = $(n), t = e.toLowerCase();
|
|
405
406
|
let h = "0.5rem";
|
|
406
407
|
t.includes("sharp") || t.includes("square") || t.includes("block") || t.includes("strict") ? h = "0rem" : t.includes("round") || t.includes("soft") || t.includes("friendly") || t.includes("bubble") ? h = "1rem" : (t.includes("pill") || t.includes("capsule")) && (h = "2rem");
|
|
407
408
|
let g = "1rem";
|
|
408
409
|
t.includes("large text") || t.includes("big text") || t.includes("accessible") || t.includes("grand") ? g = "1.125rem" : (t.includes("small text") || t.includes("compact") || t.includes("dense")) && (g = "0.875rem");
|
|
409
|
-
const m = F(e), p = m.length > 0 ? Object.entries(
|
|
410
|
+
const m = F(e), p = m.length > 0 ? Object.entries(O).filter(([, f]) => m.some((R) => R.h === f.h)).map(([f]) => f.charAt(0).toUpperCase() + f.slice(1)).slice(0, 3).join(" + ") : null, k = n.temperature > 0.3 ? "Warm" : n.temperature < -0.3 ? "Cool" : "", l = n.saturation > 0.3 ? "Vibrant" : n.saturation < -0.3 ? "Soft" : "", u = [k, l].filter(Boolean).join(" "), b = p || e.slice(0, 30);
|
|
410
411
|
return {
|
|
411
412
|
name: (u ? `${u} ${b}` : b) || "Custom Theme",
|
|
412
413
|
description: `Custom palette generated from: "${e}"`,
|
|
413
414
|
profileId: "custom",
|
|
414
|
-
fonts:
|
|
415
|
+
fonts: i,
|
|
415
416
|
borderRadius: h,
|
|
416
417
|
baseFontSize: g,
|
|
417
418
|
light: a,
|
|
418
|
-
dark:
|
|
419
|
+
dark: c
|
|
419
420
|
};
|
|
420
421
|
}
|
|
421
|
-
function
|
|
422
|
-
const n = y.find((
|
|
422
|
+
function B(e) {
|
|
423
|
+
const n = y.find((c) => c.id === e) || y[0], s = n.generate(), a = M(s);
|
|
423
424
|
return {
|
|
424
425
|
name: n.name,
|
|
425
426
|
description: n.description,
|
|
@@ -431,8 +432,8 @@ function _(e) {
|
|
|
431
432
|
dark: a
|
|
432
433
|
};
|
|
433
434
|
}
|
|
434
|
-
function
|
|
435
|
-
const e = y[r(0, y.length - 1)], n = e.generate(), s =
|
|
435
|
+
function G() {
|
|
436
|
+
const e = y[r(0, y.length - 1)], n = e.generate(), s = M(n);
|
|
436
437
|
return {
|
|
437
438
|
name: e.name,
|
|
438
439
|
description: e.description,
|
|
@@ -444,15 +445,15 @@ function W() {
|
|
|
444
445
|
dark: s
|
|
445
446
|
};
|
|
446
447
|
}
|
|
447
|
-
function
|
|
448
|
-
const n = e.primary
|
|
448
|
+
function J(e) {
|
|
449
|
+
const n = d(e.primary), s = d(e.secondary), a = d(e.accent);
|
|
449
450
|
return {
|
|
450
|
-
"--app-primary-color":
|
|
451
|
-
"--app-primary-foreground-color": n,
|
|
452
|
-
"--app-secondary-color":
|
|
453
|
-
"--app-secondary-foreground-color": s,
|
|
454
|
-
"--app-accent-color":
|
|
455
|
-
"--app-accent-foreground-color": a,
|
|
451
|
+
"--app-primary-color": n,
|
|
452
|
+
"--app-primary-foreground-color": S(n),
|
|
453
|
+
"--app-secondary-color": s,
|
|
454
|
+
"--app-secondary-foreground-color": S(s),
|
|
455
|
+
"--app-accent-color": a,
|
|
456
|
+
"--app-accent-foreground-color": S(a),
|
|
456
457
|
// Core Intent Primitives
|
|
457
458
|
"--app-bg-color": d(e.background),
|
|
458
459
|
"--app-card-bg-color": d(e.card),
|
|
@@ -461,17 +462,17 @@ function B(e) {
|
|
|
461
462
|
"--app-muted-bg": d(e.muted),
|
|
462
463
|
"--app-muted-text": d({ ...e.foreground, l: e.foreground.l > 50 ? e.foreground.l - 25 : e.foreground.l + 25 }),
|
|
463
464
|
"--app-surface-hover": d({ ...e.background, l: e.background.l > 50 ? e.background.l - 5 : e.background.l + 5 }),
|
|
464
|
-
"--app-chart-1":
|
|
465
|
+
"--app-chart-1": n
|
|
465
466
|
};
|
|
466
467
|
}
|
|
467
468
|
export {
|
|
468
469
|
y as AESTHETIC_PROFILES,
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
470
|
+
B as generateFromProfile,
|
|
471
|
+
W as generateFromPrompt,
|
|
472
|
+
G as generateRandom,
|
|
473
|
+
_ as hslToCssString,
|
|
474
|
+
C as hslToRgb,
|
|
474
475
|
d as hslToRgbString,
|
|
475
|
-
|
|
476
|
-
|
|
476
|
+
M as lightToDark,
|
|
477
|
+
J as paletteToRgbVars
|
|
477
478
|
};
|
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
import { DEFAULT_THEME_TOKENS } from '@ramme-io/shared';
|
|
2
|
+
/** WCAG 2.1 relative luminance of a space-separated RGB triplet. */
|
|
3
|
+
export declare const relativeLuminance: (rgb: string) => number;
|
|
4
|
+
/** WCAG 2.1 contrast ratio between two RGB triplets, 1 to 21. */
|
|
5
|
+
export declare const contrastRatio: (a: string, b: string) => number;
|
|
2
6
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
7
|
+
* The label colour for text on `bgRgb`: white or deep navy, whichever reads
|
|
8
|
+
* better, and pure black when neither reaches 4.5:1.
|
|
9
|
+
*
|
|
10
|
+
* It used to compare a luminance with no gamma correction against 0.45, and
|
|
11
|
+
* the Theme Lab's generator picked by an HSL lightness of 55. Both put white
|
|
12
|
+
* on mid-tone fills: generated themes shipped button labels at 1.25:1.
|
|
13
|
+
* Navy and white both fall short on a fill near 0.2 luminance (at best
|
|
14
|
+
* 4.22:1), which black clears (at least 4.58:1).
|
|
5
15
|
*/
|
|
6
|
-
export declare const getContrastColor: (bgRgb: string) =>
|
|
16
|
+
export declare const getContrastColor: (bgRgb: string) => string;
|
|
7
17
|
export declare const applyThemeToDom: (vars: Record<string, string>, target?: HTMLElement) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Every variable `applyThemeToDom` can write that its caller did not name:
|
|
20
|
+
* the readable foregrounds, the chart series, the shorthand repairs and the
|
|
21
|
+
* form-control fallbacks. Whatever purges a theme purges these too.
|
|
22
|
+
*/
|
|
23
|
+
export declare const DERIVED_THEME_VARS: readonly ["--app-primary-foreground-color", "--app-text-color", "--app-bg-color", "--app-card-bg-color", "--app-border-color", "--app-primary-color", "--app-secondary-color", "--app-accent-color", "--app-input-bg-color", "--app-input-border-color", "--app-chart-1", "--app-chart-2", "--app-chart-3", "--app-chart-4", "--app-chart-5", "--app-chart-palette"];
|
|
8
24
|
/**
|
|
9
25
|
* Dynamically loads Google Fonts and updates CSS variables
|
|
10
26
|
*/
|
|
@@ -1,18 +1,28 @@
|
|
|
1
|
-
import { DEFAULT_THEME_TOKENS as
|
|
2
|
-
const m = (
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { DEFAULT_THEME_TOKENS as g } from "@ramme-io/shared";
|
|
2
|
+
const m = (r, p) => {
|
|
3
|
+
if (!r) return "128 128 128";
|
|
4
|
+
const a = r.split(" ").map(Number);
|
|
5
|
+
if (a.length !== 3) return r;
|
|
6
|
+
const o = (t) => Math.max(0, Math.min(255, t));
|
|
7
|
+
return `${o(a[0] + p)} ${o(a[1] + p)} ${o(a[2] + p)}`;
|
|
8
|
+
}, h = (r) => {
|
|
9
|
+
const p = r / 255;
|
|
10
|
+
return p <= 0.03928 ? p / 12.92 : ((p + 0.055) / 1.055) ** 2.4;
|
|
11
|
+
}, f = (r) => {
|
|
12
|
+
const [p, a, o] = r.split(" ").map(Number);
|
|
13
|
+
return 0.2126 * h(p) + 0.7152 * h(a) + 0.0722 * h(o);
|
|
14
|
+
}, u = (r, p) => {
|
|
15
|
+
const [a, o] = [f(r), f(p)].sort((t, l) => l - t);
|
|
16
|
+
return (a + 0.05) / (o + 0.05);
|
|
17
|
+
}, b = ["255 255 255", "15 23 42"], y = (r) => {
|
|
18
|
+
const p = b.reduce((a, o) => u(o, r) > u(a, r) ? o : a);
|
|
19
|
+
return u(p, r) >= 4.5 ? p : "0 0 0";
|
|
20
|
+
}, M = (r, p) => {
|
|
21
|
+
if (!r || typeof r != "object") return;
|
|
22
|
+
const a = p || document.documentElement, o = { ...r }, t = o["--app-primary-color"];
|
|
23
|
+
t && (o["--app-primary-foreground-color"] = y(t));
|
|
24
|
+
const l = o["--app-bg-color"];
|
|
25
|
+
l && (o["--app-text-color"] = y(l)), Object.entries({
|
|
16
26
|
"--primary": "--app-primary-color",
|
|
17
27
|
"--bg": "--app-bg-color",
|
|
18
28
|
"--text": "--app-text-color",
|
|
@@ -20,78 +30,102 @@ const m = (o, p) => {
|
|
|
20
30
|
"--border": "--app-border-color",
|
|
21
31
|
"--secondary": "--app-secondary-color",
|
|
22
32
|
"--accent": "--app-accent-color"
|
|
23
|
-
}).forEach(([s,
|
|
24
|
-
|
|
33
|
+
}).forEach(([s, n]) => {
|
|
34
|
+
r[s] && !r[n] && (o[n] = r[s]);
|
|
25
35
|
});
|
|
26
|
-
const e =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
].join(", ")
|
|
34
|
-
|
|
36
|
+
const e = o["--app-chart-1"] || o["--app-primary-color"];
|
|
37
|
+
e && (o["--app-chart-1"] || (o["--app-chart-1"] = e), o["--app-chart-2"] || (o["--app-chart-2"] = m(e, 30)), o["--app-chart-3"] || (o["--app-chart-3"] = m(e, -30)), o["--app-chart-4"] || (o["--app-chart-4"] = m(e, 60)), o["--app-chart-5"] || (o["--app-chart-5"] = m(e, -60)), o["--app-chart-palette"] = [
|
|
38
|
+
o["--app-chart-1"],
|
|
39
|
+
o["--app-chart-2"],
|
|
40
|
+
o["--app-chart-3"],
|
|
41
|
+
o["--app-chart-4"],
|
|
42
|
+
o["--app-chart-5"]
|
|
43
|
+
].join(", "));
|
|
44
|
+
const d = (s, n) => {
|
|
45
|
+
!o[s] && o[n] && (o[s] = o[n]);
|
|
46
|
+
};
|
|
47
|
+
d("--app-accent-color", "--app-primary-color"), d("--app-input-bg-color", "--app-card-bg-color"), d("--app-input-border-color", "--app-border-color"), Object.entries(o).forEach(([s, n]) => {
|
|
48
|
+
s.startsWith("--app-") && typeof n == "string" && n !== "" && a.style.setProperty(s, n);
|
|
35
49
|
});
|
|
36
|
-
},
|
|
37
|
-
|
|
50
|
+
}, T = [
|
|
51
|
+
"--app-primary-foreground-color",
|
|
52
|
+
"--app-text-color",
|
|
53
|
+
"--app-bg-color",
|
|
54
|
+
"--app-card-bg-color",
|
|
55
|
+
"--app-border-color",
|
|
56
|
+
"--app-primary-color",
|
|
57
|
+
"--app-secondary-color",
|
|
58
|
+
"--app-accent-color",
|
|
59
|
+
"--app-input-bg-color",
|
|
60
|
+
"--app-input-border-color",
|
|
61
|
+
"--app-chart-1",
|
|
62
|
+
"--app-chart-2",
|
|
63
|
+
"--app-chart-3",
|
|
64
|
+
"--app-chart-4",
|
|
65
|
+
"--app-chart-5",
|
|
66
|
+
"--app-chart-palette"
|
|
67
|
+
], x = (r, p) => {
|
|
68
|
+
const a = document.head, o = "dynamic-google-fonts", t = document.getElementById(o);
|
|
38
69
|
t && a.removeChild(t);
|
|
39
|
-
const l = `${
|
|
40
|
-
|
|
70
|
+
const l = `${r.replace(/ /g, "+")}:wght@400;700&family=${p.replace(/ /g, "+")}:wght@400;500;700`, i = document.createElement("link");
|
|
71
|
+
i.id = o, i.rel = "stylesheet", i.crossOrigin = "anonymous", i.href = `https://fonts.googleapis.com/css2?family=${l}&display=swap`, a.insertBefore(i, a.firstChild);
|
|
41
72
|
const e = document.documentElement;
|
|
42
|
-
e.style.setProperty("--app-font-sans", `"${p}", sans-serif`), e.style.setProperty("--app-font-serif", `"${
|
|
43
|
-
},
|
|
44
|
-
const p =
|
|
45
|
-
return `${a} ${
|
|
46
|
-
},
|
|
73
|
+
e.style.setProperty("--app-font-sans", `"${p}", sans-serif`), e.style.setProperty("--app-font-serif", `"${r}", serif`), console.log(`[FontEngine] Applied: ${r} (H) / ${p} (B)`);
|
|
74
|
+
}, R = (r) => {
|
|
75
|
+
const p = r.replace("#", ""), a = parseInt(p.substring(0, 2), 16), o = parseInt(p.substring(2, 4), 16), t = parseInt(p.substring(4, 6), 16);
|
|
76
|
+
return `${a} ${o} ${t}`;
|
|
77
|
+
}, E = {
|
|
47
78
|
none: "0",
|
|
48
79
|
sm: "0.25rem",
|
|
49
80
|
md: "0.375rem",
|
|
50
81
|
lg: "0.5rem",
|
|
51
82
|
full: "9999px"
|
|
52
|
-
},
|
|
83
|
+
}, I = [
|
|
53
84
|
"--app-primary-color",
|
|
54
85
|
"--app-secondary-color",
|
|
55
86
|
"--app-success-color",
|
|
56
87
|
"--app-warning-color",
|
|
57
88
|
"--app-danger-color",
|
|
58
89
|
"--app-border-radius-md"
|
|
59
|
-
],
|
|
60
|
-
"--app-primary-color":
|
|
61
|
-
"--app-secondary-color":
|
|
62
|
-
"--app-success-color":
|
|
63
|
-
"--app-warning-color":
|
|
90
|
+
], _ = (r) => r ? Object.keys(g).some((p) => r[p] !== void 0 && r[p] !== g[p]) : !1, A = (r) => ({
|
|
91
|
+
"--app-primary-color": r.primary ?? "13 110 253",
|
|
92
|
+
"--app-secondary-color": r.neutral ?? "24 24 27",
|
|
93
|
+
"--app-success-color": r.success ?? "34 197 94",
|
|
94
|
+
"--app-warning-color": r.warning ?? "234 179 8",
|
|
64
95
|
// NOT `--app-destructive-color`, which this wrote until now: that variable
|
|
65
96
|
// is defined nowhere in index.css and read by nothing, so the Destructive
|
|
66
97
|
// swatch in ThemeLab changed a value no stylesheet consumed. The token the
|
|
67
98
|
// preset actually maps `destructive` on to is `--app-danger-color`.
|
|
68
|
-
"--app-danger-color":
|
|
69
|
-
"--app-border-radius-md":
|
|
70
|
-
}), c = (
|
|
71
|
-
const a = Math.floor(Math.random() * (p -
|
|
72
|
-
return `${a} ${
|
|
73
|
-
},
|
|
74
|
-
const
|
|
99
|
+
"--app-danger-color": r.destructive ?? "239 68 68",
|
|
100
|
+
"--app-border-radius-md": E[r.radius ?? "md"] ?? "0.375rem"
|
|
101
|
+
}), c = (r = 0, p = 255) => {
|
|
102
|
+
const a = Math.floor(Math.random() * (p - r) + r), o = Math.floor(Math.random() * (p - r) + r), t = Math.floor(Math.random() * (p - r) + r);
|
|
103
|
+
return `${a} ${o} ${t}`;
|
|
104
|
+
}, w = () => {
|
|
105
|
+
const r = Math.random() > 0.5, p = r ? c(10, 40) : c(240, 255), a = r ? c(220, 255) : c(20, 60), o = c(50, 200);
|
|
75
106
|
return {
|
|
76
|
-
"--app-primary-color":
|
|
77
|
-
"--app-primary-foreground-color":
|
|
107
|
+
"--app-primary-color": o,
|
|
108
|
+
"--app-primary-foreground-color": r ? "0 0 0" : "255 255 255",
|
|
78
109
|
"--app-bg-color": p,
|
|
79
110
|
"--app-text-color": a,
|
|
80
|
-
"--app-card-bg-color":
|
|
81
|
-
"--app-border-color":
|
|
82
|
-
"--app-muted-bg":
|
|
111
|
+
"--app-card-bg-color": r ? c(30, 60) : "255 255 255",
|
|
112
|
+
"--app-border-color": r ? c(60, 90) : c(200, 220),
|
|
113
|
+
"--app-muted-bg": r ? c(40, 70) : c(230, 245),
|
|
83
114
|
"--app-border-radius-md": `${(Math.random() * 1).toFixed(2)}rem`,
|
|
84
|
-
"--app-chart-1":
|
|
115
|
+
"--app-chart-1": o
|
|
85
116
|
};
|
|
86
117
|
};
|
|
87
118
|
export {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
119
|
+
T as DERIVED_THEME_VARS,
|
|
120
|
+
I as THEME_TOKEN_VARS,
|
|
121
|
+
M as applyThemeToDom,
|
|
122
|
+
u as contrastRatio,
|
|
123
|
+
w as generateRandomTheme,
|
|
124
|
+
y as getContrastColor,
|
|
125
|
+
R as hexToRgbTriplet,
|
|
126
|
+
_ as isCustomTheme,
|
|
127
|
+
x as loadGoogleFont,
|
|
95
128
|
c as randomRgb,
|
|
96
|
-
|
|
129
|
+
f as relativeLuminance,
|
|
130
|
+
A as tokensToVars
|
|
97
131
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/wizardManifest.js
CHANGED
|
@@ -2973,31 +2973,63 @@ const e = {
|
|
|
2973
2973
|
{
|
|
2974
2974
|
id: "avatar",
|
|
2975
2975
|
name: "Avatar",
|
|
2976
|
-
version: "1.0.
|
|
2977
|
-
description:
|
|
2976
|
+
version: "1.0.1",
|
|
2977
|
+
description: `Displays a person's picture or a company's logo, with letters as the fallback. The letters paint first and the image fades in over them once loaded, so a slow, missing or broken image never moves or empties the tile. Use shape="square" fit="contain" plate for a company logo.`,
|
|
2978
2978
|
tags: [
|
|
2979
2979
|
"ui",
|
|
2980
2980
|
"profile",
|
|
2981
|
-
"user"
|
|
2981
|
+
"user",
|
|
2982
|
+
"logo",
|
|
2983
|
+
"company",
|
|
2984
|
+
"initials"
|
|
2982
2985
|
],
|
|
2983
2986
|
category: "ui",
|
|
2984
2987
|
props: [
|
|
2985
2988
|
{
|
|
2986
2989
|
name: "name",
|
|
2987
2990
|
type: "string",
|
|
2988
|
-
description: "The name
|
|
2991
|
+
description: "The name, used for the image's alt text and for initials if none are given."
|
|
2989
2992
|
},
|
|
2990
2993
|
{
|
|
2991
2994
|
name: "src",
|
|
2992
2995
|
type: "string",
|
|
2993
|
-
description: "The
|
|
2996
|
+
description: "The image to show. If absent or it fails to load, the letters stay."
|
|
2997
|
+
},
|
|
2998
|
+
{
|
|
2999
|
+
name: "initials",
|
|
3000
|
+
type: "string",
|
|
3001
|
+
description: "Letters to show instead of ones taken from the name, such as a ticker."
|
|
2994
3002
|
},
|
|
2995
3003
|
{
|
|
2996
3004
|
name: "size",
|
|
2997
|
-
type: "'sm' | 'md' | 'lg'",
|
|
3005
|
+
type: "'xs' | 'sm' | 'md' | 'lg'",
|
|
2998
3006
|
description: "Controls the dimensions and font size of the avatar.",
|
|
2999
3007
|
default: "'md'"
|
|
3000
3008
|
},
|
|
3009
|
+
{
|
|
3010
|
+
name: "shape",
|
|
3011
|
+
type: "'circle' | 'square'",
|
|
3012
|
+
description: "A circle for a person, a square for a company or a product.",
|
|
3013
|
+
default: "'circle'"
|
|
3014
|
+
},
|
|
3015
|
+
{
|
|
3016
|
+
name: "fit",
|
|
3017
|
+
type: "'cover' | 'contain'",
|
|
3018
|
+
description: "cover fills the tile (a photo); contain keeps the whole image (a logo).",
|
|
3019
|
+
default: "'cover'"
|
|
3020
|
+
},
|
|
3021
|
+
{
|
|
3022
|
+
name: "plate",
|
|
3023
|
+
type: "boolean",
|
|
3024
|
+
description: "Draws a loaded image on the light logo-plate token, so logos made for a white page stay legible on dark themes.",
|
|
3025
|
+
default: "false"
|
|
3026
|
+
},
|
|
3027
|
+
{
|
|
3028
|
+
name: "decorative",
|
|
3029
|
+
type: "boolean",
|
|
3030
|
+
description: "Hides the avatar from screen readers when the name is already written beside it.",
|
|
3031
|
+
default: "false"
|
|
3032
|
+
},
|
|
3001
3033
|
{
|
|
3002
3034
|
name: "className",
|
|
3003
3035
|
type: "string",
|
|
@@ -3008,7 +3040,7 @@ const e = {
|
|
|
3008
3040
|
filePath: "src/components/ui/Avatar.tsx",
|
|
3009
3041
|
sku: "@atom/primitive/avatar",
|
|
3010
3042
|
humanLabel: "Avatar",
|
|
3011
|
-
humanDescription:
|
|
3043
|
+
humanDescription: `Displays a person's picture or a company's logo, with letters as the fallback. The letters paint first and the image fades in over them once loaded, so a slow, missing or broken image never moves or empties the tile. Use shape="square" fit="contain" plate for a company logo.`
|
|
3012
3044
|
},
|
|
3013
3045
|
{
|
|
3014
3046
|
id: "badge",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ramme-io/ui",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.1",
|
|
4
4
|
"description": "The structural component library for the Ramme Framework.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"tailwind-merge": "^3.3.1",
|
|
59
59
|
"tippy.js": "^6.3.7",
|
|
60
60
|
"zod": "^3.23.8",
|
|
61
|
-
"@ramme-io/shared": "4.
|
|
61
|
+
"@ramme-io/shared": "4.7.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@storybook/addon-links": "^10.5.9",
|