@mobilon-dev/chotto 0.3.84 → 0.3.85

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 (126) hide show
  1. package/dist/chotto.css +1 -1
  2. package/dist/components/1_atoms/ButtonContextMenu/ButtonContextMenu.vue2.js +3 -2
  3. package/dist/components/1_atoms/ContactContextMenu/ContactContextMenu.vue2.js +3 -2
  4. package/dist/components/1_atoms/EmojiGlyph/EmojiGlyph.vue.js +38 -0
  5. package/dist/components/1_atoms/EmojiGlyph/EmojiGlyph.vue2.js +4 -0
  6. package/dist/components/1_atoms/Tooltip/Tooltip.vue.js +1 -1
  7. package/dist/components/1_atoms/Tooltip/Tooltip.vue2.js +49 -36
  8. package/dist/components/1_icons/CloseIcon.vue.js +21 -0
  9. package/dist/components/2_blocks/FeedSearch/FeedSearch.vue2.js +10 -9
  10. package/dist/components/2_chatinput_elements/ButtonCommandsSelector/ButtonCommandsSelector.vue2.js +8 -7
  11. package/dist/components/2_chatinput_elements/ButtonEmojiPicker/ButtonEmojiPicker.vue.js +2 -2
  12. package/dist/components/2_chatinput_elements/ButtonEmojiPicker/ButtonEmojiPicker.vue2.js +48 -37
  13. package/dist/components/2_chatinput_elements/ButtonTemplateSelector/ButtonTemplateSelector.vue2.js +3 -2
  14. package/dist/components/2_chatinput_elements/ButtonWabaTemplateSelector/ButtonWabaTemplateSelector.vue.js +7 -6
  15. package/dist/components/2_chatinput_elements/FilePreview/FilePreview.vue2.js +3 -2
  16. package/dist/components/2_chatinput_elements/FileUploader/FileUploader.vue2.js +3 -2
  17. package/dist/components/2_chatinput_elements/StickerPicker/StickerPicker.vue2.js +3 -2
  18. package/dist/components/2_chatinput_elements/TemplateSelector/TemplateSelector.vue.js +27 -26
  19. package/dist/components/2_chatinput_elements/TextFormatToolbar/TextFormatToolbar.vue2.js +3 -2
  20. package/dist/components/2_chatinput_elements/WABAAttachmentSection/WABAAttachmentSection.vue2.js +3 -2
  21. package/dist/components/2_chatlist_elements/ChatItem/ChatItem.vue2.js +3 -2
  22. package/dist/components/2_elements/AudioRecorder/AudioRecorder.vue2.js +3 -2
  23. package/dist/components/2_elements/ChannelSelector/ChannelSelector.vue.js +6 -5
  24. package/dist/components/2_elements/ThemeMode/ThemeMode.vue.js +10 -9
  25. package/dist/components/2_elements/VideoRecorder/VideoRecorder.vue2.js +3 -2
  26. package/dist/components/2_feed_elements/AudioMessage/AudioMessage.vue.js +1 -1
  27. package/dist/components/2_feed_elements/AudioMessage/AudioMessage.vue2.js +169 -143
  28. package/dist/components/2_feed_elements/BaseReplyMessage/BaseReplyMessage.vue.js +4 -4
  29. package/dist/components/2_feed_elements/BaseReplyMessage/BaseReplyMessage.vue2.js +33 -32
  30. package/dist/components/2_feed_elements/CallMessage/CallMessage.vue2.js +8 -2
  31. package/dist/components/2_feed_elements/FileMessage/FileMessage.vue.js +3 -3
  32. package/dist/components/2_feed_elements/FileMessage/FileMessage.vue2.js +134 -108
  33. package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue.js +1 -1
  34. package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue2.js +116 -97
  35. package/dist/components/2_feed_elements/MessageKeyboard/MessageKeyboard.vue2.js +3 -2
  36. package/dist/components/2_feed_elements/MessageReactions/MessageReactions.vue.js +2 -2
  37. package/dist/components/2_feed_elements/MessageReactions/MessageReactions.vue2.js +232 -113
  38. package/dist/components/2_feed_elements/MessageReactions/composables/usePositioning.js +77 -62
  39. package/dist/components/2_feed_elements/MessageReactions/composables/useReactions.js +62 -20
  40. package/dist/components/2_feed_elements/MessageReactions/composables/useReactionsPanel.js +91 -69
  41. package/dist/components/2_feed_elements/MessageReactions/composables/useReactionsState.js +46 -22
  42. package/dist/components/2_feed_elements/MessageReactions/icons/ExpandReactionsIcon.vue.js +21 -0
  43. package/dist/components/2_feed_elements/MessageReactions/icons/ReplyIcon.vue.js +21 -0
  44. package/dist/components/2_feed_elements/MessageReactions/utils/quickReactions.js +2 -8
  45. package/dist/components/2_feed_elements/MessageReactions/utils/reactionTooltip.js +39 -0
  46. package/dist/components/2_feed_elements/MissedCallMessage/MissedCallMessage.vue2.js +26 -20
  47. package/dist/components/2_feed_elements/ReplyAudioMessage/ReplyAudioMessage.vue.js +2 -2
  48. package/dist/components/2_feed_elements/ReplyAudioMessage/ReplyAudioMessage.vue2.js +27 -18
  49. package/dist/components/2_feed_elements/ReplyCallMessage/ReplyCallMessage.vue.js +2 -2
  50. package/dist/components/2_feed_elements/ReplyCallMessage/ReplyCallMessage.vue2.js +16 -15
  51. package/dist/components/2_feed_elements/ReplyFileMessage/ReplyFileMessage.vue.js +3 -3
  52. package/dist/components/2_feed_elements/ReplyFileMessage/ReplyFileMessage.vue2.js +27 -18
  53. package/dist/components/2_feed_elements/ReplyImageMessage/ReplyImageMessage.vue.js +1 -1
  54. package/dist/components/2_feed_elements/ReplyImageMessage/ReplyImageMessage.vue2.js +16 -12
  55. package/dist/components/2_feed_elements/ReplyStickerMessage/ReplyStickerMessage.vue.js +4 -4
  56. package/dist/components/2_feed_elements/ReplyStickerMessage/ReplyStickerMessage.vue2.js +74 -65
  57. package/dist/components/2_feed_elements/ReplyTextMessage/ReplyTextMessage.vue.js +1 -1
  58. package/dist/components/2_feed_elements/ReplyTextMessage/ReplyTextMessage.vue2.js +20 -11
  59. package/dist/components/2_feed_elements/ReplyVideoMessage/ReplyVideoMessage.vue.js +2 -2
  60. package/dist/components/2_feed_elements/ReplyVideoMessage/ReplyVideoMessage.vue2.js +13 -9
  61. package/dist/components/2_feed_elements/StickerMessage/StickerMessage.vue.js +4 -4
  62. package/dist/components/2_feed_elements/StickerMessage/StickerMessage.vue2.js +74 -55
  63. package/dist/components/2_feed_elements/TextMessage/TextMessage.vue.js +4 -4
  64. package/dist/components/2_feed_elements/TextMessage/TextMessage.vue2.js +102 -76
  65. package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue.js +2 -2
  66. package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue2.js +74 -55
  67. package/dist/components/3_compounds/ChatInput/ChatInput.vue.js +2 -2
  68. package/dist/components/3_compounds/ChatInput/ChatInput.vue2.js +99 -82
  69. package/dist/components/3_compounds/Feed/Feed.vue.js +3 -3
  70. package/dist/components/3_compounds/Feed/Feed.vue2.js +159 -139
  71. package/dist/components/3_compounds/Feed/composables/useFeedReply.js +22 -25
  72. package/dist/functions/renderAppleEmojis.js +92 -0
  73. package/dist/hooks/messages/buildReplyPayload.js +14 -0
  74. package/dist/hooks/messages/useMessageLinks.js +60 -50
  75. package/dist/hooks/messages/useStartReply.js +29 -0
  76. package/dist/hooks/useEmojiNative.js +19 -0
  77. package/dist/index.js +130 -122
  78. package/dist/themes/dark.css +1 -1
  79. package/dist/themes/default.css +1 -1
  80. package/dist/themes/glass.css +1 -1
  81. package/dist/themes/green.css +1 -1
  82. package/dist/themes/mobilon1.css +1 -1
  83. package/dist/types/apps/data/messages.d.ts +20 -18
  84. package/dist/types/components/1_atoms/EmojiGlyph/EmojiGlyph.vue.d.ts +12 -0
  85. package/dist/types/components/1_atoms/Tooltip/stories/Tooltip.stories.d.ts +3 -0
  86. package/dist/types/components/1_icons/CloseIcon.vue.d.ts +2 -0
  87. package/dist/types/components/2_chatinput_elements/ButtonEmojiPicker/ButtonEmojiPicker.vue.d.ts +9 -1
  88. package/dist/types/components/2_feed_elements/AudioMessage/AudioMessage.vue.d.ts +29 -0
  89. package/dist/types/components/2_feed_elements/AudioMessage/styles/types.d.ts +24 -16
  90. package/dist/types/components/2_feed_elements/BaseReplyMessage/styles/types.d.ts +8 -4
  91. package/dist/types/components/2_feed_elements/FileMessage/FileMessage.vue.d.ts +29 -0
  92. package/dist/types/components/2_feed_elements/FileMessage/styles/types.d.ts +20 -0
  93. package/dist/types/components/2_feed_elements/ImageMessage/ImageMessage.vue.d.ts +29 -0
  94. package/dist/types/components/2_feed_elements/ImageMessage/styles/types.d.ts +2 -0
  95. package/dist/types/components/2_feed_elements/MessageReactions/MessageReactions.vue.d.ts +64 -1
  96. package/dist/types/components/2_feed_elements/MessageReactions/composables/index.d.ts +2 -2
  97. package/dist/types/components/2_feed_elements/MessageReactions/composables/usePositioning.d.ts +11 -1
  98. package/dist/types/components/2_feed_elements/MessageReactions/composables/useReactions.d.ts +20 -12
  99. package/dist/types/components/2_feed_elements/MessageReactions/composables/useReactionsPanel.d.ts +3 -3
  100. package/dist/types/components/2_feed_elements/MessageReactions/composables/useReactionsState.d.ts +13 -22
  101. package/dist/types/components/2_feed_elements/MessageReactions/icons/ExpandReactionsIcon.vue.d.ts +2 -0
  102. package/dist/types/components/2_feed_elements/MessageReactions/icons/ReplyIcon.vue.d.ts +2 -0
  103. package/dist/types/components/2_feed_elements/MessageReactions/styles/types.d.ts +14 -74
  104. package/dist/types/components/2_feed_elements/MessageReactions/utils/quickReactions.d.ts +1 -1
  105. package/dist/types/components/2_feed_elements/MessageReactions/utils/reactionTooltip.d.ts +14 -0
  106. package/dist/types/components/2_feed_elements/ReplyAudioMessage/styles/types.d.ts +6 -0
  107. package/dist/types/components/2_feed_elements/ReplyCallMessage/styles/types.d.ts +6 -0
  108. package/dist/types/components/2_feed_elements/ReplyFileMessage/styles/types.d.ts +6 -0
  109. package/dist/types/components/2_feed_elements/ReplyImageMessage/styles/types.d.ts +6 -0
  110. package/dist/types/components/2_feed_elements/ReplyStickerMessage/styles/types.d.ts +6 -0
  111. package/dist/types/components/2_feed_elements/ReplyTextMessage/styles/types.d.ts +4 -0
  112. package/dist/types/components/2_feed_elements/ReplyVideoMessage/styles/types.d.ts +6 -0
  113. package/dist/types/components/2_feed_elements/StickerMessage/StickerMessage.vue.d.ts +29 -0
  114. package/dist/types/components/2_feed_elements/TextMessage/TextMessage.vue.d.ts +29 -0
  115. package/dist/types/components/2_feed_elements/TextMessage/styles/types.d.ts +22 -0
  116. package/dist/types/components/2_feed_elements/VideoMessage/VideoMessage.vue.d.ts +29 -0
  117. package/dist/types/components/2_feed_elements/types/messages.d.ts +11 -6
  118. package/dist/types/components/3_compounds/ChatInput/styles/types.d.ts +2 -0
  119. package/dist/types/components/3_compounds/Feed/Feed.vue.d.ts +33 -0
  120. package/dist/types/functions/renderAppleEmojis.d.ts +16 -0
  121. package/dist/types/hooks/index.d.ts +1 -0
  122. package/dist/types/hooks/messages/buildReplyPayload.d.ts +11 -0
  123. package/dist/types/hooks/messages/index.d.ts +2 -0
  124. package/dist/types/hooks/messages/useStartReply.d.ts +6 -0
  125. package/dist/types/hooks/useEmojiNative.d.ts +9 -0
  126. package/package.json +1 -1
