@mobilon-dev/chotto 0.3.90 → 0.3.92

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.
Files changed (62) hide show
  1. package/dist/chotto.css +1 -1
  2. package/dist/components/2_chatinput_elements/ButtonEmojiPicker/ButtonEmojiPicker.vue.js +1 -1
  3. package/dist/components/2_chatinput_elements/ButtonEmojiPicker/ButtonEmojiPicker.vue2.js +23 -23
  4. package/dist/components/2_chatinput_elements/FileUploader/FileUploader.vue.js +3 -3
  5. package/dist/components/2_chatinput_elements/FileUploader/FileUploader.vue2.js +87 -103
  6. package/dist/components/2_chatlist_elements/ChatItem/ChatItem.vue.js +2 -2
  7. package/dist/components/2_chatlist_elements/ChatItem/ChatItem.vue2.js +218 -182
  8. package/dist/components/2_elements/AudioRecorder/AudioRecorder.vue.js +2 -2
  9. package/dist/components/2_elements/AudioRecorder/AudioRecorder.vue2.js +52 -79
  10. package/dist/components/2_elements/VideoRecorder/VideoRecorder.vue.js +2 -2
  11. package/dist/components/2_elements/VideoRecorder/VideoRecorder.vue2.js +35 -64
  12. package/dist/components/2_feed_elements/AudioMessage/AudioMessage.vue.js +2 -2
  13. package/dist/components/2_feed_elements/AudioMessage/AudioMessage.vue2.js +4 -0
  14. package/dist/components/2_feed_elements/CallMessage/CallMessage.vue.js +3 -3
  15. package/dist/components/2_feed_elements/CallMessage/CallMessage.vue2.js +4 -0
  16. package/dist/components/2_feed_elements/FileMessage/FileMessage.vue.js +3 -3
  17. package/dist/components/2_feed_elements/FileMessage/FileMessage.vue2.js +33 -29
  18. package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue.js +2 -2
  19. package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue2.js +62 -58
  20. package/dist/components/2_feed_elements/MissedCallMessage/MissedCallMessage.vue.js +1 -1
  21. package/dist/components/2_feed_elements/MissedCallMessage/MissedCallMessage.vue2.js +27 -23
  22. package/dist/components/2_feed_elements/TextMessage/TextMessage.vue.js +2 -2
  23. package/dist/components/2_feed_elements/TextMessage/TextMessage.vue2.js +49 -41
  24. package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue.js +1 -1
  25. package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue2.js +105 -101
  26. package/dist/components/3_compounds/ChatInput/ChatInput.vue.js +2 -2
  27. package/dist/components/3_compounds/ChatInput/ChatInput.vue2.js +224 -138
  28. package/dist/components/3_compounds/ChatList/composables/useChatListFilter.js +18 -13
  29. package/dist/functions/renderAppleEmojis.js +127 -70
  30. package/dist/hooks/uploadFile/generatePreview.js +23 -11
  31. package/dist/hooks/useMessageDraft.js +73 -39
  32. package/dist/index.js +116 -114
  33. package/dist/locale/en.js +1 -0
  34. package/dist/locale/ru.js +1 -0
  35. package/dist/node_modules/vue3-emoji-picker-ru/dist/emoji-picker.es.js +106 -106
  36. package/dist/themes/dark.css +1 -1
  37. package/dist/themes/default.css +1 -1
  38. package/dist/themes/glass.css +1 -1
  39. package/dist/themes/green.css +1 -1
  40. package/dist/themes/mobilon1.css +1 -1
  41. package/dist/types/apps/data/messages.d.ts +52 -0
  42. package/dist/types/components/2_blocks/CommunicationPanel/CommunicationPanel.vue.d.ts +2 -2
  43. package/dist/types/components/2_blocks/CommunicationPanel/stories/CommunicationPanel.stories.d.ts +2 -2
  44. package/dist/types/components/2_chatlist_elements/ChatItem/styles/types.d.ts +6 -0
  45. package/dist/types/components/2_feed_elements/AudioMessage/styles/types.d.ts +34 -0
  46. package/dist/types/components/2_feed_elements/CallMessage/styles/types.d.ts +26 -0
  47. package/dist/types/components/2_feed_elements/FileMessage/styles/types.d.ts +30 -0
  48. package/dist/types/components/2_feed_elements/ImageMessage/styles/types.d.ts +34 -0
  49. package/dist/types/components/2_feed_elements/StickerMessage/styles/types.d.ts +4 -0
  50. package/dist/types/components/2_feed_elements/TextMessage/styles/types.d.ts +38 -2
  51. package/dist/types/components/2_feed_elements/TypingMessage/styles/types.d.ts +2 -0
  52. package/dist/types/components/2_feed_elements/VideoMessage/styles/types.d.ts +34 -0
  53. package/dist/types/components/3_compounds/ChatInput/ChatInput.vue.d.ts +3 -3
  54. package/dist/types/components/3_compounds/ChatInput/styles/types.d.ts +2 -0
  55. package/dist/types/components/3_compounds/Feed/composables/useFeedReply.d.ts +1 -27
  56. package/dist/types/functions/renderAppleEmojis.d.ts +17 -2
  57. package/dist/types/hooks/uploadFile/generatePreview.d.ts +2 -0
  58. package/dist/types/hooks/uploadFile/uploadFile.d.ts +9 -17
  59. package/dist/types/hooks/useMessageDraft.d.ts +30 -29
  60. package/dist/types/locale/en.d.ts +1 -0
  61. package/dist/types/locale/ru.d.ts +1 -0
  62. package/package.json +2 -2
