@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
|
@@ -236,6 +236,7 @@ declare class BottomSheetEngine {
|
|
|
236
236
|
private progressWriteSentinel;
|
|
237
237
|
private isTopSheet;
|
|
238
238
|
private opening;
|
|
239
|
+
private allowOvershoot;
|
|
239
240
|
private progressPayload;
|
|
240
241
|
private dragContextBuf;
|
|
241
242
|
private bus;
|
|
@@ -294,8 +295,9 @@ declare class BottomSheetEngine {
|
|
|
294
295
|
setSnapPoints(points: EngineOptions["snapPoints"], allowed?: string[]): void;
|
|
295
296
|
recompute(): void;
|
|
296
297
|
private contentTargets;
|
|
297
|
-
private
|
|
298
|
+
private measureSheetNatural;
|
|
298
299
|
private measureFitSize;
|
|
300
|
+
private containingExtent;
|
|
299
301
|
private installFitObserver;
|
|
300
302
|
destroy(): void;
|
|
301
303
|
private emit;
|
|
@@ -236,6 +236,7 @@ declare class BottomSheetEngine {
|
|
|
236
236
|
private progressWriteSentinel;
|
|
237
237
|
private isTopSheet;
|
|
238
238
|
private opening;
|
|
239
|
+
private allowOvershoot;
|
|
239
240
|
private progressPayload;
|
|
240
241
|
private dragContextBuf;
|
|
241
242
|
private bus;
|
|
@@ -294,8 +295,9 @@ declare class BottomSheetEngine {
|
|
|
294
295
|
setSnapPoints(points: EngineOptions["snapPoints"], allowed?: string[]): void;
|
|
295
296
|
recompute(): void;
|
|
296
297
|
private contentTargets;
|
|
297
|
-
private
|
|
298
|
+
private measureSheetNatural;
|
|
298
299
|
private measureFitSize;
|
|
300
|
+
private containingExtent;
|
|
299
301
|
private installFitObserver;
|
|
300
302
|
destroy(): void;
|
|
301
303
|
private emit;
|
package/dist/element.cjs
CHANGED
|
@@ -2599,6 +2599,7 @@ var init_BottomSheetEngine = __esm({
|
|
|
2599
2599
|
__publicField(this, "progressWriteSentinel", new WriteSentinel());
|
|
2600
2600
|
__publicField(this, "isTopSheet", true);
|
|
2601
2601
|
__publicField(this, "opening", false);
|
|
2602
|
+
__publicField(this, "allowOvershoot", false);
|
|
2602
2603
|
__publicField(this, "progressPayload", {
|
|
2603
2604
|
value: 0,
|
|
2604
2605
|
size: 0
|
|
@@ -3151,45 +3152,52 @@ var init_BottomSheetEngine = __esm({
|
|
|
3151
3152
|
}
|
|
3152
3153
|
return out;
|
|
3153
3154
|
}
|
|
3154
|
-
|
|
3155
|
+
measureSheetNatural(vertical) {
|
|
3156
|
+
const el = this.element;
|
|
3155
3157
|
const content = this.scrollContainer;
|
|
3156
|
-
if (!content)
|
|
3157
|
-
|
|
3158
|
-
if (targets.length === 0) {
|
|
3159
|
-
return vertical ? content.scrollHeight : content.scrollWidth;
|
|
3158
|
+
if (!content) {
|
|
3159
|
+
return vertical ? el.offsetHeight : el.offsetWidth;
|
|
3160
3160
|
}
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
if (
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
}
|
|
3181
|
-
return max - min + pad;
|
|
3161
|
+
const axis = vertical ? "height" : "width";
|
|
3162
|
+
const sheetStyle = el.style;
|
|
3163
|
+
const cs = content.style;
|
|
3164
|
+
const prevSheet = sheetStyle[axis];
|
|
3165
|
+
const prevFlex = cs.flex;
|
|
3166
|
+
const prevContent = vertical ? cs.height : cs.width;
|
|
3167
|
+
sheetStyle[axis] = "auto";
|
|
3168
|
+
cs.flex = "none";
|
|
3169
|
+
if (vertical) cs.height = "auto";
|
|
3170
|
+
else cs.width = "auto";
|
|
3171
|
+
const poked = vertical ? el.offsetHeight : el.offsetWidth;
|
|
3172
|
+
const contentBox = vertical ? content.clientHeight : content.clientWidth;
|
|
3173
|
+
const contentScroll = vertical ? content.scrollHeight : content.scrollWidth;
|
|
3174
|
+
const natural = Math.max(poked, poked - contentBox + contentScroll);
|
|
3175
|
+
sheetStyle[axis] = prevSheet;
|
|
3176
|
+
cs.flex = prevFlex;
|
|
3177
|
+
if (vertical) cs.height = prevContent;
|
|
3178
|
+
else cs.width = prevContent;
|
|
3179
|
+
return natural;
|
|
3182
3180
|
}
|
|
3183
3181
|
measureFitSize() {
|
|
3184
3182
|
const vertical = layoutAxis(this.mode) === "height";
|
|
3185
|
-
const
|
|
3186
|
-
const content = this.scrollContainer;
|
|
3187
|
-
const natural = content ? handleSize + this.measureContentExtent(vertical) : handleSize;
|
|
3183
|
+
const natural = this.measureSheetNatural(vertical);
|
|
3188
3184
|
const capped = this.maxHeightCap !== void 0 ? Math.min(natural, this.maxHeightCap) : natural;
|
|
3189
3185
|
if (typeof window === "undefined") return capped;
|
|
3190
|
-
const viewport = vertical
|
|
3186
|
+
const viewport = this.containingExtent(vertical);
|
|
3191
3187
|
return viewport > 0 ? Math.min(capped, viewport) : capped;
|
|
3192
3188
|
}
|
|
3189
|
+
// The fit cap is the sheet's containing block, not always the window: a
|
|
3190
|
+
// position:fixed sheet nested under a transform/filter/will-change ancestor
|
|
3191
|
+
// is clipped to that ancestor, so capping by window.innerHeight oversizes the
|
|
3192
|
+
// sheet and the content/footer get clipped. offsetParent resolves to that
|
|
3193
|
+
// ancestor when present, and is null (→ viewport) for a plain fixed sheet.
|
|
3194
|
+
containingExtent(vertical) {
|
|
3195
|
+
const op = this.element.offsetParent;
|
|
3196
|
+
if (op && op !== document.body && op !== document.documentElement) {
|
|
3197
|
+
return vertical ? op.clientHeight : op.clientWidth;
|
|
3198
|
+
}
|
|
3199
|
+
return vertical ? window.innerHeight : window.innerWidth;
|
|
3200
|
+
}
|
|
3193
3201
|
installFitObserver() {
|
|
3194
3202
|
if (typeof ResizeObserver === "undefined") return;
|
|
3195
3203
|
if (!this.snapPointsRaw.some((p) => p.size === "fit" || p.size === "content"))
|
|
@@ -3270,6 +3278,10 @@ var init_BottomSheetEngine = __esm({
|
|
|
3270
3278
|
this.backdrop.style.opacity = "";
|
|
3271
3279
|
this.backdrop.style.pointerEvents = "";
|
|
3272
3280
|
}
|
|
3281
|
+
if (this.anchorHost) {
|
|
3282
|
+
this.anchorHost.style.removeProperty("--bs-size");
|
|
3283
|
+
this.anchorHost.style.removeProperty("--bs-progress");
|
|
3284
|
+
}
|
|
3273
3285
|
if (this.screenComponent) {
|
|
3274
3286
|
this.screenComponent.style.opacity = "";
|
|
3275
3287
|
this.screenComponent.style.display = "";
|
|
@@ -3281,6 +3293,7 @@ var init_BottomSheetEngine = __esm({
|
|
|
3281
3293
|
this.bus.emit(event, payload);
|
|
3282
3294
|
}
|
|
3283
3295
|
newCycle() {
|
|
3296
|
+
this.allowOvershoot = false;
|
|
3284
3297
|
this.currentAbort.abort();
|
|
3285
3298
|
this.currentAbort = new AbortController();
|
|
3286
3299
|
return this.currentAbort.signal;
|
|
@@ -3346,6 +3359,7 @@ var init_BottomSheetEngine = __esm({
|
|
|
3346
3359
|
seen.add(p.id);
|
|
3347
3360
|
}
|
|
3348
3361
|
this.snaps.setRaw(this.snapPointsRaw);
|
|
3362
|
+
this.clampToMaxHeight();
|
|
3349
3363
|
this.scrim.invalidateOpacityCache();
|
|
3350
3364
|
}
|
|
3351
3365
|
getAllowedRange() {
|
|
@@ -3552,9 +3566,13 @@ var init_BottomSheetEngine = __esm({
|
|
|
3552
3566
|
this.opening = true;
|
|
3553
3567
|
sheetStack.promote(this.id);
|
|
3554
3568
|
}
|
|
3555
|
-
|
|
3556
|
-
|
|
3569
|
+
const settleCap = this.snaps.getMaxAxisSize();
|
|
3570
|
+
const settleSize = settleCap > 0 ? Math.min(target.size, settleCap) : target.size;
|
|
3571
|
+
this.allowOvershoot = true;
|
|
3572
|
+
void this.animation.animateTo(settleSize, velocity).then(() => {
|
|
3557
3573
|
if (signal.aborted) return;
|
|
3574
|
+
this.allowOvershoot = false;
|
|
3575
|
+
this.opening = false;
|
|
3558
3576
|
this.scrollCache.restore(target.id, previousSize, target.size);
|
|
3559
3577
|
this.updateAriaSlider();
|
|
3560
3578
|
this.emit("snap", {
|
|
@@ -3586,7 +3604,7 @@ var init_BottomSheetEngine = __esm({
|
|
|
3586
3604
|
}
|
|
3587
3605
|
applySize(size) {
|
|
3588
3606
|
const cap = this.snaps.getMaxAxisSize();
|
|
3589
|
-
const clamped = cap > 0 && size > cap && !this.gesture?.isDragging ? cap : size;
|
|
3607
|
+
const clamped = cap > 0 && size > cap && !this.gesture?.isDragging && !this.allowOvershoot ? cap : size;
|
|
3590
3608
|
this.size = clamped;
|
|
3591
3609
|
const offset = cap - clamped;
|
|
3592
3610
|
const style = this.element.style;
|
package/dist/element.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BottomSheetEngine, C as CloseReason, A as AnchorOptions, S as ScrimStagesOptions, E as EngineState } from './BottomSheetEngine-
|
|
1
|
+
import { B as BottomSheetEngine, C as CloseReason, A as AnchorOptions, S as ScrimStagesOptions, E as EngineState } from './BottomSheetEngine-7BDK2OWX.cjs';
|
|
2
2
|
import './transform-jVfAikE9.cjs';
|
|
3
3
|
|
|
4
4
|
declare const BaseHTMLElement: typeof HTMLElement;
|
package/dist/element.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BottomSheetEngine, C as CloseReason, A as AnchorOptions, S as ScrimStagesOptions, E as EngineState } from './BottomSheetEngine-
|
|
1
|
+
import { B as BottomSheetEngine, C as CloseReason, A as AnchorOptions, S as ScrimStagesOptions, E as EngineState } from './BottomSheetEngine-BFTb0-4Z.js';
|
|
2
2
|
import './transform-jVfAikE9.js';
|
|
3
3
|
|
|
4
4
|
declare const BaseHTMLElement: typeof HTMLElement;
|