@aiquants/virtualscroll 2.7.0 → 3.0.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 +25 -0
- package/README.md +10 -10
- package/dist/VirtualScroll.d.cts +15 -9
- package/dist/VirtualScroll.d.ts +15 -9
- package/dist/VirtualScroll.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +333 -344
- package/package.json +1 -1
- package/src/VirtualScroll.tsx +21 -41
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as de, jsxs as Mt, Fragment as dr } from "react/jsx-runtime";
|
|
2
|
-
import xr, { memo as
|
|
2
|
+
import xr, { memo as Ir, forwardRef as Zt, useState as rt, useRef as g, useCallback as S, useImperativeHandle as Jt, useMemo as Fe, useLayoutEffect as nt, useEffect as q, useId as Sr } from "react";
|
|
3
3
|
import { twMerge as Et } from "tailwind-merge";
|
|
4
4
|
class T {
|
|
5
5
|
level;
|
|
@@ -181,92 +181,92 @@ const rr = {
|
|
|
181
181
|
}
|
|
182
182
|
)
|
|
183
183
|
] });
|
|
184
|
-
}, fr =
|
|
184
|
+
}, fr = Ir(
|
|
185
185
|
Zt(({ onDragChange: r, className: e, maxVisualDistance: t = 160, size: n = 40, style: i, opacity: s = 1, renderVisual: a }, c) => {
|
|
186
|
-
const [f, b] = rt(rr),
|
|
186
|
+
const [f, b] = rt(rr), I = g(null), w = g(null), V = g({ x: 0, y: 0 }), h = g(null), z = g(0), G = S(
|
|
187
187
|
(v) => {
|
|
188
188
|
b(v), r(v);
|
|
189
189
|
},
|
|
190
190
|
[r]
|
|
191
|
-
), H =
|
|
192
|
-
(v,
|
|
193
|
-
const { x: qe, y: ee } = V.current, X = v - qe, Xe =
|
|
194
|
-
let je =
|
|
191
|
+
), H = S(
|
|
192
|
+
(v, W, ge = !1) => {
|
|
193
|
+
const { x: qe, y: ee } = V.current, X = v - qe, Xe = W - ee, $e = Math.abs(Xe), ze = $e < $t ? 0 : Xe < 0 ? -1 : 1, Ce = z.current;
|
|
194
|
+
let je = ze;
|
|
195
195
|
const Ge = $t + vr;
|
|
196
|
-
|
|
196
|
+
ze === 0 ? Ce !== 0 && $e < Ge ? je = Ce : (je = 0, ge || (z.current = 0)) : ze !== Ce && Ce !== 0 && $e < Ge ? je = Ce : z.current = ze, G({
|
|
197
197
|
active: ge || $e >= $t,
|
|
198
198
|
offsetX: X,
|
|
199
199
|
offsetY: Xe,
|
|
200
200
|
distance: $e,
|
|
201
201
|
direction: je,
|
|
202
|
-
pointerId:
|
|
202
|
+
pointerId: I.current
|
|
203
203
|
});
|
|
204
204
|
},
|
|
205
205
|
[G]
|
|
206
|
-
), pe =
|
|
206
|
+
), pe = S((v) => {
|
|
207
207
|
if (v === null)
|
|
208
208
|
return;
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
}, []), me =
|
|
209
|
+
const W = h.current;
|
|
210
|
+
W?.hasPointerCapture(v) && W.releasePointerCapture(v);
|
|
211
|
+
}, []), me = S(
|
|
212
212
|
(v = !1) => {
|
|
213
|
-
v && pe(
|
|
213
|
+
v && pe(I.current), I.current = null, w.current = null, z.current = 0, G(rr);
|
|
214
214
|
},
|
|
215
215
|
[G, pe]
|
|
216
|
-
), oe =
|
|
216
|
+
), oe = S(
|
|
217
217
|
(v) => {
|
|
218
|
-
if (
|
|
218
|
+
if (I.current !== null && I.current !== v.pointerId) {
|
|
219
219
|
w.current = { pointerId: v.pointerId, clientX: v.clientX, clientY: v.clientY }, v.preventDefault(), v.stopPropagation();
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
222
222
|
v.preventDefault(), v.stopPropagation();
|
|
223
|
-
const
|
|
224
|
-
V.current = { x: ge + ee / 2, y: qe + X / 2 },
|
|
223
|
+
const W = h.current ?? v.currentTarget, { left: ge, top: qe, width: ee, height: X } = W.getBoundingClientRect();
|
|
224
|
+
V.current = { x: ge + ee / 2, y: qe + X / 2 }, I.current = v.pointerId;
|
|
225
225
|
try {
|
|
226
|
-
|
|
226
|
+
W.setPointerCapture(v.pointerId);
|
|
227
227
|
} catch {
|
|
228
228
|
}
|
|
229
229
|
H(v.clientX, v.clientY, !0);
|
|
230
230
|
},
|
|
231
231
|
[H]
|
|
232
|
-
), ce =
|
|
232
|
+
), ce = S(
|
|
233
233
|
(v) => {
|
|
234
|
-
if (
|
|
234
|
+
if (I.current !== v.pointerId) {
|
|
235
235
|
w.current !== null && w.current.pointerId === v.pointerId && (w.current = { pointerId: v.pointerId, clientX: v.clientX, clientY: v.clientY });
|
|
236
236
|
return;
|
|
237
237
|
}
|
|
238
238
|
v.preventDefault(), H(v.clientX, v.clientY);
|
|
239
239
|
},
|
|
240
240
|
[H]
|
|
241
|
-
), he =
|
|
241
|
+
), he = S(
|
|
242
242
|
(v) => {
|
|
243
|
-
if (
|
|
243
|
+
if (I.current !== v.pointerId) {
|
|
244
244
|
w.current !== null && w.current.pointerId === v.pointerId && (w.current = null);
|
|
245
245
|
return;
|
|
246
246
|
}
|
|
247
247
|
v.preventDefault(), v.stopPropagation();
|
|
248
|
-
const
|
|
249
|
-
if (w.current = null,
|
|
248
|
+
const W = w.current;
|
|
249
|
+
if (w.current = null, W !== null) {
|
|
250
250
|
pe(v.pointerId);
|
|
251
251
|
const ge = h.current;
|
|
252
252
|
let qe = !0;
|
|
253
253
|
if (ge !== null && typeof ge.setPointerCapture == "function")
|
|
254
254
|
try {
|
|
255
|
-
ge.setPointerCapture(
|
|
255
|
+
ge.setPointerCapture(W.pointerId);
|
|
256
256
|
} catch (ee) {
|
|
257
257
|
(typeof ee == "object" && ee !== null && "name" in ee ? ee.name : void 0) === "NotFoundError" && (qe = !1);
|
|
258
258
|
}
|
|
259
259
|
if (qe) {
|
|
260
|
-
|
|
260
|
+
I.current = W.pointerId, H(W.clientX, W.clientY, !0);
|
|
261
261
|
return;
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
me(!0);
|
|
265
265
|
},
|
|
266
266
|
[me, pe, H]
|
|
267
|
-
), P =
|
|
267
|
+
), P = S(
|
|
268
268
|
(v) => {
|
|
269
|
-
v.target === v.currentTarget &&
|
|
269
|
+
v.target === v.currentTarget && I.current === v.pointerId && me(!1);
|
|
270
270
|
},
|
|
271
271
|
[me]
|
|
272
272
|
);
|
|
@@ -280,25 +280,25 @@ const rr = {
|
|
|
280
280
|
}),
|
|
281
281
|
[me]
|
|
282
282
|
);
|
|
283
|
-
const _ = Math.min(Math.max(s, 0), 1), M = n / 64, Z = Math.min(f.distance, t) / t, Q = f.direction * Z * 10 * M,
|
|
283
|
+
const _ = Math.min(Math.max(s, 0), 1), M = n / 64, Z = Math.min(f.distance, t) / t, Q = f.direction * Z * 10 * M, U = a ?? wr, Se = {
|
|
284
284
|
dragState: f,
|
|
285
285
|
normalizedDistance: Z,
|
|
286
286
|
sizeScale: M,
|
|
287
287
|
size: n,
|
|
288
288
|
opacity: _
|
|
289
|
-
},
|
|
289
|
+
}, C = {
|
|
290
290
|
...i,
|
|
291
291
|
width: n,
|
|
292
292
|
height: n,
|
|
293
293
|
transform: `translateY(${Q}px)`
|
|
294
294
|
};
|
|
295
|
-
return
|
|
295
|
+
return C.opacity = _, /* @__PURE__ */ de(
|
|
296
296
|
"div",
|
|
297
297
|
{
|
|
298
298
|
ref: h,
|
|
299
299
|
"data-testid": "virtual-scroll-tap-circle",
|
|
300
300
|
className: Et("aqvs-tap-scroll-circle", e),
|
|
301
|
-
style:
|
|
301
|
+
style: C,
|
|
302
302
|
tabIndex: -1,
|
|
303
303
|
onPointerDown: oe,
|
|
304
304
|
onPointerMove: ce,
|
|
@@ -306,7 +306,7 @@ const rr = {
|
|
|
306
306
|
onPointerCancel: he,
|
|
307
307
|
onLostPointerCapture: P,
|
|
308
308
|
role: "presentation",
|
|
309
|
-
children:
|
|
309
|
+
children: U(Se)
|
|
310
310
|
}
|
|
311
311
|
);
|
|
312
312
|
})
|
|
@@ -317,7 +317,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
317
317
|
maxDistance: 240,
|
|
318
318
|
/** 最小速度倍率 (ビューポート比)。 */
|
|
319
319
|
minSpeedMultiplier: 0.2
|
|
320
|
-
}, Rr = pr.maxDistance, ir = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null },
|
|
320
|
+
}, Rr = pr.maxDistance, ir = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, Ut = 2.2, Er = 8, Nr = 120, Vr = 1 / 10, dt = {
|
|
321
321
|
enabled: !0,
|
|
322
322
|
size: 40,
|
|
323
323
|
offsetX: -80,
|
|
@@ -328,7 +328,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
328
328
|
opacity: 0.9,
|
|
329
329
|
renderVisual: void 0,
|
|
330
330
|
maxSpeedCurve: void 0
|
|
331
|
-
},
|
|
331
|
+
}, zr = (r) => r ? {
|
|
332
332
|
mainSizeKey: "width",
|
|
333
333
|
crossSizeKey: "height",
|
|
334
334
|
positionKey: "left",
|
|
@@ -348,7 +348,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
348
348
|
arrowIcons: ["▲", "▼"],
|
|
349
349
|
directionClass: "aqvs-scrollbar-vertical",
|
|
350
350
|
orientation: "vertical"
|
|
351
|
-
},
|
|
351
|
+
}, Cr = (r, e) => {
|
|
352
352
|
const t = r?.maxSpeedMultiplier, n = typeof t == "number" ? t : _r(e);
|
|
353
353
|
return {
|
|
354
354
|
enabled: r?.enabled ?? dt.enabled,
|
|
@@ -364,11 +364,11 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
364
364
|
maxSpeedCurve: r?.maxSpeedCurve ?? dt.maxSpeedCurve
|
|
365
365
|
};
|
|
366
366
|
}, Dr = ({ isDragging: r, isThumbHovered: e, enableThumbDrag: t }) => Fe(() => t ? r ? "dragging" : e ? "hover" : "idle" : "disabled", [t, r, e]), Ar = ({ canUseArrowButtons: r, enableArrowButtons: e, resetTapScroll: t, scrollByStep: n }) => {
|
|
367
|
-
const i = g(null), s = g(null), a = g(null), c =
|
|
367
|
+
const i = g(null), s = g(null), a = g(null), c = S(() => {
|
|
368
368
|
i.current !== null && (window.clearInterval(i.current), i.current = null), s.current !== null && (window.clearTimeout(s.current), s.current = null), a.current !== null && (window.removeEventListener("pointerup", a.current), window.removeEventListener("pointercancel", a.current), window.removeEventListener("blur", a.current), a.current = null);
|
|
369
|
-
}, []), f =
|
|
369
|
+
}, []), f = S(() => {
|
|
370
370
|
c();
|
|
371
|
-
}, [c]), b =
|
|
371
|
+
}, [c]), b = S(
|
|
372
372
|
(w) => (V) => {
|
|
373
373
|
if (!r)
|
|
374
374
|
return;
|
|
@@ -381,7 +381,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
381
381
|
a.current = h, window.addEventListener("pointerup", h), window.addEventListener("pointercancel", h), window.addEventListener("blur", h);
|
|
382
382
|
},
|
|
383
383
|
[r, c, t, n]
|
|
384
|
-
),
|
|
384
|
+
), I = S(
|
|
385
385
|
(w) => (V) => {
|
|
386
386
|
e && (V.key === "Enter" || V.key === " " || V.key === "Spacebar") && (V.preventDefault(), n(w));
|
|
387
387
|
},
|
|
@@ -391,12 +391,12 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
391
391
|
r || c();
|
|
392
392
|
}, [r, c]), q(() => () => {
|
|
393
393
|
c();
|
|
394
|
-
}, [c]), { handleArrowPointerDown: b, handleArrowPointerUp: f, handleArrowKeyDown:
|
|
395
|
-
}, Lr = 700,
|
|
396
|
-
const c = Math.max(
|
|
394
|
+
}, [c]), { handleArrowPointerDown: b, handleArrowPointerUp: f, handleArrowKeyDown: I };
|
|
395
|
+
}, Lr = 700, It = (r, e) => typeof r == "number" && Number.isFinite(r) ? r : e, Or = ({ distance: r, maxDistance: e, viewportSize: t, minSpeedMultiplier: n, maxSpeedMultiplier: i, hasCustomMaxSpeedMultiplier: s, curve: a }) => {
|
|
396
|
+
const c = Math.max(It(r, 0), 0), f = It(e, 0), b = f > 0 ? Math.min(c, f) / f : 1, I = Math.max(It(t, 0), 0), w = Math.max(It(n, 0), 0), V = Math.max(It(i, 0), 0), h = Math.max(I * w, 40), z = s ? h : 1200, G = Math.max(I * V, z), H = a ? Math.max(It(a.exponentialScale, V), 0) : 0, pe = a ? Math.min(G, Math.max(I * H, h)) : G, me = Math.max(pe, h);
|
|
397
397
|
let oe = b ** 1.1;
|
|
398
398
|
if (a) {
|
|
399
|
-
const he = Math.min(Math.max(
|
|
399
|
+
const he = Math.min(Math.max(It(a.exponentialSteepness, 0), 0), Lr);
|
|
400
400
|
if (he === 0)
|
|
401
401
|
oe = b;
|
|
402
402
|
else {
|
|
@@ -404,13 +404,13 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
404
404
|
oe = Math.min(Math.max(Math.expm1(he * b) / P, 0), 1);
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
|
-
const ce = Math.min(Math.max(
|
|
407
|
+
const ce = Math.min(Math.max(It(a?.easedOffset, 0), 0), 1);
|
|
408
408
|
return h + (me - h) * (ce + (1 - ce) * oe);
|
|
409
409
|
}, _r = (r) => {
|
|
410
410
|
if (!r || r <= 0)
|
|
411
|
-
return
|
|
412
|
-
const e = Math.max(1, r), t = Math.log10(e), n =
|
|
413
|
-
return le(n,
|
|
411
|
+
return Ut;
|
|
412
|
+
const e = Math.max(1, r), t = Math.log10(e), n = Ut + t * Er;
|
|
413
|
+
return le(n, Ut, Nr);
|
|
414
414
|
}, kr = ({
|
|
415
415
|
contentSize: r,
|
|
416
416
|
viewportSize: e,
|
|
@@ -422,11 +422,11 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
422
422
|
horizontal: c = !1,
|
|
423
423
|
scrollBarWidth: f = 12,
|
|
424
424
|
className: b,
|
|
425
|
-
ariaControls:
|
|
425
|
+
ariaControls: I,
|
|
426
426
|
tapScrollCircleOptions: w,
|
|
427
427
|
itemCount: V,
|
|
428
428
|
renderThumbOverlay: h,
|
|
429
|
-
visibleStartIndex:
|
|
429
|
+
visibleStartIndex: z,
|
|
430
430
|
visibleEndIndex: G
|
|
431
431
|
}) => {
|
|
432
432
|
const [H, pe] = rt(!1), [me, oe] = rt(!1), [ce, he] = rt(!1), P = g(null), _ = g({
|
|
@@ -436,12 +436,12 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
436
436
|
startClientY: 0,
|
|
437
437
|
scale: 1,
|
|
438
438
|
captureTarget: null
|
|
439
|
-
}), M = g({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 }), Z = g(t), Q = g(n),
|
|
439
|
+
}), M = g({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 }), Z = g(t), Q = g(n), U = g(ir), Se = g(null), C = g(null), v = g(null), W = g(0), ge = g(0), qe = Fe(() => Cr(w, V), [V, w]), ee = Fe(() => zr(c), [c]), {
|
|
440
440
|
enabled: X,
|
|
441
441
|
size: Xe,
|
|
442
442
|
offsetX: $e,
|
|
443
|
-
offsetY:
|
|
444
|
-
className:
|
|
443
|
+
offsetY: ze,
|
|
444
|
+
className: Ce,
|
|
445
445
|
maxVisualDistance: je,
|
|
446
446
|
maxSpeedMultiplier: Ge,
|
|
447
447
|
minSpeedMultiplier: K,
|
|
@@ -482,7 +482,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
482
482
|
}, [n]), q(() => {
|
|
483
483
|
i || oe(!1);
|
|
484
484
|
}, [i]);
|
|
485
|
-
const De = Dr({ isDragging: H, isThumbHovered: me, enableThumbDrag: i }), ne =
|
|
485
|
+
const De = Dr({ isDragging: H, isThumbHovered: me, enableThumbDrag: i }), ne = S((l, x) => {
|
|
486
486
|
const R = Te.current, D = x ?? Z.current;
|
|
487
487
|
if (Q.current) {
|
|
488
488
|
const Ee = Q.current(l, D);
|
|
@@ -491,7 +491,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
491
491
|
}
|
|
492
492
|
const $ = typeof l == "function" ? l(D) : l, ye = Math.max(R.maxScrollPosition, 0), Re = R.scrollBarVisible ? le($, 0, ye) : 0;
|
|
493
493
|
return Z.current = Re, Re;
|
|
494
|
-
}, []), Je =
|
|
494
|
+
}, []), Je = S(
|
|
495
495
|
(l) => {
|
|
496
496
|
const x = Te.current, R = Z.current;
|
|
497
497
|
if (!x.scrollBarVisible || x.maxScrollPosition <= 0) {
|
|
@@ -504,7 +504,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
504
504
|
return { nextPosition: $, actualDelta: ye, reachedBoundary: lt };
|
|
505
505
|
},
|
|
506
506
|
[ne]
|
|
507
|
-
), Oe =
|
|
507
|
+
), Oe = S(
|
|
508
508
|
(l, x) => {
|
|
509
509
|
l.current += x;
|
|
510
510
|
const R = Math.max(Te.current.maxScrollPosition, 0);
|
|
@@ -513,13 +513,13 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
513
513
|
return l.current -= D.actualDelta, D.reachedBoundary && (l.current = 0), D;
|
|
514
514
|
},
|
|
515
515
|
[Je]
|
|
516
|
-
), ae =
|
|
517
|
-
|
|
518
|
-
}, []), ve =
|
|
519
|
-
|
|
520
|
-
}, [ae]),
|
|
516
|
+
), ae = S(() => {
|
|
517
|
+
C.current !== null && (window.cancelAnimationFrame(C.current), C.current = null), v.current = null, W.current = 0, ge.current = 0;
|
|
518
|
+
}, []), ve = S(() => {
|
|
519
|
+
U.current = { ...ir }, he(!1), Se.current?.reset(), ae();
|
|
520
|
+
}, [ae]), Ue = S(
|
|
521
521
|
(l) => {
|
|
522
|
-
const x =
|
|
522
|
+
const x = U.current, R = Te.current;
|
|
523
523
|
if (!x.active || x.direction === 0) {
|
|
524
524
|
ae();
|
|
525
525
|
return;
|
|
@@ -530,7 +530,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
530
530
|
}
|
|
531
531
|
const D = v.current ?? l, $ = Math.max((l - D) / 1e3, 0), ye = Math.min($, Vr);
|
|
532
532
|
if (v.current = l, ye <= 0) {
|
|
533
|
-
|
|
533
|
+
C.current = window.requestAnimationFrame(Ue);
|
|
534
534
|
return;
|
|
535
535
|
}
|
|
536
536
|
const Re = Or({
|
|
@@ -542,27 +542,27 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
542
542
|
hasCustomMaxSpeedMultiplier: typeof R.tapScrollCircleOptions?.maxSpeedMultiplier == "number",
|
|
543
543
|
curve: R.tapCircleMaxSpeedCurve
|
|
544
544
|
});
|
|
545
|
-
ge.current !== x.direction && (ge.current = x.direction,
|
|
546
|
-
const { reachedBoundary: Ee } = Oe(
|
|
545
|
+
ge.current !== x.direction && (ge.current = x.direction, W.current = 0);
|
|
546
|
+
const { reachedBoundary: Ee } = Oe(W, x.direction * Re * ye);
|
|
547
547
|
if (Ee) {
|
|
548
548
|
ae();
|
|
549
549
|
return;
|
|
550
550
|
}
|
|
551
|
-
|
|
551
|
+
C.current = window.requestAnimationFrame(Ue);
|
|
552
552
|
},
|
|
553
553
|
[Oe, ae]
|
|
554
|
-
), Ve =
|
|
555
|
-
|
|
556
|
-
}, [
|
|
554
|
+
), Ve = S(() => {
|
|
555
|
+
C.current === null && (v.current = null, W.current = 0, C.current = window.requestAnimationFrame(Ue));
|
|
556
|
+
}, [Ue]);
|
|
557
557
|
q(() => {
|
|
558
|
-
const l =
|
|
558
|
+
const l = U.current;
|
|
559
559
|
!l.active || l.direction === 0 || Ve();
|
|
560
560
|
}, [r, e, Ve]), q(() => () => {
|
|
561
561
|
ae();
|
|
562
562
|
}, [ae]);
|
|
563
|
-
const ft =
|
|
563
|
+
const ft = S(
|
|
564
564
|
(l) => {
|
|
565
|
-
|
|
565
|
+
U.current = l, he(l.active), l.active && l.direction !== 0 ? Ve() : ae();
|
|
566
566
|
},
|
|
567
567
|
[Ve, ae]
|
|
568
568
|
);
|
|
@@ -571,23 +571,23 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
571
571
|
}, [ve, X]), q(() => {
|
|
572
572
|
const l = (x) => {
|
|
573
573
|
const D = x.detail?.paneId;
|
|
574
|
-
D &&
|
|
574
|
+
D && I && D !== I || ve();
|
|
575
575
|
};
|
|
576
576
|
return window.addEventListener(Gt, l), () => {
|
|
577
577
|
window.removeEventListener(Gt, l);
|
|
578
578
|
};
|
|
579
|
-
}, [
|
|
579
|
+
}, [I, ve]), q(() => {
|
|
580
580
|
if (!X)
|
|
581
581
|
return;
|
|
582
582
|
const l = (x) => {
|
|
583
|
-
if (!
|
|
583
|
+
if (!U.current.active || U.current.pointerId === x.pointerId)
|
|
584
584
|
return;
|
|
585
585
|
const R = x.target;
|
|
586
586
|
if (!(R instanceof Node)) {
|
|
587
587
|
ve();
|
|
588
588
|
return;
|
|
589
589
|
}
|
|
590
|
-
|
|
590
|
+
Se.current?.getElement()?.contains(R) || ve();
|
|
591
591
|
};
|
|
592
592
|
return document.addEventListener("pointerdown", l, !0), () => {
|
|
593
593
|
document.removeEventListener("pointerdown", l, !0);
|
|
@@ -598,13 +598,13 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
598
598
|
return 0;
|
|
599
599
|
const x = le(l, 0, Y);
|
|
600
600
|
return le(x / Y * B, 0, B);
|
|
601
|
-
}, ot =
|
|
601
|
+
}, ot = S((l) => {
|
|
602
602
|
const { scrollBarVisible: x, effectiveTrackLength: R, maxScrollPosition: D } = Te.current;
|
|
603
603
|
if (T.debug("[ScrollBar] calculateScrollPositionFromThumb", () => ({ thumbPos: l, trackLen: R, maxScroll: D })), R <= 0 || D <= 0)
|
|
604
604
|
return null;
|
|
605
605
|
const $ = le(l, 0, R);
|
|
606
606
|
return le($ / R * D, 0, D);
|
|
607
|
-
}, []), d =
|
|
607
|
+
}, []), d = S(
|
|
608
608
|
(l) => {
|
|
609
609
|
const x = l.getBoundingClientRect(), R = c ? x.width : x.height, D = (lt) => {
|
|
610
610
|
const Ye = Number.parseFloat(lt);
|
|
@@ -613,7 +613,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
613
613
|
return Ee <= 0 || R <= 0 ? 1 : R / Ee;
|
|
614
614
|
},
|
|
615
615
|
[c]
|
|
616
|
-
), y =
|
|
616
|
+
), y = S(
|
|
617
617
|
(l) => {
|
|
618
618
|
const x = _.current;
|
|
619
619
|
if (x.pointerId !== l.pointerId)
|
|
@@ -630,7 +630,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
630
630
|
ye !== null && ne(ye), l.cancelable && l.preventDefault();
|
|
631
631
|
},
|
|
632
632
|
[it, ot, ne]
|
|
633
|
-
), xe =
|
|
633
|
+
), xe = S(
|
|
634
634
|
(l) => {
|
|
635
635
|
const x = _.current;
|
|
636
636
|
if (x.pointerId !== l.pointerId)
|
|
@@ -648,7 +648,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
648
648
|
q(() => () => {
|
|
649
649
|
document.removeEventListener("pointermove", y), document.removeEventListener("pointerup", xe), document.removeEventListener("pointercancel", xe);
|
|
650
650
|
}, [y, xe]);
|
|
651
|
-
const tt = g(0), _e = g(0), ct =
|
|
651
|
+
const tt = g(0), _e = g(0), ct = S(
|
|
652
652
|
(l) => {
|
|
653
653
|
const x = Math.max(Math.round(Te.current.viewportSize / yr), Mr);
|
|
654
654
|
_e.current !== l && (_e.current = l, tt.current = 0), Oe(tt, l * x);
|
|
@@ -734,12 +734,12 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
734
734
|
}, bt = (l) => {
|
|
735
735
|
l.target === l.currentTarget && M.current.pointerId === l.pointerId && wt();
|
|
736
736
|
}, Lt = Fe(() => le((ce ? 1 : 0.8) * Ae, 0, 1), [ce, Ae]), Ot = Fe(() => {
|
|
737
|
-
const x = `calc(50% - ${Xe / 2}px + ${
|
|
737
|
+
const x = `calc(50% - ${Xe / 2}px + ${ze}px)`;
|
|
738
738
|
return {
|
|
739
739
|
left: $e,
|
|
740
740
|
top: x
|
|
741
741
|
};
|
|
742
|
-
}, [$e,
|
|
742
|
+
}, [$e, ze, Xe]), We = (l, x, R, D) => /* @__PURE__ */ de(
|
|
743
743
|
"button",
|
|
744
744
|
{
|
|
745
745
|
type: "button",
|
|
@@ -772,7 +772,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
772
772
|
trackSize: ie,
|
|
773
773
|
isDragging: H,
|
|
774
774
|
isTapScrollActive: ce,
|
|
775
|
-
visibleStartIndex:
|
|
775
|
+
visibleStartIndex: z,
|
|
776
776
|
visibleEndIndex: G
|
|
777
777
|
} : null;
|
|
778
778
|
return /* @__PURE__ */ Mt(
|
|
@@ -786,7 +786,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
786
786
|
"data-visible": j ? "true" : "false",
|
|
787
787
|
role: "scrollbar",
|
|
788
788
|
tabIndex: -1,
|
|
789
|
-
"aria-controls":
|
|
789
|
+
"aria-controls": I,
|
|
790
790
|
"aria-valuenow": t,
|
|
791
791
|
"aria-valuemin": 0,
|
|
792
792
|
"aria-valuemax": B,
|
|
@@ -795,8 +795,8 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
795
795
|
!c && j && X && /* @__PURE__ */ de(
|
|
796
796
|
fr,
|
|
797
797
|
{
|
|
798
|
-
ref:
|
|
799
|
-
className: Et("aqvs-scrollbar-tap-circle-wrapper",
|
|
798
|
+
ref: Se,
|
|
799
|
+
className: Et("aqvs-scrollbar-tap-circle-wrapper", Ce),
|
|
800
800
|
size: Xe,
|
|
801
801
|
maxVisualDistance: Le,
|
|
802
802
|
style: Ot,
|
|
@@ -806,7 +806,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
806
806
|
},
|
|
807
807
|
"tap-circle"
|
|
808
808
|
),
|
|
809
|
-
|
|
809
|
+
We(-1, E[0], J[0], "arrow-start"),
|
|
810
810
|
/* @__PURE__ */ Mt(
|
|
811
811
|
"div",
|
|
812
812
|
{
|
|
@@ -867,7 +867,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
867
867
|
},
|
|
868
868
|
"track"
|
|
869
869
|
),
|
|
870
|
-
|
|
870
|
+
We(1, E[1], J[1], "arrow-end")
|
|
871
871
|
]
|
|
872
872
|
}
|
|
873
873
|
);
|
|
@@ -885,7 +885,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
885
885
|
};
|
|
886
886
|
}, mr = /* @__PURE__ */ new WeakSet(), or = (r) => {
|
|
887
887
|
mr.add(r);
|
|
888
|
-
}, Br = (r) => mr.has(r), Hr = ["mouse", "pen", "touch"],
|
|
888
|
+
}, Br = (r) => mr.has(r), Hr = ["mouse", "pen", "touch"], Wt = (r, e) => !(r === "mouse" || r === "pen" || r === "touch") || e.includes(r), qr = (r) => r === "mouse" || r === "pen", Ct = {
|
|
889
889
|
maxVelocity: 6,
|
|
890
890
|
minVelocity: 0.02,
|
|
891
891
|
deceleration: 25e-4,
|
|
@@ -906,11 +906,11 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
906
906
|
enableArrowButtons: c = !0,
|
|
907
907
|
enablePointerDrag: f = !0,
|
|
908
908
|
pointerDragInputs: b = Hr,
|
|
909
|
-
onScroll:
|
|
909
|
+
onScroll: I,
|
|
910
910
|
className: w,
|
|
911
911
|
testId: V,
|
|
912
912
|
style: h,
|
|
913
|
-
background:
|
|
913
|
+
background: z,
|
|
914
914
|
tapScrollCircleOptions: G,
|
|
915
915
|
inertiaOptions: H,
|
|
916
916
|
itemCount: pe,
|
|
@@ -923,13 +923,13 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
923
923
|
visibleEndIndex: M,
|
|
924
924
|
renderOverlay: Z,
|
|
925
925
|
initialScrollPosition: Q = 0,
|
|
926
|
-
contentProps:
|
|
927
|
-
},
|
|
928
|
-
const
|
|
926
|
+
contentProps: U
|
|
927
|
+
}, Se) => {
|
|
928
|
+
const C = g(Number.isFinite(Q) ? Math.max(0, Q) : 0), v = g(null), W = g(null), ge = t === void 0, [qe, ee] = rt(0), X = t ?? qe, Xe = g(null);
|
|
929
929
|
nt(() => {
|
|
930
930
|
if (!ge)
|
|
931
931
|
return;
|
|
932
|
-
const p =
|
|
932
|
+
const p = W.current;
|
|
933
933
|
if (!p)
|
|
934
934
|
return;
|
|
935
935
|
const F = () => {
|
|
@@ -974,18 +974,18 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
974
974
|
q(() => {
|
|
975
975
|
$e.current = he;
|
|
976
976
|
}, [he]);
|
|
977
|
-
const
|
|
977
|
+
const ze = g({
|
|
978
978
|
frame: null,
|
|
979
979
|
velocity: 0,
|
|
980
980
|
lastTimestamp: null,
|
|
981
981
|
generation: 0
|
|
982
|
-
}),
|
|
982
|
+
}), Ce = Fe(
|
|
983
983
|
() => ({
|
|
984
|
-
maxVelocity: H?.maxVelocity ??
|
|
985
|
-
minVelocity: H?.minVelocity ??
|
|
986
|
-
deceleration: H?.deceleration ??
|
|
987
|
-
velocitySampleWindow: H?.velocitySampleWindow ??
|
|
988
|
-
startVelocityThreshold: H?.startVelocityThreshold ??
|
|
984
|
+
maxVelocity: H?.maxVelocity ?? Ct.maxVelocity,
|
|
985
|
+
minVelocity: H?.minVelocity ?? Ct.minVelocity,
|
|
986
|
+
deceleration: H?.deceleration ?? Ct.deceleration,
|
|
987
|
+
velocitySampleWindow: H?.velocitySampleWindow ?? Ct.velocitySampleWindow,
|
|
988
|
+
startVelocityThreshold: H?.startVelocityThreshold ?? Ct.startVelocityThreshold
|
|
989
989
|
}),
|
|
990
990
|
[H]
|
|
991
991
|
), je = Fe(() => ({
|
|
@@ -1003,26 +1003,26 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
1003
1003
|
enablePointerDrag: f,
|
|
1004
1004
|
contentInsets: je
|
|
1005
1005
|
}));
|
|
1006
|
-
const Ge = g({ contentSize: e, viewportSize: X }), K = Fe(() => e > X, [e, X]), Ae =
|
|
1006
|
+
const Ge = g({ contentSize: e, viewportSize: X }), K = Fe(() => e > X, [e, X]), Ae = S(
|
|
1007
1007
|
(p, F) => {
|
|
1008
1008
|
let B = F ?? Ge.current;
|
|
1009
1009
|
F && !(Number.isFinite(F.contentSize) && Number.isFinite(F.viewportSize)) && (T.warn("[ScrollPane] scrollTo received non-finite dimsOverride; falling back to the committed dims", { dimsOverride: F }), B = Ge.current);
|
|
1010
|
-
const { contentSize: Y, viewportSize: te } = B, Me = Y > te, j =
|
|
1010
|
+
const { contentSize: Y, viewportSize: te } = B, Me = Y > te, j = C.current;
|
|
1011
1011
|
if (T.debug("[ScrollPane] scrollTo called", () => ({ newPosition: p, contentSize: Y, viewportSize: te, currentIsScrollable: Me, prevPosition: j })), !Me)
|
|
1012
|
-
return
|
|
1013
|
-
const re = typeof p == "function" ? p(
|
|
1012
|
+
return C.current !== 0 && (C.current = 0, I?.(0, j)), C.current;
|
|
1013
|
+
const re = typeof p == "function" ? p(C.current) : p;
|
|
1014
1014
|
if (!Number.isFinite(re))
|
|
1015
|
-
return T.warn("[ScrollPane] scrollTo received a non-finite position; keeping the current position", { nextPosition: re }),
|
|
1015
|
+
return T.warn("[ScrollPane] scrollTo received a non-finite position; keeping the current position", { nextPosition: re }), C.current;
|
|
1016
1016
|
const De = Math.max(Y - te, 0), ne = le(re, 0, De);
|
|
1017
|
-
return
|
|
1017
|
+
return C.current !== ne && (C.current = ne, I?.(ne, j)), C.current;
|
|
1018
1018
|
},
|
|
1019
|
-
[
|
|
1019
|
+
[I]
|
|
1020
1020
|
), ue = g(Ae);
|
|
1021
1021
|
q(() => {
|
|
1022
1022
|
ue.current = Ae;
|
|
1023
1023
|
}, [Ae]);
|
|
1024
|
-
const be =
|
|
1025
|
-
const p =
|
|
1024
|
+
const be = S(() => {
|
|
1025
|
+
const p = ze.current;
|
|
1026
1026
|
p.generation += 1, p.frame !== null && cancelAnimationFrame(p.frame), p.frame = null, p.velocity = 0, p.lastTimestamp = null;
|
|
1027
1027
|
}, []), Te = g(be);
|
|
1028
1028
|
q(() => {
|
|
@@ -1030,16 +1030,16 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
1030
1030
|
}, [be]), q(() => () => {
|
|
1031
1031
|
Te.current();
|
|
1032
1032
|
}, []);
|
|
1033
|
-
const et =
|
|
1033
|
+
const et = S(
|
|
1034
1034
|
(p) => {
|
|
1035
1035
|
if (!K)
|
|
1036
1036
|
return;
|
|
1037
|
-
const { maxVelocity: F, minVelocity: B, deceleration: Y, startVelocityThreshold: te } =
|
|
1037
|
+
const { maxVelocity: F, minVelocity: B, deceleration: Y, startVelocityThreshold: te } = Ce, Me = le(p, -F, F);
|
|
1038
1038
|
if (Math.abs(Me) < te)
|
|
1039
1039
|
return;
|
|
1040
|
-
be(),
|
|
1041
|
-
const j =
|
|
1042
|
-
const ne =
|
|
1040
|
+
be(), ze.current.velocity = Me, ze.current.lastTimestamp = null;
|
|
1041
|
+
const j = ze.current.generation, re = (De) => {
|
|
1042
|
+
const ne = ze.current;
|
|
1043
1043
|
if (ne.generation !== j)
|
|
1044
1044
|
return;
|
|
1045
1045
|
if (ne.lastTimestamp === null) {
|
|
@@ -1055,10 +1055,10 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
1055
1055
|
let ae = Oe;
|
|
1056
1056
|
const ve = Y * Je;
|
|
1057
1057
|
Oe > 0 ? ae = Math.max(0, Oe - ve) : Oe < 0 && (ae = Math.min(0, Oe + ve));
|
|
1058
|
-
const Ve = (Oe + ae) / 2 * Je, ft =
|
|
1059
|
-
if (Ve !== 0 && ue.current((tt) => tt + Ve),
|
|
1058
|
+
const Ve = (Oe + ae) / 2 * Je, ft = C.current;
|
|
1059
|
+
if (Ve !== 0 && ue.current((tt) => tt + Ve), ze.current.generation !== j)
|
|
1060
1060
|
return;
|
|
1061
|
-
const Qe =
|
|
1061
|
+
const Qe = C.current, { contentSize: ot, viewportSize: d } = Ge.current, y = Math.max(ot - d, 0);
|
|
1062
1062
|
ne.velocity = ae;
|
|
1063
1063
|
const xe = Qe === ft || Qe <= 0 && ae <= 0 || Qe >= y && ae >= 0;
|
|
1064
1064
|
if (Math.abs(ae) < B || xe) {
|
|
@@ -1067,16 +1067,16 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
1067
1067
|
}
|
|
1068
1068
|
ne.frame = requestAnimationFrame(re);
|
|
1069
1069
|
};
|
|
1070
|
-
|
|
1070
|
+
ze.current.frame = requestAnimationFrame(re);
|
|
1071
1071
|
},
|
|
1072
|
-
[K,
|
|
1072
|
+
[K, Ce, be]
|
|
1073
1073
|
), mt = g(et);
|
|
1074
1074
|
q(() => {
|
|
1075
1075
|
mt.current = et;
|
|
1076
1076
|
}, [et]), nt(() => {
|
|
1077
1077
|
Ge.current = { contentSize: e, viewportSize: X };
|
|
1078
1078
|
}, [e, X]), nt(() => {
|
|
1079
|
-
const p =
|
|
1079
|
+
const p = W.current;
|
|
1080
1080
|
if (!p) return;
|
|
1081
1081
|
const F = () => {
|
|
1082
1082
|
p.scrollTop !== 0 && (T.debug("[ScrollPane] Native scroll detected, resetting to 0", () => ({ scrollTop: p.scrollTop })), p.scrollTop = 0), p.scrollLeft !== 0 && (p.scrollLeft = 0);
|
|
@@ -1084,9 +1084,9 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
1084
1084
|
return p.addEventListener("scroll", F), () => p.removeEventListener("scroll", F);
|
|
1085
1085
|
}, []), nt(() => {
|
|
1086
1086
|
if (K) {
|
|
1087
|
-
T.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", () => ({ contentSize: e, viewportSize: X, scrollPosition:
|
|
1087
|
+
T.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", () => ({ contentSize: e, viewportSize: X, scrollPosition: C.current }));
|
|
1088
1088
|
const p = le(e - X, 0, e);
|
|
1089
|
-
|
|
1089
|
+
C.current > p && Ae(p);
|
|
1090
1090
|
} else
|
|
1091
1091
|
Ae(0);
|
|
1092
1092
|
}, [K, Ae, e, X]);
|
|
@@ -1094,7 +1094,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
1094
1094
|
nt(() => {
|
|
1095
1095
|
N.current = { isScrollable: K, viewportSize: X, wheelSpeedMultiplier: oe, overscrollBehavior: ce };
|
|
1096
1096
|
}, [K, X, oe, ce]);
|
|
1097
|
-
const it =
|
|
1097
|
+
const it = S(
|
|
1098
1098
|
(p) => {
|
|
1099
1099
|
if (Br(p))
|
|
1100
1100
|
return !1;
|
|
@@ -1107,11 +1107,11 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
1107
1107
|
return !1;
|
|
1108
1108
|
let j = Me.verticalDelta;
|
|
1109
1109
|
if (Y !== 1 && (j *= Y), te !== "contain") {
|
|
1110
|
-
const re =
|
|
1110
|
+
const re = C.current, De = Math.max(Ge.current.contentSize - B, 0);
|
|
1111
1111
|
if (j > 0 && re >= De || j < 0 && re <= 0)
|
|
1112
1112
|
return !1;
|
|
1113
1113
|
}
|
|
1114
|
-
return or(p), p.preventDefault(), be(), T.debug("[ScrollPane] wheel event", () => ({ deltaY: j, scrollPosition:
|
|
1114
|
+
return or(p), p.preventDefault(), be(), T.debug("[ScrollPane] wheel event", () => ({ deltaY: j, scrollPosition: C.current, wheelSpeedMultiplier: Y, deltaMode: p.deltaMode, scrollTop: W.current?.scrollTop })), Ae((re) => re + j), !0;
|
|
1115
1115
|
},
|
|
1116
1116
|
[Ae, be]
|
|
1117
1117
|
);
|
|
@@ -1125,17 +1125,17 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
1125
1125
|
B && (B.removeEventListener("wheel", p), B.removeEventListener("pointerdown", F, { capture: !0 }));
|
|
1126
1126
|
};
|
|
1127
1127
|
}, [it, be]), Jt(
|
|
1128
|
-
|
|
1128
|
+
Se,
|
|
1129
1129
|
() => ({
|
|
1130
1130
|
scrollTo: (p, F) => (be(), Ae(p, F)),
|
|
1131
|
-
getScrollPosition: () =>
|
|
1131
|
+
getScrollPosition: () => C.current,
|
|
1132
1132
|
getContentSize: () => e,
|
|
1133
1133
|
getViewportSize: () => X,
|
|
1134
1134
|
applyWheel: it
|
|
1135
1135
|
}),
|
|
1136
1136
|
[Ae, e, X, be, it]
|
|
1137
1137
|
);
|
|
1138
|
-
const vt =
|
|
1138
|
+
const vt = Sr(), E = U?.id ?? vt, J = g({
|
|
1139
1139
|
pointerType: "",
|
|
1140
1140
|
pointerId: null,
|
|
1141
1141
|
startClientY: 0,
|
|
@@ -1154,19 +1154,19 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
1154
1154
|
q(() => {
|
|
1155
1155
|
Le.current = K;
|
|
1156
1156
|
}, [K]);
|
|
1157
|
-
const st = g(
|
|
1157
|
+
const st = g(Ce);
|
|
1158
1158
|
q(() => {
|
|
1159
|
-
st.current =
|
|
1160
|
-
}, [
|
|
1159
|
+
st.current = Ce;
|
|
1160
|
+
}, [Ce]), q(() => {
|
|
1161
1161
|
const p = J.current;
|
|
1162
|
-
if (f && K && (p.pointerId === null ||
|
|
1162
|
+
if (f && K && (p.pointerId === null || Wt(p.pointerType, b)) || p.pointerId === null)
|
|
1163
1163
|
return;
|
|
1164
|
-
const F =
|
|
1164
|
+
const F = W.current;
|
|
1165
1165
|
p.clickResetTimer !== null && (window.clearTimeout(p.clickResetTimer), p.clickResetTimer = null);
|
|
1166
1166
|
const B = p.isDragging && p.shouldCancelNextClick, Y = p.pointerId;
|
|
1167
1167
|
p.pointerId = null, p.pointerType = "", p.startClientY = 0, p.startScroll = 0, p.isDragging = !1, p.shouldCancelNextClick = B, p.velocitySamples = [], F?.hasPointerCapture(Y) && F.releasePointerCapture(Y);
|
|
1168
1168
|
}, [f, b, K]), q(() => {
|
|
1169
|
-
const p =
|
|
1169
|
+
const p = W.current;
|
|
1170
1170
|
if (!p)
|
|
1171
1171
|
return;
|
|
1172
1172
|
const F = 6, B = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), Y = () => {
|
|
@@ -1204,7 +1204,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
1204
1204
|
Je(d.pointerId);
|
|
1205
1205
|
return;
|
|
1206
1206
|
}
|
|
1207
|
-
if (!(Ze.current && Le.current) || !
|
|
1207
|
+
if (!(Ze.current && Le.current) || !Wt(d.pointerType, ht.current) || !y.isDragging && (Math.abs(d.clientY - y.startClientY) < F || (De(d), !y.isDragging)))
|
|
1208
1208
|
return;
|
|
1209
1209
|
Me(d.clientY);
|
|
1210
1210
|
const xe = d.clientY - y.startClientY, tt = y.startScroll - xe;
|
|
@@ -1236,17 +1236,17 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
1236
1236
|
}, 0));
|
|
1237
1237
|
const tt = st.current.startVelocityThreshold;
|
|
1238
1238
|
Y(), p.hasPointerCapture(d.pointerId) && p.releasePointerCapture(d.pointerId), Math.abs(xe) >= tt && mt.current?.(xe);
|
|
1239
|
-
},
|
|
1239
|
+
}, Ue = (d) => {
|
|
1240
1240
|
if (J.current.pointerId !== null) {
|
|
1241
1241
|
if (!d.isPrimary || d.pointerType !== J.current.pointerType)
|
|
1242
1242
|
return;
|
|
1243
1243
|
Je(J.current.pointerId);
|
|
1244
1244
|
}
|
|
1245
|
-
if (J.current.shouldCancelNextClick && (te(), J.current.shouldCancelNextClick = !1), !(Ze.current && Le.current) || !
|
|
1245
|
+
if (J.current.shouldCancelNextClick && (te(), J.current.shouldCancelNextClick = !1), !(Ze.current && Le.current) || !Wt(d.pointerType, ht.current) || d.button !== 0 && d.pointerType === "mouse" || d.ctrlKey || d.metaKey || d.altKey || j(d.target))
|
|
1246
1246
|
return;
|
|
1247
1247
|
window.dispatchEvent(new CustomEvent(Gt, { detail: { paneId: vt } })), Te.current?.();
|
|
1248
1248
|
const y = J.current;
|
|
1249
|
-
te(), y.pointerId = d.pointerId, y.pointerType = d.pointerType, y.startClientY = d.clientY, y.startScroll =
|
|
1249
|
+
te(), y.pointerId = d.pointerId, y.pointerType = d.pointerType, y.startClientY = d.clientY, y.startScroll = C.current, y.isDragging = !1, y.shouldCancelNextClick = !1, y.velocitySamples = [];
|
|
1250
1250
|
}, Ve = (d) => {
|
|
1251
1251
|
if (J.current.pointerId !== d.pointerId) {
|
|
1252
1252
|
ae();
|
|
@@ -1255,7 +1255,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
1255
1255
|
ne(d) && Je(d.pointerId);
|
|
1256
1256
|
}, Qe = [
|
|
1257
1257
|
["click", re, !0],
|
|
1258
|
-
["pointerdown",
|
|
1258
|
+
["pointerdown", Ue, { passive: !1 }],
|
|
1259
1259
|
["lostpointercapture", (d) => {
|
|
1260
1260
|
d.target !== p || J.current.pointerId !== d.pointerId || Je(d.pointerId);
|
|
1261
1261
|
}, void 0]
|
|
@@ -1270,7 +1270,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
1270
1270
|
d.pointerId !== null && p.hasPointerCapture(d.pointerId) && p.releasePointerCapture(d.pointerId), te(), Y();
|
|
1271
1271
|
};
|
|
1272
1272
|
}, [vt]);
|
|
1273
|
-
const ie =
|
|
1273
|
+
const ie = S(
|
|
1274
1274
|
(p) => (be(), Ae(p)),
|
|
1275
1275
|
[Ae, be]
|
|
1276
1276
|
);
|
|
@@ -1278,7 +1278,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
1278
1278
|
/* @__PURE__ */ Mt(
|
|
1279
1279
|
"div",
|
|
1280
1280
|
{
|
|
1281
|
-
ref:
|
|
1281
|
+
ref: W,
|
|
1282
1282
|
className: Et("aqvs-scroll-pane-content"),
|
|
1283
1283
|
"data-testid": "aqvs-scroll-pane-content",
|
|
1284
1284
|
style: {
|
|
@@ -1304,11 +1304,11 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
1304
1304
|
// (空のペインがページのパンを殺すデッドゾーンになり、そちらの実害の方が大きいため)。
|
|
1305
1305
|
...f && K && b.some((p) => p === "touch" || p === "pen") ? { touchAction: "none" } : {}
|
|
1306
1306
|
},
|
|
1307
|
-
...
|
|
1307
|
+
...U,
|
|
1308
1308
|
id: E,
|
|
1309
1309
|
children: [
|
|
1310
|
-
|
|
1311
|
-
r(
|
|
1310
|
+
z,
|
|
1311
|
+
r(C.current)
|
|
1312
1312
|
]
|
|
1313
1313
|
}
|
|
1314
1314
|
),
|
|
@@ -1317,7 +1317,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
1317
1317
|
{
|
|
1318
1318
|
contentSize: e,
|
|
1319
1319
|
viewportSize: X,
|
|
1320
|
-
scrollPosition:
|
|
1320
|
+
scrollPosition: C.current,
|
|
1321
1321
|
onScroll: ie,
|
|
1322
1322
|
enableThumbDrag: s,
|
|
1323
1323
|
enableTrackClick: a,
|
|
@@ -1335,8 +1335,8 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
1335
1335
|
Z?.()
|
|
1336
1336
|
] });
|
|
1337
1337
|
}
|
|
1338
|
-
), ar = (r, e, t) => Math.min(Math.max(r, e), t),
|
|
1339
|
-
const i = Math.max(n / 2, 1), s = 1 + e * 0.65, a = Math.max(0.65, 1 - e * 0.25), c = r.direction * e * 26 * t, f = 0.8 + e * 0.18, b = 3 * t,
|
|
1338
|
+
), ar = (r, e, t) => Math.min(Math.max(r, e), t), an = ({ dragState: r, normalizedDistance: e, sizeScale: t, size: n }) => {
|
|
1339
|
+
const i = Math.max(n / 2, 1), s = 1 + e * 0.65, a = Math.max(0.65, 1 - e * 0.25), c = r.direction * e * 26 * t, f = 0.8 + e * 0.18, b = 3 * t, I = 6 * t, w = 22 * t, V = Math.abs(c) + I, h = c > 0 ? b : -Math.abs(c) - b, z = Math.max(2.5, 3 * t), G = ar(r.offsetX, -i, i), H = ar(r.offsetY, -i, i), pe = i * 0.35, me = G / i * pe, oe = H / i * pe, ce = me * 0.45, he = oe * 0.45, P = Math.max(w * 0.38, 6), _ = 0.65 + e * 0.2, M = r.active;
|
|
1340
1340
|
return /* @__PURE__ */ Mt(dr, { children: [
|
|
1341
1341
|
/* @__PURE__ */ de(
|
|
1342
1342
|
"div",
|
|
@@ -1379,7 +1379,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
1379
1379
|
{
|
|
1380
1380
|
className: "aqvs-sample-visual-rod",
|
|
1381
1381
|
style: {
|
|
1382
|
-
width:
|
|
1382
|
+
width: z,
|
|
1383
1383
|
height: V,
|
|
1384
1384
|
transform: `translate(-50%, ${h}px)`,
|
|
1385
1385
|
opacity: e,
|
|
@@ -1406,7 +1406,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
1406
1406
|
const t = BigInt(e) & -BigInt(e);
|
|
1407
1407
|
return Number(t);
|
|
1408
1408
|
};
|
|
1409
|
-
class
|
|
1409
|
+
class St {
|
|
1410
1410
|
/**
|
|
1411
1411
|
* @private
|
|
1412
1412
|
* @property {Map<number, number>} tree - The Map storing the Fenwick tree structure, specifically the sums of deltas. It is 1-indexed.
|
|
@@ -1478,10 +1478,10 @@ class It {
|
|
|
1478
1478
|
};
|
|
1479
1479
|
let f = Math.max(0, Math.trunc(c.from)), b = Math.min(Math.trunc(c.to), i - 1);
|
|
1480
1480
|
if (f > b && (f = 0, b = Math.min(Ft - 1, i - 1)), i > Ft)
|
|
1481
|
-
s =
|
|
1481
|
+
s = St._sampleBaseValueStrided(t, i, Ft), n?.materialize && (a = { from: f, values: St._collectValidatedValues(t, f, b) });
|
|
1482
1482
|
else {
|
|
1483
|
-
const
|
|
1484
|
-
s =
|
|
1483
|
+
const I = St._collectValidatedValues(t, f, b);
|
|
1484
|
+
s = St._modeOrMedian([...I]), n?.materialize && (a = { from: f, values: I });
|
|
1485
1485
|
}
|
|
1486
1486
|
}
|
|
1487
1487
|
if (this.size = i, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.total = void 0, this.valueFn = t, this.baseValue = s, a)
|
|
@@ -1572,7 +1572,7 @@ class It {
|
|
|
1572
1572
|
const s = [];
|
|
1573
1573
|
for (let a = 0; a < t && s.length < n; a += i)
|
|
1574
1574
|
s.push(Kt(e(a), a));
|
|
1575
|
-
return
|
|
1575
|
+
return St._modeOrMedian(s);
|
|
1576
1576
|
}
|
|
1577
1577
|
/**
|
|
1578
1578
|
* @method update
|
|
@@ -1728,8 +1728,8 @@ class It {
|
|
|
1728
1728
|
if (i && i.length > 0) {
|
|
1729
1729
|
for (const c of i) {
|
|
1730
1730
|
const f = Math.max(0, Math.trunc(c.from)), b = Math.min(Math.trunc(c.to), this.size - 1);
|
|
1731
|
-
for (let
|
|
1732
|
-
this._materialize(
|
|
1731
|
+
for (let I = f; I <= b; I++)
|
|
1732
|
+
this._materialize(I);
|
|
1733
1733
|
}
|
|
1734
1734
|
if (t === void 0)
|
|
1735
1735
|
return;
|
|
@@ -1815,10 +1815,10 @@ class It {
|
|
|
1815
1815
|
this._materializeRanges(t.materializeOption);
|
|
1816
1816
|
const s = t.materializeOption?.materialize === !0;
|
|
1817
1817
|
for (; ; ) {
|
|
1818
|
-
let a = 0n, c = i - 1n, f, b,
|
|
1818
|
+
let a = 0n, c = i - 1n, f, b, I = this.total;
|
|
1819
1819
|
for (; a <= c; ) {
|
|
1820
|
-
const h = a + c >> 1n,
|
|
1821
|
-
if (
|
|
1820
|
+
const h = a + c >> 1n, z = Number(h), G = this.prefixSum(z);
|
|
1821
|
+
if (I = G.total, n ? G.cumulative >= e : G.cumulative <= e)
|
|
1822
1822
|
if (f = h, b = G, n) {
|
|
1823
1823
|
if (h === 0n)
|
|
1824
1824
|
break;
|
|
@@ -1841,7 +1841,7 @@ class It {
|
|
|
1841
1841
|
}
|
|
1842
1842
|
return {
|
|
1843
1843
|
index: V,
|
|
1844
|
-
total:
|
|
1844
|
+
total: I,
|
|
1845
1845
|
cumulative: w?.cumulative,
|
|
1846
1846
|
currentValue: w?.currentValue,
|
|
1847
1847
|
safeIndex: w?.safeIndex
|
|
@@ -2070,7 +2070,7 @@ class It {
|
|
|
2070
2070
|
*/
|
|
2071
2071
|
_growSize(e, t) {
|
|
2072
2072
|
if (this.size = t, this.deltas.size > 0) {
|
|
2073
|
-
const n =
|
|
2073
|
+
const n = St._minCoveredLowBound(e, t);
|
|
2074
2074
|
if (e - n < this.deltas.size)
|
|
2075
2075
|
for (let s = n; s < e; s++) {
|
|
2076
2076
|
const a = this.deltas.get(s);
|
|
@@ -2148,16 +2148,16 @@ class It {
|
|
|
2148
2148
|
return this._findIndex(e, t ?? {}, !1);
|
|
2149
2149
|
}
|
|
2150
2150
|
}
|
|
2151
|
-
const
|
|
2151
|
+
const Ur = (r, e) => {
|
|
2152
2152
|
const t = r?.sampleRange, n = e?.sampleRange;
|
|
2153
2153
|
return t === n ? !1 : t && n ? t.from !== n.from || t.to !== n.to : !0;
|
|
2154
|
-
},
|
|
2154
|
+
}, Wr = (r, e, t) => {
|
|
2155
2155
|
const n = Number.isFinite(r) && r > 0 ? Math.trunc(r) : 0, i = g(null), s = g({ size: n, valueOrFn: e, options: t });
|
|
2156
|
-
i.current === null && (i.current = new
|
|
2157
|
-
const a = i.current, c = s.current, f = c.size !== n, b = c.valueOrFn !== e,
|
|
2158
|
-
if (b ||
|
|
2156
|
+
i.current === null && (i.current = new St(n, e, t));
|
|
2157
|
+
const a = i.current, c = s.current, f = c.size !== n, b = c.valueOrFn !== e, I = Ur(c.options, t), w = c.size === 0 && n > 0 && (!i.current || i.current.base === 0);
|
|
2158
|
+
if (b || I) {
|
|
2159
2159
|
const V = t?.resetOnValueFnChange ?? !0;
|
|
2160
|
-
|
|
2160
|
+
I || b && V || w ? (t?.debug && T.debug("[useFenwickMapTree] reset", { valueOrFnChanged: b, optionsChanged: I }), a.reset(n, e, t)) : (f && (t?.debug && T.debug("[useFenwickMapTree] resize (with valueFn change)", { from: c.size, to: n }), a.changeSize(n)), t?.debug && T.debug("[useFenwickMapTree] setValueFn (no reset)", { valueOrFnChanged: b }), a.setValueFn(e, { reset: !1 })), s.current = { size: n, valueOrFn: e, options: t };
|
|
2161
2161
|
} else f && (t?.debug && T.debug("[useFenwickMapTree] resize", { from: c.size, to: n }), w ? a.reset(n, e, t) : a.changeSize(n), s.current = { size: n, valueOrFn: e, options: t });
|
|
2162
2162
|
return a;
|
|
2163
2163
|
};
|
|
@@ -2220,49 +2220,49 @@ function jr(r) {
|
|
|
2220
2220
|
}
|
|
2221
2221
|
if (Number.isFinite(n))
|
|
2222
2222
|
for (; e.current.size > n; ) {
|
|
2223
|
-
const
|
|
2224
|
-
if (
|
|
2225
|
-
e.current.delete(
|
|
2223
|
+
const I = t.current.removeHead();
|
|
2224
|
+
if (I)
|
|
2225
|
+
e.current.delete(I.key);
|
|
2226
2226
|
else
|
|
2227
2227
|
break;
|
|
2228
2228
|
}
|
|
2229
2229
|
}, [r, n]);
|
|
2230
|
-
const s =
|
|
2231
|
-
const w = e.current.get(
|
|
2230
|
+
const s = S((I) => {
|
|
2231
|
+
const w = e.current.get(I);
|
|
2232
2232
|
if (w)
|
|
2233
2233
|
return t.current.moveToTail(w), w.value;
|
|
2234
|
-
}, []), a =
|
|
2234
|
+
}, []), a = S((I, w) => {
|
|
2235
2235
|
const V = i.current;
|
|
2236
2236
|
if (Number.isNaN(V) || V <= 0)
|
|
2237
2237
|
return;
|
|
2238
|
-
let h = e.current.get(
|
|
2238
|
+
let h = e.current.get(I);
|
|
2239
2239
|
if (h)
|
|
2240
2240
|
h.value = w, t.current.moveToTail(h);
|
|
2241
2241
|
else {
|
|
2242
2242
|
if (e.current.size >= V) {
|
|
2243
|
-
const
|
|
2244
|
-
|
|
2243
|
+
const z = t.current.removeHead();
|
|
2244
|
+
z && e.current.delete(z.key);
|
|
2245
2245
|
}
|
|
2246
|
-
h = new Kr(
|
|
2246
|
+
h = new Kr(I, w), e.current.set(I, h), t.current.addToTail(h);
|
|
2247
2247
|
}
|
|
2248
|
-
}, []), c =
|
|
2249
|
-
const w = e.current.get(
|
|
2250
|
-
w && (t.current.remove(w), e.current.delete(
|
|
2251
|
-
}, []), b =
|
|
2248
|
+
}, []), c = S((I) => e.current.has(I), []), f = S((I) => {
|
|
2249
|
+
const w = e.current.get(I);
|
|
2250
|
+
w && (t.current.remove(w), e.current.delete(I));
|
|
2251
|
+
}, []), b = S(() => {
|
|
2252
2252
|
e.current.clear(), t.current = new jt();
|
|
2253
2253
|
}, []);
|
|
2254
2254
|
return Fe(() => ({ get: s, set: a, has: c, remove: f, clear: b }), [s, a, c, f, b]);
|
|
2255
2255
|
}
|
|
2256
|
-
const Gr = 1e4,
|
|
2256
|
+
const Gr = 1e4, ln = () => {
|
|
2257
2257
|
const { get: r, set: e, has: t, clear: n } = jr(Gr);
|
|
2258
2258
|
return Fe(() => ({ get: r, set: e, has: t, clear: n }), [r, e, t, n]);
|
|
2259
|
-
},
|
|
2259
|
+
}, cn = (r, e) => {
|
|
2260
2260
|
const t = g(e), n = g(r);
|
|
2261
2261
|
nt(() => {
|
|
2262
2262
|
t.current = e, n.current = r;
|
|
2263
2263
|
}, [e, r]);
|
|
2264
2264
|
const i = g(/* @__PURE__ */ new WeakMap());
|
|
2265
|
-
return
|
|
2265
|
+
return S((s) => {
|
|
2266
2266
|
if (!s || i.current.has(s))
|
|
2267
2267
|
return;
|
|
2268
2268
|
const a = (c) => {
|
|
@@ -2275,26 +2275,18 @@ const Gr = 1e4, cn = () => {
|
|
|
2275
2275
|
}, Pe = (r, e) => e <= 0 ? 0 : le(r, 0, e - 1), lr = (r) => ({
|
|
2276
2276
|
top: Math.max(0, r?.top ?? 0),
|
|
2277
2277
|
bottom: Math.max(0, r?.bottom ?? 0)
|
|
2278
|
-
}), Ke = (r, e) => r <= e ? 0 : r - e, Pt = (r, e) => r <= 0 ? 0 : r + e, Yt = 1e3, cr = 2e3, Zr = 1048576, Jr = 40,
|
|
2279
|
-
const e = r.ownerDocument.defaultView?.getSelection();
|
|
2280
|
-
if (!e || e.isCollapsed || e.rangeCount === 0)
|
|
2281
|
-
return !1;
|
|
2282
|
-
for (let t = 0; t < e.rangeCount; t += 1)
|
|
2283
|
-
if (e.getRangeAt(t).intersectsNode(r))
|
|
2284
|
-
return !0;
|
|
2285
|
-
return !1;
|
|
2286
|
-
}, Dt = (r) => {
|
|
2278
|
+
}), Ke = (r, e) => r <= e ? 0 : r - e, Pt = (r, e) => r <= 0 ? 0 : r + e, Yt = 1e3, cr = 2e3, Zr = 1048576, Jr = 40, Dt = (r) => {
|
|
2287
2279
|
if (!Number.isFinite(r)) return 0n;
|
|
2288
2280
|
const e = Math.trunc(r);
|
|
2289
2281
|
return e <= 0 ? 0n : BigInt(e);
|
|
2290
|
-
},
|
|
2282
|
+
}, Qr = (r, e, t, n, i, s, a, c) => {
|
|
2291
2283
|
const f = Dt(n);
|
|
2292
2284
|
if (f === 0n)
|
|
2293
2285
|
return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
|
|
2294
|
-
const b = (P) => P < 0n ? 0n : P >= f ? f - 1n : P,
|
|
2286
|
+
const b = (P) => P < 0n ? 0n : P >= f ? f - 1n : P, I = { materializeOption: { materialize: !1 } }, { index: w, cumulative: V } = s.findIndexAtOrAfter(r, I);
|
|
2295
2287
|
let h;
|
|
2296
2288
|
w === -1 ? h = f - 1n : (V === r ? h = Dt(w + 1) : h = Dt(w), h >= f && (h = f - 1n)), r <= 0 && (h = 0n), c && r >= a && (h = f - 1n);
|
|
2297
|
-
const
|
|
2289
|
+
const z = (P) => {
|
|
2298
2290
|
const _ = Number(P);
|
|
2299
2291
|
if (!Number.isSafeInteger(_))
|
|
2300
2292
|
return null;
|
|
@@ -2307,23 +2299,23 @@ const Gr = 1e4, cn = () => {
|
|
|
2307
2299
|
const Q = Dt(Z);
|
|
2308
2300
|
return Q > P ? Q : null;
|
|
2309
2301
|
}, G = (P) => {
|
|
2310
|
-
let _ = 0, M = P, Z = P, Q = 0n,
|
|
2302
|
+
let _ = 0, M = P, Z = P, Q = 0n, U = 0;
|
|
2311
2303
|
for (; M < f && _ < e; ) {
|
|
2312
|
-
const
|
|
2313
|
-
if (_ +=
|
|
2304
|
+
const Se = Number(M), C = i(Se);
|
|
2305
|
+
if (_ += C, Z = M, M += 1n, Q += 1n, !Number.isFinite(C) || C < 0)
|
|
2314
2306
|
break;
|
|
2315
|
-
if (
|
|
2316
|
-
if (
|
|
2317
|
-
const v =
|
|
2307
|
+
if (C === 0) {
|
|
2308
|
+
if (U += 1, U > Yt) {
|
|
2309
|
+
const v = z(Z);
|
|
2318
2310
|
if (v !== null && v > M)
|
|
2319
|
-
M = v,
|
|
2311
|
+
M = v, U = 0;
|
|
2320
2312
|
else if (v !== null && v === M && i(Number(M)) > 0)
|
|
2321
|
-
|
|
2313
|
+
U = 0;
|
|
2322
2314
|
else
|
|
2323
2315
|
break;
|
|
2324
2316
|
}
|
|
2325
2317
|
} else
|
|
2326
|
-
|
|
2318
|
+
U = 0;
|
|
2327
2319
|
}
|
|
2328
2320
|
return Q === 0n && (Z = P), { height: _, end: Z };
|
|
2329
2321
|
};
|
|
@@ -2332,21 +2324,21 @@ const Gr = 1e4, cn = () => {
|
|
|
2332
2324
|
let P = h, _ = H, M = 0;
|
|
2333
2325
|
for (; P > 0n && _ < e; ) {
|
|
2334
2326
|
P -= 1n;
|
|
2335
|
-
const Q = Number(P),
|
|
2336
|
-
if (_ +=
|
|
2327
|
+
const Q = Number(P), U = i(Q);
|
|
2328
|
+
if (_ += U, !Number.isFinite(U) || U < 0)
|
|
2337
2329
|
break;
|
|
2338
|
-
if (
|
|
2330
|
+
if (U === 0) {
|
|
2339
2331
|
if (M += 1, M > Yt) {
|
|
2340
|
-
const
|
|
2341
|
-
if (!Number.isSafeInteger(
|
|
2332
|
+
const Se = Number(P);
|
|
2333
|
+
if (!Number.isSafeInteger(Se))
|
|
2342
2334
|
break;
|
|
2343
|
-
const { cumulative:
|
|
2344
|
-
if (!Number.isFinite(
|
|
2335
|
+
const { cumulative: C } = s.prefixSum(Se, { materializeOption: { materialize: !1 } });
|
|
2336
|
+
if (!Number.isFinite(C))
|
|
2345
2337
|
break;
|
|
2346
|
-
const { index: v } = s.findIndexAtOrAfter(
|
|
2347
|
-
if (
|
|
2348
|
-
P =
|
|
2349
|
-
else if (
|
|
2338
|
+
const { index: v } = s.findIndexAtOrAfter(C - 0.5, { materializeOption: { materialize: !1 } }), W = v === -1 ? -1n : Dt(v);
|
|
2339
|
+
if (W >= 0n && W < P)
|
|
2340
|
+
P = W + 1n, M = 0;
|
|
2341
|
+
else if (W === P && P >= 1n && i(Number(P - 1n)) > 0)
|
|
2350
2342
|
M = 0;
|
|
2351
2343
|
else
|
|
2352
2344
|
break;
|
|
@@ -2365,34 +2357,34 @@ const Gr = 1e4, cn = () => {
|
|
|
2365
2357
|
visibleStartIndex: Pe(Number(me), n),
|
|
2366
2358
|
visibleEndIndex: Pe(Number(oe), n)
|
|
2367
2359
|
};
|
|
2368
|
-
},
|
|
2360
|
+
}, en = (r, e, t, n, i, s, a) => {
|
|
2369
2361
|
if (n === 0)
|
|
2370
2362
|
return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
|
|
2371
2363
|
const c = Number.isFinite(a), f = c ? Math.min(Math.max(0, r), a) : Math.max(0, r);
|
|
2372
2364
|
if (n >= Number.MAX_SAFE_INTEGER)
|
|
2373
|
-
return
|
|
2374
|
-
const { index: b, cumulative:
|
|
2375
|
-
let h = Pe(V, n),
|
|
2376
|
-
if (b !== -1 &&
|
|
2377
|
-
h = Pe(b + 1, n),
|
|
2378
|
-
else if (h === b &&
|
|
2379
|
-
|
|
2365
|
+
return Qr(f, e, t, n, i, s, a, c);
|
|
2366
|
+
const { index: b, cumulative: I, currentValue: w } = s.findIndexAtOrAfter(f, { materializeOption: { materialize: !1 } }), V = b === -1 ? e <= 0 || (I ?? 0) < f + (w ?? 0) ? n - 1 : 0 : b;
|
|
2367
|
+
let h = Pe(V, n), z = 0;
|
|
2368
|
+
if (b !== -1 && I === f)
|
|
2369
|
+
h = Pe(b + 1, n), z = 0;
|
|
2370
|
+
else if (h === b && I !== void 0 && w !== void 0)
|
|
2371
|
+
z = I - w - f;
|
|
2380
2372
|
else {
|
|
2381
2373
|
const { cumulative: P, currentValue: _ } = s.prefixSum(h, { materializeOption: { materialize: !1 } });
|
|
2382
|
-
|
|
2374
|
+
z = (P ?? 0) - (_ ?? 0) - f;
|
|
2383
2375
|
}
|
|
2384
|
-
const G =
|
|
2376
|
+
const G = z, H = (P, _) => {
|
|
2385
2377
|
let M = P, Z = _, Q = 0;
|
|
2386
2378
|
for (; M < n && Z < e; ) {
|
|
2387
|
-
const
|
|
2388
|
-
if (Z +=
|
|
2379
|
+
const U = i(M);
|
|
2380
|
+
if (Z += U, M++, !Number.isFinite(U) || U < 0)
|
|
2389
2381
|
break;
|
|
2390
|
-
if (
|
|
2382
|
+
if (U === 0) {
|
|
2391
2383
|
if (Q++, Q > Yt) {
|
|
2392
|
-
const { cumulative:
|
|
2393
|
-
if (
|
|
2394
|
-
M =
|
|
2395
|
-
else if (
|
|
2384
|
+
const { cumulative: Se } = s.prefixSum(M - 1, { materializeOption: { materialize: !1 } }), { index: C } = Number.isFinite(Se) ? s.findIndexAtOrAfter(Se + 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
|
|
2385
|
+
if (C > M)
|
|
2386
|
+
M = C, Q = 0;
|
|
2387
|
+
else if (C === M && i(M) > 0)
|
|
2396
2388
|
Q = 0;
|
|
2397
2389
|
else
|
|
2398
2390
|
break;
|
|
@@ -2401,10 +2393,10 @@ const Gr = 1e4, cn = () => {
|
|
|
2401
2393
|
Q = 0;
|
|
2402
2394
|
}
|
|
2403
2395
|
return { cursor: M, height: Z };
|
|
2404
|
-
}, pe = H(h,
|
|
2396
|
+
}, pe = H(h, z);
|
|
2405
2397
|
let me = pe.cursor;
|
|
2406
|
-
if (
|
|
2407
|
-
let P =
|
|
2398
|
+
if (z = pe.height, z < e && h > 0) {
|
|
2399
|
+
let P = z + Math.abs(Math.min(0, G)), _ = h - 1, M = 0;
|
|
2408
2400
|
for (; _ >= 0 && P < e; ) {
|
|
2409
2401
|
const Q = i(_);
|
|
2410
2402
|
if (P += Q, !Number.isFinite(Q) || Q < 0) {
|
|
@@ -2413,12 +2405,12 @@ const Gr = 1e4, cn = () => {
|
|
|
2413
2405
|
}
|
|
2414
2406
|
if (Q === 0) {
|
|
2415
2407
|
if (M++, M > Yt) {
|
|
2416
|
-
const { cumulative:
|
|
2417
|
-
if (
|
|
2418
|
-
_ =
|
|
2408
|
+
const { cumulative: U } = s.prefixSum(_, { materializeOption: { materialize: !1 } }), { index: Se } = Number.isFinite(U) ? s.findIndexAtOrAfter(U - 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
|
|
2409
|
+
if (Se !== -1 && Se < _) {
|
|
2410
|
+
_ = Se, M = 0;
|
|
2419
2411
|
continue;
|
|
2420
2412
|
}
|
|
2421
|
-
if (
|
|
2413
|
+
if (Se === _ && _ >= 1 && i(_ - 1) > 0)
|
|
2422
2414
|
M = 0;
|
|
2423
2415
|
else {
|
|
2424
2416
|
_--;
|
|
@@ -2431,7 +2423,7 @@ const Gr = 1e4, cn = () => {
|
|
|
2431
2423
|
}
|
|
2432
2424
|
h = Pe(_ + 1, n);
|
|
2433
2425
|
const Z = H(h, 0);
|
|
2434
|
-
me = Z.cursor,
|
|
2426
|
+
me = Z.cursor, z = Z.height;
|
|
2435
2427
|
}
|
|
2436
2428
|
const oe = Pe(h - t, n), ce = Pe(Math.max(me - 1, h), n), he = Pe(ce + t, n);
|
|
2437
2429
|
return { renderingStartIndex: oe, renderingEndIndex: he, visibleStartIndex: h, visibleEndIndex: ce };
|
|
@@ -2449,7 +2441,7 @@ const Gr = 1e4, cn = () => {
|
|
|
2449
2441
|
}
|
|
2450
2442
|
},
|
|
2451
2443
|
[i, r, t]
|
|
2452
|
-
),
|
|
2444
|
+
), S(
|
|
2453
2445
|
(s) => {
|
|
2454
2446
|
if (i.arg = s, i.id !== null) return;
|
|
2455
2447
|
const a = (c) => {
|
|
@@ -2470,14 +2462,14 @@ const Gr = 1e4, cn = () => {
|
|
|
2470
2462
|
},
|
|
2471
2463
|
[n, t, r, i]
|
|
2472
2464
|
);
|
|
2473
|
-
},
|
|
2474
|
-
const
|
|
2475
|
-
|
|
2465
|
+
}, tn = xr.memo(({ index: r, top: e, height: t, item: n, children: i, clipItemHeight: s, enableKeyboardNavigation: a, onKeyDown: c, onFocus: f, registerItemRef: b }) => {
|
|
2466
|
+
const I = S((z) => b(r, z), [r, b]), w = S((z) => c(z, r), [r, c]), V = S(() => f(r), [r, f]), h = S((z) => {
|
|
2467
|
+
z.currentTarget.focus({ preventScroll: !0 });
|
|
2476
2468
|
}, []);
|
|
2477
2469
|
return /* @__PURE__ */ de(
|
|
2478
2470
|
"div",
|
|
2479
2471
|
{
|
|
2480
|
-
ref:
|
|
2472
|
+
ref: I,
|
|
2481
2473
|
"data-index": r,
|
|
2482
2474
|
"data-virtualscroll-item": "true",
|
|
2483
2475
|
className: "aqvs-item-container",
|
|
@@ -2493,7 +2485,7 @@ const Gr = 1e4, cn = () => {
|
|
|
2493
2485
|
children: i(n, r)
|
|
2494
2486
|
}
|
|
2495
2487
|
);
|
|
2496
|
-
}),
|
|
2488
|
+
}), rn = ({
|
|
2497
2489
|
itemCount: r,
|
|
2498
2490
|
getItem: e,
|
|
2499
2491
|
getItemKey: t,
|
|
@@ -2504,11 +2496,11 @@ const Gr = 1e4, cn = () => {
|
|
|
2504
2496
|
testId: c,
|
|
2505
2497
|
onScroll: f,
|
|
2506
2498
|
onRangeChange: b,
|
|
2507
|
-
children:
|
|
2499
|
+
children: I,
|
|
2508
2500
|
background: w,
|
|
2509
2501
|
initialScrollIndex: V,
|
|
2510
2502
|
initialScrollOffset: h,
|
|
2511
|
-
initialScrollAnchor:
|
|
2503
|
+
initialScrollAnchor: z,
|
|
2512
2504
|
callbackThrottleMs: G = 5,
|
|
2513
2505
|
contentInsets: H,
|
|
2514
2506
|
onItemFocus: pe,
|
|
@@ -2519,7 +2511,7 @@ const Gr = 1e4, cn = () => {
|
|
|
2519
2511
|
horizontalKeyStep: P = Jr,
|
|
2520
2512
|
contentProps: _
|
|
2521
2513
|
}, M) => {
|
|
2522
|
-
const { width: Z, enableThumbDrag: Q, enableTrackClick:
|
|
2514
|
+
const { width: Z, enableThumbDrag: Q, enableTrackClick: U, enableArrowButtons: Se, enableScrollToTopBottomButtons: C, renderThumbOverlay: v, tapScrollCircleOptions: W } = me ?? {}, { enablePointerDrag: ge, pointerDragInputs: qe, enableKeyboardNavigation: ee = !0, wheelSpeedMultiplier: X, inertiaOptions: Xe, overscrollBehavior: $e, clipItemHeight: ze = !1, resetOnGetItemHeightChange: Ce = !1 } = oe ?? {}, [je, Ge] = rt(0), K = i ?? je, Ae = S((o) => {
|
|
2523
2515
|
Ge((u) => u === o ? u : o);
|
|
2524
2516
|
}, []), ue = g(null), be = g({
|
|
2525
2517
|
renderingStartIndex: 0,
|
|
@@ -2528,16 +2520,16 @@ const Gr = 1e4, cn = () => {
|
|
|
2528
2520
|
visibleEndIndex: 0,
|
|
2529
2521
|
scrollPosition: 0,
|
|
2530
2522
|
totalHeight: 0
|
|
2531
|
-
}), Te = g(
|
|
2523
|
+
}), Te = g(z && r > 0 ? { index: le(Math.trunc(z.index), 0, r - 1), align: "top", offset: -Math.max(0, z.offsetPx ?? 0) } : null), et = g(!1), mt = g(!0);
|
|
2532
2524
|
q(() => {
|
|
2533
2525
|
if (mt.current) {
|
|
2534
2526
|
mt.current = !1;
|
|
2535
2527
|
return;
|
|
2536
2528
|
}
|
|
2537
|
-
|
|
2538
|
-
}, [
|
|
2529
|
+
Ce && (Te.current = null);
|
|
2530
|
+
}, [Ce, n]);
|
|
2539
2531
|
const N = Fe(() => lr(H), [H]), [it] = rt(() => {
|
|
2540
|
-
const u =
|
|
2532
|
+
const u = z?.index ?? V, m = typeof u == "number" && Number.isFinite(u) ? Math.max(0, Math.trunc(u)) : 0;
|
|
2541
2533
|
return { from: Math.max(0, m - 50), to: m + 50 };
|
|
2542
2534
|
}), vt = Fe(
|
|
2543
2535
|
// 目的: Fenwick Tree のオプション設定
|
|
@@ -2546,29 +2538,29 @@ const Gr = 1e4, cn = () => {
|
|
|
2546
2538
|
// この useMemo により sampleRange を毎レンダー新規生成しない = 参照同一性由来の破壊的 reset を防ぐ。
|
|
2547
2539
|
() => ({
|
|
2548
2540
|
sampleRange: it,
|
|
2549
|
-
resetOnValueFnChange:
|
|
2541
|
+
resetOnValueFnChange: Ce,
|
|
2550
2542
|
materialize: !0
|
|
2551
2543
|
}),
|
|
2552
|
-
[
|
|
2553
|
-
), E =
|
|
2544
|
+
[Ce, it]
|
|
2545
|
+
), E = Wr(r, n, vt), [J] = rt(() => {
|
|
2554
2546
|
let o = 0, u = 0;
|
|
2555
|
-
if (
|
|
2556
|
-
const m = le(Math.trunc(
|
|
2547
|
+
if (z && r > 0) {
|
|
2548
|
+
const m = le(Math.trunc(z.index), 0, r - 1), A = Math.max(0, z.offsetPx ?? 0), L = le(m - s * 2, 0, r - 1), O = le(m + s * 2, 0, r - 1), k = m > 0 || A > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: L, to: O }] } } : void 0, { cumulative: se, total: Ne, currentValue: Ie } = E.prefixSum(m, k), fe = Math.max(se - Ie + A, 0);
|
|
2557
2549
|
o = Pt(fe, N.top), u = Ne ?? E.getTotal();
|
|
2558
2550
|
} else if (typeof V == "number") {
|
|
2559
|
-
const m = le(V, 0, r - 1), A = le(m - s * 2, 0, r - 1), L = le(m + s * 2, 0, r - 1), O = V > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: A, to: L }] } } : void 0, { cumulative: k, total: se, currentValue: Ne } = E.prefixSum(V, O),
|
|
2560
|
-
o = Pt(
|
|
2551
|
+
const m = le(V, 0, r - 1), A = le(m - s * 2, 0, r - 1), L = le(m + s * 2, 0, r - 1), O = V > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: A, to: L }] } } : void 0, { cumulative: k, total: se, currentValue: Ne } = E.prefixSum(V, O), Ie = Math.max(k - Ne, 0);
|
|
2552
|
+
o = Pt(Ie, N.top), u = se ?? E.getTotal();
|
|
2561
2553
|
} else typeof h == "number" && (o = Pt(Math.max(h, 0), N.top)), u = E.getTotal();
|
|
2562
2554
|
return { position: o, total: u };
|
|
2563
2555
|
}), [Ze, ht] = rt(J.position), [Le, st] = rt(J.total), ie = g(J.position), p = g(N.top), F = g(f ?? void 0), B = g(b ?? void 0), Y = g(ce), te = (he?.length ?? 0) > 0, Me = !!ce;
|
|
2564
2556
|
q(() => {
|
|
2565
2557
|
te && (ee || T.warn("[VirtualScroll] horizontalKeyInputs is set but behaviorOptions.enableKeyboardNavigation is false; horizontal keyboard scrolling is disabled because the row key handler is not mounted."), Me || T.warn("[VirtualScroll] horizontalKeyInputs is set but onWheelHorizontal is missing; horizontal keyboard scrolling is disabled because the package does not own the horizontal axis."), Number.isFinite(P) && P > 0 || T.warn(`[VirtualScroll] horizontalKeyStep must be a finite positive number, received ${P}. Horizontal arrow keys are left untouched.`));
|
|
2566
2558
|
}, [te, Me, ee, P]);
|
|
2567
|
-
const j = g(/* @__PURE__ */ new Map()), re = g(null), De = g(null), [ne, Je] = rt(null), [Oe, ae] = rt(!1), ve = g(null),
|
|
2559
|
+
const j = g(/* @__PURE__ */ new Map()), re = g(null), De = g(null), [ne, Je] = rt(null), [Oe, ae] = rt(!1), ve = g(null), Ue = g(!1), Ve = g(0), ft = g(!1), Qe = g(!1), ot = g(r);
|
|
2568
2560
|
ot.current !== r && (ot.current = r, Qe.current = !0), nt(() => {
|
|
2569
2561
|
F.current = f ?? void 0, B.current = b ?? void 0, Y.current = ce;
|
|
2570
2562
|
}, [b, f, ce]);
|
|
2571
|
-
const d =
|
|
2563
|
+
const d = S(
|
|
2572
2564
|
(o) => {
|
|
2573
2565
|
if (ee && o && typeof o.focus == "function")
|
|
2574
2566
|
try {
|
|
@@ -2578,9 +2570,9 @@ const Gr = 1e4, cn = () => {
|
|
|
2578
2570
|
}
|
|
2579
2571
|
},
|
|
2580
2572
|
[ee]
|
|
2581
|
-
), y =
|
|
2573
|
+
), y = S((o, { position: u, totalHeight: m }) => {
|
|
2582
2574
|
o(u, m);
|
|
2583
|
-
}, []), xe = ur(F, G, y), tt =
|
|
2575
|
+
}, []), xe = ur(F, G, y), tt = S((o, u) => {
|
|
2584
2576
|
o(u);
|
|
2585
2577
|
}, []), _e = ur(B, G, tt), ct = g(N.top);
|
|
2586
2578
|
ct.current = N.top;
|
|
@@ -2590,7 +2582,7 @@ const Gr = 1e4, cn = () => {
|
|
|
2590
2582
|
}), []), q(() => {
|
|
2591
2583
|
ee || (j.current.clear(), re.current = null, De.current = null);
|
|
2592
2584
|
}, [ee]);
|
|
2593
|
-
const at =
|
|
2585
|
+
const at = S(
|
|
2594
2586
|
(o, u) => {
|
|
2595
2587
|
if (!u) {
|
|
2596
2588
|
j.current.delete(o);
|
|
@@ -2604,7 +2596,7 @@ const Gr = 1e4, cn = () => {
|
|
|
2604
2596
|
loopActive: !1,
|
|
2605
2597
|
idleFrames: 0,
|
|
2606
2598
|
lastRenderedPosition: J.position
|
|
2607
|
-
}), yt =
|
|
2599
|
+
}), yt = S(() => {
|
|
2608
2600
|
const o = pt.current;
|
|
2609
2601
|
o.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(o.rafId), o.rafId = null, o.loopActive = !1, o.idleFrames = 0;
|
|
2610
2602
|
}, []);
|
|
@@ -2615,7 +2607,7 @@ const Gr = 1e4, cn = () => {
|
|
|
2615
2607
|
[yt]
|
|
2616
2608
|
);
|
|
2617
2609
|
const wt = g(() => {
|
|
2618
|
-
}), Nt =
|
|
2610
|
+
}), Nt = S(() => {
|
|
2619
2611
|
const o = pt.current;
|
|
2620
2612
|
o.rafId = null;
|
|
2621
2613
|
const u = ie.current, m = Ke(u, ct.current), A = E.getTotal();
|
|
@@ -2630,7 +2622,7 @@ const Gr = 1e4, cn = () => {
|
|
|
2630
2622
|
o.loopActive = !1;
|
|
2631
2623
|
}, [E, yt]);
|
|
2632
2624
|
wt.current = Nt;
|
|
2633
|
-
const At =
|
|
2625
|
+
const At = S(() => {
|
|
2634
2626
|
const o = pt.current;
|
|
2635
2627
|
if (o.idleFrames = 0, !o.loopActive) {
|
|
2636
2628
|
if (o.loopActive = !0, typeof requestAnimationFrame == "function") {
|
|
@@ -2639,7 +2631,7 @@ const Gr = 1e4, cn = () => {
|
|
|
2639
2631
|
}
|
|
2640
2632
|
o.loopActive = !1;
|
|
2641
2633
|
}
|
|
2642
|
-
}, [Nt]), we =
|
|
2634
|
+
}, [Nt]), we = S(
|
|
2643
2635
|
(o, u) => {
|
|
2644
2636
|
const m = u?.immediate ?? !1, A = Ke(o, N.top);
|
|
2645
2637
|
if (ie.current = o, m) {
|
|
@@ -2649,7 +2641,7 @@ const Gr = 1e4, cn = () => {
|
|
|
2649
2641
|
At();
|
|
2650
2642
|
},
|
|
2651
2643
|
[At, E, N.top, xe]
|
|
2652
|
-
), bt =
|
|
2644
|
+
), bt = S((o, u = 0) => {
|
|
2653
2645
|
const m = ue.current;
|
|
2654
2646
|
if (!m)
|
|
2655
2647
|
return o;
|
|
@@ -2660,12 +2652,12 @@ const Gr = 1e4, cn = () => {
|
|
|
2660
2652
|
}, []), Lt = g(!1);
|
|
2661
2653
|
q(() => {
|
|
2662
2654
|
if (!Lt.current)
|
|
2663
|
-
if (Lt.current = !0,
|
|
2655
|
+
if (Lt.current = !0, z == null && typeof V != "number" && typeof h == "number") {
|
|
2664
2656
|
const o = Pt(Math.max(h, 0), N.top), u = Math.abs(o - ie.current) > 0.5;
|
|
2665
2657
|
we(o, { immediate: !0 }), u && ue.current?.scrollTo(o);
|
|
2666
2658
|
} else
|
|
2667
2659
|
we(ie.current, { immediate: !0 });
|
|
2668
|
-
}, [
|
|
2660
|
+
}, [z, V, h, N.top, we]), q(() => {
|
|
2669
2661
|
const o = E.getTotal();
|
|
2670
2662
|
if (Le !== o) {
|
|
2671
2663
|
st(o);
|
|
@@ -2686,12 +2678,12 @@ const Gr = 1e4, cn = () => {
|
|
|
2686
2678
|
const k = Math.max(L - O, 0);
|
|
2687
2679
|
let se = k;
|
|
2688
2680
|
u === "bottom" ? se = L - K : u === "center" && (se = k + O / 2 - K / 2), m && (se -= m), se = Math.max(0, se);
|
|
2689
|
-
const Ne = Math.max(0, Le + N.top + N.bottom - K),
|
|
2690
|
-
Math.abs(
|
|
2681
|
+
const Ne = Math.max(0, Le + N.top + N.bottom - K), Ie = Math.min(Pt(se, N.top), Ne);
|
|
2682
|
+
Math.abs(Ie - ie.current) > 1 && (T.debug("[VirtualScroll] Drift correction", {
|
|
2691
2683
|
from: ie.current,
|
|
2692
|
-
to:
|
|
2684
|
+
to: Ie,
|
|
2693
2685
|
targetIndex: A
|
|
2694
|
-
}), Ve.current === 0 && (Ve.current += 1), ue.current?.scrollTo(
|
|
2686
|
+
}), Ve.current === 0 && (Ve.current += 1), ue.current?.scrollTo(Ie), we(Ie, { immediate: !0 }));
|
|
2695
2687
|
}
|
|
2696
2688
|
}
|
|
2697
2689
|
Qe.current = !1;
|
|
@@ -2702,7 +2694,7 @@ const Gr = 1e4, cn = () => {
|
|
|
2702
2694
|
const u = Ke(ie.current, o), m = Pt(u, N.top);
|
|
2703
2695
|
ie.current = m, ue.current?.scrollTo(m), we(m, { immediate: !0 });
|
|
2704
2696
|
}, [N.top, we]);
|
|
2705
|
-
const Ot =
|
|
2697
|
+
const Ot = S(
|
|
2706
2698
|
(o, u) => {
|
|
2707
2699
|
if (r === 0)
|
|
2708
2700
|
return;
|
|
@@ -2710,8 +2702,8 @@ const Gr = 1e4, cn = () => {
|
|
|
2710
2702
|
O !== void 0 && st(O), T.debug("[VirtualScroll] Updated item size manually", { index: m, size: u, total: O });
|
|
2711
2703
|
let k = Te.current ? Te.current.index : null;
|
|
2712
2704
|
if (k === null) {
|
|
2713
|
-
const se = ie.current, Ne = lr(H).top,
|
|
2714
|
-
k = Be !== void 0 && Be ===
|
|
2705
|
+
const se = ie.current, Ne = lr(H).top, Ie = Ke(se, Ne), { index: fe, cumulative: Be } = E.findIndexAtOrAfter(Ie, { materializeOption: { materialize: !1 } });
|
|
2706
|
+
k = Be !== void 0 && Be === Ie ? fe + 1 : fe;
|
|
2715
2707
|
}
|
|
2716
2708
|
if (k !== -1 && m < k && L !== 0) {
|
|
2717
2709
|
const se = ie.current, Ne = se + L;
|
|
@@ -2719,7 +2711,7 @@ const Gr = 1e4, cn = () => {
|
|
|
2719
2711
|
}
|
|
2720
2712
|
},
|
|
2721
2713
|
[E, r, bt, we, H]
|
|
2722
|
-
),
|
|
2714
|
+
), We = S(
|
|
2723
2715
|
(o, u) => {
|
|
2724
2716
|
if (!ue.current || r === 0)
|
|
2725
2717
|
return;
|
|
@@ -2727,32 +2719,32 @@ const Gr = 1e4, cn = () => {
|
|
|
2727
2719
|
if (T.debug("[VirtualScroll] Scrolling to index:", m, "ItemBottom:", O, "Total height:", k, "ItemHeight:", se, "safeIndexFrom:", A, "safeIndexTo:", L), !k)
|
|
2728
2720
|
return;
|
|
2729
2721
|
const Ne = Math.max(O - se, 0);
|
|
2730
|
-
let
|
|
2731
|
-
u?.align === "bottom" ?
|
|
2732
|
-
const fe = Pt(
|
|
2722
|
+
let Ie = Ne;
|
|
2723
|
+
u?.align === "bottom" ? Ie = O - K : u?.align === "center" && (Ie = Ne + se / 2 - K / 2), u?.offset && (Ie -= u.offset), Ie = Math.max(0, Ie);
|
|
2724
|
+
const fe = Pt(Ie, N.top), Be = ue.current?.getContentSize() ?? k + N.top + N.bottom, ke = Math.max(0, Be - K), He = Math.min(fe, ke);
|
|
2733
2725
|
Te.current = {
|
|
2734
2726
|
index: m,
|
|
2735
2727
|
align: u?.align,
|
|
2736
2728
|
offset: u?.offset
|
|
2737
2729
|
};
|
|
2738
|
-
const
|
|
2739
|
-
|
|
2730
|
+
const zt = ue.current?.getScrollPosition() ?? -1, Xt = Math.abs(zt - He) > 0.5;
|
|
2731
|
+
Ue.current = !1, Ve.current = 0, Xt && (Ue.current = !0, Ve.current += 1, ue.current?.scrollTo(He)), st(k), we(He, { immediate: !0 }), T.debug("[VirtualScroll] Setting scroll position to:", He, { original: fe, max: ke });
|
|
2740
2732
|
},
|
|
2741
2733
|
[E, s, r, N.top, N.bottom, K, we]
|
|
2742
|
-
), Vt = g(
|
|
2734
|
+
), Vt = g(z && r === 0 ? z : null);
|
|
2743
2735
|
q(() => {
|
|
2744
2736
|
const o = Vt.current;
|
|
2745
|
-
!o || r === 0 || (Vt.current = null,
|
|
2746
|
-
}, [r,
|
|
2747
|
-
const l =
|
|
2737
|
+
!o || r === 0 || (Vt.current = null, We(le(Math.trunc(o.index), 0, r - 1), { align: "top", offset: -Math.max(0, o.offsetPx ?? 0) }));
|
|
2738
|
+
}, [r, We]);
|
|
2739
|
+
const l = S(
|
|
2748
2740
|
(o) => {
|
|
2749
2741
|
if (!ue.current || r === 0)
|
|
2750
2742
|
return;
|
|
2751
2743
|
const u = E.getTotal(), m = le(Math.floor(o), 0, u), { index: A, cumulative: L, currentValue: O } = E.findIndexAtOrAfter(m, { materializeOption: { materialize: !1 } }), se = (L ?? 0) - (O ?? 0) - m;
|
|
2752
|
-
|
|
2744
|
+
We(A, { offset: se });
|
|
2753
2745
|
},
|
|
2754
|
-
[E, r,
|
|
2755
|
-
), x =
|
|
2746
|
+
[E, r, We]
|
|
2747
|
+
), x = S(() => {
|
|
2756
2748
|
if (r === 0)
|
|
2757
2749
|
return null;
|
|
2758
2750
|
const o = Ke(ie.current, N.top), { index: u, cumulative: m, currentValue: A } = E.findIndexAtOrAfter(o, { materializeOption: { materialize: !1 } });
|
|
@@ -2762,7 +2754,7 @@ const Gr = 1e4, cn = () => {
|
|
|
2762
2754
|
return { index: le(u + 1, 0, r - 1), offsetPx: 0 };
|
|
2763
2755
|
const L = (m ?? 0) - (A ?? 0);
|
|
2764
2756
|
return { index: u, offsetPx: Math.max(0, o - L) };
|
|
2765
|
-
}, [E, r, N.top]), R =
|
|
2757
|
+
}, [E, r, N.top]), R = S(
|
|
2766
2758
|
(o) => {
|
|
2767
2759
|
const u = Ke(ie.current, N.top), m = typeof o == "function" ? o(u) : o;
|
|
2768
2760
|
l(m);
|
|
@@ -2770,21 +2762,21 @@ const Gr = 1e4, cn = () => {
|
|
|
2770
2762
|
return we(L), Ke(L, ct.current);
|
|
2771
2763
|
},
|
|
2772
2764
|
[N.top, l, we]
|
|
2773
|
-
), D =
|
|
2765
|
+
), D = S((o) => {
|
|
2774
2766
|
const u = ue.current;
|
|
2775
2767
|
if (!u)
|
|
2776
2768
|
return Ke(ie.current, ct.current);
|
|
2777
2769
|
const m = u.scrollTo((A) => A + o);
|
|
2778
2770
|
return Ke(m, ct.current);
|
|
2779
|
-
}, []), $ =
|
|
2771
|
+
}, []), $ = S((o) => ue.current?.applyWheel(o) ?? !1, []), ye = S(
|
|
2780
2772
|
(o, u) => {
|
|
2781
2773
|
T.debug("[VirtualScroll] Scroll position changed:", o);
|
|
2782
|
-
const m =
|
|
2783
|
-
m && (
|
|
2774
|
+
const m = Ue.current;
|
|
2775
|
+
m && (Ue.current = !1);
|
|
2784
2776
|
const A = Ve.current > 0;
|
|
2785
2777
|
A && (Ve.current = 0);
|
|
2786
2778
|
const L = Qe.current && ot.current === r;
|
|
2787
|
-
if (m || A || L || (Te.current = null), we(o),
|
|
2779
|
+
if (m || A || L || (Te.current = null), we(o), C) {
|
|
2788
2780
|
if (m || A)
|
|
2789
2781
|
return;
|
|
2790
2782
|
const O = o - u;
|
|
@@ -2796,9 +2788,9 @@ const Gr = 1e4, cn = () => {
|
|
|
2796
2788
|
}
|
|
2797
2789
|
}
|
|
2798
2790
|
},
|
|
2799
|
-
[we,
|
|
2791
|
+
[we, C, r]
|
|
2800
2792
|
), Re = Fe(() => Ke(Ze, N.top), [N.top, Ze]), Ee = Fe(() => {
|
|
2801
|
-
const o = E.getTotal(), u =
|
|
2793
|
+
const o = E.getTotal(), u = en(Re, K, s, r, n, E, o);
|
|
2802
2794
|
return T.debug("[VirtualScroll] Calculated rendering range:", () => ({
|
|
2803
2795
|
...u,
|
|
2804
2796
|
scrollPosition: Re,
|
|
@@ -2806,7 +2798,7 @@ const Gr = 1e4, cn = () => {
|
|
|
2806
2798
|
overscanCount: s,
|
|
2807
2799
|
viewportSize: K
|
|
2808
2800
|
})), u;
|
|
2809
|
-
}, [Re, K, s, r, n, E]), { renderingStartIndex: lt, renderingEndIndex: Ye, visibleStartIndex: xt, visibleEndIndex: _t } = Ee, Tt =
|
|
2801
|
+
}, [Re, K, s, r, n, E]), { renderingStartIndex: lt, renderingEndIndex: Ye, visibleStartIndex: xt, visibleEndIndex: _t } = Ee, Tt = S(
|
|
2810
2802
|
(o, u) => {
|
|
2811
2803
|
if (!ee || r === 0)
|
|
2812
2804
|
return;
|
|
@@ -2816,9 +2808,9 @@ const Gr = 1e4, cn = () => {
|
|
|
2816
2808
|
ke && (re.current = null, De.current = m, d(ke));
|
|
2817
2809
|
return;
|
|
2818
2810
|
}
|
|
2819
|
-
const L = E.prefixSum(m, { materializeOption: { materialize: !1 } }), O = L.currentValue, k = Math.max(L.cumulative - O, 0), se = k + O, Ne = Ke(ie.current, N.top),
|
|
2820
|
-
if (k < Ne || se >
|
|
2821
|
-
|
|
2811
|
+
const L = E.prefixSum(m, { materializeOption: { materialize: !1 } }), O = L.currentValue, k = Math.max(L.cumulative - O, 0), se = k + O, Ne = Ke(ie.current, N.top), Ie = Ne + K;
|
|
2812
|
+
if (k < Ne || se > Ie) {
|
|
2813
|
+
We(m);
|
|
2822
2814
|
const ke = j.current.get(m);
|
|
2823
2815
|
ke ? (re.current = null, De.current = m, d(ke)) : re.current = m;
|
|
2824
2816
|
return;
|
|
@@ -2830,16 +2822,13 @@ const Gr = 1e4, cn = () => {
|
|
|
2830
2822
|
}
|
|
2831
2823
|
re.current = m;
|
|
2832
2824
|
},
|
|
2833
|
-
[ee, r, E, N.top,
|
|
2834
|
-
), Qt =
|
|
2825
|
+
[ee, r, E, N.top, We, d, K]
|
|
2826
|
+
), Qt = S(
|
|
2835
2827
|
(o, u) => {
|
|
2836
2828
|
if (!(!ee || o.defaultPrevented) && !(o.altKey || o.metaKey || o.ctrlKey) && o.target === o.currentTarget && !o.currentTarget.isContentEditable) {
|
|
2837
2829
|
if (o.key === "ArrowLeft" || o.key === "ArrowRight") {
|
|
2838
2830
|
const m = Y.current;
|
|
2839
|
-
if (!m)
|
|
2840
|
-
return;
|
|
2841
|
-
const A = o.shiftKey ? "shift-arrow" : "arrow";
|
|
2842
|
-
if (!he?.includes(A) || o.shiftKey && Qr(o.currentTarget) || !(Number.isFinite(P) && P > 0))
|
|
2831
|
+
if (!m || o.shiftKey || !he?.includes("arrow") || !(Number.isFinite(P) && P > 0))
|
|
2843
2832
|
return;
|
|
2844
2833
|
o.preventDefault(), m(o.key === "ArrowLeft" ? -P : P);
|
|
2845
2834
|
return;
|
|
@@ -2868,7 +2857,7 @@ const Gr = 1e4, cn = () => {
|
|
|
2868
2857
|
}
|
|
2869
2858
|
},
|
|
2870
2859
|
[ee, r, Tt, he, P]
|
|
2871
|
-
), er =
|
|
2860
|
+
), er = S(
|
|
2872
2861
|
(o) => {
|
|
2873
2862
|
if (!ee)
|
|
2874
2863
|
return;
|
|
@@ -2898,8 +2887,8 @@ const Gr = 1e4, cn = () => {
|
|
|
2898
2887
|
totalHeight: Le
|
|
2899
2888
|
});
|
|
2900
2889
|
}, [Le, Ye, lt, N.top, _e, Ze, _t, xt]);
|
|
2901
|
-
const hr =
|
|
2902
|
-
if (!
|
|
2890
|
+
const hr = S(() => {
|
|
2891
|
+
if (!C)
|
|
2903
2892
|
return null;
|
|
2904
2893
|
const o = Oe && ne !== null;
|
|
2905
2894
|
return /* @__PURE__ */ de("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": o, inert: !o, children: ne === "up" ? /* @__PURE__ */ de("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ de(
|
|
@@ -2909,7 +2898,7 @@ const Gr = 1e4, cn = () => {
|
|
|
2909
2898
|
className: "aqvs-scroll-to-edge-button",
|
|
2910
2899
|
tabIndex: o ? 0 : -1,
|
|
2911
2900
|
onClick: (m) => {
|
|
2912
|
-
m.stopPropagation(),
|
|
2901
|
+
m.stopPropagation(), Ue.current = !0, We(0), ae(!1);
|
|
2913
2902
|
},
|
|
2914
2903
|
children: "Top"
|
|
2915
2904
|
}
|
|
@@ -2920,12 +2909,12 @@ const Gr = 1e4, cn = () => {
|
|
|
2920
2909
|
className: "aqvs-scroll-to-edge-button",
|
|
2921
2910
|
tabIndex: o ? 0 : -1,
|
|
2922
2911
|
onClick: (m) => {
|
|
2923
|
-
m.stopPropagation(),
|
|
2912
|
+
m.stopPropagation(), Ue.current = !0, We(r - 1), ae(!1);
|
|
2924
2913
|
},
|
|
2925
2914
|
children: "Bottom"
|
|
2926
2915
|
}
|
|
2927
2916
|
) }) });
|
|
2928
|
-
}, [
|
|
2917
|
+
}, [C, Oe, ne, We, r]), Bt = g(0), { visibleItems: Ht, renderAnchor: qt } = Fe(() => {
|
|
2929
2918
|
if (r === 0)
|
|
2930
2919
|
return {
|
|
2931
2920
|
visibleItems: /* @__PURE__ */ de("div", { className: "aqvs-no-items-container", children: /* @__PURE__ */ de("div", { className: "aqvs-no-items-text", children: "No items" }) }),
|
|
@@ -2934,7 +2923,7 @@ const Gr = 1e4, cn = () => {
|
|
|
2934
2923
|
const o = Pe(lt, r), u = Pe(Ye, r), { cumulative: m, currentValue: A } = E.prefixSum(o, { materializeOption: { materialize: !1 } }), L = m - A;
|
|
2935
2924
|
Number.isFinite(L) && Math.abs(L - Bt.current) > Zr && (Bt.current = L);
|
|
2936
2925
|
const O = Bt.current, k = [], se = [];
|
|
2937
|
-
let Ne = 0,
|
|
2926
|
+
let Ne = 0, Ie = L;
|
|
2938
2927
|
for (let fe = o; fe <= u; fe++) {
|
|
2939
2928
|
if (se.length >= cr) {
|
|
2940
2929
|
T.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.", { cap: cr, safeRenderingStartIndex: o, safeRenderingEndIndex: u });
|
|
@@ -2942,25 +2931,25 @@ const Gr = 1e4, cn = () => {
|
|
|
2942
2931
|
}
|
|
2943
2932
|
const Be = n(fe), ke = E.get(fe), He = Be - ke;
|
|
2944
2933
|
He !== 0 && k.push({ index: fe, value: Be });
|
|
2945
|
-
const
|
|
2934
|
+
const zt = Ie + Ne, Xt = t ? t(fe) : fe;
|
|
2946
2935
|
se.push(
|
|
2947
2936
|
/* @__PURE__ */ de(
|
|
2948
|
-
|
|
2937
|
+
tn,
|
|
2949
2938
|
{
|
|
2950
2939
|
index: fe,
|
|
2951
|
-
top:
|
|
2940
|
+
top: zt - O,
|
|
2952
2941
|
height: Be,
|
|
2953
2942
|
item: e(fe),
|
|
2954
|
-
clipItemHeight:
|
|
2943
|
+
clipItemHeight: ze,
|
|
2955
2944
|
enableKeyboardNavigation: ee,
|
|
2956
2945
|
onKeyDown: Qt,
|
|
2957
2946
|
onFocus: er,
|
|
2958
2947
|
registerItemRef: at,
|
|
2959
|
-
children:
|
|
2948
|
+
children: I
|
|
2960
2949
|
},
|
|
2961
2950
|
Xt
|
|
2962
2951
|
)
|
|
2963
|
-
), Ne += He,
|
|
2952
|
+
), Ne += He, Ie += ke;
|
|
2964
2953
|
}
|
|
2965
2954
|
return k.length > 0 && Promise.resolve().then(() => {
|
|
2966
2955
|
if (et.current)
|
|
@@ -2968,8 +2957,8 @@ const Gr = 1e4, cn = () => {
|
|
|
2968
2957
|
let fe = 0;
|
|
2969
2958
|
for (const He of k)
|
|
2970
2959
|
if (He.index < xt) {
|
|
2971
|
-
const
|
|
2972
|
-
fe += He.value -
|
|
2960
|
+
const zt = E.get(He.index);
|
|
2961
|
+
fe += He.value - zt;
|
|
2973
2962
|
}
|
|
2974
2963
|
const Be = E.updates(k);
|
|
2975
2964
|
if (et.current || typeof Be != "number")
|
|
@@ -2982,8 +2971,8 @@ const Gr = 1e4, cn = () => {
|
|
|
2982
2971
|
} else ke !== ie.current && we(ke);
|
|
2983
2972
|
}), { visibleItems: se, renderAnchor: O };
|
|
2984
2973
|
}, [
|
|
2985
|
-
|
|
2986
|
-
|
|
2974
|
+
I,
|
|
2975
|
+
ze,
|
|
2987
2976
|
Le,
|
|
2988
2977
|
ee,
|
|
2989
2978
|
r,
|
|
@@ -2999,7 +2988,7 @@ const Gr = 1e4, cn = () => {
|
|
|
2999
2988
|
lt,
|
|
3000
2989
|
we,
|
|
3001
2990
|
xt
|
|
3002
|
-
]), gr =
|
|
2991
|
+
]), gr = S(
|
|
3003
2992
|
(o) => {
|
|
3004
2993
|
const u = (G ?? 0) > 0, m = Math.abs(o - Ze), A = u && m > 0.5 ? Ze : o, L = Ke(A, N.top);
|
|
3005
2994
|
if (T.debug("[VirtualScroll] Rendering visible items", () => ({
|
|
@@ -3065,7 +3054,7 @@ const Gr = 1e4, cn = () => {
|
|
|
3065
3054
|
scrollTo: R,
|
|
3066
3055
|
scrollBy: D,
|
|
3067
3056
|
applyWheel: $,
|
|
3068
|
-
scrollToIndex:
|
|
3057
|
+
scrollToIndex: We,
|
|
3069
3058
|
getFenwickTreeTotalHeight: () => E.getTotal(),
|
|
3070
3059
|
getFenwickSize: () => E.getSize(),
|
|
3071
3060
|
focusItemAtIndex: Tt,
|
|
@@ -3073,7 +3062,7 @@ const Gr = 1e4, cn = () => {
|
|
|
3073
3062
|
getScrollAnchor: x,
|
|
3074
3063
|
updateItemSize: Ot
|
|
3075
3064
|
}),
|
|
3076
|
-
[R, D, $,
|
|
3065
|
+
[R, D, $, We, E, Tt, x, Ot]
|
|
3077
3066
|
);
|
|
3078
3067
|
const br = E.getTotal() + N.top + N.bottom;
|
|
3079
3068
|
return /* @__PURE__ */ de(
|
|
@@ -3087,14 +3076,14 @@ const Gr = 1e4, cn = () => {
|
|
|
3087
3076
|
testId: c,
|
|
3088
3077
|
onScroll: ye,
|
|
3089
3078
|
background: w,
|
|
3090
|
-
tapScrollCircleOptions:
|
|
3079
|
+
tapScrollCircleOptions: W,
|
|
3091
3080
|
inertiaOptions: Xe,
|
|
3092
3081
|
overscrollBehavior: $e,
|
|
3093
3082
|
itemCount: r,
|
|
3094
3083
|
scrollBarWidth: Z,
|
|
3095
3084
|
enableThumbDrag: Q,
|
|
3096
|
-
enableTrackClick:
|
|
3097
|
-
enableArrowButtons:
|
|
3085
|
+
enableTrackClick: U,
|
|
3086
|
+
enableArrowButtons: Se,
|
|
3098
3087
|
enablePointerDrag: ge,
|
|
3099
3088
|
pointerDragInputs: qe,
|
|
3100
3089
|
renderThumbOverlay: v,
|
|
@@ -3109,19 +3098,19 @@ const Gr = 1e4, cn = () => {
|
|
|
3109
3098
|
children: gr
|
|
3110
3099
|
}
|
|
3111
3100
|
);
|
|
3112
|
-
},
|
|
3101
|
+
}, un = Zt(rn);
|
|
3113
3102
|
export {
|
|
3114
|
-
|
|
3103
|
+
St as FenwickMapTree,
|
|
3115
3104
|
kr as ScrollBar,
|
|
3116
3105
|
Xr as ScrollPane,
|
|
3117
3106
|
pr as TAP_SCROLL_SPEED_DEFAULTS,
|
|
3118
|
-
|
|
3107
|
+
un as VirtualScroll,
|
|
3119
3108
|
_r as computeAutoTapScrollMaxSpeedMultiplier,
|
|
3120
3109
|
Or as computeTapScrollSpeed,
|
|
3121
3110
|
le as minmax,
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3111
|
+
an as tapScrollCircleSampleVisual,
|
|
3112
|
+
Wr as useFenwickMapTree,
|
|
3113
|
+
ln as useHeightCache,
|
|
3125
3114
|
jr as useLruCache,
|
|
3126
|
-
|
|
3115
|
+
cn as useWheelBridge
|
|
3127
3116
|
};
|