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