@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/react.cjs
CHANGED
|
@@ -784,7 +784,6 @@ var ScrimController = class {
|
|
|
784
784
|
__publicField(this, "backdrop");
|
|
785
785
|
__publicField(this, "mode");
|
|
786
786
|
__publicField(this, "isDestroyed");
|
|
787
|
-
__publicField(this, "isTopSheet");
|
|
788
787
|
__publicField(this, "getAllowedIds");
|
|
789
788
|
__publicField(this, "getResolvedSnaps");
|
|
790
789
|
__publicField(this, "snapToFn");
|
|
@@ -806,7 +805,6 @@ var ScrimController = class {
|
|
|
806
805
|
this.backdrop = deps.backdrop;
|
|
807
806
|
this.mode = deps.mode;
|
|
808
807
|
this.isDestroyed = deps.isDestroyed;
|
|
809
|
-
this.isTopSheet = deps.isTopSheet;
|
|
810
808
|
this.getAllowedIds = deps.getAllowedIds;
|
|
811
809
|
this.getResolvedSnaps = deps.getResolvedSnaps;
|
|
812
810
|
this.snapToFn = deps.snapTo;
|
|
@@ -855,18 +853,16 @@ var ScrimController = class {
|
|
|
855
853
|
Math.max((progress - s) / range, 0),
|
|
856
854
|
1
|
|
857
855
|
);
|
|
858
|
-
if (this.
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
)
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
this.lastBackdropPointer = nextPointer;
|
|
869
|
-
}
|
|
856
|
+
if (this.backdropOpacitySentinel.shouldWrite(
|
|
857
|
+
backdropOpacity,
|
|
858
|
+
OPACITY_WRITE_EPSILON
|
|
859
|
+
)) {
|
|
860
|
+
this.backdrop.style.opacity = String(backdropOpacity);
|
|
861
|
+
}
|
|
862
|
+
const nextPointer = backdropOpacity > POINTER_EVENTS_OPACITY_THRESHOLD ? "auto" : "none";
|
|
863
|
+
if (nextPointer !== this.lastBackdropPointer) {
|
|
864
|
+
this.backdrop.style.pointerEvents = nextPointer;
|
|
865
|
+
this.lastBackdropPointer = nextPointer;
|
|
870
866
|
}
|
|
871
867
|
}
|
|
872
868
|
if (this.screenComponent && this.scrimMode !== "off") {
|
|
@@ -1396,18 +1392,20 @@ var AnimationRunner = class {
|
|
|
1396
1392
|
get isAnimating() {
|
|
1397
1393
|
return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
|
|
1398
1394
|
}
|
|
1395
|
+
cancelWaapi() {
|
|
1396
|
+
if (!this.currentWaapi) return;
|
|
1397
|
+
const entry = this.currentWaapi;
|
|
1398
|
+
this.currentWaapi = null;
|
|
1399
|
+
entry.stop();
|
|
1400
|
+
try {
|
|
1401
|
+
entry.anim.cancel();
|
|
1402
|
+
} catch {
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1399
1405
|
cancel() {
|
|
1400
1406
|
this.currentTween?.cancel();
|
|
1401
1407
|
this.currentSpring?.cancel();
|
|
1402
|
-
|
|
1403
|
-
const entry = this.currentWaapi;
|
|
1404
|
-
this.currentWaapi = null;
|
|
1405
|
-
entry.stop();
|
|
1406
|
-
try {
|
|
1407
|
-
entry.anim.cancel();
|
|
1408
|
-
} catch {
|
|
1409
|
-
}
|
|
1410
|
-
}
|
|
1408
|
+
this.cancelWaapi();
|
|
1411
1409
|
}
|
|
1412
1410
|
async animateTo(target, velocityPxPerMs) {
|
|
1413
1411
|
if (target === this.getSize()) {
|
|
@@ -1418,6 +1416,7 @@ var AnimationRunner = class {
|
|
|
1418
1416
|
}
|
|
1419
1417
|
this.currentTween?.cancel();
|
|
1420
1418
|
this.currentSpring?.cancel();
|
|
1419
|
+
this.cancelWaapi();
|
|
1421
1420
|
this.getRootEl()?.setAttribute("data-animating", "true");
|
|
1422
1421
|
this.element.style.willChange = "transform";
|
|
1423
1422
|
if (this.reducedMotion) {
|
|
@@ -2628,6 +2627,7 @@ var BottomSheetCore = class {
|
|
|
2628
2627
|
__publicField(this, "progressWriteSentinel", new WriteSentinel());
|
|
2629
2628
|
__publicField(this, "isTopSheet", true);
|
|
2630
2629
|
__publicField(this, "opening", false);
|
|
2630
|
+
__publicField(this, "promotedForOpen", false);
|
|
2631
2631
|
__publicField(this, "allowOvershoot", false);
|
|
2632
2632
|
__publicField(this, "progressPayload", {
|
|
2633
2633
|
value: 0,
|
|
@@ -2684,7 +2684,6 @@ var BottomSheetCore = class {
|
|
|
2684
2684
|
screenComponent: this.screenComponent,
|
|
2685
2685
|
backdrop: this.backdrop,
|
|
2686
2686
|
isDestroyed: () => this.destroyed,
|
|
2687
|
-
isTopSheet: () => this.isTopSheet,
|
|
2688
2687
|
getAllowedIds: () => this.snaps.getAllowedIds().slice(),
|
|
2689
2688
|
getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
|
|
2690
2689
|
snapTo: (id) => {
|
|
@@ -2954,13 +2953,14 @@ var BottomSheetCore = class {
|
|
|
2954
2953
|
if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
|
|
2955
2954
|
return;
|
|
2956
2955
|
}
|
|
2956
|
+
const resumingOpen = this.opening;
|
|
2957
2957
|
const signal = this.newCycle();
|
|
2958
2958
|
const onExternalAbort = () => {
|
|
2959
2959
|
this.animation.cancel();
|
|
2960
2960
|
this.newCycle();
|
|
2961
2961
|
};
|
|
2962
2962
|
externalSignal?.addEventListener("abort", onExternalAbort, { once: true });
|
|
2963
|
-
const wasClosed = this.size === 0;
|
|
2963
|
+
const wasClosed = this.size === 0 || resumingOpen;
|
|
2964
2964
|
const previousId = this.activeId;
|
|
2965
2965
|
const previousSize = this.size;
|
|
2966
2966
|
this.scrollCache.cache(previousId, previousSize, target.size);
|
|
@@ -2969,7 +2969,10 @@ var BottomSheetCore = class {
|
|
|
2969
2969
|
const opensToRest = id === "closed" || rawTargetSize === 0;
|
|
2970
2970
|
if (wasClosed && !opensToRest) {
|
|
2971
2971
|
this.opening = true;
|
|
2972
|
-
|
|
2972
|
+
if (!resumingOpen) {
|
|
2973
|
+
this.promotedForOpen = true;
|
|
2974
|
+
sheetStack.promote(this.id);
|
|
2975
|
+
}
|
|
2973
2976
|
}
|
|
2974
2977
|
if (this.animation.viewTransitionsAvailable) {
|
|
2975
2978
|
this.currentViewTransition?.skipTransition?.();
|
|
@@ -3660,6 +3663,7 @@ var BottomSheetCore = class {
|
|
|
3660
3663
|
this.activeId = target.id;
|
|
3661
3664
|
if (previousSnapSize === 0 && target.size > 0) {
|
|
3662
3665
|
this.opening = true;
|
|
3666
|
+
this.promotedForOpen = true;
|
|
3663
3667
|
sheetStack.promote(this.id);
|
|
3664
3668
|
}
|
|
3665
3669
|
const settleCap = this.snaps.getMaxAxisSize();
|
|
@@ -3741,7 +3745,8 @@ var BottomSheetCore = class {
|
|
|
3741
3745
|
return Math.min(Math.max((size - min) / (reachableMax - min), 0), 1);
|
|
3742
3746
|
}
|
|
3743
3747
|
handleOpen() {
|
|
3744
|
-
|
|
3748
|
+
if (this.promotedForOpen) this.promotedForOpen = false;
|
|
3749
|
+
else sheetStack.promote(this.id);
|
|
3745
3750
|
try {
|
|
3746
3751
|
this.lifecycle.install();
|
|
3747
3752
|
} catch (err) {
|
|
@@ -3773,6 +3778,7 @@ var BottomSheetCore = class {
|
|
|
3773
3778
|
}
|
|
3774
3779
|
handleClose() {
|
|
3775
3780
|
this.opening = false;
|
|
3781
|
+
this.promotedForOpen = false;
|
|
3776
3782
|
this.lifecycle.release();
|
|
3777
3783
|
sheetStack.update();
|
|
3778
3784
|
}
|
|
@@ -4667,6 +4673,11 @@ var BottomSheet = react.forwardRef(
|
|
|
4667
4673
|
react.useEffect(() => {
|
|
4668
4674
|
onChange?.(state);
|
|
4669
4675
|
}, [state, onChange]);
|
|
4676
|
+
const mode = engineOpts.mode;
|
|
4677
|
+
react.useEffect(() => {
|
|
4678
|
+
if (mode === void 0) return;
|
|
4679
|
+
getEngine()?.setMode(mode);
|
|
4680
|
+
}, [getEngine, mode]);
|
|
4670
4681
|
const [anchorHosts, setAnchorHosts] = react.useState([]);
|
|
4671
4682
|
const anchorsKey = anchors ? JSON.stringify(
|
|
4672
4683
|
anchors.map((a) => [
|
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
|
@@ -782,7 +782,6 @@ var ScrimController = class {
|
|
|
782
782
|
__publicField(this, "backdrop");
|
|
783
783
|
__publicField(this, "mode");
|
|
784
784
|
__publicField(this, "isDestroyed");
|
|
785
|
-
__publicField(this, "isTopSheet");
|
|
786
785
|
__publicField(this, "getAllowedIds");
|
|
787
786
|
__publicField(this, "getResolvedSnaps");
|
|
788
787
|
__publicField(this, "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;
|
|
@@ -853,18 +851,16 @@ var ScrimController = class {
|
|
|
853
851
|
Math.max((progress - s) / range, 0),
|
|
854
852
|
1
|
|
855
853
|
);
|
|
856
|
-
if (this.
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
)
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
this.lastBackdropPointer = nextPointer;
|
|
867
|
-
}
|
|
854
|
+
if (this.backdropOpacitySentinel.shouldWrite(
|
|
855
|
+
backdropOpacity,
|
|
856
|
+
OPACITY_WRITE_EPSILON
|
|
857
|
+
)) {
|
|
858
|
+
this.backdrop.style.opacity = String(backdropOpacity);
|
|
859
|
+
}
|
|
860
|
+
const nextPointer = backdropOpacity > POINTER_EVENTS_OPACITY_THRESHOLD ? "auto" : "none";
|
|
861
|
+
if (nextPointer !== this.lastBackdropPointer) {
|
|
862
|
+
this.backdrop.style.pointerEvents = nextPointer;
|
|
863
|
+
this.lastBackdropPointer = nextPointer;
|
|
868
864
|
}
|
|
869
865
|
}
|
|
870
866
|
if (this.screenComponent && this.scrimMode !== "off") {
|
|
@@ -1394,18 +1390,20 @@ var AnimationRunner = class {
|
|
|
1394
1390
|
get isAnimating() {
|
|
1395
1391
|
return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
|
|
1396
1392
|
}
|
|
1393
|
+
cancelWaapi() {
|
|
1394
|
+
if (!this.currentWaapi) return;
|
|
1395
|
+
const entry = this.currentWaapi;
|
|
1396
|
+
this.currentWaapi = null;
|
|
1397
|
+
entry.stop();
|
|
1398
|
+
try {
|
|
1399
|
+
entry.anim.cancel();
|
|
1400
|
+
} catch {
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1397
1403
|
cancel() {
|
|
1398
1404
|
this.currentTween?.cancel();
|
|
1399
1405
|
this.currentSpring?.cancel();
|
|
1400
|
-
|
|
1401
|
-
const entry = this.currentWaapi;
|
|
1402
|
-
this.currentWaapi = null;
|
|
1403
|
-
entry.stop();
|
|
1404
|
-
try {
|
|
1405
|
-
entry.anim.cancel();
|
|
1406
|
-
} catch {
|
|
1407
|
-
}
|
|
1408
|
-
}
|
|
1406
|
+
this.cancelWaapi();
|
|
1409
1407
|
}
|
|
1410
1408
|
async animateTo(target, velocityPxPerMs) {
|
|
1411
1409
|
if (target === this.getSize()) {
|
|
@@ -1416,6 +1414,7 @@ var AnimationRunner = class {
|
|
|
1416
1414
|
}
|
|
1417
1415
|
this.currentTween?.cancel();
|
|
1418
1416
|
this.currentSpring?.cancel();
|
|
1417
|
+
this.cancelWaapi();
|
|
1419
1418
|
this.getRootEl()?.setAttribute("data-animating", "true");
|
|
1420
1419
|
this.element.style.willChange = "transform";
|
|
1421
1420
|
if (this.reducedMotion) {
|
|
@@ -2626,6 +2625,7 @@ var BottomSheetCore = class {
|
|
|
2626
2625
|
__publicField(this, "progressWriteSentinel", new WriteSentinel());
|
|
2627
2626
|
__publicField(this, "isTopSheet", true);
|
|
2628
2627
|
__publicField(this, "opening", false);
|
|
2628
|
+
__publicField(this, "promotedForOpen", false);
|
|
2629
2629
|
__publicField(this, "allowOvershoot", false);
|
|
2630
2630
|
__publicField(this, "progressPayload", {
|
|
2631
2631
|
value: 0,
|
|
@@ -2682,7 +2682,6 @@ var BottomSheetCore = class {
|
|
|
2682
2682
|
screenComponent: this.screenComponent,
|
|
2683
2683
|
backdrop: this.backdrop,
|
|
2684
2684
|
isDestroyed: () => this.destroyed,
|
|
2685
|
-
isTopSheet: () => this.isTopSheet,
|
|
2686
2685
|
getAllowedIds: () => this.snaps.getAllowedIds().slice(),
|
|
2687
2686
|
getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
|
|
2688
2687
|
snapTo: (id) => {
|
|
@@ -2952,13 +2951,14 @@ var BottomSheetCore = class {
|
|
|
2952
2951
|
if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
|
|
2953
2952
|
return;
|
|
2954
2953
|
}
|
|
2954
|
+
const resumingOpen = this.opening;
|
|
2955
2955
|
const signal = this.newCycle();
|
|
2956
2956
|
const onExternalAbort = () => {
|
|
2957
2957
|
this.animation.cancel();
|
|
2958
2958
|
this.newCycle();
|
|
2959
2959
|
};
|
|
2960
2960
|
externalSignal?.addEventListener("abort", onExternalAbort, { once: true });
|
|
2961
|
-
const wasClosed = this.size === 0;
|
|
2961
|
+
const wasClosed = this.size === 0 || resumingOpen;
|
|
2962
2962
|
const previousId = this.activeId;
|
|
2963
2963
|
const previousSize = this.size;
|
|
2964
2964
|
this.scrollCache.cache(previousId, previousSize, target.size);
|
|
@@ -2967,7 +2967,10 @@ var BottomSheetCore = class {
|
|
|
2967
2967
|
const opensToRest = id === "closed" || rawTargetSize === 0;
|
|
2968
2968
|
if (wasClosed && !opensToRest) {
|
|
2969
2969
|
this.opening = true;
|
|
2970
|
-
|
|
2970
|
+
if (!resumingOpen) {
|
|
2971
|
+
this.promotedForOpen = true;
|
|
2972
|
+
sheetStack.promote(this.id);
|
|
2973
|
+
}
|
|
2971
2974
|
}
|
|
2972
2975
|
if (this.animation.viewTransitionsAvailable) {
|
|
2973
2976
|
this.currentViewTransition?.skipTransition?.();
|
|
@@ -3658,6 +3661,7 @@ var BottomSheetCore = class {
|
|
|
3658
3661
|
this.activeId = target.id;
|
|
3659
3662
|
if (previousSnapSize === 0 && target.size > 0) {
|
|
3660
3663
|
this.opening = true;
|
|
3664
|
+
this.promotedForOpen = true;
|
|
3661
3665
|
sheetStack.promote(this.id);
|
|
3662
3666
|
}
|
|
3663
3667
|
const settleCap = this.snaps.getMaxAxisSize();
|
|
@@ -3739,7 +3743,8 @@ var BottomSheetCore = class {
|
|
|
3739
3743
|
return Math.min(Math.max((size - min) / (reachableMax - min), 0), 1);
|
|
3740
3744
|
}
|
|
3741
3745
|
handleOpen() {
|
|
3742
|
-
|
|
3746
|
+
if (this.promotedForOpen) this.promotedForOpen = false;
|
|
3747
|
+
else sheetStack.promote(this.id);
|
|
3743
3748
|
try {
|
|
3744
3749
|
this.lifecycle.install();
|
|
3745
3750
|
} catch (err) {
|
|
@@ -3771,6 +3776,7 @@ var BottomSheetCore = class {
|
|
|
3771
3776
|
}
|
|
3772
3777
|
handleClose() {
|
|
3773
3778
|
this.opening = false;
|
|
3779
|
+
this.promotedForOpen = false;
|
|
3774
3780
|
this.lifecycle.release();
|
|
3775
3781
|
sheetStack.update();
|
|
3776
3782
|
}
|
|
@@ -4665,6 +4671,11 @@ var BottomSheet = forwardRef(
|
|
|
4665
4671
|
useEffect(() => {
|
|
4666
4672
|
onChange?.(state);
|
|
4667
4673
|
}, [state, onChange]);
|
|
4674
|
+
const mode = engineOpts.mode;
|
|
4675
|
+
useEffect(() => {
|
|
4676
|
+
if (mode === void 0) return;
|
|
4677
|
+
getEngine()?.setMode(mode);
|
|
4678
|
+
}, [getEngine, mode]);
|
|
4668
4679
|
const [anchorHosts, setAnchorHosts] = useState([]);
|
|
4669
4680
|
const anchorsKey = anchors ? JSON.stringify(
|
|
4670
4681
|
anchors.map((a) => [
|
package/dist/solid.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
|
}
|
|
@@ -4417,6 +4423,12 @@ var BottomSheet = (props) => {
|
|
|
4417
4423
|
}, {
|
|
4418
4424
|
defer: true
|
|
4419
4425
|
}));
|
|
4426
|
+
solidJs.createEffect(solidJs.on(() => props.mode, (value, prev) => {
|
|
4427
|
+
if (!engine || prev === void 0 || value === void 0) return;
|
|
4428
|
+
engine.setMode(value);
|
|
4429
|
+
}, {
|
|
4430
|
+
defer: true
|
|
4431
|
+
}));
|
|
4420
4432
|
const showBackdrop = solidJs.createMemo(() => props.backdrop !== false);
|
|
4421
4433
|
const mode = solidJs.createMemo(() => props.mode ?? "bottom");
|
|
4422
4434
|
const ariaLabel = solidJs.createMemo(() => props.ariaLabel ?? "Bottom sheet");
|
package/dist/solid.d.cts
CHANGED
package/dist/solid.d.ts
CHANGED