@opentiny/tiny-robot 0.2.13 → 0.2.15

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,15 +1,38 @@
1
- import { computed as a, defineComponent as j, useSlots as F, Fragment as x, ref as R, watch as E, nextTick as U, createElementBlock as S, openBlock as d, createVNode as W, renderList as Z, createBlock as V, resolveDynamicComponent as q, mergeProps as k, Transition as J, normalizeProps as K, guardReactiveProps as Q, withCtx as X, createCommentVNode as Y, Teleport as ee, unref as te, createElementVNode as oe, renderSlot as re } from "vue";
2
- import { d as ne, e as se, b as ae } from "../index2.js";
3
- import { t as l } from "../utils.js";
4
- import { _ as ie } from "../_plugin-vue_export-helper.js";
5
- function le(m, w) {
6
- return a(() => {
7
- var c;
8
- const o = ne(m), i = (c = o == null ? void 0 : o.getRootNode) == null ? void 0 : c.call(o);
9
- return i instanceof ShadowRoot ? i : document.body;
1
+ import { computed as u, Fragment as R, ref as N, watch as $, defineComponent as G, useSlots as I, createElementBlock as E, openBlock as y, renderSlot as S, createVNode as F, renderList as U, unref as x, createBlock as k, resolveDynamicComponent as W, mergeProps as B, isVNode as Z, Transition as q, normalizeProps as J, guardReactiveProps as K, withCtx as Q, createCommentVNode as X, Teleport as Y, createElementVNode as ee } from "vue";
2
+ import { d as te, e as oe, b as re } from "../index2.js";
3
+ import { t as m } from "../utils.js";
4
+ import { _ as ne } from "../_plugin-vue_export-helper.js";
5
+ function se(p, g) {
6
+ const o = u(() => {
7
+ const e = (p == null ? void 0 : p()) || [], a = e.find((d) => d.type === R);
8
+ return a && Array.isArray(a.children) ? a.children : e;
9
+ }), f = u(() => g ? o.value.length : 1), v = u(() => o.value.slice(0, f.value)), c = N([]), s = (e) => e && typeof e == "object" && "$el" in e || e instanceof HTMLElement || e instanceof SVGElement ? e : (console.warn("el must be an HTMLElement or SVGElement or Vue component instance. el:", e), null), A = (e) => {
10
+ c.value[0] = s(e);
11
+ }, b = (e, a) => {
12
+ c.value[a] = s(e);
13
+ };
14
+ return $(
15
+ f,
16
+ (e) => {
17
+ c.value.length = e;
18
+ },
19
+ { flush: "post" }
20
+ ), {
21
+ vnodes: v,
22
+ ref: u(() => c.value.at(0)),
23
+ refs: c,
24
+ setRef: A,
25
+ setRefs: b
26
+ };
27
+ }
28
+ function ae(p, g) {
29
+ return u(() => {
30
+ var s;
31
+ const o = te(p), f = (s = o == null ? void 0 : o.getRootNode) == null ? void 0 : s.call(o);
32
+ return f instanceof ShadowRoot ? f : document.body;
10
33
  });
11
34
  }
12
- const ce = /* @__PURE__ */ j({
35
+ const le = /* @__PURE__ */ G({
13
36
  inheritAttrs: !1,
14
37
  __name: "index",
15
38
  props: {
@@ -22,87 +45,79 @@ const ce = /* @__PURE__ */ j({
22
45
  transitionProps: {},
23
46
  triggerEvents: {}
24
47
  },
25
- setup(m, { expose: w }) {
26
- const o = m, i = F(), v = a(() => {
27
- var r;
28
- const e = (r = i.trigger) == null ? void 0 : r.call(i), t = e ? Array.isArray(e) ? e : [e] : [];
29
- return t[0].type === x && Array.isArray(t[0].children) ? t[0].children : t;
30
- }), g = a(() => o.renderAllTriggers ? v.value.length : 1), c = a(() => v.value.slice(0, g.value)), p = R([]), h = a(() => p.value.at(0)), B = (e) => e != null && e.$el || e instanceof HTMLElement || e instanceof SVGElement ? e : (console.warn("trigger must be an HTMLElement or SVGElement or Vue component instance"), null), $ = (e, t) => {
31
- p.value[t] = B(e);
32
- };
33
- E(
34
- g,
35
- (e) => {
36
- p.value.length = e;
37
- },
38
- { flush: "post" }
39
- );
40
- function N(e = {}, t) {
41
- const r = {};
42
- for (const [n, s] of Object.entries(e))
43
- /^on[A-Z]/.test(n) && typeof s == "function" && (r[n] = (...f) => s(...f, t));
44
- return r;
48
+ setup(p, { expose: g }) {
49
+ const o = p, f = I(), {
50
+ vnodes: v,
51
+ refs: c,
52
+ ref: s,
53
+ setRefs: A
54
+ } = se(f.trigger, o.renderAllTriggers);
55
+ function b(t = {}, l) {
56
+ const n = {};
57
+ for (const [r, i] of Object.entries(t))
58
+ /^on[A-Z]/.test(r) && typeof i == "function" && (n[r] = (...h) => i(...h, l));
59
+ return n;
45
60
  }
46
- const P = a(
47
- () => c.value.map((e, t) => N(o.triggerEvents, t))
48
- ), y = R(null), u = a(() => {
49
- var e, t;
61
+ const e = u(
62
+ () => v.value.map((t, l) => b(o.triggerEvents, l))
63
+ ), a = N(null), d = u(() => {
64
+ var t, l;
50
65
  return typeof o.offset == "number" ? { mainAxis: o.offset, crossAxis: 0 } : {
51
- mainAxis: ((e = o.offset) == null ? void 0 : e.mainAxis) ?? 0,
52
- crossAxis: ((t = o.offset) == null ? void 0 : t.crossAxis) ?? 0
66
+ mainAxis: ((t = o.offset) == null ? void 0 : t.mainAxis) ?? 0,
67
+ crossAxis: ((l = o.offset) == null ? void 0 : l.crossAxis) ?? 0
53
68
  };
54
- }), { top: O, bottom: C, left: b, right: H, width: L, update: M } = se(h), { width: T, height: A } = ae(y, void 0, { box: "border-box" }), z = a(() => {
55
- const { placement: e, preventOverflow: t } = o, r = {}, n = (s, f) => {
56
- if (!t) {
57
- r[s] = f;
69
+ }), { top: P, bottom: O, left: T, right: C, width: H, update: M } = oe(s), { width: V, height: w } = re(a, void 0, { box: "border-box" }), z = u(() => {
70
+ const { placement: t, preventOverflow: l } = o, n = {}, r = (i, h) => {
71
+ if (!l) {
72
+ n[i] = h;
58
73
  return;
59
74
  }
60
- const _ = s === "top" || s === "bottom", G = _ ? "100dvh" : "100dvw", I = l(_ ? A.value : T.value);
61
- r[s] = `clamp(0px, ${f}, calc(${G} - ${I}))`;
75
+ const _ = i === "top" || i === "bottom", L = _ ? "100dvh" : "100dvw", j = m(_ ? w.value : V.value);
76
+ n[i] = `clamp(0px, ${h}, calc(${L} - ${j}))`;
62
77
  };
63
- return e.includes("top") && n("top", l(O.value - A.value - u.value.mainAxis)), e.includes("bottom") && n("bottom", `calc(100% - ${l(C.value + A.value + u.value.mainAxis)})`), e.includes("left") && n("left", l(b.value + u.value.crossAxis)), e.includes("right") && n("right", `calc(100% - ${l(H.value + u.value.crossAxis)})`), e.includes("center") && n("left", l(b.value + L.value / 2 - T.value / 2 + u.value.crossAxis)), r;
78
+ return t.includes("top") && r("top", m(P.value - w.value - d.value.mainAxis)), t.includes("bottom") && r("bottom", `calc(100% - ${m(O.value + w.value + d.value.mainAxis)})`), t.includes("left") && r("left", m(T.value + d.value.crossAxis)), t.includes("right") && r("right", `calc(100% - ${m(C.value + d.value.crossAxis)})`), t.includes("center") && r("left", m(T.value + H.value / 2 - V.value / 2 + d.value.crossAxis)), n;
64
79
  });
65
- E(
80
+ $(
66
81
  () => o.show,
67
- (e) => {
68
- e && U(() => {
69
- M();
70
- });
71
- }
82
+ (t) => {
83
+ t && M();
84
+ },
85
+ { flush: "post" }
72
86
  );
73
- const D = le(h);
74
- return w({
75
- triggerRef: h,
76
- triggerRefs: p,
77
- popperRef: y
78
- }), (e, t) => (d(), S(x, null, [
79
- (d(!0), S(x, null, Z(c.value, (r, n) => (d(), V(q(r), k({
80
- key: r.key ?? n,
87
+ const D = ae(s);
88
+ return g({
89
+ triggerRef: s,
90
+ triggerRefs: c,
91
+ popperRef: a
92
+ }), (t, l) => (y(), E(R, null, [
93
+ (y(!0), E(R, null, U(x(v), (n, r) => (y(), k(W(n), B({
94
+ key: Z(n) ? n.key : r,
81
95
  ref_for: !0,
82
- ref: (s) => $(s, n)
83
- }, { ref_for: !0 }, P.value[n]), null, 16))), 128)),
84
- W(J, K(Q(e.transitionProps)), {
85
- default: X(() => [
86
- e.show ? (d(), V(ee, {
96
+ ref: (i) => x(A)(i, r)
97
+ }, { ref_for: !0 }, e.value[r]), null, 16))), 128)),
98
+ S(t.$slots, "backdrop", {}, void 0, !0),
99
+ F(q, J(K(t.transitionProps)), {
100
+ default: Q(() => [
101
+ t.show ? (y(), k(Y, {
87
102
  key: 0,
88
- to: o.appendTo || te(D)
103
+ to: o.appendTo || x(D)
89
104
  }, [
90
- oe("div", k({
105
+ ee("div", B({
91
106
  class: "tr-base-popper",
92
107
  ref_key: "popperRef",
93
- ref: y,
108
+ ref: a,
94
109
  style: z.value
95
- }, e.$attrs), [
96
- re(e.$slots, "content", {}, void 0, !0)
110
+ }, t.$attrs), [
111
+ S(t.$slots, "content", {}, void 0, !0)
97
112
  ], 16)
98
- ], 8, ["to"])) : Y("", !0)
113
+ ], 8, ["to"])) : X("", !0)
99
114
  ]),
100
115
  _: 3
101
116
  }, 16)
102
117
  ], 64));
103
118
  }
104
- }), ue = /* @__PURE__ */ ie(ce, [["__scopeId", "data-v-9984ba18"]]);
105
- ue.name = "TrBasePopper";
119
+ }), ie = /* @__PURE__ */ ne(le, [["__scopeId", "data-v-8baa02e5"]]);
120
+ ie.name = "TrBasePopper";
106
121
  export {
107
- ue as default
122
+ ie as default
108
123
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent as V, mergeModels as E, useModel as q, watch as g, ref as i, computed as $, createElementBlock as a, openBlock as l, createElementVNode as b, Fragment as C, renderList as S, createCommentVNode as _, normalizeClass as I, createBlock as x, resolveDynamicComponent as B, toDisplayString as D, nextTick as G } from "vue";
1
+ import { defineComponent as V, mergeModels as E, useModel as q, watch as g, ref as i, computed as $, createElementBlock as a, openBlock as l, createElementVNode as C, Fragment as I, renderList as S, createCommentVNode as _, normalizeClass as b, createBlock as x, resolveDynamicComponent as B, toDisplayString as D, nextTick as G } from "vue";
2
2
  import { U as H } from "../tiny-robot-svgs.js";
3
3
  import { b as X, o as j } from "../index2.js";
4
4
  import { _ as J } from "../_plugin-vue_export-helper.js";
@@ -65,12 +65,12 @@ const K = ["onClick"], P = {
65
65
  ref_key: "containerRef",
66
66
  ref: y
67
67
  }, [
68
- (l(!0), a(C, null, S(n.items, (e, f) => (l(), a(C, {
68
+ (l(!0), a(I, null, S(n.items, (e, f) => (l(), a(I, {
69
69
  key: e.id
70
70
  }, [
71
71
  s.value === null || f < s.value ? (l(), a("button", {
72
72
  key: 0,
73
- class: I(["tr-flow-layout__item", { "icon-only": !e.label }, { selected: e.id === u.value }]),
73
+ class: b(["tr-flow-layout__item", { "icon-only": !e.label }, { selected: e.id === u.value }]),
74
74
  ref_for: !0,
75
75
  ref: (r) => A(r, f),
76
76
  onClick: (r) => R(e.id)
@@ -79,10 +79,10 @@ const K = ["onClick"], P = {
79
79
  e.label ? (l(), a("span", P, D(e.label), 1)) : _("", !0)
80
80
  ], 10, K)) : _("", !0)
81
81
  ], 64))), 128)),
82
- b("div", Q, [
82
+ C("div", Q, [
83
83
  m.value ? _("", !0) : (l(), a("button", {
84
84
  key: 0,
85
- class: I(["tr-flow-layout__item", "icon-only", { selected: O.value }]),
85
+ class: b(["tr-flow-layout__item", "icon-only", { selected: O.value }]),
86
86
  ref_key: "moreButtonRef",
87
87
  ref: w,
88
88
  onClick: U,
@@ -91,7 +91,7 @@ const K = ["onClick"], P = {
91
91
  }, [
92
92
  (l(), x(B(n.moreIcon), { class: "tr-flow-layout__item-icon" }))
93
93
  ], 34)),
94
- b("div", {
94
+ C("div", {
95
95
  class: "tr-flow-layout__dropdown-container",
96
96
  onMouseenter: o[2] || (o[2] = (e) => v(!0)),
97
97
  onMouseleave: o[3] || (o[3] = (e) => v(!1))
@@ -102,20 +102,20 @@ const K = ["onClick"], P = {
102
102
  ref_key: "dropDownRef",
103
103
  ref: k
104
104
  }, [
105
- (l(!0), a(C, null, S(z.value, (e) => (l(), a("button", {
106
- class: I(["tr-flow-layout__dropdown_item", { selected: e.id === u.value }]),
105
+ (l(!0), a(I, null, S(z.value, (e) => (l(), a("button", {
106
+ class: b(["tr-flow-layout__dropdown_item", { selected: e.id === u.value }]),
107
107
  key: e.id,
108
108
  onClick: (f) => R(e.id)
109
109
  }, [
110
110
  (l(), x(B(e.icon), { class: "tr-flow-layout__item-icon" })),
111
- b("span", Z, D(e.label), 1)
111
+ C("span", Z, D(e.label), 1)
112
112
  ], 10, Y))), 128))
113
113
  ], 512)) : _("", !0)
114
114
  ], 32)
115
115
  ])
116
116
  ], 512));
117
117
  }
118
- }), p = /* @__PURE__ */ J(ee, [["__scopeId", "data-v-3b70ef9f"]]);
118
+ }), p = /* @__PURE__ */ J(ee, [["__scopeId", "data-v-f82cf3dc"]]);
119
119
  p.name = "TrFlowLayout";
120
120
  const te = function(d) {
121
121
  d.component(p.name, p);
@@ -1,7 +1,7 @@
1
- import { defineComponent as p, useCssVars as l, computed as n, createElementBlock as u, openBlock as s, normalizeClass as m, createBlock as d, resolveDynamicComponent as _ } from "vue";
2
- import { t as c } from "../utils.js";
1
+ import { defineComponent as r, computed as a, createElementBlock as u, openBlock as l, normalizeStyle as c, normalizeClass as p, createBlock as m, resolveDynamicComponent as d } from "vue";
2
+ import { t as i } from "../utils.js";
3
3
  import { _ as f } from "../_plugin-vue_export-helper.js";
4
- const v = /* @__PURE__ */ p({
4
+ const _ = /* @__PURE__ */ r({
5
5
  __name: "index",
6
6
  props: {
7
7
  icon: {},
@@ -9,24 +9,23 @@ const v = /* @__PURE__ */ p({
9
9
  svgSize: { default: "16px" },
10
10
  rounded: { type: Boolean }
11
11
  },
12
- setup(t) {
13
- l((i) => ({
14
- "72b46ad2": a.value,
15
- 66777814: r.value
16
- }));
17
- const o = t, a = n(() => c(o.size)), r = n(() => c(o.svgSize));
18
- return (i, z) => (s(), u("button", {
19
- class: m(["tr-icon-button", { rounded: o.rounded }])
12
+ setup(o) {
13
+ const e = o, s = a(() => i(e.size)), n = a(() => i(e.svgSize));
14
+ return (z, h) => (l(), u("button", {
15
+ class: p(["tr-icon-button", { rounded: e.rounded }]),
16
+ style: c({ width: s.value, height: s.value })
20
17
  }, [
21
- (s(), d(_(o.icon)))
22
- ], 2));
18
+ (l(), m(d(e.icon), {
19
+ style: c({ width: n.value, height: n.value, fontSize: n.value })
20
+ }, null, 8, ["style"]))
21
+ ], 6));
23
22
  }
24
- }), e = /* @__PURE__ */ f(v, [["__scopeId", "data-v-fe8553bc"]]);
25
- e.name = "TrIconButton";
26
- const x = function(t) {
27
- t.component(e.name, e);
23
+ }), t = /* @__PURE__ */ f(_, [["__scopeId", "data-v-159698f7"]]);
24
+ t.name = "TrIconButton";
25
+ const v = function(o) {
26
+ o.component(t.name, t);
28
27
  };
29
- e.install = x;
28
+ t.install = v;
30
29
  export {
31
- e as default
30
+ t as default
32
31
  };