@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/solid.cjs CHANGED
@@ -777,7 +777,6 @@ var ScrimController = class {
777
777
  __publicField(this, "backdrop");
778
778
  __publicField(this, "mode");
779
779
  __publicField(this, "isDestroyed");
780
- __publicField(this, "isTopSheet");
781
780
  __publicField(this, "getAllowedIds");
782
781
  __publicField(this, "getResolvedSnaps");
783
782
  __publicField(this, "snapToFn");
@@ -799,7 +798,6 @@ var ScrimController = class {
799
798
  this.backdrop = deps.backdrop;
800
799
  this.mode = deps.mode;
801
800
  this.isDestroyed = deps.isDestroyed;
802
- this.isTopSheet = deps.isTopSheet;
803
801
  this.getAllowedIds = deps.getAllowedIds;
804
802
  this.getResolvedSnaps = deps.getResolvedSnaps;
805
803
  this.snapToFn = deps.snapTo;
@@ -844,8 +842,10 @@ var ScrimController = class {
844
842
  if (this.backdrop) {
845
843
  const [s, e] = this.backdropRange;
846
844
  const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
847
- const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
848
- const backdropOpacity = this.isTopSheet() ? ramp : 0;
845
+ const backdropOpacity = Math.min(
846
+ Math.max((progress - s) / range, 0),
847
+ 1
848
+ );
849
849
  if (this.backdropOpacitySentinel.shouldWrite(
850
850
  backdropOpacity,
851
851
  OPACITY_WRITE_EPSILON
@@ -2620,6 +2620,7 @@ var BottomSheetCore = class {
2620
2620
  __publicField(this, "progressWriteSentinel", new WriteSentinel());
2621
2621
  __publicField(this, "isTopSheet", true);
2622
2622
  __publicField(this, "opening", false);
2623
+ __publicField(this, "promotedForOpen", false);
2623
2624
  __publicField(this, "allowOvershoot", false);
2624
2625
  __publicField(this, "progressPayload", {
2625
2626
  value: 0,
@@ -2676,7 +2677,6 @@ var BottomSheetCore = class {
2676
2677
  screenComponent: this.screenComponent,
2677
2678
  backdrop: this.backdrop,
2678
2679
  isDestroyed: () => this.destroyed,
2679
- isTopSheet: () => this.isTopSheet,
2680
2680
  getAllowedIds: () => this.snaps.getAllowedIds().slice(),
2681
2681
  getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
2682
2682
  snapTo: (id) => {
@@ -2946,13 +2946,14 @@ var BottomSheetCore = class {
2946
2946
  if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
2947
2947
  return;
2948
2948
  }
2949
+ const resumingOpen = this.opening;
2949
2950
  const signal = this.newCycle();
2950
2951
  const onExternalAbort = () => {
2951
2952
  this.animation.cancel();
2952
2953
  this.newCycle();
2953
2954
  };
2954
2955
  externalSignal?.addEventListener("abort", onExternalAbort, { once: true });
2955
- const wasClosed = this.size === 0;
2956
+ const wasClosed = this.size === 0 || resumingOpen;
2956
2957
  const previousId = this.activeId;
2957
2958
  const previousSize = this.size;
2958
2959
  this.scrollCache.cache(previousId, previousSize, target.size);
@@ -2961,7 +2962,10 @@ var BottomSheetCore = class {
2961
2962
  const opensToRest = id === "closed" || rawTargetSize === 0;
2962
2963
  if (wasClosed && !opensToRest) {
2963
2964
  this.opening = true;
2964
- sheetStack.promote(this.id);
2965
+ if (!resumingOpen) {
2966
+ this.promotedForOpen = true;
2967
+ sheetStack.promote(this.id);
2968
+ }
2965
2969
  }
2966
2970
  if (this.animation.viewTransitionsAvailable) {
2967
2971
  this.currentViewTransition?.skipTransition?.();
@@ -3402,19 +3406,12 @@ var BottomSheetCore = class {
3402
3406
  for (const anchor of this.anchors) anchor.syncZ(z + 1);
3403
3407
  },
3404
3408
  setIsTop: (isTop) => {
3405
- if (this.isTopSheet === isTop) return;
3406
3409
  this.isTopSheet = isTop;
3407
- this.repaintScrim();
3408
3410
  },
3409
3411
  isOpen: () => this.size > 0 || this.opening,
3410
3412
  setDepth: (depth) => this.applyStackDepth(depth)
3411
3413
  }));
3412
3414
  }
3413
- repaintScrim() {
3414
- if (this.destroyed) return;
3415
- this.scrim.invalidateOpacityCache();
3416
- this.scrim.applyOpacity(this.computeProgress(this.size), true);
3417
- }
3418
3415
  applyStackDepth(depth) {
3419
3416
  if (!this.stackEffectEnabled) return;
3420
3417
  this.element.setAttribute("data-stack-depth", String(depth));
@@ -3659,6 +3656,7 @@ var BottomSheetCore = class {
3659
3656
  this.activeId = target.id;
3660
3657
  if (previousSnapSize === 0 && target.size > 0) {
3661
3658
  this.opening = true;
3659
+ this.promotedForOpen = true;
3662
3660
  sheetStack.promote(this.id);
3663
3661
  }
3664
3662
  const settleCap = this.snaps.getMaxAxisSize();
@@ -3740,7 +3738,8 @@ var BottomSheetCore = class {
3740
3738
  return Math.min(Math.max((size - min) / (reachableMax - min), 0), 1);
3741
3739
  }
3742
3740
  handleOpen() {
3743
- sheetStack.promote(this.id);
3741
+ if (this.promotedForOpen) this.promotedForOpen = false;
3742
+ else sheetStack.promote(this.id);
3744
3743
  try {
3745
3744
  this.lifecycle.install();
3746
3745
  } catch (err) {
@@ -3772,6 +3771,7 @@ var BottomSheetCore = class {
3772
3771
  }
3773
3772
  handleClose() {
3774
3773
  this.opening = false;
3774
+ this.promotedForOpen = false;
3775
3775
  this.lifecycle.release();
3776
3776
  sheetStack.update();
3777
3777
  }
package/dist/solid.d.cts CHANGED
@@ -285,6 +285,7 @@ declare class BottomSheetCore {
285
285
  private progressWriteSentinel;
286
286
  private isTopSheet;
287
287
  private opening;
288
+ private promotedForOpen;
288
289
  private allowOvershoot;
289
290
  private progressPayload;
290
291
  private dragContextBuf;
@@ -377,7 +378,6 @@ declare class BottomSheetCore {
377
378
  private allowedIdsBySize;
378
379
  private updateAriaSlider;
379
380
  private registerInStack;
380
- private repaintScrim;
381
381
  private applyStackDepth;
382
382
  private buildGestureDeps;
383
383
  private isContentDragAllowed;
package/dist/solid.d.ts CHANGED
@@ -285,6 +285,7 @@ declare class BottomSheetCore {
285
285
  private progressWriteSentinel;
286
286
  private isTopSheet;
287
287
  private opening;
288
+ private promotedForOpen;
288
289
  private allowOvershoot;
289
290
  private progressPayload;
290
291
  private dragContextBuf;
@@ -377,7 +378,6 @@ declare class BottomSheetCore {
377
378
  private allowedIdsBySize;
378
379
  private updateAriaSlider;
379
380
  private registerInStack;
380
- private repaintScrim;
381
381
  private applyStackDepth;
382
382
  private buildGestureDeps;
383
383
  private isContentDragAllowed;
package/dist/solid.js CHANGED
@@ -775,7 +775,6 @@ var ScrimController = class {
775
775
  __publicField(this, "backdrop");
776
776
  __publicField(this, "mode");
777
777
  __publicField(this, "isDestroyed");
778
- __publicField(this, "isTopSheet");
779
778
  __publicField(this, "getAllowedIds");
780
779
  __publicField(this, "getResolvedSnaps");
781
780
  __publicField(this, "snapToFn");
@@ -797,7 +796,6 @@ var ScrimController = class {
797
796
  this.backdrop = deps.backdrop;
798
797
  this.mode = deps.mode;
799
798
  this.isDestroyed = deps.isDestroyed;
800
- this.isTopSheet = deps.isTopSheet;
801
799
  this.getAllowedIds = deps.getAllowedIds;
802
800
  this.getResolvedSnaps = deps.getResolvedSnaps;
803
801
  this.snapToFn = deps.snapTo;
@@ -842,8 +840,10 @@ var ScrimController = class {
842
840
  if (this.backdrop) {
843
841
  const [s, e] = this.backdropRange;
844
842
  const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
845
- const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
846
- const backdropOpacity = this.isTopSheet() ? ramp : 0;
843
+ const backdropOpacity = Math.min(
844
+ Math.max((progress - s) / range, 0),
845
+ 1
846
+ );
847
847
  if (this.backdropOpacitySentinel.shouldWrite(
848
848
  backdropOpacity,
849
849
  OPACITY_WRITE_EPSILON
@@ -2618,6 +2618,7 @@ var BottomSheetCore = class {
2618
2618
  __publicField(this, "progressWriteSentinel", new WriteSentinel());
2619
2619
  __publicField(this, "isTopSheet", true);
2620
2620
  __publicField(this, "opening", false);
2621
+ __publicField(this, "promotedForOpen", false);
2621
2622
  __publicField(this, "allowOvershoot", false);
2622
2623
  __publicField(this, "progressPayload", {
2623
2624
  value: 0,
@@ -2674,7 +2675,6 @@ var BottomSheetCore = class {
2674
2675
  screenComponent: this.screenComponent,
2675
2676
  backdrop: this.backdrop,
2676
2677
  isDestroyed: () => this.destroyed,
2677
- isTopSheet: () => this.isTopSheet,
2678
2678
  getAllowedIds: () => this.snaps.getAllowedIds().slice(),
2679
2679
  getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
2680
2680
  snapTo: (id) => {
@@ -2944,13 +2944,14 @@ var BottomSheetCore = class {
2944
2944
  if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
2945
2945
  return;
2946
2946
  }
2947
+ const resumingOpen = this.opening;
2947
2948
  const signal = this.newCycle();
2948
2949
  const onExternalAbort = () => {
2949
2950
  this.animation.cancel();
2950
2951
  this.newCycle();
2951
2952
  };
2952
2953
  externalSignal?.addEventListener("abort", onExternalAbort, { once: true });
2953
- const wasClosed = this.size === 0;
2954
+ const wasClosed = this.size === 0 || resumingOpen;
2954
2955
  const previousId = this.activeId;
2955
2956
  const previousSize = this.size;
2956
2957
  this.scrollCache.cache(previousId, previousSize, target.size);
@@ -2959,7 +2960,10 @@ var BottomSheetCore = class {
2959
2960
  const opensToRest = id === "closed" || rawTargetSize === 0;
2960
2961
  if (wasClosed && !opensToRest) {
2961
2962
  this.opening = true;
2962
- sheetStack.promote(this.id);
2963
+ if (!resumingOpen) {
2964
+ this.promotedForOpen = true;
2965
+ sheetStack.promote(this.id);
2966
+ }
2963
2967
  }
2964
2968
  if (this.animation.viewTransitionsAvailable) {
2965
2969
  this.currentViewTransition?.skipTransition?.();
@@ -3400,19 +3404,12 @@ var BottomSheetCore = class {
3400
3404
  for (const anchor of this.anchors) anchor.syncZ(z + 1);
3401
3405
  },
3402
3406
  setIsTop: (isTop) => {
3403
- if (this.isTopSheet === isTop) return;
3404
3407
  this.isTopSheet = isTop;
3405
- this.repaintScrim();
3406
3408
  },
3407
3409
  isOpen: () => this.size > 0 || this.opening,
3408
3410
  setDepth: (depth) => this.applyStackDepth(depth)
3409
3411
  }));
3410
3412
  }
3411
- repaintScrim() {
3412
- if (this.destroyed) return;
3413
- this.scrim.invalidateOpacityCache();
3414
- this.scrim.applyOpacity(this.computeProgress(this.size), true);
3415
- }
3416
3413
  applyStackDepth(depth) {
3417
3414
  if (!this.stackEffectEnabled) return;
3418
3415
  this.element.setAttribute("data-stack-depth", String(depth));
@@ -3657,6 +3654,7 @@ var BottomSheetCore = class {
3657
3654
  this.activeId = target.id;
3658
3655
  if (previousSnapSize === 0 && target.size > 0) {
3659
3656
  this.opening = true;
3657
+ this.promotedForOpen = true;
3660
3658
  sheetStack.promote(this.id);
3661
3659
  }
3662
3660
  const settleCap = this.snaps.getMaxAxisSize();
@@ -3738,7 +3736,8 @@ var BottomSheetCore = class {
3738
3736
  return Math.min(Math.max((size - min) / (reachableMax - min), 0), 1);
3739
3737
  }
3740
3738
  handleOpen() {
3741
- sheetStack.promote(this.id);
3739
+ if (this.promotedForOpen) this.promotedForOpen = false;
3740
+ else sheetStack.promote(this.id);
3742
3741
  try {
3743
3742
  this.lifecycle.install();
3744
3743
  } catch (err) {
@@ -3770,6 +3769,7 @@ var BottomSheetCore = class {
3770
3769
  }
3771
3770
  handleClose() {
3772
3771
  this.opening = false;
3772
+ this.promotedForOpen = false;
3773
3773
  this.lifecycle.release();
3774
3774
  sheetStack.update();
3775
3775
  }
@@ -777,7 +777,6 @@ var ScrimController = class {
777
777
  backdrop;
778
778
  mode;
779
779
  isDestroyed;
780
- isTopSheet;
781
780
  getAllowedIds;
782
781
  getResolvedSnaps;
783
782
  snapToFn;
@@ -804,7 +803,6 @@ var ScrimController = class {
804
803
  this.backdrop = deps.backdrop;
805
804
  this.mode = deps.mode;
806
805
  this.isDestroyed = deps.isDestroyed;
807
- this.isTopSheet = deps.isTopSheet;
808
806
  this.getAllowedIds = deps.getAllowedIds;
809
807
  this.getResolvedSnaps = deps.getResolvedSnaps;
810
808
  this.snapToFn = deps.snapTo;
@@ -845,8 +843,10 @@ var ScrimController = class {
845
843
  if (this.backdrop) {
846
844
  const [s, e] = this.backdropRange;
847
845
  const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
848
- const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
849
- const backdropOpacity = this.isTopSheet() ? ramp : 0;
846
+ const backdropOpacity = Math.min(
847
+ Math.max((progress - s) / range, 0),
848
+ 1
849
+ );
850
850
  if (this.backdropOpacitySentinel.shouldWrite(
851
851
  backdropOpacity,
852
852
  OPACITY_WRITE_EPSILON
@@ -2619,6 +2619,7 @@ var BottomSheetCore = class {
2619
2619
  progressWriteSentinel = new WriteSentinel();
2620
2620
  isTopSheet = true;
2621
2621
  opening = false;
2622
+ promotedForOpen = false;
2622
2623
  allowOvershoot = false;
2623
2624
  progressPayload = {
2624
2625
  value: 0,
@@ -2676,7 +2677,6 @@ var BottomSheetCore = class {
2676
2677
  screenComponent: this.screenComponent,
2677
2678
  backdrop: this.backdrop,
2678
2679
  isDestroyed: () => this.destroyed,
2679
- isTopSheet: () => this.isTopSheet,
2680
2680
  getAllowedIds: () => this.snaps.getAllowedIds().slice(),
2681
2681
  getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
2682
2682
  snapTo: (id) => {
@@ -2946,13 +2946,14 @@ var BottomSheetCore = class {
2946
2946
  if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
2947
2947
  return;
2948
2948
  }
2949
+ const resumingOpen = this.opening;
2949
2950
  const signal = this.newCycle();
2950
2951
  const onExternalAbort = () => {
2951
2952
  this.animation.cancel();
2952
2953
  this.newCycle();
2953
2954
  };
2954
2955
  externalSignal?.addEventListener("abort", onExternalAbort, { once: true });
2955
- const wasClosed = this.size === 0;
2956
+ const wasClosed = this.size === 0 || resumingOpen;
2956
2957
  const previousId = this.activeId;
2957
2958
  const previousSize = this.size;
2958
2959
  this.scrollCache.cache(previousId, previousSize, target.size);
@@ -2961,7 +2962,10 @@ var BottomSheetCore = class {
2961
2962
  const opensToRest = id === "closed" || rawTargetSize === 0;
2962
2963
  if (wasClosed && !opensToRest) {
2963
2964
  this.opening = true;
2964
- sheetStack.promote(this.id);
2965
+ if (!resumingOpen) {
2966
+ this.promotedForOpen = true;
2967
+ sheetStack.promote(this.id);
2968
+ }
2965
2969
  }
2966
2970
  if (this.animation.viewTransitionsAvailable) {
2967
2971
  this.currentViewTransition?.skipTransition?.();
@@ -3402,19 +3406,12 @@ var BottomSheetCore = class {
3402
3406
  for (const anchor of this.anchors) anchor.syncZ(z + 1);
3403
3407
  },
3404
3408
  setIsTop: (isTop) => {
3405
- if (this.isTopSheet === isTop) return;
3406
3409
  this.isTopSheet = isTop;
3407
- this.repaintScrim();
3408
3410
  },
3409
3411
  isOpen: () => this.size > 0 || this.opening,
3410
3412
  setDepth: (depth) => this.applyStackDepth(depth)
3411
3413
  }));
3412
3414
  }
3413
- repaintScrim() {
3414
- if (this.destroyed) return;
3415
- this.scrim.invalidateOpacityCache();
3416
- this.scrim.applyOpacity(this.computeProgress(this.size), true);
3417
- }
3418
3415
  applyStackDepth(depth) {
3419
3416
  if (!this.stackEffectEnabled) return;
3420
3417
  this.element.setAttribute("data-stack-depth", String(depth));
@@ -3659,6 +3656,7 @@ var BottomSheetCore = class {
3659
3656
  this.activeId = target.id;
3660
3657
  if (previousSnapSize === 0 && target.size > 0) {
3661
3658
  this.opening = true;
3659
+ this.promotedForOpen = true;
3662
3660
  sheetStack.promote(this.id);
3663
3661
  }
3664
3662
  const settleCap = this.snaps.getMaxAxisSize();
@@ -3740,7 +3738,8 @@ var BottomSheetCore = class {
3740
3738
  return Math.min(Math.max((size - min) / (reachableMax - min), 0), 1);
3741
3739
  }
3742
3740
  handleOpen() {
3743
- sheetStack.promote(this.id);
3741
+ if (this.promotedForOpen) this.promotedForOpen = false;
3742
+ else sheetStack.promote(this.id);
3744
3743
  try {
3745
3744
  this.lifecycle.install();
3746
3745
  } catch (err) {
@@ -3772,6 +3771,7 @@ var BottomSheetCore = class {
3772
3771
  }
3773
3772
  handleClose() {
3774
3773
  this.opening = false;
3774
+ this.promotedForOpen = false;
3775
3775
  this.lifecycle.release();
3776
3776
  sheetStack.update();
3777
3777
  }
@@ -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
  }
@@ -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
  }