@mobilon-dev/chotto 0.3.120 → 0.3.123

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 "./Feed.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../../../_virtual/_plugin-vue_export-helper.js";
4
- const f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-db0a32f8"]]);
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-974328f1"]]);
5
5
  export {
6
- f as default
6
+ m as default
7
7
  };
@@ -1,36 +1,36 @@
1
- import { defineComponent as Te, ref as S, computed as l, provide as A, inject as G, unref as o, watch as B, nextTick as F, onMounted as De, createElementBlock as y, openBlock as i, createVNode as p, createBlock as f, createCommentVNode as c, normalizeStyle as H, renderSlot as J, withDirectives as we, createElementVNode as C, vShow as Ke, Transition as T, withCtx as D, Fragment as xe, renderList as Oe, isMemoSame as $e, resolveDynamicComponent as Ne, mergeProps as Le, toDisplayString as Ue, Teleport as Q } from "vue";
2
- import je from "../../2_feed_elements/DateMessageSticky/DateMessageSticky.vue.js";
3
- import qe from "../../2_feed_elements/BaseReplyMessage/BaseReplyMessage.vue.js";
4
- import Ee from "../../2_feed_elements/BaseEditMessage/BaseEditMessage.vue.js";
5
- import Pe from "../../2_feed_elements/MessageKeyboard/MessageKeyboard.vue.js";
6
- import Ve from "../../2_feed_elements/FeedKeyboard/FeedKeyboard.vue.js";
7
- import We from "../../2_feed_elements/TypingMessage/TypingMessage.vue.js";
8
- import ze from "../../1_atoms/LoadingIndicator/LoadingIndicator.vue.js";
9
- import Ge from "../../2_feed_elements/MessageReactions/MessageReactionsOverlay.vue.js";
10
- import { useFeedButton as He } from "./composables/useFeedButton.js";
11
- import { useFeedComponents as Je } from "./composables/useFeedComponents.js";
12
- import { useFeedGrouping as Qe } from "./composables/useFeedGrouping.js";
13
- import { useFeedKeyboard as Xe } from "./composables/useFeedKeyboard.js";
14
- import { useFeedLoadMore as Ye } from "./composables/useFeedLoadMore.js";
15
- import { useFeedMessageVisibility as Ze } from "./composables/useFeedMessageVisibility.js";
16
- import { useFeedProgressiveRender as _e } from "./composables/useFeedProgressiveRender.js";
17
- import { provideFeedReactionsOverlay as et } from "./composables/useFeedReactionsOverlay.js";
18
- import { useFeedReply as tt } from "./composables/useFeedReply.js";
19
- import { useFeedScroll as st } from "./composables/useFeedScroll.js";
20
- import { useFeedScrollTo as ot } from "./composables/useFeedScrollTo.js";
21
- import { useStickyDate as at } from "./composables/useStickyDate.js";
22
- import { throttle as nt } from "./functions/throttle.js";
23
- import { getDefaultMessageMenuActions as rt } from "./utils/getDefaultMessageMenuActions.js";
24
- import { isSmsFeedMessage as it } from "../../../functions/isSmsChannel.js";
1
+ import { defineComponent as Ke, ref as I, computed as l, provide as A, inject as H, unref as o, watch as B, nextTick as F, onMounted as xe, createElementBlock as y, openBlock as i, createVNode as p, createBlock as f, createCommentVNode as c, normalizeStyle as J, renderSlot as Q, withDirectives as Oe, createElementVNode as C, vShow as $e, Transition as T, withCtx as D, Fragment as Ne, renderList as Le, isMemoSame as Ue, resolveDynamicComponent as je, mergeProps as qe, toDisplayString as Ee, Teleport as X } from "vue";
2
+ import Pe from "../../2_feed_elements/DateMessageSticky/DateMessageSticky.vue.js";
3
+ import Ve from "../../2_feed_elements/BaseReplyMessage/BaseReplyMessage.vue.js";
4
+ import We from "../../2_feed_elements/BaseEditMessage/BaseEditMessage.vue.js";
5
+ import ze from "../../2_feed_elements/MessageKeyboard/MessageKeyboard.vue.js";
6
+ import Ge from "../../2_feed_elements/FeedKeyboard/FeedKeyboard.vue.js";
7
+ import He from "../../2_feed_elements/TypingMessage/TypingMessage.vue.js";
8
+ import Je from "../../1_atoms/LoadingIndicator/LoadingIndicator.vue.js";
9
+ import Qe from "../../2_feed_elements/MessageReactions/MessageReactionsOverlay.vue.js";
10
+ import { useFeedButton as Xe } from "./composables/useFeedButton.js";
11
+ import { useFeedComponents as Ye } from "./composables/useFeedComponents.js";
12
+ import { useFeedGrouping as Ze } from "./composables/useFeedGrouping.js";
13
+ import { useFeedKeyboard as _e } from "./composables/useFeedKeyboard.js";
14
+ import { useFeedLoadMore as et } from "./composables/useFeedLoadMore.js";
15
+ import { useFeedMessageVisibility as tt } from "./composables/useFeedMessageVisibility.js";
16
+ import { useFeedProgressiveRender as st } from "./composables/useFeedProgressiveRender.js";
17
+ import { provideFeedReactionsOverlay as ot } from "./composables/useFeedReactionsOverlay.js";
18
+ import { useFeedReply as at } from "./composables/useFeedReply.js";
19
+ import { useFeedScroll as nt } from "./composables/useFeedScroll.js";
20
+ import { useFeedScrollTo as rt } from "./composables/useFeedScrollTo.js";
21
+ import { useStickyDate as it } from "./composables/useStickyDate.js";
22
+ import { throttle as lt } from "./functions/throttle.js";
23
+ import { getDefaultMessageMenuActions as dt } from "./utils/getDefaultMessageMenuActions.js";
24
+ import { isSmsFeedMessage as ct } from "../../../functions/isSmsChannel.js";
25
25
  import "../../../functions/parseMarkdown.js";
