@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.
- package/SPEC.md +84 -2
- package/dist/index.js +2 -2
- package/dist/lib/anchor-placement.d.ts +5 -0
- 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 +2 -0
- package/dist/lib/overlay-classes.d.ts +4 -2
- package/dist/lib/spotlight-geometry.d.ts +22 -0
- package/dist/solid/button.d.ts +8 -3
- package/dist/solid/color-disc.d.ts +33 -0
- package/dist/solid/dashboard-preview.d.ts +24 -0
- package/dist/solid/dialog-parts.d.ts +1 -0
- package/dist/solid/dialog.d.ts +3 -0
- package/dist/solid/dock.d.ts +9 -0
- package/dist/solid/docked-panel.d.ts +11 -0
- package/dist/solid/image-picker.d.ts +3 -0
- package/dist/solid/index.d.ts +9 -3
- package/dist/solid/index.js +6254 -5475
- package/dist/solid/media-store.d.ts +10 -0
- package/dist/solid/option-card.d.ts +2 -1
- package/dist/solid/page-header.d.ts +2 -2
- package/dist/solid/preview-tile.d.ts +35 -0
- package/dist/solid/responsive-dialog.d.ts +2 -0
- package/dist/solid/schema-form.d.ts +6 -1
- package/dist/solid/sliding-indicator.d.ts +2 -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/toggle-group.d.ts +4 -1
- package/dist/solid/widget-identity.d.ts +2 -0
- package/dist/tokens/index.d.ts +1 -0
- package/dist/tokens/index.js +336 -118
- package/dist/tokens/material.d.ts +40 -0
- package/dist/tokens/presets.d.ts +3 -0
- package/dist/tokens/theme-colors.d.ts +13 -3
- package/dist/tokens/theme-recipe.d.ts +8 -0
- package/dist/{utils-COITV1s9.js → utils-CMk7R3zM.js} +488 -485
- package/package.json +2 -2
- package/scripts/check-ui-drift.mjs +5 -0
- package/src/lib/anchor-placement.ts +30 -0
- package/src/lib/button-variants.ts +13 -12
- package/src/lib/card-classes.ts +4 -3
- package/src/lib/motion-classes.ts +10 -0
- package/src/lib/overlay-classes.ts +10 -2
- package/src/lib/spotlight-geometry.ts +90 -0
- package/src/solid/bottom-sheet/bottom-sheet.tsx +8 -1
- package/src/solid/button.tsx +17 -2
- package/src/solid/color-disc.tsx +253 -0
- package/src/solid/dashboard-preview.tsx +128 -0
- package/src/solid/dialog-parts.tsx +5 -1
- package/src/solid/dialog.tsx +47 -5
- package/src/solid/dock.tsx +67 -9
- package/src/solid/docked-panel.tsx +56 -0
- package/src/solid/entity-selector.tsx +2 -2
- package/src/solid/hero-action.tsx +2 -2
- package/src/solid/image-picker.tsx +232 -147
- package/src/solid/index.ts +20 -2
- package/src/solid/media-store.ts +20 -1
- package/src/solid/option-card.tsx +27 -31
- package/src/solid/page-header.tsx +9 -16
- package/src/solid/preview-tile.tsx +89 -0
- package/src/solid/radio-group.tsx +7 -2
- package/src/solid/responsive-dialog.tsx +10 -2
- package/src/solid/schema-form.tsx +30 -4
- package/src/solid/section-card.tsx +4 -2
- package/src/solid/sliding-indicator.tsx +34 -17
- package/src/solid/spotlight.tsx +179 -0
- package/src/solid/swatch-picker.tsx +47 -0
- package/src/solid/tabs.tsx +20 -4
- package/src/solid/toggle-group.tsx +43 -8
- package/src/solid/widget-identity.tsx +3 -1
- package/src/styles/globals.css +166 -14
- package/src/styles/theme.css +25 -3
- package/src/tokens/index.ts +1 -0
- package/src/tokens/material.ts +116 -0
- package/src/tokens/presets.ts +195 -56
- package/src/tokens/theme-colors.ts +15 -3
- package/src/tokens/theme-recipe.ts +18 -4
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,13 +453,13 @@ 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
|
|
248
|
-
var
|
|
462
|
+
var F = [
|
|
249
463
|
{
|
|
250
464
|
text: "mutedForeground",
|
|
251
465
|
surface: "background",
|
|
@@ -287,37 +501,41 @@ var D = [
|
|
|
287
501
|
min: 3
|
|
288
502
|
}
|
|
289
503
|
];
|
|
290
|
-
function
|
|
291
|
-
return
|
|
292
|
-
let n =
|
|
504
|
+
function I(e) {
|
|
505
|
+
return F.flatMap((t) => {
|
|
506
|
+
let n = P(e[t.text], e[t.surface]);
|
|
293
507
|
return n >= t.min ? [] : [{
|
|
294
508
|
...t,
|
|
295
509
|
ratio: n
|
|
296
510
|
}];
|
|
297
511
|
});
|
|
298
512
|
}
|
|
299
|
-
var
|
|
300
|
-
function
|
|
301
|
-
return
|
|
513
|
+
var L = .01;
|
|
514
|
+
function R(e) {
|
|
515
|
+
return F.filter((t) => t.text === e);
|
|
302
516
|
}
|
|
303
|
-
function
|
|
304
|
-
return n.every((n) =>
|
|
517
|
+
function z(e, t, n) {
|
|
518
|
+
return n.every((n) => P(e, t[n.surface]) >= n.min);
|
|
305
519
|
}
|
|
306
|
-
function
|
|
520
|
+
function B(e, n) {
|
|
307
521
|
let a = r(e[n]);
|
|
308
522
|
if (!a) return null;
|
|
309
|
-
let o =
|
|
310
|
-
for (let n =
|
|
523
|
+
let o = R(n);
|
|
524
|
+
for (let n = L; n <= 1; n += L) for (let r of [-1, 1]) {
|
|
311
525
|
let s = a.l + r * n;
|
|
312
526
|
if (s < 0 || s > 1) continue;
|
|
313
527
|
let c = i(t(Number(s.toFixed(4)), 0, 1), a.c, a.h);
|
|
314
|
-
if (
|
|
528
|
+
if (z(c, e, o)) return c;
|
|
315
529
|
}
|
|
316
530
|
return null;
|
|
317
531
|
}
|
|
318
532
|
//#endregion
|
|
319
533
|
//#region src/tokens/theme-recipe.ts
|
|
320
|
-
var
|
|
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 = {
|
|
321
539
|
light: {
|
|
322
540
|
ground: {},
|
|
323
541
|
card: {
|
|
@@ -338,24 +556,24 @@ var N = 1, P = {
|
|
|
338
556
|
},
|
|
339
557
|
dark: {
|
|
340
558
|
ground: {
|
|
341
|
-
lTo: .
|
|
342
|
-
c:
|
|
343
|
-
cMax: .
|
|
559
|
+
lTo: .15,
|
|
560
|
+
c: 2.6,
|
|
561
|
+
cMax: .07
|
|
344
562
|
},
|
|
345
563
|
card: {
|
|
346
|
-
lTo: .
|
|
347
|
-
c:
|
|
348
|
-
cMax: .
|
|
564
|
+
lTo: .19,
|
|
565
|
+
c: 2.6,
|
|
566
|
+
cMax: .07
|
|
349
567
|
},
|
|
350
568
|
border: {
|
|
351
|
-
lTo: .
|
|
352
|
-
c:
|
|
353
|
-
cMax: .
|
|
569
|
+
lTo: .27,
|
|
570
|
+
c: 2.6,
|
|
571
|
+
cMax: .08
|
|
354
572
|
},
|
|
355
573
|
secondary: {
|
|
356
|
-
lTo: .
|
|
357
|
-
c:
|
|
358
|
-
cMax: .
|
|
574
|
+
lTo: .22,
|
|
575
|
+
c: 2.6,
|
|
576
|
+
cMax: .07
|
|
359
577
|
},
|
|
360
578
|
primary: { l: .08 },
|
|
361
579
|
accent: {
|
|
@@ -364,41 +582,41 @@ var N = 1, P = {
|
|
|
364
582
|
}
|
|
365
583
|
}
|
|
366
584
|
};
|
|
367
|
-
function
|
|
585
|
+
function W(e, n) {
|
|
368
586
|
let a = r(e);
|
|
369
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;
|
|
370
588
|
}
|
|
371
|
-
function
|
|
372
|
-
let n =
|
|
589
|
+
function G(e, t) {
|
|
590
|
+
let n = U[t];
|
|
373
591
|
return {
|
|
374
|
-
background:
|
|
375
|
-
card:
|
|
376
|
-
border:
|
|
377
|
-
secondary:
|
|
378
|
-
primary:
|
|
379
|
-
accent:
|
|
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)
|
|
380
598
|
};
|
|
381
599
|
}
|
|
382
|
-
var
|
|
600
|
+
var K = [
|
|
383
601
|
"primary",
|
|
384
602
|
"ring",
|
|
385
603
|
"mutedForeground",
|
|
386
604
|
"destructive"
|
|
387
605
|
];
|
|
388
|
-
function
|
|
389
|
-
let t = { ...e }, n = new Set(
|
|
390
|
-
for (let e of
|
|
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]);
|
|
391
609
|
return t;
|
|
392
610
|
}
|
|
393
|
-
function
|
|
394
|
-
let t =
|
|
611
|
+
function J(e) {
|
|
612
|
+
let t = G(e, "light"), n = s(t, "light"), r = e.darkLinked ? c(t) : s(G(e, "dark"), "dark");
|
|
395
613
|
return {
|
|
396
|
-
light:
|
|
397
|
-
dark:
|
|
614
|
+
light: q(n),
|
|
615
|
+
dark: q(r)
|
|
398
616
|
};
|
|
399
617
|
}
|
|
400
|
-
function
|
|
401
|
-
let t =
|
|
618
|
+
function Y(e) {
|
|
619
|
+
let t = J(e);
|
|
402
620
|
return {
|
|
403
621
|
light: {
|
|
404
622
|
...t.light,
|
|
@@ -410,15 +628,15 @@ function B(e) {
|
|
|
410
628
|
}
|
|
411
629
|
};
|
|
412
630
|
}
|
|
413
|
-
function
|
|
631
|
+
function X(e, t, n) {
|
|
414
632
|
return e.set[t][n] === void 0;
|
|
415
633
|
}
|
|
416
|
-
function
|
|
634
|
+
function Z(e, t) {
|
|
417
635
|
let n = {};
|
|
418
636
|
for (let r of Object.keys(t)) t[r] !== e[r] && (n[r] = t[r]);
|
|
419
637
|
return n;
|
|
420
638
|
}
|
|
421
|
-
function
|
|
639
|
+
function Q(e, t, n) {
|
|
422
640
|
let r = {
|
|
423
641
|
v: 1,
|
|
424
642
|
accent: e.light.primary,
|
|
@@ -430,14 +648,14 @@ function U(e, t, n) {
|
|
|
430
648
|
light: {},
|
|
431
649
|
dark: {}
|
|
432
650
|
}
|
|
433
|
-
}, i =
|
|
651
|
+
}, i = J(r);
|
|
434
652
|
return {
|
|
435
653
|
...r,
|
|
436
654
|
set: {
|
|
437
|
-
light:
|
|
438
|
-
dark:
|
|
655
|
+
light: Z(i.light, e.light),
|
|
656
|
+
dark: Z(i.dark, e.dark)
|
|
439
657
|
}
|
|
440
658
|
};
|
|
441
659
|
}
|
|
442
660
|
//#endregion
|
|
443
|
-
export {
|
|
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. */
|
|
@@ -20,14 +20,24 @@ export interface ThemeColorsConfig {
|
|
|
20
20
|
light: ThemeColors;
|
|
21
21
|
dark: ThemeColors;
|
|
22
22
|
}
|
|
23
|
-
export interface
|
|
23
|
+
export interface BackgroundLayer {
|
|
24
24
|
type: "solid" | "static" | "custom";
|
|
25
25
|
id: string;
|
|
26
|
-
themed: boolean;
|
|
27
|
-
url?: string;
|
|
28
26
|
fit?: "cover" | "contain" | "tile";
|
|
27
|
+
/** 0 to 1: how far the wallpaper fades toward `--background`. */
|
|
29
28
|
overlay?: number;
|
|
29
|
+
/** 0 to 20, in px. */
|
|
30
30
|
blur?: number;
|
|
31
|
+
/** 0 to 1: how dark the corners fall. */
|
|
32
|
+
vignette?: number;
|
|
33
|
+
}
|
|
34
|
+
/** The picture alone; visibility and softness belong to the theme, the same in both modes. */
|
|
35
|
+
export type BackgroundImage = Pick<BackgroundLayer, "type" | "id" | "fit">;
|
|
36
|
+
export interface BackgroundConfig extends BackgroundLayer {
|
|
37
|
+
themed: boolean;
|
|
38
|
+
url?: string;
|
|
39
|
+
/** Shown in dark mode instead of the top-level picture. */
|
|
40
|
+
dark?: BackgroundImage;
|
|
31
41
|
}
|
|
32
42
|
/** The 6 base colors used as input for resolving a full ThemeColors */
|
|
33
43
|
export type ThemeBaseColors = Pick<ThemeColors, "primary" | "accent" | "secondary" | "border" | "card" | "background">;
|