@mobilon-dev/chotto 0.3.14 → 0.3.16

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.
Files changed (28) hide show
  1. package/dist/CreateChat-p5-IFFaJ.js +31 -0
  2. package/dist/CreateChat2-DtgNZff2.js +129 -0
  3. package/dist/CreateDialog-CAbZOmnY.js +77 -0
  4. package/dist/ModalVideoRecorder--BE7U7HJ.js +143 -0
  5. package/dist/SelectUser2-C3Lpkkcw.js +46 -0
  6. package/dist/chotto.css +1 -1
  7. package/dist/index-CPYmSpDE.js +21464 -0
  8. package/dist/themes/dark.css +1 -1
  9. package/dist/themes/default.css +1 -1
  10. package/dist/themes/green.css +1 -1
  11. package/dist/themes/mobilon1.css +1 -1
  12. package/dist/types/components/2_modals/CreateChat2/CreateChat2.vue.d.ts +19 -0
  13. package/dist/types/components/2_modals/CreateChat2/stories/CreateChat2.stories.d.ts +19 -0
  14. package/dist/types/components/2_modals/CreateChat2/styles/types.d.ts +95 -0
  15. package/dist/types/components/2_modals/Modal/Modal.vue.d.ts +2 -0
  16. package/dist/types/components/2_modals/Modal/stories/Modal.stories.d.ts +6 -0
  17. package/dist/types/components/2_modals/Modal/styles/types.d.ts +4 -0
  18. package/dist/types/components/3_compounds/Feed/Feed.vue.d.ts +9 -0
  19. package/dist/types/components/index.d.ts +1 -6
  20. package/dist/vuessages.es.js +105 -21657
  21. package/dist/vuessages.umd.js +27 -27
  22. package/package.json +1 -1
  23. /package/dist/types/components/{2_blocks → 2_modals}/SelectUser/SelectUser.vue.d.ts +0 -0
  24. /package/dist/types/components/{2_blocks → 2_modals}/SelectUser/stories/SelectUser.stories.d.ts +0 -0
  25. /package/dist/types/components/{2_blocks → 2_modals}/SelectUser/styles/types.d.ts +0 -0
  26. /package/dist/types/components/{2_blocks → 2_modals}/SelectUser2/SelectUser2.vue.d.ts +0 -0
  27. /package/dist/types/components/{2_blocks → 2_modals}/SelectUser2/stories/SelectUser2.stories.d.ts +0 -0
  28. /package/dist/types/components/{2_blocks → 2_modals}/SelectUser2/styles/types.d.ts +0 -0
