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

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.
@@ -0,0 +1,123 @@
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 x, createBlock as B, resolveDynamicComponent as b, toDisplayString as D, nextTick as G } from "vue";
2
+ import { U as H } from "../tiny-robot-svgs.js";
3
+ import { a as X, o as j } from "../index3.js";
4
+ import { _ as J } from "../_plugin-vue_export-helper.js";
5
+ const K = ["onClick"], P = {
6
+ key: 0,
7
+ class: "tr-flow-layout__item-label"
8
+ }, Q = { class: "tr-flow-layout__dropdown-wrapper" }, Y = ["onClick"], Z = { class: "tr-flow-layout__item-label" }, ee = /* @__PURE__ */ V({
9
+ __name: "index",
10
+ props: /* @__PURE__ */ E({
11
+ items: {},
12
+ selected: {},
13
+ linesLimit: { default: Number.MAX_SAFE_INTEGER },
14
+ moreIcon: { default: H },
15
+ showMoreTrigger: { default: "click" }
16
+ }, {
17
+ selected: {},
18
+ selectedModifiers: {}
19
+ }),
20
+ emits: /* @__PURE__ */ E(["item-click"], ["update:selected"]),
21
+ setup(d, { emit: F }) {
22
+ const n = d, u = q(d, "selected");
23
+ g(
24
+ () => n.items,
25
+ (t) => {
26
+ !t.find((o) => o.id === u.value) && t.length && (u.value = t[0].id);
27
+ },
28
+ { immediate: !0 }
29
+ );
30
+ const N = F, y = i(null), w = i(null), k = i(null), M = i([]), s = i(null), m = i(!1), c = i(!1), A = (t, o) => {
31
+ t && (M.value[o] = t);
32
+ }, L = () => {
33
+ s.value = null, m.value = !1, G(() => {
34
+ const t = y.value, o = w.value;
35
+ if (!t || !o)
36
+ return;
37
+ const e = M.value.slice(0, n.items.length).filter((r) => !!r).map((r) => r.offsetTop), f = Array.from(new Set(e));
38
+ if (f.length > n.linesLimit) {
39
+ const r = f[n.linesLimit - 1], h = e.lastIndexOf(r), T = M.value[h];
40
+ t.clientWidth - T.offsetLeft - T.offsetWidth - 8 < o.offsetWidth ? s.value = h : s.value = h + 1, m.value = !1;
41
+ } else
42
+ s.value = null, m.value = !0;
43
+ });
44
+ };
45
+ g(() => n.items, L);
46
+ const { width: W } = X(y);
47
+ g(W, (t) => {
48
+ t > 0 && L();
49
+ });
50
+ const z = $(() => s.value !== null ? n.items.slice(s.value) : []), O = $(() => s.value === null ? !1 : n.items.findIndex((o) => o.id === u.value) >= s.value), R = (t) => {
51
+ u.value = t, c.value = !1, N("item-click", t);
52
+ }, U = () => {
53
+ n.showMoreTrigger === "click" && (c.value = !c.value);
54
+ }, v = (t) => {
55
+ n.showMoreTrigger === "hover" && (c.value = t);
56
+ };
57
+ return j(k, (t) => {
58
+ var o, e;
59
+ (o = k.value) != null && o.contains(t.target) || (e = w.value) != null && e.contains(t.target) || (c.value = !1);
60
+ }), (t, o) => (l(), a("div", {
61
+ class: "tr-flow-layout",
62
+ ref_key: "containerRef",
63
+ ref: y
64
+ }, [
65
+ (l(!0), a(I, null, S(n.items, (e, f) => (l(), a(I, {
66
+ key: e.id
67
+ }, [
68
+ s.value === null || f < s.value ? (l(), a("button", {
69
+ key: 0,
70
+ class: x(["tr-flow-layout__item", { "icon-only": !e.label }, { selected: e.id === u.value }]),
71
+ ref_for: !0,
72
+ ref: (r) => A(r, f),
73
+ onClick: (r) => R(e.id)
74
+ }, [
75
+ (l(), B(b(e.icon), { class: "tr-flow-layout__item-icon" })),
76
+ e.label ? (l(), a("span", P, D(e.label), 1)) : _("", !0)
77
+ ], 10, K)) : _("", !0)
78
+ ], 64))), 128)),
79
+ C("div", Q, [
80
+ m.value ? _("", !0) : (l(), a("button", {
81
+ key: 0,
82
+ class: x(["tr-flow-layout__item", "icon-only", { selected: O.value }]),
83
+ ref_key: "moreButtonRef",
84
+ ref: w,
85
+ onClick: U,
86
+ onMouseenter: o[0] || (o[0] = (e) => v(!0)),
87
+ onMouseleave: o[1] || (o[1] = (e) => v(!1))
88
+ }, [
89
+ (l(), B(b(n.moreIcon), { class: "tr-flow-layout__item-icon" }))
90
+ ], 34)),
91
+ C("div", {
92
+ class: "tr-flow-layout__dropdown-container",
93
+ onMouseenter: o[2] || (o[2] = (e) => v(!0)),
94
+ onMouseleave: o[3] || (o[3] = (e) => v(!1))
95
+ }, [
96
+ c.value ? (l(), a("div", {
97
+ key: 0,
98
+ class: "tr-flow-layout__dropdown",
99
+ ref_key: "dropDownRef",
100
+ ref: k
101
+ }, [
102
+ (l(!0), a(I, null, S(z.value, (e) => (l(), a("button", {
103
+ class: x(["tr-flow-layout__dropdown_item", { selected: e.id === u.value }]),
104
+ key: e.id,
105
+ onClick: (f) => R(e.id)
106
+ }, [
107
+ (l(), B(b(e.icon), { class: "tr-flow-layout__item-icon" })),
108
+ C("span", Z, D(e.label), 1)
109
+ ], 10, Y))), 128))
110
+ ], 512)) : _("", !0)
111
+ ], 32)
112
+ ])
113
+ ], 512));
114
+ }
115
+ }), p = /* @__PURE__ */ J(ee, [["__scopeId", "data-v-5a28ac75"]]);
116
+ p.name = "TrFlowLayout";
117
+ const te = function(d) {
118
+ d.component(p.name, p);
119
+ };
120
+ p.install = te;
121
+ export {
122
+ p as default
123
+ };
@@ -1,11 +1,11 @@
1
- import { defineComponent as M, createElementBlock as u, openBlock as n, normalizeStyle as X, normalizeClass as D, createElementVNode as p, toDisplayString as k, createVNode as m, unref as e, ref as A, watchEffect as Y, nextTick as Z, mergeModels as G, useCssVars as q, computed as h, useModel as N, createCommentVNode as E, Fragment as T, renderList as $, createBlock as P, withDirectives as ee, mergeProps as te, withCtx as R, withModifiers as H, vModelText as re } from "vue";
2
- import { Q as oe, U as se, M as ae, F as ne, y as ie } from "../tiny-robot-svgs.js";
3
- import { I as le } from "../index5.js";
1
+ import { defineComponent as V, createElementBlock as u, openBlock as n, normalizeStyle as X, normalizeClass as D, createElementVNode as p, toDisplayString as k, createVNode as m, unref as e, ref as G, watchEffect as Y, nextTick as Z, mergeModels as N, useCssVars as q, computed as h, useModel as P, createCommentVNode as E, Fragment as T, renderList as $, createBlock as R, withDirectives as ee, mergeProps as te, withCtx as z, withModifiers as H, vModelText as re } from "vue";
2
+ import { f as oe, z as se, r as ae, n as ne, t as ie } from "../tiny-robot-svgs.js";
3
+ import { I as le } from "../index6.js";
4
4
  import { T as S } from "../index4.js";
