@douxcode/vue-spring-bottom-sheet 3.1.0 → 3.2.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/README.md CHANGED
@@ -145,6 +145,9 @@ For Nuxt 3, just wrap component in `<ClientOnly>`
145
145
  | headerClass | String | '' | Set header element class |
146
146
  | contentClass | String | '' | Set content element class |
147
147
  | footerClass | String | '' | Set footer element class |
148
+ | forceMount | Boolean | false | Force mount the bottom sheet in the DOM |
149
+
150
+ Interactive content inside the sheet body keeps its native touch behavior. Inputs and editable content do not start sheet dragging, and custom widgets can opt out with data-vsbs-no-drag.
148
151
 
149
152
  ## Exposed methods
150
153
 
@@ -44,6 +44,7 @@ declare const __VLS_component: import('vue').DefineComponent<BottomSheetProps, {
44
44
  }>, {
45
45
  blocking: boolean;
46
46
  duration: number;
47
+ forceMount: boolean;
47
48
  canSwipeClose: boolean;
48
49
  canBackdropClose: boolean;
49
50
  expandOnContentDrag: boolean;
package/dist/index.mjs CHANGED
@@ -1,73 +1,73 @@
1
- import { ref as I, shallowRef as x, computed as H, defineComponent as Be, useCssVars as Oe, watch as A, nextTick as _, onMounted as Ae, toRef as F, onUnmounted as Fe, openBlock as $, createElementBlock as ee, Fragment as $e, createBlock as fe, Teleport as ve, createElementVNode as V, createVNode as he, Transition as ge, withCtx as me, unref as v, createCommentVNode as pe, normalizeStyle as Ve, normalizeClass as te, renderSlot as ne } from "vue";
2
- import { useScrollLock as Ne, useVModel as ze, useWindowSize as qe, useElementBounding as U } from "@vueuse/core";
3
- import { useFocusTrap as Ke } from "@vueuse/integrations/useFocusTrap";
4
- function Ue(e, t, o) {
5
- let n = (r) => e(r, ...t);
6
- return o === void 0 ? n : Object.assign(n, { lazy: o, lazyArgs: t });
1
+ import { ref as H, shallowRef as y, computed as D, defineComponent as Ae, useCssVars as Fe, watch as A, nextTick as _, onMounted as $e, toRef as F, onUnmounted as Ve, openBlock as $, createElementBlock as ee, Fragment as ze, createBlock as fe, Teleport as ve, createElementVNode as V, createVNode as he, Transition as ge, withCtx as me, unref as f, withDirectives as pe, vShow as Se, createCommentVNode as be, normalizeStyle as Ne, normalizeClass as te, renderSlot as ne } from "vue";
2
+ import { useScrollLock as qe, useVModel as Ke, useWindowSize as Ue, useElementBounding as U } from "@vueuse/core";
3
+ import { useFocusTrap as We } from "@vueuse/integrations/useFocusTrap";
4
+ function Ge(e, t, o) {
5
+ let a = (l) => e(l, ...t);
6
+ return o === void 0 ? a : Object.assign(a, { lazy: o, lazyArgs: t });
7
7
  }
8
- function We(e, t, o) {
9
- let n = e.length - t.length;
10
- if (n === 0) return e(...t);
11
- if (n === 1) return Ue(e, t, o);
8
+ function Qe(e, t, o) {
9
+ let a = e.length - t.length;
10
+ if (a === 0) return e(...t);
11
+ if (a === 1) return Ge(e, t, o);
12
12
  throw Error("Wrong number of arguments");
13
13
  }
14
- function E(...e) {
15
- return We(Ge, e);
14
+ function T(...e) {
15
+ return Qe(Xe, e);
16
16
  }
17
- const Ge = (e, { min: t, max: o }) => t !== void 0 && e < t ? t : o !== void 0 && e > o ? o : e, Te = /* @__PURE__ */ Symbol("funnel/voidReducer"), Qe = () => Te;
18
- function Xe(e, { triggerAt: t = "end", minQuietPeriodMs: o, maxBurstDurationMs: n, minGapMs: r, reducer: i = Qe }) {
19
- let u, f, d, h, m = () => {
20
- let g = d;
21
- g !== void 0 && (d = void 0, g === Te ? e() : e(g), r !== void 0 && (f = setTimeout(P, r)));
17
+ const Xe = (e, { min: t, max: o }) => t !== void 0 && e < t ? t : o !== void 0 && e > o ? o : e, ye = /* @__PURE__ */ Symbol("funnel/voidReducer"), je = () => ye;
18
+ function Je(e, { triggerAt: t = "end", minQuietPeriodMs: o, maxBurstDurationMs: a, minGapMs: l, reducer: u = je }) {
19
+ let i, v, d, h, p = () => {
20
+ let m = d;
21
+ m !== void 0 && (d = void 0, m === ye ? e() : e(m), l !== void 0 && (v = setTimeout(P, l)));
22
22
  }, P = () => {
23
- clearTimeout(f), f = void 0, u === void 0 && m();
23
+ clearTimeout(v), v = void 0, i === void 0 && p();
24
24
  }, C = () => {
25
- clearTimeout(u), u = void 0, h = void 0, f === void 0 && m();
25
+ clearTimeout(i), i = void 0, h = void 0, v === void 0 && p();
26
26
  };
27
- return { call: (...g) => {
28
- let T = u === void 0 && f === void 0;
29
- if ((t !== "start" || T) && (d = i(d, ...g)), !(u === void 0 && !T)) {
30
- if (o !== void 0 || n !== void 0 || r === void 0) {
31
- clearTimeout(u);
32
- let y = Date.now();
33
- h ??= y;
34
- let Y = n === void 0 ? o ?? 0 : Math.min(o ?? n, Math.max(0, n - (y - h)));
35
- u = setTimeout(C, Y);
27
+ return { call: (...m) => {
28
+ let k = i === void 0 && v === void 0;
29
+ if ((t !== "start" || k) && (d = u(d, ...m)), !(i === void 0 && !k)) {
30
+ if (o !== void 0 || a !== void 0 || l === void 0) {
31
+ clearTimeout(i);
32
+ let E = Date.now();
33
+ h ??= E;
34
+ let M = a === void 0 ? o ?? 0 : Math.min(o ?? a, Math.max(0, a - (E - h)));
35
+ i = setTimeout(C, M);
36
36
  }
37
- t !== "end" && T && m();
37
+ t !== "end" && k && p();
38
38
  }
39
39
  }, cancel: () => {
40
- clearTimeout(u), u = void 0, h = void 0, clearTimeout(f), f = void 0, d = void 0;
40
+ clearTimeout(i), i = void 0, h = void 0, clearTimeout(v), v = void 0, d = void 0;
41
41
  }, flush: () => {
42
42
  C(), P();
43
43
  }, get isIdle() {
44
- return u === void 0 && f === void 0;
44
+ return i === void 0 && v === void 0;
45
45
  } };
46
46
  }
47
- const je = 5, Je = 30, Ze = 400;
48
- function _e() {
49
- const e = I([]);
50
- function t(r) {
51
- e.value = [{ y: r, time: performance.now() }];
47
+ const Ze = 5, _e = 30, et = 400;
48
+ function tt() {
49
+ const e = H([]);
50
+ function t(l) {
51
+ e.value = [{ y: l, time: performance.now() }];
52
52
  }
53
- function o(r) {
54
- const i = e.value;
55
- i.push({ y: r, time: performance.now() }), i.length > je && i.shift();
53
+ function o(l) {
54
+ const u = e.value;
55
+ u.push({ y: l, time: performance.now() }), u.length > Ze && u.shift();
56
56
  }
57
- function n() {
58
- const r = e.value;
59
- if (r.length < 2)
57
+ function a() {
58
+ const l = e.value;
59
+ if (l.length < 2)
60
60
  return { direction: "none", velocity: 0, isSwipe: !1 };
61
- const i = r[0], u = r[r.length - 1];
62
- if (!i || !u)
61
+ const u = l[0], i = l[l.length - 1];
62
+ if (!u || !i)
63
63
  return { direction: "none", velocity: 0, isSwipe: !1 };
64
- const f = i.y - u.y, d = (u.time - i.time) / 1e3, h = d > 0 ? Math.abs(f) / d : 0, m = Math.abs(f) >= Je && h >= Ze;
64
+ const v = u.y - i.y, d = (i.time - u.time) / 1e3, h = d > 0 ? Math.abs(v) / d : 0, p = Math.abs(v) >= _e && h >= et;
65
65
  let P = "none";
66
- return m && (P = f > 0 ? "up" : "down"), e.value = [], { direction: P, velocity: h, isSwipe: m };
66
+ return p && (P = v > 0 ? "up" : "down"), e.value = [], { direction: P, velocity: h, isSwipe: p };
67
67
  }
68
- return { start: t, update: o, end: n };
68
+ return { start: t, update: o, end: a };
69
69
  }
70
- function et(e, t) {
70
+ function nt(e, t) {
71
71
  if (e === void 0)
72
72
  return t / 2;
73
73
  if (typeof e == "number")
@@ -78,109 +78,112 @@ function et(e, t) {
78
78
  }
79
79
  return t / 2;
80
80
  }
81
- const tt = 10, Se = 0.25;
82
- function be(e) {
83
- const t = e, o = e instanceof HTMLAnchorElement || e instanceof HTMLButtonElement || e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement || e instanceof HTMLLabelElement || e instanceof HTMLVideoElement || e instanceof HTMLAudioElement, n = e.hasAttribute("onclick") || e.hasAttribute("role"), r = t.tabIndex >= 0 || e.hasAttribute("tabindex"), i = t.isContentEditable || e instanceof HTMLInputElement && !e.disabled || e instanceof HTMLTextAreaElement && !e.disabled;
84
- return o || n || r || i;
81
+ const at = 10, we = 0.25;
82
+ function Pe(e) {
83
+ return !!e.closest(
84
+ 'input, textarea, [contenteditable="true"], [contenteditable=""], [data-vsbs-no-drag]'
85
+ );
85
86
  }
86
- function nt(e, t, o) {
87
+ function ot(e, t, o) {
87
88
  return Math.max(t, Math.min(e, o));
88
89
  }
89
- function at(e, t) {
90
+ function rt(e, t) {
90
91
  return Math.pow(e, t * 5);
91
92
  }
92
- function we(e, t, o) {
93
- return t === 0 || Math.abs(t) === 1 / 0 ? at(e, o) : e * t * o / (t + o * e);
93
+ function Ce(e, t, o) {
94
+ return t === 0 || Math.abs(t) === 1 / 0 ? rt(e, o) : e * t * o / (t + o * e);
94
95
  }
95
- function Pe(e, t, o, n = 0.15) {
96
- return n === 0 ? nt(e, t, o) : e < t ? -we(t - e, o - t, n) + t : e > o ? +we(e - o, o - t, n) + o : e;
96
+ function ke(e, t, o, a = 0.15) {
97
+ return a === 0 ? ot(e, t, o) : e < t ? -Ce(t - e, o - t, a) + t : e > o ? +Ce(e - o, o - t, a) + o : e;
97
98
  }
98
- const ot = (e) => {
99
- const t = _e(), o = x(!1);
100
- let n = !0, r = 0, i = 0, u = !1, f = 0, d = !1, h = 0;
101
- const m = (a) => {
102
- a > 0 ? e.onDraggingDown?.() : a < 0 && e.onDraggingUp?.();
99
+ const lt = (e) => {
100
+ const t = tt(), o = y(!1);
101
+ let a = !0, l = 0, u = 0, i = !1, v = 0, d = !1, h = 0;
102
+ const p = (n) => {
103
+ n > 0 ? e.onDraggingDown?.() : n < 0 && e.onDraggingUp?.();
103
104
  }, P = () => {
104
- if (u) return;
105
- const a = document.activeElement;
106
- a instanceof HTMLElement && a !== document.body && (a.blur(), u = !0);
107
- }, C = (a) => {
108
- typeof a.cancelable != "boolean" || a.cancelable ? n && a.preventDefault() : console.warn("The following event couldn't be canceled:");
109
- }, g = (a, p) => {
110
- const b = p === "header" ? e.sheetHeaderRef.value : e.sheetFooterRef.value;
111
- b && a.button === 0 && (r = e.height.value, i = e.translateY.value, u = !1, h = 0, d = !1, n = !0, o.value = !0, t.start(a.clientY), b.setPointerCapture(a.pointerId));
112
- }, T = (a) => {
113
- e.sheetContentRef.value && a.button === 0 && e.expandOnContentDrag.value !== !1 && (be(a.target) || (r = e.height.value, i = e.translateY.value, f = a.clientY, u = !1, h = 0, d = !1, n = !0, o.value = !0, t.start(a.clientY), e.sheetContentRef.value.setPointerCapture(a.pointerId)));
114
- }, y = (a) => {
105
+ if (i) return;
106
+ const n = document.activeElement;
107
+ n instanceof HTMLElement && n !== document.body && (n.blur(), i = !0);
108
+ }, C = (n) => {
109
+ const g = n.target;
110
+ g && Pe(g) && n.preventDefault(), typeof n.cancelable != "boolean" || n.cancelable ? a && n.preventDefault() : console.warn("The following event couldn't be canceled:");
111
+ }, m = (n, g) => {
112
+ const b = g === "header" ? e.sheetHeaderRef.value : e.sheetFooterRef.value;
113
+ b && n.button === 0 && (l = e.height.value, u = e.translateY.value, i = !1, h = 0, d = !1, a = !0, o.value = !0, t.start(n.clientY), b.setPointerCapture(n.pointerId));
114
+ }, k = (n) => {
115
+ const g = n.target;
116
+ e.sheetContentRef.value && n.button === 0 && e.expandOnContentDrag.value !== !1 && (g && Pe(g) || (l = e.height.value, u = e.translateY.value, v = n.clientY, i = !1, h = 0, d = !1, a = !0, o.value = !0, t.start(n.clientY), e.sheetContentRef.value.setPointerCapture(n.pointerId)));
117
+ }, E = (n) => {
115
118
  if (o.value) {
116
- if (Math.abs(a.movementY) > 0 && P(), t.update(a.clientY), m(a.movementY), e.translateY.value > 0) {
117
- e.canSwipeClose.value ? e.translateY.value = e.translateY.value + a.movementY : (i = i + a.movementY, e.translateY.value = Pe(
118
- i,
119
+ if (Math.abs(n.movementY) > 0 && P(), t.update(n.clientY), p(n.movementY), e.translateY.value > 0) {
120
+ e.canSwipeClose.value ? e.translateY.value = e.translateY.value + n.movementY : (u = u + n.movementY, e.translateY.value = ke(
121
+ u,
119
122
  -e.minSnapPoint.value,
120
123
  0,
121
- Se
124
+ we
122
125
  ));
123
126
  return;
124
127
  }
125
- r = E(r - a.movementY, {
128
+ l = T(l - n.movementY, {
126
129
  min: e.minSnapPoint.value
127
- }), e.height.value = Pe(
128
- r,
130
+ }), e.height.value = ke(
131
+ l,
129
132
  0,
130
133
  e.maxSnapPoint.value,
131
- Se
132
- ), e.height.value <= e.minSnapPoint.value && (e.translateY.value = e.translateY.value + a.movementY);
134
+ we
135
+ ), e.height.value <= e.minSnapPoint.value && (e.translateY.value = e.translateY.value + n.movementY);
133
136
  }
134
- }, Y = (a) => {
137
+ }, M = (n) => {
135
138
  if (h >= 2)
136
139
  return;
137
- const p = e.sheetScrollRef.value, b = p?.scrollTop === 0, w = a.clientY - f > 0, S = e.flattenedSnapPoints.value.length === 1, z = 0.5 > Math.abs(e.height.value - e.maxSnapPoint.value), D = (p?.scrollHeight ?? 0) > (p?.clientHeight ?? 0);
140
+ const g = e.sheetScrollRef.value, b = g?.scrollTop === 0, w = n.clientY - v > 0, S = e.flattenedSnapPoints.value.length === 1, N = 0.5 > Math.abs(e.height.value - e.maxSnapPoint.value), R = (g?.scrollHeight ?? 0) > (g?.clientHeight ?? 0);
138
141
  if (S) {
139
142
  if (!e.expandOnContentDrag.value) {
140
- n = !1;
143
+ a = !1;
141
144
  return;
142
145
  }
143
- e.translateY.value === 0 && b && w && (n = !0), e.translateY.value === 0 && b && !w && (n = !1);
146
+ e.translateY.value === 0 && b && w && (a = !0), e.translateY.value === 0 && b && !w && (a = !1);
144
147
  } else
145
- n = !0, z && (w && b && (n = !0), !w && b && (n = !1), b || (n = !1));
146
- d = !D, h++;
147
- }, R = (a) => {
148
- if (!o.value || !e.sheetScrollRef.value || (Math.abs(a.movementY) > 0 && P(), Y(a), h <= 1)) return;
149
- if (t.update(a.clientY), m(a.movementY), e.translateY.value > 0) {
150
- e.canSwipeClose.value && (e.translateY.value = E(e.translateY.value + a.movementY, { min: 0 }));
148
+ a = !0, N && (w && b && (a = !0), !w && b && (a = !1), b || (a = !1));
149
+ d = !R, h++;
150
+ }, B = (n) => {
151
+ if (!o.value || !e.sheetScrollRef.value || (Math.abs(n.movementY) > 0 && P(), M(n), h <= 1)) return;
152
+ if (t.update(n.clientY), p(n.movementY), e.translateY.value > 0) {
153
+ e.canSwipeClose.value && (e.translateY.value = T(e.translateY.value + n.movementY, { min: 0 }));
151
154
  return;
152
155
  }
153
- e.height.value = E(e.height.value - a.movementY, {
156
+ e.height.value = T(e.height.value - n.movementY, {
154
157
  min: e.minSnapPoint.value,
155
158
  max: e.maxSnapPoint.value
156
- }), !(e.flattenedSnapPoints.value.length === 1) && e.height.value === e.maxSnapPoint.value && (n = !1), e.height.value <= e.minSnapPoint.value && (e.translateY.value = E(e.translateY.value + a.movementY, {
159
+ }), !(e.flattenedSnapPoints.value.length === 1) && e.height.value === e.maxSnapPoint.value && (a = !1), e.height.value <= e.minSnapPoint.value && (e.translateY.value = T(e.translateY.value + n.movementY, {
157
160
  min: 0,
158
161
  ...e.canSwipeClose.value === !1 ? { max: 0 } : {}
159
162
  }));
160
- }, N = () => {
161
- const a = t.end();
162
- if (a.isSwipe && a.direction === "down" && e.canSwipeClose.value && e.height.value <= e.minSnapPoint.value + tt) {
163
+ }, z = () => {
164
+ const n = t.end();
165
+ if (n.isSwipe && n.direction === "down" && e.canSwipeClose.value && e.height.value <= e.minSnapPoint.value + at) {
163
166
  e.onClose();
164
167
  return;
165
168
  }
166
169
  if (e.canSwipeClose.value) {
167
- const p = et(
170
+ const g = nt(
168
171
  e.swipeCloseThreshold.value,
169
172
  e.height.value
170
173
  );
171
- if (e.translateY.value > p) {
174
+ if (e.translateY.value > g) {
172
175
  e.onClose();
173
176
  return;
174
177
  }
175
178
  }
176
- if (a.isSwipe && e.flattenedSnapPoints.value.length > 1) {
177
- const p = [...e.flattenedSnapPoints.value].sort((w, S) => w - S);
179
+ if (n.isSwipe && e.flattenedSnapPoints.value.length > 1) {
180
+ const g = [...e.flattenedSnapPoints.value].sort((w, S) => w - S);
178
181
  let b = e.closestSnapPointIndex.value;
179
- if (a.direction === "up") {
180
- const w = p.find((S) => S > e.height.value + 1);
182
+ if (n.direction === "up") {
183
+ const w = g.find((S) => S > e.height.value + 1);
181
184
  w !== void 0 && (b = e.flattenedSnapPoints.value.indexOf(w));
182
- } else if (a.direction === "down") {
183
- const w = [...p].reverse().find((S) => S < e.height.value - 1);
185
+ } else if (n.direction === "down") {
186
+ const w = [...g].reverse().find((S) => S < e.height.value - 1);
184
187
  w !== void 0 && (b = e.flattenedSnapPoints.value.indexOf(w));
185
188
  }
186
189
  e.onSnapToPoint(b), e.translateY.value = 0;
@@ -191,100 +194,101 @@ const ot = (e) => {
191
194
  return {
192
195
  isDragging: o,
193
196
  handleSheetScroll: C,
194
- handlePointerDown: g,
195
- handleContentPointerDown: T,
196
- handlePointerMove: y,
197
- handleContentPointerMove: R,
198
- handleLostPointerCapture: (a, p) => {
199
- o.value = !1, p === "header" ? e.sheetHeaderRef.value?.releasePointerCapture(a.pointerId) : p === "footer" ? e.sheetFooterRef.value?.releasePointerCapture(a.pointerId) : e.sheetContentRef.value?.releasePointerCapture(a.pointerId), h = 0, d = !1, u = !1, N();
197
+ handlePointerDown: m,
198
+ handleContentPointerDown: k,
199
+ handlePointerMove: E,
200
+ handleContentPointerMove: B,
201
+ handleLostPointerCapture: (n, g) => {
202
+ o.value = !1, g === "header" ? e.sheetHeaderRef.value?.releasePointerCapture(n.pointerId) : g === "footer" ? e.sheetFooterRef.value?.releasePointerCapture(n.pointerId) : e.sheetContentRef.value?.releasePointerCapture(n.pointerId), h = 0, d = !1, i = !1, z();
200
203
  },
201
- handleTouchStart: (a) => {
202
- be(a.target) || d && a.preventDefault();
204
+ handleTouchStart: (n) => {
205
+ d && n.preventDefault();
203
206
  }
204
207
  };
205
208
  };
206
- function rt(e) {
207
- const { sheetRef: t, backdropRef: o, blocking: n, onEscape: r } = e, i = I(null), u = Ke([t, o], {
209
+ function st(e) {
210
+ const { sheetRef: t, backdropRef: o, blocking: a, onEscape: l } = e, u = H(null), i = We([t, o], {
208
211
  immediate: !1,
209
212
  fallbackFocus: () => t.value || document.body
210
- }), f = (g) => {
211
- g.key === "Escape" && r();
213
+ }), v = (m) => {
214
+ m.key === "Escape" && l();
212
215
  }, d = () => {
213
- t.value && (i.value = new MutationObserver((g) => {
214
- for (const T of g)
215
- T.type === "attributes" && T.attributeName === "aria-expanded" && (T.target.getAttribute("aria-expanded") === "true" ? u.pause() : t.value?.querySelector('[aria-expanded="true"]') || u.unpause());
216
- }), i.value.observe(t.value, {
216
+ t.value && (u.value = new MutationObserver((m) => {
217
+ for (const k of m)
218
+ k.type === "attributes" && k.attributeName === "aria-expanded" && (k.target.getAttribute("aria-expanded") === "true" ? i.pause() : t.value?.querySelector('[aria-expanded="true"]') || i.unpause());
219
+ }), u.value.observe(t.value, {
217
220
  attributes: !0,
218
221
  attributeFilter: ["aria-expanded"],
219
222
  subtree: !0
220
223
  }));
221
224
  }, h = () => {
222
- i.value && (i.value.disconnect(), i.value = null);
225
+ u.value && (u.value.disconnect(), u.value = null);
223
226
  };
224
227
  return {
225
228
  activate: () => {
226
- n.value && (u.activate(), d()), window.addEventListener("keydown", f);
229
+ a.value && (i.activate(), d()), window.addEventListener("keydown", v);
227
230
  },
228
231
  deactivate: () => {
229
- window.removeEventListener("keydown", f), h(), n.value && u.deactivate();
232
+ window.removeEventListener("keydown", v), h(), a.value && i.deactivate();
230
233
  },
231
234
  cleanup: () => {
232
- h(), u.deactivate();
235
+ h(), i.deactivate();
233
236
  }
234
237
  };
235
238
  }
236
- function lt(e) {
237
- const { blocking: t } = e, o = Ne(document.documentElement), n = () => {
239
+ function ut(e) {
240
+ const { blocking: t } = e, o = qe(document.documentElement), a = () => {
238
241
  o.value = !0;
239
- }, r = () => {
242
+ }, l = () => {
240
243
  o.value = !1;
241
244
  };
242
245
  return {
243
- lock: n,
244
- unlock: r,
246
+ lock: a,
247
+ unlock: l,
245
248
  lockIfBlocking: () => {
246
- t.value && n();
249
+ t.value && a();
247
250
  },
248
251
  unlockIfBlocking: () => {
249
- t.value && r();
252
+ t.value && l();
250
253
  },
251
254
  touchStartHandler: () => {
252
- t.value || n();
255
+ t.value || a();
253
256
  },
254
257
  touchEndHandler: () => {
255
- t.value || r();
258
+ t.value || l();
256
259
  }
257
260
  };
258
261
  }
259
- function ke(e, t) {
262
+ function Te(e, t) {
260
263
  const o = parseFloat(e);
261
264
  return t * o / 100;
262
265
  }
263
- function st(e, t, o) {
264
- const n = I(0), r = H(() => e.value.map((d) => typeof d == "string" ? ke(d, o.value) : d)), i = H(() => Math.min(...r.value)), u = H(() => Math.max(...r.value)), f = H(() => {
265
- const d = r.value.reduce(
266
- (h, m) => Math.abs(m - t.value) < Math.abs(h - t.value) ? m : h
266
+ function it(e, t, o) {
267
+ const a = H(0), l = D(() => e.value.map((d) => typeof d == "string" ? Te(d, o.value) : d)), u = D(() => Math.min(...l.value)), i = D(() => Math.max(...l.value)), v = D(() => {
268
+ const d = l.value.reduce(
269
+ (h, p) => Math.abs(p - t.value) < Math.abs(h - t.value) ? p : h
267
270
  );
268
- return r.value.indexOf(d);
271
+ return l.value.indexOf(d);
269
272
  });
270
273
  return {
271
- currentSnapPointIndex: n,
272
- flattenedSnapPoints: r,
273
- minSnapPoint: i,
274
- maxSnapPoint: u,
275
- closestSnapPointIndex: f
274
+ currentSnapPointIndex: a,
275
+ flattenedSnapPoints: l,
276
+ minSnapPoint: u,
277
+ maxSnapPoint: i,
278
+ closestSnapPointIndex: v
276
279
  };
277
280
  }
278
- function Ce(e, t) {
279
- return typeof e == "number" ? E(e, { max: t }) : ke(e, t);
281
+ function xe(e, t) {
282
+ return typeof e == "number" ? T(e, { max: t }) : Te(e, t);
280
283
  }
281
- const it = ["data-vsbs-shadow", "data-vsbs-sheet-show"], ut = /* @__PURE__ */ Be({
284
+ const ct = ["data-vsbs-shadow", "data-vsbs-sheet-show"], dt = /* @__PURE__ */ Ae({
282
285
  __name: "BottomSheet",
283
286
  props: {
284
287
  duration: { default: 250 },
285
288
  snapPoints: {},
286
289
  initialSnapPoint: {},
287
290
  blocking: { type: Boolean, default: !0 },
291
+ forceMount: { type: Boolean, default: !1 },
288
292
  canSwipeClose: { type: Boolean, default: !0 },
289
293
  swipeCloseThreshold: {},
290
294
  canBackdropClose: { type: Boolean, default: !0 },
@@ -298,146 +302,146 @@ const it = ["data-vsbs-shadow", "data-vsbs-sheet-show"], ut = /* @__PURE__ */ Be
298
302
  },
299
303
  emits: ["opened", "opening-started", "closed", "closing-started", "dragging-up", "dragging-down", "snapped", "instinctHeight", "update:modelValue"],
300
304
  setup(e, { expose: t, emit: o }) {
301
- Oe((s) => ({
302
- v7643c7ff: b.value
305
+ Fe((s) => ({
306
+ v5acd7ef8: b.value
303
307
  }));
304
- const n = e, r = o, i = ze(n, "modelValue", r, {
308
+ const a = e, l = o, u = Ke(a, "modelValue", l, {
305
309
  passive: !0
306
310
  });
307
- A(i, (s) => {
308
- s ? j() : B();
309
- }), A(i, async (s) => {
311
+ A(u, (s) => {
312
+ s ? j() : L();
313
+ }), A(u, async (s) => {
310
314
  if (!s) {
311
315
  C.value = 0;
312
316
  return;
313
317
  }
314
- await _(), M();
315
- }), Ae(() => {
316
- De(), i.value && j();
318
+ await _(), Y();
319
+ }), $e(() => {
320
+ He(), u.value && j();
317
321
  });
318
- const u = x(null), f = x(null), d = x(null), h = x(null), m = x(null), P = x(null), C = I(0), { height: g } = qe(), { height: T } = U(u), { height: y } = U(f), { height: Y } = U(m), { height: R } = U(d), N = H(() => E(
319
- Math.ceil(Y.value + y.value + R.value),
320
- { max: g.value }
321
- )), ae = (s, l, c) => {
322
- y.value = s, Y.value = l, R.value = c;
323
- }, k = I(0), a = I(0), p = H(() => E(k.value + C.value, {
324
- max: g.value
325
- })), b = H(() => n.duration + "ms"), w = F(() => n.snapPoints), S = H(() => w.value ?? [N.value]), {
326
- flattenedSnapPoints: z,
327
- currentSnapPointIndex: D,
328
- closestSnapPointIndex: xe,
322
+ const i = y(null), v = y(null), d = y(null), h = y(null), p = y(null), P = y(null), C = H(0), { height: m } = Ue(), { height: k } = U(i), { height: E } = U(v), { height: M } = U(p), { height: B } = U(d), z = D(() => T(
323
+ Math.ceil(M.value + E.value + B.value),
324
+ { max: m.value }
325
+ )), ae = (s, r, c) => {
326
+ E.value = s, M.value = r, B.value = c;
327
+ }, x = H(0), n = H(0), g = D(() => T(x.value + C.value, {
328
+ max: m.value
329
+ })), b = D(() => a.duration + "ms"), w = F(() => a.snapPoints), S = D(() => w.value ?? [z.value]), {
330
+ flattenedSnapPoints: N,
331
+ currentSnapPointIndex: R,
332
+ closestSnapPointIndex: Ee,
329
333
  minSnapPoint: W,
330
- maxSnapPoint: Ee
331
- } = st(S, k, g), oe = F(() => n.blocking), ye = F(() => n.canSwipeClose), Me = F(() => n.swipeCloseThreshold), He = F(() => n.expandOnContentDrag), L = lt({ blocking: oe }), G = rt({
332
- sheetRef: u,
334
+ maxSnapPoint: Ye
335
+ } = it(S, x, m), oe = F(() => a.blocking), De = F(() => a.canSwipeClose), Me = F(() => a.swipeCloseThreshold), Re = F(() => a.expandOnContentDrag), I = ut({ blocking: oe }), G = st({
336
+ sheetRef: i,
333
337
  backdropRef: P,
334
338
  blocking: oe,
335
- onEscape: () => B()
336
- }), Q = x(!1), X = x(!1), Ye = () => {
337
- n.canBackdropClose && B();
338
- }, M = () => {
339
+ onEscape: () => L()
340
+ }), Q = y(!1), X = y(!1), Ie = () => {
341
+ a.canBackdropClose && L();
342
+ }, Y = () => {
339
343
  const s = window.visualViewport;
340
- if (!s || !i.value) {
344
+ if (!s || !u.value) {
341
345
  C.value = 0;
342
346
  return;
343
347
  }
344
- const l = Math.max(0, window.innerHeight - s.height - s.offsetTop);
345
- C.value = Math.round(l);
348
+ const r = Math.max(0, window.innerHeight - s.height - s.offsetTop);
349
+ C.value = Math.round(r);
346
350
  };
347
351
  let re = null;
348
- const De = () => {
352
+ const He = () => {
349
353
  const s = window.visualViewport;
350
- s && (s.addEventListener("resize", M), s.addEventListener("scroll", M), window.addEventListener("resize", M), re = () => {
351
- s.removeEventListener("resize", M), s.removeEventListener("scroll", M), window.removeEventListener("resize", M);
354
+ s && (s.addEventListener("resize", Y), s.addEventListener("scroll", Y), window.addEventListener("resize", Y), re = () => {
355
+ s.removeEventListener("resize", Y), s.removeEventListener("scroll", Y), window.removeEventListener("resize", Y);
352
356
  });
353
357
  }, j = async () => {
354
358
  if (Q.value) return;
355
- i.value = !0, Q.value = !0, r("opening-started"), L.lockIfBlocking(), await _(), M();
356
- const s = u.value;
357
- T.value = s.getBoundingClientRect().height;
358
- const l = s.querySelector("[data-vsbs-content]"), c = s.querySelector("[data-vsbs-header]"), K = s.querySelector("[data-vsbs-footer]");
359
+ u.value = !0, Q.value = !0, l("opening-started"), I.lockIfBlocking(), await _(), Y();
360
+ const s = i.value;
361
+ k.value = s.getBoundingClientRect().height;
362
+ const r = s.querySelector("[data-vsbs-content]"), c = s.querySelector("[data-vsbs-header]"), K = s.querySelector("[data-vsbs-footer]");
359
363
  if (ae(
360
364
  c.getBoundingClientRect().height,
361
- l.getBoundingClientRect().height,
365
+ r.getBoundingClientRect().height,
362
366
  K.getBoundingClientRect().height
363
- ), await _(), D.value = z.value.findIndex(
367
+ ), await _(), R.value = N.value.findIndex(
364
368
  (O) => O === W.value
365
- ), n.initialSnapPoint !== void 0) {
366
- const O = n.initialSnapPoint;
369
+ ), a.initialSnapPoint !== void 0) {
370
+ const O = a.initialSnapPoint;
367
371
  if (O < 0 || O >= S.value.length) {
368
372
  console.warn("Index out of bounds");
369
373
  return;
370
374
  }
371
375
  const de = S.value[O];
372
376
  if (!de) return;
373
- k.value = Ce(de, g.value);
377
+ x.value = xe(de, m.value);
374
378
  } else
375
- k.value = E(W.value, { max: g.value });
376
- a.value = k.value, requestAnimationFrame(() => {
377
- a.value = 0, n.blocking && setTimeout(() => {
378
- i.value && (r("opened"), G.activate());
379
- }, n.duration);
379
+ x.value = T(W.value, { max: m.value });
380
+ n.value = x.value, requestAnimationFrame(() => {
381
+ n.value = 0, a.blocking && setTimeout(() => {
382
+ u.value && (l("opened"), G.activate());
383
+ }, a.duration);
380
384
  }), Q.value = !1;
381
- }, B = () => {
382
- X.value || (i.value = !1, X.value = !0, r("closing-started"), L.unlockIfBlocking(), G.deactivate(), a.value = k.value, setTimeout(() => {
383
- r("closed"), X.value = !1;
384
- }, n.duration));
385
+ }, L = () => {
386
+ X.value || (u.value = !1, X.value = !0, l("closing-started"), I.unlockIfBlocking(), G.deactivate(), n.value = x.value, setTimeout(() => {
387
+ l("closed"), X.value = !1;
388
+ }, a.duration));
385
389
  }, J = (s) => {
386
390
  if (!S.value) return;
387
391
  if (s < 0 || s >= S.value.length) {
388
392
  console.warn("Index out of bounds");
389
393
  return;
390
394
  }
391
- D.value = s;
392
- const l = S.value[s];
393
- l && (k.value = Ce(l, g.value), r("snapped", S.value.indexOf(l)));
395
+ R.value = s;
396
+ const r = S.value[s];
397
+ r && (x.value = xe(r, m.value), l("snapped", S.value.indexOf(r)));
394
398
  }, {
395
- isDragging: Le,
399
+ isDragging: Be,
396
400
  handleSheetScroll: le,
397
401
  handlePointerDown: se,
398
- handleContentPointerDown: ie,
402
+ handleContentPointerDown: ue,
399
403
  handlePointerMove: q,
400
- handleContentPointerMove: ue,
404
+ handleContentPointerMove: ie,
401
405
  handleLostPointerCapture: Z,
402
406
  handleTouchStart: ce
403
- } = ot({
404
- sheetHeaderRef: f,
407
+ } = lt({
408
+ sheetHeaderRef: v,
405
409
  sheetFooterRef: d,
406
- sheetContentRef: m,
410
+ sheetContentRef: p,
407
411
  sheetScrollRef: h,
408
- height: k,
409
- translateY: a,
412
+ height: x,
413
+ translateY: n,
410
414
  minSnapPoint: W,
411
- maxSnapPoint: Ee,
412
- closestSnapPointIndex: xe,
413
- flattenedSnapPoints: z,
414
- canSwipeClose: ye,
415
- expandOnContentDrag: He,
415
+ maxSnapPoint: Ye,
416
+ closestSnapPointIndex: Ee,
417
+ flattenedSnapPoints: N,
418
+ canSwipeClose: De,
419
+ expandOnContentDrag: Re,
416
420
  swipeCloseThreshold: Me,
417
- onClose: B,
421
+ onClose: L,
418
422
  onSnapToPoint: J,
419
- onDraggingUp: () => r("dragging-up"),
420
- onDraggingDown: () => r("dragging-down")
421
- }), Ie = Xe((s) => J(s), {
422
- minQuietPeriodMs: n.duration,
423
- reducer: (s, l) => l
423
+ onDraggingUp: () => l("dragging-up"),
424
+ onDraggingDown: () => l("dragging-down")
425
+ }), Le = Je((s) => J(s), {
426
+ minQuietPeriodMs: a.duration,
427
+ reducer: (s, r) => r
424
428
  });
425
- A(S, (s, l) => {
426
- if (i.value === !1 || !s || !l) return;
427
- const c = s[D.value], K = l[D.value];
428
- !c || typeof c == "string" || !K || typeof K == "string" || (k.value = E(c, { max: g.value }));
429
- }), A(g, () => {
430
- Ie.call(D.value);
431
- }), A(N, (s) => {
432
- r("instinctHeight", s);
433
- }), Fe(() => {
429
+ A(S, (s, r) => {
430
+ if (u.value === !1 || !s || !r) return;
431
+ const c = s[R.value], K = r[R.value];
432
+ !c || typeof c == "string" || !K || typeof K == "string" || (x.value = T(c, { max: m.value }));
433
+ }), A(m, () => {
434
+ Le.call(R.value);
435
+ }), A(z, (s) => {
436
+ l("instinctHeight", s);
437
+ }), Ve(() => {
434
438
  re?.(), G.cleanup();
435
439
  });
436
- const Re = (s) => {
437
- const l = s;
438
- l.style.transition = `transform ${n.duration}ms ease, height ${n.duration}ms ease`, l.style.transform = `translateY(${p.value}px)`;
440
+ const Oe = (s) => {
441
+ const r = s;
442
+ r.style.transition = `transform ${a.duration}ms ease, height ${a.duration}ms ease`, r.style.transform = `translateY(${g.value}px)`;
439
443
  };
440
- return t({ open: j, close: B, snapToPoint: J }), (s, l) => ($(), ee($e, null, [
444
+ return t({ open: j, close: L, snapToPoint: J }), (s, r) => ($(), ee(ze, null, [
441
445
  ($(), fe(ve, {
442
446
  to: e.teleportTo,
443
447
  defer: e.teleportDefer
@@ -445,13 +449,15 @@ const it = ["data-vsbs-shadow", "data-vsbs-sheet-show"], ut = /* @__PURE__ */ Be
445
449
  V("div", null, [
446
450
  he(ge, { name: "vsbs-backdrop" }, {
447
451
  default: me(() => [
448
- v(i) && e.blocking ? ($(), ee("div", {
452
+ e.forceMount || f(u) && e.blocking ? pe(($(), ee("div", {
449
453
  key: 0,
450
454
  ref_key: "backdrop",
451
455
  ref: P,
452
456
  "data-vsbs-backdrop": "",
453
- onClick: l[0] || (l[0] = (c) => Ye())
454
- }, null, 512)) : pe("", !0)
457
+ onClick: r[0] || (r[0] = (c) => Ie())
458
+ }, null, 512)), [
459
+ [Se, f(u) && e.blocking]
460
+ ]) : be("", !0)
455
461
  ]),
456
462
  _: 1
457
463
  })
@@ -463,38 +469,38 @@ const it = ["data-vsbs-shadow", "data-vsbs-sheet-show"], ut = /* @__PURE__ */ Be
463
469
  }, [
464
470
  he(ge, {
465
471
  name: "vsbs-sheet",
466
- onLeave: Re
472
+ onLeave: Oe
467
473
  }, {
468
474
  default: me(() => [
469
- v(i) ? ($(), ee("div", {
475
+ e.forceMount || f(u) ? pe(($(), ee("div", {
470
476
  key: 0,
471
477
  ref_key: "sheet",
472
- ref: u,
473
- style: Ve({
474
- transform: `translateY(${a.value}px)`,
475
- height: `${p.value}px`,
478
+ ref: i,
479
+ style: Ne({
480
+ transform: `translateY(${n.value}px)`,
481
+ height: `${g.value}px`,
476
482
  paddingBottom: `${C.value}px`,
477
- transition: v(Le) ? "none" : `transform ${e.duration}ms ease, height ${e.duration}ms ease`
483
+ transition: f(Be) ? "none" : `transform ${e.duration}ms ease, height ${e.duration}ms ease`
478
484
  }),
479
485
  "data-vsbs-shadow": !e.blocking,
480
- "data-vsbs-sheet-show": v(i),
486
+ "data-vsbs-sheet-show": f(u),
481
487
  "aria-modal": "true",
482
488
  "data-vsbs-sheet": "",
483
489
  tabindex: "-1",
484
- onTouchstart: l[12] || (l[12] = //@ts-ignore
485
- (...c) => v(L).touchStartHandler && v(L).touchStartHandler(...c)),
486
- onTouchend: l[13] || (l[13] = //@ts-ignore
487
- (...c) => v(L).touchEndHandler && v(L).touchEndHandler(...c))
490
+ onTouchstart: r[12] || (r[12] = //@ts-ignore
491
+ (...c) => f(I).touchStartHandler && f(I).touchStartHandler(...c)),
492
+ onTouchend: r[13] || (r[13] = //@ts-ignore
493
+ (...c) => f(I).touchEndHandler && f(I).touchEndHandler(...c))
488
494
  }, [
489
495
  V("div", {
490
496
  ref_key: "sheetHeader",
491
- ref: f,
497
+ ref: v,
492
498
  "data-vsbs-header": "",
493
499
  class: te(e.headerClass),
494
- onPointerdown: l[1] || (l[1] = (c) => v(se)(c, "header")),
495
- onPointermove: l[2] || (l[2] = //@ts-ignore
496
- (...c) => v(q) && v(q)(...c)),
497
- onLostpointercapture: l[3] || (l[3] = (c) => v(Z)(c, "header"))
500
+ onPointerdown: r[1] || (r[1] = (c) => f(se)(c, "header")),
501
+ onPointermove: r[2] || (r[2] = //@ts-ignore
502
+ (...c) => f(q) && f(q)(...c)),
503
+ onLostpointercapture: r[3] || (r[3] = (c) => f(Z)(c, "header"))
498
504
  }, [
499
505
  ne(s.$slots, "header", {}, void 0, !0)
500
506
  ], 34),
@@ -502,19 +508,19 @@ const it = ["data-vsbs-shadow", "data-vsbs-sheet-show"], ut = /* @__PURE__ */ Be
502
508
  ref_key: "sheetScroll",
503
509
  ref: h,
504
510
  "data-vsbs-scroll": "",
505
- onTouchstart: l[4] || (l[4] = //@ts-ignore
506
- (...c) => v(ce) && v(ce)(...c)),
507
- onTouchmove: l[5] || (l[5] = //@ts-ignore
508
- (...c) => v(le) && v(le)(...c)),
509
- onPointerdown: l[6] || (l[6] = //@ts-ignore
510
- (...c) => v(ie) && v(ie)(...c)),
511
- onPointermove: l[7] || (l[7] = //@ts-ignore
512
- (...c) => v(ue) && v(ue)(...c)),
513
- onLostpointercapture: l[8] || (l[8] = (c) => v(Z)(c, "content"))
511
+ onTouchstart: r[4] || (r[4] = //@ts-ignore
512
+ (...c) => f(ce) && f(ce)(...c)),
513
+ onTouchmove: r[5] || (r[5] = //@ts-ignore
514
+ (...c) => f(le) && f(le)(...c)),
515
+ onPointerdown: r[6] || (r[6] = //@ts-ignore
516
+ (...c) => f(ue) && f(ue)(...c)),
517
+ onPointermove: r[7] || (r[7] = //@ts-ignore
518
+ (...c) => f(ie) && f(ie)(...c)),
519
+ onLostpointercapture: r[8] || (r[8] = (c) => f(Z)(c, "content"))
514
520
  }, [
515
521
  V("div", {
516
522
  ref_key: "sheetContent",
517
- ref: m,
523
+ ref: p,
518
524
  "data-vsbs-content": "",
519
525
  class: te(e.contentClass)
520
526
  }, [
@@ -526,26 +532,28 @@ const it = ["data-vsbs-shadow", "data-vsbs-sheet-show"], ut = /* @__PURE__ */ Be
526
532
  ref: d,
527
533
  "data-vsbs-footer": "",
528
534
  class: te(e.footerClass),
529
- onPointerdown: l[9] || (l[9] = (c) => v(se)(c, "footer")),
530
- onPointermove: l[10] || (l[10] = //@ts-ignore
531
- (...c) => v(q) && v(q)(...c)),
532
- onLostpointercapture: l[11] || (l[11] = (c) => v(Z)(c, "footer"))
535
+ onPointerdown: r[9] || (r[9] = (c) => f(se)(c, "footer")),
536
+ onPointermove: r[10] || (r[10] = //@ts-ignore
537
+ (...c) => f(q) && f(q)(...c)),
538
+ onLostpointercapture: r[11] || (r[11] = (c) => f(Z)(c, "footer"))
533
539
  }, [
534
540
  ne(s.$slots, "footer", {}, void 0, !0)
535
541
  ], 34)
536
- ], 44, it)) : pe("", !0)
542
+ ], 44, ct)), [
543
+ [Se, f(u)]
544
+ ]) : be("", !0)
537
545
  ]),
538
546
  _: 3
539
547
  })
540
548
  ], 8, ["to", "defer"]))
541
549
  ], 64));
542
550
  }
543
- }), ct = (e, t) => {
551
+ }), ft = (e, t) => {
544
552
  const o = e.__vccOpts || e;
545
- for (const [n, r] of t)
546
- o[n] = r;
553
+ for (const [a, l] of t)
554
+ o[a] = l;
547
555
  return o;
548
- }, ht = /* @__PURE__ */ ct(ut, [["__scopeId", "data-v-efbe17f6"]]);
556
+ }, mt = /* @__PURE__ */ ft(dt, [["__scopeId", "data-v-1fe5991a"]]);
549
557
  export {
550
- ht as default
558
+ mt as default
551
559
  };
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- [data-vsbs-backdrop][data-v-efbe17f6]{background-color:var(--vsbs-backdrop-bg, rgba(0, 0, 0, .5));inset:0;pointer-events:auto;position:fixed;-webkit-user-select:none;user-select:none;will-change:opacity;--vsbs-duration: var(--v7643c7ff)}[data-vsbs-shadow=true][data-v-efbe17f6]:before{content:"";z-index:-1;position:absolute;top:0;height:100lvh;width:100%;border-radius:var(--vsbs-border-radius, 16px);box-shadow:0 -5px 60px 0 var(--vsbs-shadow-color, rgba(89, 89, 89, .2))}[data-vsbs-sheet][data-v-efbe17f6]{background-color:var(--vsbs-background, #fff);box-sizing:border-box;border-top-left-radius:var(--vsbs-border-radius, 16px);border-top-right-radius:var(--vsbs-border-radius, 16px);border-right:1px solid var(--vsbs-outer-border-color, transparent);border-left:1px solid var(--vsbs-outer-border-color, transparent);bottom:0;display:flex;flex-direction:column;left:0;margin-left:auto;margin-right:auto;max-width:var(--vsbs-max-width, 640px);pointer-events:all;position:fixed;right:0;width:100%;will-change:height,transform}[data-vsbs-sheet-show=true][data-v-efbe17f6]{visibility:visible}[data-vsbs-header][data-v-efbe17f6]{touch-action:none;box-shadow:0 1px 0 var(--vsbs-border-color, rgba(46, 59, 66, .125));flex-shrink:0;padding:20px var(--vsbs-padding-x, 16px) 8px;-webkit-user-select:none;user-select:none;z-index:3;border-top-left-radius:var(--vsbs-border-radius, 16px);border-top-right-radius:var(--vsbs-border-radius, 16px);border-top:1px solid var(--vsbs-outer-border-color, transparent)}[data-vsbs-header][data-v-efbe17f6]:before{background-color:var(--vsbs-handle-background, rgba(0, 0, 0, .28));border-radius:2px;content:"";display:block;height:4px;left:50%;position:absolute;top:8px;transform:translate(-50%);width:36px}[data-vsbs-header][data-v-efbe17f6]:empty{box-shadow:none;padding:14px var(--vsbs-padding-x, 16px) 10px}[data-vsbs-footer][data-v-efbe17f6]{touch-action:none;box-shadow:0 -1px 0 var(--vsbs-border-color, rgba(46, 59, 66, .125));flex-grow:0;flex-shrink:0;padding:16px var(--vsbs-padding-x, 16px);-webkit-user-select:none;user-select:none}[data-vsbs-footer][data-v-efbe17f6]:empty{display:none}[data-vsbs-scroll][data-v-efbe17f6]{flex-grow:1;overflow-y:auto;overscroll-behavior:none}[data-vsbs-content][data-v-efbe17f6]{display:grid;padding:8px var(--vsbs-padding-x, 16px);-webkit-user-select:none;user-select:none}.vsbs-backdrop-enter-active[data-v-efbe17f6],.vsbs-backdrop-leave-active[data-v-efbe17f6]{transition:opacity var(--vsbs-duration) ease}.vsbs-backdrop-enter-from[data-v-efbe17f6],.vsbs-backdrop-leave-to[data-v-efbe17f6]{opacity:0}
1
+ [data-vsbs-backdrop][data-v-1fe5991a]{background-color:var(--vsbs-backdrop-bg, rgba(0, 0, 0, .5));inset:0;pointer-events:auto;position:fixed;-webkit-user-select:none;user-select:none;will-change:opacity;--vsbs-duration: var(--v5acd7ef8)}[data-vsbs-shadow=true][data-v-1fe5991a]:before{content:"";z-index:-1;position:absolute;top:0;height:100lvh;width:100%;border-radius:var(--vsbs-border-radius, 16px);box-shadow:0 -5px 60px 0 var(--vsbs-shadow-color, rgba(89, 89, 89, .2))}[data-vsbs-sheet][data-v-1fe5991a]{background-color:var(--vsbs-background, #fff);box-sizing:border-box;border-top-left-radius:var(--vsbs-border-radius, 16px);border-top-right-radius:var(--vsbs-border-radius, 16px);border-right:1px solid var(--vsbs-outer-border-color, transparent);border-left:1px solid var(--vsbs-outer-border-color, transparent);bottom:0;display:flex;flex-direction:column;left:0;margin-left:auto;margin-right:auto;max-width:var(--vsbs-max-width, 640px);pointer-events:all;position:fixed;right:0;width:100%;will-change:height,transform}[data-vsbs-sheet-show=true][data-v-1fe5991a]{visibility:visible}[data-vsbs-header][data-v-1fe5991a]{touch-action:none;box-shadow:0 1px 0 var(--vsbs-border-color, rgba(46, 59, 66, .125));flex-shrink:0;padding:20px var(--vsbs-padding-x, 16px) 8px;-webkit-user-select:none;user-select:none;z-index:3;border-top-left-radius:var(--vsbs-border-radius, 16px);border-top-right-radius:var(--vsbs-border-radius, 16px);border-top:1px solid var(--vsbs-outer-border-color, transparent)}[data-vsbs-header][data-v-1fe5991a]:before{background-color:var(--vsbs-handle-background, rgba(0, 0, 0, .28));border-radius:2px;content:"";display:block;height:4px;left:50%;position:absolute;top:8px;transform:translate(-50%);width:36px}[data-vsbs-header][data-v-1fe5991a]:empty{box-shadow:none;padding:14px var(--vsbs-padding-x, 16px) 10px}[data-vsbs-footer][data-v-1fe5991a]{touch-action:none;box-shadow:0 -1px 0 var(--vsbs-border-color, rgba(46, 59, 66, .125));flex-grow:0;flex-shrink:0;padding:16px var(--vsbs-padding-x, 16px);-webkit-user-select:none;user-select:none}[data-vsbs-footer][data-v-1fe5991a]:empty{display:none}[data-vsbs-scroll][data-v-1fe5991a]{flex-grow:1;overflow-y:auto;overscroll-behavior:none}[data-vsbs-content][data-v-1fe5991a]{display:grid;padding:8px var(--vsbs-padding-x, 16px);-webkit-user-select:none;user-select:none}.vsbs-backdrop-enter-active[data-v-1fe5991a],.vsbs-backdrop-leave-active[data-v-1fe5991a]{transition:opacity var(--vsbs-duration) ease}.vsbs-backdrop-enter-from[data-v-1fe5991a],.vsbs-backdrop-leave-to[data-v-1fe5991a]{opacity:0}
package/dist/types.d.ts CHANGED
@@ -4,6 +4,7 @@ export interface BottomSheetProps {
4
4
  snapPoints?: Array<number | `${number}%`>;
5
5
  initialSnapPoint?: number;
6
6
  blocking?: boolean;
7
+ forceMount?: boolean;
7
8
  canSwipeClose?: boolean;
8
9
  swipeCloseThreshold?: string | number;
9
10
  canBackdropClose?: boolean;
package/package.json CHANGED
@@ -30,7 +30,7 @@
30
30
  "url": "https://github.com/megaarmos/vue-spring-bottom-sheet/issues"
31
31
  },
32
32
  "private": false,
33
- "version": "3.1.0",
33
+ "version": "3.2.0",
34
34
  "type": "module",
35
35
  "exports": {
36
36
  ".": {