@aiquants/virtualscroll 2.7.0 → 3.1.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 +54 -0
- package/README.md +78 -10
- package/dist/VirtualScroll.d.cts +103 -9
- package/dist/VirtualScroll.d.ts +103 -9
- package/dist/VirtualScroll.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1571 -1512
- package/dist/residualQuantizer.d.cts +95 -0
- package/dist/residualQuantizer.d.ts +96 -0
- package/dist/residualQuantizer.d.ts.map +1 -0
- package/dist/styles/virtualscroll.css +1 -1
- package/dist/styles/virtualscroll.standalone.css +1 -1
- package/package.json +1 -1
- package/src/VirtualScroll.tsx +237 -44
- package/src/index.ts +3 -0
- package/src/residualQuantizer.ts +133 -0
- package/src/styles/virtualscroll.css +15 -0
package/dist/index.js
CHANGED
|
@@ -1,7 +1,26 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { twMerge as
|
|
4
|
-
|
|
1
|
+
import { jsx as ie, jsxs as Tt, Fragment as rr } from "react/jsx-runtime";
|
|
2
|
+
import Er, { memo as Nr, forwardRef as nr, useState as Je, useRef as g, useCallback as S, useImperativeHandle as ir, useMemo as _e, useLayoutEffect as et, useEffect as X, useId as Vr } from "react";
|
|
3
|
+
import { twMerge as Vt } from "tailwind-merge";
|
|
4
|
+
const bn = (r) => {
|
|
5
|
+
const { quantum: e, resetOnDirectionChange: t = !0 } = r;
|
|
6
|
+
if (!(Number.isFinite(e) && e > 0))
|
|
7
|
+
throw new TypeError(`[createResidualQuantizer] quantum must be a finite positive number, received ${e}`);
|
|
8
|
+
let n = 0;
|
|
9
|
+
return {
|
|
10
|
+
push: (i) => {
|
|
11
|
+
if (!Number.isFinite(i) || Math.abs(i) > Number.MAX_SAFE_INTEGER)
|
|
12
|
+
return 0;
|
|
13
|
+
t && n !== 0 && i !== 0 && Math.sign(i) !== Math.sign(n) && (n = 0), n += i;
|
|
14
|
+
const s = Math.trunc(n / e) * e + 0;
|
|
15
|
+
return n -= s, s;
|
|
16
|
+
},
|
|
17
|
+
peekResidue: () => n,
|
|
18
|
+
reset: () => {
|
|
19
|
+
n = 0;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
class P {
|
|
5
24
|
level;
|
|
6
25
|
prefix;
|
|
7
26
|
impl;
|
|
@@ -14,7 +33,7 @@ class T {
|
|
|
14
33
|
constructor(e = 2, t = "[virtualscroll]", n = console) {
|
|
15
34
|
this.level = e, this.prefix = t, this.impl = n;
|
|
16
35
|
}
|
|
17
|
-
static instance = new
|
|
36
|
+
static instance = new P(2, "[virtualscroll]");
|
|
18
37
|
/**
|
|
19
38
|
* @method setLevel
|
|
20
39
|
* @description Updates the current log level for the static instance.
|
|
@@ -22,7 +41,7 @@ class T {
|
|
|
22
41
|
* @param {LogLevel} level - The new log level.
|
|
23
42
|
*/
|
|
24
43
|
static setLevel(e) {
|
|
25
|
-
|
|
44
|
+
P.instance.setLevel(e);
|
|
26
45
|
}
|
|
27
46
|
/**
|
|
28
47
|
* @method setLevel
|
|
@@ -40,7 +59,7 @@ class T {
|
|
|
40
59
|
* @param {ILogger} impl - The new logger implementation.
|
|
41
60
|
*/
|
|
42
61
|
static setImplementation(e) {
|
|
43
|
-
|
|
62
|
+
P.instance.setImplementation(e);
|
|
44
63
|
}
|
|
45
64
|
/**
|
|
46
65
|
* @method setImplementation
|
|
@@ -58,7 +77,7 @@ class T {
|
|
|
58
77
|
* @param {string} prefix - The new prefix.
|
|
59
78
|
*/
|
|
60
79
|
static setPrefix(e) {
|
|
61
|
-
|
|
80
|
+
P.instance.setPrefix(e);
|
|
62
81
|
}
|
|
63
82
|
/**
|
|
64
83
|
* @method setPrefix
|
|
@@ -77,7 +96,7 @@ class T {
|
|
|
77
96
|
* @returns {boolean} True if a message at `level` would be emitted. / `level` のメッセージが出力されるなら true。
|
|
78
97
|
*/
|
|
79
98
|
static isEnabled(e) {
|
|
80
|
-
return
|
|
99
|
+
return P.instance.isEnabled(e);
|
|
81
100
|
}
|
|
82
101
|
/**
|
|
83
102
|
* @method isEnabled
|
|
@@ -122,41 +141,41 @@ class T {
|
|
|
122
141
|
return typeof e == "string" ? [`${this.prefix} ${e}`] : [this.prefix, e];
|
|
123
142
|
}
|
|
124
143
|
static debug(e, ...t) {
|
|
125
|
-
|
|
144
|
+
P.instance.debug(e, ...t);
|
|
126
145
|
}
|
|
127
146
|
debug(e, ...t) {
|
|
128
|
-
this.level <= 0 && this.impl.debug(...this.formatMessage(
|
|
147
|
+
this.level <= 0 && this.impl.debug(...this.formatMessage(P.resolveLazy(e)), ...t.map(P.resolveLazy));
|
|
129
148
|
}
|
|
130
149
|
static info(e, ...t) {
|
|
131
|
-
|
|
150
|
+
P.instance.info(e, ...t);
|
|
132
151
|
}
|
|
133
152
|
info(e, ...t) {
|
|
134
|
-
this.level <= 1 && this.impl.info(...this.formatMessage(
|
|
153
|
+
this.level <= 1 && this.impl.info(...this.formatMessage(P.resolveLazy(e)), ...t.map(P.resolveLazy));
|
|
135
154
|
}
|
|
136
155
|
static warn(e, ...t) {
|
|
137
|
-
|
|
156
|
+
P.instance.warn(e, ...t);
|
|
138
157
|
}
|
|
139
158
|
warn(e, ...t) {
|
|
140
|
-
this.level <= 2 && this.impl.warn(...this.formatMessage(
|
|
159
|
+
this.level <= 2 && this.impl.warn(...this.formatMessage(P.resolveLazy(e)), ...t.map(P.resolveLazy));
|
|
141
160
|
}
|
|
142
161
|
static error(e, ...t) {
|
|
143
|
-
|
|
162
|
+
P.instance.error(e, ...t);
|
|
144
163
|
}
|
|
145
164
|
error(e, ...t) {
|
|
146
|
-
this.level <= 3 && this.impl.error(...this.formatMessage(
|
|
165
|
+
this.level <= 3 && this.impl.error(...this.formatMessage(P.resolveLazy(e)), ...t.map(P.resolveLazy));
|
|
147
166
|
}
|
|
148
167
|
}
|
|
149
|
-
const
|
|
168
|
+
const fr = {
|
|
150
169
|
active: !1,
|
|
151
170
|
offsetX: 0,
|
|
152
171
|
offsetY: 0,
|
|
153
172
|
distance: 0,
|
|
154
173
|
direction: 0,
|
|
155
174
|
pointerId: null
|
|
156
|
-
},
|
|
175
|
+
}, jt = 6, zr = 8, Cr = ({ dragState: r, normalizedDistance: e }) => {
|
|
157
176
|
const t = 1 + e * 0.18, n = 0.16 + e * 0.24, i = 0.38 + e * 0.28, s = r.active ? "80ms ease-out" : "220ms ease";
|
|
158
|
-
return /* @__PURE__ */
|
|
159
|
-
/* @__PURE__ */
|
|
177
|
+
return /* @__PURE__ */ Tt(rr, { children: [
|
|
178
|
+
/* @__PURE__ */ ie(
|
|
160
179
|
"div",
|
|
161
180
|
{
|
|
162
181
|
className: "aqvs-tap-scroll-circle-visual-outer",
|
|
@@ -168,7 +187,7 @@ const rr = {
|
|
|
168
187
|
}
|
|
169
188
|
}
|
|
170
189
|
),
|
|
171
|
-
/* @__PURE__ */
|
|
190
|
+
/* @__PURE__ */ ie(
|
|
172
191
|
"div",
|
|
173
192
|
{
|
|
174
193
|
className: "aqvs-tap-scroll-circle-inner",
|
|
@@ -181,154 +200,154 @@ const rr = {
|
|
|
181
200
|
}
|
|
182
201
|
)
|
|
183
202
|
] });
|
|
184
|
-
},
|
|
185
|
-
|
|
186
|
-
const [
|
|
187
|
-
(
|
|
188
|
-
b(
|
|
203
|
+
}, Sr = Nr(
|
|
204
|
+
nr(({ onDragChange: r, className: e, maxVisualDistance: t = 160, size: n = 40, style: i, opacity: s = 1, renderVisual: l }, d) => {
|
|
205
|
+
const [m, b] = Je(fr), v = g(null), T = g(null), C = g({ x: 0, y: 0 }), h = g(null), O = g(0), W = S(
|
|
206
|
+
(I) => {
|
|
207
|
+
b(I), r(I);
|
|
189
208
|
},
|
|
190
209
|
[r]
|
|
191
|
-
),
|
|
192
|
-
(
|
|
193
|
-
const { x:
|
|
194
|
-
let
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
active:
|
|
198
|
-
offsetX:
|
|
199
|
-
offsetY:
|
|
200
|
-
distance:
|
|
201
|
-
direction:
|
|
202
|
-
pointerId:
|
|
210
|
+
), D = S(
|
|
211
|
+
(I, G, fe = !1) => {
|
|
212
|
+
const { x: $e, y: Ue } = C.current, z = I - $e, ke = G - Ue, We = Math.abs(ke), Ve = We < jt ? 0 : ke < 0 ? -1 : 1, Fe = O.current;
|
|
213
|
+
let Ke = Ve;
|
|
214
|
+
const De = jt + zr;
|
|
215
|
+
Ve === 0 ? Fe !== 0 && We < De ? Ke = Fe : (Ke = 0, fe || (O.current = 0)) : Ve !== Fe && Fe !== 0 && We < De ? Ke = Fe : O.current = Ve, W({
|
|
216
|
+
active: fe || We >= jt,
|
|
217
|
+
offsetX: z,
|
|
218
|
+
offsetY: ke,
|
|
219
|
+
distance: We,
|
|
220
|
+
direction: Ke,
|
|
221
|
+
pointerId: v.current
|
|
203
222
|
});
|
|
204
223
|
},
|
|
205
|
-
[
|
|
206
|
-
),
|
|
207
|
-
if (
|
|
224
|
+
[W]
|
|
225
|
+
), ce = S((I) => {
|
|
226
|
+
if (I === null)
|
|
208
227
|
return;
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
}, []),
|
|
212
|
-
(
|
|
213
|
-
|
|
228
|
+
const G = h.current;
|
|
229
|
+
G?.hasPointerCapture(I) && G.releasePointerCapture(I);
|
|
230
|
+
}, []), ue = S(
|
|
231
|
+
(I = !1) => {
|
|
232
|
+
I && ce(v.current), v.current = null, T.current = null, O.current = 0, W(fr);
|
|
214
233
|
},
|
|
215
|
-
[
|
|
216
|
-
),
|
|
217
|
-
(
|
|
218
|
-
if (
|
|
219
|
-
|
|
234
|
+
[W, ce]
|
|
235
|
+
), re = S(
|
|
236
|
+
(I) => {
|
|
237
|
+
if (v.current !== null && v.current !== I.pointerId) {
|
|
238
|
+
T.current = { pointerId: I.pointerId, clientX: I.clientX, clientY: I.clientY }, I.preventDefault(), I.stopPropagation();
|
|
220
239
|
return;
|
|
221
240
|
}
|
|
222
|
-
|
|
223
|
-
const
|
|
224
|
-
|
|
241
|
+
I.preventDefault(), I.stopPropagation();
|
|
242
|
+
const G = h.current ?? I.currentTarget, { left: fe, top: $e, width: Ue, height: z } = G.getBoundingClientRect();
|
|
243
|
+
C.current = { x: fe + Ue / 2, y: $e + z / 2 }, v.current = I.pointerId;
|
|
225
244
|
try {
|
|
226
|
-
|
|
245
|
+
G.setPointerCapture(I.pointerId);
|
|
227
246
|
} catch {
|
|
228
247
|
}
|
|
229
|
-
|
|
248
|
+
D(I.clientX, I.clientY, !0);
|
|
230
249
|
},
|
|
231
|
-
[
|
|
232
|
-
),
|
|
233
|
-
(
|
|
234
|
-
if (
|
|
235
|
-
|
|
250
|
+
[D]
|
|
251
|
+
), oe = S(
|
|
252
|
+
(I) => {
|
|
253
|
+
if (v.current !== I.pointerId) {
|
|
254
|
+
T.current !== null && T.current.pointerId === I.pointerId && (T.current = { pointerId: I.pointerId, clientX: I.clientX, clientY: I.clientY });
|
|
236
255
|
return;
|
|
237
256
|
}
|
|
238
|
-
|
|
257
|
+
I.preventDefault(), D(I.clientX, I.clientY);
|
|
239
258
|
},
|
|
240
|
-
[
|
|
241
|
-
),
|
|
242
|
-
(
|
|
243
|
-
if (
|
|
244
|
-
|
|
259
|
+
[D]
|
|
260
|
+
), de = S(
|
|
261
|
+
(I) => {
|
|
262
|
+
if (v.current !== I.pointerId) {
|
|
263
|
+
T.current !== null && T.current.pointerId === I.pointerId && (T.current = null);
|
|
245
264
|
return;
|
|
246
265
|
}
|
|
247
|
-
|
|
248
|
-
const
|
|
249
|
-
if (
|
|
250
|
-
|
|
251
|
-
const
|
|
252
|
-
let
|
|
253
|
-
if (
|
|
266
|
+
I.preventDefault(), I.stopPropagation();
|
|
267
|
+
const G = T.current;
|
|
268
|
+
if (T.current = null, G !== null) {
|
|
269
|
+
ce(I.pointerId);
|
|
270
|
+
const fe = h.current;
|
|
271
|
+
let $e = !0;
|
|
272
|
+
if (fe !== null && typeof fe.setPointerCapture == "function")
|
|
254
273
|
try {
|
|
255
|
-
|
|
256
|
-
} catch (
|
|
257
|
-
(typeof
|
|
274
|
+
fe.setPointerCapture(G.pointerId);
|
|
275
|
+
} catch (Ue) {
|
|
276
|
+
(typeof Ue == "object" && Ue !== null && "name" in Ue ? Ue.name : void 0) === "NotFoundError" && ($e = !1);
|
|
258
277
|
}
|
|
259
|
-
if (
|
|
260
|
-
|
|
278
|
+
if ($e) {
|
|
279
|
+
v.current = G.pointerId, D(G.clientX, G.clientY, !0);
|
|
261
280
|
return;
|
|
262
281
|
}
|
|
263
282
|
}
|
|
264
|
-
|
|
283
|
+
ue(!0);
|
|
265
284
|
},
|
|
266
|
-
[
|
|
267
|
-
),
|
|
268
|
-
(
|
|
269
|
-
|
|
285
|
+
[ue, ce, D]
|
|
286
|
+
), y = S(
|
|
287
|
+
(I) => {
|
|
288
|
+
I.target === I.currentTarget && v.current === I.pointerId && ue(!1);
|
|
270
289
|
},
|
|
271
|
-
[
|
|
290
|
+
[ue]
|
|
272
291
|
);
|
|
273
|
-
|
|
274
|
-
|
|
292
|
+
ir(
|
|
293
|
+
d,
|
|
275
294
|
() => ({
|
|
276
295
|
reset: () => {
|
|
277
|
-
|
|
296
|
+
ue(!0);
|
|
278
297
|
},
|
|
279
298
|
getElement: () => h.current
|
|
280
299
|
}),
|
|
281
|
-
[
|
|
300
|
+
[ue]
|
|
282
301
|
);
|
|
283
|
-
const
|
|
284
|
-
dragState:
|
|
302
|
+
const Y = Math.min(Math.max(s, 0), 1), w = n / 64, Z = Math.min(m.distance, t) / t, Q = m.direction * Z * 10 * w, K = l ?? Cr, he = {
|
|
303
|
+
dragState: m,
|
|
285
304
|
normalizedDistance: Z,
|
|
286
|
-
sizeScale:
|
|
305
|
+
sizeScale: w,
|
|
287
306
|
size: n,
|
|
288
|
-
opacity:
|
|
289
|
-
},
|
|
307
|
+
opacity: Y
|
|
308
|
+
}, A = {
|
|
290
309
|
...i,
|
|
291
310
|
width: n,
|
|
292
311
|
height: n,
|
|
293
312
|
transform: `translateY(${Q}px)`
|
|
294
313
|
};
|
|
295
|
-
return
|
|
314
|
+
return A.opacity = Y, /* @__PURE__ */ ie(
|
|
296
315
|
"div",
|
|
297
316
|
{
|
|
298
317
|
ref: h,
|
|
299
318
|
"data-testid": "virtual-scroll-tap-circle",
|
|
300
|
-
className:
|
|
301
|
-
style:
|
|
319
|
+
className: Vt("aqvs-tap-scroll-circle", e),
|
|
320
|
+
style: A,
|
|
302
321
|
tabIndex: -1,
|
|
303
|
-
onPointerDown:
|
|
304
|
-
onPointerMove:
|
|
305
|
-
onPointerUp:
|
|
306
|
-
onPointerCancel:
|
|
307
|
-
onLostPointerCapture:
|
|
322
|
+
onPointerDown: re,
|
|
323
|
+
onPointerMove: oe,
|
|
324
|
+
onPointerUp: de,
|
|
325
|
+
onPointerCancel: de,
|
|
326
|
+
onLostPointerCapture: y,
|
|
308
327
|
role: "presentation",
|
|
309
|
-
children:
|
|
328
|
+
children: K(he)
|
|
310
329
|
}
|
|
311
330
|
);
|
|
312
331
|
})
|
|
313
332
|
);
|
|
314
|
-
|
|
315
|
-
const
|
|
333
|
+
Sr.displayName = "TapScrollCircle";
|
|
334
|
+
const se = (r, e, t) => Math.max(e, Math.min(t, r)), tr = "virtualscroll:tap-scroll-cancel", mr = 20, Dr = 250, Ar = 60, Lr = 20, Or = 20, Tr = {
|
|
316
335
|
/** 速度が最大に達する引き距離 (px)。`maxVisualDistance` の既定値。 */
|
|
317
336
|
maxDistance: 240,
|
|
318
337
|
/** 最小速度倍率 (ビューポート比)。 */
|
|
319
338
|
minSpeedMultiplier: 0.2
|
|
320
|
-
},
|
|
339
|
+
}, _r = Tr.maxDistance, pr = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, Zt = 2.2, kr = 8, Fr = 120, Yr = 1 / 10, dt = {
|
|
321
340
|
enabled: !0,
|
|
322
341
|
size: 40,
|
|
323
342
|
offsetX: -80,
|
|
324
343
|
offsetY: 0,
|
|
325
344
|
className: void 0,
|
|
326
|
-
maxVisualDistance:
|
|
327
|
-
minSpeedMultiplier:
|
|
345
|
+
maxVisualDistance: _r,
|
|
346
|
+
minSpeedMultiplier: Tr.minSpeedMultiplier,
|
|
328
347
|
opacity: 0.9,
|
|
329
348
|
renderVisual: void 0,
|
|
330
349
|
maxSpeedCurve: void 0
|
|
331
|
-
},
|
|
350
|
+
}, Br = (r) => r ? {
|
|
332
351
|
mainSizeKey: "width",
|
|
333
352
|
crossSizeKey: "height",
|
|
334
353
|
positionKey: "left",
|
|
@@ -348,8 +367,8 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
348
367
|
arrowIcons: ["▲", "▼"],
|
|
349
368
|
directionClass: "aqvs-scrollbar-vertical",
|
|
350
369
|
orientation: "vertical"
|
|
351
|
-
},
|
|
352
|
-
const t = r?.maxSpeedMultiplier, n = typeof t == "number" ? t :
|
|
370
|
+
}, Hr = (r, e) => {
|
|
371
|
+
const t = r?.maxSpeedMultiplier, n = typeof t == "number" ? t : Wr(e);
|
|
353
372
|
return {
|
|
354
373
|
enabled: r?.enabled ?? dt.enabled,
|
|
355
374
|
size: r?.size ?? dt.size,
|
|
@@ -359,503 +378,503 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
359
378
|
maxVisualDistance: r?.maxVisualDistance ?? dt.maxVisualDistance,
|
|
360
379
|
maxSpeedMultiplier: n,
|
|
361
380
|
minSpeedMultiplier: Math.max(r?.minSpeedMultiplier ?? dt.minSpeedMultiplier, 0),
|
|
362
|
-
opacity:
|
|
381
|
+
opacity: se(r?.opacity ?? dt.opacity, 0, 1),
|
|
363
382
|
renderVisual: r?.renderVisual ?? dt.renderVisual,
|
|
364
383
|
maxSpeedCurve: r?.maxSpeedCurve ?? dt.maxSpeedCurve
|
|
365
384
|
};
|
|
366
|
-
},
|
|
367
|
-
const i = g(null), s = g(null),
|
|
368
|
-
i.current !== null && (window.clearInterval(i.current), i.current = null), s.current !== null && (window.clearTimeout(s.current), s.current = null),
|
|
369
|
-
}, []),
|
|
370
|
-
|
|
371
|
-
}, [
|
|
372
|
-
(
|
|
385
|
+
}, qr = ({ isDragging: r, isThumbHovered: e, enableThumbDrag: t }) => _e(() => t ? r ? "dragging" : e ? "hover" : "idle" : "disabled", [t, r, e]), Xr = ({ canUseArrowButtons: r, enableArrowButtons: e, resetTapScroll: t, scrollByStep: n }) => {
|
|
386
|
+
const i = g(null), s = g(null), l = g(null), d = S(() => {
|
|
387
|
+
i.current !== null && (window.clearInterval(i.current), i.current = null), s.current !== null && (window.clearTimeout(s.current), s.current = null), l.current !== null && (window.removeEventListener("pointerup", l.current), window.removeEventListener("pointercancel", l.current), window.removeEventListener("blur", l.current), l.current = null);
|
|
388
|
+
}, []), m = S(() => {
|
|
389
|
+
d();
|
|
390
|
+
}, [d]), b = S(
|
|
391
|
+
(T) => (C) => {
|
|
373
392
|
if (!r)
|
|
374
393
|
return;
|
|
375
|
-
|
|
394
|
+
C.cancelable && C.preventDefault(), C.stopPropagation(), t(), d(), n(T), s.current = window.setTimeout(() => {
|
|
376
395
|
i.current = window.setInterval(() => {
|
|
377
|
-
n(
|
|
378
|
-
},
|
|
379
|
-
},
|
|
380
|
-
const h = () =>
|
|
381
|
-
|
|
396
|
+
n(T);
|
|
397
|
+
}, Ar);
|
|
398
|
+
}, Dr);
|
|
399
|
+
const h = () => d();
|
|
400
|
+
l.current = h, window.addEventListener("pointerup", h), window.addEventListener("pointercancel", h), window.addEventListener("blur", h);
|
|
382
401
|
},
|
|
383
|
-
[r,
|
|
384
|
-
),
|
|
385
|
-
(
|
|
386
|
-
e && (
|
|
402
|
+
[r, d, t, n]
|
|
403
|
+
), v = S(
|
|
404
|
+
(T) => (C) => {
|
|
405
|
+
e && (C.key === "Enter" || C.key === " " || C.key === "Spacebar") && (C.preventDefault(), n(T));
|
|
387
406
|
},
|
|
388
407
|
[e, n]
|
|
389
408
|
);
|
|
390
|
-
return
|
|
391
|
-
r ||
|
|
392
|
-
}, [r,
|
|
393
|
-
|
|
394
|
-
}, [
|
|
395
|
-
},
|
|
396
|
-
const
|
|
397
|
-
let
|
|
398
|
-
if (
|
|
399
|
-
const
|
|
400
|
-
if (
|
|
401
|
-
|
|
409
|
+
return X(() => {
|
|
410
|
+
r || d();
|
|
411
|
+
}, [r, d]), X(() => () => {
|
|
412
|
+
d();
|
|
413
|
+
}, [d]), { handleArrowPointerDown: b, handleArrowPointerUp: m, handleArrowKeyDown: v };
|
|
414
|
+
}, $r = 700, It = (r, e) => typeof r == "number" && Number.isFinite(r) ? r : e, Ur = ({ distance: r, maxDistance: e, viewportSize: t, minSpeedMultiplier: n, maxSpeedMultiplier: i, hasCustomMaxSpeedMultiplier: s, curve: l }) => {
|
|
415
|
+
const d = Math.max(It(r, 0), 0), m = It(e, 0), b = m > 0 ? Math.min(d, m) / m : 1, v = Math.max(It(t, 0), 0), T = Math.max(It(n, 0), 0), C = Math.max(It(i, 0), 0), h = Math.max(v * T, 40), O = s ? h : 1200, W = Math.max(v * C, O), D = l ? Math.max(It(l.exponentialScale, C), 0) : 0, ce = l ? Math.min(W, Math.max(v * D, h)) : W, ue = Math.max(ce, h);
|
|
416
|
+
let re = b ** 1.1;
|
|
417
|
+
if (l) {
|
|
418
|
+
const de = Math.min(Math.max(It(l.exponentialSteepness, 0), 0), $r);
|
|
419
|
+
if (de === 0)
|
|
420
|
+
re = b;
|
|
402
421
|
else {
|
|
403
|
-
const
|
|
404
|
-
|
|
422
|
+
const y = Math.expm1(de) || 1;
|
|
423
|
+
re = Math.min(Math.max(Math.expm1(de * b) / y, 0), 1);
|
|
405
424
|
}
|
|
406
425
|
}
|
|
407
|
-
const
|
|
408
|
-
return h + (
|
|
409
|
-
},
|
|
426
|
+
const oe = Math.min(Math.max(It(l?.easedOffset, 0), 0), 1);
|
|
427
|
+
return h + (ue - h) * (oe + (1 - oe) * re);
|
|
428
|
+
}, Wr = (r) => {
|
|
410
429
|
if (!r || r <= 0)
|
|
411
|
-
return
|
|
412
|
-
const e = Math.max(1, r), t = Math.log10(e), n =
|
|
413
|
-
return
|
|
414
|
-
},
|
|
430
|
+
return Zt;
|
|
431
|
+
const e = Math.max(1, r), t = Math.log10(e), n = Zt + t * kr;
|
|
432
|
+
return se(n, Zt, Fr);
|
|
433
|
+
}, Kr = ({
|
|
415
434
|
contentSize: r,
|
|
416
435
|
viewportSize: e,
|
|
417
436
|
scrollPosition: t,
|
|
418
437
|
onScroll: n,
|
|
419
438
|
enableThumbDrag: i = !0,
|
|
420
439
|
enableTrackClick: s = !0,
|
|
421
|
-
enableArrowButtons:
|
|
422
|
-
horizontal:
|
|
423
|
-
scrollBarWidth:
|
|
440
|
+
enableArrowButtons: l = !0,
|
|
441
|
+
horizontal: d = !1,
|
|
442
|
+
scrollBarWidth: m = 12,
|
|
424
443
|
className: b,
|
|
425
|
-
ariaControls:
|
|
426
|
-
tapScrollCircleOptions:
|
|
427
|
-
itemCount:
|
|
444
|
+
ariaControls: v,
|
|
445
|
+
tapScrollCircleOptions: T,
|
|
446
|
+
itemCount: C,
|
|
428
447
|
renderThumbOverlay: h,
|
|
429
|
-
visibleStartIndex:
|
|
430
|
-
visibleEndIndex:
|
|
448
|
+
visibleStartIndex: O,
|
|
449
|
+
visibleEndIndex: W
|
|
431
450
|
}) => {
|
|
432
|
-
const [
|
|
451
|
+
const [D, ce] = Je(!1), [ue, re] = Je(!1), [oe, de] = Je(!1), y = g(null), Y = g({
|
|
433
452
|
pointerId: null,
|
|
434
453
|
startThumbPosition: 0,
|
|
435
454
|
startClientX: 0,
|
|
436
455
|
startClientY: 0,
|
|
437
456
|
scale: 1,
|
|
438
457
|
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
|
-
} =
|
|
458
|
+
}), w = g({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 }), Z = g(t), Q = g(n), K = g(pr), he = g(null), A = g(null), I = g(null), G = g(0), fe = g(0), $e = _e(() => Hr(T, C), [C, T]), Ue = _e(() => Br(d), [d]), {
|
|
459
|
+
enabled: z,
|
|
460
|
+
size: ke,
|
|
461
|
+
offsetX: We,
|
|
462
|
+
offsetY: Ve,
|
|
463
|
+
className: Fe,
|
|
464
|
+
maxVisualDistance: Ke,
|
|
465
|
+
maxSpeedMultiplier: De,
|
|
466
|
+
minSpeedMultiplier: Pe,
|
|
467
|
+
opacity: ze,
|
|
468
|
+
renderVisual: be,
|
|
469
|
+
maxSpeedCurve: Se
|
|
470
|
+
} = $e, j = g({
|
|
452
471
|
viewportSize: e,
|
|
453
472
|
maxScrollPosition: Math.max(r - e, 0),
|
|
454
473
|
scrollBarVisible: r > e,
|
|
455
|
-
effectiveTapMaxDistance: Math.max(
|
|
456
|
-
tapCircleMaxSpeedMultiplier:
|
|
457
|
-
tapCircleMinSpeedMultiplier:
|
|
458
|
-
tapCircleMaxSpeedCurve:
|
|
459
|
-
tapScrollCircleOptions:
|
|
474
|
+
effectiveTapMaxDistance: Math.max(Ke, 1),
|
|
475
|
+
tapCircleMaxSpeedMultiplier: De,
|
|
476
|
+
tapCircleMinSpeedMultiplier: Pe,
|
|
477
|
+
tapCircleMaxSpeedCurve: Se,
|
|
478
|
+
tapScrollCircleOptions: T,
|
|
460
479
|
effectiveTrackLength: 0,
|
|
461
480
|
onScroll: n,
|
|
462
481
|
scrollPosition: t
|
|
463
|
-
}), { mainSizeKey:
|
|
464
|
-
|
|
465
|
-
|
|
482
|
+
}), { mainSizeKey: tt, crossSizeKey: Ge, positionKey: ft, selectDelta: st, getPointerCoordinate: N, arrowLabels: gt, arrowIcons: ne, directionClass: V, orientation: ot } = Ue, je = Math.max(Ke, 1), mt = e / r, Ae = Math.max(e - m * 2, 0), f = mt * Ae, M = Math.min(Math.max(mr, f || 0), Ae || mr), q = r - e, H = Math.max(Ae - M, 0), J = q <= 0 || H <= 0 ? 0 : se(t / q * H, 0, H), Te = J + M / 2, ee = r > e || D, xe = ee && l;
|
|
483
|
+
et(() => {
|
|
484
|
+
j.current = {
|
|
466
485
|
viewportSize: e,
|
|
467
|
-
maxScrollPosition:
|
|
468
|
-
scrollBarVisible:
|
|
469
|
-
effectiveTapMaxDistance:
|
|
470
|
-
tapCircleMaxSpeedMultiplier:
|
|
471
|
-
tapCircleMinSpeedMultiplier:
|
|
472
|
-
tapCircleMaxSpeedCurve:
|
|
473
|
-
tapScrollCircleOptions:
|
|
474
|
-
effectiveTrackLength:
|
|
486
|
+
maxScrollPosition: q,
|
|
487
|
+
scrollBarVisible: ee,
|
|
488
|
+
effectiveTapMaxDistance: je,
|
|
489
|
+
tapCircleMaxSpeedMultiplier: De,
|
|
490
|
+
tapCircleMinSpeedMultiplier: Pe,
|
|
491
|
+
tapCircleMaxSpeedCurve: Se,
|
|
492
|
+
tapScrollCircleOptions: T,
|
|
493
|
+
effectiveTrackLength: H,
|
|
475
494
|
onScroll: n,
|
|
476
495
|
scrollPosition: t
|
|
477
496
|
};
|
|
478
|
-
}),
|
|
497
|
+
}), et(() => {
|
|
479
498
|
Z.current = t;
|
|
480
|
-
}, [t]),
|
|
499
|
+
}, [t]), et(() => {
|
|
481
500
|
Q.current = n;
|
|
482
|
-
}, [n]),
|
|
483
|
-
i ||
|
|
501
|
+
}, [n]), X(() => {
|
|
502
|
+
i || re(!1);
|
|
484
503
|
}, [i]);
|
|
485
|
-
const
|
|
486
|
-
const
|
|
504
|
+
const ye = qr({ isDragging: D, isThumbHovered: ue, enableThumbDrag: i }), $ = S((a, x) => {
|
|
505
|
+
const E = j.current, L = x ?? Z.current;
|
|
487
506
|
if (Q.current) {
|
|
488
|
-
const
|
|
489
|
-
if (typeof
|
|
490
|
-
return Z.current =
|
|
507
|
+
const He = Q.current(a, L);
|
|
508
|
+
if (typeof He == "number" && Number.isFinite(He))
|
|
509
|
+
return Z.current = He, He;
|
|
491
510
|
}
|
|
492
|
-
const
|
|
493
|
-
return Z.current =
|
|
494
|
-
}, []),
|
|
495
|
-
(
|
|
496
|
-
const x =
|
|
511
|
+
const U = typeof a == "function" ? a(L) : a, ve = Math.max(E.maxScrollPosition, 0), Be = E.scrollBarVisible ? se(U, 0, ve) : 0;
|
|
512
|
+
return Z.current = Be, Be;
|
|
513
|
+
}, []), Re = S(
|
|
514
|
+
(a) => {
|
|
515
|
+
const x = j.current, E = Z.current;
|
|
497
516
|
if (!x.scrollBarVisible || x.maxScrollPosition <= 0) {
|
|
498
|
-
const
|
|
499
|
-
return { nextPosition:
|
|
517
|
+
const Ze = $(0, E), pt = Ze - E;
|
|
518
|
+
return { nextPosition: Ze, actualDelta: pt, reachedBoundary: !0 };
|
|
500
519
|
}
|
|
501
|
-
if (
|
|
502
|
-
return { nextPosition:
|
|
503
|
-
const
|
|
504
|
-
return { nextPosition:
|
|
520
|
+
if (a === 0)
|
|
521
|
+
return { nextPosition: E, actualDelta: 0, reachedBoundary: !1 };
|
|
522
|
+
const U = $((Ze) => se(Ze + a, 0, x.maxScrollPosition), E), ve = U - E, Be = a < 0 && E + a <= 0, He = a > 0 && E + a >= x.maxScrollPosition, lt = a < 0 && (U <= 0 || Be && ve === 0) || a > 0 && (U >= x.maxScrollPosition || He && ve === 0);
|
|
523
|
+
return { nextPosition: U, actualDelta: ve, reachedBoundary: lt };
|
|
505
524
|
},
|
|
506
|
-
[
|
|
507
|
-
),
|
|
508
|
-
(
|
|
509
|
-
|
|
510
|
-
const
|
|
511
|
-
|
|
512
|
-
const
|
|
513
|
-
return
|
|
525
|
+
[$]
|
|
526
|
+
), Ce = S(
|
|
527
|
+
(a, x) => {
|
|
528
|
+
a.current += x;
|
|
529
|
+
const E = Math.max(j.current.maxScrollPosition, 0);
|
|
530
|
+
E > 0 && (a.current = se(a.current, -E, E));
|
|
531
|
+
const L = Re(a.current);
|
|
532
|
+
return a.current -= L.actualDelta, L.reachedBoundary && (a.current = 0), L;
|
|
514
533
|
},
|
|
515
|
-
[
|
|
516
|
-
),
|
|
517
|
-
|
|
518
|
-
}, []),
|
|
519
|
-
|
|
520
|
-
}, [
|
|
521
|
-
(
|
|
522
|
-
const x =
|
|
534
|
+
[Re]
|
|
535
|
+
), me = S(() => {
|
|
536
|
+
A.current !== null && (window.cancelAnimationFrame(A.current), A.current = null), I.current = null, G.current = 0, fe.current = 0;
|
|
537
|
+
}, []), Ee = S(() => {
|
|
538
|
+
K.current = { ...pr }, de(!1), he.current?.reset(), me();
|
|
539
|
+
}, [me]), rt = S(
|
|
540
|
+
(a) => {
|
|
541
|
+
const x = K.current, E = j.current;
|
|
523
542
|
if (!x.active || x.direction === 0) {
|
|
524
|
-
|
|
543
|
+
me();
|
|
525
544
|
return;
|
|
526
545
|
}
|
|
527
|
-
if (!
|
|
528
|
-
|
|
546
|
+
if (!E.scrollBarVisible || E.maxScrollPosition <= 0) {
|
|
547
|
+
me();
|
|
529
548
|
return;
|
|
530
549
|
}
|
|
531
|
-
const
|
|
532
|
-
if (
|
|
533
|
-
|
|
550
|
+
const L = I.current ?? a, U = Math.max((a - L) / 1e3, 0), ve = Math.min(U, Yr);
|
|
551
|
+
if (I.current = a, ve <= 0) {
|
|
552
|
+
A.current = window.requestAnimationFrame(rt);
|
|
534
553
|
return;
|
|
535
554
|
}
|
|
536
|
-
const
|
|
555
|
+
const Be = Ur({
|
|
537
556
|
distance: x.distance,
|
|
538
|
-
maxDistance:
|
|
539
|
-
viewportSize:
|
|
540
|
-
minSpeedMultiplier:
|
|
541
|
-
maxSpeedMultiplier:
|
|
542
|
-
hasCustomMaxSpeedMultiplier: typeof
|
|
543
|
-
curve:
|
|
557
|
+
maxDistance: E.effectiveTapMaxDistance,
|
|
558
|
+
viewportSize: E.viewportSize,
|
|
559
|
+
minSpeedMultiplier: E.tapCircleMinSpeedMultiplier,
|
|
560
|
+
maxSpeedMultiplier: E.tapCircleMaxSpeedMultiplier,
|
|
561
|
+
hasCustomMaxSpeedMultiplier: typeof E.tapScrollCircleOptions?.maxSpeedMultiplier == "number",
|
|
562
|
+
curve: E.tapCircleMaxSpeedCurve
|
|
544
563
|
});
|
|
545
|
-
|
|
546
|
-
const { reachedBoundary:
|
|
547
|
-
if (
|
|
548
|
-
|
|
564
|
+
fe.current !== x.direction && (fe.current = x.direction, G.current = 0);
|
|
565
|
+
const { reachedBoundary: He } = Ce(G, x.direction * Be * ve);
|
|
566
|
+
if (He) {
|
|
567
|
+
me();
|
|
549
568
|
return;
|
|
550
569
|
}
|
|
551
|
-
|
|
570
|
+
A.current = window.requestAnimationFrame(rt);
|
|
552
571
|
},
|
|
553
|
-
[
|
|
554
|
-
),
|
|
555
|
-
|
|
556
|
-
}, [
|
|
557
|
-
|
|
558
|
-
const
|
|
559
|
-
!
|
|
560
|
-
}, [r, e,
|
|
561
|
-
|
|
562
|
-
}, [
|
|
563
|
-
const
|
|
564
|
-
(
|
|
565
|
-
|
|
572
|
+
[Ce, me]
|
|
573
|
+
), Le = S(() => {
|
|
574
|
+
A.current === null && (I.current = null, G.current = 0, A.current = window.requestAnimationFrame(rt));
|
|
575
|
+
}, [rt]);
|
|
576
|
+
X(() => {
|
|
577
|
+
const a = K.current;
|
|
578
|
+
!a.active || a.direction === 0 || Le();
|
|
579
|
+
}, [r, e, Le]), X(() => () => {
|
|
580
|
+
me();
|
|
581
|
+
}, [me]);
|
|
582
|
+
const at = S(
|
|
583
|
+
(a) => {
|
|
584
|
+
K.current = a, de(a.active), a.active && a.direction !== 0 ? Le() : me();
|
|
566
585
|
},
|
|
567
|
-
[
|
|
586
|
+
[Le, me]
|
|
568
587
|
);
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
}, [
|
|
572
|
-
const
|
|
573
|
-
const
|
|
574
|
-
|
|
588
|
+
X(() => {
|
|
589
|
+
z || Ee();
|
|
590
|
+
}, [Ee, z]), X(() => {
|
|
591
|
+
const a = (x) => {
|
|
592
|
+
const L = x.detail?.paneId;
|
|
593
|
+
L && v && L !== v || Ee();
|
|
575
594
|
};
|
|
576
|
-
return window.addEventListener(
|
|
577
|
-
window.removeEventListener(
|
|
595
|
+
return window.addEventListener(tr, a), () => {
|
|
596
|
+
window.removeEventListener(tr, a);
|
|
578
597
|
};
|
|
579
|
-
}, [
|
|
580
|
-
if (!
|
|
598
|
+
}, [v, Ee]), X(() => {
|
|
599
|
+
if (!z)
|
|
581
600
|
return;
|
|
582
|
-
const
|
|
583
|
-
if (!
|
|
601
|
+
const a = (x) => {
|
|
602
|
+
if (!K.current.active || K.current.pointerId === x.pointerId)
|
|
584
603
|
return;
|
|
585
|
-
const
|
|
586
|
-
if (!(
|
|
587
|
-
|
|
604
|
+
const E = x.target;
|
|
605
|
+
if (!(E instanceof Node)) {
|
|
606
|
+
Ee();
|
|
588
607
|
return;
|
|
589
608
|
}
|
|
590
|
-
|
|
609
|
+
he.current?.getElement()?.contains(E) || Ee();
|
|
591
610
|
};
|
|
592
|
-
return document.addEventListener("pointerdown",
|
|
593
|
-
document.removeEventListener("pointerdown",
|
|
611
|
+
return document.addEventListener("pointerdown", a, !0), () => {
|
|
612
|
+
document.removeEventListener("pointerdown", a, !0);
|
|
594
613
|
};
|
|
595
|
-
}, [
|
|
596
|
-
const
|
|
597
|
-
if (!
|
|
614
|
+
}, [Ee, z]);
|
|
615
|
+
const Me = (a) => {
|
|
616
|
+
if (!ee || H <= 0 || q <= 0)
|
|
598
617
|
return 0;
|
|
599
|
-
const x =
|
|
600
|
-
return
|
|
601
|
-
},
|
|
602
|
-
const { scrollBarVisible: x, effectiveTrackLength:
|
|
603
|
-
if (
|
|
618
|
+
const x = se(a, 0, H);
|
|
619
|
+
return se(x / H * q, 0, q);
|
|
620
|
+
}, nt = S((a) => {
|
|
621
|
+
const { scrollBarVisible: x, effectiveTrackLength: E, maxScrollPosition: L } = j.current;
|
|
622
|
+
if (P.debug("[ScrollBar] calculateScrollPositionFromThumb", () => ({ thumbPos: a, trackLen: E, maxScroll: L })), E <= 0 || L <= 0)
|
|
604
623
|
return null;
|
|
605
|
-
const
|
|
606
|
-
return
|
|
607
|
-
}, []),
|
|
608
|
-
(
|
|
609
|
-
const x =
|
|
610
|
-
const
|
|
611
|
-
return Number.isFinite(
|
|
612
|
-
},
|
|
613
|
-
return
|
|
624
|
+
const U = se(a, 0, E);
|
|
625
|
+
return se(U / E * L, 0, L);
|
|
626
|
+
}, []), p = S(
|
|
627
|
+
(a) => {
|
|
628
|
+
const x = a.getBoundingClientRect(), E = d ? x.width : x.height, L = (lt) => {
|
|
629
|
+
const Ze = Number.parseFloat(lt);
|
|
630
|
+
return Number.isFinite(Ze) ? Ze : 0;
|
|
631
|
+
}, U = window.getComputedStyle(a), ve = L(d ? U.width : U.height), Be = ve > 0 ? ve + L(d ? U.paddingLeft : U.paddingTop) + L(d ? U.paddingRight : U.paddingBottom) + L(d ? U.borderLeftWidth : U.borderTopWidth) + L(d ? U.borderRightWidth : U.borderBottomWidth) : 0, He = Be > 0 ? Be : d ? a.offsetWidth : a.offsetHeight;
|
|
632
|
+
return He <= 0 || E <= 0 ? 1 : E / He;
|
|
614
633
|
},
|
|
615
|
-
[
|
|
616
|
-
),
|
|
617
|
-
(
|
|
618
|
-
const x =
|
|
619
|
-
if (x.pointerId !==
|
|
634
|
+
[d]
|
|
635
|
+
), R = S(
|
|
636
|
+
(a) => {
|
|
637
|
+
const x = Y.current;
|
|
638
|
+
if (x.pointerId !== a.pointerId)
|
|
620
639
|
return;
|
|
621
|
-
const
|
|
622
|
-
|
|
623
|
-
delta:
|
|
640
|
+
const E = a.clientX - x.startClientX, L = a.clientY - x.startClientY, U = st(E, L) / (x.scale || 1);
|
|
641
|
+
P.debug("[ScrollBar] handleThumbPointerMove", () => ({
|
|
642
|
+
delta: U,
|
|
624
643
|
startThumbPosition: x.startThumbPosition,
|
|
625
|
-
clientY:
|
|
644
|
+
clientY: a.clientY,
|
|
626
645
|
startClientY: x.startClientY,
|
|
627
|
-
metrics:
|
|
646
|
+
metrics: j.current
|
|
628
647
|
}));
|
|
629
|
-
const
|
|
630
|
-
|
|
648
|
+
const ve = nt(x.startThumbPosition + U);
|
|
649
|
+
ve !== null && $(ve), a.cancelable && a.preventDefault();
|
|
631
650
|
},
|
|
632
|
-
[
|
|
633
|
-
),
|
|
634
|
-
(
|
|
635
|
-
const x =
|
|
636
|
-
if (x.pointerId !==
|
|
651
|
+
[st, nt, $]
|
|
652
|
+
), ae = S(
|
|
653
|
+
(a) => {
|
|
654
|
+
const x = Y.current;
|
|
655
|
+
if (x.pointerId !== a.pointerId)
|
|
637
656
|
return;
|
|
638
|
-
document.removeEventListener("pointermove",
|
|
639
|
-
const
|
|
640
|
-
if (
|
|
641
|
-
const
|
|
642
|
-
|
|
657
|
+
document.removeEventListener("pointermove", R), document.removeEventListener("pointerup", ae), document.removeEventListener("pointercancel", ae);
|
|
658
|
+
const E = x.captureTarget;
|
|
659
|
+
if (E?.hasPointerCapture?.(a.pointerId) && E.releasePointerCapture(a.pointerId), Y.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1, captureTarget: null }, ce(!1), y.current) {
|
|
660
|
+
const L = y.current.getBoundingClientRect();
|
|
661
|
+
a.clientX >= L.left && a.clientX <= L.right && a.clientY >= L.top && a.clientY <= L.bottom || re(!1);
|
|
643
662
|
} else
|
|
644
|
-
|
|
663
|
+
re(!1);
|
|
645
664
|
},
|
|
646
|
-
[
|
|
665
|
+
[R]
|
|
647
666
|
);
|
|
648
|
-
|
|
649
|
-
document.removeEventListener("pointermove",
|
|
650
|
-
}, [
|
|
651
|
-
const
|
|
652
|
-
(
|
|
653
|
-
const x = Math.max(Math.round(
|
|
654
|
-
|
|
667
|
+
X(() => () => {
|
|
668
|
+
document.removeEventListener("pointermove", R), document.removeEventListener("pointerup", ae), document.removeEventListener("pointercancel", ae);
|
|
669
|
+
}, [R, ae]);
|
|
670
|
+
const it = g(0), Ne = g(0), zt = S(
|
|
671
|
+
(a) => {
|
|
672
|
+
const x = Math.max(Math.round(j.current.viewportSize / Or), Lr);
|
|
673
|
+
Ne.current !== a && (Ne.current = a, it.current = 0), Ce(it, a * x);
|
|
655
674
|
},
|
|
656
|
-
[
|
|
657
|
-
), { handleArrowPointerDown:
|
|
658
|
-
canUseArrowButtons:
|
|
659
|
-
enableArrowButtons:
|
|
660
|
-
resetTapScroll:
|
|
661
|
-
scrollByStep:
|
|
662
|
-
}),
|
|
663
|
-
if (!
|
|
675
|
+
[Ce]
|
|
676
|
+
), { handleArrowPointerDown: ct, handleArrowPointerUp: Ye, handleArrowKeyDown: bt } = Xr({
|
|
677
|
+
canUseArrowButtons: xe,
|
|
678
|
+
enableArrowButtons: l,
|
|
679
|
+
resetTapScroll: Ee,
|
|
680
|
+
scrollByStep: zt
|
|
681
|
+
}), Pt = (a) => {
|
|
682
|
+
if (!ee)
|
|
664
683
|
return;
|
|
665
684
|
if (!i) {
|
|
666
|
-
|
|
685
|
+
a.preventDefault(), a.stopPropagation();
|
|
667
686
|
return;
|
|
668
687
|
}
|
|
669
|
-
if (
|
|
688
|
+
if (a.pointerType === "mouse" && a.button !== 0 || a.ctrlKey)
|
|
670
689
|
return;
|
|
671
|
-
|
|
672
|
-
const x =
|
|
673
|
-
let
|
|
690
|
+
Ee();
|
|
691
|
+
const x = a.currentTarget, E = p(x);
|
|
692
|
+
let L = null;
|
|
674
693
|
if (x.setPointerCapture)
|
|
675
694
|
try {
|
|
676
|
-
x.setPointerCapture(
|
|
695
|
+
x.setPointerCapture(a.pointerId), L = x;
|
|
677
696
|
} catch {
|
|
678
|
-
|
|
697
|
+
L = null;
|
|
679
698
|
}
|
|
680
|
-
|
|
681
|
-
pointerId:
|
|
682
|
-
startThumbPosition:
|
|
683
|
-
startClientX:
|
|
684
|
-
startClientY:
|
|
685
|
-
scale:
|
|
686
|
-
captureTarget:
|
|
687
|
-
}, document.addEventListener("pointermove",
|
|
688
|
-
},
|
|
689
|
-
if (!
|
|
699
|
+
Y.current = {
|
|
700
|
+
pointerId: a.pointerId,
|
|
701
|
+
startThumbPosition: J,
|
|
702
|
+
startClientX: a.clientX,
|
|
703
|
+
startClientY: a.clientY,
|
|
704
|
+
scale: E,
|
|
705
|
+
captureTarget: L
|
|
706
|
+
}, document.addEventListener("pointermove", R), document.addEventListener("pointerup", ae), document.addEventListener("pointercancel", ae), ce(!0), re(!0), a.preventDefault(), a.stopPropagation();
|
|
707
|
+
}, Ft = (a) => {
|
|
708
|
+
if (!ee)
|
|
690
709
|
return;
|
|
691
710
|
if (!s) {
|
|
692
|
-
|
|
711
|
+
a.preventDefault(), a.stopPropagation();
|
|
693
712
|
return;
|
|
694
713
|
}
|
|
695
|
-
if (
|
|
714
|
+
if (a.pointerType === "mouse" && a.button !== 0 || a.ctrlKey)
|
|
696
715
|
return;
|
|
697
|
-
const x =
|
|
698
|
-
|
|
699
|
-
const
|
|
700
|
-
if (
|
|
716
|
+
const x = a.currentTarget, E = x.getBoundingClientRect(), L = N(a), U = p(x), ve = (L - (d ? E.left : E.top)) / U;
|
|
717
|
+
Ee();
|
|
718
|
+
const Be = ve - M / 2, He = Me(Be);
|
|
719
|
+
if ($(He), x.setPointerCapture)
|
|
701
720
|
try {
|
|
702
|
-
x.setPointerCapture(
|
|
721
|
+
x.setPointerCapture(a.pointerId);
|
|
703
722
|
} catch {
|
|
704
723
|
}
|
|
705
|
-
|
|
706
|
-
pointerId:
|
|
707
|
-
startThumbPosition:
|
|
708
|
-
startClientX:
|
|
709
|
-
startClientY:
|
|
710
|
-
scale:
|
|
711
|
-
},
|
|
712
|
-
},
|
|
713
|
-
|
|
714
|
-
},
|
|
715
|
-
const x =
|
|
716
|
-
if (x.pointerId !==
|
|
724
|
+
w.current = {
|
|
725
|
+
pointerId: a.pointerId,
|
|
726
|
+
startThumbPosition: Be,
|
|
727
|
+
startClientX: a.clientX,
|
|
728
|
+
startClientY: a.clientY,
|
|
729
|
+
scale: U
|
|
730
|
+
}, a.preventDefault(), a.stopPropagation();
|
|
731
|
+
}, ut = () => {
|
|
732
|
+
w.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 };
|
|
733
|
+
}, yt = (a) => {
|
|
734
|
+
const x = w.current;
|
|
735
|
+
if (x.pointerId !== a.pointerId)
|
|
717
736
|
return;
|
|
718
|
-
if (
|
|
719
|
-
|
|
737
|
+
if (a.pointerType === "mouse" && a.buttons === 0) {
|
|
738
|
+
ut();
|
|
720
739
|
return;
|
|
721
740
|
}
|
|
722
|
-
const
|
|
723
|
-
|
|
724
|
-
},
|
|
725
|
-
if (
|
|
741
|
+
const E = a.clientX - x.startClientX, L = a.clientY - x.startClientY, U = st(E, L) / (x.scale || 1), ve = Me(x.startThumbPosition + U);
|
|
742
|
+
$(ve), a.cancelable && a.preventDefault();
|
|
743
|
+
}, Yt = (a) => {
|
|
744
|
+
if (w.current.pointerId !== a.pointerId)
|
|
726
745
|
return;
|
|
727
|
-
const x =
|
|
728
|
-
x.hasPointerCapture?.(
|
|
729
|
-
},
|
|
730
|
-
if (
|
|
746
|
+
const x = a.currentTarget;
|
|
747
|
+
x.hasPointerCapture?.(a.pointerId) && x.releasePointerCapture(a.pointerId), ut(), a.preventDefault(), a.stopPropagation();
|
|
748
|
+
}, Ct = (a) => {
|
|
749
|
+
if (w.current.pointerId !== a.pointerId)
|
|
731
750
|
return;
|
|
732
|
-
const x =
|
|
733
|
-
x.hasPointerCapture?.(
|
|
734
|
-
},
|
|
735
|
-
|
|
736
|
-
},
|
|
737
|
-
const x = `calc(50% - ${
|
|
751
|
+
const x = a.currentTarget;
|
|
752
|
+
x.hasPointerCapture?.(a.pointerId) && x.releasePointerCapture(a.pointerId), ut();
|
|
753
|
+
}, Bt = (a) => {
|
|
754
|
+
a.target === a.currentTarget && w.current.pointerId === a.pointerId && ut();
|
|
755
|
+
}, ge = _e(() => se((oe ? 1 : 0.8) * ze, 0, 1), [oe, ze]), xt = _e(() => {
|
|
756
|
+
const x = `calc(50% - ${ke / 2}px + ${Ve}px)`;
|
|
738
757
|
return {
|
|
739
|
-
left:
|
|
758
|
+
left: We,
|
|
740
759
|
top: x
|
|
741
760
|
};
|
|
742
|
-
}, [
|
|
761
|
+
}, [We, Ve, ke]), Dt = (a, x, E, L) => /* @__PURE__ */ ie(
|
|
743
762
|
"button",
|
|
744
763
|
{
|
|
745
764
|
type: "button",
|
|
746
765
|
tabIndex: 0,
|
|
747
766
|
className: "aqvs-scrollbar-arrow-button",
|
|
748
767
|
style: {
|
|
749
|
-
[
|
|
750
|
-
[
|
|
768
|
+
[tt]: m,
|
|
769
|
+
[Ge]: m
|
|
751
770
|
},
|
|
752
771
|
"aria-label": x,
|
|
753
|
-
onPointerDown:
|
|
754
|
-
onPointerUp:
|
|
755
|
-
onPointerLeave:
|
|
756
|
-
onPointerCancel:
|
|
757
|
-
onKeyDown:
|
|
758
|
-
"aria-disabled": !
|
|
759
|
-
disabled: !
|
|
760
|
-
children: /* @__PURE__ */
|
|
772
|
+
onPointerDown: ct(a),
|
|
773
|
+
onPointerUp: Ye,
|
|
774
|
+
onPointerLeave: Ye,
|
|
775
|
+
onPointerCancel: Ye,
|
|
776
|
+
onKeyDown: bt(a),
|
|
777
|
+
"aria-disabled": !l,
|
|
778
|
+
disabled: !xe,
|
|
779
|
+
children: /* @__PURE__ */ ie("span", { "aria-hidden": "true", children: E })
|
|
761
780
|
},
|
|
762
|
-
|
|
763
|
-
),
|
|
764
|
-
orientation:
|
|
781
|
+
L
|
|
782
|
+
), At = h && ee ? {
|
|
783
|
+
orientation: ot,
|
|
765
784
|
scrollPosition: t,
|
|
766
|
-
maxScrollPosition:
|
|
785
|
+
maxScrollPosition: q,
|
|
767
786
|
contentSize: r,
|
|
768
787
|
viewportSize: e,
|
|
769
|
-
thumbSize:
|
|
770
|
-
thumbPosition:
|
|
771
|
-
thumbCenter:
|
|
772
|
-
trackSize:
|
|
773
|
-
isDragging:
|
|
774
|
-
isTapScrollActive:
|
|
775
|
-
visibleStartIndex:
|
|
776
|
-
visibleEndIndex:
|
|
788
|
+
thumbSize: M,
|
|
789
|
+
thumbPosition: J,
|
|
790
|
+
thumbCenter: Te,
|
|
791
|
+
trackSize: Ae,
|
|
792
|
+
isDragging: D,
|
|
793
|
+
isTapScrollActive: oe,
|
|
794
|
+
visibleStartIndex: O,
|
|
795
|
+
visibleEndIndex: W
|
|
777
796
|
} : null;
|
|
778
|
-
return /* @__PURE__ */
|
|
797
|
+
return /* @__PURE__ */ Tt(
|
|
779
798
|
"div",
|
|
780
799
|
{
|
|
781
|
-
className:
|
|
800
|
+
className: Vt("aqvs-scrollbar", V, b),
|
|
782
801
|
style: {
|
|
783
|
-
[
|
|
784
|
-
[
|
|
802
|
+
[tt]: e,
|
|
803
|
+
[Ge]: m
|
|
785
804
|
},
|
|
786
|
-
"data-visible":
|
|
805
|
+
"data-visible": ee ? "true" : "false",
|
|
787
806
|
role: "scrollbar",
|
|
788
807
|
tabIndex: -1,
|
|
789
|
-
"aria-controls":
|
|
808
|
+
"aria-controls": v,
|
|
790
809
|
"aria-valuenow": t,
|
|
791
810
|
"aria-valuemin": 0,
|
|
792
|
-
"aria-valuemax":
|
|
793
|
-
"aria-orientation":
|
|
811
|
+
"aria-valuemax": q,
|
|
812
|
+
"aria-orientation": d ? "horizontal" : "vertical",
|
|
794
813
|
children: [
|
|
795
|
-
!
|
|
796
|
-
|
|
814
|
+
!d && ee && z && /* @__PURE__ */ ie(
|
|
815
|
+
Sr,
|
|
797
816
|
{
|
|
798
|
-
ref:
|
|
799
|
-
className:
|
|
800
|
-
size:
|
|
801
|
-
maxVisualDistance:
|
|
802
|
-
style:
|
|
803
|
-
opacity:
|
|
804
|
-
renderVisual:
|
|
805
|
-
onDragChange:
|
|
817
|
+
ref: he,
|
|
818
|
+
className: Vt("aqvs-scrollbar-tap-circle-wrapper", Fe),
|
|
819
|
+
size: ke,
|
|
820
|
+
maxVisualDistance: je,
|
|
821
|
+
style: xt,
|
|
822
|
+
opacity: ge,
|
|
823
|
+
renderVisual: be,
|
|
824
|
+
onDragChange: at
|
|
806
825
|
},
|
|
807
826
|
"tap-circle"
|
|
808
827
|
),
|
|
809
|
-
|
|
810
|
-
/* @__PURE__ */
|
|
828
|
+
Dt(-1, gt[0], ne[0], "arrow-start"),
|
|
829
|
+
/* @__PURE__ */ Tt(
|
|
811
830
|
"div",
|
|
812
831
|
{
|
|
813
832
|
className: "aqvs-scrollbar-track",
|
|
814
833
|
style: {
|
|
815
|
-
borderRadius:
|
|
834
|
+
borderRadius: m / 2
|
|
816
835
|
},
|
|
817
|
-
onPointerDown:
|
|
818
|
-
onPointerMove:
|
|
819
|
-
onPointerUp:
|
|
820
|
-
onPointerCancel:
|
|
821
|
-
onLostPointerCapture:
|
|
836
|
+
onPointerDown: Ft,
|
|
837
|
+
onPointerMove: yt,
|
|
838
|
+
onPointerUp: Yt,
|
|
839
|
+
onPointerCancel: Ct,
|
|
840
|
+
onLostPointerCapture: Bt,
|
|
822
841
|
"aria-disabled": !s,
|
|
823
842
|
children: [
|
|
824
|
-
|
|
825
|
-
/* @__PURE__ */
|
|
843
|
+
At && /* @__PURE__ */ ie("div", { className: "aqvs-scrollbar-overlay", "aria-hidden": !0, children: h?.(At) }, "overlay"),
|
|
844
|
+
/* @__PURE__ */ ie(
|
|
826
845
|
"div",
|
|
827
846
|
{
|
|
828
847
|
className: "aqvs-scrollbar-thumb-wrapper",
|
|
829
848
|
style: {
|
|
830
|
-
[
|
|
831
|
-
[
|
|
832
|
-
...
|
|
849
|
+
[tt]: M,
|
|
850
|
+
[ft]: J,
|
|
851
|
+
...d ? { top: 0, bottom: 0 } : { left: 0, right: 0 }
|
|
833
852
|
},
|
|
834
|
-
"data-visible":
|
|
835
|
-
onPointerDown:
|
|
853
|
+
"data-visible": ee || D ? "true" : "false",
|
|
854
|
+
onPointerDown: Pt,
|
|
836
855
|
role: "slider",
|
|
837
|
-
"aria-orientation":
|
|
856
|
+
"aria-orientation": d ? "horizontal" : "vertical",
|
|
838
857
|
"aria-valuenow": t,
|
|
839
858
|
"aria-valuemin": 0,
|
|
840
|
-
"aria-valuemax":
|
|
859
|
+
"aria-valuemax": q,
|
|
841
860
|
"aria-disabled": !i,
|
|
842
861
|
tabIndex: -1,
|
|
843
|
-
children: /* @__PURE__ */
|
|
862
|
+
children: /* @__PURE__ */ ie(
|
|
844
863
|
"div",
|
|
845
864
|
{
|
|
846
|
-
ref:
|
|
847
|
-
className:
|
|
865
|
+
ref: y,
|
|
866
|
+
className: Vt("aqvs-scrollbar-thumb", d ? "aqvs-scrollbar-thumb-horizontal" : "aqvs-scrollbar-thumb-vertical"),
|
|
848
867
|
"data-testid": "aqvs-scrollbar-thumb",
|
|
849
|
-
"data-thumb-state":
|
|
868
|
+
"data-thumb-state": ye,
|
|
850
869
|
style: {
|
|
851
|
-
borderRadius:
|
|
870
|
+
borderRadius: m - 1,
|
|
852
871
|
cursor: i ? "pointer" : "default"
|
|
853
872
|
},
|
|
854
873
|
onMouseEnter: () => {
|
|
855
|
-
i &&
|
|
874
|
+
i && re(!0);
|
|
856
875
|
},
|
|
857
876
|
onMouseLeave: () => {
|
|
858
|
-
i &&
|
|
877
|
+
i && re(!1);
|
|
859
878
|
}
|
|
860
879
|
},
|
|
861
880
|
"thumb"
|
|
@@ -867,11 +886,11 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
867
886
|
},
|
|
868
887
|
"track"
|
|
869
888
|
),
|
|
870
|
-
|
|
889
|
+
Dt(1, gt[1], ne[1], "arrow-end")
|
|
871
890
|
]
|
|
872
891
|
}
|
|
873
892
|
);
|
|
874
|
-
},
|
|
893
|
+
}, Gr = 16, hr = (r, e, t) => e === 1 ? r * Gr : e === 2 ? r * t : r, jr = (r, e) => {
|
|
875
894
|
const t = r.shiftKey && r.deltaX === 0, n = t ? r.deltaY : r.deltaX, i = t ? 0 : r.deltaY, s = n !== 0 && Math.abs(n) >= Math.abs(i);
|
|
876
895
|
return {
|
|
877
896
|
// ❗ ズームでもデルタは潰さない。ここは**事実だけ**を報告し、「横取りしない」という
|
|
@@ -880,21 +899,21 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
880
899
|
// どのテストも検出できなくなる (変異解析で実証済み)。
|
|
881
900
|
isZoomGesture: r.ctrlKey,
|
|
882
901
|
isHorizontalDominant: s,
|
|
883
|
-
horizontalDelta:
|
|
884
|
-
verticalDelta:
|
|
902
|
+
horizontalDelta: hr(n, r.deltaMode, e),
|
|
903
|
+
verticalDelta: hr(i, r.deltaMode, e)
|
|
885
904
|
};
|
|
886
|
-
},
|
|
887
|
-
|
|
888
|
-
},
|
|
905
|
+
}, wr = /* @__PURE__ */ new WeakSet(), gr = (r) => {
|
|
906
|
+
wr.add(r);
|
|
907
|
+
}, Zr = (r) => wr.has(r), Qr = ["mouse", "pen", "touch"], Qt = (r, e) => !(r === "mouse" || r === "pen" || r === "touch") || e.includes(r), Jr = (r) => r === "mouse" || r === "pen", _t = {
|
|
889
908
|
maxVelocity: 6,
|
|
890
909
|
minVelocity: 0.02,
|
|
891
910
|
deceleration: 25e-4,
|
|
892
911
|
velocitySampleWindow: 90,
|
|
893
912
|
startVelocityThreshold: 0.04
|
|
894
|
-
},
|
|
913
|
+
}, qt = (r, e, t) => {
|
|
895
914
|
for (const [n, i, s] of e)
|
|
896
915
|
t === "add" ? r.addEventListener(n, i, s) : r.removeEventListener(n, i, s);
|
|
897
|
-
},
|
|
916
|
+
}, en = nr(
|
|
898
917
|
({
|
|
899
918
|
children: r,
|
|
900
919
|
contentSize: e,
|
|
@@ -902,240 +921,240 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
902
921
|
onViewportSizeChange: n,
|
|
903
922
|
scrollBarWidth: i = 12,
|
|
904
923
|
enableThumbDrag: s = !0,
|
|
905
|
-
enableTrackClick:
|
|
906
|
-
enableArrowButtons:
|
|
907
|
-
enablePointerDrag:
|
|
908
|
-
pointerDragInputs: b =
|
|
909
|
-
onScroll:
|
|
910
|
-
className:
|
|
911
|
-
testId:
|
|
924
|
+
enableTrackClick: l = !0,
|
|
925
|
+
enableArrowButtons: d = !0,
|
|
926
|
+
enablePointerDrag: m = !0,
|
|
927
|
+
pointerDragInputs: b = Qr,
|
|
928
|
+
onScroll: v,
|
|
929
|
+
className: T,
|
|
930
|
+
testId: C,
|
|
912
931
|
style: h,
|
|
913
|
-
background:
|
|
914
|
-
tapScrollCircleOptions:
|
|
915
|
-
inertiaOptions:
|
|
916
|
-
itemCount:
|
|
917
|
-
renderThumbOverlay:
|
|
918
|
-
wheelSpeedMultiplier:
|
|
919
|
-
overscrollBehavior:
|
|
920
|
-
onWheelHorizontal:
|
|
921
|
-
contentInsets:
|
|
922
|
-
visibleStartIndex:
|
|
923
|
-
visibleEndIndex:
|
|
932
|
+
background: O,
|
|
933
|
+
tapScrollCircleOptions: W,
|
|
934
|
+
inertiaOptions: D,
|
|
935
|
+
itemCount: ce,
|
|
936
|
+
renderThumbOverlay: ue,
|
|
937
|
+
wheelSpeedMultiplier: re = 1,
|
|
938
|
+
overscrollBehavior: oe = "auto",
|
|
939
|
+
onWheelHorizontal: de,
|
|
940
|
+
contentInsets: y,
|
|
941
|
+
visibleStartIndex: Y,
|
|
942
|
+
visibleEndIndex: w,
|
|
924
943
|
renderOverlay: Z,
|
|
925
944
|
initialScrollPosition: Q = 0,
|
|
926
|
-
contentProps:
|
|
927
|
-
},
|
|
928
|
-
const
|
|
929
|
-
|
|
930
|
-
if (!
|
|
945
|
+
contentProps: K
|
|
946
|
+
}, he) => {
|
|
947
|
+
const A = g(Number.isFinite(Q) ? Math.max(0, Q) : 0), I = g(null), G = g(null), fe = t === void 0, [$e, Ue] = Je(0), z = t ?? $e, ke = g(null);
|
|
948
|
+
et(() => {
|
|
949
|
+
if (!fe)
|
|
931
950
|
return;
|
|
932
|
-
const
|
|
933
|
-
if (!
|
|
951
|
+
const f = G.current;
|
|
952
|
+
if (!f)
|
|
934
953
|
return;
|
|
935
|
-
const
|
|
936
|
-
const
|
|
937
|
-
if (
|
|
938
|
-
|
|
954
|
+
const M = () => {
|
|
955
|
+
const H = f.offsetHeight;
|
|
956
|
+
if (H > 0) {
|
|
957
|
+
Ue((J) => J === H ? J : H);
|
|
939
958
|
return;
|
|
940
959
|
}
|
|
941
|
-
|
|
960
|
+
f.offsetParent !== null && e > 0 && ke.current !== "zero" && (ke.current = "zero", P.warn("[ScrollPane] The self-measured viewport is 0px. Give the scroll pane's host element a definite height (e.g. h-full, flex-1 + min-h-0, an explicit px height), or pass viewportSize explicitly."));
|
|
942
961
|
};
|
|
943
|
-
if (
|
|
962
|
+
if (M(), typeof ResizeObserver != "function")
|
|
944
963
|
return;
|
|
945
|
-
const
|
|
946
|
-
return
|
|
947
|
-
|
|
964
|
+
const q = new ResizeObserver(M);
|
|
965
|
+
return q.observe(f), () => {
|
|
966
|
+
q.disconnect();
|
|
948
967
|
};
|
|
949
|
-
}, [e,
|
|
950
|
-
|
|
951
|
-
}, [
|
|
952
|
-
if (
|
|
968
|
+
}, [e, fe]), et(() => {
|
|
969
|
+
fe && n?.($e);
|
|
970
|
+
}, [fe, $e, n]), et(() => {
|
|
971
|
+
if (fe)
|
|
953
972
|
return;
|
|
954
|
-
const
|
|
955
|
-
if (!
|
|
973
|
+
const f = I.current;
|
|
974
|
+
if (!f)
|
|
956
975
|
return;
|
|
957
|
-
const
|
|
958
|
-
const
|
|
959
|
-
if (
|
|
976
|
+
const M = () => {
|
|
977
|
+
const H = f.clientHeight;
|
|
978
|
+
if (H <= 0 || Math.abs(H - z) <= 1)
|
|
960
979
|
return;
|
|
961
|
-
const
|
|
962
|
-
|
|
963
|
-
`[ScrollPane] viewportSize=${
|
|
980
|
+
const J = `${z}/${H}`;
|
|
981
|
+
ke.current !== J && (ke.current = J, P.warn(
|
|
982
|
+
`[ScrollPane] viewportSize=${z} but the host band is ${H}px. The clip window, max scroll position, thumb mapping, rendered row count and scrollability all derive from viewportSize, so they are now wrong. Omit viewportSize to let the pane measure itself.`
|
|
964
983
|
));
|
|
965
984
|
};
|
|
966
|
-
if (
|
|
985
|
+
if (M(), typeof ResizeObserver != "function")
|
|
967
986
|
return;
|
|
968
|
-
const
|
|
969
|
-
return
|
|
970
|
-
|
|
987
|
+
const q = new ResizeObserver(M);
|
|
988
|
+
return q.observe(f), () => {
|
|
989
|
+
q.disconnect();
|
|
971
990
|
};
|
|
972
|
-
}, [
|
|
973
|
-
const
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
}, [
|
|
977
|
-
const
|
|
991
|
+
}, [fe, z]);
|
|
992
|
+
const We = g(de);
|
|
993
|
+
X(() => {
|
|
994
|
+
We.current = de;
|
|
995
|
+
}, [de]);
|
|
996
|
+
const Ve = g({
|
|
978
997
|
frame: null,
|
|
979
998
|
velocity: 0,
|
|
980
999
|
lastTimestamp: null,
|
|
981
1000
|
generation: 0
|
|
982
|
-
}),
|
|
1001
|
+
}), Fe = _e(
|
|
983
1002
|
() => ({
|
|
984
|
-
maxVelocity:
|
|
985
|
-
minVelocity:
|
|
986
|
-
deceleration:
|
|
987
|
-
velocitySampleWindow:
|
|
988
|
-
startVelocityThreshold:
|
|
1003
|
+
maxVelocity: D?.maxVelocity ?? _t.maxVelocity,
|
|
1004
|
+
minVelocity: D?.minVelocity ?? _t.minVelocity,
|
|
1005
|
+
deceleration: D?.deceleration ?? _t.deceleration,
|
|
1006
|
+
velocitySampleWindow: D?.velocitySampleWindow ?? _t.velocitySampleWindow,
|
|
1007
|
+
startVelocityThreshold: D?.startVelocityThreshold ?? _t.startVelocityThreshold
|
|
989
1008
|
}),
|
|
990
|
-
[
|
|
991
|
-
),
|
|
992
|
-
top: Math.max(0,
|
|
993
|
-
bottom: Math.max(0,
|
|
994
|
-
}), [
|
|
995
|
-
|
|
1009
|
+
[D]
|
|
1010
|
+
), Ke = _e(() => ({
|
|
1011
|
+
top: Math.max(0, y?.top ?? 0),
|
|
1012
|
+
bottom: Math.max(0, y?.bottom ?? 0)
|
|
1013
|
+
}), [y]);
|
|
1014
|
+
P.debug("[ScrollPane] ScrollPane rendered", () => ({
|
|
996
1015
|
contentSize: e,
|
|
997
|
-
viewportSize:
|
|
1016
|
+
viewportSize: z,
|
|
998
1017
|
scrollBarWidth: i,
|
|
999
|
-
className:
|
|
1018
|
+
className: T,
|
|
1000
1019
|
style: h,
|
|
1001
|
-
tapScrollCircleOptions:
|
|
1002
|
-
inertiaOptions:
|
|
1003
|
-
enablePointerDrag:
|
|
1004
|
-
contentInsets:
|
|
1020
|
+
tapScrollCircleOptions: W,
|
|
1021
|
+
inertiaOptions: D,
|
|
1022
|
+
enablePointerDrag: m,
|
|
1023
|
+
contentInsets: Ke
|
|
1005
1024
|
}));
|
|
1006
|
-
const
|
|
1007
|
-
(
|
|
1008
|
-
let
|
|
1009
|
-
|
|
1010
|
-
const { contentSize:
|
|
1011
|
-
if (
|
|
1012
|
-
return
|
|
1013
|
-
const
|
|
1014
|
-
if (!Number.isFinite(
|
|
1015
|
-
return
|
|
1016
|
-
const
|
|
1017
|
-
return
|
|
1025
|
+
const De = g({ contentSize: e, viewportSize: z }), Pe = _e(() => e > z, [e, z]), ze = S(
|
|
1026
|
+
(f, M) => {
|
|
1027
|
+
let q = M ?? De.current;
|
|
1028
|
+
M && !(Number.isFinite(M.contentSize) && Number.isFinite(M.viewportSize)) && (P.warn("[ScrollPane] scrollTo received non-finite dimsOverride; falling back to the committed dims", { dimsOverride: M }), q = De.current);
|
|
1029
|
+
const { contentSize: H, viewportSize: J } = q, Te = H > J, ee = A.current;
|
|
1030
|
+
if (P.debug("[ScrollPane] scrollTo called", () => ({ newPosition: f, contentSize: H, viewportSize: J, currentIsScrollable: Te, prevPosition: ee })), !Te)
|
|
1031
|
+
return A.current !== 0 && (A.current = 0, v?.(0, ee)), A.current;
|
|
1032
|
+
const xe = typeof f == "function" ? f(A.current) : f;
|
|
1033
|
+
if (!Number.isFinite(xe))
|
|
1034
|
+
return P.warn("[ScrollPane] scrollTo received a non-finite position; keeping the current position", { nextPosition: xe }), A.current;
|
|
1035
|
+
const ye = Math.max(H - J, 0), $ = se(xe, 0, ye);
|
|
1036
|
+
return A.current !== $ && (A.current = $, v?.($, ee)), A.current;
|
|
1018
1037
|
},
|
|
1019
|
-
[
|
|
1020
|
-
),
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
}, [
|
|
1024
|
-
const
|
|
1025
|
-
const
|
|
1026
|
-
|
|
1027
|
-
}, []),
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
}, [
|
|
1031
|
-
|
|
1038
|
+
[v]
|
|
1039
|
+
), be = g(ze);
|
|
1040
|
+
X(() => {
|
|
1041
|
+
be.current = ze;
|
|
1042
|
+
}, [ze]);
|
|
1043
|
+
const Se = S(() => {
|
|
1044
|
+
const f = Ve.current;
|
|
1045
|
+
f.generation += 1, f.frame !== null && cancelAnimationFrame(f.frame), f.frame = null, f.velocity = 0, f.lastTimestamp = null;
|
|
1046
|
+
}, []), j = g(Se);
|
|
1047
|
+
X(() => {
|
|
1048
|
+
j.current = Se;
|
|
1049
|
+
}, [Se]), X(() => () => {
|
|
1050
|
+
j.current();
|
|
1032
1051
|
}, []);
|
|
1033
|
-
const
|
|
1034
|
-
(
|
|
1035
|
-
if (!
|
|
1052
|
+
const tt = S(
|
|
1053
|
+
(f) => {
|
|
1054
|
+
if (!Pe)
|
|
1036
1055
|
return;
|
|
1037
|
-
const { maxVelocity:
|
|
1038
|
-
if (Math.abs(
|
|
1056
|
+
const { maxVelocity: M, minVelocity: q, deceleration: H, startVelocityThreshold: J } = Fe, Te = se(f, -M, M);
|
|
1057
|
+
if (Math.abs(Te) < J)
|
|
1039
1058
|
return;
|
|
1040
|
-
|
|
1041
|
-
const
|
|
1042
|
-
const
|
|
1043
|
-
if (
|
|
1059
|
+
Se(), Ve.current.velocity = Te, Ve.current.lastTimestamp = null;
|
|
1060
|
+
const ee = Ve.current.generation, xe = (ye) => {
|
|
1061
|
+
const $ = Ve.current;
|
|
1062
|
+
if ($.generation !== ee)
|
|
1044
1063
|
return;
|
|
1045
|
-
if (
|
|
1046
|
-
|
|
1064
|
+
if ($.lastTimestamp === null) {
|
|
1065
|
+
$.lastTimestamp = ye, $.frame = requestAnimationFrame(xe);
|
|
1047
1066
|
return;
|
|
1048
1067
|
}
|
|
1049
|
-
const
|
|
1050
|
-
if (
|
|
1051
|
-
|
|
1068
|
+
const Re = ye - $.lastTimestamp;
|
|
1069
|
+
if ($.lastTimestamp = ye, Re <= 0) {
|
|
1070
|
+
$.frame = requestAnimationFrame(xe);
|
|
1052
1071
|
return;
|
|
1053
1072
|
}
|
|
1054
|
-
const
|
|
1055
|
-
let
|
|
1056
|
-
const
|
|
1057
|
-
|
|
1058
|
-
const
|
|
1059
|
-
if (
|
|
1073
|
+
const Ce = $.velocity;
|
|
1074
|
+
let me = Ce;
|
|
1075
|
+
const Ee = H * Re;
|
|
1076
|
+
Ce > 0 ? me = Math.max(0, Ce - Ee) : Ce < 0 && (me = Math.min(0, Ce + Ee));
|
|
1077
|
+
const Le = (Ce + me) / 2 * Re, at = A.current;
|
|
1078
|
+
if (Le !== 0 && be.current((it) => it + Le), Ve.current.generation !== ee)
|
|
1060
1079
|
return;
|
|
1061
|
-
const
|
|
1062
|
-
|
|
1063
|
-
const
|
|
1064
|
-
if (Math.abs(
|
|
1065
|
-
|
|
1080
|
+
const Me = A.current, { contentSize: nt, viewportSize: p } = De.current, R = Math.max(nt - p, 0);
|
|
1081
|
+
$.velocity = me;
|
|
1082
|
+
const ae = Me === at || Me <= 0 && me <= 0 || Me >= R && me >= 0;
|
|
1083
|
+
if (Math.abs(me) < q || ae) {
|
|
1084
|
+
Se();
|
|
1066
1085
|
return;
|
|
1067
1086
|
}
|
|
1068
|
-
|
|
1087
|
+
$.frame = requestAnimationFrame(xe);
|
|
1069
1088
|
};
|
|
1070
|
-
|
|
1089
|
+
Ve.current.frame = requestAnimationFrame(xe);
|
|
1071
1090
|
},
|
|
1072
|
-
[
|
|
1073
|
-
),
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
}, [
|
|
1077
|
-
|
|
1078
|
-
}, [e,
|
|
1079
|
-
const
|
|
1080
|
-
if (!
|
|
1081
|
-
const
|
|
1082
|
-
|
|
1091
|
+
[Pe, Fe, Se]
|
|
1092
|
+
), Ge = g(tt);
|
|
1093
|
+
X(() => {
|
|
1094
|
+
Ge.current = tt;
|
|
1095
|
+
}, [tt]), et(() => {
|
|
1096
|
+
De.current = { contentSize: e, viewportSize: z };
|
|
1097
|
+
}, [e, z]), et(() => {
|
|
1098
|
+
const f = G.current;
|
|
1099
|
+
if (!f) return;
|
|
1100
|
+
const M = () => {
|
|
1101
|
+
f.scrollTop !== 0 && (P.debug("[ScrollPane] Native scroll detected, resetting to 0", () => ({ scrollTop: f.scrollTop })), f.scrollTop = 0), f.scrollLeft !== 0 && (f.scrollLeft = 0);
|
|
1083
1102
|
};
|
|
1084
|
-
return
|
|
1085
|
-
}, []),
|
|
1086
|
-
if (
|
|
1087
|
-
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1103
|
+
return f.addEventListener("scroll", M), () => f.removeEventListener("scroll", M);
|
|
1104
|
+
}, []), et(() => {
|
|
1105
|
+
if (Pe) {
|
|
1106
|
+
P.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", () => ({ contentSize: e, viewportSize: z, scrollPosition: A.current }));
|
|
1107
|
+
const f = se(e - z, 0, e);
|
|
1108
|
+
A.current > f && ze(f);
|
|
1090
1109
|
} else
|
|
1091
|
-
|
|
1092
|
-
}, [
|
|
1093
|
-
const
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
}, [
|
|
1097
|
-
const
|
|
1098
|
-
(
|
|
1099
|
-
if (
|
|
1110
|
+
ze(0);
|
|
1111
|
+
}, [Pe, ze, e, z]);
|
|
1112
|
+
const ft = g({ isScrollable: Pe, viewportSize: z, wheelSpeedMultiplier: re, overscrollBehavior: oe });
|
|
1113
|
+
et(() => {
|
|
1114
|
+
ft.current = { isScrollable: Pe, viewportSize: z, wheelSpeedMultiplier: re, overscrollBehavior: oe };
|
|
1115
|
+
}, [Pe, z, re, oe]);
|
|
1116
|
+
const st = S(
|
|
1117
|
+
(f) => {
|
|
1118
|
+
if (Zr(f))
|
|
1100
1119
|
return !1;
|
|
1101
|
-
const { isScrollable:
|
|
1102
|
-
if (
|
|
1120
|
+
const { isScrollable: M, viewportSize: q, wheelSpeedMultiplier: H, overscrollBehavior: J } = ft.current, Te = jr(f, q);
|
|
1121
|
+
if (Te.isZoomGesture)
|
|
1103
1122
|
return !1;
|
|
1104
|
-
if (
|
|
1105
|
-
return
|
|
1106
|
-
if (!
|
|
1123
|
+
if (Te.isHorizontalDominant)
|
|
1124
|
+
return We.current ? (gr(f), f.preventDefault(), Se(), We.current(Te.horizontalDelta), !0) : !1;
|
|
1125
|
+
if (!M || Te.verticalDelta === 0)
|
|
1107
1126
|
return !1;
|
|
1108
|
-
let
|
|
1109
|
-
if (
|
|
1110
|
-
const
|
|
1111
|
-
if (
|
|
1127
|
+
let ee = Te.verticalDelta;
|
|
1128
|
+
if (H !== 1 && (ee *= H), J !== "contain") {
|
|
1129
|
+
const xe = A.current, ye = Math.max(De.current.contentSize - q, 0);
|
|
1130
|
+
if (ee > 0 && xe >= ye || ee < 0 && xe <= 0)
|
|
1112
1131
|
return !1;
|
|
1113
1132
|
}
|
|
1114
|
-
return
|
|
1133
|
+
return gr(f), f.preventDefault(), Se(), P.debug("[ScrollPane] wheel event", () => ({ deltaY: ee, scrollPosition: A.current, wheelSpeedMultiplier: H, deltaMode: f.deltaMode, scrollTop: G.current?.scrollTop })), ze((xe) => xe + ee), !0;
|
|
1115
1134
|
},
|
|
1116
|
-
[
|
|
1135
|
+
[ze, Se]
|
|
1117
1136
|
);
|
|
1118
|
-
|
|
1119
|
-
const
|
|
1120
|
-
|
|
1121
|
-
},
|
|
1122
|
-
|
|
1123
|
-
},
|
|
1124
|
-
return
|
|
1125
|
-
|
|
1137
|
+
X(() => {
|
|
1138
|
+
const f = (H) => {
|
|
1139
|
+
st(H);
|
|
1140
|
+
}, M = () => {
|
|
1141
|
+
Se();
|
|
1142
|
+
}, q = I.current;
|
|
1143
|
+
return q && (q.addEventListener("wheel", f, { passive: !1 }), q.addEventListener("pointerdown", M, { capture: !0, passive: !0 })), () => {
|
|
1144
|
+
q && (q.removeEventListener("wheel", f), q.removeEventListener("pointerdown", M, { capture: !0 }));
|
|
1126
1145
|
};
|
|
1127
|
-
}, [
|
|
1128
|
-
|
|
1146
|
+
}, [st, Se]), ir(
|
|
1147
|
+
he,
|
|
1129
1148
|
() => ({
|
|
1130
|
-
scrollTo: (
|
|
1131
|
-
getScrollPosition: () =>
|
|
1149
|
+
scrollTo: (f, M) => (Se(), ze(f, M)),
|
|
1150
|
+
getScrollPosition: () => A.current,
|
|
1132
1151
|
getContentSize: () => e,
|
|
1133
|
-
getViewportSize: () =>
|
|
1134
|
-
applyWheel:
|
|
1152
|
+
getViewportSize: () => z,
|
|
1153
|
+
applyWheel: st
|
|
1135
1154
|
}),
|
|
1136
|
-
[
|
|
1155
|
+
[ze, e, z, Se, st]
|
|
1137
1156
|
);
|
|
1138
|
-
const
|
|
1157
|
+
const N = Vr(), gt = K?.id ?? N, ne = g({
|
|
1139
1158
|
pointerType: "",
|
|
1140
1159
|
pointerId: null,
|
|
1141
1160
|
startClientY: 0,
|
|
@@ -1144,151 +1163,151 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
1144
1163
|
shouldCancelNextClick: !1,
|
|
1145
1164
|
clickResetTimer: null,
|
|
1146
1165
|
velocitySamples: []
|
|
1147
|
-
}),
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
}, [
|
|
1151
|
-
|
|
1166
|
+
}), V = g(m), ot = g(b);
|
|
1167
|
+
X(() => {
|
|
1168
|
+
V.current = m;
|
|
1169
|
+
}, [m]), X(() => {
|
|
1170
|
+
ot.current = b;
|
|
1152
1171
|
}, [b]);
|
|
1153
|
-
const
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
}, [
|
|
1157
|
-
const
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
}, [
|
|
1161
|
-
const
|
|
1162
|
-
if (
|
|
1172
|
+
const je = g(Pe);
|
|
1173
|
+
X(() => {
|
|
1174
|
+
je.current = Pe;
|
|
1175
|
+
}, [Pe]);
|
|
1176
|
+
const mt = g(Fe);
|
|
1177
|
+
X(() => {
|
|
1178
|
+
mt.current = Fe;
|
|
1179
|
+
}, [Fe]), X(() => {
|
|
1180
|
+
const f = ne.current;
|
|
1181
|
+
if (m && Pe && (f.pointerId === null || Qt(f.pointerType, b)) || f.pointerId === null)
|
|
1163
1182
|
return;
|
|
1164
|
-
const
|
|
1165
|
-
|
|
1166
|
-
const
|
|
1167
|
-
|
|
1168
|
-
}, [
|
|
1169
|
-
const
|
|
1170
|
-
if (!
|
|
1183
|
+
const M = G.current;
|
|
1184
|
+
f.clickResetTimer !== null && (window.clearTimeout(f.clickResetTimer), f.clickResetTimer = null);
|
|
1185
|
+
const q = f.isDragging && f.shouldCancelNextClick, H = f.pointerId;
|
|
1186
|
+
f.pointerId = null, f.pointerType = "", f.startClientY = 0, f.startScroll = 0, f.isDragging = !1, f.shouldCancelNextClick = q, f.velocitySamples = [], M?.hasPointerCapture(H) && M.releasePointerCapture(H);
|
|
1187
|
+
}, [m, b, Pe]), X(() => {
|
|
1188
|
+
const f = G.current;
|
|
1189
|
+
if (!f)
|
|
1171
1190
|
return;
|
|
1172
|
-
const
|
|
1173
|
-
const
|
|
1174
|
-
|
|
1175
|
-
},
|
|
1176
|
-
const
|
|
1177
|
-
|
|
1178
|
-
},
|
|
1179
|
-
const
|
|
1180
|
-
|
|
1181
|
-
const
|
|
1182
|
-
|
|
1183
|
-
},
|
|
1184
|
-
const
|
|
1185
|
-
|
|
1186
|
-
},
|
|
1187
|
-
const
|
|
1188
|
-
if (!
|
|
1189
|
-
if (
|
|
1191
|
+
const M = 6, q = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), H = () => {
|
|
1192
|
+
const p = ne.current;
|
|
1193
|
+
p.pointerId = null, p.pointerType = "", p.startClientY = 0, p.startScroll = 0, p.isDragging = !1, p.velocitySamples = [];
|
|
1194
|
+
}, J = () => {
|
|
1195
|
+
const p = ne.current;
|
|
1196
|
+
p.clickResetTimer !== null && (window.clearTimeout(p.clickResetTimer), p.clickResetTimer = null);
|
|
1197
|
+
}, Te = (p) => {
|
|
1198
|
+
const R = ne.current, ae = q();
|
|
1199
|
+
R.velocitySamples.push({ clientY: p, time: ae });
|
|
1200
|
+
const it = mt.current.velocitySampleWindow;
|
|
1201
|
+
R.velocitySamples = R.velocitySamples.filter((Ne) => ae - Ne.time <= it);
|
|
1202
|
+
}, ee = (p) => p instanceof HTMLElement && p.closest("[data-scrollpane-ignore-drag='true']") !== null, xe = (p) => {
|
|
1203
|
+
const R = ne.current;
|
|
1204
|
+
R.shouldCancelNextClick && (p.preventDefault(), p.stopPropagation(), R.shouldCancelNextClick = !1);
|
|
1205
|
+
}, ye = (p) => {
|
|
1206
|
+
const R = ne.current;
|
|
1207
|
+
if (!R.isDragging) {
|
|
1208
|
+
if (R.isDragging = !0, R.shouldCancelNextClick = !0, !f.hasPointerCapture(p.pointerId))
|
|
1190
1209
|
try {
|
|
1191
|
-
|
|
1210
|
+
f.setPointerCapture(p.pointerId);
|
|
1192
1211
|
} catch {
|
|
1193
1212
|
}
|
|
1194
|
-
|
|
1213
|
+
Te(p.clientY);
|
|
1195
1214
|
}
|
|
1196
|
-
},
|
|
1197
|
-
const
|
|
1198
|
-
|
|
1199
|
-
},
|
|
1200
|
-
const
|
|
1201
|
-
if (
|
|
1215
|
+
}, $ = (p) => p.isTrusted || p.target === f, Re = (p) => {
|
|
1216
|
+
const R = ne.current;
|
|
1217
|
+
f.hasPointerCapture(p) && f.releasePointerCapture(p), R.shouldCancelNextClick = !1, J(), H();
|
|
1218
|
+
}, Ce = (p) => {
|
|
1219
|
+
const R = ne.current;
|
|
1220
|
+
if (R.pointerId !== p.pointerId)
|
|
1202
1221
|
return;
|
|
1203
|
-
if (
|
|
1204
|
-
|
|
1222
|
+
if (p.buttons === 0 && Jr(p.pointerType)) {
|
|
1223
|
+
Re(p.pointerId);
|
|
1205
1224
|
return;
|
|
1206
1225
|
}
|
|
1207
|
-
if (!(
|
|
1226
|
+
if (!(V.current && je.current) || !Qt(p.pointerType, ot.current) || !R.isDragging && (Math.abs(p.clientY - R.startClientY) < M || (ye(p), !R.isDragging)))
|
|
1208
1227
|
return;
|
|
1209
|
-
|
|
1210
|
-
const
|
|
1211
|
-
|
|
1212
|
-
},
|
|
1213
|
-
const
|
|
1214
|
-
return
|
|
1215
|
-
const
|
|
1216
|
-
|
|
1228
|
+
Te(p.clientY);
|
|
1229
|
+
const ae = p.clientY - R.startClientY, it = R.startScroll - ae;
|
|
1230
|
+
be.current(it), p.cancelable && p.preventDefault();
|
|
1231
|
+
}, me = () => {
|
|
1232
|
+
const p = ne.current;
|
|
1233
|
+
return p.pointerId !== null || !p.shouldCancelNextClick ? !1 : (J(), p.clickResetTimer = window.setTimeout(() => {
|
|
1234
|
+
const R = ne.current;
|
|
1235
|
+
R.shouldCancelNextClick = !1, R.clickResetTimer = null;
|
|
1217
1236
|
}, 0), !0);
|
|
1218
|
-
},
|
|
1219
|
-
const
|
|
1220
|
-
if (
|
|
1221
|
-
|
|
1237
|
+
}, Ee = (p) => {
|
|
1238
|
+
const R = ne.current;
|
|
1239
|
+
if (R.pointerId !== p.pointerId) {
|
|
1240
|
+
me();
|
|
1222
1241
|
return;
|
|
1223
1242
|
}
|
|
1224
|
-
|
|
1225
|
-
let
|
|
1226
|
-
if (
|
|
1227
|
-
const
|
|
1228
|
-
if (
|
|
1229
|
-
const
|
|
1230
|
-
|
|
1243
|
+
R.isDragging && R.shouldCancelNextClick && p.cancelable && (p.preventDefault(), p.stopPropagation()), R.isDragging && Te(p.clientY);
|
|
1244
|
+
let ae = 0;
|
|
1245
|
+
if (R.isDragging && R.velocitySamples.length >= 2) {
|
|
1246
|
+
const Ne = R.velocitySamples, zt = mt.current.velocitySampleWindow, ct = Ne[Ne.length - 1], Ye = Ne.find((bt) => ct.time - bt.time <= zt) ?? Ne[0];
|
|
1247
|
+
if (ct && Ye && ct.time !== Ye.time) {
|
|
1248
|
+
const bt = ct.clientY - Ye.clientY, Pt = ct.time - Ye.time;
|
|
1249
|
+
ae = -(bt / Pt);
|
|
1231
1250
|
}
|
|
1232
1251
|
}
|
|
1233
|
-
|
|
1234
|
-
const
|
|
1235
|
-
|
|
1252
|
+
J(), R.shouldCancelNextClick && (R.clickResetTimer = window.setTimeout(() => {
|
|
1253
|
+
const Ne = ne.current;
|
|
1254
|
+
Ne.shouldCancelNextClick = !1, Ne.clickResetTimer = null;
|
|
1236
1255
|
}, 0));
|
|
1237
|
-
const
|
|
1238
|
-
|
|
1239
|
-
},
|
|
1240
|
-
if (
|
|
1241
|
-
if (!
|
|
1256
|
+
const it = mt.current.startVelocityThreshold;
|
|
1257
|
+
H(), f.hasPointerCapture(p.pointerId) && f.releasePointerCapture(p.pointerId), Math.abs(ae) >= it && Ge.current?.(ae);
|
|
1258
|
+
}, rt = (p) => {
|
|
1259
|
+
if (ne.current.pointerId !== null) {
|
|
1260
|
+
if (!p.isPrimary || p.pointerType !== ne.current.pointerType)
|
|
1242
1261
|
return;
|
|
1243
|
-
|
|
1262
|
+
Re(ne.current.pointerId);
|
|
1244
1263
|
}
|
|
1245
|
-
if (
|
|
1264
|
+
if (ne.current.shouldCancelNextClick && (J(), ne.current.shouldCancelNextClick = !1), !(V.current && je.current) || !Qt(p.pointerType, ot.current) || p.button !== 0 && p.pointerType === "mouse" || p.ctrlKey || p.metaKey || p.altKey || ee(p.target))
|
|
1246
1265
|
return;
|
|
1247
|
-
window.dispatchEvent(new CustomEvent(
|
|
1248
|
-
const
|
|
1249
|
-
|
|
1250
|
-
},
|
|
1251
|
-
if (
|
|
1252
|
-
|
|
1266
|
+
window.dispatchEvent(new CustomEvent(tr, { detail: { paneId: N } })), j.current?.();
|
|
1267
|
+
const R = ne.current;
|
|
1268
|
+
J(), R.pointerId = p.pointerId, R.pointerType = p.pointerType, R.startClientY = p.clientY, R.startScroll = A.current, R.isDragging = !1, R.shouldCancelNextClick = !1, R.velocitySamples = [];
|
|
1269
|
+
}, Le = (p) => {
|
|
1270
|
+
if (ne.current.pointerId !== p.pointerId) {
|
|
1271
|
+
me();
|
|
1253
1272
|
return;
|
|
1254
1273
|
}
|
|
1255
|
-
|
|
1256
|
-
},
|
|
1257
|
-
["click",
|
|
1258
|
-
["pointerdown",
|
|
1259
|
-
["lostpointercapture", (
|
|
1260
|
-
|
|
1274
|
+
$(p) && Re(p.pointerId);
|
|
1275
|
+
}, Me = [
|
|
1276
|
+
["click", xe, !0],
|
|
1277
|
+
["pointerdown", rt, { passive: !1 }],
|
|
1278
|
+
["lostpointercapture", (p) => {
|
|
1279
|
+
p.target !== f || ne.current.pointerId !== p.pointerId || Re(p.pointerId);
|
|
1261
1280
|
}, void 0]
|
|
1262
|
-
],
|
|
1263
|
-
["pointermove",
|
|
1264
|
-
["pointerup",
|
|
1265
|
-
["pointercancel",
|
|
1281
|
+
], nt = [
|
|
1282
|
+
["pointermove", Ce, { passive: !1 }],
|
|
1283
|
+
["pointerup", Ee, void 0],
|
|
1284
|
+
["pointercancel", Le, void 0]
|
|
1266
1285
|
];
|
|
1267
|
-
return
|
|
1268
|
-
|
|
1269
|
-
const
|
|
1270
|
-
|
|
1286
|
+
return qt(f, Me, "add"), qt(window, nt, "add"), () => {
|
|
1287
|
+
qt(f, Me, "remove"), qt(window, nt, "remove");
|
|
1288
|
+
const p = ne.current;
|
|
1289
|
+
p.pointerId !== null && f.hasPointerCapture(p.pointerId) && f.releasePointerCapture(p.pointerId), J(), H();
|
|
1271
1290
|
};
|
|
1272
|
-
}, [
|
|
1273
|
-
const
|
|
1274
|
-
(
|
|
1275
|
-
[
|
|
1291
|
+
}, [N]);
|
|
1292
|
+
const Ae = S(
|
|
1293
|
+
(f) => (Se(), ze(f)),
|
|
1294
|
+
[ze, Se]
|
|
1276
1295
|
);
|
|
1277
|
-
return /* @__PURE__ */
|
|
1278
|
-
/* @__PURE__ */
|
|
1296
|
+
return /* @__PURE__ */ Tt("div", { ref: I, "data-testid": C, "data-self-measured": fe ? "true" : void 0, className: Vt("aqvs-scroll-pane", T), style: h, children: [
|
|
1297
|
+
/* @__PURE__ */ Tt(
|
|
1279
1298
|
"div",
|
|
1280
1299
|
{
|
|
1281
|
-
ref:
|
|
1282
|
-
className:
|
|
1300
|
+
ref: G,
|
|
1301
|
+
className: Vt("aqvs-scroll-pane-content"),
|
|
1283
1302
|
"data-testid": "aqvs-scroll-pane-content",
|
|
1284
1303
|
style: {
|
|
1285
1304
|
// ❗ 自己計測モードでは高さを書かない。CSS の `height: 100%` (= ルートの確定高さ) が
|
|
1286
1305
|
// レイアウトを所有することで、「計測した値を書き戻して自分のサイズを変える」
|
|
1287
1306
|
// フィードバックループが構造的に起こらず、初回 paint の時点でも帯は実寸で正しい
|
|
1288
1307
|
// (数値の反映だけが 1 コミット遅れる)。明示モードは従来どおり px を書く。
|
|
1289
|
-
height:
|
|
1290
|
-
paddingTop:
|
|
1291
|
-
paddingBottom:
|
|
1308
|
+
height: fe ? void 0 : z,
|
|
1309
|
+
paddingTop: Ke.top,
|
|
1310
|
+
paddingBottom: Ke.bottom,
|
|
1292
1311
|
// スクロール不能時 (contentSize <= viewportSize) は touch-action を通常に戻し、
|
|
1293
1312
|
// 短いリスト上のタッチがページ全体のパンを妨げるデッドゾーン化を防ぐ。
|
|
1294
1313
|
// 直接操作 (指・ペン) のドラッグを許可していない場合も付けない。
|
|
@@ -1302,102 +1321,102 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
1302
1321
|
// 同一条件で揃えてあるため状態としても一貫している。
|
|
1303
1322
|
// 非同期コンテンツを先読みして確保する挙動は意図的に入れていない
|
|
1304
1323
|
// (空のペインがページのパンを殺すデッドゾーンになり、そちらの実害の方が大きいため)。
|
|
1305
|
-
...
|
|
1324
|
+
...m && Pe && b.some((f) => f === "touch" || f === "pen") ? { touchAction: "none" } : {}
|
|
1306
1325
|
},
|
|
1307
|
-
...
|
|
1308
|
-
id:
|
|
1326
|
+
...K,
|
|
1327
|
+
id: gt,
|
|
1309
1328
|
children: [
|
|
1310
|
-
|
|
1311
|
-
r(
|
|
1329
|
+
O,
|
|
1330
|
+
r(A.current)
|
|
1312
1331
|
]
|
|
1313
1332
|
}
|
|
1314
1333
|
),
|
|
1315
|
-
/* @__PURE__ */
|
|
1316
|
-
|
|
1334
|
+
/* @__PURE__ */ ie(
|
|
1335
|
+
Kr,
|
|
1317
1336
|
{
|
|
1318
1337
|
contentSize: e,
|
|
1319
|
-
viewportSize:
|
|
1320
|
-
scrollPosition:
|
|
1321
|
-
onScroll:
|
|
1338
|
+
viewportSize: z,
|
|
1339
|
+
scrollPosition: A.current,
|
|
1340
|
+
onScroll: Ae,
|
|
1322
1341
|
enableThumbDrag: s,
|
|
1323
|
-
enableTrackClick:
|
|
1324
|
-
enableArrowButtons:
|
|
1342
|
+
enableTrackClick: l,
|
|
1343
|
+
enableArrowButtons: d,
|
|
1325
1344
|
scrollBarWidth: i,
|
|
1326
|
-
ariaControls:
|
|
1327
|
-
tapScrollCircleOptions:
|
|
1328
|
-
itemCount:
|
|
1329
|
-
renderThumbOverlay:
|
|
1330
|
-
visibleStartIndex:
|
|
1331
|
-
visibleEndIndex:
|
|
1345
|
+
ariaControls: gt,
|
|
1346
|
+
tapScrollCircleOptions: W,
|
|
1347
|
+
itemCount: ce,
|
|
1348
|
+
renderThumbOverlay: ue,
|
|
1349
|
+
visibleStartIndex: Y,
|
|
1350
|
+
visibleEndIndex: w
|
|
1332
1351
|
},
|
|
1333
1352
|
"scrollbar"
|
|
1334
1353
|
),
|
|
1335
1354
|
Z?.()
|
|
1336
1355
|
] });
|
|
1337
1356
|
}
|
|
1338
|
-
),
|
|
1339
|
-
const i = Math.max(n / 2, 1), s = 1 + e * 0.65,
|
|
1340
|
-
return /* @__PURE__ */
|
|
1341
|
-
/* @__PURE__ */
|
|
1357
|
+
), br = (r, e, t) => Math.min(Math.max(r, e), t), xn = ({ dragState: r, normalizedDistance: e, sizeScale: t, size: n }) => {
|
|
1358
|
+
const i = Math.max(n / 2, 1), s = 1 + e * 0.65, l = Math.max(0.65, 1 - e * 0.25), d = r.direction * e * 26 * t, m = 0.8 + e * 0.18, b = 3 * t, v = 6 * t, T = 22 * t, C = Math.abs(d) + v, h = d > 0 ? b : -Math.abs(d) - b, O = Math.max(2.5, 3 * t), W = br(r.offsetX, -i, i), D = br(r.offsetY, -i, i), ce = i * 0.35, ue = W / i * ce, re = D / i * ce, oe = ue * 0.45, de = re * 0.45, y = Math.max(T * 0.38, 6), Y = 0.65 + e * 0.2, w = r.active;
|
|
1359
|
+
return /* @__PURE__ */ Tt(rr, { children: [
|
|
1360
|
+
/* @__PURE__ */ ie(
|
|
1342
1361
|
"div",
|
|
1343
1362
|
{
|
|
1344
1363
|
className: "aqvs-tap-scroll-circle-gradient",
|
|
1345
1364
|
style: {
|
|
1346
|
-
transform: `scale(${
|
|
1347
|
-
transition:
|
|
1365
|
+
transform: `scale(${l}, ${s})`,
|
|
1366
|
+
transition: w ? "40ms transform ease-out" : "200ms ease transform"
|
|
1348
1367
|
}
|
|
1349
1368
|
}
|
|
1350
1369
|
),
|
|
1351
|
-
/* @__PURE__ */
|
|
1370
|
+
/* @__PURE__ */ ie(
|
|
1352
1371
|
"div",
|
|
1353
1372
|
{
|
|
1354
1373
|
className: "aqvs-sample-visual-pupil",
|
|
1355
1374
|
style: {
|
|
1356
|
-
width:
|
|
1357
|
-
height:
|
|
1358
|
-
transform: `translate(calc(-50% + ${
|
|
1359
|
-
transition:
|
|
1375
|
+
width: T,
|
|
1376
|
+
height: T,
|
|
1377
|
+
transform: `translate(calc(-50% + ${ue}px), calc(-50% + ${re}px)) scale(${l}, ${m * s})`,
|
|
1378
|
+
transition: w ? "70ms transform ease-out" : "200ms ease transform"
|
|
1360
1379
|
}
|
|
1361
1380
|
}
|
|
1362
1381
|
),
|
|
1363
|
-
/* @__PURE__ */
|
|
1382
|
+
/* @__PURE__ */ ie(
|
|
1364
1383
|
"div",
|
|
1365
1384
|
{
|
|
1366
1385
|
className: "aqvs-sample-visual-highlight",
|
|
1367
1386
|
style: {
|
|
1368
|
-
width:
|
|
1369
|
-
height:
|
|
1370
|
-
transform: `translate(calc(-50% + ${
|
|
1371
|
-
opacity:
|
|
1387
|
+
width: y,
|
|
1388
|
+
height: y,
|
|
1389
|
+
transform: `translate(calc(-50% + ${oe}px), calc(-50% + ${de}px)) scale(${l}, ${s})`,
|
|
1390
|
+
opacity: Y,
|
|
1372
1391
|
boxShadow: "0 0 8px rgba(255,255,255,0.45)",
|
|
1373
|
-
transition:
|
|
1392
|
+
transition: w ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
|
|
1374
1393
|
}
|
|
1375
1394
|
}
|
|
1376
1395
|
),
|
|
1377
|
-
/* @__PURE__ */
|
|
1396
|
+
/* @__PURE__ */ ie(
|
|
1378
1397
|
"div",
|
|
1379
1398
|
{
|
|
1380
1399
|
className: "aqvs-sample-visual-rod",
|
|
1381
1400
|
style: {
|
|
1382
|
-
width:
|
|
1383
|
-
height:
|
|
1401
|
+
width: O,
|
|
1402
|
+
height: C,
|
|
1384
1403
|
transform: `translate(-50%, ${h}px)`,
|
|
1385
1404
|
opacity: e,
|
|
1386
|
-
transition:
|
|
1405
|
+
transition: w ? "40ms height, 60ms opacity ease-out ease-out" : "200ms ease height, 120ms ease opacity"
|
|
1387
1406
|
}
|
|
1388
1407
|
}
|
|
1389
1408
|
)
|
|
1390
1409
|
] });
|
|
1391
|
-
},
|
|
1410
|
+
}, Xt = 100, tn = (r) => {
|
|
1392
1411
|
if (!Number.isFinite(r))
|
|
1393
1412
|
return 0n;
|
|
1394
1413
|
const e = Math.trunc(r);
|
|
1395
1414
|
return e <= 0 ? 0n : BigInt(e);
|
|
1396
|
-
},
|
|
1415
|
+
}, Jt = (r, e) => {
|
|
1397
1416
|
if (!Number.isFinite(r))
|
|
1398
1417
|
throw new Error(`valueFn returned a non-finite value at index ${e}: ${r}`);
|
|
1399
1418
|
return r;
|
|
1400
|
-
},
|
|
1419
|
+
}, Nt = (r) => {
|
|
1401
1420
|
if (r <= 0 || !Number.isFinite(r))
|
|
1402
1421
|
return 0;
|
|
1403
1422
|
const e = Math.trunc(r);
|
|
@@ -1406,7 +1425,7 @@ const le = (r, e, t) => Math.max(e, Math.min(t, r)), Gt = "virtualscroll:tap-scr
|
|
|
1406
1425
|
const t = BigInt(e) & -BigInt(e);
|
|
1407
1426
|
return Number(t);
|
|
1408
1427
|
};
|
|
1409
|
-
class
|
|
1428
|
+
class St {
|
|
1410
1429
|
/**
|
|
1411
1430
|
* @private
|
|
1412
1431
|
* @property {Map<number, number>} tree - The Map storing the Fenwick tree structure, specifically the sums of deltas. It is 1-indexed.
|
|
@@ -1470,27 +1489,27 @@ class It {
|
|
|
1470
1489
|
this.size = i, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.valueFn = void 0, this.baseValue = t, this.total = this.baseValue * this.size;
|
|
1471
1490
|
return;
|
|
1472
1491
|
}
|
|
1473
|
-
let s = 0,
|
|
1492
|
+
let s = 0, l;
|
|
1474
1493
|
if (i > 0) {
|
|
1475
|
-
const
|
|
1494
|
+
const d = n?.sampleRange ?? {
|
|
1476
1495
|
from: 0,
|
|
1477
|
-
to: Math.min(
|
|
1496
|
+
to: Math.min(Xt - 1, i - 1)
|
|
1478
1497
|
};
|
|
1479
|
-
let
|
|
1480
|
-
if (
|
|
1481
|
-
s =
|
|
1498
|
+
let m = Math.max(0, Math.trunc(d.from)), b = Math.min(Math.trunc(d.to), i - 1);
|
|
1499
|
+
if (m > b && (m = 0, b = Math.min(Xt - 1, i - 1)), i > Xt)
|
|
1500
|
+
s = St._sampleBaseValueStrided(t, i, Xt), n?.materialize && (l = { from: m, values: St._collectValidatedValues(t, m, b) });
|
|
1482
1501
|
else {
|
|
1483
|
-
const
|
|
1484
|
-
s =
|
|
1502
|
+
const v = St._collectValidatedValues(t, m, b);
|
|
1503
|
+
s = St._modeOrMedian([...v]), n?.materialize && (l = { from: m, values: v });
|
|
1485
1504
|
}
|
|
1486
1505
|
}
|
|
1487
|
-
if (this.size = i, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.total = void 0, this.valueFn = t, this.baseValue = s,
|
|
1488
|
-
for (let
|
|
1489
|
-
const
|
|
1490
|
-
if (
|
|
1506
|
+
if (this.size = i, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.total = void 0, this.valueFn = t, this.baseValue = s, l)
|
|
1507
|
+
for (let d = 0; d < l.values.length; d++) {
|
|
1508
|
+
const m = l.from + d;
|
|
1509
|
+
if (m >= this.size)
|
|
1491
1510
|
break;
|
|
1492
|
-
const b =
|
|
1493
|
-
b !== 0 && (this.deltas.set(
|
|
1511
|
+
const b = l.values[d] - this.baseValue;
|
|
1512
|
+
b !== 0 && (this.deltas.set(m, b), this._updateTree(m, b));
|
|
1494
1513
|
}
|
|
1495
1514
|
this.total = this.getTotal();
|
|
1496
1515
|
}
|
|
@@ -1521,7 +1540,7 @@ class It {
|
|
|
1521
1540
|
static _collectValidatedValues(e, t, n) {
|
|
1522
1541
|
const i = [];
|
|
1523
1542
|
for (let s = t; s <= n; s++)
|
|
1524
|
-
i.push(
|
|
1543
|
+
i.push(Jt(e(s), s));
|
|
1525
1544
|
return i;
|
|
1526
1545
|
}
|
|
1527
1546
|
/**
|
|
@@ -1535,22 +1554,22 @@ class It {
|
|
|
1535
1554
|
static _modeOrMedian(e) {
|
|
1536
1555
|
if (e.length === 0)
|
|
1537
1556
|
return 0;
|
|
1538
|
-
e.sort((
|
|
1557
|
+
e.sort((l, d) => l - d);
|
|
1539
1558
|
const t = Math.floor(e.length / 2);
|
|
1540
1559
|
let n;
|
|
1541
1560
|
e.length % 2 === 0 ? n = Math.floor((e[t - 1] + e[t]) / 2) : n = e[t];
|
|
1542
1561
|
const i = /* @__PURE__ */ new Map();
|
|
1543
1562
|
let s = 0;
|
|
1544
|
-
for (const
|
|
1545
|
-
const
|
|
1546
|
-
i.set(
|
|
1563
|
+
for (const l of e) {
|
|
1564
|
+
const d = (i.get(l) ?? 0) + 1;
|
|
1565
|
+
i.set(l, d), d > s && (s = d);
|
|
1547
1566
|
}
|
|
1548
1567
|
if (s > e.length * 0.2) {
|
|
1549
|
-
const
|
|
1550
|
-
for (const [
|
|
1551
|
-
b === s &&
|
|
1552
|
-
const
|
|
1553
|
-
n = Math.floor(
|
|
1568
|
+
const l = [];
|
|
1569
|
+
for (const [m, b] of i.entries())
|
|
1570
|
+
b === s && l.push(m);
|
|
1571
|
+
const d = l.reduce((m, b) => m + b, 0);
|
|
1572
|
+
n = Math.floor(d / l.length);
|
|
1554
1573
|
}
|
|
1555
1574
|
return n;
|
|
1556
1575
|
}
|
|
@@ -1570,9 +1589,9 @@ class It {
|
|
|
1570
1589
|
let i = Math.max(1, Math.ceil(t / n));
|
|
1571
1590
|
i % 2 === 0 && (i += 1);
|
|
1572
1591
|
const s = [];
|
|
1573
|
-
for (let
|
|
1574
|
-
s.push(
|
|
1575
|
-
return
|
|
1592
|
+
for (let l = 0; l < t && s.length < n; l += i)
|
|
1593
|
+
s.push(Jt(e(l), l));
|
|
1594
|
+
return St._modeOrMedian(s);
|
|
1576
1595
|
}
|
|
1577
1596
|
/**
|
|
1578
1597
|
* @method update
|
|
@@ -1619,14 +1638,14 @@ class It {
|
|
|
1619
1638
|
throw new Error(`Index must be an integer: ${n}`);
|
|
1620
1639
|
if (!Number.isFinite(i))
|
|
1621
1640
|
throw new Error(`Change must be a finite number: ${i}`);
|
|
1622
|
-
const
|
|
1623
|
-
if (
|
|
1624
|
-
throw new Error(`Change would make the value at index ${n} negative: ${
|
|
1625
|
-
t.set(n,
|
|
1641
|
+
const l = (t.get(n) ?? this.deltas.get(n) ?? 0) + i;
|
|
1642
|
+
if (l + this.baseValue < -1e-9)
|
|
1643
|
+
throw new Error(`Change would make the value at index ${n} negative: ${l + this.baseValue}`);
|
|
1644
|
+
t.set(n, l);
|
|
1626
1645
|
}
|
|
1627
1646
|
for (const { index: n, change: i } of e) {
|
|
1628
|
-
const
|
|
1629
|
-
|
|
1647
|
+
const l = (this.deltas.get(n) ?? 0) + i;
|
|
1648
|
+
l === 0 ? this.deltas.delete(n) : this.deltas.set(n, l), this._updateTree(n, i);
|
|
1630
1649
|
}
|
|
1631
1650
|
return this.total;
|
|
1632
1651
|
}
|
|
@@ -1644,7 +1663,7 @@ class It {
|
|
|
1644
1663
|
let n = e + 1;
|
|
1645
1664
|
for (; n <= this.size; ) {
|
|
1646
1665
|
this.tree.set(n, (this.tree.get(n) ?? 0) + t);
|
|
1647
|
-
const i =
|
|
1666
|
+
const i = Nt(n);
|
|
1648
1667
|
if (i === 0)
|
|
1649
1668
|
break;
|
|
1650
1669
|
n += i;
|
|
@@ -1670,8 +1689,8 @@ class It {
|
|
|
1670
1689
|
throw new Error(`Value must be a finite number: ${s}`);
|
|
1671
1690
|
if (s < 0)
|
|
1672
1691
|
throw new Error("Value cannot be negative.");
|
|
1673
|
-
const
|
|
1674
|
-
|
|
1692
|
+
const l = n.has(i) ? n.get(i) ?? 0 : this.deltas.get(i) ?? 0, d = l + this.baseValue, m = s - d;
|
|
1693
|
+
m !== 0 && t.push({ index: i, change: m }), n.set(i, l + m);
|
|
1675
1694
|
}
|
|
1676
1695
|
return t;
|
|
1677
1696
|
}
|
|
@@ -1688,7 +1707,7 @@ class It {
|
|
|
1688
1707
|
let e = 0, t = this.size;
|
|
1689
1708
|
for (; t > 0; ) {
|
|
1690
1709
|
e += this.tree.get(t) ?? 0;
|
|
1691
|
-
const n =
|
|
1710
|
+
const n = Nt(t);
|
|
1692
1711
|
if (n === 0)
|
|
1693
1712
|
break;
|
|
1694
1713
|
t -= n;
|
|
@@ -1705,10 +1724,10 @@ class It {
|
|
|
1705
1724
|
*/
|
|
1706
1725
|
_materialize(e, t = !0) {
|
|
1707
1726
|
if (this.valueFn) {
|
|
1708
|
-
const n = this.deltas.get(e) ?? 0, s =
|
|
1727
|
+
const n = this.deltas.get(e) ?? 0, s = Jt(this.valueFn(e), e) - this.baseValue;
|
|
1709
1728
|
if (s !== n && (s === 0 ? this.deltas.delete(e) : this.deltas.set(e, s), t)) {
|
|
1710
|
-
const
|
|
1711
|
-
this._updateTree(e,
|
|
1729
|
+
const l = s - n;
|
|
1730
|
+
this._updateTree(e, l);
|
|
1712
1731
|
}
|
|
1713
1732
|
}
|
|
1714
1733
|
}
|
|
@@ -1726,10 +1745,10 @@ class It {
|
|
|
1726
1745
|
return;
|
|
1727
1746
|
const i = e.ranges;
|
|
1728
1747
|
if (i && i.length > 0) {
|
|
1729
|
-
for (const
|
|
1730
|
-
const
|
|
1731
|
-
for (let
|
|
1732
|
-
this._materialize(
|
|
1748
|
+
for (const d of i) {
|
|
1749
|
+
const m = Math.max(0, Math.trunc(d.from)), b = Math.min(Math.trunc(d.to), this.size - 1);
|
|
1750
|
+
for (let v = m; v <= b; v++)
|
|
1751
|
+
this._materialize(v);
|
|
1733
1752
|
}
|
|
1734
1753
|
if (t === void 0)
|
|
1735
1754
|
return;
|
|
@@ -1737,8 +1756,8 @@ class It {
|
|
|
1737
1756
|
this._materialize(t);
|
|
1738
1757
|
return;
|
|
1739
1758
|
}
|
|
1740
|
-
const s = i[0].from,
|
|
1741
|
-
t >= s && t <=
|
|
1759
|
+
const s = i[0].from, l = i[i.length - 1].to;
|
|
1760
|
+
t >= s && t <= l && this._materialize(t);
|
|
1742
1761
|
return;
|
|
1743
1762
|
}
|
|
1744
1763
|
t !== void 0 && this._materialize(t);
|
|
@@ -1766,17 +1785,17 @@ class It {
|
|
|
1766
1785
|
return { index: -1, total: this.total ?? this.getTotal(), cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1767
1786
|
if (!i)
|
|
1768
1787
|
break;
|
|
1769
|
-
const
|
|
1770
|
-
if (this._materialize(s), (this.deltas.get(s) ?? 0) ===
|
|
1788
|
+
const d = this.deltas.get(s) ?? 0;
|
|
1789
|
+
if (this._materialize(s), (this.deltas.get(s) ?? 0) === d)
|
|
1771
1790
|
break;
|
|
1772
1791
|
}
|
|
1773
|
-
const
|
|
1792
|
+
const l = this.prefixSum(s);
|
|
1774
1793
|
return {
|
|
1775
1794
|
index: s,
|
|
1776
|
-
total: this.total ??
|
|
1777
|
-
cumulative:
|
|
1778
|
-
currentValue:
|
|
1779
|
-
safeIndex:
|
|
1795
|
+
total: this.total ?? l.total,
|
|
1796
|
+
cumulative: l.cumulative,
|
|
1797
|
+
currentValue: l.currentValue,
|
|
1798
|
+
safeIndex: l.safeIndex
|
|
1780
1799
|
};
|
|
1781
1800
|
}
|
|
1782
1801
|
/**
|
|
@@ -1793,10 +1812,10 @@ class It {
|
|
|
1793
1812
|
for (; s << 1 <= this.size; )
|
|
1794
1813
|
s <<= 1;
|
|
1795
1814
|
for (; s > 0; s >>= 1) {
|
|
1796
|
-
const
|
|
1797
|
-
if (
|
|
1798
|
-
const
|
|
1799
|
-
(t ? i +
|
|
1815
|
+
const l = n + s;
|
|
1816
|
+
if (l <= this.size) {
|
|
1817
|
+
const m = (this.tree.get(l) ?? 0) + this.baseValue * s;
|
|
1818
|
+
(t ? i + m < e : i + m <= e) && (n = l, i += m);
|
|
1800
1819
|
}
|
|
1801
1820
|
}
|
|
1802
1821
|
return t ? n : n - 1;
|
|
@@ -1809,42 +1828,42 @@ class It {
|
|
|
1809
1828
|
_findIndexLarge(e, t, n) {
|
|
1810
1829
|
if (this.size === 0)
|
|
1811
1830
|
return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1812
|
-
const i =
|
|
1831
|
+
const i = tn(this.size);
|
|
1813
1832
|
if (i === 0n)
|
|
1814
1833
|
return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1815
1834
|
this._materializeRanges(t.materializeOption);
|
|
1816
1835
|
const s = t.materializeOption?.materialize === !0;
|
|
1817
1836
|
for (; ; ) {
|
|
1818
|
-
let
|
|
1819
|
-
for (;
|
|
1820
|
-
const h =
|
|
1821
|
-
if (
|
|
1822
|
-
if (
|
|
1837
|
+
let l = 0n, d = i - 1n, m, b, v = this.total;
|
|
1838
|
+
for (; l <= d; ) {
|
|
1839
|
+
const h = l + d >> 1n, O = Number(h), W = this.prefixSum(O);
|
|
1840
|
+
if (v = W.total, n ? W.cumulative >= e : W.cumulative <= e)
|
|
1841
|
+
if (m = h, b = W, n) {
|
|
1823
1842
|
if (h === 0n)
|
|
1824
1843
|
break;
|
|
1825
|
-
|
|
1844
|
+
d = h - 1n;
|
|
1826
1845
|
} else
|
|
1827
|
-
|
|
1846
|
+
l = h + 1n;
|
|
1828
1847
|
else if (n)
|
|
1829
|
-
|
|
1848
|
+
l = h + 1n;
|
|
1830
1849
|
else {
|
|
1831
1850
|
if (h === 0n)
|
|
1832
1851
|
break;
|
|
1833
|
-
|
|
1852
|
+
d = h - 1n;
|
|
1834
1853
|
}
|
|
1835
1854
|
}
|
|
1836
|
-
const
|
|
1837
|
-
if (s &&
|
|
1838
|
-
const h = this.deltas.get(
|
|
1839
|
-
if (this._materialize(
|
|
1855
|
+
const T = b, C = m !== void 0 ? Number(m) : -1;
|
|
1856
|
+
if (s && C >= 0) {
|
|
1857
|
+
const h = this.deltas.get(C) ?? 0;
|
|
1858
|
+
if (this._materialize(C), (this.deltas.get(C) ?? 0) !== h)
|
|
1840
1859
|
continue;
|
|
1841
1860
|
}
|
|
1842
1861
|
return {
|
|
1843
|
-
index:
|
|
1844
|
-
total:
|
|
1845
|
-
cumulative:
|
|
1846
|
-
currentValue:
|
|
1847
|
-
safeIndex:
|
|
1862
|
+
index: C,
|
|
1863
|
+
total: v,
|
|
1864
|
+
cumulative: T?.cumulative,
|
|
1865
|
+
currentValue: T?.currentValue,
|
|
1866
|
+
safeIndex: T?.safeIndex
|
|
1848
1867
|
};
|
|
1849
1868
|
}
|
|
1850
1869
|
}
|
|
@@ -1861,19 +1880,19 @@ class It {
|
|
|
1861
1880
|
return { cumulative: 0, total: this.total, currentValue: 0, safeIndex: 0 };
|
|
1862
1881
|
if (this.size === 0)
|
|
1863
1882
|
return { cumulative: 0, total: this.total ?? 0, currentValue: 0, safeIndex: 0 };
|
|
1864
|
-
const n =
|
|
1883
|
+
const n = se(Math.trunc(e), 0, this.size - 1), i = t?.materializeOption;
|
|
1865
1884
|
this._materializeRanges(i, n, !0);
|
|
1866
|
-
let s = 0,
|
|
1867
|
-
for (;
|
|
1868
|
-
const
|
|
1869
|
-
s +=
|
|
1870
|
-
const b =
|
|
1885
|
+
let s = 0, l = n + 1;
|
|
1886
|
+
for (; l > 0; ) {
|
|
1887
|
+
const m = this.tree.get(l) ?? 0;
|
|
1888
|
+
s += m;
|
|
1889
|
+
const b = Nt(l);
|
|
1871
1890
|
if (b === 0)
|
|
1872
1891
|
break;
|
|
1873
|
-
|
|
1892
|
+
l -= b;
|
|
1874
1893
|
}
|
|
1875
|
-
const
|
|
1876
|
-
return { cumulative: s + this.baseValue * (n + 1), total: this.total, currentValue:
|
|
1894
|
+
const d = i?.materialize ? this.get(n) : (this.deltas.get(n) || 0) + this.baseValue;
|
|
1895
|
+
return { cumulative: s + this.baseValue * (n + 1), total: this.total, currentValue: d, safeIndex: n };
|
|
1877
1896
|
}
|
|
1878
1897
|
/**
|
|
1879
1898
|
* @method get
|
|
@@ -1906,7 +1925,7 @@ class It {
|
|
|
1906
1925
|
else {
|
|
1907
1926
|
this.total = this._computeTreeTotal();
|
|
1908
1927
|
const n = this.prefixSum(this.getSize() - 1);
|
|
1909
|
-
n.cumulative !== n.total &&
|
|
1928
|
+
n.cumulative !== n.total && P.error("Inconsistent Fenwick Tree state");
|
|
1910
1929
|
}
|
|
1911
1930
|
return this.total;
|
|
1912
1931
|
}
|
|
@@ -1930,10 +1949,10 @@ class It {
|
|
|
1930
1949
|
let s = n + 1;
|
|
1931
1950
|
for (; s <= this.size; ) {
|
|
1932
1951
|
t.set(s, (t.get(s) ?? 0) + i);
|
|
1933
|
-
const
|
|
1934
|
-
if (
|
|
1952
|
+
const l = Nt(s);
|
|
1953
|
+
if (l === 0)
|
|
1935
1954
|
break;
|
|
1936
|
-
s +=
|
|
1955
|
+
s += l;
|
|
1937
1956
|
}
|
|
1938
1957
|
}
|
|
1939
1958
|
this.tree = t, this.total = this._computeTreeTotal();
|
|
@@ -2013,7 +2032,7 @@ class It {
|
|
|
2013
2032
|
this.size = t, this.rebuildTree();
|
|
2014
2033
|
}
|
|
2015
2034
|
const i = this.prefixSum(this.getSize() - 1);
|
|
2016
|
-
i.cumulative !== i.total &&
|
|
2035
|
+
i.cumulative !== i.total && P.error("Inconsistent Fenwick Tree state");
|
|
2017
2036
|
}
|
|
2018
2037
|
/**
|
|
2019
2038
|
* @private
|
|
@@ -2047,17 +2066,17 @@ class It {
|
|
|
2047
2066
|
_propagateDeltaToGrownNodes(e, t, n, i) {
|
|
2048
2067
|
let s = e + 1;
|
|
2049
2068
|
for (; s <= n; ) {
|
|
2050
|
-
const
|
|
2051
|
-
if (
|
|
2069
|
+
const l = Nt(s);
|
|
2070
|
+
if (l === 0)
|
|
2052
2071
|
break;
|
|
2053
|
-
s +=
|
|
2072
|
+
s += l;
|
|
2054
2073
|
}
|
|
2055
2074
|
for (; s <= i; ) {
|
|
2056
2075
|
this.tree.set(s, (this.tree.get(s) ?? 0) + t);
|
|
2057
|
-
const
|
|
2058
|
-
if (
|
|
2076
|
+
const l = Nt(s);
|
|
2077
|
+
if (l === 0)
|
|
2059
2078
|
break;
|
|
2060
|
-
s +=
|
|
2079
|
+
s += l;
|
|
2061
2080
|
}
|
|
2062
2081
|
}
|
|
2063
2082
|
/**
|
|
@@ -2070,15 +2089,15 @@ class It {
|
|
|
2070
2089
|
*/
|
|
2071
2090
|
_growSize(e, t) {
|
|
2072
2091
|
if (this.size = t, this.deltas.size > 0) {
|
|
2073
|
-
const n =
|
|
2092
|
+
const n = St._minCoveredLowBound(e, t);
|
|
2074
2093
|
if (e - n < this.deltas.size)
|
|
2075
2094
|
for (let s = n; s < e; s++) {
|
|
2076
|
-
const
|
|
2077
|
-
|
|
2095
|
+
const l = this.deltas.get(s);
|
|
2096
|
+
l === void 0 || l === 0 || this._propagateDeltaToGrownNodes(s, l, e, t);
|
|
2078
2097
|
}
|
|
2079
2098
|
else
|
|
2080
|
-
for (const [s,
|
|
2081
|
-
|
|
2099
|
+
for (const [s, l] of this.deltas.entries())
|
|
2100
|
+
l === 0 || s < n || this._propagateDeltaToGrownNodes(s, l, e, t);
|
|
2082
2101
|
}
|
|
2083
2102
|
this.total = this._computeTreeTotal();
|
|
2084
2103
|
}
|
|
@@ -2148,20 +2167,20 @@ class It {
|
|
|
2148
2167
|
return this._findIndex(e, t ?? {}, !1);
|
|
2149
2168
|
}
|
|
2150
2169
|
}
|
|
2151
|
-
const
|
|
2170
|
+
const rn = (r, e) => {
|
|
2152
2171
|
const t = r?.sampleRange, n = e?.sampleRange;
|
|
2153
2172
|
return t === n ? !1 : t && n ? t.from !== n.from || t.to !== n.to : !0;
|
|
2154
|
-
},
|
|
2173
|
+
}, nn = (r, e, t) => {
|
|
2155
2174
|
const n = Number.isFinite(r) && r > 0 ? Math.trunc(r) : 0, i = g(null), s = g({ size: n, valueOrFn: e, options: t });
|
|
2156
|
-
i.current === null && (i.current = new
|
|
2157
|
-
const
|
|
2158
|
-
if (b ||
|
|
2159
|
-
const
|
|
2160
|
-
|
|
2161
|
-
} else
|
|
2162
|
-
return
|
|
2175
|
+
i.current === null && (i.current = new St(n, e, t));
|
|
2176
|
+
const l = i.current, d = s.current, m = d.size !== n, b = d.valueOrFn !== e, v = rn(d.options, t), T = d.size === 0 && n > 0 && (!i.current || i.current.base === 0);
|
|
2177
|
+
if (b || v) {
|
|
2178
|
+
const C = t?.resetOnValueFnChange ?? !0;
|
|
2179
|
+
v || b && C || T ? (t?.debug && P.debug("[useFenwickMapTree] reset", { valueOrFnChanged: b, optionsChanged: v }), l.reset(n, e, t)) : (m && (t?.debug && P.debug("[useFenwickMapTree] resize (with valueFn change)", { from: d.size, to: n }), l.changeSize(n)), t?.debug && P.debug("[useFenwickMapTree] setValueFn (no reset)", { valueOrFnChanged: b }), l.setValueFn(e, { reset: !1 })), s.current = { size: n, valueOrFn: e, options: t };
|
|
2180
|
+
} else m && (t?.debug && P.debug("[useFenwickMapTree] resize", { from: d.size, to: n }), T ? l.reset(n, e, t) : l.changeSize(n), s.current = { size: n, valueOrFn: e, options: t });
|
|
2181
|
+
return l;
|
|
2163
2182
|
};
|
|
2164
|
-
class
|
|
2183
|
+
class sn {
|
|
2165
2184
|
key;
|
|
2166
2185
|
value;
|
|
2167
2186
|
prev = null;
|
|
@@ -2170,7 +2189,7 @@ class Kr {
|
|
|
2170
2189
|
this.key = e, this.value = t;
|
|
2171
2190
|
}
|
|
2172
2191
|
}
|
|
2173
|
-
class
|
|
2192
|
+
class er {
|
|
2174
2193
|
head = null;
|
|
2175
2194
|
tail = null;
|
|
2176
2195
|
/**
|
|
@@ -2211,188 +2230,180 @@ class jt {
|
|
|
2211
2230
|
this.remove(e), this.addToTail(e);
|
|
2212
2231
|
}
|
|
2213
2232
|
}
|
|
2214
|
-
function
|
|
2215
|
-
const e = g(/* @__PURE__ */ new Map()), t = g(new
|
|
2216
|
-
|
|
2233
|
+
function on(r) {
|
|
2234
|
+
const e = g(/* @__PURE__ */ new Map()), t = g(new er()), n = Math.floor(r), i = g(n);
|
|
2235
|
+
X(() => {
|
|
2217
2236
|
if (i.current = n, Number.isNaN(n) || n < 0) {
|
|
2218
|
-
|
|
2237
|
+
P.warn(`useLruCache: invalid capacity ${r}; the cache will not store any entries.`), e.current.clear(), t.current = new er();
|
|
2219
2238
|
return;
|
|
2220
2239
|
}
|
|
2221
2240
|
if (Number.isFinite(n))
|
|
2222
2241
|
for (; e.current.size > n; ) {
|
|
2223
|
-
const
|
|
2224
|
-
if (
|
|
2225
|
-
e.current.delete(
|
|
2242
|
+
const v = t.current.removeHead();
|
|
2243
|
+
if (v)
|
|
2244
|
+
e.current.delete(v.key);
|
|
2226
2245
|
else
|
|
2227
2246
|
break;
|
|
2228
2247
|
}
|
|
2229
2248
|
}, [r, n]);
|
|
2230
|
-
const s =
|
|
2231
|
-
const
|
|
2232
|
-
if (
|
|
2233
|
-
return t.current.moveToTail(
|
|
2234
|
-
}, []),
|
|
2235
|
-
const
|
|
2236
|
-
if (Number.isNaN(
|
|
2249
|
+
const s = S((v) => {
|
|
2250
|
+
const T = e.current.get(v);
|
|
2251
|
+
if (T)
|
|
2252
|
+
return t.current.moveToTail(T), T.value;
|
|
2253
|
+
}, []), l = S((v, T) => {
|
|
2254
|
+
const C = i.current;
|
|
2255
|
+
if (Number.isNaN(C) || C <= 0)
|
|
2237
2256
|
return;
|
|
2238
|
-
let h = e.current.get(
|
|
2257
|
+
let h = e.current.get(v);
|
|
2239
2258
|
if (h)
|
|
2240
|
-
h.value =
|
|
2259
|
+
h.value = T, t.current.moveToTail(h);
|
|
2241
2260
|
else {
|
|
2242
|
-
if (e.current.size >=
|
|
2243
|
-
const
|
|
2244
|
-
|
|
2261
|
+
if (e.current.size >= C) {
|
|
2262
|
+
const O = t.current.removeHead();
|
|
2263
|
+
O && e.current.delete(O.key);
|
|
2245
2264
|
}
|
|
2246
|
-
h = new
|
|
2265
|
+
h = new sn(v, T), e.current.set(v, h), t.current.addToTail(h);
|
|
2247
2266
|
}
|
|
2248
|
-
}, []),
|
|
2249
|
-
const
|
|
2250
|
-
|
|
2251
|
-
}, []), b =
|
|
2252
|
-
e.current.clear(), t.current = new
|
|
2267
|
+
}, []), d = S((v) => e.current.has(v), []), m = S((v) => {
|
|
2268
|
+
const T = e.current.get(v);
|
|
2269
|
+
T && (t.current.remove(T), e.current.delete(v));
|
|
2270
|
+
}, []), b = S(() => {
|
|
2271
|
+
e.current.clear(), t.current = new er();
|
|
2253
2272
|
}, []);
|
|
2254
|
-
return
|
|
2273
|
+
return _e(() => ({ get: s, set: l, has: d, remove: m, clear: b }), [s, l, d, m, b]);
|
|
2255
2274
|
}
|
|
2256
|
-
const
|
|
2257
|
-
const { get: r, set: e, has: t, clear: n } =
|
|
2258
|
-
return
|
|
2259
|
-
},
|
|
2275
|
+
const an = 1e4, vn = () => {
|
|
2276
|
+
const { get: r, set: e, has: t, clear: n } = on(an);
|
|
2277
|
+
return _e(() => ({ get: r, set: e, has: t, clear: n }), [r, e, t, n]);
|
|
2278
|
+
}, In = (r, e) => {
|
|
2260
2279
|
const t = g(e), n = g(r);
|
|
2261
|
-
|
|
2280
|
+
et(() => {
|
|
2262
2281
|
t.current = e, n.current = r;
|
|
2263
2282
|
}, [e, r]);
|
|
2264
2283
|
const i = g(/* @__PURE__ */ new WeakMap());
|
|
2265
|
-
return
|
|
2284
|
+
return S((s) => {
|
|
2266
2285
|
if (!s || i.current.has(s))
|
|
2267
2286
|
return;
|
|
2268
|
-
const
|
|
2269
|
-
t.current?.enableBridge !== !1 && n.current.current?.applyWheel(
|
|
2287
|
+
const l = (d) => {
|
|
2288
|
+
t.current?.enableBridge !== !1 && n.current.current?.applyWheel(d);
|
|
2270
2289
|
};
|
|
2271
|
-
return s.addEventListener("wheel",
|
|
2272
|
-
i.current.get(s) ===
|
|
2290
|
+
return s.addEventListener("wheel", l, { passive: !1 }), i.current.set(s, l), () => {
|
|
2291
|
+
i.current.get(s) === l && (s.removeEventListener("wheel", l), i.current.delete(s));
|
|
2273
2292
|
};
|
|
2274
2293
|
}, []);
|
|
2275
|
-
},
|
|
2294
|
+
}, Ie = (r, e) => e <= 0 ? 0 : se(r, 0, e - 1), xr = (r) => ({
|
|
2276
2295
|
top: Math.max(0, r?.top ?? 0),
|
|
2277
2296
|
bottom: Math.max(0, r?.bottom ?? 0)
|
|
2278
|
-
}),
|
|
2279
|
-
const e = r.ownerDocument.defaultView?.getSelection();
|
|
2280
|
-
if (!e || e.isCollapsed || e.rangeCount === 0)
|
|
2281
|
-
return !1;
|
|
2282
|
-
for (let t = 0; t < e.rangeCount; t += 1)
|
|
2283
|
-
if (e.getRangeAt(t).intersectsNode(r))
|
|
2284
|
-
return !0;
|
|
2285
|
-
return !1;
|
|
2286
|
-
}, Dt = (r) => {
|
|
2297
|
+
}), Qe = (r, e) => r <= e ? 0 : r - e, Mt = (r, e) => r <= 0 ? 0 : r + e, $t = 1e3, vr = 2e3, ln = 1048576, cn = 40, kt = (r) => {
|
|
2287
2298
|
if (!Number.isFinite(r)) return 0n;
|
|
2288
2299
|
const e = Math.trunc(r);
|
|
2289
2300
|
return e <= 0 ? 0n : BigInt(e);
|
|
2290
|
-
},
|
|
2291
|
-
const
|
|
2292
|
-
if (
|
|
2301
|
+
}, un = (r, e, t, n, i, s, l, d) => {
|
|
2302
|
+
const m = kt(n);
|
|
2303
|
+
if (m === 0n)
|
|
2293
2304
|
return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
|
|
2294
|
-
const b = (
|
|
2305
|
+
const b = (y) => y < 0n ? 0n : y >= m ? m - 1n : y, v = { materializeOption: { materialize: !1 } }, { index: T, cumulative: C } = s.findIndexAtOrAfter(r, v);
|
|
2295
2306
|
let h;
|
|
2296
|
-
|
|
2297
|
-
const
|
|
2298
|
-
const
|
|
2299
|
-
if (!Number.isSafeInteger(
|
|
2307
|
+
T === -1 ? h = m - 1n : (C === r ? h = kt(T + 1) : h = kt(T), h >= m && (h = m - 1n)), r <= 0 && (h = 0n), d && r >= l && (h = m - 1n);
|
|
2308
|
+
const O = (y) => {
|
|
2309
|
+
const Y = Number(y);
|
|
2310
|
+
if (!Number.isSafeInteger(Y))
|
|
2300
2311
|
return null;
|
|
2301
|
-
const { cumulative:
|
|
2302
|
-
if (!Number.isFinite(
|
|
2312
|
+
const { cumulative: w } = s.prefixSum(Y, { materializeOption: { materialize: !1 } });
|
|
2313
|
+
if (!Number.isFinite(w))
|
|
2303
2314
|
return null;
|
|
2304
|
-
const { index: Z } = s.findIndexAtOrAfter(
|
|
2315
|
+
const { index: Z } = s.findIndexAtOrAfter(w + 0.5, { materializeOption: { materialize: !1 } });
|
|
2305
2316
|
if (Z === -1)
|
|
2306
2317
|
return null;
|
|
2307
|
-
const Q =
|
|
2308
|
-
return Q >
|
|
2309
|
-
},
|
|
2310
|
-
let
|
|
2311
|
-
for (;
|
|
2312
|
-
const
|
|
2313
|
-
if (
|
|
2318
|
+
const Q = kt(Z);
|
|
2319
|
+
return Q > y ? Q : null;
|
|
2320
|
+
}, W = (y) => {
|
|
2321
|
+
let Y = 0, w = y, Z = y, Q = 0n, K = 0;
|
|
2322
|
+
for (; w < m && Y < e; ) {
|
|
2323
|
+
const he = Number(w), A = i(he);
|
|
2324
|
+
if (Y += A, Z = w, w += 1n, Q += 1n, !Number.isFinite(A) || A < 0)
|
|
2314
2325
|
break;
|
|
2315
|
-
if (
|
|
2316
|
-
if (
|
|
2317
|
-
const
|
|
2318
|
-
if (
|
|
2319
|
-
|
|
2320
|
-
else if (
|
|
2321
|
-
|
|
2326
|
+
if (A === 0) {
|
|
2327
|
+
if (K += 1, K > $t) {
|
|
2328
|
+
const I = O(Z);
|
|
2329
|
+
if (I !== null && I > w)
|
|
2330
|
+
w = I, K = 0;
|
|
2331
|
+
else if (I !== null && I === w && i(Number(w)) > 0)
|
|
2332
|
+
K = 0;
|
|
2322
2333
|
else
|
|
2323
2334
|
break;
|
|
2324
2335
|
}
|
|
2325
2336
|
} else
|
|
2326
|
-
|
|
2337
|
+
K = 0;
|
|
2327
2338
|
}
|
|
2328
|
-
return Q === 0n && (Z =
|
|
2339
|
+
return Q === 0n && (Z = y), { height: Y, end: Z };
|
|
2329
2340
|
};
|
|
2330
|
-
let { height:
|
|
2331
|
-
if (
|
|
2332
|
-
let
|
|
2333
|
-
for (;
|
|
2334
|
-
|
|
2335
|
-
const Q = Number(
|
|
2336
|
-
if (
|
|
2341
|
+
let { height: D, end: ce } = W(h);
|
|
2342
|
+
if (D < e && h > 0n) {
|
|
2343
|
+
let y = h, Y = D, w = 0;
|
|
2344
|
+
for (; y > 0n && Y < e; ) {
|
|
2345
|
+
y -= 1n;
|
|
2346
|
+
const Q = Number(y), K = i(Q);
|
|
2347
|
+
if (Y += K, !Number.isFinite(K) || K < 0)
|
|
2337
2348
|
break;
|
|
2338
|
-
if (
|
|
2339
|
-
if (
|
|
2340
|
-
const
|
|
2341
|
-
if (!Number.isSafeInteger(
|
|
2349
|
+
if (K === 0) {
|
|
2350
|
+
if (w += 1, w > $t) {
|
|
2351
|
+
const he = Number(y);
|
|
2352
|
+
if (!Number.isSafeInteger(he))
|
|
2342
2353
|
break;
|
|
2343
|
-
const { cumulative:
|
|
2344
|
-
if (!Number.isFinite(
|
|
2354
|
+
const { cumulative: A } = s.prefixSum(he, { materializeOption: { materialize: !1 } });
|
|
2355
|
+
if (!Number.isFinite(A))
|
|
2345
2356
|
break;
|
|
2346
|
-
const { index:
|
|
2347
|
-
if (
|
|
2348
|
-
|
|
2349
|
-
else if (
|
|
2350
|
-
|
|
2357
|
+
const { index: I } = s.findIndexAtOrAfter(A - 0.5, { materializeOption: { materialize: !1 } }), G = I === -1 ? -1n : kt(I);
|
|
2358
|
+
if (G >= 0n && G < y)
|
|
2359
|
+
y = G + 1n, w = 0;
|
|
2360
|
+
else if (G === y && y >= 1n && i(Number(y - 1n)) > 0)
|
|
2361
|
+
w = 0;
|
|
2351
2362
|
else
|
|
2352
2363
|
break;
|
|
2353
2364
|
}
|
|
2354
2365
|
} else
|
|
2355
|
-
|
|
2366
|
+
w = 0;
|
|
2356
2367
|
}
|
|
2357
|
-
h = b(
|
|
2358
|
-
const Z =
|
|
2359
|
-
|
|
2368
|
+
h = b(y);
|
|
2369
|
+
const Z = W(h);
|
|
2370
|
+
D = Z.height, ce = Z.end;
|
|
2360
2371
|
}
|
|
2361
|
-
const
|
|
2372
|
+
const ue = b(h), re = b(ce), oe = b(ue - BigInt(Math.max(0, t))), de = b(re + BigInt(Math.max(0, t)));
|
|
2362
2373
|
return {
|
|
2363
|
-
renderingStartIndex:
|
|
2364
|
-
renderingEndIndex:
|
|
2365
|
-
visibleStartIndex:
|
|
2366
|
-
visibleEndIndex:
|
|
2374
|
+
renderingStartIndex: Ie(Number(oe), n),
|
|
2375
|
+
renderingEndIndex: Ie(Number(de), n),
|
|
2376
|
+
visibleStartIndex: Ie(Number(ue), n),
|
|
2377
|
+
visibleEndIndex: Ie(Number(re), n)
|
|
2367
2378
|
};
|
|
2368
|
-
},
|
|
2379
|
+
}, dn = (r, e, t, n, i, s, l) => {
|
|
2369
2380
|
if (n === 0)
|
|
2370
2381
|
return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
|
|
2371
|
-
const
|
|
2382
|
+
const d = Number.isFinite(l), m = d ? Math.min(Math.max(0, r), l) : Math.max(0, r);
|
|
2372
2383
|
if (n >= Number.MAX_SAFE_INTEGER)
|
|
2373
|
-
return
|
|
2374
|
-
const { index: b, cumulative:
|
|
2375
|
-
let h =
|
|
2376
|
-
if (b !== -1 &&
|
|
2377
|
-
h =
|
|
2378
|
-
else if (h === b &&
|
|
2379
|
-
|
|
2384
|
+
return un(m, e, t, n, i, s, l, d);
|
|
2385
|
+
const { index: b, cumulative: v, currentValue: T } = s.findIndexAtOrAfter(m, { materializeOption: { materialize: !1 } }), C = b === -1 ? e <= 0 || (v ?? 0) < m + (T ?? 0) ? n - 1 : 0 : b;
|
|
2386
|
+
let h = Ie(C, n), O = 0;
|
|
2387
|
+
if (b !== -1 && v === m)
|
|
2388
|
+
h = Ie(b + 1, n), O = 0;
|
|
2389
|
+
else if (h === b && v !== void 0 && T !== void 0)
|
|
2390
|
+
O = v - T - m;
|
|
2380
2391
|
else {
|
|
2381
|
-
const { cumulative:
|
|
2382
|
-
|
|
2392
|
+
const { cumulative: y, currentValue: Y } = s.prefixSum(h, { materializeOption: { materialize: !1 } });
|
|
2393
|
+
O = (y ?? 0) - (Y ?? 0) - m;
|
|
2383
2394
|
}
|
|
2384
|
-
const
|
|
2385
|
-
let
|
|
2386
|
-
for (;
|
|
2387
|
-
const
|
|
2388
|
-
if (Z +=
|
|
2395
|
+
const W = O, D = (y, Y) => {
|
|
2396
|
+
let w = y, Z = Y, Q = 0;
|
|
2397
|
+
for (; w < n && Z < e; ) {
|
|
2398
|
+
const K = i(w);
|
|
2399
|
+
if (Z += K, w++, !Number.isFinite(K) || K < 0)
|
|
2389
2400
|
break;
|
|
2390
|
-
if (
|
|
2391
|
-
if (Q++, Q >
|
|
2392
|
-
const { cumulative:
|
|
2393
|
-
if (
|
|
2394
|
-
|
|
2395
|
-
else if (
|
|
2401
|
+
if (K === 0) {
|
|
2402
|
+
if (Q++, Q > $t) {
|
|
2403
|
+
const { cumulative: he } = s.prefixSum(w - 1, { materializeOption: { materialize: !1 } }), { index: A } = Number.isFinite(he) ? s.findIndexAtOrAfter(he + 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
|
|
2404
|
+
if (A > w)
|
|
2405
|
+
w = A, Q = 0;
|
|
2406
|
+
else if (A === w && i(w) > 0)
|
|
2396
2407
|
Q = 0;
|
|
2397
2408
|
else
|
|
2398
2409
|
break;
|
|
@@ -2400,44 +2411,44 @@ const Gr = 1e4, cn = () => {
|
|
|
2400
2411
|
} else
|
|
2401
2412
|
Q = 0;
|
|
2402
2413
|
}
|
|
2403
|
-
return { cursor:
|
|
2404
|
-
},
|
|
2405
|
-
let
|
|
2406
|
-
if (
|
|
2407
|
-
let
|
|
2408
|
-
for (;
|
|
2409
|
-
const Q = i(
|
|
2410
|
-
if (
|
|
2411
|
-
|
|
2414
|
+
return { cursor: w, height: Z };
|
|
2415
|
+
}, ce = D(h, O);
|
|
2416
|
+
let ue = ce.cursor;
|
|
2417
|
+
if (O = ce.height, O < e && h > 0) {
|
|
2418
|
+
let y = O + Math.abs(Math.min(0, W)), Y = h - 1, w = 0;
|
|
2419
|
+
for (; Y >= 0 && y < e; ) {
|
|
2420
|
+
const Q = i(Y);
|
|
2421
|
+
if (y += Q, !Number.isFinite(Q) || Q < 0) {
|
|
2422
|
+
Y--;
|
|
2412
2423
|
break;
|
|
2413
2424
|
}
|
|
2414
2425
|
if (Q === 0) {
|
|
2415
|
-
if (
|
|
2416
|
-
const { cumulative:
|
|
2417
|
-
if (
|
|
2418
|
-
|
|
2426
|
+
if (w++, w > $t) {
|
|
2427
|
+
const { cumulative: K } = s.prefixSum(Y, { materializeOption: { materialize: !1 } }), { index: he } = Number.isFinite(K) ? s.findIndexAtOrAfter(K - 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
|
|
2428
|
+
if (he !== -1 && he < Y) {
|
|
2429
|
+
Y = he, w = 0;
|
|
2419
2430
|
continue;
|
|
2420
2431
|
}
|
|
2421
|
-
if (
|
|
2422
|
-
|
|
2432
|
+
if (he === Y && Y >= 1 && i(Y - 1) > 0)
|
|
2433
|
+
w = 0;
|
|
2423
2434
|
else {
|
|
2424
|
-
|
|
2435
|
+
Y--;
|
|
2425
2436
|
break;
|
|
2426
2437
|
}
|
|
2427
2438
|
}
|
|
2428
2439
|
} else
|
|
2429
|
-
|
|
2430
|
-
|
|
2440
|
+
w = 0;
|
|
2441
|
+
Y--;
|
|
2431
2442
|
}
|
|
2432
|
-
h =
|
|
2433
|
-
const Z =
|
|
2434
|
-
|
|
2443
|
+
h = Ie(Y + 1, n);
|
|
2444
|
+
const Z = D(h, 0);
|
|
2445
|
+
ue = Z.cursor, O = Z.height;
|
|
2435
2446
|
}
|
|
2436
|
-
const
|
|
2437
|
-
return { renderingStartIndex:
|
|
2438
|
-
},
|
|
2447
|
+
const re = Ie(h - t, n), oe = Ie(Math.max(ue - 1, h), n), de = Ie(oe + t, n);
|
|
2448
|
+
return { renderingStartIndex: re, renderingEndIndex: de, visibleStartIndex: h, visibleEndIndex: oe };
|
|
2449
|
+
}, Ir = (r, e, t) => {
|
|
2439
2450
|
const n = Math.max(0, e ?? 0), i = g({ last: 0, id: null, arg: null }).current;
|
|
2440
|
-
return
|
|
2451
|
+
return X(
|
|
2441
2452
|
() => () => {
|
|
2442
2453
|
if (i.id !== null && (cancelAnimationFrame(i.id), i.id = null), i.arg !== null && r.current) {
|
|
2443
2454
|
try {
|
|
@@ -2449,679 +2460,727 @@ const Gr = 1e4, cn = () => {
|
|
|
2449
2460
|
}
|
|
2450
2461
|
},
|
|
2451
2462
|
[i, r, t]
|
|
2452
|
-
),
|
|
2463
|
+
), S(
|
|
2453
2464
|
(s) => {
|
|
2454
2465
|
if (i.arg = s, i.id !== null) return;
|
|
2455
|
-
const
|
|
2466
|
+
const l = (d) => {
|
|
2456
2467
|
if (i.id = null, i.arg === null) return;
|
|
2457
|
-
const
|
|
2458
|
-
if (n === 0 || i.last === 0 ||
|
|
2468
|
+
const m = d - i.last;
|
|
2469
|
+
if (n === 0 || i.last === 0 || m >= n) {
|
|
2459
2470
|
if (r.current)
|
|
2460
2471
|
try {
|
|
2461
2472
|
t(r.current, i.arg);
|
|
2462
2473
|
} catch (b) {
|
|
2463
2474
|
console.error("[useThrottledInvoker] Error invoking callback", b);
|
|
2464
2475
|
}
|
|
2465
|
-
i.arg = null, i.last =
|
|
2476
|
+
i.arg = null, i.last = d;
|
|
2466
2477
|
}
|
|
2467
|
-
i.arg !== null && (i.id = requestAnimationFrame(
|
|
2478
|
+
i.arg !== null && (i.id = requestAnimationFrame(l));
|
|
2468
2479
|
};
|
|
2469
|
-
i.id = requestAnimationFrame(
|
|
2480
|
+
i.id = requestAnimationFrame(l);
|
|
2470
2481
|
},
|
|
2471
2482
|
[n, t, r, i]
|
|
2472
2483
|
);
|
|
2473
|
-
},
|
|
2474
|
-
const
|
|
2475
|
-
|
|
2484
|
+
}, fn = Er.memo(({ index: r, top: e, height: t, item: n, children: i, clipItemHeight: s, enableKeyboardNavigation: l, onKeyDown: d, onEscapeKeyDown: m, onFocus: b, registerItemRef: v }) => {
|
|
2485
|
+
const T = S((D) => v(r, D), [r, v]), C = S((D) => d(D, r), [r, d]), h = S((D) => m?.(D, r), [r, m]), O = S(() => b(r), [r, b]), W = S((D) => {
|
|
2486
|
+
D.currentTarget.focus({ preventScroll: !0 });
|
|
2476
2487
|
}, []);
|
|
2477
|
-
return
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2488
|
+
return (
|
|
2489
|
+
// 行ラッパーの role は消費側の複合ウィジェット契約 (listbox / tree / grid — README「Composite widget
|
|
2490
|
+
// roles」) の所有物で、パッケージが既定 role を課すと衝突する。キー/フォーカス結線は
|
|
2491
|
+
// enableKeyboardNavigation の行ナビゲーション機構そのもの。
|
|
2492
|
+
// biome-ignore lint/a11y/noStaticElementInteractions: role は消費側の複合ウィジェット契約の所有物 (上記)
|
|
2493
|
+
/* @__PURE__ */ ie(
|
|
2494
|
+
"div",
|
|
2495
|
+
{
|
|
2496
|
+
ref: T,
|
|
2497
|
+
"data-index": r,
|
|
2498
|
+
"data-virtualscroll-item": "true",
|
|
2499
|
+
className: "aqvs-item-container",
|
|
2500
|
+
style: {
|
|
2501
|
+
top: e,
|
|
2502
|
+
height: t,
|
|
2503
|
+
overflow: s ? "hidden" : void 0
|
|
2504
|
+
},
|
|
2505
|
+
tabIndex: l ? -1 : void 0,
|
|
2506
|
+
onPointerDown: l ? W : void 0,
|
|
2507
|
+
onKeyDownCapture: l ? C : void 0,
|
|
2508
|
+
onKeyDown: l && m ? h : void 0,
|
|
2509
|
+
onFocusCapture: l ? O : void 0,
|
|
2510
|
+
children: i(n, r)
|
|
2511
|
+
}
|
|
2512
|
+
)
|
|
2495
2513
|
);
|
|
2496
|
-
}),
|
|
2514
|
+
}), mn = ({
|
|
2497
2515
|
itemCount: r,
|
|
2498
2516
|
getItem: e,
|
|
2499
2517
|
getItemKey: t,
|
|
2500
2518
|
getItemHeight: n,
|
|
2501
2519
|
viewportSize: i,
|
|
2502
2520
|
overscanCount: s = 15,
|
|
2503
|
-
className:
|
|
2504
|
-
testId:
|
|
2505
|
-
onScroll:
|
|
2521
|
+
className: l,
|
|
2522
|
+
testId: d,
|
|
2523
|
+
onScroll: m,
|
|
2506
2524
|
onRangeChange: b,
|
|
2507
|
-
children:
|
|
2508
|
-
background:
|
|
2509
|
-
initialScrollIndex:
|
|
2525
|
+
children: v,
|
|
2526
|
+
background: T,
|
|
2527
|
+
initialScrollIndex: C,
|
|
2510
2528
|
initialScrollOffset: h,
|
|
2511
|
-
initialScrollAnchor:
|
|
2512
|
-
callbackThrottleMs:
|
|
2513
|
-
contentInsets:
|
|
2514
|
-
onItemFocus:
|
|
2515
|
-
scrollBarOptions:
|
|
2516
|
-
behaviorOptions:
|
|
2517
|
-
onWheelHorizontal:
|
|
2518
|
-
horizontalKeyInputs:
|
|
2519
|
-
horizontalKeyStep:
|
|
2520
|
-
contentProps:
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2529
|
+
initialScrollAnchor: O,
|
|
2530
|
+
callbackThrottleMs: W = 5,
|
|
2531
|
+
contentInsets: D,
|
|
2532
|
+
onItemFocus: ce,
|
|
2533
|
+
scrollBarOptions: ue,
|
|
2534
|
+
behaviorOptions: re,
|
|
2535
|
+
onWheelHorizontal: oe,
|
|
2536
|
+
horizontalKeyInputs: de,
|
|
2537
|
+
horizontalKeyStep: y = cn,
|
|
2538
|
+
contentProps: Y,
|
|
2539
|
+
liveRegion: w
|
|
2540
|
+
}, Z) => {
|
|
2541
|
+
const { width: Q, enableThumbDrag: K, enableTrackClick: he, enableArrowButtons: A, enableScrollToTopBottomButtons: I, renderThumbOverlay: G, tapScrollCircleOptions: fe } = ue ?? {}, { enablePointerDrag: $e, pointerDragInputs: Ue, enableKeyboardNavigation: z = !0, enableEscapeRowReturn: ke = !1, wheelSpeedMultiplier: We, inertiaOptions: Ve, overscrollBehavior: Fe, clipItemHeight: Ke = !1, resetOnGetItemHeightChange: De = !1 } = re ?? {}, [Pe, ze] = Je(0), be = i ?? Pe, Se = S((o) => {
|
|
2542
|
+
ze((c) => c === o ? c : o);
|
|
2543
|
+
}, []), j = g(null), tt = g({
|
|
2525
2544
|
renderingStartIndex: 0,
|
|
2526
2545
|
renderingEndIndex: 0,
|
|
2527
2546
|
visibleStartIndex: 0,
|
|
2528
2547
|
visibleEndIndex: 0,
|
|
2529
2548
|
scrollPosition: 0,
|
|
2530
2549
|
totalHeight: 0
|
|
2531
|
-
}),
|
|
2532
|
-
|
|
2533
|
-
if (
|
|
2534
|
-
|
|
2550
|
+
}), Ge = g(O && r > 0 ? { index: se(Math.trunc(O.index), 0, r - 1), align: "top", offset: -Math.max(0, O.offsetPx ?? 0) } : null), ft = g(!1), st = g(!0);
|
|
2551
|
+
X(() => {
|
|
2552
|
+
if (st.current) {
|
|
2553
|
+
st.current = !1;
|
|
2535
2554
|
return;
|
|
2536
2555
|
}
|
|
2537
|
-
|
|
2538
|
-
}, [
|
|
2539
|
-
const N =
|
|
2540
|
-
const
|
|
2541
|
-
return { from: Math.max(0,
|
|
2542
|
-
}),
|
|
2556
|
+
De && (Ge.current = null);
|
|
2557
|
+
}, [De, n]);
|
|
2558
|
+
const N = _e(() => xr(D), [D]), [gt] = Je(() => {
|
|
2559
|
+
const c = O?.index ?? C, u = typeof c == "number" && Number.isFinite(c) ? Math.max(0, Math.trunc(c)) : 0;
|
|
2560
|
+
return { from: Math.max(0, u - 50), to: u + 50 };
|
|
2561
|
+
}), ne = _e(
|
|
2543
2562
|
// 目的: Fenwick Tree のオプション設定
|
|
2544
2563
|
// 依存関係: resetOnGetItemHeightChange, initialSampleRange (マウント時固定)
|
|
2545
2564
|
// itemCount には依存させない (依存させると追記のたびに options 参照が変わり、計測済み高さが全消去される)。
|
|
2546
2565
|
// この useMemo により sampleRange を毎レンダー新規生成しない = 参照同一性由来の破壊的 reset を防ぐ。
|
|
2547
2566
|
() => ({
|
|
2548
|
-
sampleRange:
|
|
2549
|
-
resetOnValueFnChange:
|
|
2567
|
+
sampleRange: gt,
|
|
2568
|
+
resetOnValueFnChange: De,
|
|
2550
2569
|
materialize: !0
|
|
2551
2570
|
}),
|
|
2552
|
-
[
|
|
2553
|
-
),
|
|
2554
|
-
let o = 0,
|
|
2555
|
-
if (
|
|
2556
|
-
const
|
|
2557
|
-
o =
|
|
2558
|
-
} else if (typeof
|
|
2559
|
-
const
|
|
2560
|
-
o =
|
|
2561
|
-
} else typeof h == "number" && (o =
|
|
2562
|
-
return { position: o, total:
|
|
2563
|
-
}), [
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
}, [
|
|
2567
|
-
const
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
}, [b,
|
|
2571
|
-
const
|
|
2571
|
+
[De, gt]
|
|
2572
|
+
), V = nn(r, n, ne), [ot] = Je(() => {
|
|
2573
|
+
let o = 0, c = 0;
|
|
2574
|
+
if (O && r > 0) {
|
|
2575
|
+
const u = se(Math.trunc(O.index), 0, r - 1), _ = Math.max(0, O.offsetPx ?? 0), k = se(u - s * 2, 0, r - 1), F = se(u + s * 2, 0, r - 1), B = u > 0 || _ > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: k, to: F }] } } : void 0, { cumulative: te, total: we, currentValue: pe } = V.prefixSum(u, B), le = Math.max(te - pe + _, 0);
|
|
2576
|
+
o = Mt(le, N.top), c = we ?? V.getTotal();
|
|
2577
|
+
} else if (typeof C == "number") {
|
|
2578
|
+
const u = se(C, 0, r - 1), _ = se(u - s * 2, 0, r - 1), k = se(u + s * 2, 0, r - 1), F = C > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: _, to: k }] } } : void 0, { cumulative: B, total: te, currentValue: we } = V.prefixSum(C, F), pe = Math.max(B - we, 0);
|
|
2579
|
+
o = Mt(pe, N.top), c = te ?? V.getTotal();
|
|
2580
|
+
} else typeof h == "number" && (o = Mt(Math.max(h, 0), N.top)), c = V.getTotal();
|
|
2581
|
+
return { position: o, total: c };
|
|
2582
|
+
}), [je, mt] = Je(ot.position), [Ae, f] = Je(ot.total), M = g(ot.position), q = g(N.top), H = g(m ?? void 0), J = g(b ?? void 0), Te = g(oe), ee = (de?.length ?? 0) > 0, xe = !!oe;
|
|
2583
|
+
X(() => {
|
|
2584
|
+
ee && (z || P.warn("[VirtualScroll] horizontalKeyInputs is set but behaviorOptions.enableKeyboardNavigation is false; horizontal keyboard scrolling is disabled because the row key handler is not mounted."), xe || P.warn("[VirtualScroll] horizontalKeyInputs is set but onWheelHorizontal is missing; horizontal keyboard scrolling is disabled because the package does not own the horizontal axis."), Number.isFinite(y) && y > 0 || P.warn(`[VirtualScroll] horizontalKeyStep must be a finite positive number, received ${y}. Horizontal arrow keys are left untouched.`));
|
|
2585
|
+
}, [ee, xe, z, y]);
|
|
2586
|
+
const ye = g(/* @__PURE__ */ new Map()), $ = g(null), Re = g(null), [Ce, me] = Je(null), [Ee, rt] = Je(!1), Le = g(null), at = g(!1), Me = g(0), nt = g(!1), p = g(!1), R = g(r);
|
|
2587
|
+
R.current !== r && (R.current = r, p.current = !0), et(() => {
|
|
2588
|
+
H.current = m ?? void 0, J.current = b ?? void 0, Te.current = oe;
|
|
2589
|
+
}, [b, m, oe]);
|
|
2590
|
+
const ae = S(
|
|
2572
2591
|
(o) => {
|
|
2573
|
-
if (
|
|
2592
|
+
if (z && o && typeof o.focus == "function")
|
|
2574
2593
|
try {
|
|
2575
2594
|
o.focus({ preventScroll: !0 });
|
|
2576
2595
|
} catch {
|
|
2577
2596
|
o.focus();
|
|
2578
2597
|
}
|
|
2579
2598
|
},
|
|
2580
|
-
[
|
|
2581
|
-
),
|
|
2582
|
-
o(
|
|
2583
|
-
}, []),
|
|
2584
|
-
o(
|
|
2585
|
-
}, []),
|
|
2586
|
-
|
|
2587
|
-
const
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
}), []),
|
|
2591
|
-
|
|
2592
|
-
}, [
|
|
2593
|
-
const
|
|
2594
|
-
(o,
|
|
2595
|
-
if (!
|
|
2596
|
-
|
|
2599
|
+
[z]
|
|
2600
|
+
), it = S((o, { position: c, totalHeight: u }) => {
|
|
2601
|
+
o(c, u);
|
|
2602
|
+
}, []), Ne = Ir(H, W, it), zt = S((o, c) => {
|
|
2603
|
+
o(c);
|
|
2604
|
+
}, []), ct = Ir(J, W, zt), Ye = g(N.top);
|
|
2605
|
+
Ye.current = N.top;
|
|
2606
|
+
const bt = g(Ne);
|
|
2607
|
+
bt.current = Ne, X(() => (ft.current = !1, () => {
|
|
2608
|
+
ft.current = !0, Le.current && (clearTimeout(Le.current), Le.current = null);
|
|
2609
|
+
}), []), X(() => {
|
|
2610
|
+
z || (ye.current.clear(), $.current = null, Re.current = null);
|
|
2611
|
+
}, [z]);
|
|
2612
|
+
const Pt = S(
|
|
2613
|
+
(o, c) => {
|
|
2614
|
+
if (!c) {
|
|
2615
|
+
ye.current.delete(o);
|
|
2597
2616
|
return;
|
|
2598
2617
|
}
|
|
2599
|
-
|
|
2618
|
+
z && (ye.current.set(o, c), $.current === o && ($.current = null, Re.current = o, ae(c)));
|
|
2600
2619
|
},
|
|
2601
|
-
[
|
|
2602
|
-
),
|
|
2620
|
+
[z, ae]
|
|
2621
|
+
), Ft = 0.01, ut = g({
|
|
2603
2622
|
rafId: null,
|
|
2604
2623
|
loopActive: !1,
|
|
2605
2624
|
idleFrames: 0,
|
|
2606
|
-
lastRenderedPosition:
|
|
2607
|
-
}), yt =
|
|
2608
|
-
const o =
|
|
2625
|
+
lastRenderedPosition: ot.position
|
|
2626
|
+
}), yt = S(() => {
|
|
2627
|
+
const o = ut.current;
|
|
2609
2628
|
o.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(o.rafId), o.rafId = null, o.loopActive = !1, o.idleFrames = 0;
|
|
2610
2629
|
}, []);
|
|
2611
|
-
|
|
2630
|
+
X(
|
|
2612
2631
|
() => () => {
|
|
2613
2632
|
yt();
|
|
2614
2633
|
},
|
|
2615
2634
|
[yt]
|
|
2616
2635
|
);
|
|
2617
|
-
const
|
|
2618
|
-
}),
|
|
2619
|
-
const o =
|
|
2636
|
+
const Yt = g(() => {
|
|
2637
|
+
}), Ct = S(() => {
|
|
2638
|
+
const o = ut.current;
|
|
2620
2639
|
o.rafId = null;
|
|
2621
|
-
const
|
|
2622
|
-
if (
|
|
2640
|
+
const c = M.current, u = Qe(c, Ye.current), _ = V.getTotal();
|
|
2641
|
+
if (mt((F) => Math.abs(F - c) < Ft ? F : c), Math.abs(o.lastRenderedPosition - c) >= Ft ? (bt.current({ position: u, totalHeight: _ }), o.lastRenderedPosition = c, o.idleFrames = 0) : o.idleFrames += 1, o.idleFrames >= 2) {
|
|
2623
2642
|
yt();
|
|
2624
2643
|
return;
|
|
2625
2644
|
}
|
|
2626
2645
|
if (typeof requestAnimationFrame == "function") {
|
|
2627
|
-
o.rafId = requestAnimationFrame((
|
|
2646
|
+
o.rafId = requestAnimationFrame((F) => Yt.current(F));
|
|
2628
2647
|
return;
|
|
2629
2648
|
}
|
|
2630
2649
|
o.loopActive = !1;
|
|
2631
|
-
}, [
|
|
2632
|
-
|
|
2633
|
-
const
|
|
2634
|
-
const o =
|
|
2650
|
+
}, [V, yt]);
|
|
2651
|
+
Yt.current = Ct;
|
|
2652
|
+
const Bt = S(() => {
|
|
2653
|
+
const o = ut.current;
|
|
2635
2654
|
if (o.idleFrames = 0, !o.loopActive) {
|
|
2636
2655
|
if (o.loopActive = !0, typeof requestAnimationFrame == "function") {
|
|
2637
|
-
o.rafId = requestAnimationFrame(
|
|
2656
|
+
o.rafId = requestAnimationFrame(Ct);
|
|
2638
2657
|
return;
|
|
2639
2658
|
}
|
|
2640
2659
|
o.loopActive = !1;
|
|
2641
2660
|
}
|
|
2642
|
-
}, [
|
|
2643
|
-
(o,
|
|
2644
|
-
const
|
|
2645
|
-
if (
|
|
2646
|
-
|
|
2661
|
+
}, [Ct]), ge = S(
|
|
2662
|
+
(o, c) => {
|
|
2663
|
+
const u = c?.immediate ?? !1, _ = Qe(o, N.top);
|
|
2664
|
+
if (M.current = o, u) {
|
|
2665
|
+
ut.current.lastRenderedPosition = o, ut.current.idleFrames = 0, mt(o), Ne({ position: _, totalHeight: V.getTotal() });
|
|
2647
2666
|
return;
|
|
2648
2667
|
}
|
|
2649
|
-
|
|
2668
|
+
Bt();
|
|
2650
2669
|
},
|
|
2651
|
-
[
|
|
2652
|
-
),
|
|
2653
|
-
const
|
|
2654
|
-
if (!
|
|
2670
|
+
[Bt, V, N.top, Ne]
|
|
2671
|
+
), xt = S((o, c = 0) => {
|
|
2672
|
+
const u = j.current;
|
|
2673
|
+
if (!u)
|
|
2655
2674
|
return o;
|
|
2656
|
-
const
|
|
2657
|
-
|
|
2658
|
-
const
|
|
2659
|
-
return
|
|
2660
|
-
}, []),
|
|
2661
|
-
|
|
2662
|
-
if (!
|
|
2663
|
-
if (
|
|
2664
|
-
const o =
|
|
2665
|
-
|
|
2675
|
+
const _ = u.getScrollPosition();
|
|
2676
|
+
Me.current += 1;
|
|
2677
|
+
const k = u.getContentSize() + c, F = u.getViewportSize(), B = u.scrollTo(o, { contentSize: k, viewportSize: F });
|
|
2678
|
+
return B === _ && (Me.current = Math.max(0, Me.current - 1)), Math.abs(B - o) > 0.5 && (nt.current = !0), B;
|
|
2679
|
+
}, []), Dt = g(!1);
|
|
2680
|
+
X(() => {
|
|
2681
|
+
if (!Dt.current)
|
|
2682
|
+
if (Dt.current = !0, O == null && typeof C != "number" && typeof h == "number") {
|
|
2683
|
+
const o = Mt(Math.max(h, 0), N.top), c = Math.abs(o - M.current) > 0.5;
|
|
2684
|
+
ge(o, { immediate: !0 }), c && j.current?.scrollTo(o);
|
|
2666
2685
|
} else
|
|
2667
|
-
|
|
2668
|
-
}, [
|
|
2669
|
-
const o =
|
|
2670
|
-
if (
|
|
2671
|
-
|
|
2686
|
+
ge(M.current, { immediate: !0 });
|
|
2687
|
+
}, [O, C, h, N.top, ge]), X(() => {
|
|
2688
|
+
const o = V.getTotal();
|
|
2689
|
+
if (Ae !== o) {
|
|
2690
|
+
f(o);
|
|
2672
2691
|
return;
|
|
2673
2692
|
}
|
|
2674
|
-
if (
|
|
2675
|
-
|
|
2676
|
-
const
|
|
2677
|
-
if (
|
|
2678
|
-
const
|
|
2679
|
-
|
|
2693
|
+
if (nt.current) {
|
|
2694
|
+
nt.current = !1;
|
|
2695
|
+
const c = j.current;
|
|
2696
|
+
if (c && Math.abs(c.getScrollPosition() - M.current) > 0.5) {
|
|
2697
|
+
const u = xt(M.current);
|
|
2698
|
+
nt.current = !1, ge(u, { immediate: !0 });
|
|
2680
2699
|
}
|
|
2681
2700
|
}
|
|
2682
|
-
}, [
|
|
2683
|
-
if (
|
|
2684
|
-
const { index: o, align:
|
|
2685
|
-
if (
|
|
2686
|
-
const
|
|
2687
|
-
let
|
|
2688
|
-
|
|
2689
|
-
const
|
|
2690
|
-
Math.abs(
|
|
2691
|
-
from:
|
|
2692
|
-
to:
|
|
2693
|
-
targetIndex:
|
|
2694
|
-
}),
|
|
2701
|
+
}, [V, Ae, r, xt, ge]), X(() => {
|
|
2702
|
+
if (Ge.current !== null) {
|
|
2703
|
+
const { index: o, align: c, offset: u } = Ge.current, _ = Ie(o, r), { cumulative: k, currentValue: F } = V.prefixSum(_, { materializeOption: { materialize: !1 } });
|
|
2704
|
+
if (k !== void 0 && F !== void 0) {
|
|
2705
|
+
const B = Math.max(k - F, 0);
|
|
2706
|
+
let te = B;
|
|
2707
|
+
c === "bottom" ? te = k - be : c === "center" && (te = B + F / 2 - be / 2), u && (te -= u), te = Math.max(0, te);
|
|
2708
|
+
const we = Math.max(0, Ae + N.top + N.bottom - be), pe = Math.min(Mt(te, N.top), we);
|
|
2709
|
+
Math.abs(pe - M.current) > 1 && (P.debug("[VirtualScroll] Drift correction", {
|
|
2710
|
+
from: M.current,
|
|
2711
|
+
to: pe,
|
|
2712
|
+
targetIndex: _
|
|
2713
|
+
}), Me.current === 0 && (Me.current += 1), j.current?.scrollTo(pe), ge(pe, { immediate: !0 }));
|
|
2695
2714
|
}
|
|
2696
2715
|
}
|
|
2697
|
-
|
|
2698
|
-
}, [
|
|
2699
|
-
const o =
|
|
2700
|
-
if (o === N.top || (
|
|
2716
|
+
p.current = !1;
|
|
2717
|
+
}, [Ae, V, r, N.top, ge, be, N.bottom]), X(() => {
|
|
2718
|
+
const o = q.current;
|
|
2719
|
+
if (o === N.top || (q.current = N.top, Ge.current))
|
|
2701
2720
|
return;
|
|
2702
|
-
const
|
|
2703
|
-
|
|
2704
|
-
}, [N.top,
|
|
2705
|
-
const
|
|
2706
|
-
(o,
|
|
2721
|
+
const c = Qe(M.current, o), u = Mt(c, N.top);
|
|
2722
|
+
M.current = u, j.current?.scrollTo(u), ge(u, { immediate: !0 });
|
|
2723
|
+
}, [N.top, ge]);
|
|
2724
|
+
const At = S(
|
|
2725
|
+
(o, c) => {
|
|
2707
2726
|
if (r === 0)
|
|
2708
2727
|
return;
|
|
2709
|
-
const
|
|
2710
|
-
|
|
2711
|
-
let
|
|
2712
|
-
if (
|
|
2713
|
-
const
|
|
2714
|
-
|
|
2728
|
+
const u = Ie(o, r), _ = V.get(u), k = c - _, F = V.update(u, c);
|
|
2729
|
+
F !== void 0 && f(F), P.debug("[VirtualScroll] Updated item size manually", { index: u, size: c, total: F });
|
|
2730
|
+
let B = Ge.current ? Ge.current.index : null;
|
|
2731
|
+
if (B === null) {
|
|
2732
|
+
const te = M.current, we = xr(D).top, pe = Qe(te, we), { index: le, cumulative: qe } = V.findIndexAtOrAfter(pe, { materializeOption: { materialize: !1 } });
|
|
2733
|
+
B = qe !== void 0 && qe === pe ? le + 1 : le;
|
|
2715
2734
|
}
|
|
2716
|
-
if (
|
|
2717
|
-
const
|
|
2718
|
-
|
|
2735
|
+
if (B !== -1 && u < B && k !== 0) {
|
|
2736
|
+
const te = M.current, we = te + k;
|
|
2737
|
+
xt(we, k), ge(we, { immediate: !0 }), P.debug("[VirtualScroll] Adjusted scroll for layout shift (manual update)", { from: te, to: we, causedByIndex: u, delta: k, activeVisibleStartIndex: B });
|
|
2719
2738
|
}
|
|
2720
2739
|
},
|
|
2721
|
-
[
|
|
2722
|
-
),
|
|
2723
|
-
(o,
|
|
2724
|
-
if (!
|
|
2740
|
+
[V, r, xt, ge, D]
|
|
2741
|
+
), a = S(
|
|
2742
|
+
(o, c) => {
|
|
2743
|
+
if (!j.current || r === 0)
|
|
2725
2744
|
return;
|
|
2726
|
-
const
|
|
2727
|
-
if (
|
|
2745
|
+
const u = Ie(o, r), _ = Ie(u - s * 2, r), k = Ie(u + s * 2, r), { cumulative: F, total: B, currentValue: te } = V.prefixSum(u, { materializeOption: { materialize: !0, ranges: [{ from: _, to: k }] } });
|
|
2746
|
+
if (P.debug("[VirtualScroll] Scrolling to index:", u, "ItemBottom:", F, "Total height:", B, "ItemHeight:", te, "safeIndexFrom:", _, "safeIndexTo:", k), !B)
|
|
2728
2747
|
return;
|
|
2729
|
-
const
|
|
2730
|
-
let
|
|
2731
|
-
|
|
2732
|
-
const
|
|
2733
|
-
|
|
2734
|
-
index:
|
|
2735
|
-
align:
|
|
2736
|
-
offset:
|
|
2748
|
+
const we = Math.max(F - te, 0);
|
|
2749
|
+
let pe = we;
|
|
2750
|
+
c?.align === "bottom" ? pe = F - be : c?.align === "center" && (pe = we + te / 2 - be / 2), c?.offset && (pe -= c.offset), pe = Math.max(0, pe);
|
|
2751
|
+
const le = Mt(pe, N.top), qe = j.current?.getContentSize() ?? B + N.top + N.bottom, Oe = Math.max(0, qe - be), Xe = Math.min(le, Oe);
|
|
2752
|
+
Ge.current = {
|
|
2753
|
+
index: u,
|
|
2754
|
+
align: c?.align,
|
|
2755
|
+
offset: c?.offset
|
|
2737
2756
|
};
|
|
2738
|
-
const
|
|
2739
|
-
|
|
2757
|
+
const Ot = j.current?.getScrollPosition() ?? -1, Gt = Math.abs(Ot - Xe) > 0.5;
|
|
2758
|
+
at.current = !1, Me.current = 0, Gt && (at.current = !0, Me.current += 1, j.current?.scrollTo(Xe)), f(B), ge(Xe, { immediate: !0 }), P.debug("[VirtualScroll] Setting scroll position to:", Xe, { original: le, max: Oe });
|
|
2740
2759
|
},
|
|
2741
|
-
[
|
|
2742
|
-
),
|
|
2743
|
-
|
|
2744
|
-
const o =
|
|
2745
|
-
!o || r === 0 || (
|
|
2746
|
-
}, [r,
|
|
2747
|
-
const
|
|
2760
|
+
[V, s, r, N.top, N.bottom, be, ge]
|
|
2761
|
+
), x = g(O && r === 0 ? O : null);
|
|
2762
|
+
X(() => {
|
|
2763
|
+
const o = x.current;
|
|
2764
|
+
!o || r === 0 || (x.current = null, a(se(Math.trunc(o.index), 0, r - 1), { align: "top", offset: -Math.max(0, o.offsetPx ?? 0) }));
|
|
2765
|
+
}, [r, a]);
|
|
2766
|
+
const E = S(
|
|
2748
2767
|
(o) => {
|
|
2749
|
-
if (!
|
|
2768
|
+
if (!j.current || r === 0)
|
|
2750
2769
|
return;
|
|
2751
|
-
const
|
|
2752
|
-
|
|
2770
|
+
const c = V.getTotal(), u = se(Math.floor(o), 0, c), { index: _, cumulative: k, currentValue: F } = V.findIndexAtOrAfter(u, { materializeOption: { materialize: !1 } }), te = (k ?? 0) - (F ?? 0) - u;
|
|
2771
|
+
a(_, { offset: te });
|
|
2753
2772
|
},
|
|
2754
|
-
[
|
|
2755
|
-
),
|
|
2773
|
+
[V, r, a]
|
|
2774
|
+
), L = S(() => {
|
|
2756
2775
|
if (r === 0)
|
|
2757
2776
|
return null;
|
|
2758
|
-
const o =
|
|
2759
|
-
if (
|
|
2777
|
+
const o = Qe(M.current, N.top), { index: c, cumulative: u, currentValue: _ } = V.findIndexAtOrAfter(o, { materializeOption: { materialize: !1 } });
|
|
2778
|
+
if (c === -1)
|
|
2760
2779
|
return { index: r - 1, offsetPx: 0 };
|
|
2761
|
-
if (
|
|
2762
|
-
return { index:
|
|
2763
|
-
const
|
|
2764
|
-
return { index:
|
|
2765
|
-
}, [
|
|
2780
|
+
if (u === o)
|
|
2781
|
+
return { index: se(c + 1, 0, r - 1), offsetPx: 0 };
|
|
2782
|
+
const k = (u ?? 0) - (_ ?? 0);
|
|
2783
|
+
return { index: c, offsetPx: Math.max(0, o - k) };
|
|
2784
|
+
}, [V, r, N.top]), U = S(
|
|
2766
2785
|
(o) => {
|
|
2767
|
-
const
|
|
2768
|
-
|
|
2769
|
-
const
|
|
2770
|
-
return
|
|
2786
|
+
const c = Qe(M.current, N.top), u = typeof o == "function" ? o(c) : o;
|
|
2787
|
+
E(u);
|
|
2788
|
+
const _ = j.current?.getScrollPosition(), k = typeof _ == "number" ? _ : M.current;
|
|
2789
|
+
return ge(k), Qe(k, Ye.current);
|
|
2771
2790
|
},
|
|
2772
|
-
[N.top,
|
|
2773
|
-
),
|
|
2774
|
-
const
|
|
2775
|
-
if (!
|
|
2776
|
-
return
|
|
2777
|
-
const
|
|
2778
|
-
return
|
|
2779
|
-
}, []),
|
|
2780
|
-
(o,
|
|
2781
|
-
|
|
2782
|
-
const
|
|
2783
|
-
|
|
2784
|
-
const
|
|
2785
|
-
|
|
2786
|
-
const
|
|
2787
|
-
if (
|
|
2788
|
-
if (
|
|
2791
|
+
[N.top, E, ge]
|
|
2792
|
+
), ve = S((o) => {
|
|
2793
|
+
const c = j.current;
|
|
2794
|
+
if (!c)
|
|
2795
|
+
return Qe(M.current, Ye.current);
|
|
2796
|
+
const u = c.scrollTo((_) => _ + o);
|
|
2797
|
+
return Qe(u, Ye.current);
|
|
2798
|
+
}, []), Be = S((o) => j.current?.applyWheel(o) ?? !1, []), He = S(
|
|
2799
|
+
(o, c) => {
|
|
2800
|
+
P.debug("[VirtualScroll] Scroll position changed:", o);
|
|
2801
|
+
const u = at.current;
|
|
2802
|
+
u && (at.current = !1);
|
|
2803
|
+
const _ = Me.current > 0;
|
|
2804
|
+
_ && (Me.current = 0);
|
|
2805
|
+
const k = p.current && R.current === r;
|
|
2806
|
+
if (u || _ || k || (Ge.current = null), ge(o), I) {
|
|
2807
|
+
if (u || _)
|
|
2789
2808
|
return;
|
|
2790
|
-
const
|
|
2791
|
-
if (
|
|
2792
|
-
const
|
|
2793
|
-
|
|
2794
|
-
|
|
2809
|
+
const F = o - c;
|
|
2810
|
+
if (P.debug("[VirtualScroll] Scroll diff:", F, "New:", o, "Prev:", c), Math.abs(F) > 1) {
|
|
2811
|
+
const B = F > 0 ? "down" : "up";
|
|
2812
|
+
me(B), rt(!0), P.debug("[VirtualScroll] Showing scroll buttons. Direction:", B), Le.current && clearTimeout(Le.current), Le.current = setTimeout(() => {
|
|
2813
|
+
rt(!1), P.debug("[VirtualScroll] Hiding scroll buttons");
|
|
2795
2814
|
}, 2e3);
|
|
2796
2815
|
}
|
|
2797
2816
|
}
|
|
2798
2817
|
},
|
|
2799
|
-
[
|
|
2800
|
-
),
|
|
2801
|
-
const o =
|
|
2802
|
-
return
|
|
2803
|
-
...
|
|
2804
|
-
scrollPosition:
|
|
2818
|
+
[ge, I, r]
|
|
2819
|
+
), lt = _e(() => Qe(je, N.top), [N.top, je]), Ze = _e(() => {
|
|
2820
|
+
const o = V.getTotal(), c = dn(lt, be, s, r, n, V, o);
|
|
2821
|
+
return P.debug("[VirtualScroll] Calculated rendering range:", () => ({
|
|
2822
|
+
...c,
|
|
2823
|
+
scrollPosition: lt,
|
|
2805
2824
|
renderingContentSize: o,
|
|
2806
2825
|
overscanCount: s,
|
|
2807
|
-
viewportSize:
|
|
2808
|
-
})),
|
|
2809
|
-
}, [
|
|
2810
|
-
(o,
|
|
2811
|
-
if (!
|
|
2826
|
+
viewportSize: be
|
|
2827
|
+
})), c;
|
|
2828
|
+
}, [lt, be, s, r, n, V]), { renderingStartIndex: pt, renderingEndIndex: wt, visibleStartIndex: vt, visibleEndIndex: Rt } = Ze, ht = S(
|
|
2829
|
+
(o, c) => {
|
|
2830
|
+
if (!z || r === 0)
|
|
2812
2831
|
return;
|
|
2813
|
-
const
|
|
2814
|
-
if (!(
|
|
2815
|
-
const
|
|
2816
|
-
|
|
2832
|
+
const u = Ie(o, r);
|
|
2833
|
+
if (!(c?.ensureVisible ?? !0)) {
|
|
2834
|
+
const Oe = ye.current.get(u);
|
|
2835
|
+
Oe && ($.current = null, Re.current = u, ae(Oe));
|
|
2817
2836
|
return;
|
|
2818
2837
|
}
|
|
2819
|
-
const
|
|
2820
|
-
if (
|
|
2821
|
-
|
|
2822
|
-
const
|
|
2823
|
-
|
|
2838
|
+
const k = V.prefixSum(u, { materializeOption: { materialize: !1 } }), F = k.currentValue, B = Math.max(k.cumulative - F, 0), te = B + F, we = Qe(M.current, N.top), pe = we + be;
|
|
2839
|
+
if (B < we || te > pe) {
|
|
2840
|
+
a(u);
|
|
2841
|
+
const Oe = ye.current.get(u);
|
|
2842
|
+
Oe ? ($.current = null, Re.current = u, ae(Oe)) : $.current = u;
|
|
2824
2843
|
return;
|
|
2825
2844
|
}
|
|
2826
|
-
const
|
|
2827
|
-
if (
|
|
2828
|
-
|
|
2845
|
+
const qe = ye.current.get(u);
|
|
2846
|
+
if (qe) {
|
|
2847
|
+
$.current = null, Re.current = u, ae(qe);
|
|
2829
2848
|
return;
|
|
2830
2849
|
}
|
|
2831
|
-
|
|
2850
|
+
$.current = u;
|
|
2832
2851
|
},
|
|
2833
|
-
[
|
|
2834
|
-
),
|
|
2835
|
-
(o,
|
|
2836
|
-
if (!(!
|
|
2852
|
+
[z, r, V, N.top, a, ae, be]
|
|
2853
|
+
), sr = S(
|
|
2854
|
+
(o, c) => {
|
|
2855
|
+
if (!(!z || o.defaultPrevented) && !(o.altKey || o.metaKey || o.ctrlKey) && o.target === o.currentTarget && !o.currentTarget.isContentEditable) {
|
|
2837
2856
|
if (o.key === "ArrowLeft" || o.key === "ArrowRight") {
|
|
2838
|
-
const
|
|
2839
|
-
if (!
|
|
2840
|
-
return;
|
|
2841
|
-
const A = o.shiftKey ? "shift-arrow" : "arrow";
|
|
2842
|
-
if (!he?.includes(A) || o.shiftKey && Qr(o.currentTarget) || !(Number.isFinite(P) && P > 0))
|
|
2857
|
+
const u = Te.current;
|
|
2858
|
+
if (!u || o.shiftKey || !de?.includes("arrow") || !(Number.isFinite(y) && y > 0))
|
|
2843
2859
|
return;
|
|
2844
|
-
o.preventDefault(),
|
|
2860
|
+
o.preventDefault(), u(o.key === "ArrowLeft" ? -y : y);
|
|
2845
2861
|
return;
|
|
2846
2862
|
}
|
|
2847
2863
|
if (o.key === "ArrowDown") {
|
|
2848
|
-
|
|
2864
|
+
c < r - 1 && (o.preventDefault(), ht(c + 1));
|
|
2849
2865
|
return;
|
|
2850
2866
|
}
|
|
2851
2867
|
if (o.key === "ArrowUp") {
|
|
2852
|
-
|
|
2868
|
+
c > 0 && (o.preventDefault(), ht(c - 1));
|
|
2853
2869
|
return;
|
|
2854
2870
|
}
|
|
2855
2871
|
if (o.key === "PageDown") {
|
|
2856
|
-
if (
|
|
2872
|
+
if (c < r - 1) {
|
|
2857
2873
|
o.preventDefault();
|
|
2858
|
-
const { visibleStartIndex:
|
|
2859
|
-
|
|
2874
|
+
const { visibleStartIndex: u, visibleEndIndex: _ } = tt.current, k = Math.max(_ - u + 1, 1), F = Math.max(k, 1), B = Ie(Math.min(c + F, r - 1), r);
|
|
2875
|
+
ht(B);
|
|
2860
2876
|
}
|
|
2861
2877
|
return;
|
|
2862
2878
|
}
|
|
2863
|
-
if (o.key === "PageUp" &&
|
|
2879
|
+
if (o.key === "PageUp" && c > 0) {
|
|
2864
2880
|
o.preventDefault();
|
|
2865
|
-
const { visibleStartIndex:
|
|
2866
|
-
|
|
2881
|
+
const { visibleStartIndex: u, visibleEndIndex: _ } = tt.current, k = Math.max(_ - u + 1, 1), F = Math.max(k, 1), B = Ie(c - F, r);
|
|
2882
|
+
ht(B);
|
|
2867
2883
|
}
|
|
2868
2884
|
}
|
|
2869
2885
|
},
|
|
2870
|
-
[
|
|
2871
|
-
),
|
|
2886
|
+
[z, r, ht, de, y]
|
|
2887
|
+
), or = S(
|
|
2888
|
+
/**
|
|
2889
|
+
* Returns focus from an element inside the row back to the row wrapper on Escape.
|
|
2890
|
+
* 行内要素の Escape で行ラッパーへフォーカスを戻す処理。
|
|
2891
|
+
*
|
|
2892
|
+
* @param event - Keyboard event (bubble phase on the row wrapper) / 行ラッパー bubble フェーズのキーイベント
|
|
2893
|
+
* @param index - Row index / 行インデックス
|
|
2894
|
+
*/
|
|
2895
|
+
(o, c) => {
|
|
2896
|
+
if (o.key !== "Escape" || o.defaultPrevented || o.nativeEvent.isComposing || o.target === o.currentTarget)
|
|
2897
|
+
return;
|
|
2898
|
+
const u = o.target;
|
|
2899
|
+
u instanceof HTMLInputElement || u instanceof HTMLTextAreaElement || u instanceof HTMLSelectElement || u.isContentEditable || (o.preventDefault(), ht(c));
|
|
2900
|
+
},
|
|
2901
|
+
[ht]
|
|
2902
|
+
), ar = S(
|
|
2872
2903
|
(o) => {
|
|
2873
|
-
if (!
|
|
2904
|
+
if (!z)
|
|
2874
2905
|
return;
|
|
2875
|
-
const
|
|
2876
|
-
|
|
2906
|
+
const c = Ie(o, r);
|
|
2907
|
+
$.current = null, Re.current = c, ce?.(c);
|
|
2877
2908
|
},
|
|
2878
|
-
[
|
|
2909
|
+
[z, r, ce]
|
|
2879
2910
|
);
|
|
2880
|
-
|
|
2881
|
-
const o =
|
|
2882
|
-
|
|
2883
|
-
renderingStartIndex:
|
|
2884
|
-
renderingEndIndex:
|
|
2885
|
-
visibleStartIndex:
|
|
2886
|
-
visibleEndIndex:
|
|
2887
|
-
scrollPositionState:
|
|
2888
|
-
paneScrollPosition:
|
|
2889
|
-
logicalScrollPosition:
|
|
2890
|
-
contentSize:
|
|
2911
|
+
X(() => {
|
|
2912
|
+
const o = j.current?.getScrollPosition() ?? 0, c = M.current, u = Qe(c, N.top);
|
|
2913
|
+
P.debug("[VirtualScroll] Range change effect triggered", () => ({
|
|
2914
|
+
renderingStartIndex: pt,
|
|
2915
|
+
renderingEndIndex: wt,
|
|
2916
|
+
visibleStartIndex: vt,
|
|
2917
|
+
visibleEndIndex: Rt,
|
|
2918
|
+
scrollPositionState: je,
|
|
2919
|
+
paneScrollPosition: c,
|
|
2920
|
+
logicalScrollPosition: u,
|
|
2921
|
+
contentSize: Ae,
|
|
2891
2922
|
scrollPaneScrollPosition: o
|
|
2892
|
-
})),
|
|
2893
|
-
renderingStartIndex:
|
|
2894
|
-
renderingEndIndex:
|
|
2895
|
-
visibleStartIndex:
|
|
2896
|
-
visibleEndIndex:
|
|
2897
|
-
scrollPosition:
|
|
2898
|
-
totalHeight:
|
|
2923
|
+
})), ct({
|
|
2924
|
+
renderingStartIndex: pt,
|
|
2925
|
+
renderingEndIndex: wt,
|
|
2926
|
+
visibleStartIndex: vt,
|
|
2927
|
+
visibleEndIndex: Rt,
|
|
2928
|
+
scrollPosition: u,
|
|
2929
|
+
totalHeight: Ae
|
|
2899
2930
|
});
|
|
2900
|
-
}, [
|
|
2901
|
-
const
|
|
2902
|
-
if (!
|
|
2931
|
+
}, [Ae, wt, pt, N.top, ct, je, Rt, vt]);
|
|
2932
|
+
const Mr = S(() => {
|
|
2933
|
+
if (!I)
|
|
2903
2934
|
return null;
|
|
2904
|
-
const o =
|
|
2905
|
-
return /* @__PURE__ */
|
|
2935
|
+
const o = Ee && Ce !== null;
|
|
2936
|
+
return /* @__PURE__ */ ie("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": o, inert: !o, children: Ce === "up" ? /* @__PURE__ */ ie("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ ie(
|
|
2906
2937
|
"button",
|
|
2907
2938
|
{
|
|
2908
2939
|
type: "button",
|
|
2909
2940
|
className: "aqvs-scroll-to-edge-button",
|
|
2910
2941
|
tabIndex: o ? 0 : -1,
|
|
2911
|
-
onClick: (
|
|
2912
|
-
|
|
2942
|
+
onClick: (u) => {
|
|
2943
|
+
u.stopPropagation(), at.current = !0, a(0), rt(!1);
|
|
2913
2944
|
},
|
|
2914
2945
|
children: "Top"
|
|
2915
2946
|
}
|
|
2916
|
-
) }) : /* @__PURE__ */
|
|
2947
|
+
) }) : /* @__PURE__ */ ie("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-bottom", children: /* @__PURE__ */ ie(
|
|
2917
2948
|
"button",
|
|
2918
2949
|
{
|
|
2919
2950
|
type: "button",
|
|
2920
2951
|
className: "aqvs-scroll-to-edge-button",
|
|
2921
2952
|
tabIndex: o ? 0 : -1,
|
|
2922
|
-
onClick: (
|
|
2923
|
-
|
|
2953
|
+
onClick: (u) => {
|
|
2954
|
+
u.stopPropagation(), at.current = !0, a(r - 1), rt(!1);
|
|
2924
2955
|
},
|
|
2925
2956
|
children: "Bottom"
|
|
2926
2957
|
}
|
|
2927
2958
|
) }) });
|
|
2928
|
-
}, [
|
|
2959
|
+
}, [I, Ee, Ce, a, r]), Ut = g(0), { visibleItems: Wt, renderAnchor: Kt } = _e(() => {
|
|
2929
2960
|
if (r === 0)
|
|
2930
2961
|
return {
|
|
2931
|
-
visibleItems: /* @__PURE__ */
|
|
2962
|
+
visibleItems: /* @__PURE__ */ ie("div", { className: "aqvs-no-items-container", children: /* @__PURE__ */ ie("div", { className: "aqvs-no-items-text", children: "No items" }) }),
|
|
2932
2963
|
renderAnchor: 0
|
|
2933
2964
|
};
|
|
2934
|
-
const o =
|
|
2935
|
-
Number.isFinite(
|
|
2936
|
-
const
|
|
2937
|
-
let
|
|
2938
|
-
for (let
|
|
2939
|
-
if (
|
|
2940
|
-
|
|
2965
|
+
const o = Ie(pt, r), c = Ie(wt, r), { cumulative: u, currentValue: _ } = V.prefixSum(o, { materializeOption: { materialize: !1 } }), k = u - _;
|
|
2966
|
+
Number.isFinite(k) && Math.abs(k - Ut.current) > ln && (Ut.current = k);
|
|
2967
|
+
const F = Ut.current, B = [], te = [];
|
|
2968
|
+
let we = 0, pe = k;
|
|
2969
|
+
for (let le = o; le <= c; le++) {
|
|
2970
|
+
if (te.length >= vr) {
|
|
2971
|
+
P.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.", { cap: vr, safeRenderingStartIndex: o, safeRenderingEndIndex: c });
|
|
2941
2972
|
break;
|
|
2942
2973
|
}
|
|
2943
|
-
const
|
|
2944
|
-
|
|
2945
|
-
const
|
|
2946
|
-
|
|
2947
|
-
/* @__PURE__ */
|
|
2948
|
-
|
|
2974
|
+
const qe = n(le), Oe = V.get(le), Xe = qe - Oe;
|
|
2975
|
+
Xe !== 0 && B.push({ index: le, value: qe });
|
|
2976
|
+
const Ot = pe + we, Gt = t ? t(le) : le;
|
|
2977
|
+
te.push(
|
|
2978
|
+
/* @__PURE__ */ ie(
|
|
2979
|
+
fn,
|
|
2949
2980
|
{
|
|
2950
|
-
index:
|
|
2951
|
-
top:
|
|
2952
|
-
height:
|
|
2953
|
-
item: e(
|
|
2954
|
-
clipItemHeight:
|
|
2955
|
-
enableKeyboardNavigation:
|
|
2956
|
-
onKeyDown:
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2981
|
+
index: le,
|
|
2982
|
+
top: Ot - F,
|
|
2983
|
+
height: qe,
|
|
2984
|
+
item: e(le),
|
|
2985
|
+
clipItemHeight: Ke,
|
|
2986
|
+
enableKeyboardNavigation: z,
|
|
2987
|
+
onKeyDown: sr,
|
|
2988
|
+
onEscapeKeyDown: ke ? or : void 0,
|
|
2989
|
+
onFocus: ar,
|
|
2990
|
+
registerItemRef: Pt,
|
|
2991
|
+
children: v
|
|
2960
2992
|
},
|
|
2961
|
-
|
|
2993
|
+
Gt
|
|
2962
2994
|
)
|
|
2963
|
-
),
|
|
2995
|
+
), we += Xe, pe += Oe;
|
|
2964
2996
|
}
|
|
2965
|
-
return
|
|
2966
|
-
if (
|
|
2997
|
+
return B.length > 0 && Promise.resolve().then(() => {
|
|
2998
|
+
if (ft.current)
|
|
2967
2999
|
return;
|
|
2968
|
-
let
|
|
2969
|
-
for (const
|
|
2970
|
-
if (
|
|
2971
|
-
const
|
|
2972
|
-
|
|
3000
|
+
let le = 0;
|
|
3001
|
+
for (const Xe of B)
|
|
3002
|
+
if (Xe.index < vt) {
|
|
3003
|
+
const Ot = V.get(Xe.index);
|
|
3004
|
+
le += Xe.value - Ot;
|
|
2973
3005
|
}
|
|
2974
|
-
const
|
|
2975
|
-
if (
|
|
3006
|
+
const qe = V.updates(B);
|
|
3007
|
+
if (ft.current || typeof qe != "number")
|
|
2976
3008
|
return;
|
|
2977
|
-
|
|
2978
|
-
const
|
|
2979
|
-
if (
|
|
2980
|
-
const
|
|
2981
|
-
|
|
2982
|
-
} else
|
|
2983
|
-
}), { visibleItems:
|
|
3009
|
+
f(qe), P.debug("[VirtualScroll] Updated heights for items", B, "New total height:", qe);
|
|
3010
|
+
const Oe = j.current?.getScrollPosition() ?? M.current;
|
|
3011
|
+
if (le !== 0) {
|
|
3012
|
+
const Xe = Oe + le;
|
|
3013
|
+
xt(Xe, le), ge(Xe, { immediate: !0 }), P.debug("[VirtualScroll] Adjusted scroll for layout shift (auto update)", { from: Oe, to: Xe, shiftAmount: le });
|
|
3014
|
+
} else Oe !== M.current && ge(Oe);
|
|
3015
|
+
}), { visibleItems: te, renderAnchor: F };
|
|
2984
3016
|
}, [
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
3017
|
+
v,
|
|
3018
|
+
Ke,
|
|
3019
|
+
Ae,
|
|
3020
|
+
z,
|
|
2989
3021
|
r,
|
|
2990
|
-
|
|
3022
|
+
V,
|
|
2991
3023
|
e,
|
|
2992
3024
|
t,
|
|
2993
3025
|
n,
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3026
|
+
ar,
|
|
3027
|
+
sr,
|
|
3028
|
+
ke,
|
|
3029
|
+
or,
|
|
3030
|
+
xt,
|
|
3031
|
+
Pt,
|
|
3032
|
+
wt,
|
|
3033
|
+
pt,
|
|
3034
|
+
ge,
|
|
3035
|
+
vt
|
|
3036
|
+
]), Pr = S(
|
|
3003
3037
|
(o) => {
|
|
3004
|
-
const
|
|
3005
|
-
if (
|
|
3038
|
+
const c = (W ?? 0) > 0, u = Math.abs(o - je), _ = c && u > 0.5 ? je : o, k = Qe(_, N.top);
|
|
3039
|
+
if (P.debug("[VirtualScroll] Rendering visible items", () => ({
|
|
3006
3040
|
currentScrollPosition: o,
|
|
3007
|
-
effectiveScrollPosition:
|
|
3008
|
-
renderingStartIndex:
|
|
3009
|
-
renderingEndIndex:
|
|
3041
|
+
effectiveScrollPosition: k,
|
|
3042
|
+
renderingStartIndex: pt,
|
|
3043
|
+
renderingEndIndex: wt,
|
|
3010
3044
|
itemCount: r,
|
|
3011
|
-
viewportSize:
|
|
3012
|
-
callbackThrottleMs:
|
|
3013
|
-
diff:
|
|
3014
|
-
rawEffectiveScrollPosition:
|
|
3045
|
+
viewportSize: be,
|
|
3046
|
+
callbackThrottleMs: W,
|
|
3047
|
+
diff: u,
|
|
3048
|
+
rawEffectiveScrollPosition: _
|
|
3015
3049
|
})), r === 0)
|
|
3016
|
-
return
|
|
3017
|
-
const
|
|
3050
|
+
return Wt;
|
|
3051
|
+
const F = N.top + Kt - _, B = N.bottom > 0 ? /* @__PURE__ */ ie(
|
|
3018
3052
|
"div",
|
|
3019
3053
|
{
|
|
3020
3054
|
className: "aqvs-bottom-inset",
|
|
3021
3055
|
style: {
|
|
3022
3056
|
// ラッパー座標での bottom インセット位置 = コンテンツ総高さ (最終行の下端) - アンカー。
|
|
3023
|
-
top:
|
|
3057
|
+
top: V.getTotal() - Kt,
|
|
3024
3058
|
height: N.bottom
|
|
3025
3059
|
}
|
|
3026
3060
|
},
|
|
3027
3061
|
"virtualscroll-bottom-inset"
|
|
3028
3062
|
) : null;
|
|
3029
|
-
return
|
|
3030
|
-
containerTop:
|
|
3031
|
-
logicalScrollPosition:
|
|
3063
|
+
return P.debug("[VirtualScroll] Rendering items", () => ({
|
|
3064
|
+
containerTop: F,
|
|
3065
|
+
logicalScrollPosition: lt,
|
|
3032
3066
|
resolvedInsets: N,
|
|
3033
|
-
effectiveScrollPosition:
|
|
3034
|
-
})), /* @__PURE__ */
|
|
3035
|
-
|
|
3036
|
-
|
|
3067
|
+
effectiveScrollPosition: k
|
|
3068
|
+
})), /* @__PURE__ */ Tt("div", { className: "aqvs-items-wrapper", style: { top: 0, transform: `translateY(${F}px)`, willChange: "transform" }, children: [
|
|
3069
|
+
Wt,
|
|
3070
|
+
B
|
|
3037
3071
|
] });
|
|
3038
3072
|
},
|
|
3039
|
-
[
|
|
3040
|
-
),
|
|
3073
|
+
[W, r, V, lt, Kt, wt, pt, N, je, be, Wt]
|
|
3074
|
+
), lr = _e(
|
|
3041
3075
|
() => ({
|
|
3042
|
-
renderingStartIndex:
|
|
3043
|
-
renderingEndIndex:
|
|
3044
|
-
visibleStartIndex:
|
|
3045
|
-
visibleEndIndex:
|
|
3046
|
-
scrollPosition:
|
|
3047
|
-
totalHeight:
|
|
3076
|
+
renderingStartIndex: Ze.renderingStartIndex,
|
|
3077
|
+
renderingEndIndex: Ze.renderingEndIndex,
|
|
3078
|
+
visibleStartIndex: Ze.visibleStartIndex,
|
|
3079
|
+
visibleEndIndex: Ze.visibleEndIndex,
|
|
3080
|
+
scrollPosition: lt,
|
|
3081
|
+
totalHeight: V.getTotal()
|
|
3048
3082
|
// contentSize (State) ではなく最新値を反映
|
|
3049
3083
|
}),
|
|
3050
3084
|
// contentSize を依存に含めることで、updateItemSize/updates 等で木の総高さが変わった際に
|
|
3051
3085
|
// (fenwickTree は安定参照のため getTotal() の変化だけでは再計算されない) 総高さを再取得する。
|
|
3052
|
-
[
|
|
3086
|
+
[Ze, lt, V, Ae]
|
|
3053
3087
|
);
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
}, [
|
|
3057
|
-
|
|
3088
|
+
X(() => {
|
|
3089
|
+
tt.current = lr;
|
|
3090
|
+
}, [lr]);
|
|
3091
|
+
const [yr, cr] = Je(""), ur = g(w);
|
|
3092
|
+
et(() => {
|
|
3093
|
+
ur.current = w;
|
|
3094
|
+
}, [w]);
|
|
3095
|
+
const Et = w?.debounceMs ?? 400, Ht = Number.isFinite(Et) && Et >= 0, Lt = w !== void 0;
|
|
3096
|
+
X(() => {
|
|
3097
|
+
Lt && !Ht && P.warn(`[VirtualScroll] liveRegion.debounceMs must be a finite number >= 0, received ${Et}. Announcements are disabled.`);
|
|
3098
|
+
}, [Lt, Ht, Et]), X(() => {
|
|
3099
|
+
if (!(Lt && Ht)) {
|
|
3100
|
+
cr("");
|
|
3101
|
+
return;
|
|
3102
|
+
}
|
|
3103
|
+
const o = setTimeout(() => {
|
|
3104
|
+
const c = ur.current?.format;
|
|
3105
|
+
if (!c)
|
|
3106
|
+
return;
|
|
3107
|
+
const u = c({ visibleStartIndex: vt, visibleEndIndex: Rt, itemCount: r });
|
|
3108
|
+
cr(u);
|
|
3109
|
+
}, Et);
|
|
3110
|
+
return () => clearTimeout(o);
|
|
3111
|
+
}, [Lt, Ht, Et, vt, Rt, r]), ir(
|
|
3112
|
+
Z,
|
|
3058
3113
|
() => ({
|
|
3059
3114
|
getScrollPosition: () => {
|
|
3060
|
-
const o =
|
|
3061
|
-
return typeof o == "number" ?
|
|
3115
|
+
const o = j.current?.getScrollPosition();
|
|
3116
|
+
return typeof o == "number" ? Qe(o, Ye.current) : -1;
|
|
3062
3117
|
},
|
|
3063
|
-
getContentSize: () =>
|
|
3064
|
-
getViewportSize: () =>
|
|
3065
|
-
scrollTo:
|
|
3066
|
-
scrollBy:
|
|
3067
|
-
applyWheel:
|
|
3068
|
-
scrollToIndex:
|
|
3069
|
-
getFenwickTreeTotalHeight: () =>
|
|
3070
|
-
getFenwickSize: () =>
|
|
3071
|
-
focusItemAtIndex:
|
|
3072
|
-
getRange: () =>
|
|
3073
|
-
getScrollAnchor:
|
|
3074
|
-
updateItemSize:
|
|
3118
|
+
getContentSize: () => j.current?.getContentSize() ?? -1,
|
|
3119
|
+
getViewportSize: () => j.current?.getViewportSize() ?? -1,
|
|
3120
|
+
scrollTo: U,
|
|
3121
|
+
scrollBy: ve,
|
|
3122
|
+
applyWheel: Be,
|
|
3123
|
+
scrollToIndex: a,
|
|
3124
|
+
getFenwickTreeTotalHeight: () => V.getTotal(),
|
|
3125
|
+
getFenwickSize: () => V.getSize(),
|
|
3126
|
+
focusItemAtIndex: ht,
|
|
3127
|
+
getRange: () => tt.current,
|
|
3128
|
+
getScrollAnchor: L,
|
|
3129
|
+
updateItemSize: At
|
|
3075
3130
|
}),
|
|
3076
|
-
[
|
|
3131
|
+
[U, ve, Be, a, V, ht, L, At]
|
|
3077
3132
|
);
|
|
3078
|
-
const
|
|
3079
|
-
|
|
3080
|
-
Xr,
|
|
3133
|
+
const Rr = V.getTotal() + N.top + N.bottom, dr = /* @__PURE__ */ ie(
|
|
3134
|
+
en,
|
|
3081
3135
|
{
|
|
3082
|
-
ref:
|
|
3083
|
-
contentSize:
|
|
3136
|
+
ref: j,
|
|
3137
|
+
contentSize: Rr,
|
|
3084
3138
|
viewportSize: i,
|
|
3085
|
-
onViewportSizeChange:
|
|
3086
|
-
className:
|
|
3087
|
-
testId:
|
|
3088
|
-
onScroll:
|
|
3089
|
-
background:
|
|
3090
|
-
tapScrollCircleOptions:
|
|
3091
|
-
inertiaOptions:
|
|
3092
|
-
overscrollBehavior:
|
|
3139
|
+
onViewportSizeChange: Se,
|
|
3140
|
+
className: l,
|
|
3141
|
+
testId: d,
|
|
3142
|
+
onScroll: He,
|
|
3143
|
+
background: T,
|
|
3144
|
+
tapScrollCircleOptions: fe,
|
|
3145
|
+
inertiaOptions: Ve,
|
|
3146
|
+
overscrollBehavior: Fe,
|
|
3093
3147
|
itemCount: r,
|
|
3094
|
-
scrollBarWidth:
|
|
3095
|
-
enableThumbDrag:
|
|
3096
|
-
enableTrackClick:
|
|
3097
|
-
enableArrowButtons:
|
|
3098
|
-
enablePointerDrag:
|
|
3099
|
-
pointerDragInputs:
|
|
3100
|
-
renderThumbOverlay:
|
|
3101
|
-
wheelSpeedMultiplier:
|
|
3102
|
-
onWheelHorizontal:
|
|
3148
|
+
scrollBarWidth: Q,
|
|
3149
|
+
enableThumbDrag: K,
|
|
3150
|
+
enableTrackClick: he,
|
|
3151
|
+
enableArrowButtons: A,
|
|
3152
|
+
enablePointerDrag: $e,
|
|
3153
|
+
pointerDragInputs: Ue,
|
|
3154
|
+
renderThumbOverlay: G,
|
|
3155
|
+
wheelSpeedMultiplier: We,
|
|
3156
|
+
onWheelHorizontal: oe,
|
|
3103
3157
|
contentInsets: N,
|
|
3104
|
-
contentProps:
|
|
3105
|
-
visibleStartIndex:
|
|
3106
|
-
visibleEndIndex:
|
|
3107
|
-
renderOverlay:
|
|
3108
|
-
initialScrollPosition:
|
|
3109
|
-
children:
|
|
3158
|
+
contentProps: Y,
|
|
3159
|
+
visibleStartIndex: vt,
|
|
3160
|
+
visibleEndIndex: Rt,
|
|
3161
|
+
renderOverlay: Mr,
|
|
3162
|
+
initialScrollPosition: ot.position,
|
|
3163
|
+
children: Pr
|
|
3110
3164
|
}
|
|
3111
3165
|
);
|
|
3112
|
-
|
|
3166
|
+
return Lt ? /* @__PURE__ */ Tt(rr, { children: [
|
|
3167
|
+
dr,
|
|
3168
|
+
/* @__PURE__ */ ie("div", { className: "aqvs-live-region", role: "status", "aria-live": "polite", "aria-atomic": "true", "data-aqvs-live-region": "", children: yr })
|
|
3169
|
+
] }) : dr;
|
|
3170
|
+
}, Sn = nr(mn);
|
|
3113
3171
|
export {
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3172
|
+
St as FenwickMapTree,
|
|
3173
|
+
Kr as ScrollBar,
|
|
3174
|
+
en as ScrollPane,
|
|
3175
|
+
Tr as TAP_SCROLL_SPEED_DEFAULTS,
|
|
3176
|
+
Sn as VirtualScroll,
|
|
3177
|
+
Wr as computeAutoTapScrollMaxSpeedMultiplier,
|
|
3178
|
+
Ur as computeTapScrollSpeed,
|
|
3179
|
+
bn as createResidualQuantizer,
|
|
3180
|
+
se as minmax,
|
|
3181
|
+
xn as tapScrollCircleSampleVisual,
|
|
3182
|
+
nn as useFenwickMapTree,
|
|
3183
|
+
vn as useHeightCache,
|
|
3184
|
+
on as useLruCache,
|
|
3185
|
+
In as useWheelBridge
|
|
3127
3186
|
};
|