@mikebrucker/brucks 0.1.0 → 0.1.1

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/README.md CHANGED
@@ -10,7 +10,7 @@ It has three entry points, one per folder in `src/`:
10
10
  | --- | --- | --- |
11
11
  | `@mikebrucker/brucks/style` (+ `@mikebrucker/brucks/style/theme.css`) | the Tailwind theme, `cn`, `Side`, the class recipes, the style settings | nothing |
12
12
  | `@mikebrucker/brucks/ui` (+ `@mikebrucker/brucks/ui/<file>`) | the components, `BrucksProvider`, the back stack | style |
13
- | `@mikebrucker/brucks/blucks` | `AppLayout`, `Header`, `Footer`, the settings kit, `HomeCard`, `ScrollToTopFab`, `useDisclosure`, `useScrollAncestor`, `isKeyOf` | ui, style |
13
+ | `@mikebrucker/brucks/blucks` | `AppLayout`, `Header`, `Footer`, the settings kit, `HomeCard`, `Loader`, `ScrollToTopFab`, `useDisclosure`, `useScrollAncestor`, `isKeyOf` | ui, style |
14
14
 
15
15
  There is no plain `brucks` import, so everything has exactly one import path.
16
16
  `npm run lint` keeps the layers apart: style imports neither ui nor blucks, and ui
@@ -101,8 +101,8 @@ The theme provides:
101
101
  `html.high-contrast`, `html[data-accent]`)
102
102
  - the `dark` and `hc` variants
103
103
  - the stacking layers (see below)
104
- - the drawer, collapsible and flap keyframes (`animate-flap`)
105
- - the `safe-area-y` utility and the loader
104
+ - the drawer and collapsible keyframes
105
+ - the `safe-area-y` utility
106
106
  - a base rule giving every element `border-border` and `outline-ring`
107
107
  - a reduced-motion rule: with reduced motion on, every animation and transition
108
108
  finishes at once
@@ -211,7 +211,9 @@ wiring.
211
211
  ### Blocks (`@mikebrucker/brucks/blucks`)
212
212
 
213
213
  The blocks of an app, optional: ui and style never need them. Together with the
214
- style settings they make a full settings page.
214
+ style settings they make a full settings page. Their own CSS comes with them:
215
+ `Loader` and `ScrollToTopFab` import the `.css` file next to them, which the app's
216
+ bundler loads along with the component, so the theme carries none of it.
215
217
 
216
218
  - `AppLayout` frames every page: a skip link, the `header`, `main` as the one
217
219
  scroller, with the page in a centered column, an optional `sidebar` beside it
