@surdeddd/bottom-sheet 0.8.0 → 0.8.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/vue.js CHANGED
@@ -2926,7 +2926,10 @@ var BottomSheetEngine = class {
2926
2926
  cs.flex = "none";
2927
2927
  if (vertical) cs.height = "auto";
2928
2928
  else cs.width = "auto";
2929
- const natural = vertical ? el.offsetHeight : el.offsetWidth;
2929
+ const poked = vertical ? el.offsetHeight : el.offsetWidth;
2930
+ const contentBox = vertical ? content.clientHeight : content.clientWidth;
2931
+ const contentScroll = vertical ? content.scrollHeight : content.scrollWidth;
2932
+ const natural = Math.max(poked, poked - contentBox + contentScroll);
2930
2933
  sheetStyle[axis] = prevSheet;
2931
2934
  cs.flex = prevFlex;
2932
2935
  if (vertical) cs.height = prevContent;
@@ -2938,9 +2941,21 @@ var BottomSheetEngine = class {
2938
2941
  const natural = this.measureSheetNatural(vertical);
2939
2942
  const capped = this.maxHeightCap !== void 0 ? Math.min(natural, this.maxHeightCap) : natural;
2940
2943
  if (typeof window === "undefined") return capped;
2941
- const viewport = vertical ? window.innerHeight : window.innerWidth;
2944
+ const viewport = this.containingExtent(vertical);
2942
2945
  return viewport > 0 ? Math.min(capped, viewport) : capped;
2943
2946
  }
2947
+ // The fit cap is the sheet's containing block, not always the window: a
2948
+ // position:fixed sheet nested under a transform/filter/will-change ancestor
2949
+ // is clipped to that ancestor, so capping by window.innerHeight oversizes the
2950
+ // sheet and the content/footer get clipped. offsetParent resolves to that
2951
+ // ancestor when present, and is null (→ viewport) for a plain fixed sheet.
2952
+ containingExtent(vertical) {
2953
+ const op = this.element.offsetParent;
2954
+ if (op && op !== document.body && op !== document.documentElement) {
2955
+ return vertical ? op.clientHeight : op.clientWidth;
2956
+ }
2957
+ return vertical ? window.innerHeight : window.innerWidth;
2958
+ }
2944
2959
  installFitObserver() {
2945
2960
  if (typeof ResizeObserver === "undefined") return;
2946
2961
  if (!this.snapPointsRaw.some((p) => p.size === "fit" || p.size === "content"))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surdeddd/bottom-sheet",
3
- "version": "0.8.0",
3
+ "version": "0.8.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",