@surdeddd/bottom-sheet 0.20.2 → 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.
- package/README.md +10 -1
- package/dist/{BottomSheetCore-VPJZcKcg.d.cts → BottomSheetCore-BHv6LPmS.d.cts} +1 -0
- package/dist/{BottomSheetCore-Cgn8b_6A.d.ts → BottomSheetCore-CK_mq14p.d.ts} +1 -0
- package/dist/{BottomSheetEngine-B8C2CwF9.d.cts → BottomSheetEngine-mmFzIK1Z.d.cts} +1 -1
- package/dist/{BottomSheetEngine-DwYR_ygJ.d.ts → BottomSheetEngine-wLn6Q2kA.d.ts} +1 -1
- package/dist/core.cjs +33 -27
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +33 -27
- package/dist/debug.d.cts +1 -1
- package/dist/debug.d.ts +1 -1
- package/dist/element.cjs +37 -27
- 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 -27
- package/dist/features.d.cts +2 -2
- package/dist/features.d.ts +2 -2
- package/dist/{index-DcMkhXAy.d.ts → index-CWKv1Xy4.d.ts} +1 -1
- package/dist/{index-CnfbOKx0.d.cts → index-juAyT76E.d.cts} +1 -1
- package/dist/index.cjs +33 -27
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +33 -27
- 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 +36 -24
- package/dist/qwik-lib/index.qwik.mjs +36 -24
- package/dist/qwik.cjs +39 -27
- package/dist/qwik.d.cts +2 -2
- package/dist/qwik.d.ts +2 -2
- package/dist/qwik.js +39 -27
- package/dist/react.cjs +38 -27
- package/dist/react.d.cts +3 -3
- package/dist/react.d.ts +3 -3
- package/dist/react.js +38 -27
- package/dist/solid.cjs +39 -27
- package/dist/solid.d.cts +1 -0
- package/dist/solid.d.ts +1 -0
- package/dist/solid.js +39 -27
- package/dist/solid.source.jsx +43 -27
- package/dist/svelte-core.cjs +33 -27
- package/dist/svelte-core.js +33 -27
- package/dist/svelte-src/BottomSheet.svelte +3 -0
- package/dist/svelte.cjs +36 -27
- package/dist/svelte.js +36 -27
- package/dist/vue.cjs +37 -27
- package/dist/vue.js +37 -27
- package/dist/webgl.d.cts +1 -1
- package/dist/webgl.d.ts +1 -1
- package/package.json +2 -2
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;
|
|
@@ -846,18 +844,16 @@ var ScrimController = class {
|
|
|
846
844
|
Math.max((progress - s) / range, 0),
|
|
847
845
|
1
|
|
848
846
|
);
|
|
849
|
-
if (this.
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
)
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
this.lastBackdropPointer = nextPointer;
|
|
860
|
-
}
|
|
847
|
+
if (this.backdropOpacitySentinel.shouldWrite(
|
|
848
|
+
backdropOpacity,
|
|
849
|
+
OPACITY_WRITE_EPSILON
|
|
850
|
+
)) {
|
|
851
|
+
this.backdrop.style.opacity = String(backdropOpacity);
|
|
852
|
+
}
|
|
853
|
+
const nextPointer = backdropOpacity > POINTER_EVENTS_OPACITY_THRESHOLD ? "auto" : "none";
|
|
854
|
+
if (nextPointer !== this.lastBackdropPointer) {
|
|
855
|
+
this.backdrop.style.pointerEvents = nextPointer;
|
|
856
|
+
this.lastBackdropPointer = nextPointer;
|
|
861
857
|
}
|
|
862
858
|
}
|
|
863
859
|
if (this.screenComponent && this.scrimMode !== "off") {
|
|
@@ -1387,18 +1383,20 @@ var AnimationRunner = class {
|
|
|
1387
1383
|
get isAnimating() {
|
|
1388
1384
|
return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
|
|
1389
1385
|
}
|
|
1386
|
+
cancelWaapi() {
|
|
1387
|
+
if (!this.currentWaapi) return;
|
|
1388
|
+
const entry = this.currentWaapi;
|
|
1389
|
+
this.currentWaapi = null;
|
|
1390
|
+
entry.stop();
|
|
1391
|
+
try {
|
|
1392
|
+
entry.anim.cancel();
|
|
1393
|
+
} catch {
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1390
1396
|
cancel() {
|
|
1391
1397
|
this.currentTween?.cancel();
|
|
1392
1398
|
this.currentSpring?.cancel();
|
|
1393
|
-
|
|
1394
|
-
const entry = this.currentWaapi;
|
|
1395
|
-
this.currentWaapi = null;
|
|
1396
|
-
entry.stop();
|
|
1397
|
-
try {
|
|
1398
|
-
entry.anim.cancel();
|
|
1399
|
-
} catch {
|
|
1400
|
-
}
|
|
1401
|
-
}
|
|
1399
|
+
this.cancelWaapi();
|
|
1402
1400
|
}
|
|
1403
1401
|
async animateTo(target, velocityPxPerMs) {
|
|
1404
1402
|
if (target === this.getSize()) {
|
|
@@ -1409,6 +1407,7 @@ var AnimationRunner = class {
|
|
|
1409
1407
|
}
|
|
1410
1408
|
this.currentTween?.cancel();
|
|
1411
1409
|
this.currentSpring?.cancel();
|
|
1410
|
+
this.cancelWaapi();
|
|
1412
1411
|
this.getRootEl()?.setAttribute("data-animating", "true");
|
|
1413
1412
|
this.element.style.willChange = "transform";
|
|
1414
1413
|
if (this.reducedMotion) {
|
|
@@ -2619,6 +2618,7 @@ var BottomSheetCore = class {
|
|
|
2619
2618
|
__publicField(this, "progressWriteSentinel", new WriteSentinel());
|
|
2620
2619
|
__publicField(this, "isTopSheet", true);
|
|
2621
2620
|
__publicField(this, "opening", false);
|
|
2621
|
+
__publicField(this, "promotedForOpen", false);
|
|
2622
2622
|
__publicField(this, "allowOvershoot", false);
|
|
2623
2623
|
__publicField(this, "progressPayload", {
|
|
2624
2624
|
value: 0,
|
|
@@ -2675,7 +2675,6 @@ var BottomSheetCore = class {
|
|
|
2675
2675
|
screenComponent: this.screenComponent,
|
|
2676
2676
|
backdrop: this.backdrop,
|
|
2677
2677
|
isDestroyed: () => this.destroyed,
|
|
2678
|
-
isTopSheet: () => this.isTopSheet,
|
|
2679
2678
|
getAllowedIds: () => this.snaps.getAllowedIds().slice(),
|
|
2680
2679
|
getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
|
|
2681
2680
|
snapTo: (id) => {
|
|
@@ -2945,13 +2944,14 @@ var BottomSheetCore = class {
|
|
|
2945
2944
|
if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
|
|
2946
2945
|
return;
|
|
2947
2946
|
}
|
|
2947
|
+
const resumingOpen = this.opening;
|
|
2948
2948
|
const signal = this.newCycle();
|
|
2949
2949
|
const onExternalAbort = () => {
|
|
2950
2950
|
this.animation.cancel();
|
|
2951
2951
|
this.newCycle();
|
|
2952
2952
|
};
|
|
2953
2953
|
externalSignal?.addEventListener("abort", onExternalAbort, { once: true });
|
|
2954
|
-
const wasClosed = this.size === 0;
|
|
2954
|
+
const wasClosed = this.size === 0 || resumingOpen;
|
|
2955
2955
|
const previousId = this.activeId;
|
|
2956
2956
|
const previousSize = this.size;
|
|
2957
2957
|
this.scrollCache.cache(previousId, previousSize, target.size);
|
|
@@ -2960,7 +2960,10 @@ var BottomSheetCore = class {
|
|
|
2960
2960
|
const opensToRest = id === "closed" || rawTargetSize === 0;
|
|
2961
2961
|
if (wasClosed && !opensToRest) {
|
|
2962
2962
|
this.opening = true;
|
|
2963
|
-
|
|
2963
|
+
if (!resumingOpen) {
|
|
2964
|
+
this.promotedForOpen = true;
|
|
2965
|
+
sheetStack.promote(this.id);
|
|
2966
|
+
}
|
|
2964
2967
|
}
|
|
2965
2968
|
if (this.animation.viewTransitionsAvailable) {
|
|
2966
2969
|
this.currentViewTransition?.skipTransition?.();
|
|
@@ -3651,6 +3654,7 @@ var BottomSheetCore = class {
|
|
|
3651
3654
|
this.activeId = target.id;
|
|
3652
3655
|
if (previousSnapSize === 0 && target.size > 0) {
|
|
3653
3656
|
this.opening = true;
|
|
3657
|
+
this.promotedForOpen = true;
|
|
3654
3658
|
sheetStack.promote(this.id);
|
|
3655
3659
|
}
|
|
3656
3660
|
const settleCap = this.snaps.getMaxAxisSize();
|
|
@@ -3732,7 +3736,8 @@ var BottomSheetCore = class {
|
|
|
3732
3736
|
return Math.min(Math.max((size - min) / (reachableMax - min), 0), 1);
|
|
3733
3737
|
}
|
|
3734
3738
|
handleOpen() {
|
|
3735
|
-
|
|
3739
|
+
if (this.promotedForOpen) this.promotedForOpen = false;
|
|
3740
|
+
else sheetStack.promote(this.id);
|
|
3736
3741
|
try {
|
|
3737
3742
|
this.lifecycle.install();
|
|
3738
3743
|
} catch (err) {
|
|
@@ -3764,6 +3769,7 @@ var BottomSheetCore = class {
|
|
|
3764
3769
|
}
|
|
3765
3770
|
handleClose() {
|
|
3766
3771
|
this.opening = false;
|
|
3772
|
+
this.promotedForOpen = false;
|
|
3767
3773
|
this.lifecycle.release();
|
|
3768
3774
|
sheetStack.update();
|
|
3769
3775
|
}
|
|
@@ -4415,6 +4421,12 @@ var BottomSheet = (props) => {
|
|
|
4415
4421
|
}, {
|
|
4416
4422
|
defer: true
|
|
4417
4423
|
}));
|
|
4424
|
+
createEffect(on(() => props.mode, (value, prev) => {
|
|
4425
|
+
if (!engine || prev === void 0 || value === void 0) return;
|
|
4426
|
+
engine.setMode(value);
|
|
4427
|
+
}, {
|
|
4428
|
+
defer: true
|
|
4429
|
+
}));
|
|
4418
4430
|
const showBackdrop = createMemo(() => props.backdrop !== false);
|
|
4419
4431
|
const mode = createMemo(() => props.mode ?? "bottom");
|
|
4420
4432
|
const ariaLabel = createMemo(() => props.ariaLabel ?? "Bottom sheet");
|
package/dist/solid.source.jsx
CHANGED
|
@@ -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;
|
|
@@ -849,18 +847,16 @@ var ScrimController = class {
|
|
|
849
847
|
Math.max((progress - s) / range, 0),
|
|
850
848
|
1
|
|
851
849
|
);
|
|
852
|
-
if (this.
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
)
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
this.lastBackdropPointer = nextPointer;
|
|
863
|
-
}
|
|
850
|
+
if (this.backdropOpacitySentinel.shouldWrite(
|
|
851
|
+
backdropOpacity,
|
|
852
|
+
OPACITY_WRITE_EPSILON
|
|
853
|
+
)) {
|
|
854
|
+
this.backdrop.style.opacity = String(backdropOpacity);
|
|
855
|
+
}
|
|
856
|
+
const nextPointer = backdropOpacity > POINTER_EVENTS_OPACITY_THRESHOLD ? "auto" : "none";
|
|
857
|
+
if (nextPointer !== this.lastBackdropPointer) {
|
|
858
|
+
this.backdrop.style.pointerEvents = nextPointer;
|
|
859
|
+
this.lastBackdropPointer = nextPointer;
|
|
864
860
|
}
|
|
865
861
|
}
|
|
866
862
|
if (this.screenComponent && this.scrimMode !== "off") {
|
|
@@ -1390,18 +1386,20 @@ var AnimationRunner = class {
|
|
|
1390
1386
|
get isAnimating() {
|
|
1391
1387
|
return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
|
|
1392
1388
|
}
|
|
1389
|
+
cancelWaapi() {
|
|
1390
|
+
if (!this.currentWaapi) return;
|
|
1391
|
+
const entry = this.currentWaapi;
|
|
1392
|
+
this.currentWaapi = null;
|
|
1393
|
+
entry.stop();
|
|
1394
|
+
try {
|
|
1395
|
+
entry.anim.cancel();
|
|
1396
|
+
} catch {
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1393
1399
|
cancel() {
|
|
1394
1400
|
this.currentTween?.cancel();
|
|
1395
1401
|
this.currentSpring?.cancel();
|
|
1396
|
-
|
|
1397
|
-
const entry = this.currentWaapi;
|
|
1398
|
-
this.currentWaapi = null;
|
|
1399
|
-
entry.stop();
|
|
1400
|
-
try {
|
|
1401
|
-
entry.anim.cancel();
|
|
1402
|
-
} catch {
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1402
|
+
this.cancelWaapi();
|
|
1405
1403
|
}
|
|
1406
1404
|
async animateTo(target, velocityPxPerMs) {
|
|
1407
1405
|
if (target === this.getSize()) {
|
|
@@ -1412,6 +1410,7 @@ var AnimationRunner = class {
|
|
|
1412
1410
|
}
|
|
1413
1411
|
this.currentTween?.cancel();
|
|
1414
1412
|
this.currentSpring?.cancel();
|
|
1413
|
+
this.cancelWaapi();
|
|
1415
1414
|
this.getRootEl()?.setAttribute("data-animating", "true");
|
|
1416
1415
|
this.element.style.willChange = "transform";
|
|
1417
1416
|
if (this.reducedMotion) {
|
|
@@ -2620,6 +2619,7 @@ var BottomSheetCore = class {
|
|
|
2620
2619
|
progressWriteSentinel = new WriteSentinel();
|
|
2621
2620
|
isTopSheet = true;
|
|
2622
2621
|
opening = false;
|
|
2622
|
+
promotedForOpen = false;
|
|
2623
2623
|
allowOvershoot = false;
|
|
2624
2624
|
progressPayload = {
|
|
2625
2625
|
value: 0,
|
|
@@ -2677,7 +2677,6 @@ var BottomSheetCore = class {
|
|
|
2677
2677
|
screenComponent: this.screenComponent,
|
|
2678
2678
|
backdrop: this.backdrop,
|
|
2679
2679
|
isDestroyed: () => this.destroyed,
|
|
2680
|
-
isTopSheet: () => this.isTopSheet,
|
|
2681
2680
|
getAllowedIds: () => this.snaps.getAllowedIds().slice(),
|
|
2682
2681
|
getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
|
|
2683
2682
|
snapTo: (id) => {
|
|
@@ -2947,13 +2946,14 @@ var BottomSheetCore = class {
|
|
|
2947
2946
|
if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
|
|
2948
2947
|
return;
|
|
2949
2948
|
}
|
|
2949
|
+
const resumingOpen = this.opening;
|
|
2950
2950
|
const signal = this.newCycle();
|
|
2951
2951
|
const onExternalAbort = () => {
|
|
2952
2952
|
this.animation.cancel();
|
|
2953
2953
|
this.newCycle();
|
|
2954
2954
|
};
|
|
2955
2955
|
externalSignal?.addEventListener("abort", onExternalAbort, { once: true });
|
|
2956
|
-
const wasClosed = this.size === 0;
|
|
2956
|
+
const wasClosed = this.size === 0 || resumingOpen;
|
|
2957
2957
|
const previousId = this.activeId;
|
|
2958
2958
|
const previousSize = this.size;
|
|
2959
2959
|
this.scrollCache.cache(previousId, previousSize, target.size);
|
|
@@ -2962,7 +2962,10 @@ var BottomSheetCore = class {
|
|
|
2962
2962
|
const opensToRest = id === "closed" || rawTargetSize === 0;
|
|
2963
2963
|
if (wasClosed && !opensToRest) {
|
|
2964
2964
|
this.opening = true;
|
|
2965
|
-
|
|
2965
|
+
if (!resumingOpen) {
|
|
2966
|
+
this.promotedForOpen = true;
|
|
2967
|
+
sheetStack.promote(this.id);
|
|
2968
|
+
}
|
|
2966
2969
|
}
|
|
2967
2970
|
if (this.animation.viewTransitionsAvailable) {
|
|
2968
2971
|
this.currentViewTransition?.skipTransition?.();
|
|
@@ -3653,6 +3656,7 @@ var BottomSheetCore = class {
|
|
|
3653
3656
|
this.activeId = target.id;
|
|
3654
3657
|
if (previousSnapSize === 0 && target.size > 0) {
|
|
3655
3658
|
this.opening = true;
|
|
3659
|
+
this.promotedForOpen = true;
|
|
3656
3660
|
sheetStack.promote(this.id);
|
|
3657
3661
|
}
|
|
3658
3662
|
const settleCap = this.snaps.getMaxAxisSize();
|
|
@@ -3734,7 +3738,8 @@ var BottomSheetCore = class {
|
|
|
3734
3738
|
return Math.min(Math.max((size - min) / (reachableMax - min), 0), 1);
|
|
3735
3739
|
}
|
|
3736
3740
|
handleOpen() {
|
|
3737
|
-
|
|
3741
|
+
if (this.promotedForOpen) this.promotedForOpen = false;
|
|
3742
|
+
else sheetStack.promote(this.id);
|
|
3738
3743
|
try {
|
|
3739
3744
|
this.lifecycle.install();
|
|
3740
3745
|
} catch (err) {
|
|
@@ -3766,6 +3771,7 @@ var BottomSheetCore = class {
|
|
|
3766
3771
|
}
|
|
3767
3772
|
handleClose() {
|
|
3768
3773
|
this.opening = false;
|
|
3774
|
+
this.promotedForOpen = false;
|
|
3769
3775
|
this.lifecycle.release();
|
|
3770
3776
|
sheetStack.update();
|
|
3771
3777
|
}
|
|
@@ -4443,6 +4449,16 @@ var BottomSheet = (props) => {
|
|
|
4443
4449
|
{ defer: true }
|
|
4444
4450
|
)
|
|
4445
4451
|
);
|
|
4452
|
+
createEffect(
|
|
4453
|
+
on(
|
|
4454
|
+
() => props.mode,
|
|
4455
|
+
(value, prev) => {
|
|
4456
|
+
if (!engine || prev === void 0 || value === void 0) return;
|
|
4457
|
+
engine.setMode(value);
|
|
4458
|
+
},
|
|
4459
|
+
{ defer: true }
|
|
4460
|
+
)
|
|
4461
|
+
);
|
|
4446
4462
|
const showBackdrop = createMemo(() => props.backdrop !== false);
|
|
4447
4463
|
const mode = createMemo(() => props.mode ?? "bottom");
|
|
4448
4464
|
const ariaLabel = createMemo(() => props.ariaLabel ?? "Bottom sheet");
|
package/dist/svelte-core.cjs
CHANGED
|
@@ -776,7 +776,6 @@ var ScrimController = class {
|
|
|
776
776
|
__publicField(this, "backdrop");
|
|
777
777
|
__publicField(this, "mode");
|
|
778
778
|
__publicField(this, "isDestroyed");
|
|
779
|
-
__publicField(this, "isTopSheet");
|
|
780
779
|
__publicField(this, "getAllowedIds");
|
|
781
780
|
__publicField(this, "getResolvedSnaps");
|
|
782
781
|
__publicField(this, "snapToFn");
|
|
@@ -798,7 +797,6 @@ var ScrimController = class {
|
|
|
798
797
|
this.backdrop = deps.backdrop;
|
|
799
798
|
this.mode = deps.mode;
|
|
800
799
|
this.isDestroyed = deps.isDestroyed;
|
|
801
|
-
this.isTopSheet = deps.isTopSheet;
|
|
802
800
|
this.getAllowedIds = deps.getAllowedIds;
|
|
803
801
|
this.getResolvedSnaps = deps.getResolvedSnaps;
|
|
804
802
|
this.snapToFn = deps.snapTo;
|
|
@@ -847,18 +845,16 @@ var ScrimController = class {
|
|
|
847
845
|
Math.max((progress - s) / range, 0),
|
|
848
846
|
1
|
|
849
847
|
);
|
|
850
|
-
if (this.
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
)
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
this.lastBackdropPointer = nextPointer;
|
|
861
|
-
}
|
|
848
|
+
if (this.backdropOpacitySentinel.shouldWrite(
|
|
849
|
+
backdropOpacity,
|
|
850
|
+
OPACITY_WRITE_EPSILON
|
|
851
|
+
)) {
|
|
852
|
+
this.backdrop.style.opacity = String(backdropOpacity);
|
|
853
|
+
}
|
|
854
|
+
const nextPointer = backdropOpacity > POINTER_EVENTS_OPACITY_THRESHOLD ? "auto" : "none";
|
|
855
|
+
if (nextPointer !== this.lastBackdropPointer) {
|
|
856
|
+
this.backdrop.style.pointerEvents = nextPointer;
|
|
857
|
+
this.lastBackdropPointer = nextPointer;
|
|
862
858
|
}
|
|
863
859
|
}
|
|
864
860
|
if (this.screenComponent && this.scrimMode !== "off") {
|
|
@@ -1388,18 +1384,20 @@ var AnimationRunner = class {
|
|
|
1388
1384
|
get isAnimating() {
|
|
1389
1385
|
return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
|
|
1390
1386
|
}
|
|
1387
|
+
cancelWaapi() {
|
|
1388
|
+
if (!this.currentWaapi) return;
|
|
1389
|
+
const entry = this.currentWaapi;
|
|
1390
|
+
this.currentWaapi = null;
|
|
1391
|
+
entry.stop();
|
|
1392
|
+
try {
|
|
1393
|
+
entry.anim.cancel();
|
|
1394
|
+
} catch {
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1391
1397
|
cancel() {
|
|
1392
1398
|
this.currentTween?.cancel();
|
|
1393
1399
|
this.currentSpring?.cancel();
|
|
1394
|
-
|
|
1395
|
-
const entry = this.currentWaapi;
|
|
1396
|
-
this.currentWaapi = null;
|
|
1397
|
-
entry.stop();
|
|
1398
|
-
try {
|
|
1399
|
-
entry.anim.cancel();
|
|
1400
|
-
} catch {
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1400
|
+
this.cancelWaapi();
|
|
1403
1401
|
}
|
|
1404
1402
|
async animateTo(target, velocityPxPerMs) {
|
|
1405
1403
|
if (target === this.getSize()) {
|
|
@@ -1410,6 +1408,7 @@ var AnimationRunner = class {
|
|
|
1410
1408
|
}
|
|
1411
1409
|
this.currentTween?.cancel();
|
|
1412
1410
|
this.currentSpring?.cancel();
|
|
1411
|
+
this.cancelWaapi();
|
|
1413
1412
|
this.getRootEl()?.setAttribute("data-animating", "true");
|
|
1414
1413
|
this.element.style.willChange = "transform";
|
|
1415
1414
|
if (this.reducedMotion) {
|
|
@@ -2620,6 +2619,7 @@ var BottomSheetCore = class {
|
|
|
2620
2619
|
__publicField(this, "progressWriteSentinel", new WriteSentinel());
|
|
2621
2620
|
__publicField(this, "isTopSheet", true);
|
|
2622
2621
|
__publicField(this, "opening", false);
|
|
2622
|
+
__publicField(this, "promotedForOpen", false);
|
|
2623
2623
|
__publicField(this, "allowOvershoot", false);
|
|
2624
2624
|
__publicField(this, "progressPayload", {
|
|
2625
2625
|
value: 0,
|
|
@@ -2676,7 +2676,6 @@ var BottomSheetCore = class {
|
|
|
2676
2676
|
screenComponent: this.screenComponent,
|
|
2677
2677
|
backdrop: this.backdrop,
|
|
2678
2678
|
isDestroyed: () => this.destroyed,
|
|
2679
|
-
isTopSheet: () => this.isTopSheet,
|
|
2680
2679
|
getAllowedIds: () => this.snaps.getAllowedIds().slice(),
|
|
2681
2680
|
getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
|
|
2682
2681
|
snapTo: (id) => {
|
|
@@ -2946,13 +2945,14 @@ var BottomSheetCore = class {
|
|
|
2946
2945
|
if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
|
|
2947
2946
|
return;
|
|
2948
2947
|
}
|
|
2948
|
+
const resumingOpen = this.opening;
|
|
2949
2949
|
const signal = this.newCycle();
|
|
2950
2950
|
const onExternalAbort = () => {
|
|
2951
2951
|
this.animation.cancel();
|
|
2952
2952
|
this.newCycle();
|
|
2953
2953
|
};
|
|
2954
2954
|
externalSignal?.addEventListener("abort", onExternalAbort, { once: true });
|
|
2955
|
-
const wasClosed = this.size === 0;
|
|
2955
|
+
const wasClosed = this.size === 0 || resumingOpen;
|
|
2956
2956
|
const previousId = this.activeId;
|
|
2957
2957
|
const previousSize = this.size;
|
|
2958
2958
|
this.scrollCache.cache(previousId, previousSize, target.size);
|
|
@@ -2961,7 +2961,10 @@ var BottomSheetCore = class {
|
|
|
2961
2961
|
const opensToRest = id === "closed" || rawTargetSize === 0;
|
|
2962
2962
|
if (wasClosed && !opensToRest) {
|
|
2963
2963
|
this.opening = true;
|
|
2964
|
-
|
|
2964
|
+
if (!resumingOpen) {
|
|
2965
|
+
this.promotedForOpen = true;
|
|
2966
|
+
sheetStack.promote(this.id);
|
|
2967
|
+
}
|
|
2965
2968
|
}
|
|
2966
2969
|
if (this.animation.viewTransitionsAvailable) {
|
|
2967
2970
|
this.currentViewTransition?.skipTransition?.();
|
|
@@ -3652,6 +3655,7 @@ var BottomSheetCore = class {
|
|
|
3652
3655
|
this.activeId = target.id;
|
|
3653
3656
|
if (previousSnapSize === 0 && target.size > 0) {
|
|
3654
3657
|
this.opening = true;
|
|
3658
|
+
this.promotedForOpen = true;
|
|
3655
3659
|
sheetStack.promote(this.id);
|
|
3656
3660
|
}
|
|
3657
3661
|
const settleCap = this.snaps.getMaxAxisSize();
|
|
@@ -3733,7 +3737,8 @@ var BottomSheetCore = class {
|
|
|
3733
3737
|
return Math.min(Math.max((size - min) / (reachableMax - min), 0), 1);
|
|
3734
3738
|
}
|
|
3735
3739
|
handleOpen() {
|
|
3736
|
-
|
|
3740
|
+
if (this.promotedForOpen) this.promotedForOpen = false;
|
|
3741
|
+
else sheetStack.promote(this.id);
|
|
3737
3742
|
try {
|
|
3738
3743
|
this.lifecycle.install();
|
|
3739
3744
|
} catch (err) {
|
|
@@ -3765,6 +3770,7 @@ var BottomSheetCore = class {
|
|
|
3765
3770
|
}
|
|
3766
3771
|
handleClose() {
|
|
3767
3772
|
this.opening = false;
|
|
3773
|
+
this.promotedForOpen = false;
|
|
3768
3774
|
this.lifecycle.release();
|
|
3769
3775
|
sheetStack.update();
|
|
3770
3776
|
}
|
package/dist/svelte-core.js
CHANGED
|
@@ -774,7 +774,6 @@ var ScrimController = class {
|
|
|
774
774
|
__publicField(this, "backdrop");
|
|
775
775
|
__publicField(this, "mode");
|
|
776
776
|
__publicField(this, "isDestroyed");
|
|
777
|
-
__publicField(this, "isTopSheet");
|
|
778
777
|
__publicField(this, "getAllowedIds");
|
|
779
778
|
__publicField(this, "getResolvedSnaps");
|
|
780
779
|
__publicField(this, "snapToFn");
|
|
@@ -796,7 +795,6 @@ var ScrimController = class {
|
|
|
796
795
|
this.backdrop = deps.backdrop;
|
|
797
796
|
this.mode = deps.mode;
|
|
798
797
|
this.isDestroyed = deps.isDestroyed;
|
|
799
|
-
this.isTopSheet = deps.isTopSheet;
|
|
800
798
|
this.getAllowedIds = deps.getAllowedIds;
|
|
801
799
|
this.getResolvedSnaps = deps.getResolvedSnaps;
|
|
802
800
|
this.snapToFn = deps.snapTo;
|
|
@@ -845,18 +843,16 @@ var ScrimController = class {
|
|
|
845
843
|
Math.max((progress - s) / range, 0),
|
|
846
844
|
1
|
|
847
845
|
);
|
|
848
|
-
if (this.
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
)
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
this.lastBackdropPointer = nextPointer;
|
|
859
|
-
}
|
|
846
|
+
if (this.backdropOpacitySentinel.shouldWrite(
|
|
847
|
+
backdropOpacity,
|
|
848
|
+
OPACITY_WRITE_EPSILON
|
|
849
|
+
)) {
|
|
850
|
+
this.backdrop.style.opacity = String(backdropOpacity);
|
|
851
|
+
}
|
|
852
|
+
const nextPointer = backdropOpacity > POINTER_EVENTS_OPACITY_THRESHOLD ? "auto" : "none";
|
|
853
|
+
if (nextPointer !== this.lastBackdropPointer) {
|
|
854
|
+
this.backdrop.style.pointerEvents = nextPointer;
|
|
855
|
+
this.lastBackdropPointer = nextPointer;
|
|
860
856
|
}
|
|
861
857
|
}
|
|
862
858
|
if (this.screenComponent && this.scrimMode !== "off") {
|
|
@@ -1386,18 +1382,20 @@ var AnimationRunner = class {
|
|
|
1386
1382
|
get isAnimating() {
|
|
1387
1383
|
return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
|
|
1388
1384
|
}
|
|
1385
|
+
cancelWaapi() {
|
|
1386
|
+
if (!this.currentWaapi) return;
|
|
1387
|
+
const entry = this.currentWaapi;
|
|
1388
|
+
this.currentWaapi = null;
|
|
1389
|
+
entry.stop();
|
|
1390
|
+
try {
|
|
1391
|
+
entry.anim.cancel();
|
|
1392
|
+
} catch {
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1389
1395
|
cancel() {
|
|
1390
1396
|
this.currentTween?.cancel();
|
|
1391
1397
|
this.currentSpring?.cancel();
|
|
1392
|
-
|
|
1393
|
-
const entry = this.currentWaapi;
|
|
1394
|
-
this.currentWaapi = null;
|
|
1395
|
-
entry.stop();
|
|
1396
|
-
try {
|
|
1397
|
-
entry.anim.cancel();
|
|
1398
|
-
} catch {
|
|
1399
|
-
}
|
|
1400
|
-
}
|
|
1398
|
+
this.cancelWaapi();
|
|
1401
1399
|
}
|
|
1402
1400
|
async animateTo(target, velocityPxPerMs) {
|
|
1403
1401
|
if (target === this.getSize()) {
|
|
@@ -1408,6 +1406,7 @@ var AnimationRunner = class {
|
|
|
1408
1406
|
}
|
|
1409
1407
|
this.currentTween?.cancel();
|
|
1410
1408
|
this.currentSpring?.cancel();
|
|
1409
|
+
this.cancelWaapi();
|
|
1411
1410
|
this.getRootEl()?.setAttribute("data-animating", "true");
|
|
1412
1411
|
this.element.style.willChange = "transform";
|
|
1413
1412
|
if (this.reducedMotion) {
|
|
@@ -2618,6 +2617,7 @@ var BottomSheetCore = class {
|
|
|
2618
2617
|
__publicField(this, "progressWriteSentinel", new WriteSentinel());
|
|
2619
2618
|
__publicField(this, "isTopSheet", true);
|
|
2620
2619
|
__publicField(this, "opening", false);
|
|
2620
|
+
__publicField(this, "promotedForOpen", false);
|
|
2621
2621
|
__publicField(this, "allowOvershoot", false);
|
|
2622
2622
|
__publicField(this, "progressPayload", {
|
|
2623
2623
|
value: 0,
|
|
@@ -2674,7 +2674,6 @@ var BottomSheetCore = class {
|
|
|
2674
2674
|
screenComponent: this.screenComponent,
|
|
2675
2675
|
backdrop: this.backdrop,
|
|
2676
2676
|
isDestroyed: () => this.destroyed,
|
|
2677
|
-
isTopSheet: () => this.isTopSheet,
|
|
2678
2677
|
getAllowedIds: () => this.snaps.getAllowedIds().slice(),
|
|
2679
2678
|
getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
|
|
2680
2679
|
snapTo: (id) => {
|
|
@@ -2944,13 +2943,14 @@ var BottomSheetCore = class {
|
|
|
2944
2943
|
if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
|
|
2945
2944
|
return;
|
|
2946
2945
|
}
|
|
2946
|
+
const resumingOpen = this.opening;
|
|
2947
2947
|
const signal = this.newCycle();
|
|
2948
2948
|
const onExternalAbort = () => {
|
|
2949
2949
|
this.animation.cancel();
|
|
2950
2950
|
this.newCycle();
|
|
2951
2951
|
};
|
|
2952
2952
|
externalSignal?.addEventListener("abort", onExternalAbort, { once: true });
|
|
2953
|
-
const wasClosed = this.size === 0;
|
|
2953
|
+
const wasClosed = this.size === 0 || resumingOpen;
|
|
2954
2954
|
const previousId = this.activeId;
|
|
2955
2955
|
const previousSize = this.size;
|
|
2956
2956
|
this.scrollCache.cache(previousId, previousSize, target.size);
|
|
@@ -2959,7 +2959,10 @@ var BottomSheetCore = class {
|
|
|
2959
2959
|
const opensToRest = id === "closed" || rawTargetSize === 0;
|
|
2960
2960
|
if (wasClosed && !opensToRest) {
|
|
2961
2961
|
this.opening = true;
|
|
2962
|
-
|
|
2962
|
+
if (!resumingOpen) {
|
|
2963
|
+
this.promotedForOpen = true;
|
|
2964
|
+
sheetStack.promote(this.id);
|
|
2965
|
+
}
|
|
2963
2966
|
}
|
|
2964
2967
|
if (this.animation.viewTransitionsAvailable) {
|
|
2965
2968
|
this.currentViewTransition?.skipTransition?.();
|
|
@@ -3650,6 +3653,7 @@ var BottomSheetCore = class {
|
|
|
3650
3653
|
this.activeId = target.id;
|
|
3651
3654
|
if (previousSnapSize === 0 && target.size > 0) {
|
|
3652
3655
|
this.opening = true;
|
|
3656
|
+
this.promotedForOpen = true;
|
|
3653
3657
|
sheetStack.promote(this.id);
|
|
3654
3658
|
}
|
|
3655
3659
|
const settleCap = this.snaps.getMaxAxisSize();
|
|
@@ -3731,7 +3735,8 @@ var BottomSheetCore = class {
|
|
|
3731
3735
|
return Math.min(Math.max((size - min) / (reachableMax - min), 0), 1);
|
|
3732
3736
|
}
|
|
3733
3737
|
handleOpen() {
|
|
3734
|
-
|
|
3738
|
+
if (this.promotedForOpen) this.promotedForOpen = false;
|
|
3739
|
+
else sheetStack.promote(this.id);
|
|
3735
3740
|
try {
|
|
3736
3741
|
this.lifecycle.install();
|
|
3737
3742
|
} catch (err) {
|
|
@@ -3763,6 +3768,7 @@ var BottomSheetCore = class {
|
|
|
3763
3768
|
}
|
|
3764
3769
|
handleClose() {
|
|
3765
3770
|
this.opening = false;
|
|
3771
|
+
this.promotedForOpen = false;
|
|
3766
3772
|
this.lifecycle.release();
|
|
3767
3773
|
sheetStack.update();
|
|
3768
3774
|
}
|
|
@@ -286,6 +286,9 @@
|
|
|
286
286
|
$effect(() => {
|
|
287
287
|
if (dragFrom !== undefined) engine?.setDragFrom(dragFrom);
|
|
288
288
|
});
|
|
289
|
+
$effect(() => {
|
|
290
|
+
if (mode !== undefined) engine?.setMode(mode);
|
|
291
|
+
});
|
|
289
292
|
$effect(() => {
|
|
290
293
|
if (radius !== undefined) engine?.setRadius(radius);
|
|
291
294
|
});
|