@mobilon-dev/chotto 0.3.91 → 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.
@@ -1,44 +1,48 @@
1
- import { ref as h, getCurrentInstance as x, inject as R, computed as S, unref as I, watch as D } from "vue";
2
- const r = h([]);
3
- function E(n) {
1
+ import { ref as x, getCurrentInstance as R, inject as h, computed as S, unref as D, watch as C } from "vue";
2
+ const o = x([]);
3
+ function E(s) {
4
4
  return {
5
- id: n,
5
+ id: s,
6
6
  text: "",
7
7
  file: void 0,
8
8
  forceSend: !1,
9
9
  isRecording: !1
10
10
  };
11
11
  }
12
- function f(n) {
13
- const i = r.value.find((a) => a.id === n);
14
- if (i) return i;
15
- const s = E(n);
16
- return r.value.push(s), s;
12
+ function u(s) {
13
+ const t = o.value.find((a) => a.id === s);
14
+ if (t) return t;
15
+ const i = E(s);
16
+ return o.value.push(i), i;
17
17
  }
18
- function F(n, i) {
18
+ function j(s, t) {
19
+ if (!(t == null || t === ""))
20
+ return o.value.find((i) => i.id === `${s}:${t}`);
21
+ }
22
+ function F(s, t) {
19
23
  if (typeof document > "u") return;
20
- const s = document.getElementById("chat-input-reply-line-" + n);
21
- s && (s.style.display = i.reply || i.edit ? "inherit" : "none");
24
+ const i = document.getElementById("chat-input-reply-line-" + s);
25
+ i && (i.style.display = t.reply || t.edit ? "inherit" : "none");
22
26
  }
23
- const j = (n) => {
24
- const i = x() ? R("selectedChat", void 0) : void 0, s = S(() => {
25
- const e = i ? I(i) : void 0, t = e == null ? void 0 : e.chatId;
26
- return t == null || t === "" ? n : `${n}:${t}`;
27
+ const B = (s) => {
28
+ const t = R() ? h("selectedChat", void 0) : void 0, i = S(() => {
29
+ const e = t ? D(t) : void 0, n = e == null ? void 0 : e.chatId;
30
+ return n == null || n === "" ? s : `${s}:${n}`;
27
31
  });
28
- D(
29
- s,
30
- (e, t) => {
31
- const d = f(e);
32
- t !== void 0 && t !== e && F(n, d);
32
+ C(
33
+ i,
34
+ (e, n) => {
35
+ const c = u(e);
36
+ n !== void 0 && n !== e && F(s, c);
33
37
  },
34
38
  { immediate: !0 }
35
39
  );
36
40
  const a = () => {
37
- const e = s.value, t = r.value.findIndex((d) => d.id === e);
38
- return t !== -1 ? t : (f(e), r.value.findIndex((d) => d.id === e));
39
- }, u = () => {
40
- const e = c();
41
- r.value[a()] = {
41
+ const e = i.value, n = o.value.findIndex((c) => c.id === e);
42
+ return n !== -1 ? n : (u(e), o.value.findIndex((c) => c.id === e));
43
+ }, f = () => {
44
+ const e = d();
45
+ o.value[a()] = {
42
46
  id: e.id,
43
47
  text: "",
44
48
  file: void 0,
@@ -47,50 +51,51 @@ const j = (n) => {
47
51
  forceSend: !1,
48
52
  isRecording: e.isRecording
49
53
  };
50
- }, o = (e) => {
51
- const t = c();
52
- r.value[a()] = {
53
- ...t,
54
+ }, r = (e) => {
55
+ const n = d();
56
+ o.value[a()] = {
57
+ ...n,
54
58
  forceSend: !1,
55
59
  ...e,
56
- id: t.id
60
+ id: n.id
57
61
  };
58
62
  }, l = (e) => {
59
- o({ text: e });
60
- }, g = (e) => {
61
- o({ file: e });
62
- }, v = () => {
63
- o({ file: void 0 });
63
+ r({ text: e });
64
+ }, v = (e) => {
65
+ r({ file: e });
66
+ }, g = () => {
67
+ r({ file: void 0 });
64
68
  }, p = (e) => {
65
- o({ reply: e, edit: void 0 });
69
+ r({ reply: e, edit: void 0 });
66
70
  }, y = () => {
67
- o({ reply: void 0 });
71
+ r({ reply: void 0 });
68
72
  }, M = (e) => {
69
- o({ edit: e, reply: void 0 });
73
+ r({ edit: e, reply: void 0 });
70
74
  }, m = () => {
71
- o({ edit: void 0 });
75
+ r({ edit: void 0 });
72
76
  };
73
- function c() {
74
- return f(s.value);
77
+ function d() {
78
+ return u(i.value);
75
79
  }
76
80
  return {
77
- getMessage: c,
78
- resetMessage: u,
79
- setMessageFile: g,
80
- resetMessageFile: v,
81
+ getMessage: d,
82
+ resetMessage: f,
83
+ setMessageFile: v,
84
+ resetMessageFile: g,
81
85
  setMessageText: l,
82
86
  setReply: p,
83
87
  resetReply: y,
84
88
  setEdit: M,
85
89
  resetEdit: m,
86
90
  setForceSendMessage: (e) => {
87
- c().forceSend = e;
91
+ d().forceSend = e;
88
92
  },
89
93
  setRecordingMessage: (e) => {
90
- c().isRecording = e;
94
+ d().isRecording = e;
91
95
  }
92
96
  };
93
97
  };
94
98
  export {
95
- j as useMessageDraft
99
+ j as getChatDraft,
100
+ B as useMessageDraft
96
101
  };
package/dist/index.js CHANGED
@@ -100,45 +100,45 @@ import { getTypeFileByMime as Lo } from "./hooks/uploadFile/getTypeFileByMime.js
100
100
  import { uploadFile as Uo } from "./hooks/uploadFile/uploadFile.js";
101
101
  import { useDelayDebouncedRef as No } from "./hooks/useDelayDebouncedRef.js";
102
102
  import { useImmediateDebouncedRef as Ko } from "./hooks/useImmediateDebouncedRef.js";
103
- import { useMessageDraft as Qo } from "./hooks/useMessageDraft.js";
104
- import { useSearchModel as zo } from "./hooks/useSearchModel.js";
105
- import { useTheme as Jo } from "./hooks/useTheme.js";
106
- import { useEmojiNative as Yo } from "./hooks/useEmojiNative.js";
107
- import { useModalCreateChat as _o } from "./hooks/modals/useCreateChat.js";
108
- import { useModalCreateChat2 as ea } from "./hooks/modals/useCreateChat2.js";
109
- import { useModalCreateDialog as oa } from "./hooks/modals/useCreateDialog.js";
110
- import { useConfirmDeleteMessage as ra } from "./hooks/modals/useConfirmDeleteMessage.js";
111
- import { useModalSelectUser2 as fa } from "./hooks/modals/useModalSelectUser2.js";
112
- import { useModalVideoRecorder as pa } from "./hooks/modals/useVideoRecorder.js";
113
- import { getValidationReport as ma, validateChats as ua } from "./hooks/validators/chats/chatValidator.js";
114
- import { useChatValidator as ia } from "./hooks/validators/chats/useChatValidator.js";
115
- import { getMessageValidationReport as ca, validateMessages as Ma } from "./hooks/validators/messages/messageValidator.js";
116
- import { useMessageValidator as Ca } from "./hooks/validators/messages/useMessageValidator.js";
117
- import { getSidebarValidationReport as ya, validateSidebarItems as ha } from "./hooks/validators/sidebar/sidebarValidator.js";
118
- import { useSidebarValidator as Ia } from "./hooks/validators/sidebar/useSidebarValidator.js";
119
- import { useValidation as Aa } from "./hooks/validators/useValidation.js";
120
- import { useMessageActions as Ba } from "./hooks/messages/useMessageActions.js";
121
- import { calculateMessageMenuPosition as ba, findAppBoundsRect as va } from "./hooks/messages/calculateMessageMenuPosition.js";
122
- import { useMessageMenuActions as Ea } from "./hooks/messages/useMessageMenuActions.js";
123
- import { useMessageLinks as wa } from "./hooks/messages/useMessageLinks.js";
124
- import { useChannelAccentColor as La } from "./hooks/messages/useChannelAccentColor.js";
125
- import { useSubtextTooltip as Ua } from "./hooks/messages/useSubtextTooltip.js";
126
- import { hideReplyPreview as Na, showReplyPreview as Ha, useStartReply as Ka } from "./hooks/messages/useStartReply.js";
127
- import { hideEditPreview as Qa, showEditPreview as qa, useStartEdit as za } from "./hooks/messages/useStartEdit.js";
128
- import { buildReplyPayload as Ja } from "./hooks/messages/buildReplyPayload.js";
129
- import { buildEditPayload as Ya } from "./hooks/messages/buildEditPayload.js";
130
- import { getEditTooltipLines as _a } from "./hooks/messages/getEditTooltipLines.js";
131
- import { getDeletedOriginalText as er, getDeletedTooltipLines as tr } from "./hooks/messages/getDeletedOriginalText.js";
132
- import { getStatus as ar, getStatusTitle as rr, statuses as sr } from "./functions/getStatusMessage.js";
133
- import { formatTimestamp as lr } from "./functions/formatTimestamp.js";
134
- import { playNotificationAudio as dr } from "./functions/playNotificationAudio.js";
135
- import { insertDaySeparators as ur } from "./functions/insertDaySeparators.js";
136
- import { sortByTimestamp as ir } from "./functions/sortByTimestamp.js";
137
- import { getMessageClass as cr } from "./functions/getMessageClass.js";
138
- import { createReactionHandlers as gr } from "./functions/createReactionHandlers.js";
139
- import { getChannelAccentColor as Sr } from "./functions/getChannelAccentColor.js";
140
- import { parseMarkdown as hr } from "./functions/parseMarkdown.js";
141
- import { safeMediaPlay as Ir, safeMediaPlayVoid as Tr } from "./functions/safeMediaPlay.js";
103
+ import { getChatDraft as Qo, useMessageDraft as qo } from "./hooks/useMessageDraft.js";
104
+ import { useSearchModel as Go } from "./hooks/useSearchModel.js";
105
+ import { useTheme as Xo } from "./hooks/useTheme.js";
106
+ import { useEmojiNative as Zo } from "./hooks/useEmojiNative.js";
107
+ import { useModalCreateChat as $o } from "./hooks/modals/useCreateChat.js";
108
+ import { useModalCreateChat2 as ta } from "./hooks/modals/useCreateChat2.js";
109
+ import { useModalCreateDialog as aa } from "./hooks/modals/useCreateDialog.js";
110
+ import { useConfirmDeleteMessage as sa } from "./hooks/modals/useConfirmDeleteMessage.js";
111
+ import { useModalSelectUser2 as la } from "./hooks/modals/useModalSelectUser2.js";
112
+ import { useModalVideoRecorder as da } from "./hooks/modals/useVideoRecorder.js";
113
+ import { getValidationReport as ua, validateChats as xa } from "./hooks/validators/chats/chatValidator.js";
114
+ import { useChatValidator as na } from "./hooks/validators/chats/useChatValidator.js";
115
+ import { getMessageValidationReport as Ma, validateMessages as ga } from "./hooks/validators/messages/messageValidator.js";
116
+ import { useMessageValidator as Sa } from "./hooks/validators/messages/useMessageValidator.js";
117
+ import { getSidebarValidationReport as ha, validateSidebarItems as Ra } from "./hooks/validators/sidebar/sidebarValidator.js";
118
+ import { useSidebarValidator as Ta } from "./hooks/validators/sidebar/useSidebarValidator.js";
119
+ import { useValidation as Pa } from "./hooks/validators/useValidation.js";
120
+ import { useMessageActions as Fa } from "./hooks/messages/useMessageActions.js";
121
+ import { calculateMessageMenuPosition as va, findAppBoundsRect as Da } from "./hooks/messages/calculateMessageMenuPosition.js";
122
+ import { useMessageMenuActions as ka } from "./hooks/messages/useMessageMenuActions.js";
123
+ import { useMessageLinks as Va } from "./hooks/messages/useMessageLinks.js";
124
+ import { useChannelAccentColor as Wa } from "./hooks/messages/useChannelAccentColor.js";
125
+ import { useSubtextTooltip as ja } from "./hooks/messages/useSubtextTooltip.js";
126
+ import { hideReplyPreview as Ha, showReplyPreview as Ka, useStartReply as Oa } from "./hooks/messages/useStartReply.js";
127
+ import { hideEditPreview as qa, showEditPreview as za, useStartEdit as Ga } from "./hooks/messages/useStartEdit.js";
128
+ import { buildReplyPayload as Xa } from "./hooks/messages/buildReplyPayload.js";
129
+ import { buildEditPayload as Za } from "./hooks/messages/buildEditPayload.js";
130
+ import { getEditTooltipLines as $a } from "./hooks/messages/getEditTooltipLines.js";
131
+ import { getDeletedOriginalText as tr, getDeletedTooltipLines as or } from "./hooks/messages/getDeletedOriginalText.js";
132
+ import { getStatus as rr, getStatusTitle as sr, statuses as fr } from "./functions/getStatusMessage.js";
133
+ import { formatTimestamp as pr } from "./functions/formatTimestamp.js";
134
+ import { playNotificationAudio as mr } from "./functions/playNotificationAudio.js";
135
+ import { insertDaySeparators as xr } from "./functions/insertDaySeparators.js";
136
+ import { sortByTimestamp as nr } from "./functions/sortByTimestamp.js";
137
+ import { getMessageClass as Mr } from "./functions/getMessageClass.js";
138
+ import { createReactionHandlers as Cr } from "./functions/createReactionHandlers.js";
139
+ import { getChannelAccentColor as yr } from "./functions/getChannelAccentColor.js";
140
+ import { parseMarkdown as Rr } from "./functions/parseMarkdown.js";
141
+ import { safeMediaPlay as Tr, safeMediaPlayVoid as Ar } from "./functions/safeMediaPlay.js";
142
142
  export {
143
143
  Io as AdaptiveExtendedLayout,
144
144
  Je as AudioMessage,
@@ -235,61 +235,62 @@ export {
235
235
  Re as WABASeparatedQuickButtons,
236
236
  Te as WABATemplateSelector,
237
237
  E as WhatsAppIcon,
238
- Ya as buildEditPayload,
238
+ Za as buildEditPayload,
239
239
  ko as buildFilePreview,
240
- Ja as buildReplyPayload,
241
- ba as calculateMessageMenuPosition,
242
- gr as createReactionHandlers,
243
- va as findAppBoundsRect,
244
- lr as formatTimestamp,
240
+ Xa as buildReplyPayload,
241
+ va as calculateMessageMenuPosition,
242
+ Cr as createReactionHandlers,
243
+ Da as findAppBoundsRect,
244
+ pr as formatTimestamp,
245
245
  wo as generatePreview,
246
- Sr as getChannelAccentColor,
247
- er as getDeletedOriginalText,
248
- tr as getDeletedTooltipLines,
249
- _a as getEditTooltipLines,
250
- cr as getMessageClass,
251
- ca as getMessageValidationReport,
252
- ya as getSidebarValidationReport,
253
- ar as getStatus,
254
- rr as getStatusTitle,
246
+ yr as getChannelAccentColor,
247
+ Qo as getChatDraft,
248
+ tr as getDeletedOriginalText,
249
+ or as getDeletedTooltipLines,
250
+ $a as getEditTooltipLines,
251
+ Mr as getMessageClass,
252
+ Ma as getMessageValidationReport,
253
+ ha as getSidebarValidationReport,
254
+ rr as getStatus,
255
+ sr as getStatusTitle,
255
256
  Lo as getTypeFileByMime,
256
- ma as getValidationReport,
257
- Qa as hideEditPreview,
258
- Na as hideReplyPreview,
259
- ur as insertDaySeparators,
260
- hr as parseMarkdown,
261
- dr as playNotificationAudio,
262
- Ir as safeMediaPlay,
263
- Tr as safeMediaPlayVoid,
264
- qa as showEditPreview,
265
- Ha as showReplyPreview,
266
- ir as sortByTimestamp,
267
- sr as statuses,
257
+ ua as getValidationReport,
258
+ qa as hideEditPreview,
259
+ Ha as hideReplyPreview,
260
+ xr as insertDaySeparators,
261
+ Rr as parseMarkdown,
262
+ mr as playNotificationAudio,
263
+ Tr as safeMediaPlay,
264
+ Ar as safeMediaPlayVoid,
265
+ za as showEditPreview,
266
+ Ka as showReplyPreview,
267
+ nr as sortByTimestamp,
268
+ fr as statuses,
268
269
  Uo as uploadFile,
269
- La as useChannelAccentColor,
270
- ia as useChatValidator,
271
- ra as useConfirmDeleteMessage,
270
+ Wa as useChannelAccentColor,
271
+ na as useChatValidator,
272
+ sa as useConfirmDeleteMessage,
272
273
  No as useDelayDebouncedRef,
273
- Yo as useEmojiNative,
274
+ Zo as useEmojiNative,
274
275
  Ko as useImmediateDebouncedRef,
275
- Ba as useMessageActions,
276
- Qo as useMessageDraft,
277
- wa as useMessageLinks,
278
- Ea as useMessageMenuActions,
279
- Ca as useMessageValidator,
280
- _o as useModalCreateChat,
281
- ea as useModalCreateChat2,
282
- oa as useModalCreateDialog,
283
- fa as useModalSelectUser2,
284
- pa as useModalVideoRecorder,
285
- zo as useSearchModel,
286
- Ia as useSidebarValidator,
287
- za as useStartEdit,
288
- Ka as useStartReply,
289
- Ua as useSubtextTooltip,
290
- Jo as useTheme,
291
- Aa as useValidation,
292
- ua as validateChats,
293
- Ma as validateMessages,
294
- ha as validateSidebarItems
276
+ Fa as useMessageActions,
277
+ qo as useMessageDraft,
278
+ Va as useMessageLinks,
279
+ ka as useMessageMenuActions,
280
+ Sa as useMessageValidator,
281
+ $o as useModalCreateChat,
282
+ ta as useModalCreateChat2,
283
+ aa as useModalCreateDialog,
284
+ la as useModalSelectUser2,
285
+ da as useModalVideoRecorder,
286
+ Go as useSearchModel,
287
+ Ta as useSidebarValidator,
288
+ Ga as useStartEdit,
289
+ Oa as useStartReply,
290
+ ja as useSubtextTooltip,
291
+ Xo as useTheme,
292
+ Pa as useValidation,
293
+ xa as validateChats,
294
+ ga as validateMessages,
295
+ Ra as validateSidebarItems
295
296
  };
package/dist/locale/en.js CHANGED
@@ -3,6 +3,7 @@ const e = {
3
3
  "component.ChatFilter.InputPlaceholder": "Chat search",
4
4
  "layout.ChatWrapper.noSelectedChat": "Choose contact to start conversation",
5
5
  "component.ChatItem.typing": "typing",
6
+ "component.ChatItem.draft": "Draft:",
6
7
  "component.ChatInput.InputPlaceholder": "Type a message...",
7
8
  "component.ChatInput.TelegramInputPlaceholder": "Type a message Telegram or change channel",
8
9
  "component.ChatInput.WhatsappInputPlaceholder": "Type a message WhatsApp or change channel",
package/dist/locale/ru.js CHANGED
@@ -3,6 +3,7 @@ const e = {
3
3
  "component.ChatFilter.InputPlaceholder": "Поиск чата",
4
4
  "layout.ChatWrapper.noSelectedChat": "Выберите контакт для начала общения",
5
5
  "component.ChatItem.typing": "печатает",
6
+ "component.ChatItem.draft": "Черновик:",
6
7
  "component.ChatInput.InputPlaceholder": "Введите сообщение",
7
8
  "component.ChatInput.WhatsappInputPlaceholder": "Введите сообщение WhatsApp или смените канал",
8
9
  "component.ChatInput.TelegramInputPlaceholder": "Введите сообщение Telegram или смените канал",