@@ -264,6 +266,8 @@ style settings they make a full settings page.
264
266
  ```
265
267
 
266
268
  Without `asChild` it is a button that runs `onClick`.
269
+ - `Loader` draws bouncing bars in the text color; `fullScreen` centers them over
270
+ the page.
267
271
  - `ScrollToTopFab` scrolls its nearest scrolling ancestor to the top. It fades in
268
272
  after `screensBeforeVisible` screen heights; `position="inline"` keeps it in
269
273
  the flow, always shown. Its name is the `scrollToTop` label. Pressed from the
@@ -0,0 +1,169 @@
1
+ /* The bars hold a [2 3 5 6 7 6 4] spectrum contour and pulse together on a 4-beat envelope. */
2
+ .loader {
3
+ display: inline-block;
4
+ position: relative;
5
+ width: 100px;
6
+ height: 50px;
7
+ background-repeat: no-repeat;
8
+ background-image:
9
+ linear-gradient(currentColor 50px, transparent 0),
10
+ linear-gradient(currentColor 50px, transparent 0),
11
+ linear-gradient(currentColor 50px, transparent 0),
12
+ linear-gradient(currentColor 50px, transparent 0),
13
+ linear-gradient(currentColor 50px, transparent 0),
14
+ linear-gradient(currentColor 50px, transparent 0),
15
+ linear-gradient(currentColor 50px, transparent 0);
16
+ background-position:
17
+ 0px center,
18
+ 15px center,
19
+ 30px center,
20
+ 45px center,
21
+ 60px center,
22
+ 75px center,
23
+ 90px center;
24
+ animation: musicBounce 1.8s ease-in-out infinite;
25
+ }
26
+ @keyframes musicBounce {
27
+ 0% {
28
+ background-size:
29
+ 10px 12px,
30
+ 10px 18px,
31
+ 10px 20px,
32
+ 10px 35px,
33
+ 10px 33px,
34
+ 10px 25px,
35
+ 10px 24px;
36
+ }
37
+
38
+ 8.3333% {
39
+ background-size:
40
+ 10px 17px,
41
+ 10px 19px,
42
+ 10px 30px,
43
+ 10px 41px,
44
+ 10px 35px,
45
+ 10px 36px,
46
+ 10px 27px;
47
+ }
48
+
49
+ 16.6667% {
50
+ background-size:
51
+ 10px 17px,
52
+ 10px 17px,
53
+ 10px 33px,
54
+ 10px 32px,
55
+ 10px 37px,
56
+ 10px 37px,
57
+ 10px 21px;
58
+ }
59
+
60
+ 25% {
61
+ background-size:
62
+ 10px 12px,
63
+ 10px 14px,
64
+ 10px 25px,
65
+ 10px 25px,
66
+ 10px 42px,
67
+ 10px 34px,
68
+ 10px 17px;
69
+ }
70
+
71
+ 33.3333% {
72
+ background-size:
73
+ 10px 13px,
74
+ 10px 21px,
75
+ 10px 26px,
76
+ 10px 31px,
77
+ 10px 39px,
78
+ 10px 36px,
79
+ 10px 24px;
80
+ }
81
+
82
+ 41.6667% {
83
+ background-size:
84
+ 10px 13px,
85
+ 10px 22px,
86
+ 10px 27px,
87
+ 10px 32px,
88
+ 10px 29px,
89
+ 10px 27px,
90
+ 10px 26px;
91
+ }
92
+
93
+ 50% {
94
+ background-size:
95
+ 10px 12px,
96
+ 10px 18px,
97
+ 10px 29px,
98
+ 10px 35px,
99
+ 10px 38px,
100
+ 10px 25px,
101
+ 10px 24px;
102
+ }
103
+
104
+ 58.3333% {
105
+ background-size:
106
+ 10px 17px,
107
+ 10px 19px,
108
+ 10px 32px,
109
+ 10px 41px,
110
+ 10px 48px,
111
+ 10px 36px,
112
+ 10px 27px;
113
+ }
114
+
115
+ 66.6667% {
116
+ background-size:
117
+ 10px 17px,
118
+ 10px 17px,
119
+ 10px 24px,
120
+ 10px 32px,
121
+ 10px 33px,
122
+ 10px 37px,
123
+ 10px 21px;
124
+ }
125
+
126
+ 75% {
127
+ background-size:
128
+ 10px 12px,
129
+ 10px 14px,
130
+ 10px 24px,
131
+ 10px 25px,
132
+ 10px 29px,
133
+ 10px 34px,
134
+ 10px 17px;
135
+ }
136
+
137
+ 83.3333% {
138
+ background-size:
139
+ 10px 13px,
140
+ 10px 21px,
141
+ 10px 35px,
142
+ 10px 31px,
143
+ 10px 44px,
144
+ 10px 36px,
145
+ 10px 24px;
146
+ }
147
+
148
+ 91.6667% {
149
+ background-size:
150
+ 10px 13px,
151
+ 10px 22px,
152
+ 10px 27px,
153
+ 10px 32px,
154
+ 10px 41px,
155
+ 10px 27px,
156
+ 10px 26px;
157
+ }
158
+
159
+ 100% {
160
+ background-size:
161
+ 10px 12px,
162
+ 10px 18px,
163
+ 10px 20px,
164
+ 10px 35px,
165
+ 10px 33px,
166
+ 10px 25px,
167
+ 10px 24px;
168
+ }
169
+ }
@@ -1,3 +1,4 @@
1
+ import "./loader.css";
1
2
  type LoaderProps = {
2
3
  isOpen: boolean;
3
4
  /** Tailwind text color utilities, e.g. "text-cyan-400" */
@@ -11,5 +12,5 @@ type LoaderProps = {
11
12
  /** Makes the wrapper a keyboard-accessible button you can click */
12
13
  onClick?: () => void;
13
14
  };
14
- export default function Loader({ isOpen, className, fullScreen, transparentBg, label, onClick, }: LoaderProps): import("react").JSX.Element | null;
15
- export {};
15
+ declare function Loader({ isOpen, className, fullScreen, transparentBg, label, onClick }: LoaderProps): import("react").JSX.Element | null;
16
+ export { Loader };
@@ -1,6 +1,7 @@
1
1
  import { cn } from "../../style/utils.js";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- // src/ui/components/loader.tsx
3
+ import "./loader.css";
4
+ // src/blucks/components/loader.tsx
4
5
  function Loader({ isOpen, className, fullScreen, transparentBg, label, onClick }) {
5
6
  if (!isOpen) return null;
6
7
  const wrapperClassName = fullScreen ? cn("fixed inset-0 z-loader flex items-center justify-center", !transparentBg ? "bg-black/50" : null) : void 0;
@@ -22,6 +23,6 @@ function Loader({ isOpen, className, fullScreen, transparentBg, label, onClick }
22
23
  children: [bars, status]
23
24
  });
24
25
  }
25
- export { Loader as default };
26
+ export { Loader };
26
27
 
27
28
  //# sourceMappingURL=loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.js","names":[],"sources":["../../../src/blucks/components/loader.tsx"],"sourcesContent":["import \"~/blucks/components/loader.css\";\nimport { cn } from \"~/style/utils\";\n\ntype LoaderProps = {\n isOpen: boolean;\n /** Tailwind text color utilities, e.g. \"text-cyan-400\" */\n className?: string;\n /** Center the loader over a full-page overlay */\n fullScreen?: boolean;\n /** With fullScreen, skip the dimmed backdrop so the page shows through */\n transparentBg?: boolean;\n /** What screen readers announce, in the page's language; English \"Loading\" if left out */\n label?: string;\n /** Makes the wrapper a keyboard-accessible button you can click */\n onClick?: () => void;\n};\n\nfunction Loader({ isOpen, className, fullScreen, transparentBg, label, onClick }: LoaderProps) {\n if (!isOpen) return null;\n\n const backdropClassName = !transparentBg ? \"bg-black/50\" : null;\n const wrapperClassName = fullScreen\n ? cn(\"fixed inset-0 z-loader flex items-center justify-center\", backdropClassName)\n : undefined;\n\n const bars = <span className={`loader ${className ?? \"\"}`.trim()} />;\n\n // The fallback is English on any page, so it says so for the screen reader's voice.\n const status = (\n <span\n role=\"status\"\n aria-live=\"polite\"\n className=\"sr-only\"\n lang={label === undefined ? \"en\" : undefined}\n >\n {label ?? \"Loading\"}\n </span>\n );\n\n return onClick ? (\n <button type=\"button\" onClick={onClick} className={wrapperClassName}>\n {bars}\n {status}\n </button>\n ) : (\n <div className={wrapperClassName}>\n {bars}\n {status}\n </div>\n );\n}\n\nexport { Loader };\n"],"mappings":";;;;AAiBA,SAAS,OAAO,EAAE,QAAQ,WAAW,YAAY,eAAe,OAAO,WAAwB;CAC7F,IAAI,CAAC,QAAQ,OAAO;CAGpB,MAAM,mBAAmB,aACrB,GAAG,2DAFmB,CAAC,gBAAgB,gBAAgB,IAEwB,IAC/E,KAAA;CAEJ,MAAM,OAAO,oBAAC,QAAD,EAAM,WAAW,UAAU,aAAa,KAAK,KAAK,EAAI,CAAA;CAGnE,MAAM,SACJ,oBAAC,QAAD;EACE,MAAK;EACL,aAAU;EACV,WAAU;EACV,MAAM,UAAU,KAAA,IAAY,OAAO,KAAA;EAElC,UAAA,SAAS;CACN,CAAA;CAGR,OAAO,UACL,qBAAC,UAAD;EAAQ,MAAK;EAAkB;EAAS,WAAW;EAAnD,UAAA,CACG,MACA,MACK;CAER,CAAA,IAAA,qBAAC,OAAD;EAAK,WAAW;EAAhB,UAAA,CACG,MACA,MACE;;AAET"}
