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