@mobilon-dev/chotto 0.3.85 → 0.3.87

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 (151) hide show
  1. package/dist/chotto.css +1 -1
  2. package/dist/components/1_atoms/ButtonContextMenu/ButtonContextMenu.vue2.js +15 -13
  3. package/dist/components/1_atoms/ContactContextMenu/ContactContextMenu.vue2.js +4 -2
  4. package/dist/components/1_atoms/ContextMenu/ContextMenu.vue.js +43 -39
  5. package/dist/components/1_atoms/EmojiGlyph/EmojiGlyph.vue.js +7 -5
  6. package/dist/components/1_atoms/LoadingIndicator/LoadingIndicator.vue.js +19 -18
  7. package/dist/components/1_atoms/Tooltip/Tooltip.vue.js +2 -2
  8. package/dist/components/1_atoms/Tooltip/Tooltip.vue2.js +83 -72
  9. package/dist/components/2_blocks/CommunicationPanel/CommunicationPanel.vue.js +174 -165
  10. package/dist/components/2_blocks/CommunicationPanel/composables/useCommunicationActions.js +21 -18
  11. package/dist/components/2_blocks/CommunicationPanel/composables/useCommunicationMenu.js +32 -27
  12. package/dist/components/2_blocks/CommunicationPanel/composables/useCommunicationSubMenu.js +44 -35
  13. package/dist/components/2_blocks/FeedSearch/FeedSearch.vue2.js +11 -10
  14. package/dist/components/2_chatinput_elements/ButtonCommandsSelector/ButtonCommandsSelector.vue2.js +4 -2
  15. package/dist/components/2_chatinput_elements/ButtonEmojiPicker/ButtonEmojiPicker.vue2.js +18 -16
  16. package/dist/components/2_chatinput_elements/ButtonTemplateSelector/ButtonTemplateSelector.vue2.js +16 -14
  17. package/dist/components/2_chatinput_elements/ButtonWabaTemplateSelector/ButtonWabaTemplateSelector.vue.js +4 -2
  18. package/dist/components/2_chatinput_elements/FilePreview/FilePreview.vue2.js +4 -2
  19. package/dist/components/2_chatinput_elements/FileUploader/FileUploader.vue2.js +4 -2
  20. package/dist/components/2_chatinput_elements/StickerPicker/StickerPicker.vue2.js +4 -2
  21. package/dist/components/2_chatinput_elements/TemplateSelector/TemplateSelector.vue.js +4 -2
  22. package/dist/components/2_chatinput_elements/TextFormatToolbar/TextFormatToolbar.vue2.js +4 -3
  23. package/dist/components/2_chatinput_elements/WABAAttachmentSection/WABAAttachmentSection.vue2.js +4 -2
  24. package/dist/components/2_chatlist_elements/ChatItem/ChatItem.vue2.js +3 -2
  25. package/dist/components/2_elements/AudioRecorder/AudioRecorder.vue2.js +4 -2
  26. package/dist/components/2_elements/ChannelSelector/ChannelSelector.vue.js +3 -2
  27. package/dist/components/2_elements/ThemeMode/ThemeMode.vue.js +7 -5
  28. package/dist/components/2_elements/VideoRecorder/VideoRecorder.vue2.js +4 -2
  29. package/dist/components/2_feed_elements/AudioMessage/AudioMessage.vue.js +1 -1
  30. package/dist/components/2_feed_elements/AudioMessage/AudioMessage.vue2.js +387 -340
  31. package/dist/components/2_feed_elements/BaseEditMessage/BaseEditMessage.vue.js +7 -0
  32. package/dist/components/2_feed_elements/BaseEditMessage/BaseEditMessage.vue2.js +34 -0
  33. package/dist/components/2_feed_elements/CallMessage/CallMessage.vue.js +2 -2
  34. package/dist/components/2_feed_elements/CallMessage/CallMessage.vue2.js +388 -352
  35. package/dist/components/2_feed_elements/DeletedMessageContent/DeletedMessageContent.vue.js +7 -0
  36. package/dist/components/2_feed_elements/DeletedMessageContent/DeletedMessageContent.vue2.js +63 -0
  37. package/dist/components/2_feed_elements/DeletedMessageContent/icons/DeletedMessageIcon.vue.js +21 -0
  38. package/dist/components/2_feed_elements/EditTextMessage/EditTextMessage.vue.js +7 -0
  39. package/dist/components/2_feed_elements/EditTextMessage/EditTextMessage.vue2.js +35 -0
  40. package/dist/components/2_feed_elements/FileMessage/FileMessage.vue.js +2 -2
  41. package/dist/components/2_feed_elements/FileMessage/FileMessage.vue2.js +204 -157
  42. package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue.js +3 -3
  43. package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue2.js +273 -226
  44. package/dist/components/2_feed_elements/MessageKeyboard/MessageKeyboard.vue2.js +9 -7
  45. package/dist/components/2_feed_elements/MessageReactions/MessageReactions.vue.js +2 -2
  46. package/dist/components/2_feed_elements/MessageReactions/MessageReactions.vue2.js +141 -117
  47. package/dist/components/2_feed_elements/MessageReactions/icons/DeleteIcon.vue.js +32 -0
  48. package/dist/components/2_feed_elements/MessageReactions/icons/EditIcon.vue.js +32 -0
  49. package/dist/components/2_feed_elements/MessageReactions/icons/MessageActionsIcon.vue.js +21 -0
  50. package/dist/components/2_feed_elements/MissedCallMessage/MissedCallMessage.vue.js +4 -4
  51. package/dist/components/2_feed_elements/MissedCallMessage/MissedCallMessage.vue2.js +102 -66
  52. package/dist/components/2_feed_elements/ReplyAudioMessage/ReplyAudioMessage.vue2.js +11 -9
  53. package/dist/components/2_feed_elements/ReplyFileMessage/ReplyFileMessage.vue2.js +14 -12
  54. package/dist/components/2_feed_elements/ReplyImageMessage/ReplyImageMessage.vue2.js +11 -9
  55. package/dist/components/2_feed_elements/ReplyStickerMessage/ReplyStickerMessage.vue2.js +13 -11
  56. package/dist/components/2_feed_elements/ReplyTextMessage/ReplyTextMessage.vue2.js +11 -9
  57. package/dist/components/2_feed_elements/ReplyVideoMessage/ReplyVideoMessage.vue2.js +4 -2
  58. package/dist/components/2_feed_elements/StickerMessage/StickerMessage.vue.js +2 -2
  59. package/dist/components/2_feed_elements/StickerMessage/StickerMessage.vue2.js +255 -210
  60. package/dist/components/2_feed_elements/TextMessage/TextMessage.vue.js +1 -1
  61. package/dist/components/2_feed_elements/TextMessage/TextMessage.vue2.js +241 -140
  62. package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue.js +3 -3
  63. package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue2.js +245 -200
  64. package/dist/components/2_modals/ConfirmDeleteMessage/ConfirmDeleteMessage.vue.js +7 -0
  65. package/dist/components/2_modals/ConfirmDeleteMessage/ConfirmDeleteMessage.vue3.js +58 -0
  66. package/dist/components/3_compounds/ChatInput/ChatInput.vue.js +2 -2
  67. package/dist/components/3_compounds/ChatInput/ChatInput.vue2.js +5 -4
  68. package/dist/components/3_compounds/ChatList/ChatListHeader.vue.js +8 -8
  69. package/dist/components/3_compounds/ChatList/icons/LogoIcon.vue.js +12 -13
  70. package/dist/components/3_compounds/Feed/Feed.vue.js +2 -2
  71. package/dist/components/3_compounds/Feed/Feed.vue2.js +187 -163
  72. package/dist/components/3_compounds/Feed/composables/useFeedComponents.js +41 -26
  73. package/dist/components/3_compounds/Feed/composables/useFeedReply.js +16 -11
  74. package/dist/components/3_compounds/Feed/utils/getDefaultMessageMenuActions.js +31 -0
  75. package/dist/hooks/messages/buildEditPayload.js +10 -0
  76. package/dist/hooks/messages/calculateMessageMenuPosition.js +70 -0
  77. package/dist/hooks/messages/getDeletedOriginalText.js +26 -0
  78. package/dist/hooks/messages/getEditTooltipLines.js +28 -0
  79. package/dist/hooks/messages/useMessageActions.js +94 -19
  80. package/dist/hooks/messages/useMessageMenuActions.js +18 -0
  81. package/dist/hooks/messages/useStartEdit.js +30 -0
  82. package/dist/hooks/messages/useStartReply.js +16 -14
  83. package/dist/hooks/modals/useConfirmDeleteMessage.js +24 -0
  84. package/dist/hooks/useMessageDraft.js +46 -66
  85. package/dist/hooks/validators/messages/messageValidator.js +29 -35
  86. package/dist/index.js +220 -194
  87. package/dist/locale/en.js +6 -1
  88. package/dist/locale/ru.js +6 -1
  89. package/dist/themes/dark.css +1 -1
  90. package/dist/themes/default.css +1 -1
  91. package/dist/themes/glass.css +1 -1
  92. package/dist/themes/green.css +1 -1
  93. package/dist/themes/mobilon1.css +1 -1
  94. package/dist/types/apps/data/messages.d.ts +0 -321
  95. package/dist/types/components/1_atoms/ContextMenu/ContextMenu.vue.d.ts +0 -2
  96. package/dist/types/components/1_atoms/ContextMenu/stories/ContextMenu.stories.d.ts +1 -0
  97. package/dist/types/components/1_atoms/ContextMenu/styles/types.d.ts +18 -0
  98. package/dist/types/components/1_atoms/LoadingIndicator/styles/types.d.ts +0 -2
  99. package/dist/types/components/1_atoms/Tooltip/Tooltip.vue.d.ts +12 -1
  100. package/dist/types/components/2_blocks/CommunicationPanel/CommunicationPanel.vue.d.ts +2 -0
  101. package/dist/types/components/2_blocks/CommunicationPanel/composables/useCommunicationActions.d.ts +3 -1
  102. package/dist/types/components/2_blocks/CommunicationPanel/composables/useCommunicationMenu.d.ts +3 -0
  103. package/dist/types/components/2_blocks/CommunicationPanel/composables/useCommunicationSubMenu.d.ts +4 -2
  104. package/dist/types/components/2_blocks/CommunicationPanel/stories/CommunicationPanel.stories.d.ts +1 -0
  105. package/dist/types/components/2_feed_elements/BaseEditMessage/BaseEditMessage.vue.d.ts +23 -0
  106. package/dist/types/components/2_feed_elements/BaseEditMessage/stories/BaseEditMessage.stories.d.ts +6 -0
  107. package/dist/types/components/2_feed_elements/DeletedMessageContent/DeletedMessageContent.vue.d.ts +31 -0
  108. package/dist/types/components/2_feed_elements/DeletedMessageContent/icons/DeletedMessageIcon.vue.d.ts +2 -0
  109. package/dist/types/components/2_feed_elements/DeletedMessageContent/styles/types.d.ts +35 -0
  110. package/dist/types/components/2_feed_elements/EditTextMessage/EditTextMessage.vue.d.ts +13 -0
  111. package/dist/types/components/2_feed_elements/EditTextMessage/stories/EditTextMessage.stories.d.ts +7 -0
  112. package/dist/types/components/2_feed_elements/FeedKeyboard/FeedKeyboard.vue.d.ts +1 -1
  113. package/dist/types/components/2_feed_elements/MessageKeyboard/MessageKeyboard.vue.d.ts +1 -1
  114. package/dist/types/components/2_feed_elements/MessageReactions/MessageReactions.vue.d.ts +35 -0
  115. package/dist/types/components/2_feed_elements/MessageReactions/icons/DeleteIcon.vue.d.ts +2 -0
  116. package/dist/types/components/2_feed_elements/MessageReactions/icons/EditIcon.vue.d.ts +2 -0
  117. package/dist/types/components/2_feed_elements/MessageReactions/icons/MessageActionsIcon.vue.d.ts +2 -0
  118. package/dist/types/components/2_feed_elements/TextMessage/TextMessage.vue.d.ts +11 -3
  119. package/dist/types/components/2_feed_elements/TextMessage/stories/TextMessage.stories.d.ts +1 -0
  120. package/dist/types/components/2_feed_elements/TextMessage/styles/types.d.ts +22 -0
  121. package/dist/types/components/2_feed_elements/VideoMessage/stories/VideoMessage.stories.d.ts +2 -2
  122. package/dist/types/components/2_feed_elements/types/components.d.ts +1 -2
  123. package/dist/types/components/2_feed_elements/types/messages.d.ts +116 -9
  124. package/dist/types/components/2_modals/ConfirmDeleteMessage/ConfirmDeleteMessage.vue.d.ts +22 -0
  125. package/dist/types/components/2_modals/ConfirmDeleteMessage/stories/ConfirmDeleteMessage.stories.d.ts +37 -0
  126. package/dist/types/components/2_modals/ConfirmDeleteMessage/styles/types.d.ts +97 -0
  127. package/dist/types/components/3_compounds/ChatInput/types/IInputMessage.d.ts +2 -1
  128. package/dist/types/components/3_compounds/ChatList/styles/types.d.ts +2 -2
  129. package/dist/types/components/3_compounds/Feed/Feed.vue.d.ts +20 -3
  130. package/dist/types/components/3_compounds/Feed/composables/useFeedComponents.d.ts +6 -2
  131. package/dist/types/components/3_compounds/Feed/composables/useFeedGrouping.d.ts +0 -1
  132. package/dist/types/components/3_compounds/Feed/composables/useFeedReply.d.ts +7 -1
  133. package/dist/types/components/3_compounds/Feed/utils/getDefaultMessageMenuActions.d.ts +3 -0
  134. package/dist/types/components/3_compounds/SideBar/SideBar.vue.d.ts +2 -2
  135. package/dist/types/components/index.d.ts +4 -0
  136. package/dist/types/hooks/messages/buildEditPayload.d.ts +7 -0
  137. package/dist/types/hooks/messages/calculateMessageMenuPosition.d.ts +16 -0
  138. package/dist/types/hooks/messages/getDeletedOriginalText.d.ts +28 -0
  139. package/dist/types/hooks/messages/getEditTooltipLines.d.ts +17 -0
  140. package/dist/types/hooks/messages/index.d.ts +6 -0
  141. package/dist/types/hooks/messages/useMessageActions.d.ts +33 -39
  142. package/dist/types/hooks/messages/useMessageMenuActions.d.ts +10 -0
  143. package/dist/types/hooks/messages/useStartEdit.d.ts +6 -0
  144. package/dist/types/hooks/modals/index.d.ts +1 -0
  145. package/dist/types/hooks/modals/useConfirmDeleteMessage.d.ts +2 -0
  146. package/dist/types/hooks/useMessageDraft.d.ts +10 -1
  147. package/dist/types/hooks/validators/messages/types.d.ts +0 -6
  148. package/dist/types/locale/en.d.ts +5 -0
  149. package/dist/types/locale/ru.d.ts +5 -0
  150. package/dist/types/main.d.ts +1 -0
  151. package/package.json +1 -1
