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.
@@ -1,10 +1,10 @@
1
- const e = null, {min: t, max: o, abs: r, floor: s} = Math, n = (e, r, s) => t(s, o(r, e)), i = e => [ ...e ].sort(((e, t) => e - t)), c = "function" == typeof queueMicrotask ? queueMicrotask : e => {
1
+ const e = null, {min: t, max: o, abs: r, floor: s} = Math, n = (e, r, s) => t(s, o(r, e)), i = e => [ ...e ].sort((e, t) => e - t), c = "function" == typeof queueMicrotask ? queueMicrotask : e => {
2
2
  Promise.resolve().then(e);
3
3
  }, l = () => {
4
4
  let e;
5
- return [ new Promise((t => {
5
+ return [ new Promise(t => {
6
6
  e = t;
7
- })), e ];
7
+ }), e ];
8
8
  }, f = e => {
9
9
  let t;
10
10
  return () => (e && (t = e(), e = void 0), t);
@@ -35,8 +35,8 @@ const e = null, {min: t, max: o, abs: r, floor: s} = Math, n = (e, r, s) => t(s,
35
35
  }, h = (e, o, r) => {
36
36
  const s = o - e.l;
37
37
  return e.i = r ? -1 : t(o - 1, e.i), e.l = o, s > 0 ? (a(e.u, s), a(e.t, s, r),
38
- e.o * s) : (e.u.splice(s), (r ? e.t.splice(0, -s) : e.t.splice(s)).reduce(((t, o) => t - (-1 === o ? e.o : o)), 0));
39
- }, g = "undefined" != typeof window, m = e => e.documentElement, v = e => e.ownerDocument, b = e => e.defaultView, w = /*#__PURE__*/ f((() => !!/iP(hone|od|ad)/.test(navigator.userAgent) || "MacIntel" === navigator.platform && navigator.maxTouchPoints > 0)), x = /*#__PURE__*/ f((() => "scrollBehavior" in m(document).style)), S = setTimeout, k = (e, t) => t ? -e : e, I = (t, o, r, s, n, i) => {
38
+ e.o * s) : (e.u.splice(s), (r ? e.t.splice(0, -s) : e.t.splice(s)).reduce((t, o) => t - (-1 === o ? e.o : o), 0));
39
+ }, g = "undefined" != typeof window, m = e => e.documentElement, v = e => e.ownerDocument, b = e => e.defaultView, w = /*#__PURE__*/ f(() => !!/iP(hone|od|ad)/.test(navigator.userAgent) || "MacIntel" === navigator.platform && navigator.maxTouchPoints > 0), x = /*#__PURE__*/ f(() => "scrollBehavior" in m(document).style), S = setTimeout, k = (e, t) => t ? -e : e, I = (t, o, r, s, n, i) => {
40
40
  const c = Date.now;
41
41
  let l = 0, f = !1, a = !1, u = !1, p = !1;
42
42
  const $ = (() => {
@@ -44,12 +44,12 @@ const e = null, {min: t, max: o, abs: r, floor: s} = Math, n = (e, r, s) => t(s,
44
44
  const r = () => {
45
45
  o != e && clearTimeout(o);
46
46
  }, s = () => {
47
- r(), o = S((() => {
47
+ r(), o = S(() => {
48
48
  o = e, (() => {
49
49
  if (f || a) return f = !1, void $();
50
50
  u = !1, t.$update(2);
51
51
  })();
52
- }), 150);
52
+ }, 150);
53
53
  };
54
54
  return s.p = r, s;
55
55
  })(), d = () => {
@@ -88,11 +88,11 @@ const e = null, {min: t, max: o, abs: r, floor: s} = Math, n = (e, r, s) => t(s,
88
88
  const [t, o] = l();
89
89
  return r = () => {
90
90
  o(!1);
91
- }, e.$getViewportSize() && S(r, 150), [ t, e.$subscribe(2, (() => {
91
+ }, e.$getViewportSize() && S(r, 150), [ t, e.$subscribe(2, () => {
92
92
  o(!0);
93
- })) ];
93
+ }) ];
94
94
  };
95
- if (n && x()) e.$update(8, s()), c((async () => {
95
+ if (n && x()) e.$update(8, s()), c(async () => {
96
96
  for (;;) {
97
97
  let t = !0;
98
98
  for (let [o, r] = e.$getRange(); o <= r; o++) if (e.$isUnmeasuredItem(o)) {
@@ -108,7 +108,7 @@ const e = null, {min: t, max: o, abs: r, floor: s} = Math, n = (e, r, s) => t(s,
108
108
  }
109
109
  }
110
110
  e.$update(7), o(s(), n);
111
- })); else for (;;) {
111
+ }); else for (;;) {
112
112
  const [t, r] = i();
113
113
  try {
114
114
  if (e.$update(7), o(s()), !await t) return;
@@ -121,33 +121,33 @@ const e = null, {min: t, max: o, abs: r, floor: s} = Math, n = (e, r, s) => t(s,
121
121
  } ];
122
122
  }, _ = (e, t) => {
123
123
  let o, r, s = l(), i = !1;
124
- const c = t ? "scrollLeft" : "scrollTop", f = t ? "overflowX" : "overflowY", [a, u] = y(e, (() => s[0]), ((e, r) => {
124
+ const c = t ? "scrollLeft" : "scrollTop", f = t ? "overflowX" : "overflowY", [a, u] = y(e, () => s[0], (e, r) => {
125
125
  e = k(e, i), r ? o.scrollTo({
126
126
  [t ? "left" : "top"]: e,
127
127
  behavior: "smooth"
128
128
  }) : o[c] = e;
129
- }));
129
+ });
130
130
  return {
131
131
  $observe(n, l) {
132
- o = l, t && (i = "rtl" === getComputedStyle(l).direction), r = I(e, l, t, (() => k(l[c], i)), ((t, o, r) => {
132
+ o = l, t && (i = "rtl" === getComputedStyle(l).direction), r = I(e, l, t, () => k(l[c], i), (t, o, r) => {
133
133
  if (r) {
134
134
  const e = l.style, t = e[f];
135
- e[f] = "hidden", S((() => {
135
+ e[f] = "hidden", S(() => {
136
136
  e[f] = t;
137
- }));
137
+ });
138
138
  }
139
139
  l[c] = k(e.$getScrollOffset() + t, i), o && u();
140
- })), s[1](!0);
140
+ }), s[1](!0);
141
141
  },
142
142
  $dispose() {
143
143
  r && r.$(), s[1](!1), s = l();
144
144
  },
145
145
  $isNegative: () => i,
146
146
  $scrollTo(e) {
147
- a((() => e));
147
+ a(() => e);
148
148
  },
149
149
  $scrollBy(t) {
150
- t += e.$getScrollOffset(), a((() => t));
150
+ t += e.$getScrollOffset(), a(() => t);
151
151
  },
152
152
  $scrollToIndex(t, {align: o, smooth: r, offset: s = 0} = {}) {
153
153
  if (t = n(t, 0, e.$getItemsLength() - 1), "nearest" === o) {
@@ -157,7 +157,7 @@ const e = null, {min: t, max: o, abs: r, floor: s} = Math, n = (e, r, s) => t(s,
157
157
  o = "end";
158
158
  }
159
159
  }
160
- a((() => s + e.$getStartSpacerSize() + e.$getItemOffset(t) + ("end" === o ? e.$getItemSize(t) - e.$getViewportSize() : "center" === o ? (e.$getItemSize(t) - e.$getViewportSize()) / 2 : 0)), r);
160
+ a(() => s + e.$getStartSpacerSize() + e.$getItemOffset(t) + ("end" === o ? e.$getItemSize(t) - e.$getViewportSize() : "center" === o ? (e.$getItemSize(t) - e.$getViewportSize()) / 2 : 0), r);
161
161
  },
162
162
  $fixScrollJump: () => {
163
163
  r && r.h();
@@ -182,7 +182,7 @@ exports.ACTION_ITEMS_LENGTH_CHANGE = 5, exports.ACTION_START_OFFSET_CHANGE = 6,
182
182
  exports.UPDATE_SCROLL_END_EVENT = 8, exports.UPDATE_SCROLL_EVENT = 4, exports.UPDATE_VIRTUAL_STATE = 1,
183
183
  exports.createGridResizer = (e, t) => {
184
184
  let r;
185
- const s = new WeakMap, n = new Set, i = new Set, c = new Map, l = (e, t) => `${e}-${t}`, f = z((f => {
185
+ const s = new WeakMap, n = new Set, i = new Set, c = new Map, l = (e, t) => `${e}-${t}`, f = z(f => {
186
186
  const a = new Set, u = new Set;
187
187
  for (const {target: o, contentRect: {width: n, height: i}} of f) if (o.offsetParent) if (o === r) e.$update(4, i),
188
188
  t.$update(4, n); else {
@@ -196,25 +196,25 @@ exports.createGridResizer = (e, t) => {
196
196
  }
197
197
  if (a.size) {
198
198
  const t = [];
199
- a.forEach((e => {
199
+ a.forEach(e => {
200
200
  let r = 0;
201
- i.forEach((t => {
201
+ i.forEach(t => {
202
202
  const s = c.get(l(e, t));
203
203
  s && (r = o(r, s[0]));
204
- })), r && t.push([ e, r ]);
205
- })), e.$update(3, t);
204
+ }), r && t.push([ e, r ]);
205
+ }), e.$update(3, t);
206
206
  }
207
207
  if (u.size) {
208
208
  const e = [];
209
- u.forEach((t => {
209
+ u.forEach(t => {
210
210
  let r = 0;
211
- n.forEach((e => {
211
+ n.forEach(e => {
212
212
  const s = c.get(l(e, t));
213
213
  s && (r = o(r, s[1]));
214
- })), r && e.push([ t, r ]);
215
- })), t.$update(3, e);
214
+ }), r && e.push([ t, r ]);
215
+ }), t.$update(3, e);
216
216
  }
217
- }));
217
+ });
218
218
  return {
219
219
  $observeRoot(e) {
220
220
  f.v(r = e);
@@ -257,14 +257,14 @@ exports.createGridResizer = (e, t) => {
257
257
  };
258
258
  }, exports.createResizer = (t, o) => {
259
259
  let r;
260
- const s = o ? "width" : "height", n = new WeakMap, i = z((o => {
260
+ const s = o ? "width" : "height", n = new WeakMap, i = z(o => {
261
261
  const i = [];
262
262
  for (const {target: c, contentRect: l} of o) if (c.offsetParent) if (c === r) t.$update(4, l[s]); else {
263
263
  const t = n.get(c);
264
264
  t != e && i.push([ t, l[s] ]);
265
265
  }
266
266
  i.length && t.$update(3, i);
267
- }));
267
+ });
268
268
  return {
269
269
  $observeRoot(e) {
270
270
  i.v(r = e);
@@ -351,16 +351,16 @@ exports.createGridResizer = (e, t) => {
351
351
 
352
352
  case 3:
353
353
  {
354
- const e = s.filter((([e, t]) => !q(e, t)));
354
+ const e = s.filter(([e, t]) => !q(e, t));
355
355
  if (!e.length) break;
356
- V(e.reduce(((e, [t, o]) => {
356
+ V(e.reduce((e, [t, o]) => {
357
357
  let r;
358
358
  if (2 === _) r = !0; else if (z && 1 === _) r = t < z[0]; else {
359
359
  const e = W(), o = O(t), s = P(t);
360
- r = 1 !== y && 0 === _ ? o + s < e : o < e && o + s < e + v;
360
+ r = 1 !== y && 0 === _ ? o + s <= e : o < e && o + s < e + v;
361
361
  }
362
362
  return r && (e += o - P(t)), e;
363
- }), 0));
363
+ }, 0));
364
364
  for (const [t, o] of e) {
365
365
  const e = P(t), r = p(J, t, o);
366
366
  f && (M += r ? o : o - e);
@@ -368,9 +368,9 @@ exports.createGridResizer = (e, t) => {
368
368
  f && v && M > v && (V(((e, t) => {
369
369
  let r = 0;
370
370
  const s = [];
371
- e.t.forEach(((e, o) => {
371
+ e.t.forEach((e, o) => {
372
372
  -1 !== e && (s.push(e), o < t && r++);
373
- })), e.i = -1;
373
+ }), e.i = -1;
374
374
  const n = i(s), c = n.length, l = c / 2 | 0, f = c % 2 == 0 ? (n[l - 1] + n[l]) / 2 : n[l], a = e.o;
375
375
  return ((e.o = f) - a) * o(t - r, 0);
376
376
  })(J, d(J, B()))), f = !1), l = 3, c = !0;
@@ -396,13 +396,13 @@ exports.createGridResizer = (e, t) => {
396
396
  case 8:
397
397
  z = L(s, s + v), l = 1;
398
398
  }
399
- l && (m = 1 + (2147483647 & m), n && k && (S += k, k = 0), C.forEach((([e, t]) => {
399
+ l && (m = 1 + (2147483647 & m), n && k && (S += k, k = 0), C.forEach(([e, t]) => {
400
400
  l & e && t(c);
401
- })));
401
+ }));
402
402
  }
403
403
  };
404
404
  }, exports.createWindowResizer = (t, o) => {
405
- const r = o ? "width" : "height", s = o ? "innerWidth" : "innerHeight", n = new WeakMap, i = z((o => {
405
+ const r = o ? "width" : "height", s = o ? "innerWidth" : "innerHeight", n = new WeakMap, i = z(o => {
406
406
  const s = [];
407
407
  for (const {target: t, contentRect: i} of o) {
408
408
  if (!t.offsetParent) continue;
@@ -410,7 +410,7 @@ exports.createGridResizer = (e, t) => {
410
410
  o != e && s.push([ o, i[r] ]);
411
411
  }
412
412
  s.length && t.$update(3, s);
413
- }));
413
+ });
414
414
  let l;
415
415
  return {
416
416
  $observeRoot(e) {
@@ -430,7 +430,7 @@ exports.createGridResizer = (e, t) => {
430
430
  };
431
431
  }, exports.createWindowScroller = (e, t) => {
432
432
  let o, r, s = l(), i = !1;
433
- const c = t ? "left" : "top", [f] = y(e, (() => s[0]), ((e, t) => {
433
+ const c = t ? "left" : "top", [f] = y(e, () => s[0], (e, t) => {
434
434
  e = k(e, i);
435
435
  const r = b(v(o));
436
436
  t ? r.scroll({
@@ -439,7 +439,7 @@ exports.createGridResizer = (e, t) => {
439
439
  }) : r.scroll({
440
440
  [c]: e
441
441
  });
442
- })), a = (e, t, o, r, s = 0) => {
442
+ }), a = (e, t, o, r, s = 0) => {
443
443
  const n = r ? "offsetLeft" : "offsetTop", c = s + (r && i ? o.innerWidth - e[n] - e.offsetWidth : e[n]), l = e.offsetParent;
444
444
  return e !== t && l ? a(l, t, o, r, c) : c;
445
445
  };
@@ -447,13 +447,13 @@ exports.createGridResizer = (e, t) => {
447
447
  $observe(n) {
448
448
  o = n;
449
449
  const l = t ? "scrollX" : "scrollY", f = v(n), u = b(f);
450
- t && (i = "rtl" === getComputedStyle(m(f)).direction), r = I(e, u, t, (() => k(u[l], i)), ((t, o) => {
450
+ t && (i = "rtl" === getComputedStyle(m(f)).direction), r = I(e, u, t, () => k(u[l], i), (t, o) => {
451
451
  o ? u.scroll({
452
452
  [c]: k(e.$getScrollOffset() + t, i)
453
453
  }) : u.scrollBy({
454
454
  [c]: k(t, i)
455
455
  });
456
- }), (() => a(n, f.body, u, t))), s[1](!0);
456
+ }, () => a(n, f.body, u, t)), s[1](!0);
457
457
  },
458
458
  $dispose() {
459
459
  r && r.$(), o = void 0, s[1](!1), s = l();
@@ -472,7 +472,7 @@ exports.createGridResizer = (e, t) => {
472
472
  }
473
473
  }
474
474
  const l = v(o), u = b(l), p = m(l), $ = () => e.$getViewportSize() - (t ? p.clientWidth : p.clientHeight);
475
- f((() => c + a(o, l.body, u, t) + e.$getItemOffset(r) + ("end" === s ? e.$getItemSize(r) - (e.$getViewportSize() - $()) : "center" === s ? (e.$getItemSize(r) - (e.$getViewportSize() - $())) / 2 : 0)), i);
475
+ f(() => c + a(o, l.body, u, t) + e.$getItemOffset(r) + ("end" === s ? e.$getItemSize(r) - (e.$getViewportSize() - $()) : "center" === s ? (e.$getItemSize(r) - (e.$getViewportSize() - $())) / 2 : 0), i);
476
476
  }
477
477
  };
478
478
  }, exports.getScrollSize = e => o(e.$getTotalSize(), e.$getViewportSize()), exports.isBrowser = g,