react-layout-virtual 0.0.1 → 0.0.2
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/dist/index.d.ts +1 -0
- package/dist/index.js +6 -372
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,372 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if (V) return y;
|
|
8
|
-
V = 1;
|
|
9
|
-
var v = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
10
|
-
function c(l, n, o) {
|
|
11
|
-
var s = null;
|
|
12
|
-
if (o !== void 0 && (s = "" + o), n.key !== void 0 && (s = "" + n.key), "key" in n) {
|
|
13
|
-
o = {};
|
|
14
|
-
for (var i in n)
|
|
15
|
-
i !== "key" && (o[i] = n[i]);
|
|
16
|
-
} else o = n;
|
|
17
|
-
return n = o.ref, {
|
|
18
|
-
$$typeof: v,
|
|
19
|
-
type: l,
|
|
20
|
-
key: s,
|
|
21
|
-
ref: n !== void 0 ? n : null,
|
|
22
|
-
props: o
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
return y.Fragment = t, y.jsx = c, y.jsxs = c, y;
|
|
26
|
-
}
|
|
27
|
-
var S = {};
|
|
28
|
-
var z;
|
|
29
|
-
function de() {
|
|
30
|
-
return z || (z = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
31
|
-
function v(e) {
|
|
32
|
-
if (e == null) return null;
|
|
33
|
-
if (typeof e == "function")
|
|
34
|
-
return e.$$typeof === Q ? null : e.displayName || e.name || null;
|
|
35
|
-
if (typeof e == "string") return e;
|
|
36
|
-
switch (e) {
|
|
37
|
-
case T:
|
|
38
|
-
return "Fragment";
|
|
39
|
-
case j:
|
|
40
|
-
return "Profiler";
|
|
41
|
-
case P:
|
|
42
|
-
return "StrictMode";
|
|
43
|
-
case J:
|
|
44
|
-
return "Suspense";
|
|
45
|
-
case B:
|
|
46
|
-
return "SuspenseList";
|
|
47
|
-
case Z:
|
|
48
|
-
return "Activity";
|
|
49
|
-
}
|
|
50
|
-
if (typeof e == "object")
|
|
51
|
-
switch (typeof e.tag == "number" && console.error(
|
|
52
|
-
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
53
|
-
), e.$$typeof) {
|
|
54
|
-
case w:
|
|
55
|
-
return "Portal";
|
|
56
|
-
case G:
|
|
57
|
-
return e.displayName || "Context";
|
|
58
|
-
case I:
|
|
59
|
-
return (e._context.displayName || "Context") + ".Consumer";
|
|
60
|
-
case H:
|
|
61
|
-
var r = e.render;
|
|
62
|
-
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
63
|
-
case X:
|
|
64
|
-
return r = e.displayName || null, r !== null ? r : v(e.type) || "Memo";
|
|
65
|
-
case A:
|
|
66
|
-
r = e._payload, e = e._init;
|
|
67
|
-
try {
|
|
68
|
-
return v(e(r));
|
|
69
|
-
} catch {
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
function t(e) {
|
|
75
|
-
return "" + e;
|
|
76
|
-
}
|
|
77
|
-
function c(e) {
|
|
78
|
-
try {
|
|
79
|
-
t(e);
|
|
80
|
-
var r = !1;
|
|
81
|
-
} catch {
|
|
82
|
-
r = !0;
|
|
83
|
-
}
|
|
84
|
-
if (r) {
|
|
85
|
-
r = console;
|
|
86
|
-
var u = r.error, d = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
87
|
-
return u.call(
|
|
88
|
-
r,
|
|
89
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
90
|
-
d
|
|
91
|
-
), t(e);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
function l(e) {
|
|
95
|
-
if (e === T) return "<>";
|
|
96
|
-
if (typeof e == "object" && e !== null && e.$$typeof === A)
|
|
97
|
-
return "<...>";
|
|
98
|
-
try {
|
|
99
|
-
var r = v(e);
|
|
100
|
-
return r ? "<" + r + ">" : "<...>";
|
|
101
|
-
} catch {
|
|
102
|
-
return "<...>";
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
function n() {
|
|
106
|
-
var e = C.A;
|
|
107
|
-
return e === null ? null : e.getOwner();
|
|
108
|
-
}
|
|
109
|
-
function o() {
|
|
110
|
-
return Error("react-stack-top-frame");
|
|
111
|
-
}
|
|
112
|
-
function s(e) {
|
|
113
|
-
if (Y.call(e, "key")) {
|
|
114
|
-
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
115
|
-
if (r && r.isReactWarning) return !1;
|
|
116
|
-
}
|
|
117
|
-
return e.key !== void 0;
|
|
118
|
-
}
|
|
119
|
-
function i(e, r) {
|
|
120
|
-
function u() {
|
|
121
|
-
F || (F = !0, console.error(
|
|
122
|
-
"%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)",
|
|
123
|
-
r
|
|
124
|
-
));
|
|
125
|
-
}
|
|
126
|
-
u.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
127
|
-
get: u,
|
|
128
|
-
configurable: !0
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
function a() {
|
|
132
|
-
var e = v(this.type);
|
|
133
|
-
return $[e] || ($[e] = !0, console.error(
|
|
134
|
-
"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."
|
|
135
|
-
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
136
|
-
}
|
|
137
|
-
function f(e, r, u, d, k, L) {
|
|
138
|
-
var m = u.ref;
|
|
139
|
-
return e = {
|
|
140
|
-
$$typeof: b,
|
|
141
|
-
type: e,
|
|
142
|
-
key: r,
|
|
143
|
-
props: u,
|
|
144
|
-
_owner: d
|
|
145
|
-
}, (m !== void 0 ? m : null) !== null ? Object.defineProperty(e, "ref", {
|
|
146
|
-
enumerable: !1,
|
|
147
|
-
get: a
|
|
148
|
-
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
149
|
-
configurable: !1,
|
|
150
|
-
enumerable: !1,
|
|
151
|
-
writable: !0,
|
|
152
|
-
value: 0
|
|
153
|
-
}), Object.defineProperty(e, "_debugInfo", {
|
|
154
|
-
configurable: !1,
|
|
155
|
-
enumerable: !1,
|
|
156
|
-
writable: !0,
|
|
157
|
-
value: null
|
|
158
|
-
}), Object.defineProperty(e, "_debugStack", {
|
|
159
|
-
configurable: !1,
|
|
160
|
-
enumerable: !1,
|
|
161
|
-
writable: !0,
|
|
162
|
-
value: k
|
|
163
|
-
}), Object.defineProperty(e, "_debugTask", {
|
|
164
|
-
configurable: !1,
|
|
165
|
-
enumerable: !1,
|
|
166
|
-
writable: !0,
|
|
167
|
-
value: L
|
|
168
|
-
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
169
|
-
}
|
|
170
|
-
function _(e, r, u, d, k, L) {
|
|
171
|
-
var m = r.children;
|
|
172
|
-
if (m !== void 0)
|
|
173
|
-
if (d)
|
|
174
|
-
if (K(m)) {
|
|
175
|
-
for (d = 0; d < m.length; d++)
|
|
176
|
-
R(m[d]);
|
|
177
|
-
Object.freeze && Object.freeze(m);
|
|
178
|
-
} else
|
|
179
|
-
console.error(
|
|
180
|
-
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
181
|
-
);
|
|
182
|
-
else R(m);
|
|
183
|
-
if (Y.call(r, "key")) {
|
|
184
|
-
m = v(e);
|
|
185
|
-
var x = Object.keys(r).filter(function(ee) {
|
|
186
|
-
return ee !== "key";
|
|
187
|
-
});
|
|
188
|
-
d = 0 < x.length ? "{key: someKey, " + x.join(": ..., ") + ": ...}" : "{key: someKey}", U[m + d] || (x = 0 < x.length ? "{" + x.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
189
|
-
`A props object containing a "key" prop is being spread into JSX:
|
|
190
|
-
let props = %s;
|
|
191
|
-
<%s {...props} />
|
|
192
|
-
React keys must be passed directly to JSX without using spread:
|
|
193
|
-
let props = %s;
|
|
194
|
-
<%s key={someKey} {...props} />`,
|
|
195
|
-
d,
|
|
196
|
-
m,
|
|
197
|
-
x,
|
|
198
|
-
m
|
|
199
|
-
), U[m + d] = !0);
|
|
200
|
-
}
|
|
201
|
-
if (m = null, u !== void 0 && (c(u), m = "" + u), s(r) && (c(r.key), m = "" + r.key), "key" in r) {
|
|
202
|
-
u = {};
|
|
203
|
-
for (var M in r)
|
|
204
|
-
M !== "key" && (u[M] = r[M]);
|
|
205
|
-
} else u = r;
|
|
206
|
-
return m && i(
|
|
207
|
-
u,
|
|
208
|
-
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
209
|
-
), f(
|
|
210
|
-
e,
|
|
211
|
-
m,
|
|
212
|
-
u,
|
|
213
|
-
n(),
|
|
214
|
-
k,
|
|
215
|
-
L
|
|
216
|
-
);
|
|
217
|
-
}
|
|
218
|
-
function R(e) {
|
|
219
|
-
E(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === A && (e._payload.status === "fulfilled" ? E(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
220
|
-
}
|
|
221
|
-
function E(e) {
|
|
222
|
-
return typeof e == "object" && e !== null && e.$$typeof === b;
|
|
223
|
-
}
|
|
224
|
-
var p = re, b = /* @__PURE__ */ Symbol.for("react.transitional.element"), w = /* @__PURE__ */ Symbol.for("react.portal"), T = /* @__PURE__ */ Symbol.for("react.fragment"), P = /* @__PURE__ */ Symbol.for("react.strict_mode"), j = /* @__PURE__ */ Symbol.for("react.profiler"), I = /* @__PURE__ */ Symbol.for("react.consumer"), G = /* @__PURE__ */ Symbol.for("react.context"), H = /* @__PURE__ */ Symbol.for("react.forward_ref"), J = /* @__PURE__ */ Symbol.for("react.suspense"), B = /* @__PURE__ */ Symbol.for("react.suspense_list"), X = /* @__PURE__ */ Symbol.for("react.memo"), A = /* @__PURE__ */ Symbol.for("react.lazy"), Z = /* @__PURE__ */ Symbol.for("react.activity"), Q = /* @__PURE__ */ Symbol.for("react.client.reference"), C = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, K = Array.isArray, N = console.createTask ? console.createTask : function() {
|
|
225
|
-
return null;
|
|
226
|
-
};
|
|
227
|
-
p = {
|
|
228
|
-
react_stack_bottom_frame: function(e) {
|
|
229
|
-
return e();
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
var F, $ = {}, D = p.react_stack_bottom_frame.bind(
|
|
233
|
-
p,
|
|
234
|
-
o
|
|
235
|
-
)(), W = N(l(o)), U = {};
|
|
236
|
-
S.Fragment = T, S.jsx = function(e, r, u) {
|
|
237
|
-
var d = 1e4 > C.recentlyCreatedOwnerStacks++;
|
|
238
|
-
return _(
|
|
239
|
-
e,
|
|
240
|
-
r,
|
|
241
|
-
u,
|
|
242
|
-
!1,
|
|
243
|
-
d ? Error("react-stack-top-frame") : D,
|
|
244
|
-
d ? N(l(e)) : W
|
|
245
|
-
);
|
|
246
|
-
}, S.jsxs = function(e, r, u) {
|
|
247
|
-
var d = 1e4 > C.recentlyCreatedOwnerStacks++;
|
|
248
|
-
return _(
|
|
249
|
-
e,
|
|
250
|
-
r,
|
|
251
|
-
u,
|
|
252
|
-
!0,
|
|
253
|
-
d ? Error("react-stack-top-frame") : D,
|
|
254
|
-
d ? N(l(e)) : W
|
|
255
|
-
);
|
|
256
|
-
};
|
|
257
|
-
})()), S;
|
|
258
|
-
}
|
|
259
|
-
var q;
|
|
260
|
-
function me() {
|
|
261
|
-
return q || (q = 1, process.env.NODE_ENV === "production" ? O.exports = fe() : O.exports = de()), O.exports;
|
|
262
|
-
}
|
|
263
|
-
var h = me();
|
|
264
|
-
class _e {
|
|
265
|
-
_store = null;
|
|
266
|
-
_scrollableContainer;
|
|
267
|
-
_renderedIndexRegistry = /* @__PURE__ */ new Map();
|
|
268
|
-
_renderedItemsRegistry = /* @__PURE__ */ new Map();
|
|
269
|
-
_itemsSetter;
|
|
270
|
-
_renderedRangeRefPool = /* @__PURE__ */ new Map();
|
|
271
|
-
_listItems = [];
|
|
272
|
-
_flushItems = () => {
|
|
273
|
-
this._itemsSetter(this._listItems);
|
|
274
|
-
};
|
|
275
|
-
_getRenderedBoundaryIndex(t) {
|
|
276
|
-
const c = t === "first" ? this._scrollableContainer.getFirstItem() : t === "last" ? this._scrollableContainer.getLastItem() : null;
|
|
277
|
-
if (c)
|
|
278
|
-
return this.getIndex(c);
|
|
279
|
-
}
|
|
280
|
-
constructor(t) {
|
|
281
|
-
this._scrollableContainer = new ie({ ...t }), this._itemsSetter = t.itemsSetter;
|
|
282
|
-
}
|
|
283
|
-
render(t, c, l) {
|
|
284
|
-
const n = this._getRenderedBoundaryIndex("first"), o = this._getRenderedBoundaryIndex("last");
|
|
285
|
-
let s = t, i = c, a = n, f = o, _ = 0;
|
|
286
|
-
return l === "down" ? (console.log("SCROLLING DOWN"), a !== void 0 && o !== void 0 && (f = Math.min(s - 1, o), s = Math.max(o + 1, s), a <= f && (_ = this.removeRange(a, f, l)))) : l === "up" && (console.log("SCROLLING UP"), f !== void 0 && n !== void 0 && (a = Math.max(i + 1, n), i = Math.min(n - 1, i), a <= f && (_ = this.removeRange(a, f, l)))), s < i && this.renderRange(s, i, l), _;
|
|
287
|
-
}
|
|
288
|
-
renderRange(t, c, l) {
|
|
289
|
-
console.log("_renderRange", t, c, l), t > c && console.error("_renderRange", t, c, l);
|
|
290
|
-
const n = this._store, o = this._listItems, s = [], i = this._renderedRangeRefPool;
|
|
291
|
-
if (n) {
|
|
292
|
-
for (let a = t; a <= c; a++) {
|
|
293
|
-
const f = n.getByIndex(a);
|
|
294
|
-
if (f) {
|
|
295
|
-
const _ = f.render, R = i.get(a) || { current: null, idx: a };
|
|
296
|
-
i.set(a, R), s.push(/* @__PURE__ */ h.jsx(_, { data: f.data, ref: R, index: a }, a));
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
this._listItems = l === "down" ? o.concat(s) : l === "up" ? s.concat(o) : this._listItems;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
removeRange(t, c, l) {
|
|
303
|
-
const n = this._renderedIndexRegistry, o = this._renderedItemsRegistry;
|
|
304
|
-
let s = 0, i = 1 / 0, a = 0;
|
|
305
|
-
for (let f = t; f <= c; f++) {
|
|
306
|
-
const _ = o.get(f);
|
|
307
|
-
if (_) {
|
|
308
|
-
const { offsetTop: R, offsetHeight: E } = _;
|
|
309
|
-
i = Math.min(i, R), a = Math.max(a, R + E), o.delete(f), n.delete(_), s++;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
return s && (this._listItems = l === "down" ? this._listItems.slice(s) : l === "up" ? this._listItems.slice(0, -s) : this._listItems), console.log("_removeItems startIndex:", t, "endIndex:", c, "removedHeight:", a > i ? a - i : 0, "removedItemsCount:", s), a > i ? a - i : 0;
|
|
313
|
-
}
|
|
314
|
-
clear() {
|
|
315
|
-
this._renderedIndexRegistry.clear(), this._renderedItemsRegistry.clear(), this._listItems = [], this._itemsSetter(this._listItems);
|
|
316
|
-
}
|
|
317
|
-
getIndex(t) {
|
|
318
|
-
return this._renderedIndexRegistry.get(t);
|
|
319
|
-
}
|
|
320
|
-
getItem(t) {
|
|
321
|
-
return this._renderedItemsRegistry.get(t);
|
|
322
|
-
}
|
|
323
|
-
get scrollableContainer() {
|
|
324
|
-
return this._scrollableContainer;
|
|
325
|
-
}
|
|
326
|
-
attach(t) {
|
|
327
|
-
this._store = t;
|
|
328
|
-
}
|
|
329
|
-
flush() {
|
|
330
|
-
return oe(this._flushItems), Promise.resolve();
|
|
331
|
-
}
|
|
332
|
-
commit() {
|
|
333
|
-
const t = this._renderedIndexRegistry, c = this._renderedItemsRegistry, l = this._renderedRangeRefPool;
|
|
334
|
-
for (const n of l.values()) {
|
|
335
|
-
const { idx: o, current: s } = n;
|
|
336
|
-
s && (t.set(s, o), c.set(o, s));
|
|
337
|
-
}
|
|
338
|
-
l.clear();
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
function ge(v) {
|
|
342
|
-
const { overscanHeight: t = 200, data: c, renderItem: l, scrollerRef: n } = v, o = n || g(null), s = g(null), i = g(null), a = g(null), f = g(null), _ = g(null), R = g(null), [E, p] = te([]), b = g(void 0);
|
|
343
|
-
ne(() => {
|
|
344
|
-
b.current = new _e({
|
|
345
|
-
container: o.current,
|
|
346
|
-
scrollHeightFiller: s.current,
|
|
347
|
-
viewportContainer: i.current,
|
|
348
|
-
scrollCanvas: a.current,
|
|
349
|
-
topSpacer: f.current,
|
|
350
|
-
contentLayer: _.current,
|
|
351
|
-
bottomSpacer: R.current,
|
|
352
|
-
itemsSetter: p
|
|
353
|
-
});
|
|
354
|
-
const T = new ce(), P = new ue({ overscanHeight: t, renderer: b.current }), j = new le({ store: T, layout: P });
|
|
355
|
-
for (let I = 0; I < c.length; I++)
|
|
356
|
-
j.insert({ data: c[I], render: l }, I);
|
|
357
|
-
}, []), se(() => {
|
|
358
|
-
b.current?.commit();
|
|
359
|
-
}, [E]);
|
|
360
|
-
const w = /* @__PURE__ */ h.jsxs(h.Fragment, { children: [
|
|
361
|
-
/* @__PURE__ */ h.jsx("div", { ref: s }),
|
|
362
|
-
/* @__PURE__ */ h.jsx("div", { ref: i, children: /* @__PURE__ */ h.jsxs("div", { ref: a, children: [
|
|
363
|
-
/* @__PURE__ */ h.jsx("div", { ref: f }),
|
|
364
|
-
/* @__PURE__ */ h.jsx("div", { ref: _, children: E }),
|
|
365
|
-
/* @__PURE__ */ h.jsx("div", { ref: R })
|
|
366
|
-
] }) })
|
|
367
|
-
] });
|
|
368
|
-
return n && n.current ? ae(w, n.current) : /* @__PURE__ */ h.jsx("div", { ref: o, children: w });
|
|
369
|
-
}
|
|
370
|
-
export {
|
|
371
|
-
ge as default
|
|
372
|
-
};
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import{useRef as n,useState as s,useLayoutEffect as i,useEffect as o}from"react";import{flushSync as l,createPortal as h}from"react-dom";import d,{ScrollableContainer as a,ArrayItemStore as c,DynamicListLayout as u}from"layout-virtual";class f{t=null;i;o=/* @__PURE__ */new Map;l=/* @__PURE__ */new Map;h;u=/* @__PURE__ */new Map;m=[];v=()=>{this.h(this.m)};p(e){const t="first"===e?this.i.getFirstItem():"last"===e?this.i.getLastItem():null;if(t)return this.getIndex(t)}constructor(e){this.i=new a({...e}),this.h=e.itemsSetter}render(e,t,r){const n=this.p("first"),s=this.p("last");let i=e,o=t,l=n,h=s,d=0;return"down"===r?(console.log("SCROLLING DOWN"),void 0!==l&&void 0!==s&&(h=Math.min(i-1,s),i=Math.max(s+1,i),l<=h&&(d=this.removeRange(l,h,r)))):"up"===r&&(console.log("SCROLLING UP"),void 0!==h&&void 0!==n&&(l=Math.max(o+1,n),o=Math.min(n-1,o),l<=h&&(d=this.removeRange(l,h,r)))),i<o&&this.renderRange(i,o,r),d}renderRange(t,r,n){console.log("_renderRange",t,r,n),t>r&&console.error("_renderRange",t,r,n);const s=this.t,i=this.m,o=[],l=this.u;if(s){for(let n=t;n<=r;n++){const t=s.getByIndex(n);if(t){const r=t.render,s=l.get(n)||{current:null,idx:n};l.set(n,s),o.push(/* @__PURE__ */e(r,{data:t.data,ref:s,index:n},n))}}this.m="down"===n?i.concat(o):"up"===n?o.concat(i):this.m}}removeRange(e,t,r){const n=this.o,s=this.l;let i=0,o=1/0,l=0;for(let h=e;h<=t;h++){const e=s.get(h);if(e){const{offsetTop:t,offsetHeight:r}=e;o=Math.min(o,t),l=Math.max(l,t+r),s.delete(h),n.delete(e),i++}}return i&&(this.m="down"===r?this.m.slice(i):"up"===r?this.m.slice(0,-i):this.m),console.log("_removeItems startIndex:",e,"endIndex:",t,"removedHeight:",l>o?l-o:0,"removedItemsCount:",i),l>o?l-o:0}clear(){this.o.clear(),this.l.clear(),this.m=[],this.h(this.m)}getIndex(e){return this.o.get(e)}getItem(e){return this.l.get(e)}get scrollableContainer(){return this.i}attach(e){this.t=e}flush(){return l(this.v),Promise.resolve()}commit(){const e=this.o,t=this.l,r=this.u;for(const n of r.values()){const{idx:r,current:s}=n;s&&(e.set(s,r),t.set(r,s))}r.clear()}}function m(l){const{overscanHeight:a=200,data:m,renderItem:v,scrollerRef:g}=l,p=n(null),I=g??p,w=n(null),R=n(null),_=n(null),x=n(null),M=n(null),C=n(null),[y,S]=s([]),H=n(void 0);i(()=>{H.current=new f({container:I.current,scrollHeightFiller:w.current,viewportContainer:R.current,scrollCanvas:_.current,topSpacer:x.current,contentLayer:M.current,bottomSpacer:C.current,itemsSetter:S});const e=new c,t=new u({overscanHeight:a,renderer:H.current}),r=new d({store:e,layout:t});for(let n=0;n<m.length;n++)r.insert({data:m[n],render:v},n)},[]),o(()=>{H.current?.commit()},[y]);const L=/* @__PURE__ */t(r,{children:[
|
|
2
|
+
/* @__PURE__ */e("div",{ref:w}),
|
|
3
|
+
/* @__PURE__ */e("div",{ref:R,children:/* @__PURE__ */t("div",{ref:_,children:[
|
|
4
|
+
/* @__PURE__ */e("div",{ref:x}),
|
|
5
|
+
/* @__PURE__ */e("div",{ref:M,children:y}),
|
|
6
|
+
/* @__PURE__ */e("div",{ref:C})]})})]});return g&&g.current?h(L,g.current):/* @__PURE__ */e("div",{ref:I,children:L})}export{m as default};
|