@opentiny/tiny-robot 0.3.0-alpha.6 → 0.3.0-alpha.8

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,10 +1,10 @@
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";
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 A, watchEffect as Y, nextTick as Z, mergeModels as G, useCssVars as q, computed as h, useModel as L, createCommentVNode as E, Fragment as T, renderList as $, createBlock as N, withDirectives as ee, mergeProps as te, withCtx as R, withModifiers as z, vModelText as re } from "vue";
2
+ import { P as oe, I as se, z as ae, L as ne, a as ie } from "../tiny-robot-svgs.js";
3
3
  import { I as le } from "../index6.js";
4
- import { T as S } from "../index5.js";
4
+ import { T as H } from "../index2.js";
5
5
  import B from "../icon-button/index.js";
6
- import { o as ce } from "../index2.js";
7
- import { _ as M } from "../_plugin-vue_export-helper.js";
6
+ import { o as ce } from "../index3.js";
7
+ import { _ as P } from "../_plugin-vue_export-helper.js";
8
8
  const ue = /* @__PURE__ */ V({
9
9
  __name: "item-tag",
10
10
  props: {
@@ -21,7 +21,7 @@ const ue = /* @__PURE__ */ V({
21
21
  p("span", null, k(t.text), 1)
22
22
  ], 6));
23
23
  }
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({
24
+ }), de = /* @__PURE__ */ P(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,20 +35,20 @@ const ue = /* @__PURE__ */ V({
35
35
  p("span", he, k(t.text), 1)
36
36
  ]));
37
37
  }
