@surdeddd/bottom-sheet 0.9.1 → 0.10.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 +108 -66
- package/dist/{BottomSheetEngine-CBRcBwV-.d.ts → BottomSheetEngine-DRjCU73e.d.ts} +6 -5
- package/dist/{BottomSheetEngine-BcyruNP1.d.cts → BottomSheetEngine-DzsIwD28.d.cts} +6 -5
- package/dist/element.cjs +161 -99
- package/dist/element.d.cts +1 -1
- package/dist/element.d.ts +1 -1
- package/dist/element.iife.global.js +2 -2
- package/dist/element.js +161 -99
- package/dist/index.cjs +155 -115
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +155 -115
- 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/overlay.cjs +34 -25
- package/dist/overlay.d.cts +3 -0
- package/dist/overlay.d.ts +3 -0
- package/dist/overlay.js +34 -25
- package/dist/preact.d.cts +2 -1
- package/dist/preact.d.ts +2 -1
- package/dist/qwik.cjs +179 -93
- package/dist/qwik.d.cts +11 -2
- package/dist/qwik.d.ts +11 -2
- package/dist/qwik.js +179 -93
- package/dist/react.cjs +266 -181
- package/dist/react.d.cts +26 -4
- package/dist/react.d.ts +26 -4
- package/dist/react.js +266 -181
- package/dist/solid.cjs +145 -92
- package/dist/solid.d.cts +14 -4
- package/dist/solid.d.ts +14 -4
- package/dist/solid.js +145 -92
- package/dist/solid.source.jsx +145 -92
- package/dist/styles.css +17 -1
- package/dist/svelte-core.cjs +128 -90
- package/dist/svelte-core.js +128 -90
- package/dist/svelte-src/BottomSheet.svelte +6 -0
- package/dist/svelte.cjs +130 -90
- package/dist/svelte.d.cts +2 -0
- package/dist/svelte.d.ts +2 -0
- package/dist/svelte.js +130 -90
- package/dist/teleport-7uYNiEAT.d.cts +3 -0
- package/dist/teleport-7uYNiEAT.d.ts +3 -0
- package/dist/vue.cjs +136 -91
- package/dist/vue.d.cts +3 -1
- package/dist/vue.d.ts +3 -1
- package/dist/vue.js +136 -91
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -189,11 +189,18 @@ var resolveSnap = (point, mode, measureFit) => {
|
|
|
189
189
|
return Math.max(0, el.getBoundingClientRect().width);
|
|
190
190
|
};
|
|
191
191
|
|
|
192
|
+
// src/core/primitives/devWarn.ts
|
|
193
|
+
function devWarn(...args) {
|
|
194
|
+
if (typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production" && typeof console !== "undefined") {
|
|
195
|
+
console.warn(...args);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
192
199
|
// src/core/primitives/snap-points.ts
|
|
193
200
|
var resolveSnapList = (points, mode, measureFit) => points.map((p) => {
|
|
194
201
|
const raw = resolveSnap(p.size, mode, measureFit);
|
|
195
202
|
if (!Number.isFinite(raw) || raw < 0) {
|
|
196
|
-
|
|
203
|
+
devWarn(
|
|
197
204
|
`[BottomSheet] snap "${p.id}" resolved to invalid size (${String(p.size)} \u2192 ${raw}); clamped to 0.`
|
|
198
205
|
);
|
|
199
206
|
return { id: p.id, size: 0 };
|
|
@@ -205,7 +212,7 @@ var auditVhUsage = (points) => {
|
|
|
205
212
|
for (const p of points) {
|
|
206
213
|
if (typeof p.size !== "string") continue;
|
|
207
214
|
if (!VH_NOT_DVH.test(p.size)) continue;
|
|
208
|
-
|
|
215
|
+
devWarn(
|
|
209
216
|
`[BottomSheet] snap "${p.id}" uses "vh" \u2014 prefer "dvh" on mobile (iOS Safari URL bar makes vh unstable). See https://web.dev/blog/viewport-units`
|
|
210
217
|
);
|
|
211
218
|
}
|
|
@@ -259,6 +266,26 @@ var findDragSettleTarget = (input) => {
|
|
|
259
266
|
);
|
|
260
267
|
};
|
|
261
268
|
|
|
269
|
+
// src/core/primitives/cancelable-emit.ts
|
|
270
|
+
function emitCancelable(emit, base, warnLabel) {
|
|
271
|
+
let cancelled = false;
|
|
272
|
+
let frozen = false;
|
|
273
|
+
emit({
|
|
274
|
+
...base,
|
|
275
|
+
cancel: () => {
|
|
276
|
+
if (frozen) {
|
|
277
|
+
devWarn(
|
|
278
|
+
`[BottomSheet] ${warnLabel}.cancel() called asynchronously \u2014 ignored. cancel() must be invoked synchronously inside the listener.`
|
|
279
|
+
);
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
cancelled = true;
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
frozen = true;
|
|
286
|
+
return cancelled;
|
|
287
|
+
}
|
|
288
|
+
|
|
262
289
|
// src/core/primitives/snap-resolver.ts
|
|
263
290
|
var SnapResolver = class {
|
|
264
291
|
constructor(raw, allowed, mode, measureFit, onMaxAxisSizeChange) {
|
|
@@ -403,7 +430,9 @@ function notifyLinkedSheets(sheets, self) {
|
|
|
403
430
|
try {
|
|
404
431
|
if (linked.state.size === 0) continue;
|
|
405
432
|
const ids = linked.getAllowedIds();
|
|
406
|
-
const
|
|
433
|
+
const resolved = linked.getResolvedSnaps();
|
|
434
|
+
const sizeOf = (id) => resolved.find((s) => s.id === id)?.size ?? 0;
|
|
435
|
+
const target = ids.find((id) => sizeOf(id) > 0);
|
|
407
436
|
if (target && target !== linked.state.activeId) {
|
|
408
437
|
void linked.snapTo(target);
|
|
409
438
|
}
|
|
@@ -620,11 +649,15 @@ function installVisualViewport(deps) {
|
|
|
620
649
|
if (clamp < deps.getMaxAxisSize()) {
|
|
621
650
|
deps.setMaxAxisSize(clamp);
|
|
622
651
|
}
|
|
652
|
+
const wasAnimating = deps.isAnimating?.() ?? false;
|
|
653
|
+
deps.cancelInFlight();
|
|
654
|
+
deps.newCycle();
|
|
623
655
|
const max = deps.getMaxAxisSize();
|
|
624
656
|
deps.setSize(Math.min(deps.getSize(), max));
|
|
625
657
|
const current = deps.resolveActiveSnap();
|
|
626
658
|
if (current && !deps.isDragging()) {
|
|
627
659
|
deps.applySize(Math.min(current.size, max));
|
|
660
|
+
if (wasAnimating) deps.resyncAfterCancel?.();
|
|
628
661
|
} else {
|
|
629
662
|
deps.applySize(deps.getSize());
|
|
630
663
|
}
|
|
@@ -765,6 +798,54 @@ function installFitObserver(deps) {
|
|
|
765
798
|
};
|
|
766
799
|
}
|
|
767
800
|
|
|
801
|
+
// src/core/features/max-height-controller.ts
|
|
802
|
+
function createMaxHeightController(deps) {
|
|
803
|
+
let maxHeightCap;
|
|
804
|
+
let maxHeightRaw;
|
|
805
|
+
const resolveCap = () => {
|
|
806
|
+
const raw = maxHeightRaw;
|
|
807
|
+
if (raw === void 0) {
|
|
808
|
+
maxHeightCap = void 0;
|
|
809
|
+
return;
|
|
810
|
+
}
|
|
811
|
+
if (typeof raw === "number") {
|
|
812
|
+
maxHeightCap = raw;
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
if (typeof window === "undefined") return;
|
|
816
|
+
const measured = resolveSnap(raw, deps.mode);
|
|
817
|
+
maxHeightCap = measured > 0 ? measured : void 0;
|
|
818
|
+
};
|
|
819
|
+
const clampTo = () => {
|
|
820
|
+
if (maxHeightCap === void 0) return;
|
|
821
|
+
if (deps.getMaxAxisSize() > maxHeightCap) {
|
|
822
|
+
deps.setMaxAxisSize(maxHeightCap);
|
|
823
|
+
}
|
|
824
|
+
};
|
|
825
|
+
return {
|
|
826
|
+
setRadius(r) {
|
|
827
|
+
deps.element.style.setProperty(
|
|
828
|
+
"--bs-radius",
|
|
829
|
+
typeof r === "number" ? `${r}px` : r
|
|
830
|
+
);
|
|
831
|
+
},
|
|
832
|
+
setMaxHeight(h) {
|
|
833
|
+
const value = typeof h === "number" ? `${h}px` : h;
|
|
834
|
+
const axis = layoutAxis(deps.mode);
|
|
835
|
+
deps.element.style.setProperty(
|
|
836
|
+
axis === "height" ? "max-height" : "max-width",
|
|
837
|
+
value
|
|
838
|
+
);
|
|
839
|
+
maxHeightRaw = h;
|
|
840
|
+
resolveCap();
|
|
841
|
+
deps.recompute();
|
|
842
|
+
},
|
|
843
|
+
resolveCap,
|
|
844
|
+
clampTo,
|
|
845
|
+
getCap: () => maxHeightCap
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
|
|
768
849
|
// src/core/features/fit-measurement.ts
|
|
769
850
|
var measureSheetNatural = (element, content, vertical) => {
|
|
770
851
|
if (!content) {
|
|
@@ -896,13 +977,6 @@ var WriteSentinel = class {
|
|
|
896
977
|
}
|
|
897
978
|
};
|
|
898
979
|
|
|
899
|
-
// src/core/primitives/devWarn.ts
|
|
900
|
-
function devWarn(...args) {
|
|
901
|
-
if (typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production" && typeof console !== "undefined") {
|
|
902
|
-
console.warn(...args);
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
|
|
906
980
|
// src/core/primitives/overlay-position.ts
|
|
907
981
|
function resolveSheetAnchoredStyle(mode, position, inset) {
|
|
908
982
|
const sizeOffset = `calc(var(--bs-size, 0px) + ${inset})`;
|
|
@@ -2549,8 +2623,7 @@ var BottomSheetEngine = class {
|
|
|
2549
2623
|
__publicField(this, "disableCloseFlag");
|
|
2550
2624
|
__publicField(this, "disableDragFlag");
|
|
2551
2625
|
__publicField(this, "closeOnRouteChange");
|
|
2552
|
-
__publicField(this, "
|
|
2553
|
-
__publicField(this, "maxHeightRaw");
|
|
2626
|
+
__publicField(this, "maxHeight");
|
|
2554
2627
|
__publicField(this, "snapPointsRaw");
|
|
2555
2628
|
__publicField(this, "snaps");
|
|
2556
2629
|
__publicField(this, "activeId");
|
|
@@ -2661,11 +2734,20 @@ var BottomSheetEngine = class {
|
|
|
2661
2734
|
auditVhUsage(this.snapPointsRaw);
|
|
2662
2735
|
this.auditDuplicateSnapIds(this.snapPointsRaw);
|
|
2663
2736
|
this.rootEl = this.element.closest(".bs-root");
|
|
2737
|
+
this.maxHeight = createMaxHeightController({
|
|
2738
|
+
element: this.element,
|
|
2739
|
+
mode: this.mode,
|
|
2740
|
+
getMaxAxisSize: () => this.snaps.getMaxAxisSize(),
|
|
2741
|
+
setMaxAxisSize: (size) => {
|
|
2742
|
+
this.snaps.setMaxAxisSize(size);
|
|
2743
|
+
},
|
|
2744
|
+
recompute: () => this.recompute()
|
|
2745
|
+
});
|
|
2664
2746
|
this.fitDeps = {
|
|
2665
2747
|
element: this.element,
|
|
2666
2748
|
scrollContainer: this.scrollContainer,
|
|
2667
2749
|
mode: this.mode,
|
|
2668
|
-
getMaxHeightCap: () => this.
|
|
2750
|
+
getMaxHeightCap: () => this.maxHeight.getCap()
|
|
2669
2751
|
};
|
|
2670
2752
|
this.snaps = new SnapResolver(
|
|
2671
2753
|
this.snapPointsRaw,
|
|
@@ -2776,7 +2858,7 @@ var BottomSheetEngine = class {
|
|
|
2776
2858
|
}
|
|
2777
2859
|
use(plugin) {
|
|
2778
2860
|
if (this.destroyed) {
|
|
2779
|
-
|
|
2861
|
+
devWarn(
|
|
2780
2862
|
`[BottomSheet] use("${plugin.name}") called on destroyed engine \u2014 ignored.`
|
|
2781
2863
|
);
|
|
2782
2864
|
return this;
|
|
@@ -2818,6 +2900,9 @@ var BottomSheetEngine = class {
|
|
|
2818
2900
|
getAllowedIds() {
|
|
2819
2901
|
return this.snaps.getAllowedIds().slice();
|
|
2820
2902
|
}
|
|
2903
|
+
getResolvedSnaps() {
|
|
2904
|
+
return this.snaps.getResolvedSnaps();
|
|
2905
|
+
}
|
|
2821
2906
|
async snapTo(id, velocityOrOpts = 0, _skipBeforeSnap = false) {
|
|
2822
2907
|
if (this.destroyed) return;
|
|
2823
2908
|
const opts = typeof velocityOrOpts === "object" ? velocityOrOpts : { velocity: velocityOrOpts };
|
|
@@ -2826,11 +2911,11 @@ var BottomSheetEngine = class {
|
|
|
2826
2911
|
if (externalSignal?.aborted) return;
|
|
2827
2912
|
const target = this.snaps.findById(id);
|
|
2828
2913
|
if (!target) {
|
|
2829
|
-
|
|
2914
|
+
devWarn(`[BottomSheet] unknown snap id: ${id}`);
|
|
2830
2915
|
return;
|
|
2831
2916
|
}
|
|
2832
2917
|
if (!this.snaps.getAllowedIds().includes(id)) {
|
|
2833
|
-
|
|
2918
|
+
devWarn(`[BottomSheet] snap "${id}" is not in allowed list`);
|
|
2834
2919
|
return;
|
|
2835
2920
|
}
|
|
2836
2921
|
if (!_skipBeforeSnap && this.emitBeforeSnap(target, this.activeId)) {
|
|
@@ -2962,42 +3047,11 @@ var BottomSheetEngine = class {
|
|
|
2962
3047
|
}
|
|
2963
3048
|
setRadius(r) {
|
|
2964
3049
|
if (this.destroyed) return;
|
|
2965
|
-
this.
|
|
2966
|
-
"--bs-radius",
|
|
2967
|
-
typeof r === "number" ? `${r}px` : r
|
|
2968
|
-
);
|
|
3050
|
+
this.maxHeight.setRadius(r);
|
|
2969
3051
|
}
|
|
2970
3052
|
setMaxHeight(h) {
|
|
2971
3053
|
if (this.destroyed) return;
|
|
2972
|
-
|
|
2973
|
-
const axis = layoutAxis(this.mode);
|
|
2974
|
-
this.element.style.setProperty(
|
|
2975
|
-
axis === "height" ? "max-height" : "max-width",
|
|
2976
|
-
value
|
|
2977
|
-
);
|
|
2978
|
-
this.maxHeightRaw = h;
|
|
2979
|
-
this.resolveMaxHeightCap();
|
|
2980
|
-
this.recompute();
|
|
2981
|
-
}
|
|
2982
|
-
resolveMaxHeightCap() {
|
|
2983
|
-
const raw = this.maxHeightRaw;
|
|
2984
|
-
if (raw === void 0) {
|
|
2985
|
-
this.maxHeightCap = void 0;
|
|
2986
|
-
return;
|
|
2987
|
-
}
|
|
2988
|
-
if (typeof raw === "number") {
|
|
2989
|
-
this.maxHeightCap = raw;
|
|
2990
|
-
return;
|
|
2991
|
-
}
|
|
2992
|
-
if (typeof window === "undefined") return;
|
|
2993
|
-
const measured = resolveSnap(raw, this.mode);
|
|
2994
|
-
this.maxHeightCap = measured > 0 ? measured : void 0;
|
|
2995
|
-
}
|
|
2996
|
-
clampToMaxHeight() {
|
|
2997
|
-
if (this.maxHeightCap === void 0) return;
|
|
2998
|
-
if (this.snaps.getMaxAxisSize() > this.maxHeightCap) {
|
|
2999
|
-
this.snaps.setMaxAxisSize(this.maxHeightCap);
|
|
3000
|
-
}
|
|
3054
|
+
this.maxHeight.setMaxHeight(h);
|
|
3001
3055
|
}
|
|
3002
3056
|
setAllowed(ids, snap) {
|
|
3003
3057
|
if (this.destroyed) return;
|
|
@@ -3085,7 +3139,7 @@ var BottomSheetEngine = class {
|
|
|
3085
3139
|
};
|
|
3086
3140
|
const host = this.screenComponent?.parentElement;
|
|
3087
3141
|
if (!host) {
|
|
3088
|
-
|
|
3142
|
+
devWarn(
|
|
3089
3143
|
"[BottomSheet] setScrimStages: no scrim element mounted \u2014 pass `scrim` to the engine first."
|
|
3090
3144
|
);
|
|
3091
3145
|
return () => {
|
|
@@ -3135,9 +3189,9 @@ var BottomSheetEngine = class {
|
|
|
3135
3189
|
}
|
|
3136
3190
|
recompute() {
|
|
3137
3191
|
if (this.destroyed) return;
|
|
3138
|
-
this.
|
|
3192
|
+
this.maxHeight.resolveCap();
|
|
3139
3193
|
this.snaps.recompute();
|
|
3140
|
-
this.
|
|
3194
|
+
this.maxHeight.clampTo();
|
|
3141
3195
|
this.scrim.invalidateOpacityCache();
|
|
3142
3196
|
if (this.gesture?.isDragging) return;
|
|
3143
3197
|
const current = this.snaps.findById(this.activeId);
|
|
@@ -3187,42 +3241,18 @@ var BottomSheetEngine = class {
|
|
|
3187
3241
|
return this.currentAbort.signal;
|
|
3188
3242
|
}
|
|
3189
3243
|
emitBeforeSnap(target, previousId) {
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
previousId,
|
|
3196
|
-
cancel: () => {
|
|
3197
|
-
if (frozen) {
|
|
3198
|
-
console.warn(
|
|
3199
|
-
"[BottomSheet] before-snap.cancel() called asynchronously \u2014 ignored. cancel() must be invoked synchronously inside the listener."
|
|
3200
|
-
);
|
|
3201
|
-
return;
|
|
3202
|
-
}
|
|
3203
|
-
cancelled = true;
|
|
3204
|
-
}
|
|
3205
|
-
});
|
|
3206
|
-
frozen = true;
|
|
3207
|
-
return cancelled;
|
|
3244
|
+
return emitCancelable(
|
|
3245
|
+
(payload) => this.emit("before-snap", payload),
|
|
3246
|
+
{ id: target.id, size: target.size, previousId },
|
|
3247
|
+
"before-snap"
|
|
3248
|
+
);
|
|
3208
3249
|
}
|
|
3209
3250
|
emitBeforeClose(reason) {
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
if (frozen) {
|
|
3216
|
-
console.warn(
|
|
3217
|
-
"[BottomSheet] before-close.cancel() called asynchronously \u2014 ignored. cancel() must be invoked synchronously inside the listener."
|
|
3218
|
-
);
|
|
3219
|
-
return;
|
|
3220
|
-
}
|
|
3221
|
-
cancelled = true;
|
|
3222
|
-
}
|
|
3223
|
-
});
|
|
3224
|
-
frozen = true;
|
|
3225
|
-
return cancelled;
|
|
3251
|
+
return emitCancelable(
|
|
3252
|
+
(payload) => this.emit("before-close", payload),
|
|
3253
|
+
{ reason },
|
|
3254
|
+
"before-close"
|
|
3255
|
+
);
|
|
3226
3256
|
}
|
|
3227
3257
|
applyAutoAriaLabelledBy() {
|
|
3228
3258
|
if (typeof document === "undefined") return;
|
|
@@ -3237,16 +3267,16 @@ var BottomSheetEngine = class {
|
|
|
3237
3267
|
this.element.setAttribute("aria-labelledby", titled.id);
|
|
3238
3268
|
}
|
|
3239
3269
|
recomputeSnaps() {
|
|
3240
|
-
this.
|
|
3270
|
+
this.maxHeight.resolveCap();
|
|
3241
3271
|
this.snaps.setRaw(this.snapPointsRaw);
|
|
3242
|
-
this.
|
|
3272
|
+
this.maxHeight.clampTo();
|
|
3243
3273
|
this.scrim.invalidateOpacityCache();
|
|
3244
3274
|
}
|
|
3245
3275
|
auditDuplicateSnapIds(points) {
|
|
3246
3276
|
const seen = /* @__PURE__ */ new Set();
|
|
3247
3277
|
for (const p of points) {
|
|
3248
3278
|
if (seen.has(p.id)) {
|
|
3249
|
-
|
|
3279
|
+
devWarn(
|
|
3250
3280
|
`[BottomSheet] duplicate snap id "${p.id}" \u2014 only the first occurrence is reachable.`
|
|
3251
3281
|
);
|
|
3252
3282
|
}
|
|
@@ -3413,7 +3443,15 @@ var BottomSheetEngine = class {
|
|
|
3413
3443
|
setSize: (size) => {
|
|
3414
3444
|
this.size = size;
|
|
3415
3445
|
},
|
|
3416
|
-
applySize: (size) => this.applySize(size)
|
|
3446
|
+
applySize: (size) => this.applySize(size),
|
|
3447
|
+
cancelInFlight: () => {
|
|
3448
|
+
this.animation.cancel();
|
|
3449
|
+
},
|
|
3450
|
+
newCycle: () => {
|
|
3451
|
+
this.newCycle();
|
|
3452
|
+
},
|
|
3453
|
+
isAnimating: () => this.animation.isAnimating,
|
|
3454
|
+
resyncAfterCancel: () => this.resyncAfterResize()
|
|
3417
3455
|
}));
|
|
3418
3456
|
}
|
|
3419
3457
|
this.teardowns.add(installSliderKeyboard({
|
|
@@ -3690,7 +3728,7 @@ function installOverlaySwipe(deps) {
|
|
|
3690
3728
|
};
|
|
3691
3729
|
}
|
|
3692
3730
|
|
|
3693
|
-
// src/core/overlay.ts
|
|
3731
|
+
// src/core/overlay-options.ts
|
|
3694
3732
|
var OVERLAY_PRESETS = Object.freeze({
|
|
3695
3733
|
sheet: Object.freeze({
|
|
3696
3734
|
enterAnimation: "slide",
|
|
@@ -3721,6 +3759,8 @@ var OVERLAY_PRESETS = Object.freeze({
|
|
|
3721
3759
|
swipeToClose: false
|
|
3722
3760
|
})
|
|
3723
3761
|
});
|
|
3762
|
+
|
|
3763
|
+
// src/core/overlay.ts
|
|
3724
3764
|
var OverlayEngine = class {
|
|
3725
3765
|
constructor(opts) {
|
|
3726
3766
|
__publicField(this, "id", nextInstanceId("ovl"));
|
|
@@ -3797,7 +3837,7 @@ var OverlayEngine = class {
|
|
|
3797
3837
|
this.onOpenCb = opts.onOpen;
|
|
3798
3838
|
this.onCloseCb = opts.onClose;
|
|
3799
3839
|
if (this.peekRaw !== void 0 && this.edge !== "bottom") {
|
|
3800
|
-
|
|
3840
|
+
devWarn(
|
|
3801
3841
|
"[OverlayEngine] `peek` is only supported on edge: 'bottom' \u2014 ignoring."
|
|
3802
3842
|
);
|
|
3803
3843
|
this.peekRaw = void 0;
|
|
@@ -3864,10 +3904,9 @@ var OverlayEngine = class {
|
|
|
3864
3904
|
this.element.style.opacity = "1";
|
|
3865
3905
|
if (this.backdrop) {
|
|
3866
3906
|
this.backdrop.style.opacity = String(this.backdropOpacity);
|
|
3867
|
-
this.
|
|
3907
|
+
this.syncBackdropPointerEvents();
|
|
3868
3908
|
if (this.backdropFilter) {
|
|
3869
|
-
this.
|
|
3870
|
-
this.backdrop.style.webkitBackdropFilter = this.backdropFilter;
|
|
3909
|
+
this.applyBackdropFilter(this.backdropFilter);
|
|
3871
3910
|
}
|
|
3872
3911
|
}
|
|
3873
3912
|
try {
|
|
@@ -3887,8 +3926,7 @@ var OverlayEngine = class {
|
|
|
3887
3926
|
this.backdrop.style.opacity = "0";
|
|
3888
3927
|
this.backdrop.style.pointerEvents = "none";
|
|
3889
3928
|
if (this.backdropFilter) {
|
|
3890
|
-
this.
|
|
3891
|
-
this.backdrop.style.webkitBackdropFilter = "";
|
|
3929
|
+
this.applyBackdropFilter(void 0);
|
|
3892
3930
|
}
|
|
3893
3931
|
}
|
|
3894
3932
|
this.element.setAttribute("data-state", "closed");
|
|
@@ -3946,8 +3984,7 @@ var OverlayEngine = class {
|
|
|
3946
3984
|
this.backdrop.style.opacity = "0";
|
|
3947
3985
|
this.backdrop.style.pointerEvents = "none";
|
|
3948
3986
|
if (this.backdropFilter) {
|
|
3949
|
-
this.
|
|
3950
|
-
this.backdrop.style.webkitBackdropFilter = "";
|
|
3987
|
+
this.applyBackdropFilter(void 0);
|
|
3951
3988
|
}
|
|
3952
3989
|
}
|
|
3953
3990
|
this.releaseInteractiveListeners();
|
|
@@ -3995,20 +4032,14 @@ var OverlayEngine = class {
|
|
|
3995
4032
|
this.backdropOpacity = opacity;
|
|
3996
4033
|
if (this.isOpen_ && this.backdrop) {
|
|
3997
4034
|
this.backdrop.style.opacity = String(opacity);
|
|
4035
|
+
this.syncBackdropPointerEvents();
|
|
3998
4036
|
}
|
|
3999
4037
|
}
|
|
4000
4038
|
setBackdropFilter(filter) {
|
|
4001
4039
|
if (this.destroyed) return;
|
|
4002
4040
|
this.backdropFilter = filter;
|
|
4003
4041
|
if (!this.isOpen_ || !this.backdrop) return;
|
|
4004
|
-
|
|
4005
|
-
if (filter) {
|
|
4006
|
-
this.backdrop.style.backdropFilter = filter;
|
|
4007
|
-
style.webkitBackdropFilter = filter;
|
|
4008
|
-
} else {
|
|
4009
|
-
this.backdrop.style.backdropFilter = "";
|
|
4010
|
-
style.webkitBackdropFilter = "";
|
|
4011
|
-
}
|
|
4042
|
+
this.applyBackdropFilter(filter);
|
|
4012
4043
|
}
|
|
4013
4044
|
setSwipeToClose(config) {
|
|
4014
4045
|
if (this.destroyed) return;
|
|
@@ -4077,16 +4108,10 @@ var OverlayEngine = class {
|
|
|
4077
4108
|
if (this.isOpen_ && this.backdrop) {
|
|
4078
4109
|
if (merged.backdropOpacity !== void 0) {
|
|
4079
4110
|
this.backdrop.style.opacity = String(this.backdropOpacity);
|
|
4111
|
+
this.syncBackdropPointerEvents();
|
|
4080
4112
|
}
|
|
4081
4113
|
if (merged.backdropFilter !== void 0) {
|
|
4082
|
-
|
|
4083
|
-
if (this.backdropFilter) {
|
|
4084
|
-
this.backdrop.style.backdropFilter = this.backdropFilter;
|
|
4085
|
-
style.webkitBackdropFilter = this.backdropFilter;
|
|
4086
|
-
} else {
|
|
4087
|
-
this.backdrop.style.backdropFilter = "";
|
|
4088
|
-
style.webkitBackdropFilter = "";
|
|
4089
|
-
}
|
|
4114
|
+
this.applyBackdropFilter(this.backdropFilter);
|
|
4090
4115
|
}
|
|
4091
4116
|
}
|
|
4092
4117
|
if (opts.duration !== void 0) this.duration = opts.duration;
|
|
@@ -4221,6 +4246,21 @@ var OverlayEngine = class {
|
|
|
4221
4246
|
this.backdrop.style.pointerEvents = "none";
|
|
4222
4247
|
}
|
|
4223
4248
|
}
|
|
4249
|
+
syncBackdropPointerEvents() {
|
|
4250
|
+
if (!this.backdrop) return;
|
|
4251
|
+
this.backdrop.style.pointerEvents = this.backdropOpacity > 0 ? "auto" : "none";
|
|
4252
|
+
}
|
|
4253
|
+
applyBackdropFilter(filter) {
|
|
4254
|
+
if (!this.backdrop) return;
|
|
4255
|
+
const style = this.backdrop.style;
|
|
4256
|
+
if (filter) {
|
|
4257
|
+
this.backdrop.style.backdropFilter = filter;
|
|
4258
|
+
style.webkitBackdropFilter = filter;
|
|
4259
|
+
} else {
|
|
4260
|
+
this.backdrop.style.backdropFilter = "";
|
|
4261
|
+
style.webkitBackdropFilter = "";
|
|
4262
|
+
}
|
|
4263
|
+
}
|
|
4224
4264
|
setWillChange(on) {
|
|
4225
4265
|
this.element.style.willChange = on ? "transform, opacity" : "";
|
|
4226
4266
|
if (this.backdrop) {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { g as AnchorAnimationPreset, h as AnchorAnimationSpec, i as AnchorHandle, A as AnchorOptions, j as AnchorPosition, k as AnchorState, B as BottomSheetEngine, C as CloseReason, E as EngineState, P as Plugin, l as SCRIM_PRESETS, m as ScrimOverlayOptions, n as ScrimPreset, o as ScrimPresetConfig, p as ScrimStageDef, S as ScrimStagesOptions, q as ScrimUpdate,
|
|
1
|
+
import { e as SnapPoint, b as SheetMode, a as SnapPointDef, c as EngineOptions, f as ScrimOverlayPosition } from './BottomSheetEngine-DzsIwD28.cjs';
|
|
2
|
+
export { g as AnchorAnimationPreset, h as AnchorAnimationSpec, i as AnchorHandle, A as AnchorOptions, j as AnchorPosition, k as AnchorState, B as BottomSheetEngine, C as CloseReason, E as EngineState, P as Plugin, l as SCRIM_PRESETS, m as ScrimOverlayOptions, n as ScrimPreset, o as ScrimPresetConfig, p as ScrimStageDef, S as ScrimStagesOptions, q as ScrimUpdate, d as SheetEventMap, r as SnapId, T as TeardownScope, s as runAnchorTransition } from './BottomSheetEngine-DzsIwD28.cjs';
|
|
3
3
|
export { OVERLAY_PRESETS, Overlay, OverlayAnimation, OverlayCloseReason, OverlayEdge, Overlay as OverlayEngine, OverlayEventMap, OverlayMountTarget, OverlayOptions, OverlayPreset, OverlayState, OverlayUpdate, SwipeToCloseConfig, createOverlay } from './overlay.cjs';
|
|
4
4
|
import './transform-jVfAikE9.cjs';
|
|
5
5
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { g as AnchorAnimationPreset, h as AnchorAnimationSpec, i as AnchorHandle, A as AnchorOptions, j as AnchorPosition, k as AnchorState, B as BottomSheetEngine, C as CloseReason, E as EngineState, P as Plugin, l as SCRIM_PRESETS, m as ScrimOverlayOptions, n as ScrimPreset, o as ScrimPresetConfig, p as ScrimStageDef, S as ScrimStagesOptions, q as ScrimUpdate,
|
|
1
|
+
import { e as SnapPoint, b as SheetMode, a as SnapPointDef, c as EngineOptions, f as ScrimOverlayPosition } from './BottomSheetEngine-DRjCU73e.js';
|
|
2
|
+
export { g as AnchorAnimationPreset, h as AnchorAnimationSpec, i as AnchorHandle, A as AnchorOptions, j as AnchorPosition, k as AnchorState, B as BottomSheetEngine, C as CloseReason, E as EngineState, P as Plugin, l as SCRIM_PRESETS, m as ScrimOverlayOptions, n as ScrimPreset, o as ScrimPresetConfig, p as ScrimStageDef, S as ScrimStagesOptions, q as ScrimUpdate, d as SheetEventMap, r as SnapId, T as TeardownScope, s as runAnchorTransition } from './BottomSheetEngine-DRjCU73e.js';
|
|
3
3
|
export { OVERLAY_PRESETS, Overlay, OverlayAnimation, OverlayCloseReason, OverlayEdge, Overlay as OverlayEngine, OverlayEventMap, OverlayMountTarget, OverlayOptions, OverlayPreset, OverlayState, OverlayUpdate, SwipeToCloseConfig, createOverlay } from './overlay.js';
|
|
4
4
|
import './transform-jVfAikE9.js';
|
|
5
5
|
|