@surdeddd/bottom-sheet 0.20.2 → 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 +31 -25
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +31 -25
- package/dist/debug.d.cts +1 -1
- package/dist/debug.d.ts +1 -1
- package/dist/element.cjs +35 -25
- 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 +35 -25
- 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 +31 -25
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +31 -25
- 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 +34 -19
- package/dist/qwik-lib/index.qwik.mjs +34 -19
- package/dist/qwik.cjs +37 -25
- package/dist/qwik.d.cts +2 -2
- package/dist/qwik.d.ts +2 -2
- package/dist/qwik.js +37 -25
- package/dist/react.cjs +36 -25
- package/dist/react.d.cts +3 -3
- package/dist/react.d.ts +3 -3
- package/dist/react.js +36 -25
- package/dist/solid.cjs +37 -25
- package/dist/solid.d.cts +1 -0
- package/dist/solid.d.ts +1 -0
- package/dist/solid.js +37 -25
- package/dist/solid.source.jsx +41 -25
- package/dist/svelte-core.cjs +31 -25
- package/dist/svelte-core.js +31 -25
- package/dist/svelte-src/BottomSheet.svelte +3 -0
- package/dist/svelte.cjs +34 -25
- package/dist/svelte.js +34 -25
- package/dist/vue.cjs +35 -25
- package/dist/vue.js +35 -25
- package/dist/webgl.d.cts +1 -1
- package/dist/webgl.d.ts +1 -1
- package/package.json +1 -1
package/dist/vue.cjs
CHANGED
|
@@ -843,22 +843,18 @@ var ScrimController = class {
|
|
|
843
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
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
if (nextPointer !== this.lastBackdropPointer) {
|
|
859
|
-
this.backdrop.style.pointerEvents = nextPointer;
|
|
860
|
-
this.lastBackdropPointer = nextPointer;
|
|
861
|
-
}
|
|
846
|
+
const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
|
|
847
|
+
const backdropOpacity = this.isTopSheet() ? ramp : 0;
|
|
848
|
+
if (this.backdropOpacitySentinel.shouldWrite(
|
|
849
|
+
backdropOpacity,
|
|
850
|
+
OPACITY_WRITE_EPSILON
|
|
851
|
+
)) {
|
|
852
|
+
this.backdrop.style.opacity = String(backdropOpacity);
|
|
853
|
+
}
|
|
854
|
+
const nextPointer = backdropOpacity > POINTER_EVENTS_OPACITY_THRESHOLD ? "auto" : "none";
|
|
855
|
+
if (nextPointer !== this.lastBackdropPointer) {
|
|
856
|
+
this.backdrop.style.pointerEvents = nextPointer;
|
|
857
|
+
this.lastBackdropPointer = nextPointer;
|
|
862
858
|
}
|
|
863
859
|
}
|
|
864
860
|
if (this.screenComponent && this.scrimMode !== "off") {
|
|
@@ -1388,18 +1384,20 @@ var AnimationRunner = class {
|
|
|
1388
1384
|
get isAnimating() {
|
|
1389
1385
|
return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
|
|
1390
1386
|
}
|
|
1387
|
+
cancelWaapi() {
|
|
1388
|
+
if (!this.currentWaapi) return;
|
|
1389
|
+
const entry = this.currentWaapi;
|
|
1390
|
+
this.currentWaapi = null;
|
|
1391
|
+
entry.stop();
|
|
1392
|
+
try {
|
|
1393
|
+
entry.anim.cancel();
|
|
1394
|
+
} catch {
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1391
1397
|
cancel() {
|
|
1392
1398
|
this.currentTween?.cancel();
|
|
1393
1399
|
this.currentSpring?.cancel();
|
|
1394
|
-
|
|
1395
|
-
const entry = this.currentWaapi;
|
|
1396
|
-
this.currentWaapi = null;
|
|
1397
|
-
entry.stop();
|
|
1398
|
-
try {
|
|
1399
|
-
entry.anim.cancel();
|
|
1400
|
-
} catch {
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1400
|
+
this.cancelWaapi();
|
|
1403
1401
|
}
|
|
1404
1402
|
async animateTo(target, velocityPxPerMs) {
|
|
1405
1403
|
if (target === this.getSize()) {
|
|
@@ -1410,6 +1408,7 @@ var AnimationRunner = class {
|
|
|
1410
1408
|
}
|
|
1411
1409
|
this.currentTween?.cancel();
|
|
1412
1410
|
this.currentSpring?.cancel();
|
|
1411
|
+
this.cancelWaapi();
|
|
1413
1412
|
this.getRootEl()?.setAttribute("data-animating", "true");
|
|
1414
1413
|
this.element.style.willChange = "transform";
|
|
1415
1414
|
if (this.reducedMotion) {
|
|
@@ -3402,12 +3401,19 @@ var BottomSheetCore = class {
|
|
|
3402
3401
|
for (const anchor of this.anchors) anchor.syncZ(z + 1);
|
|
3403
3402
|
},
|
|
3404
3403
|
setIsTop: (isTop) => {
|
|
3404
|
+
if (this.isTopSheet === isTop) return;
|
|
3405
3405
|
this.isTopSheet = isTop;
|
|
3406
|
+
this.repaintScrim();
|
|
3406
3407
|
},
|
|
3407
3408
|
isOpen: () => this.size > 0 || this.opening,
|
|
3408
3409
|
setDepth: (depth) => this.applyStackDepth(depth)
|
|
3409
3410
|
}));
|
|
3410
3411
|
}
|
|
3412
|
+
repaintScrim() {
|
|
3413
|
+
if (this.destroyed) return;
|
|
3414
|
+
this.scrim.invalidateOpacityCache();
|
|
3415
|
+
this.scrim.applyOpacity(this.computeProgress(this.size), true);
|
|
3416
|
+
}
|
|
3411
3417
|
applyStackDepth(depth) {
|
|
3412
3418
|
if (!this.stackEffectEnabled) return;
|
|
3413
3419
|
this.element.setAttribute("data-stack-depth", String(depth));
|
|
@@ -4740,6 +4746,10 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
4740
4746
|
if (next === void 0) return;
|
|
4741
4747
|
getEngine()?.setDragFrom(next);
|
|
4742
4748
|
});
|
|
4749
|
+
vue.watch(() => props.mode, (next) => {
|
|
4750
|
+
if (next === void 0) return;
|
|
4751
|
+
getEngine()?.setMode(next);
|
|
4752
|
+
});
|
|
4743
4753
|
const mounted = vue.ref(false);
|
|
4744
4754
|
const anchorHosts = vue.shallowRef({});
|
|
4745
4755
|
const anchorDetachers = vue.ref([]);
|
package/dist/vue.js
CHANGED
|
@@ -841,22 +841,18 @@ var ScrimController = class {
|
|
|
841
841
|
if (this.backdrop) {
|
|
842
842
|
const [s, e] = this.backdropRange;
|
|
843
843
|
const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
|
|
844
|
-
const
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
if (nextPointer !== this.lastBackdropPointer) {
|
|
857
|
-
this.backdrop.style.pointerEvents = nextPointer;
|
|
858
|
-
this.lastBackdropPointer = nextPointer;
|
|
859
|
-
}
|
|
844
|
+
const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
|
|
845
|
+
const backdropOpacity = this.isTopSheet() ? ramp : 0;
|
|
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) {
|
|
@@ -3400,12 +3399,19 @@ var BottomSheetCore = class {
|
|
|
3400
3399
|
for (const anchor of this.anchors) anchor.syncZ(z + 1);
|
|
3401
3400
|
},
|
|
3402
3401
|
setIsTop: (isTop) => {
|
|
3402
|
+
if (this.isTopSheet === isTop) return;
|
|
3403
3403
|
this.isTopSheet = isTop;
|
|
3404
|
+
this.repaintScrim();
|
|
3404
3405
|
},
|
|
3405
3406
|
isOpen: () => this.size > 0 || this.opening,
|
|
3406
3407
|
setDepth: (depth) => this.applyStackDepth(depth)
|
|
3407
3408
|
}));
|
|
3408
3409
|
}
|
|
3410
|
+
repaintScrim() {
|
|
3411
|
+
if (this.destroyed) return;
|
|
3412
|
+
this.scrim.invalidateOpacityCache();
|
|
3413
|
+
this.scrim.applyOpacity(this.computeProgress(this.size), true);
|
|
3414
|
+
}
|
|
3409
3415
|
applyStackDepth(depth) {
|
|
3410
3416
|
if (!this.stackEffectEnabled) return;
|
|
3411
3417
|
this.element.setAttribute("data-stack-depth", String(depth));
|
|
@@ -4738,6 +4744,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4738
4744
|
if (next === void 0) return;
|
|
4739
4745
|
getEngine()?.setDragFrom(next);
|
|
4740
4746
|
});
|
|
4747
|
+
watch(() => props.mode, (next) => {
|
|
4748
|
+
if (next === void 0) return;
|
|
4749
|
+
getEngine()?.setMode(next);
|
|
4750
|
+
});
|
|
4741
4751
|
const mounted = ref(false);
|
|
4742
4752
|
const anchorHosts = shallowRef({});
|
|
4743
4753
|
const anchorDetachers = ref([]);
|
package/dist/webgl.d.cts
CHANGED
package/dist/webgl.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@surdeddd/bottom-sheet",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "Universal, headless bottom sheet — framework-agnostic core with React, Vue 3, Svelte, Solid, Qwik, Preact, Lit and Custom Element adapters. Pointer Events, snap points, momentum, a11y, SSR-safe.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|