@mobilon-dev/chotto 0.3.52 → 0.3.54

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.
Files changed (35) hide show
  1. package/dist/chotto.css +1 -1
  2. package/dist/components/1_atoms/LoadingIndicator/LoadingIndicator.vue.js +33 -12
  3. package/dist/components/2_blocks/CommunicationPanel/CommunicationPanel.vue.js +245 -313
  4. package/dist/components/2_blocks/CommunicationPanel/composables/useCommunicationActions.js +32 -61
  5. package/dist/components/2_blocks/CommunicationPanel/composables/useCommunicationAttributes.js +18 -41
  6. package/dist/components/2_blocks/CommunicationPanel/composables/useCommunicationMenu.js +21 -22
  7. package/dist/components/2_blocks/CommunicationPanel/composables/useCommunicationPlaceholder.js +13 -22
  8. package/dist/components/2_blocks/CommunicationPanel/composables/useCommunicationSubMenu.js +34 -46
  9. package/dist/components/2_blocks/CommunicationPanel/icons/CommunicationPanelCheckIcon.vue.js +19 -0
  10. package/dist/components/3_compounds/Feed/Feed.vue.js +1 -1
  11. package/dist/components/3_compounds/Feed/Feed.vue2.js +173 -149
  12. package/dist/components/3_compounds/Feed/composables/useFeedLoadMore.js +40 -37
  13. package/dist/components/3_compounds/Feed/composables/useFeedMessageVisibility.js +17 -19
  14. package/dist/components/3_compounds/Feed/composables/useStickyDate.js +31 -35
  15. package/dist/themes/dark.css +1 -1
  16. package/dist/themes/default.css +1 -1
  17. package/dist/themes/glass.css +1 -1
  18. package/dist/themes/green.css +1 -1
  19. package/dist/themes/mobilon1.css +1 -1
  20. package/dist/types/components/1_atoms/LoadingIndicator/LoadingIndicator.vue.d.ts +4 -0
  21. package/dist/types/components/1_atoms/LoadingIndicator/styles/types.d.ts +6 -0
  22. package/dist/types/components/2_blocks/CommunicationPanel/CommunicationPanel.vue.d.ts +0 -2
  23. package/dist/types/components/2_blocks/CommunicationPanel/composables/useCommunicationActions.d.ts +2 -12
  24. package/dist/types/components/2_blocks/CommunicationPanel/composables/useCommunicationAttributes.d.ts +2 -17
  25. package/dist/types/components/2_blocks/CommunicationPanel/composables/useCommunicationMenu.d.ts +1 -3
  26. package/dist/types/components/2_blocks/CommunicationPanel/composables/useCommunicationPlaceholder.d.ts +1 -7
  27. package/dist/types/components/2_blocks/CommunicationPanel/composables/useCommunicationSubMenu.d.ts +1 -5
  28. package/dist/types/components/2_blocks/CommunicationPanel/icons/CommunicationPanelCheckIcon.vue.d.ts +2 -0
  29. package/dist/types/components/2_blocks/CommunicationPanel/icons/index.d.ts +1 -0
  30. package/dist/types/components/2_blocks/CommunicationPanel/stories/CommunicationPanel.stories.d.ts +0 -2
  31. package/dist/types/components/2_blocks/CommunicationPanel/styles/types.d.ts +32 -0
  32. package/dist/types/components/3_compounds/Feed/Feed.vue.d.ts +2 -2
  33. package/dist/types/components/3_compounds/Feed/composables/useFeedMessageVisibility.d.ts +3 -1
  34. package/dist/types/components/3_compounds/Feed/styles/types.d.ts +1 -0
  35. package/package.json +1 -1
