@aiquants/virtualscroll 1.17.0 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +1014 -998
- package/dist/src/ScrollPane.d.ts +7 -0
- package/dist/src/ScrollPane.d.ts.map +1 -1
- package/dist/src/VirtualScroll.d.ts +2 -0
- package/dist/src/VirtualScroll.d.ts.map +1 -1
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as $, jsxs as
|
|
2
|
-
import He, { memo as
|
|
3
|
-
import { twMerge as
|
|
1
|
+
import { jsx as $, jsxs as ne, Fragment as _e } from "react/jsx-runtime";
|
|
2
|
+
import He, { memo as Xe, forwardRef as ye, useState as Bt, useRef as T, useCallback as P, useImperativeHandle as we, useMemo as At, useLayoutEffect as oe, useEffect as Y, useId as Be } from "react";
|
|
3
|
+
import { twMerge as re } from "tailwind-merge";
|
|
4
4
|
class _ {
|
|
5
5
|
level;
|
|
6
6
|
prefix;
|
|
@@ -97,16 +97,16 @@ class _ {
|
|
|
97
97
|
this.level <= 3 && this.impl.error(...this.formatMessage(t), ...e);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
const
|
|
100
|
+
const Ve = {
|
|
101
101
|
active: !1,
|
|
102
102
|
offsetX: 0,
|
|
103
103
|
offsetY: 0,
|
|
104
104
|
distance: 0,
|
|
105
105
|
direction: 0,
|
|
106
106
|
pointerId: null
|
|
107
|
-
},
|
|
108
|
-
const e = 1 + t * 0.18, r = 0.16 + t * 0.24,
|
|
109
|
-
return /* @__PURE__ */
|
|
107
|
+
}, Te = 6, Ue = 8, $e = ({ dragState: n, normalizedDistance: t }) => {
|
|
108
|
+
const e = 1 + t * 0.18, r = 0.16 + t * 0.24, i = 0.38 + t * 0.28, l = n.active ? "80ms ease-out" : "220ms ease";
|
|
109
|
+
return /* @__PURE__ */ ne(_e, { children: [
|
|
110
110
|
/* @__PURE__ */ $(
|
|
111
111
|
"div",
|
|
112
112
|
{
|
|
@@ -126,104 +126,104 @@ const Re = {
|
|
|
126
126
|
style: {
|
|
127
127
|
background: "linear-gradient(140deg, rgba(255,255,255,0.72), rgba(28,28,28,0.58))",
|
|
128
128
|
boxShadow: "inset 0 4px 10px rgba(0,0,0,0.24), inset 0 0 2px rgba(255,255,255,0.55)",
|
|
129
|
-
opacity:
|
|
129
|
+
opacity: i,
|
|
130
130
|
transition: n.active ? "120ms opacity ease-out" : "220ms opacity ease"
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
)
|
|
134
134
|
] });
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
const [f,
|
|
138
|
-
(
|
|
139
|
-
|
|
135
|
+
}, Fe = Xe(
|
|
136
|
+
ye(({ onDragChange: n, className: t, maxVisualDistance: e = 160, size: r = 40, style: i, opacity: l = 1, renderVisual: c }, d) => {
|
|
137
|
+
const [f, h] = Bt(Ve), m = T(null), g = T({ x: 0, y: 0 }), N = T(null), x = T(0), k = P(
|
|
138
|
+
(I) => {
|
|
139
|
+
h(I), n(I);
|
|
140
140
|
},
|
|
141
141
|
[n]
|
|
142
|
-
),
|
|
143
|
-
(
|
|
144
|
-
const { x:
|
|
145
|
-
let
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
active:
|
|
149
|
-
offsetX:
|
|
150
|
-
offsetY:
|
|
151
|
-
distance:
|
|
152
|
-
direction:
|
|
142
|
+
), B = P(
|
|
143
|
+
(I, W, St = !1) => {
|
|
144
|
+
const { x: Dt, y: ot } = g.current, A = I - Dt, G = W - ot, dt = Math.abs(G), It = dt < Te ? 0 : G < 0 ? -1 : 1, v = x.current;
|
|
145
|
+
let kt = It;
|
|
146
|
+
const S = Te + Ue;
|
|
147
|
+
It === 0 ? v !== 0 && dt < S ? kt = v : (kt = 0, St || (x.current = 0)) : It !== v && v !== 0 && dt < S ? kt = v : x.current = It, k({
|
|
148
|
+
active: St || dt >= Te,
|
|
149
|
+
offsetX: A,
|
|
150
|
+
offsetY: G,
|
|
151
|
+
distance: dt,
|
|
152
|
+
direction: kt,
|
|
153
153
|
pointerId: m.current
|
|
154
154
|
});
|
|
155
155
|
},
|
|
156
|
-
[
|
|
157
|
-
),
|
|
158
|
-
if (
|
|
156
|
+
[k]
|
|
157
|
+
), z = P((I) => {
|
|
158
|
+
if (I === null)
|
|
159
159
|
return;
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
}, []), Q =
|
|
163
|
-
(
|
|
164
|
-
|
|
160
|
+
const W = N.current;
|
|
161
|
+
W?.hasPointerCapture(I) && W.releasePointerCapture(I);
|
|
162
|
+
}, []), Q = P(
|
|
163
|
+
(I = !1) => {
|
|
164
|
+
I && z(m.current), m.current = null, x.current = 0, k(Ve);
|
|
165
165
|
},
|
|
166
|
-
[
|
|
167
|
-
),
|
|
168
|
-
(
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
g.current = { x:
|
|
166
|
+
[k, z]
|
|
167
|
+
), pt = P(
|
|
168
|
+
(I) => {
|
|
169
|
+
I.preventDefault(), I.stopPropagation();
|
|
170
|
+
const W = N.current ?? I.currentTarget, { left: St, top: Dt, width: ot, height: A } = W.getBoundingClientRect();
|
|
171
|
+
g.current = { x: St + ot / 2, y: Dt + A / 2 }, m.current = I.pointerId, W.setPointerCapture(I.pointerId), B(I.clientX, I.clientY, !0);
|
|
172
172
|
},
|
|
173
|
-
[
|
|
174
|
-
),
|
|
175
|
-
(
|
|
176
|
-
m.current ===
|
|
173
|
+
[B]
|
|
174
|
+
), ct = P(
|
|
175
|
+
(I) => {
|
|
176
|
+
m.current === I.pointerId && (I.preventDefault(), B(I.clientX, I.clientY));
|
|
177
177
|
},
|
|
178
|
-
[
|
|
179
|
-
),
|
|
180
|
-
(
|
|
181
|
-
m.current ===
|
|
178
|
+
[B]
|
|
179
|
+
), st = P(
|
|
180
|
+
(I) => {
|
|
181
|
+
m.current === I.pointerId && (I.preventDefault(), I.stopPropagation(), Q(!0));
|
|
182
182
|
},
|
|
183
183
|
[Q]
|
|
184
184
|
);
|
|
185
|
-
|
|
185
|
+
we(
|
|
186
186
|
d,
|
|
187
187
|
() => ({
|
|
188
188
|
reset: () => {
|
|
189
189
|
Q(!0);
|
|
190
190
|
},
|
|
191
|
-
getElement: () =>
|
|
191
|
+
getElement: () => N.current
|
|
192
192
|
}),
|
|
193
193
|
[Q]
|
|
194
194
|
);
|
|
195
|
-
const
|
|
195
|
+
const L = Math.min(Math.max(l, 0), 1), tt = r / 64, et = Math.min(f.distance, e) / e, E = f.direction * et * 10 * tt, ut = c ?? $e, Pt = {
|
|
196
196
|
dragState: f,
|
|
197
|
-
normalizedDistance:
|
|
197
|
+
normalizedDistance: et,
|
|
198
198
|
sizeScale: tt,
|
|
199
199
|
size: r,
|
|
200
|
-
opacity:
|
|
201
|
-
},
|
|
202
|
-
...
|
|
200
|
+
opacity: L
|
|
201
|
+
}, ht = {
|
|
202
|
+
...i,
|
|
203
203
|
width: r,
|
|
204
204
|
height: r,
|
|
205
|
-
transform: `translateY(${
|
|
205
|
+
transform: `translateY(${E}px)`
|
|
206
206
|
};
|
|
207
|
-
return
|
|
207
|
+
return ht.opacity = L, /* @__PURE__ */ $(
|
|
208
208
|
"div",
|
|
209
209
|
{
|
|
210
|
-
ref:
|
|
210
|
+
ref: N,
|
|
211
211
|
"data-testid": "virtual-scroll-tap-circle",
|
|
212
|
-
className:
|
|
213
|
-
style:
|
|
212
|
+
className: re("aqvs-tap-scroll-circle", t),
|
|
213
|
+
style: ht,
|
|
214
214
|
tabIndex: -1,
|
|
215
|
-
onPointerDown:
|
|
216
|
-
onPointerMove:
|
|
217
|
-
onPointerUp:
|
|
218
|
-
onPointerCancel:
|
|
215
|
+
onPointerDown: pt,
|
|
216
|
+
onPointerMove: ct,
|
|
217
|
+
onPointerUp: st,
|
|
218
|
+
onPointerCancel: st,
|
|
219
219
|
role: "presentation",
|
|
220
|
-
children:
|
|
220
|
+
children: ut(Pt)
|
|
221
221
|
}
|
|
222
222
|
);
|
|
223
223
|
})
|
|
224
224
|
);
|
|
225
|
-
|
|
226
|
-
const
|
|
225
|
+
Fe.displayName = "TapScrollCircle";
|
|
226
|
+
const xt = (n, t, e) => Math.min(e, Math.max(t, n)), Me = "virtualscroll:tap-scroll-cancel", Ce = 20, Ke = 250, We = 60, je = 20, Ge = 20, Ze = 240, Ee = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, Pe = 2.2, Je = 8, Qe = 120, tr = 1 / 60, Xt = {
|
|
227
227
|
enabled: !0,
|
|
228
228
|
size: 40,
|
|
229
229
|
offsetX: -80,
|
|
@@ -257,267 +257,267 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Se = "virtualscroll:tap-scr
|
|
|
257
257
|
}, rr = (n, t) => {
|
|
258
258
|
const e = n?.maxSpeedMultiplier, r = typeof e == "number" ? e : sr(t);
|
|
259
259
|
return {
|
|
260
|
-
enabled: n?.enabled ??
|
|
261
|
-
size: n?.size ??
|
|
262
|
-
offsetX: n?.offsetX ??
|
|
263
|
-
offsetY: n?.offsetY ??
|
|
264
|
-
className: n?.className ??
|
|
265
|
-
maxVisualDistance: n?.maxVisualDistance ??
|
|
260
|
+
enabled: n?.enabled ?? Xt.enabled,
|
|
261
|
+
size: n?.size ?? Xt.size,
|
|
262
|
+
offsetX: n?.offsetX ?? Xt.offsetX,
|
|
263
|
+
offsetY: n?.offsetY ?? Xt.offsetY,
|
|
264
|
+
className: n?.className ?? Xt.className,
|
|
265
|
+
maxVisualDistance: n?.maxVisualDistance ?? Xt.maxVisualDistance,
|
|
266
266
|
maxSpeedMultiplier: r,
|
|
267
|
-
minSpeedMultiplier: Math.max(n?.minSpeedMultiplier ??
|
|
268
|
-
opacity:
|
|
269
|
-
renderVisual: n?.renderVisual ??
|
|
270
|
-
maxSpeedCurve: n?.maxSpeedCurve ??
|
|
267
|
+
minSpeedMultiplier: Math.max(n?.minSpeedMultiplier ?? Xt.minSpeedMultiplier, 0),
|
|
268
|
+
opacity: xt(n?.opacity ?? Xt.opacity, 0, 1),
|
|
269
|
+
renderVisual: n?.renderVisual ?? Xt.renderVisual,
|
|
270
|
+
maxSpeedCurve: n?.maxSpeedCurve ?? Xt.maxSpeedCurve
|
|
271
271
|
};
|
|
272
|
-
}, nr = ({ isDragging: n, isThumbHovered: t, enableThumbDrag: e }) =>
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
}, []), d =
|
|
272
|
+
}, nr = ({ isDragging: n, isThumbHovered: t, enableThumbDrag: e }) => At(() => e ? n ? "dragging" : t ? "hover" : "idle" : "disabled", [e, n, t]), ir = ({ canUseArrowButtons: n, enableArrowButtons: t, resetTapScroll: e, scrollByStep: r }) => {
|
|
273
|
+
const i = T(null), l = T(null), c = P(() => {
|
|
274
|
+
i.current !== null && (window.clearInterval(i.current), i.current = null), l.current !== null && (window.clearTimeout(l.current), l.current = null);
|
|
275
|
+
}, []), d = P(() => {
|
|
276
276
|
c();
|
|
277
|
-
}, [c]), f =
|
|
277
|
+
}, [c]), f = P(
|
|
278
278
|
(m) => (g) => {
|
|
279
279
|
n && (g.cancelable && g.preventDefault(), g.stopPropagation(), e(), c(), r(m), l.current = window.setTimeout(() => {
|
|
280
|
-
|
|
280
|
+
i.current = window.setInterval(() => {
|
|
281
281
|
r(m);
|
|
282
282
|
}, We);
|
|
283
283
|
}, Ke));
|
|
284
284
|
},
|
|
285
285
|
[n, c, e, r]
|
|
286
|
-
),
|
|
286
|
+
), h = P(
|
|
287
287
|
(m) => (g) => {
|
|
288
288
|
t && (g.key === "Enter" || g.key === " " || g.key === "Spacebar") && (g.preventDefault(), r(m));
|
|
289
289
|
},
|
|
290
290
|
[t, r]
|
|
291
291
|
);
|
|
292
|
-
return
|
|
292
|
+
return Y(() => () => {
|
|
293
293
|
c();
|
|
294
|
-
}, [c]), { handleArrowPointerDown: f, handleArrowPointerUp: d, handleArrowKeyDown:
|
|
294
|
+
}, [c]), { handleArrowPointerDown: f, handleArrowPointerUp: d, handleArrowKeyDown: h };
|
|
295
295
|
}, sr = (n) => {
|
|
296
296
|
if (!n || n <= 0)
|
|
297
|
-
return
|
|
298
|
-
const t = Math.max(1, n), e = Math.log10(t), r =
|
|
299
|
-
return
|
|
297
|
+
return Pe;
|
|
298
|
+
const t = Math.max(1, n), e = Math.log10(t), r = Pe + e * Je;
|
|
299
|
+
return xt(r, Pe, Qe);
|
|
300
300
|
}, or = ({
|
|
301
301
|
contentSize: n,
|
|
302
302
|
viewportSize: t,
|
|
303
303
|
scrollPosition: e,
|
|
304
304
|
onScroll: r,
|
|
305
|
-
enableThumbDrag:
|
|
305
|
+
enableThumbDrag: i = !0,
|
|
306
306
|
enableTrackClick: l = !0,
|
|
307
307
|
enableArrowButtons: c = !0,
|
|
308
308
|
horizontal: d = !1,
|
|
309
309
|
scrollBarWidth: f = 12,
|
|
310
|
-
className:
|
|
310
|
+
className: h,
|
|
311
311
|
ariaControls: m,
|
|
312
312
|
tapScrollCircleOptions: g,
|
|
313
|
-
itemCount:
|
|
313
|
+
itemCount: N,
|
|
314
314
|
renderThumbOverlay: x,
|
|
315
|
-
visibleStartIndex:
|
|
316
|
-
visibleEndIndex:
|
|
315
|
+
visibleStartIndex: k,
|
|
316
|
+
visibleEndIndex: B
|
|
317
317
|
}) => {
|
|
318
|
-
const [
|
|
319
|
-
enabled:
|
|
320
|
-
size:
|
|
321
|
-
offsetX:
|
|
322
|
-
offsetY:
|
|
323
|
-
className:
|
|
324
|
-
maxVisualDistance:
|
|
325
|
-
maxSpeedMultiplier:
|
|
326
|
-
minSpeedMultiplier:
|
|
327
|
-
opacity:
|
|
328
|
-
renderVisual:
|
|
329
|
-
maxSpeedCurve:
|
|
330
|
-
} =
|
|
318
|
+
const [z, Q] = Bt(!1), [pt, ct] = Bt(!1), [st, L] = Bt(!1), tt = T(null), et = T({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), E = T({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), ut = T(e), Pt = T(r), ht = T(Ee), I = T(null), W = T(null), St = T(null), Dt = At(() => rr(g, N), [N, g]), ot = At(() => er(d), [d]), {
|
|
319
|
+
enabled: A,
|
|
320
|
+
size: G,
|
|
321
|
+
offsetX: dt,
|
|
322
|
+
offsetY: It,
|
|
323
|
+
className: v,
|
|
324
|
+
maxVisualDistance: kt,
|
|
325
|
+
maxSpeedMultiplier: S,
|
|
326
|
+
minSpeedMultiplier: rt,
|
|
327
|
+
opacity: Vt,
|
|
328
|
+
renderVisual: Gt,
|
|
329
|
+
maxSpeedCurve: Mt
|
|
330
|
+
} = Dt, b = T({
|
|
331
331
|
viewportSize: t,
|
|
332
332
|
maxScrollPosition: Math.max(n - t, 0),
|
|
333
333
|
scrollBarVisible: n > t,
|
|
334
|
-
effectiveTapMaxDistance: Math.max(
|
|
335
|
-
tapCircleMaxSpeedMultiplier:
|
|
336
|
-
tapCircleMinSpeedMultiplier:
|
|
337
|
-
tapCircleMaxSpeedCurve:
|
|
334
|
+
effectiveTapMaxDistance: Math.max(kt, 1),
|
|
335
|
+
tapCircleMaxSpeedMultiplier: S,
|
|
336
|
+
tapCircleMinSpeedMultiplier: rt,
|
|
337
|
+
tapCircleMaxSpeedCurve: Mt,
|
|
338
338
|
tapScrollCircleOptions: g,
|
|
339
339
|
effectiveTrackLength: 0,
|
|
340
340
|
onScroll: r,
|
|
341
341
|
scrollPosition: e
|
|
342
|
-
}), { mainSizeKey:
|
|
343
|
-
|
|
344
|
-
|
|
342
|
+
}), { mainSizeKey: M, crossSizeKey: q, positionKey: ft, selectDelta: j, getPointerCoordinate: mt, arrowLabels: Z, arrowIcons: J, directionClass: bt, orientation: qt } = ot, yt = Math.max(kt, 1), Tt = t / n, Ct = Math.max(t - f * 2, 0), _t = Tt * Ct, at = Math.min(Math.max(Ce, _t || 0), Ct || Ce), p = n - t, y = Math.max(Ct - at, 0), nt = p <= 0 || y <= 0 ? 0 : e / p * y, Lt = nt + at / 2, H = n > t || z, Zt = H && c;
|
|
343
|
+
oe(() => {
|
|
344
|
+
b.current = {
|
|
345
345
|
viewportSize: t,
|
|
346
|
-
maxScrollPosition:
|
|
347
|
-
scrollBarVisible:
|
|
348
|
-
effectiveTapMaxDistance:
|
|
349
|
-
tapCircleMaxSpeedMultiplier:
|
|
350
|
-
tapCircleMinSpeedMultiplier:
|
|
351
|
-
tapCircleMaxSpeedCurve:
|
|
346
|
+
maxScrollPosition: p,
|
|
347
|
+
scrollBarVisible: H,
|
|
348
|
+
effectiveTapMaxDistance: yt,
|
|
349
|
+
tapCircleMaxSpeedMultiplier: S,
|
|
350
|
+
tapCircleMinSpeedMultiplier: rt,
|
|
351
|
+
tapCircleMaxSpeedCurve: Mt,
|
|
352
352
|
tapScrollCircleOptions: g,
|
|
353
|
-
effectiveTrackLength:
|
|
353
|
+
effectiveTrackLength: y,
|
|
354
354
|
onScroll: r,
|
|
355
355
|
scrollPosition: e
|
|
356
356
|
};
|
|
357
|
-
}),
|
|
358
|
-
|
|
359
|
-
}, [e]),
|
|
360
|
-
|
|
361
|
-
}, [r]),
|
|
362
|
-
|
|
363
|
-
}, [
|
|
364
|
-
const
|
|
365
|
-
const
|
|
366
|
-
if (
|
|
367
|
-
const
|
|
368
|
-
if (typeof
|
|
369
|
-
return
|
|
357
|
+
}), oe(() => {
|
|
358
|
+
ut.current = e;
|
|
359
|
+
}, [e]), oe(() => {
|
|
360
|
+
Pt.current = r;
|
|
361
|
+
}, [r]), Y(() => {
|
|
362
|
+
i || ct(!1);
|
|
363
|
+
}, [i]);
|
|
364
|
+
const Ft = nr({ isDragging: z, isThumbHovered: pt, enableThumbDrag: i }), wt = P((o, w) => {
|
|
365
|
+
const V = b.current, K = w ?? ut.current;
|
|
366
|
+
if (Pt.current) {
|
|
367
|
+
const R = Pt.current(o, K);
|
|
368
|
+
if (typeof R == "number" && Number.isFinite(R))
|
|
369
|
+
return ut.current = R, R;
|
|
370
370
|
}
|
|
371
|
-
const
|
|
372
|
-
return
|
|
373
|
-
}, []),
|
|
371
|
+
const s = typeof o == "function" ? o(K) : o, a = Math.max(V.maxScrollPosition, 0), u = V.scrollBarVisible ? xt(s, 0, a) : 0;
|
|
372
|
+
return ut.current = u, u;
|
|
373
|
+
}, []), Ht = P(
|
|
374
374
|
(o) => {
|
|
375
|
-
const
|
|
376
|
-
if (!
|
|
377
|
-
const
|
|
378
|
-
return { nextPosition:
|
|
375
|
+
const w = b.current, V = ut.current;
|
|
376
|
+
if (!w.scrollBarVisible || w.maxScrollPosition <= 0) {
|
|
377
|
+
const R = wt(0, V), D = R - V;
|
|
378
|
+
return { nextPosition: R, actualDelta: D, reachedBoundary: !0 };
|
|
379
379
|
}
|
|
380
380
|
if (o === 0)
|
|
381
|
-
return { nextPosition:
|
|
382
|
-
const
|
|
383
|
-
return { nextPosition:
|
|
381
|
+
return { nextPosition: V, actualDelta: 0, reachedBoundary: !1 };
|
|
382
|
+
const s = wt((R) => xt(R + o, 0, w.maxScrollPosition), V), a = s - V, u = a === 0 || o < 0 && s <= 0 || o > 0 && s >= w.maxScrollPosition;
|
|
383
|
+
return { nextPosition: s, actualDelta: a, reachedBoundary: u };
|
|
384
384
|
},
|
|
385
|
-
[
|
|
386
|
-
),
|
|
387
|
-
|
|
388
|
-
}, []), Rt =
|
|
389
|
-
|
|
390
|
-
}, [
|
|
385
|
+
[wt]
|
|
386
|
+
), gt = P(() => {
|
|
387
|
+
W.current !== null && (window.cancelAnimationFrame(W.current), W.current = null), St.current = null;
|
|
388
|
+
}, []), Rt = P(() => {
|
|
389
|
+
ht.current = { ...Ee }, L(!1), I.current?.reset(), gt();
|
|
390
|
+
}, [gt]), Jt = P(
|
|
391
391
|
(o) => {
|
|
392
|
-
const
|
|
393
|
-
if (!
|
|
394
|
-
|
|
392
|
+
const w = ht.current, V = b.current;
|
|
393
|
+
if (!w.active || w.direction === 0) {
|
|
394
|
+
gt();
|
|
395
395
|
return;
|
|
396
396
|
}
|
|
397
|
-
if (!
|
|
398
|
-
|
|
397
|
+
if (!V.scrollBarVisible || V.maxScrollPosition <= 0) {
|
|
398
|
+
gt();
|
|
399
399
|
return;
|
|
400
400
|
}
|
|
401
|
-
const
|
|
402
|
-
if (
|
|
403
|
-
|
|
401
|
+
const K = St.current ?? o, s = Math.max((o - K) / 1e3, 0), a = Math.min(s, tr);
|
|
402
|
+
if (St.current = o, a <= 0) {
|
|
403
|
+
W.current = window.requestAnimationFrame(Jt);
|
|
404
404
|
return;
|
|
405
405
|
}
|
|
406
|
-
const
|
|
407
|
-
let
|
|
408
|
-
const
|
|
409
|
-
if (
|
|
410
|
-
const
|
|
411
|
-
|
|
406
|
+
const u = Math.min(w.distance, V.effectiveTapMaxDistance) / V.effectiveTapMaxDistance, R = u ** 1.1, D = typeof V.tapScrollCircleOptions?.maxSpeedMultiplier == "number", C = Math.max(V.viewportSize * V.tapCircleMinSpeedMultiplier, 40), X = D ? C : 1200;
|
|
407
|
+
let F = Math.max(V.viewportSize * V.tapCircleMaxSpeedMultiplier, X);
|
|
408
|
+
const O = V.tapCircleMaxSpeedCurve;
|
|
409
|
+
if (O) {
|
|
410
|
+
const xe = Math.max(O.exponentialSteepness, 0), Oe = Math.max(O.exponentialScale ?? V.tapCircleMaxSpeedMultiplier, 0), Ye = xe === 0 ? u : Math.expm1(xe * u), Re = xe === 0 ? 1 : Math.expm1(xe) || 1, ze = Re === 0 ? u : Math.min(Math.max(Ye / Re, 0), 1), qe = V.viewportSize * Oe * ze;
|
|
411
|
+
F = Math.min(F, Math.max(qe, C));
|
|
412
412
|
}
|
|
413
|
-
const
|
|
414
|
-
if (Le ||
|
|
415
|
-
|
|
413
|
+
const Et = Math.max(F, C), vt = Math.max(O?.easedOffset ?? 0, 0), zt = Math.min(1, R + vt), te = C + (Et - C) * zt, ue = w.direction * te * a, { actualDelta: de, reachedBoundary: Le } = Ht(ue);
|
|
414
|
+
if (Le || de === 0) {
|
|
415
|
+
gt();
|
|
416
416
|
return;
|
|
417
417
|
}
|
|
418
|
-
|
|
418
|
+
W.current = window.requestAnimationFrame(Jt);
|
|
419
419
|
},
|
|
420
|
-
[
|
|
421
|
-
),
|
|
422
|
-
|
|
423
|
-
}, [
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
}, [
|
|
427
|
-
const
|
|
420
|
+
[Ht, gt]
|
|
421
|
+
), ae = P(() => {
|
|
422
|
+
W.current === null && (St.current = null, W.current = window.requestAnimationFrame(Jt));
|
|
423
|
+
}, [Jt]);
|
|
424
|
+
Y(() => () => {
|
|
425
|
+
gt();
|
|
426
|
+
}, [gt]);
|
|
427
|
+
const lt = P(
|
|
428
428
|
(o) => {
|
|
429
|
-
|
|
429
|
+
ht.current = o, L(o.active), o.active && o.direction !== 0 ? ae() : gt();
|
|
430
430
|
},
|
|
431
|
-
[
|
|
431
|
+
[ae, gt]
|
|
432
432
|
);
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
}, [Rt,
|
|
436
|
-
const o = (
|
|
437
|
-
const
|
|
438
|
-
|
|
433
|
+
Y(() => {
|
|
434
|
+
A || Rt();
|
|
435
|
+
}, [Rt, A]), Y(() => {
|
|
436
|
+
const o = (w) => {
|
|
437
|
+
const K = w.detail?.paneId;
|
|
438
|
+
K && m && K !== m || Rt();
|
|
439
439
|
};
|
|
440
|
-
return window.addEventListener(
|
|
441
|
-
window.removeEventListener(
|
|
440
|
+
return window.addEventListener(Me, o), () => {
|
|
441
|
+
window.removeEventListener(Me, o);
|
|
442
442
|
};
|
|
443
|
-
}, [m, Rt]),
|
|
444
|
-
if (!
|
|
443
|
+
}, [m, Rt]), Y(() => {
|
|
444
|
+
if (!A)
|
|
445
445
|
return;
|
|
446
|
-
const o = (
|
|
447
|
-
if (!
|
|
446
|
+
const o = (w) => {
|
|
447
|
+
if (!ht.current.active || ht.current.pointerId === w.pointerId)
|
|
448
448
|
return;
|
|
449
|
-
const
|
|
450
|
-
if (!(
|
|
449
|
+
const V = w.target;
|
|
450
|
+
if (!(V instanceof Node)) {
|
|
451
451
|
Rt();
|
|
452
452
|
return;
|
|
453
453
|
}
|
|
454
|
-
|
|
454
|
+
I.current?.getElement()?.contains(V) || Rt();
|
|
455
455
|
};
|
|
456
456
|
return document.addEventListener("pointerdown", o, !0), () => {
|
|
457
457
|
document.removeEventListener("pointerdown", o, !0);
|
|
458
458
|
};
|
|
459
|
-
}, [Rt,
|
|
459
|
+
}, [Rt, A]);
|
|
460
460
|
const le = (o) => {
|
|
461
|
-
if (!
|
|
461
|
+
if (!H || y <= 0 || p <= 0)
|
|
462
462
|
return 0;
|
|
463
|
-
const
|
|
464
|
-
return
|
|
465
|
-
},
|
|
466
|
-
const { scrollBarVisible:
|
|
467
|
-
if (_.debug("[ScrollBar] calculateScrollPositionFromThumb", { thumbPos: o, trackLen:
|
|
463
|
+
const w = xt(o, 0, y);
|
|
464
|
+
return xt(w / y * p, 0, p);
|
|
465
|
+
}, ce = P((o) => {
|
|
466
|
+
const { scrollBarVisible: w, effectiveTrackLength: V, maxScrollPosition: K } = b.current;
|
|
467
|
+
if (_.debug("[ScrollBar] calculateScrollPositionFromThumb", { thumbPos: o, trackLen: V, maxScroll: K }), V <= 0 || K <= 0)
|
|
468
468
|
return null;
|
|
469
|
-
const
|
|
470
|
-
return
|
|
471
|
-
}, []),
|
|
469
|
+
const s = xt(o, 0, V);
|
|
470
|
+
return xt(s / V * K, 0, K);
|
|
471
|
+
}, []), Nt = P(
|
|
472
472
|
(o) => {
|
|
473
|
-
const
|
|
474
|
-
if (
|
|
473
|
+
const w = et.current;
|
|
474
|
+
if (w.pointerId !== o.pointerId)
|
|
475
475
|
return;
|
|
476
|
-
const
|
|
476
|
+
const V = o.clientX - w.startClientX, K = o.clientY - w.startClientY, s = j(V, K);
|
|
477
477
|
_.debug("[ScrollBar] handleThumbPointerMove", {
|
|
478
|
-
delta:
|
|
479
|
-
startThumbPosition:
|
|
478
|
+
delta: s,
|
|
479
|
+
startThumbPosition: w.startThumbPosition,
|
|
480
480
|
clientY: o.clientY,
|
|
481
|
-
startClientY:
|
|
482
|
-
metrics:
|
|
481
|
+
startClientY: w.startClientY,
|
|
482
|
+
metrics: b.current
|
|
483
483
|
});
|
|
484
|
-
const
|
|
485
|
-
|
|
484
|
+
const a = ce(w.startThumbPosition + s);
|
|
485
|
+
a !== null && wt(a), o.cancelable && o.preventDefault();
|
|
486
486
|
},
|
|
487
|
-
[
|
|
488
|
-
),
|
|
487
|
+
[j, ce, wt]
|
|
488
|
+
), ee = P(
|
|
489
489
|
(o) => {
|
|
490
|
-
if (
|
|
491
|
-
if (document.removeEventListener("pointermove",
|
|
492
|
-
const
|
|
493
|
-
o.clientX >=
|
|
490
|
+
if (et.current.pointerId === o.pointerId)
|
|
491
|
+
if (document.removeEventListener("pointermove", Nt), document.removeEventListener("pointerup", ee), document.removeEventListener("pointercancel", ee), et.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, Q(!1), tt.current) {
|
|
492
|
+
const V = tt.current.getBoundingClientRect();
|
|
493
|
+
o.clientX >= V.left && o.clientX <= V.right && o.clientY >= V.top && o.clientY <= V.bottom || ct(!1);
|
|
494
494
|
} else
|
|
495
|
-
|
|
495
|
+
ct(!1);
|
|
496
496
|
},
|
|
497
|
-
[
|
|
498
|
-
),
|
|
499
|
-
const
|
|
500
|
-
|
|
501
|
-
}, { handleArrowPointerDown:
|
|
502
|
-
canUseArrowButtons:
|
|
497
|
+
[Nt]
|
|
498
|
+
), me = (o) => {
|
|
499
|
+
const w = Math.max(Math.round(t / Ge), je);
|
|
500
|
+
Ht(o * w);
|
|
501
|
+
}, { handleArrowPointerDown: Ie, handleArrowPointerUp: Ot, handleArrowKeyDown: Qt } = ir({
|
|
502
|
+
canUseArrowButtons: Zt,
|
|
503
503
|
enableArrowButtons: c,
|
|
504
504
|
resetTapScroll: Rt,
|
|
505
|
-
scrollByStep:
|
|
506
|
-
}),
|
|
507
|
-
if (
|
|
508
|
-
if (!
|
|
505
|
+
scrollByStep: me
|
|
506
|
+
}), Ut = (o) => {
|
|
507
|
+
if (H) {
|
|
508
|
+
if (!i) {
|
|
509
509
|
o.preventDefault(), o.stopPropagation();
|
|
510
510
|
return;
|
|
511
511
|
}
|
|
512
|
-
o.pointerType === "mouse" && o.button !== 0 || o.ctrlKey || (Rt(),
|
|
512
|
+
o.pointerType === "mouse" && o.button !== 0 || o.ctrlKey || (Rt(), et.current = {
|
|
513
513
|
pointerId: o.pointerId,
|
|
514
|
-
startThumbPosition:
|
|
514
|
+
startThumbPosition: nt,
|
|
515
515
|
startClientX: o.clientX,
|
|
516
516
|
startClientY: o.clientY
|
|
517
|
-
}, document.addEventListener("pointermove",
|
|
517
|
+
}, document.addEventListener("pointermove", Nt), document.addEventListener("pointerup", ee), document.addEventListener("pointercancel", ee), Q(!0), ct(!0), o.preventDefault(), o.stopPropagation());
|
|
518
518
|
}
|
|
519
|
-
},
|
|
520
|
-
if (!
|
|
519
|
+
}, $t = (o) => {
|
|
520
|
+
if (!H)
|
|
521
521
|
return;
|
|
522
522
|
if (!l) {
|
|
523
523
|
o.preventDefault(), o.stopPropagation();
|
|
@@ -525,150 +525,150 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Se = "virtualscroll:tap-scr
|
|
|
525
525
|
}
|
|
526
526
|
if (o.pointerType === "mouse" && o.button !== 0 || o.ctrlKey)
|
|
527
527
|
return;
|
|
528
|
-
const
|
|
528
|
+
const w = o.currentTarget, V = w.getBoundingClientRect(), s = mt(o) - (d ? V.left : V.top);
|
|
529
529
|
Rt();
|
|
530
|
-
const
|
|
531
|
-
|
|
530
|
+
const a = s - at / 2, u = le(a);
|
|
531
|
+
wt(u), w.setPointerCapture && w.setPointerCapture(o.pointerId), E.current = {
|
|
532
532
|
pointerId: o.pointerId,
|
|
533
|
-
startThumbPosition:
|
|
533
|
+
startThumbPosition: a,
|
|
534
534
|
startClientX: o.clientX,
|
|
535
535
|
startClientY: o.clientY
|
|
536
536
|
}, o.preventDefault(), o.stopPropagation();
|
|
537
|
-
},
|
|
538
|
-
const
|
|
539
|
-
if (
|
|
537
|
+
}, Yt = (o) => {
|
|
538
|
+
const w = E.current;
|
|
539
|
+
if (w.pointerId !== o.pointerId)
|
|
540
540
|
return;
|
|
541
|
-
const
|
|
542
|
-
|
|
543
|
-
},
|
|
544
|
-
if (
|
|
541
|
+
const V = o.clientX - w.startClientX, K = o.clientY - w.startClientY, s = j(V, K), a = le(w.startThumbPosition + s);
|
|
542
|
+
wt(a), o.cancelable && o.preventDefault();
|
|
543
|
+
}, Kt = (o) => {
|
|
544
|
+
if (E.current.pointerId !== o.pointerId)
|
|
545
545
|
return;
|
|
546
|
-
const
|
|
547
|
-
|
|
548
|
-
},
|
|
549
|
-
if (
|
|
546
|
+
const w = o.currentTarget;
|
|
547
|
+
w.hasPointerCapture(o.pointerId) && w.releasePointerCapture(o.pointerId), E.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, o.preventDefault(), o.stopPropagation();
|
|
548
|
+
}, Wt = (o) => {
|
|
549
|
+
if (E.current.pointerId !== o.pointerId)
|
|
550
550
|
return;
|
|
551
|
-
const
|
|
552
|
-
|
|
553
|
-
}, pe =
|
|
554
|
-
const
|
|
551
|
+
const w = o.currentTarget;
|
|
552
|
+
w.hasPointerCapture(o.pointerId) && w.releasePointerCapture(o.pointerId), E.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 };
|
|
553
|
+
}, pe = At(() => xt((st ? 1 : 0.8) * Vt, 0, 1), [st, Vt]), he = At(() => {
|
|
554
|
+
const w = `calc(50% - ${G / 2}px + ${It}px)`;
|
|
555
555
|
return {
|
|
556
|
-
left:
|
|
557
|
-
top:
|
|
556
|
+
left: dt,
|
|
557
|
+
top: w
|
|
558
558
|
};
|
|
559
|
-
}, [
|
|
559
|
+
}, [dt, It, G]), ge = (o, w, V, K) => /* @__PURE__ */ $(
|
|
560
560
|
"button",
|
|
561
561
|
{
|
|
562
562
|
type: "button",
|
|
563
563
|
tabIndex: -1,
|
|
564
564
|
className: "aqvs-scrollbar-arrow-button",
|
|
565
565
|
style: {
|
|
566
|
-
[
|
|
567
|
-
[
|
|
566
|
+
[M]: f,
|
|
567
|
+
[q]: f
|
|
568
568
|
},
|
|
569
|
-
"aria-label":
|
|
570
|
-
onPointerDown:
|
|
571
|
-
onPointerUp:
|
|
572
|
-
onPointerLeave:
|
|
573
|
-
onPointerCancel:
|
|
574
|
-
onKeyDown:
|
|
569
|
+
"aria-label": w,
|
|
570
|
+
onPointerDown: Ie(o),
|
|
571
|
+
onPointerUp: Ot,
|
|
572
|
+
onPointerLeave: Ot,
|
|
573
|
+
onPointerCancel: Ot,
|
|
574
|
+
onKeyDown: Qt(o),
|
|
575
575
|
"aria-disabled": !c,
|
|
576
|
-
disabled: !
|
|
577
|
-
children: /* @__PURE__ */ $("span", { "aria-hidden": "true", children:
|
|
576
|
+
disabled: !Zt,
|
|
577
|
+
children: /* @__PURE__ */ $("span", { "aria-hidden": "true", children: V })
|
|
578
578
|
},
|
|
579
|
-
|
|
580
|
-
),
|
|
581
|
-
orientation:
|
|
579
|
+
K
|
|
580
|
+
), ie = x && H ? {
|
|
581
|
+
orientation: qt,
|
|
582
582
|
scrollPosition: e,
|
|
583
|
-
maxScrollPosition:
|
|
583
|
+
maxScrollPosition: p,
|
|
584
584
|
contentSize: n,
|
|
585
585
|
viewportSize: t,
|
|
586
|
-
thumbSize:
|
|
587
|
-
thumbPosition:
|
|
588
|
-
thumbCenter:
|
|
589
|
-
trackSize:
|
|
590
|
-
isDragging:
|
|
591
|
-
isTapScrollActive:
|
|
592
|
-
visibleStartIndex:
|
|
593
|
-
visibleEndIndex:
|
|
586
|
+
thumbSize: at,
|
|
587
|
+
thumbPosition: nt,
|
|
588
|
+
thumbCenter: Lt,
|
|
589
|
+
trackSize: Ct,
|
|
590
|
+
isDragging: z,
|
|
591
|
+
isTapScrollActive: st,
|
|
592
|
+
visibleStartIndex: k,
|
|
593
|
+
visibleEndIndex: B
|
|
594
594
|
} : null;
|
|
595
|
-
return /* @__PURE__ */
|
|
595
|
+
return /* @__PURE__ */ ne(
|
|
596
596
|
"div",
|
|
597
597
|
{
|
|
598
|
-
className:
|
|
598
|
+
className: re("aqvs-scrollbar", bt, !H && "pointer-events-none opacity-0", h),
|
|
599
599
|
style: {
|
|
600
|
-
[
|
|
601
|
-
[
|
|
600
|
+
[M]: t,
|
|
601
|
+
[q]: f
|
|
602
602
|
},
|
|
603
603
|
role: "scrollbar",
|
|
604
604
|
tabIndex: -1,
|
|
605
605
|
"aria-controls": m,
|
|
606
606
|
"aria-valuenow": e,
|
|
607
607
|
"aria-valuemin": 0,
|
|
608
|
-
"aria-valuemax":
|
|
608
|
+
"aria-valuemax": p,
|
|
609
609
|
"aria-orientation": d ? "horizontal" : "vertical",
|
|
610
610
|
children: [
|
|
611
|
-
!d &&
|
|
612
|
-
|
|
611
|
+
!d && H && A && /* @__PURE__ */ $(
|
|
612
|
+
Fe,
|
|
613
613
|
{
|
|
614
|
-
ref:
|
|
615
|
-
className:
|
|
616
|
-
size:
|
|
617
|
-
maxVisualDistance:
|
|
618
|
-
style:
|
|
614
|
+
ref: I,
|
|
615
|
+
className: re("aqvs-scrollbar-tap-circle-wrapper", v),
|
|
616
|
+
size: G,
|
|
617
|
+
maxVisualDistance: yt,
|
|
618
|
+
style: he,
|
|
619
619
|
opacity: pe,
|
|
620
|
-
renderVisual:
|
|
621
|
-
onDragChange:
|
|
620
|
+
renderVisual: Gt,
|
|
621
|
+
onDragChange: lt
|
|
622
622
|
},
|
|
623
623
|
"tap-circle"
|
|
624
624
|
),
|
|
625
|
-
|
|
626
|
-
/* @__PURE__ */
|
|
625
|
+
ge(-1, Z[0], J[0], "arrow-start"),
|
|
626
|
+
/* @__PURE__ */ ne(
|
|
627
627
|
"div",
|
|
628
628
|
{
|
|
629
629
|
className: "aqvs-scrollbar-track",
|
|
630
630
|
style: {
|
|
631
631
|
borderRadius: f / 2
|
|
632
632
|
},
|
|
633
|
-
onPointerDown:
|
|
634
|
-
onPointerMove:
|
|
635
|
-
onPointerUp:
|
|
636
|
-
onPointerCancel:
|
|
633
|
+
onPointerDown: $t,
|
|
634
|
+
onPointerMove: Yt,
|
|
635
|
+
onPointerUp: Kt,
|
|
636
|
+
onPointerCancel: Wt,
|
|
637
637
|
"aria-disabled": !l,
|
|
638
638
|
children: [
|
|
639
|
-
|
|
639
|
+
ie && /* @__PURE__ */ $("div", { className: "aqvs-scrollbar-overlay", "aria-hidden": !0, children: x?.(ie) }, "overlay"),
|
|
640
640
|
/* @__PURE__ */ $(
|
|
641
641
|
"div",
|
|
642
642
|
{
|
|
643
|
-
className:
|
|
643
|
+
className: re("aqvs-scrollbar-thumb-wrapper", !(H || z) && "pointer-events-none opacity-0"),
|
|
644
644
|
style: {
|
|
645
|
-
[
|
|
646
|
-
[
|
|
645
|
+
[M]: at,
|
|
646
|
+
[ft]: nt,
|
|
647
647
|
...d ? { top: 0, bottom: 0 } : { left: 0, right: 0 }
|
|
648
648
|
},
|
|
649
|
-
onPointerDown:
|
|
649
|
+
onPointerDown: Ut,
|
|
650
650
|
role: "slider",
|
|
651
651
|
"aria-orientation": d ? "horizontal" : "vertical",
|
|
652
652
|
"aria-valuenow": e,
|
|
653
653
|
"aria-valuemin": 0,
|
|
654
|
-
"aria-valuemax":
|
|
655
|
-
"aria-disabled": !
|
|
654
|
+
"aria-valuemax": p,
|
|
655
|
+
"aria-disabled": !i,
|
|
656
656
|
tabIndex: -1,
|
|
657
657
|
children: /* @__PURE__ */ $(
|
|
658
658
|
"div",
|
|
659
659
|
{
|
|
660
660
|
ref: tt,
|
|
661
|
-
className:
|
|
662
|
-
"data-thumb-state":
|
|
661
|
+
className: re("aqvs-scrollbar-thumb", d ? "aqvs-scrollbar-thumb-horizontal" : "aqvs-scrollbar-thumb-vertical"),
|
|
662
|
+
"data-thumb-state": Ft,
|
|
663
663
|
style: {
|
|
664
664
|
borderRadius: f - 1,
|
|
665
|
-
cursor:
|
|
665
|
+
cursor: i ? "pointer" : "default"
|
|
666
666
|
},
|
|
667
667
|
onMouseEnter: () => {
|
|
668
|
-
|
|
668
|
+
i && ct(!0);
|
|
669
669
|
},
|
|
670
670
|
onMouseLeave: () => {
|
|
671
|
-
|
|
671
|
+
i && ct(!1);
|
|
672
672
|
}
|
|
673
673
|
},
|
|
674
674
|
"thumb"
|
|
@@ -680,172 +680,186 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Se = "virtualscroll:tap-scr
|
|
|
680
680
|
},
|
|
681
681
|
"track"
|
|
682
682
|
),
|
|
683
|
-
|
|
683
|
+
ge(1, Z[1], J[1], "arrow-end")
|
|
684
684
|
]
|
|
685
685
|
}
|
|
686
686
|
);
|
|
687
|
-
},
|
|
687
|
+
}, fe = {
|
|
688
688
|
maxVelocity: 6,
|
|
689
689
|
minVelocity: 0.02,
|
|
690
690
|
deceleration: 25e-4,
|
|
691
691
|
velocitySampleWindow: 90,
|
|
692
692
|
startVelocityThreshold: 0.04
|
|
693
|
-
},
|
|
694
|
-
for (const [r,
|
|
695
|
-
e === "add" ? n.addEventListener(r,
|
|
696
|
-
}, ar =
|
|
693
|
+
}, be = (n, t, e) => {
|
|
694
|
+
for (const [r, i, l] of t)
|
|
695
|
+
e === "add" ? n.addEventListener(r, i, l) : n.removeEventListener(r, i, l);
|
|
696
|
+
}, ar = ye(
|
|
697
697
|
({
|
|
698
698
|
children: n,
|
|
699
699
|
contentSize: t,
|
|
700
700
|
viewportSize: e,
|
|
701
701
|
scrollBarWidth: r = 12,
|
|
702
|
-
enableThumbDrag:
|
|
702
|
+
enableThumbDrag: i = !0,
|
|
703
703
|
enableTrackClick: l = !0,
|
|
704
704
|
enableArrowButtons: c = !0,
|
|
705
705
|
enablePointerDrag: d = !0,
|
|
706
706
|
onScroll: f,
|
|
707
|
-
className:
|
|
707
|
+
className: h,
|
|
708
708
|
style: m,
|
|
709
709
|
background: g,
|
|
710
|
-
tapScrollCircleOptions:
|
|
710
|
+
tapScrollCircleOptions: N,
|
|
711
711
|
inertiaOptions: x,
|
|
712
|
-
itemCount:
|
|
713
|
-
renderThumbOverlay:
|
|
714
|
-
wheelSpeedMultiplier:
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
712
|
+
itemCount: k,
|
|
713
|
+
renderThumbOverlay: B,
|
|
714
|
+
wheelSpeedMultiplier: z = 1,
|
|
715
|
+
onWheelHorizontal: Q,
|
|
716
|
+
contentInsets: pt,
|
|
717
|
+
visibleStartIndex: ct,
|
|
718
|
+
visibleEndIndex: st,
|
|
719
|
+
renderOverlay: L,
|
|
720
|
+
initialScrollPosition: tt = 0
|
|
721
|
+
}, et) => {
|
|
722
|
+
const E = T(tt), ut = T(null), Pt = T(null), ht = T(Q);
|
|
723
|
+
Y(() => {
|
|
724
|
+
ht.current = Q;
|
|
725
|
+
}, [Q]);
|
|
726
|
+
const I = T({
|
|
722
727
|
frame: null,
|
|
723
728
|
velocity: 0,
|
|
724
729
|
lastTimestamp: null
|
|
725
|
-
}),
|
|
730
|
+
}), W = At(
|
|
726
731
|
() => ({
|
|
727
|
-
maxVelocity: x?.maxVelocity ??
|
|
728
|
-
minVelocity: x?.minVelocity ??
|
|
729
|
-
deceleration: x?.deceleration ??
|
|
730
|
-
velocitySampleWindow: x?.velocitySampleWindow ??
|
|
731
|
-
startVelocityThreshold: x?.startVelocityThreshold ??
|
|
732
|
+
maxVelocity: x?.maxVelocity ?? fe.maxVelocity,
|
|
733
|
+
minVelocity: x?.minVelocity ?? fe.minVelocity,
|
|
734
|
+
deceleration: x?.deceleration ?? fe.deceleration,
|
|
735
|
+
velocitySampleWindow: x?.velocitySampleWindow ?? fe.velocitySampleWindow,
|
|
736
|
+
startVelocityThreshold: x?.startVelocityThreshold ?? fe.startVelocityThreshold
|
|
732
737
|
}),
|
|
733
738
|
[x]
|
|
734
|
-
),
|
|
735
|
-
top: Math.max(0,
|
|
736
|
-
bottom: Math.max(0,
|
|
737
|
-
}), [
|
|
739
|
+
), St = At(() => ({
|
|
740
|
+
top: Math.max(0, pt?.top ?? 0),
|
|
741
|
+
bottom: Math.max(0, pt?.bottom ?? 0)
|
|
742
|
+
}), [pt]);
|
|
738
743
|
_.debug("[ScrollPane] ScrollPane rendered", {
|
|
739
744
|
contentSize: t,
|
|
740
745
|
viewportSize: e,
|
|
741
746
|
scrollBarWidth: r,
|
|
742
|
-
className:
|
|
747
|
+
className: h,
|
|
743
748
|
style: m,
|
|
744
|
-
tapScrollCircleOptions:
|
|
749
|
+
tapScrollCircleOptions: N,
|
|
745
750
|
inertiaOptions: x,
|
|
746
751
|
enablePointerDrag: d,
|
|
747
|
-
contentInsets:
|
|
752
|
+
contentInsets: St
|
|
748
753
|
});
|
|
749
|
-
const
|
|
750
|
-
|
|
751
|
-
const
|
|
752
|
-
(
|
|
753
|
-
const { contentSize:
|
|
754
|
-
if (_.debug("[ScrollPane] scrollTo called", { newPosition:
|
|
755
|
-
return
|
|
756
|
-
const
|
|
757
|
-
return
|
|
754
|
+
const Dt = T({ contentSize: t, viewportSize: e });
|
|
755
|
+
Dt.current = { contentSize: t, viewportSize: e };
|
|
756
|
+
const ot = At(() => t > e, [t, e]), A = P(
|
|
757
|
+
(b) => {
|
|
758
|
+
const { contentSize: M, viewportSize: q } = Dt.current, ft = M > q, j = E.current;
|
|
759
|
+
if (_.debug("[ScrollPane] scrollTo called", { newPosition: b, contentSize: M, viewportSize: q, currentIsScrollable: ft, prevPosition: j }), !ft)
|
|
760
|
+
return E.current !== 0 && (E.current = 0, f?.(0, j)), E.current;
|
|
761
|
+
const mt = typeof b == "function" ? b(E.current) : b, Z = Math.max(M - q, 0), J = xt(mt, 0, Z);
|
|
762
|
+
return E.current !== J && (E.current = J, f?.(J, j)), E.current;
|
|
758
763
|
},
|
|
759
764
|
[f]
|
|
760
|
-
),
|
|
761
|
-
const
|
|
762
|
-
|
|
763
|
-
}, []),
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
}, [
|
|
767
|
-
const
|
|
768
|
-
(
|
|
769
|
-
if (!
|
|
765
|
+
), G = P(() => {
|
|
766
|
+
const b = I.current;
|
|
767
|
+
b.frame !== null && cancelAnimationFrame(b.frame), b.frame = null, b.velocity = 0, b.lastTimestamp = null;
|
|
768
|
+
}, []), dt = T(G);
|
|
769
|
+
Y(() => {
|
|
770
|
+
dt.current = G;
|
|
771
|
+
}, [G]);
|
|
772
|
+
const It = P(
|
|
773
|
+
(b) => {
|
|
774
|
+
if (!ot)
|
|
770
775
|
return;
|
|
771
|
-
const { maxVelocity:
|
|
772
|
-
if (Math.abs(
|
|
776
|
+
const { maxVelocity: M, minVelocity: q, deceleration: ft, startVelocityThreshold: j } = W, mt = xt(b, -M, M);
|
|
777
|
+
if (Math.abs(mt) < j)
|
|
773
778
|
return;
|
|
774
|
-
|
|
775
|
-
const
|
|
776
|
-
const
|
|
777
|
-
if (
|
|
778
|
-
|
|
779
|
+
G(), I.current.velocity = mt, I.current.lastTimestamp = null;
|
|
780
|
+
const Z = (J) => {
|
|
781
|
+
const bt = I.current;
|
|
782
|
+
if (bt.lastTimestamp === null) {
|
|
783
|
+
bt.lastTimestamp = J, bt.frame = requestAnimationFrame(Z);
|
|
779
784
|
return;
|
|
780
785
|
}
|
|
781
|
-
const
|
|
782
|
-
if (
|
|
783
|
-
|
|
786
|
+
const qt = J - bt.lastTimestamp;
|
|
787
|
+
if (bt.lastTimestamp = J, qt <= 0) {
|
|
788
|
+
bt.frame = requestAnimationFrame(Z);
|
|
784
789
|
return;
|
|
785
790
|
}
|
|
786
|
-
const
|
|
787
|
-
let
|
|
788
|
-
const
|
|
789
|
-
|
|
790
|
-
const
|
|
791
|
-
|
|
792
|
-
const
|
|
793
|
-
|
|
794
|
-
const
|
|
795
|
-
if (Math.abs(
|
|
796
|
-
|
|
791
|
+
const yt = bt.velocity;
|
|
792
|
+
let Tt = yt;
|
|
793
|
+
const Ct = ft * qt;
|
|
794
|
+
yt > 0 ? Tt = Math.max(0, yt - Ct) : yt < 0 && (Tt = Math.min(0, yt + Ct));
|
|
795
|
+
const at = (yt + Tt) / 2 * qt, p = E.current;
|
|
796
|
+
at !== 0 && A((Ft) => Ft + at);
|
|
797
|
+
const y = E.current, { contentSize: nt, viewportSize: Lt } = Dt.current, H = Math.max(nt - Lt, 0);
|
|
798
|
+
bt.velocity = Tt;
|
|
799
|
+
const Zt = y === p || y <= 0 && Tt <= 0 || y >= H && Tt >= 0;
|
|
800
|
+
if (Math.abs(Tt) < q || Zt) {
|
|
801
|
+
G();
|
|
797
802
|
return;
|
|
798
803
|
}
|
|
799
|
-
|
|
804
|
+
bt.frame = requestAnimationFrame(Z);
|
|
800
805
|
};
|
|
801
|
-
|
|
806
|
+
I.current.frame = requestAnimationFrame(Z);
|
|
802
807
|
},
|
|
803
|
-
[
|
|
804
|
-
),
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
}, [
|
|
808
|
-
|
|
809
|
-
}, [t, e]),
|
|
810
|
-
const
|
|
811
|
-
if (!
|
|
812
|
-
const
|
|
813
|
-
|
|
808
|
+
[ot, W, A, G]
|
|
809
|
+
), v = T(It);
|
|
810
|
+
Y(() => {
|
|
811
|
+
v.current = It;
|
|
812
|
+
}, [It]), oe(() => {
|
|
813
|
+
Dt.current = { contentSize: t, viewportSize: e };
|
|
814
|
+
}, [t, e]), oe(() => {
|
|
815
|
+
const b = Pt.current;
|
|
816
|
+
if (!b) return;
|
|
817
|
+
const M = () => {
|
|
818
|
+
b.scrollTop !== 0 && (_.debug("[ScrollPane] Native scroll detected, resetting to 0", { scrollTop: b.scrollTop }), b.scrollTop = 0), b.scrollLeft !== 0 && (b.scrollLeft = 0);
|
|
814
819
|
};
|
|
815
|
-
return
|
|
816
|
-
}, []),
|
|
817
|
-
if (
|
|
818
|
-
_.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", { contentSize: t, viewportSize: e, scrollPosition:
|
|
819
|
-
const
|
|
820
|
-
|
|
820
|
+
return b.addEventListener("scroll", M), () => b.removeEventListener("scroll", M);
|
|
821
|
+
}, []), oe(() => {
|
|
822
|
+
if (ot) {
|
|
823
|
+
_.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", { contentSize: t, viewportSize: e, scrollPosition: E.current });
|
|
824
|
+
const b = xt(t - e, 0, t);
|
|
825
|
+
E.current > b && A(b);
|
|
821
826
|
} else
|
|
822
|
-
|
|
823
|
-
}, [
|
|
824
|
-
const
|
|
825
|
-
if (
|
|
827
|
+
A(0);
|
|
828
|
+
}, [ot, A, t, e]), Y(() => {
|
|
829
|
+
const b = (q) => {
|
|
830
|
+
if (ht.current) {
|
|
831
|
+
const j = q.shiftKey && q.deltaX === 0, mt = j ? q.deltaY : q.deltaX, Z = j ? 0 : q.deltaY;
|
|
832
|
+
if (mt !== 0 && Math.abs(mt) >= Math.abs(Z)) {
|
|
833
|
+
q.preventDefault(), G();
|
|
834
|
+
let J = mt;
|
|
835
|
+
q.deltaMode === 1 ? J *= 16 : q.deltaMode === 2 && (J *= e), ht.current(J);
|
|
836
|
+
return;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
if (!ot)
|
|
826
840
|
return;
|
|
827
|
-
|
|
828
|
-
let
|
|
829
|
-
|
|
830
|
-
},
|
|
831
|
-
return
|
|
832
|
-
|
|
841
|
+
q.preventDefault(), G();
|
|
842
|
+
let ft = q.deltaY;
|
|
843
|
+
q.deltaMode === 1 ? ft *= 16 : q.deltaMode === 2 && (ft *= e), z !== 1 && (ft *= z), _.debug("[ScrollPane] wheel event", { deltaY: ft, scrollPosition: E.current, wheelSpeedMultiplier: z, deltaMode: q.deltaMode, scrollTop: Pt.current?.scrollTop }), A((j) => j + ft);
|
|
844
|
+
}, M = ut.current;
|
|
845
|
+
return M && M.addEventListener("wheel", b, { passive: !1 }), () => {
|
|
846
|
+
M && M.removeEventListener("wheel", b);
|
|
833
847
|
};
|
|
834
|
-
}, [
|
|
835
|
-
|
|
848
|
+
}, [ot, A, G, e, z]), we(
|
|
849
|
+
et,
|
|
836
850
|
() => ({
|
|
837
|
-
scrollTo: (
|
|
838
|
-
getScrollPosition: () =>
|
|
851
|
+
scrollTo: (b) => (G(), A(b)),
|
|
852
|
+
getScrollPosition: () => E.current,
|
|
839
853
|
getContentSize: () => t,
|
|
840
854
|
getViewportSize: () => e
|
|
841
855
|
}),
|
|
842
|
-
[
|
|
856
|
+
[A, t, e, G]
|
|
843
857
|
);
|
|
844
|
-
const
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
}, [
|
|
848
|
-
const
|
|
858
|
+
const kt = T(A);
|
|
859
|
+
Y(() => {
|
|
860
|
+
kt.current = A;
|
|
861
|
+
}, [A]);
|
|
862
|
+
const S = Be(), rt = T({
|
|
849
863
|
pointerId: null,
|
|
850
864
|
startClientY: 0,
|
|
851
865
|
startScroll: 0,
|
|
@@ -853,110 +867,110 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Se = "virtualscroll:tap-scr
|
|
|
853
867
|
shouldCancelNextClick: !1,
|
|
854
868
|
clickResetTimer: null,
|
|
855
869
|
velocitySamples: []
|
|
856
|
-
}),
|
|
857
|
-
|
|
858
|
-
|
|
870
|
+
}), Vt = T(d);
|
|
871
|
+
Y(() => {
|
|
872
|
+
Vt.current = d;
|
|
859
873
|
}, [d]);
|
|
860
|
-
const
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
}, [
|
|
864
|
-
const
|
|
865
|
-
return
|
|
866
|
-
|
|
867
|
-
}, [
|
|
874
|
+
const Gt = T(ot);
|
|
875
|
+
Y(() => {
|
|
876
|
+
Gt.current = ot;
|
|
877
|
+
}, [ot]);
|
|
878
|
+
const Mt = T(W);
|
|
879
|
+
return Y(() => {
|
|
880
|
+
Mt.current = W;
|
|
881
|
+
}, [W]), Y(() => {
|
|
868
882
|
if (d)
|
|
869
883
|
return;
|
|
870
|
-
const
|
|
871
|
-
|
|
872
|
-
}, [d]),
|
|
873
|
-
const
|
|
874
|
-
if (!
|
|
884
|
+
const b = Pt.current, M = rt.current;
|
|
885
|
+
M.pointerId && b?.hasPointerCapture(M.pointerId) && b.releasePointerCapture(M.pointerId), M.clickResetTimer !== null && (window.clearTimeout(M.clickResetTimer), M.clickResetTimer = null), M.pointerId = null, M.startClientY = 0, M.startScroll = 0, M.isDragging = !1, M.shouldCancelNextClick = !1, M.velocitySamples = [];
|
|
886
|
+
}, [d]), Y(() => {
|
|
887
|
+
const b = Pt.current;
|
|
888
|
+
if (!b)
|
|
875
889
|
return;
|
|
876
|
-
const
|
|
877
|
-
const
|
|
878
|
-
|
|
879
|
-
},
|
|
880
|
-
const
|
|
881
|
-
|
|
882
|
-
},
|
|
883
|
-
const
|
|
884
|
-
|
|
885
|
-
const
|
|
886
|
-
|
|
887
|
-
},
|
|
888
|
-
const
|
|
889
|
-
|
|
890
|
-
},
|
|
891
|
-
const
|
|
892
|
-
|
|
893
|
-
},
|
|
894
|
-
const
|
|
895
|
-
if (
|
|
890
|
+
const M = 6, q = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), ft = () => {
|
|
891
|
+
const p = rt.current;
|
|
892
|
+
p.pointerId = null, p.startClientY = 0, p.startScroll = 0, p.isDragging = !1, p.velocitySamples = [];
|
|
893
|
+
}, j = () => {
|
|
894
|
+
const p = rt.current;
|
|
895
|
+
p.clickResetTimer !== null && (window.clearTimeout(p.clickResetTimer), p.clickResetTimer = null);
|
|
896
|
+
}, mt = (p) => {
|
|
897
|
+
const y = rt.current, nt = q();
|
|
898
|
+
y.velocitySamples.push({ clientY: p, time: nt });
|
|
899
|
+
const Lt = Mt.current.velocitySampleWindow;
|
|
900
|
+
y.velocitySamples = y.velocitySamples.filter((H) => nt - H.time <= Lt);
|
|
901
|
+
}, Z = (p) => p instanceof HTMLElement && p.closest("[data-scrollpane-ignore-drag='true']") !== null, J = (p) => {
|
|
902
|
+
const y = rt.current;
|
|
903
|
+
y.shouldCancelNextClick && (p.preventDefault(), p.stopPropagation(), y.shouldCancelNextClick = !1);
|
|
904
|
+
}, bt = (p) => {
|
|
905
|
+
const y = rt.current;
|
|
906
|
+
y.isDragging || (y.isDragging = !0, y.shouldCancelNextClick = !0, b.hasPointerCapture(p.pointerId) || b.setPointerCapture(p.pointerId), mt(p.clientY));
|
|
907
|
+
}, qt = (p) => {
|
|
908
|
+
const y = rt.current;
|
|
909
|
+
if (y.pointerId !== p.pointerId || !(Vt.current && Gt.current) || !y.isDragging && (Math.abs(p.clientY - y.startClientY) < M || (bt(p), !y.isDragging)))
|
|
896
910
|
return;
|
|
897
|
-
|
|
898
|
-
const
|
|
899
|
-
|
|
900
|
-
},
|
|
901
|
-
const
|
|
902
|
-
if (
|
|
911
|
+
mt(p.clientY);
|
|
912
|
+
const nt = p.clientY - y.startClientY, Lt = y.startScroll - nt;
|
|
913
|
+
kt.current(Lt), p.cancelable && p.preventDefault();
|
|
914
|
+
}, yt = (p) => {
|
|
915
|
+
const y = rt.current;
|
|
916
|
+
if (y.pointerId !== p.pointerId)
|
|
903
917
|
return;
|
|
904
|
-
|
|
905
|
-
let
|
|
906
|
-
if (
|
|
907
|
-
const
|
|
908
|
-
if (
|
|
909
|
-
const
|
|
910
|
-
|
|
918
|
+
y.isDragging && y.shouldCancelNextClick && p.cancelable && (p.preventDefault(), p.stopPropagation()), b.hasPointerCapture(p.pointerId) && b.releasePointerCapture(p.pointerId);
|
|
919
|
+
let nt = 0;
|
|
920
|
+
if (y.isDragging && y.velocitySamples.length >= 2) {
|
|
921
|
+
const H = y.velocitySamples, Zt = Mt.current.velocitySampleWindow, Ft = H[H.length - 1], wt = H.find((Ht) => Ft.time - Ht.time <= Zt) ?? H[0];
|
|
922
|
+
if (Ft && wt && Ft.time !== wt.time) {
|
|
923
|
+
const Ht = Ft.clientY - wt.clientY, gt = Ft.time - wt.time;
|
|
924
|
+
nt = -(Ht / gt);
|
|
911
925
|
}
|
|
912
926
|
}
|
|
913
|
-
|
|
914
|
-
const
|
|
915
|
-
|
|
927
|
+
j(), y.shouldCancelNextClick && (y.clickResetTimer = window.setTimeout(() => {
|
|
928
|
+
const H = rt.current;
|
|
929
|
+
H.shouldCancelNextClick = !1, H.clickResetTimer = null;
|
|
916
930
|
}, 0));
|
|
917
|
-
const
|
|
918
|
-
|
|
919
|
-
},
|
|
920
|
-
if (!(
|
|
931
|
+
const Lt = Mt.current.startVelocityThreshold;
|
|
932
|
+
ft(), Math.abs(nt) >= Lt && v.current?.(nt);
|
|
933
|
+
}, Tt = (p) => {
|
|
934
|
+
if (!(Vt.current && Gt.current) || p.button !== 0 && p.pointerType === "mouse" || p.ctrlKey || p.metaKey || p.altKey || Z(p.target))
|
|
921
935
|
return;
|
|
922
|
-
window.dispatchEvent(new CustomEvent(
|
|
923
|
-
const
|
|
924
|
-
|
|
925
|
-
},
|
|
926
|
-
const
|
|
927
|
-
|
|
928
|
-
},
|
|
929
|
-
["click",
|
|
930
|
-
["pointerdown",
|
|
931
|
-
["pointermove",
|
|
932
|
-
["pointerup",
|
|
933
|
-
["pointercancel",
|
|
934
|
-
],
|
|
935
|
-
["pointermove",
|
|
936
|
-
["pointerup",
|
|
937
|
-
["pointercancel",
|
|
936
|
+
window.dispatchEvent(new CustomEvent(Me, { detail: { paneId: S } })), dt.current?.();
|
|
937
|
+
const y = rt.current;
|
|
938
|
+
j(), y.pointerId = p.pointerId, y.startClientY = p.clientY, y.startScroll = E.current, y.isDragging = !1, y.shouldCancelNextClick = !1, y.velocitySamples = [];
|
|
939
|
+
}, Ct = (p) => {
|
|
940
|
+
const y = rt.current;
|
|
941
|
+
y.pointerId === p.pointerId && (y.shouldCancelNextClick = !1, b.hasPointerCapture(p.pointerId) && b.releasePointerCapture(p.pointerId), j(), ft());
|
|
942
|
+
}, _t = [
|
|
943
|
+
["click", J, !0],
|
|
944
|
+
["pointerdown", Tt, { passive: !1 }],
|
|
945
|
+
["pointermove", qt, { passive: !1 }],
|
|
946
|
+
["pointerup", yt, void 0],
|
|
947
|
+
["pointercancel", Ct, void 0]
|
|
948
|
+
], at = [
|
|
949
|
+
["pointermove", qt, { passive: !1 }],
|
|
950
|
+
["pointerup", yt, void 0],
|
|
951
|
+
["pointercancel", Ct, void 0]
|
|
938
952
|
];
|
|
939
|
-
return
|
|
940
|
-
|
|
941
|
-
const
|
|
942
|
-
|
|
953
|
+
return be(b, _t, "add"), be(window, at, "add"), () => {
|
|
954
|
+
be(b, _t, "remove"), be(window, at, "remove");
|
|
955
|
+
const p = rt.current;
|
|
956
|
+
p.pointerId !== null && b.hasPointerCapture(p.pointerId) && b.releasePointerCapture(p.pointerId), j(), ft();
|
|
943
957
|
};
|
|
944
|
-
}, [
|
|
945
|
-
/* @__PURE__ */
|
|
958
|
+
}, [S]), /* @__PURE__ */ ne("div", { ref: ut, className: re("aqvs-scroll-pane", h), style: m, children: [
|
|
959
|
+
/* @__PURE__ */ ne(
|
|
946
960
|
"div",
|
|
947
961
|
{
|
|
948
|
-
ref:
|
|
949
|
-
className:
|
|
962
|
+
ref: Pt,
|
|
963
|
+
className: re("aqvs-scroll-pane-content"),
|
|
950
964
|
style: {
|
|
951
965
|
height: e,
|
|
952
|
-
paddingTop:
|
|
953
|
-
paddingBottom:
|
|
966
|
+
paddingTop: St.top,
|
|
967
|
+
paddingBottom: St.bottom,
|
|
954
968
|
...d ? { touchAction: "none" } : {}
|
|
955
969
|
},
|
|
956
|
-
id:
|
|
970
|
+
id: S,
|
|
957
971
|
children: [
|
|
958
972
|
g,
|
|
959
|
-
n(
|
|
973
|
+
n(E.current)
|
|
960
974
|
]
|
|
961
975
|
}
|
|
962
976
|
),
|
|
@@ -965,34 +979,34 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Se = "virtualscroll:tap-scr
|
|
|
965
979
|
{
|
|
966
980
|
contentSize: t,
|
|
967
981
|
viewportSize: e,
|
|
968
|
-
scrollPosition:
|
|
969
|
-
onScroll:
|
|
970
|
-
enableThumbDrag:
|
|
982
|
+
scrollPosition: E.current,
|
|
983
|
+
onScroll: A,
|
|
984
|
+
enableThumbDrag: i,
|
|
971
985
|
enableTrackClick: l,
|
|
972
986
|
enableArrowButtons: c,
|
|
973
987
|
scrollBarWidth: r,
|
|
974
|
-
ariaControls:
|
|
975
|
-
tapScrollCircleOptions:
|
|
976
|
-
itemCount:
|
|
977
|
-
renderThumbOverlay:
|
|
978
|
-
visibleStartIndex:
|
|
979
|
-
visibleEndIndex:
|
|
988
|
+
ariaControls: S,
|
|
989
|
+
tapScrollCircleOptions: N,
|
|
990
|
+
itemCount: k,
|
|
991
|
+
renderThumbOverlay: B,
|
|
992
|
+
visibleStartIndex: ct,
|
|
993
|
+
visibleEndIndex: st
|
|
980
994
|
},
|
|
981
995
|
"scrollbar"
|
|
982
996
|
),
|
|
983
|
-
|
|
997
|
+
L?.()
|
|
984
998
|
] });
|
|
985
999
|
}
|
|
986
|
-
),
|
|
987
|
-
const
|
|
988
|
-
return /* @__PURE__ */
|
|
1000
|
+
), Ae = (n, t, e) => Math.min(Math.max(n, t), e), Tr = ({ dragState: n, normalizedDistance: t, sizeScale: e, size: r }) => {
|
|
1001
|
+
const i = Math.max(r / 2, 1), l = 1 + t * 0.65, c = Math.max(0.65, 1 - t * 0.25), d = n.direction * t * 26 * e, f = 0.8 + t * 0.18, h = 3 * e, m = 6 * e, g = 22 * e, N = Math.abs(d) + m, x = d > 0 ? h : -Math.abs(d) - h, k = Math.max(2.5, 3 * e), B = Ae(n.offsetX, -i, i), z = Ae(n.offsetY, -i, i), Q = i * 0.35, pt = B / i * Q, ct = z / i * Q, st = pt * 0.45, L = ct * 0.45, tt = Math.max(g * 0.38, 6), et = 0.65 + t * 0.2, E = n.active;
|
|
1002
|
+
return /* @__PURE__ */ ne(_e, { children: [
|
|
989
1003
|
/* @__PURE__ */ $(
|
|
990
1004
|
"div",
|
|
991
1005
|
{
|
|
992
1006
|
className: "aqvs-tap-scroll-circle-gradient",
|
|
993
1007
|
style: {
|
|
994
1008
|
transform: `scale(${c}, ${l})`,
|
|
995
|
-
transition:
|
|
1009
|
+
transition: E ? "40ms transform ease-out" : "200ms ease transform"
|
|
996
1010
|
}
|
|
997
1011
|
}
|
|
998
1012
|
),
|
|
@@ -1003,8 +1017,8 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Se = "virtualscroll:tap-scr
|
|
|
1003
1017
|
style: {
|
|
1004
1018
|
width: g,
|
|
1005
1019
|
height: g,
|
|
1006
|
-
transform: `translate(calc(-50% + ${
|
|
1007
|
-
transition:
|
|
1020
|
+
transform: `translate(calc(-50% + ${pt}px), calc(-50% + ${ct}px)) scale(${c}, ${f * l})`,
|
|
1021
|
+
transition: E ? "70ms transform ease-out" : "200ms ease transform"
|
|
1008
1022
|
}
|
|
1009
1023
|
}
|
|
1010
1024
|
),
|
|
@@ -1015,10 +1029,10 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Se = "virtualscroll:tap-scr
|
|
|
1015
1029
|
style: {
|
|
1016
1030
|
width: tt,
|
|
1017
1031
|
height: tt,
|
|
1018
|
-
transform: `translate(calc(-50% + ${
|
|
1019
|
-
opacity:
|
|
1032
|
+
transform: `translate(calc(-50% + ${st}px), calc(-50% + ${L}px)) scale(${c}, ${l})`,
|
|
1033
|
+
opacity: et,
|
|
1020
1034
|
boxShadow: "0 0 8px rgba(255,255,255,0.45)",
|
|
1021
|
-
transition:
|
|
1035
|
+
transition: E ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
|
|
1022
1036
|
}
|
|
1023
1037
|
}
|
|
1024
1038
|
),
|
|
@@ -1027,11 +1041,11 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Se = "virtualscroll:tap-scr
|
|
|
1027
1041
|
{
|
|
1028
1042
|
className: "aqvs-sample-visual-highlight",
|
|
1029
1043
|
style: {
|
|
1030
|
-
width:
|
|
1031
|
-
height:
|
|
1044
|
+
width: k,
|
|
1045
|
+
height: N,
|
|
1032
1046
|
transform: `translate(-50%, ${x}px)`,
|
|
1033
1047
|
opacity: t,
|
|
1034
|
-
transition:
|
|
1048
|
+
transition: E ? "40ms height, 60ms opacity ease-out ease-out" : "200ms ease height, 120ms ease opacity"
|
|
1035
1049
|
}
|
|
1036
1050
|
}
|
|
1037
1051
|
)
|
|
@@ -1041,7 +1055,7 @@ const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Se = "virtualscroll:tap-scr
|
|
|
1041
1055
|
return 0n;
|
|
1042
1056
|
const t = Math.trunc(n);
|
|
1043
1057
|
return t <= 0 ? 0n : BigInt(t);
|
|
1044
|
-
},
|
|
1058
|
+
}, ve = (n) => {
|
|
1045
1059
|
if (n <= 0 || !Number.isFinite(n))
|
|
1046
1060
|
return 0;
|
|
1047
1061
|
const t = Math.trunc(n), e = BigInt(t) & -BigInt(t);
|
|
@@ -1107,10 +1121,10 @@ class cr {
|
|
|
1107
1121
|
}, { mode: c, materializedValues: d } = this._calculateMode(l.from, l.to);
|
|
1108
1122
|
if (this.baseValue = c, r?.materialize)
|
|
1109
1123
|
for (let f = 0; f < d.length; f++) {
|
|
1110
|
-
const
|
|
1124
|
+
const h = d[f], m = l.from + f;
|
|
1111
1125
|
if (m >= this.size)
|
|
1112
1126
|
break;
|
|
1113
|
-
const g =
|
|
1127
|
+
const g = h - this.baseValue;
|
|
1114
1128
|
this.deltas.set(m, g), this._updateTree(m, g);
|
|
1115
1129
|
}
|
|
1116
1130
|
} else
|
|
@@ -1146,29 +1160,29 @@ class cr {
|
|
|
1146
1160
|
if (!this.valueFn)
|
|
1147
1161
|
return { mode: 0, materializedValues: [] };
|
|
1148
1162
|
const r = [];
|
|
1149
|
-
for (let
|
|
1150
|
-
r.push(this.valueFn(
|
|
1151
|
-
const
|
|
1163
|
+
for (let h = t; h <= e && !(h >= this.size); h++)
|
|
1164
|
+
r.push(this.valueFn(h));
|
|
1165
|
+
const i = [...r];
|
|
1152
1166
|
if (r.length === 0)
|
|
1153
1167
|
return { mode: 0, materializedValues: [] };
|
|
1154
|
-
r.sort((
|
|
1168
|
+
r.sort((h, m) => h - m);
|
|
1155
1169
|
const l = Math.floor(r.length / 2);
|
|
1156
1170
|
let c;
|
|
1157
1171
|
r.length % 2 === 0 ? c = Math.floor((r[l - 1] + r[l]) / 2) : c = r[l];
|
|
1158
1172
|
const d = /* @__PURE__ */ new Map();
|
|
1159
1173
|
let f = 0;
|
|
1160
|
-
for (const
|
|
1161
|
-
const m = (d.get(
|
|
1162
|
-
d.set(
|
|
1174
|
+
for (const h of r) {
|
|
1175
|
+
const m = (d.get(h) ?? 0) + 1;
|
|
1176
|
+
d.set(h, m), m > f && (f = m);
|
|
1163
1177
|
}
|
|
1164
1178
|
if (f > r.length * 0.2) {
|
|
1165
|
-
const
|
|
1166
|
-
for (const [g,
|
|
1167
|
-
|
|
1168
|
-
const m =
|
|
1169
|
-
c = Math.floor(m /
|
|
1179
|
+
const h = [];
|
|
1180
|
+
for (const [g, N] of d.entries())
|
|
1181
|
+
N === f && h.push(g);
|
|
1182
|
+
const m = h.reduce((g, N) => g + N, 0);
|
|
1183
|
+
c = Math.floor(m / h.length);
|
|
1170
1184
|
}
|
|
1171
|
-
return { mode: c, materializedValues:
|
|
1185
|
+
return { mode: c, materializedValues: i };
|
|
1172
1186
|
}
|
|
1173
1187
|
/**
|
|
1174
1188
|
* @method update
|
|
@@ -1210,8 +1224,8 @@ class cr {
|
|
|
1210
1224
|
for (const { index: e, change: r } of t) {
|
|
1211
1225
|
if (e < 0 || e >= this.size)
|
|
1212
1226
|
throw new Error(`Index ${e} out of bounds`);
|
|
1213
|
-
const
|
|
1214
|
-
this.deltas.set(e,
|
|
1227
|
+
const i = this.deltas.get(e) ?? 0;
|
|
1228
|
+
this.deltas.set(e, i + r), this._updateTree(e, r);
|
|
1215
1229
|
}
|
|
1216
1230
|
return this.total;
|
|
1217
1231
|
}
|
|
@@ -1229,10 +1243,10 @@ class cr {
|
|
|
1229
1243
|
let r = t + 1;
|
|
1230
1244
|
for (; r <= this.size; ) {
|
|
1231
1245
|
this.tree.set(r, (this.tree.get(r) ?? 0) + e);
|
|
1232
|
-
const
|
|
1233
|
-
if (
|
|
1246
|
+
const i = ve(r);
|
|
1247
|
+
if (i === 0)
|
|
1234
1248
|
break;
|
|
1235
|
-
r +=
|
|
1249
|
+
r += i;
|
|
1236
1250
|
}
|
|
1237
1251
|
this.total !== void 0 && (this.total += e);
|
|
1238
1252
|
}
|
|
@@ -1246,12 +1260,12 @@ class cr {
|
|
|
1246
1260
|
*/
|
|
1247
1261
|
_buildDeltaUpdates(t) {
|
|
1248
1262
|
const e = [];
|
|
1249
|
-
for (const { index: r, value:
|
|
1263
|
+
for (const { index: r, value: i } of t) {
|
|
1250
1264
|
if (r < 0 || r >= this.size)
|
|
1251
1265
|
throw new Error(`Index ${r} out of bounds`);
|
|
1252
|
-
if (
|
|
1266
|
+
if (i < 0)
|
|
1253
1267
|
throw new Error("Value cannot be negative.");
|
|
1254
|
-
const l = this.deltas.has(r) ? (this.deltas.get(r) ?? 0) + this.baseValue : this.baseValue, c =
|
|
1268
|
+
const l = this.deltas.has(r) ? (this.deltas.get(r) ?? 0) + this.baseValue : this.baseValue, c = i - l;
|
|
1255
1269
|
c !== 0 && e.push({ index: r, change: c });
|
|
1256
1270
|
}
|
|
1257
1271
|
return e;
|
|
@@ -1269,7 +1283,7 @@ class cr {
|
|
|
1269
1283
|
let t = 0, e = this.size;
|
|
1270
1284
|
for (; e > 0; ) {
|
|
1271
1285
|
t += this.tree.get(e) ?? 0;
|
|
1272
|
-
const r =
|
|
1286
|
+
const r = ve(e);
|
|
1273
1287
|
if (r === 0)
|
|
1274
1288
|
break;
|
|
1275
1289
|
e -= r;
|
|
@@ -1305,11 +1319,11 @@ class cr {
|
|
|
1305
1319
|
_materializeRanges(t, e, r = !1) {
|
|
1306
1320
|
if (!(t?.materialize && this.valueFn))
|
|
1307
1321
|
return;
|
|
1308
|
-
const
|
|
1309
|
-
if (
|
|
1310
|
-
for (const d of
|
|
1311
|
-
const f = d.from,
|
|
1312
|
-
for (let m = f; m <=
|
|
1322
|
+
const i = t.ranges;
|
|
1323
|
+
if (i && i.length > 0) {
|
|
1324
|
+
for (const d of i) {
|
|
1325
|
+
const f = d.from, h = Math.min(d.to, this.size - 1);
|
|
1326
|
+
for (let m = f; m <= h; m++)
|
|
1313
1327
|
this._materialize(m);
|
|
1314
1328
|
}
|
|
1315
1329
|
if (e === void 0)
|
|
@@ -1318,7 +1332,7 @@ class cr {
|
|
|
1318
1332
|
this._materialize(e);
|
|
1319
1333
|
return;
|
|
1320
1334
|
}
|
|
1321
|
-
const l =
|
|
1335
|
+
const l = i[0].from, c = i[i.length - 1].to;
|
|
1322
1336
|
e >= l && e <= c && this._materialize(e);
|
|
1323
1337
|
return;
|
|
1324
1338
|
}
|
|
@@ -1339,17 +1353,17 @@ class cr {
|
|
|
1339
1353
|
return this._findIndexLarge(t, e, r);
|
|
1340
1354
|
if (this.size === 0)
|
|
1341
1355
|
return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1342
|
-
let
|
|
1356
|
+
let i = 0, l = 0, c = 1;
|
|
1343
1357
|
for (; c << 1 <= this.size; )
|
|
1344
1358
|
c <<= 1;
|
|
1345
1359
|
for (; c > 0; c >>= 1) {
|
|
1346
|
-
const
|
|
1347
|
-
if (
|
|
1348
|
-
const g = (this.tree.get(
|
|
1349
|
-
(r ? l + g < t : l + g <= t) && (
|
|
1360
|
+
const h = i + c;
|
|
1361
|
+
if (h <= this.size) {
|
|
1362
|
+
const g = (this.tree.get(h) ?? 0) + this.baseValue * c;
|
|
1363
|
+
(r ? l + g < t : l + g <= t) && (i = h, l += g);
|
|
1350
1364
|
}
|
|
1351
1365
|
}
|
|
1352
|
-
const d = r ?
|
|
1366
|
+
const d = r ? i : i - 1;
|
|
1353
1367
|
if (d < 0 || d >= this.size)
|
|
1354
1368
|
return { index: -1, total: this.total ?? this.getTotal(), cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1355
1369
|
const f = this.prefixSum(d, e);
|
|
@@ -1369,14 +1383,14 @@ class cr {
|
|
|
1369
1383
|
_findIndexLarge(t, e, r) {
|
|
1370
1384
|
if (this.size === 0)
|
|
1371
1385
|
return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1372
|
-
const
|
|
1373
|
-
if (
|
|
1386
|
+
const i = lr(this.size);
|
|
1387
|
+
if (i === 0n)
|
|
1374
1388
|
return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1375
|
-
let l = 0n, c =
|
|
1389
|
+
let l = 0n, c = i - 1n, d, f, h, m = this.total;
|
|
1376
1390
|
for (; l <= c; ) {
|
|
1377
|
-
const x = l + c >> 1n,
|
|
1378
|
-
if (
|
|
1379
|
-
if (d = x, f =
|
|
1391
|
+
const x = l + c >> 1n, k = Number(x), B = this.prefixSum(k, e);
|
|
1392
|
+
if (h = B, m = B.total, r ? B.cumulative >= t : B.cumulative <= t)
|
|
1393
|
+
if (d = x, f = B, r) {
|
|
1380
1394
|
if (x === 0n)
|
|
1381
1395
|
break;
|
|
1382
1396
|
c = x - 1n;
|
|
@@ -1390,7 +1404,7 @@ class cr {
|
|
|
1390
1404
|
c = x - 1n;
|
|
1391
1405
|
}
|
|
1392
1406
|
}
|
|
1393
|
-
const g = f ??
|
|
1407
|
+
const g = f ?? h;
|
|
1394
1408
|
return {
|
|
1395
1409
|
index: d !== void 0 ? Number(d) : -1,
|
|
1396
1410
|
total: m,
|
|
@@ -1410,18 +1424,18 @@ class cr {
|
|
|
1410
1424
|
prefixSum(t, e) {
|
|
1411
1425
|
if (t < 0)
|
|
1412
1426
|
return { cumulative: 0, total: this.total, currentValue: 0, safeIndex: 0 };
|
|
1413
|
-
const r =
|
|
1414
|
-
this._materializeRanges(
|
|
1427
|
+
const r = xt(t, 0, this.size - 1), i = e?.materializeOption;
|
|
1428
|
+
this._materializeRanges(i, r, !0);
|
|
1415
1429
|
let l = 0, c = r + 1;
|
|
1416
1430
|
for (; c > 0; ) {
|
|
1417
1431
|
const f = this.tree.get(c) ?? 0;
|
|
1418
1432
|
l += f;
|
|
1419
|
-
const
|
|
1420
|
-
if (
|
|
1433
|
+
const h = ve(c);
|
|
1434
|
+
if (h === 0)
|
|
1421
1435
|
break;
|
|
1422
|
-
c -=
|
|
1436
|
+
c -= h;
|
|
1423
1437
|
}
|
|
1424
|
-
const d =
|
|
1438
|
+
const d = i?.materialize ? this.get(r) : (this.deltas.get(r) || 0) + this.baseValue;
|
|
1425
1439
|
return { cumulative: l + this.baseValue * (r + 1), total: this.total, currentValue: d, safeIndex: r };
|
|
1426
1440
|
}
|
|
1427
1441
|
/**
|
|
@@ -1467,17 +1481,17 @@ class cr {
|
|
|
1467
1481
|
rebuildTree(t) {
|
|
1468
1482
|
if (t?.materialize && this.valueFn) {
|
|
1469
1483
|
const r = this.valueFn;
|
|
1470
|
-
this.reset(this.size, (
|
|
1484
|
+
this.reset(this.size, (i) => r(i), { materialize: !0 });
|
|
1471
1485
|
return;
|
|
1472
1486
|
}
|
|
1473
1487
|
const e = /* @__PURE__ */ new Map();
|
|
1474
|
-
for (const [r,
|
|
1475
|
-
if (
|
|
1488
|
+
for (const [r, i] of this.deltas.entries()) {
|
|
1489
|
+
if (i === 0)
|
|
1476
1490
|
continue;
|
|
1477
1491
|
let l = r + 1;
|
|
1478
1492
|
for (; l <= this.size; ) {
|
|
1479
|
-
e.set(l, (e.get(l) ?? 0) +
|
|
1480
|
-
const c =
|
|
1493
|
+
e.set(l, (e.get(l) ?? 0) + i);
|
|
1494
|
+
const c = ve(l);
|
|
1481
1495
|
if (c === 0)
|
|
1482
1496
|
break;
|
|
1483
1497
|
l += c;
|
|
@@ -1510,8 +1524,8 @@ class cr {
|
|
|
1510
1524
|
if (t === e)
|
|
1511
1525
|
return;
|
|
1512
1526
|
if (t < e)
|
|
1513
|
-
for (const
|
|
1514
|
-
|
|
1527
|
+
for (const i of this.deltas.keys())
|
|
1528
|
+
i >= t && this.deltas.delete(i);
|
|
1515
1529
|
this.size = t, this.rebuildTree();
|
|
1516
1530
|
const r = this.prefixSum(this.getSize() - 1);
|
|
1517
1531
|
r.cumulative !== r.total && _.error("Inconsistent Fenwick Tree state");
|
|
@@ -1555,12 +1569,12 @@ class cr {
|
|
|
1555
1569
|
}
|
|
1556
1570
|
}
|
|
1557
1571
|
const ur = (n, t, e) => {
|
|
1558
|
-
const r = Math.max(0, n),
|
|
1559
|
-
|
|
1560
|
-
const c =
|
|
1561
|
-
if (
|
|
1572
|
+
const r = Math.max(0, n), i = T(null), l = T({ size: r, valueOrFn: t, options: e });
|
|
1573
|
+
i.current === null && (i.current = new cr(r, t, e));
|
|
1574
|
+
const c = i.current, d = l.current, f = d.size !== r, h = d.valueOrFn !== t, m = d.options !== e;
|
|
1575
|
+
if (h || m) {
|
|
1562
1576
|
const g = e?.resetOnValueFnChange ?? !0;
|
|
1563
|
-
m ||
|
|
1577
|
+
m || h && g ? (e?.debug && _.debug("[useFenwickMapTree] reset", { valueOrFnChanged: h, optionsChanged: m }), c.reset(r, t, e)) : (f && (e?.debug && _.debug("[useFenwickMapTree] resize (with valueFn change)", { from: d.size, to: r }), c.changeSize(r)), e?.debug && _.debug("[useFenwickMapTree] setValueFn (no reset)", { valueOrFnChanged: h }), c.setValueFn(t, { reset: !1 })), l.current = { size: r, valueOrFn: t, options: e };
|
|
1564
1578
|
} else f && (e?.debug && _.debug("[useFenwickMapTree] resize", { from: d.size, to: r }), d.size === 0 && r > 0 ? c.reset(r, t, e) : c.changeSize(r), l.current = { size: r, valueOrFn: t, options: e });
|
|
1565
1579
|
return c;
|
|
1566
1580
|
};
|
|
@@ -1573,7 +1587,7 @@ class dr {
|
|
|
1573
1587
|
this.key = t, this.value = e;
|
|
1574
1588
|
}
|
|
1575
1589
|
}
|
|
1576
|
-
class
|
|
1590
|
+
class De {
|
|
1577
1591
|
head = null;
|
|
1578
1592
|
tail = null;
|
|
1579
1593
|
/**
|
|
@@ -1615,8 +1629,8 @@ class Ae {
|
|
|
1615
1629
|
}
|
|
1616
1630
|
}
|
|
1617
1631
|
function fr(n) {
|
|
1618
|
-
const t =
|
|
1619
|
-
|
|
1632
|
+
const t = T(/* @__PURE__ */ new Map()), e = T(new De());
|
|
1633
|
+
Y(() => {
|
|
1620
1634
|
for (; t.current.size > n; ) {
|
|
1621
1635
|
const m = e.current.removeHead();
|
|
1622
1636
|
if (m)
|
|
@@ -1625,140 +1639,140 @@ function fr(n) {
|
|
|
1625
1639
|
break;
|
|
1626
1640
|
}
|
|
1627
1641
|
}, [n]);
|
|
1628
|
-
const r =
|
|
1642
|
+
const r = P((m) => {
|
|
1629
1643
|
const g = t.current.get(m);
|
|
1630
1644
|
if (g)
|
|
1631
1645
|
return e.current.moveToTail(g), g.value;
|
|
1632
|
-
}, []),
|
|
1646
|
+
}, []), i = P(
|
|
1633
1647
|
(m, g) => {
|
|
1634
1648
|
if (n <= 0)
|
|
1635
1649
|
return;
|
|
1636
|
-
let
|
|
1637
|
-
if (
|
|
1638
|
-
|
|
1650
|
+
let N = t.current.get(m);
|
|
1651
|
+
if (N)
|
|
1652
|
+
N.value = g, e.current.moveToTail(N);
|
|
1639
1653
|
else {
|
|
1640
1654
|
if (t.current.size >= n) {
|
|
1641
1655
|
const x = e.current.removeHead();
|
|
1642
1656
|
x && t.current.delete(x.key);
|
|
1643
1657
|
}
|
|
1644
|
-
|
|
1658
|
+
N = new dr(m, g), t.current.set(m, N), e.current.addToTail(N);
|
|
1645
1659
|
}
|
|
1646
1660
|
},
|
|
1647
1661
|
[n]
|
|
1648
|
-
), l =
|
|
1662
|
+
), l = P((m) => t.current.has(m), []), c = P((m) => {
|
|
1649
1663
|
const g = t.current.get(m);
|
|
1650
1664
|
g && (e.current.remove(g), t.current.delete(m));
|
|
1651
|
-
}, []), d =
|
|
1652
|
-
t.current.clear(), e.current = new
|
|
1653
|
-
}, []), [f,
|
|
1654
|
-
return
|
|
1665
|
+
}, []), d = P(() => {
|
|
1666
|
+
t.current.clear(), e.current = new De();
|
|
1667
|
+
}, []), [f, h] = Bt(() => ({ get: r, set: i, has: l, remove: c, clear: d }));
|
|
1668
|
+
return Y(() => h({ get: r, set: i, has: l, remove: c, clear: d }), [r, i, l, c, d]), f;
|
|
1655
1669
|
}
|
|
1656
1670
|
const mr = 1e4, Pr = () => {
|
|
1657
1671
|
const { get: n, set: t, has: e, clear: r } = fr(mr);
|
|
1658
1672
|
return { get: n, set: t, has: e, clear: r };
|
|
1659
|
-
},
|
|
1673
|
+
}, it = (n, t) => t <= 0 ? 0 : xt(n, 0, t - 1), Ne = (n) => ({
|
|
1660
1674
|
top: Math.max(0, n?.top ?? 0),
|
|
1661
1675
|
bottom: Math.max(0, n?.bottom ?? 0)
|
|
1662
|
-
}),
|
|
1676
|
+
}), jt = (n, t) => n <= t ? 0 : n - t, se = (n, t) => n <= 0 ? t : n + t, Se = (n) => {
|
|
1663
1677
|
if (!Number.isFinite(n)) return 0n;
|
|
1664
1678
|
const t = Math.trunc(n);
|
|
1665
1679
|
return t <= 0 ? 0n : BigInt(t);
|
|
1666
|
-
}, pr = (n, t, e, r,
|
|
1667
|
-
const f =
|
|
1680
|
+
}, pr = (n, t, e, r, i, l, c, d) => {
|
|
1681
|
+
const f = Se(r);
|
|
1668
1682
|
if (f === 0n)
|
|
1669
1683
|
return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
|
|
1670
|
-
const
|
|
1684
|
+
const h = (L) => L < 0n ? 0n : L >= f ? f - 1n : L, m = { materializeOption: { materialize: !1 } }, { index: g, cumulative: N } = l.findIndexAtOrAfter(n, m);
|
|
1671
1685
|
let x;
|
|
1672
|
-
g === -1 ? x = f - 1n : (
|
|
1673
|
-
const
|
|
1674
|
-
let tt = 0,
|
|
1675
|
-
for (;
|
|
1676
|
-
const
|
|
1677
|
-
if (tt +=
|
|
1686
|
+
g === -1 ? x = f - 1n : (N === n ? x = Se(g + 1) : x = Se(g), x >= f && (x = f - 1n)), n <= 0 && (x = 0n), d && n >= c && (x = f - 1n);
|
|
1687
|
+
const k = (L) => {
|
|
1688
|
+
let tt = 0, et = L, E = L, ut = 0n;
|
|
1689
|
+
for (; et < f && tt < t; ) {
|
|
1690
|
+
const Pt = Number(et), ht = i(Pt);
|
|
1691
|
+
if (tt += ht, E = et, et += 1n, ut += 1n, !Number.isFinite(ht) || ht <= 0)
|
|
1678
1692
|
break;
|
|
1679
1693
|
}
|
|
1680
|
-
return
|
|
1694
|
+
return ut === 0n && (E = L), { height: tt, end: E };
|
|
1681
1695
|
};
|
|
1682
|
-
let { height:
|
|
1683
|
-
if (
|
|
1684
|
-
let
|
|
1685
|
-
for (;
|
|
1686
|
-
|
|
1687
|
-
const
|
|
1688
|
-
if (tt +=
|
|
1696
|
+
let { height: B, end: z } = k(x);
|
|
1697
|
+
if (B < t && x > 0n) {
|
|
1698
|
+
let L = x, tt = B;
|
|
1699
|
+
for (; L > 0n && tt < t; ) {
|
|
1700
|
+
L -= 1n;
|
|
1701
|
+
const E = Number(L), ut = i(E);
|
|
1702
|
+
if (tt += ut, !Number.isFinite(ut) || ut <= 0)
|
|
1689
1703
|
break;
|
|
1690
1704
|
}
|
|
1691
|
-
x =
|
|
1692
|
-
const
|
|
1693
|
-
|
|
1705
|
+
x = h(L);
|
|
1706
|
+
const et = k(x);
|
|
1707
|
+
B = et.height, z = et.end;
|
|
1694
1708
|
}
|
|
1695
|
-
const Q =
|
|
1709
|
+
const Q = h(x), pt = h(z), ct = h(Q - BigInt(Math.max(0, e))), st = h(pt + BigInt(Math.max(0, e)));
|
|
1696
1710
|
return {
|
|
1697
|
-
renderingStartIndex:
|
|
1698
|
-
renderingEndIndex:
|
|
1699
|
-
visibleStartIndex:
|
|
1700
|
-
visibleEndIndex:
|
|
1711
|
+
renderingStartIndex: it(Number(ct), r),
|
|
1712
|
+
renderingEndIndex: it(Number(st), r),
|
|
1713
|
+
visibleStartIndex: it(Number(Q), r),
|
|
1714
|
+
visibleEndIndex: it(Number(pt), r)
|
|
1701
1715
|
};
|
|
1702
|
-
}, hr = (n, t, e, r,
|
|
1716
|
+
}, hr = (n, t, e, r, i, l, c) => {
|
|
1703
1717
|
if (r === 0)
|
|
1704
1718
|
return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
|
|
1705
1719
|
const d = Number.isFinite(c), f = d ? Math.min(Math.max(0, n), c) : Math.max(0, n);
|
|
1706
1720
|
if (r >= Number.MAX_SAFE_INTEGER)
|
|
1707
|
-
return pr(f, t, e, r,
|
|
1708
|
-
const { index:
|
|
1709
|
-
let x =
|
|
1710
|
-
if (
|
|
1711
|
-
x =
|
|
1712
|
-
else if (x ===
|
|
1713
|
-
|
|
1721
|
+
return pr(f, t, e, r, i, l, c, d);
|
|
1722
|
+
const { index: h, cumulative: m, currentValue: g } = l.findIndexAtOrAfter(f, { materializeOption: { materialize: !1 } }), N = h === -1 ? t <= 0 || (m ?? 0) < f + (g ?? 0) ? r - 1 : 0 : h;
|
|
1723
|
+
let x = it(N, r), k = 0;
|
|
1724
|
+
if (h !== -1 && m === f)
|
|
1725
|
+
x = it(h + 1, r), k = 0;
|
|
1726
|
+
else if (x === h && m !== void 0 && g !== void 0)
|
|
1727
|
+
k = m - g - f;
|
|
1714
1728
|
else {
|
|
1715
|
-
const { cumulative:
|
|
1716
|
-
|
|
1729
|
+
const { cumulative: st, currentValue: L } = l.prefixSum(x, { materializeOption: { materialize: !1 } });
|
|
1730
|
+
k = (st ?? 0) - (L ?? 0) - f;
|
|
1717
1731
|
}
|
|
1718
|
-
const
|
|
1719
|
-
let
|
|
1720
|
-
for (;
|
|
1721
|
-
|
|
1722
|
-
if (
|
|
1723
|
-
let
|
|
1724
|
-
for (;
|
|
1725
|
-
|
|
1726
|
-
for (x =
|
|
1727
|
-
|
|
1732
|
+
const B = k;
|
|
1733
|
+
let z = x;
|
|
1734
|
+
for (; z < r && k < t; )
|
|
1735
|
+
k += i(z), z++;
|
|
1736
|
+
if (k < t && x > 0) {
|
|
1737
|
+
let st = k + Math.abs(Math.min(0, B)), L = x - 1;
|
|
1738
|
+
for (; L >= 0 && st < t; )
|
|
1739
|
+
st += i(L), L--;
|
|
1740
|
+
for (x = it(L + 1, r), k = 0, z = x; z < r && k < t; )
|
|
1741
|
+
k += i(z), z++;
|
|
1728
1742
|
}
|
|
1729
|
-
const Q =
|
|
1730
|
-
return { renderingStartIndex: Q, renderingEndIndex:
|
|
1731
|
-
},
|
|
1732
|
-
const r = Math.max(0, t ?? 0),
|
|
1733
|
-
return
|
|
1743
|
+
const Q = it(x - e, r), pt = it(Math.max(z - 1, x), r), ct = it(pt + e, r);
|
|
1744
|
+
return { renderingStartIndex: Q, renderingEndIndex: ct, visibleStartIndex: x, visibleEndIndex: pt };
|
|
1745
|
+
}, ke = (n, t, e) => {
|
|
1746
|
+
const r = Math.max(0, t ?? 0), i = T({ last: 0, id: null, arg: null }).current;
|
|
1747
|
+
return Y(
|
|
1734
1748
|
() => () => {
|
|
1735
|
-
|
|
1749
|
+
i.id !== null && (cancelAnimationFrame(i.id), i.id = null);
|
|
1736
1750
|
},
|
|
1737
|
-
[
|
|
1738
|
-
),
|
|
1751
|
+
[i]
|
|
1752
|
+
), P(
|
|
1739
1753
|
(l) => {
|
|
1740
|
-
if (
|
|
1754
|
+
if (i.arg = l, i.id !== null) return;
|
|
1741
1755
|
const c = (d) => {
|
|
1742
|
-
if (
|
|
1743
|
-
const f = d -
|
|
1744
|
-
if (r === 0 ||
|
|
1756
|
+
if (i.id = null, i.arg === null) return;
|
|
1757
|
+
const f = d - i.last;
|
|
1758
|
+
if (r === 0 || i.last === 0 || f >= r) {
|
|
1745
1759
|
if (n.current)
|
|
1746
1760
|
try {
|
|
1747
|
-
e(n.current,
|
|
1748
|
-
} catch (
|
|
1749
|
-
console.error("[useThrottledInvoker] Error invoking callback",
|
|
1761
|
+
e(n.current, i.arg);
|
|
1762
|
+
} catch (h) {
|
|
1763
|
+
console.error("[useThrottledInvoker] Error invoking callback", h);
|
|
1750
1764
|
}
|
|
1751
|
-
|
|
1765
|
+
i.arg = null, i.last = d;
|
|
1752
1766
|
}
|
|
1753
|
-
|
|
1767
|
+
i.arg !== null && (i.id = requestAnimationFrame(c));
|
|
1754
1768
|
};
|
|
1755
|
-
|
|
1769
|
+
i.id = requestAnimationFrame(c);
|
|
1756
1770
|
},
|
|
1757
|
-
[r, e, n,
|
|
1771
|
+
[r, e, n, i]
|
|
1758
1772
|
);
|
|
1759
|
-
}, gr = He.memo(({ index: n, top: t, height: e, item: r, children:
|
|
1760
|
-
const m =
|
|
1761
|
-
|
|
1773
|
+
}, gr = He.memo(({ index: n, top: t, height: e, item: r, children: i, clipItemHeight: l, enableKeyboardNavigation: c, onKeyDown: d, onFocus: f, registerItemRef: h }) => {
|
|
1774
|
+
const m = P((k) => h(n, k), [n, h]), g = P((k) => d(k, n), [n, d]), N = P(() => f(n), [n, f]), x = P((k) => {
|
|
1775
|
+
k.currentTarget.focus({ preventScroll: !0 });
|
|
1762
1776
|
}, []);
|
|
1763
1777
|
return /* @__PURE__ */ $(
|
|
1764
1778
|
"div",
|
|
@@ -1775,8 +1789,8 @@ const mr = 1e4, Pr = () => {
|
|
|
1775
1789
|
tabIndex: c ? -1 : void 0,
|
|
1776
1790
|
onPointerDown: c ? x : void 0,
|
|
1777
1791
|
onKeyDownCapture: c ? g : void 0,
|
|
1778
|
-
onFocusCapture: c ?
|
|
1779
|
-
children:
|
|
1792
|
+
onFocusCapture: c ? N : void 0,
|
|
1793
|
+
children: i(r, n)
|
|
1780
1794
|
}
|
|
1781
1795
|
);
|
|
1782
1796
|
}), xr = ({
|
|
@@ -1784,333 +1798,334 @@ const mr = 1e4, Pr = () => {
|
|
|
1784
1798
|
getItem: t,
|
|
1785
1799
|
getItemKey: e,
|
|
1786
1800
|
getItemHeight: r,
|
|
1787
|
-
viewportSize:
|
|
1801
|
+
viewportSize: i,
|
|
1788
1802
|
overscanCount: l = 15,
|
|
1789
1803
|
className: c,
|
|
1790
1804
|
onScroll: d,
|
|
1791
1805
|
onRangeChange: f,
|
|
1792
|
-
children:
|
|
1806
|
+
children: h,
|
|
1793
1807
|
background: m,
|
|
1794
1808
|
initialScrollIndex: g,
|
|
1795
|
-
initialScrollOffset:
|
|
1809
|
+
initialScrollOffset: N,
|
|
1796
1810
|
callbackThrottleMs: x = 5,
|
|
1797
|
-
contentInsets:
|
|
1798
|
-
onItemFocus:
|
|
1799
|
-
scrollBarOptions:
|
|
1800
|
-
behaviorOptions: Q
|
|
1801
|
-
|
|
1802
|
-
|
|
1811
|
+
contentInsets: k,
|
|
1812
|
+
onItemFocus: B,
|
|
1813
|
+
scrollBarOptions: z,
|
|
1814
|
+
behaviorOptions: Q,
|
|
1815
|
+
onWheelHorizontal: pt
|
|
1816
|
+
}, ct) => {
|
|
1817
|
+
const { width: st, enableThumbDrag: L, enableTrackClick: tt, enableArrowButtons: et, enableScrollToTopBottomButtons: E, renderThumbOverlay: ut, tapScrollCircleOptions: Pt } = z ?? {}, { enablePointerDrag: ht, enableKeyboardNavigation: I = !0, wheelSpeedMultiplier: W, inertiaOptions: St, clipItemHeight: Dt = !1, resetOnGetItemHeightChange: ot = !1 } = Q ?? {}, A = T(null), G = T({
|
|
1803
1818
|
renderingStartIndex: 0,
|
|
1804
1819
|
renderingEndIndex: 0,
|
|
1805
1820
|
visibleStartIndex: 0,
|
|
1806
1821
|
visibleEndIndex: 0,
|
|
1807
1822
|
scrollPosition: 0,
|
|
1808
1823
|
totalHeight: 0
|
|
1809
|
-
}),
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
}, [
|
|
1813
|
-
const v =
|
|
1824
|
+
}), dt = T(null), It = T(!1);
|
|
1825
|
+
Y(() => {
|
|
1826
|
+
ot && (dt.current = null);
|
|
1827
|
+
}, [ot]);
|
|
1828
|
+
const v = At(() => Ne(k), [k]), kt = At(
|
|
1814
1829
|
// 目的: Fenwick Tree のオプション設定
|
|
1815
1830
|
// 依存関係: resetOnGetItemHeightChange
|
|
1816
1831
|
() => ({
|
|
1817
1832
|
sampleRange: { from: 0, to: 100 },
|
|
1818
|
-
resetOnValueFnChange:
|
|
1833
|
+
resetOnValueFnChange: ot,
|
|
1819
1834
|
materialize: !0
|
|
1820
1835
|
}),
|
|
1821
|
-
[
|
|
1822
|
-
),
|
|
1823
|
-
let
|
|
1836
|
+
[ot]
|
|
1837
|
+
), S = ur(n, r, kt), [rt] = Bt(() => {
|
|
1838
|
+
let s = v.top, a = 0;
|
|
1824
1839
|
if (typeof g == "number") {
|
|
1825
|
-
const u =
|
|
1826
|
-
|
|
1827
|
-
} else typeof
|
|
1828
|
-
return { position:
|
|
1829
|
-
}), [
|
|
1830
|
-
|
|
1831
|
-
|
|
1840
|
+
const u = xt(g, 0, n - 1), R = xt(u - l * 2, 0, n - 1), D = xt(u + l * 2, 0, n - 1), C = g > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: R, to: D }] } } : void 0, { cumulative: X, total: U, currentValue: F } = S.prefixSum(g, C), O = Math.max(X - F, 0);
|
|
1841
|
+
s = se(O, v.top), a = U ?? S.getTotal();
|
|
1842
|
+
} else typeof N == "number" && (s = se(Math.max(N, 0), v.top)), a = S.getTotal();
|
|
1843
|
+
return { position: s, total: a };
|
|
1844
|
+
}), [Vt, Gt] = Bt(rt.position), [Mt, b] = Bt(rt.total), M = T(rt.position), q = T(v.top), ft = T(d ?? void 0), j = T(f ?? void 0), mt = T(/* @__PURE__ */ new Map()), Z = T(null), J = T(null), [bt, qt] = Bt(null), [yt, Tt] = Bt(!1), Ct = T(null), _t = T(!1), at = T(0), p = T(!1), y = T(n);
|
|
1845
|
+
y.current !== n && (y.current = n, p.current = !0), Y(() => {
|
|
1846
|
+
ft.current = d ?? void 0, j.current = f ?? void 0;
|
|
1832
1847
|
}, [f, d]);
|
|
1833
|
-
const
|
|
1834
|
-
(
|
|
1835
|
-
if (
|
|
1848
|
+
const nt = P(
|
|
1849
|
+
(s) => {
|
|
1850
|
+
if (I && s && typeof s.focus == "function")
|
|
1836
1851
|
try {
|
|
1837
|
-
|
|
1852
|
+
s.focus({ preventScroll: !0 });
|
|
1838
1853
|
} catch {
|
|
1839
|
-
|
|
1854
|
+
s.focus();
|
|
1840
1855
|
}
|
|
1841
1856
|
},
|
|
1842
|
-
[
|
|
1843
|
-
),
|
|
1844
|
-
|
|
1845
|
-
}, []),
|
|
1846
|
-
|
|
1847
|
-
}, []),
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
}), []),
|
|
1851
|
-
|
|
1852
|
-
}, [
|
|
1853
|
-
const
|
|
1854
|
-
(
|
|
1857
|
+
[I]
|
|
1858
|
+
), Lt = P((s, { position: a, totalHeight: u }) => {
|
|
1859
|
+
s(a, u);
|
|
1860
|
+
}, []), H = ke(ft, x, Lt), Zt = P((s, a) => {
|
|
1861
|
+
s(a);
|
|
1862
|
+
}, []), Ft = ke(j, x, Zt);
|
|
1863
|
+
Y(() => (It.current = !0, () => {
|
|
1864
|
+
It.current = !1;
|
|
1865
|
+
}), []), Y(() => {
|
|
1866
|
+
I || (mt.current.clear(), Z.current = null, J.current = null);
|
|
1867
|
+
}, [I]);
|
|
1868
|
+
const wt = P(
|
|
1869
|
+
(s, a) => {
|
|
1855
1870
|
if (!a) {
|
|
1856
|
-
mt.current.delete(
|
|
1871
|
+
mt.current.delete(s);
|
|
1857
1872
|
return;
|
|
1858
1873
|
}
|
|
1859
|
-
|
|
1874
|
+
I && (mt.current.set(s, a), Z.current === s && (Z.current = null, J.current = s, nt(a)));
|
|
1860
1875
|
},
|
|
1861
|
-
[
|
|
1862
|
-
),
|
|
1876
|
+
[I, nt]
|
|
1877
|
+
), Ht = 0.01, gt = T({
|
|
1863
1878
|
rafId: null,
|
|
1864
1879
|
loopActive: !1,
|
|
1865
1880
|
idleFrames: 0,
|
|
1866
|
-
lastRenderedPosition:
|
|
1867
|
-
}),
|
|
1868
|
-
const
|
|
1869
|
-
|
|
1881
|
+
lastRenderedPosition: rt.position
|
|
1882
|
+
}), Rt = P(() => {
|
|
1883
|
+
const s = gt.current;
|
|
1884
|
+
s.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(s.rafId), s.rafId = null, s.loopActive = !1, s.idleFrames = 0;
|
|
1870
1885
|
}, []);
|
|
1871
|
-
|
|
1886
|
+
Y(
|
|
1872
1887
|
() => () => {
|
|
1873
|
-
|
|
1888
|
+
Rt();
|
|
1874
1889
|
},
|
|
1875
|
-
[
|
|
1890
|
+
[Rt]
|
|
1876
1891
|
);
|
|
1877
|
-
const
|
|
1878
|
-
const
|
|
1879
|
-
|
|
1880
|
-
const a =
|
|
1881
|
-
if (
|
|
1882
|
-
|
|
1892
|
+
const Jt = P(() => {
|
|
1893
|
+
const s = gt.current;
|
|
1894
|
+
s.rafId = null;
|
|
1895
|
+
const a = M.current, u = jt(a, v.top), R = S.getTotal();
|
|
1896
|
+
if (Gt((C) => Math.abs(C - a) < Ht ? C : a), H({ position: u, totalHeight: R }), Math.abs(s.lastRenderedPosition - a) >= Ht ? (s.lastRenderedPosition = a, s.idleFrames = 0) : s.idleFrames += 1, s.idleFrames >= 2) {
|
|
1897
|
+
Rt();
|
|
1883
1898
|
return;
|
|
1884
1899
|
}
|
|
1885
1900
|
if (typeof requestAnimationFrame == "function") {
|
|
1886
|
-
|
|
1901
|
+
s.rafId = requestAnimationFrame(Jt);
|
|
1887
1902
|
return;
|
|
1888
1903
|
}
|
|
1889
|
-
|
|
1890
|
-
}, [
|
|
1891
|
-
const
|
|
1892
|
-
if (
|
|
1893
|
-
if (
|
|
1894
|
-
|
|
1904
|
+
s.loopActive = !1;
|
|
1905
|
+
}, [S, v.top, H, Rt]), ae = P(() => {
|
|
1906
|
+
const s = gt.current;
|
|
1907
|
+
if (s.idleFrames = 0, !s.loopActive) {
|
|
1908
|
+
if (s.loopActive = !0, typeof requestAnimationFrame == "function") {
|
|
1909
|
+
s.rafId = requestAnimationFrame(Jt);
|
|
1895
1910
|
return;
|
|
1896
1911
|
}
|
|
1897
|
-
|
|
1912
|
+
s.loopActive = !1;
|
|
1898
1913
|
}
|
|
1899
|
-
}, [
|
|
1900
|
-
(
|
|
1901
|
-
const u = a?.immediate ?? !1,
|
|
1902
|
-
if (
|
|
1903
|
-
|
|
1914
|
+
}, [Jt]), lt = P(
|
|
1915
|
+
(s, a) => {
|
|
1916
|
+
const u = a?.immediate ?? !1, R = jt(s, v.top);
|
|
1917
|
+
if (M.current = s, u) {
|
|
1918
|
+
gt.current.lastRenderedPosition = s, gt.current.idleFrames = 0, Gt(s), H({ position: R, totalHeight: S.getTotal() });
|
|
1904
1919
|
return;
|
|
1905
1920
|
}
|
|
1906
|
-
|
|
1921
|
+
ae();
|
|
1907
1922
|
},
|
|
1908
|
-
[
|
|
1909
|
-
),
|
|
1910
|
-
|
|
1911
|
-
if (!
|
|
1912
|
-
if (
|
|
1913
|
-
const
|
|
1914
|
-
|
|
1923
|
+
[ae, S, v.top, H]
|
|
1924
|
+
), le = T(!1);
|
|
1925
|
+
Y(() => {
|
|
1926
|
+
if (!le.current)
|
|
1927
|
+
if (le.current = !0, typeof N == "number") {
|
|
1928
|
+
const s = se(Math.max(N, 0), v.top), a = Math.abs(s - M.current) > 0.5;
|
|
1929
|
+
lt(s, { immediate: !0 }), a && A.current?.scrollTo(s);
|
|
1915
1930
|
} else
|
|
1916
|
-
|
|
1917
|
-
}, [
|
|
1918
|
-
const
|
|
1919
|
-
|
|
1920
|
-
}, [
|
|
1921
|
-
if (
|
|
1922
|
-
const { index:
|
|
1923
|
-
if (
|
|
1924
|
-
const
|
|
1925
|
-
let
|
|
1926
|
-
a === "bottom" ?
|
|
1927
|
-
const
|
|
1928
|
-
Math.abs(
|
|
1929
|
-
from:
|
|
1930
|
-
to:
|
|
1931
|
-
targetIndex:
|
|
1932
|
-
}),
|
|
1931
|
+
lt(M.current, { immediate: !0 });
|
|
1932
|
+
}, [N, v.top, lt]), Y(() => {
|
|
1933
|
+
const s = S.getTotal();
|
|
1934
|
+
Mt !== s && b(s);
|
|
1935
|
+
}, [S, Mt, n]), Y(() => {
|
|
1936
|
+
if (dt.current !== null) {
|
|
1937
|
+
const { index: s, align: a, offset: u } = dt.current, R = it(s, n), { cumulative: D, currentValue: C } = S.prefixSum(R, { materializeOption: { materialize: !1 } });
|
|
1938
|
+
if (D !== void 0 && C !== void 0) {
|
|
1939
|
+
const X = Math.max(D - C, 0);
|
|
1940
|
+
let U = X;
|
|
1941
|
+
a === "bottom" ? U = D - i : a === "center" && (U = X + C / 2 - i / 2), u && (U -= u), U = Math.max(0, U);
|
|
1942
|
+
const F = Math.max(0, Mt + v.top + v.bottom - i), O = Math.min(se(U, v.top), F);
|
|
1943
|
+
Math.abs(O - M.current) > 1 && (_.debug("[VirtualScroll] Drift correction", {
|
|
1944
|
+
from: M.current,
|
|
1945
|
+
to: O,
|
|
1946
|
+
targetIndex: R
|
|
1947
|
+
}), at.current === 0 && (at.current += 1), A.current?.scrollTo(O), lt(O, { immediate: !0 }));
|
|
1933
1948
|
}
|
|
1934
1949
|
}
|
|
1935
|
-
|
|
1936
|
-
}, [
|
|
1937
|
-
const
|
|
1938
|
-
if (
|
|
1939
|
-
const a =
|
|
1940
|
-
|
|
1941
|
-
}, [v.top,
|
|
1942
|
-
const
|
|
1943
|
-
(
|
|
1944
|
-
const u =
|
|
1945
|
-
|
|
1946
|
-
let
|
|
1947
|
-
if (
|
|
1948
|
-
const
|
|
1949
|
-
|
|
1950
|
+
p.current = !1;
|
|
1951
|
+
}, [Mt, S, n, v.top, lt, i, v.bottom]), Y(() => {
|
|
1952
|
+
const s = q.current;
|
|
1953
|
+
if (s === v.top) return;
|
|
1954
|
+
const a = jt(M.current, s), u = se(a, v.top);
|
|
1955
|
+
q.current = v.top, M.current = u, A.current?.scrollTo(u), lt(u, { immediate: !0 });
|
|
1956
|
+
}, [v.top, lt]);
|
|
1957
|
+
const ce = P(
|
|
1958
|
+
(s, a) => {
|
|
1959
|
+
const u = it(s, n), R = S.get(u), D = a - R, C = S.update(u, a);
|
|
1960
|
+
C !== void 0 && b(C), _.debug("[VirtualScroll] Updated item size manually", { index: u, size: a, total: C });
|
|
1961
|
+
let X = dt.current ? dt.current.index : null;
|
|
1962
|
+
if (X === null) {
|
|
1963
|
+
const U = M.current, F = Ne(k).top, O = jt(U, F), { index: Et } = S.findIndexAtOrAfter(O, { materializeOption: { materialize: !1 } });
|
|
1964
|
+
X = Et;
|
|
1950
1965
|
}
|
|
1951
|
-
if (
|
|
1952
|
-
const
|
|
1953
|
-
|
|
1966
|
+
if (X !== -1 && u < X && D !== 0) {
|
|
1967
|
+
const U = M.current, F = U + D;
|
|
1968
|
+
at.current += 1, lt(F, { immediate: !0 }), A.current?.scrollTo(F), _.debug("[VirtualScroll] Adjusted scroll for layout shift (manual update)", { from: U, to: F, causedByIndex: u, delta: D, activeVisibleStartIndex: X });
|
|
1954
1969
|
}
|
|
1955
1970
|
},
|
|
1956
|
-
[
|
|
1957
|
-
),
|
|
1958
|
-
(
|
|
1959
|
-
if (!
|
|
1971
|
+
[S, n, lt, k]
|
|
1972
|
+
), Nt = P(
|
|
1973
|
+
(s, a) => {
|
|
1974
|
+
if (!A.current)
|
|
1960
1975
|
return;
|
|
1961
|
-
const u =
|
|
1962
|
-
if (_.debug("[VirtualScroll] Scrolling to index:", u, "ItemBottom:",
|
|
1976
|
+
const u = it(s, n), R = it(u - l * 2, n), D = it(u + l * 2, n), { cumulative: C, total: X, currentValue: U } = S.prefixSum(u, { materializeOption: { materialize: !0, ranges: [{ from: R, to: D }] } });
|
|
1977
|
+
if (_.debug("[VirtualScroll] Scrolling to index:", u, "ItemBottom:", C, "Total height:", X, "ItemHeight:", U, "safeIndexFrom:", R, "safeIndexTo:", D), !X)
|
|
1963
1978
|
return;
|
|
1964
|
-
const
|
|
1965
|
-
let
|
|
1966
|
-
a?.align === "bottom" ?
|
|
1967
|
-
const
|
|
1968
|
-
|
|
1979
|
+
const F = Math.max(C - U, 0);
|
|
1980
|
+
let O = F;
|
|
1981
|
+
a?.align === "bottom" ? O = C - i : a?.align === "center" && (O = F + U / 2 - i / 2), a?.offset && (O -= a.offset), O = Math.max(0, O);
|
|
1982
|
+
const Et = se(O, v.top), vt = A.current?.getContentSize() ?? X + v.top + v.bottom, zt = Math.max(0, vt - i), te = Math.min(Et, zt);
|
|
1983
|
+
dt.current = {
|
|
1969
1984
|
index: u,
|
|
1970
1985
|
align: a?.align,
|
|
1971
1986
|
offset: a?.offset
|
|
1972
1987
|
};
|
|
1973
|
-
const
|
|
1974
|
-
|
|
1988
|
+
const ue = A.current?.getScrollPosition() ?? -1, de = Math.abs(ue - te) > 0.5;
|
|
1989
|
+
_t.current = !1, at.current = 0, de && (_t.current = !0, at.current += 1, A.current?.scrollTo(te)), b(X), lt(te, { immediate: !0 }), _.debug("[VirtualScroll] Setting scroll position to:", te, { original: Et, max: zt });
|
|
1975
1990
|
},
|
|
1976
|
-
[
|
|
1977
|
-
),
|
|
1978
|
-
(
|
|
1979
|
-
if (!
|
|
1991
|
+
[S, l, n, v.top, v.bottom, i, lt]
|
|
1992
|
+
), ee = P(
|
|
1993
|
+
(s) => {
|
|
1994
|
+
if (!A.current)
|
|
1980
1995
|
return;
|
|
1981
|
-
const a =
|
|
1982
|
-
|
|
1996
|
+
const a = S.getTotal(), u = xt(Math.floor(s), 0, a), { index: R, cumulative: D, currentValue: C } = S.findIndexAtOrAfter(u, { materializeOption: { materialize: !1 } }), U = (D ?? 0) - (C ?? 0) - u;
|
|
1997
|
+
Nt(R, { offset: U });
|
|
1983
1998
|
},
|
|
1984
|
-
[
|
|
1985
|
-
),
|
|
1986
|
-
(
|
|
1987
|
-
const a =
|
|
1988
|
-
|
|
1989
|
-
const
|
|
1990
|
-
return
|
|
1999
|
+
[S, Nt]
|
|
2000
|
+
), me = P(
|
|
2001
|
+
(s) => {
|
|
2002
|
+
const a = jt(M.current, v.top), u = typeof s == "function" ? s(a) : s;
|
|
2003
|
+
ee(u);
|
|
2004
|
+
const R = A.current?.getScrollPosition(), D = typeof R == "number" ? R : M.current;
|
|
2005
|
+
return lt(D), D;
|
|
1991
2006
|
},
|
|
1992
|
-
[v.top,
|
|
1993
|
-
),
|
|
1994
|
-
(
|
|
1995
|
-
_.debug("[VirtualScroll] Scroll position changed:",
|
|
1996
|
-
const u =
|
|
1997
|
-
u && (
|
|
1998
|
-
const
|
|
1999
|
-
if (
|
|
2000
|
-
if (u ||
|
|
2007
|
+
[v.top, ee, lt]
|
|
2008
|
+
), Ie = P(
|
|
2009
|
+
(s, a) => {
|
|
2010
|
+
_.debug("[VirtualScroll] Scroll position changed:", s);
|
|
2011
|
+
const u = _t.current;
|
|
2012
|
+
u && (_t.current = !1);
|
|
2013
|
+
const R = at.current > 0;
|
|
2014
|
+
if (R && (at.current = 0), u || R || p.current || (dt.current = null), lt(s), E) {
|
|
2015
|
+
if (u || R)
|
|
2001
2016
|
return;
|
|
2002
|
-
const
|
|
2003
|
-
if (_.debug("[VirtualScroll] Scroll diff:",
|
|
2004
|
-
const
|
|
2005
|
-
|
|
2006
|
-
|
|
2017
|
+
const D = s - a;
|
|
2018
|
+
if (_.debug("[VirtualScroll] Scroll diff:", D, "New:", s, "Prev:", a), Math.abs(D) > 1) {
|
|
2019
|
+
const C = D > 0 ? "down" : "up";
|
|
2020
|
+
qt(C), Tt(!0), _.debug("[VirtualScroll] Showing scroll buttons. Direction:", C), Ct.current && clearTimeout(Ct.current), Ct.current = setTimeout(() => {
|
|
2021
|
+
Tt(!1), _.debug("[VirtualScroll] Hiding scroll buttons");
|
|
2007
2022
|
}, 2e3);
|
|
2008
2023
|
}
|
|
2009
2024
|
}
|
|
2010
2025
|
},
|
|
2011
|
-
[
|
|
2012
|
-
),
|
|
2013
|
-
const
|
|
2026
|
+
[lt, E]
|
|
2027
|
+
), Ot = At(() => jt(Vt, v.top), [v.top, Vt]), Qt = At(() => {
|
|
2028
|
+
const s = S.getTotal(), a = hr(Ot, i, l, n, r, S, s);
|
|
2014
2029
|
return _.debug("[VirtualScroll] Calculated rendering range:", {
|
|
2015
2030
|
...a,
|
|
2016
|
-
scrollPosition:
|
|
2017
|
-
renderingContentSize:
|
|
2031
|
+
scrollPosition: Ot,
|
|
2032
|
+
renderingContentSize: s,
|
|
2018
2033
|
overscanCount: l,
|
|
2019
|
-
viewportSize:
|
|
2034
|
+
viewportSize: i
|
|
2020
2035
|
}), a;
|
|
2021
|
-
}, [
|
|
2022
|
-
(
|
|
2023
|
-
if (!
|
|
2036
|
+
}, [Ot, i, l, n, r, S]), { renderingStartIndex: Ut, renderingEndIndex: $t, visibleStartIndex: Yt, visibleEndIndex: Kt } = Qt, Wt = P(
|
|
2037
|
+
(s, a) => {
|
|
2038
|
+
if (!I || n === 0)
|
|
2024
2039
|
return;
|
|
2025
|
-
const u =
|
|
2040
|
+
const u = it(s, n);
|
|
2026
2041
|
if (!(a?.ensureVisible ?? !0)) {
|
|
2027
|
-
const
|
|
2028
|
-
|
|
2042
|
+
const zt = mt.current.get(u);
|
|
2043
|
+
zt && (Z.current = null, J.current = u, nt(zt));
|
|
2029
2044
|
return;
|
|
2030
2045
|
}
|
|
2031
|
-
const
|
|
2032
|
-
if (
|
|
2033
|
-
|
|
2046
|
+
const D = S.prefixSum(u, { materializeOption: { materialize: !1 } }), C = D.currentValue, X = Math.max(D.cumulative - C, 0), U = X + C, F = jt(M.current, v.top), O = F + i;
|
|
2047
|
+
if (X < F || U > O) {
|
|
2048
|
+
Z.current = u, Nt(u);
|
|
2034
2049
|
return;
|
|
2035
2050
|
}
|
|
2036
|
-
const
|
|
2037
|
-
if (
|
|
2038
|
-
|
|
2051
|
+
const vt = mt.current.get(u);
|
|
2052
|
+
if (vt) {
|
|
2053
|
+
Z.current = null, J.current = u, nt(vt);
|
|
2039
2054
|
return;
|
|
2040
2055
|
}
|
|
2041
|
-
|
|
2056
|
+
Z.current = u;
|
|
2042
2057
|
},
|
|
2043
|
-
[
|
|
2044
|
-
),
|
|
2045
|
-
(
|
|
2046
|
-
if (!
|
|
2058
|
+
[I, n, S, v.top, Nt, nt, i]
|
|
2059
|
+
), pe = P(
|
|
2060
|
+
(s, a) => {
|
|
2061
|
+
if (!I || s.defaultPrevented || s.altKey || s.metaKey || s.ctrlKey)
|
|
2047
2062
|
return;
|
|
2048
|
-
const u =
|
|
2063
|
+
const u = s.target;
|
|
2049
2064
|
if (u) {
|
|
2050
|
-
const
|
|
2051
|
-
if (
|
|
2065
|
+
const R = u.tagName;
|
|
2066
|
+
if (R === "INPUT" || R === "TEXTAREA" || R === "SELECT" || u.isContentEditable)
|
|
2052
2067
|
return;
|
|
2053
2068
|
}
|
|
2054
|
-
if (
|
|
2055
|
-
a < n - 1 && (
|
|
2069
|
+
if (s.key === "ArrowDown") {
|
|
2070
|
+
a < n - 1 && (s.preventDefault(), Wt(a + 1));
|
|
2056
2071
|
return;
|
|
2057
2072
|
}
|
|
2058
|
-
if (
|
|
2059
|
-
a > 0 && (
|
|
2073
|
+
if (s.key === "ArrowUp") {
|
|
2074
|
+
a > 0 && (s.preventDefault(), Wt(a - 1));
|
|
2060
2075
|
return;
|
|
2061
2076
|
}
|
|
2062
|
-
if (
|
|
2077
|
+
if (s.key === "PageDown") {
|
|
2063
2078
|
if (a < n - 1) {
|
|
2064
|
-
|
|
2065
|
-
const
|
|
2066
|
-
|
|
2079
|
+
s.preventDefault();
|
|
2080
|
+
const R = Math.max(Kt - Yt + 1, 1), D = Math.max(R, 1), C = it(Math.min(a + D, n - 1), n);
|
|
2081
|
+
Wt(C);
|
|
2067
2082
|
}
|
|
2068
2083
|
return;
|
|
2069
2084
|
}
|
|
2070
|
-
if (
|
|
2071
|
-
|
|
2072
|
-
const
|
|
2073
|
-
|
|
2085
|
+
if (s.key === "PageUp" && a > 0) {
|
|
2086
|
+
s.preventDefault();
|
|
2087
|
+
const R = Math.max(Kt - Yt + 1, 1), D = Math.max(R, 1), C = it(a - D, n);
|
|
2088
|
+
Wt(C);
|
|
2074
2089
|
}
|
|
2075
2090
|
},
|
|
2076
|
-
[
|
|
2077
|
-
),
|
|
2078
|
-
(
|
|
2079
|
-
if (!
|
|
2091
|
+
[I, n, Wt, Kt, Yt]
|
|
2092
|
+
), he = P(
|
|
2093
|
+
(s) => {
|
|
2094
|
+
if (!I)
|
|
2080
2095
|
return;
|
|
2081
|
-
const a =
|
|
2082
|
-
|
|
2096
|
+
const a = it(s, n);
|
|
2097
|
+
Z.current = null, J.current = a, B?.(a);
|
|
2083
2098
|
},
|
|
2084
|
-
[
|
|
2099
|
+
[I, n, B]
|
|
2085
2100
|
);
|
|
2086
|
-
|
|
2087
|
-
const
|
|
2101
|
+
Y(() => {
|
|
2102
|
+
const s = A.current?.getScrollPosition() ?? 0, a = M.current, u = jt(a, v.top);
|
|
2088
2103
|
_.debug("[VirtualScroll] Range change effect triggered", {
|
|
2089
|
-
renderingStartIndex:
|
|
2090
|
-
renderingEndIndex:
|
|
2091
|
-
visibleStartIndex:
|
|
2092
|
-
visibleEndIndex:
|
|
2093
|
-
scrollPositionState:
|
|
2104
|
+
renderingStartIndex: Ut,
|
|
2105
|
+
renderingEndIndex: $t,
|
|
2106
|
+
visibleStartIndex: Yt,
|
|
2107
|
+
visibleEndIndex: Kt,
|
|
2108
|
+
scrollPositionState: Vt,
|
|
2094
2109
|
paneScrollPosition: a,
|
|
2095
2110
|
logicalScrollPosition: u,
|
|
2096
|
-
contentSize:
|
|
2097
|
-
scrollPaneScrollPosition:
|
|
2098
|
-
}),
|
|
2099
|
-
renderingStartIndex:
|
|
2100
|
-
renderingEndIndex:
|
|
2101
|
-
visibleStartIndex:
|
|
2102
|
-
visibleEndIndex:
|
|
2111
|
+
contentSize: Mt,
|
|
2112
|
+
scrollPaneScrollPosition: s
|
|
2113
|
+
}), Ft({
|
|
2114
|
+
renderingStartIndex: Ut,
|
|
2115
|
+
renderingEndIndex: $t,
|
|
2116
|
+
visibleStartIndex: Yt,
|
|
2117
|
+
visibleEndIndex: Kt,
|
|
2103
2118
|
scrollPosition: u,
|
|
2104
|
-
totalHeight:
|
|
2119
|
+
totalHeight: Mt
|
|
2105
2120
|
});
|
|
2106
|
-
}, [
|
|
2107
|
-
const
|
|
2121
|
+
}, [Mt, $t, Ut, v.top, Ft, Vt, Kt, Yt]);
|
|
2122
|
+
const ge = P(() => E ? /* @__PURE__ */ $("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": yt && bt !== null, children: bt === "up" ? /* @__PURE__ */ $("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ $(
|
|
2108
2123
|
"button",
|
|
2109
2124
|
{
|
|
2110
2125
|
type: "button",
|
|
2111
2126
|
className: "aqvs-scroll-to-edge-button",
|
|
2112
2127
|
onClick: (u) => {
|
|
2113
|
-
u.stopPropagation(),
|
|
2128
|
+
u.stopPropagation(), _t.current = !0, Nt(0), Tt(!1);
|
|
2114
2129
|
},
|
|
2115
2130
|
children: "Top"
|
|
2116
2131
|
}
|
|
@@ -2120,179 +2135,180 @@ const mr = 1e4, Pr = () => {
|
|
|
2120
2135
|
type: "button",
|
|
2121
2136
|
className: "aqvs-scroll-to-edge-button",
|
|
2122
2137
|
onClick: (u) => {
|
|
2123
|
-
u.stopPropagation(),
|
|
2138
|
+
u.stopPropagation(), _t.current = !0, Nt(n - 1), Tt(!1);
|
|
2124
2139
|
},
|
|
2125
2140
|
children: "Bottom"
|
|
2126
2141
|
}
|
|
2127
|
-
) }) }) : null, [
|
|
2142
|
+
) }) }) : null, [E, yt, bt, Nt, n]), { visibleItems: ie, startPosition: o } = At(() => {
|
|
2128
2143
|
if (n === 0)
|
|
2129
2144
|
return {
|
|
2130
2145
|
visibleItems: /* @__PURE__ */ $("div", { className: "aqvs-no-items-container", children: /* @__PURE__ */ $("div", { className: "aqvs-no-items-text", children: "No items" }) }),
|
|
2131
2146
|
startPosition: 0
|
|
2132
2147
|
};
|
|
2133
|
-
const
|
|
2134
|
-
let
|
|
2135
|
-
for (let
|
|
2136
|
-
const
|
|
2137
|
-
|
|
2138
|
-
const { cumulative:
|
|
2139
|
-
|
|
2148
|
+
const s = it(Ut, n), a = it($t, n), { cumulative: u, currentValue: R } = S.prefixSum(s, { materializeOption: { materialize: !1 } }), D = u - R, C = [], X = [];
|
|
2149
|
+
let U = 0;
|
|
2150
|
+
for (let F = s; F <= a; F++) {
|
|
2151
|
+
const O = r(F), Et = S.get(F), vt = O - Et;
|
|
2152
|
+
vt !== 0 && C.push({ index: F, value: O });
|
|
2153
|
+
const { cumulative: zt, currentValue: te } = S.prefixSum(F, { materializeOption: { materialize: !1 } }), ue = zt - te + U, de = e ? e(F) : F;
|
|
2154
|
+
X.push(
|
|
2140
2155
|
/* @__PURE__ */ $(
|
|
2141
2156
|
gr,
|
|
2142
2157
|
{
|
|
2143
|
-
index:
|
|
2144
|
-
top:
|
|
2145
|
-
height:
|
|
2146
|
-
item: t(
|
|
2147
|
-
clipItemHeight:
|
|
2148
|
-
enableKeyboardNavigation:
|
|
2149
|
-
onKeyDown:
|
|
2150
|
-
onFocus:
|
|
2151
|
-
registerItemRef:
|
|
2152
|
-
children:
|
|
2158
|
+
index: F,
|
|
2159
|
+
top: ue - D + v.top,
|
|
2160
|
+
height: O,
|
|
2161
|
+
item: t(F),
|
|
2162
|
+
clipItemHeight: Dt,
|
|
2163
|
+
enableKeyboardNavigation: I,
|
|
2164
|
+
onKeyDown: pe,
|
|
2165
|
+
onFocus: he,
|
|
2166
|
+
registerItemRef: wt,
|
|
2167
|
+
children: h
|
|
2153
2168
|
},
|
|
2154
|
-
|
|
2169
|
+
de
|
|
2155
2170
|
)
|
|
2156
|
-
),
|
|
2171
|
+
), U += vt;
|
|
2157
2172
|
}
|
|
2158
|
-
return
|
|
2159
|
-
if (!
|
|
2173
|
+
return C.length > 0 && Promise.resolve().then(() => {
|
|
2174
|
+
if (!It.current)
|
|
2160
2175
|
return;
|
|
2161
|
-
let
|
|
2162
|
-
for (const
|
|
2163
|
-
if (
|
|
2164
|
-
const
|
|
2165
|
-
|
|
2176
|
+
let F = 0;
|
|
2177
|
+
for (const vt of C)
|
|
2178
|
+
if (vt.index < Yt) {
|
|
2179
|
+
const zt = S.get(vt.index);
|
|
2180
|
+
F += vt.value - zt;
|
|
2166
2181
|
}
|
|
2167
|
-
const
|
|
2168
|
-
if (!
|
|
2182
|
+
const O = S.updates(C);
|
|
2183
|
+
if (!It.current || typeof O != "number")
|
|
2169
2184
|
return;
|
|
2170
|
-
|
|
2171
|
-
const
|
|
2172
|
-
if (
|
|
2173
|
-
const
|
|
2174
|
-
|
|
2175
|
-
} else
|
|
2176
|
-
}), { visibleItems:
|
|
2185
|
+
b(O), _.debug("[VirtualScroll] Updated heights for items", C, "New total height:", O);
|
|
2186
|
+
const Et = A.current?.getScrollPosition() ?? M.current;
|
|
2187
|
+
if (F !== 0) {
|
|
2188
|
+
const vt = Et + F;
|
|
2189
|
+
at.current += 1, lt(vt, { immediate: !0 }), A.current?.scrollTo(vt), _.debug("[VirtualScroll] Adjusted scroll for layout shift (auto update)", { from: Et, to: vt, shiftAmount: F });
|
|
2190
|
+
} else Et !== M.current && lt(Et);
|
|
2191
|
+
}), { visibleItems: X, startPosition: D };
|
|
2177
2192
|
}, [
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2193
|
+
h,
|
|
2194
|
+
Dt,
|
|
2195
|
+
I,
|
|
2181
2196
|
n,
|
|
2182
|
-
|
|
2197
|
+
S,
|
|
2183
2198
|
t,
|
|
2184
2199
|
e,
|
|
2185
2200
|
r,
|
|
2201
|
+
he,
|
|
2186
2202
|
pe,
|
|
2187
|
-
|
|
2188
|
-
Zt,
|
|
2189
|
-
Kt,
|
|
2203
|
+
wt,
|
|
2190
2204
|
$t,
|
|
2205
|
+
Ut,
|
|
2191
2206
|
v.top,
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
]),
|
|
2195
|
-
(
|
|
2196
|
-
const a = (x ?? 0) > 0, u = Math.abs(
|
|
2207
|
+
lt,
|
|
2208
|
+
Yt
|
|
2209
|
+
]), w = P(
|
|
2210
|
+
(s) => {
|
|
2211
|
+
const a = (x ?? 0) > 0, u = Math.abs(s - Vt), R = a && u > 0.5 ? Vt : s, D = jt(R, v.top);
|
|
2197
2212
|
if (_.debug("[VirtualScroll] Rendering visible items", {
|
|
2198
|
-
currentScrollPosition:
|
|
2199
|
-
effectiveScrollPosition:
|
|
2200
|
-
renderingStartIndex:
|
|
2201
|
-
renderingEndIndex:
|
|
2213
|
+
currentScrollPosition: s,
|
|
2214
|
+
effectiveScrollPosition: D,
|
|
2215
|
+
renderingStartIndex: Ut,
|
|
2216
|
+
renderingEndIndex: $t,
|
|
2202
2217
|
itemCount: n,
|
|
2203
|
-
viewportSize:
|
|
2218
|
+
viewportSize: i,
|
|
2204
2219
|
callbackThrottleMs: x,
|
|
2205
2220
|
diff: u,
|
|
2206
|
-
rawEffectiveScrollPosition:
|
|
2221
|
+
rawEffectiveScrollPosition: R
|
|
2207
2222
|
}), n === 0)
|
|
2208
2223
|
return ie;
|
|
2209
|
-
const
|
|
2224
|
+
const C = o - D, X = v.bottom > 0 ? /* @__PURE__ */ $(
|
|
2210
2225
|
"div",
|
|
2211
2226
|
{
|
|
2212
2227
|
className: "aqvs-bottom-inset",
|
|
2213
2228
|
style: {
|
|
2214
|
-
top:
|
|
2229
|
+
top: S.getTotal() + v.top - o,
|
|
2215
2230
|
height: v.bottom
|
|
2216
2231
|
}
|
|
2217
2232
|
},
|
|
2218
2233
|
"virtualscroll-bottom-inset"
|
|
2219
2234
|
) : null;
|
|
2220
2235
|
return _.debug("[VirtualScroll] Rendering items", {
|
|
2221
|
-
containerTop:
|
|
2222
|
-
logicalScrollPosition:
|
|
2236
|
+
containerTop: C,
|
|
2237
|
+
logicalScrollPosition: Ot,
|
|
2223
2238
|
resolvedInsets: v,
|
|
2224
|
-
effectiveScrollPosition:
|
|
2225
|
-
}), /* @__PURE__ */
|
|
2239
|
+
effectiveScrollPosition: D
|
|
2240
|
+
}), /* @__PURE__ */ ne("div", { className: "aqvs-items-wrapper", style: { top: C, position: "relative" }, children: [
|
|
2226
2241
|
ie,
|
|
2227
|
-
|
|
2242
|
+
X
|
|
2228
2243
|
] });
|
|
2229
2244
|
},
|
|
2230
|
-
[x, n,
|
|
2231
|
-
),
|
|
2245
|
+
[x, n, S, Ot, $t, Ut, v, Vt, o, i, ie]
|
|
2246
|
+
), V = At(
|
|
2232
2247
|
() => ({
|
|
2233
|
-
renderingStartIndex:
|
|
2234
|
-
renderingEndIndex:
|
|
2235
|
-
visibleStartIndex:
|
|
2236
|
-
visibleEndIndex:
|
|
2237
|
-
scrollPosition:
|
|
2238
|
-
totalHeight:
|
|
2248
|
+
renderingStartIndex: Qt.renderingStartIndex,
|
|
2249
|
+
renderingEndIndex: Qt.renderingEndIndex,
|
|
2250
|
+
visibleStartIndex: Qt.visibleStartIndex,
|
|
2251
|
+
visibleEndIndex: Qt.visibleEndIndex,
|
|
2252
|
+
scrollPosition: Ot,
|
|
2253
|
+
totalHeight: S.getTotal()
|
|
2239
2254
|
// contentSize (State) ではなく最新値を反映
|
|
2240
2255
|
}),
|
|
2241
|
-
[
|
|
2256
|
+
[Qt, Ot, S]
|
|
2242
2257
|
);
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
}, [
|
|
2246
|
-
|
|
2258
|
+
Y(() => {
|
|
2259
|
+
G.current = V;
|
|
2260
|
+
}, [V]), we(
|
|
2261
|
+
ct,
|
|
2247
2262
|
() => ({
|
|
2248
|
-
getScrollPosition: () =>
|
|
2249
|
-
getContentSize: () =>
|
|
2250
|
-
getViewportSize: () =>
|
|
2251
|
-
scrollTo:
|
|
2252
|
-
scrollToIndex:
|
|
2253
|
-
getFenwickTreeTotalHeight: () =>
|
|
2254
|
-
getFenwickSize: () =>
|
|
2255
|
-
focusItemAtIndex:
|
|
2256
|
-
getRange: () =>
|
|
2257
|
-
updateItemSize:
|
|
2263
|
+
getScrollPosition: () => A.current?.getScrollPosition() ?? -1,
|
|
2264
|
+
getContentSize: () => A.current?.getContentSize() ?? -1,
|
|
2265
|
+
getViewportSize: () => A.current?.getViewportSize() ?? -1,
|
|
2266
|
+
scrollTo: me,
|
|
2267
|
+
scrollToIndex: Nt,
|
|
2268
|
+
getFenwickTreeTotalHeight: () => S.getTotal(),
|
|
2269
|
+
getFenwickSize: () => S.getSize(),
|
|
2270
|
+
focusItemAtIndex: Wt,
|
|
2271
|
+
getRange: () => G.current,
|
|
2272
|
+
updateItemSize: ce
|
|
2258
2273
|
}),
|
|
2259
|
-
[
|
|
2274
|
+
[me, Nt, S, Wt, ce]
|
|
2260
2275
|
);
|
|
2261
|
-
const
|
|
2276
|
+
const K = S.getTotal() + v.top + v.bottom;
|
|
2262
2277
|
return /* @__PURE__ */ $(
|
|
2263
2278
|
ar,
|
|
2264
2279
|
{
|
|
2265
|
-
ref:
|
|
2266
|
-
contentSize:
|
|
2267
|
-
viewportSize:
|
|
2280
|
+
ref: A,
|
|
2281
|
+
contentSize: K,
|
|
2282
|
+
viewportSize: i,
|
|
2268
2283
|
className: c,
|
|
2269
|
-
onScroll:
|
|
2284
|
+
onScroll: Ie,
|
|
2270
2285
|
background: m,
|
|
2271
|
-
tapScrollCircleOptions:
|
|
2272
|
-
inertiaOptions:
|
|
2286
|
+
tapScrollCircleOptions: Pt,
|
|
2287
|
+
inertiaOptions: St,
|
|
2273
2288
|
itemCount: n,
|
|
2274
|
-
scrollBarWidth:
|
|
2275
|
-
enableThumbDrag:
|
|
2276
|
-
enableTrackClick:
|
|
2277
|
-
enableArrowButtons:
|
|
2278
|
-
enablePointerDrag:
|
|
2279
|
-
renderThumbOverlay:
|
|
2280
|
-
wheelSpeedMultiplier:
|
|
2289
|
+
scrollBarWidth: st,
|
|
2290
|
+
enableThumbDrag: L,
|
|
2291
|
+
enableTrackClick: tt,
|
|
2292
|
+
enableArrowButtons: et,
|
|
2293
|
+
enablePointerDrag: ht,
|
|
2294
|
+
renderThumbOverlay: ut,
|
|
2295
|
+
wheelSpeedMultiplier: W,
|
|
2296
|
+
onWheelHorizontal: pt,
|
|
2281
2297
|
contentInsets: v,
|
|
2282
|
-
visibleStartIndex:
|
|
2283
|
-
visibleEndIndex:
|
|
2284
|
-
renderOverlay:
|
|
2285
|
-
initialScrollPosition:
|
|
2286
|
-
children:
|
|
2298
|
+
visibleStartIndex: Yt,
|
|
2299
|
+
visibleEndIndex: Kt,
|
|
2300
|
+
renderOverlay: ge,
|
|
2301
|
+
initialScrollPosition: rt.position,
|
|
2302
|
+
children: w
|
|
2287
2303
|
}
|
|
2288
2304
|
);
|
|
2289
|
-
}, Sr =
|
|
2305
|
+
}, Sr = ye(xr);
|
|
2290
2306
|
export {
|
|
2291
2307
|
cr as FenwickMapTree,
|
|
2292
2308
|
or as ScrollBar,
|
|
2293
2309
|
ar as ScrollPane,
|
|
2294
2310
|
Sr as VirtualScroll,
|
|
2295
|
-
|
|
2311
|
+
xt as minmax,
|
|
2296
2312
|
Tr as tapScrollCircleSampleVisual,
|
|
2297
2313
|
ur as useFenwickMapTree,
|
|
2298
2314
|
Pr as useHeightCache,
|