@aiquants/virtualscroll 1.14.1 → 1.17.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/README.md +20 -9
- package/dist/cli.js +109 -14
- package/dist/index.cjs +1 -1
- package/dist/index.js +1401 -1215
- package/dist/src/ScrollBar.d.ts +5 -2
- package/dist/src/ScrollBar.d.ts.map +1 -1
- package/dist/src/ScrollPane.d.ts +2 -0
- package/dist/src/ScrollPane.d.ts.map +1 -1
- package/dist/src/VirtualScroll.d.ts +41 -1
- package/dist/src/VirtualScroll.d.ts.map +1 -1
- package/dist/src/cli.server.d.ts +2 -0
- package/dist/src/cli.server.d.ts.map +1 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/logger.d.ts +97 -5
- package/dist/src/logger.d.ts.map +1 -1
- package/dist/src/useFenwickMapTree.d.ts +3 -1
- package/dist/src/useFenwickMapTree.d.ts.map +1 -1
- package/dist/styles/virtualscroll.css +2 -2
- package/dist/virtualscroll.css +1 -1
- package/package.json +7 -7
- package/dist/src/cli.d.ts +0 -3
- package/dist/src/cli.d.ts.map +0 -1
- package/dist/src/test-setup.d.ts +0 -1
- package/dist/src/test-setup.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,144 +1,240 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { twMerge as
|
|
4
|
-
|
|
1
|
+
import { jsx as $, jsxs as re, Fragment as ke } from "react/jsx-runtime";
|
|
2
|
+
import He, { memo as Be, forwardRef as Me, useState as Ht, useRef as S, useCallback as T, useImperativeHandle as ye, useMemo as Vt, useLayoutEffect as ae, useEffect as B, useId as Xe } from "react";
|
|
3
|
+
import { twMerge as ee } from "tailwind-merge";
|
|
4
|
+
class _ {
|
|
5
|
+
level;
|
|
6
|
+
prefix;
|
|
7
|
+
impl;
|
|
8
|
+
/**
|
|
9
|
+
* @constructor
|
|
10
|
+
* @param {LogLevel} [level=LogLevel.WARN] - The minimum log level to output.
|
|
11
|
+
* @param {string} [prefix="[virtualscroll]"] - The prefix to add to all log messages.
|
|
12
|
+
* @param {ILogger} [impl=console] - The implementation to use for logging.
|
|
13
|
+
*/
|
|
14
|
+
constructor(t = 2, e = "[virtualscroll]", r = console) {
|
|
15
|
+
this.level = t, this.prefix = e, this.impl = r;
|
|
16
|
+
}
|
|
17
|
+
static instance = new _(2, "[virtualscroll]");
|
|
18
|
+
/**
|
|
19
|
+
* @method setLevel
|
|
20
|
+
* @description Updates the current log level for the static instance.
|
|
21
|
+
* @description 静的インスタンスの現在のログレベルを更新します。
|
|
22
|
+
* @param {LogLevel} level - The new log level.
|
|
23
|
+
*/
|
|
24
|
+
static setLevel(t) {
|
|
25
|
+
_.instance.setLevel(t);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @method setLevel
|
|
29
|
+
* @description Updates the current log level.
|
|
30
|
+
* @description 現在のログレベルを更新します。
|
|
31
|
+
* @param {LogLevel} level - The new log level.
|
|
32
|
+
*/
|
|
33
|
+
setLevel(t) {
|
|
34
|
+
this.level = t;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @method setImplementation
|
|
38
|
+
* @description Updates the logger implementation for the static instance.
|
|
39
|
+
* @description 静的インスタンスのロガーの実装を更新します。
|
|
40
|
+
* @param {ILogger} impl - The new logger implementation.
|
|
41
|
+
*/
|
|
42
|
+
static setImplementation(t) {
|
|
43
|
+
_.instance.setImplementation(t);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @method setImplementation
|
|
47
|
+
* @description Updates the logger implementation.
|
|
48
|
+
* @description ロガーの実装を更新します。
|
|
49
|
+
* @param {ILogger} impl - The new logger implementation.
|
|
50
|
+
*/
|
|
51
|
+
setImplementation(t) {
|
|
52
|
+
this.impl = t;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* @method setPrefix
|
|
56
|
+
* @description Updates the log prefix for the static instance.
|
|
57
|
+
* @description 静的インスタンスのログのプレフィックスを更新します。
|
|
58
|
+
* @param {string} prefix - The new prefix.
|
|
59
|
+
*/
|
|
60
|
+
static setPrefix(t) {
|
|
61
|
+
_.instance.setPrefix(t);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @method setPrefix
|
|
65
|
+
* @description Updates the log prefix.
|
|
66
|
+
* @description ログのプレフィックスを更新します。
|
|
67
|
+
* @param {string} prefix - The new prefix.
|
|
68
|
+
*/
|
|
69
|
+
setPrefix(t) {
|
|
70
|
+
this.prefix = t;
|
|
71
|
+
}
|
|
72
|
+
formatMessage(t) {
|
|
73
|
+
return typeof t == "string" ? [`${this.prefix} ${t}`] : [this.prefix, t];
|
|
74
|
+
}
|
|
75
|
+
static debug(t, ...e) {
|
|
76
|
+
_.instance.debug(t, ...e);
|
|
77
|
+
}
|
|
78
|
+
debug(t, ...e) {
|
|
79
|
+
this.level <= 0 && this.impl.debug(...this.formatMessage(t), ...e);
|
|
80
|
+
}
|
|
81
|
+
static info(t, ...e) {
|
|
82
|
+
_.instance.info(t, ...e);
|
|
83
|
+
}
|
|
84
|
+
info(t, ...e) {
|
|
85
|
+
this.level <= 1 && this.impl.info(...this.formatMessage(t), ...e);
|
|
86
|
+
}
|
|
87
|
+
static warn(t, ...e) {
|
|
88
|
+
_.instance.warn(t, ...e);
|
|
89
|
+
}
|
|
90
|
+
warn(t, ...e) {
|
|
91
|
+
this.level <= 2 && this.impl.warn(...this.formatMessage(t), ...e);
|
|
92
|
+
}
|
|
93
|
+
static error(t, ...e) {
|
|
94
|
+
_.instance.error(t, ...e);
|
|
95
|
+
}
|
|
96
|
+
error(t, ...e) {
|
|
97
|
+
this.level <= 3 && this.impl.error(...this.formatMessage(t), ...e);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const Re = {
|
|
5
101
|
active: !1,
|
|
6
102
|
offsetX: 0,
|
|
7
103
|
offsetY: 0,
|
|
8
104
|
distance: 0,
|
|
9
105
|
direction: 0,
|
|
10
106
|
pointerId: null
|
|
11
|
-
},
|
|
12
|
-
const e = 1 + t * 0.18,
|
|
13
|
-
return /* @__PURE__ */
|
|
14
|
-
/* @__PURE__ */
|
|
107
|
+
}, Ie = 6, Ue = 8, $e = ({ dragState: n, normalizedDistance: t }) => {
|
|
108
|
+
const e = 1 + t * 0.18, r = 0.16 + t * 0.24, s = 0.38 + t * 0.28, l = n.active ? "80ms ease-out" : "220ms ease";
|
|
109
|
+
return /* @__PURE__ */ re(ke, { children: [
|
|
110
|
+
/* @__PURE__ */ $(
|
|
15
111
|
"div",
|
|
16
112
|
{
|
|
17
|
-
className: "
|
|
113
|
+
className: "aqvs-tap-scroll-circle-visual-outer",
|
|
18
114
|
style: {
|
|
19
115
|
background: "linear-gradient(140deg, rgba(255,255,255,0.62), rgba(72,72,72,0.48))",
|
|
20
|
-
boxShadow: `0 0 0 1px rgba(255,255,255,0.28), 0 10px 22px rgba(0,0,0,${
|
|
116
|
+
boxShadow: `0 0 0 1px rgba(255,255,255,0.28), 0 10px 22px rgba(0,0,0,${r})`,
|
|
21
117
|
transform: `scale(${e})`,
|
|
22
|
-
transition: `${
|
|
118
|
+
transition: `${l}, ${n.active ? "80ms" : "260ms"} box-shadow ease`
|
|
23
119
|
}
|
|
24
120
|
}
|
|
25
121
|
),
|
|
26
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ $(
|
|
27
123
|
"div",
|
|
28
124
|
{
|
|
29
|
-
className: "aqvs
|
|
125
|
+
className: "aqvs-tap-scroll-circle-inner",
|
|
30
126
|
style: {
|
|
31
127
|
background: "linear-gradient(140deg, rgba(255,255,255,0.72), rgba(28,28,28,0.58))",
|
|
32
128
|
boxShadow: "inset 0 4px 10px rgba(0,0,0,0.24), inset 0 0 2px rgba(255,255,255,0.55)",
|
|
33
129
|
opacity: s,
|
|
34
|
-
transition:
|
|
130
|
+
transition: n.active ? "120ms opacity ease-out" : "220ms opacity ease"
|
|
35
131
|
}
|
|
36
132
|
}
|
|
37
133
|
)
|
|
38
134
|
] });
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
const [
|
|
42
|
-
(
|
|
43
|
-
|
|
135
|
+
}, _e = Be(
|
|
136
|
+
Me(({ onDragChange: n, className: t, maxVisualDistance: e = 160, size: r = 40, style: s, opacity: l = 1, renderVisual: c }, d) => {
|
|
137
|
+
const [f, p] = Ht(Re), m = S(null), g = S({ x: 0, y: 0 }), E = S(null), x = S(0), A = T(
|
|
138
|
+
(D) => {
|
|
139
|
+
p(D), n(D);
|
|
44
140
|
},
|
|
45
|
-
[
|
|
141
|
+
[n]
|
|
46
142
|
), U = T(
|
|
47
|
-
(
|
|
48
|
-
const { x:
|
|
49
|
-
let
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
active:
|
|
53
|
-
offsetX:
|
|
54
|
-
offsetY:
|
|
55
|
-
distance:
|
|
56
|
-
direction:
|
|
57
|
-
pointerId:
|
|
143
|
+
(D, Z, J = !1) => {
|
|
144
|
+
const { x: W, y: F } = g.current, Tt = D - W, ct = Z - F, vt = Math.abs(ct), v = vt < Ie ? 0 : ct < 0 ? -1 : 1, Mt = x.current;
|
|
145
|
+
let b = v;
|
|
146
|
+
const Pt = Ie + Ue;
|
|
147
|
+
v === 0 ? Mt !== 0 && vt < Pt ? b = Mt : (b = 0, J || (x.current = 0)) : v !== Mt && Mt !== 0 && vt < Pt ? b = Mt : x.current = v, A({
|
|
148
|
+
active: J || vt >= Ie,
|
|
149
|
+
offsetX: Tt,
|
|
150
|
+
offsetY: ct,
|
|
151
|
+
distance: vt,
|
|
152
|
+
direction: b,
|
|
153
|
+
pointerId: m.current
|
|
58
154
|
});
|
|
59
155
|
},
|
|
60
156
|
[A]
|
|
61
|
-
),
|
|
62
|
-
if (
|
|
157
|
+
), q = T((D) => {
|
|
158
|
+
if (D === null)
|
|
63
159
|
return;
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
}, []),
|
|
67
|
-
(
|
|
68
|
-
|
|
160
|
+
const Z = E.current;
|
|
161
|
+
Z?.hasPointerCapture(D) && Z.releasePointerCapture(D);
|
|
162
|
+
}, []), Q = T(
|
|
163
|
+
(D = !1) => {
|
|
164
|
+
D && q(m.current), m.current = null, x.current = 0, A(Re);
|
|
69
165
|
},
|
|
70
|
-
[A,
|
|
71
|
-
),
|
|
72
|
-
(
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
166
|
+
[A, q]
|
|
167
|
+
), bt = T(
|
|
168
|
+
(D) => {
|
|
169
|
+
D.preventDefault(), D.stopPropagation();
|
|
170
|
+
const Z = E.current ?? D.currentTarget, { left: J, top: W, width: F, height: Tt } = Z.getBoundingClientRect();
|
|
171
|
+
g.current = { x: J + F / 2, y: W + Tt / 2 }, m.current = D.pointerId, Z.setPointerCapture(D.pointerId), U(D.clientX, D.clientY, !0);
|
|
76
172
|
},
|
|
77
173
|
[U]
|
|
78
|
-
),
|
|
79
|
-
(
|
|
80
|
-
|
|
174
|
+
), lt = T(
|
|
175
|
+
(D) => {
|
|
176
|
+
m.current === D.pointerId && (D.preventDefault(), U(D.clientX, D.clientY));
|
|
81
177
|
},
|
|
82
178
|
[U]
|
|
83
|
-
),
|
|
84
|
-
(
|
|
85
|
-
|
|
179
|
+
), it = T(
|
|
180
|
+
(D) => {
|
|
181
|
+
m.current === D.pointerId && (D.preventDefault(), D.stopPropagation(), Q(!0));
|
|
86
182
|
},
|
|
87
|
-
[
|
|
183
|
+
[Q]
|
|
88
184
|
);
|
|
89
|
-
|
|
90
|
-
|
|
185
|
+
ye(
|
|
186
|
+
d,
|
|
91
187
|
() => ({
|
|
92
188
|
reset: () => {
|
|
93
|
-
|
|
189
|
+
Q(!0);
|
|
94
190
|
},
|
|
95
|
-
getElement: () =>
|
|
191
|
+
getElement: () => E.current
|
|
96
192
|
}),
|
|
97
|
-
[
|
|
193
|
+
[Q]
|
|
98
194
|
);
|
|
99
|
-
const
|
|
100
|
-
dragState:
|
|
101
|
-
normalizedDistance:
|
|
102
|
-
sizeScale:
|
|
103
|
-
size:
|
|
104
|
-
opacity:
|
|
105
|
-
},
|
|
195
|
+
const Y = Math.min(Math.max(l, 0), 1), tt = r / 64, C = Math.min(f.distance, e) / e, K = f.direction * C * 10 * tt, G = c ?? $e, It = {
|
|
196
|
+
dragState: f,
|
|
197
|
+
normalizedDistance: C,
|
|
198
|
+
sizeScale: tt,
|
|
199
|
+
size: r,
|
|
200
|
+
opacity: Y
|
|
201
|
+
}, L = {
|
|
106
202
|
...s,
|
|
107
|
-
width:
|
|
108
|
-
height:
|
|
109
|
-
transform: `translateY(${
|
|
203
|
+
width: r,
|
|
204
|
+
height: r,
|
|
205
|
+
transform: `translateY(${K}px)`
|
|
110
206
|
};
|
|
111
|
-
return
|
|
207
|
+
return L.opacity = Y, /* @__PURE__ */ $(
|
|
112
208
|
"div",
|
|
113
209
|
{
|
|
114
|
-
ref:
|
|
210
|
+
ref: E,
|
|
115
211
|
"data-testid": "virtual-scroll-tap-circle",
|
|
116
|
-
className:
|
|
117
|
-
style:
|
|
212
|
+
className: ee("aqvs-tap-scroll-circle", t),
|
|
213
|
+
style: L,
|
|
118
214
|
tabIndex: -1,
|
|
119
|
-
onPointerDown:
|
|
120
|
-
onPointerMove:
|
|
121
|
-
onPointerUp:
|
|
122
|
-
onPointerCancel:
|
|
215
|
+
onPointerDown: bt,
|
|
216
|
+
onPointerMove: lt,
|
|
217
|
+
onPointerUp: it,
|
|
218
|
+
onPointerCancel: it,
|
|
123
219
|
role: "presentation",
|
|
124
|
-
children:
|
|
220
|
+
children: G(It)
|
|
125
221
|
}
|
|
126
222
|
);
|
|
127
223
|
})
|
|
128
224
|
);
|
|
129
|
-
|
|
130
|
-
const
|
|
225
|
+
_e.displayName = "TapScrollCircle";
|
|
226
|
+
const pt = (n, t, e) => Math.min(e, Math.max(t, n)), Se = "virtualscroll:tap-scroll-cancel", Ve = 20, Ke = 250, We = 60, je = 20, Ge = 20, Ze = 240, Ce = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, Te = 2.2, Je = 8, Qe = 120, tr = 1 / 60, qt = {
|
|
131
227
|
enabled: !0,
|
|
132
228
|
size: 40,
|
|
133
229
|
offsetX: -80,
|
|
134
230
|
offsetY: 0,
|
|
135
231
|
className: void 0,
|
|
136
|
-
maxVisualDistance:
|
|
232
|
+
maxVisualDistance: Ze,
|
|
137
233
|
minSpeedMultiplier: 0.2,
|
|
138
234
|
opacity: 0.9,
|
|
139
235
|
renderVisual: void 0,
|
|
140
236
|
maxSpeedCurve: void 0
|
|
141
|
-
},
|
|
237
|
+
}, er = (n) => n ? {
|
|
142
238
|
mainSizeKey: "width",
|
|
143
239
|
crossSizeKey: "height",
|
|
144
240
|
positionKey: "left",
|
|
@@ -146,7 +242,7 @@ const ht = (o, t, e) => Math.min(e, Math.max(t, o)), be = "virtualscroll:tap-scr
|
|
|
146
242
|
getPointerCoordinate: ({ clientX: t }) => t,
|
|
147
243
|
arrowLabels: ["Scroll left", "Scroll right"],
|
|
148
244
|
arrowIcons: ["◀", "▶"],
|
|
149
|
-
directionClass: "
|
|
245
|
+
directionClass: "aqvs-scrollbar-horizontal",
|
|
150
246
|
orientation: "horizontal"
|
|
151
247
|
} : {
|
|
152
248
|
mainSizeKey: "height",
|
|
@@ -156,594 +252,600 @@ const ht = (o, t, e) => Math.min(e, Math.max(t, o)), be = "virtualscroll:tap-scr
|
|
|
156
252
|
getPointerCoordinate: ({ clientY: t }) => t,
|
|
157
253
|
arrowLabels: ["Scroll up", "Scroll down"],
|
|
158
254
|
arrowIcons: ["▲", "▼"],
|
|
159
|
-
directionClass: "
|
|
255
|
+
directionClass: "aqvs-scrollbar-vertical",
|
|
160
256
|
orientation: "vertical"
|
|
161
|
-
},
|
|
162
|
-
const e =
|
|
257
|
+
}, rr = (n, t) => {
|
|
258
|
+
const e = n?.maxSpeedMultiplier, r = typeof e == "number" ? e : sr(t);
|
|
163
259
|
return {
|
|
164
|
-
enabled:
|
|
165
|
-
size:
|
|
166
|
-
offsetX:
|
|
167
|
-
offsetY:
|
|
168
|
-
className:
|
|
169
|
-
maxVisualDistance:
|
|
170
|
-
maxSpeedMultiplier:
|
|
171
|
-
minSpeedMultiplier: Math.max(
|
|
172
|
-
opacity:
|
|
173
|
-
renderVisual:
|
|
174
|
-
maxSpeedCurve:
|
|
260
|
+
enabled: n?.enabled ?? qt.enabled,
|
|
261
|
+
size: n?.size ?? qt.size,
|
|
262
|
+
offsetX: n?.offsetX ?? qt.offsetX,
|
|
263
|
+
offsetY: n?.offsetY ?? qt.offsetY,
|
|
264
|
+
className: n?.className ?? qt.className,
|
|
265
|
+
maxVisualDistance: n?.maxVisualDistance ?? qt.maxVisualDistance,
|
|
266
|
+
maxSpeedMultiplier: r,
|
|
267
|
+
minSpeedMultiplier: Math.max(n?.minSpeedMultiplier ?? qt.minSpeedMultiplier, 0),
|
|
268
|
+
opacity: pt(n?.opacity ?? qt.opacity, 0, 1),
|
|
269
|
+
renderVisual: n?.renderVisual ?? qt.renderVisual,
|
|
270
|
+
maxSpeedCurve: n?.maxSpeedCurve ?? qt.maxSpeedCurve
|
|
175
271
|
};
|
|
176
|
-
},
|
|
177
|
-
const s = S(null),
|
|
178
|
-
s.current !== null && (window.clearInterval(s.current), s.current = null),
|
|
179
|
-
}, []),
|
|
180
|
-
|
|
181
|
-
}, [
|
|
182
|
-
(
|
|
183
|
-
|
|
272
|
+
}, nr = ({ isDragging: n, isThumbHovered: t, enableThumbDrag: e }) => Vt(() => e ? n ? "dragging" : t ? "hover" : "idle" : "disabled", [e, n, t]), ir = ({ canUseArrowButtons: n, enableArrowButtons: t, resetTapScroll: e, scrollByStep: r }) => {
|
|
273
|
+
const s = S(null), l = S(null), c = T(() => {
|
|
274
|
+
s.current !== null && (window.clearInterval(s.current), s.current = null), l.current !== null && (window.clearTimeout(l.current), l.current = null);
|
|
275
|
+
}, []), d = T(() => {
|
|
276
|
+
c();
|
|
277
|
+
}, [c]), f = T(
|
|
278
|
+
(m) => (g) => {
|
|
279
|
+
n && (g.cancelable && g.preventDefault(), g.stopPropagation(), e(), c(), r(m), l.current = window.setTimeout(() => {
|
|
184
280
|
s.current = window.setInterval(() => {
|
|
185
|
-
|
|
186
|
-
},
|
|
187
|
-
},
|
|
281
|
+
r(m);
|
|
282
|
+
}, We);
|
|
283
|
+
}, Ke));
|
|
188
284
|
},
|
|
189
|
-
[
|
|
190
|
-
),
|
|
191
|
-
(
|
|
192
|
-
t && (
|
|
285
|
+
[n, c, e, r]
|
|
286
|
+
), p = T(
|
|
287
|
+
(m) => (g) => {
|
|
288
|
+
t && (g.key === "Enter" || g.key === " " || g.key === "Spacebar") && (g.preventDefault(), r(m));
|
|
193
289
|
},
|
|
194
|
-
[t,
|
|
290
|
+
[t, r]
|
|
195
291
|
);
|
|
196
|
-
return
|
|
197
|
-
|
|
198
|
-
}, [
|
|
199
|
-
},
|
|
200
|
-
if (!
|
|
201
|
-
return
|
|
202
|
-
const t = Math.max(1,
|
|
203
|
-
return
|
|
292
|
+
return B(() => () => {
|
|
293
|
+
c();
|
|
294
|
+
}, [c]), { handleArrowPointerDown: f, handleArrowPointerUp: d, handleArrowKeyDown: p };
|
|
295
|
+
}, sr = (n) => {
|
|
296
|
+
if (!n || n <= 0)
|
|
297
|
+
return Te;
|
|
298
|
+
const t = Math.max(1, n), e = Math.log10(t), r = Te + e * Je;
|
|
299
|
+
return pt(r, Te, Qe);
|
|
204
300
|
}, or = ({
|
|
205
|
-
contentSize:
|
|
301
|
+
contentSize: n,
|
|
206
302
|
viewportSize: t,
|
|
207
303
|
scrollPosition: e,
|
|
208
|
-
onScroll:
|
|
304
|
+
onScroll: r,
|
|
209
305
|
enableThumbDrag: s = !0,
|
|
210
|
-
enableTrackClick:
|
|
211
|
-
enableArrowButtons:
|
|
212
|
-
horizontal:
|
|
213
|
-
scrollBarWidth:
|
|
214
|
-
className:
|
|
215
|
-
ariaControls:
|
|
216
|
-
tapScrollCircleOptions:
|
|
217
|
-
itemCount:
|
|
218
|
-
renderThumbOverlay:
|
|
306
|
+
enableTrackClick: l = !0,
|
|
307
|
+
enableArrowButtons: c = !0,
|
|
308
|
+
horizontal: d = !1,
|
|
309
|
+
scrollBarWidth: f = 12,
|
|
310
|
+
className: p,
|
|
311
|
+
ariaControls: m,
|
|
312
|
+
tapScrollCircleOptions: g,
|
|
313
|
+
itemCount: E,
|
|
314
|
+
renderThumbOverlay: x,
|
|
219
315
|
visibleStartIndex: A,
|
|
220
316
|
visibleEndIndex: U
|
|
221
317
|
}) => {
|
|
222
|
-
const [
|
|
223
|
-
enabled:
|
|
224
|
-
size:
|
|
318
|
+
const [q, Q] = Ht(!1), [bt, lt] = Ht(!1), [it, Y] = Ht(!1), tt = S(null), C = S({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), K = S({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), G = S(e), It = S(r), L = S(Ce), D = S(null), Z = S(null), J = S(null), W = Vt(() => rr(g, E), [E, g]), F = Vt(() => er(d), [d]), {
|
|
319
|
+
enabled: Tt,
|
|
320
|
+
size: ct,
|
|
225
321
|
offsetX: vt,
|
|
226
|
-
offsetY:
|
|
227
|
-
className:
|
|
228
|
-
maxVisualDistance:
|
|
229
|
-
maxSpeedMultiplier:
|
|
230
|
-
minSpeedMultiplier:
|
|
231
|
-
opacity:
|
|
322
|
+
offsetY: v,
|
|
323
|
+
className: Mt,
|
|
324
|
+
maxVisualDistance: b,
|
|
325
|
+
maxSpeedMultiplier: Pt,
|
|
326
|
+
minSpeedMultiplier: yt,
|
|
327
|
+
opacity: Lt,
|
|
232
328
|
renderVisual: I,
|
|
233
|
-
maxSpeedCurve:
|
|
234
|
-
} =
|
|
235
|
-
viewportSize: t,
|
|
236
|
-
maxScrollPosition: Math.max(o - t, 0),
|
|
237
|
-
scrollBarVisible: o > t,
|
|
238
|
-
effectiveTapMaxDistance: Math.max(F, 1),
|
|
239
|
-
tapCircleMaxSpeedMultiplier: bt,
|
|
240
|
-
tapCircleMinSpeedMultiplier: at,
|
|
241
|
-
tapCircleMaxSpeedCurve: D,
|
|
242
|
-
tapScrollCircleOptions: m
|
|
243
|
-
}), { mainSizeKey: et, crossSizeKey: L, positionKey: Mt, selectDelta: xt, getPointerCoordinate: It, arrowLabels: rt, arrowIcons: lt, directionClass: ut, orientation: gt } = O, Et = Math.max(F, 1), Xt = t / o, Pt = l, g = Math.max(t - Pt * 2, 0), P = Xt * g, ot = Math.min(Math.max(Pe, P || 0), g || Pe), W = o - t, j = Math.max(g - ot, 0), Dt = W <= 0 || j <= 0 ? 0 : e / W * j, wt = Dt + ot / 2, pt = o > t, Ct = pt && u;
|
|
244
|
-
M.current = {
|
|
329
|
+
maxSpeedCurve: N
|
|
330
|
+
} = W, k = S({
|
|
245
331
|
viewportSize: t,
|
|
246
|
-
maxScrollPosition:
|
|
247
|
-
scrollBarVisible:
|
|
248
|
-
effectiveTapMaxDistance:
|
|
249
|
-
tapCircleMaxSpeedMultiplier:
|
|
250
|
-
tapCircleMinSpeedMultiplier:
|
|
251
|
-
tapCircleMaxSpeedCurve:
|
|
252
|
-
tapScrollCircleOptions:
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
332
|
+
maxScrollPosition: Math.max(n - t, 0),
|
|
333
|
+
scrollBarVisible: n > t,
|
|
334
|
+
effectiveTapMaxDistance: Math.max(b, 1),
|
|
335
|
+
tapCircleMaxSpeedMultiplier: Pt,
|
|
336
|
+
tapCircleMinSpeedMultiplier: yt,
|
|
337
|
+
tapCircleMaxSpeedCurve: N,
|
|
338
|
+
tapScrollCircleOptions: g,
|
|
339
|
+
effectiveTrackLength: 0,
|
|
340
|
+
onScroll: r,
|
|
341
|
+
scrollPosition: e
|
|
342
|
+
}), { mainSizeKey: et, crossSizeKey: ut, positionKey: Dt, selectDelta: mt, getPointerCoordinate: st, arrowLabels: ot, arrowIcons: Ct, directionClass: Et, orientation: wt } = F, At = Math.max(b, 1), Bt = t / n, ht = Math.max(t - f * 2, 0), h = Bt * ht, M = Math.min(Math.max(Ve, h || 0), ht || Ve), j = n - t, at = Math.max(ht - M, 0), dt = j <= 0 || at <= 0 ? 0 : e / j * at, Ot = dt + M / 2, ft = n > t || q, Yt = ft && c;
|
|
343
|
+
ae(() => {
|
|
344
|
+
k.current = {
|
|
345
|
+
viewportSize: t,
|
|
346
|
+
maxScrollPosition: j,
|
|
347
|
+
scrollBarVisible: ft,
|
|
348
|
+
effectiveTapMaxDistance: At,
|
|
349
|
+
tapCircleMaxSpeedMultiplier: Pt,
|
|
350
|
+
tapCircleMinSpeedMultiplier: yt,
|
|
351
|
+
tapCircleMaxSpeedCurve: N,
|
|
352
|
+
tapScrollCircleOptions: g,
|
|
353
|
+
effectiveTrackLength: at,
|
|
354
|
+
onScroll: r,
|
|
355
|
+
scrollPosition: e
|
|
356
|
+
};
|
|
357
|
+
}), ae(() => {
|
|
358
|
+
G.current = e;
|
|
359
|
+
}, [e]), ae(() => {
|
|
360
|
+
It.current = r;
|
|
361
|
+
}, [r]), B(() => {
|
|
362
|
+
s || lt(!1);
|
|
257
363
|
}, [s]);
|
|
258
|
-
const
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
if (!a.scrollBarVisible || a.maxScrollPosition <= 0) {
|
|
274
|
-
const G = Nt(0, x), zt = G - x;
|
|
275
|
-
return { nextPosition: G, actualDelta: zt, reachedBoundary: !0 };
|
|
364
|
+
const Zt = nr({ isDragging: q, isThumbHovered: bt, enableThumbDrag: s }), Nt = T((o, P) => {
|
|
365
|
+
const R = k.current, i = P ?? G.current;
|
|
366
|
+
if (It.current) {
|
|
367
|
+
const w = It.current(o, i);
|
|
368
|
+
if (typeof w == "number" && Number.isFinite(w))
|
|
369
|
+
return G.current = w, w;
|
|
370
|
+
}
|
|
371
|
+
const a = typeof o == "function" ? o(i) : o, u = Math.max(R.maxScrollPosition, 0), y = R.scrollBarVisible ? pt(a, 0, u) : 0;
|
|
372
|
+
return G.current = y, y;
|
|
373
|
+
}, []), Xt = T(
|
|
374
|
+
(o) => {
|
|
375
|
+
const P = k.current, R = G.current;
|
|
376
|
+
if (!P.scrollBarVisible || P.maxScrollPosition <= 0) {
|
|
377
|
+
const w = Nt(0, R), V = w - R;
|
|
378
|
+
return { nextPosition: w, actualDelta: V, reachedBoundary: !0 };
|
|
276
379
|
}
|
|
277
|
-
if (
|
|
278
|
-
return { nextPosition:
|
|
279
|
-
const
|
|
280
|
-
return { nextPosition:
|
|
380
|
+
if (o === 0)
|
|
381
|
+
return { nextPosition: R, actualDelta: 0, reachedBoundary: !1 };
|
|
382
|
+
const a = Nt((w) => pt(w + o, 0, P.maxScrollPosition), R), u = a - R, y = u === 0 || o < 0 && a <= 0 || o > 0 && a >= P.maxScrollPosition;
|
|
383
|
+
return { nextPosition: a, actualDelta: u, reachedBoundary: y };
|
|
281
384
|
},
|
|
282
385
|
[Nt]
|
|
283
|
-
),
|
|
284
|
-
|
|
285
|
-
}, []),
|
|
286
|
-
|
|
287
|
-
}, [
|
|
288
|
-
(
|
|
289
|
-
const
|
|
290
|
-
if (!
|
|
291
|
-
|
|
386
|
+
), St = T(() => {
|
|
387
|
+
Z.current !== null && (window.cancelAnimationFrame(Z.current), Z.current = null), J.current = null;
|
|
388
|
+
}, []), Rt = T(() => {
|
|
389
|
+
L.current = { ...Ce }, Y(!1), D.current?.reset(), St();
|
|
390
|
+
}, [St]), Qt = T(
|
|
391
|
+
(o) => {
|
|
392
|
+
const P = L.current, R = k.current;
|
|
393
|
+
if (!P.active || P.direction === 0) {
|
|
394
|
+
St();
|
|
292
395
|
return;
|
|
293
396
|
}
|
|
294
|
-
if (!
|
|
295
|
-
|
|
397
|
+
if (!R.scrollBarVisible || R.maxScrollPosition <= 0) {
|
|
398
|
+
St();
|
|
296
399
|
return;
|
|
297
400
|
}
|
|
298
|
-
const
|
|
299
|
-
if (
|
|
300
|
-
|
|
401
|
+
const i = J.current ?? o, a = Math.max((o - i) / 1e3, 0), u = Math.min(a, tr);
|
|
402
|
+
if (J.current = o, u <= 0) {
|
|
403
|
+
Z.current = window.requestAnimationFrame(Qt);
|
|
301
404
|
return;
|
|
302
405
|
}
|
|
303
|
-
const
|
|
304
|
-
let
|
|
305
|
-
const
|
|
306
|
-
if (
|
|
307
|
-
const
|
|
308
|
-
|
|
406
|
+
const y = Math.min(P.distance, R.effectiveTapMaxDistance) / R.effectiveTapMaxDistance, w = y ** 1.1, V = typeof R.tapScrollCircleOptions?.maxSpeedMultiplier == "number", z = Math.max(R.viewportSize * R.tapCircleMinSpeedMultiplier, 40), X = V ? z : 1200;
|
|
407
|
+
let H = Math.max(R.viewportSize * R.tapCircleMaxSpeedMultiplier, X);
|
|
408
|
+
const gt = R.tapCircleMaxSpeedCurve;
|
|
409
|
+
if (gt) {
|
|
410
|
+
const he = Math.max(gt.exponentialSteepness, 0), Oe = Math.max(gt.exponentialScale ?? R.tapCircleMaxSpeedMultiplier, 0), Ye = he === 0 ? y : Math.expm1(he * y), we = he === 0 ? 1 : Math.expm1(he) || 1, ze = we === 0 ? y : Math.min(Math.max(Ye / we, 0), 1), qe = R.viewportSize * Oe * ze;
|
|
411
|
+
H = Math.min(H, Math.max(qe, z));
|
|
309
412
|
}
|
|
310
|
-
const
|
|
311
|
-
if (
|
|
312
|
-
|
|
413
|
+
const xt = Math.max(H, z), Ft = Math.max(gt?.easedOffset ?? 0, 0), Jt = Math.min(1, w + Ft), ce = z + (xt - z) * Jt, ue = P.direction * ce * u, { actualDelta: Fe, reachedBoundary: Le } = Xt(ue);
|
|
414
|
+
if (Le || Fe === 0) {
|
|
415
|
+
St();
|
|
313
416
|
return;
|
|
314
417
|
}
|
|
315
|
-
|
|
418
|
+
Z.current = window.requestAnimationFrame(Qt);
|
|
316
419
|
},
|
|
317
|
-
[
|
|
318
|
-
),
|
|
319
|
-
|
|
320
|
-
}, [
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
}, [
|
|
324
|
-
const
|
|
325
|
-
(
|
|
326
|
-
|
|
420
|
+
[Xt, St]
|
|
421
|
+
), rt = T(() => {
|
|
422
|
+
Z.current === null && (J.current = null, Z.current = window.requestAnimationFrame(Qt));
|
|
423
|
+
}, [Qt]);
|
|
424
|
+
B(() => () => {
|
|
425
|
+
St();
|
|
426
|
+
}, [St]);
|
|
427
|
+
const fe = T(
|
|
428
|
+
(o) => {
|
|
429
|
+
L.current = o, Y(o.active), o.active && o.direction !== 0 ? rt() : St();
|
|
327
430
|
},
|
|
328
|
-
[
|
|
431
|
+
[rt, St]
|
|
329
432
|
);
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
}, [
|
|
333
|
-
const
|
|
334
|
-
const
|
|
335
|
-
|
|
433
|
+
B(() => {
|
|
434
|
+
Tt || Rt();
|
|
435
|
+
}, [Rt, Tt]), B(() => {
|
|
436
|
+
const o = (P) => {
|
|
437
|
+
const i = P.detail?.paneId;
|
|
438
|
+
i && m && i !== m || Rt();
|
|
336
439
|
};
|
|
337
|
-
return window.addEventListener(
|
|
338
|
-
window.removeEventListener(
|
|
440
|
+
return window.addEventListener(Se, o), () => {
|
|
441
|
+
window.removeEventListener(Se, o);
|
|
339
442
|
};
|
|
340
|
-
}, [
|
|
341
|
-
if (!
|
|
443
|
+
}, [m, Rt]), B(() => {
|
|
444
|
+
if (!Tt)
|
|
342
445
|
return;
|
|
343
|
-
const
|
|
344
|
-
if (!
|
|
446
|
+
const o = (P) => {
|
|
447
|
+
if (!L.current.active || L.current.pointerId === P.pointerId)
|
|
345
448
|
return;
|
|
346
|
-
const
|
|
347
|
-
if (!(
|
|
348
|
-
|
|
449
|
+
const R = P.target;
|
|
450
|
+
if (!(R instanceof Node)) {
|
|
451
|
+
Rt();
|
|
349
452
|
return;
|
|
350
453
|
}
|
|
351
|
-
|
|
454
|
+
D.current?.getElement()?.contains(R) || Rt();
|
|
352
455
|
};
|
|
353
|
-
return document.addEventListener("pointerdown",
|
|
354
|
-
document.removeEventListener("pointerdown",
|
|
456
|
+
return document.addEventListener("pointerdown", o, !0), () => {
|
|
457
|
+
document.removeEventListener("pointerdown", o, !0);
|
|
355
458
|
};
|
|
356
|
-
}, [
|
|
357
|
-
const
|
|
358
|
-
if (!
|
|
459
|
+
}, [Rt, Tt]);
|
|
460
|
+
const le = (o) => {
|
|
461
|
+
if (!ft || at <= 0 || j <= 0)
|
|
359
462
|
return 0;
|
|
360
|
-
const
|
|
361
|
-
return
|
|
362
|
-
},
|
|
363
|
-
const
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
463
|
+
const P = pt(o, 0, at);
|
|
464
|
+
return pt(P / at * j, 0, j);
|
|
465
|
+
}, kt = T((o) => {
|
|
466
|
+
const { scrollBarVisible: P, effectiveTrackLength: R, maxScrollPosition: i } = k.current;
|
|
467
|
+
if (_.debug("[ScrollBar] calculateScrollPositionFromThumb", { thumbPos: o, trackLen: R, maxScroll: i }), R <= 0 || i <= 0)
|
|
468
|
+
return null;
|
|
469
|
+
const a = pt(o, 0, R);
|
|
470
|
+
return pt(a / R * i, 0, i);
|
|
471
|
+
}, []), ne = T(
|
|
472
|
+
(o) => {
|
|
473
|
+
const P = C.current;
|
|
474
|
+
if (P.pointerId !== o.pointerId)
|
|
475
|
+
return;
|
|
476
|
+
const R = o.clientX - P.startClientX, i = o.clientY - P.startClientY, a = mt(R, i);
|
|
477
|
+
_.debug("[ScrollBar] handleThumbPointerMove", {
|
|
478
|
+
delta: a,
|
|
479
|
+
startThumbPosition: P.startThumbPosition,
|
|
480
|
+
clientY: o.clientY,
|
|
481
|
+
startClientY: P.startClientY,
|
|
482
|
+
metrics: k.current
|
|
483
|
+
});
|
|
484
|
+
const u = kt(P.startThumbPosition + a);
|
|
485
|
+
u !== null && Nt(u), o.cancelable && o.preventDefault();
|
|
486
|
+
},
|
|
487
|
+
[mt, kt, Nt]
|
|
488
|
+
), te = T(
|
|
489
|
+
(o) => {
|
|
490
|
+
if (C.current.pointerId === o.pointerId)
|
|
491
|
+
if (document.removeEventListener("pointermove", ne), document.removeEventListener("pointerup", te), document.removeEventListener("pointercancel", te), C.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, Q(!1), tt.current) {
|
|
492
|
+
const R = tt.current.getBoundingClientRect();
|
|
493
|
+
o.clientX >= R.left && o.clientX <= R.right && o.clientY >= R.top && o.clientY <= R.bottom || lt(!1);
|
|
494
|
+
} else
|
|
495
|
+
lt(!1);
|
|
496
|
+
},
|
|
497
|
+
[ne]
|
|
498
|
+
), be = (o) => {
|
|
499
|
+
const P = Math.max(Math.round(t / Ge), je);
|
|
500
|
+
Xt(o * P);
|
|
501
|
+
}, { handleArrowPointerDown: Ut, handleArrowPointerUp: zt, handleArrowKeyDown: $t } = ir({
|
|
502
|
+
canUseArrowButtons: Yt,
|
|
503
|
+
enableArrowButtons: c,
|
|
504
|
+
resetTapScroll: Rt,
|
|
505
|
+
scrollByStep: be
|
|
506
|
+
}), Kt = (o) => {
|
|
507
|
+
if (ft) {
|
|
508
|
+
if (!s) {
|
|
509
|
+
o.preventDefault(), o.stopPropagation();
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
o.pointerType === "mouse" && o.button !== 0 || o.ctrlKey || (Rt(), C.current = {
|
|
513
|
+
pointerId: o.pointerId,
|
|
514
|
+
startThumbPosition: dt,
|
|
515
|
+
startClientX: o.clientX,
|
|
516
|
+
startClientY: o.clientY
|
|
517
|
+
}, document.addEventListener("pointermove", ne), document.addEventListener("pointerup", te), document.addEventListener("pointercancel", te), Q(!0), lt(!0), o.preventDefault(), o.stopPropagation());
|
|
376
518
|
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
St();
|
|
380
|
-
const a = r.currentTarget;
|
|
381
|
-
a.setPointerCapture && a.setPointerCapture(r.pointerId), $.current = {
|
|
382
|
-
pointerId: r.pointerId,
|
|
383
|
-
startThumbPosition: Dt,
|
|
384
|
-
startClientX: r.clientX,
|
|
385
|
-
startClientY: r.clientY
|
|
386
|
-
}, Z(!0), nt(!0), r.preventDefault(), r.stopPropagation();
|
|
387
|
-
}, Ot = (r) => {
|
|
388
|
-
const a = $.current;
|
|
389
|
-
if (a.pointerId !== r.pointerId)
|
|
390
|
-
return;
|
|
391
|
-
const x = r.clientX - a.startClientX, V = r.clientY - a.startClientY, k = xt(x, V), E = Gt(a.startThumbPosition + k);
|
|
392
|
-
Nt(E), r.cancelable && r.preventDefault();
|
|
393
|
-
}, Yt = (r) => {
|
|
394
|
-
if ($.current.pointerId !== r.pointerId)
|
|
395
|
-
return;
|
|
396
|
-
const a = r.currentTarget;
|
|
397
|
-
a.hasPointerCapture(r.pointerId) && a.releasePointerCapture(r.pointerId), $.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, Z(!1), w.current && !w.current.matches(":hover") && nt(!1), r.preventDefault(), r.stopPropagation();
|
|
398
|
-
}, oe = (r) => {
|
|
399
|
-
if ($.current.pointerId !== r.pointerId)
|
|
519
|
+
}, _t = (o) => {
|
|
520
|
+
if (!ft)
|
|
400
521
|
return;
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
}, se = (r) => {
|
|
404
|
-
if (!pt)
|
|
405
|
-
return;
|
|
406
|
-
if (!c) {
|
|
407
|
-
r.preventDefault(), r.stopPropagation();
|
|
522
|
+
if (!l) {
|
|
523
|
+
o.preventDefault(), o.stopPropagation();
|
|
408
524
|
return;
|
|
409
525
|
}
|
|
410
|
-
if (
|
|
526
|
+
if (o.pointerType === "mouse" && o.button !== 0 || o.ctrlKey)
|
|
411
527
|
return;
|
|
412
|
-
const
|
|
413
|
-
|
|
414
|
-
const
|
|
415
|
-
Nt(
|
|
416
|
-
pointerId:
|
|
417
|
-
startThumbPosition:
|
|
418
|
-
startClientX:
|
|
419
|
-
startClientY:
|
|
420
|
-
},
|
|
421
|
-
},
|
|
422
|
-
const
|
|
423
|
-
if (
|
|
528
|
+
const P = o.currentTarget, R = P.getBoundingClientRect(), a = st(o) - (d ? R.left : R.top);
|
|
529
|
+
Rt();
|
|
530
|
+
const u = a - M / 2, y = le(u);
|
|
531
|
+
Nt(y), P.setPointerCapture && P.setPointerCapture(o.pointerId), K.current = {
|
|
532
|
+
pointerId: o.pointerId,
|
|
533
|
+
startThumbPosition: u,
|
|
534
|
+
startClientX: o.clientX,
|
|
535
|
+
startClientY: o.clientY
|
|
536
|
+
}, o.preventDefault(), o.stopPropagation();
|
|
537
|
+
}, Wt = (o) => {
|
|
538
|
+
const P = K.current;
|
|
539
|
+
if (P.pointerId !== o.pointerId)
|
|
424
540
|
return;
|
|
425
|
-
const
|
|
426
|
-
Nt(
|
|
427
|
-
},
|
|
428
|
-
if (
|
|
541
|
+
const R = o.clientX - P.startClientX, i = o.clientY - P.startClientY, a = mt(R, i), u = le(P.startThumbPosition + a);
|
|
542
|
+
Nt(u), o.cancelable && o.preventDefault();
|
|
543
|
+
}, jt = (o) => {
|
|
544
|
+
if (K.current.pointerId !== o.pointerId)
|
|
429
545
|
return;
|
|
430
|
-
const
|
|
431
|
-
|
|
432
|
-
},
|
|
433
|
-
if (
|
|
546
|
+
const P = o.currentTarget;
|
|
547
|
+
P.hasPointerCapture(o.pointerId) && P.releasePointerCapture(o.pointerId), K.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, o.preventDefault(), o.stopPropagation();
|
|
548
|
+
}, me = (o) => {
|
|
549
|
+
if (K.current.pointerId !== o.pointerId)
|
|
434
550
|
return;
|
|
435
|
-
const
|
|
436
|
-
|
|
437
|
-
},
|
|
438
|
-
const
|
|
551
|
+
const P = o.currentTarget;
|
|
552
|
+
P.hasPointerCapture(o.pointerId) && P.releasePointerCapture(o.pointerId), K.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 };
|
|
553
|
+
}, pe = Vt(() => pt((it ? 1 : 0.8) * Lt, 0, 1), [it, Lt]), ve = Vt(() => {
|
|
554
|
+
const P = `calc(50% - ${ct / 2}px + ${v}px)`;
|
|
439
555
|
return {
|
|
440
556
|
left: vt,
|
|
441
|
-
top:
|
|
557
|
+
top: P
|
|
442
558
|
};
|
|
443
|
-
}, [vt,
|
|
559
|
+
}, [vt, v, ct]), ie = (o, P, R, i) => /* @__PURE__ */ $(
|
|
444
560
|
"button",
|
|
445
561
|
{
|
|
446
562
|
type: "button",
|
|
447
563
|
tabIndex: -1,
|
|
448
|
-
className: "aqvs
|
|
564
|
+
className: "aqvs-scrollbar-arrow-button",
|
|
449
565
|
style: {
|
|
450
|
-
[et]:
|
|
451
|
-
[
|
|
566
|
+
[et]: f,
|
|
567
|
+
[ut]: f
|
|
452
568
|
},
|
|
453
|
-
"aria-label":
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
"aria-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
orientation: gt,
|
|
569
|
+
"aria-label": P,
|
|
570
|
+
onPointerDown: Ut(o),
|
|
571
|
+
onPointerUp: zt,
|
|
572
|
+
onPointerLeave: zt,
|
|
573
|
+
onPointerCancel: zt,
|
|
574
|
+
onKeyDown: $t(o),
|
|
575
|
+
"aria-disabled": !c,
|
|
576
|
+
disabled: !Yt,
|
|
577
|
+
children: /* @__PURE__ */ $("span", { "aria-hidden": "true", children: R })
|
|
578
|
+
},
|
|
579
|
+
i
|
|
580
|
+
), se = x && ft ? {
|
|
581
|
+
orientation: wt,
|
|
467
582
|
scrollPosition: e,
|
|
468
|
-
maxScrollPosition:
|
|
469
|
-
contentSize:
|
|
583
|
+
maxScrollPosition: j,
|
|
584
|
+
contentSize: n,
|
|
470
585
|
viewportSize: t,
|
|
471
|
-
thumbSize:
|
|
472
|
-
thumbPosition:
|
|
473
|
-
thumbCenter:
|
|
474
|
-
trackSize:
|
|
475
|
-
isDragging:
|
|
476
|
-
isTapScrollActive:
|
|
586
|
+
thumbSize: M,
|
|
587
|
+
thumbPosition: dt,
|
|
588
|
+
thumbCenter: Ot,
|
|
589
|
+
trackSize: ht,
|
|
590
|
+
isDragging: q,
|
|
591
|
+
isTapScrollActive: it,
|
|
477
592
|
visibleStartIndex: A,
|
|
478
593
|
visibleEndIndex: U
|
|
479
594
|
} : null;
|
|
480
|
-
return /* @__PURE__ */
|
|
595
|
+
return /* @__PURE__ */ re(
|
|
481
596
|
"div",
|
|
482
597
|
{
|
|
483
|
-
className:
|
|
598
|
+
className: ee("aqvs-scrollbar", Et, !ft && "pointer-events-none opacity-0", p),
|
|
484
599
|
style: {
|
|
485
600
|
[et]: t,
|
|
486
|
-
[
|
|
487
|
-
backgroundColor: "white",
|
|
488
|
-
userSelect: "none",
|
|
489
|
-
position: "relative",
|
|
490
|
-
touchAction: "none"
|
|
601
|
+
[ut]: f
|
|
491
602
|
},
|
|
492
603
|
role: "scrollbar",
|
|
493
604
|
tabIndex: -1,
|
|
494
|
-
"aria-controls":
|
|
605
|
+
"aria-controls": m,
|
|
495
606
|
"aria-valuenow": e,
|
|
496
607
|
"aria-valuemin": 0,
|
|
497
|
-
"aria-valuemax":
|
|
498
|
-
"aria-orientation":
|
|
608
|
+
"aria-valuemax": j,
|
|
609
|
+
"aria-orientation": d ? "horizontal" : "vertical",
|
|
499
610
|
children: [
|
|
500
|
-
!
|
|
501
|
-
|
|
611
|
+
!d && ft && Tt && /* @__PURE__ */ $(
|
|
612
|
+
_e,
|
|
502
613
|
{
|
|
503
|
-
ref:
|
|
504
|
-
className:
|
|
505
|
-
size:
|
|
506
|
-
maxVisualDistance:
|
|
507
|
-
style:
|
|
508
|
-
opacity:
|
|
614
|
+
ref: D,
|
|
615
|
+
className: ee("aqvs-scrollbar-tap-circle-wrapper", Mt),
|
|
616
|
+
size: ct,
|
|
617
|
+
maxVisualDistance: At,
|
|
618
|
+
style: ve,
|
|
619
|
+
opacity: pe,
|
|
509
620
|
renderVisual: I,
|
|
510
|
-
onDragChange:
|
|
511
|
-
}
|
|
621
|
+
onDragChange: fe
|
|
622
|
+
},
|
|
623
|
+
"tap-circle"
|
|
512
624
|
),
|
|
513
|
-
|
|
514
|
-
/* @__PURE__ */
|
|
625
|
+
ie(-1, ot[0], Ct[0], "arrow-start"),
|
|
626
|
+
/* @__PURE__ */ re(
|
|
515
627
|
"div",
|
|
516
628
|
{
|
|
517
|
-
className: "aqvs
|
|
629
|
+
className: "aqvs-scrollbar-track",
|
|
518
630
|
style: {
|
|
519
|
-
borderRadius:
|
|
520
|
-
touchAction: "none"
|
|
631
|
+
borderRadius: f / 2
|
|
521
632
|
},
|
|
522
|
-
onPointerDown:
|
|
523
|
-
onPointerMove:
|
|
524
|
-
onPointerUp:
|
|
525
|
-
onPointerCancel:
|
|
526
|
-
"aria-disabled": !
|
|
633
|
+
onPointerDown: _t,
|
|
634
|
+
onPointerMove: Wt,
|
|
635
|
+
onPointerUp: jt,
|
|
636
|
+
onPointerCancel: me,
|
|
637
|
+
"aria-disabled": !l,
|
|
527
638
|
children: [
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
/* @__PURE__ */ B(
|
|
639
|
+
se && /* @__PURE__ */ $("div", { className: "aqvs-scrollbar-overlay", "aria-hidden": !0, children: x?.(se) }, "overlay"),
|
|
640
|
+
/* @__PURE__ */ $(
|
|
531
641
|
"div",
|
|
532
642
|
{
|
|
533
|
-
className: "
|
|
643
|
+
className: ee("aqvs-scrollbar-thumb-wrapper", !(ft || q) && "pointer-events-none opacity-0"),
|
|
534
644
|
style: {
|
|
535
|
-
[et]:
|
|
536
|
-
[
|
|
537
|
-
...
|
|
538
|
-
touchAction: "none"
|
|
645
|
+
[et]: M,
|
|
646
|
+
[Dt]: dt,
|
|
647
|
+
...d ? { top: 0, bottom: 0 } : { left: 0, right: 0 }
|
|
539
648
|
},
|
|
540
|
-
onPointerDown:
|
|
541
|
-
onPointerMove: Ot,
|
|
542
|
-
onPointerUp: Yt,
|
|
543
|
-
onPointerCancel: oe,
|
|
649
|
+
onPointerDown: Kt,
|
|
544
650
|
role: "slider",
|
|
545
|
-
"aria-orientation":
|
|
651
|
+
"aria-orientation": d ? "horizontal" : "vertical",
|
|
546
652
|
"aria-valuenow": e,
|
|
547
653
|
"aria-valuemin": 0,
|
|
548
|
-
"aria-valuemax":
|
|
654
|
+
"aria-valuemax": j,
|
|
549
655
|
"aria-disabled": !s,
|
|
550
656
|
tabIndex: -1,
|
|
551
|
-
children: /* @__PURE__ */
|
|
657
|
+
children: /* @__PURE__ */ $(
|
|
552
658
|
"div",
|
|
553
659
|
{
|
|
554
|
-
ref:
|
|
555
|
-
className:
|
|
556
|
-
"data-thumb-state":
|
|
660
|
+
ref: tt,
|
|
661
|
+
className: ee("aqvs-scrollbar-thumb", d ? "aqvs-scrollbar-thumb-horizontal" : "aqvs-scrollbar-thumb-vertical"),
|
|
662
|
+
"data-thumb-state": Zt,
|
|
557
663
|
style: {
|
|
558
|
-
borderRadius:
|
|
664
|
+
borderRadius: f - 1,
|
|
559
665
|
cursor: s ? "pointer" : "default"
|
|
560
666
|
},
|
|
561
667
|
onMouseEnter: () => {
|
|
562
|
-
s &&
|
|
668
|
+
s && lt(!0);
|
|
563
669
|
},
|
|
564
670
|
onMouseLeave: () => {
|
|
565
|
-
s &&
|
|
671
|
+
s && lt(!1);
|
|
566
672
|
}
|
|
567
|
-
}
|
|
673
|
+
},
|
|
674
|
+
"thumb"
|
|
568
675
|
)
|
|
569
|
-
}
|
|
676
|
+
},
|
|
677
|
+
"thumb-wrapper"
|
|
570
678
|
)
|
|
571
679
|
]
|
|
572
|
-
}
|
|
680
|
+
},
|
|
681
|
+
"track"
|
|
573
682
|
),
|
|
574
|
-
|
|
683
|
+
ie(1, ot[1], Ct[1], "arrow-end")
|
|
575
684
|
]
|
|
576
685
|
}
|
|
577
686
|
);
|
|
578
|
-
},
|
|
579
|
-
debug(o, ...t) {
|
|
580
|
-
process.env.NODE_ENV === "___" && console.debug(`[VirtualScroll] ${o}`, ...t);
|
|
581
|
-
},
|
|
582
|
-
warn(o, ...t) {
|
|
583
|
-
console.warn(`[VirtualScroll] ${o}`, ...t);
|
|
584
|
-
},
|
|
585
|
-
error(o, ...t) {
|
|
586
|
-
console.error(`[VirtualScroll] ${o}`, ...t);
|
|
587
|
-
}
|
|
588
|
-
}, Qt = {
|
|
687
|
+
}, de = {
|
|
589
688
|
maxVelocity: 6,
|
|
590
689
|
minVelocity: 0.02,
|
|
591
690
|
deceleration: 25e-4,
|
|
592
691
|
velocitySampleWindow: 90,
|
|
593
692
|
startVelocityThreshold: 0.04
|
|
594
|
-
},
|
|
595
|
-
for (const [
|
|
596
|
-
e === "add" ?
|
|
597
|
-
},
|
|
693
|
+
}, ge = (n, t, e) => {
|
|
694
|
+
for (const [r, s, l] of t)
|
|
695
|
+
e === "add" ? n.addEventListener(r, s, l) : n.removeEventListener(r, s, l);
|
|
696
|
+
}, ar = Me(
|
|
598
697
|
({
|
|
599
|
-
children:
|
|
698
|
+
children: n,
|
|
600
699
|
contentSize: t,
|
|
601
700
|
viewportSize: e,
|
|
602
|
-
scrollBarWidth:
|
|
701
|
+
scrollBarWidth: r = 12,
|
|
603
702
|
enableThumbDrag: s = !0,
|
|
604
|
-
enableTrackClick:
|
|
605
|
-
enableArrowButtons:
|
|
606
|
-
enablePointerDrag:
|
|
607
|
-
onScroll:
|
|
608
|
-
className:
|
|
609
|
-
style:
|
|
610
|
-
background:
|
|
611
|
-
tapScrollCircleOptions:
|
|
612
|
-
inertiaOptions:
|
|
703
|
+
enableTrackClick: l = !0,
|
|
704
|
+
enableArrowButtons: c = !0,
|
|
705
|
+
enablePointerDrag: d = !0,
|
|
706
|
+
onScroll: f,
|
|
707
|
+
className: p,
|
|
708
|
+
style: m,
|
|
709
|
+
background: g,
|
|
710
|
+
tapScrollCircleOptions: E,
|
|
711
|
+
inertiaOptions: x,
|
|
613
712
|
itemCount: A,
|
|
614
713
|
renderThumbOverlay: U,
|
|
615
|
-
wheelSpeedMultiplier:
|
|
616
|
-
contentInsets:
|
|
617
|
-
visibleStartIndex:
|
|
618
|
-
visibleEndIndex:
|
|
619
|
-
renderOverlay:
|
|
620
|
-
|
|
621
|
-
|
|
714
|
+
wheelSpeedMultiplier: q = 1,
|
|
715
|
+
contentInsets: Q,
|
|
716
|
+
visibleStartIndex: bt,
|
|
717
|
+
visibleEndIndex: lt,
|
|
718
|
+
renderOverlay: it,
|
|
719
|
+
initialScrollPosition: Y = 0
|
|
720
|
+
}, tt) => {
|
|
721
|
+
const C = S(Y), K = S(null), G = S(null), It = S({
|
|
622
722
|
frame: null,
|
|
623
723
|
velocity: 0,
|
|
624
724
|
lastTimestamp: null
|
|
625
|
-
}),
|
|
725
|
+
}), L = Vt(
|
|
626
726
|
() => ({
|
|
627
|
-
maxVelocity:
|
|
628
|
-
minVelocity:
|
|
629
|
-
deceleration:
|
|
630
|
-
velocitySampleWindow:
|
|
631
|
-
startVelocityThreshold:
|
|
727
|
+
maxVelocity: x?.maxVelocity ?? de.maxVelocity,
|
|
728
|
+
minVelocity: x?.minVelocity ?? de.minVelocity,
|
|
729
|
+
deceleration: x?.deceleration ?? de.deceleration,
|
|
730
|
+
velocitySampleWindow: x?.velocitySampleWindow ?? de.velocitySampleWindow,
|
|
731
|
+
startVelocityThreshold: x?.startVelocityThreshold ?? de.startVelocityThreshold
|
|
632
732
|
}),
|
|
633
|
-
[
|
|
634
|
-
),
|
|
635
|
-
top: Math.max(0,
|
|
636
|
-
bottom: Math.max(0,
|
|
637
|
-
}), [
|
|
638
|
-
|
|
733
|
+
[x]
|
|
734
|
+
), D = Vt(() => ({
|
|
735
|
+
top: Math.max(0, Q?.top ?? 0),
|
|
736
|
+
bottom: Math.max(0, Q?.bottom ?? 0)
|
|
737
|
+
}), [Q]);
|
|
738
|
+
_.debug("[ScrollPane] ScrollPane rendered", {
|
|
639
739
|
contentSize: t,
|
|
640
740
|
viewportSize: e,
|
|
641
|
-
scrollBarWidth:
|
|
642
|
-
className:
|
|
643
|
-
style:
|
|
644
|
-
tapScrollCircleOptions:
|
|
645
|
-
inertiaOptions:
|
|
646
|
-
enablePointerDrag:
|
|
647
|
-
contentInsets:
|
|
741
|
+
scrollBarWidth: r,
|
|
742
|
+
className: p,
|
|
743
|
+
style: m,
|
|
744
|
+
tapScrollCircleOptions: E,
|
|
745
|
+
inertiaOptions: x,
|
|
746
|
+
enablePointerDrag: d,
|
|
747
|
+
contentInsets: D
|
|
648
748
|
});
|
|
649
|
-
const
|
|
749
|
+
const Z = S({ contentSize: t, viewportSize: e });
|
|
750
|
+
Z.current = { contentSize: t, viewportSize: e };
|
|
751
|
+
const J = Vt(() => t > e, [t, e]), W = T(
|
|
650
752
|
(I) => {
|
|
651
|
-
const { contentSize:
|
|
652
|
-
if (
|
|
653
|
-
return
|
|
654
|
-
const
|
|
655
|
-
return
|
|
753
|
+
const { contentSize: N, viewportSize: k } = Z.current, et = N > k, ut = C.current;
|
|
754
|
+
if (_.debug("[ScrollPane] scrollTo called", { newPosition: I, contentSize: N, viewportSize: k, currentIsScrollable: et, prevPosition: ut }), !et)
|
|
755
|
+
return C.current !== 0 && (C.current = 0, f?.(0, ut)), C.current;
|
|
756
|
+
const Dt = typeof I == "function" ? I(C.current) : I, mt = Math.max(N - k, 0), st = pt(Dt, 0, mt);
|
|
757
|
+
return C.current !== st && (C.current = st, f?.(st, ut)), C.current;
|
|
656
758
|
},
|
|
657
|
-
[
|
|
658
|
-
),
|
|
659
|
-
const I =
|
|
759
|
+
[f]
|
|
760
|
+
), F = T(() => {
|
|
761
|
+
const I = It.current;
|
|
660
762
|
I.frame !== null && cancelAnimationFrame(I.frame), I.frame = null, I.velocity = 0, I.lastTimestamp = null;
|
|
661
|
-
}, []),
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
}, [
|
|
665
|
-
const
|
|
763
|
+
}, []), Tt = S(F);
|
|
764
|
+
B(() => {
|
|
765
|
+
Tt.current = F;
|
|
766
|
+
}, [F]);
|
|
767
|
+
const ct = T(
|
|
666
768
|
(I) => {
|
|
667
|
-
if (!
|
|
769
|
+
if (!J)
|
|
668
770
|
return;
|
|
669
|
-
const { maxVelocity:
|
|
670
|
-
if (Math.abs(
|
|
771
|
+
const { maxVelocity: N, minVelocity: k, deceleration: et, startVelocityThreshold: ut } = L, Dt = pt(I, -N, N);
|
|
772
|
+
if (Math.abs(Dt) < ut)
|
|
671
773
|
return;
|
|
672
|
-
|
|
673
|
-
const
|
|
674
|
-
const
|
|
675
|
-
if (
|
|
676
|
-
|
|
774
|
+
F(), It.current.velocity = Dt, It.current.lastTimestamp = null;
|
|
775
|
+
const mt = (st) => {
|
|
776
|
+
const ot = It.current;
|
|
777
|
+
if (ot.lastTimestamp === null) {
|
|
778
|
+
ot.lastTimestamp = st, ot.frame = requestAnimationFrame(mt);
|
|
677
779
|
return;
|
|
678
780
|
}
|
|
679
|
-
const
|
|
680
|
-
if (
|
|
681
|
-
|
|
781
|
+
const Ct = st - ot.lastTimestamp;
|
|
782
|
+
if (ot.lastTimestamp = st, Ct <= 0) {
|
|
783
|
+
ot.frame = requestAnimationFrame(mt);
|
|
682
784
|
return;
|
|
683
785
|
}
|
|
684
|
-
const
|
|
685
|
-
let
|
|
686
|
-
const
|
|
687
|
-
|
|
688
|
-
const
|
|
689
|
-
|
|
690
|
-
const
|
|
691
|
-
|
|
692
|
-
const
|
|
693
|
-
if (Math.abs(
|
|
694
|
-
|
|
786
|
+
const Et = ot.velocity;
|
|
787
|
+
let wt = Et;
|
|
788
|
+
const At = et * Ct;
|
|
789
|
+
Et > 0 ? wt = Math.max(0, Et - At) : Et < 0 && (wt = Math.min(0, Et + At));
|
|
790
|
+
const ht = (Et + wt) / 2 * Ct, h = C.current;
|
|
791
|
+
ht !== 0 && W((ft) => ft + ht);
|
|
792
|
+
const M = C.current, { contentSize: j, viewportSize: at } = Z.current, dt = Math.max(j - at, 0);
|
|
793
|
+
ot.velocity = wt;
|
|
794
|
+
const Ot = M === h || M <= 0 && wt <= 0 || M >= dt && wt >= 0;
|
|
795
|
+
if (Math.abs(wt) < k || Ot) {
|
|
796
|
+
F();
|
|
695
797
|
return;
|
|
696
798
|
}
|
|
697
|
-
|
|
799
|
+
ot.frame = requestAnimationFrame(mt);
|
|
698
800
|
};
|
|
699
|
-
|
|
801
|
+
It.current.frame = requestAnimationFrame(mt);
|
|
700
802
|
},
|
|
701
|
-
[
|
|
702
|
-
), vt = S(
|
|
703
|
-
|
|
704
|
-
vt.current =
|
|
705
|
-
}, [
|
|
706
|
-
|
|
707
|
-
}, [t, e]),
|
|
708
|
-
const I =
|
|
803
|
+
[J, L, W, F]
|
|
804
|
+
), vt = S(ct);
|
|
805
|
+
B(() => {
|
|
806
|
+
vt.current = ct;
|
|
807
|
+
}, [ct]), ae(() => {
|
|
808
|
+
Z.current = { contentSize: t, viewportSize: e };
|
|
809
|
+
}, [t, e]), ae(() => {
|
|
810
|
+
const I = G.current;
|
|
709
811
|
if (!I) return;
|
|
710
|
-
const
|
|
711
|
-
I.scrollTop !== 0 && (
|
|
812
|
+
const N = () => {
|
|
813
|
+
I.scrollTop !== 0 && (_.debug("[ScrollPane] Native scroll detected, resetting to 0", { scrollTop: I.scrollTop }), I.scrollTop = 0), I.scrollLeft !== 0 && (I.scrollLeft = 0);
|
|
712
814
|
};
|
|
713
|
-
return I.addEventListener("scroll",
|
|
714
|
-
}, []),
|
|
715
|
-
if (
|
|
716
|
-
|
|
717
|
-
const I =
|
|
718
|
-
|
|
815
|
+
return I.addEventListener("scroll", N), () => I.removeEventListener("scroll", N);
|
|
816
|
+
}, []), ae(() => {
|
|
817
|
+
if (J) {
|
|
818
|
+
_.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", { contentSize: t, viewportSize: e, scrollPosition: C.current });
|
|
819
|
+
const I = pt(t - e, 0, t);
|
|
820
|
+
C.current > I && W(I);
|
|
719
821
|
} else
|
|
720
|
-
|
|
721
|
-
}, [
|
|
722
|
-
const I = (
|
|
723
|
-
if (!
|
|
822
|
+
W(0);
|
|
823
|
+
}, [J, W, t, e]), B(() => {
|
|
824
|
+
const I = (k) => {
|
|
825
|
+
if (!J)
|
|
724
826
|
return;
|
|
725
|
-
|
|
726
|
-
let et =
|
|
727
|
-
|
|
728
|
-
},
|
|
729
|
-
return
|
|
730
|
-
|
|
827
|
+
k.preventDefault(), F();
|
|
828
|
+
let et = k.deltaY;
|
|
829
|
+
k.deltaMode === 1 ? et *= 16 : k.deltaMode === 2 && (et *= e), q !== 1 && (et *= q), _.debug("[ScrollPane] wheel event", { deltaY: et, scrollPosition: C.current, wheelSpeedMultiplier: q, deltaMode: k.deltaMode, scrollTop: G.current?.scrollTop }), W((ut) => ut + et);
|
|
830
|
+
}, N = K.current;
|
|
831
|
+
return N && N.addEventListener("wheel", I, { passive: !1 }), () => {
|
|
832
|
+
N && N.removeEventListener("wheel", I);
|
|
731
833
|
};
|
|
732
|
-
}, [
|
|
733
|
-
|
|
834
|
+
}, [J, W, F, e, q]), ye(
|
|
835
|
+
tt,
|
|
734
836
|
() => ({
|
|
735
|
-
scrollTo: (I) => (
|
|
736
|
-
getScrollPosition: () =>
|
|
837
|
+
scrollTo: (I) => (F(), W(I)),
|
|
838
|
+
getScrollPosition: () => C.current,
|
|
737
839
|
getContentSize: () => t,
|
|
738
840
|
getViewportSize: () => e
|
|
739
841
|
}),
|
|
740
|
-
[
|
|
842
|
+
[W, t, e, F]
|
|
741
843
|
);
|
|
742
|
-
const
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
}, [
|
|
746
|
-
const
|
|
844
|
+
const v = S(W);
|
|
845
|
+
B(() => {
|
|
846
|
+
v.current = W;
|
|
847
|
+
}, [W]);
|
|
848
|
+
const Mt = Xe(), b = S({
|
|
747
849
|
pointerId: null,
|
|
748
850
|
startClientY: 0,
|
|
749
851
|
startScroll: 0,
|
|
@@ -751,200 +853,201 @@ const ht = (o, t, e) => Math.min(e, Math.max(t, o)), be = "virtualscroll:tap-scr
|
|
|
751
853
|
shouldCancelNextClick: !1,
|
|
752
854
|
clickResetTimer: null,
|
|
753
855
|
velocitySamples: []
|
|
754
|
-
}),
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
}, [
|
|
758
|
-
const
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
}, [
|
|
762
|
-
const
|
|
763
|
-
return
|
|
764
|
-
|
|
765
|
-
}, [
|
|
766
|
-
if (
|
|
856
|
+
}), Pt = S(d);
|
|
857
|
+
B(() => {
|
|
858
|
+
Pt.current = d;
|
|
859
|
+
}, [d]);
|
|
860
|
+
const yt = S(J);
|
|
861
|
+
B(() => {
|
|
862
|
+
yt.current = J;
|
|
863
|
+
}, [J]);
|
|
864
|
+
const Lt = S(L);
|
|
865
|
+
return B(() => {
|
|
866
|
+
Lt.current = L;
|
|
867
|
+
}, [L]), B(() => {
|
|
868
|
+
if (d)
|
|
767
869
|
return;
|
|
768
|
-
const I =
|
|
769
|
-
|
|
770
|
-
}, [
|
|
771
|
-
const I =
|
|
870
|
+
const I = G.current, N = b.current;
|
|
871
|
+
N.pointerId && I?.hasPointerCapture(N.pointerId) && I.releasePointerCapture(N.pointerId), N.clickResetTimer !== null && (window.clearTimeout(N.clickResetTimer), N.clickResetTimer = null), N.pointerId = null, N.startClientY = 0, N.startScroll = 0, N.isDragging = !1, N.shouldCancelNextClick = !1, N.velocitySamples = [];
|
|
872
|
+
}, [d]), B(() => {
|
|
873
|
+
const I = G.current;
|
|
772
874
|
if (!I)
|
|
773
875
|
return;
|
|
774
|
-
const
|
|
775
|
-
const
|
|
776
|
-
|
|
777
|
-
},
|
|
778
|
-
const
|
|
779
|
-
|
|
780
|
-
},
|
|
781
|
-
const
|
|
782
|
-
|
|
783
|
-
const
|
|
784
|
-
|
|
785
|
-
},
|
|
786
|
-
const
|
|
787
|
-
|
|
788
|
-
},
|
|
789
|
-
const
|
|
790
|
-
|
|
791
|
-
},
|
|
792
|
-
const
|
|
793
|
-
if (
|
|
876
|
+
const N = 6, k = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), et = () => {
|
|
877
|
+
const h = b.current;
|
|
878
|
+
h.pointerId = null, h.startClientY = 0, h.startScroll = 0, h.isDragging = !1, h.velocitySamples = [];
|
|
879
|
+
}, ut = () => {
|
|
880
|
+
const h = b.current;
|
|
881
|
+
h.clickResetTimer !== null && (window.clearTimeout(h.clickResetTimer), h.clickResetTimer = null);
|
|
882
|
+
}, Dt = (h) => {
|
|
883
|
+
const M = b.current, j = k();
|
|
884
|
+
M.velocitySamples.push({ clientY: h, time: j });
|
|
885
|
+
const at = Lt.current.velocitySampleWindow;
|
|
886
|
+
M.velocitySamples = M.velocitySamples.filter((dt) => j - dt.time <= at);
|
|
887
|
+
}, mt = (h) => h instanceof HTMLElement && h.closest("[data-scrollpane-ignore-drag='true']") !== null, st = (h) => {
|
|
888
|
+
const M = b.current;
|
|
889
|
+
M.shouldCancelNextClick && (h.preventDefault(), h.stopPropagation(), M.shouldCancelNextClick = !1);
|
|
890
|
+
}, ot = (h) => {
|
|
891
|
+
const M = b.current;
|
|
892
|
+
M.isDragging || (M.isDragging = !0, M.shouldCancelNextClick = !0, I.hasPointerCapture(h.pointerId) || I.setPointerCapture(h.pointerId), Dt(h.clientY));
|
|
893
|
+
}, Ct = (h) => {
|
|
894
|
+
const M = b.current;
|
|
895
|
+
if (M.pointerId !== h.pointerId || !(Pt.current && yt.current) || !M.isDragging && (Math.abs(h.clientY - M.startClientY) < N || (ot(h), !M.isDragging)))
|
|
794
896
|
return;
|
|
795
|
-
|
|
796
|
-
const
|
|
797
|
-
|
|
798
|
-
},
|
|
799
|
-
const
|
|
800
|
-
if (
|
|
897
|
+
Dt(h.clientY);
|
|
898
|
+
const j = h.clientY - M.startClientY, at = M.startScroll - j;
|
|
899
|
+
v.current(at), h.cancelable && h.preventDefault();
|
|
900
|
+
}, Et = (h) => {
|
|
901
|
+
const M = b.current;
|
|
902
|
+
if (M.pointerId !== h.pointerId)
|
|
801
903
|
return;
|
|
802
|
-
|
|
803
|
-
let
|
|
804
|
-
if (
|
|
805
|
-
const
|
|
806
|
-
if (
|
|
807
|
-
const
|
|
808
|
-
|
|
904
|
+
M.isDragging && M.shouldCancelNextClick && h.cancelable && (h.preventDefault(), h.stopPropagation()), I.hasPointerCapture(h.pointerId) && I.releasePointerCapture(h.pointerId);
|
|
905
|
+
let j = 0;
|
|
906
|
+
if (M.isDragging && M.velocitySamples.length >= 2) {
|
|
907
|
+
const dt = M.velocitySamples, Ot = Lt.current.velocitySampleWindow, ft = dt[dt.length - 1], Yt = dt.find((Zt) => ft.time - Zt.time <= Ot) ?? dt[0];
|
|
908
|
+
if (ft && Yt && ft.time !== Yt.time) {
|
|
909
|
+
const Zt = ft.clientY - Yt.clientY, Nt = ft.time - Yt.time;
|
|
910
|
+
j = -(Zt / Nt);
|
|
809
911
|
}
|
|
810
912
|
}
|
|
811
|
-
|
|
812
|
-
const
|
|
813
|
-
|
|
913
|
+
ut(), M.shouldCancelNextClick && (M.clickResetTimer = window.setTimeout(() => {
|
|
914
|
+
const dt = b.current;
|
|
915
|
+
dt.shouldCancelNextClick = !1, dt.clickResetTimer = null;
|
|
814
916
|
}, 0));
|
|
815
|
-
const
|
|
816
|
-
et(), Math.abs(
|
|
817
|
-
},
|
|
818
|
-
if (!(
|
|
917
|
+
const at = Lt.current.startVelocityThreshold;
|
|
918
|
+
et(), Math.abs(j) >= at && vt.current?.(j);
|
|
919
|
+
}, wt = (h) => {
|
|
920
|
+
if (!(Pt.current && yt.current) || h.button !== 0 && h.pointerType === "mouse" || h.ctrlKey || h.metaKey || h.altKey || mt(h.target))
|
|
819
921
|
return;
|
|
820
|
-
window.dispatchEvent(new CustomEvent(
|
|
821
|
-
const
|
|
822
|
-
|
|
823
|
-
},
|
|
824
|
-
const
|
|
825
|
-
|
|
826
|
-
},
|
|
827
|
-
["click",
|
|
828
|
-
["pointerdown",
|
|
829
|
-
["pointermove",
|
|
830
|
-
["pointerup",
|
|
831
|
-
["pointercancel",
|
|
832
|
-
],
|
|
833
|
-
["pointermove",
|
|
834
|
-
["pointerup",
|
|
835
|
-
["pointercancel",
|
|
922
|
+
window.dispatchEvent(new CustomEvent(Se, { detail: { paneId: Mt } })), Tt.current?.();
|
|
923
|
+
const M = b.current;
|
|
924
|
+
ut(), M.pointerId = h.pointerId, M.startClientY = h.clientY, M.startScroll = C.current, M.isDragging = !1, M.shouldCancelNextClick = !1, M.velocitySamples = [];
|
|
925
|
+
}, At = (h) => {
|
|
926
|
+
const M = b.current;
|
|
927
|
+
M.pointerId === h.pointerId && (M.shouldCancelNextClick = !1, I.hasPointerCapture(h.pointerId) && I.releasePointerCapture(h.pointerId), ut(), et());
|
|
928
|
+
}, Bt = [
|
|
929
|
+
["click", st, !0],
|
|
930
|
+
["pointerdown", wt, { passive: !1 }],
|
|
931
|
+
["pointermove", Ct, { passive: !1 }],
|
|
932
|
+
["pointerup", Et, void 0],
|
|
933
|
+
["pointercancel", At, void 0]
|
|
934
|
+
], ht = [
|
|
935
|
+
["pointermove", Ct, { passive: !1 }],
|
|
936
|
+
["pointerup", Et, void 0],
|
|
937
|
+
["pointercancel", At, void 0]
|
|
836
938
|
];
|
|
837
|
-
return
|
|
838
|
-
|
|
839
|
-
const
|
|
840
|
-
|
|
939
|
+
return ge(I, Bt, "add"), ge(window, ht, "add"), () => {
|
|
940
|
+
ge(I, Bt, "remove"), ge(window, ht, "remove");
|
|
941
|
+
const h = b.current;
|
|
942
|
+
h.pointerId !== null && I.hasPointerCapture(h.pointerId) && I.releasePointerCapture(h.pointerId), ut(), et();
|
|
841
943
|
};
|
|
842
|
-
}, [
|
|
843
|
-
/* @__PURE__ */
|
|
944
|
+
}, [Mt]), /* @__PURE__ */ re("div", { ref: K, className: ee("aqvs-scroll-pane", p), style: m, children: [
|
|
945
|
+
/* @__PURE__ */ re(
|
|
844
946
|
"div",
|
|
845
947
|
{
|
|
846
|
-
ref:
|
|
847
|
-
className:
|
|
948
|
+
ref: G,
|
|
949
|
+
className: ee("aqvs-scroll-pane-content"),
|
|
848
950
|
style: {
|
|
849
951
|
height: e,
|
|
850
|
-
paddingTop:
|
|
851
|
-
paddingBottom:
|
|
852
|
-
...
|
|
952
|
+
paddingTop: D.top,
|
|
953
|
+
paddingBottom: D.bottom,
|
|
954
|
+
...d ? { touchAction: "none" } : {}
|
|
853
955
|
},
|
|
854
|
-
id:
|
|
956
|
+
id: Mt,
|
|
855
957
|
children: [
|
|
856
|
-
|
|
857
|
-
|
|
958
|
+
g,
|
|
959
|
+
n(C.current)
|
|
858
960
|
]
|
|
859
961
|
}
|
|
860
962
|
),
|
|
861
|
-
|
|
963
|
+
/* @__PURE__ */ $(
|
|
862
964
|
or,
|
|
863
965
|
{
|
|
864
966
|
contentSize: t,
|
|
865
967
|
viewportSize: e,
|
|
866
|
-
scrollPosition:
|
|
867
|
-
onScroll:
|
|
968
|
+
scrollPosition: C.current,
|
|
969
|
+
onScroll: W,
|
|
868
970
|
enableThumbDrag: s,
|
|
869
|
-
enableTrackClick:
|
|
870
|
-
enableArrowButtons:
|
|
871
|
-
scrollBarWidth:
|
|
872
|
-
ariaControls:
|
|
873
|
-
tapScrollCircleOptions:
|
|
971
|
+
enableTrackClick: l,
|
|
972
|
+
enableArrowButtons: c,
|
|
973
|
+
scrollBarWidth: r,
|
|
974
|
+
ariaControls: Mt,
|
|
975
|
+
tapScrollCircleOptions: E,
|
|
874
976
|
itemCount: A,
|
|
875
977
|
renderThumbOverlay: U,
|
|
876
|
-
visibleStartIndex:
|
|
877
|
-
visibleEndIndex:
|
|
878
|
-
}
|
|
978
|
+
visibleStartIndex: bt,
|
|
979
|
+
visibleEndIndex: lt
|
|
980
|
+
},
|
|
981
|
+
"scrollbar"
|
|
879
982
|
),
|
|
880
|
-
|
|
983
|
+
it?.()
|
|
881
984
|
] });
|
|
882
985
|
}
|
|
883
|
-
),
|
|
884
|
-
const s = Math.max(
|
|
885
|
-
return /* @__PURE__ */
|
|
886
|
-
/* @__PURE__ */
|
|
986
|
+
), Ee = (n, t, e) => Math.min(Math.max(n, t), e), Tr = ({ dragState: n, normalizedDistance: t, sizeScale: e, size: r }) => {
|
|
987
|
+
const s = Math.max(r / 2, 1), l = 1 + t * 0.65, c = Math.max(0.65, 1 - t * 0.25), d = n.direction * t * 26 * e, f = 0.8 + t * 0.18, p = 3 * e, m = 6 * e, g = 22 * e, E = Math.abs(d) + m, x = d > 0 ? p : -Math.abs(d) - p, A = Math.max(2.5, 3 * e), U = Ee(n.offsetX, -s, s), q = Ee(n.offsetY, -s, s), Q = s * 0.35, bt = U / s * Q, lt = q / s * Q, it = bt * 0.45, Y = lt * 0.45, tt = Math.max(g * 0.38, 6), C = 0.65 + t * 0.2, K = n.active;
|
|
988
|
+
return /* @__PURE__ */ re(ke, { children: [
|
|
989
|
+
/* @__PURE__ */ $(
|
|
887
990
|
"div",
|
|
888
991
|
{
|
|
889
|
-
className: "aqvs
|
|
992
|
+
className: "aqvs-tap-scroll-circle-gradient",
|
|
890
993
|
style: {
|
|
891
|
-
transform: `scale(${
|
|
892
|
-
transition:
|
|
994
|
+
transform: `scale(${c}, ${l})`,
|
|
995
|
+
transition: K ? "40ms transform ease-out" : "200ms ease transform"
|
|
893
996
|
}
|
|
894
997
|
}
|
|
895
998
|
),
|
|
896
|
-
/* @__PURE__ */
|
|
999
|
+
/* @__PURE__ */ $(
|
|
897
1000
|
"div",
|
|
898
1001
|
{
|
|
899
|
-
className: "
|
|
1002
|
+
className: "aqvs-sample-visual-rod",
|
|
900
1003
|
style: {
|
|
901
|
-
width:
|
|
902
|
-
height:
|
|
903
|
-
transform: `translate(calc(-50% + ${
|
|
904
|
-
transition:
|
|
1004
|
+
width: g,
|
|
1005
|
+
height: g,
|
|
1006
|
+
transform: `translate(calc(-50% + ${bt}px), calc(-50% + ${lt}px)) scale(${c}, ${f * l})`,
|
|
1007
|
+
transition: K ? "70ms transform ease-out" : "200ms ease transform"
|
|
905
1008
|
}
|
|
906
1009
|
}
|
|
907
1010
|
),
|
|
908
|
-
/* @__PURE__ */
|
|
1011
|
+
/* @__PURE__ */ $(
|
|
909
1012
|
"div",
|
|
910
1013
|
{
|
|
911
|
-
className: "
|
|
1014
|
+
className: "aqvs-sample-visual-pupil",
|
|
912
1015
|
style: {
|
|
913
|
-
width:
|
|
914
|
-
height:
|
|
915
|
-
transform: `translate(calc(-50% + ${
|
|
916
|
-
opacity:
|
|
1016
|
+
width: tt,
|
|
1017
|
+
height: tt,
|
|
1018
|
+
transform: `translate(calc(-50% + ${it}px), calc(-50% + ${Y}px)) scale(${c}, ${l})`,
|
|
1019
|
+
opacity: C,
|
|
917
1020
|
boxShadow: "0 0 8px rgba(255,255,255,0.45)",
|
|
918
|
-
transition:
|
|
1021
|
+
transition: K ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
|
|
919
1022
|
}
|
|
920
1023
|
}
|
|
921
1024
|
),
|
|
922
|
-
/* @__PURE__ */
|
|
1025
|
+
/* @__PURE__ */ $(
|
|
923
1026
|
"div",
|
|
924
1027
|
{
|
|
925
|
-
className: "
|
|
1028
|
+
className: "aqvs-sample-visual-highlight",
|
|
926
1029
|
style: {
|
|
927
1030
|
width: A,
|
|
928
|
-
height:
|
|
929
|
-
transform: `translate(-50%, ${
|
|
1031
|
+
height: E,
|
|
1032
|
+
transform: `translate(-50%, ${x}px)`,
|
|
930
1033
|
opacity: t,
|
|
931
|
-
transition:
|
|
1034
|
+
transition: K ? "40ms height, 60ms opacity ease-out ease-out" : "200ms ease height, 120ms ease opacity"
|
|
932
1035
|
}
|
|
933
1036
|
}
|
|
934
1037
|
)
|
|
935
1038
|
] });
|
|
936
|
-
},
|
|
937
|
-
if (!Number.isFinite(
|
|
1039
|
+
}, lr = (n) => {
|
|
1040
|
+
if (!Number.isFinite(n))
|
|
938
1041
|
return 0n;
|
|
939
|
-
const t = Math.trunc(
|
|
1042
|
+
const t = Math.trunc(n);
|
|
940
1043
|
return t <= 0 ? 0n : BigInt(t);
|
|
941
|
-
},
|
|
942
|
-
if (
|
|
1044
|
+
}, xe = (n) => {
|
|
1045
|
+
if (n <= 0 || !Number.isFinite(n))
|
|
943
1046
|
return 0;
|
|
944
|
-
const t = Math.trunc(
|
|
1047
|
+
const t = Math.trunc(n), e = BigInt(t) & -BigInt(t);
|
|
945
1048
|
return Number(e);
|
|
946
1049
|
};
|
|
947
|
-
class
|
|
1050
|
+
class cr {
|
|
948
1051
|
/**
|
|
949
1052
|
* @private
|
|
950
1053
|
* @property {Map<number, number>} tree - The Map storing the Fenwick tree structure, specifically the sums of deltas. It is 1-indexed.
|
|
@@ -984,8 +1087,8 @@ class ar {
|
|
|
984
1087
|
* @param {number | ((index: number) => number)} valueOrFn - The value for all elements, or a function to generate values.
|
|
985
1088
|
* @param {{ sampleRange?: { from: number; to: number }, materialize?: boolean }} [options] - Optional settings for initialization.
|
|
986
1089
|
*/
|
|
987
|
-
constructor(t, e,
|
|
988
|
-
this.reset(t, e,
|
|
1090
|
+
constructor(t, e, r) {
|
|
1091
|
+
this.reset(t, e, r);
|
|
989
1092
|
}
|
|
990
1093
|
/**
|
|
991
1094
|
* @method reset
|
|
@@ -995,20 +1098,20 @@ class ar {
|
|
|
995
1098
|
* @param {number | ((index: number) => number)} valueOrFn - The value for all elements, or a function to generate values.
|
|
996
1099
|
* @param {{ sampleRange?: { from: number; to: number }, materialize?: boolean }} [options] - Optional settings for initialization.
|
|
997
1100
|
*/
|
|
998
|
-
reset(t, e,
|
|
1101
|
+
reset(t, e, r) {
|
|
999
1102
|
if (this.size = t, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.total = void 0, typeof e == "function") {
|
|
1000
1103
|
if (this.valueFn = e, this.size > 0) {
|
|
1001
|
-
const
|
|
1104
|
+
const l = r?.sampleRange ?? {
|
|
1002
1105
|
from: 0,
|
|
1003
1106
|
to: Math.min(99, this.size - 1)
|
|
1004
|
-
}, { mode:
|
|
1005
|
-
if (this.baseValue =
|
|
1006
|
-
for (let
|
|
1007
|
-
const
|
|
1008
|
-
if (
|
|
1107
|
+
}, { mode: c, materializedValues: d } = this._calculateMode(l.from, l.to);
|
|
1108
|
+
if (this.baseValue = c, r?.materialize)
|
|
1109
|
+
for (let f = 0; f < d.length; f++) {
|
|
1110
|
+
const p = d[f], m = l.from + f;
|
|
1111
|
+
if (m >= this.size)
|
|
1009
1112
|
break;
|
|
1010
|
-
const
|
|
1011
|
-
this.deltas.set(
|
|
1113
|
+
const g = p - this.baseValue;
|
|
1114
|
+
this.deltas.set(m, g), this._updateTree(m, g);
|
|
1012
1115
|
}
|
|
1013
1116
|
} else
|
|
1014
1117
|
this.baseValue = 0;
|
|
@@ -1042,30 +1145,30 @@ class ar {
|
|
|
1042
1145
|
_calculateMode(t, e) {
|
|
1043
1146
|
if (!this.valueFn)
|
|
1044
1147
|
return { mode: 0, materializedValues: [] };
|
|
1045
|
-
const
|
|
1046
|
-
for (let
|
|
1047
|
-
|
|
1048
|
-
const s = [...
|
|
1049
|
-
if (
|
|
1148
|
+
const r = [];
|
|
1149
|
+
for (let p = t; p <= e && !(p >= this.size); p++)
|
|
1150
|
+
r.push(this.valueFn(p));
|
|
1151
|
+
const s = [...r];
|
|
1152
|
+
if (r.length === 0)
|
|
1050
1153
|
return { mode: 0, materializedValues: [] };
|
|
1051
|
-
|
|
1052
|
-
const
|
|
1053
|
-
let
|
|
1054
|
-
|
|
1055
|
-
const
|
|
1056
|
-
let
|
|
1057
|
-
for (const
|
|
1058
|
-
const
|
|
1059
|
-
|
|
1154
|
+
r.sort((p, m) => p - m);
|
|
1155
|
+
const l = Math.floor(r.length / 2);
|
|
1156
|
+
let c;
|
|
1157
|
+
r.length % 2 === 0 ? c = Math.floor((r[l - 1] + r[l]) / 2) : c = r[l];
|
|
1158
|
+
const d = /* @__PURE__ */ new Map();
|
|
1159
|
+
let f = 0;
|
|
1160
|
+
for (const p of r) {
|
|
1161
|
+
const m = (d.get(p) ?? 0) + 1;
|
|
1162
|
+
d.set(p, m), m > f && (f = m);
|
|
1060
1163
|
}
|
|
1061
|
-
if (
|
|
1062
|
-
const
|
|
1063
|
-
for (const [
|
|
1064
|
-
|
|
1065
|
-
const
|
|
1066
|
-
|
|
1164
|
+
if (f > r.length * 0.2) {
|
|
1165
|
+
const p = [];
|
|
1166
|
+
for (const [g, E] of d.entries())
|
|
1167
|
+
E === f && p.push(g);
|
|
1168
|
+
const m = p.reduce((g, E) => g + E, 0);
|
|
1169
|
+
c = Math.floor(m / p.length);
|
|
1067
1170
|
}
|
|
1068
|
-
return { mode:
|
|
1171
|
+
return { mode: c, materializedValues: s };
|
|
1069
1172
|
}
|
|
1070
1173
|
/**
|
|
1071
1174
|
* @method update
|
|
@@ -1104,11 +1207,11 @@ class ar {
|
|
|
1104
1207
|
* @param {DeltaUpdate[]} updates - An array of updates, each with an index and the change to apply.
|
|
1105
1208
|
*/
|
|
1106
1209
|
updateDeltas(t) {
|
|
1107
|
-
for (const { index: e, change:
|
|
1210
|
+
for (const { index: e, change: r } of t) {
|
|
1108
1211
|
if (e < 0 || e >= this.size)
|
|
1109
1212
|
throw new Error(`Index ${e} out of bounds`);
|
|
1110
1213
|
const s = this.deltas.get(e) ?? 0;
|
|
1111
|
-
this.deltas.set(e, s +
|
|
1214
|
+
this.deltas.set(e, s + r), this._updateTree(e, r);
|
|
1112
1215
|
}
|
|
1113
1216
|
return this.total;
|
|
1114
1217
|
}
|
|
@@ -1123,13 +1226,13 @@ class ar {
|
|
|
1123
1226
|
_updateTree(t, e) {
|
|
1124
1227
|
if (e === 0)
|
|
1125
1228
|
return;
|
|
1126
|
-
let
|
|
1127
|
-
for (;
|
|
1128
|
-
this.tree.set(
|
|
1129
|
-
const s =
|
|
1229
|
+
let r = t + 1;
|
|
1230
|
+
for (; r <= this.size; ) {
|
|
1231
|
+
this.tree.set(r, (this.tree.get(r) ?? 0) + e);
|
|
1232
|
+
const s = xe(r);
|
|
1130
1233
|
if (s === 0)
|
|
1131
1234
|
break;
|
|
1132
|
-
|
|
1235
|
+
r += s;
|
|
1133
1236
|
}
|
|
1134
1237
|
this.total !== void 0 && (this.total += e);
|
|
1135
1238
|
}
|
|
@@ -1143,13 +1246,13 @@ class ar {
|
|
|
1143
1246
|
*/
|
|
1144
1247
|
_buildDeltaUpdates(t) {
|
|
1145
1248
|
const e = [];
|
|
1146
|
-
for (const { index:
|
|
1147
|
-
if (
|
|
1148
|
-
throw new Error(`Index ${
|
|
1249
|
+
for (const { index: r, value: s } of t) {
|
|
1250
|
+
if (r < 0 || r >= this.size)
|
|
1251
|
+
throw new Error(`Index ${r} out of bounds`);
|
|
1149
1252
|
if (s < 0)
|
|
1150
1253
|
throw new Error("Value cannot be negative.");
|
|
1151
|
-
const
|
|
1152
|
-
|
|
1254
|
+
const l = this.deltas.has(r) ? (this.deltas.get(r) ?? 0) + this.baseValue : this.baseValue, c = s - l;
|
|
1255
|
+
c !== 0 && e.push({ index: r, change: c });
|
|
1153
1256
|
}
|
|
1154
1257
|
return e;
|
|
1155
1258
|
}
|
|
@@ -1166,10 +1269,10 @@ class ar {
|
|
|
1166
1269
|
let t = 0, e = this.size;
|
|
1167
1270
|
for (; e > 0; ) {
|
|
1168
1271
|
t += this.tree.get(e) ?? 0;
|
|
1169
|
-
const
|
|
1170
|
-
if (
|
|
1272
|
+
const r = xe(e);
|
|
1273
|
+
if (r === 0)
|
|
1171
1274
|
break;
|
|
1172
|
-
e -=
|
|
1275
|
+
e -= r;
|
|
1173
1276
|
}
|
|
1174
1277
|
return t + this.baseValue * this.size;
|
|
1175
1278
|
}
|
|
@@ -1183,10 +1286,10 @@ class ar {
|
|
|
1183
1286
|
*/
|
|
1184
1287
|
_materialize(t, e = !0) {
|
|
1185
1288
|
if (this.valueFn) {
|
|
1186
|
-
const
|
|
1187
|
-
if (
|
|
1188
|
-
const
|
|
1189
|
-
this._updateTree(t,
|
|
1289
|
+
const r = this.deltas.get(t) ?? 0, l = this.valueFn(t) - this.baseValue;
|
|
1290
|
+
if (l !== r && (this.deltas.set(t, l), e)) {
|
|
1291
|
+
const c = l - r;
|
|
1292
|
+
this._updateTree(t, c);
|
|
1190
1293
|
}
|
|
1191
1294
|
}
|
|
1192
1295
|
}
|
|
@@ -1199,24 +1302,24 @@ class ar {
|
|
|
1199
1302
|
* @param {number | undefined} index - Target index for materialization.
|
|
1200
1303
|
* @param {boolean} [forceIndex=false] - When true, materializes the index even if it is outside the provided ranges.
|
|
1201
1304
|
*/
|
|
1202
|
-
_materializeRanges(t, e,
|
|
1305
|
+
_materializeRanges(t, e, r = !1) {
|
|
1203
1306
|
if (!(t?.materialize && this.valueFn))
|
|
1204
1307
|
return;
|
|
1205
1308
|
const s = t.ranges;
|
|
1206
1309
|
if (s && s.length > 0) {
|
|
1207
|
-
for (const
|
|
1208
|
-
const
|
|
1209
|
-
for (let
|
|
1210
|
-
this._materialize(
|
|
1310
|
+
for (const d of s) {
|
|
1311
|
+
const f = d.from, p = Math.min(d.to, this.size - 1);
|
|
1312
|
+
for (let m = f; m <= p; m++)
|
|
1313
|
+
this._materialize(m);
|
|
1211
1314
|
}
|
|
1212
1315
|
if (e === void 0)
|
|
1213
1316
|
return;
|
|
1214
|
-
if (
|
|
1317
|
+
if (r) {
|
|
1215
1318
|
this._materialize(e);
|
|
1216
1319
|
return;
|
|
1217
1320
|
}
|
|
1218
|
-
const
|
|
1219
|
-
e >=
|
|
1321
|
+
const l = s[0].from, c = s[s.length - 1].to;
|
|
1322
|
+
e >= l && e <= c && this._materialize(e);
|
|
1220
1323
|
return;
|
|
1221
1324
|
}
|
|
1222
1325
|
e !== void 0 && this._materialize(e);
|
|
@@ -1231,31 +1334,31 @@ class ar {
|
|
|
1231
1334
|
* @param {boolean} chooseLowerBound - When true, finds the smallest index meeting or exceeding the target; otherwise finds the largest index not exceeding it.
|
|
1232
1335
|
* @returns {{ index: number; total: number | undefined; cumulative: number | undefined; currentValue: number | undefined; safeIndex: number | undefined }} Binary search result.
|
|
1233
1336
|
*/
|
|
1234
|
-
_findIndex(t, e = {},
|
|
1235
|
-
if (this.size
|
|
1236
|
-
return this._findIndexLarge(t, e,
|
|
1337
|
+
_findIndex(t, e = {}, r) {
|
|
1338
|
+
if (this.size > 2147483647)
|
|
1339
|
+
return this._findIndexLarge(t, e, r);
|
|
1237
1340
|
if (this.size === 0)
|
|
1238
1341
|
return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1239
|
-
let s = 0,
|
|
1240
|
-
for (;
|
|
1241
|
-
|
|
1242
|
-
for (;
|
|
1243
|
-
const
|
|
1244
|
-
if (
|
|
1245
|
-
const
|
|
1246
|
-
(
|
|
1342
|
+
let s = 0, l = 0, c = 1;
|
|
1343
|
+
for (; c << 1 <= this.size; )
|
|
1344
|
+
c <<= 1;
|
|
1345
|
+
for (; c > 0; c >>= 1) {
|
|
1346
|
+
const p = s + c;
|
|
1347
|
+
if (p <= this.size) {
|
|
1348
|
+
const g = (this.tree.get(p) ?? 0) + this.baseValue * c;
|
|
1349
|
+
(r ? l + g < t : l + g <= t) && (s = p, l += g);
|
|
1247
1350
|
}
|
|
1248
1351
|
}
|
|
1249
|
-
const
|
|
1250
|
-
if (
|
|
1352
|
+
const d = r ? s : s - 1;
|
|
1353
|
+
if (d < 0 || d >= this.size)
|
|
1251
1354
|
return { index: -1, total: this.total ?? this.getTotal(), cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1252
|
-
const
|
|
1355
|
+
const f = this.prefixSum(d, e);
|
|
1253
1356
|
return {
|
|
1254
|
-
index:
|
|
1255
|
-
total: this.total ??
|
|
1256
|
-
cumulative:
|
|
1257
|
-
currentValue:
|
|
1258
|
-
safeIndex:
|
|
1357
|
+
index: d,
|
|
1358
|
+
total: this.total ?? f.total,
|
|
1359
|
+
cumulative: f.cumulative,
|
|
1360
|
+
currentValue: f.currentValue,
|
|
1361
|
+
safeIndex: f.safeIndex
|
|
1259
1362
|
};
|
|
1260
1363
|
}
|
|
1261
1364
|
/**
|
|
@@ -1263,37 +1366,37 @@ class ar {
|
|
|
1263
1366
|
*
|
|
1264
1367
|
* 非常に大きなサイズに対して bigint 演算を用いた二分探索を実施。
|
|
1265
1368
|
*/
|
|
1266
|
-
_findIndexLarge(t, e,
|
|
1369
|
+
_findIndexLarge(t, e, r) {
|
|
1267
1370
|
if (this.size === 0)
|
|
1268
1371
|
return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1269
|
-
const s =
|
|
1372
|
+
const s = lr(this.size);
|
|
1270
1373
|
if (s === 0n)
|
|
1271
1374
|
return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1272
|
-
let
|
|
1273
|
-
for (;
|
|
1274
|
-
const
|
|
1275
|
-
if (
|
|
1276
|
-
if (
|
|
1277
|
-
if (
|
|
1375
|
+
let l = 0n, c = s - 1n, d, f, p, m = this.total;
|
|
1376
|
+
for (; l <= c; ) {
|
|
1377
|
+
const x = l + c >> 1n, A = Number(x), U = this.prefixSum(A, e);
|
|
1378
|
+
if (p = U, m = U.total, r ? U.cumulative >= t : U.cumulative <= t)
|
|
1379
|
+
if (d = x, f = U, r) {
|
|
1380
|
+
if (x === 0n)
|
|
1278
1381
|
break;
|
|
1279
|
-
|
|
1382
|
+
c = x - 1n;
|
|
1280
1383
|
} else
|
|
1281
|
-
|
|
1282
|
-
else if (
|
|
1283
|
-
|
|
1384
|
+
l = x + 1n;
|
|
1385
|
+
else if (r)
|
|
1386
|
+
l = x + 1n;
|
|
1284
1387
|
else {
|
|
1285
|
-
if (
|
|
1388
|
+
if (x === 0n)
|
|
1286
1389
|
break;
|
|
1287
|
-
|
|
1390
|
+
c = x - 1n;
|
|
1288
1391
|
}
|
|
1289
1392
|
}
|
|
1290
|
-
const
|
|
1393
|
+
const g = f ?? p;
|
|
1291
1394
|
return {
|
|
1292
|
-
index:
|
|
1293
|
-
total:
|
|
1294
|
-
cumulative:
|
|
1295
|
-
currentValue:
|
|
1296
|
-
safeIndex:
|
|
1395
|
+
index: d !== void 0 ? Number(d) : -1,
|
|
1396
|
+
total: m,
|
|
1397
|
+
cumulative: g?.cumulative,
|
|
1398
|
+
currentValue: g?.currentValue,
|
|
1399
|
+
safeIndex: g?.safeIndex
|
|
1297
1400
|
};
|
|
1298
1401
|
}
|
|
1299
1402
|
/**
|
|
@@ -1307,19 +1410,19 @@ class ar {
|
|
|
1307
1410
|
prefixSum(t, e) {
|
|
1308
1411
|
if (t < 0)
|
|
1309
1412
|
return { cumulative: 0, total: this.total, currentValue: 0, safeIndex: 0 };
|
|
1310
|
-
const
|
|
1311
|
-
this._materializeRanges(s,
|
|
1312
|
-
let
|
|
1313
|
-
for (;
|
|
1314
|
-
const
|
|
1315
|
-
|
|
1316
|
-
const
|
|
1317
|
-
if (
|
|
1413
|
+
const r = pt(t, 0, this.size - 1), s = e?.materializeOption;
|
|
1414
|
+
this._materializeRanges(s, r, !0);
|
|
1415
|
+
let l = 0, c = r + 1;
|
|
1416
|
+
for (; c > 0; ) {
|
|
1417
|
+
const f = this.tree.get(c) ?? 0;
|
|
1418
|
+
l += f;
|
|
1419
|
+
const p = xe(c);
|
|
1420
|
+
if (p === 0)
|
|
1318
1421
|
break;
|
|
1319
|
-
|
|
1422
|
+
c -= p;
|
|
1320
1423
|
}
|
|
1321
|
-
const
|
|
1322
|
-
return { cumulative:
|
|
1424
|
+
const d = s?.materialize ? this.get(r) : (this.deltas.get(r) || 0) + this.baseValue;
|
|
1425
|
+
return { cumulative: l + this.baseValue * (r + 1), total: this.total, currentValue: d, safeIndex: r };
|
|
1323
1426
|
}
|
|
1324
1427
|
/**
|
|
1325
1428
|
* @method get
|
|
@@ -1332,8 +1435,8 @@ class ar {
|
|
|
1332
1435
|
get(t, e) {
|
|
1333
1436
|
if (t < 0 || t >= this.size)
|
|
1334
1437
|
throw new Error("Index out of bounds");
|
|
1335
|
-
const
|
|
1336
|
-
return this._materializeRanges(
|
|
1438
|
+
const r = e?.materializeOption;
|
|
1439
|
+
return this._materializeRanges(r, t), (this.deltas.get(t) ?? 0) + this.baseValue;
|
|
1337
1440
|
}
|
|
1338
1441
|
/**
|
|
1339
1442
|
* @method getTotal
|
|
@@ -1349,8 +1452,8 @@ class ar {
|
|
|
1349
1452
|
this.total = 0;
|
|
1350
1453
|
else {
|
|
1351
1454
|
this.total = this._computeTreeTotal();
|
|
1352
|
-
const
|
|
1353
|
-
|
|
1455
|
+
const r = this.prefixSum(this.getSize() - 1);
|
|
1456
|
+
r.cumulative !== r.total && _.error("Inconsistent Fenwick Tree state");
|
|
1354
1457
|
}
|
|
1355
1458
|
return this.total;
|
|
1356
1459
|
}
|
|
@@ -1363,21 +1466,21 @@ class ar {
|
|
|
1363
1466
|
*/
|
|
1364
1467
|
rebuildTree(t) {
|
|
1365
1468
|
if (t?.materialize && this.valueFn) {
|
|
1366
|
-
const
|
|
1367
|
-
this.reset(this.size, (s) =>
|
|
1469
|
+
const r = this.valueFn;
|
|
1470
|
+
this.reset(this.size, (s) => r(s), { materialize: !0 });
|
|
1368
1471
|
return;
|
|
1369
1472
|
}
|
|
1370
1473
|
const e = /* @__PURE__ */ new Map();
|
|
1371
|
-
for (const [
|
|
1474
|
+
for (const [r, s] of this.deltas.entries()) {
|
|
1372
1475
|
if (s === 0)
|
|
1373
1476
|
continue;
|
|
1374
|
-
let
|
|
1375
|
-
for (;
|
|
1376
|
-
e.set(
|
|
1377
|
-
const
|
|
1378
|
-
if (
|
|
1477
|
+
let l = r + 1;
|
|
1478
|
+
for (; l <= this.size; ) {
|
|
1479
|
+
e.set(l, (e.get(l) ?? 0) + s);
|
|
1480
|
+
const c = xe(l);
|
|
1481
|
+
if (c === 0)
|
|
1379
1482
|
break;
|
|
1380
|
-
|
|
1483
|
+
l += c;
|
|
1381
1484
|
}
|
|
1382
1485
|
}
|
|
1383
1486
|
this.tree = e, this.total = this._computeTreeTotal();
|
|
@@ -1410,8 +1513,8 @@ class ar {
|
|
|
1410
1513
|
for (const s of this.deltas.keys())
|
|
1411
1514
|
s >= t && this.deltas.delete(s);
|
|
1412
1515
|
this.size = t, this.rebuildTree();
|
|
1413
|
-
const
|
|
1414
|
-
|
|
1516
|
+
const r = this.prefixSum(this.getSize() - 1);
|
|
1517
|
+
r.cumulative !== r.total && _.error("Inconsistent Fenwick Tree state");
|
|
1415
1518
|
}
|
|
1416
1519
|
/**
|
|
1417
1520
|
* @method getSize
|
|
@@ -1451,11 +1554,17 @@ class ar {
|
|
|
1451
1554
|
return this._findIndex(t, e ?? {}, !1);
|
|
1452
1555
|
}
|
|
1453
1556
|
}
|
|
1454
|
-
const
|
|
1455
|
-
const
|
|
1456
|
-
|
|
1557
|
+
const ur = (n, t, e) => {
|
|
1558
|
+
const r = Math.max(0, n), s = S(null), l = S({ size: r, valueOrFn: t, options: e });
|
|
1559
|
+
s.current === null && (s.current = new cr(r, t, e));
|
|
1560
|
+
const c = s.current, d = l.current, f = d.size !== r, p = d.valueOrFn !== t, m = d.options !== e;
|
|
1561
|
+
if (p || m) {
|
|
1562
|
+
const g = e?.resetOnValueFnChange ?? !0;
|
|
1563
|
+
m || p && g ? (e?.debug && _.debug("[useFenwickMapTree] reset", { valueOrFnChanged: p, optionsChanged: m }), c.reset(r, t, e)) : (f && (e?.debug && _.debug("[useFenwickMapTree] resize (with valueFn change)", { from: d.size, to: r }), c.changeSize(r)), e?.debug && _.debug("[useFenwickMapTree] setValueFn (no reset)", { valueOrFnChanged: p }), c.setValueFn(t, { reset: !1 })), l.current = { size: r, valueOrFn: t, options: e };
|
|
1564
|
+
} else f && (e?.debug && _.debug("[useFenwickMapTree] resize", { from: d.size, to: r }), d.size === 0 && r > 0 ? c.reset(r, t, e) : c.changeSize(r), l.current = { size: r, valueOrFn: t, options: e });
|
|
1565
|
+
return c;
|
|
1457
1566
|
};
|
|
1458
|
-
class
|
|
1567
|
+
class dr {
|
|
1459
1568
|
key;
|
|
1460
1569
|
value;
|
|
1461
1570
|
prev = null;
|
|
@@ -1464,7 +1573,7 @@ class cr {
|
|
|
1464
1573
|
this.key = t, this.value = e;
|
|
1465
1574
|
}
|
|
1466
1575
|
}
|
|
1467
|
-
class
|
|
1576
|
+
class Ae {
|
|
1468
1577
|
head = null;
|
|
1469
1578
|
tail = null;
|
|
1470
1579
|
/**
|
|
@@ -1505,610 +1614,687 @@ class Me {
|
|
|
1505
1614
|
this.remove(t), this.addToTail(t);
|
|
1506
1615
|
}
|
|
1507
1616
|
}
|
|
1508
|
-
function
|
|
1509
|
-
const t = S(/* @__PURE__ */ new Map()), e = S(new
|
|
1510
|
-
|
|
1511
|
-
for (; t.current.size >
|
|
1512
|
-
const
|
|
1513
|
-
if (
|
|
1514
|
-
t.current.delete(
|
|
1617
|
+
function fr(n) {
|
|
1618
|
+
const t = S(/* @__PURE__ */ new Map()), e = S(new Ae());
|
|
1619
|
+
B(() => {
|
|
1620
|
+
for (; t.current.size > n; ) {
|
|
1621
|
+
const m = e.current.removeHead();
|
|
1622
|
+
if (m)
|
|
1623
|
+
t.current.delete(m.key);
|
|
1515
1624
|
else
|
|
1516
1625
|
break;
|
|
1517
1626
|
}
|
|
1518
|
-
}, [
|
|
1519
|
-
const
|
|
1520
|
-
const
|
|
1521
|
-
if (
|
|
1522
|
-
return e.current.moveToTail(
|
|
1627
|
+
}, [n]);
|
|
1628
|
+
const r = T((m) => {
|
|
1629
|
+
const g = t.current.get(m);
|
|
1630
|
+
if (g)
|
|
1631
|
+
return e.current.moveToTail(g), g.value;
|
|
1523
1632
|
}, []), s = T(
|
|
1524
|
-
(
|
|
1525
|
-
if (
|
|
1633
|
+
(m, g) => {
|
|
1634
|
+
if (n <= 0)
|
|
1526
1635
|
return;
|
|
1527
|
-
let
|
|
1528
|
-
if (
|
|
1529
|
-
|
|
1636
|
+
let E = t.current.get(m);
|
|
1637
|
+
if (E)
|
|
1638
|
+
E.value = g, e.current.moveToTail(E);
|
|
1530
1639
|
else {
|
|
1531
|
-
if (t.current.size >=
|
|
1532
|
-
const
|
|
1533
|
-
|
|
1640
|
+
if (t.current.size >= n) {
|
|
1641
|
+
const x = e.current.removeHead();
|
|
1642
|
+
x && t.current.delete(x.key);
|
|
1534
1643
|
}
|
|
1535
|
-
|
|
1644
|
+
E = new dr(m, g), t.current.set(m, E), e.current.addToTail(E);
|
|
1536
1645
|
}
|
|
1537
1646
|
},
|
|
1538
|
-
[
|
|
1539
|
-
),
|
|
1540
|
-
const
|
|
1541
|
-
|
|
1542
|
-
}, []),
|
|
1543
|
-
t.current.clear(), e.current = new
|
|
1544
|
-
}, []), [
|
|
1545
|
-
return
|
|
1647
|
+
[n]
|
|
1648
|
+
), l = T((m) => t.current.has(m), []), c = T((m) => {
|
|
1649
|
+
const g = t.current.get(m);
|
|
1650
|
+
g && (e.current.remove(g), t.current.delete(m));
|
|
1651
|
+
}, []), d = T(() => {
|
|
1652
|
+
t.current.clear(), e.current = new Ae();
|
|
1653
|
+
}, []), [f, p] = Ht(() => ({ get: r, set: s, has: l, remove: c, clear: d }));
|
|
1654
|
+
return B(() => p({ get: r, set: s, has: l, remove: c, clear: d }), [r, s, l, c, d]), f;
|
|
1546
1655
|
}
|
|
1547
|
-
const
|
|
1548
|
-
const { get:
|
|
1549
|
-
return { get:
|
|
1550
|
-
},
|
|
1551
|
-
top: Math.max(0,
|
|
1552
|
-
bottom: Math.max(0,
|
|
1553
|
-
}),
|
|
1554
|
-
if (!Number.isFinite(
|
|
1555
|
-
|
|
1556
|
-
const t = Math.trunc(o);
|
|
1656
|
+
const mr = 1e4, Pr = () => {
|
|
1657
|
+
const { get: n, set: t, has: e, clear: r } = fr(mr);
|
|
1658
|
+
return { get: n, set: t, has: e, clear: r };
|
|
1659
|
+
}, nt = (n, t) => t <= 0 ? 0 : pt(n, 0, t - 1), De = (n) => ({
|
|
1660
|
+
top: Math.max(0, n?.top ?? 0),
|
|
1661
|
+
bottom: Math.max(0, n?.bottom ?? 0)
|
|
1662
|
+
}), Gt = (n, t) => n <= t ? 0 : n - t, oe = (n, t) => n <= 0 ? t : n + t, Pe = (n) => {
|
|
1663
|
+
if (!Number.isFinite(n)) return 0n;
|
|
1664
|
+
const t = Math.trunc(n);
|
|
1557
1665
|
return t <= 0 ? 0n : BigInt(t);
|
|
1558
|
-
},
|
|
1559
|
-
const
|
|
1560
|
-
if (
|
|
1666
|
+
}, pr = (n, t, e, r, s, l, c, d) => {
|
|
1667
|
+
const f = Pe(r);
|
|
1668
|
+
if (f === 0n)
|
|
1561
1669
|
return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
|
|
1562
|
-
const
|
|
1563
|
-
let
|
|
1564
|
-
|
|
1565
|
-
const A = (
|
|
1566
|
-
let
|
|
1567
|
-
for (;
|
|
1568
|
-
const
|
|
1569
|
-
if (
|
|
1670
|
+
const p = (Y) => Y < 0n ? 0n : Y >= f ? f - 1n : Y, m = { materializeOption: { materialize: !1 } }, { index: g, cumulative: E } = l.findIndexAtOrAfter(n, m);
|
|
1671
|
+
let x;
|
|
1672
|
+
g === -1 ? x = f - 1n : (E === n ? x = Pe(g + 1) : x = Pe(g), x >= f && (x = f - 1n)), n <= 0 && (x = 0n), d && n >= c && (x = f - 1n);
|
|
1673
|
+
const A = (Y) => {
|
|
1674
|
+
let tt = 0, C = Y, K = Y, G = 0n;
|
|
1675
|
+
for (; C < f && tt < t; ) {
|
|
1676
|
+
const It = Number(C), L = s(It);
|
|
1677
|
+
if (tt += L, K = C, C += 1n, G += 1n, !Number.isFinite(L) || L <= 0)
|
|
1570
1678
|
break;
|
|
1571
1679
|
}
|
|
1572
|
-
return
|
|
1680
|
+
return G === 0n && (K = Y), { height: tt, end: K };
|
|
1573
1681
|
};
|
|
1574
|
-
let { height: U, end:
|
|
1575
|
-
if (U < t &&
|
|
1576
|
-
let
|
|
1577
|
-
for (;
|
|
1578
|
-
|
|
1579
|
-
const
|
|
1580
|
-
if (
|
|
1682
|
+
let { height: U, end: q } = A(x);
|
|
1683
|
+
if (U < t && x > 0n) {
|
|
1684
|
+
let Y = x, tt = U;
|
|
1685
|
+
for (; Y > 0n && tt < t; ) {
|
|
1686
|
+
Y -= 1n;
|
|
1687
|
+
const K = Number(Y), G = s(K);
|
|
1688
|
+
if (tt += G, !Number.isFinite(G) || G <= 0)
|
|
1581
1689
|
break;
|
|
1582
1690
|
}
|
|
1583
|
-
|
|
1584
|
-
const
|
|
1585
|
-
U =
|
|
1691
|
+
x = p(Y);
|
|
1692
|
+
const C = A(x);
|
|
1693
|
+
U = C.height, q = C.end;
|
|
1586
1694
|
}
|
|
1587
|
-
const
|
|
1695
|
+
const Q = p(x), bt = p(q), lt = p(Q - BigInt(Math.max(0, e))), it = p(bt + BigInt(Math.max(0, e)));
|
|
1588
1696
|
return {
|
|
1589
|
-
renderingStartIndex:
|
|
1590
|
-
renderingEndIndex:
|
|
1591
|
-
visibleStartIndex:
|
|
1592
|
-
visibleEndIndex:
|
|
1697
|
+
renderingStartIndex: nt(Number(lt), r),
|
|
1698
|
+
renderingEndIndex: nt(Number(it), r),
|
|
1699
|
+
visibleStartIndex: nt(Number(Q), r),
|
|
1700
|
+
visibleEndIndex: nt(Number(bt), r)
|
|
1593
1701
|
};
|
|
1594
|
-
},
|
|
1595
|
-
if (
|
|
1702
|
+
}, hr = (n, t, e, r, s, l, c) => {
|
|
1703
|
+
if (r === 0)
|
|
1596
1704
|
return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
|
|
1597
|
-
const
|
|
1598
|
-
if (
|
|
1599
|
-
return
|
|
1600
|
-
const { index:
|
|
1601
|
-
let
|
|
1602
|
-
if (
|
|
1603
|
-
|
|
1604
|
-
else if (
|
|
1605
|
-
A =
|
|
1705
|
+
const d = Number.isFinite(c), f = d ? Math.min(Math.max(0, n), c) : Math.max(0, n);
|
|
1706
|
+
if (r >= Number.MAX_SAFE_INTEGER)
|
|
1707
|
+
return pr(f, t, e, r, s, l, c, d);
|
|
1708
|
+
const { index: p, cumulative: m, currentValue: g } = l.findIndexAtOrAfter(f, { materializeOption: { materialize: !1 } }), E = p === -1 ? t <= 0 || (m ?? 0) < f + (g ?? 0) ? r - 1 : 0 : p;
|
|
1709
|
+
let x = nt(E, r), A = 0;
|
|
1710
|
+
if (p !== -1 && m === f)
|
|
1711
|
+
x = nt(p + 1, r), A = 0;
|
|
1712
|
+
else if (x === p && m !== void 0 && g !== void 0)
|
|
1713
|
+
A = m - g - f;
|
|
1606
1714
|
else {
|
|
1607
|
-
const { cumulative:
|
|
1608
|
-
A = (
|
|
1715
|
+
const { cumulative: it, currentValue: Y } = l.prefixSum(x, { materializeOption: { materialize: !1 } });
|
|
1716
|
+
A = (it ?? 0) - (Y ?? 0) - f;
|
|
1609
1717
|
}
|
|
1610
1718
|
const U = A;
|
|
1611
|
-
let
|
|
1612
|
-
for (;
|
|
1613
|
-
A += s(
|
|
1614
|
-
if (A < t &&
|
|
1615
|
-
let
|
|
1616
|
-
for (;
|
|
1617
|
-
|
|
1618
|
-
for (
|
|
1619
|
-
A += s(
|
|
1719
|
+
let q = x;
|
|
1720
|
+
for (; q < r && A < t; )
|
|
1721
|
+
A += s(q), q++;
|
|
1722
|
+
if (A < t && x > 0) {
|
|
1723
|
+
let it = A + Math.abs(Math.min(0, U)), Y = x - 1;
|
|
1724
|
+
for (; Y >= 0 && it < t; )
|
|
1725
|
+
it += s(Y), Y--;
|
|
1726
|
+
for (x = nt(Y + 1, r), A = 0, q = x; q < r && A < t; )
|
|
1727
|
+
A += s(q), q++;
|
|
1620
1728
|
}
|
|
1621
|
-
const
|
|
1622
|
-
return { renderingStartIndex:
|
|
1623
|
-
},
|
|
1624
|
-
const
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
loopActive: !1,
|
|
1629
|
-
normalizedThrottle: n
|
|
1630
|
-
}), c = T(() => {
|
|
1631
|
-
const l = s.current;
|
|
1632
|
-
l.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(l.rafId), l.rafId = null, l.loopActive = !1;
|
|
1633
|
-
}, []), u = T(
|
|
1634
|
-
(l) => {
|
|
1635
|
-
const d = s.current;
|
|
1636
|
-
d.rafId = null;
|
|
1637
|
-
const f = typeof l == "number" ? l : hr(), m = d.normalizedThrottle, R = d.pendingPayload, b = o.current;
|
|
1638
|
-
if (R !== null && b) {
|
|
1639
|
-
const A = f - d.lastInvokeAt;
|
|
1640
|
-
(m === 0 || d.lastInvokeAt === 0 || A >= m) && (d.pendingPayload = null, d.lastInvokeAt = f, e(b, R));
|
|
1641
|
-
}
|
|
1642
|
-
if (d.pendingPayload !== null) {
|
|
1643
|
-
typeof requestAnimationFrame == "function" ? d.rafId = requestAnimationFrame(u) : d.loopActive = !1;
|
|
1644
|
-
return;
|
|
1645
|
-
}
|
|
1646
|
-
d.loopActive = !1;
|
|
1729
|
+
const Q = nt(x - e, r), bt = nt(Math.max(q - 1, x), r), lt = nt(bt + e, r);
|
|
1730
|
+
return { renderingStartIndex: Q, renderingEndIndex: lt, visibleStartIndex: x, visibleEndIndex: bt };
|
|
1731
|
+
}, Ne = (n, t, e) => {
|
|
1732
|
+
const r = Math.max(0, t ?? 0), s = S({ last: 0, id: null, arg: null }).current;
|
|
1733
|
+
return B(
|
|
1734
|
+
() => () => {
|
|
1735
|
+
s.id !== null && (cancelAnimationFrame(s.id), s.id = null);
|
|
1647
1736
|
},
|
|
1648
|
-
[
|
|
1649
|
-
),
|
|
1650
|
-
const l = s.current;
|
|
1651
|
-
if (!l.loopActive) {
|
|
1652
|
-
if (l.loopActive = !0, typeof requestAnimationFrame == "function") {
|
|
1653
|
-
l.rafId = requestAnimationFrame(u);
|
|
1654
|
-
return;
|
|
1655
|
-
}
|
|
1656
|
-
l.loopActive = !1;
|
|
1657
|
-
}
|
|
1658
|
-
}, [u]);
|
|
1659
|
-
return X(() => () => {
|
|
1660
|
-
c(), s.current.pendingPayload = null;
|
|
1661
|
-
}, [c]), X(() => {
|
|
1662
|
-
c();
|
|
1663
|
-
const l = s.current;
|
|
1664
|
-
l.lastInvokeAt = 0, l.pendingPayload = null, l.normalizedThrottle = n;
|
|
1665
|
-
}, [n, c]), T(
|
|
1737
|
+
[s]
|
|
1738
|
+
), T(
|
|
1666
1739
|
(l) => {
|
|
1667
|
-
|
|
1668
|
-
|
|
1740
|
+
if (s.arg = l, s.id !== null) return;
|
|
1741
|
+
const c = (d) => {
|
|
1742
|
+
if (s.id = null, s.arg === null) return;
|
|
1743
|
+
const f = d - s.last;
|
|
1744
|
+
if (r === 0 || s.last === 0 || f >= r) {
|
|
1745
|
+
if (n.current)
|
|
1746
|
+
try {
|
|
1747
|
+
e(n.current, s.arg);
|
|
1748
|
+
} catch (p) {
|
|
1749
|
+
console.error("[useThrottledInvoker] Error invoking callback", p);
|
|
1750
|
+
}
|
|
1751
|
+
s.arg = null, s.last = d;
|
|
1752
|
+
}
|
|
1753
|
+
s.arg !== null && (s.id = requestAnimationFrame(c));
|
|
1754
|
+
};
|
|
1755
|
+
s.id = requestAnimationFrame(c);
|
|
1669
1756
|
},
|
|
1670
|
-
[
|
|
1757
|
+
[r, e, n, s]
|
|
1671
1758
|
);
|
|
1672
|
-
}, gr =
|
|
1673
|
-
const
|
|
1759
|
+
}, gr = He.memo(({ index: n, top: t, height: e, item: r, children: s, clipItemHeight: l, enableKeyboardNavigation: c, onKeyDown: d, onFocus: f, registerItemRef: p }) => {
|
|
1760
|
+
const m = T((A) => p(n, A), [n, p]), g = T((A) => d(A, n), [n, d]), E = T(() => f(n), [n, f]), x = T((A) => {
|
|
1674
1761
|
A.currentTarget.focus({ preventScroll: !0 });
|
|
1675
1762
|
}, []);
|
|
1676
|
-
return /* @__PURE__ */
|
|
1763
|
+
return /* @__PURE__ */ $(
|
|
1677
1764
|
"div",
|
|
1678
1765
|
{
|
|
1679
|
-
ref:
|
|
1680
|
-
"data-index":
|
|
1766
|
+
ref: m,
|
|
1767
|
+
"data-index": n,
|
|
1681
1768
|
"data-virtualscroll-item": "true",
|
|
1682
|
-
className: "aqvs
|
|
1769
|
+
className: "aqvs-item-container",
|
|
1683
1770
|
style: {
|
|
1684
1771
|
top: t,
|
|
1685
1772
|
height: e,
|
|
1686
|
-
overflow:
|
|
1773
|
+
overflow: l ? "hidden" : void 0
|
|
1687
1774
|
},
|
|
1688
|
-
tabIndex:
|
|
1689
|
-
onPointerDown:
|
|
1690
|
-
onKeyDownCapture:
|
|
1691
|
-
onFocusCapture:
|
|
1692
|
-
children: s(
|
|
1775
|
+
tabIndex: c ? -1 : void 0,
|
|
1776
|
+
onPointerDown: c ? x : void 0,
|
|
1777
|
+
onKeyDownCapture: c ? g : void 0,
|
|
1778
|
+
onFocusCapture: c ? E : void 0,
|
|
1779
|
+
children: s(r, n)
|
|
1693
1780
|
}
|
|
1694
1781
|
);
|
|
1695
|
-
}),
|
|
1696
|
-
itemCount:
|
|
1782
|
+
}), xr = ({
|
|
1783
|
+
itemCount: n,
|
|
1697
1784
|
getItem: t,
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1785
|
+
getItemKey: e,
|
|
1786
|
+
getItemHeight: r,
|
|
1787
|
+
viewportSize: s,
|
|
1788
|
+
overscanCount: l = 15,
|
|
1701
1789
|
className: c,
|
|
1702
|
-
onScroll:
|
|
1703
|
-
onRangeChange:
|
|
1704
|
-
children:
|
|
1705
|
-
background:
|
|
1706
|
-
initialScrollIndex:
|
|
1707
|
-
initialScrollOffset:
|
|
1708
|
-
callbackThrottleMs:
|
|
1709
|
-
contentInsets:
|
|
1710
|
-
onItemFocus:
|
|
1711
|
-
scrollBarOptions:
|
|
1712
|
-
behaviorOptions:
|
|
1713
|
-
},
|
|
1714
|
-
const { width:
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
}),
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
}, [
|
|
1725
|
-
const
|
|
1790
|
+
onScroll: d,
|
|
1791
|
+
onRangeChange: f,
|
|
1792
|
+
children: p,
|
|
1793
|
+
background: m,
|
|
1794
|
+
initialScrollIndex: g,
|
|
1795
|
+
initialScrollOffset: E,
|
|
1796
|
+
callbackThrottleMs: x = 5,
|
|
1797
|
+
contentInsets: A,
|
|
1798
|
+
onItemFocus: U,
|
|
1799
|
+
scrollBarOptions: q,
|
|
1800
|
+
behaviorOptions: Q
|
|
1801
|
+
}, bt) => {
|
|
1802
|
+
const { width: lt, enableThumbDrag: it, enableTrackClick: Y, enableArrowButtons: tt, enableScrollToTopBottomButtons: C, renderThumbOverlay: K, tapScrollCircleOptions: G } = q ?? {}, { enablePointerDrag: It, enableKeyboardNavigation: L = !0, wheelSpeedMultiplier: D, inertiaOptions: Z, clipItemHeight: J = !1, resetOnGetItemHeightChange: W = !1 } = Q ?? {}, F = S(null), Tt = S({
|
|
1803
|
+
renderingStartIndex: 0,
|
|
1804
|
+
renderingEndIndex: 0,
|
|
1805
|
+
visibleStartIndex: 0,
|
|
1806
|
+
visibleEndIndex: 0,
|
|
1807
|
+
scrollPosition: 0,
|
|
1808
|
+
totalHeight: 0
|
|
1809
|
+
}), ct = S(null), vt = S(!1);
|
|
1810
|
+
B(() => {
|
|
1811
|
+
W && (ct.current = null);
|
|
1812
|
+
}, [W]);
|
|
1813
|
+
const v = Vt(() => De(A), [A]), Mt = Vt(
|
|
1814
|
+
// 目的: Fenwick Tree のオプション設定
|
|
1815
|
+
// 依存関係: resetOnGetItemHeightChange
|
|
1816
|
+
() => ({
|
|
1817
|
+
sampleRange: { from: 0, to: 100 },
|
|
1818
|
+
resetOnValueFnChange: W,
|
|
1819
|
+
materialize: !0
|
|
1820
|
+
}),
|
|
1821
|
+
[W]
|
|
1822
|
+
), b = ur(n, r, Mt), [Pt] = Ht(() => {
|
|
1823
|
+
let i = v.top, a = 0;
|
|
1824
|
+
if (typeof g == "number") {
|
|
1825
|
+
const u = pt(g, 0, n - 1), y = pt(u - l * 2, 0, n - 1), w = pt(u + l * 2, 0, n - 1), V = g > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: y, to: w }] } } : void 0, { cumulative: z, total: X, currentValue: O } = b.prefixSum(g, V), H = Math.max(z - O, 0);
|
|
1826
|
+
i = oe(H, v.top), a = X ?? b.getTotal();
|
|
1827
|
+
} else typeof E == "number" && (i = oe(Math.max(E, 0), v.top)), a = b.getTotal();
|
|
1828
|
+
return { position: i, total: a };
|
|
1829
|
+
}), [yt, Lt] = Ht(Pt.position), [I, N] = Ht(Pt.total), k = S(Pt.position), et = S(v.top), ut = S(d ?? void 0), Dt = S(f ?? void 0), mt = S(/* @__PURE__ */ new Map()), st = S(null), ot = S(null), [Ct, Et] = Ht(null), [wt, At] = Ht(!1), Bt = S(null), ht = S(!1), h = S(0), M = S(!1), j = S(n);
|
|
1830
|
+
j.current !== n && (j.current = n, M.current = !0), B(() => {
|
|
1831
|
+
ut.current = d ?? void 0, Dt.current = f ?? void 0;
|
|
1832
|
+
}, [f, d]);
|
|
1833
|
+
const at = T(
|
|
1726
1834
|
(i) => {
|
|
1727
|
-
if (
|
|
1835
|
+
if (L && i && typeof i.focus == "function")
|
|
1728
1836
|
try {
|
|
1729
1837
|
i.focus({ preventScroll: !0 });
|
|
1730
1838
|
} catch {
|
|
1731
1839
|
i.focus();
|
|
1732
1840
|
}
|
|
1733
1841
|
},
|
|
1734
|
-
[
|
|
1735
|
-
),
|
|
1736
|
-
i(
|
|
1737
|
-
}),
|
|
1738
|
-
i(
|
|
1739
|
-
});
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
}), []),
|
|
1743
|
-
|
|
1744
|
-
}, [
|
|
1745
|
-
const
|
|
1746
|
-
(i,
|
|
1747
|
-
if (!
|
|
1748
|
-
|
|
1842
|
+
[L]
|
|
1843
|
+
), dt = T((i, { position: a, totalHeight: u }) => {
|
|
1844
|
+
i(a, u);
|
|
1845
|
+
}, []), Ot = Ne(ut, x, dt), ft = T((i, a) => {
|
|
1846
|
+
i(a);
|
|
1847
|
+
}, []), Yt = Ne(Dt, x, ft);
|
|
1848
|
+
B(() => (vt.current = !0, () => {
|
|
1849
|
+
vt.current = !1;
|
|
1850
|
+
}), []), B(() => {
|
|
1851
|
+
L || (mt.current.clear(), st.current = null, ot.current = null);
|
|
1852
|
+
}, [L]);
|
|
1853
|
+
const Zt = T(
|
|
1854
|
+
(i, a) => {
|
|
1855
|
+
if (!a) {
|
|
1856
|
+
mt.current.delete(i);
|
|
1749
1857
|
return;
|
|
1750
1858
|
}
|
|
1751
|
-
|
|
1859
|
+
L && (mt.current.set(i, a), st.current === i && (st.current = null, ot.current = i, at(a)));
|
|
1752
1860
|
},
|
|
1753
|
-
[
|
|
1754
|
-
),
|
|
1861
|
+
[L, at]
|
|
1862
|
+
), Nt = 0.01, Xt = S({
|
|
1755
1863
|
rafId: null,
|
|
1756
1864
|
loopActive: !1,
|
|
1757
1865
|
idleFrames: 0,
|
|
1758
|
-
lastRenderedPosition:
|
|
1759
|
-
}),
|
|
1760
|
-
const i =
|
|
1866
|
+
lastRenderedPosition: Pt.position
|
|
1867
|
+
}), St = T(() => {
|
|
1868
|
+
const i = Xt.current;
|
|
1761
1869
|
i.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(i.rafId), i.rafId = null, i.loopActive = !1, i.idleFrames = 0;
|
|
1762
1870
|
}, []);
|
|
1763
|
-
|
|
1871
|
+
B(
|
|
1764
1872
|
() => () => {
|
|
1765
|
-
|
|
1873
|
+
St();
|
|
1766
1874
|
},
|
|
1767
|
-
[
|
|
1875
|
+
[St]
|
|
1768
1876
|
);
|
|
1769
|
-
const
|
|
1770
|
-
const i =
|
|
1877
|
+
const Rt = T(() => {
|
|
1878
|
+
const i = Xt.current;
|
|
1771
1879
|
i.rafId = null;
|
|
1772
|
-
const
|
|
1773
|
-
if (
|
|
1774
|
-
|
|
1880
|
+
const a = k.current, u = Gt(a, v.top), y = b.getTotal();
|
|
1881
|
+
if (Lt((V) => Math.abs(V - a) < Nt ? V : a), Ot({ position: u, totalHeight: y }), Math.abs(i.lastRenderedPosition - a) >= Nt ? (i.lastRenderedPosition = a, i.idleFrames = 0) : i.idleFrames += 1, i.idleFrames >= 2) {
|
|
1882
|
+
St();
|
|
1775
1883
|
return;
|
|
1776
1884
|
}
|
|
1777
1885
|
if (typeof requestAnimationFrame == "function") {
|
|
1778
|
-
i.rafId = requestAnimationFrame(
|
|
1886
|
+
i.rafId = requestAnimationFrame(Rt);
|
|
1779
1887
|
return;
|
|
1780
1888
|
}
|
|
1781
1889
|
i.loopActive = !1;
|
|
1782
|
-
}, [
|
|
1783
|
-
const i =
|
|
1890
|
+
}, [b, v.top, Ot, St]), Qt = T(() => {
|
|
1891
|
+
const i = Xt.current;
|
|
1784
1892
|
if (i.idleFrames = 0, !i.loopActive) {
|
|
1785
1893
|
if (i.loopActive = !0, typeof requestAnimationFrame == "function") {
|
|
1786
|
-
i.rafId = requestAnimationFrame(
|
|
1894
|
+
i.rafId = requestAnimationFrame(Rt);
|
|
1787
1895
|
return;
|
|
1788
1896
|
}
|
|
1789
1897
|
i.loopActive = !1;
|
|
1790
1898
|
}
|
|
1791
|
-
}, [
|
|
1792
|
-
(i,
|
|
1793
|
-
const
|
|
1794
|
-
if (
|
|
1795
|
-
|
|
1899
|
+
}, [Rt]), rt = T(
|
|
1900
|
+
(i, a) => {
|
|
1901
|
+
const u = a?.immediate ?? !1, y = Gt(i, v.top);
|
|
1902
|
+
if (k.current = i, u) {
|
|
1903
|
+
Xt.current.lastRenderedPosition = i, Xt.current.idleFrames = 0, Lt(i), Ot({ position: y, totalHeight: b.getTotal() });
|
|
1796
1904
|
return;
|
|
1797
1905
|
}
|
|
1798
|
-
|
|
1906
|
+
Qt();
|
|
1799
1907
|
},
|
|
1800
|
-
[
|
|
1801
|
-
),
|
|
1802
|
-
|
|
1803
|
-
if (!
|
|
1804
|
-
if (
|
|
1805
|
-
const i =
|
|
1806
|
-
|
|
1908
|
+
[Qt, b, v.top, Ot]
|
|
1909
|
+
), fe = S(!1);
|
|
1910
|
+
B(() => {
|
|
1911
|
+
if (!fe.current)
|
|
1912
|
+
if (fe.current = !0, typeof E == "number") {
|
|
1913
|
+
const i = oe(Math.max(E, 0), v.top), a = Math.abs(i - k.current) > 0.5;
|
|
1914
|
+
rt(i, { immediate: !0 }), a && F.current?.scrollTo(i);
|
|
1807
1915
|
} else
|
|
1808
|
-
|
|
1809
|
-
}, [
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1916
|
+
rt(k.current, { immediate: !0 });
|
|
1917
|
+
}, [E, v.top, rt]), B(() => {
|
|
1918
|
+
const i = b.getTotal();
|
|
1919
|
+
I !== i && N(i);
|
|
1920
|
+
}, [b, I, n]), B(() => {
|
|
1921
|
+
if (ct.current !== null) {
|
|
1922
|
+
const { index: i, align: a, offset: u } = ct.current, y = nt(i, n), { cumulative: w, currentValue: V } = b.prefixSum(y, { materializeOption: { materialize: !1 } });
|
|
1923
|
+
if (w !== void 0 && V !== void 0) {
|
|
1924
|
+
const z = Math.max(w - V, 0);
|
|
1925
|
+
let X = z;
|
|
1926
|
+
a === "bottom" ? X = w - s : a === "center" && (X = z + V / 2 - s / 2), u && (X -= u), X = Math.max(0, X);
|
|
1927
|
+
const O = Math.max(0, I + v.top + v.bottom - s), H = Math.min(oe(X, v.top), O);
|
|
1928
|
+
Math.abs(H - k.current) > 1 && (_.debug("[VirtualScroll] Drift correction", {
|
|
1929
|
+
from: k.current,
|
|
1930
|
+
to: H,
|
|
1931
|
+
targetIndex: y
|
|
1932
|
+
}), h.current === 0 && (h.current += 1), F.current?.scrollTo(H), rt(H, { immediate: !0 }));
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
M.current = !1;
|
|
1936
|
+
}, [I, b, n, v.top, rt, s, v.bottom]), B(() => {
|
|
1937
|
+
const i = et.current;
|
|
1938
|
+
if (i === v.top) return;
|
|
1939
|
+
const a = Gt(k.current, i), u = oe(a, v.top);
|
|
1940
|
+
et.current = v.top, k.current = u, F.current?.scrollTo(u), rt(u, { immediate: !0 });
|
|
1941
|
+
}, [v.top, rt]);
|
|
1942
|
+
const le = T(
|
|
1943
|
+
(i, a) => {
|
|
1944
|
+
const u = nt(i, n), y = b.get(u), w = a - y, V = b.update(u, a);
|
|
1945
|
+
V !== void 0 && N(V), _.debug("[VirtualScroll] Updated item size manually", { index: u, size: a, total: V });
|
|
1946
|
+
let z = ct.current ? ct.current.index : null;
|
|
1947
|
+
if (z === null) {
|
|
1948
|
+
const X = k.current, O = De(A).top, H = Gt(X, O), { index: gt } = b.findIndexAtOrAfter(H, { materializeOption: { materialize: !1 } });
|
|
1949
|
+
z = gt;
|
|
1950
|
+
}
|
|
1951
|
+
if (z !== -1 && u < z && w !== 0) {
|
|
1952
|
+
const X = k.current, O = X + w;
|
|
1953
|
+
h.current += 1, rt(O, { immediate: !0 }), F.current?.scrollTo(O), _.debug("[VirtualScroll] Adjusted scroll for layout shift (manual update)", { from: X, to: O, causedByIndex: u, delta: w, activeVisibleStartIndex: z });
|
|
1954
|
+
}
|
|
1955
|
+
},
|
|
1956
|
+
[b, n, rt, A]
|
|
1957
|
+
), kt = T(
|
|
1958
|
+
(i, a) => {
|
|
1959
|
+
if (!F.current)
|
|
1825
1960
|
return;
|
|
1826
|
-
const
|
|
1827
|
-
if (
|
|
1961
|
+
const u = nt(i, n), y = nt(u - l * 2, n), w = nt(u + l * 2, n), { cumulative: V, total: z, currentValue: X } = b.prefixSum(u, { materializeOption: { materialize: !0, ranges: [{ from: y, to: w }] } });
|
|
1962
|
+
if (_.debug("[VirtualScroll] Scrolling to index:", u, "ItemBottom:", V, "Total height:", z, "ItemHeight:", X, "safeIndexFrom:", y, "safeIndexTo:", w), !z)
|
|
1828
1963
|
return;
|
|
1829
|
-
const
|
|
1830
|
-
let
|
|
1831
|
-
|
|
1832
|
-
const
|
|
1833
|
-
|
|
1964
|
+
const O = Math.max(V - X, 0);
|
|
1965
|
+
let H = O;
|
|
1966
|
+
a?.align === "bottom" ? H = V - s : a?.align === "center" && (H = O + X / 2 - s / 2), a?.offset && (H -= a.offset), H = Math.max(0, H);
|
|
1967
|
+
const gt = oe(H, v.top), xt = F.current?.getContentSize() ?? z + v.top + v.bottom, Ft = Math.max(0, xt - s), Jt = Math.min(gt, Ft);
|
|
1968
|
+
ct.current = {
|
|
1969
|
+
index: u,
|
|
1970
|
+
align: a?.align,
|
|
1971
|
+
offset: a?.offset
|
|
1972
|
+
};
|
|
1973
|
+
const ce = F.current?.getScrollPosition() ?? -1, ue = Math.abs(ce - Jt) > 0.5;
|
|
1974
|
+
ht.current = !1, h.current = 0, ue && (ht.current = !0, h.current += 1, F.current?.scrollTo(Jt)), N(z), rt(Jt, { immediate: !0 }), _.debug("[VirtualScroll] Setting scroll position to:", Jt, { original: gt, max: Ft });
|
|
1834
1975
|
},
|
|
1835
|
-
[
|
|
1836
|
-
),
|
|
1976
|
+
[b, l, n, v.top, v.bottom, s, rt]
|
|
1977
|
+
), ne = T(
|
|
1837
1978
|
(i) => {
|
|
1838
|
-
if (!
|
|
1979
|
+
if (!F.current)
|
|
1839
1980
|
return;
|
|
1840
|
-
const
|
|
1841
|
-
|
|
1981
|
+
const a = b.getTotal(), u = pt(Math.floor(i), 0, a), { index: y, cumulative: w, currentValue: V } = b.findIndexAtOrAfter(u, { materializeOption: { materialize: !1 } }), X = (w ?? 0) - (V ?? 0) - u;
|
|
1982
|
+
kt(y, { offset: X });
|
|
1842
1983
|
},
|
|
1843
|
-
[
|
|
1844
|
-
),
|
|
1984
|
+
[b, kt]
|
|
1985
|
+
), te = T(
|
|
1845
1986
|
(i) => {
|
|
1846
|
-
const
|
|
1847
|
-
|
|
1848
|
-
const
|
|
1849
|
-
return
|
|
1987
|
+
const a = Gt(k.current, v.top), u = typeof i == "function" ? i(a) : i;
|
|
1988
|
+
ne(u);
|
|
1989
|
+
const y = F.current?.getScrollPosition(), w = typeof y == "number" ? y : k.current;
|
|
1990
|
+
return rt(w), w;
|
|
1850
1991
|
},
|
|
1851
|
-
[v.top,
|
|
1852
|
-
),
|
|
1853
|
-
(i,
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1992
|
+
[v.top, ne, rt]
|
|
1993
|
+
), be = T(
|
|
1994
|
+
(i, a) => {
|
|
1995
|
+
_.debug("[VirtualScroll] Scroll position changed:", i);
|
|
1996
|
+
const u = ht.current;
|
|
1997
|
+
u && (ht.current = !1);
|
|
1998
|
+
const y = h.current > 0;
|
|
1999
|
+
if (y && (h.current = 0), u || y || M.current || (ct.current = null), rt(i), C) {
|
|
2000
|
+
if (u || y)
|
|
1857
2001
|
return;
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
Pt(!1), dt.debug("[VirtualScroll] Hiding scroll buttons");
|
|
2002
|
+
const w = i - a;
|
|
2003
|
+
if (_.debug("[VirtualScroll] Scroll diff:", w, "New:", i, "Prev:", a), Math.abs(w) > 1) {
|
|
2004
|
+
const V = w > 0 ? "down" : "up";
|
|
2005
|
+
Et(V), At(!0), _.debug("[VirtualScroll] Showing scroll buttons. Direction:", V), Bt.current && clearTimeout(Bt.current), Bt.current = setTimeout(() => {
|
|
2006
|
+
At(!1), _.debug("[VirtualScroll] Hiding scroll buttons");
|
|
1864
2007
|
}, 2e3);
|
|
1865
2008
|
}
|
|
1866
2009
|
}
|
|
1867
2010
|
},
|
|
1868
|
-
[
|
|
1869
|
-
),
|
|
1870
|
-
const i =
|
|
1871
|
-
return
|
|
1872
|
-
...
|
|
1873
|
-
scrollPosition:
|
|
1874
|
-
renderingContentSize:
|
|
1875
|
-
overscanCount:
|
|
1876
|
-
viewportSize:
|
|
1877
|
-
}),
|
|
1878
|
-
}, [
|
|
1879
|
-
(i,
|
|
1880
|
-
if (!
|
|
2011
|
+
[rt, C]
|
|
2012
|
+
), Ut = Vt(() => Gt(yt, v.top), [v.top, yt]), zt = Vt(() => {
|
|
2013
|
+
const i = b.getTotal(), a = hr(Ut, s, l, n, r, b, i);
|
|
2014
|
+
return _.debug("[VirtualScroll] Calculated rendering range:", {
|
|
2015
|
+
...a,
|
|
2016
|
+
scrollPosition: Ut,
|
|
2017
|
+
renderingContentSize: i,
|
|
2018
|
+
overscanCount: l,
|
|
2019
|
+
viewportSize: s
|
|
2020
|
+
}), a;
|
|
2021
|
+
}, [Ut, s, l, n, r, b]), { renderingStartIndex: $t, renderingEndIndex: Kt, visibleStartIndex: _t, visibleEndIndex: Wt } = zt, jt = T(
|
|
2022
|
+
(i, a) => {
|
|
2023
|
+
if (!L || n === 0)
|
|
1881
2024
|
return;
|
|
1882
|
-
const
|
|
1883
|
-
if (!(
|
|
1884
|
-
const
|
|
1885
|
-
|
|
2025
|
+
const u = nt(i, n);
|
|
2026
|
+
if (!(a?.ensureVisible ?? !0)) {
|
|
2027
|
+
const Ft = mt.current.get(u);
|
|
2028
|
+
Ft && (st.current = null, ot.current = u, at(Ft));
|
|
1886
2029
|
return;
|
|
1887
2030
|
}
|
|
1888
|
-
const
|
|
1889
|
-
if (
|
|
1890
|
-
|
|
2031
|
+
const w = b.prefixSum(u, { materializeOption: { materialize: !1 } }), V = w.currentValue, z = Math.max(w.cumulative - V, 0), X = z + V, O = Gt(k.current, v.top), H = O + s;
|
|
2032
|
+
if (z < O || X > H) {
|
|
2033
|
+
st.current = u, kt(u);
|
|
1891
2034
|
return;
|
|
1892
2035
|
}
|
|
1893
|
-
const
|
|
1894
|
-
if (
|
|
1895
|
-
|
|
2036
|
+
const xt = mt.current.get(u);
|
|
2037
|
+
if (xt) {
|
|
2038
|
+
st.current = null, ot.current = u, at(xt);
|
|
1896
2039
|
return;
|
|
1897
2040
|
}
|
|
1898
|
-
|
|
2041
|
+
st.current = u;
|
|
1899
2042
|
},
|
|
1900
|
-
[
|
|
1901
|
-
),
|
|
1902
|
-
(i,
|
|
1903
|
-
if (!
|
|
2043
|
+
[L, n, b, v.top, kt, at, s]
|
|
2044
|
+
), me = T(
|
|
2045
|
+
(i, a) => {
|
|
2046
|
+
if (!L || i.defaultPrevented || i.altKey || i.metaKey || i.ctrlKey)
|
|
1904
2047
|
return;
|
|
1905
|
-
const
|
|
1906
|
-
if (
|
|
1907
|
-
const
|
|
1908
|
-
if (
|
|
2048
|
+
const u = i.target;
|
|
2049
|
+
if (u) {
|
|
2050
|
+
const y = u.tagName;
|
|
2051
|
+
if (y === "INPUT" || y === "TEXTAREA" || y === "SELECT" || u.isContentEditable)
|
|
1909
2052
|
return;
|
|
1910
2053
|
}
|
|
1911
2054
|
if (i.key === "ArrowDown") {
|
|
1912
|
-
|
|
2055
|
+
a < n - 1 && (i.preventDefault(), jt(a + 1));
|
|
1913
2056
|
return;
|
|
1914
2057
|
}
|
|
1915
2058
|
if (i.key === "ArrowUp") {
|
|
1916
|
-
|
|
2059
|
+
a > 0 && (i.preventDefault(), jt(a - 1));
|
|
1917
2060
|
return;
|
|
1918
2061
|
}
|
|
1919
2062
|
if (i.key === "PageDown") {
|
|
1920
|
-
if (
|
|
2063
|
+
if (a < n - 1) {
|
|
1921
2064
|
i.preventDefault();
|
|
1922
|
-
const
|
|
1923
|
-
|
|
2065
|
+
const y = Math.max(Wt - _t + 1, 1), w = Math.max(y, 1), V = nt(Math.min(a + w, n - 1), n);
|
|
2066
|
+
jt(V);
|
|
1924
2067
|
}
|
|
1925
2068
|
return;
|
|
1926
2069
|
}
|
|
1927
|
-
if (i.key === "PageUp" &&
|
|
2070
|
+
if (i.key === "PageUp" && a > 0) {
|
|
1928
2071
|
i.preventDefault();
|
|
1929
|
-
const
|
|
1930
|
-
|
|
2072
|
+
const y = Math.max(Wt - _t + 1, 1), w = Math.max(y, 1), V = nt(a - w, n);
|
|
2073
|
+
jt(V);
|
|
1931
2074
|
}
|
|
1932
2075
|
},
|
|
1933
|
-
[
|
|
1934
|
-
),
|
|
2076
|
+
[L, n, jt, Wt, _t]
|
|
2077
|
+
), pe = T(
|
|
1935
2078
|
(i) => {
|
|
1936
|
-
if (!
|
|
2079
|
+
if (!L)
|
|
1937
2080
|
return;
|
|
1938
|
-
const
|
|
1939
|
-
|
|
2081
|
+
const a = nt(i, n);
|
|
2082
|
+
st.current = null, ot.current = a, U?.(a);
|
|
1940
2083
|
},
|
|
1941
|
-
[
|
|
2084
|
+
[L, n, U]
|
|
1942
2085
|
);
|
|
1943
|
-
|
|
1944
|
-
const i =
|
|
1945
|
-
|
|
1946
|
-
renderingStartIndex:
|
|
1947
|
-
renderingEndIndex:
|
|
1948
|
-
visibleStartIndex:
|
|
1949
|
-
visibleEndIndex:
|
|
1950
|
-
scrollPositionState:
|
|
1951
|
-
paneScrollPosition:
|
|
1952
|
-
logicalScrollPosition:
|
|
1953
|
-
contentSize:
|
|
2086
|
+
B(() => {
|
|
2087
|
+
const i = F.current?.getScrollPosition() ?? 0, a = k.current, u = Gt(a, v.top);
|
|
2088
|
+
_.debug("[VirtualScroll] Range change effect triggered", {
|
|
2089
|
+
renderingStartIndex: $t,
|
|
2090
|
+
renderingEndIndex: Kt,
|
|
2091
|
+
visibleStartIndex: _t,
|
|
2092
|
+
visibleEndIndex: Wt,
|
|
2093
|
+
scrollPositionState: yt,
|
|
2094
|
+
paneScrollPosition: a,
|
|
2095
|
+
logicalScrollPosition: u,
|
|
2096
|
+
contentSize: I,
|
|
1954
2097
|
scrollPaneScrollPosition: i
|
|
1955
|
-
}),
|
|
1956
|
-
renderingStartIndex:
|
|
1957
|
-
renderingEndIndex:
|
|
1958
|
-
visibleStartIndex:
|
|
1959
|
-
visibleEndIndex:
|
|
1960
|
-
scrollPosition:
|
|
1961
|
-
totalHeight:
|
|
2098
|
+
}), Yt({
|
|
2099
|
+
renderingStartIndex: $t,
|
|
2100
|
+
renderingEndIndex: Kt,
|
|
2101
|
+
visibleStartIndex: _t,
|
|
2102
|
+
visibleEndIndex: Wt,
|
|
2103
|
+
scrollPosition: u,
|
|
2104
|
+
totalHeight: I
|
|
1962
2105
|
});
|
|
1963
|
-
}, [
|
|
1964
|
-
const
|
|
2106
|
+
}, [I, Kt, $t, v.top, Yt, yt, Wt, _t]);
|
|
2107
|
+
const ve = T(() => C ? /* @__PURE__ */ $("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": wt && Ct !== null, children: Ct === "up" ? /* @__PURE__ */ $("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ $(
|
|
1965
2108
|
"button",
|
|
1966
2109
|
{
|
|
1967
2110
|
type: "button",
|
|
1968
|
-
className: "aqvs
|
|
1969
|
-
onClick: (
|
|
1970
|
-
|
|
2111
|
+
className: "aqvs-scroll-to-edge-button",
|
|
2112
|
+
onClick: (u) => {
|
|
2113
|
+
u.stopPropagation(), ht.current = !0, kt(0), At(!1);
|
|
1971
2114
|
},
|
|
1972
2115
|
children: "Top"
|
|
1973
2116
|
}
|
|
1974
|
-
) }) : /* @__PURE__ */
|
|
2117
|
+
) }) : /* @__PURE__ */ $("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-bottom", children: /* @__PURE__ */ $(
|
|
1975
2118
|
"button",
|
|
1976
2119
|
{
|
|
1977
2120
|
type: "button",
|
|
1978
|
-
className: "aqvs
|
|
1979
|
-
onClick: (
|
|
1980
|
-
|
|
2121
|
+
className: "aqvs-scroll-to-edge-button",
|
|
2122
|
+
onClick: (u) => {
|
|
2123
|
+
u.stopPropagation(), ht.current = !0, kt(n - 1), At(!1);
|
|
1981
2124
|
},
|
|
1982
2125
|
children: "Bottom"
|
|
1983
2126
|
}
|
|
1984
|
-
) }) }) : null, [
|
|
1985
|
-
if (
|
|
2127
|
+
) }) }) : null, [C, wt, Ct, kt, n]), { visibleItems: ie, startPosition: se } = Vt(() => {
|
|
2128
|
+
if (n === 0)
|
|
1986
2129
|
return {
|
|
1987
|
-
visibleItems: /* @__PURE__ */
|
|
2130
|
+
visibleItems: /* @__PURE__ */ $("div", { className: "aqvs-no-items-container", children: /* @__PURE__ */ $("div", { className: "aqvs-no-items-text", children: "No items" }) }),
|
|
1988
2131
|
startPosition: 0
|
|
1989
2132
|
};
|
|
1990
|
-
const i =
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
2133
|
+
const i = nt($t, n), a = nt(Kt, n), { cumulative: u, currentValue: y } = b.prefixSum(i, { materializeOption: { materialize: !1 } }), w = u - y, V = [], z = [];
|
|
2134
|
+
let X = 0;
|
|
2135
|
+
for (let O = i; O <= a; O++) {
|
|
2136
|
+
const H = r(O), gt = b.get(O), xt = H - gt;
|
|
2137
|
+
xt !== 0 && V.push({ index: O, value: H });
|
|
2138
|
+
const { cumulative: Ft, currentValue: Jt } = b.prefixSum(O, { materializeOption: { materialize: !1 } }), ce = Ft - Jt + X, ue = e ? e(O) : O;
|
|
2139
|
+
z.push(
|
|
2140
|
+
/* @__PURE__ */ $(
|
|
1997
2141
|
gr,
|
|
1998
2142
|
{
|
|
1999
|
-
index:
|
|
2000
|
-
top:
|
|
2001
|
-
height:
|
|
2002
|
-
item: t(
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2143
|
+
index: O,
|
|
2144
|
+
top: ce - w + v.top,
|
|
2145
|
+
height: H,
|
|
2146
|
+
item: t(O),
|
|
2147
|
+
clipItemHeight: J,
|
|
2148
|
+
enableKeyboardNavigation: L,
|
|
2149
|
+
onKeyDown: me,
|
|
2150
|
+
onFocus: pe,
|
|
2151
|
+
registerItemRef: Zt,
|
|
2152
|
+
children: p
|
|
2009
2153
|
},
|
|
2010
|
-
|
|
2154
|
+
ue
|
|
2011
2155
|
)
|
|
2012
|
-
);
|
|
2156
|
+
), X += xt;
|
|
2013
2157
|
}
|
|
2014
2158
|
return V.length > 0 && Promise.resolve().then(() => {
|
|
2015
|
-
if (!
|
|
2159
|
+
if (!vt.current)
|
|
2016
2160
|
return;
|
|
2017
|
-
|
|
2018
|
-
|
|
2161
|
+
let O = 0;
|
|
2162
|
+
for (const xt of V)
|
|
2163
|
+
if (xt.index < _t) {
|
|
2164
|
+
const Ft = b.get(xt.index);
|
|
2165
|
+
O += xt.value - Ft;
|
|
2166
|
+
}
|
|
2167
|
+
const H = b.updates(V);
|
|
2168
|
+
if (!vt.current || typeof H != "number")
|
|
2019
2169
|
return;
|
|
2020
|
-
|
|
2021
|
-
const
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2170
|
+
N(H), _.debug("[VirtualScroll] Updated heights for items", V, "New total height:", H);
|
|
2171
|
+
const gt = F.current?.getScrollPosition() ?? k.current;
|
|
2172
|
+
if (O !== 0) {
|
|
2173
|
+
const xt = gt + O;
|
|
2174
|
+
h.current += 1, rt(xt, { immediate: !0 }), F.current?.scrollTo(xt), _.debug("[VirtualScroll] Adjusted scroll for layout shift (auto update)", { from: gt, to: xt, shiftAmount: O });
|
|
2175
|
+
} else gt !== k.current && rt(gt);
|
|
2176
|
+
}), { visibleItems: z, startPosition: w };
|
|
2177
|
+
}, [
|
|
2178
|
+
p,
|
|
2179
|
+
J,
|
|
2180
|
+
L,
|
|
2181
|
+
n,
|
|
2182
|
+
b,
|
|
2183
|
+
t,
|
|
2184
|
+
e,
|
|
2185
|
+
r,
|
|
2186
|
+
pe,
|
|
2187
|
+
me,
|
|
2188
|
+
Zt,
|
|
2189
|
+
Kt,
|
|
2190
|
+
$t,
|
|
2191
|
+
v.top,
|
|
2192
|
+
rt,
|
|
2193
|
+
_t
|
|
2194
|
+
]), o = T(
|
|
2025
2195
|
(i) => {
|
|
2026
|
-
const
|
|
2027
|
-
if (
|
|
2196
|
+
const a = (x ?? 0) > 0, u = Math.abs(i - yt), y = a && u > 0.5 ? yt : i, w = Gt(y, v.top);
|
|
2197
|
+
if (_.debug("[VirtualScroll] Rendering visible items", {
|
|
2028
2198
|
currentScrollPosition: i,
|
|
2029
|
-
effectiveScrollPosition:
|
|
2030
|
-
renderingStartIndex:
|
|
2031
|
-
renderingEndIndex:
|
|
2032
|
-
|
|
2033
|
-
viewportSize:
|
|
2034
|
-
callbackThrottleMs:
|
|
2035
|
-
diff:
|
|
2036
|
-
rawEffectiveScrollPosition:
|
|
2037
|
-
}),
|
|
2038
|
-
return
|
|
2039
|
-
const V =
|
|
2199
|
+
effectiveScrollPosition: w,
|
|
2200
|
+
renderingStartIndex: $t,
|
|
2201
|
+
renderingEndIndex: Kt,
|
|
2202
|
+
itemCount: n,
|
|
2203
|
+
viewportSize: s,
|
|
2204
|
+
callbackThrottleMs: x,
|
|
2205
|
+
diff: u,
|
|
2206
|
+
rawEffectiveScrollPosition: y
|
|
2207
|
+
}), n === 0)
|
|
2208
|
+
return ie;
|
|
2209
|
+
const V = se - w, z = v.bottom > 0 ? /* @__PURE__ */ $(
|
|
2040
2210
|
"div",
|
|
2041
2211
|
{
|
|
2042
|
-
className: "aqvs
|
|
2212
|
+
className: "aqvs-bottom-inset",
|
|
2043
2213
|
style: {
|
|
2044
|
-
top:
|
|
2214
|
+
top: b.getTotal() + v.top - se,
|
|
2045
2215
|
height: v.bottom
|
|
2046
2216
|
}
|
|
2047
2217
|
},
|
|
2048
2218
|
"virtualscroll-bottom-inset"
|
|
2049
2219
|
) : null;
|
|
2050
|
-
return
|
|
2220
|
+
return _.debug("[VirtualScroll] Rendering items", {
|
|
2051
2221
|
containerTop: V,
|
|
2052
|
-
logicalScrollPosition:
|
|
2222
|
+
logicalScrollPosition: Ut,
|
|
2053
2223
|
resolvedInsets: v,
|
|
2054
|
-
effectiveScrollPosition:
|
|
2055
|
-
}), /* @__PURE__ */
|
|
2056
|
-
|
|
2057
|
-
|
|
2224
|
+
effectiveScrollPosition: w
|
|
2225
|
+
}), /* @__PURE__ */ re("div", { className: "aqvs-items-wrapper", style: { top: V, position: "relative" }, children: [
|
|
2226
|
+
ie,
|
|
2227
|
+
z
|
|
2058
2228
|
] });
|
|
2059
2229
|
},
|
|
2060
|
-
[
|
|
2230
|
+
[x, n, b, Ut, Kt, $t, v, yt, se, s, ie]
|
|
2231
|
+
), P = Vt(
|
|
2232
|
+
() => ({
|
|
2233
|
+
renderingStartIndex: zt.renderingStartIndex,
|
|
2234
|
+
renderingEndIndex: zt.renderingEndIndex,
|
|
2235
|
+
visibleStartIndex: zt.visibleStartIndex,
|
|
2236
|
+
visibleEndIndex: zt.visibleEndIndex,
|
|
2237
|
+
scrollPosition: Ut,
|
|
2238
|
+
totalHeight: b.getTotal()
|
|
2239
|
+
// contentSize (State) ではなく最新値を反映
|
|
2240
|
+
}),
|
|
2241
|
+
[zt, Ut, b]
|
|
2061
2242
|
);
|
|
2062
|
-
|
|
2063
|
-
|
|
2243
|
+
B(() => {
|
|
2244
|
+
Tt.current = P;
|
|
2245
|
+
}, [P]), ye(
|
|
2246
|
+
bt,
|
|
2064
2247
|
() => ({
|
|
2065
|
-
getScrollPosition: () =>
|
|
2066
|
-
getContentSize: () =>
|
|
2067
|
-
getViewportSize: () =>
|
|
2068
|
-
scrollTo:
|
|
2069
|
-
scrollToIndex:
|
|
2070
|
-
getFenwickTreeTotalHeight: () =>
|
|
2071
|
-
getFenwickSize: () =>
|
|
2072
|
-
focusItemAtIndex:
|
|
2248
|
+
getScrollPosition: () => F.current?.getScrollPosition() ?? -1,
|
|
2249
|
+
getContentSize: () => F.current?.getContentSize() ?? -1,
|
|
2250
|
+
getViewportSize: () => F.current?.getViewportSize() ?? -1,
|
|
2251
|
+
scrollTo: te,
|
|
2252
|
+
scrollToIndex: kt,
|
|
2253
|
+
getFenwickTreeTotalHeight: () => b.getTotal(),
|
|
2254
|
+
getFenwickSize: () => b.getSize(),
|
|
2255
|
+
focusItemAtIndex: jt,
|
|
2256
|
+
getRange: () => Tt.current,
|
|
2257
|
+
updateItemSize: le
|
|
2073
2258
|
}),
|
|
2074
|
-
[
|
|
2259
|
+
[te, kt, b, jt, le]
|
|
2075
2260
|
);
|
|
2076
|
-
const
|
|
2077
|
-
return /* @__PURE__ */
|
|
2078
|
-
|
|
2261
|
+
const R = b.getTotal() + v.top + v.bottom;
|
|
2262
|
+
return /* @__PURE__ */ $(
|
|
2263
|
+
ar,
|
|
2079
2264
|
{
|
|
2080
|
-
ref:
|
|
2081
|
-
contentSize:
|
|
2082
|
-
viewportSize:
|
|
2265
|
+
ref: F,
|
|
2266
|
+
contentSize: R,
|
|
2267
|
+
viewportSize: s,
|
|
2083
2268
|
className: c,
|
|
2084
|
-
onScroll:
|
|
2085
|
-
background:
|
|
2086
|
-
tapScrollCircleOptions:
|
|
2087
|
-
inertiaOptions:
|
|
2088
|
-
itemCount:
|
|
2089
|
-
scrollBarWidth:
|
|
2090
|
-
enableThumbDrag:
|
|
2091
|
-
enableTrackClick:
|
|
2092
|
-
enableArrowButtons:
|
|
2093
|
-
enablePointerDrag:
|
|
2094
|
-
renderThumbOverlay:
|
|
2095
|
-
wheelSpeedMultiplier:
|
|
2269
|
+
onScroll: be,
|
|
2270
|
+
background: m,
|
|
2271
|
+
tapScrollCircleOptions: G,
|
|
2272
|
+
inertiaOptions: Z,
|
|
2273
|
+
itemCount: n,
|
|
2274
|
+
scrollBarWidth: lt,
|
|
2275
|
+
enableThumbDrag: it,
|
|
2276
|
+
enableTrackClick: Y,
|
|
2277
|
+
enableArrowButtons: tt,
|
|
2278
|
+
enablePointerDrag: It,
|
|
2279
|
+
renderThumbOverlay: K,
|
|
2280
|
+
wheelSpeedMultiplier: D,
|
|
2096
2281
|
contentInsets: v,
|
|
2097
|
-
visibleStartIndex:
|
|
2098
|
-
visibleEndIndex:
|
|
2099
|
-
renderOverlay:
|
|
2100
|
-
|
|
2282
|
+
visibleStartIndex: _t,
|
|
2283
|
+
visibleEndIndex: Wt,
|
|
2284
|
+
renderOverlay: ve,
|
|
2285
|
+
initialScrollPosition: Pt.position,
|
|
2286
|
+
children: o
|
|
2101
2287
|
}
|
|
2102
2288
|
);
|
|
2103
|
-
},
|
|
2289
|
+
}, Sr = Me(xr);
|
|
2104
2290
|
export {
|
|
2105
|
-
|
|
2291
|
+
cr as FenwickMapTree,
|
|
2106
2292
|
or as ScrollBar,
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2293
|
+
ar as ScrollPane,
|
|
2294
|
+
Sr as VirtualScroll,
|
|
2295
|
+
pt as minmax,
|
|
2296
|
+
Tr as tapScrollCircleSampleVisual,
|
|
2297
|
+
ur as useFenwickMapTree,
|
|
2298
|
+
Pr as useHeightCache,
|
|
2299
|
+
fr as useLruCache
|
|
2114
2300
|
};
|