@aiquants/virtualscroll 1.11.0 → 1.13.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/README.md +45 -16
- package/dist/cli.js +0 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1161 -1144
- package/dist/src/VirtualScroll.d.ts +24 -14
- package/dist/src/VirtualScroll.d.ts.map +1 -1
- package/dist/src/useFenwickMapTree.d.ts +4 -1
- package/dist/src/useFenwickMapTree.d.ts.map +1 -1
- package/dist/styles/virtualscroll.css +2 -2
- package/dist/virtualscroll.css +1 -1
- package/package.json +20 -19
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { memo as Xe, forwardRef as
|
|
3
|
-
import { twMerge as
|
|
1
|
+
import { jsx as B, jsxs as Ut, Fragment as Ce } from "react/jsx-runtime";
|
|
2
|
+
import ze, { memo as Xe, forwardRef as xe, useState as Vt, useRef as S, useCallback as T, useImperativeHandle as Ie, useMemo as yt, useEffect as X, useLayoutEffect as ee, useId as He } from "react";
|
|
3
|
+
import { twMerge as Wt } from "tailwind-merge";
|
|
4
4
|
const ve = {
|
|
5
5
|
active: !1,
|
|
6
6
|
offsetX: 0,
|
|
@@ -8,22 +8,22 @@ const ve = {
|
|
|
8
8
|
distance: 0,
|
|
9
9
|
direction: 0,
|
|
10
10
|
pointerId: null
|
|
11
|
-
},
|
|
12
|
-
const e = 1 + t * 0.18,
|
|
13
|
-
return /* @__PURE__ */
|
|
14
|
-
/* @__PURE__ */
|
|
11
|
+
}, pe = 6, qe = 8, Be = ({ dragState: o, normalizedDistance: t }) => {
|
|
12
|
+
const e = 1 + t * 0.18, n = 0.16 + t * 0.24, s = 0.38 + t * 0.28, c = o.active ? "80ms ease-out" : "220ms ease";
|
|
13
|
+
return /* @__PURE__ */ Ut(Ce, { children: [
|
|
14
|
+
/* @__PURE__ */ B(
|
|
15
15
|
"div",
|
|
16
16
|
{
|
|
17
17
|
className: "absolute inset-0 rounded-full",
|
|
18
18
|
style: {
|
|
19
19
|
background: "linear-gradient(140deg, rgba(255,255,255,0.62), rgba(72,72,72,0.48))",
|
|
20
|
-
boxShadow: `0 0 0 1px rgba(255,255,255,0.28), 0 10px 22px rgba(0,0,0,${
|
|
20
|
+
boxShadow: `0 0 0 1px rgba(255,255,255,0.28), 0 10px 22px rgba(0,0,0,${n})`,
|
|
21
21
|
transform: `scale(${e})`,
|
|
22
|
-
transition: `${
|
|
22
|
+
transition: `${c}, ${o.active ? "80ms" : "260ms"} box-shadow ease`
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
),
|
|
26
|
-
/* @__PURE__ */
|
|
26
|
+
/* @__PURE__ */ B(
|
|
27
27
|
"div",
|
|
28
28
|
{
|
|
29
29
|
className: "aqvs:tap-scroll-circle-inner absolute rounded-full",
|
|
@@ -31,103 +31,103 @@ const ve = {
|
|
|
31
31
|
background: "linear-gradient(140deg, rgba(255,255,255,0.72), rgba(28,28,28,0.58))",
|
|
32
32
|
boxShadow: "inset 0 4px 10px rgba(0,0,0,0.24), inset 0 0 2px rgba(255,255,255,0.55)",
|
|
33
33
|
opacity: s,
|
|
34
|
-
transition:
|
|
34
|
+
transition: o.active ? "120ms opacity ease-out" : "220ms opacity ease"
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
)
|
|
38
38
|
] });
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
const [l, d] =
|
|
42
|
-
(
|
|
43
|
-
d(
|
|
39
|
+
}, Re = Xe(
|
|
40
|
+
xe(({ onDragChange: o, className: t, maxVisualDistance: e = 160, size: n = 40, style: s, opacity: c = 1, renderVisual: u }, h) => {
|
|
41
|
+
const [l, d] = Vt(ve), f = S(null), m = S({ x: 0, y: 0 }), R = S(null), b = S(0), A = T(
|
|
42
|
+
(C) => {
|
|
43
|
+
d(C), o(C);
|
|
44
44
|
},
|
|
45
|
-
[
|
|
46
|
-
), U =
|
|
47
|
-
(
|
|
48
|
-
const { x:
|
|
49
|
-
let
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
active:
|
|
53
|
-
offsetX:
|
|
54
|
-
offsetY:
|
|
55
|
-
distance:
|
|
56
|
-
direction:
|
|
57
|
-
pointerId:
|
|
45
|
+
[o]
|
|
46
|
+
), U = T(
|
|
47
|
+
(C, H, K = !1) => {
|
|
48
|
+
const { x: O, y: it } = m.current, v = C - O, vt = H - it, y = Math.abs(vt), ct = y < pe ? 0 : vt < 0 ? -1 : 1, F = b.current;
|
|
49
|
+
let bt = ct;
|
|
50
|
+
const at = pe + qe;
|
|
51
|
+
ct === 0 ? F !== 0 && y < at ? bt = F : (bt = 0, K || (b.current = 0)) : ct !== F && F !== 0 && y < at ? bt = F : b.current = ct, A({
|
|
52
|
+
active: K || y >= pe,
|
|
53
|
+
offsetX: v,
|
|
54
|
+
offsetY: vt,
|
|
55
|
+
distance: y,
|
|
56
|
+
direction: bt,
|
|
57
|
+
pointerId: f.current
|
|
58
58
|
});
|
|
59
59
|
},
|
|
60
|
-
[
|
|
61
|
-
),
|
|
62
|
-
if (
|
|
60
|
+
[A]
|
|
61
|
+
), Y = T((C) => {
|
|
62
|
+
if (C === null)
|
|
63
63
|
return;
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
}, []),
|
|
67
|
-
(
|
|
68
|
-
|
|
64
|
+
const H = R.current;
|
|
65
|
+
H?.hasPointerCapture(C) && H.releasePointerCapture(C);
|
|
66
|
+
}, []), Z = T(
|
|
67
|
+
(C = !1) => {
|
|
68
|
+
C && Y(f.current), f.current = null, b.current = 0, A(ve);
|
|
69
69
|
},
|
|
70
|
-
[
|
|
71
|
-
),
|
|
72
|
-
(
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
70
|
+
[A, Y]
|
|
71
|
+
), ft = T(
|
|
72
|
+
(C) => {
|
|
73
|
+
C.preventDefault(), C.stopPropagation();
|
|
74
|
+
const H = R.current ?? C.currentTarget, { left: K, top: O, width: it, height: v } = H.getBoundingClientRect();
|
|
75
|
+
m.current = { x: K + it / 2, y: O + v / 2 }, f.current = C.pointerId, H.setPointerCapture(C.pointerId), U(C.clientX, C.clientY, !0);
|
|
76
76
|
},
|
|
77
77
|
[U]
|
|
78
|
-
),
|
|
79
|
-
(
|
|
80
|
-
|
|
78
|
+
), nt = T(
|
|
79
|
+
(C) => {
|
|
80
|
+
f.current === C.pointerId && (C.preventDefault(), U(C.clientX, C.clientY));
|
|
81
81
|
},
|
|
82
82
|
[U]
|
|
83
|
-
),
|
|
84
|
-
(
|
|
85
|
-
|
|
83
|
+
), tt = T(
|
|
84
|
+
(C) => {
|
|
85
|
+
f.current === C.pointerId && (C.preventDefault(), C.stopPropagation(), Z(!0));
|
|
86
86
|
},
|
|
87
|
-
[
|
|
87
|
+
[Z]
|
|
88
88
|
);
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
Ie(
|
|
90
|
+
h,
|
|
91
91
|
() => ({
|
|
92
92
|
reset: () => {
|
|
93
|
-
|
|
93
|
+
Z(!0);
|
|
94
94
|
},
|
|
95
|
-
getElement: () =>
|
|
95
|
+
getElement: () => R.current
|
|
96
96
|
}),
|
|
97
|
-
[
|
|
97
|
+
[Z]
|
|
98
98
|
);
|
|
99
|
-
const
|
|
99
|
+
const N = Math.min(Math.max(c, 0), 1), w = n / 64, $ = Math.min(l.distance, e) / e, z = l.direction * $ * 10 * w, J = u ?? Be, _ = {
|
|
100
100
|
dragState: l,
|
|
101
|
-
normalizedDistance:
|
|
102
|
-
sizeScale:
|
|
103
|
-
size:
|
|
104
|
-
opacity:
|
|
105
|
-
},
|
|
101
|
+
normalizedDistance: $,
|
|
102
|
+
sizeScale: w,
|
|
103
|
+
size: n,
|
|
104
|
+
opacity: N
|
|
105
|
+
}, mt = {
|
|
106
106
|
...s,
|
|
107
|
-
width:
|
|
108
|
-
height:
|
|
109
|
-
transform: `translateY(${
|
|
107
|
+
width: n,
|
|
108
|
+
height: n,
|
|
109
|
+
transform: `translateY(${z}px)`
|
|
110
110
|
};
|
|
111
|
-
return
|
|
111
|
+
return mt.opacity = N, /* @__PURE__ */ B(
|
|
112
112
|
"div",
|
|
113
113
|
{
|
|
114
|
-
ref:
|
|
114
|
+
ref: R,
|
|
115
115
|
"data-testid": "virtual-scroll-tap-circle",
|
|
116
|
-
className:
|
|
117
|
-
style:
|
|
116
|
+
className: Wt("relative flex touch-none select-none items-center justify-center", "transition-transform duration-100 ease-out", t),
|
|
117
|
+
style: mt,
|
|
118
118
|
tabIndex: -1,
|
|
119
|
-
onPointerDown:
|
|
120
|
-
onPointerMove:
|
|
121
|
-
onPointerUp:
|
|
122
|
-
onPointerCancel:
|
|
119
|
+
onPointerDown: ft,
|
|
120
|
+
onPointerMove: nt,
|
|
121
|
+
onPointerUp: tt,
|
|
122
|
+
onPointerCancel: tt,
|
|
123
123
|
role: "presentation",
|
|
124
|
-
children:
|
|
124
|
+
children: J(_)
|
|
125
125
|
}
|
|
126
126
|
);
|
|
127
127
|
})
|
|
128
128
|
);
|
|
129
|
-
|
|
130
|
-
const
|
|
129
|
+
Re.displayName = "TapScrollCircle";
|
|
130
|
+
const ht = (o, t, e) => Math.min(e, Math.max(t, o)), be = "virtualscroll:tap-scroll-cancel", Pe = 20, Ue = 250, $e = 60, Ke = 20, We = 20, je = 240, Se = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, he = 2.2, Ge = 8, Ze = 120, Je = 1 / 60, kt = {
|
|
131
131
|
enabled: !0,
|
|
132
132
|
size: 40,
|
|
133
133
|
offsetX: -80,
|
|
@@ -138,7 +138,7 @@ const xt = (n, t, e) => Math.min(e, Math.max(t, n)), xe = "virtualscroll:tap-scr
|
|
|
138
138
|
opacity: 0.9,
|
|
139
139
|
renderVisual: void 0,
|
|
140
140
|
maxSpeedCurve: void 0
|
|
141
|
-
}, Qe = (
|
|
141
|
+
}, Qe = (o) => o ? {
|
|
142
142
|
mainSizeKey: "width",
|
|
143
143
|
crossSizeKey: "height",
|
|
144
144
|
positionKey: "left",
|
|
@@ -158,332 +158,332 @@ const xt = (n, t, e) => Math.min(e, Math.max(t, n)), xe = "virtualscroll:tap-scr
|
|
|
158
158
|
arrowIcons: ["▲", "▼"],
|
|
159
159
|
directionClass: "flex flex-col items-stretch",
|
|
160
160
|
orientation: "vertical"
|
|
161
|
-
}, tr = (
|
|
162
|
-
const e =
|
|
161
|
+
}, tr = (o, t) => {
|
|
162
|
+
const e = o?.maxSpeedMultiplier, n = typeof e == "number" ? e : nr(t);
|
|
163
163
|
return {
|
|
164
|
-
enabled:
|
|
165
|
-
size:
|
|
166
|
-
offsetX:
|
|
167
|
-
offsetY:
|
|
168
|
-
className:
|
|
169
|
-
maxVisualDistance:
|
|
170
|
-
maxSpeedMultiplier:
|
|
171
|
-
minSpeedMultiplier: Math.max(
|
|
172
|
-
opacity:
|
|
173
|
-
renderVisual:
|
|
174
|
-
maxSpeedCurve:
|
|
164
|
+
enabled: o?.enabled ?? kt.enabled,
|
|
165
|
+
size: o?.size ?? kt.size,
|
|
166
|
+
offsetX: o?.offsetX ?? kt.offsetX,
|
|
167
|
+
offsetY: o?.offsetY ?? kt.offsetY,
|
|
168
|
+
className: o?.className ?? kt.className,
|
|
169
|
+
maxVisualDistance: o?.maxVisualDistance ?? kt.maxVisualDistance,
|
|
170
|
+
maxSpeedMultiplier: n,
|
|
171
|
+
minSpeedMultiplier: Math.max(o?.minSpeedMultiplier ?? kt.minSpeedMultiplier, 0),
|
|
172
|
+
opacity: ht(o?.opacity ?? kt.opacity, 0, 1),
|
|
173
|
+
renderVisual: o?.renderVisual ?? kt.renderVisual,
|
|
174
|
+
maxSpeedCurve: o?.maxSpeedCurve ?? kt.maxSpeedCurve
|
|
175
175
|
};
|
|
176
|
-
}, er = ({ isDragging:
|
|
177
|
-
const s =
|
|
178
|
-
s.current !== null && (window.clearInterval(s.current), s.current = null),
|
|
179
|
-
}, []),
|
|
176
|
+
}, er = ({ isDragging: o, isThumbHovered: t, enableThumbDrag: e }) => yt(() => e ? o ? "dragging" : t ? "hover" : "idle" : "disabled", [e, o, t]), rr = ({ canUseArrowButtons: o, enableArrowButtons: t, resetTapScroll: e, scrollByStep: n }) => {
|
|
177
|
+
const s = S(null), c = S(null), u = T(() => {
|
|
178
|
+
s.current !== null && (window.clearInterval(s.current), s.current = null), c.current !== null && (window.clearTimeout(c.current), c.current = null);
|
|
179
|
+
}, []), h = T(() => {
|
|
180
180
|
u();
|
|
181
|
-
}, [u]), l =
|
|
182
|
-
(
|
|
183
|
-
|
|
181
|
+
}, [u]), l = T(
|
|
182
|
+
(f) => (m) => {
|
|
183
|
+
o && (m.preventDefault(), m.stopPropagation(), e(), u(), n(f), c.current = window.setTimeout(() => {
|
|
184
184
|
s.current = window.setInterval(() => {
|
|
185
|
-
|
|
186
|
-
},
|
|
187
|
-
},
|
|
185
|
+
n(f);
|
|
186
|
+
}, $e);
|
|
187
|
+
}, Ue));
|
|
188
188
|
},
|
|
189
|
-
[
|
|
190
|
-
), d =
|
|
191
|
-
(
|
|
192
|
-
t && (
|
|
189
|
+
[o, u, e, n]
|
|
190
|
+
), d = T(
|
|
191
|
+
(f) => (m) => {
|
|
192
|
+
t && (m.key === "Enter" || m.key === " " || m.key === "Spacebar") && (m.preventDefault(), n(f));
|
|
193
193
|
},
|
|
194
|
-
[t,
|
|
194
|
+
[t, n]
|
|
195
195
|
);
|
|
196
|
-
return
|
|
196
|
+
return X(() => () => {
|
|
197
197
|
u();
|
|
198
|
-
}, [u]), { handleArrowPointerDown: l, handleArrowPointerUp:
|
|
199
|
-
}, nr = (
|
|
200
|
-
if (!
|
|
201
|
-
return
|
|
202
|
-
const t = Math.max(1,
|
|
203
|
-
return
|
|
198
|
+
}, [u]), { handleArrowPointerDown: l, handleArrowPointerUp: h, handleArrowKeyDown: d };
|
|
199
|
+
}, nr = (o) => {
|
|
200
|
+
if (!o || o <= 0)
|
|
201
|
+
return he;
|
|
202
|
+
const t = Math.max(1, o), e = Math.log10(t), n = he + e * Ge;
|
|
203
|
+
return ht(n, he, Ze);
|
|
204
204
|
}, or = ({
|
|
205
|
-
contentSize:
|
|
205
|
+
contentSize: o,
|
|
206
206
|
viewportSize: t,
|
|
207
207
|
scrollPosition: e,
|
|
208
|
-
onScroll:
|
|
208
|
+
onScroll: n,
|
|
209
209
|
enableThumbDrag: s = !0,
|
|
210
|
-
enableTrackClick:
|
|
210
|
+
enableTrackClick: c = !0,
|
|
211
211
|
enableArrowButtons: u = !0,
|
|
212
|
-
horizontal:
|
|
212
|
+
horizontal: h = !1,
|
|
213
213
|
scrollBarWidth: l = 12,
|
|
214
214
|
className: d,
|
|
215
|
-
ariaControls:
|
|
216
|
-
tapScrollCircleOptions:
|
|
217
|
-
itemCount:
|
|
218
|
-
renderThumbOverlay:
|
|
219
|
-
visibleStartIndex:
|
|
215
|
+
ariaControls: f,
|
|
216
|
+
tapScrollCircleOptions: m,
|
|
217
|
+
itemCount: R,
|
|
218
|
+
renderThumbOverlay: b,
|
|
219
|
+
visibleStartIndex: A,
|
|
220
220
|
visibleEndIndex: U
|
|
221
221
|
}) => {
|
|
222
|
-
const [
|
|
223
|
-
enabled:
|
|
224
|
-
size:
|
|
225
|
-
offsetX:
|
|
226
|
-
offsetY:
|
|
227
|
-
className:
|
|
228
|
-
maxVisualDistance:
|
|
229
|
-
maxSpeedMultiplier:
|
|
230
|
-
minSpeedMultiplier:
|
|
231
|
-
opacity:
|
|
232
|
-
renderVisual:
|
|
233
|
-
maxSpeedCurve:
|
|
234
|
-
} =
|
|
222
|
+
const [Y, Z] = Vt(!1), [ft, nt] = Vt(!1), [tt, N] = Vt(!1), w = S(null), $ = S({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), z = S({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), J = S(e), _ = S(Se), mt = S(null), C = S(null), H = S(null), K = yt(() => tr(m, R), [R, m]), O = yt(() => Qe(h), [h]), {
|
|
223
|
+
enabled: it,
|
|
224
|
+
size: v,
|
|
225
|
+
offsetX: vt,
|
|
226
|
+
offsetY: y,
|
|
227
|
+
className: ct,
|
|
228
|
+
maxVisualDistance: F,
|
|
229
|
+
maxSpeedMultiplier: bt,
|
|
230
|
+
minSpeedMultiplier: at,
|
|
231
|
+
opacity: At,
|
|
232
|
+
renderVisual: I,
|
|
233
|
+
maxSpeedCurve: D
|
|
234
|
+
} = K, M = S({
|
|
235
235
|
viewportSize: t,
|
|
236
|
-
maxScrollPosition: Math.max(
|
|
237
|
-
scrollBarVisible:
|
|
238
|
-
effectiveTapMaxDistance: Math.max(
|
|
239
|
-
tapCircleMaxSpeedMultiplier:
|
|
240
|
-
tapCircleMinSpeedMultiplier:
|
|
241
|
-
tapCircleMaxSpeedCurve:
|
|
242
|
-
tapScrollCircleOptions:
|
|
243
|
-
}), { mainSizeKey:
|
|
244
|
-
|
|
236
|
+
maxScrollPosition: Math.max(o - t, 0),
|
|
237
|
+
scrollBarVisible: o > t,
|
|
238
|
+
effectiveTapMaxDistance: Math.max(F, 1),
|
|
239
|
+
tapCircleMaxSpeedMultiplier: bt,
|
|
240
|
+
tapCircleMinSpeedMultiplier: at,
|
|
241
|
+
tapCircleMaxSpeedCurve: D,
|
|
242
|
+
tapScrollCircleOptions: m
|
|
243
|
+
}), { mainSizeKey: et, crossSizeKey: L, positionKey: Mt, selectDelta: xt, getPointerCoordinate: It, arrowLabels: rt, arrowIcons: lt, directionClass: ut, orientation: gt } = O, Et = Math.max(F, 1), Xt = t / o, Pt = l, g = Math.max(t - Pt * 2, 0), P = Xt * g, ot = Math.min(Math.max(Pe, P || 0), g || Pe), W = o - t, j = Math.max(g - ot, 0), Dt = W <= 0 || j <= 0 ? 0 : e / W * j, wt = Dt + ot / 2, pt = o > t, Ct = pt && u;
|
|
244
|
+
M.current = {
|
|
245
245
|
viewportSize: t,
|
|
246
|
-
maxScrollPosition:
|
|
247
|
-
scrollBarVisible:
|
|
248
|
-
effectiveTapMaxDistance:
|
|
249
|
-
tapCircleMaxSpeedMultiplier:
|
|
250
|
-
tapCircleMinSpeedMultiplier:
|
|
251
|
-
tapCircleMaxSpeedCurve:
|
|
252
|
-
tapScrollCircleOptions:
|
|
253
|
-
},
|
|
254
|
-
|
|
255
|
-
}, [e]),
|
|
256
|
-
s ||
|
|
246
|
+
maxScrollPosition: W,
|
|
247
|
+
scrollBarVisible: pt,
|
|
248
|
+
effectiveTapMaxDistance: Et,
|
|
249
|
+
tapCircleMaxSpeedMultiplier: bt,
|
|
250
|
+
tapCircleMinSpeedMultiplier: at,
|
|
251
|
+
tapCircleMaxSpeedCurve: D,
|
|
252
|
+
tapScrollCircleOptions: m
|
|
253
|
+
}, X(() => {
|
|
254
|
+
J.current = e;
|
|
255
|
+
}, [e]), X(() => {
|
|
256
|
+
s || nt(!1);
|
|
257
257
|
}, [s]);
|
|
258
|
-
const
|
|
259
|
-
(
|
|
260
|
-
const
|
|
261
|
-
if (
|
|
262
|
-
const
|
|
263
|
-
if (typeof
|
|
264
|
-
return
|
|
258
|
+
const Ht = er({ isDragging: Y, isThumbHovered: ft, enableThumbDrag: s }), Nt = T(
|
|
259
|
+
(r, a) => {
|
|
260
|
+
const x = M.current, V = a ?? J.current;
|
|
261
|
+
if (n) {
|
|
262
|
+
const G = n(r, V);
|
|
263
|
+
if (typeof G == "number" && Number.isFinite(G))
|
|
264
|
+
return J.current = G, G;
|
|
265
265
|
}
|
|
266
|
-
const
|
|
267
|
-
return
|
|
266
|
+
const k = typeof r == "function" ? r(V) : r, E = Math.max(x.maxScrollPosition, 0), q = x.scrollBarVisible ? ht(k, 0, E) : 0;
|
|
267
|
+
return J.current = q, q;
|
|
268
268
|
},
|
|
269
|
-
[
|
|
270
|
-
),
|
|
271
|
-
(
|
|
272
|
-
const
|
|
273
|
-
if (!
|
|
274
|
-
const
|
|
275
|
-
return { nextPosition:
|
|
269
|
+
[n]
|
|
270
|
+
), $t = T(
|
|
271
|
+
(r) => {
|
|
272
|
+
const a = M.current, x = J.current;
|
|
273
|
+
if (!a.scrollBarVisible || a.maxScrollPosition <= 0) {
|
|
274
|
+
const G = Nt(0, x), zt = G - x;
|
|
275
|
+
return { nextPosition: G, actualDelta: zt, reachedBoundary: !0 };
|
|
276
276
|
}
|
|
277
|
-
if (
|
|
278
|
-
return { nextPosition:
|
|
279
|
-
const
|
|
280
|
-
return { nextPosition:
|
|
277
|
+
if (r === 0)
|
|
278
|
+
return { nextPosition: x, actualDelta: 0, reachedBoundary: !1 };
|
|
279
|
+
const k = Nt((G) => ht(G + r, 0, a.maxScrollPosition), x), E = k - x, q = E === 0 || r < 0 && k <= 0 || r > 0 && k >= a.maxScrollPosition;
|
|
280
|
+
return { nextPosition: k, actualDelta: E, reachedBoundary: q };
|
|
281
281
|
},
|
|
282
|
-
[
|
|
283
|
-
),
|
|
284
|
-
|
|
285
|
-
}, []),
|
|
286
|
-
|
|
287
|
-
}, [
|
|
288
|
-
(
|
|
289
|
-
const
|
|
290
|
-
if (!
|
|
291
|
-
|
|
282
|
+
[Nt]
|
|
283
|
+
), Q = T(() => {
|
|
284
|
+
C.current !== null && (window.cancelAnimationFrame(C.current), C.current = null), H.current = null;
|
|
285
|
+
}, []), St = T(() => {
|
|
286
|
+
_.current = { ...Se }, N(!1), mt.current?.reset(), Q();
|
|
287
|
+
}, [Q]), Tt = T(
|
|
288
|
+
(r) => {
|
|
289
|
+
const a = _.current, x = M.current;
|
|
290
|
+
if (!a.active || a.direction === 0) {
|
|
291
|
+
Q();
|
|
292
292
|
return;
|
|
293
293
|
}
|
|
294
|
-
if (!
|
|
295
|
-
|
|
294
|
+
if (!x.scrollBarVisible || x.maxScrollPosition <= 0) {
|
|
295
|
+
Q();
|
|
296
296
|
return;
|
|
297
297
|
}
|
|
298
|
-
const
|
|
299
|
-
if (
|
|
300
|
-
|
|
298
|
+
const V = H.current ?? r, k = Math.max((r - V) / 1e3, 0), E = Math.min(k, Je);
|
|
299
|
+
if (H.current = r, E <= 0) {
|
|
300
|
+
C.current = window.requestAnimationFrame(Tt);
|
|
301
301
|
return;
|
|
302
302
|
}
|
|
303
|
-
const
|
|
304
|
-
let me = Math.max(
|
|
305
|
-
const ie =
|
|
303
|
+
const q = Math.min(a.distance, x.effectiveTapMaxDistance) / x.effectiveTapMaxDistance, G = q ** 1.1, zt = typeof x.tapScrollCircleOptions?.maxSpeedMultiplier == "number", _t = Math.max(x.viewportSize * x.tapCircleMinSpeedMultiplier, 40), Kt = zt ? _t : 1200;
|
|
304
|
+
let me = Math.max(x.viewportSize * x.tapCircleMaxSpeedMultiplier, Kt);
|
|
305
|
+
const ie = x.tapCircleMaxSpeedCurve;
|
|
306
306
|
if (ie) {
|
|
307
|
-
const ae = Math.max(ie.exponentialSteepness, 0),
|
|
308
|
-
me = Math.min(me, Math.max(
|
|
307
|
+
const ae = Math.max(ie.exponentialSteepness, 0), Fe = Math.max(ie.exponentialScale ?? x.tapCircleMaxSpeedMultiplier, 0), Le = ae === 0 ? q : Math.expm1(ae * q), Te = ae === 0 ? 1 : Math.expm1(ae) || 1, Oe = Te === 0 ? q : Math.min(Math.max(Le / Te, 0), 1), Ye = x.viewportSize * Fe * Oe;
|
|
308
|
+
me = Math.min(me, Math.max(Ye, _t));
|
|
309
309
|
}
|
|
310
|
-
const Ve = Math.max(me,
|
|
311
|
-
if (ke ||
|
|
312
|
-
|
|
310
|
+
const Ve = Math.max(me, _t), Ae = Math.max(ie?.easedOffset ?? 0, 0), De = Math.min(1, G + Ae), Ee = _t + (Ve - _t) * De, Ne = a.direction * Ee * E, { actualDelta: _e, reachedBoundary: ke } = $t(Ne);
|
|
311
|
+
if (ke || _e === 0) {
|
|
312
|
+
Q();
|
|
313
313
|
return;
|
|
314
314
|
}
|
|
315
|
-
|
|
315
|
+
C.current = window.requestAnimationFrame(Tt);
|
|
316
316
|
},
|
|
317
|
-
[
|
|
318
|
-
),
|
|
319
|
-
|
|
320
|
-
}, [
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
}, [
|
|
324
|
-
const
|
|
325
|
-
(
|
|
326
|
-
|
|
317
|
+
[$t, Q]
|
|
318
|
+
), jt = T(() => {
|
|
319
|
+
C.current === null && (H.current = null, C.current = window.requestAnimationFrame(Tt));
|
|
320
|
+
}, [Tt]);
|
|
321
|
+
X(() => () => {
|
|
322
|
+
Q();
|
|
323
|
+
}, [Q]);
|
|
324
|
+
const re = T(
|
|
325
|
+
(r) => {
|
|
326
|
+
_.current = r, N(r.active), r.active && r.direction !== 0 ? jt() : Q();
|
|
327
327
|
},
|
|
328
|
-
[
|
|
328
|
+
[jt, Q]
|
|
329
329
|
);
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
}, [
|
|
333
|
-
const
|
|
334
|
-
const
|
|
335
|
-
|
|
330
|
+
X(() => {
|
|
331
|
+
it || St();
|
|
332
|
+
}, [St, it]), X(() => {
|
|
333
|
+
const r = (a) => {
|
|
334
|
+
const V = a.detail?.paneId;
|
|
335
|
+
V && f && V !== f || St();
|
|
336
336
|
};
|
|
337
|
-
return window.addEventListener(
|
|
338
|
-
window.removeEventListener(
|
|
337
|
+
return window.addEventListener(be, r), () => {
|
|
338
|
+
window.removeEventListener(be, r);
|
|
339
339
|
};
|
|
340
|
-
}, [
|
|
341
|
-
if (!
|
|
340
|
+
}, [f, St]), X(() => {
|
|
341
|
+
if (!it)
|
|
342
342
|
return;
|
|
343
|
-
const
|
|
344
|
-
if (!
|
|
343
|
+
const r = (a) => {
|
|
344
|
+
if (!_.current.active || _.current.pointerId === a.pointerId)
|
|
345
345
|
return;
|
|
346
|
-
const
|
|
347
|
-
if (!(
|
|
348
|
-
|
|
346
|
+
const x = a.target;
|
|
347
|
+
if (!(x instanceof Node)) {
|
|
348
|
+
St();
|
|
349
349
|
return;
|
|
350
350
|
}
|
|
351
|
-
|
|
351
|
+
mt.current?.getElement()?.contains(x) || St();
|
|
352
352
|
};
|
|
353
|
-
return document.addEventListener("pointerdown",
|
|
354
|
-
document.removeEventListener("pointerdown",
|
|
353
|
+
return document.addEventListener("pointerdown", r, !0), () => {
|
|
354
|
+
document.removeEventListener("pointerdown", r, !0);
|
|
355
355
|
};
|
|
356
|
-
}, [
|
|
357
|
-
const
|
|
358
|
-
if (!
|
|
356
|
+
}, [St, it]);
|
|
357
|
+
const Gt = (r) => {
|
|
358
|
+
if (!pt || j <= 0 || W <= 0)
|
|
359
359
|
return 0;
|
|
360
|
-
const
|
|
361
|
-
return
|
|
362
|
-
},
|
|
363
|
-
const
|
|
364
|
-
|
|
365
|
-
}, { handleArrowPointerDown:
|
|
366
|
-
canUseArrowButtons:
|
|
360
|
+
const a = ht(r, 0, j);
|
|
361
|
+
return ht(a / j * W, 0, W);
|
|
362
|
+
}, Bt = (r) => {
|
|
363
|
+
const a = Math.max(Math.round(t / We), Ke);
|
|
364
|
+
$t(r * a);
|
|
365
|
+
}, { handleArrowPointerDown: ne, handleArrowPointerUp: Rt, handleArrowKeyDown: Ft } = rr({
|
|
366
|
+
canUseArrowButtons: Ct,
|
|
367
367
|
enableArrowButtons: u,
|
|
368
|
-
resetTapScroll:
|
|
369
|
-
scrollByStep:
|
|
370
|
-
}),
|
|
371
|
-
if (!
|
|
368
|
+
resetTapScroll: St,
|
|
369
|
+
scrollByStep: Bt
|
|
370
|
+
}), Lt = (r) => {
|
|
371
|
+
if (!pt)
|
|
372
372
|
return;
|
|
373
373
|
if (!s) {
|
|
374
|
-
|
|
374
|
+
r.preventDefault(), r.stopPropagation();
|
|
375
375
|
return;
|
|
376
376
|
}
|
|
377
|
-
if (
|
|
377
|
+
if (r.pointerType === "mouse" && r.button !== 0 || r.ctrlKey)
|
|
378
378
|
return;
|
|
379
|
-
|
|
380
|
-
const
|
|
381
|
-
|
|
382
|
-
pointerId:
|
|
383
|
-
startThumbPosition:
|
|
384
|
-
startClientX:
|
|
385
|
-
startClientY:
|
|
386
|
-
},
|
|
387
|
-
},
|
|
388
|
-
const
|
|
389
|
-
if (
|
|
379
|
+
St();
|
|
380
|
+
const a = r.currentTarget;
|
|
381
|
+
a.setPointerCapture && a.setPointerCapture(r.pointerId), $.current = {
|
|
382
|
+
pointerId: r.pointerId,
|
|
383
|
+
startThumbPosition: Dt,
|
|
384
|
+
startClientX: r.clientX,
|
|
385
|
+
startClientY: r.clientY
|
|
386
|
+
}, Z(!0), nt(!0), r.preventDefault(), r.stopPropagation();
|
|
387
|
+
}, Ot = (r) => {
|
|
388
|
+
const a = $.current;
|
|
389
|
+
if (a.pointerId !== r.pointerId)
|
|
390
390
|
return;
|
|
391
|
-
const
|
|
392
|
-
|
|
393
|
-
},
|
|
394
|
-
if (
|
|
391
|
+
const x = r.clientX - a.startClientX, V = r.clientY - a.startClientY, k = xt(x, V), E = Gt(a.startThumbPosition + k);
|
|
392
|
+
Nt(E), r.cancelable && r.preventDefault();
|
|
393
|
+
}, Yt = (r) => {
|
|
394
|
+
if ($.current.pointerId !== r.pointerId)
|
|
395
395
|
return;
|
|
396
|
-
const
|
|
397
|
-
|
|
398
|
-
},
|
|
399
|
-
if (
|
|
396
|
+
const a = r.currentTarget;
|
|
397
|
+
a.hasPointerCapture(r.pointerId) && a.releasePointerCapture(r.pointerId), $.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, Z(!1), w.current && !w.current.matches(":hover") && nt(!1), r.preventDefault(), r.stopPropagation();
|
|
398
|
+
}, oe = (r) => {
|
|
399
|
+
if ($.current.pointerId !== r.pointerId)
|
|
400
400
|
return;
|
|
401
|
-
const
|
|
402
|
-
|
|
403
|
-
},
|
|
404
|
-
if (!
|
|
401
|
+
const a = r.currentTarget;
|
|
402
|
+
a.hasPointerCapture(r.pointerId) && a.releasePointerCapture(r.pointerId), $.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, Z(!1), w.current && !w.current.matches(":hover") && nt(!1);
|
|
403
|
+
}, se = (r) => {
|
|
404
|
+
if (!pt)
|
|
405
405
|
return;
|
|
406
|
-
if (!
|
|
407
|
-
|
|
406
|
+
if (!c) {
|
|
407
|
+
r.preventDefault(), r.stopPropagation();
|
|
408
408
|
return;
|
|
409
409
|
}
|
|
410
|
-
if (
|
|
410
|
+
if (r.pointerType === "mouse" && r.button !== 0 || r.ctrlKey)
|
|
411
411
|
return;
|
|
412
|
-
const
|
|
413
|
-
|
|
414
|
-
const
|
|
415
|
-
|
|
416
|
-
pointerId:
|
|
417
|
-
startThumbPosition:
|
|
418
|
-
startClientX:
|
|
419
|
-
startClientY:
|
|
420
|
-
},
|
|
421
|
-
},
|
|
422
|
-
const
|
|
423
|
-
if (
|
|
412
|
+
const a = r.currentTarget, x = a.getBoundingClientRect(), k = It(r) - (h ? x.left : x.top);
|
|
413
|
+
St();
|
|
414
|
+
const E = k - ot / 2, q = Gt(E);
|
|
415
|
+
Nt(q), a.setPointerCapture && a.setPointerCapture(r.pointerId), z.current = {
|
|
416
|
+
pointerId: r.pointerId,
|
|
417
|
+
startThumbPosition: E,
|
|
418
|
+
startClientX: r.clientX,
|
|
419
|
+
startClientY: r.clientY
|
|
420
|
+
}, r.preventDefault(), r.stopPropagation();
|
|
421
|
+
}, ue = (r) => {
|
|
422
|
+
const a = z.current;
|
|
423
|
+
if (a.pointerId !== r.pointerId)
|
|
424
424
|
return;
|
|
425
|
-
const
|
|
426
|
-
|
|
427
|
-
},
|
|
428
|
-
if (
|
|
425
|
+
const x = r.clientX - a.startClientX, V = r.clientY - a.startClientY, k = xt(x, V), E = Gt(a.startThumbPosition + k);
|
|
426
|
+
Nt(E), r.cancelable && r.preventDefault();
|
|
427
|
+
}, Zt = (r) => {
|
|
428
|
+
if (z.current.pointerId !== r.pointerId)
|
|
429
429
|
return;
|
|
430
|
-
const
|
|
431
|
-
|
|
432
|
-
},
|
|
433
|
-
if (
|
|
430
|
+
const a = r.currentTarget;
|
|
431
|
+
a.hasPointerCapture(r.pointerId) && a.releasePointerCapture(r.pointerId), z.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, r.preventDefault(), r.stopPropagation();
|
|
432
|
+
}, Jt = (r) => {
|
|
433
|
+
if (z.current.pointerId !== r.pointerId)
|
|
434
434
|
return;
|
|
435
|
-
const
|
|
436
|
-
|
|
437
|
-
},
|
|
438
|
-
const
|
|
435
|
+
const a = r.currentTarget;
|
|
436
|
+
a.hasPointerCapture(r.pointerId) && a.releasePointerCapture(r.pointerId), z.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 };
|
|
437
|
+
}, de = yt(() => ht((tt ? 1 : 0.8) * At, 0, 1), [tt, At]), fe = yt(() => {
|
|
438
|
+
const a = `calc(50% - ${v / 2}px + ${y}px)`;
|
|
439
439
|
return {
|
|
440
|
-
left:
|
|
441
|
-
top:
|
|
440
|
+
left: vt,
|
|
441
|
+
top: a
|
|
442
442
|
};
|
|
443
|
-
}, [
|
|
443
|
+
}, [vt, y, v]), i = (r, a, x) => /* @__PURE__ */ B(
|
|
444
444
|
"button",
|
|
445
445
|
{
|
|
446
446
|
type: "button",
|
|
447
447
|
tabIndex: -1,
|
|
448
448
|
className: "aqvs:scrollbar-arrow-button flex items-center justify-center text-xs transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50",
|
|
449
449
|
style: {
|
|
450
|
-
[
|
|
451
|
-
[
|
|
450
|
+
[et]: Pt,
|
|
451
|
+
[L]: l
|
|
452
452
|
},
|
|
453
|
-
"aria-label":
|
|
454
|
-
onMouseDown:
|
|
455
|
-
onTouchStart:
|
|
456
|
-
onMouseUp:
|
|
457
|
-
onMouseLeave:
|
|
458
|
-
onTouchEnd:
|
|
459
|
-
onTouchCancel:
|
|
460
|
-
onKeyDown:
|
|
453
|
+
"aria-label": a,
|
|
454
|
+
onMouseDown: ne(r),
|
|
455
|
+
onTouchStart: ne(r),
|
|
456
|
+
onMouseUp: Rt,
|
|
457
|
+
onMouseLeave: Rt,
|
|
458
|
+
onTouchEnd: Rt,
|
|
459
|
+
onTouchCancel: Rt,
|
|
460
|
+
onKeyDown: Ft(r),
|
|
461
461
|
"aria-disabled": !u,
|
|
462
|
-
disabled: !
|
|
463
|
-
children: /* @__PURE__ */
|
|
462
|
+
disabled: !Ct,
|
|
463
|
+
children: /* @__PURE__ */ B("span", { "aria-hidden": "true", children: x })
|
|
464
464
|
}
|
|
465
|
-
),
|
|
466
|
-
orientation:
|
|
465
|
+
), p = b && pt ? {
|
|
466
|
+
orientation: gt,
|
|
467
467
|
scrollPosition: e,
|
|
468
|
-
maxScrollPosition:
|
|
469
|
-
contentSize:
|
|
468
|
+
maxScrollPosition: W,
|
|
469
|
+
contentSize: o,
|
|
470
470
|
viewportSize: t,
|
|
471
|
-
thumbSize:
|
|
472
|
-
thumbPosition:
|
|
473
|
-
thumbCenter:
|
|
474
|
-
trackSize:
|
|
475
|
-
isDragging:
|
|
476
|
-
isTapScrollActive:
|
|
477
|
-
visibleStartIndex:
|
|
471
|
+
thumbSize: ot,
|
|
472
|
+
thumbPosition: Dt,
|
|
473
|
+
thumbCenter: wt,
|
|
474
|
+
trackSize: g,
|
|
475
|
+
isDragging: Y,
|
|
476
|
+
isTapScrollActive: tt,
|
|
477
|
+
visibleStartIndex: A,
|
|
478
478
|
visibleEndIndex: U
|
|
479
479
|
} : null;
|
|
480
|
-
return /* @__PURE__ */
|
|
480
|
+
return /* @__PURE__ */ Ut(
|
|
481
481
|
"div",
|
|
482
482
|
{
|
|
483
|
-
className:
|
|
483
|
+
className: Wt("group relative cursor-default select-none", ut, d),
|
|
484
484
|
style: {
|
|
485
|
-
[
|
|
486
|
-
[
|
|
485
|
+
[et]: t,
|
|
486
|
+
[L]: l,
|
|
487
487
|
backgroundColor: "white",
|
|
488
488
|
userSelect: "none",
|
|
489
489
|
position: "relative",
|
|
@@ -491,27 +491,27 @@ const xt = (n, t, e) => Math.min(e, Math.max(t, n)), xe = "virtualscroll:tap-scr
|
|
|
491
491
|
},
|
|
492
492
|
role: "scrollbar",
|
|
493
493
|
tabIndex: -1,
|
|
494
|
-
"aria-controls":
|
|
494
|
+
"aria-controls": f,
|
|
495
495
|
"aria-valuenow": e,
|
|
496
496
|
"aria-valuemin": 0,
|
|
497
|
-
"aria-valuemax":
|
|
498
|
-
"aria-orientation":
|
|
497
|
+
"aria-valuemax": W,
|
|
498
|
+
"aria-orientation": h ? "horizontal" : "vertical",
|
|
499
499
|
children: [
|
|
500
|
-
!
|
|
501
|
-
|
|
500
|
+
!h && pt && it && /* @__PURE__ */ B(
|
|
501
|
+
Re,
|
|
502
502
|
{
|
|
503
|
-
ref:
|
|
504
|
-
className:
|
|
505
|
-
size:
|
|
506
|
-
maxVisualDistance:
|
|
507
|
-
style:
|
|
508
|
-
opacity:
|
|
509
|
-
renderVisual:
|
|
510
|
-
onDragChange:
|
|
503
|
+
ref: mt,
|
|
504
|
+
className: Wt("pointer-events-auto absolute transition-opacity duration-150", ct),
|
|
505
|
+
size: v,
|
|
506
|
+
maxVisualDistance: Et,
|
|
507
|
+
style: fe,
|
|
508
|
+
opacity: de,
|
|
509
|
+
renderVisual: I,
|
|
510
|
+
onDragChange: re
|
|
511
511
|
}
|
|
512
512
|
),
|
|
513
|
-
|
|
514
|
-
/* @__PURE__ */
|
|
513
|
+
i(-1, rt[0], lt[0]),
|
|
514
|
+
/* @__PURE__ */ Ut(
|
|
515
515
|
"div",
|
|
516
516
|
{
|
|
517
517
|
className: "aqvs:scrollbar-track relative flex-1",
|
|
@@ -519,50 +519,50 @@ const xt = (n, t, e) => Math.min(e, Math.max(t, n)), xe = "virtualscroll:tap-scr
|
|
|
519
519
|
borderRadius: l / 2,
|
|
520
520
|
touchAction: "none"
|
|
521
521
|
},
|
|
522
|
-
onPointerDown:
|
|
523
|
-
onPointerMove:
|
|
524
|
-
onPointerUp:
|
|
525
|
-
onPointerCancel:
|
|
526
|
-
"aria-disabled": !
|
|
522
|
+
onPointerDown: se,
|
|
523
|
+
onPointerMove: ue,
|
|
524
|
+
onPointerUp: Zt,
|
|
525
|
+
onPointerCancel: Jt,
|
|
526
|
+
"aria-disabled": !c,
|
|
527
527
|
children: [
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
/* @__PURE__ */
|
|
528
|
+
p && /* @__PURE__ */ B("div", { className: "pointer-events-none absolute inset-0", "aria-hidden": !0, children: b?.(p) }),
|
|
529
|
+
pt && // スクロールバーのつまみの当たり判定を広げるためのラッパー
|
|
530
|
+
/* @__PURE__ */ B(
|
|
531
531
|
"div",
|
|
532
532
|
{
|
|
533
533
|
className: "group absolute",
|
|
534
534
|
style: {
|
|
535
|
-
[
|
|
536
|
-
[
|
|
537
|
-
...
|
|
535
|
+
[et]: ot,
|
|
536
|
+
[Mt]: Dt,
|
|
537
|
+
...h ? { top: 0, bottom: 0 } : { left: 0, right: 0 },
|
|
538
538
|
touchAction: "none"
|
|
539
539
|
},
|
|
540
|
-
onPointerDown:
|
|
541
|
-
onPointerMove:
|
|
542
|
-
onPointerUp:
|
|
543
|
-
onPointerCancel:
|
|
540
|
+
onPointerDown: Lt,
|
|
541
|
+
onPointerMove: Ot,
|
|
542
|
+
onPointerUp: Yt,
|
|
543
|
+
onPointerCancel: oe,
|
|
544
544
|
role: "slider",
|
|
545
|
-
"aria-orientation":
|
|
545
|
+
"aria-orientation": h ? "horizontal" : "vertical",
|
|
546
546
|
"aria-valuenow": e,
|
|
547
547
|
"aria-valuemin": 0,
|
|
548
|
-
"aria-valuemax":
|
|
548
|
+
"aria-valuemax": W,
|
|
549
549
|
"aria-disabled": !s,
|
|
550
550
|
tabIndex: -1,
|
|
551
|
-
children: /* @__PURE__ */
|
|
551
|
+
children: /* @__PURE__ */ B(
|
|
552
552
|
"div",
|
|
553
553
|
{
|
|
554
|
-
ref:
|
|
555
|
-
className:
|
|
556
|
-
"data-thumb-state":
|
|
554
|
+
ref: w,
|
|
555
|
+
className: Wt("aqvs:scrollbar-thumb absolute", h ? "aqvs:scrollbar-thumb-horizontal" : "aqvs:scrollbar-thumb-vertical"),
|
|
556
|
+
"data-thumb-state": Ht,
|
|
557
557
|
style: {
|
|
558
558
|
borderRadius: l - 1,
|
|
559
559
|
cursor: s ? "pointer" : "default"
|
|
560
560
|
},
|
|
561
561
|
onMouseEnter: () => {
|
|
562
|
-
s &&
|
|
562
|
+
s && nt(!0);
|
|
563
563
|
},
|
|
564
564
|
onMouseLeave: () => {
|
|
565
|
-
s &&
|
|
565
|
+
s && nt(!1);
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
568
|
)
|
|
@@ -571,179 +571,179 @@ const xt = (n, t, e) => Math.min(e, Math.max(t, n)), xe = "virtualscroll:tap-scr
|
|
|
571
571
|
]
|
|
572
572
|
}
|
|
573
573
|
),
|
|
574
|
-
|
|
574
|
+
i(1, rt[1], lt[1])
|
|
575
575
|
]
|
|
576
576
|
}
|
|
577
577
|
);
|
|
578
|
-
},
|
|
579
|
-
debug(
|
|
580
|
-
process.env.NODE_ENV === "___" && console.debug(`[VirtualScroll] ${
|
|
578
|
+
}, dt = {
|
|
579
|
+
debug(o, ...t) {
|
|
580
|
+
process.env.NODE_ENV === "___" && console.debug(`[VirtualScroll] ${o}`, ...t);
|
|
581
581
|
},
|
|
582
|
-
warn(
|
|
583
|
-
console.warn(`[VirtualScroll] ${
|
|
582
|
+
warn(o, ...t) {
|
|
583
|
+
console.warn(`[VirtualScroll] ${o}`, ...t);
|
|
584
584
|
},
|
|
585
|
-
error(
|
|
586
|
-
console.error(`[VirtualScroll] ${
|
|
585
|
+
error(o, ...t) {
|
|
586
|
+
console.error(`[VirtualScroll] ${o}`, ...t);
|
|
587
587
|
}
|
|
588
|
-
},
|
|
588
|
+
}, Qt = {
|
|
589
589
|
maxVelocity: 6,
|
|
590
590
|
minVelocity: 0.02,
|
|
591
591
|
deceleration: 25e-4,
|
|
592
592
|
velocitySampleWindow: 90,
|
|
593
593
|
startVelocityThreshold: 0.04
|
|
594
|
-
}, le = (
|
|
595
|
-
for (const [
|
|
596
|
-
e === "add" ?
|
|
597
|
-
}, sr =
|
|
594
|
+
}, le = (o, t, e) => {
|
|
595
|
+
for (const [n, s, c] of t)
|
|
596
|
+
e === "add" ? o.addEventListener(n, s, c) : o.removeEventListener(n, s, c);
|
|
597
|
+
}, sr = xe(
|
|
598
598
|
({
|
|
599
|
-
children:
|
|
599
|
+
children: o,
|
|
600
600
|
contentSize: t,
|
|
601
601
|
viewportSize: e,
|
|
602
|
-
scrollBarWidth:
|
|
602
|
+
scrollBarWidth: n = 12,
|
|
603
603
|
enableThumbDrag: s = !0,
|
|
604
|
-
enableTrackClick:
|
|
604
|
+
enableTrackClick: c = !0,
|
|
605
605
|
enableArrowButtons: u = !0,
|
|
606
|
-
enablePointerDrag:
|
|
606
|
+
enablePointerDrag: h = !0,
|
|
607
607
|
onScroll: l,
|
|
608
608
|
className: d,
|
|
609
|
-
style:
|
|
610
|
-
background:
|
|
611
|
-
tapScrollCircleOptions:
|
|
612
|
-
inertiaOptions:
|
|
613
|
-
itemCount:
|
|
609
|
+
style: f,
|
|
610
|
+
background: m,
|
|
611
|
+
tapScrollCircleOptions: R,
|
|
612
|
+
inertiaOptions: b,
|
|
613
|
+
itemCount: A,
|
|
614
614
|
renderThumbOverlay: U,
|
|
615
|
-
wheelSpeedMultiplier:
|
|
616
|
-
contentInsets:
|
|
617
|
-
visibleStartIndex:
|
|
618
|
-
visibleEndIndex:
|
|
619
|
-
renderOverlay:
|
|
620
|
-
},
|
|
621
|
-
const
|
|
615
|
+
wheelSpeedMultiplier: Y = 1,
|
|
616
|
+
contentInsets: Z,
|
|
617
|
+
visibleStartIndex: ft,
|
|
618
|
+
visibleEndIndex: nt,
|
|
619
|
+
renderOverlay: tt
|
|
620
|
+
}, N) => {
|
|
621
|
+
const w = S(0), $ = S(null), z = S(null), J = S({
|
|
622
622
|
frame: null,
|
|
623
623
|
velocity: 0,
|
|
624
624
|
lastTimestamp: null
|
|
625
|
-
}),
|
|
625
|
+
}), _ = yt(
|
|
626
626
|
() => ({
|
|
627
|
-
maxVelocity:
|
|
628
|
-
minVelocity:
|
|
629
|
-
deceleration:
|
|
630
|
-
velocitySampleWindow:
|
|
631
|
-
startVelocityThreshold:
|
|
627
|
+
maxVelocity: b?.maxVelocity ?? Qt.maxVelocity,
|
|
628
|
+
minVelocity: b?.minVelocity ?? Qt.minVelocity,
|
|
629
|
+
deceleration: b?.deceleration ?? Qt.deceleration,
|
|
630
|
+
velocitySampleWindow: b?.velocitySampleWindow ?? Qt.velocitySampleWindow,
|
|
631
|
+
startVelocityThreshold: b?.startVelocityThreshold ?? Qt.startVelocityThreshold
|
|
632
632
|
}),
|
|
633
|
-
[
|
|
634
|
-
),
|
|
635
|
-
top: Math.max(0,
|
|
636
|
-
bottom: Math.max(0,
|
|
637
|
-
}), [
|
|
638
|
-
|
|
633
|
+
[b]
|
|
634
|
+
), mt = yt(() => ({
|
|
635
|
+
top: Math.max(0, Z?.top ?? 0),
|
|
636
|
+
bottom: Math.max(0, Z?.bottom ?? 0)
|
|
637
|
+
}), [Z]);
|
|
638
|
+
dt.debug("[ScrollPane] ScrollPane rendered", {
|
|
639
639
|
contentSize: t,
|
|
640
640
|
viewportSize: e,
|
|
641
|
-
scrollBarWidth:
|
|
641
|
+
scrollBarWidth: n,
|
|
642
642
|
className: d,
|
|
643
|
-
style:
|
|
644
|
-
tapScrollCircleOptions:
|
|
645
|
-
inertiaOptions:
|
|
646
|
-
enablePointerDrag:
|
|
647
|
-
contentInsets:
|
|
643
|
+
style: f,
|
|
644
|
+
tapScrollCircleOptions: R,
|
|
645
|
+
inertiaOptions: b,
|
|
646
|
+
enablePointerDrag: h,
|
|
647
|
+
contentInsets: mt
|
|
648
648
|
});
|
|
649
|
-
const
|
|
650
|
-
(
|
|
651
|
-
const { contentSize:
|
|
652
|
-
if (
|
|
653
|
-
return
|
|
654
|
-
const
|
|
655
|
-
return
|
|
649
|
+
const C = S({ contentSize: t, viewportSize: e }), H = yt(() => t > e, [t, e]), K = T(
|
|
650
|
+
(I) => {
|
|
651
|
+
const { contentSize: D, viewportSize: M } = C.current, et = D > M, L = w.current;
|
|
652
|
+
if (dt.debug("[ScrollPane] scrollTo called", { newPosition: I, contentSize: D, viewportSize: M, currentIsScrollable: et, prevPosition: L }), !et)
|
|
653
|
+
return w.current !== 0 && (w.current = 0, l?.(0, L)), w.current;
|
|
654
|
+
const Mt = typeof I == "function" ? I(w.current) : I, xt = Math.max(D - M, 0), It = ht(Mt, 0, xt);
|
|
655
|
+
return w.current !== It && (w.current = It, l?.(It, L)), w.current;
|
|
656
656
|
},
|
|
657
657
|
[l]
|
|
658
|
-
),
|
|
659
|
-
const
|
|
660
|
-
|
|
661
|
-
}, []),
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
}, [
|
|
665
|
-
const
|
|
666
|
-
(
|
|
667
|
-
if (!
|
|
658
|
+
), O = T(() => {
|
|
659
|
+
const I = J.current;
|
|
660
|
+
I.frame !== null && cancelAnimationFrame(I.frame), I.frame = null, I.velocity = 0, I.lastTimestamp = null;
|
|
661
|
+
}, []), it = S(O);
|
|
662
|
+
X(() => {
|
|
663
|
+
it.current = O;
|
|
664
|
+
}, [O]);
|
|
665
|
+
const v = T(
|
|
666
|
+
(I) => {
|
|
667
|
+
if (!H)
|
|
668
668
|
return;
|
|
669
|
-
const { maxVelocity:
|
|
670
|
-
if (Math.abs(
|
|
669
|
+
const { maxVelocity: D, minVelocity: M, deceleration: et, startVelocityThreshold: L } = _, Mt = ht(I, -D, D);
|
|
670
|
+
if (Math.abs(Mt) < L)
|
|
671
671
|
return;
|
|
672
|
-
|
|
673
|
-
const
|
|
674
|
-
const
|
|
675
|
-
if (
|
|
676
|
-
|
|
672
|
+
O(), J.current.velocity = Mt, J.current.lastTimestamp = null;
|
|
673
|
+
const xt = (It) => {
|
|
674
|
+
const rt = J.current;
|
|
675
|
+
if (rt.lastTimestamp === null) {
|
|
676
|
+
rt.lastTimestamp = It, rt.frame = requestAnimationFrame(xt);
|
|
677
677
|
return;
|
|
678
678
|
}
|
|
679
|
-
const
|
|
680
|
-
if (
|
|
681
|
-
|
|
679
|
+
const lt = It - rt.lastTimestamp;
|
|
680
|
+
if (rt.lastTimestamp = It, lt <= 0) {
|
|
681
|
+
rt.frame = requestAnimationFrame(xt);
|
|
682
682
|
return;
|
|
683
683
|
}
|
|
684
|
-
const
|
|
685
|
-
let
|
|
686
|
-
const
|
|
687
|
-
|
|
688
|
-
const
|
|
689
|
-
|
|
690
|
-
const
|
|
691
|
-
|
|
692
|
-
const
|
|
693
|
-
if (Math.abs(
|
|
694
|
-
|
|
684
|
+
const ut = rt.velocity;
|
|
685
|
+
let gt = ut;
|
|
686
|
+
const Et = et * lt;
|
|
687
|
+
ut > 0 ? gt = Math.max(0, ut - Et) : ut < 0 && (gt = Math.min(0, ut + Et));
|
|
688
|
+
const Pt = (ut + gt) / 2 * lt, g = w.current;
|
|
689
|
+
Pt !== 0 && K((wt) => wt + Pt);
|
|
690
|
+
const P = w.current, { contentSize: ot, viewportSize: W } = C.current, j = Math.max(ot - W, 0);
|
|
691
|
+
rt.velocity = gt;
|
|
692
|
+
const Dt = P === g || P <= 0 && gt <= 0 || P >= j && gt >= 0;
|
|
693
|
+
if (Math.abs(gt) < M || Dt) {
|
|
694
|
+
O();
|
|
695
695
|
return;
|
|
696
696
|
}
|
|
697
|
-
|
|
697
|
+
rt.frame = requestAnimationFrame(xt);
|
|
698
698
|
};
|
|
699
|
-
|
|
699
|
+
J.current.frame = requestAnimationFrame(xt);
|
|
700
700
|
},
|
|
701
|
-
[
|
|
702
|
-
),
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
}, [
|
|
706
|
-
|
|
707
|
-
}, [t, e]),
|
|
708
|
-
const
|
|
709
|
-
if (!
|
|
710
|
-
const
|
|
711
|
-
|
|
701
|
+
[H, _, K, O]
|
|
702
|
+
), vt = S(v);
|
|
703
|
+
X(() => {
|
|
704
|
+
vt.current = v;
|
|
705
|
+
}, [v]), ee(() => {
|
|
706
|
+
C.current = { contentSize: t, viewportSize: e };
|
|
707
|
+
}, [t, e]), ee(() => {
|
|
708
|
+
const I = z.current;
|
|
709
|
+
if (!I) return;
|
|
710
|
+
const D = () => {
|
|
711
|
+
I.scrollTop !== 0 && (dt.debug("[ScrollPane] Native scroll detected, resetting to 0", { scrollTop: I.scrollTop }), I.scrollTop = 0), I.scrollLeft !== 0 && (I.scrollLeft = 0);
|
|
712
712
|
};
|
|
713
|
-
return
|
|
714
|
-
}, []),
|
|
715
|
-
if (
|
|
716
|
-
|
|
717
|
-
const
|
|
718
|
-
|
|
713
|
+
return I.addEventListener("scroll", D), () => I.removeEventListener("scroll", D);
|
|
714
|
+
}, []), ee(() => {
|
|
715
|
+
if (H) {
|
|
716
|
+
dt.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", { contentSize: t, viewportSize: e, scrollPosition: w.current });
|
|
717
|
+
const I = ht(t - e, 0, t);
|
|
718
|
+
w.current > I && K(I);
|
|
719
719
|
} else
|
|
720
|
-
|
|
721
|
-
}, [
|
|
722
|
-
const
|
|
723
|
-
if (!
|
|
720
|
+
K(0);
|
|
721
|
+
}, [H, K, t, e]), X(() => {
|
|
722
|
+
const I = (M) => {
|
|
723
|
+
if (!H)
|
|
724
724
|
return;
|
|
725
|
-
|
|
726
|
-
let
|
|
727
|
-
|
|
728
|
-
},
|
|
729
|
-
return
|
|
730
|
-
|
|
725
|
+
M.preventDefault(), O();
|
|
726
|
+
let et = M.deltaY;
|
|
727
|
+
M.deltaMode === 1 ? et *= 16 : M.deltaMode === 2 && (et *= e), Y !== 1 && (et *= Y), dt.debug("[ScrollPane] wheel event", { deltaY: et, scrollPosition: w.current, wheelSpeedMultiplier: Y, deltaMode: M.deltaMode, scrollTop: z.current?.scrollTop }), K((L) => L + et);
|
|
728
|
+
}, D = $.current;
|
|
729
|
+
return D && D.addEventListener("wheel", I, { passive: !1 }), () => {
|
|
730
|
+
D && D.removeEventListener("wheel", I);
|
|
731
731
|
};
|
|
732
|
-
}, [
|
|
733
|
-
|
|
732
|
+
}, [H, K, O, e, Y]), Ie(
|
|
733
|
+
N,
|
|
734
734
|
() => ({
|
|
735
|
-
scrollTo: (
|
|
736
|
-
getScrollPosition: () =>
|
|
735
|
+
scrollTo: (I) => (O(), K(I)),
|
|
736
|
+
getScrollPosition: () => w.current,
|
|
737
737
|
getContentSize: () => t,
|
|
738
738
|
getViewportSize: () => e
|
|
739
739
|
}),
|
|
740
|
-
[
|
|
740
|
+
[K, t, e, O]
|
|
741
741
|
);
|
|
742
|
-
const
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
}, [
|
|
746
|
-
const
|
|
742
|
+
const y = S(K);
|
|
743
|
+
X(() => {
|
|
744
|
+
y.current = K;
|
|
745
|
+
}, [K]);
|
|
746
|
+
const ct = He(), F = S({
|
|
747
747
|
pointerId: null,
|
|
748
748
|
startClientY: 0,
|
|
749
749
|
startScroll: 0,
|
|
@@ -751,197 +751,197 @@ const xt = (n, t, e) => Math.min(e, Math.max(t, n)), xe = "virtualscroll:tap-scr
|
|
|
751
751
|
shouldCancelNextClick: !1,
|
|
752
752
|
clickResetTimer: null,
|
|
753
753
|
velocitySamples: []
|
|
754
|
-
}),
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
}, [
|
|
758
|
-
const
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
}, [
|
|
762
|
-
const
|
|
763
|
-
return
|
|
764
|
-
|
|
765
|
-
}, [
|
|
766
|
-
if (
|
|
754
|
+
}), bt = S(h);
|
|
755
|
+
X(() => {
|
|
756
|
+
bt.current = h;
|
|
757
|
+
}, [h]);
|
|
758
|
+
const at = S(H);
|
|
759
|
+
X(() => {
|
|
760
|
+
at.current = H;
|
|
761
|
+
}, [H]);
|
|
762
|
+
const At = S(_);
|
|
763
|
+
return X(() => {
|
|
764
|
+
At.current = _;
|
|
765
|
+
}, [_]), X(() => {
|
|
766
|
+
if (h)
|
|
767
767
|
return;
|
|
768
|
-
const
|
|
769
|
-
|
|
770
|
-
}, [
|
|
771
|
-
const
|
|
772
|
-
if (!
|
|
768
|
+
const I = z.current, D = F.current;
|
|
769
|
+
D.pointerId !== null && I && I.hasPointerCapture(D.pointerId) && I.releasePointerCapture(D.pointerId), D.clickResetTimer !== null && (window.clearTimeout(D.clickResetTimer), D.clickResetTimer = null), D.pointerId = null, D.startClientY = 0, D.startScroll = 0, D.isDragging = !1, D.shouldCancelNextClick = !1, D.velocitySamples = [];
|
|
770
|
+
}, [h]), X(() => {
|
|
771
|
+
const I = z.current;
|
|
772
|
+
if (!I)
|
|
773
773
|
return;
|
|
774
|
-
const
|
|
775
|
-
const
|
|
776
|
-
|
|
777
|
-
},
|
|
778
|
-
const
|
|
779
|
-
|
|
780
|
-
},
|
|
781
|
-
const
|
|
782
|
-
|
|
783
|
-
const
|
|
784
|
-
|
|
785
|
-
},
|
|
786
|
-
const
|
|
787
|
-
|
|
788
|
-
},
|
|
789
|
-
const
|
|
790
|
-
|
|
791
|
-
},
|
|
792
|
-
const
|
|
793
|
-
if (
|
|
774
|
+
const D = 6, M = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), et = () => {
|
|
775
|
+
const g = F.current;
|
|
776
|
+
g.pointerId = null, g.startClientY = 0, g.startScroll = 0, g.isDragging = !1, g.velocitySamples = [];
|
|
777
|
+
}, L = () => {
|
|
778
|
+
const g = F.current;
|
|
779
|
+
g.clickResetTimer !== null && (window.clearTimeout(g.clickResetTimer), g.clickResetTimer = null);
|
|
780
|
+
}, Mt = (g) => {
|
|
781
|
+
const P = F.current, ot = M();
|
|
782
|
+
P.velocitySamples.push({ clientY: g, time: ot });
|
|
783
|
+
const W = At.current.velocitySampleWindow;
|
|
784
|
+
P.velocitySamples = P.velocitySamples.filter((j) => ot - j.time <= W);
|
|
785
|
+
}, xt = (g) => g instanceof HTMLElement && g.closest("[data-scrollpane-ignore-drag='true']") !== null, It = (g) => {
|
|
786
|
+
const P = F.current;
|
|
787
|
+
P.shouldCancelNextClick && (g.preventDefault(), g.stopPropagation(), P.shouldCancelNextClick = !1);
|
|
788
|
+
}, rt = (g) => {
|
|
789
|
+
const P = F.current;
|
|
790
|
+
P.isDragging || (P.isDragging = !0, P.shouldCancelNextClick = !0, I.hasPointerCapture(g.pointerId) || I.setPointerCapture(g.pointerId), Mt(g.clientY));
|
|
791
|
+
}, lt = (g) => {
|
|
792
|
+
const P = F.current;
|
|
793
|
+
if (P.pointerId !== g.pointerId || !(bt.current && at.current) || !P.isDragging && (Math.abs(g.clientY - P.startClientY) < D || (rt(g), !P.isDragging)))
|
|
794
794
|
return;
|
|
795
|
-
|
|
796
|
-
const
|
|
797
|
-
|
|
798
|
-
},
|
|
799
|
-
const
|
|
800
|
-
if (
|
|
795
|
+
Mt(g.clientY);
|
|
796
|
+
const ot = g.clientY - P.startClientY, W = P.startScroll - ot;
|
|
797
|
+
y.current(W), g.cancelable && g.preventDefault();
|
|
798
|
+
}, ut = (g) => {
|
|
799
|
+
const P = F.current;
|
|
800
|
+
if (P.pointerId !== g.pointerId)
|
|
801
801
|
return;
|
|
802
|
-
|
|
803
|
-
let
|
|
804
|
-
if (
|
|
805
|
-
const
|
|
806
|
-
if (
|
|
807
|
-
const
|
|
808
|
-
|
|
802
|
+
P.isDragging && P.shouldCancelNextClick && g.cancelable && (g.preventDefault(), g.stopPropagation()), I.hasPointerCapture(g.pointerId) && I.releasePointerCapture(g.pointerId);
|
|
803
|
+
let ot = 0;
|
|
804
|
+
if (P.isDragging && P.velocitySamples.length >= 2) {
|
|
805
|
+
const j = P.velocitySamples, Dt = At.current.velocitySampleWindow, wt = j[j.length - 1], pt = j.find((Ct) => wt.time - Ct.time <= Dt) ?? j[0];
|
|
806
|
+
if (wt && pt && wt.time !== pt.time) {
|
|
807
|
+
const Ct = wt.clientY - pt.clientY, Ht = wt.time - pt.time;
|
|
808
|
+
ot = -(Ct / Ht);
|
|
809
809
|
}
|
|
810
810
|
}
|
|
811
|
-
|
|
812
|
-
const
|
|
813
|
-
|
|
811
|
+
L(), P.shouldCancelNextClick && (P.clickResetTimer = window.setTimeout(() => {
|
|
812
|
+
const j = F.current;
|
|
813
|
+
j.shouldCancelNextClick = !1, j.clickResetTimer = null;
|
|
814
814
|
}, 0));
|
|
815
|
-
const
|
|
816
|
-
|
|
817
|
-
},
|
|
818
|
-
if (!(
|
|
815
|
+
const W = At.current.startVelocityThreshold;
|
|
816
|
+
et(), Math.abs(ot) >= W && vt.current?.(ot);
|
|
817
|
+
}, gt = (g) => {
|
|
818
|
+
if (!(bt.current && at.current) || g.button !== 0 && g.pointerType === "mouse" || g.ctrlKey || g.metaKey || g.altKey || xt(g.target))
|
|
819
819
|
return;
|
|
820
|
-
window.dispatchEvent(new CustomEvent(
|
|
821
|
-
const
|
|
822
|
-
|
|
823
|
-
},
|
|
824
|
-
const
|
|
825
|
-
|
|
826
|
-
},
|
|
827
|
-
["click",
|
|
828
|
-
["pointerdown",
|
|
829
|
-
["pointermove",
|
|
830
|
-
["pointerup",
|
|
831
|
-
["pointercancel",
|
|
832
|
-
],
|
|
833
|
-
["pointermove",
|
|
834
|
-
["pointerup",
|
|
835
|
-
["pointercancel",
|
|
820
|
+
window.dispatchEvent(new CustomEvent(be, { detail: { paneId: ct } })), it.current?.();
|
|
821
|
+
const P = F.current;
|
|
822
|
+
L(), P.pointerId = g.pointerId, P.startClientY = g.clientY, P.startScroll = w.current, P.isDragging = !1, P.shouldCancelNextClick = !1, P.velocitySamples = [];
|
|
823
|
+
}, Et = (g) => {
|
|
824
|
+
const P = F.current;
|
|
825
|
+
P.pointerId === g.pointerId && (P.shouldCancelNextClick = !1, I.hasPointerCapture(g.pointerId) && I.releasePointerCapture(g.pointerId), L(), et());
|
|
826
|
+
}, Xt = [
|
|
827
|
+
["click", It, !0],
|
|
828
|
+
["pointerdown", gt, { passive: !1 }],
|
|
829
|
+
["pointermove", lt, { passive: !1 }],
|
|
830
|
+
["pointerup", ut, void 0],
|
|
831
|
+
["pointercancel", Et, void 0]
|
|
832
|
+
], Pt = [
|
|
833
|
+
["pointermove", lt, { passive: !1 }],
|
|
834
|
+
["pointerup", ut, void 0],
|
|
835
|
+
["pointercancel", Et, void 0]
|
|
836
836
|
];
|
|
837
|
-
return le(
|
|
838
|
-
le(
|
|
839
|
-
const
|
|
840
|
-
|
|
837
|
+
return le(I, Xt, "add"), le(window, Pt, "add"), () => {
|
|
838
|
+
le(I, Xt, "remove"), le(window, Pt, "remove");
|
|
839
|
+
const g = F.current;
|
|
840
|
+
g.pointerId !== null && I.hasPointerCapture(g.pointerId) && I.releasePointerCapture(g.pointerId), L(), et();
|
|
841
841
|
};
|
|
842
|
-
}, [
|
|
843
|
-
/* @__PURE__ */
|
|
842
|
+
}, [ct]), /* @__PURE__ */ Ut("div", { ref: $, className: Wt("relative flex", d), style: f, children: [
|
|
843
|
+
/* @__PURE__ */ Ut(
|
|
844
844
|
"div",
|
|
845
845
|
{
|
|
846
|
-
ref:
|
|
847
|
-
className:
|
|
846
|
+
ref: z,
|
|
847
|
+
className: Wt("relative h-full flex-1 overflow-hidden"),
|
|
848
848
|
style: {
|
|
849
849
|
height: e,
|
|
850
|
-
paddingTop:
|
|
851
|
-
paddingBottom:
|
|
852
|
-
...
|
|
850
|
+
paddingTop: mt.top,
|
|
851
|
+
paddingBottom: mt.bottom,
|
|
852
|
+
...h ? { touchAction: "none" } : {}
|
|
853
853
|
},
|
|
854
|
-
id:
|
|
854
|
+
id: ct,
|
|
855
855
|
children: [
|
|
856
|
-
|
|
857
|
-
|
|
856
|
+
m,
|
|
857
|
+
o(w.current)
|
|
858
858
|
]
|
|
859
859
|
}
|
|
860
860
|
),
|
|
861
|
-
|
|
861
|
+
H && /* @__PURE__ */ B(
|
|
862
862
|
or,
|
|
863
863
|
{
|
|
864
864
|
contentSize: t,
|
|
865
865
|
viewportSize: e,
|
|
866
|
-
scrollPosition:
|
|
867
|
-
onScroll:
|
|
866
|
+
scrollPosition: w.current,
|
|
867
|
+
onScroll: K,
|
|
868
868
|
enableThumbDrag: s,
|
|
869
|
-
enableTrackClick:
|
|
869
|
+
enableTrackClick: c,
|
|
870
870
|
enableArrowButtons: u,
|
|
871
|
-
scrollBarWidth:
|
|
872
|
-
ariaControls:
|
|
873
|
-
tapScrollCircleOptions:
|
|
874
|
-
itemCount:
|
|
871
|
+
scrollBarWidth: n,
|
|
872
|
+
ariaControls: ct,
|
|
873
|
+
tapScrollCircleOptions: R,
|
|
874
|
+
itemCount: A,
|
|
875
875
|
renderThumbOverlay: U,
|
|
876
|
-
visibleStartIndex:
|
|
877
|
-
visibleEndIndex:
|
|
876
|
+
visibleStartIndex: ft,
|
|
877
|
+
visibleEndIndex: nt
|
|
878
878
|
}
|
|
879
879
|
),
|
|
880
|
-
|
|
880
|
+
tt?.()
|
|
881
881
|
] });
|
|
882
882
|
}
|
|
883
|
-
),
|
|
884
|
-
const s = Math.max(
|
|
885
|
-
return /* @__PURE__ */
|
|
886
|
-
/* @__PURE__ */
|
|
883
|
+
), ye = (o, t, e) => Math.min(Math.max(o, t), e), Pr = ({ dragState: o, normalizedDistance: t, sizeScale: e, size: n }) => {
|
|
884
|
+
const s = Math.max(n / 2, 1), c = 1 + t * 0.65, u = Math.max(0.65, 1 - t * 0.25), h = o.direction * t * 26 * e, l = 0.8 + t * 0.18, d = 3 * e, f = 6 * e, m = 22 * e, R = Math.abs(h) + f, b = h > 0 ? d : -Math.abs(h) - d, A = Math.max(2.5, 3 * e), U = ye(o.offsetX, -s, s), Y = ye(o.offsetY, -s, s), Z = s * 0.35, ft = U / s * Z, nt = Y / s * Z, tt = ft * 0.45, N = nt * 0.45, w = Math.max(m * 0.38, 6), $ = 0.65 + t * 0.2, z = o.active;
|
|
885
|
+
return /* @__PURE__ */ Ut(Ce, { children: [
|
|
886
|
+
/* @__PURE__ */ B(
|
|
887
887
|
"div",
|
|
888
888
|
{
|
|
889
889
|
className: "aqvs:tap-scroll-circle-gradient absolute inset-0 rounded-full border border-white/40 shadow-md",
|
|
890
890
|
style: {
|
|
891
|
-
transform: `scale(${u}, ${
|
|
892
|
-
transition:
|
|
891
|
+
transform: `scale(${u}, ${c})`,
|
|
892
|
+
transition: z ? "40ms transform ease-out" : "200ms ease transform"
|
|
893
893
|
}
|
|
894
894
|
}
|
|
895
895
|
),
|
|
896
|
-
/* @__PURE__ */
|
|
896
|
+
/* @__PURE__ */ B(
|
|
897
897
|
"div",
|
|
898
898
|
{
|
|
899
899
|
className: "absolute top-1/2 left-1/2 rounded-full border border-white/50 bg-white/85",
|
|
900
900
|
style: {
|
|
901
|
-
width:
|
|
902
|
-
height:
|
|
903
|
-
transform: `translate(calc(-50% + ${
|
|
904
|
-
transition:
|
|
901
|
+
width: m,
|
|
902
|
+
height: m,
|
|
903
|
+
transform: `translate(calc(-50% + ${ft}px), calc(-50% + ${nt}px)) scale(${u}, ${l * c})`,
|
|
904
|
+
transition: z ? "70ms transform ease-out" : "200ms ease transform"
|
|
905
905
|
}
|
|
906
906
|
}
|
|
907
907
|
),
|
|
908
|
-
/* @__PURE__ */
|
|
908
|
+
/* @__PURE__ */ B(
|
|
909
909
|
"div",
|
|
910
910
|
{
|
|
911
911
|
className: "absolute top-1/2 left-1/2 rounded-full bg-white/80",
|
|
912
912
|
style: {
|
|
913
|
-
width:
|
|
914
|
-
height:
|
|
915
|
-
transform: `translate(calc(-50% + ${
|
|
916
|
-
opacity:
|
|
913
|
+
width: w,
|
|
914
|
+
height: w,
|
|
915
|
+
transform: `translate(calc(-50% + ${tt}px), calc(-50% + ${N}px)) scale(${u}, ${c})`,
|
|
916
|
+
opacity: $,
|
|
917
917
|
boxShadow: "0 0 8px rgba(255,255,255,0.45)",
|
|
918
|
-
transition:
|
|
918
|
+
transition: z ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
|
|
919
919
|
}
|
|
920
920
|
}
|
|
921
921
|
),
|
|
922
|
-
/* @__PURE__ */
|
|
922
|
+
/* @__PURE__ */ B(
|
|
923
923
|
"div",
|
|
924
924
|
{
|
|
925
925
|
className: "absolute top-1/2 left-1/2 rounded-full bg-white/50",
|
|
926
926
|
style: {
|
|
927
|
-
width:
|
|
928
|
-
height:
|
|
929
|
-
transform: `translate(-50%, ${
|
|
927
|
+
width: A,
|
|
928
|
+
height: R,
|
|
929
|
+
transform: `translate(-50%, ${b}px)`,
|
|
930
930
|
opacity: t,
|
|
931
|
-
transition:
|
|
931
|
+
transition: z ? "40ms height, 60ms opacity ease-out ease-out" : "200ms ease height, 120ms ease opacity"
|
|
932
932
|
}
|
|
933
933
|
}
|
|
934
934
|
)
|
|
935
935
|
] });
|
|
936
|
-
}, ir = (
|
|
937
|
-
if (!Number.isFinite(
|
|
936
|
+
}, ir = (o) => {
|
|
937
|
+
if (!Number.isFinite(o))
|
|
938
938
|
return 0n;
|
|
939
|
-
const t = Math.trunc(
|
|
939
|
+
const t = Math.trunc(o);
|
|
940
940
|
return t <= 0 ? 0n : BigInt(t);
|
|
941
|
-
}, ce = (
|
|
942
|
-
if (
|
|
941
|
+
}, ce = (o) => {
|
|
942
|
+
if (o <= 0 || !Number.isFinite(o))
|
|
943
943
|
return 0;
|
|
944
|
-
const t = Math.trunc(
|
|
944
|
+
const t = Math.trunc(o), e = BigInt(t) & -BigInt(t);
|
|
945
945
|
return Number(e);
|
|
946
946
|
};
|
|
947
947
|
class ar {
|
|
@@ -984,8 +984,8 @@ class ar {
|
|
|
984
984
|
* @param {number | ((index: number) => number)} valueOrFn - The value for all elements, or a function to generate values.
|
|
985
985
|
* @param {{ sampleRange?: { from: number; to: number }, materialize?: boolean }} [options] - Optional settings for initialization.
|
|
986
986
|
*/
|
|
987
|
-
constructor(t, e,
|
|
988
|
-
this.reset(t, e,
|
|
987
|
+
constructor(t, e, n) {
|
|
988
|
+
this.reset(t, e, n);
|
|
989
989
|
}
|
|
990
990
|
/**
|
|
991
991
|
* @method reset
|
|
@@ -995,20 +995,20 @@ class ar {
|
|
|
995
995
|
* @param {number | ((index: number) => number)} valueOrFn - The value for all elements, or a function to generate values.
|
|
996
996
|
* @param {{ sampleRange?: { from: number; to: number }, materialize?: boolean }} [options] - Optional settings for initialization.
|
|
997
997
|
*/
|
|
998
|
-
reset(t, e,
|
|
998
|
+
reset(t, e, n) {
|
|
999
999
|
if (this.size = t, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.total = void 0, typeof e == "function") {
|
|
1000
1000
|
if (this.valueFn = e, this.size > 0) {
|
|
1001
|
-
const
|
|
1001
|
+
const c = n?.sampleRange ?? {
|
|
1002
1002
|
from: 0,
|
|
1003
1003
|
to: Math.min(99, this.size - 1)
|
|
1004
|
-
}, { mode: u, materializedValues:
|
|
1005
|
-
if (this.baseValue = u,
|
|
1006
|
-
for (let l = 0; l <
|
|
1007
|
-
const d =
|
|
1008
|
-
if (
|
|
1004
|
+
}, { mode: u, materializedValues: h } = this._calculateMode(c.from, c.to);
|
|
1005
|
+
if (this.baseValue = u, n?.materialize)
|
|
1006
|
+
for (let l = 0; l < h.length; l++) {
|
|
1007
|
+
const d = h[l], f = c.from + l;
|
|
1008
|
+
if (f >= this.size)
|
|
1009
1009
|
break;
|
|
1010
|
-
const
|
|
1011
|
-
this.deltas.set(
|
|
1010
|
+
const m = d - this.baseValue;
|
|
1011
|
+
this.deltas.set(f, m), this._updateTree(f, m);
|
|
1012
1012
|
}
|
|
1013
1013
|
} else
|
|
1014
1014
|
this.baseValue = 0;
|
|
@@ -1021,8 +1021,13 @@ class ar {
|
|
|
1021
1021
|
* @description Updates the value function and re-initializes the tree.
|
|
1022
1022
|
* @description 値関数を更新し、ツリーを再初期化する。
|
|
1023
1023
|
* @param {number | ((index: number) => number)} valueOrFn - The new value for all elements, or a function to generate values.
|
|
1024
|
+
* @param {{ reset?: boolean }} [options] - Optional settings. If reset is true, the tree is reset with the new value function.
|
|
1024
1025
|
*/
|
|
1025
|
-
setValueFn(t) {
|
|
1026
|
+
setValueFn(t, e) {
|
|
1027
|
+
if (e?.reset) {
|
|
1028
|
+
this.reset(this.size, t);
|
|
1029
|
+
return;
|
|
1030
|
+
}
|
|
1026
1031
|
typeof t == "function" ? this.valueFn = t : (this.valueFn = void 0, this.baseValue = t);
|
|
1027
1032
|
}
|
|
1028
1033
|
/**
|
|
@@ -1037,28 +1042,28 @@ class ar {
|
|
|
1037
1042
|
_calculateMode(t, e) {
|
|
1038
1043
|
if (!this.valueFn)
|
|
1039
1044
|
return { mode: 0, materializedValues: [] };
|
|
1040
|
-
const
|
|
1045
|
+
const n = [];
|
|
1041
1046
|
for (let d = t; d <= e && !(d >= this.size); d++)
|
|
1042
|
-
|
|
1043
|
-
const s = [...
|
|
1044
|
-
if (
|
|
1047
|
+
n.push(this.valueFn(d));
|
|
1048
|
+
const s = [...n];
|
|
1049
|
+
if (n.length === 0)
|
|
1045
1050
|
return { mode: 0, materializedValues: [] };
|
|
1046
|
-
|
|
1047
|
-
const
|
|
1051
|
+
n.sort((d, f) => d - f);
|
|
1052
|
+
const c = Math.floor(n.length / 2);
|
|
1048
1053
|
let u;
|
|
1049
|
-
|
|
1050
|
-
const
|
|
1054
|
+
n.length % 2 === 0 ? u = Math.floor((n[c - 1] + n[c]) / 2) : u = n[c];
|
|
1055
|
+
const h = /* @__PURE__ */ new Map();
|
|
1051
1056
|
let l = 0;
|
|
1052
|
-
for (const d of
|
|
1053
|
-
const
|
|
1054
|
-
|
|
1057
|
+
for (const d of n) {
|
|
1058
|
+
const f = (h.get(d) ?? 0) + 1;
|
|
1059
|
+
h.set(d, f), f > l && (l = f);
|
|
1055
1060
|
}
|
|
1056
|
-
if (l >
|
|
1061
|
+
if (l > n.length * 0.2) {
|
|
1057
1062
|
const d = [];
|
|
1058
|
-
for (const [
|
|
1059
|
-
|
|
1060
|
-
const
|
|
1061
|
-
u = Math.floor(
|
|
1063
|
+
for (const [m, R] of h.entries())
|
|
1064
|
+
R === l && d.push(m);
|
|
1065
|
+
const f = d.reduce((m, R) => m + R, 0);
|
|
1066
|
+
u = Math.floor(f / d.length);
|
|
1062
1067
|
}
|
|
1063
1068
|
return { mode: u, materializedValues: s };
|
|
1064
1069
|
}
|
|
@@ -1099,11 +1104,11 @@ class ar {
|
|
|
1099
1104
|
* @param {DeltaUpdate[]} updates - An array of updates, each with an index and the change to apply.
|
|
1100
1105
|
*/
|
|
1101
1106
|
updateDeltas(t) {
|
|
1102
|
-
for (const { index: e, change:
|
|
1107
|
+
for (const { index: e, change: n } of t) {
|
|
1103
1108
|
if (e < 0 || e >= this.size)
|
|
1104
1109
|
throw new Error(`Index ${e} out of bounds`);
|
|
1105
1110
|
const s = this.deltas.get(e) ?? 0;
|
|
1106
|
-
this.deltas.set(e, s +
|
|
1111
|
+
this.deltas.set(e, s + n), this._updateTree(e, n);
|
|
1107
1112
|
}
|
|
1108
1113
|
return this.total;
|
|
1109
1114
|
}
|
|
@@ -1118,13 +1123,13 @@ class ar {
|
|
|
1118
1123
|
_updateTree(t, e) {
|
|
1119
1124
|
if (e === 0)
|
|
1120
1125
|
return;
|
|
1121
|
-
let
|
|
1122
|
-
for (;
|
|
1123
|
-
this.tree.set(
|
|
1124
|
-
const s = ce(
|
|
1126
|
+
let n = t + 1;
|
|
1127
|
+
for (; n <= this.size; ) {
|
|
1128
|
+
this.tree.set(n, (this.tree.get(n) ?? 0) + e);
|
|
1129
|
+
const s = ce(n);
|
|
1125
1130
|
if (s === 0)
|
|
1126
1131
|
break;
|
|
1127
|
-
|
|
1132
|
+
n += s;
|
|
1128
1133
|
}
|
|
1129
1134
|
this.total !== void 0 && (this.total += e);
|
|
1130
1135
|
}
|
|
@@ -1138,13 +1143,13 @@ class ar {
|
|
|
1138
1143
|
*/
|
|
1139
1144
|
_buildDeltaUpdates(t) {
|
|
1140
1145
|
const e = [];
|
|
1141
|
-
for (const { index:
|
|
1142
|
-
if (
|
|
1143
|
-
throw new Error(`Index ${
|
|
1146
|
+
for (const { index: n, value: s } of t) {
|
|
1147
|
+
if (n < 0 || n >= this.size)
|
|
1148
|
+
throw new Error(`Index ${n} out of bounds`);
|
|
1144
1149
|
if (s < 0)
|
|
1145
1150
|
throw new Error("Value cannot be negative.");
|
|
1146
|
-
const
|
|
1147
|
-
u !== 0 && e.push({ index:
|
|
1151
|
+
const c = this.deltas.has(n) ? (this.deltas.get(n) ?? 0) + this.baseValue : this.baseValue, u = s - c;
|
|
1152
|
+
u !== 0 && e.push({ index: n, change: u });
|
|
1148
1153
|
}
|
|
1149
1154
|
return e;
|
|
1150
1155
|
}
|
|
@@ -1161,10 +1166,10 @@ class ar {
|
|
|
1161
1166
|
let t = 0, e = this.size;
|
|
1162
1167
|
for (; e > 0; ) {
|
|
1163
1168
|
t += this.tree.get(e) ?? 0;
|
|
1164
|
-
const
|
|
1165
|
-
if (
|
|
1169
|
+
const n = ce(e);
|
|
1170
|
+
if (n === 0)
|
|
1166
1171
|
break;
|
|
1167
|
-
e -=
|
|
1172
|
+
e -= n;
|
|
1168
1173
|
}
|
|
1169
1174
|
return t + this.baseValue * this.size;
|
|
1170
1175
|
}
|
|
@@ -1178,9 +1183,9 @@ class ar {
|
|
|
1178
1183
|
*/
|
|
1179
1184
|
_materialize(t, e = !0) {
|
|
1180
1185
|
if (this.valueFn) {
|
|
1181
|
-
const
|
|
1182
|
-
if (
|
|
1183
|
-
const u =
|
|
1186
|
+
const n = this.deltas.get(t) ?? 0, c = this.valueFn(t) - this.baseValue;
|
|
1187
|
+
if (c !== n && (this.deltas.set(t, c), e)) {
|
|
1188
|
+
const u = c - n;
|
|
1184
1189
|
this._updateTree(t, u);
|
|
1185
1190
|
}
|
|
1186
1191
|
}
|
|
@@ -1194,24 +1199,24 @@ class ar {
|
|
|
1194
1199
|
* @param {number | undefined} index - Target index for materialization.
|
|
1195
1200
|
* @param {boolean} [forceIndex=false] - When true, materializes the index even if it is outside the provided ranges.
|
|
1196
1201
|
*/
|
|
1197
|
-
_materializeRanges(t, e,
|
|
1202
|
+
_materializeRanges(t, e, n = !1) {
|
|
1198
1203
|
if (!(t?.materialize && this.valueFn))
|
|
1199
1204
|
return;
|
|
1200
1205
|
const s = t.ranges;
|
|
1201
1206
|
if (s && s.length > 0) {
|
|
1202
|
-
for (const
|
|
1203
|
-
const l =
|
|
1204
|
-
for (let
|
|
1205
|
-
this._materialize(
|
|
1207
|
+
for (const h of s) {
|
|
1208
|
+
const l = h.from, d = Math.min(h.to, this.size - 1);
|
|
1209
|
+
for (let f = l; f <= d; f++)
|
|
1210
|
+
this._materialize(f);
|
|
1206
1211
|
}
|
|
1207
1212
|
if (e === void 0)
|
|
1208
1213
|
return;
|
|
1209
|
-
if (
|
|
1214
|
+
if (n) {
|
|
1210
1215
|
this._materialize(e);
|
|
1211
1216
|
return;
|
|
1212
1217
|
}
|
|
1213
|
-
const
|
|
1214
|
-
e >=
|
|
1218
|
+
const c = s[0].from, u = s[s.length - 1].to;
|
|
1219
|
+
e >= c && e <= u && this._materialize(e);
|
|
1215
1220
|
return;
|
|
1216
1221
|
}
|
|
1217
1222
|
e !== void 0 && this._materialize(e);
|
|
@@ -1226,55 +1231,69 @@ class ar {
|
|
|
1226
1231
|
* @param {boolean} chooseLowerBound - When true, finds the smallest index meeting or exceeding the target; otherwise finds the largest index not exceeding it.
|
|
1227
1232
|
* @returns {{ index: number; total: number | undefined; cumulative: number | undefined; currentValue: number | undefined; safeIndex: number | undefined }} Binary search result.
|
|
1228
1233
|
*/
|
|
1229
|
-
_findIndex(t, e = {},
|
|
1234
|
+
_findIndex(t, e = {}, n) {
|
|
1230
1235
|
if (this.size >= Number.MAX_SAFE_INTEGER)
|
|
1231
|
-
return this._findIndexLarge(t, e,
|
|
1236
|
+
return this._findIndexLarge(t, e, n);
|
|
1232
1237
|
if (this.size === 0)
|
|
1233
1238
|
return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1234
|
-
let s = 0,
|
|
1235
|
-
for (;
|
|
1236
|
-
|
|
1237
|
-
|
|
1239
|
+
let s = 0, c = 0, u = 1;
|
|
1240
|
+
for (; u << 1 <= this.size; )
|
|
1241
|
+
u <<= 1;
|
|
1242
|
+
for (; u > 0; u >>= 1) {
|
|
1243
|
+
const d = s + u;
|
|
1244
|
+
if (d <= this.size) {
|
|
1245
|
+
const m = (this.tree.get(d) ?? 0) + this.baseValue * u;
|
|
1246
|
+
(n ? c + m < t : c + m <= t) && (s = d, c += m);
|
|
1247
|
+
}
|
|
1238
1248
|
}
|
|
1239
|
-
const
|
|
1240
|
-
|
|
1249
|
+
const h = n ? s : s - 1;
|
|
1250
|
+
if (h < 0 || h >= this.size)
|
|
1251
|
+
return { index: -1, total: this.total ?? this.getTotal(), cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1252
|
+
const l = this.prefixSum(h, e);
|
|
1253
|
+
return {
|
|
1254
|
+
index: h,
|
|
1255
|
+
total: this.total ?? l.total,
|
|
1256
|
+
cumulative: l.cumulative,
|
|
1257
|
+
currentValue: l.currentValue,
|
|
1258
|
+
safeIndex: l.safeIndex
|
|
1259
|
+
};
|
|
1241
1260
|
}
|
|
1242
1261
|
/**
|
|
1243
1262
|
* Executes a binary search using bigint arithmetic for extremely large sizes.
|
|
1244
1263
|
*
|
|
1245
1264
|
* 非常に大きなサイズに対して bigint 演算を用いた二分探索を実施。
|
|
1246
1265
|
*/
|
|
1247
|
-
_findIndexLarge(t, e,
|
|
1266
|
+
_findIndexLarge(t, e, n) {
|
|
1248
1267
|
if (this.size === 0)
|
|
1249
1268
|
return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1250
1269
|
const s = ir(this.size);
|
|
1251
1270
|
if (s === 0n)
|
|
1252
1271
|
return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1253
|
-
let
|
|
1254
|
-
for (;
|
|
1255
|
-
const
|
|
1256
|
-
if (d = U,
|
|
1257
|
-
if (
|
|
1258
|
-
if (
|
|
1272
|
+
let c = 0n, u = s - 1n, h, l, d, f = this.total;
|
|
1273
|
+
for (; c <= u; ) {
|
|
1274
|
+
const b = c + u >> 1n, A = Number(b), U = this.prefixSum(A, e);
|
|
1275
|
+
if (d = U, f = U.total, n ? U.cumulative >= t : U.cumulative <= t)
|
|
1276
|
+
if (h = b, l = U, n) {
|
|
1277
|
+
if (b === 0n)
|
|
1259
1278
|
break;
|
|
1260
|
-
u =
|
|
1279
|
+
u = b - 1n;
|
|
1261
1280
|
} else
|
|
1262
|
-
|
|
1263
|
-
else if (
|
|
1264
|
-
|
|
1281
|
+
c = b + 1n;
|
|
1282
|
+
else if (n)
|
|
1283
|
+
c = b + 1n;
|
|
1265
1284
|
else {
|
|
1266
|
-
if (
|
|
1285
|
+
if (b === 0n)
|
|
1267
1286
|
break;
|
|
1268
|
-
u =
|
|
1287
|
+
u = b - 1n;
|
|
1269
1288
|
}
|
|
1270
1289
|
}
|
|
1271
|
-
const
|
|
1290
|
+
const m = l ?? d;
|
|
1272
1291
|
return {
|
|
1273
|
-
index:
|
|
1274
|
-
total:
|
|
1275
|
-
cumulative:
|
|
1276
|
-
currentValue:
|
|
1277
|
-
safeIndex:
|
|
1292
|
+
index: h !== void 0 ? Number(h) : -1,
|
|
1293
|
+
total: f,
|
|
1294
|
+
cumulative: m?.cumulative,
|
|
1295
|
+
currentValue: m?.currentValue,
|
|
1296
|
+
safeIndex: m?.safeIndex
|
|
1278
1297
|
};
|
|
1279
1298
|
}
|
|
1280
1299
|
/**
|
|
@@ -1288,19 +1307,19 @@ class ar {
|
|
|
1288
1307
|
prefixSum(t, e) {
|
|
1289
1308
|
if (t < 0)
|
|
1290
1309
|
return { cumulative: 0, total: this.total, currentValue: 0, safeIndex: 0 };
|
|
1291
|
-
const
|
|
1292
|
-
this._materializeRanges(s,
|
|
1293
|
-
let
|
|
1310
|
+
const n = ht(t, 0, this.size - 1), s = e?.materializeOption;
|
|
1311
|
+
this._materializeRanges(s, n, !0);
|
|
1312
|
+
let c = 0, u = n + 1;
|
|
1294
1313
|
for (; u > 0; ) {
|
|
1295
1314
|
const l = this.tree.get(u) ?? 0;
|
|
1296
|
-
|
|
1315
|
+
c += l;
|
|
1297
1316
|
const d = ce(u);
|
|
1298
1317
|
if (d === 0)
|
|
1299
1318
|
break;
|
|
1300
1319
|
u -= d;
|
|
1301
1320
|
}
|
|
1302
|
-
const
|
|
1303
|
-
return { cumulative:
|
|
1321
|
+
const h = s?.materialize ? this.get(n) : (this.deltas.get(n) || 0) + this.baseValue;
|
|
1322
|
+
return { cumulative: c + this.baseValue * (n + 1), total: this.total, currentValue: h, safeIndex: n };
|
|
1304
1323
|
}
|
|
1305
1324
|
/**
|
|
1306
1325
|
* @method get
|
|
@@ -1313,8 +1332,8 @@ class ar {
|
|
|
1313
1332
|
get(t, e) {
|
|
1314
1333
|
if (t < 0 || t >= this.size)
|
|
1315
1334
|
throw new Error("Index out of bounds");
|
|
1316
|
-
const
|
|
1317
|
-
return this._materializeRanges(
|
|
1335
|
+
const n = e?.materializeOption;
|
|
1336
|
+
return this._materializeRanges(n, t), (this.deltas.get(t) ?? 0) + this.baseValue;
|
|
1318
1337
|
}
|
|
1319
1338
|
/**
|
|
1320
1339
|
* @method getTotal
|
|
@@ -1330,8 +1349,8 @@ class ar {
|
|
|
1330
1349
|
this.total = 0;
|
|
1331
1350
|
else {
|
|
1332
1351
|
this.total = this._computeTreeTotal();
|
|
1333
|
-
const
|
|
1334
|
-
console.assert(
|
|
1352
|
+
const n = this.prefixSum(this.getSize() - 1);
|
|
1353
|
+
console.assert(n.cumulative === n.total, "Inconsistent Fenwick Tree state");
|
|
1335
1354
|
}
|
|
1336
1355
|
return this.total;
|
|
1337
1356
|
}
|
|
@@ -1344,21 +1363,21 @@ class ar {
|
|
|
1344
1363
|
*/
|
|
1345
1364
|
rebuildTree(t) {
|
|
1346
1365
|
if (t?.materialize && this.valueFn) {
|
|
1347
|
-
const
|
|
1348
|
-
this.reset(this.size, (s) =>
|
|
1366
|
+
const n = this.valueFn;
|
|
1367
|
+
this.reset(this.size, (s) => n(s), { materialize: !0 });
|
|
1349
1368
|
return;
|
|
1350
1369
|
}
|
|
1351
1370
|
const e = /* @__PURE__ */ new Map();
|
|
1352
|
-
for (const [
|
|
1371
|
+
for (const [n, s] of this.deltas.entries()) {
|
|
1353
1372
|
if (s === 0)
|
|
1354
1373
|
continue;
|
|
1355
|
-
let
|
|
1356
|
-
for (;
|
|
1357
|
-
e.set(
|
|
1358
|
-
const u = ce(
|
|
1374
|
+
let c = n + 1;
|
|
1375
|
+
for (; c <= this.size; ) {
|
|
1376
|
+
e.set(c, (e.get(c) ?? 0) + s);
|
|
1377
|
+
const u = ce(c);
|
|
1359
1378
|
if (u === 0)
|
|
1360
1379
|
break;
|
|
1361
|
-
|
|
1380
|
+
c += u;
|
|
1362
1381
|
}
|
|
1363
1382
|
}
|
|
1364
1383
|
this.tree = e, this.total = this._computeTreeTotal();
|
|
@@ -1391,8 +1410,8 @@ class ar {
|
|
|
1391
1410
|
for (const s of this.deltas.keys())
|
|
1392
1411
|
s >= t && this.deltas.delete(s);
|
|
1393
1412
|
this.size = t, this.rebuildTree();
|
|
1394
|
-
const
|
|
1395
|
-
console.assert(
|
|
1413
|
+
const n = this.prefixSum(this.getSize() - 1);
|
|
1414
|
+
console.assert(n.cumulative === n.total, "Inconsistent Fenwick Tree state");
|
|
1396
1415
|
}
|
|
1397
1416
|
/**
|
|
1398
1417
|
* @method getSize
|
|
@@ -1432,9 +1451,9 @@ class ar {
|
|
|
1432
1451
|
return this._findIndex(t, e ?? {}, !1);
|
|
1433
1452
|
}
|
|
1434
1453
|
}
|
|
1435
|
-
const lr = (
|
|
1436
|
-
const
|
|
1437
|
-
return Object.is(s.current,
|
|
1454
|
+
const lr = (o, t, e) => {
|
|
1455
|
+
const n = Math.max(0, o), s = S(null), c = yt(() => new ar(n, t, e), [n, t, e]);
|
|
1456
|
+
return Object.is(s.current, c) || console.warn("[useFenwickMapTree] instance changed"), s.current = c, c;
|
|
1438
1457
|
};
|
|
1439
1458
|
class cr {
|
|
1440
1459
|
key;
|
|
@@ -1445,7 +1464,7 @@ class cr {
|
|
|
1445
1464
|
this.key = t, this.value = e;
|
|
1446
1465
|
}
|
|
1447
1466
|
}
|
|
1448
|
-
class
|
|
1467
|
+
class Me {
|
|
1449
1468
|
head = null;
|
|
1450
1469
|
tail = null;
|
|
1451
1470
|
/**
|
|
@@ -1486,137 +1505,139 @@ class ye {
|
|
|
1486
1505
|
this.remove(t), this.addToTail(t);
|
|
1487
1506
|
}
|
|
1488
1507
|
}
|
|
1489
|
-
function ur(
|
|
1490
|
-
const t =
|
|
1491
|
-
|
|
1492
|
-
for (; t.current.size >
|
|
1493
|
-
const
|
|
1494
|
-
if (
|
|
1495
|
-
t.current.delete(
|
|
1508
|
+
function ur(o) {
|
|
1509
|
+
const t = S(/* @__PURE__ */ new Map()), e = S(new Me());
|
|
1510
|
+
X(() => {
|
|
1511
|
+
for (; t.current.size > o; ) {
|
|
1512
|
+
const f = e.current.removeHead();
|
|
1513
|
+
if (f)
|
|
1514
|
+
t.current.delete(f.key);
|
|
1496
1515
|
else
|
|
1497
1516
|
break;
|
|
1498
1517
|
}
|
|
1499
|
-
}, [
|
|
1500
|
-
const
|
|
1501
|
-
const
|
|
1502
|
-
if (
|
|
1503
|
-
return e.current.moveToTail(
|
|
1504
|
-
}, []), s =
|
|
1505
|
-
(
|
|
1506
|
-
if (
|
|
1518
|
+
}, [o]);
|
|
1519
|
+
const n = T((f) => {
|
|
1520
|
+
const m = t.current.get(f);
|
|
1521
|
+
if (m)
|
|
1522
|
+
return e.current.moveToTail(m), m.value;
|
|
1523
|
+
}, []), s = T(
|
|
1524
|
+
(f, m) => {
|
|
1525
|
+
if (o <= 0)
|
|
1507
1526
|
return;
|
|
1508
|
-
let
|
|
1509
|
-
if (
|
|
1510
|
-
|
|
1527
|
+
let R = t.current.get(f);
|
|
1528
|
+
if (R)
|
|
1529
|
+
R.value = m, e.current.moveToTail(R);
|
|
1511
1530
|
else {
|
|
1512
|
-
if (t.current.size >=
|
|
1513
|
-
const
|
|
1514
|
-
|
|
1531
|
+
if (t.current.size >= o) {
|
|
1532
|
+
const b = e.current.removeHead();
|
|
1533
|
+
b && t.current.delete(b.key);
|
|
1515
1534
|
}
|
|
1516
|
-
|
|
1535
|
+
R = new cr(f, m), t.current.set(f, R), e.current.addToTail(R);
|
|
1517
1536
|
}
|
|
1518
1537
|
},
|
|
1519
|
-
[
|
|
1520
|
-
),
|
|
1521
|
-
const
|
|
1522
|
-
|
|
1523
|
-
}, []),
|
|
1524
|
-
t.current.clear(), e.current = new
|
|
1525
|
-
}, []), [l, d] =
|
|
1526
|
-
return
|
|
1538
|
+
[o]
|
|
1539
|
+
), c = T((f) => t.current.has(f), []), u = T((f) => {
|
|
1540
|
+
const m = t.current.get(f);
|
|
1541
|
+
m && (e.current.remove(m), t.current.delete(f));
|
|
1542
|
+
}, []), h = T(() => {
|
|
1543
|
+
t.current.clear(), e.current = new Me();
|
|
1544
|
+
}, []), [l, d] = Vt(() => ({ get: n, set: s, has: c, remove: u, clear: h }));
|
|
1545
|
+
return X(() => d({ get: n, set: s, has: c, remove: u, clear: h }), [n, s, c, u, h]), l;
|
|
1527
1546
|
}
|
|
1528
|
-
const dr = 1e4,
|
|
1529
|
-
const { get:
|
|
1530
|
-
return { get:
|
|
1531
|
-
},
|
|
1532
|
-
top: Math.max(0,
|
|
1533
|
-
bottom: Math.max(0,
|
|
1534
|
-
}),
|
|
1535
|
-
if (!Number.isFinite(
|
|
1547
|
+
const dr = 1e4, Sr = () => {
|
|
1548
|
+
const { get: o, set: t, has: e, clear: n } = ur(dr);
|
|
1549
|
+
return { get: o, set: t, has: e, clear: n };
|
|
1550
|
+
}, st = (o, t) => t <= 0 ? 0 : ht(o, 0, t - 1), fr = (o) => ({
|
|
1551
|
+
top: Math.max(0, o?.top ?? 0),
|
|
1552
|
+
bottom: Math.max(0, o?.bottom ?? 0)
|
|
1553
|
+
}), qt = (o, t) => o <= t ? 0 : o - t, te = (o, t) => o <= 0 ? t : o + t, ge = (o) => {
|
|
1554
|
+
if (!Number.isFinite(o))
|
|
1536
1555
|
return 0n;
|
|
1537
|
-
const t = Math.trunc(
|
|
1556
|
+
const t = Math.trunc(o);
|
|
1538
1557
|
return t <= 0 ? 0n : BigInt(t);
|
|
1539
|
-
},
|
|
1540
|
-
const l =
|
|
1558
|
+
}, mr = (o, t, e, n, s, c, u, h) => {
|
|
1559
|
+
const l = ge(n);
|
|
1541
1560
|
if (l === 0n)
|
|
1542
1561
|
return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
|
|
1543
|
-
const d = (
|
|
1544
|
-
let
|
|
1545
|
-
|
|
1546
|
-
const
|
|
1547
|
-
let
|
|
1548
|
-
for (;
|
|
1549
|
-
const
|
|
1550
|
-
if (
|
|
1562
|
+
const d = (N) => N < 0n ? 0n : N >= l ? l - 1n : N, f = { materializeOption: { materialize: !1 } }, { index: m, cumulative: R } = c.findIndexAtOrAfter(o, f);
|
|
1563
|
+
let b;
|
|
1564
|
+
m === -1 ? b = l - 1n : (R === o ? b = ge(m + 1) : b = ge(m), b >= l && (b = l - 1n)), o <= 0 && (b = 0n), h && o >= u && (b = l - 1n);
|
|
1565
|
+
const A = (N) => {
|
|
1566
|
+
let w = 0, $ = N, z = N, J = 0n;
|
|
1567
|
+
for (; $ < l && w < t; ) {
|
|
1568
|
+
const _ = Number($), mt = s(_);
|
|
1569
|
+
if (w += mt, z = $, $ += 1n, J += 1n, !Number.isFinite(mt) || mt <= 0)
|
|
1551
1570
|
break;
|
|
1552
1571
|
}
|
|
1553
|
-
return
|
|
1572
|
+
return J === 0n && (z = N), { height: w, end: z };
|
|
1554
1573
|
};
|
|
1555
|
-
let { height:
|
|
1556
|
-
if (
|
|
1557
|
-
let
|
|
1558
|
-
for (;
|
|
1559
|
-
|
|
1560
|
-
const
|
|
1561
|
-
if (
|
|
1574
|
+
let { height: U, end: Y } = A(b);
|
|
1575
|
+
if (U < t && b > 0n) {
|
|
1576
|
+
let N = b, w = U;
|
|
1577
|
+
for (; N > 0n && w < t; ) {
|
|
1578
|
+
N -= 1n;
|
|
1579
|
+
const z = Number(N), J = s(z);
|
|
1580
|
+
if (w += J, !Number.isFinite(J) || J <= 0)
|
|
1562
1581
|
break;
|
|
1563
1582
|
}
|
|
1564
|
-
|
|
1565
|
-
const
|
|
1566
|
-
|
|
1583
|
+
b = d(N);
|
|
1584
|
+
const $ = A(b);
|
|
1585
|
+
U = $.height, Y = $.end;
|
|
1567
1586
|
}
|
|
1568
|
-
const
|
|
1587
|
+
const Z = d(b), ft = d(Y), nt = d(Z - BigInt(Math.max(0, e))), tt = d(ft + BigInt(Math.max(0, e)));
|
|
1569
1588
|
return {
|
|
1570
|
-
renderingStartIndex:
|
|
1571
|
-
renderingEndIndex:
|
|
1572
|
-
visibleStartIndex:
|
|
1573
|
-
visibleEndIndex:
|
|
1589
|
+
renderingStartIndex: st(Number(nt), n),
|
|
1590
|
+
renderingEndIndex: st(Number(tt), n),
|
|
1591
|
+
visibleStartIndex: st(Number(Z), n),
|
|
1592
|
+
visibleEndIndex: st(Number(ft), n)
|
|
1574
1593
|
};
|
|
1575
|
-
},
|
|
1576
|
-
if (
|
|
1594
|
+
}, pr = (o, t, e, n, s, c, u) => {
|
|
1595
|
+
if (n === 0)
|
|
1577
1596
|
return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
|
|
1578
|
-
const
|
|
1579
|
-
if (
|
|
1580
|
-
return
|
|
1581
|
-
const { index: d, cumulative:
|
|
1582
|
-
let
|
|
1583
|
-
if (
|
|
1584
|
-
|
|
1597
|
+
const h = Number.isFinite(u), l = h ? Math.min(Math.max(0, o), u) : Math.max(0, o);
|
|
1598
|
+
if (n >= Number.MAX_SAFE_INTEGER)
|
|
1599
|
+
return mr(l, t, e, n, s, c, u, h);
|
|
1600
|
+
const { index: d, cumulative: f, currentValue: m } = c.findIndexAtOrAfter(l, { materializeOption: { materialize: !1 } }), R = d === -1 ? t <= 0 || (f ?? 0) < l + (m ?? 0) ? n - 1 : 0 : d;
|
|
1601
|
+
let b = st(R, n), A = 0;
|
|
1602
|
+
if (d !== -1 && f === l)
|
|
1603
|
+
b = st(d + 1, n), A = 0;
|
|
1604
|
+
else if (b === d && f !== void 0 && m !== void 0)
|
|
1605
|
+
A = f - m - l;
|
|
1585
1606
|
else {
|
|
1586
|
-
const { cumulative:
|
|
1587
|
-
|
|
1607
|
+
const { cumulative: tt, currentValue: N } = c.prefixSum(b, { materializeOption: { materialize: !1 } });
|
|
1608
|
+
A = (tt ?? 0) - (N ?? 0) - l;
|
|
1588
1609
|
}
|
|
1589
|
-
const U =
|
|
1590
|
-
let
|
|
1591
|
-
for (;
|
|
1592
|
-
|
|
1593
|
-
if (
|
|
1594
|
-
let
|
|
1595
|
-
for (;
|
|
1596
|
-
|
|
1597
|
-
for (
|
|
1598
|
-
|
|
1610
|
+
const U = A;
|
|
1611
|
+
let Y = b;
|
|
1612
|
+
for (; Y < n && A < t; )
|
|
1613
|
+
A += s(Y), Y++;
|
|
1614
|
+
if (A < t && b > 0) {
|
|
1615
|
+
let tt = A + Math.abs(Math.min(0, U)), N = b - 1;
|
|
1616
|
+
for (; N >= 0 && tt < t; )
|
|
1617
|
+
tt += s(N), N--;
|
|
1618
|
+
for (b = st(N + 1, n), A = 0, Y = b; Y < n && A < t; )
|
|
1619
|
+
A += s(Y), Y++;
|
|
1599
1620
|
}
|
|
1600
|
-
const
|
|
1601
|
-
return { renderingStartIndex:
|
|
1602
|
-
}, hr = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(),
|
|
1603
|
-
const
|
|
1621
|
+
const Z = st(b - e, n), ft = st(Math.max(Y - 1, b), n), nt = st(ft + e, n);
|
|
1622
|
+
return { renderingStartIndex: Z, renderingEndIndex: nt, visibleStartIndex: b, visibleEndIndex: ft };
|
|
1623
|
+
}, hr = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), we = (o, t, e) => {
|
|
1624
|
+
const n = Math.max(0, t ?? 0), s = S({
|
|
1604
1625
|
lastInvokeAt: 0,
|
|
1605
1626
|
rafId: null,
|
|
1606
1627
|
pendingPayload: null,
|
|
1607
1628
|
loopActive: !1,
|
|
1608
|
-
normalizedThrottle:
|
|
1609
|
-
}),
|
|
1629
|
+
normalizedThrottle: n
|
|
1630
|
+
}), c = T(() => {
|
|
1610
1631
|
const l = s.current;
|
|
1611
1632
|
l.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(l.rafId), l.rafId = null, l.loopActive = !1;
|
|
1612
|
-
}, []), u =
|
|
1633
|
+
}, []), u = T(
|
|
1613
1634
|
(l) => {
|
|
1614
1635
|
const d = s.current;
|
|
1615
1636
|
d.rafId = null;
|
|
1616
|
-
const
|
|
1617
|
-
if (
|
|
1618
|
-
const
|
|
1619
|
-
(
|
|
1637
|
+
const f = typeof l == "number" ? l : hr(), m = d.normalizedThrottle, R = d.pendingPayload, b = o.current;
|
|
1638
|
+
if (R !== null && b) {
|
|
1639
|
+
const A = f - d.lastInvokeAt;
|
|
1640
|
+
(m === 0 || d.lastInvokeAt === 0 || A >= m) && (d.pendingPayload = null, d.lastInvokeAt = f, e(b, R));
|
|
1620
1641
|
}
|
|
1621
1642
|
if (d.pendingPayload !== null) {
|
|
1622
1643
|
typeof requestAnimationFrame == "function" ? d.rafId = requestAnimationFrame(u) : d.loopActive = !1;
|
|
@@ -1624,8 +1645,8 @@ const dr = 1e4, vr = () => {
|
|
|
1624
1645
|
}
|
|
1625
1646
|
d.loopActive = !1;
|
|
1626
1647
|
},
|
|
1627
|
-
[
|
|
1628
|
-
),
|
|
1648
|
+
[o, e]
|
|
1649
|
+
), h = T(() => {
|
|
1629
1650
|
const l = s.current;
|
|
1630
1651
|
if (!l.loopActive) {
|
|
1631
1652
|
if (l.loopActive = !0, typeof requestAnimationFrame == "function") {
|
|
@@ -1635,463 +1656,459 @@ const dr = 1e4, vr = () => {
|
|
|
1635
1656
|
l.loopActive = !1;
|
|
1636
1657
|
}
|
|
1637
1658
|
}, [u]);
|
|
1638
|
-
return
|
|
1639
|
-
|
|
1640
|
-
}, [
|
|
1641
|
-
|
|
1659
|
+
return X(() => () => {
|
|
1660
|
+
c(), s.current.pendingPayload = null;
|
|
1661
|
+
}, [c]), X(() => {
|
|
1662
|
+
c();
|
|
1642
1663
|
const l = s.current;
|
|
1643
|
-
l.lastInvokeAt = 0, l.pendingPayload = null, l.normalizedThrottle =
|
|
1644
|
-
}, [
|
|
1664
|
+
l.lastInvokeAt = 0, l.pendingPayload = null, l.normalizedThrottle = n;
|
|
1665
|
+
}, [n, c]), T(
|
|
1645
1666
|
(l) => {
|
|
1646
1667
|
const d = s.current;
|
|
1647
|
-
d.pendingPayload = l,
|
|
1668
|
+
d.pendingPayload = l, h();
|
|
1648
1669
|
},
|
|
1649
|
-
[
|
|
1670
|
+
[h]
|
|
1650
1671
|
);
|
|
1651
|
-
}, gr = ({
|
|
1652
|
-
|
|
1672
|
+
}, gr = ze.memo(({ index: o, top: t, height: e, item: n, children: s, clipItemHeight: c, enableKeyboardNavigation: u, onKeyDown: h, onFocus: l, registerItemRef: d }) => {
|
|
1673
|
+
const f = T((A) => d(o, A), [o, d]), m = T((A) => h(A, o), [o, h]), R = T(() => l(o), [o, l]), b = T((A) => {
|
|
1674
|
+
A.currentTarget.focus({ preventScroll: !0 });
|
|
1675
|
+
}, []);
|
|
1676
|
+
return /* @__PURE__ */ B(
|
|
1677
|
+
"div",
|
|
1678
|
+
{
|
|
1679
|
+
ref: f,
|
|
1680
|
+
"data-index": o,
|
|
1681
|
+
"data-virtualscroll-item": "true",
|
|
1682
|
+
className: "aqvs:item-container",
|
|
1683
|
+
style: {
|
|
1684
|
+
top: t,
|
|
1685
|
+
height: e,
|
|
1686
|
+
overflow: c ? "hidden" : void 0
|
|
1687
|
+
},
|
|
1688
|
+
tabIndex: u ? -1 : void 0,
|
|
1689
|
+
onPointerDown: u ? b : void 0,
|
|
1690
|
+
onKeyDownCapture: u ? m : void 0,
|
|
1691
|
+
onFocusCapture: u ? R : void 0,
|
|
1692
|
+
children: s(n, o)
|
|
1693
|
+
}
|
|
1694
|
+
);
|
|
1695
|
+
}), br = ({
|
|
1696
|
+
itemCount: o,
|
|
1653
1697
|
getItem: t,
|
|
1654
1698
|
getItemHeight: e,
|
|
1655
|
-
viewportSize:
|
|
1699
|
+
viewportSize: n,
|
|
1656
1700
|
overscanCount: s = 15,
|
|
1657
|
-
className:
|
|
1701
|
+
className: c,
|
|
1658
1702
|
onScroll: u,
|
|
1659
|
-
onRangeChange:
|
|
1703
|
+
onRangeChange: h,
|
|
1660
1704
|
children: l,
|
|
1661
1705
|
background: d,
|
|
1662
|
-
initialScrollIndex:
|
|
1663
|
-
initialScrollOffset:
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
inertiaOptions:
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
if (typeof c == "number") {
|
|
1683
|
-
const b = xt(c, 0, n - 1), _ = xt(b - s * 2, 0, n - 1), K = xt(b + s * 2, 0, n - 1), Z = c > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: _, to: K }] } } : void 0, { cumulative: yt, total: zt, currentValue: Dt } = w.prefixSum(c, Z), o = Math.max(yt - Dt, 0);
|
|
1684
|
-
i = ne(o, g.top), x = zt ?? w.getTotal();
|
|
1685
|
-
} else typeof f == "number" && (i = ne(Math.max(f, 0), g.top)), x = w.getTotal();
|
|
1686
|
-
return { position: i, total: x };
|
|
1687
|
-
}), [dt, Tt] = Nt(ut.position), [rt, X] = Nt(ut.total), [mt, vt] = Nt(ut.position), [D, T] = Nt(n), S = y(ut.position), J = y(g.top), Q = y(u ?? void 0), st = y(m ?? void 0), bt = y(/* @__PURE__ */ new Map()), nt = y(null), ft = y(null), [lt, kt] = Nt(null), [Pt, ht] = Nt(!1), Rt = y(null), Lt = y(!1);
|
|
1688
|
-
Y(() => {
|
|
1689
|
-
Q.current = u ?? void 0, st.current = m ?? void 0;
|
|
1690
|
-
}, [m, u]);
|
|
1691
|
-
const St = C(
|
|
1706
|
+
initialScrollIndex: f,
|
|
1707
|
+
initialScrollOffset: m,
|
|
1708
|
+
callbackThrottleMs: R = 5,
|
|
1709
|
+
contentInsets: b,
|
|
1710
|
+
onItemFocus: A,
|
|
1711
|
+
scrollBarOptions: U,
|
|
1712
|
+
behaviorOptions: Y
|
|
1713
|
+
}, Z) => {
|
|
1714
|
+
const { width: ft, enableThumbDrag: nt, enableTrackClick: tt, enableArrowButtons: N, enableScrollToTopBottomButtons: w, renderThumbOverlay: $, tapScrollCircleOptions: z } = U ?? {}, { enablePointerDrag: J, enableKeyboardNavigation: _ = !0, wheelSpeedMultiplier: mt, inertiaOptions: C, clipItemHeight: H = !1, resetOnGetItemHeightChange: K = !1 } = Y ?? {}, O = S(null), it = S(!1), v = yt(() => fr(b), [b]), vt = S({ size: o, valueOrFn: e, options: { sampleRange: { from: 0, to: 100 } } }), y = lr(vt.current.size, vt.current.valueOrFn, vt.current.options), [ct] = Vt(() => {
|
|
1715
|
+
let i = v.top, p = 0;
|
|
1716
|
+
if (typeof f == "number") {
|
|
1717
|
+
const r = ht(f, 0, o - 1), a = ht(r - s * 2, 0, o - 1), x = ht(r + s * 2, 0, o - 1), V = f > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: a, to: x }] } } : void 0, { cumulative: k, total: E, currentValue: q } = y.prefixSum(f, V), G = Math.max(k - q, 0);
|
|
1718
|
+
i = te(G, v.top), p = E ?? y.getTotal();
|
|
1719
|
+
} else typeof m == "number" && (i = te(Math.max(m, 0), v.top)), p = y.getTotal();
|
|
1720
|
+
return { position: i, total: p };
|
|
1721
|
+
}), [F, bt] = Vt(ct.position), [at, At] = Vt(ct.total), [I, D] = Vt(ct.position), [M, et] = Vt(o), L = S(ct.position), Mt = S(v.top), xt = S(u ?? void 0), It = S(h ?? void 0), rt = S(/* @__PURE__ */ new Map()), lt = S(null), ut = S(null), [gt, Et] = Vt(null), [Xt, Pt] = Vt(!1), g = S(null), P = S(!1), ot = S(e);
|
|
1722
|
+
X(() => {
|
|
1723
|
+
xt.current = u ?? void 0, It.current = h ?? void 0;
|
|
1724
|
+
}, [h, u]);
|
|
1725
|
+
const W = T(
|
|
1692
1726
|
(i) => {
|
|
1693
|
-
if (
|
|
1727
|
+
if (_ && i && typeof i.focus == "function")
|
|
1694
1728
|
try {
|
|
1695
1729
|
i.focus({ preventScroll: !0 });
|
|
1696
1730
|
} catch {
|
|
1697
1731
|
i.focus();
|
|
1698
1732
|
}
|
|
1699
1733
|
},
|
|
1700
|
-
[
|
|
1701
|
-
),
|
|
1702
|
-
i(
|
|
1703
|
-
}),
|
|
1704
|
-
i(
|
|
1734
|
+
[_]
|
|
1735
|
+
), j = we(xt, R, (i, { position: p, totalHeight: r }) => {
|
|
1736
|
+
i(p, r);
|
|
1737
|
+
}), Dt = we(It, R, (i, { renderingStartIndex: p, renderingEndIndex: r, visibleStartIndex: a, visibleEndIndex: x, scrollPosition: V, totalHeight: k }) => {
|
|
1738
|
+
i(p, r, a, x, V, k);
|
|
1705
1739
|
});
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
}), []),
|
|
1709
|
-
|
|
1710
|
-
}, [
|
|
1711
|
-
const
|
|
1740
|
+
X(() => (it.current = !0, () => {
|
|
1741
|
+
it.current = !1;
|
|
1742
|
+
}), []), X(() => {
|
|
1743
|
+
_ || (rt.current.clear(), lt.current = null, ut.current = null);
|
|
1744
|
+
}, [_]);
|
|
1745
|
+
const wt = T(
|
|
1746
|
+
(i, p) => {
|
|
1747
|
+
if (!p) {
|
|
1748
|
+
rt.current.delete(i);
|
|
1749
|
+
return;
|
|
1750
|
+
}
|
|
1751
|
+
_ && (rt.current.set(i, p), lt.current === i && (lt.current = null, ut.current = i, W(p)));
|
|
1752
|
+
},
|
|
1753
|
+
[_, W]
|
|
1754
|
+
), pt = 0.01, Ct = S({
|
|
1712
1755
|
rafId: null,
|
|
1713
1756
|
loopActive: !1,
|
|
1714
1757
|
idleFrames: 0,
|
|
1715
|
-
lastRenderedPosition:
|
|
1716
|
-
}),
|
|
1717
|
-
const i =
|
|
1758
|
+
lastRenderedPosition: ct.position
|
|
1759
|
+
}), Ht = T(() => {
|
|
1760
|
+
const i = Ct.current;
|
|
1718
1761
|
i.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(i.rafId), i.rafId = null, i.loopActive = !1, i.idleFrames = 0;
|
|
1719
1762
|
}, []);
|
|
1720
|
-
|
|
1763
|
+
X(
|
|
1721
1764
|
() => () => {
|
|
1722
|
-
|
|
1765
|
+
Ht();
|
|
1723
1766
|
},
|
|
1724
|
-
[
|
|
1767
|
+
[Ht]
|
|
1725
1768
|
);
|
|
1726
|
-
const
|
|
1727
|
-
const i =
|
|
1769
|
+
const Nt = T(() => {
|
|
1770
|
+
const i = Ct.current;
|
|
1728
1771
|
i.rafId = null;
|
|
1729
|
-
const
|
|
1730
|
-
if (
|
|
1731
|
-
|
|
1772
|
+
const p = L.current, r = qt(p, v.top), a = y.getTotal();
|
|
1773
|
+
if (bt((V) => Math.abs(V - p) < pt ? V : p), j({ position: r, totalHeight: a }), Math.abs(i.lastRenderedPosition - p) >= pt ? (i.lastRenderedPosition = p, i.idleFrames = 0) : i.idleFrames += 1, i.idleFrames >= 2) {
|
|
1774
|
+
Ht();
|
|
1732
1775
|
return;
|
|
1733
1776
|
}
|
|
1734
1777
|
if (typeof requestAnimationFrame == "function") {
|
|
1735
|
-
i.rafId = requestAnimationFrame(
|
|
1778
|
+
i.rafId = requestAnimationFrame(Nt);
|
|
1736
1779
|
return;
|
|
1737
1780
|
}
|
|
1738
1781
|
i.loopActive = !1;
|
|
1739
|
-
}, [
|
|
1740
|
-
const i =
|
|
1782
|
+
}, [y, v.top, j, Ht]), $t = T(() => {
|
|
1783
|
+
const i = Ct.current;
|
|
1741
1784
|
if (i.idleFrames = 0, !i.loopActive) {
|
|
1742
1785
|
if (i.loopActive = !0, typeof requestAnimationFrame == "function") {
|
|
1743
|
-
i.rafId = requestAnimationFrame(
|
|
1786
|
+
i.rafId = requestAnimationFrame(Nt);
|
|
1744
1787
|
return;
|
|
1745
1788
|
}
|
|
1746
1789
|
i.loopActive = !1;
|
|
1747
1790
|
}
|
|
1748
|
-
}, [
|
|
1749
|
-
(i,
|
|
1750
|
-
const
|
|
1751
|
-
if (
|
|
1752
|
-
|
|
1791
|
+
}, [Nt]), Q = T(
|
|
1792
|
+
(i, p) => {
|
|
1793
|
+
const r = p?.immediate ?? !1, a = qt(i, v.top);
|
|
1794
|
+
if (L.current = i, r) {
|
|
1795
|
+
Ct.current.lastRenderedPosition = i, Ct.current.idleFrames = 0, bt(i), j({ position: a, totalHeight: y.getTotal() });
|
|
1753
1796
|
return;
|
|
1754
1797
|
}
|
|
1755
|
-
|
|
1798
|
+
$t();
|
|
1756
1799
|
},
|
|
1757
|
-
[
|
|
1758
|
-
),
|
|
1759
|
-
|
|
1760
|
-
if (!
|
|
1761
|
-
if (
|
|
1762
|
-
const i =
|
|
1763
|
-
|
|
1800
|
+
[$t, y, v.top, j]
|
|
1801
|
+
), St = S(!1);
|
|
1802
|
+
X(() => {
|
|
1803
|
+
if (!St.current)
|
|
1804
|
+
if (St.current = !0, typeof m == "number") {
|
|
1805
|
+
const i = te(Math.max(m, 0), v.top), p = Math.abs(i - L.current) > 0.5;
|
|
1806
|
+
Q(i, { immediate: !0 }), p && D(i);
|
|
1764
1807
|
} else
|
|
1765
|
-
|
|
1766
|
-
}, [
|
|
1767
|
-
|
|
1768
|
-
const
|
|
1769
|
-
|
|
1770
|
-
}, [
|
|
1771
|
-
|
|
1772
|
-
}, [
|
|
1773
|
-
const i =
|
|
1774
|
-
if (i ===
|
|
1808
|
+
Q(L.current, { immediate: !0 });
|
|
1809
|
+
}, [m, v.top, Q]), ee(() => {
|
|
1810
|
+
ot.current !== e ? (y.setValueFn(e, { reset: K }), ot.current = e) : y.setValueFn(e, { reset: !1 }), M !== o && (y.changeSize(o), et(o));
|
|
1811
|
+
const p = y.getTotal();
|
|
1812
|
+
at !== p && At(p);
|
|
1813
|
+
}, [y, M, o, at, e, K]), ee(() => {
|
|
1814
|
+
I !== null && O.current && (dt.debug("[VirtualScroll] Scrolling to position:", I), O.current.scrollTo(I), D(null));
|
|
1815
|
+
}, [I]), X(() => {
|
|
1816
|
+
const i = Mt.current;
|
|
1817
|
+
if (i === v.top)
|
|
1775
1818
|
return;
|
|
1776
|
-
const
|
|
1777
|
-
|
|
1778
|
-
}, [
|
|
1779
|
-
const
|
|
1780
|
-
(i) => {
|
|
1781
|
-
if (!
|
|
1819
|
+
const p = qt(L.current, i), r = te(p, v.top);
|
|
1820
|
+
Mt.current = v.top, L.current = r, D(r), Q(r, { immediate: !0 });
|
|
1821
|
+
}, [v.top, Q]);
|
|
1822
|
+
const Tt = T(
|
|
1823
|
+
(i, p) => {
|
|
1824
|
+
if (!O.current)
|
|
1782
1825
|
return;
|
|
1783
|
-
const
|
|
1784
|
-
if (
|
|
1826
|
+
const r = st(i, M), a = st(r - s * 2, M), x = st(r + s * 2, M), { cumulative: V, total: k, currentValue: E } = y.prefixSum(r, { materializeOption: { materialize: !0, ranges: [{ from: a, to: x }] } });
|
|
1827
|
+
if (dt.debug("[VirtualScroll] Scrolling to index:", r, "ItemBottom:", V, "Total height:", k, "ItemHeight:", E, "safeIndexFrom:", a, "safeIndexTo:", x), !k)
|
|
1785
1828
|
return;
|
|
1786
|
-
const
|
|
1787
|
-
|
|
1829
|
+
const q = Math.max(V - E, 0);
|
|
1830
|
+
let G = q;
|
|
1831
|
+
p?.align === "bottom" ? G = V - n : p?.align === "center" && (G = q + E / 2 - n / 2), p?.offset && (G -= p.offset), G = Math.max(0, G);
|
|
1832
|
+
const zt = te(G, v.top);
|
|
1833
|
+
At(k), D(zt), dt.debug("[VirtualScroll] Setting scroll position to:", zt);
|
|
1788
1834
|
},
|
|
1789
|
-
[
|
|
1790
|
-
),
|
|
1835
|
+
[y, s, M, v.top, n]
|
|
1836
|
+
), jt = T(
|
|
1791
1837
|
(i) => {
|
|
1792
|
-
if (!
|
|
1838
|
+
if (!O.current)
|
|
1793
1839
|
return;
|
|
1794
|
-
const
|
|
1795
|
-
|
|
1840
|
+
const p = y.getTotal(), r = ht(Math.floor(i), 0, p), a = y.findIndexAtOrAfter(r, { materializeOption: { materialize: !1 } }).index;
|
|
1841
|
+
Tt(a);
|
|
1796
1842
|
},
|
|
1797
|
-
[
|
|
1798
|
-
),
|
|
1843
|
+
[y, Tt]
|
|
1844
|
+
), re = T(
|
|
1799
1845
|
(i) => {
|
|
1800
|
-
const
|
|
1801
|
-
|
|
1802
|
-
const
|
|
1803
|
-
return
|
|
1846
|
+
const p = qt(L.current, v.top), r = typeof i == "function" ? i(p) : i;
|
|
1847
|
+
jt(r);
|
|
1848
|
+
const a = O.current?.getScrollPosition(), x = typeof a == "number" ? a : L.current;
|
|
1849
|
+
return Q(x), x;
|
|
1804
1850
|
},
|
|
1805
|
-
[
|
|
1806
|
-
),
|
|
1807
|
-
(i,
|
|
1808
|
-
if (
|
|
1809
|
-
if (
|
|
1810
|
-
|
|
1851
|
+
[v.top, jt, Q]
|
|
1852
|
+
), Gt = T(
|
|
1853
|
+
(i, p) => {
|
|
1854
|
+
if (dt.debug("[VirtualScroll] Scroll position changed:", i), Q(i), w) {
|
|
1855
|
+
if (P.current) {
|
|
1856
|
+
P.current = !1;
|
|
1811
1857
|
return;
|
|
1812
1858
|
}
|
|
1813
|
-
const
|
|
1814
|
-
if (
|
|
1815
|
-
const
|
|
1816
|
-
|
|
1817
|
-
|
|
1859
|
+
const r = i - p;
|
|
1860
|
+
if (dt.debug("[VirtualScroll] Scroll diff:", r, "New:", i, "Prev:", p), Math.abs(r) > 1) {
|
|
1861
|
+
const a = r > 0 ? "down" : "up";
|
|
1862
|
+
Et(a), Pt(!0), dt.debug("[VirtualScroll] Showing scroll buttons. Direction:", a), g.current && clearTimeout(g.current), g.current = setTimeout(() => {
|
|
1863
|
+
Pt(!1), dt.debug("[VirtualScroll] Hiding scroll buttons");
|
|
1818
1864
|
}, 2e3);
|
|
1819
1865
|
}
|
|
1820
1866
|
}
|
|
1821
1867
|
},
|
|
1822
|
-
[
|
|
1823
|
-
),
|
|
1824
|
-
const i =
|
|
1825
|
-
return
|
|
1868
|
+
[Q, w]
|
|
1869
|
+
), Bt = yt(() => qt(F, v.top), [v.top, F]), ne = yt(() => {
|
|
1870
|
+
const i = pr(Bt, n, s, M, e, y, at);
|
|
1871
|
+
return dt.debug("[VirtualScroll] Calculated rendering range:", {
|
|
1826
1872
|
...i,
|
|
1827
|
-
scrollPosition:
|
|
1828
|
-
renderingContentSize:
|
|
1873
|
+
scrollPosition: Bt,
|
|
1874
|
+
renderingContentSize: y.getTotal(),
|
|
1829
1875
|
overscanCount: s,
|
|
1830
|
-
viewportSize:
|
|
1876
|
+
viewportSize: n
|
|
1831
1877
|
}), i;
|
|
1832
|
-
}, [
|
|
1833
|
-
(i,
|
|
1834
|
-
if (!
|
|
1878
|
+
}, [Bt, n, s, M, e, y, at]), { renderingStartIndex: Rt, renderingEndIndex: Ft, visibleStartIndex: Lt, visibleEndIndex: Ot } = ne, Yt = T(
|
|
1879
|
+
(i, p) => {
|
|
1880
|
+
if (!_ || M === 0)
|
|
1835
1881
|
return;
|
|
1836
|
-
const
|
|
1837
|
-
if (!(
|
|
1838
|
-
const
|
|
1839
|
-
|
|
1882
|
+
const r = st(i, M);
|
|
1883
|
+
if (!(p?.ensureVisible ?? !0)) {
|
|
1884
|
+
const Kt = rt.current.get(r);
|
|
1885
|
+
Kt && (lt.current = null, ut.current = r, W(Kt));
|
|
1840
1886
|
return;
|
|
1841
1887
|
}
|
|
1842
|
-
const
|
|
1843
|
-
if (
|
|
1844
|
-
|
|
1888
|
+
const x = y.prefixSum(r, { materializeOption: { materialize: !1 } }), V = x.currentValue, k = Math.max(x.cumulative - V, 0), E = k + V, q = qt(L.current, v.top), G = q + n;
|
|
1889
|
+
if (k < q || E > G) {
|
|
1890
|
+
lt.current = r, Tt(r);
|
|
1845
1891
|
return;
|
|
1846
1892
|
}
|
|
1847
|
-
const
|
|
1848
|
-
if (
|
|
1849
|
-
|
|
1893
|
+
const _t = rt.current.get(r);
|
|
1894
|
+
if (_t) {
|
|
1895
|
+
lt.current = null, ut.current = r, W(_t);
|
|
1850
1896
|
return;
|
|
1851
1897
|
}
|
|
1852
|
-
|
|
1898
|
+
lt.current = r;
|
|
1853
1899
|
},
|
|
1854
|
-
[
|
|
1855
|
-
),
|
|
1856
|
-
(i,
|
|
1857
|
-
if (!
|
|
1900
|
+
[_, M, y, v.top, Tt, W, n]
|
|
1901
|
+
), oe = T(
|
|
1902
|
+
(i, p) => {
|
|
1903
|
+
if (!_ || i.defaultPrevented || i.altKey || i.metaKey || i.ctrlKey)
|
|
1858
1904
|
return;
|
|
1859
|
-
const
|
|
1860
|
-
if (
|
|
1861
|
-
const
|
|
1862
|
-
if (
|
|
1905
|
+
const r = i.target;
|
|
1906
|
+
if (r) {
|
|
1907
|
+
const a = r.tagName;
|
|
1908
|
+
if (a === "INPUT" || a === "TEXTAREA" || a === "SELECT" || r.isContentEditable)
|
|
1863
1909
|
return;
|
|
1864
1910
|
}
|
|
1865
1911
|
if (i.key === "ArrowDown") {
|
|
1866
|
-
|
|
1912
|
+
p < M - 1 && (i.preventDefault(), Yt(p + 1));
|
|
1867
1913
|
return;
|
|
1868
1914
|
}
|
|
1869
1915
|
if (i.key === "ArrowUp") {
|
|
1870
|
-
|
|
1916
|
+
p > 0 && (i.preventDefault(), Yt(p - 1));
|
|
1871
1917
|
return;
|
|
1872
1918
|
}
|
|
1873
1919
|
if (i.key === "PageDown") {
|
|
1874
|
-
if (
|
|
1920
|
+
if (p < M - 1) {
|
|
1875
1921
|
i.preventDefault();
|
|
1876
|
-
const
|
|
1877
|
-
Yt(
|
|
1922
|
+
const a = Math.max(Ot - Lt + 1, 1), x = Math.max(a, 1), V = st(Math.min(p + x, M - 1), M);
|
|
1923
|
+
Yt(V);
|
|
1878
1924
|
}
|
|
1879
1925
|
return;
|
|
1880
1926
|
}
|
|
1881
|
-
if (i.key === "PageUp" &&
|
|
1927
|
+
if (i.key === "PageUp" && p > 0) {
|
|
1882
1928
|
i.preventDefault();
|
|
1883
|
-
const
|
|
1884
|
-
Yt(
|
|
1929
|
+
const a = Math.max(Ot - Lt + 1, 1), x = Math.max(a, 1), V = st(p - x, M);
|
|
1930
|
+
Yt(V);
|
|
1885
1931
|
}
|
|
1886
1932
|
},
|
|
1887
|
-
[
|
|
1888
|
-
), se =
|
|
1933
|
+
[_, M, Yt, Ot, Lt]
|
|
1934
|
+
), se = T(
|
|
1889
1935
|
(i) => {
|
|
1890
|
-
if (!
|
|
1936
|
+
if (!_)
|
|
1891
1937
|
return;
|
|
1892
|
-
const
|
|
1893
|
-
|
|
1938
|
+
const p = st(i, M);
|
|
1939
|
+
lt.current = null, ut.current = p, A?.(p);
|
|
1894
1940
|
},
|
|
1895
|
-
[
|
|
1941
|
+
[_, M, A]
|
|
1896
1942
|
);
|
|
1897
|
-
|
|
1898
|
-
const i =
|
|
1899
|
-
|
|
1900
|
-
renderingStartIndex:
|
|
1901
|
-
renderingEndIndex:
|
|
1902
|
-
visibleStartIndex:
|
|
1903
|
-
visibleEndIndex:
|
|
1904
|
-
scrollPositionState:
|
|
1905
|
-
paneScrollPosition:
|
|
1906
|
-
logicalScrollPosition:
|
|
1907
|
-
contentSize:
|
|
1943
|
+
X(() => {
|
|
1944
|
+
const i = O.current?.getScrollPosition() ?? 0, p = L.current, r = qt(p, v.top);
|
|
1945
|
+
dt.debug("[VirtualScroll] Range change effect triggered", {
|
|
1946
|
+
renderingStartIndex: Rt,
|
|
1947
|
+
renderingEndIndex: Ft,
|
|
1948
|
+
visibleStartIndex: Lt,
|
|
1949
|
+
visibleEndIndex: Ot,
|
|
1950
|
+
scrollPositionState: F,
|
|
1951
|
+
paneScrollPosition: p,
|
|
1952
|
+
logicalScrollPosition: r,
|
|
1953
|
+
contentSize: at,
|
|
1908
1954
|
scrollPaneScrollPosition: i
|
|
1909
|
-
}),
|
|
1910
|
-
renderingStartIndex:
|
|
1911
|
-
renderingEndIndex:
|
|
1912
|
-
visibleStartIndex:
|
|
1913
|
-
visibleEndIndex:
|
|
1914
|
-
scrollPosition:
|
|
1915
|
-
totalHeight:
|
|
1955
|
+
}), Dt({
|
|
1956
|
+
renderingStartIndex: Rt,
|
|
1957
|
+
renderingEndIndex: Ft,
|
|
1958
|
+
visibleStartIndex: Lt,
|
|
1959
|
+
visibleEndIndex: Ot,
|
|
1960
|
+
scrollPosition: r,
|
|
1961
|
+
totalHeight: at
|
|
1916
1962
|
});
|
|
1917
|
-
}, [
|
|
1918
|
-
const ue =
|
|
1963
|
+
}, [at, Ft, Rt, v.top, Dt, F, Ot, Lt]);
|
|
1964
|
+
const ue = T(() => w ? /* @__PURE__ */ B("div", { className: "aqvs:scroll-to-edge-overlay", "data-visible": Xt && gt !== null, children: gt === "up" ? /* @__PURE__ */ B("div", { className: "aqvs:scroll-to-edge-button-container aqvs:scroll-to-edge-button-container-top", children: /* @__PURE__ */ B(
|
|
1919
1965
|
"button",
|
|
1920
1966
|
{
|
|
1921
1967
|
type: "button",
|
|
1922
1968
|
className: "aqvs:scroll-to-edge-button",
|
|
1923
|
-
onClick: (
|
|
1924
|
-
|
|
1969
|
+
onClick: (r) => {
|
|
1970
|
+
r.stopPropagation(), P.current = !0, Tt(0), Pt(!1);
|
|
1925
1971
|
},
|
|
1926
1972
|
children: "Top"
|
|
1927
1973
|
}
|
|
1928
|
-
) }) : /* @__PURE__ */
|
|
1974
|
+
) }) : /* @__PURE__ */ B("div", { className: "aqvs:scroll-to-edge-button-container aqvs:scroll-to-edge-button-container-bottom", children: /* @__PURE__ */ B(
|
|
1929
1975
|
"button",
|
|
1930
1976
|
{
|
|
1931
1977
|
type: "button",
|
|
1932
1978
|
className: "aqvs:scroll-to-edge-button",
|
|
1933
|
-
onClick: (
|
|
1934
|
-
|
|
1979
|
+
onClick: (r) => {
|
|
1980
|
+
r.stopPropagation(), P.current = !0, Tt(o - 1), Pt(!1);
|
|
1935
1981
|
},
|
|
1936
1982
|
children: "Bottom"
|
|
1937
1983
|
}
|
|
1938
|
-
) }) }) : null, [
|
|
1984
|
+
) }) }) : null, [w, Xt, gt, Tt, o]), { visibleItems: Zt, startPosition: Jt } = yt(() => {
|
|
1985
|
+
if (M === 0)
|
|
1986
|
+
return {
|
|
1987
|
+
visibleItems: /* @__PURE__ */ B("div", { className: "aqvs:no-items-container", children: /* @__PURE__ */ B("div", { className: "aqvs:no-items-text", children: "No items" }) }),
|
|
1988
|
+
startPosition: 0
|
|
1989
|
+
};
|
|
1990
|
+
const i = st(Rt, M), p = st(Ft, M), { cumulative: r, currentValue: a } = y.prefixSum(i, { materializeOption: { materialize: !1 } }), x = r - a, V = [], k = [];
|
|
1991
|
+
for (let E = i; E <= p; E++) {
|
|
1992
|
+
const q = e(E);
|
|
1993
|
+
y.get(E) !== q && V.push({ index: E, value: q });
|
|
1994
|
+
const { cumulative: zt, currentValue: _t } = y.prefixSum(E, { materializeOption: { materialize: !1 } }), Kt = zt - _t;
|
|
1995
|
+
k.push(
|
|
1996
|
+
/* @__PURE__ */ B(
|
|
1997
|
+
gr,
|
|
1998
|
+
{
|
|
1999
|
+
index: E,
|
|
2000
|
+
top: Kt - x + v.top,
|
|
2001
|
+
height: q,
|
|
2002
|
+
item: t(E),
|
|
2003
|
+
children: l,
|
|
2004
|
+
clipItemHeight: H,
|
|
2005
|
+
enableKeyboardNavigation: _,
|
|
2006
|
+
onKeyDown: oe,
|
|
2007
|
+
onFocus: se,
|
|
2008
|
+
registerItemRef: wt
|
|
2009
|
+
},
|
|
2010
|
+
E
|
|
2011
|
+
)
|
|
2012
|
+
);
|
|
2013
|
+
}
|
|
2014
|
+
return V.length > 0 && Promise.resolve().then(() => {
|
|
2015
|
+
if (!it.current)
|
|
2016
|
+
return;
|
|
2017
|
+
const E = y.updates(V);
|
|
2018
|
+
if (!it.current || typeof E != "number")
|
|
2019
|
+
return;
|
|
2020
|
+
At(E), dt.debug("[VirtualScroll] Updated heights for items", V, "New total height:", E);
|
|
2021
|
+
const q = O.current?.getScrollPosition() ?? L.current;
|
|
2022
|
+
q === L.current || !it.current || Q(q);
|
|
2023
|
+
}), { visibleItems: k, startPosition: x };
|
|
2024
|
+
}, [l, H, _, M, y, t, e, se, oe, wt, Ft, Rt, v.top, Q]), de = T(
|
|
1939
2025
|
(i) => {
|
|
1940
|
-
const
|
|
1941
|
-
if (
|
|
2026
|
+
const p = (R ?? 0) > 0, r = Math.abs(i - F), a = p && r > 0.5 ? F : i, x = qt(a, v.top);
|
|
2027
|
+
if (dt.debug("[VirtualScroll] Rendering visible items", {
|
|
1942
2028
|
currentScrollPosition: i,
|
|
1943
|
-
effectiveScrollPosition:
|
|
1944
|
-
renderingStartIndex:
|
|
1945
|
-
renderingEndIndex:
|
|
1946
|
-
fenwickSize:
|
|
1947
|
-
viewportSize:
|
|
1948
|
-
callbackThrottleMs:
|
|
1949
|
-
diff:
|
|
1950
|
-
rawEffectiveScrollPosition:
|
|
1951
|
-
}),
|
|
1952
|
-
return
|
|
1953
|
-
const
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
return;
|
|
2029
|
+
effectiveScrollPosition: x,
|
|
2030
|
+
renderingStartIndex: Rt,
|
|
2031
|
+
renderingEndIndex: Ft,
|
|
2032
|
+
fenwickSize: M,
|
|
2033
|
+
viewportSize: n,
|
|
2034
|
+
callbackThrottleMs: R,
|
|
2035
|
+
diff: r,
|
|
2036
|
+
rawEffectiveScrollPosition: a
|
|
2037
|
+
}), M === 0)
|
|
2038
|
+
return Zt;
|
|
2039
|
+
const V = Jt - x, k = v.bottom > 0 ? /* @__PURE__ */ B(
|
|
2040
|
+
"div",
|
|
2041
|
+
{
|
|
2042
|
+
className: "aqvs:bottom-inset",
|
|
2043
|
+
style: {
|
|
2044
|
+
top: y.getTotal() + v.top - Jt,
|
|
2045
|
+
height: v.bottom
|
|
1961
2046
|
}
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
height: tt,
|
|
1975
|
-
overflow: at ? "hidden" : void 0
|
|
1976
|
-
},
|
|
1977
|
-
tabIndex: V ? -1 : void 0,
|
|
1978
|
-
onPointerDown: V ? (Wt) => {
|
|
1979
|
-
Wt.currentTarget.focus({ preventScroll: !0 });
|
|
1980
|
-
} : void 0,
|
|
1981
|
-
onKeyDownCapture: V ? (Wt) => jt(Wt, E) : void 0,
|
|
1982
|
-
onFocusCapture: V ? () => se(E) : void 0,
|
|
1983
|
-
children: l(t(E), E)
|
|
1984
|
-
},
|
|
1985
|
-
E
|
|
1986
|
-
)
|
|
1987
|
-
);
|
|
1988
|
-
}
|
|
1989
|
-
h.length > 0 && Promise.resolve().then(() => {
|
|
1990
|
-
if (!O.current)
|
|
1991
|
-
return;
|
|
1992
|
-
const E = w.updates(h);
|
|
1993
|
-
if (!O.current || typeof E != "number")
|
|
1994
|
-
return;
|
|
1995
|
-
X(E), pt.debug("[VirtualScroll] Updated heights for items", h, "New total height:", E);
|
|
1996
|
-
const tt = I.current?.getScrollPosition() ?? S.current;
|
|
1997
|
-
tt === S.current || !O.current || q(tt);
|
|
1998
|
-
});
|
|
1999
|
-
const ot = o - K;
|
|
2000
|
-
if (g.bottom > 0) {
|
|
2001
|
-
const E = w.getTotal() + g.top - o;
|
|
2002
|
-
R.push(
|
|
2003
|
-
/* @__PURE__ */ H(
|
|
2004
|
-
"div",
|
|
2005
|
-
{
|
|
2006
|
-
className: "aqvs:bottom-inset",
|
|
2007
|
-
style: {
|
|
2008
|
-
top: E,
|
|
2009
|
-
height: g.bottom
|
|
2010
|
-
}
|
|
2011
|
-
},
|
|
2012
|
-
"virtualscroll-bottom-inset"
|
|
2013
|
-
)
|
|
2014
|
-
);
|
|
2015
|
-
}
|
|
2016
|
-
return pt.debug("[VirtualScroll] Rendering items", {
|
|
2017
|
-
nodeCount: R.length,
|
|
2018
|
-
containerTop: ot,
|
|
2019
|
-
logicalScrollPosition: gt,
|
|
2020
|
-
resolvedInsets: g,
|
|
2021
|
-
effectiveScrollPosition: K
|
|
2022
|
-
}), /* @__PURE__ */ H("div", { className: "aqvs:items-wrapper", style: { top: ot }, children: R });
|
|
2047
|
+
},
|
|
2048
|
+
"virtualscroll-bottom-inset"
|
|
2049
|
+
) : null;
|
|
2050
|
+
return dt.debug("[VirtualScroll] Rendering items", {
|
|
2051
|
+
containerTop: V,
|
|
2052
|
+
logicalScrollPosition: Bt,
|
|
2053
|
+
resolvedInsets: v,
|
|
2054
|
+
effectiveScrollPosition: x
|
|
2055
|
+
}), /* @__PURE__ */ Ut("div", { className: "aqvs:items-wrapper", style: { top: V }, children: [
|
|
2056
|
+
Zt,
|
|
2057
|
+
k
|
|
2058
|
+
] });
|
|
2023
2059
|
},
|
|
2024
|
-
[
|
|
2025
|
-
$,
|
|
2026
|
-
l,
|
|
2027
|
-
V,
|
|
2028
|
-
w,
|
|
2029
|
-
D,
|
|
2030
|
-
t,
|
|
2031
|
-
e,
|
|
2032
|
-
se,
|
|
2033
|
-
jt,
|
|
2034
|
-
gt,
|
|
2035
|
-
Bt,
|
|
2036
|
-
Ut,
|
|
2037
|
-
g,
|
|
2038
|
-
dt,
|
|
2039
|
-
St,
|
|
2040
|
-
q,
|
|
2041
|
-
r,
|
|
2042
|
-
at
|
|
2043
|
-
]
|
|
2060
|
+
[R, M, y, Bt, Ft, Rt, v, F, Jt, n, Zt]
|
|
2044
2061
|
);
|
|
2045
|
-
|
|
2046
|
-
|
|
2062
|
+
Ie(
|
|
2063
|
+
Z,
|
|
2047
2064
|
() => ({
|
|
2048
|
-
getScrollPosition: () =>
|
|
2049
|
-
getContentSize: () =>
|
|
2050
|
-
getViewportSize: () =>
|
|
2051
|
-
scrollTo:
|
|
2052
|
-
scrollToIndex:
|
|
2053
|
-
getFenwickTreeTotalHeight: () =>
|
|
2054
|
-
getFenwickSize: () =>
|
|
2065
|
+
getScrollPosition: () => O.current?.getScrollPosition() ?? -1,
|
|
2066
|
+
getContentSize: () => O.current?.getContentSize() ?? -1,
|
|
2067
|
+
getViewportSize: () => O.current?.getViewportSize() ?? -1,
|
|
2068
|
+
scrollTo: re,
|
|
2069
|
+
scrollToIndex: Tt,
|
|
2070
|
+
getFenwickTreeTotalHeight: () => y.getTotal(),
|
|
2071
|
+
getFenwickSize: () => y.getSize(),
|
|
2055
2072
|
focusItemAtIndex: Yt
|
|
2056
2073
|
}),
|
|
2057
|
-
[
|
|
2074
|
+
[re, Tt, y, Yt]
|
|
2058
2075
|
);
|
|
2059
|
-
const fe =
|
|
2060
|
-
return /* @__PURE__ */
|
|
2076
|
+
const fe = at + v.top + v.bottom;
|
|
2077
|
+
return /* @__PURE__ */ B(
|
|
2061
2078
|
sr,
|
|
2062
2079
|
{
|
|
2063
|
-
ref:
|
|
2080
|
+
ref: O,
|
|
2064
2081
|
contentSize: fe,
|
|
2065
|
-
viewportSize:
|
|
2066
|
-
className:
|
|
2067
|
-
onScroll:
|
|
2082
|
+
viewportSize: n,
|
|
2083
|
+
className: c,
|
|
2084
|
+
onScroll: Gt,
|
|
2068
2085
|
background: d,
|
|
2069
|
-
tapScrollCircleOptions:
|
|
2070
|
-
inertiaOptions:
|
|
2071
|
-
itemCount:
|
|
2072
|
-
scrollBarWidth:
|
|
2073
|
-
enableThumbDrag:
|
|
2074
|
-
enableTrackClick:
|
|
2075
|
-
enableArrowButtons:
|
|
2076
|
-
enablePointerDrag:
|
|
2077
|
-
renderThumbOverlay:
|
|
2078
|
-
wheelSpeedMultiplier:
|
|
2079
|
-
contentInsets:
|
|
2080
|
-
visibleStartIndex:
|
|
2081
|
-
visibleEndIndex:
|
|
2086
|
+
tapScrollCircleOptions: z,
|
|
2087
|
+
inertiaOptions: C,
|
|
2088
|
+
itemCount: o,
|
|
2089
|
+
scrollBarWidth: ft,
|
|
2090
|
+
enableThumbDrag: nt,
|
|
2091
|
+
enableTrackClick: tt,
|
|
2092
|
+
enableArrowButtons: N,
|
|
2093
|
+
enablePointerDrag: J,
|
|
2094
|
+
renderThumbOverlay: $,
|
|
2095
|
+
wheelSpeedMultiplier: mt,
|
|
2096
|
+
contentInsets: v,
|
|
2097
|
+
visibleStartIndex: Lt,
|
|
2098
|
+
visibleEndIndex: Ot,
|
|
2082
2099
|
renderOverlay: ue,
|
|
2083
2100
|
children: de
|
|
2084
2101
|
}
|
|
2085
2102
|
);
|
|
2086
|
-
},
|
|
2103
|
+
}, yr = xe(br);
|
|
2087
2104
|
export {
|
|
2088
2105
|
ar as FenwickMapTree,
|
|
2089
2106
|
or as ScrollBar,
|
|
2090
2107
|
sr as ScrollPane,
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2108
|
+
yr as VirtualScroll,
|
|
2109
|
+
ht as minmax,
|
|
2110
|
+
Pr as tapScrollCircleSampleVisual,
|
|
2094
2111
|
lr as useFenwickMapTree,
|
|
2095
|
-
|
|
2112
|
+
Sr as useHeightCache,
|
|
2096
2113
|
ur as useLruCache
|
|
2097
2114
|
};
|