@glasshome/ui 1.24.0 → 1.26.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.
@@ -55,6 +55,12 @@
55
55
  inherits: false;
56
56
  initial-value: 0;
57
57
  }
58
+ /* 1 when a .glass-halo beside the surface draws its outer glow instead. */
59
+ @property --glass-halo {
60
+ syntax: "<number>";
61
+ inherits: false;
62
+ initial-value: 0;
63
+ }
58
64
  @property --glass-text {
59
65
  syntax: "<percentage>";
60
66
  inherits: false;
@@ -142,6 +148,108 @@
142
148
  inherits: true;
143
149
  initial-value: 0;
144
150
  }
151
+ /* Depth split three ways: rim light, sheen and shade, lift shadow. */
152
+ @property --_material-edge {
153
+ syntax: "<number>";
154
+ inherits: true;
155
+ initial-value: 1;
156
+ }
157
+ @property --_material-sheen {
158
+ syntax: "<number>";
159
+ inherits: true;
160
+ initial-value: 1;
161
+ }
162
+ @property --_material-shadow {
163
+ syntax: "<number>";
164
+ inherits: true;
165
+ initial-value: 1;
166
+ }
167
+ @property --_material-inset {
168
+ syntax: "<number>";
169
+ inherits: true;
170
+ initial-value: 0;
171
+ }
172
+ @property --_material-inner-glow {
173
+ syntax: "<number>";
174
+ inherits: true;
175
+ initial-value: 0;
176
+ }
177
+ @property --_material-relief {
178
+ syntax: "<number>";
179
+ inherits: true;
180
+ initial-value: 1;
181
+ }
182
+
183
+ /* --material-*: what a widget reads to match the material; --_material-* is how
184
+ * it is drawn. Light comes from --_material-light-cos/-sin. */
185
+ :root {
186
+ --_material-hi: oklch(1 0 0);
187
+ --_material-lo: color-mix(in srgb, var(--card), black 20%);
188
+ --material-raised:
189
+ calc(
190
+ (6px * var(--_material-light-cos) - 6px * var(--_material-light-sin)) *
191
+ var(--_material-relief)
192
+ )
193
+ calc(
194
+ (6px * var(--_material-light-sin) + 6px * var(--_material-light-cos)) *
195
+ var(--_material-relief)
196
+ )
197
+ calc(14px * var(--_material-relief)) var(--_material-lo),
198
+ calc(
199
+ (-6px * var(--_material-light-cos) + 6px * var(--_material-light-sin)) *
200
+ var(--_material-relief)
201
+ )
202
+ calc(
203
+ (-6px * var(--_material-light-sin) - 6px * var(--_material-light-cos)) *
204
+ var(--_material-relief)
205
+ )
206
+ calc(14px * var(--_material-relief)) var(--_material-hi);
207
+ --material-pressed:
208
+ inset
209
+ calc(
210
+ (3px * var(--_material-light-cos) - 3px * var(--_material-light-sin)) *
211
+ var(--_material-relief)
212
+ )
213
+ calc(
214
+ (3px * var(--_material-light-sin) + 3px * var(--_material-light-cos)) *
215
+ var(--_material-relief)
216
+ )
217
+ calc(6px * var(--_material-relief)) var(--_material-lo),
218
+ inset
219
+ calc(
220
+ (-3px * var(--_material-light-cos) + 3px * var(--_material-light-sin)) *
221
+ var(--_material-relief)
222
+ )
223
+ calc(
224
+ (-3px * var(--_material-light-sin) - 3px * var(--_material-light-cos)) *
225
+ var(--_material-relief)
226
+ )
227
+ calc(6px * var(--_material-relief)) var(--_material-hi);
228
+ --material-face: radial-gradient(
229
+ circle at 50% 38%,
230
+ color-mix(in srgb, var(--card), white 40%),
231
+ var(--card)
232
+ );
233
+ --material-well: radial-gradient(
234
+ circle at 50% 38%,
235
+ color-mix(in srgb, var(--card), black 10%),
236
+ color-mix(in srgb, var(--card), black 3%)
237
+ );
238
+ }
239
+ .dark {
240
+ --_material-hi: color-mix(in srgb, var(--card), white 14%);
241
+ --_material-lo: color-mix(in srgb, var(--card), black 45%);
242
+ --material-face: radial-gradient(
243
+ circle at 50% 38%,
244
+ color-mix(in srgb, var(--card), white 5%),
245
+ var(--card)
246
+ );
247
+ --material-well: radial-gradient(
248
+ circle at 50% 38%,
249
+ color-mix(in srgb, var(--card), black 40%),
250
+ color-mix(in srgb, var(--card), black 12%)
251
+ );
252
+ }
145
253
 
