@surdeddd/bottom-sheet 0.20.1 → 0.21.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.
Files changed (61) hide show
  1. package/README.md +1 -1
  2. package/dist/{BottomSheetCore-Cgn8b_6A.d.ts → BottomSheetCore-CIijwtdi.d.ts} +1 -0
  3. package/dist/{BottomSheetCore-VPJZcKcg.d.cts → BottomSheetCore-CK8Rh1He.d.cts} +1 -0
  4. package/dist/{BottomSheetEngine-DwYR_ygJ.d.ts → BottomSheetEngine-CZglPsTF.d.ts} +1 -1
  5. package/dist/{BottomSheetEngine-B8C2CwF9.d.cts → BottomSheetEngine-hLSAxzla.d.cts} +1 -1
  6. package/dist/core.cjs +22 -14
  7. package/dist/core.d.cts +2 -2
  8. package/dist/core.d.ts +2 -2
  9. package/dist/core.js +22 -14
  10. package/dist/debug.d.cts +1 -1
  11. package/dist/debug.d.ts +1 -1
  12. package/dist/element.cjs +26 -14
  13. package/dist/element.d.cts +2 -2
  14. package/dist/element.d.ts +2 -2
  15. package/dist/element.iife.global.js +2 -2
  16. package/dist/element.js +26 -14
  17. package/dist/features.d.cts +2 -2
  18. package/dist/features.d.ts +2 -2
  19. package/dist/{index-CnfbOKx0.d.cts → index-BEX-NHRJ.d.cts} +1 -1
  20. package/dist/{index-DcMkhXAy.d.ts → index-BqLHKOeM.d.ts} +1 -1
  21. package/dist/index.cjs +22 -14
  22. package/dist/index.d.cts +4 -4
  23. package/dist/index.d.ts +4 -4
  24. package/dist/index.js +22 -14
  25. package/dist/integrations/formik.d.cts +1 -1
  26. package/dist/integrations/formik.d.ts +1 -1
  27. package/dist/integrations/react-hook-form.d.cts +1 -1
  28. package/dist/integrations/react-hook-form.d.ts +1 -1
  29. package/dist/preact.d.cts +2 -2
  30. package/dist/preact.d.ts +2 -2
  31. package/dist/qwik-lib/index.qwik.cjs +28 -11
  32. package/dist/qwik-lib/index.qwik.mjs +28 -11
  33. package/dist/qwik.cjs +28 -14
  34. package/dist/qwik.d.cts +2 -2
  35. package/dist/qwik.d.ts +2 -2
  36. package/dist/qwik.js +28 -14
  37. package/dist/react.cjs +27 -14
  38. package/dist/react.d.cts +3 -3
  39. package/dist/react.d.ts +3 -3
  40. package/dist/react.js +27 -14
  41. package/dist/solid.cjs +28 -14
  42. package/dist/solid.d.cts +1 -0
  43. package/dist/solid.d.ts +1 -0
  44. package/dist/solid.js +28 -14
  45. package/dist/solid.source.jsx +32 -14
  46. package/dist/styles.d.ts +1 -0
  47. package/dist/svelte-core.cjs +22 -14
  48. package/dist/svelte-core.js +22 -14
  49. package/dist/svelte-src/BottomSheet.svelte +3 -0
  50. package/dist/svelte.cjs +25 -14
  51. package/dist/svelte.js +25 -14
  52. package/dist/themes/ios.d.ts +1 -0
  53. package/dist/themes/material.d.ts +1 -0
  54. package/dist/themes/vercel.d.ts +1 -0
  55. package/dist/vue.cjs +27 -15
  56. package/dist/vue.d.cts +6 -1
  57. package/dist/vue.d.ts +6 -1
  58. package/dist/vue.js +27 -15
  59. package/dist/webgl.d.cts +1 -1
  60. package/dist/webgl.d.ts +1 -1
  61. package/package.json +36 -12
