@surdeddd/bottom-sheet 0.21.0 → 0.21.1

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 (54) hide show
  1. package/README.md +9 -0
  2. package/dist/{BottomSheetCore-CK8Rh1He.d.cts → BottomSheetCore-BHv6LPmS.d.cts} +1 -1
  3. package/dist/{BottomSheetCore-CIijwtdi.d.ts → BottomSheetCore-CK_mq14p.d.ts} +1 -1
  4. package/dist/{BottomSheetEngine-hLSAxzla.d.cts → BottomSheetEngine-mmFzIK1Z.d.cts} +1 -1
  5. package/dist/{BottomSheetEngine-CZglPsTF.d.ts → BottomSheetEngine-wLn6Q2kA.d.ts} +1 -1
  6. package/dist/core.cjs +15 -15
  7. package/dist/core.d.cts +2 -2
  8. package/dist/core.d.ts +2 -2
  9. package/dist/core.js +15 -15
  10. package/dist/debug.d.cts +1 -1
  11. package/dist/debug.d.ts +1 -1
  12. package/dist/element.cjs +15 -15
  13. package/dist/element.d.cts +2 -2
  14. package/dist/element.d.ts +2 -2
  15. package/dist/element.iife.global.js +1 -1
  16. package/dist/element.js +15 -15
  17. package/dist/features.d.cts +2 -2
  18. package/dist/features.d.ts +2 -2
  19. package/dist/{index-BqLHKOeM.d.ts → index-CWKv1Xy4.d.ts} +1 -1
  20. package/dist/{index-BEX-NHRJ.d.cts → index-juAyT76E.d.cts} +1 -1
  21. package/dist/index.cjs +15 -15
  22. package/dist/index.d.cts +4 -4
  23. package/dist/index.d.ts +4 -4
  24. package/dist/index.js +15 -15
  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 +12 -15
  32. package/dist/qwik-lib/index.qwik.mjs +12 -15
  33. package/dist/qwik.cjs +15 -15
  34. package/dist/qwik.d.cts +2 -2
  35. package/dist/qwik.d.ts +2 -2
  36. package/dist/qwik.js +15 -15
  37. package/dist/react.cjs +15 -15
  38. package/dist/react.d.cts +3 -3
  39. package/dist/react.d.ts +3 -3
  40. package/dist/react.js +15 -15
  41. package/dist/solid.cjs +15 -15
  42. package/dist/solid.d.cts +1 -1
  43. package/dist/solid.d.ts +1 -1
  44. package/dist/solid.js +15 -15
  45. package/dist/solid.source.jsx +15 -15
  46. package/dist/svelte-core.cjs +15 -15
  47. package/dist/svelte-core.js +15 -15
  48. package/dist/svelte.cjs +15 -15
  49. package/dist/svelte.js +15 -15
  50. package/dist/vue.cjs +15 -15
  51. package/dist/vue.js +15 -15
  52. package/dist/webgl.d.cts +1 -1
  53. package/dist/webgl.d.ts +1 -1
  54. package/package.json +2 -2
