@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/element.js CHANGED
@@ -883,7 +883,6 @@ var init_scrim_controller = __esm({
883
883
  __publicField(this, "backdrop");
884
884
  __publicField(this, "mode");
885
885
  __publicField(this, "isDestroyed");
886
- __publicField(this, "isTopSheet");
887
886
  __publicField(this, "getAllowedIds");
888
887
  __publicField(this, "getResolvedSnaps");
889
888
  __publicField(this, "snapToFn");
@@ -905,7 +904,6 @@ var init_scrim_controller = __esm({
905
904
  this.backdrop = deps.backdrop;
906
905
  this.mode = deps.mode;
907
906
  this.isDestroyed = deps.isDestroyed;
908
- this.isTopSheet = deps.isTopSheet;
909
907
  this.getAllowedIds = deps.getAllowedIds;
910
908
  this.getResolvedSnaps = deps.getResolvedSnaps;
911
909
  this.snapToFn = deps.snapTo;
@@ -950,8 +948,10 @@ var init_scrim_controller = __esm({
950
948
  if (this.backdrop) {
951
949
  const [s, e] = this.backdropRange;
952
950
  const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
953
- const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
954
- const backdropOpacity = this.isTopSheet() ? ramp : 0;
951
+ const backdropOpacity = Math.min(
952
+ Math.max((progress - s) / range, 0),
953
+ 1
954
+ );
955
955
  if (this.backdropOpacitySentinel.shouldWrite(
956
956
  backdropOpacity,
957
957
  OPACITY_WRITE_EPSILON
@@ -2893,6 +2893,7 @@ var init_BottomSheetCore = __esm({
2893
2893
  __publicField(this, "progressWriteSentinel", new WriteSentinel());
2894
2894
  __publicField(this, "isTopSheet", true);
2895
2895
  __publicField(this, "opening", false);
2896
+ __publicField(this, "promotedForOpen", false);
2896
2897
  __publicField(this, "allowOvershoot", false);
2897
2898
  __publicField(this, "progressPayload", {
2898
2899
  value: 0,
@@ -2949,7 +2950,6 @@ var init_BottomSheetCore = __esm({
2949
2950
  screenComponent: this.screenComponent,
2950
2951
  backdrop: this.backdrop,
2951
2952
  isDestroyed: () => this.destroyed,
2952
- isTopSheet: () => this.isTopSheet,
2953
2953
  getAllowedIds: () => this.snaps.getAllowedIds().slice(),
2954
2954
  getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
2955
2955
  snapTo: (id) => {
@@ -3219,13 +3219,14 @@ var init_BottomSheetCore = __esm({
3219
3219
  if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
3220
3220
  return;
3221
3221
  }
3222
+ const resumingOpen = this.opening;
3222
3223
  const signal = this.newCycle();
3223
3224
  const onExternalAbort = () => {
3224
3225
  this.animation.cancel();
3225
3226
  this.newCycle();
3226
3227
  };
3227
3228
  externalSignal?.addEventListener("abort", onExternalAbort, { once: true });
3228
- const wasClosed = this.size === 0;
3229
+ const wasClosed = this.size === 0 || resumingOpen;
3229
3230
  const previousId = this.activeId;
3230
3231
  const previousSize = this.size;
3231
3232
  this.scrollCache.cache(previousId, previousSize, target.size);
@@ -3234,7 +3235,10 @@ var init_BottomSheetCore = __esm({
3234
3235
  const opensToRest = id === "closed" || rawTargetSize === 0;
3235
3236
  if (wasClosed && !opensToRest) {
3236
3237
  this.opening = true;
3237
- sheetStack.promote(this.id);
3238
+ if (!resumingOpen) {
3239
+ this.promotedForOpen = true;
3240
+ sheetStack.promote(this.id);
3241
+ }
3238
3242
  }
3239
3243
  if (this.animation.viewTransitionsAvailable) {
3240
3244
  this.currentViewTransition?.skipTransition?.();
@@ -3675,19 +3679,12 @@ var init_BottomSheetCore = __esm({
3675
3679
  for (const anchor of this.anchors) anchor.syncZ(z + 1);
3676
3680
  },
3677
3681
  setIsTop: (isTop) => {
3678
- if (this.isTopSheet === isTop) return;
3679
3682
  this.isTopSheet = isTop;
3680
- this.repaintScrim();
3681
3683
  },
3682
3684
  isOpen: () => this.size > 0 || this.opening,
3683
3685
  setDepth: (depth) => this.applyStackDepth(depth)
3684
3686
  }));
3685
3687
  }
3686
- repaintScrim() {
3687
- if (this.destroyed) return;
3688
- this.scrim.invalidateOpacityCache();
3689
- this.scrim.applyOpacity(this.computeProgress(this.size), true);
3690
- }
3691
3688
  applyStackDepth(depth) {
3692
3689
  if (!this.stackEffectEnabled) return;
3693
3690
  this.element.setAttribute("data-stack-depth", String(depth));
@@ -3932,6 +3929,7 @@ var init_BottomSheetCore = __esm({
3932
3929
  this.activeId = target.id;
3933
3930
  if (previousSnapSize === 0 && target.size > 0) {
3934
3931
  this.opening = true;
3932
+ this.promotedForOpen = true;
3935
3933
  sheetStack.promote(this.id);
3936
3934
  }
3937
3935
  const settleCap = this.snaps.getMaxAxisSize();
@@ -4013,7 +4011,8 @@ var init_BottomSheetCore = __esm({
4013
4011
  return Math.min(Math.max((size - min) / (reachableMax - min), 0), 1);
4014
4012
  }
4015
4013
  handleOpen() {
4016
- sheetStack.promote(this.id);
4014
+ if (this.promotedForOpen) this.promotedForOpen = false;
4015
+ else sheetStack.promote(this.id);
4017
4016
  try {
4018
4017
  this.lifecycle.install();
4019
4018
  } catch (err) {
@@ -4045,6 +4044,7 @@ var init_BottomSheetCore = __esm({
4045
4044
  }
4046
4045
  handleClose() {
4047
4046
  this.opening = false;
4047
+ this.promotedForOpen = false;
4048
4048
  this.lifecycle.release();
4049
4049
  sheetStack.update();
4050
4050
  }
@@ -1,5 +1,5 @@
1
- import { f as EngineFeature } from './BottomSheetCore-CK8Rh1He.cjs';
2
- export { m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage } from './BottomSheetCore-CK8Rh1He.cjs';
1
+ import { f as EngineFeature } from './BottomSheetCore-BHv6LPmS.cjs';
2
+ export { m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage } from './BottomSheetCore-BHv6LPmS.cjs';
3
3
  import './transform-jVfAikE9.cjs';
4
4
 
5
5
  declare function routeFeature(): EngineFeature;
@@ -1,5 +1,5 @@
1
- import { f as EngineFeature } from './BottomSheetCore-CIijwtdi.js';
2
- export { m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage } from './BottomSheetCore-CIijwtdi.js';
1
+ import { f as EngineFeature } from './BottomSheetCore-CK_mq14p.js';
2
+ export { m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage } from './BottomSheetCore-CK_mq14p.js';
3
3
  import './transform-jVfAikE9.js';
4
4
 
5
5
  declare function routeFeature(): EngineFeature;
@@ -1,4 +1,4 @@
1
- import { a as SnapPointDef, b as SheetMode } from './BottomSheetCore-CIijwtdi.js';
1
+ import { a as SnapPointDef, b as SheetMode } from './BottomSheetCore-CK_mq14p.js';
2
2
 
3
3
  type ResolvedSnap = {
4
4
  id: string;
@@ -1,4 +1,4 @@
1
- import { a as SnapPointDef, b as SheetMode } from './BottomSheetCore-CK8Rh1He.cjs';
1
+ import { a as SnapPointDef, b as SheetMode } from './BottomSheetCore-BHv6LPmS.cjs';
2
2
 
3
3
  type ResolvedSnap = {
4
4
  id: string;
package/dist/index.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/index.d.cts CHANGED
@@ -1,8 +1,8 @@
1
- export { B as BottomSheetEngine } from './BottomSheetEngine-hLSAxzla.cjs';
2
- import { d as SnapPoint, b as SheetMode, c as EngineOptions, P as PhysicalSheetMode, g as ScrimOverlayPosition } from './BottomSheetCore-CK8Rh1He.cjs';
3
- export { h as AnchorAnimationPreset, i as AnchorAnimationSpec, j as AnchorHandle, A as AnchorOptions, k as AnchorPosition, l as AnchorState, B as BottomSheetCore, C as CloseReason, f as EngineFeature, m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage, E as EngineState, L as LogicalSheetMode, p as Plugin, q as SCRIM_PRESETS, r as ScrimOverlayOptions, s as ScrimPreset, t as ScrimPresetConfig, u as ScrimStageDef, e as ScrimStagesOptions, v as ScrimUpdate, S as SheetEventMap, w as SnapId, a as SnapPointDef, T as TeardownScope, x as runAnchorTransition } from './BottomSheetCore-CK8Rh1He.cjs';
1
+ export { B as BottomSheetEngine } from './BottomSheetEngine-mmFzIK1Z.cjs';
2
+ import { d as SnapPoint, b as SheetMode, c as EngineOptions, P as PhysicalSheetMode, g as ScrimOverlayPosition } from './BottomSheetCore-BHv6LPmS.cjs';
3
+ export { h as AnchorAnimationPreset, i as AnchorAnimationSpec, j as AnchorHandle, A as AnchorOptions, k as AnchorPosition, l as AnchorState, B as BottomSheetCore, C as CloseReason, f as EngineFeature, m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage, E as EngineState, L as LogicalSheetMode, p as Plugin, q as SCRIM_PRESETS, r as ScrimOverlayOptions, s as ScrimPreset, t as ScrimPresetConfig, u as ScrimStageDef, e as ScrimStagesOptions, v as ScrimUpdate, S as SheetEventMap, w as SnapId, a as SnapPointDef, T as TeardownScope, x as runAnchorTransition } from './BottomSheetCore-BHv6LPmS.cjs';
4
4
  export { autoCollapseFeature, contentSwipeFeature, defaultEngineFeatures, persistFeature, routeFeature, visualViewportFeature } from './features.cjs';
5
- export { R as ResolvedSnap, r as resolveSnapList } from './index-BEX-NHRJ.cjs';
5
+ export { R as ResolvedSnap, r as resolveSnapList } from './index-juAyT76E.cjs';
6
6
  import './transform-jVfAikE9.cjs';
7
7
 
8
8
  declare const resolveSnap: (point: SnapPoint | string, mode: SheetMode, measureFit?: () => number) => number;
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export { B as BottomSheetEngine } from './BottomSheetEngine-CZglPsTF.js';
2
- import { d as SnapPoint, b as SheetMode, c as EngineOptions, P as PhysicalSheetMode, g as ScrimOverlayPosition } from './BottomSheetCore-CIijwtdi.js';
3
- export { h as AnchorAnimationPreset, i as AnchorAnimationSpec, j as AnchorHandle, A as AnchorOptions, k as AnchorPosition, l as AnchorState, B as BottomSheetCore, C as CloseReason, f as EngineFeature, m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage, E as EngineState, L as LogicalSheetMode, p as Plugin, q as SCRIM_PRESETS, r as ScrimOverlayOptions, s as ScrimPreset, t as ScrimPresetConfig, u as ScrimStageDef, e as ScrimStagesOptions, v as ScrimUpdate, S as SheetEventMap, w as SnapId, a as SnapPointDef, T as TeardownScope, x as runAnchorTransition } from './BottomSheetCore-CIijwtdi.js';
1
+ export { B as BottomSheetEngine } from './BottomSheetEngine-wLn6Q2kA.js';
2
+ import { d as SnapPoint, b as SheetMode, c as EngineOptions, P as PhysicalSheetMode, g as ScrimOverlayPosition } from './BottomSheetCore-CK_mq14p.js';
3
+ export { h as AnchorAnimationPreset, i as AnchorAnimationSpec, j as AnchorHandle, A as AnchorOptions, k as AnchorPosition, l as AnchorState, B as BottomSheetCore, C as CloseReason, f as EngineFeature, m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage, E as EngineState, L as LogicalSheetMode, p as Plugin, q as SCRIM_PRESETS, r as ScrimOverlayOptions, s as ScrimPreset, t as ScrimPresetConfig, u as ScrimStageDef, e as ScrimStagesOptions, v as ScrimUpdate, S as SheetEventMap, w as SnapId, a as SnapPointDef, T as TeardownScope, x as runAnchorTransition } from './BottomSheetCore-CK_mq14p.js';
4
4
  export { autoCollapseFeature, contentSwipeFeature, defaultEngineFeatures, persistFeature, routeFeature, visualViewportFeature } from './features.js';
5
- export { R as ResolvedSnap, r as resolveSnapList } from './index-BqLHKOeM.js';
5
+ export { R as ResolvedSnap, r as resolveSnapList } from './index-CWKv1Xy4.js';
6
6
  import './transform-jVfAikE9.js';
7
7
 
8
8
  declare const resolveSnap: (point: SnapPoint | string, mode: SheetMode, measureFit?: () => number) => number;
package/dist/index.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
  }
@@ -1,4 +1,4 @@
1
- import { S as SheetEventMap } from '../BottomSheetCore-CK8Rh1He.cjs';
1
+ import { S as SheetEventMap } from '../BottomSheetCore-BHv6LPmS.cjs';
2
2
  import '../transform-jVfAikE9.cjs';
3
3
 
4
4
  type FormikStateLike = {
@@ -1,4 +1,4 @@
1
- import { S as SheetEventMap } from '../BottomSheetCore-CIijwtdi.js';
1
+ import { S as SheetEventMap } from '../BottomSheetCore-CK_mq14p.js';
2
2
  import '../transform-jVfAikE9.js';
3
3
 
4
4
  type FormikStateLike = {
@@ -1,4 +1,4 @@
1
- import { S as SheetEventMap } from '../BottomSheetCore-CK8Rh1He.cjs';
1
+ import { S as SheetEventMap } from '../BottomSheetCore-BHv6LPmS.cjs';
2
2
  import '../transform-jVfAikE9.cjs';
3
3
 
4
4
  type RhfFormStateLike = {
@@ -1,4 +1,4 @@
1
- import { S as SheetEventMap } from '../BottomSheetCore-CIijwtdi.js';
1
+ import { S as SheetEventMap } from '../BottomSheetCore-CK_mq14p.js';
2
2
  import '../transform-jVfAikE9.js';
3
3
 
4
4
  type RhfFormStateLike = {
package/dist/preact.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { BottomSheet, BottomSheetFromConfig, BottomSheetFromConfigProps, BottomSheetHandle, BottomSheetProps, HeaderProp, Overlay, OverlayHandle, OverlayProps, SheetConfig, UseBottomSheetRefs, UseBottomSheetReturn, UseOverlayReturn, useBottomSheet, useOverlay } from './react.cjs';
2
- export { E as EngineState, b as SheetMode, d as SnapPoint, a as SnapPointDef } from './BottomSheetCore-CK8Rh1He.cjs';
2
+ export { E as EngineState, b as SheetMode, d as SnapPoint, a as SnapPointDef } from './BottomSheetCore-BHv6LPmS.cjs';
3
3
  export { OverlayEdge, OverlayOptions, OverlayState } from './overlay.cjs';
4
4
  import 'react';
5
- import './BottomSheetEngine-hLSAxzla.cjs';
5
+ import './BottomSheetEngine-mmFzIK1Z.cjs';
6
6
  import './teleport-7uYNiEAT.cjs';
7
7
  import './transform-jVfAikE9.cjs';
package/dist/preact.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { BottomSheet, BottomSheetFromConfig, BottomSheetFromConfigProps, BottomSheetHandle, BottomSheetProps, HeaderProp, Overlay, OverlayHandle, OverlayProps, SheetConfig, UseBottomSheetRefs, UseBottomSheetReturn, UseOverlayReturn, useBottomSheet, useOverlay } from './react.js';
2
- export { E as EngineState, b as SheetMode, d as SnapPoint, a as SnapPointDef } from './BottomSheetCore-CIijwtdi.js';
2
+ export { E as EngineState, b as SheetMode, d as SnapPoint, a as SnapPointDef } from './BottomSheetCore-CK_mq14p.js';
3
3
  export { OverlayEdge, OverlayOptions, OverlayState } from './overlay.js';
4
4
  import 'react';
5
- import './BottomSheetEngine-CZglPsTF.js';
5
+ import './BottomSheetEngine-wLn6Q2kA.js';
6
6
  import './teleport-7uYNiEAT.js';
7
7
  import './transform-jVfAikE9.js';
@@ -783,7 +783,6 @@ class ScrimController {
783
783
  __publicField(this, "backdrop");
784
784
  __publicField(this, "mode");
785
785
  __publicField(this, "isDestroyed");
786
- __publicField(this, "isTopSheet");
787
786
  __publicField(this, "getAllowedIds");
788
787
  __publicField(this, "getResolvedSnaps");
789
788
  __publicField(this, "snapToFn");
@@ -805,7 +804,6 @@ class ScrimController {
805
804
  this.backdrop = deps.backdrop;
806
805
  this.mode = deps.mode;
807
806
  this.isDestroyed = deps.isDestroyed;
808
- this.isTopSheet = deps.isTopSheet;
809
807
  this.getAllowedIds = deps.getAllowedIds;
810
808
  this.getResolvedSnaps = deps.getResolvedSnaps;
811
809
  this.snapToFn = deps.snapTo;
@@ -856,8 +854,7 @@ class ScrimController {
856
854
  if (this.backdrop) {
857
855
  const [s, e] = this.backdropRange;
858
856
  const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
859
- const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
860
- const backdropOpacity = this.isTopSheet() ? ramp : 0;
857
+ const backdropOpacity = Math.min(Math.max((progress - s) / range, 0), 1);
861
858
  if (this.backdropOpacitySentinel.shouldWrite(backdropOpacity, OPACITY_WRITE_EPSILON)) {
862
859
  this.backdrop.style.opacity = String(backdropOpacity);
863
860
  }
@@ -2664,6 +2661,7 @@ class BottomSheetCore {
2664
2661
  __publicField(this, "progressWriteSentinel", new WriteSentinel());
2665
2662
  __publicField(this, "isTopSheet", true);
2666
2663
  __publicField(this, "opening", false);
2664
+ __publicField(this, "promotedForOpen", false);
2667
2665
  __publicField(this, "allowOvershoot", false);
2668
2666
  __publicField(this, "progressPayload", {
2669
2667
  value: 0,
@@ -2720,7 +2718,6 @@ class BottomSheetCore {
2720
2718
  screenComponent: this.screenComponent,
2721
2719
  backdrop: this.backdrop,
2722
2720
  isDestroyed: () => this.destroyed,
2723
- isTopSheet: () => this.isTopSheet,
2724
2721
  getAllowedIds: () => this.snaps.getAllowedIds().slice(),
2725
2722
  getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
2726
2723
  snapTo: (id) => {
@@ -2968,6 +2965,7 @@ class BottomSheetCore {
2968
2965
  if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
2969
2966
  return;
2970
2967
  }
2968
+ const resumingOpen = this.opening;
2971
2969
  const signal = this.newCycle();
2972
2970
  const onExternalAbort = () => {
2973
2971
  this.animation.cancel();
@@ -2976,7 +2974,7 @@ class BottomSheetCore {
2976
2974
  externalSignal?.addEventListener("abort", onExternalAbort, {
2977
2975
  once: true
2978
2976
  });
2979
- const wasClosed = this.size === 0;
2977
+ const wasClosed = this.size === 0 || resumingOpen;
2980
2978
  const previousId = this.activeId;
2981
2979
  const previousSize = this.size;
2982
2980
  this.scrollCache.cache(previousId, previousSize, target.size);
@@ -2985,7 +2983,10 @@ class BottomSheetCore {
2985
2983
  const opensToRest = id === "closed" || rawTargetSize === 0;
2986
2984
  if (wasClosed && !opensToRest) {
2987
2985
  this.opening = true;
2988
- sheetStack.promote(this.id);
2986
+ if (!resumingOpen) {
2987
+ this.promotedForOpen = true;
2988
+ sheetStack.promote(this.id);
2989
+ }
2989
2990
  }
2990
2991
  if (this.animation.viewTransitionsAvailable) {
2991
2992
  this.currentViewTransition?.skipTransition?.();
@@ -3424,19 +3425,12 @@ class BottomSheetCore {
3424
3425
  for (const anchor of this.anchors) anchor.syncZ(z + 1);
3425
3426
  },
3426
3427
  setIsTop: (isTop) => {
3427
- if (this.isTopSheet === isTop) return;
3428
3428
  this.isTopSheet = isTop;
3429
- this.repaintScrim();
3430
3429
  },
3431
3430
  isOpen: () => this.size > 0 || this.opening,
3432
3431
  setDepth: (depth) => this.applyStackDepth(depth)
3433
3432
  }));
3434
3433
  }
3435
- repaintScrim() {
3436
- if (this.destroyed) return;
3437
- this.scrim.invalidateOpacityCache();
3438
- this.scrim.applyOpacity(this.computeProgress(this.size), true);
3439
- }
3440
3434
  applyStackDepth(depth) {
3441
3435
  if (!this.stackEffectEnabled) return;
3442
3436
  this.element.setAttribute("data-stack-depth", String(depth));
@@ -3672,6 +3666,7 @@ class BottomSheetCore {
3672
3666
  this.activeId = target.id;
3673
3667
  if (previousSnapSize === 0 && target.size > 0) {
3674
3668
  this.opening = true;
3669
+ this.promotedForOpen = true;
3675
3670
  sheetStack.promote(this.id);
3676
3671
  }
3677
3672
  const settleCap = this.snaps.getMaxAxisSize();
@@ -3744,7 +3739,8 @@ class BottomSheetCore {
3744
3739
  return Math.min(Math.max((size - min) / (reachableMax - min), 0), 1);
3745
3740
  }
3746
3741
  handleOpen() {
3747
- sheetStack.promote(this.id);
3742
+ if (this.promotedForOpen) this.promotedForOpen = false;
3743
+ else sheetStack.promote(this.id);
3748
3744
  try {
3749
3745
  this.lifecycle.install();
3750
3746
  } catch (err) {
@@ -3776,6 +3772,7 @@ class BottomSheetCore {
3776
3772
  }
3777
3773
  handleClose() {
3778
3774
  this.opening = false;
3775
+ this.promotedForOpen = false;
3779
3776
  this.lifecycle.release();
3780
3777
  sheetStack.update();
3781
3778
  }