@mobilon-dev/chotto 0.3.106 → 0.3.107

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 +2 -2
  3. package/dist/components/2_feed_elements/AudioMessage/AudioMessage.vue2.js +295 -268
  4. package/dist/components/2_feed_elements/FileMessage/FileMessage.vue.js +2 -2
  5. package/dist/components/2_feed_elements/FileMessage/FileMessage.vue2.js +185 -158
  6. package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue.js +3 -3
  7. package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue2.js +227 -200
  8. package/dist/components/2_feed_elements/MessageReactions/MessageReactions.vue.js +2 -2
  9. package/dist/components/2_feed_elements/MessageReactions/MessageReactions.vue2.js +62 -245
  10. package/dist/components/2_feed_elements/MessageReactions/MessageReactionsOverlay.vue.js +7 -0
  11. package/dist/components/2_feed_elements/MessageReactions/MessageReactionsOverlay.vue2.js +231 -0
  12. package/dist/components/2_feed_elements/MessageReactions/composables/usePositioning.js +25 -25
  13. package/dist/components/2_feed_elements/StickerMessage/StickerMessage.vue.js +2 -2
  14. package/dist/components/2_feed_elements/StickerMessage/StickerMessage.vue2.js +209 -182
  15. package/dist/components/2_feed_elements/TextMessage/TextMessage.vue.js +2 -2
  16. package/dist/components/2_feed_elements/TextMessage/TextMessage.vue2.js +190 -164
  17. package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue.js +3 -3
  18. package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue2.js +208 -181
  19. package/dist/components/3_compounds/Feed/Feed.vue.js +1 -1
  20. package/dist/components/3_compounds/Feed/Feed.vue2.js +207 -197
  21. package/dist/components/3_compounds/Feed/composables/useFeedProgressiveRender.js +52 -49
  22. package/dist/components/3_compounds/Feed/composables/useFeedReactionsOverlay.js +34 -0
  23. package/dist/hooks/messages/useMessageActions.js +81 -70
  24. package/dist/hooks/messages/useMessageReactionsInFeed.js +53 -0
  25. package/dist/hooks/messages/useMessageReactionsMount.js +21 -0
  26. package/dist/index.js +149 -144
  27. package/dist/types/components/2_feed_elements/MessageReactions/MessageReactions.vue.d.ts +4 -71
  28. package/dist/types/components/2_feed_elements/MessageReactions/MessageReactionsOverlay.vue.d.ts +2 -0
  29. package/dist/types/components/2_feed_elements/MessageReactions/composables/usePositioning.d.ts +2 -1
  30. package/dist/types/components/3_compounds/Feed/composables/index.d.ts +1 -0
  31. package/dist/types/components/3_compounds/Feed/composables/useFeedReactionsOverlay.d.ts +52 -0
  32. package/dist/types/hooks/messages/index.d.ts +2 -0
  33. package/dist/types/hooks/messages/useMessageReactionsInFeed.d.ts +25 -0
  34. package/dist/types/hooks/messages/useMessageReactionsMount.d.ts +10 -0
  35. package/package.json +1 -1
@@ -1,79 +1,82 @@
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) ?? "";
1
+ import { ref as C, computed as H, watch as I, nextTick as B, onUnmounted as K } from "vue";
2
+ const M = 28, d = 24;
3
+ function F(u, n) {
4
+ var l;
5
+ return ((l = u[n]) == null ? void 0 : l.messageId) ?? "";
6
6
  }
