@surdeddd/bottom-sheet 0.21.0 → 0.21.2
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.
- package/README.md +9 -0
- package/dist/{BottomSheetCore-CK8Rh1He.d.cts → BottomSheetCore-BHv6LPmS.d.cts} +1 -1
- package/dist/{BottomSheetCore-CIijwtdi.d.ts → BottomSheetCore-CK_mq14p.d.ts} +1 -1
- package/dist/{BottomSheetEngine-hLSAxzla.d.cts → BottomSheetEngine-mmFzIK1Z.d.cts} +1 -1
- package/dist/{BottomSheetEngine-CZglPsTF.d.ts → BottomSheetEngine-wLn6Q2kA.d.ts} +1 -1
- package/dist/core.cjs +31 -21
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +31 -21
- package/dist/debug.d.cts +1 -1
- package/dist/debug.d.ts +1 -1
- package/dist/element.cjs +37 -26
- package/dist/element.d.cts +2 -2
- package/dist/element.d.ts +2 -2
- package/dist/element.iife.global.js +2 -2
- package/dist/element.js +37 -26
- package/dist/features.d.cts +2 -2
- package/dist/features.d.ts +2 -2
- package/dist/{index-BqLHKOeM.d.ts → index-CWKv1Xy4.d.ts} +1 -1
- package/dist/{index-BEX-NHRJ.d.cts → index-juAyT76E.d.cts} +1 -1
- package/dist/index.cjs +31 -21
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +31 -21
- package/dist/integrations/formik.d.cts +1 -1
- package/dist/integrations/formik.d.ts +1 -1
- package/dist/integrations/react-hook-form.d.cts +1 -1
- package/dist/integrations/react-hook-form.d.ts +1 -1
- package/dist/preact.d.cts +2 -2
- package/dist/preact.d.ts +2 -2
- package/dist/qwik-lib/index.qwik.cjs +29 -19
- package/dist/qwik-lib/index.qwik.mjs +29 -19
- package/dist/qwik.cjs +31 -21
- package/dist/qwik.d.cts +2 -2
- package/dist/qwik.d.ts +2 -2
- package/dist/qwik.js +31 -21
- package/dist/react.cjs +31 -21
- package/dist/react.d.cts +3 -3
- package/dist/react.d.ts +3 -3
- package/dist/react.js +31 -21
- package/dist/solid.cjs +31 -21
- package/dist/solid.d.cts +1 -1
- package/dist/solid.d.ts +1 -1
- package/dist/solid.js +31 -21
- package/dist/solid.source.jsx +31 -21
- package/dist/svelte-core.cjs +31 -21
- package/dist/svelte-core.js +31 -21
- package/dist/svelte.cjs +31 -21
- package/dist/svelte.js +31 -21
- package/dist/vue.cjs +31 -21
- package/dist/vue.js +31 -21
- package/dist/webgl.d.cts +1 -1
- package/dist/webgl.d.ts +1 -1
- package/package.json +2 -2
package/dist/react.cjs
CHANGED
|
@@ -385,14 +385,26 @@ function notifyLinkedSheets(sheets, self) {
|
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
387
|
|
|
388
|
+
// src/core/primitives/hot-path-thresholds.ts
|
|
389
|
+
var SIZE_WRITE_EPSILON = 0.5;
|
|
390
|
+
var OPACITY_WRITE_EPSILON = 5e-3;
|
|
391
|
+
var POINTER_EVENTS_OPACITY_THRESHOLD = 0.05;
|
|
392
|
+
var RANGE_DIVISION_EPSILON = 1e-4;
|
|
393
|
+
|
|
388
394
|
// src/core/features/resize-observer.ts
|
|
389
395
|
function installResizeObserver(deps) {
|
|
390
396
|
if (typeof window === "undefined") {
|
|
391
397
|
return () => {
|
|
392
398
|
};
|
|
393
399
|
}
|
|
400
|
+
const seatFor = () => {
|
|
401
|
+
const snap = deps.resolveActiveSnap();
|
|
402
|
+
const max = deps.getMaxAxisSize();
|
|
403
|
+
return { target: snap ? Math.min(snap.size, max) : null, max };
|
|
404
|
+
};
|
|
394
405
|
const onResize = () => {
|
|
395
406
|
if (deps.isDestroyed()) return;
|
|
407
|
+
const before = seatFor();
|
|
396
408
|
deps.recomputeSnaps();
|
|
397
409
|
const mode = deps.getMode();
|
|
398
410
|
const isVerticalAxis = mode === "bottom" || mode === "top";
|
|
@@ -401,6 +413,10 @@ function installResizeObserver(deps) {
|
|
|
401
413
|
if (viewportSize2 > 0 && viewportSize2 < max) {
|
|
402
414
|
deps.setMaxAxisSize(viewportSize2);
|
|
403
415
|
}
|
|
416
|
+
const after = seatFor();
|
|
417
|
+
if (before.target !== null && after.target !== null && Math.abs(after.target - before.target) < SIZE_WRITE_EPSILON && Math.abs(after.max - before.max) < SIZE_WRITE_EPSILON) {
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
404
420
|
const wasAnimating = deps.isAnimating?.() ?? false;
|
|
405
421
|
deps.cancelInFlight();
|
|
406
422
|
deps.newCycle();
|
|
@@ -669,12 +685,6 @@ var SCRIM_PRESETS = Object.freeze({
|
|
|
669
685
|
}
|
|
670
686
|
});
|
|
671
687
|
|
|
672
|
-
// src/core/primitives/hot-path-thresholds.ts
|
|
673
|
-
var SIZE_WRITE_EPSILON = 0.5;
|
|
674
|
-
var OPACITY_WRITE_EPSILON = 5e-3;
|
|
675
|
-
var POINTER_EVENTS_OPACITY_THRESHOLD = 0.05;
|
|
676
|
-
var RANGE_DIVISION_EPSILON = 1e-4;
|
|
677
|
-
|
|
678
688
|
// src/core/primitives/opacity-dedup.ts
|
|
679
689
|
var WriteSentinel = class {
|
|
680
690
|
constructor() {
|
|
@@ -784,7 +794,6 @@ var ScrimController = class {
|
|
|
784
794
|
__publicField(this, "backdrop");
|
|
785
795
|
__publicField(this, "mode");
|
|
786
796
|
__publicField(this, "isDestroyed");
|
|
787
|
-
__publicField(this, "isTopSheet");
|
|
788
797
|
__publicField(this, "getAllowedIds");
|
|
789
798
|
__publicField(this, "getResolvedSnaps");
|
|
790
799
|
__publicField(this, "snapToFn");
|
|
@@ -806,7 +815,6 @@ var ScrimController = class {
|
|
|
806
815
|
this.backdrop = deps.backdrop;
|
|
807
816
|
this.mode = deps.mode;
|
|
808
817
|
this.isDestroyed = deps.isDestroyed;
|
|
809
|
-
this.isTopSheet = deps.isTopSheet;
|
|
810
818
|
this.getAllowedIds = deps.getAllowedIds;
|
|
811
819
|
this.getResolvedSnaps = deps.getResolvedSnaps;
|
|
812
820
|
this.snapToFn = deps.snapTo;
|
|
@@ -851,8 +859,10 @@ var ScrimController = class {
|
|
|
851
859
|
if (this.backdrop) {
|
|
852
860
|
const [s, e] = this.backdropRange;
|
|
853
861
|
const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
|
|
854
|
-
const
|
|
855
|
-
|
|
862
|
+
const backdropOpacity = Math.min(
|
|
863
|
+
Math.max((progress - s) / range, 0),
|
|
864
|
+
1
|
|
865
|
+
);
|
|
856
866
|
if (this.backdropOpacitySentinel.shouldWrite(
|
|
857
867
|
backdropOpacity,
|
|
858
868
|
OPACITY_WRITE_EPSILON
|
|
@@ -2627,6 +2637,7 @@ var BottomSheetCore = class {
|
|
|
2627
2637
|
__publicField(this, "progressWriteSentinel", new WriteSentinel());
|
|
2628
2638
|
__publicField(this, "isTopSheet", true);
|
|
2629
2639
|
__publicField(this, "opening", false);
|
|
2640
|
+
__publicField(this, "promotedForOpen", false);
|
|
2630
2641
|
__publicField(this, "allowOvershoot", false);
|
|
2631
2642
|
__publicField(this, "progressPayload", {
|
|
2632
2643
|
value: 0,
|
|
@@ -2683,7 +2694,6 @@ var BottomSheetCore = class {
|
|
|
2683
2694
|
screenComponent: this.screenComponent,
|
|
2684
2695
|
backdrop: this.backdrop,
|
|
2685
2696
|
isDestroyed: () => this.destroyed,
|
|
2686
|
-
isTopSheet: () => this.isTopSheet,
|
|
2687
2697
|
getAllowedIds: () => this.snaps.getAllowedIds().slice(),
|
|
2688
2698
|
getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
|
|
2689
2699
|
snapTo: (id) => {
|
|
@@ -2953,13 +2963,14 @@ var BottomSheetCore = class {
|
|
|
2953
2963
|
if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
|
|
2954
2964
|
return;
|
|
2955
2965
|
}
|
|
2966
|
+
const resumingOpen = this.opening;
|
|
2956
2967
|
const signal = this.newCycle();
|
|
2957
2968
|
const onExternalAbort = () => {
|
|
2958
2969
|
this.animation.cancel();
|
|
2959
2970
|
this.newCycle();
|
|
2960
2971
|
};
|
|
2961
2972
|
externalSignal?.addEventListener("abort", onExternalAbort, { once: true });
|
|
2962
|
-
const wasClosed = this.size === 0;
|
|
2973
|
+
const wasClosed = this.size === 0 || resumingOpen;
|
|
2963
2974
|
const previousId = this.activeId;
|
|
2964
2975
|
const previousSize = this.size;
|
|
2965
2976
|
this.scrollCache.cache(previousId, previousSize, target.size);
|
|
@@ -2968,7 +2979,10 @@ var BottomSheetCore = class {
|
|
|
2968
2979
|
const opensToRest = id === "closed" || rawTargetSize === 0;
|
|
2969
2980
|
if (wasClosed && !opensToRest) {
|
|
2970
2981
|
this.opening = true;
|
|
2971
|
-
|
|
2982
|
+
if (!resumingOpen) {
|
|
2983
|
+
this.promotedForOpen = true;
|
|
2984
|
+
sheetStack.promote(this.id);
|
|
2985
|
+
}
|
|
2972
2986
|
}
|
|
2973
2987
|
if (this.animation.viewTransitionsAvailable) {
|
|
2974
2988
|
this.currentViewTransition?.skipTransition?.();
|
|
@@ -3409,19 +3423,12 @@ var BottomSheetCore = class {
|
|
|
3409
3423
|
for (const anchor of this.anchors) anchor.syncZ(z + 1);
|
|
3410
3424
|
},
|
|
3411
3425
|
setIsTop: (isTop) => {
|
|
3412
|
-
if (this.isTopSheet === isTop) return;
|
|
3413
3426
|
this.isTopSheet = isTop;
|
|
3414
|
-
this.repaintScrim();
|
|
3415
3427
|
},
|
|
3416
3428
|
isOpen: () => this.size > 0 || this.opening,
|
|
3417
3429
|
setDepth: (depth) => this.applyStackDepth(depth)
|
|
3418
3430
|
}));
|
|
3419
3431
|
}
|
|
3420
|
-
repaintScrim() {
|
|
3421
|
-
if (this.destroyed) return;
|
|
3422
|
-
this.scrim.invalidateOpacityCache();
|
|
3423
|
-
this.scrim.applyOpacity(this.computeProgress(this.size), true);
|
|
3424
|
-
}
|
|
3425
3432
|
applyStackDepth(depth) {
|
|
3426
3433
|
if (!this.stackEffectEnabled) return;
|
|
3427
3434
|
this.element.setAttribute("data-stack-depth", String(depth));
|
|
@@ -3666,6 +3673,7 @@ var BottomSheetCore = class {
|
|
|
3666
3673
|
this.activeId = target.id;
|
|
3667
3674
|
if (previousSnapSize === 0 && target.size > 0) {
|
|
3668
3675
|
this.opening = true;
|
|
3676
|
+
this.promotedForOpen = true;
|
|
3669
3677
|
sheetStack.promote(this.id);
|
|
3670
3678
|
}
|
|
3671
3679
|
const settleCap = this.snaps.getMaxAxisSize();
|
|
@@ -3747,7 +3755,8 @@ var BottomSheetCore = class {
|
|
|
3747
3755
|
return Math.min(Math.max((size - min) / (reachableMax - min), 0), 1);
|
|
3748
3756
|
}
|
|
3749
3757
|
handleOpen() {
|
|
3750
|
-
|
|
3758
|
+
if (this.promotedForOpen) this.promotedForOpen = false;
|
|
3759
|
+
else sheetStack.promote(this.id);
|
|
3751
3760
|
try {
|
|
3752
3761
|
this.lifecycle.install();
|
|
3753
3762
|
} catch (err) {
|
|
@@ -3779,6 +3788,7 @@ var BottomSheetCore = class {
|
|
|
3779
3788
|
}
|
|
3780
3789
|
handleClose() {
|
|
3781
3790
|
this.opening = false;
|
|
3791
|
+
this.promotedForOpen = false;
|
|
3782
3792
|
this.lifecycle.release();
|
|
3783
3793
|
sheetStack.update();
|
|
3784
3794
|
}
|
package/dist/react.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { c as EngineOptions, E as EngineState, A as AnchorOptions, e as ScrimStagesOptions, u as ScrimStageDef, S as SheetEventMap, C as CloseReason, v as ScrimUpdate, r as ScrimOverlayOptions, a as SnapPointDef, b as SheetMode } from './BottomSheetCore-
|
|
2
|
-
export { d as SnapPoint } from './BottomSheetCore-
|
|
1
|
+
import { c as EngineOptions, E as EngineState, A as AnchorOptions, e as ScrimStagesOptions, u as ScrimStageDef, S as SheetEventMap, C as CloseReason, v as ScrimUpdate, r as ScrimOverlayOptions, a as SnapPointDef, b as SheetMode } from './BottomSheetCore-BHv6LPmS.cjs';
|
|
2
|
+
export { d as SnapPoint } from './BottomSheetCore-BHv6LPmS.cjs';
|
|
3
3
|
import { OverlayOptions, OverlayState, Overlay as OverlayEngine } from './overlay.cjs';
|
|
4
4
|
export { OverlayEdge } from './overlay.cjs';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import { CSSProperties, ReactNode } from 'react';
|
|
7
|
-
import { B as BottomSheetEngine } from './BottomSheetEngine-
|
|
7
|
+
import { B as BottomSheetEngine } from './BottomSheetEngine-mmFzIK1Z.cjs';
|
|
8
8
|
import { T as TeleportTarget } from './teleport-7uYNiEAT.cjs';
|
|
9
9
|
import './transform-jVfAikE9.cjs';
|
|
10
10
|
|
package/dist/react.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { c as EngineOptions, E as EngineState, A as AnchorOptions, e as ScrimStagesOptions, u as ScrimStageDef, S as SheetEventMap, C as CloseReason, v as ScrimUpdate, r as ScrimOverlayOptions, a as SnapPointDef, b as SheetMode } from './BottomSheetCore-
|
|
2
|
-
export { d as SnapPoint } from './BottomSheetCore-
|
|
1
|
+
import { c as EngineOptions, E as EngineState, A as AnchorOptions, e as ScrimStagesOptions, u as ScrimStageDef, S as SheetEventMap, C as CloseReason, v as ScrimUpdate, r as ScrimOverlayOptions, a as SnapPointDef, b as SheetMode } from './BottomSheetCore-CK_mq14p.js';
|
|
2
|
+
export { d as SnapPoint } from './BottomSheetCore-CK_mq14p.js';
|
|
3
3
|
import { OverlayOptions, OverlayState, Overlay as OverlayEngine } from './overlay.js';
|
|
4
4
|
export { OverlayEdge } from './overlay.js';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import { CSSProperties, ReactNode } from 'react';
|
|
7
|
-
import { B as BottomSheetEngine } from './BottomSheetEngine-
|
|
7
|
+
import { B as BottomSheetEngine } from './BottomSheetEngine-wLn6Q2kA.js';
|
|
8
8
|
import { T as TeleportTarget } from './teleport-7uYNiEAT.js';
|
|
9
9
|
import './transform-jVfAikE9.js';
|
|
10
10
|
|
package/dist/react.js
CHANGED
|
@@ -383,14 +383,26 @@ function notifyLinkedSheets(sheets, self) {
|
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
385
|
|
|
386
|
+
// src/core/primitives/hot-path-thresholds.ts
|
|
387
|
+
var SIZE_WRITE_EPSILON = 0.5;
|
|
388
|
+
var OPACITY_WRITE_EPSILON = 5e-3;
|
|
389
|
+
var POINTER_EVENTS_OPACITY_THRESHOLD = 0.05;
|
|
390
|
+
var RANGE_DIVISION_EPSILON = 1e-4;
|
|
391
|
+
|
|
386
392
|
// src/core/features/resize-observer.ts
|
|
387
393
|
function installResizeObserver(deps) {
|
|
388
394
|
if (typeof window === "undefined") {
|
|
389
395
|
return () => {
|
|
390
396
|
};
|
|
391
397
|
}
|
|
398
|
+
const seatFor = () => {
|
|
399
|
+
const snap = deps.resolveActiveSnap();
|
|
400
|
+
const max = deps.getMaxAxisSize();
|
|
401
|
+
return { target: snap ? Math.min(snap.size, max) : null, max };
|
|
402
|
+
};
|
|
392
403
|
const onResize = () => {
|
|
393
404
|
if (deps.isDestroyed()) return;
|
|
405
|
+
const before = seatFor();
|
|
394
406
|
deps.recomputeSnaps();
|
|
395
407
|
const mode = deps.getMode();
|
|
396
408
|
const isVerticalAxis = mode === "bottom" || mode === "top";
|
|
@@ -399,6 +411,10 @@ function installResizeObserver(deps) {
|
|
|
399
411
|
if (viewportSize2 > 0 && viewportSize2 < max) {
|
|
400
412
|
deps.setMaxAxisSize(viewportSize2);
|
|
401
413
|
}
|
|
414
|
+
const after = seatFor();
|
|
415
|
+
if (before.target !== null && after.target !== null && Math.abs(after.target - before.target) < SIZE_WRITE_EPSILON && Math.abs(after.max - before.max) < SIZE_WRITE_EPSILON) {
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
402
418
|
const wasAnimating = deps.isAnimating?.() ?? false;
|
|
403
419
|
deps.cancelInFlight();
|
|
404
420
|
deps.newCycle();
|
|
@@ -667,12 +683,6 @@ var SCRIM_PRESETS = Object.freeze({
|
|
|
667
683
|
}
|
|
668
684
|
});
|
|
669
685
|
|
|
670
|
-
// src/core/primitives/hot-path-thresholds.ts
|
|
671
|
-
var SIZE_WRITE_EPSILON = 0.5;
|
|
672
|
-
var OPACITY_WRITE_EPSILON = 5e-3;
|
|
673
|
-
var POINTER_EVENTS_OPACITY_THRESHOLD = 0.05;
|
|
674
|
-
var RANGE_DIVISION_EPSILON = 1e-4;
|
|
675
|
-
|
|
676
686
|
// src/core/primitives/opacity-dedup.ts
|
|
677
687
|
var WriteSentinel = class {
|
|
678
688
|
constructor() {
|
|
@@ -782,7 +792,6 @@ var ScrimController = class {
|
|
|
782
792
|
__publicField(this, "backdrop");
|
|
783
793
|
__publicField(this, "mode");
|
|
784
794
|
__publicField(this, "isDestroyed");
|
|
785
|
-
__publicField(this, "isTopSheet");
|
|
786
795
|
__publicField(this, "getAllowedIds");
|
|
787
796
|
__publicField(this, "getResolvedSnaps");
|
|
788
797
|
__publicField(this, "snapToFn");
|
|
@@ -804,7 +813,6 @@ var ScrimController = class {
|
|
|
804
813
|
this.backdrop = deps.backdrop;
|
|
805
814
|
this.mode = deps.mode;
|
|
806
815
|
this.isDestroyed = deps.isDestroyed;
|
|
807
|
-
this.isTopSheet = deps.isTopSheet;
|
|
808
816
|
this.getAllowedIds = deps.getAllowedIds;
|
|
809
817
|
this.getResolvedSnaps = deps.getResolvedSnaps;
|
|
810
818
|
this.snapToFn = deps.snapTo;
|
|
@@ -849,8 +857,10 @@ var ScrimController = class {
|
|
|
849
857
|
if (this.backdrop) {
|
|
850
858
|
const [s, e] = this.backdropRange;
|
|
851
859
|
const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
|
|
852
|
-
const
|
|
853
|
-
|
|
860
|
+
const backdropOpacity = Math.min(
|
|
861
|
+
Math.max((progress - s) / range, 0),
|
|
862
|
+
1
|
|
863
|
+
);
|
|
854
864
|
if (this.backdropOpacitySentinel.shouldWrite(
|
|
855
865
|
backdropOpacity,
|
|
856
866
|
OPACITY_WRITE_EPSILON
|
|
@@ -2625,6 +2635,7 @@ var BottomSheetCore = class {
|
|
|
2625
2635
|
__publicField(this, "progressWriteSentinel", new WriteSentinel());
|
|
2626
2636
|
__publicField(this, "isTopSheet", true);
|
|
2627
2637
|
__publicField(this, "opening", false);
|
|
2638
|
+
__publicField(this, "promotedForOpen", false);
|
|
2628
2639
|
__publicField(this, "allowOvershoot", false);
|
|
2629
2640
|
__publicField(this, "progressPayload", {
|
|
2630
2641
|
value: 0,
|
|
@@ -2681,7 +2692,6 @@ var BottomSheetCore = class {
|
|
|
2681
2692
|
screenComponent: this.screenComponent,
|
|
2682
2693
|
backdrop: this.backdrop,
|
|
2683
2694
|
isDestroyed: () => this.destroyed,
|
|
2684
|
-
isTopSheet: () => this.isTopSheet,
|
|
2685
2695
|
getAllowedIds: () => this.snaps.getAllowedIds().slice(),
|
|
2686
2696
|
getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
|
|
2687
2697
|
snapTo: (id) => {
|
|
@@ -2951,13 +2961,14 @@ var BottomSheetCore = class {
|
|
|
2951
2961
|
if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
|
|
2952
2962
|
return;
|
|
2953
2963
|
}
|
|
2964
|
+
const resumingOpen = this.opening;
|
|
2954
2965
|
const signal = this.newCycle();
|
|
2955
2966
|
const onExternalAbort = () => {
|
|
2956
2967
|
this.animation.cancel();
|
|
2957
2968
|
this.newCycle();
|
|
2958
2969
|
};
|
|
2959
2970
|
externalSignal?.addEventListener("abort", onExternalAbort, { once: true });
|
|
2960
|
-
const wasClosed = this.size === 0;
|
|
2971
|
+
const wasClosed = this.size === 0 || resumingOpen;
|
|
2961
2972
|
const previousId = this.activeId;
|
|
2962
2973
|
const previousSize = this.size;
|
|
2963
2974
|
this.scrollCache.cache(previousId, previousSize, target.size);
|
|
@@ -2966,7 +2977,10 @@ var BottomSheetCore = class {
|
|
|
2966
2977
|
const opensToRest = id === "closed" || rawTargetSize === 0;
|
|
2967
2978
|
if (wasClosed && !opensToRest) {
|
|
2968
2979
|
this.opening = true;
|
|
2969
|
-
|
|
2980
|
+
if (!resumingOpen) {
|
|
2981
|
+
this.promotedForOpen = true;
|
|
2982
|
+
sheetStack.promote(this.id);
|
|
2983
|
+
}
|
|
2970
2984
|
}
|
|
2971
2985
|
if (this.animation.viewTransitionsAvailable) {
|
|
2972
2986
|
this.currentViewTransition?.skipTransition?.();
|
|
@@ -3407,19 +3421,12 @@ var BottomSheetCore = class {
|
|
|
3407
3421
|
for (const anchor of this.anchors) anchor.syncZ(z + 1);
|
|
3408
3422
|
},
|
|
3409
3423
|
setIsTop: (isTop) => {
|
|
3410
|
-
if (this.isTopSheet === isTop) return;
|
|
3411
3424
|
this.isTopSheet = isTop;
|
|
3412
|
-
this.repaintScrim();
|
|
3413
3425
|
},
|
|
3414
3426
|
isOpen: () => this.size > 0 || this.opening,
|
|
3415
3427
|
setDepth: (depth) => this.applyStackDepth(depth)
|
|
3416
3428
|
}));
|
|
3417
3429
|
}
|
|
3418
|
-
repaintScrim() {
|
|
3419
|
-
if (this.destroyed) return;
|
|
3420
|
-
this.scrim.invalidateOpacityCache();
|
|
3421
|
-
this.scrim.applyOpacity(this.computeProgress(this.size), true);
|
|
3422
|
-
}
|
|
3423
3430
|
applyStackDepth(depth) {
|
|
3424
3431
|
if (!this.stackEffectEnabled) return;
|
|
3425
3432
|
this.element.setAttribute("data-stack-depth", String(depth));
|
|
@@ -3664,6 +3671,7 @@ var BottomSheetCore = class {
|
|
|
3664
3671
|
this.activeId = target.id;
|
|
3665
3672
|
if (previousSnapSize === 0 && target.size > 0) {
|
|
3666
3673
|
this.opening = true;
|
|
3674
|
+
this.promotedForOpen = true;
|
|
3667
3675
|
sheetStack.promote(this.id);
|
|
3668
3676
|
}
|
|
3669
3677
|
const settleCap = this.snaps.getMaxAxisSize();
|
|
@@ -3745,7 +3753,8 @@ var BottomSheetCore = class {
|
|
|
3745
3753
|
return Math.min(Math.max((size - min) / (reachableMax - min), 0), 1);
|
|
3746
3754
|
}
|
|
3747
3755
|
handleOpen() {
|
|
3748
|
-
|
|
3756
|
+
if (this.promotedForOpen) this.promotedForOpen = false;
|
|
3757
|
+
else sheetStack.promote(this.id);
|
|
3749
3758
|
try {
|
|
3750
3759
|
this.lifecycle.install();
|
|
3751
3760
|
} catch (err) {
|
|
@@ -3777,6 +3786,7 @@ var BottomSheetCore = class {
|
|
|
3777
3786
|
}
|
|
3778
3787
|
handleClose() {
|
|
3779
3788
|
this.opening = false;
|
|
3789
|
+
this.promotedForOpen = false;
|
|
3780
3790
|
this.lifecycle.release();
|
|
3781
3791
|
sheetStack.update();
|
|
3782
3792
|
}
|
package/dist/solid.cjs
CHANGED
|
@@ -378,14 +378,26 @@ function notifyLinkedSheets(sheets, self) {
|
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
380
|
|
|
381
|
+
// src/core/primitives/hot-path-thresholds.ts
|
|
382
|
+
var SIZE_WRITE_EPSILON = 0.5;
|
|
383
|
+
var OPACITY_WRITE_EPSILON = 5e-3;
|
|
384
|
+
var POINTER_EVENTS_OPACITY_THRESHOLD = 0.05;
|
|
385
|
+
var RANGE_DIVISION_EPSILON = 1e-4;
|
|
386
|
+
|
|
381
387
|
// src/core/features/resize-observer.ts
|
|
382
388
|
function installResizeObserver(deps) {
|
|
383
389
|
if (typeof window === "undefined") {
|
|
384
390
|
return () => {
|
|
385
391
|
};
|
|
386
392
|
}
|
|
393
|
+
const seatFor = () => {
|
|
394
|
+
const snap = deps.resolveActiveSnap();
|
|
395
|
+
const max = deps.getMaxAxisSize();
|
|
396
|
+
return { target: snap ? Math.min(snap.size, max) : null, max };
|
|
397
|
+
};
|
|
387
398
|
const onResize = () => {
|
|
388
399
|
if (deps.isDestroyed()) return;
|
|
400
|
+
const before = seatFor();
|
|
389
401
|
deps.recomputeSnaps();
|
|
390
402
|
const mode = deps.getMode();
|
|
391
403
|
const isVerticalAxis = mode === "bottom" || mode === "top";
|
|
@@ -394,6 +406,10 @@ function installResizeObserver(deps) {
|
|
|
394
406
|
if (viewportSize2 > 0 && viewportSize2 < max) {
|
|
395
407
|
deps.setMaxAxisSize(viewportSize2);
|
|
396
408
|
}
|
|
409
|
+
const after = seatFor();
|
|
410
|
+
if (before.target !== null && after.target !== null && Math.abs(after.target - before.target) < SIZE_WRITE_EPSILON && Math.abs(after.max - before.max) < SIZE_WRITE_EPSILON) {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
397
413
|
const wasAnimating = deps.isAnimating?.() ?? false;
|
|
398
414
|
deps.cancelInFlight();
|
|
399
415
|
deps.newCycle();
|
|
@@ -662,12 +678,6 @@ var SCRIM_PRESETS = Object.freeze({
|
|
|
662
678
|
}
|
|
663
679
|
});
|
|
664
680
|
|
|
665
|
-
// src/core/primitives/hot-path-thresholds.ts
|
|
666
|
-
var SIZE_WRITE_EPSILON = 0.5;
|
|
667
|
-
var OPACITY_WRITE_EPSILON = 5e-3;
|
|
668
|
-
var POINTER_EVENTS_OPACITY_THRESHOLD = 0.05;
|
|
669
|
-
var RANGE_DIVISION_EPSILON = 1e-4;
|
|
670
|
-
|
|
671
681
|
// src/core/primitives/opacity-dedup.ts
|
|
672
682
|
var WriteSentinel = class {
|
|
673
683
|
constructor() {
|
|
@@ -777,7 +787,6 @@ var ScrimController = class {
|
|
|
777
787
|
__publicField(this, "backdrop");
|
|
778
788
|
__publicField(this, "mode");
|
|
779
789
|
__publicField(this, "isDestroyed");
|
|
780
|
-
__publicField(this, "isTopSheet");
|
|
781
790
|
__publicField(this, "getAllowedIds");
|
|
782
791
|
__publicField(this, "getResolvedSnaps");
|
|
783
792
|
__publicField(this, "snapToFn");
|
|
@@ -799,7 +808,6 @@ var ScrimController = class {
|
|
|
799
808
|
this.backdrop = deps.backdrop;
|
|
800
809
|
this.mode = deps.mode;
|
|
801
810
|
this.isDestroyed = deps.isDestroyed;
|
|
802
|
-
this.isTopSheet = deps.isTopSheet;
|
|
803
811
|
this.getAllowedIds = deps.getAllowedIds;
|
|
804
812
|
this.getResolvedSnaps = deps.getResolvedSnaps;
|
|
805
813
|
this.snapToFn = deps.snapTo;
|
|
@@ -844,8 +852,10 @@ var ScrimController = class {
|
|
|
844
852
|
if (this.backdrop) {
|
|
845
853
|
const [s, e] = this.backdropRange;
|
|
846
854
|
const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
|
|
847
|
-
const
|
|
848
|
-
|
|
855
|
+
const backdropOpacity = Math.min(
|
|
856
|
+
Math.max((progress - s) / range, 0),
|
|
857
|
+
1
|
|
858
|
+
);
|
|
849
859
|
if (this.backdropOpacitySentinel.shouldWrite(
|
|
850
860
|
backdropOpacity,
|
|
851
861
|
OPACITY_WRITE_EPSILON
|
|
@@ -2620,6 +2630,7 @@ var BottomSheetCore = class {
|
|
|
2620
2630
|
__publicField(this, "progressWriteSentinel", new WriteSentinel());
|
|
2621
2631
|
__publicField(this, "isTopSheet", true);
|
|
2622
2632
|
__publicField(this, "opening", false);
|
|
2633
|
+
__publicField(this, "promotedForOpen", false);
|
|
2623
2634
|
__publicField(this, "allowOvershoot", false);
|
|
2624
2635
|
__publicField(this, "progressPayload", {
|
|
2625
2636
|
value: 0,
|
|
@@ -2676,7 +2687,6 @@ var BottomSheetCore = class {
|
|
|
2676
2687
|
screenComponent: this.screenComponent,
|
|
2677
2688
|
backdrop: this.backdrop,
|
|
2678
2689
|
isDestroyed: () => this.destroyed,
|
|
2679
|
-
isTopSheet: () => this.isTopSheet,
|
|
2680
2690
|
getAllowedIds: () => this.snaps.getAllowedIds().slice(),
|
|
2681
2691
|
getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
|
|
2682
2692
|
snapTo: (id) => {
|
|
@@ -2946,13 +2956,14 @@ var BottomSheetCore = class {
|
|
|
2946
2956
|
if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
|
|
2947
2957
|
return;
|
|
2948
2958
|
}
|
|
2959
|
+
const resumingOpen = this.opening;
|
|
2949
2960
|
const signal = this.newCycle();
|
|
2950
2961
|
const onExternalAbort = () => {
|
|
2951
2962
|
this.animation.cancel();
|
|
2952
2963
|
this.newCycle();
|
|
2953
2964
|
};
|
|
2954
2965
|
externalSignal?.addEventListener("abort", onExternalAbort, { once: true });
|
|
2955
|
-
const wasClosed = this.size === 0;
|
|
2966
|
+
const wasClosed = this.size === 0 || resumingOpen;
|
|
2956
2967
|
const previousId = this.activeId;
|
|
2957
2968
|
const previousSize = this.size;
|
|
2958
2969
|
this.scrollCache.cache(previousId, previousSize, target.size);
|
|
@@ -2961,7 +2972,10 @@ var BottomSheetCore = class {
|
|
|
2961
2972
|
const opensToRest = id === "closed" || rawTargetSize === 0;
|
|
2962
2973
|
if (wasClosed && !opensToRest) {
|
|
2963
2974
|
this.opening = true;
|
|
2964
|
-
|
|
2975
|
+
if (!resumingOpen) {
|
|
2976
|
+
this.promotedForOpen = true;
|
|
2977
|
+
sheetStack.promote(this.id);
|
|
2978
|
+
}
|
|
2965
2979
|
}
|
|
2966
2980
|
if (this.animation.viewTransitionsAvailable) {
|
|
2967
2981
|
this.currentViewTransition?.skipTransition?.();
|
|
@@ -3402,19 +3416,12 @@ var BottomSheetCore = class {
|
|
|
3402
3416
|
for (const anchor of this.anchors) anchor.syncZ(z + 1);
|
|
3403
3417
|
},
|
|
3404
3418
|
setIsTop: (isTop) => {
|
|
3405
|
-
if (this.isTopSheet === isTop) return;
|
|
3406
3419
|
this.isTopSheet = isTop;
|
|
3407
|
-
this.repaintScrim();
|
|
3408
3420
|
},
|
|
3409
3421
|
isOpen: () => this.size > 0 || this.opening,
|
|
3410
3422
|
setDepth: (depth) => this.applyStackDepth(depth)
|
|
3411
3423
|
}));
|
|
3412
3424
|
}
|
|
3413
|
-
repaintScrim() {
|
|
3414
|
-
if (this.destroyed) return;
|
|
3415
|
-
this.scrim.invalidateOpacityCache();
|
|
3416
|
-
this.scrim.applyOpacity(this.computeProgress(this.size), true);
|
|
3417
|
-
}
|
|
3418
3425
|
applyStackDepth(depth) {
|
|
3419
3426
|
if (!this.stackEffectEnabled) return;
|
|
3420
3427
|
this.element.setAttribute("data-stack-depth", String(depth));
|
|
@@ -3659,6 +3666,7 @@ var BottomSheetCore = class {
|
|
|
3659
3666
|
this.activeId = target.id;
|
|
3660
3667
|
if (previousSnapSize === 0 && target.size > 0) {
|
|
3661
3668
|
this.opening = true;
|
|
3669
|
+
this.promotedForOpen = true;
|
|
3662
3670
|
sheetStack.promote(this.id);
|
|
3663
3671
|
}
|
|
3664
3672
|
const settleCap = this.snaps.getMaxAxisSize();
|
|
@@ -3740,7 +3748,8 @@ var BottomSheetCore = class {
|
|
|
3740
3748
|
return Math.min(Math.max((size - min) / (reachableMax - min), 0), 1);
|
|
3741
3749
|
}
|
|
3742
3750
|
handleOpen() {
|
|
3743
|
-
|
|
3751
|
+
if (this.promotedForOpen) this.promotedForOpen = false;
|
|
3752
|
+
else sheetStack.promote(this.id);
|
|
3744
3753
|
try {
|
|
3745
3754
|
this.lifecycle.install();
|
|
3746
3755
|
} catch (err) {
|
|
@@ -3772,6 +3781,7 @@ var BottomSheetCore = class {
|
|
|
3772
3781
|
}
|
|
3773
3782
|
handleClose() {
|
|
3774
3783
|
this.opening = false;
|
|
3784
|
+
this.promotedForOpen = false;
|
|
3775
3785
|
this.lifecycle.release();
|
|
3776
3786
|
sheetStack.update();
|
|
3777
3787
|
}
|
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;
|