@surdeddd/bottom-sheet 0.23.0 → 0.23.2

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.js CHANGED
@@ -4269,6 +4269,7 @@ function contentFitFeature() {
4269
4269
  let inset = 0;
4270
4270
  let unpaddedMax = -1;
4271
4271
  let top = 0;
4272
+ let resting = false;
4272
4273
  const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
4273
4274
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4274
4275
  const follow = (size) => {
@@ -4285,32 +4286,46 @@ function contentFitFeature() {
4285
4286
  const settle = () => {
4286
4287
  if (ctx.isDestroyed()) return;
4287
4288
  const size = ctx.getSize();
4288
- unpaddedMax = -1;
4289
- follow(size);
4289
+ if (!resting) {
4290
+ unpaddedMax = -1;
4291
+ follow(size);
4292
+ }
4290
4293
  inset = hiddenAt(size);
4291
- put(LIFT_VAR, scroller.offsetHeight);
4292
4294
  put(INSET_VAR, inset);
4293
4295
  put(SIZE_VAR, size);
4294
4296
  put(CAP_VAR, ctx.getMaxAxisSize());
4297
+ if (!resting) {
4298
+ resting = true;
4299
+ sheet.setAttribute(FIT_ATTR, "rest");
4300
+ }
4295
4301
  unpaddedMax = -1;
4296
4302
  };
4303
+ const move = (size) => {
4304
+ if (resting) {
4305
+ resting = false;
4306
+ sheet.setAttribute(FIT_ATTR, "moving");
4307
+ put(LIFT_VAR, scroller.offsetHeight);
4308
+ }
4309
+ follow(size);
4310
+ };
4297
4311
  const moving = () => ctx.isAnimating() || ctx.isDragging();
4298
4312
  const whenIdle = () => {
4299
4313
  if (!moving()) settle();
4300
4314
  };
4301
- sheet.setAttribute(FIT_ATTR, "");
4302
4315
  settle();
4303
4316
  const offProgress = ctx.on(
4304
4317
  "progress",
4305
- (p) => moving() ? follow(p.size) : settle()
4318
+ (p) => moving() ? move(p.size) : settle()
4306
4319
  );
4307
4320
  const offSnap = ctx.on("snap", settle);
4321
+ const offDragStart = ctx.on("dragstart", () => move(ctx.getSize()));
4308
4322
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
4309
4323
  observer?.observe(document.documentElement);
4310
4324
  window.addEventListener("orientationchange", whenIdle);
4311
4325
  return () => {
4312
4326
  offProgress();
4313
4327
  offSnap();
4328
+ offDragStart();
4314
4329
  observer?.disconnect();
4315
4330
  window.removeEventListener("orientationchange", whenIdle);
4316
4331
  sheet.removeAttribute(FIT_ATTR);
package/dist/solid.cjs CHANGED
@@ -4264,6 +4264,7 @@ function contentFitFeature() {
4264
4264
  let inset = 0;
4265
4265
  let unpaddedMax = -1;
4266
4266
  let top = 0;
4267
+ let resting = false;
4267
4268
  const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
4268
4269
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4269
4270
  const follow = (size) => {
@@ -4280,32 +4281,46 @@ function contentFitFeature() {
4280
4281
  const settle = () => {
4281
4282
  if (ctx.isDestroyed()) return;
4282
4283
  const size = ctx.getSize();
4283
- unpaddedMax = -1;
4284
- follow(size);
4284
+ if (!resting) {
4285
+ unpaddedMax = -1;
4286
+ follow(size);
4287
+ }
4285
4288
  inset = hiddenAt(size);
4286
- put(LIFT_VAR, scroller.offsetHeight);
4287
4289
  put(INSET_VAR, inset);
4288
4290
  put(SIZE_VAR, size);
4289
4291
  put(CAP_VAR, ctx.getMaxAxisSize());
4292
+ if (!resting) {
4293
+ resting = true;
4294
+ sheet.setAttribute(FIT_ATTR, "rest");
4295
+ }
4290
4296
  unpaddedMax = -1;
4291
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
+ };
4292
4306
  const moving = () => ctx.isAnimating() || ctx.isDragging();
4293
4307
  const whenIdle = () => {
4294
4308
  if (!moving()) settle();
4295
4309
  };
4296
- sheet.setAttribute(FIT_ATTR, "");
4297
4310
  settle();
4298
4311
  const offProgress = ctx.on(
4299
4312
  "progress",
4300
- (p) => moving() ? follow(p.size) : settle()
4313
+ (p) => moving() ? move(p.size) : settle()
4301
4314
  );
4302
4315
  const offSnap = ctx.on("snap", settle);
4316
+ const offDragStart = ctx.on("dragstart", () => move(ctx.getSize()));
4303
4317
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
4304
4318
  observer?.observe(document.documentElement);
4305
4319
  window.addEventListener("orientationchange", whenIdle);
4306
4320
  return () => {
4307
4321
  offProgress();
4308
4322
  offSnap();
4323
+ offDragStart();
4309
4324
  observer?.disconnect();
4310
4325
  window.removeEventListener("orientationchange", whenIdle);
4311
4326
  sheet.removeAttribute(FIT_ATTR);
package/dist/solid.js CHANGED
@@ -4262,6 +4262,7 @@ function contentFitFeature() {
4262
4262
  let inset = 0;
4263
4263
  let unpaddedMax = -1;
4264
4264
  let top = 0;
4265
+ let resting = false;
4265
4266
  const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
4266
4267
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4267
4268
  const follow = (size) => {
@@ -4278,32 +4279,46 @@ function contentFitFeature() {
4278
4279
  const settle = () => {
4279
4280
  if (ctx.isDestroyed()) return;
4280
4281
  const size = ctx.getSize();
4281
- unpaddedMax = -1;
4282
- follow(size);
4282
+ if (!resting) {
4283
+ unpaddedMax = -1;
4284
+ follow(size);
4285
+ }
4283
4286
  inset = hiddenAt(size);
4284
- put(LIFT_VAR, scroller.offsetHeight);
4285
4287
  put(INSET_VAR, inset);
4286
4288
  put(SIZE_VAR, size);
4287
4289
  put(CAP_VAR, ctx.getMaxAxisSize());
4290
+ if (!resting) {
4291
+ resting = true;
4292
+ sheet.setAttribute(FIT_ATTR, "rest");
4293
+ }
4288
4294
  unpaddedMax = -1;
4289
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
+ };
4290
4304
  const moving = () => ctx.isAnimating() || ctx.isDragging();
4291
4305
  const whenIdle = () => {
4292
4306
  if (!moving()) settle();
4293
4307
  };
4294
- sheet.setAttribute(FIT_ATTR, "");
4295
4308
  settle();
4296
4309
  const offProgress = ctx.on(
4297
4310
  "progress",
4298
- (p) => moving() ? follow(p.size) : settle()
4311
+ (p) => moving() ? move(p.size) : settle()
4299
4312
  );
4300
4313
  const offSnap = ctx.on("snap", settle);
4314
+ const offDragStart = ctx.on("dragstart", () => move(ctx.getSize()));
4301
4315
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
4302
4316
  observer?.observe(document.documentElement);
4303
4317
  window.addEventListener("orientationchange", whenIdle);
4304
4318
  return () => {
4305
4319
  offProgress();
4306
4320
  offSnap();
4321
+ offDragStart();
4307
4322
  observer?.disconnect();
4308
4323
  window.removeEventListener("orientationchange", whenIdle);
4309
4324
  sheet.removeAttribute(FIT_ATTR);
@@ -4264,6 +4264,7 @@ function contentFitFeature() {
4264
4264
  let inset = 0;
4265
4265
  let unpaddedMax = -1;
4266
4266
  let top = 0;
4267
+ let resting = false;
4267
4268
  const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
4268
4269
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4269
4270
  const follow = (size) => {
@@ -4280,32 +4281,46 @@ function contentFitFeature() {
4280
4281
  const settle = () => {
4281
4282
  if (ctx.isDestroyed()) return;
4282
4283
  const size = ctx.getSize();
4283
- unpaddedMax = -1;
4284
- follow(size);
4284
+ if (!resting) {
4285
+ unpaddedMax = -1;
4286
+ follow(size);
4287
+ }
4285
4288
  inset = hiddenAt(size);
4286
- put(LIFT_VAR, scroller.offsetHeight);
4287
4289
  put(INSET_VAR, inset);
4288
4290
  put(SIZE_VAR, size);
4289
4291
  put(CAP_VAR, ctx.getMaxAxisSize());
4292
+ if (!resting) {
4293
+ resting = true;
4294
+ sheet.setAttribute(FIT_ATTR, "rest");
4295
+ }
4290
4296
  unpaddedMax = -1;
4291
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
+ };
4292
4306
  const moving = () => ctx.isAnimating() || ctx.isDragging();
4293
4307
  const whenIdle = () => {
4294
4308
  if (!moving()) settle();
4295
4309
  };
4296
- sheet.setAttribute(FIT_ATTR, "");
4297
4310
  settle();
4298
4311
  const offProgress = ctx.on(
4299
4312
  "progress",
4300
- (p) => moving() ? follow(p.size) : settle()
4313
+ (p) => moving() ? move(p.size) : settle()
4301
4314
  );
4302
4315
  const offSnap = ctx.on("snap", settle);
4316
+ const offDragStart = ctx.on("dragstart", () => move(ctx.getSize()));
4303
4317
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
4304
4318
  observer?.observe(document.documentElement);
4305
4319
  window.addEventListener("orientationchange", whenIdle);
4306
4320
  return () => {
4307
4321
  offProgress();
4308
4322
  offSnap();
4323
+ offDragStart();
4309
4324
  observer?.disconnect();
4310
4325
  window.removeEventListener("orientationchange", whenIdle);
4311
4326
  sheet.removeAttribute(FIT_ATTR);
package/dist/styles.css CHANGED
@@ -280,17 +280,22 @@
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
284
  scroll-padding-bottom: var(--bs-content-inset, 0px);
285
285
  }
286
286
 
287
- .bs-sheet[data-bs-fit-content] .bs-content::after {
287
+ .bs-sheet[data-bs-fit-content="moving"] .bs-content::after {
288
288
  content: "";
289
289
  display: block;
290
290
  flex: none;
291
291
  height: var(--bs-content-inset, 0px);
292
292
  }
293
293
 
294
+ .bs-sheet[data-bs-fit-content="rest"][data-mode="bottom"]::after {
295
+ content: "";
296
+ flex: 0 1 max(0px, var(--bs-max-size, 0px) - var(--bs-size, 0px));
297
+ }
298
+
294
299
  .bs-footer {
295
300
  flex: 0 0 auto;
296
301
  padding: var(--bs-footer-padding, 12px 16px calc(12px + env(safe-area-inset-bottom)));
@@ -298,7 +303,7 @@
298
303
  background: var(--bs-surface, var(--bs-surface-d));
299
304
  }
300
305
 
301
- .bs-sheet[data-bs-fit-content][data-mode="bottom"]:not([data-bs-webgl="on"]) .bs-footer {
306
+ .bs-sheet[data-bs-fit-content="moving"][data-mode="bottom"] .bs-footer {
302
307
  transform: translateY(
303
308
  clamp(
304
309
  calc(-1 * var(--bs-footer-lift-max, 0px)),
@@ -308,6 +313,10 @@
308
313
  );
309
314
  }
310
315
 
316
+ .bs-sheet[data-bs-fit-content="moving"][data-mode="bottom"][data-bs-webgl="on"] .bs-footer {
317
+ background: var(--bs-surface, var(--bs-surface-d));
318
+ }
319
+
311
320
  .bs-sheet[data-mode="bottom"]:has(.bs-footer:not([hidden]):has(*)) {
312
321
  padding-bottom: 0;
313
322
  }
@@ -4263,6 +4263,7 @@ function contentFitFeature() {
4263
4263
  let inset = 0;
4264
4264
  let unpaddedMax = -1;
4265
4265
  let top = 0;
4266
+ let resting = false;
4266
4267
  const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
4267
4268
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4268
4269
  const follow = (size) => {
@@ -4279,32 +4280,46 @@ function contentFitFeature() {
4279
4280
  const settle = () => {
4280
4281
  if (ctx.isDestroyed()) return;
4281
4282
  const size = ctx.getSize();
4282
- unpaddedMax = -1;
4283
- follow(size);
4283
+ if (!resting) {
4284
+ unpaddedMax = -1;
4285
+ follow(size);
4286
+ }
4284
4287
  inset = hiddenAt(size);
4285
- put(LIFT_VAR, scroller.offsetHeight);
4286
4288
  put(INSET_VAR, inset);
4287
4289
  put(SIZE_VAR, size);
4288
4290
  put(CAP_VAR, ctx.getMaxAxisSize());
4291
+ if (!resting) {
4292
+ resting = true;
4293
+ sheet.setAttribute(FIT_ATTR, "rest");
4294
+ }
4289
4295
  unpaddedMax = -1;
4290
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
+ };
4291
4305
  const moving = () => ctx.isAnimating() || ctx.isDragging();
4292
4306
  const whenIdle = () => {
4293
4307
  if (!moving()) settle();
4294
4308
  };
4295
- sheet.setAttribute(FIT_ATTR, "");
4296
4309
  settle();
4297
4310
  const offProgress = ctx.on(
4298
4311
  "progress",
4299
- (p) => moving() ? follow(p.size) : settle()
4312
+ (p) => moving() ? move(p.size) : settle()
4300
4313
  );
4301
4314
  const offSnap = ctx.on("snap", settle);
4315
+ const offDragStart = ctx.on("dragstart", () => move(ctx.getSize()));
4302
4316
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
4303
4317
  observer?.observe(document.documentElement);
4304
4318
  window.addEventListener("orientationchange", whenIdle);
4305
4319
  return () => {
4306
4320
  offProgress();
4307
4321
  offSnap();
4322
+ offDragStart();
4308
4323
  observer?.disconnect();
4309
4324
  window.removeEventListener("orientationchange", whenIdle);
4310
4325
  sheet.removeAttribute(FIT_ATTR);
@@ -4261,6 +4261,7 @@ function contentFitFeature() {
4261
4261
  let inset = 0;
4262
4262
  let unpaddedMax = -1;
4263
4263
  let top = 0;
4264
+ let resting = false;
4264
4265
  const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
4265
4266
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4266
4267
  const follow = (size) => {
@@ -4277,32 +4278,46 @@ function contentFitFeature() {
4277
4278
  const settle = () => {
4278
4279
  if (ctx.isDestroyed()) return;
4279
4280
  const size = ctx.getSize();
4280
- unpaddedMax = -1;
4281
- follow(size);
4281
+ if (!resting) {
4282
+ unpaddedMax = -1;
4283
+ follow(size);
4284
+ }
4282
4285
  inset = hiddenAt(size);
4283
- put(LIFT_VAR, scroller.offsetHeight);
4284
4286
  put(INSET_VAR, inset);
4285
4287
  put(SIZE_VAR, size);
4286
4288
  put(CAP_VAR, ctx.getMaxAxisSize());
4289
+ if (!resting) {
4290
+ resting = true;
4291
+ sheet.setAttribute(FIT_ATTR, "rest");
4292
+ }
4287
4293
  unpaddedMax = -1;
4288
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
+ };
4289
4303
  const moving = () => ctx.isAnimating() || ctx.isDragging();
4290
4304
  const whenIdle = () => {
4291
4305
  if (!moving()) settle();
4292
4306
  };
4293
- sheet.setAttribute(FIT_ATTR, "");
4294
4307
  settle();
4295
4308
  const offProgress = ctx.on(
4296
4309
  "progress",
4297
- (p) => moving() ? follow(p.size) : settle()
4310
+ (p) => moving() ? move(p.size) : settle()
4298
4311
  );
4299
4312
  const offSnap = ctx.on("snap", settle);
4313
+ const offDragStart = ctx.on("dragstart", () => move(ctx.getSize()));
4300
4314
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
4301
4315
  observer?.observe(document.documentElement);
4302
4316
  window.addEventListener("orientationchange", whenIdle);
4303
4317
  return () => {
4304
4318
  offProgress();
4305
4319
  offSnap();
4320
+ offDragStart();
4306
4321
  observer?.disconnect();
4307
4322
  window.removeEventListener("orientationchange", whenIdle);
4308
4323
  sheet.removeAttribute(FIT_ATTR);
package/dist/svelte.cjs CHANGED
@@ -4285,6 +4285,7 @@ function contentFitFeature() {
4285
4285
  let inset = 0;
4286
4286
  let unpaddedMax = -1;
4287
4287
  let top = 0;
4288
+ let resting = false;
4288
4289
  const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
4289
4290
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4290
4291
  const follow = (size) => {
@@ -4301,32 +4302,46 @@ function contentFitFeature() {
4301
4302
  const settle = () => {
4302
4303
  if (ctx.isDestroyed()) return;
4303
4304
  const size = ctx.getSize();
4304
- unpaddedMax = -1;
4305
- follow(size);
4305
+ if (!resting) {
4306
+ unpaddedMax = -1;
4307
+ follow(size);
4308
+ }
4306
4309
  inset = hiddenAt(size);
4307
- put(LIFT_VAR, scroller.offsetHeight);
4308
4310
  put(INSET_VAR, inset);
4309
4311
  put(SIZE_VAR, size);
4310
4312
  put(CAP_VAR, ctx.getMaxAxisSize());
4313
+ if (!resting) {
4314
+ resting = true;
4315
+ sheet.setAttribute(FIT_ATTR, "rest");
4316
+ }
4311
4317
  unpaddedMax = -1;
4312
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
+ };
4313
4327
  const moving = () => ctx.isAnimating() || ctx.isDragging();
4314
4328
  const whenIdle = () => {
4315
4329
  if (!moving()) settle();
4316
4330
  };
4317
- sheet.setAttribute(FIT_ATTR, "");
4318
4331
  settle();
4319
4332
  const offProgress = ctx.on(
4320
4333
  "progress",
4321
- (p) => moving() ? follow(p.size) : settle()
4334
+ (p) => moving() ? move(p.size) : settle()
4322
4335
  );
4323
4336
  const offSnap = ctx.on("snap", settle);
4337
+ const offDragStart = ctx.on("dragstart", () => move(ctx.getSize()));
4324
4338
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
4325
4339
  observer?.observe(document.documentElement);
4326
4340
  window.addEventListener("orientationchange", whenIdle);
4327
4341
  return () => {
4328
4342
  offProgress();
4329
4343
  offSnap();
4344
+ offDragStart();
4330
4345
  observer?.disconnect();
4331
4346
  window.removeEventListener("orientationchange", whenIdle);
4332
4347
  sheet.removeAttribute(FIT_ATTR);
package/dist/svelte.js CHANGED
@@ -4263,6 +4263,7 @@ function contentFitFeature() {
4263
4263
  let inset = 0;
4264
4264
  let unpaddedMax = -1;
4265
4265
  let top = 0;
4266
+ let resting = false;
4266
4267
  const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
4267
4268
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4268
4269
  const follow = (size) => {
@@ -4279,32 +4280,46 @@ function contentFitFeature() {
4279
4280
  const settle = () => {
4280
4281
  if (ctx.isDestroyed()) return;
4281
4282
  const size = ctx.getSize();
4282
- unpaddedMax = -1;
4283
- follow(size);
4283
+ if (!resting) {
4284
+ unpaddedMax = -1;
4285
+ follow(size);
4286
+ }
4284
4287
  inset = hiddenAt(size);
4285
- put(LIFT_VAR, scroller.offsetHeight);
4286
4288
  put(INSET_VAR, inset);
4287
4289
  put(SIZE_VAR, size);
4288
4290
  put(CAP_VAR, ctx.getMaxAxisSize());
4291
+ if (!resting) {
4292
+ resting = true;
4293
+ sheet.setAttribute(FIT_ATTR, "rest");
4294
+ }
4289
4295
  unpaddedMax = -1;
4290
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
+ };
4291
4305
  const moving = () => ctx.isAnimating() || ctx.isDragging();
4292
4306
  const whenIdle = () => {
4293
4307
  if (!moving()) settle();
4294
4308
  };
4295
- sheet.setAttribute(FIT_ATTR, "");
4296
4309
  settle();
4297
4310
  const offProgress = ctx.on(
4298
4311
  "progress",
4299
- (p) => moving() ? follow(p.size) : settle()
4312
+ (p) => moving() ? move(p.size) : settle()
4300
4313
  );
4301
4314
  const offSnap = ctx.on("snap", settle);
4315
+ const offDragStart = ctx.on("dragstart", () => move(ctx.getSize()));
4302
4316
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
4303
4317
  observer?.observe(document.documentElement);
4304
4318
  window.addEventListener("orientationchange", whenIdle);
4305
4319
  return () => {
4306
4320
  offProgress();
4307
4321
  offSnap();
4322
+ offDragStart();
4308
4323
  observer?.disconnect();
4309
4324
  window.removeEventListener("orientationchange", whenIdle);
4310
4325
  sheet.removeAttribute(FIT_ATTR);
package/dist/vue.cjs CHANGED
@@ -4263,6 +4263,7 @@ function contentFitFeature() {
4263
4263
  let inset = 0;
4264
4264
  let unpaddedMax = -1;
4265
4265
  let top = 0;
4266
+ let resting = false;
4266
4267
  const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
4267
4268
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4268
4269
  const follow = (size) => {
@@ -4279,32 +4280,46 @@ function contentFitFeature() {
4279
4280
  const settle = () => {
4280
4281
  if (ctx.isDestroyed()) return;
4281
4282
  const size = ctx.getSize();
4282
- unpaddedMax = -1;
4283
- follow(size);
4283
+ if (!resting) {
4284
+ unpaddedMax = -1;
4285
+ follow(size);
4286
+ }
4284
4287
  inset = hiddenAt(size);
4285
- put(LIFT_VAR, scroller.offsetHeight);
4286
4288
  put(INSET_VAR, inset);
4287
4289
  put(SIZE_VAR, size);
4288
4290
  put(CAP_VAR, ctx.getMaxAxisSize());
4291
+ if (!resting) {
4292
+ resting = true;
4293
+ sheet.setAttribute(FIT_ATTR, "rest");
4294
+ }
4289
4295
  unpaddedMax = -1;
4290
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
+ };
4291
4305
  const moving = () => ctx.isAnimating() || ctx.isDragging();
4292
4306
  const whenIdle = () => {
4293
4307
  if (!moving()) settle();
4294
4308
  };
4295
- sheet.setAttribute(FIT_ATTR, "");
4296
4309
  settle();
4297
4310
  const offProgress = ctx.on(
4298
4311
  "progress",
4299
- (p) => moving() ? follow(p.size) : settle()
4312
+ (p) => moving() ? move(p.size) : settle()
4300
4313
  );
4301
4314
  const offSnap = ctx.on("snap", settle);
4315
+ const offDragStart = ctx.on("dragstart", () => move(ctx.getSize()));
4302
4316
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
4303
4317
  observer?.observe(document.documentElement);
4304
4318
  window.addEventListener("orientationchange", whenIdle);
4305
4319
  return () => {
4306
4320
  offProgress();
4307
4321
  offSnap();
4322
+ offDragStart();
4308
4323
  observer?.disconnect();
4309
4324
  window.removeEventListener("orientationchange", whenIdle);
4310
4325
  sheet.removeAttribute(FIT_ATTR);
package/dist/vue.js CHANGED
@@ -4261,6 +4261,7 @@ function contentFitFeature() {
4261
4261
  let inset = 0;
4262
4262
  let unpaddedMax = -1;
4263
4263
  let top = 0;
4264
+ let resting = false;
4264
4265
  const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
4265
4266
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4266
4267
  const follow = (size) => {
@@ -4277,32 +4278,46 @@ function contentFitFeature() {
4277
4278
  const settle = () => {
4278
4279
  if (ctx.isDestroyed()) return;
4279
4280
  const size = ctx.getSize();
4280
- unpaddedMax = -1;
4281
- follow(size);
4281
+ if (!resting) {
4282
+ unpaddedMax = -1;
4283
+ follow(size);
4284
+ }
4282
4285
  inset = hiddenAt(size);
4283
- put(LIFT_VAR, scroller.offsetHeight);
4284
4286
  put(INSET_VAR, inset);
4285
4287
  put(SIZE_VAR, size);
4286
4288
  put(CAP_VAR, ctx.getMaxAxisSize());
4289
+ if (!resting) {
4290
+ resting = true;
4291
+ sheet.setAttribute(FIT_ATTR, "rest");
4292
+ }
4287
4293
  unpaddedMax = -1;
4288
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
+ };
4289
4303
  const moving = () => ctx.isAnimating() || ctx.isDragging();
4290
4304
  const whenIdle = () => {
4291
4305
  if (!moving()) settle();
4292
4306
  };
4293
- sheet.setAttribute(FIT_ATTR, "");
4294
4307
  settle();
4295
4308
  const offProgress = ctx.on(
4296
4309
  "progress",
4297
- (p) => moving() ? follow(p.size) : settle()
4310
+ (p) => moving() ? move(p.size) : settle()
4298
4311
  );
4299
4312
  const offSnap = ctx.on("snap", settle);
4313
+ const offDragStart = ctx.on("dragstart", () => move(ctx.getSize()));
4300
4314
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
4301
4315
  observer?.observe(document.documentElement);
4302
4316
  window.addEventListener("orientationchange", whenIdle);
4303
4317
  return () => {
4304
4318
  offProgress();
4305
4319
  offSnap();
4320
+ offDragStart();
4306
4321
  observer?.disconnect();
4307
4322
  window.removeEventListener("orientationchange", whenIdle);
4308
4323
  sheet.removeAttribute(FIT_ATTR);