@mobilon-dev/chotto 0.3.116 → 0.3.118
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/chotto.css +1 -1
- package/dist/components/1_icons/VerifiedBadge.vue.js +31 -0
- package/dist/components/2_blocks/CommunicationPanel/composables/useCommunicationRecentSelection.js +12 -15
- package/dist/components/2_chatlist_elements/ChatItem/ChatItem.vue.js +2 -2
- package/dist/components/2_chatlist_elements/ChatItem/ChatItem.vue2.js +197 -187
- package/dist/components/2_elements/ChatInfo/ChatInfo.vue.js +43 -40
- package/dist/components/3_compounds/ChatInput/ChatInput.vue.js +1 -1
- package/dist/components/3_compounds/ChatInput/ChatInput.vue2.js +243 -232
- package/dist/index.js +325 -323
- package/dist/themes/dark.css +1 -1
- package/dist/themes/default.css +1 -1
- package/dist/themes/glass.css +1 -1
- package/dist/themes/green.css +1 -1
- package/dist/themes/mobilon1.css +1 -1
- package/dist/types/src/components/1_icons/VerifiedBadge.vue.d.ts +2 -0
- package/dist/types/src/components/2_chatlist_elements/ChatItem/ChatItem.vue.d.ts +11 -1
- package/dist/types/src/components/2_chatlist_elements/ChatItem/stories/ChatItem.stories.d.ts +1 -0
- package/dist/types/src/components/2_chatlist_elements/ChatItem/styles/types.d.ts +35 -3
- package/dist/types/src/components/2_chatlist_elements/ChatItem/types.d.ts +2 -0
- package/dist/types/src/components/2_elements/ChatInfo/ChatInfo.vue.d.ts +2 -0
- package/dist/types/src/components/2_elements/ChatInfo/stories/ChatInfo.stories.d.ts +2 -0
- package/dist/types/src/components/2_elements/ChatInfo/styles/types.d.ts +20 -0
- package/dist/types/src/components/3_compounds/ChatInput/styles/types.d.ts +32 -0
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/test-utils/withSetup.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,29 +1,33 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useImmediateDebouncedRef as
|
|
3
|
-
import { MAX_ATTACHED_FILES as
|
|
4
|
-
import { useEmojiNative as
|
|
1
|
+
import { defineComponent as Ge, inject as Oe, watch as p, ref as b, computed as v, provide as Ue, nextTick as F, unref as r, onMounted as Ve, onUnmounted as Ye, createElementBlock as g, openBlock as h, normalizeClass as q, toDisplayString as N, Fragment as ie, createElementVNode as f, createVNode as z, createCommentVNode as V, renderList as Xe, createBlock as Je, renderSlot as oe, withDirectives as Qe, withKeys as Ze, vModelText as et } from "vue";
|
|
2
|
+
import { useImmediateDebouncedRef as tt } from "../../../hooks/useImmediateDebouncedRef.js";
|
|
3
|
+
import { MAX_ATTACHED_FILES as se, resolveMessageDraftStore as nt, useMessageDraft as lt, getDraftFiles as it } from "../../../hooks/useMessageDraft.js";
|
|
4
|
+
import { useEmojiNative as ot } from "../../../hooks/useEmojiNative.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
/* empty css */
|
|
7
|
-
import { t as
|
|
7
|
+
import { t as m } from "../../../locale/useLocale.js";
|
|
8
8
|
/* empty css */
|
|
9
9
|
import "../../../node_modules/linkifyjs/dist/linkify.js";
|
|
10
10
|
import "../../../node_modules/linkify-string/dist/linkify-string.js";
|
|
11
11
|
import "../../../functions/parseMarkdown.js";
|
|
12
|
-
import { textToAppleEmojiHtml as
|
|
13
|
-
import { useStartEdit as
|
|
14
|
-
import { canStartEditLastSent as ut, isEditableLastSentCandidate as
|
|
15
|
-
import { buildEditPayload as
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
const
|
|
12
|
+
import { textToAppleEmojiHtml as st, textContainsEmoji as at, previousGraphemeIndex as ae, nextGraphemeIndex as re, snapIndexToGrapheme as ce } from "../../../functions/renderAppleEmojis.js";
|
|
13
|
+
import { useStartEdit as rt, hideEditPreview as ct } from "../../../hooks/messages/useStartEdit.js";
|
|
14
|
+
import { canStartEditLastSent as ut, isEditableLastSentCandidate as dt } from "../../../hooks/messages/canStartEditLastSent.js";
|
|
15
|
+
import { buildEditPayload as ft } from "../../../hooks/messages/buildEditPayload.js";
|
|
16
|
+
import pt from "./icons/SendIcon.vue.js";
|
|
17
|
+
import ue from "./icons/ArrowIcon.vue.js";
|
|
18
|
+
import ht from "../../2_chatinput_elements/TextFormatToolbar/TextFormatToolbar.vue.js";
|
|
19
|
+
import mt from "../../2_chatinput_elements/FilePreview/FilePreview.vue.js";
|
|
20
|
+
const vt = {
|
|
21
|
+
key: 0,
|
|
22
|
+
class: "chat-input__disabled-placeholder",
|
|
23
|
+
"data-testid": "chat-input-disabled-placeholder"
|
|
24
|
+
}, gt = ["id"], yt = ["id"], St = { class: "chat-input__file-counter" }, _t = { class: "chat-input__file-chips-wrap" }, xt = ["aria-label"], bt = ["aria-label"], It = { class: "chat-input__inline-buttons" }, Ct = {
|
|
21
25
|
key: 0,
|
|
22
26
|
class: "chat-input__input chat-input__disabled-placeholder"
|
|
23
|
-
},
|
|
27
|
+
}, Ft = {
|
|
24
28
|
key: 1,
|
|
25
29
|
class: "chat-input__input-wrap"
|
|
26
|
-
},
|
|
30
|
+
}, Tt = ["innerHTML"], Et = ["disabled", "placeholder"], At = ["disabled"], wt = { class: "" }, Mt = { class: "chat-input__third-line" }, Y = 40, Jt = /* @__PURE__ */ Ge({
|
|
27
31
|
__name: "ChatInput",
|
|
28
32
|
props: {
|
|
29
33
|
state: {
|
|
@@ -53,7 +57,7 @@ const mt = { class: "chat-input__container" }, vt = ["id"], gt = ["id"], yt = {
|
|
|
53
57
|
maxAttachedFiles: {
|
|
54
58
|
type: Number,
|
|
55
59
|
required: !1,
|
|
56
|
-
default:
|
|
60
|
+
default: se
|
|
57
61
|
},
|
|
58
62
|
resolveEditLastSentMessage: {
|
|
59
63
|
type: Function,
|
|
@@ -62,8 +66,8 @@ const mt = { class: "chat-input__container" }, vt = ["id"], gt = ["id"], yt = {
|
|
|
62
66
|
}
|
|
63
67
|
},
|
|
64
68
|
emits: ["send", "typing"],
|
|
65
|
-
setup(M, { emit:
|
|
66
|
-
const D =
|
|
69
|
+
setup(M, { emit: de }) {
|
|
70
|
+
const D = de, I = Oe("chatAppId"), fe = nt(I), { resetMessage: pe, getMessage: o, setMessageText: H, setForceSendMessage: he, resetEdit: me, removeMessageFile: ve } = lt(I), { startEdit: ge } = rt(I), { isNative: ye, emojiSrc: Se } = ot(I);
|
|
67
71
|
let X = o().id;
|
|
68
72
|
p(
|
|
69
73
|
() => o().id,
|
|
@@ -71,19 +75,19 @@ const mt = { class: "chat-input__container" }, vt = ["id"], gt = ["id"], yt = {
|
|
|
71
75
|
X = e;
|
|
72
76
|
}
|
|
73
77
|
);
|
|
74
|
-
const l =
|
|
75
|
-
let
|
|
76
|
-
const
|
|
78
|
+
const l = b(), T = b(), L = b(), E = b(null), R = b(!1), _e = tt("", 2e3), B = b(!1), j = b(!1);
|
|
79
|
+
let y = null;
|
|
80
|
+
const S = v(() => it(o()));
|
|
77
81
|
function K() {
|
|
78
82
|
const e = L.value;
|
|
79
83
|
if (!e) {
|
|
80
|
-
|
|
84
|
+
B.value = !1, j.value = !1;
|
|
81
85
|
return;
|
|
82
86
|
}
|
|
83
87
|
const t = e.scrollWidth - e.clientWidth;
|
|
84
|
-
|
|
88
|
+
B.value = e.scrollLeft > 1, j.value = t - e.scrollLeft > 1;
|
|
85
89
|
}
|
|
86
|
-
function
|
|
90
|
+
function xe(e) {
|
|
87
91
|
const t = e.firstElementChild;
|
|
88
92
|
if (!t) return e.clientWidth;
|
|
89
93
|
const n = parseFloat(getComputedStyle(e).gap) || 8;
|
|
@@ -92,15 +96,15 @@ const mt = { class: "chat-input__container" }, vt = ["id"], gt = ["id"], yt = {
|
|
|
92
96
|
function J(e) {
|
|
93
97
|
const t = L.value;
|
|
94
98
|
if (!t) return;
|
|
95
|
-
const n =
|
|
99
|
+
const n = xe(t);
|
|
96
100
|
t.scrollBy({ left: e === "right" ? n : -n, behavior: "smooth" });
|
|
97
101
|
}
|
|
98
102
|
function Q() {
|
|
99
|
-
|
|
103
|
+
y == null || y.disconnect();
|
|
100
104
|
const e = L.value;
|
|
101
|
-
e && (
|
|
105
|
+
e && (y = new ResizeObserver(() => K()), y.observe(e));
|
|
102
106
|
}
|
|
103
|
-
function
|
|
107
|
+
function be(e) {
|
|
104
108
|
return e.preview ?? {
|
|
105
109
|
isImage: !1,
|
|
106
110
|
isVideo: !1,
|
|
@@ -109,30 +113,30 @@ const mt = { class: "chat-input__container" }, vt = ["id"], gt = ["id"], yt = {
|
|
|
109
113
|
fileSize: ""
|
|
110
114
|
};
|
|
111
115
|
}
|
|
112
|
-
const
|
|
113
|
-
() =>
|
|
114
|
-
), A =
|
|
115
|
-
() => !
|
|
116
|
-
),
|
|
116
|
+
const Ie = v(
|
|
117
|
+
() => st(o().text || "", E.value, Se.value)
|
|
118
|
+
), A = v(
|
|
119
|
+
() => !ye.value && at(o().text || "")
|
|
120
|
+
), _ = () => {
|
|
117
121
|
if (!T.value || !l.value) return;
|
|
118
122
|
const e = l.value, t = T.value, n = Math.max(0, e.offsetWidth - e.clientWidth);
|
|
119
123
|
t.style.right = n > 0 ? `${n}px` : "", t.scrollTop = e.scrollTop;
|
|
120
124
|
};
|
|
121
125
|
let w = 0;
|
|
122
|
-
function
|
|
126
|
+
function $() {
|
|
123
127
|
E.value = null;
|
|
124
128
|
}
|
|
125
|
-
function
|
|
129
|
+
function Ce(e = "nearest") {
|
|
126
130
|
const t = l.value;
|
|
127
131
|
if (!t || !A.value) return;
|
|
128
|
-
const n = t.value, i =
|
|
129
|
-
(i !== t.selectionStart ||
|
|
132
|
+
const n = t.value, i = ce(n, t.selectionStart, e), a = ce(n, t.selectionEnd, e);
|
|
133
|
+
(i !== t.selectionStart || a !== t.selectionEnd) && t.setSelectionRange(i, a);
|
|
130
134
|
}
|
|
131
|
-
function
|
|
132
|
-
|
|
135
|
+
function G() {
|
|
136
|
+
Ce("nearest"), C();
|
|
133
137
|
}
|
|
134
|
-
function
|
|
135
|
-
var
|
|
138
|
+
function Fe(e) {
|
|
139
|
+
var a, c, u;
|
|
136
140
|
const t = o(), n = l.value;
|
|
137
141
|
if (!ut({
|
|
138
142
|
key: e.key,
|
|
@@ -140,99 +144,101 @@ const mt = { class: "chat-input__container" }, vt = ["id"], gt = ["id"], yt = {
|
|
|
140
144
|
metaKey: e.metaKey,
|
|
141
145
|
ctrlKey: e.ctrlKey,
|
|
142
146
|
shiftKey: e.shiftKey,
|
|
143
|
-
hasResolver: typeof
|
|
144
|
-
disabled:
|
|
147
|
+
hasResolver: typeof s.resolveEditLastSentMessage == "function",
|
|
148
|
+
disabled: s.state === "disabled",
|
|
145
149
|
isRecording: t.isRecording,
|
|
146
150
|
draftText: t.text ?? "",
|
|
147
|
-
replyMessageId: (
|
|
148
|
-
editMessageId: (
|
|
151
|
+
replyMessageId: (a = t.reply) == null ? void 0 : a.messageId,
|
|
152
|
+
editMessageId: (c = t.edit) == null ? void 0 : c.messageId,
|
|
149
153
|
textareaText: (n == null ? void 0 : n.value) ?? t.text ?? "",
|
|
150
154
|
selectionStart: (n == null ? void 0 : n.selectionStart) ?? 0
|
|
151
155
|
})) return !1;
|
|
152
|
-
const i = (
|
|
153
|
-
return
|
|
156
|
+
const i = (u = s.resolveEditLastSentMessage) == null ? void 0 : u.call(s);
|
|
157
|
+
return dt(i) ? (e.preventDefault(), ge(ft(i)), !0) : !1;
|
|
154
158
|
}
|
|
155
|
-
function
|
|
156
|
-
if (
|
|
159
|
+
function Te(e) {
|
|
160
|
+
if (Fe(e) || !A.value || e.key !== "ArrowLeft" && e.key !== "ArrowRight" || e.altKey || e.metaKey || e.ctrlKey) return;
|
|
157
161
|
const t = l.value;
|
|
158
162
|
if (!t) return;
|
|
159
163
|
const n = t.value, i = t.selectionStart !== t.selectionEnd;
|
|
160
164
|
if (e.shiftKey) {
|
|
161
|
-
requestAnimationFrame(() =>
|
|
165
|
+
requestAnimationFrame(() => G());
|
|
162
166
|
return;
|
|
163
167
|
}
|
|
164
168
|
if (i) {
|
|
165
169
|
e.preventDefault();
|
|
166
|
-
const
|
|
167
|
-
t.setSelectionRange(
|
|
170
|
+
const u = e.key === "ArrowLeft" ? t.selectionStart : t.selectionEnd, x = e.key === "ArrowLeft" ? ae(n, u) : re(n, u);
|
|
171
|
+
t.setSelectionRange(x, x), C();
|
|
168
172
|
return;
|
|
169
173
|
}
|
|
170
174
|
e.preventDefault();
|
|
171
|
-
const
|
|
172
|
-
t.setSelectionRange(
|
|
175
|
+
const a = t.selectionStart, c = e.key === "ArrowLeft" ? ae(n, a) : re(n, a);
|
|
176
|
+
t.setSelectionRange(c, c), C();
|
|
173
177
|
}
|
|
174
|
-
function
|
|
178
|
+
function C() {
|
|
175
179
|
if (!A.value) {
|
|
176
|
-
|
|
180
|
+
$();
|
|
177
181
|
return;
|
|
178
182
|
}
|
|
179
183
|
w && cancelAnimationFrame(w), w = requestAnimationFrame(() => {
|
|
180
|
-
var
|
|
184
|
+
var c;
|
|
181
185
|
w = 0;
|
|
182
186
|
const e = l.value;
|
|
183
187
|
if (!e) {
|
|
184
|
-
|
|
188
|
+
$();
|
|
185
189
|
return;
|
|
186
190
|
}
|
|
187
191
|
const t = e.selectionStart, n = e.selectionEnd;
|
|
188
192
|
if (t === n) {
|
|
189
|
-
E.value !== null && (E.value = null,
|
|
193
|
+
E.value !== null && (E.value = null, F(_));
|
|
190
194
|
return;
|
|
191
195
|
}
|
|
192
196
|
const i = E.value;
|
|
193
197
|
if (i && i.start === t && i.end === n) return;
|
|
194
|
-
const
|
|
195
|
-
E.value = { start: t, end: n },
|
|
196
|
-
T.value && (T.value.scrollTop =
|
|
198
|
+
const a = ((c = T.value) == null ? void 0 : c.scrollTop) ?? 0;
|
|
199
|
+
E.value = { start: t, end: n }, F(() => {
|
|
200
|
+
T.value && (T.value.scrollTop = a), _();
|
|
197
201
|
});
|
|
198
202
|
});
|
|
199
203
|
}
|
|
200
|
-
function
|
|
201
|
-
e.buttons &&
|
|
204
|
+
function Ee(e) {
|
|
205
|
+
e.buttons && C();
|
|
202
206
|
}
|
|
203
207
|
function Z() {
|
|
204
|
-
document.activeElement === l.value &&
|
|
208
|
+
document.activeElement === l.value && C();
|
|
205
209
|
}
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
210
|
+
const s = M, ee = v(
|
|
211
|
+
() => s.state === "disabled" && !!s.disabledPlaceholder
|
|
212
|
+
), te = v(() => {
|
|
213
|
+
const e = Number(s.maxAttachedFiles);
|
|
214
|
+
return Number.isFinite(e) && e > 0 ? Math.floor(e) : se;
|
|
209
215
|
});
|
|
210
|
-
|
|
211
|
-
const
|
|
212
|
-
() =>
|
|
213
|
-
),
|
|
216
|
+
Ue("maxAttachedFiles", te);
|
|
217
|
+
const Ae = v(
|
|
218
|
+
() => m("component.ChatInput.FilesSelectedCount").replace("{count}", String(S.value.length)).replace("{max}", String(te.value))
|
|
219
|
+
), we = v(() => !!(s.state == "disabled" || o().text == "" && !S.value.length || o().isRecording)), Me = v(() => {
|
|
214
220
|
var t;
|
|
215
|
-
if (
|
|
216
|
-
return
|
|
217
|
-
if (!((t =
|
|
221
|
+
if (s.inputButtonColor)
|
|
222
|
+
return s.inputButtonColor;
|
|
223
|
+
if (!((t = s.selectedChannel) != null && t.channelId))
|
|
218
224
|
return "#25D366";
|
|
219
|
-
const e =
|
|
225
|
+
const e = s.selectedChannel.channelId.toLowerCase();
|
|
220
226
|
return e.includes("whatsapp") || e.includes("waba") ? "#25D366" : e.includes("telegram") ? "#37AFE2" : e.includes("sms") ? "#6C757D" : e.includes("max") ? "#4B0082" : "#25D366";
|
|
221
|
-
}),
|
|
227
|
+
}), Le = v(() => {
|
|
222
228
|
var t;
|
|
223
|
-
if (!((t =
|
|
224
|
-
return
|
|
225
|
-
const e =
|
|
226
|
-
return e.includes("whatsapp") || e.includes("waba") ?
|
|
229
|
+
if (!((t = s.selectedChannel) != null && t.channelId))
|
|
230
|
+
return m("component.ChatInput.InputPlaceholder");
|
|
231
|
+
const e = s.selectedChannel.channelId.toLowerCase();
|
|
232
|
+
return e.includes("whatsapp") || e.includes("waba") ? m("component.ChatInput.WhatsappInputPlaceholder") : e.includes("telegram") ? m("component.ChatInput.TelegramInputPlaceholder") : e.includes("sms") ? m("component.ChatInput.SmsInputPlaceholder") : e.includes("max") ? m("component.ChatInput.MaxInputPlaceholder") : m("component.ChatInput.InputPlaceholder");
|
|
227
233
|
});
|
|
228
234
|
p(
|
|
229
|
-
() =>
|
|
235
|
+
() => _e.value,
|
|
230
236
|
() => {
|
|
231
237
|
D("typing");
|
|
232
238
|
}
|
|
233
239
|
);
|
|
234
|
-
function
|
|
235
|
-
|
|
240
|
+
function ne(e = !1) {
|
|
241
|
+
F(() => {
|
|
236
242
|
if (e && !R.value) return;
|
|
237
243
|
const t = l.value;
|
|
238
244
|
t && (k(t), e && (R.value = !1), P(t), requestAnimationFrame(() => P(t)));
|
|
@@ -241,17 +247,17 @@ const mt = { class: "chat-input__container" }, vt = ["id"], gt = ["id"], yt = {
|
|
|
241
247
|
p(
|
|
242
248
|
() => o().edit,
|
|
243
249
|
(e) => {
|
|
244
|
-
(e == null ? void 0 : e.messageId) != null && (R.value = !0,
|
|
250
|
+
(e == null ? void 0 : e.messageId) != null && (R.value = !0, ne(!0));
|
|
245
251
|
}
|
|
246
252
|
), p(
|
|
247
253
|
() => o().reply,
|
|
248
254
|
(e) => {
|
|
249
|
-
(e == null ? void 0 : e.messageId) != null &&
|
|
255
|
+
(e == null ? void 0 : e.messageId) != null && ne();
|
|
250
256
|
}
|
|
251
257
|
), p(
|
|
252
|
-
() =>
|
|
258
|
+
() => s.focusOnInputArea,
|
|
253
259
|
() => {
|
|
254
|
-
|
|
260
|
+
s.focusOnInputArea && F(() => {
|
|
255
261
|
const e = r(l);
|
|
256
262
|
e == null || e.focus();
|
|
257
263
|
});
|
|
@@ -274,18 +280,18 @@ const mt = { class: "chat-input__container" }, vt = ["id"], gt = ["id"], yt = {
|
|
|
274
280
|
}));
|
|
275
281
|
}
|
|
276
282
|
), p(A, (e) => {
|
|
277
|
-
e &&
|
|
283
|
+
e && F(() => {
|
|
278
284
|
const t = l.value;
|
|
279
285
|
if (!t) return;
|
|
280
286
|
const n = t.scrollTop;
|
|
281
|
-
k(t), t.scrollTop = n,
|
|
287
|
+
k(t), t.scrollTop = n, _(), requestAnimationFrame(_);
|
|
282
288
|
});
|
|
283
289
|
});
|
|
284
290
|
function W(e) {
|
|
285
291
|
const t = o().inputHeight;
|
|
286
292
|
e.style.height = (t || Y) + "px", (!t || t <= Y) && (e.style.overflowY = "hidden");
|
|
287
293
|
}
|
|
288
|
-
function
|
|
294
|
+
function Re(e) {
|
|
289
295
|
const t = parseFloat(e.style.height);
|
|
290
296
|
Number.isFinite(t) && (o().inputHeight = t);
|
|
291
297
|
}
|
|
@@ -297,50 +303,50 @@ const mt = { class: "chat-input__container" }, vt = ["id"], gt = ["id"], yt = {
|
|
|
297
303
|
}
|
|
298
304
|
const n = e.scrollTop;
|
|
299
305
|
e.style.height = "auto";
|
|
300
|
-
const i = getComputedStyle(e),
|
|
306
|
+
const i = getComputedStyle(e), a = parseFloat(i.fontSize) || 16, c = parseFloat(i.lineHeight) || a * 1.4, u = Y, x = c * 11, U = e.scrollHeight, qe = t.split(`
|
|
301
307
|
`).length > 1, d = document.createElement("div");
|
|
302
308
|
d.style.position = "absolute", d.style.visibility = "hidden", d.style.whiteSpace = "nowrap", d.style.font = i.font, d.style.fontSize = i.fontSize, d.style.fontFamily = i.fontFamily, d.style.fontWeight = i.fontWeight, d.style.letterSpacing = i.letterSpacing, d.textContent = t, document.body.appendChild(d);
|
|
303
|
-
const
|
|
309
|
+
const Ne = d.offsetWidth;
|
|
304
310
|
document.body.removeChild(d);
|
|
305
|
-
const
|
|
306
|
-
if (
|
|
311
|
+
const ze = parseFloat(i.paddingLeft) || 0, Be = parseFloat(i.paddingRight) || 0, je = e.clientWidth - ze - Be, $e = Ne > je, le = qe || $e;
|
|
312
|
+
if (le && U <= u + 1) {
|
|
307
313
|
W(e);
|
|
308
314
|
return;
|
|
309
315
|
}
|
|
310
|
-
t.trim() &&
|
|
316
|
+
t.trim() && le ? U <= x ? (e.style.height = U + "px", e.style.overflowY = "hidden") : (e.style.height = x + "px", e.style.overflowY = "auto", e.scrollTop = n) : (e.style.height = u + "px", e.style.overflowY = "hidden"), Re(e), _(), requestAnimationFrame(_);
|
|
311
317
|
}
|
|
312
318
|
function P(e) {
|
|
313
|
-
if (
|
|
319
|
+
if (s.state === "disabled" || o().isRecording) return;
|
|
314
320
|
const t = e.value.length;
|
|
315
|
-
e.focus(), e.setSelectionRange(t, t), e.scrollTop = e.scrollHeight,
|
|
321
|
+
e.focus(), e.setSelectionRange(t, t), e.scrollTop = e.scrollHeight, _();
|
|
316
322
|
}
|
|
317
323
|
p(
|
|
318
324
|
() => o().forceSend,
|
|
319
325
|
() => {
|
|
320
|
-
o().forceSend && (
|
|
326
|
+
o().forceSend && (O(), he(!1));
|
|
321
327
|
}
|
|
322
328
|
);
|
|
323
|
-
const
|
|
329
|
+
const ke = (e) => {
|
|
324
330
|
const t = e.target;
|
|
325
|
-
D("typing", t.value),
|
|
331
|
+
D("typing", t.value), C();
|
|
326
332
|
};
|
|
327
333
|
p(
|
|
328
|
-
|
|
334
|
+
S,
|
|
329
335
|
(e, t) => {
|
|
330
|
-
|
|
336
|
+
F(() => {
|
|
331
337
|
Q(), K();
|
|
332
338
|
const n = L.value;
|
|
333
339
|
n && e.length > ((t == null ? void 0 : t.length) ?? 0) && n.scrollTo({ left: n.scrollWidth, behavior: "smooth" });
|
|
334
340
|
});
|
|
335
341
|
},
|
|
336
342
|
{ flush: "post" }
|
|
337
|
-
),
|
|
343
|
+
), Ve(() => {
|
|
338
344
|
const e = l.value;
|
|
339
345
|
e && (W(e), k(e)), Q(), K(), document.addEventListener("selectionchange", Z);
|
|
340
|
-
}),
|
|
341
|
-
|
|
346
|
+
}), Ye(() => {
|
|
347
|
+
fe.commitChatDraftToList(X), document.removeEventListener("selectionchange", Z), y == null || y.disconnect(), w && cancelAnimationFrame(w);
|
|
342
348
|
});
|
|
343
|
-
const
|
|
349
|
+
const De = (e) => {
|
|
344
350
|
if (e.shiftKey) {
|
|
345
351
|
if (l.value instanceof HTMLTextAreaElement) {
|
|
346
352
|
let t = l.value.selectionStart;
|
|
@@ -356,34 +362,34 @@ const mt = { class: "chat-input__container" }, vt = ["id"], gt = ["id"], yt = {
|
|
|
356
362
|
}
|
|
357
363
|
e.preventDefault();
|
|
358
364
|
} else
|
|
359
|
-
e.preventDefault(),
|
|
360
|
-
},
|
|
365
|
+
e.preventDefault(), O();
|
|
366
|
+
}, He = (e) => {
|
|
361
367
|
if (l.value) {
|
|
362
368
|
const t = l.value.value;
|
|
363
369
|
l.value.value = e.newText;
|
|
364
370
|
const n = e.newText.length - (t.length - (e.end - e.start)), i = e.start + n;
|
|
365
|
-
H(e.newText),
|
|
371
|
+
H(e.newText), F(() => {
|
|
366
372
|
l.value && (l.value.setSelectionRange(i, i), l.value.focus());
|
|
367
373
|
});
|
|
368
374
|
}
|
|
369
375
|
};
|
|
370
|
-
function
|
|
371
|
-
|
|
376
|
+
function Ke(e) {
|
|
377
|
+
ve(e);
|
|
372
378
|
}
|
|
373
|
-
function
|
|
374
|
-
|
|
379
|
+
function We() {
|
|
380
|
+
me(), H(""), ct(I), l.value && l.value.focus();
|
|
375
381
|
}
|
|
376
|
-
function
|
|
382
|
+
function Pe() {
|
|
377
383
|
const e = o();
|
|
378
384
|
return e.edit ? (e.text ?? "").trim() === (e.edit.text ?? "").trim() : !1;
|
|
379
385
|
}
|
|
380
|
-
const
|
|
381
|
-
const e =
|
|
382
|
-
if (e.value.edit &&
|
|
383
|
-
|
|
386
|
+
const O = () => {
|
|
387
|
+
const e = b(o());
|
|
388
|
+
if (e.value.edit && Pe() && !S.value.length) {
|
|
389
|
+
We();
|
|
384
390
|
return;
|
|
385
391
|
}
|
|
386
|
-
if (e.value.text != "" ||
|
|
392
|
+
if (e.value.text != "" || S.value.length) {
|
|
387
393
|
const t = {
|
|
388
394
|
type: "",
|
|
389
395
|
text: "",
|
|
@@ -391,129 +397,134 @@ const mt = { class: "chat-input__container" }, vt = ["id"], gt = ["id"], yt = {
|
|
|
391
397
|
filename: "",
|
|
392
398
|
size: "",
|
|
393
399
|
reply: void 0
|
|
394
|
-
}, n =
|
|
400
|
+
}, n = S.value;
|
|
395
401
|
if (n.length) {
|
|
396
402
|
const i = e.value.text.trim();
|
|
397
|
-
n.forEach((
|
|
398
|
-
var
|
|
399
|
-
const
|
|
400
|
-
type: "message." +
|
|
401
|
-
url:
|
|
402
|
-
filename:
|
|
403
|
-
size: (
|
|
404
|
-
text:
|
|
403
|
+
n.forEach((a, c) => {
|
|
404
|
+
var x;
|
|
405
|
+
const u = {
|
|
406
|
+
type: "message." + a.type,
|
|
407
|
+
url: a.url,
|
|
408
|
+
filename: a.name,
|
|
409
|
+
size: (x = a.size) == null ? void 0 : x.toString(),
|
|
410
|
+
text: c === 0 ? i : ""
|
|
405
411
|
};
|
|
406
|
-
|
|
412
|
+
c === 0 && (e.value.reply && (u.reply = e.value.reply), e.value.edit && (u.edit = e.value.edit)), D("send", u);
|
|
407
413
|
});
|
|
408
414
|
} else
|
|
409
415
|
t.type = "message.text", t.text = e.value.text.trim(), e.value.reply && (t.reply = e.value.reply), e.value.edit && (t.edit = e.value.edit), D("send", t);
|
|
410
|
-
|
|
416
|
+
pe(), l.value && l.value.focus();
|
|
411
417
|
}
|
|
412
418
|
};
|
|
413
|
-
return (e, t) => (
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
f("
|
|
424
|
-
|
|
425
|
-
|
|
419
|
+
return (e, t) => (h(), g("div", {
|
|
420
|
+
class: q(["chat-input__container", { "chat-input__container--disabled-notice": ee.value }]),
|
|
421
|
+
"data-testid": "chat-input"
|
|
422
|
+
}, [
|
|
423
|
+
ee.value ? (h(), g("div", vt, N(M.disabledPlaceholder), 1)) : (h(), g(ie, { key: 1 }, [
|
|
424
|
+
f("div", {
|
|
425
|
+
id: "chat-input-reply-line-" + r(I),
|
|
426
|
+
class: "chat-input__reply-line",
|
|
427
|
+
"data-testid": "chat-input-reply-line"
|
|
428
|
+
}, null, 8, gt),
|
|
429
|
+
f("div", {
|
|
430
|
+
id: "chat-input-file-line-" + r(I),
|
|
431
|
+
class: q(["chat-input__file-line", { "chat-input__file-line--visible": S.value.length > 0 }])
|
|
432
|
+
}, [
|
|
433
|
+
f("span", St, [
|
|
434
|
+
f("span", null, N(r(m)("component.ChatInput.FilesSelected")), 1),
|
|
435
|
+
f("span", null, N(Ae.value), 1)
|
|
436
|
+
]),
|
|
437
|
+
f("div", _t, [
|
|
438
|
+
B.value ? (h(), g("button", {
|
|
439
|
+
key: 0,
|
|
440
|
+
type: "button",
|
|
441
|
+
class: "chat-input__file-scroll chat-input__file-scroll--left",
|
|
442
|
+
"aria-label": r(m)("component.ChatInput.FilesScrollLeft"),
|
|
443
|
+
onClick: t[0] || (t[0] = (n) => J("left"))
|
|
444
|
+
}, [
|
|
445
|
+
z(r(ue))
|
|
446
|
+
], 8, xt)) : V("", !0),
|
|
447
|
+
f("div", {
|
|
448
|
+
ref_key: "refFileChips",
|
|
449
|
+
ref: L,
|
|
450
|
+
class: "chat-input__file-chips",
|
|
451
|
+
onScroll: K
|
|
452
|
+
}, [
|
|
453
|
+
(h(!0), g(ie, null, Xe(S.value, (n, i) => (h(), Je(mt, {
|
|
454
|
+
key: (n.url || n.name || "") + "-" + i,
|
|
455
|
+
"file-info": be(n),
|
|
456
|
+
onReset: (a) => Ke(i)
|
|
457
|
+
}, null, 8, ["file-info", "onReset"]))), 128))
|
|
458
|
+
], 544),
|
|
459
|
+
j.value ? (h(), g("button", {
|
|
460
|
+
key: 1,
|
|
461
|
+
type: "button",
|
|
462
|
+
class: "chat-input__file-scroll chat-input__file-scroll--right",
|
|
463
|
+
"aria-label": r(m)("component.ChatInput.FilesScrollRight"),
|
|
464
|
+
onClick: t[1] || (t[1] = (n) => J("right"))
|
|
465
|
+
}, [
|
|
466
|
+
z(r(ue))
|
|
467
|
+
], 8, bt)) : V("", !0)
|
|
468
|
+
])
|
|
469
|
+
], 10, yt),
|
|
470
|
+
f("div", It, [
|
|
471
|
+
oe(e.$slots, "inline-buttons", {}, void 0, !0)
|
|
426
472
|
]),
|
|
427
|
-
|
|
428
|
-
|
|
473
|
+
M.disabledPlaceholder && r(o)().isRecording ? (h(), g("div", Ct, N(M.disabledPlaceholder), 1)) : (h(), g("div", Ft, [
|
|
474
|
+
A.value ? (h(), g("div", {
|
|
429
475
|
key: 0,
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
"data-testid": "chat-input-textarea",
|
|
478
|
-
disabled: M.state == "disabled" || r(o)().isRecording,
|
|
479
|
-
class: O(["chat-input__input", { "chat-input__input--emoji-images": A.value }]),
|
|
480
|
-
placeholder: we.value,
|
|
481
|
-
onKeydown: [
|
|
482
|
-
Ce,
|
|
483
|
-
Qe(Re, ["enter"])
|
|
484
|
-
],
|
|
485
|
-
onInput: Le,
|
|
486
|
-
onScroll: g,
|
|
487
|
-
onSelect: b,
|
|
488
|
-
onMouseup: j,
|
|
489
|
-
onKeyup: j,
|
|
490
|
-
onMousemove: Fe,
|
|
491
|
-
onBlur: N
|
|
492
|
-
}, null, 42, Tt), [
|
|
493
|
-
[Ze, r(o)().text]
|
|
494
|
-
])
|
|
495
|
-
])),
|
|
496
|
-
q(pt, {
|
|
497
|
-
textarea: l.value,
|
|
498
|
-
onFormatApplied: ke
|
|
499
|
-
}, null, 8, ["textarea"]),
|
|
500
|
-
f("button", {
|
|
501
|
-
type: "button",
|
|
502
|
-
class: O(["chat-input__button", { "chat-input__button-disabled": Ee.value }]),
|
|
503
|
-
"data-testid": "chat-input-send",
|
|
504
|
-
disabled: r(o)().isRecording,
|
|
505
|
-
onClick: $
|
|
506
|
-
}, [
|
|
507
|
-
f("span", At, [
|
|
508
|
-
q(r(ft), { color: Ae.value }, null, 8, ["color"])
|
|
476
|
+
ref_key: "refMirror",
|
|
477
|
+
ref: T,
|
|
478
|
+
class: "chat-input__input-mirror",
|
|
479
|
+
"aria-hidden": "true",
|
|
480
|
+
innerHTML: Ie.value
|
|
481
|
+
}, null, 8, Tt)) : V("", !0),
|
|
482
|
+
Qe(f("textarea", {
|
|
483
|
+
ref_key: "refInput",
|
|
484
|
+
ref: l,
|
|
485
|
+
"onUpdate:modelValue": t[2] || (t[2] = (n) => r(o)().text = n),
|
|
486
|
+
rows: "1",
|
|
487
|
+
"data-testid": "chat-input-textarea",
|
|
488
|
+
disabled: M.state == "disabled" || r(o)().isRecording,
|
|
489
|
+
class: q(["chat-input__input", { "chat-input__input--emoji-images": A.value }]),
|
|
490
|
+
placeholder: Le.value,
|
|
491
|
+
onKeydown: [
|
|
492
|
+
Te,
|
|
493
|
+
Ze(De, ["enter"])
|
|
494
|
+
],
|
|
495
|
+
onInput: ke,
|
|
496
|
+
onScroll: _,
|
|
497
|
+
onSelect: C,
|
|
498
|
+
onMouseup: G,
|
|
499
|
+
onKeyup: G,
|
|
500
|
+
onMousemove: Ee,
|
|
501
|
+
onBlur: $
|
|
502
|
+
}, null, 42, Et), [
|
|
503
|
+
[et, r(o)().text]
|
|
504
|
+
])
|
|
505
|
+
])),
|
|
506
|
+
z(ht, {
|
|
507
|
+
textarea: l.value,
|
|
508
|
+
onFormatApplied: He
|
|
509
|
+
}, null, 8, ["textarea"]),
|
|
510
|
+
f("button", {
|
|
511
|
+
type: "button",
|
|
512
|
+
class: q(["chat-input__button", { "chat-input__button-disabled": we.value }]),
|
|
513
|
+
"data-testid": "chat-input-send",
|
|
514
|
+
disabled: r(o)().isRecording,
|
|
515
|
+
onClick: O
|
|
516
|
+
}, [
|
|
517
|
+
f("span", wt, [
|
|
518
|
+
z(r(pt), { color: Me.value }, null, 8, ["color"])
|
|
519
|
+
])
|
|
520
|
+
], 10, At),
|
|
521
|
+
f("div", Mt, [
|
|
522
|
+
oe(e.$slots, "buttons", {}, void 0, !0)
|
|
509
523
|
])
|
|
510
|
-
],
|
|
511
|
-
|
|
512
|
-
le(e.$slots, "buttons", {}, void 0, !0)
|
|
513
|
-
])
|
|
514
|
-
]));
|
|
524
|
+
], 64))
|
|
525
|
+
], 2));
|
|
515
526
|
}
|
|
516
527
|
});
|
|
517
528
|
export {
|
|
518
|
-
|
|
529
|
+
Jt as default
|
|
519
530
|
};
|