@@ -1,11 +1,29 @@
1
- import { defineComponent as se, inject as re, ref as m, computed as f, onMounted as le, onUnmounted as ce, createElementBlock as l, openBlock as s, normalizeClass as x, unref as o, createCommentVNode as de, createVNode as k, createBlock as ue, Fragment as Q, renderList as A, createElementVNode as r, toDisplayString as g, Transition as T, withCtx as w, withDirectives as L, normalizeStyle as N, withModifiers as O, vShow as F, Teleport as me } from "vue";
2
- import fe from "../../../node_modules/vue3-emoji-picker-ru/dist/emoji-picker.es.js";
1
+ import { defineComponent as Ee, inject as M, ref as b, computed as a, unref as s, onMounted as Ce, onUnmounted as _e, watch as Ne, createElementBlock as d, openBlock as l, normalizeClass as w, createBlock as K, Fragment as Q, renderList as A, withCtx as E, createElementVNode as f, createCommentVNode as F, createVNode as c, toDisplayString as Se, Teleport as Ue, Transition as D, withDirectives as V, normalizeStyle as $, withModifiers as C, vShow as z } from "vue";
2
+ import je from "../../../node_modules/vue3-emoji-picker-ru/dist/emoji-picker.es.js";
3
3
  /* empty css */
