@mobilon-dev/chotto 0.3.101 → 0.3.103
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_chatinput_elements/FilePreview/FilePreview.vue.js +4 -3
- package/dist/components/2_chatinput_elements/FilePreview/FilePreview.vue2.js +72 -119
- package/dist/components/2_chatinput_elements/FileUploader/FileUploader.vue.js +2 -2
- package/dist/components/2_chatinput_elements/FileUploader/FileUploader.vue2.js +109 -88
- package/dist/components/3_compounds/ChatInput/ChatInput.vue.js +2 -2
- package/dist/components/3_compounds/ChatInput/ChatInput.vue2.js +334 -225
- package/dist/components/3_compounds/ChatInput/icons/ArrowIcon.vue.js +40 -0
- package/dist/hooks/uploadFile/generatePreview.js +19 -18
- package/dist/hooks/useMessageDraft.js +85 -65
- package/dist/index.js +159 -157
- package/dist/locale/en.js +4 -0
- package/dist/locale/ru.js +4 -0
- 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_chatinput_elements/FilePreview/stories/FilePreview.stories.d.ts +3 -3
- package/dist/types/components/2_chatinput_elements/FilePreview/styles/types.d.ts +135 -127
- package/dist/types/components/2_chatinput_elements/FileUploader/FileUploader.vue.d.ts +9 -0
- package/dist/types/components/3_compounds/ChatInput/ChatInput.vue.d.ts +14 -3
- package/dist/types/components/3_compounds/ChatInput/icons/ArrowIcon.vue.d.ts +2 -0
- package/dist/types/components/3_compounds/ChatInput/icons/index.d.ts +1 -0
- package/dist/types/components/3_compounds/ChatInput/styles/types.d.ts +74 -0
- package/dist/types/hooks/useMessageDraft.d.ts +10 -3
- package/dist/types/locale/en.d.ts +4 -0
- package/dist/types/locale/ru.d.ts +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createElementBlock as l, openBlock as n, createElementVNode as e } from "vue";
|
|
2
|
+
import o from "../../../../_virtual/_plugin-vue_export-helper.js";
|
|
3
|
+
const r = {}, s = {
|
|
4
|
+
id: "svg1",
|
|
5
|
+
width: "22",
|
|
6
|
+
height: "32",
|
|
7
|
+
viewBox: "0 0 22 32",
|
|
8
|
+
fill: "none",
|
|
9
|
+
version: "1.1",
|
|
10
|
+
"xml:space": "preserve",
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
"xmlns:svg": "http://www.w3.org/2000/svg"
|
|
13
|
+
};
|
|
14
|
+
function f(i, t) {
|
|
15
|
+
return n(), l("svg", s, [...t[0] || (t[0] = [
|
|
16
|
+
e("defs", { id: "defs1" }, null, -1),
|
|
17
|
+
e("path", {
|
|
18
|
+
id: "path1",
|
|
19
|
+
d: "M0 16C0 7.16344 7.16344 0 16 0H22V32H16C7.16344 32 0 24.8366 0 16Z",
|
|
20
|
+
fill: "#D0D0D0"
|
|
21
|
+
}, null, -1),
|
|
22
|
+
e("g", {
|
|
23
|
+
id: "g1",
|
|
24
|
+
style: { fill: "none" },
|
|
25
|
+
transform: "translate(1.99999,6.99915)"
|
|
26
|
+
}, [
|
|
27
|
+
e("path", {
|
|
28
|
+
id: "path1-8",
|
|
29
|
+
"fill-rule": "evenodd",
|
|
30
|
+
"clip-rule": "evenodd",
|
|
31
|
+
d: "M 7.22678,1.85276 C 7.27903,1.80037 7.3411,1.75881 7.40944,1.73045 7.47778,1.7021 7.55104,1.6875 7.62503,1.6875 c 0.07399,0 0.14725,0.0146 0.21559,0.04295 0.06833,0.02836 0.13041,0.06992 0.18266,0.12231 l 6.75002,6.75 c 0.0524,0.05225 0.0939,0.11432 0.1223,0.18266 0.0283,0.06834 0.0429,0.1416 0.0429,0.21559 0,0.07398 -0.0146,0.14724 -0.0429,0.21558 C 14.8672,9.28493 14.8257,9.347 14.7733,9.39926 L 8.02328,16.1493 C 7.91766,16.2549 7.7744,16.3142 7.62503,16.3142 7.47566,16.3142 7.3324,16.2549 7.22678,16.1493 7.12116,16.0436 7.06182,15.9004 7.06182,15.751 c 0,-0.1494 0.05934,-0.2926 0.16496,-0.3982 L 13.5797,9.00101 7.22678,2.64926 C 7.17439,2.597 7.13283,2.53493 7.10448,2.46659 7.07612,2.39826 7.06152,2.32499 7.06152,2.25101 c 0,-0.07399 0.0146,-0.14725 0.04296,-0.21559 0.02835,-0.06834 0.06991,-0.13041 0.1223,-0.18266 z",
|
|
32
|
+
fill: "#ffffff"
|
|
33
|
+
})
|
|
34
|
+
], -1)
|
|
35
|
+
])]);
|
|
36
|
+
}
|
|
37
|
+
const p = /* @__PURE__ */ o(r, [["render", f]]);
|
|
38
|
+
export {
|
|
39
|
+
p as default
|
|
40
|
+
};
|
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { getTypeFileByMime as
|
|
3
|
-
const
|
|
4
|
-
const e =
|
|
5
|
-
e === "image" ?
|
|
6
|
-
const
|
|
7
|
-
let
|
|
8
|
-
for (; l
|
|
9
|
-
|
|
1
|
+
import { ref as a } from "vue";
|
|
2
|
+
import { getTypeFileByMime as f } from "./getTypeFileByMime.js";
|
|
3
|
+
const c = (t) => {
|
|
4
|
+
const e = f(t.type), s = a(!1), o = a(!1), r = a(!1), u = a("");
|
|
5
|
+
e === "image" ? s.value = !0 : e === "video" ? o.value = !0 : e === "audio" && (r.value = !0), s.value || o.value || r.value ? u.value = URL.createObjectURL(t) : u.value = "";
|
|
6
|
+
const n = ["Б", "КБ", "МБ", "ГБ"];
|
|
7
|
+
let i = t.size, l = 0;
|
|
8
|
+
for (; i >= 1024 && l < n.length - 1; )
|
|
9
|
+
i = i / 1024, l++;
|
|
10
|
+
const d = l === 0 || Math.abs(i - Math.round(i)) < 0.05 ? String(Math.round(i)) : i.toFixed(1);
|
|
10
11
|
return {
|
|
11
|
-
isImage:
|
|
12
|
-
isVideo:
|
|
13
|
-
isAudio:
|
|
14
|
-
previewUrl:
|
|
15
|
-
fileSize:
|
|
12
|
+
isImage: s.value,
|
|
13
|
+
isVideo: o.value,
|
|
14
|
+
isAudio: r.value,
|
|
15
|
+
previewUrl: u.value,
|
|
16
|
+
fileSize: `${d} ${n[l]}`
|
|
16
17
|
};
|
|
17
18
|
};
|
|
18
|
-
function
|
|
19
|
+
function g(t, e) {
|
|
19
20
|
if (e)
|
|
20
21
|
return {
|
|
21
22
|
previewUrl: e.previewUrl,
|
|
22
23
|
isImage: e.isImage,
|
|
23
24
|
isVideo: e.isVideo,
|
|
24
25
|
isAudio: e.isAudio,
|
|
25
|
-
fileName:
|
|
26
|
+
fileName: t,
|
|
26
27
|
fileSize: e.fileSize
|
|
27
28
|
};
|
|
28
29
|
}
|
|
29
30
|
export {
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
g as buildFilePreview,
|
|
32
|
+
c as generatePreview
|
|
32
33
|
};
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
1
|
+
import { ref as S, getCurrentInstance as E, inject as $, computed as A, unref as N, watch as m } from "vue";
|
|
2
|
+
const a = 5;
|
|
3
|
+
function d(t) {
|
|
4
|
+
var i;
|
|
5
|
+
return t ? (i = t.files) != null && i.length ? t.files : t.file ? [t.file] : [] : [];
|
|
6
|
+
}
|
|
7
|
+
function f(t, i = a) {
|
|
8
|
+
const o = Number.isFinite(i) && i > 0 ? Math.floor(i) : a, s = t.slice(0, o);
|
|
9
|
+
return s.length ? { files: s, file: s[0] } : { file: void 0, files: void 0 };
|
|
10
|
+
}
|
|
11
|
+
const l = S([]);
|
|
12
|
+
function _(t) {
|
|
4
13
|
return {
|
|
5
14
|
id: t,
|
|
6
15
|
text: "",
|
|
@@ -9,136 +18,147 @@ function S(t) {
|
|
|
9
18
|
isRecording: !1
|
|
10
19
|
};
|
|
11
20
|
}
|
|
12
|
-
function
|
|
13
|
-
const i =
|
|
21
|
+
function p(t) {
|
|
22
|
+
const i = l.value.find((s) => s.id === t);
|
|
14
23
|
if (i) return i;
|
|
15
|
-
const
|
|
16
|
-
return
|
|
24
|
+
const o = _(t);
|
|
25
|
+
return l.value.push(o), o;
|
|
17
26
|
}
|
|
18
27
|
function k(t, i) {
|
|
19
28
|
if (!(i == null || i === ""))
|
|
20
|
-
return
|
|
29
|
+
return l.value.find((o) => o.id === `${t}:${i}`);
|
|
21
30
|
}
|
|
22
|
-
function
|
|
31
|
+
function h(t) {
|
|
23
32
|
return t.replace(/\s+/g, " ").trim();
|
|
24
33
|
}
|
|
25
|
-
function
|
|
26
|
-
var
|
|
34
|
+
function x(t) {
|
|
35
|
+
var r;
|
|
27
36
|
if (!t) return;
|
|
28
37
|
if (t.edit) {
|
|
29
38
|
t.listPreviewText = void 0, t.listPreviewFile = void 0;
|
|
30
39
|
return;
|
|
31
40
|
}
|
|
32
|
-
const i =
|
|
41
|
+
const i = h(t.text || "");
|
|
33
42
|
t.listPreviewText = i || void 0;
|
|
34
|
-
const s = (
|
|
35
|
-
t.listPreviewFile =
|
|
43
|
+
const s = d(t)[0], v = (s == null ? void 0 : s.name) || ((r = s == null ? void 0 : s.preview) == null ? void 0 : r.fileName) || "";
|
|
44
|
+
t.listPreviewFile = s ? { name: v, type: s.type } : void 0;
|
|
36
45
|
}
|
|
37
|
-
function
|
|
38
|
-
return !!(
|
|
46
|
+
function B(t) {
|
|
47
|
+
return !!(h(t.text || "") || d(t).length);
|
|
39
48
|
}
|
|
40
|
-
function
|
|
49
|
+
function b(t) {
|
|
41
50
|
t.listPreviewText = void 0, t.listPreviewFile = void 0;
|
|
42
51
|
}
|
|
43
52
|
function q(t) {
|
|
44
|
-
t &&
|
|
53
|
+
t && x(l.value.find((i) => i.id === t));
|
|
45
54
|
}
|
|
46
|
-
function
|
|
55
|
+
function j(t, i) {
|
|
47
56
|
if (typeof document > "u") return;
|
|
48
|
-
const
|
|
49
|
-
|
|
57
|
+
const o = document.getElementById("chat-input-reply-line-" + t);
|
|
58
|
+
o && (o.style.display = i.reply || i.edit ? "inherit" : "none");
|
|
50
59
|
}
|
|
51
60
|
const z = (t) => {
|
|
52
|
-
const i =
|
|
53
|
-
const e = i ?
|
|
61
|
+
const i = E() ? $("selectedChat", void 0) : void 0, o = A(() => {
|
|
62
|
+
const e = i ? N(i) : void 0, n = e == null ? void 0 : e.chatId;
|
|
54
63
|
return n == null || n === "" ? t : `${t}:${n}`;
|
|
55
64
|
});
|
|
56
|
-
|
|
57
|
-
|
|
65
|
+
m(
|
|
66
|
+
o,
|
|
58
67
|
(e, n) => {
|
|
59
|
-
const
|
|
68
|
+
const u = p(e);
|
|
60
69
|
if (n !== void 0 && n !== e) {
|
|
61
|
-
const
|
|
62
|
-
g
|
|
70
|
+
const g = l.value.find((L) => L.id === n);
|
|
71
|
+
x(g), j(t, u);
|
|
63
72
|
}
|
|
64
73
|
},
|
|
65
74
|
{ immediate: !0 }
|
|
66
|
-
),
|
|
75
|
+
), m(
|
|
67
76
|
() => {
|
|
68
|
-
|
|
69
|
-
|
|
77
|
+
var n;
|
|
78
|
+
const e = c();
|
|
79
|
+
return [e.text, e.file, (n = e.files) == null ? void 0 : n.length];
|
|
70
80
|
},
|
|
71
81
|
() => {
|
|
72
|
-
const e =
|
|
82
|
+
const e = c();
|
|
73
83
|
if (!e.edit) {
|
|
74
|
-
if (!
|
|
75
|
-
|
|
84
|
+
if (!B(e)) {
|
|
85
|
+
b(e);
|
|
76
86
|
return;
|
|
77
87
|
}
|
|
78
|
-
e.
|
|
88
|
+
d(e).length || (e.listPreviewFile = void 0), h(e.text || "") || (e.listPreviewText = void 0);
|
|
79
89
|
}
|
|
80
90
|
}
|
|
81
91
|
);
|
|
82
|
-
const
|
|
83
|
-
const e =
|
|
84
|
-
return n !== -1 ? n : (
|
|
85
|
-
},
|
|
86
|
-
const e =
|
|
87
|
-
|
|
92
|
+
const s = () => {
|
|
93
|
+
const e = o.value, n = l.value.findIndex((u) => u.id === e);
|
|
94
|
+
return n !== -1 ? n : (p(e), l.value.findIndex((u) => u.id === e));
|
|
95
|
+
}, v = () => {
|
|
96
|
+
const e = c();
|
|
97
|
+
l.value[s()] = {
|
|
88
98
|
id: e.id,
|
|
89
99
|
text: "",
|
|
90
100
|
file: void 0,
|
|
101
|
+
files: void 0,
|
|
91
102
|
reply: void 0,
|
|
92
103
|
edit: void 0,
|
|
93
104
|
forceSend: !1,
|
|
94
105
|
isRecording: e.isRecording
|
|
95
106
|
};
|
|
96
107
|
}, r = (e) => {
|
|
97
|
-
const n =
|
|
98
|
-
|
|
108
|
+
const n = c();
|
|
109
|
+
l.value[s()] = {
|
|
99
110
|
...n,
|
|
100
111
|
forceSend: !1,
|
|
101
112
|
...e,
|
|
102
113
|
id: n.id
|
|
103
114
|
};
|
|
104
|
-
}, p = (e) => {
|
|
105
|
-
r({ text: e });
|
|
106
|
-
}, m = (e) => {
|
|
107
|
-
r({ file: e });
|
|
108
|
-
}, x = () => {
|
|
109
|
-
r({ file: void 0 });
|
|
110
115
|
}, y = (e) => {
|
|
116
|
+
r({ text: e });
|
|
117
|
+
}, M = (e) => {
|
|
118
|
+
r(f([e]));
|
|
119
|
+
}, w = (e, n = a) => {
|
|
120
|
+
e.length && r(f([...d(c()), ...e], n));
|
|
121
|
+
}, F = (e) => {
|
|
122
|
+
const n = d(c()).filter((u, g) => g !== e);
|
|
123
|
+
r(f(n, n.length || a));
|
|
124
|
+
}, D = () => {
|
|
125
|
+
r(f([]));
|
|
126
|
+
}, P = (e) => {
|
|
111
127
|
r({ reply: e, edit: void 0 });
|
|
112
|
-
},
|
|
128
|
+
}, T = () => {
|
|
113
129
|
r({ reply: void 0 });
|
|
114
|
-
},
|
|
130
|
+
}, C = (e) => {
|
|
115
131
|
r({ edit: e, reply: void 0 });
|
|
116
|
-
},
|
|
132
|
+
}, R = () => {
|
|
117
133
|
r({ edit: void 0 });
|
|
118
134
|
};
|
|
119
|
-
function
|
|
120
|
-
return
|
|
135
|
+
function c() {
|
|
136
|
+
return p(o.value);
|
|
121
137
|
}
|
|
122
138
|
return {
|
|
123
|
-
getMessage:
|
|
124
|
-
resetMessage:
|
|
125
|
-
setMessageFile:
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
139
|
+
getMessage: c,
|
|
140
|
+
resetMessage: v,
|
|
141
|
+
setMessageFile: M,
|
|
142
|
+
addMessageFiles: w,
|
|
143
|
+
removeMessageFile: F,
|
|
144
|
+
resetMessageFile: D,
|
|
145
|
+
setMessageText: y,
|
|
146
|
+
setReply: P,
|
|
147
|
+
resetReply: T,
|
|
148
|
+
setEdit: C,
|
|
149
|
+
resetEdit: R,
|
|
132
150
|
setForceSendMessage: (e) => {
|
|
133
|
-
|
|
151
|
+
c().forceSend = e;
|
|
134
152
|
},
|
|
135
153
|
setRecordingMessage: (e) => {
|
|
136
|
-
|
|
154
|
+
c().isRecording = e;
|
|
137
155
|
}
|
|
138
156
|
};
|
|
139
157
|
};
|
|
140
158
|
export {
|
|
159
|
+
a as MAX_ATTACHED_FILES,
|
|
141
160
|
q as commitChatDraftToList,
|
|
142
161
|
k as getChatDraft,
|
|
162
|
+
d as getDraftFiles,
|
|
143
163
|
z as useMessageDraft
|
|
144
164
|
};
|