@mobilon-dev/chotto 0.3.38 → 0.3.39

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 a = /* @__PURE__ */ o(t, [["__scopeId", "data-v-f453fe25"]]);
4
+ const p = /* @__PURE__ */ o(t, [["__scopeId", "data-v-b9128cb0"]]);
5
5
  export {
6
- a as default
6
+ p as default
7
7
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent as lt, inject as rt, useId as ut, ref as p, computed as M, watch as dt, onMounted as ht, nextTick as b, onUnmounted as mt, createElementBlock as c, openBlock as s, createElementVNode as a, createCommentVNode as l, withModifiers as gt, normalizeClass as B, normalizeStyle as X, createVNode as I, withCtx as A, toDisplayString as r, createBlock as S, Teleport as vt, unref as C, Fragment as yt, renderList as ft } from "vue";
1
+ import { defineComponent as rt, inject as ut, useId as dt, ref as p, computed as M, watch as ht, onMounted as mt, nextTick as b, onUnmounted as gt, createElementBlock as c, openBlock as o, createElementVNode as a, createCommentVNode as l, withModifiers as yt, normalizeClass as B, normalizeStyle as X, createVNode as I, withCtx as A, toDisplayString as r, createBlock as S, Teleport as vt, unref as C, Fragment as Y, renderList as ft } from "vue";
2
2
  import { getStatus as pt, statuses as kt } from "../../../functions/getStatusMessage.js";
3
3
  import "../../../functions/parseMarkdown.js";
4
4
  import { t as U } from "../../../locale/useLocale.js";
@@ -8,7 +8,7 @@ import { useTheme as xt } from "../../../hooks/useTheme.js";
8
8
  /* empty css */
9
9
  /* empty css */
10
10
  import "../../../node_modules/linkifyjs/dist/linkify.js";
11
- import Y from "../../1_atoms/Tooltip/Tooltip.vue.js";
11
+ import H from "../../1_atoms/Tooltip/Tooltip.vue.js";
12
12
  import _t from "../../1_atoms/ButtonContextMenu/ButtonContextMenu.vue.js";
13
13
  import Mt from "../../1_atoms/ContextMenu/ContextMenu.vue.js";
14
14
  import Ct from "../../1_icons/AvatarIcon.vue.js";
