@mobilon-dev/chotto 0.3.88 → 0.3.89

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,18 +1,43 @@
1
- import { watch as m } from "vue";
2
- function d({ targetIdRef: l, feedContainerId: s, focusClass: n = "focused-message" }) {
3
- m(
4
- () => l.value,
5
- (o) => {
6
- var c;
7
- if (!o) return;
8
- const e = document.getElementById(o), t = document.getElementById(s);
9
- e instanceof HTMLElement && t instanceof HTMLElement && (t.scrollTop = e.offsetTop + e.clientHeight / 2 - t.clientHeight / 2, (c = e.children[0]) == null || c.classList.add(n), setTimeout(() => {
10
- var i;
11
- (i = e.children[0]) == null || i.classList.remove(n);
12
- }, 2e3));
1
+ import { watch as u, nextTick as f } from "vue";
2
+ function g(r) {
3
+ const e = r.trim();
4
+ if (!e || document.getElementById(e))
5
+ return e;
6
+ const n = e.startsWith("msg-") ? e : `msg-${e}`;
7
+ if (document.getElementById(n))
8
+ return n;
9
+ try {
10
+ const t = JSON.parse(e);
11
+ if ((t == null ? void 0 : t.messageId) != null) {
12
+ const s = `msg-${t.messageId}`;
13
+ if (document.getElementById(s))
14
+ return s;
15
+ }
16
+ } catch {
17
+ }
18
+ return n;
19
+ }
20
+ function T({ targetIdRef: r, feedContainerId: e, focusClass: n = "focused-message" }) {
21
+ u(
22
+ () => r.value,
23
+ (t) => {
24
+ if (!t) return;
25
+ const s = (i = 0) => {
26
+ var l;
27
+ const d = g(t), o = document.getElementById(d), c = document.getElementById(e);
28
+ if (o instanceof HTMLElement && c instanceof HTMLElement) {
29
+ c.scrollTop = o.offsetTop + o.clientHeight / 2 - c.clientHeight / 2, (l = o.children[0]) == null || l.classList.add(n), setTimeout(() => {
30
+ var m;
31
+ (m = o.children[0]) == null || m.classList.remove(n);
32
+ }, 2e3);
33
+ return;
34
+ }
35
+ i < 5 && setTimeout(() => s(i + 1), 50);
36
+ };
37
+ f(() => s());
13
38
  }
14
39
  );
15
40
  }
16
41
  export {
17
- d as useFeedScrollTo
42
+ T as useFeedScrollTo
18
43
  };
@@ -1,4 +1,4 @@
1
- const f = "https://cdn.jsdelivr.net/npm/emoji-datasource-apple@6.0.1/img/apple/64", p = new RegExp("(?:\\p{Regional_Indicator}{2})|(?:[#*0-9]\\uFE0F?\\u20E3)|(?:\\p{Extended_Pictographic}(?:\\uFE0F|\\uFE0E)?(?:\\u200D(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier_Base})(?:\\uFE0F|\\uFE0E)?)*)", "gu"), g = "height:1.2em;width:1.2em;margin:0 0.05em;vertical-align:-0.2em;display:inline";
1
+ const f = "https://cdn.jsdelivr.net/npm/emoji-datasource-apple@6.0.1/img/apple/64", s = new RegExp("(?:\\p{Regional_Indicator}{2})|(?:[#*0-9]\\uFE0F?\\u20E3)|(?:\\p{Extended_Pictographic}(?:\\uFE0F|\\uFE0E)?(?:\\u200D(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier_Base})(?:\\uFE0F|\\uFE0E)?)*)", "gu"), g = "height:1.2em;width:1.2em;margin:0 0.05em;vertical-align:-0.2em;display:inline";
2
2
  function u(e, t) {
3
3
  const n = [];
4
4
  for (const c of e) {
@@ -21,7 +21,7 @@ function h(e) {
21
21
  }
22
22
  return null;
23
23
  }
24
- function T(e, t) {
24
+ function x(e, t) {
25
25
  const n = h(t);
26
26
  n && e.addEventListener(
27
27
  "error",
@@ -31,7 +31,7 @@ function T(e, t) {
31
31
  { once: !0 }
32
32
  );
33
33
  }
34
- function x(e) {
34
+ function T(e) {
35
35
  const t = u(e);
36
36
  if (!t) return e;
37
37
  const n = `${f}/${t}.png`, c = h(e), a = c ? ` data-fallback="${E(c)}" onerror="if(this.dataset.fallback&&this.src!==this.dataset.fallback){this.onerror=null;this.src=this.dataset.fallback}"` : "";
@@ -40,20 +40,23 @@ function x(e) {
40
40
  function E(e) {
41
41
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
42
42
  }
43
- function N(e) {
43
+ function I(e) {
44
44
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
45
45
  }
46
- function I(e) {
47
- return e ? N(e).replace(p, (n) => x(n)) : "";
46
+ function N(e) {
47
+ return e ? I(e).replace(s, (n) => T(n)) : "";
48
48
  }
49
49
  function $(e) {
50
+ return e ? (s.lastIndex = 0, s.test(e)) : !1;
51
+ }
52
+ function A(e) {
50
53
  var m;
51
54
  if (!e || typeof document > "u") return e;
52
55
  const t = document.createElement("div");
53
56
  t.innerHTML = e;
54
57
  const n = document.createTreeWalker(t, NodeFilter.SHOW_TEXT, {
55
- acceptNode: (s) => {
56
- let r = s.parentNode;
58
+ acceptNode: (d) => {
59
+ let r = d.parentNode;
57
60
  for (; r && r !== t; ) {
58
61
  const o = r.nodeName;
59
62
  if (o === "SCRIPT" || o === "STYLE" || o === "TEXTAREA")
@@ -66,27 +69,28 @@ function $(e) {
66
69
  let a;
67
70
  for (; a = n.nextNode(); )
68
71
  c.push(a);
69
- for (const s of c.reverse()) {
70
- const r = s.textContent || "";
71
- if (p.lastIndex = 0, !p.test(r)) continue;
72
- p.lastIndex = 0;
72
+ for (const d of c.reverse()) {
73
+ const r = d.textContent || "";
74
+ if (s.lastIndex = 0, !s.test(r)) continue;
75
+ s.lastIndex = 0;
73
76
  const o = document.createDocumentFragment();
74
- let d = 0, i;
75
- for (; i = p.exec(r); ) {
76
- i.index > d && o.appendChild(document.createTextNode(r.slice(d, i.index)));
77
+ let p = 0, i;
78
+ for (; i = s.exec(r); ) {
79
+ i.index > p && o.appendChild(document.createTextNode(r.slice(p, i.index)));
77
80
  const l = document.createElement("img");
78
- l.className = "chotto-emoji", l.src = F(i[0]), l.alt = i[0], l.draggable = !1, l.setAttribute("style", g), T(l, i[0]), o.appendChild(l), d = i.index + i[0].length;
81
+ l.className = "chotto-emoji", l.src = F(i[0]), l.alt = i[0], l.draggable = !1, l.setAttribute("style", g), x(l, i[0]), o.appendChild(l), p = i.index + i[0].length;
79
82
  }
80
- d < r.length && o.appendChild(document.createTextNode(r.slice(d))), (m = s.parentNode) == null || m.replaceChild(o, s);
83
+ p < r.length && o.appendChild(document.createTextNode(r.slice(p))), (m = d.parentNode) == null || m.replaceChild(o, d);
81
84
  }
82
85
  return t.innerHTML;
83
86
  }
84
87
  export {
85
88
  f as APPLE_EMOJI_CDN,
86
- x as createAppleEmojiImgHtml,
89
+ T as createAppleEmojiImgHtml,
87
90
  u as emojiToAppleCode,
88
91
  h as getAppleEmojiFallbackUrl,
89
92
  F as getAppleEmojiUrl,
90
- $ as replaceEmojisInHtml,
91
- I as textToAppleEmojiHtml
93
+ A as replaceEmojisInHtml,
94
+ $ as textContainsEmoji,
95
+ N as textToAppleEmojiHtml
92
96
  };
@@ -14,7 +14,7 @@ import { hideReplyPreview as s, showReplyPreview as r } from "./useStartReply.js
14
14
  function R(t) {
15
15
  const { setEdit: e, setMessageText: o, resetReply: m } = p(t);
16
16
  return { startEdit: (i) => {
17
- m(), r(t), e(i), o(i.text ?? "");
17
+ m(), r(t), o(i.text ?? ""), e(i);
18
18
  } };
19
19
  }
20
20
  function g(t) {