@surdeddd/bottom-sheet 0.7.0 → 0.8.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/dist/{BottomSheetEngine-CqiCz64W.d.cts → BottomSheetEngine-7BDK2OWX.d.cts} +3 -1
- package/dist/{BottomSheetEngine-BHjKFtnM.d.ts → BottomSheetEngine-BFTb0-4Z.d.ts} +3 -1
- package/dist/element.cjs +51 -33
- 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 +51 -33
- package/dist/index.cjs +52 -34
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +52 -34
- 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 +1 -1
- package/dist/preact.d.ts +1 -1
- package/dist/qwik.cjs +79 -36
- package/dist/qwik.d.cts +8 -3
- package/dist/qwik.d.ts +8 -3
- package/dist/qwik.js +79 -36
- package/dist/react.cjs +64 -34
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +64 -34
- package/dist/solid.cjs +59 -36
- package/dist/solid.d.cts +8 -1
- package/dist/solid.d.ts +8 -1
- package/dist/solid.js +59 -36
- package/dist/solid.source.jsx +59 -36
- package/dist/svelte-core.cjs +52 -34
- package/dist/svelte-core.js +52 -34
- package/dist/svelte-src/BottomSheet.svelte +3 -10
- package/dist/svelte.cjs +61 -55
- package/dist/svelte.js +61 -55
- package/dist/vue.cjs +52 -50
- package/dist/vue.js +52 -50
- package/package.json +1 -1
package/dist/svelte-core.cjs
CHANGED
|
@@ -2359,6 +2359,7 @@ var BottomSheetEngine = class {
|
|
|
2359
2359
|
__publicField(this, "progressWriteSentinel", new WriteSentinel());
|
|
2360
2360
|
__publicField(this, "isTopSheet", true);
|
|
2361
2361
|
__publicField(this, "opening", false);
|
|
2362
|
+
__publicField(this, "allowOvershoot", false);
|
|
2362
2363
|
__publicField(this, "progressPayload", {
|
|
2363
2364
|
value: 0,
|
|
2364
2365
|
size: 0
|
|
@@ -2911,45 +2912,52 @@ var BottomSheetEngine = class {
|
|
|
2911
2912
|
}
|
|
2912
2913
|
return out;
|
|
2913
2914
|
}
|
|
2914
|
-
|
|
2915
|
+
measureSheetNatural(vertical) {
|
|
2916
|
+
const el = this.element;
|
|
2915
2917
|
const content = this.scrollContainer;
|
|
2916
|
-
if (!content)
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
const cs = getComputedStyle(content);
|
|
2939
|
-
pad = vertical ? (parseFloat(cs.paddingTop) || 0) + (parseFloat(cs.paddingBottom) || 0) : (parseFloat(cs.paddingLeft) || 0) + (parseFloat(cs.paddingRight) || 0);
|
|
2940
|
-
}
|
|
2941
|
-
return max - min + pad;
|
|
2918
|
+
if (!content) {
|
|
2919
|
+
return vertical ? el.offsetHeight : el.offsetWidth;
|
|
2920
|
+
}
|
|
2921
|
+
const axis = vertical ? "height" : "width";
|
|
2922
|
+
const sheetStyle = el.style;
|
|
2923
|
+
const cs = content.style;
|
|
2924
|
+
const prevSheet = sheetStyle[axis];
|
|
2925
|
+
const prevFlex = cs.flex;
|
|
2926
|
+
const prevContent = vertical ? cs.height : cs.width;
|
|
2927
|
+
sheetStyle[axis] = "auto";
|
|
2928
|
+
cs.flex = "none";
|
|
2929
|
+
if (vertical) cs.height = "auto";
|
|
2930
|
+
else cs.width = "auto";
|
|
2931
|
+
const poked = vertical ? el.offsetHeight : el.offsetWidth;
|
|
2932
|
+
const contentBox = vertical ? content.clientHeight : content.clientWidth;
|
|
2933
|
+
const contentScroll = vertical ? content.scrollHeight : content.scrollWidth;
|
|
2934
|
+
const natural = Math.max(poked, poked - contentBox + contentScroll);
|
|
2935
|
+
sheetStyle[axis] = prevSheet;
|
|
2936
|
+
cs.flex = prevFlex;
|
|
2937
|
+
if (vertical) cs.height = prevContent;
|
|
2938
|
+
else cs.width = prevContent;
|
|
2939
|
+
return natural;
|
|
2942
2940
|
}
|
|
2943
2941
|
measureFitSize() {
|
|
2944
2942
|
const vertical = layoutAxis(this.mode) === "height";
|
|
2945
|
-
const
|
|
2946
|
-
const content = this.scrollContainer;
|
|
2947
|
-
const natural = content ? handleSize + this.measureContentExtent(vertical) : handleSize;
|
|
2943
|
+
const natural = this.measureSheetNatural(vertical);
|
|
2948
2944
|
const capped = this.maxHeightCap !== void 0 ? Math.min(natural, this.maxHeightCap) : natural;
|
|
2949
2945
|
if (typeof window === "undefined") return capped;
|
|
2950
|
-
const viewport = vertical
|
|
2946
|
+
const viewport = this.containingExtent(vertical);
|
|
2951
2947
|
return viewport > 0 ? Math.min(capped, viewport) : capped;
|
|
2952
2948
|
}
|
|
2949
|
+
// The fit cap is the sheet's containing block, not always the window: a
|
|
2950
|
+
// position:fixed sheet nested under a transform/filter/will-change ancestor
|
|
2951
|
+
// is clipped to that ancestor, so capping by window.innerHeight oversizes the
|
|
2952
|
+
// sheet and the content/footer get clipped. offsetParent resolves to that
|
|
2953
|
+
// ancestor when present, and is null (→ viewport) for a plain fixed sheet.
|
|
2954
|
+
containingExtent(vertical) {
|
|
2955
|
+
const op = this.element.offsetParent;
|
|
2956
|
+
if (op && op !== document.body && op !== document.documentElement) {
|
|
2957
|
+
return vertical ? op.clientHeight : op.clientWidth;
|
|
2958
|
+
}
|
|
2959
|
+
return vertical ? window.innerHeight : window.innerWidth;
|
|
2960
|
+
}
|
|
2953
2961
|
installFitObserver() {
|
|
2954
2962
|
if (typeof ResizeObserver === "undefined") return;
|
|
2955
2963
|
if (!this.snapPointsRaw.some((p) => p.size === "fit" || p.size === "content"))
|
|
@@ -3030,6 +3038,10 @@ var BottomSheetEngine = class {
|
|
|
3030
3038
|
this.backdrop.style.opacity = "";
|
|
3031
3039
|
this.backdrop.style.pointerEvents = "";
|
|
3032
3040
|
}
|
|
3041
|
+
if (this.anchorHost) {
|
|
3042
|
+
this.anchorHost.style.removeProperty("--bs-size");
|
|
3043
|
+
this.anchorHost.style.removeProperty("--bs-progress");
|
|
3044
|
+
}
|
|
3033
3045
|
if (this.screenComponent) {
|
|
3034
3046
|
this.screenComponent.style.opacity = "";
|
|
3035
3047
|
this.screenComponent.style.display = "";
|
|
@@ -3041,6 +3053,7 @@ var BottomSheetEngine = class {
|
|
|
3041
3053
|
this.bus.emit(event, payload);
|
|
3042
3054
|
}
|
|
3043
3055
|
newCycle() {
|
|
3056
|
+
this.allowOvershoot = false;
|
|
3044
3057
|
this.currentAbort.abort();
|
|
3045
3058
|
this.currentAbort = new AbortController();
|
|
3046
3059
|
return this.currentAbort.signal;
|
|
@@ -3106,6 +3119,7 @@ var BottomSheetEngine = class {
|
|
|
3106
3119
|
seen.add(p.id);
|
|
3107
3120
|
}
|
|
3108
3121
|
this.snaps.setRaw(this.snapPointsRaw);
|
|
3122
|
+
this.clampToMaxHeight();
|
|
3109
3123
|
this.scrim.invalidateOpacityCache();
|
|
3110
3124
|
}
|
|
3111
3125
|
getAllowedRange() {
|
|
@@ -3312,9 +3326,13 @@ var BottomSheetEngine = class {
|
|
|
3312
3326
|
this.opening = true;
|
|
3313
3327
|
sheetStack.promote(this.id);
|
|
3314
3328
|
}
|
|
3315
|
-
|
|
3316
|
-
|
|
3329
|
+
const settleCap = this.snaps.getMaxAxisSize();
|
|
3330
|
+
const settleSize = settleCap > 0 ? Math.min(target.size, settleCap) : target.size;
|
|
3331
|
+
this.allowOvershoot = true;
|
|
3332
|
+
void this.animation.animateTo(settleSize, velocity).then(() => {
|
|
3317
3333
|
if (signal.aborted) return;
|
|
3334
|
+
this.allowOvershoot = false;
|
|
3335
|
+
this.opening = false;
|
|
3318
3336
|
this.scrollCache.restore(target.id, previousSize, target.size);
|
|
3319
3337
|
this.updateAriaSlider();
|
|
3320
3338
|
this.emit("snap", {
|
|
@@ -3346,7 +3364,7 @@ var BottomSheetEngine = class {
|
|
|
3346
3364
|
}
|
|
3347
3365
|
applySize(size) {
|
|
3348
3366
|
const cap = this.snaps.getMaxAxisSize();
|
|
3349
|
-
const clamped = cap > 0 && size > cap && !this.gesture?.isDragging ? cap : size;
|
|
3367
|
+
const clamped = cap > 0 && size > cap && !this.gesture?.isDragging && !this.allowOvershoot ? cap : size;
|
|
3350
3368
|
this.size = clamped;
|
|
3351
3369
|
const offset = cap - clamped;
|
|
3352
3370
|
const style = this.element.style;
|
package/dist/svelte-core.js
CHANGED
|
@@ -2357,6 +2357,7 @@ var BottomSheetEngine = class {
|
|
|
2357
2357
|
__publicField(this, "progressWriteSentinel", new WriteSentinel());
|
|
2358
2358
|
__publicField(this, "isTopSheet", true);
|
|
2359
2359
|
__publicField(this, "opening", false);
|
|
2360
|
+
__publicField(this, "allowOvershoot", false);
|
|
2360
2361
|
__publicField(this, "progressPayload", {
|
|
2361
2362
|
value: 0,
|
|
2362
2363
|
size: 0
|
|
@@ -2909,45 +2910,52 @@ var BottomSheetEngine = class {
|
|
|
2909
2910
|
}
|
|
2910
2911
|
return out;
|
|
2911
2912
|
}
|
|
2912
|
-
|
|
2913
|
+
measureSheetNatural(vertical) {
|
|
2914
|
+
const el = this.element;
|
|
2913
2915
|
const content = this.scrollContainer;
|
|
2914
|
-
if (!content)
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
const cs = getComputedStyle(content);
|
|
2937
|
-
pad = vertical ? (parseFloat(cs.paddingTop) || 0) + (parseFloat(cs.paddingBottom) || 0) : (parseFloat(cs.paddingLeft) || 0) + (parseFloat(cs.paddingRight) || 0);
|
|
2938
|
-
}
|
|
2939
|
-
return max - min + pad;
|
|
2916
|
+
if (!content) {
|
|
2917
|
+
return vertical ? el.offsetHeight : el.offsetWidth;
|
|
2918
|
+
}
|
|
2919
|
+
const axis = vertical ? "height" : "width";
|
|
2920
|
+
const sheetStyle = el.style;
|
|
2921
|
+
const cs = content.style;
|
|
2922
|
+
const prevSheet = sheetStyle[axis];
|
|
2923
|
+
const prevFlex = cs.flex;
|
|
2924
|
+
const prevContent = vertical ? cs.height : cs.width;
|
|
2925
|
+
sheetStyle[axis] = "auto";
|
|
2926
|
+
cs.flex = "none";
|
|
2927
|
+
if (vertical) cs.height = "auto";
|
|
2928
|
+
else cs.width = "auto";
|
|
2929
|
+
const poked = vertical ? el.offsetHeight : el.offsetWidth;
|
|
2930
|
+
const contentBox = vertical ? content.clientHeight : content.clientWidth;
|
|
2931
|
+
const contentScroll = vertical ? content.scrollHeight : content.scrollWidth;
|
|
2932
|
+
const natural = Math.max(poked, poked - contentBox + contentScroll);
|
|
2933
|
+
sheetStyle[axis] = prevSheet;
|
|
2934
|
+
cs.flex = prevFlex;
|
|
2935
|
+
if (vertical) cs.height = prevContent;
|
|
2936
|
+
else cs.width = prevContent;
|
|
2937
|
+
return natural;
|
|
2940
2938
|
}
|
|
2941
2939
|
measureFitSize() {
|
|
2942
2940
|
const vertical = layoutAxis(this.mode) === "height";
|
|
2943
|
-
const
|
|
2944
|
-
const content = this.scrollContainer;
|
|
2945
|
-
const natural = content ? handleSize + this.measureContentExtent(vertical) : handleSize;
|
|
2941
|
+
const natural = this.measureSheetNatural(vertical);
|
|
2946
2942
|
const capped = this.maxHeightCap !== void 0 ? Math.min(natural, this.maxHeightCap) : natural;
|
|
2947
2943
|
if (typeof window === "undefined") return capped;
|
|
2948
|
-
const viewport = vertical
|
|
2944
|
+
const viewport = this.containingExtent(vertical);
|
|
2949
2945
|
return viewport > 0 ? Math.min(capped, viewport) : capped;
|
|
2950
2946
|
}
|
|
2947
|
+
// The fit cap is the sheet's containing block, not always the window: a
|
|
2948
|
+
// position:fixed sheet nested under a transform/filter/will-change ancestor
|
|
2949
|
+
// is clipped to that ancestor, so capping by window.innerHeight oversizes the
|
|
2950
|
+
// sheet and the content/footer get clipped. offsetParent resolves to that
|
|
2951
|
+
// ancestor when present, and is null (→ viewport) for a plain fixed sheet.
|
|
2952
|
+
containingExtent(vertical) {
|
|
2953
|
+
const op = this.element.offsetParent;
|
|
2954
|
+
if (op && op !== document.body && op !== document.documentElement) {
|
|
2955
|
+
return vertical ? op.clientHeight : op.clientWidth;
|
|
2956
|
+
}
|
|
2957
|
+
return vertical ? window.innerHeight : window.innerWidth;
|
|
2958
|
+
}
|
|
2951
2959
|
installFitObserver() {
|
|
2952
2960
|
if (typeof ResizeObserver === "undefined") return;
|
|
2953
2961
|
if (!this.snapPointsRaw.some((p) => p.size === "fit" || p.size === "content"))
|
|
@@ -3028,6 +3036,10 @@ var BottomSheetEngine = class {
|
|
|
3028
3036
|
this.backdrop.style.opacity = "";
|
|
3029
3037
|
this.backdrop.style.pointerEvents = "";
|
|
3030
3038
|
}
|
|
3039
|
+
if (this.anchorHost) {
|
|
3040
|
+
this.anchorHost.style.removeProperty("--bs-size");
|
|
3041
|
+
this.anchorHost.style.removeProperty("--bs-progress");
|
|
3042
|
+
}
|
|
3031
3043
|
if (this.screenComponent) {
|
|
3032
3044
|
this.screenComponent.style.opacity = "";
|
|
3033
3045
|
this.screenComponent.style.display = "";
|
|
@@ -3039,6 +3051,7 @@ var BottomSheetEngine = class {
|
|
|
3039
3051
|
this.bus.emit(event, payload);
|
|
3040
3052
|
}
|
|
3041
3053
|
newCycle() {
|
|
3054
|
+
this.allowOvershoot = false;
|
|
3042
3055
|
this.currentAbort.abort();
|
|
3043
3056
|
this.currentAbort = new AbortController();
|
|
3044
3057
|
return this.currentAbort.signal;
|
|
@@ -3104,6 +3117,7 @@ var BottomSheetEngine = class {
|
|
|
3104
3117
|
seen.add(p.id);
|
|
3105
3118
|
}
|
|
3106
3119
|
this.snaps.setRaw(this.snapPointsRaw);
|
|
3120
|
+
this.clampToMaxHeight();
|
|
3107
3121
|
this.scrim.invalidateOpacityCache();
|
|
3108
3122
|
}
|
|
3109
3123
|
getAllowedRange() {
|
|
@@ -3310,9 +3324,13 @@ var BottomSheetEngine = class {
|
|
|
3310
3324
|
this.opening = true;
|
|
3311
3325
|
sheetStack.promote(this.id);
|
|
3312
3326
|
}
|
|
3313
|
-
|
|
3314
|
-
|
|
3327
|
+
const settleCap = this.snaps.getMaxAxisSize();
|
|
3328
|
+
const settleSize = settleCap > 0 ? Math.min(target.size, settleCap) : target.size;
|
|
3329
|
+
this.allowOvershoot = true;
|
|
3330
|
+
void this.animation.animateTo(settleSize, velocity).then(() => {
|
|
3315
3331
|
if (signal.aborted) return;
|
|
3332
|
+
this.allowOvershoot = false;
|
|
3333
|
+
this.opening = false;
|
|
3316
3334
|
this.scrollCache.restore(target.id, previousSize, target.size);
|
|
3317
3335
|
this.updateAriaSlider();
|
|
3318
3336
|
this.emit("snap", {
|
|
@@ -3344,7 +3362,7 @@ var BottomSheetEngine = class {
|
|
|
3344
3362
|
}
|
|
3345
3363
|
applySize(size) {
|
|
3346
3364
|
const cap = this.snaps.getMaxAxisSize();
|
|
3347
|
-
const clamped = cap > 0 && size > cap && !this.gesture?.isDragging ? cap : size;
|
|
3365
|
+
const clamped = cap > 0 && size > cap && !this.gesture?.isDragging && !this.allowOvershoot ? cap : size;
|
|
3348
3366
|
this.size = clamped;
|
|
3349
3367
|
const offset = cap - clamped;
|
|
3350
3368
|
const style = this.element.style;
|
|
@@ -238,12 +238,6 @@
|
|
|
238
238
|
else if (!next && isOpen) void engine.close();
|
|
239
239
|
});
|
|
240
240
|
|
|
241
|
-
let allowedIds = $derived(
|
|
242
|
-
allowed && allowed.length > 0
|
|
243
|
-
? allowed
|
|
244
|
-
: snapPoints.map(s => s.id),
|
|
245
|
-
);
|
|
246
|
-
let activeIdx = $derived(allowedIds.indexOf(viewState.activeId));
|
|
247
241
|
let isVerticalAxis = $derived(mode === "bottom" || mode === "top");
|
|
248
242
|
</script>
|
|
249
243
|
|
|
@@ -282,10 +276,9 @@
|
|
|
282
276
|
tabindex="0"
|
|
283
277
|
aria-label="Resize sheet"
|
|
284
278
|
aria-orientation={isVerticalAxis ? "vertical" : "horizontal"}
|
|
285
|
-
aria-valuemin=
|
|
286
|
-
aria-valuemax=
|
|
287
|
-
aria-valuenow=
|
|
288
|
-
aria-valuetext={viewState.activeId}
|
|
279
|
+
aria-valuemin="0"
|
|
280
|
+
aria-valuemax="0"
|
|
281
|
+
aria-valuenow="0"
|
|
289
282
|
></div>
|
|
290
283
|
{#if header}<div class="bs-header">{@render header(viewState)}</div>{/if}
|
|
291
284
|
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
|
package/dist/svelte.cjs
CHANGED
|
@@ -2381,6 +2381,7 @@ var BottomSheetEngine = class {
|
|
|
2381
2381
|
__publicField(this, "progressWriteSentinel", new WriteSentinel());
|
|
2382
2382
|
__publicField(this, "isTopSheet", true);
|
|
2383
2383
|
__publicField(this, "opening", false);
|
|
2384
|
+
__publicField(this, "allowOvershoot", false);
|
|
2384
2385
|
__publicField(this, "progressPayload", {
|
|
2385
2386
|
value: 0,
|
|
2386
2387
|
size: 0
|
|
@@ -2933,45 +2934,52 @@ var BottomSheetEngine = class {
|
|
|
2933
2934
|
}
|
|
2934
2935
|
return out;
|
|
2935
2936
|
}
|
|
2936
|
-
|
|
2937
|
+
measureSheetNatural(vertical) {
|
|
2938
|
+
const el = this.element;
|
|
2937
2939
|
const content = this.scrollContainer;
|
|
2938
|
-
if (!content)
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
const cs = getComputedStyle(content);
|
|
2961
|
-
pad = vertical ? (parseFloat(cs.paddingTop) || 0) + (parseFloat(cs.paddingBottom) || 0) : (parseFloat(cs.paddingLeft) || 0) + (parseFloat(cs.paddingRight) || 0);
|
|
2962
|
-
}
|
|
2963
|
-
return max - min + pad;
|
|
2940
|
+
if (!content) {
|
|
2941
|
+
return vertical ? el.offsetHeight : el.offsetWidth;
|
|
2942
|
+
}
|
|
2943
|
+
const axis = vertical ? "height" : "width";
|
|
2944
|
+
const sheetStyle = el.style;
|
|
2945
|
+
const cs = content.style;
|
|
2946
|
+
const prevSheet = sheetStyle[axis];
|
|
2947
|
+
const prevFlex = cs.flex;
|
|
2948
|
+
const prevContent = vertical ? cs.height : cs.width;
|
|
2949
|
+
sheetStyle[axis] = "auto";
|
|
2950
|
+
cs.flex = "none";
|
|
2951
|
+
if (vertical) cs.height = "auto";
|
|
2952
|
+
else cs.width = "auto";
|
|
2953
|
+
const poked = vertical ? el.offsetHeight : el.offsetWidth;
|
|
2954
|
+
const contentBox = vertical ? content.clientHeight : content.clientWidth;
|
|
2955
|
+
const contentScroll = vertical ? content.scrollHeight : content.scrollWidth;
|
|
2956
|
+
const natural = Math.max(poked, poked - contentBox + contentScroll);
|
|
2957
|
+
sheetStyle[axis] = prevSheet;
|
|
2958
|
+
cs.flex = prevFlex;
|
|
2959
|
+
if (vertical) cs.height = prevContent;
|
|
2960
|
+
else cs.width = prevContent;
|
|
2961
|
+
return natural;
|
|
2964
2962
|
}
|
|
2965
2963
|
measureFitSize() {
|
|
2966
2964
|
const vertical = layoutAxis(this.mode) === "height";
|
|
2967
|
-
const
|
|
2968
|
-
const content = this.scrollContainer;
|
|
2969
|
-
const natural = content ? handleSize + this.measureContentExtent(vertical) : handleSize;
|
|
2965
|
+
const natural = this.measureSheetNatural(vertical);
|
|
2970
2966
|
const capped = this.maxHeightCap !== void 0 ? Math.min(natural, this.maxHeightCap) : natural;
|
|
2971
2967
|
if (typeof window === "undefined") return capped;
|
|
2972
|
-
const viewport = vertical
|
|
2968
|
+
const viewport = this.containingExtent(vertical);
|
|
2973
2969
|
return viewport > 0 ? Math.min(capped, viewport) : capped;
|
|
2974
2970
|
}
|
|
2971
|
+
// The fit cap is the sheet's containing block, not always the window: a
|
|
2972
|
+
// position:fixed sheet nested under a transform/filter/will-change ancestor
|
|
2973
|
+
// is clipped to that ancestor, so capping by window.innerHeight oversizes the
|
|
2974
|
+
// sheet and the content/footer get clipped. offsetParent resolves to that
|
|
2975
|
+
// ancestor when present, and is null (→ viewport) for a plain fixed sheet.
|
|
2976
|
+
containingExtent(vertical) {
|
|
2977
|
+
const op = this.element.offsetParent;
|
|
2978
|
+
if (op && op !== document.body && op !== document.documentElement) {
|
|
2979
|
+
return vertical ? op.clientHeight : op.clientWidth;
|
|
2980
|
+
}
|
|
2981
|
+
return vertical ? window.innerHeight : window.innerWidth;
|
|
2982
|
+
}
|
|
2975
2983
|
installFitObserver() {
|
|
2976
2984
|
if (typeof ResizeObserver === "undefined") return;
|
|
2977
2985
|
if (!this.snapPointsRaw.some((p) => p.size === "fit" || p.size === "content"))
|
|
@@ -3052,6 +3060,10 @@ var BottomSheetEngine = class {
|
|
|
3052
3060
|
this.backdrop.style.opacity = "";
|
|
3053
3061
|
this.backdrop.style.pointerEvents = "";
|
|
3054
3062
|
}
|
|
3063
|
+
if (this.anchorHost) {
|
|
3064
|
+
this.anchorHost.style.removeProperty("--bs-size");
|
|
3065
|
+
this.anchorHost.style.removeProperty("--bs-progress");
|
|
3066
|
+
}
|
|
3055
3067
|
if (this.screenComponent) {
|
|
3056
3068
|
this.screenComponent.style.opacity = "";
|
|
3057
3069
|
this.screenComponent.style.display = "";
|
|
@@ -3063,6 +3075,7 @@ var BottomSheetEngine = class {
|
|
|
3063
3075
|
this.bus.emit(event, payload);
|
|
3064
3076
|
}
|
|
3065
3077
|
newCycle() {
|
|
3078
|
+
this.allowOvershoot = false;
|
|
3066
3079
|
this.currentAbort.abort();
|
|
3067
3080
|
this.currentAbort = new AbortController();
|
|
3068
3081
|
return this.currentAbort.signal;
|
|
@@ -3128,6 +3141,7 @@ var BottomSheetEngine = class {
|
|
|
3128
3141
|
seen.add(p.id);
|
|
3129
3142
|
}
|
|
3130
3143
|
this.snaps.setRaw(this.snapPointsRaw);
|
|
3144
|
+
this.clampToMaxHeight();
|
|
3131
3145
|
this.scrim.invalidateOpacityCache();
|
|
3132
3146
|
}
|
|
3133
3147
|
getAllowedRange() {
|
|
@@ -3334,9 +3348,13 @@ var BottomSheetEngine = class {
|
|
|
3334
3348
|
this.opening = true;
|
|
3335
3349
|
sheetStack.promote(this.id);
|
|
3336
3350
|
}
|
|
3337
|
-
|
|
3338
|
-
|
|
3351
|
+
const settleCap = this.snaps.getMaxAxisSize();
|
|
3352
|
+
const settleSize = settleCap > 0 ? Math.min(target.size, settleCap) : target.size;
|
|
3353
|
+
this.allowOvershoot = true;
|
|
3354
|
+
void this.animation.animateTo(settleSize, velocity).then(() => {
|
|
3339
3355
|
if (signal.aborted) return;
|
|
3356
|
+
this.allowOvershoot = false;
|
|
3357
|
+
this.opening = false;
|
|
3340
3358
|
this.scrollCache.restore(target.id, previousSize, target.size);
|
|
3341
3359
|
this.updateAriaSlider();
|
|
3342
3360
|
this.emit("snap", {
|
|
@@ -3368,7 +3386,7 @@ var BottomSheetEngine = class {
|
|
|
3368
3386
|
}
|
|
3369
3387
|
applySize(size) {
|
|
3370
3388
|
const cap = this.snaps.getMaxAxisSize();
|
|
3371
|
-
const clamped = cap > 0 && size > cap && !this.gesture?.isDragging ? cap : size;
|
|
3389
|
+
const clamped = cap > 0 && size > cap && !this.gesture?.isDragging && !this.allowOvershoot ? cap : size;
|
|
3372
3390
|
this.size = clamped;
|
|
3373
3391
|
const offset = cap - clamped;
|
|
3374
3392
|
const style = this.element.style;
|
|
@@ -3574,7 +3592,7 @@ var root_3 = $2__namespace.from_html(`<div class="bs-header"><!></div>`);
|
|
|
3574
3592
|
var root_5 = $2__namespace.from_html(`<div class="bs-footer"><!></div>`);
|
|
3575
3593
|
var root_6 = $2__namespace.from_html(`<div class="bs-button-slot" data-side="left"><!></div>`);
|
|
3576
3594
|
var root_7 = $2__namespace.from_html(`<div class="bs-button-slot" data-side="right"><!></div>`);
|
|
3577
|
-
var root = $2__namespace.from_html(`<div class="bs-root"><!> <div class="bs-screen"><!></div> <section class="bs-sheet" role="dialog"><div class="bs-handle" role="slider" tabindex="0" aria-label="Resize sheet"></div> <!> <div class="bs-content" tabindex="0" role="region" aria-label="Sheet content"><!></div> <!> <span class="bs-sr-only" role="status" aria-live="polite"> </span></section> <!> <!></div>`);
|
|
3595
|
+
var root = $2__namespace.from_html(`<div class="bs-root"><!> <div class="bs-screen"><!></div> <section class="bs-sheet" role="dialog"><div class="bs-handle" role="slider" tabindex="0" aria-label="Resize sheet" aria-valuemin="0" aria-valuemax="0" aria-valuenow="0"></div> <!> <div class="bs-content" tabindex="0" role="region" aria-label="Sheet content"><!></div> <!> <span class="bs-sr-only" role="status" aria-live="polite"> </span></section> <!> <!></div>`);
|
|
3578
3596
|
function BottomSheet($$anchor, $$props) {
|
|
3579
3597
|
$2__namespace.push($$props, true);
|
|
3580
3598
|
let mode = $2__namespace.prop($$props, "mode", 3, "bottom"), animation = $2__namespace.prop($$props, "animation", 3, "spring"), focusTrap = $2__namespace.prop($$props, "focusTrap", 3, false), closeOnEscape = $2__namespace.prop($$props, "closeOnEscape", 3, true), closeOnBack = $2__namespace.prop($$props, "closeOnBack", 3, false), lockBodyScroll2 = $2__namespace.prop($$props, "lockBodyScroll", 3, true), rubberBand2 = $2__namespace.prop($$props, "rubberBand", 3, true), backdrop = $2__namespace.prop($$props, "backdrop", 3, true), closeOnBackdrop = $2__namespace.prop($$props, "closeOnBackdrop", 3, true), persistent = $2__namespace.prop($$props, "persistent", 3, false), disableClose = $2__namespace.prop($$props, "disableClose", 3, false), disableDrag = $2__namespace.prop($$props, "disableDrag", 3, false), closeOnRouteChange = $2__namespace.prop($$props, "closeOnRouteChange", 3, false), openProp = $2__namespace.prop($$props, "open", 15), snap = $2__namespace.prop($$props, "snap", 15), ariaLabel = $2__namespace.prop($$props, "ariaLabel", 3, "Bottom sheet");
|
|
@@ -3699,8 +3717,6 @@ function BottomSheet($$anchor, $$props) {
|
|
|
3699
3717
|
if (next && !isOpen) void engine.open();
|
|
3700
3718
|
else if (!next && isOpen) void engine.close();
|
|
3701
3719
|
});
|
|
3702
|
-
let allowedIds = $2__namespace.derived(() => $$props.allowed && $$props.allowed.length > 0 ? $$props.allowed : $$props.snapPoints.map((s) => s.id));
|
|
3703
|
-
let activeIdx = $2__namespace.derived(() => $2__namespace.get(allowedIds).indexOf($2__namespace.get(viewState).activeId));
|
|
3704
3720
|
let isVerticalAxis = $2__namespace.derived(() => mode() === "bottom" || mode() === "top");
|
|
3705
3721
|
var $$exports = {
|
|
3706
3722
|
snapTo,
|
|
@@ -3754,7 +3770,6 @@ function BottomSheet($$anchor, $$props) {
|
|
|
3754
3770
|
$2__namespace.bind_this(div_2, ($$value) => $2__namespace.set(screenEl, $$value), () => $2__namespace.get(screenEl));
|
|
3755
3771
|
var section = $2__namespace.sibling(div_2, 2);
|
|
3756
3772
|
var div_3 = $2__namespace.child(section);
|
|
3757
|
-
$2__namespace.set_attribute(div_3, "aria-valuemin", 0);
|
|
3758
3773
|
$2__namespace.bind_this(div_3, ($$value) => $2__namespace.set(handleEl, $$value), () => $2__namespace.get(handleEl));
|
|
3759
3774
|
var node_3 = $2__namespace.sibling(div_3, 2);
|
|
3760
3775
|
{
|
|
@@ -3831,23 +3846,14 @@ function BottomSheet($$anchor, $$props) {
|
|
|
3831
3846
|
});
|
|
3832
3847
|
}
|
|
3833
3848
|
$2__namespace.reset(div);
|
|
3834
|
-
$2__namespace.template_effect(
|
|
3835
|
-
(
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
$2__namespace.set_attribute(div_3, "aria-valuenow", $1);
|
|
3843
|
-
$2__namespace.set_attribute(div_3, "aria-valuetext", $2__namespace.get(viewState).activeId);
|
|
3844
|
-
$2__namespace.set_text(text, $2__namespace.get(viewState).activeId);
|
|
3845
|
-
},
|
|
3846
|
-
[
|
|
3847
|
-
() => Math.max(0, $2__namespace.get(allowedIds).length - 1),
|
|
3848
|
-
() => Math.max(0, $2__namespace.get(activeIdx))
|
|
3849
|
-
]
|
|
3850
|
-
);
|
|
3849
|
+
$2__namespace.template_effect(() => {
|
|
3850
|
+
$2__namespace.set_attribute(section, "data-mode", mode());
|
|
3851
|
+
$2__namespace.set_attribute(section, "data-active", $2__namespace.get(viewState).activeId);
|
|
3852
|
+
$2__namespace.set_attribute(section, "aria-modal", focusTrap() ? "true" : void 0);
|
|
3853
|
+
$2__namespace.set_attribute(section, "aria-label", ariaLabel());
|
|
3854
|
+
$2__namespace.set_attribute(div_3, "aria-orientation", $2__namespace.get(isVerticalAxis) ? "vertical" : "horizontal");
|
|
3855
|
+
$2__namespace.set_text(text, $2__namespace.get(viewState).activeId);
|
|
3856
|
+
});
|
|
3851
3857
|
$2__namespace.append($$anchor, div);
|
|
3852
3858
|
return $2__namespace.pop($$exports);
|
|
3853
3859
|
}
|