@@ -23,31 +23,37 @@ const wt = { class: "chat-item__avatar-container" }, Tt = ["src"], Et = {
23
23
  class: "chat-item__time"
24
24
  }, Ut = { class: "chat-item__status-unread-container" }, Lt = {
25
25
  key: 0,
26
- class: "pi pi-check"
26
+ class: "pi pi-clock"
27
27
  }, Nt = {
28
28
  key: 1,
29
- class: "chat-item__unread"
29
+ class: "pi pi-exclamation-circle"
30
30
  }, Dt = {
31
+ key: 0,
32
+ class: "pi pi-check"
33
+ }, Vt = {
34
+ key: 1,
35
+ class: "chat-item__unread"
36
+ }, Xt = {
31
37
  key: 2,
32
38
  class: "chat-item__status-chat-container"
33
- }, Vt = {
39
+ }, Yt = {
34
40
  key: 0,
35
41
  class: "chat-item__fixed pi pi-thumbtack"
36
- }, Xt = {
42
+ }, Ht = {
37
43
  key: 0,
38
44
  id: "noSelectButton",
39
45
  class: "chat-item__menu-button"
40
- }, Yt = {
46
+ }, Ot = {
41
47
  key: 1,
42
48
  id: "noSelectButton",
43
49
  class: "chat-item__menu-button"
44
- }, Ht = {
50
+ }, Rt = {
45
51
  key: 0,
46
52
  class: "dialog__container"
47
- }, Ot = ["onClick"], Rt = ["src"], Ft = {
53
+ }, Ft = ["onClick"], $t = ["src"], zt = {
48
54
  key: 1,
49
55
  class: "dialog__icon pi pi-user"
50
- }, $t = { class: "dialog__text-container" }, zt = { class: "dialog__name" }, Wt = { class: "dialog__time" }, ce = /* @__PURE__ */ lt({
56
+ }, Wt = { class: "dialog__text-container" }, jt = { class: "dialog__name" }, qt = { class: "dialog__time" }, le = /* @__PURE__ */ rt({
51
57
  __name: "ChatItem",
52
58
  props: {
53
59
  chat: {},
@@ -55,27 +61,27 @@ const wt = { class: "chat-item__avatar-container" }, Tt = ["src"], Et = {
55
61
  contextMenuTrigger: { default: "hover" }
56
62
  },
57
63
  emits: ["select", "action", "expand"],
58
- setup(o, { emit: H }) {
59
- const O = rt("chatAppId"), { getTheme: L } = xt(O), e = o, k = H, u = ut(), d = p(!1), h = p(!1), w = p(!1), R = p(null), F = () => {
64
+ setup(i, { emit: O }) {
65
+ const R = ut("chatAppId"), { getTheme: L } = xt(R), e = i, k = O, u = dt(), d = p(!1), h = p(!1), w = p(!1), F = p(null), $ = () => {
60
66
  w.value = !0;
61
- }, $ = (t) => {
62
- w.value || t.target instanceof HTMLElement && t.target.id != "noSelectButton" && k("select", { chat: e.chat, dialog: null }), w.value = !1;
63
67
  }, z = (t) => {
68
+ w.value || t.target instanceof HTMLElement && t.target.id != "noSelectButton" && k("select", { chat: e.chat, dialog: null }), w.value = !1;
69
+ }, W = (t) => {
64
70
  k("select", { chat: e.chat, dialog: t });
65
- }, W = () => e.chat.isSelected ? "chat-item__selected" : "", j = (t) => t.isSelected ? "dialog__selected" : "", N = (t) => {
71
+ }, j = () => e.chat.isSelected ? "chat-item__selected" : "", q = (t) => t.isSelected ? "dialog__selected" : "", N = (t) => {
66
72
  e.contextMenuTrigger === "rightClick" && T(), k("action", { chat: e.chat, ...t });
67
73
  }, T = () => {
68
74
  const t = document.getElementById("context-menu-rightclick-" + u);
69
75
  t && (t.style.top = "0", t.style.left = "0", t.style.opacity = "0", t.style.display = "none"), h.value = !1;
70
- }, q = () => {
76
+ }, G = () => {
71
77
  document.querySelectorAll('[id^="context-menu-rightclick-"]').forEach((n) => {
72
- const i = n;
73
- i.id !== "context-menu-rightclick-" + u && (i.style.top = "0", i.style.left = "0", i.style.opacity = "0", i.style.display = "none");
78
+ const s = n;
79
+ s.id !== "context-menu-rightclick-" + u && (s.style.top = "0", s.style.left = "0", s.style.opacity = "0", s.style.display = "none");
74
80
  });
75
- }, G = () => 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)) : [], J = M(() => pt(e.chat["lastMessage.status"])), K = M(() => e.chat.showEmptyIndicator || e.chat.countUnread > 0), P = M(() => e.chat.countUnread > 0 ? e.chat.countUnread > 99 ? "99+" : e.chat.countUnread : e.chat.showEmptyIndicator ? "" : void 0);
81
+ }, J = () => 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)) : [], K = M(() => pt(e.chat["lastMessage.status"])), P = M(() => e.chat.showEmptyIndicator || e.chat.countUnread > 0), Q = M(() => e.chat.countUnread > 0 ? e.chat.countUnread > 99 ? "99+" : e.chat.countUnread : e.chat.showEmptyIndicator ? "" : void 0);
76
82
  let x;
77
- const m = p(0), Q = [U("component.ChatItem.typing") + ".", U("component.ChatItem.typing") + "..", U("component.ChatItem.typing") + "..."], Z = M(() => e.chat.typing ? Q[m.value] : e.chat.lastMessage);
78
- dt(
83
+ const m = p(0), Z = [U("component.ChatItem.typing") + ".", U("component.ChatItem.typing") + "..", U("component.ChatItem.typing") + "..."], tt = M(() => e.chat.typing ? Z[m.value] : e.chat.lastMessage);
84
+ ht(
79
85
  () => e.chat.typing,
80
86
  () => {
81
87
  e.chat.typing ? x = setInterval(() => {
@@ -84,140 +90,142 @@ const wt = { class: "chat-item__avatar-container" }, Tt = ["src"], Et = {
84
90
  },
85
91
  { immediate: !0 }
86
92
  );
87
- const tt = () => {
93
+ const et = () => {
88
94
  e.contextMenuTrigger === "hover" && (d.value = !0);
89
- }, et = (t) => {
90
- e.contextMenuTrigger === "hover" && (t.relatedTarget instanceof HTMLElement && t.relatedTarget.className == "context-menu__list" ? d.value = !0 : d.value = !1);
91
95
  }, nt = (t) => {
92
- e.contextMenuTrigger === "rightClick" && e.chat.actions && it(t);
96
+ e.contextMenuTrigger === "hover" && (t.relatedTarget instanceof HTMLElement && t.relatedTarget.className == "context-menu__list" ? d.value = !0 : d.value = !1);
93
97
  }, it = (t) => {
94
- q(), h.value = !0, b(() => {
98
+ e.contextMenuTrigger === "rightClick" && e.chat.actions && st(t);
99
+ }, st = (t) => {
100
+ G(), h.value = !0, b(() => {
95
101
  const n = document.getElementById("context-menu-rightclick-" + u);
96
102
  if (n) {
97
- const i = t.clientX, E = t.clientY;
103
+ const s = t.clientX, E = t.clientY;
98
104
  n.style.display = "inherit";
99
105
  const _ = n.getBoundingClientRect();
100
106
  n.style.display = "none", b(() => {
101
- const ct = window.innerWidth, at = window.innerHeight, g = window.scrollX || window.pageXOffset, v = window.scrollY || window.pageYOffset;
102
- let y = i + g, f = E + v;
103
- y + _.width > ct + g && (y = i + g - _.width), f + _.height > at + v && (f = E + v - _.height), y < g && (y = g), f < v && (f = v), n.style.top = f + "px", n.style.left = y + "px", n.style.opacity = "1", n.style.display = "inherit";
107
+ const at = window.innerWidth, lt = window.innerHeight, g = window.scrollX || window.pageXOffset, y = window.scrollY || window.pageYOffset;
108
+ let v = s + g, f = E + y;
109
+ v + _.width > at + g && (v = s + g - _.width), f + _.height > lt + y && (f = E + y - _.height), v < g && (v = g), f < y && (f = y), n.style.top = f + "px", n.style.left = v + "px", n.style.opacity = "1", n.style.display = "inherit";
104
110
  });
105
111
  }
106
112
  });
107
113
  }, ot = () => {
108
- }, st = () => {
114
+ }, ct = () => {
109
115
  }, D = (t) => {
110
116
  if (e.contextMenuTrigger === "rightClick" && h.value) {
111
- const n = t.target, i = document.getElementById("context-menu-rightclick-" + u);
112
- (!i || !i.contains(n)) && T();
117
+ const n = t.target, s = document.getElementById("context-menu-rightclick-" + u);
118
+ (!s || !s.contains(n)) && T();
113
119
  }
114
120
  }, V = () => {
115
121
  e.contextMenuTrigger === "rightClick" && h.value && T();
116
122
  };
117
- return ht(() => {
123
+ return mt(() => {
118
124
  e.contextMenuTrigger === "rightClick" && (document.addEventListener("click", D), window.addEventListener("scroll", V, !0), b(() => {
119
125
  const t = document.getElementById("context-menu-rightclick-" + u);
120
126
  t && (t.style.display = "none", t.style.opacity = "0");
121
127
  }));
122
- }), mt(() => {
128
+ }), gt(() => {
123
129
  document.removeEventListener("click", D), window.removeEventListener("scroll", V, !0);
124
- }), (t, n) => (s(), c("div", null, [
130
+ }), (t, n) => (o(), c("div", null, [
125
131
  a("div", {
126
132
  ref_key: "containerRef",
127
- ref: R,
128
- class: B(["chat-item__container", W()]),
129
- onMouseenter: tt,
130
- onMouseleave: et,
131
- onClick: $,
132
- onContextmenu: gt(nt, ["prevent"])
133
+ ref: F,
134
+ class: B(["chat-item__container", j()]),
135
+ onMouseenter: et,
136
+ onMouseleave: nt,
137
+ onClick: z,
138
+ onContextmenu: yt(it, ["prevent"])
133
139
  }, [
134
140
  a("div", wt, [
135
141
  a("span", {
136
142
  class: "chat-item__status-user",
137
143
  style: X({ backgroundColor: e.chat.status })
138
144
  }, null, 4),
139
- e.chat.avatar ? (s(), c("img", {
145
+ e.chat.avatar ? (o(), c("img", {
140
146
  key: 0,
141
147
  src: e.chat.avatar,
142
148
  height: "48",
143
149
  width: "48"
144
- }, null, 8, Tt)) : (s(), c("div", Et, [
150
+ }, null, 8, Tt)) : (o(), c("div", Et, [
145
151
  I(Ct)
146
152
  ]))
147
153
  ]),
148
154
  a("div", bt, [
149
- I(Y, {
150
- text: o.chat.name,
155
+ I(H, {
156
+ text: i.chat.name,
151
157
  position: "bottom"
152
158
  }, {
153
159
  default: A(() => [
154
- a("div", Bt, r(o.chat.name), 1)
160
+ a("div", Bt, r(i.chat.name), 1)
155
161
  ]),
156
162
  _: 1
157
163
  }, 8, ["text"]),
158
- I(Y, {
159
- text: o.chat.lastMessage,
164
+ I(H, {
165
+ text: i.chat.lastMessage,
160
166
  position: "bottom"
161
167
  }, {
162
168
  default: A(() => [
163
- o.chat.lastMessage || o.chat.typing ? (s(), c("div", It, r(Z.value), 1)) : l("", !0)
169
+ i.chat.lastMessage || i.chat.typing ? (o(), c("div", It, r(tt.value), 1)) : l("", !0)
164
170
  ]),
165
171
  _: 1
166
172
  }, 8, ["text"])
167
173
  ]),
168
174
  a("div", At, [
169
- o.chat["lastActivity.time"] && (!o.chat.actions || !d.value) ? (s(), c("div", St, r(o.chat["lastActivity.time"]), 1)) : l("", !0),
170
- d.value && o.chat.actions && o.contextMenuTrigger === "hover" ? (s(), S(_t, {
175
+ i.chat["lastActivity.time"] && (!i.chat.actions || !d.value) ? (o(), c("div", St, r(i.chat["lastActivity.time"]), 1)) : l("", !0),
176
+ d.value && i.chat.actions && i.contextMenuTrigger === "hover" ? (o(), S(_t, {
171
177
  key: 1,
172
178
  mode: "click",
173
179
  "menu-side": "bottom-right",
174
- actions: o.chat.actions,
180
+ actions: i.chat.actions,
175
181
  onClick: N,
176
- onButtonClick: F,
177
- onMenuMouseLeave: n[0] || (n[0] = (i) => d.value = !1)
182
+ onButtonClick: $,
183
+ onMenuMouseLeave: n[0] || (n[0] = (s) => d.value = !1)
178
184
  }, {
179
185
  default: A(() => [...n[2] || (n[2] = [
180
186
  a("span", { class: "pi pi-ellipsis-h chat-item__actions-trigger" }, null, -1)
181
187
  ])]),
182
188
  _: 1
183
189
  }, 8, ["actions"])) : l("", !0),
184
- (s(), S(vt, { to: "body" }, [
185
- o.contextMenuTrigger === "rightClick" && o.chat.actions && h.value ? (s(), S(Mt, {
190
+ (o(), S(vt, { to: "body" }, [
191
+ i.contextMenuTrigger === "rightClick" && i.chat.actions && h.value ? (o(), S(Mt, {
186
192
  key: 0,
187
193
  id: "context-menu-rightclick-" + C(u),
188
- actions: o.chat.actions,
194
+ actions: i.chat.actions,
189
195
  "data-theme": C(L)().theme ? C(L)().theme : "light",
190
196
  onClick: N,
191
197
  onMouseenter: ot,
192
- onMouseleave: st
198
+ onMouseleave: ct
193
199
  }, null, 8, ["id", "actions", "data-theme"])) : l("", !0)
194
200
  ])),
195
201
  a("div", Ut, [
196
- C(kt).includes(o.chat["lastMessage.status"]) ? (s(), c("div", {
202
+ C(kt).includes(i.chat["lastMessage.status"]) ? (o(), c("div", {
197
203
  key: 0,
198
- class: B(["chat-item__status-message", J.value])
204
+ class: B(["chat-item__status-message", K.value])
199
205
  }, [
200
- o.chat["lastMessage.status"] !== "sent" ? (s(), c("span", Lt)) : l("", !0),
201
- n[3] || (n[3] = a("span", { class: "pi pi-check" }, null, -1))
206
+ i.chat["lastMessage.status"] === "pending" ? (o(), c("span", Lt)) : i.chat["lastMessage.status"] === "error" ? (o(), c("span", Nt)) : (o(), c(Y, { key: 2 }, [
207
+ i.chat["lastMessage.status"] !== "sent" ? (o(), c("span", Dt)) : l("", !0),
208
+ n[3] || (n[3] = a("span", { class: "pi pi-check" }, null, -1))
209
+ ], 64))
202
210
  ], 2)) : l("", !0),
203
- K.value ? (s(), c("div", Nt, r(P.value), 1)) : l("", !0)
211
+ P.value ? (o(), c("div", Vt, r(Q.value), 1)) : l("", !0)
204
212
  ]),
205
- o.chat.countUnread < 1 ? (s(), c("div", Dt, [
206
- o.chat.isFixedTop || o.chat.isFixedBottom ? (s(), c("span", Vt)) : l("", !0)
213
+ i.chat.countUnread < 1 ? (o(), c("div", Xt, [
214
+ i.chat.isFixedTop || i.chat.isFixedBottom ? (o(), c("span", Yt)) : l("", !0)
207
215
  ])) : l("", !0)
208
216
  ]),
209
- e.showDialogs && o.chat.dialogs ? (s(), c("div", {
217
+ e.showDialogs && i.chat.dialogs ? (o(), c("div", {
210
218
  key: 0,
211
219
  class: "chat-item__dialog-buttons",
212
- onClick: n[1] || (n[1] = (i) => k("expand", e.chat))
220
+ onClick: n[1] || (n[1] = (s) => k("expand", e.chat))
213
221
  }, [
214
- e.showDialogs && !o.chat.dialogsExpanded ? (s(), c("button", Xt, [...n[4] || (n[4] = [
222
+ e.showDialogs && !i.chat.dialogsExpanded ? (o(), c("button", Ht, [...n[4] || (n[4] = [
215
223
  a("span", {
216
224
  id: "noSelectButton",
217
225
  class: "pi pi-angle-down"
218
226
  }, null, -1)
219
227
  ])])) : l("", !0),
220
- e.showDialogs && o.chat.dialogsExpanded ? (s(), c("button", Yt, [...n[5] || (n[5] = [
228
+ e.showDialogs && i.chat.dialogsExpanded ? (o(), c("button", Ot, [...n[5] || (n[5] = [
221
229
  a("span", {
222
230
  id: "noSelectButton",
223
231
  class: "pi pi-angle-up"
@@ -225,33 +233,33 @@ const wt = { class: "chat-item__avatar-container" }, Tt = ["src"], Et = {
225
233
  ])])) : l("", !0)
226
234
  ])) : l("", !0)
227
235
  ], 34),
228
- e.showDialogs && o.chat.dialogsExpanded ? (s(), c("div", Ht, [
229
- (s(!0), c(yt, null, ft(G(), (i) => (s(), c("div", {
230
- key: i.dialogId,
231
- class: B(["dialog__item", j(i)]),
232
- onClick: (E) => z(i)
236
+ e.showDialogs && i.chat.dialogsExpanded ? (o(), c("div", Rt, [
237
+ (o(!0), c(Y, null, ft(J(), (s) => (o(), c("div", {
238
+ key: s.dialogId,
239
+ class: B(["dialog__item", q(s)]),
240
+ onClick: (E) => W(s)
233
241
  }, [
234
- i.icon ? (s(), c("img", {
242
+ s.icon ? (o(), c("img", {
235
243
  key: 0,
236
244
  class: "dialog__icon",
237
- src: i.icon,
245
+ src: s.icon,
238
246
  height: "16",
239
247
  width: "16"
240
- }, null, 8, Rt)) : (s(), c("span", Ft)),
241
- a("div", $t, [
242
- a("div", zt, r(i.name), 1),
243
- a("div", Wt, r(i["lastActivity.time"]), 1)
248
+ }, null, 8, $t)) : (o(), c("span", zt)),
249
+ a("div", Wt, [
250
+ a("div", jt, r(s.name), 1),
251
+ a("div", qt, r(s["lastActivity.time"]), 1)
244
252
  ]),
245
- i.countUnread > 0 ? (s(), c("div", {
253
+ s.countUnread > 0 ? (o(), c("div", {
246
254
  key: 2,
247
255
  class: "chat-item__unread",
248
- style: X(i.colorUnread ? { backgroundColor: i.colorUnread } : {})
249
- }, r(i.countUnread > 99 ? "99+" : i.countUnread), 5)) : l("", !0)
250
- ], 10, Ot))), 128))
256
+ style: X(s.colorUnread ? { backgroundColor: s.colorUnread } : {})
257
+ }, r(s.countUnread > 99 ? "99+" : s.countUnread), 5)) : l("", !0)
258
+ ], 10, Ft))), 128))
251
259
  ])) : l("", !0)
252
260
  ]));
253
261
  }
254
262
  });
255
263
  export {
256
- ce as default
264
+ le as default
257
265
  };