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.
@@ -2,13 +2,13 @@ import { createComponent as e, Dynamic as t, spread as r, mergeProps as n, inser
2
2
 
3
3
  import { mergeProps as u, createEffect as f, createMemo as a, onCleanup as d, createSignal as g, onMount as h, createComputed as p, on as v, untrack as m, For as S, splitProps as $ } from "solid-js";
4
4
 
5
- const b = null, {min: z, max: w, abs: x, floor: y} = Math, _ = (e, t, r) => z(r, w(t, e)), I = e => [ ...e ].sort(((e, t) => e - t)), k = "function" == typeof queueMicrotask ? queueMicrotask : e => {
5
+ const b = null, {min: z, max: w, abs: x, floor: y} = Math, _ = (e, t, r) => z(r, w(t, e)), I = e => [ ...e ].sort((e, t) => e - t), k = "function" == typeof queueMicrotask ? queueMicrotask : e => {
6
6
  Promise.resolve().then(e);
7
7
  }, T = () => {
8
8
  let e;
9
- return [ new Promise((t => {
9
+ return [ new Promise(t => {
10
10
  e = t;
11
- })), e ];
11
+ }), e ];
12
12
  }, M = e => {
13
13
  let t;
14
14
  return () => (e && (t = e(), e = void 0), t);
@@ -39,8 +39,8 @@ const b = null, {min: z, max: w, abs: x, floor: y} = Math, _ = (e, t, r) => z(r,
39
39
  }, C = (e, t, r) => {
40
40
  const n = t - e.u;
41
41
  return e.l = r ? -1 : z(t - 1, e.l), e.u = t, n > 0 ? (O(e.h, n), O(e.o, n, r),
42
- e.i * n) : (e.h.splice(n), (r ? e.o.splice(0, -n) : e.o.splice(n)).reduce(((t, r) => t - (-1 === r ? e.i : r)), 0));
43
- }, E = e => e.documentElement, H = e => e.ownerDocument, L = e => e.defaultView, W = /*#__PURE__*/ M((() => !!/iP(hone|od|ad)/.test(navigator.userAgent) || "MacIntel" === navigator.platform && navigator.maxTouchPoints > 0)), j = /*#__PURE__*/ M((() => "scrollBehavior" in E(document).style)), q = (e, t = 40, r = 0, n, o = !1) => {
42
+ e.i * n) : (e.h.splice(n), (r ? e.o.splice(0, -n) : e.o.splice(n)).reduce((t, r) => t - (-1 === r ? e.i : r), 0));
43
+ }, E = e => e.documentElement, H = e => e.ownerDocument, L = e => e.defaultView, W = /*#__PURE__*/ M(() => !!/iP(hone|od|ad)/.test(navigator.userAgent) || "MacIntel" === navigator.platform && navigator.maxTouchPoints > 0), j = /*#__PURE__*/ M(() => "scrollBehavior" in E(document).style), q = (e, t = 40, r = 0, n, o = !1) => {
44
44
  let s = !!r, i = 1, c = 0, l = 0, u = 0, f = 0, a = 0, d = 0, g = 0, h = 0, p = b, v = [ 0, s ? w(r - 1, 0) : -1 ], m = 0, S = !1;
45
45
  const $ = ((e, t, r) => ({
46
46
  i: t,
@@ -117,16 +117,16 @@ const b = null, {min: z, max: w, abs: x, floor: y} = Math, _ = (e, t, r) => z(r,
117
117
 
118
118
  case 3:
119
119
  {
120
- const e = t.filter((([e, t]) => !L(e, t)));
120
+ const e = t.filter(([e, t]) => !L(e, t));
121
121
  if (!e.length) break;
122
- j(e.reduce(((e, [t, r]) => {
122
+ j(e.reduce((e, [t, r]) => {
123
123
  let n;
124
124
  if (2 === h) n = !0; else if (p && 1 === h) n = t < p[0]; else {
125
125
  const e = _(), r = E(t), o = H(t);
126
- n = 1 !== g && 0 === h ? r + o < e : r < e && r + o < e + c;
126
+ n = 1 !== g && 0 === h ? r + o <= e : r < e && r + o < e + c;
127
127
  }
128
128
  return n && (e += r - H(t)), e;
129
- }), 0));
129
+ }, 0));
130
130
  for (const [t, r] of e) {
131
131
  const e = H(t), n = J($, t, r);
132
132
  o && (m += n ? r : r - e);
@@ -134,9 +134,9 @@ const b = null, {min: z, max: w, abs: x, floor: y} = Math, _ = (e, t, r) => z(r,
134
134
  o && c && m > c && (j(((e, t) => {
135
135
  let r = 0;
136
136
  const n = [];
137
- e.o.forEach(((e, o) => {
137
+ e.o.forEach((e, o) => {
138
138
  -1 !== e && (n.push(e), o < t && r++);
139
- })), e.l = -1;
139
+ }), e.l = -1;
140
140
  const o = I(n), s = o.length, i = s / 2 | 0, c = s % 2 == 0 ? (o[i - 1] + o[i]) / 2 : o[i], l = e.i;
141
141
  return ((e.i = c) - l) * w(t - r, 0);
142
142
  })($, B($, k()))), o = !1), v = 3, n = !0;
@@ -162,9 +162,9 @@ const b = null, {min: z, max: w, abs: x, floor: y} = Math, _ = (e, t, r) => z(r,
162
162
  case 8:
163
163
  p = T(t, t + c), v = 1;
164
164
  }
165
- v && (i = 1 + (2147483647 & i), r && a && (f += a, a = 0), y.forEach((([e, t]) => {
165
+ v && (i = 1 + (2147483647 & i), r && a && (f += a, a = 0), y.forEach(([e, t]) => {
166
166
  v & e && t(n);
167
- })));
167
+ }));
168
168
  }
169
169
  };
170
170
  }, N = setTimeout, V = (e, t) => t ? -e : e, X = (e, t, r, n, o, s) => {
@@ -175,12 +175,12 @@ const b = null, {min: z, max: w, abs: x, floor: y} = Math, _ = (e, t, r) => z(r,
175
175
  const r = () => {
176
176
  t != b && clearTimeout(t);
177
177
  }, n = () => {
178
- r(), t = N((() => {
178
+ r(), t = N(() => {
179
179
  t = b, (() => {
180
180
  if (l || u) return l = !1, void d();
181
181
  f = !1, e.H(2);
182
182
  })();
183
- }), 150);
183
+ }, 150);
184
184
  };
185
185
  return n.L = r, n;
186
186
  })(), g = () => {
@@ -219,11 +219,11 @@ const b = null, {min: z, max: w, abs: x, floor: y} = Math, _ = (e, t, r) => z(r,
219
219
  const [t, r] = T();
220
220
  return n = () => {
221
221
  r(!1);
222
- }, e.R() && N(n, 150), [ t, e.C(2, (() => {
222
+ }, e.R() && N(n, 150), [ t, e.C(2, () => {
223
223
  r(!0);
224
- })) ];
224
+ }) ];
225
225
  };
226
- if (s && j()) e.H(8, o()), k((async () => {
226
+ if (s && j()) e.H(8, o()), k(async () => {
227
227
  for (;;) {
228
228
  let t = !0;
229
229
  for (let [r, n] = e.S(); r <= n; r++) if (e._(r)) {
@@ -239,7 +239,7 @@ const b = null, {min: z, max: w, abs: x, floor: y} = Math, _ = (e, t, r) => z(r,
239
239
  }
240
240
  }
241
241
  e.H(7), r(o(), s);
242
- })); else for (;;) {
242
+ }); else for (;;) {
243
243
  const [t, n] = i();
244
244
  try {
245
245
  if (e.H(7), r(o()), !await t) return;
@@ -267,10 +267,10 @@ const b = null, {min: z, max: w, abs: x, floor: y} = Math, _ = (e, t, r) => z(r,
267
267
  let n;
268
268
  r = u({
269
269
  V: "div"
270
- }, r), f((() => {
270
+ }, r), f(() => {
271
271
  n && d(r.X(n, r.Y));
272
- }));
273
- const o = a((() => {
272
+ });
273
+ const o = a(() => {
274
274
  const e = r.D, t = {
275
275
  contain: "layout style",
276
276
  position: "absolute",
@@ -280,7 +280,7 @@ const b = null, {min: z, max: w, abs: x, floor: y} = Math, _ = (e, t, r) => z(r,
280
280
  visibility: r.A ? "hidden" : void 0
281
281
  };
282
282
  return e && (t.display = "inline-flex"), t;
283
- }));
283
+ });
284
284
  return e(t, {
285
285
  get component() {
286
286
  return r.V;
@@ -306,14 +306,14 @@ const b = null, {min: z, max: w, abs: x, floor: y} = Math, _ = (e, t, r) => z(r,
306
306
  }, r);
307
307
  const c = q(r.data.length, o, void 0, i, !o), l = ((e, t) => {
308
308
  let r;
309
- const n = t ? "width" : "height", o = new WeakMap, s = D((t => {
309
+ const n = t ? "width" : "height", o = new WeakMap, s = D(t => {
310
310
  const s = [];
311
311
  for (const {target: i, contentRect: c} of t) if (i.offsetParent) if (i === r) e.H(4, c[n]); else {
312
312
  const e = o.get(i);
313
313
  e != b && s.push([ e, c[n] ]);
314
314
  }
315
315
  s.length && e.H(3, s);
316
- }));
316
+ });
317
317
  return {
318
318
  G(e) {
319
319
  s.q(r = e);
@@ -325,33 +325,33 @@ const b = null, {min: z, max: w, abs: x, floor: y} = Math, _ = (e, t, r) => z(r,
325
325
  };
326
326
  })(c, s), $ = ((e, t) => {
327
327
  let r, n, o = T(), s = !1;
328
- const i = t ? "scrollLeft" : "scrollTop", c = t ? "overflowX" : "overflowY", [l, u] = Y(e, (() => o[0]), ((e, n) => {
328
+ const i = t ? "scrollLeft" : "scrollTop", c = t ? "overflowX" : "overflowY", [l, u] = Y(e, () => o[0], (e, n) => {
329
329
  e = V(e, s), n ? r.scrollTo({
330
330
  [t ? "left" : "top"]: e,
331
331
  behavior: "smooth"
332
332
  }) : r[i] = e;
333
- }));
333
+ });
334
334
  return {
335
335
  Z(l, f) {
336
- r = f, t && (s = "rtl" === getComputedStyle(f).direction), n = X(e, f, t, (() => V(f[i], s)), ((t, r, n) => {
336
+ r = f, t && (s = "rtl" === getComputedStyle(f).direction), n = X(e, f, t, () => V(f[i], s), (t, r, n) => {
337
337
  if (n) {
338
338
  const e = f.style, t = e[c];
339
- e[c] = "hidden", N((() => {
339
+ e[c] = "hidden", N(() => {
340
340
  e[c] = t;
341
- }));
341
+ });
342
342
  }
343
343
  f[i] = V(e.M() + t, s), r && u();
344
- })), o[1](!0);
344
+ }), o[1](!0);
345
345
  },
346
346
  p() {
347
347
  n && n.W(), o[1](!1), o = T();
348
348
  },
349
349
  ee: () => s,
350
350
  te(e) {
351
- l((() => e));
351
+ l(() => e);
352
352
  },
353
353
  re(t) {
354
- t += e.M(), l((() => t));
354
+ t += e.M(), l(() => t);
355
355
  },
356
356
  ne(t, {align: r, smooth: n, offset: o = 0} = {}) {
357
357
  if (t = _(t, 0, e.T() - 1), "nearest" === r) {
@@ -361,26 +361,26 @@ const b = null, {min: z, max: w, abs: x, floor: y} = Math, _ = (e, t, r) => z(r,
361
361
  r = "end";
362
362
  }
363
363
  }
364
- l((() => o + e.J() + e.I(t) + ("end" === r ? e.k(t) - e.R() : "center" === r ? (e.k(t) - e.R()) / 2 : 0)), n);
364
+ l(() => o + e.J() + e.I(t) + ("end" === r ? e.k(t) - e.R() : "center" === r ? (e.k(t) - e.R()) / 2 : 0), n);
365
365
  },
366
366
  oe: () => {
367
367
  n && n.j();
368
368
  }
369
369
  };
370
370
  })(c, s), [z, x] = g(c.v());
371
- c.C(1, (() => {
371
+ c.C(1, () => {
372
372
  x(c.v());
373
- })), c.C(4, (() => {
373
+ }), c.C(4, () => {
374
374
  r.onScroll?.(c.M());
375
- })), c.C(8, (() => {
375
+ }), c.C(8, () => {
376
376
  r.onScrollEnd?.();
377
- }));
378
- const y = a((e => {
377
+ });
378
+ const y = a(e => {
379
379
  z();
380
380
  const t = c.S(r.bufferSize);
381
381
  return e && A(e, t) ? e : t;
382
- })), k = a((() => z() && c.O())), M = a((() => z() && c.P())), O = a((() => z() && $.ee()));
383
- h((() => {
382
+ }), k = a(() => z() && c.O()), M = a(() => z() && c.P()), O = a(() => z() && $.ee());
383
+ h(() => {
384
384
  r.ref && r.ref({
385
385
  get cache() {
386
386
  return c.m();
@@ -402,32 +402,32 @@ const b = null, {min: z, max: w, abs: x, floor: y} = Math, _ = (e, t, r) => z(r,
402
402
  scrollBy: $.re
403
403
  });
404
404
  const e = n, t = r.scrollRef || e.parentElement;
405
- l.G(t), $.Z(e, t), d((() => {
405
+ l.G(t), $.Z(e, t), d(() => {
406
406
  r.ref && r.ref(), c.p(), l.p(), $.p();
407
- }));
408
- })), p(v((() => r.startMargin || 0), (e => {
407
+ });
408
+ }), p(v(() => r.startMargin || 0, e => {
409
409
  e !== c.J() && c.H(6, e);
410
- }))), f(v(z, (() => {
410
+ })), f(v(z, () => {
411
411
  $.oe();
412
- })));
413
- const R = a((() => {
412
+ }));
413
+ const R = a(() => {
414
414
  const e = r.data.length;
415
- m((() => {
415
+ m(() => {
416
416
  e !== c.T() && c.H(5, [ e, r.shift ]);
417
- }));
417
+ });
418
418
  const t = [], n = [];
419
419
  if (r.keepMounted) {
420
420
  const e = new Set(r.keepMounted);
421
421
  for (let [t, r] = y(); t <= r; t++) e.add(t);
422
- I([ ...e ]).forEach((e => {
422
+ I([ ...e ]).forEach(e => {
423
423
  t.push(r.data[e]), n.push(e);
424
- }));
424
+ });
425
425
  } else for (let [e, o] = y(); e <= o; e++) t.push(r.data[e]), n.push(e);
426
426
  return {
427
427
  se: t,
428
428
  ie: n
429
429
  };
430
- }));
430
+ });
431
431
  return e(t, {
432
432
  get component() {
433
433
  return r.as;
@@ -452,7 +452,7 @@ const b = null, {min: z, max: w, abs: x, floor: y} = Math, _ = (e, t, r) => z(r,
452
452
  return R().se;
453
453
  },
454
454
  children: (t, n) => ((t, n) => {
455
- const o = a((() => (z(), c.I(n(), O())))), i = a((() => (z(), c._(n())))), u = a((() => m((() => r.children(t, n)))));
455
+ const o = a(() => (z(), c.I(n(), O()))), i = a(() => (z(), c._(n()))), u = a(() => m(() => r.children(t, n)));
456
456
  return e(U, {
457
457
  get V() {
458
458
  return r.item;
@@ -474,7 +474,7 @@ const b = null, {min: z, max: w, abs: x, floor: y} = Math, _ = (e, t, r) => z(r,
474
474
  },
475
475
  D: s
476
476
  });
477
- })(t, a((() => R().ie[n()])))
477
+ })(t, a(() => R().ie[n()]))
478
478
  });
479
479
  }
480
480
  });
@@ -542,7 +542,7 @@ var Q = /*#__PURE__*/ s('<div style="contain:size style;overflow-anchor:none;fle
542
542
  const Z = t => {
543
543
  let r;
544
544
  const {ref: n, data: s, children: u, itemSize: p, shift: $, horizontal: z = !1, cache: w, onScrollEnd: x} = t, y = q(t.data.length, p, void 0, w, !p), I = ((e, t) => {
545
- const r = t ? "width" : "height", n = t ? "innerWidth" : "innerHeight", o = new WeakMap, s = D((t => {
545
+ const r = t ? "width" : "height", n = t ? "innerWidth" : "innerHeight", o = new WeakMap, s = D(t => {
546
546
  const n = [];
547
547
  for (const {target: e, contentRect: s} of t) {
548
548
  if (!e.offsetParent) continue;
@@ -550,7 +550,7 @@ const Z = t => {
550
550
  t != b && n.push([ t, s[r] ]);
551
551
  }
552
552
  n.length && e.H(3, n);
553
- }));
553
+ });
554
554
  let i;
555
555
  return {
556
556
  G(t) {
@@ -570,7 +570,7 @@ const Z = t => {
570
570
  };
571
571
  })(y, z), M = ((e, t) => {
572
572
  let r, n, o = T(), s = !1;
573
- const i = t ? "left" : "top", [c] = Y(e, (() => o[0]), ((e, t) => {
573
+ const i = t ? "left" : "top", [c] = Y(e, () => o[0], (e, t) => {
574
574
  e = V(e, s);
575
575
  const n = L(H(r));
576
576
  t ? n.scroll({
@@ -579,7 +579,7 @@ const Z = t => {
579
579
  }) : n.scroll({
580
580
  [i]: e
581
581
  });
582
- })), l = (e, t, r, n, o = 0) => {
582
+ }), l = (e, t, r, n, o = 0) => {
583
583
  const i = n ? "offsetLeft" : "offsetTop", c = o + (n && s ? r.innerWidth - e[i] - e.offsetWidth : e[i]), u = e.offsetParent;
584
584
  return e !== t && u ? l(u, t, r, n, c) : c;
585
585
  };
@@ -587,13 +587,13 @@ const Z = t => {
587
587
  Z(c) {
588
588
  r = c;
589
589
  const u = t ? "scrollX" : "scrollY", f = H(c), a = L(f);
590
- t && (s = "rtl" === getComputedStyle(E(f)).direction), n = X(e, a, t, (() => V(a[u], s)), ((t, r) => {
590
+ t && (s = "rtl" === getComputedStyle(E(f)).direction), n = X(e, a, t, () => V(a[u], s), (t, r) => {
591
591
  r ? a.scroll({
592
592
  [i]: V(e.M() + t, s)
593
593
  }) : a.scrollBy({
594
594
  [i]: V(t, s)
595
595
  });
596
- }), (() => l(c, f.body, a, t))), o[1](!0);
596
+ }, () => l(c, f.body, a, t)), o[1](!0);
597
597
  },
598
598
  p() {
599
599
  n && n.W(), r = void 0, o[1](!1), o = T();
@@ -612,23 +612,23 @@ const Z = t => {
612
612
  }
613
613
  }
614
614
  const u = H(r), f = L(u), a = E(u), d = () => e.R() - (t ? a.clientWidth : a.clientHeight);
615
- c((() => i + l(r, u.body, f, t) + e.I(n) + ("end" === o ? e.k(n) - (e.R() - d()) : "center" === o ? (e.k(n) - (e.R() - d())) / 2 : 0)), s);
615
+ c(() => i + l(r, u.body, f, t) + e.I(n) + ("end" === o ? e.k(n) - (e.R() - d()) : "center" === o ? (e.k(n) - (e.R() - d())) / 2 : 0), s);
616
616
  }
617
617
  };
618
618
  })(y, z), [O, R] = g(y.v());
619
- y.C(1, (() => {
619
+ y.C(1, () => {
620
620
  R(y.v());
621
- })), y.C(4, (() => {
621
+ }), y.C(4, () => {
622
622
  t.onScroll?.();
623
- })), y.C(8, (() => {
623
+ }), y.C(8, () => {
624
624
  t.onScrollEnd?.();
625
- }));
626
- const J = a((e => {
625
+ });
626
+ const J = a(e => {
627
627
  O();
628
628
  const r = y.S(t.bufferSize);
629
629
  return e && A(e, r) ? e : r;
630
- })), P = a((() => O() && y.O())), B = a((() => O() && y.P())), C = a((() => O() && M.ee()));
631
- h((() => {
630
+ }), P = a(() => O() && y.O()), B = a(() => O() && y.P()), C = a(() => O() && M.ee());
631
+ h(() => {
632
632
  t.ref && t.ref({
633
633
  get cache() {
634
634
  return y.m();
@@ -643,28 +643,28 @@ const Z = t => {
643
643
  getItemOffset: y.I,
644
644
  getItemSize: y.k,
645
645
  scrollToIndex: M.ne
646
- }), I.G(r), M.Z(r), d((() => {
646
+ }), I.G(r), M.Z(r), d(() => {
647
647
  t.ref && t.ref(), y.p(), I.p(), M.p();
648
- }));
649
- })), f(v(O, (() => {
648
+ });
649
+ }), f(v(O, () => {
650
650
  M.oe();
651
- })));
652
- const W = a((() => {
651
+ }));
652
+ const W = a(() => {
653
653
  const e = t.data.length;
654
- m((() => {
654
+ m(() => {
655
655
  e !== y.T() && y.H(5, [ e, t.shift ]);
656
- }));
656
+ });
657
657
  const r = [];
658
658
  for (let [e, n] = J(); e <= n; e++) r.push(t.data[e]);
659
659
  return r;
660
- }));
660
+ });
661
661
  return j = Q(), "function" == typeof r ? i(r, j) : r = j, o(j, e(S, {
662
662
  get each() {
663
663
  return W();
664
664
  },
665
665
  children: (r, n) => {
666
- const o = a((() => J()[0] + n())), s = a((() => (O(), y.I(o(), C())))), i = a((() => (O(),
667
- y._(o())))), c = a((() => m((() => t.children(r, o)))));
666
+ const o = a(() => J()[0] + n()), s = a(() => (O(), y.I(o(), C()))), i = a(() => (O(),
667
+ y._(o()))), c = a(() => m(() => t.children(r, o)));
668
668
  return e(U, {
669
669
  get Y() {
670
670
  return o();
@@ -684,11 +684,11 @@ const Z = t => {
684
684
  D: z
685
685
  });
686
686
  }
687
- })), c((e => {
687
+ })), c(e => {
688
688
  var t = z ? B() + "px" : "100%", r = z ? "100%" : B() + "px", n = P() ? "none" : void 0;
689
689
  return t !== e.e && l(j, "width", e.e = t), r !== e.t && l(j, "height", e.t = r),
690
690
  n !== e.a && l(j, "pointer-events", e.a = n), e;
691
- }), {
691
+ }, {
692
692
  e: void 0,
693
693
  t: void 0,
694
694
  a: void 0