@douxcode/vue-spring-bottom-sheet 1.0.3 → 1.0.4

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.
Files changed (2) hide show
  1. package/dist/index.mjs +107 -1031
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1,947 +1,23 @@
1
- import { getCurrentScope as Ge, onScopeDispose as Ve, unref as Ie, toRef as $e, readonly as ze, customRef as Ue, ref as k, onMounted as Se, nextTick as ye, getCurrentInstance as Pe, watch as G, computed as P, watchEffect as Ye, defineComponent as qe, toRefs as Xe, openBlock as Qe, createBlock as Ze, Teleport as Je, createElementVNode as K, createVNode as et, Transition as tt, withCtx as nt, withDirectives as at, vShow as rt, renderSlot as ve } from "vue";
2
- import { useGesture as be, rubberbandIfOutOfBounds as he } from "@vueuse/gesture";
3
- import { useMotionProperties as it, useMotionTransitions as ot, useMotionControls as ut } from "@vueuse/motion";
4
- function X(n) {
5
- return Ge() ? (Ve(n), !0) : !1;
6
- }
7
- function H(n) {
8
- return typeof n == "function" ? n() : Ie(n);
9
- }
10
- const Re = typeof window < "u" && typeof document < "u";
11
- typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
12
- const st = (n) => n != null, lt = Object.prototype.toString, ct = (n) => lt.call(n) === "[object Object]", xe = () => {
13
- }, Ne = /* @__PURE__ */ ft();
14
- function ft() {
15
- var n, e;
16
- return Re && ((n = window == null ? void 0 : window.navigator) == null ? void 0 : n.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((e = window == null ? void 0 : window.navigator) == null ? void 0 : e.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? void 0 : window.navigator.userAgent));
17
- }
18
- function dt(n) {
19
- return Pe();
20
- }
21
- function vt(...n) {
22
- if (n.length !== 1)
23
- return $e(...n);
24
- const e = n[0];
25
- return typeof e == "function" ? ze(Ue(() => ({ get: e, set: xe }))) : k(e);
26
- }
27
- function Le(n, e = !0, t) {
28
- dt() ? Se(n, t) : e ? n() : ye(n);
29
- }
30
- const te = Re ? window : void 0;
31
- function U(n) {
32
- var e;
33
- const t = H(n);
34
- return (e = t == null ? void 0 : t.$el) != null ? e : t;
35
- }
36
- function oe(...n) {
37
- let e, t, a, i;
38
- if (typeof n[0] == "string" || Array.isArray(n[0]) ? ([t, a, i] = n, e = te) : [e, t, a, i] = n, !e)
39
- return xe;
40
- Array.isArray(t) || (t = [t]), Array.isArray(a) || (a = [a]);
41
- const u = [], r = () => {
42
- u.forEach((p) => p()), u.length = 0;
43
- }, l = (p, h, v, T) => (p.addEventListener(h, v, T), () => p.removeEventListener(h, v, T)), f = G(
44
- () => [U(e), H(i)],
45
- ([p, h]) => {
46
- if (r(), !p)
47
- return;
48
- const v = ct(h) ? { ...h } : h;
49
- u.push(
50
- ...t.flatMap((T) => a.map((F) => l(p, T, F, v)))
51
- );
52
- },
53
- { immediate: !0, flush: "post" }
54
- ), d = () => {
55
- f(), r();
56
- };
57
- return X(d), d;
58
- }
59
- function bt() {
60
- const n = k(!1), e = Pe();
61
- return e && Se(() => {
62
- n.value = !0;
63
- }, e), n;
64
- }
65
- function ke(n) {
66
- const e = bt();
67
- return P(() => (e.value, !!n()));
68
- }
69
- function ht(n, e, t = {}) {
70
- const { window: a = te, ...i } = t;
71
- let u;
72
- const r = ke(() => a && "MutationObserver" in a), l = () => {
73
- u && (u.disconnect(), u = void 0);
74
- }, f = P(() => {
75
- const v = H(n), T = (Array.isArray(v) ? v : [v]).map(U).filter(st);
76
- return new Set(T);
77
- }), d = G(
78
- () => f.value,
79
- (v) => {
80
- l(), r.value && v.size && (u = new MutationObserver(e), v.forEach((T) => u.observe(T, i)));
81
- },
82
- { immediate: !0, flush: "post" }
83
- ), p = () => u == null ? void 0 : u.takeRecords(), h = () => {
84
- d(), l();
85
- };
86
- return X(h), {
87
- isSupported: r,
88
- stop: h,
89
- takeRecords: p
90
- };
91
- }
92
- function pt(n, e = {}) {
93
- const { window: t = te } = e, a = ke(() => t && "matchMedia" in t && typeof t.matchMedia == "function");
94
- let i;
95
- const u = k(!1), r = (d) => {
96
- u.value = d.matches;
97
- }, l = () => {
98
- i && ("removeEventListener" in i ? i.removeEventListener("change", r) : i.removeListener(r));
99
- }, f = Ye(() => {
100
- a.value && (l(), i = t.matchMedia(H(n)), "addEventListener" in i ? i.addEventListener("change", r) : i.addListener(r), u.value = i.matches);
101
- });
102
- return X(() => {
103
- f(), l(), i = void 0;
104
- }), u;
105
- }
106
- function gt(n, e, t = {}) {
107
- const { window: a = te, ...i } = t;
108
- let u;
109
- const r = ke(() => a && "ResizeObserver" in a), l = () => {
110
- u && (u.disconnect(), u = void 0);
111
- }, f = P(() => {
112
- const h = H(n);
113
- return Array.isArray(h) ? h.map((v) => U(v)) : [U(h)];
114
- }), d = G(
115
- f,
116
- (h) => {
117
- if (l(), r.value && a) {
118
- u = new ResizeObserver(e);
119
- for (const v of h)
120
- v && u.observe(v, i);
121
- }
122
- },
123
- { immediate: !0, flush: "post" }
124
- ), p = () => {
125
- l(), d();
126
- };
127
- return X(p), {
128
- isSupported: r,
129
- stop: p
130
- };
131
- }
132
- function re(n, e = {}) {
133
- const {
134
- reset: t = !0,
135
- windowResize: a = !0,
136
- windowScroll: i = !0,
137
- immediate: u = !0,
138
- updateTiming: r = "sync"
139
- } = e, l = k(0), f = k(0), d = k(0), p = k(0), h = k(0), v = k(0), T = k(0), F = k(0);
140
- function R() {
141
- const I = U(n);
142
- if (!I) {
143
- t && (l.value = 0, f.value = 0, d.value = 0, p.value = 0, h.value = 0, v.value = 0, T.value = 0, F.value = 0);
144
- return;
145
- }
146
- const O = I.getBoundingClientRect();
147
- l.value = O.height, f.value = O.bottom, d.value = O.left, p.value = O.right, h.value = O.top, v.value = O.width, T.value = O.x, F.value = O.y;
148
- }
149
- function C() {
150
- r === "sync" ? R() : r === "next-frame" && requestAnimationFrame(() => R());
151
- }
152
- return gt(n, C), G(() => U(n), (I) => !I && C()), ht(n, C, {
153
- attributeFilter: ["style", "class"]
154
- }), i && oe("scroll", C, { capture: !0, passive: !0 }), a && oe("resize", C, { passive: !0 }), Le(() => {
155
- u && C();
156
- }), {
157
- height: l,
158
- bottom: f,
159
- left: d,
160
- right: p,
161
- top: h,
162
- width: v,
163
- x: T,
164
- y: F,
165
- update: C
166
- };
167
- }
168
- function pe(n) {
169
- return typeof Window < "u" && n instanceof Window ? n.document.documentElement : typeof Document < "u" && n instanceof Document ? n.documentElement : n;
170
- }
171
- function Be(n) {
172
- const e = window.getComputedStyle(n);
173
- if (e.overflowX === "scroll" || e.overflowY === "scroll" || e.overflowX === "auto" && n.clientWidth < n.scrollWidth || e.overflowY === "auto" && n.clientHeight < n.scrollHeight)
174
- return !0;
175
- {
176
- const t = n.parentNode;
177
- return !t || t.tagName === "BODY" ? !1 : Be(t);
178
- }
179
- }
180
- function mt(n) {
181
- const e = n || window.event, t = e.target;
182
- return Be(t) ? !1 : e.touches.length > 1 ? !0 : (e.preventDefault && e.preventDefault(), !1);
183
- }
184
- const ge = /* @__PURE__ */ new WeakMap();
185
- function yt(n, e = !1) {
186
- const t = k(e);
187
- let a = null, i = "";
188
- G(vt(n), (l) => {
189
- const f = pe(H(l));
190
- if (f) {
191
- const d = f;
192
- if (ge.get(d) || ge.set(d, d.style.overflow), d.style.overflow !== "hidden" && (i = d.style.overflow), d.style.overflow === "hidden")
193
- return t.value = !0;
194
- if (t.value)
195
- return d.style.overflow = "hidden";
196
- }
197
- }, {
198
- immediate: !0
199
- });
200
- const u = () => {
201
- const l = pe(H(n));
202
- !l || t.value || (Ne && (a = oe(
203
- l,
204
- "touchmove",
205
- (f) => {
206
- mt(f);
207
- },
208
- { passive: !1 }
209
- )), l.style.overflow = "hidden", t.value = !0);
210
- }, r = () => {
211
- const l = pe(H(n));
212
- !l || !t.value || (Ne && (a == null || a()), l.style.overflow = i, ge.delete(l), t.value = !1);
213
- };
214
- return X(r), P({
215
- get() {
216
- return t.value;
217
- },
218
- set(l) {
219
- l ? u() : r();
220
- }
221
- });
222
- }
223
- function wt(n = {}) {
224
- const {
225
- window: e = te,
226
- initialWidth: t = Number.POSITIVE_INFINITY,
227
- initialHeight: a = Number.POSITIVE_INFINITY,
228
- listenOrientation: i = !0,
229
- includeScrollbar: u = !0,
230
- type: r = "inner"
231
- } = n, l = k(t), f = k(a), d = () => {
232
- e && (r === "outer" ? (l.value = e.outerWidth, f.value = e.outerHeight) : u ? (l.value = e.innerWidth, f.value = e.innerHeight) : (l.value = e.document.documentElement.clientWidth, f.value = e.document.documentElement.clientHeight));
233
- };
234
- if (d(), Le(d), oe("resize", d, { passive: !0 }), i) {
235
- const p = pt("(orientation: portrait)");
236
- G(p, () => d());
237
- }
238
- return { width: l, height: f };
239
- }
240
- function Ee(n) {
241
- return typeof n == "function" ? n() : Ie(n);
242
- }
243
- typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
244
- const Tt = (n) => n != null;
245
- /*!
246
- * tabbable 6.2.0
247
- * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
248
- */
249
- var Me = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"], ue = /* @__PURE__ */ Me.join(","), We = typeof Element > "u", Y = We ? function() {
250
- } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, se = !We && Element.prototype.getRootNode ? function(n) {
251
- var e;
252
- return n == null || (e = n.getRootNode) === null || e === void 0 ? void 0 : e.call(n);
253
- } : function(n) {
254
- return n == null ? void 0 : n.ownerDocument;
255
- }, le = function n(e, t) {
256
- var a;
257
- t === void 0 && (t = !0);
258
- var i = e == null || (a = e.getAttribute) === null || a === void 0 ? void 0 : a.call(e, "inert"), u = i === "" || i === "true", r = u || t && e && n(e.parentNode);
259
- return r;
260
- }, St = function(e) {
261
- var t, a = e == null || (t = e.getAttribute) === null || t === void 0 ? void 0 : t.call(e, "contenteditable");
262
- return a === "" || a === "true";
263
- }, _e = function(e, t, a) {
264
- if (le(e))
265
- return [];
266
- var i = Array.prototype.slice.apply(e.querySelectorAll(ue));
267
- return t && Y.call(e, ue) && i.unshift(e), i = i.filter(a), i;
268
- }, je = function n(e, t, a) {
269
- for (var i = [], u = Array.from(e); u.length; ) {
270
- var r = u.shift();
271
- if (!le(r, !1))
272
- if (r.tagName === "SLOT") {
273
- var l = r.assignedElements(), f = l.length ? l : r.children, d = n(f, !0, a);
274
- a.flatten ? i.push.apply(i, d) : i.push({
275
- scopeParent: r,
276
- candidates: d
277
- });
278
- } else {
279
- var p = Y.call(r, ue);
280
- p && a.filter(r) && (t || !e.includes(r)) && i.push(r);
281
- var h = r.shadowRoot || // check for an undisclosed shadow
282
- typeof a.getShadowRoot == "function" && a.getShadowRoot(r), v = !le(h, !1) && (!a.shadowRootFilter || a.shadowRootFilter(r));
283
- if (h && v) {
284
- var T = n(h === !0 ? r.children : h.children, !0, a);
285
- a.flatten ? i.push.apply(i, T) : i.push({
286
- scopeParent: r,
287
- candidates: T
288
- });
289
- } else
290
- u.unshift.apply(u, r.children);
291
- }
292
- }
293
- return i;
294
- }, Ke = function(e) {
295
- return !isNaN(parseInt(e.getAttribute("tabindex"), 10));
296
- }, z = function(e) {
297
- if (!e)
298
- throw new Error("No node provided");
299
- return e.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName) || St(e)) && !Ke(e) ? 0 : e.tabIndex;
300
- }, kt = function(e, t) {
301
- var a = z(e);
302
- return a < 0 && t && !Ke(e) ? 0 : a;
303
- }, Nt = function(e, t) {
304
- return e.tabIndex === t.tabIndex ? e.documentOrder - t.documentOrder : e.tabIndex - t.tabIndex;
305
- }, He = function(e) {
306
- return e.tagName === "INPUT";
307
- }, Et = function(e) {
308
- return He(e) && e.type === "hidden";
309
- }, Ft = function(e) {
310
- var t = e.tagName === "DETAILS" && Array.prototype.slice.apply(e.children).some(function(a) {
311
- return a.tagName === "SUMMARY";
312
- });
313
- return t;
314
- }, Dt = function(e, t) {
315
- for (var a = 0; a < e.length; a++)
316
- if (e[a].checked && e[a].form === t)
317
- return e[a];
318
- }, Ot = function(e) {
319
- if (!e.name)
320
- return !0;
321
- var t = e.form || se(e), a = function(l) {
322
- return t.querySelectorAll('input[type="radio"][name="' + l + '"]');
323
- }, i;
324
- if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
325
- i = a(window.CSS.escape(e.name));
326
- else
327
- try {
328
- i = a(e.name);
329
- } catch (r) {
330
- return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", r.message), !1;
331
- }
332
- var u = Dt(i, e.form);
333
- return !u || u === e;
334
- }, Ct = function(e) {
335
- return He(e) && e.type === "radio";
336
- }, At = function(e) {
337
- return Ct(e) && !Ot(e);
338
- }, It = function(e) {
339
- var t, a = e && se(e), i = (t = a) === null || t === void 0 ? void 0 : t.host, u = !1;
340
- if (a && a !== e) {
341
- var r, l, f;
342
- for (u = !!((r = i) !== null && r !== void 0 && (l = r.ownerDocument) !== null && l !== void 0 && l.contains(i) || e != null && (f = e.ownerDocument) !== null && f !== void 0 && f.contains(e)); !u && i; ) {
343
- var d, p, h;
344
- a = se(i), i = (d = a) === null || d === void 0 ? void 0 : d.host, u = !!((p = i) !== null && p !== void 0 && (h = p.ownerDocument) !== null && h !== void 0 && h.contains(i));
345
- }
346
- }
347
- return u;
348
- }, Fe = function(e) {
349
- var t = e.getBoundingClientRect(), a = t.width, i = t.height;
350
- return a === 0 && i === 0;
351
- }, Pt = function(e, t) {
352
- var a = t.displayCheck, i = t.getShadowRoot;
353
- if (getComputedStyle(e).visibility === "hidden")
354
- return !0;
355
- var u = Y.call(e, "details>summary:first-of-type"), r = u ? e.parentElement : e;
356
- if (Y.call(r, "details:not([open]) *"))
357
- return !0;
358
- if (!a || a === "full" || a === "legacy-full") {
359
- if (typeof i == "function") {
360
- for (var l = e; e; ) {
361
- var f = e.parentElement, d = se(e);
362
- if (f && !f.shadowRoot && i(f) === !0)
363
- return Fe(e);
364
- e.assignedSlot ? e = e.assignedSlot : !f && d !== e.ownerDocument ? e = d.host : e = f;
365
- }
366
- e = l;
367
- }
368
- if (It(e))
369
- return !e.getClientRects().length;
370
- if (a !== "legacy-full")
371
- return !0;
372
- } else if (a === "non-zero-area")
373
- return Fe(e);
374
- return !1;
375
- }, Rt = function(e) {
376
- if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))
377
- for (var t = e.parentElement; t; ) {
378
- if (t.tagName === "FIELDSET" && t.disabled) {
379
- for (var a = 0; a < t.children.length; a++) {
380
- var i = t.children.item(a);
381
- if (i.tagName === "LEGEND")
382
- return Y.call(t, "fieldset[disabled] *") ? !0 : !i.contains(e);
383
- }
384
- return !0;
385
- }
386
- t = t.parentElement;
387
- }
388
- return !1;
389
- }, ce = function(e, t) {
390
- return !(t.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
391
- // because we're limited in the type of selectors we can use in JSDom (see related
392
- // note related to `candidateSelectors`)
393
- le(t) || Et(t) || Pt(t, e) || // For a details element with a summary, the summary element gets the focus
394
- Ft(t) || Rt(t));
395
- }, we = function(e, t) {
396
- return !(At(t) || z(t) < 0 || !ce(e, t));
397
- }, xt = function(e) {
398
- var t = parseInt(e.getAttribute("tabindex"), 10);
399
- return !!(isNaN(t) || t >= 0);
400
- }, Lt = function n(e) {
401
- var t = [], a = [];
402
- return e.forEach(function(i, u) {
403
- var r = !!i.scopeParent, l = r ? i.scopeParent : i, f = kt(l, r), d = r ? n(i.candidates) : l;
404
- f === 0 ? r ? t.push.apply(t, d) : t.push(l) : a.push({
405
- documentOrder: u,
406
- tabIndex: f,
407
- item: i,
408
- isScope: r,
409
- content: d
410
- });
411
- }), a.sort(Nt).reduce(function(i, u) {
412
- return u.isScope ? i.push.apply(i, u.content) : i.push(u.content), i;
413
- }, []).concat(t);
414
- }, Bt = function(e, t) {
415
- t = t || {};
416
- var a;
417
- return t.getShadowRoot ? a = je([e], t.includeContainer, {
418
- filter: we.bind(null, t),
419
- flatten: !1,
420
- getShadowRoot: t.getShadowRoot,
421
- shadowRootFilter: xt
422
- }) : a = _e(e, t.includeContainer, we.bind(null, t)), Lt(a);
423
- }, Mt = function(e, t) {
424
- t = t || {};
425
- var a;
426
- return t.getShadowRoot ? a = je([e], t.includeContainer, {
427
- filter: ce.bind(null, t),
428
- flatten: !0,
429
- getShadowRoot: t.getShadowRoot
430
- }) : a = _e(e, t.includeContainer, ce.bind(null, t)), a;
431
- }, q = function(e, t) {
432
- if (t = t || {}, !e)
433
- throw new Error("No node provided");
434
- return Y.call(e, ue) === !1 ? !1 : we(t, e);
435
- }, Wt = /* @__PURE__ */ Me.concat("iframe").join(","), me = function(e, t) {
436
- if (t = t || {}, !e)
437
- throw new Error("No node provided");
438
- return Y.call(e, Wt) === !1 ? !1 : ce(t, e);
439
- };
440
- /*!
441
- * focus-trap 7.6.2
442
- * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
443
- */
444
- function Te(n, e) {
445
- (e == null || e > n.length) && (e = n.length);
446
- for (var t = 0, a = Array(e); t < e; t++) a[t] = n[t];
447
- return a;
448
- }
449
- function _t(n) {
450
- if (Array.isArray(n)) return Te(n);
451
- }
452
- function jt(n, e, t) {
453
- return (e = $t(e)) in n ? Object.defineProperty(n, e, {
454
- value: t,
455
- enumerable: !0,
456
- configurable: !0,
457
- writable: !0
458
- }) : n[e] = t, n;
459
- }
460
- function Kt(n) {
461
- if (typeof Symbol < "u" && n[Symbol.iterator] != null || n["@@iterator"] != null) return Array.from(n);
462
- }
463
- function Ht() {
464
- throw new TypeError(`Invalid attempt to spread non-iterable instance.
465
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
466
- }
467
- function De(n, e) {
468
- var t = Object.keys(n);
469
- if (Object.getOwnPropertySymbols) {
470
- var a = Object.getOwnPropertySymbols(n);
471
- e && (a = a.filter(function(i) {
472
- return Object.getOwnPropertyDescriptor(n, i).enumerable;
473
- })), t.push.apply(t, a);
474
- }
475
- return t;
476
- }
477
- function Oe(n) {
478
- for (var e = 1; e < arguments.length; e++) {
479
- var t = arguments[e] != null ? arguments[e] : {};
480
- e % 2 ? De(Object(t), !0).forEach(function(a) {
481
- jt(n, a, t[a]);
482
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(n, Object.getOwnPropertyDescriptors(t)) : De(Object(t)).forEach(function(a) {
483
- Object.defineProperty(n, a, Object.getOwnPropertyDescriptor(t, a));
484
- });
485
- }
486
- return n;
487
- }
488
- function Gt(n) {
489
- return _t(n) || Kt(n) || zt(n) || Ht();
490
- }
491
- function Vt(n, e) {
492
- if (typeof n != "object" || !n) return n;
493
- var t = n[Symbol.toPrimitive];
494
- if (t !== void 0) {
495
- var a = t.call(n, e || "default");
496
- if (typeof a != "object") return a;
497
- throw new TypeError("@@toPrimitive must return a primitive value.");
498
- }
499
- return (e === "string" ? String : Number)(n);
500
- }
501
- function $t(n) {
502
- var e = Vt(n, "string");
503
- return typeof e == "symbol" ? e : e + "";
504
- }
505
- function zt(n, e) {
506
- if (n) {
507
- if (typeof n == "string") return Te(n, e);
508
- var t = {}.toString.call(n).slice(8, -1);
509
- return t === "Object" && n.constructor && (t = n.constructor.name), t === "Map" || t === "Set" ? Array.from(n) : t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? Te(n, e) : void 0;
510
- }
511
- }
512
- var Ce = {
513
- activateTrap: function(e, t) {
514
- if (e.length > 0) {
515
- var a = e[e.length - 1];
516
- a !== t && a.pause();
517
- }
518
- var i = e.indexOf(t);
519
- i === -1 || e.splice(i, 1), e.push(t);
520
- },
521
- deactivateTrap: function(e, t) {
522
- var a = e.indexOf(t);
523
- a !== -1 && e.splice(a, 1), e.length > 0 && e[e.length - 1].unpause();
524
- }
525
- }, Ut = function(e) {
526
- return e.tagName && e.tagName.toLowerCase() === "input" && typeof e.select == "function";
527
- }, Yt = function(e) {
528
- return (e == null ? void 0 : e.key) === "Escape" || (e == null ? void 0 : e.key) === "Esc" || (e == null ? void 0 : e.keyCode) === 27;
529
- }, ee = function(e) {
530
- return (e == null ? void 0 : e.key) === "Tab" || (e == null ? void 0 : e.keyCode) === 9;
531
- }, qt = function(e) {
532
- return ee(e) && !e.shiftKey;
533
- }, Xt = function(e) {
534
- return ee(e) && e.shiftKey;
535
- }, Ae = function(e) {
536
- return setTimeout(e, 0);
537
- }, J = function(e) {
538
- for (var t = arguments.length, a = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++)
539
- a[i - 1] = arguments[i];
540
- return typeof e == "function" ? e.apply(void 0, a) : e;
541
- }, ie = function(e) {
542
- return e.target.shadowRoot && typeof e.composedPath == "function" ? e.composedPath()[0] : e.target;
543
- }, Qt = [], Zt = function(e, t) {
544
- var a = (t == null ? void 0 : t.document) || document, i = (t == null ? void 0 : t.trapStack) || Qt, u = Oe({
545
- returnFocusOnDeactivate: !0,
546
- escapeDeactivates: !0,
547
- delayInitialFocus: !0,
548
- isKeyForward: qt,
549
- isKeyBackward: Xt
550
- }, t), r = {
551
- // containers given to createFocusTrap()
552
- // @type {Array<HTMLElement>}
553
- containers: [],
554
- // list of objects identifying tabbable nodes in `containers` in the trap
555
- // NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap
556
- // is active, but the trap should never get to a state where there isn't at least one group
557
- // with at least one tabbable node in it (that would lead to an error condition that would
558
- // result in an error being thrown)
559
- // @type {Array<{
560
- // container: HTMLElement,
561
- // tabbableNodes: Array<HTMLElement>, // empty if none
562
- // focusableNodes: Array<HTMLElement>, // empty if none
563
- // posTabIndexesFound: boolean,
564
- // firstTabbableNode: HTMLElement|undefined,
565
- // lastTabbableNode: HTMLElement|undefined,
566
- // firstDomTabbableNode: HTMLElement|undefined,
567
- // lastDomTabbableNode: HTMLElement|undefined,
568
- // nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
569
- // }>}
570
- containerGroups: [],
571
- // same order/length as `containers` list
572
- // references to objects in `containerGroups`, but only those that actually have
573
- // tabbable nodes in them
574
- // NOTE: same order as `containers` and `containerGroups`, but __not necessarily__
575
- // the same length
576
- tabbableGroups: [],
577
- nodeFocusedBeforeActivation: null,
578
- mostRecentlyFocusedNode: null,
579
- active: !1,
580
- paused: !1,
581
- // timer ID for when delayInitialFocus is true and initial focus in this trap
582
- // has been delayed during activation
583
- delayInitialFocusTimer: void 0,
584
- // the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
585
- recentNavEvent: void 0
586
- }, l, f = function(o, s, c) {
587
- return o && o[s] !== void 0 ? o[s] : u[c || s];
588
- }, d = function(o, s) {
589
- var c = typeof (s == null ? void 0 : s.composedPath) == "function" ? s.composedPath() : void 0;
590
- return r.containerGroups.findIndex(function(m) {
591
- var w = m.container, N = m.tabbableNodes;
592
- return w.contains(o) || // fall back to explicit tabbable search which will take into consideration any
593
- // web components if the `tabbableOptions.getShadowRoot` option was used for
594
- // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
595
- // look inside web components even if open)
596
- (c == null ? void 0 : c.includes(w)) || N.find(function(g) {
597
- return g === o;
598
- });
599
- });
600
- }, p = function(o) {
601
- var s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, c = s.hasFallback, m = c === void 0 ? !1 : c, w = s.params, N = w === void 0 ? [] : w, g = u[o];
602
- if (typeof g == "function" && (g = g.apply(void 0, Gt(N))), g === !0 && (g = void 0), !g) {
603
- if (g === void 0 || g === !1)
604
- return g;
605
- throw new Error("`".concat(o, "` was specified but was not a node, or did not return a node"));
606
- }
607
- var E = g;
608
- if (typeof g == "string") {
609
- try {
610
- E = a.querySelector(g);
611
- } catch (D) {
612
- throw new Error("`".concat(o, '` appears to be an invalid selector; error="').concat(D.message, '"'));
613
- }
614
- if (!E && !m)
615
- throw new Error("`".concat(o, "` as selector refers to no known node"));
616
- }
617
- return E;
618
- }, h = function() {
619
- var o = p("initialFocus", {
620
- hasFallback: !0
621
- });
622
- if (o === !1)
623
- return !1;
624
- if (o === void 0 || o && !me(o, u.tabbableOptions))
625
- if (d(a.activeElement) >= 0)
626
- o = a.activeElement;
627
- else {
628
- var s = r.tabbableGroups[0], c = s && s.firstTabbableNode;
629
- o = c || p("fallbackFocus");
630
- }
631
- else o === null && (o = p("fallbackFocus"));
632
- if (!o)
633
- throw new Error("Your focus-trap needs to have at least one focusable element");
634
- return o;
635
- }, v = function() {
636
- if (r.containerGroups = r.containers.map(function(o) {
637
- var s = Bt(o, u.tabbableOptions), c = Mt(o, u.tabbableOptions), m = s.length > 0 ? s[0] : void 0, w = s.length > 0 ? s[s.length - 1] : void 0, N = c.find(function(D) {
638
- return q(D);
639
- }), g = c.slice().reverse().find(function(D) {
640
- return q(D);
641
- }), E = !!s.find(function(D) {
642
- return z(D) > 0;
643
- });
644
- return {
645
- container: o,
646
- tabbableNodes: s,
647
- focusableNodes: c,
648
- /** True if at least one node with positive `tabindex` was found in this container. */
649
- posTabIndexesFound: E,
650
- /** First tabbable node in container, __tabindex__ order; `undefined` if none. */
651
- firstTabbableNode: m,
652
- /** Last tabbable node in container, __tabindex__ order; `undefined` if none. */
653
- lastTabbableNode: w,
654
- // NOTE: DOM order is NOT NECESSARILY "document position" order, but figuring that out
655
- // would require more than just https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
656
- // because that API doesn't work with Shadow DOM as well as it should (@see
657
- // https://github.com/whatwg/dom/issues/320) and since this first/last is only needed, so far,
658
- // to address an edge case related to positive tabindex support, this seems like a much easier,
659
- // "close enough most of the time" alternative for positive tabindexes which should generally
660
- // be avoided anyway...
661
- /** First tabbable node in container, __DOM__ order; `undefined` if none. */
662
- firstDomTabbableNode: N,
663
- /** Last tabbable node in container, __DOM__ order; `undefined` if none. */
664
- lastDomTabbableNode: g,
665
- /**
666
- * Finds the __tabbable__ node that follows the given node in the specified direction,
667
- * in this container, if any.
668
- * @param {HTMLElement} node
669
- * @param {boolean} [forward] True if going in forward tab order; false if going
670
- * in reverse.
671
- * @returns {HTMLElement|undefined} The next tabbable node, if any.
672
- */
673
- nextTabbableNode: function(A) {
674
- var V = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, B = s.indexOf(A);
675
- return B < 0 ? V ? c.slice(c.indexOf(A) + 1).find(function(j) {
676
- return q(j);
677
- }) : c.slice(0, c.indexOf(A)).reverse().find(function(j) {
678
- return q(j);
679
- }) : s[B + (V ? 1 : -1)];
680
- }
681
- };
682
- }), r.tabbableGroups = r.containerGroups.filter(function(o) {
683
- return o.tabbableNodes.length > 0;
684
- }), r.tabbableGroups.length <= 0 && !p("fallbackFocus"))
685
- throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");
686
- if (r.containerGroups.find(function(o) {
687
- return o.posTabIndexesFound;
688
- }) && r.containerGroups.length > 1)
689
- throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.");
690
- }, T = function(o) {
691
- var s = o.activeElement;
692
- if (s)
693
- return s.shadowRoot && s.shadowRoot.activeElement !== null ? T(s.shadowRoot) : s;
694
- }, F = function(o) {
695
- if (o !== !1 && o !== T(document)) {
696
- if (!o || !o.focus) {
697
- F(h());
698
- return;
699
- }
700
- o.focus({
701
- preventScroll: !!u.preventScroll
702
- }), r.mostRecentlyFocusedNode = o, Ut(o) && o.select();
703
- }
704
- }, R = function(o) {
705
- var s = p("setReturnFocus", {
706
- params: [o]
707
- });
708
- return s || (s === !1 ? !1 : o);
709
- }, C = function(o) {
710
- var s = o.target, c = o.event, m = o.isBackward, w = m === void 0 ? !1 : m;
711
- s = s || ie(c), v();
712
- var N = null;
713
- if (r.tabbableGroups.length > 0) {
714
- var g = d(s, c), E = g >= 0 ? r.containerGroups[g] : void 0;
715
- if (g < 0)
716
- w ? N = r.tabbableGroups[r.tabbableGroups.length - 1].lastTabbableNode : N = r.tabbableGroups[0].firstTabbableNode;
717
- else if (w) {
718
- var D = r.tabbableGroups.findIndex(function($) {
719
- var S = $.firstTabbableNode;
720
- return s === S;
721
- });
722
- if (D < 0 && (E.container === s || me(s, u.tabbableOptions) && !q(s, u.tabbableOptions) && !E.nextTabbableNode(s, !1)) && (D = g), D >= 0) {
723
- var A = D === 0 ? r.tabbableGroups.length - 1 : D - 1, V = r.tabbableGroups[A];
724
- N = z(s) >= 0 ? V.lastTabbableNode : V.lastDomTabbableNode;
725
- } else ee(c) || (N = E.nextTabbableNode(s, !1));
726
- } else {
727
- var B = r.tabbableGroups.findIndex(function($) {
728
- var S = $.lastTabbableNode;
729
- return s === S;
730
- });
731
- if (B < 0 && (E.container === s || me(s, u.tabbableOptions) && !q(s, u.tabbableOptions) && !E.nextTabbableNode(s)) && (B = g), B >= 0) {
732
- var j = B === r.tabbableGroups.length - 1 ? 0 : B + 1, Z = r.tabbableGroups[j];
733
- N = z(s) >= 0 ? Z.firstTabbableNode : Z.firstDomTabbableNode;
734
- } else ee(c) || (N = E.nextTabbableNode(s));
735
- }
736
- } else
737
- N = p("fallbackFocus");
738
- return N;
739
- }, I = function(o) {
740
- var s = ie(o);
741
- if (!(d(s, o) >= 0)) {
742
- if (J(u.clickOutsideDeactivates, o)) {
743
- l.deactivate({
744
- // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
745
- // which will result in the outside click setting focus to the node
746
- // that was clicked (and if not focusable, to "nothing"); by setting
747
- // `returnFocus: true`, we'll attempt to re-focus the node originally-focused
748
- // on activation (or the configured `setReturnFocus` node), whether the
749
- // outside click was on a focusable node or not
750
- returnFocus: u.returnFocusOnDeactivate
751
- });
752
- return;
753
- }
754
- J(u.allowOutsideClick, o) || o.preventDefault();
755
- }
756
- }, O = function(o) {
757
- var s = ie(o), c = d(s, o) >= 0;
758
- if (c || s instanceof Document)
759
- c && (r.mostRecentlyFocusedNode = s);
760
- else {
761
- o.stopImmediatePropagation();
762
- var m, w = !0;
763
- if (r.mostRecentlyFocusedNode)
764
- if (z(r.mostRecentlyFocusedNode) > 0) {
765
- var N = d(r.mostRecentlyFocusedNode), g = r.containerGroups[N].tabbableNodes;
766
- if (g.length > 0) {
767
- var E = g.findIndex(function(D) {
768
- return D === r.mostRecentlyFocusedNode;
769
- });
770
- E >= 0 && (u.isKeyForward(r.recentNavEvent) ? E + 1 < g.length && (m = g[E + 1], w = !1) : E - 1 >= 0 && (m = g[E - 1], w = !1));
771
- }
772
- } else
773
- r.containerGroups.some(function(D) {
774
- return D.tabbableNodes.some(function(A) {
775
- return z(A) > 0;
776
- });
777
- }) || (w = !1);
778
- else
779
- w = !1;
780
- w && (m = C({
781
- // move FROM the MRU node, not event-related node (which will be the node that is
782
- // outside the trap causing the focus escape we're trying to fix)
783
- target: r.mostRecentlyFocusedNode,
784
- isBackward: u.isKeyBackward(r.recentNavEvent)
785
- })), F(m || r.mostRecentlyFocusedNode || h());
786
- }
787
- r.recentNavEvent = void 0;
788
- }, fe = function(o) {
789
- var s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
790
- r.recentNavEvent = o;
791
- var c = C({
792
- event: o,
793
- isBackward: s
794
- });
795
- c && (ee(o) && o.preventDefault(), F(c));
796
- }, ne = function(o) {
797
- (u.isKeyForward(o) || u.isKeyBackward(o)) && fe(o, u.isKeyBackward(o));
798
- }, x = function(o) {
799
- Yt(o) && J(u.escapeDeactivates, o) !== !1 && (o.preventDefault(), l.deactivate());
800
- }, W = function(o) {
801
- var s = ie(o);
802
- d(s, o) >= 0 || J(u.clickOutsideDeactivates, o) || J(u.allowOutsideClick, o) || (o.preventDefault(), o.stopImmediatePropagation());
803
- }, _ = function() {
804
- if (r.active)
805
- return Ce.activateTrap(i, l), r.delayInitialFocusTimer = u.delayInitialFocus ? Ae(function() {
806
- F(h());
807
- }) : F(h()), a.addEventListener("focusin", O, !0), a.addEventListener("mousedown", I, {
808
- capture: !0,
809
- passive: !1
810
- }), a.addEventListener("touchstart", I, {
811
- capture: !0,
812
- passive: !1
813
- }), a.addEventListener("click", W, {
814
- capture: !0,
815
- passive: !1
816
- }), a.addEventListener("keydown", ne, {
817
- capture: !0,
818
- passive: !1
819
- }), a.addEventListener("keydown", x), l;
820
- }, ae = function() {
821
- if (r.active)
822
- return a.removeEventListener("focusin", O, !0), a.removeEventListener("mousedown", I, !0), a.removeEventListener("touchstart", I, !0), a.removeEventListener("click", W, !0), a.removeEventListener("keydown", ne, !0), a.removeEventListener("keydown", x), l;
823
- }, Q = function(o) {
824
- var s = o.some(function(c) {
825
- var m = Array.from(c.removedNodes);
826
- return m.some(function(w) {
827
- return w === r.mostRecentlyFocusedNode;
828
- });
829
- });
830
- s && F(h());
831
- }, L = typeof window < "u" && "MutationObserver" in window ? new MutationObserver(Q) : void 0, y = function() {
832
- L && (L.disconnect(), r.active && !r.paused && r.containers.map(function(o) {
833
- L.observe(o, {
834
- subtree: !0,
835
- childList: !0
836
- });
837
- }));
838
- };
839
- return l = {
840
- get active() {
841
- return r.active;
842
- },
843
- get paused() {
844
- return r.paused;
845
- },
846
- activate: function(o) {
847
- if (r.active)
848
- return this;
849
- var s = f(o, "onActivate"), c = f(o, "onPostActivate"), m = f(o, "checkCanFocusTrap");
850
- m || v(), r.active = !0, r.paused = !1, r.nodeFocusedBeforeActivation = a.activeElement, s == null || s();
851
- var w = function() {
852
- m && v(), _(), y(), c == null || c();
853
- };
854
- return m ? (m(r.containers.concat()).then(w, w), this) : (w(), this);
855
- },
856
- deactivate: function(o) {
857
- if (!r.active)
858
- return this;
859
- var s = Oe({
860
- onDeactivate: u.onDeactivate,
861
- onPostDeactivate: u.onPostDeactivate,
862
- checkCanReturnFocus: u.checkCanReturnFocus
863
- }, o);
864
- clearTimeout(r.delayInitialFocusTimer), r.delayInitialFocusTimer = void 0, ae(), r.active = !1, r.paused = !1, y(), Ce.deactivateTrap(i, l);
865
- var c = f(s, "onDeactivate"), m = f(s, "onPostDeactivate"), w = f(s, "checkCanReturnFocus"), N = f(s, "returnFocus", "returnFocusOnDeactivate");
866
- c == null || c();
867
- var g = function() {
868
- Ae(function() {
869
- N && F(R(r.nodeFocusedBeforeActivation)), m == null || m();
870
- });
871
- };
872
- return N && w ? (w(R(r.nodeFocusedBeforeActivation)).then(g, g), this) : (g(), this);
873
- },
874
- pause: function(o) {
875
- if (r.paused || !r.active)
876
- return this;
877
- var s = f(o, "onPause"), c = f(o, "onPostPause");
878
- return r.paused = !0, s == null || s(), ae(), y(), c == null || c(), this;
879
- },
880
- unpause: function(o) {
881
- if (!r.paused || !r.active)
882
- return this;
883
- var s = f(o, "onUnpause"), c = f(o, "onPostUnpause");
884
- return r.paused = !1, s == null || s(), v(), _(), y(), c == null || c(), this;
885
- },
886
- updateContainerElements: function(o) {
887
- var s = [].concat(o).filter(Boolean);
888
- return r.containers = s.map(function(c) {
889
- return typeof c == "string" ? a.querySelector(c) : c;
890
- }), r.active && v(), y(), this;
891
- }
892
- }, l.updateContainerElements(e), l;
893
- };
894
- function Jt(n, e = {}) {
895
- let t;
896
- const { immediate: a, ...i } = e, u = k(!1), r = k(!1), l = (v) => t && t.activate(v), f = (v) => t && t.deactivate(v), d = () => {
897
- t && (t.pause(), r.value = !0);
898
- }, p = () => {
899
- t && (t.unpause(), r.value = !1);
900
- }, h = P(() => {
901
- const v = Ee(n);
902
- return (Array.isArray(v) ? v : [v]).map((T) => {
903
- const F = Ee(T);
904
- return typeof F == "string" ? F : U(F);
905
- }).filter(Tt);
906
- });
907
- return G(
908
- h,
909
- (v) => {
910
- v.length && (t = Zt(v, {
911
- ...i,
912
- onActivate() {
913
- u.value = !0, e.onActivate && e.onActivate();
914
- },
915
- onDeactivate() {
916
- u.value = !1, e.onDeactivate && e.onDeactivate();
917
- }
918
- }), a && l());
919
- },
920
- { flush: "post" }
921
- ), X(() => f()), {
922
- hasFocus: u,
923
- isPaused: r,
924
- activate: l,
925
- deactivate: f,
926
- pause: d,
927
- unpause: p
928
- };
929
- }
930
- function en(n, e) {
931
- const t = P(() => n.value.slice().sort((r, l) => r - l)), a = P(() => t.value[0]), i = P(() => t.value[t.value.length - 1]), u = P(() => {
932
- const r = t.value.reduce(
933
- (l, f) => Math.abs(f - e.value) < Math.abs(l - e.value) ? f : l
1
+ import { computed as w, defineComponent as te, ref as l, toRefs as ae, watch as ne, nextTick as R, onMounted as oe, openBlock as le, createBlock as se, Teleport as ue, createElementVNode as c, createVNode as ie, Transition as re, withCtx as ve, withDirectives as ce, vShow as de, renderSlot as O } from "vue";
2
+ import { useWindowSize as he, useElementBounding as x, useScrollLock as pe } from "@vueuse/core";
3
+ import { useGesture as P, rubberbandIfOutOfBounds as E } from "@vueuse/gesture";
4
+ import { useMotionProperties as fe, useMotionTransitions as ge, useMotionControls as me } from "@vueuse/motion";
5
+ import { useFocusTrap as be } from "@vueuse/integrations/useFocusTrap";
6
+ function ye(d, g) {
7
+ const s = w(() => d.value.slice().sort((h, v) => h - v)), n = w(() => s.value[0]), u = w(() => s.value[s.value.length - 1]), o = w(() => {
8
+ const h = s.value.reduce(
9
+ (v, m) => Math.abs(m - g.value) < Math.abs(v - g.value) ? m : v
934
10
  );
935
- return t.value.indexOf(r);
11
+ return s.value.indexOf(h);
936
12
  });
937
13
  return {
938
- minSnap: a,
939
- maxSnap: i,
940
- snapPoints: n,
941
- closestSnapPoint: u
14
+ minSnap: n,
15
+ maxSnap: u,
16
+ snapPoints: d,
17
+ closestSnapPoint: o
942
18
  };
943
19
  }
944
- const tn = { "data-vsbs-container": "" }, nn = ["data-vsbs-shadow", "data-vsbs-sheet-show"], an = /* @__PURE__ */ qe({
20
+ const ke = { "data-vsbs-container": "" }, Se = ["data-vsbs-shadow", "data-vsbs-sheet-show"], we = /* @__PURE__ */ te({
945
21
  __name: "BottomSheet",
946
22
  props: {
947
23
  snapPoints: {},
@@ -952,165 +28,165 @@ const tn = { "data-vsbs-container": "" }, nn = ["data-vsbs-shadow", "data-vsbs-s
952
28
  expandOnContentDrag: { type: Boolean, default: !0 }
953
29
  },
954
30
  emits: ["opened", "closed", "ready", "minHeight", "maxHeight"],
955
- setup(n, { expose: e, emit: t }) {
956
- const a = n, i = t, u = k(null), r = k(null), l = k(null), f = k(null), d = k(null), p = k(null), h = k(null), v = k(!1), T = k(a.expandOnContentDrag), { height: F } = wt(), { height: R } = re(u), { height: C } = re(r), { height: I } = re(l), { height: O } = re(p), { activate: fe, deactivate: ne } = Jt([u, h]), x = P(() => Math.ceil(O.value + C.value + I.value)), { motionProperties: W } = it(u), { push: _, stop: ae, motionValues: Q } = ot(), { set: L } = ut(W, {}, { push: _, motionValues: Q, stop: ae }), y = k(0), b = k(0), { snapPoints: o } = Xe(a), s = P(() => o.value ?? [x.value]), { minSnap: c, maxSnap: m, snapPoints: w, closestSnapPoint: N } = en(s, y), g = yt(document.body), E = (S) => {
957
- S.key === "Escape" && A();
958
- }, D = () => {
959
- u.value && (y.value = a.defaultBreakpoint ?? c.value, L({
960
- height: y.value,
961
- y: y.value
962
- }), _("y", 0, W, { type: "tween", easings: "easeInOut", bounce: 0, duration: 300 }), v.value = !0, g.value = !0, window.addEventListener("keydown", E), a.blocking && setTimeout(() => {
963
- Q.value.y.get() - 0 < 0.1 && (i("opened"), fe());
31
+ setup(d, { expose: g, emit: s }) {
32
+ const n = d, u = s, o = l(null), h = l(null), v = l(null), m = l(null), I = l(null), F = l(null), L = l(null), D = l(!1), r = l(n.expandOnContentDrag), { height: W } = he(), { height: T } = x(o), { height: z } = x(h), { height: G } = x(v), { height: K } = x(F), { activate: Y, deactivate: j } = be([o, L]), p = w(() => Math.ceil(K.value + z.value + G.value)), { motionProperties: b } = fe(o), { push: y, stop: q, motionValues: B } = ge(), { set: k } = me(b, {}, { push: y, motionValues: B, stop: q }), e = l(0), a = l(0), { snapPoints: J } = ae(n), Q = w(() => J.value ?? [p.value]), { minSnap: f, maxSnap: S, snapPoints: C, closestSnapPoint: U } = ye(Q, e), $ = pe(document.body), N = (t) => {
33
+ t.key === "Escape" && _();
34
+ }, X = () => {
35
+ o.value && (e.value = n.defaultBreakpoint ?? f.value, k({
36
+ height: e.value,
37
+ y: e.value
38
+ }), y("y", 0, b, { type: "tween", easings: "easeInOut", bounce: 0, duration: 300 }), D.value = !0, $.value = !0, window.addEventListener("keydown", N), n.blocking && setTimeout(() => {
39
+ B.value.y.get() - 0 < 0.1 && (u("opened"), Y());
964
40
  }, 300));
965
- }, A = () => {
966
- u.value && (_("y", R.value, W, { type: "tween", bounce: 0, duration: 300 }), v.value = !1, g.value = !1, a.blocking && ne(), window.removeEventListener("keydown", E), setTimeout(() => {
967
- Q.value.y.get() - R.value < 0.1 && i("closed");
41
+ }, _ = () => {
42
+ o.value && (y("y", T.value, b, { type: "tween", bounce: 0, duration: 300 }), D.value = !1, $.value = !1, n.blocking && j(), window.removeEventListener("keydown", N), setTimeout(() => {
43
+ B.value.y.get() - T.value < 0.1 && u("closed");
968
44
  }, 300));
969
- }, V = () => {
970
- a.canBackdropClose && A();
45
+ }, Z = () => {
46
+ n.canBackdropClose && _();
971
47
  };
972
- function B(S) {
973
- T.value && S.preventDefault();
48
+ function ee(t) {
49
+ r.value && t.preventDefault();
974
50
  }
975
- const j = (S) => {
976
- u.value && (y.value = S, _("height", y.value, W, {
51
+ const V = (t) => {
52
+ o.value && (e.value = t, y("height", e.value, b, {
977
53
  type: "tween",
978
54
  easings: "easeInOut",
979
55
  bounce: 0,
980
56
  duration: 300
981
57
  }));
982
- }, Z = ({ delta: S }) => {
983
- u.value && (b.value === 0 && (y.value -= S[1]), y.value <= c.value && (y.value = c.value, b.value += S[1], b.value = Math.max(0, Math.min(b.value, c.value)), L({
984
- y: a.canSwipeClose ? b.value : he(b.value, -R.value, 0, 0.5)
985
- })), L({
986
- height: Math.min(Math.max(he(y.value, 0, m.value, 0.25), 0), F.value)
58
+ }, A = ({ delta: t }) => {
59
+ o.value && (a.value === 0 && (e.value -= t[1]), e.value <= f.value && (e.value = f.value, a.value += t[1], a.value = Math.max(0, Math.min(a.value, f.value)), k({
60
+ y: n.canSwipeClose ? a.value : E(a.value, -T.value, 0, 0.5)
61
+ })), k({
62
+ height: Math.min(Math.max(E(e.value, 0, S.value, 0.25), 0), W.value)
987
63
  }));
988
- }, $ = () => {
989
- u.value && (b.value = a.canSwipeClose ? [0, y.value].reduce((S, M) => Math.abs(M - b.value) < Math.abs(S - b.value) ? M : S) : 0, _("y", b.value, W, { type: "tween", easings: "easeInOut", bounce: 0, duration: 300 }), b.value === y.value && (b.value = 0, A()), y.value = w.value[N.value], _("height", y.value, W, { type: "tween", easings: "easeInOut", bounce: 0, duration: 300 }));
64
+ }, M = () => {
65
+ o.value && (a.value = n.canSwipeClose ? [0, e.value].reduce((t, i) => Math.abs(i - a.value) < Math.abs(t - a.value) ? i : t) : 0, y("y", a.value, b, { type: "tween", easings: "easeInOut", bounce: 0, duration: 300 }), a.value === e.value && (a.value = 0, _()), e.value = C.value[U.value], y("height", e.value, b, { type: "tween", easings: "easeInOut", bounce: 0, duration: 300 }));
990
66
  };
991
- return be(
67
+ return P(
992
68
  {
993
- onDrag: Z,
994
- onDragEnd: $
69
+ onDrag: A,
70
+ onDragEnd: M
995
71
  },
996
72
  {
997
- domTarget: r,
73
+ domTarget: h,
998
74
  drag: { filterTaps: !0 }
999
75
  }
1000
- ), be(
76
+ ), P(
1001
77
  {
1002
- onDrag: Z,
1003
- onDragEnd: $
78
+ onDrag: A,
79
+ onDragEnd: M
1004
80
  },
1005
81
  {
1006
- domTarget: l,
82
+ domTarget: v,
1007
83
  drag: { filterTaps: !0 }
1008
84
  }
1009
- ), be(
85
+ ), P(
1010
86
  {
1011
- onDragStart: ({ direction: S }) => {
1012
- const M = f.value.scrollTop === 0, de = S[1] > 0;
1013
- w.value.length === 1 ? b.value === 0 && M && (T.value = de) : (a.expandOnContentDrag && y.value !== m.value && (T.value = !0), y.value === m.value && M && (T.value = de));
87
+ onDragStart: ({ direction: t }) => {
88
+ const i = m.value.scrollTop === 0, H = t[1] > 0;
89
+ C.value.length === 1 ? a.value === 0 && i && (r.value = H) : (n.expandOnContentDrag && e.value !== S.value && (r.value = !0), e.value === S.value && i && (r.value = H));
1014
90
  },
1015
- onDrag: ({ delta: S }) => {
1016
- if (!a.expandOnContentDrag) {
1017
- T.value = !1;
91
+ onDrag: ({ delta: t }) => {
92
+ if (!n.expandOnContentDrag) {
93
+ r.value = !1;
1018
94
  return;
1019
95
  }
1020
- if (!u.value) return;
1021
- b.value === 0 && T.value && a.expandOnContentDrag && (y.value -= S[1]), y.value <= c.value && (y.value = c.value, T.value && a.expandOnContentDrag && (b.value += S[1]), b.value = Math.max(0, Math.min(b.value, c.value)), L({
1022
- y: a.canSwipeClose ? b.value : he(b.value, -R.value, 0, 0.5)
1023
- })), y.value > m.value && (y.value = m.value);
1024
- const M = f.value.scrollTop === 0;
1025
- w.value.length === 1 ? S[1] < 0 && b.value === 0 && M && (T.value = !1) : y.value === m.value && (T.value = !1), L({
1026
- height: y.value
96
+ if (!o.value) return;
97
+ a.value === 0 && r.value && n.expandOnContentDrag && (e.value -= t[1]), e.value <= f.value && (e.value = f.value, r.value && n.expandOnContentDrag && (a.value += t[1]), a.value = Math.max(0, Math.min(a.value, f.value)), k({
98
+ y: n.canSwipeClose ? a.value : E(a.value, -T.value, 0, 0.5)
99
+ })), e.value > S.value && (e.value = S.value);
100
+ const i = m.value.scrollTop === 0;
101
+ C.value.length === 1 ? t[1] < 0 && a.value === 0 && i && (r.value = !1) : e.value === S.value && (r.value = !1), k({
102
+ height: e.value
1027
103
  });
1028
104
  },
1029
- onDragEnd: $
105
+ onDragEnd: M
1030
106
  },
1031
107
  {
1032
- domTarget: d,
108
+ domTarget: I,
1033
109
  drag: { filterTaps: !0 }
1034
110
  }
1035
- ), G(x, () => {
1036
- i("minHeight", x.value), w.value.length === 1 && ye(() => {
1037
- w.value[0] === x.value && j(x.value);
111
+ ), ne(p, () => {
112
+ u("minHeight", p.value), C.value.length === 1 && R(() => {
113
+ C.value[0] === p.value && V(p.value);
1038
114
  });
1039
- }), Se(() => {
1040
- i("minHeight", x.value), i("maxHeight", F.value), y.value = a.defaultBreakpoint ?? Number(x.value), L({
1041
- height: y.value,
1042
- y: y.value
1043
- }), ye(() => {
1044
- i("ready");
115
+ }), oe(() => {
116
+ u("minHeight", p.value), u("maxHeight", W.value), e.value = n.defaultBreakpoint ?? Number(p.value), k({
117
+ height: e.value,
118
+ y: e.value
119
+ }), R(() => {
120
+ u("ready");
1045
121
  });
1046
- }), e({ open: D, close: A, snapToPoint: j }), (S, M) => (Qe(), Ze(Je, { to: "body" }, [
1047
- K("div", tn, [
1048
- et(tt, { name: "fade" }, {
1049
- default: nt(() => [
1050
- at(K("div", {
122
+ }), g({ open: X, close: _, snapToPoint: V }), (t, i) => (le(), se(ue, { to: "body" }, [
123
+ c("div", ke, [
124
+ ie(re, { name: "fade" }, {
125
+ default: ve(() => [
126
+ ce(c("div", {
1051
127
  ref_key: "backdrop",
1052
- ref: h,
128
+ ref: L,
1053
129
  "data-vsbs-backdrop": "",
1054
- onClick: M[0] || (M[0] = (de) => V())
130
+ onClick: i[0] || (i[0] = (H) => Z())
1055
131
  }, null, 512), [
1056
- [rt, v.value && S.blocking]
132
+ [de, D.value && t.blocking]
1057
133
  ])
1058
134
  ]),
1059
135
  _: 1
1060
136
  }),
1061
- K("div", {
137
+ c("div", {
1062
138
  ref_key: "sheet",
1063
- ref: u,
1064
- "data-vsbs-shadow": !S.blocking,
1065
- "data-vsbs-sheet-show": v.value,
139
+ ref: o,
140
+ "data-vsbs-shadow": !t.blocking,
141
+ "data-vsbs-sheet-show": D.value,
1066
142
  "aria-modal": "true",
1067
143
  "data-vsbs-sheet": "",
1068
144
  tabindex: "-1"
1069
145
  }, [
1070
- K("div", {
146
+ c("div", {
1071
147
  ref_key: "sheetHeader",
1072
- ref: r,
148
+ ref: h,
1073
149
  "data-vsbs-header": ""
1074
150
  }, [
1075
- ve(S.$slots, "header", {}, void 0, !0)
151
+ O(t.$slots, "header", {}, void 0, !0)
1076
152
  ], 512),
1077
- K("div", {
153
+ c("div", {
1078
154
  ref_key: "sheetScroll",
1079
- ref: f,
155
+ ref: m,
1080
156
  "data-vsbs-scroll": "",
1081
- onTouchmove: B
157
+ onTouchmove: ee
1082
158
  }, [
1083
- K("div", {
159
+ c("div", {
1084
160
  ref_key: "sheetContentWrapper",
1085
- ref: d,
161
+ ref: I,
1086
162
  "data-vsbs-content-wrapper": ""
1087
163
  }, [
1088
- K("div", {
164
+ c("div", {
1089
165
  ref_key: "sheetContent",
1090
- ref: p,
166
+ ref: F,
1091
167
  "data-vsbs-content": ""
1092
168
  }, [
1093
- ve(S.$slots, "default", {}, void 0, !0)
169
+ O(t.$slots, "default", {}, void 0, !0)
1094
170
  ], 512)
1095
171
  ], 512)
1096
172
  ], 544),
1097
- K("div", {
173
+ c("div", {
1098
174
  ref_key: "sheetFooter",
1099
- ref: l,
175
+ ref: v,
1100
176
  "data-vsbs-footer": ""
1101
177
  }, [
1102
- ve(S.$slots, "footer", {}, void 0, !0)
178
+ O(t.$slots, "footer", {}, void 0, !0)
1103
179
  ], 512)
1104
- ], 8, nn)
180
+ ], 8, Se)
1105
181
  ])
1106
182
  ]));
1107
183
  }
1108
- }), rn = (n, e) => {
1109
- const t = n.__vccOpts || n;
1110
- for (const [a, i] of e)
1111
- t[a] = i;
1112
- return t;
1113
- }, cn = /* @__PURE__ */ rn(an, [["__scopeId", "data-v-931062ac"]]);
184
+ }), Ce = (d, g) => {
185
+ const s = d.__vccOpts || d;
186
+ for (const [n, u] of g)
187
+ s[n] = u;
188
+ return s;
189
+ }, He = /* @__PURE__ */ Ce(we, [["__scopeId", "data-v-931062ac"]]);
1114
190
  export {
1115
- cn as default
191
+ He as default
1116
192
  };
package/package.json CHANGED
@@ -32,7 +32,7 @@
32
32
  "url": "https://github.com/megaarmos/vue-spring-bottom-sheet/issues"
33
33
  },
34
34
  "private": false,
35
- "version": "1.0.3",
35
+ "version": "1.0.4",
36
36
  "type": "module",
37
37
  "exports": {
38
38
  ".": {