@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.
- package/dist/chotto.css +1 -1
- package/dist/components/2_feed_elements/MessageReactions/MessageReactions.vue.js +2 -2
- package/dist/components/2_feed_elements/MessageReactions/MessageReactions.vue2.js +15 -15
- package/dist/components/2_feed_elements/ReplyTextMessage/ReplyTextMessage.vue.js +4 -4
- package/dist/components/2_feed_elements/ReplyTextMessage/ReplyTextMessage.vue2.js +52 -16
- package/dist/components/3_compounds/ChatInput/ChatInput.vue.js +2 -2
- package/dist/components/3_compounds/ChatInput/ChatInput.vue2.js +165 -96
- package/dist/components/3_compounds/Feed/composables/useFeedScrollTo.js +38 -13
- package/dist/functions/renderAppleEmojis.js +24 -20
- package/dist/hooks/messages/useStartEdit.js +1 -1
- package/dist/themes/dark.css +1 -1
- package/dist/themes/default.css +1 -1
- package/dist/themes/glass.css +1 -1
- package/dist/themes/green.css +1 -1
- package/dist/themes/mobilon1.css +1 -1
- package/dist/types/components/2_feed_elements/BaseReplyMessage/styles/types.d.ts +6 -0
- package/dist/types/components/2_feed_elements/ReplyTextMessage/stories/ReplyTextMessage.stories.d.ts +1 -0
- package/dist/types/components/2_feed_elements/ReplyTextMessage/styles/types.d.ts +22 -0
- package/dist/types/components/2_feed_elements/TextMessage/styles/types.d.ts +18 -0
- package/dist/types/functions/renderAppleEmojis.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,18 +1,43 @@
|
|
|
1
|
-
import { watch as
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
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
|
-
|
|
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",
|
|
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
|
|
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
|
|
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, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function I(e) {
|
|
44
44
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
return e ?
|
|
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: (
|
|
56
|
-
let r =
|
|
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
|
|
70
|
-
const r =
|
|
71
|
-
if (
|
|
72
|
-
|
|
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
|
|
75
|
-
for (; i =
|
|
76
|
-
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),
|
|
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
|
-
|
|
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
|
-
|
|
89
|
+
T as createAppleEmojiImgHtml,
|
|
87
90
|
u as emojiToAppleCode,
|
|
88
91
|
h as getAppleEmojiFallbackUrl,
|
|
89
92
|
F as getAppleEmojiUrl,
|
|
90
|
-
|
|
91
|
-
|
|
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),
|
|
17
|
+
m(), r(t), o(i.text ?? ""), e(i);
|
|
18
18
|
} };
|
|
19
19
|
}
|
|
20
20
|
function g(t) {
|