@mobilon-dev/chotto 0.3.104 → 0.3.106

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/2_feed_elements/AudioMessage/AudioMessage.vue.js +1 -1
  3. package/dist/components/2_feed_elements/AudioMessage/AudioMessage.vue2.js +171 -167
  4. package/dist/components/2_feed_elements/FeedReplyQuote/FeedReplyQuote.vue.js +7 -0
  5. package/dist/components/2_feed_elements/FeedReplyQuote/FeedReplyQuote.vue2.js +73 -0
  6. package/dist/components/2_feed_elements/FileMessage/FileMessage.vue.js +3 -3
  7. package/dist/components/2_feed_elements/FileMessage/FileMessage.vue2.js +112 -108
  8. package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue.js +3 -3
  9. package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue2.js +133 -128
  10. package/dist/components/2_feed_elements/StickerMessage/StickerMessage.vue.js +3 -3
  11. package/dist/components/2_feed_elements/StickerMessage/StickerMessage.vue2.js +131 -126
  12. package/dist/components/2_feed_elements/TextMessage/TextMessage.vue.js +1 -1
  13. package/dist/components/2_feed_elements/TextMessage/TextMessage.vue2.js +149 -145
  14. package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue.js +2 -2
  15. package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue2.js +131 -126
  16. package/dist/components/3_compounds/Feed/Feed.vue.js +2 -2
  17. package/dist/components/3_compounds/Feed/Feed.vue2.js +249 -207
  18. package/dist/components/3_compounds/Feed/composables/useFeedGrouping.js +23 -20
  19. package/dist/components/3_compounds/Feed/composables/useFeedProgressiveRender.js +79 -0
  20. package/dist/components/3_compounds/Feed/composables/useFeedReply.js +10 -10
  21. package/dist/functions/isSmsChannel.js +19 -0
  22. package/dist/hooks/messages/useMessageHoverActions.js +13 -0
  23. package/dist/index.js +225 -218
  24. package/dist/types/components/2_feed_elements/FeedReplyQuote/FeedReplyQuote.vue.d.ts +19 -0
  25. package/dist/types/components/3_compounds/Feed/Feed.vue.d.ts +6 -0
  26. package/dist/types/components/3_compounds/Feed/composables/index.d.ts +1 -0
  27. package/dist/types/components/3_compounds/Feed/composables/useFeedGrouping.d.ts +3 -22
  28. package/dist/types/components/3_compounds/Feed/composables/useFeedProgressiveRender.d.ts +22 -0
  29. package/dist/types/components/3_compounds/Feed/composables/useFeedReply.d.ts +2 -1
  30. package/dist/types/components/index.d.ts +1 -0
  31. package/dist/types/functions/index.d.ts +1 -0
  32. package/dist/types/functions/isSmsChannel.d.ts +8 -0
  33. package/dist/types/hooks/messages/index.d.ts +1 -0
  34. package/dist/types/hooks/messages/useMessageHoverActions.d.ts +9 -0
  35. package/package.json +1 -1
