@opentiny/tiny-robot 0.2.0-alpha.6 → 0.2.0-alpha.7

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,8 +1,8 @@
1
- import { defineComponent as $, useCssVars as T, unref as D, ref as d, computed as S, watch as B, createElementBlock as u, openBlock as n, renderSlot as M, createVNode as R, Transition as V, withCtx as E, createBlock as N, createCommentVNode as O, Teleport as W, createElementVNode as m, normalizeStyle as I, Fragment as b, renderList as z, toDisplayString as F } from "vue";
2
- import { u as p, o as H } from "../index3.js";
1
+ import { defineComponent as T, useCssVars as D, unref as S, ref as c, computed as B, watch as M, createElementBlock as m, openBlock as n, renderSlot as R, createVNode as V, Transition as E, withCtx as N, createBlock as O, createCommentVNode as W, Teleport as I, createElementVNode as p, normalizeStyle as b, Fragment as z, renderList as F, toDisplayString as H } from "vue";
2
+ import { u as f, o as L } from "../index3.js";
3
3
  import { toCssUnit as o } from "../shared/index.js";
4
- import { _ as L } from "../_plugin-vue_export-helper.js";
5
- const P = { class: "tr-dropdown-menu__list" }, U = ["onClick"], j = /* @__PURE__ */ $({
4
+ import { _ as P } from "../_plugin-vue_export-helper.js";
5
+ const U = { class: "tr-dropdown-menu__list" }, j = ["onClick"], q = /* @__PURE__ */ T({
6
6
  __name: "index",
7
7
  props: {
8
8
  items: {},
@@ -10,63 +10,64 @@ const P = { class: "tr-dropdown-menu__list" }, U = ["onClick"], j = /* @__PURE__
10
10
  topOffset: { default: 0 }
11
11
  },
12
12
  emits: ["item-click"],
13
- setup(s, { emit: f }) {
14
- T((e) => ({
15
- f8e23632: D(o)(l.minWidth)
13
+ setup(s, { emit: _ }) {
14
+ D((e) => ({
15
+ "2f21d602": S(o)(l.minWidth)
16
16
  }));
17
- const l = s, t = d(!1), _ = f, c = d(null), a = d(null), { x: w, y: h, update: v } = p(c), { width: k, height: g } = p(a), x = S(() => ({
18
- left: `min(${o(w.value)}, 100% - ${o(k.value)})`,
19
- top: `max(${o(h.value)} - ${o(g.value)} + ${o(l.topOffset)} - 8px, 0px)`
17
+ const l = s, t = c(!1), w = _, a = c(null), i = c(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)`
20
20
  }));
21
- H(a, (e) => {
22
- e.stopPropagation(), t.value = !1;
23
- }), B(t, (e) => {
24
- e && v();
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) => {
25
+ e && k();
25
26
  });
26
- const y = () => {
27
+ const C = () => {
27
28
  t.value = !t.value;
28
- }, C = (e) => {
29
- t.value = !1, _("item-click", e);
29
+ }, $ = (e) => {
30
+ t.value = !1, w("item-click", e);
30
31
  };
31
- return (e, A) => (n(), u("div", {
32
+ return (e, d) => (n(), m("div", {
32
33
  class: "tr-dropdown-menu__wrapper",
33
34
  ref_key: "dropDownTriggerRef",
34
- ref: c,
35
- onClick: y
35
+ ref: a,
36
+ onClick: C
36
37
  }, [
37
- M(e.$slots, "default", {}, void 0, !0),
38
- R(V, { name: "tr-dropdown-menu" }, {
39
- default: E(() => [
40
- t.value ? (n(), N(W, {
38
+ R(e.$slots, "default", {}, void 0, !0),
39
+ V(E, { name: "tr-dropdown-menu" }, {
40
+ default: N(() => [
41
+ t.value ? (n(), O(I, {
41
42
  key: 0,
42
43
  to: "body"
43
44
  }, [
44
- m("div", {
45
+ p("div", {
45
46
  class: "tr-dropdown-menu",
46
- style: I(x.value),
47
+ style: b(y.value),
47
48
  ref_key: "dropdownMenuRef",
48
- ref: a
49
+ ref: i
49
50
  }, [
50
- m("ul", P, [
51
- (n(!0), u(b, null, z(l.items, (i) => (n(), u("li", {
51
+ p("ul", U, [
52
+ (n(!0), m(z, null, F(l.items, (u) => (n(), m("li", {
52
53
  class: "tr-dropdown-menu__list-item",
53
- key: i.id,
54
- onClick: (G) => C(i)
55
- }, F(i.text), 9, U))), 128))
54
+ key: u.id,
55
+ onClick: (G) => $(u)
56
+ }, H(u.text), 9, j))), 128))
56
57
  ])
57
58
  ], 4)
58
- ])) : O("", !0)
59
+ ])) : W("", !0)
59
60
  ]),
60
61
  _: 1
61
62
  })
62
63
  ], 512));
63
64
  }
64
- }), r = /* @__PURE__ */ L(j, [["__scopeId", "data-v-e4886a37"]]);
65
+ }), r = /* @__PURE__ */ P(q, [["__scopeId", "data-v-978efe81"]]);
65
66
  r.name = "TrDropdownMenu";
66
- const q = function(s) {
67
+ const A = function(s) {
67
68
  s.component(r.name, r);
68
69
  };
69
- r.install = q;
70
+ r.install = A;
70
71
  export {
71
72
  r as default
72
73
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent as X, ref as E, computed as z, onMounted as D, watch as K, createElementBlock as a, openBlock as t, createCommentVNode as k, Fragment as I, renderList as S, toDisplayString as y, createVNode as b, unref as l, nextTick as O, createElementVNode as p, createBlock as d, withCtx as f, createTextVNode as U, resolveDynamicComponent as C } from "vue";
1
+ import { defineComponent as X, ref as E, computed as z, onMounted as D, watch as K, createElementBlock as a, openBlock as t, createCommentVNode as k, Fragment as I, renderList as S, toDisplayString as y, createVNode as h, unref as l, nextTick as O, createElementVNode as d, createBlock as _, withCtx as f, createTextVNode as U, resolveDynamicComponent as C } from "vue";
2
2
  import { K as T, U as N, d as q, s as j, p as H, e as J } from "../tiny-robot-svgs.js";
3
3
  import { B as R } from "../index5.js";
4
4
  import $, { ActionGroupItem as V } from "../action-group/index.js";
@@ -10,30 +10,30 @@ const W = { class: "tr-feedback__source-list" }, Y = ["href"], Z = /* @__PURE__
10
10
  sources: {},
11
11
  linesLimit: { default: Number.MAX_SAFE_INTEGER }
12
12
  },
13
- setup(h) {
14
- const _ = h, e = E(!1), L = E([]), c = E(null), g = () => {
13
+ setup(b) {
14
+ const m = b, e = E(!1), g = E([]), c = E(null), L = () => {
15
15
  O(() => {
16
- const u = L.value.map((o) => (o == null ? void 0 : o.offsetTop) || 0), n = Array.from(new Set(u));
17
- if (n.length > _.linesLimit) {
18
- const o = n[_.linesLimit - 1], s = u.lastIndexOf(o);
16
+ const u = g.value.slice(0, m.sources.length).map((o) => (o == null ? void 0 : o.offsetTop) || 0), n = Array.from(new Set(u));
17
+ if (n.length > m.linesLimit) {
18
+ const o = n[m.linesLimit - 1], s = u.lastIndexOf(o);
19
19
  c.value = s;
20
20
  } else
21
21
  c.value = null;
22
22
  });
23
- }, A = z(() => _.sources.length - (c.value || 0));
24
- D(g), K(() => _.sources, g);
25
- const m = (u, n) => {
26
- u && (L.value[n] = u);
23
+ }, A = z(() => m.sources.length - (c.value || 0));
24
+ D(L), K(() => m.sources, L);
25
+ const p = (u, n) => {
26
+ u && (g.value[n] = u);
27
27
  };
28
28
  return (u, n) => (t(), a("div", W, [
29
- (t(!0), a(I, null, S(_.sources, (o, s) => (t(), a(I, { key: s }, [
29
+ (t(!0), a(I, null, S(m.sources, (o, s) => (t(), a(I, { key: s }, [
30
30
  !c.value || e.value || s < c.value ? (t(), a("a", {
31
31
  key: 0,
32
32
  class: "pill",
33
33
  href: o.link,
34
34
  target: "_blank",
35
35
  ref_for: !0,
36
- ref: (r) => m(r, s)
36
+ ref: (r) => p(r, s)
37
37
  }, y(o.label), 9, Y)) : k("", !0),
38
38
  c.value && !e.value && s === c.value ? (t(), a("span", {
39
39
  key: 1,
@@ -46,11 +46,11 @@ const W = { class: "tr-feedback__source-list" }, Y = ["href"], Z = /* @__PURE__
46
46
  class: "pill collapse-pill",
47
47
  onClick: n[1] || (n[1] = (o) => e.value = !1)
48
48
  }, [
49
- b(l(T))
49
+ h(l(T))
50
50
  ])) : k("", !0)
51
51
  ]));
52
52
  }
53
- }), ee = /* @__PURE__ */ P(Z, [["__scopeId", "data-v-5817f518"]]), te = { class: "tr-feedback" }, se = { class: "tr-feedback__operations" }, oe = { class: "tr-feedback__operations-left" }, ne = { key: 1 }, le = { class: "tr-feedback__operations-right" }, ae = {
53
+ }), ee = /* @__PURE__ */ P(Z, [["__scopeId", "data-v-c5fbb560"]]), te = { class: "tr-feedback" }, se = { class: "tr-feedback__operations" }, oe = { class: "tr-feedback__operations-left" }, ne = { key: 1 }, le = { class: "tr-feedback__operations-right" }, ae = {
54
54
  key: 0,
55
55
  class: "tr-feedback__footer"
56
56
  }, re = { key: 0 }, ie = /* @__PURE__ */ X({
@@ -64,55 +64,55 @@ const W = { class: "tr-feedback__source-list" }, Y = ["href"], Z = /* @__PURE__
64
64
  sourcesLinesLimit: { default: Number.MAX_SAFE_INTEGER }
65
65
  },
66
66
  emits: ["operation", "action"],
67
- setup(h, { emit: _ }) {
68
- const e = h, L = {
67
+ setup(b, { emit: m }) {
68
+ const e = b, g = {
69
69
  copy: J,
70
70
  refresh: H,
71
71
  like: j,
72
72
  dislike: q
73
- }, c = _, g = (n) => {
73
+ }, c = m, L = (n) => {
74
74
  var o, s, r;
75
75
  (r = (s = (o = e.operations) == null ? void 0 : o.find((v) => v.name === n)) == null ? void 0 : s.onClick) == null || r.call(s), c("operation", n);
76
76
  }, A = (n) => {
77
77
  var o, s, r;
78
78
  (r = (s = (o = e.actions) == null ? void 0 : o.find((v) => v.name === n)) == null ? void 0 : s.onClick) == null || r.call(s), c("action", n);
79
- }, m = E(!1), u = () => {
80
- m.value = !m.value;
79
+ }, p = E(!1), u = () => {
80
+ p.value = !p.value;
81
81
  };
82
82
  return (n, o) => {
83
83
  var s, r, v, w, B, F, M, G;
84
84
  return t(), a("div", te, [
85
- p("div", se, [
86
- p("div", oe, [
87
- (s = e.operations) != null && s.length ? (t(), d(l($), {
85
+ d("div", se, [
86
+ d("div", oe, [
87
+ (s = e.operations) != null && s.length ? (t(), _(l($), {
88
88
  key: 0,
89
89
  "max-num": e.operationsLimit,
90
90
  "drop-down-show-label-only": !0,
91
- onItemClick: g,
91
+ onItemClick: L,
92
92
  class: "tr-feedback__operations-left-action-group"
93
93
  }, {
94
94
  moreBtn: f(() => [
95
- b(l(R), {
95
+ h(l(R), {
96
96
  round: "",
97
97
  size: "mini",
98
98
  "reset-time": 0,
99
99
  class: "tr-feedback__operations-more-btn"
100
100
  }, {
101
101
  default: f(() => [
102
- o[0] || (o[0] = p("span", null, "更多", -1)),
103
- b(l(N))
102
+ o[0] || (o[0] = d("span", null, "更多", -1)),
103
+ h(l(N))
104
104
  ]),
105
105
  _: 1
106
106
  })
107
107
  ]),
108
108
  default: f(() => [
109
- (t(!0), a(I, null, S(e.operations, (i) => (t(), d(l(V), {
109
+ (t(!0), a(I, null, S(e.operations, (i) => (t(), _(l(V), {
110
110
  key: i.name,
111
111
  name: i.name,
112
112
  label: i.label
113
113
  }, {
114
114
  default: f(() => [
115
- b(l(R), {
115
+ h(l(R), {
116
116
  round: "",
117
117
  "reset-time": 0,
118
118
  size: "mini"
@@ -128,32 +128,32 @@ const W = { class: "tr-feedback__source-list" }, Y = ["href"], Z = /* @__PURE__
128
128
  ]),
129
129
  _: 1
130
130
  }, 8, ["max-num"])) : (r = e.sources) != null && r.length ? (t(), a("div", ne, [
131
- p("span", {
131
+ d("span", {
132
132
  class: "tr-feedback__source",
133
133
  onClick: u
134
134
  }, [
135
- p("span", null, y((v = e.sources) == null ? void 0 : v.length) + "条来源", 1),
136
- (t(), d(C(m.value ? l(T) : l(N))))
135
+ d("span", null, y((v = e.sources) == null ? void 0 : v.length) + "条来源", 1),
136
+ (t(), _(C(p.value ? l(T) : l(N))))
137
137
  ])
138
138
  ])) : k("", !0)
139
139
  ]),
140
- p("div", le, [
141
- b(l($), {
140
+ d("div", le, [
141
+ h(l($), {
142
142
  "max-num": e.actionsLimit,
143
143
  "show-tooltip": !0,
144
144
  onItemClick: A
145
145
  }, {
146
146
  default: f(() => [
147
- (t(!0), a(I, null, S(e.actions, (i) => (t(), d(l(V), {
147
+ (t(!0), a(I, null, S(e.actions, (i) => (t(), _(l(V), {
148
148
  key: i.name,
149
149
  name: i.name,
150
150
  label: i.label
151
151
  }, {
152
152
  default: f(() => [
153
- typeof i.icon == "string" ? (t(), d(l(Q), {
153
+ typeof i.icon == "string" ? (t(), _(l(Q), {
154
154
  key: 0,
155
- icon: L[i.icon]
156
- }, null, 8, ["icon"])) : (t(), d(C(i.icon), { key: 1 }))
155
+ icon: g[i.icon]
156
+ }, null, 8, ["icon"])) : (t(), _(C(i.icon), { key: 1 }))
157
157
  ]),
158
158
  _: 2
159
159
  }, 1032, ["name", "label"]))), 128))
@@ -162,17 +162,17 @@ const W = { class: "tr-feedback__source-list" }, Y = ["href"], Z = /* @__PURE__
162
162
  }, 8, ["max-num"])
163
163
  ])
164
164
  ]),
165
- (w = e.operations) != null && w.length && ((B = e.sources) != null && B.length) || m.value && e.sources ? (t(), a("div", ae, [
165
+ (w = e.operations) != null && w.length && ((B = e.sources) != null && B.length) || p.value && e.sources ? (t(), a("div", ae, [
166
166
  (F = e.operations) != null && F.length && ((M = e.sources) != null && M.length) ? (t(), a("div", re, [
167
- p("span", {
167
+ d("span", {
168
168
  class: "tr-feedback__source",
169
169
  onClick: u
170
170
  }, [
171
- p("span", null, y((G = e.sources) == null ? void 0 : G.length) + "条来源", 1),
172
- (t(), d(C(m.value ? l(T) : l(N))))
171
+ d("span", null, y((G = e.sources) == null ? void 0 : G.length) + "条来源", 1),
172
+ (t(), _(C(p.value ? l(T) : l(N))))
173
173
  ])
174
174
  ])) : k("", !0),
175
- m.value && e.sources ? (t(), d(l(ee), {
175
+ p.value && e.sources ? (t(), _(l(ee), {
176
176
  key: 1,
177
177
  sources: e.sources,
178
178
  "lines-limit": e.sourcesLinesLimit
@@ -183,8 +183,8 @@ const W = { class: "tr-feedback__source-list" }, Y = ["href"], Z = /* @__PURE__
183
183
  }
184
184
  }), x = /* @__PURE__ */ P(ie, [["__scopeId", "data-v-cc6ef316"]]);
185
185
  x.name = "TrFeedback";
186
- const ce = function(h) {
187
- h.component(x.name, x);
186
+ const ce = function(b) {
187
+ b.component(x.name, x);
188
188
  };
189
189
  x.install = ce;
190
190
  export {