26
- import lt from "./assets/chat-background.svg.js";
27
- const dt = {
26
+ import ut from "./assets/chat-background.svg.js";
27
+ const mt = {
28
28
  class: "message-feed-wrapper",
29
29
  "data-testid": "feed"
30
- }, ct = ["id"], ut = { class: "message-feed__loading" }, mt = { style: { margin: "auto" } }, ft = {
30
+ }, ft = ["id"], gt = { class: "message-feed__loading" }, yt = { style: { margin: "auto" } }, pt = {
31
31
  key: 0,
32
32
  class: "message-feed__unread-amount"
33
- }, qt = /* @__PURE__ */ Te({
33
+ }, Vt = /* @__PURE__ */ Ke({
34
34
  __name: "Feed",
35
35
  props: {
36
36
  /**
@@ -128,7 +128,7 @@ const dt = {
128
128
  */
129
129
  messageMenuActions: {
130
130
  type: Array,
131
- default: () => rt()
131
+ default: () => dt()
132
132
  }
133
133
  },
134
134
  emits: [
@@ -143,22 +143,22 @@ const dt = {
143
143
  "smsInvite",
144
144
  "delimiterRead"
145
145
  ],
146
- setup(a, { emit: X }) {
147
- const n = a, v = S(), u = S(), w = S(), {
148
- isShowButton: Y,
146
+ setup(a, { emit: Y }) {
147
+ const n = a, v = I(), u = I(), w = I(), {
148
+ isShowButton: K,
149
149
  isKeyboardPlace: Z,
150
150
  checkButtonVisibility: _
151
- } = He({
151
+ } = Xe({
152
152
  feedRef: u,
153
153
  keyboardRef: w
154
- }), { componentsMap: ee } = Je(), K = l(() => n.reactionsEnabled);
155
- et();
156
- const te = l(() => n.reactionsMode), x = l(() => n.currentUserId), O = l(() => n.reactionUserNames);
157
- A("currentUserId", x), A("reactionUserNames", O), A(
154
+ }), { componentsMap: ee } = Ye(), x = l(() => n.reactionsEnabled);
155
+ ot();
156
+ const te = l(() => n.reactionsMode), O = l(() => n.currentUserId), $ = l(() => n.reactionUserNames);
157
+ A("currentUserId", O), A("reactionUserNames", $), A(
158
158
  "messageMenuActions",
159
159
  l(() => n.messageMenuActions)
160
160
  );
161
- const { seriesFlags: $ } = Qe({
161
+ const { seriesFlags: N } = Ze({
162
162
  objects: l(() => n.objects)
163
163
  }), {
164
164
  visibleObjects: se,
@@ -166,12 +166,12 @@ const dt = {
166
166
  isBackfilling: oe,
167
167
  revealThroughIndex: ae,
168
168
  accelerateBackfill: ne
169
- } = _e({
169
+ } = st({
170
170
  objectsRef: l(() => n.objects),
171
171
  feedRef: u
172
- }), b = G("chatAppId"), N = G("selectedChat", void 0), L = l(() => {
173
- if (N)
174
- return o(N);
172
+ }), b = H("chatAppId"), L = H("selectedChat", void 0), U = l(() => {
173
+ if (L)
174
+ return o(L);
175
175
  });
176
176
  function re(t) {
177
177
  return t.timestamp;
@@ -184,38 +184,38 @@ const dt = {
184
184
  const s = (e = t.reactions) == null ? void 0 : e.items;
185
185
  return s != null && s.length ? s.map((r) => `${r.key}:${r.userId}`).join(",") : "";
186
186
  }
187
- function U(t) {
187
+ function j(t) {
188
188
  var m, d, k;
189
189
  const s = t, e = s.channelId || ((m = s.channel) == null ? void 0 : m.channelId) || ((d = s.meta) == null ? void 0 : d.channelId);
190
190
  if (e) return String(e);
191
- if (!s.dialogId || !((k = L.value) != null && k.dialogs))
191
+ if (!s.dialogId || !((k = U.value) != null && k.dialogs))
192
192
  return;
193
- const r = L.value.dialogs.find((I) => I.dialogId === s.dialogId);
193
+ const r = U.value.dialogs.find((R) => R.dialogId === s.dialogId);
194
194
  return r == null ? void 0 : r.channelId;
195
195
  }
196
196
  function le(t) {
197
197
  return t.type === "message.call" && typeof n.callMessageOnCallback == "function" ? { onCall: n.callMessageOnCallback } : {};
198
198
  }
199
- const g = X, {
199
+ const g = Y, {
200
200
  checkScrollPosition: de,
201
- startScrollWatch: j,
202
- stopScrollWatch: q,
201
+ startScrollWatch: q,
202
+ stopScrollWatch: E,
203
203
  resetAllowFlags: ce
204
- } = Ye({
204
+ } = et({
205
205
  feedRef: u,
206
206
  emit: g,
207
207
  isLoadingMoreRef: l(() => n.isLoadingMore)
208
208
  }), {
209
- getMessage: R,
209
+ getMessage: S,
210
210
  messageAction: ue,
211
211
  handleClickReplied: me,
212
212
  feedObjectDoubleClick: fe,
213
213
  handleResetReply: ge,
214
214
  handleResetEdit: ye
215
- } = tt({
215
+ } = at({
216
216
  enableDoubleClickReply: n.enableDoubleClickReply,
217
217
  emit: g,
218
- isReplyAllowed: (t) => !it(t, U(t))
218
+ isReplyAllowed: (t) => !ct(t, j(t))
219
219
  });
220
220
  function pe(t) {
221
221
  g("smsInvite", t);
@@ -227,39 +227,48 @@ const dt = {
227
227
  showKeyboard: ke,
228
228
  keyboardAction: ve,
229
229
  feedKeyboardAction: he
230
- } = Xe({
230
+ } = _e({
231
231
  isKeyboardPlace: Z,
232
232
  objects: l(() => n.objects),
233
233
  emit: g
234
234
  }), {
235
235
  showStickyDate: Me,
236
- stickyDateText: Re,
237
- show: E
238
- } = at({
236
+ stickyDateText: Se,
237
+ show: Re,
238
+ hide: Ie
239
+ } = it({
239
240
  feedRef: u,
240
241
  trackingObjects: v
241
242
  }), {
242
- isInitialized: Ie,
243
- initializeScroll: Se,
244
- smoothScrollToBottom: Ae
245
- } = st({
243
+ isInitialized: Ae,
244
+ stickToBottom: Be,
245
+ initializeScroll: Fe,
246
+ smoothScrollToBottom: Ce
247
+ } = nt({
246
248
  feedRef: u,
247
249
  objectsRef: l(() => n.objects),
248
250
  scrollToBottomRef: l(() => n.scrollToBottom)
249
- }), P = l(() => n.chatBackground ?? `data:image/svg+xml;charset=utf-8,${encodeURIComponent(lt)}`);
250
- function V(t = !0) {
251
+ }), P = l(() => n.chatBackground ?? `data:image/svg+xml;charset=utf-8,${encodeURIComponent(ut)}`);
252
+ function V() {
253
+ if (Be.value || !K.value) {
254
+ Ie();
255
+ return;
256
+ }
257
+ Re();
258
+ }
259
+ function W(t = !0) {
251
260
  if (_(), oe.value) {
252
261
  const s = u.value;
253
- s && s.scrollTop < 300 && ne(), E();
262
+ s && s.scrollTop < 300 && ne(), V();
254
263
  return;
255
264
  }
256
- de(t), E();
265
+ de(t), V();
257
266
  }
258
- const Be = nt(() => V(), 250);
259
- function Fe() {
260
- g("forceScrollToBottom"), Ae();
267
+ const Te = lt(() => W(), 250);
268
+ function De() {
269
+ g("forceScrollToBottom"), Ce();
261
270
  }
262
- function Ce(t) {
271
+ function we(t) {
263
272
  const s = n.objects;
264
273
  if (t.startsWith("mid-")) {
265
274
  const e = parseInt(t.slice(4), 10);
@@ -267,10 +276,10 @@ const dt = {
267
276
  }
268
277
  return s.find((e) => e.messageId === t);
269
278
  }
270
- const { restartObserving: W } = Ze({
279
+ const { restartObserving: z } = tt({
271
280
  trackingObjects: v,
272
281
  chatAppId: b,
273
- getMessageById: Ce,
282
+ getMessageById: we,
274
283
  onMessageVisible: (t) => g("messageVisible", t)
275
284
  });
276
285
  return B(
@@ -278,14 +287,14 @@ const dt = {
278
287
  () => {
279
288
  F(() => {
280
289
  requestAnimationFrame(() => {
281
- ce(), V(!1), v.value = document.querySelectorAll(".tracking-message"), W();
290
+ ce(), W(!1), v.value = document.querySelectorAll(".tracking-message"), z();
282
291
  });
283
292
  });
284
293
  },
285
294
  { immediate: !0 }
286
295
  ), B(h, () => {
287
296
  F(() => {
288
- v.value = document.querySelectorAll(".tracking-message"), W();
297
+ v.value = document.querySelectorAll(".tracking-message"), z();
289
298
  });
290
299
  }), B(
291
300
  () => n.scrollTo,
@@ -295,14 +304,14 @@ const dt = {
295
304
  let m = -1;
296
305
  r.startsWith("mid-") ? m = Number.parseInt(r.slice(4), 10) : m = s.findIndex((d) => d.messageId === r || d.messageId === e), Number.isFinite(m) && ae(m);
297
306
  }
298
- ), ot({
307
+ ), rt({
299
308
  targetIdRef: l(() => n.scrollTo),
300
309
  feedContainerId: `feed-container-${b}`
301
- }), De(() => {
310
+ }), xe(() => {
302
311
  F(() => {
303
- n.objects.length > 0 && !Ie.value && Se();
312
+ n.objects.length > 0 && !Ae.value && Fe();
304
313
  });
305
- }), (t, s) => (i(), y("div", dt, [
314
+ }), (t, s) => (i(), y("div", mt, [
306
315
  a.objects.length > 0 || a.typing ? (i(), y("div", {
307
316
  key: 0,
308
317
  id: "feed-container-" + o(b),
@@ -310,67 +319,67 @@ const dt = {
310
319
  ref: u,
311
320
  class: "message-feed",
312
321
  "data-testid": "feed-scroll",
313
- style: H({ backgroundImage: `url(${P.value})` }),
314
- onScroll: s[2] || (s[2] = (e) => o(Be)()),
322
+ style: J({ backgroundImage: `url(${P.value})` }),
323
+ onScroll: s[2] || (s[2] = (e) => o(Te)()),
315
324
  onMousedown: s[3] || (s[3] = //@ts-ignore
316
- (...e) => o(j) && o(j)(...e)),
325
+ (...e) => o(q) && o(q)(...e)),
317
326
  onMouseup: s[4] || (s[4] = //@ts-ignore
318
- (...e) => o(q) && o(q)(...e))
327
+ (...e) => o(E) && o(E)(...e))
319
328
  }, [
320
- J(t.$slots, "prepend", {}, void 0, !0),
321
- we(C("div", ut, [
322
- p(ze, {
329
+ Q(t.$slots, "prepend", {}, void 0, !0),
330
+ Oe(C("div", gt, [
331
+ p(Je, {
323
332
  "is-loading": a.isLoadingMore,
324
333
  size: "small",
325
334
  position: "top"
326
335
  }, null, 8, ["is-loading"])
327
336
  ], 512), [
328
- [Ke, a.isLoadingMore]
337
+ [$e, a.isLoadingMore]
329
338
  ]),
330
339
  p(T, null, {
331
340
  default: D(() => [
332
- o(Me) && !a.isLoadingMore ? (i(), f(je, {
341
+ o(Me) && !a.isLoadingMore ? (i(), f(Pe, {
333
342
  key: 0,
334
343
  class: "message-feed__sticky-date",
335
- text: o(Re)
344
+ text: o(Se)
336
345
  }, null, 8, ["text"])) : c("", !0)
337
346
  ]),
338
347
  _: 1
339
348
  }),
340
- (i(!0), y(xe, null, Oe(o(se), (e, r, m, d) => {
341
- const k = [e.messageId, e.text, e.status, e.reply, e.deleted, o($)[o(h) + r], ie(e)];
342
- if (d && d.key === M(e, r) && $e(d, k)) return d;
343
- const I = (i(), y("div", {
349
+ (i(!0), y(Ne, null, Le(o(se), (e, r, m, d) => {
350
+ const k = [e.messageId, e.text, e.status, e.reply, e.deleted, o(N)[o(h) + r], ie(e)];
351
+ if (d && d.key === M(e, r) && Ue(d, k)) return d;
352
+ const R = (i(), y("div", {
344
353
  id: "msg-" + M(e, r),
345
354
  key: M(e, r),
346
355
  "data-timestamp": re(e),
347
356
  "data-testid": "feed-message",
348
357
  "data-message-id": e.messageId,
349
358
  class: "tracking-message",
350
- onDblclick: (z) => o(fe)(z, e)
359
+ onDblclick: (G) => o(fe)(G, e)
351
360
  }, [
352
- (i(), f(Ne(o(ee)(e)), Le({
361
+ (i(), f(je(o(ee)(e)), qe({
353
362
  key: M(e, r),
354
363
  class: "message-feed__message",
355
364
  message: e,
356
365
  "apply-style": a.applyStyle,
357
- "is-first-in-series": o($)[o(h) + r],
358
- "reactions-enabled": K.value,
366
+ "is-first-in-series": o(N)[o(h) + r],
367
+ "reactions-enabled": x.value,
359
368
  "reactions-mode": te.value,
360
- "current-user-id": x.value,
361
- "reaction-user-names": O.value,
369
+ "current-user-id": O.value,
370
+ "reaction-user-names": $.value,
362
371
  "subtext-tooltip-data": a.subtextTooltipData,
363
- channel: U(e)
372
+ channel: j(e)
364
373
  }, { ref_for: !0 }, le(e), {
365
374
  onAction: o(ue),
366
375
  onReply: o(me),
367
- onSmsInvite: (z) => pe(e),
376
+ onSmsInvite: (G) => pe(e),
368
377
  onRead: be
369
378
  }), 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"]))
370
379
  ], 40, ["id", "data-timestamp", "data-message-id", "onDblclick"]));
371
- return I.memo = k, I;
380
+ return R.memo = k, R;
372
381
  }, s, 0), 128)),
373
- a.typing ? (i(), f(We, {
382
+ a.typing ? (i(), f(He, {
374
383
  key: 0,
375
384
  message: {
376
385
  subText: a.typing.title,
@@ -379,7 +388,7 @@ const dt = {
379
388
  }, null, 8, ["message"])) : c("", !0),
380
389
  p(T, null, {
381
390
  default: D(() => [
382
- o(ke) ? (i(), f(Pe, {
391
+ o(ke) ? (i(), f(ze, {
383
392
  key: 0,
384
393
  ref_key: "keyboardRef",
385
394
  ref: w,
@@ -391,61 +400,61 @@ const dt = {
391
400
  ]),
392
401
  _: 1
393
402
  }),
394
- a.feedKeyboards && a.feedKeyboards.length > 0 ? (i(), f(Ve, {
403
+ a.feedKeyboards && a.feedKeyboards.length > 0 ? (i(), f(Ge, {
395
404
  key: 1,
396
405
  class: "message-feed__feed-keyboard",
397
406
  buttons: a.feedKeyboards,
398
407
  align: a.feedKeyboardAlign,
399
408
  onAction: o(he)
400
409
  }, null, 8, ["buttons", "align", "onAction"])) : c("", !0)
401
- ], 44, ct)) : (i(), y("div", {
410
+ ], 44, ft)) : (i(), y("div", {
402
411
  key: 1,
403
412
  ref_key: "refFeed",
404
413
  ref: u,
405
414
  class: "message-feed",
406
- style: H({ backgroundImage: `url(${P.value})` })
415
+ style: J({ backgroundImage: `url(${P.value})` })
407
416
  }, [
408
- C("div", mt, [
409
- J(t.$slots, "empty-feed", {}, void 0, !0)
417
+ C("div", yt, [
418
+ Q(t.$slots, "empty-feed", {}, void 0, !0)
410
419
  ])
411
420
  ], 4)),
412
421
  p(T, null, {
413
422
  default: D(() => [
414
- o(Y) ? (i(), y("button", {
423
+ o(K) ? (i(), y("button", {
415
424
  key: 0,
416
425
  class: "message-feed__button-down",
417
- onClick: Fe
426
+ onClick: De
418
427
  }, [
419
- a.buttonParams ? (i(), y("div", ft, Ue(a.buttonParams.unreadAmount), 1)) : c("", !0),
428
+ a.buttonParams ? (i(), y("div", pt, Ee(a.buttonParams.unreadAmount), 1)) : c("", !0),
420
429
  s[5] || (s[5] = C("span", { class: "pi pi-angle-down message-feed__icon-down" }, null, -1))
421
430
  ])) : c("", !0)
422
431
  ]),
423
432
  _: 1
424
433
  }),
425
- o(R)().reply ? (i(), f(Q, {
434
+ o(S)().reply ? (i(), f(X, {
426
435
  key: 2,
427
436
  to: "#chat-input-reply-line-" + o(b)
428
437
  }, [
429
- p(qe, {
438
+ p(Ve, {
430
439
  class: "chat-input-reply",
431
- message: o(R)().reply,
440
+ message: o(S)().reply,
432
441
  onReset: o(ge)
433
442
  }, null, 8, ["message", "onReset"])
434
443
  ], 8, ["to"])) : c("", !0),
435
- o(R)().edit ? (i(), f(Q, {
444
+ o(S)().edit ? (i(), f(X, {
436
445
  key: 3,
437
446
  to: "#chat-input-reply-line-" + o(b)
438
447
  }, [
439
- p(Ee, {
448
+ p(We, {
440
449
  class: "chat-input-reply",
441
- message: o(R)().edit,
450
+ message: o(S)().edit,
442
451
  onReset: o(ye)
443
452
  }, null, 8, ["message", "onReset"])
444
453
  ], 8, ["to"])) : c("", !0),
445
- K.value ? (i(), f(Ge, { key: 4 })) : c("", !0)
454
+ x.value ? (i(), f(Qe, { key: 4 })) : c("", !0)
446
455
  ]));
447
456
  }
448
457
  });
449
458
  export {
450
- qt as default
459
+ Vt as default
451
460
  };
@@ -1,34 +1,34 @@
1
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);
2
+ function q({ feedRef: i, objectsRef: l, scrollToBottomRef: B }) {
3
+ const a = S(!1), n = S(!1);
4
4
  let d = !1, u = !1, s = null, e = null;
5
5
  function c() {
6
- if (!i.value) return;
7
- const t = o.value;
6
+ if (!n.value) return;
7
+ const t = i.value;
8
8
  t && (d = !0, t.style.scrollBehavior = "auto", t.scrollTop = t.scrollHeight, requestAnimationFrame(() => {
9
9
  d = !1;
10
10
  }));
11
11
  }
12
12
  function g() {
13
- const t = o.value;
13
+ const t = i.value;
14
14
  if (!t) return;
15
- const n = t.scrollTop;
16
- t.style.scrollBehavior = "auto", t.scrollTop = n;
15
+ const o = t.scrollTop;
16
+ t.style.scrollBehavior = "auto", t.scrollTop = o;
17
17
  }
18
18
  function m() {
19
- i.value = !0, h(() => {
19
+ n.value = !0, h(() => {
20
20
  c(), requestAnimationFrame(() => c());
21
21
  });
22
22
  }
23
23
  function r() {
24
- i.value && (i.value = !1, g());
24
+ n.value && (n.value = !1, g());
25
25
  }
26
26
  function p(t) {
27
27
  e == null || e.disconnect(), e = new ResizeObserver(() => {
28
28
  c();
29
29
  }), e.observe(t);
30
- for (const n of t.children)
31
- n instanceof HTMLElement && e.observe(n);
30
+ for (const o of t.children)
31
+ o instanceof HTMLElement && e.observe(o);
32
32
  }
33
33
  function w() {
34
34
  u = !0;
@@ -52,22 +52,22 @@ function q({ feedRef: o, objectsRef: l, scrollToBottomRef: B }) {
52
52
  !a.value && l.value.length > 0 && (m(), a.value = !0);
53
53
  }
54
54
  function P() {
55
- i.value = !0, h(() => {
56
- const t = o.value;
55
+ n.value = !0, h(() => {
56
+ const t = i.value;
57
57
  t && t.scrollTo({ top: t.scrollHeight, behavior: "smooth" });
58
58
  });
59
59
  }
60
60
  return f(
61
- o,
62
- (t, n) => {
63
- n && E(n), s = t ?? null, t && (k(t), p(t), i.value && c());
61
+ i,
62
+ (t, o) => {
63
+ o && E(o), s = t ?? null, t && (k(t), p(t), n.value && c());
64
64
  },
65
65
  { immediate: !0 }
66
66
  ), f(
67
67
  l,
68
68
  () => {
69
69
  h(() => {
70
- o.value && p(o.value);
70
+ i.value && p(i.value);
71
71
  });
72
72
  }
73
73
  ), f(
@@ -86,6 +86,8 @@ function q({ feedRef: o, objectsRef: l, scrollToBottomRef: B }) {
86
86
  e == null || e.disconnect(), e = null, s && (E(s), s = null);
87
87
  }), {
88
88
  isInitialized: a,
89
+ /** true, пока лента прижата вниз (автоскролл при новых сообщениях) */
90
+ stickToBottom: n,
89
91
  performScrollToBottom: F,
90
92
  initializeScroll: T,
91
93
  smoothScrollToBottom: P
@@ -166,6 +166,7 @@ export declare const chats: ({
166
166
  lastMessage: {
167
167
  type: string;
168
168
  data?: undefined;
169
+ deleted?: undefined;
169
170
  };
170
171
  'lastMessage.status': string;
171
172
  'lastActivity.time': string;
@@ -198,6 +199,7 @@ export declare const chats: ({
198
199
  filename: string;
199
200
  isVoiceMessage?: undefined;
200
201
  };
202
+ deleted?: undefined;
201
203
  };
202
204
  'lastMessage.status': string;
203
205
  'lastActivity.time': string;
@@ -254,6 +256,7 @@ export declare const chats: ({
254
256
  filename: string;
255
257
  isVoiceMessage?: undefined;
256
258
  };
259
+ deleted?: undefined;
257
260
  };
258
261
  'lastActivity.time': string;
259
262
  'lastActivity.timestamp': string;
@@ -305,10 +308,11 @@ export declare const chats: ({
305
308
  countUnread: number;
306
309
  lastMessage: {
307
310
  type: string;
311
+ deleted: boolean;
308
312
  data: {
309
313
  text: string;
310
- url: string;
311
- filename: string;
314
+ url?: undefined;
315
+ filename?: undefined;
312
316
  isVoiceMessage?: undefined;
313
317
  };
314
318
  };
@@ -393,6 +397,7 @@ export declare const chats: ({
393
397
  filename: string;
394
398
  isVoiceMessage?: undefined;
395
399
  };
400
+ deleted?: undefined;
396
401
  };
397
402
  'lastActivity.time': string;
398
403
  'lastActivity.timestamp': string;
@@ -425,6 +430,7 @@ export declare const chats: ({
425
430
  text?: undefined;
426
431
  isVoiceMessage?: undefined;
427
432
  };
433
+ deleted?: undefined;
428
434
  };
429
435
  'lastMessage.status': string;
430
436
  'lastActivity.time': string;
@@ -457,6 +463,7 @@ export declare const chats: ({
457
463
  isVoiceMessage: boolean;
458
464
  text?: undefined;
459
465
  };
466
+ deleted?: undefined;
460
467
  };
461
468
  'lastMessage.status': string;
462
469
  'lastActivity.time': string;
@@ -15,6 +15,7 @@ export declare const ChatItemWithAvatar: Story;
15
15
  export declare const ChatItemVerified: Story;
16
16
  export declare const ChatItemWithUnread: Story;
17
17
  export declare const ChatItemWithLongLastMessage: Story;
18
+ export declare const ChatItemWithDeletedLastMessage: Story;
18
19
  export declare const ChatItemSelected: Story;
19
20
  export declare const ChatItemWithActions: Story;
20
21
  export declare const ChatItemWithStatusOnline: Story;
@@ -29,6 +29,8 @@ export interface ILastMessageObject {
29
29
  channelId?: string;
30
30
  senderId?: string;
31
31
  type?: string;
32
+ /** Сообщение удалено — в lastMessage показываем tombstone независимо от type */
33
+ deleted?: boolean;
32
34
  isVoiceMessage?: boolean;
33
35
  data?: {
34
36
  text?: string;
@@ -17,6 +17,8 @@ interface UseFeedScrollOptions<T = unknown> {
17
17
  }
18
18
  export declare function useFeedScroll<T = unknown>({ feedRef, objectsRef, scrollToBottomRef }: UseFeedScrollOptions<T>): {
19
19
  isInitialized: Ref<boolean, boolean>;
20
+ /** true, пока лента прижата вниз (автоскролл при новых сообщениях) */
21
+ stickToBottom: Ref<boolean, boolean>;
20
22
  performScrollToBottom: () => void;
21
23
  initializeScroll: () => void;
22
24
  smoothScrollToBottom: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mobilon-dev/chotto",
3
- "version": "0.3.120",
3
+ "version": "0.3.123",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",