@surdeddd/bottom-sheet 0.22.1 → 0.23.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/react.cjs CHANGED
@@ -1497,13 +1497,17 @@ var AnimationRunner = class {
1497
1497
  });
1498
1498
  let stopped = false;
1499
1499
  let auxRaf = 0;
1500
- const start = performance.now();
1501
1500
  const lastIdx = samples.values.length - 1;
1502
1501
  const auxTick = () => {
1503
1502
  if (stopped) return;
1504
- const elapsed = performance.now() - start;
1505
- const idx = Math.min(Math.floor(elapsed / samples.stepMs), lastIdx);
1506
- applyAux(samples.values[idx]);
1503
+ const at = Math.min(
1504
+ (Number(anim.currentTime) || 0) / samples.stepMs,
1505
+ lastIdx
1506
+ );
1507
+ const idx = Math.floor(at);
1508
+ const from = samples.values[idx];
1509
+ const to = samples.values[Math.min(idx + 1, lastIdx)];
1510
+ applyAux(from + (to - from) * (at - idx));
1507
1511
  auxRaf = requestAnimationFrame(auxTick);
1508
1512
  };
1509
1513
  auxRaf = requestAnimationFrame(auxTick);
@@ -2715,7 +2719,11 @@ var BottomSheetCore = class {
2715
2719
  getSize: () => this.size,
2716
2720
  isDragging: () => this.isDraggingAny(),
2717
2721
  applyAux: (size) => this.applySize(size, true),
2718
- getTransformFor: (size) => this.transformTemplate(this.snaps.getMaxAxisSize() - size)
2722
+ getTransformFor: (size) => {
2723
+ const cap = this.snaps.getMaxAxisSize();
2724
+ const shown = cap > 0 && !this.allowOvershoot ? Math.min(size, cap) : size;
2725
+ return this.transformTemplate(cap - shown);
2726
+ }
2719
2727
  },
2720
2728
  resolved.animation
2721
2729
  );
