@mobilon-dev/chotto 0.3.115 → 0.3.117

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-0e9ba92c"]]);
4
+ const _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-11bc5009"]]);
5
5
  export {
6
- m as default
6
+ _ as default
7
7
  };
@@ -1,5 +1,5 @@
1
- import { defineComponent as st, inject as ct, useSlots as ht, ref as u, computed as s, onMounted as mt, onUnmounted as pt, createElementBlock as m, openBlock as c, Fragment as L, createElementVNode as vt, createBlock as gt, renderSlot as R, Teleport as dt, createVNode as yt, Transition as Tt, withCtx as wt, createCommentVNode as xt, renderList as _t, normalizeStyle as Ct, normalizeClass as St, unref as A, createTextVNode as Mt, toDisplayString as kt, nextTick as E } from "vue";
2
- import { useTheme as Lt } from "../../../hooks/useTheme.js";
1
+ import { defineComponent as nt, inject as ut, useSlots as ft, ref as u, computed as s, onMounted as st, onUnmounted as ct, createElementBlock as h, openBlock as c, Fragment as C, createElementVNode as ht, createBlock as mt, renderSlot as W, Teleport as pt, createVNode as vt, Transition as gt, withCtx as dt, createCommentVNode as Tt, renderList as yt, normalizeStyle as wt, normalizeClass as xt, unref as M, createTextVNode as _t, toDisplayString as St, nextTick as L } from "vue";
2
+ import { useTheme as kt } from "../../../hooks/useTheme.js";
3
3
  /* empty css */
4
4
  /* empty css */
5
5
  import "../../../locale/useLocale.js";
@@ -7,7 +7,7 @@ import "../../../locale/useLocale.js";
7
7
  import "../../../node_modules/linkifyjs/dist/linkify.js";
8
8
  import "../../../node_modules/linkify-string/dist/linkify-string.js";
9
9
  import "../../../functions/parseMarkdown.js";
