@surdeddd/bottom-sheet 0.23.0 → 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/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,24 +4279,36 @@ 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);
4301
4314
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
@@ -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,24 +4281,36 @@ 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);
4303
4316
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
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,7 +305,7 @@
298
305
  background: var(--bs-surface, var(--bs-surface-d));
299
306
  }
300
307
 
301
- .bs-sheet[data-bs-fit-content][data-mode="bottom"]:not([data-bs-webgl="on"]) .bs-footer {
308
+ .bs-sheet[data-bs-fit-content="moving"][data-mode="bottom"]:not([data-bs-webgl="on"]) .bs-footer {
302
309
  transform: translateY(
303
310
  clamp(
304
311
  calc(-1 * var(--bs-footer-lift-max, 0px)),
@@ -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,24 +4280,36 @@ 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);
4302
4315
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
@@ -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,24 +4278,36 @@ 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);
4300
4313
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
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,24 +4302,36 @@ 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);
4324
4337
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
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,24 +4280,36 @@ 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);
4302
4315
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
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,24 +4280,36 @@ 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);
4302
4315
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
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,24 +4278,36 @@ 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);
4300
4313
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surdeddd/bottom-sheet",
3
- "version": "0.23.0",
3
+ "version": "0.23.1",
4
4
  "description": "Universal, headless bottom sheet — framework-agnostic core with React, Vue 3, Svelte, Solid, Qwik, Preact, Lit and Custom Element adapters. Pointer Events, snap points, momentum, a11y, SSR-safe.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -315,7 +315,7 @@
315
315
  {
316
316
  "name": "features (subpath)",
317
317
  "path": "dist/features.js",
318
- "limit": "2.68 KB",
318
+ "limit": "2.72 KB",
319
319
  "gzip": true
320
320
  },
321
321
  {