@glasshome/ui 1.16.1 → 1.18.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/SPEC.md +7 -3
- package/dist/backgrounds/geometric-houses.d.ts +1 -0
- package/dist/backgrounds/index.d.ts +1 -0
- package/dist/backgrounds/index.js +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +20 -2
- package/dist/lib/button-variants.d.ts +1 -1
- package/dist/lib/motion-window.d.ts +5 -0
- package/dist/lib/pill-classes.d.ts +1 -1
- package/dist/lib/thumb-classes.d.ts +1 -0
- package/dist/lib/tier-badge.d.ts +1 -1
- package/dist/solid/index.js +4001 -4001
- package/dist/tokens/index.d.ts +2 -0
- package/dist/tokens/index.js +203 -7
- package/dist/tokens/readability.d.ts +21 -0
- package/dist/tokens/theme-recipe.d.ts +25 -0
- package/dist/{utils-DMaksjvy.js → utils-COITV1s9.js} +327 -327
- package/package.json +8 -2
- package/src/backgrounds/geometric-houses.ts +103 -0
- package/src/backgrounds/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/lib/button-variants.ts +6 -4
- package/src/lib/motion-window.ts +34 -0
- package/src/lib/pill-classes.ts +4 -3
- package/src/lib/thumb-classes.ts +7 -0
- package/src/lib/tier-badge.ts +1 -1
- package/src/solid/carousel.tsx +2 -2
- package/src/solid/data-table.tsx +2 -2
- package/src/solid/icon-picker.tsx +1 -1
- package/src/solid/media-tile.tsx +1 -1
- package/src/solid/switch.tsx +5 -2
- package/src/styles/theme.css +9 -3
- package/src/tokens/index.ts +2 -0
- package/src/tokens/presets.ts +6 -6
- package/src/tokens/readability.ts +67 -0
- package/src/tokens/theme-recipe.ts +147 -0
package/dist/tokens/index.d.ts
CHANGED
package/dist/tokens/index.js
CHANGED
|
@@ -161,7 +161,7 @@ var x = [
|
|
|
161
161
|
},
|
|
162
162
|
background: y("geometric-houses", { url: "/backgrounds/geometric-houses.svg" })
|
|
163
163
|
},
|
|
164
|
-
b("sunrise-studio", "Sunrise Studio", 1.
|
|
164
|
+
b("sunrise-studio", "Sunrise Studio", 1.1, ["#e8590c", "#fab005"], {
|
|
165
165
|
primary: "oklch(0.68 0.16 50)",
|
|
166
166
|
accent: "oklch(0.74 0.14 28)",
|
|
167
167
|
secondary: "oklch(0.92 0.04 82)",
|
|
@@ -169,7 +169,7 @@ var x = [
|
|
|
169
169
|
card: "oklch(0.96 0.02 85)",
|
|
170
170
|
background: "oklch(0.985 0.01 90)"
|
|
171
171
|
}, y("diagonal-stripes")),
|
|
172
|
-
b("forest-zen", "Forest Zen", 1.
|
|
172
|
+
b("forest-zen", "Forest Zen", 1.6, ["#2f9e44", "#12b886"], {
|
|
173
173
|
primary: "oklch(0.58 0.13 145)",
|
|
174
174
|
accent: "oklch(0.66 0.1 165)",
|
|
175
175
|
secondary: "oklch(0.9 0.03 150)",
|
|
@@ -177,7 +177,7 @@ var x = [
|
|
|
177
177
|
card: "oklch(0.95 0.01 150)",
|
|
178
178
|
background: "oklch(0.98 0.01 160)"
|
|
179
179
|
}, y("trees")),
|
|
180
|
-
b("lavender-dreams", "Lavender Dreams", 1.
|
|
180
|
+
b("lavender-dreams", "Lavender Dreams", 1.8, ["#9c36b5", "#e64980"], {
|
|
181
181
|
primary: "oklch(0.62 0.14 300)",
|
|
182
182
|
accent: "oklch(0.7 0.12 320)",
|
|
183
183
|
secondary: "oklch(0.93 0.03 290)",
|
|
@@ -185,7 +185,7 @@ var x = [
|
|
|
185
185
|
card: "oklch(0.97 0.02 300)",
|
|
186
186
|
background: "oklch(0.99 0.01 305)"
|
|
187
187
|
}, y("streets", { url: "/backgrounds/streets.svg" })),
|
|
188
|
-
b("coral-reef", "Coral Reef", 1.
|
|
188
|
+
b("coral-reef", "Coral Reef", 1.25, ["#e03131", "#fd7e14"], {
|
|
189
189
|
primary: "oklch(0.66 0.19 20)",
|
|
190
190
|
accent: "oklch(0.7 0.16 45)",
|
|
191
191
|
secondary: "oklch(0.91 0.04 35)",
|
|
@@ -204,14 +204,14 @@ var x = [
|
|
|
204
204
|
card: "oklch(0.98 0.003 260)",
|
|
205
205
|
background: "oklch(0.995 0.002 260)"
|
|
206
206
|
}, y("grid")),
|
|
207
|
-
b("ocean-breeze", "Ocean Breeze", 1.
|
|
207
|
+
b("ocean-breeze", "Ocean Breeze", 1.5, ["#1098ad", "#3b5bdb"], {
|
|
208
208
|
primary: "oklch(0.6 0.16 235)",
|
|
209
209
|
accent: "oklch(0.68 0.11 205)",
|
|
210
210
|
secondary: "oklch(0.92 0.03 225)",
|
|
211
211
|
border: "oklch(0.84 0.02 230)",
|
|
212
212
|
card: "oklch(0.97 0.01 230)",
|
|
213
213
|
background: "oklch(0.99 0.01 235)"
|
|
214
|
-
}, y("
|
|
214
|
+
}, y("abstract-pattern", { url: "/backgrounds/ride-the-wave.svg" }))
|
|
215
215
|
];
|
|
216
216
|
function S() {
|
|
217
217
|
return x;
|
|
@@ -244,4 +244,200 @@ function E(e, t) {
|
|
|
244
244
|
return (Math.max(n, r) + .05) / (Math.min(n, r) + .05);
|
|
245
245
|
}
|
|
246
246
|
//#endregion
|
|
247
|
-
|
|
247
|
+
//#region src/tokens/readability.ts
|
|
248
|
+
var D = [
|
|
249
|
+
{
|
|
250
|
+
text: "mutedForeground",
|
|
251
|
+
surface: "background",
|
|
252
|
+
min: 4.5
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
text: "mutedForeground",
|
|
256
|
+
surface: "card",
|
|
257
|
+
min: 4.5
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
text: "mutedForeground",
|
|
261
|
+
surface: "muted",
|
|
262
|
+
min: 4.5
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
text: "destructive",
|
|
266
|
+
surface: "background",
|
|
267
|
+
min: 4.5
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
text: "destructive",
|
|
271
|
+
surface: "card",
|
|
272
|
+
min: 4.5
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
text: "primary",
|
|
276
|
+
surface: "background",
|
|
277
|
+
min: 3
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
text: "primary",
|
|
281
|
+
surface: "card",
|
|
282
|
+
min: 3
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
text: "ring",
|
|
286
|
+
surface: "background",
|
|
287
|
+
min: 3
|
|
288
|
+
}
|
|
289
|
+
];
|
|
290
|
+
function O(e) {
|
|
291
|
+
return D.flatMap((t) => {
|
|
292
|
+
let n = E(e[t.text], e[t.surface]);
|
|
293
|
+
return n >= t.min ? [] : [{
|
|
294
|
+
...t,
|
|
295
|
+
ratio: n
|
|
296
|
+
}];
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
var k = .01;
|
|
300
|
+
function A(e) {
|
|
301
|
+
return D.filter((t) => t.text === e);
|
|
302
|
+
}
|
|
303
|
+
function j(e, t, n) {
|
|
304
|
+
return n.every((n) => E(e, t[n.surface]) >= n.min);
|
|
305
|
+
}
|
|
306
|
+
function M(e, n) {
|
|
307
|
+
let a = r(e[n]);
|
|
308
|
+
if (!a) return null;
|
|
309
|
+
let o = A(n);
|
|
310
|
+
for (let n = k; n <= 1; n += k) for (let r of [-1, 1]) {
|
|
311
|
+
let s = a.l + r * n;
|
|
312
|
+
if (s < 0 || s > 1) continue;
|
|
313
|
+
let c = i(t(Number(s.toFixed(4)), 0, 1), a.c, a.h);
|
|
314
|
+
if (j(c, e, o)) return c;
|
|
315
|
+
}
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
318
|
+
//#endregion
|
|
319
|
+
//#region src/tokens/theme-recipe.ts
|
|
320
|
+
var N = 1, P = {
|
|
321
|
+
light: {
|
|
322
|
+
ground: {},
|
|
323
|
+
card: {
|
|
324
|
+
l: .015,
|
|
325
|
+
c: .6
|
|
326
|
+
},
|
|
327
|
+
border: {
|
|
328
|
+
l: -.08,
|
|
329
|
+
c: 1.2,
|
|
330
|
+
cMax: .06
|
|
331
|
+
},
|
|
332
|
+
secondary: { l: -.035 },
|
|
333
|
+
primary: {},
|
|
334
|
+
accent: {
|
|
335
|
+
l: .05,
|
|
336
|
+
c: .85
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
dark: {
|
|
340
|
+
ground: {
|
|
341
|
+
lTo: .14,
|
|
342
|
+
c: 1.5,
|
|
343
|
+
cMax: .04
|
|
344
|
+
},
|
|
345
|
+
card: {
|
|
346
|
+
lTo: .18,
|
|
347
|
+
c: 1.5,
|
|
348
|
+
cMax: .04
|
|
349
|
+
},
|
|
350
|
+
border: {
|
|
351
|
+
lTo: .26,
|
|
352
|
+
c: 1.5,
|
|
353
|
+
cMax: .05
|
|
354
|
+
},
|
|
355
|
+
secondary: {
|
|
356
|
+
lTo: .21,
|
|
357
|
+
c: 1.5,
|
|
358
|
+
cMax: .04
|
|
359
|
+
},
|
|
360
|
+
primary: { l: .08 },
|
|
361
|
+
accent: {
|
|
362
|
+
l: .12,
|
|
363
|
+
c: .85
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
function F(e, n) {
|
|
368
|
+
let a = r(e);
|
|
369
|
+
return a ? i(t(n.lTo ?? a.l + (n.l ?? 0), 0, 1), t(a.c * (n.c ?? 1), 0, n.cMax ?? .4), a.h) : e;
|
|
370
|
+
}
|
|
371
|
+
function I(e, t) {
|
|
372
|
+
let n = P[t];
|
|
373
|
+
return {
|
|
374
|
+
background: F(e.surface, n.ground),
|
|
375
|
+
card: F(e.surface, n.card),
|
|
376
|
+
border: F(e.surface, n.border),
|
|
377
|
+
secondary: F(e.surface, n.secondary),
|
|
378
|
+
primary: F(e.accent, n.primary),
|
|
379
|
+
accent: F(e.accent, n.accent)
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
var L = [
|
|
383
|
+
"primary",
|
|
384
|
+
"ring",
|
|
385
|
+
"mutedForeground",
|
|
386
|
+
"destructive"
|
|
387
|
+
];
|
|
388
|
+
function R(e) {
|
|
389
|
+
let t = { ...e }, n = new Set(O(t).map((e) => e.text));
|
|
390
|
+
for (let e of L) n.has(e) && (t[e] = M(t, e) ?? t[e]);
|
|
391
|
+
return t;
|
|
392
|
+
}
|
|
393
|
+
function z(e) {
|
|
394
|
+
let t = I(e, "light"), n = s(t, "light"), r = e.darkLinked ? c(t) : s(I(e, "dark"), "dark");
|
|
395
|
+
return {
|
|
396
|
+
light: R(n),
|
|
397
|
+
dark: R(r)
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
function B(e) {
|
|
401
|
+
let t = z(e);
|
|
402
|
+
return {
|
|
403
|
+
light: {
|
|
404
|
+
...t.light,
|
|
405
|
+
...e.set.light
|
|
406
|
+
},
|
|
407
|
+
dark: {
|
|
408
|
+
...t.dark,
|
|
409
|
+
...e.set.dark
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
function V(e, t, n) {
|
|
414
|
+
return e.set[t][n] === void 0;
|
|
415
|
+
}
|
|
416
|
+
function H(e, t) {
|
|
417
|
+
let n = {};
|
|
418
|
+
for (let r of Object.keys(t)) t[r] !== e[r] && (n[r] = t[r]);
|
|
419
|
+
return n;
|
|
420
|
+
}
|
|
421
|
+
function U(e, t, n) {
|
|
422
|
+
let r = {
|
|
423
|
+
v: 1,
|
|
424
|
+
accent: e.light.primary,
|
|
425
|
+
surface: e.light.background,
|
|
426
|
+
radius: t,
|
|
427
|
+
background: n,
|
|
428
|
+
darkLinked: !1,
|
|
429
|
+
set: {
|
|
430
|
+
light: {},
|
|
431
|
+
dark: {}
|
|
432
|
+
}
|
|
433
|
+
}, i = z(r);
|
|
434
|
+
return {
|
|
435
|
+
...r,
|
|
436
|
+
set: {
|
|
437
|
+
light: H(i.light, e.light),
|
|
438
|
+
dark: H(i.dark, e.dark)
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
//#endregion
|
|
443
|
+
export { g as DEFAULT_THEME_ID, v as FONT_MONO, _ as FONT_SANS, D as READABLE_PAIRS, N as RECIPE_VERSION, x as THEME_PRESETS, t as clamp, E as contrastRatio, c as deriveDarkFromLight, u as ensureFullThemeColors, O as findUnreadable, M as fixReadable, S as getAllPresets, C as getPreset, V as isDerived, d as oklchToHex, r as parseOklch, w as parseThemeBlock, B as resolveRecipe, s as resolveThemeColors, U as seedsFromColors, i as toOklch };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ThemeColors } from "./theme-colors.js";
|
|
2
|
+
type Key = keyof ThemeColors;
|
|
3
|
+
export interface ReadablePair {
|
|
4
|
+
/** The color read as text, an icon or an indicator. */
|
|
5
|
+
text: Key;
|
|
6
|
+
surface: Key;
|
|
7
|
+
/** 4.5 for text, 3 for icons and indicators (WCAG AA). */
|
|
8
|
+
min: 4.5 | 3;
|
|
9
|
+
}
|
|
10
|
+
export declare const READABLE_PAIRS: ReadablePair[];
|
|
11
|
+
export interface ReadabilityIssue extends ReadablePair {
|
|
12
|
+
ratio: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function findUnreadable(colors: ThemeColors): ReadabilityIssue[];
|
|
15
|
+
/**
|
|
16
|
+
* The nearest lightness of the text color that clears every surface it is read
|
|
17
|
+
* on, hue and chroma kept. Null when no lightness can: the surfaces disagree
|
|
18
|
+
* (one dark, one light), and only a different surface fixes that.
|
|
19
|
+
*/
|
|
20
|
+
export declare function fixReadable(colors: ThemeColors, text: Key): string | null;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type BackgroundConfig, type ThemeColors, type ThemeColorsConfig } from "./theme-colors.js";
|
|
2
|
+
export declare const RECIPE_VERSION = 1;
|
|
3
|
+
type Mode = "light" | "dark";
|
|
4
|
+
/** What was chosen, never what was computed: a stored theme re-derives on read. */
|
|
5
|
+
export interface ThemeRecipe {
|
|
6
|
+
/** Selects the derivation table, so a change to the math never moves a stored theme. */
|
|
7
|
+
v: typeof RECIPE_VERSION;
|
|
8
|
+
accent: string;
|
|
9
|
+
/** Tint and depth of the ground the glass sits on, as chosen for light. */
|
|
10
|
+
surface: string;
|
|
11
|
+
radius: number;
|
|
12
|
+
background: BackgroundConfig;
|
|
13
|
+
/** Dark is derived from the light result instead of from the seeds. */
|
|
14
|
+
darkLinked: boolean;
|
|
15
|
+
/** Hand-set colors only; everything absent is derived. */
|
|
16
|
+
set: {
|
|
17
|
+
light: Partial<ThemeColors>;
|
|
18
|
+
dark: Partial<ThemeColors>;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export declare function resolveRecipe(recipe: ThemeRecipe): ThemeColorsConfig;
|
|
22
|
+
export declare function isDerived(recipe: ThemeRecipe, mode: Mode, key: keyof ThemeColors): boolean;
|
|
23
|
+
/** A flat theme (a preset, a legacy row) as a recipe that resolves back to the same 24 colors. */
|
|
24
|
+
export declare function seedsFromColors(colors: ThemeColorsConfig, radius: number, background: BackgroundConfig): ThemeRecipe;
|
|
25
|
+
export {};
|