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