@mobilon-dev/chotto 0.3.87 → 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/useFeedGrouping.js +22 -5
- 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/dist/types/main.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./MessageReactions.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-64bc224b"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
r as default
|
|
7
7
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as Ce, inject as E, ref as M, computed as c, unref as i, onMounted as _e, onUnmounted as Ne, watch as Se, createElementBlock as d, openBlock as l, normalizeClass as K, createBlock as Q, Fragment as A, renderList as F, withCtx as C, createElementVNode as
|
|
1
|
+
import { defineComponent as Ce, inject as E, ref as M, computed as c, unref as i, onMounted as _e, onUnmounted as Ne, watch as Se, createElementBlock as d, openBlock as l, normalizeClass as K, createBlock as Q, Fragment as A, renderList as F, withCtx as C, createElementVNode as p, createCommentVNode as _, createVNode as u, toDisplayString as Ue, Teleport as je, Transition as D, withDirectives as V, normalizeStyle as $, withModifiers as y, vShow as z } from "vue";
|
|
2
2
|
import Pe from "../../../node_modules/vue3-emoji-picker-ru/dist/emoji-picker.es.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import "../../../hooks/useMessageDraft.js";
|
|
@@ -82,7 +82,7 @@ const Ve = ["onClick"], $e = { class: "message-reactions__emoji" }, ze = {
|
|
|
82
82
|
},
|
|
83
83
|
emits: ["toggle-reaction", "add-reaction", "remove-reaction", "menu"],
|
|
84
84
|
setup(s, { emit: J }) {
|
|
85
|
-
const n = s, a = J,
|
|
85
|
+
const n = s, a = J, g = E("chatAppId"), G = E("currentUserId", void 0), W = E("reactionUserNames", void 0), { startReply: X } = Be(g || ""), m = M(null), f = M(null), N = M("light"), { isNative: Y } = Le(g || ""), S = c(() => Qe), Z = c(() => n.mode), k = c(() => n.currentUserId ?? i(G)), U = c(() => n.reactionUserNames ?? i(W)), ee = c(() => {
|
|
86
86
|
var t, r;
|
|
87
87
|
const e = (t = n.currentUserName) == null ? void 0 : t.trim();
|
|
88
88
|
if (e) return e;
|
|
@@ -105,7 +105,7 @@ const Ve = ["onClick"], $e = { class: "message-reactions__emoji" }, ze = {
|
|
|
105
105
|
quickReactionsRef: ue,
|
|
106
106
|
quickPanelStyle: de,
|
|
107
107
|
pickerStyle: me,
|
|
108
|
-
closeQuickPanel:
|
|
108
|
+
closeQuickPanel: v,
|
|
109
109
|
handleMessageMouseEnter: fe,
|
|
110
110
|
handleMessageMouseLeave: pe,
|
|
111
111
|
openFullPicker: ge,
|
|
@@ -117,8 +117,8 @@ const Ve = ["onClick"], $e = { class: "message-reactions__emoji" }, ze = {
|
|
|
117
117
|
handleClickOutside: O
|
|
118
118
|
} = re, ve = c(() => m.value ? Te(m.value) : !1), ye = () => {
|
|
119
119
|
var o;
|
|
120
|
-
if (!
|
|
121
|
-
const e = document.getElementById(
|
|
120
|
+
if (!g) return "light";
|
|
121
|
+
const e = document.getElementById(g);
|
|
122
122
|
return (o = e == null ? void 0 : e.getAttribute("data-theme")) != null && o.includes("dark") ? "dark" : "light";
|
|
123
123
|
};
|
|
124
124
|
function I() {
|
|
@@ -156,11 +156,11 @@ const Ve = ["onClick"], $e = { class: "message-reactions__emoji" }, ze = {
|
|
|
156
156
|
const o = h(e);
|
|
157
157
|
o && a("remove-reaction", { messageId: n.messageId, key: o }), a("add-reaction", { messageId: n.messageId, key: e });
|
|
158
158
|
}
|
|
159
|
-
|
|
159
|
+
v();
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
function be() {
|
|
163
|
-
n.readonly || !n.enabled || !n.reply || (X(n.reply),
|
|
163
|
+
n.readonly || !n.enabled || !n.reply || (X(n.reply), v());
|
|
164
164
|
}
|
|
165
165
|
function Re(e) {
|
|
166
166
|
if (n.readonly || !n.enabled || !n.menuEnabled) return;
|
|
@@ -168,13 +168,13 @@ const Ve = ["onClick"], $e = { class: "message-reactions__emoji" }, ze = {
|
|
|
168
168
|
const r = o.getBoundingClientRect();
|
|
169
169
|
return { top: r.top, right: r.right, bottom: r.bottom, left: r.left, width: r.width, height: r.height };
|
|
170
170
|
})() : void 0;
|
|
171
|
-
|
|
171
|
+
a("menu", { messageId: n.messageId, triggerRect: t, event: e });
|
|
172
172
|
}
|
|
173
173
|
async function Ee() {
|
|
174
174
|
n.readonly || !n.enabled || (N.value = ye(), await ge());
|
|
175
175
|
}
|
|
176
176
|
function Me(e) {
|
|
177
|
-
if (T(),
|
|
177
|
+
if (T(), v(), !I()) return;
|
|
178
178
|
const o = e.i;
|
|
179
179
|
if (L(o))
|
|
180
180
|
return;
|
|
@@ -190,7 +190,7 @@ const Ve = ["onClick"], $e = { class: "message-reactions__emoji" }, ze = {
|
|
|
190
190
|
}), Se(
|
|
191
191
|
() => [n.enabled, n.readonly],
|
|
192
192
|
([e, o]) => {
|
|
193
|
-
(!e || o) && (
|
|
193
|
+
(!e || o) && (v(), T());
|
|
194
194
|
}
|
|
195
195
|
), (e, o) => (l(), d("div", {
|
|
196
196
|
ref_key: "reactionsContainerRef",
|
|
@@ -207,11 +207,11 @@ const Ve = ["onClick"], $e = { class: "message-reactions__emoji" }, ze = {
|
|
|
207
207
|
delay: 400
|
|
208
208
|
}, {
|
|
209
209
|
default: C(() => [
|
|
210
|
-
|
|
210
|
+
p("button", {
|
|
211
211
|
class: K(["message-reactions__chip", { "is-active": t.reactedByMe && t.count === 1 }]),
|
|
212
212
|
onClick: (r) => ke(t.key)
|
|
213
213
|
}, [
|
|
214
|
-
|
|
214
|
+
p("span", $e, [
|
|
215
215
|
u(H, {
|
|
216
216
|
emoji: t.key
|
|
217
217
|
}, null, 8, ["emoji"])
|
|
@@ -224,7 +224,7 @@ const Ve = ["onClick"], $e = { class: "message-reactions__emoji" }, ze = {
|
|
|
224
224
|
(l(), Q(je, { to: "body" }, [
|
|
225
225
|
u(D, { name: "message-reactions-popover" }, {
|
|
226
226
|
default: C(() => [
|
|
227
|
-
V(
|
|
227
|
+
V(p("div", {
|
|
228
228
|
ref_key: "quickReactionsRef",
|
|
229
229
|
ref: ue,
|
|
230
230
|
class: "message-reactions__quick-panel",
|
|
@@ -242,7 +242,7 @@ const Ve = ["onClick"], $e = { class: "message-reactions__emoji" }, ze = {
|
|
|
242
242
|
}, [
|
|
243
243
|
u(H, { emoji: t }, null, 8, ["emoji"])
|
|
244
244
|
], 8, He))), 128)),
|
|
245
|
-
|
|
245
|
+
p("button", {
|
|
246
246
|
class: "message-reactions__expand",
|
|
247
247
|
title: "Развернуть",
|
|
248
248
|
onClick: y(Ee, ["stop"])
|
|
@@ -273,7 +273,7 @@ const Ve = ["onClick"], $e = { class: "message-reactions__emoji" }, ze = {
|
|
|
273
273
|
}),
|
|
274
274
|
u(D, { name: "message-reactions-popover" }, {
|
|
275
275
|
default: C(() => [
|
|
276
|
-
V(
|
|
276
|
+
V(p("div", {
|
|
277
277
|
ref_key: "pickerRef",
|
|
278
278
|
ref: ce,
|
|
279
279
|
class: "message-reactions__picker",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from "./ReplyTextMessage.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
const
|
|
3
|
+
import o from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const r = /* @__PURE__ */ o(e, [["__scopeId", "data-v-31ae85ec"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
r as default
|
|
7
7
|
};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as x, computed as f, createElementBlock as r, openBlock as o, createBlock as h, withCtx as g, createElementVNode as s, createCommentVNode as p, toDisplayString as d, unref as u } from "vue";
|
|
2
|
+
import k from "../../1_atoms/Tooltip/Tooltip.vue.js";
|
|
2
3
|
import "../../../locale/useLocale.js";
|
|
3
4
|
/* empty css */
|
|
4
5
|
import "../../../hooks/useTheme.js";
|
|
5
|
-
import { useMessageLinks as
|
|
6
|
+
import { useMessageLinks as _ } from "../../../hooks/messages/useMessageLinks.js";
|
|
6
7
|
import "../../../functions/parseMarkdown.js";
|
|
7
8
|
import "../../../hooks/useMessageDraft.js";
|
|
8
9
|
import "../../../hooks/useSearchModel.js";
|
|
9
10
|
import "../../../hooks/useEmojiNative.js";
|
|
10
11
|
/* empty css */
|
|
11
12
|
/* empty css */
|
|
12
|
-
const
|
|
13
|
+
const C = { class: "reply-text-message__wrapper" }, y = ["textContent"], T = ["innerHTML"], M = ["textContent"], H = ["innerHTML"], A = /* @__PURE__ */ x({
|
|
13
14
|
__name: "ReplyTextMessage",
|
|
14
15
|
props: {
|
|
15
16
|
message: {
|
|
@@ -17,22 +18,57 @@ const g = { class: "container" }, x = ["textContent"], f = ["innerHTML"], E = /*
|
|
|
17
18
|
required: !0
|
|
18
19
|
}
|
|
19
20
|
},
|
|
20
|
-
setup(
|
|
21
|
-
const i =
|
|
22
|
-
|
|
23
|
-
e.message.
|
|
21
|
+
setup(t) {
|
|
22
|
+
const i = t, { linkedHtml: a } = _(() => i.message.text), c = f(() => {
|
|
23
|
+
var e;
|
|
24
|
+
return ((e = i.message.text) == null ? void 0 : e.trim()) || "";
|
|
25
|
+
}), l = (e) => {
|
|
26
|
+
var m;
|
|
27
|
+
const n = (m = e.target) == null ? void 0 : m.closest("a");
|
|
28
|
+
n instanceof HTMLAnchorElement && n.href && (e.preventDefault(), e.stopPropagation(), window.open(n.href, "_blank", "noopener,noreferrer"));
|
|
29
|
+
};
|
|
30
|
+
return (e, n) => (o(), r("div", C, [
|
|
31
|
+
c.value ? (o(), h(k, {
|
|
24
32
|
key: 0,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
position: "top",
|
|
34
|
+
offset: 8,
|
|
35
|
+
delay: 1e3,
|
|
36
|
+
"max-width": "25rem",
|
|
37
|
+
text: c.value
|
|
38
|
+
}, {
|
|
39
|
+
default: g(() => [
|
|
40
|
+
s("div", {
|
|
41
|
+
class: "container",
|
|
42
|
+
onClick: l
|
|
43
|
+
}, [
|
|
44
|
+
t.message.header ? (o(), r("p", {
|
|
45
|
+
key: 0,
|
|
46
|
+
textContent: d(`В ответ ${t.message.header}`)
|
|
47
|
+
}, null, 8, y)) : p("", !0),
|
|
48
|
+
s("p", {
|
|
49
|
+
class: "text",
|
|
50
|
+
innerHTML: u(a)
|
|
51
|
+
}, null, 8, T)
|
|
52
|
+
])
|
|
53
|
+
]),
|
|
54
|
+
_: 1
|
|
55
|
+
}, 8, ["text"])) : (o(), r("div", {
|
|
56
|
+
key: 1,
|
|
57
|
+
class: "container",
|
|
58
|
+
onClick: l
|
|
59
|
+
}, [
|
|
60
|
+
t.message.header ? (o(), r("p", {
|
|
61
|
+
key: 0,
|
|
62
|
+
textContent: d(`В ответ ${t.message.header}`)
|
|
63
|
+
}, null, 8, M)) : p("", !0),
|
|
64
|
+
s("p", {
|
|
65
|
+
class: "text",
|
|
66
|
+
innerHTML: u(a)
|
|
67
|
+
}, null, 8, H)
|
|
68
|
+
]))
|
|
33
69
|
]));
|
|
34
70
|
}
|
|
35
71
|
});
|
|
36
72
|
export {
|
|
37
|
-
|
|
73
|
+
A as default
|
|
38
74
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import t from "./ChatInput.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import o from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const a = /* @__PURE__ */ o(t, [["__scopeId", "data-v-edf490bf"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
a as default
|
|
7
7
|
};
|
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useImmediateDebouncedRef as
|
|
3
|
-
import { useMessageDraft as
|
|
1
|
+
import { defineComponent as re, inject as ue, ref as f, computed as _, watch as h, nextTick as d, unref as r, onMounted as ce, createElementBlock as C, openBlock as I, createElementVNode as p, createVNode as P, renderSlot as W, toDisplayString as de, createCommentVNode as pe, withDirectives as fe, normalizeClass as H, withKeys as he, vModelText as me } from "vue";
|
|
2
|
+
import { useImmediateDebouncedRef as ve } from "../../../hooks/useImmediateDebouncedRef.js";
|
|
3
|
+
import { useMessageDraft as ge } from "../../../hooks/useMessageDraft.js";
|
|
4
4
|
import "../../../hooks/useSearchModel.js";
|
|
5
5
|
import "../../../hooks/useTheme.js";
|
|
6
|
-
import { useEmojiNative as
|
|
6
|
+
import { useEmojiNative as ye } from "../../../hooks/useEmojiNative.js";
|
|
7
7
|
/* empty css */
|
|
8
8
|
/* empty css */
|
|
9
|
-
import { t as
|
|
9
|
+
import { t as m } from "../../../locale/useLocale.js";
|
|
10
10
|
/* empty css */
|
|
11
11
|
import "../../../node_modules/linkifyjs/dist/linkify.js";
|
|
12
12
|
import "../../../node_modules/linkify-string/dist/linkify-string.js";
|
|
13
13
|
import "../../../functions/parseMarkdown.js";
|
|
14
|
-
import { textToAppleEmojiHtml as
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
|
|
14
|
+
import { textToAppleEmojiHtml as xe, textContainsEmoji as _e } from "../../../functions/renderAppleEmojis.js";
|
|
15
|
+
import { hideEditPreview as Te } from "../../../hooks/messages/useStartEdit.js";
|
|
16
|
+
import be from "./icons/SendIcon.vue.js";
|
|
17
|
+
import Se from "../../2_chatinput_elements/TextFormatToolbar/TextFormatToolbar.vue.js";
|
|
18
|
+
const Ce = { class: "chat-input__container" }, Ie = ["id"], we = ["id"], Ae = { class: "chat-input__inline-buttons" }, Ee = {
|
|
18
19
|
key: 0,
|
|
19
20
|
class: "chat-input__input chat-input__disabled-placeholder"
|
|
20
|
-
},
|
|
21
|
+
}, Me = {
|
|
21
22
|
key: 1,
|
|
22
23
|
class: "chat-input__input-wrap"
|
|
23
|
-
},
|
|
24
|
+
}, Fe = ["innerHTML"], He = ["disabled", "placeholder"], Re = ["disabled"], ke = { class: "" }, ze = { class: "chat-input__third-line" }, Ze = /* @__PURE__ */ re({
|
|
24
25
|
__name: "ChatInput",
|
|
25
26
|
props: {
|
|
26
27
|
state: {
|
|
@@ -49,103 +50,164 @@ const pe = { class: "chat-input__container" }, fe = ["id"], he = ["id"], me = {
|
|
|
49
50
|
}
|
|
50
51
|
},
|
|
51
52
|
emits: ["send", "typing"],
|
|
52
|
-
setup(
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
setup(v, { emit: B }) {
|
|
54
|
+
const w = B, g = ue("chatAppId"), { resetMessage: L, getMessage: l, setMessageText: T, setForceSendMessage: j, resetEdit: q } = ge(g), { isNative: K } = ye(g), n = f(), A = f(), u = f(!1), y = f(!1), N = ve("", 2e3), R = f(), O = _(() => xe(l().text || "")), x = _(
|
|
55
|
+
() => !K.value && _e(l().text || "")
|
|
56
|
+
), c = () => {
|
|
57
|
+
if (!A.value || !n.value) return;
|
|
58
|
+
const e = n.value, t = A.value, i = Math.max(0, e.offsetWidth - e.clientWidth);
|
|
59
|
+
t.style.right = i > 0 ? `${i}px` : "", t.scrollTop = e.scrollTop;
|
|
60
|
+
};
|
|
61
|
+
let b = 0;
|
|
62
|
+
function E() {
|
|
63
|
+
if (!x.value) {
|
|
64
|
+
u.value = !1;
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
b && cancelAnimationFrame(b), b = requestAnimationFrame(() => {
|
|
68
|
+
b = 0;
|
|
69
|
+
const e = n.value;
|
|
70
|
+
if (!e) {
|
|
71
|
+
u.value = !1;
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const t = e.selectionStart !== e.selectionEnd;
|
|
75
|
+
u.value !== t && (u.value = t, t || d(c));
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
const a = v, Y = _(() => !!(a.state == "disabled" || l().text == "" && !l().file || l().isRecording)), $ = _(() => {
|
|
56
79
|
var t;
|
|
57
|
-
if (
|
|
58
|
-
return
|
|
59
|
-
if (!((t =
|
|
80
|
+
if (a.inputButtonColor)
|
|
81
|
+
return a.inputButtonColor;
|
|
82
|
+
if (!((t = a.selectedChannel) != null && t.channelId))
|
|
60
83
|
return "#25D366";
|
|
61
|
-
const e =
|
|
84
|
+
const e = a.selectedChannel.channelId.toLowerCase();
|
|
62
85
|
return e.includes("whatsapp") || e.includes("waba") ? "#25D366" : e.includes("telegram") ? "#37AFE2" : e.includes("sms") ? "#6C757D" : e.includes("max") ? "#4B0082" : "#25D366";
|
|
63
|
-
}),
|
|
86
|
+
}), V = _(() => {
|
|
64
87
|
var t;
|
|
65
|
-
if (!((t =
|
|
66
|
-
return
|
|
67
|
-
const e =
|
|
68
|
-
return e.includes("whatsapp") || e.includes("waba") ?
|
|
88
|
+
if (!((t = a.selectedChannel) != null && t.channelId))
|
|
89
|
+
return m("component.ChatInput.InputPlaceholder");
|
|
90
|
+
const e = a.selectedChannel.channelId.toLowerCase();
|
|
91
|
+
return e.includes("whatsapp") || e.includes("waba") ? m("component.ChatInput.WhatsappInputPlaceholder") : e.includes("telegram") ? m("component.ChatInput.TelegramInputPlaceholder") : e.includes("sms") ? m("component.ChatInput.SmsInputPlaceholder") : e.includes("max") ? m("component.ChatInput.MaxInputPlaceholder") : m("component.ChatInput.InputPlaceholder");
|
|
69
92
|
});
|
|
70
|
-
|
|
71
|
-
() =>
|
|
93
|
+
h(
|
|
94
|
+
() => N.value,
|
|
72
95
|
() => {
|
|
73
|
-
|
|
96
|
+
w("typing");
|
|
74
97
|
}
|
|
75
|
-
),
|
|
76
|
-
() => r.focusOnInputArea,
|
|
98
|
+
), h(
|
|
77
99
|
() => {
|
|
78
|
-
|
|
79
|
-
|
|
100
|
+
var e;
|
|
101
|
+
return (e = l().edit) == null ? void 0 : e.messageId;
|
|
102
|
+
},
|
|
103
|
+
(e, t) => {
|
|
104
|
+
e != null && e !== t && (y.value = !0, d(() => {
|
|
105
|
+
if (!y.value) return;
|
|
106
|
+
const i = n.value;
|
|
107
|
+
i && (M(i), y.value = !1, S(i), requestAnimationFrame(() => S(i)));
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
), h(
|
|
111
|
+
() => a.focusOnInputArea,
|
|
112
|
+
() => {
|
|
113
|
+
a.focusOnInputArea && d(() => {
|
|
114
|
+
const e = r(n);
|
|
80
115
|
e == null || e.focus();
|
|
81
116
|
});
|
|
82
117
|
},
|
|
83
118
|
{ immediate: !0 }
|
|
84
|
-
),
|
|
119
|
+
), h(
|
|
85
120
|
() => l().text,
|
|
86
121
|
() => {
|
|
87
|
-
|
|
122
|
+
d(() => {
|
|
88
123
|
const e = n.value;
|
|
89
|
-
|
|
90
|
-
const t = e.scrollTop;
|
|
91
|
-
e.style.height = "auto";
|
|
92
|
-
const i = getComputedStyle(e), o = parseFloat(i.fontSize) || 16, q = parseFloat(i.lineHeight) || o * 1.4, S = 40, w = q * 11, M = e.scrollHeight, K = l().text.split(`
|
|
93
|
-
`).length > 1, s = document.createElement("div");
|
|
94
|
-
s.style.position = "absolute", s.style.visibility = "hidden", s.style.whiteSpace = "nowrap", s.style.font = i.font, s.style.fontSize = i.fontSize, s.style.fontFamily = i.fontFamily, s.style.fontWeight = i.fontWeight, s.style.letterSpacing = i.letterSpacing, s.textContent = l().text, document.body.appendChild(s);
|
|
95
|
-
const V = s.offsetWidth;
|
|
96
|
-
document.body.removeChild(s);
|
|
97
|
-
const $ = parseFloat(i.paddingLeft) || 0, G = parseFloat(i.paddingRight) || 0, U = e.clientWidth - $ - G, J = V > U, Q = K || J;
|
|
98
|
-
l().text.trim() && Q ? M <= w ? (e.style.height = M + "px", e.style.overflowY = "hidden") : (e.style.height = w + "px", e.style.overflowY = "auto", e.scrollTop = t) : (e.style.height = S + "px", e.style.overflowY = "hidden"), T();
|
|
124
|
+
e && (M(e), y.value && (y.value = !1, S(e), requestAnimationFrame(() => S(e))));
|
|
99
125
|
});
|
|
100
126
|
},
|
|
101
127
|
{ immediate: !0 }
|
|
102
|
-
),
|
|
128
|
+
), h(x, (e) => {
|
|
129
|
+
e && d(() => {
|
|
130
|
+
const t = n.value;
|
|
131
|
+
if (!t) return;
|
|
132
|
+
const i = t.scrollTop;
|
|
133
|
+
M(t), t.scrollTop = i, c(), requestAnimationFrame(c);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
function M(e) {
|
|
137
|
+
const t = e.scrollTop;
|
|
138
|
+
e.style.height = "auto";
|
|
139
|
+
const i = getComputedStyle(e), o = parseFloat(i.fontSize) || 16, ee = parseFloat(i.lineHeight) || o * 1.4, k = 40, z = ee * 11, D = e.scrollHeight, te = l().text.split(`
|
|
140
|
+
`).length > 1, s = document.createElement("div");
|
|
141
|
+
s.style.position = "absolute", s.style.visibility = "hidden", s.style.whiteSpace = "nowrap", s.style.font = i.font, s.style.fontSize = i.fontSize, s.style.fontFamily = i.fontFamily, s.style.fontWeight = i.fontWeight, s.style.letterSpacing = i.letterSpacing, s.textContent = l().text, document.body.appendChild(s);
|
|
142
|
+
const ne = s.offsetWidth;
|
|
143
|
+
document.body.removeChild(s);
|
|
144
|
+
const ie = parseFloat(i.paddingLeft) || 0, le = parseFloat(i.paddingRight) || 0, oe = e.clientWidth - ie - le, se = ne > oe, ae = te || se;
|
|
145
|
+
l().text.trim() && ae ? D <= z ? (e.style.height = D + "px", e.style.overflowY = "hidden") : (e.style.height = z + "px", e.style.overflowY = "auto", e.scrollTop = t) : (e.style.height = k + "px", e.style.overflowY = "hidden"), c(), requestAnimationFrame(c);
|
|
146
|
+
}
|
|
147
|
+
function S(e) {
|
|
148
|
+
if (a.state === "disabled" || l().isRecording) return;
|
|
149
|
+
const t = e.value.length;
|
|
150
|
+
e.focus(), e.setSelectionRange(t, t), e.scrollTop = e.scrollHeight, c();
|
|
151
|
+
}
|
|
152
|
+
h(
|
|
103
153
|
() => l().forceSend,
|
|
104
154
|
() => {
|
|
105
|
-
l().forceSend && (
|
|
155
|
+
l().forceSend && (F(), j(!1));
|
|
106
156
|
}
|
|
107
157
|
);
|
|
108
|
-
const
|
|
158
|
+
const U = (e) => {
|
|
109
159
|
const t = e.target;
|
|
110
|
-
|
|
111
|
-
},
|
|
112
|
-
|
|
160
|
+
w("typing", t.value);
|
|
161
|
+
}, G = () => {
|
|
162
|
+
d(() => {
|
|
113
163
|
const e = n.value;
|
|
114
164
|
e && (e.style.height = "40px", e.style.overflowY = "hidden");
|
|
115
165
|
});
|
|
116
166
|
};
|
|
117
|
-
|
|
118
|
-
|
|
167
|
+
ce(() => {
|
|
168
|
+
G();
|
|
119
169
|
});
|
|
120
|
-
const
|
|
170
|
+
const J = (e) => {
|
|
121
171
|
if (e.shiftKey) {
|
|
122
172
|
if (n.value instanceof HTMLTextAreaElement) {
|
|
123
173
|
let t = n.value.selectionStart;
|
|
124
174
|
t && (n.value.setRangeText(`
|
|
125
|
-
`, t, t, "end"),
|
|
175
|
+
`, t, t, "end"), T(n.value.value));
|
|
126
176
|
}
|
|
127
177
|
e.preventDefault();
|
|
128
178
|
} else if (e.ctrlKey) {
|
|
129
179
|
if (n.value instanceof HTMLTextAreaElement) {
|
|
130
180
|
let t = n.value.selectionStart;
|
|
131
181
|
t && (n.value.setRangeText(`
|
|
132
|
-
`, t, t, "end"),
|
|
182
|
+
`, t, t, "end"), T(n.value.value));
|
|
133
183
|
}
|
|
134
184
|
e.preventDefault();
|
|
135
185
|
} else
|
|
136
|
-
e.preventDefault(),
|
|
137
|
-
},
|
|
186
|
+
e.preventDefault(), F();
|
|
187
|
+
}, Q = (e) => {
|
|
138
188
|
if (n.value) {
|
|
139
189
|
const t = n.value.value;
|
|
140
190
|
n.value.value = e.newText;
|
|
141
191
|
const i = e.newText.length - (t.length - (e.end - e.start)), o = e.start + i;
|
|
142
|
-
|
|
192
|
+
T(e.newText), d(() => {
|
|
143
193
|
n.value && (n.value.setSelectionRange(o, o), n.value.focus());
|
|
144
194
|
});
|
|
145
195
|
}
|
|
146
|
-
}
|
|
196
|
+
};
|
|
197
|
+
function X() {
|
|
198
|
+
q(), T(""), Te(g), R.value = void 0, n.value && n.value.focus();
|
|
199
|
+
}
|
|
200
|
+
function Z() {
|
|
201
|
+
const e = l();
|
|
202
|
+
return e.edit ? (e.text ?? "").trim() === (e.edit.text ?? "").trim() : !1;
|
|
203
|
+
}
|
|
204
|
+
const F = () => {
|
|
147
205
|
var t, i;
|
|
148
206
|
const e = f(l());
|
|
207
|
+
if (e.value.edit && Z()) {
|
|
208
|
+
X();
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
149
211
|
if (e.value.text != "" || e.value.file) {
|
|
150
212
|
const o = {
|
|
151
213
|
type: "",
|
|
@@ -155,63 +217,70 @@ const pe = { class: "chat-input__container" }, fe = ["id"], he = ["id"], me = {
|
|
|
155
217
|
size: "",
|
|
156
218
|
reply: void 0
|
|
157
219
|
};
|
|
158
|
-
e.value.file ? (o.type = "message." + e.value.file.type, o.url = e.value.file.url, o.filename = e.value.file.name, o.size = (t = e.value.file.size) == null ? void 0 : t.toString(), o.text = (i = e == null ? void 0 : e.value) == null ? void 0 : i.text.trim()) : (o.type = "message.text", o.text = e.value.text.trim()), e.value.reply && (o.reply = e.value.reply), e.value.edit && (o.edit = e.value.edit),
|
|
220
|
+
e.value.file ? (o.type = "message." + e.value.file.type, o.url = e.value.file.url, o.filename = e.value.file.name, o.size = (t = e.value.file.size) == null ? void 0 : t.toString(), o.text = (i = e == null ? void 0 : e.value) == null ? void 0 : i.text.trim()) : (o.type = "message.text", o.text = e.value.text.trim()), e.value.reply && (o.reply = e.value.reply), e.value.edit && (o.edit = e.value.edit), w("send", o), L(), R.value = void 0, n.value && n.value.focus();
|
|
159
221
|
}
|
|
160
222
|
};
|
|
161
|
-
return (e, t) => (
|
|
162
|
-
|
|
163
|
-
id: "chat-input-reply-line-" +
|
|
223
|
+
return (e, t) => (I(), C("div", Ce, [
|
|
224
|
+
p("div", {
|
|
225
|
+
id: "chat-input-reply-line-" + r(g),
|
|
164
226
|
class: "chat-input__reply-line"
|
|
165
|
-
}, null, 8,
|
|
166
|
-
|
|
167
|
-
id: "chat-input-file-line-" +
|
|
227
|
+
}, null, 8, Ie),
|
|
228
|
+
p("div", {
|
|
229
|
+
id: "chat-input-file-line-" + r(g),
|
|
168
230
|
class: "chat-input__file-line"
|
|
169
|
-
}, null, 8,
|
|
170
|
-
|
|
171
|
-
|
|
231
|
+
}, null, 8, we),
|
|
232
|
+
p("div", Ae, [
|
|
233
|
+
W(e.$slots, "inline-buttons", {}, void 0, !0)
|
|
172
234
|
]),
|
|
173
|
-
|
|
174
|
-
|
|
235
|
+
v.disabledPlaceholder && (v.state == "disabled" || r(l)().isRecording) ? (I(), C("div", Ee, de(v.disabledPlaceholder), 1)) : (I(), C("div", Me, [
|
|
236
|
+
x.value ? (I(), C("div", {
|
|
175
237
|
key: 0,
|
|
176
238
|
ref_key: "refMirror",
|
|
177
|
-
ref:
|
|
178
|
-
class: "chat-input__input-mirror",
|
|
239
|
+
ref: A,
|
|
240
|
+
class: H(["chat-input__input-mirror", { "chat-input__input-mirror--hidden": u.value }]),
|
|
179
241
|
"aria-hidden": "true",
|
|
180
|
-
innerHTML:
|
|
181
|
-
}, null,
|
|
182
|
-
|
|
242
|
+
innerHTML: O.value
|
|
243
|
+
}, null, 10, Fe)) : pe("", !0),
|
|
244
|
+
fe(p("textarea", {
|
|
183
245
|
ref_key: "refInput",
|
|
184
246
|
ref: n,
|
|
185
|
-
"onUpdate:modelValue": t[0] || (t[0] = (i) =>
|
|
186
|
-
disabled:
|
|
187
|
-
class:
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
247
|
+
"onUpdate:modelValue": t[0] || (t[0] = (i) => r(l)().text = i),
|
|
248
|
+
disabled: v.state == "disabled" || r(l)().isRecording,
|
|
249
|
+
class: H(["chat-input__input", {
|
|
250
|
+
"chat-input__input--emoji-images": x.value && !u.value,
|
|
251
|
+
"chat-input__input--selecting": x.value && u.value
|
|
252
|
+
}]),
|
|
253
|
+
placeholder: V.value,
|
|
254
|
+
onKeydown: he(J, ["enter"]),
|
|
255
|
+
onInput: U,
|
|
256
|
+
onScroll: c,
|
|
257
|
+
onSelect: E,
|
|
258
|
+
onMouseup: E,
|
|
259
|
+
onKeyup: E,
|
|
260
|
+
onBlur: t[1] || (t[1] = (i) => u.value = !1)
|
|
261
|
+
}, null, 42, He), [
|
|
262
|
+
[me, r(l)().text]
|
|
194
263
|
])
|
|
195
264
|
])),
|
|
196
|
-
|
|
265
|
+
P(Se, {
|
|
197
266
|
textarea: n.value,
|
|
198
|
-
onFormatApplied:
|
|
267
|
+
onFormatApplied: Q
|
|
199
268
|
}, null, 8, ["textarea"]),
|
|
200
|
-
|
|
201
|
-
class:
|
|
202
|
-
disabled:
|
|
203
|
-
onClick:
|
|
269
|
+
p("button", {
|
|
270
|
+
class: H(["chat-input__button", { "chat-input__button-disabled": Y.value }]),
|
|
271
|
+
disabled: r(l)().isRecording,
|
|
272
|
+
onClick: F
|
|
204
273
|
}, [
|
|
205
|
-
|
|
206
|
-
|
|
274
|
+
p("span", ke, [
|
|
275
|
+
P(r(be), { color: $.value }, null, 8, ["color"])
|
|
207
276
|
])
|
|
208
|
-
], 10,
|
|
209
|
-
|
|
210
|
-
|
|
277
|
+
], 10, Re),
|
|
278
|
+
p("div", ze, [
|
|
279
|
+
W(e.$slots, "buttons", {}, void 0, !0)
|
|
211
280
|
])
|
|
212
281
|
]));
|
|
213
282
|
}
|
|
214
283
|
});
|
|
215
284
|
export {
|
|
216
|
-
|
|
285
|
+
Ze as default
|
|
217
286
|
};
|
|
@@ -1,11 +1,28 @@
|
|
|
1
|
-
import { computed as
|
|
1
|
+
import { computed as p } from "vue";
|
|
2
|
+
const n = /* @__PURE__ */ new Set([
|
|
3
|
+
"message.system",
|
|
4
|
+
"message.typing",
|
|
5
|
+
"message.delimiter",
|
|
6
|
+
"system.date"
|
|
7
|
+
]);
|
|
8
|
+
function d(r, i) {
|
|
9
|
+
for (let e = i - 1; e >= 0; e--)
|
|
10
|
+
if (!n.has(r[e].type))
|
|
11
|
+
return r[e];
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
2
14
|
function a({ objects: r }) {
|
|
3
15
|
return {
|
|
4
|
-
groupedObjects:
|
|
5
|
-
|
|
16
|
+
groupedObjects: p(() => !r.value || r.value.length === 0 ? [] : r.value.map((e, u, s) => {
|
|
17
|
+
if (n.has(e.type))
|
|
18
|
+
return {
|
|
19
|
+
...e,
|
|
20
|
+
isFirstInSeries: !0
|
|
21
|
+
};
|
|
22
|
+
const t = d(s, u), o = t != null && t.position === e.position && t.header === e.header;
|
|
6
23
|
return {
|
|
7
|
-
...
|
|
8
|
-
isFirstInSeries: !o
|
|
24
|
+
...e,
|
|
25
|
+
isFirstInSeries: !o
|
|
9
26
|
};
|
|
10
27
|
}))
|
|
11
28
|
};
|