@opentiny/tiny-robot 0.3.0-alpha.0 → 0.3.0-alpha.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.
@@ -1,11 +1,11 @@
1
- import { defineComponent as M, createElementBlock as u, openBlock as n, normalizeStyle as J, normalizeClass as D, createElementVNode as p, toDisplayString as k, createVNode as m, unref as e, ref as A, watchEffect as X, 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 H, withModifiers as S, vModelText as re } from "vue";
2
- import { G as oe, l as se, Y as ae, M as ne, T as ie } from "../tiny-robot-svgs.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 h, unref as e, ref as G, watchEffect as Y, nextTick as Z, mergeModels as N, useCssVars as q, computed as m, useModel as P, createCommentVNode as E, Fragment as T, renderList as $, createBlock as R, withDirectives as ee, mergeProps as te, withCtx as H, withModifiers as S, vModelText as re } from "vue";
2
+ import { u as oe, m as se, p as ae, o as ne, s as ie } from "../tiny-robot-svgs.js";
3
3
  import { I as le } from "../index5.js";
4
4
  import { T as U } from "../index4.js";
5
5
  import B from "../icon-button/index.js";
6
6
  import { o as ce } from "../index2.js";
7
- import { _ as V } from "../_plugin-vue_export-helper.js";
8
- const ue = /* @__PURE__ */ M({
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: {},
@@ -16,12 +16,12 @@ const ue = /* @__PURE__ */ M({
16
16
  const t = i;
17
17
  return (a, _) => (n(), u("div", {
18
18
  class: D(["tr-history__item-tag", t.type]),
19
- style: J(t.style)
19
+ style: X(t.style)
20
20
  }, [
21
21
  p("span", null, k(t.text), 1)
22
22
  ], 6));
23
23
  }
24
- }), de = /* @__PURE__ */ V(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" }, me = { class: "tr-history__empty-text" }, he = /* @__PURE__ */ V({
25
25
  __name: "search-empty",
26
26
  props: {
27
27
  text: { default: "暂无内容" }
@@ -30,19 +30,19 @@ const ue = /* @__PURE__ */ M({
30
30
  const t = i;
31
31
  return (a, _) => (n(), u("div", _e, [
32
32
  p("span", pe, [
33
- m(e(oe))
33
+ h(e(oe))
34
34
  ]),
35
- p("span", he, k(t.text), 1)
35
+ p("span", me, k(t.text), 1)
36
36
  ]));
37
37
  }
38
- }), ve = /* @__PURE__ */ V(me, [["__scopeId", "data-v-b21f5bc0"]]), ye = (i) => {
39
- const t = A(), a = (l) => {
38
+ }), ve = /* @__PURE__ */ M(he, [["__scopeId", "data-v-b21f5bc0"]]), ye = (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), v = (l) => {
45
+ }, _ = G(null), v = (l) => {
46
46
  l && Z(() => {
47
47
  _.value = l, _.value.focus();
48
48
  });
@@ -62,7 +62,7 @@ const ue = /* @__PURE__ */ M({
62
62
  }, b = (l) => {
63
63
  l.key === "Enter" ? y() : l.key === "Escape" && g();
64
64
  };
65
- return X(() => {
65
+ return Y(() => {
66
66
  _.value && (r == null || r(), r = ce(_, () => {
67
67
  y();
68
68
  }));
@@ -78,7 +78,7 @@ const ue = /* @__PURE__ */ M({
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
83
  props: /* @__PURE__ */ N({
84
84
  tabTitle: {},
@@ -102,24 +102,24 @@ const ue = /* @__PURE__ */ M({
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, _ = P(i, "activeTab"), v = P(i, "searchQuery"), r = t, y = h(() => Array.isArray(a.tabs) ? a.tabs : [{ title: a.tabTitle, id: "0" }]), g = h(() => _.value || y.value[0].id), b = h(() => y.value.length > 1), l = (c) => {
105
+ const a = i, _ = P(i, "activeTab"), v = P(i, "searchQuery"), r = t, y = m(() => Array.isArray(a.tabs) ? a.tabs : [{ title: a.tabTitle, id: "0" }]), g = m(() => _.value || y.value[0].id), b = m(() => y.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"), G = h(() => {
109
+ }, I = m(() => Array.isArray(a.data) ? a.data || [] : a.data[g.value] || []), w = Symbol("NO_GROUP"), O = m(() => {
110
110
  const c = I.value;
111
111
  return l(c) ? c : [{ group: w, items: c }];
112
- }), x = h(() => a.searchBar ? G.value.map((o) => ({
112
+ }), x = m(() => a.searchBar ? O.value.map((o) => ({
113
113
  ...o,
114
114
  items: o.items.filter((s) => a.searchFn(v.value || "", s))
115
- })).filter((o) => o.items.length > 0) : G.value), L = h(() => x.value.length === 0 ? !1 : x.value[0].group === w ? x.value[0].items.length > 0 : !0), z = (c) => {
115
+ })).filter((o) => o.items.length > 0) : O.value), L = m(() => x.value.length === 0 ? !1 : x.value[0].group === w ? x.value[0].items.length > 0 : !0), z = (c) => {
116
116
  var o;
117
117
  c.id !== ((o = C.value) == null ? void 0 : o.id) && r("item-click", c);
118
118
  }, W = () => {
119
119
  r("close");
120
- }, Y = (c) => {
120
+ }, F = (c) => {
121
121
  r("item-delete", c);
122
- }, { editingItem: C, handleEdit: F, handleEditorInputRef: j, handleKeyDown: O } = ye(r);
122
+ }, { editingItem: C, handleEdit: j, handleEditorInputRef: J, handleKeyDown: Q } = ye(r);
123
123
  return (c, o) => (n(), u("div", fe, [
124
124
  p("div", ke, [
125
125
  (n(!0), u(T, null, $(y.value, (s) => (n(), u("div", {
@@ -129,7 +129,7 @@ const ue = /* @__PURE__ */ M({
129
129
  }, k(s.title), 11, ge))), 128))
130
130
  ]),
131
131
  a.searchBar ? (n(), u("div", be, [
132
- m(e(le), {
132
+ h(e(le), {
133
133
  modelValue: v.value,
134
134
  "onUpdate:modelValue": o[0] || (o[0] = (s) => v.value = s),
135
135
  placeholder: a.searchPlaceholder || "搜索对话名称",
@@ -146,44 +146,43 @@ 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 Q;
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
153
  onClick: (f) => z(d)
154
154
  }, [
155
- ((Q = e(C)) == null ? void 0 : Q.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
157
  d.tag ? (n(), R(e(de), te({
158
158
  key: 0,
159
- class: "tr-history__item-tag",
160
- ref_for: !0
161
- }, d.tag), null, 16)) : E("", !0),
159
+ class: "tr-history__item-tag"
160
+ }, { ref_for: !0 }, d.tag), null, 16)) : E("", !0),
162
161
  p("div", we, [
163
- m(e(U), {
162
+ h(e(U), {
164
163
  content: "编辑",
165
164
  effect: "dark",
166
165
  placement: "top",
167
166
  "open-delay": 500
168
167
  }, {
169
168
  default: H(() => [
170
- m(e(B), {
169
+ h(e(B), {
171
170
  icon: e(ae),
172
- onClick: S((f) => e(F)(d), ["stop"])
171
+ onClick: S((f) => e(j)(d), ["stop"])
173
172
  }, null, 8, ["icon", "onClick"])
174
173
  ]),
175
174
  _: 2
176
175
  }, 1024),
177
- m(e(U), {
176
+ h(e(U), {
178
177
  content: "删除",
179
178
  effect: "dark",
180
179
  placement: "top",
181
180
  "open-delay": 500
182
181
  }, {
183
182
  default: H(() => [
184
- m(e(B), {
183
+ h(e(B), {
185
184
  icon: e(ne),
186
- onClick: S((f) => Y(d), ["stop"])
185
+ onClick: S((f) => F(d), ["stop"])
187
186
  }, null, 8, ["icon", "onClick"])
188
187
  ]),
189
188
  _: 2
@@ -194,9 +193,9 @@ const ue = /* @__PURE__ */ M({
194
193
  "onUpdate:modelValue": o[1] || (o[1] = (f) => e(C).title = f),
195
194
  class: "tr-history__item-edit",
196
195
  ref_for: !0,
197
- ref: e(j),
196
+ ref: e(J),
198
197
  onKeydown: o[2] || (o[2] = //@ts-ignore
199
- (...f) => e(O) && e(O)(...f))
198
+ (...f) => e(Q) && e(Q)(...f))
200
199
  }, null, 544)), [
201
200
  [re, e(C).title]
202
201
  ])
@@ -208,7 +207,7 @@ const ue = /* @__PURE__ */ M({
208
207
  }, null, 8, ["text"]))
209
208
  ]),
210
209
  p("div", Ee, [
211
- m(e(B), {
210
+ h(e(B), {
212
211
  icon: e(ie),
213
212
  rounded: "",
214
213
  onClick: W
@@ -216,7 +215,7 @@ const ue = /* @__PURE__ */ M({
216
215
  ])
217
216
  ]));
218
217
  }
219
- }), K = /* @__PURE__ */ V($e, [["__scopeId", "data-v-8aa5fd59"]]), Be = function(i) {
218
+ }), K = /* @__PURE__ */ M($e, [["__scopeId", "data-v-8aa5fd59"]]), Be = function(i) {
220
219
  i.component("TrHistory", K);
221
220
  }, Ne = {
222
221
  ...K,