cursedbelt 6.20.0 → 6.23.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.
Files changed (131) hide show
  1. package/dist/react/VirtualCardGrid.d.ts +36 -1
  2. package/dist/react/VirtualCardGrid.d.ts.map +1 -1
  3. package/dist/react/VirtualCardGrid.js +62 -11
  4. package/dist/react/VirtualCardGrid.js.map +1 -1
  5. package/dist/react/components/DataTable/DataTable.d.ts +11 -2
  6. package/dist/react/components/DataTable/DataTable.d.ts.map +1 -1
  7. package/dist/react/components/DataTable/DataTable.js +17 -178
  8. package/dist/react/components/DataTable/DataTable.js.map +1 -1
  9. package/dist/react/components/DataTable/types.d.ts +3 -2
  10. package/dist/react/components/DataTable/types.d.ts.map +1 -1
  11. package/dist/react/components/DataTable/types.js.map +1 -1
  12. package/dist/react/components/DataTable/useServerWindowAsks.d.ts +48 -0
  13. package/dist/react/components/DataTable/useServerWindowAsks.d.ts.map +1 -0
  14. package/dist/react/components/DataTable/useServerWindowAsks.js +208 -0
  15. package/dist/react/components/DataTable/useServerWindowAsks.js.map +1 -0
  16. package/dist/react/components/FastScroller.d.ts +94 -0
  17. package/dist/react/components/FastScroller.d.ts.map +1 -0
  18. package/dist/react/components/FastScroller.js +74 -0
  19. package/dist/react/components/FastScroller.js.map +1 -0
  20. package/dist/react/components/FastScrollerImpl.d.ts +4 -0
  21. package/dist/react/components/FastScrollerImpl.d.ts.map +1 -0
  22. package/dist/react/components/FastScrollerImpl.js +235 -0
  23. package/dist/react/components/FastScrollerImpl.js.map +1 -0
  24. package/dist/react/components/fastScroll.d.ts +41 -0
  25. package/dist/react/components/fastScroll.d.ts.map +1 -0
  26. package/dist/react/components/fastScroll.js +72 -0
  27. package/dist/react/components/fastScroll.js.map +1 -0
  28. package/dist/react/index.d.ts +3 -1
  29. package/dist/react/index.d.ts.map +1 -1
  30. package/dist/react/index.js +2 -0
  31. package/dist/react/index.js.map +1 -1
  32. package/dist/react/media/DenseGalleryShell.d.ts +4 -1
  33. package/dist/react/media/DenseGalleryShell.d.ts.map +1 -1
  34. package/dist/react/media/DenseGalleryShell.js +2 -2
  35. package/dist/react/media/DenseGalleryShell.js.map +1 -1
  36. package/dist/react/media-gallery/GalleryTable.d.ts +4 -1
  37. package/dist/react/media-gallery/GalleryTable.d.ts.map +1 -1
  38. package/dist/react/media-gallery/GalleryTable.js +3 -2
  39. package/dist/react/media-gallery/GalleryTable.js.map +1 -1
  40. package/dist/react/media-gallery/MediaGallery.d.ts +10 -1
  41. package/dist/react/media-gallery/MediaGallery.d.ts.map +1 -1
  42. package/dist/react/media-gallery/MediaGallery.js +16 -4
  43. package/dist/react/media-gallery/MediaGallery.js.map +1 -1
  44. package/dist/react/media-gallery/mediaGalleryModel.d.ts +8 -0
  45. package/dist/react/media-gallery/mediaGalleryModel.d.ts.map +1 -1
  46. package/dist/react/media-gallery/mediaGalleryModel.js +19 -0
  47. package/dist/react/media-gallery/mediaGalleryModel.js.map +1 -1
  48. package/dist/react/useWindowedList.d.ts +82 -0
  49. package/dist/react/useWindowedList.d.ts.map +1 -0
  50. package/dist/react/useWindowedList.js +167 -0
  51. package/dist/react/useWindowedList.js.map +1 -0
  52. package/dist/styles-areas/analytics.css +7 -7
  53. package/dist/styles-areas/auth.css +2 -3
  54. package/dist/styles-areas/calendar.css +2 -2
  55. package/dist/styles-areas/canvas-hud.css +5 -5
  56. package/dist/styles-areas/charts.css +3 -3
  57. package/dist/styles-areas/chat.css +3 -3
  58. package/dist/styles-areas/core.css +50 -48
  59. package/dist/styles-areas/data-table.css +7 -7
  60. package/dist/styles-areas/disk-usage.css +5 -5
  61. package/dist/styles-areas/fields.css +6 -6
  62. package/dist/styles-areas/file-tree.css +2 -2
  63. package/dist/styles-areas/filter-rail.css +3 -3
  64. package/dist/styles-areas/folder-tree.css +2 -2
  65. package/dist/styles-areas/layout-engine.css +2 -2
  66. package/dist/styles-areas/media-gallery.css +7 -7
  67. package/dist/styles-areas/media.css +13 -13
  68. package/dist/styles-areas/nav.css +7 -7
  69. package/dist/styles-areas/notifications.css +2 -2
  70. package/dist/styles-areas/palette.css +5 -6
  71. package/dist/styles-areas/sharing.css +3 -3
  72. package/dist/styles-areas/spreadsheet.css +1 -2
  73. package/dist/styles-areas/stats.css +13 -14
  74. package/dist/styles-areas/virtual.css +2 -2
  75. package/dist/styles-areas/wizard.css +2 -2
  76. package/dist/styles-areas/workbench.css +2 -2
  77. package/dist/styles-areas/workbook-viewer.css +2 -2
  78. package/dist/styles-areas/workspace-shell.css +2 -2
  79. package/dist/styles-utilities.css +10 -0
  80. package/dist/testing/shell.d.ts +2 -0
  81. package/dist/testing/shell.d.ts.map +1 -1
  82. package/dist/testing/shell.js +3 -0
  83. package/dist/testing/shell.js.map +1 -1
  84. package/package.json +1 -1
  85. package/scripts/styleAreas.ts +5 -0
  86. package/src/react/VirtualCardGrid.tsx +129 -7
  87. package/src/react/components/DataTable/DataTable.tsx +26 -168
  88. package/src/react/components/DataTable/types.ts +3 -2
  89. package/src/react/components/DataTable/useServerWindowAsks.ts +242 -0
  90. package/src/react/components/FastScroller.spec.tsx +253 -0
  91. package/src/react/components/FastScroller.tsx +164 -0
  92. package/src/react/components/FastScrollerImpl.tsx +316 -0
  93. package/src/react/components/fastScroll.spec.ts +82 -0
  94. package/src/react/components/fastScroll.ts +85 -0
  95. package/src/react/index.ts +9 -1
  96. package/src/react/media/DenseGalleryShell.tsx +5 -0
  97. package/src/react/media-gallery/GalleryTable.tsx +6 -0
  98. package/src/react/media-gallery/MediaGallery.tsx +24 -0
  99. package/src/react/media-gallery/mediaGalleryModel.spec.ts +26 -0
  100. package/src/react/media-gallery/mediaGalleryModel.ts +18 -0
  101. package/src/react/useWindowedList.spec.ts +76 -0
  102. package/src/react/useWindowedList.ts +251 -0
  103. package/src/styles-areas/analytics.css +7 -7
  104. package/src/styles-areas/auth.css +2 -3
  105. package/src/styles-areas/calendar.css +2 -2
  106. package/src/styles-areas/canvas-hud.css +5 -5
  107. package/src/styles-areas/charts.css +3 -3
  108. package/src/styles-areas/chat.css +3 -3
  109. package/src/styles-areas/core.css +50 -48
  110. package/src/styles-areas/data-table.css +7 -7
  111. package/src/styles-areas/disk-usage.css +5 -5
  112. package/src/styles-areas/fields.css +6 -6
  113. package/src/styles-areas/file-tree.css +2 -2
  114. package/src/styles-areas/filter-rail.css +3 -3
  115. package/src/styles-areas/folder-tree.css +2 -2
  116. package/src/styles-areas/layout-engine.css +2 -2
  117. package/src/styles-areas/media-gallery.css +7 -7
  118. package/src/styles-areas/media.css +13 -13
  119. package/src/styles-areas/nav.css +7 -7
  120. package/src/styles-areas/notifications.css +2 -2
  121. package/src/styles-areas/palette.css +5 -6
  122. package/src/styles-areas/sharing.css +3 -3
  123. package/src/styles-areas/spreadsheet.css +1 -2
  124. package/src/styles-areas/stats.css +13 -14
  125. package/src/styles-areas/virtual.css +2 -2
  126. package/src/styles-areas/wizard.css +2 -2
  127. package/src/styles-areas/workbench.css +2 -2
  128. package/src/styles-areas/workbook-viewer.css +2 -2
  129. package/src/styles-areas/workspace-shell.css +2 -2
  130. package/src/styles-utilities.css +10 -0
  131. package/src/testing/shell.ts +3 -0
