@opentiny/tiny-robot 0.3.0-alpha.13 → 0.3.0-alpha.15
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/action-group/index.js +7 -7
- package/dist/attachments/index.js +71 -71
- package/dist/bubble/index.js +1905 -1171
- package/dist/container/index.js +29 -29
- package/dist/feedback/index.js +52 -52
- package/dist/flow-layout-buttons/index.js +1 -1
- package/dist/history/index.js +30 -30
- package/dist/index.d.ts +438 -388
- package/dist/index.js +74 -68
- package/dist/index3.js +283 -269
- package/dist/loading.js +4 -0
- package/dist/mcp-server-picker/index.js +632 -632
- package/dist/question/index.js +54 -54
- package/dist/sender/index.js +835 -812
- package/dist/style.css +1 -1
- package/dist/suggestion/index.js +62 -62
- package/dist/suggestion-pills/index.js +1 -1
- package/dist/suggestion-popover/index.js +185 -184
- package/dist/tiny-robot-svgs.js +377 -257
- package/package.json +4 -3
package/dist/sender/index.js
CHANGED
|
@@ -1,279 +1,228 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { I as
|
|
3
|
-
import { d as
|
|
4
|
-
import { T as
|
|
5
|
-
import {
|
|
6
|
-
import { _ as
|
|
7
|
-
import { t as
|
|
8
|
-
function
|
|
9
|
-
const a =
|
|
10
|
-
|
|
11
|
-
() =>
|
|
12
|
-
(
|
|
13
|
-
|
|
1
|
+
import { ref as M, watch as ne, reactive as nt, computed as L, defineComponent as we, createElementBlock as O, openBlock as w, createCommentVNode as U, normalizeStyle as Fe, createBlock as Z, unref as C, withCtx as de, createElementVNode as z, createVNode as X, normalizeClass as oe, toDisplayString as ce, useAttrs as ot, resolveComponent as st, mergeProps as me, Fragment as fe, renderList as be, mergeModels as at, useModel as lt, onMounted as rt, onUnmounted as it, nextTick as te, Transition as We, withModifiers as ut, useSlots as ct, renderSlot as ue, isRef as dt, createTextVNode as je } from "vue";
|
|
2
|
+
import { I as ft } from "../index6.js";
|
|
3
|
+
import { d as pt } from "../index3.js";
|
|
4
|
+
import { T as Me } from "../index2.js";
|
|
5
|
+
import { p as ht, u as yt, I as vt, x as gt, i as mt, l as bt, z as wt } from "../tiny-robot-svgs.js";
|
|
6
|
+
import { _ as Te } from "../_plugin-vue_export-helper.js";
|
|
7
|
+
import { t as _t } from "../utils.js";
|
|
8
|
+
function St(s, i) {
|
|
9
|
+
const a = M(s.modelValue || s.defaultValue || ""), u = M(null);
|
|
10
|
+
ne(
|
|
11
|
+
() => s.modelValue,
|
|
12
|
+
(d) => {
|
|
13
|
+
d !== void 0 && d !== a.value && (a.value = d);
|
|
14
14
|
}
|
|
15
|
-
),
|
|
15
|
+
), ne(
|
|
16
16
|
() => a.value,
|
|
17
|
-
(
|
|
18
|
-
|
|
17
|
+
(d) => {
|
|
18
|
+
i("update:modelValue", d);
|
|
19
19
|
}
|
|
20
20
|
);
|
|
21
|
-
const
|
|
22
|
-
a.value =
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
!
|
|
27
|
-
},
|
|
28
|
-
a.value = "",
|
|
29
|
-
},
|
|
21
|
+
const h = (d) => {
|
|
22
|
+
a.value = d, i("update:modelValue", d);
|
|
23
|
+
}, g = (d) => {
|
|
24
|
+
d == null || d.preventDefault();
|
|
25
|
+
const _ = a.value;
|
|
26
|
+
!s.disabled && !s.loading && _.trim() && i("submit", _);
|
|
27
|
+
}, l = () => {
|
|
28
|
+
a.value = "", i("update:modelValue", ""), i("clear");
|
|
29
|
+
}, f = M(!1);
|
|
30
30
|
return {
|
|
31
31
|
inputValue: a,
|
|
32
32
|
inputWrapper: u,
|
|
33
|
-
isComposing:
|
|
34
|
-
handleChange:
|
|
35
|
-
handleSubmit:
|
|
36
|
-
handleClear:
|
|
33
|
+
isComposing: f,
|
|
34
|
+
handleChange: h,
|
|
35
|
+
handleSubmit: g,
|
|
36
|
+
handleClear: l,
|
|
37
37
|
clearInput: () => {
|
|
38
|
-
|
|
38
|
+
l();
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
if (!(
|
|
47
|
-
switch (
|
|
42
|
+
function Ct(s, i, a, u, h, g, l, f, m, d, _, y, A, V, P, W) {
|
|
43
|
+
const k = () => {
|
|
44
|
+
y.value && (P != null && P.value && (W == null || W()), i("submit", a.value.trim()));
|
|
45
|
+
}, v = (b, E) => {
|
|
46
|
+
if (!(b.key === "Enter")) return !1;
|
|
47
|
+
switch (E) {
|
|
48
48
|
case "enter":
|
|
49
|
-
return !
|
|
49
|
+
return !b.shiftKey && !b.ctrlKey && !b.metaKey;
|
|
50
50
|
case "ctrlEnter":
|
|
51
|
-
return (
|
|
51
|
+
return (b.ctrlKey || b.metaKey) && !b.shiftKey;
|
|
52
52
|
case "shiftEnter":
|
|
53
|
-
return
|
|
53
|
+
return b.shiftKey && !b.ctrlKey && !b.metaKey;
|
|
54
54
|
default:
|
|
55
55
|
return !1;
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
58
|
return {
|
|
59
|
-
handleKeyPress: (
|
|
59
|
+
handleKeyPress: (b) => {
|
|
60
60
|
if (u.value) return;
|
|
61
|
-
if (
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
a.value =
|
|
65
|
-
` +
|
|
66
|
-
|
|
61
|
+
if (b.key === "Enter" && b.shiftKey && (A == null ? void 0 : A.value) === "single" && V) {
|
|
62
|
+
b.preventDefault(), V();
|
|
63
|
+
const q = b.target, Q = q.selectionStart, F = a.value;
|
|
64
|
+
a.value = F.substring(0, Q) + `
|
|
65
|
+
` + F.substring(Q), setTimeout(() => {
|
|
66
|
+
q.selectionStart = q.selectionEnd = Q + 1;
|
|
67
67
|
}, 0);
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
if (
|
|
71
|
-
|
|
70
|
+
if (b.key === "Tab" && g.value && l.value) {
|
|
71
|
+
b.preventDefault(), f();
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
|
-
if (
|
|
75
|
-
if (
|
|
76
|
-
|
|
74
|
+
if (g.value) {
|
|
75
|
+
if (b.key === "ArrowDown") {
|
|
76
|
+
b.preventDefault(), d("down");
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
|
-
if (
|
|
80
|
-
|
|
79
|
+
if (b.key === "ArrowUp") {
|
|
80
|
+
b.preventDefault(), d("up");
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
-
if (
|
|
84
|
-
|
|
83
|
+
if (b.key === "Enter" && l.value) {
|
|
84
|
+
b.preventDefault(), f();
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
if (
|
|
89
|
-
|
|
88
|
+
if (b.key === "Escape") {
|
|
89
|
+
g.value ? (m(), b.preventDefault()) : h.isRecording && (_(), b.preventDefault()), i("escape-press");
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
v(b, s.submitType) && (b.preventDefault(), y.value && k());
|
|
93
93
|
},
|
|
94
|
-
triggerSubmit:
|
|
94
|
+
triggerSubmit: k
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
-
function xt(
|
|
98
|
-
const
|
|
97
|
+
function xt(s) {
|
|
98
|
+
const i = nt({
|
|
99
99
|
isRecording: !1,
|
|
100
100
|
isSupported: typeof window < "u" && "webkitSpeechRecognition" in window || "SpeechRecognition" in window,
|
|
101
101
|
error: void 0
|
|
102
|
-
}), a =
|
|
103
|
-
a !== void 0 && (a.continuous =
|
|
104
|
-
var
|
|
105
|
-
|
|
102
|
+
}), a = i.isSupported ? new (window.webkitSpeechRecognition || window.SpeechRecognition)() : void 0;
|
|
103
|
+
a !== void 0 && (a.continuous = s.continuous ?? !1, a.interimResults = s.interimResults ?? !0, a.lang = s.lang ?? navigator.language, a.onstart = () => {
|
|
104
|
+
var l;
|
|
105
|
+
i.isRecording = !0, i.error = void 0, (l = s.onStart) == null || l.call(s);
|
|
106
106
|
}, a.onend = () => {
|
|
107
|
-
var
|
|
108
|
-
|
|
109
|
-
}, a.onresult = (
|
|
110
|
-
var
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
}, a.onerror = (
|
|
114
|
-
var
|
|
115
|
-
|
|
107
|
+
var l;
|
|
108
|
+
i.isRecording = !1, (l = s.onEnd) == null || l.call(s);
|
|
109
|
+
}, a.onresult = (l) => {
|
|
110
|
+
var m, d;
|
|
111
|
+
const f = Array.from(l.results).map((_) => _[0].transcript).join("");
|
|
112
|
+
l.results[0].isFinal ? (m = s.onFinal) == null || m.call(s, f) : (d = s.onInterim) == null || d.call(s, f);
|
|
113
|
+
}, a.onerror = (l) => {
|
|
114
|
+
var f;
|
|
115
|
+
i.error = new Error(l.error), i.isRecording = !1, (f = s.onError) == null || f.call(s, i.error);
|
|
116
116
|
});
|
|
117
117
|
const u = () => {
|
|
118
|
-
var
|
|
118
|
+
var l;
|
|
119
119
|
if (!a) {
|
|
120
|
-
const
|
|
121
|
-
|
|
120
|
+
const f = new Error("浏览器不支持语音识别");
|
|
121
|
+
i.error = f, (l = s.onError) == null || l.call(s, f);
|
|
122
122
|
return;
|
|
123
123
|
}
|
|
124
|
-
if (
|
|
124
|
+
if (i.isRecording) {
|
|
125
125
|
try {
|
|
126
126
|
a.stop(), setTimeout(() => {
|
|
127
127
|
try {
|
|
128
128
|
a.start();
|
|
129
|
-
} catch (
|
|
130
|
-
|
|
129
|
+
} catch (f) {
|
|
130
|
+
g(f);
|
|
131
131
|
}
|
|
132
132
|
}, 100);
|
|
133
|
-
} catch (
|
|
134
|
-
|
|
133
|
+
} catch (f) {
|
|
134
|
+
g(f);
|
|
135
135
|
}
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
138
|
try {
|
|
139
139
|
a.start();
|
|
140
|
-
} catch (
|
|
141
|
-
|
|
140
|
+
} catch (f) {
|
|
141
|
+
g(f);
|
|
142
142
|
}
|
|
143
|
-
},
|
|
144
|
-
if (a &&
|
|
143
|
+
}, h = () => {
|
|
144
|
+
if (a && i.isRecording)
|
|
145
145
|
try {
|
|
146
146
|
a.stop();
|
|
147
|
-
} catch (
|
|
148
|
-
|
|
147
|
+
} catch (l) {
|
|
148
|
+
g(l);
|
|
149
149
|
}
|
|
150
|
-
},
|
|
151
|
-
var
|
|
152
|
-
|
|
150
|
+
}, g = (l) => {
|
|
151
|
+
var f;
|
|
152
|
+
i.error = l instanceof Error ? l : new Error("语音识别操作失败"), i.isRecording = !1, (f = s.onError) == null || f.call(s, i.error);
|
|
153
153
|
};
|
|
154
154
|
return {
|
|
155
|
-
speechState:
|
|
155
|
+
speechState: i,
|
|
156
156
|
start: u,
|
|
157
|
-
stop:
|
|
157
|
+
stop: h
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
return [{ text: i, isMatch: !1 }];
|
|
175
|
-
const o = [];
|
|
176
|
-
for (const h of v)
|
|
177
|
-
if (o.length === 0)
|
|
178
|
-
o.push(h);
|
|
179
|
-
else {
|
|
180
|
-
const k = o[o.length - 1];
|
|
181
|
-
h.start <= k.end ? k.end = Math.max(k.end, h.end) : o.push(h);
|
|
182
|
-
}
|
|
183
|
-
const p = [];
|
|
184
|
-
let b = 0;
|
|
185
|
-
for (const h of o)
|
|
186
|
-
b < h.start && p.push({
|
|
187
|
-
text: i.substring(b, h.start),
|
|
188
|
-
isMatch: !1
|
|
189
|
-
}), p.push({
|
|
190
|
-
text: i.substring(h.start, h.end),
|
|
191
|
-
isMatch: !0
|
|
192
|
-
}), b = h.end;
|
|
193
|
-
return b < i.length && p.push({
|
|
194
|
-
text: i.substring(b),
|
|
195
|
-
isMatch: !1
|
|
196
|
-
}), p;
|
|
197
|
-
};
|
|
198
|
-
function Rt(i, c, a, u, v) {
|
|
199
|
-
const w = H(!1), o = H(-1), p = H(-1), b = H(""), h = H(!1), k = H(null), g = H(!1), I = H(null), m = L(() => {
|
|
200
|
-
if (!i.suggestions || !a.value || v.value) return [];
|
|
201
|
-
const O = a.value.toLowerCase();
|
|
202
|
-
return i.suggestions.filter((V) => V.toLowerCase().includes(O));
|
|
203
|
-
}), K = L(() => {
|
|
204
|
-
let O = -1;
|
|
205
|
-
return I.value === "mouse" && p.value !== -1 ? O = p.value : I.value === "keyboard" && o.value !== -1 && (O = o.value), m.value[O] || null;
|
|
206
|
-
}), B = (O) => O === o.value || O === p.value, A = (O) => {
|
|
207
|
-
if (I.value === null) {
|
|
208
|
-
b.value = "", h.value = !1;
|
|
160
|
+
function kt(s, i, a, u, h, g) {
|
|
161
|
+
const l = M(!1), f = M(-1), m = M(-1), d = M(null), _ = M(""), y = M(!1), A = L(() => {
|
|
162
|
+
var G, j;
|
|
163
|
+
if (!((G = s.value) != null && G.length)) return "";
|
|
164
|
+
const B = d.value === "mouse" ? m.value : f.value;
|
|
165
|
+
return ((j = s.value[B]) == null ? void 0 : j.content) || "";
|
|
166
|
+
}), V = (B) => {
|
|
167
|
+
_.value = B, y.value = !0;
|
|
168
|
+
}, P = () => {
|
|
169
|
+
_.value = "", y.value = !1;
|
|
170
|
+
}, W = (B) => {
|
|
171
|
+
const G = B || A.value;
|
|
172
|
+
if (!G || !i.value) {
|
|
173
|
+
P();
|
|
209
174
|
return;
|
|
210
175
|
}
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
},
|
|
214
|
-
|
|
215
|
-
},
|
|
216
|
-
|
|
217
|
-
},
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
176
|
+
const j = G.substring(i.value.length);
|
|
177
|
+
G.toLowerCase().startsWith(i.value.toLowerCase()) && j ? V(j) : P();
|
|
178
|
+
}, k = () => {
|
|
179
|
+
f.value = -1, m.value = -1, d.value = null;
|
|
180
|
+
}, v = () => {
|
|
181
|
+
l.value = !0, W();
|
|
182
|
+
}, R = () => {
|
|
183
|
+
l.value = !1, k(), P();
|
|
184
|
+
}, b = L(() => {
|
|
185
|
+
var B;
|
|
186
|
+
return a.value ? !0 : !!(i.value && ((B = s.value) == null ? void 0 : B.length) > 0 && !u.value);
|
|
187
|
+
}), E = (B) => {
|
|
188
|
+
R(), i.value = B, h(B), g(B);
|
|
189
|
+
}, q = () => {
|
|
190
|
+
A.value && E(A.value);
|
|
191
|
+
}, Q = (B) => {
|
|
192
|
+
!l.value || !s.value || (d.value = "keyboard", f.value === -1 ? f.value = B === "down" ? 0 : s.value.length - 1 : B === "down" ? f.value = (f.value + 1) % s.value.length : f.value = (f.value - 1 + s.value.length) % s.value.length, W());
|
|
193
|
+
}, F = (B) => {
|
|
194
|
+
s.value && (d.value = "mouse", m.value = B, W());
|
|
195
|
+
}, N = () => {
|
|
196
|
+
s.value && (m.value = -1, f.value !== -1 ? d.value = "keyboard" : d.value = null, W());
|
|
221
197
|
};
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
closeSuggestionsPopup: U,
|
|
245
|
-
navigateSuggestions: (O) => {
|
|
246
|
-
if (!w.value || m.value.length === 0) return;
|
|
247
|
-
I.value = "keyboard", o.value === -1 ? o.value = O === "down" ? 0 : m.value.length - 1 : O === "down" ? o.value = (o.value + 1) % m.value.length : o.value = (o.value - 1 + m.value.length) % m.value.length;
|
|
248
|
-
const V = m.value[o.value];
|
|
249
|
-
V && A(V);
|
|
250
|
-
const le = k.value;
|
|
251
|
-
if (le) {
|
|
252
|
-
const j = le.children[o.value];
|
|
253
|
-
j && j.scrollIntoView({ block: "nearest" });
|
|
254
|
-
}
|
|
255
|
-
},
|
|
256
|
-
handleSuggestionItemHover: (O) => {
|
|
257
|
-
I.value = "mouse", p.value = O, A(m.value[O]);
|
|
258
|
-
},
|
|
259
|
-
handleSuggestionItemLeave: () => {
|
|
260
|
-
if (p.value = -1, o.value !== -1) {
|
|
261
|
-
I.value = "keyboard";
|
|
262
|
-
const O = m.value[o.value];
|
|
263
|
-
O && A(O);
|
|
264
|
-
} else
|
|
265
|
-
I.value = null, A();
|
|
266
|
-
},
|
|
267
|
-
handleClickOutside: () => {
|
|
268
|
-
U();
|
|
269
|
-
},
|
|
270
|
-
highlightSuggestionText: It
|
|
198
|
+
return ne(b, (B) => {
|
|
199
|
+
B ? l.value || v() : l.value && R();
|
|
200
|
+
}), {
|
|
201
|
+
// 弹窗控制
|
|
202
|
+
isPopupVisible: l,
|
|
203
|
+
openPopup: v,
|
|
204
|
+
closePopup: R,
|
|
205
|
+
// 自动完成占位符
|
|
206
|
+
autoCompleteText: _,
|
|
207
|
+
showTabIndicator: y,
|
|
208
|
+
syncAutoComplete: W,
|
|
209
|
+
// 选中控制层
|
|
210
|
+
activeSuggestion: A,
|
|
211
|
+
activeKeyboardIndex: f,
|
|
212
|
+
activeMouseIndex: m,
|
|
213
|
+
// 交互处理
|
|
214
|
+
navigateWithKeyboard: Q,
|
|
215
|
+
handleMouseEnter: F,
|
|
216
|
+
handleMouseLeave: N,
|
|
217
|
+
// 业务操作
|
|
218
|
+
applySuggestion: E,
|
|
219
|
+
confirmSelection: q
|
|
271
220
|
};
|
|
272
221
|
}
|
|
273
|
-
const
|
|
222
|
+
const It = { class: "action-buttons" }, Rt = { class: "action-buttons__submit-content" }, Ot = {
|
|
274
223
|
key: 0,
|
|
275
224
|
class: "action-buttons__cancel-text"
|
|
276
|
-
},
|
|
225
|
+
}, Tt = /* @__PURE__ */ we({
|
|
277
226
|
__name: "ActionButtons",
|
|
278
227
|
props: {
|
|
279
228
|
loading: { type: Boolean, default: !1 },
|
|
@@ -293,133 +242,144 @@ const Ot = { class: "action-buttons" }, Tt = { class: "action-buttons__submit-co
|
|
|
293
242
|
stopText: { default: void 0 }
|
|
294
243
|
},
|
|
295
244
|
emits: ["clear", "toggle-speech", "submit", "cancel", "trigger-select"],
|
|
296
|
-
setup(
|
|
297
|
-
const a =
|
|
298
|
-
var
|
|
299
|
-
const
|
|
300
|
-
if (typeof
|
|
301
|
-
return () =>
|
|
302
|
-
if (typeof
|
|
303
|
-
return
|
|
304
|
-
}),
|
|
305
|
-
var
|
|
306
|
-
const
|
|
307
|
-
if (typeof
|
|
308
|
-
return () =>
|
|
309
|
-
if (typeof
|
|
310
|
-
return
|
|
311
|
-
}),
|
|
312
|
-
var
|
|
313
|
-
return
|
|
314
|
-
}),
|
|
315
|
-
|
|
316
|
-
},
|
|
317
|
-
if (!
|
|
318
|
-
const
|
|
319
|
-
u("toggle-speech",
|
|
245
|
+
setup(s, { emit: i }) {
|
|
246
|
+
const a = s, u = i, h = L(() => {
|
|
247
|
+
var R, b;
|
|
248
|
+
const v = (b = (R = a.buttonGroup) == null ? void 0 : R.file) == null ? void 0 : b.tooltips;
|
|
249
|
+
if (typeof v == "string" && v)
|
|
250
|
+
return () => v;
|
|
251
|
+
if (typeof v == "function")
|
|
252
|
+
return v;
|
|
253
|
+
}), g = L(() => {
|
|
254
|
+
var R, b;
|
|
255
|
+
const v = (b = (R = a.buttonGroup) == null ? void 0 : R.submit) == null ? void 0 : b.tooltips;
|
|
256
|
+
if (typeof v == "string" && v)
|
|
257
|
+
return () => v;
|
|
258
|
+
if (typeof v == "function")
|
|
259
|
+
return v;
|
|
260
|
+
}), l = L(() => a.allowSpeech), f = L(() => a.speechStatus.isRecording), m = L(() => a.disabled), d = L(() => {
|
|
261
|
+
var v, R;
|
|
262
|
+
return m.value || a.isOverLimit || ((R = (v = a.buttonGroup) == null ? void 0 : v.submit) == null ? void 0 : R.disabled);
|
|
263
|
+
}), _ = L(() => a.allowFiles || a.allowSpeech || a.showClear), y = () => {
|
|
264
|
+
m.value || u("clear");
|
|
265
|
+
}, A = () => {
|
|
266
|
+
if (!m.value) {
|
|
267
|
+
const v = !a.speechStatus.isRecording;
|
|
268
|
+
u("toggle-speech", v);
|
|
320
269
|
}
|
|
321
|
-
},
|
|
322
|
-
|
|
323
|
-
},
|
|
324
|
-
|
|
325
|
-
},
|
|
326
|
-
var
|
|
327
|
-
return
|
|
328
|
-
}),
|
|
329
|
-
|
|
270
|
+
}, V = () => {
|
|
271
|
+
d.value || u("submit");
|
|
272
|
+
}, P = () => {
|
|
273
|
+
m.value || u("cancel");
|
|
274
|
+
}, W = L(() => {
|
|
275
|
+
var v, R;
|
|
276
|
+
return m.value || ((R = (v = a.buttonGroup) == null ? void 0 : v.file) == null ? void 0 : R.disabled);
|
|
277
|
+
}), k = () => {
|
|
278
|
+
W.value || u("trigger-select");
|
|
330
279
|
};
|
|
331
|
-
return (
|
|
332
|
-
|
|
280
|
+
return (v, R) => (w(), O("div", It, [
|
|
281
|
+
_.value ? (w(), O("div", {
|
|
333
282
|
key: 0,
|
|
334
283
|
class: "action-buttons__utility",
|
|
335
|
-
style:
|
|
284
|
+
style: Fe({ "padding-right": v.hasContent || v.loading ? "0" : "6px" })
|
|
336
285
|
}, [
|
|
337
|
-
|
|
286
|
+
v.allowFiles && !v.loading ? (w(), Z(C(Me), {
|
|
338
287
|
key: 0,
|
|
339
288
|
effect: "light",
|
|
340
289
|
placement: "top",
|
|
341
|
-
"render-content":
|
|
290
|
+
"render-content": h.value,
|
|
342
291
|
"visible-arrow": !1
|
|
343
292
|
}, {
|
|
344
|
-
default:
|
|
345
|
-
|
|
293
|
+
default: de(() => [
|
|
294
|
+
z("div", {
|
|
346
295
|
class: "action-buttons__button",
|
|
347
|
-
onClick:
|
|
296
|
+
onClick: k
|
|
348
297
|
}, [
|
|
349
|
-
|
|
350
|
-
class:
|
|
298
|
+
X(C(ht), {
|
|
299
|
+
class: oe(["action-buttons__icon", "action-buttons__icon--upload", { "is-disabled": W.value }]),
|
|
351
300
|
alt: "上传文件"
|
|
352
301
|
}, null, 8, ["class"])
|
|
353
302
|
])
|
|
354
303
|
]),
|
|
355
304
|
_: 1
|
|
356
|
-
}, 8, ["render-content"])) :
|
|
357
|
-
|
|
305
|
+
}, 8, ["render-content"])) : U("", !0),
|
|
306
|
+
l.value && !v.loading ? (w(), O("div", {
|
|
358
307
|
key: 1,
|
|
359
|
-
class:
|
|
360
|
-
onClick:
|
|
308
|
+
class: oe(["action-buttons__button", { "is-recording": f.value }]),
|
|
309
|
+
onClick: A
|
|
361
310
|
}, [
|
|
362
|
-
|
|
311
|
+
f.value ? (w(), Z(C(vt), {
|
|
363
312
|
key: 1,
|
|
364
313
|
class: "action-buttons__icon action-buttons__icon--recording",
|
|
365
314
|
alt: "语音中"
|
|
366
|
-
})) : (
|
|
315
|
+
})) : (w(), Z(C(yt), {
|
|
367
316
|
key: 0,
|
|
368
317
|
class: "action-buttons__icon",
|
|
369
318
|
alt: "录音"
|
|
370
319
|
}))
|
|
371
|
-
], 2)) :
|
|
372
|
-
|
|
320
|
+
], 2)) : U("", !0),
|
|
321
|
+
v.showClear ? (w(), Z(C(Me), {
|
|
373
322
|
key: 2,
|
|
374
323
|
content: "清空内容",
|
|
375
324
|
placement: "top"
|
|
376
325
|
}, {
|
|
377
|
-
default:
|
|
378
|
-
|
|
326
|
+
default: de(() => [
|
|
327
|
+
z("div", {
|
|
379
328
|
class: "action-buttons__button",
|
|
380
|
-
onClick:
|
|
329
|
+
onClick: y
|
|
381
330
|
}, [
|
|
382
|
-
|
|
331
|
+
X(C(gt), { class: "action-buttons__icon action-buttons__icon--clear" })
|
|
383
332
|
])
|
|
384
333
|
]),
|
|
385
334
|
_: 1
|
|
386
|
-
})) :
|
|
387
|
-
], 4)) :
|
|
388
|
-
|
|
335
|
+
})) : U("", !0)
|
|
336
|
+
], 4)) : U("", !0),
|
|
337
|
+
v.hasContent || v.loading ? (w(), O("div", {
|
|
389
338
|
key: 1,
|
|
390
339
|
class: "action-buttons__button action-buttons__submit",
|
|
391
|
-
onClick:
|
|
340
|
+
onClick: R[0] || (R[0] = (b) => v.loading ? P() : V())
|
|
392
341
|
}, [
|
|
393
|
-
|
|
394
|
-
|
|
342
|
+
z("div", Rt, [
|
|
343
|
+
v.loading ? (w(), O("div", {
|
|
395
344
|
key: 1,
|
|
396
|
-
class:
|
|
345
|
+
class: oe(["action-buttons__cancel", { "action-buttons__cancel--icon-only": !v.stopText }])
|
|
397
346
|
}, [
|
|
398
|
-
|
|
347
|
+
X(C(bt), {
|
|
399
348
|
class: "action-buttons__icon action-buttons__icon--cancel",
|
|
400
349
|
alt: "停止"
|
|
401
350
|
}),
|
|
402
|
-
|
|
403
|
-
], 2)) : (
|
|
351
|
+
v.stopText ? (w(), O("span", Ot, ce(v.stopText), 1)) : U("", !0)
|
|
352
|
+
], 2)) : (w(), Z(C(Me), {
|
|
404
353
|
key: 0,
|
|
405
354
|
effect: "light",
|
|
406
355
|
placement: "top",
|
|
407
|
-
"render-content":
|
|
356
|
+
"render-content": g.value,
|
|
408
357
|
"visible-arrow": !1
|
|
409
358
|
}, {
|
|
410
|
-
default:
|
|
411
|
-
|
|
412
|
-
class:
|
|
359
|
+
default: de(() => [
|
|
360
|
+
X(C(mt), {
|
|
361
|
+
class: oe(["action-buttons__icon", "action-buttons__icon--send", { "is-disabled": d.value }]),
|
|
413
362
|
alt: "发送"
|
|
414
363
|
}, null, 8, ["class"])
|
|
415
364
|
]),
|
|
416
365
|
_: 1
|
|
417
366
|
}, 8, ["render-content"]))
|
|
418
367
|
])
|
|
419
|
-
])) :
|
|
368
|
+
])) : U("", !0)
|
|
420
369
|
]));
|
|
421
370
|
}
|
|
422
|
-
}), Je = /* @__PURE__ */
|
|
371
|
+
}), Je = /* @__PURE__ */ Te(Tt, [["__scopeId", "data-v-a9e0fa92"]]);
|
|
372
|
+
function Et(s, i = {}) {
|
|
373
|
+
let a = [], u = [], h = s;
|
|
374
|
+
return { commit: (_) => {
|
|
375
|
+
var y;
|
|
376
|
+
a.push(h), h = _, u.length && ((y = i.onRemoveHistory) == null || y.call(i, u)), u = [];
|
|
377
|
+
}, undo: () => a.length ? (u.push(h), h = a.pop(), h) : null, redo: () => u.length ? (a.push(h), h = u.pop(), h) : null, clear: () => {
|
|
378
|
+
var _, y;
|
|
379
|
+
a.length && ((_ = i.onRemoveHistory) == null || _.call(i, a)), u.length && ((y = i.onRemoveHistory) == null || y.call(i, u)), a = [], u = [];
|
|
380
|
+
}, get: () => h };
|
|
381
|
+
}
|
|
382
|
+
const $t = ["data-id", "data-type"], Bt = ["data-id", "data-type"], Lt = /* @__PURE__ */ we({
|
|
423
383
|
inheritAttrs: !1,
|
|
424
384
|
__name: "Block",
|
|
425
385
|
props: {
|
|
@@ -429,75 +389,55 @@ const Ot = { class: "action-buttons" }, Tt = { class: "action-buttons__submit-co
|
|
|
429
389
|
readonly: { type: Boolean },
|
|
430
390
|
asChild: { type: Boolean }
|
|
431
391
|
},
|
|
432
|
-
setup(
|
|
433
|
-
const
|
|
434
|
-
return (u,
|
|
435
|
-
const
|
|
436
|
-
return
|
|
392
|
+
setup(s) {
|
|
393
|
+
const i = s, a = ot();
|
|
394
|
+
return (u, h) => {
|
|
395
|
+
const g = st("Block", !0);
|
|
396
|
+
return i.type !== "block" ? (w(), O("span", me({
|
|
437
397
|
key: 0,
|
|
438
|
-
"data-id":
|
|
439
|
-
"data-type":
|
|
440
|
-
}, C(a)),
|
|
441
|
-
|
|
442
|
-
key: `${
|
|
443
|
-
}, { ref_for: !0 },
|
|
398
|
+
"data-id": i.id,
|
|
399
|
+
"data-type": i.type
|
|
400
|
+
}, C(a)), ce(i.content), 17, $t)) : (w(), O(fe, { key: 1 }, [
|
|
401
|
+
i.asChild ? (w(!0), O(fe, { key: 0 }, be(i.content, (l) => (w(), Z(g, me({
|
|
402
|
+
key: `${l.id}-${l.type}`
|
|
403
|
+
}, { ref_for: !0 }, l), null, 16))), 128)) : (w(), O("span", me({
|
|
444
404
|
key: 1,
|
|
445
|
-
"data-id":
|
|
446
|
-
"data-type":
|
|
405
|
+
"data-id": i.id,
|
|
406
|
+
"data-type": i.type
|
|
447
407
|
}, C(a)), [
|
|
448
|
-
(
|
|
449
|
-
key: `${
|
|
450
|
-
}, { ref_for: !0 },
|
|
451
|
-
], 16,
|
|
408
|
+
(w(!0), O(fe, null, be(i.content, (l) => (w(), Z(g, me({
|
|
409
|
+
key: `${l.id}-${l.type}`
|
|
410
|
+
}, { ref_for: !0 }, l), null, 16))), 128))
|
|
411
|
+
], 16, Bt))
|
|
452
412
|
], 64));
|
|
453
413
|
};
|
|
454
414
|
}
|
|
455
|
-
}),
|
|
456
|
-
function Ht(i, c = {}) {
|
|
457
|
-
let a = [], u = [], v = i;
|
|
458
|
-
return { commit: (k) => {
|
|
459
|
-
var g;
|
|
460
|
-
a.push(v), v = k, u.length && ((g = c.onRemoveHistory) == null || g.call(c, u)), u = [];
|
|
461
|
-
}, undo: () => a.length ? (u.push(v), v = a.pop(), v) : null, redo: () => u.length ? (a.push(v), v = u.pop(), v) : null, clear: () => {
|
|
462
|
-
var k, g;
|
|
463
|
-
a.length && ((k = c.onRemoveHistory) == null || k.call(c, a)), u.length && ((g = c.onRemoveHistory) == null || g.call(c, u)), a = [], u = [];
|
|
464
|
-
}, get: () => v };
|
|
465
|
-
}
|
|
466
|
-
const Kt = { class: "editor-container" }, De = "", Fe = "", Pt = /* @__PURE__ */ me({
|
|
415
|
+
}), Dt = /* @__PURE__ */ Te(Lt, [["__scopeId", "data-v-13862606"]]), At = { class: "editor-container" }, Pe = "", Kt = /* @__PURE__ */ we({
|
|
467
416
|
__name: "TemplateEditor",
|
|
468
417
|
props: {
|
|
469
418
|
modelValue: { default: () => [] },
|
|
470
419
|
modelModifiers: {}
|
|
471
420
|
},
|
|
472
|
-
emits: /* @__PURE__ */
|
|
473
|
-
setup(
|
|
474
|
-
const u = typeof window.ShadowRoot.prototype.getSelection == "function",
|
|
475
|
-
function
|
|
421
|
+
emits: /* @__PURE__ */ at(["submit"], ["update:modelValue"]),
|
|
422
|
+
setup(s, { expose: i, emit: a }) {
|
|
423
|
+
const u = typeof window.ShadowRoot.prototype.getSelection == "function", h = typeof window.Selection.prototype.getComposedRanges == "function";
|
|
424
|
+
function g() {
|
|
476
425
|
const e = navigator.userAgent;
|
|
477
426
|
return e.includes("Safari") && !e.includes("Chrome") && !e.includes("Chromium") && !e.includes("CriOS");
|
|
478
427
|
}
|
|
479
|
-
const
|
|
480
|
-
id:
|
|
481
|
-
...t.type === "template" ? { ...t, prefix:
|
|
482
|
-
})),
|
|
483
|
-
const t =
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
m.value = [t].concat(e);
|
|
489
|
-
else {
|
|
490
|
-
m.value = e;
|
|
491
|
-
const s = e[0], r = e[e.length - 1];
|
|
492
|
-
o ? r.content !== "" && (r.content = r.content.replace(/\u200B/g, "")) : s.content !== "" && (s.content = s.content.replace(/\u200B/g, ""));
|
|
493
|
-
}
|
|
494
|
-
else
|
|
495
|
-
m.value = e;
|
|
496
|
-
}, B = L(() => m.value.map((e) => e.type === "template" ? [
|
|
428
|
+
const l = g(), f = () => Math.random().toString(36).substring(2, 15), m = Pe, d = Pe, _ = Pe, y = lt(s, "modelValue"), A = a, V = M(0), P = (e) => e.map((t) => ({
|
|
429
|
+
id: t.id || f(),
|
|
430
|
+
...t.type === "template" ? { ...t, prefix: d, suffix: _ } : t
|
|
431
|
+
})), W = (e) => e.map((t) => ({ id: t.id, type: t.type, content: t.content })), k = M(P(y.value || [])), v = (e) => {
|
|
432
|
+
const t = [], o = [];
|
|
433
|
+
e.length > 0 && e[0].type === "template" && t.push({ type: "text", content: m, id: f() }), e.length > 0 && e[e.length - 1].type === "template" && o.push({ type: "text", content: m, id: f() });
|
|
434
|
+
const r = new RegExp(m, "g");
|
|
435
|
+
e.length > 0 && (e[0].content !== m && (e[0].content = e[0].content.replace(r, "")), e[e.length - 1].content !== m && (e[e.length - 1].content = e[e.length - 1].content.replace(r, ""))), k.value = t.concat(e).concat(o);
|
|
436
|
+
}, R = L(() => k.value.map((e) => e.type === "template" ? [
|
|
497
437
|
{ id: e.id, type: "prefix", content: e.prefix },
|
|
498
438
|
{ id: e.id, type: "template", content: e.content },
|
|
499
439
|
{ id: e.id, type: "suffix", content: e.suffix }
|
|
500
|
-
] : [e]).flat()),
|
|
440
|
+
] : [e]).flat()), b = L(() => k.value.map((e) => e.type === "text" ? e : l ? {
|
|
501
441
|
id: e.id,
|
|
502
442
|
type: "block",
|
|
503
443
|
asChild: !0,
|
|
@@ -527,88 +467,95 @@ const Kt = { class: "editor-container" }, De = "", Fe = "", Pt = /* @__PUR
|
|
|
527
467
|
},
|
|
528
468
|
{ id: e.id, type: "suffix", content: e.suffix }
|
|
529
469
|
]
|
|
530
|
-
})),
|
|
531
|
-
const t = Date.now(),
|
|
532
|
-
return `${t}:${
|
|
533
|
-
},
|
|
534
|
-
const t = parseInt(e.slice(0, 13)),
|
|
470
|
+
})), E = M(null), q = (e) => {
|
|
471
|
+
const t = Date.now(), o = JSON.stringify(e);
|
|
472
|
+
return `${t}:${o}`;
|
|
473
|
+
}, Q = (e) => {
|
|
474
|
+
const t = parseInt(e.slice(0, 13)), o = JSON.parse(e.slice(14));
|
|
535
475
|
return {
|
|
536
476
|
timestamp: t,
|
|
537
|
-
data:
|
|
477
|
+
data: o
|
|
538
478
|
};
|
|
539
|
-
},
|
|
479
|
+
}, F = /* @__PURE__ */ new Map(), N = Et(q(k.value), {
|
|
540
480
|
onRemoveHistory: (e) => {
|
|
541
481
|
for (const t of e)
|
|
542
|
-
|
|
482
|
+
F.delete(t);
|
|
543
483
|
}
|
|
544
484
|
});
|
|
545
|
-
|
|
546
|
-
() =>
|
|
485
|
+
ne(
|
|
486
|
+
() => y.value,
|
|
547
487
|
(e) => {
|
|
548
|
-
|
|
488
|
+
const t = P(e || []);
|
|
489
|
+
if (JSON.stringify(t) !== JSON.stringify(k.value)) {
|
|
490
|
+
if (E.value) {
|
|
491
|
+
const r = j(E.value);
|
|
492
|
+
r && F.set(N.get(), J(r));
|
|
493
|
+
}
|
|
494
|
+
v(t), N.commit(q(k.value));
|
|
495
|
+
}
|
|
549
496
|
},
|
|
550
497
|
{ deep: !0 }
|
|
551
498
|
);
|
|
552
|
-
const
|
|
499
|
+
const B = (e, t = document.body) => t.contains(e) ? e instanceof HTMLElement && e.dataset.id ? e : e.parentElement ? B(e.parentElement, t) : null : null, G = (e) => e === E.value, j = (e) => {
|
|
553
500
|
const t = window.getSelection();
|
|
554
501
|
if (!t)
|
|
555
502
|
return null;
|
|
556
|
-
const
|
|
503
|
+
const o = t.rangeCount > 0 ? t.getRangeAt(0) : null, r = e.getRootNode();
|
|
557
504
|
if (!(r instanceof ShadowRoot))
|
|
558
|
-
return
|
|
559
|
-
if (
|
|
560
|
-
const
|
|
561
|
-
return (
|
|
505
|
+
return o;
|
|
506
|
+
if (h) {
|
|
507
|
+
const c = t.getComposedRanges(l ? r : { shadowRoots: [r] });
|
|
508
|
+
return (c == null ? void 0 : c[0]) ?? null;
|
|
562
509
|
}
|
|
563
510
|
if (u) {
|
|
564
|
-
const
|
|
565
|
-
return
|
|
511
|
+
const c = r.getSelection();
|
|
512
|
+
return c.rangeCount > 0 ? c.getRangeAt(0) : null;
|
|
566
513
|
}
|
|
567
|
-
return
|
|
568
|
-
},
|
|
514
|
+
return o;
|
|
515
|
+
}, pe = (e, t) => {
|
|
569
516
|
var r;
|
|
570
517
|
if (!e.firstChild || e.firstChild.nodeType !== Node.TEXT_NODE)
|
|
571
|
-
return
|
|
572
|
-
const
|
|
573
|
-
return t >
|
|
574
|
-
},
|
|
575
|
-
const
|
|
576
|
-
if (!
|
|
518
|
+
return { node: e, offset: 0 };
|
|
519
|
+
const o = ((r = e.firstChild.textContent) == null ? void 0 : r.length) ?? 0;
|
|
520
|
+
return t > o && console.warn("offset is too large", { offset: t, el: e }), { node: e.firstChild, offset: Math.min(t, o) };
|
|
521
|
+
}, K = (e, t, o, r) => {
|
|
522
|
+
const c = window.getSelection();
|
|
523
|
+
if (!c)
|
|
577
524
|
return;
|
|
578
|
-
const { node:
|
|
579
|
-
if (!
|
|
580
|
-
|
|
525
|
+
const { node: p, offset: I } = pe(e, t);
|
|
526
|
+
if (!o) {
|
|
527
|
+
c.setBaseAndExtent(p, I, p, I);
|
|
581
528
|
return;
|
|
582
529
|
}
|
|
583
|
-
const { node:
|
|
584
|
-
|
|
585
|
-
},
|
|
586
|
-
const
|
|
530
|
+
const { node: T, offset: S } = pe(o, r ?? 0);
|
|
531
|
+
c.setBaseAndExtent(p, I, T, S);
|
|
532
|
+
}, Y = (e, t) => {
|
|
533
|
+
const o = f(), r = { id: o, type: "text", content: e };
|
|
587
534
|
if (t) {
|
|
588
|
-
const
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
) : console.warn(`can not find item with id: ${t}`);
|
|
535
|
+
const c = k.value.findIndex((p) => p.id === t);
|
|
536
|
+
c !== -1 ? (v(
|
|
537
|
+
k.value.slice(0, c + 1).concat(r).concat(k.value.slice(c + 1))
|
|
538
|
+
), N.commit(q(k.value))) : console.warn(`can not find item with id: ${t}`);
|
|
592
539
|
} else
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
var
|
|
596
|
-
const
|
|
597
|
-
|
|
598
|
-
}),
|
|
599
|
-
},
|
|
540
|
+
v([r].concat(k.value)), N.commit(q(k.value));
|
|
541
|
+
te(() => {
|
|
542
|
+
var p;
|
|
543
|
+
const c = (p = E.value) == null ? void 0 : p.querySelector(`[data-id="${o}"][data-type="text"]`);
|
|
544
|
+
c && K(c, e.length);
|
|
545
|
+
}), y.value = W(k.value);
|
|
546
|
+
}, se = M({
|
|
600
547
|
hasStarted: !1,
|
|
601
548
|
range: null
|
|
602
|
-
}),
|
|
603
|
-
var
|
|
549
|
+
}), Ee = (e) => {
|
|
550
|
+
var T;
|
|
604
551
|
const t = e;
|
|
605
552
|
e.preventDefault();
|
|
606
|
-
const { inputType:
|
|
607
|
-
if (!
|
|
608
|
-
console.warn("range is null",
|
|
553
|
+
const { inputType: o } = t, r = (t.data || ((T = t.dataTransfer) == null ? void 0 : T.getData("text/plain")) || "").replace(d, "").replace(_, ""), c = t.getTargetRanges()[0];
|
|
554
|
+
if (!c) {
|
|
555
|
+
console.warn("range is null", c);
|
|
609
556
|
return;
|
|
610
557
|
}
|
|
611
|
-
const
|
|
558
|
+
const p = [
|
|
612
559
|
"insertText",
|
|
613
560
|
"insertFromPaste",
|
|
614
561
|
"insertReplacementText",
|
|
@@ -619,96 +566,80 @@ const Kt = { class: "editor-container" }, De = "", Fe = "", Pt = /* @__PUR
|
|
|
619
566
|
"deleteSoftLineBackward",
|
|
620
567
|
"deleteSoftLineForward",
|
|
621
568
|
"deleteByCut"
|
|
622
|
-
],
|
|
623
|
-
if (
|
|
624
|
-
if (r &&
|
|
625
|
-
|
|
569
|
+
], I = j(E.value);
|
|
570
|
+
if (p.includes(o)) {
|
|
571
|
+
if (r && G(c.startContainer) && G(c.endContainer)) {
|
|
572
|
+
I && F.set(N.get(), J(I)), Y(r);
|
|
626
573
|
return;
|
|
627
574
|
}
|
|
628
|
-
const
|
|
629
|
-
|
|
630
|
-
} else
|
|
631
|
-
},
|
|
632
|
-
const t =
|
|
575
|
+
const S = J(c);
|
|
576
|
+
S.startId && S.endId ? (I && F.set(N.get(), J(I)), _e(S, o, r)) : console.warn("range is not valid, range:", S);
|
|
577
|
+
} else o === "insertCompositionText" && se.value.hasStarted && (se.value = { hasStarted: !1, range: J(c) });
|
|
578
|
+
}, J = (e) => {
|
|
579
|
+
const t = B(e.startContainer, E.value), o = B(e.endContainer, E.value);
|
|
633
580
|
return {
|
|
634
581
|
collapsed: e.collapsed,
|
|
635
582
|
endContainer: e.endContainer,
|
|
636
|
-
endId:
|
|
583
|
+
endId: o == null ? void 0 : o.dataset.id,
|
|
584
|
+
endEl: o,
|
|
637
585
|
endOffset: e.endOffset,
|
|
638
|
-
endType:
|
|
586
|
+
endType: o == null ? void 0 : o.dataset.type,
|
|
639
587
|
startContainer: e.startContainer,
|
|
640
588
|
startId: t == null ? void 0 : t.dataset.id,
|
|
589
|
+
startEl: t,
|
|
641
590
|
startOffset: e.startOffset,
|
|
642
591
|
startType: t == null ? void 0 : t.dataset.type
|
|
643
592
|
};
|
|
644
|
-
},
|
|
645
|
-
|
|
646
|
-
return e;
|
|
647
|
-
const r = e[0], l = m.value.find((D) => D.id === r.id);
|
|
648
|
-
if (!l || l.type !== "text" || l.content !== "" || t.collapsed)
|
|
649
|
-
return e;
|
|
650
|
-
const d = B.value.findIndex((D) => D.id === r.id);
|
|
651
|
-
if (d < 0 || d >= B.value.length - 1)
|
|
652
|
-
return [{ ...r, startOffset: 0, endOffset: 0 }];
|
|
653
|
-
const _ = B.value[d + 1];
|
|
654
|
-
return [
|
|
655
|
-
{
|
|
656
|
-
id: _.id,
|
|
657
|
-
type: _.type,
|
|
658
|
-
startOffset: 0,
|
|
659
|
-
endOffset: 0
|
|
660
|
-
}
|
|
661
|
-
];
|
|
662
|
-
}, Se = (e, t, s) => {
|
|
663
|
-
const r = we(e);
|
|
593
|
+
}, he = (e, t, o, r) => e.slice(0, o) + t + e.slice(r), _e = (e, t, o) => {
|
|
594
|
+
const r = ve(e);
|
|
664
595
|
if (!Array.isArray(r) || r.length === 0)
|
|
665
596
|
return;
|
|
666
|
-
const
|
|
667
|
-
if (
|
|
668
|
-
const { afterId:
|
|
669
|
-
|
|
597
|
+
const c = $e(r, e, t, o);
|
|
598
|
+
if (c.some((S) => S.tag === "new")) {
|
|
599
|
+
const { afterId: S, content: $ } = c[0];
|
|
600
|
+
Y($, S);
|
|
670
601
|
return;
|
|
671
602
|
}
|
|
672
|
-
const
|
|
673
|
-
for (const [
|
|
674
|
-
const
|
|
675
|
-
|
|
603
|
+
const p = c, I = [];
|
|
604
|
+
for (const [S, $] of p.entries()) {
|
|
605
|
+
const H = k.value.find((Ae) => Ae.id === $.id), le = S === 0 ? o : "";
|
|
606
|
+
H ? H.type === "text" ? H.content = he(H.content, le, $.startOffset, $.endOffset) : H.type === "template" ? $.type === "prefix" || $.type === "suffix" ? $.startOffset === 0 && $.endOffset === 1 && le.length === 0 ? H[$.type] = "" : console.warn(`${$.type} can not be inserted text. it only can be deleted`, $) : $.startOffset < 0 || $.endOffset > H.content.length ? I.push(H.id) : H.content = he(H.content, le, $.startOffset, $.endOffset) : console.warn("dataItem.type is not text or template", H) : console.warn("can not find dataItem", $);
|
|
676
607
|
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
);
|
|
685
|
-
for (const
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
},
|
|
689
|
-
const
|
|
690
|
-
|
|
691
|
-
var
|
|
692
|
-
const
|
|
693
|
-
if (
|
|
694
|
-
|
|
608
|
+
let T = k.value.filter((S) => !I.includes(S.id));
|
|
609
|
+
if (T = T.filter((S) => !(S.type === "template" && [S.prefix, S.suffix, S.content].join("").length === 0)), T.length >= 2) {
|
|
610
|
+
const S = T[0], $ = T[1];
|
|
611
|
+
S.type === "text" && S.content.length === 0 && $.type === "template" && (S.content = m);
|
|
612
|
+
const H = T[T.length - 1], le = T[T.length - 2];
|
|
613
|
+
H.type === "text" && H.content.length === 0 && le.type === "template" && (H.content = m);
|
|
614
|
+
}
|
|
615
|
+
T = T.filter((S) => !(S.type === "text" && S.content.length === 0));
|
|
616
|
+
for (const S of T.filter(($) => $.type === "template"))
|
|
617
|
+
S.prefix.length === 0 && (S.prefix = d), S.suffix.length === 0 && (S.suffix = _);
|
|
618
|
+
v(T), N.commit(q(k.value)), p.length > 0 && ye(p, o), y.value = W(k.value);
|
|
619
|
+
}, ye = (e, t) => {
|
|
620
|
+
const o = e[0], r = `[data-id="${o.id}"][data-type="${o.type}"]`, c = e.slice(1).map((p) => `[data-id="${p.id}"][data-type="${p.type}"]`);
|
|
621
|
+
te(() => {
|
|
622
|
+
var I, T;
|
|
623
|
+
const p = (I = E.value) == null ? void 0 : I.querySelector(r);
|
|
624
|
+
if (p)
|
|
625
|
+
K(p, o.startOffset + t.length);
|
|
695
626
|
else if (t.length === 0)
|
|
696
|
-
for (const
|
|
697
|
-
const $ = (
|
|
627
|
+
for (const S of c) {
|
|
628
|
+
const $ = (T = E.value) == null ? void 0 : T.querySelector(S);
|
|
698
629
|
if ($) {
|
|
699
|
-
|
|
630
|
+
K($, 0);
|
|
700
631
|
break;
|
|
701
632
|
}
|
|
702
633
|
}
|
|
703
634
|
else
|
|
704
635
|
console.warn(`can not find el with selector: ${r}`);
|
|
705
636
|
});
|
|
706
|
-
},
|
|
707
|
-
const t =
|
|
708
|
-
if (t === -1 ||
|
|
637
|
+
}, ve = (e) => {
|
|
638
|
+
const t = R.value.findIndex((I) => I.id === e.startId && I.type === e.startType), o = R.value.findIndex((I) => I.id === e.endId && I.type === e.endType);
|
|
639
|
+
if (t === -1 || o === -1 || t > o)
|
|
709
640
|
return console.warn("startIndex or endIndex is -1, or startIndex > endIndex. ", { range: e }), null;
|
|
710
|
-
const r =
|
|
711
|
-
if (t ===
|
|
641
|
+
const r = R.value[t], c = R.value[o];
|
|
642
|
+
if (t === o)
|
|
712
643
|
return [
|
|
713
644
|
{
|
|
714
645
|
id: r.id,
|
|
@@ -717,7 +648,7 @@ const Kt = { class: "editor-container" }, De = "", Fe = "", Pt = /* @__PUR
|
|
|
717
648
|
endOffset: e.endOffset
|
|
718
649
|
}
|
|
719
650
|
];
|
|
720
|
-
const
|
|
651
|
+
const p = [
|
|
721
652
|
{
|
|
722
653
|
id: r.id,
|
|
723
654
|
type: r.type,
|
|
@@ -725,236 +656,326 @@ const Kt = { class: "editor-container" }, De = "", Fe = "", Pt = /* @__PUR
|
|
|
725
656
|
endOffset: r.content.length
|
|
726
657
|
}
|
|
727
658
|
];
|
|
728
|
-
for (let
|
|
729
|
-
const
|
|
730
|
-
|
|
731
|
-
id:
|
|
732
|
-
type:
|
|
659
|
+
for (let I = t + 1; I < o; I++) {
|
|
660
|
+
const T = R.value[I];
|
|
661
|
+
p.push({
|
|
662
|
+
id: T.id,
|
|
663
|
+
type: T.type,
|
|
733
664
|
startOffset: 0,
|
|
734
|
-
endOffset:
|
|
665
|
+
endOffset: T.content.length
|
|
735
666
|
});
|
|
736
667
|
}
|
|
737
|
-
return
|
|
738
|
-
id:
|
|
739
|
-
type:
|
|
668
|
+
return p.push({
|
|
669
|
+
id: c.id,
|
|
670
|
+
type: c.type,
|
|
740
671
|
startOffset: 0,
|
|
741
672
|
endOffset: e.endOffset
|
|
742
|
-
}),
|
|
743
|
-
},
|
|
744
|
-
const
|
|
745
|
-
if (
|
|
673
|
+
}), p;
|
|
674
|
+
}, $e = (e, t, o, r) => {
|
|
675
|
+
const c = e[0];
|
|
676
|
+
if (c.type !== "prefix" && c.type !== "suffix")
|
|
746
677
|
return e;
|
|
747
678
|
if (e.length === 1) {
|
|
748
679
|
if (t.collapsed)
|
|
749
680
|
if (t.startOffset === 0) {
|
|
750
|
-
const
|
|
751
|
-
return
|
|
681
|
+
const p = ge(c, r);
|
|
682
|
+
return p ? [p] : [];
|
|
752
683
|
} else {
|
|
753
|
-
const
|
|
754
|
-
return
|
|
684
|
+
const p = ae(c, r);
|
|
685
|
+
return p ? [p] : [];
|
|
755
686
|
}
|
|
756
|
-
if (
|
|
757
|
-
if (
|
|
758
|
-
const
|
|
759
|
-
return
|
|
687
|
+
if (o.startsWith("insert"))
|
|
688
|
+
if (l) {
|
|
689
|
+
const p = ge(c, r);
|
|
690
|
+
return p ? [p] : [];
|
|
760
691
|
} else {
|
|
761
|
-
const
|
|
762
|
-
return
|
|
692
|
+
const p = ae(c, r);
|
|
693
|
+
return p ? [p] : [];
|
|
763
694
|
}
|
|
764
|
-
if (
|
|
765
|
-
if (
|
|
766
|
-
const
|
|
767
|
-
return
|
|
768
|
-
} else if (
|
|
769
|
-
const
|
|
770
|
-
return
|
|
695
|
+
if (o.startsWith("delete")) {
|
|
696
|
+
if (o.includes("Backward")) {
|
|
697
|
+
const p = ge(c, r, 1);
|
|
698
|
+
return p ? [p] : [];
|
|
699
|
+
} else if (o.includes("Forward")) {
|
|
700
|
+
const p = ae(c, r, 1);
|
|
701
|
+
return p ? [p] : [];
|
|
771
702
|
}
|
|
772
703
|
}
|
|
773
704
|
}
|
|
774
705
|
return r.length > 0 ? e.slice(1) : e;
|
|
775
|
-
},
|
|
776
|
-
const r =
|
|
706
|
+
}, ge = (e, t, o = 0) => {
|
|
707
|
+
const r = R.value.findIndex((c) => c.id === e.id && c.type === e.type);
|
|
777
708
|
if (r > 0) {
|
|
778
|
-
const
|
|
779
|
-
if (
|
|
709
|
+
const c = R.value[r - 1], { id: p, type: I, content: T } = c;
|
|
710
|
+
if (I === "text" || I === "template")
|
|
780
711
|
return {
|
|
781
|
-
id:
|
|
782
|
-
type:
|
|
783
|
-
startOffset:
|
|
784
|
-
endOffset:
|
|
712
|
+
id: p,
|
|
713
|
+
type: I,
|
|
714
|
+
startOffset: T.length - o,
|
|
715
|
+
endOffset: T.length
|
|
785
716
|
};
|
|
786
717
|
if (t.length > 0)
|
|
787
|
-
return { tag: "new", afterId:
|
|
788
|
-
if (console.warn("the previous item is not text or template", { current: e, previous:
|
|
718
|
+
return { tag: "new", afterId: p, type: "text", content: t };
|
|
719
|
+
if (console.warn("the previous item is not text or template", { current: e, previous: c }), o === 1)
|
|
789
720
|
return { ...e, endOffset: e.startOffset };
|
|
790
721
|
} else return t.length > 0 ? { tag: "new", type: "text", content: t } : (console.warn("the previous item of current is not found", { current: e }), null);
|
|
791
722
|
return e;
|
|
792
|
-
},
|
|
793
|
-
const r =
|
|
794
|
-
if (r <
|
|
795
|
-
const
|
|
796
|
-
if (
|
|
723
|
+
}, ae = (e, t, o = 0) => {
|
|
724
|
+
const r = R.value.findIndex((c) => c.id === e.id && c.type === e.type);
|
|
725
|
+
if (r < R.value.length - 1) {
|
|
726
|
+
const c = R.value[r + 1], { id: p, type: I } = c;
|
|
727
|
+
if (I === "text" || I === "template")
|
|
797
728
|
return {
|
|
798
|
-
id:
|
|
799
|
-
type:
|
|
729
|
+
id: p,
|
|
730
|
+
type: I,
|
|
800
731
|
startOffset: 0,
|
|
801
|
-
endOffset: 0 +
|
|
732
|
+
endOffset: 0 + o
|
|
802
733
|
};
|
|
803
734
|
if (t.length > 0)
|
|
804
735
|
return { tag: "new", afterId: e.id, type: "text", content: t };
|
|
805
|
-
if (console.warn("the next item is not text or template", { current: e, next:
|
|
736
|
+
if (console.warn("the next item is not text or template", { current: e, next: c }), o === 1)
|
|
806
737
|
return { ...e, startOffset: e.endOffset };
|
|
807
738
|
} else return t.length > 0 ? { tag: "new", afterId: e.id, type: "text", content: t } : (console.warn("the next item of current is not found", { current: e }), null);
|
|
808
739
|
return e;
|
|
809
|
-
},
|
|
810
|
-
|
|
811
|
-
},
|
|
812
|
-
const t =
|
|
813
|
-
t ? (e.data &&
|
|
814
|
-
},
|
|
740
|
+
}, Se = () => {
|
|
741
|
+
se.value = { hasStarted: !0, range: null };
|
|
742
|
+
}, Ce = (e) => {
|
|
743
|
+
const t = se.value.range;
|
|
744
|
+
t ? (e.data && G(t.startContainer) && G(t.endContainer) ? (F.set(N.get(), J(t)), Y(e.data)) : t.startId && t.endId ? (F.set(N.get(), J(t)), _e(t, "insertCompositionText", e.data)) : console.warn("range is not valid, range:", t), V.value++) : console.warn("range is null, compositionEnd:", e), se.value = { hasStarted: !1, range: null };
|
|
745
|
+
}, ee = (() => {
|
|
815
746
|
const e = navigator.userAgent.toLowerCase();
|
|
816
747
|
return /macintosh|mac os x|iphone|ipad|ipod/.test(e);
|
|
817
|
-
})(),
|
|
818
|
-
const t =
|
|
819
|
-
!
|
|
820
|
-
!
|
|
748
|
+
})(), Be = (e) => {
|
|
749
|
+
const t = ee && e.metaKey && !e.shiftKey && e.key.toLowerCase() === "z" || // Cmd+Z
|
|
750
|
+
!ee && e.ctrlKey && !e.shiftKey && e.key.toLowerCase() === "z", o = ee && e.metaKey && e.shiftKey && e.key.toLowerCase() === "z" || // Cmd+Shift+z
|
|
751
|
+
!ee && e.ctrlKey && (e.key.toLowerCase() === "y" || e.shiftKey && e.key.toLowerCase() === "z"), r = e.key.toLowerCase() === "enter";
|
|
821
752
|
if (t) {
|
|
822
753
|
e.preventDefault();
|
|
823
|
-
const
|
|
824
|
-
|
|
825
|
-
const
|
|
826
|
-
|
|
754
|
+
const c = j(E.value);
|
|
755
|
+
c && F.set(N.get(), J(c));
|
|
756
|
+
const p = N.undo();
|
|
757
|
+
p && re(p);
|
|
827
758
|
}
|
|
828
|
-
if (
|
|
759
|
+
if (o) {
|
|
829
760
|
e.preventDefault();
|
|
830
|
-
const
|
|
831
|
-
|
|
761
|
+
const c = N.redo();
|
|
762
|
+
c && re(c);
|
|
832
763
|
}
|
|
833
|
-
r && (e.preventDefault(),
|
|
834
|
-
},
|
|
835
|
-
const { data: t } =
|
|
836
|
-
if (
|
|
837
|
-
const
|
|
838
|
-
|
|
839
|
-
const r =
|
|
840
|
-
r &&
|
|
764
|
+
r && (e.preventDefault(), A("submit"));
|
|
765
|
+
}, re = (e) => {
|
|
766
|
+
const { data: t } = Q(e);
|
|
767
|
+
if (v(t), F.has(e)) {
|
|
768
|
+
const o = F.get(e);
|
|
769
|
+
te(() => {
|
|
770
|
+
const r = E.value.querySelector(`[data-id="${o.startId}"][data-type="${o.startType}"]`), c = E.value.querySelector(`[data-id="${o.endId}"][data-type="${o.endType}"]`);
|
|
771
|
+
r && K(r, o.startOffset, c, o.endOffset);
|
|
841
772
|
});
|
|
842
773
|
}
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
774
|
+
y.value = W(k.value);
|
|
775
|
+
}, Le = () => {
|
|
776
|
+
if (!E.value)
|
|
777
|
+
return;
|
|
778
|
+
const e = k.value.find((t) => t.type === "template");
|
|
779
|
+
e && te(() => {
|
|
780
|
+
var o, r;
|
|
781
|
+
const t = (o = E.value) == null ? void 0 : o.querySelector(`[data-id="${e.id}"][data-type="template"]`);
|
|
782
|
+
if (t) {
|
|
783
|
+
const c = ((r = t.textContent) == null ? void 0 : r.length) || 0;
|
|
784
|
+
K(t, c);
|
|
785
|
+
}
|
|
786
|
+
});
|
|
787
|
+
}, De = () => {
|
|
788
|
+
N.clear(), F.clear();
|
|
789
|
+
}, ke = () => {
|
|
790
|
+
if (!E.value || se.value.range)
|
|
791
|
+
return;
|
|
792
|
+
const e = j(E.value);
|
|
793
|
+
if (e != null && e.collapsed && k.value.length > 0) {
|
|
794
|
+
const t = J(e), o = k.value[0];
|
|
795
|
+
if (t.startEl && t.startId === o.id && t.startOffset === 0 && o.content === m && o.type === "text") {
|
|
796
|
+
K(t.startEl, 1);
|
|
850
797
|
return;
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
G(t, l);
|
|
858
|
-
}
|
|
859
|
-
});
|
|
798
|
+
}
|
|
799
|
+
const r = k.value[k.value.length - 1];
|
|
800
|
+
if (t.endEl && t.endId === r.id && t.endOffset === 1 && r.content === m && r.type === "text") {
|
|
801
|
+
K(t.endEl, 0);
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
860
804
|
}
|
|
861
|
-
}
|
|
862
|
-
|
|
805
|
+
};
|
|
806
|
+
return rt(() => {
|
|
807
|
+
document.addEventListener("selectionchange", ke);
|
|
808
|
+
}), it(() => {
|
|
809
|
+
document.removeEventListener("selectionchange", ke);
|
|
810
|
+
}), i({
|
|
811
|
+
clearHistory: De,
|
|
812
|
+
activateFirstField: Le
|
|
813
|
+
}), (e, t) => (w(), O("div", At, [
|
|
814
|
+
(w(), O("div", {
|
|
863
815
|
contenteditable: "true",
|
|
864
816
|
ref_key: "editorRef",
|
|
865
|
-
ref:
|
|
866
|
-
key:
|
|
817
|
+
ref: E,
|
|
818
|
+
key: V.value,
|
|
867
819
|
class: "editor",
|
|
868
|
-
onBeforeinput:
|
|
869
|
-
onCompositionstart:
|
|
870
|
-
onCompositionend:
|
|
871
|
-
onKeydown:
|
|
820
|
+
onBeforeinput: Ee,
|
|
821
|
+
onCompositionstart: Se,
|
|
822
|
+
onCompositionend: Ce,
|
|
823
|
+
onKeydown: Be
|
|
872
824
|
}, [
|
|
873
|
-
(
|
|
874
|
-
key: `${
|
|
875
|
-
}, { ref_for: !0 },
|
|
825
|
+
(w(!0), O(fe, null, be(b.value, (o) => (w(), Z(Dt, me({
|
|
826
|
+
key: `${o.id}-${o.type}`
|
|
827
|
+
}, { ref_for: !0 }, o), null, 16))), 128))
|
|
876
828
|
], 32))
|
|
877
829
|
]));
|
|
878
830
|
}
|
|
879
|
-
}),
|
|
831
|
+
}), Mt = /* @__PURE__ */ Te(Kt, [["__scopeId", "data-v-7a3ac2af"]]), Pt = (s, i) => {
|
|
832
|
+
if (!i || !s)
|
|
833
|
+
return [{ text: s, isMatch: !1 }];
|
|
834
|
+
const a = s.toLowerCase(), u = i.toLowerCase(), h = [];
|
|
835
|
+
let g = 0;
|
|
836
|
+
for (; g < a.length; ) {
|
|
837
|
+
const d = a.indexOf(u, g);
|
|
838
|
+
if (d === -1) break;
|
|
839
|
+
h.push({
|
|
840
|
+
start: d,
|
|
841
|
+
end: d + i.length
|
|
842
|
+
}), g = d + 1;
|
|
843
|
+
}
|
|
844
|
+
if (h.length === 0)
|
|
845
|
+
return [{ text: s, isMatch: !1 }];
|
|
846
|
+
const l = [];
|
|
847
|
+
for (const d of h)
|
|
848
|
+
if (l.length === 0)
|
|
849
|
+
l.push(d);
|
|
850
|
+
else {
|
|
851
|
+
const _ = l[l.length - 1];
|
|
852
|
+
d.start <= _.end ? _.end = Math.max(_.end, d.end) : l.push(d);
|
|
853
|
+
}
|
|
854
|
+
const f = [];
|
|
855
|
+
let m = 0;
|
|
856
|
+
for (const d of l)
|
|
857
|
+
m < d.start && f.push({
|
|
858
|
+
text: s.substring(m, d.start),
|
|
859
|
+
isMatch: !1
|
|
860
|
+
}), f.push({
|
|
861
|
+
text: s.substring(d.start, d.end),
|
|
862
|
+
isMatch: !0
|
|
863
|
+
}), m = d.end;
|
|
864
|
+
return m < s.length && f.push({
|
|
865
|
+
text: s.substring(m),
|
|
866
|
+
isMatch: !1
|
|
867
|
+
}), f;
|
|
868
|
+
}, Wt = (s, i) => {
|
|
869
|
+
if (!i.length)
|
|
870
|
+
return [{ text: s, isMatch: !1 }];
|
|
871
|
+
const a = new Array(s.length).fill(!1);
|
|
872
|
+
for (const g of i) {
|
|
873
|
+
let l = 0;
|
|
874
|
+
for (; ; ) {
|
|
875
|
+
const f = s.indexOf(g, l);
|
|
876
|
+
if (f === -1) break;
|
|
877
|
+
for (let m = 0; m < g.length; m++)
|
|
878
|
+
a[f + m] = !0;
|
|
879
|
+
l = f + 1;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
const u = [];
|
|
883
|
+
let h = null;
|
|
884
|
+
for (let g = 0; g < s.length; g++) {
|
|
885
|
+
const l = a[g];
|
|
886
|
+
!h || h.isMatch !== l ? (h = { text: s[g], isMatch: l }, u.push(h)) : h.text += s[g];
|
|
887
|
+
}
|
|
888
|
+
return u;
|
|
889
|
+
}, Ft = (s, i) => {
|
|
890
|
+
const { content: a, highlights: u } = s;
|
|
891
|
+
return typeof u == "function" ? u(a, i) : Array.isArray(u) ? Wt(a, u) : Pt(a, i);
|
|
892
|
+
}, Vt = ["onMouseenter", "onMousedown"], Nt = { class: "suggestion-list__text" }, Ht = /* @__PURE__ */ we({
|
|
880
893
|
__name: "SuggestionList",
|
|
881
894
|
props: {
|
|
882
895
|
show: { type: Boolean },
|
|
883
896
|
suggestions: {},
|
|
884
897
|
popupStyle: {},
|
|
885
|
-
|
|
886
|
-
|
|
898
|
+
activeKeyboardIndex: {},
|
|
899
|
+
activeMouseIndex: {},
|
|
887
900
|
inputValue: {}
|
|
888
901
|
},
|
|
889
|
-
emits: ["
|
|
890
|
-
setup(
|
|
891
|
-
const a =
|
|
892
|
-
u("
|
|
893
|
-
},
|
|
894
|
-
u("
|
|
895
|
-
},
|
|
896
|
-
u("select",
|
|
902
|
+
emits: ["select", "mouse-enter", "mouse-leave"],
|
|
903
|
+
setup(s, { emit: i }) {
|
|
904
|
+
const a = s, u = i, h = M(null), g = (d) => d === a.activeKeyboardIndex || d === a.activeMouseIndex, l = (d) => {
|
|
905
|
+
u("mouse-enter", d);
|
|
906
|
+
}, f = () => {
|
|
907
|
+
u("mouse-leave");
|
|
908
|
+
}, m = (d) => {
|
|
909
|
+
u("select", d);
|
|
897
910
|
};
|
|
898
|
-
return (
|
|
899
|
-
|
|
900
|
-
|
|
911
|
+
return ne(
|
|
912
|
+
() => a.activeKeyboardIndex,
|
|
913
|
+
(d) => {
|
|
914
|
+
if (d !== -1 && h.value) {
|
|
915
|
+
const _ = h.value.children[d];
|
|
916
|
+
_ && _.scrollIntoView({ block: "nearest" });
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
), (d, _) => (w(), Z(We, { name: "tiny-sender-slide-up" }, {
|
|
920
|
+
default: de(() => [
|
|
921
|
+
a.show && a.suggestions.length ? (w(), O("div", {
|
|
901
922
|
key: 0,
|
|
902
923
|
ref_key: "suggestionsListRef",
|
|
903
|
-
ref:
|
|
924
|
+
ref: h,
|
|
904
925
|
class: "suggestion-list",
|
|
905
|
-
style:
|
|
926
|
+
style: Fe(a.popupStyle)
|
|
906
927
|
}, [
|
|
907
|
-
(
|
|
908
|
-
key:
|
|
909
|
-
class:
|
|
910
|
-
onMouseenter: (
|
|
911
|
-
onMouseleave:
|
|
912
|
-
onMousedown:
|
|
928
|
+
(w(!0), O(fe, null, be(a.suggestions, (y, A) => (w(), O("div", {
|
|
929
|
+
key: A,
|
|
930
|
+
class: oe(["suggestion-list__item", { highlighted: g(A) }]),
|
|
931
|
+
onMouseenter: (V) => l(A),
|
|
932
|
+
onMouseleave: f,
|
|
933
|
+
onMousedown: ut((V) => m(y.content), ["prevent"])
|
|
913
934
|
}, [
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
(
|
|
917
|
-
key:
|
|
918
|
-
class:
|
|
919
|
-
"suggestion-list__text--match":
|
|
920
|
-
"suggestion-list__text--normal": !
|
|
935
|
+
X(C(wt), { class: "suggestion-list__icon" }),
|
|
936
|
+
z("span", Nt, [
|
|
937
|
+
(w(!0), O(fe, null, be(C(Ft)(y, a.inputValue), (V, P) => (w(), O("span", {
|
|
938
|
+
key: P,
|
|
939
|
+
class: oe({
|
|
940
|
+
"suggestion-list__text--match": V.isMatch,
|
|
941
|
+
"suggestion-list__text--normal": !V.isMatch
|
|
921
942
|
})
|
|
922
|
-
},
|
|
943
|
+
}, ce(V.text), 3))), 128))
|
|
923
944
|
])
|
|
924
|
-
], 42,
|
|
925
|
-
], 4)) :
|
|
945
|
+
], 42, Vt))), 128))
|
|
946
|
+
], 4)) : U("", !0)
|
|
926
947
|
]),
|
|
927
948
|
_: 1
|
|
928
949
|
}));
|
|
929
950
|
}
|
|
930
|
-
}),
|
|
951
|
+
}), Ut = /* @__PURE__ */ Te(Ht, [["__scopeId", "data-v-e0ec9fe3"]]), qt = ["data-theme"], zt = { class: "tiny-sender__container" }, Gt = {
|
|
931
952
|
key: 0,
|
|
932
953
|
class: "tiny-sender__header-slot"
|
|
933
954
|
}, jt = {
|
|
934
955
|
key: 0,
|
|
935
956
|
class: "tiny-sender__prefix-slot"
|
|
936
|
-
},
|
|
957
|
+
}, Jt = { class: "tiny-sender__content-area" }, Xt = {
|
|
937
958
|
key: 0,
|
|
938
959
|
class: "tiny-sender__decorative-content"
|
|
939
|
-
},
|
|
960
|
+
}, Zt = {
|
|
940
961
|
key: 2,
|
|
941
962
|
class: "tiny-sender__input-field-wrapper"
|
|
942
963
|
}, Qt = {
|
|
943
964
|
key: 0,
|
|
944
965
|
class: "tiny-sender__completion-placeholder"
|
|
945
|
-
}, Yt = { class: "user-input-mirror" },
|
|
966
|
+
}, Yt = { class: "user-input-mirror" }, en = {
|
|
946
967
|
key: 0,
|
|
947
968
|
class: "tiny-sender__tab-hint"
|
|
948
|
-
},
|
|
969
|
+
}, tn = {
|
|
949
970
|
key: 1,
|
|
950
971
|
class: "tiny-sender__actions-slot"
|
|
951
|
-
},
|
|
972
|
+
}, nn = { class: "tiny-sender__footer-left" }, on = { class: "tiny-sender__footer-right" }, sn = { class: "real-word-length" }, an = {
|
|
952
973
|
key: 1,
|
|
953
974
|
class: "tiny-sender__toolbar"
|
|
954
|
-
},
|
|
975
|
+
}, ln = { class: "tiny-sender__buttons-container" }, rn = {
|
|
955
976
|
key: 1,
|
|
956
977
|
class: "tiny-sender__footer-slot"
|
|
957
|
-
},
|
|
978
|
+
}, Oe = /* @__PURE__ */ we({
|
|
958
979
|
__name: "index",
|
|
959
980
|
props: {
|
|
960
981
|
autofocus: { type: Boolean, default: !1 },
|
|
@@ -980,357 +1001,359 @@ const Kt = { class: "editor-container" }, De = "", Fe = "", Pt = /* @__PUR
|
|
|
980
1001
|
stopText: { default: "" }
|
|
981
1002
|
},
|
|
982
1003
|
emits: ["update:modelValue", "update:templateData", "submit", "clear", "speech-start", "speech-end", "speech-interim", "speech-error", "suggestion-select", "focus", "blur", "escape-press", "cancel", "reset-template", "files-selected"],
|
|
983
|
-
setup(
|
|
984
|
-
var
|
|
985
|
-
const u =
|
|
1004
|
+
setup(s, { expose: i, emit: a }) {
|
|
1005
|
+
var Ve;
|
|
1006
|
+
const u = s, h = a, g = M(null), l = M(null), f = M(null), m = M(null), d = M(null), _ = L(() => u.templateData && u.templateData.length > 0), { inputValue: y, isComposing: A, clearInput: V } = St(u, h), P = L(() => !!y.value.trim()), W = L(() => {
|
|
986
1007
|
var n, x;
|
|
987
|
-
return !(u.disabled || u.loading || !
|
|
1008
|
+
return !(u.disabled || u.loading || !P.value || ee.value || (x = (n = u.buttonGroup) == null ? void 0 : n.submit) != null && x.disabled);
|
|
988
1009
|
}), {
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1010
|
+
isPopupVisible: k,
|
|
1011
|
+
activeSuggestion: v,
|
|
1012
|
+
activeKeyboardIndex: R,
|
|
1013
|
+
activeMouseIndex: b,
|
|
1014
|
+
autoCompleteText: E,
|
|
1015
|
+
showTabIndicator: q,
|
|
1016
|
+
syncAutoComplete: Q,
|
|
1017
|
+
closePopup: F,
|
|
1018
|
+
applySuggestion: N,
|
|
1019
|
+
confirmSelection: B,
|
|
1020
|
+
navigateWithKeyboard: G,
|
|
1021
|
+
handleMouseEnter: j,
|
|
1022
|
+
handleMouseLeave: pe
|
|
1023
|
+
} = kt(
|
|
1024
|
+
L(() => u.suggestions),
|
|
1025
|
+
y,
|
|
1026
|
+
A,
|
|
1027
|
+
_,
|
|
1028
|
+
(n) => h("update:modelValue", n),
|
|
1029
|
+
(n) => h("suggestion-select", n)
|
|
1030
|
+
), K = M(u.mode), Y = M(!1), se = () => {
|
|
1031
|
+
K.value === "single" && (K.value = "multiple", te(() => {
|
|
1006
1032
|
setTimeout(() => {
|
|
1007
1033
|
const n = document.querySelector(".tiny-textarea__inner");
|
|
1008
1034
|
if (n) {
|
|
1009
1035
|
n.style.whiteSpace = "pre-wrap";
|
|
1010
|
-
const x =
|
|
1036
|
+
const x = y.value.length;
|
|
1011
1037
|
n.focus(), n.setSelectionRange(x, x);
|
|
1012
1038
|
}
|
|
1013
1039
|
}, 50);
|
|
1014
1040
|
}));
|
|
1015
|
-
},
|
|
1016
|
-
const
|
|
1017
|
-
|
|
1018
|
-
const
|
|
1019
|
-
return document.body.removeChild(
|
|
1020
|
-
},
|
|
1021
|
-
var
|
|
1022
|
-
if (u.mode !== "single" || !
|
|
1023
|
-
const n =
|
|
1041
|
+
}, Ee = (n, x) => {
|
|
1042
|
+
const D = document.createElement("span");
|
|
1043
|
+
D.style.visibility = "hidden", D.style.position = "absolute", D.style.whiteSpace = "nowrap", D.style.font = x, D.textContent = n, document.body.appendChild(D);
|
|
1044
|
+
const ie = D.offsetWidth;
|
|
1045
|
+
return document.body.removeChild(D), ie;
|
|
1046
|
+
}, J = () => {
|
|
1047
|
+
var Ie, Ue, qe;
|
|
1048
|
+
if (u.mode !== "single" || !g.value || Y.value || !l.value || !m.value) return;
|
|
1049
|
+
const n = l.value.querySelector(".tiny-sender__content-area");
|
|
1024
1050
|
if (!n) return;
|
|
1025
|
-
const x = ((
|
|
1051
|
+
const x = ((Ue = (Ie = g.value) == null ? void 0 : Ie.querySelector) == null ? void 0 : Ue.call(Ie, ".tiny-input__inner")) || n.querySelector(".tiny-input__inner"), D = d.value || l.value.querySelector(".tiny-sender__buttons-container");
|
|
1026
1052
|
if (!x) {
|
|
1027
1053
|
console.warn("Cannot find input element for overflow check");
|
|
1028
1054
|
return;
|
|
1029
1055
|
}
|
|
1030
|
-
const
|
|
1031
|
-
if (
|
|
1032
|
-
setTimeout(() =>
|
|
1056
|
+
const ie = x.getBoundingClientRect(), Ke = D == null ? void 0 : D.getBoundingClientRect();
|
|
1057
|
+
if (ie.width === 0) {
|
|
1058
|
+
setTimeout(() => J(), 50);
|
|
1033
1059
|
return;
|
|
1034
1060
|
}
|
|
1035
|
-
const
|
|
1036
|
-
|
|
1037
|
-
|
|
1061
|
+
const Xe = window.getComputedStyle(x).font, Ze = Ee(y.value, Xe), Ne = (qe = l.value) == null ? void 0 : qe.classList.contains("tr-sender-compact"), Qe = Ne ? 12 : 20, Ye = ie.width, et = (Ke == null ? void 0 : Ke.width) || 0, He = Ye - et - Qe, tt = Ne ? 50 : 80;
|
|
1062
|
+
Ze > He && He > tt && K.value === "single" && (Y.value = !0, K.value = "multiple", te(() => {
|
|
1063
|
+
g.value ? setTimeout(() => {
|
|
1038
1064
|
var ze;
|
|
1039
|
-
const
|
|
1040
|
-
if (
|
|
1041
|
-
|
|
1042
|
-
const
|
|
1043
|
-
|
|
1065
|
+
const Re = (ze = l.value) == null ? void 0 : ze.querySelector(".tiny-textarea__inner");
|
|
1066
|
+
if (Re) {
|
|
1067
|
+
Re.style.whiteSpace = "pre-wrap";
|
|
1068
|
+
const Ge = y.value.length;
|
|
1069
|
+
Re.focus(), Re.setSelectionRange(Ge, Ge);
|
|
1044
1070
|
}
|
|
1045
|
-
|
|
1046
|
-
}, 300) :
|
|
1071
|
+
Y.value = !1;
|
|
1072
|
+
}, 300) : Y.value = !1;
|
|
1047
1073
|
}));
|
|
1048
|
-
},
|
|
1049
|
-
if (
|
|
1050
|
-
|
|
1051
|
-
else if (
|
|
1052
|
-
|
|
1074
|
+
}, he = () => {
|
|
1075
|
+
if (_.value && f.value)
|
|
1076
|
+
S();
|
|
1077
|
+
else if (g.value)
|
|
1078
|
+
g.value.focus();
|
|
1053
1079
|
else {
|
|
1054
1080
|
const n = document.querySelector(".tiny-input__inner");
|
|
1055
1081
|
n == null || n.focus();
|
|
1056
1082
|
}
|
|
1057
|
-
},
|
|
1058
|
-
if (
|
|
1059
|
-
|
|
1083
|
+
}, _e = () => {
|
|
1084
|
+
if (g.value)
|
|
1085
|
+
g.value.blur();
|
|
1060
1086
|
else {
|
|
1061
1087
|
const n = document.querySelector(".tiny-input__inner");
|
|
1062
1088
|
n == null || n.blur();
|
|
1063
1089
|
}
|
|
1064
|
-
},
|
|
1090
|
+
}, ye = () => {
|
|
1065
1091
|
var n;
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1092
|
+
h("update:templateData", []), (n = f.value) == null || n.clearHistory(), te(() => {
|
|
1093
|
+
y.value === "" && (K.value = u.mode || "single"), setTimeout(() => {
|
|
1094
|
+
he();
|
|
1069
1095
|
}, 50);
|
|
1070
|
-
})
|
|
1071
|
-
},
|
|
1096
|
+
});
|
|
1097
|
+
}, ve = () => {
|
|
1072
1098
|
var n;
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
})
|
|
1099
|
+
V(), _.value ? ye() : (n = l.value) == null || n.focus(), te(() => {
|
|
1100
|
+
y.value === "" && (K.value = u.mode || "single");
|
|
1101
|
+
});
|
|
1076
1102
|
}, $e = (n) => {
|
|
1077
|
-
|
|
1078
|
-
|
|
1103
|
+
const x = (ie) => ie.type === "text" && ie.content === "";
|
|
1104
|
+
if (n.length === 0 || n.every(x)) {
|
|
1105
|
+
ye();
|
|
1079
1106
|
return;
|
|
1080
1107
|
}
|
|
1081
|
-
|
|
1108
|
+
h("update:templateData", n);
|
|
1082
1109
|
};
|
|
1083
|
-
|
|
1110
|
+
ne(
|
|
1084
1111
|
() => u.templateData,
|
|
1085
1112
|
() => {
|
|
1086
|
-
|
|
1113
|
+
y.value = u.templateData.map((n) => n.content).join("");
|
|
1087
1114
|
},
|
|
1088
1115
|
{ deep: !0 }
|
|
1089
1116
|
);
|
|
1090
|
-
const
|
|
1117
|
+
const ge = L(() => {
|
|
1091
1118
|
const n = typeof u.speech == "object" ? u.speech : {};
|
|
1092
1119
|
return {
|
|
1093
1120
|
...n,
|
|
1094
|
-
onStart: () =>
|
|
1095
|
-
onEnd: (x) =>
|
|
1096
|
-
onInterim: (x) =>
|
|
1121
|
+
onStart: () => h("speech-start"),
|
|
1122
|
+
onEnd: (x) => h("speech-end", x),
|
|
1123
|
+
onInterim: (x) => h("speech-interim", x),
|
|
1097
1124
|
onFinal: (x) => {
|
|
1098
1125
|
if (n.autoReplace)
|
|
1099
|
-
|
|
1126
|
+
y.value = x;
|
|
1100
1127
|
else {
|
|
1101
|
-
const
|
|
1102
|
-
|
|
1128
|
+
const D = y.value;
|
|
1129
|
+
D && x && !D.endsWith(" ") && !x.startsWith(" ") && D.length > 0 ? y.value = D + " " + x : y.value = D + x;
|
|
1103
1130
|
}
|
|
1104
|
-
|
|
1131
|
+
h("speech-end", x);
|
|
1105
1132
|
},
|
|
1106
1133
|
onError: (x) => {
|
|
1107
|
-
|
|
1134
|
+
h("speech-error", x);
|
|
1108
1135
|
}
|
|
1109
1136
|
};
|
|
1110
|
-
}), { speechState:
|
|
1111
|
-
|
|
1112
|
-
},
|
|
1137
|
+
}), { speechState: ae, start: Se, stop: Ce } = xt(ge.value), xe = () => {
|
|
1138
|
+
ae.isRecording ? Ce() : Se();
|
|
1139
|
+
}, ee = L(() => u.maxLength !== 1 / 0 && y.value.length > u.maxLength), { handleKeyPress: Be, triggerSubmit: re } = Ct(
|
|
1113
1140
|
u,
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
I,
|
|
1117
|
-
Z,
|
|
1141
|
+
h,
|
|
1142
|
+
y,
|
|
1118
1143
|
A,
|
|
1119
|
-
|
|
1120
|
-
ce,
|
|
1121
|
-
G,
|
|
1122
|
-
O,
|
|
1123
|
-
Ce,
|
|
1124
|
-
B,
|
|
1125
|
-
N,
|
|
1126
|
-
Se,
|
|
1144
|
+
ae,
|
|
1127
1145
|
k,
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1146
|
+
v,
|
|
1147
|
+
B,
|
|
1148
|
+
F,
|
|
1149
|
+
G,
|
|
1150
|
+
xe,
|
|
1151
|
+
W,
|
|
1152
|
+
K,
|
|
1153
|
+
se,
|
|
1154
|
+
_,
|
|
1155
|
+
ye
|
|
1156
|
+
), Le = (n) => {
|
|
1157
|
+
h("focus", n), y.value && !_.value && (k.value = !0);
|
|
1158
|
+
}, De = (n) => {
|
|
1159
|
+
h("blur", n), F();
|
|
1160
|
+
}, ke = L(() => K.value === "multiple" ? "textarea" : "text"), e = L(
|
|
1134
1161
|
() => ({
|
|
1135
1162
|
display: "flex",
|
|
1136
1163
|
justifyContent: u.showWordLimit && u.maxLength !== 1 / 0 ? "space-between" : "flex-end",
|
|
1137
1164
|
alignItems: "center"
|
|
1138
1165
|
})
|
|
1139
|
-
),
|
|
1140
|
-
"is-disabled":
|
|
1141
|
-
"is-loading":
|
|
1142
|
-
"is-auto-switching":
|
|
1143
|
-
})),
|
|
1144
|
-
width:
|
|
1166
|
+
), t = ct(), o = L(() => !!t.decorativeContent), r = L(() => u.disabled || o.value), c = L(() => u.loading), p = L(() => ({
|
|
1167
|
+
"is-disabled": r.value,
|
|
1168
|
+
"is-loading": c.value,
|
|
1169
|
+
"is-auto-switching": Y.value
|
|
1170
|
+
})), I = L(() => ({
|
|
1171
|
+
width: _t(u.suggestionPopupWidth),
|
|
1145
1172
|
maxWidth: "100%"
|
|
1146
1173
|
// 确保不超出父容器宽度
|
|
1147
|
-
})),
|
|
1148
|
-
|
|
1149
|
-
I.value = !1, Q();
|
|
1150
|
-
}, 50);
|
|
1174
|
+
})), T = () => {
|
|
1175
|
+
A.value = !1;
|
|
1151
1176
|
};
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
}),
|
|
1155
|
-
() =>
|
|
1177
|
+
ne(y, () => {
|
|
1178
|
+
te(J), y.value === "" && u.mode === "single" && (K.value = "single"), Q();
|
|
1179
|
+
}), ne(
|
|
1180
|
+
() => _.value,
|
|
1156
1181
|
(n) => {
|
|
1157
|
-
n && (
|
|
1182
|
+
n && (K.value = "multiple");
|
|
1158
1183
|
}
|
|
1159
1184
|
);
|
|
1160
|
-
const
|
|
1161
|
-
|
|
1162
|
-
}, { accept:
|
|
1163
|
-
return
|
|
1164
|
-
n && n.length > 0 &&
|
|
1165
|
-
}),
|
|
1166
|
-
focus:
|
|
1167
|
-
blur:
|
|
1168
|
-
clear:
|
|
1169
|
-
submit:
|
|
1170
|
-
startSpeech:
|
|
1171
|
-
stopSpeech:
|
|
1172
|
-
activateTemplateFirstField:
|
|
1173
|
-
}), (n, x) => (
|
|
1185
|
+
const S = () => {
|
|
1186
|
+
f.value && f.value.activateFirstField();
|
|
1187
|
+
}, { accept: $ = "*", multiple: H = !0 } = ((Ve = u.buttonGroup) == null ? void 0 : Ve.file) || {}, { open: le, files: Ae } = pt({ accept: $, multiple: H });
|
|
1188
|
+
return ne(Ae, (n) => {
|
|
1189
|
+
n && n.length > 0 && h("files-selected", Array.from(n));
|
|
1190
|
+
}), i({
|
|
1191
|
+
focus: he,
|
|
1192
|
+
blur: _e,
|
|
1193
|
+
clear: ve,
|
|
1194
|
+
submit: re,
|
|
1195
|
+
startSpeech: Se,
|
|
1196
|
+
stopSpeech: Ce,
|
|
1197
|
+
activateTemplateFirstField: S
|
|
1198
|
+
}), (n, x) => (w(), O("div", {
|
|
1174
1199
|
ref_key: "senderRef",
|
|
1175
|
-
ref:
|
|
1176
|
-
class:
|
|
1200
|
+
ref: l,
|
|
1201
|
+
class: oe(["tiny-sender", [p.value, `theme-${n.theme}`, `mode-${K.value}`]]),
|
|
1177
1202
|
"data-theme": n.theme
|
|
1178
1203
|
}, [
|
|
1179
|
-
|
|
1180
|
-
|
|
1204
|
+
z("div", zt, [
|
|
1205
|
+
z("div", {
|
|
1181
1206
|
class: "tiny-sender__input-wrapper",
|
|
1182
1207
|
ref_key: "inputWrapperRef",
|
|
1183
|
-
ref:
|
|
1208
|
+
ref: m
|
|
1184
1209
|
}, [
|
|
1185
|
-
|
|
1186
|
-
default:
|
|
1187
|
-
n.$slots.header ? (
|
|
1188
|
-
|
|
1189
|
-
])) :
|
|
1210
|
+
X(We, { name: "tiny-sender-slide-down" }, {
|
|
1211
|
+
default: de(() => [
|
|
1212
|
+
n.$slots.header ? (w(), O("div", Gt, [
|
|
1213
|
+
ue(n.$slots, "header")
|
|
1214
|
+
])) : U("", !0)
|
|
1190
1215
|
]),
|
|
1191
1216
|
_: 3
|
|
1192
1217
|
}),
|
|
1193
|
-
|
|
1194
|
-
class:
|
|
1218
|
+
z("div", {
|
|
1219
|
+
class: oe(["tiny-sender__input-row", { "has-prefix": n.$slots.prefix, "has-header": n.$slots.header }])
|
|
1195
1220
|
}, [
|
|
1196
|
-
n.$slots.prefix ? (
|
|
1197
|
-
|
|
1198
|
-
])) :
|
|
1199
|
-
|
|
1200
|
-
n.$slots.decorativeContent ? (
|
|
1201
|
-
|
|
1202
|
-
])) :
|
|
1203
|
-
|
|
1221
|
+
n.$slots.prefix ? (w(), O("div", jt, [
|
|
1222
|
+
ue(n.$slots, "prefix")
|
|
1223
|
+
])) : U("", !0),
|
|
1224
|
+
z("div", Jt, [
|
|
1225
|
+
n.$slots.decorativeContent ? (w(), O("div", Xt, [
|
|
1226
|
+
ue(n.$slots, "decorativeContent")
|
|
1227
|
+
])) : U("", !0),
|
|
1228
|
+
_.value ? (w(), Z(Mt, {
|
|
1204
1229
|
key: 1,
|
|
1205
1230
|
ref_key: "templateEditorRef",
|
|
1206
|
-
ref:
|
|
1231
|
+
ref: f,
|
|
1207
1232
|
"model-value": u.templateData,
|
|
1208
1233
|
"onUpdate:modelValue": $e,
|
|
1209
|
-
onSubmit: C(
|
|
1210
|
-
}, null, 8, ["model-value", "onSubmit"])) : (
|
|
1211
|
-
|
|
1234
|
+
onSubmit: C(re)
|
|
1235
|
+
}, null, 8, ["model-value", "onSubmit"])) : (w(), O("div", Zt, [
|
|
1236
|
+
X(C(ft), {
|
|
1212
1237
|
ref_key: "inputRef",
|
|
1213
|
-
ref:
|
|
1238
|
+
ref: g,
|
|
1214
1239
|
autosize: n.autoSize,
|
|
1215
|
-
type:
|
|
1240
|
+
type: ke.value,
|
|
1216
1241
|
resize: "none",
|
|
1217
|
-
modelValue: C(
|
|
1218
|
-
"onUpdate:modelValue": x[0] || (x[0] = (
|
|
1219
|
-
disabled:
|
|
1242
|
+
modelValue: C(y),
|
|
1243
|
+
"onUpdate:modelValue": x[0] || (x[0] = (D) => dt(y) ? y.value = D : null),
|
|
1244
|
+
disabled: r.value,
|
|
1220
1245
|
placeholder: n.placeholder,
|
|
1221
1246
|
autofocus: n.autofocus,
|
|
1222
|
-
onKeydown: C(
|
|
1223
|
-
onCompositionstart: x[1] || (x[1] = (
|
|
1224
|
-
onCompositionend:
|
|
1225
|
-
onFocus:
|
|
1226
|
-
onBlur:
|
|
1247
|
+
onKeydown: C(Be),
|
|
1248
|
+
onCompositionstart: x[1] || (x[1] = (D) => A.value = !0),
|
|
1249
|
+
onCompositionend: T,
|
|
1250
|
+
onFocus: Le,
|
|
1251
|
+
onBlur: De
|
|
1227
1252
|
}, null, 8, ["autosize", "type", "modelValue", "disabled", "placeholder", "autofocus", "onKeydown"]),
|
|
1228
|
-
C(
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
C(
|
|
1232
|
-
])) :
|
|
1253
|
+
C(E) && !C(A) ? (w(), O("div", Qt, [
|
|
1254
|
+
z("span", Yt, ce(C(y)), 1),
|
|
1255
|
+
je(ce(C(E)) + " ", 1),
|
|
1256
|
+
C(q) ? (w(), O("div", en, "TAB")) : U("", !0)
|
|
1257
|
+
])) : U("", !0)
|
|
1233
1258
|
]))
|
|
1234
1259
|
]),
|
|
1235
|
-
|
|
1236
|
-
|
|
1260
|
+
K.value === "single" ? (w(), O("div", tn, [
|
|
1261
|
+
z("div", {
|
|
1237
1262
|
class: "tiny-sender__buttons-container",
|
|
1238
1263
|
ref_key: "buttonsContainerRef",
|
|
1239
|
-
ref:
|
|
1264
|
+
ref: d
|
|
1240
1265
|
}, [
|
|
1241
|
-
|
|
1242
|
-
|
|
1266
|
+
ue(n.$slots, "actions"),
|
|
1267
|
+
X(Je, {
|
|
1243
1268
|
"allow-speech": n.allowSpeech,
|
|
1244
1269
|
"allow-files": n.allowFiles,
|
|
1245
1270
|
loading: n.loading,
|
|
1246
|
-
disabled:
|
|
1271
|
+
disabled: r.value,
|
|
1247
1272
|
"show-clear": n.clearable,
|
|
1248
|
-
"has-content":
|
|
1249
|
-
"speech-status": C(
|
|
1273
|
+
"has-content": P.value,
|
|
1274
|
+
"speech-status": C(ae),
|
|
1250
1275
|
"button-group": n.buttonGroup,
|
|
1251
1276
|
"submit-type": n.submitType,
|
|
1252
|
-
"is-over-limit":
|
|
1277
|
+
"is-over-limit": ee.value,
|
|
1253
1278
|
"stop-text": n.stopText,
|
|
1254
|
-
onClear:
|
|
1255
|
-
onToggleSpeech:
|
|
1256
|
-
onSubmit: C(
|
|
1257
|
-
onCancel: x[2] || (x[2] = (
|
|
1258
|
-
onTriggerSelect: C(
|
|
1279
|
+
onClear: ve,
|
|
1280
|
+
onToggleSpeech: xe,
|
|
1281
|
+
onSubmit: C(re),
|
|
1282
|
+
onCancel: x[2] || (x[2] = (D) => n.$emit("cancel")),
|
|
1283
|
+
onTriggerSelect: C(le)
|
|
1259
1284
|
}, null, 8, ["allow-speech", "allow-files", "loading", "disabled", "show-clear", "has-content", "speech-status", "button-group", "submit-type", "is-over-limit", "stop-text", "onSubmit", "onTriggerSelect"])
|
|
1260
1285
|
], 512)
|
|
1261
|
-
])) :
|
|
1286
|
+
])) : U("", !0)
|
|
1262
1287
|
], 2),
|
|
1263
|
-
|
|
1264
|
-
default:
|
|
1265
|
-
|
|
1288
|
+
X(We, { name: "tiny-sender-slide-up" }, {
|
|
1289
|
+
default: de(() => [
|
|
1290
|
+
K.value === "multiple" ? (w(), O("div", {
|
|
1266
1291
|
key: 0,
|
|
1267
|
-
style:
|
|
1292
|
+
style: Fe(e.value),
|
|
1268
1293
|
class: "tiny-sender__footer-slot tiny-sender__bottom-row"
|
|
1269
1294
|
}, [
|
|
1270
|
-
|
|
1271
|
-
|
|
1295
|
+
z("div", nn, [
|
|
1296
|
+
ue(n.$slots, "footer-left")
|
|
1272
1297
|
]),
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
n.showWordLimit && n.maxLength !== 1 / 0 ? (
|
|
1298
|
+
z("div", on, [
|
|
1299
|
+
ue(n.$slots, "footer-right"),
|
|
1300
|
+
n.showWordLimit && n.maxLength !== 1 / 0 ? (w(), O("div", {
|
|
1276
1301
|
key: 0,
|
|
1277
|
-
class:
|
|
1302
|
+
class: oe(["tiny-sender__word-limit", { "is-over-limit": ee.value }])
|
|
1278
1303
|
}, [
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
], 2)) :
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1304
|
+
z("span", sn, ce(C(y).length), 1),
|
|
1305
|
+
je("/" + ce(n.maxLength), 1)
|
|
1306
|
+
], 2)) : U("", !0),
|
|
1307
|
+
K.value === "multiple" ? (w(), O("div", an, [
|
|
1308
|
+
z("div", ln, [
|
|
1309
|
+
X(Je, {
|
|
1285
1310
|
"allow-speech": n.allowSpeech,
|
|
1286
1311
|
"allow-files": n.allowFiles,
|
|
1287
1312
|
loading: n.loading,
|
|
1288
|
-
disabled:
|
|
1313
|
+
disabled: r.value,
|
|
1289
1314
|
"show-clear": n.clearable,
|
|
1290
|
-
"has-content":
|
|
1291
|
-
"speech-status": C(
|
|
1315
|
+
"has-content": P.value,
|
|
1316
|
+
"speech-status": C(ae),
|
|
1292
1317
|
"button-group": n.buttonGroup,
|
|
1293
1318
|
"submit-type": n.submitType,
|
|
1294
|
-
"is-over-limit":
|
|
1319
|
+
"is-over-limit": ee.value,
|
|
1295
1320
|
"stop-text": n.stopText,
|
|
1296
|
-
onClear:
|
|
1297
|
-
onToggleSpeech:
|
|
1298
|
-
onSubmit: C(
|
|
1299
|
-
onCancel: x[3] || (x[3] = (
|
|
1300
|
-
onTriggerSelect: C(
|
|
1321
|
+
onClear: ve,
|
|
1322
|
+
onToggleSpeech: xe,
|
|
1323
|
+
onSubmit: C(re),
|
|
1324
|
+
onCancel: x[3] || (x[3] = (D) => n.$emit("cancel")),
|
|
1325
|
+
onTriggerSelect: C(le)
|
|
1301
1326
|
}, null, 8, ["allow-speech", "allow-files", "loading", "disabled", "show-clear", "has-content", "speech-status", "button-group", "submit-type", "is-over-limit", "stop-text", "onSubmit", "onTriggerSelect"])
|
|
1302
1327
|
])
|
|
1303
|
-
])) :
|
|
1328
|
+
])) : U("", !0)
|
|
1304
1329
|
])
|
|
1305
|
-
], 4)) : n.$slots.footer ? (
|
|
1306
|
-
|
|
1307
|
-
])) :
|
|
1330
|
+
], 4)) : n.$slots.footer ? (w(), O("div", rn, [
|
|
1331
|
+
ue(n.$slots, "footer")
|
|
1332
|
+
])) : U("", !0)
|
|
1308
1333
|
]),
|
|
1309
1334
|
_: 3
|
|
1310
1335
|
})
|
|
1311
1336
|
], 512)
|
|
1312
1337
|
]),
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
"
|
|
1319
|
-
"
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
}, null, 8, ["show", "suggestions", "popup-style", "is-item-highlighted", "highlight-suggestion-text", "input-value", "onItemHover", "onItemLeave", "onSelect"])
|
|
1326
|
-
], 10, Mt));
|
|
1338
|
+
X(Ut, {
|
|
1339
|
+
show: C(k),
|
|
1340
|
+
suggestions: n.suggestions,
|
|
1341
|
+
"popup-style": I.value,
|
|
1342
|
+
"active-keyboard-index": C(R),
|
|
1343
|
+
"active-mouse-index": C(b),
|
|
1344
|
+
"input-value": C(y),
|
|
1345
|
+
onSelect: C(N),
|
|
1346
|
+
onMouseEnter: C(j),
|
|
1347
|
+
onMouseLeave: C(pe)
|
|
1348
|
+
}, null, 8, ["show", "suggestions", "popup-style", "active-keyboard-index", "active-mouse-index", "input-value", "onSelect", "onMouseEnter", "onMouseLeave"])
|
|
1349
|
+
], 10, qt));
|
|
1327
1350
|
}
|
|
1328
1351
|
});
|
|
1329
|
-
|
|
1330
|
-
const
|
|
1331
|
-
|
|
1352
|
+
Oe.name = "TrSender";
|
|
1353
|
+
const un = function(s) {
|
|
1354
|
+
s.component(Oe.name, Oe);
|
|
1332
1355
|
};
|
|
1333
|
-
|
|
1356
|
+
Oe.install = un;
|
|
1334
1357
|
export {
|
|
1335
|
-
|
|
1358
|
+
Oe as default
|
|
1336
1359
|
};
|