@opentiny/tiny-robot 0.2.0-alpha.8 → 0.2.0

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/close.js CHANGED
@@ -1,4 +1,4 @@
1
- import { s as o } from "./index6.js";
1
+ import { l as o } from "./index6.js";
2
2
  import { createElementBlock as n, openBlock as r, createElementVNode as t } from "vue";
3
3
  var c = {
4
4
  viewBox: "0 0 16 16",
@@ -1,8 +1,8 @@
1
- import { defineComponent as T, useCssVars as D, unref as S, ref as u, computed as B, watch as M, createElementBlock as m, openBlock as n, renderSlot as R, createVNode as V, Transition as b, withCtx as E, createBlock as N, createCommentVNode as O, Teleport as W, createElementVNode as p, normalizeStyle as I, Fragment as z, renderList as F, toDisplayString as H } from "vue";
2
- import { c as f, o as L } from "../index2.js";
3
- import { t as o } from "../utils.js";
4
- import { _ as P } from "../_plugin-vue_export-helper.js";
5
- const U = { class: "tr-dropdown-menu__list" }, j = ["onClick"], q = /* @__PURE__ */ T({
1
+ import { defineComponent as S, useCssVars as T, unref as M, ref as m, computed as R, watch as V, createElementBlock as o, openBlock as r, Fragment as p, createElementVNode as f, createVNode as B, renderSlot as E, Transition as N, withCtx as O, createCommentVNode as W, normalizeStyle as I, renderList as b, toDisplayString as z } from "vue";
2
+ import { c as _, o as F } from "../index2.js";
3
+ import { t as n } from "../utils.js";
4
+ import { _ as H } from "../_plugin-vue_export-helper.js";
5
+ const L = { class: "tr-dropdown-menu__list" }, P = ["onClick"], U = /* @__PURE__ */ S({
6
6
  __name: "index",
7
7
  props: {
8
8
  items: {},
@@ -10,64 +10,62 @@ const U = { class: "tr-dropdown-menu__list" }, j = ["onClick"], q = /* @__PURE__
10
10
  topOffset: { default: 0 }
11
11
  },
12
12
  emits: ["item-click"],
13
- setup(s, { emit: _ }) {
14
- D((e) => ({
15
- fb65405a: S(o)(l.minWidth)
13
+ setup(l, { emit: w }) {
14
+ T((e) => ({
15
+ "90b2d29e": M(n)(a.minWidth)
16
16
  }));
17
- const l = s, t = u(!1), w = _, a = u(null), i = u(null), { x: h, y: v, update: k } = f(a), { width: g, height: x } = f(i), y = B(() => ({
18
- left: `min(${o(h.value)}, 100% - ${o(g.value)})`,
19
- top: `max(${o(v.value)} - ${o(x.value)} + ${o(l.topOffset)} - 8px, 0px)`
17
+ const a = l, t = m(!1), h = w, i = m(null), d = m(null), { x: v, y: g, update: k } = _(i), { width: x, height: C } = _(d), y = R(() => ({
18
+ left: `min(${n(v.value)}, 100% - ${n(x.value)})`,
19
+ top: `max(${n(g.value)} - ${n(C.value)} + ${n(a.topOffset)} - 8px, 0px)`
20
20
  }));
21
- L(i, (e) => {
22
- var d;
23
- (d = a.value) != null && d.contains(e.target) && e.stopPropagation(), t.value = !1;
24
- }), M(t, (e) => {
21
+ F(d, (e) => {
22
+ var c;
23
+ (c = i.value) != null && c.contains(e.target) && e.stopPropagation(), t.value = !1;
24
+ }), V(t, (e) => {
25
25
  e && k();
26
26
  });
27
- const C = () => {
27
+ const $ = () => {
28
28
  t.value = !t.value;
29
- }, $ = (e) => {
30
- t.value = !1, w("item-click", e);
29
+ }, D = (e) => {
30
+ t.value = !1, h("item-click", e);
31
31
  };
32
- return (e, d) => (n(), m("div", {
33
- class: "tr-dropdown-menu__wrapper",
34
- ref_key: "dropDownTriggerRef",
35
- ref: a,
36
- onClick: C
37
- }, [
38
- R(e.$slots, "default", {}, void 0, !0),
39
- V(b, { name: "tr-dropdown-menu" }, {
40
- default: E(() => [
41
- t.value ? (n(), N(W, {
32
+ return (e, c) => (r(), o(p, null, [
33
+ f("div", {
34
+ class: "tr-dropdown-menu__wrapper",
35
+ ref_key: "dropDownTriggerRef",
36
+ ref: i,
37
+ onClick: $
38
+ }, [
39
+ E(e.$slots, "default", {}, void 0, !0)
40
+ ], 512),
41
+ B(N, { name: "tr-dropdown-menu" }, {
42
+ default: O(() => [
43
+ t.value ? (r(), o("div", {
42
44
  key: 0,
43
- to: "body"
45
+ class: "tr-dropdown-menu",
46
+ style: I(y.value),
47
+ ref_key: "dropdownMenuRef",
48
+ ref: d
44
49
  }, [
45
- p("div", {
46
- class: "tr-dropdown-menu",
47
- style: I(y.value),
48
- ref_key: "dropdownMenuRef",
49
- ref: i
50
- }, [
51
- p("ul", U, [
52
- (n(!0), m(z, null, F(l.items, (c) => (n(), m("li", {
53
- class: "tr-dropdown-menu__list-item",
54
- key: c.id,
55
- onClick: (G) => $(c)
56
- }, H(c.text), 9, j))), 128))
57
- ])
58
- ], 4)
59
- ])) : O("", !0)
50
+ f("ul", L, [
51
+ (r(!0), o(p, null, b(a.items, (u) => (r(), o("li", {
52
+ class: "tr-dropdown-menu__list-item",
53
+ key: u.id,
54
+ onClick: (q) => D(u)
55
+ }, z(u.text), 9, P))), 128))
56
+ ])
57
+ ], 4)) : W("", !0)
60
58
  ]),
61
59
  _: 1
62
60
  })
63
- ], 512));
61
+ ], 64));
64
62
  }
65
- }), r = /* @__PURE__ */ P(q, [["__scopeId", "data-v-740d1b6f"]]);
66
- r.name = "TrDropdownMenu";
67
- const A = function(s) {
68
- s.component(r.name, r);
63
+ }), s = /* @__PURE__ */ H(U, [["__scopeId", "data-v-ce90a07c"]]);
64
+ s.name = "TrDropdownMenu";
65
+ const j = function(l) {
66
+ l.component(s.name, s);
69
67
  };
70
- r.install = A;
68
+ s.install = j;
71
69
  export {
72
- r as default
70
+ s as default
73
71
  };
package/dist/index.d.ts CHANGED
@@ -89,7 +89,7 @@ popoverHeight: string | number;
89
89
  }, {}, {}, {}, string, ComponentProvideOptions, false, {
90
90
  popoverTriggerRef: HTMLDivElement;
91
91
  popoverRef: HTMLDivElement;
92
- }, HTMLDivElement>;
92
+ }, any>;
93
93
 
94
94
  declare const __VLS_component_2: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
95
95
  "update:show": (value: boolean) => any;
@@ -109,7 +109,7 @@ topOffset: string | number;
109
109
  }, {}, {}, {}, string, ComponentProvideOptions, false, {
110
110
  dropDownTriggerRef: HTMLDivElement;
111
111
  dropdownMenuRef: HTMLDivElement;
112
- }, HTMLDivElement>;
112
+ }, any>;
113
113
 
114
114
  declare const __VLS_component_4: DefineComponent<PromptsProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
115
115
  "item-click": (ev: MouseEvent, item: PromptProps) => any;
@@ -394,20 +394,20 @@ disabled: boolean;
394
394
  type: string;
395
395
  ellipsis: boolean;
396
396
  mask: boolean;
397
- vertical: boolean;
398
- customClass: string;
399
397
  tiny_mode_root: boolean;
400
398
  _constants: Record<string, any>;
401
399
  tabindex: string;
400
+ contentStyle: Record<string, any>;
401
+ customClass: string;
402
402
  showTitle: boolean;
403
403
  readonly: boolean;
404
404
  hoverExpand: boolean;
405
405
  memorySpace: number;
406
+ vertical: boolean;
406
407
  selectMenu: {
407
408
  id: string;
408
409
  label: string;
409
410
  }[];
410
- contentStyle: Record<string, any>;
411
411
  isSelect: boolean;
412
412
  counter: boolean;
413
413
  autosize: boolean | Record<string, any>;
@@ -621,20 +621,20 @@ disabled: boolean;
621
621
  type: string;
622
622
  ellipsis: boolean;
623
623
  mask: boolean;
624
- vertical: boolean;
625
- customClass: string;
626
624
  tiny_mode_root: boolean;
627
625
  _constants: Record<string, any>;
628
626
  tabindex: string;
627
+ contentStyle: Record<string, any>;
628
+ customClass: string;
629
629
  showTitle: boolean;
630
630
  readonly: boolean;
631
631
  hoverExpand: boolean;
632
632
  memorySpace: number;
633
+ vertical: boolean;
633
634
  selectMenu: {
634
635
  id: string;
635
636
  label: string;
636
637
  }[];
637
- contentStyle: Record<string, any>;
638
638
  isSelect: boolean;
639
639
  counter: boolean;
640
640
  autosize: boolean | Record<string, any>;
@@ -895,7 +895,7 @@ declare function __VLS_template_11(): {
895
895
  popoverTriggerRef: HTMLDivElement;
896
896
  popoverRef: HTMLDivElement;
897
897
  };
898
- rootEl: HTMLDivElement;
898
+ rootEl: any;
899
899
  };
