@leaflink/stash 51.10.0 → 51.11.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.
@@ -0,0 +1,294 @@
1
+ import { isRef as B, ref as v, unref as j, onMounted as z, nextTick as L, getCurrentScope as F, onScopeDispose as V, getCurrentInstance as I, watch as A, computed as T } from "vue";
2
+ function _(e) {
3
+ return F() ? (V(e), !0) : !1;
4
+ }
5
+ function S(e) {
6
+ return typeof e == "function" ? e() : j(e);
7
+ }
8
+ const D = typeof window < "u" && typeof document < "u";
9
+ typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
10
+ const k = (e) => e != null, G = Object.prototype.toString, P = (e) => G.call(e) === "[object Object]", Y = () => {
11
+ };
12
+ function q(e) {
13
+ return I();
14
+ }
15
+ function N(e, n = !0, l) {
16
+ q() ? z(e, l) : n ? e() : L(e);
17
+ }
18
+ function ee(e = !1, n = {}) {
19
+ const {
20
+ truthyValue: l = !0,
21
+ falsyValue: r = !1
22
+ } = n, p = B(e), t = v(e);
23
+ function c(d) {
24
+ if (arguments.length)
25
+ return t.value = d, t.value;
26
+ {
27
+ const i = S(l);
28
+ return t.value = t.value === i ? S(r) : i, t.value;
29
+ }
30
+ }
31
+ return p ? c : [t, c];
32
+ }
33
+ const E = D ? window : void 0;
34
+ function O(e) {
35
+ var n;
36
+ const l = S(e);
37
+ return (n = l?.$el) != null ? n : l;
38
+ }
39
+ function M(...e) {
40
+ let n, l, r, p;
41
+ if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([l, r, p] = e, n = E) : [n, l, r, p] = e, !n)
42
+ return Y;
43
+ Array.isArray(l) || (l = [l]), Array.isArray(r) || (r = [r]);
44
+ const t = [], c = () => {
45
+ t.forEach((u) => u()), t.length = 0;
46
+ }, d = (u, o, s, f) => (u.addEventListener(o, s, f), () => u.removeEventListener(o, s, f)), i = A(
47
+ () => [O(n), S(p)],
48
+ ([u, o]) => {
49
+ if (c(), !u)
50
+ return;
51
+ const s = P(o) ? { ...o } : o;
52
+ t.push(
53
+ ...l.flatMap((f) => r.map((h) => d(u, f, h, s)))
54
+ );
55
+ },
56
+ { immediate: !0, flush: "post" }
57
+ ), m = () => {
58
+ i(), c();
59
+ };
60
+ return _(m), m;
61
+ }
62
+ function U() {
63
+ const e = v(!1), n = I();
64
+ return n && z(() => {
65
+ e.value = !0;
66
+ }, n), e;
67
+ }
68
+ function H(e) {
69
+ const n = U();
70
+ return T(() => (n.value, !!e()));
71
+ }
72
+ function $(e, n, l = {}) {
73
+ const { window: r = E, ...p } = l;
74
+ let t;
75
+ const c = H(() => r && "MutationObserver" in r), d = () => {
76
+ t && (t.disconnect(), t = void 0);
77
+ }, i = T(() => {
78
+ const s = S(e), f = (Array.isArray(s) ? s : [s]).map(O).filter(k);
79
+ return new Set(f);
80
+ }), m = A(
81
+ () => i.value,
82
+ (s) => {
83
+ d(), c.value && s.size && (t = new MutationObserver(n), s.forEach((f) => t.observe(f, p)));
84
+ },
85
+ { immediate: !0, flush: "post" }
86
+ ), u = () => t?.takeRecords(), o = () => {
87
+ m(), d();
88
+ };
89
+ return _(o), {
90
+ isSupported: c,
91
+ stop: o,
92
+ takeRecords: u
93
+ };
94
+ }
95
+ function J(e, n, l = {}) {
96
+ const { window: r = E, ...p } = l;
97
+ let t;
98
+ const c = H(() => r && "ResizeObserver" in r), d = () => {
99
+ t && (t.disconnect(), t = void 0);
100
+ }, i = T(() => {
101
+ const o = S(e);
102
+ return Array.isArray(o) ? o.map((s) => O(s)) : [O(o)];
103
+ }), m = A(
104
+ i,
105
+ (o) => {
106
+ if (d(), c.value && r) {
107
+ t = new ResizeObserver(n);
108
+ for (const s of o)
109
+ s && t.observe(s, p);
110
+ }
111
+ },
112
+ { immediate: !0, flush: "post" }
113
+ ), u = () => {
114
+ d(), m();
115
+ };
116
+ return _(u), {
117
+ isSupported: c,
118
+ stop: u
119
+ };
120
+ }
121
+ function te(e, n = {}) {
122
+ const {
123
+ reset: l = !0,
124
+ windowResize: r = !0,
125
+ windowScroll: p = !0,
126
+ immediate: t = !0,
127
+ updateTiming: c = "sync"
128
+ } = n, d = v(0), i = v(0), m = v(0), u = v(0), o = v(0), s = v(0), f = v(0), h = v(0);
129
+ function b() {
130
+ const y = O(e);
131
+ if (!y) {
132
+ l && (d.value = 0, i.value = 0, m.value = 0, u.value = 0, o.value = 0, s.value = 0, f.value = 0, h.value = 0);
133
+ return;
134
+ }
135
+ const w = y.getBoundingClientRect();
136
+ d.value = w.height, i.value = w.bottom, m.value = w.left, u.value = w.right, o.value = w.top, s.value = w.width, f.value = w.x, h.value = w.y;
137
+ }
138
+ function g() {
139
+ c === "sync" ? b() : c === "next-frame" && requestAnimationFrame(() => b());
140
+ }
141
+ return J(e, g), A(() => O(e), (y) => !y && g()), $(e, g, {
142
+ attributeFilter: ["style", "class"]
143
+ }), p && M("scroll", g, { capture: !0, passive: !0 }), r && M("resize", g, { passive: !0 }), N(() => {
144
+ t && g();
145
+ }), {
146
+ height: d,
147
+ bottom: i,
148
+ left: m,
149
+ right: u,
150
+ top: o,
151
+ width: s,
152
+ x: f,
153
+ y: h,
154
+ update: g
155
+ };
156
+ }
157
+ function ne(e, n, l = {}) {
158
+ const {
159
+ root: r,
160
+ rootMargin: p = "0px",
161
+ threshold: t = 0,
162
+ window: c = E,
163
+ immediate: d = !0
164
+ } = l, i = H(() => c && "IntersectionObserver" in c), m = T(() => {
165
+ const h = S(e);
166
+ return (Array.isArray(h) ? h : [h]).map(O).filter(k);
167
+ });
168
+ let u = Y;
169
+ const o = v(d), s = i.value ? A(
170
+ () => [m.value, O(r), o.value],
171
+ ([h, b]) => {
172
+ if (u(), !o.value || !h.length)
173
+ return;
174
+ const g = new IntersectionObserver(
175
+ n,
176
+ {
177
+ root: O(b),
178
+ rootMargin: p,
179
+ threshold: t
180
+ }
181
+ );
182
+ h.forEach((y) => y && g.observe(y)), u = () => {
183
+ g.disconnect(), u = Y;
184
+ };
185
+ },
186
+ { immediate: d, flush: "post" }
187
+ ) : Y, f = () => {
188
+ u(), s(), o.value = !1;
189
+ };
190
+ return _(f), {
191
+ isSupported: i,
192
+ isActive: o,
193
+ pause() {
194
+ u(), o.value = !1;
195
+ },
196
+ resume() {
197
+ o.value = !0;
198
+ },
199
+ stop: f
200
+ };
201
+ }
202
+ const K = {
203
+ page: (e) => [e.pageX, e.pageY],
204
+ client: (e) => [e.clientX, e.clientY],
205
+ screen: (e) => [e.screenX, e.screenY],
206
+ movement: (e) => e instanceof Touch ? null : [e.movementX, e.movementY]
207
+ };
208
+ function Q(e = {}) {
209
+ const {
210
+ type: n = "page",
211
+ touch: l = !0,
212
+ resetOnTouchEnds: r = !1,
213
+ initialValue: p = { x: 0, y: 0 },
214
+ window: t = E,
215
+ target: c = t,
216
+ scroll: d = !0,
217
+ eventFilter: i
218
+ } = e;
219
+ let m = null, u = 0, o = 0;
220
+ const s = v(p.x), f = v(p.y), h = v(null), b = typeof n == "function" ? n : K[n], g = (a) => {
221
+ const X = b(a);
222
+ m = a, X && ([s.value, f.value] = X, h.value = "mouse"), t && (u = t.scrollX, o = t.scrollY);
223
+ }, y = (a) => {
224
+ if (a.touches.length > 0) {
225
+ const X = b(a.touches[0]);
226
+ X && ([s.value, f.value] = X, h.value = "touch");
227
+ }
228
+ }, w = () => {
229
+ if (!m || !t)
230
+ return;
231
+ const a = b(m);
232
+ m instanceof MouseEvent && a && (s.value = a[0] + t.scrollX - u, f.value = a[1] + t.scrollY - o);
233
+ }, C = () => {
234
+ s.value = p.x, f.value = p.y;
235
+ }, x = i ? (a) => i(() => g(a), {}) : (a) => g(a), R = i ? (a) => i(() => y(a), {}) : (a) => y(a), W = i ? () => i(() => w(), {}) : () => w();
236
+ if (c) {
237
+ const a = { passive: !0 };
238
+ M(c, ["mousemove", "dragover"], x, a), l && n !== "movement" && (M(c, ["touchstart", "touchmove"], R, a), r && M(c, "touchend", C, a)), d && n === "page" && M(t, "scroll", W, { passive: !0 });
239
+ }
240
+ return {
241
+ x: s,
242
+ y: f,
243
+ sourceType: h
244
+ };
245
+ }
246
+ function oe(e, n = {}) {
247
+ const {
248
+ handleOutside: l = !0,
249
+ window: r = E
250
+ } = n, p = n.type || "page", { x: t, y: c, sourceType: d } = Q(n), i = v(e ?? r?.document.body), m = v(0), u = v(0), o = v(0), s = v(0), f = v(0), h = v(0), b = v(!0);
251
+ let g = () => {
252
+ };
253
+ return r && (g = A(
254
+ [i, t, c],
255
+ () => {
256
+ const y = O(i);
257
+ if (!y || !(y instanceof Element))
258
+ return;
259
+ const {
260
+ left: w,
261
+ top: C,
262
+ width: x,
263
+ height: R
264
+ } = y.getBoundingClientRect();
265
+ o.value = w + (p === "page" ? r.pageXOffset : 0), s.value = C + (p === "page" ? r.pageYOffset : 0), f.value = R, h.value = x;
266
+ const W = t.value - o.value, a = c.value - s.value;
267
+ b.value = x === 0 || R === 0 || W < 0 || a < 0 || W > x || a > R, (l || !b.value) && (m.value = W, u.value = a);
268
+ },
269
+ { immediate: !0 }
270
+ ), M(document, "mouseleave", () => {
271
+ b.value = !0;
272
+ })), {
273
+ x: t,
274
+ y: c,
275
+ sourceType: d,
276
+ elementX: m,
277
+ elementY: u,
278
+ elementPositionX: o,
279
+ elementPositionY: s,
280
+ elementHeight: f,
281
+ elementWidth: h,
282
+ isOutside: b,
283
+ stop: g
284
+ };
285
+ }
286
+ export {
287
+ oe as a,
288
+ ee as b,
289
+ te as c,
290
+ J as d,
291
+ ne as e,
292
+ O as u
293
+ };
294
+ //# sourceMappingURL=index-XZqpB2_R.js.map