@mobilon-dev/chotto 0.3.59 → 0.3.61

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.
@@ -1,7 +1,7 @@
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 u, Fragment as L, createCommentVNode as _, createElementVNode as p, createBlock as S, normalizeClass as R, createVNode as j, unref as b, 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";
1
+ import { defineComponent as O, ref as n, inject as P, computed as B, watchEffect as $, onMounted as H, onUnmounted as L, createElementBlock as _, openBlock as u, Fragment as R, createCommentVNode as b, createElementVNode as p, createBlock as V, normalizeClass as j, createVNode as T, unref as h, Teleport as q } from "vue";
2
+ import G from "../FilePreview/FilePreview.vue.js";
3
+ import { uploadFile as J } from "../../../hooks/uploadFile/uploadFile.js";
4
+ import { useMessageDraft as K } from "../../../hooks/useMessageDraft.js";
5
5
  import "../../../hooks/useSearchModel.js";
6
6
  import "../../../hooks/useTheme.js";
7
7
  /* empty css */
@@ -9,14 +9,14 @@ import "../../../hooks/useTheme.js";
9
9
  import "../../../node_modules/linkifyjs/dist/linkify.js";
10
10
  import "../../../node_modules/linkify-string/dist/linkify-string.js";
11
11
  import "../../../functions/parseMarkdown.js";
