@opentiny/tiny-robot 0.3.1-alpha.8 → 0.3.1-alpha.9
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.
- package/dist/base-popper/index.js +1 -1
- package/dist/bubble/index.js +4017 -11
- package/dist/chat-input/index.js +3154 -0
- package/dist/dropdown-menu/index.js +1 -1
- package/dist/history/index.js +1 -1
- package/dist/index.d.ts +684 -968
- package/dist/index.js +104 -108
- package/dist/index2.js +90 -90
- package/dist/index3.js +150 -155
- package/dist/index4.js +295 -319
- package/dist/index5.js +279 -507
- package/dist/index6.js +146 -286
- package/dist/loading.js +4 -0
- package/dist/mcp-server-picker/index.js +57 -58
- package/dist/sender/index.js +6 -3261
- package/dist/sender-compat/index.js +109 -105
- package/dist/style.css +1 -1
- package/dist/suggestion-popover/index.js +185 -184
- package/package.json +17 -17
- package/dist/index7.js +0 -161
- /package/dist/{sender-actions → chat-input-actions}/index.js +0 -0
package/dist/index5.js
CHANGED
|
@@ -1,529 +1,301 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
)
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
__name: "Box",
|
|
20
|
-
props: {
|
|
21
|
-
placement: {},
|
|
22
|
-
shape: {}
|
|
23
|
-
},
|
|
24
|
-
setup(t) {
|
|
25
|
-
return (n, e) => (m(), y("div", Ee, [
|
|
26
|
-
g(n.$slots, "default", {}, void 0, !0)
|
|
27
|
-
]));
|
|
28
|
-
}
|
|
29
|
-
}), ae = /* @__PURE__ */ P(Ce, [["__scopeId", "data-v-98101726"]]), Se = {
|
|
30
|
-
key: 0,
|
|
31
|
-
class: "tr-bubble__text",
|
|
32
|
-
"data-type": "text"
|
|
33
|
-
}, ke = /* @__PURE__ */ k({
|
|
34
|
-
__name: "Text",
|
|
35
|
-
props: {
|
|
36
|
-
message: {},
|
|
37
|
-
contentIndex: {}
|
|
38
|
-
},
|
|
39
|
-
setup(t) {
|
|
40
|
-
const n = t, e = Oe(() => n.message, n.contentIndex);
|
|
41
|
-
return (a, c) => {
|
|
42
|
-
var i;
|
|
43
|
-
return v(e) ? (m(), y("p", Se, be(typeof v(e) == "string" ? v(e) : (i = v(e)) == null ? void 0 : i.text), 1)) : X("", !0);
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
}), le = /* @__PURE__ */ P(ke, [["__scopeId", "data-v-53daeb22"]]), ce = [], ue = [], de = z(ae), ie = z(le);
|
|
47
|
-
function Ie(t) {
|
|
48
|
-
const { boxRendererMatches: n, fallbackBoxRenderer: e } = t;
|
|
49
|
-
n && S(Z, n), e && S(ee, e);
|
|
50
|
-
}
|
|
51
|
-
function Me(t) {
|
|
52
|
-
const { fallbackBoxRenderer: n } = t;
|
|
53
|
-
n && S(te, n);
|
|
54
|
-
}
|
|
55
|
-
function Ae(t, n) {
|
|
56
|
-
const e = C(Z, ce), a = C(ee, void 0), c = C(te, void 0);
|
|
57
|
-
return _(() => {
|
|
58
|
-
const i = B(t), s = B(e).find((b) => b.find(i, n));
|
|
59
|
-
return s ? {
|
|
60
|
-
renderer: s.renderer,
|
|
61
|
-
attributes: s.attributes
|
|
62
|
-
} : {
|
|
63
|
-
renderer: B(c) || B(a) || de
|
|
64
|
-
};
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
function Le(t) {
|
|
68
|
-
const { contentRendererMatches: n, fallbackContentRenderer: e } = t;
|
|
69
|
-
n && S(ne, n), e && S(se, e);
|
|
70
|
-
}
|
|
71
|
-
function Te(t) {
|
|
72
|
-
const { fallbackContentRenderer: n } = t;
|
|
73
|
-
n && S(oe, n);
|
|
74
|
-
}
|
|
75
|
-
function $e(t, n) {
|
|
76
|
-
const e = C(ne, ue), a = C(se, void 0), c = C(oe, void 0);
|
|
77
|
-
return _(() => {
|
|
78
|
-
const i = B(t), s = B(e).find((b) => b.find(i, n));
|
|
79
|
-
return s ? s.renderer : B(c) || B(a) || ie;
|
|
80
|
-
});
|
|
1
|
+
import { onMounted as ne, onBeforeUnmount as oe, ref as _, defineComponent as P, openBlock as r, createElementBlock as a, createElementVNode as w, createVNode as T, unref as n, toDisplayString as B, useModel as W, computed as I, normalizeStyle as ie, Fragment as S, renderList as V, createBlock as H, resolveDynamicComponent as Y, mergeModels as j, nextTick as se, normalizeClass as U, createCommentVNode as G, renderSlot as q, withDirectives as A, withKeys as F, isRef as le, withModifiers as J, vModelText as re, vShow as ae } from "vue";
|
|
2
|
+
import { IconEmptySearch as ue, IconEditPen as ce, IconDelete as de, IconCheck as me, IconClose as fe, IconMenu2 as pe } from "@opentiny/tiny-robot-svgs";
|
|
3
|
+
import { _ as z } from "./_plugin-vue_export-helper.js";
|
|
4
|
+
import { o as Z, d as ve, c as ge, b as ye } from "./index4.js";
|
|
5
|
+
import { t as O } from "./utils.js";
|
|
6
|
+
const D = _(!1);
|
|
7
|
+
let b = 0, $;
|
|
8
|
+
function _e() {
|
|
9
|
+
const s = window.matchMedia("(hover: none) and (pointer: coarse)"), m = () => {
|
|
10
|
+
D.value = s.matches;
|
|
11
|
+
};
|
|
12
|
+
m(), s.addEventListener("change", m);
|
|
13
|
+
const t = (c) => {
|
|
14
|
+
D.value = c.pointerType !== "mouse";
|
|
15
|
+
};
|
|
16
|
+
return window.addEventListener("pointerdown", t, !0), () => {
|
|
17
|
+
s.removeEventListener("change", m), window.removeEventListener("pointerdown", t, !0);
|
|
18
|
+
};
|
|
81
19
|
}
|
|
82
|
-
function
|
|
83
|
-
|
|
20
|
+
function he() {
|
|
21
|
+
$ == null || $(), $ = void 0;
|
|
84
22
|
}
|
|
85
|
-
function
|
|
86
|
-
return
|
|
87
|
-
|
|
23
|
+
function Ce() {
|
|
24
|
+
return typeof window > "u" ? {
|
|
25
|
+
isTouchDevice: D
|
|
26
|
+
} : (ne(() => {
|
|
27
|
+
b++, b === 1 && ($ = _e());
|
|
28
|
+
}), oe(() => {
|
|
29
|
+
b = Math.max(0, b - 1), b === 0 && he();
|
|
30
|
+
}), {
|
|
31
|
+
isTouchDevice: D
|
|
88
32
|
});
|
|
89
33
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (n)
|
|
93
|
-
return n;
|
|
94
|
-
const e = fe(t || {});
|
|
95
|
-
return S(j, e), e;
|
|
96
|
-
}
|
|
97
|
-
const M = (t) => {
|
|
98
|
-
var n;
|
|
99
|
-
return ((n = t.state) == null ? void 0 : n.content) ?? t.content;
|
|
100
|
-
}, Oe = (t, n) => _(() => {
|
|
101
|
-
const e = M(B(t));
|
|
102
|
-
return Array.isArray(e) ? e.at(n ?? 0) : e;
|
|
103
|
-
});
|
|
104
|
-
function Fe(t) {
|
|
105
|
-
S(Q, t);
|
|
106
|
-
}
|
|
107
|
-
function Ge() {
|
|
108
|
-
return C(Q, void 0);
|
|
109
|
-
}
|
|
110
|
-
function nt(t, n) {
|
|
111
|
-
const e = _(() => {
|
|
112
|
-
const c = Object.entries(t.message).filter(([i]) => !n.includes(i));
|
|
113
|
-
return Object.fromEntries(c);
|
|
114
|
-
}), a = _(() => ({
|
|
115
|
-
...t,
|
|
116
|
-
message: e.value
|
|
117
|
-
}));
|
|
118
|
-
return {
|
|
119
|
-
restMessage: e,
|
|
120
|
-
restProps: a
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
const W = /* @__PURE__ */ k({
|
|
124
|
-
__name: "BubbleBoxWrapper",
|
|
34
|
+
const ke = { class: "tr-history__empty" }, Le = { class: "tr-history__empty-icon" }, Ee = { class: "tr-history__empty-text" }, we = /* @__PURE__ */ P({
|
|
35
|
+
__name: "Empty",
|
|
125
36
|
props: {
|
|
126
|
-
|
|
127
|
-
placement: {},
|
|
128
|
-
shape: {},
|
|
129
|
-
messages: {},
|
|
130
|
-
contentIndex: {}
|
|
37
|
+
text: { default: "暂无内容" }
|
|
131
38
|
},
|
|
132
|
-
setup(
|
|
133
|
-
const
|
|
134
|
-
return (
|
|
135
|
-
"
|
|
136
|
-
|
|
137
|
-
"data-shape": n.shape
|
|
138
|
-
}, v(e).attributes), {
|
|
139
|
-
default: R(() => [
|
|
140
|
-
g(a.$slots, "default")
|
|
39
|
+
setup(s) {
|
|
40
|
+
const m = s;
|
|
41
|
+
return (t, c) => (r(), a("div", ke, [
|
|
42
|
+
w("span", Le, [
|
|
43
|
+
T(n(ue))
|
|
141
44
|
]),
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
}), D = /* @__PURE__ */ k({
|
|
146
|
-
__name: "BubbleContentWrapper",
|
|
147
|
-
props: {
|
|
148
|
-
message: {},
|
|
149
|
-
contentIndex: {}
|
|
150
|
-
},
|
|
151
|
-
emits: ["state-change"],
|
|
152
|
-
setup(t, { emit: n }) {
|
|
153
|
-
const e = t, a = $e(() => e.message, e.contentIndex), c = n;
|
|
154
|
-
return Ne((s, b) => {
|
|
155
|
-
c("state-change", {
|
|
156
|
-
key: s,
|
|
157
|
-
value: b,
|
|
158
|
-
contentIndex: e.contentIndex
|
|
159
|
-
});
|
|
160
|
-
}), (s, b) => (m(), E(U(v(a)), T($(e)), null, 16));
|
|
45
|
+
w("span", Ee, B(m.text), 1)
|
|
46
|
+
]));
|
|
161
47
|
}
|
|
162
|
-
}),
|
|
163
|
-
__name: "
|
|
164
|
-
props: {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
"data-placement": e.placement
|
|
48
|
+
}), Re = /* @__PURE__ */ z(we, [["__scopeId", "data-v-d0340c39"]]), Ie = ["onClick"], Q = 4, xe = /* @__PURE__ */ P({
|
|
49
|
+
__name: "MenuList",
|
|
50
|
+
props: /* @__PURE__ */ j({
|
|
51
|
+
items: {},
|
|
52
|
+
menuListGap: { default: 8 }
|
|
53
|
+
}, {
|
|
54
|
+
trigger: { default: null },
|
|
55
|
+
triggerModifiers: {},
|
|
56
|
+
data: { default: null },
|
|
57
|
+
dataModifiers: {}
|
|
58
|
+
}),
|
|
59
|
+
emits: /* @__PURE__ */ j(["item-click"], ["update:trigger", "update:data"]),
|
|
60
|
+
setup(s, { emit: m }) {
|
|
61
|
+
const t = W(s, "trigger"), c = W(s, "data"), h = s, C = m, E = _(null);
|
|
62
|
+
Z(
|
|
63
|
+
E,
|
|
64
|
+
() => {
|
|
65
|
+
t.value = null, c.value = null;
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
ignore: [t]
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
const { top: p, bottom: x, left: y } = ve(t), { width: M, height: k } = ge(E, void 0, { box: "border-box" }), { height: R } = ye(), o = I(() => {
|
|
72
|
+
const L = {
|
|
73
|
+
left: `min(${O(y.value)}, calc(100% - ${O(M.value + Q)}))`
|
|
74
|
+
}, g = x.value + h.menuListGap;
|
|
75
|
+
return g + k.value + Q > R.value ? L.bottom = `calc(100% - ${O(p.value - h.menuListGap)})` : L.top = O(g), L;
|
|
76
|
+
}), v = (L) => {
|
|
77
|
+
C("item-click", L), t.value = null, c.value = null;
|
|
78
|
+
};
|
|
79
|
+
return (L, g) => (r(), a("ul", {
|
|
80
|
+
class: "tr-history__menu-list",
|
|
81
|
+
ref_key: "menuRef",
|
|
82
|
+
ref: E,
|
|
83
|
+
style: ie(o.value)
|
|
199
84
|
}, [
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
K("div", Ke, [
|
|
210
|
-
x.value ? (m(!0), y(N, { key: 0 }, G(v(M)(s.value[0]), (u, r) => (m(), E(W, {
|
|
211
|
-
key: r,
|
|
212
|
-
class: "tr-bubble__box",
|
|
213
|
-
role: e.role,
|
|
214
|
-
placement: e.placement,
|
|
215
|
-
shape: e.shape,
|
|
216
|
-
messages: s.value,
|
|
217
|
-
"content-index": r
|
|
218
|
-
}, {
|
|
219
|
-
default: R(() => [
|
|
220
|
-
ge(D, {
|
|
221
|
-
message: s.value[0],
|
|
222
|
-
"content-index": r,
|
|
223
|
-
onStateChange: f[0] || (f[0] = (l) => a("state-change", { ...l, messageIndex: 0 }))
|
|
224
|
-
}, null, 8, ["message", "content-index"]),
|
|
225
|
-
g(h.$slots, "content-footer", {
|
|
226
|
-
messages: s.value,
|
|
227
|
-
role: e.role,
|
|
228
|
-
contentIndex: r
|
|
229
|
-
}, void 0, !0)
|
|
230
|
-
]),
|
|
231
|
-
_: 2
|
|
232
|
-
}, 1032, ["role", "placement", "shape", "messages", "content-index"]))), 128)) : (m(), E(W, {
|
|
233
|
-
key: 1,
|
|
234
|
-
role: e.role,
|
|
235
|
-
placement: e.placement,
|
|
236
|
-
shape: e.shape,
|
|
237
|
-
messages: s.value
|
|
238
|
-
}, {
|
|
239
|
-
default: R(() => [
|
|
240
|
-
(m(!0), y(N, null, G(s.value, (u, r) => (m(), y(N, {
|
|
241
|
-
key: `message-${r}`
|
|
242
|
-
}, [
|
|
243
|
-
Array.isArray(v(M)(u)) ? (m(!0), y(N, { key: 0 }, G(v(M)(u), (l, d) => (m(), E(D, {
|
|
244
|
-
key: `content-${d}`,
|
|
245
|
-
message: u,
|
|
246
|
-
"content-index": d,
|
|
247
|
-
onStateChange: (o) => a("state-change", { ...o, messageIndex: r })
|
|
248
|
-
}, null, 8, ["message", "content-index", "onStateChange"]))), 128)) : (m(), E(D, {
|
|
249
|
-
key: 1,
|
|
250
|
-
message: u,
|
|
251
|
-
onStateChange: (l) => a("state-change", { ...l, messageIndex: r })
|
|
252
|
-
}, null, 8, ["message", "onStateChange"]))
|
|
253
|
-
], 64))), 128)),
|
|
254
|
-
g(h.$slots, "content-footer", {
|
|
255
|
-
messages: s.value,
|
|
256
|
-
role: e.role
|
|
257
|
-
}, void 0, !0)
|
|
258
|
-
]),
|
|
259
|
-
_: 3
|
|
260
|
-
}, 8, ["role", "placement", "shape", "messages"]))
|
|
261
|
-
]),
|
|
262
|
-
K("div", De, [
|
|
263
|
-
g(h.$slots, "after", {
|
|
264
|
-
messages: s.value,
|
|
265
|
-
role: t.role
|
|
266
|
-
}, void 0, !0)
|
|
267
|
-
])
|
|
268
|
-
]),
|
|
269
|
-
g(h.$slots, "suffix", {
|
|
270
|
-
messages: s.value,
|
|
271
|
-
role: t.role
|
|
272
|
-
}, void 0, !0)
|
|
273
|
-
], 8, Pe)), [
|
|
274
|
-
[_e, !b.value]
|
|
275
|
-
]);
|
|
85
|
+
(r(!0), a(S, null, V(h.items, (u) => (r(), a("li", {
|
|
86
|
+
class: "tr-history__menu-list__item",
|
|
87
|
+
key: u.id,
|
|
88
|
+
onClick: (K) => v(u)
|
|
89
|
+
}, [
|
|
90
|
+
(r(), H(Y(u.icon))),
|
|
91
|
+
w("span", null, B(u.text), 1)
|
|
92
|
+
], 8, Ie))), 128))
|
|
93
|
+
], 4));
|
|
276
94
|
}
|
|
277
|
-
}),
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}, d = () => {
|
|
300
|
-
b || !s.value || (b = !0, requestAnimationFrame(async () => {
|
|
301
|
-
b = !1, await l("auto");
|
|
302
|
-
}));
|
|
95
|
+
}), Me = /* @__PURE__ */ z(xe, [["__scopeId", "data-v-89fdb41c"]]), be = ({
|
|
96
|
+
renameControlOnClickOutside: s,
|
|
97
|
+
onItemTitleChange: m
|
|
98
|
+
}) => {
|
|
99
|
+
const t = _(void 0), c = _(null), h = I(() => {
|
|
100
|
+
var o;
|
|
101
|
+
return (o = c.value) == null ? void 0 : o.at(0);
|
|
102
|
+
}), C = _(null), E = I(() => {
|
|
103
|
+
var o;
|
|
104
|
+
return (o = C.value) == null ? void 0 : o.at(0);
|
|
105
|
+
}), p = _(null), x = I(() => {
|
|
106
|
+
var o;
|
|
107
|
+
return (o = p.value) == null ? void 0 : o.at(0);
|
|
108
|
+
}), y = _(""), M = (o) => {
|
|
109
|
+
t.value = o, y.value = o.title, se(() => {
|
|
110
|
+
const v = h.value;
|
|
111
|
+
v && (v.focus(), v.select());
|
|
112
|
+
});
|
|
113
|
+
}, k = () => {
|
|
114
|
+
t.value = void 0, y.value = "";
|
|
115
|
+
}, R = () => {
|
|
116
|
+
t.value && m(y.value, t.value), t.value = void 0, y.value = "";
|
|
303
117
|
};
|
|
304
|
-
return
|
|
305
|
-
|
|
306
|
-
() => {
|
|
307
|
-
const o = B(h);
|
|
308
|
-
o && (s.value = r(o));
|
|
309
|
-
},
|
|
310
|
-
{ flush: "post" }
|
|
311
|
-
), xe(
|
|
312
|
-
n,
|
|
118
|
+
return (s === "confirm" || s === "cancel") && Z(
|
|
119
|
+
h,
|
|
313
120
|
() => {
|
|
314
|
-
|
|
121
|
+
s === "confirm" ? R() : k();
|
|
315
122
|
},
|
|
316
|
-
{
|
|
317
|
-
),
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
l("auto"), x.delete(p);
|
|
327
|
-
});
|
|
328
|
-
x.add(p);
|
|
329
|
-
}
|
|
330
|
-
}), {
|
|
331
|
-
scrollToBottom: l
|
|
123
|
+
{ ignore: [E, x] }
|
|
124
|
+
), {
|
|
125
|
+
editingItem: t,
|
|
126
|
+
editorRefList: c,
|
|
127
|
+
editorConfirmRefList: C,
|
|
128
|
+
editorCancelRefList: p,
|
|
129
|
+
editorValue: y,
|
|
130
|
+
handleEdit: M,
|
|
131
|
+
handleEditCancel: k,
|
|
132
|
+
handleEditConfirm: R
|
|
332
133
|
};
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
roleConfig: {},
|
|
339
|
-
contentRenderMode: {}
|
|
340
|
-
},
|
|
341
|
-
emits: ["state-change"],
|
|
342
|
-
setup(t, { emit: n }) {
|
|
343
|
-
const e = t, a = n;
|
|
344
|
-
return Fe(() => e.messageGroup), (c, i) => (m(), E(L, A(t.roleConfig, {
|
|
345
|
-
role: t.messageGroup.role,
|
|
346
|
-
"content-render-mode": t.contentRenderMode,
|
|
347
|
-
onStateChange: i[0] || (i[0] = (s) => a("state-change", s))
|
|
348
|
-
}), {
|
|
349
|
-
prefix: R((s) => [
|
|
350
|
-
g(c.$slots, "prefix", T($(s)))
|
|
351
|
-
]),
|
|
352
|
-
suffix: R((s) => [
|
|
353
|
-
g(c.$slots, "suffix", T($(s)))
|
|
354
|
-
]),
|
|
355
|
-
"content-footer": R((s) => [
|
|
356
|
-
g(c.$slots, "content-footer", T($(s)))
|
|
357
|
-
]),
|
|
358
|
-
after: R((s) => [
|
|
359
|
-
g(c.$slots, "after", T($(s)))
|
|
360
|
-
]),
|
|
361
|
-
_: 3
|
|
362
|
-
}, 16, ["role", "content-render-mode"]));
|
|
363
|
-
}
|
|
364
|
-
}), Ve = /* @__PURE__ */ k({
|
|
365
|
-
__name: "BubbleList",
|
|
134
|
+
}, X = Symbol("NO_GROUP"), Te = {
|
|
135
|
+
key: 0,
|
|
136
|
+
class: "tr-history__group-title"
|
|
137
|
+
}, $e = { class: "tr-history__group-items" }, Ge = ["onClick"], Oe = ["title"], Se = ["onClick"], Be = /* @__PURE__ */ P({
|
|
138
|
+
__name: "index",
|
|
366
139
|
props: {
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
140
|
+
data: {},
|
|
141
|
+
selected: {},
|
|
142
|
+
showRenameControls: { type: Boolean, default: !1 },
|
|
143
|
+
renameControlOnClickOutside: { default: "confirm" },
|
|
144
|
+
menuItems: { default: () => [
|
|
145
|
+
{ id: "rename", text: "重命名", icon: ce },
|
|
146
|
+
{ id: "delete", text: "删除", icon: de }
|
|
147
|
+
] },
|
|
148
|
+
menuListGap: { default: 8 }
|
|
374
149
|
},
|
|
375
|
-
emits: ["
|
|
376
|
-
setup(
|
|
377
|
-
const
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
r === "user" && (await J(), u("smooth"));
|
|
398
|
-
}
|
|
399
|
-
);
|
|
400
|
-
}
|
|
401
|
-
const b = (f) => {
|
|
402
|
-
const u = [];
|
|
403
|
-
let r = !1;
|
|
404
|
-
for (const [l, d] of f.entries()) {
|
|
405
|
-
const o = u[u.length - 1];
|
|
406
|
-
Array.isArray(M(d)) ? (u.push({
|
|
407
|
-
role: d.role || "",
|
|
408
|
-
messages: [d],
|
|
409
|
-
messageIndexes: [l],
|
|
410
|
-
startIndex: l
|
|
411
|
-
}), r = !0) : o && o.role === d.role && !r ? (o.messages.push(d), o.messageIndexes.push(l)) : (u.push({
|
|
412
|
-
role: d.role || "",
|
|
413
|
-
messages: [d],
|
|
414
|
-
messageIndexes: [l],
|
|
415
|
-
startIndex: l
|
|
416
|
-
}), r = !1);
|
|
417
|
-
}
|
|
418
|
-
return u;
|
|
419
|
-
}, x = (f, u) => {
|
|
420
|
-
const r = [];
|
|
421
|
-
let l = !1;
|
|
422
|
-
for (const [d, o] of f.entries()) {
|
|
423
|
-
const p = r[r.length - 1], I = o.role === u;
|
|
424
|
-
Array.isArray(M(o)) ? (r.push({
|
|
425
|
-
role: o.role || "",
|
|
426
|
-
messages: [o],
|
|
427
|
-
messageIndexes: [d],
|
|
428
|
-
startIndex: d
|
|
429
|
-
}), l = !0) : p && p.role === u === I && !l ? (p.messages.push(o), p.messageIndexes.push(d)) : (r.push({
|
|
430
|
-
role: I ? u : o.role || "",
|
|
431
|
-
messages: [o],
|
|
432
|
-
messageIndexes: [d],
|
|
433
|
-
startIndex: d
|
|
434
|
-
}), l = !1);
|
|
150
|
+
emits: ["item-click", "item-title-change", "item-action"],
|
|
151
|
+
setup(s, { emit: m }) {
|
|
152
|
+
const t = s, c = m, h = (i) => {
|
|
153
|
+
var f;
|
|
154
|
+
const e = typeof ((f = i[0]) == null ? void 0 : f.group);
|
|
155
|
+
return e === "string" || e === "symbol";
|
|
156
|
+
}, C = I(() => {
|
|
157
|
+
const i = t.data;
|
|
158
|
+
return h(i) ? i : [{ group: X, items: i }];
|
|
159
|
+
}), E = I(() => C.value.length === 0 || C.value.every((i) => i.items.length === 0)), {
|
|
160
|
+
editingItem: p,
|
|
161
|
+
editorRefList: x,
|
|
162
|
+
editorConfirmRefList: y,
|
|
163
|
+
editorCancelRefList: M,
|
|
164
|
+
editorValue: k,
|
|
165
|
+
handleEdit: R,
|
|
166
|
+
handleEditCancel: o,
|
|
167
|
+
handleEditConfirm: v
|
|
168
|
+
} = be({
|
|
169
|
+
renameControlOnClickOutside: t.renameControlOnClickOutside,
|
|
170
|
+
onItemTitleChange: (i, e) => {
|
|
171
|
+
c("item-title-change", i, e);
|
|
435
172
|
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
173
|
+
}), { isTouchDevice: L } = Ce(), g = _(null), u = _(null), K = (i, e) => {
|
|
174
|
+
if (i.currentTarget instanceof HTMLButtonElement) {
|
|
175
|
+
if (u.value === e) {
|
|
176
|
+
g.value = null, u.value = null;
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
g.value = i.currentTarget, u.value = e;
|
|
180
|
+
} else
|
|
181
|
+
g.value = null, u.value = null;
|
|
182
|
+
}, ee = (i) => {
|
|
183
|
+
const e = u.value;
|
|
184
|
+
e && (i.id === "rename" && R(e), c("item-action", i, e));
|
|
185
|
+
};
|
|
186
|
+
return (i, e) => (r(), a("div", {
|
|
187
|
+
class: U(["tr-history", { "touch-device": n(L) }])
|
|
444
188
|
}, [
|
|
445
|
-
(
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
key:
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
"
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
189
|
+
E.value ? (r(), H(Re, { key: 1 })) : (r(), a(S, { key: 0 }, [
|
|
190
|
+
(r(!0), a(S, null, V(C.value, (f) => (r(), a("div", {
|
|
191
|
+
class: "tr-history__group",
|
|
192
|
+
key: f.group
|
|
193
|
+
}, [
|
|
194
|
+
f.group !== n(X) ? (r(), a("div", Te, B(f.group), 1)) : G("", !0),
|
|
195
|
+
w("div", $e, [
|
|
196
|
+
(r(!0), a(S, null, V(f.items, (l, te) => (r(), a("div", {
|
|
197
|
+
class: U(["tr-history__item", {
|
|
198
|
+
selected: l.id && l.id === t.selected,
|
|
199
|
+
editing: n(p) === l,
|
|
200
|
+
active: u.value === l
|
|
201
|
+
}]),
|
|
202
|
+
key: l.id || te,
|
|
203
|
+
onClick: (d) => c("item-click", l)
|
|
204
|
+
}, [
|
|
205
|
+
q(i.$slots, "item-prefix", { item: l }, void 0, !0),
|
|
206
|
+
l.icon ? (r(), H(Y(l.icon), { key: 0 })) : G("", !0),
|
|
207
|
+
n(p) === l ? A((r(), a("input", {
|
|
208
|
+
key: 1,
|
|
209
|
+
class: "tr-history__item-editor",
|
|
210
|
+
type: "text",
|
|
211
|
+
onClick: e[0] || (e[0] = J(() => {
|
|
212
|
+
}, ["stop"])),
|
|
213
|
+
ref_for: !0,
|
|
214
|
+
ref_key: "editorRefList",
|
|
215
|
+
ref: x,
|
|
216
|
+
"onUpdate:modelValue": e[1] || (e[1] = (d) => le(k) ? k.value = d : null),
|
|
217
|
+
onKeydown: [
|
|
218
|
+
e[2] || (e[2] = F(
|
|
219
|
+
//@ts-ignore
|
|
220
|
+
(...d) => n(v) && n(v)(...d),
|
|
221
|
+
["enter"]
|
|
222
|
+
)),
|
|
223
|
+
e[3] || (e[3] = F(
|
|
224
|
+
//@ts-ignore
|
|
225
|
+
(...d) => n(o) && n(o)(...d),
|
|
226
|
+
["escape"]
|
|
227
|
+
))
|
|
228
|
+
]
|
|
229
|
+
}, null, 544)), [
|
|
230
|
+
[re, n(k)]
|
|
231
|
+
]) : q(i.$slots, "item-title", {
|
|
232
|
+
key: 2,
|
|
233
|
+
item: l
|
|
234
|
+
}, () => [
|
|
235
|
+
w("span", {
|
|
236
|
+
class: "text",
|
|
237
|
+
title: l.title
|
|
238
|
+
}, B(l.title), 9, Oe)
|
|
239
|
+
], !0),
|
|
240
|
+
w("span", {
|
|
241
|
+
class: "tr-history__item-actions",
|
|
242
|
+
onClick: e[6] || (e[6] = J(() => {
|
|
243
|
+
}, ["stop"]))
|
|
244
|
+
}, [
|
|
245
|
+
t.showRenameControls && n(p) === l ? (r(), a("button", {
|
|
246
|
+
key: 0,
|
|
247
|
+
class: "editor-confirm",
|
|
248
|
+
ref_for: !0,
|
|
249
|
+
ref_key: "editorConfirmRefList",
|
|
250
|
+
ref: y,
|
|
251
|
+
onClick: e[4] || (e[4] = //@ts-ignore
|
|
252
|
+
(...d) => n(v) && n(v)(...d))
|
|
253
|
+
}, [
|
|
254
|
+
T(n(me))
|
|
255
|
+
], 512)) : G("", !0),
|
|
256
|
+
t.showRenameControls && n(p) === l ? (r(), a("button", {
|
|
257
|
+
key: 1,
|
|
258
|
+
class: "editor-cancel",
|
|
259
|
+
ref_for: !0,
|
|
260
|
+
ref_key: "editorCancelRefList",
|
|
261
|
+
ref: M,
|
|
262
|
+
onClick: e[5] || (e[5] = //@ts-ignore
|
|
263
|
+
(...d) => n(o) && n(o)(...d))
|
|
264
|
+
}, [
|
|
265
|
+
T(n(fe))
|
|
266
|
+
], 512)) : G("", !0),
|
|
267
|
+
w("button", {
|
|
268
|
+
class: U(["menu", { hidden: n(p) === l }]),
|
|
269
|
+
onClick: (d) => K(d, l)
|
|
270
|
+
}, [
|
|
271
|
+
T(n(pe))
|
|
272
|
+
], 10, Se)
|
|
273
|
+
])
|
|
274
|
+
], 10, Ge))), 128))
|
|
275
|
+
])
|
|
276
|
+
]))), 128)),
|
|
277
|
+
A(T(Me, {
|
|
278
|
+
trigger: g.value,
|
|
279
|
+
"onUpdate:trigger": e[7] || (e[7] = (f) => g.value = f),
|
|
280
|
+
data: u.value,
|
|
281
|
+
"onUpdate:data": e[8] || (e[8] = (f) => u.value = f),
|
|
282
|
+
items: t.menuItems,
|
|
283
|
+
"menu-list-gap": t.menuListGap,
|
|
284
|
+
onItemClick: ee
|
|
285
|
+
}, null, 8, ["trigger", "data", "items", "menu-list-gap"]), [
|
|
286
|
+
[ae, g.value]
|
|
287
|
+
])
|
|
288
|
+
], 64))
|
|
289
|
+
], 2));
|
|
494
290
|
}
|
|
495
|
-
}),
|
|
496
|
-
|
|
497
|
-
Text: le
|
|
291
|
+
}), N = /* @__PURE__ */ z(Be, [["__scopeId", "data-v-97a7e8a2"]]), De = function(s) {
|
|
292
|
+
s.component(N.name, N);
|
|
498
293
|
};
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
};
|
|
503
|
-
L.install = Xe;
|
|
504
|
-
const ot = L;
|
|
505
|
-
O.name = "TrBubbleList";
|
|
506
|
-
const ze = function(t) {
|
|
507
|
-
t.component(O.name, O);
|
|
508
|
-
};
|
|
509
|
-
O.install = ze;
|
|
510
|
-
const rt = O;
|
|
511
|
-
F.name = "TrBubbleProvider";
|
|
512
|
-
const qe = function(t) {
|
|
513
|
-
t.component(F.name, F);
|
|
514
|
-
};
|
|
515
|
-
F.install = qe;
|
|
516
|
-
const at = F;
|
|
294
|
+
Object.assign(N, {
|
|
295
|
+
name: "TrHistory",
|
|
296
|
+
install: De
|
|
297
|
+
});
|
|
517
298
|
export {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
at as b,
|
|
521
|
-
et as c,
|
|
522
|
-
st as d,
|
|
523
|
-
Ae as e,
|
|
524
|
-
$e as f,
|
|
525
|
-
tt as g,
|
|
526
|
-
Oe as h,
|
|
527
|
-
nt as i,
|
|
528
|
-
je as u
|
|
299
|
+
N as H,
|
|
300
|
+
Ce as u
|
|
529
301
|
};
|