@aiquants/virtualscroll 1.20.0 → 1.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +73 -0
- package/README.md +5 -3
- package/dist/ScrollBar.d.cts +123 -0
- package/dist/ScrollBar.d.ts +123 -0
- package/dist/ScrollBar.d.ts.map +1 -1
- package/dist/ScrollPane.d.cts +16 -0
- package/dist/ScrollPane.d.ts +16 -0
- package/dist/ScrollPane.d.ts.map +1 -1
- package/dist/VirtualScroll.d.cts +9 -0
- package/dist/VirtualScroll.d.ts +9 -0
- package/dist/VirtualScroll.d.ts.map +1 -1
- package/dist/_headFenwick.d.cts +450 -0
- package/dist/_headFenwick.d.ts +451 -0
- package/dist/_headFenwick.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1468 -1360
- package/dist/styles/virtualscroll.css +1 -1
- package/dist/styles/virtualscroll.standalone.css +1 -1
- package/dist/tapScrollCircleSampleVisual.d.ts.map +1 -1
- package/dist/useFenwickMapTree.d.cts +43 -0
- package/dist/useFenwickMapTree.d.ts +43 -0
- package/dist/useFenwickMapTree.d.ts.map +1 -1
- package/package.json +4 -1
- package/src/ScrollBar.tsx +211 -33
- package/src/ScrollPane.tsx +232 -19
- package/src/VirtualScroll.tsx +11 -1
- package/src/index.ts +1 -1
- package/src/styles/virtualscroll.css +3 -3
- package/src/tapScrollCircleSampleVisual.tsx +22 -5
- package/src/useFenwickMapTree.ts +95 -13
- package/src/ScrollBar.spec.tsx +0 -620
- package/src/ScrollPane.spec.tsx +0 -496
- package/src/TapScrollCircle.spec.tsx +0 -275
- package/src/VirtualScroll.spec.ts +0 -641
- package/src/cli.server.spec.ts +0 -137
- package/src/logger.spec.ts +0 -128
- package/src/useFenwickMapTree.huge.spec.ts +0 -388
- package/src/useFenwickMapTree.spec.ts +0 -1518
- package/src/useLruCache.spec.ts +0 -382
- package/src/utils.spec.ts +0 -39
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
1
|
+
import { jsx as st, jsxs as ue, Fragment as je } from "react/jsx-runtime";
|
|
2
|
+
import Je, { memo as Qe, forwardRef as Ye, useState as Zt, useRef as T, useCallback as S, useImperativeHandle as Be, useMemo as At, useLayoutEffect as be, useEffect as Y, useId as tr } from "react";
|
|
3
3
|
import { twMerge as ce } from "tailwind-merge";
|
|
4
|
-
class
|
|
4
|
+
class C {
|
|
5
5
|
level;
|
|
6
6
|
prefix;
|
|
7
7
|
impl;
|
|
@@ -14,7 +14,7 @@ class N {
|
|
|
14
14
|
constructor(t = 2, e = "[virtualscroll]", r = console) {
|
|
15
15
|
this.level = t, this.prefix = e, this.impl = r;
|
|
16
16
|
}
|
|
17
|
-
static instance = new
|
|
17
|
+
static instance = new C(2, "[virtualscroll]");
|
|
18
18
|
/**
|
|
19
19
|
* @method setLevel
|
|
20
20
|
* @description Updates the current log level for the static instance.
|
|
@@ -22,7 +22,7 @@ class N {
|
|
|
22
22
|
* @param {LogLevel} level - The new log level.
|
|
23
23
|
*/
|
|
24
24
|
static setLevel(t) {
|
|
25
|
-
|
|
25
|
+
C.instance.setLevel(t);
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* @method setLevel
|
|
@@ -40,7 +40,7 @@ class N {
|
|
|
40
40
|
* @param {ILogger} impl - The new logger implementation.
|
|
41
41
|
*/
|
|
42
42
|
static setImplementation(t) {
|
|
43
|
-
|
|
43
|
+
C.instance.setImplementation(t);
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* @method setImplementation
|
|
@@ -58,7 +58,7 @@ class N {
|
|
|
58
58
|
* @param {string} prefix - The new prefix.
|
|
59
59
|
*/
|
|
60
60
|
static setPrefix(t) {
|
|
61
|
-
|
|
61
|
+
C.instance.setPrefix(t);
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* @method setPrefix
|
|
@@ -77,7 +77,7 @@ class N {
|
|
|
77
77
|
* @returns {boolean} True if a message at `level` would be emitted. / `level` のメッセージが出力されるなら true。
|
|
78
78
|
*/
|
|
79
79
|
static isEnabled(t) {
|
|
80
|
-
return
|
|
80
|
+
return C.instance.isEnabled(t);
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* @method isEnabled
|
|
@@ -122,41 +122,41 @@ class N {
|
|
|
122
122
|
return typeof t == "string" ? [`${this.prefix} ${t}`] : [this.prefix, t];
|
|
123
123
|
}
|
|
124
124
|
static debug(t, ...e) {
|
|
125
|
-
|
|
125
|
+
C.instance.debug(t, ...e);
|
|
126
126
|
}
|
|
127
127
|
debug(t, ...e) {
|
|
128
|
-
this.level <= 0 && this.impl.debug(...this.formatMessage(
|
|
128
|
+
this.level <= 0 && this.impl.debug(...this.formatMessage(C.resolveLazy(t)), ...e.map(C.resolveLazy));
|
|
129
129
|
}
|
|
130
130
|
static info(t, ...e) {
|
|
131
|
-
|
|
131
|
+
C.instance.info(t, ...e);
|
|
132
132
|
}
|
|
133
133
|
info(t, ...e) {
|
|
134
|
-
this.level <= 1 && this.impl.info(...this.formatMessage(
|
|
134
|
+
this.level <= 1 && this.impl.info(...this.formatMessage(C.resolveLazy(t)), ...e.map(C.resolveLazy));
|
|
135
135
|
}
|
|
136
136
|
static warn(t, ...e) {
|
|
137
|
-
|
|
137
|
+
C.instance.warn(t, ...e);
|
|
138
138
|
}
|
|
139
139
|
warn(t, ...e) {
|
|
140
|
-
this.level <= 2 && this.impl.warn(...this.formatMessage(
|
|
140
|
+
this.level <= 2 && this.impl.warn(...this.formatMessage(C.resolveLazy(t)), ...e.map(C.resolveLazy));
|
|
141
141
|
}
|
|
142
142
|
static error(t, ...e) {
|
|
143
|
-
|
|
143
|
+
C.instance.error(t, ...e);
|
|
144
144
|
}
|
|
145
145
|
error(t, ...e) {
|
|
146
|
-
this.level <= 3 && this.impl.error(...this.formatMessage(
|
|
146
|
+
this.level <= 3 && this.impl.error(...this.formatMessage(C.resolveLazy(t)), ...e.map(C.resolveLazy));
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
const
|
|
149
|
+
const qe = {
|
|
150
150
|
active: !1,
|
|
151
151
|
offsetX: 0,
|
|
152
152
|
offsetY: 0,
|
|
153
153
|
distance: 0,
|
|
154
154
|
direction: 0,
|
|
155
155
|
pointerId: null
|
|
156
|
-
},
|
|
157
|
-
const e = 1 + t * 0.18, r = 0.16 + t * 0.24,
|
|
158
|
-
return /* @__PURE__ */ ue(
|
|
159
|
-
/* @__PURE__ */
|
|
156
|
+
}, Le = 6, er = 8, rr = ({ dragState: n, normalizedDistance: t }) => {
|
|
157
|
+
const e = 1 + t * 0.18, r = 0.16 + t * 0.24, i = 0.38 + t * 0.28, s = n.active ? "80ms ease-out" : "220ms ease";
|
|
158
|
+
return /* @__PURE__ */ ue(je, { children: [
|
|
159
|
+
/* @__PURE__ */ st(
|
|
160
160
|
"div",
|
|
161
161
|
{
|
|
162
162
|
className: "aqvs-tap-scroll-circle-visual-outer",
|
|
@@ -164,166 +164,171 @@ const Ye = {
|
|
|
164
164
|
background: "linear-gradient(140deg, rgba(255,255,255,0.62), rgba(72,72,72,0.48))",
|
|
165
165
|
boxShadow: `0 0 0 1px rgba(255,255,255,0.28), 0 10px 22px rgba(0,0,0,${r})`,
|
|
166
166
|
transform: `scale(${e})`,
|
|
167
|
-
transition: `${s}, ${
|
|
167
|
+
transition: `${s}, ${n.active ? "80ms" : "260ms"} box-shadow ease`
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
),
|
|
171
|
-
/* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ st(
|
|
172
172
|
"div",
|
|
173
173
|
{
|
|
174
174
|
className: "aqvs-tap-scroll-circle-inner",
|
|
175
175
|
style: {
|
|
176
176
|
background: "linear-gradient(140deg, rgba(255,255,255,0.72), rgba(28,28,28,0.58))",
|
|
177
177
|
boxShadow: "inset 0 4px 10px rgba(0,0,0,0.24), inset 0 0 2px rgba(255,255,255,0.55)",
|
|
178
|
-
opacity:
|
|
179
|
-
transition:
|
|
178
|
+
opacity: i,
|
|
179
|
+
transition: n.active ? "120ms opacity ease-out" : "220ms opacity ease"
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
)
|
|
183
183
|
] });
|
|
184
|
-
},
|
|
185
|
-
|
|
186
|
-
const [
|
|
187
|
-
(
|
|
188
|
-
x(
|
|
184
|
+
}, Ge = Qe(
|
|
185
|
+
Ye(({ onDragChange: n, className: t, maxVisualDistance: e = 160, size: r = 40, style: i, opacity: s = 1, renderVisual: l }, c) => {
|
|
186
|
+
const [d, x] = Zt(qe), I = T(null), M = T(null), E = T({ x: 0, y: 0 }), h = T(null), _ = T(0), z = S(
|
|
187
|
+
(p) => {
|
|
188
|
+
x(p), n(p);
|
|
189
189
|
},
|
|
190
|
-
[
|
|
191
|
-
),
|
|
192
|
-
(
|
|
193
|
-
const { x:
|
|
194
|
-
let
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
active:
|
|
198
|
-
offsetX:
|
|
199
|
-
offsetY:
|
|
200
|
-
distance:
|
|
201
|
-
direction:
|
|
190
|
+
[n]
|
|
191
|
+
), j = S(
|
|
192
|
+
(p, $, St = !1) => {
|
|
193
|
+
const { x: Rt, y: Z } = E.current, k = p - Rt, Ct = $ - Z, U = Math.abs(Ct), Et = U < Le ? 0 : Ct < 0 ? -1 : 1, y = _.current;
|
|
194
|
+
let Yt = Et;
|
|
195
|
+
const Ht = Le + er;
|
|
196
|
+
Et === 0 ? y !== 0 && U < Ht ? Yt = y : (Yt = 0, St || (_.current = 0)) : Et !== y && y !== 0 && U < Ht ? Yt = y : _.current = Et, z({
|
|
197
|
+
active: St || U >= Le,
|
|
198
|
+
offsetX: k,
|
|
199
|
+
offsetY: Ct,
|
|
200
|
+
distance: U,
|
|
201
|
+
direction: Yt,
|
|
202
202
|
pointerId: I.current
|
|
203
203
|
});
|
|
204
204
|
},
|
|
205
|
-
[
|
|
206
|
-
),
|
|
207
|
-
if (
|
|
205
|
+
[z]
|
|
206
|
+
), ut = S((p) => {
|
|
207
|
+
if (p === null)
|
|
208
208
|
return;
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
}, []),
|
|
212
|
-
(
|
|
213
|
-
|
|
209
|
+
const $ = h.current;
|
|
210
|
+
$?.hasPointerCapture(p) && $.releasePointerCapture(p);
|
|
211
|
+
}, []), Q = S(
|
|
212
|
+
(p = !1) => {
|
|
213
|
+
p && ut(I.current), I.current = null, M.current = null, _.current = 0, z(qe);
|
|
214
214
|
},
|
|
215
|
-
[
|
|
216
|
-
),
|
|
217
|
-
(
|
|
218
|
-
if (I.current !== null && I.current !==
|
|
219
|
-
M.current = { pointerId:
|
|
215
|
+
[z, ut]
|
|
216
|
+
), tt = S(
|
|
217
|
+
(p) => {
|
|
218
|
+
if (I.current !== null && I.current !== p.pointerId) {
|
|
219
|
+
M.current = { pointerId: p.pointerId, clientX: p.clientX, clientY: p.clientY }, p.preventDefault(), p.stopPropagation();
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
222
|
-
|
|
223
|
-
const
|
|
224
|
-
|
|
222
|
+
p.preventDefault(), p.stopPropagation();
|
|
223
|
+
const $ = h.current ?? p.currentTarget, { left: St, top: Rt, width: Z, height: k } = $.getBoundingClientRect();
|
|
224
|
+
E.current = { x: St + Z / 2, y: Rt + k / 2 }, I.current = p.pointerId;
|
|
225
225
|
try {
|
|
226
|
-
|
|
226
|
+
$.setPointerCapture(p.pointerId);
|
|
227
227
|
} catch {
|
|
228
228
|
}
|
|
229
|
-
|
|
229
|
+
j(p.clientX, p.clientY, !0);
|
|
230
230
|
},
|
|
231
|
-
[
|
|
232
|
-
),
|
|
233
|
-
(
|
|
234
|
-
if (I.current !==
|
|
235
|
-
M.current !== null && M.current.pointerId ===
|
|
231
|
+
[j]
|
|
232
|
+
), mt = S(
|
|
233
|
+
(p) => {
|
|
234
|
+
if (I.current !== p.pointerId) {
|
|
235
|
+
M.current !== null && M.current.pointerId === p.pointerId && (M.current = { pointerId: p.pointerId, clientX: p.clientX, clientY: p.clientY });
|
|
236
236
|
return;
|
|
237
237
|
}
|
|
238
|
-
|
|
238
|
+
p.preventDefault(), j(p.clientX, p.clientY);
|
|
239
239
|
},
|
|
240
|
-
[
|
|
241
|
-
),
|
|
242
|
-
(
|
|
243
|
-
if (I.current !==
|
|
244
|
-
M.current !== null && M.current.pointerId ===
|
|
240
|
+
[j]
|
|
241
|
+
), Tt = S(
|
|
242
|
+
(p) => {
|
|
243
|
+
if (I.current !== p.pointerId) {
|
|
244
|
+
M.current !== null && M.current.pointerId === p.pointerId && (M.current = null);
|
|
245
245
|
return;
|
|
246
246
|
}
|
|
247
|
-
|
|
248
|
-
const
|
|
249
|
-
if (M.current = null,
|
|
250
|
-
|
|
251
|
-
const
|
|
252
|
-
let
|
|
253
|
-
if (
|
|
247
|
+
p.preventDefault(), p.stopPropagation();
|
|
248
|
+
const $ = M.current;
|
|
249
|
+
if (M.current = null, $ !== null) {
|
|
250
|
+
ut(p.pointerId);
|
|
251
|
+
const St = h.current;
|
|
252
|
+
let Rt = !0;
|
|
253
|
+
if (St !== null && typeof St.setPointerCapture == "function")
|
|
254
254
|
try {
|
|
255
|
-
|
|
256
|
-
} catch (
|
|
257
|
-
(typeof
|
|
255
|
+
St.setPointerCapture($.pointerId);
|
|
256
|
+
} catch (Z) {
|
|
257
|
+
(typeof Z == "object" && Z !== null && "name" in Z ? Z.name : void 0) === "NotFoundError" && (Rt = !1);
|
|
258
258
|
}
|
|
259
|
-
if (
|
|
260
|
-
I.current =
|
|
259
|
+
if (Rt) {
|
|
260
|
+
I.current = $.pointerId, j($.clientX, $.clientY, !0);
|
|
261
261
|
return;
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
|
-
|
|
264
|
+
Q(!0);
|
|
265
265
|
},
|
|
266
|
-
[
|
|
267
|
-
),
|
|
268
|
-
(
|
|
269
|
-
I.current ===
|
|
266
|
+
[Q, ut, j]
|
|
267
|
+
), D = S(
|
|
268
|
+
(p) => {
|
|
269
|
+
I.current === p.pointerId && Q(!1);
|
|
270
270
|
},
|
|
271
|
-
[
|
|
271
|
+
[Q]
|
|
272
272
|
);
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
Be(
|
|
274
|
+
c,
|
|
275
275
|
() => ({
|
|
276
276
|
reset: () => {
|
|
277
|
-
|
|
277
|
+
Q(!0);
|
|
278
278
|
},
|
|
279
|
-
getElement: () =>
|
|
279
|
+
getElement: () => h.current
|
|
280
280
|
}),
|
|
281
|
-
[
|
|
281
|
+
[Q]
|
|
282
282
|
);
|
|
283
|
-
const
|
|
284
|
-
dragState:
|
|
285
|
-
normalizedDistance:
|
|
286
|
-
sizeScale:
|
|
283
|
+
const O = Math.min(Math.max(s, 0), 1), P = r / 64, B = Math.min(d.distance, e) / e, N = d.direction * B * 10 * P, q = l ?? rr, et = {
|
|
284
|
+
dragState: d,
|
|
285
|
+
normalizedDistance: B,
|
|
286
|
+
sizeScale: P,
|
|
287
287
|
size: r,
|
|
288
|
-
opacity:
|
|
289
|
-
},
|
|
290
|
-
...
|
|
288
|
+
opacity: O
|
|
289
|
+
}, G = {
|
|
290
|
+
...i,
|
|
291
291
|
width: r,
|
|
292
292
|
height: r,
|
|
293
|
-
transform: `translateY(${
|
|
293
|
+
transform: `translateY(${N}px)`
|
|
294
294
|
};
|
|
295
|
-
return
|
|
295
|
+
return G.opacity = O, /* @__PURE__ */ st(
|
|
296
296
|
"div",
|
|
297
297
|
{
|
|
298
|
-
ref:
|
|
298
|
+
ref: h,
|
|
299
299
|
"data-testid": "virtual-scroll-tap-circle",
|
|
300
300
|
className: ce("aqvs-tap-scroll-circle", t),
|
|
301
|
-
style:
|
|
301
|
+
style: G,
|
|
302
302
|
tabIndex: -1,
|
|
303
|
-
onPointerDown:
|
|
304
|
-
onPointerMove:
|
|
305
|
-
onPointerUp:
|
|
306
|
-
onPointerCancel:
|
|
307
|
-
onLostPointerCapture:
|
|
303
|
+
onPointerDown: tt,
|
|
304
|
+
onPointerMove: mt,
|
|
305
|
+
onPointerUp: Tt,
|
|
306
|
+
onPointerCancel: Tt,
|
|
307
|
+
onLostPointerCapture: D,
|
|
308
308
|
role: "presentation",
|
|
309
|
-
children:
|
|
309
|
+
children: q(et)
|
|
310
310
|
}
|
|
311
311
|
);
|
|
312
312
|
})
|
|
313
313
|
);
|
|
314
|
-
|
|
315
|
-
const
|
|
314
|
+
Ge.displayName = "TapScrollCircle";
|
|
315
|
+
const It = (n, t, e) => Math.max(t, Math.min(e, n)), ze = "virtualscroll:tap-scroll-cancel", He = 20, nr = 250, ir = 60, sr = 20, or = 20, Ze = {
|
|
316
|
+
/** 速度が最大に達する引き距離 (px)。`maxVisualDistance` の既定値。 */
|
|
317
|
+
maxDistance: 240,
|
|
318
|
+
/** 最小速度倍率 (ビューポート比)。 */
|
|
319
|
+
minSpeedMultiplier: 0.2
|
|
320
|
+
}, ar = Ze.maxDistance, Xe = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, _e = 2.2, lr = 8, cr = 120, ur = 1 / 10, Gt = {
|
|
316
321
|
enabled: !0,
|
|
317
322
|
size: 40,
|
|
318
323
|
offsetX: -80,
|
|
319
324
|
offsetY: 0,
|
|
320
325
|
className: void 0,
|
|
321
|
-
maxVisualDistance:
|
|
322
|
-
minSpeedMultiplier:
|
|
326
|
+
maxVisualDistance: ar,
|
|
327
|
+
minSpeedMultiplier: Ze.minSpeedMultiplier,
|
|
323
328
|
opacity: 0.9,
|
|
324
329
|
renderVisual: void 0,
|
|
325
330
|
maxSpeedCurve: void 0
|
|
326
|
-
},
|
|
331
|
+
}, dr = (n) => n ? {
|
|
327
332
|
mainSizeKey: "width",
|
|
328
333
|
crossSizeKey: "height",
|
|
329
334
|
positionKey: "left",
|
|
@@ -343,327 +348,345 @@ const pt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
343
348
|
arrowIcons: ["▲", "▼"],
|
|
344
349
|
directionClass: "aqvs-scrollbar-vertical",
|
|
345
350
|
orientation: "vertical"
|
|
346
|
-
},
|
|
347
|
-
const e =
|
|
351
|
+
}, fr = (n, t) => {
|
|
352
|
+
const e = n?.maxSpeedMultiplier, r = typeof e == "number" ? e : br(t);
|
|
348
353
|
return {
|
|
349
|
-
enabled:
|
|
350
|
-
size:
|
|
351
|
-
offsetX:
|
|
352
|
-
offsetY:
|
|
353
|
-
className:
|
|
354
|
-
maxVisualDistance:
|
|
354
|
+
enabled: n?.enabled ?? Gt.enabled,
|
|
355
|
+
size: n?.size ?? Gt.size,
|
|
356
|
+
offsetX: n?.offsetX ?? Gt.offsetX,
|
|
357
|
+
offsetY: n?.offsetY ?? Gt.offsetY,
|
|
358
|
+
className: n?.className ?? Gt.className,
|
|
359
|
+
maxVisualDistance: n?.maxVisualDistance ?? Gt.maxVisualDistance,
|
|
355
360
|
maxSpeedMultiplier: r,
|
|
356
|
-
minSpeedMultiplier: Math.max(
|
|
357
|
-
opacity:
|
|
358
|
-
renderVisual:
|
|
359
|
-
maxSpeedCurve:
|
|
361
|
+
minSpeedMultiplier: Math.max(n?.minSpeedMultiplier ?? Gt.minSpeedMultiplier, 0),
|
|
362
|
+
opacity: It(n?.opacity ?? Gt.opacity, 0, 1),
|
|
363
|
+
renderVisual: n?.renderVisual ?? Gt.renderVisual,
|
|
364
|
+
maxSpeedCurve: n?.maxSpeedCurve ?? Gt.maxSpeedCurve
|
|
360
365
|
};
|
|
361
|
-
},
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
}, []),
|
|
365
|
-
|
|
366
|
-
}, [
|
|
367
|
-
(M) => (
|
|
368
|
-
if (!
|
|
366
|
+
}, mr = ({ isDragging: n, isThumbHovered: t, enableThumbDrag: e }) => At(() => e ? n ? "dragging" : t ? "hover" : "idle" : "disabled", [e, n, t]), pr = ({ canUseArrowButtons: n, enableArrowButtons: t, resetTapScroll: e, scrollByStep: r }) => {
|
|
367
|
+
const i = T(null), s = T(null), l = T(null), c = S(() => {
|
|
368
|
+
i.current !== null && (window.clearInterval(i.current), i.current = null), s.current !== null && (window.clearTimeout(s.current), s.current = null), l.current !== null && (window.removeEventListener("pointerup", l.current), window.removeEventListener("pointercancel", l.current), window.removeEventListener("blur", l.current), l.current = null);
|
|
369
|
+
}, []), d = S(() => {
|
|
370
|
+
c();
|
|
371
|
+
}, [c]), x = S(
|
|
372
|
+
(M) => (E) => {
|
|
373
|
+
if (!n)
|
|
369
374
|
return;
|
|
370
|
-
|
|
371
|
-
|
|
375
|
+
E.cancelable && E.preventDefault(), E.stopPropagation(), e(), c(), r(M), s.current = window.setTimeout(() => {
|
|
376
|
+
i.current = window.setInterval(() => {
|
|
372
377
|
r(M);
|
|
373
|
-
},
|
|
374
|
-
},
|
|
375
|
-
const
|
|
376
|
-
l.current =
|
|
378
|
+
}, ir);
|
|
379
|
+
}, nr);
|
|
380
|
+
const h = () => c();
|
|
381
|
+
l.current = h, window.addEventListener("pointerup", h), window.addEventListener("pointercancel", h), window.addEventListener("blur", h);
|
|
377
382
|
},
|
|
378
|
-
[
|
|
383
|
+
[n, c, e, r]
|
|
379
384
|
), I = S(
|
|
380
|
-
(M) => (
|
|
381
|
-
t && (
|
|
385
|
+
(M) => (E) => {
|
|
386
|
+
t && (E.key === "Enter" || E.key === " " || E.key === "Spacebar") && (E.preventDefault(), r(M));
|
|
382
387
|
},
|
|
383
388
|
[t, r]
|
|
384
389
|
);
|
|
385
|
-
return
|
|
386
|
-
|
|
387
|
-
}, [
|
|
388
|
-
|
|
389
|
-
}, [
|
|
390
|
-
}, gr = (i) => {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
390
|
+
return Y(() => {
|
|
391
|
+
n || c();
|
|
392
|
+
}, [n, c]), Y(() => () => {
|
|
393
|
+
c();
|
|
394
|
+
}, [c]), { handleArrowPointerDown: x, handleArrowPointerUp: d, handleArrowKeyDown: I };
|
|
395
|
+
}, hr = 700, ae = (n, t) => typeof n == "number" && Number.isFinite(n) ? n : t, gr = ({ distance: n, maxDistance: t, viewportSize: e, minSpeedMultiplier: r, maxSpeedMultiplier: i, hasCustomMaxSpeedMultiplier: s, curve: l }) => {
|
|
396
|
+
const c = Math.max(ae(n, 0), 0), d = ae(t, 0), x = d > 0 ? Math.min(c, d) / d : 1, I = Math.max(ae(e, 0), 0), M = Math.max(ae(r, 0), 0), E = Math.max(ae(i, 0), 0), h = Math.max(I * M, 40), _ = s ? h : 1200, z = Math.max(I * E, _), j = l ? Math.max(ae(l.exponentialScale, E), 0) : 0, ut = l ? Math.min(z, Math.max(I * j, h)) : z, Q = Math.max(ut, h);
|
|
397
|
+
let tt = x ** 1.1;
|
|
398
|
+
if (l) {
|
|
399
|
+
const Tt = Math.min(Math.max(ae(l.exponentialSteepness, 0), 0), hr);
|
|
400
|
+
if (Tt === 0)
|
|
401
|
+
tt = x;
|
|
402
|
+
else {
|
|
403
|
+
const D = Math.expm1(Tt) || 1;
|
|
404
|
+
tt = Math.min(Math.max(Math.expm1(Tt * x) / D, 0), 1);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
const mt = Math.min(Math.max(ae(l?.easedOffset, 0), 0), 1);
|
|
408
|
+
return h + (Q - h) * (mt + (1 - mt) * tt);
|
|
409
|
+
}, br = (n) => {
|
|
410
|
+
if (!n || n <= 0)
|
|
411
|
+
return _e;
|
|
412
|
+
const t = Math.max(1, n), e = Math.log10(t), r = _e + e * lr;
|
|
413
|
+
return It(r, _e, cr);
|
|
414
|
+
}, xr = ({
|
|
415
|
+
contentSize: n,
|
|
397
416
|
viewportSize: t,
|
|
398
417
|
scrollPosition: e,
|
|
399
418
|
onScroll: r,
|
|
400
|
-
enableThumbDrag:
|
|
419
|
+
enableThumbDrag: i = !0,
|
|
401
420
|
enableTrackClick: s = !0,
|
|
402
421
|
enableArrowButtons: l = !0,
|
|
403
|
-
horizontal:
|
|
404
|
-
scrollBarWidth:
|
|
422
|
+
horizontal: c = !1,
|
|
423
|
+
scrollBarWidth: d = 12,
|
|
405
424
|
className: x,
|
|
406
425
|
ariaControls: I,
|
|
407
426
|
tapScrollCircleOptions: M,
|
|
408
|
-
itemCount:
|
|
409
|
-
renderThumbOverlay:
|
|
410
|
-
visibleStartIndex:
|
|
411
|
-
visibleEndIndex:
|
|
427
|
+
itemCount: E,
|
|
428
|
+
renderThumbOverlay: h,
|
|
429
|
+
visibleStartIndex: _,
|
|
430
|
+
visibleEndIndex: z
|
|
412
431
|
}) => {
|
|
413
|
-
const [
|
|
432
|
+
const [j, ut] = Zt(!1), [Q, tt] = Zt(!1), [mt, Tt] = Zt(!1), D = T(null), O = T({
|
|
414
433
|
pointerId: null,
|
|
415
434
|
startThumbPosition: 0,
|
|
416
435
|
startClientX: 0,
|
|
417
436
|
startClientY: 0,
|
|
418
437
|
scale: 1,
|
|
419
438
|
captureTarget: null
|
|
420
|
-
}),
|
|
421
|
-
enabled:
|
|
422
|
-
size:
|
|
423
|
-
offsetX:
|
|
424
|
-
offsetY:
|
|
425
|
-
className:
|
|
426
|
-
maxVisualDistance:
|
|
427
|
-
maxSpeedMultiplier:
|
|
428
|
-
minSpeedMultiplier:
|
|
429
|
-
opacity:
|
|
430
|
-
renderVisual:
|
|
431
|
-
maxSpeedCurve:
|
|
432
|
-
} =
|
|
439
|
+
}), P = T({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 }), B = T(e), N = T(r), q = T(Xe), et = T(null), G = T(null), p = T(null), $ = T(0), St = T(0), Rt = At(() => fr(M, E), [E, M]), Z = At(() => dr(c), [c]), {
|
|
440
|
+
enabled: k,
|
|
441
|
+
size: Ct,
|
|
442
|
+
offsetX: U,
|
|
443
|
+
offsetY: Et,
|
|
444
|
+
className: y,
|
|
445
|
+
maxVisualDistance: Yt,
|
|
446
|
+
maxSpeedMultiplier: Ht,
|
|
447
|
+
minSpeedMultiplier: v,
|
|
448
|
+
opacity: Xt,
|
|
449
|
+
renderVisual: Bt,
|
|
450
|
+
maxSpeedCurve: Jt
|
|
451
|
+
} = Rt, at = T({
|
|
433
452
|
viewportSize: t,
|
|
434
|
-
maxScrollPosition: Math.max(
|
|
435
|
-
scrollBarVisible:
|
|
436
|
-
effectiveTapMaxDistance: Math.max(
|
|
437
|
-
tapCircleMaxSpeedMultiplier:
|
|
438
|
-
tapCircleMinSpeedMultiplier:
|
|
439
|
-
tapCircleMaxSpeedCurve:
|
|
453
|
+
maxScrollPosition: Math.max(n - t, 0),
|
|
454
|
+
scrollBarVisible: n > t,
|
|
455
|
+
effectiveTapMaxDistance: Math.max(Yt, 1),
|
|
456
|
+
tapCircleMaxSpeedMultiplier: Ht,
|
|
457
|
+
tapCircleMinSpeedMultiplier: v,
|
|
458
|
+
tapCircleMaxSpeedCurve: Jt,
|
|
440
459
|
tapScrollCircleOptions: M,
|
|
441
460
|
effectiveTrackLength: 0,
|
|
442
461
|
onScroll: r,
|
|
443
462
|
scrollPosition: e
|
|
444
|
-
}), { mainSizeKey:
|
|
463
|
+
}), { mainSizeKey: jt, crossSizeKey: f, positionKey: dt, selectDelta: lt, getPointerCoordinate: H, arrowLabels: it, arrowIcons: J, directionClass: yt, orientation: wt } = Z, Nt = Math.max(Yt, 1), rt = t / n, Dt = Math.max(t - d * 2, 0), Mt = rt * Dt, ft = Math.min(Math.max(He, Mt || 0), Dt || He), ot = n - t, Lt = Math.max(Dt - ft, 0), $t = ot <= 0 || Lt <= 0 ? 0 : It(e / ot * Lt, 0, Lt), Qt = $t + ft / 2, ct = n > t || j, g = ct && l;
|
|
445
464
|
be(() => {
|
|
446
|
-
|
|
465
|
+
at.current = {
|
|
447
466
|
viewportSize: t,
|
|
448
|
-
maxScrollPosition:
|
|
449
|
-
scrollBarVisible:
|
|
450
|
-
effectiveTapMaxDistance:
|
|
451
|
-
tapCircleMaxSpeedMultiplier:
|
|
452
|
-
tapCircleMinSpeedMultiplier:
|
|
453
|
-
tapCircleMaxSpeedCurve:
|
|
467
|
+
maxScrollPosition: ot,
|
|
468
|
+
scrollBarVisible: ct,
|
|
469
|
+
effectiveTapMaxDistance: Nt,
|
|
470
|
+
tapCircleMaxSpeedMultiplier: Ht,
|
|
471
|
+
tapCircleMinSpeedMultiplier: v,
|
|
472
|
+
tapCircleMaxSpeedCurve: Jt,
|
|
454
473
|
tapScrollCircleOptions: M,
|
|
455
|
-
effectiveTrackLength:
|
|
474
|
+
effectiveTrackLength: Lt,
|
|
456
475
|
onScroll: r,
|
|
457
476
|
scrollPosition: e
|
|
458
477
|
};
|
|
459
478
|
}), be(() => {
|
|
460
|
-
|
|
479
|
+
B.current = e;
|
|
461
480
|
}, [e]), be(() => {
|
|
462
|
-
|
|
463
|
-
}, [r]),
|
|
464
|
-
|
|
465
|
-
}, [
|
|
466
|
-
const
|
|
467
|
-
const
|
|
468
|
-
if (
|
|
469
|
-
const
|
|
470
|
-
if (typeof
|
|
471
|
-
return
|
|
481
|
+
N.current = r;
|
|
482
|
+
}, [r]), Y(() => {
|
|
483
|
+
i || tt(!1);
|
|
484
|
+
}, [i]);
|
|
485
|
+
const w = mr({ isDragging: j, isThumbHovered: Q, enableThumbDrag: i }), bt = S((a, b) => {
|
|
486
|
+
const R = at.current, L = b ?? B.current;
|
|
487
|
+
if (N.current) {
|
|
488
|
+
const m = N.current(a, L);
|
|
489
|
+
if (typeof m == "number" && Number.isFinite(m))
|
|
490
|
+
return B.current = m, m;
|
|
472
491
|
}
|
|
473
|
-
const
|
|
474
|
-
return
|
|
475
|
-
}, []),
|
|
492
|
+
const X = typeof a == "function" ? a(L) : a, o = Math.max(R.maxScrollPosition, 0), u = R.scrollBarVisible ? It(X, 0, o) : 0;
|
|
493
|
+
return B.current = u, u;
|
|
494
|
+
}, []), qt = S(
|
|
476
495
|
(a) => {
|
|
477
|
-
const
|
|
478
|
-
if (!
|
|
479
|
-
const
|
|
480
|
-
return { nextPosition:
|
|
496
|
+
const b = at.current, R = B.current;
|
|
497
|
+
if (!b.scrollBarVisible || b.maxScrollPosition <= 0) {
|
|
498
|
+
const A = bt(0, R), F = A - R;
|
|
499
|
+
return { nextPosition: A, actualDelta: F, reachedBoundary: !0 };
|
|
481
500
|
}
|
|
482
501
|
if (a === 0)
|
|
483
|
-
return { nextPosition:
|
|
484
|
-
const
|
|
485
|
-
return { nextPosition:
|
|
502
|
+
return { nextPosition: R, actualDelta: 0, reachedBoundary: !1 };
|
|
503
|
+
const X = bt((A) => It(A + a, 0, b.maxScrollPosition), R), o = X - R, u = a < 0 && R + a <= 0, m = a > 0 && R + a >= b.maxScrollPosition, V = a < 0 && (X <= 0 || u && o === 0) || a > 0 && (X >= b.maxScrollPosition || m && o === 0);
|
|
504
|
+
return { nextPosition: X, actualDelta: o, reachedBoundary: V };
|
|
486
505
|
},
|
|
487
|
-
[
|
|
488
|
-
),
|
|
489
|
-
(a,
|
|
490
|
-
a.current +=
|
|
491
|
-
const
|
|
492
|
-
|
|
493
|
-
const
|
|
494
|
-
return a.current -=
|
|
506
|
+
[bt]
|
|
507
|
+
), xt = S(
|
|
508
|
+
(a, b) => {
|
|
509
|
+
a.current += b;
|
|
510
|
+
const R = Math.max(at.current.maxScrollPosition, 0);
|
|
511
|
+
R > 0 && (a.current = It(a.current, -R, R));
|
|
512
|
+
const L = qt(a.current);
|
|
513
|
+
return a.current -= L.actualDelta, L.reachedBoundary && (a.current = 0), L;
|
|
495
514
|
},
|
|
496
|
-
[
|
|
497
|
-
),
|
|
498
|
-
|
|
499
|
-
}, []),
|
|
500
|
-
|
|
501
|
-
}, [
|
|
515
|
+
[qt]
|
|
516
|
+
), _t = S(() => {
|
|
517
|
+
G.current !== null && (window.cancelAnimationFrame(G.current), G.current = null), p.current = null, $.current = 0, St.current = 0;
|
|
518
|
+
}, []), vt = S(() => {
|
|
519
|
+
q.current = { ...Xe }, Tt(!1), et.current?.reset(), _t();
|
|
520
|
+
}, [_t]), Ut = S(
|
|
502
521
|
(a) => {
|
|
503
|
-
const
|
|
504
|
-
if (!
|
|
505
|
-
|
|
522
|
+
const b = q.current, R = at.current;
|
|
523
|
+
if (!b.active || b.direction === 0) {
|
|
524
|
+
_t();
|
|
506
525
|
return;
|
|
507
526
|
}
|
|
508
|
-
if (!
|
|
509
|
-
|
|
527
|
+
if (!R.scrollBarVisible || R.maxScrollPosition <= 0) {
|
|
528
|
+
_t();
|
|
510
529
|
return;
|
|
511
530
|
}
|
|
512
|
-
const
|
|
513
|
-
if (
|
|
514
|
-
|
|
531
|
+
const L = p.current ?? a, X = Math.max((a - L) / 1e3, 0), o = Math.min(X, ur);
|
|
532
|
+
if (p.current = a, o <= 0) {
|
|
533
|
+
G.current = window.requestAnimationFrame(Ut);
|
|
515
534
|
return;
|
|
516
535
|
}
|
|
517
|
-
const
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
536
|
+
const u = gr({
|
|
537
|
+
distance: b.distance,
|
|
538
|
+
maxDistance: R.effectiveTapMaxDistance,
|
|
539
|
+
viewportSize: R.viewportSize,
|
|
540
|
+
minSpeedMultiplier: R.tapCircleMinSpeedMultiplier,
|
|
541
|
+
maxSpeedMultiplier: R.tapCircleMaxSpeedMultiplier,
|
|
542
|
+
hasCustomMaxSpeedMultiplier: typeof R.tapScrollCircleOptions?.maxSpeedMultiplier == "number",
|
|
543
|
+
curve: R.tapCircleMaxSpeedCurve
|
|
544
|
+
});
|
|
545
|
+
St.current !== b.direction && (St.current = b.direction, $.current = 0);
|
|
546
|
+
const { reachedBoundary: m } = xt($, b.direction * u * o);
|
|
547
|
+
if (m) {
|
|
548
|
+
_t();
|
|
529
549
|
return;
|
|
530
550
|
}
|
|
531
|
-
|
|
551
|
+
G.current = window.requestAnimationFrame(Ut);
|
|
532
552
|
},
|
|
533
|
-
[
|
|
534
|
-
),
|
|
535
|
-
|
|
553
|
+
[xt, _t]
|
|
554
|
+
), Ft = S(() => {
|
|
555
|
+
G.current === null && (p.current = null, $.current = 0, G.current = window.requestAnimationFrame(Ut));
|
|
536
556
|
}, [Ut]);
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
557
|
+
Y(() => {
|
|
558
|
+
const a = q.current;
|
|
559
|
+
!a.active || a.direction === 0 || Ft();
|
|
560
|
+
}, [n, t, Ft]), Y(() => () => {
|
|
561
|
+
_t();
|
|
562
|
+
}, [_t]);
|
|
563
|
+
const ie = S(
|
|
541
564
|
(a) => {
|
|
542
|
-
|
|
565
|
+
q.current = a, Tt(a.active), a.active && a.direction !== 0 ? Ft() : _t();
|
|
543
566
|
},
|
|
544
|
-
[
|
|
567
|
+
[Ft, _t]
|
|
545
568
|
);
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
}, [
|
|
549
|
-
const a = (
|
|
550
|
-
const
|
|
551
|
-
|
|
569
|
+
Y(() => {
|
|
570
|
+
k || vt();
|
|
571
|
+
}, [vt, k]), Y(() => {
|
|
572
|
+
const a = (b) => {
|
|
573
|
+
const L = b.detail?.paneId;
|
|
574
|
+
L && I && L !== I || vt();
|
|
552
575
|
};
|
|
553
|
-
return window.addEventListener(
|
|
554
|
-
window.removeEventListener(
|
|
576
|
+
return window.addEventListener(ze, a), () => {
|
|
577
|
+
window.removeEventListener(ze, a);
|
|
555
578
|
};
|
|
556
|
-
}, [I,
|
|
557
|
-
if (!
|
|
579
|
+
}, [I, vt]), Y(() => {
|
|
580
|
+
if (!k)
|
|
558
581
|
return;
|
|
559
|
-
const a = (
|
|
560
|
-
if (!
|
|
582
|
+
const a = (b) => {
|
|
583
|
+
if (!q.current.active || q.current.pointerId === b.pointerId)
|
|
561
584
|
return;
|
|
562
|
-
const
|
|
563
|
-
if (!(
|
|
564
|
-
|
|
585
|
+
const R = b.target;
|
|
586
|
+
if (!(R instanceof Node)) {
|
|
587
|
+
vt();
|
|
565
588
|
return;
|
|
566
589
|
}
|
|
567
|
-
|
|
590
|
+
et.current?.getElement()?.contains(R) || vt();
|
|
568
591
|
};
|
|
569
592
|
return document.addEventListener("pointerdown", a, !0), () => {
|
|
570
593
|
document.removeEventListener("pointerdown", a, !0);
|
|
571
594
|
};
|
|
572
|
-
}, [
|
|
573
|
-
const
|
|
574
|
-
if (!
|
|
595
|
+
}, [vt, k]);
|
|
596
|
+
const xe = (a) => {
|
|
597
|
+
if (!ct || Lt <= 0 || ot <= 0)
|
|
575
598
|
return 0;
|
|
576
|
-
const
|
|
577
|
-
return
|
|
578
|
-
},
|
|
579
|
-
const { scrollBarVisible:
|
|
580
|
-
if (
|
|
599
|
+
const b = It(a, 0, Lt);
|
|
600
|
+
return It(b / Lt * ot, 0, ot);
|
|
601
|
+
}, de = S((a) => {
|
|
602
|
+
const { scrollBarVisible: b, effectiveTrackLength: R, maxScrollPosition: L } = at.current;
|
|
603
|
+
if (C.debug("[ScrollBar] calculateScrollPositionFromThumb", () => ({ thumbPos: a, trackLen: R, maxScroll: L })), R <= 0 || L <= 0)
|
|
581
604
|
return null;
|
|
582
|
-
const
|
|
583
|
-
return
|
|
584
|
-
}, []),
|
|
605
|
+
const X = It(a, 0, R);
|
|
606
|
+
return It(X / R * L, 0, L);
|
|
607
|
+
}, []), Ie = S(
|
|
585
608
|
(a) => {
|
|
586
|
-
const
|
|
587
|
-
const
|
|
588
|
-
return Number.isFinite(
|
|
589
|
-
},
|
|
590
|
-
return
|
|
609
|
+
const b = a.getBoundingClientRect(), R = c ? b.width : b.height, L = (V) => {
|
|
610
|
+
const A = Number.parseFloat(V);
|
|
611
|
+
return Number.isFinite(A) ? A : 0;
|
|
612
|
+
}, X = window.getComputedStyle(a), o = L(c ? X.width : X.height), u = o > 0 ? o + L(c ? X.paddingLeft : X.paddingTop) + L(c ? X.paddingRight : X.paddingBottom) + L(c ? X.borderLeftWidth : X.borderTopWidth) + L(c ? X.borderRightWidth : X.borderBottomWidth) : 0, m = u > 0 ? u : c ? a.offsetWidth : a.offsetHeight;
|
|
613
|
+
return m <= 0 || R <= 0 ? 1 : R / m;
|
|
591
614
|
},
|
|
592
|
-
[
|
|
593
|
-
),
|
|
615
|
+
[c]
|
|
616
|
+
), nt = S(
|
|
594
617
|
(a) => {
|
|
595
|
-
const
|
|
596
|
-
if (
|
|
618
|
+
const b = O.current;
|
|
619
|
+
if (b.pointerId !== a.pointerId)
|
|
597
620
|
return;
|
|
598
|
-
const
|
|
599
|
-
|
|
600
|
-
delta:
|
|
601
|
-
startThumbPosition:
|
|
621
|
+
const R = a.clientX - b.startClientX, L = a.clientY - b.startClientY, X = lt(R, L) / (b.scale || 1);
|
|
622
|
+
C.debug("[ScrollBar] handleThumbPointerMove", () => ({
|
|
623
|
+
delta: X,
|
|
624
|
+
startThumbPosition: b.startThumbPosition,
|
|
602
625
|
clientY: a.clientY,
|
|
603
|
-
startClientY:
|
|
604
|
-
metrics:
|
|
626
|
+
startClientY: b.startClientY,
|
|
627
|
+
metrics: at.current
|
|
605
628
|
}));
|
|
606
|
-
const
|
|
607
|
-
|
|
629
|
+
const o = de(b.startThumbPosition + X);
|
|
630
|
+
o !== null && bt(o), a.cancelable && a.preventDefault();
|
|
608
631
|
},
|
|
609
|
-
[
|
|
610
|
-
),
|
|
632
|
+
[lt, de, bt]
|
|
633
|
+
), zt = S(
|
|
611
634
|
(a) => {
|
|
612
|
-
const
|
|
613
|
-
if (
|
|
635
|
+
const b = O.current;
|
|
636
|
+
if (b.pointerId !== a.pointerId)
|
|
614
637
|
return;
|
|
615
|
-
document.removeEventListener("pointermove",
|
|
616
|
-
const
|
|
617
|
-
if (
|
|
618
|
-
const
|
|
619
|
-
a.clientX >=
|
|
638
|
+
document.removeEventListener("pointermove", nt), document.removeEventListener("pointerup", zt), document.removeEventListener("pointercancel", zt);
|
|
639
|
+
const R = b.captureTarget;
|
|
640
|
+
if (R?.hasPointerCapture?.(a.pointerId) && R.releasePointerCapture(a.pointerId), O.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1, captureTarget: null }, ut(!1), D.current) {
|
|
641
|
+
const L = D.current.getBoundingClientRect();
|
|
642
|
+
a.clientX >= L.left && a.clientX <= L.right && a.clientY >= L.top && a.clientY <= L.bottom || tt(!1);
|
|
620
643
|
} else
|
|
621
|
-
|
|
644
|
+
tt(!1);
|
|
622
645
|
},
|
|
623
|
-
[
|
|
646
|
+
[nt]
|
|
624
647
|
);
|
|
625
|
-
|
|
626
|
-
document.removeEventListener("pointermove",
|
|
627
|
-
}, [
|
|
628
|
-
const
|
|
648
|
+
Y(() => () => {
|
|
649
|
+
document.removeEventListener("pointermove", nt), document.removeEventListener("pointerup", zt), document.removeEventListener("pointercancel", zt);
|
|
650
|
+
}, [nt, zt]);
|
|
651
|
+
const Te = T(0), ve = T(0), Wt = S(
|
|
629
652
|
(a) => {
|
|
630
|
-
const
|
|
631
|
-
|
|
653
|
+
const b = Math.max(Math.round(at.current.viewportSize / or), sr);
|
|
654
|
+
ve.current !== a && (ve.current = a, Te.current = 0), xt(Te, a * b);
|
|
632
655
|
},
|
|
633
|
-
[
|
|
634
|
-
), { handleArrowPointerDown: ye, handleArrowPointerUp:
|
|
635
|
-
canUseArrowButtons:
|
|
656
|
+
[xt]
|
|
657
|
+
), { handleArrowPointerDown: ye, handleArrowPointerUp: fe, handleArrowKeyDown: Ae } = pr({
|
|
658
|
+
canUseArrowButtons: g,
|
|
636
659
|
enableArrowButtons: l,
|
|
637
|
-
resetTapScroll:
|
|
638
|
-
scrollByStep:
|
|
639
|
-
}),
|
|
640
|
-
if (!
|
|
660
|
+
resetTapScroll: vt,
|
|
661
|
+
scrollByStep: Wt
|
|
662
|
+
}), te = (a) => {
|
|
663
|
+
if (!ct)
|
|
641
664
|
return;
|
|
642
|
-
if (!
|
|
665
|
+
if (!i) {
|
|
643
666
|
a.preventDefault(), a.stopPropagation();
|
|
644
667
|
return;
|
|
645
668
|
}
|
|
646
669
|
if (a.pointerType === "mouse" && a.button !== 0 || a.ctrlKey)
|
|
647
670
|
return;
|
|
648
|
-
|
|
649
|
-
const
|
|
650
|
-
let
|
|
651
|
-
if (
|
|
671
|
+
vt();
|
|
672
|
+
const b = a.currentTarget, R = Ie(b);
|
|
673
|
+
let L = null;
|
|
674
|
+
if (b.setPointerCapture)
|
|
652
675
|
try {
|
|
653
|
-
|
|
676
|
+
b.setPointerCapture(a.pointerId), L = b;
|
|
654
677
|
} catch {
|
|
655
|
-
|
|
678
|
+
L = null;
|
|
656
679
|
}
|
|
657
|
-
|
|
680
|
+
O.current = {
|
|
658
681
|
pointerId: a.pointerId,
|
|
659
|
-
startThumbPosition:
|
|
682
|
+
startThumbPosition: $t,
|
|
660
683
|
startClientX: a.clientX,
|
|
661
684
|
startClientY: a.clientY,
|
|
662
|
-
scale:
|
|
663
|
-
captureTarget:
|
|
664
|
-
}, document.addEventListener("pointermove",
|
|
665
|
-
},
|
|
666
|
-
if (!
|
|
685
|
+
scale: R,
|
|
686
|
+
captureTarget: L
|
|
687
|
+
}, document.addEventListener("pointermove", nt), document.addEventListener("pointerup", zt), document.addEventListener("pointercancel", zt), ut(!0), tt(!0), a.preventDefault(), a.stopPropagation();
|
|
688
|
+
}, se = (a) => {
|
|
689
|
+
if (!ct)
|
|
667
690
|
return;
|
|
668
691
|
if (!s) {
|
|
669
692
|
a.preventDefault(), a.stopPropagation();
|
|
@@ -671,165 +694,166 @@ const pt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
671
694
|
}
|
|
672
695
|
if (a.pointerType === "mouse" && a.button !== 0 || a.ctrlKey)
|
|
673
696
|
return;
|
|
674
|
-
const
|
|
675
|
-
|
|
676
|
-
const
|
|
677
|
-
if (
|
|
697
|
+
const b = a.currentTarget, R = b.getBoundingClientRect(), L = H(a), X = Ie(b), o = (L - (c ? R.left : R.top)) / X;
|
|
698
|
+
vt();
|
|
699
|
+
const u = o - ft / 2, m = xe(u);
|
|
700
|
+
if (bt(m), b.setPointerCapture)
|
|
678
701
|
try {
|
|
679
|
-
|
|
702
|
+
b.setPointerCapture(a.pointerId);
|
|
680
703
|
} catch {
|
|
681
704
|
}
|
|
682
|
-
|
|
705
|
+
P.current = {
|
|
683
706
|
pointerId: a.pointerId,
|
|
684
|
-
startThumbPosition:
|
|
707
|
+
startThumbPosition: u,
|
|
685
708
|
startClientX: a.clientX,
|
|
686
709
|
startClientY: a.clientY,
|
|
687
|
-
scale:
|
|
710
|
+
scale: X
|
|
688
711
|
}, a.preventDefault(), a.stopPropagation();
|
|
689
|
-
},
|
|
690
|
-
|
|
691
|
-
},
|
|
692
|
-
const
|
|
693
|
-
if (
|
|
712
|
+
}, Kt = () => {
|
|
713
|
+
P.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 };
|
|
714
|
+
}, ee = (a) => {
|
|
715
|
+
const b = P.current;
|
|
716
|
+
if (b.pointerId !== a.pointerId)
|
|
694
717
|
return;
|
|
695
718
|
if (a.pointerType === "mouse" && a.buttons === 0) {
|
|
696
|
-
|
|
719
|
+
Kt();
|
|
697
720
|
return;
|
|
698
721
|
}
|
|
699
|
-
const
|
|
700
|
-
|
|
701
|
-
},
|
|
702
|
-
if (
|
|
722
|
+
const R = a.clientX - b.startClientX, L = a.clientY - b.startClientY, X = lt(R, L) / (b.scale || 1), o = xe(b.startThumbPosition + X);
|
|
723
|
+
bt(o), a.cancelable && a.preventDefault();
|
|
724
|
+
}, oe = (a) => {
|
|
725
|
+
if (P.current.pointerId !== a.pointerId)
|
|
703
726
|
return;
|
|
704
|
-
const
|
|
705
|
-
|
|
706
|
-
},
|
|
707
|
-
if (
|
|
727
|
+
const b = a.currentTarget;
|
|
728
|
+
b.hasPointerCapture?.(a.pointerId) && b.releasePointerCapture(a.pointerId), Kt(), a.preventDefault(), a.stopPropagation();
|
|
729
|
+
}, me = (a) => {
|
|
730
|
+
if (P.current.pointerId !== a.pointerId)
|
|
708
731
|
return;
|
|
709
|
-
const
|
|
710
|
-
|
|
711
|
-
},
|
|
712
|
-
|
|
713
|
-
},
|
|
714
|
-
const
|
|
732
|
+
const b = a.currentTarget;
|
|
733
|
+
b.hasPointerCapture?.(a.pointerId) && b.releasePointerCapture(a.pointerId), Kt();
|
|
734
|
+
}, re = (a) => {
|
|
735
|
+
P.current.pointerId === a.pointerId && Kt();
|
|
736
|
+
}, we = At(() => It((mt ? 1 : 0.8) * Xt, 0, 1), [mt, Xt]), Re = At(() => {
|
|
737
|
+
const b = `calc(50% - ${Ct / 2}px + ${Et}px)`;
|
|
715
738
|
return {
|
|
716
|
-
left:
|
|
717
|
-
top:
|
|
739
|
+
left: U,
|
|
740
|
+
top: b
|
|
718
741
|
};
|
|
719
|
-
}, [
|
|
742
|
+
}, [U, Et, Ct]), Ce = (a, b, R, L) => /* @__PURE__ */ st(
|
|
720
743
|
"button",
|
|
721
744
|
{
|
|
722
745
|
type: "button",
|
|
723
746
|
tabIndex: 0,
|
|
724
747
|
className: "aqvs-scrollbar-arrow-button",
|
|
725
748
|
style: {
|
|
726
|
-
[
|
|
727
|
-
[
|
|
749
|
+
[jt]: d,
|
|
750
|
+
[f]: d
|
|
728
751
|
},
|
|
729
|
-
"aria-label":
|
|
752
|
+
"aria-label": b,
|
|
730
753
|
onPointerDown: ye(a),
|
|
731
|
-
onPointerUp:
|
|
732
|
-
onPointerLeave:
|
|
733
|
-
onPointerCancel:
|
|
734
|
-
onKeyDown:
|
|
754
|
+
onPointerUp: fe,
|
|
755
|
+
onPointerLeave: fe,
|
|
756
|
+
onPointerCancel: fe,
|
|
757
|
+
onKeyDown: Ae(a),
|
|
735
758
|
"aria-disabled": !l,
|
|
736
|
-
disabled: !
|
|
737
|
-
children: /* @__PURE__ */
|
|
759
|
+
disabled: !g,
|
|
760
|
+
children: /* @__PURE__ */ st("span", { "aria-hidden": "true", children: R })
|
|
738
761
|
},
|
|
739
|
-
|
|
740
|
-
), pe =
|
|
741
|
-
orientation:
|
|
762
|
+
L
|
|
763
|
+
), pe = h && ct ? {
|
|
764
|
+
orientation: wt,
|
|
742
765
|
scrollPosition: e,
|
|
743
|
-
maxScrollPosition:
|
|
744
|
-
contentSize:
|
|
766
|
+
maxScrollPosition: ot,
|
|
767
|
+
contentSize: n,
|
|
745
768
|
viewportSize: t,
|
|
746
|
-
thumbSize:
|
|
747
|
-
thumbPosition:
|
|
748
|
-
thumbCenter:
|
|
749
|
-
trackSize:
|
|
750
|
-
isDragging:
|
|
751
|
-
isTapScrollActive:
|
|
752
|
-
visibleStartIndex:
|
|
753
|
-
visibleEndIndex:
|
|
769
|
+
thumbSize: ft,
|
|
770
|
+
thumbPosition: $t,
|
|
771
|
+
thumbCenter: Qt,
|
|
772
|
+
trackSize: Dt,
|
|
773
|
+
isDragging: j,
|
|
774
|
+
isTapScrollActive: mt,
|
|
775
|
+
visibleStartIndex: _,
|
|
776
|
+
visibleEndIndex: z
|
|
754
777
|
} : null;
|
|
755
778
|
return /* @__PURE__ */ ue(
|
|
756
779
|
"div",
|
|
757
780
|
{
|
|
758
|
-
className: ce("aqvs-scrollbar",
|
|
781
|
+
className: ce("aqvs-scrollbar", yt, !ct && "pointer-events-none opacity-0", x),
|
|
759
782
|
style: {
|
|
760
|
-
[
|
|
761
|
-
[
|
|
783
|
+
[jt]: t,
|
|
784
|
+
[f]: d
|
|
762
785
|
},
|
|
763
786
|
role: "scrollbar",
|
|
764
787
|
tabIndex: -1,
|
|
765
788
|
"aria-controls": I,
|
|
766
789
|
"aria-valuenow": e,
|
|
767
790
|
"aria-valuemin": 0,
|
|
768
|
-
"aria-valuemax":
|
|
769
|
-
"aria-orientation":
|
|
791
|
+
"aria-valuemax": ot,
|
|
792
|
+
"aria-orientation": c ? "horizontal" : "vertical",
|
|
770
793
|
children: [
|
|
771
|
-
!
|
|
772
|
-
|
|
794
|
+
!c && ct && k && /* @__PURE__ */ st(
|
|
795
|
+
Ge,
|
|
773
796
|
{
|
|
774
|
-
ref:
|
|
775
|
-
className: ce("aqvs-scrollbar-tap-circle-wrapper",
|
|
776
|
-
size:
|
|
777
|
-
maxVisualDistance:
|
|
778
|
-
style:
|
|
779
|
-
opacity:
|
|
780
|
-
renderVisual:
|
|
781
|
-
onDragChange:
|
|
797
|
+
ref: et,
|
|
798
|
+
className: ce("aqvs-scrollbar-tap-circle-wrapper", y),
|
|
799
|
+
size: Ct,
|
|
800
|
+
maxVisualDistance: Nt,
|
|
801
|
+
style: Re,
|
|
802
|
+
opacity: we,
|
|
803
|
+
renderVisual: Bt,
|
|
804
|
+
onDragChange: ie
|
|
782
805
|
},
|
|
783
806
|
"tap-circle"
|
|
784
807
|
),
|
|
785
|
-
|
|
808
|
+
Ce(-1, it[0], J[0], "arrow-start"),
|
|
786
809
|
/* @__PURE__ */ ue(
|
|
787
810
|
"div",
|
|
788
811
|
{
|
|
789
812
|
className: "aqvs-scrollbar-track",
|
|
790
813
|
style: {
|
|
791
|
-
borderRadius:
|
|
814
|
+
borderRadius: d / 2
|
|
792
815
|
},
|
|
793
|
-
onPointerDown:
|
|
794
|
-
onPointerMove:
|
|
795
|
-
onPointerUp:
|
|
796
|
-
onPointerCancel:
|
|
797
|
-
onLostPointerCapture:
|
|
816
|
+
onPointerDown: se,
|
|
817
|
+
onPointerMove: ee,
|
|
818
|
+
onPointerUp: oe,
|
|
819
|
+
onPointerCancel: me,
|
|
820
|
+
onLostPointerCapture: re,
|
|
798
821
|
"aria-disabled": !s,
|
|
799
822
|
children: [
|
|
800
|
-
pe && /* @__PURE__ */
|
|
801
|
-
/* @__PURE__ */
|
|
823
|
+
pe && /* @__PURE__ */ st("div", { className: "aqvs-scrollbar-overlay", "aria-hidden": !0, children: h?.(pe) }, "overlay"),
|
|
824
|
+
/* @__PURE__ */ st(
|
|
802
825
|
"div",
|
|
803
826
|
{
|
|
804
|
-
className: ce("aqvs-scrollbar-thumb-wrapper", !(
|
|
827
|
+
className: ce("aqvs-scrollbar-thumb-wrapper", !(ct || j) && "pointer-events-none opacity-0"),
|
|
805
828
|
style: {
|
|
806
|
-
[
|
|
807
|
-
[
|
|
808
|
-
...
|
|
829
|
+
[jt]: ft,
|
|
830
|
+
[dt]: $t,
|
|
831
|
+
...c ? { top: 0, bottom: 0 } : { left: 0, right: 0 }
|
|
809
832
|
},
|
|
810
|
-
onPointerDown:
|
|
833
|
+
onPointerDown: te,
|
|
811
834
|
role: "slider",
|
|
812
|
-
"aria-orientation":
|
|
835
|
+
"aria-orientation": c ? "horizontal" : "vertical",
|
|
813
836
|
"aria-valuenow": e,
|
|
814
837
|
"aria-valuemin": 0,
|
|
815
|
-
"aria-valuemax":
|
|
816
|
-
"aria-disabled": !
|
|
838
|
+
"aria-valuemax": ot,
|
|
839
|
+
"aria-disabled": !i,
|
|
817
840
|
tabIndex: -1,
|
|
818
|
-
children: /* @__PURE__ */
|
|
841
|
+
children: /* @__PURE__ */ st(
|
|
819
842
|
"div",
|
|
820
843
|
{
|
|
821
|
-
ref:
|
|
822
|
-
className: ce("aqvs-scrollbar-thumb",
|
|
823
|
-
"data-
|
|
844
|
+
ref: D,
|
|
845
|
+
className: ce("aqvs-scrollbar-thumb", c ? "aqvs-scrollbar-thumb-horizontal" : "aqvs-scrollbar-thumb-vertical"),
|
|
846
|
+
"data-testid": "aqvs-scrollbar-thumb",
|
|
847
|
+
"data-thumb-state": w,
|
|
824
848
|
style: {
|
|
825
|
-
borderRadius:
|
|
826
|
-
cursor:
|
|
849
|
+
borderRadius: d - 1,
|
|
850
|
+
cursor: i ? "pointer" : "default"
|
|
827
851
|
},
|
|
828
852
|
onMouseEnter: () => {
|
|
829
|
-
|
|
853
|
+
i && tt(!0);
|
|
830
854
|
},
|
|
831
855
|
onMouseLeave: () => {
|
|
832
|
-
|
|
856
|
+
i && tt(!1);
|
|
833
857
|
}
|
|
834
858
|
},
|
|
835
859
|
"thumb"
|
|
@@ -841,198 +865,202 @@ const pt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
841
865
|
},
|
|
842
866
|
"track"
|
|
843
867
|
),
|
|
844
|
-
|
|
868
|
+
Ce(1, it[1], J[1], "arrow-end")
|
|
845
869
|
]
|
|
846
870
|
}
|
|
847
871
|
);
|
|
848
|
-
},
|
|
872
|
+
}, Ir = ["mouse", "pen", "touch"], ke = (n, t) => !(n === "mouse" || n === "pen" || n === "touch") || t.includes(n), Me = {
|
|
849
873
|
maxVelocity: 6,
|
|
850
874
|
minVelocity: 0.02,
|
|
851
875
|
deceleration: 25e-4,
|
|
852
876
|
velocitySampleWindow: 90,
|
|
853
877
|
startVelocityThreshold: 0.04
|
|
854
|
-
},
|
|
855
|
-
for (const [r,
|
|
856
|
-
e === "add" ?
|
|
857
|
-
},
|
|
878
|
+
}, Ee = (n, t, e) => {
|
|
879
|
+
for (const [r, i, s] of t)
|
|
880
|
+
e === "add" ? n.addEventListener(r, i, s) : n.removeEventListener(r, i, s);
|
|
881
|
+
}, Tr = Ye(
|
|
858
882
|
({
|
|
859
|
-
children:
|
|
883
|
+
children: n,
|
|
860
884
|
contentSize: t,
|
|
861
885
|
viewportSize: e,
|
|
862
886
|
scrollBarWidth: r = 12,
|
|
863
|
-
enableThumbDrag:
|
|
887
|
+
enableThumbDrag: i = !0,
|
|
864
888
|
enableTrackClick: s = !0,
|
|
865
889
|
enableArrowButtons: l = !0,
|
|
866
|
-
enablePointerDrag:
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
890
|
+
enablePointerDrag: c = !0,
|
|
891
|
+
pointerDragInputs: d = Ir,
|
|
892
|
+
onScroll: x,
|
|
893
|
+
className: I,
|
|
894
|
+
testId: M,
|
|
895
|
+
style: E,
|
|
896
|
+
background: h,
|
|
897
|
+
tapScrollCircleOptions: _,
|
|
898
|
+
inertiaOptions: z,
|
|
899
|
+
itemCount: j,
|
|
900
|
+
renderThumbOverlay: ut,
|
|
901
|
+
wheelSpeedMultiplier: Q = 1,
|
|
902
|
+
onWheelHorizontal: tt,
|
|
903
|
+
contentInsets: mt,
|
|
904
|
+
visibleStartIndex: Tt,
|
|
905
|
+
visibleEndIndex: D,
|
|
906
|
+
renderOverlay: O,
|
|
907
|
+
initialScrollPosition: P = 0
|
|
908
|
+
}, B) => {
|
|
909
|
+
const N = T(Number.isFinite(P) ? Math.max(0, P) : 0), q = T(null), et = T(null), G = T(tt);
|
|
910
|
+
Y(() => {
|
|
911
|
+
G.current = tt;
|
|
912
|
+
}, [tt]);
|
|
913
|
+
const p = T({
|
|
889
914
|
frame: null,
|
|
890
915
|
velocity: 0,
|
|
891
916
|
lastTimestamp: null,
|
|
892
917
|
generation: 0
|
|
893
|
-
}),
|
|
918
|
+
}), $ = At(
|
|
894
919
|
() => ({
|
|
895
|
-
maxVelocity:
|
|
896
|
-
minVelocity:
|
|
897
|
-
deceleration:
|
|
898
|
-
velocitySampleWindow:
|
|
899
|
-
startVelocityThreshold:
|
|
920
|
+
maxVelocity: z?.maxVelocity ?? Me.maxVelocity,
|
|
921
|
+
minVelocity: z?.minVelocity ?? Me.minVelocity,
|
|
922
|
+
deceleration: z?.deceleration ?? Me.deceleration,
|
|
923
|
+
velocitySampleWindow: z?.velocitySampleWindow ?? Me.velocitySampleWindow,
|
|
924
|
+
startVelocityThreshold: z?.startVelocityThreshold ?? Me.startVelocityThreshold
|
|
900
925
|
}),
|
|
901
|
-
[
|
|
902
|
-
),
|
|
903
|
-
top: Math.max(0,
|
|
904
|
-
bottom: Math.max(0,
|
|
905
|
-
}), [
|
|
906
|
-
|
|
926
|
+
[z]
|
|
927
|
+
), St = At(() => ({
|
|
928
|
+
top: Math.max(0, mt?.top ?? 0),
|
|
929
|
+
bottom: Math.max(0, mt?.bottom ?? 0)
|
|
930
|
+
}), [mt]);
|
|
931
|
+
C.debug("[ScrollPane] ScrollPane rendered", () => ({
|
|
907
932
|
contentSize: t,
|
|
908
933
|
viewportSize: e,
|
|
909
934
|
scrollBarWidth: r,
|
|
910
|
-
className:
|
|
911
|
-
style:
|
|
912
|
-
tapScrollCircleOptions:
|
|
913
|
-
inertiaOptions:
|
|
914
|
-
enablePointerDrag:
|
|
915
|
-
contentInsets:
|
|
935
|
+
className: I,
|
|
936
|
+
style: E,
|
|
937
|
+
tapScrollCircleOptions: _,
|
|
938
|
+
inertiaOptions: z,
|
|
939
|
+
enablePointerDrag: c,
|
|
940
|
+
contentInsets: St
|
|
916
941
|
}));
|
|
917
|
-
const
|
|
918
|
-
|
|
919
|
-
const
|
|
920
|
-
(
|
|
921
|
-
const { contentSize:
|
|
922
|
-
if (
|
|
923
|
-
return
|
|
924
|
-
const
|
|
925
|
-
if (!Number.isFinite(
|
|
926
|
-
return
|
|
927
|
-
const
|
|
928
|
-
return
|
|
942
|
+
const Rt = T({ contentSize: t, viewportSize: e });
|
|
943
|
+
Rt.current = { contentSize: t, viewportSize: e };
|
|
944
|
+
const Z = At(() => t > e, [t, e]), k = S(
|
|
945
|
+
(f) => {
|
|
946
|
+
const { contentSize: dt, viewportSize: lt } = Rt.current, H = dt > lt, it = N.current;
|
|
947
|
+
if (C.debug("[ScrollPane] scrollTo called", () => ({ newPosition: f, contentSize: dt, viewportSize: lt, currentIsScrollable: H, prevPosition: it })), !H)
|
|
948
|
+
return N.current !== 0 && (N.current = 0, x?.(0, it)), N.current;
|
|
949
|
+
const J = typeof f == "function" ? f(N.current) : f;
|
|
950
|
+
if (!Number.isFinite(J))
|
|
951
|
+
return C.warn("[ScrollPane] scrollTo received a non-finite position; keeping the current position", { nextPosition: J }), N.current;
|
|
952
|
+
const yt = Math.max(dt - lt, 0), wt = It(J, 0, yt);
|
|
953
|
+
return N.current !== wt && (N.current = wt, x?.(wt, it)), N.current;
|
|
929
954
|
},
|
|
930
|
-
[
|
|
931
|
-
),
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
}, [])
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
955
|
+
[x]
|
|
956
|
+
), Ct = T(k);
|
|
957
|
+
Y(() => {
|
|
958
|
+
Ct.current = k;
|
|
959
|
+
}, [k]);
|
|
960
|
+
const U = S(() => {
|
|
961
|
+
const f = p.current;
|
|
962
|
+
f.generation += 1, f.frame !== null && cancelAnimationFrame(f.frame), f.frame = null, f.velocity = 0, f.lastTimestamp = null;
|
|
963
|
+
}, []), Et = T(U);
|
|
964
|
+
Y(() => {
|
|
965
|
+
Et.current = U;
|
|
966
|
+
}, [U]), Y(() => () => {
|
|
967
|
+
Et.current();
|
|
939
968
|
}, []);
|
|
940
|
-
const
|
|
941
|
-
(
|
|
942
|
-
if (!
|
|
969
|
+
const y = S(
|
|
970
|
+
(f) => {
|
|
971
|
+
if (!Z)
|
|
943
972
|
return;
|
|
944
|
-
const { maxVelocity:
|
|
945
|
-
if (Math.abs(
|
|
973
|
+
const { maxVelocity: dt, minVelocity: lt, deceleration: H, startVelocityThreshold: it } = $, J = It(f, -dt, dt);
|
|
974
|
+
if (Math.abs(J) < it)
|
|
946
975
|
return;
|
|
947
|
-
|
|
948
|
-
const
|
|
949
|
-
const
|
|
950
|
-
if (
|
|
976
|
+
U(), p.current.velocity = J, p.current.lastTimestamp = null;
|
|
977
|
+
const yt = p.current.generation, wt = (Nt) => {
|
|
978
|
+
const rt = p.current;
|
|
979
|
+
if (rt.generation !== yt)
|
|
951
980
|
return;
|
|
952
|
-
if (
|
|
953
|
-
|
|
981
|
+
if (rt.lastTimestamp === null) {
|
|
982
|
+
rt.lastTimestamp = Nt, rt.frame = requestAnimationFrame(wt);
|
|
954
983
|
return;
|
|
955
984
|
}
|
|
956
|
-
const
|
|
957
|
-
if (
|
|
958
|
-
|
|
985
|
+
const Dt = Nt - rt.lastTimestamp;
|
|
986
|
+
if (rt.lastTimestamp = Nt, Dt <= 0) {
|
|
987
|
+
rt.frame = requestAnimationFrame(wt);
|
|
959
988
|
return;
|
|
960
989
|
}
|
|
961
|
-
const
|
|
962
|
-
let
|
|
963
|
-
const
|
|
964
|
-
|
|
965
|
-
const
|
|
966
|
-
if (
|
|
990
|
+
const Mt = rt.velocity;
|
|
991
|
+
let ft = Mt;
|
|
992
|
+
const ot = H * Dt;
|
|
993
|
+
Mt > 0 ? ft = Math.max(0, Mt - ot) : Mt < 0 && (ft = Math.min(0, Mt + ot));
|
|
994
|
+
const $t = (Mt + ft) / 2 * Dt, Qt = N.current;
|
|
995
|
+
if ($t !== 0 && Ct.current((xt) => xt + $t), p.current.generation !== yt)
|
|
967
996
|
return;
|
|
968
|
-
const
|
|
969
|
-
|
|
970
|
-
const
|
|
971
|
-
if (Math.abs(
|
|
972
|
-
|
|
997
|
+
const ct = N.current, { contentSize: g, viewportSize: w } = Rt.current, bt = Math.max(g - w, 0);
|
|
998
|
+
rt.velocity = ft;
|
|
999
|
+
const qt = ct === Qt || ct <= 0 && ft <= 0 || ct >= bt && ft >= 0;
|
|
1000
|
+
if (Math.abs(ft) < lt || qt) {
|
|
1001
|
+
U();
|
|
973
1002
|
return;
|
|
974
1003
|
}
|
|
975
|
-
|
|
1004
|
+
rt.frame = requestAnimationFrame(wt);
|
|
976
1005
|
};
|
|
977
|
-
|
|
1006
|
+
p.current.frame = requestAnimationFrame(wt);
|
|
978
1007
|
},
|
|
979
|
-
[
|
|
980
|
-
),
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
}, [
|
|
984
|
-
|
|
1008
|
+
[Z, $, U]
|
|
1009
|
+
), Yt = T(y);
|
|
1010
|
+
Y(() => {
|
|
1011
|
+
Yt.current = y;
|
|
1012
|
+
}, [y]), be(() => {
|
|
1013
|
+
Rt.current = { contentSize: t, viewportSize: e };
|
|
985
1014
|
}, [t, e]), be(() => {
|
|
986
|
-
const
|
|
987
|
-
if (!
|
|
988
|
-
const
|
|
989
|
-
|
|
1015
|
+
const f = et.current;
|
|
1016
|
+
if (!f) return;
|
|
1017
|
+
const dt = () => {
|
|
1018
|
+
f.scrollTop !== 0 && (C.debug("[ScrollPane] Native scroll detected, resetting to 0", () => ({ scrollTop: f.scrollTop })), f.scrollTop = 0), f.scrollLeft !== 0 && (f.scrollLeft = 0);
|
|
990
1019
|
};
|
|
991
|
-
return
|
|
1020
|
+
return f.addEventListener("scroll", dt), () => f.removeEventListener("scroll", dt);
|
|
992
1021
|
}, []), be(() => {
|
|
993
|
-
if (
|
|
994
|
-
|
|
995
|
-
const
|
|
996
|
-
|
|
1022
|
+
if (Z) {
|
|
1023
|
+
C.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", () => ({ contentSize: t, viewportSize: e, scrollPosition: N.current }));
|
|
1024
|
+
const f = It(t - e, 0, t);
|
|
1025
|
+
N.current > f && k(f);
|
|
997
1026
|
} else
|
|
998
|
-
|
|
999
|
-
}, [
|
|
1000
|
-
const
|
|
1001
|
-
if (
|
|
1027
|
+
k(0);
|
|
1028
|
+
}, [Z, k, t, e]), Y(() => {
|
|
1029
|
+
const f = (H) => {
|
|
1030
|
+
if (H.ctrlKey)
|
|
1002
1031
|
return;
|
|
1003
|
-
const
|
|
1004
|
-
if (
|
|
1005
|
-
if (
|
|
1006
|
-
|
|
1007
|
-
let
|
|
1008
|
-
|
|
1032
|
+
const it = H.shiftKey && H.deltaX === 0, J = it ? H.deltaY : H.deltaX, yt = it ? 0 : H.deltaY;
|
|
1033
|
+
if (J !== 0 && Math.abs(J) >= Math.abs(yt)) {
|
|
1034
|
+
if (G.current) {
|
|
1035
|
+
H.preventDefault(), U();
|
|
1036
|
+
let rt = J;
|
|
1037
|
+
H.deltaMode === 1 ? rt *= 16 : H.deltaMode === 2 && (rt *= e), G.current(rt);
|
|
1009
1038
|
}
|
|
1010
1039
|
return;
|
|
1011
1040
|
}
|
|
1012
|
-
if (!
|
|
1041
|
+
if (!Z || H.deltaY === 0)
|
|
1013
1042
|
return;
|
|
1014
|
-
|
|
1015
|
-
let
|
|
1016
|
-
|
|
1017
|
-
},
|
|
1018
|
-
|
|
1019
|
-
|
|
1043
|
+
H.preventDefault(), U();
|
|
1044
|
+
let Nt = H.deltaY;
|
|
1045
|
+
H.deltaMode === 1 ? Nt *= 16 : H.deltaMode === 2 && (Nt *= e), Q !== 1 && (Nt *= Q), C.debug("[ScrollPane] wheel event", () => ({ deltaY: Nt, scrollPosition: N.current, wheelSpeedMultiplier: Q, deltaMode: H.deltaMode, scrollTop: et.current?.scrollTop })), k((rt) => rt + Nt);
|
|
1046
|
+
}, dt = () => {
|
|
1047
|
+
U();
|
|
1048
|
+
}, lt = q.current;
|
|
1049
|
+
return lt && (lt.addEventListener("wheel", f, { passive: !1 }), lt.addEventListener("pointerdown", dt, { capture: !0, passive: !0 })), () => {
|
|
1050
|
+
lt && (lt.removeEventListener("wheel", f), lt.removeEventListener("pointerdown", dt, { capture: !0 }));
|
|
1020
1051
|
};
|
|
1021
|
-
}, [
|
|
1022
|
-
|
|
1052
|
+
}, [Z, k, U, e, Q]), Be(
|
|
1053
|
+
B,
|
|
1023
1054
|
() => ({
|
|
1024
|
-
scrollTo: (
|
|
1025
|
-
getScrollPosition: () =>
|
|
1055
|
+
scrollTo: (f) => (U(), k(f)),
|
|
1056
|
+
getScrollPosition: () => N.current,
|
|
1026
1057
|
getContentSize: () => t,
|
|
1027
1058
|
getViewportSize: () => e
|
|
1028
1059
|
}),
|
|
1029
|
-
[
|
|
1060
|
+
[k, t, e, U]
|
|
1030
1061
|
);
|
|
1031
|
-
const
|
|
1032
|
-
|
|
1033
|
-
Ft.current = Y;
|
|
1034
|
-
}, [Y]);
|
|
1035
|
-
const Lt = er(), v = g({
|
|
1062
|
+
const Ht = tr(), v = T({
|
|
1063
|
+
pointerType: "",
|
|
1036
1064
|
pointerId: null,
|
|
1037
1065
|
startClientY: 0,
|
|
1038
1066
|
startScroll: 0,
|
|
@@ -1040,225 +1068,250 @@ const pt = (i, t, e) => Math.max(t, Math.min(e, i)), Oe = "virtualscroll:tap-scr
|
|
|
1040
1068
|
shouldCancelNextClick: !1,
|
|
1041
1069
|
clickResetTimer: null,
|
|
1042
1070
|
velocitySamples: []
|
|
1043
|
-
}),
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
}, [
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1071
|
+
}), Xt = T(c), Bt = T(d);
|
|
1072
|
+
Y(() => {
|
|
1073
|
+
Xt.current = c;
|
|
1074
|
+
}, [c]), Y(() => {
|
|
1075
|
+
Bt.current = d;
|
|
1076
|
+
}, [d]);
|
|
1077
|
+
const Jt = T(Z);
|
|
1078
|
+
Y(() => {
|
|
1079
|
+
Jt.current = Z;
|
|
1080
|
+
}, [Z]);
|
|
1081
|
+
const at = T($);
|
|
1082
|
+
Y(() => {
|
|
1083
|
+
at.current = $;
|
|
1084
|
+
}, [$]), Y(() => {
|
|
1085
|
+
const f = v.current;
|
|
1086
|
+
if (c && Z && (f.pointerId === null || ke(f.pointerType, d)) || f.pointerId === null)
|
|
1056
1087
|
return;
|
|
1057
|
-
const
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1088
|
+
const dt = et.current;
|
|
1089
|
+
f.clickResetTimer !== null && (window.clearTimeout(f.clickResetTimer), f.clickResetTimer = null);
|
|
1090
|
+
const lt = f.isDragging && f.shouldCancelNextClick, H = f.pointerId;
|
|
1091
|
+
f.pointerId = null, f.pointerType = "", f.startClientY = 0, f.startScroll = 0, f.isDragging = !1, f.shouldCancelNextClick = lt, f.velocitySamples = [], dt?.hasPointerCapture(H) && dt.releasePointerCapture(H);
|
|
1092
|
+
}, [c, d, Z]), Y(() => {
|
|
1093
|
+
const f = et.current;
|
|
1094
|
+
if (!f)
|
|
1062
1095
|
return;
|
|
1063
|
-
const
|
|
1064
|
-
const
|
|
1065
|
-
|
|
1066
|
-
},
|
|
1067
|
-
const
|
|
1068
|
-
|
|
1069
|
-
},
|
|
1070
|
-
const
|
|
1071
|
-
|
|
1072
|
-
const
|
|
1073
|
-
|
|
1074
|
-
},
|
|
1075
|
-
const
|
|
1076
|
-
|
|
1077
|
-
},
|
|
1078
|
-
const
|
|
1079
|
-
if (!
|
|
1080
|
-
if (
|
|
1096
|
+
const dt = 6, lt = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), H = () => {
|
|
1097
|
+
const g = v.current;
|
|
1098
|
+
g.pointerId = null, g.pointerType = "", g.startClientY = 0, g.startScroll = 0, g.isDragging = !1, g.velocitySamples = [];
|
|
1099
|
+
}, it = () => {
|
|
1100
|
+
const g = v.current;
|
|
1101
|
+
g.clickResetTimer !== null && (window.clearTimeout(g.clickResetTimer), g.clickResetTimer = null);
|
|
1102
|
+
}, J = (g) => {
|
|
1103
|
+
const w = v.current, bt = lt();
|
|
1104
|
+
w.velocitySamples.push({ clientY: g, time: bt });
|
|
1105
|
+
const qt = at.current.velocitySampleWindow;
|
|
1106
|
+
w.velocitySamples = w.velocitySamples.filter((xt) => bt - xt.time <= qt);
|
|
1107
|
+
}, yt = (g) => g instanceof HTMLElement && g.closest("[data-scrollpane-ignore-drag='true']") !== null, wt = (g) => {
|
|
1108
|
+
const w = v.current;
|
|
1109
|
+
w.shouldCancelNextClick && (g.preventDefault(), g.stopPropagation(), w.shouldCancelNextClick = !1);
|
|
1110
|
+
}, Nt = (g) => {
|
|
1111
|
+
const w = v.current;
|
|
1112
|
+
if (!w.isDragging) {
|
|
1113
|
+
if (w.isDragging = !0, w.shouldCancelNextClick = !0, !f.hasPointerCapture(g.pointerId))
|
|
1081
1114
|
try {
|
|
1082
|
-
|
|
1115
|
+
f.setPointerCapture(g.pointerId);
|
|
1083
1116
|
} catch {
|
|
1084
1117
|
}
|
|
1085
|
-
|
|
1118
|
+
J(g.clientY);
|
|
1086
1119
|
}
|
|
1087
|
-
},
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1090
|
-
},
|
|
1091
|
-
const
|
|
1092
|
-
if (
|
|
1120
|
+
}, rt = (g) => {
|
|
1121
|
+
const w = v.current;
|
|
1122
|
+
f.hasPointerCapture(g) && f.releasePointerCapture(g), w.shouldCancelNextClick = !1, it(), H();
|
|
1123
|
+
}, Dt = (g) => {
|
|
1124
|
+
const w = v.current;
|
|
1125
|
+
if (w.pointerId !== g.pointerId)
|
|
1093
1126
|
return;
|
|
1094
|
-
if (
|
|
1095
|
-
|
|
1127
|
+
if (g.buttons === 0) {
|
|
1128
|
+
rt(g.pointerId);
|
|
1096
1129
|
return;
|
|
1097
1130
|
}
|
|
1098
|
-
if (!(
|
|
1131
|
+
if (!(Xt.current && Jt.current) || !ke(g.pointerType, Bt.current) || !w.isDragging && (Math.abs(g.clientY - w.startClientY) < dt || (Nt(g), !w.isDragging)))
|
|
1099
1132
|
return;
|
|
1100
|
-
|
|
1101
|
-
const
|
|
1102
|
-
|
|
1103
|
-
},
|
|
1104
|
-
const
|
|
1105
|
-
|
|
1133
|
+
J(g.clientY);
|
|
1134
|
+
const bt = g.clientY - w.startClientY, qt = w.startScroll - bt;
|
|
1135
|
+
Ct.current(qt), g.cancelable && g.preventDefault();
|
|
1136
|
+
}, Mt = () => {
|
|
1137
|
+
const g = v.current;
|
|
1138
|
+
return g.pointerId !== null || !g.shouldCancelNextClick ? !1 : (it(), g.clickResetTimer = window.setTimeout(() => {
|
|
1139
|
+
const w = v.current;
|
|
1140
|
+
w.shouldCancelNextClick = !1, w.clickResetTimer = null;
|
|
1141
|
+
}, 0), !0);
|
|
1142
|
+
}, ft = (g) => {
|
|
1143
|
+
const w = v.current;
|
|
1144
|
+
if (w.pointerId !== g.pointerId) {
|
|
1145
|
+
Mt();
|
|
1106
1146
|
return;
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1147
|
+
}
|
|
1148
|
+
w.isDragging && w.shouldCancelNextClick && g.cancelable && (g.preventDefault(), g.stopPropagation()), w.isDragging && J(g.clientY);
|
|
1149
|
+
let bt = 0;
|
|
1150
|
+
if (w.isDragging && w.velocitySamples.length >= 2) {
|
|
1151
|
+
const xt = w.velocitySamples, _t = at.current.velocitySampleWindow, vt = xt[xt.length - 1], Ut = xt.find((Ft) => vt.time - Ft.time <= _t) ?? xt[0];
|
|
1152
|
+
if (vt && Ut && vt.time !== Ut.time) {
|
|
1153
|
+
const Ft = vt.clientY - Ut.clientY, ie = vt.time - Ut.time;
|
|
1154
|
+
bt = -(Ft / ie);
|
|
1114
1155
|
}
|
|
1115
1156
|
}
|
|
1116
|
-
|
|
1117
|
-
const
|
|
1118
|
-
|
|
1157
|
+
it(), w.shouldCancelNextClick && (w.clickResetTimer = window.setTimeout(() => {
|
|
1158
|
+
const xt = v.current;
|
|
1159
|
+
xt.shouldCancelNextClick = !1, xt.clickResetTimer = null;
|
|
1119
1160
|
}, 0));
|
|
1120
|
-
const
|
|
1121
|
-
|
|
1122
|
-
},
|
|
1123
|
-
if (v.current.pointerId !== null || !(
|
|
1161
|
+
const qt = at.current.startVelocityThreshold;
|
|
1162
|
+
H(), f.hasPointerCapture(g.pointerId) && f.releasePointerCapture(g.pointerId), Math.abs(bt) >= qt && Yt.current?.(bt);
|
|
1163
|
+
}, ot = (g) => {
|
|
1164
|
+
if (v.current.pointerId !== null || (v.current.shouldCancelNextClick && (it(), v.current.shouldCancelNextClick = !1), !(Xt.current && Jt.current)) || !ke(g.pointerType, Bt.current) || g.button !== 0 && g.pointerType === "mouse" || g.ctrlKey || g.metaKey || g.altKey || yt(g.target))
|
|
1165
|
+
return;
|
|
1166
|
+
window.dispatchEvent(new CustomEvent(ze, { detail: { paneId: Ht } })), Et.current?.();
|
|
1167
|
+
const w = v.current;
|
|
1168
|
+
it(), w.pointerId = g.pointerId, w.pointerType = g.pointerType, w.startClientY = g.clientY, w.startScroll = N.current, w.isDragging = !1, w.shouldCancelNextClick = !1, w.velocitySamples = [];
|
|
1169
|
+
}, Lt = (g) => {
|
|
1170
|
+
if (v.current.pointerId !== g.pointerId) {
|
|
1171
|
+
Mt();
|
|
1124
1172
|
return;
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
["pointerdown", Ct, { passive: !1 }],
|
|
1133
|
-
["lostpointercapture", (m) => {
|
|
1134
|
-
v.current.pointerId === m.pointerId && ft(m.pointerId);
|
|
1173
|
+
}
|
|
1174
|
+
rt(g.pointerId);
|
|
1175
|
+
}, Qt = [
|
|
1176
|
+
["click", wt, !0],
|
|
1177
|
+
["pointerdown", ot, { passive: !1 }],
|
|
1178
|
+
["lostpointercapture", (g) => {
|
|
1179
|
+
v.current.pointerId === g.pointerId && rt(g.pointerId);
|
|
1135
1180
|
}, void 0]
|
|
1136
|
-
],
|
|
1137
|
-
["pointermove",
|
|
1138
|
-
["pointerup",
|
|
1139
|
-
["pointercancel",
|
|
1181
|
+
], ct = [
|
|
1182
|
+
["pointermove", Dt, { passive: !1 }],
|
|
1183
|
+
["pointerup", ft, void 0],
|
|
1184
|
+
["pointercancel", Lt, void 0]
|
|
1140
1185
|
];
|
|
1141
|
-
return
|
|
1142
|
-
|
|
1143
|
-
const
|
|
1144
|
-
|
|
1186
|
+
return Ee(f, Qt, "add"), Ee(window, ct, "add"), () => {
|
|
1187
|
+
Ee(f, Qt, "remove"), Ee(window, ct, "remove");
|
|
1188
|
+
const g = v.current;
|
|
1189
|
+
g.pointerId !== null && f.hasPointerCapture(g.pointerId) && f.releasePointerCapture(g.pointerId), it(), H();
|
|
1145
1190
|
};
|
|
1146
|
-
}, [
|
|
1191
|
+
}, [Ht]);
|
|
1192
|
+
const jt = S(
|
|
1193
|
+
(f) => (U(), k(f)),
|
|
1194
|
+
[k, U]
|
|
1195
|
+
);
|
|
1196
|
+
return /* @__PURE__ */ ue("div", { ref: q, "data-testid": M, className: ce("aqvs-scroll-pane", I), style: E, children: [
|
|
1147
1197
|
/* @__PURE__ */ ue(
|
|
1148
1198
|
"div",
|
|
1149
1199
|
{
|
|
1150
|
-
ref:
|
|
1200
|
+
ref: et,
|
|
1151
1201
|
className: ce("aqvs-scroll-pane-content"),
|
|
1202
|
+
"data-testid": "aqvs-scroll-pane-content",
|
|
1152
1203
|
style: {
|
|
1153
1204
|
height: e,
|
|
1154
|
-
paddingTop:
|
|
1155
|
-
paddingBottom:
|
|
1205
|
+
paddingTop: St.top,
|
|
1206
|
+
paddingBottom: St.bottom,
|
|
1156
1207
|
// スクロール不能時 (contentSize <= viewportSize) は touch-action を通常に戻し、
|
|
1157
|
-
//
|
|
1158
|
-
|
|
1208
|
+
// 短いリスト上のタッチがページ全体のパンを妨げるデッドゾーン化を防ぐ。
|
|
1209
|
+
// 直接操作 (指・ペン) のドラッグを許可していない場合も付けない。
|
|
1210
|
+
// touch-action はペン入力にも効くため、判定は touch と pen の論理和にする
|
|
1211
|
+
...c && Z && d.some((f) => f === "touch" || f === "pen") ? { touchAction: "none" } : {}
|
|
1159
1212
|
},
|
|
1160
|
-
id:
|
|
1213
|
+
id: Ht,
|
|
1161
1214
|
children: [
|
|
1162
|
-
|
|
1163
|
-
|
|
1215
|
+
h,
|
|
1216
|
+
n(N.current)
|
|
1164
1217
|
]
|
|
1165
1218
|
}
|
|
1166
1219
|
),
|
|
1167
|
-
/* @__PURE__ */
|
|
1168
|
-
|
|
1220
|
+
/* @__PURE__ */ st(
|
|
1221
|
+
xr,
|
|
1169
1222
|
{
|
|
1170
1223
|
contentSize: t,
|
|
1171
1224
|
viewportSize: e,
|
|
1172
|
-
scrollPosition:
|
|
1173
|
-
onScroll:
|
|
1174
|
-
enableThumbDrag:
|
|
1225
|
+
scrollPosition: N.current,
|
|
1226
|
+
onScroll: jt,
|
|
1227
|
+
enableThumbDrag: i,
|
|
1175
1228
|
enableTrackClick: s,
|
|
1176
1229
|
enableArrowButtons: l,
|
|
1177
1230
|
scrollBarWidth: r,
|
|
1178
|
-
ariaControls:
|
|
1179
|
-
tapScrollCircleOptions:
|
|
1180
|
-
itemCount:
|
|
1181
|
-
renderThumbOverlay:
|
|
1182
|
-
visibleStartIndex:
|
|
1183
|
-
visibleEndIndex:
|
|
1231
|
+
ariaControls: Ht,
|
|
1232
|
+
tapScrollCircleOptions: _,
|
|
1233
|
+
itemCount: j,
|
|
1234
|
+
renderThumbOverlay: ut,
|
|
1235
|
+
visibleStartIndex: Tt,
|
|
1236
|
+
visibleEndIndex: D
|
|
1184
1237
|
},
|
|
1185
1238
|
"scrollbar"
|
|
1186
1239
|
),
|
|
1187
|
-
|
|
1240
|
+
O?.()
|
|
1188
1241
|
] });
|
|
1189
1242
|
}
|
|
1190
|
-
),
|
|
1191
|
-
const
|
|
1192
|
-
return /* @__PURE__ */ ue(
|
|
1193
|
-
/* @__PURE__ */
|
|
1243
|
+
), $e = (n, t, e) => Math.min(Math.max(n, t), e), _r = ({ dragState: n, normalizedDistance: t, sizeScale: e, size: r }) => {
|
|
1244
|
+
const i = Math.max(r / 2, 1), s = 1 + t * 0.65, l = Math.max(0.65, 1 - t * 0.25), c = n.direction * t * 26 * e, d = 0.8 + t * 0.18, x = 3 * e, I = 6 * e, M = 22 * e, E = Math.abs(c) + I, h = c > 0 ? x : -Math.abs(c) - x, _ = Math.max(2.5, 3 * e), z = $e(n.offsetX, -i, i), j = $e(n.offsetY, -i, i), ut = i * 0.35, Q = z / i * ut, tt = j / i * ut, mt = Q * 0.45, Tt = tt * 0.45, D = Math.max(M * 0.38, 6), O = 0.65 + t * 0.2, P = n.active;
|
|
1245
|
+
return /* @__PURE__ */ ue(je, { children: [
|
|
1246
|
+
/* @__PURE__ */ st(
|
|
1194
1247
|
"div",
|
|
1195
1248
|
{
|
|
1196
1249
|
className: "aqvs-tap-scroll-circle-gradient",
|
|
1197
1250
|
style: {
|
|
1198
1251
|
transform: `scale(${l}, ${s})`,
|
|
1199
|
-
transition:
|
|
1252
|
+
transition: P ? "40ms transform ease-out" : "200ms ease transform"
|
|
1200
1253
|
}
|
|
1201
1254
|
}
|
|
1202
1255
|
),
|
|
1203
|
-
/* @__PURE__ */
|
|
1256
|
+
/* @__PURE__ */ st(
|
|
1204
1257
|
"div",
|
|
1205
1258
|
{
|
|
1206
|
-
className: "aqvs-sample-visual-
|
|
1259
|
+
className: "aqvs-sample-visual-pupil",
|
|
1207
1260
|
style: {
|
|
1208
1261
|
width: M,
|
|
1209
1262
|
height: M,
|
|
1210
|
-
transform: `translate(calc(-50% + ${
|
|
1211
|
-
transition:
|
|
1263
|
+
transform: `translate(calc(-50% + ${Q}px), calc(-50% + ${tt}px)) scale(${l}, ${d * s})`,
|
|
1264
|
+
transition: P ? "70ms transform ease-out" : "200ms ease transform"
|
|
1212
1265
|
}
|
|
1213
1266
|
}
|
|
1214
1267
|
),
|
|
1215
|
-
/* @__PURE__ */
|
|
1268
|
+
/* @__PURE__ */ st(
|
|
1216
1269
|
"div",
|
|
1217
1270
|
{
|
|
1218
|
-
className: "aqvs-sample-visual-
|
|
1271
|
+
className: "aqvs-sample-visual-highlight",
|
|
1219
1272
|
style: {
|
|
1220
|
-
width:
|
|
1221
|
-
height:
|
|
1222
|
-
transform: `translate(calc(-50% + ${
|
|
1223
|
-
opacity:
|
|
1273
|
+
width: D,
|
|
1274
|
+
height: D,
|
|
1275
|
+
transform: `translate(calc(-50% + ${mt}px), calc(-50% + ${Tt}px)) scale(${l}, ${s})`,
|
|
1276
|
+
opacity: O,
|
|
1224
1277
|
boxShadow: "0 0 8px rgba(255,255,255,0.45)",
|
|
1225
|
-
transition:
|
|
1278
|
+
transition: P ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
|
|
1226
1279
|
}
|
|
1227
1280
|
}
|
|
1228
1281
|
),
|
|
1229
|
-
/* @__PURE__ */
|
|
1282
|
+
/* @__PURE__ */ st(
|
|
1230
1283
|
"div",
|
|
1231
1284
|
{
|
|
1232
|
-
className: "aqvs-sample-visual-
|
|
1285
|
+
className: "aqvs-sample-visual-rod",
|
|
1233
1286
|
style: {
|
|
1234
|
-
width:
|
|
1235
|
-
height:
|
|
1236
|
-
transform: `translate(-50%, ${
|
|
1287
|
+
width: _,
|
|
1288
|
+
height: E,
|
|
1289
|
+
transform: `translate(-50%, ${h}px)`,
|
|
1237
1290
|
opacity: t,
|
|
1238
|
-
transition:
|
|
1291
|
+
transition: P ? "40ms height, 60ms opacity ease-out ease-out" : "200ms ease height, 120ms ease opacity"
|
|
1239
1292
|
}
|
|
1240
1293
|
}
|
|
1241
1294
|
)
|
|
1242
1295
|
] });
|
|
1243
|
-
},
|
|
1244
|
-
if (!Number.isFinite(
|
|
1296
|
+
}, Ne = 100, vr = (n) => {
|
|
1297
|
+
if (!Number.isFinite(n))
|
|
1245
1298
|
return 0n;
|
|
1246
|
-
const t = Math.trunc(
|
|
1299
|
+
const t = Math.trunc(n);
|
|
1247
1300
|
return t <= 0 ? 0n : BigInt(t);
|
|
1248
|
-
},
|
|
1249
|
-
if (!Number.isFinite(
|
|
1250
|
-
throw new Error(`valueFn returned a non-finite value at index ${t}: ${
|
|
1251
|
-
return
|
|
1252
|
-
}, he = (
|
|
1253
|
-
if (
|
|
1301
|
+
}, Oe = (n, t) => {
|
|
1302
|
+
if (!Number.isFinite(n))
|
|
1303
|
+
throw new Error(`valueFn returned a non-finite value at index ${t}: ${n}`);
|
|
1304
|
+
return n;
|
|
1305
|
+
}, he = (n) => {
|
|
1306
|
+
if (n <= 0 || !Number.isFinite(n))
|
|
1254
1307
|
return 0;
|
|
1255
|
-
const t = Math.trunc(
|
|
1308
|
+
const t = Math.trunc(n);
|
|
1256
1309
|
if (t <= 2147483647)
|
|
1257
1310
|
return t & -t;
|
|
1258
1311
|
const e = BigInt(t) & -BigInt(t);
|
|
1259
1312
|
return Number(e);
|
|
1260
1313
|
};
|
|
1261
|
-
class
|
|
1314
|
+
class le {
|
|
1262
1315
|
/**
|
|
1263
1316
|
* @private
|
|
1264
1317
|
* @property {Map<number, number>} tree - The Map storing the Fenwick tree structure, specifically the sums of deltas. It is 1-indexed.
|
|
@@ -1317,32 +1370,32 @@ class oe {
|
|
|
1317
1370
|
* @param {{ sampleRange?: { from: number; to: number }, materialize?: boolean }} [options] - Optional settings for initialization.
|
|
1318
1371
|
*/
|
|
1319
1372
|
reset(t, e, r) {
|
|
1320
|
-
const
|
|
1373
|
+
const i = Number.isFinite(t) && t > 0 ? Math.trunc(t) : 0;
|
|
1321
1374
|
if (typeof e != "function") {
|
|
1322
|
-
this.size =
|
|
1375
|
+
this.size = i, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.valueFn = void 0, this.baseValue = e, this.total = this.baseValue * this.size;
|
|
1323
1376
|
return;
|
|
1324
1377
|
}
|
|
1325
1378
|
let s = 0, l;
|
|
1326
|
-
if (
|
|
1327
|
-
const
|
|
1379
|
+
if (i > 0) {
|
|
1380
|
+
const c = r?.sampleRange ?? {
|
|
1328
1381
|
from: 0,
|
|
1329
|
-
to: Math.min(
|
|
1382
|
+
to: Math.min(Ne - 1, i - 1)
|
|
1330
1383
|
};
|
|
1331
|
-
let
|
|
1332
|
-
if (
|
|
1333
|
-
s =
|
|
1384
|
+
let d = Math.max(0, Math.trunc(c.from)), x = Math.min(Math.trunc(c.to), i - 1);
|
|
1385
|
+
if (d > x && (d = 0, x = Math.min(Ne - 1, i - 1)), i > Ne)
|
|
1386
|
+
s = le._sampleBaseValueStrided(e, i, Ne), r?.materialize && (l = { from: d, values: le._collectValidatedValues(e, d, x) });
|
|
1334
1387
|
else {
|
|
1335
|
-
const I =
|
|
1336
|
-
s =
|
|
1388
|
+
const I = le._collectValidatedValues(e, d, x);
|
|
1389
|
+
s = le._modeOrMedian([...I]), r?.materialize && (l = { from: d, values: I });
|
|
1337
1390
|
}
|
|
1338
1391
|
}
|
|
1339
|
-
if (this.size =
|
|
1340
|
-
for (let
|
|
1341
|
-
const
|
|
1342
|
-
if (
|
|
1392
|
+
if (this.size = i, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.total = void 0, this.valueFn = e, this.baseValue = s, l)
|
|
1393
|
+
for (let c = 0; c < l.values.length; c++) {
|
|
1394
|
+
const d = l.from + c;
|
|
1395
|
+
if (d >= this.size)
|
|
1343
1396
|
break;
|
|
1344
|
-
const x = l.values[
|
|
1345
|
-
x !== 0 && (this.deltas.set(
|
|
1397
|
+
const x = l.values[c] - this.baseValue;
|
|
1398
|
+
x !== 0 && (this.deltas.set(d, x), this._updateTree(d, x));
|
|
1346
1399
|
}
|
|
1347
1400
|
this.total = this.getTotal();
|
|
1348
1401
|
}
|
|
@@ -1371,10 +1424,10 @@ class oe {
|
|
|
1371
1424
|
* @returns {number[]} The validated (finite-only) values in index order.
|
|
1372
1425
|
*/
|
|
1373
1426
|
static _collectValidatedValues(t, e, r) {
|
|
1374
|
-
const
|
|
1427
|
+
const i = [];
|
|
1375
1428
|
for (let s = e; s <= r; s++)
|
|
1376
|
-
|
|
1377
|
-
return
|
|
1429
|
+
i.push(Oe(t(s), s));
|
|
1430
|
+
return i;
|
|
1378
1431
|
}
|
|
1379
1432
|
/**
|
|
1380
1433
|
* @private
|
|
@@ -1387,22 +1440,22 @@ class oe {
|
|
|
1387
1440
|
static _modeOrMedian(t) {
|
|
1388
1441
|
if (t.length === 0)
|
|
1389
1442
|
return 0;
|
|
1390
|
-
t.sort((l,
|
|
1443
|
+
t.sort((l, c) => l - c);
|
|
1391
1444
|
const e = Math.floor(t.length / 2);
|
|
1392
1445
|
let r;
|
|
1393
1446
|
t.length % 2 === 0 ? r = Math.floor((t[e - 1] + t[e]) / 2) : r = t[e];
|
|
1394
|
-
const
|
|
1447
|
+
const i = /* @__PURE__ */ new Map();
|
|
1395
1448
|
let s = 0;
|
|
1396
1449
|
for (const l of t) {
|
|
1397
|
-
const
|
|
1398
|
-
|
|
1450
|
+
const c = (i.get(l) ?? 0) + 1;
|
|
1451
|
+
i.set(l, c), c > s && (s = c);
|
|
1399
1452
|
}
|
|
1400
1453
|
if (s > t.length * 0.2) {
|
|
1401
1454
|
const l = [];
|
|
1402
|
-
for (const [
|
|
1403
|
-
x === s && l.push(
|
|
1404
|
-
const
|
|
1405
|
-
r = Math.floor(
|
|
1455
|
+
for (const [d, x] of i.entries())
|
|
1456
|
+
x === s && l.push(d);
|
|
1457
|
+
const c = l.reduce((d, x) => d + x, 0);
|
|
1458
|
+
r = Math.floor(c / l.length);
|
|
1406
1459
|
}
|
|
1407
1460
|
return r;
|
|
1408
1461
|
}
|
|
@@ -1419,12 +1472,12 @@ class oe {
|
|
|
1419
1472
|
static _sampleBaseValueStrided(t, e, r) {
|
|
1420
1473
|
if (e <= 0)
|
|
1421
1474
|
return 0;
|
|
1422
|
-
let
|
|
1423
|
-
|
|
1475
|
+
let i = Math.max(1, Math.ceil(e / r));
|
|
1476
|
+
i % 2 === 0 && (i += 1);
|
|
1424
1477
|
const s = [];
|
|
1425
|
-
for (let l = 0; l < e && s.length < r; l +=
|
|
1426
|
-
s.push(
|
|
1427
|
-
return
|
|
1478
|
+
for (let l = 0; l < e && s.length < r; l += i)
|
|
1479
|
+
s.push(Oe(t(l), l));
|
|
1480
|
+
return le._modeOrMedian(s);
|
|
1428
1481
|
}
|
|
1429
1482
|
/**
|
|
1430
1483
|
* @method update
|
|
@@ -1464,21 +1517,21 @@ class oe {
|
|
|
1464
1517
|
*/
|
|
1465
1518
|
updateDeltas(t) {
|
|
1466
1519
|
const e = /* @__PURE__ */ new Map();
|
|
1467
|
-
for (const { index: r, change:
|
|
1520
|
+
for (const { index: r, change: i } of t) {
|
|
1468
1521
|
if (r < 0 || r >= this.size)
|
|
1469
1522
|
throw new Error(`Index ${r} out of bounds`);
|
|
1470
1523
|
if (!Number.isInteger(r))
|
|
1471
1524
|
throw new Error(`Index must be an integer: ${r}`);
|
|
1472
|
-
if (!Number.isFinite(
|
|
1473
|
-
throw new Error(`Change must be a finite number: ${
|
|
1474
|
-
const l = (e.get(r) ?? this.deltas.get(r) ?? 0) +
|
|
1525
|
+
if (!Number.isFinite(i))
|
|
1526
|
+
throw new Error(`Change must be a finite number: ${i}`);
|
|
1527
|
+
const l = (e.get(r) ?? this.deltas.get(r) ?? 0) + i;
|
|
1475
1528
|
if (l + this.baseValue < -1e-9)
|
|
1476
1529
|
throw new Error(`Change would make the value at index ${r} negative: ${l + this.baseValue}`);
|
|
1477
1530
|
e.set(r, l);
|
|
1478
1531
|
}
|
|
1479
|
-
for (const { index: r, change:
|
|
1480
|
-
const l = (this.deltas.get(r) ?? 0) +
|
|
1481
|
-
l === 0 ? this.deltas.delete(r) : this.deltas.set(r, l), this._updateTree(r,
|
|
1532
|
+
for (const { index: r, change: i } of t) {
|
|
1533
|
+
const l = (this.deltas.get(r) ?? 0) + i;
|
|
1534
|
+
l === 0 ? this.deltas.delete(r) : this.deltas.set(r, l), this._updateTree(r, i);
|
|
1482
1535
|
}
|
|
1483
1536
|
return this.total;
|
|
1484
1537
|
}
|
|
@@ -1496,10 +1549,10 @@ class oe {
|
|
|
1496
1549
|
let r = t + 1;
|
|
1497
1550
|
for (; r <= this.size; ) {
|
|
1498
1551
|
this.tree.set(r, (this.tree.get(r) ?? 0) + e);
|
|
1499
|
-
const
|
|
1500
|
-
if (
|
|
1552
|
+
const i = he(r);
|
|
1553
|
+
if (i === 0)
|
|
1501
1554
|
break;
|
|
1502
|
-
r +=
|
|
1555
|
+
r += i;
|
|
1503
1556
|
}
|
|
1504
1557
|
this.total !== void 0 && (this.total += e);
|
|
1505
1558
|
}
|
|
@@ -1513,17 +1566,17 @@ class oe {
|
|
|
1513
1566
|
*/
|
|
1514
1567
|
_buildDeltaUpdates(t) {
|
|
1515
1568
|
const e = [], r = /* @__PURE__ */ new Map();
|
|
1516
|
-
for (const { index:
|
|
1517
|
-
if (
|
|
1518
|
-
throw new Error(`Index ${
|
|
1519
|
-
if (!Number.isInteger(
|
|
1520
|
-
throw new Error(`Index must be an integer: ${
|
|
1569
|
+
for (const { index: i, value: s } of t) {
|
|
1570
|
+
if (i < 0 || i >= this.size)
|
|
1571
|
+
throw new Error(`Index ${i} out of bounds`);
|
|
1572
|
+
if (!Number.isInteger(i))
|
|
1573
|
+
throw new Error(`Index must be an integer: ${i}`);
|
|
1521
1574
|
if (!Number.isFinite(s))
|
|
1522
1575
|
throw new Error(`Value must be a finite number: ${s}`);
|
|
1523
1576
|
if (s < 0)
|
|
1524
1577
|
throw new Error("Value cannot be negative.");
|
|
1525
|
-
const l = r.has(
|
|
1526
|
-
|
|
1578
|
+
const l = r.has(i) ? r.get(i) ?? 0 : this.deltas.get(i) ?? 0, c = l + this.baseValue, d = s - c;
|
|
1579
|
+
d !== 0 && e.push({ index: i, change: d }), r.set(i, l + d);
|
|
1527
1580
|
}
|
|
1528
1581
|
return e;
|
|
1529
1582
|
}
|
|
@@ -1557,7 +1610,7 @@ class oe {
|
|
|
1557
1610
|
*/
|
|
1558
1611
|
_materialize(t, e = !0) {
|
|
1559
1612
|
if (this.valueFn) {
|
|
1560
|
-
const r = this.deltas.get(t) ?? 0, s =
|
|
1613
|
+
const r = this.deltas.get(t) ?? 0, s = Oe(this.valueFn(t), t) - this.baseValue;
|
|
1561
1614
|
if (s !== r && (s === 0 ? this.deltas.delete(t) : this.deltas.set(t, s), e)) {
|
|
1562
1615
|
const l = s - r;
|
|
1563
1616
|
this._updateTree(t, l);
|
|
@@ -1576,11 +1629,11 @@ class oe {
|
|
|
1576
1629
|
_materializeRanges(t, e, r = !1) {
|
|
1577
1630
|
if (!(t?.materialize && this.valueFn))
|
|
1578
1631
|
return;
|
|
1579
|
-
const
|
|
1580
|
-
if (
|
|
1581
|
-
for (const
|
|
1582
|
-
const
|
|
1583
|
-
for (let I =
|
|
1632
|
+
const i = t.ranges;
|
|
1633
|
+
if (i && i.length > 0) {
|
|
1634
|
+
for (const c of i) {
|
|
1635
|
+
const d = Math.max(0, Math.trunc(c.from)), x = Math.min(Math.trunc(c.to), this.size - 1);
|
|
1636
|
+
for (let I = d; I <= x; I++)
|
|
1584
1637
|
this._materialize(I);
|
|
1585
1638
|
}
|
|
1586
1639
|
if (e === void 0)
|
|
@@ -1589,7 +1642,7 @@ class oe {
|
|
|
1589
1642
|
this._materialize(e);
|
|
1590
1643
|
return;
|
|
1591
1644
|
}
|
|
1592
|
-
const s =
|
|
1645
|
+
const s = i[0].from, l = i[i.length - 1].to;
|
|
1593
1646
|
e >= s && e <= l && this._materialize(e);
|
|
1594
1647
|
return;
|
|
1595
1648
|
}
|
|
@@ -1611,15 +1664,15 @@ class oe {
|
|
|
1611
1664
|
if (this.size === 0)
|
|
1612
1665
|
return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1613
1666
|
this._materializeRanges(e.materializeOption);
|
|
1614
|
-
const
|
|
1667
|
+
const i = e.materializeOption?.materialize === !0;
|
|
1615
1668
|
let s;
|
|
1616
1669
|
for (; ; ) {
|
|
1617
1670
|
if (s = this._descend(t, r), s < 0 || s >= this.size)
|
|
1618
1671
|
return { index: -1, total: this.total ?? this.getTotal(), cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1619
|
-
if (!
|
|
1672
|
+
if (!i)
|
|
1620
1673
|
break;
|
|
1621
|
-
const
|
|
1622
|
-
if (this._materialize(s), (this.deltas.get(s) ?? 0) ===
|
|
1674
|
+
const c = this.deltas.get(s) ?? 0;
|
|
1675
|
+
if (this._materialize(s), (this.deltas.get(s) ?? 0) === c)
|
|
1623
1676
|
break;
|
|
1624
1677
|
}
|
|
1625
1678
|
const l = this.prefixSum(s);
|
|
@@ -1641,14 +1694,14 @@ class oe {
|
|
|
1641
1694
|
* @returns {number} The candidate index (may be out of range when no index satisfies the condition).
|
|
1642
1695
|
*/
|
|
1643
1696
|
_descend(t, e) {
|
|
1644
|
-
let r = 0,
|
|
1697
|
+
let r = 0, i = 0, s = 1;
|
|
1645
1698
|
for (; s << 1 <= this.size; )
|
|
1646
1699
|
s <<= 1;
|
|
1647
1700
|
for (; s > 0; s >>= 1) {
|
|
1648
1701
|
const l = r + s;
|
|
1649
1702
|
if (l <= this.size) {
|
|
1650
|
-
const
|
|
1651
|
-
(e ?
|
|
1703
|
+
const d = (this.tree.get(l) ?? 0) + this.baseValue * s;
|
|
1704
|
+
(e ? i + d < t : i + d <= t) && (r = l, i += d);
|
|
1652
1705
|
}
|
|
1653
1706
|
}
|
|
1654
1707
|
return e ? r : r - 1;
|
|
@@ -1661,38 +1714,38 @@ class oe {
|
|
|
1661
1714
|
_findIndexLarge(t, e, r) {
|
|
1662
1715
|
if (this.size === 0)
|
|
1663
1716
|
return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1664
|
-
const
|
|
1665
|
-
if (
|
|
1717
|
+
const i = vr(this.size);
|
|
1718
|
+
if (i === 0n)
|
|
1666
1719
|
return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1667
1720
|
this._materializeRanges(e.materializeOption);
|
|
1668
1721
|
const s = e.materializeOption?.materialize === !0;
|
|
1669
1722
|
for (; ; ) {
|
|
1670
|
-
let l = 0n,
|
|
1671
|
-
for (; l <=
|
|
1672
|
-
const
|
|
1673
|
-
if (I =
|
|
1674
|
-
if (
|
|
1675
|
-
if (
|
|
1723
|
+
let l = 0n, c = i - 1n, d, x, I = this.total;
|
|
1724
|
+
for (; l <= c; ) {
|
|
1725
|
+
const h = l + c >> 1n, _ = Number(h), z = this.prefixSum(_);
|
|
1726
|
+
if (I = z.total, r ? z.cumulative >= t : z.cumulative <= t)
|
|
1727
|
+
if (d = h, x = z, r) {
|
|
1728
|
+
if (h === 0n)
|
|
1676
1729
|
break;
|
|
1677
|
-
|
|
1730
|
+
c = h - 1n;
|
|
1678
1731
|
} else
|
|
1679
|
-
l =
|
|
1732
|
+
l = h + 1n;
|
|
1680
1733
|
else if (r)
|
|
1681
|
-
l =
|
|
1734
|
+
l = h + 1n;
|
|
1682
1735
|
else {
|
|
1683
|
-
if (
|
|
1736
|
+
if (h === 0n)
|
|
1684
1737
|
break;
|
|
1685
|
-
|
|
1738
|
+
c = h - 1n;
|
|
1686
1739
|
}
|
|
1687
1740
|
}
|
|
1688
|
-
const M = x,
|
|
1689
|
-
if (s &&
|
|
1690
|
-
const
|
|
1691
|
-
if (this._materialize(
|
|
1741
|
+
const M = x, E = d !== void 0 ? Number(d) : -1;
|
|
1742
|
+
if (s && E >= 0) {
|
|
1743
|
+
const h = this.deltas.get(E) ?? 0;
|
|
1744
|
+
if (this._materialize(E), (this.deltas.get(E) ?? 0) !== h)
|
|
1692
1745
|
continue;
|
|
1693
1746
|
}
|
|
1694
1747
|
return {
|
|
1695
|
-
index:
|
|
1748
|
+
index: E,
|
|
1696
1749
|
total: I,
|
|
1697
1750
|
cumulative: M?.cumulative,
|
|
1698
1751
|
currentValue: M?.currentValue,
|
|
@@ -1713,19 +1766,19 @@ class oe {
|
|
|
1713
1766
|
return { cumulative: 0, total: this.total, currentValue: 0, safeIndex: 0 };
|
|
1714
1767
|
if (this.size === 0)
|
|
1715
1768
|
return { cumulative: 0, total: this.total ?? 0, currentValue: 0, safeIndex: 0 };
|
|
1716
|
-
const r =
|
|
1717
|
-
this._materializeRanges(
|
|
1769
|
+
const r = It(Math.trunc(t), 0, this.size - 1), i = e?.materializeOption;
|
|
1770
|
+
this._materializeRanges(i, r, !0);
|
|
1718
1771
|
let s = 0, l = r + 1;
|
|
1719
1772
|
for (; l > 0; ) {
|
|
1720
|
-
const
|
|
1721
|
-
s +=
|
|
1773
|
+
const d = this.tree.get(l) ?? 0;
|
|
1774
|
+
s += d;
|
|
1722
1775
|
const x = he(l);
|
|
1723
1776
|
if (x === 0)
|
|
1724
1777
|
break;
|
|
1725
1778
|
l -= x;
|
|
1726
1779
|
}
|
|
1727
|
-
const
|
|
1728
|
-
return { cumulative: s + this.baseValue * (r + 1), total: this.total, currentValue:
|
|
1780
|
+
const c = i?.materialize ? this.get(r) : (this.deltas.get(r) || 0) + this.baseValue;
|
|
1781
|
+
return { cumulative: s + this.baseValue * (r + 1), total: this.total, currentValue: c, safeIndex: r };
|
|
1729
1782
|
}
|
|
1730
1783
|
/**
|
|
1731
1784
|
* @method get
|
|
@@ -1758,7 +1811,7 @@ class oe {
|
|
|
1758
1811
|
else {
|
|
1759
1812
|
this.total = this._computeTreeTotal();
|
|
1760
1813
|
const r = this.prefixSum(this.getSize() - 1);
|
|
1761
|
-
r.cumulative !== r.total &&
|
|
1814
|
+
r.cumulative !== r.total && C.error("Inconsistent Fenwick Tree state");
|
|
1762
1815
|
}
|
|
1763
1816
|
return this.total;
|
|
1764
1817
|
}
|
|
@@ -1772,16 +1825,16 @@ class oe {
|
|
|
1772
1825
|
rebuildTree(t) {
|
|
1773
1826
|
if (t?.materialize && this.valueFn) {
|
|
1774
1827
|
const r = this.valueFn;
|
|
1775
|
-
this.reset(this.size, (
|
|
1828
|
+
this.reset(this.size, (i) => r(i), { materialize: !0 });
|
|
1776
1829
|
return;
|
|
1777
1830
|
}
|
|
1778
1831
|
const e = /* @__PURE__ */ new Map();
|
|
1779
|
-
for (const [r,
|
|
1780
|
-
if (
|
|
1832
|
+
for (const [r, i] of this.deltas.entries()) {
|
|
1833
|
+
if (i === 0)
|
|
1781
1834
|
continue;
|
|
1782
1835
|
let s = r + 1;
|
|
1783
1836
|
for (; s <= this.size; ) {
|
|
1784
|
-
e.set(s, (e.get(s) ?? 0) +
|
|
1837
|
+
e.set(s, (e.get(s) ?? 0) + i);
|
|
1785
1838
|
const l = he(s);
|
|
1786
1839
|
if (l === 0)
|
|
1787
1840
|
break;
|
|
@@ -1794,14 +1847,19 @@ class oe {
|
|
|
1794
1847
|
* @method calculateAccumulatedError
|
|
1795
1848
|
* @description Compares the cached total sum with a theoretical total calculated directly from the source values (`deltas` and `baseValue`, or `valueFn`). This helps detect any discrepancy in the tree's cached state, which might be caused by floating-point errors or other inconsistencies.
|
|
1796
1849
|
* @description キャッシュされている合計値と、元の値 (`deltas` と `baseValue`、または `valueFn`) から直接計算した理論上の合計値とを比較します。これにより、浮動小数点数の累積誤差やその他の不整合によって生じる可能性のある、ツリーのキャッシュ状態の不一致を検出できます。
|
|
1850
|
+
*
|
|
1851
|
+
* ❗ 集計対象は `[0, size)` の範囲内にある delta だけです。`changeSize(0)` は
|
|
1852
|
+
* ロード中の一時クリアとみなして delta を温存する (再伸長時にキャッシュを再利用するため) ので、
|
|
1853
|
+
* 範囲外の delta まで数えると**木は健全なのに空リストの間ずっと非ゼロ**が返り、
|
|
1854
|
+
* この値を破損検知に使う利用者が毎回不要な復旧処理を走らせてしまいます。
|
|
1797
1855
|
* @returns {number} The difference between the cached total and the theoretical total.
|
|
1798
1856
|
*/
|
|
1799
1857
|
calculateAccumulatedError() {
|
|
1800
1858
|
if (this.total === void 0)
|
|
1801
1859
|
return 0;
|
|
1802
1860
|
let t = this.baseValue * this.size;
|
|
1803
|
-
for (const e of this.deltas
|
|
1804
|
-
t +=
|
|
1861
|
+
for (const [e, r] of this.deltas)
|
|
1862
|
+
e < this.size && (t += r);
|
|
1805
1863
|
return this.total - t;
|
|
1806
1864
|
}
|
|
1807
1865
|
/**
|
|
@@ -1818,6 +1876,18 @@ class oe {
|
|
|
1818
1876
|
* サイズ差分のみを受け取りインデックスの対応表は受け取らないため、要素は末尾に追加/末尾から削除
|
|
1819
1877
|
* されると仮定する。既存行は index↔高さ の対応を保つ。したがって中間挿入/削除は表現できず、その
|
|
1820
1878
|
* ような構造変更の後は index↔高さ の対応が保存されず、木の delta が誤った行へ適用されてしまう。
|
|
1879
|
+
* ❗ `changeSize(0)` は例外的に delta を消去しない。ロード中に一覧が一瞬空になるフローで
|
|
1880
|
+
* 実測済みの行高を捨てないための特例で、`changeSize(N > 0)` で再伸長したときに範囲内の delta が
|
|
1881
|
+
* そのまま復元される (範囲外の delta はそこで刈られる)。size が 0 に留まっている間、
|
|
1882
|
+
* `get()` / `getTotal()` は 0 を返し、`calculateAccumulatedError()` は範囲内 delta だけを
|
|
1883
|
+
* 集計するので 0 のままになる。**別データセットへ差し替える場合は温存が害になる**ため、
|
|
1884
|
+
* `reset()` を呼ぶか新しい `key` で作り直すこと。
|
|
1885
|
+
* ❗ `changeSize(0)` intentionally keeps its deltas so a list that briefly empties while loading
|
|
1886
|
+
* does not lose measured row heights; growing back restores the in-range ones (out-of-range
|
|
1887
|
+
* deltas are pruned then). While the size stays 0, `get()` / `getTotal()` return 0 and
|
|
1888
|
+
* `calculateAccumulatedError()` stays 0 because it only sums in-range deltas. Replacing the
|
|
1889
|
+
* dataset instead of reloading the same one must go through `reset()` or a fresh instance.
|
|
1890
|
+
*
|
|
1821
1891
|
* 中間で要素を挿入/削除する消費側は、代わりに木をリセットするか (`useFenwickMapTree` の
|
|
1822
1892
|
* `resetOnValueFnChange`。VirtualScroll では `resetOnGetItemHeightChange` として公開) 、新しい
|
|
1823
1893
|
* `key` でコンポーネントを再マウントすること。
|
|
@@ -1835,14 +1905,20 @@ class oe {
|
|
|
1835
1905
|
if (e === r)
|
|
1836
1906
|
return;
|
|
1837
1907
|
if (e > r)
|
|
1838
|
-
|
|
1908
|
+
if (r === 0 && this.deltas.size > 0) {
|
|
1909
|
+
for (const s of this.deltas.keys())
|
|
1910
|
+
s >= e && this.deltas.delete(s);
|
|
1911
|
+
this.size = e, this.rebuildTree();
|
|
1912
|
+
} else
|
|
1913
|
+
this._growSize(r, e);
|
|
1839
1914
|
else {
|
|
1840
|
-
|
|
1841
|
-
|
|
1915
|
+
if (e > 0)
|
|
1916
|
+
for (const s of this.deltas.keys())
|
|
1917
|
+
s >= e && this.deltas.delete(s);
|
|
1842
1918
|
this.size = e, this.rebuildTree();
|
|
1843
1919
|
}
|
|
1844
|
-
const
|
|
1845
|
-
|
|
1920
|
+
const i = this.prefixSum(this.getSize() - 1);
|
|
1921
|
+
i.cumulative !== i.total && C.error("Inconsistent Fenwick Tree state");
|
|
1846
1922
|
}
|
|
1847
1923
|
/**
|
|
1848
1924
|
* @private
|
|
@@ -1856,10 +1932,10 @@ class oe {
|
|
|
1856
1932
|
static _minCoveredLowBound(t, e) {
|
|
1857
1933
|
let r = 1;
|
|
1858
1934
|
for (; ; ) {
|
|
1859
|
-
const
|
|
1860
|
-
if (Math.floor(e /
|
|
1935
|
+
const i = r * 2;
|
|
1936
|
+
if (Math.floor(e / i) * i <= t)
|
|
1861
1937
|
break;
|
|
1862
|
-
r =
|
|
1938
|
+
r = i;
|
|
1863
1939
|
}
|
|
1864
1940
|
return r * Math.floor(t / r);
|
|
1865
1941
|
}
|
|
@@ -1873,7 +1949,7 @@ class oe {
|
|
|
1873
1949
|
* @param {number} oldSize - The previous size.
|
|
1874
1950
|
* @param {number} newSize - The new (larger) size.
|
|
1875
1951
|
*/
|
|
1876
|
-
_propagateDeltaToGrownNodes(t, e, r,
|
|
1952
|
+
_propagateDeltaToGrownNodes(t, e, r, i) {
|
|
1877
1953
|
let s = t + 1;
|
|
1878
1954
|
for (; s <= r; ) {
|
|
1879
1955
|
const l = he(s);
|
|
@@ -1881,7 +1957,7 @@ class oe {
|
|
|
1881
1957
|
break;
|
|
1882
1958
|
s += l;
|
|
1883
1959
|
}
|
|
1884
|
-
for (; s <=
|
|
1960
|
+
for (; s <= i; ) {
|
|
1885
1961
|
this.tree.set(s, (this.tree.get(s) ?? 0) + e);
|
|
1886
1962
|
const l = he(s);
|
|
1887
1963
|
if (l === 0)
|
|
@@ -1899,7 +1975,7 @@ class oe {
|
|
|
1899
1975
|
*/
|
|
1900
1976
|
_growSize(t, e) {
|
|
1901
1977
|
if (this.size = e, this.deltas.size > 0) {
|
|
1902
|
-
const r =
|
|
1978
|
+
const r = le._minCoveredLowBound(t, e);
|
|
1903
1979
|
if (t - r < this.deltas.size)
|
|
1904
1980
|
for (let s = r; s < t; s++) {
|
|
1905
1981
|
const l = this.deltas.get(s);
|
|
@@ -1920,6 +1996,34 @@ class oe {
|
|
|
1920
1996
|
getSize() {
|
|
1921
1997
|
return this.size;
|
|
1922
1998
|
}
|
|
1999
|
+
/**
|
|
2000
|
+
* @description Gets the base value of the tree — the height every row starts from before
|
|
2001
|
+
* its own delta is applied. `useFenwickMapTree` reads it to decide whether a `0 → N` growth
|
|
2002
|
+
* should re-sample from scratch (`reset`) or reuse the measured heights kept across the
|
|
2003
|
+
* empty state (`changeSize`), so removing or renaming it silently disables that cache
|
|
2004
|
+
* preservation.
|
|
2005
|
+
*
|
|
2006
|
+
* ❗ This is NOT a "has the tree warmed up?" flag. `0` is a legitimate base — it is what a
|
|
2007
|
+
* tree constructed with `new FenwickMapTree(n, 0)` has, and what sampling produces when the
|
|
2008
|
+
* value function returns 0 for not-yet-measured rows (a common virtualization pattern).
|
|
2009
|
+
* Such a tree can hold plenty of measured deltas while `base` stays `0`. The hook's
|
|
2010
|
+
* `0 → N` guard therefore trades cache preservation for correctness in exactly that case:
|
|
2011
|
+
* a base of `0` cannot be distinguished from "never established", and growing incrementally
|
|
2012
|
+
* from a zero base would pin `total` at `0 × N = 0`.
|
|
2013
|
+
* @description ツリーの基準値 (各行が自身の delta を適用される前の高さ) を取得。
|
|
2014
|
+
* `useFenwickMapTree` は `0 → N` の伸長を再サンプリング (`reset`) と実測高さの温存 (`changeSize`) の
|
|
2015
|
+
* どちらへ倒すかの判定にこの値を読むため、削除・改名するとキャッシュ温存が黙って無効化される。
|
|
2016
|
+
*
|
|
2017
|
+
* ❗ **「木が温まったか」のフラグではない。** `0` は正当な基準値であり、
|
|
2018
|
+
* `new FenwickMapTree(n, 0)` や「未計測行に 0 を返す `getItemHeight`」(仮想化では定番) の
|
|
2019
|
+
* サンプリング結果として普通に発生する。その木は実測 delta を大量に持っていても `base` は `0` のまま。
|
|
2020
|
+
* フックの `0 → N` ガードは、まさにこの場合にキャッシュ温存より整合を優先する
|
|
2021
|
+
* (基準値 0 は「未確立」と区別できず、0 のまま増分伸長すると `total = 0 × N = 0` で固着するため)。
|
|
2022
|
+
* @returns {number} The base value. 基準値。
|
|
2023
|
+
*/
|
|
2024
|
+
get base() {
|
|
2025
|
+
return this.baseValue;
|
|
2026
|
+
}
|
|
1923
2027
|
/**
|
|
1924
2028
|
* @method findIndexAtOrAfter
|
|
1925
2029
|
* @description Finds the first index where the cumulative sum is greater than or equal to a target value.
|
|
@@ -1949,20 +2053,20 @@ class oe {
|
|
|
1949
2053
|
return this._findIndex(t, e ?? {}, !1);
|
|
1950
2054
|
}
|
|
1951
2055
|
}
|
|
1952
|
-
const
|
|
1953
|
-
const e =
|
|
2056
|
+
const Sr = (n, t) => {
|
|
2057
|
+
const e = n?.sampleRange, r = t?.sampleRange;
|
|
1954
2058
|
return e === r ? !1 : e && r ? e.from !== r.from || e.to !== r.to : !0;
|
|
1955
|
-
},
|
|
1956
|
-
const r = Number.isFinite(
|
|
1957
|
-
|
|
1958
|
-
const l =
|
|
2059
|
+
}, Mr = (n, t, e) => {
|
|
2060
|
+
const r = Number.isFinite(n) && n > 0 ? Math.trunc(n) : 0, i = T(null), s = T({ size: r, valueOrFn: t, options: e });
|
|
2061
|
+
i.current === null && (i.current = new le(r, t, e));
|
|
2062
|
+
const l = i.current, c = s.current, d = c.size !== r, x = c.valueOrFn !== t, I = Sr(c.options, e), M = c.size === 0 && r > 0 && (!i.current || i.current.base === 0);
|
|
1959
2063
|
if (x || I) {
|
|
1960
|
-
const
|
|
1961
|
-
I || x &&
|
|
1962
|
-
} else
|
|
2064
|
+
const E = e?.resetOnValueFnChange ?? !0;
|
|
2065
|
+
I || x && E || M ? (e?.debug && C.debug("[useFenwickMapTree] reset", { valueOrFnChanged: x, optionsChanged: I }), l.reset(r, t, e)) : (d && (e?.debug && C.debug("[useFenwickMapTree] resize (with valueFn change)", { from: c.size, to: r }), l.changeSize(r)), e?.debug && C.debug("[useFenwickMapTree] setValueFn (no reset)", { valueOrFnChanged: x }), l.setValueFn(t, { reset: !1 })), s.current = { size: r, valueOrFn: t, options: e };
|
|
2066
|
+
} else d && (e?.debug && C.debug("[useFenwickMapTree] resize", { from: c.size, to: r }), M ? l.reset(r, t, e) : l.changeSize(r), s.current = { size: r, valueOrFn: t, options: e });
|
|
1963
2067
|
return l;
|
|
1964
2068
|
};
|
|
1965
|
-
class
|
|
2069
|
+
class Pr {
|
|
1966
2070
|
key;
|
|
1967
2071
|
value;
|
|
1968
2072
|
prev = null;
|
|
@@ -1971,7 +2075,7 @@ class Sr {
|
|
|
1971
2075
|
this.key = t, this.value = e;
|
|
1972
2076
|
}
|
|
1973
2077
|
}
|
|
1974
|
-
class
|
|
2078
|
+
class Fe {
|
|
1975
2079
|
head = null;
|
|
1976
2080
|
tail = null;
|
|
1977
2081
|
/**
|
|
@@ -2012,11 +2116,11 @@ class _e {
|
|
|
2012
2116
|
this.remove(t), this.addToTail(t);
|
|
2013
2117
|
}
|
|
2014
2118
|
}
|
|
2015
|
-
function
|
|
2016
|
-
const t =
|
|
2017
|
-
|
|
2018
|
-
if (
|
|
2019
|
-
|
|
2119
|
+
function yr(n) {
|
|
2120
|
+
const t = T(/* @__PURE__ */ new Map()), e = T(new Fe()), r = Math.floor(n), i = T(r);
|
|
2121
|
+
Y(() => {
|
|
2122
|
+
if (i.current = r, Number.isNaN(r) || r < 0) {
|
|
2123
|
+
C.warn(`useLruCache: invalid capacity ${n}; the cache will not store any entries.`), t.current.clear(), e.current = new Fe();
|
|
2020
2124
|
return;
|
|
2021
2125
|
}
|
|
2022
2126
|
if (Number.isFinite(r))
|
|
@@ -2027,228 +2131,228 @@ function Mr(i) {
|
|
|
2027
2131
|
else
|
|
2028
2132
|
break;
|
|
2029
2133
|
}
|
|
2030
|
-
}, [
|
|
2134
|
+
}, [n, r]);
|
|
2031
2135
|
const s = S((I) => {
|
|
2032
2136
|
const M = t.current.get(I);
|
|
2033
2137
|
if (M)
|
|
2034
2138
|
return e.current.moveToTail(M), M.value;
|
|
2035
2139
|
}, []), l = S((I, M) => {
|
|
2036
|
-
const
|
|
2037
|
-
if (Number.isNaN(
|
|
2140
|
+
const E = i.current;
|
|
2141
|
+
if (Number.isNaN(E) || E <= 0)
|
|
2038
2142
|
return;
|
|
2039
|
-
let
|
|
2040
|
-
if (
|
|
2041
|
-
|
|
2143
|
+
let h = t.current.get(I);
|
|
2144
|
+
if (h)
|
|
2145
|
+
h.value = M, e.current.moveToTail(h);
|
|
2042
2146
|
else {
|
|
2043
|
-
if (t.current.size >=
|
|
2044
|
-
const
|
|
2045
|
-
|
|
2147
|
+
if (t.current.size >= E) {
|
|
2148
|
+
const _ = e.current.removeHead();
|
|
2149
|
+
_ && t.current.delete(_.key);
|
|
2046
2150
|
}
|
|
2047
|
-
|
|
2151
|
+
h = new Pr(I, M), t.current.set(I, h), e.current.addToTail(h);
|
|
2048
2152
|
}
|
|
2049
|
-
}, []),
|
|
2153
|
+
}, []), c = S((I) => t.current.has(I), []), d = S((I) => {
|
|
2050
2154
|
const M = t.current.get(I);
|
|
2051
2155
|
M && (e.current.remove(M), t.current.delete(I));
|
|
2052
2156
|
}, []), x = S(() => {
|
|
2053
|
-
t.current.clear(), e.current = new
|
|
2157
|
+
t.current.clear(), e.current = new Fe();
|
|
2054
2158
|
}, []);
|
|
2055
|
-
return
|
|
2159
|
+
return At(() => ({ get: s, set: l, has: c, remove: d, clear: x }), [s, l, c, d, x]);
|
|
2056
2160
|
}
|
|
2057
|
-
const
|
|
2058
|
-
const { get:
|
|
2059
|
-
return
|
|
2060
|
-
},
|
|
2061
|
-
top: Math.max(0,
|
|
2062
|
-
bottom: Math.max(0,
|
|
2063
|
-
}),
|
|
2064
|
-
if (!Number.isFinite(
|
|
2065
|
-
const t = Math.trunc(
|
|
2161
|
+
const wr = 1e4, kr = () => {
|
|
2162
|
+
const { get: n, set: t, has: e, clear: r } = yr(wr);
|
|
2163
|
+
return At(() => ({ get: n, set: t, has: e, clear: r }), [n, t, e, r]);
|
|
2164
|
+
}, gt = (n, t) => t <= 0 ? 0 : It(n, 0, t - 1), Ue = (n) => ({
|
|
2165
|
+
top: Math.max(0, n?.top ?? 0),
|
|
2166
|
+
bottom: Math.max(0, n?.bottom ?? 0)
|
|
2167
|
+
}), ne = (n, t) => n <= t ? 0 : n - t, ge = (n, t) => n <= 0 ? t : n + t, Ve = 1e3, Ke = 2e3, Rr = 1048576, Pe = (n) => {
|
|
2168
|
+
if (!Number.isFinite(n)) return 0n;
|
|
2169
|
+
const t = Math.trunc(n);
|
|
2066
2170
|
return t <= 0 ? 0n : BigInt(t);
|
|
2067
|
-
},
|
|
2068
|
-
const
|
|
2069
|
-
if (
|
|
2171
|
+
}, Cr = (n, t, e, r, i, s, l, c) => {
|
|
2172
|
+
const d = Pe(r);
|
|
2173
|
+
if (d === 0n)
|
|
2070
2174
|
return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
|
|
2071
|
-
const x = (
|
|
2072
|
-
let
|
|
2073
|
-
M === -1 ?
|
|
2074
|
-
const
|
|
2075
|
-
const
|
|
2076
|
-
if (!Number.isSafeInteger(
|
|
2175
|
+
const x = (D) => D < 0n ? 0n : D >= d ? d - 1n : D, I = { materializeOption: { materialize: !1 } }, { index: M, cumulative: E } = s.findIndexAtOrAfter(n, I);
|
|
2176
|
+
let h;
|
|
2177
|
+
M === -1 ? h = d - 1n : (E === n ? h = Pe(M + 1) : h = Pe(M), h >= d && (h = d - 1n)), n <= 0 && (h = 0n), c && n >= l && (h = d - 1n);
|
|
2178
|
+
const _ = (D) => {
|
|
2179
|
+
const O = Number(D);
|
|
2180
|
+
if (!Number.isSafeInteger(O))
|
|
2077
2181
|
return null;
|
|
2078
|
-
const { cumulative:
|
|
2079
|
-
if (!Number.isFinite(
|
|
2182
|
+
const { cumulative: P } = s.prefixSum(O, { materializeOption: { materialize: !1 } });
|
|
2183
|
+
if (!Number.isFinite(P))
|
|
2080
2184
|
return null;
|
|
2081
|
-
const { index:
|
|
2082
|
-
if (
|
|
2185
|
+
const { index: B } = s.findIndexAtOrAfter(P + 0.5, { materializeOption: { materialize: !1 } });
|
|
2186
|
+
if (B === -1)
|
|
2083
2187
|
return null;
|
|
2084
|
-
const
|
|
2085
|
-
return
|
|
2086
|
-
},
|
|
2087
|
-
let
|
|
2088
|
-
for (;
|
|
2089
|
-
const
|
|
2090
|
-
if (
|
|
2188
|
+
const N = Pe(B);
|
|
2189
|
+
return N > D ? N : null;
|
|
2190
|
+
}, z = (D) => {
|
|
2191
|
+
let O = 0, P = D, B = D, N = 0n, q = 0;
|
|
2192
|
+
for (; P < d && O < t; ) {
|
|
2193
|
+
const et = Number(P), G = i(et);
|
|
2194
|
+
if (O += G, B = P, P += 1n, N += 1n, !Number.isFinite(G) || G < 0)
|
|
2091
2195
|
break;
|
|
2092
|
-
if (
|
|
2093
|
-
if (
|
|
2094
|
-
const
|
|
2095
|
-
if (
|
|
2096
|
-
|
|
2097
|
-
else if (
|
|
2098
|
-
|
|
2196
|
+
if (G === 0) {
|
|
2197
|
+
if (q += 1, q > Ve) {
|
|
2198
|
+
const p = _(B);
|
|
2199
|
+
if (p !== null && p > P)
|
|
2200
|
+
P = p, q = 0;
|
|
2201
|
+
else if (p !== null && p === P && i(Number(P)) > 0)
|
|
2202
|
+
q = 0;
|
|
2099
2203
|
else
|
|
2100
2204
|
break;
|
|
2101
2205
|
}
|
|
2102
2206
|
} else
|
|
2103
|
-
|
|
2207
|
+
q = 0;
|
|
2104
2208
|
}
|
|
2105
|
-
return
|
|
2209
|
+
return N === 0n && (B = D), { height: O, end: B };
|
|
2106
2210
|
};
|
|
2107
|
-
let { height:
|
|
2108
|
-
if (
|
|
2109
|
-
let
|
|
2110
|
-
for (;
|
|
2111
|
-
|
|
2112
|
-
const
|
|
2113
|
-
if (
|
|
2211
|
+
let { height: j, end: ut } = z(h);
|
|
2212
|
+
if (j < t && h > 0n) {
|
|
2213
|
+
let D = h, O = j, P = 0;
|
|
2214
|
+
for (; D > 0n && O < t; ) {
|
|
2215
|
+
D -= 1n;
|
|
2216
|
+
const N = Number(D), q = i(N);
|
|
2217
|
+
if (O += q, !Number.isFinite(q) || q < 0)
|
|
2114
2218
|
break;
|
|
2115
|
-
if (
|
|
2116
|
-
if (
|
|
2117
|
-
const
|
|
2118
|
-
if (!Number.isSafeInteger(
|
|
2219
|
+
if (q === 0) {
|
|
2220
|
+
if (P += 1, P > Ve) {
|
|
2221
|
+
const et = Number(D);
|
|
2222
|
+
if (!Number.isSafeInteger(et))
|
|
2119
2223
|
break;
|
|
2120
|
-
const { cumulative:
|
|
2121
|
-
if (!Number.isFinite(
|
|
2224
|
+
const { cumulative: G } = s.prefixSum(et, { materializeOption: { materialize: !1 } });
|
|
2225
|
+
if (!Number.isFinite(G))
|
|
2122
2226
|
break;
|
|
2123
|
-
const { index:
|
|
2124
|
-
if (
|
|
2125
|
-
|
|
2126
|
-
else if (
|
|
2127
|
-
|
|
2227
|
+
const { index: p } = s.findIndexAtOrAfter(G - 0.5, { materializeOption: { materialize: !1 } }), $ = p === -1 ? -1n : Pe(p);
|
|
2228
|
+
if ($ >= 0n && $ < D)
|
|
2229
|
+
D = $ + 1n, P = 0;
|
|
2230
|
+
else if ($ === D && D >= 1n && i(Number(D - 1n)) > 0)
|
|
2231
|
+
P = 0;
|
|
2128
2232
|
else
|
|
2129
2233
|
break;
|
|
2130
2234
|
}
|
|
2131
2235
|
} else
|
|
2132
|
-
|
|
2236
|
+
P = 0;
|
|
2133
2237
|
}
|
|
2134
|
-
|
|
2135
|
-
const
|
|
2136
|
-
|
|
2238
|
+
h = x(D);
|
|
2239
|
+
const B = z(h);
|
|
2240
|
+
j = B.height, ut = B.end;
|
|
2137
2241
|
}
|
|
2138
|
-
const
|
|
2242
|
+
const Q = x(h), tt = x(ut), mt = x(Q - BigInt(Math.max(0, e))), Tt = x(tt + BigInt(Math.max(0, e)));
|
|
2139
2243
|
return {
|
|
2140
|
-
renderingStartIndex:
|
|
2141
|
-
renderingEndIndex:
|
|
2142
|
-
visibleStartIndex:
|
|
2143
|
-
visibleEndIndex:
|
|
2244
|
+
renderingStartIndex: gt(Number(mt), r),
|
|
2245
|
+
renderingEndIndex: gt(Number(Tt), r),
|
|
2246
|
+
visibleStartIndex: gt(Number(Q), r),
|
|
2247
|
+
visibleEndIndex: gt(Number(tt), r)
|
|
2144
2248
|
};
|
|
2145
|
-
},
|
|
2249
|
+
}, Er = (n, t, e, r, i, s, l) => {
|
|
2146
2250
|
if (r === 0)
|
|
2147
2251
|
return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
|
|
2148
|
-
const
|
|
2252
|
+
const c = Number.isFinite(l), d = c ? Math.min(Math.max(0, n), l) : Math.max(0, n);
|
|
2149
2253
|
if (r >= Number.MAX_SAFE_INTEGER)
|
|
2150
|
-
return
|
|
2151
|
-
const { index: x, cumulative: I, currentValue: M } = s.findIndexAtOrAfter(
|
|
2152
|
-
let
|
|
2153
|
-
if (x !== -1 && I ===
|
|
2154
|
-
|
|
2155
|
-
else if (
|
|
2156
|
-
|
|
2254
|
+
return Cr(d, t, e, r, i, s, l, c);
|
|
2255
|
+
const { index: x, cumulative: I, currentValue: M } = s.findIndexAtOrAfter(d, { materializeOption: { materialize: !1 } }), E = x === -1 ? t <= 0 || (I ?? 0) < d + (M ?? 0) ? r - 1 : 0 : x;
|
|
2256
|
+
let h = gt(E, r), _ = 0;
|
|
2257
|
+
if (x !== -1 && I === d)
|
|
2258
|
+
h = gt(x + 1, r), _ = 0;
|
|
2259
|
+
else if (h === x && I !== void 0 && M !== void 0)
|
|
2260
|
+
_ = I - M - d;
|
|
2157
2261
|
else {
|
|
2158
|
-
const { cumulative:
|
|
2159
|
-
|
|
2262
|
+
const { cumulative: D, currentValue: O } = s.prefixSum(h, { materializeOption: { materialize: !1 } });
|
|
2263
|
+
_ = (D ?? 0) - (O ?? 0) - d;
|
|
2160
2264
|
}
|
|
2161
|
-
const
|
|
2162
|
-
let
|
|
2163
|
-
for (;
|
|
2164
|
-
const
|
|
2165
|
-
if (
|
|
2265
|
+
const z = _, j = (D, O) => {
|
|
2266
|
+
let P = D, B = O, N = 0;
|
|
2267
|
+
for (; P < r && B < t; ) {
|
|
2268
|
+
const q = i(P);
|
|
2269
|
+
if (B += q, P++, !Number.isFinite(q) || q < 0)
|
|
2166
2270
|
break;
|
|
2167
|
-
if (
|
|
2168
|
-
if (
|
|
2169
|
-
const { cumulative:
|
|
2170
|
-
if (
|
|
2171
|
-
|
|
2172
|
-
else if (
|
|
2173
|
-
|
|
2271
|
+
if (q === 0) {
|
|
2272
|
+
if (N++, N > Ve) {
|
|
2273
|
+
const { cumulative: et } = s.prefixSum(P - 1, { materializeOption: { materialize: !1 } }), { index: G } = Number.isFinite(et) ? s.findIndexAtOrAfter(et + 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
|
|
2274
|
+
if (G > P)
|
|
2275
|
+
P = G, N = 0;
|
|
2276
|
+
else if (G === P && i(P) > 0)
|
|
2277
|
+
N = 0;
|
|
2174
2278
|
else
|
|
2175
2279
|
break;
|
|
2176
2280
|
}
|
|
2177
2281
|
} else
|
|
2178
|
-
|
|
2282
|
+
N = 0;
|
|
2179
2283
|
}
|
|
2180
|
-
return { cursor:
|
|
2181
|
-
},
|
|
2182
|
-
let
|
|
2183
|
-
if (
|
|
2184
|
-
let
|
|
2185
|
-
for (;
|
|
2186
|
-
const
|
|
2187
|
-
if (
|
|
2188
|
-
|
|
2284
|
+
return { cursor: P, height: B };
|
|
2285
|
+
}, ut = j(h, _);
|
|
2286
|
+
let Q = ut.cursor;
|
|
2287
|
+
if (_ = ut.height, _ < t && h > 0) {
|
|
2288
|
+
let D = _ + Math.abs(Math.min(0, z)), O = h - 1, P = 0;
|
|
2289
|
+
for (; O >= 0 && D < t; ) {
|
|
2290
|
+
const N = i(O);
|
|
2291
|
+
if (D += N, !Number.isFinite(N) || N < 0) {
|
|
2292
|
+
O--;
|
|
2189
2293
|
break;
|
|
2190
2294
|
}
|
|
2191
|
-
if (
|
|
2192
|
-
if (
|
|
2193
|
-
const { cumulative:
|
|
2194
|
-
if (
|
|
2195
|
-
|
|
2295
|
+
if (N === 0) {
|
|
2296
|
+
if (P++, P > Ve) {
|
|
2297
|
+
const { cumulative: q } = s.prefixSum(O, { materializeOption: { materialize: !1 } }), { index: et } = Number.isFinite(q) ? s.findIndexAtOrAfter(q - 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
|
|
2298
|
+
if (et !== -1 && et < O) {
|
|
2299
|
+
O = et, P = 0;
|
|
2196
2300
|
continue;
|
|
2197
2301
|
}
|
|
2198
|
-
if (
|
|
2199
|
-
|
|
2302
|
+
if (et === O && O >= 1 && i(O - 1) > 0)
|
|
2303
|
+
P = 0;
|
|
2200
2304
|
else {
|
|
2201
|
-
|
|
2305
|
+
O--;
|
|
2202
2306
|
break;
|
|
2203
2307
|
}
|
|
2204
2308
|
}
|
|
2205
2309
|
} else
|
|
2206
|
-
|
|
2207
|
-
|
|
2310
|
+
P = 0;
|
|
2311
|
+
O--;
|
|
2208
2312
|
}
|
|
2209
|
-
|
|
2210
|
-
const
|
|
2211
|
-
|
|
2313
|
+
h = gt(O + 1, r);
|
|
2314
|
+
const B = j(h, 0);
|
|
2315
|
+
Q = B.cursor, _ = B.height;
|
|
2212
2316
|
}
|
|
2213
|
-
const
|
|
2214
|
-
return { renderingStartIndex:
|
|
2215
|
-
},
|
|
2216
|
-
const r = Math.max(0, t ?? 0),
|
|
2217
|
-
return
|
|
2317
|
+
const tt = gt(h - e, r), mt = gt(Math.max(Q - 1, h), r), Tt = gt(mt + e, r);
|
|
2318
|
+
return { renderingStartIndex: tt, renderingEndIndex: Tt, visibleStartIndex: h, visibleEndIndex: mt };
|
|
2319
|
+
}, We = (n, t, e) => {
|
|
2320
|
+
const r = Math.max(0, t ?? 0), i = T({ last: 0, id: null, arg: null }).current;
|
|
2321
|
+
return Y(
|
|
2218
2322
|
() => () => {
|
|
2219
|
-
|
|
2323
|
+
i.id !== null && (cancelAnimationFrame(i.id), i.id = null);
|
|
2220
2324
|
},
|
|
2221
|
-
[
|
|
2325
|
+
[i]
|
|
2222
2326
|
), S(
|
|
2223
2327
|
(s) => {
|
|
2224
|
-
if (
|
|
2225
|
-
const l = (
|
|
2226
|
-
if (
|
|
2227
|
-
const
|
|
2228
|
-
if (r === 0 ||
|
|
2229
|
-
if (
|
|
2328
|
+
if (i.arg = s, i.id !== null) return;
|
|
2329
|
+
const l = (c) => {
|
|
2330
|
+
if (i.id = null, i.arg === null) return;
|
|
2331
|
+
const d = c - i.last;
|
|
2332
|
+
if (r === 0 || i.last === 0 || d >= r) {
|
|
2333
|
+
if (n.current)
|
|
2230
2334
|
try {
|
|
2231
|
-
e(
|
|
2335
|
+
e(n.current, i.arg);
|
|
2232
2336
|
} catch (x) {
|
|
2233
2337
|
console.error("[useThrottledInvoker] Error invoking callback", x);
|
|
2234
2338
|
}
|
|
2235
|
-
|
|
2339
|
+
i.arg = null, i.last = c;
|
|
2236
2340
|
}
|
|
2237
|
-
|
|
2341
|
+
i.arg !== null && (i.id = requestAnimationFrame(l));
|
|
2238
2342
|
};
|
|
2239
|
-
|
|
2343
|
+
i.id = requestAnimationFrame(l);
|
|
2240
2344
|
},
|
|
2241
|
-
[r, e,
|
|
2345
|
+
[r, e, n, i]
|
|
2242
2346
|
);
|
|
2243
|
-
},
|
|
2244
|
-
const I = S((
|
|
2245
|
-
|
|
2347
|
+
}, Nr = Je.memo(({ index: n, top: t, height: e, item: r, children: i, clipItemHeight: s, enableKeyboardNavigation: l, onKeyDown: c, onFocus: d, registerItemRef: x }) => {
|
|
2348
|
+
const I = S((_) => x(n, _), [n, x]), M = S((_) => c(_, n), [n, c]), E = S(() => d(n), [n, d]), h = S((_) => {
|
|
2349
|
+
_.currentTarget.focus({ preventScroll: !0 });
|
|
2246
2350
|
}, []);
|
|
2247
|
-
return /* @__PURE__ */
|
|
2351
|
+
return /* @__PURE__ */ st(
|
|
2248
2352
|
"div",
|
|
2249
2353
|
{
|
|
2250
2354
|
ref: I,
|
|
2251
|
-
"data-index":
|
|
2355
|
+
"data-index": n,
|
|
2252
2356
|
"data-virtualscroll-item": "true",
|
|
2253
2357
|
className: "aqvs-item-container",
|
|
2254
2358
|
style: {
|
|
@@ -2257,134 +2361,134 @@ const Pr = 1e4, Lr = () => {
|
|
|
2257
2361
|
overflow: s ? "hidden" : void 0
|
|
2258
2362
|
},
|
|
2259
2363
|
tabIndex: l ? -1 : void 0,
|
|
2260
|
-
onPointerDown: l ?
|
|
2364
|
+
onPointerDown: l ? h : void 0,
|
|
2261
2365
|
onKeyDownCapture: l ? M : void 0,
|
|
2262
|
-
onFocusCapture: l ?
|
|
2263
|
-
children:
|
|
2366
|
+
onFocusCapture: l ? E : void 0,
|
|
2367
|
+
children: i(r, n)
|
|
2264
2368
|
}
|
|
2265
2369
|
);
|
|
2266
|
-
}),
|
|
2267
|
-
itemCount:
|
|
2370
|
+
}), Vr = ({
|
|
2371
|
+
itemCount: n,
|
|
2268
2372
|
getItem: t,
|
|
2269
2373
|
getItemKey: e,
|
|
2270
2374
|
getItemHeight: r,
|
|
2271
|
-
viewportSize:
|
|
2375
|
+
viewportSize: i,
|
|
2272
2376
|
overscanCount: s = 15,
|
|
2273
2377
|
className: l,
|
|
2274
|
-
testId:
|
|
2275
|
-
onScroll:
|
|
2378
|
+
testId: c,
|
|
2379
|
+
onScroll: d,
|
|
2276
2380
|
onRangeChange: x,
|
|
2277
2381
|
children: I,
|
|
2278
2382
|
background: M,
|
|
2279
|
-
initialScrollIndex:
|
|
2280
|
-
initialScrollOffset:
|
|
2281
|
-
callbackThrottleMs:
|
|
2282
|
-
contentInsets:
|
|
2283
|
-
onItemFocus:
|
|
2284
|
-
scrollBarOptions:
|
|
2285
|
-
behaviorOptions:
|
|
2286
|
-
onWheelHorizontal:
|
|
2287
|
-
},
|
|
2288
|
-
const { width:
|
|
2383
|
+
initialScrollIndex: E,
|
|
2384
|
+
initialScrollOffset: h,
|
|
2385
|
+
callbackThrottleMs: _ = 5,
|
|
2386
|
+
contentInsets: z,
|
|
2387
|
+
onItemFocus: j,
|
|
2388
|
+
scrollBarOptions: ut,
|
|
2389
|
+
behaviorOptions: Q,
|
|
2390
|
+
onWheelHorizontal: tt
|
|
2391
|
+
}, mt) => {
|
|
2392
|
+
const { width: Tt, enableThumbDrag: D, enableTrackClick: O, enableArrowButtons: P, enableScrollToTopBottomButtons: B, renderThumbOverlay: N, tapScrollCircleOptions: q } = ut ?? {}, { enablePointerDrag: et, pointerDragInputs: G, enableKeyboardNavigation: p = !0, wheelSpeedMultiplier: $, inertiaOptions: St, clipItemHeight: Rt = !1, resetOnGetItemHeightChange: Z = !1 } = Q ?? {}, k = T(null), Ct = T({
|
|
2289
2393
|
renderingStartIndex: 0,
|
|
2290
2394
|
renderingEndIndex: 0,
|
|
2291
2395
|
visibleStartIndex: 0,
|
|
2292
2396
|
visibleEndIndex: 0,
|
|
2293
2397
|
scrollPosition: 0,
|
|
2294
2398
|
totalHeight: 0
|
|
2295
|
-
}),
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
}, [
|
|
2299
|
-
const
|
|
2300
|
-
const
|
|
2301
|
-
return { from: Math.max(0,
|
|
2302
|
-
}),
|
|
2399
|
+
}), U = T(null), Et = T(!1);
|
|
2400
|
+
Y(() => {
|
|
2401
|
+
Z && (U.current = null);
|
|
2402
|
+
}, [Z, r]);
|
|
2403
|
+
const y = At(() => Ue(z), [z]), [Yt] = Zt(() => {
|
|
2404
|
+
const u = typeof E == "number" && Number.isFinite(E) ? Math.max(0, Math.trunc(E)) : 0;
|
|
2405
|
+
return { from: Math.max(0, u - 50), to: u + 50 };
|
|
2406
|
+
}), Ht = At(
|
|
2303
2407
|
// 目的: Fenwick Tree のオプション設定
|
|
2304
2408
|
// 依存関係: resetOnGetItemHeightChange, initialSampleRange (マウント時固定)
|
|
2305
2409
|
// itemCount には依存させない (依存させると追記のたびに options 参照が変わり、計測済み高さが全消去される)。
|
|
2306
2410
|
// この useMemo により sampleRange を毎レンダー新規生成しない = 参照同一性由来の破壊的 reset を防ぐ。
|
|
2307
2411
|
() => ({
|
|
2308
|
-
sampleRange:
|
|
2309
|
-
resetOnValueFnChange:
|
|
2412
|
+
sampleRange: Yt,
|
|
2413
|
+
resetOnValueFnChange: Z,
|
|
2310
2414
|
materialize: !0
|
|
2311
2415
|
}),
|
|
2312
|
-
[
|
|
2313
|
-
), v =
|
|
2314
|
-
let o = 0,
|
|
2315
|
-
if (typeof
|
|
2316
|
-
const
|
|
2317
|
-
o = ge(
|
|
2318
|
-
} else typeof
|
|
2319
|
-
return { position: o, total:
|
|
2320
|
-
}), [
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
}, [x,
|
|
2324
|
-
const
|
|
2416
|
+
[Z, Yt]
|
|
2417
|
+
), v = Mr(n, r, Ht), [Xt] = Zt(() => {
|
|
2418
|
+
let o = 0, u = 0;
|
|
2419
|
+
if (typeof E == "number") {
|
|
2420
|
+
const m = It(E, 0, n - 1), V = It(m - s * 2, 0, n - 1), A = It(m + s * 2, 0, n - 1), F = E > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: V, to: A }] } } : void 0, { cumulative: K, total: W, currentValue: Pt } = v.prefixSum(E, F), pt = Math.max(K - Pt, 0);
|
|
2421
|
+
o = ge(pt, y.top), u = W ?? v.getTotal();
|
|
2422
|
+
} else typeof h == "number" && (o = ge(Math.max(h, 0), y.top)), u = v.getTotal();
|
|
2423
|
+
return { position: o, total: u };
|
|
2424
|
+
}), [Bt, Jt] = Zt(Xt.position), [at, jt] = Zt(Xt.total), f = T(Xt.position), dt = T(y.top), lt = T(d ?? void 0), H = T(x ?? void 0), it = T(/* @__PURE__ */ new Map()), J = T(null), yt = T(null), [wt, Nt] = Zt(null), [rt, Dt] = Zt(!1), Mt = T(null), ft = T(!1), ot = T(0), Lt = T(!1), $t = T(!1), Qt = T(n);
|
|
2425
|
+
Qt.current !== n && (Qt.current = n, $t.current = !0), Y(() => {
|
|
2426
|
+
lt.current = d ?? void 0, H.current = x ?? void 0;
|
|
2427
|
+
}, [x, d]);
|
|
2428
|
+
const ct = S(
|
|
2325
2429
|
(o) => {
|
|
2326
|
-
if (
|
|
2430
|
+
if (p && o && typeof o.focus == "function")
|
|
2327
2431
|
try {
|
|
2328
2432
|
o.focus({ preventScroll: !0 });
|
|
2329
2433
|
} catch {
|
|
2330
2434
|
o.focus();
|
|
2331
2435
|
}
|
|
2332
2436
|
},
|
|
2333
|
-
[
|
|
2334
|
-
),
|
|
2335
|
-
o(
|
|
2336
|
-
}, []),
|
|
2337
|
-
o(
|
|
2338
|
-
}, []),
|
|
2339
|
-
|
|
2340
|
-
const
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
}), []),
|
|
2344
|
-
|
|
2345
|
-
}, [
|
|
2346
|
-
const
|
|
2347
|
-
(o,
|
|
2348
|
-
if (!
|
|
2349
|
-
|
|
2437
|
+
[p]
|
|
2438
|
+
), g = S((o, { position: u, totalHeight: m }) => {
|
|
2439
|
+
o(u, m);
|
|
2440
|
+
}, []), w = We(lt, _, g), bt = S((o, u) => {
|
|
2441
|
+
o(u);
|
|
2442
|
+
}, []), qt = We(H, _, bt), xt = T(y.top);
|
|
2443
|
+
xt.current = y.top;
|
|
2444
|
+
const _t = T(w);
|
|
2445
|
+
_t.current = w, Y(() => (Et.current = !1, () => {
|
|
2446
|
+
Et.current = !0, Mt.current && (clearTimeout(Mt.current), Mt.current = null);
|
|
2447
|
+
}), []), Y(() => {
|
|
2448
|
+
p || (it.current.clear(), J.current = null, yt.current = null);
|
|
2449
|
+
}, [p]);
|
|
2450
|
+
const vt = S(
|
|
2451
|
+
(o, u) => {
|
|
2452
|
+
if (!u) {
|
|
2453
|
+
it.current.delete(o);
|
|
2350
2454
|
return;
|
|
2351
2455
|
}
|
|
2352
|
-
|
|
2456
|
+
p && (it.current.set(o, u), J.current === o && (J.current = null, yt.current = o, ct(u)));
|
|
2353
2457
|
},
|
|
2354
|
-
[
|
|
2355
|
-
),
|
|
2458
|
+
[p, ct]
|
|
2459
|
+
), Ut = 0.01, Ft = T({
|
|
2356
2460
|
rafId: null,
|
|
2357
2461
|
loopActive: !1,
|
|
2358
2462
|
idleFrames: 0,
|
|
2359
|
-
lastRenderedPosition:
|
|
2360
|
-
}),
|
|
2361
|
-
const o =
|
|
2463
|
+
lastRenderedPosition: Xt.position
|
|
2464
|
+
}), ie = S(() => {
|
|
2465
|
+
const o = Ft.current;
|
|
2362
2466
|
o.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(o.rafId), o.rafId = null, o.loopActive = !1, o.idleFrames = 0;
|
|
2363
2467
|
}, []);
|
|
2364
|
-
|
|
2468
|
+
Y(
|
|
2365
2469
|
() => () => {
|
|
2366
|
-
|
|
2470
|
+
ie();
|
|
2367
2471
|
},
|
|
2368
|
-
[
|
|
2472
|
+
[ie]
|
|
2369
2473
|
);
|
|
2370
|
-
const
|
|
2474
|
+
const xe = T(() => {
|
|
2371
2475
|
}), de = S(() => {
|
|
2372
|
-
const o =
|
|
2476
|
+
const o = Ft.current;
|
|
2373
2477
|
o.rafId = null;
|
|
2374
|
-
const
|
|
2375
|
-
if (
|
|
2376
|
-
|
|
2478
|
+
const u = f.current, m = ne(u, xt.current), V = v.getTotal();
|
|
2479
|
+
if (Jt((F) => Math.abs(F - u) < Ut ? F : u), Math.abs(o.lastRenderedPosition - u) >= Ut ? (_t.current({ position: m, totalHeight: V }), o.lastRenderedPosition = u, o.idleFrames = 0) : o.idleFrames += 1, o.idleFrames >= 2) {
|
|
2480
|
+
ie();
|
|
2377
2481
|
return;
|
|
2378
2482
|
}
|
|
2379
2483
|
if (typeof requestAnimationFrame == "function") {
|
|
2380
|
-
o.rafId = requestAnimationFrame((
|
|
2484
|
+
o.rafId = requestAnimationFrame((F) => xe.current(F));
|
|
2381
2485
|
return;
|
|
2382
2486
|
}
|
|
2383
2487
|
o.loopActive = !1;
|
|
2384
|
-
}, [v,
|
|
2385
|
-
|
|
2386
|
-
const
|
|
2387
|
-
const o =
|
|
2488
|
+
}, [v, ie]);
|
|
2489
|
+
xe.current = de;
|
|
2490
|
+
const Ie = S(() => {
|
|
2491
|
+
const o = Ft.current;
|
|
2388
2492
|
if (o.idleFrames = 0, !o.loopActive) {
|
|
2389
2493
|
if (o.loopActive = !0, typeof requestAnimationFrame == "function") {
|
|
2390
2494
|
o.rafId = requestAnimationFrame(de);
|
|
@@ -2392,440 +2496,444 @@ const Pr = 1e4, Lr = () => {
|
|
|
2392
2496
|
}
|
|
2393
2497
|
o.loopActive = !1;
|
|
2394
2498
|
}
|
|
2395
|
-
}, [de]),
|
|
2396
|
-
(o,
|
|
2397
|
-
const
|
|
2398
|
-
if (
|
|
2399
|
-
|
|
2499
|
+
}, [de]), nt = S(
|
|
2500
|
+
(o, u) => {
|
|
2501
|
+
const m = u?.immediate ?? !1, V = ne(o, y.top);
|
|
2502
|
+
if (f.current = o, m) {
|
|
2503
|
+
Ft.current.lastRenderedPosition = o, Ft.current.idleFrames = 0, Jt(o), w({ position: V, totalHeight: v.getTotal() });
|
|
2400
2504
|
return;
|
|
2401
2505
|
}
|
|
2402
|
-
|
|
2506
|
+
Ie();
|
|
2403
2507
|
},
|
|
2404
|
-
[
|
|
2405
|
-
),
|
|
2406
|
-
const
|
|
2407
|
-
if (!
|
|
2508
|
+
[Ie, v, y.top, w]
|
|
2509
|
+
), zt = S((o) => {
|
|
2510
|
+
const u = k.current;
|
|
2511
|
+
if (!u)
|
|
2408
2512
|
return o;
|
|
2409
|
-
const
|
|
2410
|
-
|
|
2411
|
-
const
|
|
2412
|
-
return
|
|
2413
|
-
}, []),
|
|
2414
|
-
|
|
2415
|
-
if (!
|
|
2416
|
-
if (
|
|
2417
|
-
const o = ge(Math.max(
|
|
2418
|
-
|
|
2513
|
+
const m = u.getScrollPosition();
|
|
2514
|
+
ot.current += 1;
|
|
2515
|
+
const V = u.scrollTo(o);
|
|
2516
|
+
return V === m && (ot.current = Math.max(0, ot.current - 1)), Math.abs(V - o) > 0.5 && (Lt.current = !0), V;
|
|
2517
|
+
}, []), Te = T(!1);
|
|
2518
|
+
Y(() => {
|
|
2519
|
+
if (!Te.current)
|
|
2520
|
+
if (Te.current = !0, typeof h == "number") {
|
|
2521
|
+
const o = ge(Math.max(h, 0), y.top), u = Math.abs(o - f.current) > 0.5;
|
|
2522
|
+
nt(o, { immediate: !0 }), u && k.current?.scrollTo(o);
|
|
2419
2523
|
} else
|
|
2420
|
-
|
|
2421
|
-
}, [
|
|
2524
|
+
nt(f.current, { immediate: !0 });
|
|
2525
|
+
}, [h, y.top, nt]), Y(() => {
|
|
2422
2526
|
const o = v.getTotal();
|
|
2423
|
-
if (
|
|
2424
|
-
|
|
2527
|
+
if (at !== o) {
|
|
2528
|
+
jt(o);
|
|
2425
2529
|
return;
|
|
2426
2530
|
}
|
|
2427
|
-
if (
|
|
2428
|
-
|
|
2429
|
-
const
|
|
2430
|
-
if (
|
|
2431
|
-
const
|
|
2432
|
-
|
|
2531
|
+
if (Lt.current) {
|
|
2532
|
+
Lt.current = !1;
|
|
2533
|
+
const u = k.current;
|
|
2534
|
+
if (u && Math.abs(u.getScrollPosition() - f.current) > 0.5) {
|
|
2535
|
+
const m = zt(f.current);
|
|
2536
|
+
Lt.current = !1, nt(m, { immediate: !0 });
|
|
2433
2537
|
}
|
|
2434
2538
|
}
|
|
2435
|
-
}, [v,
|
|
2436
|
-
if (
|
|
2437
|
-
const { index: o, align:
|
|
2438
|
-
if (
|
|
2439
|
-
const
|
|
2440
|
-
let
|
|
2441
|
-
|
|
2442
|
-
const
|
|
2443
|
-
Math.abs(
|
|
2444
|
-
from:
|
|
2445
|
-
to:
|
|
2446
|
-
targetIndex:
|
|
2447
|
-
}),
|
|
2539
|
+
}, [v, at, n, zt, nt]), Y(() => {
|
|
2540
|
+
if (U.current !== null) {
|
|
2541
|
+
const { index: o, align: u, offset: m } = U.current, V = gt(o, n), { cumulative: A, currentValue: F } = v.prefixSum(V, { materializeOption: { materialize: !1 } });
|
|
2542
|
+
if (A !== void 0 && F !== void 0) {
|
|
2543
|
+
const K = Math.max(A - F, 0);
|
|
2544
|
+
let W = K;
|
|
2545
|
+
u === "bottom" ? W = A - i : u === "center" && (W = K + F / 2 - i / 2), m && (W -= m), W = Math.max(0, W);
|
|
2546
|
+
const Pt = Math.max(0, at + y.top + y.bottom - i), pt = Math.min(ge(W, y.top), Pt);
|
|
2547
|
+
Math.abs(pt - f.current) > 1 && (C.debug("[VirtualScroll] Drift correction", {
|
|
2548
|
+
from: f.current,
|
|
2549
|
+
to: pt,
|
|
2550
|
+
targetIndex: V
|
|
2551
|
+
}), ot.current === 0 && (ot.current += 1), k.current?.scrollTo(pt), nt(pt, { immediate: !0 }));
|
|
2448
2552
|
}
|
|
2449
2553
|
}
|
|
2450
|
-
|
|
2451
|
-
}, [
|
|
2452
|
-
const o =
|
|
2453
|
-
if (o ===
|
|
2454
|
-
const
|
|
2455
|
-
|
|
2456
|
-
}, [
|
|
2457
|
-
const
|
|
2458
|
-
(o,
|
|
2459
|
-
if (
|
|
2554
|
+
$t.current = !1;
|
|
2555
|
+
}, [at, v, n, y.top, nt, i, y.bottom]), Y(() => {
|
|
2556
|
+
const o = dt.current;
|
|
2557
|
+
if (o === y.top) return;
|
|
2558
|
+
const u = ne(f.current, o), m = ge(u, y.top);
|
|
2559
|
+
dt.current = y.top, f.current = m, k.current?.scrollTo(m), nt(m, { immediate: !0 });
|
|
2560
|
+
}, [y.top, nt]);
|
|
2561
|
+
const ve = S(
|
|
2562
|
+
(o, u) => {
|
|
2563
|
+
if (n === 0)
|
|
2460
2564
|
return;
|
|
2461
|
-
const
|
|
2462
|
-
|
|
2463
|
-
let
|
|
2464
|
-
if (
|
|
2465
|
-
const
|
|
2466
|
-
|
|
2565
|
+
const m = gt(o, n), V = v.get(m), A = u - V, F = v.update(m, u);
|
|
2566
|
+
F !== void 0 && jt(F), C.debug("[VirtualScroll] Updated item size manually", { index: m, size: u, total: F });
|
|
2567
|
+
let K = U.current ? U.current.index : null;
|
|
2568
|
+
if (K === null) {
|
|
2569
|
+
const W = f.current, Pt = Ue(z).top, pt = ne(W, Pt), { index: ht, cumulative: kt } = v.findIndexAtOrAfter(pt, { materializeOption: { materialize: !1 } });
|
|
2570
|
+
K = kt !== void 0 && kt === pt ? ht + 1 : ht;
|
|
2467
2571
|
}
|
|
2468
|
-
if (
|
|
2469
|
-
const
|
|
2470
|
-
|
|
2572
|
+
if (K !== -1 && m < K && A !== 0) {
|
|
2573
|
+
const W = f.current, Pt = W + A;
|
|
2574
|
+
zt(Pt), nt(Pt, { immediate: !0 }), C.debug("[VirtualScroll] Adjusted scroll for layout shift (manual update)", { from: W, to: Pt, causedByIndex: m, delta: A, activeVisibleStartIndex: K });
|
|
2471
2575
|
}
|
|
2472
2576
|
},
|
|
2473
|
-
[v,
|
|
2474
|
-
),
|
|
2475
|
-
(o,
|
|
2476
|
-
if (!
|
|
2577
|
+
[v, n, zt, nt, z]
|
|
2578
|
+
), Wt = S(
|
|
2579
|
+
(o, u) => {
|
|
2580
|
+
if (!k.current || n === 0)
|
|
2477
2581
|
return;
|
|
2478
|
-
const
|
|
2479
|
-
if (
|
|
2582
|
+
const m = gt(o, n), V = gt(m - s * 2, n), A = gt(m + s * 2, n), { cumulative: F, total: K, currentValue: W } = v.prefixSum(m, { materializeOption: { materialize: !0, ranges: [{ from: V, to: A }] } });
|
|
2583
|
+
if (C.debug("[VirtualScroll] Scrolling to index:", m, "ItemBottom:", F, "Total height:", K, "ItemHeight:", W, "safeIndexFrom:", V, "safeIndexTo:", A), !K)
|
|
2480
2584
|
return;
|
|
2481
|
-
const
|
|
2482
|
-
let
|
|
2483
|
-
|
|
2484
|
-
const
|
|
2485
|
-
|
|
2486
|
-
index:
|
|
2487
|
-
align:
|
|
2488
|
-
offset:
|
|
2585
|
+
const Pt = Math.max(F - W, 0);
|
|
2586
|
+
let pt = Pt;
|
|
2587
|
+
u?.align === "bottom" ? pt = F - i : u?.align === "center" && (pt = Pt + W / 2 - i / 2), u?.offset && (pt -= u.offset), pt = Math.max(0, pt);
|
|
2588
|
+
const ht = ge(pt, y.top), kt = k.current?.getContentSize() ?? K + y.top + y.bottom, Vt = Math.max(0, kt - i), Ot = Math.min(ht, Vt);
|
|
2589
|
+
U.current = {
|
|
2590
|
+
index: m,
|
|
2591
|
+
align: u?.align,
|
|
2592
|
+
offset: u?.offset
|
|
2489
2593
|
};
|
|
2490
|
-
const
|
|
2491
|
-
|
|
2594
|
+
const Se = k.current?.getScrollPosition() ?? -1, De = Math.abs(Se - Ot) > 0.5;
|
|
2595
|
+
ft.current = !1, ot.current = 0, De && (ft.current = !0, ot.current += 1, k.current?.scrollTo(Ot)), jt(K), nt(Ot, { immediate: !0 }), C.debug("[VirtualScroll] Setting scroll position to:", Ot, { original: ht, max: Vt });
|
|
2492
2596
|
},
|
|
2493
|
-
[v, s,
|
|
2494
|
-
),
|
|
2597
|
+
[v, s, n, y.top, y.bottom, i, nt]
|
|
2598
|
+
), ye = S(
|
|
2495
2599
|
(o) => {
|
|
2496
|
-
if (!
|
|
2600
|
+
if (!k.current || n === 0)
|
|
2497
2601
|
return;
|
|
2498
|
-
const
|
|
2499
|
-
|
|
2602
|
+
const u = v.getTotal(), m = It(Math.floor(o), 0, u), { index: V, cumulative: A, currentValue: F } = v.findIndexAtOrAfter(m, { materializeOption: { materialize: !1 } }), W = (A ?? 0) - (F ?? 0) - m;
|
|
2603
|
+
Wt(V, { offset: W });
|
|
2500
2604
|
},
|
|
2501
|
-
[v,
|
|
2502
|
-
),
|
|
2605
|
+
[v, n, Wt]
|
|
2606
|
+
), fe = S(
|
|
2503
2607
|
(o) => {
|
|
2504
|
-
const
|
|
2505
|
-
|
|
2506
|
-
const
|
|
2507
|
-
return
|
|
2608
|
+
const u = ne(f.current, y.top), m = typeof o == "function" ? o(u) : o;
|
|
2609
|
+
ye(m);
|
|
2610
|
+
const V = k.current?.getScrollPosition(), A = typeof V == "number" ? V : f.current;
|
|
2611
|
+
return nt(A), A;
|
|
2508
2612
|
},
|
|
2509
|
-
[
|
|
2510
|
-
),
|
|
2511
|
-
(o,
|
|
2512
|
-
|
|
2513
|
-
const
|
|
2514
|
-
|
|
2515
|
-
const
|
|
2516
|
-
if (
|
|
2517
|
-
if (
|
|
2613
|
+
[y.top, ye, nt]
|
|
2614
|
+
), Ae = S(
|
|
2615
|
+
(o, u) => {
|
|
2616
|
+
C.debug("[VirtualScroll] Scroll position changed:", o);
|
|
2617
|
+
const m = ft.current;
|
|
2618
|
+
m && (ft.current = !1);
|
|
2619
|
+
const V = ot.current > 0;
|
|
2620
|
+
if (V && (ot.current = 0), m || V || $t.current || (U.current = null), nt(o), B) {
|
|
2621
|
+
if (m || V)
|
|
2518
2622
|
return;
|
|
2519
|
-
const
|
|
2520
|
-
if (
|
|
2521
|
-
const
|
|
2522
|
-
|
|
2523
|
-
|
|
2623
|
+
const A = o - u;
|
|
2624
|
+
if (C.debug("[VirtualScroll] Scroll diff:", A, "New:", o, "Prev:", u), Math.abs(A) > 1) {
|
|
2625
|
+
const F = A > 0 ? "down" : "up";
|
|
2626
|
+
Nt(F), Dt(!0), C.debug("[VirtualScroll] Showing scroll buttons. Direction:", F), Mt.current && clearTimeout(Mt.current), Mt.current = setTimeout(() => {
|
|
2627
|
+
Dt(!1), C.debug("[VirtualScroll] Hiding scroll buttons");
|
|
2524
2628
|
}, 2e3);
|
|
2525
2629
|
}
|
|
2526
2630
|
}
|
|
2527
2631
|
},
|
|
2528
|
-
[
|
|
2529
|
-
),
|
|
2530
|
-
const o = v.getTotal(),
|
|
2531
|
-
return
|
|
2532
|
-
...
|
|
2533
|
-
scrollPosition:
|
|
2632
|
+
[nt, B]
|
|
2633
|
+
), te = At(() => ne(Bt, y.top), [y.top, Bt]), se = At(() => {
|
|
2634
|
+
const o = v.getTotal(), u = Er(te, i, s, n, r, v, o);
|
|
2635
|
+
return C.debug("[VirtualScroll] Calculated rendering range:", () => ({
|
|
2636
|
+
...u,
|
|
2637
|
+
scrollPosition: te,
|
|
2534
2638
|
renderingContentSize: o,
|
|
2535
2639
|
overscanCount: s,
|
|
2536
|
-
viewportSize:
|
|
2537
|
-
})),
|
|
2538
|
-
}, [
|
|
2539
|
-
(o,
|
|
2540
|
-
if (!
|
|
2640
|
+
viewportSize: i
|
|
2641
|
+
})), u;
|
|
2642
|
+
}, [te, i, s, n, r, v]), { renderingStartIndex: Kt, renderingEndIndex: ee, visibleStartIndex: oe, visibleEndIndex: me } = se, re = S(
|
|
2643
|
+
(o, u) => {
|
|
2644
|
+
if (!p || n === 0)
|
|
2541
2645
|
return;
|
|
2542
|
-
const
|
|
2543
|
-
if (!(
|
|
2544
|
-
const
|
|
2545
|
-
|
|
2646
|
+
const m = gt(o, n);
|
|
2647
|
+
if (!(u?.ensureVisible ?? !0)) {
|
|
2648
|
+
const Vt = it.current.get(m);
|
|
2649
|
+
Vt && (J.current = null, yt.current = m, ct(Vt));
|
|
2546
2650
|
return;
|
|
2547
2651
|
}
|
|
2548
|
-
const
|
|
2549
|
-
if (
|
|
2550
|
-
|
|
2551
|
-
const
|
|
2552
|
-
|
|
2652
|
+
const A = v.prefixSum(m, { materializeOption: { materialize: !1 } }), F = A.currentValue, K = Math.max(A.cumulative - F, 0), W = K + F, Pt = ne(f.current, y.top), pt = Pt + i;
|
|
2653
|
+
if (K < Pt || W > pt) {
|
|
2654
|
+
Wt(m);
|
|
2655
|
+
const Vt = it.current.get(m);
|
|
2656
|
+
Vt ? (J.current = null, yt.current = m, ct(Vt)) : J.current = m;
|
|
2553
2657
|
return;
|
|
2554
2658
|
}
|
|
2555
|
-
const
|
|
2556
|
-
if (
|
|
2557
|
-
|
|
2659
|
+
const kt = it.current.get(m);
|
|
2660
|
+
if (kt) {
|
|
2661
|
+
J.current = null, yt.current = m, ct(kt);
|
|
2558
2662
|
return;
|
|
2559
2663
|
}
|
|
2560
|
-
|
|
2664
|
+
J.current = m;
|
|
2561
2665
|
},
|
|
2562
|
-
[
|
|
2666
|
+
[p, n, v, y.top, Wt, ct, i]
|
|
2563
2667
|
), we = S(
|
|
2564
|
-
(o,
|
|
2565
|
-
if (!
|
|
2668
|
+
(o, u) => {
|
|
2669
|
+
if (!p || o.defaultPrevented || o.altKey || o.metaKey || o.ctrlKey)
|
|
2566
2670
|
return;
|
|
2567
|
-
const
|
|
2568
|
-
if (
|
|
2569
|
-
const
|
|
2570
|
-
if (
|
|
2671
|
+
const m = o.target;
|
|
2672
|
+
if (m) {
|
|
2673
|
+
const V = m.tagName;
|
|
2674
|
+
if (V === "INPUT" || V === "TEXTAREA" || V === "SELECT" || m.isContentEditable)
|
|
2571
2675
|
return;
|
|
2572
2676
|
}
|
|
2573
2677
|
if (o.key === "ArrowDown") {
|
|
2574
|
-
|
|
2678
|
+
u < n - 1 && (o.preventDefault(), re(u + 1));
|
|
2575
2679
|
return;
|
|
2576
2680
|
}
|
|
2577
2681
|
if (o.key === "ArrowUp") {
|
|
2578
|
-
|
|
2682
|
+
u > 0 && (o.preventDefault(), re(u - 1));
|
|
2579
2683
|
return;
|
|
2580
2684
|
}
|
|
2581
2685
|
if (o.key === "PageDown") {
|
|
2582
|
-
if (
|
|
2686
|
+
if (u < n - 1) {
|
|
2583
2687
|
o.preventDefault();
|
|
2584
|
-
const { visibleStartIndex:
|
|
2585
|
-
|
|
2688
|
+
const { visibleStartIndex: V, visibleEndIndex: A } = Ct.current, F = Math.max(A - V + 1, 1), K = Math.max(F, 1), W = gt(Math.min(u + K, n - 1), n);
|
|
2689
|
+
re(W);
|
|
2586
2690
|
}
|
|
2587
2691
|
return;
|
|
2588
2692
|
}
|
|
2589
|
-
if (o.key === "PageUp" &&
|
|
2693
|
+
if (o.key === "PageUp" && u > 0) {
|
|
2590
2694
|
o.preventDefault();
|
|
2591
|
-
const { visibleStartIndex:
|
|
2592
|
-
|
|
2695
|
+
const { visibleStartIndex: V, visibleEndIndex: A } = Ct.current, F = Math.max(A - V + 1, 1), K = Math.max(F, 1), W = gt(u - K, n);
|
|
2696
|
+
re(W);
|
|
2593
2697
|
}
|
|
2594
2698
|
},
|
|
2595
|
-
[
|
|
2699
|
+
[p, n, re]
|
|
2596
2700
|
), Re = S(
|
|
2597
2701
|
(o) => {
|
|
2598
|
-
if (!
|
|
2702
|
+
if (!p)
|
|
2599
2703
|
return;
|
|
2600
|
-
const
|
|
2601
|
-
|
|
2704
|
+
const u = gt(o, n);
|
|
2705
|
+
J.current = null, yt.current = u, j?.(u);
|
|
2602
2706
|
},
|
|
2603
|
-
[
|
|
2707
|
+
[p, n, j]
|
|
2604
2708
|
);
|
|
2605
|
-
|
|
2606
|
-
const o =
|
|
2607
|
-
|
|
2608
|
-
renderingStartIndex:
|
|
2609
|
-
renderingEndIndex:
|
|
2610
|
-
visibleStartIndex:
|
|
2611
|
-
visibleEndIndex:
|
|
2612
|
-
scrollPositionState:
|
|
2613
|
-
paneScrollPosition:
|
|
2614
|
-
logicalScrollPosition:
|
|
2615
|
-
contentSize:
|
|
2709
|
+
Y(() => {
|
|
2710
|
+
const o = k.current?.getScrollPosition() ?? 0, u = f.current, m = ne(u, y.top);
|
|
2711
|
+
C.debug("[VirtualScroll] Range change effect triggered", () => ({
|
|
2712
|
+
renderingStartIndex: Kt,
|
|
2713
|
+
renderingEndIndex: ee,
|
|
2714
|
+
visibleStartIndex: oe,
|
|
2715
|
+
visibleEndIndex: me,
|
|
2716
|
+
scrollPositionState: Bt,
|
|
2717
|
+
paneScrollPosition: u,
|
|
2718
|
+
logicalScrollPosition: m,
|
|
2719
|
+
contentSize: at,
|
|
2616
2720
|
scrollPaneScrollPosition: o
|
|
2617
|
-
})),
|
|
2618
|
-
renderingStartIndex:
|
|
2619
|
-
renderingEndIndex:
|
|
2620
|
-
visibleStartIndex:
|
|
2621
|
-
visibleEndIndex:
|
|
2622
|
-
scrollPosition:
|
|
2623
|
-
totalHeight:
|
|
2721
|
+
})), qt({
|
|
2722
|
+
renderingStartIndex: Kt,
|
|
2723
|
+
renderingEndIndex: ee,
|
|
2724
|
+
visibleStartIndex: oe,
|
|
2725
|
+
visibleEndIndex: me,
|
|
2726
|
+
scrollPosition: m,
|
|
2727
|
+
totalHeight: at
|
|
2624
2728
|
});
|
|
2625
|
-
}, [
|
|
2626
|
-
const
|
|
2729
|
+
}, [at, ee, Kt, y.top, qt, Bt, me, oe]);
|
|
2730
|
+
const Ce = S(() => B ? /* @__PURE__ */ st("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": rt && wt !== null, children: wt === "up" ? /* @__PURE__ */ st("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ st(
|
|
2627
2731
|
"button",
|
|
2628
2732
|
{
|
|
2629
2733
|
type: "button",
|
|
2630
2734
|
className: "aqvs-scroll-to-edge-button",
|
|
2631
|
-
onClick: (
|
|
2632
|
-
|
|
2735
|
+
onClick: (m) => {
|
|
2736
|
+
m.stopPropagation(), ft.current = !0, Wt(0), Dt(!1);
|
|
2633
2737
|
},
|
|
2634
2738
|
children: "Top"
|
|
2635
2739
|
}
|
|
2636
|
-
) }) : /* @__PURE__ */
|
|
2740
|
+
) }) : /* @__PURE__ */ st("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-bottom", children: /* @__PURE__ */ st(
|
|
2637
2741
|
"button",
|
|
2638
2742
|
{
|
|
2639
2743
|
type: "button",
|
|
2640
2744
|
className: "aqvs-scroll-to-edge-button",
|
|
2641
|
-
onClick: (
|
|
2642
|
-
|
|
2745
|
+
onClick: (m) => {
|
|
2746
|
+
m.stopPropagation(), ft.current = !0, Wt(n - 1), Dt(!1);
|
|
2643
2747
|
},
|
|
2644
2748
|
children: "Bottom"
|
|
2645
2749
|
}
|
|
2646
|
-
) }) }) : null, [
|
|
2647
|
-
if (
|
|
2750
|
+
) }) }) : null, [B, rt, wt, Wt, n]), pe = T(0), { visibleItems: a, renderAnchor: b } = At(() => {
|
|
2751
|
+
if (n === 0)
|
|
2648
2752
|
return {
|
|
2649
|
-
visibleItems: /* @__PURE__ */
|
|
2753
|
+
visibleItems: /* @__PURE__ */ st("div", { className: "aqvs-no-items-container", children: /* @__PURE__ */ st("div", { className: "aqvs-no-items-text", children: "No items" }) }),
|
|
2650
2754
|
renderAnchor: 0
|
|
2651
2755
|
};
|
|
2652
|
-
const o =
|
|
2653
|
-
Number.isFinite(
|
|
2654
|
-
const
|
|
2655
|
-
let
|
|
2656
|
-
for (let
|
|
2657
|
-
if (
|
|
2658
|
-
|
|
2756
|
+
const o = gt(Kt, n), u = gt(ee, n), { cumulative: m, currentValue: V } = v.prefixSum(o, { materializeOption: { materialize: !1 } }), A = m - V;
|
|
2757
|
+
Number.isFinite(A) && Math.abs(A - pe.current) > Rr && (pe.current = A);
|
|
2758
|
+
const F = pe.current, K = [], W = [];
|
|
2759
|
+
let Pt = 0, pt = A;
|
|
2760
|
+
for (let ht = o; ht <= u; ht++) {
|
|
2761
|
+
if (W.length >= Ke) {
|
|
2762
|
+
C.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.", { cap: Ke, safeRenderingStartIndex: o, safeRenderingEndIndex: u });
|
|
2659
2763
|
break;
|
|
2660
2764
|
}
|
|
2661
|
-
const
|
|
2662
|
-
|
|
2663
|
-
const
|
|
2664
|
-
|
|
2665
|
-
/* @__PURE__ */
|
|
2666
|
-
|
|
2765
|
+
const kt = r(ht), Vt = v.get(ht), Ot = kt - Vt;
|
|
2766
|
+
Ot !== 0 && K.push({ index: ht, value: kt });
|
|
2767
|
+
const Se = pt + Pt, De = e ? e(ht) : ht;
|
|
2768
|
+
W.push(
|
|
2769
|
+
/* @__PURE__ */ st(
|
|
2770
|
+
Nr,
|
|
2667
2771
|
{
|
|
2668
|
-
index:
|
|
2669
|
-
top:
|
|
2670
|
-
height:
|
|
2671
|
-
item: t(
|
|
2672
|
-
clipItemHeight:
|
|
2673
|
-
enableKeyboardNavigation:
|
|
2772
|
+
index: ht,
|
|
2773
|
+
top: Se - F,
|
|
2774
|
+
height: kt,
|
|
2775
|
+
item: t(ht),
|
|
2776
|
+
clipItemHeight: Rt,
|
|
2777
|
+
enableKeyboardNavigation: p,
|
|
2674
2778
|
onKeyDown: we,
|
|
2675
2779
|
onFocus: Re,
|
|
2676
|
-
registerItemRef:
|
|
2780
|
+
registerItemRef: vt,
|
|
2677
2781
|
children: I
|
|
2678
2782
|
},
|
|
2679
|
-
|
|
2783
|
+
De
|
|
2680
2784
|
)
|
|
2681
|
-
),
|
|
2785
|
+
), Pt += Ot, pt += Vt;
|
|
2682
2786
|
}
|
|
2683
|
-
return
|
|
2684
|
-
if (
|
|
2787
|
+
return K.length > 0 && Promise.resolve().then(() => {
|
|
2788
|
+
if (Et.current)
|
|
2685
2789
|
return;
|
|
2686
|
-
let
|
|
2687
|
-
for (const
|
|
2688
|
-
if (
|
|
2689
|
-
const
|
|
2690
|
-
|
|
2790
|
+
let ht = 0;
|
|
2791
|
+
for (const Ot of K)
|
|
2792
|
+
if (Ot.index < oe) {
|
|
2793
|
+
const Se = v.get(Ot.index);
|
|
2794
|
+
ht += Ot.value - Se;
|
|
2691
2795
|
}
|
|
2692
|
-
const
|
|
2693
|
-
if (
|
|
2796
|
+
const kt = v.updates(K);
|
|
2797
|
+
if (Et.current || typeof kt != "number")
|
|
2694
2798
|
return;
|
|
2695
|
-
|
|
2696
|
-
const
|
|
2697
|
-
if (
|
|
2698
|
-
const
|
|
2699
|
-
|
|
2700
|
-
} else
|
|
2701
|
-
}), { visibleItems:
|
|
2799
|
+
jt(kt), C.debug("[VirtualScroll] Updated heights for items", K, "New total height:", kt);
|
|
2800
|
+
const Vt = k.current?.getScrollPosition() ?? f.current;
|
|
2801
|
+
if (ht !== 0) {
|
|
2802
|
+
const Ot = Vt + ht;
|
|
2803
|
+
zt(Ot), nt(Ot, { immediate: !0 }), C.debug("[VirtualScroll] Adjusted scroll for layout shift (auto update)", { from: Vt, to: Ot, shiftAmount: ht });
|
|
2804
|
+
} else Vt !== f.current && nt(Vt);
|
|
2805
|
+
}), { visibleItems: W, renderAnchor: F };
|
|
2702
2806
|
}, [
|
|
2703
2807
|
I,
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2808
|
+
Rt,
|
|
2809
|
+
at,
|
|
2810
|
+
p,
|
|
2811
|
+
n,
|
|
2708
2812
|
v,
|
|
2709
2813
|
t,
|
|
2710
2814
|
e,
|
|
2711
2815
|
r,
|
|
2712
2816
|
Re,
|
|
2713
2817
|
we,
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
]),
|
|
2818
|
+
zt,
|
|
2819
|
+
vt,
|
|
2820
|
+
ee,
|
|
2821
|
+
Kt,
|
|
2822
|
+
nt,
|
|
2823
|
+
oe
|
|
2824
|
+
]), R = S(
|
|
2721
2825
|
(o) => {
|
|
2722
|
-
const
|
|
2723
|
-
if (
|
|
2826
|
+
const u = (_ ?? 0) > 0, m = Math.abs(o - Bt), V = u && m > 0.5 ? Bt : o, A = ne(V, y.top);
|
|
2827
|
+
if (C.debug("[VirtualScroll] Rendering visible items", () => ({
|
|
2724
2828
|
currentScrollPosition: o,
|
|
2725
|
-
effectiveScrollPosition:
|
|
2726
|
-
renderingStartIndex:
|
|
2727
|
-
renderingEndIndex:
|
|
2728
|
-
itemCount:
|
|
2729
|
-
viewportSize:
|
|
2730
|
-
callbackThrottleMs:
|
|
2731
|
-
diff:
|
|
2732
|
-
rawEffectiveScrollPosition:
|
|
2733
|
-
})),
|
|
2734
|
-
return
|
|
2735
|
-
const
|
|
2829
|
+
effectiveScrollPosition: A,
|
|
2830
|
+
renderingStartIndex: Kt,
|
|
2831
|
+
renderingEndIndex: ee,
|
|
2832
|
+
itemCount: n,
|
|
2833
|
+
viewportSize: i,
|
|
2834
|
+
callbackThrottleMs: _,
|
|
2835
|
+
diff: m,
|
|
2836
|
+
rawEffectiveScrollPosition: V
|
|
2837
|
+
})), n === 0)
|
|
2838
|
+
return a;
|
|
2839
|
+
const F = y.top + b - V, K = y.bottom > 0 ? /* @__PURE__ */ st(
|
|
2736
2840
|
"div",
|
|
2737
2841
|
{
|
|
2738
2842
|
className: "aqvs-bottom-inset",
|
|
2739
2843
|
style: {
|
|
2740
2844
|
// ラッパー座標での bottom インセット位置 = コンテンツ総高さ (最終行の下端) - アンカー。
|
|
2741
|
-
top: v.getTotal() -
|
|
2742
|
-
height:
|
|
2845
|
+
top: v.getTotal() - b,
|
|
2846
|
+
height: y.bottom
|
|
2743
2847
|
}
|
|
2744
2848
|
},
|
|
2745
2849
|
"virtualscroll-bottom-inset"
|
|
2746
2850
|
) : null;
|
|
2747
|
-
return
|
|
2748
|
-
containerTop:
|
|
2749
|
-
logicalScrollPosition:
|
|
2750
|
-
resolvedInsets:
|
|
2751
|
-
effectiveScrollPosition:
|
|
2752
|
-
})), /* @__PURE__ */ ue("div", { className: "aqvs-items-wrapper", style: { top: 0, transform: `translateY(${
|
|
2753
|
-
|
|
2754
|
-
|
|
2851
|
+
return C.debug("[VirtualScroll] Rendering items", () => ({
|
|
2852
|
+
containerTop: F,
|
|
2853
|
+
logicalScrollPosition: te,
|
|
2854
|
+
resolvedInsets: y,
|
|
2855
|
+
effectiveScrollPosition: A
|
|
2856
|
+
})), /* @__PURE__ */ ue("div", { className: "aqvs-items-wrapper", style: { top: 0, transform: `translateY(${F}px)`, willChange: "transform" }, children: [
|
|
2857
|
+
a,
|
|
2858
|
+
K
|
|
2755
2859
|
] });
|
|
2756
2860
|
},
|
|
2757
|
-
[
|
|
2758
|
-
),
|
|
2861
|
+
[_, n, v, te, b, ee, Kt, y, Bt, i, a]
|
|
2862
|
+
), L = At(
|
|
2759
2863
|
() => ({
|
|
2760
|
-
renderingStartIndex:
|
|
2761
|
-
renderingEndIndex:
|
|
2762
|
-
visibleStartIndex:
|
|
2763
|
-
visibleEndIndex:
|
|
2764
|
-
scrollPosition:
|
|
2864
|
+
renderingStartIndex: se.renderingStartIndex,
|
|
2865
|
+
renderingEndIndex: se.renderingEndIndex,
|
|
2866
|
+
visibleStartIndex: se.visibleStartIndex,
|
|
2867
|
+
visibleEndIndex: se.visibleEndIndex,
|
|
2868
|
+
scrollPosition: te,
|
|
2765
2869
|
totalHeight: v.getTotal()
|
|
2766
2870
|
// contentSize (State) ではなく最新値を反映
|
|
2767
2871
|
}),
|
|
2768
2872
|
// contentSize を依存に含めることで、updateItemSize/updates 等で木の総高さが変わった際に
|
|
2769
2873
|
// (fenwickTree は安定参照のため getTotal() の変化だけでは再計算されない) 総高さを再取得する。
|
|
2770
|
-
[
|
|
2874
|
+
[se, te, v, at]
|
|
2771
2875
|
);
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
}, [
|
|
2775
|
-
|
|
2876
|
+
Y(() => {
|
|
2877
|
+
Ct.current = L;
|
|
2878
|
+
}, [L]), Be(
|
|
2879
|
+
mt,
|
|
2776
2880
|
() => ({
|
|
2777
|
-
getScrollPosition: () =>
|
|
2778
|
-
getContentSize: () =>
|
|
2779
|
-
getViewportSize: () =>
|
|
2780
|
-
scrollTo:
|
|
2781
|
-
scrollToIndex:
|
|
2881
|
+
getScrollPosition: () => k.current?.getScrollPosition() ?? -1,
|
|
2882
|
+
getContentSize: () => k.current?.getContentSize() ?? -1,
|
|
2883
|
+
getViewportSize: () => k.current?.getViewportSize() ?? -1,
|
|
2884
|
+
scrollTo: fe,
|
|
2885
|
+
scrollToIndex: Wt,
|
|
2782
2886
|
getFenwickTreeTotalHeight: () => v.getTotal(),
|
|
2783
2887
|
getFenwickSize: () => v.getSize(),
|
|
2784
|
-
focusItemAtIndex:
|
|
2785
|
-
getRange: () =>
|
|
2786
|
-
updateItemSize:
|
|
2888
|
+
focusItemAtIndex: re,
|
|
2889
|
+
getRange: () => Ct.current,
|
|
2890
|
+
updateItemSize: ve
|
|
2787
2891
|
}),
|
|
2788
|
-
[
|
|
2892
|
+
[fe, Wt, v, re, ve]
|
|
2789
2893
|
);
|
|
2790
|
-
const
|
|
2791
|
-
return /* @__PURE__ */
|
|
2792
|
-
|
|
2894
|
+
const X = v.getTotal() + y.top + y.bottom;
|
|
2895
|
+
return /* @__PURE__ */ st(
|
|
2896
|
+
Tr,
|
|
2793
2897
|
{
|
|
2794
|
-
ref:
|
|
2795
|
-
contentSize:
|
|
2796
|
-
viewportSize:
|
|
2898
|
+
ref: k,
|
|
2899
|
+
contentSize: X,
|
|
2900
|
+
viewportSize: i,
|
|
2797
2901
|
className: l,
|
|
2798
|
-
testId:
|
|
2799
|
-
onScroll:
|
|
2902
|
+
testId: c,
|
|
2903
|
+
onScroll: Ae,
|
|
2800
2904
|
background: M,
|
|
2801
|
-
tapScrollCircleOptions:
|
|
2802
|
-
inertiaOptions:
|
|
2803
|
-
itemCount:
|
|
2804
|
-
scrollBarWidth:
|
|
2805
|
-
enableThumbDrag:
|
|
2806
|
-
enableTrackClick:
|
|
2807
|
-
enableArrowButtons:
|
|
2808
|
-
enablePointerDrag:
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2905
|
+
tapScrollCircleOptions: q,
|
|
2906
|
+
inertiaOptions: St,
|
|
2907
|
+
itemCount: n,
|
|
2908
|
+
scrollBarWidth: Tt,
|
|
2909
|
+
enableThumbDrag: D,
|
|
2910
|
+
enableTrackClick: O,
|
|
2911
|
+
enableArrowButtons: P,
|
|
2912
|
+
enablePointerDrag: et,
|
|
2913
|
+
pointerDragInputs: G,
|
|
2914
|
+
renderThumbOverlay: N,
|
|
2915
|
+
wheelSpeedMultiplier: $,
|
|
2916
|
+
onWheelHorizontal: tt,
|
|
2917
|
+
contentInsets: y,
|
|
2918
|
+
visibleStartIndex: oe,
|
|
2919
|
+
visibleEndIndex: me,
|
|
2920
|
+
renderOverlay: Ce,
|
|
2921
|
+
initialScrollPosition: Xt.position,
|
|
2922
|
+
children: R
|
|
2818
2923
|
}
|
|
2819
2924
|
);
|
|
2820
|
-
},
|
|
2925
|
+
}, Or = Ye(Vr);
|
|
2821
2926
|
export {
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2927
|
+
le as FenwickMapTree,
|
|
2928
|
+
xr as ScrollBar,
|
|
2929
|
+
Tr as ScrollPane,
|
|
2930
|
+
Ze as TAP_SCROLL_SPEED_DEFAULTS,
|
|
2931
|
+
Or as VirtualScroll,
|
|
2932
|
+
br as computeAutoTapScrollMaxSpeedMultiplier,
|
|
2933
|
+
gr as computeTapScrollSpeed,
|
|
2934
|
+
It as minmax,
|
|
2935
|
+
_r as tapScrollCircleSampleVisual,
|
|
2936
|
+
Mr as useFenwickMapTree,
|
|
2937
|
+
kr as useHeightCache,
|
|
2938
|
+
yr as useLruCache
|
|
2831
2939
|
};
|