@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/element.js CHANGED
@@ -4572,6 +4572,7 @@ function contentFitFeature() {
4572
4572
  let inset = 0;
4573
4573
  let unpaddedMax = -1;
4574
4574
  let top = 0;
4575
+ let resting = false;
4575
4576
  const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
4576
4577
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4577
4578
  const follow = (size) => {
@@ -4588,32 +4589,46 @@ function contentFitFeature() {
4588
4589
  const settle = () => {
4589
4590
  if (ctx.isDestroyed()) return;
4590
4591
  const size = ctx.getSize();
4591
- unpaddedMax = -1;
4592
- follow(size);
4592
+ if (!resting) {
4593
+ unpaddedMax = -1;
4594
+ follow(size);
4595
+ }
4593
4596
  inset = hiddenAt(size);
4594
- put(LIFT_VAR, scroller.offsetHeight);
4595
4597
  put(INSET_VAR, inset);
4596
4598
  put(SIZE_VAR, size);
4597
4599
  put(CAP_VAR, ctx.getMaxAxisSize());
4600
+ if (!resting) {
4601
+ resting = true;
4602
+ sheet.setAttribute(FIT_ATTR, "rest");
4603
+ }
4598
4604
  unpaddedMax = -1;
4599
4605
  };
4606
+ const move = (size) => {
4607
+ if (resting) {
4608
+ resting = false;
4609
+ sheet.setAttribute(FIT_ATTR, "moving");
4610
+ put(LIFT_VAR, scroller.offsetHeight);
4611
+ }
4612
+ follow(size);
4613
+ };
4600
4614
  const moving = () => ctx.isAnimating() || ctx.isDragging();
4601
4615
  const whenIdle = () => {
4602
4616
  if (!moving()) settle();
4603
4617
  };
4604
- sheet.setAttribute(FIT_ATTR, "");
4605
4618
  settle();
4606
4619
  const offProgress = ctx.on(
4607
4620
  "progress",
4608
- (p) => moving() ? follow(p.size) : settle()
4621
+ (p) => moving() ? move(p.size) : settle()
4609
4622
  );
4610
4623
  const offSnap = ctx.on("snap", settle);
4624
+ const offDragStart = ctx.on("dragstart", () => move(ctx.getSize()));
4611
4625
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
4612
4626
  observer?.observe(document.documentElement);
4613
4627
  window.addEventListener("orientationchange", whenIdle);
4614
4628
  return () => {
4615
4629
  offProgress();
4616
4630
  offSnap();
4631
+ offDragStart();
4617
4632
  observer?.disconnect();
4618
4633
  window.removeEventListener("orientationchange", whenIdle);
4619
4634
  sheet.removeAttribute(FIT_ATTR);
@@ -4674,7 +4689,7 @@ var init_BottomSheetEngine = __esm({
4674
4689
  var baseStyles;
4675
4690
  var init_baseStyles = __esm({
4676
4691
  "src/web-component/baseStyles.ts"() {
4677
- baseStyles = `:where(.bs-root){--bs-surface-d:#ffffff;--bs-surface-border-d:rgba(225,227,237,1);--bs-radius-d:20px;--bs-handle-color-d:rgba(26,22,20,0.3);--bs-handle-width:40px;--bs-handle-height:5px;--bs-z-backdrop:90;--bs-z-sheet:100;--bs-backdrop-color-d:rgba(0,0,0,0.5);--bs-scrim-color-d:transparent;--bs-scrim-blur:0px;--bs-z-scrim:calc(var(--bs-z-sheet) - 1);--bs-size:0px;--bs-progress:0}.bs-backdrop{position:fixed;inset:0;background:var(--bs-backdrop-color,var(--bs-backdrop-color-d));opacity:0;pointer-events:none;z-index:var(--bs-z-backdrop);transition:opacity 0.24s cubic-bezier(0.22,1,0.36,1);will-change:opacity}.bs-root[data-dragging="true"] .bs-backdrop,.bs-root[data-animating="true"] .bs-backdrop{transition:none}.bs-sheet{position:fixed;background:var(--bs-surface,var(--bs-surface-d));box-shadow:var(--bs-shadow,var(--bs-shadow-auto,none));--bs-shadow-fade:clamp(0,calc(var(--bs-progress,0) * 8),1);z-index:var(--bs-z-sheet);pointer-events:auto;overflow:hidden;display:flex;flex-direction:column;-webkit-tap-highlight-color:transparent;user-select:none;overscroll-behavior:contain}.bs-sheet[data-mode="bottom"]{left:0;right:0;bottom:0;width:100%;border-top-left-radius:var(--bs-radius,var(--bs-radius-d));border-top-right-radius:var(--bs-radius,var(--bs-radius-d));border-top:1px solid var(--bs-surface-border,var(--bs-surface-border-d));padding-bottom:env(safe-area-inset-bottom);--bs-shadow-auto:0 calc(var(--bs-progress,0) * -2px - 3px) calc(var(--bs-progress,0) * 18px + 12px) rgba( 0,0,0,calc(var(--bs-shadow-fade) * (var(--bs-progress,0) * 0.15 + 0.12)) )}.bs-sheet[data-mode="top"]{left:0;right:0;top:0;width:100%;border-bottom-left-radius:var(--bs-radius,var(--bs-radius-d));border-bottom-right-radius:var(--bs-radius,var(--bs-radius-d));border-bottom:1px solid var(--bs-surface-border,var(--bs-surface-border-d));flex-direction:column-reverse;--bs-shadow-auto:0 3px 12px rgba(0,0,0,calc(var(--bs-shadow-fade) * 0.12));padding-top:env(safe-area-inset-top)}.bs-sheet[data-mode="left"]{top:0;bottom:0;left:0;height:100%;border-top-right-radius:var(--bs-radius,var(--bs-radius-d));border-bottom-right-radius:var(--bs-radius,var(--bs-radius-d));border-right:1px solid var(--bs-surface-border,var(--bs-surface-border-d));--bs-shadow-auto:3px 0 12px rgba(0,0,0,calc(var(--bs-shadow-fade) * 0.12))}.bs-sheet[data-mode="right"]{top:0;bottom:0;right:0;height:100%;border-top-left-radius:var(--bs-radius,var(--bs-radius-d));border-bottom-left-radius:var(--bs-radius,var(--bs-radius-d));border-left:1px solid var(--bs-surface-border,var(--bs-surface-border-d));--bs-shadow-auto:-3px 0 12px rgba(0,0,0,calc(var(--bs-shadow-fade) * 0.12))}.bs-sheet[data-bs-rest="closed"]{box-shadow:none;visibility:hidden}.bs-sheet[data-bs-webgl="on"],.bs-sheet[data-bs-webgl="on"] .bs-handle,.bs-sheet[data-bs-webgl="on"] .bs-header,.bs-sheet[data-bs-webgl="on"] .bs-footer{background:transparent;box-shadow:none}.bs-sheet[data-mode="left"] .bs-content{padding-right:36px}.bs-sheet[data-mode="right"] .bs-content{padding-left:36px}.bs-handle{flex-shrink:0;min-height:44px;display:flex;flex-direction:column;justify-content:center;padding:var(--bs-handle-padding,8px 16px 4px);cursor:grab;touch-action:none;user-select:none;background:var(--bs-surface,var(--bs-surface-d));-webkit-tap-highlight-color:transparent;outline:none;position:relative}.bs-handle:active{cursor:grabbing}.bs-handle:focus-visible{outline:2px solid currentColor;outline-offset:-2px;border-radius:var(--bs-radius,var(--bs-radius-d))}.bs-handle::before{content:"";display:block;width:var(--bs-handle-width);height:var(--bs-handle-height);background:var(--bs-handle-color,var(--bs-handle-color-d));border-radius:calc(var(--bs-handle-height) / 2);margin:0 auto 8px;transition:width 0.15s ease,background 0.15s ease,transform 0.15s ease;pointer-events:none}.bs-sheet[data-mode="left"] .bs-handle,.bs-sheet[data-mode="right"] .bs-handle{position:absolute;top:0;bottom:0;width:28px;min-width:0;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:0;background:var(--bs-surface,var(--bs-surface-d));z-index:1;overflow:hidden}.bs-sheet[data-mode="left"] .bs-handle>*,.bs-sheet[data-mode="right"] .bs-handle>*{display:none}.bs-sheet[data-mode="left"] .bs-handle{right:0;border-left:1px solid var(--bs-surface-border,var(--bs-surface-border-d))}.bs-sheet[data-mode="right"] .bs-handle{left:0;border-right:1px solid var(--bs-surface-border,var(--bs-surface-border-d))}.bs-sheet[data-mode="left"] .bs-handle::before,.bs-sheet[data-mode="right"] .bs-handle::before{width:var(--bs-handle-height);height:var(--bs-handle-width);margin:0}.bs-sheet:hover .bs-handle::before{background:color-mix(in oklab,var(--bs-handle-color,var(--bs-handle-color-d)),#000 15%)}.bs-handle:active::before{background:color-mix(in oklab,var(--bs-handle-color,var(--bs-handle-color-d)),#000 35%);transform:scaleX(1.15)}.bs-handle.bs-handle--ticks::after{content:"";display:block;position:absolute;left:50%;bottom:6px;transform:translateX(-50%);width:calc(var(--bs-handle-width) * 2);height:3px;background-image:radial-gradient( circle,var(--bs-handle-color,var(--bs-handle-color-d)) 0 1.5px,transparent 1.6px );background-size:8px 3px;background-repeat:repeat-x;background-position:center;opacity:0;transition:opacity 0.18s ease-out;pointer-events:none}.bs-root[data-dragging="true"] .bs-handle.bs-handle--ticks::after{opacity:0.4}.bs-sheet[data-mode="top"] .bs-handle.bs-handle--ticks::after{bottom:auto;top:6px}.bs-sheet[data-mode="left"] .bs-handle.bs-handle--ticks::after,.bs-sheet[data-mode="right"] .bs-handle.bs-handle--ticks::after{left:50%;top:50%;bottom:auto;transform:translate(-50%,-50%);width:3px;height:calc(var(--bs-handle-width) * 2);background-size:3px 8px;background-repeat:repeat-y;margin-left:calc(var(--bs-handle-height) + 6px)}.bs-sheet[data-mode="right"] .bs-handle.bs-handle--ticks::after{margin-left:calc(-1 * (var(--bs-handle-height) + 6px))}.bs-header{flex:0 0 auto;min-height:var(--bs-header-min-height,0px);padding:var(--bs-header-padding,0 16px 8px);background:var(--bs-surface,var(--bs-surface-d))}.bs-content{flex:1;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;user-select:text;padding:var(--bs-content-padding,0 16px 16px)}.bs-sheet[data-bs-fit-content] .bs-content{scroll-padding-bottom:var(--bs-content-inset,0px)}.bs-sheet[data-bs-fit-content] .bs-content::after{content:"";display:block;flex:none;height:var(--bs-content-inset,0px)}.bs-footer{flex:0 0 auto;padding:var(--bs-footer-padding,12px 16px calc(12px + env(safe-area-inset-bottom)));border-top:1px solid var(--bs-surface-border,var(--bs-surface-border-d));background:var(--bs-surface,var(--bs-surface-d))}.bs-sheet[data-bs-fit-content][data-mode="bottom"]:not([data-bs-webgl="on"]) .bs-footer{transform:translateY( clamp( calc(-1 * var(--bs-footer-lift-max,0px)),calc(var(--bs-size,0px) - var(--bs-max-size,0px)),0px ) )}.bs-sheet[data-mode="bottom"]:has(.bs-footer:not([hidden]):has(*)){padding-bottom:0}.bs-header:not(:has(*)),.bs-footer:not(:has(*)),.bs-header[hidden],.bs-footer[hidden]{display:none}.bs-screen{position:absolute;inset:0;pointer-events:none;z-index:var(--bs-z-scrim);background:var(--bs-scrim-color,var(--bs-scrim-color-d));backdrop-filter:blur(var(--bs-scrim-blur,0px));-webkit-backdrop-filter:blur(var(--bs-scrim-blur,0px));transition:opacity 0.24s cubic-bezier(0.22,1,0.36,1);will-change:opacity}.bs-root[data-dragging="true"] .bs-screen,.bs-root[data-animating="true"] .bs-screen{transition:none}.bs-scrim-overlay{z-index:calc(var(--bs-z-sheet) + 1);pointer-events:none}.bs-button-slot{position:fixed;z-index:calc(var(--bs-z-sheet) + 1);pointer-events:auto}.bs-button-slot[data-side="left"]{left:16px;bottom:calc(var(--bs-size,0px) + 12px)}.bs-button-slot[data-side="right"]{right:16px;bottom:calc(var(--bs-size,0px) + 12px)}.bs-button-slot[data-mode="top"]{bottom:auto;top:calc(var(--bs-size,0px) + 12px)}.bs-button-slot[data-mode="left"]{left:calc(var(--bs-size,0px) + 12px);right:auto;bottom:auto;top:16px}.bs-button-slot[data-mode="right"]{right:calc(var(--bs-size,0px) + 12px);left:auto;bottom:auto;top:16px}@media (prefers-reduced-motion:reduce){.bs-backdrop,.bs-handle::before,.bs-button-slot[data-side="left"],.bs-button-slot[data-side="right"]{transition:none !important}}@media (prefers-color-scheme:dark){:where(.bs-root){--bs-surface-d:#1a1a1d;--bs-surface-border-d:rgba(255,255,255,0.08);--bs-handle-color-d:rgba(255,255,255,0.45);--bs-shadow-auto:0 -3px 16px rgba(0,0,0,0.5)}}@media (forced-colors:active){.bs-sheet{border:1px solid CanvasText}.bs-handle::before{background:CanvasText;forced-color-adjust:none}.bs-backdrop,.bs-screen{forced-color-adjust:none}}.bs-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}:where(.ovl-root){--ovl-surface:var(--bs-surface,var(--bs-surface-d,#ffffff));--ovl-surface-border:var(--bs-surface-border,var(--bs-surface-border-d,rgba(0,0,0,0.08)));--ovl-shadow:0 -8px 40px rgba(0,0,0,0.35);--ovl-radius:var(--bs-radius,var(--bs-radius-d,20px));--ovl-backdrop-color:rgba(0,0,0,0.5);--ovl-z-backdrop:200;--ovl-z-panel:201}.ovl-backdrop{position:fixed;inset:0;background:var(--ovl-backdrop-color);opacity:0;pointer-events:none;z-index:var(--ovl-z-backdrop)}.ovl-panel{position:fixed;background:var(--ovl-surface);box-shadow:var(--ovl-shadow);z-index:var(--ovl-z-panel);-webkit-tap-highlight-color:transparent;outline:none;transition:transform 0.32s cubic-bezier(0.29,1.24,0.84,0.99),opacity 0.32s ease-out}.ovl-panel[data-state="open"]{transform:translate3d(0,0,0);opacity:1}@starting-style{.ovl-panel[data-edge="bottom"][data-state="open"]{transform:translate3d(0,100%,0);opacity:0}.ovl-panel[data-edge="top"][data-state="open"]{transform:translate3d(0,-100%,0);opacity:0}.ovl-panel[data-edge="left"][data-state="open"]{transform:translate3d(-100%,0,0);opacity:0}.ovl-panel[data-edge="right"][data-state="open"]{transform:translate3d(100%,0,0);opacity:0}}.ovl-panel[data-edge="bottom"]{left:0;right:0;bottom:0;width:100%;border-top-left-radius:var(--ovl-radius);border-top-right-radius:var(--ovl-radius);border-top:1px solid var(--ovl-surface-border);padding-bottom:env(safe-area-inset-bottom)}.ovl-panel[data-edge="top"]{left:0;right:0;top:0;width:100%;border-bottom-left-radius:var(--ovl-radius);border-bottom-right-radius:var(--ovl-radius);border-bottom:1px solid var(--ovl-surface-border);padding-top:env(safe-area-inset-top)}.ovl-panel[data-edge="left"]{top:0;bottom:0;left:0;height:100%;border-top-right-radius:var(--ovl-radius);border-bottom-right-radius:var(--ovl-radius);border-right:1px solid var(--ovl-surface-border)}.ovl-panel[data-edge="right"]{top:0;bottom:0;right:0;height:100%;border-top-left-radius:var(--ovl-radius);border-bottom-left-radius:var(--ovl-radius);border-left:1px solid var(--ovl-surface-border)}@media (prefers-reduced-motion:reduce){.ovl-panel,.ovl-backdrop{transition:none !important}}`;
4692
+ baseStyles = `:where(.bs-root){--bs-surface-d:#ffffff;--bs-surface-border-d:rgba(225,227,237,1);--bs-radius-d:20px;--bs-handle-color-d:rgba(26,22,20,0.3);--bs-handle-width:40px;--bs-handle-height:5px;--bs-z-backdrop:90;--bs-z-sheet:100;--bs-backdrop-color-d:rgba(0,0,0,0.5);--bs-scrim-color-d:transparent;--bs-scrim-blur:0px;--bs-z-scrim:calc(var(--bs-z-sheet) - 1);--bs-size:0px;--bs-progress:0}.bs-backdrop{position:fixed;inset:0;background:var(--bs-backdrop-color,var(--bs-backdrop-color-d));opacity:0;pointer-events:none;z-index:var(--bs-z-backdrop);transition:opacity 0.24s cubic-bezier(0.22,1,0.36,1);will-change:opacity}.bs-root[data-dragging="true"] .bs-backdrop,.bs-root[data-animating="true"] .bs-backdrop{transition:none}.bs-sheet{position:fixed;background:var(--bs-surface,var(--bs-surface-d));box-shadow:var(--bs-shadow,var(--bs-shadow-auto,none));--bs-shadow-fade:clamp(0,calc(var(--bs-progress,0) * 8),1);z-index:var(--bs-z-sheet);pointer-events:auto;overflow:hidden;display:flex;flex-direction:column;-webkit-tap-highlight-color:transparent;user-select:none;overscroll-behavior:contain}.bs-sheet[data-mode="bottom"]{left:0;right:0;bottom:0;width:100%;border-top-left-radius:var(--bs-radius,var(--bs-radius-d));border-top-right-radius:var(--bs-radius,var(--bs-radius-d));border-top:1px solid var(--bs-surface-border,var(--bs-surface-border-d));padding-bottom:env(safe-area-inset-bottom);--bs-shadow-auto:0 calc(var(--bs-progress,0) * -2px - 3px) calc(var(--bs-progress,0) * 18px + 12px) rgba( 0,0,0,calc(var(--bs-shadow-fade) * (var(--bs-progress,0) * 0.15 + 0.12)) )}.bs-sheet[data-mode="top"]{left:0;right:0;top:0;width:100%;border-bottom-left-radius:var(--bs-radius,var(--bs-radius-d));border-bottom-right-radius:var(--bs-radius,var(--bs-radius-d));border-bottom:1px solid var(--bs-surface-border,var(--bs-surface-border-d));flex-direction:column-reverse;--bs-shadow-auto:0 3px 12px rgba(0,0,0,calc(var(--bs-shadow-fade) * 0.12));padding-top:env(safe-area-inset-top)}.bs-sheet[data-mode="left"]{top:0;bottom:0;left:0;height:100%;border-top-right-radius:var(--bs-radius,var(--bs-radius-d));border-bottom-right-radius:var(--bs-radius,var(--bs-radius-d));border-right:1px solid var(--bs-surface-border,var(--bs-surface-border-d));--bs-shadow-auto:3px 0 12px rgba(0,0,0,calc(var(--bs-shadow-fade) * 0.12))}.bs-sheet[data-mode="right"]{top:0;bottom:0;right:0;height:100%;border-top-left-radius:var(--bs-radius,var(--bs-radius-d));border-bottom-left-radius:var(--bs-radius,var(--bs-radius-d));border-left:1px solid var(--bs-surface-border,var(--bs-surface-border-d));--bs-shadow-auto:-3px 0 12px rgba(0,0,0,calc(var(--bs-shadow-fade) * 0.12))}.bs-sheet[data-bs-rest="closed"]{box-shadow:none;visibility:hidden}.bs-sheet[data-bs-webgl="on"],.bs-sheet[data-bs-webgl="on"] .bs-handle,.bs-sheet[data-bs-webgl="on"] .bs-header,.bs-sheet[data-bs-webgl="on"] .bs-footer{background:transparent;box-shadow:none}.bs-sheet[data-mode="left"] .bs-content{padding-right:36px}.bs-sheet[data-mode="right"] .bs-content{padding-left:36px}.bs-handle{flex-shrink:0;min-height:44px;display:flex;flex-direction:column;justify-content:center;padding:var(--bs-handle-padding,8px 16px 4px);cursor:grab;touch-action:none;user-select:none;background:var(--bs-surface,var(--bs-surface-d));-webkit-tap-highlight-color:transparent;outline:none;position:relative}.bs-handle:active{cursor:grabbing}.bs-handle:focus-visible{outline:2px solid currentColor;outline-offset:-2px;border-radius:var(--bs-radius,var(--bs-radius-d))}.bs-handle::before{content:"";display:block;width:var(--bs-handle-width);height:var(--bs-handle-height);background:var(--bs-handle-color,var(--bs-handle-color-d));border-radius:calc(var(--bs-handle-height) / 2);margin:0 auto 8px;transition:width 0.15s ease,background 0.15s ease,transform 0.15s ease;pointer-events:none}.bs-sheet[data-mode="left"] .bs-handle,.bs-sheet[data-mode="right"] .bs-handle{position:absolute;top:0;bottom:0;width:28px;min-width:0;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:0;background:var(--bs-surface,var(--bs-surface-d));z-index:1;overflow:hidden}.bs-sheet[data-mode="left"] .bs-handle>*,.bs-sheet[data-mode="right"] .bs-handle>*{display:none}.bs-sheet[data-mode="left"] .bs-handle{right:0;border-left:1px solid var(--bs-surface-border,var(--bs-surface-border-d))}.bs-sheet[data-mode="right"] .bs-handle{left:0;border-right:1px solid var(--bs-surface-border,var(--bs-surface-border-d))}.bs-sheet[data-mode="left"] .bs-handle::before,.bs-sheet[data-mode="right"] .bs-handle::before{width:var(--bs-handle-height);height:var(--bs-handle-width);margin:0}.bs-sheet:hover .bs-handle::before{background:color-mix(in oklab,var(--bs-handle-color,var(--bs-handle-color-d)),#000 15%)}.bs-handle:active::before{background:color-mix(in oklab,var(--bs-handle-color,var(--bs-handle-color-d)),#000 35%);transform:scaleX(1.15)}.bs-handle.bs-handle--ticks::after{content:"";display:block;position:absolute;left:50%;bottom:6px;transform:translateX(-50%);width:calc(var(--bs-handle-width) * 2);height:3px;background-image:radial-gradient( circle,var(--bs-handle-color,var(--bs-handle-color-d)) 0 1.5px,transparent 1.6px );background-size:8px 3px;background-repeat:repeat-x;background-position:center;opacity:0;transition:opacity 0.18s ease-out;pointer-events:none}.bs-root[data-dragging="true"] .bs-handle.bs-handle--ticks::after{opacity:0.4}.bs-sheet[data-mode="top"] .bs-handle.bs-handle--ticks::after{bottom:auto;top:6px}.bs-sheet[data-mode="left"] .bs-handle.bs-handle--ticks::after,.bs-sheet[data-mode="right"] .bs-handle.bs-handle--ticks::after{left:50%;top:50%;bottom:auto;transform:translate(-50%,-50%);width:3px;height:calc(var(--bs-handle-width) * 2);background-size:3px 8px;background-repeat:repeat-y;margin-left:calc(var(--bs-handle-height) + 6px)}.bs-sheet[data-mode="right"] .bs-handle.bs-handle--ticks::after{margin-left:calc(-1 * (var(--bs-handle-height) + 6px))}.bs-header{flex:0 0 auto;min-height:var(--bs-header-min-height,0px);padding:var(--bs-header-padding,0 16px 8px);background:var(--bs-surface,var(--bs-surface-d))}.bs-content{flex:1;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;user-select:text;padding:var(--bs-content-padding,0 16px 16px)}.bs-sheet[data-bs-fit-content="moving"] .bs-content{scroll-padding-bottom:var(--bs-content-inset,0px)}.bs-sheet[data-bs-fit-content="moving"] .bs-content::after{content:"";display:block;flex:none;height:var(--bs-content-inset,0px)}.bs-sheet[data-bs-fit-content="rest"][data-mode="bottom"]::after{content:"";flex:0 1 max(0px,var(--bs-max-size,0px) - var(--bs-size,0px))}.bs-footer{flex:0 0 auto;padding:var(--bs-footer-padding,12px 16px calc(12px + env(safe-area-inset-bottom)));border-top:1px solid var(--bs-surface-border,var(--bs-surface-border-d));background:var(--bs-surface,var(--bs-surface-d))}.bs-sheet[data-bs-fit-content="moving"][data-mode="bottom"] .bs-footer{transform:translateY( clamp( calc(-1 * var(--bs-footer-lift-max,0px)),calc(var(--bs-size,0px) - var(--bs-max-size,0px)),0px ) )}.bs-sheet[data-bs-fit-content="moving"][data-mode="bottom"][data-bs-webgl="on"] .bs-footer{background:var(--bs-surface,var(--bs-surface-d))}.bs-sheet[data-mode="bottom"]:has(.bs-footer:not([hidden]):has(*)){padding-bottom:0}.bs-header:not(:has(*)),.bs-footer:not(:has(*)),.bs-header[hidden],.bs-footer[hidden]{display:none}.bs-screen{position:absolute;inset:0;pointer-events:none;z-index:var(--bs-z-scrim);background:var(--bs-scrim-color,var(--bs-scrim-color-d));backdrop-filter:blur(var(--bs-scrim-blur,0px));-webkit-backdrop-filter:blur(var(--bs-scrim-blur,0px));transition:opacity 0.24s cubic-bezier(0.22,1,0.36,1);will-change:opacity}.bs-root[data-dragging="true"] .bs-screen,.bs-root[data-animating="true"] .bs-screen{transition:none}.bs-scrim-overlay{z-index:calc(var(--bs-z-sheet) + 1);pointer-events:none}.bs-button-slot{position:fixed;z-index:calc(var(--bs-z-sheet) + 1);pointer-events:auto}.bs-button-slot[data-side="left"]{left:16px;bottom:calc(var(--bs-size,0px) + 12px)}.bs-button-slot[data-side="right"]{right:16px;bottom:calc(var(--bs-size,0px) + 12px)}.bs-button-slot[data-mode="top"]{bottom:auto;top:calc(var(--bs-size,0px) + 12px)}.bs-button-slot[data-mode="left"]{left:calc(var(--bs-size,0px) + 12px);right:auto;bottom:auto;top:16px}.bs-button-slot[data-mode="right"]{right:calc(var(--bs-size,0px) + 12px);left:auto;bottom:auto;top:16px}@media (prefers-reduced-motion:reduce){.bs-backdrop,.bs-handle::before,.bs-button-slot[data-side="left"],.bs-button-slot[data-side="right"]{transition:none !important}}@media (prefers-color-scheme:dark){:where(.bs-root){--bs-surface-d:#1a1a1d;--bs-surface-border-d:rgba(255,255,255,0.08);--bs-handle-color-d:rgba(255,255,255,0.45);--bs-shadow-auto:0 -3px 16px rgba(0,0,0,0.5)}}@media (forced-colors:active){.bs-sheet{border:1px solid CanvasText}.bs-handle::before{background:CanvasText;forced-color-adjust:none}.bs-backdrop,.bs-screen{forced-color-adjust:none}}.bs-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}:where(.ovl-root){--ovl-surface:var(--bs-surface,var(--bs-surface-d,#ffffff));--ovl-surface-border:var(--bs-surface-border,var(--bs-surface-border-d,rgba(0,0,0,0.08)));--ovl-shadow:0 -8px 40px rgba(0,0,0,0.35);--ovl-radius:var(--bs-radius,var(--bs-radius-d,20px));--ovl-backdrop-color:rgba(0,0,0,0.5);--ovl-z-backdrop:200;--ovl-z-panel:201}.ovl-backdrop{position:fixed;inset:0;background:var(--ovl-backdrop-color);opacity:0;pointer-events:none;z-index:var(--ovl-z-backdrop)}.ovl-panel{position:fixed;background:var(--ovl-surface);box-shadow:var(--ovl-shadow);z-index:var(--ovl-z-panel);-webkit-tap-highlight-color:transparent;outline:none;transition:transform 0.32s cubic-bezier(0.29,1.24,0.84,0.99),opacity 0.32s ease-out}.ovl-panel[data-state="open"]{transform:translate3d(0,0,0);opacity:1}@starting-style{.ovl-panel[data-edge="bottom"][data-state="open"]{transform:translate3d(0,100%,0);opacity:0}.ovl-panel[data-edge="top"][data-state="open"]{transform:translate3d(0,-100%,0);opacity:0}.ovl-panel[data-edge="left"][data-state="open"]{transform:translate3d(-100%,0,0);opacity:0}.ovl-panel[data-edge="right"][data-state="open"]{transform:translate3d(100%,0,0);opacity:0}}.ovl-panel[data-edge="bottom"]{left:0;right:0;bottom:0;width:100%;border-top-left-radius:var(--ovl-radius);border-top-right-radius:var(--ovl-radius);border-top:1px solid var(--ovl-surface-border);padding-bottom:env(safe-area-inset-bottom)}.ovl-panel[data-edge="top"]{left:0;right:0;top:0;width:100%;border-bottom-left-radius:var(--ovl-radius);border-bottom-right-radius:var(--ovl-radius);border-bottom:1px solid var(--ovl-surface-border);padding-top:env(safe-area-inset-top)}.ovl-panel[data-edge="left"]{top:0;bottom:0;left:0;height:100%;border-top-right-radius:var(--ovl-radius);border-bottom-right-radius:var(--ovl-radius);border-right:1px solid var(--ovl-surface-border)}.ovl-panel[data-edge="right"]{top:0;bottom:0;right:0;height:100%;border-top-left-radius:var(--ovl-radius);border-bottom-left-radius:var(--ovl-radius);border-left:1px solid var(--ovl-surface-border)}@media (prefers-reduced-motion:reduce){.ovl-panel,.ovl-backdrop{transition:none !important}}`;
4678
4693
  }
4679
4694
  });
4680
4695
 
package/dist/features.cjs CHANGED
@@ -486,6 +486,7 @@ function contentFitFeature() {
486
486
  let inset = 0;
487
487
  let unpaddedMax = -1;
488
488
  let top = 0;
489
+ let resting = false;
489
490
  const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
490
491
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
491
492
  const follow = (size) => {
@@ -502,32 +503,46 @@ function contentFitFeature() {
502
503
  const settle = () => {
503
504
  if (ctx.isDestroyed()) return;
504
505
  const size = ctx.getSize();
505
- unpaddedMax = -1;
506
- follow(size);
506
+ if (!resting) {
507
+ unpaddedMax = -1;
508
+ follow(size);
509
+ }
507
510
  inset = hiddenAt(size);
508
- put(LIFT_VAR, scroller.offsetHeight);
509
511
  put(INSET_VAR, inset);
510
512
  put(SIZE_VAR, size);
511
513
  put(CAP_VAR, ctx.getMaxAxisSize());
514
+ if (!resting) {
515
+ resting = true;
516
+ sheet.setAttribute(FIT_ATTR, "rest");
517
+ }
512
518
  unpaddedMax = -1;
513
519
  };
520
+ const move = (size) => {
521
+ if (resting) {
522
+ resting = false;
523
+ sheet.setAttribute(FIT_ATTR, "moving");
524
+ put(LIFT_VAR, scroller.offsetHeight);
525
+ }
526
+ follow(size);
527
+ };
514
528
  const moving = () => ctx.isAnimating() || ctx.isDragging();
515
529
  const whenIdle = () => {
516
530
  if (!moving()) settle();
517
531
  };
518
- sheet.setAttribute(FIT_ATTR, "");
519
532
  settle();
520
533
  const offProgress = ctx.on(
521
534
  "progress",
522
- (p) => moving() ? follow(p.size) : settle()
535
+ (p) => moving() ? move(p.size) : settle()
523
536
  );
524
537
  const offSnap = ctx.on("snap", settle);
538
+ const offDragStart = ctx.on("dragstart", () => move(ctx.getSize()));
525
539
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
526
540
  observer?.observe(document.documentElement);
527
541
  window.addEventListener("orientationchange", whenIdle);
528
542
  return () => {
529
543
  offProgress();
530
544
  offSnap();
545
+ offDragStart();
531
546
  observer?.disconnect();
532
547
  window.removeEventListener("orientationchange", whenIdle);
533
548
  sheet.removeAttribute(FIT_ATTR);
package/dist/features.js CHANGED
@@ -484,6 +484,7 @@ function contentFitFeature() {
484
484
  let inset = 0;
485
485
  let unpaddedMax = -1;
486
486
  let top = 0;
487
+ let resting = false;
487
488
  const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
488
489
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
489
490
  const follow = (size) => {
@@ -500,32 +501,46 @@ function contentFitFeature() {
500
501
  const settle = () => {
501
502
  if (ctx.isDestroyed()) return;
502
503
  const size = ctx.getSize();
503
- unpaddedMax = -1;
504
- follow(size);
504
+ if (!resting) {
505
+ unpaddedMax = -1;
506
+ follow(size);
507
+ }
505
508
  inset = hiddenAt(size);
506
- put(LIFT_VAR, scroller.offsetHeight);
507
509
  put(INSET_VAR, inset);
508
510
  put(SIZE_VAR, size);
509
511
  put(CAP_VAR, ctx.getMaxAxisSize());
512
+ if (!resting) {
513
+ resting = true;
514
+ sheet.setAttribute(FIT_ATTR, "rest");
515
+ }
510
516
  unpaddedMax = -1;
511
517
  };
518
+ const move = (size) => {
519
+ if (resting) {
520
+ resting = false;
521
+ sheet.setAttribute(FIT_ATTR, "moving");
522
+ put(LIFT_VAR, scroller.offsetHeight);
523
+ }
524
+ follow(size);
525
+ };
512
526
  const moving = () => ctx.isAnimating() || ctx.isDragging();
513
527
  const whenIdle = () => {
514
528
  if (!moving()) settle();
515
529
  };
516
- sheet.setAttribute(FIT_ATTR, "");
517
530
  settle();
518
531
  const offProgress = ctx.on(
519
532
  "progress",
520
- (p) => moving() ? follow(p.size) : settle()
533
+ (p) => moving() ? move(p.size) : settle()
521
534
  );
522
535
  const offSnap = ctx.on("snap", settle);
536
+ const offDragStart = ctx.on("dragstart", () => move(ctx.getSize()));
523
537
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
524
538
  observer?.observe(document.documentElement);
525
539
  window.addEventListener("orientationchange", whenIdle);
526
540
  return () => {
527
541
  offProgress();
528
542
  offSnap();
543
+ offDragStart();
529
544
  observer?.disconnect();
530
545
  window.removeEventListener("orientationchange", whenIdle);
531
546
  sheet.removeAttribute(FIT_ATTR);
package/dist/index.cjs 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);
package/dist/index.js CHANGED
@@ -4259,6 +4259,7 @@ function contentFitFeature() {
4259
4259
  let inset = 0;
4260
4260
  let unpaddedMax = -1;
4261
4261
  let top = 0;
4262
+ let resting = false;
4262
4263
  const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
4263
4264
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4264
4265
  const follow = (size) => {
@@ -4275,32 +4276,46 @@ function contentFitFeature() {
4275
4276
  const settle = () => {
4276
4277
  if (ctx.isDestroyed()) return;
4277
4278
  const size = ctx.getSize();
4278
- unpaddedMax = -1;
4279
- follow(size);
4279
+ if (!resting) {
4280
+ unpaddedMax = -1;
4281
+ follow(size);
4282
+ }
4280
4283
  inset = hiddenAt(size);
4281
- put(LIFT_VAR, scroller.offsetHeight);
4282
4284
  put(INSET_VAR, inset);
4283
4285
  put(SIZE_VAR, size);
4284
4286
  put(CAP_VAR, ctx.getMaxAxisSize());
4287
+ if (!resting) {
4288
+ resting = true;
4289
+ sheet.setAttribute(FIT_ATTR, "rest");
4290
+ }
4285
4291
  unpaddedMax = -1;
4286
4292
  };
4293
+ const move = (size) => {
4294
+ if (resting) {
4295
+ resting = false;
4296
+ sheet.setAttribute(FIT_ATTR, "moving");
4297
+ put(LIFT_VAR, scroller.offsetHeight);
4298
+ }
4299
+ follow(size);
4300
+ };
4287
4301
  const moving = () => ctx.isAnimating() || ctx.isDragging();
4288
4302
  const whenIdle = () => {
4289
4303
  if (!moving()) settle();
4290
4304
  };
4291
- sheet.setAttribute(FIT_ATTR, "");
4292
4305
  settle();
4293
4306
  const offProgress = ctx.on(
4294
4307
  "progress",
4295
- (p) => moving() ? follow(p.size) : settle()
4308
+ (p) => moving() ? move(p.size) : settle()
4296
4309
  );
4297
4310
  const offSnap = ctx.on("snap", settle);
4311
+ const offDragStart = ctx.on("dragstart", () => move(ctx.getSize()));
4298
4312
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
4299
4313
  observer?.observe(document.documentElement);
4300
4314
  window.addEventListener("orientationchange", whenIdle);
4301
4315
  return () => {
4302
4316
  offProgress();
4303
4317
  offSnap();
4318
+ offDragStart();
4304
4319
  observer?.disconnect();
4305
4320
  window.removeEventListener("orientationchange", whenIdle);
4306
4321
  sheet.removeAttribute(FIT_ATTR);
@@ -4249,6 +4249,7 @@ function contentFitFeature() {
4249
4249
  let inset = 0;
4250
4250
  let unpaddedMax = -1;
4251
4251
  let top = 0;
4252
+ let resting = false;
4252
4253
  const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
4253
4254
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4254
4255
  const follow = (size) => {
@@ -4265,29 +4266,43 @@ function contentFitFeature() {
4265
4266
  const settle = () => {
4266
4267
  if (ctx.isDestroyed()) return;
4267
4268
  const size = ctx.getSize();
4268
- unpaddedMax = -1;
4269
- follow(size);
4269
+ if (!resting) {
4270
+ unpaddedMax = -1;
4271
+ follow(size);
4272
+ }
4270
4273
  inset = hiddenAt(size);
4271
- put(LIFT_VAR, scroller.offsetHeight);
4272
4274
  put(INSET_VAR, inset);
4273
4275
  put(SIZE_VAR, size);
4274
4276
  put(CAP_VAR, ctx.getMaxAxisSize());
4277
+ if (!resting) {
4278
+ resting = true;
4279
+ sheet.setAttribute(FIT_ATTR, "rest");
4280
+ }
4275
4281
  unpaddedMax = -1;
4276
4282
  };
4283
+ const move = (size) => {
4284
+ if (resting) {
4285
+ resting = false;
4286
+ sheet.setAttribute(FIT_ATTR, "moving");
4287
+ put(LIFT_VAR, scroller.offsetHeight);
4288
+ }
4289
+ follow(size);
4290
+ };
4277
4291
  const moving = () => ctx.isAnimating() || ctx.isDragging();
4278
4292
  const whenIdle = () => {
4279
4293
  if (!moving()) settle();
4280
4294
  };
4281
- sheet.setAttribute(FIT_ATTR, "");
4282
4295
  settle();
4283
- const offProgress = ctx.on("progress", (p) => moving() ? follow(p.size) : settle());
4296
+ const offProgress = ctx.on("progress", (p) => moving() ? move(p.size) : settle());
4284
4297
  const offSnap = ctx.on("snap", settle);
4298
+ const offDragStart = ctx.on("dragstart", () => move(ctx.getSize()));
4285
4299
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
4286
4300
  observer?.observe(document.documentElement);
4287
4301
  window.addEventListener("orientationchange", whenIdle);
4288
4302
  return () => {
4289
4303
  offProgress();
4290
4304
  offSnap();
4305
+ offDragStart();
4291
4306
  observer?.disconnect();
4292
4307
  window.removeEventListener("orientationchange", whenIdle);
4293
4308
  sheet.removeAttribute(FIT_ATTR);
@@ -4247,6 +4247,7 @@ function contentFitFeature() {
4247
4247
  let inset = 0;
4248
4248
  let unpaddedMax = -1;
4249
4249
  let top = 0;
4250
+ let resting = false;
4250
4251
  const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
4251
4252
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4252
4253
  const follow = (size) => {
@@ -4263,29 +4264,43 @@ function contentFitFeature() {
4263
4264
  const settle = () => {
4264
4265
  if (ctx.isDestroyed()) return;
4265
4266
  const size = ctx.getSize();
4266
- unpaddedMax = -1;
4267
- follow(size);
4267
+ if (!resting) {
4268
+ unpaddedMax = -1;
4269
+ follow(size);
4270
+ }
4268
4271
  inset = hiddenAt(size);
4269
- put(LIFT_VAR, scroller.offsetHeight);
4270
4272
  put(INSET_VAR, inset);
4271
4273
  put(SIZE_VAR, size);
4272
4274
  put(CAP_VAR, ctx.getMaxAxisSize());
4275
+ if (!resting) {
4276
+ resting = true;
4277
+ sheet.setAttribute(FIT_ATTR, "rest");
4278
+ }
4273
4279
  unpaddedMax = -1;
4274
4280
  };
4281
+ const move = (size) => {
4282
+ if (resting) {
4283
+ resting = false;
4284
+ sheet.setAttribute(FIT_ATTR, "moving");
4285
+ put(LIFT_VAR, scroller.offsetHeight);
4286
+ }
4287
+ follow(size);
4288
+ };
4275
4289
  const moving = () => ctx.isAnimating() || ctx.isDragging();
4276
4290
  const whenIdle = () => {
4277
4291
  if (!moving()) settle();
4278
4292
  };
4279
- sheet.setAttribute(FIT_ATTR, "");
4280
4293
  settle();
4281
- const offProgress = ctx.on("progress", (p) => moving() ? follow(p.size) : settle());
4294
+ const offProgress = ctx.on("progress", (p) => moving() ? move(p.size) : settle());
4282
4295
  const offSnap = ctx.on("snap", settle);
4296
+ const offDragStart = ctx.on("dragstart", () => move(ctx.getSize()));
4283
4297
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
4284
4298
  observer?.observe(document.documentElement);
4285
4299
  window.addEventListener("orientationchange", whenIdle);
4286
4300
  return () => {
4287
4301
  offProgress();
4288
4302
  offSnap();
4303
+ offDragStart();
4289
4304
  observer?.disconnect();
4290
4305
  window.removeEventListener("orientationchange", whenIdle);
4291
4306
  sheet.removeAttribute(FIT_ATTR);
package/dist/qwik.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/qwik.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);
package/dist/react.cjs CHANGED
@@ -4271,6 +4271,7 @@ function contentFitFeature() {
4271
4271
  let inset = 0;
4272
4272
  let unpaddedMax = -1;
4273
4273
  let top = 0;
4274
+ let resting = false;
4274
4275
  const put = (name, px) => sheet.style.setProperty(name, `${px}px`);
4275
4276
  const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4276
4277
  const follow = (size) => {
@@ -4287,32 +4288,46 @@ function contentFitFeature() {
4287
4288
  const settle = () => {
4288
4289
  if (ctx.isDestroyed()) return;
4289
4290
  const size = ctx.getSize();
4290
- unpaddedMax = -1;
4291
- follow(size);
4291
+ if (!resting) {
4292
+ unpaddedMax = -1;
4293
+ follow(size);
4294
+ }
4292
4295
  inset = hiddenAt(size);
4293
- put(LIFT_VAR, scroller.offsetHeight);
4294
4296
  put(INSET_VAR, inset);
4295
4297
  put(SIZE_VAR, size);
4296
4298
  put(CAP_VAR, ctx.getMaxAxisSize());
4299
+ if (!resting) {
4300
+ resting = true;
4301
+ sheet.setAttribute(FIT_ATTR, "rest");
4302
+ }
4297
4303
  unpaddedMax = -1;
4298
4304
  };
4305
+ const move = (size) => {
4306
+ if (resting) {
4307
+ resting = false;
4308
+ sheet.setAttribute(FIT_ATTR, "moving");
4309
+ put(LIFT_VAR, scroller.offsetHeight);
4310
+ }
4311
+ follow(size);
4312
+ };
4299
4313
  const moving = () => ctx.isAnimating() || ctx.isDragging();
4300
4314
  const whenIdle = () => {
4301
4315
  if (!moving()) settle();
4302
4316
  };
4303
- sheet.setAttribute(FIT_ATTR, "");
4304
4317
  settle();
4305
4318
  const offProgress = ctx.on(
4306
4319
  "progress",
4307
- (p) => moving() ? follow(p.size) : settle()
4320
+ (p) => moving() ? move(p.size) : settle()
4308
4321
  );
4309
4322
  const offSnap = ctx.on("snap", settle);
4323
+ const offDragStart = ctx.on("dragstart", () => move(ctx.getSize()));
4310
4324
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
4311
4325
  observer?.observe(document.documentElement);
4312
4326
  window.addEventListener("orientationchange", whenIdle);
4313
4327
  return () => {
4314
4328
  offProgress();
4315
4329
  offSnap();
4330
+ offDragStart();
4316
4331
  observer?.disconnect();
4317
4332
  window.removeEventListener("orientationchange", whenIdle);
4318
4333
  sheet.removeAttribute(FIT_ATTR);