12
- import K from "./icons/FileUploaderIcon.vue.js";
13
- const Q = {
12
+ import Q from "./icons/FileUploaderIcon.vue.js";
13
+ const W = {
14
14
  key: 0,
15
15
  class: "file-uploader__status file-uploader__status--uploading"
16
- }, W = {
16
+ }, X = {
17
17
  key: 1,
18
18
  class: "file-uploader__status file-uploader__status--error"
19
- }, X = ["disabled"], fe = /* @__PURE__ */ x({
19
+ }, Y = ["disabled"], ce = /* @__PURE__ */ O({
20
20
  __name: "FileUploader",
21
21
  props: {
22
22
  filebumpUrl: {
@@ -29,8 +29,10 @@ const Q = {
29
29
  }
30
30
  },
31
31
  emits: ["fileUploaded"],
32
- setup(m, { emit: Y }) {
33
- const v = m, r = n(""), s = n(), f = n(), B = n(), i = O("chatAppId"), { setMessageFile: V, resetMessageFile: z, getMessage: h, setRecordingMessage: C } = J(i), c = n("#5F5F5F"), d = n("#404040"), g = n(!1);
32
+ setup(m, { emit: Z }) {
33
+ const v = m, s = n(""), r = n(), f = n(), C = n();
34
+ C.value;
35
+ const i = P("chatAppId"), { setMessageFile: N, resetMessageFile: z, getMessage: I, setRecordingMessage: E } = K(i), c = n("#5F5F5F"), d = n("#404040"), g = n(!1);
34
36
  let a = null;
35
37
  const y = () => {
36
38
  if (!i) {
@@ -44,35 +46,38 @@ const Q = {
44
46
  }
45
47
  const t = window.getComputedStyle(l), e = t.getPropertyValue("--chotto-fileuploader-trigger-color").trim(), o = t.getPropertyValue("--chotto-fileuploader-trigger-hover-color").trim();
46
48
  c.value = e || "#5F5F5F", d.value = o || "#404040";
47
- }, A = M(() => g.value ? d.value : c.value);
48
- P(() => {
49
+ }, A = B(() => g.value ? d.value : c.value);
50
+ $(() => {
49
51
  y();
50
52
  });
51
- const F = M(() => !h().file), I = () => {
53
+ const F = B(() => !I().file), w = () => {
54
+ r.value && (r.value.value = "");
55
+ }, k = () => {
52
56
  const l = document.getElementById("chat-input-file-line-" + i);
53
- l && (l.style.display = "none"), z(), f.value = void 0, r.value = "";
54
- }, N = async () => {
55
- var l, t;
56
- I(), (l = s.value) != null && l.files && k((t = s.value) == null ? void 0 : t.files[0]);
57
- }, D = () => {
58
- s.value && F && v.state == "active" && s.value.click();
59
- }, E = async (l) => {
57
+ l && (l.style.display = "none"), z(), f.value = void 0, s.value = "", w();
58
+ }, D = async () => {
59
+ var t, e;
60
+ const l = (e = (t = r.value) == null ? void 0 : t.files) == null ? void 0 : e[0];
61
+ k(), l && await M(l), w();
62
+ }, x = () => {
63
+ r.value && F.value && v.state == "active" && (w(), r.value.click());
64
+ }, U = async (l) => {
60
65
  var e;
61
66
  const t = (e = l.clipboardData) == null ? void 0 : e.items;
62
67
  if (t) {
63
68
  for (let o of t)
64
69
  if (o.type.indexOf("image") !== -1) {
65
70
  l.preventDefault();
66
- const U = o.getAsFile();
67
- U && k(U);
71
+ const S = o.getAsFile();
72
+ S && M(S);
68
73
  }
69
74
  }
70
- }, k = async (l) => {
71
- r.value = "uploading", C(!0);
75
+ }, M = async (l) => {
76
+ s.value = "uploading", E(!0);
72
77
  const t = typeof v.filebumpUrl == "string" ? v.filebumpUrl : null;
73
- await G(t, l).then((e) => {
74
- if (C(!1), r.value = e.status, e.status == "success") {
75
- V({
78
+ await J(t, l).then((e) => {
79
+ if (E(!1), s.value = e.status, e.status == "success") {
80
+ N({
76
81
  url: e.url,
77
82
  name: e.name,
78
83
  size: e.size,
@@ -90,8 +95,8 @@ const Q = {
90
95
  }
91
96
  });
92
97
  };
93
- return $(() => {
94
- if (window.addEventListener("paste", E), y(), i) {
98
+ return H(() => {
99
+ if (window.addEventListener("paste", U), y(), i) {
95
100
  const l = document.getElementById(i);
96
101
  l && (a = new MutationObserver((t) => {
97
102
  t.forEach((e) => {
@@ -102,46 +107,46 @@ const Q = {
102
107
  attributeFilter: ["data-theme"]
103
108
  }));
104
109
  }
105
- }), H(() => {
106
- window.removeEventListener("paste", E), a && (a.disconnect(), a = null);
107
- }), (l, t) => (u(), w(L, null, [
108
- r.value === "uploading" ? (u(), w("div", Q, [...t[2] || (t[2] = [
110
+ }), L(() => {
111
+ window.removeEventListener("paste", U), a && (a.disconnect(), a = null);
112
+ }), (l, t) => (u(), _(R, null, [
113
+ s.value === "uploading" ? (u(), _("div", W, [...t[2] || (t[2] = [
109
114
  p("span", null, "Загрузка", -1),
110
115
  p("span", null, "файла...", -1)
111
- ])])) : r.value === "error" ? (u(), w("div", W, [...t[3] || (t[3] = [
116
+ ])])) : s.value === "error" ? (u(), _("div", X, [...t[3] || (t[3] = [
112
117
  p("span", null, "Ошибка при загрузке файла.", -1)
113
- ])])) : _("", !0),
118
+ ])])) : b("", !0),
114
119
  p("span", {
115
120
  ref_key: "triggerElement",
116
- ref: B,
117
- class: R(["file-uploader__trigger", { "file-uploader__disabled": !F.value || m.state == "disabled" }]),
121
+ ref: C,
122
+ class: j(["file-uploader__trigger", { "file-uploader__disabled": !F.value || m.state == "disabled" }]),
118
123
  disabled: !F.value || m.state == "disabled",
119
- onClick: D,
124
+ onClick: x,
120
125
  onMouseenter: t[0] || (t[0] = (e) => g.value = !0),
121
126
  onMouseleave: t[1] || (t[1] = (e) => g.value = !1)
122
127
  }, [
123
- j(b(K), { fill: A.value }, null, 8, ["fill"])
124
- ], 42, X),
128
+ T(h(Q), { fill: A.value }, null, 8, ["fill"])
129
+ ], 42, Y),
125
130
  p("input", {
126
131
  ref_key: "fileInput",
127
- ref: s,
132
+ ref: r,
128
133
  style: { display: "none" },
129
134
  type: "file",
130
- onChange: N
135
+ onChange: D
131
136
  }, null, 544),
132
- b(h)().file ? (u(), S(T, {
137
+ h(I)().file ? (u(), V(q, {
133
138
  key: 2,
134
- to: "#chat-input-file-line-" + b(i)
139
+ to: "#chat-input-file-line-" + h(i)
135
140
  }, [
136
- f.value ? (u(), S(q, {
141
+ f.value ? (u(), V(G, {
137
142
  key: 0,
138
143
  "file-info": f.value,
139
- onReset: I
140
- }, null, 8, ["file-info"])) : _("", !0)
141
- ], 8, ["to"])) : _("", !0)
144
+ onReset: k
145
+ }, null, 8, ["file-info"])) : b("", !0)
146
+ ], 8, ["to"])) : b("", !0)
142
147
  ], 64));
143
148
  }
144
149
  });
145
150
  export {
146
- fe as default
151
+ ce as default
147
152
  };
@@ -8,6 +8,7 @@ declare const _default: import("vue").DefineComponent<{}, {
8
8
  isNewDialog: boolean;
9
9
  selectedDialog: Record<string, any>;
10
10
  emptyChannelsPlaceholder: Record<string, any>;
11
+ attributeTooltips: Record<string, any>;
11
12
  showChannelIcons: boolean;
12
13
  $props: {
13
14
  readonly channels?: unknown[] | undefined;
@@ -18,6 +19,7 @@ declare const _default: import("vue").DefineComponent<{}, {
18
19
  readonly isNewDialog?: boolean | undefined;
19
20
  readonly selectedDialog?: Record<string, any> | undefined;
20
21
  readonly emptyChannelsPlaceholder?: Record<string, any> | undefined;
22
+ readonly attributeTooltips?: Record<string, any> | undefined;
21
23
  readonly showChannelIcons?: boolean | undefined;
22
24
  };
23
25
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -11,6 +11,7 @@ declare const meta: {
11
11
  isNewDialog: boolean;
12
12
  selectedDialog: Record<string, any>;
13
13
  emptyChannelsPlaceholder: Record<string, any>;
14
+ attributeTooltips: Record<string, any>;
14
15
  showChannelIcons: boolean;
15
16
  $props: {
16
17
  readonly channels?: unknown[] | undefined;
@@ -21,6 +22,7 @@ declare const meta: {
21
22
  readonly isNewDialog?: boolean | undefined;
22
23
  readonly selectedDialog?: Record<string, any> | undefined;
23
24
  readonly emptyChannelsPlaceholder?: Record<string, any> | undefined;
25
+ readonly attributeTooltips?: Record<string, any> | undefined;
24
26
  readonly showChannelIcons?: boolean | undefined;
25
27
  };
26
28
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mobilon-dev/chotto",
3
- "version": "0.3.59",
3
+ "version": "0.3.61",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",