@mobilon-dev/chotto 0.3.106 → 0.3.107

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 (35) hide show
  1. package/dist/chotto.css +1 -1
  2. package/dist/components/2_feed_elements/AudioMessage/AudioMessage.vue.js +2 -2
  3. package/dist/components/2_feed_elements/AudioMessage/AudioMessage.vue2.js +295 -268
  4. package/dist/components/2_feed_elements/FileMessage/FileMessage.vue.js +2 -2
  5. package/dist/components/2_feed_elements/FileMessage/FileMessage.vue2.js +185 -158
  6. package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue.js +3 -3
  7. package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue2.js +227 -200
  8. package/dist/components/2_feed_elements/MessageReactions/MessageReactions.vue.js +2 -2
  9. package/dist/components/2_feed_elements/MessageReactions/MessageReactions.vue2.js +62 -245
  10. package/dist/components/2_feed_elements/MessageReactions/MessageReactionsOverlay.vue.js +7 -0
  11. package/dist/components/2_feed_elements/MessageReactions/MessageReactionsOverlay.vue2.js +231 -0
  12. package/dist/components/2_feed_elements/MessageReactions/composables/usePositioning.js +25 -25
  13. package/dist/components/2_feed_elements/StickerMessage/StickerMessage.vue.js +2 -2
  14. package/dist/components/2_feed_elements/StickerMessage/StickerMessage.vue2.js +209 -182
  15. package/dist/components/2_feed_elements/TextMessage/TextMessage.vue.js +2 -2
  16. package/dist/components/2_feed_elements/TextMessage/TextMessage.vue2.js +190 -164
  17. package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue.js +3 -3
  18. package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue2.js +208 -181
  19. package/dist/components/3_compounds/Feed/Feed.vue.js +1 -1
  20. package/dist/components/3_compounds/Feed/Feed.vue2.js +207 -197
  21. package/dist/components/3_compounds/Feed/composables/useFeedProgressiveRender.js +52 -49
  22. package/dist/components/3_compounds/Feed/composables/useFeedReactionsOverlay.js +34 -0
  23. package/dist/hooks/messages/useMessageActions.js +81 -70
  24. package/dist/hooks/messages/useMessageReactionsInFeed.js +53 -0
  25. package/dist/hooks/messages/useMessageReactionsMount.js +21 -0
  26. package/dist/index.js +149 -144
  27. package/dist/types/components/2_feed_elements/MessageReactions/MessageReactions.vue.d.ts +4 -71
  28. package/dist/types/components/2_feed_elements/MessageReactions/MessageReactionsOverlay.vue.d.ts +2 -0
  29. package/dist/types/components/2_feed_elements/MessageReactions/composables/usePositioning.d.ts +2 -1
  30. package/dist/types/components/3_compounds/Feed/composables/index.d.ts +1 -0
  31. package/dist/types/components/3_compounds/Feed/composables/useFeedReactionsOverlay.d.ts +52 -0
  32. package/dist/types/hooks/messages/index.d.ts +2 -0
  33. package/dist/types/hooks/messages/useMessageReactionsInFeed.d.ts +25 -0
  34. package/dist/types/hooks/messages/useMessageReactionsMount.d.ts +10 -0
  35. package/package.json +1 -1