10
- const At = { key: 0 }, Et = ["data-theme"], Dt = 6, Pt = 120, Yt = /* @__PURE__ */ st({
10
+ const Ct = { key: 0 }, Mt = ["data-theme"], Lt = 6, At = 120, Vt = /* @__PURE__ */ nt({
11
11
  __name: "Tooltip",
12
12
  props: {
13
13
  text: {
@@ -51,24 +51,19 @@ const At = { key: 0 }, Et = ["data-theme"], Dt = 6, Pt = 120, Yt = /* @__PURE__
51
51
  bubbleStyle: {
52
52
  type: Object,
53
53
  default: () => ({})
54
- },
55
- /** Позиционировать пузырь под курсором (clientX/Y), а не по bounds триггера */
56
- followCursor: {
57
- type: Boolean,
58
- default: !1
59
54
  }
60
55
  },
61
- setup(V, { expose: H }) {
62
- const w = ct("chatAppId"), { getTheme: D } = Lt(w), X = ht(), x = u(), p = u([]), f = u(!1), v = u(null), n = u(null), r = u(null), g = u(!1), d = u(!1), y = u({ x: 0, y: 0 }), e = V, _ = s(() => typeof X.content == "function"), Y = s(() => ({
56
+ setup(R, { expose: V }) {
57
+ const y = ut("chatAppId"), { getTheme: A } = kt(y), H = ft(), w = u(), m = u([]), f = u(!1), p = u(null), n = u(null), r = u(null), v = u(!1), g = u(!1), e = R, x = s(() => typeof H.content == "function"), j = s(() => ({
63
58
  tooltip__text: !0,
64
59
  [`tooltip--${e.position}`]: !0
65
- })), j = s(() => ({
60
+ })), q = s(() => ({
66
61
  maxWidth: e.maxWidth || void 0,
67
62
  ...e.bubbleStyle
68
- })), P = s(() => {
63
+ })), E = s(() => {
69
64
  const t = Array.isArray(e.texts) ? e.texts.map((o) => String(o ?? "").trim()).filter(Boolean) : [];
70
65
  return t.length > 0 ? t : e.text ? [e.text] : [];
71
- }), q = s(() => _.value ? ["__content__"] : P.value), z = s(() => _.value ? !0 : P.value.length > 0), F = (t, o) => {
66
+ }), z = s(() => x.value ? ["__content__"] : E.value), F = s(() => x.value ? !0 : E.value.length > 0), G = (t, o) => {
72
67
  const l = o.left < 0 ? o.left : 0, i = o.top < 0 ? o.top : 0;
73
68
  return {
74
69
  left: {
@@ -112,99 +107,92 @@ const At = { key: 0 }, Et = ["data-theme"], Dt = 6, Pt = 120, Yt = /* @__PURE__
112
107
  left: t.left - l
113
108
  }
114
109
  }[e.position];
115
- }, G = (t) => ({
116
- // «под курсором»: ниже pointer, по горизонтали — центр пузыря у X курсора
117
- top: y.value.y + e.offset,
118
- left: y.value.x - t.width / 2
119
- }), C = () => {
120
- if (!x.value || p.value.length === 0) return;
121
- const t = x.value.getBoundingClientRect(), o = !e.followCursor && e.position.startsWith("top"), l = 8, i = w ? document.getElementById(w) : null, a = i == null ? void 0 : i.getBoundingClientRect(), tt = (a == null ? void 0 : a.top) ?? 0, et = (a == null ? void 0 : a.left) ?? 0, ot = (a == null ? void 0 : a.right) ?? window.innerWidth, lt = (a == null ? void 0 : a.bottom) ?? window.innerHeight;
122
- p.value.forEach((M, it) => {
123
- const h = M.getBoundingClientRect(), k = e.followCursor ? G(h) : F(t, h), O = it * (h.height + Dt), rt = o ? k.top - O : k.top + O, $ = tt + l, at = lt - h.height - l, W = et + l, nt = ot - h.width - l, ut = Math.min(Math.max(rt, $), Math.max($, at)), ft = Math.min(Math.max(k.left, W), Math.max(W, nt));
124
- M.style.top = `${ut}px`, M.style.left = `${ft}px`;
110
+ }, D = () => {
111
+ if (!w.value || m.value.length === 0) return;
112
+ const t = w.value.getBoundingClientRect(), o = e.position.startsWith("top"), l = 8, i = y ? document.getElementById(y) : null, a = i == null ? void 0 : i.getBoundingClientRect(), Z = (a == null ? void 0 : a.top) ?? 0, b = (a == null ? void 0 : a.left) ?? 0, B = (a == null ? void 0 : a.right) ?? window.innerWidth, tt = (a == null ? void 0 : a.bottom) ?? window.innerHeight;
113
+ m.value.forEach((S, et) => {
114
+ const T = S.getBoundingClientRect(), k = G(t, T), O = et * (T.height + Lt), ot = o ? k.top - O : k.top + O, $ = Z + l, lt = tt - T.height - l, P = b + l, it = B - T.width - l, rt = Math.min(Math.max(ot, $), Math.max($, lt)), at = Math.min(Math.max(k.left, P), Math.max(P, it));
115
+ S.style.top = `${rt}px`, S.style.left = `${at}px`;
125
116
  });
126
117
  }, K = () => {
127
118
  e.trigger !== "auto" && (n.value && (clearTimeout(n.value), n.value = null), r.value && (clearTimeout(r.value), r.value = null), n.value = setTimeout(() => {
128
- f.value = !0, E(() => {
129
- C();
119
+ f.value = !0, L(() => {
120
+ D();
130
121
  }), n.value = null;
131
122
  }, e.delay));
132
- }, S = () => {
133
- e.trigger !== "auto" && (n.value && (clearTimeout(n.value), n.value = null), r.value && (clearTimeout(r.value), r.value = null), f.value = !1, E(() => {
134
- A(p).forEach((o) => {
123
+ }, _ = () => {
124
+ e.trigger !== "auto" && (n.value && (clearTimeout(n.value), n.value = null), r.value && (clearTimeout(r.value), r.value = null), f.value = !1, L(() => {
125
+ M(m).forEach((o) => {
135
126
  o.style.top = "0", o.style.left = "0";
136
127
  });
137
128
  }));
138
129
  }, I = () => {
139
130
  e.trigger !== "auto" && (r.value && clearTimeout(r.value), r.value = setTimeout(() => {
140
- !g.value && !d.value && S();
141
- }, Pt));
142
- }, U = (t) => {
143
- g.value = !0, e.followCursor && (y.value = { x: t.clientX, y: t.clientY }), K();
144
- }, J = (t) => {
145
- e.followCursor && (y.value = { x: t.clientX, y: t.clientY }, f.value && C());
146
- }, Q = () => {
131
+ !v.value && !g.value && _();
132
+ }, At));
133
+ }, U = () => {
134
+ v.value = !0, K();
135
+ }, X = () => {
136
+ v.value = !1, I();
137
+ }, Y = () => {
138
+ g.value = !0, r.value && (clearTimeout(r.value), r.value = null);
139
+ }, J = () => {
147
140
  g.value = !1, I();
148
- }, Z = () => {
149
- d.value = !0, r.value && (clearTimeout(r.value), r.value = null);
150
- }, b = () => {
151
- d.value = !1, I();
152
141
  }, N = () => {
153
142
  if (e.hideOnClick) {
154
- if (g.value = !1, d.value = !1, e.trigger === "auto") {
155
- T(), f.value = !1;
143
+ if (v.value = !1, g.value = !1, e.trigger === "auto") {
144
+ d(), f.value = !1;
156
145
  return;
157
146
  }
158
- S();
147
+ _();
159
148
  }
160
- }, B = () => {
161
- T(), f.value = !0, E(() => {
162
- C();
163
- }), e.autoShowDuration > 0 && (v.value = setTimeout(() => {
149
+ }, Q = () => {
150
+ d(), f.value = !0, L(() => {
151
+ D();
152
+ }), e.autoShowDuration > 0 && (p.value = setTimeout(() => {
164
153
  f.value = !1;
165
154
  }, e.autoShowDuration));
166
- }, T = () => {
167
- v.value && (clearTimeout(v.value), v.value = null);
155
+ }, d = () => {
156
+ p.value && (clearTimeout(p.value), p.value = null);
168
157
  };
169
- return mt(() => {
158
+ return st(() => {
170
159
  e.hideOnClick && document.addEventListener("mousedown", N, !0);
171
- }), pt(() => {
172
- e.hideOnClick && document.removeEventListener("mousedown", N, !0), n.value && clearTimeout(n.value), r.value && clearTimeout(r.value), T();
173
- }), H({
174
- startAutoShow: B,
175
- clearAutoTimer: T,
176
- hide: S
177
- }), (t, o) => (c(), m(L, null, [
178
- vt("div", {
160
+ }), ct(() => {
161
+ e.hideOnClick && document.removeEventListener("mousedown", N, !0), n.value && clearTimeout(n.value), r.value && clearTimeout(r.value), d();
162
+ }), V({
163
+ startAutoShow: Q,
164
+ clearAutoTimer: d,
165
+ hide: _
166
+ }), (t, o) => (c(), h(C, null, [
167
+ ht("div", {
179
168
  ref_key: "container",
180
- ref: x,
169
+ ref: w,
181
170
  class: "tooltip-wrapper",
182
171
  onMouseenter: U,
183
- onMousemove: J,
184
- onMouseleave: Q
172
+ onMouseleave: X
185
173
  }, [
186
- R(t.$slots, "default", {}, void 0, !0)
174
+ W(t.$slots, "default", {}, void 0, !0)
187
175
  ], 544),
188
- (c(), gt(dt, { to: "body" }, [
189
- yt(Tt, null, {
190
- default: wt(() => [
191
- f.value && z.value ? (c(), m("div", At, [
192
- (c(!0), m(L, null, _t(q.value, (l, i) => (c(), m("span", {
176
+ (c(), mt(pt, { to: "body" }, [
177
+ vt(gt, null, {
178
+ default: dt(() => [
179
+ f.value && F.value ? (c(), h("div", Ct, [
180
+ (c(!0), h(C, null, yt(z.value, (l, i) => (c(), h("span", {
193
181
  key: `${l}-${i}`,
194
182
  ref_for: !0,
195
183
  ref_key: "tooltipItems",
196
- ref: p,
197
- "data-theme": A(D)().theme ? A(D)().theme : "light",
198
- class: St(Y.value),
199
- style: Ct(j.value),
200
- onMouseenter: Z,
201
- onMouseleave: b
184
+ ref: m,
185
+ "data-theme": M(A)().theme ? M(A)().theme : "light",
186
+ class: xt(j.value),
187
+ style: wt(q.value),
188
+ onMouseenter: Y,
189
+ onMouseleave: J
202
190
  }, [
203
- _.value ? R(t.$slots, "content", { key: 0 }, void 0, !0) : (c(), m(L, { key: 1 }, [
204
- Mt(kt(l), 1)
191
+ x.value ? W(t.$slots, "content", { key: 0 }, void 0, !0) : (c(), h(C, { key: 1 }, [
192
+ _t(St(l), 1)
205
193
  ], 64))
206
- ], 46, Et))), 128))
207
- ])) : xt("", !0)
194
+ ], 46, Mt))), 128))
195
+ ])) : Tt("", !0)
208
196
  ]),
209
197
  _: 3
210
198
  })
@@ -213,5 +201,5 @@ const At = { key: 0 }, Et = ["data-theme"], Dt = 6, Pt = 120, Yt = /* @__PURE__
213
201
  }
214
202
  });
215
203
  export {
216
- Yt as default
204
+ Vt as default
217
205
  };
@@ -1,9 +1,9 @@
1
- import { isAttributeUnconfirmed as f, needsAttributeConfirmation as d } from "./useCommunicationAttributes.js";
2
- const c = /* @__PURE__ */ new Set(["whatsapp", "telegram", "max", "sms"]);
3
- function h(t) {
4
- return c.has(t);
1
+ import { needsAttributeConfirmation as f } from "./useCommunicationAttributes.js";
2
+ const d = /* @__PURE__ */ new Set(["whatsapp", "telegram", "max", "sms"]);
3
+ function c(t) {
4
+ return d.has(t);
5
5
  }
6
- function a(t, n) {
6
+ function h(t, n) {
7
7
  if (!n || !t.length)
8
8
  return;
9
9
  const l = n.includes(".") ? n.split(".").pop() : n;
@@ -12,10 +12,10 @@ function a(t, n) {
12
12
  return !i || typeof i != "string" ? !1 : i === n || i === l || i.endsWith(`.${l}`);
13
13
  });
14
14
  }
15
- function m(t, n, l, r) {
15
+ function a(t, n, l, r) {
16
16
  const i = r(t);
17
17
  if (n != null && n.channelId) {
18
- const s = i.find((e) => e.channelId === n.channelId);
18
+ const s = i.find((u) => u.channelId === n.channelId);
19
19
  if (s)
20
20
  return s.channelId;
21
21
  }
@@ -25,9 +25,9 @@ function m(t, n, l, r) {
25
25
  return (o == null ? void 0 : o.channelId) ?? null;
26
26
  }
27
27
  function I(t, n, l, r, i) {
28
- if (!h(t))
28
+ if (!c(t))
29
29
  return null;
30
- const o = n == null ? void 0 : n[t], s = m(
30
+ const o = n == null ? void 0 : n[t], s = a(
31
31
  t,
32
32
  o,
33
33
  r,
@@ -35,13 +35,10 @@ function I(t, n, l, r, i) {
35
35
  );
36
36
  if (!s)
37
37
  return null;
38
- const e = l[t] ?? [];
39
- if (e.some(f))
40
- return null;
41
- const u = a(e, o == null ? void 0 : o.attributeId) ?? (e.length === 1 ? e[0] : void 0);
42
- return !u || d(u) ? null : { attribute: u, channelId: s };
38
+ const u = l[t] ?? [], e = h(u, o == null ? void 0 : o.attributeId) ?? (u.length === 1 ? u[0] : void 0);
39
+ return !e || f(e) ? null : { attribute: e, channelId: s };
43
40
  }
44
41
  export {
45
- h as isOneClickChannelType,
42
+ c as isOneClickChannelType,
46
43
  I as resolveRecentChannelSelection
47
44
  };
@@ -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 f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-a4bf1ccf"]]);
3
+ import o from "../../../_virtual/_plugin-vue_export-helper.js";
4
+ const s = /* @__PURE__ */ o(e, [["__scopeId", "data-v-e7027153"]]);
5
5
  export {
6
- f as default
6
+ s as default
7
7
  };
@@ -1,9 +1,9 @@
1
- import { defineComponent as v, computed as T, ref as m, onMounted as y, onBeforeUnmount as x, watch as _, createElementBlock as c, openBlock as n, normalizeClass as R, createBlock as D, withCtx as O, createElementVNode as b, toDisplayString as f } from "vue";
1
+ import { defineComponent as v, computed as T, ref as c, onMounted as y, onBeforeUnmount as x, watch as _, createElementBlock as u, openBlock as n, normalizeClass as R, createBlock as b, withCtx as D, createElementVNode as O, toDisplayString as f } from "vue";
2
2
  import h from "../../1_atoms/Tooltip/Tooltip.vue.js";
3
- const w = { class: "delimiter-message__text" }, k = {
3
+ const k = { class: "delimiter-message__text" }, I = {
4
4
  key: 1,
5
5
  class: "delimiter-message__text"
6
- }, B = 3e3, C = 400, A = /* @__PURE__ */ v({
6
+ }, N = 3e3, A = 400, U = /* @__PURE__ */ v({
7
7
  __name: "DelimiterMessage",
8
8
  props: {
9
9
  message: {
@@ -15,10 +15,10 @@ const w = { class: "delimiter-message__text" }, k = {
15
15
  type: String,
16
16
  default: ""
17
17
  },
18
- /** Позиция тултипа: top | right | bottom | left | bottom-left | top-center */
18
+ /** Позиция тултипа: top | right | bottom | bottom-center | left | bottom-left | top-center */
19
19
  tooltipPosition: {
20
20
  type: String,
21
- default: "top-center"
21
+ default: "bottom-center"
22
22
  },
23
23
  /** Отступ тултипа от элемента (px) */
24
24
  tooltipOffset: {
@@ -29,69 +29,63 @@ const w = { class: "delimiter-message__text" }, k = {
29
29
  tooltipDelay: {
30
30
  type: Number,
31
31
  default: 100
32
- },
33
- /** Позиционировать тултип под курсором (FDR-0028) */
34
- tooltipFollowCursor: {
35
- type: Boolean,
36
- default: !0
37
32
  }
38
33
  },
39
34
  emits: ["read"],
40
35
  setup(o, { emit: d }) {
41
- const i = o, r = T(
36
+ const i = o, a = T(
42
37
  () => i.tooltipText || i.message.tooltipText || ""
43
- ), p = d, l = m(null), a = m(!1);
38
+ ), p = d, s = c(null), r = c(!1);
44
39
  let t = null, e = null;
45
- const u = () => {
46
- !i.message.autoRemove || !l.value || (t = new IntersectionObserver(
47
- (s) => {
48
- s[0].isIntersecting ? (e && clearTimeout(e), e = setTimeout(() => {
49
- a.value = !0, t && l.value && (t.disconnect(), t = null), setTimeout(() => {
40
+ const m = () => {
41
+ !i.message.autoRemove || !s.value || (t = new IntersectionObserver(
42
+ (l) => {
43
+ l[0].isIntersecting ? (e && clearTimeout(e), e = setTimeout(() => {
44
+ r.value = !0, t && s.value && (t.disconnect(), t = null), setTimeout(() => {
50
45
  p("read", i.message.messageId);
51
- }, C);
52
- }, B)) : e && (clearTimeout(e), e = null);
46
+ }, A);
47
+ }, N)) : e && (clearTimeout(e), e = null);
53
48
  },
54
49
  {
55
50
  threshold: 0.75,
56
51
  // Элемент должен быть виден минимум на 75%
57
52
  rootMargin: "0px"
58
53
  }
59
- ), t.observe(l.value));
54
+ ), t.observe(s.value));
60
55
  };
61
56
  return y(() => {
62
57
  i.message.autoRemove && setTimeout(() => {
63
- u();
58
+ m();
64
59
  }, 100);
65
60
  }), x(() => {
66
61
  e && (clearTimeout(e), e = null), t && (t.disconnect(), t = null);
67
62
  }), _(
68
63
  () => i.message.autoRemove,
69
- (s) => {
70
- t && (t.disconnect(), t = null), e && (clearTimeout(e), e = null), s && setTimeout(() => {
71
- u();
64
+ (l) => {
65
+ t && (t.disconnect(), t = null), e && (clearTimeout(e), e = null), l && setTimeout(() => {
66
+ m();
72
67
  }, 100);
73
68
  }
74
- ), (s, g) => (n(), c("div", {
69
+ ), (l, g) => (n(), u("div", {
75
70
  ref_key: "containerRef",
76
- ref: l,
77
- class: R(["delimiter-message__container", { "delimiter-message__container--removing": a.value }])
71
+ ref: s,
72
+ class: R(["delimiter-message__container", { "delimiter-message__container--removing": r.value }])
78
73
  }, [
79
- r.value ? (n(), D(h, {
74
+ a.value ? (n(), b(h, {
80
75
  key: 0,
81
- text: r.value,
76
+ text: a.value,
82
77
  position: o.tooltipPosition,
83
78
  offset: o.tooltipOffset,
84
- delay: o.tooltipDelay,
85
- "follow-cursor": o.tooltipFollowCursor
79
+ delay: o.tooltipDelay
86
80
  }, {
87
- default: O(() => [
88
- b("p", w, f(o.message.text), 1)
81
+ default: D(() => [
82
+ O("p", k, f(o.message.text), 1)
89
83
  ]),
90
84
  _: 1
91
- }, 8, ["text", "position", "offset", "delay", "follow-cursor"])) : (n(), c("p", k, f(o.message.text), 1))
85
+ }, 8, ["text", "position", "offset", "delay"])) : (n(), u("p", I, f(o.message.text), 1))
92
86
  ], 2));
93
87
  }
94
88
  });
95
89
  export {
96
- A as default
90
+ U as default
97
91
  };