@surdeddd/bottom-sheet 0.21.1 → 0.22.0

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.
Files changed (62) hide show
  1. package/README.md +32 -0
  2. package/dist/{BottomSheetCore-CK_mq14p.d.ts → BottomSheetCore-9i-Uh6T3.d.ts} +4 -1
  3. package/dist/{BottomSheetCore-BHv6LPmS.d.cts → BottomSheetCore-CQStdVy2.d.cts} +4 -1
  4. package/dist/{BottomSheetEngine-mmFzIK1Z.d.cts → BottomSheetEngine-CsQWHLNb.d.cts} +1 -1
  5. package/dist/{BottomSheetEngine-wLn6Q2kA.d.ts → BottomSheetEngine-Dn6h-7gF.d.ts} +1 -1
  6. package/dist/core.cjs +25 -7
  7. package/dist/core.d.cts +2 -2
  8. package/dist/core.d.ts +2 -2
  9. package/dist/core.js +25 -7
  10. package/dist/debug.d.cts +1 -1
  11. package/dist/debug.d.ts +1 -1
  12. package/dist/default-features-C3cilcW9.d.ts +11 -0
  13. package/dist/default-features-DkG9aho0.d.cts +11 -0
  14. package/dist/element.cjs +106 -15
  15. package/dist/element.d.cts +2 -2
  16. package/dist/element.d.ts +2 -2
  17. package/dist/element.iife.global.js +2 -2
  18. package/dist/element.js +106 -15
  19. package/dist/features.cjs +65 -1
  20. package/dist/features.d.cts +5 -10
  21. package/dist/features.d.ts +5 -10
  22. package/dist/features.js +65 -2
  23. package/dist/{index-juAyT76E.d.cts → index-CVGC5B5D.d.cts} +1 -1
  24. package/dist/{index-CWKv1Xy4.d.ts → index-CnsJQZp2.d.ts} +1 -1
  25. package/dist/index.cjs +89 -8
  26. package/dist/index.d.cts +5 -5
  27. package/dist/index.d.ts +5 -5
  28. package/dist/index.js +89 -8
  29. package/dist/integrations/formik.d.cts +1 -1
  30. package/dist/integrations/formik.d.ts +1 -1
  31. package/dist/integrations/react-hook-form.d.cts +1 -1
  32. package/dist/integrations/react-hook-form.d.ts +1 -1
  33. package/dist/preact.d.cts +2 -2
  34. package/dist/preact.d.ts +2 -2
  35. package/dist/qwik-lib/index.qwik.cjs +84 -6
  36. package/dist/qwik-lib/index.qwik.mjs +84 -6
  37. package/dist/qwik.cjs +90 -8
  38. package/dist/qwik.d.cts +3 -2
  39. package/dist/qwik.d.ts +3 -2
  40. package/dist/qwik.js +90 -8
  41. package/dist/react.cjs +89 -8
  42. package/dist/react.d.cts +3 -3
  43. package/dist/react.d.ts +3 -3
  44. package/dist/react.js +89 -8
  45. package/dist/solid.cjs +90 -8
  46. package/dist/solid.d.cts +4 -0
  47. package/dist/solid.d.ts +4 -0
  48. package/dist/solid.js +90 -8
  49. package/dist/solid.source.jsx +90 -8
  50. package/dist/styles.css +11 -0
  51. package/dist/svelte-core.cjs +89 -8
  52. package/dist/svelte-core.js +89 -8
  53. package/dist/svelte-src/BottomSheet.svelte +3 -0
  54. package/dist/svelte.cjs +90 -8
  55. package/dist/svelte.d.cts +1 -0
  56. package/dist/svelte.d.ts +1 -0
  57. package/dist/svelte.js +90 -8
  58. package/dist/vue.cjs +93 -8
  59. package/dist/vue.js +93 -8
  60. package/dist/webgl.d.cts +1 -1
  61. package/dist/webgl.d.ts +1 -1
  62. package/package.json +9 -9
package/README.md CHANGED
@@ -250,6 +250,7 @@ type SnapPoint =
250
250
  | `disableDrag` | `false` | Suppress the drag gesture (imperative snaps still work) |
251
251
  | `dragFrom` | `"handle"` | Which regions start a drag: `"handle"`, `"sheet"` (whole sheet), or `"zones"` (only `[data-bs-drag]` subtrees). Defaults to `"sheet"` when no handle is given. `[data-bs-no-drag]` opts a subtree out in every mode. Also `setDragFrom()` / `getDragFrom()` — switching remounts the gesture, no component remount |
252
252
  | `dragFromContent` | `true` | Whether a touch gesture on the scroll container drags the sheet; override per snap point with `{ id, size, dragFromContent: false }`. Also `setDragFromContent()` |
