@surdeddd/bottom-sheet 0.7.0 → 0.8.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/dist/{BottomSheetEngine-CqiCz64W.d.cts → BottomSheetEngine-BD1mSExI.d.cts} +2 -1
- package/dist/{BottomSheetEngine-BHjKFtnM.d.ts → BottomSheetEngine-BDGRWa2i.d.ts} +2 -1
- package/dist/element.cjs +35 -32
- 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 +35 -32
- package/dist/index.cjs +36 -33
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +36 -33
- 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 +63 -35
- package/dist/qwik.d.cts +8 -3
- package/dist/qwik.d.ts +8 -3
- package/dist/qwik.js +63 -35
- package/dist/react.cjs +48 -33
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +48 -33
- package/dist/solid.cjs +43 -35
- package/dist/solid.d.cts +7 -1
- package/dist/solid.d.ts +7 -1
- package/dist/solid.js +43 -35
- package/dist/solid.source.jsx +43 -35
- package/dist/svelte-core.cjs +36 -33
- package/dist/svelte-core.js +36 -33
- package/dist/svelte-src/BottomSheet.svelte +0 -10
- package/dist/svelte.cjs +44 -53
- package/dist/svelte.js +44 -53
- package/dist/vue.cjs +36 -49
- package/dist/vue.js +36 -49
- 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,7 +295,7 @@ 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;
|
|
299
300
|
private installFitObserver;
|
|
300
301
|
destroy(): void;
|
|
@@ -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,7 +295,7 @@ 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;
|
|
299
300
|
private installFitObserver;
|
|
300
301
|
destroy(): void;
|
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,40 +3152,32 @@ 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 (typeof getComputedStyle !== "undefined") {
|
|
3178
|
-
const cs = getComputedStyle(content);
|
|
3179
|
-
pad = vertical ? (parseFloat(cs.paddingTop) || 0) + (parseFloat(cs.paddingBottom) || 0) : (parseFloat(cs.paddingLeft) || 0) + (parseFloat(cs.paddingRight) || 0);
|
|
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 natural = vertical ? el.offsetHeight : el.offsetWidth;
|
|
3172
|
+
sheetStyle[axis] = prevSheet;
|
|
3173
|
+
cs.flex = prevFlex;
|
|
3174
|
+
if (vertical) cs.height = prevContent;
|
|
3175
|
+
else cs.width = prevContent;
|
|
3176
|
+
return natural;
|
|
3182
3177
|
}
|
|
3183
3178
|
measureFitSize() {
|
|
3184
3179
|
const vertical = layoutAxis(this.mode) === "height";
|
|
3185
|
-
const
|
|
3186
|
-
const content = this.scrollContainer;
|
|
3187
|
-
const natural = content ? handleSize + this.measureContentExtent(vertical) : handleSize;
|
|
3180
|
+
const natural = this.measureSheetNatural(vertical);
|
|
3188
3181
|
const capped = this.maxHeightCap !== void 0 ? Math.min(natural, this.maxHeightCap) : natural;
|
|
3189
3182
|
if (typeof window === "undefined") return capped;
|
|
3190
3183
|
const viewport = vertical ? window.innerHeight : window.innerWidth;
|
|
@@ -3270,6 +3263,10 @@ var init_BottomSheetEngine = __esm({
|
|
|
3270
3263
|
this.backdrop.style.opacity = "";
|
|
3271
3264
|
this.backdrop.style.pointerEvents = "";
|
|
3272
3265
|
}
|
|
3266
|
+
if (this.anchorHost) {
|
|
3267
|
+
this.anchorHost.style.removeProperty("--bs-size");
|
|
3268
|
+
this.anchorHost.style.removeProperty("--bs-progress");
|
|
3269
|
+
}
|
|
3273
3270
|
if (this.screenComponent) {
|
|
3274
3271
|
this.screenComponent.style.opacity = "";
|
|
3275
3272
|
this.screenComponent.style.display = "";
|
|
@@ -3281,6 +3278,7 @@ var init_BottomSheetEngine = __esm({
|
|
|
3281
3278
|
this.bus.emit(event, payload);
|
|
3282
3279
|
}
|
|
3283
3280
|
newCycle() {
|
|
3281
|
+
this.allowOvershoot = false;
|
|
3284
3282
|
this.currentAbort.abort();
|
|
3285
3283
|
this.currentAbort = new AbortController();
|
|
3286
3284
|
return this.currentAbort.signal;
|
|
@@ -3346,6 +3344,7 @@ var init_BottomSheetEngine = __esm({
|
|
|
3346
3344
|
seen.add(p.id);
|
|
3347
3345
|
}
|
|
3348
3346
|
this.snaps.setRaw(this.snapPointsRaw);
|
|
3347
|
+
this.clampToMaxHeight();
|
|
3349
3348
|
this.scrim.invalidateOpacityCache();
|
|
3350
3349
|
}
|
|
3351
3350
|
getAllowedRange() {
|
|
@@ -3552,9 +3551,13 @@ var init_BottomSheetEngine = __esm({
|
|
|
3552
3551
|
this.opening = true;
|
|
3553
3552
|
sheetStack.promote(this.id);
|
|
3554
3553
|
}
|
|
3555
|
-
|
|
3556
|
-
|
|
3554
|
+
const settleCap = this.snaps.getMaxAxisSize();
|
|
3555
|
+
const settleSize = settleCap > 0 ? Math.min(target.size, settleCap) : target.size;
|
|
3556
|
+
this.allowOvershoot = true;
|
|
3557
|
+
void this.animation.animateTo(settleSize, velocity).then(() => {
|
|
3557
3558
|
if (signal.aborted) return;
|
|
3559
|
+
this.allowOvershoot = false;
|
|
3560
|
+
this.opening = false;
|
|
3558
3561
|
this.scrollCache.restore(target.id, previousSize, target.size);
|
|
3559
3562
|
this.updateAriaSlider();
|
|
3560
3563
|
this.emit("snap", {
|
|
@@ -3586,7 +3589,7 @@ var init_BottomSheetEngine = __esm({
|
|
|
3586
3589
|
}
|
|
3587
3590
|
applySize(size) {
|
|
3588
3591
|
const cap = this.snaps.getMaxAxisSize();
|
|
3589
|
-
const clamped = cap > 0 && size > cap && !this.gesture?.isDragging ? cap : size;
|
|
3592
|
+
const clamped = cap > 0 && size > cap && !this.gesture?.isDragging && !this.allowOvershoot ? cap : size;
|
|
3590
3593
|
this.size = clamped;
|
|
3591
3594
|
const offset = cap - clamped;
|
|
3592
3595
|
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-BD1mSExI.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-BDGRWa2i.js';
|
|
2
2
|
import './transform-jVfAikE9.js';
|
|
3
3
|
|
|
4
4
|
declare const BaseHTMLElement: typeof HTMLElement;
|