@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.
@@ -1,28 +1,28 @@
1
- import { defineComponent as ve, ref as v, computed as i, provide as h, inject as K, unref as t, watch as he, nextTick as x, onMounted as Me, createElementBlock as u, openBlock as r, createVNode as g, createBlock as m, createCommentVNode as d, normalizeStyle as L, renderSlot as U, withDirectives as Se, createElementVNode as M, vShow as Re, Transition as S, withCtx as R, Fragment as Ie, renderList as Ae, resolveDynamicComponent as Be, mergeProps as Te, toDisplayString as Ce, Teleport as E } from "vue";
2
- import Fe from "../../2_feed_elements/DateMessageSticky/DateMessageSticky.vue.js";
3
- import De from "../../2_feed_elements/BaseReplyMessage/BaseReplyMessage.vue.js";
4
- import we from "../../2_feed_elements/BaseEditMessage/BaseEditMessage.vue.js";
5
- import Oe from "../../2_feed_elements/MessageKeyboard/MessageKeyboard.vue.js";
6
- import je from "../../2_feed_elements/FeedKeyboard/FeedKeyboard.vue.js";
7
- import Ke from "../../2_feed_elements/TypingMessage/TypingMessage.vue.js";
8
- import xe from "../../1_atoms/LoadingIndicator/LoadingIndicator.vue.js";
9
- import { useFeedButton as Le } from "./composables/useFeedButton.js";
10
- import { useFeedComponents as Ue } from "./composables/useFeedComponents.js";
11
- import { useFeedGrouping as Ee } from "./composables/useFeedGrouping.js";
12
- import { useFeedKeyboard as Ne } from "./composables/useFeedKeyboard.js";
13
- import { useFeedLoadMore as Ve } from "./composables/useFeedLoadMore.js";
14
- import { useFeedMessageVisibility as $e } from "./composables/useFeedMessageVisibility.js";
15
- import { useFeedReply as qe } from "./composables/useFeedReply.js";
16
- import { useFeedScroll as Pe } from "./composables/useFeedScroll.js";
17
- import { useFeedScrollTo as ze } from "./composables/useFeedScrollTo.js";
18
- import { useStickyDate as We } from "./composables/useStickyDate.js";
19
- import { throttle as Ge } from "./functions/throttle.js";
20
- import { getDefaultMessageMenuActions as He } from "./utils/getDefaultMessageMenuActions.js";
21
- import Je from "./assets/chat-background.svg.js";
22
- const Qe = { class: "message-feed-wrapper" }, Xe = ["id"], Ye = { class: "message-feed__loading" }, Ze = ["id", "data-timestamp", "onDblclick"], _e = { style: { margin: "auto" } }, et = {
1
+ import { defineComponent as be, ref as h, computed as r, provide as v, inject as K, unref as t, watch as ke, nextTick as x, onMounted as he, createElementBlock as c, openBlock as i, createVNode as g, createBlock as u, createCommentVNode as l, normalizeStyle as O, renderSlot as L, withDirectives as ve, createElementVNode as M, vShow as Me, Transition as S, withCtx as R, Fragment as Se, renderList as Re, resolveDynamicComponent as Ie, mergeProps as Ae, toDisplayString as Be, Teleport as U } from "vue";
2
+ import Ce from "../../2_feed_elements/DateMessageSticky/DateMessageSticky.vue.js";
3
+ import Fe from "../../2_feed_elements/BaseReplyMessage/BaseReplyMessage.vue.js";
4
+ import Te from "../../2_feed_elements/BaseEditMessage/BaseEditMessage.vue.js";
5
+ import De from "../../2_feed_elements/MessageKeyboard/MessageKeyboard.vue.js";
6
+ import we from "../../2_feed_elements/FeedKeyboard/FeedKeyboard.vue.js";
7
+ import je from "../../2_feed_elements/TypingMessage/TypingMessage.vue.js";
8
+ import Ke from "../../1_atoms/LoadingIndicator/LoadingIndicator.vue.js";
9
+ import { useFeedButton as xe } from "./composables/useFeedButton.js";
10
+ import { useFeedComponents as Oe } from "./composables/useFeedComponents.js";
11
+ import { useFeedGrouping as Le } from "./composables/useFeedGrouping.js";
12
+ import { useFeedKeyboard as Ue } from "./composables/useFeedKeyboard.js";
13
+ import { useFeedLoadMore as Ee } from "./composables/useFeedLoadMore.js";
14
+ import { useFeedMessageVisibility as Ne } from "./composables/useFeedMessageVisibility.js";
15
+ import { useFeedReply as Ve } from "./composables/useFeedReply.js";
16
+ import { useFeedScroll as $e } from "./composables/useFeedScroll.js";
17
+ import { useFeedScrollTo as qe } from "./composables/useFeedScrollTo.js";
18
+ import { useStickyDate as Pe } from "./composables/useStickyDate.js";
19
+ import { throttle as ze } from "./functions/throttle.js";
20
+ import { getDefaultMessageMenuActions as We } from "./utils/getDefaultMessageMenuActions.js";
21
+ import Ge from "./assets/chat-background.svg.js";
22
+ const He = { class: "message-feed-wrapper" }, Je = ["id"], Qe = { class: "message-feed__loading" }, Xe = ["id", "data-timestamp", "onDblclick"], Ye = { style: { margin: "auto" } }, Ze = {
23
23
  key: 0,
24
24
  class: "message-feed__unread-amount"
25
- }, St = /* @__PURE__ */ ve({
25
+ }, vt = /* @__PURE__ */ be({
26
26
  __name: "Feed",
27
27
  props: {
28
28
  objects: {
@@ -117,7 +117,7 @@ const Qe = { class: "message-feed-wrapper" }, Xe = ["id"], Ye = { class: "messag
117
117
  */
118
118
  messageMenuActions: {
119
119
  type: Array,
120
- default: () => He()
120
+ default: () => We()
121
121
  }
122
122
  },
123
123
  emits: [
@@ -132,99 +132,97 @@ const Qe = { class: "message-feed-wrapper" }, Xe = ["id"], Ye = { class: "messag
132
132
  "smsInvite",
133
133
  "delimiterRead"
134
134
  ],
135
- setup(e, { emit: N }) {
136
- const a = e, k = v(), l = v(), I = v(), {
137
- isShowButton: V,
138
- isKeyboardPlace: $,
139
- checkButtonVisibility: q
140
- } = Le({
141
- feedRef: l,
135
+ setup(e, { emit: E }) {
136
+ const a = e, k = h(), m = h(), I = h(), {
137
+ isShowButton: N,
138
+ isKeyboardPlace: V,
139
+ checkButtonVisibility: $
140
+ } = xe({
141
+ feedRef: m,
142
142
  keyboardRef: I
143
- }), { componentsMap: P } = Ue(), z = i(() => a.reactionsEnabled), W = i(() => a.reactionsMode), A = i(() => a.currentUserId), B = i(() => a.reactionUserNames);
144
- h("currentUserId", A), h("reactionUserNames", B), h(
143
+ }), { componentsMap: q } = Oe(), P = r(() => a.reactionsEnabled), z = r(() => a.reactionsMode), A = r(() => a.currentUserId), B = r(() => a.reactionUserNames);
144
+ v("currentUserId", A), v("reactionUserNames", B), v(
145
145
  "messageMenuActions",
146
- i(() => a.messageMenuActions)
146
+ r(() => a.messageMenuActions)
147
147
  );
148
- const { groupedObjects: G } = Ee({
149
- objects: i(() => a.objects)
150
- }), y = K("chatAppId"), T = K("selectedChat", void 0), C = i(() => {
151
- if (T)
152
- return t(T);
148
+ const { groupedObjects: W } = Le({
149
+ objects: r(() => a.objects)
150
+ }), y = K("chatAppId"), C = K("selectedChat", void 0), F = r(() => {
151
+ if (C)
152
+ return t(C);
153
153
  });
154
- function H(s) {
154
+ function G(s) {
155
155
  return s.timestamp;
156
156
  }
157
- function J(s) {
157
+ function H(s) {
158
158
  var f;
159
159
  const n = s;
160
- if (!n.dialogId || !((f = C.value) != null && f.dialogs))
160
+ if (!n.dialogId || !((f = F.value) != null && f.dialogs))
161
161
  return;
162
- const o = C.value.dialogs.find((b) => b.dialogId === n.dialogId);
162
+ const o = F.value.dialogs.find((b) => b.dialogId === n.dialogId);
163
163
  return o == null ? void 0 : o.channelId;
164
164
  }
165
- function Q(s) {
165
+ function J(s) {
166
166
  return s.type === "message.call" && typeof a.callMessageOnCallback == "function" ? { onCall: a.callMessageOnCallback } : {};
167
167
  }
168
- const c = N, {
169
- checkScrollPosition: X,
170
- startScrollWatch: F,
168
+ const d = E, {
169
+ checkScrollPosition: Q,
170
+ startScrollWatch: T,
171
171
  stopScrollWatch: D,
172
- resetAllowFlags: Y
173
- } = Ve({
174
- feedRef: l,
175
- emit: c,
176
- isLoadingMoreRef: i(() => a.isLoadingMore)
172
+ resetAllowFlags: X
173
+ } = Ee({
174
+ feedRef: m,
175
+ emit: d,
176
+ isLoadingMoreRef: r(() => a.isLoadingMore)
177
177
  }), {
178
178
  getMessage: p,
179
- messageAction: Z,
180
- handleClickReplied: _,
181
- feedObjectDoubleClick: ee,
182
- handleResetReply: te,
183
- handleResetEdit: oe
184
- } = qe({
179
+ messageAction: Y,
180
+ handleClickReplied: Z,
181
+ feedObjectDoubleClick: _,
182
+ handleResetReply: ee,
183
+ handleResetEdit: te
184
+ } = Ve({
185
185
  enableDoubleClickReply: a.enableDoubleClickReply,
186
- emit: c
186
+ emit: d
187
187
  });
188
- function se(s) {
189
- c("smsInvite", s);
188
+ function oe(s) {
189
+ d("smsInvite", s);
190
190
  }
191
- function ae(s) {
192
- c("delimiterRead", s);
191
+ function se(s) {
192
+ d("delimiterRead", s);
193
193
  }
194
194
  const {
195
- showKeyboard: ne,
196
- keyboardAction: re,
195
+ showKeyboard: ae,
196
+ keyboardAction: ne,
197
197
  feedKeyboardAction: ie
198
- } = Ne({
199
- isKeyboardPlace: $,
200
- objects: i(() => a.objects),
201
- emit: c
198
+ } = Ue({
199
+ isKeyboardPlace: V,
200
+ objects: r(() => a.objects),
201
+ emit: d
202
202
  }), {
203
- showStickyDate: le,
204
- stickyDateText: de,
205
- show: ce
206
- } = We({
207
- feedRef: l,
203
+ showStickyDate: re,
204
+ stickyDateText: le,
205
+ show: de
206
+ } = Pe({
207
+ feedRef: m,
208
208
  trackingObjects: k
209
209
  }), {
210
- isInitialized: ue,
211
- performScrollToBottom: me,
212
- ensureScrollToBottom: w,
213
- initializeScroll: fe,
214
- smoothScrollToBottom: ge
215
- } = Pe({
216
- feedRef: l,
217
- objectsRef: i(() => a.objects),
218
- scrollToBottomRef: i(() => a.scrollToBottom)
219
- }), O = i(() => a.chatBackground ?? `data:image/svg+xml;charset=utf-8,${encodeURIComponent(Je)}`);
210
+ isInitialized: ce,
211
+ initializeScroll: ue,
212
+ smoothScrollToBottom: me
213
+ } = $e({
214
+ feedRef: m,
215
+ objectsRef: r(() => a.objects),
216
+ scrollToBottomRef: r(() => a.scrollToBottom)
217
+ }), w = r(() => a.chatBackground ?? `data:image/svg+xml;charset=utf-8,${encodeURIComponent(Ge)}`);
220
218
  function j(s = !0) {
221
- q(), X(s), ce();
219
+ $(), Q(s), de();
222
220
  }
223
- const ye = Ge(() => j(), 250);
224
- function pe() {
225
- c("forceScrollToBottom"), ge();
221
+ const fe = ze(() => j(), 250);
222
+ function ge() {
223
+ d("forceScrollToBottom"), me();
226
224
  }
227
- function be(s) {
225
+ function ye(s) {
228
226
  const n = a.objects;
229
227
  if (s.startsWith("mid-")) {
230
228
  const o = parseInt(s.slice(4), 10);
@@ -232,171 +230,163 @@ const Qe = { class: "message-feed-wrapper" }, Xe = ["id"], Ye = { class: "messag
232
230
  }
233
231
  return n.find((o) => o.messageId === s);
234
232
  }
235
- const { restartObserving: ke } = $e({
233
+ const { restartObserving: pe } = Ne({
236
234
  trackingObjects: k,
237
235
  chatAppId: y,
238
- getMessageById: be,
239
- onMessageVisible: (s) => c("messageVisible", s)
236
+ getMessageById: ye,
237
+ onMessageVisible: (s) => d("messageVisible", s)
240
238
  });
241
- return he(
239
+ return ke(
242
240
  () => a.objects,
243
241
  () => {
244
242
  x(() => {
245
243
  requestAnimationFrame(() => {
246
- Y(), j(!1), k.value = document.querySelectorAll(".tracking-message"), ke();
244
+ X(), j(!1), k.value = document.querySelectorAll(".tracking-message"), pe();
247
245
  });
248
246
  });
249
247
  },
250
248
  { immediate: !0 }
251
- ), ze({
252
- targetIdRef: i(() => a.scrollTo),
249
+ ), qe({
250
+ targetIdRef: r(() => a.scrollTo),
253
251
  feedContainerId: `feed-container-${y}`
254
- }), Me(() => {
252
+ }), he(() => {
255
253
  x(() => {
256
- a.objects.length > 0 && !ue.value && fe();
257
- const s = new ResizeObserver(() => {
258
- a.scrollToBottom && (me(), setTimeout(() => {
259
- w();
260
- }, 200), setTimeout(() => {
261
- w();
262
- }, 800));
263
- });
264
- l.value && s.observe(l.value);
254
+ a.objects.length > 0 && !ce.value && ue();
265
255
  });
266
- }), (s, n) => (r(), u("div", Qe, [
267
- e.objects.length > 0 || e.typing ? (r(), u("div", {
256
+ }), (s, n) => (i(), c("div", He, [
257
+ e.objects.length > 0 || e.typing ? (i(), c("div", {
268
258
  key: 0,
269
259
  id: "feed-container-" + t(y),
270
260
  ref_key: "refFeed",
271
- ref: l,
261
+ ref: m,
272
262
  class: "message-feed",
273
- style: L({ backgroundImage: `url(${O.value})` }),
274
- onScroll: n[0] || (n[0] = (o) => t(ye)()),
263
+ style: O({ backgroundImage: `url(${w.value})` }),
264
+ onScroll: n[0] || (n[0] = (o) => t(fe)()),
275
265
  onMousedown: n[1] || (n[1] = //@ts-ignore
276
- (...o) => t(F) && t(F)(...o)),
266
+ (...o) => t(T) && t(T)(...o)),
277
267
  onMouseup: n[2] || (n[2] = //@ts-ignore
278
268
  (...o) => t(D) && t(D)(...o))
279
269
  }, [
280
- U(s.$slots, "prepend", {}, void 0, !0),
281
- Se(M("div", Ye, [
282
- g(xe, {
270
+ L(s.$slots, "prepend", {}, void 0, !0),
271
+ ve(M("div", Qe, [
272
+ g(Ke, {
283
273
  "is-loading": e.isLoadingMore,
284
274
  size: "small",
285
275
  position: "top"
286
276
  }, null, 8, ["is-loading"])
287
277
  ], 512), [
288
- [Re, e.isLoadingMore]
278
+ [Me, e.isLoadingMore]
289
279
  ]),
290
280
  g(S, null, {
291
281
  default: R(() => [
292
- t(le) && !e.isLoadingMore ? (r(), m(Fe, {
282
+ t(re) && !e.isLoadingMore ? (i(), u(Ce, {
293
283
  key: 0,
294
284
  class: "message-feed__sticky-date",
295
- text: t(de)
296
- }, null, 8, ["text"])) : d("", !0)
285
+ text: t(le)
286
+ }, null, 8, ["text"])) : l("", !0)
297
287
  ]),
298
288
  _: 1
299
289
  }),
300
- (r(!0), u(Ie, null, Ae(t(G), (o, f) => (r(), u("div", {
290
+ (i(!0), c(Se, null, Re(t(W), (o, f) => (i(), c("div", {
301
291
  id: "msg-" + (o.messageId ?? "mid-" + f),
302
292
  key: o.messageId ?? "mid-" + f,
303
- "data-timestamp": H(o),
293
+ "data-timestamp": G(o),
304
294
  class: "tracking-message",
305
- onDblclick: (b) => t(ee)(b, o)
295
+ onDblclick: (b) => t(_)(b, o)
306
296
  }, [
307
- (r(), m(Be(t(P)(o)), Te({
297
+ (i(), u(Ie(t(q)(o)), Ae({
308
298
  key: o.messageId ?? "mid-" + f,
309
299
  class: "message-feed__message",
310
300
  message: o,
311
301
  "apply-style": e.applyStyle,
312
302
  "is-first-in-series": o.isFirstInSeries,
313
- "reactions-enabled": z.value,
314
- "reactions-mode": W.value,
303
+ "reactions-enabled": P.value,
304
+ "reactions-mode": z.value,
315
305
  "current-user-id": A.value,
316
306
  "reaction-user-names": B.value,
317
307
  "subtext-tooltip-data": e.subtextTooltipData,
318
- channel: J(o)
319
- }, { ref_for: !0 }, Q(o), {
320
- onAction: t(Z),
321
- onReply: t(_),
322
- onSmsInvite: (b) => se(o),
323
- onRead: ae
308
+ channel: H(o)
309
+ }, { ref_for: !0 }, J(o), {
310
+ onAction: t(Y),
311
+ onReply: t(Z),
312
+ onSmsInvite: (b) => oe(o),
313
+ onRead: se
324
314
  }), null, 16, ["message", "apply-style", "is-first-in-series", "reactions-enabled", "reactions-mode", "current-user-id", "reaction-user-names", "subtext-tooltip-data", "channel", "onAction", "onReply", "onSmsInvite"]))
325
- ], 40, Ze))), 128)),
326
- e.typing ? (r(), m(Ke, {
315
+ ], 40, Xe))), 128)),
316
+ e.typing ? (i(), u(je, {
327
317
  key: 0,
328
318
  message: {
329
319
  subText: e.typing.title,
330
320
  avatar: e.typing.avatar
331
321
  }
332
- }, null, 8, ["message"])) : d("", !0),
322
+ }, null, 8, ["message"])) : l("", !0),
333
323
  g(S, null, {
334
324
  default: R(() => [
335
- t(ne) ? (r(), m(Oe, {
325
+ t(ae) ? (i(), u(De, {
336
326
  key: 0,
337
327
  ref_key: "keyboardRef",
338
328
  ref: I,
339
329
  class: "message-feed__keyboard",
340
330
  keyboard: e.objects[e.objects.length - 1].keyboard,
341
331
  align: e.keyboardAlign,
342
- onAction: t(re)
343
- }, null, 8, ["keyboard", "align", "onAction"])) : d("", !0)
332
+ onAction: t(ne)
333
+ }, null, 8, ["keyboard", "align", "onAction"])) : l("", !0)
344
334
  ]),
345
335
  _: 1
346
336
  }),
347
- e.feedKeyboards && e.feedKeyboards.length > 0 ? (r(), m(je, {
337
+ e.feedKeyboards && e.feedKeyboards.length > 0 ? (i(), u(we, {
348
338
  key: 1,
349
339
  buttons: e.feedKeyboards,
350
340
  align: e.feedKeyboardAlign,
351
341
  onAction: t(ie)
352
- }, null, 8, ["buttons", "align", "onAction"])) : d("", !0)
353
- ], 44, Xe)) : (r(), u("div", {
342
+ }, null, 8, ["buttons", "align", "onAction"])) : l("", !0)
343
+ ], 44, Je)) : (i(), c("div", {
354
344
  key: 1,
355
345
  ref_key: "refFeed",
356
- ref: l,
346
+ ref: m,
357
347
  class: "message-feed",
358
- style: L({ backgroundImage: `url(${O.value})` })
348
+ style: O({ backgroundImage: `url(${w.value})` })
359
349
  }, [
360
- M("div", _e, [
361
- U(s.$slots, "empty-feed", {}, void 0, !0)
350
+ M("div", Ye, [
351
+ L(s.$slots, "empty-feed", {}, void 0, !0)
362
352
  ])
363
353
  ], 4)),
364
354
  g(S, null, {
365
355
  default: R(() => [
366
- t(V) ? (r(), u("button", {
356
+ t(N) ? (i(), c("button", {
367
357
  key: 0,
368
358
  class: "message-feed__button-down",
369
- onClick: pe
359
+ onClick: ge
370
360
  }, [
371
- e.buttonParams ? (r(), u("div", et, Ce(e.buttonParams.unreadAmount), 1)) : d("", !0),
361
+ e.buttonParams ? (i(), c("div", Ze, Be(e.buttonParams.unreadAmount), 1)) : l("", !0),
372
362
  n[3] || (n[3] = M("span", { class: "pi pi-angle-down message-feed__icon-down" }, null, -1))
373
- ])) : d("", !0)
363
+ ])) : l("", !0)
374
364
  ]),
375
365
  _: 1
376
366
  }),
377
- t(p)().reply ? (r(), m(E, {
367
+ t(p)().reply ? (i(), u(U, {
378
368
  key: 2,
379
369
  to: "#chat-input-reply-line-" + t(y)
380
370
  }, [
381
- g(De, {
371
+ g(Fe, {
382
372
  class: "chat-input-reply",
383
373
  message: t(p)().reply,
384
- onReset: t(te)
374
+ onReset: t(ee)
385
375
  }, null, 8, ["message", "onReset"])
386
- ], 8, ["to"])) : d("", !0),
387
- t(p)().edit ? (r(), m(E, {
376
+ ], 8, ["to"])) : l("", !0),
377
+ t(p)().edit ? (i(), u(U, {
388
378
  key: 3,
389
379
  to: "#chat-input-reply-line-" + t(y)
390
380
  }, [
391
- g(we, {
381
+ g(Te, {
392
382
  class: "chat-input-reply",
393
383
  message: t(p)().edit,
394
- onReset: t(oe)
384
+ onReset: t(te)
395
385
  }, null, 8, ["message", "onReset"])
396
- ], 8, ["to"])) : d("", !0)
386
+ ], 8, ["to"])) : l("", !0)
397
387
  ]));
398
388
  }
399
389
  });
400
390
  export {
401
- St as default
391
+ vt as default
402
392
  };
@@ -1,63 +1,96 @@
1
- import { ref as a, watch as u, nextTick as s } from "vue";
2
- function f({ feedRef: e, objectsRef: i, scrollToBottomRef: m }) {
3
- const l = a(!1);
4
- function r() {
5
- s(() => {
6
- const t = e.value;
7
- t && (t.style.scrollBehavior = "auto", t.scrollTop = t.scrollHeight, s(() => {
8
- t.scrollHeight - t.scrollTop - t.clientHeight > 10 && (t.scrollTop = t.scrollHeight);
9
- }), setTimeout(() => {
10
- t.style.scrollBehavior = "smooth";
11
- }, 1e3));
12
- });
1
+ import { ref as S, watch as f, nextTick as h, onUnmounted as U } from "vue";
2
+ function q({ feedRef: o, objectsRef: l, scrollToBottomRef: B }) {
3
+ const a = S(!1), i = S(!1);
4
+ let d = !1, u = !1, s = null, e = null;
5
+ function c() {
6
+ if (!i.value) return;
7
+ const t = o.value;
8
+ t && (d = !0, t.style.scrollBehavior = "auto", t.scrollTop = t.scrollHeight, requestAnimationFrame(() => {
9
+ d = !1;
10
+ }));
13
11
  }
14
- function o() {
15
- const t = e.value;
12
+ function g() {
13
+ const t = o.value;
16
14
  if (!t) return;
17
- const n = () => {
18
- t.scrollHeight - t.scrollTop - t.clientHeight < 5 || (t.scrollTop = t.scrollHeight, setTimeout(() => {
19
- t.scrollHeight - t.scrollTop - t.clientHeight > 5 && (t.scrollTop = t.scrollHeight);
20
- }, 200));
21
- };
22
- n(), setTimeout(n, 300);
15
+ const n = t.scrollTop;
16
+ t.style.scrollBehavior = "auto", t.scrollTop = n;
23
17
  }
24
- function c() {
25
- !l.value && i.value.length > 0 && (r(), setTimeout(() => {
26
- o();
27
- }, 300), setTimeout(() => {
28
- o();
29
- }, 800), l.value = !0);
30
- }
31
- function h() {
32
- s(() => {
33
- const t = e.value;
34
- t && (t.style.scrollBehavior = "smooth", t.scrollTop = t.scrollHeight);
18
+ function m() {
19
+ i.value = !0, h(() => {
20
+ c(), requestAnimationFrame(() => c());
35
21
  });
36
22
  }
37
- return u(
38
- () => m.value,
23
+ function r() {
24
+ i.value && (i.value = !1, g());
25
+ }
26
+ function p(t) {
27
+ e == null || e.disconnect(), e = new ResizeObserver(() => {
28
+ c();
29
+ }), e.observe(t);
30
+ for (const n of t.children)
31
+ n instanceof HTMLElement && e.observe(n);
32
+ }
33
+ function w() {
34
+ u = !0;
35
+ }
36
+ function v() {
37
+ u = !1;
38
+ }
39
+ function L() {
40
+ d || u && r();
41
+ }
42
+ function k(t) {
43
+ t.addEventListener("wheel", r, { passive: !0 }), t.addEventListener("touchstart", r, { passive: !0 }), t.addEventListener("pointerdown", w), t.addEventListener("scroll", L, { passive: !0 }), window.addEventListener("pointerup", v), window.addEventListener("pointercancel", v);
44
+ }
45
+ function E(t) {
46
+ t.removeEventListener("wheel", r), t.removeEventListener("touchstart", r), t.removeEventListener("pointerdown", w), t.removeEventListener("scroll", L), window.removeEventListener("pointerup", v), window.removeEventListener("pointercancel", v), u = !1;
47
+ }
48
+ function F() {
49
+ m();
50
+ }
51
+ function T() {
52
+ !a.value && l.value.length > 0 && (m(), a.value = !0);
53
+ }
54
+ function P() {
55
+ i.value = !0, h(() => {
56
+ const t = o.value;
57
+ t && t.scrollTo({ top: t.scrollHeight, behavior: "smooth" });
58
+ });
59
+ }
60
+ return f(
61
+ o,
62
+ (t, n) => {
63
+ n && E(n), s = t ?? null, t && (k(t), p(t), i.value && c());
64
+ },
65
+ { immediate: !0 }
66
+ ), f(
67
+ l,
68
+ () => {
69
+ h(() => {
70
+ o.value && p(o.value);
71
+ });
72
+ }
73
+ ), f(
74
+ () => B.value,
39
75
  (t) => {
40
- t && (r(), setTimeout(() => {
41
- o();
42
- }, 500), setTimeout(() => {
43
- o();
44
- }, 1200));
76
+ t && m();
45
77
  },
46
78
  { immediate: !0 }
47
- ), u(
48
- () => i.value.length,
79
+ ), f(
80
+ () => l.value.length,
49
81
  () => {
50
- !l.value && i.value.length > 0 && c();
82
+ !a.value && l.value.length > 0 && T();
51
83
  },
52
84
  { immediate: !0 }
53
- ), {
54
- isInitialized: l,
55
- performScrollToBottom: r,
56
- ensureScrollToBottom: o,
57
- initializeScroll: c,
58
- smoothScrollToBottom: h
85
+ ), U(() => {
86
+ e == null || e.disconnect(), e = null, s && (E(s), s = null);
87
+ }), {
88
+ isInitialized: a,
89
+ performScrollToBottom: F,
90
+ initializeScroll: T,
91
+ smoothScrollToBottom: P
59
92
  };
60
93
  }
61
94
  export {
62
- f as useFeedScroll
95
+ q as useFeedScroll
63
96
  };