@glasshome/ui 1.16.0 → 1.17.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 +6 -2
- package/dist/backgrounds/geometric-houses.d.ts +1 -0
- package/dist/backgrounds/index.d.ts +1 -0
- package/dist/backgrounds/index.js +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +20 -2
- package/dist/lib/motion-window.d.ts +5 -0
- package/dist/solid/dock-paging.d.ts +3 -1
- package/dist/solid/index.js +21 -30
- package/package.json +8 -2
- package/src/backgrounds/geometric-houses.ts +103 -0
- package/src/backgrounds/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/lib/motion-window.ts +34 -0
- package/src/solid/data-table.tsx +1 -1
- package/src/solid/dock-paging.ts +4 -2
- package/src/solid/dock.tsx +29 -45
- package/src/solid/empty.tsx +1 -1
package/SPEC.md
CHANGED
|
@@ -119,6 +119,8 @@ role clears 4.5:1 against `--background`/`--card`/`--popover`/`--muted` (3:1 for
|
|
|
119
119
|
| position inside a multi-step flow | `<StepIndicator count index>` | a hand-rolled row of dots |
|
|
120
120
|
| tinted text alone | `glassToneText(tone)` | ad-hoc color-mix |
|
|
121
121
|
| a metallic tier chip | `<TierBadge>` | gradients by hand |
|
|
122
|
+
| the ambient motion window | `startMotionWindow()` | an app-local timer writing `data-motion` |
|
|
123
|
+
| a built-in wallpaper | `GEOMETRIC_HOUSES_SVG` from `@glasshome/ui/backgrounds` | an app's own copy of the SVG |
|
|
122
124
|
|
|
123
125
|
Server-run `.astro` markup imports `@glasshome/ui/solid` too: the `solid`
|
|
124
126
|
export condition hands Astro the source, and a component with no `client:`
|
|
@@ -148,8 +150,10 @@ Motion is one system, not per-component flair. Four rules, all held by
|
|
|
148
150
|
the arrival time. Pressables dip (`PRESS_DIP`).
|
|
149
151
|
5. **Ambient motion is an event.** A wallpaper or decorative loop runs for a
|
|
150
152
|
window after mount or a touch, then freezes mid-phase; an idle screen
|
|
151
|
-
animates nothing.
|
|
152
|
-
|
|
153
|
+
animates nothing. `startMotionWindow()` (package root) holds
|
|
154
|
+
`html[data-motion="live"]` for the window: 30 s, woken by `pointerdown`,
|
|
155
|
+
frozen on tab hide. Dash wraps it as `createMotionWindow` for Solid's
|
|
156
|
+
lifecycle; hub calls it directly. Light-DOM loops gate on that attribute,
|
|
153
157
|
widget shadow roots on the inherited `--motion-ambient` (1 live, else 0)
|
|
154
158
|
or, for a loop that can only pause, `--motion-play` (`running` live, else
|
|
155
159
|
`paused`). A wrapper with `data-motion="still"` opts out: thumbnails are
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const GEOMETRIC_HOUSES_SVG = "<svg width=\"100%\" height=\"100%\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 100 100\" preserveAspectRatio=\"xMidYMid slice\">\n <style>\n .house-shape { opacity: 0.9; filter: blur(0.2px); transform: translate(var(--tx), var(--ty)) rotate(var(--rot)); }\n\n @keyframes pop {\n 0% { transform: scale(0.88); opacity: 0; }\n 100% { transform: scale(1); opacity: 1; }\n }\n\n .h1 { --tx: 12px; --ty: 20px; --rot: 12deg; }\n .h1 .house-pop { animation: pop 2.2s cubic-bezier(0.16, 1, 0.3, 1) 0.10s; }\n .h2 { --tx: 85px; --ty: 25px; --rot: -15deg; }\n .h2 .house-pop { animation: pop 2.2s cubic-bezier(0.16, 1, 0.3, 1) 0.40s; }\n .h3 { --tx: 15px; --ty: 75px; --rot: -8deg; }\n .h3 .house-pop { animation: pop 2.2s cubic-bezier(0.16, 1, 0.3, 1) 0.70s; }\n .h4 { --tx: 70px; --ty: 10px; --rot: 20deg; }\n .h4 .house-pop { animation: pop 2.2s cubic-bezier(0.16, 1, 0.3, 1) 1.00s; }\n .h5 { --tx: 35px; --ty: 8px; --rot: -25deg; }\n .h5 .house-pop { animation: pop 2.2s cubic-bezier(0.16, 1, 0.3, 1) 1.30s; }\n .h6 { --tx: 55px; --ty: 55px; --rot: 18deg; }\n .h6 .house-pop { animation: pop 2.2s cubic-bezier(0.16, 1, 0.3, 1) 1.60s; }\n\n .house-shape .house-pop { animation-play-state: paused; }\n [data-motion=\"live\"] .house-shape .house-pop { animation-play-state: running; }\n [data-motion=\"still\"] .house-shape .house-pop { animation-play-state: paused; }\n\n @media (prefers-reduced-motion: reduce) {\n .house-pop { animation: none; }\n }\n </style>\n\n <defs>\n <linearGradient id=\"grad1\" x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"100%\">\n <stop offset=\"0%\" style=\"stop-color:var(--primary, oklch(0.48 0.2 215.221));stop-opacity:0.28\" />\n <stop offset=\"100%\" style=\"stop-color:var(--accent, oklch(0.6 0.2 195));stop-opacity:0.06\" />\n </linearGradient>\n <linearGradient id=\"grad2\" x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"100%\">\n <stop offset=\"0%\" style=\"stop-color:var(--accent, oklch(0.6 0.2 195));stop-opacity:0.30\" />\n <stop offset=\"100%\" style=\"stop-color:var(--secondary, oklch(0.11 0.003 0));stop-opacity:0.08\" />\n </linearGradient>\n <linearGradient id=\"grad3\" x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"100%\">\n <stop offset=\"0%\" style=\"stop-color:var(--primary, oklch(0.48 0.2 215.221));stop-opacity:0.35\" />\n <stop offset=\"100%\" style=\"stop-color:var(--accent, oklch(0.6 0.2 195));stop-opacity:0.10\" />\n </linearGradient>\n <linearGradient id=\"grad4\" x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"100%\">\n <stop offset=\"0%\" style=\"stop-color:var(--secondary, oklch(0.11 0.003 0));stop-opacity:0.22\" />\n <stop offset=\"100%\" style=\"stop-color:var(--primary, oklch(0.48 0.2 215.221));stop-opacity:0.04\" />\n </linearGradient>\n <linearGradient id=\"grad5\" x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"100%\">\n <stop offset=\"0%\" style=\"stop-color:var(--accent, oklch(0.6 0.2 195));stop-opacity:0.25\" />\n <stop offset=\"100%\" style=\"stop-color:var(--primary, oklch(0.48 0.2 215.221));stop-opacity:0.05\" />\n </linearGradient>\n <linearGradient id=\"grad6\" x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"100%\">\n <stop offset=\"0%\" style=\"stop-color:var(--primary, oklch(0.48 0.2 215.221));stop-opacity:0.32\" />\n <stop offset=\"100%\" style=\"stop-color:var(--secondary, oklch(0.11 0.003 0));stop-opacity:0.07\" />\n </linearGradient>\n <linearGradient id=\"overlay\" x1=\"0%\" y1=\"100%\" x2=\"100%\" y2=\"0%\">\n <stop offset=\"0%\" style=\"stop-color:var(--primary, oklch(0.48 0.2 215.221));stop-opacity:0.20\" />\n <stop offset=\"50%\" style=\"stop-color:transparent;stop-opacity:0\" />\n <stop offset=\"100%\" style=\"stop-color:var(--accent, oklch(0.6 0.2 195));stop-opacity:0.40\" />\n </linearGradient>\n\n <path id=\"house\" d=\"M 50,4 C 52,4 53.5,4.7 54.5,6 L 86,38 C 88.8,40.2 90,43 90,46 L 90,90 C 90,93.8 87.8,96 84,96 L 16,96 C 12.2,96 10,93.8 10,90 L 10,46 C 10,43 11.2,40.2 14,38 L 45.5,6 C 46.5,4.7 48,4 50,4 Z\"/>\n </defs>\n\n <rect width=\"100%\" height=\"100%\" fill=\"var(--background, oklch(0.12 0.005 0))\"/>\n\n <g class=\"house-shape h1\">\n <g class=\"house-pop\">\n <use href=\"#house\" transform=\"translate(-15, -15) scale(0.31)\" fill=\"url(#grad1)\" stroke=\"var(--primary, oklch(0.48 0.2 215.221))\" stroke-opacity=\"0.35\" stroke-width=\"0.5\"/>\n </g>\n </g>\n <g class=\"house-shape h2\">\n <g class=\"house-pop\">\n <use href=\"#house\" transform=\"translate(-13, -12) scale(0.26)\" fill=\"url(#grad2)\" stroke=\"var(--accent, oklch(0.6 0.2 195))\" stroke-opacity=\"0.40\" stroke-width=\"0.5\"/>\n </g>\n </g>\n <g class=\"house-shape h3\">\n <g class=\"house-pop\">\n <use href=\"#house\" transform=\"translate(-8, -8) scale(0.16)\" fill=\"url(#grad3)\" stroke=\"var(--primary, oklch(0.48 0.2 215.221))\" stroke-opacity=\"0.45\" stroke-width=\"0.5\"/>\n </g>\n </g>\n <g class=\"house-shape h4\">\n <g class=\"house-pop\">\n <use href=\"#house\" transform=\"translate(-5, -5) scale(0.10)\" fill=\"url(#grad4)\" stroke=\"var(--secondary, oklch(0.11 0.003 0))\" stroke-opacity=\"0.28\" stroke-width=\"0.5\"/>\n </g>\n </g>\n <g class=\"house-shape h5\">\n <g class=\"house-pop\">\n <use href=\"#house\" transform=\"translate(-4, -4) scale(0.08)\" fill=\"url(#grad5)\" stroke=\"var(--accent, oklch(0.6 0.2 195))\" stroke-opacity=\"0.32\" stroke-width=\"0.5\"/>\n </g>\n </g>\n <g class=\"house-shape h6\">\n <g class=\"house-pop\">\n <use href=\"#house\" transform=\"translate(-9.5, -9.5) scale(0.19)\" fill=\"url(#grad6)\" stroke=\"var(--primary, oklch(0.48 0.2 215.221))\" stroke-opacity=\"0.38\" stroke-width=\"0.5\"/>\n </g>\n </g>\n\n <rect width=\"100%\" height=\"100%\" fill=\"url(#overlay)\" pointer-events=\"none\"/>\n</svg>";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GEOMETRIC_HOUSES_SVG } from "./geometric-houses.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/backgrounds/geometric-houses.ts
|
|
2
|
+
var e = "<svg width=\"100%\" height=\"100%\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 100 100\" preserveAspectRatio=\"xMidYMid slice\">\n <style>\n .house-shape { opacity: 0.9; filter: blur(0.2px); transform: translate(var(--tx), var(--ty)) rotate(var(--rot)); }\n\n @keyframes pop {\n 0% { transform: scale(0.88); opacity: 0; }\n 100% { transform: scale(1); opacity: 1; }\n }\n\n .h1 { --tx: 12px; --ty: 20px; --rot: 12deg; }\n .h1 .house-pop { animation: pop 2.2s cubic-bezier(0.16, 1, 0.3, 1) 0.10s; }\n .h2 { --tx: 85px; --ty: 25px; --rot: -15deg; }\n .h2 .house-pop { animation: pop 2.2s cubic-bezier(0.16, 1, 0.3, 1) 0.40s; }\n .h3 { --tx: 15px; --ty: 75px; --rot: -8deg; }\n .h3 .house-pop { animation: pop 2.2s cubic-bezier(0.16, 1, 0.3, 1) 0.70s; }\n .h4 { --tx: 70px; --ty: 10px; --rot: 20deg; }\n .h4 .house-pop { animation: pop 2.2s cubic-bezier(0.16, 1, 0.3, 1) 1.00s; }\n .h5 { --tx: 35px; --ty: 8px; --rot: -25deg; }\n .h5 .house-pop { animation: pop 2.2s cubic-bezier(0.16, 1, 0.3, 1) 1.30s; }\n .h6 { --tx: 55px; --ty: 55px; --rot: 18deg; }\n .h6 .house-pop { animation: pop 2.2s cubic-bezier(0.16, 1, 0.3, 1) 1.60s; }\n\n .house-shape .house-pop { animation-play-state: paused; }\n [data-motion=\"live\"] .house-shape .house-pop { animation-play-state: running; }\n [data-motion=\"still\"] .house-shape .house-pop { animation-play-state: paused; }\n\n @media (prefers-reduced-motion: reduce) {\n .house-pop { animation: none; }\n }\n </style>\n\n <defs>\n <linearGradient id=\"grad1\" x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"100%\">\n <stop offset=\"0%\" style=\"stop-color:var(--primary, oklch(0.48 0.2 215.221));stop-opacity:0.28\" />\n <stop offset=\"100%\" style=\"stop-color:var(--accent, oklch(0.6 0.2 195));stop-opacity:0.06\" />\n </linearGradient>\n <linearGradient id=\"grad2\" x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"100%\">\n <stop offset=\"0%\" style=\"stop-color:var(--accent, oklch(0.6 0.2 195));stop-opacity:0.30\" />\n <stop offset=\"100%\" style=\"stop-color:var(--secondary, oklch(0.11 0.003 0));stop-opacity:0.08\" />\n </linearGradient>\n <linearGradient id=\"grad3\" x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"100%\">\n <stop offset=\"0%\" style=\"stop-color:var(--primary, oklch(0.48 0.2 215.221));stop-opacity:0.35\" />\n <stop offset=\"100%\" style=\"stop-color:var(--accent, oklch(0.6 0.2 195));stop-opacity:0.10\" />\n </linearGradient>\n <linearGradient id=\"grad4\" x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"100%\">\n <stop offset=\"0%\" style=\"stop-color:var(--secondary, oklch(0.11 0.003 0));stop-opacity:0.22\" />\n <stop offset=\"100%\" style=\"stop-color:var(--primary, oklch(0.48 0.2 215.221));stop-opacity:0.04\" />\n </linearGradient>\n <linearGradient id=\"grad5\" x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"100%\">\n <stop offset=\"0%\" style=\"stop-color:var(--accent, oklch(0.6 0.2 195));stop-opacity:0.25\" />\n <stop offset=\"100%\" style=\"stop-color:var(--primary, oklch(0.48 0.2 215.221));stop-opacity:0.05\" />\n </linearGradient>\n <linearGradient id=\"grad6\" x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"100%\">\n <stop offset=\"0%\" style=\"stop-color:var(--primary, oklch(0.48 0.2 215.221));stop-opacity:0.32\" />\n <stop offset=\"100%\" style=\"stop-color:var(--secondary, oklch(0.11 0.003 0));stop-opacity:0.07\" />\n </linearGradient>\n <linearGradient id=\"overlay\" x1=\"0%\" y1=\"100%\" x2=\"100%\" y2=\"0%\">\n <stop offset=\"0%\" style=\"stop-color:var(--primary, oklch(0.48 0.2 215.221));stop-opacity:0.20\" />\n <stop offset=\"50%\" style=\"stop-color:transparent;stop-opacity:0\" />\n <stop offset=\"100%\" style=\"stop-color:var(--accent, oklch(0.6 0.2 195));stop-opacity:0.40\" />\n </linearGradient>\n\n <path id=\"house\" d=\"M 50,4 C 52,4 53.5,4.7 54.5,6 L 86,38 C 88.8,40.2 90,43 90,46 L 90,90 C 90,93.8 87.8,96 84,96 L 16,96 C 12.2,96 10,93.8 10,90 L 10,46 C 10,43 11.2,40.2 14,38 L 45.5,6 C 46.5,4.7 48,4 50,4 Z\"/>\n </defs>\n\n <rect width=\"100%\" height=\"100%\" fill=\"var(--background, oklch(0.12 0.005 0))\"/>\n\n <g class=\"house-shape h1\">\n <g class=\"house-pop\">\n <use href=\"#house\" transform=\"translate(-15, -15) scale(0.31)\" fill=\"url(#grad1)\" stroke=\"var(--primary, oklch(0.48 0.2 215.221))\" stroke-opacity=\"0.35\" stroke-width=\"0.5\"/>\n </g>\n </g>\n <g class=\"house-shape h2\">\n <g class=\"house-pop\">\n <use href=\"#house\" transform=\"translate(-13, -12) scale(0.26)\" fill=\"url(#grad2)\" stroke=\"var(--accent, oklch(0.6 0.2 195))\" stroke-opacity=\"0.40\" stroke-width=\"0.5\"/>\n </g>\n </g>\n <g class=\"house-shape h3\">\n <g class=\"house-pop\">\n <use href=\"#house\" transform=\"translate(-8, -8) scale(0.16)\" fill=\"url(#grad3)\" stroke=\"var(--primary, oklch(0.48 0.2 215.221))\" stroke-opacity=\"0.45\" stroke-width=\"0.5\"/>\n </g>\n </g>\n <g class=\"house-shape h4\">\n <g class=\"house-pop\">\n <use href=\"#house\" transform=\"translate(-5, -5) scale(0.10)\" fill=\"url(#grad4)\" stroke=\"var(--secondary, oklch(0.11 0.003 0))\" stroke-opacity=\"0.28\" stroke-width=\"0.5\"/>\n </g>\n </g>\n <g class=\"house-shape h5\">\n <g class=\"house-pop\">\n <use href=\"#house\" transform=\"translate(-4, -4) scale(0.08)\" fill=\"url(#grad5)\" stroke=\"var(--accent, oklch(0.6 0.2 195))\" stroke-opacity=\"0.32\" stroke-width=\"0.5\"/>\n </g>\n </g>\n <g class=\"house-shape h6\">\n <g class=\"house-pop\">\n <use href=\"#house\" transform=\"translate(-9.5, -9.5) scale(0.19)\" fill=\"url(#grad6)\" stroke=\"var(--primary, oklch(0.48 0.2 215.221))\" stroke-opacity=\"0.38\" stroke-width=\"0.5\"/>\n </g>\n </g>\n\n <rect width=\"100%\" height=\"100%\" fill=\"url(#overlay)\" pointer-events=\"none\"/>\n</svg>";
|
|
3
|
+
//#endregion
|
|
4
|
+
export { e as GEOMETRIC_HOUSES_SVG };
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { Z, Z_CLASS } from "./lib/layers.js";
|
|
|
8
8
|
export { LOGO_DEFAULT_SIZE, LOGO_DEFAULT_SRC, LOGO_DEFAULT_SUB, LOGO_MARK_CLASS, LOGO_MARK_PX, LOGO_NAME_CLASS, LOGO_ROOT_CLASS, LOGO_SIZES, LOGO_STACK_CLASS, LOGO_SUB_CLASS, type LogoSize, } from "./lib/logo-lockup.js";
|
|
9
9
|
export { MENU_ITEM, MENU_ITEM_BASE, MENU_ITEM_X, MENU_LABEL, MENU_SEPARATOR, } from "./lib/menu-classes.js";
|
|
10
10
|
export { FIELD_MOTION, MODAL_MOTION, MORPH_MOTION, OVERLAY_MOTION, PRESS_DIP, SCRIM_MOTION, SETTLE_MOTION, STAGGER, } from "./lib/motion-classes.js";
|
|
11
|
+
export { MOTION_WINDOW_MS, startMotionWindow } from "./lib/motion-window.js";
|
|
11
12
|
export { anchorToTriggerTop, FLOATING_PANEL, OVERLAY_BLUR, OVERLAY_SURFACE, OVERLAY_SURFACE_BASE, OVERLAY_SURFACE_OPAQUE, SCRIM_CLASS, } from "./lib/overlay-classes.js";
|
|
12
13
|
export { CONTROL_H_TOUCH, PICKER_LIST, PICKER_TRIGGER } from "./lib/picker-classes.js";
|
|
13
14
|
export { CHIP, ICON_PILL, ICON_PILL_TINT } from "./lib/pill-classes.js";
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,20 @@
|
|
|
1
|
-
import { $ as e, A as t, B as n, Bt as r, C as i, Ct as a, D as
|
|
2
|
-
|
|
1
|
+
import { $ as e, A as t, B as n, Bt as r, C as i, Ct as a, D as ee, Dt as te, E as o, Et as s, F as c, Ft as l, G as u, Gt as d, H as f, Ht as p, I as m, It as h, J as g, Jt as _, Kt as v, L as y, Lt as b, M as x, Mt as S, N as C, Nt as w, O as T, Ot as E, P as D, Pt as O, Q as k, R as A, Rt as j, S as M, St as N, T as P, U as F, Ut as I, V as L, Vt as R, Wt as z, X as B, Xt as V, Y as H, Yt as U, Z as W, Zt as G, _ as K, _t as q, at as J, b as Y, c as ne, ct as X, d as Z, et as re, f as ie, g as ae, h as oe, i as se, it as ce, j as le, jt as ue, k as de, kt as fe, l as pe, m as me, n as he, nt as ge, o as _e, ot as ve, p as ye, q as be, qt as xe, r as Se, rt as Ce, s as we, st as Te, t as Ee, tt as De, u as Oe, ut as Q, v as ke, vt as Ae, w as je, wt as Me, x as Ne, y as Pe, yt as Fe, z as Ie } from "./utils-DMaksjvy.js";
|
|
2
|
+
//#region src/lib/motion-window.ts
|
|
3
|
+
var $ = 3e4;
|
|
4
|
+
function Le(e = $) {
|
|
5
|
+
let t, n = document.documentElement, r = () => {
|
|
6
|
+
clearTimeout(t), t = void 0, delete n.dataset.motion;
|
|
7
|
+
}, i = () => {
|
|
8
|
+
clearTimeout(t), t = setTimeout(r, e), n.dataset.motion !== "live" && (n.dataset.motion = "live");
|
|
9
|
+
}, a = () => {
|
|
10
|
+
document.visibilityState === "hidden" ? r() : i();
|
|
11
|
+
};
|
|
12
|
+
return i(), document.addEventListener("pointerdown", i, {
|
|
13
|
+
passive: !0,
|
|
14
|
+
capture: !0
|
|
15
|
+
}), document.addEventListener("visibilitychange", a), () => {
|
|
16
|
+
r(), document.removeEventListener("pointerdown", i, { capture: !0 }), document.removeEventListener("visibilitychange", a);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { r as ALERT_CLASS, R as ALERT_CONTENT_CLASS, p as ALERT_DESCRIPTION_CLASS, I as ALERT_ICON_BG_CLASS, z as ALERT_ICON_CLASS, d as ALERT_ICON_PATHS, v as ALERT_TITLE_CLASS, xe as ALERT_TONES, O as BUTTON_DEFAULT_CLASS, l as BUTTON_OUTLINE_CLASS, Q as CARD_BLUR, q as CARD_SURFACE, Ae as CARD_SURFACE_BASE, Fe as CARD_SURFACE_OPAQUE, g as CAROUSEL_DOTS, H as CAROUSEL_VIEWPORT, me as CHIP, De as CONTROL_H, K as CONTROL_H_TOUCH, ge as FIELD_CHROME, Ce as FIELD_CONTROL, Me as FIELD_MOTION, ce as FIELD_TEXT, Y as FLOATING_PANEL, J as FOCUS_RING, h as ICON_BUTTON_CLASS, oe as ICON_PILL, ae as ICON_PILL_TINT, ve as INPUT_CLASS, Te as INPUT_SURFACE, X as INVALID_RING, x as LOGO_DEFAULT_SIZE, C as LOGO_DEFAULT_SRC, D as LOGO_DEFAULT_SUB, c as LOGO_MARK_CLASS, m as LOGO_MARK_PX, y as LOGO_NAME_CLASS, A as LOGO_ROOT_CLASS, Ie as LOGO_SIZES, n as LOGO_STACK_CLASS, L as LOGO_SUB_CLASS, ee as MENU_ITEM, T as MENU_ITEM_BASE, de as MENU_ITEM_X, t as MENU_LABEL, le as MENU_SEPARATOR, he as MOBILE_BREAKPOINT, s as MODAL_MOTION, te as MORPH_MOTION, $ as MOTION_WINDOW_MS, b as OUTLINE_SURFACE, Ne as OVERLAY_BLUR, E as OVERLAY_MOTION, M as OVERLAY_SURFACE, i as OVERLAY_SURFACE_BASE, je as OVERLAY_SURFACE_OPAQUE, ke as PICKER_LIST, Pe as PICKER_TRIGGER, e as POSITION_BAR, re as POSITION_BAR_LIT, fe as PRESS_DIP, P as SCRIM_CLASS, ue as SCRIM_MOTION, Oe as SECTION_INNER_RADIUS, Z as SECTION_OUTER_RADIUS, ie as SECTION_PADDING, ye as SECTION_ROW_CLASS, N as SECTION_ROW_SURFACE, pe as SEGMENT_ITEM, S as SETTLE_MOTION, w as STAGGER, se as THUMB_CLASS, _e as THUMB_RAIL_BLEED, we as THUMB_RAIL_PAD, ne as THUMB_SIZE, a as TRACK_SURFACE, f as Z, F as Z_CLASS, _ as alertBorder, U as alertFill, V as alertIconBgStyle, G as alertIconFill, o as anchorToTriggerTop, j as buttonVariants, B as carouselDot, W as carouselItem, k as carouselTrack, Ee as cn, Se as createIsMobile, u as glassToneText, Le as startMotionWindow, be as toneTextMix };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const MOTION_WINDOW_MS = 30000;
|
|
2
|
+
/** Ambient motion runs for a window after load or a touch, then freezes; `html[data-motion="live"]`
|
|
3
|
+
* is the one signal, which theme.css turns into `--motion-ambient` and the wallpapers gate on.
|
|
4
|
+
* Returns the stop function. */
|
|
5
|
+
export declare function startMotionWindow(windowMs?: number): () => void;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
/** A page is one strip-width of items. The last one is whatever is left.
|
|
1
|
+
/** A page is one strip-width of items. The last one is whatever is left.
|
|
2
|
+
* The tolerance keeps a strip a sub-pixel over its viewport on one page: both
|
|
3
|
+
* numbers are rounded reads of the same box. */
|
|
2
4
|
export declare function pageCount(scrollWidth: number, viewport: number): number;
|
|
3
5
|
/** The page a scroll position sits on, counting a half-page as turned. */
|
|
4
6
|
export declare function pageOf(scrollLeft: number, viewport: number): number;
|
package/dist/solid/index.js
CHANGED
|
@@ -12561,7 +12561,7 @@ var fy = /*#__PURE__*/ K("<div data-slot=empty>"), py = /*#__PURE__*/ K("<div da
|
|
|
12561
12561
|
return (() => {
|
|
12562
12562
|
var e = fy();
|
|
12563
12563
|
return G(e, U({ get class() {
|
|
12564
|
-
return O("flex min-w-0 flex-1 flex-col items-center justify-center gap-6 text-balance rounded-lg
|
|
12564
|
+
return O("flex min-w-0 flex-1 flex-col items-center justify-center gap-6 text-balance rounded-lg p-6 text-center md:p-12", t.class);
|
|
12565
12565
|
} }, n), !1, !1), e;
|
|
12566
12566
|
})();
|
|
12567
12567
|
}, yy = (e) => {
|
|
@@ -13836,7 +13836,7 @@ function tx(e) {
|
|
|
13836
13836
|
}
|
|
13837
13837
|
function nx(e) {
|
|
13838
13838
|
return z(vy, {
|
|
13839
|
-
class: "gap-3 rounded-none
|
|
13839
|
+
class: "gap-3 rounded-none py-12",
|
|
13840
13840
|
get children() {
|
|
13841
13841
|
return [z(yy, { get children() {
|
|
13842
13842
|
return [z(k, {
|
|
@@ -13994,7 +13994,7 @@ var cx = (e) => z(Go, U(e, { preventScroll: !1 })), lx = (e) => z(Go.Trigger, U(
|
|
|
13994
13994
|
//#endregion
|
|
13995
13995
|
//#region src/solid/dock-paging.ts
|
|
13996
13996
|
function vx(e, t) {
|
|
13997
|
-
return t <= 0 ? 1 : Math.max(1, Math.ceil(e / t));
|
|
13997
|
+
return t <= 0 ? 1 : Math.max(1, Math.ceil((e - 1) / t));
|
|
13998
13998
|
}
|
|
13999
13999
|
function yx(e, t) {
|
|
14000
14000
|
return t <= 0 ? 0 : Math.round(e / t);
|
|
@@ -14357,31 +14357,22 @@ var Fx = Object.assign(Nx, {
|
|
|
14357
14357
|
let o = () => t.dockMode ?? "floating", s, [c, l] = N(!1), [u, d] = N(1), [f, p] = N(0), [m, h] = N(0), g = () => {
|
|
14358
14358
|
let e = t.items.findIndex((e) => e.isActive);
|
|
14359
14359
|
return e < 0 ? null : e;
|
|
14360
|
-
}, _ = () => s && Number.parseFloat(getComputedStyle(s).columnGap) || 0, v = () => s?.querySelector("[data-slot=\"dock-item\"]")?.getBoundingClientRect().width ?? 0, y = () => {
|
|
14360
|
+
}, _ = () => s && Number.parseFloat(getComputedStyle(s).columnGap) || 0, v = () => s?.querySelector("[data-slot=\"dock-item\"]")?.getBoundingClientRect().width ?? 0, y = (e) => {
|
|
14361
|
+
let t = getComputedStyle(e);
|
|
14362
|
+
return (Number.parseFloat(t.paddingLeft) || 0) + (Number.parseFloat(t.paddingRight) || 0);
|
|
14363
|
+
}, b = () => {
|
|
14364
|
+
let e = s?.closest("[data-slot=\"dock\"]");
|
|
14365
|
+
return !e || !a ? 0 : e.clientWidth - y(e) - y(a);
|
|
14366
|
+
}, x = () => {
|
|
14361
14367
|
if (!s) return;
|
|
14362
|
-
let e = s.
|
|
14363
|
-
if (
|
|
14364
|
-
|
|
14365
|
-
|
|
14366
|
-
}
|
|
14367
|
-
|
|
14368
|
-
|
|
14369
|
-
|
|
14370
|
-
let e = getComputedStyle(t);
|
|
14371
|
-
e.position === "absolute" || e.position === "fixed" || (r += t.getBoundingClientRect().width + (Number.parseFloat(e.marginLeft) || 0) + (Number.parseFloat(e.marginRight) || 0));
|
|
14372
|
-
}
|
|
14373
|
-
let i = e.clientWidth - n - r, a = s.scrollWidth > i, o = a ? xx(i, v(), _()) : 0;
|
|
14374
|
-
o > 0 && (s.style.width = `${o}px`), l(a);
|
|
14375
|
-
let c = o > 0 ? o : s.clientWidth;
|
|
14376
|
-
h(c), d(vx(s.scrollWidth, c)), p(yx(s.scrollLeft, c));
|
|
14377
|
-
}, b, x = () => {
|
|
14378
|
-
if (s) {
|
|
14379
|
-
if (!s.style.width) {
|
|
14380
|
-
y();
|
|
14381
|
-
return;
|
|
14382
|
-
}
|
|
14383
|
-
s.style.width = "", clearTimeout(b), b = setTimeout(y, 250);
|
|
14384
|
-
}
|
|
14368
|
+
let e = b(), t = e > 0 && s.scrollWidth > e + 1;
|
|
14369
|
+
if (t) {
|
|
14370
|
+
let t = xx(e, v(), _());
|
|
14371
|
+
t > 0 && (s.style.width = `${t}px`);
|
|
14372
|
+
} else s.style.width && (s.style.width = "");
|
|
14373
|
+
l(t);
|
|
14374
|
+
let n = s.clientWidth;
|
|
14375
|
+
h(n), d(vx(s.scrollWidth, n)), p(yx(s.scrollLeft, n));
|
|
14385
14376
|
}, S = (e) => {
|
|
14386
14377
|
s && s.scrollTo({
|
|
14387
14378
|
left: bx(e, m(), s.scrollWidth),
|
|
@@ -14400,10 +14391,10 @@ var Fx = Object.assign(Nx, {
|
|
|
14400
14391
|
clearTimeout(t), t = setTimeout(x, 50);
|
|
14401
14392
|
};
|
|
14402
14393
|
window.addEventListener("resize", n), F(() => {
|
|
14403
|
-
clearTimeout(e), clearTimeout(t),
|
|
14394
|
+
clearTimeout(e), clearTimeout(t), window.removeEventListener("resize", n);
|
|
14404
14395
|
});
|
|
14405
14396
|
}), j(() => {
|
|
14406
|
-
t.items.length;
|
|
14397
|
+
t.items.length, o();
|
|
14407
14398
|
let e = setTimeout(x, 150);
|
|
14408
14399
|
F(() => clearTimeout(e));
|
|
14409
14400
|
}), (() => {
|
|
@@ -14478,7 +14469,7 @@ var Fx = Object.assign(Nx, {
|
|
|
14478
14469
|
})), e;
|
|
14479
14470
|
}
|
|
14480
14471
|
}), null), B((e) => {
|
|
14481
|
-
var n = O("relative isolate flex max-w-full items-center justify-center p-1.5 sm:p-2", u() > 1 && "pb-4 sm:pb-5", ge, "[--glass-lift:0.55]", o() === "floating" ? "rounded-xl" : "rounded-t-xl"), a = t.hold && !t.hold.fired ? "" : void 0, s = t.hold?.fired ? "" : void 0, l = O("absolute -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary/45", ae), f = `${r().x}px`, p = `${r().y}px`, m = `${r().r * 2}px`, g = `${r().r * 2}px`, _ = O("flex items-center gap-0.5 sm:gap-1", c() ? "scrollbar-hide snap-x snap-mandatory overflow-x-auto overscroll-x-contain scroll-smooth" : "overflow-visible", !c() && "justify-center"), v = c() ? "auto" : "fit-content";
|
|
14472
|
+
var n = O("pointer-events-auto relative isolate flex max-w-full items-center justify-center p-1.5 sm:p-2", u() > 1 && "pb-4 sm:pb-5", ge, "[--glass-lift:0.55]", o() === "floating" ? "rounded-xl" : "rounded-t-xl"), a = t.hold && !t.hold.fired ? "" : void 0, s = t.hold?.fired ? "" : void 0, l = O("absolute -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary/45", ae), f = `${r().x}px`, p = `${r().y}px`, m = `${r().r * 2}px`, g = `${r().r * 2}px`, _ = O("flex items-center gap-0.5 sm:gap-1", c() ? "scrollbar-hide snap-x snap-mandatory overflow-x-auto overscroll-x-contain scroll-smooth" : "overflow-visible", !c() && "justify-center"), v = c() ? "auto" : "fit-content";
|
|
14482
14473
|
return n !== e.e && R(i, e.e = n), a !== e.t && W(d, "data-hold", e.t = a), s !== e.a && W(d, "data-fired", e.a = s), l !== e.o && R(d, e.o = l), f !== e.i && Ot(d, "left", e.i = f), p !== e.n && Ot(d, "top", e.n = p), m !== e.s && Ot(d, "width", e.s = m), g !== e.h && Ot(d, "height", e.h = g), _ !== e.r && R(h, e.r = _), v !== e.d && Ot(h, "min-width", e.d = v), e;
|
|
14483
14474
|
}, {
|
|
14484
14475
|
e: void 0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glasshome/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"description": "SolidJS component library for GlassHome, built on Kobalte",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://github.com/glasshome/ui#readme",
|
|
@@ -47,11 +47,17 @@
|
|
|
47
47
|
"./styles": "./src/styles/globals.css",
|
|
48
48
|
"./package.json": "./package.json",
|
|
49
49
|
"./styles/theme": "./src/styles/theme.css",
|
|
50
|
-
"./scripts/*": "./scripts/*"
|
|
50
|
+
"./scripts/*": "./scripts/*",
|
|
51
|
+
"./backgrounds": {
|
|
52
|
+
"@glasshome/source": "./src/backgrounds/index.ts",
|
|
53
|
+
"types": "./dist/backgrounds/index.d.ts",
|
|
54
|
+
"import": "./dist/backgrounds/index.js"
|
|
55
|
+
}
|
|
51
56
|
},
|
|
52
57
|
"files": [
|
|
53
58
|
"dist",
|
|
54
59
|
"src/index.ts",
|
|
60
|
+
"src/backgrounds",
|
|
55
61
|
"src/lib",
|
|
56
62
|
"src/solid",
|
|
57
63
|
"src/styles",
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/* The wallpaper both apps render. Motion lives on an inner .house-pop group gated by
|
|
2
|
+
* html[data-motion], so the entrance plays inside the motion window and nothing animates after it.
|
|
3
|
+
* Written by hand once; keep the copy here and nowhere else. */
|
|
4
|
+
export const GEOMETRIC_HOUSES_SVG = `<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid slice">
|
|
5
|
+
<style>
|
|
6
|
+
.house-shape { opacity: 0.9; filter: blur(0.2px); transform: translate(var(--tx), var(--ty)) rotate(var(--rot)); }
|
|
7
|
+
|
|
8
|
+
@keyframes pop {
|
|
9
|
+
0% { transform: scale(0.88); opacity: 0; }
|
|
10
|
+
100% { transform: scale(1); opacity: 1; }
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.h1 { --tx: 12px; --ty: 20px; --rot: 12deg; }
|
|
14
|
+
.h1 .house-pop { animation: pop 2.2s cubic-bezier(0.16, 1, 0.3, 1) 0.10s; }
|
|
15
|
+
.h2 { --tx: 85px; --ty: 25px; --rot: -15deg; }
|
|
16
|
+
.h2 .house-pop { animation: pop 2.2s cubic-bezier(0.16, 1, 0.3, 1) 0.40s; }
|
|
17
|
+
.h3 { --tx: 15px; --ty: 75px; --rot: -8deg; }
|
|
18
|
+
.h3 .house-pop { animation: pop 2.2s cubic-bezier(0.16, 1, 0.3, 1) 0.70s; }
|
|
19
|
+
.h4 { --tx: 70px; --ty: 10px; --rot: 20deg; }
|
|
20
|
+
.h4 .house-pop { animation: pop 2.2s cubic-bezier(0.16, 1, 0.3, 1) 1.00s; }
|
|
21
|
+
.h5 { --tx: 35px; --ty: 8px; --rot: -25deg; }
|
|
22
|
+
.h5 .house-pop { animation: pop 2.2s cubic-bezier(0.16, 1, 0.3, 1) 1.30s; }
|
|
23
|
+
.h6 { --tx: 55px; --ty: 55px; --rot: 18deg; }
|
|
24
|
+
.h6 .house-pop { animation: pop 2.2s cubic-bezier(0.16, 1, 0.3, 1) 1.60s; }
|
|
25
|
+
|
|
26
|
+
.house-shape .house-pop { animation-play-state: paused; }
|
|
27
|
+
[data-motion="live"] .house-shape .house-pop { animation-play-state: running; }
|
|
28
|
+
[data-motion="still"] .house-shape .house-pop { animation-play-state: paused; }
|
|
29
|
+
|
|
30
|
+
@media (prefers-reduced-motion: reduce) {
|
|
31
|
+
.house-pop { animation: none; }
|
|
32
|
+
}
|
|
33
|
+
</style>
|
|
34
|
+
|
|
35
|
+
<defs>
|
|
36
|
+
<linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
37
|
+
<stop offset="0%" style="stop-color:var(--primary, oklch(0.48 0.2 215.221));stop-opacity:0.28" />
|
|
38
|
+
<stop offset="100%" style="stop-color:var(--accent, oklch(0.6 0.2 195));stop-opacity:0.06" />
|
|
39
|
+
</linearGradient>
|
|
40
|
+
<linearGradient id="grad2" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
41
|
+
<stop offset="0%" style="stop-color:var(--accent, oklch(0.6 0.2 195));stop-opacity:0.30" />
|
|
42
|
+
<stop offset="100%" style="stop-color:var(--secondary, oklch(0.11 0.003 0));stop-opacity:0.08" />
|
|
43
|
+
</linearGradient>
|
|
44
|
+
<linearGradient id="grad3" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
45
|
+
<stop offset="0%" style="stop-color:var(--primary, oklch(0.48 0.2 215.221));stop-opacity:0.35" />
|
|
46
|
+
<stop offset="100%" style="stop-color:var(--accent, oklch(0.6 0.2 195));stop-opacity:0.10" />
|
|
47
|
+
</linearGradient>
|
|
48
|
+
<linearGradient id="grad4" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
49
|
+
<stop offset="0%" style="stop-color:var(--secondary, oklch(0.11 0.003 0));stop-opacity:0.22" />
|
|
50
|
+
<stop offset="100%" style="stop-color:var(--primary, oklch(0.48 0.2 215.221));stop-opacity:0.04" />
|
|
51
|
+
</linearGradient>
|
|
52
|
+
<linearGradient id="grad5" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
53
|
+
<stop offset="0%" style="stop-color:var(--accent, oklch(0.6 0.2 195));stop-opacity:0.25" />
|
|
54
|
+
<stop offset="100%" style="stop-color:var(--primary, oklch(0.48 0.2 215.221));stop-opacity:0.05" />
|
|
55
|
+
</linearGradient>
|
|
56
|
+
<linearGradient id="grad6" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
57
|
+
<stop offset="0%" style="stop-color:var(--primary, oklch(0.48 0.2 215.221));stop-opacity:0.32" />
|
|
58
|
+
<stop offset="100%" style="stop-color:var(--secondary, oklch(0.11 0.003 0));stop-opacity:0.07" />
|
|
59
|
+
</linearGradient>
|
|
60
|
+
<linearGradient id="overlay" x1="0%" y1="100%" x2="100%" y2="0%">
|
|
61
|
+
<stop offset="0%" style="stop-color:var(--primary, oklch(0.48 0.2 215.221));stop-opacity:0.20" />
|
|
62
|
+
<stop offset="50%" style="stop-color:transparent;stop-opacity:0" />
|
|
63
|
+
<stop offset="100%" style="stop-color:var(--accent, oklch(0.6 0.2 195));stop-opacity:0.40" />
|
|
64
|
+
</linearGradient>
|
|
65
|
+
|
|
66
|
+
<path id="house" d="M 50,4 C 52,4 53.5,4.7 54.5,6 L 86,38 C 88.8,40.2 90,43 90,46 L 90,90 C 90,93.8 87.8,96 84,96 L 16,96 C 12.2,96 10,93.8 10,90 L 10,46 C 10,43 11.2,40.2 14,38 L 45.5,6 C 46.5,4.7 48,4 50,4 Z"/>
|
|
67
|
+
</defs>
|
|
68
|
+
|
|
69
|
+
<rect width="100%" height="100%" fill="var(--background, oklch(0.12 0.005 0))"/>
|
|
70
|
+
|
|
71
|
+
<g class="house-shape h1">
|
|
72
|
+
<g class="house-pop">
|
|
73
|
+
<use href="#house" transform="translate(-15, -15) scale(0.31)" fill="url(#grad1)" stroke="var(--primary, oklch(0.48 0.2 215.221))" stroke-opacity="0.35" stroke-width="0.5"/>
|
|
74
|
+
</g>
|
|
75
|
+
</g>
|
|
76
|
+
<g class="house-shape h2">
|
|
77
|
+
<g class="house-pop">
|
|
78
|
+
<use href="#house" transform="translate(-13, -12) scale(0.26)" fill="url(#grad2)" stroke="var(--accent, oklch(0.6 0.2 195))" stroke-opacity="0.40" stroke-width="0.5"/>
|
|
79
|
+
</g>
|
|
80
|
+
</g>
|
|
81
|
+
<g class="house-shape h3">
|
|
82
|
+
<g class="house-pop">
|
|
83
|
+
<use href="#house" transform="translate(-8, -8) scale(0.16)" fill="url(#grad3)" stroke="var(--primary, oklch(0.48 0.2 215.221))" stroke-opacity="0.45" stroke-width="0.5"/>
|
|
84
|
+
</g>
|
|
85
|
+
</g>
|
|
86
|
+
<g class="house-shape h4">
|
|
87
|
+
<g class="house-pop">
|
|
88
|
+
<use href="#house" transform="translate(-5, -5) scale(0.10)" fill="url(#grad4)" stroke="var(--secondary, oklch(0.11 0.003 0))" stroke-opacity="0.28" stroke-width="0.5"/>
|
|
89
|
+
</g>
|
|
90
|
+
</g>
|
|
91
|
+
<g class="house-shape h5">
|
|
92
|
+
<g class="house-pop">
|
|
93
|
+
<use href="#house" transform="translate(-4, -4) scale(0.08)" fill="url(#grad5)" stroke="var(--accent, oklch(0.6 0.2 195))" stroke-opacity="0.32" stroke-width="0.5"/>
|
|
94
|
+
</g>
|
|
95
|
+
</g>
|
|
96
|
+
<g class="house-shape h6">
|
|
97
|
+
<g class="house-pop">
|
|
98
|
+
<use href="#house" transform="translate(-9.5, -9.5) scale(0.19)" fill="url(#grad6)" stroke="var(--primary, oklch(0.48 0.2 215.221))" stroke-opacity="0.38" stroke-width="0.5"/>
|
|
99
|
+
</g>
|
|
100
|
+
</g>
|
|
101
|
+
|
|
102
|
+
<rect width="100%" height="100%" fill="url(#overlay)" pointer-events="none"/>
|
|
103
|
+
</svg>`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GEOMETRIC_HOUSES_SVG } from "./geometric-houses.js";
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const MOTION_WINDOW_MS = 30_000;
|
|
2
|
+
|
|
3
|
+
/** Ambient motion runs for a window after load or a touch, then freezes; `html[data-motion="live"]`
|
|
4
|
+
* is the one signal, which theme.css turns into `--motion-ambient` and the wallpapers gate on.
|
|
5
|
+
* Returns the stop function. */
|
|
6
|
+
export function startMotionWindow(windowMs = MOTION_WINDOW_MS): () => void {
|
|
7
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
8
|
+
const root = document.documentElement;
|
|
9
|
+
|
|
10
|
+
const freeze = () => {
|
|
11
|
+
clearTimeout(timer);
|
|
12
|
+
timer = undefined;
|
|
13
|
+
delete root.dataset.motion;
|
|
14
|
+
};
|
|
15
|
+
const wake = () => {
|
|
16
|
+
clearTimeout(timer);
|
|
17
|
+
timer = setTimeout(freeze, windowMs);
|
|
18
|
+
if (root.dataset.motion !== "live") root.dataset.motion = "live";
|
|
19
|
+
};
|
|
20
|
+
const onVisibility = () => {
|
|
21
|
+
if (document.visibilityState === "hidden") freeze();
|
|
22
|
+
else wake();
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
wake();
|
|
26
|
+
document.addEventListener("pointerdown", wake, { passive: true, capture: true });
|
|
27
|
+
document.addEventListener("visibilitychange", onVisibility);
|
|
28
|
+
|
|
29
|
+
return () => {
|
|
30
|
+
freeze();
|
|
31
|
+
document.removeEventListener("pointerdown", wake, { capture: true });
|
|
32
|
+
document.removeEventListener("visibilitychange", onVisibility);
|
|
33
|
+
};
|
|
34
|
+
}
|
package/src/solid/data-table.tsx
CHANGED
|
@@ -239,7 +239,7 @@ export function TableEmpty(props: {
|
|
|
239
239
|
action?: JSX.Element;
|
|
240
240
|
}) {
|
|
241
241
|
return (
|
|
242
|
-
<Empty class="gap-3 rounded-none
|
|
242
|
+
<Empty class="gap-3 rounded-none py-12">
|
|
243
243
|
<EmptyHeader>
|
|
244
244
|
<Show when={props.icon}>
|
|
245
245
|
<EmptyMedia media="icon">
|
package/src/solid/dock-paging.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
/** A page is one strip-width of items. The last one is whatever is left.
|
|
1
|
+
/** A page is one strip-width of items. The last one is whatever is left.
|
|
2
|
+
* The tolerance keeps a strip a sub-pixel over its viewport on one page: both
|
|
3
|
+
* numbers are rounded reads of the same box. */
|
|
2
4
|
export function pageCount(scrollWidth: number, viewport: number): number {
|
|
3
5
|
if (viewport <= 0) return 1;
|
|
4
|
-
return Math.max(1, Math.ceil(scrollWidth / viewport));
|
|
6
|
+
return Math.max(1, Math.ceil((scrollWidth - 1) / viewport));
|
|
5
7
|
}
|
|
6
8
|
|
|
7
9
|
/** The page a scroll position sits on, counting a half-page as turned. */
|
package/src/solid/dock.tsx
CHANGED
|
@@ -134,53 +134,38 @@ const Dock: Component<DockProps> = (props) => {
|
|
|
134
134
|
const itemWidth = () =>
|
|
135
135
|
containerRef?.querySelector('[data-slot="dock-item"]')?.getBoundingClientRect().width ?? 0;
|
|
136
136
|
|
|
137
|
+
const padX = (el: Element) => {
|
|
138
|
+
const style = getComputedStyle(el);
|
|
139
|
+
return (
|
|
140
|
+
(Number.parseFloat(style.paddingLeft) || 0) + (Number.parseFloat(style.paddingRight) || 0)
|
|
141
|
+
);
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// The width the app gave the dock. Never the surface: it shrink-wraps this strip,
|
|
145
|
+
// so measuring it asks the strip how wide the strip is.
|
|
146
|
+
const availableWidth = () => {
|
|
147
|
+
const box = containerRef?.closest<HTMLElement>('[data-slot="dock"]');
|
|
148
|
+
if (!box || !surfaceRef) return 0;
|
|
149
|
+
return box.clientWidth - padX(box) - padX(surfaceRef);
|
|
150
|
+
};
|
|
151
|
+
|
|
137
152
|
const checkOverflow = () => {
|
|
138
153
|
if (!containerRef) return;
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
(Number.parseFloat(surfaceStyle.paddingLeft) || 0) +
|
|
147
|
-
(Number.parseFloat(surfaceStyle.paddingRight) || 0);
|
|
148
|
-
let siblingWidth = 0;
|
|
149
|
-
for (const child of Array.from(surface.children)) {
|
|
150
|
-
if (child === containerRef) continue;
|
|
151
|
-
const childStyle = getComputedStyle(child);
|
|
152
|
-
// The page dots overlay the bar out of flow; they do not narrow it.
|
|
153
|
-
if (childStyle.position === "absolute" || childStyle.position === "fixed") continue;
|
|
154
|
-
siblingWidth +=
|
|
155
|
-
child.getBoundingClientRect().width +
|
|
156
|
-
(Number.parseFloat(childStyle.marginLeft) || 0) +
|
|
157
|
-
(Number.parseFloat(childStyle.marginRight) || 0);
|
|
154
|
+
const available = availableWidth();
|
|
155
|
+
const overflowing = available > 0 && containerRef.scrollWidth > available + 1;
|
|
156
|
+
if (overflowing) {
|
|
157
|
+
const trimmed = stripWidth(available, itemWidth(), gapWidth());
|
|
158
|
+
if (trimmed > 0) containerRef.style.width = `${trimmed}px`;
|
|
159
|
+
} else if (containerRef.style.width) {
|
|
160
|
+
containerRef.style.width = "";
|
|
158
161
|
}
|
|
159
|
-
const availableWidth = surface.clientWidth - paddingX - siblingWidth;
|
|
160
|
-
const overflowing = containerRef.scrollWidth > availableWidth;
|
|
161
|
-
const trimmed = overflowing ? stripWidth(availableWidth, itemWidth(), gapWidth()) : 0;
|
|
162
|
-
if (trimmed > 0) containerRef.style.width = `${trimmed}px`;
|
|
163
162
|
setNeedsScroll(overflowing);
|
|
164
|
-
const viewport =
|
|
163
|
+
const viewport = containerRef.clientWidth;
|
|
165
164
|
setViewportWidth(viewport);
|
|
166
165
|
setPages(pageCount(containerRef.scrollWidth, viewport));
|
|
167
166
|
setPage(pageOf(containerRef.scrollLeft, viewport));
|
|
168
167
|
};
|
|
169
168
|
|
|
170
|
-
// The surface animates its width, so a read taken right after we set one is
|
|
171
|
-
// mid-transition: clearing our trim has to settle before the next measure.
|
|
172
|
-
let settleId: ReturnType<typeof setTimeout> | undefined;
|
|
173
|
-
const remeasure = () => {
|
|
174
|
-
if (!containerRef) return;
|
|
175
|
-
if (!containerRef.style.width) {
|
|
176
|
-
checkOverflow();
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
containerRef.style.width = "";
|
|
180
|
-
clearTimeout(settleId);
|
|
181
|
-
settleId = setTimeout(checkOverflow, 250);
|
|
182
|
-
};
|
|
183
|
-
|
|
184
169
|
const goToPage = (next: number) => {
|
|
185
170
|
if (!containerRef) return;
|
|
186
171
|
containerRef.scrollTo({
|
|
@@ -198,26 +183,25 @@ const Dock: Component<DockProps> = (props) => {
|
|
|
198
183
|
});
|
|
199
184
|
|
|
200
185
|
onMount(() => {
|
|
201
|
-
const timeoutId = setTimeout(
|
|
202
|
-
// Watching the bar would see its own trim and re-trim forever; the viewport
|
|
203
|
-
// is the only width the dock does not derive from itself.
|
|
186
|
+
const timeoutId = setTimeout(checkOverflow, 100);
|
|
204
187
|
let resizeTimeoutId: ReturnType<typeof setTimeout> | undefined;
|
|
205
188
|
const onResize = () => {
|
|
206
189
|
clearTimeout(resizeTimeoutId);
|
|
207
|
-
resizeTimeoutId = setTimeout(
|
|
190
|
+
resizeTimeoutId = setTimeout(checkOverflow, 50);
|
|
208
191
|
};
|
|
209
192
|
window.addEventListener("resize", onResize);
|
|
210
193
|
onCleanup(() => {
|
|
211
194
|
clearTimeout(timeoutId);
|
|
212
195
|
clearTimeout(resizeTimeoutId);
|
|
213
|
-
clearTimeout(settleId);
|
|
214
196
|
window.removeEventListener("resize", onResize);
|
|
215
197
|
});
|
|
216
198
|
});
|
|
217
199
|
|
|
218
200
|
createEffect(() => {
|
|
219
201
|
local.items.length;
|
|
220
|
-
|
|
202
|
+
// The box pads by mode, so switching it changes the room the strip has.
|
|
203
|
+
dockMode();
|
|
204
|
+
const timeoutId = setTimeout(checkOverflow, 150);
|
|
221
205
|
onCleanup(() => clearTimeout(timeoutId));
|
|
222
206
|
});
|
|
223
207
|
|
|
@@ -236,7 +220,7 @@ const Dock: Component<DockProps> = (props) => {
|
|
|
236
220
|
data-slot="dock-surface"
|
|
237
221
|
class={cn(
|
|
238
222
|
// isolate: the layers behind the icons stay inside the dock even with blur off.
|
|
239
|
-
"relative isolate flex max-w-full items-center justify-center p-1.5 sm:p-2",
|
|
223
|
+
"pointer-events-auto relative isolate flex max-w-full items-center justify-center p-1.5 sm:p-2",
|
|
240
224
|
// Room for the page dots inside the glass; outside it they sit on
|
|
241
225
|
// the screen edge and get clipped.
|
|
242
226
|
pages() > 1 && "pb-4 sm:pb-5",
|
package/src/solid/empty.tsx
CHANGED
|
@@ -8,7 +8,7 @@ const Empty: Component<ComponentProps<"div">> = (props) => {
|
|
|
8
8
|
<div
|
|
9
9
|
data-slot="empty"
|
|
10
10
|
class={cn(
|
|
11
|
-
"flex min-w-0 flex-1 flex-col items-center justify-center gap-6 text-balance rounded-lg
|
|
11
|
+
"flex min-w-0 flex-1 flex-col items-center justify-center gap-6 text-balance rounded-lg p-6 text-center md:p-12",
|
|
12
12
|
local.class,
|
|
13
13
|
)}
|
|
14
14
|
{...rest}
|