@mobilon-dev/chotto 0.3.32 → 0.3.34
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/1_atoms/ButtonContextMenu/ButtonContextMenu.vue.js +2 -2
- package/dist/components/1_atoms/ButtonContextMenu/ButtonContextMenu.vue2.js +28 -27
- package/dist/components/1_atoms/ContextMenu/ContextMenu.vue.js +36 -22
- package/dist/components/1_icons/SettingsIcon.vue.js +6 -6
- package/dist/components/2_blocks/CommunicationPanel/CommunicationPanel.vue.js +164 -156
- package/dist/components/2_chatinput_elements/ButtonEmojiPicker/ButtonEmojiPicker.vue.js +4 -103
- package/dist/components/2_chatinput_elements/ButtonEmojiPicker/ButtonEmojiPicker.vue2.js +135 -0
- package/dist/components/2_chatinput_elements/ButtonEmojiPicker/icons/SmilesIcon.vue.js +33 -11
- package/dist/components/2_chatinput_elements/ButtonEmojiPicker/icons/SmilesIcon.vue2.js +4 -0
- package/dist/components/2_chatinput_elements/ButtonTemplateSelector/ButtonTemplateSelector.vue.js +4 -102
- package/dist/components/2_chatinput_elements/ButtonTemplateSelector/ButtonTemplateSelector.vue2.js +135 -0
- package/dist/components/2_chatinput_elements/ButtonTemplateSelector/icons/ChatTemplatesIcon.vue.js +21 -18
- package/dist/components/2_chatinput_elements/ButtonTemplateSelector/icons/ChatTemplatesIcon.vue2.js +4 -0
- package/dist/components/2_chatinput_elements/FileUploader/FileUploader.vue.js +2 -2
- package/dist/components/2_chatinput_elements/FileUploader/FileUploader.vue2.js +89 -55
- package/dist/components/2_chatinput_elements/FileUploader/icons/FileUploaderIcon.vue.js +17 -14
- package/dist/components/2_chatinput_elements/FileUploader/icons/FileUploaderIcon.vue2.js +4 -0
- package/dist/components/2_chatinput_elements/StickerPicker/StickerPicker.vue.js +7 -0
- package/dist/components/2_chatinput_elements/StickerPicker/StickerPicker.vue2.js +360 -0
- package/dist/components/2_chatinput_elements/StickerPicker/icons/StickerIcon.vue.js +65 -0
- package/dist/components/2_chatinput_elements/StickerPicker/icons/StickerIcon.vue2.js +4 -0
- package/dist/components/2_chatlist_elements/ChatItem/ChatItem.vue.js +2 -2
- package/dist/components/2_chatlist_elements/ChatItem/ChatItem.vue2.js +164 -100
- package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue.js +1 -1
- package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue2.js +184 -134
- package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue.js +3 -3
- package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue2.js +1 -1
- package/dist/components/3_compounds/ChatList/ChatList.vue.js +101 -91
- package/dist/components/3_compounds/SideBar/SideBar.vue.js +68 -67
- package/dist/hooks/messages/useChannelAccentColor.js +35 -19
- package/dist/index.js +191 -189
- package/dist/themes/dark.css +1 -1
- package/dist/themes/default.css +1 -1
- package/dist/themes/glass.css +1 -0
- package/dist/themes/green.css +1 -1
- package/dist/themes/mobilon1.css +1 -1
- package/dist/types/apps/data/images/stickers/animated/index.d.ts +9 -0
- package/dist/types/apps/data/images/stickers/index.d.ts +10 -0
- package/dist/types/apps/data/messages.d.ts +117 -86
- package/dist/types/components/1_atoms/ContextMenu/ContextMenu.vue.d.ts +5 -1
- package/dist/types/components/2_blocks/CommunicationPanel/CommunicationPanel.vue.d.ts +2 -0
- package/dist/types/components/2_blocks/CommunicationPanel/stories/CommunicationPanel.stories.d.ts +2 -0
- package/dist/types/components/2_blocks/CommunicationPanel/styles/types.d.ts +4 -0
- package/dist/types/components/2_chatinput_elements/ButtonEmojiPicker/ButtonEmojiPicker.vue.d.ts +31 -7
- package/dist/types/components/2_chatinput_elements/ButtonEmojiPicker/icons/SmilesIcon.vue.d.ts +6 -1
- package/dist/types/components/2_chatinput_elements/ButtonEmojiPicker/styles/types.d.ts +6 -0
- package/dist/types/components/2_chatinput_elements/ButtonTemplateSelector/ButtonTemplateSelector.vue.d.ts +59 -11
- package/dist/types/components/2_chatinput_elements/ButtonTemplateSelector/icons/ChatTemplatesIcon.vue.d.ts +6 -1
- package/dist/types/components/2_chatinput_elements/FileUploader/icons/FileUploaderIcon.vue.d.ts +6 -1
- package/dist/types/components/2_chatinput_elements/StickerPicker/StickerPicker.vue.d.ts +25 -0
- package/dist/types/components/2_chatinput_elements/StickerPicker/icons/StickerIcon.vue.d.ts +7 -0
- package/dist/types/components/2_chatinput_elements/StickerPicker/icons/index.d.ts +1 -0
- package/dist/types/components/2_chatinput_elements/StickerPicker/stories/StickerPicker.stories.d.ts +12 -0
- package/dist/types/components/2_chatinput_elements/StickerPicker/styles/types.d.ts +275 -0
- package/dist/types/components/2_chatlist_elements/ChatItem/ChatItem.vue.d.ts +2 -0
- package/dist/types/components/2_chatlist_elements/ChatItem/styles/types.d.ts +2 -0
- package/dist/types/components/2_elements/ChatInfo/styles/types.d.ts +2 -0
- package/dist/types/components/2_feed_elements/AudioMessage/styles/types.d.ts +18 -0
- package/dist/types/components/2_feed_elements/CallMessage/styles/types.d.ts +24 -0
- package/dist/types/components/2_feed_elements/DateMessage/styles/types.d.ts +6 -0
- package/dist/types/components/2_feed_elements/DateMessageSticky/styles/types.d.ts +4 -0
- package/dist/types/components/2_feed_elements/FeedKeyboard/styles/types.d.ts +2 -0
- package/dist/types/components/2_feed_elements/FileMessage/styles/types.d.ts +12 -0
- package/dist/types/components/2_feed_elements/ImageMessage/styles/types.d.ts +126 -0
- package/dist/types/components/2_feed_elements/MessageReactions/styles/types.d.ts +8 -0
- package/dist/types/components/2_feed_elements/TextMessage/styles/types.d.ts +16 -0
- package/dist/types/components/3_compounds/ChatInput/styles/types.d.ts +2 -0
- package/dist/types/components/3_compounds/ChatList/ChatList.vue.d.ts +2 -0
- package/dist/types/components/3_compounds/ChatList/styles/types.d.ts +8 -0
- package/dist/types/components/3_compounds/SideBar/styles/types.d.ts +6 -16
- package/dist/types/components/4_layouts/ChatWrapper/styles/types.d.ts +4 -0
- package/dist/types/components/4_layouts/ExtendedLayout/styles/types.d.ts +8 -0
- package/dist/types/components/index.d.ts +1 -0
- package/package.json +2 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { uploadFile as
|
|
4
|
-
import { useMessageDraft as
|
|
1
|
+
import { defineComponent as x, ref as n, inject as O, computed as M, watchEffect as P, onMounted as $, onUnmounted as H, createElementBlock as w, openBlock as a, Fragment as L, createCommentVNode as b, createElementVNode as m, createBlock as S, normalizeClass as R, createVNode as j, unref as h, Teleport as T } from "vue";
|
|
2
|
+
import q from "../FilePreview/FilePreview.vue.js";
|
|
3
|
+
import { uploadFile as G } from "../../../hooks/uploadFile/uploadFile.js";
|
|
4
|
+
import { useMessageDraft as J } from "../../../hooks/useMessageDraft.js";
|
|
5
5
|
import "../../../hooks/useSearchModel.js";
|
|
6
6
|
import "../../../hooks/useTheme.js";
|
|
7
7
|
/* empty css */
|
|
8
8
|
/* empty css */
|
|
9
9
|
import "../../../node_modules/linkifyjs/dist/linkify.js";
|
|
10
10
|
import "../../../functions/parseMarkdown.js";
|
|
11
|
-
import
|
|
12
|
-
const
|
|
11
|
+
import K from "./icons/FileUploaderIcon.vue.js";
|
|
12
|
+
const Q = { key: 0 }, W = { key: 1 }, X = ["disabled"], pe = /* @__PURE__ */ x({
|
|
13
13
|
__name: "FileUploader",
|
|
14
14
|
props: {
|
|
15
15
|
filebumpUrl: {
|
|
@@ -22,39 +22,57 @@ const O = { key: 0 }, P = { key: 1 }, T = ["disabled"], ie = /* @__PURE__ */ M({
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
emits: ["fileUploaded"],
|
|
25
|
-
setup(
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
setup(d, { emit: Y }) {
|
|
26
|
+
const v = d, r = n(""), s = n(), p = n(), B = n(), i = O("chatAppId"), { setMessageFile: V, resetMessageFile: z, getMessage: C, setRecordingMessage: I } = J(i), f = n("#5F5F5F"), c = n("#404040"), g = n(!1);
|
|
27
|
+
let u = null;
|
|
28
|
+
const y = () => {
|
|
29
|
+
if (!i) {
|
|
30
|
+
f.value = "#5F5F5F", c.value = "#404040";
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const l = document.getElementById(i);
|
|
34
|
+
if (!l) {
|
|
35
|
+
f.value = "#5F5F5F", c.value = "#404040";
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const t = window.getComputedStyle(l), e = t.getPropertyValue("--chotto-fileuploader-trigger-color").trim(), o = t.getPropertyValue("--chotto-fileuploader-trigger-hover-color").trim();
|
|
39
|
+
f.value = e || "#5F5F5F", c.value = o || "#404040";
|
|
40
|
+
}, A = M(() => g.value ? c.value : f.value);
|
|
41
|
+
P(() => {
|
|
42
|
+
y();
|
|
43
|
+
});
|
|
44
|
+
const F = M(() => !C().file), E = () => {
|
|
45
|
+
const l = document.getElementById("chat-input-file-line-" + i);
|
|
46
|
+
l && (l.style.display = "none"), z(), p.value = void 0, r.value = "";
|
|
47
|
+
}, N = async () => {
|
|
48
|
+
var l, t;
|
|
49
|
+
E(), (l = s.value) != null && l.files && U((t = s.value) == null ? void 0 : t.files[0]);
|
|
50
|
+
}, D = () => {
|
|
51
|
+
s.value && F && v.state == "active" && s.value.click();
|
|
52
|
+
}, k = async (l) => {
|
|
35
53
|
var e;
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
38
|
-
for (let
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
const _ =
|
|
54
|
+
const t = (e = l.clipboardData) == null ? void 0 : e.items;
|
|
55
|
+
if (t) {
|
|
56
|
+
for (let o of t)
|
|
57
|
+
if (o.type.indexOf("image") !== -1) {
|
|
58
|
+
l.preventDefault();
|
|
59
|
+
const _ = o.getAsFile();
|
|
42
60
|
_ && U(_);
|
|
43
61
|
}
|
|
44
62
|
}
|
|
45
|
-
}, U = async (
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
await
|
|
49
|
-
if (
|
|
50
|
-
|
|
63
|
+
}, U = async (l) => {
|
|
64
|
+
r.value = "uploading", I(!0);
|
|
65
|
+
const t = typeof v.filebumpUrl == "string" ? v.filebumpUrl : null;
|
|
66
|
+
await G(t, l).then((e) => {
|
|
67
|
+
if (I(!1), r.value = e.status, e.status == "success") {
|
|
68
|
+
V({
|
|
51
69
|
url: e.url,
|
|
52
70
|
name: e.name,
|
|
53
71
|
size: e.size,
|
|
54
72
|
type: e.type
|
|
55
73
|
});
|
|
56
|
-
const
|
|
57
|
-
|
|
74
|
+
const o = document.getElementById("chat-input-file-line-" + i);
|
|
75
|
+
o && (o.style.display = "inherit"), e.preview && (p.value = {
|
|
58
76
|
previewUrl: e.preview.previewUrl,
|
|
59
77
|
isImage: e.preview.isImage,
|
|
60
78
|
isVideo: e.preview.isVideo,
|
|
@@ -65,41 +83,57 @@ const O = { key: 0 }, P = { key: 1 }, T = ["disabled"], ie = /* @__PURE__ */ M({
|
|
|
65
83
|
}
|
|
66
84
|
});
|
|
67
85
|
};
|
|
68
|
-
return
|
|
69
|
-
window.addEventListener("paste",
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
86
|
+
return $(() => {
|
|
87
|
+
if (window.addEventListener("paste", k), y(), i) {
|
|
88
|
+
const l = document.getElementById(i);
|
|
89
|
+
l && (u = new MutationObserver((t) => {
|
|
90
|
+
t.forEach((e) => {
|
|
91
|
+
e.type === "attributes" && e.attributeName === "data-theme" && y();
|
|
92
|
+
});
|
|
93
|
+
}), u.observe(l, {
|
|
94
|
+
attributes: !0,
|
|
95
|
+
attributeFilter: ["data-theme"]
|
|
96
|
+
}));
|
|
97
|
+
}
|
|
98
|
+
}), H(() => {
|
|
99
|
+
window.removeEventListener("paste", k), u && (u.disconnect(), u = null);
|
|
100
|
+
}), (l, t) => (a(), w(L, null, [
|
|
101
|
+
r.value === "uploading" ? (a(), w("div", Q, [...t[2] || (t[2] = [
|
|
102
|
+
m("p", null, "Загрузка файла...", -1)
|
|
103
|
+
])])) : r.value === "error" ? (a(), w("div", W, [...t[3] || (t[3] = [
|
|
104
|
+
m("p", null, "Ошибка при загрузке файла.", -1)
|
|
105
|
+
])])) : b("", !0),
|
|
106
|
+
m("span", {
|
|
107
|
+
ref_key: "triggerElement",
|
|
108
|
+
ref: B,
|
|
109
|
+
class: R(["file-uploader__trigger", { "file-uploader__disabled": !F.value || d.state == "disabled" }]),
|
|
110
|
+
disabled: !F.value || d.state == "disabled",
|
|
111
|
+
onClick: D,
|
|
112
|
+
onMouseenter: t[0] || (t[0] = (e) => g.value = !0),
|
|
113
|
+
onMouseleave: t[1] || (t[1] = (e) => g.value = !1)
|
|
80
114
|
}, [
|
|
81
|
-
|
|
82
|
-
],
|
|
83
|
-
|
|
115
|
+
j(h(K), { fill: A.value }, null, 8, ["fill"])
|
|
116
|
+
], 42, X),
|
|
117
|
+
m("input", {
|
|
84
118
|
ref_key: "fileInput",
|
|
85
|
-
ref:
|
|
119
|
+
ref: s,
|
|
86
120
|
style: { display: "none" },
|
|
87
121
|
type: "file",
|
|
88
|
-
onChange:
|
|
122
|
+
onChange: N
|
|
89
123
|
}, null, 544),
|
|
90
|
-
|
|
124
|
+
h(C)().file ? (a(), S(T, {
|
|
91
125
|
key: 2,
|
|
92
|
-
to: "#chat-input-file-line-" +
|
|
126
|
+
to: "#chat-input-file-line-" + h(i)
|
|
93
127
|
}, [
|
|
94
|
-
|
|
128
|
+
p.value ? (a(), S(q, {
|
|
95
129
|
key: 0,
|
|
96
|
-
"file-info":
|
|
97
|
-
onReset:
|
|
98
|
-
}, null, 8, ["file-info"])) :
|
|
99
|
-
], 8, ["to"])) :
|
|
130
|
+
"file-info": p.value,
|
|
131
|
+
onReset: E
|
|
132
|
+
}, null, 8, ["file-info"])) : b("", !0)
|
|
133
|
+
], 8, ["to"])) : b("", !0)
|
|
100
134
|
], 64));
|
|
101
135
|
}
|
|
102
136
|
});
|
|
103
137
|
export {
|
|
104
|
-
|
|
138
|
+
pe as default
|
|
105
139
|
};
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const r = {}, l = {
|
|
1
|
+
import { defineComponent as e, createElementBlock as t, openBlock as l, createElementVNode as o } from "vue";
|
|
2
|
+
const n = {
|
|
4
3
|
width: "26",
|
|
5
4
|
height: "26",
|
|
6
5
|
viewBox: "0 0 26 26",
|
|
7
6
|
fill: "none",
|
|
8
7
|
xmlns: "http://www.w3.org/2000/svg"
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
}, i = ["fill"], a = /* @__PURE__ */ e({
|
|
9
|
+
__name: "FileUploaderIcon",
|
|
10
|
+
props: {
|
|
11
|
+
fill: { default: "#5F5F5F" }
|
|
12
|
+
},
|
|
13
|
+
setup(C) {
|
|
14
|
+
return (c, r) => (l(), t("svg", n, [
|
|
15
|
+
o("path", {
|
|
16
|
+
d: "M7.3125 4.875C7.3125 3.79756 7.74051 2.76425 8.50238 2.00238C9.26425 1.24051 10.2976 0.8125 11.375 0.8125C12.4524 0.8125 13.4858 1.24051 14.2476 2.00238C15.0095 2.76425 15.4375 3.79756 15.4375 4.875V19.5C15.4375 20.1465 15.1807 20.7665 14.7236 21.2236C14.2665 21.6807 13.6465 21.9375 13 21.9375C12.3535 21.9375 11.7335 21.6807 11.2764 21.2236C10.8193 20.7665 10.5625 20.1465 10.5625 19.5V8.125C10.5625 7.90951 10.6481 7.70285 10.8005 7.55048C10.9528 7.3981 11.1595 7.3125 11.375 7.3125C11.5905 7.3125 11.7972 7.3981 11.9495 7.55048C12.1019 7.70285 12.1875 7.90951 12.1875 8.125V19.5C12.1875 19.7155 12.2731 19.9222 12.4255 20.0745C12.5778 20.2269 12.7845 20.3125 13 20.3125C13.2155 20.3125 13.4222 20.2269 13.5745 20.0745C13.7269 19.9222 13.8125 19.7155 13.8125 19.5V4.875C13.8125 4.5549 13.7495 4.23794 13.627 3.94221C13.5045 3.64648 13.3249 3.37777 13.0986 3.15143C12.8722 2.92508 12.6035 2.74554 12.3078 2.62304C12.0121 2.50055 11.6951 2.4375 11.375 2.4375C11.0549 2.4375 10.7379 2.50055 10.4422 2.62304C10.1465 2.74554 9.87777 2.92508 9.65143 3.15143C9.42508 3.37777 9.24554 3.64648 9.12304 3.94221C9.00055 4.23794 8.9375 4.5549 8.9375 4.875V19.5C8.9375 20.5774 9.36551 21.6108 10.1274 22.3726C10.8892 23.1345 11.9226 23.5625 13 23.5625C14.0774 23.5625 15.1108 23.1345 15.8726 22.3726C16.6345 21.6108 17.0625 20.5774 17.0625 19.5V8.125C17.0625 7.90951 17.1481 7.70285 17.3005 7.55048C17.4528 7.3981 17.6595 7.3125 17.875 7.3125C18.0905 7.3125 18.2972 7.3981 18.4495 7.55048C18.6019 7.70285 18.6875 7.90951 18.6875 8.125V19.5C18.6875 21.0084 18.0883 22.4551 17.0217 23.5217C15.9551 24.5883 14.5084 25.1875 13 25.1875C11.4916 25.1875 10.0449 24.5883 8.97833 23.5217C7.91172 22.4551 7.3125 21.0084 7.3125 19.5V4.875Z",
|
|
17
|
+
fill: C.fill
|
|
18
|
+
}, null, 8, i)
|
|
19
|
+
]));
|
|
20
|
+
}
|
|
21
|
+
});
|
|
19
22
|
export {
|
|
20
|
-
|
|
23
|
+
a as default
|
|
21
24
|
};
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
import { defineComponent as Oe, ref as a, inject as Ae, computed as h, watchEffect as Be, watch as j, onMounted as We, onUnmounted as Ne, createElementBlock as n, openBlock as c, Fragment as z, createCommentVNode as E, createVNode as C, unref as P, normalizeClass as se, createElementVNode as L, Transition as le, withCtx as re, withDirectives as Ve, renderList as oe, toDisplayString as ae, vShow as Re, normalizeStyle as He } from "vue";
|
|
2
|
+
import { useMessageDraft as Ie } from "../../../hooks/useMessageDraft.js";
|
|
3
|
+
import "../../../hooks/useSearchModel.js";
|
|
4
|
+
import "../../../hooks/useTheme.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
/* empty css */
|
|
7
|
+
import "../../../node_modules/linkifyjs/dist/linkify.js";
|
|
8
|
+
import "../../../functions/parseMarkdown.js";
|
|
9
|
+
import ne from "./icons/StickerIcon.vue.js";
|
|
10
|
+
import { isAnimatedSticker as F } from "../../2_feed_elements/StickerMessage/utils/stickerUtils.js";
|
|
11
|
+
import "../../2_feed_elements/StickerMessage/utils/suppress-lit-warning.js";
|
|
12
|
+
const Xe = { class: "sticker-picker__container" }, Ye = ["onClick", "onMouseenter", "onMouseleave"], je = ["src"], ze = ["src", "alt"], Ge = {
|
|
13
|
+
key: 2,
|
|
14
|
+
class: "sticker-picker__tab-icon-placeholder"
|
|
15
|
+
}, Ke = { class: "sticker-picker__content" }, qe = {
|
|
16
|
+
key: 0,
|
|
17
|
+
class: "sticker-picker__empty"
|
|
18
|
+
}, Je = {
|
|
19
|
+
key: 1,
|
|
20
|
+
class: "sticker-picker__grid"
|
|
21
|
+
}, Qe = ["onClick", "onMousedown", "onMouseenter", "onTouchstart"], Ze = ["src"], xe = ["src", "alt"], et = ["src"], tt = ["src", "alt"], st = {
|
|
22
|
+
key: 2,
|
|
23
|
+
class: "sticker-picker__preview-label"
|
|
24
|
+
}, lt = 500, pt = /* @__PURE__ */ Oe({
|
|
25
|
+
__name: "StickerPicker",
|
|
26
|
+
props: {
|
|
27
|
+
state: { default: "active" },
|
|
28
|
+
mode: { default: "click" },
|
|
29
|
+
stickers: { default: () => [] },
|
|
30
|
+
emptyText: { default: "Нет доступных стикеров" }
|
|
31
|
+
},
|
|
32
|
+
setup(U) {
|
|
33
|
+
const r = U, $ = a(null), D = a(null), O = a(null), A = a(null), v = a(!1), p = a(0), _ = Ae("chatAppId"), { getMessage: ce, setMessageFile: ie, setForceSendMessage: ue } = Ie(_), T = a("#5F5F5F"), M = a("#404040"), B = a(!1);
|
|
34
|
+
let g = null;
|
|
35
|
+
const W = () => {
|
|
36
|
+
if (!_) {
|
|
37
|
+
T.value = "#5F5F5F", M.value = "#404040";
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const e = document.getElementById(_);
|
|
41
|
+
if (!e) {
|
|
42
|
+
T.value = "#5F5F5F", M.value = "#404040";
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const t = window.getComputedStyle(e), s = t.getPropertyValue("--chotto-stickerpicker-button-span-color").trim(), l = t.getPropertyValue("--chotto-stickerpicker-button-span-hover-color").trim();
|
|
46
|
+
T.value = s || "#5F5F5F", M.value = l || "#404040";
|
|
47
|
+
}, ve = h(() => B.value ? M.value : T.value);
|
|
48
|
+
Be(() => {
|
|
49
|
+
W();
|
|
50
|
+
});
|
|
51
|
+
const i = a(null), N = a({}), m = a(null), u = a(!1), fe = a(null), f = a(/* @__PURE__ */ new Map()), d = a(/* @__PURE__ */ new Map());
|
|
52
|
+
let w = !1, S = !1;
|
|
53
|
+
const k = a(!1), V = a(!1);
|
|
54
|
+
async function G() {
|
|
55
|
+
if (!(k.value || V.value)) {
|
|
56
|
+
V.value = !0;
|
|
57
|
+
try {
|
|
58
|
+
await import("../../2_feed_elements/StickerMessage/libs/tgs-player/lottie-player.esm.js"), await import("../../2_feed_elements/StickerMessage/libs/tgs-player/tgs-player.esm.js"), k.value = !0;
|
|
59
|
+
} catch (e) {
|
|
60
|
+
console.error("Failed to load TGS libraries:", e);
|
|
61
|
+
} finally {
|
|
62
|
+
V.value = !1;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const ke = () => {
|
|
67
|
+
if (!r.stickers || !Array.isArray(r.stickers) || r.stickers.length === 0)
|
|
68
|
+
return { hasTabs: !1, tabs: [] };
|
|
69
|
+
const e = r.stickers[0], t = Array.isArray(e), s = e && typeof e == "object" && "stickers" in e;
|
|
70
|
+
return t ? {
|
|
71
|
+
hasTabs: !0,
|
|
72
|
+
tabs: r.stickers.map((l, o) => ({
|
|
73
|
+
id: `tab-${o}`,
|
|
74
|
+
label: `Set ${o + 1}`,
|
|
75
|
+
stickers: l,
|
|
76
|
+
iconUrl: l && l.length > 0 ? l[0].url : null
|
|
77
|
+
}))
|
|
78
|
+
} : s && "stickers" in e ? {
|
|
79
|
+
hasTabs: !0,
|
|
80
|
+
tabs: r.stickers.map((l, o) => ({
|
|
81
|
+
id: l.id || `tab-${o}`,
|
|
82
|
+
label: l.label || `Set ${o + 1}`,
|
|
83
|
+
stickers: l.stickers || [],
|
|
84
|
+
iconUrl: l.iconUrl || (l.stickers && l.stickers.length > 0 ? l.stickers[0].url : null)
|
|
85
|
+
}))
|
|
86
|
+
} : {
|
|
87
|
+
hasTabs: !0,
|
|
88
|
+
tabs: [{
|
|
89
|
+
id: "default",
|
|
90
|
+
label: "Stickers",
|
|
91
|
+
stickers: r.stickers,
|
|
92
|
+
iconUrl: r.stickers.length > 0 ? r.stickers[0].url : null
|
|
93
|
+
}]
|
|
94
|
+
};
|
|
95
|
+
}, R = h(() => ke()), de = h(() => R.value.hasTabs && R.value.tabs.length > 0), y = h(() => R.value.tabs), H = h(() => {
|
|
96
|
+
var e;
|
|
97
|
+
return y.value.length === 0 ? [] : ((e = y.value[p.value]) == null ? void 0 : e.stickers) || [];
|
|
98
|
+
}), K = h(() => {
|
|
99
|
+
const e = H.value.some((s) => F(s.url)), t = y.value.some((s) => s.iconUrl && F(s.iconUrl));
|
|
100
|
+
return e || t;
|
|
101
|
+
});
|
|
102
|
+
j(K, (e) => {
|
|
103
|
+
e && !k.value && G();
|
|
104
|
+
}, { immediate: !0 });
|
|
105
|
+
const I = (e) => F(e.url), pe = (e, t) => {
|
|
106
|
+
t ? f.value.set(e, t) : f.value.delete(e);
|
|
107
|
+
}, me = (e, t) => {
|
|
108
|
+
t ? d.value.set(e, t) : d.value.delete(e);
|
|
109
|
+
}, he = (e) => {
|
|
110
|
+
const t = d.value.get(e);
|
|
111
|
+
t && typeof t.play == "function" && t.play();
|
|
112
|
+
}, _e = (e) => {
|
|
113
|
+
const t = d.value.get(e);
|
|
114
|
+
t && typeof t.pause == "function" && t.pause();
|
|
115
|
+
};
|
|
116
|
+
j(p, () => {
|
|
117
|
+
f.value.clear();
|
|
118
|
+
}), j(() => r.stickers, () => {
|
|
119
|
+
p.value >= y.value.length && (p.value = 0);
|
|
120
|
+
}, { deep: !0 });
|
|
121
|
+
const ge = (e) => {
|
|
122
|
+
if (!e) return "image";
|
|
123
|
+
const t = e.toLowerCase();
|
|
124
|
+
return t.endsWith(".tgs") || t.endsWith(".webp") ? "sticker" : "image";
|
|
125
|
+
}, q = (e) => {
|
|
126
|
+
if (r.state === "disabled") return;
|
|
127
|
+
const t = ge(e.url);
|
|
128
|
+
ie({
|
|
129
|
+
url: e.url,
|
|
130
|
+
name: e.alt || `sticker.${t === "sticker" ? e.url.toLowerCase().endsWith(".tgs") ? "tgs" : "webp" : "png"}`,
|
|
131
|
+
type: t
|
|
132
|
+
}), ue(!0), r.mode === "click" && (v.value = !1);
|
|
133
|
+
}, J = (e, t) => {
|
|
134
|
+
fe.value = t.currentTarget, u.value = !1, m.value && clearTimeout(m.value), m.value = setTimeout(() => {
|
|
135
|
+
u.value = !0, we(e);
|
|
136
|
+
}, lt);
|
|
137
|
+
}, Q = () => {
|
|
138
|
+
if (X(), u.value) {
|
|
139
|
+
u.value = !1;
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
}, ye = (e, t) => {
|
|
143
|
+
if (I(e) && k.value) {
|
|
144
|
+
const s = f.value.get(t);
|
|
145
|
+
s && typeof s.play == "function" && s.play();
|
|
146
|
+
}
|
|
147
|
+
}, be = () => {
|
|
148
|
+
f.value.forEach((e) => {
|
|
149
|
+
e && typeof e.pause == "function" && e.pause();
|
|
150
|
+
}), !(u.value && i.value) && (X(), b());
|
|
151
|
+
}, Te = (e, t) => {
|
|
152
|
+
const s = new MouseEvent("mousedown", {
|
|
153
|
+
bubbles: !0,
|
|
154
|
+
cancelable: !0,
|
|
155
|
+
clientX: t.touches[0].clientX,
|
|
156
|
+
clientY: t.touches[0].clientY
|
|
157
|
+
});
|
|
158
|
+
J(e, s);
|
|
159
|
+
}, Z = () => {
|
|
160
|
+
Q();
|
|
161
|
+
}, Me = (e, t) => {
|
|
162
|
+
if (u.value) {
|
|
163
|
+
t.preventDefault(), t.stopPropagation(), u.value = !1, b();
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
q(e);
|
|
167
|
+
}, X = () => {
|
|
168
|
+
m.value && (clearTimeout(m.value), m.value = null);
|
|
169
|
+
}, we = (e) => {
|
|
170
|
+
i.value = e, N.value = {
|
|
171
|
+
left: "50%",
|
|
172
|
+
top: "50%",
|
|
173
|
+
transform: "translate(-50%, -50%)"
|
|
174
|
+
};
|
|
175
|
+
}, b = () => {
|
|
176
|
+
i.value = null, N.value = {};
|
|
177
|
+
}, Se = () => {
|
|
178
|
+
i.value && (q(i.value), b());
|
|
179
|
+
}, x = () => {
|
|
180
|
+
r.state === "active" && (v.value = !0);
|
|
181
|
+
}, Y = () => {
|
|
182
|
+
f.value.forEach((e) => {
|
|
183
|
+
e && typeof e.pause == "function" && e.pause();
|
|
184
|
+
}), d.value.forEach((e) => {
|
|
185
|
+
e && typeof e.pause == "function" && e.pause();
|
|
186
|
+
}), v.value = !1;
|
|
187
|
+
}, Ee = () => {
|
|
188
|
+
r.mode === "click" && (v.value = !v.value, v.value && x());
|
|
189
|
+
}, Ce = () => {
|
|
190
|
+
r.mode === "hover" && (w = !0, x());
|
|
191
|
+
}, Pe = () => {
|
|
192
|
+
r.mode === "hover" && (w = !1, setTimeout(() => {
|
|
193
|
+
!S && !w && Y();
|
|
194
|
+
}, 150));
|
|
195
|
+
}, Le = () => {
|
|
196
|
+
B.value = !0, Ce();
|
|
197
|
+
}, Fe = () => {
|
|
198
|
+
B.value = !1, Pe();
|
|
199
|
+
}, Ue = () => {
|
|
200
|
+
r.mode === "hover" && (S = !0);
|
|
201
|
+
}, $e = () => {
|
|
202
|
+
r.mode === "hover" && (S = !1, setTimeout(() => {
|
|
203
|
+
!w && !S && Y();
|
|
204
|
+
}, 150));
|
|
205
|
+
}, De = (e) => {
|
|
206
|
+
if (!O.value) return;
|
|
207
|
+
const t = e.shiftKey || Math.abs(e.deltaX) > Math.abs(e.deltaY) ? e.deltaX : e.deltaY;
|
|
208
|
+
O.value.scrollLeft += t, e.preventDefault();
|
|
209
|
+
}, ee = (e) => {
|
|
210
|
+
r.mode === "click" && v.value && D.value && $.value && e.target instanceof Node && !D.value.contains(e.target) && !$.value.contains(e.target) && Y(), i.value && A.value && e.target instanceof Node && !A.value.contains(e.target) && b();
|
|
211
|
+
}, te = () => {
|
|
212
|
+
u.value && (u.value = !1);
|
|
213
|
+
};
|
|
214
|
+
return We(() => {
|
|
215
|
+
if (document.addEventListener("click", ee), document.addEventListener("mouseup", te), W(), _) {
|
|
216
|
+
const e = document.getElementById(_);
|
|
217
|
+
e && (g = new MutationObserver((t) => {
|
|
218
|
+
t.forEach((s) => {
|
|
219
|
+
s.type === "attributes" && s.attributeName === "data-theme" && W();
|
|
220
|
+
});
|
|
221
|
+
}), g.observe(e, {
|
|
222
|
+
attributes: !0,
|
|
223
|
+
attributeFilter: ["data-theme"]
|
|
224
|
+
}));
|
|
225
|
+
}
|
|
226
|
+
K.value && !k.value && G();
|
|
227
|
+
}), Ne(() => {
|
|
228
|
+
document.removeEventListener("click", ee), document.removeEventListener("mouseup", te), X(), b(), g && (g.disconnect(), g = null), f.value.forEach((e) => {
|
|
229
|
+
e && typeof e.pause == "function" && e.pause();
|
|
230
|
+
}), f.value.clear(), d.value.forEach((e) => {
|
|
231
|
+
e && typeof e.pause == "function" && e.pause();
|
|
232
|
+
}), d.value.clear();
|
|
233
|
+
}), (e, t) => (c(), n(z, null, [
|
|
234
|
+
P(ce)().isRecording ? E("", !0) : (c(), n("button", {
|
|
235
|
+
key: 0,
|
|
236
|
+
ref_key: "stickerButton",
|
|
237
|
+
ref: D,
|
|
238
|
+
class: se(["button", { "button-disabled": U.state === "disabled" }]),
|
|
239
|
+
onClick: Ee,
|
|
240
|
+
onMouseenter: Le,
|
|
241
|
+
onMouseleave: Fe
|
|
242
|
+
}, [
|
|
243
|
+
L("span", null, [
|
|
244
|
+
C(P(ne), { fill: ve.value }, null, 8, ["fill"])
|
|
245
|
+
])
|
|
246
|
+
], 34)),
|
|
247
|
+
C(le, null, {
|
|
248
|
+
default: re(() => [
|
|
249
|
+
Ve(L("div", {
|
|
250
|
+
ref_key: "stickerPicker",
|
|
251
|
+
ref: $,
|
|
252
|
+
class: "sticker-picker",
|
|
253
|
+
onMouseenter: Ue,
|
|
254
|
+
onMouseleave: $e
|
|
255
|
+
}, [
|
|
256
|
+
L("div", Xe, [
|
|
257
|
+
de.value ? (c(), n("div", {
|
|
258
|
+
key: 0,
|
|
259
|
+
ref_key: "tabsContainer",
|
|
260
|
+
ref: O,
|
|
261
|
+
class: "sticker-picker__tabs",
|
|
262
|
+
onWheel: De
|
|
263
|
+
}, [
|
|
264
|
+
(c(!0), n(z, null, oe(y.value, (s, l) => (c(), n("button", {
|
|
265
|
+
key: l,
|
|
266
|
+
class: se(["sticker-picker__tab", { "sticker-picker__tab--active": p.value === l }]),
|
|
267
|
+
onClick: (o) => p.value = l,
|
|
268
|
+
onMouseenter: (o) => he(l),
|
|
269
|
+
onMouseleave: (o) => _e(l)
|
|
270
|
+
}, [
|
|
271
|
+
s.iconUrl && P(F)(s.iconUrl) && k.value ? (c(), n("tgs-player", {
|
|
272
|
+
key: 0,
|
|
273
|
+
ref_for: !0,
|
|
274
|
+
ref: (o) => me(l, o),
|
|
275
|
+
src: s.iconUrl,
|
|
276
|
+
class: "sticker-picker__tab-icon sticker-picker__tab-icon-animated",
|
|
277
|
+
loop: "",
|
|
278
|
+
mode: "normal"
|
|
279
|
+
}, null, 8, je)) : s.iconUrl ? (c(), n("img", {
|
|
280
|
+
key: 1,
|
|
281
|
+
src: s.iconUrl,
|
|
282
|
+
alt: s.label || `Tab ${l + 1}`,
|
|
283
|
+
class: "sticker-picker__tab-icon"
|
|
284
|
+
}, null, 8, ze)) : (c(), n("span", Ge, [
|
|
285
|
+
C(P(ne))
|
|
286
|
+
]))
|
|
287
|
+
], 42, Ye))), 128))
|
|
288
|
+
], 544)) : E("", !0),
|
|
289
|
+
L("div", Ke, [
|
|
290
|
+
H.value.length === 0 ? (c(), n("div", qe, ae(U.emptyText), 1)) : (c(), n("div", Je, [
|
|
291
|
+
(c(!0), n(z, null, oe(H.value, (s, l) => (c(), n("button", {
|
|
292
|
+
key: l,
|
|
293
|
+
class: "sticker-picker__item",
|
|
294
|
+
onClick: (o) => Me(s, o),
|
|
295
|
+
onMousedown: (o) => J(s, o),
|
|
296
|
+
onMouseup: Q,
|
|
297
|
+
onMouseenter: (o) => ye(s, l),
|
|
298
|
+
onMouseleave: be,
|
|
299
|
+
onTouchstart: (o) => Te(s, o),
|
|
300
|
+
onTouchend: Z,
|
|
301
|
+
onTouchcancel: Z
|
|
302
|
+
}, [
|
|
303
|
+
I(s) && k.value ? (c(), n("tgs-player", {
|
|
304
|
+
key: 0,
|
|
305
|
+
ref_for: !0,
|
|
306
|
+
ref: (o) => pe(l, o),
|
|
307
|
+
src: s.url,
|
|
308
|
+
class: "sticker-picker__image sticker-picker__image-animated",
|
|
309
|
+
loop: "",
|
|
310
|
+
mode: "normal"
|
|
311
|
+
}, null, 8, Ze)) : (c(), n("img", {
|
|
312
|
+
key: 1,
|
|
313
|
+
src: s.url,
|
|
314
|
+
alt: s.alt || `Sticker ${l + 1}`,
|
|
315
|
+
class: "sticker-picker__image"
|
|
316
|
+
}, null, 8, xe))
|
|
317
|
+
], 40, Qe))), 128))
|
|
318
|
+
]))
|
|
319
|
+
])
|
|
320
|
+
])
|
|
321
|
+
], 544), [
|
|
322
|
+
[Re, v.value]
|
|
323
|
+
])
|
|
324
|
+
]),
|
|
325
|
+
_: 1
|
|
326
|
+
}),
|
|
327
|
+
C(le, { name: "preview" }, {
|
|
328
|
+
default: re(() => [
|
|
329
|
+
i.value ? (c(), n("div", {
|
|
330
|
+
key: 0,
|
|
331
|
+
ref_key: "previewElement",
|
|
332
|
+
ref: A,
|
|
333
|
+
class: "sticker-picker__preview",
|
|
334
|
+
style: He(N.value),
|
|
335
|
+
onClick: Se
|
|
336
|
+
}, [
|
|
337
|
+
I(i.value) && k.value ? (c(), n("tgs-player", {
|
|
338
|
+
key: 0,
|
|
339
|
+
src: i.value.url,
|
|
340
|
+
class: "sticker-picker__preview-image sticker-picker__preview-image-animated",
|
|
341
|
+
autoplay: "",
|
|
342
|
+
loop: "",
|
|
343
|
+
mode: "normal"
|
|
344
|
+
}, null, 8, et)) : (c(), n("img", {
|
|
345
|
+
key: 1,
|
|
346
|
+
src: i.value.url,
|
|
347
|
+
alt: i.value.alt || "Preview",
|
|
348
|
+
class: "sticker-picker__preview-image"
|
|
349
|
+
}, null, 8, tt)),
|
|
350
|
+
i.value.alt ? (c(), n("div", st, ae(i.value.alt), 1)) : E("", !0)
|
|
351
|
+
], 4)) : E("", !0)
|
|
352
|
+
]),
|
|
353
|
+
_: 1
|
|
354
|
+
})
|
|
355
|
+
], 64));
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
export {
|
|
359
|
+
pt as default
|
|
360
|
+
};
|