@@ -1,25 +1,26 @@
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 = {
1
+ import { defineComponent as fe, ref as k, computed as i, inject as w, unref as o, watch as ge, nextTick as j, onMounted as ye, createElementBlock as c, openBlock as l, Fragment as K, createBlock as f, createCommentVNode as u, normalizeStyle as x, renderSlot as L, withDirectives as pe, createVNode as g, createElementVNode as h, vShow as be, Transition as v, withCtx as S, renderList as ke, resolveDynamicComponent as he, toDisplayString as ve, Teleport as Se } from "vue";
2
+ import Re from "../../2_feed_elements/DateMessageSticky/DateMessageSticky.vue.js";
3
+ import Be from "../../2_feed_elements/BaseReplyMessage/BaseReplyMessage.vue.js";
4
+ import Ie from "../../2_feed_elements/MessageKeyboard/MessageKeyboard.vue.js";
5
+ import Te from "../../2_feed_elements/FeedKeyboard/FeedKeyboard.vue.js";
6
+ import Ae from "../../2_feed_elements/TypingMessage/TypingMessage.vue.js";
7
+ import Me from "../../1_atoms/LoadingIndicator/LoadingIndicator.vue.js";
8
+ import { useFeedButton as Fe } from "./composables/useFeedButton.js";
9
+ import { useFeedComponents as Ce } from "./composables/useFeedComponents.js";
10
+ import { useFeedGrouping as De } from "./composables/useFeedGrouping.js";
11
+ import { useFeedKeyboard as we } from "./composables/useFeedKeyboard.js";
12
+ import { useFeedLoadMore as je } from "./composables/useFeedLoadMore.js";
13
+ import { useFeedMessageVisibility as Ke } from "./composables/useFeedMessageVisibility.js";
14
+ import { useFeedReply as xe } from "./composables/useFeedReply.js";
15
+ import { useFeedScroll as Le } from "./composables/useFeedScroll.js";
16
+ import { useFeedScrollTo as Oe } from "./composables/useFeedScrollTo.js";
17
+ import { useStickyDate as Ve } from "./composables/useStickyDate.js";
18
+ import { throttle as $e } from "./functions/throttle.js";
19
+ import qe from "./assets/chat-background.svg.js";
20
+ const ze = ["id"], Ee = { class: "message-feed__loading" }, Pe = ["id", "data-timestamp", "onDblclick"], We = {
20
21
  key: 0,
21
22
  class: "message-feed__unread-amount"
22
- }, qe = { style: { margin: "auto" } }, st = /* @__PURE__ */ ue({
23
+ }, Ne = { style: { margin: "auto" } }, ct = /* @__PURE__ */ fe({
23
24
  __name: "Feed",
24
25
  props: {
25
26
  objects: {
@@ -55,7 +56,7 @@ const xe = ["id"], Oe = ["id", "onDblclick"], Ve = {
55
56
  keyboardAlign: {
56
57
  type: String,
57
58
  default: "right",
58
- validator: (t) => ["left", "center", "right"].includes(t)
59
+ validator: (e) => ["left", "center", "right"].includes(e)
59
60
  },
60
61
  feedKeyboards: {
61
62
  type: Array,
@@ -65,7 +66,7 @@ const xe = ["id"], Oe = ["id", "onDblclick"], Ve = {
65
66
  feedKeyboardAlign: {
66
67
  type: String,
67
68
  default: "right",
68
- validator: (t) => ["left", "center", "right"].includes(t)
69
+ validator: (e) => ["left", "center", "right"].includes(e)
69
70
  },
70
71
  chatBackground: {
71
72
  type: String,
@@ -97,225 +98,248 @@ const xe = ["id"], Oe = ["id", "onDblclick"], Ve = {
97
98
  "smsInvite",
98
99
  "delimiterRead"
99
100
  ],
100
- setup(t, { emit: O }) {
101
- const l = t, p = k(), r = k(), S = k(), {
101
+ setup(e, { emit: O }) {
102
+ const a = e, b = k(), r = k(), R = k(), {
102
103
  isShowButton: V,
103
- isKeyboardPlace: q,
104
- checkButtonVisibility: z
105
- } = Be({
104
+ isKeyboardPlace: $,
105
+ checkButtonVisibility: q
106
+ } = Fe({
106
107
  feedRef: r,
107
- keyboardRef: S
108
- }), { componentsMap: E } = Te(), L = i(() => l.reactionsEnabled), { groupedObjects: P } = Ae({
109
- objects: i(() => l.objects)
110
- }), y = D("chatAppId"), R = D("selectedChat", void 0), B = i(() => {
111
- if (R)
112
- return e(R);
108
+ keyboardRef: R
109
+ }), { componentsMap: z } = Ce(), E = i(() => a.reactionsEnabled), { groupedObjects: P } = De({
110
+ objects: i(() => a.objects)
111
+ }), y = w("chatAppId"), B = w("selectedChat", void 0), I = i(() => {
112
+ if (B)
113
+ return o(B);
113
114
  });
115
+ function W(s) {
116
+ return s.timestamp;
117
+ }
114
118
  function N(s) {
115
- var f;
116
- const a = s;
117
- if (!a.dialogId || !((f = B.value) != null && f.dialogs))
119
+ var m;
120
+ const n = s;
121
+ if (!n.dialogId || !((m = I.value) != null && m.dialogs))
118
122
  return;
119
- const o = B.value.dialogs.find((g) => g.dialogId === a.dialogId);
120
- return o == null ? void 0 : o.channelId;
123
+ const t = I.value.dialogs.find((p) => p.dialogId === n.dialogId);
124
+ return t == null ? void 0 : t.channelId;
121
125
  }
122
126
  const d = O, {
123
- checkScrollPosition: W,
127
+ checkScrollPosition: G,
124
128
  startScrollWatch: T,
125
129
  stopScrollWatch: A,
126
- resetAllowFlags: G
127
- } = Ce({
130
+ resetAllowFlags: U
131
+ } = je({
128
132
  feedRef: r,
129
133
  emit: d,
130
- isLoadingMoreRef: i(() => l.isLoadingMore)
134
+ isLoadingMoreRef: i(() => a.isLoadingMore)
131
135
  }), {
132
- getMessage: I,
133
- messageAction: J,
134
- handleClickReplied: U,
135
- feedObjectDoubleClick: H,
136
- handleResetReply: Q
137
- } = Me({
138
- enableDoubleClickReply: l.enableDoubleClickReply,
136
+ getMessage: M,
137
+ messageAction: H,
138
+ handleClickReplied: J,
139
+ feedObjectDoubleClick: Q,
140
+ handleResetReply: X
141
+ } = xe({
142
+ enableDoubleClickReply: a.enableDoubleClickReply,
139
143
  emit: d
140
144
  });
141
- function X(s) {
145
+ function Y(s) {
142
146
  d("smsInvite", s);
143
147
  }
144
- function Y(s) {
148
+ function Z(s) {
145
149
  d("delimiterRead", s);
146
150
  }
147
151
  const {
148
- showKeyboard: Z,
149
- keyboardAction: _,
150
- feedKeyboardAction: ee
151
- } = Ie({
152
- isKeyboardPlace: q,
153
- objects: i(() => l.objects),
152
+ showKeyboard: _,
153
+ keyboardAction: ee,
154
+ feedKeyboardAction: te
155
+ } = we({
156
+ isKeyboardPlace: $,
157
+ objects: i(() => a.objects),
154
158
  emit: d
155
159
  }), {
156
- showStickyDate: te,
157
- stickyDateText: oe,
158
- show: se
159
- } = je({
160
+ showStickyDate: oe,
161
+ stickyDateText: se,
162
+ show: ne
163
+ } = Ve({
160
164
  feedRef: r,
161
- trackingObjects: p
165
+ trackingObjects: b
162
166
  }), {
163
- isInitialized: ne,
167
+ isInitialized: ae,
164
168
  performScrollToBottom: le,
165
- ensureScrollToBottom: C,
166
- initializeScroll: ae,
169
+ ensureScrollToBottom: F,
170
+ initializeScroll: ie,
167
171
  smoothScrollToBottom: re
168
- } = De({
172
+ } = Le({
169
173
  feedRef: r,
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();
174
+ objectsRef: i(() => a.objects),
175
+ scrollToBottomRef: i(() => a.scrollToBottom)
176
+ }), C = i(() => a.chatBackground ?? `data:image/svg+xml;charset=utf-8,${encodeURIComponent(qe)}`);
177
+ function D(s = !0) {
178
+ q(), G(s), ne();
175
179
  }
176
- const ie = Ke(() => M(), 250);
177
- function de() {
180
+ const de = $e(() => D(), 250);
181
+ function ce() {
178
182
  d("forceScrollToBottom"), re();
179
183
  }
180
- const { restartObserving: ce } = Fe({
181
- feedRef: r,
182
- trackingObjects: p,
184
+ function ue(s) {
185
+ const n = a.objects;
186
+ if (s.startsWith("mid-")) {
187
+ const t = parseInt(s.slice(4), 10);
188
+ return n[t];
189
+ }
190
+ return n.find((t) => t.messageId === s);
191
+ }
192
+ const { restartObserving: me } = Ke({
193
+ trackingObjects: b,
183
194
  chatAppId: y,
195
+ getMessageById: ue,
184
196
  onMessageVisible: (s) => d("messageVisible", s)
185
197
  });
186
- return me(
187
- () => l.objects,
198
+ return ge(
199
+ () => a.objects,
188
200
  () => {
189
- w(() => {
190
- G(), M(!1), p.value = document.querySelectorAll(".tracking-message"), ce();
201
+ j(() => {
202
+ requestAnimationFrame(() => {
203
+ U(), D(!1), b.value = document.querySelectorAll(".tracking-message"), me();
204
+ });
191
205
  });
192
206
  },
193
207
  { immediate: !0 }
194
- ), we({
195
- targetIdRef: i(() => l.scrollTo),
208
+ ), Oe({
209
+ targetIdRef: i(() => a.scrollTo),
196
210
  feedContainerId: `feed-container-${y}`
197
- }), fe(() => {
198
- w(() => {
199
- l.objects.length > 0 && !ne.value && ae();
211
+ }), ye(() => {
212
+ j(() => {
213
+ a.objects.length > 0 && !ae.value && ie();
200
214
  const s = new ResizeObserver(() => {
201
- l.scrollToBottom && (le(), setTimeout(() => {
202
- C();
215
+ a.scrollToBottom && (le(), setTimeout(() => {
216
+ F();
203
217
  }, 200), setTimeout(() => {
204
- C();
218
+ F();
205
219
  }, 800));
206
220
  });
207
221
  r.value && s.observe(r.value);
208
222
  });
209
- }), (s, a) => (n(), c(j, null, [
210
- t.objects.length > 0 || t.typing ? (n(), c("div", {
223
+ }), (s, n) => (l(), c(K, null, [
224
+ e.objects.length > 0 || e.typing ? (l(), c("div", {
211
225
  key: 0,
212
- id: "feed-container-" + e(y),
226
+ id: "feed-container-" + o(y),
213
227
  ref_key: "refFeed",
214
228
  ref: r,
215
229
  class: "message-feed",
216
- style: K({ backgroundImage: `url(${F.value})` }),
217
- onScroll: a[0] || (a[0] = (o) => e(ie)()),
218
- onMousedown: a[1] || (a[1] = //@ts-ignore
219
- (...o) => e(T) && e(T)(...o)),
220
- onMouseup: a[2] || (a[2] = //@ts-ignore
221
- (...o) => e(A) && e(A)(...o))
230
+ style: x({ backgroundImage: `url(${C.value})` }),
231
+ onScroll: n[0] || (n[0] = (t) => o(de)()),
232
+ onMousedown: n[1] || (n[1] = //@ts-ignore
233
+ (...t) => o(T) && o(T)(...t)),
234
+ onMouseup: n[2] || (n[2] = //@ts-ignore
235
+ (...t) => o(A) && o(A)(...t))
222
236
  }, [
223
- $(s.$slots, "prepend", {}, void 0, !0),
224
- b(h, null, {
225
- default: v(() => [
226
- e(te) ? (n(), m(ke, {
237
+ L(s.$slots, "prepend", {}, void 0, !0),
238
+ pe(h("div", Ee, [
239
+ g(Me, {
240
+ "is-loading": e.isLoadingMore,
241
+ size: "small",
242
+ position: "top"
243
+ }, null, 8, ["is-loading"])
244
+ ], 512), [
245
+ [be, e.isLoadingMore]
246
+ ]),
247
+ g(v, null, {
248
+ default: S(() => [
249
+ o(oe) && !e.isLoadingMore ? (l(), f(Re, {
227
250
  key: 0,
228
251
  class: "message-feed__sticky-date",
229
- text: e(oe)
252
+ text: o(se)
230
253
  }, null, 8, ["text"])) : u("", !0)
231
254
  ]),
232
255
  _: 1
233
256
  }),
234
- (n(!0), c(j, null, ye(e(P), (o, f) => (n(), c("div", {
235
- id: JSON.stringify(o),
236
- key: `${o.messageId ?? "mid"}-${f}`,
257
+ (l(!0), c(K, null, ke(o(P), (t, m) => (l(), c("div", {
258
+ id: "msg-" + (t.messageId ?? "mid-" + m),
259
+ key: t.messageId ?? "mid-" + m,
260
+ "data-timestamp": W(t),
237
261
  class: "tracking-message",
238
- onDblclick: (g) => e(H)(g, o)
262
+ onDblclick: (p) => o(Q)(p, t)
239
263
  }, [
240
- (n(), m(ge(e(E)(o.type)), {
241
- key: `${o.messageId ?? "mid"}-${f}`,
264
+ (l(), f(he(o(z)(t.type)), {
265
+ key: t.messageId ?? "mid-" + m,
242
266
  class: "message-feed__message",
243
- message: o,
244
- "apply-style": t.applyStyle,
245
- "is-first-in-series": o.isFirstInSeries,
246
- "reactions-enabled": L.value,
247
- "subtext-tooltip-data": t.subtextTooltipData,
248
- channel: N(o),
249
- onAction: e(J),
250
- onReply: e(U),
251
- onSmsInvite: (g) => X(o),
252
- onRead: Y
267
+ message: t,
268
+ "apply-style": e.applyStyle,
269
+ "is-first-in-series": t.isFirstInSeries,
270
+ "reactions-enabled": E.value,
271
+ "subtext-tooltip-data": e.subtextTooltipData,
272
+ channel: N(t),
273
+ onAction: o(H),
274
+ onReply: o(J),
275
+ onSmsInvite: (p) => Y(t),
276
+ onRead: Z
253
277
  }, null, 40, ["message", "apply-style", "is-first-in-series", "reactions-enabled", "subtext-tooltip-data", "channel", "onAction", "onReply", "onSmsInvite"]))
254
- ], 40, Oe))), 128)),
255
- t.typing ? (n(), m(Re, {
278
+ ], 40, Pe))), 128)),
279
+ e.typing ? (l(), f(Ae, {
256
280
  key: 0,
257
281
  message: {
258
- subText: t.typing.title,
259
- avatar: t.typing.avatar
282
+ subText: e.typing.title,
283
+ avatar: e.typing.avatar
260
284
  }
261
285
  }, null, 8, ["message"])) : u("", !0),
262
- b(h, null, {
263
- default: v(() => [
264
- e(Z) ? (n(), m(ve, {
286
+ g(v, null, {
287
+ default: S(() => [
288
+ o(_) ? (l(), f(Ie, {
265
289
  key: 0,
266
290
  ref_key: "keyboardRef",
267
- ref: S,
291
+ ref: R,
268
292
  class: "message-feed__keyboard",
269
- keyboard: t.objects[t.objects.length - 1].keyboard,
270
- align: t.keyboardAlign,
271
- onAction: e(_)
293
+ keyboard: e.objects[e.objects.length - 1].keyboard,
294
+ align: e.keyboardAlign,
295
+ onAction: o(ee)
272
296
  }, null, 8, ["keyboard", "align", "onAction"])) : u("", !0)
273
297
  ]),
274
298
  _: 1
275
299
  }),
276
- b(h, null, {
277
- default: v(() => [
278
- e(V) ? (n(), c("button", {
300
+ g(v, null, {
301
+ default: S(() => [
302
+ o(V) ? (l(), c("button", {
279
303
  key: 0,
280
304
  class: "message-feed__button-down",
281
- onClick: de
305
+ onClick: ce
282
306
  }, [
283
- t.buttonParams ? (n(), c("div", Ve, be(t.buttonParams.unreadAmount), 1)) : u("", !0),
284
- a[3] || (a[3] = x("span", { class: "pi pi-angle-down message-feed__icon-down" }, null, -1))
307
+ e.buttonParams ? (l(), c("div", We, ve(e.buttonParams.unreadAmount), 1)) : u("", !0),
308
+ n[3] || (n[3] = h("span", { class: "pi pi-angle-down message-feed__icon-down" }, null, -1))
285
309
  ])) : u("", !0)
286
310
  ]),
287
311
  _: 1
288
312
  }),
289
- t.feedKeyboards && t.feedKeyboards.length > 0 ? (n(), m(Se, {
313
+ e.feedKeyboards && e.feedKeyboards.length > 0 ? (l(), f(Te, {
290
314
  key: 1,
291
- buttons: t.feedKeyboards,
292
- align: t.feedKeyboardAlign,
293
- onAction: e(ee)
315
+ buttons: e.feedKeyboards,
316
+ align: e.feedKeyboardAlign,
317
+ onAction: o(te)
294
318
  }, null, 8, ["buttons", "align", "onAction"])) : u("", !0)
295
- ], 44, xe)) : (n(), c("div", {
319
+ ], 44, ze)) : (l(), c("div", {
296
320
  key: 1,
297
321
  ref_key: "refFeed",
298
322
  ref: r,
299
323
  class: "message-feed",
300
- style: K({ backgroundImage: `url(${F.value})` })
324
+ style: x({ backgroundImage: `url(${C.value})` })
301
325
  }, [
302
- x("div", qe, [
303
- $(s.$slots, "empty-feed", {}, void 0, !0)
326
+ h("div", Ne, [
327
+ L(s.$slots, "empty-feed", {}, void 0, !0)
304
328
  ])
305
329
  ], 4)),
306
- e(I)().reply ? (n(), m(pe, {
330
+ o(M)().reply ? (l(), f(Se, {
307
331
  key: 2,
308
- to: "#chat-input-reply-line-" + e(y)
332
+ to: "#chat-input-reply-line-" + o(y)
309
333
  }, [
310
- b(he, {
334
+ g(Be, {
311
335
  class: "chat-input-reply",
312
- message: e(I)().reply,
313
- onReset: e(Q)
336
+ message: o(M)().reply,
337
+ onReset: o(X)
314
338
  }, null, 8, ["message", "onReset"])
315
339
  ], 8, ["to"])) : u("", !0)
316
340
  ], 64));
317
341
  }
318
342
  });
319
343
  export {
320
- st as default
344
+ ct as default
321
345
  };
@@ -1,62 +1,65 @@
1
- import { ref as o, watch as d, nextTick as B, unref as v } from "vue";
2
- function W({ feedRef: u, emit: i, isLoadingMoreRef: p }) {
3
- const t = o(!1), s = o(!1), n = o(!1), r = o(!1), h = o(0), T = o(0), c = o(!1), f = o(!1), g = (e = !0) => {
1
+ import { ref as t, watch as m, unref as v, nextTick as w } from "vue";
2
+ function F({ feedRef: u, emit: i, isLoadingMoreRef: p }) {
3
+ const s = t(!1), a = t(!1), n = t(!1), r = t(!1), h = t(0), T = t(0), c = t(!1), f = t(!1), d = (o = !0) => {
4
4
  const l = v(u);
5
5
  if (!l) return;
6
- const a = l.scrollHeight - l.scrollTop - l.clientHeight;
7
- r.value ? (l.scrollTop < 300 && (n.value = !1, t.value = !1), a < 300 && (s.value = !1, n.value = !0)) : e && (l.scrollTop < 300 && (h.value = l.scrollHeight, T.value = l.scrollTop, c.value = !0, t.value = !1), a < 300 && (s.value = !1));
8
- }, S = (e = 0) => {
9
- B(() => {
10
- setTimeout(() => {
11
- try {
12
- const l = v(u);
13
- if (!l || !c.value) return;
14
- const a = l.style.scrollBehavior;
15
- l.style.scrollBehavior = "auto";
16
- const m = l.scrollHeight - h.value;
17
- l.scrollTop = T.value + m, setTimeout(() => {
18
- l.style.scrollBehavior = a || "auto";
19
- }, 50);
20
- } finally {
21
- c.value = !1, f.value = !0, setTimeout(() => {
22
- f.value = !1;
23
- }, 500);
24
- }
25
- }, e);
26
- });
6
+ const e = l.scrollHeight - l.scrollTop - l.clientHeight;
7
+ r.value ? (l.scrollTop < 300 && (n.value = !1, s.value = !1), e < 300 && (a.value = !1, n.value = !0)) : o && (l.scrollTop < 300 && (h.value = l.scrollHeight, T.value = l.scrollTop, c.value = !0, s.value = !1), e < 300 && (a.value = !1));
8
+ }, S = (o = 0) => {
9
+ const l = () => {
10
+ w(() => {
11
+ requestAnimationFrame(() => {
12
+ try {
13
+ const e = v(u);
14
+ if (!e || !c.value) return;
15
+ const g = e.style.scrollBehavior;
16
+ e.style.scrollBehavior = "auto";
17
+ const B = e.scrollHeight - h.value;
18
+ e.scrollTop = T.value + B, setTimeout(() => {
19
+ e.style.scrollBehavior = g || "auto";
20
+ }, 50);
21
+ } finally {
22
+ c.value = !1, f.value = !0, setTimeout(() => {
23
+ f.value = !1;
24
+ }, 500);
25
+ }
26
+ });
27
+ });
28
+ };
29
+ o > 0 ? setTimeout(l, o) : l();
27
30
  };
28
- return i && d(
29
- () => [s.value, t.value],
31
+ return i && m(
32
+ () => [a.value, s.value],
30
33
  () => {
31
- s.value || i("loadMoreDown"), t.value || i("loadMore");
34
+ a.value || i("loadMoreDown"), s.value || i("loadMore");
32
35
  }
33
- ), p && d(
36
+ ), p && m(
34
37
  () => p.value,
35
- (e, l) => {
36
- l === !0 && e === !1 && S(0);
38
+ (o, l) => {
39
+ l === !0 && o === !1 && S(0);
37
40
  }
38
41
  ), {
39
- allowLoadMoreTop: t,
40
- allowLoadMoreBottom: s,
42
+ allowLoadMoreTop: s,
43
+ allowLoadMoreBottom: a,
41
44
  movingDown: n,
42
45
  isScrollByMouseButton: r,
43
46
  pendingTopRestore: c,
44
47
  topLoadJustHappened: f,
45
- checkScrollPosition: g,
48
+ checkScrollPosition: d,
46
49
  restoreScrollPosition: S,
47
- startScrollWatch: (e) => {
50
+ startScrollWatch: (o) => {
48
51
  const l = v(u);
49
52
  if (!l) return;
50
- (e.offsetX > l.clientWidth || e.offsetY > l.clientHeight) && (r.value = !0);
53
+ (o.offsetX > l.clientWidth || o.offsetY > l.clientHeight) && (r.value = !0);
51
54
  },
52
55
  stopScrollWatch: () => {
53
56
  r.value = !1;
54
57
  },
55
58
  resetAllowFlags: () => {
56
- t.value = !0, s.value = !0;
59
+ s.value = !0, a.value = !0;
57
60
  }
58
61
  };
59
62
  }
60
63
  export {
61
- W as useFeedLoadMore
64
+ F as useFeedLoadMore
62
65
  };
@@ -1,33 +1,31 @@
1
- function v({
2
- trackingObjects: s,
3
- chatAppId: a,
4
- onMessageVisible: c
1
+ function f({
2
+ trackingObjects: t,
3
+ chatAppId: c,
4
+ getMessageById: a,
5
+ onMessageVisible: g
5
6
  }) {
6
- const i = (e) => {
7
+ const d = (e) => {
7
8
  e.forEach((n) => {
8
- if (n.isIntersecting)
9
- try {
10
- const r = JSON.parse(n.target.id);
11
- c(r);
12
- } catch (r) {
13
- console.error("Failed to parse message from IntersectionObserver:", r);
14
- }
9
+ if (n.isIntersecting) {
10
+ const s = n.target.id, v = s.startsWith("msg-") ? s.slice(4) : s, i = a(v);
11
+ i && g(i);
12
+ }
15
13
  });
16
- }, g = {
17
- root: document.getElementById("feed-container-" + a),
14
+ }, l = {
15
+ root: document.getElementById("feed-container-" + c),
18
16
  rootMargin: "5px",
19
17
  threshold: 0
20
- }, o = new IntersectionObserver(i, g), t = () => {
21
- s.value && s.value.forEach((e) => o.observe(e));
18
+ }, o = new IntersectionObserver(d, l), r = () => {
19
+ t.value && t.value.forEach((e) => o.observe(e));
22
20
  };
23
21
  return {
24
22
  observer: o,
25
- observeMessages: t,
23
+ observeMessages: r,
26
24
  restartObserving: () => {
27
- t();
25
+ r();
28
26
  }
29
27
  };
30
28
  }
31
29
  export {
32
- v as useFeedMessageVisibility
30
+ f as useFeedMessageVisibility
33
31
  };