virtua 0.51.2 → 0.51.3

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/lib/index.js CHANGED
@@ -254,28 +254,28 @@ a), b = e => d(e.t(), e.o()), x = ({i: e, l: t, u: n, h: o, S: r, p: i, t: s, v:
254
254
  };
255
255
  }, O = (e, t) => {
256
256
  let n, o, r = w();
257
- const i = t ? "width" : "height", s = /* @__PURE__ */ new WeakMap, l = M(t => {
258
- const o = [];
259
- for (const {target: r, contentRect: l} of t) if (r.offsetParent) if (r === n) e.W(4, l[i]); else {
260
- const e = s.get(r);
261
- null != e && o.push([ e, l[i] ]);
257
+ const i = /* @__PURE__ */ new WeakMap, s = M(o => {
258
+ const r = [];
259
+ for (const {target: s, contentRect: {width: l, height: c}} of o) if (s === n) (l || c) && e.W(4, t ? l : c); else if (s.offsetParent) {
260
+ const e = i.get(s);
261
+ null != e && r.push([ e, t ? l : c ]);
262
262
  }
263
- o.length && e.W(3, o);
263
+ r.length && e.W(3, r);
264
264
  });
265
265
  return {
266
- P(i, s = i.parentElement) {
267
- l.A(n = s), o = T(e, s, s, t, t && "rtl" === getComputedStyle(s).direction, () => {
268
- const e = t ? "overflowX" : "overflowY", n = s.style, o = n[e];
266
+ P(i, l = i.parentElement) {
267
+ s.A(n = l), o = T(e, l, l, t, t && "rtl" === getComputedStyle(l).direction, () => {
268
+ const e = t ? "overflowX" : "overflowY", n = l.style, o = n[e];
269
269
  n[e] = "hidden", v(() => {
270
270
  n[e] = o;
271
271
  });
272
272
  }), r[1](!0);
273
273
  },
274
274
  _() {
275
- l.X(), o && o.X(), r[1](!1), r = w();
275
+ s.X(), o && o.X(), r[1](!1), r = w();
276
276
  },
277
- V: (e, t) => (s.set(e, t), l.A(e), () => {
278
- s.delete(e), l.B(e);
277
+ V: (e, t) => (i.set(e, t), s.A(e), () => {
278
+ i.delete(e), s.B(e);
279
279
  }),
280
280
  async J(e, t) {
281
281
  await r[0] && o.D(e, t);
@@ -287,36 +287,31 @@ a), b = e => d(e.t(), e.o()), x = ({i: e, l: t, u: n, h: o, S: r, p: i, t: s, v:
287
287
  };
288
288
  }, E = (e, t) => {
289
289
  let n, o, r, i, s, l = w();
290
- const c = t ? "width" : "height", f = /* @__PURE__ */ new WeakMap, a = M(t => {
291
- const o = [];
292
- for (const {target: e, contentRect: r} of t) {
293
- if (e === n) {
294
- s && s();
295
- continue;
296
- }
297
- if (!e.offsetParent) continue;
298
- const t = f.get(e);
299
- null != t && o.push([ t, r[c] ]);
290
+ const c = /* @__PURE__ */ new WeakMap, f = M(o => {
291
+ const r = [];
292
+ for (const {target: e, contentRect: {width: i, height: l}} of o) if (e === n) s && s(); else if (e.offsetParent) {
293
+ const n = c.get(e);
294
+ null != n && r.push([ n, t ? i : l ]);
300
295
  }
301
- o.length && e.W(3, o);
296
+ r.length && e.W(3, r);
302
297
  });
303
298
  return {
304
299
  P(c) {
305
- const f = z(c), u = I(f), d = n = f.scrollingElement, h = t && "rtl" === getComputedStyle(d).direction, g = (e, t, n, o, r = 0) => {
300
+ const a = z(c), u = I(a), d = n = a.scrollingElement, h = t && "rtl" === getComputedStyle(d).direction, g = (e, t, n, o, r = 0) => {
306
301
  const i = o ? "offsetLeft" : "offsetTop", s = r + (h ? t.clientWidth - e[i] - e.offsetWidth : e[i]), l = e.offsetParent;
307
302
  return e !== n && l ? g(l, t, n, o, s) : s;
308
- }, S = i = () => g(c, d, f.body, t), p = s = () => {
303
+ }, S = i = () => g(c, d, a.body, t), p = s = () => {
309
304
  e.W(4, d[t ? "clientWidth" : "clientHeight"]);
310
305
  };
311
- u.addEventListener("resize", p), a.A(d), r = () => {
306
+ u.addEventListener("resize", p), f.A(d), r = () => {
312
307
  u.removeEventListener("resize", p);
313
308
  }, o = T(e, u, d, t, h, null, S), l[1](!0);
314
309
  },
315
310
  _() {
316
- r && r(), a.X(), o && o.X(), l[1](!1), l = w();
311
+ r && r(), f.X(), o && o.X(), l[1](!1), l = w();
317
312
  },
318
- V: (e, t) => (f.set(e, t), a.A(e), () => {
319
- f.delete(e), a.B(e);
313
+ V: (e, t) => (c.set(e, t), f.A(e), () => {
314
+ c.delete(e), f.B(e);
320
315
  }),
321
316
  async J(e, t) {
322
317
  await l[0] && o.D(e, t);
@@ -330,8 +325,8 @@ a), b = e => d(e.t(), e.o()), x = ({i: e, l: t, u: n, h: o, S: r, p: i, t: s, v:
330
325
  let n, o, r, i = w();
331
326
  const s = /* @__PURE__ */ new WeakMap, l = /* @__PURE__ */ new Set, c = /* @__PURE__ */ new Set, f = /* @__PURE__ */ new Map, a = (e, t) => `${e}-${t}`, u = M(o => {
332
327
  const r = /* @__PURE__ */ new Set, i = /* @__PURE__ */ new Set;
333
- for (const {target: l, contentRect: {width: c, height: u}} of o) if (l.offsetParent) if (l === n) e.W(4, u),
334
- t.W(4, c); else {
328
+ for (const {target: l, contentRect: {width: c, height: u}} of o) if (l === n) (c || u) && (e.W(4, u),
329
+ t.W(4, c)); else if (l.offsetParent) {
335
330
  const e = s.get(l);
336
331
  if (e) {
337
332
  const [t, n] = e, o = a(t, n), s = f.get(o);