@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
|
@@ -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;
|
|
@@ -857,15 +855,13 @@ class ScrimController {
|
|
|
857
855
|
const [s, e] = this.backdropRange;
|
|
858
856
|
const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
|
|
859
857
|
const backdropOpacity = Math.min(Math.max((progress - s) / range, 0), 1);
|
|
860
|
-
if (this.
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
this.lastBackdropPointer = nextPointer;
|
|
868
|
-
}
|
|
858
|
+
if (this.backdropOpacitySentinel.shouldWrite(backdropOpacity, OPACITY_WRITE_EPSILON)) {
|
|
859
|
+
this.backdrop.style.opacity = String(backdropOpacity);
|
|
860
|
+
}
|
|
861
|
+
const nextPointer = backdropOpacity > POINTER_EVENTS_OPACITY_THRESHOLD ? "auto" : "none";
|
|
862
|
+
if (nextPointer !== this.lastBackdropPointer) {
|
|
863
|
+
this.backdrop.style.pointerEvents = nextPointer;
|
|
864
|
+
this.lastBackdropPointer = nextPointer;
|
|
869
865
|
}
|
|
870
866
|
}
|
|
871
867
|
if (this.screenComponent && this.scrimMode !== "off") {
|
|
@@ -1410,18 +1406,20 @@ class AnimationRunner {
|
|
|
1410
1406
|
get isAnimating() {
|
|
1411
1407
|
return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
|
|
1412
1408
|
}
|
|
1409
|
+
cancelWaapi() {
|
|
1410
|
+
if (!this.currentWaapi) return;
|
|
1411
|
+
const entry = this.currentWaapi;
|
|
1412
|
+
this.currentWaapi = null;
|
|
1413
|
+
entry.stop();
|
|
1414
|
+
try {
|
|
1415
|
+
entry.anim.cancel();
|
|
1416
|
+
} catch {
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1413
1419
|
cancel() {
|
|
1414
1420
|
this.currentTween?.cancel();
|
|
1415
1421
|
this.currentSpring?.cancel();
|
|
1416
|
-
|
|
1417
|
-
const entry = this.currentWaapi;
|
|
1418
|
-
this.currentWaapi = null;
|
|
1419
|
-
entry.stop();
|
|
1420
|
-
try {
|
|
1421
|
-
entry.anim.cancel();
|
|
1422
|
-
} catch {
|
|
1423
|
-
}
|
|
1424
|
-
}
|
|
1422
|
+
this.cancelWaapi();
|
|
1425
1423
|
}
|
|
1426
1424
|
async animateTo(target, velocityPxPerMs) {
|
|
1427
1425
|
if (target === this.getSize()) {
|
|
@@ -1432,6 +1430,7 @@ class AnimationRunner {
|
|
|
1432
1430
|
}
|
|
1433
1431
|
this.currentTween?.cancel();
|
|
1434
1432
|
this.currentSpring?.cancel();
|
|
1433
|
+
this.cancelWaapi();
|
|
1435
1434
|
this.getRootEl()?.setAttribute("data-animating", "true");
|
|
1436
1435
|
this.element.style.willChange = "transform";
|
|
1437
1436
|
if (this.reducedMotion) {
|
|
@@ -2662,6 +2661,7 @@ class BottomSheetCore {
|
|
|
2662
2661
|
__publicField(this, "progressWriteSentinel", new WriteSentinel());
|
|
2663
2662
|
__publicField(this, "isTopSheet", true);
|
|
2664
2663
|
__publicField(this, "opening", false);
|
|
2664
|
+
__publicField(this, "promotedForOpen", false);
|
|
2665
2665
|
__publicField(this, "allowOvershoot", false);
|
|
2666
2666
|
__publicField(this, "progressPayload", {
|
|
2667
2667
|
value: 0,
|
|
@@ -2718,7 +2718,6 @@ class BottomSheetCore {
|
|
|
2718
2718
|
screenComponent: this.screenComponent,
|
|
2719
2719
|
backdrop: this.backdrop,
|
|
2720
2720
|
isDestroyed: () => this.destroyed,
|
|
2721
|
-
isTopSheet: () => this.isTopSheet,
|
|
2722
2721
|
getAllowedIds: () => this.snaps.getAllowedIds().slice(),
|
|
2723
2722
|
getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
|
|
2724
2723
|
snapTo: (id) => {
|
|
@@ -2966,6 +2965,7 @@ class BottomSheetCore {
|
|
|
2966
2965
|
if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
|
|
2967
2966
|
return;
|
|
2968
2967
|
}
|
|
2968
|
+
const resumingOpen = this.opening;
|
|
2969
2969
|
const signal = this.newCycle();
|
|
2970
2970
|
const onExternalAbort = () => {
|
|
2971
2971
|
this.animation.cancel();
|
|
@@ -2974,7 +2974,7 @@ class BottomSheetCore {
|
|
|
2974
2974
|
externalSignal?.addEventListener("abort", onExternalAbort, {
|
|
2975
2975
|
once: true
|
|
2976
2976
|
});
|
|
2977
|
-
const wasClosed = this.size === 0;
|
|
2977
|
+
const wasClosed = this.size === 0 || resumingOpen;
|
|
2978
2978
|
const previousId = this.activeId;
|
|
2979
2979
|
const previousSize = this.size;
|
|
2980
2980
|
this.scrollCache.cache(previousId, previousSize, target.size);
|
|
@@ -2983,7 +2983,10 @@ class BottomSheetCore {
|
|
|
2983
2983
|
const opensToRest = id === "closed" || rawTargetSize === 0;
|
|
2984
2984
|
if (wasClosed && !opensToRest) {
|
|
2985
2985
|
this.opening = true;
|
|
2986
|
-
|
|
2986
|
+
if (!resumingOpen) {
|
|
2987
|
+
this.promotedForOpen = true;
|
|
2988
|
+
sheetStack.promote(this.id);
|
|
2989
|
+
}
|
|
2987
2990
|
}
|
|
2988
2991
|
if (this.animation.viewTransitionsAvailable) {
|
|
2989
2992
|
this.currentViewTransition?.skipTransition?.();
|
|
@@ -3663,6 +3666,7 @@ class BottomSheetCore {
|
|
|
3663
3666
|
this.activeId = target.id;
|
|
3664
3667
|
if (previousSnapSize === 0 && target.size > 0) {
|
|
3665
3668
|
this.opening = true;
|
|
3669
|
+
this.promotedForOpen = true;
|
|
3666
3670
|
sheetStack.promote(this.id);
|
|
3667
3671
|
}
|
|
3668
3672
|
const settleCap = this.snaps.getMaxAxisSize();
|
|
@@ -3735,7 +3739,8 @@ class BottomSheetCore {
|
|
|
3735
3739
|
return Math.min(Math.max((size - min) / (reachableMax - min), 0), 1);
|
|
3736
3740
|
}
|
|
3737
3741
|
handleOpen() {
|
|
3738
|
-
|
|
3742
|
+
if (this.promotedForOpen) this.promotedForOpen = false;
|
|
3743
|
+
else sheetStack.promote(this.id);
|
|
3739
3744
|
try {
|
|
3740
3745
|
this.lifecycle.install();
|
|
3741
3746
|
} catch (err) {
|
|
@@ -3767,6 +3772,7 @@ class BottomSheetCore {
|
|
|
3767
3772
|
}
|
|
3768
3773
|
handleClose() {
|
|
3769
3774
|
this.opening = false;
|
|
3775
|
+
this.promotedForOpen = false;
|
|
3770
3776
|
this.lifecycle.release();
|
|
3771
3777
|
sheetStack.update();
|
|
3772
3778
|
}
|
|
@@ -4424,6 +4430,12 @@ const BottomSheet = qwik.component$((props) => {
|
|
|
4424
4430
|
}
|
|
4425
4431
|
if (dragFrom !== void 0) engine.setDragFrom(dragFrom);
|
|
4426
4432
|
});
|
|
4433
|
+
qwik.useTask$(({ track }) => {
|
|
4434
|
+
const nextMode = track(() => props.mode);
|
|
4435
|
+
const engine = engineStore.engine;
|
|
4436
|
+
if (!engine || nextMode === void 0) return;
|
|
4437
|
+
engine.setMode(nextMode);
|
|
4438
|
+
});
|
|
4427
4439
|
const showBackdrop = props.backdrop !== false;
|
|
4428
4440
|
const mode = props.mode ?? "bottom";
|
|
4429
4441
|
const ariaLabel = props.ariaLabel ?? "Bottom sheet";
|
|
@@ -781,7 +781,6 @@ class ScrimController {
|
|
|
781
781
|
__publicField(this, "backdrop");
|
|
782
782
|
__publicField(this, "mode");
|
|
783
783
|
__publicField(this, "isDestroyed");
|
|
784
|
-
__publicField(this, "isTopSheet");
|
|
785
784
|
__publicField(this, "getAllowedIds");
|
|
786
785
|
__publicField(this, "getResolvedSnaps");
|
|
787
786
|
__publicField(this, "snapToFn");
|
|
@@ -803,7 +802,6 @@ class ScrimController {
|
|
|
803
802
|
this.backdrop = deps.backdrop;
|
|
804
803
|
this.mode = deps.mode;
|
|
805
804
|
this.isDestroyed = deps.isDestroyed;
|
|
806
|
-
this.isTopSheet = deps.isTopSheet;
|
|
807
805
|
this.getAllowedIds = deps.getAllowedIds;
|
|
808
806
|
this.getResolvedSnaps = deps.getResolvedSnaps;
|
|
809
807
|
this.snapToFn = deps.snapTo;
|
|
@@ -855,15 +853,13 @@ class ScrimController {
|
|
|
855
853
|
const [s, e] = this.backdropRange;
|
|
856
854
|
const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
|
|
857
855
|
const backdropOpacity = Math.min(Math.max((progress - s) / range, 0), 1);
|
|
858
|
-
if (this.
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
this.lastBackdropPointer = nextPointer;
|
|
866
|
-
}
|
|
856
|
+
if (this.backdropOpacitySentinel.shouldWrite(backdropOpacity, OPACITY_WRITE_EPSILON)) {
|
|
857
|
+
this.backdrop.style.opacity = String(backdropOpacity);
|
|
858
|
+
}
|
|
859
|
+
const nextPointer = backdropOpacity > POINTER_EVENTS_OPACITY_THRESHOLD ? "auto" : "none";
|
|
860
|
+
if (nextPointer !== this.lastBackdropPointer) {
|
|
861
|
+
this.backdrop.style.pointerEvents = nextPointer;
|
|
862
|
+
this.lastBackdropPointer = nextPointer;
|
|
867
863
|
}
|
|
868
864
|
}
|
|
869
865
|
if (this.screenComponent && this.scrimMode !== "off") {
|
|
@@ -1408,18 +1404,20 @@ class AnimationRunner {
|
|
|
1408
1404
|
get isAnimating() {
|
|
1409
1405
|
return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
|
|
1410
1406
|
}
|
|
1407
|
+
cancelWaapi() {
|
|
1408
|
+
if (!this.currentWaapi) return;
|
|
1409
|
+
const entry = this.currentWaapi;
|
|
1410
|
+
this.currentWaapi = null;
|
|
1411
|
+
entry.stop();
|
|
1412
|
+
try {
|
|
1413
|
+
entry.anim.cancel();
|
|
1414
|
+
} catch {
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1411
1417
|
cancel() {
|
|
1412
1418
|
this.currentTween?.cancel();
|
|
1413
1419
|
this.currentSpring?.cancel();
|
|
1414
|
-
|
|
1415
|
-
const entry = this.currentWaapi;
|
|
1416
|
-
this.currentWaapi = null;
|
|
1417
|
-
entry.stop();
|
|
1418
|
-
try {
|
|
1419
|
-
entry.anim.cancel();
|
|
1420
|
-
} catch {
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1420
|
+
this.cancelWaapi();
|
|
1423
1421
|
}
|
|
1424
1422
|
async animateTo(target, velocityPxPerMs) {
|
|
1425
1423
|
if (target === this.getSize()) {
|
|
@@ -1430,6 +1428,7 @@ class AnimationRunner {
|
|
|
1430
1428
|
}
|
|
1431
1429
|
this.currentTween?.cancel();
|
|
1432
1430
|
this.currentSpring?.cancel();
|
|
1431
|
+
this.cancelWaapi();
|
|
1433
1432
|
this.getRootEl()?.setAttribute("data-animating", "true");
|
|
1434
1433
|
this.element.style.willChange = "transform";
|
|
1435
1434
|
if (this.reducedMotion) {
|
|
@@ -2660,6 +2659,7 @@ class BottomSheetCore {
|
|
|
2660
2659
|
__publicField(this, "progressWriteSentinel", new WriteSentinel());
|
|
2661
2660
|
__publicField(this, "isTopSheet", true);
|
|
2662
2661
|
__publicField(this, "opening", false);
|
|
2662
|
+
__publicField(this, "promotedForOpen", false);
|
|
2663
2663
|
__publicField(this, "allowOvershoot", false);
|
|
2664
2664
|
__publicField(this, "progressPayload", {
|
|
2665
2665
|
value: 0,
|
|
@@ -2716,7 +2716,6 @@ class BottomSheetCore {
|
|
|
2716
2716
|
screenComponent: this.screenComponent,
|
|
2717
2717
|
backdrop: this.backdrop,
|
|
2718
2718
|
isDestroyed: () => this.destroyed,
|
|
2719
|
-
isTopSheet: () => this.isTopSheet,
|
|
2720
2719
|
getAllowedIds: () => this.snaps.getAllowedIds().slice(),
|
|
2721
2720
|
getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
|
|
2722
2721
|
snapTo: (id) => {
|
|
@@ -2964,6 +2963,7 @@ class BottomSheetCore {
|
|
|
2964
2963
|
if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
|
|
2965
2964
|
return;
|
|
2966
2965
|
}
|
|
2966
|
+
const resumingOpen = this.opening;
|
|
2967
2967
|
const signal = this.newCycle();
|
|
2968
2968
|
const onExternalAbort = () => {
|
|
2969
2969
|
this.animation.cancel();
|
|
@@ -2972,7 +2972,7 @@ class BottomSheetCore {
|
|
|
2972
2972
|
externalSignal?.addEventListener("abort", onExternalAbort, {
|
|
2973
2973
|
once: true
|
|
2974
2974
|
});
|
|
2975
|
-
const wasClosed = this.size === 0;
|
|
2975
|
+
const wasClosed = this.size === 0 || resumingOpen;
|
|
2976
2976
|
const previousId = this.activeId;
|
|
2977
2977
|
const previousSize = this.size;
|
|
2978
2978
|
this.scrollCache.cache(previousId, previousSize, target.size);
|
|
@@ -2981,7 +2981,10 @@ class BottomSheetCore {
|
|
|
2981
2981
|
const opensToRest = id === "closed" || rawTargetSize === 0;
|
|
2982
2982
|
if (wasClosed && !opensToRest) {
|
|
2983
2983
|
this.opening = true;
|
|
2984
|
-
|
|
2984
|
+
if (!resumingOpen) {
|
|
2985
|
+
this.promotedForOpen = true;
|
|
2986
|
+
sheetStack.promote(this.id);
|
|
2987
|
+
}
|
|
2985
2988
|
}
|
|
2986
2989
|
if (this.animation.viewTransitionsAvailable) {
|
|
2987
2990
|
this.currentViewTransition?.skipTransition?.();
|
|
@@ -3661,6 +3664,7 @@ class BottomSheetCore {
|
|
|
3661
3664
|
this.activeId = target.id;
|
|
3662
3665
|
if (previousSnapSize === 0 && target.size > 0) {
|
|
3663
3666
|
this.opening = true;
|
|
3667
|
+
this.promotedForOpen = true;
|
|
3664
3668
|
sheetStack.promote(this.id);
|
|
3665
3669
|
}
|
|
3666
3670
|
const settleCap = this.snaps.getMaxAxisSize();
|
|
@@ -3733,7 +3737,8 @@ class BottomSheetCore {
|
|
|
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 @@ class BottomSheetCore {
|
|
|
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
|
}
|
|
@@ -4422,6 +4428,12 @@ const BottomSheet = component$((props) => {
|
|
|
4422
4428
|
}
|
|
4423
4429
|
if (dragFrom !== void 0) engine.setDragFrom(dragFrom);
|
|
4424
4430
|
});
|
|
4431
|
+
useTask$(({ track }) => {
|
|
4432
|
+
const nextMode = track(() => props.mode);
|
|
4433
|
+
const engine = engineStore.engine;
|
|
4434
|
+
if (!engine || nextMode === void 0) return;
|
|
4435
|
+
engine.setMode(nextMode);
|
|
4436
|
+
});
|
|
4425
4437
|
const showBackdrop = props.backdrop !== false;
|
|
4426
4438
|
const mode = props.mode ?? "bottom";
|
|
4427
4439
|
const ariaLabel = props.ariaLabel ?? "Bottom sheet";
|
package/dist/qwik.cjs
CHANGED
|
@@ -777,7 +777,6 @@ var ScrimController = class {
|
|
|
777
777
|
__publicField(this, "backdrop");
|
|
778
778
|
__publicField(this, "mode");
|
|
779
779
|
__publicField(this, "isDestroyed");
|
|
780
|
-
__publicField(this, "isTopSheet");
|
|
781
780
|
__publicField(this, "getAllowedIds");
|
|
782
781
|
__publicField(this, "getResolvedSnaps");
|
|
783
782
|
__publicField(this, "snapToFn");
|
|
@@ -799,7 +798,6 @@ var ScrimController = class {
|
|
|
799
798
|
this.backdrop = deps.backdrop;
|
|
800
799
|
this.mode = deps.mode;
|
|
801
800
|
this.isDestroyed = deps.isDestroyed;
|
|
802
|
-
this.isTopSheet = deps.isTopSheet;
|
|
803
801
|
this.getAllowedIds = deps.getAllowedIds;
|
|
804
802
|
this.getResolvedSnaps = deps.getResolvedSnaps;
|
|
805
803
|
this.snapToFn = deps.snapTo;
|
|
@@ -848,18 +846,16 @@ var ScrimController = class {
|
|
|
848
846
|
Math.max((progress - s) / range, 0),
|
|
849
847
|
1
|
|
850
848
|
);
|
|
851
|
-
if (this.
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
)
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
this.lastBackdropPointer = nextPointer;
|
|
862
|
-
}
|
|
849
|
+
if (this.backdropOpacitySentinel.shouldWrite(
|
|
850
|
+
backdropOpacity,
|
|
851
|
+
OPACITY_WRITE_EPSILON
|
|
852
|
+
)) {
|
|
853
|
+
this.backdrop.style.opacity = String(backdropOpacity);
|
|
854
|
+
}
|
|
855
|
+
const nextPointer = backdropOpacity > POINTER_EVENTS_OPACITY_THRESHOLD ? "auto" : "none";
|
|
856
|
+
if (nextPointer !== this.lastBackdropPointer) {
|
|
857
|
+
this.backdrop.style.pointerEvents = nextPointer;
|
|
858
|
+
this.lastBackdropPointer = nextPointer;
|
|
863
859
|
}
|
|
864
860
|
}
|
|
865
861
|
if (this.screenComponent && this.scrimMode !== "off") {
|
|
@@ -1389,18 +1385,20 @@ var AnimationRunner = class {
|
|
|
1389
1385
|
get isAnimating() {
|
|
1390
1386
|
return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
|
|
1391
1387
|
}
|
|
1388
|
+
cancelWaapi() {
|
|
1389
|
+
if (!this.currentWaapi) return;
|
|
1390
|
+
const entry = this.currentWaapi;
|
|
1391
|
+
this.currentWaapi = null;
|
|
1392
|
+
entry.stop();
|
|
1393
|
+
try {
|
|
1394
|
+
entry.anim.cancel();
|
|
1395
|
+
} catch {
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1392
1398
|
cancel() {
|
|
1393
1399
|
this.currentTween?.cancel();
|
|
1394
1400
|
this.currentSpring?.cancel();
|
|
1395
|
-
|
|
1396
|
-
const entry = this.currentWaapi;
|
|
1397
|
-
this.currentWaapi = null;
|
|
1398
|
-
entry.stop();
|
|
1399
|
-
try {
|
|
1400
|
-
entry.anim.cancel();
|
|
1401
|
-
} catch {
|
|
1402
|
-
}
|
|
1403
|
-
}
|
|
1401
|
+
this.cancelWaapi();
|
|
1404
1402
|
}
|
|
1405
1403
|
async animateTo(target, velocityPxPerMs) {
|
|
1406
1404
|
if (target === this.getSize()) {
|
|
@@ -1411,6 +1409,7 @@ var AnimationRunner = class {
|
|
|
1411
1409
|
}
|
|
1412
1410
|
this.currentTween?.cancel();
|
|
1413
1411
|
this.currentSpring?.cancel();
|
|
1412
|
+
this.cancelWaapi();
|
|
1414
1413
|
this.getRootEl()?.setAttribute("data-animating", "true");
|
|
1415
1414
|
this.element.style.willChange = "transform";
|
|
1416
1415
|
if (this.reducedMotion) {
|
|
@@ -2621,6 +2620,7 @@ var BottomSheetCore = class {
|
|
|
2621
2620
|
__publicField(this, "progressWriteSentinel", new WriteSentinel());
|
|
2622
2621
|
__publicField(this, "isTopSheet", true);
|
|
2623
2622
|
__publicField(this, "opening", false);
|
|
2623
|
+
__publicField(this, "promotedForOpen", false);
|
|
2624
2624
|
__publicField(this, "allowOvershoot", false);
|
|
2625
2625
|
__publicField(this, "progressPayload", {
|
|
2626
2626
|
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
|
}
|
|
@@ -4436,6 +4442,12 @@ var BottomSheet = qwik.component$((props) => {
|
|
|
4436
4442
|
}
|
|
4437
4443
|
if (dragFrom !== void 0) engine.setDragFrom(dragFrom);
|
|
4438
4444
|
});
|
|
4445
|
+
qwik.useTask$(({ track }) => {
|
|
4446
|
+
const nextMode = track(() => props.mode);
|
|
4447
|
+
const engine = engineStore.engine;
|
|
4448
|
+
if (!engine || nextMode === void 0) return;
|
|
4449
|
+
engine.setMode(nextMode);
|
|
4450
|
+
});
|
|
4439
4451
|
const showBackdrop = props.backdrop !== false;
|
|
4440
4452
|
const mode = props.mode ?? "bottom";
|
|
4441
4453
|
const ariaLabel = props.ariaLabel ?? "Bottom sheet";
|
package/dist/qwik.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _builder_io_qwik from '@builder.io/qwik';
|
|
2
2
|
import { QRL } from '@builder.io/qwik';
|
|
3
3
|
import { T as TeleportTarget } from './teleport-7uYNiEAT.cjs';
|
|
4
|
-
import { a as SnapPointDef, b as SheetMode, c as EngineOptions, S as SheetEventMap, E as EngineState } from './BottomSheetCore-
|
|
5
|
-
export { d as SnapPoint } from './BottomSheetCore-
|
|
4
|
+
import { a as SnapPointDef, b as SheetMode, c as EngineOptions, S as SheetEventMap, E as EngineState } from './BottomSheetCore-BHv6LPmS.cjs';
|
|
5
|
+
export { d as SnapPoint } from './BottomSheetCore-BHv6LPmS.cjs';
|
|
6
6
|
import './transform-jVfAikE9.cjs';
|
|
7
7
|
|
|
8
8
|
type BottomSheetProps<TId extends string = string> = {
|
package/dist/qwik.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _builder_io_qwik from '@builder.io/qwik';
|
|
2
2
|
import { QRL } from '@builder.io/qwik';
|
|
3
3
|
import { T as TeleportTarget } from './teleport-7uYNiEAT.js';
|
|
4
|
-
import { a as SnapPointDef, b as SheetMode, c as EngineOptions, S as SheetEventMap, E as EngineState } from './BottomSheetCore-
|
|
5
|
-
export { d as SnapPoint } from './BottomSheetCore-
|
|
4
|
+
import { a as SnapPointDef, b as SheetMode, c as EngineOptions, S as SheetEventMap, E as EngineState } from './BottomSheetCore-CK_mq14p.js';
|
|
5
|
+
export { d as SnapPoint } from './BottomSheetCore-CK_mq14p.js';
|
|
6
6
|
import './transform-jVfAikE9.js';
|
|
7
7
|
|
|
8
8
|
type BottomSheetProps<TId extends string = string> = {
|
package/dist/qwik.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
|
}
|
|
@@ -4434,6 +4440,12 @@ var BottomSheet = component$((props) => {
|
|
|
4434
4440
|
}
|
|
4435
4441
|
if (dragFrom !== void 0) engine.setDragFrom(dragFrom);
|
|
4436
4442
|
});
|
|
4443
|
+
useTask$(({ track }) => {
|
|
4444
|
+
const nextMode = track(() => props.mode);
|
|
4445
|
+
const engine = engineStore.engine;
|
|
4446
|
+
if (!engine || nextMode === void 0) return;
|
|
4447
|
+
engine.setMode(nextMode);
|
|
4448
|
+
});
|
|
4437
4449
|
const showBackdrop = props.backdrop !== false;
|
|
4438
4450
|
const mode = props.mode ?? "bottom";
|
|
4439
4451
|
const ariaLabel = props.ariaLabel ?? "Bottom sheet";
|