@aiquants/virtualscroll 2.1.0 → 2.3.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/CHANGELOG.md +102 -0
- package/README.md +94 -27
- package/dist/ScrollBar.d.ts.map +1 -1
- package/dist/VirtualScroll.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +263 -254
- package/dist/styles/virtualscroll.css +1 -1
- package/dist/styles/virtualscroll.standalone.css +1 -1
- package/package.json +1 -1
- package/src/ScrollBar.tsx +7 -2
- package/src/VirtualScroll.tsx +25 -3
- package/src/styles/standalone.entry.css +5 -5
- package/src/styles/virtualscroll.css +22 -5
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as ot, jsxs as
|
|
2
|
-
import nr, { memo as ir, forwardRef as $e, useState as re, useRef as x, useCallback as S, useImperativeHandle as Ue, useMemo as Ft, useLayoutEffect as
|
|
3
|
-
import { twMerge as
|
|
1
|
+
import { jsx as ot, jsxs as Te, Fragment as tr } from "react/jsx-runtime";
|
|
2
|
+
import nr, { memo as ir, forwardRef as $e, useState as re, useRef as x, useCallback as S, useImperativeHandle as Ue, useMemo as Ft, useLayoutEffect as Me, useEffect as Y, useId as sr } from "react";
|
|
3
|
+
import { twMerge as ye } from "tailwind-merge";
|
|
4
4
|
class N {
|
|
5
5
|
level;
|
|
6
6
|
prefix;
|
|
@@ -155,7 +155,7 @@ const Ke = {
|
|
|
155
155
|
pointerId: null
|
|
156
156
|
}, ze = 6, or = 8, ar = ({ dragState: r, normalizedDistance: t }) => {
|
|
157
157
|
const e = 1 + t * 0.18, n = 0.16 + t * 0.24, i = 0.38 + t * 0.28, s = r.active ? "80ms ease-out" : "220ms ease";
|
|
158
|
-
return /* @__PURE__ */
|
|
158
|
+
return /* @__PURE__ */ Te(tr, { children: [
|
|
159
159
|
/* @__PURE__ */ ot(
|
|
160
160
|
"div",
|
|
161
161
|
{
|
|
@@ -182,7 +182,7 @@ const Ke = {
|
|
|
182
182
|
)
|
|
183
183
|
] });
|
|
184
184
|
}, er = ir(
|
|
185
|
-
$e(({ onDragChange: r, className: t, maxVisualDistance: e = 160, size: n = 40, style: i, opacity: s = 1, renderVisual:
|
|
185
|
+
$e(({ onDragChange: r, className: t, maxVisualDistance: e = 160, size: n = 40, style: i, opacity: s = 1, renderVisual: l }, c) => {
|
|
186
186
|
const [d, b] = re(Ke), I = x(null), v = x(null), C = x({ x: 0, y: 0 }), p = x(null), V = x(0), z = S(
|
|
187
187
|
(T) => {
|
|
188
188
|
b(T), r(T);
|
|
@@ -280,7 +280,7 @@ const Ke = {
|
|
|
280
280
|
}),
|
|
281
281
|
[Q]
|
|
282
282
|
);
|
|
283
|
-
const O = Math.min(Math.max(s, 0), 1), P = n / 64, U = Math.min(d.distance, e) / e, Z = d.direction * U * 10 * P, w =
|
|
283
|
+
const O = Math.min(Math.max(s, 0), 1), P = n / 64, U = Math.min(d.distance, e) / e, Z = d.direction * U * 10 * P, w = l ?? ar, lt = {
|
|
284
284
|
dragState: d,
|
|
285
285
|
normalizedDistance: U,
|
|
286
286
|
sizeScale: P,
|
|
@@ -297,7 +297,7 @@ const Ke = {
|
|
|
297
297
|
{
|
|
298
298
|
ref: p,
|
|
299
299
|
"data-testid": "virtual-scroll-tap-circle",
|
|
300
|
-
className:
|
|
300
|
+
className: ye("aqvs-tap-scroll-circle", t),
|
|
301
301
|
style: j,
|
|
302
302
|
tabIndex: -1,
|
|
303
303
|
onPointerDown: tt,
|
|
@@ -364,8 +364,8 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
364
364
|
maxSpeedCurve: r?.maxSpeedCurve ?? ee.maxSpeedCurve
|
|
365
365
|
};
|
|
366
366
|
}, xr = ({ isDragging: r, isThumbHovered: t, enableThumbDrag: e }) => Ft(() => e ? r ? "dragging" : t ? "hover" : "idle" : "disabled", [e, r, t]), Ir = ({ canUseArrowButtons: r, enableArrowButtons: t, resetTapScroll: e, scrollByStep: n }) => {
|
|
367
|
-
const i = x(null), s = x(null),
|
|
368
|
-
i.current !== null && (window.clearInterval(i.current), i.current = null), s.current !== null && (window.clearTimeout(s.current), s.current = null),
|
|
367
|
+
const i = x(null), s = x(null), l = x(null), c = S(() => {
|
|
368
|
+
i.current !== null && (window.clearInterval(i.current), i.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);
|
|
369
369
|
}, []), d = S(() => {
|
|
370
370
|
c();
|
|
371
371
|
}, [c]), b = S(
|
|
@@ -378,7 +378,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
378
378
|
}, cr);
|
|
379
379
|
}, lr);
|
|
380
380
|
const p = () => c();
|
|
381
|
-
|
|
381
|
+
l.current = p, window.addEventListener("pointerup", p), window.addEventListener("pointercancel", p), window.addEventListener("blur", p);
|
|
382
382
|
},
|
|
383
383
|
[r, c, e, n]
|
|
384
384
|
), I = S(
|
|
@@ -392,11 +392,11 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
392
392
|
}, [r, c]), Y(() => () => {
|
|
393
393
|
c();
|
|
394
394
|
}, [c]), { handleArrowPointerDown: b, handleArrowPointerUp: d, handleArrowKeyDown: I };
|
|
395
|
-
}, Tr = 700, he = (r, t) => typeof r == "number" && Number.isFinite(r) ? r : t, Sr = ({ distance: r, maxDistance: t, viewportSize: e, minSpeedMultiplier: n, maxSpeedMultiplier: i, hasCustomMaxSpeedMultiplier: s, curve:
|
|
396
|
-
const c = Math.max(he(r, 0), 0), d = he(t, 0), b = d > 0 ? Math.min(c, d) / d : 1, I = Math.max(he(e, 0), 0), v = Math.max(he(n, 0), 0), C = Math.max(he(i, 0), 0), p = Math.max(I * v, 40), V = s ? p : 1200, z = Math.max(I * C, V), W =
|
|
395
|
+
}, Tr = 700, he = (r, t) => typeof r == "number" && Number.isFinite(r) ? r : t, Sr = ({ distance: r, maxDistance: t, viewportSize: e, minSpeedMultiplier: n, maxSpeedMultiplier: i, hasCustomMaxSpeedMultiplier: s, curve: l }) => {
|
|
396
|
+
const c = Math.max(he(r, 0), 0), d = he(t, 0), b = d > 0 ? Math.min(c, d) / d : 1, I = Math.max(he(e, 0), 0), v = Math.max(he(n, 0), 0), C = Math.max(he(i, 0), 0), p = Math.max(I * v, 40), V = s ? p : 1200, z = Math.max(I * C, V), W = l ? Math.max(he(l.exponentialScale, C), 0) : 0, at = l ? Math.min(z, Math.max(I * W, p)) : z, Q = Math.max(at, p);
|
|
397
397
|
let tt = b ** 1.1;
|
|
398
|
-
if (
|
|
399
|
-
const Et = Math.min(Math.max(he(
|
|
398
|
+
if (l) {
|
|
399
|
+
const Et = Math.min(Math.max(he(l.exponentialSteepness, 0), 0), Tr);
|
|
400
400
|
if (Et === 0)
|
|
401
401
|
tt = b;
|
|
402
402
|
else {
|
|
@@ -404,7 +404,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
404
404
|
tt = Math.min(Math.max(Math.expm1(Et * b) / A, 0), 1);
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
|
-
const xt = Math.min(Math.max(he(
|
|
407
|
+
const xt = Math.min(Math.max(he(l?.easedOffset, 0), 0), 1);
|
|
408
408
|
return p + (Q - p) * (xt + (1 - xt) * tt);
|
|
409
409
|
}, vr = (r) => {
|
|
410
410
|
if (!r || r <= 0)
|
|
@@ -418,7 +418,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
418
418
|
onScroll: n,
|
|
419
419
|
enableThumbDrag: i = !0,
|
|
420
420
|
enableTrackClick: s = !0,
|
|
421
|
-
enableArrowButtons:
|
|
421
|
+
enableArrowButtons: l = !0,
|
|
422
422
|
horizontal: c = !1,
|
|
423
423
|
scrollBarWidth: d = 12,
|
|
424
424
|
className: b,
|
|
@@ -460,8 +460,8 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
460
460
|
effectiveTrackLength: 0,
|
|
461
461
|
onScroll: n,
|
|
462
462
|
scrollPosition: e
|
|
463
|
-
}), { mainSizeKey: zt, crossSizeKey: Jt, positionKey: $t, selectDelta: h, getPointerCoordinate: k, arrowLabels: gt, arrowIcons: X, directionClass: Pt, orientation: ct } = Dt, It = Math.max(Lt, 1), Mt = t / r, yt = Math.max(t - d * 2, 0), ut = Mt * yt, At = Math.min(Math.max(We, ut || 0), yt || We), dt = r - t, st = Math.max(yt - At, 0), _t = dt <= 0 || st <= 0 ? 0 : rt(e / dt * st, 0, st), Xt = _t + At / 2, Nt = r > t || W, ne = Nt &&
|
|
464
|
-
|
|
463
|
+
}), { mainSizeKey: zt, crossSizeKey: Jt, positionKey: $t, selectDelta: h, getPointerCoordinate: k, arrowLabels: gt, arrowIcons: X, directionClass: Pt, orientation: ct } = Dt, It = Math.max(Lt, 1), Mt = t / r, yt = Math.max(t - d * 2, 0), ut = Mt * yt, At = Math.min(Math.max(We, ut || 0), yt || We), dt = r - t, st = Math.max(yt - At, 0), _t = dt <= 0 || st <= 0 ? 0 : rt(e / dt * st, 0, st), Xt = _t + At / 2, Nt = r > t || W, ne = Nt && l;
|
|
464
|
+
Me(() => {
|
|
465
465
|
Vt.current = {
|
|
466
466
|
viewportSize: t,
|
|
467
467
|
maxScrollPosition: dt,
|
|
@@ -475,9 +475,9 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
475
475
|
onScroll: n,
|
|
476
476
|
scrollPosition: e
|
|
477
477
|
};
|
|
478
|
-
}),
|
|
478
|
+
}), Me(() => {
|
|
479
479
|
U.current = e;
|
|
480
|
-
}, [e]),
|
|
480
|
+
}, [e]), Me(() => {
|
|
481
481
|
Z.current = n;
|
|
482
482
|
}, [n]), Y(() => {
|
|
483
483
|
i || tt(!1);
|
|
@@ -495,13 +495,13 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
495
495
|
(o) => {
|
|
496
496
|
const g = Vt.current, y = U.current;
|
|
497
497
|
if (!g.scrollBarVisible || g.maxScrollPosition <= 0) {
|
|
498
|
-
const ue = Ct(0, y),
|
|
499
|
-
return { nextPosition: ue, actualDelta:
|
|
498
|
+
const ue = Ct(0, y), a = ue - y;
|
|
499
|
+
return { nextPosition: ue, actualDelta: a, reachedBoundary: !0 };
|
|
500
500
|
}
|
|
501
501
|
if (o === 0)
|
|
502
502
|
return { nextPosition: y, actualDelta: 0, reachedBoundary: !1 };
|
|
503
|
-
const B = Ct((ue) => rt(ue + o, 0, g.maxScrollPosition), y), bt = B - y, Ot = o < 0 && y + o <= 0, Yt = o > 0 && y + o >= g.maxScrollPosition,
|
|
504
|
-
return { nextPosition: B, actualDelta: bt, reachedBoundary:
|
|
503
|
+
const B = Ct((ue) => rt(ue + o, 0, g.maxScrollPosition), y), bt = B - y, Ot = o < 0 && y + o <= 0, Yt = o > 0 && y + o >= g.maxScrollPosition, ve = o < 0 && (B <= 0 || Ot && bt === 0) || o > 0 && (B >= g.maxScrollPosition || Yt && bt === 0);
|
|
504
|
+
return { nextPosition: B, actualDelta: bt, reachedBoundary: ve };
|
|
505
505
|
},
|
|
506
506
|
[Ct]
|
|
507
507
|
), M = S(
|
|
@@ -606,8 +606,8 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
606
606
|
return rt(B / y * L, 0, L);
|
|
607
607
|
}, []), se = S(
|
|
608
608
|
(o) => {
|
|
609
|
-
const g = o.getBoundingClientRect(), y = c ? g.width : g.height, L = (
|
|
610
|
-
const ue = Number.parseFloat(
|
|
609
|
+
const g = o.getBoundingClientRect(), y = c ? g.width : g.height, L = (ve) => {
|
|
610
|
+
const ue = Number.parseFloat(ve);
|
|
611
611
|
return Number.isFinite(ue) ? ue : 0;
|
|
612
612
|
}, B = window.getComputedStyle(o), bt = L(c ? B.width : B.height), Ot = bt > 0 ? bt + L(c ? B.paddingLeft : B.paddingTop) + L(c ? B.paddingRight : B.paddingBottom) + L(c ? B.borderLeftWidth : B.borderTopWidth) + L(c ? B.borderRightWidth : B.borderBottomWidth) : 0, Yt = Ot > 0 ? Ot : c ? o.offsetWidth : o.offsetHeight;
|
|
613
613
|
return Yt <= 0 || y <= 0 ? 1 : y / Yt;
|
|
@@ -654,9 +654,9 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
654
654
|
mt.current !== o && (mt.current = o, we.current = 0), M(we, o * g);
|
|
655
655
|
},
|
|
656
656
|
[M]
|
|
657
|
-
), { handleArrowPointerDown: Ce, handleArrowPointerUp:
|
|
657
|
+
), { handleArrowPointerDown: Ce, handleArrowPointerUp: Se, handleArrowKeyDown: Ut } = Ir({
|
|
658
658
|
canUseArrowButtons: ne,
|
|
659
|
-
enableArrowButtons:
|
|
659
|
+
enableArrowButtons: l,
|
|
660
660
|
resetTapScroll: Tt,
|
|
661
661
|
scrollByStep: me
|
|
662
662
|
}), Ve = (o) => {
|
|
@@ -751,11 +751,11 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
751
751
|
},
|
|
752
752
|
"aria-label": g,
|
|
753
753
|
onPointerDown: Ce(o),
|
|
754
|
-
onPointerUp:
|
|
755
|
-
onPointerLeave:
|
|
756
|
-
onPointerCancel:
|
|
754
|
+
onPointerUp: Se,
|
|
755
|
+
onPointerLeave: Se,
|
|
756
|
+
onPointerCancel: Se,
|
|
757
757
|
onKeyDown: Ut(o),
|
|
758
|
-
"aria-disabled": !
|
|
758
|
+
"aria-disabled": !l,
|
|
759
759
|
disabled: !ne,
|
|
760
760
|
children: /* @__PURE__ */ ot("span", { "aria-hidden": "true", children: y })
|
|
761
761
|
},
|
|
@@ -775,14 +775,15 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
775
775
|
visibleStartIndex: V,
|
|
776
776
|
visibleEndIndex: z
|
|
777
777
|
} : null;
|
|
778
|
-
return /* @__PURE__ */
|
|
778
|
+
return /* @__PURE__ */ Te(
|
|
779
779
|
"div",
|
|
780
780
|
{
|
|
781
|
-
className:
|
|
781
|
+
className: ye("aqvs-scrollbar", Pt, b),
|
|
782
782
|
style: {
|
|
783
783
|
[zt]: t,
|
|
784
784
|
[Jt]: d
|
|
785
785
|
},
|
|
786
|
+
"data-visible": Nt ? "true" : "false",
|
|
786
787
|
role: "scrollbar",
|
|
787
788
|
tabIndex: -1,
|
|
788
789
|
"aria-controls": I,
|
|
@@ -795,7 +796,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
795
796
|
er,
|
|
796
797
|
{
|
|
797
798
|
ref: lt,
|
|
798
|
-
className:
|
|
799
|
+
className: ye("aqvs-scrollbar-tap-circle-wrapper", vt),
|
|
799
800
|
size: nt,
|
|
800
801
|
maxVisualDistance: It,
|
|
801
802
|
style: le,
|
|
@@ -806,7 +807,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
806
807
|
"tap-circle"
|
|
807
808
|
),
|
|
808
809
|
ce(-1, gt[0], X[0], "arrow-start"),
|
|
809
|
-
/* @__PURE__ */
|
|
810
|
+
/* @__PURE__ */ Te(
|
|
810
811
|
"div",
|
|
811
812
|
{
|
|
812
813
|
className: "aqvs-scrollbar-track",
|
|
@@ -824,12 +825,13 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
824
825
|
/* @__PURE__ */ ot(
|
|
825
826
|
"div",
|
|
826
827
|
{
|
|
827
|
-
className:
|
|
828
|
+
className: "aqvs-scrollbar-thumb-wrapper",
|
|
828
829
|
style: {
|
|
829
830
|
[zt]: At,
|
|
830
831
|
[$t]: _t,
|
|
831
832
|
...c ? { top: 0, bottom: 0 } : { left: 0, right: 0 }
|
|
832
833
|
},
|
|
834
|
+
"data-visible": Nt || W ? "true" : "false",
|
|
833
835
|
onPointerDown: Ve,
|
|
834
836
|
role: "slider",
|
|
835
837
|
"aria-orientation": c ? "horizontal" : "vertical",
|
|
@@ -842,7 +844,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
842
844
|
"div",
|
|
843
845
|
{
|
|
844
846
|
ref: A,
|
|
845
|
-
className:
|
|
847
|
+
className: ye("aqvs-scrollbar-thumb", c ? "aqvs-scrollbar-thumb-horizontal" : "aqvs-scrollbar-thumb-vertical"),
|
|
846
848
|
"data-testid": "aqvs-scrollbar-thumb",
|
|
847
849
|
"data-thumb-state": Gt,
|
|
848
850
|
style: {
|
|
@@ -886,7 +888,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
886
888
|
scrollBarWidth: n = 12,
|
|
887
889
|
enableThumbDrag: i = !0,
|
|
888
890
|
enableTrackClick: s = !0,
|
|
889
|
-
enableArrowButtons:
|
|
891
|
+
enableArrowButtons: l = !0,
|
|
890
892
|
enablePointerDrag: c = !0,
|
|
891
893
|
pointerDragInputs: d = Mr,
|
|
892
894
|
onScroll: b,
|
|
@@ -1010,16 +1012,16 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
1010
1012
|
), jt = x(Lt);
|
|
1011
1013
|
Y(() => {
|
|
1012
1014
|
jt.current = Lt;
|
|
1013
|
-
}, [Lt]),
|
|
1015
|
+
}, [Lt]), Me(() => {
|
|
1014
1016
|
Dt.current = { contentSize: t, viewportSize: e };
|
|
1015
|
-
}, [t, e]),
|
|
1017
|
+
}, [t, e]), Me(() => {
|
|
1016
1018
|
const h = j.current;
|
|
1017
1019
|
if (!h) return;
|
|
1018
1020
|
const k = () => {
|
|
1019
1021
|
h.scrollTop !== 0 && (N.debug("[ScrollPane] Native scroll detected, resetting to 0", () => ({ scrollTop: h.scrollTop })), h.scrollTop = 0), h.scrollLeft !== 0 && (h.scrollLeft = 0);
|
|
1020
1022
|
};
|
|
1021
1023
|
return h.addEventListener("scroll", k), () => h.removeEventListener("scroll", k);
|
|
1022
|
-
}, []),
|
|
1024
|
+
}, []), Me(() => {
|
|
1023
1025
|
if (et) {
|
|
1024
1026
|
N.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", () => ({ contentSize: t, viewportSize: e, scrollPosition: w.current }));
|
|
1025
1027
|
const h = rt(t - e, 0, t);
|
|
@@ -1199,12 +1201,12 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
1199
1201
|
(h) => (J(), nt(h)),
|
|
1200
1202
|
[nt, J]
|
|
1201
1203
|
);
|
|
1202
|
-
return /* @__PURE__ */
|
|
1203
|
-
/* @__PURE__ */
|
|
1204
|
+
return /* @__PURE__ */ Te("div", { ref: lt, "data-testid": v, className: ye("aqvs-scroll-pane", I), style: C, children: [
|
|
1205
|
+
/* @__PURE__ */ Te(
|
|
1204
1206
|
"div",
|
|
1205
1207
|
{
|
|
1206
1208
|
ref: j,
|
|
1207
|
-
className:
|
|
1209
|
+
className: ye("aqvs-scroll-pane-content"),
|
|
1208
1210
|
"data-testid": "aqvs-scroll-pane-content",
|
|
1209
1211
|
style: {
|
|
1210
1212
|
height: e,
|
|
@@ -1242,7 +1244,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
1242
1244
|
onScroll: $t,
|
|
1243
1245
|
enableThumbDrag: i,
|
|
1244
1246
|
enableTrackClick: s,
|
|
1245
|
-
enableArrowButtons:
|
|
1247
|
+
enableArrowButtons: l,
|
|
1246
1248
|
scrollBarWidth: n,
|
|
1247
1249
|
ariaControls: de,
|
|
1248
1250
|
tapScrollCircleOptions: V,
|
|
@@ -1257,14 +1259,14 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
1257
1259
|
] });
|
|
1258
1260
|
}
|
|
1259
1261
|
), Ge = (r, t, e) => Math.min(Math.max(r, t), e), Br = ({ dragState: r, normalizedDistance: t, sizeScale: e, size: n }) => {
|
|
1260
|
-
const i = Math.max(n / 2, 1), s = 1 + t * 0.65,
|
|
1261
|
-
return /* @__PURE__ */
|
|
1262
|
+
const i = Math.max(n / 2, 1), s = 1 + t * 0.65, l = Math.max(0.65, 1 - t * 0.25), c = r.direction * t * 26 * e, d = 0.8 + t * 0.18, b = 3 * e, I = 6 * e, v = 22 * e, C = Math.abs(c) + I, p = c > 0 ? b : -Math.abs(c) - b, V = Math.max(2.5, 3 * e), z = Ge(r.offsetX, -i, i), W = Ge(r.offsetY, -i, i), at = i * 0.35, Q = z / i * at, tt = W / i * at, xt = Q * 0.45, Et = tt * 0.45, A = Math.max(v * 0.38, 6), O = 0.65 + t * 0.2, P = r.active;
|
|
1263
|
+
return /* @__PURE__ */ Te(tr, { children: [
|
|
1262
1264
|
/* @__PURE__ */ ot(
|
|
1263
1265
|
"div",
|
|
1264
1266
|
{
|
|
1265
1267
|
className: "aqvs-tap-scroll-circle-gradient",
|
|
1266
1268
|
style: {
|
|
1267
|
-
transform: `scale(${
|
|
1269
|
+
transform: `scale(${l}, ${s})`,
|
|
1268
1270
|
transition: P ? "40ms transform ease-out" : "200ms ease transform"
|
|
1269
1271
|
}
|
|
1270
1272
|
}
|
|
@@ -1276,7 +1278,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
1276
1278
|
style: {
|
|
1277
1279
|
width: v,
|
|
1278
1280
|
height: v,
|
|
1279
|
-
transform: `translate(calc(-50% + ${Q}px), calc(-50% + ${tt}px)) scale(${
|
|
1281
|
+
transform: `translate(calc(-50% + ${Q}px), calc(-50% + ${tt}px)) scale(${l}, ${d * s})`,
|
|
1280
1282
|
transition: P ? "70ms transform ease-out" : "200ms ease transform"
|
|
1281
1283
|
}
|
|
1282
1284
|
}
|
|
@@ -1288,7 +1290,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
1288
1290
|
style: {
|
|
1289
1291
|
width: A,
|
|
1290
1292
|
height: A,
|
|
1291
|
-
transform: `translate(calc(-50% + ${xt}px), calc(-50% + ${Et}px)) scale(${
|
|
1293
|
+
transform: `translate(calc(-50% + ${xt}px), calc(-50% + ${Et}px)) scale(${l}, ${s})`,
|
|
1292
1294
|
opacity: O,
|
|
1293
1295
|
boxShadow: "0 0 8px rgba(255,255,255,0.45)",
|
|
1294
1296
|
transition: P ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
|
|
@@ -1318,7 +1320,7 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
|
|
|
1318
1320
|
if (!Number.isFinite(r))
|
|
1319
1321
|
throw new Error(`valueFn returned a non-finite value at index ${t}: ${r}`);
|
|
1320
1322
|
return r;
|
|
1321
|
-
},
|
|
1323
|
+
}, Pe = (r) => {
|
|
1322
1324
|
if (r <= 0 || !Number.isFinite(r))
|
|
1323
1325
|
return 0;
|
|
1324
1326
|
const t = Math.trunc(r);
|
|
@@ -1391,7 +1393,7 @@ class ge {
|
|
|
1391
1393
|
this.size = i, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.valueFn = void 0, this.baseValue = e, this.total = this.baseValue * this.size;
|
|
1392
1394
|
return;
|
|
1393
1395
|
}
|
|
1394
|
-
let s = 0,
|
|
1396
|
+
let s = 0, l;
|
|
1395
1397
|
if (i > 0) {
|
|
1396
1398
|
const c = n?.sampleRange ?? {
|
|
1397
1399
|
from: 0,
|
|
@@ -1399,18 +1401,18 @@ class ge {
|
|
|
1399
1401
|
};
|
|
1400
1402
|
let d = Math.max(0, Math.trunc(c.from)), b = Math.min(Math.trunc(c.to), i - 1);
|
|
1401
1403
|
if (d > b && (d = 0, b = Math.min(_e - 1, i - 1)), i > _e)
|
|
1402
|
-
s = ge._sampleBaseValueStrided(e, i, _e), n?.materialize && (
|
|
1404
|
+
s = ge._sampleBaseValueStrided(e, i, _e), n?.materialize && (l = { from: d, values: ge._collectValidatedValues(e, d, b) });
|
|
1403
1405
|
else {
|
|
1404
1406
|
const I = ge._collectValidatedValues(e, d, b);
|
|
1405
|
-
s = ge._modeOrMedian([...I]), n?.materialize && (
|
|
1407
|
+
s = ge._modeOrMedian([...I]), n?.materialize && (l = { from: d, values: I });
|
|
1406
1408
|
}
|
|
1407
1409
|
}
|
|
1408
|
-
if (this.size = i, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.total = void 0, this.valueFn = e, this.baseValue = s,
|
|
1409
|
-
for (let c = 0; c <
|
|
1410
|
-
const d =
|
|
1410
|
+
if (this.size = i, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.total = void 0, this.valueFn = e, this.baseValue = s, l)
|
|
1411
|
+
for (let c = 0; c < l.values.length; c++) {
|
|
1412
|
+
const d = l.from + c;
|
|
1411
1413
|
if (d >= this.size)
|
|
1412
1414
|
break;
|
|
1413
|
-
const b =
|
|
1415
|
+
const b = l.values[c] - this.baseValue;
|
|
1414
1416
|
b !== 0 && (this.deltas.set(d, b), this._updateTree(d, b));
|
|
1415
1417
|
}
|
|
1416
1418
|
this.total = this.getTotal();
|
|
@@ -1456,22 +1458,22 @@ class ge {
|
|
|
1456
1458
|
static _modeOrMedian(t) {
|
|
1457
1459
|
if (t.length === 0)
|
|
1458
1460
|
return 0;
|
|
1459
|
-
t.sort((
|
|
1461
|
+
t.sort((l, c) => l - c);
|
|
1460
1462
|
const e = Math.floor(t.length / 2);
|
|
1461
1463
|
let n;
|
|
1462
1464
|
t.length % 2 === 0 ? n = Math.floor((t[e - 1] + t[e]) / 2) : n = t[e];
|
|
1463
1465
|
const i = /* @__PURE__ */ new Map();
|
|
1464
1466
|
let s = 0;
|
|
1465
|
-
for (const
|
|
1466
|
-
const c = (i.get(
|
|
1467
|
-
i.set(
|
|
1467
|
+
for (const l of t) {
|
|
1468
|
+
const c = (i.get(l) ?? 0) + 1;
|
|
1469
|
+
i.set(l, c), c > s && (s = c);
|
|
1468
1470
|
}
|
|
1469
1471
|
if (s > t.length * 0.2) {
|
|
1470
|
-
const
|
|
1472
|
+
const l = [];
|
|
1471
1473
|
for (const [d, b] of i.entries())
|
|
1472
|
-
b === s &&
|
|
1473
|
-
const c =
|
|
1474
|
-
n = Math.floor(c /
|
|
1474
|
+
b === s && l.push(d);
|
|
1475
|
+
const c = l.reduce((d, b) => d + b, 0);
|
|
1476
|
+
n = Math.floor(c / l.length);
|
|
1475
1477
|
}
|
|
1476
1478
|
return n;
|
|
1477
1479
|
}
|
|
@@ -1491,8 +1493,8 @@ class ge {
|
|
|
1491
1493
|
let i = Math.max(1, Math.ceil(e / n));
|
|
1492
1494
|
i % 2 === 0 && (i += 1);
|
|
1493
1495
|
const s = [];
|
|
1494
|
-
for (let
|
|
1495
|
-
s.push(qe(t(
|
|
1496
|
+
for (let l = 0; l < e && s.length < n; l += i)
|
|
1497
|
+
s.push(qe(t(l), l));
|
|
1496
1498
|
return ge._modeOrMedian(s);
|
|
1497
1499
|
}
|
|
1498
1500
|
/**
|
|
@@ -1540,14 +1542,14 @@ class ge {
|
|
|
1540
1542
|
throw new Error(`Index must be an integer: ${n}`);
|
|
1541
1543
|
if (!Number.isFinite(i))
|
|
1542
1544
|
throw new Error(`Change must be a finite number: ${i}`);
|
|
1543
|
-
const
|
|
1544
|
-
if (
|
|
1545
|
-
throw new Error(`Change would make the value at index ${n} negative: ${
|
|
1546
|
-
e.set(n,
|
|
1545
|
+
const l = (e.get(n) ?? this.deltas.get(n) ?? 0) + i;
|
|
1546
|
+
if (l + this.baseValue < -1e-9)
|
|
1547
|
+
throw new Error(`Change would make the value at index ${n} negative: ${l + this.baseValue}`);
|
|
1548
|
+
e.set(n, l);
|
|
1547
1549
|
}
|
|
1548
1550
|
for (const { index: n, change: i } of t) {
|
|
1549
|
-
const
|
|
1550
|
-
|
|
1551
|
+
const l = (this.deltas.get(n) ?? 0) + i;
|
|
1552
|
+
l === 0 ? this.deltas.delete(n) : this.deltas.set(n, l), this._updateTree(n, i);
|
|
1551
1553
|
}
|
|
1552
1554
|
return this.total;
|
|
1553
1555
|
}
|
|
@@ -1565,7 +1567,7 @@ class ge {
|
|
|
1565
1567
|
let n = t + 1;
|
|
1566
1568
|
for (; n <= this.size; ) {
|
|
1567
1569
|
this.tree.set(n, (this.tree.get(n) ?? 0) + e);
|
|
1568
|
-
const i =
|
|
1570
|
+
const i = Pe(n);
|
|
1569
1571
|
if (i === 0)
|
|
1570
1572
|
break;
|
|
1571
1573
|
n += i;
|
|
@@ -1591,8 +1593,8 @@ class ge {
|
|
|
1591
1593
|
throw new Error(`Value must be a finite number: ${s}`);
|
|
1592
1594
|
if (s < 0)
|
|
1593
1595
|
throw new Error("Value cannot be negative.");
|
|
1594
|
-
const
|
|
1595
|
-
d !== 0 && e.push({ index: i, change: d }), n.set(i,
|
|
1596
|
+
const l = n.has(i) ? n.get(i) ?? 0 : this.deltas.get(i) ?? 0, c = l + this.baseValue, d = s - c;
|
|
1597
|
+
d !== 0 && e.push({ index: i, change: d }), n.set(i, l + d);
|
|
1596
1598
|
}
|
|
1597
1599
|
return e;
|
|
1598
1600
|
}
|
|
@@ -1609,7 +1611,7 @@ class ge {
|
|
|
1609
1611
|
let t = 0, e = this.size;
|
|
1610
1612
|
for (; e > 0; ) {
|
|
1611
1613
|
t += this.tree.get(e) ?? 0;
|
|
1612
|
-
const n =
|
|
1614
|
+
const n = Pe(e);
|
|
1613
1615
|
if (n === 0)
|
|
1614
1616
|
break;
|
|
1615
1617
|
e -= n;
|
|
@@ -1628,8 +1630,8 @@ class ge {
|
|
|
1628
1630
|
if (this.valueFn) {
|
|
1629
1631
|
const n = this.deltas.get(t) ?? 0, s = qe(this.valueFn(t), t) - this.baseValue;
|
|
1630
1632
|
if (s !== n && (s === 0 ? this.deltas.delete(t) : this.deltas.set(t, s), e)) {
|
|
1631
|
-
const
|
|
1632
|
-
this._updateTree(t,
|
|
1633
|
+
const l = s - n;
|
|
1634
|
+
this._updateTree(t, l);
|
|
1633
1635
|
}
|
|
1634
1636
|
}
|
|
1635
1637
|
}
|
|
@@ -1658,8 +1660,8 @@ class ge {
|
|
|
1658
1660
|
this._materialize(e);
|
|
1659
1661
|
return;
|
|
1660
1662
|
}
|
|
1661
|
-
const s = i[0].from,
|
|
1662
|
-
e >= s && e <=
|
|
1663
|
+
const s = i[0].from, l = i[i.length - 1].to;
|
|
1664
|
+
e >= s && e <= l && this._materialize(e);
|
|
1663
1665
|
return;
|
|
1664
1666
|
}
|
|
1665
1667
|
e !== void 0 && this._materialize(e);
|
|
@@ -1691,13 +1693,13 @@ class ge {
|
|
|
1691
1693
|
if (this._materialize(s), (this.deltas.get(s) ?? 0) === c)
|
|
1692
1694
|
break;
|
|
1693
1695
|
}
|
|
1694
|
-
const
|
|
1696
|
+
const l = this.prefixSum(s);
|
|
1695
1697
|
return {
|
|
1696
1698
|
index: s,
|
|
1697
|
-
total: this.total ??
|
|
1698
|
-
cumulative:
|
|
1699
|
-
currentValue:
|
|
1700
|
-
safeIndex:
|
|
1699
|
+
total: this.total ?? l.total,
|
|
1700
|
+
cumulative: l.cumulative,
|
|
1701
|
+
currentValue: l.currentValue,
|
|
1702
|
+
safeIndex: l.safeIndex
|
|
1701
1703
|
};
|
|
1702
1704
|
}
|
|
1703
1705
|
/**
|
|
@@ -1714,10 +1716,10 @@ class ge {
|
|
|
1714
1716
|
for (; s << 1 <= this.size; )
|
|
1715
1717
|
s <<= 1;
|
|
1716
1718
|
for (; s > 0; s >>= 1) {
|
|
1717
|
-
const
|
|
1718
|
-
if (
|
|
1719
|
-
const d = (this.tree.get(
|
|
1720
|
-
(e ? i + d < t : i + d <= t) && (n =
|
|
1719
|
+
const l = n + s;
|
|
1720
|
+
if (l <= this.size) {
|
|
1721
|
+
const d = (this.tree.get(l) ?? 0) + this.baseValue * s;
|
|
1722
|
+
(e ? i + d < t : i + d <= t) && (n = l, i += d);
|
|
1721
1723
|
}
|
|
1722
1724
|
}
|
|
1723
1725
|
return e ? n : n - 1;
|
|
@@ -1736,18 +1738,18 @@ class ge {
|
|
|
1736
1738
|
this._materializeRanges(e.materializeOption);
|
|
1737
1739
|
const s = e.materializeOption?.materialize === !0;
|
|
1738
1740
|
for (; ; ) {
|
|
1739
|
-
let
|
|
1740
|
-
for (;
|
|
1741
|
-
const p =
|
|
1741
|
+
let l = 0n, c = i - 1n, d, b, I = this.total;
|
|
1742
|
+
for (; l <= c; ) {
|
|
1743
|
+
const p = l + c >> 1n, V = Number(p), z = this.prefixSum(V);
|
|
1742
1744
|
if (I = z.total, n ? z.cumulative >= t : z.cumulative <= t)
|
|
1743
1745
|
if (d = p, b = z, n) {
|
|
1744
1746
|
if (p === 0n)
|
|
1745
1747
|
break;
|
|
1746
1748
|
c = p - 1n;
|
|
1747
1749
|
} else
|
|
1748
|
-
|
|
1750
|
+
l = p + 1n;
|
|
1749
1751
|
else if (n)
|
|
1750
|
-
|
|
1752
|
+
l = p + 1n;
|
|
1751
1753
|
else {
|
|
1752
1754
|
if (p === 0n)
|
|
1753
1755
|
break;
|
|
@@ -1784,14 +1786,14 @@ class ge {
|
|
|
1784
1786
|
return { cumulative: 0, total: this.total ?? 0, currentValue: 0, safeIndex: 0 };
|
|
1785
1787
|
const n = rt(Math.trunc(t), 0, this.size - 1), i = e?.materializeOption;
|
|
1786
1788
|
this._materializeRanges(i, n, !0);
|
|
1787
|
-
let s = 0,
|
|
1788
|
-
for (;
|
|
1789
|
-
const d = this.tree.get(
|
|
1789
|
+
let s = 0, l = n + 1;
|
|
1790
|
+
for (; l > 0; ) {
|
|
1791
|
+
const d = this.tree.get(l) ?? 0;
|
|
1790
1792
|
s += d;
|
|
1791
|
-
const b =
|
|
1793
|
+
const b = Pe(l);
|
|
1792
1794
|
if (b === 0)
|
|
1793
1795
|
break;
|
|
1794
|
-
|
|
1796
|
+
l -= b;
|
|
1795
1797
|
}
|
|
1796
1798
|
const c = i?.materialize ? this.get(n) : (this.deltas.get(n) || 0) + this.baseValue;
|
|
1797
1799
|
return { cumulative: s + this.baseValue * (n + 1), total: this.total, currentValue: c, safeIndex: n };
|
|
@@ -1851,10 +1853,10 @@ class ge {
|
|
|
1851
1853
|
let s = n + 1;
|
|
1852
1854
|
for (; s <= this.size; ) {
|
|
1853
1855
|
e.set(s, (e.get(s) ?? 0) + i);
|
|
1854
|
-
const
|
|
1855
|
-
if (
|
|
1856
|
+
const l = Pe(s);
|
|
1857
|
+
if (l === 0)
|
|
1856
1858
|
break;
|
|
1857
|
-
s +=
|
|
1859
|
+
s += l;
|
|
1858
1860
|
}
|
|
1859
1861
|
}
|
|
1860
1862
|
this.tree = e, this.total = this._computeTreeTotal();
|
|
@@ -1968,17 +1970,17 @@ class ge {
|
|
|
1968
1970
|
_propagateDeltaToGrownNodes(t, e, n, i) {
|
|
1969
1971
|
let s = t + 1;
|
|
1970
1972
|
for (; s <= n; ) {
|
|
1971
|
-
const
|
|
1972
|
-
if (
|
|
1973
|
+
const l = Pe(s);
|
|
1974
|
+
if (l === 0)
|
|
1973
1975
|
break;
|
|
1974
|
-
s +=
|
|
1976
|
+
s += l;
|
|
1975
1977
|
}
|
|
1976
1978
|
for (; s <= i; ) {
|
|
1977
1979
|
this.tree.set(s, (this.tree.get(s) ?? 0) + e);
|
|
1978
|
-
const
|
|
1979
|
-
if (
|
|
1980
|
+
const l = Pe(s);
|
|
1981
|
+
if (l === 0)
|
|
1980
1982
|
break;
|
|
1981
|
-
s +=
|
|
1983
|
+
s += l;
|
|
1982
1984
|
}
|
|
1983
1985
|
}
|
|
1984
1986
|
/**
|
|
@@ -1994,12 +1996,12 @@ class ge {
|
|
|
1994
1996
|
const n = ge._minCoveredLowBound(t, e);
|
|
1995
1997
|
if (t - n < this.deltas.size)
|
|
1996
1998
|
for (let s = n; s < t; s++) {
|
|
1997
|
-
const
|
|
1998
|
-
|
|
1999
|
+
const l = this.deltas.get(s);
|
|
2000
|
+
l === void 0 || l === 0 || this._propagateDeltaToGrownNodes(s, l, t, e);
|
|
1999
2001
|
}
|
|
2000
2002
|
else
|
|
2001
|
-
for (const [s,
|
|
2002
|
-
|
|
2003
|
+
for (const [s, l] of this.deltas.entries())
|
|
2004
|
+
l === 0 || s < n || this._propagateDeltaToGrownNodes(s, l, t, e);
|
|
2003
2005
|
}
|
|
2004
2006
|
this.total = this._computeTreeTotal();
|
|
2005
2007
|
}
|
|
@@ -2075,12 +2077,12 @@ const Er = (r, t) => {
|
|
|
2075
2077
|
}, Nr = (r, t, e) => {
|
|
2076
2078
|
const n = Number.isFinite(r) && r > 0 ? Math.trunc(r) : 0, i = x(null), s = x({ size: n, valueOrFn: t, options: e });
|
|
2077
2079
|
i.current === null && (i.current = new ge(n, t, e));
|
|
2078
|
-
const
|
|
2080
|
+
const l = i.current, c = s.current, d = c.size !== n, b = c.valueOrFn !== t, I = Er(c.options, e), v = c.size === 0 && n > 0 && (!i.current || i.current.base === 0);
|
|
2079
2081
|
if (b || I) {
|
|
2080
2082
|
const C = e?.resetOnValueFnChange ?? !0;
|
|
2081
|
-
I || b && C || v ? (e?.debug && N.debug("[useFenwickMapTree] reset", { valueOrFnChanged: b, optionsChanged: I }),
|
|
2082
|
-
} else d && (e?.debug && N.debug("[useFenwickMapTree] resize", { from: c.size, to: n }), v ?
|
|
2083
|
-
return
|
|
2083
|
+
I || b && C || v ? (e?.debug && N.debug("[useFenwickMapTree] reset", { valueOrFnChanged: b, optionsChanged: I }), l.reset(n, t, e)) : (d && (e?.debug && N.debug("[useFenwickMapTree] resize (with valueFn change)", { from: c.size, to: n }), l.changeSize(n)), e?.debug && N.debug("[useFenwickMapTree] setValueFn (no reset)", { valueOrFnChanged: b }), l.setValueFn(t, { reset: !1 })), s.current = { size: n, valueOrFn: t, options: e };
|
|
2084
|
+
} else d && (e?.debug && N.debug("[useFenwickMapTree] resize", { from: c.size, to: n }), v ? l.reset(n, t, e) : l.changeSize(n), s.current = { size: n, valueOrFn: t, options: e });
|
|
2085
|
+
return l;
|
|
2084
2086
|
};
|
|
2085
2087
|
class Cr {
|
|
2086
2088
|
key;
|
|
@@ -2152,7 +2154,7 @@ function Vr(r) {
|
|
|
2152
2154
|
const v = t.current.get(I);
|
|
2153
2155
|
if (v)
|
|
2154
2156
|
return e.current.moveToTail(v), v.value;
|
|
2155
|
-
}, []),
|
|
2157
|
+
}, []), l = S((I, v) => {
|
|
2156
2158
|
const C = i.current;
|
|
2157
2159
|
if (Number.isNaN(C) || C <= 0)
|
|
2158
2160
|
return;
|
|
@@ -2172,7 +2174,7 @@ function Vr(r) {
|
|
|
2172
2174
|
}, []), b = S(() => {
|
|
2173
2175
|
t.current.clear(), e.current = new He();
|
|
2174
2176
|
}, []);
|
|
2175
|
-
return Ft(() => ({ get: s, set:
|
|
2177
|
+
return Ft(() => ({ get: s, set: l, has: c, remove: d, clear: b }), [s, l, c, d, b]);
|
|
2176
2178
|
}
|
|
2177
2179
|
const Dr = 1e4, qr = () => {
|
|
2178
2180
|
const { get: r, set: t, has: e, clear: n } = Vr(Dr);
|
|
@@ -2184,13 +2186,13 @@ const Dr = 1e4, qr = () => {
|
|
|
2184
2186
|
if (!Number.isFinite(r)) return 0n;
|
|
2185
2187
|
const t = Math.trunc(r);
|
|
2186
2188
|
return t <= 0 ? 0n : BigInt(t);
|
|
2187
|
-
}, Lr = (r, t, e, n, i, s,
|
|
2189
|
+
}, Lr = (r, t, e, n, i, s, l, c) => {
|
|
2188
2190
|
const d = Ne(n);
|
|
2189
2191
|
if (d === 0n)
|
|
2190
2192
|
return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
|
|
2191
2193
|
const b = (A) => A < 0n ? 0n : A >= d ? d - 1n : A, I = { materializeOption: { materialize: !1 } }, { index: v, cumulative: C } = s.findIndexAtOrAfter(r, I);
|
|
2192
2194
|
let p;
|
|
2193
|
-
v === -1 ? p = d - 1n : (C === r ? p = Ne(v + 1) : p = Ne(v), p >= d && (p = d - 1n)), r <= 0 && (p = 0n), c && r >=
|
|
2195
|
+
v === -1 ? p = d - 1n : (C === r ? p = Ne(v + 1) : p = Ne(v), p >= d && (p = d - 1n)), r <= 0 && (p = 0n), c && r >= l && (p = d - 1n);
|
|
2194
2196
|
const V = (A) => {
|
|
2195
2197
|
const O = Number(A);
|
|
2196
2198
|
if (!Number.isSafeInteger(O))
|
|
@@ -2262,12 +2264,12 @@ const Dr = 1e4, qr = () => {
|
|
|
2262
2264
|
visibleStartIndex: St(Number(Q), n),
|
|
2263
2265
|
visibleEndIndex: St(Number(tt), n)
|
|
2264
2266
|
};
|
|
2265
|
-
}, _r = (r, t, e, n, i, s,
|
|
2267
|
+
}, _r = (r, t, e, n, i, s, l) => {
|
|
2266
2268
|
if (n === 0)
|
|
2267
2269
|
return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
|
|
2268
|
-
const c = Number.isFinite(
|
|
2270
|
+
const c = Number.isFinite(l), d = c ? Math.min(Math.max(0, r), l) : Math.max(0, r);
|
|
2269
2271
|
if (n >= Number.MAX_SAFE_INTEGER)
|
|
2270
|
-
return Lr(d, t, e, n, i, s,
|
|
2272
|
+
return Lr(d, t, e, n, i, s, l, c);
|
|
2271
2273
|
const { index: b, cumulative: I, currentValue: v } = s.findIndexAtOrAfter(d, { materializeOption: { materialize: !1 } }), C = b === -1 ? t <= 0 || (I ?? 0) < d + (v ?? 0) ? n - 1 : 0 : b;
|
|
2272
2274
|
let p = St(C, n), V = 0;
|
|
2273
2275
|
if (b !== -1 && I === d)
|
|
@@ -2349,7 +2351,7 @@ const Dr = 1e4, qr = () => {
|
|
|
2349
2351
|
), S(
|
|
2350
2352
|
(s) => {
|
|
2351
2353
|
if (i.arg = s, i.id !== null) return;
|
|
2352
|
-
const
|
|
2354
|
+
const l = (c) => {
|
|
2353
2355
|
if (i.id = null, i.arg === null) return;
|
|
2354
2356
|
const d = c - i.last;
|
|
2355
2357
|
if (n === 0 || i.last === 0 || d >= n) {
|
|
@@ -2361,13 +2363,13 @@ const Dr = 1e4, qr = () => {
|
|
|
2361
2363
|
}
|
|
2362
2364
|
i.arg = null, i.last = c;
|
|
2363
2365
|
}
|
|
2364
|
-
i.arg !== null && (i.id = requestAnimationFrame(
|
|
2366
|
+
i.arg !== null && (i.id = requestAnimationFrame(l));
|
|
2365
2367
|
};
|
|
2366
|
-
i.id = requestAnimationFrame(
|
|
2368
|
+
i.id = requestAnimationFrame(l);
|
|
2367
2369
|
},
|
|
2368
2370
|
[n, e, r, i]
|
|
2369
2371
|
);
|
|
2370
|
-
}, Or = nr.memo(({ index: r, top: t, height: e, item: n, children: i, clipItemHeight: s, enableKeyboardNavigation:
|
|
2372
|
+
}, Or = nr.memo(({ index: r, top: t, height: e, item: n, children: i, clipItemHeight: s, enableKeyboardNavigation: l, onKeyDown: c, onFocus: d, registerItemRef: b }) => {
|
|
2371
2373
|
const I = S((V) => b(r, V), [r, b]), v = S((V) => c(V, r), [r, c]), C = S(() => d(r), [r, d]), p = S((V) => {
|
|
2372
2374
|
V.currentTarget.focus({ preventScroll: !0 });
|
|
2373
2375
|
}, []);
|
|
@@ -2383,10 +2385,10 @@ const Dr = 1e4, qr = () => {
|
|
|
2383
2385
|
height: e,
|
|
2384
2386
|
overflow: s ? "hidden" : void 0
|
|
2385
2387
|
},
|
|
2386
|
-
tabIndex:
|
|
2387
|
-
onPointerDown:
|
|
2388
|
-
onKeyDownCapture:
|
|
2389
|
-
onFocusCapture:
|
|
2388
|
+
tabIndex: l ? -1 : void 0,
|
|
2389
|
+
onPointerDown: l ? p : void 0,
|
|
2390
|
+
onKeyDownCapture: l ? v : void 0,
|
|
2391
|
+
onFocusCapture: l ? C : void 0,
|
|
2390
2392
|
children: i(n, r)
|
|
2391
2393
|
}
|
|
2392
2394
|
);
|
|
@@ -2397,7 +2399,7 @@ const Dr = 1e4, qr = () => {
|
|
|
2397
2399
|
getItemHeight: n,
|
|
2398
2400
|
viewportSize: i,
|
|
2399
2401
|
overscanCount: s = 15,
|
|
2400
|
-
className:
|
|
2402
|
+
className: l,
|
|
2401
2403
|
testId: c,
|
|
2402
2404
|
onScroll: d,
|
|
2403
2405
|
onRangeChange: b,
|
|
@@ -2444,33 +2446,33 @@ const Dr = 1e4, qr = () => {
|
|
|
2444
2446
|
}),
|
|
2445
2447
|
[nt, de]
|
|
2446
2448
|
), E = Nr(r, n, it), [Vt] = re(() => {
|
|
2447
|
-
let
|
|
2449
|
+
let a = 0, u = 0;
|
|
2448
2450
|
if (V && r > 0) {
|
|
2449
2451
|
const m = rt(Math.trunc(V.index), 0, r - 1), D = Math.max(0, V.offsetPx ?? 0), _ = rt(m - s * 2, 0, r - 1), F = rt(m + s * 2, 0, r - 1), $ = m > 0 || D > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: _, to: F }] } } : void 0, { cumulative: K, total: Rt, currentValue: pt } = E.prefixSum(m, $), ht = Math.max(K - pt + D, 0);
|
|
2450
|
-
|
|
2452
|
+
a = Ie(ht, R.top), u = Rt ?? E.getTotal();
|
|
2451
2453
|
} else if (typeof C == "number") {
|
|
2452
2454
|
const m = rt(C, 0, r - 1), D = rt(m - s * 2, 0, r - 1), _ = rt(m + s * 2, 0, r - 1), F = C > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: D, to: _ }] } } : void 0, { cumulative: $, total: K, currentValue: Rt } = E.prefixSum(C, F), pt = Math.max($ - Rt, 0);
|
|
2453
|
-
|
|
2454
|
-
} else typeof p == "number" && (
|
|
2455
|
-
return { position:
|
|
2455
|
+
a = Ie(pt, R.top), u = K ?? E.getTotal();
|
|
2456
|
+
} else typeof p == "number" && (a = Ie(Math.max(p, 0), R.top)), u = E.getTotal();
|
|
2457
|
+
return { position: a, total: u };
|
|
2456
2458
|
}), [zt, Jt] = re(Vt.position), [$t, h] = re(Vt.total), k = x(Vt.position), gt = x(R.top), X = x(d ?? void 0), Pt = x(b ?? void 0), ct = x(/* @__PURE__ */ new Map()), It = x(null), Mt = x(null), [yt, ut] = re(null), [At, dt] = re(!1), st = x(null), _t = x(!1), Xt = x(0), Nt = x(!1), ne = x(!1), Gt = x(r);
|
|
2457
2459
|
Gt.current !== r && (Gt.current = r, ne.current = !0), Y(() => {
|
|
2458
2460
|
X.current = d ?? void 0, Pt.current = b ?? void 0;
|
|
2459
2461
|
}, [b, d]);
|
|
2460
2462
|
const Ct = S(
|
|
2461
|
-
(
|
|
2462
|
-
if (H &&
|
|
2463
|
+
(a) => {
|
|
2464
|
+
if (H && a && typeof a.focus == "function")
|
|
2463
2465
|
try {
|
|
2464
|
-
|
|
2466
|
+
a.focus({ preventScroll: !0 });
|
|
2465
2467
|
} catch {
|
|
2466
|
-
|
|
2468
|
+
a.focus();
|
|
2467
2469
|
}
|
|
2468
2470
|
},
|
|
2469
2471
|
[H]
|
|
2470
|
-
), f = S((
|
|
2471
|
-
|
|
2472
|
-
}, []), M = Qe(X, z, f), ft = S((
|
|
2473
|
-
|
|
2472
|
+
), f = S((a, { position: u, totalHeight: m }) => {
|
|
2473
|
+
a(u, m);
|
|
2474
|
+
}, []), M = Qe(X, z, f), ft = S((a, u) => {
|
|
2475
|
+
a(u);
|
|
2474
2476
|
}, []), Tt = Qe(Pt, z, ft), wt = x(R.top);
|
|
2475
2477
|
wt.current = R.top;
|
|
2476
2478
|
const ie = x(M);
|
|
@@ -2480,12 +2482,12 @@ const Dr = 1e4, qr = () => {
|
|
|
2480
2482
|
H || (ct.current.clear(), It.current = null, Mt.current = null);
|
|
2481
2483
|
}, [H]);
|
|
2482
2484
|
const Qt = S(
|
|
2483
|
-
(
|
|
2485
|
+
(a, u) => {
|
|
2484
2486
|
if (!u) {
|
|
2485
|
-
ct.current.delete(
|
|
2487
|
+
ct.current.delete(a);
|
|
2486
2488
|
return;
|
|
2487
2489
|
}
|
|
2488
|
-
H && (ct.current.set(
|
|
2490
|
+
H && (ct.current.set(a, u), It.current === a && (It.current = null, Mt.current = a, Ct(u)));
|
|
2489
2491
|
},
|
|
2490
2492
|
[H, Ct]
|
|
2491
2493
|
), te = 0.01, Kt = x({
|
|
@@ -2494,8 +2496,8 @@ const Dr = 1e4, qr = () => {
|
|
|
2494
2496
|
idleFrames: 0,
|
|
2495
2497
|
lastRenderedPosition: Vt.position
|
|
2496
2498
|
}), se = S(() => {
|
|
2497
|
-
const
|
|
2498
|
-
|
|
2499
|
+
const a = Kt.current;
|
|
2500
|
+
a.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(a.rafId), a.rafId = null, a.loopActive = !1, a.idleFrames = 0;
|
|
2499
2501
|
}, []);
|
|
2500
2502
|
Y(
|
|
2501
2503
|
() => () => {
|
|
@@ -2505,59 +2507,59 @@ const Dr = 1e4, qr = () => {
|
|
|
2505
2507
|
);
|
|
2506
2508
|
const fe = x(() => {
|
|
2507
2509
|
}), Zt = S(() => {
|
|
2508
|
-
const
|
|
2509
|
-
|
|
2510
|
+
const a = Kt.current;
|
|
2511
|
+
a.rafId = null;
|
|
2510
2512
|
const u = k.current, m = Wt(u, wt.current), D = E.getTotal();
|
|
2511
|
-
if (Jt((F) => Math.abs(F - u) < te ? F : u), Math.abs(
|
|
2513
|
+
if (Jt((F) => Math.abs(F - u) < te ? F : u), Math.abs(a.lastRenderedPosition - u) >= te ? (ie.current({ position: m, totalHeight: D }), a.lastRenderedPosition = u, a.idleFrames = 0) : a.idleFrames += 1, a.idleFrames >= 2) {
|
|
2512
2514
|
se();
|
|
2513
2515
|
return;
|
|
2514
2516
|
}
|
|
2515
2517
|
if (typeof requestAnimationFrame == "function") {
|
|
2516
|
-
|
|
2518
|
+
a.rafId = requestAnimationFrame((F) => fe.current(F));
|
|
2517
2519
|
return;
|
|
2518
2520
|
}
|
|
2519
|
-
|
|
2521
|
+
a.loopActive = !1;
|
|
2520
2522
|
}, [E, se]);
|
|
2521
2523
|
fe.current = Zt;
|
|
2522
2524
|
const we = S(() => {
|
|
2523
|
-
const
|
|
2524
|
-
if (
|
|
2525
|
-
if (
|
|
2526
|
-
|
|
2525
|
+
const a = Kt.current;
|
|
2526
|
+
if (a.idleFrames = 0, !a.loopActive) {
|
|
2527
|
+
if (a.loopActive = !0, typeof requestAnimationFrame == "function") {
|
|
2528
|
+
a.rafId = requestAnimationFrame(Zt);
|
|
2527
2529
|
return;
|
|
2528
2530
|
}
|
|
2529
|
-
|
|
2531
|
+
a.loopActive = !1;
|
|
2530
2532
|
}
|
|
2531
2533
|
}, [Zt]), mt = S(
|
|
2532
|
-
(
|
|
2533
|
-
const m = u?.immediate ?? !1, D = Wt(
|
|
2534
|
-
if (k.current =
|
|
2535
|
-
Kt.current.lastRenderedPosition =
|
|
2534
|
+
(a, u) => {
|
|
2535
|
+
const m = u?.immediate ?? !1, D = Wt(a, R.top);
|
|
2536
|
+
if (k.current = a, m) {
|
|
2537
|
+
Kt.current.lastRenderedPosition = a, Kt.current.idleFrames = 0, Jt(a), M({ position: D, totalHeight: E.getTotal() });
|
|
2536
2538
|
return;
|
|
2537
2539
|
}
|
|
2538
2540
|
we();
|
|
2539
2541
|
},
|
|
2540
2542
|
[we, E, R.top, M]
|
|
2541
|
-
), me = S((
|
|
2543
|
+
), me = S((a) => {
|
|
2542
2544
|
const u = G.current;
|
|
2543
2545
|
if (!u)
|
|
2544
|
-
return
|
|
2546
|
+
return a;
|
|
2545
2547
|
const m = u.getScrollPosition();
|
|
2546
2548
|
Xt.current += 1;
|
|
2547
|
-
const D = u.scrollTo(
|
|
2548
|
-
return D === m && (Xt.current = Math.max(0, Xt.current - 1)), Math.abs(D -
|
|
2549
|
+
const D = u.scrollTo(a);
|
|
2550
|
+
return D === m && (Xt.current = Math.max(0, Xt.current - 1)), Math.abs(D - a) > 0.5 && (Nt.current = !0), D;
|
|
2549
2551
|
}, []), Ce = x(!1);
|
|
2550
2552
|
Y(() => {
|
|
2551
2553
|
if (!Ce.current)
|
|
2552
2554
|
if (Ce.current = !0, V == null && typeof C != "number" && typeof p == "number") {
|
|
2553
|
-
const
|
|
2554
|
-
mt(
|
|
2555
|
+
const a = Ie(Math.max(p, 0), R.top), u = Math.abs(a - k.current) > 0.5;
|
|
2556
|
+
mt(a, { immediate: !0 }), u && G.current?.scrollTo(a);
|
|
2555
2557
|
} else
|
|
2556
2558
|
mt(k.current, { immediate: !0 });
|
|
2557
2559
|
}, [V, C, p, R.top, mt]), Y(() => {
|
|
2558
|
-
const
|
|
2559
|
-
if ($t !==
|
|
2560
|
-
h(
|
|
2560
|
+
const a = E.getTotal();
|
|
2561
|
+
if ($t !== a) {
|
|
2562
|
+
h(a);
|
|
2561
2563
|
return;
|
|
2562
2564
|
}
|
|
2563
2565
|
if (Nt.current) {
|
|
@@ -2570,7 +2572,7 @@ const Dr = 1e4, qr = () => {
|
|
|
2570
2572
|
}
|
|
2571
2573
|
}, [E, $t, r, me, mt]), Y(() => {
|
|
2572
2574
|
if (vt.current !== null) {
|
|
2573
|
-
const { index:
|
|
2575
|
+
const { index: a, align: u, offset: m } = vt.current, D = St(a, r), { cumulative: _, currentValue: F } = E.prefixSum(D, { materializeOption: { materialize: !1 } });
|
|
2574
2576
|
if (_ !== void 0 && F !== void 0) {
|
|
2575
2577
|
const $ = Math.max(_ - F, 0);
|
|
2576
2578
|
let K = $;
|
|
@@ -2585,17 +2587,17 @@ const Dr = 1e4, qr = () => {
|
|
|
2585
2587
|
}
|
|
2586
2588
|
ne.current = !1;
|
|
2587
2589
|
}, [$t, E, r, R.top, mt, i, R.bottom]), Y(() => {
|
|
2588
|
-
const
|
|
2589
|
-
if (
|
|
2590
|
+
const a = gt.current;
|
|
2591
|
+
if (a === R.top || (gt.current = R.top, vt.current))
|
|
2590
2592
|
return;
|
|
2591
|
-
const u = Wt(k.current,
|
|
2593
|
+
const u = Wt(k.current, a), m = Ie(u, R.top);
|
|
2592
2594
|
k.current = m, G.current?.scrollTo(m), mt(m, { immediate: !0 });
|
|
2593
2595
|
}, [R.top, mt]);
|
|
2594
|
-
const
|
|
2595
|
-
(
|
|
2596
|
+
const Se = S(
|
|
2597
|
+
(a, u) => {
|
|
2596
2598
|
if (r === 0)
|
|
2597
2599
|
return;
|
|
2598
|
-
const m = St(
|
|
2600
|
+
const m = St(a, r), D = E.get(m), _ = u - D, F = E.update(m, u);
|
|
2599
2601
|
F !== void 0 && h(F), N.debug("[VirtualScroll] Updated item size manually", { index: m, size: u, total: F });
|
|
2600
2602
|
let $ = vt.current ? vt.current.index : null;
|
|
2601
2603
|
if ($ === null) {
|
|
@@ -2609,10 +2611,10 @@ const Dr = 1e4, qr = () => {
|
|
|
2609
2611
|
},
|
|
2610
2612
|
[E, r, me, mt, W]
|
|
2611
2613
|
), Ut = S(
|
|
2612
|
-
(
|
|
2614
|
+
(a, u) => {
|
|
2613
2615
|
if (!G.current || r === 0)
|
|
2614
2616
|
return;
|
|
2615
|
-
const m = St(
|
|
2617
|
+
const m = St(a, r), D = St(m - s * 2, r), _ = St(m + s * 2, r), { cumulative: F, total: $, currentValue: K } = E.prefixSum(m, { materializeOption: { materialize: !0, ranges: [{ from: D, to: _ }] } });
|
|
2616
2618
|
if (N.debug("[VirtualScroll] Scrolling to index:", m, "ItemBottom:", F, "Total height:", $, "ItemHeight:", K, "safeIndexFrom:", D, "safeIndexTo:", _), !$)
|
|
2617
2619
|
return;
|
|
2618
2620
|
const Rt = Math.max(F - K, 0);
|
|
@@ -2630,46 +2632,46 @@ const Dr = 1e4, qr = () => {
|
|
|
2630
2632
|
[E, s, r, R.top, R.bottom, i, mt]
|
|
2631
2633
|
), Ve = x(V && r === 0 ? V : null);
|
|
2632
2634
|
Y(() => {
|
|
2633
|
-
const
|
|
2634
|
-
!
|
|
2635
|
+
const a = Ve.current;
|
|
2636
|
+
!a || r === 0 || (Ve.current = null, Ut(rt(Math.trunc(a.index), 0, r - 1), { align: "top", offset: -Math.max(0, a.offsetPx ?? 0) }));
|
|
2635
2637
|
}, [r, Ut]);
|
|
2636
2638
|
const De = S(
|
|
2637
|
-
(
|
|
2639
|
+
(a) => {
|
|
2638
2640
|
if (!G.current || r === 0)
|
|
2639
2641
|
return;
|
|
2640
|
-
const u = E.getTotal(), m = rt(Math.floor(
|
|
2642
|
+
const u = E.getTotal(), m = rt(Math.floor(a), 0, u), { index: D, cumulative: _, currentValue: F } = E.findIndexAtOrAfter(m, { materializeOption: { materialize: !1 } }), K = (_ ?? 0) - (F ?? 0) - m;
|
|
2641
2643
|
Ut(D, { offset: K });
|
|
2642
2644
|
},
|
|
2643
2645
|
[E, r, Ut]
|
|
2644
2646
|
), be = S(() => {
|
|
2645
2647
|
if (r === 0)
|
|
2646
2648
|
return null;
|
|
2647
|
-
const
|
|
2649
|
+
const a = Wt(k.current, R.top), { index: u, cumulative: m, currentValue: D } = E.findIndexAtOrAfter(a, { materializeOption: { materialize: !1 } });
|
|
2648
2650
|
if (u === -1)
|
|
2649
2651
|
return { index: r - 1, offsetPx: 0 };
|
|
2650
|
-
if (m ===
|
|
2652
|
+
if (m === a)
|
|
2651
2653
|
return { index: rt(u + 1, 0, r - 1), offsetPx: 0 };
|
|
2652
2654
|
const _ = (m ?? 0) - (D ?? 0);
|
|
2653
|
-
return { index: u, offsetPx: Math.max(0,
|
|
2655
|
+
return { index: u, offsetPx: Math.max(0, a - _) };
|
|
2654
2656
|
}, [E, r, R.top]), Ae = S(
|
|
2655
|
-
(
|
|
2656
|
-
const u = Wt(k.current, R.top), m = typeof
|
|
2657
|
+
(a) => {
|
|
2658
|
+
const u = Wt(k.current, R.top), m = typeof a == "function" ? a(u) : a;
|
|
2657
2659
|
De(m);
|
|
2658
2660
|
const D = G.current?.getScrollPosition(), _ = typeof D == "number" ? D : k.current;
|
|
2659
2661
|
return mt(_), Wt(_, wt.current);
|
|
2660
2662
|
},
|
|
2661
2663
|
[R.top, De, mt]
|
|
2662
2664
|
), ke = S(
|
|
2663
|
-
(
|
|
2664
|
-
N.debug("[VirtualScroll] Scroll position changed:",
|
|
2665
|
+
(a, u) => {
|
|
2666
|
+
N.debug("[VirtualScroll] Scroll position changed:", a);
|
|
2665
2667
|
const m = _t.current;
|
|
2666
2668
|
m && (_t.current = !1);
|
|
2667
2669
|
const D = Xt.current > 0;
|
|
2668
|
-
if (D && (Xt.current = 0), m || D || ne.current || (vt.current = null), mt(
|
|
2670
|
+
if (D && (Xt.current = 0), m || D || ne.current || (vt.current = null), mt(a), w) {
|
|
2669
2671
|
if (m || D)
|
|
2670
2672
|
return;
|
|
2671
|
-
const _ =
|
|
2672
|
-
if (N.debug("[VirtualScroll] Scroll diff:", _, "New:",
|
|
2673
|
+
const _ = a - u;
|
|
2674
|
+
if (N.debug("[VirtualScroll] Scroll diff:", _, "New:", a, "Prev:", u), Math.abs(_) > 1) {
|
|
2673
2675
|
const F = _ > 0 ? "down" : "up";
|
|
2674
2676
|
ut(F), dt(!0), N.debug("[VirtualScroll] Showing scroll buttons. Direction:", F), st.current && clearTimeout(st.current), st.current = setTimeout(() => {
|
|
2675
2677
|
dt(!1), N.debug("[VirtualScroll] Hiding scroll buttons");
|
|
@@ -2679,19 +2681,19 @@ const Dr = 1e4, qr = () => {
|
|
|
2679
2681
|
},
|
|
2680
2682
|
[mt, w]
|
|
2681
2683
|
), oe = Ft(() => Wt(zt, R.top), [R.top, zt]), pe = Ft(() => {
|
|
2682
|
-
const
|
|
2684
|
+
const a = E.getTotal(), u = _r(oe, i, s, r, n, E, a);
|
|
2683
2685
|
return N.debug("[VirtualScroll] Calculated rendering range:", () => ({
|
|
2684
2686
|
...u,
|
|
2685
2687
|
scrollPosition: oe,
|
|
2686
|
-
renderingContentSize:
|
|
2688
|
+
renderingContentSize: a,
|
|
2687
2689
|
overscanCount: s,
|
|
2688
2690
|
viewportSize: i
|
|
2689
2691
|
})), u;
|
|
2690
2692
|
}, [oe, i, s, r, n, E]), { renderingStartIndex: ae, renderingEndIndex: le, visibleStartIndex: ce, visibleEndIndex: xe } = pe, o = S(
|
|
2691
|
-
(
|
|
2693
|
+
(a, u) => {
|
|
2692
2694
|
if (!H || r === 0)
|
|
2693
2695
|
return;
|
|
2694
|
-
const m = St(
|
|
2696
|
+
const m = St(a, r);
|
|
2695
2697
|
if (!(u?.ensureVisible ?? !0)) {
|
|
2696
2698
|
const kt = ct.current.get(m);
|
|
2697
2699
|
kt && (It.current = null, Mt.current = m, Ct(kt));
|
|
@@ -2713,49 +2715,49 @@ const Dr = 1e4, qr = () => {
|
|
|
2713
2715
|
},
|
|
2714
2716
|
[H, r, E, R.top, Ut, Ct, i]
|
|
2715
2717
|
), g = S(
|
|
2716
|
-
(
|
|
2717
|
-
if (!H ||
|
|
2718
|
+
(a, u) => {
|
|
2719
|
+
if (!H || a.defaultPrevented || a.altKey || a.metaKey || a.ctrlKey)
|
|
2718
2720
|
return;
|
|
2719
|
-
const m =
|
|
2721
|
+
const m = a.target;
|
|
2720
2722
|
if (m) {
|
|
2721
2723
|
const D = m.tagName;
|
|
2722
2724
|
if (D === "INPUT" || D === "TEXTAREA" || D === "SELECT" || m.isContentEditable)
|
|
2723
2725
|
return;
|
|
2724
2726
|
}
|
|
2725
|
-
if (
|
|
2726
|
-
u < r - 1 && (
|
|
2727
|
+
if (a.key === "ArrowDown") {
|
|
2728
|
+
u < r - 1 && (a.preventDefault(), o(u + 1));
|
|
2727
2729
|
return;
|
|
2728
2730
|
}
|
|
2729
|
-
if (
|
|
2730
|
-
u > 0 && (
|
|
2731
|
+
if (a.key === "ArrowUp") {
|
|
2732
|
+
u > 0 && (a.preventDefault(), o(u - 1));
|
|
2731
2733
|
return;
|
|
2732
2734
|
}
|
|
2733
|
-
if (
|
|
2735
|
+
if (a.key === "PageDown") {
|
|
2734
2736
|
if (u < r - 1) {
|
|
2735
|
-
|
|
2737
|
+
a.preventDefault();
|
|
2736
2738
|
const { visibleStartIndex: D, visibleEndIndex: _ } = J.current, F = Math.max(_ - D + 1, 1), $ = Math.max(F, 1), K = St(Math.min(u + $, r - 1), r);
|
|
2737
2739
|
o(K);
|
|
2738
2740
|
}
|
|
2739
2741
|
return;
|
|
2740
2742
|
}
|
|
2741
|
-
if (
|
|
2742
|
-
|
|
2743
|
+
if (a.key === "PageUp" && u > 0) {
|
|
2744
|
+
a.preventDefault();
|
|
2743
2745
|
const { visibleStartIndex: D, visibleEndIndex: _ } = J.current, F = Math.max(_ - D + 1, 1), $ = Math.max(F, 1), K = St(u - $, r);
|
|
2744
2746
|
o(K);
|
|
2745
2747
|
}
|
|
2746
2748
|
},
|
|
2747
2749
|
[H, r, o]
|
|
2748
2750
|
), y = S(
|
|
2749
|
-
(
|
|
2751
|
+
(a) => {
|
|
2750
2752
|
if (!H)
|
|
2751
2753
|
return;
|
|
2752
|
-
const u = St(
|
|
2754
|
+
const u = St(a, r);
|
|
2753
2755
|
It.current = null, Mt.current = u, at?.(u);
|
|
2754
2756
|
},
|
|
2755
2757
|
[H, r, at]
|
|
2756
2758
|
);
|
|
2757
2759
|
Y(() => {
|
|
2758
|
-
const
|
|
2760
|
+
const a = G.current?.getScrollPosition() ?? 0, u = k.current, m = Wt(u, R.top);
|
|
2759
2761
|
N.debug("[VirtualScroll] Range change effect triggered", () => ({
|
|
2760
2762
|
renderingStartIndex: ae,
|
|
2761
2763
|
renderingEndIndex: le,
|
|
@@ -2765,7 +2767,7 @@ const Dr = 1e4, qr = () => {
|
|
|
2765
2767
|
paneScrollPosition: u,
|
|
2766
2768
|
logicalScrollPosition: m,
|
|
2767
2769
|
contentSize: $t,
|
|
2768
|
-
scrollPaneScrollPosition:
|
|
2770
|
+
scrollPaneScrollPosition: a
|
|
2769
2771
|
})), Tt({
|
|
2770
2772
|
renderingStartIndex: ae,
|
|
2771
2773
|
renderingEndIndex: le,
|
|
@@ -2775,39 +2777,46 @@ const Dr = 1e4, qr = () => {
|
|
|
2775
2777
|
totalHeight: $t
|
|
2776
2778
|
});
|
|
2777
2779
|
}, [$t, le, ae, R.top, Tt, zt, xe, ce]);
|
|
2778
|
-
const L = S(() =>
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2780
|
+
const L = S(() => {
|
|
2781
|
+
if (!w)
|
|
2782
|
+
return null;
|
|
2783
|
+
const a = At && yt !== null;
|
|
2784
|
+
return /* @__PURE__ */ ot("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": a, inert: !a, children: yt === "up" ? /* @__PURE__ */ ot("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ ot(
|
|
2785
|
+
"button",
|
|
2786
|
+
{
|
|
2787
|
+
type: "button",
|
|
2788
|
+
className: "aqvs-scroll-to-edge-button",
|
|
2789
|
+
tabIndex: a ? 0 : -1,
|
|
2790
|
+
onClick: (m) => {
|
|
2791
|
+
m.stopPropagation(), _t.current = !0, Ut(0), dt(!1);
|
|
2792
|
+
},
|
|
2793
|
+
children: "Top"
|
|
2794
|
+
}
|
|
2795
|
+
) }) : /* @__PURE__ */ ot("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-bottom", children: /* @__PURE__ */ ot(
|
|
2796
|
+
"button",
|
|
2797
|
+
{
|
|
2798
|
+
type: "button",
|
|
2799
|
+
className: "aqvs-scroll-to-edge-button",
|
|
2800
|
+
tabIndex: a ? 0 : -1,
|
|
2801
|
+
onClick: (m) => {
|
|
2802
|
+
m.stopPropagation(), _t.current = !0, Ut(r - 1), dt(!1);
|
|
2803
|
+
},
|
|
2804
|
+
children: "Bottom"
|
|
2805
|
+
}
|
|
2806
|
+
) }) });
|
|
2807
|
+
}, [w, At, yt, Ut, r]), B = x(0), { visibleItems: bt, renderAnchor: Ot } = Ft(() => {
|
|
2799
2808
|
if (r === 0)
|
|
2800
2809
|
return {
|
|
2801
2810
|
visibleItems: /* @__PURE__ */ ot("div", { className: "aqvs-no-items-container", children: /* @__PURE__ */ ot("div", { className: "aqvs-no-items-text", children: "No items" }) }),
|
|
2802
2811
|
renderAnchor: 0
|
|
2803
2812
|
};
|
|
2804
|
-
const
|
|
2813
|
+
const a = St(ae, r), u = St(le, r), { cumulative: m, currentValue: D } = E.prefixSum(a, { materializeOption: { materialize: !1 } }), _ = m - D;
|
|
2805
2814
|
Number.isFinite(_) && Math.abs(_ - B.current) > Ar && (B.current = _);
|
|
2806
2815
|
const F = B.current, $ = [], K = [];
|
|
2807
2816
|
let Rt = 0, pt = _;
|
|
2808
|
-
for (let ht =
|
|
2817
|
+
for (let ht = a; ht <= u; ht++) {
|
|
2809
2818
|
if (K.length >= Je) {
|
|
2810
|
-
N.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.", { cap: Je, safeRenderingStartIndex:
|
|
2819
|
+
N.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.", { cap: Je, safeRenderingStartIndex: a, safeRenderingEndIndex: u });
|
|
2811
2820
|
break;
|
|
2812
2821
|
}
|
|
2813
2822
|
const Bt = n(ht), kt = E.get(ht), qt = Bt - kt;
|
|
@@ -2870,10 +2879,10 @@ const Dr = 1e4, qr = () => {
|
|
|
2870
2879
|
mt,
|
|
2871
2880
|
ce
|
|
2872
2881
|
]), Yt = S(
|
|
2873
|
-
(
|
|
2874
|
-
const u = (z ?? 0) > 0, m = Math.abs(
|
|
2882
|
+
(a) => {
|
|
2883
|
+
const u = (z ?? 0) > 0, m = Math.abs(a - zt), D = u && m > 0.5 ? zt : a, _ = Wt(D, R.top);
|
|
2875
2884
|
if (N.debug("[VirtualScroll] Rendering visible items", () => ({
|
|
2876
|
-
currentScrollPosition:
|
|
2885
|
+
currentScrollPosition: a,
|
|
2877
2886
|
effectiveScrollPosition: _,
|
|
2878
2887
|
renderingStartIndex: ae,
|
|
2879
2888
|
renderingEndIndex: le,
|
|
@@ -2901,13 +2910,13 @@ const Dr = 1e4, qr = () => {
|
|
|
2901
2910
|
logicalScrollPosition: oe,
|
|
2902
2911
|
resolvedInsets: R,
|
|
2903
2912
|
effectiveScrollPosition: _
|
|
2904
|
-
})), /* @__PURE__ */
|
|
2913
|
+
})), /* @__PURE__ */ Te("div", { className: "aqvs-items-wrapper", style: { top: 0, transform: `translateY(${F}px)`, willChange: "transform" }, children: [
|
|
2905
2914
|
bt,
|
|
2906
2915
|
$
|
|
2907
2916
|
] });
|
|
2908
2917
|
},
|
|
2909
2918
|
[z, r, E, oe, Ot, le, ae, R, zt, i, bt]
|
|
2910
|
-
),
|
|
2919
|
+
), ve = Ft(
|
|
2911
2920
|
() => ({
|
|
2912
2921
|
renderingStartIndex: pe.renderingStartIndex,
|
|
2913
2922
|
renderingEndIndex: pe.renderingEndIndex,
|
|
@@ -2922,13 +2931,13 @@ const Dr = 1e4, qr = () => {
|
|
|
2922
2931
|
[pe, oe, E, $t]
|
|
2923
2932
|
);
|
|
2924
2933
|
Y(() => {
|
|
2925
|
-
J.current =
|
|
2926
|
-
}, [
|
|
2934
|
+
J.current = ve;
|
|
2935
|
+
}, [ve]), Ue(
|
|
2927
2936
|
A,
|
|
2928
2937
|
() => ({
|
|
2929
2938
|
getScrollPosition: () => {
|
|
2930
|
-
const
|
|
2931
|
-
return typeof
|
|
2939
|
+
const a = G.current?.getScrollPosition();
|
|
2940
|
+
return typeof a == "number" ? Wt(a, wt.current) : -1;
|
|
2932
2941
|
},
|
|
2933
2942
|
getContentSize: () => G.current?.getContentSize() ?? -1,
|
|
2934
2943
|
getViewportSize: () => G.current?.getViewportSize() ?? -1,
|
|
@@ -2939,9 +2948,9 @@ const Dr = 1e4, qr = () => {
|
|
|
2939
2948
|
focusItemAtIndex: o,
|
|
2940
2949
|
getRange: () => J.current,
|
|
2941
2950
|
getScrollAnchor: be,
|
|
2942
|
-
updateItemSize:
|
|
2951
|
+
updateItemSize: Se
|
|
2943
2952
|
}),
|
|
2944
|
-
[Ae, Ut, E, o, be,
|
|
2953
|
+
[Ae, Ut, E, o, be, Se]
|
|
2945
2954
|
);
|
|
2946
2955
|
const ue = E.getTotal() + R.top + R.bottom;
|
|
2947
2956
|
return /* @__PURE__ */ ot(
|
|
@@ -2950,7 +2959,7 @@ const Dr = 1e4, qr = () => {
|
|
|
2950
2959
|
ref: G,
|
|
2951
2960
|
contentSize: ue,
|
|
2952
2961
|
viewportSize: i,
|
|
2953
|
-
className:
|
|
2962
|
+
className: l,
|
|
2954
2963
|
testId: c,
|
|
2955
2964
|
onScroll: ke,
|
|
2956
2965
|
background: v,
|