@glasshome/ui 1.24.0 → 1.25.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 +40 -12
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/lib/card-classes.d.ts +4 -4
- package/dist/lib/input-classes.d.ts +1 -0
- package/dist/lib/overlay-classes.d.ts +2 -2
- package/dist/lib/position-bar-classes.d.ts +1 -1
- package/dist/lib/thumb-classes.d.ts +0 -1
- package/dist/solid/index.js +339 -339
- package/dist/solid/sliding-indicator.d.ts +1 -1
- package/dist/solid/toggle-group.d.ts +1 -1
- package/dist/tokens/index.js +201 -101
- package/dist/tokens/material.d.ts +53 -8
- package/dist/{utils-rZf2Zpkw.js → utils-Sl2ceVna.js} +23 -23
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/lib/button-variants.ts +1 -1
- package/src/lib/card-classes.ts +2 -2
- package/src/lib/input-classes.ts +5 -0
- package/src/lib/overlay-classes.ts +1 -1
- package/src/lib/position-bar-classes.ts +1 -1
- package/src/lib/thumb-classes.ts +0 -7
- package/src/solid/checkbox.tsx +1 -1
- package/src/solid/slider.tsx +5 -3
- package/src/solid/sliding-indicator.tsx +2 -2
- package/src/solid/switch.tsx +5 -7
- package/src/solid/tabs.tsx +1 -1
- package/src/solid/toggle-group.tsx +3 -3
- package/src/solid/toggle.tsx +1 -1
- package/src/styles/globals.css +237 -21
- package/src/styles/theme.css +27 -14
- package/src/tokens/material.ts +215 -41
|
@@ -22,7 +22,7 @@ interface SlidingIndicatorProps extends ComponentProps<"div"> {
|
|
|
22
22
|
* this can't flatten the indicator; it only tunes it. Default radius: `rounded-lg`. */
|
|
23
23
|
indicatorClass?: string;
|
|
24
24
|
/** Glass tone that drives the `.glass` material (`--glass-tone`). Defaults to
|
|
25
|
-
* `var(--
|
|
25
|
+
* `var(--material-accent)`, the theme accent unless the material sets its own. Pass another CSS color to re-tint. */
|
|
26
26
|
indicatorTone?: string;
|
|
27
27
|
/** Selector for the measurable items. Default: direct children (minus the indicator). */
|
|
28
28
|
itemSelector?: string;
|
|
@@ -3,7 +3,7 @@ import type { VariantProps } from "cva";
|
|
|
3
3
|
import { type Component, type ComponentProps, type ParentComponent } from "solid-js";
|
|
4
4
|
import { toggleVariants } from "./toggle.js";
|
|
5
5
|
declare const ToggleGroup: ParentComponent<ComponentProps<typeof ToggleGroupPrimitive> & VariantProps<typeof toggleVariants> & {
|
|
6
|
-
/** CSS colour for the selected segment's glass. Default `var(--
|
|
6
|
+
/** CSS colour for the selected segment's glass. Default `var(--material-accent)`. */
|
|
7
7
|
tone?: string;
|
|
8
8
|
/** One row that scrolls sideways when it outgrows its container, instead of wrapping. */
|
|
9
9
|
scroll?: boolean;
|
package/dist/tokens/index.js
CHANGED
|
@@ -116,6 +116,16 @@ var g = 1, _ = {
|
|
|
116
116
|
ink: 0,
|
|
117
117
|
..._
|
|
118
118
|
},
|
|
119
|
+
frost: {
|
|
120
|
+
blur: 24,
|
|
121
|
+
clarity: 60,
|
|
122
|
+
depth: 1,
|
|
123
|
+
tint: 1,
|
|
124
|
+
glow: 0,
|
|
125
|
+
ink: 0,
|
|
126
|
+
..._,
|
|
127
|
+
grain: .4
|
|
128
|
+
},
|
|
119
129
|
paper: {
|
|
120
130
|
blur: 0,
|
|
121
131
|
clarity: 100,
|
|
@@ -124,19 +134,27 @@ var g = 1, _ = {
|
|
|
124
134
|
glow: 0,
|
|
125
135
|
ink: 0,
|
|
126
136
|
..._,
|
|
127
|
-
edgeInk: .3
|
|
137
|
+
edgeInk: .3,
|
|
138
|
+
sheen: 0,
|
|
139
|
+
edge: .2,
|
|
140
|
+
shadow: .7
|
|
128
141
|
},
|
|
129
142
|
neon: {
|
|
130
|
-
blur:
|
|
131
|
-
clarity:
|
|
143
|
+
blur: 9,
|
|
144
|
+
clarity: 57,
|
|
132
145
|
depth: .4,
|
|
133
|
-
tint: .
|
|
134
|
-
edgeWidth: 1
|
|
146
|
+
tint: .6,
|
|
147
|
+
edgeWidth: 1,
|
|
135
148
|
edgeInk: 0,
|
|
136
|
-
edgeAccent:
|
|
149
|
+
edgeAccent: .35,
|
|
137
150
|
inkLift: 0,
|
|
138
|
-
glow:
|
|
139
|
-
ink: 0
|
|
151
|
+
glow: 3,
|
|
152
|
+
ink: 0,
|
|
153
|
+
vibrancy: 1.3,
|
|
154
|
+
edge: .25,
|
|
155
|
+
sheen: .3,
|
|
156
|
+
shadow: 1,
|
|
157
|
+
innerGlow: .35
|
|
140
158
|
},
|
|
141
159
|
chalk: {
|
|
142
160
|
blur: 0,
|
|
@@ -157,41 +175,123 @@ var g = 1, _ = {
|
|
|
157
175
|
depth: [0, 2],
|
|
158
176
|
tint: [0, 2],
|
|
159
177
|
glow: [0, 40],
|
|
160
|
-
ink: [0, 1]
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
178
|
+
ink: [0, 1],
|
|
179
|
+
vibrancy: [.5, 2],
|
|
180
|
+
edge: [0, 2],
|
|
181
|
+
sheen: [0, 2],
|
|
182
|
+
shadow: [0, 2],
|
|
183
|
+
inset: [0, 1],
|
|
184
|
+
lightFrom: [0, 360],
|
|
185
|
+
darkScale: [0, 1],
|
|
186
|
+
innerGlow: [0, 1],
|
|
187
|
+
innerGlowHue: [0, 1],
|
|
188
|
+
grain: [0, 1],
|
|
189
|
+
washAngle: [0, 360],
|
|
190
|
+
relief: [0, 2],
|
|
191
|
+
fill: [0, .6]
|
|
192
|
+
}, x = {
|
|
193
|
+
vibrancy: 1,
|
|
194
|
+
inset: 0,
|
|
195
|
+
lightFrom: 315,
|
|
196
|
+
rim: "top",
|
|
197
|
+
darkScale: 1,
|
|
198
|
+
glowAt: "outside",
|
|
199
|
+
innerGlow: 0,
|
|
200
|
+
innerGlowHue: 1,
|
|
201
|
+
grain: 0,
|
|
202
|
+
washStyle: "fade",
|
|
203
|
+
washAngle: 135,
|
|
204
|
+
face: "flat",
|
|
205
|
+
relief: 1,
|
|
206
|
+
accent: "theme",
|
|
207
|
+
fill: 0
|
|
208
|
+
}, S = 85, C = Object.keys(b);
|
|
209
|
+
function w(e) {
|
|
210
|
+
let { edgeWidth: n, edgeInk: r, edgeAccent: i, inkLift: a, ...o } = v[e.preset], s = {
|
|
211
|
+
...x,
|
|
212
|
+
...o,
|
|
165
213
|
...e.dials
|
|
214
|
+
}, c = {
|
|
215
|
+
...s,
|
|
216
|
+
edge: s.edge ?? s.depth,
|
|
217
|
+
sheen: s.sheen ?? s.depth,
|
|
218
|
+
shadow: s.shadow ?? s.depth
|
|
166
219
|
};
|
|
220
|
+
for (let e of C) c[e] = t(c[e], ...b[e]);
|
|
221
|
+
return c;
|
|
222
|
+
}
|
|
223
|
+
function T(e) {
|
|
224
|
+
let { blur: t, clarity: n, depth: r, tint: i, glow: a, ink: o } = w(e);
|
|
167
225
|
return {
|
|
168
|
-
blur: t
|
|
169
|
-
clarity:
|
|
170
|
-
depth:
|
|
171
|
-
tint:
|
|
172
|
-
glow:
|
|
173
|
-
ink:
|
|
226
|
+
blur: t,
|
|
227
|
+
clarity: n,
|
|
228
|
+
depth: r,
|
|
229
|
+
tint: i,
|
|
230
|
+
glow: a,
|
|
231
|
+
ink: o
|
|
174
232
|
};
|
|
175
233
|
}
|
|
176
|
-
|
|
177
|
-
|
|
234
|
+
var E = 315, D = (e) => Math.round(e * 1e4) / 1e4, O = (e, t) => `url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='${e}' height='${e}'><filter id='n' x='0' y='0' width='100%' height='100%'>${t}</filter><rect width='${e}' height='${e}' filter='url(%23n)'/></svg>")`, ee = (e) => O(160, `<feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='0' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.7 0 0 0 0 0.7 0 0 0 0 0.7 0 0 0 ${D(e * .3)} 0'/>`), te = {
|
|
235
|
+
flat: 1,
|
|
236
|
+
fade: 3,
|
|
237
|
+
"two-tone": 1
|
|
238
|
+
}, ne = {
|
|
239
|
+
top: [0, 0],
|
|
240
|
+
"top-bottom": [1, 0],
|
|
241
|
+
around: [0, 1]
|
|
242
|
+
}, re = {
|
|
243
|
+
flat: {
|
|
244
|
+
"--material-control-track": "var(--input)",
|
|
245
|
+
"--material-control-fill": "var(--material-accent)",
|
|
246
|
+
"--material-control-knob": "oklch(1 0 0)"
|
|
247
|
+
},
|
|
248
|
+
raised: {
|
|
249
|
+
"--material-control-track": "var(--material-well)",
|
|
250
|
+
"--material-control-fill": "linear-gradient(90deg, color-mix(in srgb, var(--material-accent), black 50%), var(--material-accent))",
|
|
251
|
+
"--material-control-knob": "var(--material-face)"
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
function ie(e, t, n = "light") {
|
|
255
|
+
let r = w(e), i = v[e.preset], a = t === "none" ? 0 : r.blur, o = t === "none" ? Math.max(r.clarity, S) : r.clarity, s = n === "dark" ? r.darkScale : 1, c = (r.lightFrom - E) * Math.PI / 180, [l, u] = ne[r.rim];
|
|
178
256
|
return {
|
|
179
|
-
"--material-blur": `${
|
|
180
|
-
"--material-clarity": `${
|
|
181
|
-
"--material-depth": `${
|
|
182
|
-
"--material-tint": `${
|
|
183
|
-
"--material-edge-width": `${
|
|
184
|
-
"--material-edge-ink": `${
|
|
185
|
-
"--material-edge-accent": `${
|
|
186
|
-
"--material-glow": `${
|
|
187
|
-
"--material-ink-level": `${
|
|
188
|
-
"--material-ink-lift": `${
|
|
257
|
+
"--material-blur": `${a}px`,
|
|
258
|
+
"--material-clarity": `${o}%`,
|
|
259
|
+
"--material-depth": `${r.depth}`,
|
|
260
|
+
"--material-tint": `${r.tint}`,
|
|
261
|
+
"--material-edge-width": `${i.edgeWidth}px`,
|
|
262
|
+
"--material-edge-ink": `${i.edgeInk}`,
|
|
263
|
+
"--material-edge-accent": `${i.edgeAccent}`,
|
|
264
|
+
"--material-glow": `${r.glow}px`,
|
|
265
|
+
"--material-ink-level": `${r.ink}`,
|
|
266
|
+
"--material-ink-lift": `${i.inkLift}`,
|
|
267
|
+
"--_material-vibrancy": `${r.vibrancy}`,
|
|
268
|
+
"--_material-edge": `${D(r.edge * s)}`,
|
|
269
|
+
"--_material-sheen": `${D(r.sheen * s)}`,
|
|
270
|
+
"--_material-shadow": `${r.shadow}`,
|
|
271
|
+
"--_material-inset": `${D(r.inset * s)}`,
|
|
272
|
+
"--_material-light-cos": `${D(Math.cos(c))}`,
|
|
273
|
+
"--_material-light-sin": `${D(Math.sin(c))}`,
|
|
274
|
+
"--_material-rim-bottom": `${l}`,
|
|
275
|
+
"--_material-rim-around": `${u}`,
|
|
276
|
+
"--_material-glow-out": r.glowAt === "outside" ? "1" : "0",
|
|
277
|
+
"--_material-glow-in": r.glowAt === "inside" ? "1" : "0",
|
|
278
|
+
"--_material-inner-glow": `${D(r.innerGlow * s)}`,
|
|
279
|
+
"--_material-inner-glow-hue": `${r.innerGlowHue}`,
|
|
280
|
+
"--_material-grain": r.grain > 0 ? ee(r.grain) : "none",
|
|
281
|
+
"--_material-wash-split": `${te[r.washStyle]}`,
|
|
282
|
+
"--_material-wash-angle": `${r.washAngle}deg`,
|
|
283
|
+
"--_material-two-tone": r.washStyle === "two-tone" ? "1" : "0",
|
|
284
|
+
"--_material-face-raised": r.face === "raised" ? "1" : "0",
|
|
285
|
+
...re[r.face],
|
|
286
|
+
"--_material-relief": `${r.relief}`,
|
|
287
|
+
"--material-accent": r.accent === "theme" ? "var(--primary)" : r.accent,
|
|
288
|
+
"--_material-fill": `${r.fill}`
|
|
189
289
|
};
|
|
190
290
|
}
|
|
191
291
|
//#endregion
|
|
192
292
|
//#region src/tokens/presets.ts
|
|
193
|
-
var
|
|
194
|
-
function
|
|
293
|
+
var k = "midnight-glass", A = "\"Geist Variable\", ui-sans-serif, system-ui, sans-serif", j = "\"GeistMono Variable\", \"JetBrains Mono\", \"Fira Code\", Consolas, monospace";
|
|
294
|
+
function M(e, t) {
|
|
195
295
|
let n = e === "default" ? "solid" : "static", r = t?.night ? {
|
|
196
296
|
type: "static",
|
|
197
297
|
id: t.night
|
|
@@ -207,7 +307,7 @@ function D(e, t) {
|
|
|
207
307
|
vignette: s
|
|
208
308
|
};
|
|
209
309
|
}
|
|
210
|
-
function
|
|
310
|
+
function N(e, t, n, r, i, a, o, l) {
|
|
211
311
|
return {
|
|
212
312
|
id: e,
|
|
213
313
|
name: t,
|
|
@@ -221,7 +321,7 @@ function O(e, t, n, r, i, a, o, l) {
|
|
|
221
321
|
background: a
|
|
222
322
|
};
|
|
223
323
|
}
|
|
224
|
-
var
|
|
324
|
+
var P = [
|
|
225
325
|
{
|
|
226
326
|
id: "midnight-glass",
|
|
227
327
|
name: "Midnight Glass",
|
|
@@ -257,7 +357,7 @@ var k = [
|
|
|
257
357
|
destructive: "oklch(0.7106 0.1661 22.2162)"
|
|
258
358
|
}
|
|
259
359
|
},
|
|
260
|
-
background:
|
|
360
|
+
background: M("glass-house", {
|
|
261
361
|
url: "/backgrounds/glass-house.webp",
|
|
262
362
|
themed: !1,
|
|
263
363
|
night: "glass-house-night",
|
|
@@ -265,14 +365,14 @@ var k = [
|
|
|
265
365
|
blur: 4
|
|
266
366
|
})
|
|
267
367
|
},
|
|
268
|
-
|
|
368
|
+
N("sunrise-studio", "Sunrise Studio", 1.1, ["#e8590c", "#f7e3c6"], {
|
|
269
369
|
primary: "oklch(0.56 0.13 48)",
|
|
270
370
|
accent: "oklch(0.54 0.11 35)",
|
|
271
371
|
secondary: "oklch(0.93 0.02 70)",
|
|
272
372
|
border: "oklch(0.84 0.025 65)",
|
|
273
373
|
card: "oklch(0.99 0.008 75)",
|
|
274
374
|
background: "oklch(0.945 0.02 72)"
|
|
275
|
-
},
|
|
375
|
+
}, M("studio-geometric", {
|
|
276
376
|
url: "/backgrounds/studio-geometric.svg",
|
|
277
377
|
night: "studio-night"
|
|
278
378
|
}), {
|
|
@@ -286,14 +386,14 @@ var k = [
|
|
|
286
386
|
v: 1,
|
|
287
387
|
preset: "paper"
|
|
288
388
|
}),
|
|
289
|
-
|
|
389
|
+
N("forest-zen", "Forest Zen", 1.6, ["#2b8a3e", "#a9c7b0"], {
|
|
290
390
|
primary: "oklch(0.5 0.12 150)",
|
|
291
391
|
accent: "oklch(0.5 0.09 170)",
|
|
292
392
|
secondary: "oklch(0.92 0.025 150)",
|
|
293
393
|
border: "oklch(0.83 0.02 155)",
|
|
294
394
|
card: "oklch(0.99 0.008 150)",
|
|
295
395
|
background: "oklch(0.945 0.015 160)"
|
|
296
|
-
},
|
|
396
|
+
}, M("forest-mist", {
|
|
297
397
|
url: "/backgrounds/forest-mist.webp",
|
|
298
398
|
themed: !1,
|
|
299
399
|
night: "forest-mist-night",
|
|
@@ -310,14 +410,14 @@ var k = [
|
|
|
310
410
|
preset: "frosted",
|
|
311
411
|
dials: { clarity: 82 }
|
|
312
412
|
}),
|
|
313
|
-
|
|
413
|
+
N("lavender-dreams", "Lavender Dreams", 1.8, ["#845ef7", "#fff4e6"], {
|
|
314
414
|
primary: "oklch(0.5 0.14 305)",
|
|
315
415
|
accent: "oklch(0.52 0.12 325)",
|
|
316
416
|
secondary: "oklch(0.93 0.025 300)",
|
|
317
417
|
border: "oklch(0.85 0.025 300)",
|
|
318
418
|
card: "oklch(0.975 0.012 90)",
|
|
319
419
|
background: "oklch(0.97 0.015 85)"
|
|
320
|
-
},
|
|
420
|
+
}, M("lavender-ink"), {
|
|
321
421
|
primary: "oklch(0.76 0.12 305)",
|
|
322
422
|
accent: "oklch(0.76 0.1 325)",
|
|
323
423
|
secondary: "oklch(0.26 0.04 310)",
|
|
@@ -329,14 +429,14 @@ var k = [
|
|
|
329
429
|
preset: "paper",
|
|
330
430
|
dials: { ink: 1 }
|
|
331
431
|
}),
|
|
332
|
-
|
|
432
|
+
N("coral-reef", "Liquid Glass", .9, ["#0e1426", "#5fd4e8"], {
|
|
333
433
|
primary: "oklch(0.5 0.11 225)",
|
|
334
434
|
accent: "oklch(0.52 0.16 345)",
|
|
335
435
|
secondary: "oklch(0.93 0.008 260)",
|
|
336
436
|
border: "oklch(0.85 0.012 260)",
|
|
337
437
|
card: "oklch(0.99 0.004 260)",
|
|
338
438
|
background: "oklch(0.94 0.008 260)"
|
|
339
|
-
},
|
|
439
|
+
}, M("liquid-glass-day", {
|
|
340
440
|
url: "/backgrounds/liquid-glass-day.webp",
|
|
341
441
|
themed: !1,
|
|
342
442
|
night: "liquid-glass"
|
|
@@ -351,14 +451,14 @@ var k = [
|
|
|
351
451
|
v: 1,
|
|
352
452
|
preset: "frosted"
|
|
353
453
|
}),
|
|
354
|
-
|
|
454
|
+
N("monochrome-pro", "Monochrome Pro", 0, ["#e9ecef", "#343a40"], {
|
|
355
455
|
primary: "oklch(0.32 0.01 260)",
|
|
356
456
|
accent: "oklch(0.4 0.01 260)",
|
|
357
457
|
secondary: "oklch(0.93 0.004 260)",
|
|
358
458
|
border: "oklch(0.8 0.004 260)",
|
|
359
459
|
card: "oklch(0.99 0.002 260)",
|
|
360
460
|
background: "oklch(0.955 0.003 260)"
|
|
361
|
-
},
|
|
461
|
+
}, M("monochrome-blocks", {
|
|
362
462
|
url: "/backgrounds/monochrome-blocks.svg",
|
|
363
463
|
night: "monochrome-night"
|
|
364
464
|
}), {
|
|
@@ -372,14 +472,14 @@ var k = [
|
|
|
372
472
|
v: 1,
|
|
373
473
|
preset: "paper"
|
|
374
474
|
}),
|
|
375
|
-
|
|
475
|
+
N("ocean-breeze", "Tide", 1.5, ["#2b4a8b", "#efe6d2"], {
|
|
376
476
|
primary: "oklch(0.42 0.12 262)",
|
|
377
477
|
accent: "oklch(0.48 0.09 225)",
|
|
378
478
|
secondary: "oklch(0.93 0.015 85)",
|
|
379
479
|
border: "oklch(0.84 0.02 80)",
|
|
380
480
|
card: "oklch(0.975 0.012 85)",
|
|
381
481
|
background: "oklch(0.955 0.018 85)"
|
|
382
|
-
},
|
|
482
|
+
}, M("tide-waves"), {
|
|
383
483
|
primary: "oklch(0.78 0.09 235)",
|
|
384
484
|
accent: "oklch(0.76 0.08 205)",
|
|
385
485
|
secondary: "oklch(0.26 0.04 262)",
|
|
@@ -390,14 +490,14 @@ var k = [
|
|
|
390
490
|
v: 1,
|
|
391
491
|
preset: "paper"
|
|
392
492
|
}),
|
|
393
|
-
|
|
493
|
+
N("chalkboard", "Chalkboard", 1.2, ["#2f4a40", "#f2e6a0"], {
|
|
394
494
|
primary: "oklch(0.48 0.13 255)",
|
|
395
495
|
accent: "oklch(0.5 0.1 165)",
|
|
396
496
|
secondary: "oklch(0.9 0.012 165)",
|
|
397
497
|
border: "oklch(0.8 0.015 165)",
|
|
398
498
|
card: "oklch(0.965 0.006 165)",
|
|
399
499
|
background: "oklch(0.93 0.012 165)"
|
|
400
|
-
},
|
|
500
|
+
}, M("chalkboard"), {
|
|
401
501
|
primary: "oklch(0.88 0.12 95)",
|
|
402
502
|
accent: "oklch(0.8 0.09 220)",
|
|
403
503
|
secondary: "oklch(0.29 0.025 165)",
|
|
@@ -408,14 +508,14 @@ var k = [
|
|
|
408
508
|
v: 1,
|
|
409
509
|
preset: "chalk"
|
|
410
510
|
}),
|
|
411
|
-
|
|
511
|
+
N("retrowave", "Retrowave", 1.2, ["#ff2bd6", "#35e0ff"], {
|
|
412
512
|
primary: "oklch(0.58 0.24 345)",
|
|
413
513
|
accent: "oklch(0.6 0.14 215)",
|
|
414
514
|
secondary: "oklch(0.93 0.03 320)",
|
|
415
515
|
border: "oklch(0.84 0.04 320)",
|
|
416
516
|
card: "oklch(0.96 0.02 320)",
|
|
417
517
|
background: "oklch(0.98 0.015 320)"
|
|
418
|
-
},
|
|
518
|
+
}, M("sunset-grid", { url: "/backgrounds/sunset-grid.svg" }), {
|
|
419
519
|
primary: "oklch(0.68 0.27 345)",
|
|
420
520
|
accent: "oklch(0.8 0.14 205)",
|
|
421
521
|
secondary: "oklch(0.2 0.06 290)",
|
|
@@ -428,15 +528,15 @@ var k = [
|
|
|
428
528
|
dials: { glow: 14 }
|
|
429
529
|
})
|
|
430
530
|
];
|
|
431
|
-
function
|
|
432
|
-
return
|
|
531
|
+
function F() {
|
|
532
|
+
return P;
|
|
433
533
|
}
|
|
434
|
-
function
|
|
435
|
-
return
|
|
534
|
+
function I(e) {
|
|
535
|
+
return P.find((t) => t.id === e);
|
|
436
536
|
}
|
|
437
537
|
//#endregion
|
|
438
538
|
//#region src/tokens/theme-css.ts
|
|
439
|
-
function
|
|
539
|
+
function L(e, t) {
|
|
440
540
|
let n = e.match(RegExp(`${t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\s*\\{([^}]*)\\}`));
|
|
441
541
|
if (!n) throw Error(`block not found in theme.css: ${t}`);
|
|
442
542
|
let r = {};
|
|
@@ -446,7 +546,7 @@ function M(e, t) {
|
|
|
446
546
|
}
|
|
447
547
|
return r;
|
|
448
548
|
}
|
|
449
|
-
function
|
|
549
|
+
function R(e) {
|
|
450
550
|
let t = d(e), [n, r, i] = [
|
|
451
551
|
1,
|
|
452
552
|
3,
|
|
@@ -454,13 +554,13 @@ function N(e) {
|
|
|
454
554
|
].map((e) => Number.parseInt(t.slice(e, e + 2), 16) / 255).map((e) => e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4);
|
|
455
555
|
return .2126 * n + .7152 * r + .0722 * i;
|
|
456
556
|
}
|
|
457
|
-
function
|
|
458
|
-
let [n, r] = [
|
|
557
|
+
function z(e, t) {
|
|
558
|
+
let [n, r] = [R(e), R(t)];
|
|
459
559
|
return (Math.max(n, r) + .05) / (Math.min(n, r) + .05);
|
|
460
560
|
}
|
|
461
561
|
//#endregion
|
|
462
562
|
//#region src/tokens/readability.ts
|
|
463
|
-
var
|
|
563
|
+
var B = [
|
|
464
564
|
{
|
|
465
565
|
text: "mutedForeground",
|
|
466
566
|
surface: "background",
|
|
@@ -502,41 +602,41 @@ var F = [
|
|
|
502
602
|
min: 3
|
|
503
603
|
}
|
|
504
604
|
];
|
|
505
|
-
function
|
|
506
|
-
return
|
|
507
|
-
let n =
|
|
605
|
+
function V(e) {
|
|
606
|
+
return B.flatMap((t) => {
|
|
607
|
+
let n = z(e[t.text], e[t.surface]);
|
|
508
608
|
return n >= t.min ? [] : [{
|
|
509
609
|
...t,
|
|
510
610
|
ratio: n
|
|
511
611
|
}];
|
|
512
612
|
});
|
|
513
613
|
}
|
|
514
|
-
var
|
|
515
|
-
function
|
|
516
|
-
return
|
|
614
|
+
var H = .01;
|
|
615
|
+
function U(e) {
|
|
616
|
+
return B.filter((t) => t.text === e);
|
|
517
617
|
}
|
|
518
|
-
function
|
|
519
|
-
return n.every((n) =>
|
|
618
|
+
function W(e, t, n) {
|
|
619
|
+
return n.every((n) => z(e, t[n.surface]) >= n.min);
|
|
520
620
|
}
|
|
521
|
-
function
|
|
621
|
+
function G(e, n) {
|
|
522
622
|
let a = r(e[n]);
|
|
523
623
|
if (!a) return null;
|
|
524
|
-
let o =
|
|
525
|
-
for (let n =
|
|
624
|
+
let o = U(n);
|
|
625
|
+
for (let n = H; n <= 1; n += H) for (let r of [-1, 1]) {
|
|
526
626
|
let s = a.l + r * n;
|
|
527
627
|
if (s < 0 || s > 1) continue;
|
|
528
628
|
let c = i(t(Number(s.toFixed(4)), 0, 1), a.c, a.h);
|
|
529
|
-
if (
|
|
629
|
+
if (W(c, e, o)) return c;
|
|
530
630
|
}
|
|
531
631
|
return null;
|
|
532
632
|
}
|
|
533
633
|
//#endregion
|
|
534
634
|
//#region src/tokens/theme-recipe.ts
|
|
535
|
-
var
|
|
635
|
+
var K = 1, q = {
|
|
536
636
|
cool: "oklch(0.965 0.02 240)",
|
|
537
637
|
neutral: "oklch(0.97 0 0)",
|
|
538
638
|
warm: "oklch(0.965 0.025 75)"
|
|
539
|
-
},
|
|
639
|
+
}, J = {
|
|
540
640
|
light: {
|
|
541
641
|
ground: {},
|
|
542
642
|
card: {
|
|
@@ -583,41 +683,41 @@ var V = 1, H = {
|
|
|
583
683
|
}
|
|
584
684
|
}
|
|
585
685
|
};
|
|
586
|
-
function
|
|
686
|
+
function Y(e, n) {
|
|
587
687
|
let a = r(e);
|
|
588
688
|
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;
|
|
589
689
|
}
|
|
590
|
-
function
|
|
591
|
-
let n =
|
|
690
|
+
function X(e, t) {
|
|
691
|
+
let n = J[t];
|
|
592
692
|
return {
|
|
593
|
-
background:
|
|
594
|
-
card:
|
|
595
|
-
border:
|
|
596
|
-
secondary:
|
|
597
|
-
primary:
|
|
598
|
-
accent:
|
|
693
|
+
background: Y(e.surface, n.ground),
|
|
694
|
+
card: Y(e.surface, n.card),
|
|
695
|
+
border: Y(e.surface, n.border),
|
|
696
|
+
secondary: Y(e.surface, n.secondary),
|
|
697
|
+
primary: Y(e.accent, n.primary),
|
|
698
|
+
accent: Y(e.accent, n.accent)
|
|
599
699
|
};
|
|
600
700
|
}
|
|
601
|
-
var
|
|
701
|
+
var ae = [
|
|
602
702
|
"primary",
|
|
603
703
|
"ring",
|
|
604
704
|
"mutedForeground",
|
|
605
705
|
"destructive"
|
|
606
706
|
];
|
|
607
|
-
function
|
|
608
|
-
let t = { ...e }, n = new Set(
|
|
609
|
-
for (let e of
|
|
707
|
+
function Z(e) {
|
|
708
|
+
let t = { ...e }, n = new Set(V(t).map((e) => e.text));
|
|
709
|
+
for (let e of ae) n.has(e) && (t[e] = G(t, e) ?? t[e]);
|
|
610
710
|
return t;
|
|
611
711
|
}
|
|
612
|
-
function
|
|
613
|
-
let t =
|
|
712
|
+
function Q(e) {
|
|
713
|
+
let t = X(e, "light"), n = s(t, "light"), r = e.darkLinked ? c(t) : s(X(e, "dark"), "dark");
|
|
614
714
|
return {
|
|
615
|
-
light:
|
|
616
|
-
dark:
|
|
715
|
+
light: Z(n),
|
|
716
|
+
dark: Z(r)
|
|
617
717
|
};
|
|
618
718
|
}
|
|
619
|
-
function
|
|
620
|
-
let t =
|
|
719
|
+
function oe(e) {
|
|
720
|
+
let t = Q(e);
|
|
621
721
|
return {
|
|
622
722
|
light: {
|
|
623
723
|
...t.light,
|
|
@@ -629,15 +729,15 @@ function Y(e) {
|
|
|
629
729
|
}
|
|
630
730
|
};
|
|
631
731
|
}
|
|
632
|
-
function
|
|
732
|
+
function se(e, t, n) {
|
|
633
733
|
return e.set[t][n] === void 0;
|
|
634
734
|
}
|
|
635
|
-
function
|
|
735
|
+
function $(e, t) {
|
|
636
736
|
let n = {};
|
|
637
737
|
for (let r of Object.keys(t)) t[r] !== e[r] && (n[r] = t[r]);
|
|
638
738
|
return n;
|
|
639
739
|
}
|
|
640
|
-
function
|
|
740
|
+
function ce(e, t, n) {
|
|
641
741
|
let r = {
|
|
642
742
|
v: 1,
|
|
643
743
|
accent: e.light.primary,
|
|
@@ -649,14 +749,14 @@ function Q(e, t, n) {
|
|
|
649
749
|
light: {},
|
|
650
750
|
dark: {}
|
|
651
751
|
}
|
|
652
|
-
}, i =
|
|
752
|
+
}, i = Q(r);
|
|
653
753
|
return {
|
|
654
754
|
...r,
|
|
655
755
|
set: {
|
|
656
|
-
light:
|
|
657
|
-
dark:
|
|
756
|
+
light: $(i.light, e.light),
|
|
757
|
+
dark: $(i.dark, e.dark)
|
|
658
758
|
}
|
|
659
759
|
};
|
|
660
760
|
}
|
|
661
761
|
//#endregion
|
|
662
|
-
export {
|
|
762
|
+
export { k as DEFAULT_THEME_ID, j as FONT_MONO, A as FONT_SANS, y as FROSTED, v as MATERIAL_PRESETS, b as MATERIAL_RANGES, g as MATERIAL_VERSION, B as READABLE_PAIRS, K as RECIPE_VERSION, P as THEME_PRESETS, q as TINT_SURFACES, t as clamp, z as contrastRatio, c as deriveDarkFromLight, u as ensureFullThemeColors, V as findUnreadable, G as fixReadable, F as getAllPresets, I as getPreset, se as isDerived, T as materialDials, w as materialTerms, d as oklchToHex, r as parseOklch, L as parseThemeBlock, ie as resolveMaterial, oe as resolveRecipe, s as resolveThemeColors, ce as seedsFromColors, i as toOklch };
|
|
@@ -1,22 +1,61 @@
|
|
|
1
1
|
export declare const MATERIAL_VERSION = 1;
|
|
2
|
-
export type MaterialPresetId = "frosted" | "paper" | "neon" | "chalk";
|
|
2
|
+
export type MaterialPresetId = "frosted" | "frost" | "paper" | "neon" | "chalk";
|
|
3
3
|
/** Tier 2 of the glass formula: what every surface's knobs are multiplied by. The homeowner's dials. */
|
|
4
4
|
export interface MaterialDials {
|
|
5
5
|
/** Backdrop blur radius, px. */
|
|
6
6
|
blur: number;
|
|
7
7
|
/** How much of the card colour a surface keeps, %; the rest is the wallpaper. */
|
|
8
8
|
clarity: number;
|
|
9
|
-
/**
|
|
9
|
+
/** Default for edge, sheen and shadow together; each can then move on its own. */
|
|
10
10
|
depth: number;
|
|
11
11
|
/** Scales the tone wash. */
|
|
12
12
|
tint: number;
|
|
13
|
-
/**
|
|
13
|
+
/** Bloom radius in the surface's own hue, px. */
|
|
14
14
|
glow: number;
|
|
15
15
|
/** 0..1; above 0 every surface is hand-inked: a drawn line over a hand-laid fill. */
|
|
16
16
|
ink: number;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
export
|
|
18
|
+
export type WashStyle = "flat" | "fade" | "two-tone";
|
|
19
|
+
export type RimPosition = "top" | "top-bottom" | "around";
|
|
20
|
+
export type GlowPosition = "outside" | "inside";
|
|
21
|
+
export type MaterialFace = "flat" | "raised";
|
|
22
|
+
/** The creator's terms. Every one has a default that renders today's glass. */
|
|
23
|
+
export interface MaterialTerms extends MaterialDials {
|
|
24
|
+
/** Backdrop saturation and brightness together; 1 is each surface's own. */
|
|
25
|
+
vibrancy: number;
|
|
26
|
+
/** The bright hairline and rim light. Defaults to depth. */
|
|
27
|
+
edge: number;
|
|
28
|
+
/** The white sweep. Defaults to depth. */
|
|
29
|
+
sheen: number;
|
|
30
|
+
/** The lift shadow. Defaults to depth. */
|
|
31
|
+
shadow: number;
|
|
32
|
+
/** Glass thickness: a soft inner shade with a light catch, 0..1. */
|
|
33
|
+
inset: number;
|
|
34
|
+
/** Where the light comes from, degrees, 0 is the top; turns sheen, rim and inset together. */
|
|
35
|
+
lightFrom: number;
|
|
36
|
+
rim: RimPosition;
|
|
37
|
+
/** Dark mode multiplies edge, sheen, inset and inner glow by this. */
|
|
38
|
+
darkScale: number;
|
|
39
|
+
glowAt: GlowPosition;
|
|
40
|
+
/** Light inside the card from the top, 0..1. */
|
|
41
|
+
innerGlow: number;
|
|
42
|
+
/** 0 is white light, 1 the surface's own hue. */
|
|
43
|
+
innerGlowHue: number;
|
|
44
|
+
/** Fine still frost over a card's fill, 0..1. */
|
|
45
|
+
grain: number;
|
|
46
|
+
washStyle: WashStyle;
|
|
47
|
+
/** Angle of the tone wash, degrees. */
|
|
48
|
+
washAngle: number;
|
|
49
|
+
face: MaterialFace;
|
|
50
|
+
/** Raised and pressed depth, for the surface face and the controls. */
|
|
51
|
+
relief: number;
|
|
52
|
+
/** "theme" is the theme's --primary; otherwise a colour. */
|
|
53
|
+
accent: string;
|
|
54
|
+
/** Accent wash on surfaces that pass no tone, 0..0.6. */
|
|
55
|
+
fill: number;
|
|
56
|
+
}
|
|
57
|
+
/** Terms a preset turns on; inert at zero, never a creator term. */
|
|
58
|
+
export interface MaterialPresetTerms {
|
|
20
59
|
/** Edge width, px. */
|
|
21
60
|
edgeWidth: number;
|
|
22
61
|
/** 0..1, how far the edge moves toward the material ink. */
|
|
@@ -26,15 +65,21 @@ export interface MaterialTerms {
|
|
|
26
65
|
/** 0..1, how far the Ink line moves from the mode's ink toward the foreground: chalk on a dark board. */
|
|
27
66
|
inkLift: number;
|
|
28
67
|
}
|
|
29
|
-
export type MaterialSpec = MaterialDials & MaterialTerms
|
|
68
|
+
export type MaterialSpec = MaterialDials & MaterialPresetTerms & Partial<MaterialTerms>;
|
|
30
69
|
/** What was chosen, never what was computed. */
|
|
31
70
|
export interface Material {
|
|
32
71
|
v: typeof MATERIAL_VERSION;
|
|
33
72
|
preset: MaterialPresetId;
|
|
34
|
-
dials?: Partial<
|
|
73
|
+
dials?: Partial<MaterialTerms>;
|
|
35
74
|
}
|
|
36
75
|
export type BlurMode = "dynamic" | "performant" | "none";
|
|
37
76
|
export declare const MATERIAL_PRESETS: Record<MaterialPresetId, MaterialSpec>;
|
|
38
77
|
export declare const FROSTED: Material;
|
|
78
|
+
type NumericTerm = {
|
|
79
|
+
[K in keyof MaterialTerms]: MaterialTerms[K] extends number ? K : never;
|
|
80
|
+
}[keyof MaterialTerms];
|
|
81
|
+
export declare const MATERIAL_RANGES: Record<NumericTerm, [number, number]>;
|
|
82
|
+
export declare function materialTerms(material: Material): MaterialTerms;
|
|
39
83
|
export declare function materialDials(material: Material): MaterialDials;
|
|
40
|
-
export declare function resolveMaterial(material: Material, blurMode: BlurMode): Record
|
|
84
|
+
export declare function resolveMaterial(material: Material, blurMode: BlurMode, mode?: "light" | "dark"): Record<`--${string}`, string>;
|
|
85
|
+
export {};
|