@glasshome/ui 1.18.0 → 1.19.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 (53) hide show
  1. package/SPEC.md +82 -1
  2. package/dist/index.js +2 -2
  3. package/dist/lib/button-variants.d.ts +3 -0
  4. package/dist/lib/card-classes.d.ts +4 -4
  5. package/dist/lib/motion-classes.d.ts +1 -0
  6. package/dist/lib/overlay-classes.d.ts +4 -2
  7. package/dist/lib/spotlight-geometry.d.ts +22 -0
  8. package/dist/solid/button.d.ts +8 -3
  9. package/dist/solid/dock.d.ts +9 -0
  10. package/dist/solid/docked-panel.d.ts +11 -0
  11. package/dist/solid/index.d.ts +6 -2
  12. package/dist/solid/index.js +4387 -4022
  13. package/dist/solid/option-card.d.ts +1 -1
  14. package/dist/solid/preview-tile.d.ts +33 -0
  15. package/dist/solid/spotlight.d.ts +14 -0
  16. package/dist/solid/swatch-picker.d.ts +12 -0
  17. package/dist/solid/tabs.d.ts +4 -1
  18. package/dist/solid/widget-identity.d.ts +2 -0
  19. package/dist/tokens/index.d.ts +1 -0
  20. package/dist/tokens/index.js +336 -118
  21. package/dist/tokens/material.d.ts +40 -0
  22. package/dist/tokens/presets.d.ts +3 -0
  23. package/dist/tokens/theme-colors.d.ts +13 -3
  24. package/dist/tokens/theme-recipe.d.ts +8 -0
  25. package/dist/{utils-COITV1s9.js → utils-CV6G6fr8.js} +618 -615
  26. package/package.json +2 -2
  27. package/src/lib/button-variants.ts +4 -3
  28. package/src/lib/card-classes.ts +4 -3
  29. package/src/lib/motion-classes.ts +5 -0
  30. package/src/lib/overlay-classes.ts +10 -2
  31. package/src/lib/spotlight-geometry.ts +90 -0
  32. package/src/solid/button.tsx +17 -2
  33. package/src/solid/dock.tsx +67 -9
  34. package/src/solid/docked-panel.tsx +56 -0
  35. package/src/solid/hero-action.tsx +2 -2
  36. package/src/solid/index.ts +11 -2
  37. package/src/solid/option-card.tsx +25 -31
  38. package/src/solid/preview-tile.tsx +79 -0
  39. package/src/solid/radio-group.tsx +7 -2
  40. package/src/solid/section-card.tsx +4 -2
  41. package/src/solid/sliding-indicator.tsx +13 -12
  42. package/src/solid/spotlight.tsx +179 -0
  43. package/src/solid/swatch-picker.tsx +47 -0
  44. package/src/solid/tabs.tsx +20 -4
  45. package/src/solid/toggle-group.tsx +1 -4
  46. package/src/solid/widget-identity.tsx +3 -1
  47. package/src/styles/globals.css +166 -14
  48. package/src/styles/theme.css +13 -0
  49. package/src/tokens/index.ts +1 -0
  50. package/src/tokens/material.ts +116 -0
  51. package/src/tokens/presets.ts +195 -56
  52. package/src/tokens/theme-colors.ts +15 -3
  53. package/src/tokens/theme-recipe.ts +18 -4
@@ -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
  },