146
254
  /* --glass-base and --glass-edge need var() defaults, which @property forbids,
147
255
  * so they reset here instead. MUST stay in @layer base so [--glass-*] utilities
@@ -151,9 +259,10 @@
151
259
  /* biome-ignore-start lint/correctness/noMissingVarFunction: transition-property takes property names, and these are the registered knobs */
152
260
  --glass-transition:
153
261
  --glass-tone, --glass-wash, --glass-light, --glass-shade, --glass-rim, --glass-lift,
154
- --glass-glow, --glass-drop, --glass-text, --material-depth, --material-tint,
155
- --material-edge-width, --material-edge-ink, --material-edge-accent, --material-glow, color,
156
- background-color, border-color, box-shadow, opacity, transform, translate, scale, width, height;
262
+ --glass-glow, --glass-drop, --glass-text, --material-depth, --material-tint, --_material-edge,
263
+ --_material-sheen, --_material-shadow, --material-edge-width, --material-edge-ink,
264
+ --material-edge-accent, --material-glow, color, background-color, border-color, box-shadow,
265
+ opacity, transform, translate, scale, width, height;
157
266
  /* biome-ignore-end lint/correctness/noMissingVarFunction: see above */
158
267
  }
159
268
 
@@ -175,14 +284,30 @@
175
284
  transition-timing-function: var(--ease-emphasis);
176
285
  --glass-base: var(--card);
177
286
  --glass-edge: color-mix(in srgb, var(--border) 60%, transparent);
287
+ --lc: var(--_material-light-cos);
288
+ --ls: var(--_material-light-sin);
289
+ /* A lit rim (top-bottom, around) is a crisp hairline the surface's own rim knob does not dim. */
290
+ --glass-hairline: calc(
291
+ var(--_material-edge) *
292
+ (0.22 * var(--glass-rim) + (0.5 - 0.22 * var(--glass-rim)) *
293
+ min(1, var(--_material-rim-bottom) + var(--_material-rim-around)))
294
+ );
178
295
  --glass-rim-raise:
179
- inset 0 1px 0 oklch(1 0 0 / calc(0.22 * var(--glass-rim) * var(--material-depth))),
180
- inset 2px 2px 5px -3px oklch(1 0 0 / calc(0.5 * var(--glass-rim) * var(--material-depth))),
181
- inset -2px -2px 4px -2px oklch(0 0 0 / calc(0.12 * var(--glass-rim) * var(--material-depth)));
296
+ inset calc(-1px * var(--ls)) calc(1px * var(--lc)) 0 oklch(1 0 0 / var(--glass-hairline)),
297
+ inset calc(2px * (var(--lc) - var(--ls))) calc(2px * (var(--ls) + var(--lc))) 5px -3px
298
+ oklch(1 0 0 / calc(0.5 * var(--glass-rim) * var(--_material-edge))),
299
+ inset calc(-2px * (var(--lc) - var(--ls))) calc(-2px * (var(--ls) + var(--lc))) 4px -2px
300
+ oklch(0 0 0 / calc(0.12 * var(--glass-rim) * var(--_material-edge))),
301
+ inset calc(1px * var(--ls)) calc(-1px * var(--lc)) 0
302
+ oklch(1 0 0 / calc(var(--glass-hairline) * var(--_material-rim-bottom))),
303
+ inset 0 0 0 1px oklch(1 0 0 / calc(var(--glass-hairline) * var(--_material-rim-around)));
182
304
  --glass-rim-sink:
183
- inset 0 2px 3px -1px oklch(0 0 0 / calc(0.28 * var(--glass-rim) * var(--material-depth))),
184
- inset 2px 2px 5px -3px oklch(0 0 0 / calc(0.22 * var(--glass-rim) * var(--material-depth))),
185
- inset 0 -1px 0 oklch(1 0 0 / calc(0.12 * var(--glass-rim) * var(--material-depth)));
305
+ inset calc(-2px * var(--ls)) calc(2px * var(--lc)) 3px -1px
306
+ oklch(0 0 0 / calc(0.28 * var(--glass-rim) * var(--_material-edge))),
307
+ inset calc(2px * (var(--lc) - var(--ls))) calc(2px * (var(--ls) + var(--lc))) 5px -3px
308
+ oklch(0 0 0 / calc(0.22 * var(--glass-rim) * var(--_material-edge))),
309
+ inset calc(1px * var(--ls)) calc(-1px * var(--lc)) 0
310
+ oklch(1 0 0 / calc(0.12 * var(--glass-rim) * var(--_material-edge)));
186
311
  --glass-rim-shine: var(--glass-rim-raise);
187
312
  }
188
313
  :where(.glass-tint) {
@@ -201,6 +326,28 @@
201
326
  }
202
327
  }
203
328
 
329
+ :where(.glass, .glass-halo) {
330
+ /* The surface's own hue, opaque: its tone when it has one, the accent otherwise
331
+ * (a transparent tone mixes to the accent at low alpha; the /1 restores it). */
332
+ --material-hue: oklch(
333
+ from color-mix(in srgb, var(--glass-tone) 99%, var(--material-accent)) l c h / 1
334
+ );
335
+ /* Glow scales with --glass-lift, the knob that already says how big a surface
336
+ * floats: a card (0.45) takes the full bloom, a chip or button (0) about a third. */
337
+ --material-reach: calc(0.35 + var(--glass-lift) * 1.45);
338
+ --_glass-bloom: calc(var(--material-glow) * var(--material-reach) * var(--_material-glow-out));
339
+ }
340
+ /* A surface's outer glow as its own layer, laid over the surface's box with the
341
+ * same tone and lift. Its z-index lifts the glow over neighbouring surfaces;
342
+ * the surface itself sets --glass-halo: 1 so the glow is not drawn twice. */
343
+ :where(.glass-halo) {
344
+ position: absolute;
345
+ inset: 0;
346
+ z-index: 1;
347
+ pointer-events: none;
348
+ box-shadow: 0 0 var(--_glass-bloom) oklch(from var(--material-hue) l c h / 0.65);
349
+ }
350
+
204
351
  /* The ONE glass formula. Neutral by default (--glass-tone transparent makes
205
352
  * every tone term inert); add .glass-tint for the tinted badge/alert look and
206
353
  * .glass-sink for a recessed field. Tone mixes are srgb: oklch drags a tone
@@ -220,12 +367,9 @@
220
367
  * trick as --surface-tone). Defaults reproduce the single-tone wash exactly;
221
368
  * override tone-2/wash-2/angle together for a two-tone tint (slider fills). */
222
369
  --glass-tone-2: var(--glass-tone);
223
- --glass-wash-2: calc(var(--glass-wash) / 3);
224
- --glass-wash-angle: 135deg;
370
+ --glass-wash-2: calc(var(--glass-wash) / var(--_material-wash-split));
371
+ --glass-wash-angle: var(--_material-wash-angle);
225
372
  --surface-wash: calc(var(--glass-wash) * var(--material-tint));
226
- /* The surface's own hue, opaque: its tone when it has one, the accent otherwise
227
- * (a transparent tone mixes to the accent at low alpha; the /1 restores it). */
228
- --material-hue: oklch(from color-mix(in srgb, var(--glass-tone) 99%, var(--primary)) l c h / 1);
229
373
  border: var(--material-edge-width) solid