38
- }), fe = /* @__PURE__ */ M(me, [["__scopeId", "data-v-b21f5bc0"]]), ve = (i) => {
39
- const t = G(), a = (l) => {
38
+ }), ve = /* @__PURE__ */ P(me, [["__scopeId", "data-v-b21f5bc0"]]), ye = (i) => {
39
+ const t = A(), a = (l) => {
40
40
  t.value = {
41
41
  id: l.id,
42
42
  title: l.title,
43
43
  rawData: l
44
44
  };
45
- }, _ = G(null), f = (l) => {
45
+ }, _ = A(null), v = (l) => {
46
46
  l && Z(() => {
47
47
  _.value = l, _.value.focus();
48
48
  });
49
49
  };
50
50
  let r;
51
- const v = () => {
51
+ const y = () => {
52
52
  if (t.value) {
53
53
  if (t.value.title !== t.value.rawData.title) {
54
54
  const { title: l, rawData: I } = t.value;
@@ -60,19 +60,19 @@ const ue = /* @__PURE__ */ V({
60
60
  }, g = () => {
61
61
  t.value = void 0, r == null || r(), r = void 0;
62
62
  }, b = (l) => {
63
- l.key === "Enter" ? v() : l.key === "Escape" && g();
63
+ l.key === "Enter" ? y() : l.key === "Escape" && g();
64
64
  };
65
65
  return Y(() => {
66
66
  _.value && (r == null || r(), r = ce(_, () => {
67
- v();
67
+ y();
68
68
  }));
69
69
  }), {
70
70
  editingItem: t,
71
71
  handleEdit: a,
72
- handleEditorInputRef: f,
72
+ handleEditorInputRef: v,
73
73
  handleKeyDown: b
74
74
  };
75
- }, ye = { class: "tr-history" }, ke = { class: "tr-history__tabs" }, ge = ["onClick"], be = {
75
+ }, fe = { 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 = {
@@ -80,7 +80,7 @@ const ue = /* @__PURE__ */ V({
80
80
  class: "tr-history__group-title"
81
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__ */ N({
83
+ props: /* @__PURE__ */ G({
84
84
  tabTitle: {},
85
85
  data: {},
86
86
  activeTab: {},
@@ -96,33 +96,33 @@ const ue = /* @__PURE__ */ V({
96
96
  searchQuery: {},
97
97
  searchQueryModifiers: {}
98
98
  }),
99
- emits: /* @__PURE__ */ N(["close", "item-click", "item-title-change", "item-delete"], ["update:activeTab", "update:searchQuery"]),
99
+ emits: /* @__PURE__ */ G(["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, _ = 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) => {
105
+ const a = i, _ = L(i, "activeTab"), v = L(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) => {
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"), O = h(() => {
109
+ }, I = h(() => Array.isArray(a.data) ? a.data || [] : a.data[g.value] || []), w = Symbol("NO_GROUP"), M = h(() => {
110
110
  const c = I.value;
111
111
  return l(c) ? c : [{ group: w, items: c }];
112
- }), x = h(() => a.searchBar ? O.value.map((o) => ({
112
+ }), x = h(() => a.searchBar ? M.value.map((o) => ({
113
113
  ...o,
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) => {
114
+ items: o.items.filter((s) => a.searchFn(v.value || "", s))
115
+ })).filter((o) => o.items.length > 0) : M.value), U = h(() => x.value.length === 0 ? !1 : x.value[0].group === w ? x.value[0].items.length > 0 : !0), K = (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
120
  }, F = (c) => {
121
121
  r("item-delete", c);
122
- }, { editingItem: C, handleEdit: j, handleEditorInputRef: J, handleKeyDown: Q } = ve(r);
123
- return (c, o) => (n(), u("div", ye, [
122
+ }, { editingItem: C, handleEdit: j, handleEditorInputRef: J, handleKeyDown: O } = ye(r);
123
+ return (c, o) => (n(), u("div", fe, [
124
124
  p("div", ke, [
125
- (n(!0), u(T, null, $(v.value, (s) => (n(), u("div", {
125
+ (n(!0), u(T, null, $(y.value, (s) => (n(), u("div", {
126
126
  key: s.id,
127
127
  class: D(["tr-history__tab", { active: g.value === s.id }]),
128
128
  onClick: (d) => _.value = s.id
@@ -130,15 +130,15 @@ const ue = /* @__PURE__ */ V({
130
130
  ]),
131
131
  a.searchBar ? (n(), u("div", be, [
132
132
  m(e(le), {
133
- modelValue: f.value,
134
- "onUpdate:modelValue": o[0] || (o[0] = (s) => f.value = s),
133
+ modelValue: v.value,
134
+ "onUpdate:modelValue": o[0] || (o[0] = (s) => v.value = s),
135
135
  placeholder: a.searchPlaceholder || "搜索对话名称",
136
136
  "prefix-icon": e(se),
137
137
  clearable: ""
138
138
  }, null, 8, ["modelValue", "placeholder", "prefix-icon"])
139
139
  ])) : E("", !0),
140
140
  p("div", xe, [
141
- K.value ? (n(!0), u(T, { key: 0 }, $(x.value, (s) => (n(), u("div", {
141
+ U.value ? (n(!0), u(T, { key: 0 }, $(x.value, (s) => (n(), u("div", {
142
142
  key: s.group,
143
143
  class: "tr-history__group"
144
144
  }, [
@@ -146,43 +146,43 @@ const ue = /* @__PURE__ */ V({
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 A;
149
+ var Q;
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: (y) => L(d)
153
+ onClick: (f) => K(d)
154
154
  }, [
155
- ((A = e(C)) == null ? void 0 : A.id) !== d.id ? (n(), u(T, { key: 0 }, [
155
+ ((Q = e(C)) == null ? void 0 : Q.id) !== d.id ? (n(), u(T, { key: 0 }, [
156
156
  p("span", Ie, k(d.title), 1),
157
- d.tag ? (n(), R(e(de), te({
157
+ d.tag ? (n(), N(e(de), te({
158
158
  key: 0,
159
159
  class: "tr-history__item-tag"
160
160
  }, { ref_for: !0 }, d.tag), null, 16)) : E("", !0),
161
161
  p("div", we, [
162
- m(e(S), {
162
+ m(e(H), {
163
163
  content: "编辑",
164
164
  effect: "dark",
165
165
  placement: "top",
166
166
  "open-delay": 500
167
167
  }, {
168
- default: z(() => [
168
+ default: R(() => [
169
169
  m(e(B), {
170
170
  icon: e(ae),
171
- onClick: H((y) => e(j)(d), ["stop"])
171
+ onClick: z((f) => e(j)(d), ["stop"])
172
172
  }, null, 8, ["icon", "onClick"])
173
173
  ]),
174
174
  _: 2
175
175
  }, 1024),
176
- m(e(S), {
176
+ m(e(H), {
177
177
  content: "删除",
178
178
  effect: "dark",
179
179
  placement: "top",
180
180
  "open-delay": 500
181
181
  }, {
182
- default: z(() => [
182
+ default: R(() => [
183
183
  m(e(B), {
184
184
  icon: e(ne),
185
- onClick: H((y) => F(d), ["stop"])
185
+ onClick: z((f) => F(d), ["stop"])
186
186
  }, null, 8, ["icon", "onClick"])
187
187
  ]),
188
188
  _: 2
@@ -190,20 +190,20 @@ const ue = /* @__PURE__ */ V({
190
190
  ])
191
191
  ], 64)) : ee((n(), u("input", {
192
192
  key: 1,
193
- "onUpdate:modelValue": o[1] || (o[1] = (y) => e(C).title = y),
193
+ "onUpdate:modelValue": o[1] || (o[1] = (f) => e(C).title = f),
194
194
  class: "tr-history__item-edit",
195
195
  ref_for: !0,
196
196
  ref: e(J),
197
197
  onKeydown: o[2] || (o[2] = //@ts-ignore
198
- (...y) => e(Q) && e(Q)(...y))
198
+ (...f) => e(O) && e(O)(...f))
199
199
  }, null, 544)), [
200
200
  [re, e(C).title]
201
201
  ])
202
202
  ], 10, Te);
203
203
  }), 128))
204
- ]))), 128)) : (n(), R(e(fe), {
204
+ ]))), 128)) : (n(), N(e(ve), {
205
205
  key: 1,
206
- text: f.value ? "暂无搜索结果" : "暂无内容"
206
+ text: v.value ? "暂无搜索结果" : "暂无内容"
207
207
  }, null, 8, ["text"]))
208
208
  ]),
209
209
  p("div", Ee, [
@@ -215,13 +215,13 @@ const ue = /* @__PURE__ */ V({
215
215
  ])
216
216
  ]));
217
217
  }
218
- }), U = /* @__PURE__ */ M($e, [["__scopeId", "data-v-8aa5fd59"]]), Be = function(i) {
219
- i.component("TrHistory", U);
220
- }, Ne = {
221
- ...U,
218
+ }), S = /* @__PURE__ */ P($e, [["__scopeId", "data-v-8aa5fd59"]]), Be = function(i) {
219
+ i.component("TrHistory", S);
220
+ }, Ge = {
221
+ ...S,
222
222
  install: Be,
223
223
  name: "TrHistory"
224
224
  };
225
225
  export {
226
- Ne as default
226
+ Ge as default
227
227
  };