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