@surdeddd/bottom-sheet 0.22.1 → 0.23.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/README.md +58 -14
- package/dist/core.cjs +13 -5
- package/dist/core.js +13 -5
- package/dist/element.cjs +43 -13
- package/dist/element.iife.global.js +2 -2
- package/dist/element.js +43 -13
- package/dist/features.cjs +28 -6
- package/dist/features.js +28 -6
- package/dist/index.cjs +41 -11
- package/dist/index.js +41 -11
- package/dist/qwik-lib/index.qwik.cjs +42 -11
- package/dist/qwik-lib/index.qwik.mjs +42 -11
- package/dist/qwik.cjs +41 -11
- package/dist/qwik.js +41 -11
- package/dist/react.cjs +41 -11
- package/dist/react.js +41 -11
- package/dist/solid.cjs +41 -11
- package/dist/solid.js +41 -11
- package/dist/solid.source.jsx +41 -11
- package/dist/styles.css +19 -2
- package/dist/svelte-core.cjs +41 -11
- package/dist/svelte-core.js +41 -11
- package/dist/svelte.cjs +41 -11
- package/dist/svelte.js +41 -11
- package/dist/vue.cjs +41 -11
- package/dist/vue.js +41 -11
- package/package.json +11 -11
package/dist/solid.js
CHANGED
|
@@ -1488,13 +1488,17 @@ var AnimationRunner = class {
|
|
|
1488
1488
|
});
|
|
1489
1489
|
let stopped = false;
|
|
1490
1490
|
let auxRaf = 0;
|
|
1491
|
-
const start = performance.now();
|
|
1492
1491
|
const lastIdx = samples.values.length - 1;
|
|
1493
1492
|
const auxTick = () => {
|
|
1494
1493
|
if (stopped) return;
|
|
1495
|
-
const
|
|
1496
|
-
|
|
1497
|
-
|
|
1494
|
+
const at = Math.min(
|
|
1495
|
+
(Number(anim.currentTime) || 0) / samples.stepMs,
|
|
1496
|
+
lastIdx
|
|
1497
|
+
);
|
|
1498
|
+
const idx = Math.floor(at);
|
|
1499
|
+
const from = samples.values[idx];
|
|
1500
|
+
const to = samples.values[Math.min(idx + 1, lastIdx)];
|
|
1501
|
+
applyAux(from + (to - from) * (at - idx));
|
|
1498
1502
|
auxRaf = requestAnimationFrame(auxTick);
|
|
1499
1503
|
};
|
|
1500
1504
|
auxRaf = requestAnimationFrame(auxTick);
|
|
@@ -2706,7 +2710,11 @@ var BottomSheetCore = class {
|
|
|
2706
2710
|
getSize: () => this.size,
|
|
2707
2711
|
isDragging: () => this.isDraggingAny(),
|
|
2708
2712
|
applyAux: (size) => this.applySize(size, true),
|
|
2709
|
-
getTransformFor: (size) =>
|
|
2713
|
+
getTransformFor: (size) => {
|
|
2714
|
+
const cap = this.snaps.getMaxAxisSize();
|
|
2715
|
+
const shown = cap > 0 && !this.allowOvershoot ? Math.min(size, cap) : size;
|
|
2716
|
+
return this.transformTemplate(cap - shown);
|
|
2717
|
+
}
|
|
2710
2718
|
},
|
|
2711
2719
|
resolved.animation
|
|
2712
2720
|
);
|
|
@@ -4238,6 +4246,9 @@ function visualViewportFeature() {
|
|
|
4238
4246
|
|
|
4239
4247
|
// src/core/features/content-fit.ts
|
|
4240
4248
|
var INSET_VAR = "--bs-content-inset";
|
|
4249
|
+
var SIZE_VAR = "--bs-size";
|
|
4250
|
+
var CAP_VAR = "--bs-max-size";
|
|
4251
|
+
var LIFT_VAR = "--bs-footer-lift-max";
|
|
4241
4252
|
var FIT_ATTR = "data-bs-fit-content";
|
|
4242
4253
|
function contentFitFeature() {
|
|
4243
4254
|
return {
|
|
@@ -4251,6 +4262,8 @@ function contentFitFeature() {
|
|
|
4251
4262
|
let inset = 0;
|
|
4252
4263
|
let unpaddedMax = -1;
|
|
4253
4264
|
let top = 0;
|
|
4265
|
+
let resting = false;
|
|
4266
|
+
const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
|
|
4254
4267
|
const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
|
|
4255
4268
|
const follow = (size) => {
|
|
4256
4269
|
if (unpaddedMax < 0) {
|
|
@@ -4266,21 +4279,36 @@ function contentFitFeature() {
|
|
|
4266
4279
|
const settle = () => {
|
|
4267
4280
|
if (ctx.isDestroyed()) return;
|
|
4268
4281
|
const size = ctx.getSize();
|
|
4269
|
-
|
|
4270
|
-
|
|
4282
|
+
if (!resting) {
|
|
4283
|
+
unpaddedMax = -1;
|
|
4284
|
+
follow(size);
|
|
4285
|
+
}
|
|
4271
4286
|
inset = hiddenAt(size);
|
|
4272
|
-
|
|
4287
|
+
put(INSET_VAR, inset);
|
|
4288
|
+
put(SIZE_VAR, size);
|
|
4289
|
+
put(CAP_VAR, ctx.getMaxAxisSize());
|
|
4290
|
+
if (!resting) {
|
|
4291
|
+
resting = true;
|
|
4292
|
+
sheet.setAttribute(FIT_ATTR, "rest");
|
|
4293
|
+
}
|
|
4273
4294
|
unpaddedMax = -1;
|
|
4274
4295
|
};
|
|
4296
|
+
const move = (size) => {
|
|
4297
|
+
if (resting) {
|
|
4298
|
+
resting = false;
|
|
4299
|
+
sheet.setAttribute(FIT_ATTR, "moving");
|
|
4300
|
+
put(LIFT_VAR, scroller.offsetHeight);
|
|
4301
|
+
}
|
|
4302
|
+
follow(size);
|
|
4303
|
+
};
|
|
4275
4304
|
const moving = () => ctx.isAnimating() || ctx.isDragging();
|
|
4276
4305
|
const whenIdle = () => {
|
|
4277
4306
|
if (!moving()) settle();
|
|
4278
4307
|
};
|
|
4279
|
-
sheet.setAttribute(FIT_ATTR, "");
|
|
4280
4308
|
settle();
|
|
4281
4309
|
const offProgress = ctx.on(
|
|
4282
4310
|
"progress",
|
|
4283
|
-
(p) => moving() ?
|
|
4311
|
+
(p) => moving() ? move(p.size) : settle()
|
|
4284
4312
|
);
|
|
4285
4313
|
const offSnap = ctx.on("snap", settle);
|
|
4286
4314
|
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
|
|
@@ -4292,7 +4320,9 @@ function contentFitFeature() {
|
|
|
4292
4320
|
observer?.disconnect();
|
|
4293
4321
|
window.removeEventListener("orientationchange", whenIdle);
|
|
4294
4322
|
sheet.removeAttribute(FIT_ATTR);
|
|
4295
|
-
|
|
4323
|
+
for (const name of [INSET_VAR, CAP_VAR, LIFT_VAR]) {
|
|
4324
|
+
sheet.style.removeProperty(name);
|
|
4325
|
+
}
|
|
4296
4326
|
};
|
|
4297
4327
|
}
|
|
4298
4328
|
};
|
package/dist/solid.source.jsx
CHANGED
|
@@ -1491,13 +1491,17 @@ var AnimationRunner = class {
|
|
|
1491
1491
|
});
|
|
1492
1492
|
let stopped = false;
|
|
1493
1493
|
let auxRaf = 0;
|
|
1494
|
-
const start = performance.now();
|
|
1495
1494
|
const lastIdx = samples.values.length - 1;
|
|
1496
1495
|
const auxTick = () => {
|
|
1497
1496
|
if (stopped) return;
|
|
1498
|
-
const
|
|
1499
|
-
|
|
1500
|
-
|
|
1497
|
+
const at = Math.min(
|
|
1498
|
+
(Number(anim.currentTime) || 0) / samples.stepMs,
|
|
1499
|
+
lastIdx
|
|
1500
|
+
);
|
|
1501
|
+
const idx = Math.floor(at);
|
|
1502
|
+
const from = samples.values[idx];
|
|
1503
|
+
const to = samples.values[Math.min(idx + 1, lastIdx)];
|
|
1504
|
+
applyAux(from + (to - from) * (at - idx));
|
|
1501
1505
|
auxRaf = requestAnimationFrame(auxTick);
|
|
1502
1506
|
};
|
|
1503
1507
|
auxRaf = requestAnimationFrame(auxTick);
|
|
@@ -2708,7 +2712,11 @@ var BottomSheetCore = class {
|
|
|
2708
2712
|
getSize: () => this.size,
|
|
2709
2713
|
isDragging: () => this.isDraggingAny(),
|
|
2710
2714
|
applyAux: (size) => this.applySize(size, true),
|
|
2711
|
-
getTransformFor: (size) =>
|
|
2715
|
+
getTransformFor: (size) => {
|
|
2716
|
+
const cap = this.snaps.getMaxAxisSize();
|
|
2717
|
+
const shown = cap > 0 && !this.allowOvershoot ? Math.min(size, cap) : size;
|
|
2718
|
+
return this.transformTemplate(cap - shown);
|
|
2719
|
+
}
|
|
2712
2720
|
},
|
|
2713
2721
|
resolved.animation
|
|
2714
2722
|
);
|
|
@@ -4240,6 +4248,9 @@ function visualViewportFeature() {
|
|
|
4240
4248
|
|
|
4241
4249
|
// src/core/features/content-fit.ts
|
|
4242
4250
|
var INSET_VAR = "--bs-content-inset";
|
|
4251
|
+
var SIZE_VAR = "--bs-size";
|
|
4252
|
+
var CAP_VAR = "--bs-max-size";
|
|
4253
|
+
var LIFT_VAR = "--bs-footer-lift-max";
|
|
4243
4254
|
var FIT_ATTR = "data-bs-fit-content";
|
|
4244
4255
|
function contentFitFeature() {
|
|
4245
4256
|
return {
|
|
@@ -4253,6 +4264,8 @@ function contentFitFeature() {
|
|
|
4253
4264
|
let inset = 0;
|
|
4254
4265
|
let unpaddedMax = -1;
|
|
4255
4266
|
let top = 0;
|
|
4267
|
+
let resting = false;
|
|
4268
|
+
const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
|
|
4256
4269
|
const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
|
|
4257
4270
|
const follow = (size) => {
|
|
4258
4271
|
if (unpaddedMax < 0) {
|
|
@@ -4268,21 +4281,36 @@ function contentFitFeature() {
|
|
|
4268
4281
|
const settle = () => {
|
|
4269
4282
|
if (ctx.isDestroyed()) return;
|
|
4270
4283
|
const size = ctx.getSize();
|
|
4271
|
-
|
|
4272
|
-
|
|
4284
|
+
if (!resting) {
|
|
4285
|
+
unpaddedMax = -1;
|
|
4286
|
+
follow(size);
|
|
4287
|
+
}
|
|
4273
4288
|
inset = hiddenAt(size);
|
|
4274
|
-
|
|
4289
|
+
put(INSET_VAR, inset);
|
|
4290
|
+
put(SIZE_VAR, size);
|
|
4291
|
+
put(CAP_VAR, ctx.getMaxAxisSize());
|
|
4292
|
+
if (!resting) {
|
|
4293
|
+
resting = true;
|
|
4294
|
+
sheet.setAttribute(FIT_ATTR, "rest");
|
|
4295
|
+
}
|
|
4275
4296
|
unpaddedMax = -1;
|
|
4276
4297
|
};
|
|
4298
|
+
const move = (size) => {
|
|
4299
|
+
if (resting) {
|
|
4300
|
+
resting = false;
|
|
4301
|
+
sheet.setAttribute(FIT_ATTR, "moving");
|
|
4302
|
+
put(LIFT_VAR, scroller.offsetHeight);
|
|
4303
|
+
}
|
|
4304
|
+
follow(size);
|
|
4305
|
+
};
|
|
4277
4306
|
const moving = () => ctx.isAnimating() || ctx.isDragging();
|
|
4278
4307
|
const whenIdle = () => {
|
|
4279
4308
|
if (!moving()) settle();
|
|
4280
4309
|
};
|
|
4281
|
-
sheet.setAttribute(FIT_ATTR, "");
|
|
4282
4310
|
settle();
|
|
4283
4311
|
const offProgress = ctx.on(
|
|
4284
4312
|
"progress",
|
|
4285
|
-
(p) => moving() ?
|
|
4313
|
+
(p) => moving() ? move(p.size) : settle()
|
|
4286
4314
|
);
|
|
4287
4315
|
const offSnap = ctx.on("snap", settle);
|
|
4288
4316
|
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
|
|
@@ -4294,7 +4322,9 @@ function contentFitFeature() {
|
|
|
4294
4322
|
observer?.disconnect();
|
|
4295
4323
|
window.removeEventListener("orientationchange", whenIdle);
|
|
4296
4324
|
sheet.removeAttribute(FIT_ATTR);
|
|
4297
|
-
|
|
4325
|
+
for (const name of [INSET_VAR, CAP_VAR, LIFT_VAR]) {
|
|
4326
|
+
sheet.style.removeProperty(name);
|
|
4327
|
+
}
|
|
4298
4328
|
};
|
|
4299
4329
|
}
|
|
4300
4330
|
};
|
package/dist/styles.css
CHANGED
|
@@ -280,17 +280,24 @@
|
|
|
280
280
|
padding: var(--bs-content-padding, 0 16px 16px);
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
.bs-sheet[data-bs-fit-content] .bs-content
|
|
283
|
+
.bs-sheet[data-bs-fit-content="moving"] .bs-content,
|
|
284
|
+
.bs-sheet[data-bs-fit-content][data-bs-webgl="on"] .bs-content {
|
|
284
285
|
scroll-padding-bottom: var(--bs-content-inset, 0px);
|
|
285
286
|
}
|
|
286
287
|
|
|
287
|
-
.bs-sheet[data-bs-fit-content] .bs-content::after
|
|
288
|
+
.bs-sheet[data-bs-fit-content="moving"] .bs-content::after,
|
|
289
|
+
.bs-sheet[data-bs-fit-content][data-bs-webgl="on"] .bs-content::after {
|
|
288
290
|
content: "";
|
|
289
291
|
display: block;
|
|
290
292
|
flex: none;
|
|
291
293
|
height: var(--bs-content-inset, 0px);
|
|
292
294
|
}
|
|
293
295
|
|
|
296
|
+
.bs-sheet[data-bs-fit-content="rest"][data-mode="bottom"]:not([data-bs-webgl="on"])::after {
|
|
297
|
+
content: "";
|
|
298
|
+
flex: 0 1 max(0px, var(--bs-max-size, 0px) - var(--bs-size, 0px));
|
|
299
|
+
}
|
|
300
|
+
|
|
294
301
|
.bs-footer {
|
|
295
302
|
flex: 0 0 auto;
|
|
296
303
|
padding: var(--bs-footer-padding, 12px 16px calc(12px + env(safe-area-inset-bottom)));
|
|
@@ -298,6 +305,16 @@
|
|
|
298
305
|
background: var(--bs-surface, var(--bs-surface-d));
|
|
299
306
|
}
|
|
300
307
|
|
|
308
|
+
.bs-sheet[data-bs-fit-content="moving"][data-mode="bottom"]:not([data-bs-webgl="on"]) .bs-footer {
|
|
309
|
+
transform: translateY(
|
|
310
|
+
clamp(
|
|
311
|
+
calc(-1 * var(--bs-footer-lift-max, 0px)),
|
|
312
|
+
calc(var(--bs-size, 0px) - var(--bs-max-size, 0px)),
|
|
313
|
+
0px
|
|
314
|
+
)
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
|
|
301
318
|
.bs-sheet[data-mode="bottom"]:has(.bs-footer:not([hidden]):has(*)) {
|
|
302
319
|
padding-bottom: 0;
|
|
303
320
|
}
|
package/dist/svelte-core.cjs
CHANGED
|
@@ -1489,13 +1489,17 @@ var AnimationRunner = class {
|
|
|
1489
1489
|
});
|
|
1490
1490
|
let stopped = false;
|
|
1491
1491
|
let auxRaf = 0;
|
|
1492
|
-
const start = performance.now();
|
|
1493
1492
|
const lastIdx = samples.values.length - 1;
|
|
1494
1493
|
const auxTick = () => {
|
|
1495
1494
|
if (stopped) return;
|
|
1496
|
-
const
|
|
1497
|
-
|
|
1498
|
-
|
|
1495
|
+
const at = Math.min(
|
|
1496
|
+
(Number(anim.currentTime) || 0) / samples.stepMs,
|
|
1497
|
+
lastIdx
|
|
1498
|
+
);
|
|
1499
|
+
const idx = Math.floor(at);
|
|
1500
|
+
const from = samples.values[idx];
|
|
1501
|
+
const to = samples.values[Math.min(idx + 1, lastIdx)];
|
|
1502
|
+
applyAux(from + (to - from) * (at - idx));
|
|
1499
1503
|
auxRaf = requestAnimationFrame(auxTick);
|
|
1500
1504
|
};
|
|
1501
1505
|
auxRaf = requestAnimationFrame(auxTick);
|
|
@@ -2707,7 +2711,11 @@ var BottomSheetCore = class {
|
|
|
2707
2711
|
getSize: () => this.size,
|
|
2708
2712
|
isDragging: () => this.isDraggingAny(),
|
|
2709
2713
|
applyAux: (size) => this.applySize(size, true),
|
|
2710
|
-
getTransformFor: (size) =>
|
|
2714
|
+
getTransformFor: (size) => {
|
|
2715
|
+
const cap = this.snaps.getMaxAxisSize();
|
|
2716
|
+
const shown = cap > 0 && !this.allowOvershoot ? Math.min(size, cap) : size;
|
|
2717
|
+
return this.transformTemplate(cap - shown);
|
|
2718
|
+
}
|
|
2711
2719
|
},
|
|
2712
2720
|
resolved.animation
|
|
2713
2721
|
);
|
|
@@ -4239,6 +4247,9 @@ function visualViewportFeature() {
|
|
|
4239
4247
|
|
|
4240
4248
|
// src/core/features/content-fit.ts
|
|
4241
4249
|
var INSET_VAR = "--bs-content-inset";
|
|
4250
|
+
var SIZE_VAR = "--bs-size";
|
|
4251
|
+
var CAP_VAR = "--bs-max-size";
|
|
4252
|
+
var LIFT_VAR = "--bs-footer-lift-max";
|
|
4242
4253
|
var FIT_ATTR = "data-bs-fit-content";
|
|
4243
4254
|
function contentFitFeature() {
|
|
4244
4255
|
return {
|
|
@@ -4252,6 +4263,8 @@ function contentFitFeature() {
|
|
|
4252
4263
|
let inset = 0;
|
|
4253
4264
|
let unpaddedMax = -1;
|
|
4254
4265
|
let top = 0;
|
|
4266
|
+
let resting = false;
|
|
4267
|
+
const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
|
|
4255
4268
|
const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
|
|
4256
4269
|
const follow = (size) => {
|
|
4257
4270
|
if (unpaddedMax < 0) {
|
|
@@ -4267,21 +4280,36 @@ function contentFitFeature() {
|
|
|
4267
4280
|
const settle = () => {
|
|
4268
4281
|
if (ctx.isDestroyed()) return;
|
|
4269
4282
|
const size = ctx.getSize();
|
|
4270
|
-
|
|
4271
|
-
|
|
4283
|
+
if (!resting) {
|
|
4284
|
+
unpaddedMax = -1;
|
|
4285
|
+
follow(size);
|
|
4286
|
+
}
|
|
4272
4287
|
inset = hiddenAt(size);
|
|
4273
|
-
|
|
4288
|
+
put(INSET_VAR, inset);
|
|
4289
|
+
put(SIZE_VAR, size);
|
|
4290
|
+
put(CAP_VAR, ctx.getMaxAxisSize());
|
|
4291
|
+
if (!resting) {
|
|
4292
|
+
resting = true;
|
|
4293
|
+
sheet.setAttribute(FIT_ATTR, "rest");
|
|
4294
|
+
}
|
|
4274
4295
|
unpaddedMax = -1;
|
|
4275
4296
|
};
|
|
4297
|
+
const move = (size) => {
|
|
4298
|
+
if (resting) {
|
|
4299
|
+
resting = false;
|
|
4300
|
+
sheet.setAttribute(FIT_ATTR, "moving");
|
|
4301
|
+
put(LIFT_VAR, scroller.offsetHeight);
|
|
4302
|
+
}
|
|
4303
|
+
follow(size);
|
|
4304
|
+
};
|
|
4276
4305
|
const moving = () => ctx.isAnimating() || ctx.isDragging();
|
|
4277
4306
|
const whenIdle = () => {
|
|
4278
4307
|
if (!moving()) settle();
|
|
4279
4308
|
};
|
|
4280
|
-
sheet.setAttribute(FIT_ATTR, "");
|
|
4281
4309
|
settle();
|
|
4282
4310
|
const offProgress = ctx.on(
|
|
4283
4311
|
"progress",
|
|
4284
|
-
(p) => moving() ?
|
|
4312
|
+
(p) => moving() ? move(p.size) : settle()
|
|
4285
4313
|
);
|
|
4286
4314
|
const offSnap = ctx.on("snap", settle);
|
|
4287
4315
|
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
|
|
@@ -4293,7 +4321,9 @@ function contentFitFeature() {
|
|
|
4293
4321
|
observer?.disconnect();
|
|
4294
4322
|
window.removeEventListener("orientationchange", whenIdle);
|
|
4295
4323
|
sheet.removeAttribute(FIT_ATTR);
|
|
4296
|
-
|
|
4324
|
+
for (const name of [INSET_VAR, CAP_VAR, LIFT_VAR]) {
|
|
4325
|
+
sheet.style.removeProperty(name);
|
|
4326
|
+
}
|
|
4297
4327
|
};
|
|
4298
4328
|
}
|
|
4299
4329
|
};
|
package/dist/svelte-core.js
CHANGED
|
@@ -1487,13 +1487,17 @@ var AnimationRunner = class {
|
|
|
1487
1487
|
});
|
|
1488
1488
|
let stopped = false;
|
|
1489
1489
|
let auxRaf = 0;
|
|
1490
|
-
const start = performance.now();
|
|
1491
1490
|
const lastIdx = samples.values.length - 1;
|
|
1492
1491
|
const auxTick = () => {
|
|
1493
1492
|
if (stopped) return;
|
|
1494
|
-
const
|
|
1495
|
-
|
|
1496
|
-
|
|
1493
|
+
const at = Math.min(
|
|
1494
|
+
(Number(anim.currentTime) || 0) / samples.stepMs,
|
|
1495
|
+
lastIdx
|
|
1496
|
+
);
|
|
1497
|
+
const idx = Math.floor(at);
|
|
1498
|
+
const from = samples.values[idx];
|
|
1499
|
+
const to = samples.values[Math.min(idx + 1, lastIdx)];
|
|
1500
|
+
applyAux(from + (to - from) * (at - idx));
|
|
1497
1501
|
auxRaf = requestAnimationFrame(auxTick);
|
|
1498
1502
|
};
|
|
1499
1503
|
auxRaf = requestAnimationFrame(auxTick);
|
|
@@ -2705,7 +2709,11 @@ var BottomSheetCore = class {
|
|
|
2705
2709
|
getSize: () => this.size,
|
|
2706
2710
|
isDragging: () => this.isDraggingAny(),
|
|
2707
2711
|
applyAux: (size) => this.applySize(size, true),
|
|
2708
|
-
getTransformFor: (size) =>
|
|
2712
|
+
getTransformFor: (size) => {
|
|
2713
|
+
const cap = this.snaps.getMaxAxisSize();
|
|
2714
|
+
const shown = cap > 0 && !this.allowOvershoot ? Math.min(size, cap) : size;
|
|
2715
|
+
return this.transformTemplate(cap - shown);
|
|
2716
|
+
}
|
|
2709
2717
|
},
|
|
2710
2718
|
resolved.animation
|
|
2711
2719
|
);
|
|
@@ -4237,6 +4245,9 @@ function visualViewportFeature() {
|
|
|
4237
4245
|
|
|
4238
4246
|
// src/core/features/content-fit.ts
|
|
4239
4247
|
var INSET_VAR = "--bs-content-inset";
|
|
4248
|
+
var SIZE_VAR = "--bs-size";
|
|
4249
|
+
var CAP_VAR = "--bs-max-size";
|
|
4250
|
+
var LIFT_VAR = "--bs-footer-lift-max";
|
|
4240
4251
|
var FIT_ATTR = "data-bs-fit-content";
|
|
4241
4252
|
function contentFitFeature() {
|
|
4242
4253
|
return {
|
|
@@ -4250,6 +4261,8 @@ function contentFitFeature() {
|
|
|
4250
4261
|
let inset = 0;
|
|
4251
4262
|
let unpaddedMax = -1;
|
|
4252
4263
|
let top = 0;
|
|
4264
|
+
let resting = false;
|
|
4265
|
+
const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
|
|
4253
4266
|
const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
|
|
4254
4267
|
const follow = (size) => {
|
|
4255
4268
|
if (unpaddedMax < 0) {
|
|
@@ -4265,21 +4278,36 @@ function contentFitFeature() {
|
|
|
4265
4278
|
const settle = () => {
|
|
4266
4279
|
if (ctx.isDestroyed()) return;
|
|
4267
4280
|
const size = ctx.getSize();
|
|
4268
|
-
|
|
4269
|
-
|
|
4281
|
+
if (!resting) {
|
|
4282
|
+
unpaddedMax = -1;
|
|
4283
|
+
follow(size);
|
|
4284
|
+
}
|
|
4270
4285
|
inset = hiddenAt(size);
|
|
4271
|
-
|
|
4286
|
+
put(INSET_VAR, inset);
|
|
4287
|
+
put(SIZE_VAR, size);
|
|
4288
|
+
put(CAP_VAR, ctx.getMaxAxisSize());
|
|
4289
|
+
if (!resting) {
|
|
4290
|
+
resting = true;
|
|
4291
|
+
sheet.setAttribute(FIT_ATTR, "rest");
|
|
4292
|
+
}
|
|
4272
4293
|
unpaddedMax = -1;
|
|
4273
4294
|
};
|
|
4295
|
+
const move = (size) => {
|
|
4296
|
+
if (resting) {
|
|
4297
|
+
resting = false;
|
|
4298
|
+
sheet.setAttribute(FIT_ATTR, "moving");
|
|
4299
|
+
put(LIFT_VAR, scroller.offsetHeight);
|
|
4300
|
+
}
|
|
4301
|
+
follow(size);
|
|
4302
|
+
};
|
|
4274
4303
|
const moving = () => ctx.isAnimating() || ctx.isDragging();
|
|
4275
4304
|
const whenIdle = () => {
|
|
4276
4305
|
if (!moving()) settle();
|
|
4277
4306
|
};
|
|
4278
|
-
sheet.setAttribute(FIT_ATTR, "");
|
|
4279
4307
|
settle();
|
|
4280
4308
|
const offProgress = ctx.on(
|
|
4281
4309
|
"progress",
|
|
4282
|
-
(p) => moving() ?
|
|
4310
|
+
(p) => moving() ? move(p.size) : settle()
|
|
4283
4311
|
);
|
|
4284
4312
|
const offSnap = ctx.on("snap", settle);
|
|
4285
4313
|
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
|
|
@@ -4291,7 +4319,9 @@ function contentFitFeature() {
|
|
|
4291
4319
|
observer?.disconnect();
|
|
4292
4320
|
window.removeEventListener("orientationchange", whenIdle);
|
|
4293
4321
|
sheet.removeAttribute(FIT_ATTR);
|
|
4294
|
-
|
|
4322
|
+
for (const name of [INSET_VAR, CAP_VAR, LIFT_VAR]) {
|
|
4323
|
+
sheet.style.removeProperty(name);
|
|
4324
|
+
}
|
|
4295
4325
|
};
|
|
4296
4326
|
}
|
|
4297
4327
|
};
|
package/dist/svelte.cjs
CHANGED
|
@@ -1511,13 +1511,17 @@ var AnimationRunner = class {
|
|
|
1511
1511
|
});
|
|
1512
1512
|
let stopped = false;
|
|
1513
1513
|
let auxRaf = 0;
|
|
1514
|
-
const start = performance.now();
|
|
1515
1514
|
const lastIdx = samples.values.length - 1;
|
|
1516
1515
|
const auxTick = () => {
|
|
1517
1516
|
if (stopped) return;
|
|
1518
|
-
const
|
|
1519
|
-
|
|
1520
|
-
|
|
1517
|
+
const at = Math.min(
|
|
1518
|
+
(Number(anim.currentTime) || 0) / samples.stepMs,
|
|
1519
|
+
lastIdx
|
|
1520
|
+
);
|
|
1521
|
+
const idx = Math.floor(at);
|
|
1522
|
+
const from = samples.values[idx];
|
|
1523
|
+
const to = samples.values[Math.min(idx + 1, lastIdx)];
|
|
1524
|
+
applyAux(from + (to - from) * (at - idx));
|
|
1521
1525
|
auxRaf = requestAnimationFrame(auxTick);
|
|
1522
1526
|
};
|
|
1523
1527
|
auxRaf = requestAnimationFrame(auxTick);
|
|
@@ -2729,7 +2733,11 @@ var BottomSheetCore = class {
|
|
|
2729
2733
|
getSize: () => this.size,
|
|
2730
2734
|
isDragging: () => this.isDraggingAny(),
|
|
2731
2735
|
applyAux: (size) => this.applySize(size, true),
|
|
2732
|
-
getTransformFor: (size) =>
|
|
2736
|
+
getTransformFor: (size) => {
|
|
2737
|
+
const cap = this.snaps.getMaxAxisSize();
|
|
2738
|
+
const shown = cap > 0 && !this.allowOvershoot ? Math.min(size, cap) : size;
|
|
2739
|
+
return this.transformTemplate(cap - shown);
|
|
2740
|
+
}
|
|
2733
2741
|
},
|
|
2734
2742
|
resolved.animation
|
|
2735
2743
|
);
|
|
@@ -4261,6 +4269,9 @@ function visualViewportFeature() {
|
|
|
4261
4269
|
|
|
4262
4270
|
// src/core/features/content-fit.ts
|
|
4263
4271
|
var INSET_VAR = "--bs-content-inset";
|
|
4272
|
+
var SIZE_VAR = "--bs-size";
|
|
4273
|
+
var CAP_VAR = "--bs-max-size";
|
|
4274
|
+
var LIFT_VAR = "--bs-footer-lift-max";
|
|
4264
4275
|
var FIT_ATTR = "data-bs-fit-content";
|
|
4265
4276
|
function contentFitFeature() {
|
|
4266
4277
|
return {
|
|
@@ -4274,6 +4285,8 @@ function contentFitFeature() {
|
|
|
4274
4285
|
let inset = 0;
|
|
4275
4286
|
let unpaddedMax = -1;
|
|
4276
4287
|
let top = 0;
|
|
4288
|
+
let resting = false;
|
|
4289
|
+
const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
|
|
4277
4290
|
const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
|
|
4278
4291
|
const follow = (size) => {
|
|
4279
4292
|
if (unpaddedMax < 0) {
|
|
@@ -4289,21 +4302,36 @@ function contentFitFeature() {
|
|
|
4289
4302
|
const settle = () => {
|
|
4290
4303
|
if (ctx.isDestroyed()) return;
|
|
4291
4304
|
const size = ctx.getSize();
|
|
4292
|
-
|
|
4293
|
-
|
|
4305
|
+
if (!resting) {
|
|
4306
|
+
unpaddedMax = -1;
|
|
4307
|
+
follow(size);
|
|
4308
|
+
}
|
|
4294
4309
|
inset = hiddenAt(size);
|
|
4295
|
-
|
|
4310
|
+
put(INSET_VAR, inset);
|
|
4311
|
+
put(SIZE_VAR, size);
|
|
4312
|
+
put(CAP_VAR, ctx.getMaxAxisSize());
|
|
4313
|
+
if (!resting) {
|
|
4314
|
+
resting = true;
|
|
4315
|
+
sheet.setAttribute(FIT_ATTR, "rest");
|
|
4316
|
+
}
|
|
4296
4317
|
unpaddedMax = -1;
|
|
4297
4318
|
};
|
|
4319
|
+
const move = (size) => {
|
|
4320
|
+
if (resting) {
|
|
4321
|
+
resting = false;
|
|
4322
|
+
sheet.setAttribute(FIT_ATTR, "moving");
|
|
4323
|
+
put(LIFT_VAR, scroller.offsetHeight);
|
|
4324
|
+
}
|
|
4325
|
+
follow(size);
|
|
4326
|
+
};
|
|
4298
4327
|
const moving = () => ctx.isAnimating() || ctx.isDragging();
|
|
4299
4328
|
const whenIdle = () => {
|
|
4300
4329
|
if (!moving()) settle();
|
|
4301
4330
|
};
|
|
4302
|
-
sheet.setAttribute(FIT_ATTR, "");
|
|
4303
4331
|
settle();
|
|
4304
4332
|
const offProgress = ctx.on(
|
|
4305
4333
|
"progress",
|
|
4306
|
-
(p) => moving() ?
|
|
4334
|
+
(p) => moving() ? move(p.size) : settle()
|
|
4307
4335
|
);
|
|
4308
4336
|
const offSnap = ctx.on("snap", settle);
|
|
4309
4337
|
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
|
|
@@ -4315,7 +4343,9 @@ function contentFitFeature() {
|
|
|
4315
4343
|
observer?.disconnect();
|
|
4316
4344
|
window.removeEventListener("orientationchange", whenIdle);
|
|
4317
4345
|
sheet.removeAttribute(FIT_ATTR);
|
|
4318
|
-
|
|
4346
|
+
for (const name of [INSET_VAR, CAP_VAR, LIFT_VAR]) {
|
|
4347
|
+
sheet.style.removeProperty(name);
|
|
4348
|
+
}
|
|
4319
4349
|
};
|
|
4320
4350
|
}
|
|
4321
4351
|
};
|
package/dist/svelte.js
CHANGED
|
@@ -1489,13 +1489,17 @@ var AnimationRunner = class {
|
|
|
1489
1489
|
});
|
|
1490
1490
|
let stopped = false;
|
|
1491
1491
|
let auxRaf = 0;
|
|
1492
|
-
const start = performance.now();
|
|
1493
1492
|
const lastIdx = samples.values.length - 1;
|
|
1494
1493
|
const auxTick = () => {
|
|
1495
1494
|
if (stopped) return;
|
|
1496
|
-
const
|
|
1497
|
-
|
|
1498
|
-
|
|
1495
|
+
const at = Math.min(
|
|
1496
|
+
(Number(anim.currentTime) || 0) / samples.stepMs,
|
|
1497
|
+
lastIdx
|
|
1498
|
+
);
|
|
1499
|
+
const idx = Math.floor(at);
|
|
1500
|
+
const from = samples.values[idx];
|
|
1501
|
+
const to = samples.values[Math.min(idx + 1, lastIdx)];
|
|
1502
|
+
applyAux(from + (to - from) * (at - idx));
|
|
1499
1503
|
auxRaf = requestAnimationFrame(auxTick);
|
|
1500
1504
|
};
|
|
1501
1505
|
auxRaf = requestAnimationFrame(auxTick);
|
|
@@ -2707,7 +2711,11 @@ var BottomSheetCore = class {
|
|
|
2707
2711
|
getSize: () => this.size,
|
|
2708
2712
|
isDragging: () => this.isDraggingAny(),
|
|
2709
2713
|
applyAux: (size) => this.applySize(size, true),
|
|
2710
|
-
getTransformFor: (size) =>
|
|
2714
|
+
getTransformFor: (size) => {
|
|
2715
|
+
const cap = this.snaps.getMaxAxisSize();
|
|
2716
|
+
const shown = cap > 0 && !this.allowOvershoot ? Math.min(size, cap) : size;
|
|
2717
|
+
return this.transformTemplate(cap - shown);
|
|
2718
|
+
}
|
|
2711
2719
|
},
|
|
2712
2720
|
resolved.animation
|
|
2713
2721
|
);
|
|
@@ -4239,6 +4247,9 @@ function visualViewportFeature() {
|
|
|
4239
4247
|
|
|
4240
4248
|
// src/core/features/content-fit.ts
|
|
4241
4249
|
var INSET_VAR = "--bs-content-inset";
|
|
4250
|
+
var SIZE_VAR = "--bs-size";
|
|
4251
|
+
var CAP_VAR = "--bs-max-size";
|
|
4252
|
+
var LIFT_VAR = "--bs-footer-lift-max";
|
|
4242
4253
|
var FIT_ATTR = "data-bs-fit-content";
|
|
4243
4254
|
function contentFitFeature() {
|
|
4244
4255
|
return {
|
|
@@ -4252,6 +4263,8 @@ function contentFitFeature() {
|
|
|
4252
4263
|
let inset = 0;
|
|
4253
4264
|
let unpaddedMax = -1;
|
|
4254
4265
|
let top = 0;
|
|
4266
|
+
let resting = false;
|
|
4267
|
+
const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
|
|
4255
4268
|
const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
|
|
4256
4269
|
const follow = (size) => {
|
|
4257
4270
|
if (unpaddedMax < 0) {
|
|
@@ -4267,21 +4280,36 @@ function contentFitFeature() {
|
|
|
4267
4280
|
const settle = () => {
|
|
4268
4281
|
if (ctx.isDestroyed()) return;
|
|
4269
4282
|
const size = ctx.getSize();
|
|
4270
|
-
|
|
4271
|
-
|
|
4283
|
+
if (!resting) {
|
|
4284
|
+
unpaddedMax = -1;
|
|
4285
|
+
follow(size);
|
|
4286
|
+
}
|
|
4272
4287
|
inset = hiddenAt(size);
|
|
4273
|
-
|
|
4288
|
+
put(INSET_VAR, inset);
|
|
4289
|
+
put(SIZE_VAR, size);
|
|
4290
|
+
put(CAP_VAR, ctx.getMaxAxisSize());
|
|
4291
|
+
if (!resting) {
|
|
4292
|
+
resting = true;
|
|
4293
|
+
sheet.setAttribute(FIT_ATTR, "rest");
|
|
4294
|
+
}
|
|
4274
4295
|
unpaddedMax = -1;
|
|
4275
4296
|
};
|
|
4297
|
+
const move = (size) => {
|
|
4298
|
+
if (resting) {
|
|
4299
|
+
resting = false;
|
|
4300
|
+
sheet.setAttribute(FIT_ATTR, "moving");
|
|
4301
|
+
put(LIFT_VAR, scroller.offsetHeight);
|
|
4302
|
+
}
|
|
4303
|
+
follow(size);
|
|
4304
|
+
};
|
|
4276
4305
|
const moving = () => ctx.isAnimating() || ctx.isDragging();
|
|
4277
4306
|
const whenIdle = () => {
|
|
4278
4307
|
if (!moving()) settle();
|
|
4279
4308
|
};
|
|
4280
|
-
sheet.setAttribute(FIT_ATTR, "");
|
|
4281
4309
|
settle();
|
|
4282
4310
|
const offProgress = ctx.on(
|
|
4283
4311
|
"progress",
|
|
4284
|
-
(p) => moving() ?
|
|
4312
|
+
(p) => moving() ? move(p.size) : settle()
|
|
4285
4313
|
);
|
|
4286
4314
|
const offSnap = ctx.on("snap", settle);
|
|
4287
4315
|
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
|
|
@@ -4293,7 +4321,9 @@ function contentFitFeature() {
|
|
|
4293
4321
|
observer?.disconnect();
|
|
4294
4322
|
window.removeEventListener("orientationchange", whenIdle);
|
|
4295
4323
|
sheet.removeAttribute(FIT_ATTR);
|
|
4296
|
-
|
|
4324
|
+
for (const name of [INSET_VAR, CAP_VAR, LIFT_VAR]) {
|
|
4325
|
+
sheet.style.removeProperty(name);
|
|
4326
|
+
}
|
|
4297
4327
|
};
|
|
4298
4328
|
}
|
|
4299
4329
|
};
|