@mobilon-dev/chotto 0.3.105 → 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.
- package/dist/chotto.css +1 -1
- package/dist/components/2_feed_elements/AudioMessage/AudioMessage.vue.js +2 -2
- package/dist/components/2_feed_elements/AudioMessage/AudioMessage.vue2.js +293 -266
- package/dist/components/2_feed_elements/FeedReplyQuote/FeedReplyQuote.vue.js +7 -0
- package/dist/components/2_feed_elements/FeedReplyQuote/FeedReplyQuote.vue2.js +73 -0
- package/dist/components/2_feed_elements/FileMessage/FileMessage.vue.js +1 -1
- package/dist/components/2_feed_elements/FileMessage/FileMessage.vue2.js +185 -158
- package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue.js +3 -3
- package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue2.js +227 -200
- package/dist/components/2_feed_elements/MessageReactions/MessageReactions.vue.js +2 -2
- package/dist/components/2_feed_elements/MessageReactions/MessageReactions.vue2.js +62 -245
- package/dist/components/2_feed_elements/MessageReactions/MessageReactionsOverlay.vue.js +7 -0
- package/dist/components/2_feed_elements/MessageReactions/MessageReactionsOverlay.vue2.js +231 -0
- package/dist/components/2_feed_elements/MessageReactions/composables/usePositioning.js +25 -25
- package/dist/components/2_feed_elements/StickerMessage/StickerMessage.vue.js +2 -2
- package/dist/components/2_feed_elements/StickerMessage/StickerMessage.vue2.js +213 -186
- package/dist/components/2_feed_elements/TextMessage/TextMessage.vue.js +2 -2
- package/dist/components/2_feed_elements/TextMessage/TextMessage.vue2.js +190 -164
- package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue.js +1 -1
- package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue2.js +209 -182
- package/dist/components/3_compounds/Feed/Feed.vue.js +2 -2
- package/dist/components/3_compounds/Feed/Feed.vue2.js +261 -213
- package/dist/components/3_compounds/Feed/composables/useFeedGrouping.js +23 -20
- package/dist/components/3_compounds/Feed/composables/useFeedProgressiveRender.js +82 -0
- package/dist/components/3_compounds/Feed/composables/useFeedReactionsOverlay.js +34 -0
- package/dist/hooks/messages/useMessageActions.js +81 -70
- package/dist/hooks/messages/useMessageReactionsInFeed.js +53 -0
- package/dist/hooks/messages/useMessageReactionsMount.js +21 -0
- package/dist/index.js +245 -238
- package/dist/types/components/2_feed_elements/FeedReplyQuote/FeedReplyQuote.vue.d.ts +19 -0
- package/dist/types/components/2_feed_elements/MessageReactions/MessageReactions.vue.d.ts +4 -71
- package/dist/types/components/2_feed_elements/MessageReactions/MessageReactionsOverlay.vue.d.ts +2 -0
- package/dist/types/components/2_feed_elements/MessageReactions/composables/usePositioning.d.ts +2 -1
- package/dist/types/components/3_compounds/Feed/Feed.vue.d.ts +6 -0
- package/dist/types/components/3_compounds/Feed/composables/index.d.ts +2 -0
- package/dist/types/components/3_compounds/Feed/composables/useFeedGrouping.d.ts +3 -22
- package/dist/types/components/3_compounds/Feed/composables/useFeedProgressiveRender.d.ts +22 -0
- package/dist/types/components/3_compounds/Feed/composables/useFeedReactionsOverlay.d.ts +52 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/hooks/messages/index.d.ts +2 -0
- package/dist/types/hooks/messages/useMessageReactionsInFeed.d.ts +25 -0
- package/dist/types/hooks/messages/useMessageReactionsMount.d.ts +10 -0
- package/package.json +1 -1
|
@@ -1,32 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
6
|
-
import "
|
|
7
|
-
import {
|
|
8
|
-
|
|
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
|
-
},
|
|
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: (
|
|
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"
|
|
84
|
-
setup(
|
|
85
|
-
const
|
|
86
|
-
var t,
|
|
87
|
-
const e = (t =
|
|
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
|
|
90
|
-
if (
|
|
91
|
-
return (
|
|
92
|
-
}),
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
), { displayedReactions:
|
|
98
|
-
function
|
|
99
|
-
|
|
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
|
|
102
|
-
|
|
103
|
-
|
|
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
|
|
128
|
-
if (
|
|
129
|
-
if (
|
|
130
|
-
if (
|
|
131
|
-
|
|
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 =
|
|
134
|
-
t &&
|
|
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
|
-
|
|
87
|
+
k(e), r("toggle-reaction", { messageId: o.messageId, key: e }), _();
|
|
139
88
|
}
|
|
140
89
|
}
|
|
141
|
-
|
|
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:
|
|
198
|
-
class:
|
|
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
|
-
(
|
|
95
|
+
(c(!0), g(w, null, $(i(j), (t) => (c(), z(Y, {
|
|
203
96
|
key: t.key,
|
|
204
|
-
text:
|
|
97
|
+
text: B(t),
|
|
205
98
|
position: "bottom-right",
|
|
206
99
|
offset: 6,
|
|
207
100
|
delay: 400
|
|
208
101
|
}, {
|
|
209
|
-
default:
|
|
210
|
-
|
|
211
|
-
class:
|
|
212
|
-
onClick: (
|
|
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
|
-
|
|
215
|
-
|
|
107
|
+
R("span", Z, [
|
|
108
|
+
G(P, {
|
|
216
109
|
emoji: t.key
|
|
217
110
|
}, null, 8, ["emoji"])
|
|
218
111
|
]),
|
|
219
|
-
|
|
220
|
-
], 10,
|
|
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
|
-
|
|
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
|
-
|
|
121
|
+
ce as default
|
|
305
122
|
};
|
|
@@ -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
|
+
};
|