900
900
 
901
901
  declare function __VLS_template_2(): {
@@ -912,7 +912,7 @@ declare function __VLS_template_3(): {
912
912
  dropDownTriggerRef: HTMLDivElement;
913
913
  dropdownMenuRef: HTMLDivElement;
914
914
  };
915
- rootEl: HTMLDivElement;
915
+ rootEl: any;
916
916
  };
917
917
 
918
918
  declare function __VLS_template_4(): {
@@ -1176,20 +1176,20 @@ declare function __VLS_template_5(): {
1176
1176
  type: string;
1177
1177
  ellipsis: boolean;
1178
1178
  mask: boolean;
1179
- vertical: boolean;
1180
- customClass: string;
1181
1179
  tiny_mode_root: boolean;
1182
1180
  _constants: Record<string, any>;
1183
1181
  tabindex: string;
1182
+ contentStyle: Record<string, any>;
1183
+ customClass: string;
1184
1184
  showTitle: boolean;
1185
1185
  readonly: boolean;
1186
1186
  hoverExpand: boolean;
1187
1187
  memorySpace: number;
1188
+ vertical: boolean;
1188
1189
  selectMenu: {
1189
1190
  id: string;
1190
1191
  label: string;
1191
1192
  }[];
1192
- contentStyle: Record<string, any>;
1193
1193
  isSelect: boolean;
1194
1194
  counter: boolean;
1195
1195
  autosize: boolean | Record<string, any>;
@@ -1403,20 +1403,20 @@ declare function __VLS_template_5(): {
1403
1403
  type: string;
1404
1404
  ellipsis: boolean;
1405
1405
  mask: boolean;
1406
- vertical: boolean;
1407
- customClass: string;
1408
1406
  tiny_mode_root: boolean;
1409
1407
  _constants: Record<string, any>;
1410
1408
  tabindex: string;
1409
+ contentStyle: Record<string, any>;
1410
+ customClass: string;
1411
1411
  showTitle: boolean;
1412
1412
  readonly: boolean;
1413
1413
  hoverExpand: boolean;
1414
1414
  memorySpace: number;
1415
+ vertical: boolean;
1415
1416
  selectMenu: {
1416
1417
  id: string;
1417
1418
  label: string;
1418
1419
  }[];
1419
- contentStyle: Record<string, any>;
1420
1420
  isSelect: boolean;
1421
1421
  counter: boolean;
1422
1422
  autosize: boolean | Record<string, any>;
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 k(e) {
63
+ function D(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 M(...e) {
129
+ function W(...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 = k(g(e[0])).filter((l) => l != null);
133
+ const i = D(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
- k(g(v.value ? e[1] : e[0])),
141
- k(de(v.value ? e[2] : e[1])),
140
+ D(g(v.value ? e[1] : e[0])),
141
+ D(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) => f.addEventListener("click", x, u)), n.document.documentElement.addEventListener("click", x, u);
172
+ Array.from(n.document.body.children).forEach((f) => W(f, "click", x, u)), W(n.document.documentElement, "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((D) => D.el === f.target || f.composedPath().includes(D.el));
189
+ return F == null || !Array.isArray(F) ? !1 : F.some((L) => L.el === f.target || f.composedPath().includes(L.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
- M(n, "click", (u) => {
203
+ W(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
- M(n, "pointerdown", (u) => {
208
+ W(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 && M(n, "blur", (u) => {
212
+ d && W(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 = k(a).map(E).filter(he);
246
+ const a = g(e), m = D(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
- }), M(d, "change", l, { passive: !0 }), I(() => i.value);
284
+ }), W(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 Le(e, t = {}) {
312
+ function Ce(e, t = {}) {
313
313
  const {
314
314
  reset: o = !0,
315
315
  windowResize: n = !0,
@@ -331,7 +331,7 @@ function Le(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 && M("scroll", u, { capture: !0, passive: !0 }), n && M("resize", u, { passive: !0 }), V(() => {
334
+ }), v && W("scroll", u, { capture: !0, passive: !0 }), n && W("resize", u, { passive: !0 }), V(() => {
335
335
  c && u();
336
336
  }), {
337
337
  height: i,
@@ -345,7 +345,7 @@ function Le(e, t = {}) {
345
345
  update: u
346
346
  };
347
347
  }
348
- function Ce(e, t = { width: 0, height: 0 }, o = {}) {
348
+ function ke(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 Ce(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 = k(a);
363
+ const m = D(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 Ce(e, t = { width: 0, height: 0 }, o = {}) {
387
387
  };
388
388
  }
389
389
  const ee = 1;
390
- function ke(e, t = {}) {
390
+ function De(e, t = {}) {
391
391
  const {
392
392
  throttle: o = 0,
393
393
  idle: n = 200,
@@ -424,18 +424,18 @@ function ke(e, t = {}) {
424
424
  }
425
425
  });
426
426
  function y(w, P) {
427
- var T, L, C, j;
427
+ var T, C, k, j;
428
428
  if (!s)
429
429
  return;
430
- const W = g(e);
431
- if (!W)
430
+ const M = g(e);
431
+ if (!M)
432
432
  return;
433
- (C = W instanceof Document ? s.document.body : W) == null || C.scrollTo({
433
+ (k = M instanceof Document ? s.document.body : M) == null || k.scrollTo({
434
434
  top: (T = g(P)) != null ? T : b.value,
435
- left: (L = g(w)) != null ? L : m.value,
435
+ left: (C = g(w)) != null ? C : m.value,
436
436
  behavior: g(l)
437
437
  });
438
- const O = ((j = W == null ? void 0 : W.document) == null ? void 0 : j.documentElement) || (W == null ? void 0 : W.documentElement) || W;
438
+ const O = ((j = M == null ? void 0 : M.document) == null ? void 0 : j.documentElement) || (M == null ? void 0 : M.documentElement) || M;
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 ke(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
- }, D = Ee(F, o + n), z = (w) => {
453
+ }, L = 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: L, flexDirection: C, direction: j } = getComputedStyle(T), W = 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: C, flexDirection: k, direction: j } = getComputedStyle(T), M = 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 * 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;
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;
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
- L === "flex" && C === "column-reverse" ? (f.top = q, f.bottom = U) : (f.top = U, f.bottom = q), a.value = A;
464
+ C === "flex" && k === "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, D(w), c(w);
470
+ z(T), u.value = !0, L(w), c(w);
471
471
  };
472
- return M(
472
+ return W(
473
473
  e,
474
474
  "scroll",
475
475
  o ? Te(Y, o, !0, !1) : Y,
@@ -483,7 +483,7 @@ function ke(e, t = {}) {
483
483
  } catch (w) {
484
484
  h(w);
485
485
  }
486
- }), M(
486
+ }), W(
487
487
  e,
488
488
  "scrollend",
489
489
  F,
@@ -500,7 +500,7 @@ function ke(e, t = {}) {
500
500
  }
501
501
  };
502
502
  }
503
- function De(e = {}) {
503
+ function Le(e = {}) {
504
504
  const {
505
505
  window: t = R,
506
506
  initialWidth: o = Number.POSITIVE_INFINITY,
@@ -519,18 +519,18 @@ function De(e = {}) {
519
519
  };
520
520
  s(), V(s);
521
521
  const h = { passive: !0 };
522
- if (M("resize", s, h), t && d === "visual" && t.visualViewport && M(t.visualViewport, "resize", s, h), v) {
522
+ if (W("resize", s, h), t && d === "visual" && t.visualViewport && W(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
- De as a,
530
- Ce as b,
531
- Le as c,
529
+ Le as a,
530
+ ke as b,
531
+ Ce as c,
532
532
  Pe as d,
533
533
  Fe as o,
534
- ke as u,
534
+ De as u,
535
535
  _e as w
536
536
  };