@glasshome/ui 1.18.0 → 1.20.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.
Files changed (78) hide show
  1. package/SPEC.md +84 -2
  2. package/dist/index.js +2 -2
  3. package/dist/lib/anchor-placement.d.ts +5 -0
  4. package/dist/lib/button-variants.d.ts +4 -1
  5. package/dist/lib/card-classes.d.ts +4 -4
  6. package/dist/lib/motion-classes.d.ts +2 -0
  7. package/dist/lib/overlay-classes.d.ts +4 -2
  8. package/dist/lib/spotlight-geometry.d.ts +22 -0
  9. package/dist/solid/button.d.ts +8 -3
  10. package/dist/solid/color-disc.d.ts +33 -0
  11. package/dist/solid/dashboard-preview.d.ts +24 -0
  12. package/dist/solid/dialog-parts.d.ts +1 -0
  13. package/dist/solid/dialog.d.ts +3 -0
  14. package/dist/solid/dock.d.ts +9 -0
  15. package/dist/solid/docked-panel.d.ts +11 -0
  16. package/dist/solid/image-picker.d.ts +3 -0
  17. package/dist/solid/index.d.ts +9 -3
  18. package/dist/solid/index.js +6254 -5475
  19. package/dist/solid/media-store.d.ts +10 -0
  20. package/dist/solid/option-card.d.ts +2 -1
  21. package/dist/solid/page-header.d.ts +2 -2
  22. package/dist/solid/preview-tile.d.ts +35 -0
  23. package/dist/solid/responsive-dialog.d.ts +2 -0
  24. package/dist/solid/schema-form.d.ts +6 -1
  25. package/dist/solid/sliding-indicator.d.ts +2 -0
  26. package/dist/solid/spotlight.d.ts +14 -0
  27. package/dist/solid/swatch-picker.d.ts +12 -0
  28. package/dist/solid/tabs.d.ts +4 -1
  29. package/dist/solid/toggle-group.d.ts +4 -1
  30. package/dist/solid/widget-identity.d.ts +2 -0
  31. package/dist/tokens/index.d.ts +1 -0
  32. package/dist/tokens/index.js +336 -118
  33. package/dist/tokens/material.d.ts +40 -0
  34. package/dist/tokens/presets.d.ts +3 -0
  35. package/dist/tokens/theme-colors.d.ts +13 -3
  36. package/dist/tokens/theme-recipe.d.ts +8 -0
  37. package/dist/{utils-COITV1s9.js → utils-CMk7R3zM.js} +488 -485
  38. package/package.json +2 -2
  39. package/scripts/check-ui-drift.mjs +5 -0
  40. package/src/lib/anchor-placement.ts +30 -0
  41. package/src/lib/button-variants.ts +13 -12
  42. package/src/lib/card-classes.ts +4 -3
  43. package/src/lib/motion-classes.ts +10 -0
  44. package/src/lib/overlay-classes.ts +10 -2
  45. package/src/lib/spotlight-geometry.ts +90 -0
  46. package/src/solid/bottom-sheet/bottom-sheet.tsx +8 -1
  47. package/src/solid/button.tsx +17 -2
  48. package/src/solid/color-disc.tsx +253 -0
  49. package/src/solid/dashboard-preview.tsx +128 -0
  50. package/src/solid/dialog-parts.tsx +5 -1
  51. package/src/solid/dialog.tsx +47 -5
  52. package/src/solid/dock.tsx +67 -9
  53. package/src/solid/docked-panel.tsx +56 -0
  54. package/src/solid/entity-selector.tsx +2 -2
  55. package/src/solid/hero-action.tsx +2 -2
  56. package/src/solid/image-picker.tsx +232 -147
  57. package/src/solid/index.ts +20 -2
  58. package/src/solid/media-store.ts +20 -1
  59. package/src/solid/option-card.tsx +27 -31
  60. package/src/solid/page-header.tsx +9 -16
  61. package/src/solid/preview-tile.tsx +89 -0
  62. package/src/solid/radio-group.tsx +7 -2
  63. package/src/solid/responsive-dialog.tsx +10 -2
  64. package/src/solid/schema-form.tsx +30 -4
  65. package/src/solid/section-card.tsx +4 -2
  66. package/src/solid/sliding-indicator.tsx +34 -17
  67. package/src/solid/spotlight.tsx +179 -0
  68. package/src/solid/swatch-picker.tsx +47 -0
  69. package/src/solid/tabs.tsx +20 -4
  70. package/src/solid/toggle-group.tsx +43 -8
  71. package/src/solid/widget-identity.tsx +3 -1
  72. package/src/styles/globals.css +166 -14
  73. package/src/styles/theme.css +25 -3
  74. package/src/tokens/index.ts +1 -0
  75. package/src/tokens/material.ts +116 -0
  76. package/src/tokens/presets.ts +195 -56
  77. package/src/tokens/theme-colors.ts +15 -3
  78. package/src/tokens/theme-recipe.ts +18 -4