@@ -1,27 +1,28 @@
1
- import { defineComponent as re, inject as ue, ref as f, computed as _, watch as h, nextTick as d, unref as r, onMounted as ce, createElementBlock as C, openBlock as I, createElementVNode as p, createVNode as P, renderSlot as W, toDisplayString as de, createCommentVNode as pe, withDirectives as fe, normalizeClass as H, withKeys as he, vModelText as me } from "vue";
2
- import { useImmediateDebouncedRef as ve } from "../../../hooks/useImmediateDebouncedRef.js";
3
- import { useMessageDraft as ge } from "../../../hooks/useMessageDraft.js";
1
+ import { defineComponent as Te, inject as be, ref as E, computed as _, watch as p, nextTick as S, unref as u, onMounted as we, onUnmounted as Ce, createElementBlock as k, openBlock as F, createElementVNode as h, createVNode as G, normalizeClass as z, createBlock as Ae, createCommentVNode as O, renderSlot as U, toDisplayString as Ee, withDirectives as Fe, withKeys as Me, vModelText as Re } from "vue";
2
+ import { useImmediateDebouncedRef as He } from "../../../hooks/useImmediateDebouncedRef.js";
3
+ import { useMessageDraft as ke } from "../../../hooks/useMessageDraft.js";
4
4
  import "../../../hooks/useSearchModel.js";
5
5
  import "../../../hooks/useTheme.js";
6
- import { useEmojiNative as ye } from "../../../hooks/useEmojiNative.js";
6
+ import { useEmojiNative as Le } from "../../../hooks/useEmojiNative.js";
7
7
  /* empty css */
8
8
  /* empty css */
9
- import { t as m } from "../../../locale/useLocale.js";
9
+ import { t as I } from "../../../locale/useLocale.js";
10
10
  /* empty css */
11
11
  import "../../../node_modules/linkifyjs/dist/linkify.js";
12
12
  import "../../../node_modules/linkify-string/dist/linkify-string.js";
13
13
  import "../../../functions/parseMarkdown.js";
