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