@@ -68,10 +68,13 @@
68
68
 
69
69
  /* Trigger morph: the panel is anchored over the trigger's top edge and starts
70
70
  * clipped to the trigger's own box and radius (--morph-w/h/radius, written by
71
- * the content from its trigger), then unrolls into its own box. The pill
71
+ * the content from its trigger; --morph-x/y when the panel had to shift off
72
+ * the trigger's corner to stay on screen), then unrolls into its own box. The pill
72
73
  * becomes the panel; nothing scales, so no row or radius distorts. */
73
74
  --animate-morph-in: morph-in var(--duration-morph) var(--ease-morph) both;
74
75
  --animate-morph-out: morph-out calc(var(--duration-morph) / 2) var(--ease-contract) both;
76
+ /* Unfilled once done, so the anchored panel's clip lets go and its shadow shows. */
77
+ --animate-anchored-in: morph-in var(--duration-morph) var(--ease-morph) backwards;
75
78
  }
76
79
 
77
80
  @keyframes collapsible-down {
@@ -120,7 +123,8 @@
120
123
  from {
121
124
  opacity: 0;
122
125
  clip-path: inset(
123
- 0 calc(100% - var(--morph-w, 100%)) calc(100% - var(--morph-h, 2.5rem)) 0 round
126
+ var(--morph-y, 0px) calc(100% - var(--morph-x, 0px) - var(--morph-w, 100%))
127
+ calc(100% - var(--morph-y, 0px) - var(--morph-h, 2.5rem)) var(--morph-x, 0px) round
124
128
  var(--morph-radius, 9999px)
125
129
  );
126
130
  pointer-events: none;
@@ -145,7 +149,8 @@
145
149
  to {
146
150
  opacity: 0;
147
151
  clip-path: inset(
148
- 0 calc(100% - var(--morph-w, 100%)) calc(100% - var(--morph-h, 2.5rem)) 0 round
152
+ var(--morph-y, 0px) calc(100% - var(--morph-x, 0px) - var(--morph-w, 100%))
153
+ calc(100% - var(--morph-y, 0px) - var(--morph-h, 2.5rem)) var(--morph-x, 0px) round
149
154
  var(--morph-radius, 9999px)
150
155
  );
151
156
  }
@@ -232,6 +237,18 @@
232
237
  --font-caveat: "Caveat Variable", cursive;
233
238
  --font-bebas: "Bebas Neue", ui-sans-serif, system-ui, sans-serif;
234
239
  --radius: 1.4rem;
240
+ /* The material tier; the studio writes these per theme (Frosted defaults). */
241
+ --material-blur: 24px;
242
+ --material-clarity: 60%;
243
+ --material-depth: 1;
244
+ --material-tint: 1;
245
+ --material-edge-width: 1px;
246
+ --material-edge-ink: 0;
247
+ --material-edge-accent: 0;
248
+ --material-glow: 0px;
249
+ --material-ink-level: 0;
250
+ --material-ink-lift: 0;
251
+ --material-ink: oklch(0.16 0 0);
235
252
  --shadow-x: 0px;
236
253
  --shadow-y: 2px;
237
254
  --shadow-blur: 3px;
@@ -342,6 +359,7 @@ html[data-motion="live"] {
342
359
  --shadow-lg: 0px 2px 3px 0px hsl(0 0% 0% / 0.16), 0px 4px 6px -1px hsl(0 0% 0% / 0.16);
343
360
  --shadow-xl: 0px 2px 3px 0px hsl(0 0% 0% / 0.16), 0px 8px 10px -1px hsl(0 0% 0% / 0.16);
344
361
  --shadow-2xl: 0px 2px 3px 0px hsl(0 0% 0% / 0.4);
362
+ --material-ink: oklch(0.68 0 0);
345
363
  }
346
364
 
347
365
  @layer base {
@@ -570,6 +588,10 @@ html[data-motion="live"] {
570
588
  backdrop-filter: none !important;
571
589
  -webkit-backdrop-filter: none !important;
572
590
  }
591
+ /* A control that cannot blur takes the opaque card fill, never bare see-through. */
592
+ .reduce-blur .glass-control {
593
+ --glass-base: var(--card);
594
+ }
573
595
 
574
596
  /* Accessibility: minimize animations/transitions when reduce-motion is active */
575
597
  .reduce-motion,
@@ -4,6 +4,7 @@
4
4
  */
5
5
 
6
6
  export * from "./hex.js";
7
+ export * from "./material.js";
7
8
  export * from "./presets.js";
8
9
  export * from "./readability.js";
9
10
  export * from "./theme-colors.js";
@@ -0,0 +1,116 @@
1
+ import { clamp } from "./theme-colors.js";
2
+
3
+ export const MATERIAL_VERSION = 1;
4
+
5
+ export type MaterialPresetId = "frosted" | "paper" | "neon" | "chalk";
6
+
7
+ /** Tier 2 of the glass formula: what every surface's knobs are multiplied by. The homeowner's dials. */
8
+ export interface MaterialDials {
9
+ /** Backdrop blur radius, px. */
10
+ blur: number;
11
+ /** How much of the card colour a surface keeps, %; the rest is the wallpaper. */
12
+ clarity: number;
13
+ /** Scales sheen, shade, rim and lift together. */
14
+ depth: number;
15
+ /** Scales the tone wash. */
16
+ tint: number;
17
+ /** Outer bloom radius in the surface's own hue, px. */
18
+ glow: number;
19
+ /** 0..1; above 0 every surface is hand-inked: a drawn line over a hand-laid fill. */
20
+ ink: number;
21
+ }
22
+
23
+ /** Terms a preset turns on; inert at zero, never a homeowner dial. */
24
+ export interface MaterialTerms {
25
+ /** Edge width, px. */
26
+ edgeWidth: number;
27
+ /** 0..1, how far the edge moves toward the material ink. */
28
+ edgeInk: number;
29
+ /** 0..1, how far the edge moves toward the surface's own hue (its tone, else the accent). */
30
+ edgeAccent: number;
31
+ /** 0..1, how far the Ink line moves from the mode's ink toward the foreground: chalk on a dark board. */
32
+ inkLift: number;
33
+ }
34
+
35
+ export type MaterialSpec = MaterialDials & MaterialTerms;
36
+
37
+ /** What was chosen, never what was computed. */
38
+ export interface Material {
39
+ v: typeof MATERIAL_VERSION;
40
+ preset: MaterialPresetId;
41
+ dials?: Partial<MaterialDials>;
42
+ }
43
+
44
+ export type BlurMode = "dynamic" | "performant" | "none";
45
+
46
+ const PLAIN: MaterialTerms = { edgeWidth: 1, edgeInk: 0, edgeAccent: 0, inkLift: 0 };
47
+
48
+ export const MATERIAL_PRESETS: Record<MaterialPresetId, MaterialSpec> = {
49
+ /** Today's glass: translucent, blurred, lit rim. */
50
+ frosted: { blur: 24, clarity: 60, depth: 1, tint: 1, glow: 0, ink: 0, ...PLAIN },
51
+ /** Opaque matte stock, a faint inked cut edge, calm tint; the Ink dial draws on it. */
52
+ paper: { blur: 0, clarity: 100, depth: 0.5, tint: 0.85, glow: 0, ink: 0, ...PLAIN, edgeInk: 0.3 },
53
+ /** Near-opaque dark tile, thin tube of its own hue at the edge, bloom around it. */
54
+ neon: {
55
+ blur: 8,
56
+ clarity: 92,
57
+ depth: 0.4,
58
+ tint: 0.9,
59
+ edgeWidth: 1.5,
60
+ edgeInk: 0,
61
+ edgeAccent: 1,
62
+ inkLift: 0,
63
+ glow: 18,
64
+ ink: 0,
65
+ },
66
+ /** Matte board, the Ink body drawn in the foreground colour. */
67
+ chalk: { blur: 0, clarity: 100, depth: 0.3, tint: 0.7, glow: 0, ink: 1, ...PLAIN, inkLift: 1 },
68
+ };
69
+
70
+ export const FROSTED: Material = { v: 1, preset: "frosted" };
71
+
72
+ const RANGE: Record<keyof MaterialDials, [number, number]> = {
73
+ blur: [0, 48],
74
+ clarity: [0, 100],
75
+ depth: [0, 2],
76
+ tint: [0, 2],
77
+ glow: [0, 40],
78
+ ink: [0, 1],
79
+ };
80
+
81
+ /** Below this the text floor fails over a busy wallpaper with nothing blurred behind it. */
82
+ const NO_BLUR_CLARITY_FLOOR = 85;
83
+
84
+ export function materialDials(material: Material): MaterialDials {
85
+ const merged = { ...MATERIAL_PRESETS[material.preset], ...material.dials };
86
+ return {
87
+ blur: clamp(merged.blur, ...RANGE.blur),
88
+ clarity: clamp(merged.clarity, ...RANGE.clarity),
89
+ depth: clamp(merged.depth, ...RANGE.depth),
90
+ tint: clamp(merged.tint, ...RANGE.tint),
91
+ glow: clamp(merged.glow, ...RANGE.glow),
92
+ ink: clamp(merged.ink, ...RANGE.ink),
93
+ };
94
+ }
95
+
96
+ export function resolveMaterial(
97
+ material: Material,
98
+ blurMode: BlurMode,
99
+ ): Record<`--material-${string}`, string> {
100
+ const d = materialDials(material);
101
+ const t = MATERIAL_PRESETS[material.preset];
102
+ const blur = blurMode === "none" ? 0 : d.blur;
103
+ const clarity = blurMode === "none" ? Math.max(d.clarity, NO_BLUR_CLARITY_FLOOR) : d.clarity;
104
+ return {
105
+ "--material-blur": `${blur}px`,
106
+ "--material-clarity": `${clarity}%`,
107
+ "--material-depth": `${d.depth}`,
108
+ "--material-tint": `${d.tint}`,
109
+ "--material-edge-width": `${t.edgeWidth}px`,
110
+ "--material-edge-ink": `${t.edgeInk}`,
111
+ "--material-edge-accent": `${t.edgeAccent}`,
112
+ "--material-glow": `${d.glow}px`,
113
+ "--material-ink-level": `${d.ink}`,
114
+ "--material-ink-lift": `${t.inkLift}`,
115
+ };
116
+ }
@@ -1,3 +1,4 @@
1
+ import type { Material } from "./material.js";
1
2
  import {
2
3
  type BackgroundConfig,
3
4
  deriveDarkFromLight,
@@ -14,6 +15,8 @@ export interface ThemePreset {
14
15
  background: BackgroundConfig;
15
16
  /** Curated two-stop gradient used for theme picker dots and marketing swatches. */
16
17
  swatch: [string, string];
18
+ /** Absent: Frosted. */
19
+ material?: Material;
17
20
  }
18
21
 
19
22
  export const DEFAULT_THEME_ID = "midnight-glass";
@@ -22,9 +25,21 @@ export const DEFAULT_THEME_ID = "midnight-glass";
22
25
  export const FONT_SANS = '"Geist Variable", ui-sans-serif, system-ui, sans-serif';
23
26
  export const FONT_MONO = '"GeistMono Variable", "JetBrains Mono", "Fira Code", Consolas, monospace';
24
27
 
25
- function bg(id: string, options?: { url?: string; themed?: boolean }): BackgroundConfig {
28
+ function bg(
29
+ id: string,
30
+ options?: {
31
+ url?: string;
32
+ themed?: boolean;
33
+ night?: string;
34
+ overlay?: number;
35
+ blur?: number;
36
+ vignette?: number;
37
+ },
38
+ ): BackgroundConfig {
26
39
  const type = id === "default" ? "solid" : "static";
27
- return { type, id, themed: options?.themed ?? true, url: options?.url };
40
+ const dark = options?.night ? { type: "static" as const, id: options.night } : undefined;
41
+ const { url, overlay, blur, vignette } = options ?? {};
42
+ return { type, id, themed: options?.themed ?? true, url, dark, overlay, blur, vignette };
28
43
  }
29
44
 
30
45
  function preset(
@@ -35,12 +50,14 @@ function preset(
35
50
  light: ThemeBaseColors,
36
51
  background: BackgroundConfig,
37
52
  dark?: ThemeBaseColors,
53
+ material?: Material,
38
54
  ): ThemePreset {
39
55
  return {
40
56
  id,
41
57
  name,
42
58
  radius,
43
59
  swatch,
60
+ material,
44
61
  colors: {
45
62
  light: resolveThemeColors(light, "light"),
46
63
  dark: dark ? resolveThemeColors(dark, "dark") : deriveDarkFromLight(light),
@@ -89,97 +106,219 @@ export const THEME_PRESETS: ThemePreset[] = [
89
106
  destructive: "oklch(0.7106 0.1661 22.2162)",
90
107
  },
91
108
  },
92
- background: bg("geometric-houses", { url: "/backgrounds/geometric-houses.svg" }),
109
+ background: bg("glass-house", {
110
+ url: "/backgrounds/glass-house.webp",
111
+ themed: false,
112
+ night: "glass-house-night",
113
+ vignette: 0.65,
114
+ }),
93
115
  },
94
116
  preset(
95
117
  "sunrise-studio",
96
118
  "Sunrise Studio",
97
119
  1.1,
98
- ["#e8590c", "#fab005"],
120
+ ["#e8590c", "#f7e3c6"],
121
+ {
122
+ primary: "oklch(0.56 0.13 48)",
123
+ accent: "oklch(0.54 0.11 35)",
124
+ secondary: "oklch(0.93 0.02 70)",
125
+ border: "oklch(0.84 0.025 65)",
126
+ card: "oklch(0.99 0.008 75)",
127
+ background: "oklch(0.945 0.02 72)",
128
+ },
129
+ bg("studio-geometric", {
130
+ url: "/backgrounds/studio-geometric.svg",
131
+ night: "studio-night",
132
+ }),
99
133
  {
100
- primary: "oklch(0.68 0.16 50)",
101
- accent: "oklch(0.74 0.14 28)",
102
- secondary: "oklch(0.92 0.04 82)",
103
- border: "oklch(0.84 0.03 78)",
104
- card: "oklch(0.96 0.02 85)",
105
- background: "oklch(0.985 0.01 90)",
134
+ primary: "oklch(0.78 0.11 62)",
135
+ accent: "oklch(0.72 0.1 42)",
136
+ secondary: "oklch(0.3 0.025 55)",
137
+ border: "oklch(0.4 0.03 55)",
138
+ card: "oklch(0.27 0.025 55)",
139
+ background: "oklch(0.17 0.022 55)",
106
140
  },
107
- bg("diagonal-stripes"),
141
+ { v: 1, preset: "paper" },
108
142
  ),
109
143
  preset(
110
144
  "forest-zen",
111
145
  "Forest Zen",
112
146
  1.6,
113
- ["#2f9e44", "#12b886"],
147
+ ["#2b8a3e", "#a9c7b0"],
114
148
  {
115
- primary: "oklch(0.58 0.13 145)",
116
- accent: "oklch(0.66 0.1 165)",
117
- secondary: "oklch(0.9 0.03 150)",
118
- border: "oklch(0.82 0.02 155)",
119
- card: "oklch(0.95 0.01 150)",
120
- background: "oklch(0.98 0.01 160)",
149
+ primary: "oklch(0.5 0.12 150)",
150
+ accent: "oklch(0.5 0.09 170)",
151
+ secondary: "oklch(0.92 0.025 150)",
152
+ border: "oklch(0.83 0.02 155)",
153
+ card: "oklch(0.99 0.008 150)",
154
+ background: "oklch(0.945 0.015 160)",
121
155
  },
122
- bg("trees"),
156
+ bg("forest-mist", {
157
+ url: "/backgrounds/forest-mist.webp",
158
+ themed: false,
159
+ night: "forest-mist-night",
160
+ vignette: 0.65,
161
+ }),
162
+ {
163
+ primary: "oklch(0.74 0.12 150)",
164
+ accent: "oklch(0.72 0.08 175)",
165
+ secondary: "oklch(0.24 0.025 160)",
166
+ border: "oklch(0.33 0.025 160)",
167
+ card: "oklch(0.25 0.02 160)",
168
+ background: "oklch(0.15 0.02 165)",
169
+ },
170
+ { v: 1, preset: "frosted", dials: { clarity: 82 } },
123
171
  ),
124
172
  preset(
125
173
  "lavender-dreams",
126
174
  "Lavender Dreams",
127
175
  1.8,
128
- ["#9c36b5", "#e64980"],
176
+ ["#845ef7", "#fff4e6"],
177
+ {
178
+ primary: "oklch(0.5 0.14 305)",
179
+ accent: "oklch(0.52 0.12 325)",
180
+ secondary: "oklch(0.93 0.025 300)",
181
+ border: "oklch(0.85 0.025 300)",
182
+ card: "oklch(0.975 0.012 90)",
183
+ background: "oklch(0.97 0.015 85)",
184
+ },
185
+ bg("lavender-ink"),
129
186
  {
130
- primary: "oklch(0.62 0.14 300)",
131
- accent: "oklch(0.7 0.12 320)",
132
- secondary: "oklch(0.93 0.03 290)",
133
- border: "oklch(0.85 0.03 295)",
134
- card: "oklch(0.97 0.02 300)",
135
- background: "oklch(0.99 0.01 305)",
187
+ primary: "oklch(0.76 0.12 305)",
188
+ accent: "oklch(0.76 0.1 325)",
189
+ secondary: "oklch(0.26 0.04 310)",
190
+ border: "oklch(0.36 0.045 310)",
191
+ card: "oklch(0.23 0.045 312)",
192
+ background: "oklch(0.18 0.045 315)",
136
193
  },
137
- bg("streets", { url: "/backgrounds/streets.svg" }),
194
+ { v: 1, preset: "paper", dials: { ink: 1 } },
138
195
  ),
139
196
  preset(
140
197
  "coral-reef",
141
- "Coral Reef",
142
- 1.25,
143
- ["#e03131", "#fd7e14"],
144
- {
145
- primary: "oklch(0.66 0.19 20)",
146
- accent: "oklch(0.7 0.16 45)",
147
- secondary: "oklch(0.91 0.04 35)",
148
- border: "oklch(0.83 0.03 28)",
149
- card: "oklch(0.96 0.02 25)",
150
- background: "oklch(0.985 0.01 30)",
151
- },
152
- bg("beauty-over-cliff", { url: "/backgrounds/beauty-over-cliff.jpg", themed: false }),
198
+ "Liquid Glass",
199
+ 0.9,
200
+ ["#0e1426", "#5fd4e8"],
201
+ {
202
+ primary: "oklch(0.5 0.11 225)",
203
+ accent: "oklch(0.52 0.16 345)",
204
+ secondary: "oklch(0.93 0.008 260)",
205
+ border: "oklch(0.85 0.012 260)",
206
+ card: "oklch(0.99 0.004 260)",
207
+ background: "oklch(0.94 0.008 260)",
208
+ },
209
+ bg("liquid-glass-day", {
210
+ url: "/backgrounds/liquid-glass-day.webp",
211
+ themed: false,
212
+ night: "liquid-glass",
213
+ }),
214
+ {
215
+ primary: "oklch(0.78 0.11 210)",
216
+ accent: "oklch(0.72 0.16 340)",
217
+ secondary: "oklch(0.25 0.03 265)",
218
+ border: "oklch(0.36 0.035 265)",
219
+ card: "oklch(0.24 0.03 265)",
220
+ background: "oklch(0.13 0.03 268)",
221
+ },
222
+ { v: 1, preset: "frosted" },
153
223
  ),
154
224
  preset(
155
225
  "monochrome-pro",
156
226
  "Monochrome Pro",
157
227
  0,
158
- ["#868e96", "#495057"],
228
+ ["#e9ecef", "#343a40"],
229
+ {
230
+ primary: "oklch(0.32 0.01 260)",
231
+ accent: "oklch(0.4 0.01 260)",
232
+ secondary: "oklch(0.93 0.004 260)",
233
+ border: "oklch(0.8 0.004 260)",
234
+ card: "oklch(0.99 0.002 260)",
235
+ background: "oklch(0.955 0.003 260)",
236
+ },
237
+ bg("monochrome-blocks", {
238
+ url: "/backgrounds/monochrome-blocks.svg",
239
+ night: "monochrome-night",
240
+ }),
159
241
  {
160
- primary: "oklch(0.4 0.01 260)",
161
- accent: "oklch(0.55 0.01 260)",
162
- secondary: "oklch(0.94 0.005 260)",
163
- border: "oklch(0.86 0.005 260)",
164
- card: "oklch(0.98 0.003 260)",
165
- background: "oklch(0.995 0.002 260)",
242
+ primary: "oklch(0.9 0.005 260)",
243
+ accent: "oklch(0.82 0.005 260)",
244
+ secondary: "oklch(0.24 0.004 260)",
245
+ border: "oklch(0.36 0.004 260)",
246
+ card: "oklch(0.2 0.003 260)",
247
+ background: "oklch(0.14 0.003 260)",
166
248
  },
167
- bg("grid"),
249
+ { v: 1, preset: "paper" },
168
250
  ),
169
251
  preset(
170
252
  "ocean-breeze",
171
- "Ocean Breeze",
253
+ "Tide",
172
254
  1.5,
173
- ["#1098ad", "#3b5bdb"],
255
+ ["#2b4a8b", "#efe6d2"],
256
+ {
257
+ primary: "oklch(0.42 0.12 262)",
258
+ accent: "oklch(0.48 0.09 225)",
259
+ secondary: "oklch(0.93 0.015 85)",
260
+ border: "oklch(0.84 0.02 80)",
261
+ card: "oklch(0.975 0.012 85)",
262
+ background: "oklch(0.955 0.018 85)",
263
+ },
264
+ bg("tide-waves"),
265
+ {
266
+ primary: "oklch(0.78 0.09 235)",
267
+ accent: "oklch(0.76 0.08 205)",
268
+ secondary: "oklch(0.26 0.04 262)",
269
+ border: "oklch(0.36 0.045 262)",
270
+ card: "oklch(0.23 0.045 262)",
271
+ background: "oklch(0.18 0.05 262)",
272
+ },
273
+ { v: 1, preset: "paper" },
274
+ ),
275
+ preset(
276
+ "chalkboard",
277
+ "Chalkboard",
278
+ 1.2,
279
+ ["#2f4a40", "#f2e6a0"],
280
+ {
281
+ primary: "oklch(0.48 0.13 255)",
282
+ accent: "oklch(0.5 0.1 165)",
283
+ secondary: "oklch(0.9 0.012 165)",
284
+ border: "oklch(0.8 0.015 165)",
285
+ card: "oklch(0.965 0.006 165)",
286
+ background: "oklch(0.93 0.012 165)",
287
+ },
288
+ bg("chalkboard"),
289
+ {
290
+ primary: "oklch(0.88 0.12 95)",
291
+ accent: "oklch(0.8 0.09 220)",
292
+ secondary: "oklch(0.29 0.025 165)",
293
+ border: "oklch(0.43 0.02 165)",
294
+ card: "oklch(0.28 0.028 165)",
295
+ background: "oklch(0.22 0.03 165)",
296
+ },
297
+ { v: 1, preset: "chalk" },
298
+ ),
299
+ preset(
300
+ "retrowave",
301
+ "Retrowave",
302
+ 1.2,
303
+ ["#ff2bd6", "#35e0ff"],
304
+ {
305
+ primary: "oklch(0.58 0.24 345)",
306
+ accent: "oklch(0.6 0.14 215)",
307
+ secondary: "oklch(0.93 0.03 320)",
308
+ border: "oklch(0.84 0.04 320)",
309
+ card: "oklch(0.96 0.02 320)",
310
+ background: "oklch(0.98 0.015 320)",
311
+ },
312
+ bg("sunset-grid", { url: "/backgrounds/sunset-grid.svg" }),
174
313
  {
175
- primary: "oklch(0.6 0.16 235)",
176
- accent: "oklch(0.68 0.11 205)",
177
- secondary: "oklch(0.92 0.03 225)",
178
- border: "oklch(0.84 0.02 230)",
179
- card: "oklch(0.97 0.01 230)",
180
- background: "oklch(0.99 0.01 235)",
314
+ primary: "oklch(0.68 0.27 345)",
315
+ accent: "oklch(0.8 0.14 205)",
316
+ secondary: "oklch(0.2 0.06 290)",
317
+ border: "oklch(0.34 0.1 300)",
318
+ card: "oklch(0.19 0.07 290)",
319
+ background: "oklch(0.13 0.06 285)",
181
320
  },
182
- bg("abstract-pattern", { url: "/backgrounds/ride-the-wave.svg" }),
321
+ { v: 1, preset: "neon", dials: { glow: 14 } },
183
322
  ),
184
323
  ];
185
324
 
@@ -23,14 +23,26 @@ export interface ThemeColorsConfig {
23
23
  dark: ThemeColors;
24
24
  }
25
25
 
26
- export interface BackgroundConfig {
26
+ export interface BackgroundLayer {
27
27
  type: "solid" | "static" | "custom";
28
28
  id: string;
29
- themed: boolean;
30
- url?: string;
31
29
  fit?: "cover" | "contain" | "tile";
30
+ /** 0 to 1: how far the wallpaper fades toward `--background`. */
32
31
  overlay?: number;
32
+ /** 0 to 20, in px. */
33
33
  blur?: number;
34
+ /** 0 to 1: how dark the corners fall. */
35
+ vignette?: number;
36
+ }
37
+
38
+ /** The picture alone; visibility and softness belong to the theme, the same in both modes. */
39
+ export type BackgroundImage = Pick<BackgroundLayer, "type" | "id" | "fit">;
40
+
41
+ export interface BackgroundConfig extends BackgroundLayer {
42
+ themed: boolean;
43
+ url?: string;
44
+ /** Shown in dark mode instead of the top-level picture. */
45
+ dark?: BackgroundImage;
34
46
  }
35
47
 
36
48
  /** The 6 base colors used as input for resolving a full ThemeColors */
@@ -1,3 +1,4 @@
1
+ import type { Material } from "./material.js";
1
2
  import { findUnreadable, fixReadable } from "./readability.js";
2
3
  import {
3
4
  type BackgroundConfig,
@@ -13,6 +14,15 @@ import {
13
14
 
14
15
  export const RECIPE_VERSION = 1;
15
16
 
17
+ /** The studio's glass tint: `auto` follows the background picture; the rest are fixed surfaces. */
18
+ export type GlassTint = "auto" | "cool" | "neutral" | "warm";
19
+
20
+ export const TINT_SURFACES: Record<Exclude<GlassTint, "auto">, string> = {
21
+ cool: "oklch(0.965 0.02 240)",
22
+ neutral: "oklch(0.97 0 0)",
23
+ warm: "oklch(0.965 0.025 75)",
24
+ };
25
+
16
26
  type Mode = "light" | "dark";
17
27
 
18
28
  /** What was chosen, never what was computed: a stored theme re-derives on read. */
@@ -28,6 +38,10 @@ export interface ThemeRecipe {
28
38
  darkLinked: boolean;
29
39
  /** Hand-set colors only; everything absent is derived. */
30
40
  set: { light: Partial<ThemeColors>; dark: Partial<ThemeColors> };
41
+ /** What the studio's tint choice was; `surface` stays the value the math reads. Absent is a hand-set surface. */
42
+ tint?: GlassTint;
43
+ /** The glass material; absent is Frosted, so no stored theme moved when this arrived. */
44
+ material?: Material;
31
45
  }
32
46
 
33
47
  interface Step {
@@ -50,10 +64,10 @@ const LADDER_V1: Record<
50
64
  accent: { l: 0.05, c: 0.85 },
51
65
  },
52
66
  dark: {
53
- ground: { lTo: 0.14, c: 1.5, cMax: 0.04 },
54
- card: { lTo: 0.18, c: 1.5, cMax: 0.04 },
55
- border: { lTo: 0.26, c: 1.5, cMax: 0.05 },
56
- secondary: { lTo: 0.21, c: 1.5, cMax: 0.04 },
67
+ ground: { lTo: 0.15, c: 2.6, cMax: 0.07 },
68
+ card: { lTo: 0.19, c: 2.6, cMax: 0.07 },
69
+ border: { lTo: 0.27, c: 2.6, cMax: 0.08 },
70
+ secondary: { lTo: 0.22, c: 2.6, cMax: 0.07 },
57
71
  primary: { l: 0.08 },
58
72
  accent: { l: 0.12, c: 0.85 },
59
73
  },