14
- import { textToAppleEmojiHtml as xe, textContainsEmoji as _e } from "../../../functions/renderAppleEmojis.js";
15
- import { hideEditPreview as Te } from "../../../hooks/messages/useStartEdit.js";
16
- import be from "./icons/SendIcon.vue.js";
17
- import Se from "../../2_chatinput_elements/TextFormatToolbar/TextFormatToolbar.vue.js";
18
- const Ce = { class: "chat-input__container" }, Ie = ["id"], we = ["id"], Ae = { class: "chat-input__inline-buttons" }, Ee = {
14
+ import { textToAppleEmojiHtml as De, textContainsEmoji as Pe, previousGraphemeIndex as Y, nextGraphemeIndex as V, snapIndexToGrapheme as $ } from "../../../functions/renderAppleEmojis.js";
15
+ import { hideEditPreview as We } from "../../../hooks/messages/useStartEdit.js";
16
+ import qe from "./icons/SendIcon.vue.js";
17
+ import Be from "../../2_chatinput_elements/TextFormatToolbar/TextFormatToolbar.vue.js";
18
+ import ze from "../../2_chatinput_elements/FilePreview/FilePreview.vue.js";
19
+ const Ke = { class: "chat-input__container" }, je = ["id"], Ne = ["id"], Ge = { class: "chat-input__inline-buttons" }, Oe = {
19
20
  key: 0,
20
21
  class: "chat-input__input chat-input__disabled-placeholder"
21
- }, Me = {
22
+ }, Ue = {
22
23
  key: 1,
23
24
  class: "chat-input__input-wrap"
24
- }, Fe = ["innerHTML"], He = ["disabled", "placeholder"], Re = ["disabled"], ke = { class: "" }, ze = { class: "chat-input__third-line" }, Ze = /* @__PURE__ */ re({
25
+ }, Ye = ["innerHTML"], Ve = ["disabled", "placeholder"], $e = ["disabled"], Je = { class: "" }, Qe = { class: "chat-input__third-line" }, K = 40, gt = /* @__PURE__ */ Te({
25
26
  __name: "ChatInput",
26
27
  props: {
27
28
  state: {
@@ -50,32 +51,84 @@ const Ce = { class: "chat-input__container" }, Ie = ["id"], we = ["id"], Ae = {
50
51
  }
51
52
  },
52
53
  emits: ["send", "typing"],
53
- setup(v, { emit: B }) {
54
- const w = B, g = ue("chatAppId"), { resetMessage: L, getMessage: l, setMessageText: T, setForceSendMessage: j, resetEdit: q } = ge(g), { isNative: K } = ye(g), n = f(), A = f(), u = f(!1), y = f(!1), N = ve("", 2e3), R = f(), O = _(() => xe(l().text || "")), x = _(
55
- () => !K.value && _e(l().text || "")
54
+ setup(T, { emit: J }) {
55
+ const L = J, b = be("chatAppId"), { resetMessage: Q, getMessage: o, setMessageText: M, setForceSendMessage: X, resetEdit: Z, resetMessageFile: ee } = ke(b), { isNative: te } = Le(b), n = E(), m = E(), v = E(null), w = E(!1), ne = He("", 2e3), D = _(() => {
56
+ var e;
57
+ return (e = o().file) == null ? void 0 : e.preview;
58
+ }), ie = _(
59
+ () => De(o().text || "", v.value)
60
+ ), g = _(
61
+ () => !te.value && Pe(o().text || "")
56
62
  ), c = () => {
57
- if (!A.value || !n.value) return;
58
- const e = n.value, t = A.value, i = Math.max(0, e.offsetWidth - e.clientWidth);
59
- t.style.right = i > 0 ? `${i}px` : "", t.scrollTop = e.scrollTop;
63
+ if (!m.value || !n.value) return;
64
+ const e = n.value, t = m.value, l = Math.max(0, e.offsetWidth - e.clientWidth);
65
+ t.style.right = l > 0 ? `${l}px` : "", t.scrollTop = e.scrollTop;
60
66
  };
61
- let b = 0;
62
- function E() {
63
- if (!x.value) {
64
- u.value = !1;
67
+ let y = 0;
68
+ function P() {
69
+ v.value = null;
70
+ }
71
+ function le(e = "nearest") {
72
+ const t = n.value;
73
+ if (!t || !g.value) return;
74
+ const l = t.value, i = $(l, t.selectionStart, e), r = $(l, t.selectionEnd, e);
75
+ (i !== t.selectionStart || r !== t.selectionEnd) && t.setSelectionRange(i, r);
76
+ }
77
+ function W() {
78
+ le("nearest"), d();
79
+ }
80
+ function oe(e) {
81
+ if (!g.value || e.key !== "ArrowLeft" && e.key !== "ArrowRight" || e.altKey || e.metaKey || e.ctrlKey) return;
82
+ const t = n.value;
83
+ if (!t) return;
84
+ const l = t.value, i = t.selectionStart !== t.selectionEnd;
85
+ if (e.shiftKey) {
86
+ requestAnimationFrame(() => W());
65
87
  return;
66
88
  }
67
- b && cancelAnimationFrame(b), b = requestAnimationFrame(() => {
68
- b = 0;
89
+ if (i) {
90
+ e.preventDefault();
91
+ const x = e.key === "ArrowLeft" ? t.selectionStart : t.selectionEnd, A = e.key === "ArrowLeft" ? Y(l, x) : V(l, x);
92
+ t.setSelectionRange(A, A), d();
93
+ return;
94
+ }
95
+ e.preventDefault();
96
+ const r = t.selectionStart, f = e.key === "ArrowLeft" ? Y(l, r) : V(l, r);
97
+ t.setSelectionRange(f, f), d();
98
+ }
99
+ function d() {
100
+ if (!g.value) {
101
+ P();
102
+ return;
103
+ }
104
+ y && cancelAnimationFrame(y), y = requestAnimationFrame(() => {
105
+ var f;
106
+ y = 0;
69
107
  const e = n.value;
70
108
  if (!e) {
71
- u.value = !1;
109
+ P();
110
+ return;
111
+ }
112
+ const t = e.selectionStart, l = e.selectionEnd;
113
+ if (t === l) {
114
+ v.value !== null && (v.value = null, S(c));
72
115
  return;
73
116
  }
74
- const t = e.selectionStart !== e.selectionEnd;
75
- u.value !== t && (u.value = t, t || d(c));
117
+ const i = v.value;
118
+ if (i && i.start === t && i.end === l) return;
119
+ const r = ((f = m.value) == null ? void 0 : f.scrollTop) ?? 0;
120
+ v.value = { start: t, end: l }, S(() => {
121
+ m.value && (m.value.scrollTop = r), c();
122
+ });
76
123
  });
77
124
  }
78
- const a = v, Y = _(() => !!(a.state == "disabled" || l().text == "" && !l().file || l().isRecording)), $ = _(() => {
125
+ function se(e) {
126
+ e.buttons && d();
127
+ }
128
+ function j() {
129
+ document.activeElement === n.value && d();
130
+ }
131
+ const a = T, ae = _(() => !!(a.state == "disabled" || o().text == "" && !o().file || o().isRecording)), re = _(() => {
79
132
  var t;
80
133
  if (a.inputButtonColor)
81
134
  return a.inputButtonColor;
@@ -83,133 +136,158 @@ const Ce = { class: "chat-input__container" }, Ie = ["id"], we = ["id"], Ae = {
83
136
  return "#25D366";
84
137
  const e = a.selectedChannel.channelId.toLowerCase();
85
138
  return e.includes("whatsapp") || e.includes("waba") ? "#25D366" : e.includes("telegram") ? "#37AFE2" : e.includes("sms") ? "#6C757D" : e.includes("max") ? "#4B0082" : "#25D366";
86
- }), V = _(() => {
139
+ }), ue = _(() => {
87
140
  var t;
88
141
  if (!((t = a.selectedChannel) != null && t.channelId))
89
- return m("component.ChatInput.InputPlaceholder");
142
+ return I("component.ChatInput.InputPlaceholder");
90
143
  const e = a.selectedChannel.channelId.toLowerCase();
91
- 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");
144
+ return e.includes("whatsapp") || e.includes("waba") ? I("component.ChatInput.WhatsappInputPlaceholder") : e.includes("telegram") ? I("component.ChatInput.TelegramInputPlaceholder") : e.includes("sms") ? I("component.ChatInput.SmsInputPlaceholder") : e.includes("max") ? I("component.ChatInput.MaxInputPlaceholder") : I("component.ChatInput.InputPlaceholder");
92
145
  });
93
- h(
94
- () => N.value,
146
+ p(
147
+ () => ne.value,
95
148
  () => {
96
- w("typing");
149
+ L("typing");
97
150
  }
98
- ), h(
151
+ ), p(
99
152
  () => {
100
153
  var e;
101
- return (e = l().edit) == null ? void 0 : e.messageId;
154
+ return (e = o().edit) == null ? void 0 : e.messageId;
102
155
  },
103
156
  (e, t) => {
104
- e != null && e !== t && (y.value = !0, d(() => {
105
- if (!y.value) return;
106
- const i = n.value;
107
- i && (M(i), y.value = !1, S(i), requestAnimationFrame(() => S(i)));
157
+ e != null && e !== t && (w.value = !0, S(() => {
158
+ if (!w.value) return;
159
+ const l = n.value;
160
+ l && (C(l), w.value = !1, H(l), requestAnimationFrame(() => H(l)));
108
161
  }));
109
162
  }
110
- ), h(
163
+ ), p(
111
164
  () => a.focusOnInputArea,
112
165
  () => {
113
- a.focusOnInputArea && d(() => {
114
- const e = r(n);
166
+ a.focusOnInputArea && S(() => {
167
+ const e = u(n);
115
168
  e == null || e.focus();
116
169
  });
117
170
  },
118
171
  { immediate: !0 }
119
- ), h(
120
- () => l().text,
172
+ ), p(
173
+ () => o().text,
121
174
  () => {
122
- d(() => {
123
- const e = n.value;
124
- e && (M(e), y.value && (y.value = !1, S(e), requestAnimationFrame(() => S(e))));
125
- });
175
+ const e = n.value;
176
+ e && (C(e), w.value && (w.value = !1, H(e), requestAnimationFrame(() => H(e))));
126
177
  },
127
- { immediate: !0 }
128
- ), h(x, (e) => {
129
- e && d(() => {
178
+ { immediate: !0, flush: "post" }
179
+ ), p(
180
+ () => o().id,
181
+ () => {
182
+ const e = n.value;
183
+ e && (R(e), requestAnimationFrame(() => {
184
+ const t = n.value;
185
+ t && C(t);
186
+ }));
187
+ }
188
+ ), p(g, (e) => {
189
+ e && S(() => {
130
190
  const t = n.value;
131
191
  if (!t) return;
132
- const i = t.scrollTop;
133
- M(t), t.scrollTop = i, c(), requestAnimationFrame(c);
192
+ const l = t.scrollTop;
193
+ C(t), t.scrollTop = l, c(), requestAnimationFrame(c);
134
194
  });
135
195
  });
136
- function M(e) {
137
- const t = e.scrollTop;
196
+ function R(e) {
197
+ const t = o().inputHeight;
198
+ e.style.height = (t || K) + "px", (!t || t <= K) && (e.style.overflowY = "hidden");
199
+ }
200
+ function ce(e) {
201
+ const t = parseFloat(e.style.height);
202
+ Number.isFinite(t) && (o().inputHeight = t);
203
+ }
204
+ function C(e) {
205
+ const t = o().text || "";
206
+ if (e.value !== t || e.clientWidth === 0) {
207
+ R(e);
208
+ return;
209
+ }
210
+ const l = e.scrollTop;
138
211
  e.style.height = "auto";
139
- const i = getComputedStyle(e), o = parseFloat(i.fontSize) || 16, ee = parseFloat(i.lineHeight) || o * 1.4, k = 40, z = ee * 11, D = e.scrollHeight, te = l().text.split(`
212
+ const i = getComputedStyle(e), r = parseFloat(i.fontSize) || 16, f = parseFloat(i.lineHeight) || r * 1.4, x = K, A = f * 11, B = e.scrollHeight, ge = t.split(`
140
213
  `).length > 1, s = document.createElement("div");
141
- s.style.position = "absolute", s.style.visibility = "hidden", s.style.whiteSpace = "nowrap", s.style.font = i.font, s.style.fontSize = i.fontSize, s.style.fontFamily = i.fontFamily, s.style.fontWeight = i.fontWeight, s.style.letterSpacing = i.letterSpacing, s.textContent = l().text, document.body.appendChild(s);
142
- const ne = s.offsetWidth;
214
+ s.style.position = "absolute", s.style.visibility = "hidden", s.style.whiteSpace = "nowrap", s.style.font = i.font, s.style.fontSize = i.fontSize, s.style.fontFamily = i.fontFamily, s.style.fontWeight = i.fontWeight, s.style.letterSpacing = i.letterSpacing, s.textContent = t, document.body.appendChild(s);
215
+ const ye = s.offsetWidth;
143
216
  document.body.removeChild(s);
144
- const ie = parseFloat(i.paddingLeft) || 0, le = parseFloat(i.paddingRight) || 0, oe = e.clientWidth - ie - le, se = ne > oe, ae = te || se;
145
- l().text.trim() && ae ? D <= z ? (e.style.height = D + "px", e.style.overflowY = "hidden") : (e.style.height = z + "px", e.style.overflowY = "auto", e.scrollTop = t) : (e.style.height = k + "px", e.style.overflowY = "hidden"), c(), requestAnimationFrame(c);
217
+ const xe = parseFloat(i.paddingLeft) || 0, _e = parseFloat(i.paddingRight) || 0, Se = e.clientWidth - xe - _e, Ie = ye > Se, N = ge || Ie;
218
+ if (N && B <= x + 1) {
219
+ R(e);
220
+ return;
221
+ }
222
+ t.trim() && N ? B <= A ? (e.style.height = B + "px", e.style.overflowY = "hidden") : (e.style.height = A + "px", e.style.overflowY = "auto", e.scrollTop = l) : (e.style.height = x + "px", e.style.overflowY = "hidden"), ce(e), c(), requestAnimationFrame(c);
146
223
  }
147
- function S(e) {
148
- if (a.state === "disabled" || l().isRecording) return;
224
+ function H(e) {
225
+ if (a.state === "disabled" || o().isRecording) return;
149
226
  const t = e.value.length;
150
227
  e.focus(), e.setSelectionRange(t, t), e.scrollTop = e.scrollHeight, c();
151
228
  }
152
- h(
153
- () => l().forceSend,
229
+ p(
230
+ () => o().forceSend,
154
231
  () => {
155
- l().forceSend && (F(), j(!1));
232
+ o().forceSend && (q(), X(!1));
156
233
  }
157
234
  );
158
- const U = (e) => {
235
+ const de = (e) => {
159
236
  const t = e.target;
160
- w("typing", t.value);
161
- }, G = () => {
162
- d(() => {
163
- const e = n.value;
164
- e && (e.style.height = "40px", e.style.overflowY = "hidden");
165
- });
237
+ L("typing", t.value), d();
166
238
  };
167
- ce(() => {
168
- G();
239
+ we(() => {
240
+ const e = n.value;
241
+ e && (R(e), C(e)), document.addEventListener("selectionchange", j);
242
+ }), Ce(() => {
243
+ document.removeEventListener("selectionchange", j), y && cancelAnimationFrame(y);
169
244
  });
170
- const J = (e) => {
245
+ const fe = (e) => {
171
246
  if (e.shiftKey) {
172
247
  if (n.value instanceof HTMLTextAreaElement) {
173
248
  let t = n.value.selectionStart;
174
249
  t && (n.value.setRangeText(`
175
- `, t, t, "end"), T(n.value.value));
250
+ `, t, t, "end"), M(n.value.value));
176
251
  }
177
252
  e.preventDefault();
178
253
  } else if (e.ctrlKey) {
179
254
  if (n.value instanceof HTMLTextAreaElement) {
180
255
  let t = n.value.selectionStart;
181
256
  t && (n.value.setRangeText(`
182
- `, t, t, "end"), T(n.value.value));
257
+ `, t, t, "end"), M(n.value.value));
183
258
  }
184
259
  e.preventDefault();
185
260
  } else
186
- e.preventDefault(), F();
187
- }, Q = (e) => {
261
+ e.preventDefault(), q();
262
+ }, pe = (e) => {
188
263
  if (n.value) {
189
264
  const t = n.value.value;
190
265
  n.value.value = e.newText;
191
- const i = e.newText.length - (t.length - (e.end - e.start)), o = e.start + i;
192
- T(e.newText), d(() => {
193
- n.value && (n.value.setSelectionRange(o, o), n.value.focus());
266
+ const l = e.newText.length - (t.length - (e.end - e.start)), i = e.start + l;
267
+ M(e.newText), S(() => {
268
+ n.value && (n.value.setSelectionRange(i, i), n.value.focus());
194
269
  });
195
270
  }
196
271
  };
197
- function X() {
198
- q(), T(""), Te(g), R.value = void 0, n.value && n.value.focus();
272
+ function he() {
273
+ ee();
274
+ }
275
+ function me() {
276
+ Z(), M(""), We(b), n.value && n.value.focus();
199
277
  }
200
- function Z() {
201
- const e = l();
278
+ function ve() {
279
+ const e = o();
202
280
  return e.edit ? (e.text ?? "").trim() === (e.edit.text ?? "").trim() : !1;
203
281
  }
204
- const F = () => {
205
- var t, i;
206
- const e = f(l());
207
- if (e.value.edit && Z()) {
208
- X();
282
+ const q = () => {
283
+ var t, l;
284
+ const e = E(o());
285
+ if (e.value.edit && ve()) {
286
+ me();
209
287
  return;
210
288
  }
211
289
  if (e.value.text != "" || e.value.file) {
212
- const o = {
290
+ const i = {
213
291
  type: "",
214
292
  text: "",
215
293
  url: "",
@@ -217,70 +295,78 @@ const Ce = { class: "chat-input__container" }, Ie = ["id"], we = ["id"], Ae = {
217
295
  size: "",
218
296
  reply: void 0
219
297
  };
220
- e.value.file ? (o.type = "message." + e.value.file.type, o.url = e.value.file.url, o.filename = e.value.file.name, o.size = (t = e.value.file.size) == null ? void 0 : t.toString(), o.text = (i = e == null ? void 0 : e.value) == null ? void 0 : i.text.trim()) : (o.type = "message.text", o.text = e.value.text.trim()), e.value.reply && (o.reply = e.value.reply), e.value.edit && (o.edit = e.value.edit), w("send", o), L(), R.value = void 0, n.value && n.value.focus();
298
+ e.value.file ? (i.type = "message." + e.value.file.type, i.url = e.value.file.url, i.filename = e.value.file.name, i.size = (t = e.value.file.size) == null ? void 0 : t.toString(), i.text = (l = e == null ? void 0 : e.value) == null ? void 0 : l.text.trim()) : (i.type = "message.text", i.text = e.value.text.trim()), e.value.reply && (i.reply = e.value.reply), e.value.edit && (i.edit = e.value.edit), L("send", i), Q(), n.value && n.value.focus();
221
299
  }
222
300
  };
223
- return (e, t) => (I(), C("div", Ce, [
224
- p("div", {
225
- id: "chat-input-reply-line-" + r(g),
301
+ return (e, t) => (F(), k("div", Ke, [
302
+ h("div", {
303
+ id: "chat-input-reply-line-" + u(b),
226
304
  class: "chat-input__reply-line"
227
- }, null, 8, Ie),
228
- p("div", {
229
- id: "chat-input-file-line-" + r(g),
230
- class: "chat-input__file-line"
231
- }, null, 8, we),
232
- p("div", Ae, [
233
- W(e.$slots, "inline-buttons", {}, void 0, !0)
305
+ }, null, 8, je),
306
+ h("div", {
307
+ id: "chat-input-file-line-" + u(b),
308
+ class: z(["chat-input__file-line", { "chat-input__file-line--visible": !!D.value }])
309
+ }, [
310
+ D.value ? (F(), Ae(ze, {
311
+ key: 0,
312
+ "file-info": D.value,
313
+ onReset: he
314
+ }, null, 8, ["file-info"])) : O("", !0)
315
+ ], 10, Ne),
316
+ h("div", Ge, [
317
+ U(e.$slots, "inline-buttons", {}, void 0, !0)
234
318
  ]),
235
- v.disabledPlaceholder && (v.state == "disabled" || r(l)().isRecording) ? (I(), C("div", Ee, de(v.disabledPlaceholder), 1)) : (I(), C("div", Me, [
236
- x.value ? (I(), C("div", {
319
+ T.disabledPlaceholder && (T.state == "disabled" || u(o)().isRecording) ? (F(), k("div", Oe, Ee(T.disabledPlaceholder), 1)) : (F(), k("div", Ue, [
320
+ g.value ? (F(), k("div", {
237
321
  key: 0,
238
322
  ref_key: "refMirror",
239
- ref: A,
240
- class: H(["chat-input__input-mirror", { "chat-input__input-mirror--hidden": u.value }]),
323
+ ref: m,
324
+ class: "chat-input__input-mirror",
241
325
  "aria-hidden": "true",
242
- innerHTML: O.value
243
- }, null, 10, Fe)) : pe("", !0),
244
- fe(p("textarea", {
326
+ innerHTML: ie.value
327
+ }, null, 8, Ye)) : O("", !0),
328
+ Fe(h("textarea", {
245
329
  ref_key: "refInput",
246
330
  ref: n,
247
- "onUpdate:modelValue": t[0] || (t[0] = (i) => r(l)().text = i),
248
- disabled: v.state == "disabled" || r(l)().isRecording,
249
- class: H(["chat-input__input", {
250
- "chat-input__input--emoji-images": x.value && !u.value,
251
- "chat-input__input--selecting": x.value && u.value
252
- }]),
253
- placeholder: V.value,
254
- onKeydown: he(J, ["enter"]),
255
- onInput: U,
331
+ "onUpdate:modelValue": t[0] || (t[0] = (l) => u(o)().text = l),
332
+ rows: "1",
333
+ disabled: T.state == "disabled" || u(o)().isRecording,
334
+ class: z(["chat-input__input", { "chat-input__input--emoji-images": g.value }]),
335
+ placeholder: ue.value,
336
+ onKeydown: [
337
+ oe,
338
+ Me(fe, ["enter"])
339
+ ],
340
+ onInput: de,
256
341
  onScroll: c,
257
- onSelect: E,
258
- onMouseup: E,
259
- onKeyup: E,
260
- onBlur: t[1] || (t[1] = (i) => u.value = !1)
261
- }, null, 42, He), [
262
- [me, r(l)().text]
342
+ onSelect: d,
343
+ onMouseup: W,
344
+ onKeyup: W,
345
+ onMousemove: se,
346
+ onBlur: P
347
+ }, null, 42, Ve), [
348
+ [Re, u(o)().text]
263
349
  ])
264
350
  ])),
265
- P(Se, {
351
+ G(Be, {
266
352
  textarea: n.value,
267
- onFormatApplied: Q
353
+ onFormatApplied: pe
268
354
  }, null, 8, ["textarea"]),
269
- p("button", {
270
- class: H(["chat-input__button", { "chat-input__button-disabled": Y.value }]),
271
- disabled: r(l)().isRecording,
272
- onClick: F
355
+ h("button", {
356
+ class: z(["chat-input__button", { "chat-input__button-disabled": ae.value }]),
357
+ disabled: u(o)().isRecording,
358
+ onClick: q
273
359
  }, [
274
- p("span", ke, [
275
- P(r(be), { color: $.value }, null, 8, ["color"])
360
+ h("span", Je, [
361
+ G(u(qe), { color: re.value }, null, 8, ["color"])
276
362
  ])
277
- ], 10, Re),
278
- p("div", ze, [
279
- W(e.$slots, "buttons", {}, void 0, !0)
363
+ ], 10, $e),
364
+ h("div", Qe, [
365
+ U(e.$slots, "buttons", {}, void 0, !0)
280
366
  ])
281
367
  ]));
282
368
  }
283
369
  });
284
370
  export {
285
- Ze as default
371
+ gt as default
286
372
  };
@@ -1,24 +1,29 @@
1
- import { ref as u } from "vue";
2
- function h({ props: e, emit: l }) {
3
- const r = u("");
1
+ import { ref as c } from "vue";
2
+ function d({ props: e, emit: i }) {
3
+ const n = c("");
4
4
  return {
5
- filter: r,
5
+ filter: n,
6
6
  getSortedAndFilteredChats: () => !e.chats || e.chats.length === 0 ? [] : e.chats.slice().filter((t) => {
7
- var n;
8
- const i = e.activeTabId || "all";
9
- if (i !== "all") {
10
- if (i === "countUnread") {
7
+ var l;
8
+ const a = e.activeTabId || "all";
9
+ if (a !== "all") {
10
+ if (a === "countUnread") {
11
11
  if (t.countUnread <= 0) return !1;
12
- } else if (i.startsWith("tag_") && (!((n = t.contact) != null && n.tags) || !t.contact.tags.some((s) => s.tagId === i)))
12
+ } else if (a.startsWith("tag_") && (!((l = t.contact) != null && l.tags) || !t.contact.tags.some((s) => s.tagId === a)))
13
13
  return !1;
14
14
  }
15
- return e.searchQuery && e.searchQuery.trim() !== "" ? !0 : e.filterQuery ? t.name.includes(e.filterQuery) || t.metadata.includes(e.filterQuery) : t.name.includes(r.value) || t.metadata.includes(r.value);
15
+ if (e.searchQuery && e.searchQuery.trim() !== "")
16
+ return !0;
17
+ {
18
+ const s = (e.filterQuery || n.value).toLowerCase();
19
+ return (t.name ?? "").toLowerCase().includes(s) || (t.metadata ?? "").toLowerCase().includes(s);
20
+ }
16
21
  }),
17
- getFilter: (a) => {
18
- r.value = a, a.trim() !== "" ? l("search", a) : l("clear-search");
22
+ getFilter: (r) => {
23
+ n.value = r, r.trim() !== "" ? i("search", r) : i("clear-search");
19
24
  }
20
25
  };
21
26
  }
22
27
  export {
23
- h as useChatListFilter
28
+ d as useChatListFilter
24
29
  };