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