5
5
  import B from "../icon-button/index.js";
6
- import { o as ce } from "../index2.js";
7
- import { _ as Q } from "../_plugin-vue_export-helper.js";
8
- const ue = /* @__PURE__ */ M({
6
+ import { o as ce } from "../index3.js";
7
+ import { _ as M } from "../_plugin-vue_export-helper.js";
8
+ const ue = /* @__PURE__ */ V({
9
9
  __name: "item-tag",
10
10
  props: {
11
11
  text: {},
@@ -21,7 +21,7 @@ const ue = /* @__PURE__ */ M({
21
21
  p("span", null, k(t.text), 1)
22
22
  ], 6));
23
23
  }
24
- }), de = /* @__PURE__ */ Q(ue, [["__scopeId", "data-v-346767bb"]]), _e = { class: "tr-history__empty" }, pe = { class: "tr-history__empty-icon" }, he = { class: "tr-history__empty-text" }, me = /* @__PURE__ */ M({
24
+ }), de = /* @__PURE__ */ M(ue, [["__scopeId", "data-v-346767bb"]]), _e = { class: "tr-history__empty" }, pe = { class: "tr-history__empty-icon" }, he = { class: "tr-history__empty-text" }, me = /* @__PURE__ */ V({
25
25
  __name: "search-empty",
26
26
  props: {
27
27
  text: { default: "暂无内容" }
@@ -35,14 +35,14 @@ const ue = /* @__PURE__ */ M({
35
35
  p("span", he, k(t.text), 1)
36
36
  ]));
37
37
  }
38
- }), ye = /* @__PURE__ */ Q(me, [["__scopeId", "data-v-b21f5bc0"]]), ve = (i) => {
39
- const t = A(), a = (l) => {
38
+ }), fe = /* @__PURE__ */ M(me, [["__scopeId", "data-v-b21f5bc0"]]), ve = (i) => {
39
+ const t = G(), a = (l) => {
40
40
  t.value = {
41
41
  id: l.id,
42
42
  title: l.title,
43
43
  rawData: l
44
44
  };
45
- }, _ = A(null), y = (l) => {
45
+ }, _ = G(null), f = (l) => {
46
46
  l && Z(() => {
47
47
  _.value = l, _.value.focus();
48
48
  });
@@ -69,18 +69,18 @@ const ue = /* @__PURE__ */ M({
69
69
  }), {
70
70
  editingItem: t,
71
71
  handleEdit: a,
72
- handleEditorInputRef: y,
72
+ handleEditorInputRef: f,
73
73
  handleKeyDown: b
74
74
  };
75
- }, fe = { class: "tr-history" }, ke = { class: "tr-history__tabs" }, ge = ["onClick"], be = {
75
+ }, ye = { class: "tr-history" }, ke = { class: "tr-history__tabs" }, ge = ["onClick"], be = {
76
76
  key: 0,
77
77
  class: "tr-history__search"
78
78
  }, xe = { class: "tr-history__content" }, Ce = {
79
79
  key: 0,
80
80
  class: "tr-history__group-title"
81
- }, Te = ["onClick"], Ie = { class: "tr-history__item-title" }, we = { class: "tr-history__item-actions" }, Ee = { class: "tr-history__close" }, $e = /* @__PURE__ */ M({
81
+ }, Te = ["onClick"], Ie = { class: "tr-history__item-title" }, we = { class: "tr-history__item-actions" }, Ee = { class: "tr-history__close" }, $e = /* @__PURE__ */ V({
82
82
  __name: "index",
83
- props: /* @__PURE__ */ G({
83
+ props: /* @__PURE__ */ N({
84
84
  tabTitle: {},
85
85
  data: {},
86
86
  activeTab: {},
@@ -96,31 +96,31 @@ const ue = /* @__PURE__ */ M({
96
96
  searchQuery: {},
97
97
  searchQueryModifiers: {}
98
98
  }),
99
- emits: /* @__PURE__ */ G(["close", "item-click", "item-title-change", "item-delete"], ["update:activeTab", "update:searchQuery"]),
99
+ emits: /* @__PURE__ */ N(["close", "item-click", "item-title-change", "item-delete"], ["update:activeTab", "update:searchQuery"]),
100
100
  setup(i, { emit: t }) {
101
101
  q((c) => ({
102
102
  d4b77bae: b.value ? "1px solid rgb(240, 240, 240)" : "none",
103
103
  "659130e6": b.value ? "2px solid rgb(25, 25, 25)" : "none"
104
104
  }));
105
- const a = i, _ = N(i, "activeTab"), y = N(i, "searchQuery"), r = t, v = h(() => Array.isArray(a.tabs) ? a.tabs : [{ title: a.tabTitle, id: "0" }]), g = h(() => _.value || v.value[0].id), b = h(() => v.value.length > 1), l = (c) => {
105
+ const a = i, _ = P(i, "activeTab"), f = P(i, "searchQuery"), r = t, v = h(() => Array.isArray(a.tabs) ? a.tabs : [{ title: a.tabTitle, id: "0" }]), g = h(() => _.value || v.value[0].id), b = h(() => v.value.length > 1), l = (c) => {
106
106
  var s;
107
107
  const o = typeof ((s = c[0]) == null ? void 0 : s.group);
108
108
  return o === "string" || o === "symbol";
109
- }, I = h(() => Array.isArray(a.data) ? a.data || [] : a.data[g.value] || []), w = Symbol("NO_GROUP"), V = h(() => {
109
+ }, I = h(() => Array.isArray(a.data) ? a.data || [] : a.data[g.value] || []), w = Symbol("NO_GROUP"), O = h(() => {
110
110
  const c = I.value;
111
111
  return l(c) ? c : [{ group: w, items: c }];
112
- }), x = h(() => a.searchBar ? V.value.map((o) => ({
112
+ }), x = h(() => a.searchBar ? O.value.map((o) => ({
113
113
  ...o,
114
- items: o.items.filter((s) => a.searchFn(y.value || "", s))
115
- })).filter((o) => o.items.length > 0) : V.value), K = h(() => x.value.length === 0 ? !1 : x.value[0].group === w ? x.value[0].items.length > 0 : !0), L = (c) => {
114
+ items: o.items.filter((s) => a.searchFn(f.value || "", s))
115
+ })).filter((o) => o.items.length > 0) : O.value), K = h(() => x.value.length === 0 ? !1 : x.value[0].group === w ? x.value[0].items.length > 0 : !0), L = (c) => {
116
116
  var o;
117
117
  c.id !== ((o = C.value) == null ? void 0 : o.id) && r("item-click", c);
118
- }, z = () => {
118
+ }, W = () => {
119
119
  r("close");
120
- }, W = (c) => {
120
+ }, F = (c) => {
121
121
  r("item-delete", c);
122
- }, { editingItem: C, handleEdit: j, handleEditorInputRef: J, handleKeyDown: O } = ve(r);
123
- return (c, o) => (n(), u("div", fe, [
122
+ }, { editingItem: C, handleEdit: j, handleEditorInputRef: J, handleKeyDown: Q } = ve(r);
123
+ return (c, o) => (n(), u("div", ye, [
124
124
  p("div", ke, [
125
125
  (n(!0), u(T, null, $(v.value, (s) => (n(), u("div", {
126
126
  key: s.id,
@@ -130,8 +130,8 @@ const ue = /* @__PURE__ */ M({
130
130
  ]),
131
131
  a.searchBar ? (n(), u("div", be, [
132
132
  m(e(le), {
133
- modelValue: y.value,
134
- "onUpdate:modelValue": o[0] || (o[0] = (s) => y.value = s),
133
+ modelValue: f.value,
134
+ "onUpdate:modelValue": o[0] || (o[0] = (s) => f.value = s),
135
135
  placeholder: a.searchPlaceholder || "搜索对话名称",
136
136
  "prefix-icon": e(se),
137
137
  clearable: ""
@@ -146,15 +146,15 @@ const ue = /* @__PURE__ */ M({
146
146
  p("span", null, k(s.group), 1)
147
147
  ])) : E("", !0),
148
148
  (n(!0), u(T, null, $(s.items, (d) => {
149
- var U;
149
+ var A;
150
150
  return n(), u("div", {
151
151
  key: `${d.id}-${d.title}`,
152
152
  class: D(["tr-history__item", { selected: a.selected === d.id }]),
153
- onClick: (f) => L(d)
153
+ onClick: (y) => L(d)
154
154
  }, [
155
- ((U = e(C)) == null ? void 0 : U.id) !== d.id ? (n(), u(T, { key: 0 }, [
155
+ ((A = e(C)) == null ? void 0 : A.id) !== d.id ? (n(), u(T, { key: 0 }, [
156
156
  p("span", Ie, k(d.title), 1),
157
- d.tag ? (n(), P(e(de), te({
157
+ d.tag ? (n(), R(e(de), te({
158
158
  key: 0,
159
159
  class: "tr-history__item-tag",
160
160
  ref_for: !0
@@ -166,10 +166,10 @@ const ue = /* @__PURE__ */ M({
166
166
  placement: "top",
167
167
  "open-delay": 500
168
168
  }, {
169
- default: R(() => [
169
+ default: z(() => [
170
170
  m(e(B), {
171
171
  icon: e(ae),
172
- onClick: H((f) => e(j)(d), ["stop"])
172
+ onClick: H((y) => e(j)(d), ["stop"])
173
173
  }, null, 8, ["icon", "onClick"])
174
174
  ]),
175
175
  _: 2
@@ -180,10 +180,10 @@ const ue = /* @__PURE__ */ M({
180
180
  placement: "top",
181
181
  "open-delay": 500
182
182
  }, {
183
- default: R(() => [
183
+ default: z(() => [
184
184
  m(e(B), {
185
185
  icon: e(ne),
186
- onClick: H((f) => W(d), ["stop"])
186
+ onClick: H((y) => F(d), ["stop"])
187
187
  }, null, 8, ["icon", "onClick"])
188
188
  ]),
189
189
  _: 2
@@ -191,38 +191,38 @@ const ue = /* @__PURE__ */ M({
191
191
  ])
192
192
  ], 64)) : ee((n(), u("input", {
193
193
  key: 1,
194
- "onUpdate:modelValue": o[1] || (o[1] = (f) => e(C).title = f),
194
+ "onUpdate:modelValue": o[1] || (o[1] = (y) => e(C).title = y),
195
195
  class: "tr-history__item-edit",
196
196
  ref_for: !0,
197
197
  ref: e(J),
198
198
  onKeydown: o[2] || (o[2] = //@ts-ignore
199
- (...f) => e(O) && e(O)(...f))
199
+ (...y) => e(Q) && e(Q)(...y))
200
200
  }, null, 544)), [
201
201
  [re, e(C).title]
202
202
  ])
203
203
  ], 10, Te);
204
204
  }), 128))
205
- ]))), 128)) : (n(), P(e(ye), {
205
+ ]))), 128)) : (n(), R(e(fe), {
206
206
  key: 1,
207
- text: y.value ? "暂无搜索结果" : "暂无内容"
207
+ text: f.value ? "暂无搜索结果" : "暂无内容"
208
208
  }, null, 8, ["text"]))
209
209
  ]),
210
210
  p("div", Ee, [
211
211
  m(e(B), {
212
212
  icon: e(ie),
213
213
  rounded: "",
214
- onClick: z
214
+ onClick: W
215
215
  }, null, 8, ["icon"])
216
216
  ])
217
217
  ]));
218
218
  }
219
- }), F = /* @__PURE__ */ Q($e, [["__scopeId", "data-v-8aa5fd59"]]), Be = function(i) {
220
- i.component("TrHistory", F);
221
- }, Ge = {
222
- ...F,
219
+ }), U = /* @__PURE__ */ M($e, [["__scopeId", "data-v-8aa5fd59"]]), Be = function(i) {
220
+ i.component("TrHistory", U);
221
+ }, Ne = {
222
+ ...U,
223
223
  install: Be,
224
224
  name: "TrHistory"
225
225
  };
226
226
  export {
227
- Ge as default
227
+ Ne as default
228
228
  };
@@ -1,6 +1,7 @@
1
- import { defineComponent as i, useCssVars as p, computed as a, createElementBlock as l, openBlock as c, normalizeClass as m, createBlock as d, resolveDynamicComponent as f } from "vue";
2
- import { _ } from "../_plugin-vue_export-helper.js";
3
- const x = /* @__PURE__ */ i({
1
+ import { defineComponent as p, useCssVars as l, computed as t, createElementBlock as u, openBlock as s, normalizeClass as m, createBlock as d, resolveDynamicComponent as _ } from "vue";
2
+ import { toCssUnit as c } from "../shared/index.js";
3
+ import { _ as f } from "../_plugin-vue_export-helper.js";
4
+ const v = /* @__PURE__ */ p({
4
5
  __name: "index",
5
6
  props: {
6
7
  icon: {},
@@ -8,24 +9,24 @@ const x = /* @__PURE__ */ i({
8
9
  svgSize: { default: "16px" },
9
10
  rounded: { type: Boolean }
10
11
  },
11
- setup(t) {
12
- p((e) => ({
13
- "56dcaa02": r.value,
14
- "0eb2a672": u.value
12
+ setup(n) {
13
+ l((i) => ({
14
+ "72b46ad2": a.value,
15
+ 66777814: r.value
15
16
  }));
16
- const o = t, s = (e) => isNaN(Number(e)) ? e : `${e}px`, r = a(() => s(o.size)), u = a(() => s(o.svgSize));
17
- return (e, z) => (c(), l("button", {
17
+ const o = n, a = t(() => c(o.size)), r = t(() => c(o.svgSize));
18
+ return (i, z) => (s(), u("button", {
18
19
  class: m(["tr-icon-button", { rounded: o.rounded }])
19
20
  }, [
20
- (c(), d(f(o.icon)))
21
+ (s(), d(_(o.icon)))
21
22
  ], 2));
22
23
  }
23
- }), n = /* @__PURE__ */ _(x, [["__scopeId", "data-v-21ea878f"]]);
24
- n.name = "TrIconButton";
25
- const v = function(t) {
26
- t.component(n.name, n);
24
+ }), e = /* @__PURE__ */ f(v, [["__scopeId", "data-v-fe8553bc"]]);
25
+ e.name = "TrIconButton";
26
+ const x = function(n) {
27
+ n.component(e.name, e);
27
28
  };
28
- n.install = v;
29
+ e.install = x;
29
30
  export {
30
- n as default
31
+ e as default
31
32
  };