@mobilon-dev/chotto 0.3.113 → 0.3.115

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 _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-11bc5009"]]);
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-0e9ba92c"]]);
5
5
  export {
6
- _ as default
6
+ m as default
7
7
  };
@@ -1,5 +1,5 @@
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";
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";
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 Ct = { key: 0 }, Mt = ["data-theme"], Lt = 6, At = 120, Vt = /* @__PURE__ */ nt({
10
+ const At = { key: 0 }, Et = ["data-theme"], Dt = 6, Pt = 120, Yt = /* @__PURE__ */ st({
11
11
  __name: "Tooltip",
12
12
  props: {
13
13
  text: {
@@ -51,19 +51,24 @@ const Ct = { key: 0 }, Mt = ["data-theme"], Lt = 6, At = 120, Vt = /* @__PURE__
51
51
  bubbleStyle: {
52
52
  type: Object,
53
53
  default: () => ({})
54
+ },
55
+ /** Позиционировать пузырь под курсором (clientX/Y), а не по bounds триггера */
56
+ followCursor: {
57
+ type: Boolean,
58
+ default: !1
54
59
  }
55
60
  },
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(() => ({
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(() => ({
58
63
  tooltip__text: !0,
59
64
  [`tooltip--${e.position}`]: !0
60
- })), q = s(() => ({
65
+ })), j = s(() => ({
61
66
  maxWidth: e.maxWidth || void 0,
62
67
  ...e.bubbleStyle
63
- })), E = s(() => {
68
+ })), P = s(() => {
64
69
  const t = Array.isArray(e.texts) ? e.texts.map((o) => String(o ?? "").trim()).filter(Boolean) : [];
65
70
  return t.length > 0 ? t : e.text ? [e.text] : [];
66
- }), z = s(() => x.value ? ["__content__"] : E.value), F = s(() => x.value ? !0 : E.value.length > 0), G = (t, o) => {
71
+ }), q = s(() => _.value ? ["__content__"] : P.value), z = s(() => _.value ? !0 : P.value.length > 0), F = (t, o) => {
67
72
  const l = o.left < 0 ? o.left : 0, i = o.top < 0 ? o.top : 0;
68
73
  return {
69
74
  left: {
@@ -107,92 +112,99 @@ const Ct = { key: 0 }, Mt = ["data-theme"], Lt = 6, At = 120, Vt = /* @__PURE__
107
112
  left: t.left - l
108
113
  }
109
114
  }[e.position];
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`;
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`;
116
125
  });
117
126
  }, K = () => {
118
127
  e.trigger !== "auto" && (n.value && (clearTimeout(n.value), n.value = null), r.value && (clearTimeout(r.value), r.value = null), n.value = setTimeout(() => {
119
- f.value = !0, L(() => {
120
- D();
128
+ f.value = !0, E(() => {
129
+ C();
121
130
  }), n.value = null;
122
131
  }, e.delay));
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) => {
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) => {
126
135
  o.style.top = "0", o.style.left = "0";
127
136
  });
128
137
  }));
129
138
  }, I = () => {
130
139
  e.trigger !== "auto" && (r.value && clearTimeout(r.value), r.value = setTimeout(() => {
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 = () => {
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 = () => {
140
147
  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();
141
152
  }, N = () => {
142
153
  if (e.hideOnClick) {
143
- if (v.value = !1, g.value = !1, e.trigger === "auto") {
144
- d(), f.value = !1;
154
+ if (g.value = !1, d.value = !1, e.trigger === "auto") {
155
+ T(), f.value = !1;
145
156
  return;
146
157
  }
147
- _();
158
+ S();
148
159
  }
149
- }, Q = () => {
150
- d(), f.value = !0, L(() => {
151
- D();
152
- }), e.autoShowDuration > 0 && (p.value = setTimeout(() => {
160
+ }, B = () => {
161
+ T(), f.value = !0, E(() => {
162
+ C();
163
+ }), e.autoShowDuration > 0 && (v.value = setTimeout(() => {
153
164
  f.value = !1;
154
165
  }, e.autoShowDuration));
155
- }, d = () => {
156
- p.value && (clearTimeout(p.value), p.value = null);
166
+ }, T = () => {
167
+ v.value && (clearTimeout(v.value), v.value = null);
157
168
  };
158
- return st(() => {
169
+ return mt(() => {
159
170
  e.hideOnClick && document.addEventListener("mousedown", N, !0);
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", {
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", {
168
179
  ref_key: "container",
169
- ref: w,
180
+ ref: x,
170
181
  class: "tooltip-wrapper",
171
182
  onMouseenter: U,
172
- onMouseleave: X
183
+ onMousemove: J,
184
+ onMouseleave: Q
173
185
  }, [
174
- W(t.$slots, "default", {}, void 0, !0)
186
+ R(t.$slots, "default", {}, void 0, !0)
175
187
  ], 544),
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", {
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", {
181
193
  key: `${l}-${i}`,
182
194
  ref_for: !0,
183
195
  ref_key: "tooltipItems",
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
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
190
202
  }, [
191
- x.value ? W(t.$slots, "content", { key: 0 }, void 0, !0) : (c(), h(C, { key: 1 }, [
192
- _t(St(l), 1)
203
+ _.value ? R(t.$slots, "content", { key: 0 }, void 0, !0) : (c(), m(L, { key: 1 }, [
204
+ Mt(kt(l), 1)
193
205
  ], 64))
194
- ], 46, Mt))), 128))
195
- ])) : Tt("", !0)
206
+ ], 46, Et))), 128))
207
+ ])) : xt("", !0)
196
208
  ]),
197
209
  _: 3
198
210
  })
@@ -201,5 +213,5 @@ const Ct = { key: 0 }, Mt = ["data-theme"], Lt = 6, At = 120, Vt = /* @__PURE__
201
213
  }
202
214
  });
203
215
  export {
204
- Vt as default
216
+ Yt as default
205
217
  };
@@ -1,7 +1,7 @@
1
- import e from "./DelimiterMessage.vue2.js";
1
+ import o from "./DelimiterMessage.vue2.js";
2
2
  /* empty css */
3
- import o from "../../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ o(e, [["__scopeId", "data-v-75a5769e"]]);
3
+ import t from "../../../_virtual/_plugin-vue_export-helper.js";
4
+ const f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-a4bf1ccf"]]);
5
5
  export {
6
- m as default
6
+ f as default
7
7
  };
@@ -1,9 +1,9 @@
1
- import { defineComponent as T, computed as y, ref as c, onMounted as x, onBeforeUnmount as R, watch as h, createElementBlock as u, openBlock as f, createVNode as D, withCtx as O, createElementVNode as a, normalizeClass as d, toDisplayString as p } from "vue";
2
- import b 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({
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";
2
+ import h from "../../1_atoms/Tooltip/Tooltip.vue.js";
3
+ const w = { class: "delimiter-message__text" }, k = {
4
+ key: 1,
5
+ class: "delimiter-message__text"
6
+ }, B = 3e3, C = 400, A = /* @__PURE__ */ v({
7
7
  __name: "DelimiterMessage",
8
8
  props: {
9
9
  message: {
@@ -29,71 +29,69 @@ const k = {
29
29
  tooltipDelay: {
30
30
  type: Number,
31
31
  default: 100
32
+ },
33
+ /** Позиционировать тултип под курсором (FDR-0028) */
34
+ tooltipFollowCursor: {
35
+ type: Boolean,
36
+ default: !0
32
37
  }
33
38
  },
34
39
  emits: ["read"],
35
- setup(o, { emit: g }) {
36
- const i = o, r = y(
40
+ setup(o, { emit: d }) {
41
+ const i = o, r = T(
37
42
  () => i.tooltipText || i.message.tooltipText || ""
38
- ), v = g, s = c(null), l = c(!1);
43
+ ), p = d, l = m(null), a = m(!1);
39
44
  let t = null, 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);
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(() => {
50
+ p("read", i.message.messageId);
51
+ }, C);
52
+ }, B)) : e && (clearTimeout(e), e = null);
48
53
  },
49
54
  {
50
55
  threshold: 0.75,
51
56
  // Элемент должен быть виден минимум на 75%
52
57
  rootMargin: "0px"
53
58
  }
54
- ), t.observe(s.value));
59
+ ), t.observe(l.value));
55
60
  };
56
- return x(() => {
61
+ return y(() => {
57
62
  i.message.autoRemove && setTimeout(() => {
58
- m();
63
+ u();
59
64
  }, 100);
60
- }), R(() => {
65
+ }), x(() => {
61
66
  e && (clearTimeout(e), e = null), t && (t.disconnect(), t = null);
62
- }), h(
67
+ }), _(
63
68
  () => i.message.autoRemove,
64
- (n) => {
65
- t && (t.disconnect(), t = null), e && (clearTimeout(e), e = null), n && setTimeout(() => {
66
- m();
69
+ (s) => {
70
+ t && (t.disconnect(), t = null), e && (clearTimeout(e), e = null), s && setTimeout(() => {
71
+ u();
67
72
  }, 100);
68
73
  }
69
- ), (n, _) => r.value ? (f(), u("div", k, [
70
- D(b, {
74
+ ), (s, g) => (n(), c("div", {
75
+ ref_key: "containerRef",
76
+ ref: l,
77
+ class: R(["delimiter-message__container", { "delimiter-message__container--removing": a.value }])
78
+ }, [
79
+ r.value ? (n(), D(h, {
80
+ key: 0,
71
81
  text: r.value,
72
82
  position: o.tooltipPosition,
73
83
  offset: o.tooltipOffset,
74
- delay: o.tooltipDelay
84
+ delay: o.tooltipDelay,
85
+ "follow-cursor": o.tooltipFollowCursor
75
86
  }, {
76
87
  default: O(() => [
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, p(o.message.text), 1)
83
- ], 2)
88
+ b("p", w, f(o.message.text), 1)
84
89
  ]),
85
90
  _: 1
86
- }, 8, ["text", "position", "offset", "delay"])
87
- ])) : (f(), u("div", {
88
- key: 1,
89
- ref_key: "containerRef",
90
- ref: s,
91
- class: d(["delimiter-message__container", { "delimiter-message__container--removing": l.value }])
92
- }, [
93
- a("p", I, p(o.message.text), 1)
91
+ }, 8, ["text", "position", "offset", "delay", "follow-cursor"])) : (n(), c("p", k, f(o.message.text), 1))
94
92
  ], 2));
95
93
  }
96
94
  });
97
95
  export {
98
- B as default
96
+ A as default
99
97
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./Feed.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-f5bc4663"]]);
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-9221fdb9"]]);
5
5
  export {
6
6
  m as default
7
7
  };
@@ -393,6 +393,7 @@ const dt = {
393
393
  }),
394
394
  a.feedKeyboards && a.feedKeyboards.length > 0 ? (i(), f(Ve, {
395
395
  key: 1,
396
+ class: "message-feed__feed-keyboard",
396
397
  buttons: a.feedKeyboards,
397
398
  align: a.feedKeyboardAlign,
398
399
  onAction: o(he)