@surdeddd/bottom-sheet 0.8.0 → 0.8.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/vue.cjs CHANGED
@@ -2928,7 +2928,10 @@ var BottomSheetEngine = class {
2928
2928
  cs.flex = "none";
2929
2929
  if (vertical) cs.height = "auto";
2930
2930
  else cs.width = "auto";
2931
- const natural = vertical ? el.offsetHeight : el.offsetWidth;
2931
+ const poked = vertical ? el.offsetHeight : el.offsetWidth;
2932
+ const contentBox = vertical ? content.clientHeight : content.clientWidth;
2933
+ const contentScroll = vertical ? content.scrollHeight : content.scrollWidth;
2934
+ const natural = Math.max(poked, poked - contentBox + contentScroll);
2932
2935
  sheetStyle[axis] = prevSheet;
2933
2936
  cs.flex = prevFlex;
2934
2937
  if (vertical) cs.height = prevContent;
@@ -2940,9 +2943,21 @@ var BottomSheetEngine = class {
2940
2943
  const natural = this.measureSheetNatural(vertical);
2941
2944
  const capped = this.maxHeightCap !== void 0 ? Math.min(natural, this.maxHeightCap) : natural;
2942
2945
  if (typeof window === "undefined") return capped;
2943
- const viewport = vertical ? window.innerHeight : window.innerWidth;
2946
+ const viewport = this.containingExtent(vertical);
2944
2947
  return viewport > 0 ? Math.min(capped, viewport) : capped;
2945
2948
  }
2949
+ // The fit cap is the sheet's containing block, not always the window: a
2950
+ // position:fixed sheet nested under a transform/filter/will-change ancestor
2951
+ // is clipped to that ancestor, so capping by window.innerHeight oversizes the
2952
+ // sheet and the content/footer get clipped. offsetParent resolves to that
2953
+ // ancestor when present, and is null (→ viewport) for a plain fixed sheet.
2954
+ containingExtent(vertical) {
2955
+ const op = this.element.offsetParent;
2956
+ if (op && op !== document.body && op !== document.documentElement) {
2957
+ return vertical ? op.clientHeight : op.clientWidth;
2958
+ }
2959
+ return vertical ? window.innerHeight : window.innerWidth;
2960
+ }
2946
2961
  installFitObserver() {
2947
2962
  if (typeof ResizeObserver === "undefined") return;
2948
2963
  if (!this.snapPointsRaw.some((p) => p.size === "fit" || p.size === "content"))
@@ -3493,6 +3508,7 @@ function useBottomSheet(opts) {
3493
3508
  if (!sheetRef.value) return;
3494
3509
  const {
3495
3510
  onSnap,
3511
+ teleport,
3496
3512
  teleportTo,
3497
3513
  backdropColor,
3498
3514
  backdropOpacity,
@@ -3507,7 +3523,7 @@ function useBottomSheet(opts) {
3507
3523
  scrim: screenRef.value ?? void 0
3508
3524
  });
3509
3525
  sync();
3510
- const target = resolveTeleportTarget(teleportTo);
3526
+ const target = teleport === false ? null : resolveTeleportTarget(teleportTo);
3511
3527
  if (target) {
3512
3528
  restoreTeleport = teleportElements(
3513
3529
  [backdropRef.value, screenRef.value, sheetRef.value],
@@ -3772,6 +3788,11 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
3772
3788
  required: false,
3773
3789
  default: "body"
3774
3790
  },
3791
+ teleport: {
3792
+ type: Boolean,
3793
+ required: false,
3794
+ default: true
3795
+ },
3775
3796
  backdropColor: {
3776
3797
  type: String,
3777
3798
  required: false
@@ -3807,11 +3828,6 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
3807
3828
  type: null,
3808
3829
  required: false
3809
3830
  },
3810
- teleport: {
3811
- type: Boolean,
3812
- required: false,
3813
- default: true
3814
- },
3815
3831
  anchors: {
3816
3832
  type: Array,
3817
3833
  required: false
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"))
@@ -3491,6 +3506,7 @@ function useBottomSheet(opts) {
3491
3506
  if (!sheetRef.value) return;
3492
3507
  const {
3493
3508
  onSnap,
3509
+ teleport,
3494
3510
  teleportTo,
3495
3511
  backdropColor,
3496
3512
  backdropOpacity,
@@ -3505,7 +3521,7 @@ function useBottomSheet(opts) {
3505
3521
  scrim: screenRef.value ?? void 0
3506
3522
  });
3507
3523
  sync();
3508
- const target = resolveTeleportTarget(teleportTo);
3524
+ const target = teleport === false ? null : resolveTeleportTarget(teleportTo);
3509
3525
  if (target) {
3510
3526
  restoreTeleport = teleportElements(
3511
3527
  [backdropRef.value, screenRef.value, sheetRef.value],
@@ -3770,6 +3786,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
3770
3786
  required: false,
3771
3787
  default: "body"
3772
3788
  },
3789
+ teleport: {
3790
+ type: Boolean,
3791
+ required: false,
3792
+ default: true
3793
+ },
3773
3794
  backdropColor: {
3774
3795
  type: String,
3775
3796
  required: false
@@ -3805,11 +3826,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
3805
3826
  type: null,
3806
3827
  required: false
3807
3828
  },
3808
- teleport: {
3809
- type: Boolean,
3810
- required: false,
3811
- default: true
3812
- },
3813
3829
  anchors: {
3814
3830
  type: Array,
3815
3831
  required: false
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.2",
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",