@@ -0,0 +1,94 @@
1
+ import { type ComponentType, type HTMLAttributes, type ReactNode } from 'react';
2
+ import type { FastScrollStop } from './fastScroll.js';
3
+ export type { FastScrollStop } from './fastScroll.js';
4
+ /** Attributes it does not name (a `data-testid`, an `aria-*`) land on the overlay that holds the thumb. */
5
+ export interface FastScrollerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'style'> {
6
+ /**
7
+ * The scroller the thumb drives: an element, or `'window'` for the page. Omitted, it is the nearest
8
+ * `ScrollArea` (or `DataTable` body) the scroller is rendered inside, else the page — so dropping
9
+ * `<FastScroller />` anywhere in a long place is enough.
10
+ */
11
+ root?: HTMLElement | 'window' | null;
12
+ /**
13
+ * PROPORTIONAL mode (no `stops`): what the bubble says while the finger drags, given how far down the
14
+ * list it is (0–1). A list knows what sits there: `(f) => items[Math.round(f * (items.length - 1))]?.title[0]`.
15
+ * Return null for no bubble.
16
+ */
17
+ bubble?: (fraction: number) => ReactNode;
18
+ /**
19
+ * STOPS mode: the track is these sections, top first, each as tall as its `weight`'s share — for a list
20
+ * whose far end is not loaded (a timeline paged by date), so the bottom is the true end whether or not it
21
+ * exists yet. The component does not scroll; `onScrub` and `onPick` do.
22
+ */
23
+ stops?: readonly FastScrollStop[];
24
+ /** STOPS mode: the stop on screen now, where the thumb rests. */
25
+ current?: string | null;
26
+ /** STOPS mode: the finger is over this stop (fires once per stop crossed). */
27
+ onScrub?: (key: string) => void;
28
+ /** STOPS mode: the finger let go over this stop, or Home/End chose the first or last. */
29
+ onPick?: (key: string) => void;
30
+ /** A tap on the thumb — a jump sheet, a letter index. Absent, a tap only shows the thumb. */
31
+ onOpen?: () => void;
32
+ /** The thumb's accessible name. */
33
+ label?: string;
34
+ /** Its hover hint. */
35
+ tooltip?: string;
36
+ /**
37
+ * Who gets it. `coarse` (default) — a finger: on a phone or tablet a scrollbar is a 3px sliver that cannot be
38
+ * grabbed, which is the whole reason this exists; a mouse has the browser's own. `always` — every pointer,
39
+ * for a caller that decides itself.
40
+ */
41
+ show?: 'coarse' | 'always';
42
+ /** PROPORTIONAL mode: how many screens long a list must be before the thumb appears. Default 4. */
43
+ minScreens?: number;
44
+ /** Clearance at the top of the scroller — a sticky header the thumb must not ride under. Default 56. */
45
+ insetTop?: number;
46
+ /** Clearance at the bottom — a player bar, a home indicator. Default 24. */
47
+ insetBottom?: number;
48
+ className?: string;
49
+ }
50
+ type FastScrollerImplComponent = ComponentType<FastScrollerProps>;
51
+ /** Fetch the thumb once per page. Exported for the specs, which want it there before they render. */
52
+ export declare function preloadFastScroller(): Promise<FastScrollerImplComponent>;
53
+ /**
54
+ * A FAST SCROLLER — the thumb on the right edge that phones put on every long list (Google Photos,
55
+ * Apple's Contacts, Android's contact list). It fades in while the list scrolls and out after; a drag runs it the
56
+ * whole length of the list in one stroke with a bubble saying where the finger is (a letter, a month); a tap does
57
+ * what the caller asks (`onOpen` — a jump sheet). The owner, 2026-11-21: *"These are all hard to scroll through the
58
+ * long lists on, for iphone especially"* — a 3,000-row list is a hundred flicks on a phone, and a phone's scrollbar
59
+ * cannot be grabbed.
60
+ *
61
+ * Two modes ({@link FastScrollerProps.stops}): PROPORTIONAL, where the thumb IS the scroll position and a drag
62
+ * sets `scrollTop` (any list with its full height — every virtualized list here has one); and STOPS, where the
63
+ * track is weighted sections and the app scrolls (photos' timeline, whose oldest page is not loaded).
64
+ *
65
+ * Keyboard: the thumb is a button — Home and End go to either end, Page Up and Down move a tenth, Enter and Space
66
+ * are the tap. Fixed-positioned over the scroller's box, so it never takes a column from the list it serves.
67
+ *
68
+ * ── Why this file is a wrapper and not the thumb ────────────────────────────
69
+ * 🔴 Every DataTable, VirtualCardGrid and MediaGallery can draw one, so a static import put the thumb (~2.4 KB gzip
70
+ * with its pill and arithmetic) in the chunk of every list page — family's AlbumsView +2.40 kB, music's DataTable
71
+ * +2.07 kB (forge task 5691) — for a desk whose mouse never sees it. The thumb is `FastScrollerImpl.tsx`, a dynamic
72
+ * `import()` asked for only once it is wanted: a finger (`show='coarse'`, the default) or `show='always'`. On a phone
73
+ * it is fetched as this module is evaluated, so it is there long before the first scroll can show it.
74
+ */
75
+ export declare function FastScroller(props: FastScrollerProps): import("react").JSX.Element | null;
76
+ /**
77
+ * A list primitive's `fastScroll` prop ({@link DataTable}, {@link VirtualCardGrid}): `true` for the thumb alone, or
78
+ * these to name where the finger is. `bubble(index)` gets the item number over the WHOLE list — a server window's
79
+ * total, not the loaded rows — so `(i) => titles[i]?.[0]` says the letter.
80
+ */
81
+ export interface FastScrollOptions {
82
+ /** What the bubble says over item `index`; null for none. */
83
+ bubble?: (index: number) => ReactNode;
84
+ /** A tap on the thumb — a letter index, a jump sheet. */
85
+ onOpen?: () => void;
86
+ /** The thumb's accessible name. */
87
+ label?: string;
88
+ /** Clearance under a sticky header, over a player bar. */
89
+ insetTop?: number;
90
+ insetBottom?: number;
91
+ }
92
+ /** The {@link FastScroller} a list primitive draws for its `fastScroll` prop over `count` items; null when off. */
93
+ export declare function listFastScroller(fastScroll: boolean | FastScrollOptions | undefined, count: number, root?: HTMLElement | 'window' | null): ReactNode;
94
+ //# sourceMappingURL=FastScroller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FastScroller.d.ts","sourceRoot":"","sources":["../../../src/react/components/FastScroller.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAC;AAGrG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,2GAA2G;AAC3G,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IACnG;;;;OAIG;IACH,IAAI,CAAC,EAAE,WAAW,GAAG,QAAQ,GAAG,IAAI,CAAC;IACrC;;;;OAIG;IACH,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,SAAS,CAAC;IACzC;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IAClC,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,yFAAyF;IACzF,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,6FAA6F;IAC7F,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC3B,mGAAmG;IACnG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wGAAwG;IACxG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,KAAK,yBAAyB,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAAC;AAKlE,qGAAqG;AACrG,wBAAgB,mBAAmB,IAAI,OAAO,CAAC,yBAAyB,CAAC,CAcxE;AAMD;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,sCAsBpD;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,6DAA6D;IAC7D,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC;IACtC,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,mHAAmH;AACnH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,OAAO,GAAG,iBAAiB,GAAG,SAAS,EACnD,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,WAAW,GAAG,QAAQ,GAAG,IAAI,GACnC,SAAS,CAcX"}
@@ -0,0 +1,74 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { useMediaQuery } from '../hooks/useMediaQuery.js';
4
+ import { warmChunk } from '../lazy/staleChunk.js';
5
+ let loadedImpl = null;
6
+ let pendingImpl = null;
7
+ /** Fetch the thumb once per page. Exported for the specs, which want it there before they render. */
8
+ export function preloadFastScroller() {
9
+ if (!pendingImpl) {
10
+ pendingImpl = import('./FastScrollerImpl.js').then((m) => {
11
+ loadedImpl = m.default;
12
+ return m.default;
13
+ }, (error) => {
14
+ pendingImpl = null; // a failed fetch may be asked again, not remembered forever
15
+ throw error;
16
+ });
17
+ }
18
+ return pendingImpl;
19
+ }
20
+ // A finger is who the thumb is for: fetch it as this module is evaluated, long before a list can scroll. A mouse
21
+ // fetches nothing unless a caller says `show='always'`.
22
+ if (typeof window !== 'undefined' && window.matchMedia?.('(pointer: coarse)').matches)
23
+ void warmChunk(preloadFastScroller);
24
+ /**
25
+ * A FAST SCROLLER — the thumb on the right edge that phones put on every long list (Google Photos,
26
+ * Apple's Contacts, Android's contact list). It fades in while the list scrolls and out after; a drag runs it the
27
+ * whole length of the list in one stroke with a bubble saying where the finger is (a letter, a month); a tap does
28
+ * what the caller asks (`onOpen` — a jump sheet). The owner, 2026-11-21: *"These are all hard to scroll through the
29
+ * long lists on, for iphone especially"* — a 3,000-row list is a hundred flicks on a phone, and a phone's scrollbar
30
+ * cannot be grabbed.
31
+ *
32
+ * Two modes ({@link FastScrollerProps.stops}): PROPORTIONAL, where the thumb IS the scroll position and a drag
33
+ * sets `scrollTop` (any list with its full height — every virtualized list here has one); and STOPS, where the
34
+ * track is weighted sections and the app scrolls (photos' timeline, whose oldest page is not loaded).
35
+ *
36
+ * Keyboard: the thumb is a button — Home and End go to either end, Page Up and Down move a tenth, Enter and Space
37
+ * are the tap. Fixed-positioned over the scroller's box, so it never takes a column from the list it serves.
38
+ *
39
+ * ── Why this file is a wrapper and not the thumb ────────────────────────────
40
+ * 🔴 Every DataTable, VirtualCardGrid and MediaGallery can draw one, so a static import put the thumb (~2.4 KB gzip
41
+ * with its pill and arithmetic) in the chunk of every list page — family's AlbumsView +2.40 kB, music's DataTable
42
+ * +2.07 kB (forge task 5691) — for a desk whose mouse never sees it. The thumb is `FastScrollerImpl.tsx`, a dynamic
43
+ * `import()` asked for only once it is wanted: a finger (`show='coarse'`, the default) or `show='always'`. On a phone
44
+ * it is fetched as this module is evaluated, so it is there long before the first scroll can show it.
45
+ */
46
+ export function FastScroller(props) {
47
+ const coarse = useMediaQuery('(pointer: coarse)');
48
+ const wanted = props.show === 'always' || coarse;
49
+ // `() => loadedImpl`: a component IS a function, and `useState(fn)` would call it.
50
+ const [Impl, setImpl] = useState(() => loadedImpl);
51
+ useEffect(() => {
52
+ if (Impl || !wanted)
53
+ return;
54
+ let alive = true;
55
+ void preloadFastScroller().then((c) => {
56
+ if (alive)
57
+ setImpl(() => c);
58
+ }, () => undefined);
59
+ return () => {
60
+ alive = false;
61
+ };
62
+ }, [Impl, wanted]);
63
+ // Nothing to hold the place: the thumb is fixed-positioned and hidden at rest, so its arrival moves nothing.
64
+ return Impl && wanted ? _jsx(Impl, { ...props }) : null;
65
+ }
66
+ /** The {@link FastScroller} a list primitive draws for its `fastScroll` prop over `count` items; null when off. */
67
+ export function listFastScroller(fastScroll, count, root) {
68
+ if (!fastScroll)
69
+ return null;
70
+ const o = fastScroll === true ? {} : fastScroll;
71
+ const bubble = o.bubble;
72
+ return (_jsx(FastScroller, { root: root, label: o.label, onOpen: o.onOpen, insetTop: o.insetTop, insetBottom: o.insetBottom, bubble: bubble ? (fraction) => bubble(Math.round(fraction * Math.max(0, count - 1))) : undefined }));
73
+ }
74
+ //# sourceMappingURL=FastScroller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FastScroller.js","sourceRoot":"","sources":["../../../src/react/components/FastScroller.tsx"],"names":[],"mappings":";AAAA,OAAO,EAA2D,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrG,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAsDlD,IAAI,UAAU,GAAqC,IAAI,CAAC;AACxD,IAAI,WAAW,GAA8C,IAAI,CAAC;AAElE,qGAAqG;AACrG,MAAM,UAAU,mBAAmB;IACj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B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAEnB,6GAA6G;IAC7G,OAAO,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,KAAC,IAAI,OAAK,KAAK,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACrD,CAAC;AAmBD,mHAAmH;AACnH,MAAM,UAAU,gBAAgB,CAC9B,UAAmD,EACnD,KAAa,EACb,IAAoC;IAEpC,IAAI,CAAC,UAAU;QAAE,OAAO,IAAI,CAAC;IAC7B,MAAM,CAAC,GAAsB,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;IACnE,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IACxB,OAAO,CACL,KAAC,YAAY,IACX,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,CAAC,CAAC,KAAK,EACd,MAAM,EAAE,CAAC,CAAC,MAAM,EAChB,QAAQ,EAAE,CAAC,CAAC,QAAQ,EACpB,WAAW,EAAE,CAAC,CAAC,WAAW,EAC1B,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,GAChG,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { FastScrollerProps } from './FastScroller.js';
2
+ /** The fast scroller itself — `FastScroller.tsx` is the wrapper every page imports, and says why it is split. */
3
+ export default function FastScrollerImpl({ root: rootProp, bubble, stops: stopsProp, current, onScrub, onPick, onOpen, label, tooltip, show: _show, minScreens, insetTop, insetBottom, className, ...rest }: FastScrollerProps): import("react").JSX.Element | null;
4
+ //# sourceMappingURL=FastScrollerImpl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FastScrollerImpl.d.ts","sourceRoot":"","sources":["../../../src/react/components/FastScrollerImpl.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AA6C3D,iHAAiH;AACjH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,IAAI,EAAE,QAAQ,EACd,MAAM,EACN,KAAK,EAAE,SAAS,EAChB,OAAO,EACP,OAAO,EACP,MAAM,EACN,MAAM,EACN,KAA2D,EAC3D,OAA+C,EAG/C,IAAI,EAAE,KAAK,EACX,UAAc,EACd,QAAa,EACb,WAAgB,EAChB,SAAS,EACT,GAAG,IAAI,EACR,EAAE,iBAAiB,sCA+NnB"}
@@ -0,0 +1,235 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /**
3
+ * The fast scroller's implementation, loaded by `FastScroller.tsx` only once a thumb is wanted (a finger, or
4
+ * `show='always'`) — the props, the docs and the reasons are there.
5
+ */
6
+ import { ChevronsUpDown } from 'lucide-react';
7
+ import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, } from 'react';
8
+ import { cn } from '../lib/cn.js';
9
+ import { clamp01, fractionAtY, fractionOfStop, longEnough, placeStops, scrollFraction, scrollTopAt, stopAt, } from './fastScroll.js';
10
+ import { HudPill } from './HudPill.js';
11
+ import { IconButton } from './IconButton.js';
12
+ /** How long the thumb stays after the list stops scrolling. */
13
+ const SHOWN_MS = 1800;
14
+ /** A press that moves less than this is a tap. */
15
+ const TAP_PX = 6;
16
+ /** The thumb's height — `h-12` on the button. */
17
+ const THUMB = 48;
18
+ /** What the keyboard's Page keys move, as a share of the track. */
19
+ const PAGE_STEP = 0.1;
20
+ /** The scrollers this component finds by itself: the design system's own — `ScrollArea`, a table body, a card grid. */
21
+ const SCROLLER = '[data-cb-scrollarea], [data-cb-table-scroll], [data-cb-grid-scroll], [data-cb-fast-scroll-root]';
22
+ /** A box with more to show than it holds, top to bottom — a horizontal strip around the list is not its scroller. */
23
+ function scrollsVertically(el) {
24
+ return el.scrollHeight > el.clientHeight + 1;
25
+ }
26
+ function metricsOf(root) {
27
+ if (root === 'window') {
28
+ const doc = document.scrollingElement ?? document.documentElement;
29
+ return { top: window.scrollY, height: doc.scrollHeight, client: window.innerHeight };
30
+ }
31
+ return { top: root.scrollTop, height: root.scrollHeight, client: root.clientHeight };
32
+ }
33
+ function scrollRootTo(root, top) {
34
+ if (root === 'window')
35
+ window.scrollTo({ top, behavior: 'auto' });
36
+ else
37
+ root.scrollTop = top;
38
+ }
39
+ /** The fast scroller itself — `FastScroller.tsx` is the wrapper every page imports, and says why it is split. */
40
+ export default function FastScrollerImpl({ root: rootProp, bubble, stops: stopsProp, current, onScrub, onPick, onOpen, label = 'Scroll fast — drag to move through the whole list', tooltip = 'Drag to move through the whole list',
41
+ // `show` is the wrapper's to decide (`FastScroller.tsx`, which fetches this module only once a thumb is wanted);
42
+ // named here so it never lands on the overlay as an attribute.
43
+ show: _show, minScreens = 4, insetTop = 56, insetBottom = 24, className, ...rest }) {
44
+ const anchor = useRef(null);
45
+ const [found, setFound] = useState(null);
46
+ const root = rootProp === undefined ? found : rootProp;
47
+ // The nearest design-system scroller above the anchor — once, on mount: a scroller does not move under a list.
48
+ useLayoutEffect(() => {
49
+ if (rootProp !== undefined)
50
+ return;
51
+ setFound(anchor.current?.parentElement?.closest(SCROLLER) ?? 'window');
52
+ }, [rootProp]);
53
+ const corrected = useRef(false);
54
+ // 🔴 That guess can be a box that never scrolls: a `self` grid inside a shell that bounds no height grows to its
55
+ // content, and the place above it scrolls instead — family's albums on a phone, 2026-11-21, where the thumb watched a
56
+ // 5,236px box that never moved and so never showed. So a guess that cannot scroll is corrected by the first scroll
57
+ // AROUND the anchor: an ancestor that scrolls vertically, or the page. A guess that does scroll is never moved —
58
+ // the page included, so a guess of the page that cannot scroll is corrected the same way.
59
+ useEffect(() => {
60
+ if (rootProp !== undefined)
61
+ return;
62
+ const onScroll = (event) => {
63
+ const here = anchor.current;
64
+ const target = event.target;
65
+ if (!here)
66
+ return;
67
+ const next = target === document || target === document.documentElement || target === document.body
68
+ ? 'window'
69
+ : target instanceof HTMLElement && target.contains(here) && scrollsVertically(target)
70
+ ? target
71
+ : null;
72
+ if (!next)
73
+ return;
74
+ setFound((current) => {
75
+ const page = document.scrollingElement;
76
+ const stuck = current === 'window' ? !(page instanceof HTMLElement && scrollsVertically(page)) : current && !scrollsVertically(current);
77
+ if (!stuck || next === current)
78
+ return current;
79
+ corrected.current = true; // the scroll that found the root shows the thumb too, not only the next one
80
+ return next;
81
+ });
82
+ };
83
+ document.addEventListener('scroll', onScroll, { capture: true, passive: true });
84
+ return () => document.removeEventListener('scroll', onScroll, { capture: true });
85
+ }, [rootProp]);
86
+ const stops = useMemo(() => (stopsProp ? placeStops(stopsProp) : null), [stopsProp]);
87
+ const [shown, setShown] = useState(false);
88
+ const [box, setBox] = useState(null);
89
+ const [metrics, setMetrics] = useState(null);
90
+ const [drag, setDrag] = useState(null);
91
+ const press = useRef(null);
92
+ /** The click a finished drag leaves behind — not a tap. */
93
+ const dragged = useRef(false);
94
+ const dragging = drag !== null;
95
+ // The track follows the scroller's box: a rotation, the keyboard, a banner above it.
96
+ useLayoutEffect(() => {
97
+ if (!root)
98
+ return;
99
+ const measure = () => {
100
+ if (root === 'window') {
101
+ setBox({ top: insetTop, height: Math.max(0, window.innerHeight - insetTop - insetBottom - THUMB), right: 0 });
102
+ }
103
+ else {
104
+ const r = root.getBoundingClientRect();
105
+ setBox({
106
+ top: r.top + insetTop,
107
+ height: Math.max(0, r.height - insetTop - insetBottom - THUMB),
108
+ right: Math.max(0, window.innerWidth - r.right),
109
+ });
110
+ }
111
+ setMetrics(metricsOf(root));
112
+ };
113
+ measure();
114
+ const observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(measure);
115
+ if (root !== 'window')
116
+ observer?.observe(root);
117
+ window.addEventListener('resize', measure);
118
+ return () => {
119
+ observer?.disconnect();
120
+ window.removeEventListener('resize', measure);
121
+ };
122
+ }, [root, insetTop, insetBottom]);
123
+ // Scrolling shows it; stillness hides it. One measurement per frame, however fast the list moves.
124
+ useEffect(() => {
125
+ if (!root)
126
+ return;
127
+ const target = root === 'window' ? window : root;
128
+ let timer;
129
+ let frame = 0;
130
+ const onScroll = () => {
131
+ if (!frame) {
132
+ frame = requestAnimationFrame(() => {
133
+ frame = 0;
134
+ setMetrics(metricsOf(root));
135
+ });
136
+ }
137
+ setShown(true);
138
+ clearTimeout(timer);
139
+ if (!press.current)
140
+ timer = setTimeout(() => setShown(false), SHOWN_MS);
141
+ };
142
+ target.addEventListener('scroll', onScroll, { passive: true });
143
+ if (corrected.current) {
144
+ corrected.current = false;
145
+ onScroll();
146
+ }
147
+ return () => {
148
+ clearTimeout(timer);
149
+ if (frame)
150
+ cancelAnimationFrame(frame);
151
+ target.removeEventListener('scroll', onScroll);
152
+ };
153
+ }, [root]);
154
+ /** Go to a fraction of the track: a stop in STOPS mode (the app scrolls), `scrollTop` in PROPORTIONAL. */
155
+ const goTo = useCallback((fraction, final) => {
156
+ if (!root)
157
+ return null;
158
+ if (stops) {
159
+ const stop = stopAt(stops, fraction);
160
+ if (stop && final)
161
+ onPick?.(stop.key);
162
+ return stop?.key ?? null;
163
+ }
164
+ const m = metricsOf(root);
165
+ scrollRootTo(root, scrollTopAt(fraction, m.height, m.client));
166
+ return null;
167
+ }, [root, stops, onPick]);
168
+ const enoughStops = stops ? stops.length >= 2 : true;
169
+ const enoughList = stops ? true : metrics ? longEnough(metrics.height, metrics.client, minScreens) : false;
170
+ const ready = root && box && box.height > 0 && enoughStops && enoughList;
171
+ const anchorSpan = rootProp === undefined ? _jsx("span", { ref: anchor, hidden: true, "data-cb-fast-scroll-anchor": '' }) : null;
172
+ if (!ready || !box)
173
+ return anchorSpan;
174
+ const resting = stops ? fractionOfStop(stops, current) : metrics ? scrollFraction(metrics.top, metrics.height, metrics.client) : 0;
175
+ const fraction = drag ? drag.fraction : resting;
176
+ const visible = shown || dragging;
177
+ const at = (clientY) => fractionAtY(clientY, box.top, box.height, THUMB);
178
+ const onPointerDown = (event) => {
179
+ event.currentTarget.setPointerCapture?.(event.pointerId);
180
+ press.current = { y: event.clientY, moved: false, id: event.pointerId };
181
+ };
182
+ const onPointerMove = (event) => {
183
+ const p = press.current;
184
+ if (!p || p.id !== event.pointerId)
185
+ return;
186
+ if (!p.moved && Math.abs(event.clientY - p.y) < TAP_PX)
187
+ return;
188
+ p.moved = true;
189
+ const f = at(event.clientY);
190
+ const key = goTo(f, false);
191
+ if (stops && key && key !== drag?.key)
192
+ onScrub?.(key);
193
+ setDrag({ fraction: f, key });
194
+ };
195
+ const onPointerUp = (event) => {
196
+ const p = press.current;
197
+ press.current = null;
198
+ if (!p || p.id !== event.pointerId)
199
+ return;
200
+ // A tap is `onClick`, never here: opened on pointerup, the tap's own click lands on whatever opened a moment
201
+ // later (a sheet's overlay) and shuts it again. `onClick` is also Enter and Space.
202
+ if (!p.moved) {
203
+ setDrag(null);
204
+ return;
205
+ }
206
+ dragged.current = true;
207
+ goTo(at(event.clientY), true);
208
+ setDrag(null);
209
+ setShown(true);
210
+ };
211
+ const onPointerCancel = () => {
212
+ press.current = null;
213
+ setDrag(null);
214
+ };
215
+ const onKeyDown = (event) => {
216
+ const step = { Home: -Infinity, End: Infinity, PageUp: -PAGE_STEP, PageDown: PAGE_STEP };
217
+ const by = step[event.key];
218
+ if (by === undefined)
219
+ return;
220
+ event.preventDefault();
221
+ goTo(clamp01(resting + by), true);
222
+ setShown(true);
223
+ };
224
+ const said = drag ? (stops ? (stops.find((s) => s.key === drag.key)?.label ?? null) : (bubble?.(drag.fraction) ?? null)) : null;
225
+ const top = box.top + fraction * box.height;
226
+ return (_jsxs(_Fragment, { children: [anchorSpan, _jsx("div", { ...rest, className: cn('pointer-events-none fixed z-[var(--z-sticky,100)] h-12', className), style: { top, right: box.right }, "data-cb-fast-scroller": '', "data-shown": visible ? '' : undefined, "data-dragging": dragging ? '' : undefined, children: _jsxs("div", { className: cn('flex h-full items-center gap-2 transition-opacity duration-200', visible ? 'opacity-100' : 'opacity-0'), children: [said !== null && said !== undefined && said !== '' ? (_jsx(HudPill, { className: 'min-h-9 px-3 text-sm font-semibold tabular-nums', "data-cb-fast-scroll-bubble": drag?.key ?? '', children: said })) : null, _jsx(IconButton, { label: label, tooltip: tooltip, variant: 'secondary', className: cn(
227
+ // h-full: the overlay's h-12 is the thumb's height, the `THUMB` the track arithmetic subtracts.
228
+ 'h-full w-11 touch-none select-none rounded-none rounded-l-full border border-r-0 border-border/60 bg-background/92 text-muted-foreground shadow-raised backdrop-blur-md', visible ? 'pointer-events-auto' : 'pointer-events-none', dragging && 'text-foreground'), onPointerDown: onPointerDown, onPointerMove: onPointerMove, onPointerUp: onPointerUp, onPointerCancel: onPointerCancel, onKeyDown: onKeyDown, onFocus: () => setShown(true), onClick: () => {
229
+ if (dragged.current)
230
+ dragged.current = false;
231
+ else
232
+ onOpen?.();
233
+ }, children: _jsx(ChevronsUpDown, { "aria-hidden": 'true' }) })] }) })] }));
234
+ }
235
+ //# sourceMappingURL=FastScrollerImpl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FastScrollerImpl.js","sourceRoot":"","sources":["../../../src/react/components/FastScrollerImpl.tsx"],"names":[],"mappings":";AAAA;;;GAGG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAGL,WAAW,EACX,SAAS,EACT,eAAe,EACf,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EACL,OAAO,EACP,WAAW,EACX,cAAc,EACd,UAAU,EACV,UAAU,EACV,cAAc,EACd,WAAW,EACX,MAAM,GACP,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,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c,mBAAa,MAAM,GAAG,GAC1B,IACT,GACF,IACL,CACJ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * The fast scroller's arithmetic ({@link FastScroller}), pure so `fastScroll.spec.ts` holds it without a DOM.
3
+ *
4
+ * Two ways a track can map to a list:
5
+ * - PROPORTIONAL — the thumb IS the scroll position: 40% down the track is 40% of `scrollHeight`.
6
+ * Right for any list whose full height exists (a virtualized list's spacer, a server window's).
7
+ * - STOPS — the track is a set of weighted sections, top first, each as tall as its share. Right for
8
+ * a list whose far end is not loaded (photos' timeline pages by date): the bottom of the track is
9
+ * the oldest month whether or not its page exists, and the app scrolls there itself.
10
+ */
11
+ /** A section of a stops track: `weight` is its share of the height (a month's photo count, a letter's titles). */
12
+ export interface FastScrollStop {
13
+ key: string;
14
+ /** What the bubble says while the finger is over it. */
15
+ label: string;
16
+ weight: number;
17
+ }
18
+ /** A stop placed on the track: `from` is its top as a fraction of the track, `to` its bottom. */
19
+ export interface PlacedStop extends FastScrollStop {
20
+ from: number;
21
+ to: number;
22
+ }
23
+ /** Stops placed top to bottom in the order given, each as tall as its weight's share; the last ends at exactly 1. */
24
+ export declare function placeStops(stops: readonly FastScrollStop[]): PlacedStop[];
25
+ /** The stop at a fraction of the track, clamped to the first and the last. */
26
+ export declare function stopAt(stops: readonly PlacedStop[], fraction: number): PlacedStop | null;
27
+ /** Where a stop sits on the track — its top; 0 for a key that is not one (nothing on screen yet is the top). */
28
+ export declare function fractionOfStop(stops: readonly PlacedStop[], key: string | null | undefined): number;
29
+ /** How far down a scroller is, 0–1; 0 when it cannot scroll. */
30
+ export declare function scrollFraction(scrollTop: number, scrollHeight: number, clientHeight: number): number;
31
+ /** The `scrollTop` that puts a scroller at a fraction of its travel. */
32
+ export declare function scrollTopAt(fraction: number, scrollHeight: number, clientHeight: number): number;
33
+ /**
34
+ * Whether a list is long enough to earn a fast scroller: at least `screens` screens of content. Under that a
35
+ * flick reaches either end, and a thumb would be chrome for nothing.
36
+ */
37
+ export declare function longEnough(scrollHeight: number, clientHeight: number, screens: number): boolean;
38
+ /** The fraction under a pointer on a track that starts at `top` and runs `height` px, the thumb centered on it. */
39
+ export declare function fractionAtY(clientY: number, top: number, height: number, thumb: number): number;
40
+ export declare function clamp01(n: number): number;
41
+ //# sourceMappingURL=fastScroll.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fastScroll.d.ts","sourceRoot":"","sources":["../../../src/react/components/fastScroll.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,kHAAkH;AAClH,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,iGAAiG;AACjG,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,qHAAqH;AACrH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,cAAc,EAAE,GAAG,UAAU,EAAE,CAczE;AAED,8EAA8E;AAC9E,wBAAgB,MAAM,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAIxF;AAED,gHAAgH;AAChH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAGnG;AAED,gEAAgE;AAChE,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAIpG;AAED,wEAAwE;AACxE,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAEhG;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAE/F;AAED,mHAAmH;AACnH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAG/F;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAGzC"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * The fast scroller's arithmetic ({@link FastScroller}), pure so `fastScroll.spec.ts` holds it without a DOM.
3
+ *
4
+ * Two ways a track can map to a list:
5
+ * - PROPORTIONAL — the thumb IS the scroll position: 40% down the track is 40% of `scrollHeight`.
6
+ * Right for any list whose full height exists (a virtualized list's spacer, a server window's).
7
+ * - STOPS — the track is a set of weighted sections, top first, each as tall as its share. Right for
8
+ * a list whose far end is not loaded (photos' timeline pages by date): the bottom of the track is
9
+ * the oldest month whether or not its page exists, and the app scrolls there itself.
10
+ */
11
+ /** Stops placed top to bottom in the order given, each as tall as its weight's share; the last ends at exactly 1. */
12
+ export function placeStops(stops) {
13
+ const known = stops.filter((s) => Number.isFinite(s.weight) && s.weight > 0);
14
+ const total = known.reduce((n, s) => n + s.weight, 0);
15
+ if (!total)
16
+ return [];
17
+ const placed = [];
18
+ let at = 0;
19
+ for (const stop of known) {
20
+ const next = at + stop.weight / total;
21
+ placed.push({ ...stop, from: at, to: next });
22
+ at = next;
23
+ }
24
+ const last = placed[placed.length - 1];
25
+ if (last)
26
+ last.to = 1;
27
+ return placed;
28
+ }
29
+ /** The stop at a fraction of the track, clamped to the first and the last. */
30
+ export function stopAt(stops, fraction) {
31
+ if (!stops.length)
32
+ return null;
33
+ for (const stop of stops)
34
+ if (fraction < stop.to)
35
+ return stop;
36
+ return stops[stops.length - 1] ?? null;
37
+ }
38
+ /** Where a stop sits on the track — its top; 0 for a key that is not one (nothing on screen yet is the top). */
39
+ export function fractionOfStop(stops, key) {
40
+ if (!key)
41
+ return 0;
42
+ return stops.find((s) => s.key === key)?.from ?? 0;
43
+ }
44
+ /** How far down a scroller is, 0–1; 0 when it cannot scroll. */
45
+ export function scrollFraction(scrollTop, scrollHeight, clientHeight) {
46
+ const room = scrollHeight - clientHeight;
47
+ if (room <= 0)
48
+ return 0;
49
+ return clamp01(scrollTop / room);
50
+ }
51
+ /** The `scrollTop` that puts a scroller at a fraction of its travel. */
52
+ export function scrollTopAt(fraction, scrollHeight, clientHeight) {
53
+ return Math.round(clamp01(fraction) * Math.max(0, scrollHeight - clientHeight));
54
+ }
55
+ /**
56
+ * Whether a list is long enough to earn a fast scroller: at least `screens` screens of content. Under that a
57
+ * flick reaches either end, and a thumb would be chrome for nothing.
58
+ */
59
+ export function longEnough(scrollHeight, clientHeight, screens) {
60
+ return clientHeight > 0 && scrollHeight >= clientHeight * screens;
61
+ }
62
+ /** The fraction under a pointer on a track that starts at `top` and runs `height` px, the thumb centered on it. */
63
+ export function fractionAtY(clientY, top, height, thumb) {
64
+ if (height <= 0)
65
+ return 0;
66
+ return clamp01((clientY - top - thumb / 2) / height);
67
+ }
68
+ export function clamp01(n) {
69
+ // ±Infinity is a direction (Home and End are `-Infinity` and `Infinity` steps); only NaN has none.
70
+ return Number.isNaN(n) ? 0 : Math.min(1, Math.max(0, n));
71
+ }
72
+ //# sourceMappingURL=fastScroll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fastScroll.js","sourceRoot":"","sources":["../../../src/react/components/fastScroll.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAgBH,qHAAqH;AACrH,MAAM,UAAU,UAAU,CAAC,KAAgC;IACzD,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,C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esFromDataTransfer } from './components/dropTransfer.js';
122
122
  export { FileLocation, type FileLocationProps, type FileManagerKind, } from './components/FileLocation.js';
123
123
  export { FileActions, type FileActionsProps } from './components/FileActions.js';
124
124
  export { ExternalLink, type ExternalLinkProps, isHttpUrl, } from './components/ExternalLink.js';
125
+ export { type FastScrollOptions, FastScroller, type FastScrollerProps, type FastScrollStop } from './components/FastScroller.js';
125
126
  export { Grid, type GridProps } from './components/Grid.js';
126
127
  export { HoverCard, type HoverCardProps } from './components/HoverCard.js';
127
128
  export { HudPill, type HudPillProps } from './components/HudPill.js';
@@ -286,7 +287,8 @@ export { TestReportViewer, type TestReportViewerProps } from './testReport/index
286
287
  export { UiScaleControl, type UiScaleControlProps } from './uiScale/UiScaleControl.js';
287
288
  export { type UseUiScale, useUiScale } from './uiScale/useUiScale.js';
288
289
  export { type PagedList, type PagedPage, type UsePagedListOptions, usePagedList, } from './usePagedList.js';
289
- export { VirtualCardGrid, type VirtualCardGridProps } from './VirtualCardGrid.js';
290
+ export { type UseWindowedListOptions, useWindowedList, type WindowedList, type WindowedListWindow, type WindowPage, } from './useWindowedList.js';
291
+ export { type CardGridServerWindow, VirtualCardGrid, type VirtualCardGridProps } from './VirtualCardGrid.js';
290
292
  export { VirtualList, type VirtualListProps } from './VirtualList.js';
291
293
  export { createFillRegistry, type FillContribution, type FillProps, type FillRegistry, fillFeaturesSatisfied, fillPermissionsSatisfied, Slot, type SlotProps, } from './slots/Slot.js';
292
294
  export { CCPortalProvider, type CCPortalProviderProps, type FocusStackEntry, type PortalRegistry, useCcPortal, useOverlayLayer, type UseOverlayLayerOptions, } from './portal/CCPortalProvider.js';