@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.
@@ -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-d13721a4"]]);
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 c, computed as A, onUnmounted as D, createElementBlock as d, 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";
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(y, { expose: w }) {
39
- const x = N("chatAppId"), { getTheme: T } = P(x), p = c(), a = c(), n = c(!1), s = c(null), f = c(null), e = y, _ = A(() => ({
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" && (f.value && (clearTimeout(f.value), f.value = null), f.value = setTimeout(() => {
44
- n.value = !0, g(() => {
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 l = a.value, t = p.value.getBoundingClientRect(), o = a.value.getBoundingClientRect(), i = o.left < 0 ? o.left : 0, r = o.top < 0 ? o.top : 0, u = {
47
- left: { top: t.top - (o.height - t.height) / 2 - r, left: (t == null ? void 0 : t.left) - o.width - i - e.offset },
48
- right: { top: t.top - (o.height - t.height) / 2 - r, left: (t == null ? void 0 : t.left) + t.width - i + e.offset },
49
- bottom: { top: (t == null ? void 0 : t.bottom) - r + e.offset, left: (t == null ? void 0 : t.left) - i },
50
- top: { top: t.top - o.height - e.offset - r, left: (t == null ? void 0 : t.left) - i },
51
- "bottom-left": { top: (t == null ? void 0 : t.bottom) - r + e.offset, left: (t == null ? void 0 : t.left) + t.width - o.width - i }
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
- l.style.top = u[e.position].top + "px", l.style.left = u[e.position].left + "px";
54
+ f.style.top = n[e.position].top + "px", f.style.left = n[e.position].left + "px";
54
55
  }
55
- }), f.value = null;
56
+ }), r.value = null;
56
57
  }, e.delay));
57
58
  }, C = () => {
58
- e.trigger !== "auto" && (f.value && (clearTimeout(f.value), f.value = null), n.value = !1, g(() => {
59
- const l = v(a);
60
- l && (l.style.top = "0", l.style.left = "0");
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
- h(), n.value = !0, g(() => {
64
+ s(), c.value = !0, g(() => {
64
65
  if (p.value && a.value) {
65
- const l = a.value, t = p.value.getBoundingClientRect(), o = a.value.getBoundingClientRect(), i = o.left < 0 ? o.left : 0, r = o.top < 0 ? o.top : 0, u = {
66
- left: { top: t.top - (o.height - t.height) / 2 - r, left: (t == null ? void 0 : t.left) - o.width - i - e.offset },
67
- right: { top: t.top - (o.height - t.height) / 2 - r, left: (t == null ? void 0 : t.left) + t.width - i + e.offset },
68
- bottom: { top: (t == null ? void 0 : t.bottom) - r + e.offset, left: (t == null ? void 0 : t.left) - i },
69
- top: { top: t.top - o.height - e.offset - r, left: (t == null ? void 0 : t.left) - i },
70
- "bottom-left": { top: (t == null ? void 0 : t.bottom) - r + e.offset, left: (t == null ? void 0 : t.left) + t.width - o.width - i }
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
- l.style.top = u[e.position].top + "px", l.style.left = u[e.position].left + "px";
74
+ f.style.top = n[e.position].top + "px", f.style.left = n[e.position].left + "px";
73
75
  }
74
- }), e.autoShowDuration > 0 && (s.value = setTimeout(() => {
75
- n.value = !1;
76
+ }), e.autoShowDuration > 0 && (h.value = setTimeout(() => {
77
+ c.value = !1;
76
78
  }, e.autoShowDuration));
77
- }, h = () => {
78
- s.value && (clearTimeout(s.value), s.value = null);
79
+ }, s = () => {
80
+ h.value && (clearTimeout(h.value), h.value = null);
79
81
  };
80
82
  return D(() => {
81
- f.value && clearTimeout(f.value), h();
82
- }), w({
83
+ r.value && clearTimeout(r.value), s();
84
+ }), d({
83
85
  startAutoShow: S,
84
- clearAutoTimer: h
85
- }), (l, t) => (m(), d(R, null, [
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(l.$slots, "default", {}, void 0, !0)
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
- n.value ? (m(), d("span", {
100
+ c.value ? (m(), T("span", {
99
101
  key: 0,
100
102
  ref_key: "tooltip",
101
103
  ref: a,
102
- "data-theme": v(T)().theme ? v(T)().theme : "light",
104
+ "data-theme": v(y)().theme ? v(y)().theme : "light",
103
105
  class: z(_.value)
104
- }, F(y.text), 11, U)) : q("", !0)
106
+ }, F(w.text), 11, U)) : q("", !0)
105
107
  ]),
106
108
  _: 1
107
109
  })
@@ -1,7 +1,7 @@
1
- import o from "./DelimiterMessage.vue2.js";
1
+ import e from "./DelimiterMessage.vue2.js";
2
2
  /* empty css */
3
- import t from "../../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-9ff92646"]]);
3
+ import o from "../../../_virtual/_plugin-vue_export-helper.js";
4
+ const s = /* @__PURE__ */ o(e, [["__scopeId", "data-v-6097de8c"]]);
5
5
  export {
6
- m as default
6
+ s as default
7
7
  };
@@ -1,54 +1,99 @@
1
- import { defineComponent as f, ref as a, onMounted as d, onBeforeUnmount as g, watch as _, createElementBlock as v, openBlock as p, normalizeClass as T, createElementVNode as R, toDisplayString as D } from "vue";
2
- const O = { class: "delimiter-message__text" }, b = 3e3, h = 400, y = /* @__PURE__ */ f({
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(i, { emit: m }) {
12
- const s = i, c = m, n = a(null), r = a(!1);
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 l = () => {
15
- !s.message.autoRemove || !n.value || (t = new IntersectionObserver(
16
- (o) => {
17
- o[0].isIntersecting ? (e && clearTimeout(e), e = setTimeout(() => {
18
- r.value = !0, t && n.value && (t.disconnect(), t = null), setTimeout(() => {
19
- c("read", s.message.messageId);
20
- }, h);
21
- }, b)) : e && (clearTimeout(e), e = null);
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(n.value));
54
+ ), t.observe(s.value));
29
55
  };
30
- return d(() => {
31
- s.message.autoRemove && setTimeout(() => {
32
- l();
56
+ return x(() => {
57
+ i.message.autoRemove && setTimeout(() => {
58
+ m();
33
59
  }, 100);
34
- }), g(() => {
60
+ }), R(() => {
35
61
  e && (clearTimeout(e), e = null), t && (t.disconnect(), t = null);
36
- }), _(
37
- () => s.message.autoRemove,
38
- (o) => {
39
- t && (t.disconnect(), t = null), e && (clearTimeout(e), e = null), o && setTimeout(() => {
40
- l();
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
- ), (o, u) => (p(), v("div", {
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: n,
46
- class: T(["delimiter-message__container", { "delimiter-message__container--removing": r.value }])
90
+ ref: s,
91
+ class: d(["delimiter-message__container", { "delimiter-message__container--removing": l.value }])
47
92
  }, [
48
- R("p", O, D(i.message.text), 1)
93
+ a("p", I, g(o.message.text), 1)
49
94
  ], 2));
50
95
  }
51
96
  });
52
97
  export {
53
- y as default
98
+ B as default
54
99
  };