@aiquants/virtualscroll 1.18.5 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -13
- package/dist/ScrollPane.d.cts +2 -0
- package/dist/ScrollPane.d.ts +2 -0
- package/dist/ScrollPane.d.ts.map +1 -1
- package/dist/VirtualScroll.d.cts +2 -0
- package/dist/VirtualScroll.d.ts +2 -0
- package/dist/VirtualScroll.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1115 -1112
- package/dist/styles/virtualscroll.css +1 -1
- package/dist/styles/virtualscroll.standalone.css +3 -0
- package/package.json +6 -4
- package/src/ScrollBar.spec.tsx +620 -0
- package/src/ScrollBar.tsx +1397 -0
- package/src/ScrollPane.spec.tsx +482 -0
- package/src/ScrollPane.tsx +913 -0
- package/src/TapScrollCircle.spec.tsx +275 -0
- package/src/TapScrollCircle.tsx +363 -0
- package/src/VirtualScroll.spec.ts +623 -0
- package/src/VirtualScroll.tsx +1891 -0
- package/src/cli.server.spec.ts +137 -0
- package/src/cli.server.ts +110 -0
- package/src/index.ts +24 -0
- package/src/logger.spec.ts +128 -0
- package/src/logger.ts +229 -0
- package/src/styles/components.entry.css +7 -0
- package/src/styles/standalone.entry.css +11 -0
- package/src/styles/virtualscroll.css +298 -0
- package/src/tapScrollCircleSampleVisual.tsx +74 -0
- package/src/useFenwickMapTree.huge.spec.ts +388 -0
- package/src/useFenwickMapTree.spec.ts +1518 -0
- package/src/useFenwickMapTree.ts +1368 -0
- package/src/useHeightCache.ts +32 -0
- package/src/useLruCache.spec.ts +382 -0
- package/src/useLruCache.ts +301 -0
- package/src/utils.spec.ts +39 -0
- package/src/utils.ts +16 -0
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import Qe, { memo as tr, forwardRef as Fe, useState as
|
|
3
|
-
import { twMerge as
|
|
4
|
-
class
|
|
1
|
+
import { jsx as Q, jsxs as ue, Fragment as Ke } from "react/jsx-runtime";
|
|
2
|
+
import Qe, { memo as tr, forwardRef as Fe, useState as jt, useRef as g, useCallback as S, useImperativeHandle as ke, useMemo as Nt, useLayoutEffect as be, useEffect as X, useId as er } from "react";
|
|
3
|
+
import { twMerge as ce } from "tailwind-merge";
|
|
4
|
+
class N {
|
|
5
5
|
level;
|
|
6
6
|
prefix;
|
|
7
7
|
impl;
|
|
@@ -14,7 +14,7 @@ class V {
|
|
|
14
14
|
constructor(t = 2, e = "[virtualscroll]", r = console) {
|
|
15
15
|
this.level = t, this.prefix = e, this.impl = r;
|
|
16
16
|
}
|
|
17
|
-
static instance = new
|
|
17
|
+
static instance = new N(2, "[virtualscroll]");
|
|
18
18
|
/**
|
|
19
19
|
* @method setLevel
|
|
20
20
|
* @description Updates the current log level for the static instance.
|
|
@@ -22,7 +22,7 @@ class V {
|
|
|
22
22
|
* @param {LogLevel} level - The new log level.
|
|
23
23
|
*/
|
|
24
24
|
static setLevel(t) {
|
|
25
|
-
|
|
25
|
+
N.instance.setLevel(t);
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* @method setLevel
|
|
@@ -40,7 +40,7 @@ class V {
|
|
|
40
40
|
* @param {ILogger} impl - The new logger implementation.
|
|
41
41
|
*/
|
|
42
42
|
static setImplementation(t) {
|
|
43
|
-
|
|
43
|
+
N.instance.setImplementation(t);
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* @method setImplementation
|
|
@@ -58,7 +58,7 @@ class V {
|
|
|
58
58
|
* @param {string} prefix - The new prefix.
|
|
59
59
|
*/
|
|
60
60
|
static setPrefix(t) {
|
|
61
|
-
|
|
61
|
+
N.instance.setPrefix(t);
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* @method setPrefix
|
|
@@ -77,7 +77,7 @@ class V {
|
|
|
77
77
|
* @returns {boolean} True if a message at `level` would be emitted. / `level` のメッセージが出力されるなら true。
|
|
78
78
|
*/
|
|
79
79
|
static isEnabled(t) {
|
|
80
|
-
return
|
|
80
|
+
return N.instance.isEnabled(t);
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* @method isEnabled
|
|
@@ -122,28 +122,28 @@ class V {
|
|
|
122
122
|
return typeof t == "string" ? [`${this.prefix} ${t}`] : [this.prefix, t];
|
|
123
123
|
}
|
|
124
124
|
static debug(t, ...e) {
|
|
125
|
-
|
|
125
|
+
N.instance.debug(t, ...e);
|
|
126
126
|
}
|
|
127
127
|
debug(t, ...e) {
|
|
128
|
-
this.level <= 0 && this.impl.debug(...this.formatMessage(
|
|
128
|
+
this.level <= 0 && this.impl.debug(...this.formatMessage(N.resolveLazy(t)), ...e.map(N.resolveLazy));
|
|
129
129
|
}
|
|
130
130
|
static info(t, ...e) {
|
|
131
|
-
|
|
131
|
+
N.instance.info(t, ...e);
|
|
132
132
|
}
|
|
133
133
|
info(t, ...e) {
|
|
134
|
-
this.level <= 1 && this.impl.info(...this.formatMessage(
|
|
134
|
+
this.level <= 1 && this.impl.info(...this.formatMessage(N.resolveLazy(t)), ...e.map(N.resolveLazy));
|
|
135
135
|
}
|
|
136
136
|
static warn(t, ...e) {
|
|
137
|
-
|
|
137
|
+
N.instance.warn(t, ...e);
|
|
138
138
|
}
|
|
139
139
|
warn(t, ...e) {
|
|
140
|
-
this.level <= 2 && this.impl.warn(...this.formatMessage(
|
|
140
|
+
this.level <= 2 && this.impl.warn(...this.formatMessage(N.resolveLazy(t)), ...e.map(N.resolveLazy));
|
|
141
141
|
}
|
|
142
142
|
static error(t, ...e) {
|
|
143
|
-
|
|
143
|
+
N.instance.error(t, ...e);
|
|
144
144
|
}
|
|
145
145
|
error(t, ...e) {
|
|
146
|
-
this.level <= 3 && this.impl.error(...this.formatMessage(
|
|
146
|
+
this.level <= 3 && this.impl.error(...this.formatMessage(N.resolveLazy(t)), ...e.map(N.resolveLazy));
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
const Ye = {
|
|
@@ -155,8 +155,8 @@ const Ye = {
|
|
|
155
155
|
pointerId: null
|
|
156
156
|
}, Ae = 6, rr = 8, nr = ({ dragState: i, normalizedDistance: t }) => {
|
|
157
157
|
const e = 1 + t * 0.18, r = 0.16 + t * 0.24, n = 0.38 + t * 0.28, s = i.active ? "80ms ease-out" : "220ms ease";
|
|
158
|
-
return /* @__PURE__ */
|
|
159
|
-
/* @__PURE__ */
|
|
158
|
+
return /* @__PURE__ */ ue(Ke, { children: [
|
|
159
|
+
/* @__PURE__ */ Q(
|
|
160
160
|
"div",
|
|
161
161
|
{
|
|
162
162
|
className: "aqvs-tap-scroll-circle-visual-outer",
|
|
@@ -168,7 +168,7 @@ const Ye = {
|
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
),
|
|
171
|
-
/* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ Q(
|
|
172
172
|
"div",
|
|
173
173
|
{
|
|
174
174
|
className: "aqvs-tap-scroll-circle-inner",
|
|
@@ -183,90 +183,90 @@ const Ye = {
|
|
|
183
183
|
] });
|
|
184
184
|
}, We = tr(
|
|
185
185
|
Fe(({ onDragChange: i, className: t, maxVisualDistance: e = 160, size: r = 40, style: n, opacity: s = 1, renderVisual: l }, u) => {
|
|
186
|
-
const [f,
|
|
187
|
-
(
|
|
188
|
-
|
|
186
|
+
const [f, x] = jt(Ye), I = g(null), M = g(null), _ = g({ x: 0, y: 0 }), p = g(null), D = g(0), J = S(
|
|
187
|
+
(b) => {
|
|
188
|
+
x(b), i(b);
|
|
189
189
|
},
|
|
190
190
|
[i]
|
|
191
|
-
),
|
|
192
|
-
(
|
|
193
|
-
const { x:
|
|
194
|
-
let
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
active:
|
|
198
|
-
offsetX:
|
|
199
|
-
offsetY:
|
|
200
|
-
distance:
|
|
201
|
-
direction:
|
|
202
|
-
pointerId:
|
|
191
|
+
), G = S(
|
|
192
|
+
(b, K, ft = !1) => {
|
|
193
|
+
const { x: et, y: Y } = _.current, W = b - et, bt = K - Y, St = Math.abs(bt), R = St < Ae ? 0 : bt < 0 ? -1 : 1, Ft = D.current;
|
|
194
|
+
let Lt = R;
|
|
195
|
+
const v = Ae + rr;
|
|
196
|
+
R === 0 ? Ft !== 0 && St < v ? Lt = Ft : (Lt = 0, ft || (D.current = 0)) : R !== Ft && Ft !== 0 && St < v ? Lt = Ft : D.current = R, J({
|
|
197
|
+
active: ft || St >= Ae,
|
|
198
|
+
offsetX: W,
|
|
199
|
+
offsetY: bt,
|
|
200
|
+
distance: St,
|
|
201
|
+
direction: Lt,
|
|
202
|
+
pointerId: I.current
|
|
203
203
|
});
|
|
204
204
|
},
|
|
205
|
-
[
|
|
206
|
-
),
|
|
207
|
-
if (
|
|
205
|
+
[J]
|
|
206
|
+
), rt = S((b) => {
|
|
207
|
+
if (b === null)
|
|
208
208
|
return;
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
}, []), nt =
|
|
212
|
-
(
|
|
213
|
-
|
|
209
|
+
const K = p.current;
|
|
210
|
+
K?.hasPointerCapture(b) && K.releasePointerCapture(b);
|
|
211
|
+
}, []), nt = S(
|
|
212
|
+
(b = !1) => {
|
|
213
|
+
b && rt(I.current), I.current = null, M.current = null, D.current = 0, J(Ye);
|
|
214
214
|
},
|
|
215
|
-
[
|
|
216
|
-
),
|
|
217
|
-
(
|
|
218
|
-
if (
|
|
219
|
-
|
|
215
|
+
[J, rt]
|
|
216
|
+
), st = S(
|
|
217
|
+
(b) => {
|
|
218
|
+
if (I.current !== null && I.current !== b.pointerId) {
|
|
219
|
+
M.current = { pointerId: b.pointerId, clientX: b.clientX, clientY: b.clientY }, b.preventDefault(), b.stopPropagation();
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
222
|
-
|
|
223
|
-
const
|
|
224
|
-
|
|
222
|
+
b.preventDefault(), b.stopPropagation();
|
|
223
|
+
const K = p.current ?? b.currentTarget, { left: ft, top: et, width: Y, height: W } = K.getBoundingClientRect();
|
|
224
|
+
_.current = { x: ft + Y / 2, y: et + W / 2 }, I.current = b.pointerId;
|
|
225
225
|
try {
|
|
226
|
-
|
|
226
|
+
K.setPointerCapture(b.pointerId);
|
|
227
227
|
} catch {
|
|
228
228
|
}
|
|
229
|
-
|
|
229
|
+
G(b.clientX, b.clientY, !0);
|
|
230
230
|
},
|
|
231
|
-
[
|
|
232
|
-
),
|
|
233
|
-
(
|
|
234
|
-
if (
|
|
235
|
-
|
|
231
|
+
[G]
|
|
232
|
+
), wt = S(
|
|
233
|
+
(b) => {
|
|
234
|
+
if (I.current !== b.pointerId) {
|
|
235
|
+
M.current !== null && M.current.pointerId === b.pointerId && (M.current = { pointerId: b.pointerId, clientX: b.clientX, clientY: b.clientY });
|
|
236
236
|
return;
|
|
237
237
|
}
|
|
238
|
-
|
|
238
|
+
b.preventDefault(), G(b.clientX, b.clientY);
|
|
239
239
|
},
|
|
240
|
-
[
|
|
241
|
-
),
|
|
242
|
-
(
|
|
243
|
-
if (
|
|
244
|
-
|
|
240
|
+
[G]
|
|
241
|
+
), Vt = S(
|
|
242
|
+
(b) => {
|
|
243
|
+
if (I.current !== b.pointerId) {
|
|
244
|
+
M.current !== null && M.current.pointerId === b.pointerId && (M.current = null);
|
|
245
245
|
return;
|
|
246
246
|
}
|
|
247
|
-
|
|
248
|
-
const
|
|
249
|
-
if (
|
|
250
|
-
|
|
251
|
-
const
|
|
252
|
-
let
|
|
253
|
-
if (
|
|
247
|
+
b.preventDefault(), b.stopPropagation();
|
|
248
|
+
const K = M.current;
|
|
249
|
+
if (M.current = null, K !== null) {
|
|
250
|
+
rt(b.pointerId);
|
|
251
|
+
const ft = p.current;
|
|
252
|
+
let et = !0;
|
|
253
|
+
if (ft !== null && typeof ft.setPointerCapture == "function")
|
|
254
254
|
try {
|
|
255
|
-
|
|
256
|
-
} catch (
|
|
257
|
-
(typeof
|
|
255
|
+
ft.setPointerCapture(K.pointerId);
|
|
256
|
+
} catch (Y) {
|
|
257
|
+
(typeof Y == "object" && Y !== null && "name" in Y ? Y.name : void 0) === "NotFoundError" && (et = !1);
|
|
258
258
|
}
|
|
259
|
-
if (
|
|
260
|
-
|
|
259
|
+
if (et) {
|
|
260
|
+
I.current = K.pointerId, G(K.clientX, K.clientY, !0);
|
|
261
261
|
return;
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
nt(!0);
|
|
265
265
|
},
|
|
266
|
-
[nt,
|
|
267
|
-
),
|
|
268
|
-
(
|
|
269
|
-
|
|
266
|
+
[nt, rt, G]
|
|
267
|
+
), z = S(
|
|
268
|
+
(b) => {
|
|
269
|
+
I.current === b.pointerId && nt(!1);
|
|
270
270
|
},
|
|
271
271
|
[nt]
|
|
272
272
|
);
|
|
@@ -280,39 +280,39 @@ const Ye = {
|
|
|
280
280
|
}),
|
|
281
281
|
[nt]
|
|
282
282
|
);
|
|
283
|
-
const
|
|
283
|
+
const B = Math.min(Math.max(s, 0), 1), w = r / 64, C = Math.min(f.distance, e) / e, U = f.direction * C * 10 * w, H = l ?? nr, tt = {
|
|
284
284
|
dragState: f,
|
|
285
|
-
normalizedDistance:
|
|
286
|
-
sizeScale:
|
|
285
|
+
normalizedDistance: C,
|
|
286
|
+
sizeScale: w,
|
|
287
287
|
size: r,
|
|
288
|
-
opacity:
|
|
289
|
-
},
|
|
288
|
+
opacity: B
|
|
289
|
+
}, L = {
|
|
290
290
|
...n,
|
|
291
291
|
width: r,
|
|
292
292
|
height: r,
|
|
293
|
-
transform: `translateY(${
|
|
293
|
+
transform: `translateY(${U}px)`
|
|
294
294
|
};
|
|
295
|
-
return
|
|
295
|
+
return L.opacity = B, /* @__PURE__ */ Q(
|
|
296
296
|
"div",
|
|
297
297
|
{
|
|
298
298
|
ref: p,
|
|
299
299
|
"data-testid": "virtual-scroll-tap-circle",
|
|
300
|
-
className:
|
|
301
|
-
style:
|
|
300
|
+
className: ce("aqvs-tap-scroll-circle", t),
|
|
301
|
+
style: L,
|
|
302
302
|
tabIndex: -1,
|
|
303
|
-
onPointerDown:
|
|
304
|
-
onPointerMove:
|
|
305
|
-
onPointerUp:
|
|
306
|
-
onPointerCancel:
|
|
307
|
-
onLostPointerCapture:
|
|
303
|
+
onPointerDown: st,
|
|
304
|
+
onPointerMove: wt,
|
|
305
|
+
onPointerUp: Vt,
|
|
306
|
+
onPointerCancel: Vt,
|
|
307
|
+
onLostPointerCapture: z,
|
|
308
308
|
role: "presentation",
|
|
309
|
-
children: H(
|
|
309
|
+
children: H(tt)
|
|
310
310
|
}
|
|
311
311
|
);
|
|
312
312
|
})
|
|
313
313
|
);
|
|
314
314
|
We.displayName = "TapScrollCircle";
|
|
315
|
-
const
|
|
315
|
+
const gt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scroll-cancel", Be = 20, ir = 250, or = 60, sr = 20, ar = 20, lr = 240, qe = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, De = 2.2, cr = 8, ur = 120, dr = 1 / 10, Wt = {
|
|
316
316
|
enabled: !0,
|
|
317
317
|
size: 40,
|
|
318
318
|
offsetX: -80,
|
|
@@ -346,39 +346,39 @@ const mt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
346
346
|
}, mr = (i, t) => {
|
|
347
347
|
const e = i?.maxSpeedMultiplier, r = typeof e == "number" ? e : gr(t);
|
|
348
348
|
return {
|
|
349
|
-
enabled: i?.enabled ??
|
|
350
|
-
size: i?.size ??
|
|
351
|
-
offsetX: i?.offsetX ??
|
|
352
|
-
offsetY: i?.offsetY ??
|
|
353
|
-
className: i?.className ??
|
|
354
|
-
maxVisualDistance: i?.maxVisualDistance ??
|
|
349
|
+
enabled: i?.enabled ?? Wt.enabled,
|
|
350
|
+
size: i?.size ?? Wt.size,
|
|
351
|
+
offsetX: i?.offsetX ?? Wt.offsetX,
|
|
352
|
+
offsetY: i?.offsetY ?? Wt.offsetY,
|
|
353
|
+
className: i?.className ?? Wt.className,
|
|
354
|
+
maxVisualDistance: i?.maxVisualDistance ?? Wt.maxVisualDistance,
|
|
355
355
|
maxSpeedMultiplier: r,
|
|
356
|
-
minSpeedMultiplier: Math.max(i?.minSpeedMultiplier ??
|
|
357
|
-
opacity:
|
|
358
|
-
renderVisual: i?.renderVisual ??
|
|
359
|
-
maxSpeedCurve: i?.maxSpeedCurve ??
|
|
356
|
+
minSpeedMultiplier: Math.max(i?.minSpeedMultiplier ?? Wt.minSpeedMultiplier, 0),
|
|
357
|
+
opacity: gt(i?.opacity ?? Wt.opacity, 0, 1),
|
|
358
|
+
renderVisual: i?.renderVisual ?? Wt.renderVisual,
|
|
359
|
+
maxSpeedCurve: i?.maxSpeedCurve ?? Wt.maxSpeedCurve
|
|
360
360
|
};
|
|
361
|
-
}, pr = ({ isDragging: i, isThumbHovered: t, enableThumbDrag: e }) =>
|
|
362
|
-
const n =
|
|
361
|
+
}, pr = ({ isDragging: i, isThumbHovered: t, enableThumbDrag: e }) => Nt(() => e ? i ? "dragging" : t ? "hover" : "idle" : "disabled", [e, i, t]), hr = ({ canUseArrowButtons: i, enableArrowButtons: t, resetTapScroll: e, scrollByStep: r }) => {
|
|
362
|
+
const n = g(null), s = g(null), l = g(null), u = S(() => {
|
|
363
363
|
n.current !== null && (window.clearInterval(n.current), n.current = null), s.current !== null && (window.clearTimeout(s.current), s.current = null), l.current !== null && (window.removeEventListener("pointerup", l.current), window.removeEventListener("pointercancel", l.current), window.removeEventListener("blur", l.current), l.current = null);
|
|
364
|
-
}, []), f =
|
|
364
|
+
}, []), f = S(() => {
|
|
365
365
|
u();
|
|
366
|
-
}, [u]),
|
|
367
|
-
(
|
|
366
|
+
}, [u]), x = S(
|
|
367
|
+
(M) => (_) => {
|
|
368
368
|
if (!i)
|
|
369
369
|
return;
|
|
370
|
-
|
|
370
|
+
_.cancelable && _.preventDefault(), _.stopPropagation(), e(), u(), r(M), s.current = window.setTimeout(() => {
|
|
371
371
|
n.current = window.setInterval(() => {
|
|
372
|
-
r(
|
|
372
|
+
r(M);
|
|
373
373
|
}, or);
|
|
374
374
|
}, ir);
|
|
375
375
|
const p = () => u();
|
|
376
376
|
l.current = p, window.addEventListener("pointerup", p), window.addEventListener("pointercancel", p), window.addEventListener("blur", p);
|
|
377
377
|
},
|
|
378
378
|
[i, u, e, r]
|
|
379
|
-
),
|
|
380
|
-
(
|
|
381
|
-
t && (
|
|
379
|
+
), I = S(
|
|
380
|
+
(M) => (_) => {
|
|
381
|
+
t && (_.key === "Enter" || _.key === " " || _.key === "Spacebar") && (_.preventDefault(), r(M));
|
|
382
382
|
},
|
|
383
383
|
[t, r]
|
|
384
384
|
);
|
|
@@ -386,12 +386,12 @@ const mt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
386
386
|
i || u();
|
|
387
387
|
}, [i, u]), X(() => () => {
|
|
388
388
|
u();
|
|
389
|
-
}, [u]), { handleArrowPointerDown:
|
|
389
|
+
}, [u]), { handleArrowPointerDown: x, handleArrowPointerUp: f, handleArrowKeyDown: I };
|
|
390
390
|
}, gr = (i) => {
|
|
391
391
|
if (!i || i <= 0)
|
|
392
392
|
return De;
|
|
393
393
|
const t = Math.max(1, i), e = Math.log10(t), r = De + e * cr;
|
|
394
|
-
return
|
|
394
|
+
return gt(r, De, ur);
|
|
395
395
|
}, br = ({
|
|
396
396
|
contentSize: i,
|
|
397
397
|
viewportSize: t,
|
|
@@ -402,242 +402,242 @@ const mt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
402
402
|
enableArrowButtons: l = !0,
|
|
403
403
|
horizontal: u = !1,
|
|
404
404
|
scrollBarWidth: f = 12,
|
|
405
|
-
className:
|
|
406
|
-
ariaControls:
|
|
407
|
-
tapScrollCircleOptions:
|
|
408
|
-
itemCount:
|
|
405
|
+
className: x,
|
|
406
|
+
ariaControls: I,
|
|
407
|
+
tapScrollCircleOptions: M,
|
|
408
|
+
itemCount: _,
|
|
409
409
|
renderThumbOverlay: p,
|
|
410
|
-
visibleStartIndex:
|
|
411
|
-
visibleEndIndex:
|
|
410
|
+
visibleStartIndex: D,
|
|
411
|
+
visibleEndIndex: J
|
|
412
412
|
}) => {
|
|
413
|
-
const [
|
|
413
|
+
const [G, rt] = jt(!1), [nt, st] = jt(!1), [wt, Vt] = jt(!1), z = g(null), B = g({
|
|
414
414
|
pointerId: null,
|
|
415
415
|
startThumbPosition: 0,
|
|
416
416
|
startClientX: 0,
|
|
417
417
|
startClientY: 0,
|
|
418
418
|
scale: 1,
|
|
419
419
|
captureTarget: null
|
|
420
|
-
}),
|
|
421
|
-
enabled:
|
|
422
|
-
size:
|
|
423
|
-
offsetX:
|
|
424
|
-
offsetY:
|
|
425
|
-
className:
|
|
426
|
-
maxVisualDistance:
|
|
427
|
-
maxSpeedMultiplier:
|
|
428
|
-
minSpeedMultiplier:
|
|
429
|
-
opacity:
|
|
430
|
-
renderVisual:
|
|
431
|
-
maxSpeedCurve:
|
|
432
|
-
} =
|
|
420
|
+
}), w = g({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 }), C = g(e), U = g(r), H = g(qe), tt = g(null), L = g(null), b = g(null), K = g(0), ft = g(0), et = Nt(() => mr(M, _), [_, M]), Y = Nt(() => fr(u), [u]), {
|
|
421
|
+
enabled: W,
|
|
422
|
+
size: bt,
|
|
423
|
+
offsetX: St,
|
|
424
|
+
offsetY: R,
|
|
425
|
+
className: Ft,
|
|
426
|
+
maxVisualDistance: Lt,
|
|
427
|
+
maxSpeedMultiplier: v,
|
|
428
|
+
minSpeedMultiplier: zt,
|
|
429
|
+
opacity: _t,
|
|
430
|
+
renderVisual: Gt,
|
|
431
|
+
maxSpeedCurve: T
|
|
432
|
+
} = et, O = g({
|
|
433
433
|
viewportSize: t,
|
|
434
434
|
maxScrollPosition: Math.max(i - t, 0),
|
|
435
435
|
scrollBarVisible: i > t,
|
|
436
|
-
effectiveTapMaxDistance: Math.max(
|
|
437
|
-
tapCircleMaxSpeedMultiplier:
|
|
438
|
-
tapCircleMinSpeedMultiplier:
|
|
439
|
-
tapCircleMaxSpeedCurve:
|
|
440
|
-
tapScrollCircleOptions:
|
|
436
|
+
effectiveTapMaxDistance: Math.max(Lt, 1),
|
|
437
|
+
tapCircleMaxSpeedMultiplier: v,
|
|
438
|
+
tapCircleMinSpeedMultiplier: zt,
|
|
439
|
+
tapCircleMaxSpeedCurve: T,
|
|
440
|
+
tapScrollCircleOptions: M,
|
|
441
441
|
effectiveTrackLength: 0,
|
|
442
442
|
onScroll: r,
|
|
443
443
|
scrollPosition: e
|
|
444
|
-
}), { mainSizeKey:
|
|
445
|
-
|
|
446
|
-
|
|
444
|
+
}), { mainSizeKey: A, crossSizeKey: mt, positionKey: lt, selectDelta: ct, getPointerCoordinate: Mt, arrowLabels: j, arrowIcons: At, directionClass: pt, orientation: Zt } = Y, Ot = Math.max(Lt, 1), Rt = t / i, Ct = Math.max(t - f * 2, 0), Xt = Rt * Ct, ut = Math.min(Math.max(Be, Xt || 0), Ct || Be), xt = i - t, m = Math.max(Ct - ut, 0), V = xt <= 0 || m <= 0 ? 0 : gt(e / xt * m, 0, m), It = V + ut / 2, vt = i > t || G, ht = vt && l;
|
|
445
|
+
be(() => {
|
|
446
|
+
O.current = {
|
|
447
447
|
viewportSize: t,
|
|
448
|
-
maxScrollPosition:
|
|
449
|
-
scrollBarVisible:
|
|
450
|
-
effectiveTapMaxDistance:
|
|
451
|
-
tapCircleMaxSpeedMultiplier:
|
|
452
|
-
tapCircleMinSpeedMultiplier:
|
|
453
|
-
tapCircleMaxSpeedCurve:
|
|
454
|
-
tapScrollCircleOptions:
|
|
455
|
-
effectiveTrackLength:
|
|
448
|
+
maxScrollPosition: xt,
|
|
449
|
+
scrollBarVisible: vt,
|
|
450
|
+
effectiveTapMaxDistance: Ot,
|
|
451
|
+
tapCircleMaxSpeedMultiplier: v,
|
|
452
|
+
tapCircleMinSpeedMultiplier: zt,
|
|
453
|
+
tapCircleMaxSpeedCurve: T,
|
|
454
|
+
tapScrollCircleOptions: M,
|
|
455
|
+
effectiveTrackLength: m,
|
|
456
456
|
onScroll: r,
|
|
457
457
|
scrollPosition: e
|
|
458
458
|
};
|
|
459
|
-
}),
|
|
460
|
-
|
|
461
|
-
}, [e]),
|
|
462
|
-
|
|
459
|
+
}), be(() => {
|
|
460
|
+
C.current = e;
|
|
461
|
+
}, [e]), be(() => {
|
|
462
|
+
U.current = r;
|
|
463
463
|
}, [r]), X(() => {
|
|
464
|
-
n ||
|
|
464
|
+
n || st(!1);
|
|
465
465
|
}, [n]);
|
|
466
|
-
const
|
|
467
|
-
const
|
|
468
|
-
if (
|
|
469
|
-
const
|
|
470
|
-
if (typeof
|
|
471
|
-
return
|
|
466
|
+
const se = pr({ isDragging: G, isThumbHovered: nt, enableThumbDrag: n }), Et = S((a, h) => {
|
|
467
|
+
const P = O.current, F = h ?? C.current;
|
|
468
|
+
if (U.current) {
|
|
469
|
+
const y = U.current(a, F);
|
|
470
|
+
if (typeof y == "number" && Number.isFinite(y))
|
|
471
|
+
return C.current = y, y;
|
|
472
472
|
}
|
|
473
|
-
const
|
|
474
|
-
return
|
|
475
|
-
}, []),
|
|
473
|
+
const o = typeof a == "function" ? a(F) : a, c = Math.max(P.maxScrollPosition, 0), d = P.scrollBarVisible ? gt(o, 0, c) : 0;
|
|
474
|
+
return C.current = d, d;
|
|
475
|
+
}, []), $t = S(
|
|
476
476
|
(a) => {
|
|
477
|
-
const
|
|
478
|
-
if (!
|
|
479
|
-
const
|
|
480
|
-
return { nextPosition:
|
|
477
|
+
const h = O.current, P = C.current;
|
|
478
|
+
if (!h.scrollBarVisible || h.maxScrollPosition <= 0) {
|
|
479
|
+
const E = Et(0, P), q = E - P;
|
|
480
|
+
return { nextPosition: E, actualDelta: q, reachedBoundary: !0 };
|
|
481
481
|
}
|
|
482
482
|
if (a === 0)
|
|
483
|
-
return { nextPosition:
|
|
484
|
-
const
|
|
485
|
-
return { nextPosition:
|
|
483
|
+
return { nextPosition: P, actualDelta: 0, reachedBoundary: !1 };
|
|
484
|
+
const o = Et((E) => gt(E + a, 0, h.maxScrollPosition), P), c = o - P, d = a < 0 && P + a <= 0, y = a > 0 && P + a >= h.maxScrollPosition, k = a < 0 && (o <= 0 || d && c === 0) || a > 0 && (o >= h.maxScrollPosition || y && c === 0);
|
|
485
|
+
return { nextPosition: o, actualDelta: c, reachedBoundary: k };
|
|
486
486
|
},
|
|
487
|
-
[
|
|
488
|
-
),
|
|
489
|
-
(a,
|
|
490
|
-
a.current +=
|
|
491
|
-
const
|
|
492
|
-
|
|
493
|
-
const
|
|
494
|
-
return a.current -=
|
|
487
|
+
[Et]
|
|
488
|
+
), Ht = S(
|
|
489
|
+
(a, h) => {
|
|
490
|
+
a.current += h;
|
|
491
|
+
const P = Math.max(O.current.maxScrollPosition, 0);
|
|
492
|
+
P > 0 && (a.current = gt(a.current, -P, P));
|
|
493
|
+
const F = $t(a.current);
|
|
494
|
+
return a.current -= F.actualDelta, F.reachedBoundary && (a.current = 0), F;
|
|
495
495
|
},
|
|
496
|
-
[
|
|
497
|
-
),
|
|
498
|
-
|
|
499
|
-
}, []),
|
|
500
|
-
H.current = { ...qe },
|
|
501
|
-
}, [
|
|
496
|
+
[$t]
|
|
497
|
+
), Dt = S(() => {
|
|
498
|
+
L.current !== null && (window.cancelAnimationFrame(L.current), L.current = null), b.current = null, K.current = 0, ft.current = 0;
|
|
499
|
+
}, []), kt = S(() => {
|
|
500
|
+
H.current = { ...qe }, Vt(!1), tt.current?.reset(), Dt();
|
|
501
|
+
}, [Dt]), Ut = S(
|
|
502
502
|
(a) => {
|
|
503
|
-
const
|
|
504
|
-
if (!
|
|
505
|
-
|
|
503
|
+
const h = H.current, P = O.current;
|
|
504
|
+
if (!h.active || h.direction === 0) {
|
|
505
|
+
Dt();
|
|
506
506
|
return;
|
|
507
507
|
}
|
|
508
|
-
if (!
|
|
509
|
-
|
|
508
|
+
if (!P.scrollBarVisible || P.maxScrollPosition <= 0) {
|
|
509
|
+
Dt();
|
|
510
510
|
return;
|
|
511
511
|
}
|
|
512
|
-
const
|
|
513
|
-
if (
|
|
514
|
-
|
|
512
|
+
const F = b.current ?? a, o = Math.max((a - F) / 1e3, 0), c = Math.min(o, dr);
|
|
513
|
+
if (b.current = a, c <= 0) {
|
|
514
|
+
L.current = window.requestAnimationFrame(Ut);
|
|
515
515
|
return;
|
|
516
516
|
}
|
|
517
|
-
const
|
|
518
|
-
let
|
|
519
|
-
const
|
|
520
|
-
if (
|
|
521
|
-
const
|
|
522
|
-
|
|
517
|
+
const d = Math.min(h.distance, P.effectiveTapMaxDistance) / P.effectiveTapMaxDistance, y = d ** 1.1, k = typeof P.tapScrollCircleOptions?.maxSpeedMultiplier == "number", E = Math.max(P.viewportSize * P.tapCircleMinSpeedMultiplier, 40), q = k ? E : 1200;
|
|
518
|
+
let at = Math.max(P.viewportSize * P.tapCircleMaxSpeedMultiplier, q);
|
|
519
|
+
const Z = P.tapCircleMaxSpeedCurve;
|
|
520
|
+
if (Z) {
|
|
521
|
+
const ie = Math.max(Z.exponentialSteepness, 0), je = Math.max(Z.exponentialScale ?? P.tapCircleMaxSpeedMultiplier, 0), Ge = ie === 0 ? d : Math.expm1(ie * d), ze = ie === 0 ? 1 : Math.expm1(ie) || 1, Ze = ze === 0 ? d : Math.min(Math.max(Ge / ze, 0), 1), Je = P.viewportSize * je * Ze;
|
|
522
|
+
at = Math.min(at, Math.max(Je, E));
|
|
523
523
|
}
|
|
524
|
-
const
|
|
525
|
-
|
|
526
|
-
const { reachedBoundary:
|
|
527
|
-
if (
|
|
528
|
-
|
|
524
|
+
const ot = Math.max(at, E), Pt = Math.max(Z?.easedOffset ?? 0, 0), Tt = Math.min(1, y + Pt), yt = E + (ot - E) * Tt;
|
|
525
|
+
ft.current !== h.direction && (ft.current = h.direction, K.current = 0);
|
|
526
|
+
const { reachedBoundary: le } = Ht(K, h.direction * yt * c);
|
|
527
|
+
if (le) {
|
|
528
|
+
Dt();
|
|
529
529
|
return;
|
|
530
530
|
}
|
|
531
|
-
|
|
531
|
+
L.current = window.requestAnimationFrame(Ut);
|
|
532
532
|
},
|
|
533
|
-
[
|
|
534
|
-
),
|
|
535
|
-
|
|
536
|
-
}, [
|
|
533
|
+
[Ht, Dt]
|
|
534
|
+
), ae = S(() => {
|
|
535
|
+
L.current === null && (b.current = null, K.current = 0, L.current = window.requestAnimationFrame(Ut));
|
|
536
|
+
}, [Ut]);
|
|
537
537
|
X(() => () => {
|
|
538
|
-
|
|
539
|
-
}, [
|
|
540
|
-
const
|
|
538
|
+
Dt();
|
|
539
|
+
}, [Dt]);
|
|
540
|
+
const Me = S(
|
|
541
541
|
(a) => {
|
|
542
|
-
H.current = a,
|
|
542
|
+
H.current = a, Vt(a.active), a.active && a.direction !== 0 ? ae() : Dt();
|
|
543
543
|
},
|
|
544
|
-
[
|
|
544
|
+
[ae, Dt]
|
|
545
545
|
);
|
|
546
546
|
X(() => {
|
|
547
|
-
|
|
548
|
-
}, [
|
|
549
|
-
const a = (
|
|
550
|
-
const
|
|
551
|
-
|
|
547
|
+
W || kt();
|
|
548
|
+
}, [kt, W]), X(() => {
|
|
549
|
+
const a = (h) => {
|
|
550
|
+
const F = h.detail?.paneId;
|
|
551
|
+
F && I && F !== I || kt();
|
|
552
552
|
};
|
|
553
553
|
return window.addEventListener(Oe, a), () => {
|
|
554
554
|
window.removeEventListener(Oe, a);
|
|
555
555
|
};
|
|
556
|
-
}, [
|
|
557
|
-
if (!
|
|
556
|
+
}, [I, kt]), X(() => {
|
|
557
|
+
if (!W)
|
|
558
558
|
return;
|
|
559
|
-
const a = (
|
|
560
|
-
if (!H.current.active || H.current.pointerId ===
|
|
559
|
+
const a = (h) => {
|
|
560
|
+
if (!H.current.active || H.current.pointerId === h.pointerId)
|
|
561
561
|
return;
|
|
562
|
-
const
|
|
563
|
-
if (!(
|
|
564
|
-
|
|
562
|
+
const P = h.target;
|
|
563
|
+
if (!(P instanceof Node)) {
|
|
564
|
+
kt();
|
|
565
565
|
return;
|
|
566
566
|
}
|
|
567
|
-
|
|
567
|
+
tt.current?.getElement()?.contains(P) || kt();
|
|
568
568
|
};
|
|
569
569
|
return document.addEventListener("pointerdown", a, !0), () => {
|
|
570
570
|
document.removeEventListener("pointerdown", a, !0);
|
|
571
571
|
};
|
|
572
|
-
}, [
|
|
573
|
-
const
|
|
574
|
-
if (!
|
|
572
|
+
}, [kt, W]);
|
|
573
|
+
const de = (a) => {
|
|
574
|
+
if (!vt || m <= 0 || xt <= 0)
|
|
575
575
|
return 0;
|
|
576
|
-
const
|
|
577
|
-
return
|
|
578
|
-
},
|
|
579
|
-
const { scrollBarVisible:
|
|
580
|
-
if (
|
|
576
|
+
const h = gt(a, 0, m);
|
|
577
|
+
return gt(h / m * xt, 0, xt);
|
|
578
|
+
}, xe = S((a) => {
|
|
579
|
+
const { scrollBarVisible: h, effectiveTrackLength: P, maxScrollPosition: F } = O.current;
|
|
580
|
+
if (N.debug("[ScrollBar] calculateScrollPositionFromThumb", () => ({ thumbPos: a, trackLen: P, maxScroll: F })), P <= 0 || F <= 0)
|
|
581
581
|
return null;
|
|
582
|
-
const
|
|
583
|
-
return
|
|
584
|
-
}, []),
|
|
582
|
+
const o = gt(a, 0, P);
|
|
583
|
+
return gt(o / P * F, 0, F);
|
|
584
|
+
}, []), it = S(
|
|
585
585
|
(a) => {
|
|
586
|
-
const
|
|
587
|
-
const
|
|
588
|
-
return Number.isFinite(
|
|
589
|
-
},
|
|
590
|
-
return
|
|
586
|
+
const h = a.getBoundingClientRect(), P = u ? h.width : h.height, F = (k) => {
|
|
587
|
+
const E = Number.parseFloat(k);
|
|
588
|
+
return Number.isFinite(E) ? E : 0;
|
|
589
|
+
}, o = window.getComputedStyle(a), c = F(u ? o.width : o.height), d = c > 0 ? c + F(u ? o.paddingLeft : o.paddingTop) + F(u ? o.paddingRight : o.paddingBottom) + F(u ? o.borderLeftWidth : o.borderTopWidth) + F(u ? o.borderRightWidth : o.borderBottomWidth) : 0, y = d > 0 ? d : u ? a.offsetWidth : a.offsetHeight;
|
|
590
|
+
return y <= 0 || P <= 0 ? 1 : P / y;
|
|
591
591
|
},
|
|
592
592
|
[u]
|
|
593
|
-
),
|
|
593
|
+
), Yt = S(
|
|
594
594
|
(a) => {
|
|
595
|
-
const
|
|
596
|
-
if (
|
|
595
|
+
const h = B.current;
|
|
596
|
+
if (h.pointerId !== a.pointerId)
|
|
597
597
|
return;
|
|
598
|
-
const
|
|
599
|
-
|
|
600
|
-
delta:
|
|
601
|
-
startThumbPosition:
|
|
598
|
+
const P = a.clientX - h.startClientX, F = a.clientY - h.startClientY, o = ct(P, F) / (h.scale || 1);
|
|
599
|
+
N.debug("[ScrollBar] handleThumbPointerMove", () => ({
|
|
600
|
+
delta: o,
|
|
601
|
+
startThumbPosition: h.startThumbPosition,
|
|
602
602
|
clientY: a.clientY,
|
|
603
|
-
startClientY:
|
|
604
|
-
metrics:
|
|
603
|
+
startClientY: h.startClientY,
|
|
604
|
+
metrics: O.current
|
|
605
605
|
}));
|
|
606
|
-
const
|
|
607
|
-
|
|
606
|
+
const c = xe(h.startThumbPosition + o);
|
|
607
|
+
c !== null && Et(c), a.cancelable && a.preventDefault();
|
|
608
608
|
},
|
|
609
|
-
[
|
|
610
|
-
),
|
|
609
|
+
[ct, xe, Et]
|
|
610
|
+
), Kt = S(
|
|
611
611
|
(a) => {
|
|
612
|
-
const
|
|
613
|
-
if (
|
|
612
|
+
const h = B.current;
|
|
613
|
+
if (h.pointerId !== a.pointerId)
|
|
614
614
|
return;
|
|
615
|
-
document.removeEventListener("pointermove",
|
|
616
|
-
const
|
|
617
|
-
if (
|
|
618
|
-
const
|
|
619
|
-
a.clientX >=
|
|
615
|
+
document.removeEventListener("pointermove", Yt), document.removeEventListener("pointerup", Kt), document.removeEventListener("pointercancel", Kt);
|
|
616
|
+
const P = h.captureTarget;
|
|
617
|
+
if (P?.hasPointerCapture?.(a.pointerId) && P.releasePointerCapture(a.pointerId), B.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1, captureTarget: null }, rt(!1), z.current) {
|
|
618
|
+
const F = z.current.getBoundingClientRect();
|
|
619
|
+
a.clientX >= F.left && a.clientX <= F.right && a.clientY >= F.top && a.clientY <= F.bottom || st(!1);
|
|
620
620
|
} else
|
|
621
|
-
|
|
621
|
+
st(!1);
|
|
622
622
|
},
|
|
623
|
-
[
|
|
623
|
+
[Yt]
|
|
624
624
|
);
|
|
625
625
|
X(() => () => {
|
|
626
|
-
document.removeEventListener("pointermove",
|
|
627
|
-
}, [
|
|
628
|
-
const
|
|
626
|
+
document.removeEventListener("pointermove", Yt), document.removeEventListener("pointerup", Kt), document.removeEventListener("pointercancel", Kt);
|
|
627
|
+
}, [Yt, Kt]);
|
|
628
|
+
const Ie = g(0), Bt = g(0), Pe = S(
|
|
629
629
|
(a) => {
|
|
630
|
-
const
|
|
631
|
-
|
|
630
|
+
const h = Math.max(Math.round(O.current.viewportSize / ar), sr);
|
|
631
|
+
Bt.current !== a && (Bt.current = a, Ie.current = 0), Ht(Ie, a * h);
|
|
632
632
|
},
|
|
633
|
-
[
|
|
634
|
-
), { handleArrowPointerDown:
|
|
635
|
-
canUseArrowButtons:
|
|
633
|
+
[Ht]
|
|
634
|
+
), { handleArrowPointerDown: ye, handleArrowPointerUp: ve, handleArrowKeyDown: Jt } = hr({
|
|
635
|
+
canUseArrowButtons: ht,
|
|
636
636
|
enableArrowButtons: l,
|
|
637
|
-
resetTapScroll:
|
|
638
|
-
scrollByStep:
|
|
639
|
-
}),
|
|
640
|
-
if (!
|
|
637
|
+
resetTapScroll: kt,
|
|
638
|
+
scrollByStep: Pe
|
|
639
|
+
}), re = (a) => {
|
|
640
|
+
if (!vt)
|
|
641
641
|
return;
|
|
642
642
|
if (!n) {
|
|
643
643
|
a.preventDefault(), a.stopPropagation();
|
|
@@ -645,25 +645,25 @@ const mt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
645
645
|
}
|
|
646
646
|
if (a.pointerType === "mouse" && a.button !== 0 || a.ctrlKey)
|
|
647
647
|
return;
|
|
648
|
-
|
|
649
|
-
const
|
|
650
|
-
let
|
|
651
|
-
if (
|
|
648
|
+
kt();
|
|
649
|
+
const h = a.currentTarget, P = it(h);
|
|
650
|
+
let F = null;
|
|
651
|
+
if (h.setPointerCapture)
|
|
652
652
|
try {
|
|
653
|
-
|
|
653
|
+
h.setPointerCapture(a.pointerId), F = h;
|
|
654
654
|
} catch {
|
|
655
|
-
|
|
655
|
+
F = null;
|
|
656
656
|
}
|
|
657
|
-
|
|
657
|
+
B.current = {
|
|
658
658
|
pointerId: a.pointerId,
|
|
659
|
-
startThumbPosition:
|
|
659
|
+
startThumbPosition: V,
|
|
660
660
|
startClientX: a.clientX,
|
|
661
661
|
startClientY: a.clientY,
|
|
662
|
-
scale:
|
|
663
|
-
captureTarget:
|
|
664
|
-
}, document.addEventListener("pointermove",
|
|
662
|
+
scale: P,
|
|
663
|
+
captureTarget: F
|
|
664
|
+
}, document.addEventListener("pointermove", Yt), document.addEventListener("pointerup", Kt), document.addEventListener("pointercancel", Kt), rt(!0), st(!0), a.preventDefault(), a.stopPropagation();
|
|
665
665
|
}, Qt = (a) => {
|
|
666
|
-
if (!
|
|
666
|
+
if (!vt)
|
|
667
667
|
return;
|
|
668
668
|
if (!s) {
|
|
669
669
|
a.preventDefault(), a.stopPropagation();
|
|
@@ -671,119 +671,119 @@ const mt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
671
671
|
}
|
|
672
672
|
if (a.pointerType === "mouse" && a.button !== 0 || a.ctrlKey)
|
|
673
673
|
return;
|
|
674
|
-
const
|
|
675
|
-
|
|
676
|
-
const
|
|
677
|
-
if (
|
|
674
|
+
const h = a.currentTarget, P = h.getBoundingClientRect(), F = Mt(a), o = it(h), c = (F - (u ? P.left : P.top)) / o;
|
|
675
|
+
kt();
|
|
676
|
+
const d = c - ut / 2, y = de(d);
|
|
677
|
+
if (Et(y), h.setPointerCapture)
|
|
678
678
|
try {
|
|
679
|
-
|
|
679
|
+
h.setPointerCapture(a.pointerId);
|
|
680
680
|
} catch {
|
|
681
681
|
}
|
|
682
|
-
|
|
682
|
+
w.current = {
|
|
683
683
|
pointerId: a.pointerId,
|
|
684
|
-
startThumbPosition:
|
|
684
|
+
startThumbPosition: d,
|
|
685
685
|
startClientX: a.clientX,
|
|
686
686
|
startClientY: a.clientY,
|
|
687
|
-
scale:
|
|
687
|
+
scale: o
|
|
688
688
|
}, a.preventDefault(), a.stopPropagation();
|
|
689
|
-
},
|
|
690
|
-
|
|
691
|
-
},
|
|
692
|
-
const
|
|
693
|
-
if (
|
|
689
|
+
}, qt = () => {
|
|
690
|
+
w.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 };
|
|
691
|
+
}, ne = (a) => {
|
|
692
|
+
const h = w.current;
|
|
693
|
+
if (h.pointerId !== a.pointerId)
|
|
694
694
|
return;
|
|
695
695
|
if (a.pointerType === "mouse" && a.buttons === 0) {
|
|
696
|
-
|
|
696
|
+
qt();
|
|
697
697
|
return;
|
|
698
698
|
}
|
|
699
|
-
const
|
|
700
|
-
|
|
701
|
-
},
|
|
702
|
-
if (
|
|
699
|
+
const P = a.clientX - h.startClientX, F = a.clientY - h.startClientY, o = ct(P, F) / (h.scale || 1), c = de(h.startThumbPosition + o);
|
|
700
|
+
Et(c), a.cancelable && a.preventDefault();
|
|
701
|
+
}, fe = (a) => {
|
|
702
|
+
if (w.current.pointerId !== a.pointerId)
|
|
703
703
|
return;
|
|
704
|
-
const
|
|
705
|
-
|
|
706
|
-
},
|
|
707
|
-
if (
|
|
704
|
+
const h = a.currentTarget;
|
|
705
|
+
h.hasPointerCapture?.(a.pointerId) && h.releasePointerCapture(a.pointerId), qt(), a.preventDefault(), a.stopPropagation();
|
|
706
|
+
}, te = (a) => {
|
|
707
|
+
if (w.current.pointerId !== a.pointerId)
|
|
708
708
|
return;
|
|
709
|
-
const
|
|
710
|
-
|
|
711
|
-
},
|
|
712
|
-
|
|
713
|
-
},
|
|
714
|
-
const
|
|
709
|
+
const h = a.currentTarget;
|
|
710
|
+
h.hasPointerCapture?.(a.pointerId) && h.releasePointerCapture(a.pointerId), qt();
|
|
711
|
+
}, we = (a) => {
|
|
712
|
+
w.current.pointerId === a.pointerId && qt();
|
|
713
|
+
}, Re = Nt(() => gt((wt ? 1 : 0.8) * _t, 0, 1), [wt, _t]), Ve = Nt(() => {
|
|
714
|
+
const h = `calc(50% - ${bt / 2}px + ${R}px)`;
|
|
715
715
|
return {
|
|
716
|
-
left:
|
|
717
|
-
top:
|
|
716
|
+
left: St,
|
|
717
|
+
top: h
|
|
718
718
|
};
|
|
719
|
-
}, [
|
|
719
|
+
}, [St, R, bt]), me = (a, h, P, F) => /* @__PURE__ */ Q(
|
|
720
720
|
"button",
|
|
721
721
|
{
|
|
722
722
|
type: "button",
|
|
723
723
|
tabIndex: 0,
|
|
724
724
|
className: "aqvs-scrollbar-arrow-button",
|
|
725
725
|
style: {
|
|
726
|
-
[
|
|
727
|
-
[
|
|
726
|
+
[A]: f,
|
|
727
|
+
[mt]: f
|
|
728
728
|
},
|
|
729
|
-
"aria-label":
|
|
730
|
-
onPointerDown:
|
|
731
|
-
onPointerUp:
|
|
732
|
-
onPointerLeave:
|
|
733
|
-
onPointerCancel:
|
|
734
|
-
onKeyDown:
|
|
729
|
+
"aria-label": h,
|
|
730
|
+
onPointerDown: ye(a),
|
|
731
|
+
onPointerUp: ve,
|
|
732
|
+
onPointerLeave: ve,
|
|
733
|
+
onPointerCancel: ve,
|
|
734
|
+
onKeyDown: Jt(a),
|
|
735
735
|
"aria-disabled": !l,
|
|
736
|
-
disabled: !
|
|
737
|
-
children: /* @__PURE__ */
|
|
736
|
+
disabled: !ht,
|
|
737
|
+
children: /* @__PURE__ */ Q("span", { "aria-hidden": "true", children: P })
|
|
738
738
|
},
|
|
739
|
-
|
|
740
|
-
),
|
|
741
|
-
orientation:
|
|
739
|
+
F
|
|
740
|
+
), pe = p && vt ? {
|
|
741
|
+
orientation: Zt,
|
|
742
742
|
scrollPosition: e,
|
|
743
|
-
maxScrollPosition:
|
|
743
|
+
maxScrollPosition: xt,
|
|
744
744
|
contentSize: i,
|
|
745
745
|
viewportSize: t,
|
|
746
|
-
thumbSize:
|
|
747
|
-
thumbPosition:
|
|
748
|
-
thumbCenter:
|
|
749
|
-
trackSize:
|
|
750
|
-
isDragging:
|
|
751
|
-
isTapScrollActive:
|
|
752
|
-
visibleStartIndex:
|
|
753
|
-
visibleEndIndex:
|
|
746
|
+
thumbSize: ut,
|
|
747
|
+
thumbPosition: V,
|
|
748
|
+
thumbCenter: It,
|
|
749
|
+
trackSize: Ct,
|
|
750
|
+
isDragging: G,
|
|
751
|
+
isTapScrollActive: wt,
|
|
752
|
+
visibleStartIndex: D,
|
|
753
|
+
visibleEndIndex: J
|
|
754
754
|
} : null;
|
|
755
|
-
return /* @__PURE__ */
|
|
755
|
+
return /* @__PURE__ */ ue(
|
|
756
756
|
"div",
|
|
757
757
|
{
|
|
758
|
-
className:
|
|
758
|
+
className: ce("aqvs-scrollbar", pt, !vt && "pointer-events-none opacity-0", x),
|
|
759
759
|
style: {
|
|
760
|
-
[
|
|
761
|
-
[
|
|
760
|
+
[A]: t,
|
|
761
|
+
[mt]: f
|
|
762
762
|
},
|
|
763
763
|
role: "scrollbar",
|
|
764
764
|
tabIndex: -1,
|
|
765
|
-
"aria-controls":
|
|
765
|
+
"aria-controls": I,
|
|
766
766
|
"aria-valuenow": e,
|
|
767
767
|
"aria-valuemin": 0,
|
|
768
|
-
"aria-valuemax":
|
|
768
|
+
"aria-valuemax": xt,
|
|
769
769
|
"aria-orientation": u ? "horizontal" : "vertical",
|
|
770
770
|
children: [
|
|
771
|
-
!u &&
|
|
771
|
+
!u && vt && W && /* @__PURE__ */ Q(
|
|
772
772
|
We,
|
|
773
773
|
{
|
|
774
|
-
ref:
|
|
775
|
-
className:
|
|
776
|
-
size:
|
|
777
|
-
maxVisualDistance:
|
|
778
|
-
style:
|
|
779
|
-
opacity:
|
|
780
|
-
renderVisual:
|
|
781
|
-
onDragChange:
|
|
774
|
+
ref: tt,
|
|
775
|
+
className: ce("aqvs-scrollbar-tap-circle-wrapper", Ft),
|
|
776
|
+
size: bt,
|
|
777
|
+
maxVisualDistance: Ot,
|
|
778
|
+
style: Ve,
|
|
779
|
+
opacity: Re,
|
|
780
|
+
renderVisual: Gt,
|
|
781
|
+
onDragChange: Me
|
|
782
782
|
},
|
|
783
783
|
"tap-circle"
|
|
784
784
|
),
|
|
785
|
-
|
|
786
|
-
/* @__PURE__ */
|
|
785
|
+
me(-1, j[0], At[0], "arrow-start"),
|
|
786
|
+
/* @__PURE__ */ ue(
|
|
787
787
|
"div",
|
|
788
788
|
{
|
|
789
789
|
className: "aqvs-scrollbar-track",
|
|
@@ -791,45 +791,45 @@ const mt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
791
791
|
borderRadius: f / 2
|
|
792
792
|
},
|
|
793
793
|
onPointerDown: Qt,
|
|
794
|
-
onPointerMove:
|
|
795
|
-
onPointerUp:
|
|
796
|
-
onPointerCancel:
|
|
797
|
-
onLostPointerCapture:
|
|
794
|
+
onPointerMove: ne,
|
|
795
|
+
onPointerUp: fe,
|
|
796
|
+
onPointerCancel: te,
|
|
797
|
+
onLostPointerCapture: we,
|
|
798
798
|
"aria-disabled": !s,
|
|
799
799
|
children: [
|
|
800
|
-
|
|
801
|
-
/* @__PURE__ */
|
|
800
|
+
pe && /* @__PURE__ */ Q("div", { className: "aqvs-scrollbar-overlay", "aria-hidden": !0, children: p?.(pe) }, "overlay"),
|
|
801
|
+
/* @__PURE__ */ Q(
|
|
802
802
|
"div",
|
|
803
803
|
{
|
|
804
|
-
className:
|
|
804
|
+
className: ce("aqvs-scrollbar-thumb-wrapper", !(vt || G) && "pointer-events-none opacity-0"),
|
|
805
805
|
style: {
|
|
806
|
-
[
|
|
807
|
-
[
|
|
806
|
+
[A]: ut,
|
|
807
|
+
[lt]: V,
|
|
808
808
|
...u ? { top: 0, bottom: 0 } : { left: 0, right: 0 }
|
|
809
809
|
},
|
|
810
|
-
onPointerDown:
|
|
810
|
+
onPointerDown: re,
|
|
811
811
|
role: "slider",
|
|
812
812
|
"aria-orientation": u ? "horizontal" : "vertical",
|
|
813
813
|
"aria-valuenow": e,
|
|
814
814
|
"aria-valuemin": 0,
|
|
815
|
-
"aria-valuemax":
|
|
815
|
+
"aria-valuemax": xt,
|
|
816
816
|
"aria-disabled": !n,
|
|
817
817
|
tabIndex: -1,
|
|
818
|
-
children: /* @__PURE__ */
|
|
818
|
+
children: /* @__PURE__ */ Q(
|
|
819
819
|
"div",
|
|
820
820
|
{
|
|
821
|
-
ref:
|
|
822
|
-
className:
|
|
823
|
-
"data-thumb-state":
|
|
821
|
+
ref: z,
|
|
822
|
+
className: ce("aqvs-scrollbar-thumb", u ? "aqvs-scrollbar-thumb-horizontal" : "aqvs-scrollbar-thumb-vertical"),
|
|
823
|
+
"data-thumb-state": se,
|
|
824
824
|
style: {
|
|
825
825
|
borderRadius: f - 1,
|
|
826
826
|
cursor: n ? "pointer" : "default"
|
|
827
827
|
},
|
|
828
828
|
onMouseEnter: () => {
|
|
829
|
-
n &&
|
|
829
|
+
n && st(!0);
|
|
830
830
|
},
|
|
831
831
|
onMouseLeave: () => {
|
|
832
|
-
n &&
|
|
832
|
+
n && st(!1);
|
|
833
833
|
}
|
|
834
834
|
},
|
|
835
835
|
"thumb"
|
|
@@ -841,7 +841,7 @@ const mt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
841
841
|
},
|
|
842
842
|
"track"
|
|
843
843
|
),
|
|
844
|
-
|
|
844
|
+
me(1, j[1], At[1], "arrow-end")
|
|
845
845
|
]
|
|
846
846
|
}
|
|
847
847
|
);
|
|
@@ -851,7 +851,7 @@ const mt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
851
851
|
deceleration: 25e-4,
|
|
852
852
|
velocitySampleWindow: 90,
|
|
853
853
|
startVelocityThreshold: 0.04
|
|
854
|
-
},
|
|
854
|
+
}, Ce = (i, t, e) => {
|
|
855
855
|
for (const [r, n, s] of t)
|
|
856
856
|
e === "add" ? i.addEventListener(r, n, s) : i.removeEventListener(r, n, s);
|
|
857
857
|
}, xr = Fe(
|
|
@@ -865,171 +865,172 @@ const mt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
865
865
|
enableArrowButtons: l = !0,
|
|
866
866
|
enablePointerDrag: u = !0,
|
|
867
867
|
onScroll: f,
|
|
868
|
-
className:
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
868
|
+
className: x,
|
|
869
|
+
testId: I,
|
|
870
|
+
style: M,
|
|
871
|
+
background: _,
|
|
872
|
+
tapScrollCircleOptions: p,
|
|
873
|
+
inertiaOptions: D,
|
|
874
|
+
itemCount: J,
|
|
875
|
+
renderThumbOverlay: G,
|
|
876
|
+
wheelSpeedMultiplier: rt = 1,
|
|
877
|
+
onWheelHorizontal: nt,
|
|
878
|
+
contentInsets: st,
|
|
879
|
+
visibleStartIndex: wt,
|
|
880
|
+
visibleEndIndex: Vt,
|
|
881
|
+
renderOverlay: z,
|
|
882
|
+
initialScrollPosition: B = 0
|
|
883
|
+
}, w) => {
|
|
884
|
+
const C = g(Number.isFinite(B) ? Math.max(0, B) : 0), U = g(null), H = g(null), tt = g(nt);
|
|
884
885
|
X(() => {
|
|
885
|
-
|
|
886
|
-
}, [
|
|
887
|
-
const
|
|
886
|
+
tt.current = nt;
|
|
887
|
+
}, [nt]);
|
|
888
|
+
const L = g({
|
|
888
889
|
frame: null,
|
|
889
890
|
velocity: 0,
|
|
890
891
|
lastTimestamp: null,
|
|
891
892
|
generation: 0
|
|
892
|
-
}),
|
|
893
|
+
}), b = Nt(
|
|
893
894
|
() => ({
|
|
894
|
-
maxVelocity:
|
|
895
|
-
minVelocity:
|
|
896
|
-
deceleration:
|
|
897
|
-
velocitySampleWindow:
|
|
898
|
-
startVelocityThreshold:
|
|
895
|
+
maxVelocity: D?.maxVelocity ?? Te.maxVelocity,
|
|
896
|
+
minVelocity: D?.minVelocity ?? Te.minVelocity,
|
|
897
|
+
deceleration: D?.deceleration ?? Te.deceleration,
|
|
898
|
+
velocitySampleWindow: D?.velocitySampleWindow ?? Te.velocitySampleWindow,
|
|
899
|
+
startVelocityThreshold: D?.startVelocityThreshold ?? Te.startVelocityThreshold
|
|
899
900
|
}),
|
|
900
|
-
[
|
|
901
|
-
),
|
|
902
|
-
top: Math.max(0,
|
|
903
|
-
bottom: Math.max(0,
|
|
904
|
-
}), [
|
|
905
|
-
|
|
901
|
+
[D]
|
|
902
|
+
), K = Nt(() => ({
|
|
903
|
+
top: Math.max(0, st?.top ?? 0),
|
|
904
|
+
bottom: Math.max(0, st?.bottom ?? 0)
|
|
905
|
+
}), [st]);
|
|
906
|
+
N.debug("[ScrollPane] ScrollPane rendered", () => ({
|
|
906
907
|
contentSize: t,
|
|
907
908
|
viewportSize: e,
|
|
908
909
|
scrollBarWidth: r,
|
|
909
|
-
className:
|
|
910
|
-
style:
|
|
911
|
-
tapScrollCircleOptions:
|
|
912
|
-
inertiaOptions:
|
|
910
|
+
className: x,
|
|
911
|
+
style: M,
|
|
912
|
+
tapScrollCircleOptions: p,
|
|
913
|
+
inertiaOptions: D,
|
|
913
914
|
enablePointerDrag: u,
|
|
914
|
-
contentInsets:
|
|
915
|
+
contentInsets: K
|
|
915
916
|
}));
|
|
916
|
-
const
|
|
917
|
-
|
|
918
|
-
const
|
|
919
|
-
(
|
|
920
|
-
const { contentSize:
|
|
921
|
-
if (
|
|
922
|
-
return
|
|
923
|
-
const
|
|
924
|
-
if (!Number.isFinite(
|
|
925
|
-
return
|
|
926
|
-
const
|
|
927
|
-
return
|
|
917
|
+
const ft = g({ contentSize: t, viewportSize: e });
|
|
918
|
+
ft.current = { contentSize: t, viewportSize: e };
|
|
919
|
+
const et = Nt(() => t > e, [t, e]), Y = S(
|
|
920
|
+
(T) => {
|
|
921
|
+
const { contentSize: O, viewportSize: A } = ft.current, mt = O > A, lt = C.current;
|
|
922
|
+
if (N.debug("[ScrollPane] scrollTo called", () => ({ newPosition: T, contentSize: O, viewportSize: A, currentIsScrollable: mt, prevPosition: lt })), !mt)
|
|
923
|
+
return C.current !== 0 && (C.current = 0, f?.(0, lt)), C.current;
|
|
924
|
+
const ct = typeof T == "function" ? T(C.current) : T;
|
|
925
|
+
if (!Number.isFinite(ct))
|
|
926
|
+
return N.warn("[ScrollPane] scrollTo received a non-finite position; keeping the current position", { nextPosition: ct }), C.current;
|
|
927
|
+
const Mt = Math.max(O - A, 0), j = gt(ct, 0, Mt);
|
|
928
|
+
return C.current !== j && (C.current = j, f?.(j, lt)), C.current;
|
|
928
929
|
},
|
|
929
930
|
[f]
|
|
930
|
-
),
|
|
931
|
-
const
|
|
932
|
-
|
|
933
|
-
}, []),
|
|
931
|
+
), W = S(() => {
|
|
932
|
+
const T = L.current;
|
|
933
|
+
T.generation += 1, T.frame !== null && cancelAnimationFrame(T.frame), T.frame = null, T.velocity = 0, T.lastTimestamp = null;
|
|
934
|
+
}, []), bt = g(W);
|
|
934
935
|
X(() => {
|
|
935
|
-
|
|
936
|
-
}, [
|
|
937
|
-
|
|
936
|
+
bt.current = W;
|
|
937
|
+
}, [W]), X(() => () => {
|
|
938
|
+
bt.current();
|
|
938
939
|
}, []);
|
|
939
|
-
const
|
|
940
|
-
(
|
|
941
|
-
if (!
|
|
940
|
+
const St = S(
|
|
941
|
+
(T) => {
|
|
942
|
+
if (!et)
|
|
942
943
|
return;
|
|
943
|
-
const { maxVelocity:
|
|
944
|
-
if (Math.abs(
|
|
944
|
+
const { maxVelocity: O, minVelocity: A, deceleration: mt, startVelocityThreshold: lt } = b, ct = gt(T, -O, O);
|
|
945
|
+
if (Math.abs(ct) < lt)
|
|
945
946
|
return;
|
|
946
|
-
|
|
947
|
-
const
|
|
948
|
-
const
|
|
949
|
-
if (
|
|
947
|
+
W(), L.current.velocity = ct, L.current.lastTimestamp = null;
|
|
948
|
+
const Mt = L.current.generation, j = (At) => {
|
|
949
|
+
const pt = L.current;
|
|
950
|
+
if (pt.generation !== Mt)
|
|
950
951
|
return;
|
|
951
|
-
if (
|
|
952
|
-
|
|
952
|
+
if (pt.lastTimestamp === null) {
|
|
953
|
+
pt.lastTimestamp = At, pt.frame = requestAnimationFrame(j);
|
|
953
954
|
return;
|
|
954
955
|
}
|
|
955
|
-
const
|
|
956
|
-
if (
|
|
957
|
-
|
|
956
|
+
const Zt = At - pt.lastTimestamp;
|
|
957
|
+
if (pt.lastTimestamp = At, Zt <= 0) {
|
|
958
|
+
pt.frame = requestAnimationFrame(j);
|
|
958
959
|
return;
|
|
959
960
|
}
|
|
960
|
-
const
|
|
961
|
-
let
|
|
962
|
-
const
|
|
963
|
-
|
|
964
|
-
const
|
|
965
|
-
if (
|
|
961
|
+
const Ot = pt.velocity;
|
|
962
|
+
let Rt = Ot;
|
|
963
|
+
const Ct = mt * Zt;
|
|
964
|
+
Ot > 0 ? Rt = Math.max(0, Ot - Ct) : Ot < 0 && (Rt = Math.min(0, Ot + Ct));
|
|
965
|
+
const ut = (Ot + Rt) / 2 * Zt, xt = C.current;
|
|
966
|
+
if (ut !== 0 && Y((se) => se + ut), L.current.generation !== Mt)
|
|
966
967
|
return;
|
|
967
|
-
const m =
|
|
968
|
-
|
|
969
|
-
const
|
|
970
|
-
if (Math.abs(
|
|
971
|
-
|
|
968
|
+
const m = C.current, { contentSize: V, viewportSize: It } = ft.current, vt = Math.max(V - It, 0);
|
|
969
|
+
pt.velocity = Rt;
|
|
970
|
+
const ht = m === xt || m <= 0 && Rt <= 0 || m >= vt && Rt >= 0;
|
|
971
|
+
if (Math.abs(Rt) < A || ht) {
|
|
972
|
+
W();
|
|
972
973
|
return;
|
|
973
974
|
}
|
|
974
|
-
|
|
975
|
+
pt.frame = requestAnimationFrame(j);
|
|
975
976
|
};
|
|
976
|
-
|
|
977
|
+
L.current.frame = requestAnimationFrame(j);
|
|
977
978
|
},
|
|
978
|
-
[
|
|
979
|
-
), R =
|
|
979
|
+
[et, b, Y, W]
|
|
980
|
+
), R = g(St);
|
|
980
981
|
X(() => {
|
|
981
|
-
R.current =
|
|
982
|
-
}, [
|
|
983
|
-
|
|
984
|
-
}, [t, e]),
|
|
985
|
-
const
|
|
986
|
-
if (!
|
|
987
|
-
const
|
|
988
|
-
|
|
982
|
+
R.current = St;
|
|
983
|
+
}, [St]), be(() => {
|
|
984
|
+
ft.current = { contentSize: t, viewportSize: e };
|
|
985
|
+
}, [t, e]), be(() => {
|
|
986
|
+
const T = H.current;
|
|
987
|
+
if (!T) return;
|
|
988
|
+
const O = () => {
|
|
989
|
+
T.scrollTop !== 0 && (N.debug("[ScrollPane] Native scroll detected, resetting to 0", () => ({ scrollTop: T.scrollTop })), T.scrollTop = 0), T.scrollLeft !== 0 && (T.scrollLeft = 0);
|
|
989
990
|
};
|
|
990
|
-
return
|
|
991
|
-
}, []),
|
|
992
|
-
if (
|
|
993
|
-
|
|
994
|
-
const
|
|
995
|
-
|
|
991
|
+
return T.addEventListener("scroll", O), () => T.removeEventListener("scroll", O);
|
|
992
|
+
}, []), be(() => {
|
|
993
|
+
if (et) {
|
|
994
|
+
N.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", () => ({ contentSize: t, viewportSize: e, scrollPosition: C.current }));
|
|
995
|
+
const T = gt(t - e, 0, t);
|
|
996
|
+
C.current > T && Y(T);
|
|
996
997
|
} else
|
|
997
|
-
|
|
998
|
-
}, [
|
|
999
|
-
const
|
|
1000
|
-
if (
|
|
1001
|
-
const
|
|
1002
|
-
if (
|
|
1003
|
-
|
|
1004
|
-
let
|
|
1005
|
-
|
|
998
|
+
Y(0);
|
|
999
|
+
}, [et, Y, t, e]), X(() => {
|
|
1000
|
+
const T = (A) => {
|
|
1001
|
+
if (tt.current && !A.ctrlKey) {
|
|
1002
|
+
const lt = A.shiftKey && A.deltaX === 0, ct = lt ? A.deltaY : A.deltaX, Mt = lt ? 0 : A.deltaY;
|
|
1003
|
+
if (ct !== 0 && Math.abs(ct) >= Math.abs(Mt)) {
|
|
1004
|
+
A.preventDefault(), W();
|
|
1005
|
+
let j = ct;
|
|
1006
|
+
A.deltaMode === 1 ? j *= 16 : A.deltaMode === 2 && (j *= e), tt.current(j);
|
|
1006
1007
|
return;
|
|
1007
1008
|
}
|
|
1008
1009
|
}
|
|
1009
|
-
if (!
|
|
1010
|
+
if (!et || A.ctrlKey || A.deltaY === 0)
|
|
1010
1011
|
return;
|
|
1011
|
-
|
|
1012
|
-
let
|
|
1013
|
-
|
|
1014
|
-
},
|
|
1015
|
-
return
|
|
1016
|
-
|
|
1012
|
+
A.preventDefault(), W();
|
|
1013
|
+
let mt = A.deltaY;
|
|
1014
|
+
A.deltaMode === 1 ? mt *= 16 : A.deltaMode === 2 && (mt *= e), rt !== 1 && (mt *= rt), N.debug("[ScrollPane] wheel event", () => ({ deltaY: mt, scrollPosition: C.current, wheelSpeedMultiplier: rt, deltaMode: A.deltaMode, scrollTop: H.current?.scrollTop })), Y((lt) => lt + mt);
|
|
1015
|
+
}, O = U.current;
|
|
1016
|
+
return O && O.addEventListener("wheel", T, { passive: !1 }), () => {
|
|
1017
|
+
O && O.removeEventListener("wheel", T);
|
|
1017
1018
|
};
|
|
1018
|
-
}, [
|
|
1019
|
-
|
|
1019
|
+
}, [et, Y, W, e, rt]), ke(
|
|
1020
|
+
w,
|
|
1020
1021
|
() => ({
|
|
1021
|
-
scrollTo: (
|
|
1022
|
-
getScrollPosition: () =>
|
|
1022
|
+
scrollTo: (T) => (W(), Y(T)),
|
|
1023
|
+
getScrollPosition: () => C.current,
|
|
1023
1024
|
getContentSize: () => t,
|
|
1024
1025
|
getViewportSize: () => e
|
|
1025
1026
|
}),
|
|
1026
|
-
[
|
|
1027
|
+
[Y, t, e, W]
|
|
1027
1028
|
);
|
|
1028
|
-
const
|
|
1029
|
+
const Ft = g(Y);
|
|
1029
1030
|
X(() => {
|
|
1030
|
-
|
|
1031
|
-
}, [
|
|
1032
|
-
const
|
|
1031
|
+
Ft.current = Y;
|
|
1032
|
+
}, [Y]);
|
|
1033
|
+
const Lt = er(), v = g({
|
|
1033
1034
|
pointerId: null,
|
|
1034
1035
|
startClientY: 0,
|
|
1035
1036
|
startScroll: 0,
|
|
@@ -1037,207 +1038,207 @@ const mt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
1037
1038
|
shouldCancelNextClick: !1,
|
|
1038
1039
|
clickResetTimer: null,
|
|
1039
1040
|
velocitySamples: []
|
|
1040
|
-
}),
|
|
1041
|
+
}), zt = g(u);
|
|
1041
1042
|
X(() => {
|
|
1042
|
-
|
|
1043
|
+
zt.current = u;
|
|
1043
1044
|
}, [u]);
|
|
1044
|
-
const
|
|
1045
|
+
const _t = g(et);
|
|
1045
1046
|
X(() => {
|
|
1046
|
-
|
|
1047
|
-
}, [
|
|
1048
|
-
const
|
|
1047
|
+
_t.current = et;
|
|
1048
|
+
}, [et]);
|
|
1049
|
+
const Gt = g(b);
|
|
1049
1050
|
return X(() => {
|
|
1050
|
-
|
|
1051
|
-
}, [
|
|
1051
|
+
Gt.current = b;
|
|
1052
|
+
}, [b]), X(() => {
|
|
1052
1053
|
if (u)
|
|
1053
1054
|
return;
|
|
1054
|
-
const
|
|
1055
|
-
|
|
1055
|
+
const T = H.current, O = v.current;
|
|
1056
|
+
O.pointerId !== null && T?.hasPointerCapture(O.pointerId) && T.releasePointerCapture(O.pointerId), O.clickResetTimer !== null && (window.clearTimeout(O.clickResetTimer), O.clickResetTimer = null), O.pointerId = null, O.startClientY = 0, O.startScroll = 0, O.isDragging = !1, O.shouldCancelNextClick = !1, O.velocitySamples = [];
|
|
1056
1057
|
}, [u]), X(() => {
|
|
1057
|
-
const
|
|
1058
|
-
if (!
|
|
1058
|
+
const T = H.current;
|
|
1059
|
+
if (!T)
|
|
1059
1060
|
return;
|
|
1060
|
-
const
|
|
1061
|
-
const m =
|
|
1061
|
+
const O = 6, A = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), mt = () => {
|
|
1062
|
+
const m = v.current;
|
|
1062
1063
|
m.pointerId = null, m.startClientY = 0, m.startScroll = 0, m.isDragging = !1, m.velocitySamples = [];
|
|
1063
|
-
},
|
|
1064
|
-
const m =
|
|
1064
|
+
}, lt = () => {
|
|
1065
|
+
const m = v.current;
|
|
1065
1066
|
m.clickResetTimer !== null && (window.clearTimeout(m.clickResetTimer), m.clickResetTimer = null);
|
|
1066
|
-
},
|
|
1067
|
-
const
|
|
1068
|
-
|
|
1069
|
-
const
|
|
1070
|
-
|
|
1071
|
-
},
|
|
1072
|
-
const
|
|
1073
|
-
|
|
1074
|
-
},
|
|
1075
|
-
const
|
|
1076
|
-
if (!
|
|
1077
|
-
if (
|
|
1067
|
+
}, ct = (m) => {
|
|
1068
|
+
const V = v.current, It = A();
|
|
1069
|
+
V.velocitySamples.push({ clientY: m, time: It });
|
|
1070
|
+
const vt = Gt.current.velocitySampleWindow;
|
|
1071
|
+
V.velocitySamples = V.velocitySamples.filter((ht) => It - ht.time <= vt);
|
|
1072
|
+
}, Mt = (m) => m instanceof HTMLElement && m.closest("[data-scrollpane-ignore-drag='true']") !== null, j = (m) => {
|
|
1073
|
+
const V = v.current;
|
|
1074
|
+
V.shouldCancelNextClick && (m.preventDefault(), m.stopPropagation(), V.shouldCancelNextClick = !1);
|
|
1075
|
+
}, At = (m) => {
|
|
1076
|
+
const V = v.current;
|
|
1077
|
+
if (!V.isDragging) {
|
|
1078
|
+
if (V.isDragging = !0, V.shouldCancelNextClick = !0, !T.hasPointerCapture(m.pointerId))
|
|
1078
1079
|
try {
|
|
1079
|
-
|
|
1080
|
+
T.setPointerCapture(m.pointerId);
|
|
1080
1081
|
} catch {
|
|
1081
1082
|
}
|
|
1082
|
-
|
|
1083
|
+
ct(m.clientY);
|
|
1083
1084
|
}
|
|
1084
|
-
},
|
|
1085
|
-
const
|
|
1086
|
-
|
|
1087
|
-
},
|
|
1088
|
-
const
|
|
1089
|
-
if (
|
|
1085
|
+
}, pt = (m) => {
|
|
1086
|
+
const V = v.current;
|
|
1087
|
+
T.hasPointerCapture(m) && T.releasePointerCapture(m), V.shouldCancelNextClick = !1, lt(), mt();
|
|
1088
|
+
}, Zt = (m) => {
|
|
1089
|
+
const V = v.current;
|
|
1090
|
+
if (V.pointerId !== m.pointerId)
|
|
1090
1091
|
return;
|
|
1091
1092
|
if (m.buttons === 0) {
|
|
1092
|
-
|
|
1093
|
+
pt(m.pointerId);
|
|
1093
1094
|
return;
|
|
1094
1095
|
}
|
|
1095
|
-
if (!(
|
|
1096
|
+
if (!(zt.current && _t.current) || !V.isDragging && (Math.abs(m.clientY - V.startClientY) < O || (At(m), !V.isDragging)))
|
|
1096
1097
|
return;
|
|
1097
|
-
|
|
1098
|
-
const
|
|
1099
|
-
|
|
1100
|
-
},
|
|
1101
|
-
const
|
|
1102
|
-
if (
|
|
1098
|
+
ct(m.clientY);
|
|
1099
|
+
const It = m.clientY - V.startClientY, vt = V.startScroll - It;
|
|
1100
|
+
Ft.current(vt), m.cancelable && m.preventDefault();
|
|
1101
|
+
}, Ot = (m) => {
|
|
1102
|
+
const V = v.current;
|
|
1103
|
+
if (V.pointerId !== m.pointerId)
|
|
1103
1104
|
return;
|
|
1104
|
-
|
|
1105
|
-
let
|
|
1106
|
-
if (
|
|
1107
|
-
const
|
|
1108
|
-
if (
|
|
1109
|
-
const
|
|
1110
|
-
|
|
1105
|
+
V.isDragging && V.shouldCancelNextClick && m.cancelable && (m.preventDefault(), m.stopPropagation()), V.isDragging && ct(m.clientY);
|
|
1106
|
+
let It = 0;
|
|
1107
|
+
if (V.isDragging && V.velocitySamples.length >= 2) {
|
|
1108
|
+
const ht = V.velocitySamples, se = Gt.current.velocitySampleWindow, Et = ht[ht.length - 1], $t = ht.find((Ht) => Et.time - Ht.time <= se) ?? ht[0];
|
|
1109
|
+
if (Et && $t && Et.time !== $t.time) {
|
|
1110
|
+
const Ht = Et.clientY - $t.clientY, Dt = Et.time - $t.time;
|
|
1111
|
+
It = -(Ht / Dt);
|
|
1111
1112
|
}
|
|
1112
1113
|
}
|
|
1113
|
-
|
|
1114
|
-
const
|
|
1115
|
-
|
|
1114
|
+
lt(), V.shouldCancelNextClick && (V.clickResetTimer = window.setTimeout(() => {
|
|
1115
|
+
const ht = v.current;
|
|
1116
|
+
ht.shouldCancelNextClick = !1, ht.clickResetTimer = null;
|
|
1116
1117
|
}, 0));
|
|
1117
|
-
const
|
|
1118
|
-
|
|
1119
|
-
},
|
|
1120
|
-
if (
|
|
1118
|
+
const vt = Gt.current.startVelocityThreshold;
|
|
1119
|
+
mt(), T.hasPointerCapture(m.pointerId) && T.releasePointerCapture(m.pointerId), Math.abs(It) >= vt && R.current?.(It);
|
|
1120
|
+
}, Rt = (m) => {
|
|
1121
|
+
if (v.current.pointerId !== null || !(zt.current && _t.current) || m.button !== 0 && m.pointerType === "mouse" || m.ctrlKey || m.metaKey || m.altKey || Mt(m.target))
|
|
1121
1122
|
return;
|
|
1122
|
-
window.dispatchEvent(new CustomEvent(Oe, { detail: { paneId:
|
|
1123
|
-
const
|
|
1124
|
-
|
|
1125
|
-
},
|
|
1126
|
-
|
|
1127
|
-
},
|
|
1128
|
-
["click",
|
|
1129
|
-
["pointerdown",
|
|
1123
|
+
window.dispatchEvent(new CustomEvent(Oe, { detail: { paneId: Lt } })), bt.current?.();
|
|
1124
|
+
const V = v.current;
|
|
1125
|
+
lt(), V.pointerId = m.pointerId, V.startClientY = m.clientY, V.startScroll = C.current, V.isDragging = !1, V.shouldCancelNextClick = !1, V.velocitySamples = [];
|
|
1126
|
+
}, Ct = (m) => {
|
|
1127
|
+
v.current.pointerId === m.pointerId && pt(m.pointerId);
|
|
1128
|
+
}, ut = [
|
|
1129
|
+
["click", j, !0],
|
|
1130
|
+
["pointerdown", Rt, { passive: !1 }],
|
|
1130
1131
|
["lostpointercapture", (m) => {
|
|
1131
|
-
|
|
1132
|
+
v.current.pointerId === m.pointerId && pt(m.pointerId);
|
|
1132
1133
|
}, void 0]
|
|
1133
|
-
],
|
|
1134
|
-
["pointermove",
|
|
1135
|
-
["pointerup",
|
|
1136
|
-
["pointercancel",
|
|
1134
|
+
], xt = [
|
|
1135
|
+
["pointermove", Zt, { passive: !1 }],
|
|
1136
|
+
["pointerup", Ot, void 0],
|
|
1137
|
+
["pointercancel", Ct, void 0]
|
|
1137
1138
|
];
|
|
1138
|
-
return
|
|
1139
|
-
|
|
1140
|
-
const m =
|
|
1141
|
-
m.pointerId !== null &&
|
|
1139
|
+
return Ce(T, ut, "add"), Ce(window, xt, "add"), () => {
|
|
1140
|
+
Ce(T, ut, "remove"), Ce(window, xt, "remove");
|
|
1141
|
+
const m = v.current;
|
|
1142
|
+
m.pointerId !== null && T.hasPointerCapture(m.pointerId) && T.releasePointerCapture(m.pointerId), lt(), mt();
|
|
1142
1143
|
};
|
|
1143
|
-
}, [
|
|
1144
|
-
/* @__PURE__ */
|
|
1144
|
+
}, [Lt]), /* @__PURE__ */ ue("div", { ref: U, "data-testid": I, className: ce("aqvs-scroll-pane", x), style: M, children: [
|
|
1145
|
+
/* @__PURE__ */ ue(
|
|
1145
1146
|
"div",
|
|
1146
1147
|
{
|
|
1147
|
-
ref:
|
|
1148
|
-
className:
|
|
1148
|
+
ref: H,
|
|
1149
|
+
className: ce("aqvs-scroll-pane-content"),
|
|
1149
1150
|
style: {
|
|
1150
1151
|
height: e,
|
|
1151
|
-
paddingTop:
|
|
1152
|
-
paddingBottom:
|
|
1152
|
+
paddingTop: K.top,
|
|
1153
|
+
paddingBottom: K.bottom,
|
|
1153
1154
|
// スクロール不能時 (contentSize <= viewportSize) は touch-action を通常に戻し、
|
|
1154
1155
|
// 短いリスト上のタッチがページ全体のパンを妨げるデッドゾーン化を防ぐ
|
|
1155
|
-
...u &&
|
|
1156
|
+
...u && et ? { touchAction: "none" } : {}
|
|
1156
1157
|
},
|
|
1157
|
-
id:
|
|
1158
|
+
id: Lt,
|
|
1158
1159
|
children: [
|
|
1159
|
-
|
|
1160
|
-
i(
|
|
1160
|
+
_,
|
|
1161
|
+
i(C.current)
|
|
1161
1162
|
]
|
|
1162
1163
|
}
|
|
1163
1164
|
),
|
|
1164
|
-
/* @__PURE__ */
|
|
1165
|
+
/* @__PURE__ */ Q(
|
|
1165
1166
|
br,
|
|
1166
1167
|
{
|
|
1167
1168
|
contentSize: t,
|
|
1168
1169
|
viewportSize: e,
|
|
1169
|
-
scrollPosition:
|
|
1170
|
-
onScroll:
|
|
1170
|
+
scrollPosition: C.current,
|
|
1171
|
+
onScroll: Y,
|
|
1171
1172
|
enableThumbDrag: n,
|
|
1172
1173
|
enableTrackClick: s,
|
|
1173
1174
|
enableArrowButtons: l,
|
|
1174
1175
|
scrollBarWidth: r,
|
|
1175
|
-
ariaControls:
|
|
1176
|
-
tapScrollCircleOptions:
|
|
1177
|
-
itemCount:
|
|
1178
|
-
renderThumbOverlay:
|
|
1179
|
-
visibleStartIndex:
|
|
1180
|
-
visibleEndIndex:
|
|
1176
|
+
ariaControls: Lt,
|
|
1177
|
+
tapScrollCircleOptions: p,
|
|
1178
|
+
itemCount: J,
|
|
1179
|
+
renderThumbOverlay: G,
|
|
1180
|
+
visibleStartIndex: wt,
|
|
1181
|
+
visibleEndIndex: Vt
|
|
1181
1182
|
},
|
|
1182
1183
|
"scrollbar"
|
|
1183
1184
|
),
|
|
1184
|
-
|
|
1185
|
+
z?.()
|
|
1185
1186
|
] });
|
|
1186
1187
|
}
|
|
1187
1188
|
), He = (i, t, e) => Math.min(Math.max(i, t), e), Dr = ({ dragState: i, normalizedDistance: t, sizeScale: e, size: r }) => {
|
|
1188
|
-
const n = Math.max(r / 2, 1), s = 1 + t * 0.65, l = Math.max(0.65, 1 - t * 0.25), u = i.direction * t * 26 * e, f = 0.8 + t * 0.18,
|
|
1189
|
-
return /* @__PURE__ */
|
|
1190
|
-
/* @__PURE__ */
|
|
1189
|
+
const n = Math.max(r / 2, 1), s = 1 + t * 0.65, l = Math.max(0.65, 1 - t * 0.25), u = i.direction * t * 26 * e, f = 0.8 + t * 0.18, x = 3 * e, I = 6 * e, M = 22 * e, _ = Math.abs(u) + I, p = u > 0 ? x : -Math.abs(u) - x, D = Math.max(2.5, 3 * e), J = He(i.offsetX, -n, n), G = He(i.offsetY, -n, n), rt = n * 0.35, nt = J / n * rt, st = G / n * rt, wt = nt * 0.45, Vt = st * 0.45, z = Math.max(M * 0.38, 6), B = 0.65 + t * 0.2, w = i.active;
|
|
1190
|
+
return /* @__PURE__ */ ue(Ke, { children: [
|
|
1191
|
+
/* @__PURE__ */ Q(
|
|
1191
1192
|
"div",
|
|
1192
1193
|
{
|
|
1193
1194
|
className: "aqvs-tap-scroll-circle-gradient",
|
|
1194
1195
|
style: {
|
|
1195
1196
|
transform: `scale(${l}, ${s})`,
|
|
1196
|
-
transition:
|
|
1197
|
+
transition: w ? "40ms transform ease-out" : "200ms ease transform"
|
|
1197
1198
|
}
|
|
1198
1199
|
}
|
|
1199
1200
|
),
|
|
1200
|
-
/* @__PURE__ */
|
|
1201
|
+
/* @__PURE__ */ Q(
|
|
1201
1202
|
"div",
|
|
1202
1203
|
{
|
|
1203
1204
|
className: "aqvs-sample-visual-rod",
|
|
1204
1205
|
style: {
|
|
1205
|
-
width:
|
|
1206
|
-
height:
|
|
1207
|
-
transform: `translate(calc(-50% + ${nt}px), calc(-50% + ${
|
|
1208
|
-
transition:
|
|
1206
|
+
width: M,
|
|
1207
|
+
height: M,
|
|
1208
|
+
transform: `translate(calc(-50% + ${nt}px), calc(-50% + ${st}px)) scale(${l}, ${f * s})`,
|
|
1209
|
+
transition: w ? "70ms transform ease-out" : "200ms ease transform"
|
|
1209
1210
|
}
|
|
1210
1211
|
}
|
|
1211
1212
|
),
|
|
1212
|
-
/* @__PURE__ */
|
|
1213
|
+
/* @__PURE__ */ Q(
|
|
1213
1214
|
"div",
|
|
1214
1215
|
{
|
|
1215
1216
|
className: "aqvs-sample-visual-pupil",
|
|
1216
1217
|
style: {
|
|
1217
|
-
width:
|
|
1218
|
-
height:
|
|
1219
|
-
transform: `translate(calc(-50% + ${
|
|
1220
|
-
opacity:
|
|
1218
|
+
width: z,
|
|
1219
|
+
height: z,
|
|
1220
|
+
transform: `translate(calc(-50% + ${wt}px), calc(-50% + ${Vt}px)) scale(${l}, ${s})`,
|
|
1221
|
+
opacity: B,
|
|
1221
1222
|
boxShadow: "0 0 8px rgba(255,255,255,0.45)",
|
|
1222
|
-
transition:
|
|
1223
|
+
transition: w ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
|
|
1223
1224
|
}
|
|
1224
1225
|
}
|
|
1225
1226
|
),
|
|
1226
|
-
/* @__PURE__ */
|
|
1227
|
+
/* @__PURE__ */ Q(
|
|
1227
1228
|
"div",
|
|
1228
1229
|
{
|
|
1229
1230
|
className: "aqvs-sample-visual-highlight",
|
|
1230
1231
|
style: {
|
|
1231
|
-
width:
|
|
1232
|
-
height:
|
|
1232
|
+
width: D,
|
|
1233
|
+
height: _,
|
|
1233
1234
|
transform: `translate(-50%, ${p}px)`,
|
|
1234
1235
|
opacity: t,
|
|
1235
|
-
transition:
|
|
1236
|
+
transition: w ? "40ms height, 60ms opacity ease-out ease-out" : "200ms ease height, 120ms ease opacity"
|
|
1236
1237
|
}
|
|
1237
1238
|
}
|
|
1238
1239
|
)
|
|
1239
1240
|
] });
|
|
1240
|
-
},
|
|
1241
|
+
}, Ee = 100, Ir = (i) => {
|
|
1241
1242
|
if (!Number.isFinite(i))
|
|
1242
1243
|
return 0n;
|
|
1243
1244
|
const t = Math.trunc(i);
|
|
@@ -1246,7 +1247,7 @@ const mt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
1246
1247
|
if (!Number.isFinite(i))
|
|
1247
1248
|
throw new Error(`valueFn returned a non-finite value at index ${t}: ${i}`);
|
|
1248
1249
|
return i;
|
|
1249
|
-
},
|
|
1250
|
+
}, he = (i) => {
|
|
1250
1251
|
if (i <= 0 || !Number.isFinite(i))
|
|
1251
1252
|
return 0;
|
|
1252
1253
|
const t = Math.trunc(i);
|
|
@@ -1323,14 +1324,14 @@ class oe {
|
|
|
1323
1324
|
if (n > 0) {
|
|
1324
1325
|
const u = r?.sampleRange ?? {
|
|
1325
1326
|
from: 0,
|
|
1326
|
-
to: Math.min(
|
|
1327
|
+
to: Math.min(Ee - 1, n - 1)
|
|
1327
1328
|
};
|
|
1328
|
-
let f = Math.max(0, Math.trunc(u.from)),
|
|
1329
|
-
if (f >
|
|
1330
|
-
s = oe._sampleBaseValueStrided(e, n,
|
|
1329
|
+
let f = Math.max(0, Math.trunc(u.from)), x = Math.min(Math.trunc(u.to), n - 1);
|
|
1330
|
+
if (f > x && (f = 0, x = Math.min(Ee - 1, n - 1)), n > Ee)
|
|
1331
|
+
s = oe._sampleBaseValueStrided(e, n, Ee), r?.materialize && (l = { from: f, values: oe._collectValidatedValues(e, f, x) });
|
|
1331
1332
|
else {
|
|
1332
|
-
const
|
|
1333
|
-
s = oe._modeOrMedian([...
|
|
1333
|
+
const I = oe._collectValidatedValues(e, f, x);
|
|
1334
|
+
s = oe._modeOrMedian([...I]), r?.materialize && (l = { from: f, values: I });
|
|
1334
1335
|
}
|
|
1335
1336
|
}
|
|
1336
1337
|
if (this.size = n, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.total = void 0, this.valueFn = e, this.baseValue = s, l)
|
|
@@ -1338,8 +1339,8 @@ class oe {
|
|
|
1338
1339
|
const f = l.from + u;
|
|
1339
1340
|
if (f >= this.size)
|
|
1340
1341
|
break;
|
|
1341
|
-
const
|
|
1342
|
-
|
|
1342
|
+
const x = l.values[u] - this.baseValue;
|
|
1343
|
+
x !== 0 && (this.deltas.set(f, x), this._updateTree(f, x));
|
|
1343
1344
|
}
|
|
1344
1345
|
this.total = this.getTotal();
|
|
1345
1346
|
}
|
|
@@ -1396,9 +1397,9 @@ class oe {
|
|
|
1396
1397
|
}
|
|
1397
1398
|
if (s > t.length * 0.2) {
|
|
1398
1399
|
const l = [];
|
|
1399
|
-
for (const [f,
|
|
1400
|
-
|
|
1401
|
-
const u = l.reduce((f,
|
|
1400
|
+
for (const [f, x] of n.entries())
|
|
1401
|
+
x === s && l.push(f);
|
|
1402
|
+
const u = l.reduce((f, x) => f + x, 0);
|
|
1402
1403
|
r = Math.floor(u / l.length);
|
|
1403
1404
|
}
|
|
1404
1405
|
return r;
|
|
@@ -1493,7 +1494,7 @@ class oe {
|
|
|
1493
1494
|
let r = t + 1;
|
|
1494
1495
|
for (; r <= this.size; ) {
|
|
1495
1496
|
this.tree.set(r, (this.tree.get(r) ?? 0) + e);
|
|
1496
|
-
const n =
|
|
1497
|
+
const n = he(r);
|
|
1497
1498
|
if (n === 0)
|
|
1498
1499
|
break;
|
|
1499
1500
|
r += n;
|
|
@@ -1537,7 +1538,7 @@ class oe {
|
|
|
1537
1538
|
let t = 0, e = this.size;
|
|
1538
1539
|
for (; e > 0; ) {
|
|
1539
1540
|
t += this.tree.get(e) ?? 0;
|
|
1540
|
-
const r =
|
|
1541
|
+
const r = he(e);
|
|
1541
1542
|
if (r === 0)
|
|
1542
1543
|
break;
|
|
1543
1544
|
e -= r;
|
|
@@ -1576,9 +1577,9 @@ class oe {
|
|
|
1576
1577
|
const n = t.ranges;
|
|
1577
1578
|
if (n && n.length > 0) {
|
|
1578
1579
|
for (const u of n) {
|
|
1579
|
-
const f = Math.max(0, Math.trunc(u.from)),
|
|
1580
|
-
for (let
|
|
1581
|
-
this._materialize(
|
|
1580
|
+
const f = Math.max(0, Math.trunc(u.from)), x = Math.min(Math.trunc(u.to), this.size - 1);
|
|
1581
|
+
for (let I = f; I <= x; I++)
|
|
1582
|
+
this._materialize(I);
|
|
1582
1583
|
}
|
|
1583
1584
|
if (e === void 0)
|
|
1584
1585
|
return;
|
|
@@ -1664,11 +1665,11 @@ class oe {
|
|
|
1664
1665
|
this._materializeRanges(e.materializeOption);
|
|
1665
1666
|
const s = e.materializeOption?.materialize === !0;
|
|
1666
1667
|
for (; ; ) {
|
|
1667
|
-
let l = 0n, u = n - 1n, f,
|
|
1668
|
+
let l = 0n, u = n - 1n, f, x, I = this.total;
|
|
1668
1669
|
for (; l <= u; ) {
|
|
1669
|
-
const p = l + u >> 1n,
|
|
1670
|
-
if (
|
|
1671
|
-
if (f = p,
|
|
1670
|
+
const p = l + u >> 1n, D = Number(p), J = this.prefixSum(D);
|
|
1671
|
+
if (I = J.total, r ? J.cumulative >= t : J.cumulative <= t)
|
|
1672
|
+
if (f = p, x = J, r) {
|
|
1672
1673
|
if (p === 0n)
|
|
1673
1674
|
break;
|
|
1674
1675
|
u = p - 1n;
|
|
@@ -1682,18 +1683,18 @@ class oe {
|
|
|
1682
1683
|
u = p - 1n;
|
|
1683
1684
|
}
|
|
1684
1685
|
}
|
|
1685
|
-
const
|
|
1686
|
-
if (s &&
|
|
1687
|
-
const p = this.deltas.get(
|
|
1688
|
-
if (this._materialize(
|
|
1686
|
+
const M = x, _ = f !== void 0 ? Number(f) : -1;
|
|
1687
|
+
if (s && _ >= 0) {
|
|
1688
|
+
const p = this.deltas.get(_) ?? 0;
|
|
1689
|
+
if (this._materialize(_), (this.deltas.get(_) ?? 0) !== p)
|
|
1689
1690
|
continue;
|
|
1690
1691
|
}
|
|
1691
1692
|
return {
|
|
1692
|
-
index:
|
|
1693
|
-
total:
|
|
1694
|
-
cumulative:
|
|
1695
|
-
currentValue:
|
|
1696
|
-
safeIndex:
|
|
1693
|
+
index: _,
|
|
1694
|
+
total: I,
|
|
1695
|
+
cumulative: M?.cumulative,
|
|
1696
|
+
currentValue: M?.currentValue,
|
|
1697
|
+
safeIndex: M?.safeIndex
|
|
1697
1698
|
};
|
|
1698
1699
|
}
|
|
1699
1700
|
}
|
|
@@ -1710,16 +1711,16 @@ class oe {
|
|
|
1710
1711
|
return { cumulative: 0, total: this.total, currentValue: 0, safeIndex: 0 };
|
|
1711
1712
|
if (this.size === 0)
|
|
1712
1713
|
return { cumulative: 0, total: this.total ?? 0, currentValue: 0, safeIndex: 0 };
|
|
1713
|
-
const r =
|
|
1714
|
+
const r = gt(Math.trunc(t), 0, this.size - 1), n = e?.materializeOption;
|
|
1714
1715
|
this._materializeRanges(n, r, !0);
|
|
1715
1716
|
let s = 0, l = r + 1;
|
|
1716
1717
|
for (; l > 0; ) {
|
|
1717
1718
|
const f = this.tree.get(l) ?? 0;
|
|
1718
1719
|
s += f;
|
|
1719
|
-
const
|
|
1720
|
-
if (
|
|
1720
|
+
const x = he(l);
|
|
1721
|
+
if (x === 0)
|
|
1721
1722
|
break;
|
|
1722
|
-
l -=
|
|
1723
|
+
l -= x;
|
|
1723
1724
|
}
|
|
1724
1725
|
const u = n?.materialize ? this.get(r) : (this.deltas.get(r) || 0) + this.baseValue;
|
|
1725
1726
|
return { cumulative: s + this.baseValue * (r + 1), total: this.total, currentValue: u, safeIndex: r };
|
|
@@ -1755,7 +1756,7 @@ class oe {
|
|
|
1755
1756
|
else {
|
|
1756
1757
|
this.total = this._computeTreeTotal();
|
|
1757
1758
|
const r = this.prefixSum(this.getSize() - 1);
|
|
1758
|
-
r.cumulative !== r.total &&
|
|
1759
|
+
r.cumulative !== r.total && N.error("Inconsistent Fenwick Tree state");
|
|
1759
1760
|
}
|
|
1760
1761
|
return this.total;
|
|
1761
1762
|
}
|
|
@@ -1779,7 +1780,7 @@ class oe {
|
|
|
1779
1780
|
let s = r + 1;
|
|
1780
1781
|
for (; s <= this.size; ) {
|
|
1781
1782
|
e.set(s, (e.get(s) ?? 0) + n);
|
|
1782
|
-
const l =
|
|
1783
|
+
const l = he(s);
|
|
1783
1784
|
if (l === 0)
|
|
1784
1785
|
break;
|
|
1785
1786
|
s += l;
|
|
@@ -1839,7 +1840,7 @@ class oe {
|
|
|
1839
1840
|
this.size = e, this.rebuildTree();
|
|
1840
1841
|
}
|
|
1841
1842
|
const n = this.prefixSum(this.getSize() - 1);
|
|
1842
|
-
n.cumulative !== n.total &&
|
|
1843
|
+
n.cumulative !== n.total && N.error("Inconsistent Fenwick Tree state");
|
|
1843
1844
|
}
|
|
1844
1845
|
/**
|
|
1845
1846
|
* @private
|
|
@@ -1873,14 +1874,14 @@ class oe {
|
|
|
1873
1874
|
_propagateDeltaToGrownNodes(t, e, r, n) {
|
|
1874
1875
|
let s = t + 1;
|
|
1875
1876
|
for (; s <= r; ) {
|
|
1876
|
-
const l =
|
|
1877
|
+
const l = he(s);
|
|
1877
1878
|
if (l === 0)
|
|
1878
1879
|
break;
|
|
1879
1880
|
s += l;
|
|
1880
1881
|
}
|
|
1881
1882
|
for (; s <= n; ) {
|
|
1882
1883
|
this.tree.set(s, (this.tree.get(s) ?? 0) + e);
|
|
1883
|
-
const l =
|
|
1884
|
+
const l = he(s);
|
|
1884
1885
|
if (l === 0)
|
|
1885
1886
|
break;
|
|
1886
1887
|
s += l;
|
|
@@ -1950,13 +1951,13 @@ const vr = (i, t) => {
|
|
|
1950
1951
|
const e = i?.sampleRange, r = t?.sampleRange;
|
|
1951
1952
|
return e === r ? !1 : e && r ? e.from !== r.from || e.to !== r.to : !0;
|
|
1952
1953
|
}, Tr = (i, t, e) => {
|
|
1953
|
-
const r = Number.isFinite(i) && i > 0 ? Math.trunc(i) : 0, n =
|
|
1954
|
+
const r = Number.isFinite(i) && i > 0 ? Math.trunc(i) : 0, n = g(null), s = g({ size: r, valueOrFn: t, options: e });
|
|
1954
1955
|
n.current === null && (n.current = new oe(r, t, e));
|
|
1955
|
-
const l = n.current, u = s.current, f = u.size !== r,
|
|
1956
|
-
if (
|
|
1957
|
-
const
|
|
1958
|
-
|
|
1959
|
-
} else f && (e?.debug &&
|
|
1956
|
+
const l = n.current, u = s.current, f = u.size !== r, x = u.valueOrFn !== t, I = vr(u.options, e), M = u.size === 0 && r > 0;
|
|
1957
|
+
if (x || I) {
|
|
1958
|
+
const _ = e?.resetOnValueFnChange ?? !0;
|
|
1959
|
+
I || x && _ || M ? (e?.debug && N.debug("[useFenwickMapTree] reset", { valueOrFnChanged: x, optionsChanged: I }), l.reset(r, t, e)) : (f && (e?.debug && N.debug("[useFenwickMapTree] resize (with valueFn change)", { from: u.size, to: r }), l.changeSize(r)), e?.debug && N.debug("[useFenwickMapTree] setValueFn (no reset)", { valueOrFnChanged: x }), l.setValueFn(t, { reset: !1 })), s.current = { size: r, valueOrFn: t, options: e };
|
|
1960
|
+
} else f && (e?.debug && N.debug("[useFenwickMapTree] resize", { from: u.size, to: r }), M ? l.reset(r, t, e) : l.changeSize(r), s.current = { size: r, valueOrFn: t, options: e });
|
|
1960
1961
|
return l;
|
|
1961
1962
|
};
|
|
1962
1963
|
class Sr {
|
|
@@ -2010,54 +2011,54 @@ class _e {
|
|
|
2010
2011
|
}
|
|
2011
2012
|
}
|
|
2012
2013
|
function Mr(i) {
|
|
2013
|
-
const t =
|
|
2014
|
+
const t = g(/* @__PURE__ */ new Map()), e = g(new _e()), r = Math.floor(i), n = g(r);
|
|
2014
2015
|
X(() => {
|
|
2015
2016
|
if (n.current = r, Number.isNaN(r) || r < 0) {
|
|
2016
|
-
|
|
2017
|
+
N.warn(`useLruCache: invalid capacity ${i}; the cache will not store any entries.`), t.current.clear(), e.current = new _e();
|
|
2017
2018
|
return;
|
|
2018
2019
|
}
|
|
2019
2020
|
if (Number.isFinite(r))
|
|
2020
2021
|
for (; t.current.size > r; ) {
|
|
2021
|
-
const
|
|
2022
|
-
if (
|
|
2023
|
-
t.current.delete(
|
|
2022
|
+
const I = e.current.removeHead();
|
|
2023
|
+
if (I)
|
|
2024
|
+
t.current.delete(I.key);
|
|
2024
2025
|
else
|
|
2025
2026
|
break;
|
|
2026
2027
|
}
|
|
2027
2028
|
}, [i, r]);
|
|
2028
|
-
const s =
|
|
2029
|
-
const
|
|
2030
|
-
if (
|
|
2031
|
-
return e.current.moveToTail(
|
|
2032
|
-
}, []), l =
|
|
2033
|
-
const
|
|
2034
|
-
if (Number.isNaN(
|
|
2029
|
+
const s = S((I) => {
|
|
2030
|
+
const M = t.current.get(I);
|
|
2031
|
+
if (M)
|
|
2032
|
+
return e.current.moveToTail(M), M.value;
|
|
2033
|
+
}, []), l = S((I, M) => {
|
|
2034
|
+
const _ = n.current;
|
|
2035
|
+
if (Number.isNaN(_) || _ <= 0)
|
|
2035
2036
|
return;
|
|
2036
|
-
let p = t.current.get(
|
|
2037
|
+
let p = t.current.get(I);
|
|
2037
2038
|
if (p)
|
|
2038
|
-
p.value =
|
|
2039
|
+
p.value = M, e.current.moveToTail(p);
|
|
2039
2040
|
else {
|
|
2040
|
-
if (t.current.size >=
|
|
2041
|
-
const
|
|
2042
|
-
|
|
2041
|
+
if (t.current.size >= _) {
|
|
2042
|
+
const D = e.current.removeHead();
|
|
2043
|
+
D && t.current.delete(D.key);
|
|
2043
2044
|
}
|
|
2044
|
-
p = new Sr(
|
|
2045
|
+
p = new Sr(I, M), t.current.set(I, p), e.current.addToTail(p);
|
|
2045
2046
|
}
|
|
2046
|
-
}, []), u =
|
|
2047
|
-
const
|
|
2048
|
-
|
|
2049
|
-
}, []),
|
|
2047
|
+
}, []), u = S((I) => t.current.has(I), []), f = S((I) => {
|
|
2048
|
+
const M = t.current.get(I);
|
|
2049
|
+
M && (e.current.remove(M), t.current.delete(I));
|
|
2050
|
+
}, []), x = S(() => {
|
|
2050
2051
|
t.current.clear(), e.current = new _e();
|
|
2051
2052
|
}, []);
|
|
2052
|
-
return
|
|
2053
|
+
return Nt(() => ({ get: s, set: l, has: u, remove: f, clear: x }), [s, l, u, f, x]);
|
|
2053
2054
|
}
|
|
2054
2055
|
const Pr = 1e4, Lr = () => {
|
|
2055
2056
|
const { get: i, set: t, has: e, clear: r } = Mr(Pr);
|
|
2056
|
-
return
|
|
2057
|
-
}, dt = (i, t) => t <= 0 ? 0 :
|
|
2057
|
+
return Nt(() => ({ get: i, set: t, has: e, clear: r }), [i, t, e, r]);
|
|
2058
|
+
}, dt = (i, t) => t <= 0 ? 0 : gt(i, 0, t - 1), Xe = (i) => ({
|
|
2058
2059
|
top: Math.max(0, i?.top ?? 0),
|
|
2059
2060
|
bottom: Math.max(0, i?.bottom ?? 0)
|
|
2060
|
-
}), ee = (i, t) => i <= t ? 0 : i - t,
|
|
2061
|
+
}), ee = (i, t) => i <= t ? 0 : i - t, ge = (i, t) => i <= 0 ? t : i + t, Ne = 1e3, $e = 2e3, yr = 1048576, Se = (i) => {
|
|
2061
2062
|
if (!Number.isFinite(i)) return 0n;
|
|
2062
2063
|
const t = Math.trunc(i);
|
|
2063
2064
|
return t <= 0 ? 0n : BigInt(t);
|
|
@@ -2065,33 +2066,33 @@ const Pr = 1e4, Lr = () => {
|
|
|
2065
2066
|
const f = Se(r);
|
|
2066
2067
|
if (f === 0n)
|
|
2067
2068
|
return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
|
|
2068
|
-
const
|
|
2069
|
+
const x = (z) => z < 0n ? 0n : z >= f ? f - 1n : z, I = { materializeOption: { materialize: !1 } }, { index: M, cumulative: _ } = s.findIndexAtOrAfter(i, I);
|
|
2069
2070
|
let p;
|
|
2070
|
-
|
|
2071
|
-
const
|
|
2072
|
-
const
|
|
2073
|
-
if (!Number.isSafeInteger(
|
|
2071
|
+
M === -1 ? p = f - 1n : (_ === i ? p = Se(M + 1) : p = Se(M), p >= f && (p = f - 1n)), i <= 0 && (p = 0n), u && i >= l && (p = f - 1n);
|
|
2072
|
+
const D = (z) => {
|
|
2073
|
+
const B = Number(z);
|
|
2074
|
+
if (!Number.isSafeInteger(B))
|
|
2074
2075
|
return null;
|
|
2075
|
-
const { cumulative:
|
|
2076
|
-
if (!Number.isFinite(
|
|
2076
|
+
const { cumulative: w } = s.prefixSum(B, { materializeOption: { materialize: !1 } });
|
|
2077
|
+
if (!Number.isFinite(w))
|
|
2077
2078
|
return null;
|
|
2078
|
-
const { index:
|
|
2079
|
-
if (
|
|
2079
|
+
const { index: C } = s.findIndexAtOrAfter(w + 0.5, { materializeOption: { materialize: !1 } });
|
|
2080
|
+
if (C === -1)
|
|
2080
2081
|
return null;
|
|
2081
|
-
const
|
|
2082
|
-
return
|
|
2083
|
-
},
|
|
2084
|
-
let
|
|
2085
|
-
for (;
|
|
2086
|
-
const
|
|
2087
|
-
if (
|
|
2082
|
+
const U = Se(C);
|
|
2083
|
+
return U > z ? U : null;
|
|
2084
|
+
}, J = (z) => {
|
|
2085
|
+
let B = 0, w = z, C = z, U = 0n, H = 0;
|
|
2086
|
+
for (; w < f && B < t; ) {
|
|
2087
|
+
const tt = Number(w), L = n(tt);
|
|
2088
|
+
if (B += L, C = w, w += 1n, U += 1n, !Number.isFinite(L) || L < 0)
|
|
2088
2089
|
break;
|
|
2089
|
-
if (
|
|
2090
|
-
if (H += 1, H >
|
|
2091
|
-
const
|
|
2092
|
-
if (
|
|
2093
|
-
|
|
2094
|
-
else if (
|
|
2090
|
+
if (L === 0) {
|
|
2091
|
+
if (H += 1, H > Ne) {
|
|
2092
|
+
const b = D(C);
|
|
2093
|
+
if (b !== null && b > w)
|
|
2094
|
+
w = b, H = 0;
|
|
2095
|
+
else if (b !== null && b === w && n(Number(w)) > 0)
|
|
2095
2096
|
H = 0;
|
|
2096
2097
|
else
|
|
2097
2098
|
break;
|
|
@@ -2099,45 +2100,45 @@ const Pr = 1e4, Lr = () => {
|
|
|
2099
2100
|
} else
|
|
2100
2101
|
H = 0;
|
|
2101
2102
|
}
|
|
2102
|
-
return
|
|
2103
|
+
return U === 0n && (C = z), { height: B, end: C };
|
|
2103
2104
|
};
|
|
2104
|
-
let { height:
|
|
2105
|
-
if (
|
|
2106
|
-
let
|
|
2107
|
-
for (;
|
|
2108
|
-
|
|
2109
|
-
const
|
|
2110
|
-
if (
|
|
2105
|
+
let { height: G, end: rt } = J(p);
|
|
2106
|
+
if (G < t && p > 0n) {
|
|
2107
|
+
let z = p, B = G, w = 0;
|
|
2108
|
+
for (; z > 0n && B < t; ) {
|
|
2109
|
+
z -= 1n;
|
|
2110
|
+
const U = Number(z), H = n(U);
|
|
2111
|
+
if (B += H, !Number.isFinite(H) || H < 0)
|
|
2111
2112
|
break;
|
|
2112
2113
|
if (H === 0) {
|
|
2113
|
-
if (
|
|
2114
|
-
const
|
|
2115
|
-
if (!Number.isSafeInteger(
|
|
2114
|
+
if (w += 1, w > Ne) {
|
|
2115
|
+
const tt = Number(z);
|
|
2116
|
+
if (!Number.isSafeInteger(tt))
|
|
2116
2117
|
break;
|
|
2117
|
-
const { cumulative:
|
|
2118
|
-
if (!Number.isFinite(
|
|
2118
|
+
const { cumulative: L } = s.prefixSum(tt, { materializeOption: { materialize: !1 } });
|
|
2119
|
+
if (!Number.isFinite(L))
|
|
2119
2120
|
break;
|
|
2120
|
-
const { index:
|
|
2121
|
-
if (
|
|
2122
|
-
|
|
2123
|
-
else if (
|
|
2124
|
-
|
|
2121
|
+
const { index: b } = s.findIndexAtOrAfter(L - 0.5, { materializeOption: { materialize: !1 } }), K = b === -1 ? -1n : Se(b);
|
|
2122
|
+
if (K >= 0n && K < z)
|
|
2123
|
+
z = K + 1n, w = 0;
|
|
2124
|
+
else if (K === z && z >= 1n && n(Number(z - 1n)) > 0)
|
|
2125
|
+
w = 0;
|
|
2125
2126
|
else
|
|
2126
2127
|
break;
|
|
2127
2128
|
}
|
|
2128
2129
|
} else
|
|
2129
|
-
|
|
2130
|
+
w = 0;
|
|
2130
2131
|
}
|
|
2131
|
-
p =
|
|
2132
|
-
const
|
|
2133
|
-
|
|
2132
|
+
p = x(z);
|
|
2133
|
+
const C = J(p);
|
|
2134
|
+
G = C.height, rt = C.end;
|
|
2134
2135
|
}
|
|
2135
|
-
const nt =
|
|
2136
|
+
const nt = x(p), st = x(rt), wt = x(nt - BigInt(Math.max(0, e))), Vt = x(st + BigInt(Math.max(0, e)));
|
|
2136
2137
|
return {
|
|
2137
|
-
renderingStartIndex: dt(Number(
|
|
2138
|
-
renderingEndIndex: dt(Number(
|
|
2138
|
+
renderingStartIndex: dt(Number(wt), r),
|
|
2139
|
+
renderingEndIndex: dt(Number(Vt), r),
|
|
2139
2140
|
visibleStartIndex: dt(Number(nt), r),
|
|
2140
|
-
visibleEndIndex: dt(Number(
|
|
2141
|
+
visibleEndIndex: dt(Number(st), r)
|
|
2141
2142
|
};
|
|
2142
2143
|
}, Rr = (i, t, e, r, n, s, l) => {
|
|
2143
2144
|
if (r === 0)
|
|
@@ -2145,78 +2146,78 @@ const Pr = 1e4, Lr = () => {
|
|
|
2145
2146
|
const u = Number.isFinite(l), f = u ? Math.min(Math.max(0, i), l) : Math.max(0, i);
|
|
2146
2147
|
if (r >= Number.MAX_SAFE_INTEGER)
|
|
2147
2148
|
return wr(f, t, e, r, n, s, l, u);
|
|
2148
|
-
const { index:
|
|
2149
|
-
let p = dt(
|
|
2150
|
-
if (
|
|
2151
|
-
p = dt(
|
|
2152
|
-
else if (p ===
|
|
2153
|
-
|
|
2149
|
+
const { index: x, cumulative: I, currentValue: M } = s.findIndexAtOrAfter(f, { materializeOption: { materialize: !1 } }), _ = x === -1 ? t <= 0 || (I ?? 0) < f + (M ?? 0) ? r - 1 : 0 : x;
|
|
2150
|
+
let p = dt(_, r), D = 0;
|
|
2151
|
+
if (x !== -1 && I === f)
|
|
2152
|
+
p = dt(x + 1, r), D = 0;
|
|
2153
|
+
else if (p === x && I !== void 0 && M !== void 0)
|
|
2154
|
+
D = I - M - f;
|
|
2154
2155
|
else {
|
|
2155
|
-
const { cumulative:
|
|
2156
|
-
|
|
2156
|
+
const { cumulative: z, currentValue: B } = s.prefixSum(p, { materializeOption: { materialize: !1 } });
|
|
2157
|
+
D = (z ?? 0) - (B ?? 0) - f;
|
|
2157
2158
|
}
|
|
2158
|
-
const
|
|
2159
|
-
let
|
|
2160
|
-
for (;
|
|
2161
|
-
const H = n(
|
|
2162
|
-
if (
|
|
2159
|
+
const J = D, G = (z, B) => {
|
|
2160
|
+
let w = z, C = B, U = 0;
|
|
2161
|
+
for (; w < r && C < t; ) {
|
|
2162
|
+
const H = n(w);
|
|
2163
|
+
if (C += H, w++, !Number.isFinite(H) || H < 0)
|
|
2163
2164
|
break;
|
|
2164
2165
|
if (H === 0) {
|
|
2165
|
-
if (
|
|
2166
|
-
const { cumulative:
|
|
2167
|
-
if (
|
|
2168
|
-
|
|
2169
|
-
else if (
|
|
2170
|
-
|
|
2166
|
+
if (U++, U > Ne) {
|
|
2167
|
+
const { cumulative: tt } = s.prefixSum(w - 1, { materializeOption: { materialize: !1 } }), { index: L } = Number.isFinite(tt) ? s.findIndexAtOrAfter(tt + 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
|
|
2168
|
+
if (L > w)
|
|
2169
|
+
w = L, U = 0;
|
|
2170
|
+
else if (L === w && n(w) > 0)
|
|
2171
|
+
U = 0;
|
|
2171
2172
|
else
|
|
2172
2173
|
break;
|
|
2173
2174
|
}
|
|
2174
2175
|
} else
|
|
2175
|
-
|
|
2176
|
+
U = 0;
|
|
2176
2177
|
}
|
|
2177
|
-
return { cursor:
|
|
2178
|
-
},
|
|
2179
|
-
let nt =
|
|
2180
|
-
if (
|
|
2181
|
-
let
|
|
2182
|
-
for (;
|
|
2183
|
-
const
|
|
2184
|
-
if (
|
|
2185
|
-
|
|
2178
|
+
return { cursor: w, height: C };
|
|
2179
|
+
}, rt = G(p, D);
|
|
2180
|
+
let nt = rt.cursor;
|
|
2181
|
+
if (D = rt.height, D < t && p > 0) {
|
|
2182
|
+
let z = D + Math.abs(Math.min(0, J)), B = p - 1, w = 0;
|
|
2183
|
+
for (; B >= 0 && z < t; ) {
|
|
2184
|
+
const U = n(B);
|
|
2185
|
+
if (z += U, !Number.isFinite(U) || U < 0) {
|
|
2186
|
+
B--;
|
|
2186
2187
|
break;
|
|
2187
2188
|
}
|
|
2188
|
-
if (
|
|
2189
|
-
if (
|
|
2190
|
-
const { cumulative: H } = s.prefixSum(
|
|
2191
|
-
if (
|
|
2192
|
-
|
|
2189
|
+
if (U === 0) {
|
|
2190
|
+
if (w++, w > Ne) {
|
|
2191
|
+
const { cumulative: H } = s.prefixSum(B, { materializeOption: { materialize: !1 } }), { index: tt } = Number.isFinite(H) ? s.findIndexAtOrAfter(H - 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
|
|
2192
|
+
if (tt !== -1 && tt < B) {
|
|
2193
|
+
B = tt, w = 0;
|
|
2193
2194
|
continue;
|
|
2194
2195
|
}
|
|
2195
|
-
if (
|
|
2196
|
-
|
|
2196
|
+
if (tt === B && B >= 1 && n(B - 1) > 0)
|
|
2197
|
+
w = 0;
|
|
2197
2198
|
else {
|
|
2198
|
-
|
|
2199
|
+
B--;
|
|
2199
2200
|
break;
|
|
2200
2201
|
}
|
|
2201
2202
|
}
|
|
2202
2203
|
} else
|
|
2203
|
-
|
|
2204
|
-
|
|
2204
|
+
w = 0;
|
|
2205
|
+
B--;
|
|
2205
2206
|
}
|
|
2206
|
-
p = dt(
|
|
2207
|
-
const
|
|
2208
|
-
nt =
|
|
2207
|
+
p = dt(B + 1, r);
|
|
2208
|
+
const C = G(p, 0);
|
|
2209
|
+
nt = C.cursor, D = C.height;
|
|
2209
2210
|
}
|
|
2210
|
-
const
|
|
2211
|
-
return { renderingStartIndex:
|
|
2211
|
+
const st = dt(p - e, r), wt = dt(Math.max(nt - 1, p), r), Vt = dt(wt + e, r);
|
|
2212
|
+
return { renderingStartIndex: st, renderingEndIndex: Vt, visibleStartIndex: p, visibleEndIndex: wt };
|
|
2212
2213
|
}, Ue = (i, t, e) => {
|
|
2213
|
-
const r = Math.max(0, t ?? 0), n =
|
|
2214
|
+
const r = Math.max(0, t ?? 0), n = g({ last: 0, id: null, arg: null }).current;
|
|
2214
2215
|
return X(
|
|
2215
2216
|
() => () => {
|
|
2216
2217
|
n.id !== null && (cancelAnimationFrame(n.id), n.id = null);
|
|
2217
2218
|
},
|
|
2218
2219
|
[n]
|
|
2219
|
-
),
|
|
2220
|
+
), S(
|
|
2220
2221
|
(s) => {
|
|
2221
2222
|
if (n.arg = s, n.id !== null) return;
|
|
2222
2223
|
const l = (u) => {
|
|
@@ -2226,8 +2227,8 @@ const Pr = 1e4, Lr = () => {
|
|
|
2226
2227
|
if (i.current)
|
|
2227
2228
|
try {
|
|
2228
2229
|
e(i.current, n.arg);
|
|
2229
|
-
} catch (
|
|
2230
|
-
console.error("[useThrottledInvoker] Error invoking callback",
|
|
2230
|
+
} catch (x) {
|
|
2231
|
+
console.error("[useThrottledInvoker] Error invoking callback", x);
|
|
2231
2232
|
}
|
|
2232
2233
|
n.arg = null, n.last = u;
|
|
2233
2234
|
}
|
|
@@ -2237,14 +2238,14 @@ const Pr = 1e4, Lr = () => {
|
|
|
2237
2238
|
},
|
|
2238
2239
|
[r, e, i, n]
|
|
2239
2240
|
);
|
|
2240
|
-
}, Cr = Qe.memo(({ index: i, top: t, height: e, item: r, children: n, clipItemHeight: s, enableKeyboardNavigation: l, onKeyDown: u, onFocus: f, registerItemRef:
|
|
2241
|
-
const
|
|
2242
|
-
|
|
2241
|
+
}, Cr = Qe.memo(({ index: i, top: t, height: e, item: r, children: n, clipItemHeight: s, enableKeyboardNavigation: l, onKeyDown: u, onFocus: f, registerItemRef: x }) => {
|
|
2242
|
+
const I = S((D) => x(i, D), [i, x]), M = S((D) => u(D, i), [i, u]), _ = S(() => f(i), [i, f]), p = S((D) => {
|
|
2243
|
+
D.currentTarget.focus({ preventScroll: !0 });
|
|
2243
2244
|
}, []);
|
|
2244
|
-
return /* @__PURE__ */
|
|
2245
|
+
return /* @__PURE__ */ Q(
|
|
2245
2246
|
"div",
|
|
2246
2247
|
{
|
|
2247
|
-
ref:
|
|
2248
|
+
ref: I,
|
|
2248
2249
|
"data-index": i,
|
|
2249
2250
|
"data-virtualscroll-item": "true",
|
|
2250
2251
|
className: "aqvs-item-container",
|
|
@@ -2255,8 +2256,8 @@ const Pr = 1e4, Lr = () => {
|
|
|
2255
2256
|
},
|
|
2256
2257
|
tabIndex: l ? -1 : void 0,
|
|
2257
2258
|
onPointerDown: l ? p : void 0,
|
|
2258
|
-
onKeyDownCapture: l ?
|
|
2259
|
-
onFocusCapture: l ?
|
|
2259
|
+
onKeyDownCapture: l ? M : void 0,
|
|
2260
|
+
onFocusCapture: l ? _ : void 0,
|
|
2260
2261
|
children: n(r, i)
|
|
2261
2262
|
}
|
|
2262
2263
|
);
|
|
@@ -2268,302 +2269,303 @@ const Pr = 1e4, Lr = () => {
|
|
|
2268
2269
|
viewportSize: n,
|
|
2269
2270
|
overscanCount: s = 15,
|
|
2270
2271
|
className: l,
|
|
2271
|
-
|
|
2272
|
-
|
|
2272
|
+
testId: u,
|
|
2273
|
+
onScroll: f,
|
|
2274
|
+
onRangeChange: x,
|
|
2273
2275
|
children: I,
|
|
2274
|
-
background:
|
|
2275
|
-
initialScrollIndex:
|
|
2276
|
-
initialScrollOffset:
|
|
2277
|
-
callbackThrottleMs:
|
|
2278
|
-
contentInsets:
|
|
2279
|
-
onItemFocus:
|
|
2280
|
-
scrollBarOptions:
|
|
2281
|
-
behaviorOptions:
|
|
2282
|
-
onWheelHorizontal:
|
|
2283
|
-
},
|
|
2284
|
-
const { width:
|
|
2276
|
+
background: M,
|
|
2277
|
+
initialScrollIndex: _,
|
|
2278
|
+
initialScrollOffset: p,
|
|
2279
|
+
callbackThrottleMs: D = 5,
|
|
2280
|
+
contentInsets: J,
|
|
2281
|
+
onItemFocus: G,
|
|
2282
|
+
scrollBarOptions: rt,
|
|
2283
|
+
behaviorOptions: nt,
|
|
2284
|
+
onWheelHorizontal: st
|
|
2285
|
+
}, wt) => {
|
|
2286
|
+
const { width: Vt, enableThumbDrag: z, enableTrackClick: B, enableArrowButtons: w, enableScrollToTopBottomButtons: C, renderThumbOverlay: U, tapScrollCircleOptions: H } = rt ?? {}, { enablePointerDrag: tt, enableKeyboardNavigation: L = !0, wheelSpeedMultiplier: b, inertiaOptions: K, clipItemHeight: ft = !1, resetOnGetItemHeightChange: et = !1 } = nt ?? {}, Y = g(null), W = g({
|
|
2285
2287
|
renderingStartIndex: 0,
|
|
2286
2288
|
renderingEndIndex: 0,
|
|
2287
2289
|
visibleStartIndex: 0,
|
|
2288
2290
|
visibleEndIndex: 0,
|
|
2289
2291
|
scrollPosition: 0,
|
|
2290
2292
|
totalHeight: 0
|
|
2291
|
-
}),
|
|
2293
|
+
}), bt = g(null), St = g(!1);
|
|
2292
2294
|
X(() => {
|
|
2293
|
-
|
|
2294
|
-
}, [
|
|
2295
|
-
const R =
|
|
2296
|
-
const c = typeof
|
|
2295
|
+
et && (bt.current = null);
|
|
2296
|
+
}, [et, r]);
|
|
2297
|
+
const R = Nt(() => Xe(J), [J]), [Ft] = jt(() => {
|
|
2298
|
+
const c = typeof _ == "number" && Number.isFinite(_) ? Math.max(0, Math.trunc(_)) : 0;
|
|
2297
2299
|
return { from: Math.max(0, c - 50), to: c + 50 };
|
|
2298
|
-
}),
|
|
2300
|
+
}), Lt = Nt(
|
|
2299
2301
|
// 目的: Fenwick Tree のオプション設定
|
|
2300
2302
|
// 依存関係: resetOnGetItemHeightChange, initialSampleRange (マウント時固定)
|
|
2301
2303
|
// itemCount には依存させない (依存させると追記のたびに options 参照が変わり、計測済み高さが全消去される)。
|
|
2302
2304
|
// この useMemo により sampleRange を毎レンダー新規生成しない = 参照同一性由来の破壊的 reset を防ぐ。
|
|
2303
2305
|
() => ({
|
|
2304
|
-
sampleRange:
|
|
2305
|
-
resetOnValueFnChange:
|
|
2306
|
+
sampleRange: Ft,
|
|
2307
|
+
resetOnValueFnChange: et,
|
|
2306
2308
|
materialize: !0
|
|
2307
2309
|
}),
|
|
2308
|
-
[
|
|
2309
|
-
),
|
|
2310
|
+
[et, Ft]
|
|
2311
|
+
), v = Tr(i, r, Lt), [zt] = jt(() => {
|
|
2310
2312
|
let o = R.top, c = 0;
|
|
2311
|
-
if (typeof
|
|
2312
|
-
const d =
|
|
2313
|
-
o =
|
|
2314
|
-
} else typeof
|
|
2313
|
+
if (typeof _ == "number") {
|
|
2314
|
+
const d = gt(_, 0, i - 1), y = gt(d - s * 2, 0, i - 1), k = gt(d + s * 2, 0, i - 1), E = _ > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: y, to: k }] } } : void 0, { cumulative: q, total: $, currentValue: at } = v.prefixSum(_, E), Z = Math.max(q - at, 0);
|
|
2315
|
+
o = ge(Z, R.top), c = $ ?? v.getTotal();
|
|
2316
|
+
} else typeof p == "number" && (o = ge(Math.max(p, 0), R.top)), c = v.getTotal();
|
|
2315
2317
|
return { position: o, total: c };
|
|
2316
|
-
}), [
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
}, [
|
|
2320
|
-
const
|
|
2318
|
+
}), [_t, Gt] = jt(zt.position), [T, O] = jt(zt.total), A = g(zt.position), mt = g(R.top), lt = g(f ?? void 0), ct = g(x ?? void 0), Mt = g(/* @__PURE__ */ new Map()), j = g(null), At = g(null), [pt, Zt] = jt(null), [Ot, Rt] = jt(!1), Ct = g(null), Xt = g(!1), ut = g(0), xt = g(!1), m = g(!1), V = g(i);
|
|
2319
|
+
V.current !== i && (V.current = i, m.current = !0), X(() => {
|
|
2320
|
+
lt.current = f ?? void 0, ct.current = x ?? void 0;
|
|
2321
|
+
}, [x, f]);
|
|
2322
|
+
const It = S(
|
|
2321
2323
|
(o) => {
|
|
2322
|
-
if (
|
|
2324
|
+
if (L && o && typeof o.focus == "function")
|
|
2323
2325
|
try {
|
|
2324
2326
|
o.focus({ preventScroll: !0 });
|
|
2325
2327
|
} catch {
|
|
2326
2328
|
o.focus();
|
|
2327
2329
|
}
|
|
2328
2330
|
},
|
|
2329
|
-
[
|
|
2330
|
-
),
|
|
2331
|
+
[L]
|
|
2332
|
+
), vt = S((o, { position: c, totalHeight: d }) => {
|
|
2331
2333
|
o(c, d);
|
|
2332
|
-
}, []),
|
|
2334
|
+
}, []), ht = Ue(lt, D, vt), se = S((o, c) => {
|
|
2333
2335
|
o(c);
|
|
2334
|
-
}, []),
|
|
2335
|
-
|
|
2336
|
-
const
|
|
2337
|
-
|
|
2338
|
-
|
|
2336
|
+
}, []), Et = Ue(ct, D, se), $t = g(R.top);
|
|
2337
|
+
$t.current = R.top;
|
|
2338
|
+
const Ht = g(ht);
|
|
2339
|
+
Ht.current = ht, X(() => (St.current = !1, () => {
|
|
2340
|
+
St.current = !0, Ct.current && (clearTimeout(Ct.current), Ct.current = null);
|
|
2339
2341
|
}), []), X(() => {
|
|
2340
|
-
|
|
2341
|
-
}, [
|
|
2342
|
-
const
|
|
2342
|
+
L || (Mt.current.clear(), j.current = null, At.current = null);
|
|
2343
|
+
}, [L]);
|
|
2344
|
+
const Dt = S(
|
|
2343
2345
|
(o, c) => {
|
|
2344
2346
|
if (!c) {
|
|
2345
|
-
|
|
2347
|
+
Mt.current.delete(o);
|
|
2346
2348
|
return;
|
|
2347
2349
|
}
|
|
2348
|
-
|
|
2350
|
+
L && (Mt.current.set(o, c), j.current === o && (j.current = null, At.current = o, It(c)));
|
|
2349
2351
|
},
|
|
2350
|
-
[
|
|
2351
|
-
),
|
|
2352
|
+
[L, It]
|
|
2353
|
+
), kt = 0.01, Ut = g({
|
|
2352
2354
|
rafId: null,
|
|
2353
2355
|
loopActive: !1,
|
|
2354
2356
|
idleFrames: 0,
|
|
2355
|
-
lastRenderedPosition:
|
|
2356
|
-
}),
|
|
2357
|
-
const o =
|
|
2357
|
+
lastRenderedPosition: zt.position
|
|
2358
|
+
}), ae = S(() => {
|
|
2359
|
+
const o = Ut.current;
|
|
2358
2360
|
o.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(o.rafId), o.rafId = null, o.loopActive = !1, o.idleFrames = 0;
|
|
2359
2361
|
}, []);
|
|
2360
2362
|
X(
|
|
2361
2363
|
() => () => {
|
|
2362
|
-
|
|
2364
|
+
ae();
|
|
2363
2365
|
},
|
|
2364
|
-
[
|
|
2366
|
+
[ae]
|
|
2365
2367
|
);
|
|
2366
|
-
const
|
|
2367
|
-
}),
|
|
2368
|
-
const o =
|
|
2368
|
+
const Me = g(() => {
|
|
2369
|
+
}), de = S(() => {
|
|
2370
|
+
const o = Ut.current;
|
|
2369
2371
|
o.rafId = null;
|
|
2370
|
-
const c =
|
|
2371
|
-
if (
|
|
2372
|
-
|
|
2372
|
+
const c = A.current, d = ee(c, $t.current), y = v.getTotal();
|
|
2373
|
+
if (Gt((E) => Math.abs(E - c) < kt ? E : c), Math.abs(o.lastRenderedPosition - c) >= kt ? (Ht.current({ position: d, totalHeight: y }), o.lastRenderedPosition = c, o.idleFrames = 0) : o.idleFrames += 1, o.idleFrames >= 2) {
|
|
2374
|
+
ae();
|
|
2373
2375
|
return;
|
|
2374
2376
|
}
|
|
2375
2377
|
if (typeof requestAnimationFrame == "function") {
|
|
2376
|
-
o.rafId = requestAnimationFrame((
|
|
2378
|
+
o.rafId = requestAnimationFrame((E) => Me.current(E));
|
|
2377
2379
|
return;
|
|
2378
2380
|
}
|
|
2379
2381
|
o.loopActive = !1;
|
|
2380
|
-
}, [
|
|
2381
|
-
|
|
2382
|
-
const
|
|
2383
|
-
const o =
|
|
2382
|
+
}, [v, ae]);
|
|
2383
|
+
Me.current = de;
|
|
2384
|
+
const xe = S(() => {
|
|
2385
|
+
const o = Ut.current;
|
|
2384
2386
|
if (o.idleFrames = 0, !o.loopActive) {
|
|
2385
2387
|
if (o.loopActive = !0, typeof requestAnimationFrame == "function") {
|
|
2386
|
-
o.rafId = requestAnimationFrame(
|
|
2388
|
+
o.rafId = requestAnimationFrame(de);
|
|
2387
2389
|
return;
|
|
2388
2390
|
}
|
|
2389
2391
|
o.loopActive = !1;
|
|
2390
2392
|
}
|
|
2391
|
-
}, [
|
|
2393
|
+
}, [de]), it = S(
|
|
2392
2394
|
(o, c) => {
|
|
2393
|
-
const d = c?.immediate ?? !1,
|
|
2394
|
-
if (
|
|
2395
|
-
|
|
2395
|
+
const d = c?.immediate ?? !1, y = ee(o, R.top);
|
|
2396
|
+
if (A.current = o, d) {
|
|
2397
|
+
Ut.current.lastRenderedPosition = o, Ut.current.idleFrames = 0, Gt(o), ht({ position: y, totalHeight: v.getTotal() });
|
|
2396
2398
|
return;
|
|
2397
2399
|
}
|
|
2398
|
-
|
|
2400
|
+
xe();
|
|
2399
2401
|
},
|
|
2400
|
-
[
|
|
2401
|
-
),
|
|
2402
|
-
const c =
|
|
2402
|
+
[xe, v, R.top, ht]
|
|
2403
|
+
), Yt = S((o) => {
|
|
2404
|
+
const c = Y.current;
|
|
2403
2405
|
if (!c)
|
|
2404
2406
|
return o;
|
|
2405
2407
|
const d = c.getScrollPosition();
|
|
2406
|
-
|
|
2407
|
-
const
|
|
2408
|
-
return
|
|
2409
|
-
}, []),
|
|
2408
|
+
ut.current += 1;
|
|
2409
|
+
const y = c.scrollTo(o);
|
|
2410
|
+
return y === d && (ut.current = Math.max(0, ut.current - 1)), Math.abs(y - o) > 0.5 && (xt.current = !0), y;
|
|
2411
|
+
}, []), Kt = g(!1);
|
|
2410
2412
|
X(() => {
|
|
2411
|
-
if (!
|
|
2412
|
-
if (
|
|
2413
|
-
const o =
|
|
2414
|
-
it(o, { immediate: !0 }), c &&
|
|
2413
|
+
if (!Kt.current)
|
|
2414
|
+
if (Kt.current = !0, typeof p == "number") {
|
|
2415
|
+
const o = ge(Math.max(p, 0), R.top), c = Math.abs(o - A.current) > 0.5;
|
|
2416
|
+
it(o, { immediate: !0 }), c && Y.current?.scrollTo(o);
|
|
2415
2417
|
} else
|
|
2416
|
-
it(
|
|
2417
|
-
}, [
|
|
2418
|
-
const o =
|
|
2419
|
-
if (
|
|
2420
|
-
|
|
2418
|
+
it(A.current, { immediate: !0 });
|
|
2419
|
+
}, [p, R.top, it]), X(() => {
|
|
2420
|
+
const o = v.getTotal();
|
|
2421
|
+
if (T !== o) {
|
|
2422
|
+
O(o);
|
|
2421
2423
|
return;
|
|
2422
2424
|
}
|
|
2423
|
-
if (
|
|
2424
|
-
|
|
2425
|
-
const c =
|
|
2426
|
-
if (c && Math.abs(c.getScrollPosition() -
|
|
2427
|
-
const d =
|
|
2428
|
-
|
|
2425
|
+
if (xt.current) {
|
|
2426
|
+
xt.current = !1;
|
|
2427
|
+
const c = Y.current;
|
|
2428
|
+
if (c && Math.abs(c.getScrollPosition() - A.current) > 0.5) {
|
|
2429
|
+
const d = Yt(A.current);
|
|
2430
|
+
xt.current = !1, it(d, { immediate: !0 });
|
|
2429
2431
|
}
|
|
2430
2432
|
}
|
|
2431
|
-
}, [
|
|
2432
|
-
if (
|
|
2433
|
-
const { index: o, align: c, offset: d } =
|
|
2434
|
-
if (
|
|
2435
|
-
const
|
|
2436
|
-
let
|
|
2437
|
-
c === "bottom" ?
|
|
2438
|
-
const
|
|
2439
|
-
Math.abs(
|
|
2440
|
-
from:
|
|
2441
|
-
to:
|
|
2442
|
-
targetIndex:
|
|
2443
|
-
}),
|
|
2433
|
+
}, [v, T, i, Yt, it]), X(() => {
|
|
2434
|
+
if (bt.current !== null) {
|
|
2435
|
+
const { index: o, align: c, offset: d } = bt.current, y = dt(o, i), { cumulative: k, currentValue: E } = v.prefixSum(y, { materializeOption: { materialize: !1 } });
|
|
2436
|
+
if (k !== void 0 && E !== void 0) {
|
|
2437
|
+
const q = Math.max(k - E, 0);
|
|
2438
|
+
let $ = q;
|
|
2439
|
+
c === "bottom" ? $ = k - n : c === "center" && ($ = q + E / 2 - n / 2), d && ($ -= d), $ = Math.max(0, $);
|
|
2440
|
+
const at = Math.max(0, T + R.top + R.bottom - n), Z = Math.min(ge($, R.top), at);
|
|
2441
|
+
Math.abs(Z - A.current) > 1 && (N.debug("[VirtualScroll] Drift correction", {
|
|
2442
|
+
from: A.current,
|
|
2443
|
+
to: Z,
|
|
2444
|
+
targetIndex: y
|
|
2445
|
+
}), ut.current === 0 && (ut.current += 1), Y.current?.scrollTo(Z), it(Z, { immediate: !0 }));
|
|
2444
2446
|
}
|
|
2445
2447
|
}
|
|
2446
2448
|
m.current = !1;
|
|
2447
|
-
}, [
|
|
2448
|
-
const o =
|
|
2449
|
+
}, [T, v, i, R.top, it, n, R.bottom]), X(() => {
|
|
2450
|
+
const o = mt.current;
|
|
2449
2451
|
if (o === R.top) return;
|
|
2450
|
-
const c = ee(
|
|
2451
|
-
|
|
2452
|
+
const c = ee(A.current, o), d = ge(c, R.top);
|
|
2453
|
+
mt.current = R.top, A.current = d, Y.current?.scrollTo(d), it(d, { immediate: !0 });
|
|
2452
2454
|
}, [R.top, it]);
|
|
2453
|
-
const
|
|
2455
|
+
const Ie = S(
|
|
2454
2456
|
(o, c) => {
|
|
2455
2457
|
if (i === 0)
|
|
2456
2458
|
return;
|
|
2457
|
-
const d = dt(o, i),
|
|
2458
|
-
|
|
2459
|
-
let
|
|
2460
|
-
if (
|
|
2461
|
-
const
|
|
2462
|
-
|
|
2459
|
+
const d = dt(o, i), y = v.get(d), k = c - y, E = v.update(d, c);
|
|
2460
|
+
E !== void 0 && O(E), N.debug("[VirtualScroll] Updated item size manually", { index: d, size: c, total: E });
|
|
2461
|
+
let q = bt.current ? bt.current.index : null;
|
|
2462
|
+
if (q === null) {
|
|
2463
|
+
const $ = A.current, at = Xe(J).top, Z = ee($, at), { index: ot, cumulative: Pt } = v.findIndexAtOrAfter(Z, { materializeOption: { materialize: !1 } });
|
|
2464
|
+
q = Pt !== void 0 && Pt === Z ? ot + 1 : ot;
|
|
2463
2465
|
}
|
|
2464
|
-
if (
|
|
2465
|
-
const
|
|
2466
|
-
|
|
2466
|
+
if (q !== -1 && d < q && k !== 0) {
|
|
2467
|
+
const $ = A.current, at = $ + k;
|
|
2468
|
+
Yt(at), it(at, { immediate: !0 }), N.debug("[VirtualScroll] Adjusted scroll for layout shift (manual update)", { from: $, to: at, causedByIndex: d, delta: k, activeVisibleStartIndex: q });
|
|
2467
2469
|
}
|
|
2468
2470
|
},
|
|
2469
|
-
[
|
|
2470
|
-
),
|
|
2471
|
+
[v, i, Yt, it, J]
|
|
2472
|
+
), Bt = S(
|
|
2471
2473
|
(o, c) => {
|
|
2472
|
-
if (!
|
|
2474
|
+
if (!Y.current || i === 0)
|
|
2473
2475
|
return;
|
|
2474
|
-
const d = dt(o, i),
|
|
2475
|
-
if (
|
|
2476
|
+
const d = dt(o, i), y = dt(d - s * 2, i), k = dt(d + s * 2, i), { cumulative: E, total: q, currentValue: $ } = v.prefixSum(d, { materializeOption: { materialize: !0, ranges: [{ from: y, to: k }] } });
|
|
2477
|
+
if (N.debug("[VirtualScroll] Scrolling to index:", d, "ItemBottom:", E, "Total height:", q, "ItemHeight:", $, "safeIndexFrom:", y, "safeIndexTo:", k), !q)
|
|
2476
2478
|
return;
|
|
2477
|
-
const
|
|
2478
|
-
let
|
|
2479
|
-
c?.align === "bottom" ?
|
|
2480
|
-
const
|
|
2481
|
-
|
|
2479
|
+
const at = Math.max(E - $, 0);
|
|
2480
|
+
let Z = at;
|
|
2481
|
+
c?.align === "bottom" ? Z = E - n : c?.align === "center" && (Z = at + $ / 2 - n / 2), c?.offset && (Z -= c.offset), Z = Math.max(0, Z);
|
|
2482
|
+
const ot = ge(Z, R.top), Pt = Y.current?.getContentSize() ?? q + R.top + R.bottom, Tt = Math.max(0, Pt - n), yt = Math.min(ot, Tt);
|
|
2483
|
+
bt.current = {
|
|
2482
2484
|
index: d,
|
|
2483
2485
|
align: c?.align,
|
|
2484
2486
|
offset: c?.offset
|
|
2485
2487
|
};
|
|
2486
|
-
const
|
|
2487
|
-
|
|
2488
|
+
const le = Y.current?.getScrollPosition() ?? -1, ie = Math.abs(le - yt) > 0.5;
|
|
2489
|
+
Xt.current = !1, ut.current = 0, ie && (Xt.current = !0, ut.current += 1, Y.current?.scrollTo(yt)), O(q), it(yt, { immediate: !0 }), N.debug("[VirtualScroll] Setting scroll position to:", yt, { original: ot, max: Tt });
|
|
2488
2490
|
},
|
|
2489
|
-
[
|
|
2490
|
-
),
|
|
2491
|
+
[v, s, i, R.top, R.bottom, n, it]
|
|
2492
|
+
), Pe = S(
|
|
2491
2493
|
(o) => {
|
|
2492
|
-
if (!
|
|
2494
|
+
if (!Y.current || i === 0)
|
|
2493
2495
|
return;
|
|
2494
|
-
const c =
|
|
2495
|
-
|
|
2496
|
+
const c = v.getTotal(), d = gt(Math.floor(o), 0, c), { index: y, cumulative: k, currentValue: E } = v.findIndexAtOrAfter(d, { materializeOption: { materialize: !1 } }), $ = (k ?? 0) - (E ?? 0) - d;
|
|
2497
|
+
Bt(y, { offset: $ });
|
|
2496
2498
|
},
|
|
2497
|
-
[
|
|
2498
|
-
),
|
|
2499
|
+
[v, i, Bt]
|
|
2500
|
+
), ye = S(
|
|
2499
2501
|
(o) => {
|
|
2500
|
-
const c = ee(
|
|
2501
|
-
|
|
2502
|
-
const
|
|
2503
|
-
return it(
|
|
2502
|
+
const c = ee(A.current, R.top), d = typeof o == "function" ? o(c) : o;
|
|
2503
|
+
Pe(d);
|
|
2504
|
+
const y = Y.current?.getScrollPosition(), k = typeof y == "number" ? y : A.current;
|
|
2505
|
+
return it(k), k;
|
|
2504
2506
|
},
|
|
2505
|
-
[R.top,
|
|
2506
|
-
),
|
|
2507
|
+
[R.top, Pe, it]
|
|
2508
|
+
), ve = S(
|
|
2507
2509
|
(o, c) => {
|
|
2508
|
-
|
|
2509
|
-
const d =
|
|
2510
|
-
d && (
|
|
2511
|
-
const
|
|
2512
|
-
if (
|
|
2513
|
-
if (d ||
|
|
2510
|
+
N.debug("[VirtualScroll] Scroll position changed:", o);
|
|
2511
|
+
const d = Xt.current;
|
|
2512
|
+
d && (Xt.current = !1);
|
|
2513
|
+
const y = ut.current > 0;
|
|
2514
|
+
if (y && (ut.current = 0), d || y || m.current || (bt.current = null), it(o), C) {
|
|
2515
|
+
if (d || y)
|
|
2514
2516
|
return;
|
|
2515
|
-
const
|
|
2516
|
-
if (
|
|
2517
|
-
const
|
|
2518
|
-
|
|
2519
|
-
|
|
2517
|
+
const k = o - c;
|
|
2518
|
+
if (N.debug("[VirtualScroll] Scroll diff:", k, "New:", o, "Prev:", c), Math.abs(k) > 1) {
|
|
2519
|
+
const E = k > 0 ? "down" : "up";
|
|
2520
|
+
Zt(E), Rt(!0), N.debug("[VirtualScroll] Showing scroll buttons. Direction:", E), Ct.current && clearTimeout(Ct.current), Ct.current = setTimeout(() => {
|
|
2521
|
+
Rt(!1), N.debug("[VirtualScroll] Hiding scroll buttons");
|
|
2520
2522
|
}, 2e3);
|
|
2521
2523
|
}
|
|
2522
2524
|
}
|
|
2523
2525
|
},
|
|
2524
|
-
[it,
|
|
2525
|
-
),
|
|
2526
|
-
const o =
|
|
2527
|
-
return
|
|
2526
|
+
[it, C]
|
|
2527
|
+
), Jt = Nt(() => ee(_t, R.top), [R.top, _t]), re = Nt(() => {
|
|
2528
|
+
const o = v.getTotal(), c = Rr(Jt, n, s, i, r, v, o);
|
|
2529
|
+
return N.debug("[VirtualScroll] Calculated rendering range:", () => ({
|
|
2528
2530
|
...c,
|
|
2529
|
-
scrollPosition:
|
|
2531
|
+
scrollPosition: Jt,
|
|
2530
2532
|
renderingContentSize: o,
|
|
2531
2533
|
overscanCount: s,
|
|
2532
2534
|
viewportSize: n
|
|
2533
2535
|
})), c;
|
|
2534
|
-
}, [
|
|
2536
|
+
}, [Jt, n, s, i, r, v]), { renderingStartIndex: Qt, renderingEndIndex: qt, visibleStartIndex: ne, visibleEndIndex: fe } = re, te = S(
|
|
2535
2537
|
(o, c) => {
|
|
2536
|
-
if (!
|
|
2538
|
+
if (!L || i === 0)
|
|
2537
2539
|
return;
|
|
2538
2540
|
const d = dt(o, i);
|
|
2539
2541
|
if (!(c?.ensureVisible ?? !0)) {
|
|
2540
|
-
const
|
|
2541
|
-
|
|
2542
|
+
const Tt = Mt.current.get(d);
|
|
2543
|
+
Tt && (j.current = null, At.current = d, It(Tt));
|
|
2542
2544
|
return;
|
|
2543
2545
|
}
|
|
2544
|
-
const
|
|
2545
|
-
if (
|
|
2546
|
-
|
|
2547
|
-
const
|
|
2548
|
-
|
|
2546
|
+
const k = v.prefixSum(d, { materializeOption: { materialize: !1 } }), E = k.currentValue, q = Math.max(k.cumulative - E, 0), $ = q + E, at = ee(A.current, R.top), Z = at + n;
|
|
2547
|
+
if (q < at || $ > Z) {
|
|
2548
|
+
Bt(d);
|
|
2549
|
+
const Tt = Mt.current.get(d);
|
|
2550
|
+
Tt ? (j.current = null, At.current = d, It(Tt)) : j.current = d;
|
|
2549
2551
|
return;
|
|
2550
2552
|
}
|
|
2551
|
-
const
|
|
2552
|
-
if (
|
|
2553
|
-
|
|
2553
|
+
const Pt = Mt.current.get(d);
|
|
2554
|
+
if (Pt) {
|
|
2555
|
+
j.current = null, At.current = d, It(Pt);
|
|
2554
2556
|
return;
|
|
2555
2557
|
}
|
|
2556
|
-
|
|
2558
|
+
j.current = d;
|
|
2557
2559
|
},
|
|
2558
|
-
[
|
|
2559
|
-
),
|
|
2560
|
+
[L, i, v, R.top, Bt, It, n]
|
|
2561
|
+
), we = S(
|
|
2560
2562
|
(o, c) => {
|
|
2561
|
-
if (!
|
|
2563
|
+
if (!L || o.defaultPrevented || o.altKey || o.metaKey || o.ctrlKey)
|
|
2562
2564
|
return;
|
|
2563
2565
|
const d = o.target;
|
|
2564
2566
|
if (d) {
|
|
2565
|
-
const
|
|
2566
|
-
if (
|
|
2567
|
+
const y = d.tagName;
|
|
2568
|
+
if (y === "INPUT" || y === "TEXTAREA" || y === "SELECT" || d.isContentEditable)
|
|
2567
2569
|
return;
|
|
2568
2570
|
}
|
|
2569
2571
|
if (o.key === "ArrowDown") {
|
|
@@ -2577,239 +2579,240 @@ const Pr = 1e4, Lr = () => {
|
|
|
2577
2579
|
if (o.key === "PageDown") {
|
|
2578
2580
|
if (c < i - 1) {
|
|
2579
2581
|
o.preventDefault();
|
|
2580
|
-
const { visibleStartIndex:
|
|
2581
|
-
te(
|
|
2582
|
+
const { visibleStartIndex: y, visibleEndIndex: k } = W.current, E = Math.max(k - y + 1, 1), q = Math.max(E, 1), $ = dt(Math.min(c + q, i - 1), i);
|
|
2583
|
+
te($);
|
|
2582
2584
|
}
|
|
2583
2585
|
return;
|
|
2584
2586
|
}
|
|
2585
2587
|
if (o.key === "PageUp" && c > 0) {
|
|
2586
2588
|
o.preventDefault();
|
|
2587
|
-
const { visibleStartIndex:
|
|
2588
|
-
te(
|
|
2589
|
+
const { visibleStartIndex: y, visibleEndIndex: k } = W.current, E = Math.max(k - y + 1, 1), q = Math.max(E, 1), $ = dt(c - q, i);
|
|
2590
|
+
te($);
|
|
2589
2591
|
}
|
|
2590
2592
|
},
|
|
2591
|
-
[
|
|
2592
|
-
),
|
|
2593
|
+
[L, i, te]
|
|
2594
|
+
), Re = S(
|
|
2593
2595
|
(o) => {
|
|
2594
|
-
if (!
|
|
2596
|
+
if (!L)
|
|
2595
2597
|
return;
|
|
2596
2598
|
const c = dt(o, i);
|
|
2597
|
-
|
|
2599
|
+
j.current = null, At.current = c, G?.(c);
|
|
2598
2600
|
},
|
|
2599
|
-
[
|
|
2601
|
+
[L, i, G]
|
|
2600
2602
|
);
|
|
2601
2603
|
X(() => {
|
|
2602
|
-
const o =
|
|
2603
|
-
|
|
2604
|
-
renderingStartIndex:
|
|
2605
|
-
renderingEndIndex:
|
|
2606
|
-
visibleStartIndex:
|
|
2607
|
-
visibleEndIndex:
|
|
2608
|
-
scrollPositionState:
|
|
2604
|
+
const o = Y.current?.getScrollPosition() ?? 0, c = A.current, d = ee(c, R.top);
|
|
2605
|
+
N.debug("[VirtualScroll] Range change effect triggered", () => ({
|
|
2606
|
+
renderingStartIndex: Qt,
|
|
2607
|
+
renderingEndIndex: qt,
|
|
2608
|
+
visibleStartIndex: ne,
|
|
2609
|
+
visibleEndIndex: fe,
|
|
2610
|
+
scrollPositionState: _t,
|
|
2609
2611
|
paneScrollPosition: c,
|
|
2610
2612
|
logicalScrollPosition: d,
|
|
2611
|
-
contentSize:
|
|
2613
|
+
contentSize: T,
|
|
2612
2614
|
scrollPaneScrollPosition: o
|
|
2613
|
-
})),
|
|
2614
|
-
renderingStartIndex:
|
|
2615
|
-
renderingEndIndex:
|
|
2616
|
-
visibleStartIndex:
|
|
2617
|
-
visibleEndIndex:
|
|
2615
|
+
})), Et({
|
|
2616
|
+
renderingStartIndex: Qt,
|
|
2617
|
+
renderingEndIndex: qt,
|
|
2618
|
+
visibleStartIndex: ne,
|
|
2619
|
+
visibleEndIndex: fe,
|
|
2618
2620
|
scrollPosition: d,
|
|
2619
|
-
totalHeight:
|
|
2621
|
+
totalHeight: T
|
|
2620
2622
|
});
|
|
2621
|
-
}, [
|
|
2622
|
-
const Ve =
|
|
2623
|
+
}, [T, qt, Qt, R.top, Et, _t, fe, ne]);
|
|
2624
|
+
const Ve = S(() => C ? /* @__PURE__ */ Q("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": Ot && pt !== null, children: pt === "up" ? /* @__PURE__ */ Q("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ Q(
|
|
2623
2625
|
"button",
|
|
2624
2626
|
{
|
|
2625
2627
|
type: "button",
|
|
2626
2628
|
className: "aqvs-scroll-to-edge-button",
|
|
2627
2629
|
onClick: (d) => {
|
|
2628
|
-
d.stopPropagation(),
|
|
2630
|
+
d.stopPropagation(), Xt.current = !0, Bt(0), Rt(!1);
|
|
2629
2631
|
},
|
|
2630
2632
|
children: "Top"
|
|
2631
2633
|
}
|
|
2632
|
-
) }) : /* @__PURE__ */
|
|
2634
|
+
) }) : /* @__PURE__ */ Q("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-bottom", children: /* @__PURE__ */ Q(
|
|
2633
2635
|
"button",
|
|
2634
2636
|
{
|
|
2635
2637
|
type: "button",
|
|
2636
2638
|
className: "aqvs-scroll-to-edge-button",
|
|
2637
2639
|
onClick: (d) => {
|
|
2638
|
-
d.stopPropagation(),
|
|
2640
|
+
d.stopPropagation(), Xt.current = !0, Bt(i - 1), Rt(!1);
|
|
2639
2641
|
},
|
|
2640
2642
|
children: "Bottom"
|
|
2641
2643
|
}
|
|
2642
|
-
) }) }) : null, [
|
|
2644
|
+
) }) }) : null, [C, Ot, pt, Bt, i]), me = g(0), { visibleItems: pe, renderAnchor: a } = Nt(() => {
|
|
2643
2645
|
if (i === 0)
|
|
2644
2646
|
return {
|
|
2645
|
-
visibleItems: /* @__PURE__ */
|
|
2647
|
+
visibleItems: /* @__PURE__ */ Q("div", { className: "aqvs-no-items-container", children: /* @__PURE__ */ Q("div", { className: "aqvs-no-items-text", children: "No items" }) }),
|
|
2646
2648
|
renderAnchor: 0
|
|
2647
2649
|
};
|
|
2648
|
-
const o = dt(
|
|
2649
|
-
Number.isFinite(
|
|
2650
|
-
const
|
|
2651
|
-
let
|
|
2652
|
-
for (let
|
|
2653
|
-
if (
|
|
2654
|
-
|
|
2650
|
+
const o = dt(Qt, i), c = dt(qt, i), { cumulative: d, currentValue: y } = v.prefixSum(o, { materializeOption: { materialize: !1 } }), k = d - y;
|
|
2651
|
+
Number.isFinite(k) && Math.abs(k - me.current) > yr && (me.current = k);
|
|
2652
|
+
const E = me.current, q = [], $ = [];
|
|
2653
|
+
let at = 0, Z = k;
|
|
2654
|
+
for (let ot = o; ot <= c; ot++) {
|
|
2655
|
+
if ($.length >= $e) {
|
|
2656
|
+
N.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.", { cap: $e, safeRenderingStartIndex: o, safeRenderingEndIndex: c });
|
|
2655
2657
|
break;
|
|
2656
2658
|
}
|
|
2657
|
-
const
|
|
2658
|
-
|
|
2659
|
-
const
|
|
2660
|
-
|
|
2661
|
-
/* @__PURE__ */
|
|
2659
|
+
const Pt = r(ot), Tt = v.get(ot), yt = Pt - Tt;
|
|
2660
|
+
yt !== 0 && q.push({ index: ot, value: Pt });
|
|
2661
|
+
const le = Z + at, ie = e ? e(ot) : ot;
|
|
2662
|
+
$.push(
|
|
2663
|
+
/* @__PURE__ */ Q(
|
|
2662
2664
|
Cr,
|
|
2663
2665
|
{
|
|
2664
|
-
index:
|
|
2665
|
-
top:
|
|
2666
|
-
height:
|
|
2667
|
-
item: t(
|
|
2668
|
-
clipItemHeight:
|
|
2669
|
-
enableKeyboardNavigation:
|
|
2670
|
-
onKeyDown:
|
|
2671
|
-
onFocus:
|
|
2672
|
-
registerItemRef:
|
|
2666
|
+
index: ot,
|
|
2667
|
+
top: le - E,
|
|
2668
|
+
height: Pt,
|
|
2669
|
+
item: t(ot),
|
|
2670
|
+
clipItemHeight: ft,
|
|
2671
|
+
enableKeyboardNavigation: L,
|
|
2672
|
+
onKeyDown: we,
|
|
2673
|
+
onFocus: Re,
|
|
2674
|
+
registerItemRef: Dt,
|
|
2673
2675
|
children: I
|
|
2674
2676
|
},
|
|
2675
|
-
|
|
2677
|
+
ie
|
|
2676
2678
|
)
|
|
2677
|
-
),
|
|
2679
|
+
), at += yt, Z += Tt;
|
|
2678
2680
|
}
|
|
2679
|
-
return
|
|
2680
|
-
if (
|
|
2681
|
+
return q.length > 0 && Promise.resolve().then(() => {
|
|
2682
|
+
if (St.current)
|
|
2681
2683
|
return;
|
|
2682
|
-
let
|
|
2683
|
-
for (const
|
|
2684
|
-
if (
|
|
2685
|
-
const
|
|
2686
|
-
|
|
2684
|
+
let ot = 0;
|
|
2685
|
+
for (const yt of q)
|
|
2686
|
+
if (yt.index < ne) {
|
|
2687
|
+
const le = v.get(yt.index);
|
|
2688
|
+
ot += yt.value - le;
|
|
2687
2689
|
}
|
|
2688
|
-
const
|
|
2689
|
-
if (
|
|
2690
|
+
const Pt = v.updates(q);
|
|
2691
|
+
if (St.current || typeof Pt != "number")
|
|
2690
2692
|
return;
|
|
2691
|
-
|
|
2692
|
-
const
|
|
2693
|
-
if (
|
|
2694
|
-
const
|
|
2695
|
-
|
|
2696
|
-
} else
|
|
2697
|
-
}), { visibleItems:
|
|
2693
|
+
O(Pt), N.debug("[VirtualScroll] Updated heights for items", q, "New total height:", Pt);
|
|
2694
|
+
const Tt = Y.current?.getScrollPosition() ?? A.current;
|
|
2695
|
+
if (ot !== 0) {
|
|
2696
|
+
const yt = Tt + ot;
|
|
2697
|
+
Yt(yt), it(yt, { immediate: !0 }), N.debug("[VirtualScroll] Adjusted scroll for layout shift (auto update)", { from: Tt, to: yt, shiftAmount: ot });
|
|
2698
|
+
} else Tt !== A.current && it(Tt);
|
|
2699
|
+
}), { visibleItems: $, renderAnchor: E };
|
|
2698
2700
|
}, [
|
|
2699
2701
|
I,
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2702
|
+
ft,
|
|
2703
|
+
T,
|
|
2704
|
+
L,
|
|
2703
2705
|
i,
|
|
2704
|
-
|
|
2706
|
+
v,
|
|
2705
2707
|
t,
|
|
2706
2708
|
e,
|
|
2707
2709
|
r,
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2710
|
+
Re,
|
|
2711
|
+
we,
|
|
2712
|
+
Yt,
|
|
2713
|
+
Dt,
|
|
2714
|
+
qt,
|
|
2712
2715
|
Qt,
|
|
2713
|
-
Jt,
|
|
2714
2716
|
it,
|
|
2715
|
-
|
|
2716
|
-
]),
|
|
2717
|
+
ne
|
|
2718
|
+
]), h = S(
|
|
2717
2719
|
(o) => {
|
|
2718
|
-
const c = (
|
|
2719
|
-
if (
|
|
2720
|
+
const c = (D ?? 0) > 0, d = Math.abs(o - _t), y = c && d > 0.5 ? _t : o, k = ee(y, R.top);
|
|
2721
|
+
if (N.debug("[VirtualScroll] Rendering visible items", () => ({
|
|
2720
2722
|
currentScrollPosition: o,
|
|
2721
|
-
effectiveScrollPosition:
|
|
2722
|
-
renderingStartIndex:
|
|
2723
|
-
renderingEndIndex:
|
|
2723
|
+
effectiveScrollPosition: k,
|
|
2724
|
+
renderingStartIndex: Qt,
|
|
2725
|
+
renderingEndIndex: qt,
|
|
2724
2726
|
itemCount: i,
|
|
2725
2727
|
viewportSize: n,
|
|
2726
|
-
callbackThrottleMs:
|
|
2728
|
+
callbackThrottleMs: D,
|
|
2727
2729
|
diff: d,
|
|
2728
|
-
rawEffectiveScrollPosition:
|
|
2730
|
+
rawEffectiveScrollPosition: y
|
|
2729
2731
|
})), i === 0)
|
|
2730
|
-
return
|
|
2731
|
-
const
|
|
2732
|
+
return pe;
|
|
2733
|
+
const E = R.top + a - y, q = R.bottom > 0 ? /* @__PURE__ */ Q(
|
|
2732
2734
|
"div",
|
|
2733
2735
|
{
|
|
2734
2736
|
className: "aqvs-bottom-inset",
|
|
2735
2737
|
style: {
|
|
2736
2738
|
// ラッパー座標での bottom インセット位置 = コンテンツ総高さ (最終行の下端) - アンカー。
|
|
2737
|
-
top:
|
|
2739
|
+
top: v.getTotal() - a,
|
|
2738
2740
|
height: R.bottom
|
|
2739
2741
|
}
|
|
2740
2742
|
},
|
|
2741
2743
|
"virtualscroll-bottom-inset"
|
|
2742
2744
|
) : null;
|
|
2743
|
-
return
|
|
2744
|
-
containerTop:
|
|
2745
|
-
logicalScrollPosition:
|
|
2745
|
+
return N.debug("[VirtualScroll] Rendering items", () => ({
|
|
2746
|
+
containerTop: E,
|
|
2747
|
+
logicalScrollPosition: Jt,
|
|
2746
2748
|
resolvedInsets: R,
|
|
2747
|
-
effectiveScrollPosition:
|
|
2748
|
-
})), /* @__PURE__ */
|
|
2749
|
-
|
|
2750
|
-
|
|
2749
|
+
effectiveScrollPosition: k
|
|
2750
|
+
})), /* @__PURE__ */ ue("div", { className: "aqvs-items-wrapper", style: { top: 0, transform: `translateY(${E}px)`, willChange: "transform" }, children: [
|
|
2751
|
+
pe,
|
|
2752
|
+
q
|
|
2751
2753
|
] });
|
|
2752
2754
|
},
|
|
2753
|
-
[
|
|
2754
|
-
),
|
|
2755
|
+
[D, i, v, Jt, a, qt, Qt, R, _t, n, pe]
|
|
2756
|
+
), P = Nt(
|
|
2755
2757
|
() => ({
|
|
2756
|
-
renderingStartIndex:
|
|
2757
|
-
renderingEndIndex:
|
|
2758
|
-
visibleStartIndex:
|
|
2759
|
-
visibleEndIndex:
|
|
2760
|
-
scrollPosition:
|
|
2761
|
-
totalHeight:
|
|
2758
|
+
renderingStartIndex: re.renderingStartIndex,
|
|
2759
|
+
renderingEndIndex: re.renderingEndIndex,
|
|
2760
|
+
visibleStartIndex: re.visibleStartIndex,
|
|
2761
|
+
visibleEndIndex: re.visibleEndIndex,
|
|
2762
|
+
scrollPosition: Jt,
|
|
2763
|
+
totalHeight: v.getTotal()
|
|
2762
2764
|
// contentSize (State) ではなく最新値を反映
|
|
2763
2765
|
}),
|
|
2764
2766
|
// contentSize を依存に含めることで、updateItemSize/updates 等で木の総高さが変わった際に
|
|
2765
2767
|
// (fenwickTree は安定参照のため getTotal() の変化だけでは再計算されない) 総高さを再取得する。
|
|
2766
|
-
[
|
|
2768
|
+
[re, Jt, v, T]
|
|
2767
2769
|
);
|
|
2768
2770
|
X(() => {
|
|
2769
|
-
|
|
2770
|
-
}, [
|
|
2771
|
-
|
|
2771
|
+
W.current = P;
|
|
2772
|
+
}, [P]), ke(
|
|
2773
|
+
wt,
|
|
2772
2774
|
() => ({
|
|
2773
|
-
getScrollPosition: () =>
|
|
2774
|
-
getContentSize: () =>
|
|
2775
|
-
getViewportSize: () =>
|
|
2776
|
-
scrollTo:
|
|
2777
|
-
scrollToIndex:
|
|
2778
|
-
getFenwickTreeTotalHeight: () =>
|
|
2779
|
-
getFenwickSize: () =>
|
|
2775
|
+
getScrollPosition: () => Y.current?.getScrollPosition() ?? -1,
|
|
2776
|
+
getContentSize: () => Y.current?.getContentSize() ?? -1,
|
|
2777
|
+
getViewportSize: () => Y.current?.getViewportSize() ?? -1,
|
|
2778
|
+
scrollTo: ye,
|
|
2779
|
+
scrollToIndex: Bt,
|
|
2780
|
+
getFenwickTreeTotalHeight: () => v.getTotal(),
|
|
2781
|
+
getFenwickSize: () => v.getSize(),
|
|
2780
2782
|
focusItemAtIndex: te,
|
|
2781
|
-
getRange: () =>
|
|
2782
|
-
updateItemSize:
|
|
2783
|
+
getRange: () => W.current,
|
|
2784
|
+
updateItemSize: Ie
|
|
2783
2785
|
}),
|
|
2784
|
-
[
|
|
2786
|
+
[ye, Bt, v, te, Ie]
|
|
2785
2787
|
);
|
|
2786
|
-
const
|
|
2787
|
-
return /* @__PURE__ */
|
|
2788
|
+
const F = v.getTotal() + R.top + R.bottom;
|
|
2789
|
+
return /* @__PURE__ */ Q(
|
|
2788
2790
|
xr,
|
|
2789
2791
|
{
|
|
2790
|
-
ref:
|
|
2791
|
-
contentSize:
|
|
2792
|
+
ref: Y,
|
|
2793
|
+
contentSize: F,
|
|
2792
2794
|
viewportSize: n,
|
|
2793
2795
|
className: l,
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2796
|
+
testId: u,
|
|
2797
|
+
onScroll: ve,
|
|
2798
|
+
background: M,
|
|
2799
|
+
tapScrollCircleOptions: H,
|
|
2800
|
+
inertiaOptions: K,
|
|
2798
2801
|
itemCount: i,
|
|
2799
|
-
scrollBarWidth:
|
|
2800
|
-
enableThumbDrag:
|
|
2801
|
-
enableTrackClick:
|
|
2802
|
-
enableArrowButtons:
|
|
2803
|
-
enablePointerDrag:
|
|
2804
|
-
renderThumbOverlay:
|
|
2805
|
-
wheelSpeedMultiplier:
|
|
2806
|
-
onWheelHorizontal:
|
|
2802
|
+
scrollBarWidth: Vt,
|
|
2803
|
+
enableThumbDrag: z,
|
|
2804
|
+
enableTrackClick: B,
|
|
2805
|
+
enableArrowButtons: w,
|
|
2806
|
+
enablePointerDrag: tt,
|
|
2807
|
+
renderThumbOverlay: U,
|
|
2808
|
+
wheelSpeedMultiplier: b,
|
|
2809
|
+
onWheelHorizontal: st,
|
|
2807
2810
|
contentInsets: R,
|
|
2808
|
-
visibleStartIndex:
|
|
2809
|
-
visibleEndIndex:
|
|
2811
|
+
visibleStartIndex: ne,
|
|
2812
|
+
visibleEndIndex: fe,
|
|
2810
2813
|
renderOverlay: Ve,
|
|
2811
|
-
initialScrollPosition:
|
|
2812
|
-
children:
|
|
2814
|
+
initialScrollPosition: zt.position,
|
|
2815
|
+
children: h
|
|
2813
2816
|
}
|
|
2814
2817
|
);
|
|
2815
2818
|
}, _r = Fe(Er);
|
|
@@ -2818,7 +2821,7 @@ export {
|
|
|
2818
2821
|
br as ScrollBar,
|
|
2819
2822
|
xr as ScrollPane,
|
|
2820
2823
|
_r as VirtualScroll,
|
|
2821
|
-
|
|
2824
|
+
gt as minmax,
|
|
2822
2825
|
Dr as tapScrollCircleSampleVisual,
|
|
2823
2826
|
Tr as useFenwickMapTree,
|
|
2824
2827
|
Lr as useHeightCache,
|