@opentiny/tiny-robot 0.2.0 → 0.2.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.
package/dist/index2.js CHANGED
@@ -60,7 +60,7 @@ function Se(...e) {
60
60
  function K(e) {
61
61
  return e.endsWith("rem") ? Number.parseFloat(e) * 16 : Number.parseFloat(e);
62
62
  }
63
- function D(e) {
63
+ function k(e) {
64
64
  return Array.isArray(e) ? e : [e];
65
65
  }
66
66
  function ye(e) {
@@ -126,19 +126,19 @@ function E(e) {
126
126
  const o = g(e);
127
127
  return (t = o == null ? void 0 : o.$el) != null ? t : o;
128
128
  }
129
- function W(...e) {
129
+ function M(...e) {
130
130
  const t = [], o = () => {
131
131
  t.forEach((i) => i()), t.length = 0;
132
132
  }, n = (i, l, s, h) => (i.addEventListener(l, s, h), () => i.removeEventListener(l, s, h)), v = I(() => {
133
- const i = D(g(e[0])).filter((l) => l != null);
133
+ const i = k(g(e[0])).filter((l) => l != null);
134
134
  return i.every((l) => typeof l != "string") ? i : void 0;
135
135
  }), c = We(
136
136
  () => {
137
137
  var i, l;
138
138
  return [
139
139
  (l = (i = v.value) == null ? void 0 : i.map((s) => E(s))) != null ? l : [R].filter((s) => s != null),
140
- D(g(v.value ? e[1] : e[0])),
141
- D(de(v.value ? e[2] : e[1])),
140
+ k(g(v.value ? e[1] : e[0])),
141
+ k(de(v.value ? e[2] : e[1])),
142
142
  // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
143
143
  g(v.value ? e[3] : e[2])
144
144
  ];
@@ -169,7 +169,7 @@ function Fe(e, t, o = {}) {
169
169
  if (we && !Z) {
170
170
  Z = !0;
171
171
  const u = { passive: !0 };
172
- Array.from(n.document.body.children).forEach((f) => W(f, "click", x, u)), W(n.document.documentElement, "click", x, u);
172
+ Array.from(n.document.body.children).forEach((f) => f.addEventListener("click", x, u)), n.document.documentElement.addEventListener("click", x, u);
173
173
  }
174
174
  let l = !0;
175
175
  const s = (u) => g(v).some((f) => {
@@ -186,7 +186,7 @@ function Fe(e, t, o = {}) {
186
186
  }
187
187
  function r(u, f) {
188
188
  const p = g(u), F = p.$.subTree && p.$.subTree.children;
189
- return F == null || !Array.isArray(F) ? !1 : F.some((L) => L.el === f.target || f.composedPath().includes(L.el));
189
+ return F == null || !Array.isArray(F) ? !1 : F.some((D) => D.el === f.target || f.composedPath().includes(D.el));
190
190
  }
191
191
  const a = (u) => {
192
192
  const f = E(e);
@@ -200,16 +200,16 @@ function Fe(e, t, o = {}) {
200
200
  };
201
201
  let m = !1;
202
202
  const b = [
203
- W(n, "click", (u) => {
203
+ M(n, "click", (u) => {
204
204
  m || (m = !0, setTimeout(() => {
205
205
  m = !1;
206
206
  }, 0), a(u));
207
207
  }, { passive: !0, capture: c }),
208
- W(n, "pointerdown", (u) => {
208
+ M(n, "pointerdown", (u) => {
209
209
  const f = E(e);
210
210
  l = !s(u) && !!(f && !u.composedPath().includes(f));
211
211
  }, { passive: !0 }),
212
- d && W(n, "blur", (u) => {
212
+ d && M(n, "blur", (u) => {
213
213
  setTimeout(() => {
214
214
  var f;
215
215
  const p = E(e);
@@ -243,7 +243,7 @@ function Oe(e, t, o = {}) {
243
243
  const d = G(() => n && "MutationObserver" in n), i = () => {
244
244
  c && (c.disconnect(), c = void 0);
245
245
  }, l = I(() => {
246
- const a = g(e), m = D(a).map(E).filter(he);
246
+ const a = g(e), m = k(a).map(E).filter(he);
247
247
  return new Set(m);
248
248
  }), s = _(
249
249
  () => l.value,
@@ -281,7 +281,7 @@ function Pe(e, t = {}) {
281
281
  return;
282
282
  }
283
283
  v.value && (d.value = o.matchMedia(g(e)), i.value = d.value.matches);
284
- }), W(d, "change", l, { passive: !0 }), I(() => i.value);
284
+ }), M(d, "change", l, { passive: !0 }), I(() => i.value);
285
285
  }
286
286
  function le(e, t, o = {}) {
287
287
  const { window: n = R, ...v } = o;
@@ -309,7 +309,7 @@ function le(e, t, o = {}) {
309
309
  stop: h
310
310
  };
311
311
  }
312
- function Ce(e, t = {}) {
312
+ function Le(e, t = {}) {
313
313
  const {
314
314
  reset: o = !0,
315
315
  windowResize: n = !0,
@@ -331,7 +331,7 @@ function Ce(e, t = {}) {
331
331
  }
332
332
  return le(e, u), _(() => E(e), (f) => !f && u()), Oe(e, u, {
333
333
  attributeFilter: ["style", "class"]
334
- }), v && W("scroll", u, { capture: !0, passive: !0 }), n && W("resize", u, { passive: !0 }), V(() => {
334
+ }), v && M("scroll", u, { capture: !0, passive: !0 }), n && M("resize", u, { passive: !0 }), V(() => {
335
335
  c && u();
336
336
  }), {
337
337
  height: i,
@@ -345,7 +345,7 @@ function Ce(e, t = {}) {
345
345
  update: u
346
346
  };
347
347
  }
348
- function ke(e, t = { width: 0, height: 0 }, o = {}) {
348
+ function Ce(e, t = { width: 0, height: 0 }, o = {}) {
349
349
  const { window: n = R, box: v = "content-box" } = o, c = I(() => {
350
350
  var r, a;
351
351
  return (a = (r = E(e)) == null ? void 0 : r.namespaceURI) == null ? void 0 : a.includes("svg");
@@ -360,7 +360,7 @@ function ke(e, t = { width: 0, height: 0 }, o = {}) {
360
360
  d.value = b.width, i.value = b.height;
361
361
  }
362
362
  } else if (a) {
363
- const m = D(a);
363
+ const m = k(a);
364
364
  d.value = m.reduce((b, { inlineSize: y }) => b + y, 0), i.value = m.reduce((b, { blockSize: y }) => b + y, 0);
365
365
  } else
366
366
  d.value = r.contentRect.width, i.value = r.contentRect.height;
@@ -387,7 +387,7 @@ function ke(e, t = { width: 0, height: 0 }, o = {}) {
387
387
  };
388
388
  }
389
389
  const ee = 1;
390
- function De(e, t = {}) {
390
+ function ke(e, t = {}) {
391
391
  const {
392
392
  throttle: o = 0,
393
393
  idle: n = 200,
@@ -424,18 +424,18 @@ function De(e, t = {}) {
424
424
  }
425
425
  });
426
426
  function y(w, P) {
427
- var T, C, k, j;
427
+ var T, L, C, j;
428
428
  if (!s)
429
429
  return;
430
- const M = g(e);
431
- if (!M)
430
+ const W = g(e);
431
+ if (!W)
432
432
  return;
433
- (k = M instanceof Document ? s.document.body : M) == null || k.scrollTo({
433
+ (C = W instanceof Document ? s.document.body : W) == null || C.scrollTo({
434
434
  top: (T = g(P)) != null ? T : b.value,
435
- left: (C = g(w)) != null ? C : m.value,
435
+ left: (L = g(w)) != null ? L : m.value,
436
436
  behavior: g(l)
437
437
  });
438
- const O = ((j = M == null ? void 0 : M.document) == null ? void 0 : j.documentElement) || (M == null ? void 0 : M.documentElement) || M;
438
+ const O = ((j = W == null ? void 0 : W.document) == null ? void 0 : j.documentElement) || (W == null ? void 0 : W.documentElement) || W;
439
439
  m != null && (r.value = O.scrollLeft), b != null && (a.value = O.scrollTop);
440
440
  }
441
441
  const u = S(!1), f = J({
@@ -450,26 +450,26 @@ function De(e, t = {}) {
450
450
  bottom: !1
451
451
  }), F = (w) => {
452
452
  u.value && (u.value = !1, p.left = !1, p.right = !1, p.top = !1, p.bottom = !1, v(w));
453
- }, L = Ee(F, o + n), z = (w) => {
453
+ }, D = Ee(F, o + n), z = (w) => {
454
454
  var P;
455
455
  if (!s)
456
456
  return;
457
- const T = ((P = w == null ? void 0 : w.document) == null ? void 0 : P.documentElement) || (w == null ? void 0 : w.documentElement) || E(w), { display: C, flexDirection: k, direction: j } = getComputedStyle(T), M = j === "rtl" ? -1 : 1, O = T.scrollLeft;
457
+ const T = ((P = w == null ? void 0 : w.document) == null ? void 0 : P.documentElement) || (w == null ? void 0 : w.documentElement) || E(w), { display: L, flexDirection: C, direction: j } = getComputedStyle(T), W = j === "rtl" ? -1 : 1, O = T.scrollLeft;
458
458
  p.left = O < r.value, p.right = O > r.value;
459
- const Q = Math.abs(O * M) <= (d.left || 0), X = Math.abs(O * M) + T.clientWidth >= T.scrollWidth - (d.right || 0) - ee;
460
- C === "flex" && k === "row-reverse" ? (f.left = X, f.right = Q) : (f.left = Q, f.right = X), r.value = O;
459
+ const Q = Math.abs(O * W) <= (d.left || 0), X = Math.abs(O * W) + T.clientWidth >= T.scrollWidth - (d.right || 0) - ee;
460
+ L === "flex" && C === "row-reverse" ? (f.left = X, f.right = Q) : (f.left = Q, f.right = X), r.value = O;
461
461
  let A = T.scrollTop;
462
462
  w === s.document && !A && (A = s.document.body.scrollTop), p.top = A < a.value, p.bottom = A > a.value;
463
463
  const U = Math.abs(A) <= (d.top || 0), q = Math.abs(A) + T.clientHeight >= T.scrollHeight - (d.bottom || 0) - ee;
464
- C === "flex" && k === "column-reverse" ? (f.top = q, f.bottom = U) : (f.top = U, f.bottom = q), a.value = A;
464
+ L === "flex" && C === "column-reverse" ? (f.top = q, f.bottom = U) : (f.top = U, f.bottom = q), a.value = A;
465
465
  }, Y = (w) => {
466
466
  var P;
467
467
  if (!s)
468
468
  return;
469
469
  const T = (P = w.target.documentElement) != null ? P : w.target;
470
- z(T), u.value = !0, L(w), c(w);
470
+ z(T), u.value = !0, D(w), c(w);
471
471
  };
472
- return W(
472
+ return M(
473
473
  e,
474
474
  "scroll",
475
475
  o ? Te(Y, o, !0, !1) : Y,
@@ -483,7 +483,7 @@ function De(e, t = {}) {
483
483
  } catch (w) {
484
484
  h(w);
485
485
  }
486
- }), W(
486
+ }), M(
487
487
  e,
488
488
  "scrollend",
489
489
  F,
@@ -500,7 +500,7 @@ function De(e, t = {}) {
500
500
  }
501
501
  };
502
502
  }
503
- function Le(e = {}) {
503
+ function De(e = {}) {
504
504
  const {
505
505
  window: t = R,
506
506
  initialWidth: o = Number.POSITIVE_INFINITY,
@@ -519,18 +519,18 @@ function Le(e = {}) {
519
519
  };
520
520
  s(), V(s);
521
521
  const h = { passive: !0 };
522
- if (W("resize", s, h), t && d === "visual" && t.visualViewport && W(t.visualViewport, "resize", s, h), v) {
522
+ if (M("resize", s, h), t && d === "visual" && t.visualViewport && M(t.visualViewport, "resize", s, h), v) {
523
523
  const r = Pe("(orientation: portrait)");
524
524
  _(r, () => s());
525
525
  }
526
526
  return { width: i, height: l };
527
527
  }
528
528
  export {
529
- Le as a,
530
- ke as b,
531
- Ce as c,
529
+ De as a,
530
+ Ce as b,
531
+ Le as c,
532
532
  Pe as d,
533
533
  Fe as o,
534
- De as u,
534
+ ke as u,
535
535
  _e as w
536
536
  };