@@ -0,0 +1,9 @@
1
+ @keyframes flap {
2
+ 0%,
3
+ 100% {
4
+ rotate: -25deg;
5
+ }
6
+ 50% {
7
+ rotate: -15deg;
8
+ }
9
+ }
@@ -1,4 +1,5 @@
1
1
  import { type ComponentProps } from "react";
2
+ import "./scrollToTopFab.css";
2
3
  import { AppIcon } from "../../ui/components/icon";
3
4
  type ScrollToTopFabProps = {
4
5
  /** How many screen heights must be scrolled before the button appears. */
@@ -8,6 +8,7 @@ import { c } from "react/compiler-runtime";
8
8
  import { useEffect, useRef, useState } from "react";
9
9
  import { jsx } from "react/jsx-runtime";
10
10
  import { FlyingHumanIcon } from "@hugeicons/core-free-icons";
11
+ import "./scrollToTopFab.css";
11
12
  // src/blucks/components/scrollToTopFab.tsx
12
13
  /** Frames the scroller may sit still before the climb counts as stalled. */
13
14
  var STALLED_FRAMES = 3;
@@ -141,7 +142,7 @@ function ScrollToTopFab(t0) {
141
142
  $[11] = t13;
142
143
  } else t13 = $[11];
143
144
  const t14 = labels.scrollToTop;
144
- const t15 = animate && "animate-flap";
145
+ const t15 = animate && "animate-[flap_1s_ease-in-out_infinite]";
145
146
  const t16 = icon === FlyingHumanIcon && "-rotate-25";
146
147
  let t17;
147
148
  if ($[12] !== t15 || $[13] !== t16) {
@@ -1 +1 @@
1
- {"version":3,"file":"scrollToTopFab.js","names":["c","_c","FlyingHumanIcon","ComponentProps","useEffect","useRef","useState","useScrollAncestor","cn","Fab","AppIcon","useBrucksLabels","STALLED_FRAMES","HANDOVER_EVENTS","const","ScrollToTopFabProps","screensBeforeVisible","position","className","theme","icon","animate","ScrollToTopFab","t0","$","t1","t2","t3","t4","t5","undefined","labels","fadesOnScroll","fabRef","scrollAncestor","visible","setVisible","t6","t7","onScroll","scrollTop","clientHeight","scrollTarget","document","documentElement","addEventListener","passive","removeEventListener","endClimb","t8","t9","Symbol","for","current","t10","fab","activeElement","focus","preventScroll","blur","window","matchMedia","matches","scrollTo","top","behavior","runway","frame","requestAnimationFrame","tick","previousTop","stalledFrames","stop","event","cancelAnimationFrame","event_0","scrollToTop","t11","t12","t13","t14","t15","t16","t17","t18","t19","_c"],"sources":["../../../src/blucks/components/scrollToTopFab.tsx"],"sourcesContent":["\"use client\";\n\nimport { FlyingHumanIcon } from \"@hugeicons/core-free-icons\";\nimport { type ComponentProps, useEffect, useRef, useState } from \"react\";\nimport { useScrollAncestor } from \"~/blucks/hooks/useScrollAncestor\";\nimport { cn } from \"~/style/utils\";\nimport { Fab } from \"~/ui/components/fab\";\nimport { AppIcon } from \"~/ui/components/icon\";\nimport { useBrucksLabels } from \"~/ui/lib/labels\";\n\n/** Frames the scroller may sit still before the climb counts as stalled. */\nconst STALLED_FRAMES = 3;\n\n/** Reader input that means the scroller is theirs again. */\nconst HANDOVER_EVENTS = [\"wheel\", \"touchstart\", \"pointerdown\", \"keydown\"] as const;\n\ntype ScrollToTopFabProps = {\n /** How many screen heights must be scrolled before the button appears. */\n screensBeforeVisible?: number;\n /** `inline` drops the fixed positioning and keeps the button in normal flow. */\n position?: \"bottom-right\" | \"bottom-left\" | \"inline\";\n className?: string;\n /** Draws the icon in the theme accent. */\n theme?: boolean;\n icon?: ComponentProps<typeof AppIcon>[\"icon\"];\n /** Rocks the icon with the flap animation. */\n animate?: boolean;\n};\n\nfunction ScrollToTopFab({\n screensBeforeVisible = 2.5,\n position = \"bottom-right\",\n className,\n theme = false,\n icon = FlyingHumanIcon,\n animate = true,\n}: ScrollToTopFabProps) {\n const labels = useBrucksLabels();\n\n // An in-flow button would leave a hole while hidden, so it never fades out.\n const fadesOnScroll = position !== \"inline\";\n\n const fabRef = useRef<HTMLButtonElement>(null);\n const scrollAncestor = useScrollAncestor(fabRef);\n const [visible, setVisible] = useState(false);\n\n useEffect(() => {\n if (!scrollAncestor || !fadesOnScroll) return;\n\n const onScroll = () => {\n setVisible(scrollAncestor.scrollTop > scrollAncestor.clientHeight * screensBeforeVisible);\n };\n\n // The page's own scrolling fires its scroll events at the document, not at <html>.\n const scrollTarget: EventTarget =\n scrollAncestor === document.documentElement ? document : scrollAncestor;\n\n onScroll();\n scrollTarget.addEventListener(\"scroll\", onScroll, { passive: true });\n\n return () => scrollTarget.removeEventListener(\"scroll\", onScroll);\n }, [scrollAncestor, screensBeforeVisible, fadesOnScroll]);\n\n /** Tears down an in-flight climb: the frame loop and its handover listeners. */\n const endClimb = useRef<(() => void) | null>(null);\n useEffect(() => () => endClimb.current?.(), []);\n\n const scrollToTop = () => {\n if (!scrollAncestor) return;\n endClimb.current?.();\n\n // Focus goes up with the reader, instead of staying on a button left at the bottom (and hidden there).\n const fab = fabRef.current;\n if (fab && document.activeElement === fab) {\n scrollAncestor.focus({ preventScroll: true });\n if (document.activeElement === fab) fab.blur();\n }\n\n if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) {\n scrollAncestor.scrollTo({ top: 0, behavior: \"auto\" });\n return;\n }\n\n /*\n * The browser paces a smooth scroll by its distance, and a virtualized list\n * puts hundreds of thousands of pixels between the bottom and the top, so\n * animating the whole trip crawls. Cut to within a screen of the top - none\n * of what is skipped is on screen long enough to read - and animate only\n * that last leg.\n */\n const runway = scrollAncestor.clientHeight;\n if (scrollAncestor.scrollTop > runway) {\n scrollAncestor.scrollTo({ top: runway, behavior: \"auto\" });\n }\n\n scrollAncestor.scrollTo({ top: 0, behavior: \"smooth\" });\n\n /*\n * A virtualized list remeasures rows as they scroll into view and re-anchors\n * the scroll offset to keep them from jumping, which cancels the native\n * animation partway up. Re-aim whenever the climb stalls short of the top,\n * and hand the scroller back the moment the reader touches it.\n */\n let frame = requestAnimationFrame(tick);\n let previousTop = scrollAncestor.scrollTop;\n let stalledFrames = 0;\n\n function tick() {\n if (!scrollAncestor) return;\n const { scrollTop } = scrollAncestor;\n\n if (scrollTop === 0) {\n endClimb.current?.();\n return;\n }\n\n stalledFrames = scrollTop === previousTop ? stalledFrames + 1 : 0;\n previousTop = scrollTop;\n\n if (stalledFrames >= STALLED_FRAMES) {\n stalledFrames = 0;\n scrollAncestor.scrollTo({ top: 0, behavior: \"smooth\" });\n }\n\n frame = requestAnimationFrame(tick);\n }\n\n const stop = () => endClimb.current?.();\n for (const event of HANDOVER_EVENTS) {\n scrollAncestor.addEventListener(event, stop, { passive: true });\n }\n\n endClimb.current = () => {\n cancelAnimationFrame(frame);\n for (const event of HANDOVER_EVENTS) {\n scrollAncestor.removeEventListener(event, stop);\n }\n endClimb.current = null;\n };\n };\n\n return (\n <Fab\n ref={fabRef}\n type=\"button\"\n position={position}\n visible={fadesOnScroll ? visible : true}\n className={cn(className, theme ? \"text-theme-600\" : null)}\n aria-label={labels.scrollToTop}\n onClick={scrollToTop}\n >\n <AppIcon\n icon={icon}\n className={cn(animate && \"animate-flap\", icon === FlyingHumanIcon && \"-rotate-25\")}\n />\n </Fab>\n );\n}\n\nexport { ScrollToTopFab };\n"],"mappings":";;;;;;;;;;;;AAWA,IAAMY,iBAAiB;;AAGvB,IAAMC,kBAAkB;CAAC;CAAS;CAAc;CAAe;AAAS;AAexE,SAAAS,eAAAC,IAAA;CAAA,MAAAC,IAAAvB,EAAA,EAAA;CAAwB,MAAA,EAAAe,sBAAAS,IAAAR,UAAAS,IAAAR,WAAAC,OAAAQ,IAAAP,MAAAQ,IAAAP,SAAAQ,OAAAN;CACtB,MAAAP,uBAAAS,OAAAK,KAAAA,IAAA,MAAAL;CACA,MAAAR,WAAAS,OAAAI,KAAAA,IAAA,iBAAAJ;CAEA,MAAAP,QAAAQ,OAAAG,KAAAA,IAAA,QAAAH;CACA,MAAAP,OAAAQ,OAAAE,KAAAA,IAAA5B,kBAAA0B;CACA,MAAAP,UAAAQ,OAAAC,KAAAA,IAAA,OAAAD;CAEA,MAAAE,SAAepB,gBAAgB;CAG/B,MAAAqB,gBAAsBf,aAAa;CAEnC,MAAAgB,SAAe5B,OAA0B,IAAI;CAC7C,MAAA6B,iBAAuB3B,kBAAkB0B,MAAM;CAC/C,MAAA,CAAAE,S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AAA6D;CAAA,OAAAA,MAAA7D,EAAA;CAAA,OAbN6D;AAaM"}
1
+ {"version":3,"file":"scrollToTopFab.js","names":["c","_c","FlyingHumanIcon","ComponentProps","useEffect","useRef","useState","useScrollAncestor","cn","Fab","AppIcon","useBrucksLabels","STALLED_FRAMES","HANDOVER_EVENTS","const","ScrollToTopFabProps","screensBeforeVisible","position","className","theme","icon","animate","ScrollToTopFab","t0","$","t1","t2","t3","t4","t5","undefined","labels","fadesOnScroll","fabRef","scrollAncestor","visible","setVisible","t6","t7","onScroll","scrollTop","clientHeight","scrollTarget","document","documentElement","addEventListener","passive","removeEventListener","endClimb","t8","t9","Symbol","for","current","t10","fab","activeElement","focus","preventScroll","blur","window","matchMedia","matches","scrollTo","top","behavior","runway","frame","requestAnimationFrame","tick","previousTop","stalledFrames","stop","event","cancelAnimationFrame","event_0","scrollToTop","t11","t12","t13","t14","t15","t16","t17","t18","t19","_c"],"sources":["../../../src/blucks/components/scrollToTopFab.tsx"],"sourcesContent":["\"use client\";\n\nimport { FlyingHumanIcon } from \"@hugeicons/core-free-icons\";\nimport { type ComponentProps, useEffect, useRef, useState } from \"react\";\nimport \"~/blucks/components/scrollToTopFab.css\";\nimport { useScrollAncestor } from \"~/blucks/hooks/useScrollAncestor\";\nimport { cn } from \"~/style/utils\";\nimport { Fab } from \"~/ui/components/fab\";\nimport { AppIcon } from \"~/ui/components/icon\";\nimport { useBrucksLabels } from \"~/ui/lib/labels\";\n\n/** Frames the scroller may sit still before the climb counts as stalled. */\nconst STALLED_FRAMES = 3;\n\n/** Reader input that means the scroller is theirs again. */\nconst HANDOVER_EVENTS = [\"wheel\", \"touchstart\", \"pointerdown\", \"keydown\"] as const;\n\ntype ScrollToTopFabProps = {\n /** How many screen heights must be scrolled before the button appears. */\n screensBeforeVisible?: number;\n /** `inline` drops the fixed positioning and keeps the button in normal flow. */\n position?: \"bottom-right\" | \"bottom-left\" | \"inline\";\n className?: string;\n /** Draws the icon in the theme accent. */\n theme?: boolean;\n icon?: ComponentProps<typeof AppIcon>[\"icon\"];\n /** Rocks the icon with the flap animation. */\n animate?: boolean;\n};\n\nfunction ScrollToTopFab({\n screensBeforeVisible = 2.5,\n position = \"bottom-right\",\n className,\n theme = false,\n icon = FlyingHumanIcon,\n animate = true,\n}: ScrollToTopFabProps) {\n const labels = useBrucksLabels();\n\n // An in-flow button would leave a hole while hidden, so it never fades out.\n const fadesOnScroll = position !== \"inline\";\n\n const fabRef = useRef<HTMLButtonElement>(null);\n const scrollAncestor = useScrollAncestor(fabRef);\n const [visible, setVisible] = useState(false);\n\n useEffect(() => {\n if (!scrollAncestor || !fadesOnScroll) return;\n\n const onScroll = () => {\n setVisible(scrollAncestor.scrollTop > scrollAncestor.clientHeight * screensBeforeVisible);\n };\n\n // The page's own scrolling fires its scroll events at the document, not at <html>.\n const scrollTarget: EventTarget =\n scrollAncestor === document.documentElement ? document : scrollAncestor;\n\n onScroll();\n scrollTarget.addEventListener(\"scroll\", onScroll, { passive: true });\n\n return () => scrollTarget.removeEventListener(\"scroll\", onScroll);\n }, [scrollAncestor, screensBeforeVisible, fadesOnScroll]);\n\n /** Tears down an in-flight climb: the frame loop and its handover listeners. */\n const endClimb = useRef<(() => void) | null>(null);\n useEffect(() => () => endClimb.current?.(), []);\n\n const scrollToTop = () => {\n if (!scrollAncestor) return;\n endClimb.current?.();\n\n // Focus goes up with the reader, instead of staying on a button left at the bottom (and hidden there).\n const fab = fabRef.current;\n if (fab && document.activeElement === fab) {\n scrollAncestor.focus({ preventScroll: true });\n if (document.activeElement === fab) fab.blur();\n }\n\n if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) {\n scrollAncestor.scrollTo({ top: 0, behavior: \"auto\" });\n return;\n }\n\n /*\n * The browser paces a smooth scroll by its distance, and a virtualized list\n * puts hundreds of thousands of pixels between the bottom and the top, so\n * animating the whole trip crawls. Cut to within a screen of the top - none\n * of what is skipped is on screen long enough to read - and animate only\n * that last leg.\n */\n const runway = scrollAncestor.clientHeight;\n if (scrollAncestor.scrollTop > runway) {\n scrollAncestor.scrollTo({ top: runway, behavior: \"auto\" });\n }\n\n scrollAncestor.scrollTo({ top: 0, behavior: \"smooth\" });\n\n /*\n * A virtualized list remeasures rows as they scroll into view and re-anchors\n * the scroll offset to keep them from jumping, which cancels the native\n * animation partway up. Re-aim whenever the climb stalls short of the top,\n * and hand the scroller back the moment the reader touches it.\n */\n let frame = requestAnimationFrame(tick);\n let previousTop = scrollAncestor.scrollTop;\n let stalledFrames = 0;\n\n function tick() {\n if (!scrollAncestor) return;\n const { scrollTop } = scrollAncestor;\n\n if (scrollTop === 0) {\n endClimb.current?.();\n return;\n }\n\n stalledFrames = scrollTop === previousTop ? stalledFrames + 1 : 0;\n previousTop = scrollTop;\n\n if (stalledFrames >= STALLED_FRAMES) {\n stalledFrames = 0;\n scrollAncestor.scrollTo({ top: 0, behavior: \"smooth\" });\n }\n\n frame = requestAnimationFrame(tick);\n }\n\n const stop = () => endClimb.current?.();\n for (const event of HANDOVER_EVENTS) {\n scrollAncestor.addEventListener(event, stop, { passive: true });\n }\n\n endClimb.current = () => {\n cancelAnimationFrame(frame);\n for (const event of HANDOVER_EVENTS) {\n scrollAncestor.removeEventListener(event, stop);\n }\n endClimb.current = null;\n };\n };\n\n return (\n <Fab\n ref={fabRef}\n type=\"button\"\n position={position}\n visible={fadesOnScroll ? visible : true}\n className={cn(className, theme ? \"text-theme-600\" : null)}\n aria-label={labels.scrollToTop}\n onClick={scrollToTop}\n >\n <AppIcon\n icon={icon}\n className={cn(\n animate && \"animate-[flap_1s_ease-in-out_infinite]\",\n icon === FlyingHumanIcon && \"-rotate-25\",\n )}\n />\n </Fab>\n );\n}\n\nexport { ScrollToTopFab };\n"],"mappings":";;;;;;;;;;;;;AAYA,IAAMY,iBAAiB;;AAGvB,IAAMC,kBAAkB;CAAC;CAAS;CAAc;CAAe;AAAS;AAexE,SAAAS,eAAAC,IAAA;CAAA,MAAAC,IAAAvB,EAAA,EAAA;CAAwB,M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AA,MAAA4D;CAAA,OAAAA,MAAA5D,EAAA;CAAA,IAAA6D;CAAA,IAAA7D,EAAA,QAAAO,OAAA6C,eAAApD,EAAA,QAAAP,YAAAO,EAAA,QAAAoD,eAAApD,EAAA,QAAAqD,OAAArD,EAAA,QAAAuD,OAAAvD,EAAA,QAAA4D,KAAA;EAfJC,MAAA,oBAAC,KAAD;GACOpD,KAAAA;GACA,MAAA;GACKhB;GACD,SAAA4D;GACE,WAAAE;GACC,cAAAC;GACHJ,SAAAA;GAETQ,UAAAA;EATE,CAAA;EAgBE5D,EAAA,MAAAO,OAAA6C;EAAApD,EAAA,MAAAP;EAAAO,EAAA,MAAAoD;EAAApD,EAAA,MAAAqD;EAAArD,EAAA,MAAAuD;EAAAvD,EAAA,MAAA4D;EAAA5D,EAAA,MAAA6D;CAAA,OAAAA,MAAA7D,EAAA;CAAA,OAhBN6D;AAgBM"}
@@ -1,4 +1,5 @@
1
1
  export { HomeCard, type HomeCardProps } from "./components/homeCard";
2
+ export { Loader } from "./components/loader";
2
3
  export { ScrollToTopFab } from "./components/scrollToTopFab";
3
4
  export { SettingsPickerModal } from "./components/settingsPickerModal";
4
5
  export { SettingsRow } from "./components/settingsRow";
@@ -1,4 +1,5 @@
1
1
  import { HomeCard } from "./components/homeCard.js";
2
+ import { Loader } from "./components/loader.js";
2
3
  import { useScrollAncestor } from "./hooks/useScrollAncestor.js";
3
4
  import { ScrollToTopFab } from "./components/scrollToTopFab.js";
4
5
  import { SettingsPickerModal } from "./components/settingsPickerModal.js";
@@ -10,4 +11,4 @@ import { AppLayout } from "./layout/appLayout.js";
10
11
  import { Footer } from "./layout/footer.js";
11
12
  import { Header } from "./layout/header.js";
12
13
  import { isKeyOf } from "./lib/utils.js";
13
- export { AppLayout, Footer, Header, HomeCard, ScrollToTopFab, SettingsPickerModal, SettingsRow, SettingsSection, SettingsSwatchButton, isKeyOf, useDisclosure, useScrollAncestor };
14
+ export { AppLayout, Footer, Header, HomeCard, Loader, ScrollToTopFab, SettingsPickerModal, SettingsRow, SettingsSection, SettingsSwatchButton, isKeyOf, useDisclosure, useScrollAncestor };
@@ -1142,8 +1142,6 @@ html[data-accent="sixer"] {
1142
1142
  ships keyframes under those names that always collapse to 0. */
1143
1143
  --animate-collapsible-expand: collapsible-expand 0.3s ease-in-out;
1144
1144
  --animate-collapsible-collapse: collapsible-collapse 0.3s ease-in-out;
1145
- /* ScrollToTopFab's flying human */
1146
- --animate-flap: flap 1s ease-in-out infinite;
1147
1145
  }
1148
1146
 
1149
1147
  /* Stacking layers, lowest first. Not `inline`, so the `z-*` utilities read real
@@ -1231,15 +1229,6 @@ html[data-accent="sixer"] {
1231
1229
  height: var(--collapsible-collapsed-height, 0px);
1232
1230
  }
1233
1231
  }
1234
- @keyframes flap {
1235
- 0%,
1236
- 100% {
1237
- rotate: -25deg;
1238
- }
1239
- 50% {
1240
- rotate: -15deg;
1241
- }
1242
- }
1243
1232
 
1244
1233
  @layer base {
1245
1234
  * {
@@ -1268,182 +1257,3 @@ html[data-accent="sixer"] {
1268
1257
  padding-top: env(safe-area-inset-top);
1269
1258
  padding-bottom: env(safe-area-inset-bottom);
1270
1259
  }
1271
-
1272
- /* Loader */
1273
- .loader {
1274
- display: inline-block;
1275
- position: relative;
1276
- width: 100px;
1277
- height: 50px;
1278
- background-repeat: no-repeat;
1279
- background-image:
1280
- linear-gradient(currentColor 50px, transparent 0),
1281
- linear-gradient(currentColor 50px, transparent 0),
1282
- linear-gradient(currentColor 50px, transparent 0),
1283
- linear-gradient(currentColor 50px, transparent 0),
1284
- linear-gradient(currentColor 50px, transparent 0),
1285
- linear-gradient(currentColor 50px, transparent 0),
1286
- linear-gradient(currentColor 50px, transparent 0);
1287
- background-position:
1288
- 0px center,
1289
- 15px center,
1290
- 30px center,
1291
- 45px center,
1292
- 60px center,
1293
- 75px center,
1294
- 90px center;
1295
- animation: musicBounce 1.8s ease-in-out infinite;
1296
- }
1297
-
1298
- /*
1299
- Real music keeps a spectral SHAPE rather than scattering randomly: energy humps
1300
- in the low-mids/presence and tapers at the edges. The bars hold that [2 3 5 6 7 6 4]
1301
- contour the whole time and the whole curve pulses to a 4-beat envelope, with only a
1302
- subtle per-bar wiggle so it breathes instead of moving in rigid lockstep. So the edge
1303
- bars stay short, the middle bars stay tall, and they all rise and fall together on
1304
- the beat. Whole-cycle frequencies keep 100% lined up with 0% for a seamless loop.
1305
- */
1306
- @keyframes musicBounce {
1307
- 0% {
1308
- background-size:
1309
- 10px 12px,
1310
- 10px 18px,
1311
- 10px 20px,
1312
- 10px 35px,
1313
- 10px 33px,
1314
- 10px 25px,
1315
- 10px 24px;
1316
- }
1317
-
1318
- 8.3333% {
1319
- background-size:
1320
- 10px 17px,
1321
- 10px 19px,
1322
- 10px 30px,
1323
- 10px 41px,
1324
- 10px 35px,
1325
- 10px 36px,
1326
- 10px 27px;
1327
- }
1328
-
1329
- 16.6667% {
1330
- background-size:
1331
- 10px 17px,
1332
- 10px 17px,
1333
- 10px 33px,
1334
- 10px 32px,
1335
- 10px 37px,
1336
- 10px 37px,
1337
- 10px 21px;
1338
- }
1339
-
1340
- 25% {
1341
- background-size:
1342
- 10px 12px,
1343
- 10px 14px,
1344
- 10px 25px,
1345
- 10px 25px,
1346
- 10px 42px,
1347
- 10px 34px,
1348
- 10px 17px;
1349
- }
1350
-
1351
- 33.3333% {
1352
- background-size:
1353
- 10px 13px,
1354
- 10px 21px,
1355
- 10px 26px,
1356
- 10px 31px,
1357
- 10px 39px,
1358
- 10px 36px,
1359
- 10px 24px;
1360
- }
1361
-
1362
- 41.6667% {
1363
- background-size:
1364
- 10px 13px,
1365
- 10px 22px,
1366
- 10px 27px,
1367
- 10px 32px,
1368
- 10px 29px,
1369
- 10px 27px,
1370
- 10px 26px;
1371
- }
1372
-
1373
- 50% {
1374
- background-size:
1375
- 10px 12px,
1376
- 10px 18px,
1377
- 10px 29px,
1378
- 10px 35px,
1379
- 10px 38px,
1380
- 10px 25px,
1381
- 10px 24px;
1382
- }
1383
-
1384
- 58.3333% {
1385
- background-size:
1386
- 10px 17px,
1387
- 10px 19px,
1388
- 10px 32px,
1389
- 10px 41px,
1390
- 10px 48px,
1391
- 10px 36px,
1392
- 10px 27px;
1393
- }
1394
-
1395
- 66.6667% {
1396
- background-size:
1397
- 10px 17px,
1398
- 10px 17px,
1399
- 10px 24px,
1400
- 10px 32px,
1401
- 10px 33px,
1402
- 10px 37px,
1403
- 10px 21px;
1404
- }
1405
-
1406
- 75% {
1407
- background-size:
1408
- 10px 12px,
1409
- 10px 14px,
1410
- 10px 24px,
1411
- 10px 25px,
1412
- 10px 29px,
1413
- 10px 34px,
1414
- 10px 17px;
1415
- }
1416
-
1417
- 83.3333% {
1418
- background-size:
1419
- 10px 13px,
1420
- 10px 21px,
1421
- 10px 35px,
1422
- 10px 31px,
1423
- 10px 44px,
1424
- 10px 36px,
1425
- 10px 24px;
1426
- }
1427
-
1428
- 91.6667% {
1429
- background-size:
1430
- 10px 13px,
1431
- 10px 22px,
1432
- 10px 27px,
1433
- 10px 32px,
1434
- 10px 41px,
1435
- 10px 27px,
1436
- 10px 26px;
1437
- }
1438
-
1439
- 100% {
1440
- background-size:
1441
- 10px 12px,
1442
- 10px 18px,
1443
- 10px 20px,
1444
- 10px 35px,
1445
- 10px 33px,
1446
- 10px 25px,
1447
- 10px 24px;
1448
- }
1449
- }
@@ -9,7 +9,6 @@ export { Fab, fabVariants } from "./components/fab";
9
9
  export { Form, FormControl, FormField, FormLabel, FormMessage } from "./components/form";
10
10
  export { AppIcon } from "./components/icon";
11
11
  export { Input, inputVariants } from "./components/input";
12
- export { default as Loader } from "./components/loader";
13
12
  export { Modal, useModalCloseIcon } from "./components/modal";
14
13
  export { Note } from "./components/note";
15
14
  export { Popover, PopoverClose } from "./components/popover";
package/dist/ui/index.js CHANGED
@@ -12,7 +12,6 @@ import { Drawer } from "./components/drawer.js";
12
12
  import { Fab, fabVariants } from "./components/fab.js";
13
13
  import { Form, FormControl, FormField, FormLabel, FormMessage } from "./components/form.js";
14
14
  import { Input, inputVariants } from "./components/input.js";
15
- import Loader from "./components/loader.js";
16
15
  import { Modal, useModalCloseIcon } from "./components/modal.js";
17
16
  import { Note } from "./components/note.js";
18
17
  import { Popover, PopoverClose } from "./components/popover.js";
@@ -31,4 +30,4 @@ import { Toast } from "./components/toast.js";
31
30
  import { Toggle, toggleVariants } from "./components/toggle.js";
32
31
  import { ToggleGroup, ToggleGroupItem } from "./components/toggle-group.js";
33
32
  import { Tooltip } from "./components/tooltip.js";
34
- export { Accordion, AccordionGroup, AlertDialog, AppIcon, BrucksProvider, Button, Checkbox, Chip, Collapsible, Drawer, Fab, Form, FormControl, FormField, FormLabel, FormMessage, Input, Loader, Modal, Note, Popover, PopoverClose, Progress, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, Select, Separator, Slider, SortableList, SortableListRow, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toast, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, buttonVariants, closeTopmost, defaultLabels, fabVariants, inputVariants, textareaVariants, toggleVariants, useBrucksLabels, useCloseOnBack, useModalCloseIcon };
33
+ export { Accordion, AccordionGroup, AlertDialog, AppIcon, BrucksProvider, Button, Checkbox, Chip, Collapsible, Drawer, Fab, Form, FormControl, FormField, FormLabel, FormMessage, Input, Modal, Note, Popover, PopoverClose, Progress, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, Select, Separator, Slider, SortableList, SortableListRow, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toast, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, buttonVariants, closeTopmost, defaultLabels, fabVariants, inputVariants, textareaVariants, toggleVariants, useBrucksLabels, useCloseOnBack, useModalCloseIcon };
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@mikebrucker/brucks",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Shared React UI components for bruck and grammatik",
5
+ "homepage": "https://github.com/mikebrucker/brucks",
5
6
  "license": "MIT",
6
7
  "type": "module",
7
8
  "sideEffects": [
@@ -1 +0,0 @@
1
- {"version":3,"file":"loader.js","names":[],"sources":["../../../src/ui/components/loader.tsx"],"sourcesContent":["import { cn } from \"~/style/utils\";\n\ntype LoaderProps = {\n isOpen: boolean;\n /** Tailwind text color utilities, e.g. \"text-cyan-400\" */\n className?: string;\n /** Center the loader over a full-page overlay */\n fullScreen?: boolean;\n /** With fullScreen, skip the dimmed backdrop so the page shows through */\n transparentBg?: boolean;\n /** What screen readers announce, in the page's language; English \"Loading\" if left out */\n label?: string;\n /** Makes the wrapper a keyboard-accessible button you can click */\n onClick?: () => void;\n};\n\nexport default function Loader({\n isOpen,\n className,\n fullScreen,\n transparentBg,\n label,\n onClick,\n}: LoaderProps) {\n if (!isOpen) return null;\n\n const backdropClassName = !transparentBg ? \"bg-black/50\" : null;\n const wrapperClassName = fullScreen\n ? cn(\"fixed inset-0 z-loader flex items-center justify-center\", backdropClassName)\n : undefined;\n\n const bars = <span className={`loader ${className ?? \"\"}`.trim()} />;\n\n // The fallback is English on any page, so it says so for the screen reader's voice.\n const status = (\n <span\n role=\"status\"\n aria-live=\"polite\"\n className=\"sr-only\"\n lang={label === undefined ? \"en\" : undefined}\n >\n {label ?? \"Loading\"}\n </span>\n );\n\n return onClick ? (\n <button type=\"button\" onClick={onClick} className={wrapperClassName}>\n {bars}\n {status}\n </button>\n ) : (\n <div className={wrapperClassName}>\n {bars}\n {status}\n </div>\n );\n}\n"],"mappings":";;;AAgBA,SAAwB,OAAO,EAC7B,QACA,WACA,YACA,eACA,OACA,WACc;CACd,IAAI,CAAC,QAAQ,OAAO;CAGpB,MAAM,mBAAmB,aACrB,GAAG,2DAFmB,CAAC,gBAAgB,gBAAgB,IAEwB,IAC/E,KAAA;CAEJ,MAAM,OAAO,oBAAC,QAAD,EAAM,WAAW,UAAU,aAAa,KAAK,KAAK,EAAI,CAAA;CAGnE,MAAM,SACJ,oBAAC,QAAD;EACE,MAAK;EACL,aAAU;EACV,WAAU;EACV,MAAM,UAAU,KAAA,IAAY,OAAO,KAAA;EAElC,UAAA,SAAS;CACN,CAAA;CAGR,OAAO,UACL,qBAAC,UAAD;EAAQ,MAAK;EAAkB;EAAS,WAAW;EAAnD,UAAA,CACG,MACA,MACK;CAER,CAAA,IAAA,qBAAC,OAAD;EAAK,WAAW;EAAhB,UAAA,CACG,MACA,MACE;;AAET"}