package/dist/svelte.cjs CHANGED
@@ -798,7 +798,6 @@ var ScrimController = class {
798
798
  __publicField(this, "backdrop");
799
799
  __publicField(this, "mode");
800
800
  __publicField(this, "isDestroyed");
801
- __publicField(this, "isTopSheet");
802
801
  __publicField(this, "getAllowedIds");
803
802
  __publicField(this, "getResolvedSnaps");
804
803
  __publicField(this, "snapToFn");
@@ -820,7 +819,6 @@ var ScrimController = class {
820
819
  this.backdrop = deps.backdrop;
821
820
  this.mode = deps.mode;
822
821
  this.isDestroyed = deps.isDestroyed;
823
- this.isTopSheet = deps.isTopSheet;
824
822
  this.getAllowedIds = deps.getAllowedIds;
825
823
  this.getResolvedSnaps = deps.getResolvedSnaps;
826
824
  this.snapToFn = deps.snapTo;
@@ -865,8 +863,10 @@ var ScrimController = class {
865
863
  if (this.backdrop) {
866
864
  const [s, e] = this.backdropRange;
867
865
  const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
868
- const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
869
- const backdropOpacity = this.isTopSheet() ? ramp : 0;
866
+ const backdropOpacity = Math.min(
867
+ Math.max((progress - s) / range, 0),
868
+ 1
869
+ );
870
870
  if (this.backdropOpacitySentinel.shouldWrite(
871
871
  backdropOpacity,
872
872
  OPACITY_WRITE_EPSILON
@@ -2641,6 +2641,7 @@ var BottomSheetCore = class {
2641
2641
  __publicField(this, "progressWriteSentinel", new WriteSentinel());
2642
2642
  __publicField(this, "isTopSheet", true);
2643
2643
  __publicField(this, "opening", false);
2644
+ __publicField(this, "promotedForOpen", false);
2644
2645
  __publicField(this, "allowOvershoot", false);
2645
2646
  __publicField(this, "progressPayload", {
2646
2647
  value: 0,
@@ -2697,7 +2698,6 @@ var BottomSheetCore = class {
2697
2698
  screenComponent: this.screenComponent,
2698
2699
  backdrop: this.backdrop,
2699
2700
  isDestroyed: () => this.destroyed,
2700
- isTopSheet: () => this.isTopSheet,
2701
2701
  getAllowedIds: () => this.snaps.getAllowedIds().slice(),
2702
2702
  getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
2703
2703
  snapTo: (id) => {
@@ -2967,13 +2967,14 @@ var BottomSheetCore = class {
2967
2967
  if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
2968
2968
  return;
2969
2969
  }
2970
+ const resumingOpen = this.opening;
2970
2971
  const signal = this.newCycle();
2971
2972
  const onExternalAbort = () => {
2972
2973
  this.animation.cancel();
2973
2974
  this.newCycle();
2974
2975
  };
2975
2976
  externalSignal?.addEventListener("abort", onExternalAbort, { once: true });
2976
- const wasClosed = this.size === 0;
2977
+ const wasClosed = this.size === 0 || resumingOpen;
2977
2978
  const previousId = this.activeId;
2978
2979
  const previousSize = this.size;
2979
2980
  this.scrollCache.cache(previousId, previousSize, target.size);
@@ -2982,7 +2983,10 @@ var BottomSheetCore = class {
2982
2983
  const opensToRest = id === "closed" || rawTargetSize === 0;
2983
2984
  if (wasClosed && !opensToRest) {
2984
2985
  this.opening = true;
2985
- sheetStack.promote(this.id);
2986
+ if (!resumingOpen) {
2987
+ this.promotedForOpen = true;
2988
+ sheetStack.promote(this.id);
2989
+ }
2986
2990
  }
2987
2991
  if (this.animation.viewTransitionsAvailable) {
2988
2992
  this.currentViewTransition?.skipTransition?.();
@@ -3423,19 +3427,12 @@ var BottomSheetCore = class {
3423
3427
  for (const anchor of this.anchors) anchor.syncZ(z + 1);
3424
3428
  },
3425
3429
  setIsTop: (isTop) => {
3426
- if (this.isTopSheet === isTop) return;
3427
3430
  this.isTopSheet = isTop;
3428
- this.repaintScrim();
3429
3431
  },
3430
3432
  isOpen: () => this.size > 0 || this.opening,
3431
3433
  setDepth: (depth) => this.applyStackDepth(depth)
3432
3434
  }));
3433
3435
  }
3434
- repaintScrim() {
3435
- if (this.destroyed) return;
3436
- this.scrim.invalidateOpacityCache();
3437
- this.scrim.applyOpacity(this.computeProgress(this.size), true);
3438
- }
3439
3436
  applyStackDepth(depth) {
3440
3437
  if (!this.stackEffectEnabled) return;
3441
3438
  this.element.setAttribute("data-stack-depth", String(depth));
@@ -3680,6 +3677,7 @@ var BottomSheetCore = class {
3680
3677
  this.activeId = target.id;
3681
3678
  if (previousSnapSize === 0 && target.size > 0) {
3682
3679
  this.opening = true;
3680
+ this.promotedForOpen = true;
3683
3681
  sheetStack.promote(this.id);
3684
3682
  }
3685
3683
  const settleCap = this.snaps.getMaxAxisSize();
@@ -3761,7 +3759,8 @@ var BottomSheetCore = class {
3761
3759
  return Math.min(Math.max((size - min) / (reachableMax - min), 0), 1);
3762
3760
  }
3763
3761
  handleOpen() {
3764
- sheetStack.promote(this.id);
3762
+ if (this.promotedForOpen) this.promotedForOpen = false;
3763
+ else sheetStack.promote(this.id);
3765
3764
  try {
3766
3765
  this.lifecycle.install();
3767
3766
  } catch (err) {
@@ -3793,6 +3792,7 @@ var BottomSheetCore = class {
3793
3792
  }
3794
3793
  handleClose() {
3795
3794
  this.opening = false;
3795
+ this.promotedForOpen = false;
3796
3796
  this.lifecycle.release();
3797
3797
  sheetStack.update();
3798
3798
  }
package/dist/svelte.js CHANGED
@@ -776,7 +776,6 @@ var ScrimController = class {
776
776
  __publicField(this, "backdrop");
777
777
  __publicField(this, "mode");
778
778
  __publicField(this, "isDestroyed");
779
- __publicField(this, "isTopSheet");
780
779
  __publicField(this, "getAllowedIds");
781
780
  __publicField(this, "getResolvedSnaps");
782
781
  __publicField(this, "snapToFn");
@@ -798,7 +797,6 @@ var ScrimController = class {
798
797
  this.backdrop = deps.backdrop;
799
798
  this.mode = deps.mode;
800
799
  this.isDestroyed = deps.isDestroyed;
801
- this.isTopSheet = deps.isTopSheet;
802
800
  this.getAllowedIds = deps.getAllowedIds;
803
801
  this.getResolvedSnaps = deps.getResolvedSnaps;
804
802
  this.snapToFn = deps.snapTo;
@@ -843,8 +841,10 @@ var ScrimController = class {
843
841
  if (this.backdrop) {
844
842
  const [s, e] = this.backdropRange;
845
843
  const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
846
- const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
847
- const backdropOpacity = this.isTopSheet() ? ramp : 0;
844
+ const backdropOpacity = Math.min(
845
+ Math.max((progress - s) / range, 0),
846
+ 1
847
+ );
848
848
  if (this.backdropOpacitySentinel.shouldWrite(
849
849
  backdropOpacity,
850
850
  OPACITY_WRITE_EPSILON
@@ -2619,6 +2619,7 @@ var BottomSheetCore = class {
2619
2619
  __publicField(this, "progressWriteSentinel", new WriteSentinel());
2620
2620
  __publicField(this, "isTopSheet", true);
2621
2621
  __publicField(this, "opening", false);
2622
+ __publicField(this, "promotedForOpen", false);
2622
2623
  __publicField(this, "allowOvershoot", false);
2623
2624
  __publicField(this, "progressPayload", {
2624
2625
  value: 0,
@@ -2675,7 +2676,6 @@ var BottomSheetCore = class {
2675
2676
  screenComponent: this.screenComponent,
2676
2677
  backdrop: this.backdrop,
2677
2678
  isDestroyed: () => this.destroyed,
2678
- isTopSheet: () => this.isTopSheet,
2679
2679
  getAllowedIds: () => this.snaps.getAllowedIds().slice(),
2680
2680
  getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
2681
2681
  snapTo: (id) => {
@@ -2945,13 +2945,14 @@ var BottomSheetCore = class {
2945
2945
  if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
2946
2946
  return;
2947
2947
  }
2948
+ const resumingOpen = this.opening;
2948
2949
  const signal = this.newCycle();
2949
2950
  const onExternalAbort = () => {
2950
2951
  this.animation.cancel();
2951
2952
  this.newCycle();
2952
2953
  };
2953
2954
  externalSignal?.addEventListener("abort", onExternalAbort, { once: true });
2954
- const wasClosed = this.size === 0;
2955
+ const wasClosed = this.size === 0 || resumingOpen;
2955
2956
  const previousId = this.activeId;
2956
2957
  const previousSize = this.size;
2957
2958
  this.scrollCache.cache(previousId, previousSize, target.size);
@@ -2960,7 +2961,10 @@ var BottomSheetCore = class {
2960
2961
  const opensToRest = id === "closed" || rawTargetSize === 0;
2961
2962
  if (wasClosed && !opensToRest) {
2962
2963
  this.opening = true;
2963
- sheetStack.promote(this.id);
2964
+ if (!resumingOpen) {
2965
+ this.promotedForOpen = true;
2966
+ sheetStack.promote(this.id);
2967
+ }
2964
2968
  }
2965
2969
  if (this.animation.viewTransitionsAvailable) {
2966
2970
  this.currentViewTransition?.skipTransition?.();
@@ -3401,19 +3405,12 @@ var BottomSheetCore = class {
3401
3405
  for (const anchor of this.anchors) anchor.syncZ(z + 1);
3402
3406
  },
3403
3407
  setIsTop: (isTop) => {
3404
- if (this.isTopSheet === isTop) return;
3405
3408
  this.isTopSheet = isTop;
3406
- this.repaintScrim();
3407
3409
  },
3408
3410
  isOpen: () => this.size > 0 || this.opening,
3409
3411
  setDepth: (depth) => this.applyStackDepth(depth)
3410
3412
  }));
3411
3413
  }
3412
- repaintScrim() {
3413
- if (this.destroyed) return;
3414
- this.scrim.invalidateOpacityCache();
3415
- this.scrim.applyOpacity(this.computeProgress(this.size), true);
3416
- }
3417
3414
  applyStackDepth(depth) {
3418
3415
  if (!this.stackEffectEnabled) return;
3419
3416
  this.element.setAttribute("data-stack-depth", String(depth));
@@ -3658,6 +3655,7 @@ var BottomSheetCore = class {
3658
3655
  this.activeId = target.id;
3659
3656
  if (previousSnapSize === 0 && target.size > 0) {
3660
3657
  this.opening = true;
3658
+ this.promotedForOpen = true;
3661
3659
  sheetStack.promote(this.id);
3662
3660
  }
3663
3661
  const settleCap = this.snaps.getMaxAxisSize();
@@ -3739,7 +3737,8 @@ var BottomSheetCore = class {
3739
3737
  return Math.min(Math.max((size - min) / (reachableMax - min), 0), 1);
3740
3738
  }
3741
3739
  handleOpen() {
3742
- sheetStack.promote(this.id);
3740
+ if (this.promotedForOpen) this.promotedForOpen = false;
3741
+ else sheetStack.promote(this.id);
3743
3742
  try {
3744
3743
  this.lifecycle.install();
3745
3744
  } catch (err) {
@@ -3771,6 +3770,7 @@ var BottomSheetCore = class {
3771
3770
  }
3772
3771
  handleClose() {
3773
3772
  this.opening = false;
3773
+ this.promotedForOpen = false;
3774
3774
  this.lifecycle.release();
3775
3775
  sheetStack.update();
3776
3776
  }
package/dist/vue.cjs CHANGED
@@ -776,7 +776,6 @@ var ScrimController = class {
776
776
  __publicField(this, "backdrop");
777
777
  __publicField(this, "mode");
778
778
  __publicField(this, "isDestroyed");
779
- __publicField(this, "isTopSheet");
780
779
  __publicField(this, "getAllowedIds");
781
780
  __publicField(this, "getResolvedSnaps");
782
781
  __publicField(this, "snapToFn");
@@ -798,7 +797,6 @@ var ScrimController = class {
798
797
  this.backdrop = deps.backdrop;
799
798
  this.mode = deps.mode;
800
799
  this.isDestroyed = deps.isDestroyed;
801
- this.isTopSheet = deps.isTopSheet;
802
800
  this.getAllowedIds = deps.getAllowedIds;
803
801
  this.getResolvedSnaps = deps.getResolvedSnaps;
804
802
  this.snapToFn = deps.snapTo;
@@ -843,8 +841,10 @@ var ScrimController = class {
843
841
  if (this.backdrop) {
844
842
  const [s, e] = this.backdropRange;
845
843
  const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
846
- const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
847
- const backdropOpacity = this.isTopSheet() ? ramp : 0;
844
+ const backdropOpacity = Math.min(
845
+ Math.max((progress - s) / range, 0),
846
+ 1
847
+ );
848
848
  if (this.backdropOpacitySentinel.shouldWrite(
849
849
  backdropOpacity,
850
850
  OPACITY_WRITE_EPSILON
@@ -2619,6 +2619,7 @@ var BottomSheetCore = class {
2619
2619
  __publicField(this, "progressWriteSentinel", new WriteSentinel());
2620
2620
  __publicField(this, "isTopSheet", true);
2621
2621
  __publicField(this, "opening", false);
2622
+ __publicField(this, "promotedForOpen", false);
2622
2623
  __publicField(this, "allowOvershoot", false);
2623
2624
  __publicField(this, "progressPayload", {
2624
2625
  value: 0,
@@ -2675,7 +2676,6 @@ var BottomSheetCore = class {
2675
2676
  screenComponent: this.screenComponent,
2676
2677
  backdrop: this.backdrop,
2677
2678
  isDestroyed: () => this.destroyed,
2678
- isTopSheet: () => this.isTopSheet,
2679
2679
  getAllowedIds: () => this.snaps.getAllowedIds().slice(),
2680
2680
  getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
2681
2681
  snapTo: (id) => {
@@ -2945,13 +2945,14 @@ var BottomSheetCore = class {
2945
2945
  if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
2946
2946
  return;
2947
2947
  }
2948
+ const resumingOpen = this.opening;
2948
2949
  const signal = this.newCycle();
2949
2950
  const onExternalAbort = () => {
2950
2951
  this.animation.cancel();
2951
2952
  this.newCycle();
2952
2953
  };
2953
2954
  externalSignal?.addEventListener("abort", onExternalAbort, { once: true });
2954
- const wasClosed = this.size === 0;
2955
+ const wasClosed = this.size === 0 || resumingOpen;
2955
2956
  const previousId = this.activeId;
2956
2957
  const previousSize = this.size;
2957
2958
  this.scrollCache.cache(previousId, previousSize, target.size);
@@ -2960,7 +2961,10 @@ var BottomSheetCore = class {
2960
2961
  const opensToRest = id === "closed" || rawTargetSize === 0;
2961
2962
  if (wasClosed && !opensToRest) {
2962
2963
  this.opening = true;
2963
- sheetStack.promote(this.id);
2964
+ if (!resumingOpen) {
2965
+ this.promotedForOpen = true;
2966
+ sheetStack.promote(this.id);
2967
+ }
2964
2968
  }
2965
2969
  if (this.animation.viewTransitionsAvailable) {
2966
2970
  this.currentViewTransition?.skipTransition?.();
@@ -3401,19 +3405,12 @@ var BottomSheetCore = class {
3401
3405
  for (const anchor of this.anchors) anchor.syncZ(z + 1);
3402
3406
  },
3403
3407
  setIsTop: (isTop) => {
3404
- if (this.isTopSheet === isTop) return;
3405
3408
  this.isTopSheet = isTop;
3406
- this.repaintScrim();
3407
3409
  },
3408
3410
  isOpen: () => this.size > 0 || this.opening,
3409
3411
  setDepth: (depth) => this.applyStackDepth(depth)
3410
3412
  }));
3411
3413
  }
3412
- repaintScrim() {
3413
- if (this.destroyed) return;
3414
- this.scrim.invalidateOpacityCache();
3415
- this.scrim.applyOpacity(this.computeProgress(this.size), true);
3416
- }
3417
3414
  applyStackDepth(depth) {
3418
3415
  if (!this.stackEffectEnabled) return;
3419
3416
  this.element.setAttribute("data-stack-depth", String(depth));
@@ -3658,6 +3655,7 @@ var BottomSheetCore = class {
3658
3655
  this.activeId = target.id;
3659
3656
  if (previousSnapSize === 0 && target.size > 0) {
3660
3657
  this.opening = true;
3658
+ this.promotedForOpen = true;
3661
3659
  sheetStack.promote(this.id);
3662
3660
  }
3663
3661
  const settleCap = this.snaps.getMaxAxisSize();
@@ -3739,7 +3737,8 @@ var BottomSheetCore = class {
3739
3737
  return Math.min(Math.max((size - min) / (reachableMax - min), 0), 1);
3740
3738
  }
3741
3739
  handleOpen() {
3742
- sheetStack.promote(this.id);
3740
+ if (this.promotedForOpen) this.promotedForOpen = false;
3741
+ else sheetStack.promote(this.id);
3743
3742
  try {
3744
3743
  this.lifecycle.install();
3745
3744
  } catch (err) {
@@ -3771,6 +3770,7 @@ var BottomSheetCore = class {
3771
3770
  }
3772
3771
  handleClose() {
3773
3772
  this.opening = false;
3773
+ this.promotedForOpen = false;
3774
3774
  this.lifecycle.release();
3775
3775
  sheetStack.update();
3776
3776
  }
package/dist/vue.js CHANGED
@@ -774,7 +774,6 @@ var ScrimController = class {
774
774
  __publicField(this, "backdrop");
775
775
  __publicField(this, "mode");
776
776
  __publicField(this, "isDestroyed");
777
- __publicField(this, "isTopSheet");
778
777
  __publicField(this, "getAllowedIds");
779
778
  __publicField(this, "getResolvedSnaps");
780
779
  __publicField(this, "snapToFn");
@@ -796,7 +795,6 @@ var ScrimController = class {
796
795
  this.backdrop = deps.backdrop;
797
796
  this.mode = deps.mode;
798
797
  this.isDestroyed = deps.isDestroyed;
799
- this.isTopSheet = deps.isTopSheet;
800
798
  this.getAllowedIds = deps.getAllowedIds;
801
799
  this.getResolvedSnaps = deps.getResolvedSnaps;
802
800
  this.snapToFn = deps.snapTo;
@@ -841,8 +839,10 @@ var ScrimController = class {
841
839
  if (this.backdrop) {
842
840
  const [s, e] = this.backdropRange;
843
841
  const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
844
- const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
845
- const backdropOpacity = this.isTopSheet() ? ramp : 0;
842
+ const backdropOpacity = Math.min(
843
+ Math.max((progress - s) / range, 0),
844
+ 1
845
+ );
846
846
  if (this.backdropOpacitySentinel.shouldWrite(
847
847
  backdropOpacity,
848
848
  OPACITY_WRITE_EPSILON
@@ -2617,6 +2617,7 @@ var BottomSheetCore = class {
2617
2617
  __publicField(this, "progressWriteSentinel", new WriteSentinel());
2618
2618
  __publicField(this, "isTopSheet", true);
2619
2619
  __publicField(this, "opening", false);
2620
+ __publicField(this, "promotedForOpen", false);
2620
2621
  __publicField(this, "allowOvershoot", false);
2621
2622
  __publicField(this, "progressPayload", {
2622
2623
  value: 0,
@@ -2673,7 +2674,6 @@ var BottomSheetCore = class {
2673
2674
  screenComponent: this.screenComponent,
2674
2675
  backdrop: this.backdrop,
2675
2676
  isDestroyed: () => this.destroyed,
2676
- isTopSheet: () => this.isTopSheet,
2677
2677
  getAllowedIds: () => this.snaps.getAllowedIds().slice(),
2678
2678
  getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
2679
2679
  snapTo: (id) => {
@@ -2943,13 +2943,14 @@ var BottomSheetCore = class {
2943
2943
  if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
2944
2944
  return;
2945
2945
  }
2946
+ const resumingOpen = this.opening;
2946
2947
  const signal = this.newCycle();
2947
2948
  const onExternalAbort = () => {
2948
2949
  this.animation.cancel();
2949
2950
  this.newCycle();
2950
2951
  };
2951
2952
  externalSignal?.addEventListener("abort", onExternalAbort, { once: true });
2952
- const wasClosed = this.size === 0;
2953
+ const wasClosed = this.size === 0 || resumingOpen;
2953
2954
  const previousId = this.activeId;
2954
2955
  const previousSize = this.size;
2955
2956
  this.scrollCache.cache(previousId, previousSize, target.size);
@@ -2958,7 +2959,10 @@ var BottomSheetCore = class {
2958
2959
  const opensToRest = id === "closed" || rawTargetSize === 0;
2959
2960
  if (wasClosed && !opensToRest) {
2960
2961
  this.opening = true;
2961
- sheetStack.promote(this.id);
2962
+ if (!resumingOpen) {
2963
+ this.promotedForOpen = true;
2964
+ sheetStack.promote(this.id);
2965
+ }
2962
2966
  }
2963
2967
  if (this.animation.viewTransitionsAvailable) {
2964
2968
  this.currentViewTransition?.skipTransition?.();
@@ -3399,19 +3403,12 @@ var BottomSheetCore = class {
3399
3403
  for (const anchor of this.anchors) anchor.syncZ(z + 1);
3400
3404
  },
3401
3405
  setIsTop: (isTop) => {
3402
- if (this.isTopSheet === isTop) return;
3403
3406
  this.isTopSheet = isTop;
3404
- this.repaintScrim();
3405
3407
  },
3406
3408
  isOpen: () => this.size > 0 || this.opening,
3407
3409
  setDepth: (depth) => this.applyStackDepth(depth)
3408
3410
  }));
3409
3411
  }
3410
- repaintScrim() {
3411
- if (this.destroyed) return;
3412
- this.scrim.invalidateOpacityCache();
3413
- this.scrim.applyOpacity(this.computeProgress(this.size), true);
3414
- }
3415
3412
  applyStackDepth(depth) {
3416
3413
  if (!this.stackEffectEnabled) return;
3417
3414
  this.element.setAttribute("data-stack-depth", String(depth));
@@ -3656,6 +3653,7 @@ var BottomSheetCore = class {
3656
3653
  this.activeId = target.id;
3657
3654
  if (previousSnapSize === 0 && target.size > 0) {
3658
3655
  this.opening = true;
3656
+ this.promotedForOpen = true;
3659
3657
  sheetStack.promote(this.id);
3660
3658
  }
3661
3659
  const settleCap = this.snaps.getMaxAxisSize();
@@ -3737,7 +3735,8 @@ var BottomSheetCore = class {
3737
3735
  return Math.min(Math.max((size - min) / (reachableMax - min), 0), 1);
3738
3736
  }
3739
3737
  handleOpen() {
3740
- sheetStack.promote(this.id);
3738
+ if (this.promotedForOpen) this.promotedForOpen = false;
3739
+ else sheetStack.promote(this.id);
3741
3740
  try {
3742
3741
  this.lifecycle.install();
3743
3742
  } catch (err) {
@@ -3769,6 +3768,7 @@ var BottomSheetCore = class {
3769
3768
  }
3770
3769
  handleClose() {
3771
3770
  this.opening = false;
3771
+ this.promotedForOpen = false;
3772
3772
  this.lifecycle.release();
3773
3773
  sheetStack.update();
3774
3774
  }
package/dist/webgl.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { f as EngineFeature } from './BottomSheetCore-CK8Rh1He.cjs';
1
+ import { f as EngineFeature } from './BottomSheetCore-BHv6LPmS.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-CIijwtdi.js';
1
+ import { f as EngineFeature } from './BottomSheetCore-CK_mq14p.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.21.0",
3
+ "version": "0.21.1",
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",
@@ -429,7 +429,7 @@
429
429
  "publint": "^0.3.22",
430
430
  "react": "^18.3.1",
431
431
  "react-dom": "^18.3.1",
432
- "rolldown": "^1.2.1",
432
+ "rolldown": "^1.2.8",
433
433
  "size-limit": "^13.0.3",
434
434
  "solid-js": "^1.9.14",
435
435
  "svelte": "^5.56.8",