@aiquants/virtualscroll 1.24.0 → 1.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -1
- package/README.md +16 -5
- package/dist/VirtualScroll.d.cts +25 -0
- package/dist/VirtualScroll.d.ts +25 -0
- package/dist/VirtualScroll.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1353 -1329
- package/package.json +1 -1
- package/src/VirtualScroll.tsx +101 -6
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as ot, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { twMerge as
|
|
4
|
-
class
|
|
1
|
+
import { jsx as ot, jsxs as Se, Fragment as tr } from "react/jsx-runtime";
|
|
2
|
+
import nr, { memo as ir, forwardRef as $e, useState as re, useRef as x, useCallback as S, useImperativeHandle as Ue, useMemo as Ft, useLayoutEffect as ye, useEffect as Y, useId as sr } from "react";
|
|
3
|
+
import { twMerge as Te } from "tailwind-merge";
|
|
4
|
+
class N {
|
|
5
5
|
level;
|
|
6
6
|
prefix;
|
|
7
7
|
impl;
|
|
@@ -11,10 +11,10 @@ class C {
|
|
|
11
11
|
* @param {string} [prefix="[virtualscroll]"] - The prefix to add to all log messages.
|
|
12
12
|
* @param {ILogger} [impl=console] - The implementation to use for logging.
|
|
13
13
|
*/
|
|
14
|
-
constructor(t = 2, e = "[virtualscroll]",
|
|
15
|
-
this.level = t, this.prefix = e, this.impl =
|
|
14
|
+
constructor(t = 2, e = "[virtualscroll]", n = console) {
|
|
15
|
+
this.level = t, this.prefix = e, this.impl = n;
|
|
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 C {
|
|
|
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 C {
|
|
|
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 C {
|
|
|
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 C {
|
|
|
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,49 +122,49 @@ class C {
|
|
|
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
|
-
const
|
|
149
|
+
const Ke = {
|
|
150
150
|
active: !1,
|
|
151
151
|
offsetX: 0,
|
|
152
152
|
offsetY: 0,
|
|
153
153
|
distance: 0,
|
|
154
154
|
direction: 0,
|
|
155
155
|
pointerId: null
|
|
156
|
-
},
|
|
157
|
-
const e = 1 + t * 0.18,
|
|
158
|
-
return /* @__PURE__ */
|
|
156
|
+
}, ze = 6, or = 8, ar = ({ dragState: r, normalizedDistance: t }) => {
|
|
157
|
+
const e = 1 + t * 0.18, n = 0.16 + t * 0.24, i = 0.38 + t * 0.28, s = r.active ? "80ms ease-out" : "220ms ease";
|
|
158
|
+
return /* @__PURE__ */ Se(tr, { children: [
|
|
159
159
|
/* @__PURE__ */ ot(
|
|
160
160
|
"div",
|
|
161
161
|
{
|
|
162
162
|
className: "aqvs-tap-scroll-circle-visual-outer",
|
|
163
163
|
style: {
|
|
164
164
|
background: "linear-gradient(140deg, rgba(255,255,255,0.62), rgba(72,72,72,0.48))",
|
|
165
|
-
boxShadow: `0 0 0 1px rgba(255,255,255,0.28), 0 10px 22px rgba(0,0,0,${
|
|
165
|
+
boxShadow: `0 0 0 1px rgba(255,255,255,0.28), 0 10px 22px rgba(0,0,0,${n})`,
|
|
166
166
|
transform: `scale(${e})`,
|
|
167
|
-
transition: `${s}, ${
|
|
167
|
+
transition: `${s}, ${r.active ? "80ms" : "260ms"} box-shadow ease`
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
),
|
|
@@ -176,159 +176,159 @@ const He = {
|
|
|
176
176
|
background: "linear-gradient(140deg, rgba(255,255,255,0.72), rgba(28,28,28,0.58))",
|
|
177
177
|
boxShadow: "inset 0 4px 10px rgba(0,0,0,0.24), inset 0 0 2px rgba(255,255,255,0.55)",
|
|
178
178
|
opacity: i,
|
|
179
|
-
transition:
|
|
179
|
+
transition: r.active ? "120ms opacity ease-out" : "220ms opacity ease"
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
)
|
|
183
183
|
] });
|
|
184
|
-
},
|
|
185
|
-
|
|
186
|
-
const [d, b] =
|
|
184
|
+
}, er = ir(
|
|
185
|
+
$e(({ onDragChange: r, className: t, maxVisualDistance: e = 160, size: n = 40, style: i, opacity: s = 1, renderVisual: a }, c) => {
|
|
186
|
+
const [d, b] = re(Ke), I = x(null), v = x(null), C = x({ x: 0, y: 0 }), p = x(null), V = x(0), z = S(
|
|
187
187
|
(T) => {
|
|
188
|
-
b(T),
|
|
188
|
+
b(T), r(T);
|
|
189
189
|
},
|
|
190
|
-
[
|
|
191
|
-
),
|
|
192
|
-
(T,
|
|
193
|
-
const { x:
|
|
194
|
-
let
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
active:
|
|
198
|
-
offsetX:
|
|
199
|
-
offsetY:
|
|
200
|
-
distance:
|
|
201
|
-
direction:
|
|
202
|
-
pointerId:
|
|
190
|
+
[r]
|
|
191
|
+
), W = S(
|
|
192
|
+
(T, q, H = !1) => {
|
|
193
|
+
const { x: Ht, y: Dt } = C.current, et = T - Ht, nt = q - Dt, G = Math.abs(nt), J = G < ze ? 0 : nt < 0 ? -1 : 1, Rt = V.current;
|
|
194
|
+
let Lt = J;
|
|
195
|
+
const Wt = ze + or;
|
|
196
|
+
J === 0 ? Rt !== 0 && G < Wt ? Lt = Rt : (Lt = 0, H || (V.current = 0)) : J !== Rt && Rt !== 0 && G < Wt ? Lt = Rt : V.current = J, z({
|
|
197
|
+
active: H || G >= ze,
|
|
198
|
+
offsetX: et,
|
|
199
|
+
offsetY: nt,
|
|
200
|
+
distance: G,
|
|
201
|
+
direction: Lt,
|
|
202
|
+
pointerId: I.current
|
|
203
203
|
});
|
|
204
204
|
},
|
|
205
|
-
[
|
|
206
|
-
),
|
|
205
|
+
[z]
|
|
206
|
+
), at = S((T) => {
|
|
207
207
|
if (T === null)
|
|
208
208
|
return;
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
}, []),
|
|
209
|
+
const q = p.current;
|
|
210
|
+
q?.hasPointerCapture(T) && q.releasePointerCapture(T);
|
|
211
|
+
}, []), Q = S(
|
|
212
212
|
(T = !1) => {
|
|
213
|
-
T &&
|
|
213
|
+
T && at(I.current), I.current = null, v.current = null, V.current = 0, z(Ke);
|
|
214
214
|
},
|
|
215
|
-
[
|
|
216
|
-
),
|
|
215
|
+
[z, at]
|
|
216
|
+
), tt = S(
|
|
217
217
|
(T) => {
|
|
218
|
-
if (
|
|
218
|
+
if (I.current !== null && I.current !== T.pointerId) {
|
|
219
219
|
v.current = { pointerId: T.pointerId, clientX: T.clientX, clientY: T.clientY }, T.preventDefault(), T.stopPropagation();
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
222
222
|
T.preventDefault(), T.stopPropagation();
|
|
223
|
-
const
|
|
224
|
-
|
|
223
|
+
const q = p.current ?? T.currentTarget, { left: H, top: Ht, width: Dt, height: et } = q.getBoundingClientRect();
|
|
224
|
+
C.current = { x: H + Dt / 2, y: Ht + et / 2 }, I.current = T.pointerId;
|
|
225
225
|
try {
|
|
226
|
-
|
|
226
|
+
q.setPointerCapture(T.pointerId);
|
|
227
227
|
} catch {
|
|
228
228
|
}
|
|
229
|
-
|
|
229
|
+
W(T.clientX, T.clientY, !0);
|
|
230
230
|
},
|
|
231
|
-
[
|
|
232
|
-
),
|
|
231
|
+
[W]
|
|
232
|
+
), xt = S(
|
|
233
233
|
(T) => {
|
|
234
|
-
if (
|
|
234
|
+
if (I.current !== T.pointerId) {
|
|
235
235
|
v.current !== null && v.current.pointerId === T.pointerId && (v.current = { pointerId: T.pointerId, clientX: T.clientX, clientY: T.clientY });
|
|
236
236
|
return;
|
|
237
237
|
}
|
|
238
|
-
T.preventDefault(),
|
|
238
|
+
T.preventDefault(), W(T.clientX, T.clientY);
|
|
239
239
|
},
|
|
240
|
-
[
|
|
241
|
-
),
|
|
240
|
+
[W]
|
|
241
|
+
), wt = S(
|
|
242
242
|
(T) => {
|
|
243
|
-
if (
|
|
243
|
+
if (I.current !== T.pointerId) {
|
|
244
244
|
v.current !== null && v.current.pointerId === T.pointerId && (v.current = null);
|
|
245
245
|
return;
|
|
246
246
|
}
|
|
247
247
|
T.preventDefault(), T.stopPropagation();
|
|
248
|
-
const
|
|
249
|
-
if (v.current = null,
|
|
250
|
-
|
|
251
|
-
const
|
|
252
|
-
let
|
|
253
|
-
if (
|
|
248
|
+
const q = v.current;
|
|
249
|
+
if (v.current = null, q !== null) {
|
|
250
|
+
at(T.pointerId);
|
|
251
|
+
const H = p.current;
|
|
252
|
+
let Ht = !0;
|
|
253
|
+
if (H !== null && typeof H.setPointerCapture == "function")
|
|
254
254
|
try {
|
|
255
|
-
|
|
256
|
-
} catch (
|
|
257
|
-
(typeof
|
|
255
|
+
H.setPointerCapture(q.pointerId);
|
|
256
|
+
} catch (Dt) {
|
|
257
|
+
(typeof Dt == "object" && Dt !== null && "name" in Dt ? Dt.name : void 0) === "NotFoundError" && (Ht = !1);
|
|
258
258
|
}
|
|
259
|
-
if (
|
|
260
|
-
|
|
259
|
+
if (Ht) {
|
|
260
|
+
I.current = q.pointerId, W(q.clientX, q.clientY, !0);
|
|
261
261
|
return;
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
|
-
|
|
264
|
+
Q(!0);
|
|
265
265
|
},
|
|
266
|
-
[
|
|
267
|
-
),
|
|
266
|
+
[Q, at, W]
|
|
267
|
+
), A = S(
|
|
268
268
|
(T) => {
|
|
269
|
-
T.target === T.currentTarget &&
|
|
269
|
+
T.target === T.currentTarget && I.current === T.pointerId && Q(!1);
|
|
270
270
|
},
|
|
271
|
-
[
|
|
271
|
+
[Q]
|
|
272
272
|
);
|
|
273
|
-
|
|
273
|
+
Ue(
|
|
274
274
|
c,
|
|
275
275
|
() => ({
|
|
276
276
|
reset: () => {
|
|
277
|
-
|
|
277
|
+
Q(!0);
|
|
278
278
|
},
|
|
279
|
-
getElement: () =>
|
|
279
|
+
getElement: () => p.current
|
|
280
280
|
}),
|
|
281
|
-
[
|
|
281
|
+
[Q]
|
|
282
282
|
);
|
|
283
|
-
const O = Math.min(Math.max(s, 0), 1),
|
|
283
|
+
const O = Math.min(Math.max(s, 0), 1), M = n / 64, U = Math.min(d.distance, e) / e, Z = d.direction * U * 10 * M, w = a ?? ar, lt = {
|
|
284
284
|
dragState: d,
|
|
285
|
-
normalizedDistance:
|
|
286
|
-
sizeScale:
|
|
287
|
-
size:
|
|
285
|
+
normalizedDistance: U,
|
|
286
|
+
sizeScale: M,
|
|
287
|
+
size: n,
|
|
288
288
|
opacity: O
|
|
289
|
-
},
|
|
289
|
+
}, j = {
|
|
290
290
|
...i,
|
|
291
|
-
width:
|
|
292
|
-
height:
|
|
293
|
-
transform: `translateY(${
|
|
291
|
+
width: n,
|
|
292
|
+
height: n,
|
|
293
|
+
transform: `translateY(${Z}px)`
|
|
294
294
|
};
|
|
295
|
-
return
|
|
295
|
+
return j.opacity = O, /* @__PURE__ */ ot(
|
|
296
296
|
"div",
|
|
297
297
|
{
|
|
298
|
-
ref:
|
|
298
|
+
ref: p,
|
|
299
299
|
"data-testid": "virtual-scroll-tap-circle",
|
|
300
|
-
className:
|
|
301
|
-
style:
|
|
300
|
+
className: Te("aqvs-tap-scroll-circle", t),
|
|
301
|
+
style: j,
|
|
302
302
|
tabIndex: -1,
|
|
303
|
-
onPointerDown:
|
|
304
|
-
onPointerMove:
|
|
305
|
-
onPointerUp:
|
|
306
|
-
onPointerCancel:
|
|
307
|
-
onLostPointerCapture:
|
|
303
|
+
onPointerDown: tt,
|
|
304
|
+
onPointerMove: xt,
|
|
305
|
+
onPointerUp: wt,
|
|
306
|
+
onPointerCancel: wt,
|
|
307
|
+
onLostPointerCapture: A,
|
|
308
308
|
role: "presentation",
|
|
309
|
-
children:
|
|
309
|
+
children: w(lt)
|
|
310
310
|
}
|
|
311
311
|
);
|
|
312
312
|
})
|
|
313
313
|
);
|
|
314
|
-
|
|
315
|
-
const
|
|
314
|
+
er.displayName = "TapScrollCircle";
|
|
315
|
+
const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scroll-cancel", We = 20, lr = 250, cr = 60, ur = 20, dr = 20, rr = {
|
|
316
316
|
/** 速度が最大に達する引き距離 (px)。`maxVisualDistance` の既定値。 */
|
|
317
317
|
maxDistance: 240,
|
|
318
318
|
/** 最小速度倍率 (ビューポート比)。 */
|
|
319
319
|
minSpeedMultiplier: 0.2
|
|
320
|
-
},
|
|
320
|
+
}, fr = rr.maxDistance, je = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, Ye = 2.2, mr = 8, pr = 120, hr = 1 / 10, te = {
|
|
321
321
|
enabled: !0,
|
|
322
322
|
size: 40,
|
|
323
323
|
offsetX: -80,
|
|
324
324
|
offsetY: 0,
|
|
325
325
|
className: void 0,
|
|
326
|
-
maxVisualDistance:
|
|
327
|
-
minSpeedMultiplier:
|
|
326
|
+
maxVisualDistance: fr,
|
|
327
|
+
minSpeedMultiplier: rr.minSpeedMultiplier,
|
|
328
328
|
opacity: 0.9,
|
|
329
329
|
renderVisual: void 0,
|
|
330
330
|
maxSpeedCurve: void 0
|
|
331
|
-
},
|
|
331
|
+
}, gr = (r) => r ? {
|
|
332
332
|
mainSizeKey: "width",
|
|
333
333
|
crossSizeKey: "height",
|
|
334
334
|
positionKey: "left",
|
|
@@ -348,319 +348,319 @@ const vt = (n, t, e) => Math.max(t, Math.min(e, n)), Ye = "virtualscroll:tap-scr
|
|
|
348
348
|
arrowIcons: ["▲", "▼"],
|
|
349
349
|
directionClass: "aqvs-scrollbar-vertical",
|
|
350
350
|
orientation: "vertical"
|
|
351
|
-
},
|
|
352
|
-
const e =
|
|
351
|
+
}, br = (r, t) => {
|
|
352
|
+
const e = r?.maxSpeedMultiplier, n = typeof e == "number" ? e : vr(t);
|
|
353
353
|
return {
|
|
354
|
-
enabled:
|
|
355
|
-
size:
|
|
356
|
-
offsetX:
|
|
357
|
-
offsetY:
|
|
358
|
-
className:
|
|
359
|
-
maxVisualDistance:
|
|
360
|
-
maxSpeedMultiplier:
|
|
361
|
-
minSpeedMultiplier: Math.max(
|
|
362
|
-
opacity:
|
|
363
|
-
renderVisual:
|
|
364
|
-
maxSpeedCurve:
|
|
354
|
+
enabled: r?.enabled ?? te.enabled,
|
|
355
|
+
size: r?.size ?? te.size,
|
|
356
|
+
offsetX: r?.offsetX ?? te.offsetX,
|
|
357
|
+
offsetY: r?.offsetY ?? te.offsetY,
|
|
358
|
+
className: r?.className ?? te.className,
|
|
359
|
+
maxVisualDistance: r?.maxVisualDistance ?? te.maxVisualDistance,
|
|
360
|
+
maxSpeedMultiplier: n,
|
|
361
|
+
minSpeedMultiplier: Math.max(r?.minSpeedMultiplier ?? te.minSpeedMultiplier, 0),
|
|
362
|
+
opacity: rt(r?.opacity ?? te.opacity, 0, 1),
|
|
363
|
+
renderVisual: r?.renderVisual ?? te.renderVisual,
|
|
364
|
+
maxSpeedCurve: r?.maxSpeedCurve ?? te.maxSpeedCurve
|
|
365
365
|
};
|
|
366
|
-
},
|
|
367
|
-
const i =
|
|
366
|
+
}, xr = ({ isDragging: r, isThumbHovered: t, enableThumbDrag: e }) => Ft(() => e ? r ? "dragging" : t ? "hover" : "idle" : "disabled", [e, r, t]), Ir = ({ canUseArrowButtons: r, enableArrowButtons: t, resetTapScroll: e, scrollByStep: n }) => {
|
|
367
|
+
const i = x(null), s = x(null), a = x(null), c = S(() => {
|
|
368
368
|
i.current !== null && (window.clearInterval(i.current), i.current = null), s.current !== null && (window.clearTimeout(s.current), s.current = null), a.current !== null && (window.removeEventListener("pointerup", a.current), window.removeEventListener("pointercancel", a.current), window.removeEventListener("blur", a.current), a.current = null);
|
|
369
369
|
}, []), d = S(() => {
|
|
370
370
|
c();
|
|
371
371
|
}, [c]), b = S(
|
|
372
|
-
(v) => (
|
|
373
|
-
if (!
|
|
372
|
+
(v) => (C) => {
|
|
373
|
+
if (!r)
|
|
374
374
|
return;
|
|
375
|
-
|
|
375
|
+
C.cancelable && C.preventDefault(), C.stopPropagation(), e(), c(), n(v), s.current = window.setTimeout(() => {
|
|
376
376
|
i.current = window.setInterval(() => {
|
|
377
|
-
|
|
378
|
-
},
|
|
379
|
-
},
|
|
380
|
-
const
|
|
381
|
-
a.current =
|
|
377
|
+
n(v);
|
|
378
|
+
}, cr);
|
|
379
|
+
}, lr);
|
|
380
|
+
const p = () => c();
|
|
381
|
+
a.current = p, window.addEventListener("pointerup", p), window.addEventListener("pointercancel", p), window.addEventListener("blur", p);
|
|
382
382
|
},
|
|
383
|
-
[
|
|
384
|
-
),
|
|
385
|
-
(v) => (
|
|
386
|
-
t && (
|
|
383
|
+
[r, c, e, n]
|
|
384
|
+
), I = S(
|
|
385
|
+
(v) => (C) => {
|
|
386
|
+
t && (C.key === "Enter" || C.key === " " || C.key === "Spacebar") && (C.preventDefault(), n(v));
|
|
387
387
|
},
|
|
388
|
-
[t,
|
|
388
|
+
[t, n]
|
|
389
389
|
);
|
|
390
|
-
return
|
|
391
|
-
|
|
392
|
-
}, [
|
|
390
|
+
return Y(() => {
|
|
391
|
+
r || c();
|
|
392
|
+
}, [r, c]), Y(() => () => {
|
|
393
393
|
c();
|
|
394
|
-
}, [c]), { handleArrowPointerDown: b, handleArrowPointerUp: d, handleArrowKeyDown:
|
|
395
|
-
},
|
|
396
|
-
const c = Math.max(
|
|
397
|
-
let
|
|
394
|
+
}, [c]), { handleArrowPointerDown: b, handleArrowPointerUp: d, handleArrowKeyDown: I };
|
|
395
|
+
}, Tr = 700, he = (r, t) => typeof r == "number" && Number.isFinite(r) ? r : t, Sr = ({ distance: r, maxDistance: t, viewportSize: e, minSpeedMultiplier: n, maxSpeedMultiplier: i, hasCustomMaxSpeedMultiplier: s, curve: a }) => {
|
|
396
|
+
const c = Math.max(he(r, 0), 0), d = he(t, 0), b = d > 0 ? Math.min(c, d) / d : 1, I = Math.max(he(e, 0), 0), v = Math.max(he(n, 0), 0), C = Math.max(he(i, 0), 0), p = Math.max(I * v, 40), V = s ? p : 1200, z = Math.max(I * C, V), W = a ? Math.max(he(a.exponentialScale, C), 0) : 0, at = a ? Math.min(z, Math.max(I * W, p)) : z, Q = Math.max(at, p);
|
|
397
|
+
let tt = b ** 1.1;
|
|
398
398
|
if (a) {
|
|
399
|
-
const
|
|
400
|
-
if (
|
|
401
|
-
|
|
399
|
+
const wt = Math.min(Math.max(he(a.exponentialSteepness, 0), 0), Tr);
|
|
400
|
+
if (wt === 0)
|
|
401
|
+
tt = b;
|
|
402
402
|
else {
|
|
403
|
-
const
|
|
404
|
-
|
|
403
|
+
const A = Math.expm1(wt) || 1;
|
|
404
|
+
tt = Math.min(Math.max(Math.expm1(wt * b) / A, 0), 1);
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
|
-
const
|
|
408
|
-
return
|
|
409
|
-
},
|
|
410
|
-
if (!
|
|
411
|
-
return
|
|
412
|
-
const t = Math.max(1,
|
|
413
|
-
return
|
|
414
|
-
},
|
|
415
|
-
contentSize:
|
|
407
|
+
const xt = Math.min(Math.max(he(a?.easedOffset, 0), 0), 1);
|
|
408
|
+
return p + (Q - p) * (xt + (1 - xt) * tt);
|
|
409
|
+
}, vr = (r) => {
|
|
410
|
+
if (!r || r <= 0)
|
|
411
|
+
return Ye;
|
|
412
|
+
const t = Math.max(1, r), e = Math.log10(t), n = Ye + e * mr;
|
|
413
|
+
return rt(n, Ye, pr);
|
|
414
|
+
}, Mr = ({
|
|
415
|
+
contentSize: r,
|
|
416
416
|
viewportSize: t,
|
|
417
417
|
scrollPosition: e,
|
|
418
|
-
onScroll:
|
|
418
|
+
onScroll: n,
|
|
419
419
|
enableThumbDrag: i = !0,
|
|
420
420
|
enableTrackClick: s = !0,
|
|
421
421
|
enableArrowButtons: a = !0,
|
|
422
422
|
horizontal: c = !1,
|
|
423
423
|
scrollBarWidth: d = 12,
|
|
424
424
|
className: b,
|
|
425
|
-
ariaControls:
|
|
425
|
+
ariaControls: I,
|
|
426
426
|
tapScrollCircleOptions: v,
|
|
427
|
-
itemCount:
|
|
428
|
-
renderThumbOverlay:
|
|
429
|
-
visibleStartIndex:
|
|
430
|
-
visibleEndIndex:
|
|
427
|
+
itemCount: C,
|
|
428
|
+
renderThumbOverlay: p,
|
|
429
|
+
visibleStartIndex: V,
|
|
430
|
+
visibleEndIndex: z
|
|
431
431
|
}) => {
|
|
432
|
-
const [
|
|
432
|
+
const [W, at] = re(!1), [Q, tt] = re(!1), [xt, wt] = re(!1), A = x(null), O = x({
|
|
433
433
|
pointerId: null,
|
|
434
434
|
startThumbPosition: 0,
|
|
435
435
|
startClientX: 0,
|
|
436
436
|
startClientY: 0,
|
|
437
437
|
scale: 1,
|
|
438
438
|
captureTarget: null
|
|
439
|
-
}),
|
|
440
|
-
enabled:
|
|
441
|
-
size:
|
|
442
|
-
offsetX:
|
|
443
|
-
offsetY:
|
|
444
|
-
className:
|
|
445
|
-
maxVisualDistance:
|
|
446
|
-
maxSpeedMultiplier:
|
|
447
|
-
minSpeedMultiplier:
|
|
448
|
-
opacity:
|
|
449
|
-
renderVisual:
|
|
450
|
-
maxSpeedCurve:
|
|
451
|
-
} =
|
|
439
|
+
}), M = x({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 }), U = x(e), Z = x(n), w = x(je), lt = x(null), j = x(null), T = x(null), q = x(0), H = x(0), Ht = Ft(() => br(v, C), [C, v]), Dt = Ft(() => gr(c), [c]), {
|
|
440
|
+
enabled: et,
|
|
441
|
+
size: nt,
|
|
442
|
+
offsetX: G,
|
|
443
|
+
offsetY: J,
|
|
444
|
+
className: Rt,
|
|
445
|
+
maxVisualDistance: Lt,
|
|
446
|
+
maxSpeedMultiplier: Wt,
|
|
447
|
+
minSpeedMultiplier: R,
|
|
448
|
+
opacity: de,
|
|
449
|
+
renderVisual: it,
|
|
450
|
+
maxSpeedCurve: E
|
|
451
|
+
} = Ht, Ct = x({
|
|
452
452
|
viewportSize: t,
|
|
453
|
-
maxScrollPosition: Math.max(
|
|
454
|
-
scrollBarVisible:
|
|
455
|
-
effectiveTapMaxDistance: Math.max(
|
|
456
|
-
tapCircleMaxSpeedMultiplier:
|
|
457
|
-
tapCircleMinSpeedMultiplier:
|
|
458
|
-
tapCircleMaxSpeedCurve:
|
|
453
|
+
maxScrollPosition: Math.max(r - t, 0),
|
|
454
|
+
scrollBarVisible: r > t,
|
|
455
|
+
effectiveTapMaxDistance: Math.max(Lt, 1),
|
|
456
|
+
tapCircleMaxSpeedMultiplier: Wt,
|
|
457
|
+
tapCircleMinSpeedMultiplier: R,
|
|
458
|
+
tapCircleMaxSpeedCurve: E,
|
|
459
459
|
tapScrollCircleOptions: v,
|
|
460
460
|
effectiveTrackLength: 0,
|
|
461
|
-
onScroll:
|
|
461
|
+
onScroll: n,
|
|
462
462
|
scrollPosition: e
|
|
463
|
-
}), { mainSizeKey:
|
|
464
|
-
|
|
465
|
-
|
|
463
|
+
}), { mainSizeKey: zt, crossSizeKey: Zt, positionKey: $t, selectDelta: h, getPointerCoordinate: k, arrowLabels: gt, arrowIcons: X, directionClass: vt, orientation: ct } = Dt, It = Math.max(Lt, 1), Mt = t / r, Pt = Math.max(t - d * 2, 0), ut = Mt * Pt, At = Math.min(Math.max(We, ut || 0), Pt || We), dt = r - t, st = Math.max(Pt - At, 0), _t = dt <= 0 || st <= 0 ? 0 : rt(e / dt * st, 0, st), Xt = _t + At / 2, Et = r > t || W, ne = Et && a;
|
|
464
|
+
ye(() => {
|
|
465
|
+
Ct.current = {
|
|
466
466
|
viewportSize: t,
|
|
467
|
-
maxScrollPosition:
|
|
468
|
-
scrollBarVisible:
|
|
469
|
-
effectiveTapMaxDistance:
|
|
470
|
-
tapCircleMaxSpeedMultiplier:
|
|
471
|
-
tapCircleMinSpeedMultiplier:
|
|
472
|
-
tapCircleMaxSpeedCurve:
|
|
467
|
+
maxScrollPosition: dt,
|
|
468
|
+
scrollBarVisible: Et,
|
|
469
|
+
effectiveTapMaxDistance: It,
|
|
470
|
+
tapCircleMaxSpeedMultiplier: Wt,
|
|
471
|
+
tapCircleMinSpeedMultiplier: R,
|
|
472
|
+
tapCircleMaxSpeedCurve: E,
|
|
473
473
|
tapScrollCircleOptions: v,
|
|
474
|
-
effectiveTrackLength:
|
|
475
|
-
onScroll:
|
|
474
|
+
effectiveTrackLength: st,
|
|
475
|
+
onScroll: n,
|
|
476
476
|
scrollPosition: e
|
|
477
477
|
};
|
|
478
|
-
}),
|
|
479
|
-
|
|
480
|
-
}, [e]),
|
|
481
|
-
|
|
482
|
-
}, [
|
|
483
|
-
i ||
|
|
478
|
+
}), ye(() => {
|
|
479
|
+
U.current = e;
|
|
480
|
+
}, [e]), ye(() => {
|
|
481
|
+
Z.current = n;
|
|
482
|
+
}, [n]), Y(() => {
|
|
483
|
+
i || tt(!1);
|
|
484
484
|
}, [i]);
|
|
485
|
-
const
|
|
486
|
-
const
|
|
487
|
-
if (
|
|
488
|
-
const
|
|
489
|
-
if (typeof
|
|
490
|
-
return
|
|
485
|
+
const jt = xr({ isDragging: W, isThumbHovered: Q, enableThumbDrag: i }), Nt = S((o, g) => {
|
|
486
|
+
const y = Ct.current, L = g ?? U.current;
|
|
487
|
+
if (Z.current) {
|
|
488
|
+
const Yt = Z.current(o, L);
|
|
489
|
+
if (typeof Yt == "number" && Number.isFinite(Yt))
|
|
490
|
+
return U.current = Yt, Yt;
|
|
491
491
|
}
|
|
492
|
-
const
|
|
493
|
-
return
|
|
492
|
+
const B = typeof o == "function" ? o(L) : o, bt = Math.max(y.maxScrollPosition, 0), Ot = y.scrollBarVisible ? rt(B, 0, bt) : 0;
|
|
493
|
+
return U.current = Ot, Ot;
|
|
494
494
|
}, []), f = S(
|
|
495
495
|
(o) => {
|
|
496
|
-
const g =
|
|
496
|
+
const g = Ct.current, y = U.current;
|
|
497
497
|
if (!g.scrollBarVisible || g.maxScrollPosition <= 0) {
|
|
498
|
-
const
|
|
499
|
-
return { nextPosition:
|
|
498
|
+
const ue = Nt(0, y), l = ue - y;
|
|
499
|
+
return { nextPosition: ue, actualDelta: l, reachedBoundary: !0 };
|
|
500
500
|
}
|
|
501
501
|
if (o === 0)
|
|
502
|
-
return { nextPosition:
|
|
503
|
-
const
|
|
504
|
-
return { nextPosition:
|
|
502
|
+
return { nextPosition: y, actualDelta: 0, reachedBoundary: !1 };
|
|
503
|
+
const B = Nt((ue) => rt(ue + o, 0, g.maxScrollPosition), y), bt = B - y, Ot = o < 0 && y + o <= 0, Yt = o > 0 && y + o >= g.maxScrollPosition, Me = o < 0 && (B <= 0 || Ot && bt === 0) || o > 0 && (B >= g.maxScrollPosition || Yt && bt === 0);
|
|
504
|
+
return { nextPosition: B, actualDelta: bt, reachedBoundary: Me };
|
|
505
505
|
},
|
|
506
|
-
[
|
|
507
|
-
),
|
|
506
|
+
[Nt]
|
|
507
|
+
), P = S(
|
|
508
508
|
(o, g) => {
|
|
509
509
|
o.current += g;
|
|
510
|
-
const
|
|
511
|
-
|
|
510
|
+
const y = Math.max(Ct.current.maxScrollPosition, 0);
|
|
511
|
+
y > 0 && (o.current = rt(o.current, -y, y));
|
|
512
512
|
const L = f(o.current);
|
|
513
513
|
return o.current -= L.actualDelta, L.reachedBoundary && (o.current = 0), L;
|
|
514
514
|
},
|
|
515
515
|
[f]
|
|
516
|
-
),
|
|
517
|
-
|
|
518
|
-
}, []),
|
|
519
|
-
|
|
520
|
-
}, [
|
|
516
|
+
), ft = S(() => {
|
|
517
|
+
j.current !== null && (window.cancelAnimationFrame(j.current), j.current = null), T.current = null, q.current = 0, H.current = 0;
|
|
518
|
+
}, []), Tt = S(() => {
|
|
519
|
+
w.current = { ...je }, wt(!1), lt.current?.reset(), ft();
|
|
520
|
+
}, [ft]), Vt = S(
|
|
521
521
|
(o) => {
|
|
522
|
-
const g =
|
|
522
|
+
const g = w.current, y = Ct.current;
|
|
523
523
|
if (!g.active || g.direction === 0) {
|
|
524
|
-
|
|
524
|
+
ft();
|
|
525
525
|
return;
|
|
526
526
|
}
|
|
527
|
-
if (!
|
|
528
|
-
|
|
527
|
+
if (!y.scrollBarVisible || y.maxScrollPosition <= 0) {
|
|
528
|
+
ft();
|
|
529
529
|
return;
|
|
530
530
|
}
|
|
531
|
-
const L = T.current ?? o,
|
|
532
|
-
if (T.current = o,
|
|
533
|
-
|
|
531
|
+
const L = T.current ?? o, B = Math.max((o - L) / 1e3, 0), bt = Math.min(B, hr);
|
|
532
|
+
if (T.current = o, bt <= 0) {
|
|
533
|
+
j.current = window.requestAnimationFrame(Vt);
|
|
534
534
|
return;
|
|
535
535
|
}
|
|
536
|
-
const
|
|
536
|
+
const Ot = Sr({
|
|
537
537
|
distance: g.distance,
|
|
538
|
-
maxDistance:
|
|
539
|
-
viewportSize:
|
|
540
|
-
minSpeedMultiplier:
|
|
541
|
-
maxSpeedMultiplier:
|
|
542
|
-
hasCustomMaxSpeedMultiplier: typeof
|
|
543
|
-
curve:
|
|
538
|
+
maxDistance: y.effectiveTapMaxDistance,
|
|
539
|
+
viewportSize: y.viewportSize,
|
|
540
|
+
minSpeedMultiplier: y.tapCircleMinSpeedMultiplier,
|
|
541
|
+
maxSpeedMultiplier: y.tapCircleMaxSpeedMultiplier,
|
|
542
|
+
hasCustomMaxSpeedMultiplier: typeof y.tapScrollCircleOptions?.maxSpeedMultiplier == "number",
|
|
543
|
+
curve: y.tapCircleMaxSpeedCurve
|
|
544
544
|
});
|
|
545
|
-
|
|
546
|
-
const { reachedBoundary:
|
|
547
|
-
if (
|
|
548
|
-
|
|
545
|
+
H.current !== g.direction && (H.current = g.direction, q.current = 0);
|
|
546
|
+
const { reachedBoundary: Yt } = P(q, g.direction * Ot * bt);
|
|
547
|
+
if (Yt) {
|
|
548
|
+
ft();
|
|
549
549
|
return;
|
|
550
550
|
}
|
|
551
|
-
|
|
551
|
+
j.current = window.requestAnimationFrame(Vt);
|
|
552
552
|
},
|
|
553
|
-
[
|
|
554
|
-
),
|
|
555
|
-
|
|
556
|
-
}, [
|
|
557
|
-
|
|
558
|
-
const o =
|
|
559
|
-
!o.active || o.direction === 0 ||
|
|
560
|
-
}, [
|
|
561
|
-
|
|
562
|
-
}, [
|
|
563
|
-
const
|
|
553
|
+
[P, ft]
|
|
554
|
+
), ie = S(() => {
|
|
555
|
+
j.current === null && (T.current = null, q.current = 0, j.current = window.requestAnimationFrame(Vt));
|
|
556
|
+
}, [Vt]);
|
|
557
|
+
Y(() => {
|
|
558
|
+
const o = w.current;
|
|
559
|
+
!o.active || o.direction === 0 || ie();
|
|
560
|
+
}, [r, t, ie]), Y(() => () => {
|
|
561
|
+
ft();
|
|
562
|
+
}, [ft]);
|
|
563
|
+
const Jt = S(
|
|
564
564
|
(o) => {
|
|
565
|
-
|
|
565
|
+
w.current = o, wt(o.active), o.active && o.direction !== 0 ? ie() : ft();
|
|
566
566
|
},
|
|
567
|
-
[
|
|
567
|
+
[ie, ft]
|
|
568
568
|
);
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
}, [
|
|
569
|
+
Y(() => {
|
|
570
|
+
et || Tt();
|
|
571
|
+
}, [Tt, et]), Y(() => {
|
|
572
572
|
const o = (g) => {
|
|
573
573
|
const L = g.detail?.paneId;
|
|
574
|
-
L &&
|
|
574
|
+
L && I && L !== I || Tt();
|
|
575
575
|
};
|
|
576
|
-
return window.addEventListener(
|
|
577
|
-
window.removeEventListener(
|
|
576
|
+
return window.addEventListener(Xe, o), () => {
|
|
577
|
+
window.removeEventListener(Xe, o);
|
|
578
578
|
};
|
|
579
|
-
}, [
|
|
580
|
-
if (!
|
|
579
|
+
}, [I, Tt]), Y(() => {
|
|
580
|
+
if (!et)
|
|
581
581
|
return;
|
|
582
582
|
const o = (g) => {
|
|
583
|
-
if (!
|
|
583
|
+
if (!w.current.active || w.current.pointerId === g.pointerId)
|
|
584
584
|
return;
|
|
585
|
-
const
|
|
586
|
-
if (!(
|
|
587
|
-
|
|
585
|
+
const y = g.target;
|
|
586
|
+
if (!(y instanceof Node)) {
|
|
587
|
+
Tt();
|
|
588
588
|
return;
|
|
589
589
|
}
|
|
590
|
-
lt.current?.getElement()?.contains(
|
|
590
|
+
lt.current?.getElement()?.contains(y) || Tt();
|
|
591
591
|
};
|
|
592
592
|
return document.addEventListener("pointerdown", o, !0), () => {
|
|
593
593
|
document.removeEventListener("pointerdown", o, !0);
|
|
594
594
|
};
|
|
595
|
-
}, [
|
|
596
|
-
const
|
|
597
|
-
if (!
|
|
595
|
+
}, [Tt, et]);
|
|
596
|
+
const Qt = (o) => {
|
|
597
|
+
if (!Et || st <= 0 || dt <= 0)
|
|
598
598
|
return 0;
|
|
599
|
-
const g =
|
|
600
|
-
return
|
|
601
|
-
},
|
|
602
|
-
const { scrollBarVisible: g, effectiveTrackLength:
|
|
603
|
-
if (
|
|
599
|
+
const g = rt(o, 0, st);
|
|
600
|
+
return rt(g / st * dt, 0, dt);
|
|
601
|
+
}, Kt = S((o) => {
|
|
602
|
+
const { scrollBarVisible: g, effectiveTrackLength: y, maxScrollPosition: L } = Ct.current;
|
|
603
|
+
if (N.debug("[ScrollBar] calculateScrollPositionFromThumb", () => ({ thumbPos: o, trackLen: y, maxScroll: L })), y <= 0 || L <= 0)
|
|
604
604
|
return null;
|
|
605
|
-
const
|
|
606
|
-
return
|
|
607
|
-
}, []),
|
|
605
|
+
const B = rt(o, 0, y);
|
|
606
|
+
return rt(B / y * L, 0, L);
|
|
607
|
+
}, []), se = S(
|
|
608
608
|
(o) => {
|
|
609
|
-
const g = o.getBoundingClientRect(),
|
|
610
|
-
const
|
|
611
|
-
return Number.isFinite(
|
|
612
|
-
},
|
|
613
|
-
return
|
|
609
|
+
const g = o.getBoundingClientRect(), y = c ? g.width : g.height, L = (Me) => {
|
|
610
|
+
const ue = Number.parseFloat(Me);
|
|
611
|
+
return Number.isFinite(ue) ? ue : 0;
|
|
612
|
+
}, B = window.getComputedStyle(o), bt = L(c ? B.width : B.height), Ot = bt > 0 ? bt + L(c ? B.paddingLeft : B.paddingTop) + L(c ? B.paddingRight : B.paddingBottom) + L(c ? B.borderLeftWidth : B.borderTopWidth) + L(c ? B.borderRightWidth : B.borderBottomWidth) : 0, Yt = Ot > 0 ? Ot : c ? o.offsetWidth : o.offsetHeight;
|
|
613
|
+
return Yt <= 0 || y <= 0 ? 1 : y / Yt;
|
|
614
614
|
},
|
|
615
615
|
[c]
|
|
616
|
-
),
|
|
616
|
+
), fe = S(
|
|
617
617
|
(o) => {
|
|
618
618
|
const g = O.current;
|
|
619
619
|
if (g.pointerId !== o.pointerId)
|
|
620
620
|
return;
|
|
621
|
-
const
|
|
622
|
-
|
|
623
|
-
delta:
|
|
621
|
+
const y = o.clientX - g.startClientX, L = o.clientY - g.startClientY, B = h(y, L) / (g.scale || 1);
|
|
622
|
+
N.debug("[ScrollBar] handleThumbPointerMove", () => ({
|
|
623
|
+
delta: B,
|
|
624
624
|
startThumbPosition: g.startThumbPosition,
|
|
625
625
|
clientY: o.clientY,
|
|
626
626
|
startClientY: g.startClientY,
|
|
627
|
-
metrics:
|
|
627
|
+
metrics: Ct.current
|
|
628
628
|
}));
|
|
629
|
-
const
|
|
630
|
-
|
|
629
|
+
const bt = Kt(g.startThumbPosition + B);
|
|
630
|
+
bt !== null && Nt(bt), o.cancelable && o.preventDefault();
|
|
631
631
|
},
|
|
632
|
-
[
|
|
633
|
-
),
|
|
632
|
+
[h, Kt, Nt]
|
|
633
|
+
), Gt = S(
|
|
634
634
|
(o) => {
|
|
635
635
|
const g = O.current;
|
|
636
636
|
if (g.pointerId !== o.pointerId)
|
|
637
637
|
return;
|
|
638
|
-
document.removeEventListener("pointermove",
|
|
639
|
-
const
|
|
640
|
-
if (
|
|
641
|
-
const L =
|
|
642
|
-
o.clientX >= L.left && o.clientX <= L.right && o.clientY >= L.top && o.clientY <= L.bottom ||
|
|
638
|
+
document.removeEventListener("pointermove", fe), document.removeEventListener("pointerup", Gt), document.removeEventListener("pointercancel", Gt);
|
|
639
|
+
const y = g.captureTarget;
|
|
640
|
+
if (y?.hasPointerCapture?.(o.pointerId) && y.releasePointerCapture(o.pointerId), O.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1, captureTarget: null }, at(!1), A.current) {
|
|
641
|
+
const L = A.current.getBoundingClientRect();
|
|
642
|
+
o.clientX >= L.left && o.clientX <= L.right && o.clientY >= L.top && o.clientY <= L.bottom || tt(!1);
|
|
643
643
|
} else
|
|
644
|
-
|
|
644
|
+
tt(!1);
|
|
645
645
|
},
|
|
646
|
-
[
|
|
646
|
+
[fe]
|
|
647
647
|
);
|
|
648
|
-
|
|
649
|
-
document.removeEventListener("pointermove",
|
|
650
|
-
}, [
|
|
651
|
-
const
|
|
648
|
+
Y(() => () => {
|
|
649
|
+
document.removeEventListener("pointermove", fe), document.removeEventListener("pointerup", Gt), document.removeEventListener("pointercancel", Gt);
|
|
650
|
+
}, [fe, Gt]);
|
|
651
|
+
const we = x(0), mt = x(0), me = S(
|
|
652
652
|
(o) => {
|
|
653
|
-
const g = Math.max(Math.round(
|
|
654
|
-
|
|
653
|
+
const g = Math.max(Math.round(Ct.current.viewportSize / dr), ur);
|
|
654
|
+
mt.current !== o && (mt.current = o, we.current = 0), P(we, o * g);
|
|
655
655
|
},
|
|
656
|
-
[
|
|
657
|
-
), { handleArrowPointerDown:
|
|
658
|
-
canUseArrowButtons:
|
|
656
|
+
[P]
|
|
657
|
+
), { handleArrowPointerDown: Ce, handleArrowPointerUp: ve, handleArrowKeyDown: Ut } = Ir({
|
|
658
|
+
canUseArrowButtons: ne,
|
|
659
659
|
enableArrowButtons: a,
|
|
660
|
-
resetTapScroll:
|
|
661
|
-
scrollByStep:
|
|
662
|
-
}),
|
|
663
|
-
if (!
|
|
660
|
+
resetTapScroll: Tt,
|
|
661
|
+
scrollByStep: me
|
|
662
|
+
}), Ve = (o) => {
|
|
663
|
+
if (!Et)
|
|
664
664
|
return;
|
|
665
665
|
if (!i) {
|
|
666
666
|
o.preventDefault(), o.stopPropagation();
|
|
@@ -668,8 +668,8 @@ const vt = (n, t, e) => Math.max(t, Math.min(e, n)), Ye = "virtualscroll:tap-scr
|
|
|
668
668
|
}
|
|
669
669
|
if (o.pointerType === "mouse" && o.button !== 0 || o.ctrlKey)
|
|
670
670
|
return;
|
|
671
|
-
|
|
672
|
-
const g = o.currentTarget,
|
|
671
|
+
Tt();
|
|
672
|
+
const g = o.currentTarget, y = se(g);
|
|
673
673
|
let L = null;
|
|
674
674
|
if (g.setPointerCapture)
|
|
675
675
|
try {
|
|
@@ -679,14 +679,14 @@ const vt = (n, t, e) => Math.max(t, Math.min(e, n)), Ye = "virtualscroll:tap-scr
|
|
|
679
679
|
}
|
|
680
680
|
O.current = {
|
|
681
681
|
pointerId: o.pointerId,
|
|
682
|
-
startThumbPosition:
|
|
682
|
+
startThumbPosition: _t,
|
|
683
683
|
startClientX: o.clientX,
|
|
684
684
|
startClientY: o.clientY,
|
|
685
|
-
scale:
|
|
685
|
+
scale: y,
|
|
686
686
|
captureTarget: L
|
|
687
|
-
}, document.addEventListener("pointermove",
|
|
688
|
-
},
|
|
689
|
-
if (!
|
|
687
|
+
}, document.addEventListener("pointermove", fe), document.addEventListener("pointerup", Gt), document.addEventListener("pointercancel", Gt), at(!0), tt(!0), o.preventDefault(), o.stopPropagation();
|
|
688
|
+
}, De = (o) => {
|
|
689
|
+
if (!Et)
|
|
690
690
|
return;
|
|
691
691
|
if (!s) {
|
|
692
692
|
o.preventDefault(), o.stopPropagation();
|
|
@@ -694,166 +694,166 @@ const vt = (n, t, e) => Math.max(t, Math.min(e, n)), Ye = "virtualscroll:tap-scr
|
|
|
694
694
|
}
|
|
695
695
|
if (o.pointerType === "mouse" && o.button !== 0 || o.ctrlKey)
|
|
696
696
|
return;
|
|
697
|
-
const g = o.currentTarget,
|
|
698
|
-
|
|
699
|
-
const
|
|
700
|
-
if (
|
|
697
|
+
const g = o.currentTarget, y = g.getBoundingClientRect(), L = k(o), B = se(g), bt = (L - (c ? y.left : y.top)) / B;
|
|
698
|
+
Tt();
|
|
699
|
+
const Ot = bt - At / 2, Yt = Qt(Ot);
|
|
700
|
+
if (Nt(Yt), g.setPointerCapture)
|
|
701
701
|
try {
|
|
702
702
|
g.setPointerCapture(o.pointerId);
|
|
703
703
|
} catch {
|
|
704
704
|
}
|
|
705
|
-
|
|
705
|
+
M.current = {
|
|
706
706
|
pointerId: o.pointerId,
|
|
707
|
-
startThumbPosition:
|
|
707
|
+
startThumbPosition: Ot,
|
|
708
708
|
startClientX: o.clientX,
|
|
709
709
|
startClientY: o.clientY,
|
|
710
|
-
scale:
|
|
710
|
+
scale: B
|
|
711
711
|
}, o.preventDefault(), o.stopPropagation();
|
|
712
|
-
},
|
|
713
|
-
|
|
714
|
-
},
|
|
715
|
-
const g =
|
|
712
|
+
}, be = () => {
|
|
713
|
+
M.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 };
|
|
714
|
+
}, Ae = (o) => {
|
|
715
|
+
const g = M.current;
|
|
716
716
|
if (g.pointerId !== o.pointerId)
|
|
717
717
|
return;
|
|
718
718
|
if (o.pointerType === "mouse" && o.buttons === 0) {
|
|
719
|
-
|
|
719
|
+
be();
|
|
720
720
|
return;
|
|
721
721
|
}
|
|
722
|
-
const
|
|
723
|
-
|
|
724
|
-
},
|
|
725
|
-
if (
|
|
722
|
+
const y = o.clientX - g.startClientX, L = o.clientY - g.startClientY, B = h(y, L) / (g.scale || 1), bt = Qt(g.startThumbPosition + B);
|
|
723
|
+
Nt(bt), o.cancelable && o.preventDefault();
|
|
724
|
+
}, ke = (o) => {
|
|
725
|
+
if (M.current.pointerId !== o.pointerId)
|
|
726
726
|
return;
|
|
727
727
|
const g = o.currentTarget;
|
|
728
|
-
g.hasPointerCapture?.(o.pointerId) && g.releasePointerCapture(o.pointerId),
|
|
729
|
-
},
|
|
730
|
-
if (
|
|
728
|
+
g.hasPointerCapture?.(o.pointerId) && g.releasePointerCapture(o.pointerId), be(), o.preventDefault(), o.stopPropagation();
|
|
729
|
+
}, oe = (o) => {
|
|
730
|
+
if (M.current.pointerId !== o.pointerId)
|
|
731
731
|
return;
|
|
732
732
|
const g = o.currentTarget;
|
|
733
|
-
g.hasPointerCapture?.(o.pointerId) && g.releasePointerCapture(o.pointerId),
|
|
734
|
-
},
|
|
735
|
-
o.target === o.currentTarget &&
|
|
736
|
-
},
|
|
737
|
-
const g = `calc(50% - ${
|
|
733
|
+
g.hasPointerCapture?.(o.pointerId) && g.releasePointerCapture(o.pointerId), be();
|
|
734
|
+
}, pe = (o) => {
|
|
735
|
+
o.target === o.currentTarget && M.current.pointerId === o.pointerId && be();
|
|
736
|
+
}, ae = Ft(() => rt((xt ? 1 : 0.8) * de, 0, 1), [xt, de]), le = Ft(() => {
|
|
737
|
+
const g = `calc(50% - ${nt / 2}px + ${J}px)`;
|
|
738
738
|
return {
|
|
739
|
-
left:
|
|
739
|
+
left: G,
|
|
740
740
|
top: g
|
|
741
741
|
};
|
|
742
|
-
}, [
|
|
742
|
+
}, [G, J, nt]), ce = (o, g, y, L) => /* @__PURE__ */ ot(
|
|
743
743
|
"button",
|
|
744
744
|
{
|
|
745
745
|
type: "button",
|
|
746
746
|
tabIndex: 0,
|
|
747
747
|
className: "aqvs-scrollbar-arrow-button",
|
|
748
748
|
style: {
|
|
749
|
-
[
|
|
750
|
-
[
|
|
749
|
+
[zt]: d,
|
|
750
|
+
[Zt]: d
|
|
751
751
|
},
|
|
752
752
|
"aria-label": g,
|
|
753
|
-
onPointerDown:
|
|
754
|
-
onPointerUp:
|
|
755
|
-
onPointerLeave:
|
|
756
|
-
onPointerCancel:
|
|
757
|
-
onKeyDown:
|
|
753
|
+
onPointerDown: Ce(o),
|
|
754
|
+
onPointerUp: ve,
|
|
755
|
+
onPointerLeave: ve,
|
|
756
|
+
onPointerCancel: ve,
|
|
757
|
+
onKeyDown: Ut(o),
|
|
758
758
|
"aria-disabled": !a,
|
|
759
|
-
disabled:
|
|
760
|
-
children: /* @__PURE__ */ ot("span", { "aria-hidden": "true", children:
|
|
759
|
+
disabled: !ne,
|
|
760
|
+
children: /* @__PURE__ */ ot("span", { "aria-hidden": "true", children: y })
|
|
761
761
|
},
|
|
762
762
|
L
|
|
763
|
-
),
|
|
763
|
+
), xe = p && Et ? {
|
|
764
764
|
orientation: ct,
|
|
765
765
|
scrollPosition: e,
|
|
766
|
-
maxScrollPosition:
|
|
767
|
-
contentSize:
|
|
766
|
+
maxScrollPosition: dt,
|
|
767
|
+
contentSize: r,
|
|
768
768
|
viewportSize: t,
|
|
769
|
-
thumbSize:
|
|
770
|
-
thumbPosition:
|
|
771
|
-
thumbCenter:
|
|
772
|
-
trackSize:
|
|
773
|
-
isDragging:
|
|
774
|
-
isTapScrollActive:
|
|
775
|
-
visibleStartIndex:
|
|
776
|
-
visibleEndIndex:
|
|
769
|
+
thumbSize: At,
|
|
770
|
+
thumbPosition: _t,
|
|
771
|
+
thumbCenter: Xt,
|
|
772
|
+
trackSize: Pt,
|
|
773
|
+
isDragging: W,
|
|
774
|
+
isTapScrollActive: xt,
|
|
775
|
+
visibleStartIndex: V,
|
|
776
|
+
visibleEndIndex: z
|
|
777
777
|
} : null;
|
|
778
|
-
return /* @__PURE__ */
|
|
778
|
+
return /* @__PURE__ */ Se(
|
|
779
779
|
"div",
|
|
780
780
|
{
|
|
781
|
-
className:
|
|
781
|
+
className: Te("aqvs-scrollbar", vt, !Et && "pointer-events-none opacity-0", b),
|
|
782
782
|
style: {
|
|
783
|
-
[
|
|
784
|
-
[
|
|
783
|
+
[zt]: t,
|
|
784
|
+
[Zt]: d
|
|
785
785
|
},
|
|
786
786
|
role: "scrollbar",
|
|
787
787
|
tabIndex: -1,
|
|
788
|
-
"aria-controls":
|
|
788
|
+
"aria-controls": I,
|
|
789
789
|
"aria-valuenow": e,
|
|
790
790
|
"aria-valuemin": 0,
|
|
791
|
-
"aria-valuemax":
|
|
791
|
+
"aria-valuemax": dt,
|
|
792
792
|
"aria-orientation": c ? "horizontal" : "vertical",
|
|
793
793
|
children: [
|
|
794
|
-
!c &&
|
|
795
|
-
|
|
794
|
+
!c && Et && et && /* @__PURE__ */ ot(
|
|
795
|
+
er,
|
|
796
796
|
{
|
|
797
797
|
ref: lt,
|
|
798
|
-
className:
|
|
799
|
-
size:
|
|
800
|
-
maxVisualDistance:
|
|
801
|
-
style:
|
|
802
|
-
opacity:
|
|
803
|
-
renderVisual:
|
|
804
|
-
onDragChange:
|
|
798
|
+
className: Te("aqvs-scrollbar-tap-circle-wrapper", Rt),
|
|
799
|
+
size: nt,
|
|
800
|
+
maxVisualDistance: It,
|
|
801
|
+
style: le,
|
|
802
|
+
opacity: ae,
|
|
803
|
+
renderVisual: it,
|
|
804
|
+
onDragChange: Jt
|
|
805
805
|
},
|
|
806
806
|
"tap-circle"
|
|
807
807
|
),
|
|
808
|
-
|
|
809
|
-
/* @__PURE__ */
|
|
808
|
+
ce(-1, gt[0], X[0], "arrow-start"),
|
|
809
|
+
/* @__PURE__ */ Se(
|
|
810
810
|
"div",
|
|
811
811
|
{
|
|
812
812
|
className: "aqvs-scrollbar-track",
|
|
813
813
|
style: {
|
|
814
814
|
borderRadius: d / 2
|
|
815
815
|
},
|
|
816
|
-
onPointerDown:
|
|
817
|
-
onPointerMove:
|
|
818
|
-
onPointerUp:
|
|
819
|
-
onPointerCancel:
|
|
820
|
-
onLostPointerCapture:
|
|
816
|
+
onPointerDown: De,
|
|
817
|
+
onPointerMove: Ae,
|
|
818
|
+
onPointerUp: ke,
|
|
819
|
+
onPointerCancel: oe,
|
|
820
|
+
onLostPointerCapture: pe,
|
|
821
821
|
"aria-disabled": !s,
|
|
822
822
|
children: [
|
|
823
|
-
|
|
823
|
+
xe && /* @__PURE__ */ ot("div", { className: "aqvs-scrollbar-overlay", "aria-hidden": !0, children: p?.(xe) }, "overlay"),
|
|
824
824
|
/* @__PURE__ */ ot(
|
|
825
825
|
"div",
|
|
826
826
|
{
|
|
827
|
-
className:
|
|
827
|
+
className: Te("aqvs-scrollbar-thumb-wrapper", !(Et || W) && "pointer-events-none opacity-0"),
|
|
828
828
|
style: {
|
|
829
|
-
[
|
|
830
|
-
[
|
|
829
|
+
[zt]: At,
|
|
830
|
+
[$t]: _t,
|
|
831
831
|
...c ? { top: 0, bottom: 0 } : { left: 0, right: 0 }
|
|
832
832
|
},
|
|
833
|
-
onPointerDown:
|
|
833
|
+
onPointerDown: Ve,
|
|
834
834
|
role: "slider",
|
|
835
835
|
"aria-orientation": c ? "horizontal" : "vertical",
|
|
836
836
|
"aria-valuenow": e,
|
|
837
837
|
"aria-valuemin": 0,
|
|
838
|
-
"aria-valuemax":
|
|
838
|
+
"aria-valuemax": dt,
|
|
839
839
|
"aria-disabled": !i,
|
|
840
840
|
tabIndex: -1,
|
|
841
841
|
children: /* @__PURE__ */ ot(
|
|
842
842
|
"div",
|
|
843
843
|
{
|
|
844
|
-
ref:
|
|
845
|
-
className:
|
|
844
|
+
ref: A,
|
|
845
|
+
className: Te("aqvs-scrollbar-thumb", c ? "aqvs-scrollbar-thumb-horizontal" : "aqvs-scrollbar-thumb-vertical"),
|
|
846
846
|
"data-testid": "aqvs-scrollbar-thumb",
|
|
847
|
-
"data-thumb-state":
|
|
847
|
+
"data-thumb-state": jt,
|
|
848
848
|
style: {
|
|
849
849
|
borderRadius: d - 1,
|
|
850
850
|
cursor: i ? "pointer" : "default"
|
|
851
851
|
},
|
|
852
852
|
onMouseEnter: () => {
|
|
853
|
-
i &&
|
|
853
|
+
i && tt(!0);
|
|
854
854
|
},
|
|
855
855
|
onMouseLeave: () => {
|
|
856
|
-
i &&
|
|
856
|
+
i && tt(!1);
|
|
857
857
|
}
|
|
858
858
|
},
|
|
859
859
|
"thumb"
|
|
@@ -865,202 +865,202 @@ const vt = (n, t, e) => Math.max(t, Math.min(e, n)), Ye = "virtualscroll:tap-scr
|
|
|
865
865
|
},
|
|
866
866
|
"track"
|
|
867
867
|
),
|
|
868
|
-
|
|
868
|
+
ce(1, gt[1], X[1], "arrow-end")
|
|
869
869
|
]
|
|
870
870
|
}
|
|
871
871
|
);
|
|
872
|
-
},
|
|
872
|
+
}, Pr = ["mouse", "pen", "touch"], Be = (r, t) => !(r === "mouse" || r === "pen" || r === "touch") || t.includes(r), yr = (r) => r === "mouse" || r === "pen", Ee = {
|
|
873
873
|
maxVelocity: 6,
|
|
874
874
|
minVelocity: 0.02,
|
|
875
875
|
deceleration: 25e-4,
|
|
876
876
|
velocitySampleWindow: 90,
|
|
877
877
|
startVelocityThreshold: 0.04
|
|
878
|
-
},
|
|
879
|
-
for (const [
|
|
880
|
-
e === "add" ?
|
|
881
|
-
},
|
|
878
|
+
}, Le = (r, t, e) => {
|
|
879
|
+
for (const [n, i, s] of t)
|
|
880
|
+
e === "add" ? r.addEventListener(n, i, s) : r.removeEventListener(n, i, s);
|
|
881
|
+
}, wr = $e(
|
|
882
882
|
({
|
|
883
|
-
children:
|
|
883
|
+
children: r,
|
|
884
884
|
contentSize: t,
|
|
885
885
|
viewportSize: e,
|
|
886
|
-
scrollBarWidth:
|
|
886
|
+
scrollBarWidth: n = 12,
|
|
887
887
|
enableThumbDrag: i = !0,
|
|
888
888
|
enableTrackClick: s = !0,
|
|
889
889
|
enableArrowButtons: a = !0,
|
|
890
890
|
enablePointerDrag: c = !0,
|
|
891
|
-
pointerDragInputs: d =
|
|
891
|
+
pointerDragInputs: d = Pr,
|
|
892
892
|
onScroll: b,
|
|
893
|
-
className:
|
|
893
|
+
className: I,
|
|
894
894
|
testId: v,
|
|
895
|
-
style:
|
|
896
|
-
background:
|
|
897
|
-
tapScrollCircleOptions:
|
|
898
|
-
inertiaOptions:
|
|
899
|
-
itemCount:
|
|
900
|
-
renderThumbOverlay:
|
|
901
|
-
wheelSpeedMultiplier:
|
|
902
|
-
onWheelHorizontal:
|
|
903
|
-
contentInsets:
|
|
904
|
-
visibleStartIndex:
|
|
905
|
-
visibleEndIndex:
|
|
895
|
+
style: C,
|
|
896
|
+
background: p,
|
|
897
|
+
tapScrollCircleOptions: V,
|
|
898
|
+
inertiaOptions: z,
|
|
899
|
+
itemCount: W,
|
|
900
|
+
renderThumbOverlay: at,
|
|
901
|
+
wheelSpeedMultiplier: Q = 1,
|
|
902
|
+
onWheelHorizontal: tt,
|
|
903
|
+
contentInsets: xt,
|
|
904
|
+
visibleStartIndex: wt,
|
|
905
|
+
visibleEndIndex: A,
|
|
906
906
|
renderOverlay: O,
|
|
907
|
-
initialScrollPosition:
|
|
908
|
-
contentProps:
|
|
909
|
-
},
|
|
910
|
-
const
|
|
911
|
-
|
|
912
|
-
T.current =
|
|
913
|
-
}, [
|
|
914
|
-
const
|
|
907
|
+
initialScrollPosition: M = 0,
|
|
908
|
+
contentProps: U
|
|
909
|
+
}, Z) => {
|
|
910
|
+
const w = x(Number.isFinite(M) ? Math.max(0, M) : 0), lt = x(null), j = x(null), T = x(tt);
|
|
911
|
+
Y(() => {
|
|
912
|
+
T.current = tt;
|
|
913
|
+
}, [tt]);
|
|
914
|
+
const q = x({
|
|
915
915
|
frame: null,
|
|
916
916
|
velocity: 0,
|
|
917
917
|
lastTimestamp: null,
|
|
918
918
|
generation: 0
|
|
919
|
-
}),
|
|
919
|
+
}), H = Ft(
|
|
920
920
|
() => ({
|
|
921
|
-
maxVelocity:
|
|
922
|
-
minVelocity:
|
|
923
|
-
deceleration:
|
|
924
|
-
velocitySampleWindow:
|
|
925
|
-
startVelocityThreshold:
|
|
921
|
+
maxVelocity: z?.maxVelocity ?? Ee.maxVelocity,
|
|
922
|
+
minVelocity: z?.minVelocity ?? Ee.minVelocity,
|
|
923
|
+
deceleration: z?.deceleration ?? Ee.deceleration,
|
|
924
|
+
velocitySampleWindow: z?.velocitySampleWindow ?? Ee.velocitySampleWindow,
|
|
925
|
+
startVelocityThreshold: z?.startVelocityThreshold ?? Ee.startVelocityThreshold
|
|
926
926
|
}),
|
|
927
|
-
[
|
|
928
|
-
),
|
|
929
|
-
top: Math.max(0,
|
|
930
|
-
bottom: Math.max(0,
|
|
931
|
-
}), [
|
|
932
|
-
|
|
927
|
+
[z]
|
|
928
|
+
), Ht = Ft(() => ({
|
|
929
|
+
top: Math.max(0, xt?.top ?? 0),
|
|
930
|
+
bottom: Math.max(0, xt?.bottom ?? 0)
|
|
931
|
+
}), [xt]);
|
|
932
|
+
N.debug("[ScrollPane] ScrollPane rendered", () => ({
|
|
933
933
|
contentSize: t,
|
|
934
934
|
viewportSize: e,
|
|
935
|
-
scrollBarWidth:
|
|
936
|
-
className:
|
|
937
|
-
style:
|
|
938
|
-
tapScrollCircleOptions:
|
|
939
|
-
inertiaOptions:
|
|
935
|
+
scrollBarWidth: n,
|
|
936
|
+
className: I,
|
|
937
|
+
style: C,
|
|
938
|
+
tapScrollCircleOptions: V,
|
|
939
|
+
inertiaOptions: z,
|
|
940
940
|
enablePointerDrag: c,
|
|
941
|
-
contentInsets:
|
|
941
|
+
contentInsets: Ht
|
|
942
942
|
}));
|
|
943
|
-
const
|
|
944
|
-
|
|
945
|
-
const
|
|
946
|
-
(
|
|
947
|
-
const { contentSize:
|
|
948
|
-
if (
|
|
949
|
-
return
|
|
950
|
-
const ct = typeof
|
|
943
|
+
const Dt = x({ contentSize: t, viewportSize: e });
|
|
944
|
+
Dt.current = { contentSize: t, viewportSize: e };
|
|
945
|
+
const et = Ft(() => t > e, [t, e]), nt = S(
|
|
946
|
+
(h) => {
|
|
947
|
+
const { contentSize: k, viewportSize: gt } = Dt.current, X = k > gt, vt = w.current;
|
|
948
|
+
if (N.debug("[ScrollPane] scrollTo called", () => ({ newPosition: h, contentSize: k, viewportSize: gt, currentIsScrollable: X, prevPosition: vt })), !X)
|
|
949
|
+
return w.current !== 0 && (w.current = 0, b?.(0, vt)), w.current;
|
|
950
|
+
const ct = typeof h == "function" ? h(w.current) : h;
|
|
951
951
|
if (!Number.isFinite(ct))
|
|
952
|
-
return
|
|
953
|
-
const
|
|
954
|
-
return
|
|
952
|
+
return N.warn("[ScrollPane] scrollTo received a non-finite position; keeping the current position", { nextPosition: ct }), w.current;
|
|
953
|
+
const It = Math.max(k - gt, 0), Mt = rt(ct, 0, It);
|
|
954
|
+
return w.current !== Mt && (w.current = Mt, b?.(Mt, vt)), w.current;
|
|
955
955
|
},
|
|
956
956
|
[b]
|
|
957
|
-
),
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
}, [
|
|
961
|
-
const
|
|
962
|
-
const
|
|
963
|
-
|
|
964
|
-
}, []),
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
}, [
|
|
968
|
-
|
|
957
|
+
), G = x(nt);
|
|
958
|
+
Y(() => {
|
|
959
|
+
G.current = nt;
|
|
960
|
+
}, [nt]);
|
|
961
|
+
const J = S(() => {
|
|
962
|
+
const h = q.current;
|
|
963
|
+
h.generation += 1, h.frame !== null && cancelAnimationFrame(h.frame), h.frame = null, h.velocity = 0, h.lastTimestamp = null;
|
|
964
|
+
}, []), Rt = x(J);
|
|
965
|
+
Y(() => {
|
|
966
|
+
Rt.current = J;
|
|
967
|
+
}, [J]), Y(() => () => {
|
|
968
|
+
Rt.current();
|
|
969
969
|
}, []);
|
|
970
|
-
const
|
|
971
|
-
(
|
|
972
|
-
if (!
|
|
970
|
+
const Lt = S(
|
|
971
|
+
(h) => {
|
|
972
|
+
if (!et)
|
|
973
973
|
return;
|
|
974
|
-
const { maxVelocity:
|
|
975
|
-
if (Math.abs(ct) <
|
|
974
|
+
const { maxVelocity: k, minVelocity: gt, deceleration: X, startVelocityThreshold: vt } = H, ct = rt(h, -k, k);
|
|
975
|
+
if (Math.abs(ct) < vt)
|
|
976
976
|
return;
|
|
977
|
-
|
|
978
|
-
const
|
|
979
|
-
const
|
|
980
|
-
if (
|
|
977
|
+
J(), q.current.velocity = ct, q.current.lastTimestamp = null;
|
|
978
|
+
const It = q.current.generation, Mt = (Pt) => {
|
|
979
|
+
const ut = q.current;
|
|
980
|
+
if (ut.generation !== It)
|
|
981
981
|
return;
|
|
982
|
-
if (
|
|
983
|
-
|
|
982
|
+
if (ut.lastTimestamp === null) {
|
|
983
|
+
ut.lastTimestamp = Pt, ut.frame = requestAnimationFrame(Mt);
|
|
984
984
|
return;
|
|
985
985
|
}
|
|
986
|
-
const
|
|
987
|
-
if (
|
|
988
|
-
|
|
986
|
+
const At = Pt - ut.lastTimestamp;
|
|
987
|
+
if (ut.lastTimestamp = Pt, At <= 0) {
|
|
988
|
+
ut.frame = requestAnimationFrame(Mt);
|
|
989
989
|
return;
|
|
990
990
|
}
|
|
991
|
-
const
|
|
992
|
-
let
|
|
993
|
-
const
|
|
994
|
-
|
|
995
|
-
const
|
|
996
|
-
if (
|
|
991
|
+
const dt = ut.velocity;
|
|
992
|
+
let st = dt;
|
|
993
|
+
const _t = X * At;
|
|
994
|
+
dt > 0 ? st = Math.max(0, dt - _t) : dt < 0 && (st = Math.min(0, dt + _t));
|
|
995
|
+
const Et = (dt + st) / 2 * At, ne = w.current;
|
|
996
|
+
if (Et !== 0 && G.current((Tt) => Tt + Et), q.current.generation !== It)
|
|
997
997
|
return;
|
|
998
|
-
const
|
|
999
|
-
|
|
1000
|
-
const
|
|
1001
|
-
if (Math.abs(
|
|
1002
|
-
|
|
998
|
+
const jt = w.current, { contentSize: Nt, viewportSize: f } = Dt.current, P = Math.max(Nt - f, 0);
|
|
999
|
+
ut.velocity = st;
|
|
1000
|
+
const ft = jt === ne || jt <= 0 && st <= 0 || jt >= P && st >= 0;
|
|
1001
|
+
if (Math.abs(st) < gt || ft) {
|
|
1002
|
+
J();
|
|
1003
1003
|
return;
|
|
1004
1004
|
}
|
|
1005
|
-
|
|
1005
|
+
ut.frame = requestAnimationFrame(Mt);
|
|
1006
1006
|
};
|
|
1007
|
-
|
|
1007
|
+
q.current.frame = requestAnimationFrame(Mt);
|
|
1008
1008
|
},
|
|
1009
|
-
[
|
|
1010
|
-
),
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
}, [
|
|
1014
|
-
|
|
1015
|
-
}, [t, e]),
|
|
1016
|
-
const
|
|
1017
|
-
if (!
|
|
1018
|
-
const
|
|
1019
|
-
|
|
1009
|
+
[et, H, J]
|
|
1010
|
+
), Wt = x(Lt);
|
|
1011
|
+
Y(() => {
|
|
1012
|
+
Wt.current = Lt;
|
|
1013
|
+
}, [Lt]), ye(() => {
|
|
1014
|
+
Dt.current = { contentSize: t, viewportSize: e };
|
|
1015
|
+
}, [t, e]), ye(() => {
|
|
1016
|
+
const h = j.current;
|
|
1017
|
+
if (!h) return;
|
|
1018
|
+
const k = () => {
|
|
1019
|
+
h.scrollTop !== 0 && (N.debug("[ScrollPane] Native scroll detected, resetting to 0", () => ({ scrollTop: h.scrollTop })), h.scrollTop = 0), h.scrollLeft !== 0 && (h.scrollLeft = 0);
|
|
1020
1020
|
};
|
|
1021
|
-
return
|
|
1022
|
-
}, []),
|
|
1023
|
-
if (
|
|
1024
|
-
|
|
1025
|
-
const
|
|
1026
|
-
|
|
1021
|
+
return h.addEventListener("scroll", k), () => h.removeEventListener("scroll", k);
|
|
1022
|
+
}, []), ye(() => {
|
|
1023
|
+
if (et) {
|
|
1024
|
+
N.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", () => ({ contentSize: t, viewportSize: e, scrollPosition: w.current }));
|
|
1025
|
+
const h = rt(t - e, 0, t);
|
|
1026
|
+
w.current > h && nt(h);
|
|
1027
1027
|
} else
|
|
1028
|
-
|
|
1029
|
-
}, [
|
|
1030
|
-
const
|
|
1031
|
-
if (
|
|
1028
|
+
nt(0);
|
|
1029
|
+
}, [et, nt, t, e]), Y(() => {
|
|
1030
|
+
const h = (X) => {
|
|
1031
|
+
if (X.ctrlKey)
|
|
1032
1032
|
return;
|
|
1033
|
-
const
|
|
1034
|
-
if (ct !== 0 && Math.abs(ct) >= Math.abs(
|
|
1033
|
+
const vt = X.shiftKey && X.deltaX === 0, ct = vt ? X.deltaY : X.deltaX, It = vt ? 0 : X.deltaY;
|
|
1034
|
+
if (ct !== 0 && Math.abs(ct) >= Math.abs(It)) {
|
|
1035
1035
|
if (T.current) {
|
|
1036
|
-
|
|
1037
|
-
let
|
|
1038
|
-
|
|
1036
|
+
X.preventDefault(), J();
|
|
1037
|
+
let ut = ct;
|
|
1038
|
+
X.deltaMode === 1 ? ut *= 16 : X.deltaMode === 2 && (ut *= e), T.current(ut);
|
|
1039
1039
|
}
|
|
1040
1040
|
return;
|
|
1041
1041
|
}
|
|
1042
|
-
if (!
|
|
1042
|
+
if (!et || X.deltaY === 0)
|
|
1043
1043
|
return;
|
|
1044
|
-
|
|
1045
|
-
let
|
|
1046
|
-
|
|
1047
|
-
},
|
|
1048
|
-
|
|
1049
|
-
},
|
|
1050
|
-
return
|
|
1051
|
-
|
|
1044
|
+
X.preventDefault(), J();
|
|
1045
|
+
let Pt = X.deltaY;
|
|
1046
|
+
X.deltaMode === 1 ? Pt *= 16 : X.deltaMode === 2 && (Pt *= e), Q !== 1 && (Pt *= Q), N.debug("[ScrollPane] wheel event", () => ({ deltaY: Pt, scrollPosition: w.current, wheelSpeedMultiplier: Q, deltaMode: X.deltaMode, scrollTop: j.current?.scrollTop })), nt((ut) => ut + Pt);
|
|
1047
|
+
}, k = () => {
|
|
1048
|
+
J();
|
|
1049
|
+
}, gt = lt.current;
|
|
1050
|
+
return gt && (gt.addEventListener("wheel", h, { passive: !1 }), gt.addEventListener("pointerdown", k, { capture: !0, passive: !0 })), () => {
|
|
1051
|
+
gt && (gt.removeEventListener("wheel", h), gt.removeEventListener("pointerdown", k, { capture: !0 }));
|
|
1052
1052
|
};
|
|
1053
|
-
}, [
|
|
1054
|
-
|
|
1053
|
+
}, [et, nt, J, e, Q]), Ue(
|
|
1054
|
+
Z,
|
|
1055
1055
|
() => ({
|
|
1056
|
-
scrollTo: (
|
|
1057
|
-
getScrollPosition: () =>
|
|
1056
|
+
scrollTo: (h) => (J(), nt(h)),
|
|
1057
|
+
getScrollPosition: () => w.current,
|
|
1058
1058
|
getContentSize: () => t,
|
|
1059
1059
|
getViewportSize: () => e
|
|
1060
1060
|
}),
|
|
1061
|
-
[
|
|
1061
|
+
[nt, t, e, J]
|
|
1062
1062
|
);
|
|
1063
|
-
const
|
|
1063
|
+
const R = sr(), de = U?.id ?? R, it = x({
|
|
1064
1064
|
pointerType: "",
|
|
1065
1065
|
pointerId: null,
|
|
1066
1066
|
startClientY: 0,
|
|
@@ -1069,147 +1069,147 @@ const vt = (n, t, e) => Math.max(t, Math.min(e, n)), Ye = "virtualscroll:tap-scr
|
|
|
1069
1069
|
shouldCancelNextClick: !1,
|
|
1070
1070
|
clickResetTimer: null,
|
|
1071
1071
|
velocitySamples: []
|
|
1072
|
-
}),
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
}, [c]),
|
|
1076
|
-
|
|
1072
|
+
}), E = x(c), Ct = x(d);
|
|
1073
|
+
Y(() => {
|
|
1074
|
+
E.current = c;
|
|
1075
|
+
}, [c]), Y(() => {
|
|
1076
|
+
Ct.current = d;
|
|
1077
1077
|
}, [d]);
|
|
1078
|
-
const
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
}, [
|
|
1082
|
-
const
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
}, [
|
|
1086
|
-
const
|
|
1087
|
-
if (c &&
|
|
1078
|
+
const zt = x(et);
|
|
1079
|
+
Y(() => {
|
|
1080
|
+
zt.current = et;
|
|
1081
|
+
}, [et]);
|
|
1082
|
+
const Zt = x(H);
|
|
1083
|
+
Y(() => {
|
|
1084
|
+
Zt.current = H;
|
|
1085
|
+
}, [H]), Y(() => {
|
|
1086
|
+
const h = it.current;
|
|
1087
|
+
if (c && et && (h.pointerId === null || Be(h.pointerType, d)) || h.pointerId === null)
|
|
1088
1088
|
return;
|
|
1089
|
-
const
|
|
1090
|
-
|
|
1091
|
-
const
|
|
1092
|
-
|
|
1093
|
-
}, [c, d,
|
|
1094
|
-
const
|
|
1095
|
-
if (!
|
|
1089
|
+
const k = j.current;
|
|
1090
|
+
h.clickResetTimer !== null && (window.clearTimeout(h.clickResetTimer), h.clickResetTimer = null);
|
|
1091
|
+
const gt = h.isDragging && h.shouldCancelNextClick, X = h.pointerId;
|
|
1092
|
+
h.pointerId = null, h.pointerType = "", h.startClientY = 0, h.startScroll = 0, h.isDragging = !1, h.shouldCancelNextClick = gt, h.velocitySamples = [], k?.hasPointerCapture(X) && k.releasePointerCapture(X);
|
|
1093
|
+
}, [c, d, et]), Y(() => {
|
|
1094
|
+
const h = j.current;
|
|
1095
|
+
if (!h)
|
|
1096
1096
|
return;
|
|
1097
|
-
const
|
|
1098
|
-
const f =
|
|
1097
|
+
const k = 6, gt = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), X = () => {
|
|
1098
|
+
const f = it.current;
|
|
1099
1099
|
f.pointerId = null, f.pointerType = "", f.startClientY = 0, f.startScroll = 0, f.isDragging = !1, f.velocitySamples = [];
|
|
1100
|
-
},
|
|
1101
|
-
const f =
|
|
1100
|
+
}, vt = () => {
|
|
1101
|
+
const f = it.current;
|
|
1102
1102
|
f.clickResetTimer !== null && (window.clearTimeout(f.clickResetTimer), f.clickResetTimer = null);
|
|
1103
1103
|
}, ct = (f) => {
|
|
1104
|
-
const
|
|
1105
|
-
|
|
1106
|
-
const
|
|
1107
|
-
|
|
1108
|
-
},
|
|
1109
|
-
const
|
|
1110
|
-
|
|
1111
|
-
},
|
|
1112
|
-
const
|
|
1113
|
-
if (!
|
|
1114
|
-
if (
|
|
1104
|
+
const P = it.current, ft = gt();
|
|
1105
|
+
P.velocitySamples.push({ clientY: f, time: ft });
|
|
1106
|
+
const Tt = Zt.current.velocitySampleWindow;
|
|
1107
|
+
P.velocitySamples = P.velocitySamples.filter((Vt) => ft - Vt.time <= Tt);
|
|
1108
|
+
}, It = (f) => f instanceof HTMLElement && f.closest("[data-scrollpane-ignore-drag='true']") !== null, Mt = (f) => {
|
|
1109
|
+
const P = it.current;
|
|
1110
|
+
P.shouldCancelNextClick && (f.preventDefault(), f.stopPropagation(), P.shouldCancelNextClick = !1);
|
|
1111
|
+
}, Pt = (f) => {
|
|
1112
|
+
const P = it.current;
|
|
1113
|
+
if (!P.isDragging) {
|
|
1114
|
+
if (P.isDragging = !0, P.shouldCancelNextClick = !0, !h.hasPointerCapture(f.pointerId))
|
|
1115
1115
|
try {
|
|
1116
|
-
|
|
1116
|
+
h.setPointerCapture(f.pointerId);
|
|
1117
1117
|
} catch {
|
|
1118
1118
|
}
|
|
1119
1119
|
ct(f.clientY);
|
|
1120
1120
|
}
|
|
1121
|
-
},
|
|
1122
|
-
const
|
|
1123
|
-
|
|
1124
|
-
},
|
|
1125
|
-
const
|
|
1126
|
-
if (
|
|
1121
|
+
}, ut = (f) => f.isTrusted || f.target === h, At = (f) => {
|
|
1122
|
+
const P = it.current;
|
|
1123
|
+
h.hasPointerCapture(f) && h.releasePointerCapture(f), P.shouldCancelNextClick = !1, vt(), X();
|
|
1124
|
+
}, dt = (f) => {
|
|
1125
|
+
const P = it.current;
|
|
1126
|
+
if (P.pointerId !== f.pointerId)
|
|
1127
1127
|
return;
|
|
1128
|
-
if (f.buttons === 0 &&
|
|
1129
|
-
|
|
1128
|
+
if (f.buttons === 0 && yr(f.pointerType)) {
|
|
1129
|
+
At(f.pointerId);
|
|
1130
1130
|
return;
|
|
1131
1131
|
}
|
|
1132
|
-
if (!(
|
|
1132
|
+
if (!(E.current && zt.current) || !Be(f.pointerType, Ct.current) || !P.isDragging && (Math.abs(f.clientY - P.startClientY) < k || (Pt(f), !P.isDragging)))
|
|
1133
1133
|
return;
|
|
1134
1134
|
ct(f.clientY);
|
|
1135
|
-
const
|
|
1136
|
-
|
|
1137
|
-
},
|
|
1138
|
-
const f =
|
|
1139
|
-
return f.pointerId !== null || !f.shouldCancelNextClick ? !1 : (
|
|
1140
|
-
const
|
|
1141
|
-
|
|
1135
|
+
const ft = f.clientY - P.startClientY, Tt = P.startScroll - ft;
|
|
1136
|
+
G.current(Tt), f.cancelable && f.preventDefault();
|
|
1137
|
+
}, st = () => {
|
|
1138
|
+
const f = it.current;
|
|
1139
|
+
return f.pointerId !== null || !f.shouldCancelNextClick ? !1 : (vt(), f.clickResetTimer = window.setTimeout(() => {
|
|
1140
|
+
const P = it.current;
|
|
1141
|
+
P.shouldCancelNextClick = !1, P.clickResetTimer = null;
|
|
1142
1142
|
}, 0), !0);
|
|
1143
|
-
},
|
|
1144
|
-
const
|
|
1145
|
-
if (
|
|
1146
|
-
|
|
1143
|
+
}, _t = (f) => {
|
|
1144
|
+
const P = it.current;
|
|
1145
|
+
if (P.pointerId !== f.pointerId) {
|
|
1146
|
+
st();
|
|
1147
1147
|
return;
|
|
1148
1148
|
}
|
|
1149
|
-
|
|
1150
|
-
let
|
|
1151
|
-
if (
|
|
1152
|
-
const
|
|
1153
|
-
if (
|
|
1154
|
-
const
|
|
1155
|
-
|
|
1149
|
+
P.isDragging && P.shouldCancelNextClick && f.cancelable && (f.preventDefault(), f.stopPropagation()), P.isDragging && ct(f.clientY);
|
|
1150
|
+
let ft = 0;
|
|
1151
|
+
if (P.isDragging && P.velocitySamples.length >= 2) {
|
|
1152
|
+
const Vt = P.velocitySamples, ie = Zt.current.velocitySampleWindow, Jt = Vt[Vt.length - 1], Qt = Vt.find((Kt) => Jt.time - Kt.time <= ie) ?? Vt[0];
|
|
1153
|
+
if (Jt && Qt && Jt.time !== Qt.time) {
|
|
1154
|
+
const Kt = Jt.clientY - Qt.clientY, se = Jt.time - Qt.time;
|
|
1155
|
+
ft = -(Kt / se);
|
|
1156
1156
|
}
|
|
1157
1157
|
}
|
|
1158
|
-
|
|
1159
|
-
const
|
|
1160
|
-
|
|
1158
|
+
vt(), P.shouldCancelNextClick && (P.clickResetTimer = window.setTimeout(() => {
|
|
1159
|
+
const Vt = it.current;
|
|
1160
|
+
Vt.shouldCancelNextClick = !1, Vt.clickResetTimer = null;
|
|
1161
1161
|
}, 0));
|
|
1162
|
-
const
|
|
1163
|
-
|
|
1164
|
-
},
|
|
1165
|
-
if (
|
|
1166
|
-
if (!f.isPrimary || f.pointerType !==
|
|
1162
|
+
const Tt = Zt.current.startVelocityThreshold;
|
|
1163
|
+
X(), h.hasPointerCapture(f.pointerId) && h.releasePointerCapture(f.pointerId), Math.abs(ft) >= Tt && Wt.current?.(ft);
|
|
1164
|
+
}, Xt = (f) => {
|
|
1165
|
+
if (it.current.pointerId !== null) {
|
|
1166
|
+
if (!f.isPrimary || f.pointerType !== it.current.pointerType)
|
|
1167
1167
|
return;
|
|
1168
|
-
|
|
1168
|
+
At(it.current.pointerId);
|
|
1169
1169
|
}
|
|
1170
|
-
if (
|
|
1170
|
+
if (it.current.shouldCancelNextClick && (vt(), it.current.shouldCancelNextClick = !1), !(E.current && zt.current) || !Be(f.pointerType, Ct.current) || f.button !== 0 && f.pointerType === "mouse" || f.ctrlKey || f.metaKey || f.altKey || It(f.target))
|
|
1171
1171
|
return;
|
|
1172
|
-
window.dispatchEvent(new CustomEvent(
|
|
1173
|
-
const
|
|
1174
|
-
|
|
1175
|
-
},
|
|
1176
|
-
if (
|
|
1177
|
-
|
|
1172
|
+
window.dispatchEvent(new CustomEvent(Xe, { detail: { paneId: R } })), Rt.current?.();
|
|
1173
|
+
const P = it.current;
|
|
1174
|
+
vt(), P.pointerId = f.pointerId, P.pointerType = f.pointerType, P.startClientY = f.clientY, P.startScroll = w.current, P.isDragging = !1, P.shouldCancelNextClick = !1, P.velocitySamples = [];
|
|
1175
|
+
}, Et = (f) => {
|
|
1176
|
+
if (it.current.pointerId !== f.pointerId) {
|
|
1177
|
+
st();
|
|
1178
1178
|
return;
|
|
1179
1179
|
}
|
|
1180
|
-
|
|
1181
|
-
},
|
|
1182
|
-
["click",
|
|
1183
|
-
["pointerdown",
|
|
1180
|
+
ut(f) && At(f.pointerId);
|
|
1181
|
+
}, jt = [
|
|
1182
|
+
["click", Mt, !0],
|
|
1183
|
+
["pointerdown", Xt, { passive: !1 }],
|
|
1184
1184
|
["lostpointercapture", (f) => {
|
|
1185
|
-
f.target !==
|
|
1185
|
+
f.target !== h || it.current.pointerId !== f.pointerId || At(f.pointerId);
|
|
1186
1186
|
}, void 0]
|
|
1187
|
-
],
|
|
1188
|
-
["pointermove",
|
|
1189
|
-
["pointerup",
|
|
1190
|
-
["pointercancel",
|
|
1187
|
+
], Nt = [
|
|
1188
|
+
["pointermove", dt, { passive: !1 }],
|
|
1189
|
+
["pointerup", _t, void 0],
|
|
1190
|
+
["pointercancel", Et, void 0]
|
|
1191
1191
|
];
|
|
1192
|
-
return
|
|
1193
|
-
|
|
1194
|
-
const f =
|
|
1195
|
-
f.pointerId !== null &&
|
|
1192
|
+
return Le(h, jt, "add"), Le(window, Nt, "add"), () => {
|
|
1193
|
+
Le(h, jt, "remove"), Le(window, Nt, "remove");
|
|
1194
|
+
const f = it.current;
|
|
1195
|
+
f.pointerId !== null && h.hasPointerCapture(f.pointerId) && h.releasePointerCapture(f.pointerId), vt(), X();
|
|
1196
1196
|
};
|
|
1197
|
-
}, [
|
|
1198
|
-
const
|
|
1199
|
-
(
|
|
1200
|
-
[
|
|
1197
|
+
}, [R]);
|
|
1198
|
+
const $t = S(
|
|
1199
|
+
(h) => (J(), nt(h)),
|
|
1200
|
+
[nt, J]
|
|
1201
1201
|
);
|
|
1202
|
-
return /* @__PURE__ */
|
|
1203
|
-
/* @__PURE__ */
|
|
1202
|
+
return /* @__PURE__ */ Se("div", { ref: lt, "data-testid": v, className: Te("aqvs-scroll-pane", I), style: C, children: [
|
|
1203
|
+
/* @__PURE__ */ Se(
|
|
1204
1204
|
"div",
|
|
1205
1205
|
{
|
|
1206
|
-
ref:
|
|
1207
|
-
className:
|
|
1206
|
+
ref: j,
|
|
1207
|
+
className: Te("aqvs-scroll-pane-content"),
|
|
1208
1208
|
"data-testid": "aqvs-scroll-pane-content",
|
|
1209
1209
|
style: {
|
|
1210
1210
|
height: e,
|
|
1211
|
-
paddingTop:
|
|
1212
|
-
paddingBottom:
|
|
1211
|
+
paddingTop: Ht.top,
|
|
1212
|
+
paddingBottom: Ht.bottom,
|
|
1213
1213
|
// スクロール不能時 (contentSize <= viewportSize) は touch-action を通常に戻し、
|
|
1214
1214
|
// 短いリスト上のタッチがページ全体のパンを妨げるデッドゾーン化を防ぐ。
|
|
1215
1215
|
// 直接操作 (指・ペン) のドラッグを許可していない場合も付けない。
|
|
@@ -1223,49 +1223,49 @@ const vt = (n, t, e) => Math.max(t, Math.min(e, n)), Ye = "virtualscroll:tap-scr
|
|
|
1223
1223
|
// 同一条件で揃えてあるため状態としても一貫している。
|
|
1224
1224
|
// 非同期コンテンツを先読みして確保する挙動は意図的に入れていない
|
|
1225
1225
|
// (空のペインがページのパンを殺すデッドゾーンになり、そちらの実害の方が大きいため)。
|
|
1226
|
-
...c &&
|
|
1226
|
+
...c && et && d.some((h) => h === "touch" || h === "pen") ? { touchAction: "none" } : {}
|
|
1227
1227
|
},
|
|
1228
|
-
...
|
|
1229
|
-
id:
|
|
1228
|
+
...U,
|
|
1229
|
+
id: de,
|
|
1230
1230
|
children: [
|
|
1231
|
-
|
|
1232
|
-
|
|
1231
|
+
p,
|
|
1232
|
+
r(w.current)
|
|
1233
1233
|
]
|
|
1234
1234
|
}
|
|
1235
1235
|
),
|
|
1236
1236
|
/* @__PURE__ */ ot(
|
|
1237
|
-
|
|
1237
|
+
Mr,
|
|
1238
1238
|
{
|
|
1239
1239
|
contentSize: t,
|
|
1240
1240
|
viewportSize: e,
|
|
1241
|
-
scrollPosition:
|
|
1242
|
-
onScroll:
|
|
1241
|
+
scrollPosition: w.current,
|
|
1242
|
+
onScroll: $t,
|
|
1243
1243
|
enableThumbDrag: i,
|
|
1244
1244
|
enableTrackClick: s,
|
|
1245
1245
|
enableArrowButtons: a,
|
|
1246
|
-
scrollBarWidth:
|
|
1247
|
-
ariaControls:
|
|
1248
|
-
tapScrollCircleOptions:
|
|
1249
|
-
itemCount:
|
|
1250
|
-
renderThumbOverlay:
|
|
1251
|
-
visibleStartIndex:
|
|
1252
|
-
visibleEndIndex:
|
|
1246
|
+
scrollBarWidth: n,
|
|
1247
|
+
ariaControls: de,
|
|
1248
|
+
tapScrollCircleOptions: V,
|
|
1249
|
+
itemCount: W,
|
|
1250
|
+
renderThumbOverlay: at,
|
|
1251
|
+
visibleStartIndex: wt,
|
|
1252
|
+
visibleEndIndex: A
|
|
1253
1253
|
},
|
|
1254
1254
|
"scrollbar"
|
|
1255
1255
|
),
|
|
1256
1256
|
O?.()
|
|
1257
1257
|
] });
|
|
1258
1258
|
}
|
|
1259
|
-
),
|
|
1260
|
-
const i = Math.max(
|
|
1261
|
-
return /* @__PURE__ */
|
|
1259
|
+
), Ge = (r, t, e) => Math.min(Math.max(r, t), e), Br = ({ dragState: r, normalizedDistance: t, sizeScale: e, size: n }) => {
|
|
1260
|
+
const i = Math.max(n / 2, 1), s = 1 + t * 0.65, a = Math.max(0.65, 1 - t * 0.25), c = r.direction * t * 26 * e, d = 0.8 + t * 0.18, b = 3 * e, I = 6 * e, v = 22 * e, C = Math.abs(c) + I, p = c > 0 ? b : -Math.abs(c) - b, V = Math.max(2.5, 3 * e), z = Ge(r.offsetX, -i, i), W = Ge(r.offsetY, -i, i), at = i * 0.35, Q = z / i * at, tt = W / i * at, xt = Q * 0.45, wt = tt * 0.45, A = Math.max(v * 0.38, 6), O = 0.65 + t * 0.2, M = r.active;
|
|
1261
|
+
return /* @__PURE__ */ Se(tr, { children: [
|
|
1262
1262
|
/* @__PURE__ */ ot(
|
|
1263
1263
|
"div",
|
|
1264
1264
|
{
|
|
1265
1265
|
className: "aqvs-tap-scroll-circle-gradient",
|
|
1266
1266
|
style: {
|
|
1267
1267
|
transform: `scale(${a}, ${s})`,
|
|
1268
|
-
transition:
|
|
1268
|
+
transition: M ? "40ms transform ease-out" : "200ms ease transform"
|
|
1269
1269
|
}
|
|
1270
1270
|
}
|
|
1271
1271
|
),
|
|
@@ -1276,8 +1276,8 @@ const vt = (n, t, e) => Math.max(t, Math.min(e, n)), Ye = "virtualscroll:tap-scr
|
|
|
1276
1276
|
style: {
|
|
1277
1277
|
width: v,
|
|
1278
1278
|
height: v,
|
|
1279
|
-
transform: `translate(calc(-50% + ${
|
|
1280
|
-
transition:
|
|
1279
|
+
transform: `translate(calc(-50% + ${Q}px), calc(-50% + ${tt}px)) scale(${a}, ${d * s})`,
|
|
1280
|
+
transition: M ? "70ms transform ease-out" : "200ms ease transform"
|
|
1281
1281
|
}
|
|
1282
1282
|
}
|
|
1283
1283
|
),
|
|
@@ -1286,12 +1286,12 @@ const vt = (n, t, e) => Math.max(t, Math.min(e, n)), Ye = "virtualscroll:tap-scr
|
|
|
1286
1286
|
{
|
|
1287
1287
|
className: "aqvs-sample-visual-highlight",
|
|
1288
1288
|
style: {
|
|
1289
|
-
width:
|
|
1290
|
-
height:
|
|
1291
|
-
transform: `translate(calc(-50% + ${
|
|
1289
|
+
width: A,
|
|
1290
|
+
height: A,
|
|
1291
|
+
transform: `translate(calc(-50% + ${xt}px), calc(-50% + ${wt}px)) scale(${a}, ${s})`,
|
|
1292
1292
|
opacity: O,
|
|
1293
1293
|
boxShadow: "0 0 8px rgba(255,255,255,0.45)",
|
|
1294
|
-
transition:
|
|
1294
|
+
transition: M ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
|
|
1295
1295
|
}
|
|
1296
1296
|
}
|
|
1297
1297
|
),
|
|
@@ -1300,34 +1300,34 @@ const vt = (n, t, e) => Math.max(t, Math.min(e, n)), Ye = "virtualscroll:tap-scr
|
|
|
1300
1300
|
{
|
|
1301
1301
|
className: "aqvs-sample-visual-rod",
|
|
1302
1302
|
style: {
|
|
1303
|
-
width:
|
|
1304
|
-
height:
|
|
1305
|
-
transform: `translate(-50%, ${
|
|
1303
|
+
width: V,
|
|
1304
|
+
height: C,
|
|
1305
|
+
transform: `translate(-50%, ${p}px)`,
|
|
1306
1306
|
opacity: t,
|
|
1307
|
-
transition:
|
|
1307
|
+
transition: M ? "40ms height, 60ms opacity ease-out ease-out" : "200ms ease height, 120ms ease opacity"
|
|
1308
1308
|
}
|
|
1309
1309
|
}
|
|
1310
1310
|
)
|
|
1311
1311
|
] });
|
|
1312
|
-
},
|
|
1313
|
-
if (!Number.isFinite(
|
|
1312
|
+
}, _e = 100, Rr = (r) => {
|
|
1313
|
+
if (!Number.isFinite(r))
|
|
1314
1314
|
return 0n;
|
|
1315
|
-
const t = Math.trunc(
|
|
1315
|
+
const t = Math.trunc(r);
|
|
1316
1316
|
return t <= 0 ? 0n : BigInt(t);
|
|
1317
|
-
},
|
|
1318
|
-
if (!Number.isFinite(
|
|
1319
|
-
throw new Error(`valueFn returned a non-finite value at index ${t}: ${
|
|
1320
|
-
return
|
|
1321
|
-
},
|
|
1322
|
-
if (
|
|
1317
|
+
}, qe = (r, t) => {
|
|
1318
|
+
if (!Number.isFinite(r))
|
|
1319
|
+
throw new Error(`valueFn returned a non-finite value at index ${t}: ${r}`);
|
|
1320
|
+
return r;
|
|
1321
|
+
}, Pe = (r) => {
|
|
1322
|
+
if (r <= 0 || !Number.isFinite(r))
|
|
1323
1323
|
return 0;
|
|
1324
|
-
const t = Math.trunc(
|
|
1324
|
+
const t = Math.trunc(r);
|
|
1325
1325
|
if (t <= 2147483647)
|
|
1326
1326
|
return t & -t;
|
|
1327
1327
|
const e = BigInt(t) & -BigInt(t);
|
|
1328
1328
|
return Number(e);
|
|
1329
1329
|
};
|
|
1330
|
-
class
|
|
1330
|
+
class ge {
|
|
1331
1331
|
/**
|
|
1332
1332
|
* @private
|
|
1333
1333
|
* @property {Map<number, number>} tree - The Map storing the Fenwick tree structure, specifically the sums of deltas. It is 1-indexed.
|
|
@@ -1367,8 +1367,8 @@ class me {
|
|
|
1367
1367
|
* @param {number | ((index: number) => number)} valueOrFn - The value for all elements, or a function to generate values.
|
|
1368
1368
|
* @param {{ sampleRange?: { from: number; to: number }, materialize?: boolean }} [options] - Optional settings for initialization.
|
|
1369
1369
|
*/
|
|
1370
|
-
constructor(t, e,
|
|
1371
|
-
this.reset(t, e,
|
|
1370
|
+
constructor(t, e, n) {
|
|
1371
|
+
this.reset(t, e, n);
|
|
1372
1372
|
}
|
|
1373
1373
|
/**
|
|
1374
1374
|
* @method reset
|
|
@@ -1385,7 +1385,7 @@ class me {
|
|
|
1385
1385
|
* @param {number | ((index: number) => number)} valueOrFn - The value for all elements, or a function to generate values.
|
|
1386
1386
|
* @param {{ sampleRange?: { from: number; to: number }, materialize?: boolean }} [options] - Optional settings for initialization.
|
|
1387
1387
|
*/
|
|
1388
|
-
reset(t, e,
|
|
1388
|
+
reset(t, e, n) {
|
|
1389
1389
|
const i = Number.isFinite(t) && t > 0 ? Math.trunc(t) : 0;
|
|
1390
1390
|
if (typeof e != "function") {
|
|
1391
1391
|
this.size = i, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.valueFn = void 0, this.baseValue = e, this.total = this.baseValue * this.size;
|
|
@@ -1393,16 +1393,16 @@ class me {
|
|
|
1393
1393
|
}
|
|
1394
1394
|
let s = 0, a;
|
|
1395
1395
|
if (i > 0) {
|
|
1396
|
-
const c =
|
|
1396
|
+
const c = n?.sampleRange ?? {
|
|
1397
1397
|
from: 0,
|
|
1398
|
-
to: Math.min(
|
|
1398
|
+
to: Math.min(_e - 1, i - 1)
|
|
1399
1399
|
};
|
|
1400
1400
|
let d = Math.max(0, Math.trunc(c.from)), b = Math.min(Math.trunc(c.to), i - 1);
|
|
1401
|
-
if (d > b && (d = 0, b = Math.min(
|
|
1402
|
-
s =
|
|
1401
|
+
if (d > b && (d = 0, b = Math.min(_e - 1, i - 1)), i > _e)
|
|
1402
|
+
s = ge._sampleBaseValueStrided(e, i, _e), n?.materialize && (a = { from: d, values: ge._collectValidatedValues(e, d, b) });
|
|
1403
1403
|
else {
|
|
1404
|
-
const
|
|
1405
|
-
s =
|
|
1404
|
+
const I = ge._collectValidatedValues(e, d, b);
|
|
1405
|
+
s = ge._modeOrMedian([...I]), n?.materialize && (a = { from: d, values: I });
|
|
1406
1406
|
}
|
|
1407
1407
|
}
|
|
1408
1408
|
if (this.size = i, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.total = void 0, this.valueFn = e, this.baseValue = s, a)
|
|
@@ -1439,10 +1439,10 @@ class me {
|
|
|
1439
1439
|
* @param {number} to - The ending index of the range (inclusive).
|
|
1440
1440
|
* @returns {number[]} The validated (finite-only) values in index order.
|
|
1441
1441
|
*/
|
|
1442
|
-
static _collectValidatedValues(t, e,
|
|
1442
|
+
static _collectValidatedValues(t, e, n) {
|
|
1443
1443
|
const i = [];
|
|
1444
|
-
for (let s = e; s <=
|
|
1445
|
-
i.push(
|
|
1444
|
+
for (let s = e; s <= n; s++)
|
|
1445
|
+
i.push(qe(t(s), s));
|
|
1446
1446
|
return i;
|
|
1447
1447
|
}
|
|
1448
1448
|
/**
|
|
@@ -1458,8 +1458,8 @@ class me {
|
|
|
1458
1458
|
return 0;
|
|
1459
1459
|
t.sort((a, c) => a - c);
|
|
1460
1460
|
const e = Math.floor(t.length / 2);
|
|
1461
|
-
let
|
|
1462
|
-
t.length % 2 === 0 ?
|
|
1461
|
+
let n;
|
|
1462
|
+
t.length % 2 === 0 ? n = Math.floor((t[e - 1] + t[e]) / 2) : n = t[e];
|
|
1463
1463
|
const i = /* @__PURE__ */ new Map();
|
|
1464
1464
|
let s = 0;
|
|
1465
1465
|
for (const a of t) {
|
|
@@ -1471,9 +1471,9 @@ class me {
|
|
|
1471
1471
|
for (const [d, b] of i.entries())
|
|
1472
1472
|
b === s && a.push(d);
|
|
1473
1473
|
const c = a.reduce((d, b) => d + b, 0);
|
|
1474
|
-
|
|
1474
|
+
n = Math.floor(c / a.length);
|
|
1475
1475
|
}
|
|
1476
|
-
return
|
|
1476
|
+
return n;
|
|
1477
1477
|
}
|
|
1478
1478
|
/**
|
|
1479
1479
|
* @private
|
|
@@ -1485,15 +1485,15 @@ class me {
|
|
|
1485
1485
|
* @param {number} sampleCount - Maximum number of points to evaluate.
|
|
1486
1486
|
* @returns {number} The estimated base value.
|
|
1487
1487
|
*/
|
|
1488
|
-
static _sampleBaseValueStrided(t, e,
|
|
1488
|
+
static _sampleBaseValueStrided(t, e, n) {
|
|
1489
1489
|
if (e <= 0)
|
|
1490
1490
|
return 0;
|
|
1491
|
-
let i = Math.max(1, Math.ceil(e /
|
|
1491
|
+
let i = Math.max(1, Math.ceil(e / n));
|
|
1492
1492
|
i % 2 === 0 && (i += 1);
|
|
1493
1493
|
const s = [];
|
|
1494
|
-
for (let a = 0; a < e && s.length <
|
|
1495
|
-
s.push(
|
|
1496
|
-
return
|
|
1494
|
+
for (let a = 0; a < e && s.length < n; a += i)
|
|
1495
|
+
s.push(qe(t(a), a));
|
|
1496
|
+
return ge._modeOrMedian(s);
|
|
1497
1497
|
}
|
|
1498
1498
|
/**
|
|
1499
1499
|
* @method update
|
|
@@ -1533,21 +1533,21 @@ class me {
|
|
|
1533
1533
|
*/
|
|
1534
1534
|
updateDeltas(t) {
|
|
1535
1535
|
const e = /* @__PURE__ */ new Map();
|
|
1536
|
-
for (const { index:
|
|
1537
|
-
if (
|
|
1538
|
-
throw new Error(`Index ${
|
|
1539
|
-
if (!Number.isInteger(
|
|
1540
|
-
throw new Error(`Index must be an integer: ${
|
|
1536
|
+
for (const { index: n, change: i } of t) {
|
|
1537
|
+
if (n < 0 || n >= this.size)
|
|
1538
|
+
throw new Error(`Index ${n} out of bounds`);
|
|
1539
|
+
if (!Number.isInteger(n))
|
|
1540
|
+
throw new Error(`Index must be an integer: ${n}`);
|
|
1541
1541
|
if (!Number.isFinite(i))
|
|
1542
1542
|
throw new Error(`Change must be a finite number: ${i}`);
|
|
1543
|
-
const a = (e.get(
|
|
1543
|
+
const a = (e.get(n) ?? this.deltas.get(n) ?? 0) + i;
|
|
1544
1544
|
if (a + this.baseValue < -1e-9)
|
|
1545
|
-
throw new Error(`Change would make the value at index ${
|
|
1546
|
-
e.set(
|
|
1545
|
+
throw new Error(`Change would make the value at index ${n} negative: ${a + this.baseValue}`);
|
|
1546
|
+
e.set(n, a);
|
|
1547
1547
|
}
|
|
1548
|
-
for (const { index:
|
|
1549
|
-
const a = (this.deltas.get(
|
|
1550
|
-
a === 0 ? this.deltas.delete(
|
|
1548
|
+
for (const { index: n, change: i } of t) {
|
|
1549
|
+
const a = (this.deltas.get(n) ?? 0) + i;
|
|
1550
|
+
a === 0 ? this.deltas.delete(n) : this.deltas.set(n, a), this._updateTree(n, i);
|
|
1551
1551
|
}
|
|
1552
1552
|
return this.total;
|
|
1553
1553
|
}
|
|
@@ -1562,13 +1562,13 @@ class me {
|
|
|
1562
1562
|
_updateTree(t, e) {
|
|
1563
1563
|
if (e === 0)
|
|
1564
1564
|
return;
|
|
1565
|
-
let
|
|
1566
|
-
for (;
|
|
1567
|
-
this.tree.set(
|
|
1568
|
-
const i =
|
|
1565
|
+
let n = t + 1;
|
|
1566
|
+
for (; n <= this.size; ) {
|
|
1567
|
+
this.tree.set(n, (this.tree.get(n) ?? 0) + e);
|
|
1568
|
+
const i = Pe(n);
|
|
1569
1569
|
if (i === 0)
|
|
1570
1570
|
break;
|
|
1571
|
-
|
|
1571
|
+
n += i;
|
|
1572
1572
|
}
|
|
1573
1573
|
this.total !== void 0 && (this.total += e);
|
|
1574
1574
|
}
|
|
@@ -1581,7 +1581,7 @@ class me {
|
|
|
1581
1581
|
* @returns {DeltaUpdate[]} Sanitized delta updates ready to apply.
|
|
1582
1582
|
*/
|
|
1583
1583
|
_buildDeltaUpdates(t) {
|
|
1584
|
-
const e = [],
|
|
1584
|
+
const e = [], n = /* @__PURE__ */ new Map();
|
|
1585
1585
|
for (const { index: i, value: s } of t) {
|
|
1586
1586
|
if (i < 0 || i >= this.size)
|
|
1587
1587
|
throw new Error(`Index ${i} out of bounds`);
|
|
@@ -1591,8 +1591,8 @@ class me {
|
|
|
1591
1591
|
throw new Error(`Value must be a finite number: ${s}`);
|
|
1592
1592
|
if (s < 0)
|
|
1593
1593
|
throw new Error("Value cannot be negative.");
|
|
1594
|
-
const a =
|
|
1595
|
-
d !== 0 && e.push({ index: i, change: d }),
|
|
1594
|
+
const a = n.has(i) ? n.get(i) ?? 0 : this.deltas.get(i) ?? 0, c = a + this.baseValue, d = s - c;
|
|
1595
|
+
d !== 0 && e.push({ index: i, change: d }), n.set(i, a + d);
|
|
1596
1596
|
}
|
|
1597
1597
|
return e;
|
|
1598
1598
|
}
|
|
@@ -1609,10 +1609,10 @@ class me {
|
|
|
1609
1609
|
let t = 0, e = this.size;
|
|
1610
1610
|
for (; e > 0; ) {
|
|
1611
1611
|
t += this.tree.get(e) ?? 0;
|
|
1612
|
-
const
|
|
1613
|
-
if (
|
|
1612
|
+
const n = Pe(e);
|
|
1613
|
+
if (n === 0)
|
|
1614
1614
|
break;
|
|
1615
|
-
e -=
|
|
1615
|
+
e -= n;
|
|
1616
1616
|
}
|
|
1617
1617
|
return t + this.baseValue * this.size;
|
|
1618
1618
|
}
|
|
@@ -1626,9 +1626,9 @@ class me {
|
|
|
1626
1626
|
*/
|
|
1627
1627
|
_materialize(t, e = !0) {
|
|
1628
1628
|
if (this.valueFn) {
|
|
1629
|
-
const
|
|
1630
|
-
if (s !==
|
|
1631
|
-
const a = s -
|
|
1629
|
+
const n = this.deltas.get(t) ?? 0, s = qe(this.valueFn(t), t) - this.baseValue;
|
|
1630
|
+
if (s !== n && (s === 0 ? this.deltas.delete(t) : this.deltas.set(t, s), e)) {
|
|
1631
|
+
const a = s - n;
|
|
1632
1632
|
this._updateTree(t, a);
|
|
1633
1633
|
}
|
|
1634
1634
|
}
|
|
@@ -1642,19 +1642,19 @@ class me {
|
|
|
1642
1642
|
* @param {number | undefined} index - Target index for materialization.
|
|
1643
1643
|
* @param {boolean} [forceIndex=false] - When true, materializes the index even if it is outside the provided ranges.
|
|
1644
1644
|
*/
|
|
1645
|
-
_materializeRanges(t, e,
|
|
1645
|
+
_materializeRanges(t, e, n = !1) {
|
|
1646
1646
|
if (!(t?.materialize && this.valueFn))
|
|
1647
1647
|
return;
|
|
1648
1648
|
const i = t.ranges;
|
|
1649
1649
|
if (i && i.length > 0) {
|
|
1650
1650
|
for (const c of i) {
|
|
1651
1651
|
const d = Math.max(0, Math.trunc(c.from)), b = Math.min(Math.trunc(c.to), this.size - 1);
|
|
1652
|
-
for (let
|
|
1653
|
-
this._materialize(
|
|
1652
|
+
for (let I = d; I <= b; I++)
|
|
1653
|
+
this._materialize(I);
|
|
1654
1654
|
}
|
|
1655
1655
|
if (e === void 0)
|
|
1656
1656
|
return;
|
|
1657
|
-
if (
|
|
1657
|
+
if (n) {
|
|
1658
1658
|
this._materialize(e);
|
|
1659
1659
|
return;
|
|
1660
1660
|
}
|
|
@@ -1674,16 +1674,16 @@ class me {
|
|
|
1674
1674
|
* @param {boolean} chooseLowerBound - When true, finds the smallest index meeting or exceeding the target; otherwise finds the largest index not exceeding it.
|
|
1675
1675
|
* @returns {{ index: number; total: number | undefined; cumulative: number | undefined; currentValue: number | undefined; safeIndex: number | undefined }} Binary search result.
|
|
1676
1676
|
*/
|
|
1677
|
-
_findIndex(t, e = {},
|
|
1677
|
+
_findIndex(t, e = {}, n) {
|
|
1678
1678
|
if (this.size >= 1073741824)
|
|
1679
|
-
return this._findIndexLarge(t, e,
|
|
1679
|
+
return this._findIndexLarge(t, e, n);
|
|
1680
1680
|
if (this.size === 0)
|
|
1681
1681
|
return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1682
1682
|
this._materializeRanges(e.materializeOption);
|
|
1683
1683
|
const i = e.materializeOption?.materialize === !0;
|
|
1684
1684
|
let s;
|
|
1685
1685
|
for (; ; ) {
|
|
1686
|
-
if (s = this._descend(t,
|
|
1686
|
+
if (s = this._descend(t, n), s < 0 || s >= this.size)
|
|
1687
1687
|
return { index: -1, total: this.total ?? this.getTotal(), cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1688
1688
|
if (!i)
|
|
1689
1689
|
break;
|
|
@@ -1710,59 +1710,59 @@ class me {
|
|
|
1710
1710
|
* @returns {number} The candidate index (may be out of range when no index satisfies the condition).
|
|
1711
1711
|
*/
|
|
1712
1712
|
_descend(t, e) {
|
|
1713
|
-
let
|
|
1713
|
+
let n = 0, i = 0, s = 1;
|
|
1714
1714
|
for (; s << 1 <= this.size; )
|
|
1715
1715
|
s <<= 1;
|
|
1716
1716
|
for (; s > 0; s >>= 1) {
|
|
1717
|
-
const a =
|
|
1717
|
+
const a = n + s;
|
|
1718
1718
|
if (a <= this.size) {
|
|
1719
1719
|
const d = (this.tree.get(a) ?? 0) + this.baseValue * s;
|
|
1720
|
-
(e ? i + d < t : i + d <= t) && (
|
|
1720
|
+
(e ? i + d < t : i + d <= t) && (n = a, i += d);
|
|
1721
1721
|
}
|
|
1722
1722
|
}
|
|
1723
|
-
return e ?
|
|
1723
|
+
return e ? n : n - 1;
|
|
1724
1724
|
}
|
|
1725
1725
|
/**
|
|
1726
1726
|
* Executes a binary search using bigint arithmetic for extremely large sizes.
|
|
1727
1727
|
*
|
|
1728
1728
|
* 非常に大きなサイズに対して bigint 演算を用いた二分探索を実施。
|
|
1729
1729
|
*/
|
|
1730
|
-
_findIndexLarge(t, e,
|
|
1730
|
+
_findIndexLarge(t, e, n) {
|
|
1731
1731
|
if (this.size === 0)
|
|
1732
1732
|
return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1733
|
-
const i =
|
|
1733
|
+
const i = Rr(this.size);
|
|
1734
1734
|
if (i === 0n)
|
|
1735
1735
|
return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1736
1736
|
this._materializeRanges(e.materializeOption);
|
|
1737
1737
|
const s = e.materializeOption?.materialize === !0;
|
|
1738
1738
|
for (; ; ) {
|
|
1739
|
-
let a = 0n, c = i - 1n, d, b,
|
|
1739
|
+
let a = 0n, c = i - 1n, d, b, I = this.total;
|
|
1740
1740
|
for (; a <= c; ) {
|
|
1741
|
-
const
|
|
1742
|
-
if (
|
|
1743
|
-
if (d =
|
|
1744
|
-
if (
|
|
1741
|
+
const p = a + c >> 1n, V = Number(p), z = this.prefixSum(V);
|
|
1742
|
+
if (I = z.total, n ? z.cumulative >= t : z.cumulative <= t)
|
|
1743
|
+
if (d = p, b = z, n) {
|
|
1744
|
+
if (p === 0n)
|
|
1745
1745
|
break;
|
|
1746
|
-
c =
|
|
1746
|
+
c = p - 1n;
|
|
1747
1747
|
} else
|
|
1748
|
-
a =
|
|
1749
|
-
else if (
|
|
1750
|
-
a =
|
|
1748
|
+
a = p + 1n;
|
|
1749
|
+
else if (n)
|
|
1750
|
+
a = p + 1n;
|
|
1751
1751
|
else {
|
|
1752
|
-
if (
|
|
1752
|
+
if (p === 0n)
|
|
1753
1753
|
break;
|
|
1754
|
-
c =
|
|
1754
|
+
c = p - 1n;
|
|
1755
1755
|
}
|
|
1756
1756
|
}
|
|
1757
|
-
const v = b,
|
|
1758
|
-
if (s &&
|
|
1759
|
-
const
|
|
1760
|
-
if (this._materialize(
|
|
1757
|
+
const v = b, C = d !== void 0 ? Number(d) : -1;
|
|
1758
|
+
if (s && C >= 0) {
|
|
1759
|
+
const p = this.deltas.get(C) ?? 0;
|
|
1760
|
+
if (this._materialize(C), (this.deltas.get(C) ?? 0) !== p)
|
|
1761
1761
|
continue;
|
|
1762
1762
|
}
|
|
1763
1763
|
return {
|
|
1764
|
-
index:
|
|
1765
|
-
total:
|
|
1764
|
+
index: C,
|
|
1765
|
+
total: I,
|
|
1766
1766
|
cumulative: v?.cumulative,
|
|
1767
1767
|
currentValue: v?.currentValue,
|
|
1768
1768
|
safeIndex: v?.safeIndex
|
|
@@ -1782,19 +1782,19 @@ class me {
|
|
|
1782
1782
|
return { cumulative: 0, total: this.total, currentValue: 0, safeIndex: 0 };
|
|
1783
1783
|
if (this.size === 0)
|
|
1784
1784
|
return { cumulative: 0, total: this.total ?? 0, currentValue: 0, safeIndex: 0 };
|
|
1785
|
-
const
|
|
1786
|
-
this._materializeRanges(i,
|
|
1787
|
-
let s = 0, a =
|
|
1785
|
+
const n = rt(Math.trunc(t), 0, this.size - 1), i = e?.materializeOption;
|
|
1786
|
+
this._materializeRanges(i, n, !0);
|
|
1787
|
+
let s = 0, a = n + 1;
|
|
1788
1788
|
for (; a > 0; ) {
|
|
1789
1789
|
const d = this.tree.get(a) ?? 0;
|
|
1790
1790
|
s += d;
|
|
1791
|
-
const b =
|
|
1791
|
+
const b = Pe(a);
|
|
1792
1792
|
if (b === 0)
|
|
1793
1793
|
break;
|
|
1794
1794
|
a -= b;
|
|
1795
1795
|
}
|
|
1796
|
-
const c = i?.materialize ? this.get(
|
|
1797
|
-
return { cumulative: s + this.baseValue * (
|
|
1796
|
+
const c = i?.materialize ? this.get(n) : (this.deltas.get(n) || 0) + this.baseValue;
|
|
1797
|
+
return { cumulative: s + this.baseValue * (n + 1), total: this.total, currentValue: c, safeIndex: n };
|
|
1798
1798
|
}
|
|
1799
1799
|
/**
|
|
1800
1800
|
* @method get
|
|
@@ -1809,8 +1809,8 @@ class me {
|
|
|
1809
1809
|
return 0;
|
|
1810
1810
|
if (!Number.isInteger(t) || t < 0 || t >= this.size)
|
|
1811
1811
|
throw new Error("Index out of bounds");
|
|
1812
|
-
const
|
|
1813
|
-
return this._materializeRanges(
|
|
1812
|
+
const n = e?.materializeOption;
|
|
1813
|
+
return this._materializeRanges(n, t), (this.deltas.get(t) ?? 0) + this.baseValue;
|
|
1814
1814
|
}
|
|
1815
1815
|
/**
|
|
1816
1816
|
* @method getTotal
|
|
@@ -1826,8 +1826,8 @@ class me {
|
|
|
1826
1826
|
this.total = 0;
|
|
1827
1827
|
else {
|
|
1828
1828
|
this.total = this._computeTreeTotal();
|
|
1829
|
-
const
|
|
1830
|
-
|
|
1829
|
+
const n = this.prefixSum(this.getSize() - 1);
|
|
1830
|
+
n.cumulative !== n.total && N.error("Inconsistent Fenwick Tree state");
|
|
1831
1831
|
}
|
|
1832
1832
|
return this.total;
|
|
1833
1833
|
}
|
|
@@ -1840,18 +1840,18 @@ class me {
|
|
|
1840
1840
|
*/
|
|
1841
1841
|
rebuildTree(t) {
|
|
1842
1842
|
if (t?.materialize && this.valueFn) {
|
|
1843
|
-
const
|
|
1844
|
-
this.reset(this.size, (i) =>
|
|
1843
|
+
const n = this.valueFn;
|
|
1844
|
+
this.reset(this.size, (i) => n(i), { materialize: !0 });
|
|
1845
1845
|
return;
|
|
1846
1846
|
}
|
|
1847
1847
|
const e = /* @__PURE__ */ new Map();
|
|
1848
|
-
for (const [
|
|
1848
|
+
for (const [n, i] of this.deltas.entries()) {
|
|
1849
1849
|
if (i === 0)
|
|
1850
1850
|
continue;
|
|
1851
|
-
let s =
|
|
1851
|
+
let s = n + 1;
|
|
1852
1852
|
for (; s <= this.size; ) {
|
|
1853
1853
|
e.set(s, (e.get(s) ?? 0) + i);
|
|
1854
|
-
const a =
|
|
1854
|
+
const a = Pe(s);
|
|
1855
1855
|
if (a === 0)
|
|
1856
1856
|
break;
|
|
1857
1857
|
s += a;
|
|
@@ -1874,8 +1874,8 @@ class me {
|
|
|
1874
1874
|
if (this.total === void 0)
|
|
1875
1875
|
return 0;
|
|
1876
1876
|
let t = this.baseValue * this.size;
|
|
1877
|
-
for (const [e,
|
|
1878
|
-
e < this.size && (t +=
|
|
1877
|
+
for (const [e, n] of this.deltas)
|
|
1878
|
+
e < this.size && (t += n);
|
|
1879
1879
|
return this.total - t;
|
|
1880
1880
|
}
|
|
1881
1881
|
/**
|
|
@@ -1917,16 +1917,16 @@ class me {
|
|
|
1917
1917
|
changeSize(t) {
|
|
1918
1918
|
if (!Number.isFinite(t))
|
|
1919
1919
|
throw new Error(`Size must be a finite number: ${t}`);
|
|
1920
|
-
const e = Math.max(0, Math.trunc(t)),
|
|
1921
|
-
if (e ===
|
|
1920
|
+
const e = Math.max(0, Math.trunc(t)), n = this.size;
|
|
1921
|
+
if (e === n)
|
|
1922
1922
|
return;
|
|
1923
|
-
if (e >
|
|
1924
|
-
if (
|
|
1923
|
+
if (e > n)
|
|
1924
|
+
if (n === 0 && this.deltas.size > 0) {
|
|
1925
1925
|
for (const s of this.deltas.keys())
|
|
1926
1926
|
s >= e && this.deltas.delete(s);
|
|
1927
1927
|
this.size = e, this.rebuildTree();
|
|
1928
1928
|
} else
|
|
1929
|
-
this._growSize(
|
|
1929
|
+
this._growSize(n, e);
|
|
1930
1930
|
else {
|
|
1931
1931
|
if (e > 0)
|
|
1932
1932
|
for (const s of this.deltas.keys())
|
|
@@ -1934,7 +1934,7 @@ class me {
|
|
|
1934
1934
|
this.size = e, this.rebuildTree();
|
|
1935
1935
|
}
|
|
1936
1936
|
const i = this.prefixSum(this.getSize() - 1);
|
|
1937
|
-
i.cumulative !== i.total &&
|
|
1937
|
+
i.cumulative !== i.total && N.error("Inconsistent Fenwick Tree state");
|
|
1938
1938
|
}
|
|
1939
1939
|
/**
|
|
1940
1940
|
* @private
|
|
@@ -1946,14 +1946,14 @@ class me {
|
|
|
1946
1946
|
* @returns {number} The minimum left boundary `t - lowestSetBit(t)` of the newly-activated nodes.
|
|
1947
1947
|
*/
|
|
1948
1948
|
static _minCoveredLowBound(t, e) {
|
|
1949
|
-
let
|
|
1949
|
+
let n = 1;
|
|
1950
1950
|
for (; ; ) {
|
|
1951
|
-
const i =
|
|
1951
|
+
const i = n * 2;
|
|
1952
1952
|
if (Math.floor(e / i) * i <= t)
|
|
1953
1953
|
break;
|
|
1954
|
-
|
|
1954
|
+
n = i;
|
|
1955
1955
|
}
|
|
1956
|
-
return
|
|
1956
|
+
return n * Math.floor(t / n);
|
|
1957
1957
|
}
|
|
1958
1958
|
/**
|
|
1959
1959
|
* @private
|
|
@@ -1965,17 +1965,17 @@ class me {
|
|
|
1965
1965
|
* @param {number} oldSize - The previous size.
|
|
1966
1966
|
* @param {number} newSize - The new (larger) size.
|
|
1967
1967
|
*/
|
|
1968
|
-
_propagateDeltaToGrownNodes(t, e,
|
|
1968
|
+
_propagateDeltaToGrownNodes(t, e, n, i) {
|
|
1969
1969
|
let s = t + 1;
|
|
1970
|
-
for (; s <=
|
|
1971
|
-
const a =
|
|
1970
|
+
for (; s <= n; ) {
|
|
1971
|
+
const a = Pe(s);
|
|
1972
1972
|
if (a === 0)
|
|
1973
1973
|
break;
|
|
1974
1974
|
s += a;
|
|
1975
1975
|
}
|
|
1976
1976
|
for (; s <= i; ) {
|
|
1977
1977
|
this.tree.set(s, (this.tree.get(s) ?? 0) + e);
|
|
1978
|
-
const a =
|
|
1978
|
+
const a = Pe(s);
|
|
1979
1979
|
if (a === 0)
|
|
1980
1980
|
break;
|
|
1981
1981
|
s += a;
|
|
@@ -1991,15 +1991,15 @@ class me {
|
|
|
1991
1991
|
*/
|
|
1992
1992
|
_growSize(t, e) {
|
|
1993
1993
|
if (this.size = e, this.deltas.size > 0) {
|
|
1994
|
-
const
|
|
1995
|
-
if (t -
|
|
1996
|
-
for (let s =
|
|
1994
|
+
const n = ge._minCoveredLowBound(t, e);
|
|
1995
|
+
if (t - n < this.deltas.size)
|
|
1996
|
+
for (let s = n; s < t; s++) {
|
|
1997
1997
|
const a = this.deltas.get(s);
|
|
1998
1998
|
a === void 0 || a === 0 || this._propagateDeltaToGrownNodes(s, a, t, e);
|
|
1999
1999
|
}
|
|
2000
2000
|
else
|
|
2001
2001
|
for (const [s, a] of this.deltas.entries())
|
|
2002
|
-
a === 0 || s <
|
|
2002
|
+
a === 0 || s < n || this._propagateDeltaToGrownNodes(s, a, t, e);
|
|
2003
2003
|
}
|
|
2004
2004
|
this.total = this._computeTreeTotal();
|
|
2005
2005
|
}
|
|
@@ -2069,20 +2069,20 @@ class me {
|
|
|
2069
2069
|
return this._findIndex(t, e ?? {}, !1);
|
|
2070
2070
|
}
|
|
2071
2071
|
}
|
|
2072
|
-
const
|
|
2073
|
-
const e =
|
|
2074
|
-
return e ===
|
|
2075
|
-
},
|
|
2076
|
-
const
|
|
2077
|
-
i.current === null && (i.current = new
|
|
2078
|
-
const a = i.current, c = s.current, d = c.size !==
|
|
2079
|
-
if (b ||
|
|
2080
|
-
const
|
|
2081
|
-
|
|
2082
|
-
} else d && (e?.debug &&
|
|
2072
|
+
const Er = (r, t) => {
|
|
2073
|
+
const e = r?.sampleRange, n = t?.sampleRange;
|
|
2074
|
+
return e === n ? !1 : e && n ? e.from !== n.from || e.to !== n.to : !0;
|
|
2075
|
+
}, Nr = (r, t, e) => {
|
|
2076
|
+
const n = Number.isFinite(r) && r > 0 ? Math.trunc(r) : 0, i = x(null), s = x({ size: n, valueOrFn: t, options: e });
|
|
2077
|
+
i.current === null && (i.current = new ge(n, t, e));
|
|
2078
|
+
const a = i.current, c = s.current, d = c.size !== n, b = c.valueOrFn !== t, I = Er(c.options, e), v = c.size === 0 && n > 0 && (!i.current || i.current.base === 0);
|
|
2079
|
+
if (b || I) {
|
|
2080
|
+
const C = e?.resetOnValueFnChange ?? !0;
|
|
2081
|
+
I || b && C || v ? (e?.debug && N.debug("[useFenwickMapTree] reset", { valueOrFnChanged: b, optionsChanged: I }), a.reset(n, t, e)) : (d && (e?.debug && N.debug("[useFenwickMapTree] resize (with valueFn change)", { from: c.size, to: n }), a.changeSize(n)), e?.debug && N.debug("[useFenwickMapTree] setValueFn (no reset)", { valueOrFnChanged: b }), a.setValueFn(t, { reset: !1 })), s.current = { size: n, valueOrFn: t, options: e };
|
|
2082
|
+
} else d && (e?.debug && N.debug("[useFenwickMapTree] resize", { from: c.size, to: n }), v ? a.reset(n, t, e) : a.changeSize(n), s.current = { size: n, valueOrFn: t, options: e });
|
|
2083
2083
|
return a;
|
|
2084
2084
|
};
|
|
2085
|
-
class
|
|
2085
|
+
class Cr {
|
|
2086
2086
|
key;
|
|
2087
2087
|
value;
|
|
2088
2088
|
prev = null;
|
|
@@ -2091,7 +2091,7 @@ class wr {
|
|
|
2091
2091
|
this.key = t, this.value = e;
|
|
2092
2092
|
}
|
|
2093
2093
|
}
|
|
2094
|
-
class
|
|
2094
|
+
class He {
|
|
2095
2095
|
head = null;
|
|
2096
2096
|
tail = null;
|
|
2097
2097
|
/**
|
|
@@ -2132,230 +2132,230 @@ class ze {
|
|
|
2132
2132
|
this.remove(t), this.addToTail(t);
|
|
2133
2133
|
}
|
|
2134
2134
|
}
|
|
2135
|
-
function
|
|
2136
|
-
const t =
|
|
2137
|
-
|
|
2138
|
-
if (i.current =
|
|
2139
|
-
|
|
2135
|
+
function Vr(r) {
|
|
2136
|
+
const t = x(/* @__PURE__ */ new Map()), e = x(new He()), n = Math.floor(r), i = x(n);
|
|
2137
|
+
Y(() => {
|
|
2138
|
+
if (i.current = n, Number.isNaN(n) || n < 0) {
|
|
2139
|
+
N.warn(`useLruCache: invalid capacity ${r}; the cache will not store any entries.`), t.current.clear(), e.current = new He();
|
|
2140
2140
|
return;
|
|
2141
2141
|
}
|
|
2142
|
-
if (Number.isFinite(
|
|
2143
|
-
for (; t.current.size >
|
|
2144
|
-
const
|
|
2145
|
-
if (
|
|
2146
|
-
t.current.delete(
|
|
2142
|
+
if (Number.isFinite(n))
|
|
2143
|
+
for (; t.current.size > n; ) {
|
|
2144
|
+
const I = e.current.removeHead();
|
|
2145
|
+
if (I)
|
|
2146
|
+
t.current.delete(I.key);
|
|
2147
2147
|
else
|
|
2148
2148
|
break;
|
|
2149
2149
|
}
|
|
2150
|
-
}, [
|
|
2151
|
-
const s = S((
|
|
2152
|
-
const v = t.current.get(
|
|
2150
|
+
}, [r, n]);
|
|
2151
|
+
const s = S((I) => {
|
|
2152
|
+
const v = t.current.get(I);
|
|
2153
2153
|
if (v)
|
|
2154
2154
|
return e.current.moveToTail(v), v.value;
|
|
2155
|
-
}, []), a = S((
|
|
2156
|
-
const
|
|
2157
|
-
if (Number.isNaN(
|
|
2155
|
+
}, []), a = S((I, v) => {
|
|
2156
|
+
const C = i.current;
|
|
2157
|
+
if (Number.isNaN(C) || C <= 0)
|
|
2158
2158
|
return;
|
|
2159
|
-
let
|
|
2160
|
-
if (
|
|
2161
|
-
|
|
2159
|
+
let p = t.current.get(I);
|
|
2160
|
+
if (p)
|
|
2161
|
+
p.value = v, e.current.moveToTail(p);
|
|
2162
2162
|
else {
|
|
2163
|
-
if (t.current.size >=
|
|
2164
|
-
const
|
|
2165
|
-
|
|
2163
|
+
if (t.current.size >= C) {
|
|
2164
|
+
const V = e.current.removeHead();
|
|
2165
|
+
V && t.current.delete(V.key);
|
|
2166
2166
|
}
|
|
2167
|
-
|
|
2167
|
+
p = new Cr(I, v), t.current.set(I, p), e.current.addToTail(p);
|
|
2168
2168
|
}
|
|
2169
|
-
}, []), c = S((
|
|
2170
|
-
const v = t.current.get(
|
|
2171
|
-
v && (e.current.remove(v), t.current.delete(
|
|
2169
|
+
}, []), c = S((I) => t.current.has(I), []), d = S((I) => {
|
|
2170
|
+
const v = t.current.get(I);
|
|
2171
|
+
v && (e.current.remove(v), t.current.delete(I));
|
|
2172
2172
|
}, []), b = S(() => {
|
|
2173
|
-
t.current.clear(), e.current = new
|
|
2173
|
+
t.current.clear(), e.current = new He();
|
|
2174
2174
|
}, []);
|
|
2175
|
-
return
|
|
2175
|
+
return Ft(() => ({ get: s, set: a, has: c, remove: d, clear: b }), [s, a, c, d, b]);
|
|
2176
2176
|
}
|
|
2177
|
-
const
|
|
2178
|
-
const { get:
|
|
2179
|
-
return
|
|
2180
|
-
},
|
|
2181
|
-
top: Math.max(0,
|
|
2182
|
-
bottom: Math.max(0,
|
|
2183
|
-
}),
|
|
2184
|
-
if (!Number.isFinite(
|
|
2185
|
-
const t = Math.trunc(
|
|
2177
|
+
const Dr = 1e4, qr = () => {
|
|
2178
|
+
const { get: r, set: t, has: e, clear: n } = Vr(Dr);
|
|
2179
|
+
return Ft(() => ({ get: r, set: t, has: e, clear: n }), [r, t, e, n]);
|
|
2180
|
+
}, St = (r, t) => t <= 0 ? 0 : rt(r, 0, t - 1), Ze = (r) => ({
|
|
2181
|
+
top: Math.max(0, r?.top ?? 0),
|
|
2182
|
+
bottom: Math.max(0, r?.bottom ?? 0)
|
|
2183
|
+
}), ee = (r, t) => r <= t ? 0 : r - t, Ie = (r, t) => r <= 0 ? 0 : r + t, Oe = 1e3, Je = 2e3, Ar = 1048576, Ne = (r) => {
|
|
2184
|
+
if (!Number.isFinite(r)) return 0n;
|
|
2185
|
+
const t = Math.trunc(r);
|
|
2186
2186
|
return t <= 0 ? 0n : BigInt(t);
|
|
2187
|
-
},
|
|
2188
|
-
const d =
|
|
2187
|
+
}, Lr = (r, t, e, n, i, s, a, c) => {
|
|
2188
|
+
const d = Ne(n);
|
|
2189
2189
|
if (d === 0n)
|
|
2190
2190
|
return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
|
|
2191
|
-
const b = (
|
|
2192
|
-
let
|
|
2193
|
-
v === -1 ?
|
|
2194
|
-
const
|
|
2195
|
-
const O = Number(
|
|
2191
|
+
const b = (A) => A < 0n ? 0n : A >= d ? d - 1n : A, I = { materializeOption: { materialize: !1 } }, { index: v, cumulative: C } = s.findIndexAtOrAfter(r, I);
|
|
2192
|
+
let p;
|
|
2193
|
+
v === -1 ? p = d - 1n : (C === r ? p = Ne(v + 1) : p = Ne(v), p >= d && (p = d - 1n)), r <= 0 && (p = 0n), c && r >= a && (p = d - 1n);
|
|
2194
|
+
const V = (A) => {
|
|
2195
|
+
const O = Number(A);
|
|
2196
2196
|
if (!Number.isSafeInteger(O))
|
|
2197
2197
|
return null;
|
|
2198
|
-
const { cumulative:
|
|
2199
|
-
if (!Number.isFinite(
|
|
2198
|
+
const { cumulative: M } = s.prefixSum(O, { materializeOption: { materialize: !1 } });
|
|
2199
|
+
if (!Number.isFinite(M))
|
|
2200
2200
|
return null;
|
|
2201
|
-
const { index:
|
|
2202
|
-
if (
|
|
2201
|
+
const { index: U } = s.findIndexAtOrAfter(M + 0.5, { materializeOption: { materialize: !1 } });
|
|
2202
|
+
if (U === -1)
|
|
2203
2203
|
return null;
|
|
2204
|
-
const
|
|
2205
|
-
return
|
|
2206
|
-
},
|
|
2207
|
-
let O = 0,
|
|
2208
|
-
for (;
|
|
2209
|
-
const lt = Number(
|
|
2210
|
-
if (O +=
|
|
2204
|
+
const Z = Ne(U);
|
|
2205
|
+
return Z > A ? Z : null;
|
|
2206
|
+
}, z = (A) => {
|
|
2207
|
+
let O = 0, M = A, U = A, Z = 0n, w = 0;
|
|
2208
|
+
for (; M < d && O < t; ) {
|
|
2209
|
+
const lt = Number(M), j = i(lt);
|
|
2210
|
+
if (O += j, U = M, M += 1n, Z += 1n, !Number.isFinite(j) || j < 0)
|
|
2211
2211
|
break;
|
|
2212
|
-
if (
|
|
2213
|
-
if (
|
|
2214
|
-
const T =
|
|
2215
|
-
if (T !== null && T >
|
|
2216
|
-
|
|
2217
|
-
else if (T !== null && T ===
|
|
2218
|
-
|
|
2212
|
+
if (j === 0) {
|
|
2213
|
+
if (w += 1, w > Oe) {
|
|
2214
|
+
const T = V(U);
|
|
2215
|
+
if (T !== null && T > M)
|
|
2216
|
+
M = T, w = 0;
|
|
2217
|
+
else if (T !== null && T === M && i(Number(M)) > 0)
|
|
2218
|
+
w = 0;
|
|
2219
2219
|
else
|
|
2220
2220
|
break;
|
|
2221
2221
|
}
|
|
2222
2222
|
} else
|
|
2223
|
-
|
|
2223
|
+
w = 0;
|
|
2224
2224
|
}
|
|
2225
|
-
return
|
|
2225
|
+
return Z === 0n && (U = A), { height: O, end: U };
|
|
2226
2226
|
};
|
|
2227
|
-
let { height:
|
|
2228
|
-
if (
|
|
2229
|
-
let
|
|
2230
|
-
for (;
|
|
2231
|
-
|
|
2232
|
-
const
|
|
2233
|
-
if (O +=
|
|
2227
|
+
let { height: W, end: at } = z(p);
|
|
2228
|
+
if (W < t && p > 0n) {
|
|
2229
|
+
let A = p, O = W, M = 0;
|
|
2230
|
+
for (; A > 0n && O < t; ) {
|
|
2231
|
+
A -= 1n;
|
|
2232
|
+
const Z = Number(A), w = i(Z);
|
|
2233
|
+
if (O += w, !Number.isFinite(w) || w < 0)
|
|
2234
2234
|
break;
|
|
2235
|
-
if (
|
|
2236
|
-
if (
|
|
2237
|
-
const lt = Number(
|
|
2235
|
+
if (w === 0) {
|
|
2236
|
+
if (M += 1, M > Oe) {
|
|
2237
|
+
const lt = Number(A);
|
|
2238
2238
|
if (!Number.isSafeInteger(lt))
|
|
2239
2239
|
break;
|
|
2240
|
-
const { cumulative:
|
|
2241
|
-
if (!Number.isFinite(
|
|
2240
|
+
const { cumulative: j } = s.prefixSum(lt, { materializeOption: { materialize: !1 } });
|
|
2241
|
+
if (!Number.isFinite(j))
|
|
2242
2242
|
break;
|
|
2243
|
-
const { index: T } = s.findIndexAtOrAfter(
|
|
2244
|
-
if (
|
|
2245
|
-
|
|
2246
|
-
else if (
|
|
2247
|
-
|
|
2243
|
+
const { index: T } = s.findIndexAtOrAfter(j - 0.5, { materializeOption: { materialize: !1 } }), q = T === -1 ? -1n : Ne(T);
|
|
2244
|
+
if (q >= 0n && q < A)
|
|
2245
|
+
A = q + 1n, M = 0;
|
|
2246
|
+
else if (q === A && A >= 1n && i(Number(A - 1n)) > 0)
|
|
2247
|
+
M = 0;
|
|
2248
2248
|
else
|
|
2249
2249
|
break;
|
|
2250
2250
|
}
|
|
2251
2251
|
} else
|
|
2252
|
-
|
|
2252
|
+
M = 0;
|
|
2253
2253
|
}
|
|
2254
|
-
|
|
2255
|
-
const
|
|
2256
|
-
|
|
2254
|
+
p = b(A);
|
|
2255
|
+
const U = z(p);
|
|
2256
|
+
W = U.height, at = U.end;
|
|
2257
2257
|
}
|
|
2258
|
-
const
|
|
2258
|
+
const Q = b(p), tt = b(at), xt = b(Q - BigInt(Math.max(0, e))), wt = b(tt + BigInt(Math.max(0, e)));
|
|
2259
2259
|
return {
|
|
2260
|
-
renderingStartIndex:
|
|
2261
|
-
renderingEndIndex:
|
|
2262
|
-
visibleStartIndex:
|
|
2263
|
-
visibleEndIndex:
|
|
2260
|
+
renderingStartIndex: St(Number(xt), n),
|
|
2261
|
+
renderingEndIndex: St(Number(wt), n),
|
|
2262
|
+
visibleStartIndex: St(Number(Q), n),
|
|
2263
|
+
visibleEndIndex: St(Number(tt), n)
|
|
2264
2264
|
};
|
|
2265
|
-
},
|
|
2266
|
-
if (
|
|
2265
|
+
}, _r = (r, t, e, n, i, s, a) => {
|
|
2266
|
+
if (n === 0)
|
|
2267
2267
|
return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
|
|
2268
|
-
const c = Number.isFinite(a), d = c ? Math.min(Math.max(0,
|
|
2269
|
-
if (
|
|
2270
|
-
return
|
|
2271
|
-
const { index: b, cumulative:
|
|
2272
|
-
let
|
|
2273
|
-
if (b !== -1 &&
|
|
2274
|
-
|
|
2275
|
-
else if (
|
|
2276
|
-
|
|
2268
|
+
const c = Number.isFinite(a), d = c ? Math.min(Math.max(0, r), a) : Math.max(0, r);
|
|
2269
|
+
if (n >= Number.MAX_SAFE_INTEGER)
|
|
2270
|
+
return Lr(d, t, e, n, i, s, a, c);
|
|
2271
|
+
const { index: b, cumulative: I, currentValue: v } = s.findIndexAtOrAfter(d, { materializeOption: { materialize: !1 } }), C = b === -1 ? t <= 0 || (I ?? 0) < d + (v ?? 0) ? n - 1 : 0 : b;
|
|
2272
|
+
let p = St(C, n), V = 0;
|
|
2273
|
+
if (b !== -1 && I === d)
|
|
2274
|
+
p = St(b + 1, n), V = 0;
|
|
2275
|
+
else if (p === b && I !== void 0 && v !== void 0)
|
|
2276
|
+
V = I - v - d;
|
|
2277
2277
|
else {
|
|
2278
|
-
const { cumulative:
|
|
2279
|
-
|
|
2278
|
+
const { cumulative: A, currentValue: O } = s.prefixSum(p, { materializeOption: { materialize: !1 } });
|
|
2279
|
+
V = (A ?? 0) - (O ?? 0) - d;
|
|
2280
2280
|
}
|
|
2281
|
-
const
|
|
2282
|
-
let
|
|
2283
|
-
for (;
|
|
2284
|
-
const
|
|
2285
|
-
if (
|
|
2281
|
+
const z = V, W = (A, O) => {
|
|
2282
|
+
let M = A, U = O, Z = 0;
|
|
2283
|
+
for (; M < n && U < t; ) {
|
|
2284
|
+
const w = i(M);
|
|
2285
|
+
if (U += w, M++, !Number.isFinite(w) || w < 0)
|
|
2286
2286
|
break;
|
|
2287
|
-
if (
|
|
2288
|
-
if (
|
|
2289
|
-
const { cumulative: lt } = s.prefixSum(
|
|
2290
|
-
if (
|
|
2291
|
-
|
|
2292
|
-
else if (
|
|
2293
|
-
|
|
2287
|
+
if (w === 0) {
|
|
2288
|
+
if (Z++, Z > Oe) {
|
|
2289
|
+
const { cumulative: lt } = s.prefixSum(M - 1, { materializeOption: { materialize: !1 } }), { index: j } = Number.isFinite(lt) ? s.findIndexAtOrAfter(lt + 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
|
|
2290
|
+
if (j > M)
|
|
2291
|
+
M = j, Z = 0;
|
|
2292
|
+
else if (j === M && i(M) > 0)
|
|
2293
|
+
Z = 0;
|
|
2294
2294
|
else
|
|
2295
2295
|
break;
|
|
2296
2296
|
}
|
|
2297
2297
|
} else
|
|
2298
|
-
|
|
2298
|
+
Z = 0;
|
|
2299
2299
|
}
|
|
2300
|
-
return { cursor:
|
|
2301
|
-
},
|
|
2302
|
-
let
|
|
2303
|
-
if (
|
|
2304
|
-
let
|
|
2305
|
-
for (; O >= 0 &&
|
|
2306
|
-
const
|
|
2307
|
-
if (
|
|
2300
|
+
return { cursor: M, height: U };
|
|
2301
|
+
}, at = W(p, V);
|
|
2302
|
+
let Q = at.cursor;
|
|
2303
|
+
if (V = at.height, V < t && p > 0) {
|
|
2304
|
+
let A = V + Math.abs(Math.min(0, z)), O = p - 1, M = 0;
|
|
2305
|
+
for (; O >= 0 && A < t; ) {
|
|
2306
|
+
const Z = i(O);
|
|
2307
|
+
if (A += Z, !Number.isFinite(Z) || Z < 0) {
|
|
2308
2308
|
O--;
|
|
2309
2309
|
break;
|
|
2310
2310
|
}
|
|
2311
|
-
if (
|
|
2312
|
-
if (
|
|
2313
|
-
const { cumulative:
|
|
2311
|
+
if (Z === 0) {
|
|
2312
|
+
if (M++, M > Oe) {
|
|
2313
|
+
const { cumulative: w } = s.prefixSum(O, { materializeOption: { materialize: !1 } }), { index: lt } = Number.isFinite(w) ? s.findIndexAtOrAfter(w - 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
|
|
2314
2314
|
if (lt !== -1 && lt < O) {
|
|
2315
|
-
O = lt,
|
|
2315
|
+
O = lt, M = 0;
|
|
2316
2316
|
continue;
|
|
2317
2317
|
}
|
|
2318
2318
|
if (lt === O && O >= 1 && i(O - 1) > 0)
|
|
2319
|
-
|
|
2319
|
+
M = 0;
|
|
2320
2320
|
else {
|
|
2321
2321
|
O--;
|
|
2322
2322
|
break;
|
|
2323
2323
|
}
|
|
2324
2324
|
}
|
|
2325
2325
|
} else
|
|
2326
|
-
|
|
2326
|
+
M = 0;
|
|
2327
2327
|
O--;
|
|
2328
2328
|
}
|
|
2329
|
-
|
|
2330
|
-
const
|
|
2331
|
-
|
|
2329
|
+
p = St(O + 1, n);
|
|
2330
|
+
const U = W(p, 0);
|
|
2331
|
+
Q = U.cursor, V = U.height;
|
|
2332
2332
|
}
|
|
2333
|
-
const
|
|
2334
|
-
return { renderingStartIndex:
|
|
2335
|
-
},
|
|
2336
|
-
const
|
|
2337
|
-
return
|
|
2333
|
+
const tt = St(p - e, n), xt = St(Math.max(Q - 1, p), n), wt = St(xt + e, n);
|
|
2334
|
+
return { renderingStartIndex: tt, renderingEndIndex: wt, visibleStartIndex: p, visibleEndIndex: xt };
|
|
2335
|
+
}, Qe = (r, t, e) => {
|
|
2336
|
+
const n = Math.max(0, t ?? 0), i = x({ last: 0, id: null, arg: null }).current;
|
|
2337
|
+
return Y(
|
|
2338
2338
|
() => () => {
|
|
2339
|
-
if (i.id !== null && (cancelAnimationFrame(i.id), i.id = null), i.arg !== null &&
|
|
2339
|
+
if (i.id !== null && (cancelAnimationFrame(i.id), i.id = null), i.arg !== null && r.current) {
|
|
2340
2340
|
try {
|
|
2341
|
-
e(
|
|
2341
|
+
e(r.current, i.arg);
|
|
2342
2342
|
} catch (s) {
|
|
2343
2343
|
console.error("[useThrottledInvoker] Error flushing pending callback on unmount", s);
|
|
2344
2344
|
}
|
|
2345
2345
|
i.arg = null;
|
|
2346
2346
|
}
|
|
2347
2347
|
},
|
|
2348
|
-
[i,
|
|
2348
|
+
[i, r, e]
|
|
2349
2349
|
), S(
|
|
2350
2350
|
(s) => {
|
|
2351
2351
|
if (i.arg = s, i.id !== null) return;
|
|
2352
2352
|
const a = (c) => {
|
|
2353
2353
|
if (i.id = null, i.arg === null) return;
|
|
2354
2354
|
const d = c - i.last;
|
|
2355
|
-
if (
|
|
2356
|
-
if (
|
|
2355
|
+
if (n === 0 || i.last === 0 || d >= n) {
|
|
2356
|
+
if (r.current)
|
|
2357
2357
|
try {
|
|
2358
|
-
e(
|
|
2358
|
+
e(r.current, i.arg);
|
|
2359
2359
|
} catch (b) {
|
|
2360
2360
|
console.error("[useThrottledInvoker] Error invoking callback", b);
|
|
2361
2361
|
}
|
|
@@ -2365,17 +2365,17 @@ const Cr = 1e4, Fr = () => {
|
|
|
2365
2365
|
};
|
|
2366
2366
|
i.id = requestAnimationFrame(a);
|
|
2367
2367
|
},
|
|
2368
|
-
[
|
|
2368
|
+
[n, e, r, i]
|
|
2369
2369
|
);
|
|
2370
|
-
},
|
|
2371
|
-
const
|
|
2372
|
-
|
|
2370
|
+
}, Or = nr.memo(({ index: r, top: t, height: e, item: n, children: i, clipItemHeight: s, enableKeyboardNavigation: a, onKeyDown: c, onFocus: d, registerItemRef: b }) => {
|
|
2371
|
+
const I = S((V) => b(r, V), [r, b]), v = S((V) => c(V, r), [r, c]), C = S(() => d(r), [r, d]), p = S((V) => {
|
|
2372
|
+
V.currentTarget.focus({ preventScroll: !0 });
|
|
2373
2373
|
}, []);
|
|
2374
2374
|
return /* @__PURE__ */ ot(
|
|
2375
2375
|
"div",
|
|
2376
2376
|
{
|
|
2377
|
-
ref:
|
|
2378
|
-
"data-index":
|
|
2377
|
+
ref: I,
|
|
2378
|
+
"data-index": r,
|
|
2379
2379
|
"data-virtualscroll-item": "true",
|
|
2380
2380
|
className: "aqvs-item-container",
|
|
2381
2381
|
style: {
|
|
@@ -2384,380 +2384,403 @@ const Cr = 1e4, Fr = () => {
|
|
|
2384
2384
|
overflow: s ? "hidden" : void 0
|
|
2385
2385
|
},
|
|
2386
2386
|
tabIndex: a ? -1 : void 0,
|
|
2387
|
-
onPointerDown: a ?
|
|
2387
|
+
onPointerDown: a ? p : void 0,
|
|
2388
2388
|
onKeyDownCapture: a ? v : void 0,
|
|
2389
|
-
onFocusCapture: a ?
|
|
2390
|
-
children: i(
|
|
2389
|
+
onFocusCapture: a ? C : void 0,
|
|
2390
|
+
children: i(n, r)
|
|
2391
2391
|
}
|
|
2392
2392
|
);
|
|
2393
|
-
}),
|
|
2394
|
-
itemCount:
|
|
2393
|
+
}), kr = ({
|
|
2394
|
+
itemCount: r,
|
|
2395
2395
|
getItem: t,
|
|
2396
2396
|
getItemKey: e,
|
|
2397
|
-
getItemHeight:
|
|
2397
|
+
getItemHeight: n,
|
|
2398
2398
|
viewportSize: i,
|
|
2399
2399
|
overscanCount: s = 15,
|
|
2400
2400
|
className: a,
|
|
2401
2401
|
testId: c,
|
|
2402
2402
|
onScroll: d,
|
|
2403
2403
|
onRangeChange: b,
|
|
2404
|
-
children:
|
|
2404
|
+
children: I,
|
|
2405
2405
|
background: v,
|
|
2406
|
-
initialScrollIndex:
|
|
2407
|
-
initialScrollOffset:
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2406
|
+
initialScrollIndex: C,
|
|
2407
|
+
initialScrollOffset: p,
|
|
2408
|
+
initialScrollAnchor: V,
|
|
2409
|
+
callbackThrottleMs: z = 5,
|
|
2410
|
+
contentInsets: W,
|
|
2411
|
+
onItemFocus: at,
|
|
2412
|
+
scrollBarOptions: Q,
|
|
2413
|
+
behaviorOptions: tt,
|
|
2414
|
+
onWheelHorizontal: xt,
|
|
2415
|
+
contentProps: wt
|
|
2416
|
+
}, A) => {
|
|
2417
|
+
const { width: O, enableThumbDrag: M, enableTrackClick: U, enableArrowButtons: Z, enableScrollToTopBottomButtons: w, renderThumbOverlay: lt, tapScrollCircleOptions: j } = Q ?? {}, { enablePointerDrag: T, pointerDragInputs: q, enableKeyboardNavigation: H = !0, wheelSpeedMultiplier: Ht, inertiaOptions: Dt, clipItemHeight: et = !1, resetOnGetItemHeightChange: nt = !1 } = tt ?? {}, G = x(null), J = x({
|
|
2417
2418
|
renderingStartIndex: 0,
|
|
2418
2419
|
renderingEndIndex: 0,
|
|
2419
2420
|
visibleStartIndex: 0,
|
|
2420
2421
|
visibleEndIndex: 0,
|
|
2421
2422
|
scrollPosition: 0,
|
|
2422
2423
|
totalHeight: 0
|
|
2423
|
-
}),
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
}
|
|
2424
|
+
}), Rt = x(V && r > 0 ? { index: rt(Math.trunc(V.index), 0, r - 1), align: "top", offset: -Math.max(0, V.offsetPx ?? 0) } : null), Lt = x(!1), Wt = x(!0);
|
|
2425
|
+
Y(() => {
|
|
2426
|
+
if (Wt.current) {
|
|
2427
|
+
Wt.current = !1;
|
|
2428
|
+
return;
|
|
2429
|
+
}
|
|
2430
|
+
nt && (Rt.current = null);
|
|
2431
|
+
}, [nt, n]);
|
|
2432
|
+
const R = Ft(() => Ze(W), [W]), [de] = re(() => {
|
|
2433
|
+
const u = V?.index ?? C, m = typeof u == "number" && Number.isFinite(u) ? Math.max(0, Math.trunc(u)) : 0;
|
|
2434
|
+
return { from: Math.max(0, m - 50), to: m + 50 };
|
|
2435
|
+
}), it = Ft(
|
|
2431
2436
|
// 目的: Fenwick Tree のオプション設定
|
|
2432
2437
|
// 依存関係: resetOnGetItemHeightChange, initialSampleRange (マウント時固定)
|
|
2433
2438
|
// itemCount には依存させない (依存させると追記のたびに options 参照が変わり、計測済み高さが全消去される)。
|
|
2434
2439
|
// この useMemo により sampleRange を毎レンダー新規生成しない = 参照同一性由来の破壊的 reset を防ぐ。
|
|
2435
2440
|
() => ({
|
|
2436
|
-
sampleRange:
|
|
2437
|
-
resetOnValueFnChange:
|
|
2441
|
+
sampleRange: de,
|
|
2442
|
+
resetOnValueFnChange: nt,
|
|
2438
2443
|
materialize: !0
|
|
2439
2444
|
}),
|
|
2440
|
-
[
|
|
2441
|
-
),
|
|
2445
|
+
[nt, de]
|
|
2446
|
+
), E = Nr(r, n, it), [Ct] = re(() => {
|
|
2442
2447
|
let l = 0, u = 0;
|
|
2443
|
-
if (
|
|
2444
|
-
const
|
|
2445
|
-
l = Ie(
|
|
2446
|
-
} else typeof
|
|
2448
|
+
if (V && r > 0) {
|
|
2449
|
+
const m = rt(Math.trunc(V.index), 0, r - 1), D = Math.max(0, V.offsetPx ?? 0), _ = rt(m - s * 2, 0, r - 1), F = rt(m + s * 2, 0, r - 1), $ = m > 0 || D > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: _, to: F }] } } : void 0, { cumulative: K, total: yt, currentValue: pt } = E.prefixSum(m, $), ht = Math.max(K - pt + D, 0);
|
|
2450
|
+
l = Ie(ht, R.top), u = yt ?? E.getTotal();
|
|
2451
|
+
} else if (typeof C == "number") {
|
|
2452
|
+
const m = rt(C, 0, r - 1), D = rt(m - s * 2, 0, r - 1), _ = rt(m + s * 2, 0, r - 1), F = C > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: D, to: _ }] } } : void 0, { cumulative: $, total: K, currentValue: yt } = E.prefixSum(C, F), pt = Math.max($ - yt, 0);
|
|
2453
|
+
l = Ie(pt, R.top), u = K ?? E.getTotal();
|
|
2454
|
+
} else typeof p == "number" && (l = Ie(Math.max(p, 0), R.top)), u = E.getTotal();
|
|
2447
2455
|
return { position: l, total: u };
|
|
2448
|
-
}), [
|
|
2449
|
-
|
|
2450
|
-
|
|
2456
|
+
}), [zt, Zt] = re(Ct.position), [$t, h] = re(Ct.total), k = x(Ct.position), gt = x(R.top), X = x(d ?? void 0), vt = x(b ?? void 0), ct = x(/* @__PURE__ */ new Map()), It = x(null), Mt = x(null), [Pt, ut] = re(null), [At, dt] = re(!1), st = x(null), _t = x(!1), Xt = x(0), Et = x(!1), ne = x(!1), jt = x(r);
|
|
2457
|
+
jt.current !== r && (jt.current = r, ne.current = !0), Y(() => {
|
|
2458
|
+
X.current = d ?? void 0, vt.current = b ?? void 0;
|
|
2451
2459
|
}, [b, d]);
|
|
2452
|
-
const
|
|
2460
|
+
const Nt = S(
|
|
2453
2461
|
(l) => {
|
|
2454
|
-
if (
|
|
2462
|
+
if (H && l && typeof l.focus == "function")
|
|
2455
2463
|
try {
|
|
2456
2464
|
l.focus({ preventScroll: !0 });
|
|
2457
2465
|
} catch {
|
|
2458
2466
|
l.focus();
|
|
2459
2467
|
}
|
|
2460
2468
|
},
|
|
2461
|
-
[
|
|
2462
|
-
),
|
|
2463
|
-
l(u,
|
|
2464
|
-
}, []),
|
|
2469
|
+
[H]
|
|
2470
|
+
), f = S((l, { position: u, totalHeight: m }) => {
|
|
2471
|
+
l(u, m);
|
|
2472
|
+
}, []), P = Qe(X, z, f), ft = S((l, u) => {
|
|
2465
2473
|
l(u);
|
|
2466
|
-
}, []),
|
|
2467
|
-
|
|
2468
|
-
const
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
}), []),
|
|
2472
|
-
|
|
2473
|
-
}, [
|
|
2474
|
-
const
|
|
2474
|
+
}, []), Tt = Qe(vt, z, ft), Vt = x(R.top);
|
|
2475
|
+
Vt.current = R.top;
|
|
2476
|
+
const ie = x(P);
|
|
2477
|
+
ie.current = P, Y(() => (Lt.current = !1, () => {
|
|
2478
|
+
Lt.current = !0, st.current && (clearTimeout(st.current), st.current = null);
|
|
2479
|
+
}), []), Y(() => {
|
|
2480
|
+
H || (ct.current.clear(), It.current = null, Mt.current = null);
|
|
2481
|
+
}, [H]);
|
|
2482
|
+
const Jt = S(
|
|
2475
2483
|
(l, u) => {
|
|
2476
2484
|
if (!u) {
|
|
2477
|
-
|
|
2485
|
+
ct.current.delete(l);
|
|
2478
2486
|
return;
|
|
2479
2487
|
}
|
|
2480
|
-
|
|
2488
|
+
H && (ct.current.set(l, u), It.current === l && (It.current = null, Mt.current = l, Nt(u)));
|
|
2481
2489
|
},
|
|
2482
|
-
[
|
|
2483
|
-
), Qt = 0.01,
|
|
2490
|
+
[H, Nt]
|
|
2491
|
+
), Qt = 0.01, Kt = x({
|
|
2484
2492
|
rafId: null,
|
|
2485
2493
|
loopActive: !1,
|
|
2486
2494
|
idleFrames: 0,
|
|
2487
|
-
lastRenderedPosition:
|
|
2488
|
-
}),
|
|
2489
|
-
const l =
|
|
2495
|
+
lastRenderedPosition: Ct.position
|
|
2496
|
+
}), se = S(() => {
|
|
2497
|
+
const l = Kt.current;
|
|
2490
2498
|
l.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(l.rafId), l.rafId = null, l.loopActive = !1, l.idleFrames = 0;
|
|
2491
2499
|
}, []);
|
|
2492
|
-
|
|
2500
|
+
Y(
|
|
2493
2501
|
() => () => {
|
|
2494
|
-
|
|
2502
|
+
se();
|
|
2495
2503
|
},
|
|
2496
|
-
[
|
|
2504
|
+
[se]
|
|
2497
2505
|
);
|
|
2498
|
-
const
|
|
2499
|
-
}),
|
|
2500
|
-
const l =
|
|
2506
|
+
const fe = x(() => {
|
|
2507
|
+
}), Gt = S(() => {
|
|
2508
|
+
const l = Kt.current;
|
|
2501
2509
|
l.rafId = null;
|
|
2502
|
-
const u =
|
|
2503
|
-
if (
|
|
2504
|
-
|
|
2510
|
+
const u = k.current, m = ee(u, Vt.current), D = E.getTotal();
|
|
2511
|
+
if (Zt((F) => Math.abs(F - u) < Qt ? F : u), Math.abs(l.lastRenderedPosition - u) >= Qt ? (ie.current({ position: m, totalHeight: D }), l.lastRenderedPosition = u, l.idleFrames = 0) : l.idleFrames += 1, l.idleFrames >= 2) {
|
|
2512
|
+
se();
|
|
2505
2513
|
return;
|
|
2506
2514
|
}
|
|
2507
2515
|
if (typeof requestAnimationFrame == "function") {
|
|
2508
|
-
l.rafId = requestAnimationFrame((
|
|
2516
|
+
l.rafId = requestAnimationFrame((F) => fe.current(F));
|
|
2509
2517
|
return;
|
|
2510
2518
|
}
|
|
2511
2519
|
l.loopActive = !1;
|
|
2512
|
-
}, [
|
|
2513
|
-
|
|
2514
|
-
const
|
|
2515
|
-
const l =
|
|
2520
|
+
}, [E, se]);
|
|
2521
|
+
fe.current = Gt;
|
|
2522
|
+
const we = S(() => {
|
|
2523
|
+
const l = Kt.current;
|
|
2516
2524
|
if (l.idleFrames = 0, !l.loopActive) {
|
|
2517
2525
|
if (l.loopActive = !0, typeof requestAnimationFrame == "function") {
|
|
2518
|
-
l.rafId = requestAnimationFrame(
|
|
2526
|
+
l.rafId = requestAnimationFrame(Gt);
|
|
2519
2527
|
return;
|
|
2520
2528
|
}
|
|
2521
2529
|
l.loopActive = !1;
|
|
2522
2530
|
}
|
|
2523
|
-
}, [
|
|
2531
|
+
}, [Gt]), mt = S(
|
|
2524
2532
|
(l, u) => {
|
|
2525
|
-
const
|
|
2526
|
-
if (
|
|
2527
|
-
|
|
2533
|
+
const m = u?.immediate ?? !1, D = ee(l, R.top);
|
|
2534
|
+
if (k.current = l, m) {
|
|
2535
|
+
Kt.current.lastRenderedPosition = l, Kt.current.idleFrames = 0, Zt(l), P({ position: D, totalHeight: E.getTotal() });
|
|
2528
2536
|
return;
|
|
2529
2537
|
}
|
|
2530
|
-
|
|
2538
|
+
we();
|
|
2531
2539
|
},
|
|
2532
|
-
[
|
|
2533
|
-
),
|
|
2534
|
-
const u =
|
|
2540
|
+
[we, E, R.top, P]
|
|
2541
|
+
), me = S((l) => {
|
|
2542
|
+
const u = G.current;
|
|
2535
2543
|
if (!u)
|
|
2536
2544
|
return l;
|
|
2537
|
-
const
|
|
2538
|
-
|
|
2539
|
-
const
|
|
2540
|
-
return
|
|
2541
|
-
}, []),
|
|
2542
|
-
|
|
2543
|
-
if (!
|
|
2544
|
-
if (
|
|
2545
|
-
const l = Ie(Math.max(
|
|
2546
|
-
|
|
2545
|
+
const m = u.getScrollPosition();
|
|
2546
|
+
Xt.current += 1;
|
|
2547
|
+
const D = u.scrollTo(l);
|
|
2548
|
+
return D === m && (Xt.current = Math.max(0, Xt.current - 1)), Math.abs(D - l) > 0.5 && (Et.current = !0), D;
|
|
2549
|
+
}, []), Ce = x(!1);
|
|
2550
|
+
Y(() => {
|
|
2551
|
+
if (!Ce.current)
|
|
2552
|
+
if (Ce.current = !0, V == null && typeof C != "number" && typeof p == "number") {
|
|
2553
|
+
const l = Ie(Math.max(p, 0), R.top), u = Math.abs(l - k.current) > 0.5;
|
|
2554
|
+
mt(l, { immediate: !0 }), u && G.current?.scrollTo(l);
|
|
2547
2555
|
} else
|
|
2548
|
-
|
|
2549
|
-
}, [
|
|
2550
|
-
const l =
|
|
2551
|
-
if (
|
|
2552
|
-
|
|
2556
|
+
mt(k.current, { immediate: !0 });
|
|
2557
|
+
}, [V, C, p, R.top, mt]), Y(() => {
|
|
2558
|
+
const l = E.getTotal();
|
|
2559
|
+
if ($t !== l) {
|
|
2560
|
+
h(l);
|
|
2553
2561
|
return;
|
|
2554
2562
|
}
|
|
2555
|
-
if (
|
|
2556
|
-
|
|
2557
|
-
const u =
|
|
2558
|
-
if (u && Math.abs(u.getScrollPosition() -
|
|
2559
|
-
const
|
|
2560
|
-
|
|
2563
|
+
if (Et.current) {
|
|
2564
|
+
Et.current = !1;
|
|
2565
|
+
const u = G.current;
|
|
2566
|
+
if (u && Math.abs(u.getScrollPosition() - k.current) > 0.5) {
|
|
2567
|
+
const m = me(k.current);
|
|
2568
|
+
Et.current = !1, mt(m, { immediate: !0 });
|
|
2561
2569
|
}
|
|
2562
2570
|
}
|
|
2563
|
-
}, [
|
|
2564
|
-
if (
|
|
2565
|
-
const { index: l, align: u, offset:
|
|
2566
|
-
if (
|
|
2567
|
-
const
|
|
2568
|
-
let
|
|
2569
|
-
u === "bottom" ?
|
|
2570
|
-
const
|
|
2571
|
-
Math.abs(
|
|
2572
|
-
from:
|
|
2573
|
-
to:
|
|
2574
|
-
targetIndex:
|
|
2575
|
-
}),
|
|
2571
|
+
}, [E, $t, r, me, mt]), Y(() => {
|
|
2572
|
+
if (Rt.current !== null) {
|
|
2573
|
+
const { index: l, align: u, offset: m } = Rt.current, D = St(l, r), { cumulative: _, currentValue: F } = E.prefixSum(D, { materializeOption: { materialize: !1 } });
|
|
2574
|
+
if (_ !== void 0 && F !== void 0) {
|
|
2575
|
+
const $ = Math.max(_ - F, 0);
|
|
2576
|
+
let K = $;
|
|
2577
|
+
u === "bottom" ? K = _ - i : u === "center" && (K = $ + F / 2 - i / 2), m && (K -= m), K = Math.max(0, K);
|
|
2578
|
+
const yt = Math.max(0, $t + R.top + R.bottom - i), pt = Math.min(Ie(K, R.top), yt);
|
|
2579
|
+
Math.abs(pt - k.current) > 1 && (N.debug("[VirtualScroll] Drift correction", {
|
|
2580
|
+
from: k.current,
|
|
2581
|
+
to: pt,
|
|
2582
|
+
targetIndex: D
|
|
2583
|
+
}), Xt.current === 0 && (Xt.current += 1), G.current?.scrollTo(pt), mt(pt, { immediate: !0 }));
|
|
2576
2584
|
}
|
|
2577
2585
|
}
|
|
2578
|
-
|
|
2579
|
-
}, [
|
|
2580
|
-
const l =
|
|
2581
|
-
if (l ===
|
|
2582
|
-
const u =
|
|
2583
|
-
|
|
2584
|
-
}, [
|
|
2585
|
-
const
|
|
2586
|
+
ne.current = !1;
|
|
2587
|
+
}, [$t, E, r, R.top, mt, i, R.bottom]), Y(() => {
|
|
2588
|
+
const l = gt.current;
|
|
2589
|
+
if (l === R.top) return;
|
|
2590
|
+
const u = ee(k.current, l), m = Ie(u, R.top);
|
|
2591
|
+
gt.current = R.top, k.current = m, G.current?.scrollTo(m), mt(m, { immediate: !0 });
|
|
2592
|
+
}, [R.top, mt]);
|
|
2593
|
+
const ve = S(
|
|
2586
2594
|
(l, u) => {
|
|
2587
|
-
if (
|
|
2595
|
+
if (r === 0)
|
|
2588
2596
|
return;
|
|
2589
|
-
const
|
|
2590
|
-
|
|
2591
|
-
let
|
|
2592
|
-
if (
|
|
2593
|
-
const
|
|
2594
|
-
|
|
2597
|
+
const m = St(l, r), D = E.get(m), _ = u - D, F = E.update(m, u);
|
|
2598
|
+
F !== void 0 && h(F), N.debug("[VirtualScroll] Updated item size manually", { index: m, size: u, total: F });
|
|
2599
|
+
let $ = Rt.current ? Rt.current.index : null;
|
|
2600
|
+
if ($ === null) {
|
|
2601
|
+
const K = k.current, yt = Ze(W).top, pt = ee(K, yt), { index: ht, cumulative: Bt } = E.findIndexAtOrAfter(pt, { materializeOption: { materialize: !1 } });
|
|
2602
|
+
$ = Bt !== void 0 && Bt === pt ? ht + 1 : ht;
|
|
2595
2603
|
}
|
|
2596
|
-
if (
|
|
2597
|
-
const
|
|
2598
|
-
|
|
2604
|
+
if ($ !== -1 && m < $ && _ !== 0) {
|
|
2605
|
+
const K = k.current, yt = K + _;
|
|
2606
|
+
me(yt), mt(yt, { immediate: !0 }), N.debug("[VirtualScroll] Adjusted scroll for layout shift (manual update)", { from: K, to: yt, causedByIndex: m, delta: _, activeVisibleStartIndex: $ });
|
|
2599
2607
|
}
|
|
2600
2608
|
},
|
|
2601
|
-
[
|
|
2602
|
-
),
|
|
2609
|
+
[E, r, me, mt, W]
|
|
2610
|
+
), Ut = S(
|
|
2603
2611
|
(l, u) => {
|
|
2604
|
-
if (!
|
|
2612
|
+
if (!G.current || r === 0)
|
|
2605
2613
|
return;
|
|
2606
|
-
const
|
|
2607
|
-
if (
|
|
2614
|
+
const m = St(l, r), D = St(m - s * 2, r), _ = St(m + s * 2, r), { cumulative: F, total: $, currentValue: K } = E.prefixSum(m, { materializeOption: { materialize: !0, ranges: [{ from: D, to: _ }] } });
|
|
2615
|
+
if (N.debug("[VirtualScroll] Scrolling to index:", m, "ItemBottom:", F, "Total height:", $, "ItemHeight:", K, "safeIndexFrom:", D, "safeIndexTo:", _), !$)
|
|
2608
2616
|
return;
|
|
2609
|
-
const
|
|
2610
|
-
let
|
|
2611
|
-
u?.align === "bottom" ?
|
|
2612
|
-
const
|
|
2613
|
-
|
|
2614
|
-
index:
|
|
2617
|
+
const yt = Math.max(F - K, 0);
|
|
2618
|
+
let pt = yt;
|
|
2619
|
+
u?.align === "bottom" ? pt = F - i : u?.align === "center" && (pt = yt + K / 2 - i / 2), u?.offset && (pt -= u.offset), pt = Math.max(0, pt);
|
|
2620
|
+
const ht = Ie(pt, R.top), Bt = G.current?.getContentSize() ?? $ + R.top + R.bottom, kt = Math.max(0, Bt - i), qt = Math.min(ht, kt);
|
|
2621
|
+
Rt.current = {
|
|
2622
|
+
index: m,
|
|
2615
2623
|
align: u?.align,
|
|
2616
2624
|
offset: u?.offset
|
|
2617
2625
|
};
|
|
2618
|
-
const
|
|
2619
|
-
|
|
2626
|
+
const Re = G.current?.getScrollPosition() ?? -1, Fe = Math.abs(Re - qt) > 0.5;
|
|
2627
|
+
_t.current = !1, Xt.current = 0, Fe && (_t.current = !0, Xt.current += 1, G.current?.scrollTo(qt)), h($), mt(qt, { immediate: !0 }), N.debug("[VirtualScroll] Setting scroll position to:", qt, { original: ht, max: kt });
|
|
2620
2628
|
},
|
|
2621
|
-
[
|
|
2622
|
-
),
|
|
2629
|
+
[E, s, r, R.top, R.bottom, i, mt]
|
|
2630
|
+
), Ve = x(V && r === 0 ? V : null);
|
|
2631
|
+
Y(() => {
|
|
2632
|
+
const l = Ve.current;
|
|
2633
|
+
!l || r === 0 || (Ve.current = null, Ut(rt(Math.trunc(l.index), 0, r - 1), { align: "top", offset: -Math.max(0, l.offsetPx ?? 0) }));
|
|
2634
|
+
}, [r, Ut]);
|
|
2635
|
+
const De = S(
|
|
2623
2636
|
(l) => {
|
|
2624
|
-
if (!
|
|
2637
|
+
if (!G.current || r === 0)
|
|
2625
2638
|
return;
|
|
2626
|
-
const u =
|
|
2627
|
-
|
|
2639
|
+
const u = E.getTotal(), m = rt(Math.floor(l), 0, u), { index: D, cumulative: _, currentValue: F } = E.findIndexAtOrAfter(m, { materializeOption: { materialize: !1 } }), K = (_ ?? 0) - (F ?? 0) - m;
|
|
2640
|
+
Ut(D, { offset: K });
|
|
2628
2641
|
},
|
|
2629
|
-
[
|
|
2630
|
-
),
|
|
2642
|
+
[E, r, Ut]
|
|
2643
|
+
), be = S(() => {
|
|
2644
|
+
if (r === 0)
|
|
2645
|
+
return null;
|
|
2646
|
+
const l = ee(k.current, R.top), { index: u, cumulative: m, currentValue: D } = E.findIndexAtOrAfter(l, { materializeOption: { materialize: !1 } });
|
|
2647
|
+
if (u === -1)
|
|
2648
|
+
return { index: r - 1, offsetPx: 0 };
|
|
2649
|
+
if (m === l)
|
|
2650
|
+
return { index: rt(u + 1, 0, r - 1), offsetPx: 0 };
|
|
2651
|
+
const _ = (m ?? 0) - (D ?? 0);
|
|
2652
|
+
return { index: u, offsetPx: Math.max(0, l - _) };
|
|
2653
|
+
}, [E, r, R.top]), Ae = S(
|
|
2631
2654
|
(l) => {
|
|
2632
|
-
const u =
|
|
2633
|
-
|
|
2634
|
-
const
|
|
2635
|
-
return
|
|
2655
|
+
const u = ee(k.current, R.top), m = typeof l == "function" ? l(u) : l;
|
|
2656
|
+
De(m);
|
|
2657
|
+
const D = G.current?.getScrollPosition(), _ = typeof D == "number" ? D : k.current;
|
|
2658
|
+
return mt(_), _;
|
|
2636
2659
|
},
|
|
2637
|
-
[
|
|
2638
|
-
),
|
|
2660
|
+
[R.top, De, mt]
|
|
2661
|
+
), ke = S(
|
|
2639
2662
|
(l, u) => {
|
|
2640
|
-
|
|
2641
|
-
const
|
|
2642
|
-
|
|
2643
|
-
const
|
|
2644
|
-
if (
|
|
2645
|
-
if (
|
|
2663
|
+
N.debug("[VirtualScroll] Scroll position changed:", l);
|
|
2664
|
+
const m = _t.current;
|
|
2665
|
+
m && (_t.current = !1);
|
|
2666
|
+
const D = Xt.current > 0;
|
|
2667
|
+
if (D && (Xt.current = 0), m || D || ne.current || (Rt.current = null), mt(l), w) {
|
|
2668
|
+
if (m || D)
|
|
2646
2669
|
return;
|
|
2647
|
-
const
|
|
2648
|
-
if (
|
|
2649
|
-
const
|
|
2650
|
-
|
|
2651
|
-
|
|
2670
|
+
const _ = l - u;
|
|
2671
|
+
if (N.debug("[VirtualScroll] Scroll diff:", _, "New:", l, "Prev:", u), Math.abs(_) > 1) {
|
|
2672
|
+
const F = _ > 0 ? "down" : "up";
|
|
2673
|
+
ut(F), dt(!0), N.debug("[VirtualScroll] Showing scroll buttons. Direction:", F), st.current && clearTimeout(st.current), st.current = setTimeout(() => {
|
|
2674
|
+
dt(!1), N.debug("[VirtualScroll] Hiding scroll buttons");
|
|
2652
2675
|
}, 2e3);
|
|
2653
2676
|
}
|
|
2654
2677
|
}
|
|
2655
2678
|
},
|
|
2656
|
-
[
|
|
2657
|
-
),
|
|
2658
|
-
const l =
|
|
2659
|
-
return
|
|
2679
|
+
[mt, w]
|
|
2680
|
+
), oe = Ft(() => ee(zt, R.top), [R.top, zt]), pe = Ft(() => {
|
|
2681
|
+
const l = E.getTotal(), u = _r(oe, i, s, r, n, E, l);
|
|
2682
|
+
return N.debug("[VirtualScroll] Calculated rendering range:", () => ({
|
|
2660
2683
|
...u,
|
|
2661
|
-
scrollPosition:
|
|
2684
|
+
scrollPosition: oe,
|
|
2662
2685
|
renderingContentSize: l,
|
|
2663
2686
|
overscanCount: s,
|
|
2664
2687
|
viewportSize: i
|
|
2665
2688
|
})), u;
|
|
2666
|
-
}, [
|
|
2689
|
+
}, [oe, i, s, r, n, E]), { renderingStartIndex: ae, renderingEndIndex: le, visibleStartIndex: ce, visibleEndIndex: xe } = pe, o = S(
|
|
2667
2690
|
(l, u) => {
|
|
2668
|
-
if (!
|
|
2691
|
+
if (!H || r === 0)
|
|
2669
2692
|
return;
|
|
2670
|
-
const
|
|
2693
|
+
const m = St(l, r);
|
|
2671
2694
|
if (!(u?.ensureVisible ?? !0)) {
|
|
2672
|
-
const
|
|
2673
|
-
|
|
2695
|
+
const kt = ct.current.get(m);
|
|
2696
|
+
kt && (It.current = null, Mt.current = m, Nt(kt));
|
|
2674
2697
|
return;
|
|
2675
2698
|
}
|
|
2676
|
-
const
|
|
2677
|
-
if (
|
|
2678
|
-
|
|
2679
|
-
const
|
|
2680
|
-
|
|
2699
|
+
const _ = E.prefixSum(m, { materializeOption: { materialize: !1 } }), F = _.currentValue, $ = Math.max(_.cumulative - F, 0), K = $ + F, yt = ee(k.current, R.top), pt = yt + i;
|
|
2700
|
+
if ($ < yt || K > pt) {
|
|
2701
|
+
Ut(m);
|
|
2702
|
+
const kt = ct.current.get(m);
|
|
2703
|
+
kt ? (It.current = null, Mt.current = m, Nt(kt)) : It.current = m;
|
|
2681
2704
|
return;
|
|
2682
2705
|
}
|
|
2683
|
-
const
|
|
2684
|
-
if (
|
|
2685
|
-
|
|
2706
|
+
const Bt = ct.current.get(m);
|
|
2707
|
+
if (Bt) {
|
|
2708
|
+
It.current = null, Mt.current = m, Nt(Bt);
|
|
2686
2709
|
return;
|
|
2687
2710
|
}
|
|
2688
|
-
|
|
2711
|
+
It.current = m;
|
|
2689
2712
|
},
|
|
2690
|
-
[
|
|
2691
|
-
),
|
|
2713
|
+
[H, r, E, R.top, Ut, Nt, i]
|
|
2714
|
+
), g = S(
|
|
2692
2715
|
(l, u) => {
|
|
2693
|
-
if (!
|
|
2716
|
+
if (!H || l.defaultPrevented || l.altKey || l.metaKey || l.ctrlKey)
|
|
2694
2717
|
return;
|
|
2695
|
-
const
|
|
2696
|
-
if (
|
|
2697
|
-
const
|
|
2698
|
-
if (
|
|
2718
|
+
const m = l.target;
|
|
2719
|
+
if (m) {
|
|
2720
|
+
const D = m.tagName;
|
|
2721
|
+
if (D === "INPUT" || D === "TEXTAREA" || D === "SELECT" || m.isContentEditable)
|
|
2699
2722
|
return;
|
|
2700
2723
|
}
|
|
2701
2724
|
if (l.key === "ArrowDown") {
|
|
2702
|
-
u <
|
|
2725
|
+
u < r - 1 && (l.preventDefault(), o(u + 1));
|
|
2703
2726
|
return;
|
|
2704
2727
|
}
|
|
2705
2728
|
if (l.key === "ArrowUp") {
|
|
2706
|
-
u > 0 && (l.preventDefault(),
|
|
2729
|
+
u > 0 && (l.preventDefault(), o(u - 1));
|
|
2707
2730
|
return;
|
|
2708
2731
|
}
|
|
2709
2732
|
if (l.key === "PageDown") {
|
|
2710
|
-
if (u <
|
|
2733
|
+
if (u < r - 1) {
|
|
2711
2734
|
l.preventDefault();
|
|
2712
|
-
const { visibleStartIndex:
|
|
2713
|
-
|
|
2735
|
+
const { visibleStartIndex: D, visibleEndIndex: _ } = J.current, F = Math.max(_ - D + 1, 1), $ = Math.max(F, 1), K = St(Math.min(u + $, r - 1), r);
|
|
2736
|
+
o(K);
|
|
2714
2737
|
}
|
|
2715
2738
|
return;
|
|
2716
2739
|
}
|
|
2717
2740
|
if (l.key === "PageUp" && u > 0) {
|
|
2718
2741
|
l.preventDefault();
|
|
2719
|
-
const { visibleStartIndex:
|
|
2720
|
-
|
|
2742
|
+
const { visibleStartIndex: D, visibleEndIndex: _ } = J.current, F = Math.max(_ - D + 1, 1), $ = Math.max(F, 1), K = St(u - $, r);
|
|
2743
|
+
o(K);
|
|
2721
2744
|
}
|
|
2722
2745
|
},
|
|
2723
|
-
[
|
|
2724
|
-
),
|
|
2746
|
+
[H, r, o]
|
|
2747
|
+
), y = S(
|
|
2725
2748
|
(l) => {
|
|
2726
|
-
if (!
|
|
2749
|
+
if (!H)
|
|
2727
2750
|
return;
|
|
2728
|
-
const u =
|
|
2729
|
-
|
|
2751
|
+
const u = St(l, r);
|
|
2752
|
+
It.current = null, Mt.current = u, at?.(u);
|
|
2730
2753
|
},
|
|
2731
|
-
[
|
|
2754
|
+
[H, r, at]
|
|
2732
2755
|
);
|
|
2733
|
-
|
|
2734
|
-
const l =
|
|
2735
|
-
|
|
2736
|
-
renderingStartIndex:
|
|
2737
|
-
renderingEndIndex:
|
|
2738
|
-
visibleStartIndex:
|
|
2739
|
-
visibleEndIndex:
|
|
2740
|
-
scrollPositionState:
|
|
2756
|
+
Y(() => {
|
|
2757
|
+
const l = G.current?.getScrollPosition() ?? 0, u = k.current, m = ee(u, R.top);
|
|
2758
|
+
N.debug("[VirtualScroll] Range change effect triggered", () => ({
|
|
2759
|
+
renderingStartIndex: ae,
|
|
2760
|
+
renderingEndIndex: le,
|
|
2761
|
+
visibleStartIndex: ce,
|
|
2762
|
+
visibleEndIndex: xe,
|
|
2763
|
+
scrollPositionState: zt,
|
|
2741
2764
|
paneScrollPosition: u,
|
|
2742
|
-
logicalScrollPosition:
|
|
2743
|
-
contentSize:
|
|
2765
|
+
logicalScrollPosition: m,
|
|
2766
|
+
contentSize: $t,
|
|
2744
2767
|
scrollPaneScrollPosition: l
|
|
2745
|
-
})),
|
|
2746
|
-
renderingStartIndex:
|
|
2747
|
-
renderingEndIndex:
|
|
2748
|
-
visibleStartIndex:
|
|
2749
|
-
visibleEndIndex:
|
|
2750
|
-
scrollPosition:
|
|
2751
|
-
totalHeight:
|
|
2768
|
+
})), Tt({
|
|
2769
|
+
renderingStartIndex: ae,
|
|
2770
|
+
renderingEndIndex: le,
|
|
2771
|
+
visibleStartIndex: ce,
|
|
2772
|
+
visibleEndIndex: xe,
|
|
2773
|
+
scrollPosition: m,
|
|
2774
|
+
totalHeight: $t
|
|
2752
2775
|
});
|
|
2753
|
-
}, [
|
|
2754
|
-
const
|
|
2776
|
+
}, [$t, le, ae, R.top, Tt, zt, xe, ce]);
|
|
2777
|
+
const L = S(() => w ? /* @__PURE__ */ ot("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": At && Pt !== null, children: Pt === "up" ? /* @__PURE__ */ ot("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ ot(
|
|
2755
2778
|
"button",
|
|
2756
2779
|
{
|
|
2757
2780
|
type: "button",
|
|
2758
2781
|
className: "aqvs-scroll-to-edge-button",
|
|
2759
|
-
onClick: (
|
|
2760
|
-
|
|
2782
|
+
onClick: (m) => {
|
|
2783
|
+
m.stopPropagation(), _t.current = !0, Ut(0), dt(!1);
|
|
2761
2784
|
},
|
|
2762
2785
|
children: "Top"
|
|
2763
2786
|
}
|
|
@@ -2766,199 +2789,200 @@ const Cr = 1e4, Fr = () => {
|
|
|
2766
2789
|
{
|
|
2767
2790
|
type: "button",
|
|
2768
2791
|
className: "aqvs-scroll-to-edge-button",
|
|
2769
|
-
onClick: (
|
|
2770
|
-
|
|
2792
|
+
onClick: (m) => {
|
|
2793
|
+
m.stopPropagation(), _t.current = !0, Ut(r - 1), dt(!1);
|
|
2771
2794
|
},
|
|
2772
2795
|
children: "Bottom"
|
|
2773
2796
|
}
|
|
2774
|
-
) }) }) : null, [
|
|
2775
|
-
if (
|
|
2797
|
+
) }) }) : null, [w, At, Pt, Ut, r]), B = x(0), { visibleItems: bt, renderAnchor: Ot } = Ft(() => {
|
|
2798
|
+
if (r === 0)
|
|
2776
2799
|
return {
|
|
2777
2800
|
visibleItems: /* @__PURE__ */ ot("div", { className: "aqvs-no-items-container", children: /* @__PURE__ */ ot("div", { className: "aqvs-no-items-text", children: "No items" }) }),
|
|
2778
2801
|
renderAnchor: 0
|
|
2779
2802
|
};
|
|
2780
|
-
const l =
|
|
2781
|
-
Number.isFinite(
|
|
2782
|
-
const
|
|
2783
|
-
let
|
|
2784
|
-
for (let
|
|
2785
|
-
if (
|
|
2786
|
-
|
|
2803
|
+
const l = St(ae, r), u = St(le, r), { cumulative: m, currentValue: D } = E.prefixSum(l, { materializeOption: { materialize: !1 } }), _ = m - D;
|
|
2804
|
+
Number.isFinite(_) && Math.abs(_ - B.current) > Ar && (B.current = _);
|
|
2805
|
+
const F = B.current, $ = [], K = [];
|
|
2806
|
+
let yt = 0, pt = _;
|
|
2807
|
+
for (let ht = l; ht <= u; ht++) {
|
|
2808
|
+
if (K.length >= Je) {
|
|
2809
|
+
N.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.", { cap: Je, safeRenderingStartIndex: l, safeRenderingEndIndex: u });
|
|
2787
2810
|
break;
|
|
2788
2811
|
}
|
|
2789
|
-
const
|
|
2790
|
-
|
|
2791
|
-
const
|
|
2792
|
-
|
|
2812
|
+
const Bt = n(ht), kt = E.get(ht), qt = Bt - kt;
|
|
2813
|
+
qt !== 0 && $.push({ index: ht, value: Bt });
|
|
2814
|
+
const Re = pt + yt, Fe = e ? e(ht) : ht;
|
|
2815
|
+
K.push(
|
|
2793
2816
|
/* @__PURE__ */ ot(
|
|
2794
|
-
|
|
2817
|
+
Or,
|
|
2795
2818
|
{
|
|
2796
|
-
index:
|
|
2797
|
-
top:
|
|
2798
|
-
height:
|
|
2799
|
-
item: t(
|
|
2800
|
-
clipItemHeight:
|
|
2801
|
-
enableKeyboardNavigation:
|
|
2802
|
-
onKeyDown:
|
|
2803
|
-
onFocus:
|
|
2804
|
-
registerItemRef:
|
|
2805
|
-
children:
|
|
2819
|
+
index: ht,
|
|
2820
|
+
top: Re - F,
|
|
2821
|
+
height: Bt,
|
|
2822
|
+
item: t(ht),
|
|
2823
|
+
clipItemHeight: et,
|
|
2824
|
+
enableKeyboardNavigation: H,
|
|
2825
|
+
onKeyDown: g,
|
|
2826
|
+
onFocus: y,
|
|
2827
|
+
registerItemRef: Jt,
|
|
2828
|
+
children: I
|
|
2806
2829
|
},
|
|
2807
|
-
|
|
2830
|
+
Fe
|
|
2808
2831
|
)
|
|
2809
|
-
),
|
|
2832
|
+
), yt += qt, pt += kt;
|
|
2810
2833
|
}
|
|
2811
|
-
return
|
|
2812
|
-
if (
|
|
2834
|
+
return $.length > 0 && Promise.resolve().then(() => {
|
|
2835
|
+
if (Lt.current)
|
|
2813
2836
|
return;
|
|
2814
|
-
let
|
|
2815
|
-
for (const
|
|
2816
|
-
if (
|
|
2817
|
-
const
|
|
2818
|
-
|
|
2837
|
+
let ht = 0;
|
|
2838
|
+
for (const qt of $)
|
|
2839
|
+
if (qt.index < ce) {
|
|
2840
|
+
const Re = E.get(qt.index);
|
|
2841
|
+
ht += qt.value - Re;
|
|
2819
2842
|
}
|
|
2820
|
-
const
|
|
2821
|
-
if (
|
|
2843
|
+
const Bt = E.updates($);
|
|
2844
|
+
if (Lt.current || typeof Bt != "number")
|
|
2822
2845
|
return;
|
|
2823
|
-
|
|
2824
|
-
const
|
|
2825
|
-
if (
|
|
2826
|
-
const
|
|
2827
|
-
|
|
2828
|
-
} else
|
|
2829
|
-
}), { visibleItems:
|
|
2846
|
+
h(Bt), N.debug("[VirtualScroll] Updated heights for items", $, "New total height:", Bt);
|
|
2847
|
+
const kt = G.current?.getScrollPosition() ?? k.current;
|
|
2848
|
+
if (ht !== 0) {
|
|
2849
|
+
const qt = kt + ht;
|
|
2850
|
+
me(qt), mt(qt, { immediate: !0 }), N.debug("[VirtualScroll] Adjusted scroll for layout shift (auto update)", { from: kt, to: qt, shiftAmount: ht });
|
|
2851
|
+
} else kt !== k.current && mt(kt);
|
|
2852
|
+
}), { visibleItems: K, renderAnchor: F };
|
|
2830
2853
|
}, [
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2854
|
+
I,
|
|
2855
|
+
et,
|
|
2856
|
+
$t,
|
|
2857
|
+
H,
|
|
2858
|
+
r,
|
|
2859
|
+
E,
|
|
2837
2860
|
t,
|
|
2838
2861
|
e,
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
]),
|
|
2862
|
+
n,
|
|
2863
|
+
y,
|
|
2864
|
+
g,
|
|
2865
|
+
me,
|
|
2866
|
+
Jt,
|
|
2867
|
+
le,
|
|
2868
|
+
ae,
|
|
2869
|
+
mt,
|
|
2870
|
+
ce
|
|
2871
|
+
]), Yt = S(
|
|
2849
2872
|
(l) => {
|
|
2850
|
-
const u = (
|
|
2851
|
-
if (
|
|
2873
|
+
const u = (z ?? 0) > 0, m = Math.abs(l - zt), D = u && m > 0.5 ? zt : l, _ = ee(D, R.top);
|
|
2874
|
+
if (N.debug("[VirtualScroll] Rendering visible items", () => ({
|
|
2852
2875
|
currentScrollPosition: l,
|
|
2853
|
-
effectiveScrollPosition:
|
|
2854
|
-
renderingStartIndex:
|
|
2855
|
-
renderingEndIndex:
|
|
2856
|
-
itemCount:
|
|
2876
|
+
effectiveScrollPosition: _,
|
|
2877
|
+
renderingStartIndex: ae,
|
|
2878
|
+
renderingEndIndex: le,
|
|
2879
|
+
itemCount: r,
|
|
2857
2880
|
viewportSize: i,
|
|
2858
|
-
callbackThrottleMs:
|
|
2859
|
-
diff:
|
|
2860
|
-
rawEffectiveScrollPosition:
|
|
2861
|
-
})),
|
|
2862
|
-
return
|
|
2863
|
-
const
|
|
2881
|
+
callbackThrottleMs: z,
|
|
2882
|
+
diff: m,
|
|
2883
|
+
rawEffectiveScrollPosition: D
|
|
2884
|
+
})), r === 0)
|
|
2885
|
+
return bt;
|
|
2886
|
+
const F = R.top + Ot - D, $ = R.bottom > 0 ? /* @__PURE__ */ ot(
|
|
2864
2887
|
"div",
|
|
2865
2888
|
{
|
|
2866
2889
|
className: "aqvs-bottom-inset",
|
|
2867
2890
|
style: {
|
|
2868
2891
|
// ラッパー座標での bottom インセット位置 = コンテンツ総高さ (最終行の下端) - アンカー。
|
|
2869
|
-
top:
|
|
2870
|
-
height:
|
|
2892
|
+
top: E.getTotal() - Ot,
|
|
2893
|
+
height: R.bottom
|
|
2871
2894
|
}
|
|
2872
2895
|
},
|
|
2873
2896
|
"virtualscroll-bottom-inset"
|
|
2874
2897
|
) : null;
|
|
2875
|
-
return
|
|
2876
|
-
containerTop:
|
|
2877
|
-
logicalScrollPosition:
|
|
2878
|
-
resolvedInsets:
|
|
2879
|
-
effectiveScrollPosition:
|
|
2880
|
-
})), /* @__PURE__ */
|
|
2881
|
-
|
|
2882
|
-
|
|
2898
|
+
return N.debug("[VirtualScroll] Rendering items", () => ({
|
|
2899
|
+
containerTop: F,
|
|
2900
|
+
logicalScrollPosition: oe,
|
|
2901
|
+
resolvedInsets: R,
|
|
2902
|
+
effectiveScrollPosition: _
|
|
2903
|
+
})), /* @__PURE__ */ Se("div", { className: "aqvs-items-wrapper", style: { top: 0, transform: `translateY(${F}px)`, willChange: "transform" }, children: [
|
|
2904
|
+
bt,
|
|
2905
|
+
$
|
|
2883
2906
|
] });
|
|
2884
2907
|
},
|
|
2885
|
-
[
|
|
2886
|
-
),
|
|
2908
|
+
[z, r, E, oe, Ot, le, ae, R, zt, i, bt]
|
|
2909
|
+
), Me = Ft(
|
|
2887
2910
|
() => ({
|
|
2888
|
-
renderingStartIndex:
|
|
2889
|
-
renderingEndIndex:
|
|
2890
|
-
visibleStartIndex:
|
|
2891
|
-
visibleEndIndex:
|
|
2892
|
-
scrollPosition:
|
|
2893
|
-
totalHeight:
|
|
2911
|
+
renderingStartIndex: pe.renderingStartIndex,
|
|
2912
|
+
renderingEndIndex: pe.renderingEndIndex,
|
|
2913
|
+
visibleStartIndex: pe.visibleStartIndex,
|
|
2914
|
+
visibleEndIndex: pe.visibleEndIndex,
|
|
2915
|
+
scrollPosition: oe,
|
|
2916
|
+
totalHeight: E.getTotal()
|
|
2894
2917
|
// contentSize (State) ではなく最新値を反映
|
|
2895
2918
|
}),
|
|
2896
2919
|
// contentSize を依存に含めることで、updateItemSize/updates 等で木の総高さが変わった際に
|
|
2897
2920
|
// (fenwickTree は安定参照のため getTotal() の変化だけでは再計算されない) 総高さを再取得する。
|
|
2898
|
-
[
|
|
2921
|
+
[pe, oe, E, $t]
|
|
2899
2922
|
);
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
}, [
|
|
2903
|
-
|
|
2923
|
+
Y(() => {
|
|
2924
|
+
J.current = Me;
|
|
2925
|
+
}, [Me]), Ue(
|
|
2926
|
+
A,
|
|
2904
2927
|
() => ({
|
|
2905
|
-
getScrollPosition: () =>
|
|
2906
|
-
getContentSize: () =>
|
|
2907
|
-
getViewportSize: () =>
|
|
2908
|
-
scrollTo:
|
|
2909
|
-
scrollToIndex:
|
|
2910
|
-
getFenwickTreeTotalHeight: () =>
|
|
2911
|
-
getFenwickSize: () =>
|
|
2912
|
-
focusItemAtIndex:
|
|
2913
|
-
getRange: () =>
|
|
2914
|
-
|
|
2928
|
+
getScrollPosition: () => G.current?.getScrollPosition() ?? -1,
|
|
2929
|
+
getContentSize: () => G.current?.getContentSize() ?? -1,
|
|
2930
|
+
getViewportSize: () => G.current?.getViewportSize() ?? -1,
|
|
2931
|
+
scrollTo: Ae,
|
|
2932
|
+
scrollToIndex: Ut,
|
|
2933
|
+
getFenwickTreeTotalHeight: () => E.getTotal(),
|
|
2934
|
+
getFenwickSize: () => E.getSize(),
|
|
2935
|
+
focusItemAtIndex: o,
|
|
2936
|
+
getRange: () => J.current,
|
|
2937
|
+
getScrollAnchor: be,
|
|
2938
|
+
updateItemSize: ve
|
|
2915
2939
|
}),
|
|
2916
|
-
[
|
|
2940
|
+
[Ae, Ut, E, o, be, ve]
|
|
2917
2941
|
);
|
|
2918
|
-
const
|
|
2942
|
+
const ue = E.getTotal() + R.top + R.bottom;
|
|
2919
2943
|
return /* @__PURE__ */ ot(
|
|
2920
|
-
|
|
2944
|
+
wr,
|
|
2921
2945
|
{
|
|
2922
|
-
ref:
|
|
2923
|
-
contentSize:
|
|
2946
|
+
ref: G,
|
|
2947
|
+
contentSize: ue,
|
|
2924
2948
|
viewportSize: i,
|
|
2925
2949
|
className: a,
|
|
2926
2950
|
testId: c,
|
|
2927
|
-
onScroll:
|
|
2951
|
+
onScroll: ke,
|
|
2928
2952
|
background: v,
|
|
2929
|
-
tapScrollCircleOptions:
|
|
2930
|
-
inertiaOptions:
|
|
2931
|
-
itemCount:
|
|
2932
|
-
scrollBarWidth:
|
|
2933
|
-
enableThumbDrag:
|
|
2934
|
-
enableTrackClick:
|
|
2935
|
-
enableArrowButtons:
|
|
2936
|
-
enablePointerDrag:
|
|
2937
|
-
pointerDragInputs:
|
|
2938
|
-
renderThumbOverlay:
|
|
2939
|
-
wheelSpeedMultiplier:
|
|
2940
|
-
onWheelHorizontal:
|
|
2941
|
-
contentInsets:
|
|
2942
|
-
contentProps:
|
|
2943
|
-
visibleStartIndex:
|
|
2944
|
-
visibleEndIndex:
|
|
2945
|
-
renderOverlay:
|
|
2946
|
-
initialScrollPosition:
|
|
2947
|
-
children:
|
|
2953
|
+
tapScrollCircleOptions: j,
|
|
2954
|
+
inertiaOptions: Dt,
|
|
2955
|
+
itemCount: r,
|
|
2956
|
+
scrollBarWidth: O,
|
|
2957
|
+
enableThumbDrag: M,
|
|
2958
|
+
enableTrackClick: U,
|
|
2959
|
+
enableArrowButtons: Z,
|
|
2960
|
+
enablePointerDrag: T,
|
|
2961
|
+
pointerDragInputs: q,
|
|
2962
|
+
renderThumbOverlay: lt,
|
|
2963
|
+
wheelSpeedMultiplier: Ht,
|
|
2964
|
+
onWheelHorizontal: xt,
|
|
2965
|
+
contentInsets: R,
|
|
2966
|
+
contentProps: wt,
|
|
2967
|
+
visibleStartIndex: ce,
|
|
2968
|
+
visibleEndIndex: xe,
|
|
2969
|
+
renderOverlay: L,
|
|
2970
|
+
initialScrollPosition: Ct.position,
|
|
2971
|
+
children: Yt
|
|
2948
2972
|
}
|
|
2949
2973
|
);
|
|
2950
|
-
},
|
|
2974
|
+
}, Hr = $e(kr);
|
|
2951
2975
|
export {
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2976
|
+
ge as FenwickMapTree,
|
|
2977
|
+
Mr as ScrollBar,
|
|
2978
|
+
wr as ScrollPane,
|
|
2979
|
+
rr as TAP_SCROLL_SPEED_DEFAULTS,
|
|
2980
|
+
Hr as VirtualScroll,
|
|
2981
|
+
vr as computeAutoTapScrollMaxSpeedMultiplier,
|
|
2982
|
+
Sr as computeTapScrollSpeed,
|
|
2983
|
+
rt as minmax,
|
|
2984
|
+
Br as tapScrollCircleSampleVisual,
|
|
2985
|
+
Nr as useFenwickMapTree,
|
|
2986
|
+
qr as useHeightCache,
|
|
2987
|
+
Vr as useLruCache
|
|
2964
2988
|
};
|