7
- function _({
8
- objectsRef: a,
9
- feedRef: s
7
+ function b({
8
+ objectsRef: u,
9
+ feedRef: n
10
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);
11
+ const l = C(0);
12
+ let v = "", p = "", i = 0, h = 0, a = 0;
13
+ const k = H(() => u.value.slice(l.value)), A = H(() => l.value > 0);
14
+ function g() {
15
+ h += 1, a && (cancelAnimationFrame(a), a = 0);
16
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;
17
+ function T(e, o, t) {
18
+ const r = n.value;
19
+ if (!r) return;
20
+ const c = r.style.scrollBehavior;
21
+ r.style.scrollBehavior = "auto", t ? r.scrollTop = r.scrollHeight : r.scrollTop = o + (r.scrollHeight - e), requestAnimationFrame(() => {
22
+ r.style.scrollBehavior = c;
23
23
  });
24
24
  }
25
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));
26
+ const e = ++h, o = () => {
27
+ if (a = 0, e !== h || l.value <= 0) return;
28
+ const t = n.value, r = (t == null ? void 0 : t.scrollHeight) ?? 0, c = (t == null ? void 0 : t.scrollTop) ?? 0, m = t ? t.scrollHeight - t.scrollTop - t.clientHeight < 140 : !0;
29
+ l.value = Math.max(0, l.value - d), B(() => {
30
+ T(r, c, m), e === h && l.value > 0 && (a = requestAnimationFrame(o));
31
31
  });
32
32
  };
33
- i = requestAnimationFrame(o);
33
+ a = requestAnimationFrame(o);
34
34
  }
35
- function T(e) {
36
- t.value = Math.max(0, e - K), t.value > 0 && f();
35
+ function y(e) {
36
+ l.value = Math.max(0, e - M), l.value > 0 && f();
37
37
  }
38
38
  function E(e) {
39
39
  if (e < 0) return;
40
40
  const o = Math.max(0, e - 8);
41
- o < t.value && (t.value = o, t.value > 0 && f());
41
+ o < l.value && (l.value = o, l.value > 0 && f());
42
42
  }
43
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();
44
+ if (l.value <= 0) return;
45
+ const e = n.value, o = (e == null ? void 0 : e.scrollHeight) ?? 0, t = (e == null ? void 0 : e.scrollTop) ?? 0, r = e ? e.scrollHeight - e.scrollTop - e.clientHeight < 140 : !1;
46
+ l.value = Math.max(0, l.value - d * 2), B(() => {
47
+ T(o, t, r), l.value > 0 && f();
48
48
  });
49
49
  }
50
- return C(
51
- () => a.value,
50
+ return I(
51
+ () => u.value,
52
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;
53
+ const o = F(e, 0), t = F(e, e.length - 1), r = i > 0 && e.length > i && t === p && o !== v, c = i > 0 && e.length > i && o === v, m = o === v && t === p && e.length === i;
54
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);
55
+ g(), l.value = 0;
56
+ else if (!m) if (r) {
57
+ const s = e.length - i;
58
+ l.value > 0 && (l.value += s, f());
59
+ } else c || (g(), y(e.length), B(() => {
60
+ const s = n.value;
61
+ if (!s) return;
62
+ const q = s.style.scrollBehavior;
63
+ s.style.scrollBehavior = "auto", s.scrollTop = s.scrollHeight, requestAnimationFrame(() => {
64
+ s.scrollTop = s.scrollHeight, s.style.scrollBehavior = q;
62
65
  });
63
- })));
64
- u = o, g = l, r = e.length;
66
+ }));
67
+ v = o, p = t, i = e.length;
65
68
  },
66
69
  { immediate: !0 }
67
- ), I(h), {
70
+ ), K(g), {
68
71
  visibleObjects: k,
69
- renderStart: t,
72
+ renderStart: l,
70
73
  isBackfilling: A,
71
74
  revealThroughIndex: E,
72
75
  accelerateBackfill: L
73
76
  };
74
77
  }
75
78
  export {
76
- B as FEED_BACKFILL_CHUNK,
77
- K as FEED_TAIL_CHUNK,
78
- _ as useFeedProgressiveRender
79
+ d as FEED_BACKFILL_CHUNK,
80
+ M as FEED_TAIL_CHUNK,
81
+ b as useFeedProgressiveRender
79
82
  };
