@mobilon-dev/chotto 0.3.93 → 0.3.95
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_chatlist_elements/ChatItem/ChatItem.vue.js +2 -2
- package/dist/components/2_chatlist_elements/ChatItem/ChatItem.vue2.js +79 -79
- package/dist/components/3_compounds/Feed/Feed.vue.js +3 -3
- package/dist/components/3_compounds/Feed/Feed.vue2.js +147 -157
- package/dist/components/3_compounds/Feed/composables/useFeedScroll.js +81 -48
- package/dist/hooks/useMessageDraft.js +96 -75
- package/dist/types/components/3_compounds/Feed/composables/useFeedScroll.d.ts +5 -7
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import t from "./ChatItem.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import o from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const e = /* @__PURE__ */ o(t, [["__scopeId", "data-v-50654e81"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
e as default
|
|
7
7
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as Bt, inject as Vt, useId as Ht, ref as M, computed as
|
|
1
|
+
import { defineComponent as Bt, inject as Vt, useId as Ht, ref as M, computed as u, watch as Nt, onMounted as Ut, nextTick as U, onUnmounted as Dt, createElementBlock as a, openBlock as o, createElementVNode as m, createCommentVNode as r, withModifiers as Ft, normalizeClass as D, normalizeStyle as tt, createVNode as F, withCtx as P, toDisplayString as f, createBlock as d, resolveDynamicComponent as et, unref as h, Teleport as Pt, Fragment as Rt, renderList as Wt } from "vue";
|
|
2
2
|
import { getStatus as Xt, statuses as Yt } from "../../../functions/getStatusMessage.js";
|
|
3
3
|
import "../../../functions/parseMarkdown.js";
|
|
4
4
|
import { t as S } from "../../../locale/useLocale.js";
|
|
@@ -81,57 +81,57 @@ const ne = { class: "chat-item__avatar-container" }, ie = ["src"], oe = {
|
|
|
81
81
|
},
|
|
82
82
|
emits: ["select", "action", "expand"],
|
|
83
83
|
setup(c, { emit: rt }) {
|
|
84
|
-
const b = Vt("chatAppId"), { getTheme: Y } = jt(b), { isNative: $ } = zt(b),
|
|
84
|
+
const b = Vt("chatAppId"), { getTheme: Y } = jt(b), { isNative: $ } = zt(b), n = c, E = rt, y = Ht(), p = M(!1), k = M(!1), A = M(!1), lt = M(null), ut = () => {
|
|
85
85
|
A.value = !0;
|
|
86
86
|
}, mt = (t) => {
|
|
87
|
-
A.value || t.target instanceof HTMLElement && t.target.id != "noSelectButton" && E("select", { chat:
|
|
87
|
+
A.value || t.target instanceof HTMLElement && t.target.id != "noSelectButton" && E("select", { chat: n.chat, dialog: null }), A.value = !1;
|
|
88
88
|
}, dt = (t) => {
|
|
89
|
-
E("select", { chat:
|
|
90
|
-
}, ht = () =>
|
|
91
|
-
|
|
89
|
+
E("select", { chat: n.chat, dialog: t });
|
|
90
|
+
}, ht = () => n.chat.isSelected ? "chat-item__selected" : "", ft = (t) => t.isSelected ? "dialog__selected" : "", j = (t) => {
|
|
91
|
+
n.contextMenuTrigger === "rightClick" && B(), E("action", { chat: n.chat, ...t });
|
|
92
92
|
}, B = () => {
|
|
93
93
|
const t = document.getElementById("context-menu-rightclick-" + y);
|
|
94
94
|
t && (t.style.top = "0", t.style.left = "0", t.style.opacity = "0", t.style.display = "none"), k.value = !1;
|
|
95
95
|
}, vt = () => {
|
|
96
|
-
document.querySelectorAll('[id^="context-menu-rightclick-"]').forEach((
|
|
97
|
-
const i =
|
|
96
|
+
document.querySelectorAll('[id^="context-menu-rightclick-"]').forEach((e) => {
|
|
97
|
+
const i = e;
|
|
98
98
|
i.id !== "context-menu-rightclick-" + y && (i.style.top = "0", i.style.left = "0", i.style.opacity = "0", i.style.display = "none");
|
|
99
99
|
});
|
|
100
|
-
}, gt = () =>
|
|
100
|
+
}, gt = () => n.chat.dialogs ? [...n.chat.dialogs].sort((t, e) => Number(t["lastActivity.timestamp"]) > Number(e["lastActivity.timestamp"]) ? -1 : Number(t["lastActivity.timestamp"]) < Number(e["lastActivity.timestamp"]) ? 1 : (Number(t["lastActivity.timestamp"]) == Number(e["lastActivity.timestamp"]), 0)) : [], yt = u(() => Xt(n.chat["lastMessage.status"])), pt = u(() => n.chat.showEmptyIndicator || n.chat.countUnread > 0), _t = u(() => n.chat.countUnread > 0 ? n.chat.countUnread > 99 ? "99+" : n.chat.countUnread : n.chat.showEmptyIndicator ? "" : void 0);
|
|
101
101
|
let L;
|
|
102
102
|
const _ = M(0), z = [S("component.ChatItem.typing") + ".", S("component.ChatItem.typing") + "..", S("component.ChatItem.typing") + "..."], O = (t) => {
|
|
103
|
-
var
|
|
103
|
+
var l, s, v;
|
|
104
104
|
if (typeof t == "string")
|
|
105
105
|
return t;
|
|
106
106
|
if ((t == null ? void 0 : t.type) === "message.sticker")
|
|
107
107
|
return "Стикер";
|
|
108
108
|
if ((t == null ? void 0 : t.type) === "message.audio")
|
|
109
|
-
return (t.isVoiceMessage || ((
|
|
109
|
+
return (t.isVoiceMessage || ((l = t == null ? void 0 : t.data) == null ? void 0 : l.isVoiceMessage)) === !0 ? "Голосовое сообщение" : "Аудиофайл";
|
|
110
110
|
if ((t == null ? void 0 : t.type) === "message.missedCall")
|
|
111
111
|
return "Пропущенный звонок";
|
|
112
|
-
const
|
|
113
|
-
if (
|
|
114
|
-
return
|
|
112
|
+
const e = (s = t == null ? void 0 : t.data) == null ? void 0 : s.text;
|
|
113
|
+
if (e)
|
|
114
|
+
return e;
|
|
115
115
|
const i = (v = t == null ? void 0 : t.data) == null ? void 0 : v.filename;
|
|
116
116
|
return i || "";
|
|
117
|
-
}, kt = (t) => typeof t == "string" ? null : (t == null ? void 0 : t.type) || null, V = S("component.ChatItem.draft"), H =
|
|
118
|
-
const t = $t(String(b ?? ""),
|
|
119
|
-
if (!(!t || t.edit) && !(!t.listPreviewText && !t.listPreviewFile))
|
|
117
|
+
}, kt = (t) => typeof t == "string" ? null : (t == null ? void 0 : t.type) || null, V = S("component.ChatItem.draft"), H = u(() => {
|
|
118
|
+
const t = $t(String(b ?? ""), n.chat.chatId);
|
|
119
|
+
if (!(!t || t.edit) && !(!t.listPreviewText && !t.listPreviewFile) && !(!(t.text || "").trim() && !t.file))
|
|
120
120
|
return t;
|
|
121
|
-
}), x =
|
|
121
|
+
}), x = u(() => !!H.value), g = u(() => {
|
|
122
|
+
var e;
|
|
122
123
|
const t = H.value;
|
|
123
|
-
return t ? t.
|
|
124
|
-
}), q =
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (e.chat.typing || x.value)
|
|
124
|
+
return t ? t.file ? (((e = t.listPreviewFile) == null ? void 0 : e.name) || t.file.name || "").trim() : (t.listPreviewText || "").trim() : "";
|
|
125
|
+
}), q = u(() => {
|
|
126
|
+
const t = H.value;
|
|
127
|
+
if (!(t != null && t.file)) return null;
|
|
128
|
+
const e = t.listPreviewFile, i = ((e == null ? void 0 : e.type) || t.file.type || "").toLowerCase(), l = ((e == null ? void 0 : e.name) || t.file.name || "").toLowerCase();
|
|
129
|
+
return i === "sticker" || l.endsWith(".tgs") || l.endsWith(".webp") ? X : i === "image" || i.includes("image") ? ct : i === "video" || i.includes("video") ? at : i === "audio" || i.includes("audio") ? l.includes("voice") || l.includes("голос") ? st : ot : i === "file" || l ? W : W;
|
|
130
|
+
}), xt = u(() => R(g.value || "")), G = u(() => {
|
|
131
|
+
var e, i, l;
|
|
132
|
+
if (n.chat.typing || x.value)
|
|
133
133
|
return null;
|
|
134
|
-
const t = kt(
|
|
134
|
+
const t = kt(n.chat.lastMessage);
|
|
135
135
|
if (!t)
|
|
136
136
|
return null;
|
|
137
137
|
if (t === "message.sticker")
|
|
@@ -141,69 +141,69 @@ const ne = { class: "chat-item__avatar-container" }, ie = ["src"], oe = {
|
|
|
141
141
|
if (t === "message.video")
|
|
142
142
|
return at;
|
|
143
143
|
if (t === "message.audio") {
|
|
144
|
-
const s =
|
|
145
|
-
return (s.isVoiceMessage || ((
|
|
144
|
+
const s = n.chat.lastMessage;
|
|
145
|
+
return (s.isVoiceMessage || ((e = s == null ? void 0 : s.data) == null ? void 0 : e.isVoiceMessage)) === !0 ? st : ot;
|
|
146
146
|
}
|
|
147
147
|
if (t === "message.missedCall")
|
|
148
148
|
return ee;
|
|
149
149
|
if (t === "message.file") {
|
|
150
|
-
const s =
|
|
150
|
+
const s = n.chat.lastMessage, v = ((l = (i = s == null ? void 0 : s.data) == null ? void 0 : i.filename) == null ? void 0 : l.toLowerCase()) || "";
|
|
151
151
|
return v.endsWith(".tgs") || v.endsWith(".webp") ? X : W;
|
|
152
152
|
}
|
|
153
153
|
return null;
|
|
154
|
-
}), wt =
|
|
154
|
+
}), wt = u(() => n.chat.typing ? z[_.value] : x.value ? g.value ? `${V} ${g.value}` : V : O(n.chat.lastMessage)), N = u(() => n.chat.typing ? z[_.value] : O(n.chat.lastMessage)), J = u(
|
|
155
155
|
() => !$.value && nt(g.value || N.value || "")
|
|
156
|
-
), Ct =
|
|
157
|
-
() => !$.value && nt(
|
|
158
|
-
), It =
|
|
156
|
+
), Ct = u(
|
|
157
|
+
() => !$.value && nt(n.chat.name || "")
|
|
158
|
+
), It = u(() => R(N.value || "")), Tt = u(() => R(n.chat.name || ""));
|
|
159
159
|
Nt(
|
|
160
|
-
() =>
|
|
160
|
+
() => n.chat.typing,
|
|
161
161
|
() => {
|
|
162
|
-
|
|
162
|
+
n.chat.typing ? L = setInterval(() => {
|
|
163
163
|
_.value < 2 ? _.value += 1 : _.value = 0;
|
|
164
164
|
}, 1e3) : (_.value = 0, L && (clearInterval(L), L = void 0));
|
|
165
165
|
},
|
|
166
166
|
{ immediate: !0 }
|
|
167
167
|
);
|
|
168
168
|
const Mt = () => {
|
|
169
|
-
|
|
169
|
+
n.contextMenuTrigger === "hover" && (p.value = !0);
|
|
170
170
|
}, Et = (t) => {
|
|
171
|
-
|
|
171
|
+
n.contextMenuTrigger === "hover" && (t.relatedTarget instanceof HTMLElement && t.relatedTarget.className == "context-menu__list" ? p.value = !0 : p.value = !1);
|
|
172
172
|
}, Lt = (t) => {
|
|
173
|
-
|
|
173
|
+
n.contextMenuTrigger === "rightClick" && n.chat.actions && St(t);
|
|
174
174
|
}, St = (t) => {
|
|
175
175
|
vt(), k.value = !0, U(() => {
|
|
176
|
-
const
|
|
177
|
-
if (
|
|
178
|
-
const i = t.clientX,
|
|
179
|
-
|
|
180
|
-
const s =
|
|
181
|
-
|
|
176
|
+
const e = document.getElementById("context-menu-rightclick-" + y);
|
|
177
|
+
if (e) {
|
|
178
|
+
const i = t.clientX, l = t.clientY;
|
|
179
|
+
e.style.display = "inherit";
|
|
180
|
+
const s = e.getBoundingClientRect();
|
|
181
|
+
e.style.display = "none", U(() => {
|
|
182
182
|
const v = window.innerWidth, Z = window.innerHeight, w = window.scrollX || window.pageXOffset, C = window.scrollY || window.pageYOffset;
|
|
183
|
-
let I = i + w, T =
|
|
184
|
-
I + s.width > v + w && (I = i + w - s.width), T + s.height > Z + C && (T =
|
|
183
|
+
let I = i + w, T = l + C;
|
|
184
|
+
I + s.width > v + w && (I = i + w - s.width), T + s.height > Z + C && (T = l + C - s.height), I < w && (I = w), T < C && (T = C), e.style.top = T + "px", e.style.left = I + "px", e.style.opacity = "1", e.style.display = "inherit";
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
187
|
});
|
|
188
188
|
}, bt = () => {
|
|
189
189
|
}, At = () => {
|
|
190
190
|
}, K = (t) => {
|
|
191
|
-
if (
|
|
192
|
-
const
|
|
193
|
-
(!i || !i.contains(
|
|
191
|
+
if (n.contextMenuTrigger === "rightClick" && k.value) {
|
|
192
|
+
const e = t.target, i = document.getElementById("context-menu-rightclick-" + y);
|
|
193
|
+
(!i || !i.contains(e)) && B();
|
|
194
194
|
}
|
|
195
195
|
}, Q = () => {
|
|
196
|
-
|
|
196
|
+
n.contextMenuTrigger === "rightClick" && k.value && B();
|
|
197
197
|
};
|
|
198
198
|
return Ut(() => {
|
|
199
|
-
|
|
199
|
+
n.contextMenuTrigger === "rightClick" && (document.addEventListener("click", K), window.addEventListener("scroll", Q, !0), U(() => {
|
|
200
200
|
const t = document.getElementById("context-menu-rightclick-" + y);
|
|
201
201
|
t && (t.style.display = "none", t.style.opacity = "0");
|
|
202
202
|
}));
|
|
203
203
|
}), Dt(() => {
|
|
204
204
|
document.removeEventListener("click", K), window.removeEventListener("scroll", Q, !0);
|
|
205
|
-
}), (t,
|
|
206
|
-
|
|
205
|
+
}), (t, e) => (o(), a("div", null, [
|
|
206
|
+
m("div", {
|
|
207
207
|
ref_key: "containerRef",
|
|
208
208
|
ref: lt,
|
|
209
209
|
class: D(["chat-item__container", ht()]),
|
|
@@ -212,21 +212,21 @@ const ne = { class: "chat-item__avatar-container" }, ie = ["src"], oe = {
|
|
|
212
212
|
onClick: mt,
|
|
213
213
|
onContextmenu: Ft(Lt, ["prevent"])
|
|
214
214
|
}, [
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
m("div", ne, [
|
|
216
|
+
m("span", {
|
|
217
217
|
class: "chat-item__status-user",
|
|
218
|
-
style: tt({ backgroundColor:
|
|
218
|
+
style: tt({ backgroundColor: n.chat.status })
|
|
219
219
|
}, null, 4),
|
|
220
|
-
|
|
220
|
+
n.chat.avatar ? (o(), a("img", {
|
|
221
221
|
key: 0,
|
|
222
|
-
src:
|
|
222
|
+
src: n.chat.avatar,
|
|
223
223
|
height: "48",
|
|
224
224
|
width: "48"
|
|
225
225
|
}, null, 8, ie)) : (o(), a("div", oe, [
|
|
226
226
|
F(Gt)
|
|
227
227
|
]))
|
|
228
228
|
]),
|
|
229
|
-
|
|
229
|
+
m("div", ce, [
|
|
230
230
|
F(it, {
|
|
231
231
|
text: c.chat.name,
|
|
232
232
|
position: "bottom"
|
|
@@ -251,7 +251,7 @@ const ne = { class: "chat-item__avatar-container" }, ie = ["src"], oe = {
|
|
|
251
251
|
class: "chat-item__message-icon"
|
|
252
252
|
})) : r("", !0),
|
|
253
253
|
x.value ? (o(), a("span", le, [
|
|
254
|
-
|
|
254
|
+
m("span", ue, f(h(V)), 1),
|
|
255
255
|
q.value ? (o(), d(et(q.value), {
|
|
256
256
|
key: 0,
|
|
257
257
|
class: "chat-item__message-icon"
|
|
@@ -271,7 +271,7 @@ const ne = { class: "chat-item__avatar-container" }, ie = ["src"], oe = {
|
|
|
271
271
|
_: 1
|
|
272
272
|
}, 8, ["text"])
|
|
273
273
|
]),
|
|
274
|
-
|
|
274
|
+
m("div", ve, [
|
|
275
275
|
c.chat["lastActivity.time"] && (!c.chat.actions || !p.value) ? (o(), a("div", ge, f(c.chat["lastActivity.time"]), 1)) : r("", !0),
|
|
276
276
|
p.value && c.chat.actions && c.contextMenuTrigger === "hover" ? (o(), d(Ot, {
|
|
277
277
|
key: 1,
|
|
@@ -280,10 +280,10 @@ const ne = { class: "chat-item__avatar-container" }, ie = ["src"], oe = {
|
|
|
280
280
|
actions: c.chat.actions,
|
|
281
281
|
onClick: j,
|
|
282
282
|
onButtonClick: ut,
|
|
283
|
-
onMenuMouseLeave:
|
|
283
|
+
onMenuMouseLeave: e[0] || (e[0] = (i) => p.value = !1)
|
|
284
284
|
}, {
|
|
285
|
-
default: P(() => [...
|
|
286
|
-
|
|
285
|
+
default: P(() => [...e[2] || (e[2] = [
|
|
286
|
+
m("span", { class: "pi pi-ellipsis-h chat-item__actions-trigger" }, null, -1)
|
|
287
287
|
])]),
|
|
288
288
|
_: 1
|
|
289
289
|
}, 8, ["actions"])) : r("", !0),
|
|
@@ -298,7 +298,7 @@ const ne = { class: "chat-item__avatar-container" }, ie = ["src"], oe = {
|
|
|
298
298
|
onMouseleave: At
|
|
299
299
|
}, null, 8, ["id", "actions", "data-theme"])) : r("", !0)
|
|
300
300
|
])),
|
|
301
|
-
|
|
301
|
+
m("div", ye, [
|
|
302
302
|
h(Yt).includes(c.chat["lastMessage.status"]) ? (o(), a("div", {
|
|
303
303
|
key: 0,
|
|
304
304
|
class: D(["chat-item__status-message", yt.value])
|
|
@@ -311,30 +311,30 @@ const ne = { class: "chat-item__avatar-container" }, ie = ["src"], oe = {
|
|
|
311
311
|
c.chat.isFixedTop || c.chat.isFixedBottom ? (o(), a("span", ke)) : r("", !0)
|
|
312
312
|
])) : r("", !0)
|
|
313
313
|
]),
|
|
314
|
-
|
|
314
|
+
n.showDialogs && c.chat.dialogs ? (o(), a("div", {
|
|
315
315
|
key: 0,
|
|
316
316
|
class: "chat-item__dialog-buttons",
|
|
317
|
-
onClick:
|
|
317
|
+
onClick: e[1] || (e[1] = (i) => E("expand", n.chat))
|
|
318
318
|
}, [
|
|
319
|
-
|
|
320
|
-
|
|
319
|
+
n.showDialogs && !c.chat.dialogsExpanded ? (o(), a("button", xe, [...e[3] || (e[3] = [
|
|
320
|
+
m("span", {
|
|
321
321
|
id: "noSelectButton",
|
|
322
322
|
class: "pi pi-angle-down"
|
|
323
323
|
}, null, -1)
|
|
324
324
|
])])) : r("", !0),
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
n.showDialogs && c.chat.dialogsExpanded ? (o(), a("button", we, [...e[4] || (e[4] = [
|
|
326
|
+
m("span", {
|
|
327
327
|
id: "noSelectButton",
|
|
328
328
|
class: "pi pi-angle-up"
|
|
329
329
|
}, null, -1)
|
|
330
330
|
])])) : r("", !0)
|
|
331
331
|
])) : r("", !0)
|
|
332
332
|
], 34),
|
|
333
|
-
|
|
333
|
+
n.showDialogs && c.chat.dialogsExpanded ? (o(), a("div", Ce, [
|
|
334
334
|
(o(!0), a(Rt, null, Wt(gt(), (i) => (o(), a("div", {
|
|
335
335
|
key: i.dialogId,
|
|
336
336
|
class: D(["dialog__item", ft(i)]),
|
|
337
|
-
onClick: (
|
|
337
|
+
onClick: (l) => dt(i)
|
|
338
338
|
}, [
|
|
339
339
|
i.icon ? (o(), a("img", {
|
|
340
340
|
key: 0,
|
|
@@ -343,9 +343,9 @@ const ne = { class: "chat-item__avatar-container" }, ie = ["src"], oe = {
|
|
|
343
343
|
height: "16",
|
|
344
344
|
width: "16"
|
|
345
345
|
}, null, 8, Te)) : (o(), a("span", Me)),
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
346
|
+
m("div", Ee, [
|
|
347
|
+
m("div", Le, f(i.name), 1),
|
|
348
|
+
m("div", Se, f(i["lastActivity.time"]), 1)
|
|
349
349
|
]),
|
|
350
350
|
i.countUnread > 0 ? (o(), a("div", {
|
|
351
351
|
key: 2,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./Feed.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
const
|
|
3
|
+
import t from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const e = /* @__PURE__ */ t(o, [["__scopeId", "data-v-dd5bf82f"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
e as default
|
|
7
7
|
};
|