@@ -1,32 +1,14 @@
1
- import { defineComponent as Se, inject as E, ref as M, computed as c, unref as i, onMounted as _e, onUnmounted as Ne, watch as je, createElementBlock as d, openBlock as l, normalizeClass as K, createBlock as Q, Fragment as A, renderList as F, withCtx as C, createElementVNode as p, createCommentVNode as S, createVNode as u, toDisplayString as Ue, Teleport as Pe, Transition as D, withDirectives as V, normalizeStyle as $, withModifiers as y, vShow as z } from "vue";
2
- import Le from "../../../node_modules/vue3-emoji-picker-ru/dist/emoji-picker.es.js";
3
- /* empty css */
4
- import "../../../hooks/useMessageDraft.js";
5
- import "../../../hooks/useSearchModel.js";
6
- import "../../../hooks/useTheme.js";
7
- import { useEmojiNative as Te } from "../../../hooks/useEmojiNative.js";
8
- /* empty css */
9
- /* empty css */
10
- import "../../../locale/useLocale.js";
11
- /* empty css */
12
- import { isRightMessage as qe, findMessageContent as xe } from "./composables/usePositioning.js";
13
- import Be from "./icons/ReplyIcon.vue.js";
14
- import "../../../node_modules/linkifyjs/dist/linkify.js";
15
- import "../../../node_modules/linkify-string/dist/linkify-string.js";
16
- import "../../../functions/parseMarkdown.js";
17
- import { useStartReply as we } from "../../../hooks/messages/useStartReply.js";
18
- import H from "../../1_atoms/EmojiGlyph/EmojiGlyph.vue.js";
19
- import Oe from "../../1_atoms/Tooltip/Tooltip.vue.js";
20
- import Ke from "./icons/ExpandReactionsIcon.vue.js";
21
- import Qe from "./icons/MessageActionsIcon.vue.js";
22
- import { QUICK_REACTION_EMOJIS as Ae } from "./utils/quickReactions.js";
23
- import { buildReactionTooltipText as Fe } from "./utils/reactionTooltip.js";
24
- import { useReactionsState as De } from "./composables/useReactionsState.js";
25
- import { useReactionsPanel as Ve } from "./composables/useReactionsPanel.js";
26
- const $e = ["onClick"], ze = { class: "message-reactions__emoji" }, He = {
1
+ import { defineComponent as V, inject as u, ref as q, computed as s, unref as i, createElementBlock as g, openBlock as c, normalizeClass as y, Fragment as w, renderList as $, createBlock as z, withCtx as D, createElementVNode as R, createCommentVNode as F, createVNode as G, toDisplayString as H } from "vue";
2
+ import { MESSAGE_REACTIONS_PATCH_KEY as L } from "../../../hooks/messages/useMessageReactionsInFeed.js";
3
+ import P from "../../1_atoms/EmojiGlyph/EmojiGlyph.vue.js";
4
+ import Y from "../../1_atoms/Tooltip/Tooltip.vue.js";
5
+ import { buildReactionTooltipText as J } from "./utils/reactionTooltip.js";
6
+ import { isRightMessage as Q } from "./composables/usePositioning.js";
7
+ import { useReactionsState as W } from "./composables/useReactionsState.js";
8
+ const X = ["onClick"], Z = { class: "message-reactions__emoji" }, ee = {
27
9
  key: 0,
28
10
  class: "message-reactions__count"
29
- }, Je = ["title", "onClick"], It = /* @__PURE__ */ Se({
11
+ }, ce = /* @__PURE__ */ V({
30
12
  __name: "MessageReactions",
31
13
  props: {
32
14
  reactions: {
@@ -38,10 +20,6 @@ const $e = ["onClick"], ze = { class: "message-reactions__emoji" }, He = {
38
20
  type: [String, Number],
39
21
  required: !0
40
22
  },
41
- readonly: {
42
- type: Boolean,
43
- default: !1
44
- },
45
23
  enabled: {
46
24
  type: Boolean,
47
25
  default: !0
@@ -49,257 +27,96 @@ const $e = ["onClick"], ze = { class: "message-reactions__emoji" }, He = {
49
27
  mode: {
50
28
  type: String,
51
29
  default: "single",
52
- validator: (s) => ["single", "multi"].includes(s)
30
+ validator: (a) => ["single", "multi"].includes(a)
53
31
  },
54
- /** Id текущего пользователя — для расчёта reactedByMe и локальных add/remove */
55
32
  currentUserId: {
56
33
  type: [String, Number],
57
34
  default: void 0
58
35
  },
59
- /** Имя текущего пользователя — для тултипа при локальном добавлении реакции */
60
36
  currentUserName: {
61
37
  type: String,
62
38
  default: void 0
63
39
  },
64
- /** userId → имя (если в item нет name) */
65
40
  reactionUserNames: {
66
41
  type: Object,
67
42
  default: void 0
68
- },
69
- reply: {
70
- type: Object,
71
- default: void 0
72
- },
73
- replyEnabled: {
74
- type: Boolean,
75
- default: !0
76
- },
77
- /** Показывать кнопку меню действий сообщения в панели быстрых реакций */
78
- menuEnabled: {
79
- type: Boolean,
80
- default: !0
81
43
  }
82
44
  },
83
- emits: ["toggle-reaction", "add-reaction", "remove-reaction", "menu"],
84
- setup(s, { emit: J }) {
85
- const n = s, a = J, g = E("chatAppId"), G = E("currentUserId", void 0), W = E("reactionUserNames", void 0), { startReply: X } = we(g || ""), m = M(null), f = M(null), _ = M("light"), { isNative: Y, emojiSrc: Z } = Te(g || ""), N = c(() => Ae), ee = c(() => n.mode), k = c(() => n.currentUserId ?? i(G)), j = c(() => n.reactionUserNames ?? i(W)), te = c(() => {
86
- var t, r;
87
- const e = (t = n.currentUserName) == null ? void 0 : t.trim();
45
+ emits: ["toggle-reaction", "add-reaction", "remove-reaction"],
46
+ setup(a, { expose: I, emit: h }) {
47
+ const o = a, r = h, N = u("currentUserId", void 0), U = u("reactionUserNames", void 0), l = q(null), b = s(() => o.mode), d = s(() => o.currentUserId ?? i(N)), f = s(() => o.reactionUserNames ?? i(U)), C = s(() => {
48
+ var t, m;
49
+ const e = (t = o.currentUserName) == null ? void 0 : t.trim();
88
50
  if (e) return e;
89
- const o = k.value;
90
- if (o != null)
91
- return (r = j.value) == null ? void 0 : r[String(o)];
92
- }), ne = c(() => n.mode === "multi"), U = De(
93
- c(() => n.reactions),
94
- ee,
95
- k,
96
- te
97
- ), { displayedReactions: oe, hasReactions: ie, addReaction: h, removeReaction: P, toggleReaction: se, isMyReaction: L } = U;
98
- function re(e) {
99
- return Fe(e.events, j.value);
51
+ const n = d.value;
52
+ if (n != null)
53
+ return (m = f.value) == null ? void 0 : m[String(n)];
54
+ }), S = s(() => o.mode === "multi"), p = W(
55
+ s(() => o.reactions),
56
+ b,
57
+ d,
58
+ C
59
+ ), { displayedReactions: j, hasReactions: x, addReaction: T, removeReaction: M, toggleReaction: k, localReactions: E } = p, v = u(L, null);
60
+ function _() {
61
+ const e = E.value;
62
+ !v || !e || v({
63
+ ...e,
64
+ items: e.items.map((n) => ({ ...n })),
65
+ meta: e.meta ? { ...e.meta } : void 0
66
+ });
67
+ }
68
+ function B(e) {
69
+ return J(e.events, f.value);
100
70
  }
101
- const ae = Ve(N, m), {
102
- isQuickReactionsOpen: le,
103
- isFullPickerOpen: ce,
104
- pickerRef: ue,
105
- quickReactionsRef: de,
106
- quickPanelStyle: me,
107
- pickerStyle: fe,
108
- closeQuickPanel: v,
109
- handleMessageMouseEnter: pe,
110
- handleMessageMouseLeave: ge,
111
- openFullPicker: ve,
112
- closeFullPicker: T,
113
- handleQuickPanelMouseEnter: q,
114
- handleQuickPanelMouseLeave: x,
115
- handlePickerMouseEnter: B,
116
- handlePickerMouseLeave: w,
117
- handleClickOutside: O
118
- } = ae, ye = c(() => m.value ? qe(m.value) : !1), ke = () => {
119
- var o;
120
- if (!g) return "light";
121
- const e = document.getElementById(g);
122
- return (o = e == null ? void 0 : e.getAttribute("data-theme")) != null && o.includes("dark") ? "dark" : "light";
123
- };
124
- function I() {
125
- return !n.readonly && n.enabled && k.value != null;
71
+ const K = s(() => Q(l.value));
72
+ function A() {
73
+ return o.enabled && d.value != null;
126
74
  }
127
- function he(e) {
128
- if (I()) {
129
- if (n.mode === "single") {
130
- if (U.myReactionKey.value === e)
131
- P(e), a("remove-reaction", { messageId: n.messageId, key: e });
75
+ function O(e) {
76
+ if (A()) {
77
+ if (o.mode === "single") {
78
+ if (p.myReactionKey.value === e)
79
+ M(e), r("remove-reaction", { messageId: o.messageId, key: e });
132
80
  else {
133
- const t = h(e);
134
- t && a("remove-reaction", { messageId: n.messageId, key: t }), a("add-reaction", { messageId: n.messageId, key: e });
81
+ const t = T(e);
82
+ t && r("remove-reaction", { messageId: o.messageId, key: t }), r("add-reaction", { messageId: o.messageId, key: e });
135
83
  }
84
+ _();
136
85
  return;
137
86
  }
138
- se(e), a("toggle-reaction", { messageId: n.messageId, key: e });
87
+ k(e), r("toggle-reaction", { messageId: o.messageId, key: e }), _();
139
88
  }
140
89
  }
141
- function Ie(e) {
142
- var o, t;
143
- return e instanceof Node ? !!((o = f.value) != null && o.contains(e) || (t = m.value) != null && t.contains(e)) : !1;
144
- }
145
- function b() {
146
- n.readonly || !n.enabled || pe();
147
- }
148
- function R(e) {
149
- n.readonly || !n.enabled || Ie(e.relatedTarget) || ge();
150
- }
151
- function be(e) {
152
- if (I()) {
153
- if (L(e))
154
- P(e), a("remove-reaction", { messageId: n.messageId, key: e });
155
- else {
156
- const o = h(e);
157
- o && a("remove-reaction", { messageId: n.messageId, key: o }), a("add-reaction", { messageId: n.messageId, key: e });
158
- }
159
- v();
160
- }
161
- }
162
- function Re() {
163
- n.readonly || !n.enabled || !n.reply || (X(n.reply), v());
164
- }
165
- function Ee(e) {
166
- if (n.readonly || !n.enabled || !n.menuEnabled) return;
167
- const o = e.currentTarget, t = o instanceof HTMLElement ? (() => {
168
- const r = o.getBoundingClientRect();
169
- return { top: r.top, right: r.right, bottom: r.bottom, left: r.left, width: r.width, height: r.height };
170
- })() : void 0;
171
- a("menu", { messageId: n.messageId, triggerRect: t, event: e });
172
- }
173
- async function Me() {
174
- n.readonly || !n.enabled || (_.value = ke(), await ve());
175
- }
176
- function Ce(e) {
177
- if (T(), v(), !I()) return;
178
- const o = e.i;
179
- if (L(o))
180
- return;
181
- const t = h(o);
182
- t && a("remove-reaction", { messageId: n.messageId, key: t }), a("add-reaction", { messageId: n.messageId, key: o });
183
- }
184
- return _e(() => {
185
- document.addEventListener("click", O);
186
- const e = xe(m.value);
187
- e && (f.value = e, e.addEventListener("pointerenter", b), e.addEventListener("pointerleave", R));
188
- }), Ne(() => {
189
- document.removeEventListener("click", O), f.value && (f.value.removeEventListener("pointerenter", b), f.value.removeEventListener("pointerleave", R));
190
- }), je(
191
- () => [n.enabled, n.readonly],
192
- ([e, o]) => {
193
- (!e || o) && (v(), T());
194
- }
195
- ), (e, o) => (l(), d("div", {
90
+ return I({ reactionsContainerRef: l }), (e, n) => (c(), g("div", {
196
91
  ref_key: "reactionsContainerRef",
197
- ref: m,
198
- class: K(["message-reactions", { "has-reactions": i(ie), "is-right-message": ye.value, "is-disabled": !s.enabled }]),
199
- onPointerenter: b,
200
- onPointerleave: R
92
+ ref: l,
93
+ class: y(["message-reactions", { "has-reactions": i(x), "is-right-message": K.value, "is-disabled": !a.enabled }])
201
94
  }, [
202
- (l(!0), d(A, null, F(i(oe), (t) => (l(), Q(Oe, {
95
+ (c(!0), g(w, null, $(i(j), (t) => (c(), z(Y, {
203
96
  key: t.key,
204
- text: re(t),
97
+ text: B(t),
205
98
  position: "bottom-right",
206
99
  offset: 6,
207
100
  delay: 400
208
101
  }, {
209
- default: C(() => [
210
- p("button", {
211
- class: K(["message-reactions__chip", { "is-active": t.reactedByMe && t.count === 1 }]),
212
- onClick: (r) => he(t.key)
102
+ default: D(() => [
103
+ R("button", {
104
+ class: y(["message-reactions__chip", { "is-active": t.reactedByMe && t.count === 1 }]),
105
+ onClick: (m) => O(t.key)
213
106
  }, [
214
- p("span", ze, [
215
- u(H, {
107
+ R("span", Z, [
108
+ G(P, {
216
109
  emoji: t.key
217
110
  }, null, 8, ["emoji"])
218
111
  ]),
219
- ne.value || t.count > 1 ? (l(), d("span", He, Ue(t.count), 1)) : S("", !0)
220
- ], 10, $e)
112
+ S.value || t.count > 1 ? (c(), g("span", ee, H(t.count), 1)) : F("", !0)
113
+ ], 10, X)
221
114
  ]),
222
115
  _: 2
223
- }, 1032, ["text"]))), 128)),
224
- (l(), Q(Pe, { to: "body" }, [
225
- u(D, { name: "message-reactions-popover" }, {
226
- default: C(() => [
227
- V(p("div", {
228
- ref_key: "quickReactionsRef",
229
- ref: de,
230
- class: "message-reactions__quick-panel",
231
- style: $(i(me)),
232
- onMouseenter: o[0] || (o[0] = //@ts-ignore
233
- (...t) => i(q) && i(q)(...t)),
234
- onMouseleave: o[1] || (o[1] = //@ts-ignore
235
- (...t) => i(x) && i(x)(...t))
236
- }, [
237
- (l(!0), d(A, null, F(N.value, (t) => (l(), d("button", {
238
- key: t,
239
- class: "message-reactions__quick-item",
240
- title: t,
241
- onClick: y((r) => be(t), ["stop"])
242
- }, [
243
- u(H, { emoji: t }, null, 8, ["emoji"])
244
- ], 8, Je))), 128)),
245
- p("button", {
246
- class: "message-reactions__expand",
247
- title: "Развернуть",
248
- onClick: y(Me, ["stop"])
249
- }, [
250
- u(Ke)
251
- ]),
252
- s.replyEnabled && s.reply ? (l(), d("button", {
253
- key: 0,
254
- class: "message-reactions__quick-item",
255
- title: "Ответить",
256
- onClick: y(Re, ["stop"])
257
- }, [
258
- u(Be)
259
- ])) : S("", !0),
260
- s.menuEnabled ? (l(), d("button", {
261
- key: 1,
262
- class: "message-reactions__quick-item",
263
- title: "Действия",
264
- onClick: y(Ee, ["stop"])
265
- }, [
266
- u(Qe)
267
- ])) : S("", !0)
268
- ], 36), [
269
- [z, i(le) && !s.readonly && s.enabled]
270
- ])
271
- ]),
272
- _: 1
273
- }),
274
- u(D, { name: "message-reactions-popover" }, {
275
- default: C(() => [
276
- V(p("div", {
277
- ref_key: "pickerRef",
278
- ref: ue,
279
- class: "message-reactions__picker",
280
- style: $(i(fe)),
281
- onMouseenter: o[2] || (o[2] = //@ts-ignore
282
- (...t) => i(B) && i(B)(...t)),
283
- onMouseleave: o[3] || (o[3] = //@ts-ignore
284
- (...t) => i(w) && i(w)(...t))
285
- }, [
286
- u(i(Le), {
287
- native: i(Y),
288
- "emoji-src": i(Z),
289
- theme: _.value,
290
- "picker-type": "",
291
- onSelect: Ce
292
- }, null, 8, ["native", "emoji-src", "theme"])
293
- ], 36), [
294
- [z, i(ce) && !s.readonly && s.enabled]
295
- ])
296
- ]),
297
- _: 1
298
- })
299
- ]))
300
- ], 34));
116
+ }, 1032, ["text"]))), 128))
117
+ ], 2));
301
118
  }
302
119
  });
303
120
  export {
304
- It as default
121
+ ce as default
305
122
  };
@@ -0,0 +1,7 @@
1
+ import o from "./MessageReactionsOverlay.vue2.js";
2
+ /* empty css */
3
+ import t from "../../../_virtual/_plugin-vue_export-helper.js";
4
+ const s = /* @__PURE__ */ t(o, [["__scopeId", "data-v-2fb2f337"]]);
5
+ export {
6
+ s as default
7
+ };
@@ -0,0 +1,231 @@
1
+ import { defineComponent as fe, inject as E, computed as a, ref as x, watch as I, shallowRef as ge, unref as o, onMounted as ke, onUnmounted as Re, createBlock as B, openBlock as s, Teleport as he, createVNode as l, Transition as F, withCtx as Q, createElementBlock as u, createCommentVNode as g, normalizeStyle as K, createElementVNode as ye, Fragment as Me, renderList as Ee, withModifiers as k, resolveDynamicComponent as Ie } from "vue";
2
+ import "../../../hooks/useMessageDraft.js";
3
+ import "../../../hooks/useSearchModel.js";
4
+ import "../../../hooks/useTheme.js";
5
+ import { useEmojiNative as _e } from "../../../hooks/useEmojiNative.js";
6
+ /* empty css */
7
+ /* empty css */
8
+ import "../../../locale/useLocale.js";
9
+ /* empty css */
10
+ import { calculatePanelPosition as Ce } from "./composables/usePositioning.js";
11
+ import { useFeedReactionsOverlayState as Pe, registerFeedReactionsPanelBridge as V } from "../../3_compounds/Feed/composables/useFeedReactionsOverlay.js";
12
+ import be from "./icons/ReplyIcon.vue.js";
13
+ import "../../../node_modules/linkifyjs/dist/linkify.js";
14
+ import "../../../node_modules/linkify-string/dist/linkify-string.js";
15
+ import "../../../functions/parseMarkdown.js";
16
+ import { useStartReply as je } from "../../../hooks/messages/useStartReply.js";
17
+ import Ne from "../../1_atoms/EmojiGlyph/EmojiGlyph.vue.js";
18
+ import we from "./icons/ExpandReactionsIcon.vue.js";
19
+ import Se from "./icons/MessageActionsIcon.vue.js";
20
+ import { QUICK_REACTION_EMOJIS as Te } from "./utils/quickReactions.js";
21
+ import { useReactionsState as Ue } from "./composables/useReactionsState.js";
22
+ import { useReactionsPanel as qe } from "./composables/useReactionsPanel.js";
23
+ const Le = ["title", "onClick"], st = /* @__PURE__ */ fe({
24
+ __name: "MessageReactionsOverlay",
25
+ setup(Oe) {
26
+ const d = E("chatAppId"), D = E("currentUserId", void 0), W = E("reactionUserNames", void 0), { startReply: $ } = je(d || ""), { isNative: z, emojiSrc: H } = _e(d || ""), r = Pe(), i = a(() => (r == null ? void 0 : r.activeTarget.value) ?? null), R = x(null);
27
+ I(
28
+ () => r == null ? void 0 : r.anchorRef.value,
29
+ (e) => {
30
+ R.value = e ?? null;
31
+ },
32
+ { immediate: !0 }
33
+ );
34
+ const _ = x("light"), p = ge(null), h = a(() => Te), y = a(() => o(D)), J = a(() => o(W)), G = a(() => {
35
+ var t;
36
+ const e = y.value;
37
+ if (e != null)
38
+ return (t = J.value) == null ? void 0 : t[String(e)];
39
+ }), X = a(() => {
40
+ var e;
41
+ return ((e = i.value) == null ? void 0 : e.mode) ?? "single";
42
+ }), Y = a(() => {
43
+ var e;
44
+ return (e = i.value) == null ? void 0 : e.reactions;
45
+ }), Z = Ue(
46
+ Y,
47
+ X,
48
+ y,
49
+ G
50
+ ), { addReaction: C, removeReaction: ee, isMyReaction: P, localReactions: te } = Z, ne = qe(h, R), {
51
+ isQuickReactionsOpen: M,
52
+ isFullPickerOpen: b,
53
+ pickerRef: j,
54
+ quickReactionsRef: v,
55
+ quickPanelStyle: N,
56
+ pickerStyle: oe,
57
+ closeQuickPanel: f,
58
+ closeFullPicker: w,
59
+ handleMessageMouseEnter: ie,
60
+ handleMessageMouseLeave: se,
61
+ openFullPicker: ae,
62
+ handleQuickPanelMouseEnter: S,
63
+ handleQuickPanelMouseLeave: T,
64
+ handlePickerMouseEnter: U,
65
+ handlePickerMouseLeave: q,
66
+ handleClickOutside: L
67
+ } = ne;
68
+ I(R, async (e) => {
69
+ var n;
70
+ if (!e || !M.value) return;
71
+ const t = ((n = v.value) == null ? void 0 : n.offsetWidth) || h.value.length * 40 + 40;
72
+ N.value = await Ce(v.value, e, t);
73
+ });
74
+ function O() {
75
+ var e;
76
+ return !!((e = i.value) != null && e.enabled && y.value != null);
77
+ }
78
+ function re() {
79
+ var t;
80
+ if (!d) return "light";
81
+ const e = document.getElementById(d);
82
+ return (t = e == null ? void 0 : e.getAttribute("data-theme")) != null && t.includes("dark") ? "dark" : "light";
83
+ }
84
+ async function ce() {
85
+ if (p.value) return;
86
+ await Promise.resolve({ });
87
+ const e = await import("../../../node_modules/vue3-emoji-picker-ru/dist/emoji-picker.es.js");
88
+ p.value = e.default;
89
+ }
90
+ function A() {
91
+ const e = i.value, t = te.value;
92
+ !e || !t || e.patchReactions({
93
+ ...t,
94
+ items: t.items.map((n) => ({ ...n })),
95
+ meta: t.meta ? { ...t.meta } : void 0
96
+ });
97
+ }
98
+ function le(e) {
99
+ const t = i.value;
100
+ if (!(!t || !O())) {
101
+ if (P(e))
102
+ ee(e), t.handlers.onRemoveReaction({ messageId: t.messageId, key: e });
103
+ else {
104
+ const n = C(e);
105
+ n && t.handlers.onRemoveReaction({ messageId: t.messageId, key: n }), t.handlers.onAddReaction({ messageId: t.messageId, key: e });
106
+ }
107
+ A(), f();
108
+ }
109
+ }
110
+ function ue() {
111
+ const e = i.value;
112
+ e != null && e.reply && ($(e.reply), f());
113
+ }
114
+ function me(e) {
115
+ const t = i.value;
116
+ if (!(t != null && t.menuEnabled)) return;
117
+ const n = e.currentTarget, m = n instanceof HTMLElement ? (() => {
118
+ const c = n.getBoundingClientRect();
119
+ return { top: c.top, right: c.right, bottom: c.bottom, left: c.left, width: c.width, height: c.height };
120
+ })() : void 0;
121
+ t.handlers.onMenu({ messageId: t.messageId, triggerRect: m, event: e });
122
+ }
123
+ async function de() {
124
+ var e;
125
+ (e = i.value) != null && e.enabled && (_.value = re(), await ce(), await ae());
126
+ }
127
+ function pe(e) {
128
+ const t = i.value;
129
+ if (w(), f(), !t || !O()) return;
130
+ const n = e.i;
131
+ if (P(n)) return;
132
+ const m = C(n);
133
+ m && t.handlers.onRemoveReaction({ messageId: t.messageId, key: m }), t.handlers.onAddReaction({ messageId: t.messageId, key: n }), A();
134
+ }
135
+ function ve(e) {
136
+ var t, n;
137
+ return !!((t = v.value) != null && t.contains(e) || (n = j.value) != null && n.contains(e));
138
+ }
139
+ return ke(() => {
140
+ document.addEventListener("click", L), V({
141
+ onMessageEnter: ie,
142
+ onMessageLeave: se,
143
+ isPanelOpen: () => M.value || b.value,
144
+ containsNode: ve
145
+ });
146
+ }), Re(() => {
147
+ document.removeEventListener("click", L), V(null);
148
+ }), I(
149
+ () => i.value,
150
+ (e) => {
151
+ e || (f(), w());
152
+ }
153
+ ), (e, t) => (s(), B(he, { to: "body" }, [
154
+ l(F, { name: "message-reactions-popover" }, {
155
+ default: Q(() => [
156
+ o(M) && i.value ? (s(), u("div", {
157
+ key: 0,
158
+ ref_key: "quickReactionsRef",
159
+ ref: v,
160
+ class: "message-reactions__quick-panel",
161
+ style: K(o(N)),
162
+ onMouseenter: t[0] || (t[0] = //@ts-ignore
163
+ (...n) => o(S) && o(S)(...n)),
164
+ onMouseleave: t[1] || (t[1] = //@ts-ignore
165
+ (...n) => o(T) && o(T)(...n))
166
+ }, [
167
+ (s(!0), u(Me, null, Ee(h.value, (n) => (s(), u("button", {
168
+ key: n,
169
+ class: "message-reactions__quick-item",
170
+ title: n,
171
+ onClick: k((m) => le(n), ["stop"])
172
+ }, [
173
+ l(Ne, { emoji: n }, null, 8, ["emoji"])
174
+ ], 8, Le))), 128)),
175
+ ye("button", {
176
+ class: "message-reactions__expand",
177
+ title: "Развернуть",
178
+ onClick: k(de, ["stop"])
179
+ }, [
180
+ l(we)
181
+ ]),
182
+ i.value.replyEnabled && i.value.reply ? (s(), u("button", {
183
+ key: 0,
184
+ class: "message-reactions__quick-item",
185
+ title: "Ответить",
186
+ onClick: k(ue, ["stop"])
187
+ }, [
188
+ l(be)
189
+ ])) : g("", !0),
190
+ i.value.menuEnabled ? (s(), u("button", {
191
+ key: 1,
192
+ class: "message-reactions__quick-item",
193
+ title: "Действия",
194
+ onClick: k(me, ["stop"])
195
+ }, [
196
+ l(Se)
197
+ ])) : g("", !0)
198
+ ], 36)) : g("", !0)
199
+ ]),
200
+ _: 1
201
+ }),
202
+ l(F, { name: "message-reactions-popover" }, {
203
+ default: Q(() => [
204
+ o(b) && i.value && p.value ? (s(), u("div", {
205
+ key: 0,
206
+ ref_key: "pickerRef",
207
+ ref: j,
208
+ class: "message-reactions__picker",
209
+ style: K(o(oe)),
210
+ onMouseenter: t[2] || (t[2] = //@ts-ignore
211
+ (...n) => o(U) && o(U)(...n)),
212
+ onMouseleave: t[3] || (t[3] = //@ts-ignore
213
+ (...n) => o(q) && o(q)(...n))
214
+ }, [
215
+ (s(), B(Ie(p.value), {
216
+ native: o(z),
217
+ "emoji-src": o(H),
218
+ theme: _.value,
219
+ "picker-type": "",
220
+ onSelect: pe
221
+ }, null, 40, ["native", "emoji-src", "theme"]))
222
+ ], 36)) : g("", !0)
223
+ ]),
224
+ _: 1
225
+ })
226
+ ]));
227
+ }
228
+ });
229
+ export {
230
+ st as default
231
+ };