@surdeddd/bottom-sheet 0.20.1 → 0.21.0
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 +1 -1
- package/dist/{BottomSheetCore-Cgn8b_6A.d.ts → BottomSheetCore-CIijwtdi.d.ts} +1 -0
- package/dist/{BottomSheetCore-VPJZcKcg.d.cts → BottomSheetCore-CK8Rh1He.d.cts} +1 -0
- package/dist/{BottomSheetEngine-DwYR_ygJ.d.ts → BottomSheetEngine-CZglPsTF.d.ts} +1 -1
- package/dist/{BottomSheetEngine-B8C2CwF9.d.cts → BottomSheetEngine-hLSAxzla.d.cts} +1 -1
- package/dist/core.cjs +22 -14
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +22 -14
- package/dist/debug.d.cts +1 -1
- package/dist/debug.d.ts +1 -1
- package/dist/element.cjs +26 -14
- 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 +26 -14
- package/dist/features.d.cts +2 -2
- package/dist/features.d.ts +2 -2
- package/dist/{index-CnfbOKx0.d.cts → index-BEX-NHRJ.d.cts} +1 -1
- package/dist/{index-DcMkhXAy.d.ts → index-BqLHKOeM.d.ts} +1 -1
- package/dist/index.cjs +22 -14
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +22 -14
- 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 +28 -11
- package/dist/qwik-lib/index.qwik.mjs +28 -11
- package/dist/qwik.cjs +28 -14
- package/dist/qwik.d.cts +2 -2
- package/dist/qwik.d.ts +2 -2
- package/dist/qwik.js +28 -14
- package/dist/react.cjs +27 -14
- package/dist/react.d.cts +3 -3
- package/dist/react.d.ts +3 -3
- package/dist/react.js +27 -14
- package/dist/solid.cjs +28 -14
- package/dist/solid.d.cts +1 -0
- package/dist/solid.d.ts +1 -0
- package/dist/solid.js +28 -14
- package/dist/solid.source.jsx +32 -14
- package/dist/styles.d.ts +1 -0
- package/dist/svelte-core.cjs +22 -14
- package/dist/svelte-core.js +22 -14
- package/dist/svelte-src/BottomSheet.svelte +3 -0
- package/dist/svelte.cjs +25 -14
- package/dist/svelte.js +25 -14
- package/dist/themes/ios.d.ts +1 -0
- package/dist/themes/material.d.ts +1 -0
- package/dist/themes/vercel.d.ts +1 -0
- package/dist/vue.cjs +27 -15
- package/dist/vue.d.cts +6 -1
- package/dist/vue.d.ts +6 -1
- package/dist/vue.js +27 -15
- package/dist/webgl.d.cts +1 -1
- package/dist/webgl.d.ts +1 -1
- package/package.json +36 -12
package/dist/qwik.js
CHANGED
|
@@ -839,13 +839,11 @@ var ScrimController = class {
|
|
|
839
839
|
if (!progressChanged && this.backdropOpacitySentinel.value !== -1 && this.screenOpacitySentinel.value !== -1) {
|
|
840
840
|
return;
|
|
841
841
|
}
|
|
842
|
-
if (this.backdrop
|
|
842
|
+
if (this.backdrop) {
|
|
843
843
|
const [s, e] = this.backdropRange;
|
|
844
844
|
const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
|
|
845
|
-
const
|
|
846
|
-
|
|
847
|
-
1
|
|
848
|
-
);
|
|
845
|
+
const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
|
|
846
|
+
const backdropOpacity = this.isTopSheet() ? ramp : 0;
|
|
849
847
|
if (this.backdropOpacitySentinel.shouldWrite(
|
|
850
848
|
backdropOpacity,
|
|
851
849
|
OPACITY_WRITE_EPSILON
|
|
@@ -1385,18 +1383,20 @@ var AnimationRunner = class {
|
|
|
1385
1383
|
get isAnimating() {
|
|
1386
1384
|
return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
|
|
1387
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
|
+
}
|
|
1388
1396
|
cancel() {
|
|
1389
1397
|
this.currentTween?.cancel();
|
|
1390
1398
|
this.currentSpring?.cancel();
|
|
1391
|
-
|
|
1392
|
-
const entry = this.currentWaapi;
|
|
1393
|
-
this.currentWaapi = null;
|
|
1394
|
-
entry.stop();
|
|
1395
|
-
try {
|
|
1396
|
-
entry.anim.cancel();
|
|
1397
|
-
} catch {
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1399
|
+
this.cancelWaapi();
|
|
1400
1400
|
}
|
|
1401
1401
|
async animateTo(target, velocityPxPerMs) {
|
|
1402
1402
|
if (target === this.getSize()) {
|
|
@@ -1407,6 +1407,7 @@ var AnimationRunner = class {
|
|
|
1407
1407
|
}
|
|
1408
1408
|
this.currentTween?.cancel();
|
|
1409
1409
|
this.currentSpring?.cancel();
|
|
1410
|
+
this.cancelWaapi();
|
|
1410
1411
|
this.getRootEl()?.setAttribute("data-animating", "true");
|
|
1411
1412
|
this.element.style.willChange = "transform";
|
|
1412
1413
|
if (this.reducedMotion) {
|
|
@@ -3399,12 +3400,19 @@ var BottomSheetCore = class {
|
|
|
3399
3400
|
for (const anchor of this.anchors) anchor.syncZ(z + 1);
|
|
3400
3401
|
},
|
|
3401
3402
|
setIsTop: (isTop) => {
|
|
3403
|
+
if (this.isTopSheet === isTop) return;
|
|
3402
3404
|
this.isTopSheet = isTop;
|
|
3405
|
+
this.repaintScrim();
|
|
3403
3406
|
},
|
|
3404
3407
|
isOpen: () => this.size > 0 || this.opening,
|
|
3405
3408
|
setDepth: (depth) => this.applyStackDepth(depth)
|
|
3406
3409
|
}));
|
|
3407
3410
|
}
|
|
3411
|
+
repaintScrim() {
|
|
3412
|
+
if (this.destroyed) return;
|
|
3413
|
+
this.scrim.invalidateOpacityCache();
|
|
3414
|
+
this.scrim.applyOpacity(this.computeProgress(this.size), true);
|
|
3415
|
+
}
|
|
3408
3416
|
applyStackDepth(depth) {
|
|
3409
3417
|
if (!this.stackEffectEnabled) return;
|
|
3410
3418
|
this.element.setAttribute("data-stack-depth", String(depth));
|
|
@@ -4432,6 +4440,12 @@ var BottomSheet = component$((props) => {
|
|
|
4432
4440
|
}
|
|
4433
4441
|
if (dragFrom !== void 0) engine.setDragFrom(dragFrom);
|
|
4434
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
|
+
});
|
|
4435
4449
|
const showBackdrop = props.backdrop !== false;
|
|
4436
4450
|
const mode = props.mode ?? "bottom";
|
|
4437
4451
|
const ariaLabel = props.ariaLabel ?? "Bottom sheet";
|
package/dist/react.cjs
CHANGED
|
@@ -848,13 +848,11 @@ var ScrimController = class {
|
|
|
848
848
|
if (!progressChanged && this.backdropOpacitySentinel.value !== -1 && this.screenOpacitySentinel.value !== -1) {
|
|
849
849
|
return;
|
|
850
850
|
}
|
|
851
|
-
if (this.backdrop
|
|
851
|
+
if (this.backdrop) {
|
|
852
852
|
const [s, e] = this.backdropRange;
|
|
853
853
|
const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
|
|
854
|
-
const
|
|
855
|
-
|
|
856
|
-
1
|
|
857
|
-
);
|
|
854
|
+
const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
|
|
855
|
+
const backdropOpacity = this.isTopSheet() ? ramp : 0;
|
|
858
856
|
if (this.backdropOpacitySentinel.shouldWrite(
|
|
859
857
|
backdropOpacity,
|
|
860
858
|
OPACITY_WRITE_EPSILON
|
|
@@ -1394,18 +1392,20 @@ var AnimationRunner = class {
|
|
|
1394
1392
|
get isAnimating() {
|
|
1395
1393
|
return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
|
|
1396
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
|
+
}
|
|
1397
1405
|
cancel() {
|
|
1398
1406
|
this.currentTween?.cancel();
|
|
1399
1407
|
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
|
-
}
|
|
1408
|
+
this.cancelWaapi();
|
|
1409
1409
|
}
|
|
1410
1410
|
async animateTo(target, velocityPxPerMs) {
|
|
1411
1411
|
if (target === this.getSize()) {
|
|
@@ -1416,6 +1416,7 @@ var AnimationRunner = class {
|
|
|
1416
1416
|
}
|
|
1417
1417
|
this.currentTween?.cancel();
|
|
1418
1418
|
this.currentSpring?.cancel();
|
|
1419
|
+
this.cancelWaapi();
|
|
1419
1420
|
this.getRootEl()?.setAttribute("data-animating", "true");
|
|
1420
1421
|
this.element.style.willChange = "transform";
|
|
1421
1422
|
if (this.reducedMotion) {
|
|
@@ -3408,12 +3409,19 @@ var BottomSheetCore = class {
|
|
|
3408
3409
|
for (const anchor of this.anchors) anchor.syncZ(z + 1);
|
|
3409
3410
|
},
|
|
3410
3411
|
setIsTop: (isTop) => {
|
|
3412
|
+
if (this.isTopSheet === isTop) return;
|
|
3411
3413
|
this.isTopSheet = isTop;
|
|
3414
|
+
this.repaintScrim();
|
|
3412
3415
|
},
|
|
3413
3416
|
isOpen: () => this.size > 0 || this.opening,
|
|
3414
3417
|
setDepth: (depth) => this.applyStackDepth(depth)
|
|
3415
3418
|
}));
|
|
3416
3419
|
}
|
|
3420
|
+
repaintScrim() {
|
|
3421
|
+
if (this.destroyed) return;
|
|
3422
|
+
this.scrim.invalidateOpacityCache();
|
|
3423
|
+
this.scrim.applyOpacity(this.computeProgress(this.size), true);
|
|
3424
|
+
}
|
|
3417
3425
|
applyStackDepth(depth) {
|
|
3418
3426
|
if (!this.stackEffectEnabled) return;
|
|
3419
3427
|
this.element.setAttribute("data-stack-depth", String(depth));
|
|
@@ -4665,6 +4673,11 @@ var BottomSheet = react.forwardRef(
|
|
|
4665
4673
|
react.useEffect(() => {
|
|
4666
4674
|
onChange?.(state);
|
|
4667
4675
|
}, [state, onChange]);
|
|
4676
|
+
const mode = engineOpts.mode;
|
|
4677
|
+
react.useEffect(() => {
|
|
4678
|
+
if (mode === void 0) return;
|
|
4679
|
+
getEngine()?.setMode(mode);
|
|
4680
|
+
}, [getEngine, mode]);
|
|
4668
4681
|
const [anchorHosts, setAnchorHosts] = react.useState([]);
|
|
4669
4682
|
const anchorsKey = anchors ? JSON.stringify(
|
|
4670
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-CK8Rh1He.cjs';
|
|
2
|
+
export { d as SnapPoint } from './BottomSheetCore-CK8Rh1He.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-hLSAxzla.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-CIijwtdi.js';
|
|
2
|
+
export { d as SnapPoint } from './BottomSheetCore-CIijwtdi.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-CZglPsTF.js';
|
|
8
8
|
import { T as TeleportTarget } from './teleport-7uYNiEAT.js';
|
|
9
9
|
import './transform-jVfAikE9.js';
|
|
10
10
|
|
package/dist/react.js
CHANGED
|
@@ -846,13 +846,11 @@ var ScrimController = class {
|
|
|
846
846
|
if (!progressChanged && this.backdropOpacitySentinel.value !== -1 && this.screenOpacitySentinel.value !== -1) {
|
|
847
847
|
return;
|
|
848
848
|
}
|
|
849
|
-
if (this.backdrop
|
|
849
|
+
if (this.backdrop) {
|
|
850
850
|
const [s, e] = this.backdropRange;
|
|
851
851
|
const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
|
|
852
|
-
const
|
|
853
|
-
|
|
854
|
-
1
|
|
855
|
-
);
|
|
852
|
+
const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
|
|
853
|
+
const backdropOpacity = this.isTopSheet() ? ramp : 0;
|
|
856
854
|
if (this.backdropOpacitySentinel.shouldWrite(
|
|
857
855
|
backdropOpacity,
|
|
858
856
|
OPACITY_WRITE_EPSILON
|
|
@@ -1392,18 +1390,20 @@ var AnimationRunner = class {
|
|
|
1392
1390
|
get isAnimating() {
|
|
1393
1391
|
return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
|
|
1394
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
|
+
}
|
|
1395
1403
|
cancel() {
|
|
1396
1404
|
this.currentTween?.cancel();
|
|
1397
1405
|
this.currentSpring?.cancel();
|
|
1398
|
-
|
|
1399
|
-
const entry = this.currentWaapi;
|
|
1400
|
-
this.currentWaapi = null;
|
|
1401
|
-
entry.stop();
|
|
1402
|
-
try {
|
|
1403
|
-
entry.anim.cancel();
|
|
1404
|
-
} catch {
|
|
1405
|
-
}
|
|
1406
|
-
}
|
|
1406
|
+
this.cancelWaapi();
|
|
1407
1407
|
}
|
|
1408
1408
|
async animateTo(target, velocityPxPerMs) {
|
|
1409
1409
|
if (target === this.getSize()) {
|
|
@@ -1414,6 +1414,7 @@ var AnimationRunner = class {
|
|
|
1414
1414
|
}
|
|
1415
1415
|
this.currentTween?.cancel();
|
|
1416
1416
|
this.currentSpring?.cancel();
|
|
1417
|
+
this.cancelWaapi();
|
|
1417
1418
|
this.getRootEl()?.setAttribute("data-animating", "true");
|
|
1418
1419
|
this.element.style.willChange = "transform";
|
|
1419
1420
|
if (this.reducedMotion) {
|
|
@@ -3406,12 +3407,19 @@ var BottomSheetCore = class {
|
|
|
3406
3407
|
for (const anchor of this.anchors) anchor.syncZ(z + 1);
|
|
3407
3408
|
},
|
|
3408
3409
|
setIsTop: (isTop) => {
|
|
3410
|
+
if (this.isTopSheet === isTop) return;
|
|
3409
3411
|
this.isTopSheet = isTop;
|
|
3412
|
+
this.repaintScrim();
|
|
3410
3413
|
},
|
|
3411
3414
|
isOpen: () => this.size > 0 || this.opening,
|
|
3412
3415
|
setDepth: (depth) => this.applyStackDepth(depth)
|
|
3413
3416
|
}));
|
|
3414
3417
|
}
|
|
3418
|
+
repaintScrim() {
|
|
3419
|
+
if (this.destroyed) return;
|
|
3420
|
+
this.scrim.invalidateOpacityCache();
|
|
3421
|
+
this.scrim.applyOpacity(this.computeProgress(this.size), true);
|
|
3422
|
+
}
|
|
3415
3423
|
applyStackDepth(depth) {
|
|
3416
3424
|
if (!this.stackEffectEnabled) return;
|
|
3417
3425
|
this.element.setAttribute("data-stack-depth", String(depth));
|
|
@@ -4663,6 +4671,11 @@ var BottomSheet = forwardRef(
|
|
|
4663
4671
|
useEffect(() => {
|
|
4664
4672
|
onChange?.(state);
|
|
4665
4673
|
}, [state, onChange]);
|
|
4674
|
+
const mode = engineOpts.mode;
|
|
4675
|
+
useEffect(() => {
|
|
4676
|
+
if (mode === void 0) return;
|
|
4677
|
+
getEngine()?.setMode(mode);
|
|
4678
|
+
}, [getEngine, mode]);
|
|
4666
4679
|
const [anchorHosts, setAnchorHosts] = useState([]);
|
|
4667
4680
|
const anchorsKey = anchors ? JSON.stringify(
|
|
4668
4681
|
anchors.map((a) => [
|
package/dist/solid.cjs
CHANGED
|
@@ -841,13 +841,11 @@ var ScrimController = class {
|
|
|
841
841
|
if (!progressChanged && this.backdropOpacitySentinel.value !== -1 && this.screenOpacitySentinel.value !== -1) {
|
|
842
842
|
return;
|
|
843
843
|
}
|
|
844
|
-
if (this.backdrop
|
|
844
|
+
if (this.backdrop) {
|
|
845
845
|
const [s, e] = this.backdropRange;
|
|
846
846
|
const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
|
|
847
|
-
const
|
|
848
|
-
|
|
849
|
-
1
|
|
850
|
-
);
|
|
847
|
+
const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
|
|
848
|
+
const backdropOpacity = this.isTopSheet() ? ramp : 0;
|
|
851
849
|
if (this.backdropOpacitySentinel.shouldWrite(
|
|
852
850
|
backdropOpacity,
|
|
853
851
|
OPACITY_WRITE_EPSILON
|
|
@@ -1387,18 +1385,20 @@ var AnimationRunner = class {
|
|
|
1387
1385
|
get isAnimating() {
|
|
1388
1386
|
return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
|
|
1389
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
|
+
}
|
|
1390
1398
|
cancel() {
|
|
1391
1399
|
this.currentTween?.cancel();
|
|
1392
1400
|
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
|
-
}
|
|
1401
|
+
this.cancelWaapi();
|
|
1402
1402
|
}
|
|
1403
1403
|
async animateTo(target, velocityPxPerMs) {
|
|
1404
1404
|
if (target === this.getSize()) {
|
|
@@ -1409,6 +1409,7 @@ var AnimationRunner = class {
|
|
|
1409
1409
|
}
|
|
1410
1410
|
this.currentTween?.cancel();
|
|
1411
1411
|
this.currentSpring?.cancel();
|
|
1412
|
+
this.cancelWaapi();
|
|
1412
1413
|
this.getRootEl()?.setAttribute("data-animating", "true");
|
|
1413
1414
|
this.element.style.willChange = "transform";
|
|
1414
1415
|
if (this.reducedMotion) {
|
|
@@ -3401,12 +3402,19 @@ var BottomSheetCore = class {
|
|
|
3401
3402
|
for (const anchor of this.anchors) anchor.syncZ(z + 1);
|
|
3402
3403
|
},
|
|
3403
3404
|
setIsTop: (isTop) => {
|
|
3405
|
+
if (this.isTopSheet === isTop) return;
|
|
3404
3406
|
this.isTopSheet = isTop;
|
|
3407
|
+
this.repaintScrim();
|
|
3405
3408
|
},
|
|
3406
3409
|
isOpen: () => this.size > 0 || this.opening,
|
|
3407
3410
|
setDepth: (depth) => this.applyStackDepth(depth)
|
|
3408
3411
|
}));
|
|
3409
3412
|
}
|
|
3413
|
+
repaintScrim() {
|
|
3414
|
+
if (this.destroyed) return;
|
|
3415
|
+
this.scrim.invalidateOpacityCache();
|
|
3416
|
+
this.scrim.applyOpacity(this.computeProgress(this.size), true);
|
|
3417
|
+
}
|
|
3410
3418
|
applyStackDepth(depth) {
|
|
3411
3419
|
if (!this.stackEffectEnabled) return;
|
|
3412
3420
|
this.element.setAttribute("data-stack-depth", String(depth));
|
|
@@ -4415,6 +4423,12 @@ var BottomSheet = (props) => {
|
|
|
4415
4423
|
}, {
|
|
4416
4424
|
defer: true
|
|
4417
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
|
+
}));
|
|
4418
4432
|
const showBackdrop = solidJs.createMemo(() => props.backdrop !== false);
|
|
4419
4433
|
const mode = solidJs.createMemo(() => props.mode ?? "bottom");
|
|
4420
4434
|
const ariaLabel = solidJs.createMemo(() => props.ariaLabel ?? "Bottom sheet");
|
package/dist/solid.d.cts
CHANGED
package/dist/solid.d.ts
CHANGED
package/dist/solid.js
CHANGED
|
@@ -839,13 +839,11 @@ var ScrimController = class {
|
|
|
839
839
|
if (!progressChanged && this.backdropOpacitySentinel.value !== -1 && this.screenOpacitySentinel.value !== -1) {
|
|
840
840
|
return;
|
|
841
841
|
}
|
|
842
|
-
if (this.backdrop
|
|
842
|
+
if (this.backdrop) {
|
|
843
843
|
const [s, e] = this.backdropRange;
|
|
844
844
|
const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
|
|
845
|
-
const
|
|
846
|
-
|
|
847
|
-
1
|
|
848
|
-
);
|
|
845
|
+
const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
|
|
846
|
+
const backdropOpacity = this.isTopSheet() ? ramp : 0;
|
|
849
847
|
if (this.backdropOpacitySentinel.shouldWrite(
|
|
850
848
|
backdropOpacity,
|
|
851
849
|
OPACITY_WRITE_EPSILON
|
|
@@ -1385,18 +1383,20 @@ var AnimationRunner = class {
|
|
|
1385
1383
|
get isAnimating() {
|
|
1386
1384
|
return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
|
|
1387
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
|
+
}
|
|
1388
1396
|
cancel() {
|
|
1389
1397
|
this.currentTween?.cancel();
|
|
1390
1398
|
this.currentSpring?.cancel();
|
|
1391
|
-
|
|
1392
|
-
const entry = this.currentWaapi;
|
|
1393
|
-
this.currentWaapi = null;
|
|
1394
|
-
entry.stop();
|
|
1395
|
-
try {
|
|
1396
|
-
entry.anim.cancel();
|
|
1397
|
-
} catch {
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1399
|
+
this.cancelWaapi();
|
|
1400
1400
|
}
|
|
1401
1401
|
async animateTo(target, velocityPxPerMs) {
|
|
1402
1402
|
if (target === this.getSize()) {
|
|
@@ -1407,6 +1407,7 @@ var AnimationRunner = class {
|
|
|
1407
1407
|
}
|
|
1408
1408
|
this.currentTween?.cancel();
|
|
1409
1409
|
this.currentSpring?.cancel();
|
|
1410
|
+
this.cancelWaapi();
|
|
1410
1411
|
this.getRootEl()?.setAttribute("data-animating", "true");
|
|
1411
1412
|
this.element.style.willChange = "transform";
|
|
1412
1413
|
if (this.reducedMotion) {
|
|
@@ -3399,12 +3400,19 @@ var BottomSheetCore = class {
|
|
|
3399
3400
|
for (const anchor of this.anchors) anchor.syncZ(z + 1);
|
|
3400
3401
|
},
|
|
3401
3402
|
setIsTop: (isTop) => {
|
|
3403
|
+
if (this.isTopSheet === isTop) return;
|
|
3402
3404
|
this.isTopSheet = isTop;
|
|
3405
|
+
this.repaintScrim();
|
|
3403
3406
|
},
|
|
3404
3407
|
isOpen: () => this.size > 0 || this.opening,
|
|
3405
3408
|
setDepth: (depth) => this.applyStackDepth(depth)
|
|
3406
3409
|
}));
|
|
3407
3410
|
}
|
|
3411
|
+
repaintScrim() {
|
|
3412
|
+
if (this.destroyed) return;
|
|
3413
|
+
this.scrim.invalidateOpacityCache();
|
|
3414
|
+
this.scrim.applyOpacity(this.computeProgress(this.size), true);
|
|
3415
|
+
}
|
|
3408
3416
|
applyStackDepth(depth) {
|
|
3409
3417
|
if (!this.stackEffectEnabled) return;
|
|
3410
3418
|
this.element.setAttribute("data-stack-depth", String(depth));
|
|
@@ -4413,6 +4421,12 @@ var BottomSheet = (props) => {
|
|
|
4413
4421
|
}, {
|
|
4414
4422
|
defer: true
|
|
4415
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
|
+
}));
|
|
4416
4430
|
const showBackdrop = createMemo(() => props.backdrop !== false);
|
|
4417
4431
|
const mode = createMemo(() => props.mode ?? "bottom");
|
|
4418
4432
|
const ariaLabel = createMemo(() => props.ariaLabel ?? "Bottom sheet");
|
package/dist/solid.source.jsx
CHANGED
|
@@ -842,13 +842,11 @@ var ScrimController = class {
|
|
|
842
842
|
if (!progressChanged && this.backdropOpacitySentinel.value !== -1 && this.screenOpacitySentinel.value !== -1) {
|
|
843
843
|
return;
|
|
844
844
|
}
|
|
845
|
-
if (this.backdrop
|
|
845
|
+
if (this.backdrop) {
|
|
846
846
|
const [s, e] = this.backdropRange;
|
|
847
847
|
const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
|
|
848
|
-
const
|
|
849
|
-
|
|
850
|
-
1
|
|
851
|
-
);
|
|
848
|
+
const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
|
|
849
|
+
const backdropOpacity = this.isTopSheet() ? ramp : 0;
|
|
852
850
|
if (this.backdropOpacitySentinel.shouldWrite(
|
|
853
851
|
backdropOpacity,
|
|
854
852
|
OPACITY_WRITE_EPSILON
|
|
@@ -1388,18 +1386,20 @@ var AnimationRunner = class {
|
|
|
1388
1386
|
get isAnimating() {
|
|
1389
1387
|
return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
|
|
1390
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
|
+
}
|
|
1391
1399
|
cancel() {
|
|
1392
1400
|
this.currentTween?.cancel();
|
|
1393
1401
|
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
|
-
}
|
|
1402
|
+
this.cancelWaapi();
|
|
1403
1403
|
}
|
|
1404
1404
|
async animateTo(target, velocityPxPerMs) {
|
|
1405
1405
|
if (target === this.getSize()) {
|
|
@@ -1410,6 +1410,7 @@ var AnimationRunner = class {
|
|
|
1410
1410
|
}
|
|
1411
1411
|
this.currentTween?.cancel();
|
|
1412
1412
|
this.currentSpring?.cancel();
|
|
1413
|
+
this.cancelWaapi();
|
|
1413
1414
|
this.getRootEl()?.setAttribute("data-animating", "true");
|
|
1414
1415
|
this.element.style.willChange = "transform";
|
|
1415
1416
|
if (this.reducedMotion) {
|
|
@@ -3401,12 +3402,19 @@ var BottomSheetCore = class {
|
|
|
3401
3402
|
for (const anchor of this.anchors) anchor.syncZ(z + 1);
|
|
3402
3403
|
},
|
|
3403
3404
|
setIsTop: (isTop) => {
|
|
3405
|
+
if (this.isTopSheet === isTop) return;
|
|
3404
3406
|
this.isTopSheet = isTop;
|
|
3407
|
+
this.repaintScrim();
|
|
3405
3408
|
},
|
|
3406
3409
|
isOpen: () => this.size > 0 || this.opening,
|
|
3407
3410
|
setDepth: (depth) => this.applyStackDepth(depth)
|
|
3408
3411
|
}));
|
|
3409
3412
|
}
|
|
3413
|
+
repaintScrim() {
|
|
3414
|
+
if (this.destroyed) return;
|
|
3415
|
+
this.scrim.invalidateOpacityCache();
|
|
3416
|
+
this.scrim.applyOpacity(this.computeProgress(this.size), true);
|
|
3417
|
+
}
|
|
3410
3418
|
applyStackDepth(depth) {
|
|
3411
3419
|
if (!this.stackEffectEnabled) return;
|
|
3412
3420
|
this.element.setAttribute("data-stack-depth", String(depth));
|
|
@@ -4441,6 +4449,16 @@ var BottomSheet = (props) => {
|
|
|
4441
4449
|
{ defer: true }
|
|
4442
4450
|
)
|
|
4443
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
|
+
);
|
|
4444
4462
|
const showBackdrop = createMemo(() => props.backdrop !== false);
|
|
4445
4463
|
const mode = createMemo(() => props.mode ?? "bottom");
|
|
4446
4464
|
const ariaLabel = createMemo(() => props.ariaLabel ?? "Bottom sheet");
|
package/dist/styles.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/svelte-core.cjs
CHANGED
|
@@ -840,13 +840,11 @@ var ScrimController = class {
|
|
|
840
840
|
if (!progressChanged && this.backdropOpacitySentinel.value !== -1 && this.screenOpacitySentinel.value !== -1) {
|
|
841
841
|
return;
|
|
842
842
|
}
|
|
843
|
-
if (this.backdrop
|
|
843
|
+
if (this.backdrop) {
|
|
844
844
|
const [s, e] = this.backdropRange;
|
|
845
845
|
const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
|
|
846
|
-
const
|
|
847
|
-
|
|
848
|
-
1
|
|
849
|
-
);
|
|
846
|
+
const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
|
|
847
|
+
const backdropOpacity = this.isTopSheet() ? ramp : 0;
|
|
850
848
|
if (this.backdropOpacitySentinel.shouldWrite(
|
|
851
849
|
backdropOpacity,
|
|
852
850
|
OPACITY_WRITE_EPSILON
|
|
@@ -1386,18 +1384,20 @@ var AnimationRunner = class {
|
|
|
1386
1384
|
get isAnimating() {
|
|
1387
1385
|
return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
|
|
1388
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
|
+
}
|
|
1389
1397
|
cancel() {
|
|
1390
1398
|
this.currentTween?.cancel();
|
|
1391
1399
|
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
|
-
}
|
|
1400
|
+
this.cancelWaapi();
|
|
1401
1401
|
}
|
|
1402
1402
|
async animateTo(target, velocityPxPerMs) {
|
|
1403
1403
|
if (target === this.getSize()) {
|
|
@@ -1408,6 +1408,7 @@ var AnimationRunner = class {
|
|
|
1408
1408
|
}
|
|
1409
1409
|
this.currentTween?.cancel();
|
|
1410
1410
|
this.currentSpring?.cancel();
|
|
1411
|
+
this.cancelWaapi();
|
|
1411
1412
|
this.getRootEl()?.setAttribute("data-animating", "true");
|
|
1412
1413
|
this.element.style.willChange = "transform";
|
|
1413
1414
|
if (this.reducedMotion) {
|
|
@@ -3400,12 +3401,19 @@ var BottomSheetCore = class {
|
|
|
3400
3401
|
for (const anchor of this.anchors) anchor.syncZ(z + 1);
|
|
3401
3402
|
},
|
|
3402
3403
|
setIsTop: (isTop) => {
|
|
3404
|
+
if (this.isTopSheet === isTop) return;
|
|
3403
3405
|
this.isTopSheet = isTop;
|
|
3406
|
+
this.repaintScrim();
|
|
3404
3407
|
},
|
|
3405
3408
|
isOpen: () => this.size > 0 || this.opening,
|
|
3406
3409
|
setDepth: (depth) => this.applyStackDepth(depth)
|
|
3407
3410
|
}));
|
|
3408
3411
|
}
|
|
3412
|
+
repaintScrim() {
|
|
3413
|
+
if (this.destroyed) return;
|
|
3414
|
+
this.scrim.invalidateOpacityCache();
|
|
3415
|
+
this.scrim.applyOpacity(this.computeProgress(this.size), true);
|
|
3416
|
+
}
|
|
3409
3417
|
applyStackDepth(depth) {
|
|
3410
3418
|
if (!this.stackEffectEnabled) return;
|
|
3411
3419
|
this.element.setAttribute("data-stack-depth", String(depth));
|