4
- import { QUICK_REACTION_EMOJIS as ke } from "./utils/quickReactions.js";
5
- import { isRightMessage as ge } from "./composables/usePositioning.js";
6
- import { useReactionsState as pe } from "./composables/useReactionsState.js";
7
- import { useReactionsPanel as ye } from "./composables/useReactionsPanel.js";
8
- const ve = ["title", "onClick"], Re = { class: "message-reactions__emoji" }, be = { class: "message-reactions__count" }, he = ["title", "onClick"], Be = /* @__PURE__ */ se({
4
+ import "../../../hooks/useMessageDraft.js";
5
+ import "../../../hooks/useSearchModel.js";
6
+ import "../../../hooks/useTheme.js";
7
+ import { useEmojiNative as Pe } from "../../../hooks/useEmojiNative.js";
8
+ /* empty css */
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 { useStartReply as Le } from "../../../hooks/messages/useStartReply.js";
14
+ import J from "../../1_atoms/EmojiGlyph/EmojiGlyph.vue.js";
15
+ import xe from "../../1_atoms/Tooltip/Tooltip.vue.js";
16
+ import qe from "./icons/ExpandReactionsIcon.vue.js";
17
+ import Te from "./icons/ReplyIcon.vue.js";
18
+ import { QUICK_REACTION_EMOJIS as Be } from "./utils/quickReactions.js";
19
+ import { buildReactionTooltipText as Oe } from "./utils/reactionTooltip.js";
20
+ import { isRightMessage as we, findMessageContent as Ke } from "./composables/usePositioning.js";
21
+ import { useReactionsState as Qe } from "./composables/useReactionsState.js";
22
+ import { useReactionsPanel as Ae } from "./composables/useReactionsPanel.js";
23
+ const Fe = ["onClick"], De = { class: "message-reactions__emoji" }, Ve = {
24
+ key: 0,
25
+ class: "message-reactions__count"
26
+ }, $e = ["title", "onClick"], pt = /* @__PURE__ */ Ee({
9
27
  __name: "MessageReactions",
10
28
  props: {
11
29
  reactions: {
@@ -24,138 +42,239 @@ const ve = ["title", "onClick"], Re = { class: "message-reactions__emoji" }, be
24
42
  enabled: {
25
43
  type: Boolean,
26
44
  default: !0
45
+ },
46
+ mode: {
47
+ type: String,
48
+ default: "single",
49
+ validator: (i) => ["single", "multi"].includes(i)
50
+ },
51
+ /** Id текущего пользователя — для расчёта reactedByMe и локальных add/remove */
52
+ currentUserId: {
53
+ type: [String, Number],
54
+ default: void 0
55
+ },
56
+ /** Имя текущего пользователя — для тултипа при локальном добавлении реакции */
57
+ currentUserName: {
58
+ type: String,
59
+ default: void 0
60
+ },
61
+ /** userId → имя (если в item нет name) */
62
+ reactionUserNames: {
63
+ type: Object,
64
+ default: void 0
65
+ },
66
+ reply: {
67
+ type: Object,
68
+ default: void 0
69
+ },
70
+ replyEnabled: {
71
+ type: Boolean,
72
+ default: !0
27
73
  }
28
74
  },
29
75
  emits: ["toggle-reaction", "add-reaction", "remove-reaction"],
30
- setup(i, { emit: j }) {
31
- const a = i, c = j, p = re("chatAppId"), u = m(null), y = m(null), v = m("light"), R = f(() => ke), b = pe(f(() => a.reactions)), { displayedReactions: D, hasReactions: V, addReaction: h, removeReaction: z, toggleReaction: U } = b, $ = ye(R, y), {
32
- isQuickReactionsOpen: C,
33
- isFullPickerOpen: I,
34
- pickerRef: J,
35
- quickReactionsRef: K,
36
- quickPanelStyle: G,
37
- pickerStyle: H,
38
- openQuickPanel: W,
39
- closeQuickPanel: M,
40
- openFullPicker: X,
41
- closeFullPicker: Y,
42
- handleQuickPanelMouseEnter: E,
43
- handleQuickPanelMouseLeave: P,
44
- handlePickerMouseEnter: _,
45
- handlePickerMouseLeave: S,
46
- handleClickOutside: B
47
- } = $, Z = f(() => u.value ? ge(u.value) : !1), ee = () => {
48
- var n;
76
+ setup(i, { emit: G }) {
77
+ const n = i, r = G, p = M("chatAppId"), H = M("currentUserId", void 0), W = M("reactionUserNames", void 0), { startReply: X } = Le(p || ""), u = b(null), m = b(null), _ = b("light"), { isNative: Y } = Pe(p || ""), N = a(() => Be), Z = a(() => n.mode), y = a(() => n.currentUserId ?? s(H)), S = a(() => n.reactionUserNames ?? s(W)), ee = a(() => {
78
+ var t, g;
79
+ const e = (t = n.currentUserName) == null ? void 0 : t.trim();
80
+ if (e) return e;
81
+ const o = y.value;
82
+ if (o != null)
83
+ return (g = S.value) == null ? void 0 : g[String(o)];
84
+ }), te = a(() => n.mode === "multi"), U = Qe(
85
+ a(() => n.reactions),
86
+ Z,
87
+ y,
88
+ ee
89
+ ), { displayedReactions: ne, hasReactions: oe, addReaction: k, removeReaction: j, toggleReaction: se, isMyReaction: P } = U;
90
+ function ie(e) {
91
+ return Oe(e.events, S.value);
92
+ }
93
+ const re = Ae(N, u), {
94
+ isQuickReactionsOpen: ae,
95
+ isFullPickerOpen: le,
96
+ pickerRef: ce,
97
+ quickReactionsRef: ue,
98
+ quickPanelStyle: de,
99
+ pickerStyle: me,
100
+ closeQuickPanel: v,
101
+ handleMessageMouseEnter: fe,
102
+ handleMessageMouseLeave: pe,
103
+ openFullPicker: ve,
104
+ closeFullPicker: L,
105
+ handleQuickPanelMouseEnter: x,
106
+ handleQuickPanelMouseLeave: q,
107
+ handlePickerMouseEnter: T,
108
+ handlePickerMouseLeave: B,
109
+ handleClickOutside: O
110
+ } = re, ge = a(() => u.value ? we(u.value) : !1), ye = () => {
111
+ var o;
49
112
  if (!p) return "light";
50
- const t = document.getElementById(p);
51
- return (n = t == null ? void 0 : t.getAttribute("data-theme")) != null && n.includes("dark") ? "dark" : "light";
113
+ const e = document.getElementById(p);
114
+ return (o = e == null ? void 0 : e.getAttribute("data-theme")) != null && o.includes("dark") ? "dark" : "light";
52
115
  };
53
- function te(t) {
54
- a.readonly || !a.enabled || (U(t), c("toggle-reaction", { messageId: a.messageId, key: t }));
116
+ function I() {
117
+ return !n.readonly && n.enabled && y.value != null;
118
+ }
119
+ function ke(e) {
120
+ if (I()) {
121
+ if (n.mode === "single") {
122
+ if (U.myReactionKey.value === e)
123
+ j(e), r("remove-reaction", { messageId: n.messageId, key: e });
124
+ else {
125
+ const t = k(e);
126
+ t && r("remove-reaction", { messageId: n.messageId, key: t }), r("add-reaction", { messageId: n.messageId, key: e });
127
+ }
128
+ return;
129
+ }
130
+ se(e), r("toggle-reaction", { messageId: n.messageId, key: e });
131
+ }
132
+ }
133
+ function Ie(e) {
134
+ var o, t;
135
+ return e instanceof Node ? !!((o = m.value) != null && o.contains(e) || (t = u.value) != null && t.contains(e)) : !1;
136
+ }
137
+ function R() {
138
+ n.readonly || !n.enabled || fe();
55
139
  }
56
- function ne() {
57
- a.readonly || !a.enabled || (C.value ? M() : W());
140
+ function h(e) {
141
+ n.readonly || !n.enabled || Ie(e.relatedTarget) || pe();
58
142
  }
59
- function oe(t) {
60
- var e, d;
61
- if (a.readonly || !a.enabled) return;
62
- ((d = (e = b.localReactions.value) == null ? void 0 : e.items) == null ? void 0 : d.find((q) => q.key === t && q.reactedByMe)) ? (z(t), c("remove-reaction", { messageId: a.messageId, key: t })) : (h(t), c("add-reaction", { messageId: a.messageId, key: t })), M();
143
+ function Re(e) {
144
+ if (I()) {
145
+ if (P(e))
146
+ j(e), r("remove-reaction", { messageId: n.messageId, key: e });
147
+ else {
148
+ const o = k(e);
149
+ o && r("remove-reaction", { messageId: n.messageId, key: o }), r("add-reaction", { messageId: n.messageId, key: e });
150
+ }
151
+ v();
152
+ }
63
153
  }
64
- async function ae() {
65
- a.readonly || !a.enabled || (v.value = ee(), await X());
154
+ function he() {
155
+ n.readonly || !n.enabled || !n.reply || (X(n.reply), v());
66
156
  }
67
- function ie(t) {
68
- Y(), !(a.readonly || !a.enabled) && (h(t.i), c("add-reaction", { messageId: a.messageId, key: t.i }));
157
+ async function Me() {
158
+ n.readonly || !n.enabled || (_.value = ye(), await ve());
69
159
  }
70
- return le(() => {
71
- document.addEventListener("click", B);
72
- }), ce(() => {
73
- document.removeEventListener("click", B);
74
- }), (t, n) => (s(), l("div", {
160
+ function be(e) {
161
+ if (L(), v(), !I()) return;
162
+ const o = e.i;
163
+ if (P(o))
164
+ return;
165
+ const t = k(o);
166
+ t && r("remove-reaction", { messageId: n.messageId, key: t }), r("add-reaction", { messageId: n.messageId, key: o });
167
+ }
168
+ return Ce(() => {
169
+ document.addEventListener("click", O);
170
+ const e = Ke(u.value);
171
+ e && (m.value = e, e.addEventListener("pointerenter", R), e.addEventListener("pointerleave", h));
172
+ }), _e(() => {
173
+ document.removeEventListener("click", O), m.value && (m.value.removeEventListener("pointerenter", R), m.value.removeEventListener("pointerleave", h));
174
+ }), Ne(
175
+ () => [n.enabled, n.readonly],
176
+ ([e, o]) => {
177
+ (!e || o) && (v(), L());
178
+ }
179
+ ), (e, o) => (l(), d("div", {
75
180
  ref_key: "reactionsContainerRef",
76
181
  ref: u,
77
- class: x(["message-reactions", { "has-reactions": o(V), "is-right-message": Z.value, "is-disabled": !i.enabled }])
182
+ class: w(["message-reactions", { "has-reactions": s(oe), "is-right-message": ge.value, "is-disabled": !i.enabled }]),
183
+ onPointerenter: R,
184
+ onPointerleave: h
78
185
  }, [
79
- (s(!0), l(Q, null, A(o(D), (e) => (s(), l("button", {
80
- key: e.key,
81
- class: x(["message-reactions__chip", { "is-active": e.reactedByMe }]),
82
- title: e.key,
83
- onClick: (d) => te(e.key)
84
- }, [
85
- r("span", Re, g(e.key), 1),
86
- r("span", be, g(e.count), 1)
87
- ], 10, ve))), 128)),
88
- !i.readonly && i.enabled ? (s(), l("button", {
89
- key: 0,
90
- ref_key: "addButtonRef",
91
- ref: y,
92
- class: "message-reactions__add",
93
- "aria-label": "Add reaction",
94
- title: "Добавить реакцию",
95
- onClick: ne
96
- }, [...n[4] || (n[4] = [
97
- r("span", null, "+", -1)
98
- ])], 512)) : de("", !0),
99
- k(T, { name: "message-reactions-popover" }, {
100
- default: w(() => [
101
- L(r("div", {
102
- ref_key: "quickReactionsRef",
103
- ref: K,
104
- class: "message-reactions__quick-panel",
105
- style: N(o(G)),
106
- onMouseenter: n[0] || (n[0] = //@ts-ignore
107
- (...e) => o(E) && o(E)(...e)),
108
- onMouseleave: n[1] || (n[1] = //@ts-ignore
109
- (...e) => o(P) && o(P)(...e))
186
+ (l(!0), d(Q, null, A(s(ne), (t) => (l(), K(xe, {
187
+ key: t.key,
188
+ text: ie(t),
189
+ position: "bottom-right",
190
+ offset: 6,
191
+ delay: 400
192
+ }, {
193
+ default: E(() => [
194
+ f("button", {
195
+ class: w(["message-reactions__chip", { "is-active": t.reactedByMe && t.count === 1 }]),
196
+ onClick: (g) => ke(t.key)
110
197
  }, [
111
- (s(!0), l(Q, null, A(R.value, (e) => (s(), l("button", {
112
- key: e,
113
- class: "message-reactions__quick-item",
114
- title: e,
115
- onClick: O((d) => oe(e), ["stop"])
116
- }, g(e), 9, he))), 128)),
117
- r("button", {
118
- class: "message-reactions__expand",
119
- title: "Развернуть",
120
- onClick: O(ae, ["stop"])
121
- }, [...n[5] || (n[5] = [
122
- r("span", null, "⋯", -1)
123
- ])])
124
- ], 36), [
125
- [F, o(C) && !i.readonly && i.enabled && !o(I)]
126
- ])
198
+ f("span", De, [
199
+ c(J, {
200
+ emoji: t.key
201
+ }, null, 8, ["emoji"])
202
+ ]),
203
+ te.value || t.count > 1 ? (l(), d("span", Ve, Se(t.count), 1)) : F("", !0)
204
+ ], 10, Fe)
127
205
  ]),
128
- _: 1
129
- }),
130
- (s(), ue(me, { to: "body" }, [
131
- k(T, { name: "message-reactions-popover" }, {
132
- default: w(() => [
133
- L(r("div", {
206
+ _: 2
207
+ }, 1032, ["text"]))), 128)),
208
+ (l(), K(Ue, { to: "body" }, [
209
+ c(D, { name: "message-reactions-popover" }, {
210
+ default: E(() => [
211
+ V(f("div", {
212
+ ref_key: "quickReactionsRef",
213
+ ref: ue,
214
+ class: "message-reactions__quick-panel",
215
+ style: $(s(de)),
216
+ onMouseenter: o[0] || (o[0] = //@ts-ignore
217
+ (...t) => s(x) && s(x)(...t)),
218
+ onMouseleave: o[1] || (o[1] = //@ts-ignore
219
+ (...t) => s(q) && s(q)(...t))
220
+ }, [
221
+ (l(!0), d(Q, null, A(N.value, (t) => (l(), d("button", {
222
+ key: t,
223
+ class: "message-reactions__quick-item",
224
+ title: t,
225
+ onClick: C((g) => Re(t), ["stop"])
226
+ }, [
227
+ c(J, { emoji: t }, null, 8, ["emoji"])
228
+ ], 8, $e))), 128)),
229
+ f("button", {
230
+ class: "message-reactions__expand",
231
+ title: "Развернуть",
232
+ onClick: C(Me, ["stop"])
233
+ }, [
234
+ c(qe)
235
+ ]),
236
+ i.replyEnabled && i.reply ? (l(), d("button", {
237
+ key: 0,
238
+ class: "message-reactions__quick-item",
239
+ title: "Ответить",
240
+ onClick: C(he, ["stop"])
241
+ }, [
242
+ c(Te)
243
+ ])) : F("", !0)
244
+ ], 36), [
245
+ [z, s(ae) && !i.readonly && i.enabled]
246
+ ])
247
+ ]),
248
+ _: 1
249
+ }),
250
+ c(D, { name: "message-reactions-popover" }, {
251
+ default: E(() => [
252
+ V(f("div", {
134
253
  ref_key: "pickerRef",
135
- ref: J,
254
+ ref: ce,
136
255
  class: "message-reactions__picker",
137
- style: N(o(H)),
138
- onMouseenter: n[2] || (n[2] = //@ts-ignore
139
- (...e) => o(_) && o(_)(...e)),
140
- onMouseleave: n[3] || (n[3] = //@ts-ignore
141
- (...e) => o(S) && o(S)(...e))
256
+ style: $(s(me)),
257
+ onMouseenter: o[2] || (o[2] = //@ts-ignore
258
+ (...t) => s(T) && s(T)(...t)),
259
+ onMouseleave: o[3] || (o[3] = //@ts-ignore
260
+ (...t) => s(B) && s(B)(...t))
142
261
  }, [
143
- k(o(fe), {
144
- native: !0,
145
- theme: v.value,
262
+ c(s(je), {
263
+ native: s(Y),
264
+ theme: _.value,
146
265
  "picker-type": "",
147
- onSelect: ie
148
- }, null, 8, ["theme"])
266
+ onSelect: be
267
+ }, null, 8, ["native", "theme"])
149
268
  ], 36), [
150
- [F, o(I) && !i.readonly && i.enabled]
269
+ [z, s(le) && !i.readonly && i.enabled]
151
270
  ])
152
271
  ]),
153
272
  _: 1
154
273
  })
155
274
  ]))
156
- ], 2));
275
+ ], 34));
157
276
  }
158
277
  });
159
278
  export {
160
- Be as default
279
+ pt as default
161
280
  };
@@ -1,7 +1,7 @@
1
- import { nextTick as x } from "vue";
2
- function R(i) {
3
- if (!i) return null;
4
- let t = i.parentElement;
1
+ import { nextTick as p } from "vue";
2
+ function l(o) {
3
+ if (!o) return null;
4
+ let t = o.parentElement;
5
5
  for (; t; ) {
6
6
  if (t.classList.contains("message-feed"))
7
7
  return t;
@@ -9,12 +9,25 @@ function R(i) {
9
9
  }
10
10
  return null;
11
11
  }
12
- function w(i) {
13
- if (!i) return !1;
14
- let t = i.parentElement;
12
+ function R(o) {
13
+ if (!o) return null;
14
+ let t = o.parentElement;
15
15
  for (; t; ) {
16
- for (const f of t.classList)
17
- if (f.includes("__right"))
16
+ for (const s of t.classList)
17
+ if (s.endsWith("__content"))
18
+ return t;
19
+ if (t.classList.contains("message-feed"))
20
+ break;
21
+ t = t.parentElement;
22
+ }
23
+ return null;
24
+ }
25
+ function w(o) {
26
+ if (!o) return !1;
27
+ let t = o.parentElement;
28
+ for (; t; ) {
29
+ for (const s of t.classList)
30
+ if (s.includes("__right"))
18
31
  return !0;
19
32
  if (t.classList.contains("message-feed"))
20
33
  break;
@@ -22,83 +35,85 @@ function w(i) {
22
35
  }
23
36
  return !1;
24
37
  }
25
- async function P(i, t, f = 300) {
38
+ async function H(o, t, s = 300) {
26
39
  if (!t) return {};
27
- const a = R(t);
28
- if (!a) return {};
29
- const d = w(t);
30
- await x();
31
- const n = t.closest(".message-reactions");
32
- if (!n) return {};
33
- const e = t.getBoundingClientRect(), s = a.getBoundingClientRect(), g = n.getBoundingClientRect(), c = (i == null ? void 0 : i.offsetWidth) || f, o = 8;
34
- if (d) {
35
- const p = s.right - e.right, h = e.left - g.left, C = e.width;
36
- return c <= p - o ? {
37
- left: `${h + C + 6}px`,
38
- // справа от кнопки с gap 6px
39
- right: "auto",
40
- transform: "none"
41
- } : {
42
- left: `${h - c - 6}px`,
43
- right: "auto",
44
- transform: "none"
45
- };
46
- }
47
- const u = e.left - g.left, l = e.width, r = e.left - s.left;
48
- return c <= r - o ? {
49
- left: `${u - c - 6}px`,
50
- // слева от кнопки с gap 6px
51
- right: "auto",
52
- transform: "none"
53
- } : {
54
- left: `${u + l + 6}px`,
55
- // справа от кнопки с gap 6px
40
+ const g = l(t), a = R(t);
41
+ if (!g || !a) return {};
42
+ const e = w(t);
43
+ await p();
44
+ const i = a.getBoundingClientRect(), f = (o == null ? void 0 : o.offsetWidth) || s, c = (o == null ? void 0 : o.offsetHeight) || 44, r = 6, u = i.top + i.height / 2 - c / 2, n = e ? i.left - f - r : i.right + r;
45
+ return {
46
+ position: "fixed",
47
+ top: `${u}px`,
48
+ left: `${n}px`,
56
49
  right: "auto",
50
+ marginTop: "0",
57
51
  transform: "none"
58
52
  };
59
53
  }
60
- async function B(i, t, f = 300) {
54
+ async function P(o, t, s = 300) {
61
55
  if (!t) return {};
62
- const a = R(t);
63
- if (!a) return {};
64
- const d = w(t);
65
- await x();
66
- const n = t.getBoundingClientRect(), e = a.getBoundingClientRect(), s = (i == null ? void 0 : i.offsetWidth) || f, g = (i == null ? void 0 : i.offsetHeight) || 450, c = 8, o = 6, u = window.innerHeight - n.bottom - o, l = n.top - o;
67
- let r;
68
- if (u >= g || u >= l ? r = { top: `${n.bottom + o}px` } : r = { bottom: `${window.innerHeight - n.top + o}px` }, d) {
69
- const h = e.right - n.right;
70
- return s <= h - c ? {
56
+ const g = l(t);
57
+ if (!g) return {};
58
+ const a = w(t);
59
+ await p();
60
+ const e = R(t);
61
+ if (!e) return {};
62
+ const i = e.getBoundingClientRect(), f = g.getBoundingClientRect(), c = (o == null ? void 0 : o.offsetWidth) || s, r = (o == null ? void 0 : o.offsetHeight) || 450, u = 8, n = 6, d = window.innerHeight - i.bottom - n, x = i.top - n;
63
+ let h;
64
+ if (d >= r || d >= x ? h = { top: `${i.bottom + n}px` } : h = { bottom: `${window.innerHeight - i.top + n}px` }, a) {
65
+ const $ = f.right - i.right;
66
+ return c <= $ - u ? {
71
67
  position: "fixed",
72
- ...r,
73
- left: `${n.right + o}px`,
68
+ ...h,
69
+ left: `${i.right + n}px`,
74
70
  right: "auto",
75
71
  transform: "none"
76
72
  } : {
77
73
  position: "fixed",
78
- ...r,
79
- left: `${n.left - s - o}px`,
74
+ ...h,
75
+ left: `${i.left - c - n}px`,
80
76
  right: "auto",
81
77
  transform: "none"
82
78
  };
83
79
  }
84
- const p = n.left - e.left;
85
- return s <= p - c ? {
80
+ const C = i.left - f.left;
81
+ return c <= C - u ? {
86
82
  position: "fixed",
87
- ...r,
88
- left: `${n.left - s - o}px`,
83
+ ...h,
84
+ left: `${i.left - c - n}px`,
89
85
  right: "auto",
90
86
  transform: "none"
91
87
  } : {
92
88
  position: "fixed",
93
- ...r,
94
- left: `${n.right + o}px`,
89
+ ...h,
90
+ left: `${i.right + n}px`,
91
+ right: "auto",
92
+ transform: "none"
93
+ };
94
+ }
95
+ async function W(o, t, s, g = 350) {
96
+ if (!t || !s) return {};
97
+ const a = l(s);
98
+ if (!a) return {};
99
+ await p();
100
+ const e = t.getBoundingClientRect(), i = a.getBoundingClientRect(), f = (o == null ? void 0 : o.offsetWidth) || g, c = (o == null ? void 0 : o.offsetHeight) || 450, r = 8, u = 6;
101
+ let n = e.left + e.width / 2 - f / 2;
102
+ n + f > i.right - r && (n = i.right - r - f), n < i.left + r && (n = i.left + r);
103
+ const d = e.top - c - u;
104
+ return {
105
+ position: "fixed",
106
+ top: `${d >= r ? d : e.bottom + u}px`,
107
+ left: `${n}px`,
95
108
  right: "auto",
96
109
  transform: "none"
97
110
  };
98
111
  }
99
112
  export {
100
- B as calculateFixedPanelPosition,
101
- P as calculatePanelPosition,
102
- R as findFeedContainer,
113
+ P as calculateFixedPanelPosition,
114
+ H as calculatePanelPosition,
115
+ W as calculatePickerPositionAboveQuickPanel,
116
+ l as findFeedContainer,
117
+ R as findMessageContent,
103
118
  w as isRightMessage
104
119
  };
@@ -1,30 +1,72 @@
1
- function f(e, t) {
2
- e.value || (e.value = {
1
+ function v(e, t) {
2
+ return e == null || t == null ? !1 : String(e) === String(t);
3
+ }
4
+ function s(e, t, i) {
5
+ var n, u;
6
+ return i == null ? !1 : ((u = (n = e.value) == null ? void 0 : n.items) == null ? void 0 : u.some(
7
+ (f) => f.key === t && v(f.userId, i)
8
+ )) ?? !1;
9
+ }
10
+ function l(e, t) {
11
+ var i, n, u;
12
+ if (t != null)
13
+ return (u = (n = (i = e.value) == null ? void 0 : i.items) == null ? void 0 : n.find(
14
+ (f) => v(f.userId, t)
15
+ )) == null ? void 0 : u.key;
16
+ }
17
+ function p(e, t) {
18
+ var n;
19
+ if (!((n = e == null ? void 0 : e.items) != null && n.length)) return [];
20
+ const i = /* @__PURE__ */ new Map();
21
+ for (const u of e.items) {
22
+ const f = i.get(u.key), r = v(u.userId, t);
23
+ f ? (f.count++, r && (f.reactedByMe = !0), f.events.push({ ...u })) : i.set(u.key, {
24
+ key: u.key,
25
+ count: 1,
26
+ reactedByMe: r,
27
+ events: [{ ...u }]
28
+ });
29
+ }
30
+ return Array.from(i.values());
31
+ }
32
+ function g(e, t, i, n = "multi", u) {
33
+ e.value ? e.value.meta = { ...e.value.meta, mode: n } : e.value = {
3
34
  items: [],
4
- meta: { mode: "multi" }
5
- });
6
- const u = e.value.items.find((i) => i.key === t);
7
- u ? (u.count++, u.reactedByMe = !0) : e.value.items.push({
35
+ meta: { mode: n }
36
+ }, !s(e, t, i) && e.value.items.push({
8
37
  key: t,
9
- count: 1,
10
- reactedByMe: !0
38
+ userId: i,
39
+ date: Math.floor(Date.now() / 1e3),
40
+ ...u ? { name: u } : {}
11
41
  });
12
42
  }
13
- function d(e, t) {
14
- if (!e.value) return;
15
- const u = e.value.items.find((i) => i.key === t);
16
- u && (u.count--, u.reactedByMe = !1, u.count <= 0 && (e.value.items = e.value.items.filter((i) => i.key !== t), e.value.items.length === 0 && (e.value = void 0)));
43
+ function m(e, t, i) {
44
+ e.value && (e.value.items = e.value.items.filter(
45
+ (n) => !(n.key === t && v(n.userId, i))
46
+ ), e.value.items.length === 0 && (e.value = void 0));
17
47
  }
18
- function v(e, t) {
19
- if (!e.value) {
20
- f(e, t);
48
+ function a(e, t, i, n) {
49
+ const u = l(e, i);
50
+ return u && u !== t && m(e, u, i), g(e, t, i, "single", n), u && u !== t ? u : void 0;
51
+ }
52
+ function d(e, t, i, n = "multi", u) {
53
+ if (s(e, t, i)) {
54
+ m(e, t, i);
55
+ return;
56
+ }
57
+ if (n === "single") {
58
+ a(e, t, i, u);
21
59
  return;
22
60
  }
23
- const u = e.value.items.find((i) => i.key === t);
24
- u != null && u.reactedByMe ? d(e, t) : f(e, t);
61
+ g(e, t, i, n, u);
25
62
  }
26
63
  export {
27
- f as updateLocalReactionsAdd,
28
- d as updateLocalReactionsRemove,
29
- v as updateLocalReactionsToggle
64
+ p as aggregateReactions,
65
+ l as getMyReactionKey,
66
+ s as hasMyReaction,
67
+ v as sameUserId,
68
+ g as updateLocalReactionsAdd,
69
+ m as updateLocalReactionsRemove,
70
+ a as updateLocalReactionsReplace,
71
+ d as updateLocalReactionsToggle
30
72
  };