@@ -0,0 +1,31 @@
1
+ import { ref as s, createElementBlock as c, openBlock as m, createElementVNode as n, withDirectives as p, toDisplayString as u, vModelText as d } from "vue";
2
+ import { _ } from "./index-CPYmSpDE.js";
3
+ const f = {
4
+ __name: "CreateChat",
5
+ props: {
6
+ title: {
7
+ type: String,
8
+ required: !0
9
+ }
10
+ },
11
+ emits: ["change"],
12
+ setup(a, { emit: o }) {
13
+ const e = s(""), r = o, l = () => {
14
+ r("change", { name: e.value });
15
+ };
16
+ return (v, t) => (m(), c("div", null, [
17
+ n("h2", null, u(a.title), 1),
18
+ p(n("input", {
19
+ "onUpdate:modelValue": t[0] || (t[0] = (i) => e.value = i),
20
+ type: "text",
21
+ class: "name",
22
+ onInput: l
23
+ }, null, 544), [
24
+ [d, e.value]
25
+ ])
26
+ ]));
27
+ }
28
+ }, x = /* @__PURE__ */ _(f, [["__scopeId", "data-v-65f726e8"]]);
29
+ export {
30
+ x as default
31
+ };
@@ -0,0 +1,129 @@
1
+ import { ref as m, createElementBlock as p, openBlock as f, createElementVNode as l, toDisplayString as h, withDirectives as D, createCommentVNode as V, normalizeClass as x, vModelText as y } from "vue";
2
+ import { _ as z } from "./index-CPYmSpDE.js";
3
+ const N = { class: "create-chat-form" }, S = { class: "create-chat-title" }, T = { class: "form-field" }, U = {
4
+ key: 0,
5
+ class: "form-error"
6
+ }, q = { class: "form-field" }, w = {
7
+ key: 0,
8
+ class: "form-error"
9
+ }, M = {
10
+ __name: "CreateChat2",
11
+ props: {
12
+ title: {
13
+ type: String,
14
+ required: !0
15
+ }
16
+ },
17
+ emits: ["change"],
18
+ setup(C, { expose: E, emit: P }) {
19
+ const r = m({}), a = m({
20
+ name: "",
21
+ phone: ""
22
+ }), c = m(!1), b = P, k = () => {
23
+ a.value = {
24
+ name: "",
25
+ phone: ""
26
+ };
27
+ }, B = () => {
28
+ c.value = !1;
29
+ }, F = (t, e) => {
30
+ a.value[t] = e;
31
+ }, d = (t) => !t || t.trim().length < 3 ? "Имя должно содержать минимум 3 символа" : "", v = (t) => {
32
+ if (!c.value)
33
+ return "";
34
+ if (!t)
35
+ return "Телефон обязателен для заполнения";
36
+ const e = t.replace(/\D/g, "");
37
+ return e.length < 11 ? "Минимум 11 цифр" : e.startsWith("7") ? "" : "Номер телефона должен начинаться с цифры 7";
38
+ }, I = (t) => {
39
+ if (!t) return !1;
40
+ const e = t.replace(/\D/g, "");
41
+ return !(e.length < 11 || !e.startsWith("7"));
42
+ }, s = () => {
43
+ const t = d(r.value.name), e = v(r.value.phone), n = I(r.value.phone);
44
+ return a.value = {
45
+ name: t,
46
+ phone: e
47
+ }, !t && n;
48
+ }, u = (t) => (t || "").replace(/\D/g, ""), g = (t) => {
49
+ const e = u(t);
50
+ let n = e;
51
+ if (e.startsWith("8") && (n = "7" + e.slice(1)), n.startsWith("7") || (n = "7" + n), n = n.slice(0, 11), n.length <= 1)
52
+ return n ? "+" + n : "";
53
+ const i = "+7";
54
+ if (n.length > 1) {
55
+ const o = n.slice(1);
56
+ return o.length <= 3 ? i + " (" + o : o.length <= 6 ? i + " (" + o.slice(0, 3) + ") " + o.slice(3) : o.length <= 8 ? i + " (" + o.slice(0, 3) + ") " + o.slice(3, 6) + "-" + o.slice(6) : i + " (" + o.slice(0, 3) + ") " + o.slice(3, 6) + "-" + o.slice(6, 8) + "-" + o.slice(8);
57
+ }
58
+ return i;
59
+ }, W = () => {
60
+ const t = r.value.phone ?? "", e = g(t);
61
+ e !== t && (r.value = {
62
+ ...r.value,
63
+ phone: e
64
+ });
65
+ }, _ = () => {
66
+ W(), s(), b("change", {
67
+ contact: r.value,
68
+ contactDigits: u(r.value.phone),
69
+ isValid: s()
70
+ });
71
+ };
72
+ return E({
73
+ clearValidationErrors: k,
74
+ resetTouchedState: B,
75
+ setValidationError: F,
76
+ validateForm: s,
77
+ validateName: d,
78
+ validatePhone: v,
79
+ formatPhone: g,
80
+ extractDigits: u,
81
+ validationErrors: a,
82
+ phoneInputTouched: c
83
+ }), (t, e) => (f(), p("div", N, [
84
+ l("h2", S, h(C.title), 1),
85
+ l("div", T, [
86
+ e[3] || (e[3] = l("label", {
87
+ class: "form-label",
88
+ for: "contact-name"
89
+ }, "Имя", -1)),
90
+ D(l("input", {
91
+ id: "contact-name",
92
+ "onUpdate:modelValue": e[0] || (e[0] = (n) => r.value.name = n),
93
+ name: "name",
94
+ type: "text",
95
+ class: x(["form-input", { "form-input--error": a.value.name }]),
96
+ placeholder: "Введите имя",
97
+ onInput: _,
98
+ onBlur: s
99
+ }, null, 34), [
100
+ [y, r.value.name]
101
+ ]),
102
+ a.value.name ? (f(), p("div", U, h(a.value.name), 1)) : V("", !0)
103
+ ]),
104
+ l("div", q, [
105
+ e[4] || (e[4] = l("label", {
106
+ class: "form-label",
107
+ for: "contact-phone"
108
+ }, "Телефон", -1)),
109
+ D(l("input", {
110
+ id: "contact-phone",
111
+ "onUpdate:modelValue": e[1] || (e[1] = (n) => r.value.phone = n),
112
+ name: "phone",
113
+ type: "text",
114
+ class: x(["form-input", { "form-input--error": a.value.phone }]),
115
+ placeholder: "+7 (999) 999-99-99",
116
+ onInput: _,
117
+ onFocus: e[2] || (e[2] = (n) => c.value = !0),
118
+ onBlur: s
119
+ }, null, 34), [
120
+ [y, r.value.phone]
121
+ ]),
122
+ a.value.phone ? (f(), p("div", w, h(a.value.phone), 1)) : V("", !0)
123
+ ])
124
+ ]));
125
+ }
126
+ }, A = /* @__PURE__ */ z(M, [["__scopeId", "data-v-3302f415"]]);
127
+ export {
128
+ A as default
129
+ };
@@ -0,0 +1,77 @@
1
+ import { ref as v, computed as d, createElementBlock as r, openBlock as i, createElementVNode as t, toDisplayString as u, withDirectives as m, Fragment as f, renderList as p, vModelSelect as _ } from "vue";
2
+ import { _ as D } from "./index-CPYmSpDE.js";
3
+ const S = { class: "modal__contact-line" }, k = ["value"], q = { class: "modal__channel-line" }, w = ["disabled"], x = ["value"], V = ["disabled"], A = {
4
+ __name: "CreateDialog",
5
+ props: {
6
+ title: {
7
+ type: String,
8
+ required: !0
9
+ },
10
+ name: {
11
+ type: String,
12
+ required: !0
13
+ },
14
+ contacts: {
15
+ type: Array,
16
+ required: !0
17
+ },
18
+ channels: {
19
+ type: Array,
20
+ required: !0
21
+ },
22
+ filter: {
23
+ type: Function,
24
+ required: !1,
25
+ default: null
26
+ }
27
+ },
28
+ emits: ["change", "submit"],
29
+ setup(o, { emit: g }) {
30
+ const n = o, s = v(), a = v(), y = d(() => !!(s.value && a.value)), b = d(() => !!(n.filter && a.value || !n.filter)), h = d(() => n.filter && a.value ? n.filter(a.value, n.channels) : n.channels), c = g, C = () => {
31
+ c("change", { channel: s.value, contact: a.value }), c("submit");
32
+ };
33
+ return (B, l) => (i(), r("div", null, [
34
+ t("h3", null, u(o.title), 1),
35
+ t("div", null, " Контакт: " + u(o.name), 1),
36
+ t("div", S, [
37
+ l[2] || (l[2] = t("h3", { style: { margin: "0" } }, " Куда пишем ", -1)),
38
+ m(t("select", {
39
+ id: "folder",
40
+ "onUpdate:modelValue": l[0] || (l[0] = (e) => a.value = e)
41
+ }, [
42
+ (i(!0), r(f, null, p(o.contacts, (e) => (i(), r("option", {
43
+ key: e.id || e.value,
44
+ value: e
45
+ }, u(e.value), 9, k))), 128))
46
+ ], 512), [
47
+ [_, a.value]
48
+ ])
49
+ ]),
50
+ t("div", q, [
51
+ l[3] || (l[3] = t("h3", { style: { margin: "0" } }, " Через какой канал ", -1)),
52
+ m(t("select", {
53
+ id: "folder",
54
+ "onUpdate:modelValue": l[1] || (l[1] = (e) => s.value = e),
55
+ disabled: !b.value
56
+ }, [
57
+ (i(!0), r(f, null, p(h.value, (e) => (i(), r("option", {
58
+ key: e.id || e.title,
59
+ value: e
60
+ }, u(e.title), 9, x))), 128))
61
+ ], 8, w), [
62
+ [_, s.value]
63
+ ])
64
+ ]),
65
+ t("button", {
66
+ type: "button",
67
+ class: "modal__button-start",
68
+ "aria-label": "Close modal",
69
+ disabled: !y.value,
70
+ onClick: C
71
+ }, " Начать диалог ", 8, V)
72
+ ]));
73
+ }
74
+ }, U = /* @__PURE__ */ D(A, [["__scopeId", "data-v-c9b375bd"]]);
75
+ export {
76
+ U as default
77
+ };
@@ -0,0 +1,143 @@
1
+ import { defineComponent as N, ref as l, computed as z, onMounted as $, createElementBlock as m, openBlock as f, Fragment as q, createElementVNode as o, withDirectives as E, vShow as I, createCommentVNode as g, normalizeClass as y, toDisplayString as A, nextTick as G, unref as k } from "vue";
2
+ import { _ as H } from "./index-CPYmSpDE.js";
3
+ const J = { class: "video-recorder__header" }, K = { class: "video-recorder__controls" }, P = { class: "video-recorder__recording-container" }, Q = { class: "video-recorder__recording-time" }, W = /* @__PURE__ */ N({
4
+ __name: "ModalVideoRecorder",
5
+ emits: ["change", "submit", "close"],
6
+ setup(X, { emit: L }) {
7
+ const S = l(), s = l(0), n = l(0), u = l(0), d = l(0), x = z(() => {
8
+ let a = d.value < 10 ? "0" + d.value : d.value, e = u.value < 10 ? "0" + u.value : u.value, t = n.value < 10 ? "0" + n.value : n.value, b = s.value < 10 ? "00" + s.value : s.value < 100 ? "0" + s.value : s.value;
9
+ return r.value ? a + ":" + e + ":" + t + ":" + b : " ";
10
+ }), _ = l(), R = l(), r = l(!1), c = l(), p = l(), V = l([]), i = l(), w = l(), v = l("camera"), F = () => {
11
+ v.value == "camera" ? (v.value = "screen", B()) : v.value == "screen" && (C(), v.value = "camera", M());
12
+ }, O = async () => {
13
+ !r.value && p.value instanceof MediaStream && (c.value = new MediaRecorder(p.value), c.value.start(), c.value.ondataavailable = (a) => {
14
+ V.value.push(a.data);
15
+ }, r.value = !0, S.value = setInterval(() => {
16
+ s.value += 10, s.value == 1e3 && (s.value = 0, n.value++, n.value == 60 && (n.value = 0, u.value++, u.value == 60 && (u.value = 0, d.value++)));
17
+ }, 10));
18
+ }, T = async () => {
19
+ D(), C(), i.value && (i.value = void 0, await M());
20
+ }, U = () => {
21
+ c.value && (c.value.stop(), c.value.onstop = async () => {
22
+ w.value = new File(V.value, "videomessage.mp4", { type: "video/*" });
23
+ const a = URL.createObjectURL(w.value);
24
+ i.value = a, G(() => {
25
+ R.value && (R.value.src = a);
26
+ });
27
+ }), D(), C();
28
+ };
29
+ function C() {
30
+ var e;
31
+ let a = (e = p.value) == null ? void 0 : e.getTracks();
32
+ a == null || a.forEach((t) => t.stop());
33
+ }
34
+ const D = () => {
35
+ clearInterval(S.value), s.value = 0, n.value = 0, u.value = 0, d.value = 0, r.value = !1, c.value = void 0, V.value = [];
36
+ }, h = L, j = () => {
37
+ h("change", { videoFile: w.value }), h("submit");
38
+ }, M = async () => {
39
+ await navigator.mediaDevices.getUserMedia({ audio: !0, video: !0 }).then((a) => {
40
+ const e = k(_.value);
41
+ p.value = a, e.srcObject = a, e.addEventListener("loadedmetadata", () => {
42
+ var t;
43
+ (t = k(_.value)) == null || t.play();
44
+ }), e.muted = !0;
45
+ });
46
+ }, B = async () => {
47
+ const a = {
48
+ video: {
49
+ cursor: "always"
50
+ },
51
+ audio: !1
52
+ };
53
+ await navigator.mediaDevices.getDisplayMedia(a).then((e) => {
54
+ const t = k(_.value);
55
+ p.value = e, t.srcObject = e, t.addEventListener("loadedmetadata", () => {
56
+ var b;
57
+ (b = k(_.value)) == null || b.play();
58
+ }), t.muted = !0;
59
+ });
60
+ };
61
+ return $(async () => {
62
+ await M();
63
+ }), (a, e) => (f(), m(q, null, [
64
+ o("div", J, [
65
+ o("button", {
66
+ class: "video-recorder__button video-recorder__button-close",
67
+ onClick: e[0] || (e[0] = (t) => h("close"))
68
+ }, [...e[1] || (e[1] = [
69
+ o("span", { class: "pi pi-times" }, null, -1)
70
+ ])])
71
+ ]),
72
+ o("div", null, [
73
+ E(o("video", {
74
+ ref_key: "refVideo",
75
+ ref: _,
76
+ class: "video-recorder__view-area"
77
+ }, null, 512), [
78
+ [I, !i.value]
79
+ ]),
80
+ E(o("video", {
81
+ ref_key: "refRecord",
82
+ ref: R,
83
+ class: "video-recorder__view-area",
84
+ controls: ""
85
+ }, null, 512), [
86
+ [I, i.value]
87
+ ]),
88
+ o("div", K, [
89
+ o("div", P, [
90
+ !r.value && !i.value ? (f(), m("button", {
91
+ key: 0,
92
+ class: "video-recorder__button",
93
+ onClick: F
94
+ }, [
95
+ o("span", {
96
+ class: y({
97
+ "pi pi-desktop": v.value == "camera",
98
+ "pi pi-camera": v.value == "screen"
99
+ })
100
+ }, null, 2)
101
+ ])) : g("", !0),
102
+ i.value ? g("", !0) : (f(), m("button", {
103
+ key: 1,
104
+ class: y(["video-recorder__button", { "video-recorder__recording-button": r.value }]),
105
+ onClick: O
106
+ }, [
107
+ o("span", {
108
+ class: y(["pi", {
109
+ "pi-circle-fill video-recorder__recording-icon": r.value,
110
+ "pi-video": !r.value
111
+ }])
112
+ }, null, 2)
113
+ ], 2)),
114
+ !r.value && i.value ? (f(), m("button", {
115
+ key: 2,
116
+ class: "video-recorder__button",
117
+ onClick: T
118
+ }, [...e[2] || (e[2] = [
119
+ o("span", { class: "pi pi-trash" }, null, -1)
120
+ ])])) : g("", !0),
121
+ r.value ? (f(), m("button", {
122
+ key: 3,
123
+ class: "video-recorder__button",
124
+ onClick: U
125
+ }, [...e[3] || (e[3] = [
126
+ o("div", { class: "video-recorder__stop" }, null, -1)
127
+ ])])) : g("", !0),
128
+ o("span", Q, A(x.value), 1)
129
+ ]),
130
+ o("button", {
131
+ class: y(["video-recorder__button", { "video-recorder__button-disabled": !i.value }]),
132
+ onClick: j
133
+ }, [...e[4] || (e[4] = [
134
+ o("span", { class: "video-recorder__save-button" }, " Прикрепить видео ", -1)
135
+ ])], 2)
136
+ ])
137
+ ])
138
+ ], 64));
139
+ }
140
+ }), ee = /* @__PURE__ */ H(W, [["__scopeId", "data-v-47304124"]]);
141
+ export {
142
+ ee as default
143
+ };
@@ -0,0 +1,46 @@
1
+ import { ref as p, createElementBlock as n, openBlock as s, createElementVNode as t, toDisplayString as c, Fragment as m, renderList as _, withDirectives as h, vModelCheckbox as v } from "vue";
2
+ import { _ as f } from "./index-CPYmSpDE.js";
3
+ const g = { class: "participant-list" }, k = ["id", "value"], y = ["for"], b = {
4
+ __name: "SelectUser2",
5
+ props: {
6
+ users: {
7
+ type: Array,
8
+ required: !0
9
+ },
10
+ title: {
11
+ type: String,
12
+ required: !0
13
+ }
14
+ },
15
+ emits: ["change"],
16
+ setup(o, { emit: i }) {
17
+ const r = p([]), a = i, u = () => {
18
+ console.log("check"), a("change", { selectedUsers: r.value });
19
+ };
20
+ return (x, l) => (s(), n("div", null, [
21
+ t("h2", null, c(o.title), 1),
22
+ t("div", g, [
23
+ (s(!0), n(m, null, _(o.users, (e) => (s(), n("div", {
24
+ key: e.userId,
25
+ class: "participant-item"
26
+ }, [
27
+ h(t("input", {
28
+ id: e.userId,
29
+ "onUpdate:modelValue": l[0] || (l[0] = (d) => r.value = d),
30
+ type: "checkbox",
31
+ value: e.userId,
32
+ onChange: u
33
+ }, null, 40, k), [
34
+ [v, r.value]
35
+ ]),
36
+ t("label", {
37
+ for: e.userId
38
+ }, c(e.name || "unknown username"), 9, y)
39
+ ]))), 128))
40
+ ])
41
+ ]));
42
+ }
43
+ }, S = /* @__PURE__ */ f(b, [["__scopeId", "data-v-368cbcb0"]]);
44
+ export {
45
+ S as default
46
+ };