@@ -0,0 +1,34 @@
1
+ import { shallowRef as l, computed as v, provide as s, inject as i } from "vue";
2
+ const c = Symbol("feedReactionsConsumer"), f = Symbol("feedReactionsState");
3
+ let e = null;
4
+ function d(n) {
5
+ e = n;
6
+ }
7
+ function S() {
8
+ const n = l(null), u = v(() => {
9
+ var o;
10
+ return ((o = n.value) == null ? void 0 : o.anchorEl) ?? null;
11
+ });
12
+ return s(c, {
13
+ activate(o) {
14
+ n.value = o, e == null || e.onMessageEnter();
15
+ },
16
+ handlePointerLeave(o, t, r) {
17
+ if (!n.value || n.value.anchorEl !== t) return;
18
+ const a = o.relatedTarget;
19
+ a instanceof Node && (t != null && t.contains(a) || r != null && r.contains(a) || e != null && e.containsNode(a)) || (e == null || e.onMessageLeave(), e != null && e.isPanelOpen() || (n.value = null));
20
+ }
21
+ }), s(f, { activeTarget: n, anchorRef: u }), { activeTarget: n, anchorRef: u };
22
+ }
23
+ function F() {
24
+ return i(c, null);
25
+ }
26
+ function O() {
27
+ return i(f, null);
28
+ }
29
+ export {
30
+ S as provideFeedReactionsOverlay,
31
+ d as registerFeedReactionsPanelBridge,
32
+ F as useFeedReactionsConsumer,
33
+ O as useFeedReactionsOverlayState
34
+ };
@@ -1,103 +1,114 @@
1
- import { ref as u, inject as L, computed as C, watch as P, onMounted as H, onUnmounted as x, nextTick as O } from "vue";
1
+ import { ref as u, inject as P, computed as x, watch as z, onMounted as D, onUnmounted as O, nextTick as S } from "vue";
2
2
  import { useConfirmDeleteMessage as j } from "../modals/useConfirmDeleteMessage.js";
3
3
  import { useTheme as B } from "../useTheme.js";
