@aiquants/virtualscroll 1.19.3 → 1.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/ScrollPane.d.cts +3 -1
- package/dist/ScrollPane.d.ts +3 -1
- package/dist/ScrollPane.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +328 -326
- package/package.json +1 -1
- package/src/ScrollPane.spec.tsx +14 -0
- package/src/ScrollPane.tsx +20 -16
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as Q, jsxs as ue, Fragment as Ke } from "react/jsx-runtime";
|
|
2
|
-
import Qe, { memo as tr, forwardRef as Fe, useState as jt, useRef as g, useCallback as S, useImperativeHandle as
|
|
2
|
+
import Qe, { memo as tr, forwardRef as Fe, useState as jt, useRef as g, useCallback as S, useImperativeHandle as ze, useMemo as Vt, useLayoutEffect as be, useEffect as X, useId as er } from "react";
|
|
3
3
|
import { twMerge as ce } from "tailwind-merge";
|
|
4
4
|
class N {
|
|
5
5
|
level;
|
|
@@ -189,14 +189,14 @@ const Ye = {
|
|
|
189
189
|
},
|
|
190
190
|
[i]
|
|
191
191
|
), G = S(
|
|
192
|
-
(b, K,
|
|
193
|
-
const { x: et, y: Y } = _.current,
|
|
192
|
+
(b, K, dt = !1) => {
|
|
193
|
+
const { x: et, y: Y } = _.current, j = b - et, ht = K - Y, St = Math.abs(ht), R = St < Ae ? 0 : ht < 0 ? -1 : 1, Ft = D.current;
|
|
194
194
|
let Lt = R;
|
|
195
195
|
const v = Ae + rr;
|
|
196
|
-
R === 0 ? Ft !== 0 && St < v ? Lt = Ft : (Lt = 0,
|
|
197
|
-
active:
|
|
198
|
-
offsetX:
|
|
199
|
-
offsetY:
|
|
196
|
+
R === 0 ? Ft !== 0 && St < v ? Lt = Ft : (Lt = 0, dt || (D.current = 0)) : R !== Ft && Ft !== 0 && St < v ? Lt = Ft : D.current = R, J({
|
|
197
|
+
active: dt || St >= Ae,
|
|
198
|
+
offsetX: j,
|
|
199
|
+
offsetY: ht,
|
|
200
200
|
distance: St,
|
|
201
201
|
direction: Lt,
|
|
202
202
|
pointerId: I.current
|
|
@@ -220,8 +220,8 @@ const Ye = {
|
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
222
222
|
b.preventDefault(), b.stopPropagation();
|
|
223
|
-
const K = p.current ?? b.currentTarget, { left:
|
|
224
|
-
_.current = { x:
|
|
223
|
+
const K = p.current ?? b.currentTarget, { left: dt, top: et, width: Y, height: j } = K.getBoundingClientRect();
|
|
224
|
+
_.current = { x: dt + Y / 2, y: et + j / 2 }, I.current = b.pointerId;
|
|
225
225
|
try {
|
|
226
226
|
K.setPointerCapture(b.pointerId);
|
|
227
227
|
} catch {
|
|
@@ -238,7 +238,7 @@ const Ye = {
|
|
|
238
238
|
b.preventDefault(), G(b.clientX, b.clientY);
|
|
239
239
|
},
|
|
240
240
|
[G]
|
|
241
|
-
),
|
|
241
|
+
), At = S(
|
|
242
242
|
(b) => {
|
|
243
243
|
if (I.current !== b.pointerId) {
|
|
244
244
|
M.current !== null && M.current.pointerId === b.pointerId && (M.current = null);
|
|
@@ -248,11 +248,11 @@ const Ye = {
|
|
|
248
248
|
const K = M.current;
|
|
249
249
|
if (M.current = null, K !== null) {
|
|
250
250
|
rt(b.pointerId);
|
|
251
|
-
const
|
|
251
|
+
const dt = p.current;
|
|
252
252
|
let et = !0;
|
|
253
|
-
if (
|
|
253
|
+
if (dt !== null && typeof dt.setPointerCapture == "function")
|
|
254
254
|
try {
|
|
255
|
-
|
|
255
|
+
dt.setPointerCapture(K.pointerId);
|
|
256
256
|
} catch (Y) {
|
|
257
257
|
(typeof Y == "object" && Y !== null && "name" in Y ? Y.name : void 0) === "NotFoundError" && (et = !1);
|
|
258
258
|
}
|
|
@@ -264,13 +264,13 @@ const Ye = {
|
|
|
264
264
|
nt(!0);
|
|
265
265
|
},
|
|
266
266
|
[nt, rt, G]
|
|
267
|
-
),
|
|
267
|
+
), k = S(
|
|
268
268
|
(b) => {
|
|
269
269
|
I.current === b.pointerId && nt(!1);
|
|
270
270
|
},
|
|
271
271
|
[nt]
|
|
272
272
|
);
|
|
273
|
-
|
|
273
|
+
ze(
|
|
274
274
|
u,
|
|
275
275
|
() => ({
|
|
276
276
|
reset: () => {
|
|
@@ -302,9 +302,9 @@ const Ye = {
|
|
|
302
302
|
tabIndex: -1,
|
|
303
303
|
onPointerDown: st,
|
|
304
304
|
onPointerMove: wt,
|
|
305
|
-
onPointerUp:
|
|
306
|
-
onPointerCancel:
|
|
307
|
-
onLostPointerCapture:
|
|
305
|
+
onPointerUp: At,
|
|
306
|
+
onPointerCancel: At,
|
|
307
|
+
onLostPointerCapture: k,
|
|
308
308
|
role: "presentation",
|
|
309
309
|
children: H(tt)
|
|
310
310
|
}
|
|
@@ -312,7 +312,7 @@ const Ye = {
|
|
|
312
312
|
})
|
|
313
313
|
);
|
|
314
314
|
We.displayName = "TapScrollCircle";
|
|
315
|
-
const
|
|
315
|
+
const pt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scroll-cancel", Be = 20, ir = 250, or = 60, sr = 20, ar = 20, lr = 240, qe = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, De = 2.2, cr = 8, ur = 120, dr = 1 / 10, Wt = {
|
|
316
316
|
enabled: !0,
|
|
317
317
|
size: 40,
|
|
318
318
|
offsetX: -80,
|
|
@@ -354,11 +354,11 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
354
354
|
maxVisualDistance: i?.maxVisualDistance ?? Wt.maxVisualDistance,
|
|
355
355
|
maxSpeedMultiplier: r,
|
|
356
356
|
minSpeedMultiplier: Math.max(i?.minSpeedMultiplier ?? Wt.minSpeedMultiplier, 0),
|
|
357
|
-
opacity:
|
|
357
|
+
opacity: pt(i?.opacity ?? Wt.opacity, 0, 1),
|
|
358
358
|
renderVisual: i?.renderVisual ?? Wt.renderVisual,
|
|
359
359
|
maxSpeedCurve: i?.maxSpeedCurve ?? Wt.maxSpeedCurve
|
|
360
360
|
};
|
|
361
|
-
}, pr = ({ isDragging: i, isThumbHovered: t, enableThumbDrag: e }) =>
|
|
361
|
+
}, pr = ({ isDragging: i, isThumbHovered: t, enableThumbDrag: e }) => Vt(() => e ? i ? "dragging" : t ? "hover" : "idle" : "disabled", [e, i, t]), hr = ({ canUseArrowButtons: i, enableArrowButtons: t, resetTapScroll: e, scrollByStep: r }) => {
|
|
362
362
|
const n = g(null), s = g(null), l = g(null), u = S(() => {
|
|
363
363
|
n.current !== null && (window.clearInterval(n.current), n.current = null), s.current !== null && (window.clearTimeout(s.current), s.current = null), l.current !== null && (window.removeEventListener("pointerup", l.current), window.removeEventListener("pointercancel", l.current), window.removeEventListener("blur", l.current), l.current = null);
|
|
364
364
|
}, []), f = S(() => {
|
|
@@ -391,7 +391,7 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
391
391
|
if (!i || i <= 0)
|
|
392
392
|
return De;
|
|
393
393
|
const t = Math.max(1, i), e = Math.log10(t), r = De + e * cr;
|
|
394
|
-
return
|
|
394
|
+
return pt(r, De, ur);
|
|
395
395
|
}, br = ({
|
|
396
396
|
contentSize: i,
|
|
397
397
|
viewportSize: t,
|
|
@@ -410,22 +410,22 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
410
410
|
visibleStartIndex: D,
|
|
411
411
|
visibleEndIndex: J
|
|
412
412
|
}) => {
|
|
413
|
-
const [G, rt] = jt(!1), [nt, st] = jt(!1), [wt,
|
|
413
|
+
const [G, rt] = jt(!1), [nt, st] = jt(!1), [wt, At] = jt(!1), k = g(null), B = g({
|
|
414
414
|
pointerId: null,
|
|
415
415
|
startThumbPosition: 0,
|
|
416
416
|
startClientX: 0,
|
|
417
417
|
startClientY: 0,
|
|
418
418
|
scale: 1,
|
|
419
419
|
captureTarget: null
|
|
420
|
-
}), w = g({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 }), C = g(e), U = g(r), H = g(qe), tt = g(null), L = g(null), b = g(null), K = g(0),
|
|
421
|
-
enabled:
|
|
422
|
-
size:
|
|
420
|
+
}), w = g({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 }), C = g(e), U = g(r), H = g(qe), tt = g(null), L = g(null), b = g(null), K = g(0), dt = g(0), et = Vt(() => mr(M, _), [_, M]), Y = Vt(() => fr(u), [u]), {
|
|
421
|
+
enabled: j,
|
|
422
|
+
size: ht,
|
|
423
423
|
offsetX: St,
|
|
424
424
|
offsetY: R,
|
|
425
425
|
className: Ft,
|
|
426
426
|
maxVisualDistance: Lt,
|
|
427
427
|
maxSpeedMultiplier: v,
|
|
428
|
-
minSpeedMultiplier:
|
|
428
|
+
minSpeedMultiplier: kt,
|
|
429
429
|
opacity: _t,
|
|
430
430
|
renderVisual: Gt,
|
|
431
431
|
maxSpeedCurve: T
|
|
@@ -435,13 +435,13 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
435
435
|
scrollBarVisible: i > t,
|
|
436
436
|
effectiveTapMaxDistance: Math.max(Lt, 1),
|
|
437
437
|
tapCircleMaxSpeedMultiplier: v,
|
|
438
|
-
tapCircleMinSpeedMultiplier:
|
|
438
|
+
tapCircleMinSpeedMultiplier: kt,
|
|
439
439
|
tapCircleMaxSpeedCurve: T,
|
|
440
440
|
tapScrollCircleOptions: M,
|
|
441
441
|
effectiveTrackLength: 0,
|
|
442
442
|
onScroll: r,
|
|
443
443
|
scrollPosition: e
|
|
444
|
-
}), { mainSizeKey: A, crossSizeKey:
|
|
444
|
+
}), { mainSizeKey: A, crossSizeKey: Mt, positionKey: gt, selectDelta: bt, getPointerCoordinate: Rt, arrowLabels: W, arrowIcons: at, directionClass: ft, orientation: Zt } = Y, Ot = Math.max(Lt, 1), Ct = t / i, Et = Math.max(t - f * 2, 0), Xt = Ct * Et, ct = Math.min(Math.max(Be, Xt || 0), Et || Be), xt = i - t, m = Math.max(Et - ct, 0), V = xt <= 0 || m <= 0 ? 0 : pt(e / xt * m, 0, m), It = V + ct / 2, vt = i > t || G, mt = vt && l;
|
|
445
445
|
be(() => {
|
|
446
446
|
O.current = {
|
|
447
447
|
viewportSize: t,
|
|
@@ -449,7 +449,7 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
449
449
|
scrollBarVisible: vt,
|
|
450
450
|
effectiveTapMaxDistance: Ot,
|
|
451
451
|
tapCircleMaxSpeedMultiplier: v,
|
|
452
|
-
tapCircleMinSpeedMultiplier:
|
|
452
|
+
tapCircleMinSpeedMultiplier: kt,
|
|
453
453
|
tapCircleMaxSpeedCurve: T,
|
|
454
454
|
tapScrollCircleOptions: M,
|
|
455
455
|
effectiveTrackLength: m,
|
|
@@ -463,41 +463,41 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
463
463
|
}, [r]), X(() => {
|
|
464
464
|
n || st(!1);
|
|
465
465
|
}, [n]);
|
|
466
|
-
const se = pr({ isDragging: G, isThumbHovered: nt, enableThumbDrag: n }),
|
|
466
|
+
const se = pr({ isDragging: G, isThumbHovered: nt, enableThumbDrag: n }), Nt = S((a, h) => {
|
|
467
467
|
const P = O.current, F = h ?? C.current;
|
|
468
468
|
if (U.current) {
|
|
469
469
|
const y = U.current(a, F);
|
|
470
470
|
if (typeof y == "number" && Number.isFinite(y))
|
|
471
471
|
return C.current = y, y;
|
|
472
472
|
}
|
|
473
|
-
const o = typeof a == "function" ? a(F) : a, c = Math.max(P.maxScrollPosition, 0), d = P.scrollBarVisible ?
|
|
473
|
+
const o = typeof a == "function" ? a(F) : a, c = Math.max(P.maxScrollPosition, 0), d = P.scrollBarVisible ? pt(o, 0, c) : 0;
|
|
474
474
|
return C.current = d, d;
|
|
475
475
|
}, []), $t = S(
|
|
476
476
|
(a) => {
|
|
477
477
|
const h = O.current, P = C.current;
|
|
478
478
|
if (!h.scrollBarVisible || h.maxScrollPosition <= 0) {
|
|
479
|
-
const E =
|
|
479
|
+
const E = Nt(0, P), q = E - P;
|
|
480
480
|
return { nextPosition: E, actualDelta: q, reachedBoundary: !0 };
|
|
481
481
|
}
|
|
482
482
|
if (a === 0)
|
|
483
483
|
return { nextPosition: P, actualDelta: 0, reachedBoundary: !1 };
|
|
484
|
-
const o =
|
|
485
|
-
return { nextPosition: o, actualDelta: c, reachedBoundary:
|
|
484
|
+
const o = Nt((E) => pt(E + a, 0, h.maxScrollPosition), P), c = o - P, d = a < 0 && P + a <= 0, y = a > 0 && P + a >= h.maxScrollPosition, z = a < 0 && (o <= 0 || d && c === 0) || a > 0 && (o >= h.maxScrollPosition || y && c === 0);
|
|
485
|
+
return { nextPosition: o, actualDelta: c, reachedBoundary: z };
|
|
486
486
|
},
|
|
487
|
-
[
|
|
487
|
+
[Nt]
|
|
488
488
|
), Ht = S(
|
|
489
489
|
(a, h) => {
|
|
490
490
|
a.current += h;
|
|
491
491
|
const P = Math.max(O.current.maxScrollPosition, 0);
|
|
492
|
-
P > 0 && (a.current =
|
|
492
|
+
P > 0 && (a.current = pt(a.current, -P, P));
|
|
493
493
|
const F = $t(a.current);
|
|
494
494
|
return a.current -= F.actualDelta, F.reachedBoundary && (a.current = 0), F;
|
|
495
495
|
},
|
|
496
496
|
[$t]
|
|
497
497
|
), Dt = S(() => {
|
|
498
|
-
L.current !== null && (window.cancelAnimationFrame(L.current), L.current = null), b.current = null, K.current = 0,
|
|
499
|
-
}, []),
|
|
500
|
-
H.current = { ...qe },
|
|
498
|
+
L.current !== null && (window.cancelAnimationFrame(L.current), L.current = null), b.current = null, K.current = 0, dt.current = 0;
|
|
499
|
+
}, []), zt = S(() => {
|
|
500
|
+
H.current = { ...qe }, At(!1), tt.current?.reset(), Dt();
|
|
501
501
|
}, [Dt]), Ut = S(
|
|
502
502
|
(a) => {
|
|
503
503
|
const h = H.current, P = O.current;
|
|
@@ -514,15 +514,15 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
514
514
|
L.current = window.requestAnimationFrame(Ut);
|
|
515
515
|
return;
|
|
516
516
|
}
|
|
517
|
-
const d = Math.min(h.distance, P.effectiveTapMaxDistance) / P.effectiveTapMaxDistance, y = d ** 1.1,
|
|
518
|
-
let
|
|
517
|
+
const d = Math.min(h.distance, P.effectiveTapMaxDistance) / P.effectiveTapMaxDistance, y = d ** 1.1, z = typeof P.tapScrollCircleOptions?.maxSpeedMultiplier == "number", E = Math.max(P.viewportSize * P.tapCircleMinSpeedMultiplier, 40), q = z ? E : 1200;
|
|
518
|
+
let lt = Math.max(P.viewportSize * P.tapCircleMaxSpeedMultiplier, q);
|
|
519
519
|
const Z = P.tapCircleMaxSpeedCurve;
|
|
520
520
|
if (Z) {
|
|
521
|
-
const ie = Math.max(Z.exponentialSteepness, 0), je = Math.max(Z.exponentialScale ?? P.tapCircleMaxSpeedMultiplier, 0), Ge = ie === 0 ? d : Math.expm1(ie * d),
|
|
522
|
-
|
|
521
|
+
const ie = Math.max(Z.exponentialSteepness, 0), je = Math.max(Z.exponentialScale ?? P.tapCircleMaxSpeedMultiplier, 0), Ge = ie === 0 ? d : Math.expm1(ie * d), ke = ie === 0 ? 1 : Math.expm1(ie) || 1, Ze = ke === 0 ? d : Math.min(Math.max(Ge / ke, 0), 1), Je = P.viewportSize * je * Ze;
|
|
522
|
+
lt = Math.min(lt, Math.max(Je, E));
|
|
523
523
|
}
|
|
524
|
-
const ot = Math.max(
|
|
525
|
-
|
|
524
|
+
const ot = Math.max(lt, E), Pt = Math.max(Z?.easedOffset ?? 0, 0), Tt = Math.min(1, y + Pt), yt = E + (ot - E) * Tt;
|
|
525
|
+
dt.current !== h.direction && (dt.current = h.direction, K.current = 0);
|
|
526
526
|
const { reachedBoundary: le } = Ht(K, h.direction * yt * c);
|
|
527
527
|
if (le) {
|
|
528
528
|
Dt();
|
|
@@ -539,52 +539,52 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
539
539
|
}, [Dt]);
|
|
540
540
|
const Me = S(
|
|
541
541
|
(a) => {
|
|
542
|
-
H.current = a,
|
|
542
|
+
H.current = a, At(a.active), a.active && a.direction !== 0 ? ae() : Dt();
|
|
543
543
|
},
|
|
544
544
|
[ae, Dt]
|
|
545
545
|
);
|
|
546
546
|
X(() => {
|
|
547
|
-
|
|
548
|
-
}, [
|
|
547
|
+
j || zt();
|
|
548
|
+
}, [zt, j]), X(() => {
|
|
549
549
|
const a = (h) => {
|
|
550
550
|
const F = h.detail?.paneId;
|
|
551
|
-
F && I && F !== I ||
|
|
551
|
+
F && I && F !== I || zt();
|
|
552
552
|
};
|
|
553
553
|
return window.addEventListener(Oe, a), () => {
|
|
554
554
|
window.removeEventListener(Oe, a);
|
|
555
555
|
};
|
|
556
|
-
}, [I,
|
|
557
|
-
if (!
|
|
556
|
+
}, [I, zt]), X(() => {
|
|
557
|
+
if (!j)
|
|
558
558
|
return;
|
|
559
559
|
const a = (h) => {
|
|
560
560
|
if (!H.current.active || H.current.pointerId === h.pointerId)
|
|
561
561
|
return;
|
|
562
562
|
const P = h.target;
|
|
563
563
|
if (!(P instanceof Node)) {
|
|
564
|
-
|
|
564
|
+
zt();
|
|
565
565
|
return;
|
|
566
566
|
}
|
|
567
|
-
tt.current?.getElement()?.contains(P) ||
|
|
567
|
+
tt.current?.getElement()?.contains(P) || zt();
|
|
568
568
|
};
|
|
569
569
|
return document.addEventListener("pointerdown", a, !0), () => {
|
|
570
570
|
document.removeEventListener("pointerdown", a, !0);
|
|
571
571
|
};
|
|
572
|
-
}, [
|
|
572
|
+
}, [zt, j]);
|
|
573
573
|
const de = (a) => {
|
|
574
574
|
if (!vt || m <= 0 || xt <= 0)
|
|
575
575
|
return 0;
|
|
576
|
-
const h =
|
|
577
|
-
return
|
|
576
|
+
const h = pt(a, 0, m);
|
|
577
|
+
return pt(h / m * xt, 0, xt);
|
|
578
578
|
}, xe = S((a) => {
|
|
579
579
|
const { scrollBarVisible: h, effectiveTrackLength: P, maxScrollPosition: F } = O.current;
|
|
580
580
|
if (N.debug("[ScrollBar] calculateScrollPositionFromThumb", () => ({ thumbPos: a, trackLen: P, maxScroll: F })), P <= 0 || F <= 0)
|
|
581
581
|
return null;
|
|
582
|
-
const o =
|
|
583
|
-
return
|
|
582
|
+
const o = pt(a, 0, P);
|
|
583
|
+
return pt(o / P * F, 0, F);
|
|
584
584
|
}, []), it = S(
|
|
585
585
|
(a) => {
|
|
586
|
-
const h = a.getBoundingClientRect(), P = u ? h.width : h.height, F = (
|
|
587
|
-
const E = Number.parseFloat(
|
|
586
|
+
const h = a.getBoundingClientRect(), P = u ? h.width : h.height, F = (z) => {
|
|
587
|
+
const E = Number.parseFloat(z);
|
|
588
588
|
return Number.isFinite(E) ? E : 0;
|
|
589
589
|
}, o = window.getComputedStyle(a), c = F(u ? o.width : o.height), d = c > 0 ? c + F(u ? o.paddingLeft : o.paddingTop) + F(u ? o.paddingRight : o.paddingBottom) + F(u ? o.borderLeftWidth : o.borderTopWidth) + F(u ? o.borderRightWidth : o.borderBottomWidth) : 0, y = d > 0 ? d : u ? a.offsetWidth : a.offsetHeight;
|
|
590
590
|
return y <= 0 || P <= 0 ? 1 : P / y;
|
|
@@ -595,7 +595,7 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
595
595
|
const h = B.current;
|
|
596
596
|
if (h.pointerId !== a.pointerId)
|
|
597
597
|
return;
|
|
598
|
-
const P = a.clientX - h.startClientX, F = a.clientY - h.startClientY, o =
|
|
598
|
+
const P = a.clientX - h.startClientX, F = a.clientY - h.startClientY, o = bt(P, F) / (h.scale || 1);
|
|
599
599
|
N.debug("[ScrollBar] handleThumbPointerMove", () => ({
|
|
600
600
|
delta: o,
|
|
601
601
|
startThumbPosition: h.startThumbPosition,
|
|
@@ -604,9 +604,9 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
604
604
|
metrics: O.current
|
|
605
605
|
}));
|
|
606
606
|
const c = xe(h.startThumbPosition + o);
|
|
607
|
-
c !== null &&
|
|
607
|
+
c !== null && Nt(c), a.cancelable && a.preventDefault();
|
|
608
608
|
},
|
|
609
|
-
[
|
|
609
|
+
[bt, xe, Nt]
|
|
610
610
|
), Kt = S(
|
|
611
611
|
(a) => {
|
|
612
612
|
const h = B.current;
|
|
@@ -614,8 +614,8 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
614
614
|
return;
|
|
615
615
|
document.removeEventListener("pointermove", Yt), document.removeEventListener("pointerup", Kt), document.removeEventListener("pointercancel", Kt);
|
|
616
616
|
const P = h.captureTarget;
|
|
617
|
-
if (P?.hasPointerCapture?.(a.pointerId) && P.releasePointerCapture(a.pointerId), B.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1, captureTarget: null }, rt(!1),
|
|
618
|
-
const F =
|
|
617
|
+
if (P?.hasPointerCapture?.(a.pointerId) && P.releasePointerCapture(a.pointerId), B.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1, captureTarget: null }, rt(!1), k.current) {
|
|
618
|
+
const F = k.current.getBoundingClientRect();
|
|
619
619
|
a.clientX >= F.left && a.clientX <= F.right && a.clientY >= F.top && a.clientY <= F.bottom || st(!1);
|
|
620
620
|
} else
|
|
621
621
|
st(!1);
|
|
@@ -632,9 +632,9 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
632
632
|
},
|
|
633
633
|
[Ht]
|
|
634
634
|
), { handleArrowPointerDown: ye, handleArrowPointerUp: ve, handleArrowKeyDown: Jt } = hr({
|
|
635
|
-
canUseArrowButtons:
|
|
635
|
+
canUseArrowButtons: mt,
|
|
636
636
|
enableArrowButtons: l,
|
|
637
|
-
resetTapScroll:
|
|
637
|
+
resetTapScroll: zt,
|
|
638
638
|
scrollByStep: Pe
|
|
639
639
|
}), re = (a) => {
|
|
640
640
|
if (!vt)
|
|
@@ -645,7 +645,7 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
645
645
|
}
|
|
646
646
|
if (a.pointerType === "mouse" && a.button !== 0 || a.ctrlKey)
|
|
647
647
|
return;
|
|
648
|
-
|
|
648
|
+
zt();
|
|
649
649
|
const h = a.currentTarget, P = it(h);
|
|
650
650
|
let F = null;
|
|
651
651
|
if (h.setPointerCapture)
|
|
@@ -671,10 +671,10 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
671
671
|
}
|
|
672
672
|
if (a.pointerType === "mouse" && a.button !== 0 || a.ctrlKey)
|
|
673
673
|
return;
|
|
674
|
-
const h = a.currentTarget, P = h.getBoundingClientRect(), F =
|
|
675
|
-
|
|
676
|
-
const d = c -
|
|
677
|
-
if (
|
|
674
|
+
const h = a.currentTarget, P = h.getBoundingClientRect(), F = Rt(a), o = it(h), c = (F - (u ? P.left : P.top)) / o;
|
|
675
|
+
zt();
|
|
676
|
+
const d = c - ct / 2, y = de(d);
|
|
677
|
+
if (Nt(y), h.setPointerCapture)
|
|
678
678
|
try {
|
|
679
679
|
h.setPointerCapture(a.pointerId);
|
|
680
680
|
} catch {
|
|
@@ -696,8 +696,8 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
696
696
|
qt();
|
|
697
697
|
return;
|
|
698
698
|
}
|
|
699
|
-
const P = a.clientX - h.startClientX, F = a.clientY - h.startClientY, o =
|
|
700
|
-
|
|
699
|
+
const P = a.clientX - h.startClientX, F = a.clientY - h.startClientY, o = bt(P, F) / (h.scale || 1), c = de(h.startThumbPosition + o);
|
|
700
|
+
Nt(c), a.cancelable && a.preventDefault();
|
|
701
701
|
}, fe = (a) => {
|
|
702
702
|
if (w.current.pointerId !== a.pointerId)
|
|
703
703
|
return;
|
|
@@ -710,13 +710,13 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
710
710
|
h.hasPointerCapture?.(a.pointerId) && h.releasePointerCapture(a.pointerId), qt();
|
|
711
711
|
}, we = (a) => {
|
|
712
712
|
w.current.pointerId === a.pointerId && qt();
|
|
713
|
-
}, Re =
|
|
714
|
-
const h = `calc(50% - ${
|
|
713
|
+
}, Re = Vt(() => pt((wt ? 1 : 0.8) * _t, 0, 1), [wt, _t]), Ve = Vt(() => {
|
|
714
|
+
const h = `calc(50% - ${ht / 2}px + ${R}px)`;
|
|
715
715
|
return {
|
|
716
716
|
left: St,
|
|
717
717
|
top: h
|
|
718
718
|
};
|
|
719
|
-
}, [St, R,
|
|
719
|
+
}, [St, R, ht]), me = (a, h, P, F) => /* @__PURE__ */ Q(
|
|
720
720
|
"button",
|
|
721
721
|
{
|
|
722
722
|
type: "button",
|
|
@@ -724,7 +724,7 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
724
724
|
className: "aqvs-scrollbar-arrow-button",
|
|
725
725
|
style: {
|
|
726
726
|
[A]: f,
|
|
727
|
-
[
|
|
727
|
+
[Mt]: f
|
|
728
728
|
},
|
|
729
729
|
"aria-label": h,
|
|
730
730
|
onPointerDown: ye(a),
|
|
@@ -733,7 +733,7 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
733
733
|
onPointerCancel: ve,
|
|
734
734
|
onKeyDown: Jt(a),
|
|
735
735
|
"aria-disabled": !l,
|
|
736
|
-
disabled: !
|
|
736
|
+
disabled: !mt,
|
|
737
737
|
children: /* @__PURE__ */ Q("span", { "aria-hidden": "true", children: P })
|
|
738
738
|
},
|
|
739
739
|
F
|
|
@@ -743,10 +743,10 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
743
743
|
maxScrollPosition: xt,
|
|
744
744
|
contentSize: i,
|
|
745
745
|
viewportSize: t,
|
|
746
|
-
thumbSize:
|
|
746
|
+
thumbSize: ct,
|
|
747
747
|
thumbPosition: V,
|
|
748
748
|
thumbCenter: It,
|
|
749
|
-
trackSize:
|
|
749
|
+
trackSize: Et,
|
|
750
750
|
isDragging: G,
|
|
751
751
|
isTapScrollActive: wt,
|
|
752
752
|
visibleStartIndex: D,
|
|
@@ -755,10 +755,10 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
755
755
|
return /* @__PURE__ */ ue(
|
|
756
756
|
"div",
|
|
757
757
|
{
|
|
758
|
-
className: ce("aqvs-scrollbar",
|
|
758
|
+
className: ce("aqvs-scrollbar", ft, !vt && "pointer-events-none opacity-0", x),
|
|
759
759
|
style: {
|
|
760
760
|
[A]: t,
|
|
761
|
-
[
|
|
761
|
+
[Mt]: f
|
|
762
762
|
},
|
|
763
763
|
role: "scrollbar",
|
|
764
764
|
tabIndex: -1,
|
|
@@ -768,12 +768,12 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
768
768
|
"aria-valuemax": xt,
|
|
769
769
|
"aria-orientation": u ? "horizontal" : "vertical",
|
|
770
770
|
children: [
|
|
771
|
-
!u && vt &&
|
|
771
|
+
!u && vt && j && /* @__PURE__ */ Q(
|
|
772
772
|
We,
|
|
773
773
|
{
|
|
774
774
|
ref: tt,
|
|
775
775
|
className: ce("aqvs-scrollbar-tap-circle-wrapper", Ft),
|
|
776
|
-
size:
|
|
776
|
+
size: ht,
|
|
777
777
|
maxVisualDistance: Ot,
|
|
778
778
|
style: Ve,
|
|
779
779
|
opacity: Re,
|
|
@@ -782,7 +782,7 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
782
782
|
},
|
|
783
783
|
"tap-circle"
|
|
784
784
|
),
|
|
785
|
-
me(-1,
|
|
785
|
+
me(-1, W[0], at[0], "arrow-start"),
|
|
786
786
|
/* @__PURE__ */ ue(
|
|
787
787
|
"div",
|
|
788
788
|
{
|
|
@@ -803,8 +803,8 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
803
803
|
{
|
|
804
804
|
className: ce("aqvs-scrollbar-thumb-wrapper", !(vt || G) && "pointer-events-none opacity-0"),
|
|
805
805
|
style: {
|
|
806
|
-
[A]:
|
|
807
|
-
[
|
|
806
|
+
[A]: ct,
|
|
807
|
+
[gt]: V,
|
|
808
808
|
...u ? { top: 0, bottom: 0 } : { left: 0, right: 0 }
|
|
809
809
|
},
|
|
810
810
|
onPointerDown: re,
|
|
@@ -818,7 +818,7 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
818
818
|
children: /* @__PURE__ */ Q(
|
|
819
819
|
"div",
|
|
820
820
|
{
|
|
821
|
-
ref:
|
|
821
|
+
ref: k,
|
|
822
822
|
className: ce("aqvs-scrollbar-thumb", u ? "aqvs-scrollbar-thumb-horizontal" : "aqvs-scrollbar-thumb-vertical"),
|
|
823
823
|
"data-thumb-state": se,
|
|
824
824
|
style: {
|
|
@@ -841,7 +841,7 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
841
841
|
},
|
|
842
842
|
"track"
|
|
843
843
|
),
|
|
844
|
-
me(1,
|
|
844
|
+
me(1, W[1], at[1], "arrow-end")
|
|
845
845
|
]
|
|
846
846
|
}
|
|
847
847
|
);
|
|
@@ -877,8 +877,8 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
877
877
|
onWheelHorizontal: nt,
|
|
878
878
|
contentInsets: st,
|
|
879
879
|
visibleStartIndex: wt,
|
|
880
|
-
visibleEndIndex:
|
|
881
|
-
renderOverlay:
|
|
880
|
+
visibleEndIndex: At,
|
|
881
|
+
renderOverlay: k,
|
|
882
882
|
initialScrollPosition: B = 0
|
|
883
883
|
}, w) => {
|
|
884
884
|
const C = g(Number.isFinite(B) ? Math.max(0, B) : 0), U = g(null), H = g(null), tt = g(nt);
|
|
@@ -890,7 +890,7 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
890
890
|
velocity: 0,
|
|
891
891
|
lastTimestamp: null,
|
|
892
892
|
generation: 0
|
|
893
|
-
}), b =
|
|
893
|
+
}), b = Vt(
|
|
894
894
|
() => ({
|
|
895
895
|
maxVelocity: D?.maxVelocity ?? Te.maxVelocity,
|
|
896
896
|
minVelocity: D?.minVelocity ?? Te.minVelocity,
|
|
@@ -899,7 +899,7 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
899
899
|
startVelocityThreshold: D?.startVelocityThreshold ?? Te.startVelocityThreshold
|
|
900
900
|
}),
|
|
901
901
|
[D]
|
|
902
|
-
), K =
|
|
902
|
+
), K = Vt(() => ({
|
|
903
903
|
top: Math.max(0, st?.top ?? 0),
|
|
904
904
|
bottom: Math.max(0, st?.bottom ?? 0)
|
|
905
905
|
}), [st]);
|
|
@@ -914,74 +914,74 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
914
914
|
enablePointerDrag: u,
|
|
915
915
|
contentInsets: K
|
|
916
916
|
}));
|
|
917
|
-
const
|
|
918
|
-
|
|
919
|
-
const et =
|
|
917
|
+
const dt = g({ contentSize: t, viewportSize: e });
|
|
918
|
+
dt.current = { contentSize: t, viewportSize: e };
|
|
919
|
+
const et = Vt(() => t > e, [t, e]), Y = S(
|
|
920
920
|
(T) => {
|
|
921
|
-
const { contentSize: O, viewportSize: A } =
|
|
922
|
-
if (N.debug("[ScrollPane] scrollTo called", () => ({ newPosition: T, contentSize: O, viewportSize: A, currentIsScrollable:
|
|
923
|
-
return C.current !== 0 && (C.current = 0, f?.(0,
|
|
924
|
-
const
|
|
925
|
-
if (!Number.isFinite(
|
|
926
|
-
return N.warn("[ScrollPane] scrollTo received a non-finite position; keeping the current position", { nextPosition:
|
|
927
|
-
const
|
|
928
|
-
return C.current !==
|
|
921
|
+
const { contentSize: O, viewportSize: A } = dt.current, Mt = O > A, gt = C.current;
|
|
922
|
+
if (N.debug("[ScrollPane] scrollTo called", () => ({ newPosition: T, contentSize: O, viewportSize: A, currentIsScrollable: Mt, prevPosition: gt })), !Mt)
|
|
923
|
+
return C.current !== 0 && (C.current = 0, f?.(0, gt)), C.current;
|
|
924
|
+
const bt = typeof T == "function" ? T(C.current) : T;
|
|
925
|
+
if (!Number.isFinite(bt))
|
|
926
|
+
return N.warn("[ScrollPane] scrollTo received a non-finite position; keeping the current position", { nextPosition: bt }), C.current;
|
|
927
|
+
const Rt = Math.max(O - A, 0), W = pt(bt, 0, Rt);
|
|
928
|
+
return C.current !== W && (C.current = W, f?.(W, gt)), C.current;
|
|
929
929
|
},
|
|
930
930
|
[f]
|
|
931
|
-
),
|
|
931
|
+
), j = S(() => {
|
|
932
932
|
const T = L.current;
|
|
933
933
|
T.generation += 1, T.frame !== null && cancelAnimationFrame(T.frame), T.frame = null, T.velocity = 0, T.lastTimestamp = null;
|
|
934
|
-
}, []),
|
|
934
|
+
}, []), ht = g(j);
|
|
935
935
|
X(() => {
|
|
936
|
-
|
|
937
|
-
}, [
|
|
938
|
-
|
|
936
|
+
ht.current = j;
|
|
937
|
+
}, [j]), X(() => () => {
|
|
938
|
+
ht.current();
|
|
939
939
|
}, []);
|
|
940
940
|
const St = S(
|
|
941
941
|
(T) => {
|
|
942
942
|
if (!et)
|
|
943
943
|
return;
|
|
944
|
-
const { maxVelocity: O, minVelocity: A, deceleration:
|
|
945
|
-
if (Math.abs(
|
|
944
|
+
const { maxVelocity: O, minVelocity: A, deceleration: Mt, startVelocityThreshold: gt } = b, bt = pt(T, -O, O);
|
|
945
|
+
if (Math.abs(bt) < gt)
|
|
946
946
|
return;
|
|
947
|
-
|
|
948
|
-
const
|
|
949
|
-
const
|
|
950
|
-
if (
|
|
947
|
+
j(), L.current.velocity = bt, L.current.lastTimestamp = null;
|
|
948
|
+
const Rt = L.current.generation, W = (at) => {
|
|
949
|
+
const ft = L.current;
|
|
950
|
+
if (ft.generation !== Rt)
|
|
951
951
|
return;
|
|
952
|
-
if (
|
|
953
|
-
|
|
952
|
+
if (ft.lastTimestamp === null) {
|
|
953
|
+
ft.lastTimestamp = at, ft.frame = requestAnimationFrame(W);
|
|
954
954
|
return;
|
|
955
955
|
}
|
|
956
|
-
const Zt =
|
|
957
|
-
if (
|
|
958
|
-
|
|
956
|
+
const Zt = at - ft.lastTimestamp;
|
|
957
|
+
if (ft.lastTimestamp = at, Zt <= 0) {
|
|
958
|
+
ft.frame = requestAnimationFrame(W);
|
|
959
959
|
return;
|
|
960
960
|
}
|
|
961
|
-
const Ot =
|
|
962
|
-
let
|
|
963
|
-
const
|
|
964
|
-
Ot > 0 ?
|
|
965
|
-
const
|
|
966
|
-
if (
|
|
961
|
+
const Ot = ft.velocity;
|
|
962
|
+
let Ct = Ot;
|
|
963
|
+
const Et = Mt * Zt;
|
|
964
|
+
Ot > 0 ? Ct = Math.max(0, Ot - Et) : Ot < 0 && (Ct = Math.min(0, Ot + Et));
|
|
965
|
+
const ct = (Ot + Ct) / 2 * Zt, xt = C.current;
|
|
966
|
+
if (ct !== 0 && Y((se) => se + ct), L.current.generation !== Rt)
|
|
967
967
|
return;
|
|
968
|
-
const m = C.current, { contentSize: V, viewportSize: It } =
|
|
969
|
-
|
|
970
|
-
const
|
|
971
|
-
if (Math.abs(
|
|
972
|
-
|
|
968
|
+
const m = C.current, { contentSize: V, viewportSize: It } = dt.current, vt = Math.max(V - It, 0);
|
|
969
|
+
ft.velocity = Ct;
|
|
970
|
+
const mt = m === xt || m <= 0 && Ct <= 0 || m >= vt && Ct >= 0;
|
|
971
|
+
if (Math.abs(Ct) < A || mt) {
|
|
972
|
+
j();
|
|
973
973
|
return;
|
|
974
974
|
}
|
|
975
|
-
|
|
975
|
+
ft.frame = requestAnimationFrame(W);
|
|
976
976
|
};
|
|
977
|
-
L.current.frame = requestAnimationFrame(
|
|
977
|
+
L.current.frame = requestAnimationFrame(W);
|
|
978
978
|
},
|
|
979
|
-
[et, b, Y,
|
|
979
|
+
[et, b, Y, j]
|
|
980
980
|
), R = g(St);
|
|
981
981
|
X(() => {
|
|
982
982
|
R.current = St;
|
|
983
983
|
}, [St]), be(() => {
|
|
984
|
-
|
|
984
|
+
dt.current = { contentSize: t, viewportSize: e };
|
|
985
985
|
}, [t, e]), be(() => {
|
|
986
986
|
const T = H.current;
|
|
987
987
|
if (!T) return;
|
|
@@ -992,39 +992,41 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
992
992
|
}, []), be(() => {
|
|
993
993
|
if (et) {
|
|
994
994
|
N.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", () => ({ contentSize: t, viewportSize: e, scrollPosition: C.current }));
|
|
995
|
-
const T =
|
|
995
|
+
const T = pt(t - e, 0, t);
|
|
996
996
|
C.current > T && Y(T);
|
|
997
997
|
} else
|
|
998
998
|
Y(0);
|
|
999
999
|
}, [et, Y, t, e]), X(() => {
|
|
1000
1000
|
const T = (A) => {
|
|
1001
|
-
if (
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
A.
|
|
1007
|
-
|
|
1001
|
+
if (A.ctrlKey)
|
|
1002
|
+
return;
|
|
1003
|
+
const Mt = A.shiftKey && A.deltaX === 0, gt = Mt ? A.deltaY : A.deltaX, bt = Mt ? 0 : A.deltaY;
|
|
1004
|
+
if (gt !== 0 && Math.abs(gt) >= Math.abs(bt)) {
|
|
1005
|
+
if (tt.current) {
|
|
1006
|
+
A.preventDefault(), j();
|
|
1007
|
+
let at = gt;
|
|
1008
|
+
A.deltaMode === 1 ? at *= 16 : A.deltaMode === 2 && (at *= e), tt.current(at);
|
|
1008
1009
|
}
|
|
1010
|
+
return;
|
|
1009
1011
|
}
|
|
1010
|
-
if (!et || A.
|
|
1012
|
+
if (!et || A.deltaY === 0)
|
|
1011
1013
|
return;
|
|
1012
|
-
A.preventDefault(),
|
|
1013
|
-
let
|
|
1014
|
-
A.deltaMode === 1 ?
|
|
1014
|
+
A.preventDefault(), j();
|
|
1015
|
+
let W = A.deltaY;
|
|
1016
|
+
A.deltaMode === 1 ? W *= 16 : A.deltaMode === 2 && (W *= e), rt !== 1 && (W *= rt), N.debug("[ScrollPane] wheel event", () => ({ deltaY: W, scrollPosition: C.current, wheelSpeedMultiplier: rt, deltaMode: A.deltaMode, scrollTop: H.current?.scrollTop })), Y((at) => at + W);
|
|
1015
1017
|
}, O = U.current;
|
|
1016
1018
|
return O && O.addEventListener("wheel", T, { passive: !1 }), () => {
|
|
1017
1019
|
O && O.removeEventListener("wheel", T);
|
|
1018
1020
|
};
|
|
1019
|
-
}, [et, Y,
|
|
1021
|
+
}, [et, Y, j, e, rt]), ze(
|
|
1020
1022
|
w,
|
|
1021
1023
|
() => ({
|
|
1022
|
-
scrollTo: (T) => (
|
|
1024
|
+
scrollTo: (T) => (j(), Y(T)),
|
|
1023
1025
|
getScrollPosition: () => C.current,
|
|
1024
1026
|
getContentSize: () => t,
|
|
1025
1027
|
getViewportSize: () => e
|
|
1026
1028
|
}),
|
|
1027
|
-
[Y, t, e,
|
|
1029
|
+
[Y, t, e, j]
|
|
1028
1030
|
);
|
|
1029
1031
|
const Ft = g(Y);
|
|
1030
1032
|
X(() => {
|
|
@@ -1038,9 +1040,9 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
1038
1040
|
shouldCancelNextClick: !1,
|
|
1039
1041
|
clickResetTimer: null,
|
|
1040
1042
|
velocitySamples: []
|
|
1041
|
-
}),
|
|
1043
|
+
}), kt = g(u);
|
|
1042
1044
|
X(() => {
|
|
1043
|
-
|
|
1045
|
+
kt.current = u;
|
|
1044
1046
|
}, [u]);
|
|
1045
1047
|
const _t = g(et);
|
|
1046
1048
|
X(() => {
|
|
@@ -1058,21 +1060,21 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
1058
1060
|
const T = H.current;
|
|
1059
1061
|
if (!T)
|
|
1060
1062
|
return;
|
|
1061
|
-
const O = 6, A = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(),
|
|
1063
|
+
const O = 6, A = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), Mt = () => {
|
|
1062
1064
|
const m = v.current;
|
|
1063
1065
|
m.pointerId = null, m.startClientY = 0, m.startScroll = 0, m.isDragging = !1, m.velocitySamples = [];
|
|
1064
|
-
},
|
|
1066
|
+
}, gt = () => {
|
|
1065
1067
|
const m = v.current;
|
|
1066
1068
|
m.clickResetTimer !== null && (window.clearTimeout(m.clickResetTimer), m.clickResetTimer = null);
|
|
1067
|
-
},
|
|
1069
|
+
}, bt = (m) => {
|
|
1068
1070
|
const V = v.current, It = A();
|
|
1069
1071
|
V.velocitySamples.push({ clientY: m, time: It });
|
|
1070
1072
|
const vt = Gt.current.velocitySampleWindow;
|
|
1071
|
-
V.velocitySamples = V.velocitySamples.filter((
|
|
1072
|
-
},
|
|
1073
|
+
V.velocitySamples = V.velocitySamples.filter((mt) => It - mt.time <= vt);
|
|
1074
|
+
}, Rt = (m) => m instanceof HTMLElement && m.closest("[data-scrollpane-ignore-drag='true']") !== null, W = (m) => {
|
|
1073
1075
|
const V = v.current;
|
|
1074
1076
|
V.shouldCancelNextClick && (m.preventDefault(), m.stopPropagation(), V.shouldCancelNextClick = !1);
|
|
1075
|
-
},
|
|
1077
|
+
}, at = (m) => {
|
|
1076
1078
|
const V = v.current;
|
|
1077
1079
|
if (!V.isDragging) {
|
|
1078
1080
|
if (V.isDragging = !0, V.shouldCancelNextClick = !0, !T.hasPointerCapture(m.pointerId))
|
|
@@ -1080,66 +1082,66 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
1080
1082
|
T.setPointerCapture(m.pointerId);
|
|
1081
1083
|
} catch {
|
|
1082
1084
|
}
|
|
1083
|
-
|
|
1085
|
+
bt(m.clientY);
|
|
1084
1086
|
}
|
|
1085
|
-
},
|
|
1087
|
+
}, ft = (m) => {
|
|
1086
1088
|
const V = v.current;
|
|
1087
|
-
T.hasPointerCapture(m) && T.releasePointerCapture(m), V.shouldCancelNextClick = !1,
|
|
1089
|
+
T.hasPointerCapture(m) && T.releasePointerCapture(m), V.shouldCancelNextClick = !1, gt(), Mt();
|
|
1088
1090
|
}, Zt = (m) => {
|
|
1089
1091
|
const V = v.current;
|
|
1090
1092
|
if (V.pointerId !== m.pointerId)
|
|
1091
1093
|
return;
|
|
1092
1094
|
if (m.buttons === 0) {
|
|
1093
|
-
|
|
1095
|
+
ft(m.pointerId);
|
|
1094
1096
|
return;
|
|
1095
1097
|
}
|
|
1096
|
-
if (!(
|
|
1098
|
+
if (!(kt.current && _t.current) || !V.isDragging && (Math.abs(m.clientY - V.startClientY) < O || (at(m), !V.isDragging)))
|
|
1097
1099
|
return;
|
|
1098
|
-
|
|
1100
|
+
bt(m.clientY);
|
|
1099
1101
|
const It = m.clientY - V.startClientY, vt = V.startScroll - It;
|
|
1100
1102
|
Ft.current(vt), m.cancelable && m.preventDefault();
|
|
1101
1103
|
}, Ot = (m) => {
|
|
1102
1104
|
const V = v.current;
|
|
1103
1105
|
if (V.pointerId !== m.pointerId)
|
|
1104
1106
|
return;
|
|
1105
|
-
V.isDragging && V.shouldCancelNextClick && m.cancelable && (m.preventDefault(), m.stopPropagation()), V.isDragging &&
|
|
1107
|
+
V.isDragging && V.shouldCancelNextClick && m.cancelable && (m.preventDefault(), m.stopPropagation()), V.isDragging && bt(m.clientY);
|
|
1106
1108
|
let It = 0;
|
|
1107
1109
|
if (V.isDragging && V.velocitySamples.length >= 2) {
|
|
1108
|
-
const
|
|
1109
|
-
if (
|
|
1110
|
-
const Ht =
|
|
1110
|
+
const mt = V.velocitySamples, se = Gt.current.velocitySampleWindow, Nt = mt[mt.length - 1], $t = mt.find((Ht) => Nt.time - Ht.time <= se) ?? mt[0];
|
|
1111
|
+
if (Nt && $t && Nt.time !== $t.time) {
|
|
1112
|
+
const Ht = Nt.clientY - $t.clientY, Dt = Nt.time - $t.time;
|
|
1111
1113
|
It = -(Ht / Dt);
|
|
1112
1114
|
}
|
|
1113
1115
|
}
|
|
1114
|
-
|
|
1115
|
-
const
|
|
1116
|
-
|
|
1116
|
+
gt(), V.shouldCancelNextClick && (V.clickResetTimer = window.setTimeout(() => {
|
|
1117
|
+
const mt = v.current;
|
|
1118
|
+
mt.shouldCancelNextClick = !1, mt.clickResetTimer = null;
|
|
1117
1119
|
}, 0));
|
|
1118
1120
|
const vt = Gt.current.startVelocityThreshold;
|
|
1119
|
-
|
|
1120
|
-
},
|
|
1121
|
-
if (v.current.pointerId !== null || !(
|
|
1121
|
+
Mt(), T.hasPointerCapture(m.pointerId) && T.releasePointerCapture(m.pointerId), Math.abs(It) >= vt && R.current?.(It);
|
|
1122
|
+
}, Ct = (m) => {
|
|
1123
|
+
if (v.current.pointerId !== null || !(kt.current && _t.current) || m.button !== 0 && m.pointerType === "mouse" || m.ctrlKey || m.metaKey || m.altKey || Rt(m.target))
|
|
1122
1124
|
return;
|
|
1123
|
-
window.dispatchEvent(new CustomEvent(Oe, { detail: { paneId: Lt } })),
|
|
1125
|
+
window.dispatchEvent(new CustomEvent(Oe, { detail: { paneId: Lt } })), ht.current?.();
|
|
1124
1126
|
const V = v.current;
|
|
1125
|
-
|
|
1126
|
-
},
|
|
1127
|
-
v.current.pointerId === m.pointerId &&
|
|
1128
|
-
},
|
|
1129
|
-
["click",
|
|
1130
|
-
["pointerdown",
|
|
1127
|
+
gt(), V.pointerId = m.pointerId, V.startClientY = m.clientY, V.startScroll = C.current, V.isDragging = !1, V.shouldCancelNextClick = !1, V.velocitySamples = [];
|
|
1128
|
+
}, Et = (m) => {
|
|
1129
|
+
v.current.pointerId === m.pointerId && ft(m.pointerId);
|
|
1130
|
+
}, ct = [
|
|
1131
|
+
["click", W, !0],
|
|
1132
|
+
["pointerdown", Ct, { passive: !1 }],
|
|
1131
1133
|
["lostpointercapture", (m) => {
|
|
1132
|
-
v.current.pointerId === m.pointerId &&
|
|
1134
|
+
v.current.pointerId === m.pointerId && ft(m.pointerId);
|
|
1133
1135
|
}, void 0]
|
|
1134
1136
|
], xt = [
|
|
1135
1137
|
["pointermove", Zt, { passive: !1 }],
|
|
1136
1138
|
["pointerup", Ot, void 0],
|
|
1137
|
-
["pointercancel",
|
|
1139
|
+
["pointercancel", Et, void 0]
|
|
1138
1140
|
];
|
|
1139
|
-
return Ce(T,
|
|
1140
|
-
Ce(T,
|
|
1141
|
+
return Ce(T, ct, "add"), Ce(window, xt, "add"), () => {
|
|
1142
|
+
Ce(T, ct, "remove"), Ce(window, xt, "remove");
|
|
1141
1143
|
const m = v.current;
|
|
1142
|
-
m.pointerId !== null && T.hasPointerCapture(m.pointerId) && T.releasePointerCapture(m.pointerId),
|
|
1144
|
+
m.pointerId !== null && T.hasPointerCapture(m.pointerId) && T.releasePointerCapture(m.pointerId), gt(), Mt();
|
|
1143
1145
|
};
|
|
1144
1146
|
}, [Lt]), /* @__PURE__ */ ue("div", { ref: U, "data-testid": I, className: ce("aqvs-scroll-pane", x), style: M, children: [
|
|
1145
1147
|
/* @__PURE__ */ ue(
|
|
@@ -1178,15 +1180,15 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
1178
1180
|
itemCount: J,
|
|
1179
1181
|
renderThumbOverlay: G,
|
|
1180
1182
|
visibleStartIndex: wt,
|
|
1181
|
-
visibleEndIndex:
|
|
1183
|
+
visibleEndIndex: At
|
|
1182
1184
|
},
|
|
1183
1185
|
"scrollbar"
|
|
1184
1186
|
),
|
|
1185
|
-
|
|
1187
|
+
k?.()
|
|
1186
1188
|
] });
|
|
1187
1189
|
}
|
|
1188
1190
|
), He = (i, t, e) => Math.min(Math.max(i, t), e), Dr = ({ dragState: i, normalizedDistance: t, sizeScale: e, size: r }) => {
|
|
1189
|
-
const n = Math.max(r / 2, 1), s = 1 + t * 0.65, l = Math.max(0.65, 1 - t * 0.25), u = i.direction * t * 26 * e, f = 0.8 + t * 0.18, x = 3 * e, I = 6 * e, M = 22 * e, _ = Math.abs(u) + I, p = u > 0 ? x : -Math.abs(u) - x, D = Math.max(2.5, 3 * e), J = He(i.offsetX, -n, n), G = He(i.offsetY, -n, n), rt = n * 0.35, nt = J / n * rt, st = G / n * rt, wt = nt * 0.45,
|
|
1191
|
+
const n = Math.max(r / 2, 1), s = 1 + t * 0.65, l = Math.max(0.65, 1 - t * 0.25), u = i.direction * t * 26 * e, f = 0.8 + t * 0.18, x = 3 * e, I = 6 * e, M = 22 * e, _ = Math.abs(u) + I, p = u > 0 ? x : -Math.abs(u) - x, D = Math.max(2.5, 3 * e), J = He(i.offsetX, -n, n), G = He(i.offsetY, -n, n), rt = n * 0.35, nt = J / n * rt, st = G / n * rt, wt = nt * 0.45, At = st * 0.45, k = Math.max(M * 0.38, 6), B = 0.65 + t * 0.2, w = i.active;
|
|
1190
1192
|
return /* @__PURE__ */ ue(Ke, { children: [
|
|
1191
1193
|
/* @__PURE__ */ Q(
|
|
1192
1194
|
"div",
|
|
@@ -1215,9 +1217,9 @@ const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
1215
1217
|
{
|
|
1216
1218
|
className: "aqvs-sample-visual-pupil",
|
|
1217
1219
|
style: {
|
|
1218
|
-
width:
|
|
1219
|
-
height:
|
|
1220
|
-
transform: `translate(calc(-50% + ${wt}px), calc(-50% + ${
|
|
1220
|
+
width: k,
|
|
1221
|
+
height: k,
|
|
1222
|
+
transform: `translate(calc(-50% + ${wt}px), calc(-50% + ${At}px)) scale(${l}, ${s})`,
|
|
1221
1223
|
opacity: B,
|
|
1222
1224
|
boxShadow: "0 0 8px rgba(255,255,255,0.45)",
|
|
1223
1225
|
transition: w ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
|
|
@@ -1711,7 +1713,7 @@ class oe {
|
|
|
1711
1713
|
return { cumulative: 0, total: this.total, currentValue: 0, safeIndex: 0 };
|
|
1712
1714
|
if (this.size === 0)
|
|
1713
1715
|
return { cumulative: 0, total: this.total ?? 0, currentValue: 0, safeIndex: 0 };
|
|
1714
|
-
const r =
|
|
1716
|
+
const r = pt(Math.trunc(t), 0, this.size - 1), n = e?.materializeOption;
|
|
1715
1717
|
this._materializeRanges(n, r, !0);
|
|
1716
1718
|
let s = 0, l = r + 1;
|
|
1717
1719
|
for (; l > 0; ) {
|
|
@@ -2050,12 +2052,12 @@ function Mr(i) {
|
|
|
2050
2052
|
}, []), x = S(() => {
|
|
2051
2053
|
t.current.clear(), e.current = new _e();
|
|
2052
2054
|
}, []);
|
|
2053
|
-
return
|
|
2055
|
+
return Vt(() => ({ get: s, set: l, has: u, remove: f, clear: x }), [s, l, u, f, x]);
|
|
2054
2056
|
}
|
|
2055
2057
|
const Pr = 1e4, Lr = () => {
|
|
2056
2058
|
const { get: i, set: t, has: e, clear: r } = Mr(Pr);
|
|
2057
|
-
return
|
|
2058
|
-
},
|
|
2059
|
+
return Vt(() => ({ get: i, set: t, has: e, clear: r }), [i, t, e, r]);
|
|
2060
|
+
}, ut = (i, t) => t <= 0 ? 0 : pt(i, 0, t - 1), Xe = (i) => ({
|
|
2059
2061
|
top: Math.max(0, i?.top ?? 0),
|
|
2060
2062
|
bottom: Math.max(0, i?.bottom ?? 0)
|
|
2061
2063
|
}), ee = (i, t) => i <= t ? 0 : i - t, ge = (i, t) => i <= 0 ? t : i + t, Ne = 1e3, $e = 2e3, yr = 1048576, Se = (i) => {
|
|
@@ -2066,11 +2068,11 @@ const Pr = 1e4, Lr = () => {
|
|
|
2066
2068
|
const f = Se(r);
|
|
2067
2069
|
if (f === 0n)
|
|
2068
2070
|
return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
|
|
2069
|
-
const x = (
|
|
2071
|
+
const x = (k) => k < 0n ? 0n : k >= f ? f - 1n : k, I = { materializeOption: { materialize: !1 } }, { index: M, cumulative: _ } = s.findIndexAtOrAfter(i, I);
|
|
2070
2072
|
let p;
|
|
2071
2073
|
M === -1 ? p = f - 1n : (_ === i ? p = Se(M + 1) : p = Se(M), p >= f && (p = f - 1n)), i <= 0 && (p = 0n), u && i >= l && (p = f - 1n);
|
|
2072
|
-
const D = (
|
|
2073
|
-
const B = Number(
|
|
2074
|
+
const D = (k) => {
|
|
2075
|
+
const B = Number(k);
|
|
2074
2076
|
if (!Number.isSafeInteger(B))
|
|
2075
2077
|
return null;
|
|
2076
2078
|
const { cumulative: w } = s.prefixSum(B, { materializeOption: { materialize: !1 } });
|
|
@@ -2080,9 +2082,9 @@ const Pr = 1e4, Lr = () => {
|
|
|
2080
2082
|
if (C === -1)
|
|
2081
2083
|
return null;
|
|
2082
2084
|
const U = Se(C);
|
|
2083
|
-
return U >
|
|
2084
|
-
}, J = (
|
|
2085
|
-
let B = 0, w =
|
|
2085
|
+
return U > k ? U : null;
|
|
2086
|
+
}, J = (k) => {
|
|
2087
|
+
let B = 0, w = k, C = k, U = 0n, H = 0;
|
|
2086
2088
|
for (; w < f && B < t; ) {
|
|
2087
2089
|
const tt = Number(w), L = n(tt);
|
|
2088
2090
|
if (B += L, C = w, w += 1n, U += 1n, !Number.isFinite(L) || L < 0)
|
|
@@ -2100,28 +2102,28 @@ const Pr = 1e4, Lr = () => {
|
|
|
2100
2102
|
} else
|
|
2101
2103
|
H = 0;
|
|
2102
2104
|
}
|
|
2103
|
-
return U === 0n && (C =
|
|
2105
|
+
return U === 0n && (C = k), { height: B, end: C };
|
|
2104
2106
|
};
|
|
2105
2107
|
let { height: G, end: rt } = J(p);
|
|
2106
2108
|
if (G < t && p > 0n) {
|
|
2107
|
-
let
|
|
2108
|
-
for (;
|
|
2109
|
-
|
|
2110
|
-
const U = Number(
|
|
2109
|
+
let k = p, B = G, w = 0;
|
|
2110
|
+
for (; k > 0n && B < t; ) {
|
|
2111
|
+
k -= 1n;
|
|
2112
|
+
const U = Number(k), H = n(U);
|
|
2111
2113
|
if (B += H, !Number.isFinite(H) || H < 0)
|
|
2112
2114
|
break;
|
|
2113
2115
|
if (H === 0) {
|
|
2114
2116
|
if (w += 1, w > Ne) {
|
|
2115
|
-
const tt = Number(
|
|
2117
|
+
const tt = Number(k);
|
|
2116
2118
|
if (!Number.isSafeInteger(tt))
|
|
2117
2119
|
break;
|
|
2118
2120
|
const { cumulative: L } = s.prefixSum(tt, { materializeOption: { materialize: !1 } });
|
|
2119
2121
|
if (!Number.isFinite(L))
|
|
2120
2122
|
break;
|
|
2121
2123
|
const { index: b } = s.findIndexAtOrAfter(L - 0.5, { materializeOption: { materialize: !1 } }), K = b === -1 ? -1n : Se(b);
|
|
2122
|
-
if (K >= 0n && K <
|
|
2123
|
-
|
|
2124
|
-
else if (K ===
|
|
2124
|
+
if (K >= 0n && K < k)
|
|
2125
|
+
k = K + 1n, w = 0;
|
|
2126
|
+
else if (K === k && k >= 1n && n(Number(k - 1n)) > 0)
|
|
2125
2127
|
w = 0;
|
|
2126
2128
|
else
|
|
2127
2129
|
break;
|
|
@@ -2129,16 +2131,16 @@ const Pr = 1e4, Lr = () => {
|
|
|
2129
2131
|
} else
|
|
2130
2132
|
w = 0;
|
|
2131
2133
|
}
|
|
2132
|
-
p = x(
|
|
2134
|
+
p = x(k);
|
|
2133
2135
|
const C = J(p);
|
|
2134
2136
|
G = C.height, rt = C.end;
|
|
2135
2137
|
}
|
|
2136
|
-
const nt = x(p), st = x(rt), wt = x(nt - BigInt(Math.max(0, e))),
|
|
2138
|
+
const nt = x(p), st = x(rt), wt = x(nt - BigInt(Math.max(0, e))), At = x(st + BigInt(Math.max(0, e)));
|
|
2137
2139
|
return {
|
|
2138
|
-
renderingStartIndex:
|
|
2139
|
-
renderingEndIndex:
|
|
2140
|
-
visibleStartIndex:
|
|
2141
|
-
visibleEndIndex:
|
|
2140
|
+
renderingStartIndex: ut(Number(wt), r),
|
|
2141
|
+
renderingEndIndex: ut(Number(At), r),
|
|
2142
|
+
visibleStartIndex: ut(Number(nt), r),
|
|
2143
|
+
visibleEndIndex: ut(Number(st), r)
|
|
2142
2144
|
};
|
|
2143
2145
|
}, Rr = (i, t, e, r, n, s, l) => {
|
|
2144
2146
|
if (r === 0)
|
|
@@ -2147,17 +2149,17 @@ const Pr = 1e4, Lr = () => {
|
|
|
2147
2149
|
if (r >= Number.MAX_SAFE_INTEGER)
|
|
2148
2150
|
return wr(f, t, e, r, n, s, l, u);
|
|
2149
2151
|
const { index: x, cumulative: I, currentValue: M } = s.findIndexAtOrAfter(f, { materializeOption: { materialize: !1 } }), _ = x === -1 ? t <= 0 || (I ?? 0) < f + (M ?? 0) ? r - 1 : 0 : x;
|
|
2150
|
-
let p =
|
|
2152
|
+
let p = ut(_, r), D = 0;
|
|
2151
2153
|
if (x !== -1 && I === f)
|
|
2152
|
-
p =
|
|
2154
|
+
p = ut(x + 1, r), D = 0;
|
|
2153
2155
|
else if (p === x && I !== void 0 && M !== void 0)
|
|
2154
2156
|
D = I - M - f;
|
|
2155
2157
|
else {
|
|
2156
|
-
const { cumulative:
|
|
2157
|
-
D = (
|
|
2158
|
+
const { cumulative: k, currentValue: B } = s.prefixSum(p, { materializeOption: { materialize: !1 } });
|
|
2159
|
+
D = (k ?? 0) - (B ?? 0) - f;
|
|
2158
2160
|
}
|
|
2159
|
-
const J = D, G = (
|
|
2160
|
-
let w =
|
|
2161
|
+
const J = D, G = (k, B) => {
|
|
2162
|
+
let w = k, C = B, U = 0;
|
|
2161
2163
|
for (; w < r && C < t; ) {
|
|
2162
2164
|
const H = n(w);
|
|
2163
2165
|
if (C += H, w++, !Number.isFinite(H) || H < 0)
|
|
@@ -2179,10 +2181,10 @@ const Pr = 1e4, Lr = () => {
|
|
|
2179
2181
|
}, rt = G(p, D);
|
|
2180
2182
|
let nt = rt.cursor;
|
|
2181
2183
|
if (D = rt.height, D < t && p > 0) {
|
|
2182
|
-
let
|
|
2183
|
-
for (; B >= 0 &&
|
|
2184
|
+
let k = D + Math.abs(Math.min(0, J)), B = p - 1, w = 0;
|
|
2185
|
+
for (; B >= 0 && k < t; ) {
|
|
2184
2186
|
const U = n(B);
|
|
2185
|
-
if (
|
|
2187
|
+
if (k += U, !Number.isFinite(U) || U < 0) {
|
|
2186
2188
|
B--;
|
|
2187
2189
|
break;
|
|
2188
2190
|
}
|
|
@@ -2204,12 +2206,12 @@ const Pr = 1e4, Lr = () => {
|
|
|
2204
2206
|
w = 0;
|
|
2205
2207
|
B--;
|
|
2206
2208
|
}
|
|
2207
|
-
p =
|
|
2209
|
+
p = ut(B + 1, r);
|
|
2208
2210
|
const C = G(p, 0);
|
|
2209
2211
|
nt = C.cursor, D = C.height;
|
|
2210
2212
|
}
|
|
2211
|
-
const st =
|
|
2212
|
-
return { renderingStartIndex: st, renderingEndIndex:
|
|
2213
|
+
const st = ut(p - e, r), wt = ut(Math.max(nt - 1, p), r), At = ut(wt + e, r);
|
|
2214
|
+
return { renderingStartIndex: st, renderingEndIndex: At, visibleStartIndex: p, visibleEndIndex: wt };
|
|
2213
2215
|
}, Ue = (i, t, e) => {
|
|
2214
2216
|
const r = Math.max(0, t ?? 0), n = g({ last: 0, id: null, arg: null }).current;
|
|
2215
2217
|
return X(
|
|
@@ -2283,21 +2285,21 @@ const Pr = 1e4, Lr = () => {
|
|
|
2283
2285
|
behaviorOptions: nt,
|
|
2284
2286
|
onWheelHorizontal: st
|
|
2285
2287
|
}, wt) => {
|
|
2286
|
-
const { width:
|
|
2288
|
+
const { width: At, enableThumbDrag: k, enableTrackClick: B, enableArrowButtons: w, enableScrollToTopBottomButtons: C, renderThumbOverlay: U, tapScrollCircleOptions: H } = rt ?? {}, { enablePointerDrag: tt, enableKeyboardNavigation: L = !0, wheelSpeedMultiplier: b, inertiaOptions: K, clipItemHeight: dt = !1, resetOnGetItemHeightChange: et = !1 } = nt ?? {}, Y = g(null), j = g({
|
|
2287
2289
|
renderingStartIndex: 0,
|
|
2288
2290
|
renderingEndIndex: 0,
|
|
2289
2291
|
visibleStartIndex: 0,
|
|
2290
2292
|
visibleEndIndex: 0,
|
|
2291
2293
|
scrollPosition: 0,
|
|
2292
2294
|
totalHeight: 0
|
|
2293
|
-
}),
|
|
2295
|
+
}), ht = g(null), St = g(!1);
|
|
2294
2296
|
X(() => {
|
|
2295
|
-
et && (
|
|
2297
|
+
et && (ht.current = null);
|
|
2296
2298
|
}, [et, r]);
|
|
2297
|
-
const R =
|
|
2299
|
+
const R = Vt(() => Xe(J), [J]), [Ft] = jt(() => {
|
|
2298
2300
|
const c = typeof _ == "number" && Number.isFinite(_) ? Math.max(0, Math.trunc(_)) : 0;
|
|
2299
2301
|
return { from: Math.max(0, c - 50), to: c + 50 };
|
|
2300
|
-
}), Lt =
|
|
2302
|
+
}), Lt = Vt(
|
|
2301
2303
|
// 目的: Fenwick Tree のオプション設定
|
|
2302
2304
|
// 依存関係: resetOnGetItemHeightChange, initialSampleRange (マウント時固定)
|
|
2303
2305
|
// itemCount には依存させない (依存させると追記のたびに options 参照が変わり、計測済み高さが全消去される)。
|
|
@@ -2308,16 +2310,16 @@ const Pr = 1e4, Lr = () => {
|
|
|
2308
2310
|
materialize: !0
|
|
2309
2311
|
}),
|
|
2310
2312
|
[et, Ft]
|
|
2311
|
-
), v = Tr(i, r, Lt), [
|
|
2313
|
+
), v = Tr(i, r, Lt), [kt] = jt(() => {
|
|
2312
2314
|
let o = 0, c = 0;
|
|
2313
2315
|
if (typeof _ == "number") {
|
|
2314
|
-
const d =
|
|
2316
|
+
const d = pt(_, 0, i - 1), y = pt(d - s * 2, 0, i - 1), z = pt(d + s * 2, 0, i - 1), E = _ > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: y, to: z }] } } : void 0, { cumulative: q, total: $, currentValue: lt } = v.prefixSum(_, E), Z = Math.max(q - lt, 0);
|
|
2315
2317
|
o = ge(Z, R.top), c = $ ?? v.getTotal();
|
|
2316
2318
|
} else typeof p == "number" && (o = ge(Math.max(p, 0), R.top)), c = v.getTotal();
|
|
2317
2319
|
return { position: o, total: c };
|
|
2318
|
-
}), [_t, Gt] = jt(
|
|
2320
|
+
}), [_t, Gt] = jt(kt.position), [T, O] = jt(kt.total), A = g(kt.position), Mt = g(R.top), gt = g(f ?? void 0), bt = g(x ?? void 0), Rt = g(/* @__PURE__ */ new Map()), W = g(null), at = g(null), [ft, Zt] = jt(null), [Ot, Ct] = jt(!1), Et = g(null), Xt = g(!1), ct = g(0), xt = g(!1), m = g(!1), V = g(i);
|
|
2319
2321
|
V.current !== i && (V.current = i, m.current = !0), X(() => {
|
|
2320
|
-
|
|
2322
|
+
gt.current = f ?? void 0, bt.current = x ?? void 0;
|
|
2321
2323
|
}, [x, f]);
|
|
2322
2324
|
const It = S(
|
|
2323
2325
|
(o) => {
|
|
@@ -2331,30 +2333,30 @@ const Pr = 1e4, Lr = () => {
|
|
|
2331
2333
|
[L]
|
|
2332
2334
|
), vt = S((o, { position: c, totalHeight: d }) => {
|
|
2333
2335
|
o(c, d);
|
|
2334
|
-
}, []),
|
|
2336
|
+
}, []), mt = Ue(gt, D, vt), se = S((o, c) => {
|
|
2335
2337
|
o(c);
|
|
2336
|
-
}, []),
|
|
2338
|
+
}, []), Nt = Ue(bt, D, se), $t = g(R.top);
|
|
2337
2339
|
$t.current = R.top;
|
|
2338
|
-
const Ht = g(
|
|
2339
|
-
Ht.current =
|
|
2340
|
-
St.current = !0,
|
|
2340
|
+
const Ht = g(mt);
|
|
2341
|
+
Ht.current = mt, X(() => (St.current = !1, () => {
|
|
2342
|
+
St.current = !0, Et.current && (clearTimeout(Et.current), Et.current = null);
|
|
2341
2343
|
}), []), X(() => {
|
|
2342
|
-
L || (
|
|
2344
|
+
L || (Rt.current.clear(), W.current = null, at.current = null);
|
|
2343
2345
|
}, [L]);
|
|
2344
2346
|
const Dt = S(
|
|
2345
2347
|
(o, c) => {
|
|
2346
2348
|
if (!c) {
|
|
2347
|
-
|
|
2349
|
+
Rt.current.delete(o);
|
|
2348
2350
|
return;
|
|
2349
2351
|
}
|
|
2350
|
-
L && (
|
|
2352
|
+
L && (Rt.current.set(o, c), W.current === o && (W.current = null, at.current = o, It(c)));
|
|
2351
2353
|
},
|
|
2352
2354
|
[L, It]
|
|
2353
|
-
),
|
|
2355
|
+
), zt = 0.01, Ut = g({
|
|
2354
2356
|
rafId: null,
|
|
2355
2357
|
loopActive: !1,
|
|
2356
2358
|
idleFrames: 0,
|
|
2357
|
-
lastRenderedPosition:
|
|
2359
|
+
lastRenderedPosition: kt.position
|
|
2358
2360
|
}), ae = S(() => {
|
|
2359
2361
|
const o = Ut.current;
|
|
2360
2362
|
o.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(o.rafId), o.rafId = null, o.loopActive = !1, o.idleFrames = 0;
|
|
@@ -2370,7 +2372,7 @@ const Pr = 1e4, Lr = () => {
|
|
|
2370
2372
|
const o = Ut.current;
|
|
2371
2373
|
o.rafId = null;
|
|
2372
2374
|
const c = A.current, d = ee(c, $t.current), y = v.getTotal();
|
|
2373
|
-
if (Gt((E) => Math.abs(E - c) <
|
|
2375
|
+
if (Gt((E) => Math.abs(E - c) < zt ? E : c), Math.abs(o.lastRenderedPosition - c) >= zt ? (Ht.current({ position: d, totalHeight: y }), o.lastRenderedPosition = c, o.idleFrames = 0) : o.idleFrames += 1, o.idleFrames >= 2) {
|
|
2374
2376
|
ae();
|
|
2375
2377
|
return;
|
|
2376
2378
|
}
|
|
@@ -2394,20 +2396,20 @@ const Pr = 1e4, Lr = () => {
|
|
|
2394
2396
|
(o, c) => {
|
|
2395
2397
|
const d = c?.immediate ?? !1, y = ee(o, R.top);
|
|
2396
2398
|
if (A.current = o, d) {
|
|
2397
|
-
Ut.current.lastRenderedPosition = o, Ut.current.idleFrames = 0, Gt(o),
|
|
2399
|
+
Ut.current.lastRenderedPosition = o, Ut.current.idleFrames = 0, Gt(o), mt({ position: y, totalHeight: v.getTotal() });
|
|
2398
2400
|
return;
|
|
2399
2401
|
}
|
|
2400
2402
|
xe();
|
|
2401
2403
|
},
|
|
2402
|
-
[xe, v, R.top,
|
|
2404
|
+
[xe, v, R.top, mt]
|
|
2403
2405
|
), Yt = S((o) => {
|
|
2404
2406
|
const c = Y.current;
|
|
2405
2407
|
if (!c)
|
|
2406
2408
|
return o;
|
|
2407
2409
|
const d = c.getScrollPosition();
|
|
2408
|
-
|
|
2410
|
+
ct.current += 1;
|
|
2409
2411
|
const y = c.scrollTo(o);
|
|
2410
|
-
return y === d && (
|
|
2412
|
+
return y === d && (ct.current = Math.max(0, ct.current - 1)), Math.abs(y - o) > 0.5 && (xt.current = !0), y;
|
|
2411
2413
|
}, []), Kt = g(!1);
|
|
2412
2414
|
X(() => {
|
|
2413
2415
|
if (!Kt.current)
|
|
@@ -2431,41 +2433,41 @@ const Pr = 1e4, Lr = () => {
|
|
|
2431
2433
|
}
|
|
2432
2434
|
}
|
|
2433
2435
|
}, [v, T, i, Yt, it]), X(() => {
|
|
2434
|
-
if (
|
|
2435
|
-
const { index: o, align: c, offset: d } =
|
|
2436
|
-
if (
|
|
2437
|
-
const q = Math.max(
|
|
2436
|
+
if (ht.current !== null) {
|
|
2437
|
+
const { index: o, align: c, offset: d } = ht.current, y = ut(o, i), { cumulative: z, currentValue: E } = v.prefixSum(y, { materializeOption: { materialize: !1 } });
|
|
2438
|
+
if (z !== void 0 && E !== void 0) {
|
|
2439
|
+
const q = Math.max(z - E, 0);
|
|
2438
2440
|
let $ = q;
|
|
2439
|
-
c === "bottom" ? $ =
|
|
2440
|
-
const
|
|
2441
|
+
c === "bottom" ? $ = z - n : c === "center" && ($ = q + E / 2 - n / 2), d && ($ -= d), $ = Math.max(0, $);
|
|
2442
|
+
const lt = Math.max(0, T + R.top + R.bottom - n), Z = Math.min(ge($, R.top), lt);
|
|
2441
2443
|
Math.abs(Z - A.current) > 1 && (N.debug("[VirtualScroll] Drift correction", {
|
|
2442
2444
|
from: A.current,
|
|
2443
2445
|
to: Z,
|
|
2444
2446
|
targetIndex: y
|
|
2445
|
-
}),
|
|
2447
|
+
}), ct.current === 0 && (ct.current += 1), Y.current?.scrollTo(Z), it(Z, { immediate: !0 }));
|
|
2446
2448
|
}
|
|
2447
2449
|
}
|
|
2448
2450
|
m.current = !1;
|
|
2449
2451
|
}, [T, v, i, R.top, it, n, R.bottom]), X(() => {
|
|
2450
|
-
const o =
|
|
2452
|
+
const o = Mt.current;
|
|
2451
2453
|
if (o === R.top) return;
|
|
2452
2454
|
const c = ee(A.current, o), d = ge(c, R.top);
|
|
2453
|
-
|
|
2455
|
+
Mt.current = R.top, A.current = d, Y.current?.scrollTo(d), it(d, { immediate: !0 });
|
|
2454
2456
|
}, [R.top, it]);
|
|
2455
2457
|
const Ie = S(
|
|
2456
2458
|
(o, c) => {
|
|
2457
2459
|
if (i === 0)
|
|
2458
2460
|
return;
|
|
2459
|
-
const d =
|
|
2461
|
+
const d = ut(o, i), y = v.get(d), z = c - y, E = v.update(d, c);
|
|
2460
2462
|
E !== void 0 && O(E), N.debug("[VirtualScroll] Updated item size manually", { index: d, size: c, total: E });
|
|
2461
|
-
let q =
|
|
2463
|
+
let q = ht.current ? ht.current.index : null;
|
|
2462
2464
|
if (q === null) {
|
|
2463
|
-
const $ = A.current,
|
|
2465
|
+
const $ = A.current, lt = Xe(J).top, Z = ee($, lt), { index: ot, cumulative: Pt } = v.findIndexAtOrAfter(Z, { materializeOption: { materialize: !1 } });
|
|
2464
2466
|
q = Pt !== void 0 && Pt === Z ? ot + 1 : ot;
|
|
2465
2467
|
}
|
|
2466
|
-
if (q !== -1 && d < q &&
|
|
2467
|
-
const $ = A.current,
|
|
2468
|
-
Yt(
|
|
2468
|
+
if (q !== -1 && d < q && z !== 0) {
|
|
2469
|
+
const $ = A.current, lt = $ + z;
|
|
2470
|
+
Yt(lt), it(lt, { immediate: !0 }), N.debug("[VirtualScroll] Adjusted scroll for layout shift (manual update)", { from: $, to: lt, causedByIndex: d, delta: z, activeVisibleStartIndex: q });
|
|
2469
2471
|
}
|
|
2470
2472
|
},
|
|
2471
2473
|
[v, i, Yt, it, J]
|
|
@@ -2473,27 +2475,27 @@ const Pr = 1e4, Lr = () => {
|
|
|
2473
2475
|
(o, c) => {
|
|
2474
2476
|
if (!Y.current || i === 0)
|
|
2475
2477
|
return;
|
|
2476
|
-
const d =
|
|
2477
|
-
if (N.debug("[VirtualScroll] Scrolling to index:", d, "ItemBottom:", E, "Total height:", q, "ItemHeight:", $, "safeIndexFrom:", y, "safeIndexTo:",
|
|
2478
|
+
const d = ut(o, i), y = ut(d - s * 2, i), z = ut(d + s * 2, i), { cumulative: E, total: q, currentValue: $ } = v.prefixSum(d, { materializeOption: { materialize: !0, ranges: [{ from: y, to: z }] } });
|
|
2479
|
+
if (N.debug("[VirtualScroll] Scrolling to index:", d, "ItemBottom:", E, "Total height:", q, "ItemHeight:", $, "safeIndexFrom:", y, "safeIndexTo:", z), !q)
|
|
2478
2480
|
return;
|
|
2479
|
-
const
|
|
2480
|
-
let Z =
|
|
2481
|
-
c?.align === "bottom" ? Z = E - n : c?.align === "center" && (Z =
|
|
2481
|
+
const lt = Math.max(E - $, 0);
|
|
2482
|
+
let Z = lt;
|
|
2483
|
+
c?.align === "bottom" ? Z = E - n : c?.align === "center" && (Z = lt + $ / 2 - n / 2), c?.offset && (Z -= c.offset), Z = Math.max(0, Z);
|
|
2482
2484
|
const ot = ge(Z, R.top), Pt = Y.current?.getContentSize() ?? q + R.top + R.bottom, Tt = Math.max(0, Pt - n), yt = Math.min(ot, Tt);
|
|
2483
|
-
|
|
2485
|
+
ht.current = {
|
|
2484
2486
|
index: d,
|
|
2485
2487
|
align: c?.align,
|
|
2486
2488
|
offset: c?.offset
|
|
2487
2489
|
};
|
|
2488
2490
|
const le = Y.current?.getScrollPosition() ?? -1, ie = Math.abs(le - yt) > 0.5;
|
|
2489
|
-
Xt.current = !1,
|
|
2491
|
+
Xt.current = !1, ct.current = 0, ie && (Xt.current = !0, ct.current += 1, Y.current?.scrollTo(yt)), O(q), it(yt, { immediate: !0 }), N.debug("[VirtualScroll] Setting scroll position to:", yt, { original: ot, max: Tt });
|
|
2490
2492
|
},
|
|
2491
2493
|
[v, s, i, R.top, R.bottom, n, it]
|
|
2492
2494
|
), Pe = S(
|
|
2493
2495
|
(o) => {
|
|
2494
2496
|
if (!Y.current || i === 0)
|
|
2495
2497
|
return;
|
|
2496
|
-
const c = v.getTotal(), d =
|
|
2498
|
+
const c = v.getTotal(), d = pt(Math.floor(o), 0, c), { index: y, cumulative: z, currentValue: E } = v.findIndexAtOrAfter(d, { materializeOption: { materialize: !1 } }), $ = (z ?? 0) - (E ?? 0) - d;
|
|
2497
2499
|
Bt(y, { offset: $ });
|
|
2498
2500
|
},
|
|
2499
2501
|
[v, i, Bt]
|
|
@@ -2501,8 +2503,8 @@ const Pr = 1e4, Lr = () => {
|
|
|
2501
2503
|
(o) => {
|
|
2502
2504
|
const c = ee(A.current, R.top), d = typeof o == "function" ? o(c) : o;
|
|
2503
2505
|
Pe(d);
|
|
2504
|
-
const y = Y.current?.getScrollPosition(),
|
|
2505
|
-
return it(
|
|
2506
|
+
const y = Y.current?.getScrollPosition(), z = typeof y == "number" ? y : A.current;
|
|
2507
|
+
return it(z), z;
|
|
2506
2508
|
},
|
|
2507
2509
|
[R.top, Pe, it]
|
|
2508
2510
|
), ve = S(
|
|
@@ -2510,21 +2512,21 @@ const Pr = 1e4, Lr = () => {
|
|
|
2510
2512
|
N.debug("[VirtualScroll] Scroll position changed:", o);
|
|
2511
2513
|
const d = Xt.current;
|
|
2512
2514
|
d && (Xt.current = !1);
|
|
2513
|
-
const y =
|
|
2514
|
-
if (y && (
|
|
2515
|
+
const y = ct.current > 0;
|
|
2516
|
+
if (y && (ct.current = 0), d || y || m.current || (ht.current = null), it(o), C) {
|
|
2515
2517
|
if (d || y)
|
|
2516
2518
|
return;
|
|
2517
|
-
const
|
|
2518
|
-
if (N.debug("[VirtualScroll] Scroll diff:",
|
|
2519
|
-
const E =
|
|
2520
|
-
Zt(E),
|
|
2521
|
-
|
|
2519
|
+
const z = o - c;
|
|
2520
|
+
if (N.debug("[VirtualScroll] Scroll diff:", z, "New:", o, "Prev:", c), Math.abs(z) > 1) {
|
|
2521
|
+
const E = z > 0 ? "down" : "up";
|
|
2522
|
+
Zt(E), Ct(!0), N.debug("[VirtualScroll] Showing scroll buttons. Direction:", E), Et.current && clearTimeout(Et.current), Et.current = setTimeout(() => {
|
|
2523
|
+
Ct(!1), N.debug("[VirtualScroll] Hiding scroll buttons");
|
|
2522
2524
|
}, 2e3);
|
|
2523
2525
|
}
|
|
2524
2526
|
}
|
|
2525
2527
|
},
|
|
2526
2528
|
[it, C]
|
|
2527
|
-
), Jt =
|
|
2529
|
+
), Jt = Vt(() => ee(_t, R.top), [R.top, _t]), re = Vt(() => {
|
|
2528
2530
|
const o = v.getTotal(), c = Rr(Jt, n, s, i, r, v, o);
|
|
2529
2531
|
return N.debug("[VirtualScroll] Calculated rendering range:", () => ({
|
|
2530
2532
|
...c,
|
|
@@ -2537,25 +2539,25 @@ const Pr = 1e4, Lr = () => {
|
|
|
2537
2539
|
(o, c) => {
|
|
2538
2540
|
if (!L || i === 0)
|
|
2539
2541
|
return;
|
|
2540
|
-
const d =
|
|
2542
|
+
const d = ut(o, i);
|
|
2541
2543
|
if (!(c?.ensureVisible ?? !0)) {
|
|
2542
|
-
const Tt =
|
|
2543
|
-
Tt && (
|
|
2544
|
+
const Tt = Rt.current.get(d);
|
|
2545
|
+
Tt && (W.current = null, at.current = d, It(Tt));
|
|
2544
2546
|
return;
|
|
2545
2547
|
}
|
|
2546
|
-
const
|
|
2547
|
-
if (q <
|
|
2548
|
+
const z = v.prefixSum(d, { materializeOption: { materialize: !1 } }), E = z.currentValue, q = Math.max(z.cumulative - E, 0), $ = q + E, lt = ee(A.current, R.top), Z = lt + n;
|
|
2549
|
+
if (q < lt || $ > Z) {
|
|
2548
2550
|
Bt(d);
|
|
2549
|
-
const Tt =
|
|
2550
|
-
Tt ? (
|
|
2551
|
+
const Tt = Rt.current.get(d);
|
|
2552
|
+
Tt ? (W.current = null, at.current = d, It(Tt)) : W.current = d;
|
|
2551
2553
|
return;
|
|
2552
2554
|
}
|
|
2553
|
-
const Pt =
|
|
2555
|
+
const Pt = Rt.current.get(d);
|
|
2554
2556
|
if (Pt) {
|
|
2555
|
-
|
|
2557
|
+
W.current = null, at.current = d, It(Pt);
|
|
2556
2558
|
return;
|
|
2557
2559
|
}
|
|
2558
|
-
|
|
2560
|
+
W.current = d;
|
|
2559
2561
|
},
|
|
2560
2562
|
[L, i, v, R.top, Bt, It, n]
|
|
2561
2563
|
), we = S(
|
|
@@ -2579,14 +2581,14 @@ const Pr = 1e4, Lr = () => {
|
|
|
2579
2581
|
if (o.key === "PageDown") {
|
|
2580
2582
|
if (c < i - 1) {
|
|
2581
2583
|
o.preventDefault();
|
|
2582
|
-
const { visibleStartIndex: y, visibleEndIndex:
|
|
2584
|
+
const { visibleStartIndex: y, visibleEndIndex: z } = j.current, E = Math.max(z - y + 1, 1), q = Math.max(E, 1), $ = ut(Math.min(c + q, i - 1), i);
|
|
2583
2585
|
te($);
|
|
2584
2586
|
}
|
|
2585
2587
|
return;
|
|
2586
2588
|
}
|
|
2587
2589
|
if (o.key === "PageUp" && c > 0) {
|
|
2588
2590
|
o.preventDefault();
|
|
2589
|
-
const { visibleStartIndex: y, visibleEndIndex:
|
|
2591
|
+
const { visibleStartIndex: y, visibleEndIndex: z } = j.current, E = Math.max(z - y + 1, 1), q = Math.max(E, 1), $ = ut(c - q, i);
|
|
2590
2592
|
te($);
|
|
2591
2593
|
}
|
|
2592
2594
|
},
|
|
@@ -2595,8 +2597,8 @@ const Pr = 1e4, Lr = () => {
|
|
|
2595
2597
|
(o) => {
|
|
2596
2598
|
if (!L)
|
|
2597
2599
|
return;
|
|
2598
|
-
const c =
|
|
2599
|
-
|
|
2600
|
+
const c = ut(o, i);
|
|
2601
|
+
W.current = null, at.current = c, G?.(c);
|
|
2600
2602
|
},
|
|
2601
2603
|
[L, i, G]
|
|
2602
2604
|
);
|
|
@@ -2612,7 +2614,7 @@ const Pr = 1e4, Lr = () => {
|
|
|
2612
2614
|
logicalScrollPosition: d,
|
|
2613
2615
|
contentSize: T,
|
|
2614
2616
|
scrollPaneScrollPosition: o
|
|
2615
|
-
})),
|
|
2617
|
+
})), Nt({
|
|
2616
2618
|
renderingStartIndex: Qt,
|
|
2617
2619
|
renderingEndIndex: qt,
|
|
2618
2620
|
visibleStartIndex: ne,
|
|
@@ -2620,14 +2622,14 @@ const Pr = 1e4, Lr = () => {
|
|
|
2620
2622
|
scrollPosition: d,
|
|
2621
2623
|
totalHeight: T
|
|
2622
2624
|
});
|
|
2623
|
-
}, [T, qt, Qt, R.top,
|
|
2624
|
-
const Ve = S(() => C ? /* @__PURE__ */ Q("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": Ot &&
|
|
2625
|
+
}, [T, qt, Qt, R.top, Nt, _t, fe, ne]);
|
|
2626
|
+
const Ve = S(() => C ? /* @__PURE__ */ Q("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": Ot && ft !== null, children: ft === "up" ? /* @__PURE__ */ Q("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ Q(
|
|
2625
2627
|
"button",
|
|
2626
2628
|
{
|
|
2627
2629
|
type: "button",
|
|
2628
2630
|
className: "aqvs-scroll-to-edge-button",
|
|
2629
2631
|
onClick: (d) => {
|
|
2630
|
-
d.stopPropagation(), Xt.current = !0, Bt(0),
|
|
2632
|
+
d.stopPropagation(), Xt.current = !0, Bt(0), Ct(!1);
|
|
2631
2633
|
},
|
|
2632
2634
|
children: "Top"
|
|
2633
2635
|
}
|
|
@@ -2637,20 +2639,20 @@ const Pr = 1e4, Lr = () => {
|
|
|
2637
2639
|
type: "button",
|
|
2638
2640
|
className: "aqvs-scroll-to-edge-button",
|
|
2639
2641
|
onClick: (d) => {
|
|
2640
|
-
d.stopPropagation(), Xt.current = !0, Bt(i - 1),
|
|
2642
|
+
d.stopPropagation(), Xt.current = !0, Bt(i - 1), Ct(!1);
|
|
2641
2643
|
},
|
|
2642
2644
|
children: "Bottom"
|
|
2643
2645
|
}
|
|
2644
|
-
) }) }) : null, [C, Ot,
|
|
2646
|
+
) }) }) : null, [C, Ot, ft, Bt, i]), me = g(0), { visibleItems: pe, renderAnchor: a } = Vt(() => {
|
|
2645
2647
|
if (i === 0)
|
|
2646
2648
|
return {
|
|
2647
2649
|
visibleItems: /* @__PURE__ */ Q("div", { className: "aqvs-no-items-container", children: /* @__PURE__ */ Q("div", { className: "aqvs-no-items-text", children: "No items" }) }),
|
|
2648
2650
|
renderAnchor: 0
|
|
2649
2651
|
};
|
|
2650
|
-
const o =
|
|
2651
|
-
Number.isFinite(
|
|
2652
|
+
const o = ut(Qt, i), c = ut(qt, i), { cumulative: d, currentValue: y } = v.prefixSum(o, { materializeOption: { materialize: !1 } }), z = d - y;
|
|
2653
|
+
Number.isFinite(z) && Math.abs(z - me.current) > yr && (me.current = z);
|
|
2652
2654
|
const E = me.current, q = [], $ = [];
|
|
2653
|
-
let
|
|
2655
|
+
let lt = 0, Z = z;
|
|
2654
2656
|
for (let ot = o; ot <= c; ot++) {
|
|
2655
2657
|
if ($.length >= $e) {
|
|
2656
2658
|
N.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.", { cap: $e, safeRenderingStartIndex: o, safeRenderingEndIndex: c });
|
|
@@ -2658,7 +2660,7 @@ const Pr = 1e4, Lr = () => {
|
|
|
2658
2660
|
}
|
|
2659
2661
|
const Pt = r(ot), Tt = v.get(ot), yt = Pt - Tt;
|
|
2660
2662
|
yt !== 0 && q.push({ index: ot, value: Pt });
|
|
2661
|
-
const le = Z +
|
|
2663
|
+
const le = Z + lt, ie = e ? e(ot) : ot;
|
|
2662
2664
|
$.push(
|
|
2663
2665
|
/* @__PURE__ */ Q(
|
|
2664
2666
|
Cr,
|
|
@@ -2667,7 +2669,7 @@ const Pr = 1e4, Lr = () => {
|
|
|
2667
2669
|
top: le - E,
|
|
2668
2670
|
height: Pt,
|
|
2669
2671
|
item: t(ot),
|
|
2670
|
-
clipItemHeight:
|
|
2672
|
+
clipItemHeight: dt,
|
|
2671
2673
|
enableKeyboardNavigation: L,
|
|
2672
2674
|
onKeyDown: we,
|
|
2673
2675
|
onFocus: Re,
|
|
@@ -2676,7 +2678,7 @@ const Pr = 1e4, Lr = () => {
|
|
|
2676
2678
|
},
|
|
2677
2679
|
ie
|
|
2678
2680
|
)
|
|
2679
|
-
),
|
|
2681
|
+
), lt += yt, Z += Tt;
|
|
2680
2682
|
}
|
|
2681
2683
|
return q.length > 0 && Promise.resolve().then(() => {
|
|
2682
2684
|
if (St.current)
|
|
@@ -2699,7 +2701,7 @@ const Pr = 1e4, Lr = () => {
|
|
|
2699
2701
|
}), { visibleItems: $, renderAnchor: E };
|
|
2700
2702
|
}, [
|
|
2701
2703
|
I,
|
|
2702
|
-
|
|
2704
|
+
dt,
|
|
2703
2705
|
T,
|
|
2704
2706
|
L,
|
|
2705
2707
|
i,
|
|
@@ -2717,10 +2719,10 @@ const Pr = 1e4, Lr = () => {
|
|
|
2717
2719
|
ne
|
|
2718
2720
|
]), h = S(
|
|
2719
2721
|
(o) => {
|
|
2720
|
-
const c = (D ?? 0) > 0, d = Math.abs(o - _t), y = c && d > 0.5 ? _t : o,
|
|
2722
|
+
const c = (D ?? 0) > 0, d = Math.abs(o - _t), y = c && d > 0.5 ? _t : o, z = ee(y, R.top);
|
|
2721
2723
|
if (N.debug("[VirtualScroll] Rendering visible items", () => ({
|
|
2722
2724
|
currentScrollPosition: o,
|
|
2723
|
-
effectiveScrollPosition:
|
|
2725
|
+
effectiveScrollPosition: z,
|
|
2724
2726
|
renderingStartIndex: Qt,
|
|
2725
2727
|
renderingEndIndex: qt,
|
|
2726
2728
|
itemCount: i,
|
|
@@ -2746,14 +2748,14 @@ const Pr = 1e4, Lr = () => {
|
|
|
2746
2748
|
containerTop: E,
|
|
2747
2749
|
logicalScrollPosition: Jt,
|
|
2748
2750
|
resolvedInsets: R,
|
|
2749
|
-
effectiveScrollPosition:
|
|
2751
|
+
effectiveScrollPosition: z
|
|
2750
2752
|
})), /* @__PURE__ */ ue("div", { className: "aqvs-items-wrapper", style: { top: 0, transform: `translateY(${E}px)`, willChange: "transform" }, children: [
|
|
2751
2753
|
pe,
|
|
2752
2754
|
q
|
|
2753
2755
|
] });
|
|
2754
2756
|
},
|
|
2755
2757
|
[D, i, v, Jt, a, qt, Qt, R, _t, n, pe]
|
|
2756
|
-
), P =
|
|
2758
|
+
), P = Vt(
|
|
2757
2759
|
() => ({
|
|
2758
2760
|
renderingStartIndex: re.renderingStartIndex,
|
|
2759
2761
|
renderingEndIndex: re.renderingEndIndex,
|
|
@@ -2768,8 +2770,8 @@ const Pr = 1e4, Lr = () => {
|
|
|
2768
2770
|
[re, Jt, v, T]
|
|
2769
2771
|
);
|
|
2770
2772
|
X(() => {
|
|
2771
|
-
|
|
2772
|
-
}, [P]),
|
|
2773
|
+
j.current = P;
|
|
2774
|
+
}, [P]), ze(
|
|
2773
2775
|
wt,
|
|
2774
2776
|
() => ({
|
|
2775
2777
|
getScrollPosition: () => Y.current?.getScrollPosition() ?? -1,
|
|
@@ -2780,7 +2782,7 @@ const Pr = 1e4, Lr = () => {
|
|
|
2780
2782
|
getFenwickTreeTotalHeight: () => v.getTotal(),
|
|
2781
2783
|
getFenwickSize: () => v.getSize(),
|
|
2782
2784
|
focusItemAtIndex: te,
|
|
2783
|
-
getRange: () =>
|
|
2785
|
+
getRange: () => j.current,
|
|
2784
2786
|
updateItemSize: Ie
|
|
2785
2787
|
}),
|
|
2786
2788
|
[ye, Bt, v, te, Ie]
|
|
@@ -2799,8 +2801,8 @@ const Pr = 1e4, Lr = () => {
|
|
|
2799
2801
|
tapScrollCircleOptions: H,
|
|
2800
2802
|
inertiaOptions: K,
|
|
2801
2803
|
itemCount: i,
|
|
2802
|
-
scrollBarWidth:
|
|
2803
|
-
enableThumbDrag:
|
|
2804
|
+
scrollBarWidth: At,
|
|
2805
|
+
enableThumbDrag: k,
|
|
2804
2806
|
enableTrackClick: B,
|
|
2805
2807
|
enableArrowButtons: w,
|
|
2806
2808
|
enablePointerDrag: tt,
|
|
@@ -2811,7 +2813,7 @@ const Pr = 1e4, Lr = () => {
|
|
|
2811
2813
|
visibleStartIndex: ne,
|
|
2812
2814
|
visibleEndIndex: fe,
|
|
2813
2815
|
renderOverlay: Ve,
|
|
2814
|
-
initialScrollPosition:
|
|
2816
|
+
initialScrollPosition: kt.position,
|
|
2815
2817
|
children: h
|
|
2816
2818
|
}
|
|
2817
2819
|
);
|
|
@@ -2821,7 +2823,7 @@ export {
|
|
|
2821
2823
|
br as ScrollBar,
|
|
2822
2824
|
xr as ScrollPane,
|
|
2823
2825
|
_r as VirtualScroll,
|
|
2824
|
-
|
|
2826
|
+
pt as minmax,
|
|
2825
2827
|
Dr as tapScrollCircleSampleVisual,
|
|
2826
2828
|
Tr as useFenwickMapTree,
|
|
2827
2829
|
Lr as useHeightCache,
|