@aiquants/virtualscroll 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cli.js +13 -22
- package/dist/index.cjs +1 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +640 -919
- package/dist/index.js.map +1 -1
- package/dist/virtualscroll.css +1 -1
- package/package.json +21 -15
package/dist/index.js
CHANGED
|
@@ -1,286 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* @license React
|
|
6
|
-
* react-jsx-runtime.production.js
|
|
7
|
-
*
|
|
8
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the MIT license found in the
|
|
11
|
-
* LICENSE file in the root directory of this source tree.
|
|
12
|
-
*/
|
|
13
|
-
var Ve;
|
|
14
|
-
function qe() {
|
|
15
|
-
if (Ve) return fe;
|
|
16
|
-
Ve = 1;
|
|
17
|
-
var c = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
|
|
18
|
-
function n(r, s, a) {
|
|
19
|
-
var i = null;
|
|
20
|
-
if (a !== void 0 && (i = "" + a), s.key !== void 0 && (i = "" + s.key), "key" in s) {
|
|
21
|
-
a = {};
|
|
22
|
-
for (var f in s)
|
|
23
|
-
f !== "key" && (a[f] = s[f]);
|
|
24
|
-
} else a = s;
|
|
25
|
-
return s = a.ref, {
|
|
26
|
-
$$typeof: c,
|
|
27
|
-
type: r,
|
|
28
|
-
key: i,
|
|
29
|
-
ref: s !== void 0 ? s : null,
|
|
30
|
-
props: a
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
return fe.Fragment = e, fe.jsx = n, fe.jsxs = n, fe;
|
|
34
|
-
}
|
|
35
|
-
var me = {};
|
|
36
|
-
/**
|
|
37
|
-
* @license React
|
|
38
|
-
* react-jsx-runtime.development.js
|
|
39
|
-
*
|
|
40
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
41
|
-
*
|
|
42
|
-
* This source code is licensed under the MIT license found in the
|
|
43
|
-
* LICENSE file in the root directory of this source tree.
|
|
44
|
-
*/
|
|
45
|
-
var ke;
|
|
46
|
-
function Xe() {
|
|
47
|
-
return ke || (ke = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
48
|
-
function c(t) {
|
|
49
|
-
if (t == null) return null;
|
|
50
|
-
if (typeof t == "function")
|
|
51
|
-
return t.$$typeof === l ? null : t.displayName || t.name || null;
|
|
52
|
-
if (typeof t == "string") return t;
|
|
53
|
-
switch (t) {
|
|
54
|
-
case N:
|
|
55
|
-
return "Fragment";
|
|
56
|
-
case F:
|
|
57
|
-
return "Profiler";
|
|
58
|
-
case K:
|
|
59
|
-
return "StrictMode";
|
|
60
|
-
case k:
|
|
61
|
-
return "Suspense";
|
|
62
|
-
case C:
|
|
63
|
-
return "SuspenseList";
|
|
64
|
-
case se:
|
|
65
|
-
return "Activity";
|
|
66
|
-
}
|
|
67
|
-
if (typeof t == "object")
|
|
68
|
-
switch (typeof t.tag == "number" && console.error(
|
|
69
|
-
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
70
|
-
), t.$$typeof) {
|
|
71
|
-
case ie:
|
|
72
|
-
return "Portal";
|
|
73
|
-
case Z:
|
|
74
|
-
return (t.displayName || "Context") + ".Provider";
|
|
75
|
-
case m:
|
|
76
|
-
return (t._context.displayName || "Context") + ".Consumer";
|
|
77
|
-
case A:
|
|
78
|
-
var o = t.render;
|
|
79
|
-
return t = t.displayName, t || (t = o.displayName || o.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
|
|
80
|
-
case B:
|
|
81
|
-
return o = t.displayName || null, o !== null ? o : c(t.type) || "Memo";
|
|
82
|
-
case X:
|
|
83
|
-
o = t._payload, t = t._init;
|
|
84
|
-
try {
|
|
85
|
-
return c(t(o));
|
|
86
|
-
} catch {
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
function e(t) {
|
|
92
|
-
return "" + t;
|
|
93
|
-
}
|
|
94
|
-
function n(t) {
|
|
95
|
-
try {
|
|
96
|
-
e(t);
|
|
97
|
-
var o = !1;
|
|
98
|
-
} catch {
|
|
99
|
-
o = !0;
|
|
100
|
-
}
|
|
101
|
-
if (o) {
|
|
102
|
-
o = console;
|
|
103
|
-
var T = o.error, y = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
|
|
104
|
-
return T.call(
|
|
105
|
-
o,
|
|
106
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
107
|
-
y
|
|
108
|
-
), e(t);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
function r(t) {
|
|
112
|
-
if (t === N) return "<>";
|
|
113
|
-
if (typeof t == "object" && t !== null && t.$$typeof === X)
|
|
114
|
-
return "<...>";
|
|
115
|
-
try {
|
|
116
|
-
var o = c(t);
|
|
117
|
-
return o ? "<" + o + ">" : "<...>";
|
|
118
|
-
} catch {
|
|
119
|
-
return "<...>";
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
function s() {
|
|
123
|
-
var t = Y.A;
|
|
124
|
-
return t === null ? null : t.getOwner();
|
|
125
|
-
}
|
|
126
|
-
function a() {
|
|
127
|
-
return Error("react-stack-top-frame");
|
|
128
|
-
}
|
|
129
|
-
function i(t) {
|
|
130
|
-
if (j.call(t, "key")) {
|
|
131
|
-
var o = Object.getOwnPropertyDescriptor(t, "key").get;
|
|
132
|
-
if (o && o.isReactWarning) return !1;
|
|
133
|
-
}
|
|
134
|
-
return t.key !== void 0;
|
|
135
|
-
}
|
|
136
|
-
function f(t, o) {
|
|
137
|
-
function T() {
|
|
138
|
-
E || (E = !0, console.error(
|
|
139
|
-
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
140
|
-
o
|
|
141
|
-
));
|
|
142
|
-
}
|
|
143
|
-
T.isReactWarning = !0, Object.defineProperty(t, "key", {
|
|
144
|
-
get: T,
|
|
145
|
-
configurable: !0
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
function p() {
|
|
149
|
-
var t = c(this.type);
|
|
150
|
-
return M[t] || (M[t] = !0, console.error(
|
|
151
|
-
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
152
|
-
)), t = this.props.ref, t !== void 0 ? t : null;
|
|
153
|
-
}
|
|
154
|
-
function g(t, o, T, y, w, V, D, _) {
|
|
155
|
-
return T = V.ref, t = {
|
|
156
|
-
$$typeof: ne,
|
|
157
|
-
type: t,
|
|
158
|
-
key: o,
|
|
159
|
-
props: V,
|
|
160
|
-
_owner: w
|
|
161
|
-
}, (T !== void 0 ? T : null) !== null ? Object.defineProperty(t, "ref", {
|
|
162
|
-
enumerable: !1,
|
|
163
|
-
get: p
|
|
164
|
-
}) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
|
|
165
|
-
configurable: !1,
|
|
166
|
-
enumerable: !1,
|
|
167
|
-
writable: !0,
|
|
168
|
-
value: 0
|
|
169
|
-
}), Object.defineProperty(t, "_debugInfo", {
|
|
170
|
-
configurable: !1,
|
|
171
|
-
enumerable: !1,
|
|
172
|
-
writable: !0,
|
|
173
|
-
value: null
|
|
174
|
-
}), Object.defineProperty(t, "_debugStack", {
|
|
175
|
-
configurable: !1,
|
|
176
|
-
enumerable: !1,
|
|
177
|
-
writable: !0,
|
|
178
|
-
value: D
|
|
179
|
-
}), Object.defineProperty(t, "_debugTask", {
|
|
180
|
-
configurable: !1,
|
|
181
|
-
enumerable: !1,
|
|
182
|
-
writable: !0,
|
|
183
|
-
value: _
|
|
184
|
-
}), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
|
|
185
|
-
}
|
|
186
|
-
function x(t, o, T, y, w, V, D, _) {
|
|
187
|
-
var R = o.children;
|
|
188
|
-
if (R !== void 0)
|
|
189
|
-
if (y)
|
|
190
|
-
if (L(R)) {
|
|
191
|
-
for (y = 0; y < R.length; y++)
|
|
192
|
-
P(R[y]);
|
|
193
|
-
Object.freeze && Object.freeze(R);
|
|
194
|
-
} else
|
|
195
|
-
console.error(
|
|
196
|
-
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
197
|
-
);
|
|
198
|
-
else P(R);
|
|
199
|
-
if (j.call(o, "key")) {
|
|
200
|
-
R = c(t);
|
|
201
|
-
var G = Object.keys(o).filter(function(u) {
|
|
202
|
-
return u !== "key";
|
|
203
|
-
});
|
|
204
|
-
y = 0 < G.length ? "{key: someKey, " + G.join(": ..., ") + ": ...}" : "{key: someKey}", I[R + y] || (G = 0 < G.length ? "{" + G.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
205
|
-
`A props object containing a "key" prop is being spread into JSX:
|
|
206
|
-
let props = %s;
|
|
207
|
-
<%s {...props} />
|
|
208
|
-
React keys must be passed directly to JSX without using spread:
|
|
209
|
-
let props = %s;
|
|
210
|
-
<%s key={someKey} {...props} />`,
|
|
211
|
-
y,
|
|
212
|
-
R,
|
|
213
|
-
G,
|
|
214
|
-
R
|
|
215
|
-
), I[R + y] = !0);
|
|
216
|
-
}
|
|
217
|
-
if (R = null, T !== void 0 && (n(T), R = "" + T), i(o) && (n(o.key), R = "" + o.key), "key" in o) {
|
|
218
|
-
T = {};
|
|
219
|
-
for (var J in o)
|
|
220
|
-
J !== "key" && (T[J] = o[J]);
|
|
221
|
-
} else T = o;
|
|
222
|
-
return R && f(
|
|
223
|
-
T,
|
|
224
|
-
typeof t == "function" ? t.displayName || t.name || "Unknown" : t
|
|
225
|
-
), g(
|
|
226
|
-
t,
|
|
227
|
-
R,
|
|
228
|
-
V,
|
|
229
|
-
w,
|
|
230
|
-
s(),
|
|
231
|
-
T,
|
|
232
|
-
D,
|
|
233
|
-
_
|
|
234
|
-
);
|
|
235
|
-
}
|
|
236
|
-
function P(t) {
|
|
237
|
-
typeof t == "object" && t !== null && t.$$typeof === ne && t._store && (t._store.validated = 1);
|
|
238
|
-
}
|
|
239
|
-
var S = He, ne = Symbol.for("react.transitional.element"), ie = Symbol.for("react.portal"), N = Symbol.for("react.fragment"), K = Symbol.for("react.strict_mode"), F = Symbol.for("react.profiler"), m = Symbol.for("react.consumer"), Z = Symbol.for("react.context"), A = Symbol.for("react.forward_ref"), k = Symbol.for("react.suspense"), C = Symbol.for("react.suspense_list"), B = Symbol.for("react.memo"), X = Symbol.for("react.lazy"), se = Symbol.for("react.activity"), l = Symbol.for("react.client.reference"), Y = S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, L = Array.isArray, b = console.createTask ? console.createTask : function() {
|
|
240
|
-
return null;
|
|
241
|
-
};
|
|
242
|
-
S = {
|
|
243
|
-
react_stack_bottom_frame: function(t) {
|
|
244
|
-
return t();
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
var E, M = {}, h = S.react_stack_bottom_frame.bind(
|
|
248
|
-
S,
|
|
249
|
-
a
|
|
250
|
-
)(), v = b(r(a)), I = {};
|
|
251
|
-
me.Fragment = N, me.jsx = function(t, o, T, y, w) {
|
|
252
|
-
var V = 1e4 > Y.recentlyCreatedOwnerStacks++;
|
|
253
|
-
return x(
|
|
254
|
-
t,
|
|
255
|
-
o,
|
|
256
|
-
T,
|
|
257
|
-
!1,
|
|
258
|
-
y,
|
|
259
|
-
w,
|
|
260
|
-
V ? Error("react-stack-top-frame") : h,
|
|
261
|
-
V ? b(r(t)) : v
|
|
262
|
-
);
|
|
263
|
-
}, me.jsxs = function(t, o, T, y, w) {
|
|
264
|
-
var V = 1e4 > Y.recentlyCreatedOwnerStacks++;
|
|
265
|
-
return x(
|
|
266
|
-
t,
|
|
267
|
-
o,
|
|
268
|
-
T,
|
|
269
|
-
!0,
|
|
270
|
-
y,
|
|
271
|
-
w,
|
|
272
|
-
V ? Error("react-stack-top-frame") : h,
|
|
273
|
-
V ? b(r(t)) : v
|
|
274
|
-
);
|
|
275
|
-
};
|
|
276
|
-
})()), me;
|
|
277
|
-
}
|
|
278
|
-
var Le;
|
|
279
|
-
function We() {
|
|
280
|
-
return Le || (Le = 1, process.env.NODE_ENV === "production" ? Te.exports = qe() : Te.exports = Xe()), Te.exports;
|
|
281
|
-
}
|
|
282
|
-
var q = We();
|
|
283
|
-
const re = {
|
|
1
|
+
import { jsxs as xe, jsx as j } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Ve, useState as le, useRef as N, useCallback as z, useImperativeHandle as Me, useMemo as O, useEffect as re, useReducer as ze, useLayoutEffect as ve, useId as ke } from "react";
|
|
3
|
+
import { twMerge as he } from "tailwind-merge";
|
|
4
|
+
const J = {
|
|
284
5
|
debug(c, ...e) {
|
|
285
6
|
typeof window < "u" && window.localStorage?.getItem("debug") === "true" && console.debug(`[VirtualScroll] ${c}`, ...e);
|
|
286
7
|
},
|
|
@@ -290,120 +11,120 @@ const re = {
|
|
|
290
11
|
error(c, ...e) {
|
|
291
12
|
console.error(`[VirtualScroll] ${c}`, ...e);
|
|
292
13
|
}
|
|
293
|
-
},
|
|
14
|
+
}, C = (c, e, n) => Math.min(n, Math.max(e, c)), ye = {
|
|
294
15
|
active: !1,
|
|
295
16
|
offsetY: 0,
|
|
296
17
|
distance: 0,
|
|
297
18
|
direction: 0
|
|
298
|
-
},
|
|
299
|
-
const [
|
|
300
|
-
(
|
|
301
|
-
const { y: M } =
|
|
302
|
-
active:
|
|
19
|
+
}, Le = 6, Re = Ve(({ onDragChange: c, className: e, maxVisualDistance: n = 160, size: t = 64, style: r, opacity: o = 1 }, s) => {
|
|
20
|
+
const [m, d] = le(ye), f = N(null), g = N({ x: 0, y: 0 }), y = N(null), w = z(
|
|
21
|
+
(x, T = !1) => {
|
|
22
|
+
const { y: M } = g.current, h = x - M, p = Math.abs(h), I = p < Le ? 0 : h < 0 ? -1 : 1, v = {
|
|
23
|
+
active: T || p >= Le,
|
|
303
24
|
offsetY: h,
|
|
304
|
-
distance:
|
|
25
|
+
distance: p,
|
|
305
26
|
direction: I
|
|
306
27
|
};
|
|
307
|
-
|
|
28
|
+
d(v), c(v);
|
|
308
29
|
},
|
|
309
30
|
[c]
|
|
310
|
-
),
|
|
311
|
-
(
|
|
312
|
-
if (
|
|
313
|
-
const
|
|
314
|
-
|
|
31
|
+
), ie = z(
|
|
32
|
+
(x = !1) => {
|
|
33
|
+
if (x && f.current !== null) {
|
|
34
|
+
const T = y.current;
|
|
35
|
+
T?.hasPointerCapture(f.current) && T.releasePointerCapture(f.current);
|
|
315
36
|
}
|
|
316
|
-
|
|
37
|
+
f.current = null, d(ye), c(ye);
|
|
317
38
|
},
|
|
318
39
|
[c]
|
|
319
|
-
),
|
|
320
|
-
(
|
|
321
|
-
|
|
322
|
-
const
|
|
323
|
-
|
|
40
|
+
), ae = z(
|
|
41
|
+
(x) => {
|
|
42
|
+
x.preventDefault(), x.stopPropagation();
|
|
43
|
+
const T = y.current ?? x.currentTarget, M = T.getBoundingClientRect();
|
|
44
|
+
g.current = {
|
|
324
45
|
x: M.left + M.width / 2,
|
|
325
46
|
y: M.top + M.height / 2
|
|
326
|
-
},
|
|
47
|
+
}, f.current = x.pointerId, T.setPointerCapture(x.pointerId), w(x.clientY, !0);
|
|
327
48
|
},
|
|
328
|
-
[
|
|
329
|
-
),
|
|
330
|
-
(
|
|
331
|
-
|
|
49
|
+
[w]
|
|
50
|
+
), Y = z(
|
|
51
|
+
(x) => {
|
|
52
|
+
f.current === x.pointerId && (x.preventDefault(), w(x.clientY));
|
|
332
53
|
},
|
|
333
|
-
[
|
|
334
|
-
),
|
|
335
|
-
(
|
|
336
|
-
|
|
54
|
+
[w]
|
|
55
|
+
), Q = z(
|
|
56
|
+
(x) => {
|
|
57
|
+
f.current === x.pointerId && (x.preventDefault(), x.stopPropagation(), ie(!0));
|
|
337
58
|
},
|
|
338
|
-
[
|
|
59
|
+
[ie]
|
|
339
60
|
);
|
|
340
|
-
|
|
341
|
-
|
|
61
|
+
Me(
|
|
62
|
+
s,
|
|
342
63
|
() => ({
|
|
343
64
|
reset: () => {
|
|
344
|
-
|
|
65
|
+
ie(!0);
|
|
345
66
|
},
|
|
346
|
-
getElement: () =>
|
|
67
|
+
getElement: () => y.current
|
|
347
68
|
}),
|
|
348
|
-
[
|
|
69
|
+
[ie]
|
|
349
70
|
);
|
|
350
|
-
const
|
|
351
|
-
const
|
|
352
|
-
...
|
|
353
|
-
width:
|
|
354
|
-
height:
|
|
355
|
-
transform: `translateY(${
|
|
71
|
+
const D = O(() => Math.min(m.distance, n) / n, [m.distance, n]), u = O(() => t / 64, [t]), ee = O(() => 1 + D * 0.4, [D]), E = O(() => m.direction * D * 10 * u, [m.direction, D, u]), P = O(() => m.direction * D * 26 * u, [m.direction, D, u]), F = O(() => 22 * u, [u]), W = O(() => Math.max(2.5, 3 * u), [u]), q = O(() => 6 * u, [u]), se = O(() => 3 * u, [u]), i = O(() => Math.min(Math.max(o, 0), 1), [o]), $ = O(() => {
|
|
72
|
+
const x = {
|
|
73
|
+
...r,
|
|
74
|
+
width: t,
|
|
75
|
+
height: t,
|
|
76
|
+
transform: `translateY(${E}px)`
|
|
356
77
|
};
|
|
357
|
-
return
|
|
358
|
-
}, [
|
|
359
|
-
return /* @__PURE__ */
|
|
78
|
+
return x.opacity = i, x;
|
|
79
|
+
}, [i, E, t, r]), k = O(() => Math.abs(P) + q, [q, P]), A = O(() => P > 0 ? se : -Math.abs(P) - se, [se, P]);
|
|
80
|
+
return /* @__PURE__ */ xe(
|
|
360
81
|
"div",
|
|
361
82
|
{
|
|
362
|
-
ref:
|
|
363
|
-
className:
|
|
83
|
+
ref: y,
|
|
84
|
+
className: he(
|
|
364
85
|
"relative flex items-center justify-center touch-none select-none",
|
|
365
86
|
"transition-transform duration-100 ease-out",
|
|
366
87
|
e
|
|
367
88
|
),
|
|
368
|
-
style:
|
|
369
|
-
onPointerDown:
|
|
370
|
-
onPointerMove:
|
|
371
|
-
onPointerUp:
|
|
372
|
-
onPointerCancel:
|
|
89
|
+
style: $,
|
|
90
|
+
onPointerDown: ae,
|
|
91
|
+
onPointerMove: Y,
|
|
92
|
+
onPointerUp: Q,
|
|
93
|
+
onPointerCancel: Q,
|
|
373
94
|
role: "presentation",
|
|
374
95
|
children: [
|
|
375
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ j(
|
|
376
97
|
"div",
|
|
377
98
|
{
|
|
378
99
|
className: "absolute inset-0 rounded-full border border-white/40 bg-gradient-to-br from-[#1d4ed8]/60 via-[#60a5fa]/55 to-[#bfdbfe]/40 shadow-md",
|
|
379
100
|
style: {
|
|
380
|
-
transform: `scaleY(${
|
|
381
|
-
transition:
|
|
101
|
+
transform: `scaleY(${ee})`,
|
|
102
|
+
transition: m.active ? "transform 40ms ease-out" : "transform 200ms ease"
|
|
382
103
|
}
|
|
383
104
|
}
|
|
384
105
|
),
|
|
385
|
-
/* @__PURE__ */
|
|
106
|
+
/* @__PURE__ */ j(
|
|
386
107
|
"div",
|
|
387
108
|
{
|
|
388
109
|
className: "absolute left-1/2 top-1/2 h-6 w-6 -translate-x-1/2 -translate-y-1/2 rounded-full border border-white/50 bg-white/85",
|
|
389
110
|
style: {
|
|
390
|
-
width:
|
|
391
|
-
height:
|
|
392
|
-
transform: `translate(-50%, calc(-50% + ${
|
|
393
|
-
transition:
|
|
111
|
+
width: F,
|
|
112
|
+
height: F,
|
|
113
|
+
transform: `translate(-50%, calc(-50% + ${P * 0.3}px)) scale(${1 + D * 0.2})`,
|
|
114
|
+
transition: m.active ? "transform 40ms ease-out" : "transform 200ms ease"
|
|
394
115
|
}
|
|
395
116
|
}
|
|
396
117
|
),
|
|
397
|
-
/* @__PURE__ */
|
|
118
|
+
/* @__PURE__ */ j(
|
|
398
119
|
"div",
|
|
399
120
|
{
|
|
400
121
|
className: "absolute left-1/2 top-1/2 w-1 rounded-full bg-white/50",
|
|
401
122
|
style: {
|
|
402
|
-
width:
|
|
403
|
-
height:
|
|
404
|
-
transform: `translate(-50%, ${
|
|
405
|
-
opacity:
|
|
406
|
-
transition:
|
|
123
|
+
width: W,
|
|
124
|
+
height: k,
|
|
125
|
+
transform: `translate(-50%, ${A}px)`,
|
|
126
|
+
opacity: D,
|
|
127
|
+
transition: m.active ? "height 40ms ease-out, opacity 60ms" : "height 200ms ease, opacity 120ms"
|
|
407
128
|
}
|
|
408
129
|
}
|
|
409
130
|
)
|
|
@@ -411,295 +132,295 @@ const re = {
|
|
|
411
132
|
}
|
|
412
133
|
);
|
|
413
134
|
});
|
|
414
|
-
|
|
415
|
-
const
|
|
416
|
-
const
|
|
417
|
-
|
|
418
|
-
const
|
|
135
|
+
Re.displayName = "TapScrollCircle";
|
|
136
|
+
const Ae = (c, e, n) => {
|
|
137
|
+
const t = "touches" in c.nativeEvent, r = t ? c.nativeEvent.touches[0] : c.nativeEvent, o = (m) => {
|
|
138
|
+
t && m.cancelable && m.preventDefault();
|
|
139
|
+
const d = "touches" in m ? m.touches[0] : m;
|
|
419
140
|
e({
|
|
420
|
-
deltaX:
|
|
421
|
-
deltaY:
|
|
141
|
+
deltaX: d.clientX - r.clientX,
|
|
142
|
+
deltaY: d.clientY - r.clientY
|
|
422
143
|
});
|
|
423
|
-
},
|
|
424
|
-
|
|
144
|
+
}, s = () => {
|
|
145
|
+
t ? (document.removeEventListener("touchmove", o), document.removeEventListener("touchend", s)) : (document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", s)), n?.();
|
|
425
146
|
};
|
|
426
|
-
|
|
427
|
-
},
|
|
147
|
+
t ? (document.addEventListener("touchmove", o, { passive: !1 }), document.addEventListener("touchend", s)) : (document.addEventListener("mousemove", o), document.addEventListener("mouseup", s));
|
|
148
|
+
}, Ee = "virtualscroll:tap-scroll-cancel", De = 20, Oe = 250, Ye = 60, He = 20, Ue = 20, $e = 220, _e = { active: !1, offsetY: 0, distance: 0, direction: 0 }, Se = 2.2, Xe = 8, qe = 120, ce = {
|
|
428
149
|
enabled: !0,
|
|
429
150
|
size: 64,
|
|
430
151
|
offsetX: -80,
|
|
431
152
|
offsetY: 0,
|
|
432
153
|
className: void 0,
|
|
433
|
-
maxVisualDistance:
|
|
154
|
+
maxVisualDistance: $e,
|
|
434
155
|
opacity: 1
|
|
435
|
-
},
|
|
156
|
+
}, je = (c) => {
|
|
436
157
|
if (!c || c <= 0)
|
|
437
|
-
return
|
|
438
|
-
const e = Math.max(1, c), n = Math.log10(e),
|
|
439
|
-
return
|
|
440
|
-
},
|
|
441
|
-
const [
|
|
442
|
-
const
|
|
158
|
+
return Se;
|
|
159
|
+
const e = Math.max(1, c), n = Math.log10(e), t = Se + n * Xe;
|
|
160
|
+
return C(t, Se, qe);
|
|
161
|
+
}, Ke = ({ contentSize: c, viewportSize: e, scrollPosition: n, onScroll: t, horizontal: r = !1, scrollBarWidth: o = 12, className: s, ariaControls: m, tapScrollCircleOptions: d, itemCount: f }) => {
|
|
162
|
+
const [g, y] = le(!1), [w, ie] = le(!1), ae = N(null), Y = N(n), Q = N(null), D = N(null), u = N(_e), ee = N(null), E = N(null), P = N(null), F = O(() => {
|
|
163
|
+
const l = d?.maxSpeedMultiplier, L = typeof l == "number" ? l : je(f);
|
|
443
164
|
return {
|
|
444
|
-
enabled:
|
|
445
|
-
size:
|
|
446
|
-
offsetX:
|
|
447
|
-
offsetY:
|
|
448
|
-
className:
|
|
449
|
-
maxVisualDistance:
|
|
450
|
-
maxSpeedMultiplier:
|
|
451
|
-
opacity:
|
|
165
|
+
enabled: d?.enabled ?? ce.enabled,
|
|
166
|
+
size: d?.size ?? ce.size,
|
|
167
|
+
offsetX: d?.offsetX ?? ce.offsetX,
|
|
168
|
+
offsetY: d?.offsetY ?? ce.offsetY,
|
|
169
|
+
className: d?.className ?? ce.className,
|
|
170
|
+
maxVisualDistance: d?.maxVisualDistance ?? ce.maxVisualDistance,
|
|
171
|
+
maxSpeedMultiplier: L,
|
|
172
|
+
opacity: C(d?.opacity ?? ce.opacity, 0, 1)
|
|
452
173
|
};
|
|
453
|
-
}, [
|
|
454
|
-
enabled:
|
|
455
|
-
size:
|
|
174
|
+
}, [f, d]), {
|
|
175
|
+
enabled: W,
|
|
176
|
+
size: q,
|
|
456
177
|
offsetX: se,
|
|
457
|
-
offsetY:
|
|
458
|
-
className:
|
|
459
|
-
maxVisualDistance:
|
|
460
|
-
maxSpeedMultiplier:
|
|
461
|
-
opacity:
|
|
462
|
-
} =
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
}, [n]),
|
|
466
|
-
|
|
467
|
-
}, [
|
|
468
|
-
const
|
|
469
|
-
|
|
470
|
-
}, []),
|
|
471
|
-
|
|
472
|
-
}, []),
|
|
473
|
-
|
|
474
|
-
}, [
|
|
475
|
-
(
|
|
476
|
-
const
|
|
477
|
-
if (!
|
|
478
|
-
|
|
178
|
+
offsetY: i,
|
|
179
|
+
className: $,
|
|
180
|
+
maxVisualDistance: k,
|
|
181
|
+
maxSpeedMultiplier: A,
|
|
182
|
+
opacity: x
|
|
183
|
+
} = F, T = Math.max(k, 1), M = e / c, h = o, p = Math.max(e - h * 2, 0), I = M * p, v = Math.min(Math.max(De, I || 0), p || De), b = c - e, _ = Math.max(p - v, 0), H = b <= 0 || _ <= 0 ? 0 : n / b * _, V = c > e;
|
|
184
|
+
re(() => {
|
|
185
|
+
Y.current = n;
|
|
186
|
+
}, [n]), re(() => {
|
|
187
|
+
ae.current && (g ? ae.current.style.backgroundColor = "#4F4F4F" : ae.current.style.backgroundColor = "#7F7F7F");
|
|
188
|
+
}, [g]);
|
|
189
|
+
const X = z(() => {
|
|
190
|
+
Q.current !== null && (window.clearInterval(Q.current), Q.current = null), D.current !== null && (window.clearTimeout(D.current), D.current = null);
|
|
191
|
+
}, []), R = z(() => {
|
|
192
|
+
E.current !== null && (window.cancelAnimationFrame(E.current), E.current = null), P.current = null;
|
|
193
|
+
}, []), S = z(() => {
|
|
194
|
+
u.current = { ..._e }, ie(!1), ee.current?.reset(), R();
|
|
195
|
+
}, [R]), K = z(
|
|
196
|
+
(l) => {
|
|
197
|
+
const L = u.current;
|
|
198
|
+
if (!L.active || L.direction === 0) {
|
|
199
|
+
R();
|
|
479
200
|
return;
|
|
480
201
|
}
|
|
481
|
-
if (!
|
|
482
|
-
|
|
202
|
+
if (!V || b <= 0) {
|
|
203
|
+
R();
|
|
483
204
|
return;
|
|
484
205
|
}
|
|
485
|
-
const
|
|
486
|
-
if (
|
|
487
|
-
|
|
206
|
+
const Z = P.current ?? l, B = Math.max((l - Z) / 1e3, 0);
|
|
207
|
+
if (P.current = l, B <= 0) {
|
|
208
|
+
E.current = window.requestAnimationFrame(K);
|
|
488
209
|
return;
|
|
489
210
|
}
|
|
490
|
-
const
|
|
491
|
-
if (
|
|
492
|
-
|
|
211
|
+
const Te = (Math.min(L.distance, T) / T) ** 1.1, de = Math.max(e * 0.2, 40), be = Math.max(e * A, 1200), we = de + (be - de) * Te, ge = Y.current, Ie = C(ge + L.direction * we * B, 0, b);
|
|
212
|
+
if (Ie === ge) {
|
|
213
|
+
R();
|
|
493
214
|
return;
|
|
494
215
|
}
|
|
495
|
-
|
|
216
|
+
Y.current = Ie, t?.(Ie, ge), E.current = window.requestAnimationFrame(K);
|
|
496
217
|
},
|
|
497
|
-
[
|
|
498
|
-
),
|
|
499
|
-
|
|
500
|
-
}, [
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
}, [
|
|
504
|
-
const
|
|
505
|
-
(
|
|
506
|
-
|
|
218
|
+
[T, b, t, V, R, A, e]
|
|
219
|
+
), oe = z(() => {
|
|
220
|
+
E.current === null && (P.current = null, E.current = window.requestAnimationFrame(K));
|
|
221
|
+
}, [K]);
|
|
222
|
+
re(() => () => {
|
|
223
|
+
X(), R();
|
|
224
|
+
}, [X, R]);
|
|
225
|
+
const te = z(
|
|
226
|
+
(l) => {
|
|
227
|
+
u.current = l, ie(l.active), l.active && l.direction !== 0 ? oe() : R();
|
|
507
228
|
},
|
|
508
|
-
[
|
|
229
|
+
[oe, R]
|
|
509
230
|
);
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
}, [
|
|
513
|
-
const
|
|
514
|
-
const
|
|
515
|
-
|
|
231
|
+
re(() => {
|
|
232
|
+
W || S();
|
|
233
|
+
}, [S, W]), re(() => {
|
|
234
|
+
const l = (L) => {
|
|
235
|
+
const B = L.detail?.paneId;
|
|
236
|
+
B && m && B !== m || S();
|
|
516
237
|
};
|
|
517
|
-
return window.addEventListener(
|
|
518
|
-
window.removeEventListener(
|
|
238
|
+
return window.addEventListener(Ee, l), () => {
|
|
239
|
+
window.removeEventListener(Ee, l);
|
|
519
240
|
};
|
|
520
|
-
}, [
|
|
521
|
-
if (!
|
|
241
|
+
}, [m, S]), re(() => {
|
|
242
|
+
if (!W)
|
|
522
243
|
return;
|
|
523
|
-
const
|
|
524
|
-
if (!
|
|
244
|
+
const l = (L) => {
|
|
245
|
+
if (!u.current.active)
|
|
525
246
|
return;
|
|
526
|
-
const
|
|
527
|
-
if (!(
|
|
528
|
-
|
|
247
|
+
const Z = L.target;
|
|
248
|
+
if (!(Z instanceof Node)) {
|
|
249
|
+
S();
|
|
529
250
|
return;
|
|
530
251
|
}
|
|
531
|
-
|
|
252
|
+
ee.current?.getElement()?.contains(Z) || S();
|
|
532
253
|
};
|
|
533
|
-
return document.addEventListener("pointerdown",
|
|
534
|
-
document.removeEventListener("pointerdown",
|
|
254
|
+
return document.addEventListener("pointerdown", l, !0), () => {
|
|
255
|
+
document.removeEventListener("pointerdown", l, !0);
|
|
535
256
|
};
|
|
536
|
-
}, [
|
|
537
|
-
const
|
|
538
|
-
if (!
|
|
257
|
+
}, [S, W]);
|
|
258
|
+
const a = (l) => {
|
|
259
|
+
if (!V || _ <= 0 || b <= 0)
|
|
539
260
|
return 0;
|
|
540
|
-
const
|
|
541
|
-
return
|
|
542
|
-
},
|
|
543
|
-
if (!
|
|
261
|
+
const L = C(l, 0, _);
|
|
262
|
+
return C(L / _ * b, 0, b);
|
|
263
|
+
}, G = (l) => {
|
|
264
|
+
if (!V || b <= 0)
|
|
544
265
|
return;
|
|
545
|
-
const
|
|
546
|
-
|
|
547
|
-
},
|
|
548
|
-
|
|
549
|
-
},
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
},
|
|
554
|
-
},
|
|
555
|
-
}, ue = (
|
|
556
|
-
(
|
|
557
|
-
},
|
|
558
|
-
if (!
|
|
266
|
+
const L = Math.max(Math.round(e / Ue), He), Z = Y.current, B = C(Z + l * L, 0, b);
|
|
267
|
+
B !== Z && (Y.current = B, t?.(B, Z));
|
|
268
|
+
}, U = () => {
|
|
269
|
+
X();
|
|
270
|
+
}, ne = (l) => (L) => {
|
|
271
|
+
V && (L.preventDefault(), L.stopPropagation(), S(), X(), G(l), D.current = window.setTimeout(() => {
|
|
272
|
+
Q.current = window.setInterval(() => {
|
|
273
|
+
G(l);
|
|
274
|
+
}, Ye);
|
|
275
|
+
}, Oe));
|
|
276
|
+
}, ue = (l) => (L) => {
|
|
277
|
+
(L.key === "Enter" || L.key === " " || L.key === "Spacebar") && (L.preventDefault(), G(l));
|
|
278
|
+
}, me = (l) => {
|
|
279
|
+
if (!V || "button" in l && l.button !== 0 || l.ctrlKey)
|
|
559
280
|
return;
|
|
560
|
-
|
|
561
|
-
const
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
({ deltaX:
|
|
565
|
-
|
|
281
|
+
l.stopPropagation(), S();
|
|
282
|
+
const L = H;
|
|
283
|
+
y(!0), Ae(
|
|
284
|
+
l,
|
|
285
|
+
({ deltaX: Z, deltaY: B }) => {
|
|
286
|
+
t?.(a(L + (r ? Z : B)), H);
|
|
566
287
|
},
|
|
567
288
|
() => {
|
|
568
|
-
|
|
289
|
+
y(!1);
|
|
569
290
|
}
|
|
570
291
|
);
|
|
571
|
-
},
|
|
572
|
-
if (!
|
|
292
|
+
}, Pe = (l) => {
|
|
293
|
+
if (!V || "button" in l && l.button !== 0 || l.ctrlKey)
|
|
573
294
|
return;
|
|
574
|
-
const
|
|
575
|
-
|
|
576
|
-
const de =
|
|
577
|
-
|
|
578
|
-
|
|
295
|
+
const Z = "touches" in l.nativeEvent ? l.nativeEvent.touches[0] : l.nativeEvent, B = r ? Z.clientX : Z.clientY, pe = l.currentTarget.getBoundingClientRect(), Te = r ? B - pe.left : B - pe.top;
|
|
296
|
+
S();
|
|
297
|
+
const de = Te - v / 2;
|
|
298
|
+
t?.(a(de), H), Ae(l, ({ deltaX: be, deltaY: we }) => {
|
|
299
|
+
t?.(a(de + (r ? be : we)), H);
|
|
579
300
|
});
|
|
580
|
-
},
|
|
581
|
-
const
|
|
301
|
+
}, Ce = O(() => C((w ? 1 : 0.8) * x, 0, 1), [w, x]), Ne = O(() => {
|
|
302
|
+
const L = `calc(50% - ${q / 2}px + ${i}px)`;
|
|
582
303
|
return {
|
|
583
304
|
left: se,
|
|
584
|
-
top:
|
|
305
|
+
top: L
|
|
585
306
|
};
|
|
586
|
-
}, [se,
|
|
587
|
-
return /* @__PURE__ */
|
|
307
|
+
}, [se, i, q]);
|
|
308
|
+
return /* @__PURE__ */ xe(
|
|
588
309
|
"div",
|
|
589
310
|
{
|
|
590
|
-
className:
|
|
311
|
+
className: he(
|
|
591
312
|
"group relative cursor-default select-none",
|
|
592
|
-
|
|
593
|
-
|
|
313
|
+
r ? "flex flex-row items-stretch" : "flex flex-col items-stretch",
|
|
314
|
+
s
|
|
594
315
|
),
|
|
595
316
|
style: {
|
|
596
|
-
[
|
|
597
|
-
[
|
|
317
|
+
[r ? "width" : "height"]: e,
|
|
318
|
+
[r ? "height" : "width"]: o,
|
|
598
319
|
backgroundColor: "white",
|
|
599
320
|
userSelect: "none",
|
|
600
321
|
position: "relative"
|
|
601
322
|
},
|
|
602
323
|
role: "scrollbar",
|
|
603
324
|
tabIndex: -1,
|
|
604
|
-
"aria-controls":
|
|
325
|
+
"aria-controls": m,
|
|
605
326
|
"aria-valuenow": n,
|
|
606
327
|
"aria-valuemin": 0,
|
|
607
|
-
"aria-valuemax":
|
|
608
|
-
"aria-orientation":
|
|
328
|
+
"aria-valuemax": b,
|
|
329
|
+
"aria-orientation": r ? "horizontal" : "vertical",
|
|
609
330
|
children: [
|
|
610
|
-
!
|
|
611
|
-
|
|
331
|
+
!r && V && W && /* @__PURE__ */ j(
|
|
332
|
+
Re,
|
|
612
333
|
{
|
|
613
|
-
ref:
|
|
614
|
-
className:
|
|
334
|
+
ref: ee,
|
|
335
|
+
className: he(
|
|
615
336
|
"pointer-events-auto absolute transition-opacity duration-150",
|
|
616
|
-
|
|
337
|
+
$
|
|
617
338
|
),
|
|
618
|
-
size:
|
|
619
|
-
maxVisualDistance:
|
|
620
|
-
style:
|
|
621
|
-
opacity:
|
|
622
|
-
onDragChange:
|
|
339
|
+
size: q,
|
|
340
|
+
maxVisualDistance: T,
|
|
341
|
+
style: Ne,
|
|
342
|
+
opacity: Ce,
|
|
343
|
+
onDragChange: te
|
|
623
344
|
}
|
|
624
345
|
),
|
|
625
|
-
/* @__PURE__ */
|
|
346
|
+
/* @__PURE__ */ j(
|
|
626
347
|
"button",
|
|
627
348
|
{
|
|
628
349
|
type: "button",
|
|
629
350
|
className: "flex items-center justify-center text-xs text-[#313131] transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-[#60a5fa] focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50",
|
|
630
351
|
style: {
|
|
631
|
-
[
|
|
632
|
-
[
|
|
352
|
+
[r ? "width" : "height"]: h,
|
|
353
|
+
[r ? "height" : "width"]: o,
|
|
633
354
|
backgroundColor: "#E0E0E0"
|
|
634
355
|
},
|
|
635
|
-
"aria-label":
|
|
636
|
-
onMouseDown:
|
|
637
|
-
onTouchStart:
|
|
638
|
-
onMouseUp:
|
|
639
|
-
onMouseLeave:
|
|
640
|
-
onTouchEnd:
|
|
641
|
-
onTouchCancel:
|
|
356
|
+
"aria-label": r ? "Scroll left" : "Scroll up",
|
|
357
|
+
onMouseDown: ne(-1),
|
|
358
|
+
onTouchStart: ne(-1),
|
|
359
|
+
onMouseUp: U,
|
|
360
|
+
onMouseLeave: U,
|
|
361
|
+
onTouchEnd: U,
|
|
362
|
+
onTouchCancel: U,
|
|
642
363
|
onKeyDown: ue(-1),
|
|
643
|
-
disabled: !
|
|
644
|
-
children: /* @__PURE__ */
|
|
364
|
+
disabled: !V,
|
|
365
|
+
children: /* @__PURE__ */ j("span", { "aria-hidden": "true", children: r ? "◀" : "▲" })
|
|
645
366
|
}
|
|
646
367
|
),
|
|
647
|
-
/* @__PURE__ */
|
|
368
|
+
/* @__PURE__ */ j(
|
|
648
369
|
"div",
|
|
649
370
|
{
|
|
650
371
|
className: "relative flex-1",
|
|
651
372
|
style: {
|
|
652
373
|
backgroundColor: "#F5F5F5",
|
|
653
|
-
borderRadius:
|
|
374
|
+
borderRadius: o / 2
|
|
654
375
|
},
|
|
655
|
-
onMouseDown:
|
|
656
|
-
onTouchStart:
|
|
376
|
+
onMouseDown: Pe,
|
|
377
|
+
onTouchStart: Pe,
|
|
657
378
|
children: c > e && // スクロールバーのつまみの当たり判定を広げるためのラッパー
|
|
658
|
-
/* @__PURE__ */
|
|
379
|
+
/* @__PURE__ */ j(
|
|
659
380
|
"div",
|
|
660
381
|
{
|
|
661
382
|
className: "group absolute",
|
|
662
383
|
style: {
|
|
663
|
-
[
|
|
664
|
-
[
|
|
665
|
-
...
|
|
384
|
+
[r ? "width" : "height"]: v,
|
|
385
|
+
[r ? "left" : "top"]: H,
|
|
386
|
+
...r ? { top: 0, bottom: 0 } : { left: 0, right: 0 }
|
|
666
387
|
},
|
|
667
|
-
onMouseDown:
|
|
668
|
-
onTouchStart:
|
|
388
|
+
onMouseDown: me,
|
|
389
|
+
onTouchStart: me,
|
|
669
390
|
role: "slider",
|
|
670
|
-
"aria-orientation":
|
|
391
|
+
"aria-orientation": r ? "horizontal" : "vertical",
|
|
671
392
|
"aria-valuenow": n,
|
|
672
393
|
"aria-valuemin": 0,
|
|
673
|
-
"aria-valuemax":
|
|
394
|
+
"aria-valuemax": b,
|
|
674
395
|
tabIndex: 0,
|
|
675
|
-
children: /* @__PURE__ */
|
|
396
|
+
children: /* @__PURE__ */ j(
|
|
676
397
|
"div",
|
|
677
398
|
{
|
|
678
|
-
ref:
|
|
679
|
-
className:
|
|
399
|
+
ref: ae,
|
|
400
|
+
className: he(
|
|
680
401
|
"absolute",
|
|
681
|
-
|
|
402
|
+
r ? `inset-x-0 inset-y-[1.5px] group-hover:inset-y-[-0.5px] ${g ? "inset-y-[-2px]" : "group-active:inset-y-[-2px]"}` : `inset-x-[1.5px] inset-y-0 group-hover:inset-x-[-0.5px] ${g ? "inset-x-[-2px]" : "group-active:inset-x-[-2px]"}`
|
|
682
403
|
),
|
|
683
404
|
style: {
|
|
684
405
|
backgroundColor: "#7F7F7F",
|
|
685
|
-
borderRadius:
|
|
686
|
-
...
|
|
406
|
+
borderRadius: o - 1,
|
|
407
|
+
...r ? {
|
|
687
408
|
left: 0,
|
|
688
409
|
right: 0,
|
|
689
|
-
top:
|
|
690
|
-
bottom:
|
|
410
|
+
top: g ? -2 : 1.5,
|
|
411
|
+
bottom: g ? -2 : 1.5
|
|
691
412
|
} : {
|
|
692
413
|
top: 0,
|
|
693
414
|
bottom: 0,
|
|
694
|
-
left:
|
|
695
|
-
right:
|
|
415
|
+
left: g ? -2 : 1.5,
|
|
416
|
+
right: g ? -2 : 1.5
|
|
696
417
|
}
|
|
697
418
|
},
|
|
698
|
-
onMouseEnter: (
|
|
699
|
-
|
|
419
|
+
onMouseEnter: (l) => {
|
|
420
|
+
r ? (l.currentTarget.style.top = "-0.5px", l.currentTarget.style.bottom = "-0.5px") : (l.currentTarget.style.left = "-0.5px", l.currentTarget.style.right = "-0.5px"), g || (l.currentTarget.style.backgroundColor = "#5F5F5F");
|
|
700
421
|
},
|
|
701
|
-
onMouseLeave: (
|
|
702
|
-
|
|
422
|
+
onMouseLeave: (l) => {
|
|
423
|
+
r ? (l.currentTarget.style.top = g ? "-2px" : "1.5px", l.currentTarget.style.bottom = g ? "-2px" : "1.5px") : (l.currentTarget.style.left = g ? "-2px" : "1.5px", l.currentTarget.style.right = g ? "-2px" : "1.5px"), g || (l.currentTarget.style.backgroundColor = "#7F7F7F");
|
|
703
424
|
}
|
|
704
425
|
}
|
|
705
426
|
)
|
|
@@ -707,209 +428,209 @@ const De = (c, e, n) => {
|
|
|
707
428
|
)
|
|
708
429
|
}
|
|
709
430
|
),
|
|
710
|
-
/* @__PURE__ */
|
|
431
|
+
/* @__PURE__ */ j(
|
|
711
432
|
"button",
|
|
712
433
|
{
|
|
713
434
|
type: "button",
|
|
714
435
|
className: "flex items-center justify-center text-xs text-[#313131] transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-[#60a5fa] focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50",
|
|
715
436
|
style: {
|
|
716
|
-
[
|
|
717
|
-
[
|
|
437
|
+
[r ? "width" : "height"]: h,
|
|
438
|
+
[r ? "height" : "width"]: o,
|
|
718
439
|
backgroundColor: "#E0E0E0"
|
|
719
440
|
},
|
|
720
|
-
"aria-label":
|
|
721
|
-
onMouseDown:
|
|
722
|
-
onTouchStart:
|
|
723
|
-
onMouseUp:
|
|
724
|
-
onMouseLeave:
|
|
725
|
-
onTouchEnd:
|
|
726
|
-
onTouchCancel:
|
|
441
|
+
"aria-label": r ? "Scroll right" : "Scroll down",
|
|
442
|
+
onMouseDown: ne(1),
|
|
443
|
+
onTouchStart: ne(1),
|
|
444
|
+
onMouseUp: U,
|
|
445
|
+
onMouseLeave: U,
|
|
446
|
+
onTouchEnd: U,
|
|
447
|
+
onTouchCancel: U,
|
|
727
448
|
onKeyDown: ue(1),
|
|
728
|
-
disabled: !
|
|
729
|
-
children: /* @__PURE__ */
|
|
449
|
+
disabled: !V,
|
|
450
|
+
children: /* @__PURE__ */ j("span", { "aria-hidden": "true", children: r ? "▶" : "▼" })
|
|
730
451
|
}
|
|
731
452
|
)
|
|
732
453
|
]
|
|
733
454
|
}
|
|
734
455
|
);
|
|
735
|
-
},
|
|
456
|
+
}, fe = {
|
|
736
457
|
maxVelocity: 6,
|
|
737
458
|
minVelocity: 0.02,
|
|
738
459
|
deceleration: 25e-4,
|
|
739
460
|
velocitySampleWindow: 90,
|
|
740
461
|
startVelocityThreshold: 0.04
|
|
741
|
-
},
|
|
742
|
-
const
|
|
462
|
+
}, Be = Ve(({ children: c, contentSize: e, viewportSize: n, scrollBarWidth: t = 12, onScroll: r, className: o, style: s, background: m, tapScrollCircleOptions: d, inertiaOptions: f, itemCount: g }, y) => {
|
|
463
|
+
const w = N(0), [ie, ae] = ze((i) => i + 1, 0), Y = N(null), Q = N(null), D = N({
|
|
743
464
|
frame: null,
|
|
744
465
|
velocity: 0,
|
|
745
466
|
lastTimestamp: null
|
|
746
|
-
}),
|
|
467
|
+
}), u = O(
|
|
747
468
|
() => ({
|
|
748
|
-
maxVelocity:
|
|
749
|
-
minVelocity:
|
|
750
|
-
deceleration:
|
|
751
|
-
velocitySampleWindow:
|
|
752
|
-
startVelocityThreshold:
|
|
469
|
+
maxVelocity: f?.maxVelocity ?? fe.maxVelocity,
|
|
470
|
+
minVelocity: f?.minVelocity ?? fe.minVelocity,
|
|
471
|
+
deceleration: f?.deceleration ?? fe.deceleration,
|
|
472
|
+
velocitySampleWindow: f?.velocitySampleWindow ?? fe.velocitySampleWindow,
|
|
473
|
+
startVelocityThreshold: f?.startVelocityThreshold ?? fe.startVelocityThreshold
|
|
753
474
|
}),
|
|
754
|
-
[
|
|
475
|
+
[f]
|
|
755
476
|
);
|
|
756
|
-
|
|
757
|
-
const
|
|
758
|
-
(
|
|
759
|
-
const { contentSize:
|
|
760
|
-
if (
|
|
761
|
-
|
|
477
|
+
J.debug("[ScrollPane] ScrollPane rendered", { contentSize: e, viewportSize: n, scrollBarWidth: t, className: o, style: s, tapScrollCircleOptions: d, inertiaOptions: f });
|
|
478
|
+
const ee = N({ contentSize: e, viewportSize: n }), E = O(() => e > n, [e, n]), P = z(
|
|
479
|
+
(i) => {
|
|
480
|
+
const { contentSize: $, viewportSize: k } = ee.current, A = $ > k, x = w.current;
|
|
481
|
+
if (J.debug("[ScrollPane] scrollTo called", { newPosition: i, contentSize: $, viewportSize: k, currentIsScrollable: A, prevPosition: x }), !A) {
|
|
482
|
+
w.current !== 0 && (w.current = 0, r?.(0, x));
|
|
762
483
|
return;
|
|
763
484
|
}
|
|
764
|
-
const
|
|
765
|
-
|
|
485
|
+
const T = typeof i == "function" ? i(w.current) : i, M = C(T, 0, $ - k);
|
|
486
|
+
w.current !== M && (w.current = M, r?.(M, x));
|
|
766
487
|
},
|
|
767
|
-
[
|
|
768
|
-
),
|
|
769
|
-
const
|
|
770
|
-
|
|
771
|
-
}, []),
|
|
772
|
-
(
|
|
773
|
-
if (!
|
|
488
|
+
[r]
|
|
489
|
+
), F = z(() => {
|
|
490
|
+
const i = D.current;
|
|
491
|
+
i.frame !== null && cancelAnimationFrame(i.frame), i.frame = null, i.velocity = 0, i.lastTimestamp = null;
|
|
492
|
+
}, []), W = z(
|
|
493
|
+
(i) => {
|
|
494
|
+
if (!E)
|
|
774
495
|
return;
|
|
775
|
-
const { maxVelocity:
|
|
776
|
-
if (Math.abs(
|
|
496
|
+
const { maxVelocity: $, minVelocity: k, deceleration: A, startVelocityThreshold: x } = u, T = C(i, -$, $);
|
|
497
|
+
if (Math.abs(T) < x)
|
|
777
498
|
return;
|
|
778
|
-
|
|
499
|
+
F(), D.current.velocity = T, D.current.lastTimestamp = null;
|
|
779
500
|
const M = (h) => {
|
|
780
|
-
const
|
|
781
|
-
if (
|
|
782
|
-
|
|
501
|
+
const p = D.current;
|
|
502
|
+
if (p.lastTimestamp === null) {
|
|
503
|
+
p.lastTimestamp = h, p.frame = requestAnimationFrame(M);
|
|
783
504
|
return;
|
|
784
505
|
}
|
|
785
|
-
const I = h -
|
|
786
|
-
if (
|
|
787
|
-
|
|
506
|
+
const I = h - p.lastTimestamp;
|
|
507
|
+
if (p.lastTimestamp = h, I <= 0) {
|
|
508
|
+
p.frame = requestAnimationFrame(M);
|
|
788
509
|
return;
|
|
789
510
|
}
|
|
790
|
-
const
|
|
791
|
-
let
|
|
792
|
-
const
|
|
793
|
-
|
|
794
|
-
const
|
|
795
|
-
|
|
796
|
-
const
|
|
797
|
-
|
|
798
|
-
const
|
|
799
|
-
if (Math.abs(
|
|
800
|
-
|
|
511
|
+
const v = p.velocity;
|
|
512
|
+
let b = v;
|
|
513
|
+
const _ = A * I;
|
|
514
|
+
v > 0 ? b = Math.max(0, v - _) : v < 0 && (b = Math.min(0, v + _));
|
|
515
|
+
const V = (v + b) / 2 * I, X = w.current;
|
|
516
|
+
V !== 0 && P((a) => a + V);
|
|
517
|
+
const R = w.current, { contentSize: S, viewportSize: K } = ee.current, oe = Math.max(S - K, 0);
|
|
518
|
+
p.velocity = b;
|
|
519
|
+
const te = R === X || R <= 0 && b <= 0 || R >= oe && b >= 0;
|
|
520
|
+
if (Math.abs(b) < k || te) {
|
|
521
|
+
F();
|
|
801
522
|
return;
|
|
802
523
|
}
|
|
803
|
-
|
|
524
|
+
p.frame = requestAnimationFrame(M);
|
|
804
525
|
};
|
|
805
|
-
|
|
526
|
+
D.current.frame = requestAnimationFrame(M);
|
|
806
527
|
},
|
|
807
|
-
[
|
|
528
|
+
[E, u, P, F]
|
|
808
529
|
);
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
}, [e, n]),
|
|
812
|
-
if (
|
|
813
|
-
|
|
814
|
-
const
|
|
815
|
-
|
|
530
|
+
ve(() => {
|
|
531
|
+
ee.current = { contentSize: e, viewportSize: n };
|
|
532
|
+
}, [e, n]), ve(() => {
|
|
533
|
+
if (E) {
|
|
534
|
+
J.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", { contentSize: e, viewportSize: n, scrollPosition: w.current });
|
|
535
|
+
const i = C(e - n, 0, e);
|
|
536
|
+
w.current > i && P(i);
|
|
816
537
|
} else
|
|
817
|
-
|
|
818
|
-
}, [
|
|
819
|
-
const
|
|
820
|
-
if (!
|
|
538
|
+
P(0);
|
|
539
|
+
}, [E, P, e, n]), re(() => {
|
|
540
|
+
const i = (k) => {
|
|
541
|
+
if (!E)
|
|
821
542
|
return;
|
|
822
|
-
|
|
823
|
-
let
|
|
824
|
-
|
|
825
|
-
},
|
|
826
|
-
return
|
|
827
|
-
|
|
543
|
+
k.preventDefault(), F();
|
|
544
|
+
let A = k.deltaY;
|
|
545
|
+
k.deltaMode === 1 ? A *= 16 : k.deltaMode === 2 && (A *= n), J.debug("[ScrollPane] wheel event", { deltaY: A, scrollPosition: w.current }), P((x) => x + A);
|
|
546
|
+
}, $ = Y.current;
|
|
547
|
+
return $ && $.addEventListener("wheel", i, { passive: !1 }), () => {
|
|
548
|
+
$ && $.removeEventListener("wheel", i);
|
|
828
549
|
};
|
|
829
|
-
}, [
|
|
830
|
-
|
|
550
|
+
}, [E, P, F, n]), Me(
|
|
551
|
+
y,
|
|
831
552
|
() => ({
|
|
832
|
-
scrollTo:
|
|
833
|
-
getScrollPosition: () =>
|
|
553
|
+
scrollTo: P,
|
|
554
|
+
getScrollPosition: () => w.current,
|
|
834
555
|
getContentSize: () => e,
|
|
835
556
|
getViewportSize: () => n
|
|
836
557
|
}),
|
|
837
|
-
[
|
|
558
|
+
[P, e, n]
|
|
838
559
|
);
|
|
839
|
-
const
|
|
840
|
-
/* @__PURE__ */
|
|
841
|
-
|
|
842
|
-
c(
|
|
560
|
+
const q = ke(), se = O(() => /* @__PURE__ */ xe("div", { ref: Y, className: he("flex", o), style: s, children: [
|
|
561
|
+
/* @__PURE__ */ xe("div", { ref: Q, className: "relative h-full flex-1 overflow-hidden", style: { height: n, touchAction: "none" }, id: q, children: [
|
|
562
|
+
m,
|
|
563
|
+
c(w.current)
|
|
843
564
|
] }),
|
|
844
|
-
|
|
845
|
-
|
|
565
|
+
E && /* @__PURE__ */ j(
|
|
566
|
+
Ke,
|
|
846
567
|
{
|
|
847
568
|
contentSize: e,
|
|
848
569
|
viewportSize: n,
|
|
849
|
-
scrollPosition:
|
|
850
|
-
onScroll:
|
|
851
|
-
scrollBarWidth:
|
|
852
|
-
ariaControls:
|
|
853
|
-
tapScrollCircleOptions:
|
|
854
|
-
itemCount:
|
|
570
|
+
scrollPosition: w.current,
|
|
571
|
+
onScroll: P,
|
|
572
|
+
scrollBarWidth: t,
|
|
573
|
+
ariaControls: q,
|
|
574
|
+
tapScrollCircleOptions: d,
|
|
575
|
+
itemCount: g
|
|
855
576
|
}
|
|
856
577
|
)
|
|
857
|
-
] }), [c, e, n,
|
|
858
|
-
return
|
|
859
|
-
const
|
|
860
|
-
if (!
|
|
578
|
+
] }), [c, e, n, t, o, s, E, P, q, m, d, g]);
|
|
579
|
+
return re(() => {
|
|
580
|
+
const i = Q.current;
|
|
581
|
+
if (!i)
|
|
861
582
|
return;
|
|
862
|
-
const
|
|
863
|
-
let
|
|
864
|
-
const
|
|
865
|
-
|
|
866
|
-
},
|
|
867
|
-
const
|
|
868
|
-
|
|
869
|
-
},
|
|
870
|
-
|
|
871
|
-
},
|
|
872
|
-
M || (M = !0, h = !1,
|
|
873
|
-
},
|
|
874
|
-
if (
|
|
583
|
+
const $ = 6, k = "input, textarea, select, button, a[href], [role='button']";
|
|
584
|
+
let A = null, x = 0, T = 0, M = !1, h = !1, p = !1, I = null, v = [];
|
|
585
|
+
const b = () => {
|
|
586
|
+
A = null, x = 0, T = 0, M = !1, h = !1, v = [];
|
|
587
|
+
}, _ = (a) => {
|
|
588
|
+
const G = performance.now();
|
|
589
|
+
v.push({ clientY: a, time: G }), v = v.filter((U) => G - U.time <= u.velocitySampleWindow);
|
|
590
|
+
}, H = (a) => a instanceof HTMLElement ? a.closest("[data-scrollpane-ignore-drag='true']") !== null : !1, V = (a) => a instanceof HTMLElement ? a.closest(k) !== null : !1, X = (a) => {
|
|
591
|
+
p && (a.preventDefault(), a.stopPropagation(), p = !1);
|
|
592
|
+
}, R = (a) => {
|
|
593
|
+
M || (M = !0, h = !1, p = !0, i.hasPointerCapture(a.pointerId) || i.setPointerCapture(a.pointerId), _(a.clientY));
|
|
594
|
+
}, S = (a) => {
|
|
595
|
+
if (A !== a.pointerId)
|
|
875
596
|
return;
|
|
876
597
|
if (!M) {
|
|
877
|
-
const
|
|
878
|
-
if (h &&
|
|
598
|
+
const ne = Math.abs(a.clientY - x);
|
|
599
|
+
if (h && ne < $)
|
|
879
600
|
return;
|
|
880
|
-
|
|
601
|
+
R(a);
|
|
881
602
|
}
|
|
882
603
|
if (!M)
|
|
883
604
|
return;
|
|
884
|
-
|
|
885
|
-
const
|
|
886
|
-
|
|
887
|
-
},
|
|
888
|
-
if (
|
|
605
|
+
_(a.clientY);
|
|
606
|
+
const G = a.clientY - x, U = T - G;
|
|
607
|
+
P(U), a.cancelable && a.preventDefault();
|
|
608
|
+
}, K = (a) => {
|
|
609
|
+
if (A !== a.pointerId)
|
|
889
610
|
return;
|
|
890
|
-
M &&
|
|
891
|
-
let
|
|
892
|
-
if (M &&
|
|
893
|
-
const
|
|
894
|
-
if (
|
|
895
|
-
const ue =
|
|
896
|
-
|
|
611
|
+
M && p && a.cancelable && (a.preventDefault(), a.stopPropagation()), i.hasPointerCapture(a.pointerId) && i.releasePointerCapture(a.pointerId);
|
|
612
|
+
let G = 0;
|
|
613
|
+
if (M && v.length >= 2) {
|
|
614
|
+
const U = v[v.length - 1], ne = v.find((ue) => U.time - ue.time <= u.velocitySampleWindow) ?? v[0];
|
|
615
|
+
if (U && ne && U.time !== ne.time) {
|
|
616
|
+
const ue = U.clientY - ne.clientY, me = U.time - ne.time;
|
|
617
|
+
G = -(ue / me);
|
|
897
618
|
}
|
|
898
619
|
}
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
}, 0)), Math.abs(
|
|
902
|
-
},
|
|
903
|
-
|
|
904
|
-
},
|
|
905
|
-
|
|
620
|
+
b(), I !== null && window.clearTimeout(I), p && (I = window.setTimeout(() => {
|
|
621
|
+
p = !1, I = null;
|
|
622
|
+
}, 0)), Math.abs(G) >= u.startVelocityThreshold && W(G);
|
|
623
|
+
}, oe = (a) => {
|
|
624
|
+
E && (a.button !== 0 && a.pointerType === "mouse" || a.ctrlKey || a.metaKey || a.altKey || H(a.target) || (window.dispatchEvent(new CustomEvent(Ee, { detail: { paneId: q } })), F(), A = a.pointerId, x = a.clientY, T = w.current, h = V(a.target), M = !1, p = !1, v = [], h || (p = !0, R(a), _(a.clientY), a.cancelable && a.preventDefault())));
|
|
625
|
+
}, te = (a) => {
|
|
626
|
+
A === a.pointerId && (p = !1, i.hasPointerCapture(a.pointerId) && i.releasePointerCapture(a.pointerId), I !== null && (window.clearTimeout(I), I = null), b());
|
|
906
627
|
};
|
|
907
|
-
return
|
|
908
|
-
|
|
628
|
+
return i.addEventListener("click", X, !0), i.addEventListener("pointerdown", oe, { passive: !1 }), i.addEventListener("pointermove", S, { passive: !1 }), i.addEventListener("pointerup", K), i.addEventListener("pointercancel", te), window.addEventListener("pointermove", S, { passive: !1 }), window.addEventListener("pointerup", K), window.addEventListener("pointercancel", te), () => {
|
|
629
|
+
i.removeEventListener("click", X, !0), i.removeEventListener("pointerdown", oe), i.removeEventListener("pointermove", S), i.removeEventListener("pointerup", K), i.removeEventListener("pointercancel", te), window.removeEventListener("pointermove", S), window.removeEventListener("pointerup", K), window.removeEventListener("pointercancel", te), A !== null && i.hasPointerCapture(A) && i.releasePointerCapture(A), I !== null && window.clearTimeout(I), F();
|
|
909
630
|
};
|
|
910
|
-
}, [
|
|
631
|
+
}, [q, E, u, P, W, F]), se;
|
|
911
632
|
});
|
|
912
|
-
class
|
|
633
|
+
class We {
|
|
913
634
|
/**
|
|
914
635
|
* @private
|
|
915
636
|
* @property {Map<number, number>} tree - The Map storing the Fenwick tree structure, specifically the sums of deltas. It is 1-indexed.
|
|
@@ -949,8 +670,8 @@ class st {
|
|
|
949
670
|
* @param {number | ((index: number) => number)} valueOrFn - The value for all elements, or a function to generate values.
|
|
950
671
|
* @param {{ sampleRange?: { from: number; to: number }, materialize?: boolean }} [options] - Optional settings for initialization.
|
|
951
672
|
*/
|
|
952
|
-
constructor(e, n,
|
|
953
|
-
this.reset(e, n,
|
|
673
|
+
constructor(e, n, t) {
|
|
674
|
+
this.reset(e, n, t);
|
|
954
675
|
}
|
|
955
676
|
/**
|
|
956
677
|
* @method reset
|
|
@@ -960,20 +681,20 @@ class st {
|
|
|
960
681
|
* @param {number | ((index: number) => number)} valueOrFn - The value for all elements, or a function to generate values.
|
|
961
682
|
* @param {{ sampleRange?: { from: number; to: number }, materialize?: boolean }} [options] - Optional settings for initialization.
|
|
962
683
|
*/
|
|
963
|
-
reset(e, n,
|
|
684
|
+
reset(e, n, t) {
|
|
964
685
|
if (this.size = e, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.total = void 0, typeof n == "function") {
|
|
965
686
|
if (this.valueFn = n, this.size > 0) {
|
|
966
|
-
const
|
|
687
|
+
const o = t?.sampleRange ?? {
|
|
967
688
|
from: 0,
|
|
968
689
|
to: Math.min(99, this.size - 1)
|
|
969
|
-
}, { mode:
|
|
970
|
-
if (this.baseValue =
|
|
971
|
-
for (let
|
|
972
|
-
const
|
|
973
|
-
if (
|
|
690
|
+
}, { mode: s, materializedValues: m } = this._calculateMode(o.from, o.to);
|
|
691
|
+
if (this.baseValue = s, t?.materialize)
|
|
692
|
+
for (let d = 0; d < m.length; d++) {
|
|
693
|
+
const f = m[d], g = o.from + d;
|
|
694
|
+
if (g >= this.size)
|
|
974
695
|
break;
|
|
975
|
-
const
|
|
976
|
-
this.deltas.set(
|
|
696
|
+
const y = f - this.baseValue;
|
|
697
|
+
this.deltas.set(g, y), this._updateTree(g, y);
|
|
977
698
|
}
|
|
978
699
|
} else
|
|
979
700
|
this.baseValue = 0;
|
|
@@ -1002,30 +723,30 @@ class st {
|
|
|
1002
723
|
_calculateMode(e, n) {
|
|
1003
724
|
if (!this.valueFn)
|
|
1004
725
|
return { mode: 0, materializedValues: [] };
|
|
1005
|
-
const
|
|
1006
|
-
for (let
|
|
1007
|
-
|
|
1008
|
-
const
|
|
1009
|
-
if (
|
|
726
|
+
const t = [];
|
|
727
|
+
for (let f = e; f <= n && !(f >= this.size); f++)
|
|
728
|
+
t.push(this.valueFn(f));
|
|
729
|
+
const r = [...t];
|
|
730
|
+
if (t.length === 0)
|
|
1010
731
|
return { mode: 0, materializedValues: [] };
|
|
1011
|
-
|
|
1012
|
-
const
|
|
1013
|
-
let
|
|
1014
|
-
|
|
1015
|
-
const
|
|
1016
|
-
let
|
|
1017
|
-
for (const
|
|
1018
|
-
const
|
|
1019
|
-
|
|
732
|
+
t.sort((f, g) => f - g);
|
|
733
|
+
const o = Math.floor(t.length / 2);
|
|
734
|
+
let s;
|
|
735
|
+
t.length % 2 === 0 ? s = Math.floor((t[o - 1] + t[o]) / 2) : s = t[o];
|
|
736
|
+
const m = /* @__PURE__ */ new Map();
|
|
737
|
+
let d = 0;
|
|
738
|
+
for (const f of t) {
|
|
739
|
+
const g = (m.get(f) ?? 0) + 1;
|
|
740
|
+
m.set(f, g), g > d && (d = g);
|
|
1020
741
|
}
|
|
1021
|
-
if (
|
|
1022
|
-
const
|
|
1023
|
-
for (const [
|
|
1024
|
-
|
|
1025
|
-
const
|
|
1026
|
-
|
|
742
|
+
if (d > 1) {
|
|
743
|
+
const f = [];
|
|
744
|
+
for (const [y, w] of m.entries())
|
|
745
|
+
w === d && f.push(y);
|
|
746
|
+
const g = f.reduce((y, w) => y + w, 0);
|
|
747
|
+
s = Math.floor(g / f.length);
|
|
1027
748
|
}
|
|
1028
|
-
return { mode:
|
|
749
|
+
return { mode: s, materializedValues: r };
|
|
1029
750
|
}
|
|
1030
751
|
/**
|
|
1031
752
|
* @method update
|
|
@@ -1044,14 +765,14 @@ class st {
|
|
|
1044
765
|
* @param {{ index: number; value: number }[]} updates - An array of updates, each with an index and the new value.
|
|
1045
766
|
*/
|
|
1046
767
|
updates(e) {
|
|
1047
|
-
const n = e.map(({ index:
|
|
1048
|
-
if (
|
|
1049
|
-
throw new Error(`Index ${
|
|
1050
|
-
if (
|
|
768
|
+
const n = e.map(({ index: t, value: r }) => {
|
|
769
|
+
if (t < 0 || t >= this.size)
|
|
770
|
+
throw new Error(`Index ${t} out of bounds`);
|
|
771
|
+
if (r < 0)
|
|
1051
772
|
throw new Error("Value cannot be negative.");
|
|
1052
|
-
const
|
|
1053
|
-
return { index:
|
|
1054
|
-
}).filter((
|
|
773
|
+
const o = this.deltas.has(t) ? (this.deltas.get(t) ?? 0) + this.baseValue : this.baseValue, s = r - o;
|
|
774
|
+
return { index: t, change: s };
|
|
775
|
+
}).filter((t) => t.change !== 0);
|
|
1055
776
|
return n.length > 0 ? this.updateDeltas(n) : this.total;
|
|
1056
777
|
}
|
|
1057
778
|
/**
|
|
@@ -1071,11 +792,11 @@ class st {
|
|
|
1071
792
|
* @param {{ index: number; change: number }[]} updates - An array of updates, each with an index and the change to apply.
|
|
1072
793
|
*/
|
|
1073
794
|
updateDeltas(e) {
|
|
1074
|
-
for (const { index: n, change:
|
|
795
|
+
for (const { index: n, change: t } of e) {
|
|
1075
796
|
if (n < 0 || n >= this.size)
|
|
1076
797
|
throw new Error(`Index ${n} out of bounds`);
|
|
1077
|
-
const
|
|
1078
|
-
this.deltas.set(n,
|
|
798
|
+
const r = this.deltas.get(n) ?? 0;
|
|
799
|
+
this.deltas.set(n, r + t), this._updateTree(n, t);
|
|
1079
800
|
}
|
|
1080
801
|
return this.total;
|
|
1081
802
|
}
|
|
@@ -1090,9 +811,9 @@ class st {
|
|
|
1090
811
|
_updateTree(e, n) {
|
|
1091
812
|
if (n === 0)
|
|
1092
813
|
return;
|
|
1093
|
-
let
|
|
1094
|
-
for (;
|
|
1095
|
-
this.tree.set(
|
|
814
|
+
let t = e + 1;
|
|
815
|
+
for (; t <= this.size; )
|
|
816
|
+
this.tree.set(t, (this.tree.get(t) ?? 0) + n), t += t & -t;
|
|
1096
817
|
this.total !== void 0 && (this.total += n);
|
|
1097
818
|
}
|
|
1098
819
|
/**
|
|
@@ -1105,10 +826,10 @@ class st {
|
|
|
1105
826
|
*/
|
|
1106
827
|
_materialize(e, n = !0) {
|
|
1107
828
|
if (this.valueFn) {
|
|
1108
|
-
const
|
|
1109
|
-
if (
|
|
1110
|
-
const
|
|
1111
|
-
this._updateTree(e,
|
|
829
|
+
const t = this.deltas.get(e) ?? 0, o = this.valueFn(e) - this.baseValue;
|
|
830
|
+
if (o !== t && (this.deltas.set(e, o), n)) {
|
|
831
|
+
const s = o - t;
|
|
832
|
+
this._updateTree(e, s);
|
|
1112
833
|
}
|
|
1113
834
|
}
|
|
1114
835
|
}
|
|
@@ -1128,23 +849,23 @@ class st {
|
|
|
1128
849
|
prefixSum(e, n) {
|
|
1129
850
|
if (e < 0)
|
|
1130
851
|
return { cumulative: 0, total: this.total, currentValue: 0, safeIndex: 0 };
|
|
1131
|
-
const
|
|
1132
|
-
if (
|
|
1133
|
-
if (
|
|
1134
|
-
for (const
|
|
1135
|
-
const
|
|
1136
|
-
for (let
|
|
1137
|
-
this._materialize(
|
|
852
|
+
const t = C(e, 0, this.size - 1), r = n?.materializeOption;
|
|
853
|
+
if (r?.materialize && this.valueFn) {
|
|
854
|
+
if (r.ranges)
|
|
855
|
+
for (const d of r.ranges) {
|
|
856
|
+
const f = d.from, g = Math.min(d.to, this.size - 1);
|
|
857
|
+
for (let y = f; y <= g; y++)
|
|
858
|
+
this._materialize(y);
|
|
1138
859
|
}
|
|
1139
|
-
this._materialize(
|
|
860
|
+
this._materialize(t);
|
|
1140
861
|
}
|
|
1141
|
-
let
|
|
1142
|
-
for (;
|
|
1143
|
-
const
|
|
1144
|
-
|
|
862
|
+
let o = 0, s = t + 1;
|
|
863
|
+
for (; s > 0; ) {
|
|
864
|
+
const d = this.tree.get(s) ?? 0;
|
|
865
|
+
o += d, s -= s & -s;
|
|
1145
866
|
}
|
|
1146
|
-
const
|
|
1147
|
-
return { cumulative:
|
|
867
|
+
const m = r?.materialize ? this.get(t) : (this.deltas.get(t) || 0) + this.baseValue;
|
|
868
|
+
return { cumulative: o + this.baseValue * (t + 1), total: this.total, currentValue: m, safeIndex: t };
|
|
1148
869
|
}
|
|
1149
870
|
/**
|
|
1150
871
|
* @method get
|
|
@@ -1162,15 +883,15 @@ class st {
|
|
|
1162
883
|
get(e, n) {
|
|
1163
884
|
if (e < 0 || e >= this.size)
|
|
1164
885
|
throw new Error("Index out of bounds");
|
|
1165
|
-
const
|
|
1166
|
-
if (
|
|
1167
|
-
if (
|
|
1168
|
-
for (const
|
|
1169
|
-
const
|
|
1170
|
-
for (let
|
|
1171
|
-
this._materialize(
|
|
886
|
+
const t = n?.materializeOption;
|
|
887
|
+
if (t?.materialize && this.valueFn)
|
|
888
|
+
if (t.ranges) {
|
|
889
|
+
for (const r of t.ranges) {
|
|
890
|
+
const o = r.from, s = Math.min(r.to, this.size - 1);
|
|
891
|
+
for (let m = o; m <= s; m++)
|
|
892
|
+
this._materialize(m);
|
|
1172
893
|
}
|
|
1173
|
-
e >=
|
|
894
|
+
e >= t.ranges[0].from && e <= t.ranges[t.ranges.length - 1].to && this._materialize(e);
|
|
1174
895
|
} else
|
|
1175
896
|
this._materialize(e);
|
|
1176
897
|
return (this.deltas.get(e) ?? 0) + this.baseValue;
|
|
@@ -1190,19 +911,19 @@ class st {
|
|
|
1190
911
|
getTotal(e) {
|
|
1191
912
|
const n = e?.materializeOption;
|
|
1192
913
|
if (n?.materialize && this.valueFn && n.ranges)
|
|
1193
|
-
for (const
|
|
1194
|
-
const
|
|
1195
|
-
for (let
|
|
1196
|
-
this._materialize(
|
|
914
|
+
for (const t of n.ranges) {
|
|
915
|
+
const r = t.from, o = Math.min(t.to, this.size - 1);
|
|
916
|
+
for (let s = r; s <= o; s++)
|
|
917
|
+
this._materialize(s);
|
|
1197
918
|
}
|
|
1198
919
|
if (this.total === void 0)
|
|
1199
920
|
if (this.size === 0)
|
|
1200
921
|
this.total = 0;
|
|
1201
922
|
else {
|
|
1202
|
-
let
|
|
1203
|
-
for (const
|
|
1204
|
-
|
|
1205
|
-
this.total =
|
|
923
|
+
let t = this.baseValue * this.size;
|
|
924
|
+
for (const r of this.deltas.values())
|
|
925
|
+
t += r;
|
|
926
|
+
this.total = t, console.assert(this.prefixSum(this.getSize() - 1).cumulative === this.prefixSum(this.getSize() - 1).total, "Inconsistent Fenwick Tree state");
|
|
1206
927
|
}
|
|
1207
928
|
return this.total;
|
|
1208
929
|
}
|
|
@@ -1215,20 +936,20 @@ class st {
|
|
|
1215
936
|
*/
|
|
1216
937
|
rebuildTree(e) {
|
|
1217
938
|
if (e?.materialize && this.valueFn) {
|
|
1218
|
-
const
|
|
1219
|
-
this.reset(this.size, (
|
|
939
|
+
const r = this.valueFn;
|
|
940
|
+
this.reset(this.size, (o) => r(o), { materialize: !0 });
|
|
1220
941
|
return;
|
|
1221
942
|
}
|
|
1222
943
|
const n = /* @__PURE__ */ new Map();
|
|
1223
|
-
let
|
|
1224
|
-
for (const [
|
|
1225
|
-
if (
|
|
944
|
+
let t = this.baseValue * this.size;
|
|
945
|
+
for (const [r, o] of this.deltas.entries()) {
|
|
946
|
+
if (t += o, o === 0)
|
|
1226
947
|
continue;
|
|
1227
|
-
let
|
|
1228
|
-
for (;
|
|
1229
|
-
n.set(
|
|
948
|
+
let s = r + 1;
|
|
949
|
+
for (; s <= this.size; )
|
|
950
|
+
n.set(s, (n.get(s) ?? 0) + o), s += s & -s;
|
|
1230
951
|
}
|
|
1231
|
-
this.tree = n, this.total =
|
|
952
|
+
this.tree = n, this.total = t;
|
|
1232
953
|
}
|
|
1233
954
|
/**
|
|
1234
955
|
* @method calculateAccumulatedError
|
|
@@ -1254,8 +975,8 @@ class st {
|
|
|
1254
975
|
const n = this.size;
|
|
1255
976
|
if (e !== n) {
|
|
1256
977
|
if (e < n)
|
|
1257
|
-
for (const
|
|
1258
|
-
|
|
978
|
+
for (const t of this.deltas.keys())
|
|
979
|
+
t >= e && this.deltas.delete(t);
|
|
1259
980
|
this.size = e, this.rebuildTree(), console.assert(this.prefixSum(this.getSize() - 1).cumulative === this.prefixSum(this.getSize() - 1).total, "Inconsistent Fenwick Tree state");
|
|
1260
981
|
}
|
|
1261
982
|
}
|
|
@@ -1284,12 +1005,12 @@ class st {
|
|
|
1284
1005
|
findIndexAtOrAfter(e, n) {
|
|
1285
1006
|
if (this.size === 0)
|
|
1286
1007
|
return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1287
|
-
let
|
|
1288
|
-
for (;
|
|
1289
|
-
const
|
|
1290
|
-
|
|
1008
|
+
let t = 0, r = this.size - 1, o = -1, s, m = this.total;
|
|
1009
|
+
for (; t <= r; ) {
|
|
1010
|
+
const d = Math.floor((t + r) / 2);
|
|
1011
|
+
s = this.prefixSum(d, n), m = s.total, s.cumulative >= e ? (o = d, r = d - 1) : t = d + 1;
|
|
1291
1012
|
}
|
|
1292
|
-
return { index:
|
|
1013
|
+
return { index: o, total: m, cumulative: s?.cumulative, currentValue: s?.currentValue, safeIndex: s?.safeIndex };
|
|
1293
1014
|
}
|
|
1294
1015
|
/**
|
|
1295
1016
|
* @method findIndexAtOrBefore
|
|
@@ -1307,163 +1028,163 @@ class st {
|
|
|
1307
1028
|
findIndexAtOrBefore(e, n) {
|
|
1308
1029
|
if (this.size === 0)
|
|
1309
1030
|
return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
|
|
1310
|
-
let
|
|
1311
|
-
for (;
|
|
1312
|
-
const
|
|
1313
|
-
|
|
1031
|
+
let t = 0, r = this.size - 1, o = -1, s, m = this.total;
|
|
1032
|
+
for (; t <= r; ) {
|
|
1033
|
+
const d = Math.floor((t + r) / 2);
|
|
1034
|
+
s = this.prefixSum(d, n), m = s.total, s.cumulative <= e ? (o = d, t = d + 1) : r = d - 1;
|
|
1314
1035
|
}
|
|
1315
|
-
return { index:
|
|
1036
|
+
return { index: o, total: m, cumulative: s?.cumulative, currentValue: s?.currentValue, safeIndex: s?.safeIndex };
|
|
1316
1037
|
}
|
|
1317
1038
|
}
|
|
1318
|
-
const
|
|
1319
|
-
const
|
|
1320
|
-
return Object.is(
|
|
1039
|
+
const Ge = (c, e, n) => {
|
|
1040
|
+
const t = Math.max(0, c), r = N(null), o = O(() => new We(t, e, n), [t, e, n]);
|
|
1041
|
+
return Object.is(r.current, o) || console.warn("[useFenwickMapTree] instance changed"), r.current = o, o;
|
|
1321
1042
|
};
|
|
1322
|
-
function
|
|
1323
|
-
const
|
|
1324
|
-
|
|
1325
|
-
|
|
1043
|
+
function Ze({ itemCount: c, getItem: e, getItemHeight: n, viewportSize: t, overscanCount: r = 5, className: o, onScroll: s, onRangeChange: m, children: d, background: f, initialScrollIndex: g, initialScrollOffset: y, tapScrollCircleOptions: w, inertiaOptions: ie }, ae) {
|
|
1044
|
+
const Y = N(null), Q = N(!1);
|
|
1045
|
+
re(() => (Q.current = !0, () => {
|
|
1046
|
+
Q.current = !1;
|
|
1326
1047
|
}), []);
|
|
1327
|
-
const
|
|
1328
|
-
let h = 0,
|
|
1329
|
-
if (typeof
|
|
1330
|
-
const I =
|
|
1331
|
-
h =
|
|
1332
|
-
} else typeof
|
|
1333
|
-
return { position: h, total:
|
|
1334
|
-
}), [
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
const h =
|
|
1338
|
-
|
|
1339
|
-
}, [
|
|
1340
|
-
|
|
1341
|
-
}, [
|
|
1342
|
-
const
|
|
1048
|
+
const D = N({ size: c, valueOrFn: n, options: { sampleRange: { from: 0, to: 100 } } }), u = Ge(D.current.size, D.current.valueOrFn, D.current.options), [ee] = le(() => {
|
|
1049
|
+
let h = 0, p = 0;
|
|
1050
|
+
if (typeof g == "number") {
|
|
1051
|
+
const I = C(g, 0, c - 1), v = C(I - r * 2, 0, c - 1), b = C(I + r * 2, 0, c - 1), _ = g > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: v, to: b }] } } : void 0, { cumulative: H, total: V, currentValue: X } = u.prefixSum(g, _);
|
|
1052
|
+
h = H - X, p = V ?? u.getTotal();
|
|
1053
|
+
} else typeof y == "number" && (h = y), p = u.getTotal();
|
|
1054
|
+
return { position: h, total: p };
|
|
1055
|
+
}), [E, P] = le(ee.position), [F, W] = le(ee.total), [q, se] = le(ee.position), [i, $] = le(c);
|
|
1056
|
+
ve(() => {
|
|
1057
|
+
u.setValueFn(n), i !== c && (u.changeSize(c), $(c));
|
|
1058
|
+
const h = u.getTotal();
|
|
1059
|
+
F !== h && W(h);
|
|
1060
|
+
}, [u, i, c, F, n]), ve(() => {
|
|
1061
|
+
q !== null && Y.current && (J.debug("[VirtualScroll] Scrolling to position:", q), Y.current.scrollTo(q), se(null));
|
|
1062
|
+
}, [q]);
|
|
1063
|
+
const k = z(
|
|
1343
1064
|
(h) => {
|
|
1344
|
-
if (
|
|
1345
|
-
|
|
1346
|
-
const
|
|
1347
|
-
|
|
1065
|
+
if (Y.current) {
|
|
1066
|
+
J.debug("[VirtualScroll] Scrolling to index:", h);
|
|
1067
|
+
const p = C(h, 0, i - 1), I = C(p - r * 2, 0, i - 1), v = C(p + r * 2, 0, i - 1), { cumulative: b, total: _, currentValue: H } = u.prefixSum(p, { materializeOption: { materialize: !0, ranges: [{ from: I, to: v }] } });
|
|
1068
|
+
J.debug("[VirtualScroll] Scrolling to index:", h, "Offset:", b, "Total height:", _, "Current value:", H, "safeIndex:", p, "safeIndexFrom:", I, "safeIndexTo:", v), _ && (W(_), se(b - H)), J.debug("[VirtualScroll] Setting scroll position to:", b - H);
|
|
1348
1069
|
}
|
|
1349
1070
|
},
|
|
1350
|
-
[
|
|
1351
|
-
),
|
|
1071
|
+
[u, r, i]
|
|
1072
|
+
), A = z(
|
|
1352
1073
|
(h) => {
|
|
1353
|
-
if (
|
|
1354
|
-
const
|
|
1355
|
-
|
|
1074
|
+
if (Y.current) {
|
|
1075
|
+
const p = u.getTotal(), I = C(Math.floor(h), 0, p), v = u.findIndexAtOrAfter(I, { materializeOption: { materialize: !1 } }).index;
|
|
1076
|
+
k(v);
|
|
1356
1077
|
}
|
|
1357
1078
|
},
|
|
1358
|
-
[
|
|
1359
|
-
),
|
|
1360
|
-
(h,
|
|
1361
|
-
|
|
1362
|
-
const I =
|
|
1363
|
-
|
|
1079
|
+
[u, k]
|
|
1080
|
+
), x = z(
|
|
1081
|
+
(h, p) => {
|
|
1082
|
+
J.debug("[VirtualScroll] Scroll position changed:", h), P(h);
|
|
1083
|
+
const I = u.getTotal();
|
|
1084
|
+
s?.(h, I);
|
|
1364
1085
|
},
|
|
1365
|
-
[
|
|
1366
|
-
),
|
|
1367
|
-
if (
|
|
1086
|
+
[u, s]
|
|
1087
|
+
), T = O(() => {
|
|
1088
|
+
if (i === 0)
|
|
1368
1089
|
return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
|
|
1369
|
-
const { index: h, cumulative:
|
|
1370
|
-
let
|
|
1371
|
-
h === -1 ?
|
|
1372
|
-
const
|
|
1373
|
-
let
|
|
1374
|
-
for (;
|
|
1375
|
-
const
|
|
1376
|
-
|
|
1090
|
+
const { index: h, cumulative: p, currentValue: I } = u.findIndexAtOrAfter(E, { materializeOption: { materialize: !1 } });
|
|
1091
|
+
let v = 0;
|
|
1092
|
+
h === -1 ? v = 0 : (p ?? 0) < E + (I ?? 0) ? v = 1 : v = 0;
|
|
1093
|
+
const b = h === -1 ? 0 : h + v, _ = C(b - r, 0, i - 1);
|
|
1094
|
+
let H = 0, V = h === -1 ? 0 : h + v;
|
|
1095
|
+
for (; V < i && H < t; ) {
|
|
1096
|
+
const R = n(V);
|
|
1097
|
+
H += R, V++;
|
|
1377
1098
|
}
|
|
1378
|
-
|
|
1379
|
-
const
|
|
1380
|
-
return
|
|
1381
|
-
renderingStartIndex:
|
|
1382
|
-
renderingEndIndex:
|
|
1383
|
-
visibleStartIndex:
|
|
1384
|
-
visibleEndIndex:
|
|
1385
|
-
scrollPosition:
|
|
1386
|
-
renderingContentSize:
|
|
1387
|
-
overscanCount:
|
|
1388
|
-
viewportSize:
|
|
1389
|
-
}), { renderingStartIndex:
|
|
1390
|
-
}, [
|
|
1391
|
-
|
|
1392
|
-
const h =
|
|
1393
|
-
|
|
1394
|
-
renderingStartIndex:
|
|
1395
|
-
renderingEndIndex:
|
|
1396
|
-
visibleStartIndex:
|
|
1397
|
-
visibleEndIndex:
|
|
1398
|
-
scrollPosition:
|
|
1399
|
-
contentSize:
|
|
1099
|
+
V -= 1;
|
|
1100
|
+
const X = C(V + r, 0, i - 1);
|
|
1101
|
+
return J.debug("[VirtualScroll] Calculated rendering range:", {
|
|
1102
|
+
renderingStartIndex: _,
|
|
1103
|
+
renderingEndIndex: X,
|
|
1104
|
+
visibleStartIndex: b,
|
|
1105
|
+
visibleEndIndex: V,
|
|
1106
|
+
scrollPosition: E,
|
|
1107
|
+
renderingContentSize: u.getTotal(),
|
|
1108
|
+
overscanCount: r,
|
|
1109
|
+
viewportSize: t
|
|
1110
|
+
}), { renderingStartIndex: _, renderingEndIndex: X, visibleStartIndex: b, visibleEndIndex: V };
|
|
1111
|
+
}, [E, r, t, n, u, i]);
|
|
1112
|
+
re(() => {
|
|
1113
|
+
const h = Y.current?.getScrollPosition() ?? 0;
|
|
1114
|
+
J.debug("[VirtualScroll] Range change effect triggered", {
|
|
1115
|
+
renderingStartIndex: T.renderingStartIndex,
|
|
1116
|
+
renderingEndIndex: T.renderingEndIndex,
|
|
1117
|
+
visibleStartIndex: T.visibleStartIndex,
|
|
1118
|
+
visibleEndIndex: T.visibleEndIndex,
|
|
1119
|
+
scrollPosition: E,
|
|
1120
|
+
contentSize: F,
|
|
1400
1121
|
scrollPaneScrollPosition: h
|
|
1401
|
-
}),
|
|
1402
|
-
}, [
|
|
1403
|
-
const M =
|
|
1122
|
+
}), m?.(T.renderingStartIndex, T.renderingEndIndex, T.visibleStartIndex, T.visibleEndIndex, E, F);
|
|
1123
|
+
}, [T.renderingStartIndex, T.renderingEndIndex, T.visibleStartIndex, T.visibleEndIndex, m, E, F]);
|
|
1124
|
+
const M = z(
|
|
1404
1125
|
(h) => {
|
|
1405
|
-
const { renderingStartIndex:
|
|
1406
|
-
if (
|
|
1407
|
-
return /* @__PURE__ */
|
|
1408
|
-
const
|
|
1409
|
-
for (let
|
|
1410
|
-
const
|
|
1411
|
-
|
|
1126
|
+
const { renderingStartIndex: p, renderingEndIndex: I } = T;
|
|
1127
|
+
if (J.debug("[VirtualScroll] Rendering visible items", { currentScrollPosition: h, renderingStartIndex: p, renderingEndIndex: I, fenwickSize: i, viewportSize: t }), i === 0)
|
|
1128
|
+
return /* @__PURE__ */ j("div", { className: "absolute w-full", style: { top: 0 }, children: /* @__PURE__ */ j("div", { className: "text-center text-gray-500", children: "No items" }) });
|
|
1129
|
+
const v = C(p, 0, i - 1), { cumulative: b, currentValue: _ } = u.prefixSum(v, { materializeOption: { materialize: !1 } }), H = b - _, V = [], X = [];
|
|
1130
|
+
for (let S = p; S <= I; S++) {
|
|
1131
|
+
const K = n(S);
|
|
1132
|
+
V.push({ item: e(S), height: K }), u.get(S) !== K && X.push({ index: S, value: K });
|
|
1412
1133
|
}
|
|
1413
|
-
|
|
1414
|
-
const
|
|
1415
|
-
|
|
1134
|
+
X.length > 0 && Promise.resolve().then(() => {
|
|
1135
|
+
const S = u.updates(X);
|
|
1136
|
+
S && (W(S), J.debug("[VirtualScroll] Updated heights for items", X, "New total height:", S));
|
|
1416
1137
|
});
|
|
1417
|
-
const
|
|
1418
|
-
return
|
|
1419
|
-
const
|
|
1420
|
-
return /* @__PURE__ */
|
|
1138
|
+
const R = F < t ? 0 : H - h;
|
|
1139
|
+
return J.debug("[VirtualScroll] Rendering items", { visibleItems: V, containerTop: R }), /* @__PURE__ */ j("div", { className: "absolute w-full", style: { top: R }, children: V.map(({ item: S, height: K }, oe) => {
|
|
1140
|
+
const te = p + oe, a = C(te, 0, i - 1), { cumulative: G, currentValue: U } = u.prefixSum(a, { materializeOption: { materialize: !1 } }), ne = G - U;
|
|
1141
|
+
return /* @__PURE__ */ j(
|
|
1421
1142
|
"div",
|
|
1422
1143
|
{
|
|
1423
|
-
"data-index":
|
|
1144
|
+
"data-index": te,
|
|
1424
1145
|
style: {
|
|
1425
1146
|
position: "absolute",
|
|
1426
|
-
top:
|
|
1147
|
+
top: ne - H,
|
|
1427
1148
|
width: "100%"
|
|
1428
1149
|
},
|
|
1429
|
-
children:
|
|
1150
|
+
children: d(S, te)
|
|
1430
1151
|
},
|
|
1431
|
-
|
|
1152
|
+
te
|
|
1432
1153
|
);
|
|
1433
1154
|
}) });
|
|
1434
1155
|
},
|
|
1435
|
-
[e,
|
|
1156
|
+
[e, d, F, t, T, u, i, n]
|
|
1436
1157
|
);
|
|
1437
|
-
return
|
|
1438
|
-
|
|
1158
|
+
return Me(
|
|
1159
|
+
ae,
|
|
1439
1160
|
() => ({
|
|
1440
|
-
getScrollPosition: () =>
|
|
1441
|
-
getContentSize: () =>
|
|
1442
|
-
getViewportSize: () =>
|
|
1443
|
-
scrollTo: (h) =>
|
|
1444
|
-
scrollToIndex: (h) =>
|
|
1445
|
-
getFenwickTreeTotalHeight: () =>
|
|
1446
|
-
getFenwickSize: () =>
|
|
1161
|
+
getScrollPosition: () => Y.current?.getScrollPosition() ?? -1,
|
|
1162
|
+
getContentSize: () => Y.current?.getContentSize() ?? -1,
|
|
1163
|
+
getViewportSize: () => Y.current?.getViewportSize() ?? -1,
|
|
1164
|
+
scrollTo: (h) => A(h),
|
|
1165
|
+
scrollToIndex: (h) => k(h),
|
|
1166
|
+
getFenwickTreeTotalHeight: () => u.getTotal(),
|
|
1167
|
+
getFenwickSize: () => u.getSize()
|
|
1447
1168
|
}),
|
|
1448
|
-
[
|
|
1449
|
-
), /* @__PURE__ */
|
|
1450
|
-
|
|
1169
|
+
[k, u, A]
|
|
1170
|
+
), /* @__PURE__ */ j(
|
|
1171
|
+
Be,
|
|
1451
1172
|
{
|
|
1452
|
-
ref:
|
|
1453
|
-
contentSize:
|
|
1454
|
-
viewportSize:
|
|
1455
|
-
className:
|
|
1456
|
-
onScroll:
|
|
1457
|
-
background:
|
|
1458
|
-
tapScrollCircleOptions:
|
|
1459
|
-
inertiaOptions:
|
|
1173
|
+
ref: Y,
|
|
1174
|
+
contentSize: F,
|
|
1175
|
+
viewportSize: t,
|
|
1176
|
+
className: o,
|
|
1177
|
+
onScroll: x,
|
|
1178
|
+
background: f,
|
|
1179
|
+
tapScrollCircleOptions: w,
|
|
1180
|
+
inertiaOptions: ie,
|
|
1460
1181
|
itemCount: c,
|
|
1461
1182
|
children: M
|
|
1462
1183
|
}
|
|
1463
1184
|
);
|
|
1464
1185
|
}
|
|
1465
|
-
const
|
|
1466
|
-
class
|
|
1186
|
+
const st = Ve(Ze);
|
|
1187
|
+
class Je {
|
|
1467
1188
|
key;
|
|
1468
1189
|
value;
|
|
1469
1190
|
prev = null;
|
|
@@ -1472,7 +1193,7 @@ class it {
|
|
|
1472
1193
|
this.key = e, this.value = n;
|
|
1473
1194
|
}
|
|
1474
1195
|
}
|
|
1475
|
-
class
|
|
1196
|
+
class Fe {
|
|
1476
1197
|
head = null;
|
|
1477
1198
|
tail = null;
|
|
1478
1199
|
/**
|
|
@@ -1513,54 +1234,54 @@ class Ce {
|
|
|
1513
1234
|
this.remove(e), this.addToTail(e);
|
|
1514
1235
|
}
|
|
1515
1236
|
}
|
|
1516
|
-
function
|
|
1517
|
-
const e =
|
|
1518
|
-
|
|
1237
|
+
function Qe(c) {
|
|
1238
|
+
const e = N(/* @__PURE__ */ new Map()), n = N(new Fe());
|
|
1239
|
+
re(() => {
|
|
1519
1240
|
for (; e.current.size > c; ) {
|
|
1520
|
-
const
|
|
1521
|
-
if (
|
|
1522
|
-
e.current.delete(
|
|
1241
|
+
const f = n.current.removeHead();
|
|
1242
|
+
if (f)
|
|
1243
|
+
e.current.delete(f.key);
|
|
1523
1244
|
else
|
|
1524
1245
|
break;
|
|
1525
1246
|
}
|
|
1526
1247
|
}, [c]);
|
|
1527
|
-
const
|
|
1528
|
-
const
|
|
1529
|
-
if (
|
|
1530
|
-
return n.current.moveToTail(
|
|
1531
|
-
}, []),
|
|
1532
|
-
(
|
|
1248
|
+
const t = z((f) => {
|
|
1249
|
+
const g = e.current.get(f);
|
|
1250
|
+
if (g)
|
|
1251
|
+
return n.current.moveToTail(g), g.value;
|
|
1252
|
+
}, []), r = z(
|
|
1253
|
+
(f, g) => {
|
|
1533
1254
|
if (c <= 0)
|
|
1534
1255
|
return;
|
|
1535
|
-
let
|
|
1536
|
-
if (
|
|
1537
|
-
|
|
1256
|
+
let y = e.current.get(f);
|
|
1257
|
+
if (y)
|
|
1258
|
+
y.value = g, n.current.moveToTail(y);
|
|
1538
1259
|
else {
|
|
1539
1260
|
if (e.current.size >= c) {
|
|
1540
|
-
const
|
|
1541
|
-
|
|
1261
|
+
const w = n.current.removeHead();
|
|
1262
|
+
w && e.current.delete(w.key);
|
|
1542
1263
|
}
|
|
1543
|
-
|
|
1264
|
+
y = new Je(f, g), e.current.set(f, y), n.current.addToTail(y);
|
|
1544
1265
|
}
|
|
1545
1266
|
},
|
|
1546
1267
|
[c]
|
|
1547
|
-
),
|
|
1548
|
-
e.current.clear(), n.current = new
|
|
1549
|
-
}, []), [
|
|
1550
|
-
return
|
|
1268
|
+
), o = z((f) => e.current.has(f), []), s = z(() => {
|
|
1269
|
+
e.current.clear(), n.current = new Fe();
|
|
1270
|
+
}, []), [m, d] = le(() => ({ get: t, set: r, has: o, clear: s }));
|
|
1271
|
+
return re(() => d({ get: t, set: r, has: o, clear: s }), [t, r, o, s]), m;
|
|
1551
1272
|
}
|
|
1552
|
-
const
|
|
1553
|
-
const { get: c, set: e, has: n, clear:
|
|
1554
|
-
return { get: c, set: e, has: n, clear:
|
|
1273
|
+
const et = 1e4, it = () => {
|
|
1274
|
+
const { get: c, set: e, has: n, clear: t } = Qe(et);
|
|
1275
|
+
return { get: c, set: e, has: n, clear: t };
|
|
1555
1276
|
};
|
|
1556
1277
|
export {
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1278
|
+
We as FenwickMapTree,
|
|
1279
|
+
Ke as ScrollBar,
|
|
1280
|
+
Be as ScrollPane,
|
|
1281
|
+
st as VirtualScroll,
|
|
1282
|
+
C as minmax,
|
|
1283
|
+
Ge as useFenwickMapTree,
|
|
1284
|
+
it as useHeightCache,
|
|
1285
|
+
Qe as useLruCache
|
|
1565
1286
|
};
|
|
1566
1287
|
//# sourceMappingURL=index.js.map
|