@@ -4247,6 +4255,9 @@ function visualViewportFeature() {
4247
4255
 
4248
4256
  // src/core/features/content-fit.ts
4249
4257
  var INSET_VAR = "--bs-content-inset";
4258
+ var SIZE_VAR = "--bs-size";
4259
+ var CAP_VAR = "--bs-max-size";
4260
+ var LIFT_VAR = "--bs-footer-lift-max";
4250
4261
  var FIT_ATTR = "data-bs-fit-content";
4251
4262
  function contentFitFeature() {
4252
4263
  return {
@@ -4260,6 +4271,7 @@ function contentFitFeature() {
4260
4271
  let inset = 0;
4261
4272
  let unpaddedMax = -1;
4262
4273
  let top = 0;
4274
+ const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
4263
4275
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4264
4276
  const follow = (size) => {
4265
4277
  if (unpaddedMax < 0) {
@@ -4278,7 +4290,10 @@ function contentFitFeature() {
4278
4290
  unpaddedMax = -1;
4279
4291
  follow(size);
4280
4292
  inset = hiddenAt(size);
4281
- sheet.style.setProperty(INSET_VAR, `${inset}px`);
4293
+ put(LIFT_VAR, scroller.offsetHeight);
4294
+ put(INSET_VAR, inset);
4295
+ put(SIZE_VAR, size);
4296
+ put(CAP_VAR, ctx.getMaxAxisSize());
4282
4297
  unpaddedMax = -1;
4283
4298
  };
4284
4299
  const moving = () => ctx.isAnimating() || ctx.isDragging();
@@ -4301,7 +4316,9 @@ function contentFitFeature() {
4301
4316
  observer?.disconnect();
4302
4317
  window.removeEventListener("orientationchange", whenIdle);
4303
4318
  sheet.removeAttribute(FIT_ATTR);
4304
- sheet.style.removeProperty(INSET_VAR);
4319
+ for (const name of [INSET_VAR, CAP_VAR, LIFT_VAR]) {
4320
+ sheet.style.removeProperty(name);
4321
+ }
4305
4322
  };
4306
4323
  }
4307
4324
  };
package/dist/react.js CHANGED
@@ -1495,13 +1495,17 @@ var AnimationRunner = class {
1495
1495
  });
1496
1496
  let stopped = false;
1497
1497
  let auxRaf = 0;
1498
- const start = performance.now();
1499
1498
  const lastIdx = samples.values.length - 1;
1500
1499
  const auxTick = () => {
1501
1500
  if (stopped) return;
1502
- const elapsed = performance.now() - start;
1503
- const idx = Math.min(Math.floor(elapsed / samples.stepMs), lastIdx);
1504
- applyAux(samples.values[idx]);
1501
+ const at = Math.min(
1502
+ (Number(anim.currentTime) || 0) / samples.stepMs,
1503
+ lastIdx
1504
+ );
1505
+ const idx = Math.floor(at);
1506
+ const from = samples.values[idx];
1507
+ const to = samples.values[Math.min(idx + 1, lastIdx)];
1508
+ applyAux(from + (to - from) * (at - idx));
1505
1509
  auxRaf = requestAnimationFrame(auxTick);
1506
1510
  };
1507
1511
  auxRaf = requestAnimationFrame(auxTick);
@@ -2713,7 +2717,11 @@ var BottomSheetCore = class {
2713
2717
  getSize: () => this.size,
2714
2718
  isDragging: () => this.isDraggingAny(),
2715
2719
  applyAux: (size) => this.applySize(size, true),
2716
- getTransformFor: (size) => this.transformTemplate(this.snaps.getMaxAxisSize() - size)
2720
+ getTransformFor: (size) => {
2721
+ const cap = this.snaps.getMaxAxisSize();
2722
+ const shown = cap > 0 && !this.allowOvershoot ? Math.min(size, cap) : size;
2723
+ return this.transformTemplate(cap - shown);
2724
+ }
2717
2725
  },
2718
2726
  resolved.animation
2719
2727
  );
@@ -4245,6 +4253,9 @@ function visualViewportFeature() {
4245
4253
 
4246
4254
  // src/core/features/content-fit.ts
4247
4255
  var INSET_VAR = "--bs-content-inset";
4256
+ var SIZE_VAR = "--bs-size";
4257
+ var CAP_VAR = "--bs-max-size";
4258
+ var LIFT_VAR = "--bs-footer-lift-max";
4248
4259
  var FIT_ATTR = "data-bs-fit-content";
4249
4260
  function contentFitFeature() {
4250
4261
  return {
@@ -4258,6 +4269,7 @@ function contentFitFeature() {
4258
4269
  let inset = 0;
4259
4270
  let unpaddedMax = -1;
4260
4271
  let top = 0;
4272
+ const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
4261
4273
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4262
4274
  const follow = (size) => {
4263
4275
  if (unpaddedMax < 0) {
@@ -4276,7 +4288,10 @@ function contentFitFeature() {
4276
4288
  unpaddedMax = -1;
4277
4289
  follow(size);
4278
4290
  inset = hiddenAt(size);
4279
- sheet.style.setProperty(INSET_VAR, `${inset}px`);
4291
+ put(LIFT_VAR, scroller.offsetHeight);
4292
+ put(INSET_VAR, inset);
4293
+ put(SIZE_VAR, size);
4294
+ put(CAP_VAR, ctx.getMaxAxisSize());
4280
4295
  unpaddedMax = -1;
4281
4296
  };
4282
4297
  const moving = () => ctx.isAnimating() || ctx.isDragging();
@@ -4299,7 +4314,9 @@ function contentFitFeature() {
4299
4314
  observer?.disconnect();
4300
4315
  window.removeEventListener("orientationchange", whenIdle);
4301
4316
  sheet.removeAttribute(FIT_ATTR);
4302
- sheet.style.removeProperty(INSET_VAR);
4317
+ for (const name of [INSET_VAR, CAP_VAR, LIFT_VAR]) {
4318
+ sheet.style.removeProperty(name);
4319
+ }
4303
4320
  };
4304
4321
  }
4305
4322
  };
package/dist/solid.cjs CHANGED
@@ -1490,13 +1490,17 @@ var AnimationRunner = class {
1490
1490
  });
1491
1491
  let stopped = false;
1492
1492
  let auxRaf = 0;
1493
- const start = performance.now();
1494
1493
  const lastIdx = samples.values.length - 1;
1495
1494
  const auxTick = () => {
1496
1495
  if (stopped) return;
1497
- const elapsed = performance.now() - start;
1498
- const idx = Math.min(Math.floor(elapsed / samples.stepMs), lastIdx);
1499
- applyAux(samples.values[idx]);
1496
+ const at = Math.min(
1497
+ (Number(anim.currentTime) || 0) / samples.stepMs,
1498
+ lastIdx
1499
+ );
1500
+ const idx = Math.floor(at);
1501
+ const from = samples.values[idx];
1502
+ const to = samples.values[Math.min(idx + 1, lastIdx)];
1503
+ applyAux(from + (to - from) * (at - idx));
1500
1504
  auxRaf = requestAnimationFrame(auxTick);
1501
1505
  };
1502
1506
  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) => this.transformTemplate(this.snaps.getMaxAxisSize() - 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,7 @@ function contentFitFeature() {
4253
4264
  let inset = 0;
4254
4265
  let unpaddedMax = -1;
4255
4266
  let top = 0;
4267
+ const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
4256
4268
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4257
4269
  const follow = (size) => {
4258
4270
  if (unpaddedMax < 0) {
@@ -4271,7 +4283,10 @@ function contentFitFeature() {
4271
4283
  unpaddedMax = -1;
4272
4284
  follow(size);
4273
4285
  inset = hiddenAt(size);
4274
- sheet.style.setProperty(INSET_VAR, `${inset}px`);
4286
+ put(LIFT_VAR, scroller.offsetHeight);
4287
+ put(INSET_VAR, inset);
4288
+ put(SIZE_VAR, size);
4289
+ put(CAP_VAR, ctx.getMaxAxisSize());
4275
4290
  unpaddedMax = -1;
4276
4291
  };
4277
4292
  const moving = () => ctx.isAnimating() || ctx.isDragging();
@@ -4294,7 +4309,9 @@ function contentFitFeature() {
4294
4309
  observer?.disconnect();
4295
4310
  window.removeEventListener("orientationchange", whenIdle);
4296
4311
  sheet.removeAttribute(FIT_ATTR);
4297
- sheet.style.removeProperty(INSET_VAR);
4312
+ for (const name of [INSET_VAR, CAP_VAR, LIFT_VAR]) {
4313
+ sheet.style.removeProperty(name);
4314
+ }
4298
4315
  };
4299
4316
  }
4300
4317
  };
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 elapsed = performance.now() - start;
1496
- const idx = Math.min(Math.floor(elapsed / samples.stepMs), lastIdx);
1497
- applyAux(samples.values[idx]);
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) => this.transformTemplate(this.snaps.getMaxAxisSize() - 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,7 @@ function contentFitFeature() {
4251
4262
  let inset = 0;
4252
4263
  let unpaddedMax = -1;
4253
4264
  let top = 0;
4265
+ const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
4254
4266
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4255
4267
  const follow = (size) => {
4256
4268
  if (unpaddedMax < 0) {
@@ -4269,7 +4281,10 @@ function contentFitFeature() {
4269
4281
  unpaddedMax = -1;
4270
4282
  follow(size);
4271
4283
  inset = hiddenAt(size);
4272
- sheet.style.setProperty(INSET_VAR, `${inset}px`);
4284
+ put(LIFT_VAR, scroller.offsetHeight);
4285
+ put(INSET_VAR, inset);
4286
+ put(SIZE_VAR, size);
4287
+ put(CAP_VAR, ctx.getMaxAxisSize());
4273
4288
  unpaddedMax = -1;
4274
4289
  };
4275
4290
  const moving = () => ctx.isAnimating() || ctx.isDragging();
@@ -4292,7 +4307,9 @@ function contentFitFeature() {
4292
4307
  observer?.disconnect();
4293
4308
  window.removeEventListener("orientationchange", whenIdle);
4294
4309
  sheet.removeAttribute(FIT_ATTR);
4295
- sheet.style.removeProperty(INSET_VAR);
4310
+ for (const name of [INSET_VAR, CAP_VAR, LIFT_VAR]) {
4311
+ sheet.style.removeProperty(name);
4312
+ }
4296
4313
  };
4297
4314
  }
4298
4315
  };
@@ -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 elapsed = performance.now() - start;
1499
- const idx = Math.min(Math.floor(elapsed / samples.stepMs), lastIdx);
1500
- applyAux(samples.values[idx]);
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) => this.transformTemplate(this.snaps.getMaxAxisSize() - 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,7 @@ function contentFitFeature() {
4253
4264
  let inset = 0;
4254
4265
  let unpaddedMax = -1;
4255
4266
  let top = 0;
4267
+ const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
4256
4268
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4257
4269
  const follow = (size) => {
4258
4270
  if (unpaddedMax < 0) {
@@ -4271,7 +4283,10 @@ function contentFitFeature() {
4271
4283
  unpaddedMax = -1;
4272
4284
  follow(size);
4273
4285
  inset = hiddenAt(size);
4274
- sheet.style.setProperty(INSET_VAR, `${inset}px`);
4286
+ put(LIFT_VAR, scroller.offsetHeight);
4287
+ put(INSET_VAR, inset);
4288
+ put(SIZE_VAR, size);
4289
+ put(CAP_VAR, ctx.getMaxAxisSize());
4275
4290
  unpaddedMax = -1;
4276
4291
  };
4277
4292
  const moving = () => ctx.isAnimating() || ctx.isDragging();
@@ -4294,7 +4309,9 @@ function contentFitFeature() {
4294
4309
  observer?.disconnect();
4295
4310
  window.removeEventListener("orientationchange", whenIdle);
4296
4311
  sheet.removeAttribute(FIT_ATTR);
4297
- sheet.style.removeProperty(INSET_VAR);
4312
+ for (const name of [INSET_VAR, CAP_VAR, LIFT_VAR]) {
4313
+ sheet.style.removeProperty(name);
4314
+ }
4298
4315
  };
4299
4316
  }
4300
4317
  };
package/dist/styles.css CHANGED
@@ -298,6 +298,16 @@
298
298
  background: var(--bs-surface, var(--bs-surface-d));
299
299
  }
300
300
 
301
+ .bs-sheet[data-bs-fit-content][data-mode="bottom"]:not([data-bs-webgl="on"]) .bs-footer {
302
+ transform: translateY(
303
+ clamp(
304
+ calc(-1 * var(--bs-footer-lift-max, 0px)),
305
+ calc(var(--bs-size, 0px) - var(--bs-max-size, 0px)),
306
+ 0px
307
+ )
308
+ );
309
+ }
310
+
301
311
  .bs-sheet[data-mode="bottom"]:has(.bs-footer:not([hidden]):has(*)) {
302
312
  padding-bottom: 0;
303
313
  }
@@ -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 elapsed = performance.now() - start;
1497
- const idx = Math.min(Math.floor(elapsed / samples.stepMs), lastIdx);
1498
- applyAux(samples.values[idx]);
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) => this.transformTemplate(this.snaps.getMaxAxisSize() - 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,7 @@ function contentFitFeature() {
4252
4263
  let inset = 0;
4253
4264
  let unpaddedMax = -1;
4254
4265
  let top = 0;
4266
+ const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
4255
4267
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4256
4268
  const follow = (size) => {
4257
4269
  if (unpaddedMax < 0) {
@@ -4270,7 +4282,10 @@ function contentFitFeature() {
4270
4282
  unpaddedMax = -1;
4271
4283
  follow(size);
4272
4284
  inset = hiddenAt(size);
4273
- sheet.style.setProperty(INSET_VAR, `${inset}px`);
4285
+ put(LIFT_VAR, scroller.offsetHeight);
4286
+ put(INSET_VAR, inset);
4287
+ put(SIZE_VAR, size);
4288
+ put(CAP_VAR, ctx.getMaxAxisSize());
4274
4289
  unpaddedMax = -1;
4275
4290
  };
4276
4291
  const moving = () => ctx.isAnimating() || ctx.isDragging();
@@ -4293,7 +4308,9 @@ function contentFitFeature() {
4293
4308
  observer?.disconnect();
4294
4309
  window.removeEventListener("orientationchange", whenIdle);
4295
4310
  sheet.removeAttribute(FIT_ATTR);
4296
- sheet.style.removeProperty(INSET_VAR);
4311
+ for (const name of [INSET_VAR, CAP_VAR, LIFT_VAR]) {
4312
+ sheet.style.removeProperty(name);
4313
+ }
4297
4314
  };
4298
4315
  }
4299
4316
  };
@@ -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 elapsed = performance.now() - start;
1495
- const idx = Math.min(Math.floor(elapsed / samples.stepMs), lastIdx);
1496
- applyAux(samples.values[idx]);
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) => this.transformTemplate(this.snaps.getMaxAxisSize() - 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,7 @@ function contentFitFeature() {
4250
4261
  let inset = 0;
4251
4262
  let unpaddedMax = -1;
4252
4263
  let top = 0;
4264
+ const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
4253
4265
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4254
4266
  const follow = (size) => {
4255
4267
  if (unpaddedMax < 0) {
@@ -4268,7 +4280,10 @@ function contentFitFeature() {
4268
4280
  unpaddedMax = -1;
4269
4281
  follow(size);
4270
4282
  inset = hiddenAt(size);
4271
- sheet.style.setProperty(INSET_VAR, `${inset}px`);
4283
+ put(LIFT_VAR, scroller.offsetHeight);
4284
+ put(INSET_VAR, inset);
4285
+ put(SIZE_VAR, size);
4286
+ put(CAP_VAR, ctx.getMaxAxisSize());
4272
4287
  unpaddedMax = -1;
4273
4288
  };
4274
4289
  const moving = () => ctx.isAnimating() || ctx.isDragging();
@@ -4291,7 +4306,9 @@ function contentFitFeature() {
4291
4306
  observer?.disconnect();
4292
4307
  window.removeEventListener("orientationchange", whenIdle);
4293
4308
  sheet.removeAttribute(FIT_ATTR);
4294
- sheet.style.removeProperty(INSET_VAR);
4309
+ for (const name of [INSET_VAR, CAP_VAR, LIFT_VAR]) {
4310
+ sheet.style.removeProperty(name);
4311
+ }
4295
4312
  };
4296
4313
  }
4297
4314
  };
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 elapsed = performance.now() - start;
1519
- const idx = Math.min(Math.floor(elapsed / samples.stepMs), lastIdx);
1520
- applyAux(samples.values[idx]);
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) => this.transformTemplate(this.snaps.getMaxAxisSize() - 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,7 @@ function contentFitFeature() {
4274
4285
  let inset = 0;
4275
4286
  let unpaddedMax = -1;
4276
4287
  let top = 0;
4288
+ const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
4277
4289
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4278
4290
  const follow = (size) => {
4279
4291
  if (unpaddedMax < 0) {
@@ -4292,7 +4304,10 @@ function contentFitFeature() {
4292
4304
  unpaddedMax = -1;
4293
4305
  follow(size);
4294
4306
  inset = hiddenAt(size);
4295
- sheet.style.setProperty(INSET_VAR, `${inset}px`);
4307
+ put(LIFT_VAR, scroller.offsetHeight);
4308
+ put(INSET_VAR, inset);
4309
+ put(SIZE_VAR, size);
4310
+ put(CAP_VAR, ctx.getMaxAxisSize());
4296
4311
  unpaddedMax = -1;
4297
4312
  };
4298
4313
  const moving = () => ctx.isAnimating() || ctx.isDragging();
@@ -4315,7 +4330,9 @@ function contentFitFeature() {
4315
4330
  observer?.disconnect();
4316
4331
  window.removeEventListener("orientationchange", whenIdle);
4317
4332
  sheet.removeAttribute(FIT_ATTR);
4318
- sheet.style.removeProperty(INSET_VAR);
4333
+ for (const name of [INSET_VAR, CAP_VAR, LIFT_VAR]) {
4334
+ sheet.style.removeProperty(name);
4335
+ }
4319
4336
  };
4320
4337
  }
4321
4338
  };