@@ -0,0 +1,79 @@
1
+ import { ref as y, computed as H, watch as C, onUnmounted as I, nextTick as p } from "vue";
2
+ const K = 28, B = 24;
3
+ function F(a, s) {
4
+ var t;
5
+ return ((t = a[s]) == null ? void 0 : t.messageId) ?? "";
6
+ }
7
+ function _({
8
+ objectsRef: a,
9
+ feedRef: s
10
+ }) {
11
+ const t = y(0);
12
+ let u = "", g = "", r = 0, v = 0, i = 0;
13
+ const k = H(() => a.value.slice(t.value)), A = H(() => t.value > 0);
14
+ function h() {
15
+ v += 1, i && (cancelAnimationFrame(i), i = 0);
16
+ }
17
+ function d(e, o, l) {
18
+ const n = s.value;
19
+ if (!n) return;
20
+ const c = n.style.scrollBehavior;
21
+ n.style.scrollBehavior = "auto", l ? n.scrollTop = n.scrollHeight : n.scrollTop = o + (n.scrollHeight - e), requestAnimationFrame(() => {
22
+ n.style.scrollBehavior = c;
23
+ });
24
+ }
25
+ function f() {
26
+ const e = ++v, o = () => {
27
+ if (i = 0, e !== v || t.value <= 0) return;
28
+ const l = s.value, n = (l == null ? void 0 : l.scrollHeight) ?? 0, c = (l == null ? void 0 : l.scrollTop) ?? 0, m = l ? l.scrollHeight - l.scrollTop - l.clientHeight < 140 : !0;
29
+ t.value = Math.max(0, t.value - B), p(() => {
30
+ d(n, c, m), e === v && t.value > 0 && (i = requestAnimationFrame(o));
31
+ });
32
+ };
33
+ i = requestAnimationFrame(o);
34
+ }
35
+ function T(e) {
36
+ t.value = Math.max(0, e - K), t.value > 0 && f();
37
+ }
38
+ function E(e) {
39
+ if (e < 0) return;
40
+ const o = Math.max(0, e - 8);
41
+ o < t.value && (t.value = o, t.value > 0 && f());
42
+ }
43
+ function L() {
44
+ if (t.value <= 0) return;
45
+ const e = s.value, o = (e == null ? void 0 : e.scrollHeight) ?? 0, l = (e == null ? void 0 : e.scrollTop) ?? 0, n = e ? e.scrollHeight - e.scrollTop - e.clientHeight < 140 : !1;
46
+ t.value = Math.max(0, t.value - B * 2), p(() => {
47
+ d(o, l, n), t.value > 0 && f();
48
+ });
49
+ }
50
+ return C(
51
+ () => a.value,
52
+ (e) => {
53
+ const o = F(e, 0), l = F(e, e.length - 1), n = r > 0 && e.length > r && l === g && o !== u, c = r > 0 && e.length > r && o === u, m = o === u && l === g && e.length === r;
54
+ if (e.length === 0)
55
+ h(), t.value = 0;
56
+ else if (!m) if (n) {
57
+ const q = e.length - r;
58
+ t.value > 0 && (t.value += q, f());
59
+ } else c || (r === 0 ? (h(), T(e.length)) : (h(), t.value = e.length, p(() => {
60
+ requestAnimationFrame(() => {
61
+ T(a.value.length);
62
+ });
63
+ })));
64
+ u = o, g = l, r = e.length;
65
+ },
66
+ { immediate: !0 }
67
+ ), I(h), {
68
+ visibleObjects: k,
69
+ renderStart: t,
70
+ isBackfilling: A,
71
+ revealThroughIndex: E,
72
+ accelerateBackfill: L
73
+ };
74
+ }
75
+ export {
76
+ B as FEED_BACKFILL_CHUNK,
77
+ K as FEED_TAIL_CHUNK,
78
+ _ as useFeedProgressiveRender
79
+ };
@@ -1,5 +1,5 @@
1
- import { inject as m } from "vue";
2
- import { useMessageDraft as c } from "../../../../hooks/useMessageDraft.js";
1
+ import { inject as c } from "vue";
2
+ import { useMessageDraft as f } from "../../../../hooks/useMessageDraft.js";
3
3
  import "../../../../hooks/useSearchModel.js";
4
4
  import "../../../../hooks/useTheme.js";
5
5
  import "../../../../hooks/useEmojiNative.js";
@@ -10,9 +10,9 @@ import "../../../../locale/useLocale.js";
10
10
  import "../../../../node_modules/linkifyjs/dist/linkify.js";
11
11
  import "../../../../node_modules/linkify-string/dist/linkify-string.js";
12
12
  import "../../../../functions/parseMarkdown.js";