@@ -0,0 +1,31 @@
1
+ import e from "../../../2_feed_elements/MessageReactions/icons/ReplyIcon.vue.js";
2
+ import i from "../../../2_feed_elements/MessageReactions/icons/EditIcon.vue.js";
3
+ import o from "../../../2_feed_elements/MessageReactions/icons/DeleteIcon.vue.js";
4
+ function c() {
5
+ return [
6
+ {
7
+ action: "reply",
8
+ title: "Ответить",
9
+ icon: e
10
+ },
11
+ {
12
+ action: "edit",
13
+ title: "Редактировать",
14
+ icon: i,
15
+ // Чужие / нетекст / окно редактирования истекло / уже удалено
16
+ disabled: (t) => t.canEdit === !1 || !!t.deleted || t.position !== "right" || t.type != null && t.type !== "message.text"
17
+ },
18
+ { separator: !0 },
19
+ {
20
+ action: "delete",
21
+ title: "Удалить",
22
+ icon: o,
23
+ danger: !0,
24
+ // Окно удаления истекло или сообщение уже удалено
25
+ disabled: (t) => t.canDelete === !1 || !!t.deleted
26
+ }
27
+ ];
28
+ }
29
+ export {
30
+ c as getDefaultMessageMenuActions
31
+ };
@@ -0,0 +1,10 @@
1
+ function d(t, e = "message.text") {
2
+ return {
3
+ messageId: String(t.messageId),
4
+ type: t.type ?? e,
5
+ text: t.text
6
+ };
7
+ }
8
+ export {
9
+ d as buildEditPayload
10
+ };
@@ -0,0 +1,70 @@
1
+ import { nextTick as m } from "vue";
2
+ import { findMessageContent as x, isRightMessage as R } from "../../components/2_feed_elements/MessageReactions/composables/usePositioning.js";
3
+ function H(o) {
4
+ const i = {
5
+ left: 0,
6
+ top: 0,
7
+ right: window.innerWidth,
8
+ bottom: window.innerHeight
9
+ };
10
+ if (!o)
11
+ return new DOMRect(0, 0, window.innerWidth, window.innerHeight);
12
+ let t = o, n = null, g = null;
13
+ for (; t; ) {
14
+ if (t.classList.contains("base__container") || t.classList.contains("base") || t.classList.contains("chat-app")) {
15
+ g = t;
16
+ break;
17
+ }
18
+ t.hasAttribute("data-theme") && (n = t), t = t.parentElement;
19
+ }
20
+ const d = g || n;
21
+ if (!d)
22
+ return new DOMRect(0, 0, window.innerWidth, window.innerHeight);
23
+ const r = d.getBoundingClientRect(), c = Math.max(i.left, r.left), e = Math.max(i.top, r.top), a = Math.min(i.right, r.right), h = Math.min(i.bottom, r.bottom);
24
+ return new DOMRect(c, e, Math.max(0, a - c), Math.max(0, h - e));
25
+ }
26
+ function b(o, i, t) {
27
+ return t < i ? i : Math.max(i, Math.min(o, t));
28
+ }
29
+ async function A(o, i) {
30
+ const {
31
+ triggerRect: t,
32
+ boundsElement: n,
33
+ estimatedWidth: g = 220,
34
+ estimatedHeight: d = 152
35
+ } = i;
36
+ await m();
37
+ const r = (o == null ? void 0 : o.offsetWidth) || g, c = (o == null ? void 0 : o.offsetHeight) || d, e = H(n), a = 8, h = 4;
38
+ let s = t;
39
+ if (!s && n) {
40
+ const p = (x(n) || n).getBoundingClientRect();
41
+ s = {
42
+ top: p.top,
43
+ right: p.right,
44
+ bottom: p.bottom,
45
+ left: p.left,
46
+ width: p.width,
47
+ height: p.height
48
+ };
49
+ }
50
+ if (!s) return {};
51
+ const u = n ? R(n) : !1, w = e.bottom - s.bottom - h - a, M = s.top - e.top - h - a;
52
+ let f;
53
+ w >= c || w >= M ? f = s.bottom + h : f = s.top - c - h;
54
+ let l = u ? s.right - r : s.left;
55
+ return l = b(l, e.left + a, e.right - r - a), f = b(f, e.top + a, e.bottom - c - a), {
56
+ position: "fixed",
57
+ top: `${f}px`,
58
+ left: `${l}px`,
59
+ right: "auto",
60
+ bottom: "auto",
61
+ marginTop: "0",
62
+ transform: "none",
63
+ zIndex: "1000",
64
+ display: "block"
65
+ };
66
+ }
67
+ export {
68
+ A as calculateMessageMenuPosition,
69
+ H as findAppBoundsRect
70
+ };
@@ -0,0 +1,26 @@
1
+ function f(t, n) {
2
+ const r = t == null ? void 0 : t.trim(), i = n == null ? void 0 : n.trim();
3
+ return r && i ? `${r}, ${i}` : r || i || "";
4
+ }
5
+ function o(t) {
6
+ const n = typeof t.text == "string" ? t.text.trim() : "";
7
+ if (n) return n;
8
+ const r = typeof t.filename == "string" ? t.filename.trim() : "";
9
+ if (r) return r;
10
+ const i = typeof t.alt == "string" ? t.alt.trim() : "";
11
+ return i || "";
12
+ }
13
+ function u(t) {
14
+ var n, r;
15
+ return {
16
+ original: o(t),
17
+ meta: f((n = t.deletion) == null ? void 0 : n.deletedBy, (r = t.deletion) == null ? void 0 : r.deletedAt)
18
+ };
19
+ }
20
+ function e(t) {
21
+ return o(t);
22
+ }
23
+ export {
24
+ e as getDeletedOriginalText,
25
+ u as getDeletedTooltipLines
26
+ };
@@ -0,0 +1,28 @@
1
+ function u({ editedBy: t, editedAt: r }) {
2
+ const i = t == null ? void 0 : t.trim(), n = r == null ? void 0 : r.trim();
3
+ return i && n ? `${i}, ${n}` : i || n || "";
4
+ }
5
+ function a(t) {
6
+ var r;
7
+ return (r = t.history) != null && r.length ? t.history : t.editedBy || t.editedAt || t.originalText ? [{
8
+ text: t.originalText,
9
+ editedBy: t.editedBy,
10
+ editedAt: t.editedAt
11
+ }] : [];
12
+ }
13
+ function f(t) {
14
+ var n;
15
+ if (!t)
16
+ return { edits: [] };
17
+ const r = ((n = t.originalText) == null ? void 0 : n.trim()) || void 0, i = a(t).map((o) => {
18
+ var s;
19
+ return {
20
+ text: ((s = o.text) == null ? void 0 : s.trim()) || "",
21
+ meta: u(o)
22
+ };
23
+ }).filter((o) => o.text || o.meta);
24
+ return { original: r, edits: i };
25
+ }
26
+ export {
27
+ f as getEditTooltipLines
28
+ };
@@ -1,28 +1,103 @@
1
- import { ref as i } from "vue";
2
- const r = (t, e) => {
3
- const o = i(!1), s = i(!1), l = () => {
4
- s.value = !0;
5
- }, n = () => {
6
- s.value = !1, o.value = !1;
1
+ import { ref as u, inject as L, computed as C, watch as P, onMounted as H, onUnmounted as x, nextTick as O } from "vue";
2
+ import { useConfirmDeleteMessage as j } from "../modals/useConfirmDeleteMessage.js";
3
+ import { useTheme as B } from "../useTheme.js";
4
+ import { calculateMessageMenuPosition as D } from "./calculateMessageMenuPosition.js";
5
+ function m(t) {
6
+ if (!t) return null;
7
+ if (t instanceof HTMLElement) return t;
8
+ const o = t.$el;
9
+ return o instanceof HTMLElement ? o : null;
10
+ }
11
+ function M(t) {
12
+ if (!t) return null;
13
+ if (t instanceof Event) {
14
+ const o = t.currentTarget;
15
+ if (o instanceof HTMLElement) {
16
+ const n = o.getBoundingClientRect();
17
+ return { top: n.top, right: n.right, bottom: n.bottom, left: n.left, width: n.width, height: n.height };
18
+ }
19
+ return null;
20
+ }
21
+ return "triggerRect" in t && t.triggerRect ? t.triggerRect : "event" in t && t.event instanceof Event ? M(t.event) : "top" in t && "left" in t && "bottom" in t && "right" in t ? t : null;
22
+ }
23
+ const F = (t, o, n = {}) => {
24
+ const r = u(!1), a = u(!1), d = u(null), c = u(null), g = u({}), f = u(null), w = L("chatAppId", void 0), { getTheme: T } = B(w || ""), R = C(() => T().theme || "light"), y = () => {
25
+ a.value = !0;
26
+ }, E = (e) => {
27
+ const i = m(c.value);
28
+ e != null && e.relatedTarget && (i != null && i.contains(e.relatedTarget)) || (a.value = !1);
29
+ }, s = () => {
30
+ a.value = !1, r.value = !1, f.value = null;
31
+ }, k = () => {
32
+ a.value = !0;
33
+ }, A = () => {
34
+ s();
35
+ }, h = (e) => {
36
+ f.value = M(e), r.value = !0;
37
+ }, b = (e) => {
38
+ if (r.value) {
39
+ s();
40
+ return;
41
+ }
42
+ h(e);
7
43
  };
8
- return {
9
- // state
10
- isOpenMenu: o,
11
- buttonMenuVisible: s,
12
- // actions
13
- showMenu: l,
14
- hideMenu: n,
15
- clickAction: (c) => {
16
- n(), e("action", { messageId: t.messageId, type: "menu", ...c });
44
+ async function I() {
45
+ await O();
46
+ let e = 0;
47
+ for (; !m(c.value) && e < 20; )
48
+ await new Promise((l) => setTimeout(l, 10)), e++;
49
+ const i = m(c.value);
50
+ for (e = 0; i && i.offsetWidth === 0 && e < 10; )
51
+ await new Promise((l) => setTimeout(l, 10)), e++;
52
+ g.value = await D(i, {
53
+ triggerRect: f.value,
54
+ boundsElement: d.value
55
+ });
56
+ }
57
+ P(r, async (e) => {
58
+ e ? await I() : (g.value = {}, f.value = null);
59
+ });
60
+ function p(e) {
61
+ if (!r.value) return;
62
+ const i = e.target, l = m(c.value), v = d.value;
63
+ l != null && l.contains(i) || v != null && v.contains(i) || s();
64
+ }
65
+ return H(() => {
66
+ document.addEventListener("click", p, !0);
67
+ }), x(() => {
68
+ document.removeEventListener("click", p, !0);
69
+ }), {
70
+ isOpenMenu: r,
71
+ buttonMenuVisible: a,
72
+ menuAnchorRef: d,
73
+ menuRef: c,
74
+ menuStyle: g,
75
+ menuTheme: R,
76
+ showMenu: y,
77
+ hideMenu: E,
78
+ openMenu: h,
79
+ toggleMenu: b,
80
+ onMenuMouseEnter: k,
81
+ onMenuMouseLeave: A,
82
+ clickAction: async (e) => {
83
+ if (s(), e.action === "reply" && n.onReply) {
84
+ n.onReply();
85
+ return;
86
+ }
87
+ if (e.action === "edit" && n.onEdit) {
88
+ n.onEdit();
89
+ return;
90
+ }
91
+ e.action === "delete" && !await j() || o("action", { messageId: t.messageId, type: "menu", ...e });
17
92
  },
18
93
  viewsAction: () => {
19
- n(), e("action", { messageId: t.messageId, type: "views" });
94
+ s(), o("action", { messageId: t.messageId, type: "views" });
20
95
  },
21
- handleClickReplied: (c) => {
22
- e("reply", c);
96
+ handleClickReplied: (e) => {
97
+ o("reply", e);
23
98
  }
24
99
  };
25
100
  };
26
101
  export {
27
- r as useMessageActions
102
+ F as useMessageActions
28
103
  };
@@ -0,0 +1,18 @@
1
+ import { inject as u, computed as i, unref as c, toValue as a } from "vue";
2
+ import { getDefaultMessageMenuActions as f } from "../../components/3_compounds/Feed/utils/getDefaultMessageMenuActions.js";
3
+ function m(e, t) {
4
+ return typeof e == "function" ? !!e(t) : !!e;
5
+ }
6
+ function l(e = {}) {
7
+ const t = u("messageMenuActions", void 0);
8
+ return { menuActions: i(() => {
9
+ const r = c(t), s = Array.isArray(r) ? r : f(), o = a(e) ?? {};
10
+ return s.map((n) => n.separator ? n : {
11
+ ...n,
12
+ disabled: m(n.disabled, o)
13
+ });
14
+ }) };
15
+ }
16
+ export {
17
+ l as useMessageMenuActions
18
+ };
@@ -0,0 +1,30 @@
1
+ import "vue";
2
+ import { useMessageDraft as p } from "../useMessageDraft.js";
3
+ import "../useSearchModel.js";
4
+ import "../useTheme.js";
5
+ import "../useEmojiNative.js";
6
+ /* empty css */
7
+ /* empty css */
8
+ import "../../locale/useLocale.js";
9
+ /* empty css */
10
+ import "../../node_modules/linkifyjs/dist/linkify.js";
11
+ import "../../node_modules/linkify-string/dist/linkify-string.js";
12
+ import "../../functions/parseMarkdown.js";
13
+ import { hideReplyPreview as s, showReplyPreview as r } from "./useStartReply.js";
14
+ function R(t) {
15
+ const { setEdit: e, setMessageText: o, resetReply: m } = p(t);
16
+ return { startEdit: (i) => {
17
+ m(), r(t), e(i), o(i.text ?? "");
18
+ } };
19
+ }
20
+ function g(t) {
21
+ s(t);
22
+ }
23
+ function M(t) {
24
+ r(t);
25
+ }
26
+ export {
27
+ g as hideEditPreview,
28
+ M as showEditPreview,
29
+ R as useStartEdit
30
+ };
@@ -1,29 +1,31 @@
1
1
  import "vue";
2
- import { useMessageDraft as r } from "../useMessageDraft.js";
2
+ import { useMessageDraft as p } from "../useMessageDraft.js";
3
3
  import "../useSearchModel.js";
4
4
  import "../useTheme.js";
5
5
  import "../useEmojiNative.js";
6
6
  /* empty css */
7
7
  /* empty css */
8
+ import "../../locale/useLocale.js";
9
+ /* empty css */
8
10
  import "../../node_modules/linkifyjs/dist/linkify.js";
9
11
  import "../../node_modules/linkify-string/dist/linkify-string.js";
10
12
  import "../../functions/parseMarkdown.js";
11
- function n(e) {
12
- const t = document.getElementById("chat-input-reply-line-" + e);
13
- t && (t.style.display = "inherit");
13
+ function s(t) {
14
+ const e = document.getElementById("chat-input-reply-line-" + t);
15
+ e && (e.style.display = "inherit");
14
16
  }
15
- function R(e) {
16
- const t = document.getElementById("chat-input-reply-line-" + e);
17
- t && (t.style.display = "none");
17
+ function E(t) {
18
+ const e = document.getElementById("chat-input-reply-line-" + t);
19
+ e && (e.style.display = "none");
18
20
  }
19
- function w(e) {
20
- const { setReply: t } = r(e);
21
- return { startReply: (i) => {
22
- n(e), t(i);
21
+ function M(t) {
22
+ const { setReply: e, resetEdit: i, setMessageText: r, getMessage: o } = p(t);
23
+ return { startReply: (n) => {
24
+ o().edit && (i(), r("")), s(t), e(n);
23
25
  } };
24
26
  }
25
27
  export {
26
- R as hideReplyPreview,
27
- n as showReplyPreview,
28
- w as useStartReply
28
+ E as hideReplyPreview,
29
+ s as showReplyPreview,
30
+ M as useStartReply
29
31
  };
@@ -0,0 +1,24 @@
1
+ import { createApp as u } from "vue";
2
+ import l from "../../components/2_modals/ConfirmDeleteMessage/ConfirmDeleteMessage.vue.js";
3
+ function i(n) {
4
+ var o;
5
+ return n || ((o = document.querySelector("[data-theme]")) == null ? void 0 : o.getAttribute("data-theme")) || "light";
6
+ }
7
+ function d(n) {
8
+ return new Promise((o) => {
9
+ const e = document.createElement("div");
10
+ document.body.appendChild(e);
11
+ let t = null;
12
+ const r = (m) => {
13
+ t && (t.unmount(), t = null), e.parentNode && e.parentNode.removeChild(e), o(m);
14
+ };
15
+ t = u(l, {
16
+ theme: i(n),
17
+ onConfirm: () => r(!0),
18
+ onCancel: () => r(!1)
19
+ }), t.mount(e);
20
+ });
21
+ }
22
+ export {
23
+ d as useConfirmDeleteMessage
24
+ };
@@ -1,87 +1,67 @@
1
- import { ref as o } from "vue";
2
- const s = o([]), x = (t) => {
3
- const i = o(0), d = s.value.find(({ id: l }) => l == t);
4
- d != null ? i.value = s.value.indexOf(d) : (s.value.push({
5
- id: t,
1
+ import { ref as l } from "vue";
2
+ const s = l([]), y = (n) => {
3
+ const t = l(0), a = s.value.find(({ id: e }) => e == n);
4
+ a != null ? t.value = s.value.indexOf(a) : (s.value.push({
5
+ id: n,
6
6
  text: "",
7
7
  file: void 0,
8
8
  forceSend: !1,
9
9
  isRecording: !1
10
- }), i.value = s.value.length - 1);
11
- const n = () => {
12
- s.value[i.value] = {
13
- id: e().id,
10
+ }), t.value = s.value.length - 1);
11
+ const c = () => {
12
+ s.value[t.value] = {
13
+ id: i().id,
14
14
  text: "",
15
15
  file: void 0,
16
16
  reply: void 0,
17
+ edit: void 0,
17
18
  forceSend: !1,
18
- isRecording: e().isRecording
19
+ isRecording: i().isRecording
19
20
  };
20
- }, r = (l) => {
21
- s.value[i.value] = {
22
- id: e().id,
23
- text: l,
24
- file: e().file,
25
- reply: e().reply,
21
+ }, o = (e) => {
22
+ const d = i();
23
+ s.value[t.value] = {
24
+ ...d,
26
25
  forceSend: !1,
27
- isRecording: e().isRecording
28
- };
29
- }, a = (l) => {
30
- s.value[i.value] = {
31
- id: e().id,
32
- text: e().text,
33
- file: l,
34
- reply: e().reply,
35
- forceSend: !1,
36
- isRecording: e().isRecording
37
- };
38
- }, c = () => {
39
- s.value[i.value] = {
40
- id: e().id,
41
- text: e().text,
42
- file: void 0,
43
- reply: e().reply,
44
- forceSend: !1,
45
- isRecording: e().isRecording
46
- };
47
- }, f = (l) => {
48
- s.value[i.value] = {
49
- id: e().id,
50
- text: e().text,
51
- file: e().file,
52
- reply: l,
53
- forceSend: !1,
54
- isRecording: e().isRecording
55
- };
56
- }, g = () => {
57
- s.value[i.value] = {
58
- id: e().id,
59
- text: e().text,
60
- file: e().file,
61
- reply: void 0,
62
- forceSend: !1,
63
- isRecording: e().isRecording
26
+ ...e,
27
+ id: d.id
64
28
  };
29
+ }, r = (e) => {
30
+ o({ text: e });
31
+ }, v = (e) => {
32
+ o({ file: e });
33
+ }, u = () => {
34
+ o({ file: void 0 });
35
+ }, g = (e) => {
36
+ o({ reply: e, edit: void 0 });
37
+ }, f = () => {
38
+ o({ reply: void 0 });
39
+ }, M = (e) => {
40
+ o({ edit: e, reply: void 0 });
41
+ }, p = () => {
42
+ o({ edit: void 0 });
65
43
  };
66
- function e() {
67
- return s.value[i.value];
44
+ function i() {
45
+ return s.value[t.value];
68
46
  }
69
47
  return {
70
- getMessage: e,
71
- resetMessage: n,
72
- setMessageFile: a,
73
- resetMessageFile: c,
48
+ getMessage: i,
49
+ resetMessage: c,
50
+ setMessageFile: v,
51
+ resetMessageFile: u,
74
52
  setMessageText: r,
75
- setReply: f,
76
- resetReply: g,
77
- setForceSendMessage: (l) => {
78
- s.value[i.value].forceSend = l;
53
+ setReply: g,
54
+ resetReply: f,
55
+ setEdit: M,
56
+ resetEdit: p,
57
+ setForceSendMessage: (e) => {
58
+ s.value[t.value].forceSend = e;
79
59
  },
80
- setRecordingMessage: (l) => {
81
- s.value[i.value].isRecording = l;
60
+ setRecordingMessage: (e) => {
61
+ s.value[t.value].isRecording = e;
82
62
  }
83
63
  };
84
64
  };
85
65
  export {
86
- x as useMessageDraft
66
+ y as useMessageDraft
87
67
  };
@@ -1,13 +1,9 @@
1
- function n(t, s, e) {
2
- const i = [], a = `messages[${s}].actions[${e}]`;
3
- return typeof t != "object" || t === null ? (i.push({ path: a, message: "Action должен быть объектом", value: t }), i) : ((!t.action || typeof t.action != "string") && i.push({ path: `${a}.action`, message: "Поле action обязательно и должно быть строкой", value: t.action }), (!t.title || typeof t.title != "string") && i.push({ path: `${a}.title`, message: "Поле title обязательно и должно быть строкой", value: t.title }), t.icon !== void 0 && typeof t.icon != "string" && i.push({ path: `${a}.icon`, message: "Поле icon должно быть строкой", value: t.icon }), i);
4
- }
5
- function h(t, s) {
6
- const e = [], i = `messages[${s}].reply`;
1
+ function h(t, d) {
2
+ const e = [], i = `messages[${d}].reply`;
7
3
  return typeof t != "object" || t === null ? (e.push({ path: i, message: "Reply должен быть объектом", value: t }), e) : (t.messageId === void 0 ? e.push({ path: `${i}.messageId`, message: "Поле messageId обязательно", value: t.messageId }) : typeof t.messageId != "string" && typeof t.messageId != "number" && e.push({ path: `${i}.messageId`, message: "Поле messageId должно быть строкой или числом", value: t.messageId }), (!t.type || typeof t.type != "string") && e.push({ path: `${i}.type`, message: "Поле type обязательно и должно быть строкой", value: t.type }), t.text !== void 0 && typeof t.text != "string" && e.push({ path: `${i}.text`, message: "Поле text должно быть строкой", value: t.text }), t.url !== void 0 && typeof t.url != "string" && e.push({ path: `${i}.url`, message: "Поле url должно быть строкой", value: t.url }), t.filename !== void 0 && typeof t.filename != "string" && e.push({ path: `${i}.filename`, message: "Поле filename должно быть строкой", value: t.filename }), e);
8
4
  }
9
- function f(t, s) {
10
- const e = [], i = `messages[${s}]`;
5
+ function n(t, d) {
6
+ const e = [], i = `messages[${d}]`;
11
7
  if (typeof t != "object" || t === null)
12
8
  return e.push({ path: i, message: "Сообщение должно быть объектом", value: t }), e;
13
9
  if (t.chatId !== void 0 && typeof t.chatId != "string" && e.push({ path: `${i}.chatId`, message: "Поле chatId должно быть строкой", value: t.chatId }), t.type !== "system.date" && (t.messageId === void 0 ? e.push({ path: `${i}.messageId`, message: "Поле messageId обязательно", value: t.messageId }) : typeof t.messageId != "string" && typeof t.messageId != "number" && e.push({ path: `${i}.messageId`, message: "Поле messageId должно быть строкой или числом", value: t.messageId })), (!t.type || typeof t.type != "string") && e.push({ path: `${i}.type`, message: "Поле type обязательно и должно быть строкой", value: t.type }), t.type !== "system.date" && (t.timestamp === void 0 ? e.push({ path: `${i}.timestamp`, message: "Поле timestamp обязательно", value: t.timestamp }) : typeof t.timestamp != "string" && typeof t.timestamp != "number" && e.push({ path: `${i}.timestamp`, message: "Поле timestamp должно быть строкой или числом", value: t.timestamp })), t.dialogId !== void 0 && typeof t.dialogId != "string" && e.push({ path: `${i}.dialogId`, message: "Поле dialogId должно быть строкой", value: t.dialogId }), t.direction !== void 0) {
@@ -26,12 +22,10 @@ function f(t, s) {
26
22
  value: t.status
27
23
  });
28
24
  }
29
- return t.text !== void 0 && typeof t.text != "string" && e.push({ path: `${i}.text`, message: "Поле text должно быть строкой", value: t.text }), t.header !== void 0 && typeof t.header != "string" && e.push({ path: `${i}.header`, message: "Поле header должно быть строкой", value: t.header }), t.subText !== void 0 && typeof t.subText != "string" && e.push({ path: `${i}.subText`, message: "Поле subText должно быть строкой", value: t.subText }), t.avatar !== void 0 && typeof t.avatar != "string" && e.push({ path: `${i}.avatar`, message: "Поле avatar должно быть строкой", value: t.avatar }), t.url !== void 0 && typeof t.url != "string" && e.push({ path: `${i}.url`, message: "Поле url должно быть строкой", value: t.url }), t.filename !== void 0 && typeof t.filename != "string" && e.push({ path: `${i}.filename`, message: "Поле filename должно быть строкой", value: t.filename }), t.views !== void 0 && typeof t.views != "number" && e.push({ path: `${i}.views`, message: "Поле views должно быть числом", value: t.views }), t.actions !== void 0 && (Array.isArray(t.actions) ? t.actions.forEach((a, p) => {
30
- e.push(...n(a, s, p));
31
- }) : e.push({ path: `${i}.actions`, message: "Поле actions должно быть массивом", value: t.actions })), t.reply !== void 0 && e.push(...h(t.reply, s)), t.embed !== void 0 && (typeof t.embed != "object" || t.embed === null ? e.push({ path: `${i}.embed`, message: "Поле embed должно быть объектом", value: t.embed }) : ((!t.embed.type || typeof t.embed.type != "string") && e.push({ path: `${i}.embed.type`, message: "Поле embed.type обязательно и должно быть строкой", value: t.embed.type }), (!t.embed.url || typeof t.embed.url != "string") && e.push({ path: `${i}.embed.url`, message: "Поле embed.url обязательно и должно быть строкой", value: t.embed.url }))), e;
25
+ return t.text !== void 0 && typeof t.text != "string" && e.push({ path: `${i}.text`, message: "Поле text должно быть строкой", value: t.text }), t.header !== void 0 && typeof t.header != "string" && e.push({ path: `${i}.header`, message: "Поле header должно быть строкой", value: t.header }), t.subText !== void 0 && typeof t.subText != "string" && e.push({ path: `${i}.subText`, message: "Поле subText должно быть строкой", value: t.subText }), t.avatar !== void 0 && typeof t.avatar != "string" && e.push({ path: `${i}.avatar`, message: "Поле avatar должно быть строкой", value: t.avatar }), t.url !== void 0 && typeof t.url != "string" && e.push({ path: `${i}.url`, message: "Поле url должно быть строкой", value: t.url }), t.filename !== void 0 && typeof t.filename != "string" && e.push({ path: `${i}.filename`, message: "Поле filename должно быть строкой", value: t.filename }), t.views !== void 0 && typeof t.views != "number" && e.push({ path: `${i}.views`, message: "Поле views должно быть числом", value: t.views }), t.reply !== void 0 && e.push(...h(t.reply, d)), t.embed !== void 0 && (typeof t.embed != "object" || t.embed === null ? e.push({ path: `${i}.embed`, message: "Поле embed должно быть объектом", value: t.embed }) : ((!t.embed.type || typeof t.embed.type != "string") && e.push({ path: `${i}.embed.type`, message: "Поле embed.type обязательно и должно быть строкой", value: t.embed.type }), (!t.embed.url || typeof t.embed.url != "string") && e.push({ path: `${i}.embed.url`, message: "Поле embed.url обязательно и должно быть строкой", value: t.embed.url }))), e;
32
26
  }
33
- function l(t) {
34
- const s = [], e = [];
27
+ function f(t) {
28
+ const d = [], e = [];
35
29
  if (!Array.isArray(t))
36
30
  return {
37
31
  isValid: !1,
@@ -44,41 +38,41 @@ function l(t) {
44
38
  if (a && typeof a == "object" && a.chatId !== void 0 && a.messageId !== void 0) {
45
39
  const u = a.dialogId ? `${a.chatId}:${a.dialogId}` : `${a.chatId}`;
46
40
  i.has(u) || i.set(u, /* @__PURE__ */ new Set());
47
- const o = i.get(u);
48
- if (o.has(a.messageId)) {
49
- const d = a.dialogId ? `в чате ${a.chatId}, диалоге ${a.dialogId}` : `в чате ${a.chatId}`;
50
- s.push({
41
+ const s = i.get(u);
42
+ if (s.has(a.messageId)) {
43
+ const o = a.dialogId ? `в чате ${a.chatId}, диалоге ${a.dialogId}` : `в чате ${a.chatId}`;
44
+ d.push({
51
45
  path: `messages[${p}].messageId`,
52
- message: `Дублирующийся messageId ${d}`,
46
+ message: `Дублирующийся messageId ${o}`,
53
47
  value: a.messageId
54
48
  });
55
49
  } else
56
- o.add(a.messageId);
50
+ s.add(a.messageId);
57
51
  }
58
52
  }), t.forEach((a, p) => {
59
- s.push(...f(a, p));
53
+ d.push(...n(a, p));
60
54
  }), {
61
- isValid: s.length === 0,
62
- errors: s,
55
+ isValid: d.length === 0,
56
+ errors: d,
63
57
  warnings: e
64
58
  };
65
59
  }
66
- function r(t) {
67
- const s = [];
68
- return s.push(`=== РЕЗУЛЬТАТ ВАЛИДАЦИИ СООБЩЕНИЙ ===
69
- `), t.isValid ? s.push(`✅ Данные валидны!
70
- `) : s.push(`❌ Обнаружены ошибки!
71
- `), t.errors.length > 0 && (s.push(`
60
+ function l(t) {
61
+ const d = [];
62
+ return d.push(`=== РЕЗУЛЬТАТ ВАЛИДАЦИИ СООБЩЕНИЙ ===
63
+ `), t.isValid ? d.push(`✅ Данные валидны!
64
+ `) : d.push(`❌ Обнаружены ошибки!
65
+ `), t.errors.length > 0 && (d.push(`
72
66
  🔴 ОШИБКИ (${t.errors.length}):`), t.errors.forEach((e, i) => {
73
- s.push(` ${i + 1}. [${e.path}] ${e.message}`), e.value !== void 0 && s.push(` Значение: ${JSON.stringify(e.value)}`);
74
- })), t.warnings.length > 0 && (s.push(`
67
+ d.push(` ${i + 1}. [${e.path}] ${e.message}`), e.value !== void 0 && d.push(` Значение: ${JSON.stringify(e.value)}`);
68
+ })), t.warnings.length > 0 && (d.push(`
75
69
  ⚠️ ПРЕДУПРЕЖДЕНИЯ (${t.warnings.length}):`), t.warnings.forEach((e, i) => {
76
- s.push(` ${i + 1}. [${e.path}] ${e.message}`), e.value !== void 0 && s.push(` Значение: ${JSON.stringify(e.value)}`);
77
- })), s.push(`
78
- ` + "=".repeat(40)), s.join(`
70
+ d.push(` ${i + 1}. [${e.path}] ${e.message}`), e.value !== void 0 && d.push(` Значение: ${JSON.stringify(e.value)}`);
71
+ })), d.push(`
72
+ ` + "=".repeat(40)), d.join(`
79
73
  `);
80
74
  }
81
75
  export {
82
- r as getMessageValidationReport,
83
- l as validateMessages
76
+ l as getMessageValidationReport,
77
+ f as validateMessages
84
78
  };