@mobilon-dev/chotto 0.3.89 → 0.3.91

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