@mobilon-dev/chotto 0.3.93 → 0.3.94

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.
@@ -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 p = /* @__PURE__ */ o(t, [["__scopeId", "data-v-c0089500"]]);
4
+ const e = /* @__PURE__ */ o(t, [["__scopeId", "data-v-50654e81"]]);
5
5
  export {
6
- p as default
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 l, watch as Nt, onMounted as Ut, nextTick as U, onUnmounted as Dt, createElementBlock as a, openBlock as o, createElementVNode as u, 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";
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), e = c, E = rt, y = Ht(), p = M(!1), k = M(!1), A = M(!1), lt = M(null), ut = () => {
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: e.chat, dialog: null }), A.value = !1;
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: e.chat, dialog: t });
90
- }, ht = () => e.chat.isSelected ? "chat-item__selected" : "", ft = (t) => t.isSelected ? "dialog__selected" : "", j = (t) => {
91
- e.contextMenuTrigger === "rightClick" && B(), E("action", { chat: e.chat, ...t });
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((n) => {
97
- const i = n;
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 = () => e.chat.dialogs ? [...e.chat.dialogs].sort((t, n) => Number(t["lastActivity.timestamp"]) > Number(n["lastActivity.timestamp"]) ? -1 : Number(t["lastActivity.timestamp"]) < Number(n["lastActivity.timestamp"]) ? 1 : (Number(t["lastActivity.timestamp"]) == Number(n["lastActivity.timestamp"]), 0)) : [], yt = l(() => Xt(e.chat["lastMessage.status"])), pt = l(() => e.chat.showEmptyIndicator || e.chat.countUnread > 0), _t = l(() => e.chat.countUnread > 0 ? e.chat.countUnread > 99 ? "99+" : e.chat.countUnread : e.chat.showEmptyIndicator ? "" : void 0);
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 m, s, v;
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 || ((m = t == null ? void 0 : t.data) == null ? void 0 : m.isVoiceMessage)) === !0 ? "Голосовое сообщение" : "Аудиофайл";
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 n = (s = t == null ? void 0 : t.data) == null ? void 0 : s.text;
113
- if (n)
114
- return n;
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 = l(() => {
118
- const t = $t(String(b ?? ""), e.chat.chatId);
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 = l(() => !!H.value), g = l(() => {
121
+ }), x = u(() => !!H.value), g = u(() => {
122
+ var e;
122
123
  const t = H.value;
123
- return t ? t.listPreviewFile ? (t.listPreviewFile.name || "").trim() : (t.listPreviewText || "").trim() : "";
124
- }), q = l(() => {
125
- var m;
126
- const t = (m = H.value) == null ? void 0 : m.listPreviewFile;
127
- if (!t) return null;
128
- const n = (t.type || "").toLowerCase(), i = (t.name || "").toLowerCase();
129
- return n === "sticker" || i.endsWith(".tgs") || i.endsWith(".webp") ? X : n === "image" || n.includes("image") ? ct : n === "video" || n.includes("video") ? at : n === "audio" || n.includes("audio") ? i.includes("voice") || i.includes("голос") ? st : ot : n === "file" || t.name ? W : W;
130
- }), xt = l(() => R(g.value || "")), G = l(() => {
131
- var n, i, m;
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(e.chat.lastMessage);
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 = e.chat.lastMessage;
145
- return (s.isVoiceMessage || ((n = s == null ? void 0 : s.data) == null ? void 0 : n.isVoiceMessage)) === !0 ? st : ot;
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 = e.chat.lastMessage, v = ((m = (i = s == null ? void 0 : s.data) == null ? void 0 : i.filename) == null ? void 0 : m.toLowerCase()) || "";
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 = l(() => e.chat.typing ? z[_.value] : x.value ? g.value ? `${V} ${g.value}` : V : O(e.chat.lastMessage)), N = l(() => e.chat.typing ? z[_.value] : O(e.chat.lastMessage)), J = l(
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 = l(
157
- () => !$.value && nt(e.chat.name || "")
158
- ), It = l(() => R(N.value || "")), Tt = l(() => R(e.chat.name || ""));
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
- () => e.chat.typing,
160
+ () => n.chat.typing,
161
161
  () => {
162
- e.chat.typing ? L = setInterval(() => {
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
- e.contextMenuTrigger === "hover" && (p.value = !0);
169
+ n.contextMenuTrigger === "hover" && (p.value = !0);
170
170
  }, Et = (t) => {
171
- e.contextMenuTrigger === "hover" && (t.relatedTarget instanceof HTMLElement && t.relatedTarget.className == "context-menu__list" ? p.value = !0 : p.value = !1);
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
- e.contextMenuTrigger === "rightClick" && e.chat.actions && St(t);
173
+ n.contextMenuTrigger === "rightClick" && n.chat.actions && St(t);
174
174
  }, St = (t) => {
175
175
  vt(), k.value = !0, U(() => {
176
- const n = document.getElementById("context-menu-rightclick-" + y);
177
- if (n) {
178
- const i = t.clientX, m = t.clientY;
179
- n.style.display = "inherit";
180
- const s = n.getBoundingClientRect();
181
- n.style.display = "none", U(() => {
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 = m + C;
184
- I + s.width > v + w && (I = i + w - s.width), T + s.height > Z + C && (T = m + C - s.height), I < w && (I = w), T < C && (T = C), n.style.top = T + "px", n.style.left = I + "px", n.style.opacity = "1", n.style.display = "inherit";
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 (e.contextMenuTrigger === "rightClick" && k.value) {
192
- const n = t.target, i = document.getElementById("context-menu-rightclick-" + y);
193
- (!i || !i.contains(n)) && B();
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
- e.contextMenuTrigger === "rightClick" && k.value && B();
196
+ n.contextMenuTrigger === "rightClick" && k.value && B();
197
197
  };
198
198
  return Ut(() => {
199
- e.contextMenuTrigger === "rightClick" && (document.addEventListener("click", K), window.addEventListener("scroll", Q, !0), U(() => {
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, n) => (o(), a("div", null, [
206
- u("div", {
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
- u("div", ne, [
216
- u("span", {
215
+ m("div", ne, [
216
+ m("span", {
217
217
  class: "chat-item__status-user",
218
- style: tt({ backgroundColor: e.chat.status })
218
+ style: tt({ backgroundColor: n.chat.status })
219
219
  }, null, 4),
220
- e.chat.avatar ? (o(), a("img", {
220
+ n.chat.avatar ? (o(), a("img", {
221
221
  key: 0,
222
- src: e.chat.avatar,
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
- u("div", ce, [
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
- u("span", ue, f(h(V)), 1),
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
- u("div", ve, [
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: n[0] || (n[0] = (i) => p.value = !1)
283
+ onMenuMouseLeave: e[0] || (e[0] = (i) => p.value = !1)
284
284
  }, {
285
- default: P(() => [...n[2] || (n[2] = [
286
- u("span", { class: "pi pi-ellipsis-h chat-item__actions-trigger" }, null, -1)
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
- u("div", ye, [
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
- e.showDialogs && c.chat.dialogs ? (o(), a("div", {
314
+ n.showDialogs && c.chat.dialogs ? (o(), a("div", {
315
315
  key: 0,
316
316
  class: "chat-item__dialog-buttons",
317
- onClick: n[1] || (n[1] = (i) => E("expand", e.chat))
317
+ onClick: e[1] || (e[1] = (i) => E("expand", n.chat))
318
318
  }, [
319
- e.showDialogs && !c.chat.dialogsExpanded ? (o(), a("button", xe, [...n[3] || (n[3] = [
320
- u("span", {
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
- e.showDialogs && c.chat.dialogsExpanded ? (o(), a("button", we, [...n[4] || (n[4] = [
326
- u("span", {
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
- e.showDialogs && c.chat.dialogsExpanded ? (o(), a("div", Ce, [
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: (m) => dt(i)
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
- u("div", Ee, [
347
- u("div", Le, f(i.name), 1),
348
- u("div", Se, f(i["lastActivity.time"]), 1)
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 e from "../../../_virtual/_plugin-vue_export-helper.js";
4
- const p = /* @__PURE__ */ e(o, [["__scopeId", "data-v-3ec3e740"]]);
3
+ import t from "../../../_virtual/_plugin-vue_export-helper.js";
4
+ const e = /* @__PURE__ */ t(o, [["__scopeId", "data-v-dd5bf82f"]]);
5
5
  export {
6
- p as default
6
+ e as default
7
7
  };