253
+ | `fitContentToSnap` | `false` | Keeps the whole scroll container reachable at every snap point, not only the largest. Off by default; see [Content reachable at every snap](#content-reachable-at-every-snap) |
253
254
  | `radius` | token default | Corner radius (`string` CSS length or `number` px); also `setRadius()` |
254
255
  | `maxHeight` | none | Cap the sheet height. `number` (px) or a string (`"92dvh"`, `"50%"`) re-resolved on viewport / orientation changes |
255
256
  | `returnFocusTo` | opener | Focus target on dismiss — an `HTMLElement`, a selector `string`, or a `() => HTMLElement` factory |
@@ -508,6 +509,37 @@ the order sheets started opening in — a sheet opened while another is still
508
509
  animating stays on top. If you want a single dim level, pass `backdrop={false}`
509
510
  (`:backdrop="false"` in Vue) to the sheets you open on top.
510
511
 
512
+ ### Content reachable at every snap
513
+
514
+ The sheet is always as tall as its largest snap point and is moved with a
515
+ transform; that is what keeps a drag on the compositor. The cost is that below
516
+ the largest snap the bottom of the scroll container sits under the screen edge,
517
+ by exactly `largest snap − current size`. At a half snap you can scroll, but the
518
+ last rows never come into view until the sheet is pulled up.
519
+
520
+ `fitContentToSnap` closes that gap:
521
+
522
+ ```tsx
523
+ <BottomSheet snapPoints={points} fitContentToSnap>
524
+ <LongList />
525
+ </BottomSheet>
526
+ ```
527
+
528
+ When the sheet settles, the engine writes the hidden amount to
529
+ `--bs-content-inset` and the stylesheet turns it into a spacer at the end of
530
+ `.bs-content`, plus a matching `scroll-padding-bottom` so a focused field
531
+ scrolls into the visible band rather than under the edge. That is one layout per
532
+ settle and none per frame, so the motion stays transform-only. While the sheet
533
+ moves, a list that was scrolled to its very end is held in place on screen
534
+ instead of riding up with the sheet and dropping back at the end.
535
+
536
+ It applies to `bottom` sheets. For a scroll container that is not `.bs-content`,
537
+ or one laid out as a flex row, consume the variable yourself:
538
+ `padding-bottom: var(--bs-content-inset, 0px)`. On the slim core add
539
+ `contentFitFeature()` from `@surdeddd/bottom-sheet/features`. This is unrelated
540
+ to `dragFromContent`, which only decides whether a swipe on the content drags
541
+ the sheet or scrolls the list.
542
+
511
543
  ### Scrim, blur & high contrast
512
544
 
513
545
  | Token | Default | Region |
@@ -104,6 +104,7 @@ type EngineOptions = {
104
104
  dragThreshold?: number;
105
105
  dragFrom?: DragFrom;
106
106
  dragFromContent?: boolean;
107
+ fitContentToSnap?: boolean;
107
108
  rubberBand?: boolean;
108
109
  backdropRange?: [number, number];
109
110
  screenRange?: [number, number];
@@ -150,6 +151,7 @@ type EngineFeatureOptions = {
150
151
  closeOnRouteChange: boolean;
151
152
  persistKey?: string;
152
153
  autoCollapseAfter?: number;
154
+ fitContentToSnap: boolean;
153
155
  };
154
156
  type EngineFeatureContext = {
155
157
  element: HTMLElement;
@@ -282,6 +284,7 @@ declare class BottomSheetCore {
282
284
  private lifecycle;
283
285
  private closeOnBack;
284
286
  private routedTo;
287
+ private fitContentToSnap;
285
288
  private persistent;
286
289
  private disableCloseFlag;
287
290
  private disableDragFlag;
@@ -420,4 +423,4 @@ declare class BottomSheetCore {
420
423
  private handleClose;
421
424
  }
422
425
 
423
- export { type AnchorOptions as A, BottomSheetCore as B, type CloseReason as C, type EngineState as E, type LogicalSheetMode as L, type PhysicalSheetMode as P, type SheetEventMap as S, type TeardownScope as T, type SnapPointDef as a, type SheetMode as b, type EngineOptions as c, type SnapPoint as d, type ScrimStagesOptions as e, type EngineFeature as f, type ScrimOverlayPosition as g, type AnchorAnimationPreset as h, type AnchorAnimationSpec as i, type AnchorHandle as j, type AnchorPosition as k, type AnchorState as l, type EngineFeatureContext as m, type EngineFeatureOptions as n, type EngineFeatureStage as o, type Plugin as p, SCRIM_PRESETS as q, type ScrimOverlayOptions as r, type ScrimPreset as s, type ScrimPresetConfig as t, type ScrimStageDef as u, type ScrimUpdate as v, type SnapId as w, runAnchorTransition as x };
426
+ export { type AnchorOptions as A, BottomSheetCore as B, type CloseReason as C, type EngineFeature as E, type LogicalSheetMode as L, type PhysicalSheetMode as P, type SheetEventMap as S, type TeardownScope as T, type EngineFeatureContext as a, type EngineFeatureOptions as b, type EngineFeatureStage as c, type EngineState as d, type SnapPointDef as e, type SheetMode as f, type EngineOptions as g, type SnapPoint as h, type ScrimStagesOptions as i, type ScrimOverlayPosition as j, type AnchorAnimationPreset as k, type AnchorAnimationSpec as l, type AnchorHandle as m, type AnchorPosition as n, type AnchorState as o, type Plugin as p, SCRIM_PRESETS as q, type ScrimOverlayOptions as r, type ScrimPreset as s, type ScrimPresetConfig as t, type ScrimStageDef as u, type ScrimUpdate as v, type SnapId as w, runAnchorTransition as x };
@@ -104,6 +104,7 @@ type EngineOptions = {
104
104
  dragThreshold?: number;
105
105
  dragFrom?: DragFrom;
106
106
  dragFromContent?: boolean;
107
+ fitContentToSnap?: boolean;
107
108
  rubberBand?: boolean;
108
109
  backdropRange?: [number, number];
109
110
  screenRange?: [number, number];
@@ -150,6 +151,7 @@ type EngineFeatureOptions = {
150
151
  closeOnRouteChange: boolean;
151
152
  persistKey?: string;
152
153
  autoCollapseAfter?: number;
154
+ fitContentToSnap: boolean;
153
155
  };
154
156
  type EngineFeatureContext = {
155
157
  element: HTMLElement;
@@ -282,6 +284,7 @@ declare class BottomSheetCore {
282
284
  private lifecycle;
283
285
  private closeOnBack;
284
286
  private routedTo;
287
+ private fitContentToSnap;
285
288
  private persistent;
286
289
  private disableCloseFlag;
287
290
  private disableDragFlag;
@@ -420,4 +423,4 @@ declare class BottomSheetCore {
420
423
  private handleClose;
421
424
  }
422
425
 
423
- export { type AnchorOptions as A, BottomSheetCore as B, type CloseReason as C, type EngineState as E, type LogicalSheetMode as L, type PhysicalSheetMode as P, type SheetEventMap as S, type TeardownScope as T, type SnapPointDef as a, type SheetMode as b, type EngineOptions as c, type SnapPoint as d, type ScrimStagesOptions as e, type EngineFeature as f, type ScrimOverlayPosition as g, type AnchorAnimationPreset as h, type AnchorAnimationSpec as i, type AnchorHandle as j, type AnchorPosition as k, type AnchorState as l, type EngineFeatureContext as m, type EngineFeatureOptions as n, type EngineFeatureStage as o, type Plugin as p, SCRIM_PRESETS as q, type ScrimOverlayOptions as r, type ScrimPreset as s, type ScrimPresetConfig as t, type ScrimStageDef as u, type ScrimUpdate as v, type SnapId as w, runAnchorTransition as x };
426
+ export { type AnchorOptions as A, BottomSheetCore as B, type CloseReason as C, type EngineFeature as E, type LogicalSheetMode as L, type PhysicalSheetMode as P, type SheetEventMap as S, type TeardownScope as T, type EngineFeatureContext as a, type EngineFeatureOptions as b, type EngineFeatureStage as c, type EngineState as d, type SnapPointDef as e, type SheetMode as f, type EngineOptions as g, type SnapPoint as h, type ScrimStagesOptions as i, type ScrimOverlayPosition as j, type AnchorAnimationPreset as k, type AnchorAnimationSpec as l, type AnchorHandle as m, type AnchorPosition as n, type AnchorState as o, type Plugin as p, SCRIM_PRESETS as q, type ScrimOverlayOptions as r, type ScrimPreset as s, type ScrimPresetConfig as t, type ScrimStageDef as u, type ScrimUpdate as v, type SnapId as w, runAnchorTransition as x };
@@ -1,4 +1,4 @@
1
- import { B as BottomSheetCore, c as EngineOptions } from './BottomSheetCore-BHv6LPmS.cjs';
1
+ import { B as BottomSheetCore, g as EngineOptions } from './BottomSheetCore-CQStdVy2.cjs';
2
2
 
3
3
  declare class BottomSheetEngine extends BottomSheetCore {
4
4
  constructor(opts: EngineOptions);
@@ -1,4 +1,4 @@
1
- import { B as BottomSheetCore, c as EngineOptions } from './BottomSheetCore-CK_mq14p.js';
1
+ import { B as BottomSheetCore, g as EngineOptions } from './BottomSheetCore-9i-Uh6T3.js';
2
2
 
3
3
  declare class BottomSheetEngine extends BottomSheetCore {
4
4
  constructor(opts: EngineOptions);
package/dist/core.cjs CHANGED
@@ -375,14 +375,26 @@ function notifyLinkedSheets(sheets, self) {
375
375
  }
376
376
  }
377
377
 
378
+ // src/core/primitives/hot-path-thresholds.ts
379
+ var SIZE_WRITE_EPSILON = 0.5;
380
+ var OPACITY_WRITE_EPSILON = 5e-3;
381
+ var POINTER_EVENTS_OPACITY_THRESHOLD = 0.05;
382
+ var RANGE_DIVISION_EPSILON = 1e-4;
383
+
378
384
  // src/core/features/resize-observer.ts
379
385
  function installResizeObserver(deps) {
380
386
  if (typeof window === "undefined") {
381
387
  return () => {
382
388
  };
383
389
  }
390
+ const seatFor = () => {
391
+ const snap = deps.resolveActiveSnap();
392
+ const max = deps.getMaxAxisSize();
393
+ return { target: snap ? Math.min(snap.size, max) : null, max };
394
+ };
384
395
  const onResize = () => {
385
396
  if (deps.isDestroyed()) return;
397
+ const before = seatFor();
386
398
  deps.recomputeSnaps();
387
399
  const mode = deps.getMode();
388
400
  const isVerticalAxis = mode === "bottom" || mode === "top";
@@ -391,6 +403,10 @@ function installResizeObserver(deps) {
391
403
  if (viewportSize2 > 0 && viewportSize2 < max) {
392
404
  deps.setMaxAxisSize(viewportSize2);
393
405
  }
406
+ const after = seatFor();
407
+ if (before.target !== null && after.target !== null && Math.abs(after.target - before.target) < SIZE_WRITE_EPSILON && Math.abs(after.max - before.max) < SIZE_WRITE_EPSILON) {
408
+ return;
409
+ }
394
410
  const wasAnimating = deps.isAnimating?.() ?? false;
395
411
  deps.cancelInFlight();
396
412
  deps.newCycle();
@@ -659,12 +675,6 @@ var SCRIM_PRESETS = Object.freeze({
659
675
  }
660
676
  });
661
677
 
662
- // src/core/primitives/hot-path-thresholds.ts
663
- var SIZE_WRITE_EPSILON = 0.5;
664
- var OPACITY_WRITE_EPSILON = 5e-3;
665
- var POINTER_EVENTS_OPACITY_THRESHOLD = 0.05;
666
- var RANGE_DIVISION_EPSILON = 1e-4;
667
-
668
678
  // src/core/primitives/opacity-dedup.ts
669
679
  var WriteSentinel = class {
670
680
  constructor() {
@@ -2594,6 +2604,7 @@ var BottomSheetCore = class {
2594
2604
  __publicField(this, "lifecycle");
2595
2605
  __publicField(this, "closeOnBack");
2596
2606
  __publicField(this, "routedTo");
2607
+ __publicField(this, "fitContentToSnap");
2597
2608
  __publicField(this, "persistent");
2598
2609
  __publicField(this, "disableCloseFlag");
2599
2610
  __publicField(this, "disableDragFlag");
@@ -2707,6 +2718,7 @@ var BottomSheetCore = class {
2707
2718
  );
2708
2719
  this.closeOnBack = resolved.closeOnBack;
2709
2720
  this.routedTo = opts.routedTo;
2721
+ this.fitContentToSnap = opts.fitContentToSnap === true;
2710
2722
  this.persistent = resolved.persistent;
2711
2723
  this.disableCloseFlag = resolved.disableClose;
2712
2724
  this.disableDragFlag = resolved.disableDrag;
@@ -2808,7 +2820,8 @@ var BottomSheetCore = class {
2808
2820
  closeOnBack: this.closeOnBack,
2809
2821
  closeOnRouteChange: this.closeOnRouteChange,
2810
2822
  persistKey: this.persistKey,
2811
- autoCollapseAfter
2823
+ autoCollapseAfter,
2824
+ fitContentToSnap: this.fitContentToSnap
2812
2825
  },
2813
2826
  isDestroyed: () => this.destroyed,
2814
2827
  isDragging: () => this.isDraggingAny(),
@@ -2860,6 +2873,11 @@ var BottomSheetCore = class {
2860
2873
  "[BottomSheet] closeOnBack/routedTo/closeOnRouteChange need routeFeature() \u2014 option ignored"
2861
2874
  );
2862
2875
  }
2876
+ if (this.fitContentToSnap && !names.has("content-fit")) {
2877
+ devWarn(
2878
+ "[BottomSheet] fitContentToSnap needs contentFitFeature() \u2014 option ignored"
2879
+ );
2880
+ }
2863
2881
  if (this.persistKey && !names.has("persist")) {
2864
2882
  devWarn(
2865
2883
  "[BottomSheet] persistKey needs persistFeature() \u2014 snaps will not be saved"
package/dist/core.d.cts CHANGED
@@ -1,3 +1,3 @@
1
- export { B as BottomSheetCore, C as CloseReason, f as EngineFeature, m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage, c as EngineOptions, E as EngineState, S as SheetEventMap, b as SheetMode, w as SnapId, d as SnapPoint, a as SnapPointDef } from './BottomSheetCore-BHv6LPmS.cjs';
2
- export { R as ResolvedSnap } from './index-juAyT76E.cjs';
1
+ export { B as BottomSheetCore, C as CloseReason, E as EngineFeature, a as EngineFeatureContext, b as EngineFeatureOptions, c as EngineFeatureStage, g as EngineOptions, d as EngineState, S as SheetEventMap, f as SheetMode, w as SnapId, h as SnapPoint, e as SnapPointDef } from './BottomSheetCore-CQStdVy2.cjs';
2
+ export { R as ResolvedSnap } from './index-CVGC5B5D.cjs';
3
3
  import './transform-jVfAikE9.cjs';
package/dist/core.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { B as BottomSheetCore, C as CloseReason, f as EngineFeature, m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage, c as EngineOptions, E as EngineState, S as SheetEventMap, b as SheetMode, w as SnapId, d as SnapPoint, a as SnapPointDef } from './BottomSheetCore-CK_mq14p.js';
2
- export { R as ResolvedSnap } from './index-CWKv1Xy4.js';
1
+ export { B as BottomSheetCore, C as CloseReason, E as EngineFeature, a as EngineFeatureContext, b as EngineFeatureOptions, c as EngineFeatureStage, g as EngineOptions, d as EngineState, S as SheetEventMap, f as SheetMode, w as SnapId, h as SnapPoint, e as SnapPointDef } from './BottomSheetCore-9i-Uh6T3.js';
2
+ export { R as ResolvedSnap } from './index-CnsJQZp2.js';
3
3
  import './transform-jVfAikE9.js';
package/dist/core.js CHANGED
@@ -373,14 +373,26 @@ function notifyLinkedSheets(sheets, self) {
373
373
  }
374
374
  }
375
375
 
376
+ // src/core/primitives/hot-path-thresholds.ts
377
+ var SIZE_WRITE_EPSILON = 0.5;
378
+ var OPACITY_WRITE_EPSILON = 5e-3;
379
+ var POINTER_EVENTS_OPACITY_THRESHOLD = 0.05;
380
+ var RANGE_DIVISION_EPSILON = 1e-4;
381
+
376
382
  // src/core/features/resize-observer.ts
377
383
  function installResizeObserver(deps) {
378
384
  if (typeof window === "undefined") {
379
385
  return () => {
380
386
  };
381
387
  }
388
+ const seatFor = () => {
389
+ const snap = deps.resolveActiveSnap();
390
+ const max = deps.getMaxAxisSize();
391
+ return { target: snap ? Math.min(snap.size, max) : null, max };
392
+ };
382
393
  const onResize = () => {
383
394
  if (deps.isDestroyed()) return;
395
+ const before = seatFor();
384
396
  deps.recomputeSnaps();
385
397
  const mode = deps.getMode();
386
398
  const isVerticalAxis = mode === "bottom" || mode === "top";
@@ -389,6 +401,10 @@ function installResizeObserver(deps) {
389
401
  if (viewportSize2 > 0 && viewportSize2 < max) {
390
402
  deps.setMaxAxisSize(viewportSize2);
391
403
  }
404
+ const after = seatFor();
405
+ if (before.target !== null && after.target !== null && Math.abs(after.target - before.target) < SIZE_WRITE_EPSILON && Math.abs(after.max - before.max) < SIZE_WRITE_EPSILON) {
406
+ return;
407
+ }
392
408
  const wasAnimating = deps.isAnimating?.() ?? false;
393
409
  deps.cancelInFlight();
394
410
  deps.newCycle();
@@ -657,12 +673,6 @@ var SCRIM_PRESETS = Object.freeze({
657
673
  }
658
674
  });
659
675
 
660
- // src/core/primitives/hot-path-thresholds.ts
661
- var SIZE_WRITE_EPSILON = 0.5;
662
- var OPACITY_WRITE_EPSILON = 5e-3;
663
- var POINTER_EVENTS_OPACITY_THRESHOLD = 0.05;
664
- var RANGE_DIVISION_EPSILON = 1e-4;
665
-
666
676
  // src/core/primitives/opacity-dedup.ts
667
677
  var WriteSentinel = class {
668
678
  constructor() {
@@ -2592,6 +2602,7 @@ var BottomSheetCore = class {
2592
2602
  __publicField(this, "lifecycle");
2593
2603
  __publicField(this, "closeOnBack");
2594
2604
  __publicField(this, "routedTo");
2605
+ __publicField(this, "fitContentToSnap");
2595
2606
  __publicField(this, "persistent");
2596
2607
  __publicField(this, "disableCloseFlag");
2597
2608
  __publicField(this, "disableDragFlag");
@@ -2705,6 +2716,7 @@ var BottomSheetCore = class {
2705
2716
  );
2706
2717
  this.closeOnBack = resolved.closeOnBack;
2707
2718
  this.routedTo = opts.routedTo;
2719
+ this.fitContentToSnap = opts.fitContentToSnap === true;
2708
2720
  this.persistent = resolved.persistent;
2709
2721
  this.disableCloseFlag = resolved.disableClose;
2710
2722
  this.disableDragFlag = resolved.disableDrag;
@@ -2806,7 +2818,8 @@ var BottomSheetCore = class {
2806
2818
  closeOnBack: this.closeOnBack,
2807
2819
  closeOnRouteChange: this.closeOnRouteChange,
2808
2820
  persistKey: this.persistKey,
2809
- autoCollapseAfter
2821
+ autoCollapseAfter,
2822
+ fitContentToSnap: this.fitContentToSnap
2810
2823
  },
2811
2824
  isDestroyed: () => this.destroyed,
2812
2825
  isDragging: () => this.isDraggingAny(),
@@ -2858,6 +2871,11 @@ var BottomSheetCore = class {
2858
2871
  "[BottomSheet] closeOnBack/routedTo/closeOnRouteChange need routeFeature() \u2014 option ignored"
2859
2872
  );
2860
2873
  }
2874
+ if (this.fitContentToSnap && !names.has("content-fit")) {
2875
+ devWarn(
2876
+ "[BottomSheet] fitContentToSnap needs contentFitFeature() \u2014 option ignored"
2877
+ );
2878
+ }
2861
2879
  if (this.persistKey && !names.has("persist")) {
2862
2880
  devWarn(
2863
2881
  "[BottomSheet] persistKey needs persistFeature() \u2014 snaps will not be saved"
package/dist/debug.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { E as EngineState, S as SheetEventMap } from './BottomSheetCore-BHv6LPmS.cjs';
1
+ import { d as EngineState, S as SheetEventMap } from './BottomSheetCore-CQStdVy2.cjs';
2
2
  import './transform-jVfAikE9.cjs';
3
3
 
4
4
  type DebugOverlayPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
package/dist/debug.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { E as EngineState, S as SheetEventMap } from './BottomSheetCore-CK_mq14p.js';
1
+ import { d as EngineState, S as SheetEventMap } from './BottomSheetCore-9i-Uh6T3.js';
2
2
  import './transform-jVfAikE9.js';
3
3
 
4
4
  type DebugOverlayPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
@@ -0,0 +1,11 @@
1
+ import { E as EngineFeature } from './BottomSheetCore-9i-Uh6T3.js';
2
+
3
+ declare function routeFeature(): EngineFeature;
4
+ declare function persistFeature(): EngineFeature;
5
+ declare function autoCollapseFeature(): EngineFeature;
6
+ declare function contentSwipeFeature(): EngineFeature;
7
+ declare function visualViewportFeature(): EngineFeature;
8
+
9
+ declare function defaultEngineFeatures(): EngineFeature[];
10
+
11
+ export { autoCollapseFeature as a, contentSwipeFeature as c, defaultEngineFeatures as d, persistFeature as p, routeFeature as r, visualViewportFeature as v };
@@ -0,0 +1,11 @@
1
+ import { E as EngineFeature } from './BottomSheetCore-CQStdVy2.cjs';
2
+
3
+ declare function routeFeature(): EngineFeature;
4
+ declare function persistFeature(): EngineFeature;
5
+ declare function autoCollapseFeature(): EngineFeature;
6
+ declare function contentSwipeFeature(): EngineFeature;
7
+ declare function visualViewportFeature(): EngineFeature;
8
+
9
+ declare function defaultEngineFeatures(): EngineFeature[];
10
+
11
+ export { autoCollapseFeature as a, contentSwipeFeature as c, defaultEngineFeatures as d, persistFeature as p, routeFeature as r, visualViewportFeature as v };
package/dist/element.cjs CHANGED
@@ -433,14 +433,31 @@ var init_linked_sheets = __esm({
433
433
  }
434
434
  });
435
435
 
436
+ // src/core/primitives/hot-path-thresholds.ts
437
+ var SIZE_WRITE_EPSILON, OPACITY_WRITE_EPSILON, POINTER_EVENTS_OPACITY_THRESHOLD, RANGE_DIVISION_EPSILON;
438
+ var init_hot_path_thresholds = __esm({
439
+ "src/core/primitives/hot-path-thresholds.ts"() {
440
+ SIZE_WRITE_EPSILON = 0.5;
441
+ OPACITY_WRITE_EPSILON = 5e-3;
442
+ POINTER_EVENTS_OPACITY_THRESHOLD = 0.05;
443
+ RANGE_DIVISION_EPSILON = 1e-4;
444
+ }
445
+ });
446
+
436
447
  // src/core/features/resize-observer.ts
437
448
  function installResizeObserver(deps) {
438
449
  if (typeof window === "undefined") {
439
450
  return () => {
440
451
  };
441
452
  }
453
+ const seatFor = () => {
454
+ const snap = deps.resolveActiveSnap();
455
+ const max = deps.getMaxAxisSize();
456
+ return { target: snap ? Math.min(snap.size, max) : null, max };
457
+ };
442
458
  const onResize = () => {
443
459
  if (deps.isDestroyed()) return;
460
+ const before = seatFor();
444
461
  deps.recomputeSnaps();
445
462
  const mode = deps.getMode();
446
463
  const isVerticalAxis = mode === "bottom" || mode === "top";
@@ -449,6 +466,10 @@ function installResizeObserver(deps) {
449
466
  if (viewportSize2 > 0 && viewportSize2 < max) {
450
467
  deps.setMaxAxisSize(viewportSize2);
451
468
  }
469
+ const after = seatFor();
470
+ if (before.target !== null && after.target !== null && Math.abs(after.target - before.target) < SIZE_WRITE_EPSILON && Math.abs(after.max - before.max) < SIZE_WRITE_EPSILON) {
471
+ return;
472
+ }
452
473
  const wasAnimating = deps.isAnimating?.() ?? false;
453
474
  deps.cancelInFlight();
454
475
  deps.newCycle();
@@ -483,6 +504,7 @@ function installResizeObserver(deps) {
483
504
  }
484
505
  var init_resize_observer = __esm({
485
506
  "src/core/features/resize-observer.ts"() {
507
+ init_hot_path_thresholds();
486
508
  }
487
509
  });
488
510
 
@@ -747,17 +769,6 @@ var init_types = __esm({
747
769
  }
748
770
  });
749
771
 
750
- // src/core/primitives/hot-path-thresholds.ts
751
- var SIZE_WRITE_EPSILON, OPACITY_WRITE_EPSILON, POINTER_EVENTS_OPACITY_THRESHOLD, RANGE_DIVISION_EPSILON;
752
- var init_hot_path_thresholds = __esm({
753
- "src/core/primitives/hot-path-thresholds.ts"() {
754
- SIZE_WRITE_EPSILON = 0.5;
755
- OPACITY_WRITE_EPSILON = 5e-3;
756
- POINTER_EVENTS_OPACITY_THRESHOLD = 0.05;
757
- RANGE_DIVISION_EPSILON = 1e-4;
758
- }
759
- });
760
-
761
772
  // src/core/primitives/opacity-dedup.ts
762
773
  var WriteSentinel;
763
774
  var init_opacity_dedup = __esm({
@@ -2872,6 +2883,7 @@ var init_BottomSheetCore = __esm({
2872
2883
  __publicField(this, "lifecycle");
2873
2884
  __publicField(this, "closeOnBack");
2874
2885
  __publicField(this, "routedTo");
2886
+ __publicField(this, "fitContentToSnap");
2875
2887
  __publicField(this, "persistent");
2876
2888
  __publicField(this, "disableCloseFlag");
2877
2889
  __publicField(this, "disableDragFlag");
@@ -2985,6 +2997,7 @@ var init_BottomSheetCore = __esm({
2985
2997
  );
2986
2998
  this.closeOnBack = resolved.closeOnBack;
2987
2999
  this.routedTo = opts.routedTo;
3000
+ this.fitContentToSnap = opts.fitContentToSnap === true;
2988
3001
  this.persistent = resolved.persistent;
2989
3002
  this.disableCloseFlag = resolved.disableClose;
2990
3003
  this.disableDragFlag = resolved.disableDrag;
@@ -3086,7 +3099,8 @@ var init_BottomSheetCore = __esm({
3086
3099
  closeOnBack: this.closeOnBack,
3087
3100
  closeOnRouteChange: this.closeOnRouteChange,
3088
3101
  persistKey: this.persistKey,
3089
- autoCollapseAfter
3102
+ autoCollapseAfter,
3103
+ fitContentToSnap: this.fitContentToSnap
3090
3104
  },
3091
3105
  isDestroyed: () => this.destroyed,
3092
3106
  isDragging: () => this.isDraggingAny(),
@@ -3138,6 +3152,11 @@ var init_BottomSheetCore = __esm({
3138
3152
  "[BottomSheet] closeOnBack/routedTo/closeOnRouteChange need routeFeature() \u2014 option ignored"
3139
3153
  );
3140
3154
  }
3155
+ if (this.fitContentToSnap && !names.has("content-fit")) {
3156
+ devWarn(
3157
+ "[BottomSheet] fitContentToSnap needs contentFitFeature() \u2014 option ignored"
3158
+ );
3159
+ }
3141
3160
  if (this.persistKey && !names.has("persist")) {
3142
3161
  devWarn(
3143
3162
  "[BottomSheet] persistKey needs persistFeature() \u2014 snaps will not be saved"
@@ -4534,6 +4553,73 @@ var init_engine_features = __esm({
4534
4553
  }
4535
4554
  });
4536
4555
 
4556
+ // src/core/features/content-fit.ts
4557
+ function contentFitFeature() {
4558
+ return {
4559
+ name: "content-fit",
4560
+ install: (ctx) => {
4561
+ const scroller = ctx.scrollContainer;
4562
+ if (!ctx.options.fitContentToSnap || !scroller || typeof window === "undefined") {
4563
+ return;
4564
+ }
4565
+ const sheet = ctx.element;
4566
+ let inset = 0;
4567
+ let unpaddedMax = -1;
4568
+ let top = 0;
4569
+ const hiddenAt = (size) => sheet.dataset.mode === "bottom" ? Math.max(0, ctx.getMaxAxisSize() - size) : 0;
4570
+ const follow = (size) => {
4571
+ if (unpaddedMax < 0) {
4572
+ unpaddedMax = scroller.scrollHeight - scroller.clientHeight - inset;
4573
+ top = scroller.scrollTop;
4574
+ }
4575
+ const limit = Math.max(0, unpaddedMax + hiddenAt(size));
4576
+ if (top > limit) {
4577
+ if (scroller.scrollTop > limit) scroller.scrollTop = limit;
4578
+ top = limit;
4579
+ }
4580
+ };
4581
+ const settle = () => {
4582
+ if (ctx.isDestroyed()) return;
4583
+ const size = ctx.getSize();
4584
+ unpaddedMax = -1;
4585
+ follow(size);
4586
+ inset = hiddenAt(size);
4587
+ sheet.style.setProperty(INSET_VAR, `${inset}px`);
4588
+ unpaddedMax = -1;
4589
+ };
4590
+ const moving = () => ctx.isAnimating() || ctx.isDragging();
4591
+ const whenIdle = () => {
4592
+ if (!moving()) settle();
4593
+ };
4594
+ sheet.setAttribute(FIT_ATTR, "");
4595
+ settle();
4596
+ const offProgress = ctx.on(
4597
+ "progress",
4598
+ (p) => moving() ? follow(p.size) : settle()
4599
+ );
4600
+ const offSnap = ctx.on("snap", settle);
4601
+ const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(whenIdle);
4602
+ observer?.observe(document.documentElement);
4603
+ window.addEventListener("orientationchange", whenIdle);
4604
+ return () => {
4605
+ offProgress();
4606
+ offSnap();
4607
+ observer?.disconnect();
4608
+ window.removeEventListener("orientationchange", whenIdle);
4609
+ sheet.removeAttribute(FIT_ATTR);
4610
+ sheet.style.removeProperty(INSET_VAR);
4611
+ };
4612
+ }
4613
+ };
4614
+ }
4615
+ var INSET_VAR, FIT_ATTR;
4616
+ var init_content_fit = __esm({
4617
+ "src/core/features/content-fit.ts"() {
4618
+ INSET_VAR = "--bs-content-inset";
4619
+ FIT_ATTR = "data-bs-fit-content";
4620
+ }
4621
+ });
4622
+
4537
4623
  // src/core/default-features.ts
4538
4624
  function defaultEngineFeatures() {
4539
4625
  return [
@@ -4541,12 +4627,14 @@ function defaultEngineFeatures() {
4541
4627
  visualViewportFeature(),
4542
4628
  persistFeature(),
4543
4629
  autoCollapseFeature(),
4544
- routeFeature()
4630
+ routeFeature(),
4631
+ contentFitFeature()
4545
4632
  ];
4546
4633
  }
4547
4634
  var init_default_features = __esm({
4548
4635
  "src/core/default-features.ts"() {
4549
4636
  init_engine_features();
4637
+ init_content_fit();
4550
4638
  }
4551
4639
  });
4552
4640
 
@@ -4571,7 +4659,7 @@ var init_BottomSheetEngine = __esm({
4571
4659
  var baseStyles;
4572
4660
  var init_baseStyles = __esm({
4573
4661
  "src/web-component/baseStyles.ts"() {
4574
- 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-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-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}}`;
4662
+ 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-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}}`;
4575
4663
  }
4576
4664
  });
4577
4665
 
@@ -4668,7 +4756,7 @@ var init_shadow_tree = __esm({
4668
4756
  });
4669
4757
 
4670
4758
  // src/web-component/attributes.ts
4671
- var ATTR_SNAP_POINTS, ATTR_ALLOWED, ATTR_INITIAL, ATTR_MODE, ATTR_BACKDROP, ATTR_STYLESHEET, ATTR_ANIMATION, ATTR_FOCUS_TRAP, ATTR_CLOSE_ON_ESCAPE, ATTR_LOCK_BODY_SCROLL, ATTR_SHEET_LABEL, ATTR_STACK_EFFECT, ATTR_PERSISTENT, ATTR_DISABLE_CLOSE, ATTR_DISABLE_DRAG, ATTR_DRAG_FROM, ATTR_DRAG_FROM_CONTENT, ATTR_CLOSE_ON_ROUTE_CHANGE, ATTR_RADIUS, ATTR_MAX_HEIGHT, ATTR_RETURN_FOCUS_TO, ATTR_BACKDROP_COLOR, ATTR_SCRIM_COLOR, ATTR_SNAP, LIVE_ATTRS, OBSERVED_ATTRS, isValidSnapPoint, DEFAULT_SNAP_POINTS, parseSnapPoints, VALID_MODES, VALID_ANIMATIONS, parseMode, parseAnimation, VALID_DRAG_FROM, parseDragFrom, parseList, parseDimension, ANCHOR_POSITIONS, ANCHOR_ANIMATIONS, parseAnchorOptions;
4759
+ var ATTR_SNAP_POINTS, ATTR_ALLOWED, ATTR_INITIAL, ATTR_MODE, ATTR_BACKDROP, ATTR_STYLESHEET, ATTR_ANIMATION, ATTR_FOCUS_TRAP, ATTR_CLOSE_ON_ESCAPE, ATTR_LOCK_BODY_SCROLL, ATTR_SHEET_LABEL, ATTR_STACK_EFFECT, ATTR_PERSISTENT, ATTR_DISABLE_CLOSE, ATTR_DISABLE_DRAG, ATTR_DRAG_FROM, ATTR_DRAG_FROM_CONTENT, ATTR_FIT_CONTENT_TO_SNAP, ATTR_CLOSE_ON_ROUTE_CHANGE, ATTR_RADIUS, ATTR_MAX_HEIGHT, ATTR_RETURN_FOCUS_TO, ATTR_BACKDROP_COLOR, ATTR_SCRIM_COLOR, ATTR_SNAP, LIVE_ATTRS, OBSERVED_ATTRS, isValidSnapPoint, DEFAULT_SNAP_POINTS, parseSnapPoints, VALID_MODES, VALID_ANIMATIONS, parseMode, parseAnimation, VALID_DRAG_FROM, parseDragFrom, parseList, parseDimension, ANCHOR_POSITIONS, ANCHOR_ANIMATIONS, parseAnchorOptions;
4672
4760
  var init_attributes = __esm({
4673
4761
  "src/web-component/attributes.ts"() {
4674
4762
  ATTR_SNAP_POINTS = "snap-points";
@@ -4688,6 +4776,7 @@ var init_attributes = __esm({
4688
4776
  ATTR_DISABLE_DRAG = "disable-drag";
4689
4777
  ATTR_DRAG_FROM = "drag-from";
4690
4778
  ATTR_DRAG_FROM_CONTENT = "drag-from-content";
4779
+ ATTR_FIT_CONTENT_TO_SNAP = "fit-content-to-snap";
4691
4780
  ATTR_CLOSE_ON_ROUTE_CHANGE = "close-on-route-change";
4692
4781
  ATTR_RADIUS = "radius";
4693
4782
  ATTR_MAX_HEIGHT = "max-height";
@@ -4725,6 +4814,7 @@ var init_attributes = __esm({
4725
4814
  ATTR_DISABLE_DRAG,
4726
4815
  ATTR_DRAG_FROM,
4727
4816
  ATTR_DRAG_FROM_CONTENT,
4817
+ ATTR_FIT_CONTENT_TO_SNAP,
4728
4818
  ATTR_CLOSE_ON_ROUTE_CHANGE,
4729
4819
  ATTR_RADIUS,
4730
4820
  ATTR_MAX_HEIGHT,
@@ -4998,6 +5088,7 @@ var init_BottomSheetElement = __esm({
4998
5088
  disableDrag: this.getAttribute(ATTR_DISABLE_DRAG) === "true",
4999
5089
  dragFrom: parseDragFrom(this.getAttribute(ATTR_DRAG_FROM)),
5000
5090
  dragFromContent: this.getAttribute(ATTR_DRAG_FROM_CONTENT) === null ? void 0 : this.getAttribute(ATTR_DRAG_FROM_CONTENT) !== "false",
5091
+ fitContentToSnap: this.hasAttribute(ATTR_FIT_CONTENT_TO_SNAP) && this.getAttribute(ATTR_FIT_CONTENT_TO_SNAP) !== "false",
5001
5092
  closeOnRouteChange: this.getAttribute(ATTR_CLOSE_ON_ROUTE_CHANGE) === "true",
5002
5093
  radius: parseDimension(this.getAttribute(ATTR_RADIUS)),
5003
5094
  maxHeight: parseDimension(this.getAttribute(ATTR_MAX_HEIGHT)),
@@ -1,5 +1,5 @@
1
- import { B as BottomSheetEngine } from './BottomSheetEngine-mmFzIK1Z.cjs';
2
- import { C as CloseReason, A as AnchorOptions, e as ScrimStagesOptions, E as EngineState } from './BottomSheetCore-BHv6LPmS.cjs';
1
+ import { B as BottomSheetEngine } from './BottomSheetEngine-CsQWHLNb.cjs';
2
+ import { C as CloseReason, A as AnchorOptions, i as ScrimStagesOptions, d as EngineState } from './BottomSheetCore-CQStdVy2.cjs';
3
3
  import './transform-jVfAikE9.cjs';
4
4
 
5
5
  declare const BaseHTMLElement: typeof HTMLElement;