@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/README.md
CHANGED
|
@@ -227,7 +227,7 @@ type SnapPoint =
|
|
|
227
227
|
| `snapPoints` | required | Ordered list of `{ id, size }` |
|
|
228
228
|
| `allowed` | all ids | Subset the sheet may settle on right now |
|
|
229
229
|
| `initial` | first allowed | Snap id to start at |
|
|
230
|
-
| `mode` | `"bottom"` | `bottom`, `top`, `left`, `right`
|
|
230
|
+
| `mode` | `"bottom"` | `bottom`, `top`, `left`, `right`, or logical `start` / `end`; reactive in React and Vue adapters |
|
|
231
231
|
| `animation` | `"spring"` | `spring`, `tween`, `ios-spring`, `material-bounce`, `linear`, `snappy` |
|
|
232
232
|
| `settleAnimation` | off | `"waapi"` — settle runs as a compositor-driven Web Animation (pre-sampled spring keyframes); falls back to rAF automatically |
|
|
233
233
|
| `features` | all defaults | `EngineFeature[]` — override/extend the composable feature set (see Slim core below) |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BottomSheetCore, c as EngineOptions } from './BottomSheetCore-
|
|
1
|
+
import { B as BottomSheetCore, c as EngineOptions } from './BottomSheetCore-CIijwtdi.js';
|
|
2
2
|
|
|
3
3
|
declare class BottomSheetEngine extends BottomSheetCore {
|
|
4
4
|
constructor(opts: EngineOptions);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BottomSheetCore, c as EngineOptions } from './BottomSheetCore-
|
|
1
|
+
import { B as BottomSheetCore, c as EngineOptions } from './BottomSheetCore-CK8Rh1He.cjs';
|
|
2
2
|
|
|
3
3
|
declare class BottomSheetEngine extends BottomSheetCore {
|
|
4
4
|
constructor(opts: EngineOptions);
|
package/dist/core.cjs
CHANGED
|
@@ -838,13 +838,11 @@ var ScrimController = class {
|
|
|
838
838
|
if (!progressChanged && this.backdropOpacitySentinel.value !== -1 && this.screenOpacitySentinel.value !== -1) {
|
|
839
839
|
return;
|
|
840
840
|
}
|
|
841
|
-
if (this.backdrop
|
|
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
|
-
1
|
|
847
|
-
);
|
|
844
|
+
const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
|
|
845
|
+
const backdropOpacity = this.isTopSheet() ? ramp : 0;
|
|
848
846
|
if (this.backdropOpacitySentinel.shouldWrite(
|
|
849
847
|
backdropOpacity,
|
|
850
848
|
OPACITY_WRITE_EPSILON
|
|
@@ -1384,18 +1382,20 @@ var AnimationRunner = class {
|
|
|
1384
1382
|
get isAnimating() {
|
|
1385
1383
|
return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
|
|
1386
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
|
+
}
|
|
1387
1395
|
cancel() {
|
|
1388
1396
|
this.currentTween?.cancel();
|
|
1389
1397
|
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
|
-
}
|
|
1398
|
+
this.cancelWaapi();
|
|
1399
1399
|
}
|
|
1400
1400
|
async animateTo(target, velocityPxPerMs) {
|
|
1401
1401
|
if (target === this.getSize()) {
|
|
@@ -1406,6 +1406,7 @@ var AnimationRunner = class {
|
|
|
1406
1406
|
}
|
|
1407
1407
|
this.currentTween?.cancel();
|
|
1408
1408
|
this.currentSpring?.cancel();
|
|
1409
|
+
this.cancelWaapi();
|
|
1409
1410
|
this.getRootEl()?.setAttribute("data-animating", "true");
|
|
1410
1411
|
this.element.style.willChange = "transform";
|
|
1411
1412
|
if (this.reducedMotion) {
|
|
@@ -3398,12 +3399,19 @@ var BottomSheetCore = class {
|
|
|
3398
3399
|
for (const anchor of this.anchors) anchor.syncZ(z + 1);
|
|
3399
3400
|
},
|
|
3400
3401
|
setIsTop: (isTop) => {
|
|
3402
|
+
if (this.isTopSheet === isTop) return;
|
|
3401
3403
|
this.isTopSheet = isTop;
|
|
3404
|
+
this.repaintScrim();
|
|
3402
3405
|
},
|
|
3403
3406
|
isOpen: () => this.size > 0 || this.opening,
|
|
3404
3407
|
setDepth: (depth) => this.applyStackDepth(depth)
|
|
3405
3408
|
}));
|
|
3406
3409
|
}
|
|
3410
|
+
repaintScrim() {
|
|
3411
|
+
if (this.destroyed) return;
|
|
3412
|
+
this.scrim.invalidateOpacityCache();
|
|
3413
|
+
this.scrim.applyOpacity(this.computeProgress(this.size), true);
|
|
3414
|
+
}
|
|
3407
3415
|
applyStackDepth(depth) {
|
|
3408
3416
|
if (!this.stackEffectEnabled) return;
|
|
3409
3417
|
this.element.setAttribute("data-stack-depth", String(depth));
|
package/dist/core.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { B as BottomSheetCore, C as CloseReason, f as EngineFeature, m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage, c as EngineOptions, E as EngineState, S as SheetEventMap, b as SheetMode, w as SnapId, d as SnapPoint, a as SnapPointDef } from './BottomSheetCore-
|
|
2
|
-
export { R as ResolvedSnap } from './index-
|
|
1
|
+
export { B as BottomSheetCore, C as CloseReason, f as EngineFeature, m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage, c as EngineOptions, E as EngineState, S as SheetEventMap, b as SheetMode, w as SnapId, d as SnapPoint, a as SnapPointDef } from './BottomSheetCore-CK8Rh1He.cjs';
|
|
2
|
+
export { R as ResolvedSnap } from './index-BEX-NHRJ.cjs';
|
|
3
3
|
import './transform-jVfAikE9.cjs';
|
package/dist/core.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { B as BottomSheetCore, C as CloseReason, f as EngineFeature, m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage, c as EngineOptions, E as EngineState, S as SheetEventMap, b as SheetMode, w as SnapId, d as SnapPoint, a as SnapPointDef } from './BottomSheetCore-
|
|
2
|
-
export { R as ResolvedSnap } from './index-
|
|
1
|
+
export { B as BottomSheetCore, C as CloseReason, f as EngineFeature, m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage, c as EngineOptions, E as EngineState, S as SheetEventMap, b as SheetMode, w as SnapId, d as SnapPoint, a as SnapPointDef } from './BottomSheetCore-CIijwtdi.js';
|
|
2
|
+
export { R as ResolvedSnap } from './index-BqLHKOeM.js';
|
|
3
3
|
import './transform-jVfAikE9.js';
|
package/dist/core.js
CHANGED
|
@@ -836,13 +836,11 @@ var ScrimController = class {
|
|
|
836
836
|
if (!progressChanged && this.backdropOpacitySentinel.value !== -1 && this.screenOpacitySentinel.value !== -1) {
|
|
837
837
|
return;
|
|
838
838
|
}
|
|
839
|
-
if (this.backdrop
|
|
839
|
+
if (this.backdrop) {
|
|
840
840
|
const [s, e] = this.backdropRange;
|
|
841
841
|
const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
|
|
842
|
-
const
|
|
843
|
-
|
|
844
|
-
1
|
|
845
|
-
);
|
|
842
|
+
const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
|
|
843
|
+
const backdropOpacity = this.isTopSheet() ? ramp : 0;
|
|
846
844
|
if (this.backdropOpacitySentinel.shouldWrite(
|
|
847
845
|
backdropOpacity,
|
|
848
846
|
OPACITY_WRITE_EPSILON
|
|
@@ -1382,18 +1380,20 @@ var AnimationRunner = class {
|
|
|
1382
1380
|
get isAnimating() {
|
|
1383
1381
|
return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
|
|
1384
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
|
+
}
|
|
1385
1393
|
cancel() {
|
|
1386
1394
|
this.currentTween?.cancel();
|
|
1387
1395
|
this.currentSpring?.cancel();
|
|
1388
|
-
|
|
1389
|
-
const entry = this.currentWaapi;
|
|
1390
|
-
this.currentWaapi = null;
|
|
1391
|
-
entry.stop();
|
|
1392
|
-
try {
|
|
1393
|
-
entry.anim.cancel();
|
|
1394
|
-
} catch {
|
|
1395
|
-
}
|
|
1396
|
-
}
|
|
1396
|
+
this.cancelWaapi();
|
|
1397
1397
|
}
|
|
1398
1398
|
async animateTo(target, velocityPxPerMs) {
|
|
1399
1399
|
if (target === this.getSize()) {
|
|
@@ -1404,6 +1404,7 @@ var AnimationRunner = class {
|
|
|
1404
1404
|
}
|
|
1405
1405
|
this.currentTween?.cancel();
|
|
1406
1406
|
this.currentSpring?.cancel();
|
|
1407
|
+
this.cancelWaapi();
|
|
1407
1408
|
this.getRootEl()?.setAttribute("data-animating", "true");
|
|
1408
1409
|
this.element.style.willChange = "transform";
|
|
1409
1410
|
if (this.reducedMotion) {
|
|
@@ -3396,12 +3397,19 @@ var BottomSheetCore = class {
|
|
|
3396
3397
|
for (const anchor of this.anchors) anchor.syncZ(z + 1);
|
|
3397
3398
|
},
|
|
3398
3399
|
setIsTop: (isTop) => {
|
|
3400
|
+
if (this.isTopSheet === isTop) return;
|
|
3399
3401
|
this.isTopSheet = isTop;
|
|
3402
|
+
this.repaintScrim();
|
|
3400
3403
|
},
|
|
3401
3404
|
isOpen: () => this.size > 0 || this.opening,
|
|
3402
3405
|
setDepth: (depth) => this.applyStackDepth(depth)
|
|
3403
3406
|
}));
|
|
3404
3407
|
}
|
|
3408
|
+
repaintScrim() {
|
|
3409
|
+
if (this.destroyed) return;
|
|
3410
|
+
this.scrim.invalidateOpacityCache();
|
|
3411
|
+
this.scrim.applyOpacity(this.computeProgress(this.size), true);
|
|
3412
|
+
}
|
|
3405
3413
|
applyStackDepth(depth) {
|
|
3406
3414
|
if (!this.stackEffectEnabled) return;
|
|
3407
3415
|
this.element.setAttribute("data-stack-depth", String(depth));
|
package/dist/debug.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as EngineState, S as SheetEventMap } from './BottomSheetCore-
|
|
1
|
+
import { E as EngineState, S as SheetEventMap } from './BottomSheetCore-CK8Rh1He.cjs';
|
|
2
2
|
import './transform-jVfAikE9.cjs';
|
|
3
3
|
|
|
4
4
|
type DebugOverlayPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
package/dist/debug.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as EngineState, S as SheetEventMap } from './BottomSheetCore-
|
|
1
|
+
import { E as EngineState, S as SheetEventMap } from './BottomSheetCore-CIijwtdi.js';
|
|
2
2
|
import './transform-jVfAikE9.js';
|
|
3
3
|
|
|
4
4
|
type DebugOverlayPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
package/dist/element.cjs
CHANGED
|
@@ -949,13 +949,11 @@ var init_scrim_controller = __esm({
|
|
|
949
949
|
if (!progressChanged && this.backdropOpacitySentinel.value !== -1 && this.screenOpacitySentinel.value !== -1) {
|
|
950
950
|
return;
|
|
951
951
|
}
|
|
952
|
-
if (this.backdrop
|
|
952
|
+
if (this.backdrop) {
|
|
953
953
|
const [s, e] = this.backdropRange;
|
|
954
954
|
const range = Math.max(e - s, RANGE_DIVISION_EPSILON);
|
|
955
|
-
const
|
|
956
|
-
|
|
957
|
-
1
|
|
958
|
-
);
|
|
955
|
+
const ramp = Math.min(Math.max((progress - s) / range, 0), 1);
|
|
956
|
+
const backdropOpacity = this.isTopSheet() ? ramp : 0;
|
|
959
957
|
if (this.backdropOpacitySentinel.shouldWrite(
|
|
960
958
|
backdropOpacity,
|
|
961
959
|
OPACITY_WRITE_EPSILON
|
|
@@ -1526,18 +1524,20 @@ var init_animation_runner = __esm({
|
|
|
1526
1524
|
get isAnimating() {
|
|
1527
1525
|
return this.currentTween !== null || this.currentSpring !== null || this.currentWaapi !== null;
|
|
1528
1526
|
}
|
|
1527
|
+
cancelWaapi() {
|
|
1528
|
+
if (!this.currentWaapi) return;
|
|
1529
|
+
const entry = this.currentWaapi;
|
|
1530
|
+
this.currentWaapi = null;
|
|
1531
|
+
entry.stop();
|
|
1532
|
+
try {
|
|
1533
|
+
entry.anim.cancel();
|
|
1534
|
+
} catch {
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1529
1537
|
cancel() {
|
|
1530
1538
|
this.currentTween?.cancel();
|
|
1531
1539
|
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
|
-
}
|
|
1540
|
+
this.cancelWaapi();
|
|
1541
1541
|
}
|
|
1542
1542
|
async animateTo(target, velocityPxPerMs) {
|
|
1543
1543
|
if (target === this.getSize()) {
|
|
@@ -1548,6 +1548,7 @@ var init_animation_runner = __esm({
|
|
|
1548
1548
|
}
|
|
1549
1549
|
this.currentTween?.cancel();
|
|
1550
1550
|
this.currentSpring?.cancel();
|
|
1551
|
+
this.cancelWaapi();
|
|
1551
1552
|
this.getRootEl()?.setAttribute("data-animating", "true");
|
|
1552
1553
|
this.element.style.willChange = "transform";
|
|
1553
1554
|
if (this.reducedMotion) {
|
|
@@ -3676,12 +3677,19 @@ var init_BottomSheetCore = __esm({
|
|
|
3676
3677
|
for (const anchor of this.anchors) anchor.syncZ(z + 1);
|
|
3677
3678
|
},
|
|
3678
3679
|
setIsTop: (isTop) => {
|
|
3680
|
+
if (this.isTopSheet === isTop) return;
|
|
3679
3681
|
this.isTopSheet = isTop;
|
|
3682
|
+
this.repaintScrim();
|
|
3680
3683
|
},
|
|
3681
3684
|
isOpen: () => this.size > 0 || this.opening,
|
|
3682
3685
|
setDepth: (depth) => this.applyStackDepth(depth)
|
|
3683
3686
|
}));
|
|
3684
3687
|
}
|
|
3688
|
+
repaintScrim() {
|
|
3689
|
+
if (this.destroyed) return;
|
|
3690
|
+
this.scrim.invalidateOpacityCache();
|
|
3691
|
+
this.scrim.applyOpacity(this.computeProgress(this.size), true);
|
|
3692
|
+
}
|
|
3685
3693
|
applyStackDepth(depth) {
|
|
3686
3694
|
if (!this.stackEffectEnabled) return;
|
|
3687
3695
|
this.element.setAttribute("data-stack-depth", String(depth));
|
|
@@ -4688,6 +4696,7 @@ var init_attributes = __esm({
|
|
|
4688
4696
|
ATTR_SCRIM_COLOR = "scrim-color";
|
|
4689
4697
|
ATTR_SNAP = "snap";
|
|
4690
4698
|
LIVE_ATTRS = /* @__PURE__ */ new Set([
|
|
4699
|
+
ATTR_MODE,
|
|
4691
4700
|
ATTR_RADIUS,
|
|
4692
4701
|
ATTR_MAX_HEIGHT,
|
|
4693
4702
|
ATTR_BACKDROP_COLOR,
|
|
@@ -4914,6 +4923,9 @@ var init_BottomSheetElement = __esm({
|
|
|
4914
4923
|
if (mode) this.engine.setDragFrom(mode);
|
|
4915
4924
|
break;
|
|
4916
4925
|
}
|
|
4926
|
+
case ATTR_MODE:
|
|
4927
|
+
this.engine.setMode(parseMode(value));
|
|
4928
|
+
break;
|
|
4917
4929
|
case ATTR_SNAP:
|
|
4918
4930
|
if (value && value !== this.engine.state.activeId) {
|
|
4919
4931
|
void this.engine.snapTo(value);
|
package/dist/element.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BottomSheetEngine } from './BottomSheetEngine-
|
|
2
|
-
import { C as CloseReason, A as AnchorOptions, e as ScrimStagesOptions, E as EngineState } from './BottomSheetCore-
|
|
1
|
+
import { B as BottomSheetEngine } from './BottomSheetEngine-hLSAxzla.cjs';
|
|
2
|
+
import { C as CloseReason, A as AnchorOptions, e as ScrimStagesOptions, E as EngineState } from './BottomSheetCore-CK8Rh1He.cjs';
|
|
3
3
|
import './transform-jVfAikE9.cjs';
|
|
4
4
|
|
|
5
5
|
declare const BaseHTMLElement: typeof HTMLElement;
|
package/dist/element.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BottomSheetEngine } from './BottomSheetEngine-
|
|
2
|
-
import { C as CloseReason, A as AnchorOptions, e as ScrimStagesOptions, E as EngineState } from './BottomSheetCore-
|
|
1
|
+
import { B as BottomSheetEngine } from './BottomSheetEngine-CZglPsTF.js';
|
|
2
|
+
import { C as CloseReason, A as AnchorOptions, e as ScrimStagesOptions, E as EngineState } from './BottomSheetCore-CIijwtdi.js';
|
|
3
3
|
import './transform-jVfAikE9.js';
|
|
4
4
|
|
|
5
5
|
declare const BaseHTMLElement: typeof HTMLElement;
|