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