@glasshome/ui 1.23.0 → 1.24.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/dist/index.d.ts +1 -0
- package/dist/index.js +3 -3
- package/dist/lib/anchor-placement.d.ts +3 -4
- package/dist/lib/hold.d.ts +6 -0
- package/dist/lib/motion-classes.d.ts +1 -1
- package/dist/solid/index.d.ts +1 -0
- package/dist/solid/index.js +4116 -4094
- package/dist/{utils-o6ev-9h_.js → utils-rZf2Zpkw.js} +102 -102
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/lib/anchor-placement.ts +38 -15
- package/src/lib/hold.ts +7 -0
- package/src/lib/motion-classes.ts +1 -1
- package/src/solid/dialog.tsx +16 -1
- package/src/solid/index.ts +1 -0
- package/src/styles/theme.css +4 -1
|
@@ -152,7 +152,7 @@ var g = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, _ = [], { com
|
|
|
152
152
|
}), ne = S({
|
|
153
153
|
variant: "outline",
|
|
154
154
|
size: "none"
|
|
155
|
-
}), re = "inline-flex shrink-0 cursor-pointer items-center justify-center rounded-lg transition-glass duration-150 hover:bg-primary/10 active:scale-[0.97]", w = "data-[expanded]:animate-in data-[expanded]:duration-(--duration-expand) data-[expanded]:ease-(--ease-expand)", T = "data-[closed]:animate-out data-[closed]:duration-(--duration-micro) data-[closed]:ease-(--ease-contract)", ie = `origin-(--kb-popper-content-transform-origin) ${w} data-[expanded]:fade-in-0 data-[expanded]:zoom-in-90 ${T} data-[closed]:fade-out-0 data-[closed]:zoom-out-95`, E = "data-[closed]:animate-select-out data-[expanded]:animate-select-in", D = "[--morph-w:var(--kb-popper-anchor-width)] min-w-[var(--kb-popper-anchor-width)] data-[expanded]:animate-morph-in data-[closed]:animate-morph-out", O = "data-[expanded]:animate-anchored-in data-[closed]:animate-morph-out", k = "gh-stagger", A = `${w} data-[expanded]:fade-in-0 data-[expanded]:zoom-in-[0.94] data-[expanded]:slide-in-from-bottom-2 ${T} data-[closed]:fade-out-0 data-[closed]:zoom-out-[0.96]`, j = `${w} data-[expanded]:fade-in-0 ${T} data-[closed]:fade-out-0`, ae = "animate-in fade-in-0 slide-in-from-bottom-1 duration-(--duration-state) ease-(--ease-expand)", oe = "active:scale-[0.97]", se = "scale-0 opacity-0 transition-[scale,opacity] duration-(--duration-state) ease-(--ease-contract) data-[hold]:scale-100 data-[hold]:opacity-100 data-[hold]:duration-(--duration-
|
|
155
|
+
}), re = "inline-flex shrink-0 cursor-pointer items-center justify-center rounded-lg transition-glass duration-150 hover:bg-primary/10 active:scale-[0.97]", w = "data-[expanded]:animate-in data-[expanded]:duration-(--duration-expand) data-[expanded]:ease-(--ease-expand)", T = "data-[closed]:animate-out data-[closed]:duration-(--duration-micro) data-[closed]:ease-(--ease-contract)", ie = `origin-(--kb-popper-content-transform-origin) ${w} data-[expanded]:fade-in-0 data-[expanded]:zoom-in-90 ${T} data-[closed]:fade-out-0 data-[closed]:zoom-out-95`, E = "data-[closed]:animate-select-out data-[expanded]:animate-select-in", D = "[--morph-w:var(--kb-popper-anchor-width)] min-w-[var(--kb-popper-anchor-width)] data-[expanded]:animate-morph-in data-[closed]:animate-morph-out", O = "data-[expanded]:animate-anchored-in data-[closed]:animate-morph-out", k = "gh-stagger", A = `${w} data-[expanded]:fade-in-0 data-[expanded]:zoom-in-[0.94] data-[expanded]:slide-in-from-bottom-2 ${T} data-[closed]:fade-out-0 data-[closed]:zoom-out-[0.96]`, j = `${w} data-[expanded]:fade-in-0 ${T} data-[closed]:fade-out-0`, ae = "animate-in fade-in-0 slide-in-from-bottom-1 duration-(--duration-state) ease-(--ease-expand)", oe = "active:scale-[0.97]", se = "scale-0 opacity-0 transition-[scale,opacity] duration-(--duration-state) ease-(--ease-contract) data-[hold]:scale-100 data-[hold]:opacity-100 data-[hold]:duration-(--duration-hold) data-[hold]:ease-linear data-[fired]:scale-100 data-[fired]:opacity-0", ce = "origin-bottom transition-[opacity,scale,translate] data-[expanded]:duration-(--duration-expand) data-[expanded]:ease-(--ease-expand) data-[closed]:duration-(--duration-micro) data-[closed]:ease-(--ease-contract) data-[closed]:pointer-events-none data-[closed]:translate-y-2 data-[closed]:scale-95 data-[closed]:opacity-0", M = "transition-[translate,clip-path] duration-(--duration-morph) ease-(--ease-expand)", N = "glass [--glass-wash:20%] [--glass-rim:0.3] [--glass-lift:0.45] [--glass-shade:0.05] dark:[--glass-shade:0]", P = `${N} [--glass-base:color-mix(in_srgb,var(--card)_var(--material-clarity),transparent)]`, le = "backdrop-blur-[var(--glass-blur,var(--material-blur,24px))] backdrop-saturate-[1.8]", F = `${P} ${le}`, ue = N, I = "glass [--glass-rim:0.3] [--glass-base:color-mix(in_srgb,var(--card)_var(--material-clarity),transparent)]", L = "border border-border/50 bg-card/40 backdrop-blur-sm", R = {
|
|
156
156
|
slots: "flex flex-col gap-3 p-3 md:gap-4 md:p-4",
|
|
157
157
|
md: "flex flex-col gap-3 p-4",
|
|
158
158
|
sm: "flex flex-col gap-2 p-3",
|
|
@@ -222,9 +222,9 @@ var Fe = "var(--muted-foreground)", Ie = "[--glass-wash:12%]", Le = (e) => e ===
|
|
|
222
222
|
sub: "text-3xl",
|
|
223
223
|
gap: "gap-2"
|
|
224
224
|
}
|
|
225
|
-
}, Ge = "inline-flex items-end", Ke = "flex flex-col gap-0.5", qe = "shrink-0", Je = "whitespace-nowrap font-bold leading-none tracking-tight", Ye = "font-bold text-primary uppercase leading-none tracking-[0.18em]", Xe = "relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 text-sm outline-hidden transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&:not([data-tone])_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&>[data-slot=icon]]:shrink-0 [&>[data-slot=icon]]:text-[16px]", Ze = "px-2", Qe = `${Xe} ${Ze}`, $e = "px-2 py-1.5 font-medium text-muted-foreground text-xs", et = "-mx-1 my-1 h-px bg-border", tt = "glass glass-frost [--glass-rim:0.5] [--glass-lift:0.6] [--glass-light:0] [--glass-edge:color-mix(in_srgb,var(--border)_90%,transparent)]",
|
|
226
|
-
`${
|
|
227
|
-
var
|
|
225
|
+
}, Ge = "inline-flex items-end", Ke = "flex flex-col gap-0.5", qe = "shrink-0", Je = "whitespace-nowrap font-bold leading-none tracking-tight", Ye = "font-bold text-primary uppercase leading-none tracking-[0.18em]", Xe = "relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 text-sm outline-hidden transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&:not([data-tone])_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&>[data-slot=icon]]:shrink-0 [&>[data-slot=icon]]:text-[16px]", Ze = "px-2", Qe = `${Xe} ${Ze}`, $e = "px-2 py-1.5 font-medium text-muted-foreground text-xs", et = "-mx-1 my-1 h-px bg-border", tt = 350, nt = 100, rt = "glass glass-frost [--glass-rim:0.5] [--glass-lift:0.6] [--glass-light:0] [--glass-edge:color-mix(in_srgb,var(--border)_90%,transparent)]", it = "backdrop-blur-[var(--glass-blur,var(--material-blur,24px))] backdrop-saturate-[1.2]", at = `${rt} [--glass-base:color-mix(in_srgb,var(--popover)_92%,transparent)]`, ot = `${at} ${it}`, st = `${rt} [--glass-base:var(--popover)]`, ct = "bg-scrim backdrop-blur-md", lt = `${ze.overlay} rounded-md text-popover-foreground outline-hidden`;
|
|
226
|
+
`${ot}${lt}`;
|
|
227
|
+
var ut = `${ot} relative ${lt}`, dt = (e) => {
|
|
228
228
|
let t = e?.getBoundingClientRect();
|
|
229
229
|
return t ? {
|
|
230
230
|
x: t.left,
|
|
@@ -237,51 +237,51 @@ var ct = `${it} relative ${st}`, lt = (e) => {
|
|
|
237
237
|
width: 0,
|
|
238
238
|
height: 0
|
|
239
239
|
};
|
|
240
|
-
},
|
|
241
|
-
function
|
|
240
|
+
}, ft = `${Ce} ${B.default} items-center justify-between gap-2 text-left hover:[--glass-light:0.09] disabled:hover:[--glass-light:0.04] data-[expanded]:ring-0 data-[expanded]:[--glass-edge:transparent] data-[expanded]:focus-visible:ring-0 data-[expanded]:focus-visible:[--glass-edge:transparent]`, pt = "max-h-[min(70vh,400px)] overflow-y-auto gh-scroll", mt = "h-11", ht = "glass glass-tint inline-flex w-fit shrink-0 select-none items-center gap-1.5 whitespace-nowrap rounded-lg px-2.5 py-0.5 font-medium text-xs", gt = "glass flex shrink-0 items-center justify-center [--glass-rim:0.4] [--glass-light:0.08] [--glass-base:color-mix(in_srgb,var(--foreground)_10%,transparent)]", _t = "glass glass-tint flex shrink-0 items-center justify-center [--glass-rim:0.4] [--glass-wash:18%]", vt = "rounded-[var(--radius)]", yt = "rounded-[max(0px,calc(var(--radius)-var(--spacing)*3))]", bt = "p-3", xt = `${`${yt} border border-border/60 bg-card/60`} p-3`, St = `inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md ${B.sm} px-3 font-medium text-sm outline-none transition-glass active:scale-[0.97] disabled:pointer-events-none disabled:opacity-50 ${be}`, Ct = 31, wt = "block size-7 shrink-0 rounded-xl shadow-[0_2px_5px_oklch(0_0_0/0.35),inset_0_1px_0_oklch(1_0_0/0.35),inset_0_-2px_3px_oklch(0_0_0/0.2)]", Tt = "oklch(from var(--primary) var(--thumb-on-l) min(c, var(--thumb-on-c)) h)", Et = "border-2 border-white/90", Dt = "px-3.5", Ot = "-mx-3.5", kt = 640, At = /* @__PURE__ */ new Map();
|
|
241
|
+
function jt(t = 640) {
|
|
242
242
|
if (typeof window > "u") return () => void 0;
|
|
243
|
-
let n =
|
|
243
|
+
let n = At.get(t);
|
|
244
244
|
if (!n) {
|
|
245
245
|
let [r, i] = e(window.innerWidth < t);
|
|
246
|
-
window.matchMedia?.(`(max-width: ${t - 1}px)`).addEventListener("change", () => i(window.innerWidth < t)), n = r,
|
|
246
|
+
window.matchMedia?.(`(max-width: ${t - 1}px)`).addEventListener("change", () => i(window.innerWidth < t)), n = r, At.set(t, n);
|
|
247
247
|
}
|
|
248
248
|
return n;
|
|
249
249
|
}
|
|
250
250
|
//#endregion
|
|
251
251
|
//#region node_modules/tailwind-merge/dist/bundle-mjs.mjs
|
|
252
|
-
var
|
|
252
|
+
var Mt = (e, t) => {
|
|
253
253
|
let n = Array(e.length + t.length);
|
|
254
254
|
for (let t = 0; t < e.length; t++) n[t] = e[t];
|
|
255
255
|
for (let r = 0; r < t.length; r++) n[e.length + r] = t[r];
|
|
256
256
|
return n;
|
|
257
|
-
},
|
|
257
|
+
}, Nt = (e, t) => ({
|
|
258
258
|
classGroupId: e,
|
|
259
259
|
validator: t
|
|
260
|
-
}),
|
|
260
|
+
}), Pt = (e = /* @__PURE__ */ new Map(), t = null, n) => ({
|
|
261
261
|
nextPart: e,
|
|
262
262
|
validators: t,
|
|
263
263
|
classGroupId: n
|
|
264
|
-
}), V = "-",
|
|
265
|
-
let t =
|
|
264
|
+
}), V = "-", Ft = [], It = "arbitrary..", Lt = (e) => {
|
|
265
|
+
let t = Bt(e), { conflictingClassGroups: n, conflictingClassGroupModifiers: r } = e;
|
|
266
266
|
return {
|
|
267
267
|
getClassGroupId: (e) => {
|
|
268
|
-
if (e.startsWith("[") && e.endsWith("]")) return
|
|
268
|
+
if (e.startsWith("[") && e.endsWith("]")) return zt(e);
|
|
269
269
|
let n = e.split(V);
|
|
270
|
-
return
|
|
270
|
+
return Rt(n, +(n[0] === "" && n.length > 1), t);
|
|
271
271
|
},
|
|
272
272
|
getConflictingClassGroupIds: (e, t) => {
|
|
273
273
|
if (t) {
|
|
274
274
|
let t = r[e], i = n[e];
|
|
275
|
-
return t ? i ?
|
|
275
|
+
return t ? i ? Mt(i, t) : t : i || Ft;
|
|
276
276
|
}
|
|
277
|
-
return n[e] ||
|
|
277
|
+
return n[e] || Ft;
|
|
278
278
|
}
|
|
279
279
|
};
|
|
280
|
-
},
|
|
280
|
+
}, Rt = (e, t, n) => {
|
|
281
281
|
if (e.length - t === 0) return n.classGroupId;
|
|
282
282
|
let r = e[t], i = n.nextPart.get(r);
|
|
283
283
|
if (i) {
|
|
284
|
-
let n =
|
|
284
|
+
let n = Rt(e, t + 1, i);
|
|
285
285
|
if (n) return n;
|
|
286
286
|
}
|
|
287
287
|
let a = n.validators;
|
|
@@ -291,58 +291,58 @@ var At = (e, t) => {
|
|
|
291
291
|
let t = a[e];
|
|
292
292
|
if (t.validator(o)) return t.classGroupId;
|
|
293
293
|
}
|
|
294
|
-
},
|
|
294
|
+
}, zt = (e) => e.slice(1, -1).indexOf(":") === -1 ? void 0 : (() => {
|
|
295
295
|
let t = e.slice(1, -1), n = t.indexOf(":"), r = t.slice(0, n);
|
|
296
|
-
return r ?
|
|
297
|
-
})(),
|
|
296
|
+
return r ? It + r : void 0;
|
|
297
|
+
})(), Bt = (e) => {
|
|
298
298
|
let { theme: t, classGroups: n } = e;
|
|
299
|
-
return
|
|
300
|
-
},
|
|
301
|
-
let n =
|
|
299
|
+
return Vt(n, t);
|
|
300
|
+
}, Vt = (e, t) => {
|
|
301
|
+
let n = Pt();
|
|
302
302
|
for (let r in e) {
|
|
303
303
|
let i = e[r];
|
|
304
|
-
|
|
304
|
+
Ht(i, n, r, t);
|
|
305
305
|
}
|
|
306
306
|
return n;
|
|
307
|
-
},
|
|
307
|
+
}, Ht = (e, t, n, r) => {
|
|
308
308
|
let i = e.length;
|
|
309
309
|
for (let a = 0; a < i; a++) {
|
|
310
310
|
let i = e[a];
|
|
311
|
-
|
|
311
|
+
Ut(i, t, n, r);
|
|
312
312
|
}
|
|
313
|
-
},
|
|
313
|
+
}, Ut = (e, t, n, r) => {
|
|
314
314
|
if (typeof e == "string") {
|
|
315
|
-
|
|
315
|
+
Wt(e, t, n);
|
|
316
316
|
return;
|
|
317
317
|
}
|
|
318
318
|
if (typeof e == "function") {
|
|
319
|
-
|
|
319
|
+
Gt(e, t, n, r);
|
|
320
320
|
return;
|
|
321
321
|
}
|
|
322
|
-
|
|
323
|
-
},
|
|
324
|
-
let r = e === "" ? t :
|
|
322
|
+
Kt(e, t, n, r);
|
|
323
|
+
}, Wt = (e, t, n) => {
|
|
324
|
+
let r = e === "" ? t : qt(t, e);
|
|
325
325
|
r.classGroupId = n;
|
|
326
|
-
},
|
|
327
|
-
if (
|
|
328
|
-
|
|
326
|
+
}, Gt = (e, t, n, r) => {
|
|
327
|
+
if (Jt(e)) {
|
|
328
|
+
Ht(e(r), t, n, r);
|
|
329
329
|
return;
|
|
330
330
|
}
|
|
331
|
-
t.validators === null && (t.validators = []), t.validators.push(
|
|
332
|
-
},
|
|
331
|
+
t.validators === null && (t.validators = []), t.validators.push(Nt(n, e));
|
|
332
|
+
}, Kt = (e, t, n, r) => {
|
|
333
333
|
let i = Object.entries(e), a = i.length;
|
|
334
334
|
for (let e = 0; e < a; e++) {
|
|
335
335
|
let [a, o] = i[e];
|
|
336
|
-
|
|
336
|
+
Ht(o, qt(t, a), n, r);
|
|
337
337
|
}
|
|
338
|
-
},
|
|
338
|
+
}, qt = (e, t) => {
|
|
339
339
|
let n = e, r = t.split(V), i = r.length;
|
|
340
340
|
for (let e = 0; e < i; e++) {
|
|
341
341
|
let t = r[e], i = n.nextPart.get(t);
|
|
342
|
-
i || (i =
|
|
342
|
+
i || (i = Pt(), n.nextPart.set(t, i)), n = i;
|
|
343
343
|
}
|
|
344
344
|
return n;
|
|
345
|
-
},
|
|
345
|
+
}, Jt = (e) => "isThemeGetter" in e && e.isThemeGetter === !0, Yt = (e) => {
|
|
346
346
|
if (e < 1) return {
|
|
347
347
|
get: () => void 0,
|
|
348
348
|
set: () => {}
|
|
@@ -360,19 +360,19 @@ var At = (e, t) => {
|
|
|
360
360
|
e in n ? n[e] = t : i(e, t);
|
|
361
361
|
}
|
|
362
362
|
};
|
|
363
|
-
},
|
|
363
|
+
}, Xt = "!", Zt = ":", Qt = [], $t = (e, t, n, r, i) => ({
|
|
364
364
|
modifiers: e,
|
|
365
365
|
hasImportantModifier: t,
|
|
366
366
|
baseClassName: n,
|
|
367
367
|
maybePostfixModifierPosition: r,
|
|
368
368
|
isExternal: i
|
|
369
|
-
}),
|
|
369
|
+
}), en = (e) => {
|
|
370
370
|
let { prefix: t, experimentalParseClassName: n } = e, r = (e) => {
|
|
371
371
|
let t = [], n = 0, r = 0, i = 0, a, o = e.length;
|
|
372
372
|
for (let s = 0; s < o; s++) {
|
|
373
373
|
let o = e[s];
|
|
374
374
|
if (n === 0 && r === 0) {
|
|
375
|
-
if (o ===
|
|
375
|
+
if (o === Zt) {
|
|
376
376
|
t.push(e.slice(i, s)), i = s + 1;
|
|
377
377
|
continue;
|
|
378
378
|
}
|
|
@@ -384,13 +384,13 @@ var At = (e, t) => {
|
|
|
384
384
|
o === "[" ? n++ : o === "]" ? n-- : o === "(" ? r++ : o === ")" && r--;
|
|
385
385
|
}
|
|
386
386
|
let s = t.length === 0 ? e : e.slice(i), c = s, l = !1;
|
|
387
|
-
s.endsWith(
|
|
387
|
+
s.endsWith(Xt) ? (c = s.slice(0, -1), l = !0) : s.startsWith(Xt) && (c = s.slice(1), l = !0);
|
|
388
388
|
let u = a && a > i ? a - i : void 0;
|
|
389
|
-
return
|
|
389
|
+
return $t(t, l, c, u);
|
|
390
390
|
};
|
|
391
391
|
if (t) {
|
|
392
|
-
let e = t +
|
|
393
|
-
r = (t) => t.startsWith(e) ? n(t.slice(e.length)) :
|
|
392
|
+
let e = t + Zt, n = r;
|
|
393
|
+
r = (t) => t.startsWith(e) ? n(t.slice(e.length)) : $t(Qt, !1, t, void 0, !0);
|
|
394
394
|
}
|
|
395
395
|
if (n) {
|
|
396
396
|
let e = r;
|
|
@@ -400,7 +400,7 @@ var At = (e, t) => {
|
|
|
400
400
|
});
|
|
401
401
|
}
|
|
402
402
|
return r;
|
|
403
|
-
},
|
|
403
|
+
}, tn = (e) => {
|
|
404
404
|
let t = /* @__PURE__ */ new Map();
|
|
405
405
|
return e.orderSensitiveModifiers.forEach((e, n) => {
|
|
406
406
|
t.set(e, 1e6 + n);
|
|
@@ -412,18 +412,18 @@ var At = (e, t) => {
|
|
|
412
412
|
}
|
|
413
413
|
return r.length > 0 && (r.sort(), n.push(...r)), n;
|
|
414
414
|
};
|
|
415
|
-
},
|
|
416
|
-
cache:
|
|
417
|
-
parseClassName:
|
|
418
|
-
sortModifiers:
|
|
419
|
-
postfixLookupClassGroupIds:
|
|
420
|
-
...
|
|
421
|
-
}),
|
|
415
|
+
}, nn = (e) => ({
|
|
416
|
+
cache: Yt(e.cacheSize),
|
|
417
|
+
parseClassName: en(e),
|
|
418
|
+
sortModifiers: tn(e),
|
|
419
|
+
postfixLookupClassGroupIds: rn(e),
|
|
420
|
+
...Lt(e)
|
|
421
|
+
}), rn = (e) => {
|
|
422
422
|
let t = Object.create(null), n = e.postfixLookupClassGroups;
|
|
423
423
|
if (n) for (let e = 0; e < n.length; e++) t[n[e]] = !0;
|
|
424
424
|
return t;
|
|
425
|
-
},
|
|
426
|
-
let { parseClassName: n, getClassGroupId: r, getConflictingClassGroupIds: i, sortModifiers: a, postfixLookupClassGroupIds: o } = t, s = [], c = e.trim().split(
|
|
425
|
+
}, an = /\s+/, on = (e, t) => {
|
|
426
|
+
let { parseClassName: n, getClassGroupId: r, getConflictingClassGroupIds: i, sortModifiers: a, postfixLookupClassGroupIds: o } = t, s = [], c = e.trim().split(an), l = "";
|
|
427
427
|
for (let e = c.length - 1; e >= 0; --e) {
|
|
428
428
|
let t = c[e], { isExternal: u, modifiers: d, hasImportantModifier: ee, baseClassName: f, maybePostfixModifierPosition: p } = n(t);
|
|
429
429
|
if (u) {
|
|
@@ -447,7 +447,7 @@ var At = (e, t) => {
|
|
|
447
447
|
}
|
|
448
448
|
m = !1;
|
|
449
449
|
}
|
|
450
|
-
let g = d.length === 0 ? "" : d.length === 1 ? d[0] : a(d).join(":"), _ = ee ? g +
|
|
450
|
+
let g = d.length === 0 ? "" : d.length === 1 ? d[0] : a(d).join(":"), _ = ee ? g + Xt : g, v = _ + h;
|
|
451
451
|
if (s.indexOf(v) > -1) continue;
|
|
452
452
|
s.push(v);
|
|
453
453
|
let y = i(h, m);
|
|
@@ -458,33 +458,33 @@ var At = (e, t) => {
|
|
|
458
458
|
l = t + (l.length > 0 ? " " + l : l);
|
|
459
459
|
}
|
|
460
460
|
return l;
|
|
461
|
-
},
|
|
461
|
+
}, sn = (...e) => {
|
|
462
462
|
let t = 0, n, r, i = "";
|
|
463
|
-
for (; t < e.length;) (n = e[t++]) && (r =
|
|
463
|
+
for (; t < e.length;) (n = e[t++]) && (r = cn(n)) && (i && (i += " "), i += r);
|
|
464
464
|
return i;
|
|
465
|
-
},
|
|
465
|
+
}, cn = (e) => {
|
|
466
466
|
if (typeof e == "string") return e;
|
|
467
467
|
let t, n = "";
|
|
468
|
-
for (let r = 0; r < e.length; r++) e[r] && (t =
|
|
468
|
+
for (let r = 0; r < e.length; r++) e[r] && (t = cn(e[r])) && (n && (n += " "), n += t);
|
|
469
469
|
return n;
|
|
470
|
-
},
|
|
471
|
-
let n, r, i, a, o = (o) => (n =
|
|
470
|
+
}, ln = (e, ...t) => {
|
|
471
|
+
let n, r, i, a, o = (o) => (n = nn(t.reduce((e, t) => t(e), e())), r = n.cache.get, i = n.cache.set, a = s, s(o)), s = (e) => {
|
|
472
472
|
let t = r(e);
|
|
473
473
|
if (t) return t;
|
|
474
|
-
let a =
|
|
474
|
+
let a = on(e, n);
|
|
475
475
|
return i(e, a), a;
|
|
476
476
|
};
|
|
477
|
-
return a = o, (...e) => a(
|
|
478
|
-
},
|
|
479
|
-
let t = (t) => t[e] ||
|
|
477
|
+
return a = o, (...e) => a(sn(...e));
|
|
478
|
+
}, un = [], H = (e) => {
|
|
479
|
+
let t = (t) => t[e] || un;
|
|
480
480
|
return t.isThemeGetter = !0, t;
|
|
481
|
-
},
|
|
482
|
-
let r =
|
|
481
|
+
}, dn = /^\[(?:(\w[\w-]*):)?(.+)\]$/i, fn = /^\((?:(\w[\w-]*):)?(.+)\)$/i, pn = /^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/, mn = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, hn = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, gn = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/, _n = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, vn = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, U = (e) => pn.test(e), W = (e) => !!e && !Number.isNaN(Number(e)), G = (e) => !!e && Number.isInteger(Number(e)), yn = (e) => e.endsWith("%") && W(e.slice(0, -1)), K = (e) => mn.test(e), bn = () => !0, xn = (e) => hn.test(e) && !gn.test(e), Sn = () => !1, Cn = (e) => _n.test(e), wn = (e) => vn.test(e), Tn = (e) => !q(e) && !Y(e), En = (e) => e.startsWith("@container") && (e[10] === "/" && e[11] !== void 0 || e[11] === "s" && e[16] !== void 0 && e.startsWith("-size/", 10) || e[11] === "n" && e[18] !== void 0 && e.startsWith("-normal/", 10)), Dn = (e) => Q(e, Vn, Sn), q = (e) => dn.test(e), J = (e) => Q(e, Hn, xn), On = (e) => Q(e, Un, W), kn = (e) => Q(e, Gn, bn), An = (e) => Q(e, Wn, Sn), jn = (e) => Q(e, zn, Sn), Mn = (e) => Q(e, Bn, wn), Nn = (e) => Q(e, Kn, Cn), Y = (e) => fn.test(e), X = (e) => $(e, Hn), Pn = (e) => $(e, Wn), Fn = (e) => $(e, zn), In = (e) => $(e, Vn), Ln = (e) => $(e, Bn), Z = (e) => $(e, Kn, !0), Rn = (e) => $(e, Gn, !0), Q = (e, t, n) => {
|
|
482
|
+
let r = dn.exec(e);
|
|
483
483
|
return r ? r[1] ? t(r[1]) : n(r[2]) : !1;
|
|
484
484
|
}, $ = (e, t, n = !1) => {
|
|
485
|
-
let r =
|
|
485
|
+
let r = fn.exec(e);
|
|
486
486
|
return r ? r[1] ? t(r[1]) : n : !1;
|
|
487
|
-
},
|
|
487
|
+
}, zn = (e) => e === "position" || e === "percentage", Bn = (e) => e === "image" || e === "url", Vn = (e) => e === "length" || e === "size" || e === "bg-size", Hn = (e) => e === "length", Un = (e) => e === "number", Wn = (e) => e === "family-name", Gn = (e) => e === "number" || e === "weight", Kn = (e) => e === "shadow", qn = /*#__PURE__*/ ln(() => {
|
|
488
488
|
let e = H("color"), t = H("font"), n = H("text"), r = H("font-weight"), i = H("tracking"), a = H("leading"), o = H("breakpoint"), s = H("container"), c = H("spacing"), l = H("radius"), u = H("shadow"), d = H("inset-shadow"), ee = H("text-shadow"), f = H("drop-shadow"), p = H("blur"), m = H("perspective"), h = H("aspect"), g = H("ease"), _ = H("animate"), v = () => [
|
|
489
489
|
"auto",
|
|
490
490
|
"avoid",
|
|
@@ -621,8 +621,8 @@ var At = (e, t) => {
|
|
|
621
621
|
q
|
|
622
622
|
], ae = () => [
|
|
623
623
|
...y(),
|
|
624
|
-
|
|
625
|
-
|
|
624
|
+
Fn,
|
|
625
|
+
jn,
|
|
626
626
|
{ position: [Y, q] }
|
|
627
627
|
], oe = () => ["no-repeat", { repeat: [
|
|
628
628
|
"",
|
|
@@ -634,11 +634,11 @@ var At = (e, t) => {
|
|
|
634
634
|
"auto",
|
|
635
635
|
"cover",
|
|
636
636
|
"contain",
|
|
637
|
-
|
|
638
|
-
|
|
637
|
+
In,
|
|
638
|
+
Dn,
|
|
639
639
|
{ size: [Y, q] }
|
|
640
640
|
], ce = () => [
|
|
641
|
-
|
|
641
|
+
yn,
|
|
642
642
|
X,
|
|
643
643
|
J
|
|
644
644
|
], M = () => [
|
|
@@ -677,9 +677,9 @@ var At = (e, t) => {
|
|
|
677
677
|
"luminosity"
|
|
678
678
|
], F = () => [
|
|
679
679
|
W,
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
680
|
+
yn,
|
|
681
|
+
Fn,
|
|
682
|
+
jn
|
|
683
683
|
], ue = () => [
|
|
684
684
|
"",
|
|
685
685
|
"none",
|
|
@@ -717,7 +717,7 @@ var At = (e, t) => {
|
|
|
717
717
|
aspect: ["video"],
|
|
718
718
|
blur: [K],
|
|
719
719
|
breakpoint: [K],
|
|
720
|
-
color: [
|
|
720
|
+
color: [bn],
|
|
721
721
|
container: [K],
|
|
722
722
|
"drop-shadow": [K],
|
|
723
723
|
ease: [
|
|
@@ -725,7 +725,7 @@ var At = (e, t) => {
|
|
|
725
725
|
"out",
|
|
726
726
|
"in-out"
|
|
727
727
|
],
|
|
728
|
-
font: [
|
|
728
|
+
font: [Tn],
|
|
729
729
|
"font-weight": [
|
|
730
730
|
"thin",
|
|
731
731
|
"extralight",
|
|
@@ -785,7 +785,7 @@ var At = (e, t) => {
|
|
|
785
785
|
Y,
|
|
786
786
|
q
|
|
787
787
|
] }],
|
|
788
|
-
"container-named": [
|
|
788
|
+
"container-named": [En],
|
|
789
789
|
columns: [{ columns: [
|
|
790
790
|
W,
|
|
791
791
|
q,
|
|
@@ -1048,8 +1048,8 @@ var At = (e, t) => {
|
|
|
1048
1048
|
"font-style": ["italic", "not-italic"],
|
|
1049
1049
|
"font-weight": [{ font: [
|
|
1050
1050
|
r,
|
|
1051
|
-
|
|
1052
|
-
|
|
1051
|
+
Rn,
|
|
1052
|
+
kn
|
|
1053
1053
|
] }],
|
|
1054
1054
|
"font-stretch": [{ "font-stretch": [
|
|
1055
1055
|
"ultra-condensed",
|
|
@@ -1061,12 +1061,12 @@ var At = (e, t) => {
|
|
|
1061
1061
|
"expanded",
|
|
1062
1062
|
"extra-expanded",
|
|
1063
1063
|
"ultra-expanded",
|
|
1064
|
-
|
|
1064
|
+
yn,
|
|
1065
1065
|
q
|
|
1066
1066
|
] }],
|
|
1067
1067
|
"font-family": [{ font: [
|
|
1068
|
-
|
|
1069
|
-
|
|
1068
|
+
Pn,
|
|
1069
|
+
An,
|
|
1070
1070
|
t
|
|
1071
1071
|
] }],
|
|
1072
1072
|
"font-features": [{ "font-features": [q] }],
|
|
@@ -1085,7 +1085,7 @@ var At = (e, t) => {
|
|
|
1085
1085
|
W,
|
|
1086
1086
|
"none",
|
|
1087
1087
|
Y,
|
|
1088
|
-
|
|
1088
|
+
On
|
|
1089
1089
|
] }],
|
|
1090
1090
|
leading: [{ leading: [a, ...S()] }],
|
|
1091
1091
|
"list-image": [{ "list-image": [
|
|
@@ -1244,8 +1244,8 @@ var At = (e, t) => {
|
|
|
1244
1244
|
q
|
|
1245
1245
|
]
|
|
1246
1246
|
},
|
|
1247
|
-
|
|
1248
|
-
|
|
1247
|
+
Ln,
|
|
1248
|
+
Mn
|
|
1249
1249
|
] }],
|
|
1250
1250
|
"bg-color": [{ bg: j() }],
|
|
1251
1251
|
"gradient-from-pos": [{ from: ce() }],
|
|
@@ -1328,14 +1328,14 @@ var At = (e, t) => {
|
|
|
1328
1328
|
"none",
|
|
1329
1329
|
u,
|
|
1330
1330
|
Z,
|
|
1331
|
-
|
|
1331
|
+
Nn
|
|
1332
1332
|
] }],
|
|
1333
1333
|
"shadow-color": [{ shadow: j() }],
|
|
1334
1334
|
"inset-shadow": [{ "inset-shadow": [
|
|
1335
1335
|
"none",
|
|
1336
1336
|
d,
|
|
1337
1337
|
Z,
|
|
1338
|
-
|
|
1338
|
+
Nn
|
|
1339
1339
|
] }],
|
|
1340
1340
|
"inset-shadow-color": [{ "inset-shadow": j() }],
|
|
1341
1341
|
"ring-w": [{ ring: N() }],
|
|
@@ -1349,7 +1349,7 @@ var At = (e, t) => {
|
|
|
1349
1349
|
"none",
|
|
1350
1350
|
ee,
|
|
1351
1351
|
Z,
|
|
1352
|
-
|
|
1352
|
+
Nn
|
|
1353
1353
|
] }],
|
|
1354
1354
|
"text-shadow-color": [{ "text-shadow": j() }],
|
|
1355
1355
|
opacity: [{ opacity: [
|
|
@@ -1466,7 +1466,7 @@ var At = (e, t) => {
|
|
|
1466
1466
|
"none",
|
|
1467
1467
|
f,
|
|
1468
1468
|
Z,
|
|
1469
|
-
|
|
1469
|
+
Nn
|
|
1470
1470
|
] }],
|
|
1471
1471
|
"drop-shadow-color": [{ "drop-shadow": j() }],
|
|
1472
1472
|
grayscale: [{ grayscale: [
|
|
@@ -1771,7 +1771,7 @@ var At = (e, t) => {
|
|
|
1771
1771
|
W,
|
|
1772
1772
|
X,
|
|
1773
1773
|
J,
|
|
1774
|
-
|
|
1774
|
+
On
|
|
1775
1775
|
] }],
|
|
1776
1776
|
stroke: [{ stroke: ["none", ...j()] }],
|
|
1777
1777
|
"forced-color-adjust": [{ "forced-color-adjust": ["auto", "none"] }]
|
|
@@ -1962,8 +1962,8 @@ var At = (e, t) => {
|
|
|
1962
1962
|
});
|
|
1963
1963
|
//#endregion
|
|
1964
1964
|
//#region src/lib/utils.ts
|
|
1965
|
-
function
|
|
1966
|
-
return
|
|
1965
|
+
function Jn(...e) {
|
|
1966
|
+
return qn(h(e));
|
|
1967
1967
|
}
|
|
1968
1968
|
//#endregion
|
|
1969
|
-
export {
|
|
1969
|
+
export { De as $, f as $t, tt as A, se as At, Ue as B, C as Bt, ot as C, ue as Ct, ct as D, L as Dt, lt as E, I as Et, et as F, ce as Ft, Ye as G, y as Gt, Ge as H, re as Ht, He as I, j as It, Ie as J, p as Jt, Re as K, o as Kt, Be as L, ae as Lt, Xe as M, D as Mt, Ze as N, ie as Nt, dt as O, O as Ot, $e as P, oe as Pt, Ae as Q, d as Qt, Ve as R, k as Rt, it as S, P as St, st as T, de as Tt, We as U, x as Ut, Je as V, ne as Vt, Ke as W, S as Wt, Le as X, s as Xt, Pe as Y, c as Yt, Ne as Z, n as Zt, _t as _, _e as _t, Et as a, l as an, B as at, ft as b, R as bt, Dt as c, Se as ct, yt as d, ve as dt, t as en, je as et, vt as f, xe as ft, gt as g, me as gt, ht as h, ge as ht, wt as i, a as in, Ee as it, Qe as j, A as jt, nt as k, E as kt, Ct as l, be as lt, xt as m, le as mt, kt as n, i as nn, Oe as nt, Tt as o, ye as ot, bt as p, he as pt, ze as q, ee as qt, jt as r, u as rn, Te as rt, Ot as s, Ce as st, Jn as t, r as tn, ke as tt, St as u, we as ut, mt as v, fe as vt, at as w, pe as wt, ut as x, F as xt, pt as y, z as yt, qe as z, M as zt };
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -2,27 +2,50 @@ import type { JSX } from "solid-js";
|
|
|
2
2
|
|
|
3
3
|
const EDGE = 16;
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
interface Box {
|
|
6
|
+
left: number;
|
|
7
|
+
top: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Where a panel of this size sits over its anchor: centred on it, shifted only as far as the
|
|
13
|
+
* screen needs, as wide as the anchor at least. Before the panel is measured (`height`
|
|
14
|
+
* undefined) its top sits on the anchor's top. */
|
|
15
|
+
function anchoredBox(
|
|
16
|
+
anchor: Box,
|
|
17
|
+
viewport: { width: number; height: number },
|
|
18
|
+
width: number,
|
|
19
|
+
height?: number,
|
|
20
|
+
): Box {
|
|
21
|
+
const clamp = (v: number, lo: number, hi: number) => Math.max(lo, Math.min(v, hi));
|
|
22
|
+
const w = Math.min(Math.max(width, anchor.width), viewport.width - 2 * EDGE);
|
|
23
|
+
const x = clamp(anchor.left + (anchor.width - w) / 2, EDGE, viewport.width - EDGE - w);
|
|
24
|
+
const h = Math.min(Math.max(height ?? 0, anchor.height), viewport.height - 2 * EDGE);
|
|
25
|
+
const y =
|
|
26
|
+
height === undefined
|
|
27
|
+
? clamp(anchor.top, EDGE, viewport.height - EDGE - h)
|
|
28
|
+
: clamp(anchor.top + (anchor.height - h) / 2, EDGE, viewport.height - EDGE - h);
|
|
29
|
+
return { left: x, top: y, width: w, height: h };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** A panel that grows out of the element that opened it. The --morph-* values start the panel
|
|
33
|
+
* clipped to the element's box (MORPH_MOTION's keyframes), so it unrolls out of it. */
|
|
34
|
+
export function overAnchor(anchor: HTMLElement, width: number, height?: number): JSX.CSSProperties {
|
|
9
35
|
const box = anchor.getBoundingClientRect();
|
|
10
|
-
const vw = window.innerWidth;
|
|
11
36
|
const vh = window.innerHeight;
|
|
12
|
-
const
|
|
13
|
-
const x = Math.max(EDGE, Math.min(box.left, vw - EDGE - w));
|
|
14
|
-
const y = Math.max(EDGE, Math.min(box.top, vh - EDGE - Math.max(box.height, 240)));
|
|
37
|
+
const placed = anchoredBox(box, { width: window.innerWidth, height: vh }, width, height);
|
|
15
38
|
const radius = getComputedStyle(anchor).borderTopLeftRadius || "0px";
|
|
16
39
|
return {
|
|
17
|
-
left: `${
|
|
18
|
-
top: `${
|
|
40
|
+
left: `${placed.left}px`,
|
|
41
|
+
top: `${placed.top}px`,
|
|
19
42
|
translate: "none",
|
|
20
|
-
width: `${
|
|
43
|
+
width: `${placed.width}px`,
|
|
21
44
|
"max-width": "none",
|
|
22
|
-
"min-height": `${Math.min(box.height, vh -
|
|
23
|
-
"max-height": `${vh -
|
|
24
|
-
"--morph-x": `${box.left -
|
|
25
|
-
"--morph-y": `${box.top -
|
|
45
|
+
"min-height": `${Math.min(box.height, vh - 2 * EDGE)}px`,
|
|
46
|
+
"max-height": `${vh - 2 * EDGE}px`,
|
|
47
|
+
"--morph-x": `${box.left - placed.left}px`,
|
|
48
|
+
"--morph-y": `${box.top - placed.top}px`,
|
|
26
49
|
"--morph-w": `${box.width}px`,
|
|
27
50
|
"--morph-h": `${box.height}px`,
|
|
28
51
|
"--morph-radius": radius,
|
package/src/lib/hold.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** A press held this long, without moving, is a hold. Matches Android's long-press timeout, so the
|
|
2
|
+
* browser's own long press never wins the race. */
|
|
3
|
+
export const HOLD_MS = 350;
|
|
4
|
+
|
|
5
|
+
/** A tap ends inside this window, so it never shows the hold fill. The fill then grows on
|
|
6
|
+
* --duration-hold, which is HOLD_MS - HOLD_GRACE_MS. */
|
|
7
|
+
export const HOLD_GRACE_MS = 100;
|
|
@@ -47,7 +47,7 @@ export const PRESS_DIP = "active:scale-[0.97]";
|
|
|
47
47
|
/* Hold progress: a fill grows out of the touch while held, dissolves once the
|
|
48
48
|
* hold fires, and drains back faster if let go early. The host sets data-hold / data-fired. */
|
|
49
49
|
export const HOLD_MOTION =
|
|
50
|
-
"scale-0 opacity-0 transition-[scale,opacity] duration-(--duration-state) ease-(--ease-contract) data-[hold]:scale-100 data-[hold]:opacity-100 data-[hold]:duration-(--duration-
|
|
50
|
+
"scale-0 opacity-0 transition-[scale,opacity] duration-(--duration-state) ease-(--ease-contract) data-[hold]:scale-100 data-[hold]:opacity-100 data-[hold]:duration-(--duration-hold) data-[hold]:ease-linear data-[fired]:scale-100 data-[fired]:opacity-0";
|
|
51
51
|
|
|
52
52
|
/* MODAL_MOTION's twin for a surface that stays mounted: it rises out of what
|
|
53
53
|
* opened it, and its closed state is a resting style, since a mount door's exit
|
package/src/solid/dialog.tsx
CHANGED
|
@@ -87,25 +87,40 @@ const DialogContent: ParentComponent<DialogContentProps> = (props) => {
|
|
|
87
87
|
"ariaLabel",
|
|
88
88
|
"anchor",
|
|
89
89
|
"style",
|
|
90
|
+
"ref",
|
|
90
91
|
]);
|
|
91
92
|
const context = useDialogContext();
|
|
92
93
|
const [viewport, setViewport] = createSignal(0);
|
|
94
|
+
const [panel, setPanel] = createSignal<HTMLElement>();
|
|
95
|
+
const [height, setHeight] = createSignal<number>();
|
|
93
96
|
createEffect(() => {
|
|
94
97
|
if (!local.anchor || !context.isOpen()) return;
|
|
95
98
|
const measure = () => setViewport((n) => n + 1);
|
|
96
99
|
window.addEventListener("resize", measure);
|
|
97
100
|
onCleanup(() => window.removeEventListener("resize", measure));
|
|
98
101
|
});
|
|
102
|
+
createEffect(() => {
|
|
103
|
+
const el = panel();
|
|
104
|
+
if (!local.anchor || !el) return;
|
|
105
|
+
setHeight(el.offsetHeight);
|
|
106
|
+
const observer = new ResizeObserver(() => setHeight(el.offsetHeight));
|
|
107
|
+
observer.observe(el);
|
|
108
|
+
onCleanup(() => observer.disconnect());
|
|
109
|
+
});
|
|
99
110
|
const placement = () => {
|
|
100
111
|
viewport();
|
|
101
112
|
const a = local.anchor;
|
|
102
|
-
return a ? overAnchor(a, ANCHORED_WIDTH[local.size ?? "lg"]) : undefined;
|
|
113
|
+
return a ? overAnchor(a, ANCHORED_WIDTH[local.size ?? "lg"], height()) : undefined;
|
|
103
114
|
};
|
|
104
115
|
return (
|
|
105
116
|
<DialogPrimitive.Portal>
|
|
106
117
|
<ModalScrollLock />
|
|
107
118
|
<DialogPrimitive.Overlay data-slot="dialog-overlay" class={MODAL_SCRIM} />
|
|
108
119
|
<DialogPrimitive.Content
|
|
120
|
+
ref={(el: HTMLElement) => {
|
|
121
|
+
setPanel(el);
|
|
122
|
+
if (typeof local.ref === "function") local.ref(el);
|
|
123
|
+
}}
|
|
109
124
|
data-slot="dialog-content"
|
|
110
125
|
role="dialog"
|
|
111
126
|
aria-label={context.titleId() ? undefined : local.ariaLabel}
|