@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/README.md CHANGED
@@ -499,6 +499,15 @@ element — drive any CSS animation from drag without touching JS:
499
499
  > `z-index` on bs-managed elements. See
500
500
  > [Architecture → z-index & the sheet stack](docs/ARCHITECTURE.md).
501
501
 
502
+ **Every sheet owns its backdrop.** Open a list, then a detail sheet over it,
503
+ and both backdrops stay live: the dimming deepens with each level, and the
504
+ sheet underneath stays masked for the whole time the one above it closes, so
505
+ taps never reach the page mid-animation. Each backdrop follows its own sheet's
506
+ progress, so a buried sheet that closes clears its own scrim. The stack keeps
507
+ the order sheets started opening in — a sheet opened while another is still
508
+ animating stays on top. If you want a single dim level, pass `backdrop={false}`
509
+ (`:backdrop="false"` in Vue) to the sheets you open on top.
510
+
502
511
  ### Scrim, blur & high contrast
503
512
 
504
513
  | Token | Default | Region |
@@ -305,6 +305,7 @@ declare class BottomSheetCore {
305
305
  private progressWriteSentinel;
306
306
  private isTopSheet;
307
307
  private opening;
308
+ private promotedForOpen;
308
309
  private allowOvershoot;
309
310
  private progressPayload;
310
311
  private dragContextBuf;
@@ -397,7 +398,6 @@ declare class BottomSheetCore {
397
398
  private allowedIdsBySize;
398
399
  private updateAriaSlider;
399
400
  private registerInStack;
400
- private repaintScrim;
401
401
  private applyStackDepth;
402
402
  private buildGestureDeps;
403
403
  private isContentDragAllowed;
@@ -305,6 +305,7 @@ declare class BottomSheetCore {
305
305
  private progressWriteSentinel;
306
306
  private isTopSheet;
307
307
  private opening;
308
+ private promotedForOpen;
308
309
  private allowOvershoot;
309
310
  private progressPayload;
310
311
  private dragContextBuf;
@@ -397,7 +398,6 @@ declare class BottomSheetCore {
397
398
  private allowedIdsBySize;
398
399
  private updateAriaSlider;
399
400
  private registerInStack;
400
- private repaintScrim;
401
401
  private applyStackDepth;
402
402
  private buildGestureDeps;
403
403
  private isContentDragAllowed;
@@ -1,4 +1,4 @@
1
- import { B as BottomSheetCore, c as EngineOptions } from './BottomSheetCore-CK8Rh1He.cjs';
1
+ import { B as BottomSheetCore, c as EngineOptions } from './BottomSheetCore-BHv6LPmS.cjs';
2
2
 
3
3
  declare class BottomSheetEngine extends BottomSheetCore {
4
4
  constructor(opts: EngineOptions);
@@ -1,4 +1,4 @@
1
- import { B as BottomSheetCore, c as EngineOptions } from './BottomSheetCore-CIijwtdi.js';
1
+ import { B as BottomSheetCore, c as EngineOptions } from './BottomSheetCore-CK_mq14p.js';
2
2
 
3
3
  declare class BottomSheetEngine extends BottomSheetCore {
4
4
  constructor(opts: EngineOptions);
package/dist/core.cjs 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/core.d.cts CHANGED
@@ -1,3 +1,3 @@
1
- export { B as BottomSheetCore, C as CloseReason, f as EngineFeature, m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage, c as EngineOptions, E as EngineState, S as SheetEventMap, b as SheetMode, w as SnapId, d as SnapPoint, a as SnapPointDef } from './BottomSheetCore-CK8Rh1He.cjs';
2
- export { R as ResolvedSnap } from './index-BEX-NHRJ.cjs';
1
+ export { B as BottomSheetCore, C as CloseReason, f as EngineFeature, m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage, c as EngineOptions, E as EngineState, S as SheetEventMap, b as SheetMode, w as SnapId, d as SnapPoint, a as SnapPointDef } from './BottomSheetCore-BHv6LPmS.cjs';
2
+ export { R as ResolvedSnap } from './index-juAyT76E.cjs';
3
3
  import './transform-jVfAikE9.cjs';
package/dist/core.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { B as BottomSheetCore, C as CloseReason, f as EngineFeature, m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage, c as EngineOptions, E as EngineState, S as SheetEventMap, b as SheetMode, w as SnapId, d as SnapPoint, a as SnapPointDef } from './BottomSheetCore-CIijwtdi.js';
2
- export { R as ResolvedSnap } from './index-BqLHKOeM.js';
1
+ export { B as BottomSheetCore, C as CloseReason, f as EngineFeature, m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage, c as EngineOptions, E as EngineState, S as SheetEventMap, b as SheetMode, w as SnapId, d as SnapPoint, a as SnapPointDef } from './BottomSheetCore-CK_mq14p.js';
2
+ export { R as ResolvedSnap } from './index-CWKv1Xy4.js';
3
3
  import './transform-jVfAikE9.js';
package/dist/core.js CHANGED
@@ -772,7 +772,6 @@ var ScrimController = class {
772
772
  __publicField(this, "backdrop");
773
773
  __publicField(this, "mode");
774
774
  __publicField(this, "isDestroyed");
775
- __publicField(this, "isTopSheet");
776
775
  __publicField(this, "getAllowedIds");
777
776
  __publicField(this, "getResolvedSnaps");
778
777
  __publicField(this, "snapToFn");
@@ -794,7 +793,6 @@ var ScrimController = class {
794
793
  this.backdrop = deps.backdrop;
795
794
  this.mode = deps.mode;
796
795
  this.isDestroyed = deps.isDestroyed;
797
- this.isTopSheet = deps.isTopSheet;
798
796
  this.getAllowedIds = deps.getAllowedIds;
799
797
  this.getResolvedSnaps = deps.getResolvedSnaps;
800
798
  this.snapToFn = deps.snapTo;
@@ -839,8 +837,10 @@ var ScrimController = class {
839
837
  if (this.backdrop) {
840
838
  const [s, e] = this.backdropRange;
841
839
  const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
842
- const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
843
- const backdropOpacity = this.isTopSheet() ? ramp : 0;
840
+ const backdropOpacity = Math.min(
841
+ Math.max((progress - s) / range, 0),
842
+ 1
843
+ );
844
844
  if (this.backdropOpacitySentinel.shouldWrite(
845
845
  backdropOpacity,
846
846
  OPACITY_WRITE_EPSILON
@@ -2615,6 +2615,7 @@ var BottomSheetCore = class {
2615
2615
  __publicField(this, "progressWriteSentinel", new WriteSentinel());
2616
2616
  __publicField(this, "isTopSheet", true);
2617
2617
  __publicField(this, "opening", false);
2618
+ __publicField(this, "promotedForOpen", false);
2618
2619
  __publicField(this, "allowOvershoot", false);
2619
2620
  __publicField(this, "progressPayload", {
2620
2621
  value: 0,
@@ -2671,7 +2672,6 @@ var BottomSheetCore = class {
2671
2672
  screenComponent: this.screenComponent,
2672
2673
  backdrop: this.backdrop,
2673
2674
  isDestroyed: () => this.destroyed,
2674
- isTopSheet: () => this.isTopSheet,
2675
2675
  getAllowedIds: () => this.snaps.getAllowedIds().slice(),
2676
2676
  getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
2677
2677
  snapTo: (id) => {
@@ -2941,13 +2941,14 @@ var BottomSheetCore = class {
2941
2941
  if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
2942
2942
  return;
2943
2943
  }
2944
+ const resumingOpen = this.opening;
2944
2945
  const signal = this.newCycle();
2945
2946
  const onExternalAbort = () => {
2946
2947
  this.animation.cancel();
2947
2948
  this.newCycle();
2948
2949
  };
2949
2950
  externalSignal?.addEventListener("abort", onExternalAbort, { once: true });
2950
- const wasClosed = this.size === 0;
2951
+ const wasClosed = this.size === 0 || resumingOpen;
2951
2952
  const previousId = this.activeId;
2952
2953
  const previousSize = this.size;
2953
2954
  this.scrollCache.cache(previousId, previousSize, target.size);
@@ -2956,7 +2957,10 @@ var BottomSheetCore = class {
2956
2957
  const opensToRest = id === "closed" || rawTargetSize === 0;
2957
2958
  if (wasClosed && !opensToRest) {
2958
2959
  this.opening = true;
2959
- sheetStack.promote(this.id);
2960
+ if (!resumingOpen) {
2961
+ this.promotedForOpen = true;
2962
+ sheetStack.promote(this.id);
2963
+ }
2960
2964
  }
2961
2965
  if (this.animation.viewTransitionsAvailable) {
2962
2966
  this.currentViewTransition?.skipTransition?.();
@@ -3397,19 +3401,12 @@ var BottomSheetCore = class {
3397
3401
  for (const anchor of this.anchors) anchor.syncZ(z + 1);
3398
3402
  },
3399
3403
  setIsTop: (isTop) => {
3400
- if (this.isTopSheet === isTop) return;
3401
3404
  this.isTopSheet = isTop;
3402
- this.repaintScrim();
3403
3405
  },
3404
3406
  isOpen: () => this.size > 0 || this.opening,
3405
3407
  setDepth: (depth) => this.applyStackDepth(depth)
3406
3408
  }));
3407
3409
  }
3408
- repaintScrim() {
3409
- if (this.destroyed) return;
3410
- this.scrim.invalidateOpacityCache();
3411
- this.scrim.applyOpacity(this.computeProgress(this.size), true);
3412
- }
3413
3410
  applyStackDepth(depth) {
3414
3411
  if (!this.stackEffectEnabled) return;
3415
3412
  this.element.setAttribute("data-stack-depth", String(depth));
@@ -3654,6 +3651,7 @@ var BottomSheetCore = class {
3654
3651
  this.activeId = target.id;
3655
3652
  if (previousSnapSize === 0 && target.size > 0) {
3656
3653
  this.opening = true;
3654
+ this.promotedForOpen = true;
3657
3655
  sheetStack.promote(this.id);
3658
3656
  }
3659
3657
  const settleCap = this.snaps.getMaxAxisSize();
@@ -3735,7 +3733,8 @@ var BottomSheetCore = class {
3735
3733
  return Math.min(Math.max((size - min) / (reachableMax - min), 0), 1);
3736
3734
  }
3737
3735
  handleOpen() {
3738
- sheetStack.promote(this.id);
3736
+ if (this.promotedForOpen) this.promotedForOpen = false;
3737
+ else sheetStack.promote(this.id);
3739
3738
  try {
3740
3739
  this.lifecycle.install();
3741
3740
  } catch (err) {
@@ -3767,6 +3766,7 @@ var BottomSheetCore = class {
3767
3766
  }
3768
3767
  handleClose() {
3769
3768
  this.opening = false;
3769
+ this.promotedForOpen = false;
3770
3770
  this.lifecycle.release();
3771
3771
  sheetStack.update();
3772
3772
  }
package/dist/debug.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { E as EngineState, S as SheetEventMap } from './BottomSheetCore-CK8Rh1He.cjs';
1
+ import { E as EngineState, S as SheetEventMap } from './BottomSheetCore-BHv6LPmS.cjs';
2
2
  import './transform-jVfAikE9.cjs';
3
3
 
4
4
  type DebugOverlayPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
package/dist/debug.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { E as EngineState, S as SheetEventMap } from './BottomSheetCore-CIijwtdi.js';
1
+ import { E as EngineState, S as SheetEventMap } from './BottomSheetCore-CK_mq14p.js';
2
2
  import './transform-jVfAikE9.js';
3
3
 
4
4
  type DebugOverlayPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
package/dist/element.cjs CHANGED
@@ -885,7 +885,6 @@ var init_scrim_controller = __esm({
885
885
  __publicField(this, "backdrop");
886
886
  __publicField(this, "mode");
887
887
  __publicField(this, "isDestroyed");
888
- __publicField(this, "isTopSheet");
889
888
  __publicField(this, "getAllowedIds");
890
889
  __publicField(this, "getResolvedSnaps");
891
890
  __publicField(this, "snapToFn");
@@ -907,7 +906,6 @@ var init_scrim_controller = __esm({
907
906
  this.backdrop = deps.backdrop;
908
907
  this.mode = deps.mode;
909
908
  this.isDestroyed = deps.isDestroyed;
910
- this.isTopSheet = deps.isTopSheet;
911
909
  this.getAllowedIds = deps.getAllowedIds;
912
910
  this.getResolvedSnaps = deps.getResolvedSnaps;
913
911
  this.snapToFn = deps.snapTo;
@@ -952,8 +950,10 @@ var init_scrim_controller = __esm({
952
950
  if (this.backdrop) {
953
951
  const [s, e] = this.backdropRange;
954
952
  const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
955
- const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
956
- const backdropOpacity = this.isTopSheet() ? ramp : 0;
953
+ const backdropOpacity = Math.min(
954
+ Math.max((progress - s) / range, 0),
955
+ 1
956
+ );
957
957
  if (this.backdropOpacitySentinel.shouldWrite(
958
958
  backdropOpacity,
959
959
  OPACITY_WRITE_EPSILON
@@ -2895,6 +2895,7 @@ var init_BottomSheetCore = __esm({
2895
2895
  __publicField(this, "progressWriteSentinel", new WriteSentinel());
2896
2896
  __publicField(this, "isTopSheet", true);
2897
2897
  __publicField(this, "opening", false);
2898
+ __publicField(this, "promotedForOpen", false);
2898
2899
  __publicField(this, "allowOvershoot", false);
2899
2900
  __publicField(this, "progressPayload", {
2900
2901
  value: 0,
@@ -2951,7 +2952,6 @@ var init_BottomSheetCore = __esm({
2951
2952
  screenComponent: this.screenComponent,
2952
2953
  backdrop: this.backdrop,
2953
2954
  isDestroyed: () => this.destroyed,
2954
- isTopSheet: () => this.isTopSheet,
2955
2955
  getAllowedIds: () => this.snaps.getAllowedIds().slice(),
2956
2956
  getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
2957
2957
  snapTo: (id) => {
@@ -3221,13 +3221,14 @@ var init_BottomSheetCore = __esm({
3221
3221
  if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
3222
3222
  return;
3223
3223
  }
3224
+ const resumingOpen = this.opening;
3224
3225
  const signal = this.newCycle();
3225
3226
  const onExternalAbort = () => {
3226
3227
  this.animation.cancel();
3227
3228
  this.newCycle();
3228
3229
  };
3229
3230
  externalSignal?.addEventListener("abort", onExternalAbort, { once: true });
3230
- const wasClosed = this.size === 0;
3231
+ const wasClosed = this.size === 0 || resumingOpen;
3231
3232
  const previousId = this.activeId;
3232
3233
  const previousSize = this.size;
3233
3234
  this.scrollCache.cache(previousId, previousSize, target.size);
@@ -3236,7 +3237,10 @@ var init_BottomSheetCore = __esm({
3236
3237
  const opensToRest = id === "closed" || rawTargetSize === 0;
3237
3238
  if (wasClosed && !opensToRest) {
3238
3239
  this.opening = true;
3239
- sheetStack.promote(this.id);
3240
+ if (!resumingOpen) {
3241
+ this.promotedForOpen = true;
3242
+ sheetStack.promote(this.id);
3243
+ }
3240
3244
  }
3241
3245
  if (this.animation.viewTransitionsAvailable) {
3242
3246
  this.currentViewTransition?.skipTransition?.();
@@ -3677,19 +3681,12 @@ var init_BottomSheetCore = __esm({
3677
3681
  for (const anchor of this.anchors) anchor.syncZ(z + 1);
3678
3682
  },
3679
3683
  setIsTop: (isTop) => {
3680
- if (this.isTopSheet === isTop) return;
3681
3684
  this.isTopSheet = isTop;
3682
- this.repaintScrim();
3683
3685
  },
3684
3686
  isOpen: () => this.size > 0 || this.opening,
3685
3687
  setDepth: (depth) => this.applyStackDepth(depth)
3686
3688
  }));
3687
3689
  }
3688
- repaintScrim() {
3689
- if (this.destroyed) return;
3690
- this.scrim.invalidateOpacityCache();
3691
- this.scrim.applyOpacity(this.computeProgress(this.size), true);
3692
- }
3693
3690
  applyStackDepth(depth) {
3694
3691
  if (!this.stackEffectEnabled) return;
3695
3692
  this.element.setAttribute("data-stack-depth", String(depth));
@@ -3934,6 +3931,7 @@ var init_BottomSheetCore = __esm({
3934
3931
  this.activeId = target.id;
3935
3932
  if (previousSnapSize === 0 && target.size > 0) {
3936
3933
  this.opening = true;
3934
+ this.promotedForOpen = true;
3937
3935
  sheetStack.promote(this.id);
3938
3936
  }
3939
3937
  const settleCap = this.snaps.getMaxAxisSize();
@@ -4015,7 +4013,8 @@ var init_BottomSheetCore = __esm({
4015
4013
  return Math.min(Math.max((size - min) / (reachableMax - min), 0), 1);
4016
4014
  }
4017
4015
  handleOpen() {
4018
- sheetStack.promote(this.id);
4016
+ if (this.promotedForOpen) this.promotedForOpen = false;
4017
+ else sheetStack.promote(this.id);
4019
4018
  try {
4020
4019
  this.lifecycle.install();
4021
4020
  } catch (err) {
@@ -4047,6 +4046,7 @@ var init_BottomSheetCore = __esm({
4047
4046
  }
4048
4047
  handleClose() {
4049
4048
  this.opening = false;
4049
+ this.promotedForOpen = false;
4050
4050
  this.lifecycle.release();
4051
4051
  sheetStack.update();
4052
4052
  }
@@ -1,5 +1,5 @@
1
- import { B as BottomSheetEngine } from './BottomSheetEngine-hLSAxzla.cjs';
2
- import { C as CloseReason, A as AnchorOptions, e as ScrimStagesOptions, E as EngineState } from './BottomSheetCore-CK8Rh1He.cjs';
1
+ import { B as BottomSheetEngine } from './BottomSheetEngine-mmFzIK1Z.cjs';
2
+ import { C as CloseReason, A as AnchorOptions, e as ScrimStagesOptions, E as EngineState } from './BottomSheetCore-BHv6LPmS.cjs';
3
3
  import './transform-jVfAikE9.cjs';
4
4
 
5
5
  declare const BaseHTMLElement: typeof HTMLElement;
package/dist/element.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as BottomSheetEngine } from './BottomSheetEngine-CZglPsTF.js';
2
- import { C as CloseReason, A as AnchorOptions, e as ScrimStagesOptions, E as EngineState } from './BottomSheetCore-CIijwtdi.js';
1
+ import { B as BottomSheetEngine } from './BottomSheetEngine-wLn6Q2kA.js';
2
+ import { C as CloseReason, A as AnchorOptions, e as ScrimStagesOptions, E as EngineState } from './BottomSheetCore-CK_mq14p.js';
3
3
  import './transform-jVfAikE9.js';
4
4
 
5
5
  declare const BaseHTMLElement: typeof HTMLElement;