virtua 0.53.4 → 0.53.5

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.
@@ -21,7 +21,7 @@ t), m = (t, e, o) => {
21
21
  t(e) <= o ? (c = e, n = e + 1) : s = e - 1;
22
22
  }
23
23
  return l(c, 0, e - 1);
24
- }, w = t => "number" == typeof t ? t : t.length, h = /*#__PURE__*/ new WeakMap, S = (t, e, o) => {
24
+ }, h = t => "number" == typeof t ? t : t.length, w = /*#__PURE__*/ new WeakMap, S = (t, e, o) => {
25
25
  const n = [];
26
26
  for (const s of t) s >= e && s < o && n.push(s);
27
27
  return c(n);
@@ -87,8 +87,8 @@ t), m = (t, e, o) => {
87
87
  }
88
88
  };
89
89
  }, L = (t, e, o, n, s, r, l, c) => {
90
- let a, $, p = 0, g = !1, m = !1, x = !1, w = !1;
91
- const h = Date.now, S = s ? "scrollLeft" : "scrollTop", b = s ? "left" : "top", v = t => r ? -t : t, I = () => v(n[S]), y = (t, e) => {
90
+ let a, $, p = 0, g = !1, m = !1, x = !1, h = !1;
91
+ const w = Date.now, S = s ? "scrollLeft" : "scrollTop", b = s ? "left" : "top", v = t => r ? -t : t, I = () => v(n[S]), y = (t, e) => {
92
92
  n.scrollTo({
93
93
  [b]: v(t),
94
94
  behavior: e ? "smooth" : "instant"
@@ -99,13 +99,13 @@ t), m = (t, e, o) => {
99
99
  }, k = () => {
100
100
  f($), $ = i(z, 150);
101
101
  }, M = () => {
102
- p = h(), x && (w = !0), c && t.$update(7, c()), t.$update(1, I()), k();
102
+ p = w(), x && (h = !0), c && t.$update(7, c()), t.$update(1, I()), k();
103
103
  }, T = e => {
104
104
  if (g || !t.$isScrolling() || e.ctrlKey) return;
105
- const o = h() - p;
105
+ const o = w() - p;
106
106
  150 > o && 50 < o && (s ? e.deltaX : e.deltaY) && (g = !0);
107
107
  }, L = () => {
108
- m = !0, x = w = !1;
108
+ m = !0, x = h = !1;
109
109
  }, R = () => {
110
110
  m = !1, d() && (x = !0);
111
111
  };
@@ -115,16 +115,18 @@ t), m = (t, e, o) => {
115
115
  passive: !0
116
116
  }), o.addEventListener("touchend", R, {
117
117
  passive: !0
118
+ }), o.addEventListener("touchcancel", R, {
119
+ passive: !0
118
120
  }), {
119
121
  i: M,
120
122
  l: () => {
121
123
  o.removeEventListener("scroll", M), o.removeEventListener("wheel", T), o.removeEventListener("touchstart", L),
122
- o.removeEventListener("touchend", R), f($);
124
+ o.removeEventListener("touchend", R), o.removeEventListener("touchcancel", R), f($);
123
125
  },
124
126
  u: () => {
125
127
  const [e, o] = t.$();
126
128
  if (!e) return;
127
- w && l && l(), w = !1;
129
+ h && l && l(), h = !1;
128
130
  const s = t.$getScrollOffset(), r = s + e, c = t.$getStartSpacerSize() + t.$getTotalSize() - t.$getViewportSize();
129
131
  r <= 0 || r >= c || s >= c ? y(r) : n.scrollBy({
130
132
  [b]: v(e),
@@ -257,9 +259,9 @@ exports.UPDATE_VIRTUAL_STATE = 1, exports.createContainerDriver = (t, e, o) => {
257
259
  }
258
260
  };
259
261
  }, exports.createGridLayout = (t, e, s = 0) => {
260
- let i = w(t);
262
+ let i = h(t);
261
263
  const f = "number" == typeof e, u = "auto" === e;
262
- let a = (f ? e : 40) + s, $ = -1, p = 0, g = u, d = 0, h = 0, S = null;
264
+ let a = (f ? e : 40) + s, $ = -1, p = 0, g = u, d = 0, w = 0, S = null;
263
265
  const b = [], v = [], I = [], y = t => u || !!I[t], z = () => {
264
266
  b.length || m(b, i);
265
267
  }, k = t => {
@@ -275,7 +277,7 @@ exports.UPDATE_VIRTUAL_STATE = 1, exports.createContainerDriver = (t, e, o) => {
275
277
  return $ = t, o;
276
278
  }, T = (t, e) => {
277
279
  b[t] = e, $ = o(t, $);
278
- }, L = t => b.length ? x(M, i, t) : a ? l(r(t / a), 0, i - 1) : 0, R = () => o(d, i), O = () => n(i - h, R()), _ = t => (b.length ? k(t) : a) - s;
280
+ }, L = t => b.length ? x(M, i, t) : a ? l(r(t / a), 0, i - 1) : 0, R = () => o(d, i), O = () => n(i - w, R()), _ = t => (b.length ? k(t) : a) - s;
279
281
  return {
280
282
  $getRange: (t, e) => {
281
283
  const o = M(R()), r = M(i) - M(O()), l = t + (o ? o - s : 0);
@@ -308,7 +310,7 @@ exports.UPDATE_VIRTUAL_STATE = 1, exports.createContainerDriver = (t, e, o) => {
308
310
  $isEstimating: () => g,
309
311
  $isMeasurable: y,
310
312
  $setPinned: (t = 0, e = 0) => {
311
- d = t, h = e;
313
+ d = t, w = e;
312
314
  },
313
315
  $getPinnedStart: R,
314
316
  $getTrailStart: O,
@@ -334,17 +336,17 @@ exports.UPDATE_VIRTUAL_STATE = 1, exports.createContainerDriver = (t, e, o) => {
334
336
  }
335
337
  };
336
338
  }, exports.createGridPlan = (t, s, [r, i], [f, u], a, $ = e, p = e, g) => {
337
- const d = t.$getLength(), m = s.$getLength(), x = t.$getPinnedStart(), w = t.$getTrailStart(), v = s.$getPinnedStart(), T = s.$getTrailStart();
338
- r = l(r, x, w), i = o(i, w - 1), f = l(f, v, T), u = o(u, T - 1);
339
- const L = S($, x, w), R = n(v - 1, 0), O = [], _ = [], E = [];
339
+ const d = t.$getLength(), m = s.$getLength(), x = t.$getPinnedStart(), h = t.$getTrailStart(), v = s.$getPinnedStart(), T = s.$getTrailStart();
340
+ r = l(r, x, h), i = o(i, h - 1), f = l(f, v, T), u = o(u, T - 1);
341
+ const L = S($, x, h), R = n(v - 1, 0), O = [], _ = [], E = [];
340
342
  for (const t of p) t.rowIndex < d && t.colIndex < m && (E.push(t), O.push(t.rowIndex));
341
- const C = E.length, q = b(L, r, w), A = q < 0 ? -1 : L[q];
343
+ const C = E.length, q = b(L, r, h), A = q < 0 ? -1 : L[q];
342
344
  A >= 0 && O.push(A);
343
- const P = I(c(O), d, x, r, i, w);
345
+ const P = I(c(O), d, x, r, i, h);
344
346
  for (let t = 0; t < P.length; t++) for (const s of a.get(P[t]) || e) {
345
347
  const {rowIndex: e, colIndex: l} = s, c = y(s, d), a = z(s, m);
346
348
  if ((t < 1 || P[t - 1] < e) && l < m && (c - e > 1 || a - l > 1)) {
347
- let t = (e < x || n(e, r) < o(c, i + 1) || w < c || A >= e && A < c) && (l < v || n(l, f) < o(a, u + 1) || T < a);
349
+ let t = (e < x || n(e, r) < o(c, i + 1) || h < c || A >= e && A < c) && (l < v || n(l, f) < o(a, u + 1) || T < a);
348
350
  for (let o = 0; !t && o < C; o++) {
349
351
  const n = E[o];
350
352
  t = n.rowIndex >= e && n.rowIndex < c && n.colIndex >= l && n.colIndex < a;
@@ -353,11 +355,11 @@ exports.UPDATE_VIRTUAL_STATE = 1, exports.createContainerDriver = (t, e, o) => {
353
355
  }
354
356
  }
355
357
  for (const {rowIndex: t, colIndex: e} of E) {
356
- const o = b(L, t, w);
358
+ const o = b(L, t, h);
357
359
  O.push(t), o >= 0 && O.push(L[o]), _.push(e);
358
360
  }
359
361
  c(O), c(_);
360
- const W = I(O, d, x, r, i, w), B = I(_, m, v, f, u, T), J = W.length, V = B.length, X = /* @__PURE__ */ new Map, Y = [], j = [];
362
+ const W = I(O, d, x, r, i, h), B = I(_, m, v, f, u, T), J = W.length, V = B.length, X = /* @__PURE__ */ new Map, Y = [], j = [];
361
363
  for (const t of E) {
362
364
  const e = y(t, d), o = z(t, m);
363
365
  Y.push(e), j.push(o);
@@ -371,11 +373,11 @@ exports.UPDATE_VIRTUAL_STATE = 1, exports.createContainerDriver = (t, e, o) => {
371
373
  for (const t of B) D.push(!s.$isMeasurable(t) && null);
372
374
  const G = [], Z = t.$getItemOffset(x), F = [];
373
375
  let H = F;
374
- const K = h.get(t), N = /* @__PURE__ */ new Map;
376
+ const K = w.get(t), N = /* @__PURE__ */ new Map;
375
377
  for (const e of W) {
376
- const o = e < x, l = e >= w, c = b(L, e, w), a = o ? 0 : l ? w : c < 0 ? -1 : L[c];
378
+ const o = e < x, l = e >= h, c = b(L, e, h), a = o ? 0 : l ? h : c < 0 ? -1 : L[c];
377
379
  if (e === a) {
378
- const t = o ? x : l ? d : c + 1 < L.length ? L[c + 1] : w;
380
+ const t = o ? x : l ? d : c + 1 < L.length ? L[c + 1] : h;
379
381
  Y.push(t);
380
382
  const e = [];
381
383
  F.push({
@@ -384,17 +386,17 @@ exports.UPDATE_VIRTUAL_STATE = 1, exports.createContainerDriver = (t, e, o) => {
384
386
  $style: M(a, t, o || l ? 0 : null, l ? "bottom" : "top", 4)
385
387
  }), H = e;
386
388
  } else a < 0 && (H = F);
387
- const $ = c >= 0 && e === a, p = o || l || e === A || e >= r && e <= i, h = $ ? Z : null, S = e * m, I = K && K.get(e), k = I && I.$cells, O = [];
389
+ const $ = c >= 0 && e === a, p = o || l || e === A || e >= r && e <= i, w = $ ? Z : null, S = e * m, I = K && K.get(e), k = I && I.$cells, O = [];
388
390
  let _ = 0, E = !t.$isMeasurable(e) && null, C = e + 1, q = !1;
389
391
  for (let t = 0; t < V; t++) {
390
392
  const r = B[t], l = r < v, c = r >= T, i = l || c || r >= f && r <= u, a = X.get(S + r);
391
393
  if (a ? a.rowIndex === e && a.colIndex === r : p && i) {
392
- const i = a ? y(a, d) : e + 1, f = a ? z(a, m) : r + 1, u = i - e, p = f - r, x = u > 1, w = p > 1, h = x || w;
394
+ const i = a ? y(a, d) : e + 1, f = a ? z(a, m) : r + 1, u = i - e, p = f - r, x = u > 1, h = p > 1, w = x || h;
393
395
  let S, b;
394
396
  C = n(C, i);
395
397
  const v = l ? s.$getItemOffset(r) : null, I = c ? s.$getItemOffset(m) - s.$getItemOffset(f) : null;
396
- !1 !== E || x || (S = e, E = !0), !1 !== D[t] || w || (b = r, D[t] = !0);
397
- const M = o ? "columnheader" : r === R && (l || $) ? "rowheader" : "cell", T = h ? u : void 0, L = h ? p : void 0, A = "cell" !== M && g && g.rowIndex === e && g.colIndex === r ? g.order : void 0;
398
+ !1 !== E || x || (S = e, E = !0), !1 !== D[t] || h || (b = r, D[t] = !0);
399
+ const M = o ? "columnheader" : r === R && (l || $) ? "rowheader" : "cell", T = w ? u : void 0, L = w ? p : void 0, A = "cell" !== M && g && g.rowIndex === e && g.colIndex === r ? g.order : void 0;
398
400
  let P;
399
401
  if (k) {
400
402
  const t = k.length;
@@ -403,13 +405,13 @@ exports.UPDATE_VIRTUAL_STATE = 1, exports.createContainerDriver = (t, e, o) => {
403
405
  }
404
406
  if (!P || P.$rowSpan !== T || P.$colSpan !== L || P.$start !== v || P.$end !== I || P.$measureRow !== S || P.$measureCol !== b || P.$role !== M || P.$sort !== A) {
405
407
  let t = "1/l" + r;
406
- h && (t += "/l" + i + "/l" + f);
408
+ w && (t += "/l" + i + "/l" + f);
407
409
  const e = {
408
410
  contain: "layout style",
409
411
  display: "grid",
410
412
  gridArea: t
411
413
  };
412
- x && (e.height = "0px", e.minHeight = "100%", e.zIndex = 1), w && (e.width = "0px",
414
+ x && (e.height = "0px", e.minHeight = "100%", e.zIndex = 1), h && (e.width = "0px",
413
415
  e.minWidth = "100%"), (l || c) && (e[l ? "insetInlineStart" : "insetInlineEnd"] = (l ? v : I) + "px",
414
416
  e.position = "sticky", e.zIndex = 2), P = {
415
417
  $col: r,
@@ -428,16 +430,16 @@ exports.UPDATE_VIRTUAL_STATE = 1, exports.createContainerDriver = (t, e, o) => {
428
430
  }
429
431
  }
430
432
  if (G.push(E), O.length) {
431
- const t = I && !q && I.$cells.length === O.length && I.$top === h ? I : {
433
+ const t = I && !q && I.$cells.length === O.length && I.$top === w ? I : {
432
434
  $row: e,
433
435
  $cells: O,
434
- $style: M(e, C, h, "top", 3),
435
- $top: h
436
+ $style: M(e, C, w, "top", 3),
437
+ $top: w
436
438
  };
437
439
  N.set(e, t), H.push(t);
438
440
  }
439
441
  }
440
- return h.set(t, N), {
442
+ return w.set(t, N), {
441
443
  $rowTemplate: k(t, W, G, c(Y), "max-content", d),
442
444
  $colTemplate: k(s, B, D, c(j), "minmax(max-content,auto)", m),
443
445
  $groups: F
@@ -501,7 +503,7 @@ exports.UPDATE_VIRTUAL_STATE = 1, exports.createContainerDriver = (t, e, o) => {
501
503
  let i = n(e, 1), f = l && l[1] || r || 40, u = -1, a = r ? void 0 : /* @__PURE__ */ new Set, $ = !r;
502
504
  const p = l ? l[0].slice(0, t) : [];
503
505
  m(p, t - p.length);
504
- const g = [], d = [], w = [ 0 ], h = t => {
506
+ const g = [], d = [], h = [ 0 ], w = t => {
505
507
  const e = p[t];
506
508
  return -1 === e ? f : e;
507
509
  }, S = () => {
@@ -510,7 +512,7 @@ exports.UPDATE_VIRTUAL_STATE = 1, exports.createContainerDriver = (t, e, o) => {
510
512
  for (let t = 0; t < i; t++) e.push(0), o.push(-1);
511
513
  for (let t = u, n = i; t >= 0 && n; t--) {
512
514
  const r = d[t];
513
- -1 === o[r] && (o[r] = t, e[r] = g[t] + h(t) + s, n--);
515
+ -1 === o[r] && (o[r] = t, e[r] = g[t] + w(t) + s, n--);
514
516
  }
515
517
  for (;u < t - 1; ) {
516
518
  const t = ++u;
@@ -519,10 +521,10 @@ exports.UPDATE_VIRTUAL_STATE = 1, exports.createContainerDriver = (t, e, o) => {
519
521
  const n = e[t];
520
522
  (n < l || n === l && o[t] < c) && (r = t, l = n, c = o[t]);
521
523
  }
522
- const f = l + h(t);
523
- g[t] = l, d[t] = r, e[r] = f + s, o[r] = t, w[t + 1] = n(w[t], f);
524
+ const f = l + w(t);
525
+ g[t] = l, d[t] = r, e[r] = f + s, o[r] = t, h[t + 1] = n(h[t], f);
524
526
  }
525
- }, b = e => e >= t ? I() : (S(), g[e]), v = t => (S(), w[t]), I = () => v(t), y = e => x(v, t + 1, e);
527
+ }, b = e => e >= t ? I() : (S(), g[e]), v = t => (S(), h[t]), I = () => v(t), y = e => x(v, t + 1, e);
526
528
  return {
527
529
  $getRange: (e, n) => {
528
530
  const s = x(b, t, n);
@@ -530,7 +532,7 @@ exports.UPDATE_VIRTUAL_STATE = 1, exports.createContainerDriver = (t, e, o) => {
530
532
  },
531
533
  $findIndex: y,
532
534
  $getItemOffset: b,
533
- $getItemSize: h,
535
+ $getItemSize: w,
534
536
  $isSizeEqual: (t, e = -1) => p[t] === e,
535
537
  $setItemSizes: (t, e) => {
536
538
  for (const [e, n] of t) p[e] = n, a && a.add(e), u = o(e - 1, u);
@@ -562,12 +564,12 @@ exports.UPDATE_VIRTUAL_STATE = 1, exports.createContainerDriver = (t, e, o) => {
562
564
  $getItemLane: t => (S(), d[t])
563
565
  };
564
566
  }, exports.createVirtualStore = ({$getRange: t, $findIndex: e, $getItemOffset: r, $getItemSize: l, $setItemSizes: c, $getTotalSize: i, $getLength: f, $setLength: u, $isEstimating: a}, $ = 0) => {
565
- let p = !!$, g = 1, m = 0, x = 0, w = 0, h = 0, S = 0, b = 0, v = 0, I = 0, y = null, z = [ 0, p ? n($ - 1, 0) : -1 ], k = !1;
566
- const M = /* @__PURE__ */ new Set, T = () => w - x, L = () => T() + S + h, R = (t, e) => {
567
+ let p = !!$, g = 1, m = 0, x = 0, h = 0, w = 0, S = 0, b = 0, v = 0, I = 0, y = null, z = [ 0, p ? n($ - 1, 0) : -1 ], k = !1;
568
+ const M = /* @__PURE__ */ new Set, T = () => h - x, L = () => T() + S + w, R = (t, e) => {
567
569
  const o = r(t), n = l(t);
568
570
  return 1 !== v && 0 === I ? o + n <= e : o < e && o + n < e + m;
569
571
  }, O = t => {
570
- t && (d() && 0 !== v || y && 1 === I ? S += t : h += t);
572
+ t && (d() && 0 !== v || y && 1 === I ? S += t : w += t);
571
573
  }, _ = () => {
572
574
  const t = f();
573
575
  if (2 === I) return t;
@@ -595,12 +597,12 @@ exports.UPDATE_VIRTUAL_STATE = 1, exports.createContainerDriver = (t, e, o) => {
595
597
  },
596
598
  m: _,
597
599
  $getItemOffset: t => r(t) - S,
598
- $getScrollOffset: () => w,
600
+ $getScrollOffset: () => h,
599
601
  $isScrolling: () => 0 !== v,
600
602
  $getViewportSize: () => m,
601
603
  $getStartSpacerSize: () => x,
602
604
  $getTotalSize: i,
603
- $: () => (b = h, h = 0, [ b, 2 === I ]),
605
+ $: () => (b = w, w = 0, [ b, 2 === I ]),
604
606
  $subscribe: (t, e) => {
605
607
  const o = [ t, e ];
606
608
  return M.add(o), () => {
@@ -612,11 +614,11 @@ exports.UPDATE_VIRTUAL_STATE = 1, exports.createContainerDriver = (t, e, o) => {
612
614
  switch (e) {
613
615
  case 1:
614
616
  {
615
- if (o === w && 0 === I) break;
617
+ if (o === h && 0 === I) break;
616
618
  const t = b;
617
619
  b = 0;
618
- const e = o - w, n = s(e);
619
- t && n < s(t) + 1 || 0 !== I || (v = e < 0 ? 2 : 1), p && (p = !1), w = o, $ = 4;
620
+ const e = o - h, n = s(e);
621
+ t && n < s(t) + 1 || 0 !== I || (v = e < 0 ? 2 : 1), p && (p = !1), h = o, $ = 4;
620
622
  const r = T();
621
623
  r >= -m && r <= i() && ($ += 1, a = n > m);
622
624
  break;
@@ -662,7 +664,7 @@ exports.UPDATE_VIRTUAL_STATE = 1, exports.createContainerDriver = (t, e, o) => {
662
664
  case 9:
663
665
  y = t(o, o + m), $ = 1;
664
666
  }
665
- $ && (g = 1 + (2147483647 & g), l && S && (h += S, S = 0), M.forEach(([t, e]) => {
667
+ $ && (g = 1 + (2147483647 & g), l && S && (w += S, S = 0), M.forEach(([t, e]) => {
666
668
  $ & t && e(a);
667
669
  }));
668
670
  }
@@ -685,12 +687,12 @@ exports.UPDATE_VIRTUAL_STATE = 1, exports.createContainerDriver = (t, e, o) => {
685
687
  const a = p(f), $ = g(a), d = n = a.scrollingElement, m = o && "rtl" === getComputedStyle(d).direction, x = (t, e, o, n, s = 0) => {
686
688
  const r = n ? "offsetLeft" : "offsetTop", l = s + (m ? e.clientWidth - t[r] - t.offsetWidth : t[r]), c = t.offsetParent;
687
689
  return t !== o && c ? x(c, e, o, n, l) : l;
688
- }, w = l = () => x(f, d, a.body, o), h = c = () => {
690
+ }, h = l = () => x(f, d, a.body, o), w = c = () => {
689
691
  t.$update(4, d[o ? "clientWidth" : "clientHeight"]);
690
692
  };
691
- $.addEventListener("resize", h), u.t(d), r = () => {
692
- $.removeEventListener("resize", h);
693
- }, s = L(t, e, $, d, o, m, null, w), i[1](!0);
693
+ $.addEventListener("resize", w), u.t(d), r = () => {
694
+ $.removeEventListener("resize", w);
695
+ }, s = L(t, e, $, d, o, m, null, h), i[1](!0);
694
696
  },
695
697
  $dispose() {
696
698
  r && r(), u.l(), s && s.l(), i[1](!1), i = a();
@@ -706,7 +708,7 @@ exports.UPDATE_VIRTUAL_STATE = 1, exports.createContainerDriver = (t, e, o) => {
706
708
  },
707
709
  $getBaseOffset: () => l()
708
710
  };
709
- }, exports.getAxisItem = (t, e) => "number" == typeof t ? e : t[e], exports.getAxisLength = w,
711
+ }, exports.getAxisItem = (t, e) => "number" == typeof t ? e : t[e], exports.getAxisLength = h,
710
712
  exports.getScrollSize = t => n(t.$getTotalSize(), t.$getViewportSize()), exports.gridScrollBy = (t, e, o, n, s) => {
711
713
  if (null != n) {
712
714
  const o = n + e.$getScrollOffset();
@@ -724,7 +726,7 @@ exports.getScrollSize = t => n(t.$getTotalSize(), t.$getViewportSize()), exports
724
726
  let e = "";
725
727
  for (const o in t) e += o.replace(/[A-Z]/g, t => "-" + t.toLowerCase()) + ":" + t[o] + ";";
726
728
  return e;
727
- }, exports.isBrowser = $, exports.microtask = u, exports.relayout = (t, e, o, n) => {
729
+ }, exports.isBrowser = $, exports.microtask = u, exports.min = o, exports.relayout = (t, e, o, n) => {
728
730
  const s = t.m(), r = e.$getItemOffset(s);
729
731
  e.$relayout(o, n) && t.$update(6, e.$getItemOffset(s) - r);
730
732
  }, exports.scrollBy = (t, e, o) => {