13
- import { useStartReply as f, hideReplyPreview as p } from "../../../../hooks/messages/useStartReply.js";
14
- function T({ enableDoubleClickReply: r, emit: s }) {
15
- const i = m("chatAppId"), { getMessage: l, resetReply: a, resetEdit: n, setMessageText: o } = c(i), { startReply: d } = f(i);
13
+ import { useStartReply as u, hideReplyPreview as p } from "../../../../hooks/messages/useStartReply.js";
14
+ function w({ enableDoubleClickReply: a, emit: s, isReplyAllowed: r }) {
15
+ const i = c("chatAppId"), { getMessage: l, resetReply: n, resetEdit: d, setMessageText: m } = f(i), { startReply: o } = u(i);
16
16
  return {
17
17
  getMessage: l,
18
18
  messageAction: (t) => {
@@ -22,7 +22,7 @@ function T({ enableDoubleClickReply: r, emit: s }) {
22
22
  s("clickRepliedMessage", t);
23
23
  },
24
24
  feedObjectDoubleClick: (t, e) => {
25
- r && (t == null || t.preventDefault(), e.type.indexOf("system") === -1 && e.type.indexOf("typing") === -1 && d({
25
+ a && (r && !r(e) || (t == null || t.preventDefault(), e.type.indexOf("system") === -1 && e.type.indexOf("typing") === -1 && o({
26
26
  messageId: e.messageId,
27
27
  type: e.type,
28
28
  text: e.text,
@@ -30,16 +30,16 @@ function T({ enableDoubleClickReply: r, emit: s }) {
30
30
  url: e.url,
31
31
  header: e.header,
32
32
  callDuration: e.callDuration
33
- }));
33
+ })));
34
34
  },
35
35
  handleResetReply: () => {
36
- a(), p(i);
36
+ n(), p(i);
37
37
  },
38
38
  handleResetEdit: () => {
39
- n(), o(""), p(i);
39
+ d(), m(""), p(i);
40
40
  }
41
41
  };
42
42
  }
43
43
  export {
44
- T as useFeedReply
44
+ w as useFeedReply
45
45
  };
@@ -0,0 +1,19 @@
1
+ function c(t) {
2
+ const r = t == null ? void 0 : t.toLowerCase().trim();
3
+ return r ? r.split(".")[0] === "sms" : !1;
4
+ }
5
+ function l(t) {
6
+ var r, n, i, o;
7
+ return String(
8
+ ((r = t == null ? void 0 : t.meta) == null ? void 0 : r.messageStyle) ?? (t == null ? void 0 : t.messageStyle) ?? ((n = t == null ? void 0 : t.channel) == null ? void 0 : n.serviceType) ?? ((i = t == null ? void 0 : t.channel) == null ? void 0 : i.type) ?? ((o = t == null ? void 0 : t.meta) == null ? void 0 : o.serviceType) ?? ""
9
+ ).toLowerCase().trim();
10
+ }
11
+ function u(t, r) {
12
+ var i, o;
13
+ const n = t;
14
+ return l(n) === "sms" ? !0 : c(r) || c(n == null ? void 0 : n.channelId) || c((i = n == null ? void 0 : n.channel) == null ? void 0 : i.channelId) || c((o = n == null ? void 0 : n.meta) == null ? void 0 : o.channelId);
15
+ }
16
+ export {
17
+ c as isSmsChannel,
18
+ u as isSmsFeedMessage
19
+ };
@@ -0,0 +1,13 @@
1
+ import { computed as t, toValue as e } from "vue";
2
+ import { isSmsFeedMessage as c } from "../../functions/isSmsChannel.js";
3
+ function m(s, r = !0, i = void 0) {
4
+ const o = t(
5
+ () => !c(e(i), e(s))
6
+ ), n = t(
7
+ () => e(r) && o.value
8
+ );
9
+ return { hoverActionsEnabled: o, reactionsActive: n };
10
+ }
11
+ export {
12
+ m as useMessageHoverActions
13
+ };