@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/element.js
CHANGED
|
@@ -883,7 +883,6 @@ var init_scrim_controller = __esm({
|
|
|
883
883
|
__publicField(this, "backdrop");
|
|
884
884
|
__publicField(this, "mode");
|
|
885
885
|
__publicField(this, "isDestroyed");
|
|
886
|
-
__publicField(this, "isTopSheet");
|
|
887
886
|
__publicField(this, "getAllowedIds");
|
|
888
887
|
__publicField(this, "getResolvedSnaps");
|
|
889
888
|
__publicField(this, "snapToFn");
|
|
@@ -905,7 +904,6 @@ var init_scrim_controller = __esm({
|
|
|
905
904
|
this.backdrop = deps.backdrop;
|
|
906
905
|
this.mode = deps.mode;
|
|
907
906
|
this.isDestroyed = deps.isDestroyed;
|
|
908
|
-
this.isTopSheet = deps.isTopSheet;
|
|
909
907
|
this.getAllowedIds = deps.getAllowedIds;
|
|
910
908
|
this.getResolvedSnaps = deps.getResolvedSnaps;
|
|
911
909
|
this.snapToFn = deps.snapTo;
|
|
@@ -954,18 +952,16 @@ var init_scrim_controller = __esm({
|
|
|
954
952
|
Math.max((progress - s) / range, 0),
|
|
955
953
|
1
|
|
956
954
|
);
|
|
957
|
-
if (this.
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
)
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
this.lastBackdropPointer = nextPointer;
|
|
968
|
-
}
|
|
955
|
+
if (this.backdropOpacitySentinel.shouldWrite(
|
|
956
|
+
backdropOpacity,
|
|
957
|
+
OPACITY_WRITE_EPSILON
|
|
958
|
+
)) {
|
|
959
|
+
this.backdrop.style.opacity = String(backdropOpacity);
|
|
960
|
+
}
|
|
961
|
+
const nextPointer = backdropOpacity > POINTER_EVENTS_OPACITY_THRESHOLD ? "auto" : "none";
|
|
962
|
+
if (nextPointer !== this.lastBackdropPointer) {
|
|
963
|
+
this.backdrop.style.pointerEvents = nextPointer;
|
|
964
|
+
this.lastBackdropPointer = nextPointer;
|
|
969
965
|
}
|
|
970
966
|
}
|
|
971
967
|
if (this.screenComponent && this.scrimMode !== "off") {
|
|
@@ -1526,18 +1522,20 @@ var init_animation_runner = __esm({
|
|
|
1526
1522
|
get isAnimating() {
|
|
1527
1523
|
return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
|
|
1528
1524
|
}
|
|
1525
|
+
cancelWaapi() {
|
|
1526
|
+
if (!this.currentWaapi) return;
|
|
1527
|
+
const entry = this.currentWaapi;
|
|
1528
|
+
this.currentWaapi = null;
|
|
1529
|
+
entry.stop();
|
|
1530
|
+
try {
|
|
1531
|
+
entry.anim.cancel();
|
|
1532
|
+
} catch {
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1529
1535
|
cancel() {
|
|
1530
1536
|
this.currentTween?.cancel();
|
|
1531
1537
|
this.currentSpring?.cancel();
|
|
1532
|
-
|
|
1533
|
-
const entry = this.currentWaapi;
|
|
1534
|
-
this.currentWaapi = null;
|
|
1535
|
-
entry.stop();
|
|
1536
|
-
try {
|
|
1537
|
-
entry.anim.cancel();
|
|
1538
|
-
} catch {
|
|
1539
|
-
}
|
|
1540
|
-
}
|
|
1538
|
+
this.cancelWaapi();
|
|
1541
1539
|
}
|
|
1542
1540
|
async animateTo(target, velocityPxPerMs) {
|
|
1543
1541
|
if (target === this.getSize()) {
|
|
@@ -1548,6 +1546,7 @@ var init_animation_runner = __esm({
|
|
|
1548
1546
|
}
|
|
1549
1547
|
this.currentTween?.cancel();
|
|
1550
1548
|
this.currentSpring?.cancel();
|
|
1549
|
+
this.cancelWaapi();
|
|
1551
1550
|
this.getRootEl()?.setAttribute("data-animating", "true");
|
|
1552
1551
|
this.element.style.willChange = "transform";
|
|
1553
1552
|
if (this.reducedMotion) {
|
|
@@ -2894,6 +2893,7 @@ var init_BottomSheetCore = __esm({
|
|
|
2894
2893
|
__publicField(this, "progressWriteSentinel", new WriteSentinel());
|
|
2895
2894
|
__publicField(this, "isTopSheet", true);
|
|
2896
2895
|
__publicField(this, "opening", false);
|
|
2896
|
+
__publicField(this, "promotedForOpen", false);
|
|
2897
2897
|
__publicField(this, "allowOvershoot", false);
|
|
2898
2898
|
__publicField(this, "progressPayload", {
|
|
2899
2899
|
value: 0,
|
|
@@ -2950,7 +2950,6 @@ var init_BottomSheetCore = __esm({
|
|
|
2950
2950
|
screenComponent: this.screenComponent,
|
|
2951
2951
|
backdrop: this.backdrop,
|
|
2952
2952
|
isDestroyed: () => this.destroyed,
|
|
2953
|
-
isTopSheet: () => this.isTopSheet,
|
|
2954
2953
|
getAllowedIds: () => this.snaps.getAllowedIds().slice(),
|
|
2955
2954
|
getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
|
|
2956
2955
|
snapTo: (id) => {
|
|
@@ -3220,13 +3219,14 @@ var init_BottomSheetCore = __esm({
|
|
|
3220
3219
|
if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
|
|
3221
3220
|
return;
|
|
3222
3221
|
}
|
|
3222
|
+
const resumingOpen = this.opening;
|
|
3223
3223
|
const signal = this.newCycle();
|
|
3224
3224
|
const onExternalAbort = () => {
|
|
3225
3225
|
this.animation.cancel();
|
|
3226
3226
|
this.newCycle();
|
|
3227
3227
|
};
|
|
3228
3228
|
externalSignal?.addEventListener("abort", onExternalAbort, { once: true });
|
|
3229
|
-
const wasClosed = this.size === 0;
|
|
3229
|
+
const wasClosed = this.size === 0 || resumingOpen;
|
|
3230
3230
|
const previousId = this.activeId;
|
|
3231
3231
|
const previousSize = this.size;
|
|
3232
3232
|
this.scrollCache.cache(previousId, previousSize, target.size);
|
|
@@ -3235,7 +3235,10 @@ var init_BottomSheetCore = __esm({
|
|
|
3235
3235
|
const opensToRest = id === "closed" || rawTargetSize === 0;
|
|
3236
3236
|
if (wasClosed && !opensToRest) {
|
|
3237
3237
|
this.opening = true;
|
|
3238
|
-
|
|
3238
|
+
if (!resumingOpen) {
|
|
3239
|
+
this.promotedForOpen = true;
|
|
3240
|
+
sheetStack.promote(this.id);
|
|
3241
|
+
}
|
|
3239
3242
|
}
|
|
3240
3243
|
if (this.animation.viewTransitionsAvailable) {
|
|
3241
3244
|
this.currentViewTransition?.skipTransition?.();
|
|
@@ -3926,6 +3929,7 @@ var init_BottomSheetCore = __esm({
|
|
|
3926
3929
|
this.activeId = target.id;
|
|
3927
3930
|
if (previousSnapSize === 0 && target.size > 0) {
|
|
3928
3931
|
this.opening = true;
|
|
3932
|
+
this.promotedForOpen = true;
|
|
3929
3933
|
sheetStack.promote(this.id);
|
|
3930
3934
|
}
|
|
3931
3935
|
const settleCap = this.snaps.getMaxAxisSize();
|
|
@@ -4007,7 +4011,8 @@ var init_BottomSheetCore = __esm({
|
|
|
4007
4011
|
return Math.min(Math.max((size - min) / (reachableMax - min), 0), 1);
|
|
4008
4012
|
}
|
|
4009
4013
|
handleOpen() {
|
|
4010
|
-
|
|
4014
|
+
if (this.promotedForOpen) this.promotedForOpen = false;
|
|
4015
|
+
else sheetStack.promote(this.id);
|
|
4011
4016
|
try {
|
|
4012
4017
|
this.lifecycle.install();
|
|
4013
4018
|
} catch (err) {
|
|
@@ -4039,6 +4044,7 @@ var init_BottomSheetCore = __esm({
|
|
|
4039
4044
|
}
|
|
4040
4045
|
handleClose() {
|
|
4041
4046
|
this.opening = false;
|
|
4047
|
+
this.promotedForOpen = false;
|
|
4042
4048
|
this.lifecycle.release();
|
|
4043
4049
|
sheetStack.update();
|
|
4044
4050
|
}
|
|
@@ -4688,6 +4694,7 @@ var init_attributes = __esm({
|
|
|
4688
4694
|
ATTR_SCRIM_COLOR = "scrim-color";
|
|
4689
4695
|
ATTR_SNAP = "snap";
|
|
4690
4696
|
LIVE_ATTRS = /* @__PURE__ */ new Set([
|
|
4697
|
+
ATTR_MODE,
|
|
4691
4698
|
ATTR_RADIUS,
|
|
4692
4699
|
ATTR_MAX_HEIGHT,
|
|
4693
4700
|
ATTR_BACKDROP_COLOR,
|
|
@@ -4914,6 +4921,9 @@ var init_BottomSheetElement = __esm({
|
|
|
4914
4921
|
if (mode) this.engine.setDragFrom(mode);
|
|
4915
4922
|
break;
|
|
4916
4923
|
}
|
|
4924
|
+
case ATTR_MODE:
|
|
4925
|
+
this.engine.setMode(parseMode(value));
|
|
4926
|
+
break;
|
|
4917
4927
|
case ATTR_SNAP:
|
|
4918
4928
|
if (value && value !== this.engine.state.activeId) {
|
|
4919
4929
|
void this.engine.snapTo(value);
|
package/dist/features.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { f as EngineFeature } from './BottomSheetCore-
|
|
2
|
-
export { m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage } from './BottomSheetCore-
|
|
1
|
+
import { f as EngineFeature } from './BottomSheetCore-BHv6LPmS.cjs';
|
|
2
|
+
export { m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage } from './BottomSheetCore-BHv6LPmS.cjs';
|
|
3
3
|
import './transform-jVfAikE9.cjs';
|
|
4
4
|
|
|
5
5
|
declare function routeFeature(): EngineFeature;
|
package/dist/features.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { f as EngineFeature } from './BottomSheetCore-
|
|
2
|
-
export { m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage } from './BottomSheetCore-
|
|
1
|
+
import { f as EngineFeature } from './BottomSheetCore-CK_mq14p.js';
|
|
2
|
+
export { m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage } from './BottomSheetCore-CK_mq14p.js';
|
|
3
3
|
import './transform-jVfAikE9.js';
|
|
4
4
|
|
|
5
5
|
declare function routeFeature(): EngineFeature;
|
package/dist/index.cjs
CHANGED
|
@@ -774,7 +774,6 @@ var ScrimController = class {
|
|
|
774
774
|
__publicField(this, "backdrop");
|
|
775
775
|
__publicField(this, "mode");
|
|
776
776
|
__publicField(this, "isDestroyed");
|
|
777
|
-
__publicField(this, "isTopSheet");
|
|
778
777
|
__publicField(this, "getAllowedIds");
|
|
779
778
|
__publicField(this, "getResolvedSnaps");
|
|
780
779
|
__publicField(this, "snapToFn");
|
|
@@ -796,7 +795,6 @@ var ScrimController = class {
|
|
|
796
795
|
this.backdrop = deps.backdrop;
|
|
797
796
|
this.mode = deps.mode;
|
|
798
797
|
this.isDestroyed = deps.isDestroyed;
|
|
799
|
-
this.isTopSheet = deps.isTopSheet;
|
|
800
798
|
this.getAllowedIds = deps.getAllowedIds;
|
|
801
799
|
this.getResolvedSnaps = deps.getResolvedSnaps;
|
|
802
800
|
this.snapToFn = deps.snapTo;
|
|
@@ -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
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { B as BottomSheetEngine } from './BottomSheetEngine-
|
|
2
|
-
import { d as SnapPoint, b as SheetMode, c as EngineOptions, P as PhysicalSheetMode, g as ScrimOverlayPosition } from './BottomSheetCore-
|
|
3
|
-
export { h as AnchorAnimationPreset, i as AnchorAnimationSpec, j as AnchorHandle, A as AnchorOptions, k as AnchorPosition, l as AnchorState, B as BottomSheetCore, C as CloseReason, f as EngineFeature, m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage, E as EngineState, L as LogicalSheetMode, p as Plugin, q as SCRIM_PRESETS, r as ScrimOverlayOptions, s as ScrimPreset, t as ScrimPresetConfig, u as ScrimStageDef, e as ScrimStagesOptions, v as ScrimUpdate, S as SheetEventMap, w as SnapId, a as SnapPointDef, T as TeardownScope, x as runAnchorTransition } from './BottomSheetCore-
|
|
1
|
+
export { B as BottomSheetEngine } from './BottomSheetEngine-mmFzIK1Z.cjs';
|
|
2
|
+
import { d as SnapPoint, b as SheetMode, c as EngineOptions, P as PhysicalSheetMode, g as ScrimOverlayPosition } from './BottomSheetCore-BHv6LPmS.cjs';
|
|
3
|
+
export { h as AnchorAnimationPreset, i as AnchorAnimationSpec, j as AnchorHandle, A as AnchorOptions, k as AnchorPosition, l as AnchorState, B as BottomSheetCore, C as CloseReason, f as EngineFeature, m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage, E as EngineState, L as LogicalSheetMode, p as Plugin, q as SCRIM_PRESETS, r as ScrimOverlayOptions, s as ScrimPreset, t as ScrimPresetConfig, u as ScrimStageDef, e as ScrimStagesOptions, v as ScrimUpdate, S as SheetEventMap, w as SnapId, a as SnapPointDef, T as TeardownScope, x as runAnchorTransition } from './BottomSheetCore-BHv6LPmS.cjs';
|
|
4
4
|
export { autoCollapseFeature, contentSwipeFeature, defaultEngineFeatures, persistFeature, routeFeature, visualViewportFeature } from './features.cjs';
|
|
5
|
-
export { R as ResolvedSnap, r as resolveSnapList } from './index-
|
|
5
|
+
export { R as ResolvedSnap, r as resolveSnapList } from './index-juAyT76E.cjs';
|
|
6
6
|
import './transform-jVfAikE9.cjs';
|
|
7
7
|
|
|
8
8
|
declare const resolveSnap: (point: SnapPoint | string, mode: SheetMode, measureFit?: () => number) => number;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { B as BottomSheetEngine } from './BottomSheetEngine-
|
|
2
|
-
import { d as SnapPoint, b as SheetMode, c as EngineOptions, P as PhysicalSheetMode, g as ScrimOverlayPosition } from './BottomSheetCore-
|
|
3
|
-
export { h as AnchorAnimationPreset, i as AnchorAnimationSpec, j as AnchorHandle, A as AnchorOptions, k as AnchorPosition, l as AnchorState, B as BottomSheetCore, C as CloseReason, f as EngineFeature, m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage, E as EngineState, L as LogicalSheetMode, p as Plugin, q as SCRIM_PRESETS, r as ScrimOverlayOptions, s as ScrimPreset, t as ScrimPresetConfig, u as ScrimStageDef, e as ScrimStagesOptions, v as ScrimUpdate, S as SheetEventMap, w as SnapId, a as SnapPointDef, T as TeardownScope, x as runAnchorTransition } from './BottomSheetCore-
|
|
1
|
+
export { B as BottomSheetEngine } from './BottomSheetEngine-wLn6Q2kA.js';
|
|
2
|
+
import { d as SnapPoint, b as SheetMode, c as EngineOptions, P as PhysicalSheetMode, g as ScrimOverlayPosition } from './BottomSheetCore-CK_mq14p.js';
|
|
3
|
+
export { h as AnchorAnimationPreset, i as AnchorAnimationSpec, j as AnchorHandle, A as AnchorOptions, k as AnchorPosition, l as AnchorState, B as BottomSheetCore, C as CloseReason, f as EngineFeature, m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage, E as EngineState, L as LogicalSheetMode, p as Plugin, q as SCRIM_PRESETS, r as ScrimOverlayOptions, s as ScrimPreset, t as ScrimPresetConfig, u as ScrimStageDef, e as ScrimStagesOptions, v as ScrimUpdate, S as SheetEventMap, w as SnapId, a as SnapPointDef, T as TeardownScope, x as runAnchorTransition } from './BottomSheetCore-CK_mq14p.js';
|
|
4
4
|
export { autoCollapseFeature, contentSwipeFeature, defaultEngineFeatures, persistFeature, routeFeature, visualViewportFeature } from './features.js';
|
|
5
|
-
export { R as ResolvedSnap, r as resolveSnapList } from './index-
|
|
5
|
+
export { R as ResolvedSnap, r as resolveSnapList } from './index-CWKv1Xy4.js';
|
|
6
6
|
import './transform-jVfAikE9.js';
|
|
7
7
|
|
|
8
8
|
declare const resolveSnap: (point: SnapPoint | string, mode: SheetMode, measureFit?: () => number) => number;
|
package/dist/index.js
CHANGED
|
@@ -772,7 +772,6 @@ var ScrimController = class {
|
|
|
772
772
|
__publicField(this, "backdrop");
|
|
773
773
|
__publicField(this, "mode");
|
|
774
774
|
__publicField(this, "isDestroyed");
|
|
775
|
-
__publicField(this, "isTopSheet");
|
|
776
775
|
__publicField(this, "getAllowedIds");
|
|
777
776
|
__publicField(this, "getResolvedSnaps");
|
|
778
777
|
__publicField(this, "snapToFn");
|
|
@@ -794,7 +793,6 @@ var ScrimController = class {
|
|
|
794
793
|
this.backdrop = deps.backdrop;
|
|
795
794
|
this.mode = deps.mode;
|
|
796
795
|
this.isDestroyed = deps.isDestroyed;
|
|
797
|
-
this.isTopSheet = deps.isTopSheet;
|
|
798
796
|
this.getAllowedIds = deps.getAllowedIds;
|
|
799
797
|
this.getResolvedSnaps = deps.getResolvedSnaps;
|
|
800
798
|
this.snapToFn = deps.snapTo;
|
|
@@ -843,18 +841,16 @@ var ScrimController = class {
|
|
|
843
841
|
Math.max((progress - s) / range, 0),
|
|
844
842
|
1
|
|
845
843
|
);
|
|
846
|
-
if (this.
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
)
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
this.lastBackdropPointer = nextPointer;
|
|
857
|
-
}
|
|
844
|
+
if (this.backdropOpacitySentinel.shouldWrite(
|
|
845
|
+
backdropOpacity,
|
|
846
|
+
OPACITY_WRITE_EPSILON
|
|
847
|
+
)) {
|
|
848
|
+
this.backdrop.style.opacity = String(backdropOpacity);
|
|
849
|
+
}
|
|
850
|
+
const nextPointer = backdropOpacity > POINTER_EVENTS_OPACITY_THRESHOLD ? "auto" : "none";
|
|
851
|
+
if (nextPointer !== this.lastBackdropPointer) {
|
|
852
|
+
this.backdrop.style.pointerEvents = nextPointer;
|
|
853
|
+
this.lastBackdropPointer = nextPointer;
|
|
858
854
|
}
|
|
859
855
|
}
|
|
860
856
|
if (this.screenComponent && this.scrimMode !== "off") {
|
|
@@ -1384,18 +1380,20 @@ var AnimationRunner = class {
|
|
|
1384
1380
|
get isAnimating() {
|
|
1385
1381
|
return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
|
|
1386
1382
|
}
|
|
1383
|
+
cancelWaapi() {
|
|
1384
|
+
if (!this.currentWaapi) return;
|
|
1385
|
+
const entry = this.currentWaapi;
|
|
1386
|
+
this.currentWaapi = null;
|
|
1387
|
+
entry.stop();
|
|
1388
|
+
try {
|
|
1389
|
+
entry.anim.cancel();
|
|
1390
|
+
} catch {
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1387
1393
|
cancel() {
|
|
1388
1394
|
this.currentTween?.cancel();
|
|
1389
1395
|
this.currentSpring?.cancel();
|
|
1390
|
-
|
|
1391
|
-
const entry = this.currentWaapi;
|
|
1392
|
-
this.currentWaapi = null;
|
|
1393
|
-
entry.stop();
|
|
1394
|
-
try {
|
|
1395
|
-
entry.anim.cancel();
|
|
1396
|
-
} catch {
|
|
1397
|
-
}
|
|
1398
|
-
}
|
|
1396
|
+
this.cancelWaapi();
|
|
1399
1397
|
}
|
|
1400
1398
|
async animateTo(target, velocityPxPerMs) {
|
|
1401
1399
|
if (target === this.getSize()) {
|
|
@@ -1406,6 +1404,7 @@ var AnimationRunner = class {
|
|
|
1406
1404
|
}
|
|
1407
1405
|
this.currentTween?.cancel();
|
|
1408
1406
|
this.currentSpring?.cancel();
|
|
1407
|
+
this.cancelWaapi();
|
|
1409
1408
|
this.getRootEl()?.setAttribute("data-animating", "true");
|
|
1410
1409
|
this.element.style.willChange = "transform";
|
|
1411
1410
|
if (this.reducedMotion) {
|
|
@@ -2616,6 +2615,7 @@ var BottomSheetCore = class {
|
|
|
2616
2615
|
__publicField(this, "progressWriteSentinel", new WriteSentinel());
|
|
2617
2616
|
__publicField(this, "isTopSheet", true);
|
|
2618
2617
|
__publicField(this, "opening", false);
|
|
2618
|
+
__publicField(this, "promotedForOpen", false);
|
|
2619
2619
|
__publicField(this, "allowOvershoot", false);
|
|
2620
2620
|
__publicField(this, "progressPayload", {
|
|
2621
2621
|
value: 0,
|
|
@@ -2672,7 +2672,6 @@ var BottomSheetCore = class {
|
|
|
2672
2672
|
screenComponent: this.screenComponent,
|
|
2673
2673
|
backdrop: this.backdrop,
|
|
2674
2674
|
isDestroyed: () => this.destroyed,
|
|
2675
|
-
isTopSheet: () => this.isTopSheet,
|
|
2676
2675
|
getAllowedIds: () => this.snaps.getAllowedIds().slice(),
|
|
2677
2676
|
getResolvedSnaps: () => this.snaps.getResolvedSnaps().slice(),
|
|
2678
2677
|
snapTo: (id) => {
|
|
@@ -2942,13 +2941,14 @@ var BottomSheetCore = class {
|
|
|
2942
2941
|
if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
|
|
2943
2942
|
return;
|
|
2944
2943
|
}
|
|
2944
|
+
const resumingOpen = this.opening;
|
|
2945
2945
|
const signal = this.newCycle();
|
|
2946
2946
|
const onExternalAbort = () => {
|
|
2947
2947
|
this.animation.cancel();
|
|
2948
2948
|
this.newCycle();
|
|
2949
2949
|
};
|
|
2950
2950
|
externalSignal?.addEventListener("abort", onExternalAbort, { once: true });
|
|
2951
|
-
const wasClosed = this.size === 0;
|
|
2951
|
+
const wasClosed = this.size === 0 || resumingOpen;
|
|
2952
2952
|
const previousId = this.activeId;
|
|
2953
2953
|
const previousSize = this.size;
|
|
2954
2954
|
this.scrollCache.cache(previousId, previousSize, target.size);
|
|
@@ -2957,7 +2957,10 @@ var BottomSheetCore = class {
|
|
|
2957
2957
|
const opensToRest = id === "closed" || rawTargetSize === 0;
|
|
2958
2958
|
if (wasClosed && !opensToRest) {
|
|
2959
2959
|
this.opening = true;
|
|
2960
|
-
|
|
2960
|
+
if (!resumingOpen) {
|
|
2961
|
+
this.promotedForOpen = true;
|
|
2962
|
+
sheetStack.promote(this.id);
|
|
2963
|
+
}
|
|
2961
2964
|
}
|
|
2962
2965
|
if (this.animation.viewTransitionsAvailable) {
|
|
2963
2966
|
this.currentViewTransition?.skipTransition?.();
|
|
@@ -3648,6 +3651,7 @@ var BottomSheetCore = class {
|
|
|
3648
3651
|
this.activeId = target.id;
|
|
3649
3652
|
if (previousSnapSize === 0 && target.size > 0) {
|
|
3650
3653
|
this.opening = true;
|
|
3654
|
+
this.promotedForOpen = true;
|
|
3651
3655
|
sheetStack.promote(this.id);
|
|
3652
3656
|
}
|
|
3653
3657
|
const settleCap = this.snaps.getMaxAxisSize();
|
|
@@ -3729,7 +3733,8 @@ var BottomSheetCore = class {
|
|
|
3729
3733
|
return Math.min(Math.max((size - min) / (reachableMax - min), 0), 1);
|
|
3730
3734
|
}
|
|
3731
3735
|
handleOpen() {
|
|
3732
|
-
|
|
3736
|
+
if (this.promotedForOpen) this.promotedForOpen = false;
|
|
3737
|
+
else sheetStack.promote(this.id);
|
|
3733
3738
|
try {
|
|
3734
3739
|
this.lifecycle.install();
|
|
3735
3740
|
} catch (err) {
|
|
@@ -3761,6 +3766,7 @@ var BottomSheetCore = class {
|
|
|
3761
3766
|
}
|
|
3762
3767
|
handleClose() {
|
|
3763
3768
|
this.opening = false;
|
|
3769
|
+
this.promotedForOpen = false;
|
|
3764
3770
|
this.lifecycle.release();
|
|
3765
3771
|
sheetStack.update();
|
|
3766
3772
|
}
|
package/dist/preact.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { BottomSheet, BottomSheetFromConfig, BottomSheetFromConfigProps, BottomSheetHandle, BottomSheetProps, HeaderProp, Overlay, OverlayHandle, OverlayProps, SheetConfig, UseBottomSheetRefs, UseBottomSheetReturn, UseOverlayReturn, useBottomSheet, useOverlay } from './react.cjs';
|
|
2
|
-
export { E as EngineState, b as SheetMode, d as SnapPoint, a as SnapPointDef } from './BottomSheetCore-
|
|
2
|
+
export { E as EngineState, b as SheetMode, d as SnapPoint, a as SnapPointDef } from './BottomSheetCore-BHv6LPmS.cjs';
|
|
3
3
|
export { OverlayEdge, OverlayOptions, OverlayState } from './overlay.cjs';
|
|
4
4
|
import 'react';
|
|
5
|
-
import './BottomSheetEngine-
|
|
5
|
+
import './BottomSheetEngine-mmFzIK1Z.cjs';
|
|
6
6
|
import './teleport-7uYNiEAT.cjs';
|
|
7
7
|
import './transform-jVfAikE9.cjs';
|
package/dist/preact.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { BottomSheet, BottomSheetFromConfig, BottomSheetFromConfigProps, BottomSheetHandle, BottomSheetProps, HeaderProp, Overlay, OverlayHandle, OverlayProps, SheetConfig, UseBottomSheetRefs, UseBottomSheetReturn, UseOverlayReturn, useBottomSheet, useOverlay } from './react.js';
|
|
2
|
-
export { E as EngineState, b as SheetMode, d as SnapPoint, a as SnapPointDef } from './BottomSheetCore-
|
|
2
|
+
export { E as EngineState, b as SheetMode, d as SnapPoint, a as SnapPointDef } from './BottomSheetCore-CK_mq14p.js';
|
|
3
3
|
export { OverlayEdge, OverlayOptions, OverlayState } from './overlay.js';
|
|
4
4
|
import 'react';
|
|
5
|
-
import './BottomSheetEngine-
|
|
5
|
+
import './BottomSheetEngine-wLn6Q2kA.js';
|
|
6
6
|
import './teleport-7uYNiEAT.js';
|
|
7
7
|
import './transform-jVfAikE9.js';
|