230
374
  color-mix(
231
375
  in srgb,
@@ -243,15 +387,24 @@
243
387
  background:
244
388
  var(--glass-grain, none),
245
389
  radial-gradient(
246
- var(--glass-sheen, 120% 120%) at 22% 8%,
247
- oklch(1 0 0 / calc(var(--glass-light) * var(--material-depth))),
390
+ var(--glass-sheen, 120% 120%) at
391
+ calc(50% + (-28% * var(--_material-light-cos) + 42% * var(--_material-light-sin)))
392
+ calc(50% + (-28% * var(--_material-light-sin) - 42% * var(--_material-light-cos))),
393
+ oklch(1 0 0 / calc(var(--glass-light) * var(--_material-sheen))),
248
394
  transparent 58%
249
395
  ),
250
396
  radial-gradient(
251
- 120% 120% at 82% 100%,
252
- oklch(0 0 0 / calc(var(--glass-shade) * var(--material-depth))),
397
+ 120% 120% at calc(50% + (32% * var(--_material-light-cos) - 50% * var(--_material-light-sin)))
398
+ calc(50% + (32% * var(--_material-light-sin) + 50% * var(--_material-light-cos))),
399
+ oklch(0 0 0 / calc(var(--glass-shade) * var(--_material-sheen))),
253
400
  transparent 58%
254
401
  ),
402
+ radial-gradient(
403
+ circle at calc(50% + 12% * var(--_material-light-sin))
404
+ calc(50% - 12% * var(--_material-light-cos)),
405
+ oklch(1 0 0 / calc(0.07 * var(--_material-face-raised) * var(--_material-relief))),
406
+ transparent 70%
407
+ ),
255
408
  linear-gradient(
256
409
  var(--glass-wash-angle),
257
410
  color-mix(
@@ -266,16 +419,99 @@
266
419
  )
267
420
  ),
268
421
  linear-gradient(var(--glass-base), var(--glass-base)), var(--glass-frost, none);
269
- /* Glow scales with --glass-lift, the knob that already says how big a surface
270
- * floats: a card (0.45) takes the full bloom, a chip or button (0) about a third. */
271
- --material-reach: calc(0.35 + var(--glass-lift) * 1.45);
272
422
  box-shadow:
273
423
  var(--glass-rim-shine, 0 0 #0000),
274
424
  inset 0 -2px 4px color-mix(in srgb, var(--glass-tone) var(--glass-glow), transparent),
275
425
  0 1px 3px color-mix(in srgb, var(--glass-tone) var(--glass-drop), transparent),
276
- 0 10px 30px -16px oklch(0 0 0 / calc(var(--glass-lift) * var(--material-depth))),
277
- 0 0 calc(var(--material-glow) * var(--material-reach))
278
- oklch(from var(--material-hue) l c h / 0.65);
426
+ calc(-10px * var(--_material-light-sin)) calc(10px * var(--_material-light-cos)) 30px -16px
427
+ oklch(0 0 0 / calc(var(--glass-lift) * var(--_material-shadow))),
428
+ 0 0 calc(var(--_glass-bloom) * (1 - var(--glass-halo)))
429
+ oklch(from var(--material-hue) l c h / 0.65),
430
+ inset 0 0 calc(var(--material-glow) * 0.9 * var(--_material-glow-in))
431
+ oklch(from var(--material-hue) l c h / calc(0.65 * var(--_material-glow-in))),
432
+ inset 0 28px 36px -16px
433
+ oklch(
434
+ from
435
+ color-mix(
436
+ in srgb,
437
+ var(--material-hue) calc(var(--_material-inner-glow-hue) * 100%),
438
+ white
439
+ )
440
+ l c h / calc(var(--_material-inner-glow) * 0.6)
441
+ ),
442
+ inset 0 0 calc(var(--_material-inset) * 28px) oklch(0 0 0 / calc(var(--_material-inset) * 0.55)),
443
+ inset
444
+ calc(var(--_material-inset) * 3px * (var(--_material-light-cos) - var(--_material-light-sin)))
445
+ calc(var(--_material-inset) * 3px * (var(--_material-light-sin) + var(--_material-light-cos)))
446
+ calc(var(--_material-inset) * 10px) calc(var(--_material-inset) * -4px)
447
+ oklch(1 0 0 / calc(var(--_material-inset) * 0.35));
448
+ }
449
+ /* A raised face makes the controls neumorphic: wells pressed into the surface,
450
+ * knobs and keys standing out of it, what is on lit in the accent and glowing. */
451
+ @container style(--_material-face-raised: 1) {
452
+ [data-slot="switch"],
453
+ [data-slot="slider"],
454
+ [data-slot="checkbox-box"],
455
+ [data-slot="toggle-group"] {
456
+ border-color: transparent;
457
+ background: var(--material-control-track);
458
+ box-shadow: var(--material-pressed);
459
+ }
460
+ [data-slot="switch"][data-checked],
461
+ [data-slot="slider-fill"],
462
+ [data-slot="checkbox-box"]:where(.glass-tint),
463
+ [data-slot="toggle"][data-pressed],
464
+ [data-sliding-indicator] {
465
+ border-color: transparent;
466
+ background: var(--material-control-fill);
467
+ box-shadow: 0 0 calc(var(--material-glow) * 0.5)
468
+ color-mix(in srgb, var(--material-accent) 65%, transparent);
469
+ color: oklch(1 0 0);
470
+ }
471
+ [data-slot="tabs-trigger"][data-selected],
472
+ [data-slot="toggle-group-item"][data-pressed] {
473
+ color: oklch(1 0 0);
474
+ }
475
+ [data-slot="switch-thumb"],
476
+ [data-slot="slider-thumb"] {
477
+ --thumb-face-off: var(--material-accent);
478
+ box-shadow:
479
+ calc(
480
+ 2px * (var(--_material-light-cos) - var(--_material-light-sin)) * var(--_material-relief)
481
+ )
482
+ calc(
483
+ 2px * (var(--_material-light-sin) + var(--_material-light-cos)) * var(--_material-relief)
484
+ )
485
+ calc(5px * var(--_material-relief)) var(--_material-lo),
486
+ calc(
487
+ -2px * (var(--_material-light-cos) - var(--_material-light-sin)) * var(--_material-relief)
488
+ )
489
+ calc(
490
+ -2px * (var(--_material-light-sin) + var(--_material-light-cos)) * var(--_material-relief)
491
+ )
492
+ calc(5px * var(--_material-relief)) var(--_material-hi);
493
+ }
494
+ [data-slot="button"]:where(.glass-control):not(:where(.glass-tint)) {
495
+ border-color: transparent;
496
+ background: var(--material-control-knob);
497
+ box-shadow: var(--material-raised);
498
+ }
499
+ [data-slot="button"]:where(.glass-tint) {
500
+ border-color: transparent;
501
+ background: var(--material-control-fill);
502
+ box-shadow:
503
+ var(--material-raised),
504
+ 0 0 calc(var(--material-glow) * 0.5)
505
+ color-mix(in srgb, var(--material-accent) 65%, transparent);
506
+ color: oklch(1 0 0);
507
+ }
508
+ }
509
+
510
+ /* Two-tone wash: the second colour is the surface's own tone turned, so a toneless surface stays clear. */
511
+ @container style(--_material-two-tone: 1) {
512
+ :where(.glass) {
513
+ --glass-tone-2: oklch(from var(--glass-tone) l c calc(h + 60));
514
+ }
279
515
  }
280
516
 
281
517
  /* Two-tone edge: border-color cannot gradient, so the border goes transparent
@@ -310,6 +546,9 @@
310
546
  * paints above its parent's own background and border; contain: layout anchors
311
547
  * them and makes the stacking context without repositioning the surface. */
312
548
  @container not style(--material-ink-level: 0) {
549
+ :where(.glass-halo) {
550
+ box-shadow: none;
551
+ }
313
552
  :where(.glass) {
314
553
  --ink-r: var(--radius);
315
554
  --ink-line: color-mix(
@@ -344,9 +583,9 @@
344
583
  linear-gradient(color-mix(in srgb, var(--surface-tone) var(--surface-wash), transparent) 0 0),
345
584
  linear-gradient(var(--glass-base) 0 0);
346
585
  }
347
- /* Above every widget layer (the SDK stacks to 30): full-bleed media would bury the line. */
586
+ /* Under the surface's content (a knob rides over its track's line); the widget shell lifts it. */
348
587
  :where(.glass)::after {
349
- z-index: 40;
588
+ z-index: -1;
350
589
  inset: 0;
351
590
  border: 3px solid var(--ink-line);
352
591
  border-radius: inherit;
@@ -217,14 +217,8 @@
217
217
  * the card and carry a solid --border edge, 1.39:1, at 1px instead of a slab. */
218
218
  --field: var(--card);
219
219
  --field-edge: var(--border);
220
- /* The knob says the state too: on wears --primary's hue, off stays inert
221
- * metal in the recessed well. Light reads lit by going darker than its pale
222
- * track, dark by going lighter; the hue is what carries across both. The
223
- * knob derives in its own scope (lib/thumb-classes.ts); --thumb-face-on is
224
- * the same expression at page scope, for anything else that reads it. */
225
- --thumb-on-l: 0.55;
226
- --thumb-on-c: 0.16;
227
- --thumb-face-on: oklch(from var(--primary) var(--thumb-on-l) min(c, var(--thumb-on-c)) h);
220
+ /* The off knob: inert metal in the recessed well, quieter than the lit one
221
+ * (--material-control-knob) on its accent track. */
228
222
  --thumb-face-off: oklch(0.62 0.015 250);
229
223
  --chart-1: oklch(0.7459 0.1483 156.4499);
230
224
  --chart-2: oklch(0.48 0.2 215.221);
@@ -237,7 +231,7 @@
237
231
  --font-caveat: "Caveat Variable", cursive;
238
232
  --font-bebas: "Bebas Neue", ui-sans-serif, system-ui, sans-serif;
239
233
  --radius: 1.4rem;
240
- /* The material tier; the studio writes these per theme (Frosted defaults). */
234
+ /* The material tier; the studio writes these per theme (Glass defaults). */
241
235
  --material-blur: 24px;
242
236
  --material-clarity: 60%;
243
237
  --material-depth: 1;
@@ -248,6 +242,30 @@
248
242
  --material-glow: 0px;
249
243
  --material-ink-level: 0;
250
244
  --material-ink-lift: 0;
245
+ --_material-vibrancy: 1;
246
+ --_material-edge: 1;
247
+ --_material-sheen: 1;
248
+ --_material-shadow: 1;
249
+ --_material-inset: 0;
250
+ --_material-light-cos: 1;
251
+ --_material-light-sin: 0;
252
+ --_material-rim-bottom: 0;
253
+ --_material-rim-around: 0;
254
+ --_material-glow-out: 1;
255
+ --_material-glow-in: 0;
256
+ --_material-inner-glow: 0;
257
+ --_material-inner-glow-hue: 1;
258
+ --_material-grain: none;
259
+ --_material-wash-split: 3;
260
+ --_material-wash-angle: 135deg;
261
+ --_material-two-tone: 0;
262
+ --_material-face-raised: 0;
263
+ --material-control-track: var(--input);
264
+ --material-control-fill: var(--material-accent);
265
+ --material-control-knob: oklch(1 0 0);
266
+ --_material-relief: 1;
267
+ --material-accent: var(--primary);
268
+ --_material-fill: 0;
251
269
  --material-ink: oklch(0.16 0 0);
252
270
  --shadow-x: 0px;
253
271
  --shadow-y: 2px;
@@ -330,11 +348,6 @@ html[data-motion="live"] {
330
348
  * and the glass formula's own soft edge. See the light block. */
331
349
  --field: var(--input);
332
350
  --field-edge: color-mix(in srgb, var(--border) 60%, transparent);
333
- /* Lit through hue, not brightness: a neutral knob this light read as the
334
- * loudest pixel in the row. Carries --primary's hue, so on ties to the rim. */
335
- --thumb-on-l: 0.78;
336
- --thumb-on-c: 0.1;
337
- --thumb-face-on: oklch(from var(--primary) var(--thumb-on-l) min(c, var(--thumb-on-c)) h);
338
351
  --thumb-face-off: oklch(0.45 0.015 250);
339
352
  --chart-1: oklch(0.8003 0.1821 151.711);
340
353
  --chart-2: oklch(0.48 0.2 215.221);