@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 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. The host holds `html[data-motion="live"]` for the window
152
- (dash: `createMotionWindow`, 30 s); light-DOM loops gate on that attribute,
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 o, Dt as s, E as c, Et as l, F as u, Ft as d, G as f, Gt as p, H as m, Ht as h, I as g, It as _, J as v, Jt as y, Kt as b, L as x, Lt as S, M as C, Mt as w, N as T, Nt as E, O as D, Ot as O, P as k, Pt as A, Q as j, R as M, Rt as N, S as P, St as F, T as I, U as L, Ut as R, V as z, Vt as B, Wt as V, X as H, Xt as U, Y as W, Yt as G, Z as K, Zt as q, _ as J, _t as Y, at as X, b as Z, c as Q, ct as $, d as ee, et as te, f as ne, g as re, h as ie, i as ae, it as oe, j as se, jt as ce, k as le, kt as ue, l as de, m as fe, n as pe, nt as me, o as he, ot as ge, p as _e, q as ve, qt as ye, r as be, rt as xe, s as Se, st as Ce, t as we, tt as Te, u as Ee, ut as De, v as Oe, vt as ke, w as Ae, wt as je, x as Me, y as Ne, yt as Pe, z as Fe } from "./utils-DMaksjvy.js";
2
- export { r as ALERT_CLASS, B as ALERT_CONTENT_CLASS, h as ALERT_DESCRIPTION_CLASS, R as ALERT_ICON_BG_CLASS, V as ALERT_ICON_CLASS, p as ALERT_ICON_PATHS, b as ALERT_TITLE_CLASS, ye as ALERT_TONES, A as BUTTON_DEFAULT_CLASS, d as BUTTON_OUTLINE_CLASS, De as CARD_BLUR, Y as CARD_SURFACE, ke as CARD_SURFACE_BASE, Pe as CARD_SURFACE_OPAQUE, v as CAROUSEL_DOTS, W as CAROUSEL_VIEWPORT, fe as CHIP, Te as CONTROL_H, J as CONTROL_H_TOUCH, me as FIELD_CHROME, xe as FIELD_CONTROL, je as FIELD_MOTION, oe as FIELD_TEXT, Z as FLOATING_PANEL, X as FOCUS_RING, _ as ICON_BUTTON_CLASS, ie as ICON_PILL, re as ICON_PILL_TINT, ge as INPUT_CLASS, Ce as INPUT_SURFACE, $ as INVALID_RING, C as LOGO_DEFAULT_SIZE, T as LOGO_DEFAULT_SRC, k as LOGO_DEFAULT_SUB, u as LOGO_MARK_CLASS, g as LOGO_MARK_PX, x as LOGO_NAME_CLASS, M as LOGO_ROOT_CLASS, Fe as LOGO_SIZES, n as LOGO_STACK_CLASS, z as LOGO_SUB_CLASS, o as MENU_ITEM, D as MENU_ITEM_BASE, le as MENU_ITEM_X, t as MENU_LABEL, se as MENU_SEPARATOR, pe as MOBILE_BREAKPOINT, l as MODAL_MOTION, s as MORPH_MOTION, S as OUTLINE_SURFACE, Me as OVERLAY_BLUR, O as OVERLAY_MOTION, P as OVERLAY_SURFACE, i as OVERLAY_SURFACE_BASE, Ae as OVERLAY_SURFACE_OPAQUE, Oe as PICKER_LIST, Ne as PICKER_TRIGGER, e as POSITION_BAR, te as POSITION_BAR_LIT, ue as PRESS_DIP, I as SCRIM_CLASS, ce as SCRIM_MOTION, Ee as SECTION_INNER_RADIUS, ee as SECTION_OUTER_RADIUS, ne as SECTION_PADDING, _e as SECTION_ROW_CLASS, F as SECTION_ROW_SURFACE, de as SEGMENT_ITEM, w as SETTLE_MOTION, E as STAGGER, ae as THUMB_CLASS, he as THUMB_RAIL_BLEED, Se as THUMB_RAIL_PAD, Q as THUMB_SIZE, a as TRACK_SURFACE, m as Z, L as Z_CLASS, y as alertBorder, G as alertFill, U as alertIconBgStyle, q as alertIconFill, c as anchorToTriggerTop, N as buttonVariants, H as carouselDot, K as carouselItem, j as carouselTrack, we as cn, be as createIsMobile, f as glassToneText, ve as toneTextMix };
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;
@@ -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 border border-border/60 border-dashed p-6 text-center md:p-12", t.class);
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 border-none py-12",
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.parentElement;
14363
- if (!e) {
14364
- l(s.scrollWidth > window.innerWidth);
14365
- return;
14366
- }
14367
- let t = getComputedStyle(e), n = (Number.parseFloat(t.paddingLeft) || 0) + (Number.parseFloat(t.paddingRight) || 0), r = 0;
14368
- for (let t of Array.from(e.children)) {
14369
- if (t === s) continue;
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), clearTimeout(b), window.removeEventListener("resize", n);
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.16.0",
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
@@ -82,6 +82,7 @@ export {
82
82
  SETTLE_MOTION,
83
83
  STAGGER,
84
84
  } from "./lib/motion-classes.js";
85
+ export { MOTION_WINDOW_MS, startMotionWindow } from "./lib/motion-window.js";
85
86
  export {
86
87
  anchorToTriggerTop,
87
88
  FLOATING_PANEL,
@@ -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
+ }
@@ -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 border-none py-12">
242
+ <Empty class="gap-3 rounded-none py-12">
243
243
  <EmptyHeader>
244
244
  <Show when={props.icon}>
245
245
  <EmptyMedia media="icon">
@@ -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. */
@@ -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 surface = containerRef.parentElement;
140
- if (!surface) {
141
- setNeedsScroll(containerRef.scrollWidth > window.innerWidth);
142
- return;
143
- }
144
- const surfaceStyle = getComputedStyle(surface);
145
- const paddingX =
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 = trimmed > 0 ? trimmed : containerRef.clientWidth;
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(remeasure, 100);
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(remeasure, 50);
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
- const timeoutId = setTimeout(remeasure, 150);
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",
@@ -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 border border-border/60 border-dashed p-6 text-center md:p-12",
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}