4
- import { calculateMessageMenuPosition as D } from "./calculateMessageMenuPosition.js";
5
- function m(t) {
6
- if (!t) return null;
7
- if (t instanceof HTMLElement) return t;
8
- const o = t.$el;
9
- return o instanceof HTMLElement ? o : null;
4
+ import { calculateMessageMenuPosition as U } from "./calculateMessageMenuPosition.js";
5
+ function g(e) {
6
+ if (!e) return null;
7
+ if (e instanceof HTMLElement) return e;
8
+ const n = e.$el;
9
+ return n instanceof HTMLElement ? n : null;
10
10
  }
11
- function M(t) {
12
- if (!t) return null;
13
- if (t instanceof Event) {
14
- const o = t.currentTarget;
15
- if (o instanceof HTMLElement) {
16
- const n = o.getBoundingClientRect();
17
- return { top: n.top, right: n.right, bottom: n.bottom, left: n.left, width: n.width, height: n.height };
11
+ const f = /* @__PURE__ */ new Set();
12
+ function w(e) {
13
+ for (const n of f)
14
+ n(e);
15
+ }
16
+ function V(e) {
17
+ return f.size === 0 && document.addEventListener("click", w, !0), f.add(e), () => {
18
+ f.delete(e), f.size === 0 && document.removeEventListener("click", w, !0);
19
+ };
20
+ }
21
+ function T(e) {
22
+ if (!e) return null;
23
+ if (e instanceof Event) {
24
+ const n = e.currentTarget;
25
+ if (n instanceof HTMLElement) {
26
+ const i = n.getBoundingClientRect();
27
+ return { top: i.top, right: i.right, bottom: i.bottom, left: i.left, width: i.width, height: i.height };
18
28
  }
19
29
  return null;
20
30
  }
21
- return "triggerRect" in t && t.triggerRect ? t.triggerRect : "event" in t && t.event instanceof Event ? M(t.event) : "top" in t && "left" in t && "bottom" in t && "right" in t ? t : null;
31
+ return "triggerRect" in e && e.triggerRect ? e.triggerRect : "event" in e && e.event instanceof Event ? T(e.event) : "top" in e && "left" in e && "bottom" in e && "right" in e ? e : null;
22
32
  }
23
- const F = (t, o, n = {}) => {
24
- const r = u(!1), a = u(!1), d = u(null), c = u(null), g = u({}), f = u(null), w = L("chatAppId", void 0), { getTheme: T } = B(w || ""), R = C(() => T().theme || "light"), y = () => {
25
- a.value = !0;
26
- }, E = (e) => {
27
- const i = m(c.value);
28
- e != null && e.relatedTarget && (i != null && i.contains(e.relatedTarget)) || (a.value = !1);
33
+ const N = (e, n, i = {}) => {
34
+ const r = u(!1), c = u(!1), h = u(null), a = u(null), v = u({}), d = u(null), R = P("chatAppId", void 0), { getTheme: k } = B(R || ""), y = x(() => k().theme || "light"), E = () => {
35
+ c.value = !0;
36
+ }, A = (t) => {
37
+ const o = g(a.value);
38
+ t != null && t.relatedTarget && (o != null && o.contains(t.relatedTarget)) || (c.value = !1);
29
39
  }, s = () => {
30
- a.value = !1, r.value = !1, f.value = null;
31
- }, k = () => {
32
- a.value = !0;
33
- }, A = () => {
40
+ c.value = !1, r.value = !1, d.value = null;
41
+ }, C = () => {
42
+ c.value = !0;
43
+ }, b = () => {
34
44
  s();
35
- }, h = (e) => {
36
- f.value = M(e), r.value = !0;
37
- }, b = (e) => {
45
+ }, M = (t) => {
46
+ d.value = T(t), r.value = !0;
47
+ }, I = (t) => {
38
48
  if (r.value) {
39
49
  s();
40
50
  return;
41
51
  }
42
- h(e);
52
+ M(t);
43
53
  };
44
- async function I() {
45
- await O();
46
- let e = 0;
47
- for (; !m(c.value) && e < 20; )
48
- await new Promise((l) => setTimeout(l, 10)), e++;
49
- const i = m(c.value);
50
- for (e = 0; i && i.offsetWidth === 0 && e < 10; )
51
- await new Promise((l) => setTimeout(l, 10)), e++;
52
- g.value = await D(i, {
53
- triggerRect: f.value,
54
- boundsElement: d.value
54
+ async function L() {
55
+ await S();
56
+ let t = 0;
57
+ for (; !g(a.value) && t < 20; )
58
+ await new Promise((l) => setTimeout(l, 10)), t++;
59
+ const o = g(a.value);
60
+ for (t = 0; o && o.offsetWidth === 0 && t < 10; )
61
+ await new Promise((l) => setTimeout(l, 10)), t++;
62
+ v.value = await U(o, {
63
+ triggerRect: d.value,
64
+ boundsElement: h.value
55
65
  });
56
66
  }
57
- P(r, async (e) => {
58
- e ? await I() : (g.value = {}, f.value = null);
67
+ z(r, async (t) => {
68
+ t ? await L() : (v.value = {}, d.value = null);
59
69
  });
60
- function p(e) {
70
+ function H(t) {
61
71
  if (!r.value) return;
62
- const i = e.target, l = m(c.value), v = d.value;
63
- l != null && l.contains(i) || v != null && v.contains(i) || s();
72
+ const o = t.target, l = g(a.value), p = h.value;
73
+ l != null && l.contains(o) || p != null && p.contains(o) || s();
64
74
  }
65
- return H(() => {
66
- document.addEventListener("click", p, !0);
67
- }), x(() => {
68
- document.removeEventListener("click", p, !0);
75
+ let m;
76
+ return D(() => {
77
+ m = V(H);
78
+ }), O(() => {
79
+ m == null || m();
69
80
  }), {
70
81
  isOpenMenu: r,
71
- buttonMenuVisible: a,
72
- menuAnchorRef: d,
73
- menuRef: c,
74
- menuStyle: g,
75
- menuTheme: R,
76
- showMenu: y,
77
- hideMenu: E,
78
- openMenu: h,
79
- toggleMenu: b,
80
- onMenuMouseEnter: k,
81
- onMenuMouseLeave: A,
82
- clickAction: async (e) => {
83
- if (s(), e.action === "reply" && n.onReply) {
84
- n.onReply();
82
+ buttonMenuVisible: c,
83
+ menuAnchorRef: h,
84
+ menuRef: a,
85
+ menuStyle: v,
86
+ menuTheme: y,
87
+ showMenu: E,
88
+ hideMenu: A,
89
+ openMenu: M,
90
+ toggleMenu: I,
91
+ onMenuMouseEnter: C,
92
+ onMenuMouseLeave: b,
93
+ clickAction: async (t) => {
94
+ if (s(), t.action === "reply" && i.onReply) {
95
+ i.onReply();
85
96
  return;
86
97
  }
87
- if (e.action === "edit" && n.onEdit) {
88
- n.onEdit();
98
+ if (t.action === "edit" && i.onEdit) {
99
+ i.onEdit();
89
100
  return;
90
101
  }
91
- e.action === "delete" && !await j() || o("action", { messageId: t.messageId, type: "menu", ...e });
102
+ t.action === "delete" && !await j() || n("action", { messageId: e.messageId, type: "menu", ...t });
92
103
  },
93
104
  viewsAction: () => {
94
- s(), o("action", { messageId: t.messageId, type: "views" });
105
+ s(), n("action", { messageId: e.messageId, type: "views" });
95
106
  },
96
- handleClickReplied: (e) => {
97
- o("reply", e);
107
+ handleClickReplied: (t) => {
108
+ n("reply", t);
98
109
  }
99
110
  };
100
111
  };
101
112
  export {
102
- F as useMessageActions
113
+ N as useMessageActions
103
114
  };
@@ -0,0 +1,53 @@
1
+ import { provide as l, toValue as t } from "vue";
2
+ import { useFeedReactionsConsumer as m } from "../../components/3_compounds/Feed/composables/useFeedReactionsOverlay.js";
3
+ import { useMessageReactionsMount as d } from "./useMessageReactionsMount.js";
4
+ const f = Symbol(
5
+ "messageReactionsPatch"
6
+ );
7
+ function E(e) {
8
+ const { showReactions: s, engageReactionsMount: o } = d(
9
+ e.reactions,
10
+ e.reactionsActive
11
+ ), c = m();
12
+ function r(a) {
13
+ const n = t(e.message);
14
+ n.reactions = a;
15
+ }
16
+ l(f, r);
17
+ function u() {
18
+ var n;
19
+ if (!t(e.reactionsActive)) return;
20
+ o();
21
+ const a = e.contentRef.value;
22
+ !a || !c || c.activate({
23
+ messageId: t(e.messageId),
24
+ anchorEl: a,
25
+ chipsEl: ((n = e.chipsRef) == null ? void 0 : n.value) ?? null,
26
+ reactions: t(e.reactions),
27
+ reply: t(e.reply),
28
+ replyEnabled: !0,
29
+ menuEnabled: t(e.menuEnabled),
30
+ mode: t(e.reactionsMode),
31
+ enabled: !0,
32
+ handlers: e.handlers,
33
+ patchReactions: r
34
+ });
35
+ }
36
+ function i(a) {
37
+ var n;
38
+ c == null || c.handlePointerLeave(
39
+ a,
40
+ e.contentRef.value,
41
+ ((n = e.chipsRef) == null ? void 0 : n.value) ?? void 0
42
+ );
43
+ }
44
+ return {
45
+ showReactions: s,
46
+ onContentPointerEnter: u,
47
+ onContentPointerLeave: i
48
+ };
49
+ }
50
+ export {
51
+ f as MESSAGE_REACTIONS_PATCH_KEY,
52
+ E as useMessageReactionsInFeed
53
+ };
@@ -0,0 +1,21 @@
1
+ import { ref as g, computed as s, toValue as a } from "vue";
2
+ function m(r, u) {
3
+ const e = g(!1), t = s(() => {
4
+ var o;
5
+ const n = (o = a(r)) == null ? void 0 : o.items;
6
+ return Array.isArray(n) && n.length > 0;
7
+ }), c = s(
8
+ () => a(u) && (t.value || e.value)
9
+ );
10
+ function i() {
11
+ e.value = !0;
12
+ }
13
+ return {
14
+ showReactions: c,
15
+ engageReactionsMount: i,
16
+ hasReactionItems: t
17
+ };
18
+ }
19
+ export {
20
+ m as useMessageReactionsMount
21
+ };