@leaflink/stash 50.2.1 → 50.4.0

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/Tooltip.js CHANGED
@@ -1,131 +1,10 @@
1
- import { getCurrentScope as C, onScopeDispose as D, unref as M, ref as p, watch as $, defineComponent as F, computed as A, openBlock as Y, createElementBlock as P, createElementVNode as X, renderSlot as E, createBlock as j, Teleport as I, normalizeStyle as k, createTextVNode as R, toDisplayString as V } from "vue";
2
- import { u as z, a as L, f as N, o as G, b as U } from "./floating-ui.vue-BmfQDqE-.js";
3
- function q(e) {
4
- return C() ? (D(e), !0) : !1;
5
- }
6
- function B(e) {
7
- return typeof e == "function" ? e() : M(e);
8
- }
9
- const J = typeof window < "u" && typeof document < "u";
10
- typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
11
- const K = Object.prototype.toString, Q = (e) => K.call(e) === "[object Object]", Z = () => {
12
- }, W = J ? window : void 0;
13
- function H(e) {
14
- var s;
15
- const n = B(e);
16
- return (s = n == null ? void 0 : n.$el) != null ? s : n;
17
- }
18
- function b(...e) {
19
- let s, n, l, i;
20
- if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([n, l, i] = e, s = W) : [s, n, l, i] = e, !s)
21
- return Z;
22
- Array.isArray(n) || (n = [n]), Array.isArray(l) || (l = [l]);
23
- const c = [], f = () => {
24
- c.forEach((o) => o()), c.length = 0;
25
- }, y = (o, r, u, a) => (o.addEventListener(r, u, a), () => o.removeEventListener(r, u, a)), d = $(
26
- () => [H(s), B(i)],
27
- ([o, r]) => {
28
- if (f(), !o)
29
- return;
30
- const u = Q(r) ? { ...r } : r;
31
- c.push(
32
- ...n.flatMap((a) => l.map((m) => y(o, a, m, u)))
33
- );
34
- },
35
- { immediate: !0, flush: "post" }
36
- ), w = () => {
37
- d(), f();
38
- };
39
- return q(w), w;
40
- }
41
- const ee = {
42
- page: (e) => [e.pageX, e.pageY],
43
- client: (e) => [e.clientX, e.clientY],
44
- screen: (e) => [e.screenX, e.screenY],
45
- movement: (e) => e instanceof Touch ? null : [e.movementX, e.movementY]
46
- };
47
- function te(e = {}) {
48
- const {
49
- type: s = "page",
50
- touch: n = !0,
51
- resetOnTouchEnds: l = !1,
52
- initialValue: i = { x: 0, y: 0 },
53
- window: c = W,
54
- target: f = c,
55
- scroll: y = !0,
56
- eventFilter: d
57
- } = e;
58
- let w = null;
59
- const o = p(i.x), r = p(i.y), u = p(null), a = typeof s == "function" ? s : ee[s], m = (t) => {
60
- const h = a(t);
61
- w = t, h && ([o.value, r.value] = h, u.value = "mouse");
62
- }, v = (t) => {
63
- if (t.touches.length > 0) {
64
- const h = a(t.touches[0]);
65
- h && ([o.value, r.value] = h, u.value = "touch");
66
- }
67
- }, g = () => {
68
- if (!w || !c)
69
- return;
70
- const t = a(w);
71
- w instanceof MouseEvent && t && (o.value = t[0] + c.scrollX, r.value = t[1] + c.scrollY);
72
- }, x = () => {
73
- o.value = i.x, r.value = i.y;
74
- }, S = d ? (t) => d(() => m(t), {}) : (t) => m(t), O = d ? (t) => d(() => v(t), {}) : (t) => v(t), _ = d ? () => d(() => g(), {}) : () => g();
75
- if (f) {
76
- const t = { passive: !0 };
77
- b(f, ["mousemove", "dragover"], S, t), n && s !== "movement" && (b(f, ["touchstart", "touchmove"], O, t), l && b(f, "touchend", x, t)), y && s === "page" && b(c, "scroll", _, { passive: !0 });
78
- }
79
- return {
80
- x: o,
81
- y: r,
82
- sourceType: u
83
- };
84
- }
85
- function oe(e, s = {}) {
86
- const {
87
- handleOutside: n = !0,
88
- window: l = W
89
- } = s, i = s.type || "page", { x: c, y: f, sourceType: y } = te(s), d = p(e ?? (l == null ? void 0 : l.document.body)), w = p(0), o = p(0), r = p(0), u = p(0), a = p(0), m = p(0), v = p(!0);
90
- let g = () => {
91
- };
92
- return l && (g = $(
93
- [d, c, f],
94
- () => {
95
- const x = H(d);
96
- if (!x || !(x instanceof Element))
97
- return;
98
- const {
99
- left: S,
100
- top: O,
101
- width: _,
102
- height: t
103
- } = x.getBoundingClientRect();
104
- r.value = S + (i === "page" ? l.pageXOffset : 0), u.value = O + (i === "page" ? l.pageYOffset : 0), a.value = t, m.value = _;
105
- const h = c.value - r.value, T = f.value - u.value;
106
- v.value = _ === 0 || t === 0 || h < 0 || T < 0 || h > _ || T > t, (n || !v.value) && (w.value = h, o.value = T);
107
- },
108
- { immediate: !0 }
109
- ), b(document, "mouseleave", () => {
110
- v.value = !0;
111
- })), {
112
- x: c,
113
- y: f,
114
- sourceType: y,
115
- elementX: w,
116
- elementY: o,
117
- elementPositionX: r,
118
- elementPositionY: u,
119
- elementHeight: a,
120
- elementWidth: m,
121
- isOutside: v,
122
- stop: g
123
- };
124
- }
125
- const ne = {
1
+ import { defineComponent as g, ref as n, computed as r, openBlock as d, createElementBlock as S, createElementVNode as i, renderSlot as l, createBlock as T, Teleport as E, normalizeStyle as u, unref as $, createTextVNode as k, toDisplayString as O } from "vue";
2
+ import { u as A, a as B, f as F, o as D, b as I } from "./floating-ui.vue-BmfQDqE-.js";
3
+ import { u as P } from "./index-Ck3Dl09q.js";
4
+ const z = {
126
5
  ref: "wrapper",
127
6
  class: "stash-tooltip__wrapper tw-relative tw-inline-flex tw-h-fit tw-w-fit"
128
- }, se = 6, le = 12, ce = /* @__PURE__ */ F({
7
+ }, M = 6, N = 12, X = /* @__PURE__ */ g({
129
8
  __name: "Tooltip",
130
9
  props: {
131
10
  disableTeleport: { type: Boolean, default: !1 },
@@ -134,59 +13,59 @@ const ne = {
134
13
  teleportTo: { default: "#stash-menus-mount-node" },
135
14
  text: { default: "" }
136
15
  },
137
- setup(e) {
138
- const s = {
16
+ setup(f) {
17
+ const m = {
139
18
  top: "bottom",
140
19
  right: "left",
141
20
  bottom: "top",
142
21
  left: "right"
143
- }, n = e, l = p(null), i = p(null), c = p(null), { isOutside: f } = oe(l), y = A(() => !f.value || n.isOpen), d = A(() => n.side), { floatingStyles: w, middlewareData: o, placement: r } = z(l, c, {
144
- whileElementsMounted: L,
145
- placement: d,
146
- middleware: [N(), G(le), U({ element: i })]
147
- }), u = A(() => {
148
- var m, v;
149
- const a = s[r.value];
22
+ }, e = f, a = n(null), p = n(null), c = n(null), { isOutside: h } = P(a), _ = r(() => !h.value || e.isOpen), y = r(() => e.side), { floatingStyles: x, middlewareData: o, placement: v } = A(a, c, {
23
+ whileElementsMounted: B,
24
+ placement: y,
25
+ middleware: [F(), D(N), I({ element: p })]
26
+ }), b = r(() => {
27
+ var s, w;
28
+ const t = m[v.value];
150
29
  return {
151
- left: ((m = o.value.arrow) == null ? void 0 : m.x) != null ? `${o.value.arrow.x}px` : "",
152
- top: ((v = o.value.arrow) == null ? void 0 : v.y) != null ? `${o.value.arrow.y}px` : "",
153
- [a]: `-${se}px`
30
+ left: ((s = o.value.arrow) == null ? void 0 : s.x) != null ? `${o.value.arrow.x}px` : "",
31
+ top: ((w = o.value.arrow) == null ? void 0 : w.y) != null ? `${o.value.arrow.y}px` : "",
32
+ [t]: `-${M}px`
154
33
  };
155
34
  });
156
- return (a, m) => (Y(), P("div", ne, [
157
- X("span", {
35
+ return (t, s) => (d(), S("div", z, [
36
+ i("span", {
158
37
  ref_key: "anchor",
159
- ref: l,
38
+ ref: a,
160
39
  "data-test": "stash-tooltip|anchor",
161
40
  class: "stash-tooltip__anchor"
162
41
  }, [
163
- E(a.$slots, "default")
42
+ l(t.$slots, "default")
164
43
  ], 512),
165
- (Y(), j(I, {
166
- to: n.teleportTo,
167
- disabled: n.disableTeleport
44
+ (d(), T(E, {
45
+ to: e.teleportTo,
46
+ disabled: e.disableTeleport
168
47
  }, [
169
- X("div", {
48
+ i("div", {
170
49
  ref_key: "tooltip",
171
50
  ref: c,
172
51
  "data-test": "stash-tooltip",
173
52
  class: "stash-tooltip tw-pointer-events-none tw-z-screen tw-flex tw-w-[148px] tw-flex-col tw-items-center tw-whitespace-normal tw-rounded tw-bg-ice-900 tw-p-3 tw-text-center tw-text-xs tw-text-white tw-opacity-0 tw-shadow tw-transition-opacity",
174
53
  role: "tooltip",
175
- style: k({
176
- ...M(w),
177
- opacity: y.value ? 0.95 : 0
54
+ style: u({
55
+ ...$(x),
56
+ opacity: _.value ? 0.95 : 0
178
57
  })
179
58
  }, [
180
- E(a.$slots, "icon"),
181
- E(a.$slots, "content", {}, () => [
182
- R(V(n.text), 1)
59
+ l(t.$slots, "icon"),
60
+ l(t.$slots, "content", {}, () => [
61
+ k(O(e.text), 1)
183
62
  ]),
184
- E(a.$slots, "secondaryIcon"),
185
- X("div", {
63
+ l(t.$slots, "secondaryIcon"),
64
+ i("div", {
186
65
  ref_key: "floatingArrow",
187
- ref: i,
66
+ ref: p,
188
67
  class: "stash-tooltip__arrow tw-absolute tw-z-behind tw-h-[12px] tw-w-[12px] tw-rotate-45 tw-bg-ice-900",
189
- style: k(u.value)
68
+ style: u(b.value)
190
69
  }, null, 4)
191
70
  ], 4)
192
71
  ], 8, ["to", "disabled"]))
@@ -194,6 +73,6 @@ const ne = {
194
73
  }
195
74
  });
196
75
  export {
197
- ce as default
76
+ X as default
198
77
  };
199
78
  //# sourceMappingURL=Tooltip.js.map