@mobilon-dev/chotto 0.3.56 → 0.3.57
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/Tooltip/Tooltip.vue.js +1 -1
- package/dist/components/1_atoms/Tooltip/Tooltip.vue2.js +38 -36
- package/dist/components/2_feed_elements/DelimiterMessage/DelimiterMessage.vue.js +4 -4
- package/dist/components/2_feed_elements/DelimiterMessage/DelimiterMessage.vue2.js +72 -27
- 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/apps/data/messages.d.ts +75 -0
- package/dist/types/components/2_feed_elements/DelimiterMessage/DelimiterMessage.vue.d.ts +46 -1
- package/dist/types/components/2_feed_elements/DelimiterMessage/stories/DelimiterMessage.stories.d.ts +1 -0
- package/dist/types/components/2_feed_elements/DelimiterMessage/styles/types.d.ts +0 -4
- package/dist/types/components/2_feed_elements/types/messages.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./Tooltip.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
|
4
|
+
const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-595f9104"]]);
|
|
5
5
|
export {
|
|
6
6
|
m as default
|
|
7
7
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as k, inject as N, ref as
|
|
1
|
+
import { defineComponent as k, inject as N, ref as u, computed as A, onUnmounted as D, createElementBlock as T, openBlock as m, Fragment as R, createElementVNode as V, createBlock as E, renderSlot as I, Teleport as L, createVNode as M, Transition as $, withCtx as j, createCommentVNode as q, normalizeClass as z, unref as v, toDisplayString as F, nextTick as g } from "vue";
|
|
2
2
|
import "../../../hooks/useMessageDraft.js";
|
|
3
3
|
import "../../../hooks/useSearchModel.js";
|
|
4
4
|
import { useTheme as P } from "../../../hooks/useTheme.js";
|
|
@@ -35,54 +35,56 @@ const U = ["data-theme"], Z = /* @__PURE__ */ k({
|
|
|
35
35
|
default: 600
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
|
-
setup(
|
|
39
|
-
const x = N("chatAppId"), { getTheme:
|
|
38
|
+
setup(w, { expose: d }) {
|
|
39
|
+
const x = N("chatAppId"), { getTheme: y } = P(x), p = u(), a = u(), c = u(!1), h = u(null), r = u(null), e = w, _ = A(() => ({
|
|
40
40
|
tooltip__text: !0,
|
|
41
41
|
[`tooltip--${e.position}`]: !0
|
|
42
42
|
})), B = () => {
|
|
43
|
-
e.trigger !== "auto" && (
|
|
44
|
-
|
|
43
|
+
e.trigger !== "auto" && (r.value && (clearTimeout(r.value), r.value = null), r.value = setTimeout(() => {
|
|
44
|
+
c.value = !0, g(() => {
|
|
45
45
|
if (p.value && a.value) {
|
|
46
|
-
const
|
|
47
|
-
left: { top: t.top - (o.height - t.height) / 2 -
|
|
48
|
-
right: { top: t.top - (o.height - t.height) / 2 -
|
|
49
|
-
bottom: { top: (t == null ? void 0 : t.bottom) -
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
const f = a.value, t = p.value.getBoundingClientRect(), o = a.value.getBoundingClientRect(), l = o.left < 0 ? o.left : 0, i = o.top < 0 ? o.top : 0, n = {
|
|
47
|
+
left: { top: t.top - (o.height - t.height) / 2 - i, left: (t == null ? void 0 : t.left) - o.width - l - e.offset },
|
|
48
|
+
right: { top: t.top - (o.height - t.height) / 2 - i, left: (t == null ? void 0 : t.left) + t.width - l + e.offset },
|
|
49
|
+
bottom: { top: (t == null ? void 0 : t.bottom) - i + e.offset, left: (t == null ? void 0 : t.left) - l },
|
|
50
|
+
"bottom-center": { top: (t == null ? void 0 : t.bottom) - i + e.offset, left: (t == null ? void 0 : t.left) + t.width / 2 - o.width / 2 - l },
|
|
51
|
+
top: { top: t.top - o.height - e.offset - i, left: (t == null ? void 0 : t.left) - l },
|
|
52
|
+
"bottom-left": { top: (t == null ? void 0 : t.bottom) - i + e.offset, left: (t == null ? void 0 : t.left) + t.width - o.width - l }
|
|
52
53
|
};
|
|
53
|
-
|
|
54
|
+
f.style.top = n[e.position].top + "px", f.style.left = n[e.position].left + "px";
|
|
54
55
|
}
|
|
55
|
-
}),
|
|
56
|
+
}), r.value = null;
|
|
56
57
|
}, e.delay));
|
|
57
58
|
}, C = () => {
|
|
58
|
-
e.trigger !== "auto" && (
|
|
59
|
-
const
|
|
60
|
-
|
|
59
|
+
e.trigger !== "auto" && (r.value && (clearTimeout(r.value), r.value = null), c.value = !1, g(() => {
|
|
60
|
+
const f = v(a);
|
|
61
|
+
f && (f.style.top = "0", f.style.left = "0");
|
|
61
62
|
}));
|
|
62
63
|
}, S = () => {
|
|
63
|
-
|
|
64
|
+
s(), c.value = !0, g(() => {
|
|
64
65
|
if (p.value && a.value) {
|
|
65
|
-
const
|
|
66
|
-
left: { top: t.top - (o.height - t.height) / 2 -
|
|
67
|
-
right: { top: t.top - (o.height - t.height) / 2 -
|
|
68
|
-
bottom: { top: (t == null ? void 0 : t.bottom) -
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
const f = a.value, t = p.value.getBoundingClientRect(), o = a.value.getBoundingClientRect(), l = o.left < 0 ? o.left : 0, i = o.top < 0 ? o.top : 0, n = {
|
|
67
|
+
left: { top: t.top - (o.height - t.height) / 2 - i, left: (t == null ? void 0 : t.left) - o.width - l - e.offset },
|
|
68
|
+
right: { top: t.top - (o.height - t.height) / 2 - i, left: (t == null ? void 0 : t.left) + t.width - l + e.offset },
|
|
69
|
+
bottom: { top: (t == null ? void 0 : t.bottom) - i + e.offset, left: (t == null ? void 0 : t.left) - l },
|
|
70
|
+
"bottom-center": { top: (t == null ? void 0 : t.bottom) - i + e.offset, left: (t == null ? void 0 : t.left) + t.width / 2 - o.width / 2 - l },
|
|
71
|
+
top: { top: t.top - o.height - e.offset - i, left: (t == null ? void 0 : t.left) - l },
|
|
72
|
+
"bottom-left": { top: (t == null ? void 0 : t.bottom) - i + e.offset, left: (t == null ? void 0 : t.left) + t.width - o.width - l }
|
|
71
73
|
};
|
|
72
|
-
|
|
74
|
+
f.style.top = n[e.position].top + "px", f.style.left = n[e.position].left + "px";
|
|
73
75
|
}
|
|
74
|
-
}), e.autoShowDuration > 0 && (
|
|
75
|
-
|
|
76
|
+
}), e.autoShowDuration > 0 && (h.value = setTimeout(() => {
|
|
77
|
+
c.value = !1;
|
|
76
78
|
}, e.autoShowDuration));
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
+
}, s = () => {
|
|
80
|
+
h.value && (clearTimeout(h.value), h.value = null);
|
|
79
81
|
};
|
|
80
82
|
return D(() => {
|
|
81
|
-
|
|
82
|
-
}),
|
|
83
|
+
r.value && clearTimeout(r.value), s();
|
|
84
|
+
}), d({
|
|
83
85
|
startAutoShow: S,
|
|
84
|
-
clearAutoTimer:
|
|
85
|
-
}), (
|
|
86
|
+
clearAutoTimer: s
|
|
87
|
+
}), (f, t) => (m(), T(R, null, [
|
|
86
88
|
V("div", {
|
|
87
89
|
ref_key: "container",
|
|
88
90
|
ref: p,
|
|
@@ -90,18 +92,18 @@ const U = ["data-theme"], Z = /* @__PURE__ */ k({
|
|
|
90
92
|
onMouseover: B,
|
|
91
93
|
onMouseout: C
|
|
92
94
|
}, [
|
|
93
|
-
I(
|
|
95
|
+
I(f.$slots, "default", {}, void 0, !0)
|
|
94
96
|
], 544),
|
|
95
97
|
(m(), E(L, { to: "body" }, [
|
|
96
98
|
M($, null, {
|
|
97
99
|
default: j(() => [
|
|
98
|
-
|
|
100
|
+
c.value ? (m(), T("span", {
|
|
99
101
|
key: 0,
|
|
100
102
|
ref_key: "tooltip",
|
|
101
103
|
ref: a,
|
|
102
|
-
"data-theme": v(
|
|
104
|
+
"data-theme": v(y)().theme ? v(y)().theme : "light",
|
|
103
105
|
class: z(_.value)
|
|
104
|
-
}, F(
|
|
106
|
+
}, F(w.text), 11, U)) : q("", !0)
|
|
105
107
|
]),
|
|
106
108
|
_: 1
|
|
107
109
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from "./DelimiterMessage.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
const
|
|
3
|
+
import o from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const s = /* @__PURE__ */ o(e, [["__scopeId", "data-v-6097de8c"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
s as default
|
|
7
7
|
};
|
|
@@ -1,54 +1,99 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
|
|
1
|
+
import { defineComponent as T, computed as y, ref as c, onMounted as x, onBeforeUnmount as R, watch as b, createElementBlock as u, openBlock as f, createVNode as h, withCtx as D, createElementVNode as a, normalizeClass as d, toDisplayString as g } from "vue";
|
|
2
|
+
import O from "../../1_atoms/Tooltip/Tooltip.vue.js";
|
|
3
|
+
const k = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "delimiter-message__tooltip-root"
|
|
6
|
+
}, N = { class: "delimiter-message__text" }, I = { class: "delimiter-message__text" }, A = 3e3, E = 400, B = /* @__PURE__ */ T({
|
|
3
7
|
__name: "DelimiterMessage",
|
|
4
8
|
props: {
|
|
5
9
|
message: {
|
|
6
10
|
type: Object,
|
|
7
11
|
required: !0
|
|
12
|
+
},
|
|
13
|
+
/** Текст подсказки при наведении. Если не передан — берётся из message.tooltipText */
|
|
14
|
+
tooltipText: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: ""
|
|
17
|
+
},
|
|
18
|
+
/** Позиция тултипа: top | right | bottom | left | bottom-left | bottom-center */
|
|
19
|
+
tooltipPosition: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "bottom-center"
|
|
22
|
+
},
|
|
23
|
+
/** Отступ тултипа от элемента (px) */
|
|
24
|
+
tooltipOffset: {
|
|
25
|
+
type: Number,
|
|
26
|
+
default: 8
|
|
27
|
+
},
|
|
28
|
+
/** Задержка показа тултипа (ms) */
|
|
29
|
+
tooltipDelay: {
|
|
30
|
+
type: Number,
|
|
31
|
+
default: 100
|
|
8
32
|
}
|
|
9
33
|
},
|
|
10
34
|
emits: ["read"],
|
|
11
|
-
setup(
|
|
12
|
-
const
|
|
35
|
+
setup(o, { emit: p }) {
|
|
36
|
+
const i = o, r = y(
|
|
37
|
+
() => i.tooltipText || i.message.tooltipText || ""
|
|
38
|
+
), v = p, s = c(null), l = c(!1);
|
|
13
39
|
let t = null, e = null;
|
|
14
|
-
const
|
|
15
|
-
!
|
|
16
|
-
(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
},
|
|
40
|
+
const m = () => {
|
|
41
|
+
!i.message.autoRemove || !s.value || (t = new IntersectionObserver(
|
|
42
|
+
(n) => {
|
|
43
|
+
n[0].isIntersecting ? (e && clearTimeout(e), e = setTimeout(() => {
|
|
44
|
+
l.value = !0, t && s.value && (t.disconnect(), t = null), setTimeout(() => {
|
|
45
|
+
v("read", i.message.messageId);
|
|
46
|
+
}, E);
|
|
47
|
+
}, A)) : e && (clearTimeout(e), e = null);
|
|
22
48
|
},
|
|
23
49
|
{
|
|
24
50
|
threshold: 0.75,
|
|
25
51
|
// Элемент должен быть виден минимум на 75%
|
|
26
52
|
rootMargin: "0px"
|
|
27
53
|
}
|
|
28
|
-
), t.observe(
|
|
54
|
+
), t.observe(s.value));
|
|
29
55
|
};
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
|
|
56
|
+
return x(() => {
|
|
57
|
+
i.message.autoRemove && setTimeout(() => {
|
|
58
|
+
m();
|
|
33
59
|
}, 100);
|
|
34
|
-
}),
|
|
60
|
+
}), R(() => {
|
|
35
61
|
e && (clearTimeout(e), e = null), t && (t.disconnect(), t = null);
|
|
36
|
-
}),
|
|
37
|
-
() =>
|
|
38
|
-
(
|
|
39
|
-
t && (t.disconnect(), t = null), e && (clearTimeout(e), e = null),
|
|
40
|
-
|
|
62
|
+
}), b(
|
|
63
|
+
() => i.message.autoRemove,
|
|
64
|
+
(n) => {
|
|
65
|
+
t && (t.disconnect(), t = null), e && (clearTimeout(e), e = null), n && setTimeout(() => {
|
|
66
|
+
m();
|
|
41
67
|
}, 100);
|
|
42
68
|
}
|
|
43
|
-
), (
|
|
69
|
+
), (n, _) => r.value ? (f(), u("div", k, [
|
|
70
|
+
h(O, {
|
|
71
|
+
text: r.value,
|
|
72
|
+
position: o.tooltipPosition,
|
|
73
|
+
offset: o.tooltipOffset,
|
|
74
|
+
delay: o.tooltipDelay
|
|
75
|
+
}, {
|
|
76
|
+
default: D(() => [
|
|
77
|
+
a("div", {
|
|
78
|
+
ref_key: "containerRef",
|
|
79
|
+
ref: s,
|
|
80
|
+
class: d(["delimiter-message__container", { "delimiter-message__container--removing": l.value }])
|
|
81
|
+
}, [
|
|
82
|
+
a("p", N, g(o.message.text), 1)
|
|
83
|
+
], 2)
|
|
84
|
+
]),
|
|
85
|
+
_: 1
|
|
86
|
+
}, 8, ["text", "position", "offset", "delay"])
|
|
87
|
+
])) : (f(), u("div", {
|
|
88
|
+
key: 1,
|
|
44
89
|
ref_key: "containerRef",
|
|
45
|
-
ref:
|
|
46
|
-
class:
|
|
90
|
+
ref: s,
|
|
91
|
+
class: d(["delimiter-message__container", { "delimiter-message__container--removing": l.value }])
|
|
47
92
|
}, [
|
|
48
|
-
|
|
93
|
+
a("p", I, g(o.message.text), 1)
|
|
49
94
|
], 2));
|
|
50
95
|
}
|
|
51
96
|
});
|
|
52
97
|
export {
|
|
53
|
-
|
|
98
|
+
B as default
|
|
54
99
|
};
|