virtua 0.49.0 → 0.49.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.
@@ -151,8 +151,6 @@ export interface VGridProps extends ViewportComponentAttributes {
151
151
  item?: keyof JSX.IntrinsicElements | CustomCellComponent;
152
152
  /** Reference to the rendered DOM element (the one that scrolls). */
153
153
  domRef?: Ref<HTMLDivElement>;
154
- /** Reference to the inner rendered DOM element (the one that contains all the cells). */
155
- innerDomRef?: Ref<HTMLDivElement>;
156
154
  /**
157
155
  * Callback invoked whenever scroll offset changes.
158
156
  */
@@ -1,12 +1,12 @@
1
1
  var e = require("solid-js/web"), t = require("solid-js");
2
2
 
3
- const r = null, {min: n, max: o, abs: s, floor: i} = Math, c = (e, t, r) => n(r, o(t, e)), l = e => [ ...e ].sort(((e, t) => e - t)), u = "function" == typeof queueMicrotask ? queueMicrotask : e => {
3
+ const r = null, {min: n, max: o, abs: s, floor: i} = Math, c = (e, t, r) => n(r, o(t, e)), l = e => [ ...e ].sort((e, t) => e - t), u = "function" == typeof queueMicrotask ? queueMicrotask : e => {
4
4
  Promise.resolve().then(e);
5
5
  }, f = () => {
6
6
  let e;
7
- return [ new Promise((t => {
7
+ return [ new Promise(t => {
8
8
  e = t;
9
- })), e ];
9
+ }), e ];
10
10
  }, a = e => {
11
11
  let t;
12
12
  return () => (e && (t = e(), e = void 0), t);
@@ -37,8 +37,8 @@ const r = null, {min: n, max: o, abs: s, floor: i} = Math, c = (e, t, r) => n(r,
37
37
  }, m = (e, t, r) => {
38
38
  const o = t - e.u;
39
39
  return e.l = r ? -1 : n(t - 1, e.l), e.u = t, o > 0 ? (d(e.h, o), d(e.o, o, r),
40
- e.i * o) : (e.h.splice(o), (r ? e.o.splice(0, -o) : e.o.splice(o)).reduce(((t, r) => t - (-1 === r ? e.i : r)), 0));
41
- }, S = e => e.documentElement, $ = e => e.ownerDocument, b = e => e.defaultView, x = /*#__PURE__*/ a((() => !!/iP(hone|od|ad)/.test(navigator.userAgent) || "MacIntel" === navigator.platform && navigator.maxTouchPoints > 0)), z = /*#__PURE__*/ a((() => "scrollBehavior" in S(document).style)), w = (e, t = 40, i = 0, c, u = !1) => {
40
+ e.i * o) : (e.h.splice(o), (r ? e.o.splice(0, -o) : e.o.splice(o)).reduce((t, r) => t - (-1 === r ? e.i : r), 0));
41
+ }, S = e => e.documentElement, $ = e => e.ownerDocument, b = e => e.defaultView, x = /*#__PURE__*/ a(() => !!/iP(hone|od|ad)/.test(navigator.userAgent) || "MacIntel" === navigator.platform && navigator.maxTouchPoints > 0), z = /*#__PURE__*/ a(() => "scrollBehavior" in S(document).style), w = (e, t = 40, i = 0, c, u = !1) => {
42
42
  let f = !!i, a = 1, S = 0, $ = 0, b = 0, z = 0, w = 0, y = 0, _ = 0, I = 0, k = r, T = [ 0, f ? o(i - 1, 0) : -1 ], M = 0, O = !1;
43
43
  const R = ((e, t, r) => ({
44
44
  i: t,
@@ -115,16 +115,16 @@ const r = null, {min: n, max: o, abs: s, floor: i} = Math, c = (e, t, r) => n(r,
115
115
 
116
116
  case 3:
117
117
  {
118
- const e = t.filter((([e, t]) => !P(e, t)));
118
+ const e = t.filter(([e, t]) => !P(e, t));
119
119
  if (!e.length) break;
120
- W(e.reduce(((e, [t, r]) => {
120
+ W(e.reduce((e, [t, r]) => {
121
121
  let n;
122
122
  if (2 === I) n = !0; else if (k && 1 === I) n = t < k[0]; else {
123
123
  const e = J(), r = H(t), o = L(t);
124
- n = 1 !== _ && 0 === I ? r + o < e : r < e && r + o < e + S;
124
+ n = 1 !== _ && 0 === I ? r + o <= e : r < e && r + o < e + S;
125
125
  }
126
126
  return n && (e += r - L(t)), e;
127
- }), 0));
127
+ }, 0));
128
128
  for (const [t, r] of e) {
129
129
  const e = L(t), n = h(R, t, r);
130
130
  u && (M += n ? r : r - e);
@@ -132,9 +132,9 @@ const r = null, {min: n, max: o, abs: s, floor: i} = Math, c = (e, t, r) => n(r,
132
132
  u && S && M > S && (W(((e, t) => {
133
133
  let r = 0;
134
134
  const n = [];
135
- e.o.forEach(((e, o) => {
135
+ e.o.forEach((e, o) => {
136
136
  -1 !== e && (n.push(e), o < t && r++);
137
- })), e.l = -1;
137
+ }), e.l = -1;
138
138
  const s = l(n), i = s.length, c = i / 2 | 0, u = i % 2 == 0 ? (s[c - 1] + s[c]) / 2 : s[c], f = e.i;
139
139
  return ((e.i = u) - f) * o(t - r, 0);
140
140
  })(R, v(R, B()))), u = !1), c = 3, i = !0;
@@ -160,9 +160,9 @@ const r = null, {min: n, max: o, abs: s, floor: i} = Math, c = (e, t, r) => n(r,
160
160
  case 8:
161
161
  k = C(t, t + S), c = 1;
162
162
  }
163
- c && (a = 1 + (2147483647 & a), n && w && (z += w, w = 0), q.forEach((([e, t]) => {
163
+ c && (a = 1 + (2147483647 & a), n && w && (z += w, w = 0), q.forEach(([e, t]) => {
164
164
  c & e && t(i);
165
- })));
165
+ }));
166
166
  }
167
167
  };
168
168
  }, y = setTimeout, _ = (e, t) => t ? -e : e, I = (e, t, n, o, s, i) => {
@@ -173,12 +173,12 @@ const r = null, {min: n, max: o, abs: s, floor: i} = Math, c = (e, t, r) => n(r,
173
173
  const n = () => {
174
174
  t != r && clearTimeout(t);
175
175
  }, o = () => {
176
- n(), t = y((() => {
176
+ n(), t = y(() => {
177
177
  t = r, (() => {
178
178
  if (u || f) return u = !1, void g();
179
179
  a = !1, e.H(2);
180
180
  })();
181
- }), 150);
181
+ }, 150);
182
182
  };
183
183
  return o.L = n, o;
184
184
  })(), h = () => {
@@ -217,11 +217,11 @@ const r = null, {min: n, max: o, abs: s, floor: i} = Math, c = (e, t, r) => n(r,
217
217
  const [t, r] = f();
218
218
  return n = () => {
219
219
  r(!1);
220
- }, e.R() && y(n, 150), [ t, e.C(2, (() => {
220
+ }, e.R() && y(n, 150), [ t, e.C(2, () => {
221
221
  r(!0);
222
- })) ];
222
+ }) ];
223
223
  };
224
- if (s && z()) e.H(8, o()), u((async () => {
224
+ if (s && z()) e.H(8, o()), u(async () => {
225
225
  for (;;) {
226
226
  let t = !0;
227
227
  for (let [r, n] = e.S(); r <= n; r++) if (e._(r)) {
@@ -237,7 +237,7 @@ const r = null, {min: n, max: o, abs: s, floor: i} = Math, c = (e, t, r) => n(r,
237
237
  }
238
238
  }
239
239
  e.H(7), r(o(), s);
240
- })); else for (;;) {
240
+ }); else for (;;) {
241
241
  const [t, n] = i();
242
242
  try {
243
243
  if (e.H(7), r(o()), !await t) return;
@@ -265,10 +265,10 @@ const r = null, {min: n, max: o, abs: s, floor: i} = Math, c = (e, t, r) => n(r,
265
265
  let n;
266
266
  r = t.mergeProps({
267
267
  V: "div"
268
- }, r), t.createEffect((() => {
268
+ }, r), t.createEffect(() => {
269
269
  n && t.onCleanup(r.X(n, r.Y));
270
- }));
271
- const o = t.createMemo((() => {
270
+ });
271
+ const o = t.createMemo(() => {
272
272
  const e = r.D, t = {
273
273
  contain: "layout style",
274
274
  position: "absolute",
@@ -278,7 +278,7 @@ const r = null, {min: n, max: o, abs: s, floor: i} = Math, c = (e, t, r) => n(r,
278
278
  visibility: r.A ? "hidden" : void 0
279
279
  };
280
280
  return e && (t.display = "inline-flex"), t;
281
- }));
281
+ });
282
282
  return e.createComponent(e.Dynamic, {
283
283
  get component() {
284
284
  return r.V;
@@ -304,14 +304,14 @@ const r = null, {min: n, max: o, abs: s, floor: i} = Math, c = (e, t, r) => n(r,
304
304
  }, n);
305
305
  const d = w(n.data.length, i, void 0, a, !i), g = ((e, t) => {
306
306
  let n;
307
- const o = t ? "width" : "height", s = new WeakMap, i = T((t => {
307
+ const o = t ? "width" : "height", s = new WeakMap, i = T(t => {
308
308
  const i = [];
309
309
  for (const {target: c, contentRect: l} of t) if (c.offsetParent) if (c === n) e.H(4, l[o]); else {
310
310
  const e = s.get(c);
311
311
  e != r && i.push([ e, l[o] ]);
312
312
  }
313
313
  i.length && e.H(3, i);
314
- }));
314
+ });
315
315
  return {
316
316
  G(e) {
317
317
  i.j(n = e);
@@ -323,33 +323,33 @@ const r = null, {min: n, max: o, abs: s, floor: i} = Math, c = (e, t, r) => n(r,
323
323
  };
324
324
  })(d, u), h = ((e, t) => {
325
325
  let r, n, o = f(), s = !1;
326
- const i = t ? "scrollLeft" : "scrollTop", l = t ? "overflowX" : "overflowY", [u, a] = k(e, (() => o[0]), ((e, n) => {
326
+ const i = t ? "scrollLeft" : "scrollTop", l = t ? "overflowX" : "overflowY", [u, a] = k(e, () => o[0], (e, n) => {
327
327
  e = _(e, s), n ? r.scrollTo({
328
328
  [t ? "left" : "top"]: e,
329
329
  behavior: "smooth"
330
330
  }) : r[i] = e;
331
- }));
331
+ });
332
332
  return {
333
333
  Z(c, u) {
334
- r = u, t && (s = "rtl" === getComputedStyle(u).direction), n = I(e, u, t, (() => _(u[i], s)), ((t, r, n) => {
334
+ r = u, t && (s = "rtl" === getComputedStyle(u).direction), n = I(e, u, t, () => _(u[i], s), (t, r, n) => {
335
335
  if (n) {
336
336
  const e = u.style, t = e[l];
337
- e[l] = "hidden", y((() => {
337
+ e[l] = "hidden", y(() => {
338
338
  e[l] = t;
339
- }));
339
+ });
340
340
  }
341
341
  u[i] = _(e.M() + t, s), r && a();
342
- })), o[1](!0);
342
+ }), o[1](!0);
343
343
  },
344
344
  p() {
345
345
  n && n.P(), o[1](!1), o = f();
346
346
  },
347
347
  ee: () => s,
348
348
  te(e) {
349
- u((() => e));
349
+ u(() => e);
350
350
  },
351
351
  re(t) {
352
- t += e.M(), u((() => t));
352
+ t += e.M(), u(() => t);
353
353
  },
354
354
  ne(t, {align: r, smooth: n, offset: o = 0} = {}) {
355
355
  if (t = c(t, 0, e.T() - 1), "nearest" === r) {
@@ -359,26 +359,26 @@ const r = null, {min: n, max: o, abs: s, floor: i} = Math, c = (e, t, r) => n(r,
359
359
  r = "end";
360
360
  }
361
361
  }
362
- u((() => o + e.q() + e.I(t) + ("end" === r ? e.k(t) - e.R() : "center" === r ? (e.k(t) - e.R()) / 2 : 0)), n);
362
+ u(() => o + e.q() + e.I(t) + ("end" === r ? e.k(t) - e.R() : "center" === r ? (e.k(t) - e.R()) / 2 : 0), n);
363
363
  },
364
364
  oe: () => {
365
365
  n && n.W();
366
366
  }
367
367
  };
368
368
  })(d, u), [p, v] = t.createSignal(d.v());
369
- d.C(1, (() => {
369
+ d.C(1, () => {
370
370
  v(d.v());
371
- })), d.C(4, (() => {
371
+ }), d.C(4, () => {
372
372
  n.onScroll?.(d.M());
373
- })), d.C(8, (() => {
373
+ }), d.C(8, () => {
374
374
  n.onScrollEnd?.();
375
- }));
376
- const m = t.createMemo((e => {
375
+ });
376
+ const m = t.createMemo(e => {
377
377
  p();
378
378
  const t = d.S(n.bufferSize);
379
379
  return e && O(e, t) ? e : t;
380
- })), S = t.createMemo((() => p() && d.O())), $ = t.createMemo((() => p() && d.J())), b = t.createMemo((() => p() && h.ee()));
381
- t.onMount((() => {
380
+ }), S = t.createMemo(() => p() && d.O()), $ = t.createMemo(() => p() && d.J()), b = t.createMemo(() => p() && h.ee());
381
+ t.onMount(() => {
382
382
  n.ref && n.ref({
383
383
  get cache() {
384
384
  return d.m();
@@ -400,32 +400,32 @@ const r = null, {min: n, max: o, abs: s, floor: i} = Math, c = (e, t, r) => n(r,
400
400
  scrollBy: h.re
401
401
  });
402
402
  const e = s, r = n.scrollRef || e.parentElement;
403
- g.G(r), h.Z(e, r), t.onCleanup((() => {
403
+ g.G(r), h.Z(e, r), t.onCleanup(() => {
404
404
  n.ref && n.ref(), d.p(), g.p(), h.p();
405
- }));
406
- })), t.createComputed(t.on((() => n.startMargin || 0), (e => {
405
+ });
406
+ }), t.createComputed(t.on(() => n.startMargin || 0, e => {
407
407
  e !== d.q() && d.H(6, e);
408
- }))), t.createEffect(t.on(p, (() => {
408
+ })), t.createEffect(t.on(p, () => {
409
409
  h.oe();
410
- })));
411
- const x = t.createMemo((() => {
410
+ }));
411
+ const x = t.createMemo(() => {
412
412
  const e = n.data.length;
413
- t.untrack((() => {
413
+ t.untrack(() => {
414
414
  e !== d.T() && d.H(5, [ e, n.shift ]);
415
- }));
415
+ });
416
416
  const r = [], o = [];
417
417
  if (n.keepMounted) {
418
418
  const e = new Set(n.keepMounted);
419
419
  for (let [t, r] = m(); t <= r; t++) e.add(t);
420
- l([ ...e ]).forEach((e => {
420
+ l([ ...e ]).forEach(e => {
421
421
  r.push(n.data[e]), o.push(e);
422
- }));
422
+ });
423
423
  } else for (let [e, t] = m(); e <= t; e++) r.push(n.data[e]), o.push(e);
424
424
  return {
425
425
  se: r,
426
426
  ie: o
427
427
  };
428
- }));
428
+ });
429
429
  return e.createComponent(e.Dynamic, {
430
430
  get component() {
431
431
  return n.as;
@@ -450,8 +450,8 @@ const r = null, {min: n, max: o, abs: s, floor: i} = Math, c = (e, t, r) => n(r,
450
450
  return x().se;
451
451
  },
452
452
  children: (r, o) => ((r, o) => {
453
- const s = t.createMemo((() => (p(), d.I(o(), b())))), i = t.createMemo((() => (p(),
454
- d._(o())))), c = t.createMemo((() => t.untrack((() => n.children(r, o)))));
453
+ const s = t.createMemo(() => (p(), d.I(o(), b()))), i = t.createMemo(() => (p(),
454
+ d._(o()))), c = t.createMemo(() => t.untrack(() => n.children(r, o)));
455
455
  return e.createComponent(M, {
456
456
  get V() {
457
457
  return n.item;
@@ -473,7 +473,7 @@ const r = null, {min: n, max: o, abs: s, floor: i} = Math, c = (e, t, r) => n(r,
473
473
  },
474
474
  D: u
475
475
  });
476
- })(r, t.createMemo((() => x().ie[o()])))
476
+ })(r, t.createMemo(() => x().ie[o()]))
477
477
  });
478
478
  }
479
479
  });
@@ -537,7 +537,7 @@ exports.VList = r => {
537
537
  }, exports.Virtualizer = R, exports.WindowVirtualizer = n => {
538
538
  let o;
539
539
  const {ref: s, data: i, children: l, itemSize: a, shift: d, horizontal: g = !1, cache: h, onScrollEnd: p} = n, v = w(n.data.length, a, void 0, h, !a), m = ((e, t) => {
540
- const n = t ? "width" : "height", o = t ? "innerWidth" : "innerHeight", s = new WeakMap, i = T((t => {
540
+ const n = t ? "width" : "height", o = t ? "innerWidth" : "innerHeight", s = new WeakMap, i = T(t => {
541
541
  const o = [];
542
542
  for (const {target: e, contentRect: i} of t) {
543
543
  if (!e.offsetParent) continue;
@@ -545,7 +545,7 @@ exports.VList = r => {
545
545
  t != r && o.push([ t, i[n] ]);
546
546
  }
547
547
  o.length && e.H(3, o);
548
- }));
548
+ });
549
549
  let c;
550
550
  return {
551
551
  G(t) {
@@ -565,7 +565,7 @@ exports.VList = r => {
565
565
  };
566
566
  })(v, g), x = ((e, t) => {
567
567
  let r, n, o = f(), s = !1;
568
- const i = t ? "left" : "top", [l] = k(e, (() => o[0]), ((e, t) => {
568
+ const i = t ? "left" : "top", [l] = k(e, () => o[0], (e, t) => {
569
569
  e = _(e, s);
570
570
  const n = b($(r));
571
571
  t ? n.scroll({
@@ -574,7 +574,7 @@ exports.VList = r => {
574
574
  }) : n.scroll({
575
575
  [i]: e
576
576
  });
577
- })), u = (e, t, r, n, o = 0) => {
577
+ }), u = (e, t, r, n, o = 0) => {
578
578
  const i = n ? "offsetLeft" : "offsetTop", c = o + (n && s ? r.innerWidth - e[i] - e.offsetWidth : e[i]), l = e.offsetParent;
579
579
  return e !== t && l ? u(l, t, r, n, c) : c;
580
580
  };
@@ -582,13 +582,13 @@ exports.VList = r => {
582
582
  Z(c) {
583
583
  r = c;
584
584
  const l = t ? "scrollX" : "scrollY", f = $(c), a = b(f);
585
- t && (s = "rtl" === getComputedStyle(S(f)).direction), n = I(e, a, t, (() => _(a[l], s)), ((t, r) => {
585
+ t && (s = "rtl" === getComputedStyle(S(f)).direction), n = I(e, a, t, () => _(a[l], s), (t, r) => {
586
586
  r ? a.scroll({
587
587
  [i]: _(e.M() + t, s)
588
588
  }) : a.scrollBy({
589
589
  [i]: _(t, s)
590
590
  });
591
- }), (() => u(c, f.body, a, t))), o[1](!0);
591
+ }, () => u(c, f.body, a, t)), o[1](!0);
592
592
  },
593
593
  p() {
594
594
  n && n.P(), r = void 0, o[1](!1), o = f();
@@ -607,23 +607,23 @@ exports.VList = r => {
607
607
  }
608
608
  }
609
609
  const f = $(r), a = b(f), d = S(f), g = () => e.R() - (t ? d.clientWidth : d.clientHeight);
610
- l((() => i + u(r, f.body, a, t) + e.I(n) + ("end" === o ? e.k(n) - (e.R() - g()) : "center" === o ? (e.k(n) - (e.R() - g())) / 2 : 0)), s);
610
+ l(() => i + u(r, f.body, a, t) + e.I(n) + ("end" === o ? e.k(n) - (e.R() - g()) : "center" === o ? (e.k(n) - (e.R() - g())) / 2 : 0), s);
611
611
  }
612
612
  };
613
613
  })(v, g), [z, y] = t.createSignal(v.v());
614
- v.C(1, (() => {
614
+ v.C(1, () => {
615
615
  y(v.v());
616
- })), v.C(4, (() => {
616
+ }), v.C(4, () => {
617
617
  n.onScroll?.();
618
- })), v.C(8, (() => {
618
+ }), v.C(8, () => {
619
619
  n.onScrollEnd?.();
620
- }));
621
- const R = t.createMemo((e => {
620
+ });
621
+ const R = t.createMemo(e => {
622
622
  z();
623
623
  const t = v.S(n.bufferSize);
624
624
  return e && O(e, t) ? e : t;
625
- })), q = t.createMemo((() => z() && v.O())), B = t.createMemo((() => z() && v.J())), C = t.createMemo((() => z() && x.ee()));
626
- t.onMount((() => {
625
+ }), q = t.createMemo(() => z() && v.O()), B = t.createMemo(() => z() && v.J()), C = t.createMemo(() => z() && x.ee());
626
+ t.onMount(() => {
627
627
  n.ref && n.ref({
628
628
  get cache() {
629
629
  return v.m();
@@ -638,28 +638,28 @@ exports.VList = r => {
638
638
  getItemOffset: v.I,
639
639
  getItemSize: v.k,
640
640
  scrollToIndex: x.ne
641
- }), m.G(o), x.Z(o), t.onCleanup((() => {
641
+ }), m.G(o), x.Z(o), t.onCleanup(() => {
642
642
  n.ref && n.ref(), v.p(), m.p(), x.p();
643
- }));
644
- })), t.createEffect(t.on(z, (() => {
643
+ });
644
+ }), t.createEffect(t.on(z, () => {
645
645
  x.oe();
646
- })));
647
- const E = t.createMemo((() => {
646
+ }));
647
+ const E = t.createMemo(() => {
648
648
  const e = n.data.length;
649
- t.untrack((() => {
649
+ t.untrack(() => {
650
650
  e !== v.T() && v.H(5, [ e, n.shift ]);
651
- }));
651
+ });
652
652
  const r = [];
653
653
  for (let [e, t] = R(); e <= t; e++) r.push(n.data[e]);
654
654
  return r;
655
- }));
655
+ });
656
656
  return H = J(), "function" == typeof (L = o) ? e.use(L, H) : o = H, e.insert(H, e.createComponent(t.For, {
657
657
  get each() {
658
658
  return E();
659
659
  },
660
660
  children: (r, o) => {
661
- const s = t.createMemo((() => R()[0] + o())), i = t.createMemo((() => (z(), v.I(s(), C())))), c = t.createMemo((() => (z(),
662
- v._(s())))), l = t.createMemo((() => t.untrack((() => n.children(r, s)))));
661
+ const s = t.createMemo(() => R()[0] + o()), i = t.createMemo(() => (z(), v.I(s(), C()))), c = t.createMemo(() => (z(),
662
+ v._(s()))), l = t.createMemo(() => t.untrack(() => n.children(r, s)));
663
663
  return e.createComponent(M, {
664
664
  get Y() {
665
665
  return s();
@@ -679,11 +679,11 @@ exports.VList = r => {
679
679
  D: g
680
680
  });
681
681
  }
682
- })), e.effect((t => {
682
+ })), e.effect(t => {
683
683
  var r = g ? B() + "px" : "100%", n = g ? "100%" : B() + "px", o = q() ? "none" : void 0;
684
684
  return r !== t.e && e.setStyleProperty(H, "width", t.e = r), n !== t.t && e.setStyleProperty(H, "height", t.t = n),
685
685
  o !== t.a && e.setStyleProperty(H, "pointer-events", t.a = o), t;
686
- }), {
686
+ }, {
687
687
  e: void 0,
688
688
  t: void 0,
689
689
  a: void 0