@mobilon-dev/chotto 0.3.50 → 0.3.52

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 o from "./DelimiterMessage.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-5ac955b7"]]);
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-9ff92646"]]);
5
5
  export {
6
6
  m as default
7
7
  };
@@ -1,5 +1,5 @@
1
- import { defineComponent as t, createElementBlock as s, openBlock as r, createElementVNode as o, toDisplayString as a } from "vue";
2
- const i = { class: "delimiter-message__container" }, n = { class: "delimiter-message__text" }, l = /* @__PURE__ */ t({
1
+ import { defineComponent as f, ref as a, onMounted as d, onBeforeUnmount as g, watch as _, createElementBlock as v, openBlock as p, normalizeClass as T, createElementVNode as R, toDisplayString as D } from "vue";
2
+ const O = { class: "delimiter-message__text" }, b = 3e3, h = 400, y = /* @__PURE__ */ f({
3
3
  __name: "DelimiterMessage",
4
4
  props: {
5
5
  message: {
@@ -7,12 +7,48 @@ const i = { class: "delimiter-message__container" }, n = { class: "delimiter-mes
7
7
  required: !0
8
8
  }
9
9
  },
10
- setup(e) {
11
- return (c, m) => (r(), s("div", i, [
12
- o("p", n, a(e.message.text), 1)
13
- ]));
10
+ emits: ["read"],
11
+ setup(i, { emit: m }) {
12
+ const s = i, c = m, n = a(null), r = a(!1);
13
+ let t = null, e = null;
14
+ const l = () => {
15
+ !s.message.autoRemove || !n.value || (t = new IntersectionObserver(
16
+ (o) => {
17
+ o[0].isIntersecting ? (e && clearTimeout(e), e = setTimeout(() => {
18
+ r.value = !0, t && n.value && (t.disconnect(), t = null), setTimeout(() => {
19
+ c("read", s.message.messageId);
20
+ }, h);
21
+ }, b)) : e && (clearTimeout(e), e = null);
22
+ },
23
+ {
24
+ threshold: 0.75,
25
+ // Элемент должен быть виден минимум на 75%
26
+ rootMargin: "0px"
27
+ }
28
+ ), t.observe(n.value));
29
+ };
30
+ return d(() => {
31
+ s.message.autoRemove && setTimeout(() => {
32
+ l();
33
+ }, 100);
34
+ }), g(() => {
35
+ e && (clearTimeout(e), e = null), t && (t.disconnect(), t = null);
36
+ }), _(
37
+ () => s.message.autoRemove,
38
+ (o) => {
39
+ t && (t.disconnect(), t = null), e && (clearTimeout(e), e = null), o && setTimeout(() => {
40
+ l();
41
+ }, 100);
42
+ }
43
+ ), (o, u) => (p(), v("div", {
44
+ ref_key: "containerRef",
45
+ ref: n,
46
+ class: T(["delimiter-message__container", { "delimiter-message__container--removing": r.value }])
47
+ }, [
48
+ R("p", O, D(i.message.text), 1)
49
+ ], 2));
14
50
  }
15
51
  });
16
52
  export {
17
- l as default
53
+ y as default
18
54
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./Feed.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../../../_virtual/_plugin-vue_export-helper.js";
4
- const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-90b7e791"]]);
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-9686a172"]]);
5
5
  export {
6
- p as default
6
+ m as default
7
7
  };
@@ -1,25 +1,25 @@
1
- import { defineComponent as de, ref as k, computed as i, inject as D, unref as e, watch as ce, nextTick as w, onMounted as ue, createElementBlock as d, openBlock as s, Fragment as j, createBlock as m, createCommentVNode as c, normalizeStyle as K, createVNode as b, Transition as h, withCtx as v, renderList as me, resolveDynamicComponent as fe, createElementVNode as x, toDisplayString as ye, renderSlot as ge, Teleport as be } from "vue";
2
- import pe from "../../2_feed_elements/DateMessageSticky/DateMessageSticky.vue.js";
3
- import ke from "../../2_feed_elements/BaseReplyMessage/BaseReplyMessage.vue.js";
4
- import he from "../../2_feed_elements/MessageKeyboard/MessageKeyboard.vue.js";
5
- import ve from "../../2_feed_elements/FeedKeyboard/FeedKeyboard.vue.js";
6
- import Se from "../../2_feed_elements/TypingMessage/TypingMessage.vue.js";
7
- import { useFeedButton as Re } from "./composables/useFeedButton.js";
8
- import { useFeedComponents as Be } from "./composables/useFeedComponents.js";
9
- import { useFeedGrouping as Te } from "./composables/useFeedGrouping.js";
10
- import { useFeedKeyboard as Ae } from "./composables/useFeedKeyboard.js";
11
- import { useFeedLoadMore as Ie } from "./composables/useFeedLoadMore.js";
12
- import { useFeedMessageVisibility as Ce } from "./composables/useFeedMessageVisibility.js";
13
- import { useFeedReply as Fe } from "./composables/useFeedReply.js";
14
- import { useFeedScroll as Me } from "./composables/useFeedScroll.js";
15
- import { useFeedScrollTo as De } from "./composables/useFeedScrollTo.js";
16
- import { useStickyDate as we } from "./composables/useStickyDate.js";
17
- import { throttle as je } from "./functions/throttle.js";
18
- import Ke from "./assets/chat-background.svg.js";
19
- const xe = ["id"], $e = ["id", "onDblclick"], Oe = {
1
+ import { defineComponent as ue, ref as k, computed as i, inject as D, unref as e, watch as me, nextTick as w, onMounted as fe, createElementBlock as c, openBlock as n, Fragment as j, createBlock as m, createCommentVNode as u, normalizeStyle as K, renderSlot as $, createVNode as b, Transition as h, withCtx as v, renderList as ye, resolveDynamicComponent as ge, createElementVNode as x, toDisplayString as be, Teleport as pe } from "vue";
2
+ import ke from "../../2_feed_elements/DateMessageSticky/DateMessageSticky.vue.js";
3
+ import he from "../../2_feed_elements/BaseReplyMessage/BaseReplyMessage.vue.js";
4
+ import ve from "../../2_feed_elements/MessageKeyboard/MessageKeyboard.vue.js";
5
+ import Se from "../../2_feed_elements/FeedKeyboard/FeedKeyboard.vue.js";
6
+ import Re from "../../2_feed_elements/TypingMessage/TypingMessage.vue.js";
7
+ import { useFeedButton as Be } from "./composables/useFeedButton.js";
8
+ import { useFeedComponents as Te } from "./composables/useFeedComponents.js";
9
+ import { useFeedGrouping as Ae } from "./composables/useFeedGrouping.js";
10
+ import { useFeedKeyboard as Ie } from "./composables/useFeedKeyboard.js";
11
+ import { useFeedLoadMore as Ce } from "./composables/useFeedLoadMore.js";
12
+ import { useFeedMessageVisibility as Fe } from "./composables/useFeedMessageVisibility.js";
13
+ import { useFeedReply as Me } from "./composables/useFeedReply.js";
14
+ import { useFeedScroll as De } from "./composables/useFeedScroll.js";
15
+ import { useFeedScrollTo as we } from "./composables/useFeedScrollTo.js";
16
+ import { useStickyDate as je } from "./composables/useStickyDate.js";
17
+ import { throttle as Ke } from "./functions/throttle.js";
18
+ import $e from "./assets/chat-background.svg.js";
19
+ const xe = ["id"], Oe = ["id", "onDblclick"], Ve = {
20
20
  key: 0,
21
21
  class: "message-feed__unread-amount"
22
- }, Ve = { style: { margin: "auto" } }, ot = /* @__PURE__ */ de({
22
+ }, qe = { style: { margin: "auto" } }, st = /* @__PURE__ */ ue({
23
23
  __name: "Feed",
24
24
  props: {
25
25
  objects: {
@@ -94,222 +94,228 @@ const xe = ["id"], $e = ["id", "onDblclick"], Oe = {
94
94
  "forceScrollToBottom",
95
95
  "keyboardAction",
96
96
  "feedAction",
97
- "smsInvite"
97
+ "smsInvite",
98
+ "delimiterRead"
98
99
  ],
99
- setup(t, { emit: $ }) {
100
- const n = t, p = k(), r = k(), S = k(), {
101
- isShowButton: O,
102
- isKeyboardPlace: V,
103
- checkButtonVisibility: q
104
- } = Re({
100
+ setup(t, { emit: O }) {
101
+ const l = t, p = k(), r = k(), S = k(), {
102
+ isShowButton: V,
103
+ isKeyboardPlace: q,
104
+ checkButtonVisibility: z
105
+ } = Be({
105
106
  feedRef: r,
106
107
  keyboardRef: S
107
- }), { componentsMap: z } = Be(), E = i(() => n.reactionsEnabled), { groupedObjects: L } = Te({
108
- objects: i(() => n.objects)
108
+ }), { componentsMap: E } = Te(), L = i(() => l.reactionsEnabled), { groupedObjects: P } = Ae({
109
+ objects: i(() => l.objects)
109
110
  }), y = D("chatAppId"), R = D("selectedChat", void 0), B = i(() => {
110
111
  if (R)
111
112
  return e(R);
112
113
  });
113
- function P(l) {
114
+ function N(s) {
114
115
  var f;
115
- const a = l;
116
+ const a = s;
116
117
  if (!a.dialogId || !((f = B.value) != null && f.dialogs))
117
118
  return;
118
119
  const o = B.value.dialogs.find((g) => g.dialogId === a.dialogId);
119
120
  return o == null ? void 0 : o.channelId;
120
121
  }
121
- const u = $, {
122
- checkScrollPosition: N,
122
+ const d = O, {
123
+ checkScrollPosition: W,
123
124
  startScrollWatch: T,
124
125
  stopScrollWatch: A,
125
- resetAllowFlags: W
126
- } = Ie({
126
+ resetAllowFlags: G
127
+ } = Ce({
127
128
  feedRef: r,
128
- emit: u,
129
- isLoadingMoreRef: i(() => n.isLoadingMore)
129
+ emit: d,
130
+ isLoadingMoreRef: i(() => l.isLoadingMore)
130
131
  }), {
131
132
  getMessage: I,
132
- messageAction: G,
133
- handleClickReplied: J,
134
- feedObjectDoubleClick: U,
135
- handleResetReply: H
136
- } = Fe({
137
- enableDoubleClickReply: n.enableDoubleClickReply,
138
- emit: u
133
+ messageAction: J,
134
+ handleClickReplied: U,
135
+ feedObjectDoubleClick: H,
136
+ handleResetReply: Q
137
+ } = Me({
138
+ enableDoubleClickReply: l.enableDoubleClickReply,
139
+ emit: d
139
140
  });
140
- function Q(l) {
141
- u("smsInvite", l);
141
+ function X(s) {
142
+ d("smsInvite", s);
143
+ }
144
+ function Y(s) {
145
+ d("delimiterRead", s);
142
146
  }
143
147
  const {
144
- showKeyboard: X,
145
- keyboardAction: Y,
146
- feedKeyboardAction: Z
147
- } = Ae({
148
- isKeyboardPlace: V,
149
- objects: i(() => n.objects),
150
- emit: u
148
+ showKeyboard: Z,
149
+ keyboardAction: _,
150
+ feedKeyboardAction: ee
151
+ } = Ie({
152
+ isKeyboardPlace: q,
153
+ objects: i(() => l.objects),
154
+ emit: d
151
155
  }), {
152
- showStickyDate: _,
153
- stickyDateText: ee,
154
- show: te
155
- } = we({
156
+ showStickyDate: te,
157
+ stickyDateText: oe,
158
+ show: se
159
+ } = je({
156
160
  feedRef: r,
157
161
  trackingObjects: p
158
162
  }), {
159
- isInitialized: oe,
160
- performScrollToBottom: se,
163
+ isInitialized: ne,
164
+ performScrollToBottom: le,
161
165
  ensureScrollToBottom: C,
162
- initializeScroll: ne,
163
- smoothScrollToBottom: le
164
- } = Me({
166
+ initializeScroll: ae,
167
+ smoothScrollToBottom: re
168
+ } = De({
165
169
  feedRef: r,
166
- objectsRef: i(() => n.objects),
167
- scrollToBottomRef: i(() => n.scrollToBottom)
168
- }), F = i(() => n.chatBackground ?? `data:image/svg+xml;charset=utf-8,${encodeURIComponent(Ke)}`);
169
- function M(l = !0) {
170
- q(), N(l), te();
170
+ objectsRef: i(() => l.objects),
171
+ scrollToBottomRef: i(() => l.scrollToBottom)
172
+ }), F = i(() => l.chatBackground ?? `data:image/svg+xml;charset=utf-8,${encodeURIComponent($e)}`);
173
+ function M(s = !0) {
174
+ z(), W(s), se();
171
175
  }
172
- const ae = je(() => M(), 250);
173
- function re() {
174
- u("forceScrollToBottom"), le();
176
+ const ie = Ke(() => M(), 250);
177
+ function de() {
178
+ d("forceScrollToBottom"), re();
175
179
  }
176
- const { restartObserving: ie } = Ce({
180
+ const { restartObserving: ce } = Fe({
177
181
  feedRef: r,
178
182
  trackingObjects: p,
179
183
  chatAppId: y,
180
- onMessageVisible: (l) => u("messageVisible", l)
184
+ onMessageVisible: (s) => d("messageVisible", s)
181
185
  });
182
- return ce(
183
- () => n.objects,
186
+ return me(
187
+ () => l.objects,
184
188
  () => {
185
189
  w(() => {
186
- W(), M(!1), p.value = document.querySelectorAll(".tracking-message"), ie();
190
+ G(), M(!1), p.value = document.querySelectorAll(".tracking-message"), ce();
187
191
  });
188
192
  },
189
193
  { immediate: !0 }
190
- ), De({
191
- targetIdRef: i(() => n.scrollTo),
194
+ ), we({
195
+ targetIdRef: i(() => l.scrollTo),
192
196
  feedContainerId: `feed-container-${y}`
193
- }), ue(() => {
197
+ }), fe(() => {
194
198
  w(() => {
195
- n.objects.length > 0 && !oe.value && ne();
196
- const l = new ResizeObserver(() => {
197
- n.scrollToBottom && (se(), setTimeout(() => {
199
+ l.objects.length > 0 && !ne.value && ae();
200
+ const s = new ResizeObserver(() => {
201
+ l.scrollToBottom && (le(), setTimeout(() => {
198
202
  C();
199
203
  }, 200), setTimeout(() => {
200
204
  C();
201
205
  }, 800));
202
206
  });
203
- r.value && l.observe(r.value);
207
+ r.value && s.observe(r.value);
204
208
  });
205
- }), (l, a) => (s(), d(j, null, [
206
- t.objects.length > 0 || t.typing ? (s(), d("div", {
209
+ }), (s, a) => (n(), c(j, null, [
210
+ t.objects.length > 0 || t.typing ? (n(), c("div", {
207
211
  key: 0,
208
212
  id: "feed-container-" + e(y),
209
213
  ref_key: "refFeed",
210
214
  ref: r,
211
215
  class: "message-feed",
212
216
  style: K({ backgroundImage: `url(${F.value})` }),
213
- onScroll: a[0] || (a[0] = (o) => e(ae)()),
217
+ onScroll: a[0] || (a[0] = (o) => e(ie)()),
214
218
  onMousedown: a[1] || (a[1] = //@ts-ignore
215
219
  (...o) => e(T) && e(T)(...o)),
216
220
  onMouseup: a[2] || (a[2] = //@ts-ignore
217
221
  (...o) => e(A) && e(A)(...o))
218
222
  }, [
223
+ $(s.$slots, "prepend", {}, void 0, !0),
219
224
  b(h, null, {
220
225
  default: v(() => [
221
- e(_) ? (s(), m(pe, {
226
+ e(te) ? (n(), m(ke, {
222
227
  key: 0,
223
228
  class: "message-feed__sticky-date",
224
- text: e(ee)
225
- }, null, 8, ["text"])) : c("", !0)
229
+ text: e(oe)
230
+ }, null, 8, ["text"])) : u("", !0)
226
231
  ]),
227
232
  _: 1
228
233
  }),
229
- (s(!0), d(j, null, me(e(L), (o, f) => (s(), d("div", {
234
+ (n(!0), c(j, null, ye(e(P), (o, f) => (n(), c("div", {
230
235
  id: JSON.stringify(o),
231
236
  key: `${o.messageId ?? "mid"}-${f}`,
232
237
  class: "tracking-message",
233
- onDblclick: (g) => e(U)(g, o)
238
+ onDblclick: (g) => e(H)(g, o)
234
239
  }, [
235
- (s(), m(fe(e(z)(o.type)), {
240
+ (n(), m(ge(e(E)(o.type)), {
236
241
  key: `${o.messageId ?? "mid"}-${f}`,
237
242
  class: "message-feed__message",
238
243
  message: o,
239
244
  "apply-style": t.applyStyle,
240
245
  "is-first-in-series": o.isFirstInSeries,
241
- "reactions-enabled": E.value,
246
+ "reactions-enabled": L.value,
242
247
  "subtext-tooltip-data": t.subtextTooltipData,
243
- channel: P(o),
244
- onAction: e(G),
245
- onReply: e(J),
246
- onSmsInvite: (g) => Q(o)
248
+ channel: N(o),
249
+ onAction: e(J),
250
+ onReply: e(U),
251
+ onSmsInvite: (g) => X(o),
252
+ onRead: Y
247
253
  }, null, 40, ["message", "apply-style", "is-first-in-series", "reactions-enabled", "subtext-tooltip-data", "channel", "onAction", "onReply", "onSmsInvite"]))
248
- ], 40, $e))), 128)),
249
- t.typing ? (s(), m(Se, {
254
+ ], 40, Oe))), 128)),
255
+ t.typing ? (n(), m(Re, {
250
256
  key: 0,
251
257
  message: {
252
258
  subText: t.typing.title,
253
259
  avatar: t.typing.avatar
254
260
  }
255
- }, null, 8, ["message"])) : c("", !0),
261
+ }, null, 8, ["message"])) : u("", !0),
256
262
  b(h, null, {
257
263
  default: v(() => [
258
- e(X) ? (s(), m(he, {
264
+ e(Z) ? (n(), m(ve, {
259
265
  key: 0,
260
266
  ref_key: "keyboardRef",
261
267
  ref: S,
262
268
  class: "message-feed__keyboard",
263
269
  keyboard: t.objects[t.objects.length - 1].keyboard,
264
270
  align: t.keyboardAlign,
265
- onAction: e(Y)
266
- }, null, 8, ["keyboard", "align", "onAction"])) : c("", !0)
271
+ onAction: e(_)
272
+ }, null, 8, ["keyboard", "align", "onAction"])) : u("", !0)
267
273
  ]),
268
274
  _: 1
269
275
  }),
270
276
  b(h, null, {
271
277
  default: v(() => [
272
- e(O) ? (s(), d("button", {
278
+ e(V) ? (n(), c("button", {
273
279
  key: 0,
274
280
  class: "message-feed__button-down",
275
- onClick: re
281
+ onClick: de
276
282
  }, [
277
- t.buttonParams ? (s(), d("div", Oe, ye(t.buttonParams.unreadAmount), 1)) : c("", !0),
283
+ t.buttonParams ? (n(), c("div", Ve, be(t.buttonParams.unreadAmount), 1)) : u("", !0),
278
284
  a[3] || (a[3] = x("span", { class: "pi pi-angle-down message-feed__icon-down" }, null, -1))
279
- ])) : c("", !0)
285
+ ])) : u("", !0)
280
286
  ]),
281
287
  _: 1
282
288
  }),
283
- t.feedKeyboards && t.feedKeyboards.length > 0 ? (s(), m(ve, {
289
+ t.feedKeyboards && t.feedKeyboards.length > 0 ? (n(), m(Se, {
284
290
  key: 1,
285
291
  buttons: t.feedKeyboards,
286
292
  align: t.feedKeyboardAlign,
287
- onAction: e(Z)
288
- }, null, 8, ["buttons", "align", "onAction"])) : c("", !0)
289
- ], 44, xe)) : (s(), d("div", {
293
+ onAction: e(ee)
294
+ }, null, 8, ["buttons", "align", "onAction"])) : u("", !0)
295
+ ], 44, xe)) : (n(), c("div", {
290
296
  key: 1,
291
297
  ref_key: "refFeed",
292
298
  ref: r,
293
299
  class: "message-feed",
294
300
  style: K({ backgroundImage: `url(${F.value})` })
295
301
  }, [
296
- x("div", Ve, [
297
- ge(l.$slots, "empty-feed", {}, void 0, !0)
302
+ x("div", qe, [
303
+ $(s.$slots, "empty-feed", {}, void 0, !0)
298
304
  ])
299
305
  ], 4)),
300
- e(I)().reply ? (s(), m(be, {
306
+ e(I)().reply ? (n(), m(pe, {
301
307
  key: 2,
302
308
  to: "#chat-input-reply-line-" + e(y)
303
309
  }, [
304
- b(ke, {
310
+ b(he, {
305
311
  class: "chat-input-reply",
306
312
  message: e(I)().reply,
307
- onReset: e(H)
313
+ onReset: e(Q)
308
314
  }, null, 8, ["message", "onReset"])
309
- ], 8, ["to"])) : c("", !0)
315
+ ], 8, ["to"])) : u("", !0)
310
316
  ], 64));
311
317
  }
312
318
  });
313
319
  export {
314
- ot as default
320
+ st as default
315
321
  };