@@ -838,13 +838,11 @@ var ScrimController = class {
838
838
  if (!progressChanged && this.backdropOpacitySentinel.value !== -1 && this.screenOpacitySentinel.value !== -1) {
839
839
  return;
840
840
  }
841
- if (this.backdrop && this.isTopSheet()) {
841
+ if (this.backdrop) {
842
842
  const [s, e] = this.backdropRange;
843
843
  const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
844
- const backdropOpacity = Math.min(
845
- Math.max((progress - s) / range, 0),
846
- 1
847
- );
844
+ const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
845
+ const backdropOpacity = this.isTopSheet() ? ramp : 0;
848
846
  if (this.backdropOpacitySentinel.shouldWrite(
849
847
  backdropOpacity,
850
848
  OPACITY_WRITE_EPSILON
@@ -1384,18 +1382,20 @@ var AnimationRunner = class {
1384
1382
  get isAnimating() {
1385
1383
  return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
1386
1384
  }
1385
+ cancelWaapi() {
1386
+ if (!this.currentWaapi) return;
1387
+ const entry = this.currentWaapi;
1388
+ this.currentWaapi = null;
1389
+ entry.stop();
1390
+ try {
1391
+ entry.anim.cancel();
1392
+ } catch {
1393
+ }
1394
+ }
1387
1395
  cancel() {
1388
1396
  this.currentTween?.cancel();
1389
1397
  this.currentSpring?.cancel();
1390
- if (this.currentWaapi) {
1391
- const entry = this.currentWaapi;
1392
- this.currentWaapi = null;
1393
- entry.stop();
1394
- try {
1395
- entry.anim.cancel();
1396
- } catch {
1397
- }
1398
- }
1398
+ this.cancelWaapi();
1399
1399
  }
1400
1400
  async animateTo(target, velocityPxPerMs) {
1401
1401
  if (target === this.getSize()) {
@@ -1406,6 +1406,7 @@ var AnimationRunner = class {
1406
1406
  }
1407
1407
  this.currentTween?.cancel();
1408
1408
  this.currentSpring?.cancel();
1409
+ this.cancelWaapi();
1409
1410
  this.getRootEl()?.setAttribute("data-animating", "true");
1410
1411
  this.element.style.willChange = "transform";
1411
1412
  if (this.reducedMotion) {
@@ -3398,12 +3399,19 @@ var BottomSheetCore = class {
3398
3399
  for (const anchor of this.anchors) anchor.syncZ(z + 1);
3399
3400
  },
3400
3401
  setIsTop: (isTop) => {
3402
+ if (this.isTopSheet === isTop) return;
3401
3403
  this.isTopSheet = isTop;
3404
+ this.repaintScrim();
3402
3405
  },
3403
3406
  isOpen: () => this.size > 0 || this.opening,
3404
3407
  setDepth: (depth) => this.applyStackDepth(depth)
3405
3408
  }));
3406
3409
  }
3410
+ repaintScrim() {
3411
+ if (this.destroyed) return;
3412
+ this.scrim.invalidateOpacityCache();
3413
+ this.scrim.applyOpacity(this.computeProgress(this.size), true);
3414
+ }
3407
3415
  applyStackDepth(depth) {
3408
3416
  if (!this.stackEffectEnabled) return;
3409
3417
  this.element.setAttribute("data-stack-depth", String(depth));
@@ -286,6 +286,9 @@
286
286
  $effect(() => {
287
287
  if (dragFrom !== undefined) engine?.setDragFrom(dragFrom);
288
288
  });
289
+ $effect(() => {
290
+ if (mode !== undefined) engine?.setMode(mode);
291
+ });
289
292
  $effect(() => {
290
293
  if (radius !== undefined) engine?.setRadius(radius);
291
294
  });
package/dist/svelte.cjs CHANGED
@@ -862,13 +862,11 @@ var ScrimController = class {
862
862
  if (!progressChanged && this.backdropOpacitySentinel.value !== -1 && this.screenOpacitySentinel.value !== -1) {
863
863
  return;
864
864
  }
865
- if (this.backdrop && this.isTopSheet()) {
865
+ if (this.backdrop) {
866
866
  const [s, e] = this.backdropRange;
867
867
  const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
868
- const backdropOpacity = Math.min(
869
- Math.max((progress - s) / range, 0),
870
- 1
871
- );
868
+ const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
869
+ const backdropOpacity = this.isTopSheet() ? ramp : 0;
872
870
  if (this.backdropOpacitySentinel.shouldWrite(
873
871
  backdropOpacity,
874
872
  OPACITY_WRITE_EPSILON
@@ -1408,18 +1406,20 @@ var AnimationRunner = class {
1408
1406
  get isAnimating() {
1409
1407
  return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
1410
1408
  }
1409
+ cancelWaapi() {
1410
+ if (!this.currentWaapi) return;
1411
+ const entry = this.currentWaapi;
1412
+ this.currentWaapi = null;
1413
+ entry.stop();
1414
+ try {
1415
+ entry.anim.cancel();
1416
+ } catch {
1417
+ }
1418
+ }
1411
1419
  cancel() {
1412
1420
  this.currentTween?.cancel();
1413
1421
  this.currentSpring?.cancel();
1414
- if (this.currentWaapi) {
1415
- const entry = this.currentWaapi;
1416
- this.currentWaapi = null;
1417
- entry.stop();
1418
- try {
1419
- entry.anim.cancel();
1420
- } catch {
1421
- }
1422
- }
1422
+ this.cancelWaapi();
1423
1423
  }
1424
1424
  async animateTo(target, velocityPxPerMs) {
1425
1425
  if (target === this.getSize()) {
@@ -1430,6 +1430,7 @@ var AnimationRunner = class {
1430
1430
  }
1431
1431
  this.currentTween?.cancel();
1432
1432
  this.currentSpring?.cancel();
1433
+ this.cancelWaapi();
1433
1434
  this.getRootEl()?.setAttribute("data-animating", "true");
1434
1435
  this.element.style.willChange = "transform";
1435
1436
  if (this.reducedMotion) {
@@ -3422,12 +3423,19 @@ var BottomSheetCore = class {
3422
3423
  for (const anchor of this.anchors) anchor.syncZ(z + 1);
3423
3424
  },
3424
3425
  setIsTop: (isTop) => {
3426
+ if (this.isTopSheet === isTop) return;
3425
3427
  this.isTopSheet = isTop;
3428
+ this.repaintScrim();
3426
3429
  },
3427
3430
  isOpen: () => this.size > 0 || this.opening,
3428
3431
  setDepth: (depth) => this.applyStackDepth(depth)
3429
3432
  }));
3430
3433
  }
3434
+ repaintScrim() {
3435
+ if (this.destroyed) return;
3436
+ this.scrim.invalidateOpacityCache();
3437
+ this.scrim.applyOpacity(this.computeProgress(this.size), true);
3438
+ }
3431
3439
  applyStackDepth(depth) {
3432
3440
  if (!this.stackEffectEnabled) return;
3433
3441
  this.element.setAttribute("data-stack-depth", String(depth));
@@ -4520,6 +4528,9 @@ function BottomSheet($$anchor, $$props) {
4520
4528
  $2__namespace.user_effect(() => {
4521
4529
  if ($$props.dragFrom !== void 0) engine?.setDragFrom($$props.dragFrom);
4522
4530
  });
4531
+ $2__namespace.user_effect(() => {
4532
+ if (mode() !== void 0) engine?.setMode(mode());
4533
+ });
4523
4534
  $2__namespace.user_effect(() => {
4524
4535
  if ($$props.radius !== void 0) engine?.setRadius($$props.radius);
4525
4536
  });
package/dist/svelte.js CHANGED
@@ -840,13 +840,11 @@ var ScrimController = class {
840
840
  if (!progressChanged && this.backdropOpacitySentinel.value !== -1 && this.screenOpacitySentinel.value !== -1) {
841
841
  return;
842
842
  }
843
- if (this.backdrop && this.isTopSheet()) {
843
+ if (this.backdrop) {
844
844
  const [s, e] = this.backdropRange;
845
845
  const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
846
- const backdropOpacity = Math.min(
847
- Math.max((progress - s) / range, 0),
848
- 1
849
- );
846
+ const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
847
+ const backdropOpacity = this.isTopSheet() ? ramp : 0;
850
848
  if (this.backdropOpacitySentinel.shouldWrite(
851
849
  backdropOpacity,
852
850
  OPACITY_WRITE_EPSILON
@@ -1386,18 +1384,20 @@ var AnimationRunner = class {
1386
1384
  get isAnimating() {
1387
1385
  return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
1388
1386
  }
1387
+ cancelWaapi() {
1388
+ if (!this.currentWaapi) return;
1389
+ const entry = this.currentWaapi;
1390
+ this.currentWaapi = null;
1391
+ entry.stop();
1392
+ try {
1393
+ entry.anim.cancel();
1394
+ } catch {
1395
+ }
1396
+ }
1389
1397
  cancel() {
1390
1398
  this.currentTween?.cancel();
1391
1399
  this.currentSpring?.cancel();
1392
- if (this.currentWaapi) {
1393
- const entry = this.currentWaapi;
1394
- this.currentWaapi = null;
1395
- entry.stop();
1396
- try {
1397
- entry.anim.cancel();
1398
- } catch {
1399
- }
1400
- }
1400
+ this.cancelWaapi();
1401
1401
  }
1402
1402
  async animateTo(target, velocityPxPerMs) {
1403
1403
  if (target === this.getSize()) {
@@ -1408,6 +1408,7 @@ var AnimationRunner = class {
1408
1408
  }
1409
1409
  this.currentTween?.cancel();
1410
1410
  this.currentSpring?.cancel();
1411
+ this.cancelWaapi();
1411
1412
  this.getRootEl()?.setAttribute("data-animating", "true");
1412
1413
  this.element.style.willChange = "transform";
1413
1414
  if (this.reducedMotion) {
@@ -3400,12 +3401,19 @@ var BottomSheetCore = class {
3400
3401
  for (const anchor of this.anchors) anchor.syncZ(z + 1);
3401
3402
  },
3402
3403
  setIsTop: (isTop) => {
3404
+ if (this.isTopSheet === isTop) return;
3403
3405
  this.isTopSheet = isTop;
3406
+ this.repaintScrim();
3404
3407
  },
3405
3408
  isOpen: () => this.size > 0 || this.opening,
3406
3409
  setDepth: (depth) => this.applyStackDepth(depth)
3407
3410
  }));
3408
3411
  }
3412
+ repaintScrim() {
3413
+ if (this.destroyed) return;
3414
+ this.scrim.invalidateOpacityCache();
3415
+ this.scrim.applyOpacity(this.computeProgress(this.size), true);
3416
+ }
3409
3417
  applyStackDepth(depth) {
3410
3418
  if (!this.stackEffectEnabled) return;
3411
3419
  this.element.setAttribute("data-stack-depth", String(depth));
@@ -4498,6 +4506,9 @@ function BottomSheet($$anchor, $$props) {
4498
4506
  $2.user_effect(() => {
4499
4507
  if ($$props.dragFrom !== void 0) engine?.setDragFrom($$props.dragFrom);
4500
4508
  });
4509
+ $2.user_effect(() => {
4510
+ if (mode() !== void 0) engine?.setMode(mode());
4511
+ });
4501
4512
  $2.user_effect(() => {
4502
4513
  if ($$props.radius !== void 0) engine?.setRadius($$props.radius);
4503
4514
  });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/dist/vue.cjs CHANGED
@@ -840,13 +840,11 @@ var ScrimController = class {
840
840
  if (!progressChanged && this.backdropOpacitySentinel.value !== -1 && this.screenOpacitySentinel.value !== -1) {
841
841
  return;
842
842
  }
843
- if (this.backdrop && this.isTopSheet()) {
843
+ if (this.backdrop) {
844
844
  const [s, e] = this.backdropRange;
845
845
  const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
846
- const backdropOpacity = Math.min(
847
- Math.max((progress - s) / range, 0),
848
- 1
849
- );
846
+ const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
847
+ const backdropOpacity = this.isTopSheet() ? ramp : 0;
850
848
  if (this.backdropOpacitySentinel.shouldWrite(
851
849
  backdropOpacity,
852
850
  OPACITY_WRITE_EPSILON
@@ -1386,18 +1384,20 @@ var AnimationRunner = class {
1386
1384
  get isAnimating() {
1387
1385
  return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
1388
1386
  }
1387
+ cancelWaapi() {
1388
+ if (!this.currentWaapi) return;
1389
+ const entry = this.currentWaapi;
1390
+ this.currentWaapi = null;
1391
+ entry.stop();
1392
+ try {
1393
+ entry.anim.cancel();
1394
+ } catch {
1395
+ }
1396
+ }
1389
1397
  cancel() {
1390
1398
  this.currentTween?.cancel();
1391
1399
  this.currentSpring?.cancel();
1392
- if (this.currentWaapi) {
1393
- const entry = this.currentWaapi;
1394
- this.currentWaapi = null;
1395
- entry.stop();
1396
- try {
1397
- entry.anim.cancel();
1398
- } catch {
1399
- }
1400
- }
1400
+ this.cancelWaapi();
1401
1401
  }
1402
1402
  async animateTo(target, velocityPxPerMs) {
1403
1403
  if (target === this.getSize()) {
@@ -1408,6 +1408,7 @@ var AnimationRunner = class {
1408
1408
  }
1409
1409
  this.currentTween?.cancel();
1410
1410
  this.currentSpring?.cancel();
1411
+ this.cancelWaapi();
1411
1412
  this.getRootEl()?.setAttribute("data-animating", "true");
1412
1413
  this.element.style.willChange = "transform";
1413
1414
  if (this.reducedMotion) {
@@ -3400,12 +3401,19 @@ var BottomSheetCore = class {
3400
3401
  for (const anchor of this.anchors) anchor.syncZ(z + 1);
3401
3402
  },
3402
3403
  setIsTop: (isTop) => {
3404
+ if (this.isTopSheet === isTop) return;
3403
3405
  this.isTopSheet = isTop;
3406
+ this.repaintScrim();
3404
3407
  },
3405
3408
  isOpen: () => this.size > 0 || this.opening,
3406
3409
  setDepth: (depth) => this.applyStackDepth(depth)
3407
3410
  }));
3408
3411
  }
3412
+ repaintScrim() {
3413
+ if (this.destroyed) return;
3414
+ this.scrim.invalidateOpacityCache();
3415
+ this.scrim.applyOpacity(this.computeProgress(this.size), true);
3416
+ }
3409
3417
  applyStackDepth(depth) {
3410
3418
  if (!this.stackEffectEnabled) return;
3411
3419
  this.element.setAttribute("data-stack-depth", String(depth));
@@ -4738,6 +4746,10 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
4738
4746
  if (next === void 0) return;
4739
4747
  getEngine()?.setDragFrom(next);
4740
4748
  });
4749
+ vue.watch(() => props.mode, (next) => {
4750
+ if (next === void 0) return;
4751
+ getEngine()?.setMode(next);
4752
+ });
4741
4753
  const mounted = vue.ref(false);
4742
4754
  const anchorHosts = vue.shallowRef({});
4743
4755
  const anchorDetachers = vue.ref([]);
@@ -4996,7 +5008,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
4996
5008
  /* KEYED_FRAGMENT */
4997
5009
  ))], 8, ["to", "disabled"]);
4998
5010
  }
4999
- var BottomSheet_default = /* @__PURE__ */ export_helper_default(_sfc_main, [["render", _sfc_render], ["__file", "/Users/maksimkravcov/Projects/Personal/BottomSheet/src/vue/BottomSheet.vue"]]);
5011
+ var BottomSheet_default = /* @__PURE__ */ export_helper_default(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/BottomSheet/BottomSheet/src/vue/BottomSheet.vue"]]);
5000
5012
 
5001
5013
  exports.BottomSheet = BottomSheet_default;
5002
5014
  exports.useBottomSheet = useBottomSheet;
package/dist/vue.d.cts CHANGED
@@ -74,6 +74,11 @@ export function useBottomSheet<TId extends string = string>(
74
74
  opts: UseBottomSheetVueOptions<TId>,
75
75
  ): UseBottomSheetVueReturn<TId>;
76
76
 
77
+ export type BottomSheetInstance<TId extends string = string> = Omit<
78
+ UseBottomSheetVueReturn<TId>,
79
+ "sheetRef" | "handleRef" | "contentRef" | "backdropRef" | "screenRef"
80
+ >;
81
+
77
82
  export type VueAnchor<TId extends string = string> = Omit<
78
83
  AnchorOptions,
79
84
  "element"
@@ -96,7 +101,7 @@ export type BottomSheetProps<TId extends string = string> =
96
101
 
97
102
  export const BottomSheet: DefineComponent<
98
103
  BottomSheetProps,
99
- Record<string, never>,
104
+ BottomSheetInstance,
100
105
  Record<string, never>,
101
106
  Record<string, never>,
102
107
  Record<string, never>,
package/dist/vue.d.ts CHANGED
@@ -74,6 +74,11 @@ export function useBottomSheet<TId extends string = string>(
74
74
  opts: UseBottomSheetVueOptions<TId>,
75
75
  ): UseBottomSheetVueReturn<TId>;
76
76
 
77
+ export type BottomSheetInstance<TId extends string = string> = Omit<
78
+ UseBottomSheetVueReturn<TId>,
79
+ "sheetRef" | "handleRef" | "contentRef" | "backdropRef" | "screenRef"
80
+ >;
81
+
77
82
  export type VueAnchor<TId extends string = string> = Omit<
78
83
  AnchorOptions,
79
84
  "element"
@@ -96,7 +101,7 @@ export type BottomSheetProps<TId extends string = string> =
96
101
 
97
102
  export const BottomSheet: DefineComponent<
98
103
  BottomSheetProps,
99
- Record<string, never>,
104
+ BottomSheetInstance,
100
105
  Record<string, never>,
101
106
  Record<string, never>,
102
107
  Record<string, never>,
package/dist/vue.js CHANGED
@@ -838,13 +838,11 @@ var ScrimController = class {
838
838
  if (!progressChanged && this.backdropOpacitySentinel.value !== -1 && this.screenOpacitySentinel.value !== -1) {
839
839
  return;
840
840
  }
841
- if (this.backdrop && this.isTopSheet()) {
841
+ if (this.backdrop) {
842
842
  const [s, e] = this.backdropRange;
843
843
  const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
844
- const backdropOpacity = Math.min(
845
- Math.max((progress - s) / range, 0),
846
- 1
847
- );
844
+ const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
845
+ const backdropOpacity = this.isTopSheet() ? ramp : 0;
848
846
  if (this.backdropOpacitySentinel.shouldWrite(
849
847
  backdropOpacity,
850
848
  OPACITY_WRITE_EPSILON
@@ -1384,18 +1382,20 @@ var AnimationRunner = class {
1384
1382
  get isAnimating() {
1385
1383
  return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
1386
1384
  }
1385
+ cancelWaapi() {
1386
+ if (!this.currentWaapi) return;
1387
+ const entry = this.currentWaapi;
1388
+ this.currentWaapi = null;
1389
+ entry.stop();
1390
+ try {
1391
+ entry.anim.cancel();
1392
+ } catch {
1393
+ }
1394
+ }
1387
1395
  cancel() {
1388
1396
  this.currentTween?.cancel();
1389
1397
  this.currentSpring?.cancel();
1390
- if (this.currentWaapi) {
1391
- const entry = this.currentWaapi;
1392
- this.currentWaapi = null;
1393
- entry.stop();
1394
- try {
1395
- entry.anim.cancel();
1396
- } catch {
1397
- }
1398
- }
1398
+ this.cancelWaapi();
1399
1399
  }
1400
1400
  async animateTo(target, velocityPxPerMs) {
1401
1401
  if (target === this.getSize()) {
@@ -1406,6 +1406,7 @@ var AnimationRunner = class {
1406
1406
  }
1407
1407
  this.currentTween?.cancel();
1408
1408
  this.currentSpring?.cancel();
1409
+ this.cancelWaapi();
1409
1410
  this.getRootEl()?.setAttribute("data-animating", "true");
1410
1411
  this.element.style.willChange = "transform";
1411
1412
  if (this.reducedMotion) {
@@ -3398,12 +3399,19 @@ var BottomSheetCore = class {
3398
3399
  for (const anchor of this.anchors) anchor.syncZ(z + 1);
3399
3400
  },
3400
3401
  setIsTop: (isTop) => {
3402
+ if (this.isTopSheet === isTop) return;
3401
3403
  this.isTopSheet = isTop;
3404
+ this.repaintScrim();
3402
3405
  },
3403
3406
  isOpen: () => this.size > 0 || this.opening,
3404
3407
  setDepth: (depth) => this.applyStackDepth(depth)
3405
3408
  }));
3406
3409
  }
3410
+ repaintScrim() {
3411
+ if (this.destroyed) return;
3412
+ this.scrim.invalidateOpacityCache();
3413
+ this.scrim.applyOpacity(this.computeProgress(this.size), true);
3414
+ }
3407
3415
  applyStackDepth(depth) {
3408
3416
  if (!this.stackEffectEnabled) return;
3409
3417
  this.element.setAttribute("data-stack-depth", String(depth));
@@ -4736,6 +4744,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
4736
4744
  if (next === void 0) return;
4737
4745
  getEngine()?.setDragFrom(next);
4738
4746
  });
4747
+ watch(() => props.mode, (next) => {
4748
+ if (next === void 0) return;
4749
+ getEngine()?.setMode(next);
4750
+ });
4739
4751
  const mounted = ref(false);
4740
4752
  const anchorHosts = shallowRef({});
4741
4753
  const anchorDetachers = ref([]);
@@ -4994,7 +5006,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
4994
5006
  /* KEYED_FRAGMENT */
4995
5007
  ))], 8, ["to", "disabled"]);
4996
5008
  }
4997
- var BottomSheet_default = /* @__PURE__ */ export_helper_default(_sfc_main, [["render", _sfc_render], ["__file", "/Users/maksimkravcov/Projects/Personal/BottomSheet/src/vue/BottomSheet.vue"]]);
5009
+ var BottomSheet_default = /* @__PURE__ */ export_helper_default(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/BottomSheet/BottomSheet/src/vue/BottomSheet.vue"]]);
4998
5010
 
4999
5011
  export { BottomSheet_default as BottomSheet, useBottomSheet };
5000
5012
  //# sourceMappingURL=vue.js.map
package/dist/webgl.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { f as EngineFeature } from './BottomSheetCore-VPJZcKcg.cjs';
1
+ import { f as EngineFeature } from './BottomSheetCore-CK8Rh1He.cjs';
2
2
  import './transform-jVfAikE9.cjs';
3
3
 
4
4
  type WebGLRendererOptions = {
package/dist/webgl.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { f as EngineFeature } from './BottomSheetCore-Cgn8b_6A.js';
1
+ import { f as EngineFeature } from './BottomSheetCore-CIijwtdi.js';
2
2
  import './transform-jVfAikE9.js';
3
3
 
4
4
  type WebGLRendererOptions = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surdeddd/bottom-sheet",
3
- "version": "0.20.1",
3
+ "version": "0.21.0",
4
4
  "description": "Universal, headless bottom sheet — framework-agnostic core with React, Vue 3, Svelte, Solid, Qwik, Preact, Lit and Custom Element adapters. Pointer Events, snap points, momentum, a11y, SSR-safe.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -200,14 +200,38 @@
200
200
  }
201
201
  },
202
202
  "./package.json": "./package.json",
203
- "./styles": "./dist/styles.css",
204
- "./styles.css": "./dist/styles.css",
205
- "./themes/ios": "./dist/themes/ios.css",
206
- "./themes/ios.css": "./dist/themes/ios.css",
207
- "./themes/material": "./dist/themes/material.css",
208
- "./themes/material.css": "./dist/themes/material.css",
209
- "./themes/vercel": "./dist/themes/vercel.css",
210
- "./themes/vercel.css": "./dist/themes/vercel.css"
203
+ "./styles": {
204
+ "types": "./dist/styles.d.ts",
205
+ "default": "./dist/styles.css"
206
+ },
207
+ "./styles.css": {
208
+ "types": "./dist/styles.d.ts",
209
+ "default": "./dist/styles.css"
210
+ },
211
+ "./themes/ios": {
212
+ "types": "./dist/themes/ios.d.ts",
213
+ "default": "./dist/themes/ios.css"
214
+ },
215
+ "./themes/ios.css": {
216
+ "types": "./dist/themes/ios.d.ts",
217
+ "default": "./dist/themes/ios.css"
218
+ },
219
+ "./themes/material": {
220
+ "types": "./dist/themes/material.d.ts",
221
+ "default": "./dist/themes/material.css"
222
+ },
223
+ "./themes/material.css": {
224
+ "types": "./dist/themes/material.d.ts",
225
+ "default": "./dist/themes/material.css"
226
+ },
227
+ "./themes/vercel": {
228
+ "types": "./dist/themes/vercel.d.ts",
229
+ "default": "./dist/themes/vercel.css"
230
+ },
231
+ "./themes/vercel.css": {
232
+ "types": "./dist/themes/vercel.d.ts",
233
+ "default": "./dist/themes/vercel.css"
234
+ }
211
235
  },
212
236
  "workspaces": [
213
237
  "examples/*"
@@ -385,7 +409,7 @@
385
409
  "@builder.io/qwik": "^1.20.0",
386
410
  "@lhci/cli": "^0.15.1",
387
411
  "@playwright/test": "^1.62.1",
388
- "@size-limit/preset-small-lib": "^12.1.0",
412
+ "@size-limit/preset-small-lib": "^13.0.3",
389
413
  "@sveltejs/vite-plugin-svelte": "^6.2.4",
390
414
  "@types/node": "^20.19.43",
391
415
  "@types/react": "^18.3.31",
@@ -400,13 +424,13 @@
400
424
  "happy-dom": "^20.11.1",
401
425
  "husky": "^9.1.7",
402
426
  "lit": "^3.3.3",
403
- "motion": "^12.43.0",
427
+ "motion": "^13.1.0",
404
428
  "patch-package": "^8.0.1",
405
429
  "publint": "^0.3.22",
406
430
  "react": "^18.3.1",
407
431
  "react-dom": "^18.3.1",
408
432
  "rolldown": "^1.2.1",
409
- "size-limit": "^12.1.0",
433
+ "size-limit": "^13.0.3",
410
434
  "solid-js": "^1.9.14",
411
435
  "svelte": "^5.56.8",
412
436
  "three": "^0.185.1",