@glasshome/ui 1.17.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.
- package/SPEC.md +83 -2
- package/dist/index.js +2 -2
- package/dist/lib/button-variants.d.ts +4 -1
- package/dist/lib/card-classes.d.ts +4 -4
- package/dist/lib/motion-classes.d.ts +1 -0
- package/dist/lib/overlay-classes.d.ts +4 -2
- package/dist/lib/pill-classes.d.ts +1 -1
- package/dist/lib/spotlight-geometry.d.ts +22 -0
- package/dist/lib/thumb-classes.d.ts +1 -0
- package/dist/lib/tier-badge.d.ts +1 -1
- package/dist/solid/button.d.ts +8 -3
- package/dist/solid/dock.d.ts +9 -0
- package/dist/solid/docked-panel.d.ts +11 -0
- package/dist/solid/index.d.ts +6 -2
- package/dist/solid/index.js +4399 -4034
- package/dist/solid/option-card.d.ts +1 -1
- package/dist/solid/preview-tile.d.ts +33 -0
- package/dist/solid/spotlight.d.ts +14 -0
- package/dist/solid/swatch-picker.d.ts +12 -0
- package/dist/solid/tabs.d.ts +4 -1
- package/dist/solid/widget-identity.d.ts +2 -0
- package/dist/tokens/index.d.ts +3 -0
- package/dist/tokens/index.js +481 -67
- package/dist/tokens/material.d.ts +40 -0
- package/dist/tokens/presets.d.ts +3 -0
- package/dist/tokens/readability.d.ts +21 -0
- package/dist/tokens/theme-colors.d.ts +13 -3
- package/dist/tokens/theme-recipe.d.ts +33 -0
- package/dist/{utils-DMaksjvy.js → utils-CV6G6fr8.js} +343 -340
- package/package.json +2 -2
- package/src/lib/button-variants.ts +10 -7
- package/src/lib/card-classes.ts +4 -3
- package/src/lib/motion-classes.ts +5 -0
- package/src/lib/overlay-classes.ts +10 -2
- package/src/lib/pill-classes.ts +4 -3
- package/src/lib/spotlight-geometry.ts +90 -0
- package/src/lib/thumb-classes.ts +7 -0
- package/src/lib/tier-badge.ts +1 -1
- package/src/solid/button.tsx +17 -2
- package/src/solid/carousel.tsx +2 -2
- package/src/solid/data-table.tsx +2 -2
- package/src/solid/dock.tsx +67 -9
- package/src/solid/docked-panel.tsx +56 -0
- package/src/solid/hero-action.tsx +2 -2
- package/src/solid/icon-picker.tsx +1 -1
- package/src/solid/index.ts +11 -2
- package/src/solid/media-tile.tsx +1 -1
- package/src/solid/option-card.tsx +25 -31
- package/src/solid/preview-tile.tsx +79 -0
- package/src/solid/radio-group.tsx +7 -2
- package/src/solid/section-card.tsx +4 -2
- package/src/solid/sliding-indicator.tsx +13 -12
- package/src/solid/spotlight.tsx +179 -0
- package/src/solid/swatch-picker.tsx +47 -0
- package/src/solid/switch.tsx +5 -2
- package/src/solid/tabs.tsx +20 -4
- package/src/solid/toggle-group.tsx +1 -4
- package/src/solid/widget-identity.tsx +3 -1
- package/src/styles/globals.css +166 -14
- package/src/styles/theme.css +22 -3
- package/src/tokens/index.ts +3 -0
- package/src/tokens/material.ts +116 -0
- package/src/tokens/presets.ts +201 -62
- package/src/tokens/readability.ts +67 -0
- package/src/tokens/theme-colors.ts +15 -3
- package/src/tokens/theme-recipe.ts +161 -0
package/dist/tokens/index.js
CHANGED
|
@@ -100,22 +100,120 @@ function h(e) {
|
|
|
100
100
|
return e.toString(16).padStart(2, "0");
|
|
101
101
|
}
|
|
102
102
|
//#endregion
|
|
103
|
+
//#region src/tokens/material.ts
|
|
104
|
+
var g = 1, _ = {
|
|
105
|
+
edgeWidth: 1,
|
|
106
|
+
edgeInk: 0,
|
|
107
|
+
edgeAccent: 0,
|
|
108
|
+
inkLift: 0
|
|
109
|
+
}, v = {
|
|
110
|
+
frosted: {
|
|
111
|
+
blur: 24,
|
|
112
|
+
clarity: 60,
|
|
113
|
+
depth: 1,
|
|
114
|
+
tint: 1,
|
|
115
|
+
glow: 0,
|
|
116
|
+
ink: 0,
|
|
117
|
+
..._
|
|
118
|
+
},
|
|
119
|
+
paper: {
|
|
120
|
+
blur: 0,
|
|
121
|
+
clarity: 100,
|
|
122
|
+
depth: .5,
|
|
123
|
+
tint: .85,
|
|
124
|
+
glow: 0,
|
|
125
|
+
ink: 0,
|
|
126
|
+
..._,
|
|
127
|
+
edgeInk: .3
|
|
128
|
+
},
|
|
129
|
+
neon: {
|
|
130
|
+
blur: 8,
|
|
131
|
+
clarity: 92,
|
|
132
|
+
depth: .4,
|
|
133
|
+
tint: .9,
|
|
134
|
+
edgeWidth: 1.5,
|
|
135
|
+
edgeInk: 0,
|
|
136
|
+
edgeAccent: 1,
|
|
137
|
+
inkLift: 0,
|
|
138
|
+
glow: 18,
|
|
139
|
+
ink: 0
|
|
140
|
+
},
|
|
141
|
+
chalk: {
|
|
142
|
+
blur: 0,
|
|
143
|
+
clarity: 100,
|
|
144
|
+
depth: .3,
|
|
145
|
+
tint: .7,
|
|
146
|
+
glow: 0,
|
|
147
|
+
ink: 1,
|
|
148
|
+
..._,
|
|
149
|
+
inkLift: 1
|
|
150
|
+
}
|
|
151
|
+
}, y = {
|
|
152
|
+
v: 1,
|
|
153
|
+
preset: "frosted"
|
|
154
|
+
}, b = {
|
|
155
|
+
blur: [0, 48],
|
|
156
|
+
clarity: [0, 100],
|
|
157
|
+
depth: [0, 2],
|
|
158
|
+
tint: [0, 2],
|
|
159
|
+
glow: [0, 40],
|
|
160
|
+
ink: [0, 1]
|
|
161
|
+
}, x = 85;
|
|
162
|
+
function S(e) {
|
|
163
|
+
let n = {
|
|
164
|
+
...v[e.preset],
|
|
165
|
+
...e.dials
|
|
166
|
+
};
|
|
167
|
+
return {
|
|
168
|
+
blur: t(n.blur, ...b.blur),
|
|
169
|
+
clarity: t(n.clarity, ...b.clarity),
|
|
170
|
+
depth: t(n.depth, ...b.depth),
|
|
171
|
+
tint: t(n.tint, ...b.tint),
|
|
172
|
+
glow: t(n.glow, ...b.glow),
|
|
173
|
+
ink: t(n.ink, ...b.ink)
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function C(e, t) {
|
|
177
|
+
let n = S(e), r = v[e.preset], i = t === "none" ? 0 : n.blur, a = t === "none" ? Math.max(n.clarity, x) : n.clarity;
|
|
178
|
+
return {
|
|
179
|
+
"--material-blur": `${i}px`,
|
|
180
|
+
"--material-clarity": `${a}%`,
|
|
181
|
+
"--material-depth": `${n.depth}`,
|
|
182
|
+
"--material-tint": `${n.tint}`,
|
|
183
|
+
"--material-edge-width": `${r.edgeWidth}px`,
|
|
184
|
+
"--material-edge-ink": `${r.edgeInk}`,
|
|
185
|
+
"--material-edge-accent": `${r.edgeAccent}`,
|
|
186
|
+
"--material-glow": `${n.glow}px`,
|
|
187
|
+
"--material-ink-level": `${n.ink}`,
|
|
188
|
+
"--material-ink-lift": `${r.inkLift}`
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
//#endregion
|
|
103
192
|
//#region src/tokens/presets.ts
|
|
104
|
-
var
|
|
105
|
-
function
|
|
193
|
+
var w = "midnight-glass", T = "\"Geist Variable\", ui-sans-serif, system-ui, sans-serif", E = "\"GeistMono Variable\", \"JetBrains Mono\", \"Fira Code\", Consolas, monospace";
|
|
194
|
+
function D(e, t) {
|
|
195
|
+
let n = e === "default" ? "solid" : "static", r = t?.night ? {
|
|
196
|
+
type: "static",
|
|
197
|
+
id: t.night
|
|
198
|
+
} : void 0, { url: i, overlay: a, blur: o, vignette: s } = t ?? {};
|
|
106
199
|
return {
|
|
107
|
-
type:
|
|
200
|
+
type: n,
|
|
108
201
|
id: e,
|
|
109
202
|
themed: t?.themed ?? !0,
|
|
110
|
-
url:
|
|
203
|
+
url: i,
|
|
204
|
+
dark: r,
|
|
205
|
+
overlay: a,
|
|
206
|
+
blur: o,
|
|
207
|
+
vignette: s
|
|
111
208
|
};
|
|
112
209
|
}
|
|
113
|
-
function
|
|
210
|
+
function O(e, t, n, r, i, a, o, l) {
|
|
114
211
|
return {
|
|
115
212
|
id: e,
|
|
116
213
|
name: t,
|
|
117
214
|
radius: n,
|
|
118
215
|
swatch: r,
|
|
216
|
+
material: l,
|
|
119
217
|
colors: {
|
|
120
218
|
light: s(i, "light"),
|
|
121
219
|
dark: o ? s(o, "dark") : c(i)
|
|
@@ -123,7 +221,7 @@ function b(e, t, n, r, i, a, o) {
|
|
|
123
221
|
background: a
|
|
124
222
|
};
|
|
125
223
|
}
|
|
126
|
-
var
|
|
224
|
+
var k = [
|
|
127
225
|
{
|
|
128
226
|
id: "midnight-glass",
|
|
129
227
|
name: "Midnight Glass",
|
|
@@ -159,69 +257,185 @@ var x = [
|
|
|
159
257
|
destructive: "oklch(0.7106 0.1661 22.2162)"
|
|
160
258
|
}
|
|
161
259
|
},
|
|
162
|
-
background:
|
|
260
|
+
background: D("glass-house", {
|
|
261
|
+
url: "/backgrounds/glass-house.webp",
|
|
262
|
+
themed: !1,
|
|
263
|
+
night: "glass-house-night",
|
|
264
|
+
vignette: .65
|
|
265
|
+
})
|
|
163
266
|
},
|
|
164
|
-
|
|
165
|
-
primary: "oklch(0.
|
|
166
|
-
accent: "oklch(0.
|
|
167
|
-
secondary: "oklch(0.
|
|
168
|
-
border: "oklch(0.84 0.
|
|
169
|
-
card: "oklch(0.
|
|
170
|
-
background: "oklch(0.
|
|
171
|
-
},
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
267
|
+
O("sunrise-studio", "Sunrise Studio", 1.1, ["#e8590c", "#f7e3c6"], {
|
|
268
|
+
primary: "oklch(0.56 0.13 48)",
|
|
269
|
+
accent: "oklch(0.54 0.11 35)",
|
|
270
|
+
secondary: "oklch(0.93 0.02 70)",
|
|
271
|
+
border: "oklch(0.84 0.025 65)",
|
|
272
|
+
card: "oklch(0.99 0.008 75)",
|
|
273
|
+
background: "oklch(0.945 0.02 72)"
|
|
274
|
+
}, D("studio-geometric", {
|
|
275
|
+
url: "/backgrounds/studio-geometric.svg",
|
|
276
|
+
night: "studio-night"
|
|
277
|
+
}), {
|
|
278
|
+
primary: "oklch(0.78 0.11 62)",
|
|
279
|
+
accent: "oklch(0.72 0.1 42)",
|
|
280
|
+
secondary: "oklch(0.3 0.025 55)",
|
|
281
|
+
border: "oklch(0.4 0.03 55)",
|
|
282
|
+
card: "oklch(0.27 0.025 55)",
|
|
283
|
+
background: "oklch(0.17 0.022 55)"
|
|
284
|
+
}, {
|
|
285
|
+
v: 1,
|
|
286
|
+
preset: "paper"
|
|
287
|
+
}),
|
|
288
|
+
O("forest-zen", "Forest Zen", 1.6, ["#2b8a3e", "#a9c7b0"], {
|
|
289
|
+
primary: "oklch(0.5 0.12 150)",
|
|
290
|
+
accent: "oklch(0.5 0.09 170)",
|
|
291
|
+
secondary: "oklch(0.92 0.025 150)",
|
|
292
|
+
border: "oklch(0.83 0.02 155)",
|
|
293
|
+
card: "oklch(0.99 0.008 150)",
|
|
294
|
+
background: "oklch(0.945 0.015 160)"
|
|
295
|
+
}, D("forest-mist", {
|
|
296
|
+
url: "/backgrounds/forest-mist.webp",
|
|
297
|
+
themed: !1,
|
|
298
|
+
night: "forest-mist-night",
|
|
299
|
+
vignette: .65
|
|
300
|
+
}), {
|
|
301
|
+
primary: "oklch(0.74 0.12 150)",
|
|
302
|
+
accent: "oklch(0.72 0.08 175)",
|
|
303
|
+
secondary: "oklch(0.24 0.025 160)",
|
|
304
|
+
border: "oklch(0.33 0.025 160)",
|
|
305
|
+
card: "oklch(0.25 0.02 160)",
|
|
306
|
+
background: "oklch(0.15 0.02 165)"
|
|
307
|
+
}, {
|
|
308
|
+
v: 1,
|
|
309
|
+
preset: "frosted",
|
|
310
|
+
dials: { clarity: 82 }
|
|
311
|
+
}),
|
|
312
|
+
O("lavender-dreams", "Lavender Dreams", 1.8, ["#845ef7", "#fff4e6"], {
|
|
313
|
+
primary: "oklch(0.5 0.14 305)",
|
|
314
|
+
accent: "oklch(0.52 0.12 325)",
|
|
315
|
+
secondary: "oklch(0.93 0.025 300)",
|
|
316
|
+
border: "oklch(0.85 0.025 300)",
|
|
317
|
+
card: "oklch(0.975 0.012 90)",
|
|
318
|
+
background: "oklch(0.97 0.015 85)"
|
|
319
|
+
}, D("lavender-ink"), {
|
|
320
|
+
primary: "oklch(0.76 0.12 305)",
|
|
321
|
+
accent: "oklch(0.76 0.1 325)",
|
|
322
|
+
secondary: "oklch(0.26 0.04 310)",
|
|
323
|
+
border: "oklch(0.36 0.045 310)",
|
|
324
|
+
card: "oklch(0.23 0.045 312)",
|
|
325
|
+
background: "oklch(0.18 0.045 315)"
|
|
326
|
+
}, {
|
|
327
|
+
v: 1,
|
|
328
|
+
preset: "paper",
|
|
329
|
+
dials: { ink: 1 }
|
|
330
|
+
}),
|
|
331
|
+
O("coral-reef", "Liquid Glass", .9, ["#0e1426", "#5fd4e8"], {
|
|
332
|
+
primary: "oklch(0.5 0.11 225)",
|
|
333
|
+
accent: "oklch(0.52 0.16 345)",
|
|
334
|
+
secondary: "oklch(0.93 0.008 260)",
|
|
335
|
+
border: "oklch(0.85 0.012 260)",
|
|
336
|
+
card: "oklch(0.99 0.004 260)",
|
|
337
|
+
background: "oklch(0.94 0.008 260)"
|
|
338
|
+
}, D("liquid-glass-day", {
|
|
339
|
+
url: "/backgrounds/liquid-glass-day.webp",
|
|
340
|
+
themed: !1,
|
|
341
|
+
night: "liquid-glass"
|
|
342
|
+
}), {
|
|
343
|
+
primary: "oklch(0.78 0.11 210)",
|
|
344
|
+
accent: "oklch(0.72 0.16 340)",
|
|
345
|
+
secondary: "oklch(0.25 0.03 265)",
|
|
346
|
+
border: "oklch(0.36 0.035 265)",
|
|
347
|
+
card: "oklch(0.24 0.03 265)",
|
|
348
|
+
background: "oklch(0.13 0.03 268)"
|
|
349
|
+
}, {
|
|
350
|
+
v: 1,
|
|
351
|
+
preset: "frosted"
|
|
352
|
+
}),
|
|
353
|
+
O("monochrome-pro", "Monochrome Pro", 0, ["#e9ecef", "#343a40"], {
|
|
354
|
+
primary: "oklch(0.32 0.01 260)",
|
|
355
|
+
accent: "oklch(0.4 0.01 260)",
|
|
356
|
+
secondary: "oklch(0.93 0.004 260)",
|
|
357
|
+
border: "oklch(0.8 0.004 260)",
|
|
358
|
+
card: "oklch(0.99 0.002 260)",
|
|
359
|
+
background: "oklch(0.955 0.003 260)"
|
|
360
|
+
}, D("monochrome-blocks", {
|
|
361
|
+
url: "/backgrounds/monochrome-blocks.svg",
|
|
362
|
+
night: "monochrome-night"
|
|
363
|
+
}), {
|
|
364
|
+
primary: "oklch(0.9 0.005 260)",
|
|
365
|
+
accent: "oklch(0.82 0.005 260)",
|
|
366
|
+
secondary: "oklch(0.24 0.004 260)",
|
|
367
|
+
border: "oklch(0.36 0.004 260)",
|
|
368
|
+
card: "oklch(0.2 0.003 260)",
|
|
369
|
+
background: "oklch(0.14 0.003 260)"
|
|
370
|
+
}, {
|
|
371
|
+
v: 1,
|
|
372
|
+
preset: "paper"
|
|
373
|
+
}),
|
|
374
|
+
O("ocean-breeze", "Tide", 1.5, ["#2b4a8b", "#efe6d2"], {
|
|
375
|
+
primary: "oklch(0.42 0.12 262)",
|
|
376
|
+
accent: "oklch(0.48 0.09 225)",
|
|
377
|
+
secondary: "oklch(0.93 0.015 85)",
|
|
378
|
+
border: "oklch(0.84 0.02 80)",
|
|
379
|
+
card: "oklch(0.975 0.012 85)",
|
|
380
|
+
background: "oklch(0.955 0.018 85)"
|
|
381
|
+
}, D("tide-waves"), {
|
|
382
|
+
primary: "oklch(0.78 0.09 235)",
|
|
383
|
+
accent: "oklch(0.76 0.08 205)",
|
|
384
|
+
secondary: "oklch(0.26 0.04 262)",
|
|
385
|
+
border: "oklch(0.36 0.045 262)",
|
|
386
|
+
card: "oklch(0.23 0.045 262)",
|
|
387
|
+
background: "oklch(0.18 0.05 262)"
|
|
388
|
+
}, {
|
|
389
|
+
v: 1,
|
|
390
|
+
preset: "paper"
|
|
391
|
+
}),
|
|
392
|
+
O("chalkboard", "Chalkboard", 1.2, ["#2f4a40", "#f2e6a0"], {
|
|
393
|
+
primary: "oklch(0.48 0.13 255)",
|
|
394
|
+
accent: "oklch(0.5 0.1 165)",
|
|
395
|
+
secondary: "oklch(0.9 0.012 165)",
|
|
396
|
+
border: "oklch(0.8 0.015 165)",
|
|
397
|
+
card: "oklch(0.965 0.006 165)",
|
|
398
|
+
background: "oklch(0.93 0.012 165)"
|
|
399
|
+
}, D("chalkboard"), {
|
|
400
|
+
primary: "oklch(0.88 0.12 95)",
|
|
401
|
+
accent: "oklch(0.8 0.09 220)",
|
|
402
|
+
secondary: "oklch(0.29 0.025 165)",
|
|
403
|
+
border: "oklch(0.43 0.02 165)",
|
|
404
|
+
card: "oklch(0.28 0.028 165)",
|
|
405
|
+
background: "oklch(0.22 0.03 165)"
|
|
406
|
+
}, {
|
|
407
|
+
v: 1,
|
|
408
|
+
preset: "chalk"
|
|
409
|
+
}),
|
|
410
|
+
O("retrowave", "Retrowave", 1.2, ["#ff2bd6", "#35e0ff"], {
|
|
411
|
+
primary: "oklch(0.58 0.24 345)",
|
|
412
|
+
accent: "oklch(0.6 0.14 215)",
|
|
413
|
+
secondary: "oklch(0.93 0.03 320)",
|
|
414
|
+
border: "oklch(0.84 0.04 320)",
|
|
415
|
+
card: "oklch(0.96 0.02 320)",
|
|
416
|
+
background: "oklch(0.98 0.015 320)"
|
|
417
|
+
}, D("sunset-grid", { url: "/backgrounds/sunset-grid.svg" }), {
|
|
418
|
+
primary: "oklch(0.68 0.27 345)",
|
|
419
|
+
accent: "oklch(0.8 0.14 205)",
|
|
420
|
+
secondary: "oklch(0.2 0.06 290)",
|
|
421
|
+
border: "oklch(0.34 0.1 300)",
|
|
422
|
+
card: "oklch(0.19 0.07 290)",
|
|
423
|
+
background: "oklch(0.13 0.06 285)"
|
|
424
|
+
}, {
|
|
425
|
+
v: 1,
|
|
426
|
+
preset: "neon",
|
|
427
|
+
dials: { glow: 14 }
|
|
428
|
+
})
|
|
215
429
|
];
|
|
216
|
-
function
|
|
217
|
-
return
|
|
430
|
+
function A() {
|
|
431
|
+
return k;
|
|
218
432
|
}
|
|
219
|
-
function
|
|
220
|
-
return
|
|
433
|
+
function j(e) {
|
|
434
|
+
return k.find((t) => t.id === e);
|
|
221
435
|
}
|
|
222
436
|
//#endregion
|
|
223
437
|
//#region src/tokens/theme-css.ts
|
|
224
|
-
function
|
|
438
|
+
function M(e, t) {
|
|
225
439
|
let n = e.match(RegExp(`${t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\s*\\{([^}]*)\\}`));
|
|
226
440
|
if (!n) throw Error(`block not found in theme.css: ${t}`);
|
|
227
441
|
let r = {};
|
|
@@ -231,7 +445,7 @@ function w(e, t) {
|
|
|
231
445
|
}
|
|
232
446
|
return r;
|
|
233
447
|
}
|
|
234
|
-
function
|
|
448
|
+
function N(e) {
|
|
235
449
|
let t = d(e), [n, r, i] = [
|
|
236
450
|
1,
|
|
237
451
|
3,
|
|
@@ -239,9 +453,209 @@ function T(e) {
|
|
|
239
453
|
].map((e) => Number.parseInt(t.slice(e, e + 2), 16) / 255).map((e) => e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4);
|
|
240
454
|
return .2126 * n + .7152 * r + .0722 * i;
|
|
241
455
|
}
|
|
242
|
-
function
|
|
243
|
-
let [n, r] = [
|
|
456
|
+
function P(e, t) {
|
|
457
|
+
let [n, r] = [N(e), N(t)];
|
|
244
458
|
return (Math.max(n, r) + .05) / (Math.min(n, r) + .05);
|
|
245
459
|
}
|
|
246
460
|
//#endregion
|
|
247
|
-
|
|
461
|
+
//#region src/tokens/readability.ts
|
|
462
|
+
var F = [
|
|
463
|
+
{
|
|
464
|
+
text: "mutedForeground",
|
|
465
|
+
surface: "background",
|
|
466
|
+
min: 4.5
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
text: "mutedForeground",
|
|
470
|
+
surface: "card",
|
|
471
|
+
min: 4.5
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
text: "mutedForeground",
|
|
475
|
+
surface: "muted",
|
|
476
|
+
min: 4.5
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
text: "destructive",
|
|
480
|
+
surface: "background",
|
|
481
|
+
min: 4.5
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
text: "destructive",
|
|
485
|
+
surface: "card",
|
|
486
|
+
min: 4.5
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
text: "primary",
|
|
490
|
+
surface: "background",
|
|
491
|
+
min: 3
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
text: "primary",
|
|
495
|
+
surface: "card",
|
|
496
|
+
min: 3
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
text: "ring",
|
|
500
|
+
surface: "background",
|
|
501
|
+
min: 3
|
|
502
|
+
}
|
|
503
|
+
];
|
|
504
|
+
function I(e) {
|
|
505
|
+
return F.flatMap((t) => {
|
|
506
|
+
let n = P(e[t.text], e[t.surface]);
|
|
507
|
+
return n >= t.min ? [] : [{
|
|
508
|
+
...t,
|
|
509
|
+
ratio: n
|
|
510
|
+
}];
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
var L = .01;
|
|
514
|
+
function R(e) {
|
|
515
|
+
return F.filter((t) => t.text === e);
|
|
516
|
+
}
|
|
517
|
+
function z(e, t, n) {
|
|
518
|
+
return n.every((n) => P(e, t[n.surface]) >= n.min);
|
|
519
|
+
}
|
|
520
|
+
function B(e, n) {
|
|
521
|
+
let a = r(e[n]);
|
|
522
|
+
if (!a) return null;
|
|
523
|
+
let o = R(n);
|
|
524
|
+
for (let n = L; n <= 1; n += L) for (let r of [-1, 1]) {
|
|
525
|
+
let s = a.l + r * n;
|
|
526
|
+
if (s < 0 || s > 1) continue;
|
|
527
|
+
let c = i(t(Number(s.toFixed(4)), 0, 1), a.c, a.h);
|
|
528
|
+
if (z(c, e, o)) return c;
|
|
529
|
+
}
|
|
530
|
+
return null;
|
|
531
|
+
}
|
|
532
|
+
//#endregion
|
|
533
|
+
//#region src/tokens/theme-recipe.ts
|
|
534
|
+
var V = 1, H = {
|
|
535
|
+
cool: "oklch(0.965 0.02 240)",
|
|
536
|
+
neutral: "oklch(0.97 0 0)",
|
|
537
|
+
warm: "oklch(0.965 0.025 75)"
|
|
538
|
+
}, U = {
|
|
539
|
+
light: {
|
|
540
|
+
ground: {},
|
|
541
|
+
card: {
|
|
542
|
+
l: .015,
|
|
543
|
+
c: .6
|
|
544
|
+
},
|
|
545
|
+
border: {
|
|
546
|
+
l: -.08,
|
|
547
|
+
c: 1.2,
|
|
548
|
+
cMax: .06
|
|
549
|
+
},
|
|
550
|
+
secondary: { l: -.035 },
|
|
551
|
+
primary: {},
|
|
552
|
+
accent: {
|
|
553
|
+
l: .05,
|
|
554
|
+
c: .85
|
|
555
|
+
}
|
|
556
|
+
},
|
|
557
|
+
dark: {
|
|
558
|
+
ground: {
|
|
559
|
+
lTo: .15,
|
|
560
|
+
c: 2.6,
|
|
561
|
+
cMax: .07
|
|
562
|
+
},
|
|
563
|
+
card: {
|
|
564
|
+
lTo: .19,
|
|
565
|
+
c: 2.6,
|
|
566
|
+
cMax: .07
|
|
567
|
+
},
|
|
568
|
+
border: {
|
|
569
|
+
lTo: .27,
|
|
570
|
+
c: 2.6,
|
|
571
|
+
cMax: .08
|
|
572
|
+
},
|
|
573
|
+
secondary: {
|
|
574
|
+
lTo: .22,
|
|
575
|
+
c: 2.6,
|
|
576
|
+
cMax: .07
|
|
577
|
+
},
|
|
578
|
+
primary: { l: .08 },
|
|
579
|
+
accent: {
|
|
580
|
+
l: .12,
|
|
581
|
+
c: .85
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
};
|
|
585
|
+
function W(e, n) {
|
|
586
|
+
let a = r(e);
|
|
587
|
+
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;
|
|
588
|
+
}
|
|
589
|
+
function G(e, t) {
|
|
590
|
+
let n = U[t];
|
|
591
|
+
return {
|
|
592
|
+
background: W(e.surface, n.ground),
|
|
593
|
+
card: W(e.surface, n.card),
|
|
594
|
+
border: W(e.surface, n.border),
|
|
595
|
+
secondary: W(e.surface, n.secondary),
|
|
596
|
+
primary: W(e.accent, n.primary),
|
|
597
|
+
accent: W(e.accent, n.accent)
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
var K = [
|
|
601
|
+
"primary",
|
|
602
|
+
"ring",
|
|
603
|
+
"mutedForeground",
|
|
604
|
+
"destructive"
|
|
605
|
+
];
|
|
606
|
+
function q(e) {
|
|
607
|
+
let t = { ...e }, n = new Set(I(t).map((e) => e.text));
|
|
608
|
+
for (let e of K) n.has(e) && (t[e] = B(t, e) ?? t[e]);
|
|
609
|
+
return t;
|
|
610
|
+
}
|
|
611
|
+
function J(e) {
|
|
612
|
+
let t = G(e, "light"), n = s(t, "light"), r = e.darkLinked ? c(t) : s(G(e, "dark"), "dark");
|
|
613
|
+
return {
|
|
614
|
+
light: q(n),
|
|
615
|
+
dark: q(r)
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
function Y(e) {
|
|
619
|
+
let t = J(e);
|
|
620
|
+
return {
|
|
621
|
+
light: {
|
|
622
|
+
...t.light,
|
|
623
|
+
...e.set.light
|
|
624
|
+
},
|
|
625
|
+
dark: {
|
|
626
|
+
...t.dark,
|
|
627
|
+
...e.set.dark
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
function X(e, t, n) {
|
|
632
|
+
return e.set[t][n] === void 0;
|
|
633
|
+
}
|
|
634
|
+
function Z(e, t) {
|
|
635
|
+
let n = {};
|
|
636
|
+
for (let r of Object.keys(t)) t[r] !== e[r] && (n[r] = t[r]);
|
|
637
|
+
return n;
|
|
638
|
+
}
|
|
639
|
+
function Q(e, t, n) {
|
|
640
|
+
let r = {
|
|
641
|
+
v: 1,
|
|
642
|
+
accent: e.light.primary,
|
|
643
|
+
surface: e.light.background,
|
|
644
|
+
radius: t,
|
|
645
|
+
background: n,
|
|
646
|
+
darkLinked: !1,
|
|
647
|
+
set: {
|
|
648
|
+
light: {},
|
|
649
|
+
dark: {}
|
|
650
|
+
}
|
|
651
|
+
}, i = J(r);
|
|
652
|
+
return {
|
|
653
|
+
...r,
|
|
654
|
+
set: {
|
|
655
|
+
light: Z(i.light, e.light),
|
|
656
|
+
dark: Z(i.dark, e.dark)
|
|
657
|
+
}
|
|
658
|
+
};
|
|
659
|
+
}
|
|
660
|
+
//#endregion
|
|
661
|
+
export { w as DEFAULT_THEME_ID, E as FONT_MONO, T as FONT_SANS, y as FROSTED, v as MATERIAL_PRESETS, g as MATERIAL_VERSION, F as READABLE_PAIRS, V as RECIPE_VERSION, k as THEME_PRESETS, H as TINT_SURFACES, t as clamp, P as contrastRatio, c as deriveDarkFromLight, u as ensureFullThemeColors, I as findUnreadable, B as fixReadable, A as getAllPresets, j as getPreset, X as isDerived, S as materialDials, d as oklchToHex, r as parseOklch, M as parseThemeBlock, C as resolveMaterial, Y as resolveRecipe, s as resolveThemeColors, Q as seedsFromColors, i as toOklch };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const MATERIAL_VERSION = 1;
|
|
2
|
+
export type MaterialPresetId = "frosted" | "paper" | "neon" | "chalk";
|
|
3
|
+
/** Tier 2 of the glass formula: what every surface's knobs are multiplied by. The homeowner's dials. */
|
|
4
|
+
export interface MaterialDials {
|
|
5
|
+
/** Backdrop blur radius, px. */
|
|
6
|
+
blur: number;
|
|
7
|
+
/** How much of the card colour a surface keeps, %; the rest is the wallpaper. */
|
|
8
|
+
clarity: number;
|
|
9
|
+
/** Scales sheen, shade, rim and lift together. */
|
|
10
|
+
depth: number;
|
|
11
|
+
/** Scales the tone wash. */
|
|
12
|
+
tint: number;
|
|
13
|
+
/** Outer bloom radius in the surface's own hue, px. */
|
|
14
|
+
glow: number;
|
|
15
|
+
/** 0..1; above 0 every surface is hand-inked: a drawn line over a hand-laid fill. */
|
|
16
|
+
ink: number;
|
|
17
|
+
}
|
|
18
|
+
/** Terms a preset turns on; inert at zero, never a homeowner dial. */
|
|
19
|
+
export interface MaterialTerms {
|
|
20
|
+
/** Edge width, px. */
|
|
21
|
+
edgeWidth: number;
|
|
22
|
+
/** 0..1, how far the edge moves toward the material ink. */
|
|
23
|
+
edgeInk: number;
|
|
24
|
+
/** 0..1, how far the edge moves toward the surface's own hue (its tone, else the accent). */
|
|
25
|
+
edgeAccent: number;
|
|
26
|
+
/** 0..1, how far the Ink line moves from the mode's ink toward the foreground: chalk on a dark board. */
|
|
27
|
+
inkLift: number;
|
|
28
|
+
}
|
|
29
|
+
export type MaterialSpec = MaterialDials & MaterialTerms;
|
|
30
|
+
/** What was chosen, never what was computed. */
|
|
31
|
+
export interface Material {
|
|
32
|
+
v: typeof MATERIAL_VERSION;
|
|
33
|
+
preset: MaterialPresetId;
|
|
34
|
+
dials?: Partial<MaterialDials>;
|
|
35
|
+
}
|
|
36
|
+
export type BlurMode = "dynamic" | "performant" | "none";
|
|
37
|
+
export declare const MATERIAL_PRESETS: Record<MaterialPresetId, MaterialSpec>;
|
|
38
|
+
export declare const FROSTED: Material;
|
|
39
|
+
export declare function materialDials(material: Material): MaterialDials;
|
|
40
|
+
export declare function resolveMaterial(material: Material, blurMode: BlurMode): Record<`--material-${string}`, string>;
|
package/dist/tokens/presets.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Material } from "./material.js";
|
|
1
2
|
import { type BackgroundConfig, type ThemeColorsConfig } from "./theme-colors.js";
|
|
2
3
|
export interface ThemePreset {
|
|
3
4
|
id: string;
|
|
@@ -7,6 +8,8 @@ export interface ThemePreset {
|
|
|
7
8
|
background: BackgroundConfig;
|
|
8
9
|
/** Curated two-stop gradient used for theme picker dots and marketing swatches. */
|
|
9
10
|
swatch: [string, string];
|
|
11
|
+
/** Absent: Frosted. */
|
|
12
|
+
material?: Material;
|
|
10
13
|
}
|
|
11
14
|
export declare const DEFAULT_THEME_ID = "midnight-glass";
|
|
12
15
|
/** Font stacks as shipped in styles/theme.css. */
|
|
@@ -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 {};
|