@surdeddd/bottom-sheet 0.14.0 → 0.20.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 (56) hide show
  1. package/README.md +13 -0
  2. package/dist/{BottomSheetCore-DJYwWOqt.d.ts → BottomSheetCore-Cgn8b_6A.d.ts} +11 -2
  3. package/dist/{BottomSheetCore-Cp7dWy91.d.cts → BottomSheetCore-VPJZcKcg.d.cts} +11 -2
  4. package/dist/{BottomSheetEngine-Lm7HIVHv.d.cts → BottomSheetEngine-B8C2CwF9.d.cts} +1 -1
  5. package/dist/{BottomSheetEngine-O5PbeKfe.d.ts → BottomSheetEngine-DwYR_ygJ.d.ts} +1 -1
  6. package/dist/core.cjs +100 -9
  7. package/dist/core.d.cts +2 -2
  8. package/dist/core.d.ts +2 -2
  9. package/dist/core.js +100 -9
  10. package/dist/debug.d.cts +1 -1
  11. package/dist/debug.d.ts +1 -1
  12. package/dist/element.cjs +107 -9
  13. package/dist/element.d.cts +2 -2
  14. package/dist/element.d.ts +2 -2
  15. package/dist/element.iife.global.js +2 -2
  16. package/dist/element.js +107 -9
  17. package/dist/features.d.cts +4 -4
  18. package/dist/features.d.ts +4 -4
  19. package/dist/{index-Bb5TRmyg.d.cts → index-CnfbOKx0.d.cts} +1 -1
  20. package/dist/{index-Cl9ebCP2.d.ts → index-DcMkhXAy.d.ts} +1 -1
  21. package/dist/index.cjs +100 -9
  22. package/dist/index.d.cts +8 -8
  23. package/dist/index.d.ts +8 -8
  24. package/dist/index.js +100 -9
  25. package/dist/integrations/formik.d.cts +1 -1
  26. package/dist/integrations/formik.d.ts +1 -1
  27. package/dist/integrations/react-hook-form.d.cts +1 -1
  28. package/dist/integrations/react-hook-form.d.ts +1 -1
  29. package/dist/preact.d.cts +2 -2
  30. package/dist/preact.d.ts +2 -2
  31. package/dist/qwik-lib/index.qwik.cjs +98 -9
  32. package/dist/qwik-lib/index.qwik.mjs +98 -9
  33. package/dist/qwik.cjs +100 -9
  34. package/dist/qwik.d.cts +2 -2
  35. package/dist/qwik.d.ts +2 -2
  36. package/dist/qwik.js +100 -9
  37. package/dist/react.cjs +100 -9
  38. package/dist/react.d.cts +3 -3
  39. package/dist/react.d.ts +3 -3
  40. package/dist/react.js +100 -9
  41. package/dist/solid.cjs +100 -9
  42. package/dist/solid.d.cts +10 -1
  43. package/dist/solid.d.ts +10 -1
  44. package/dist/solid.js +100 -9
  45. package/dist/solid.source.jsx +100 -9
  46. package/dist/svelte-core.cjs +100 -9
  47. package/dist/svelte-core.js +100 -9
  48. package/dist/svelte.cjs +100 -9
  49. package/dist/svelte.js +100 -9
  50. package/dist/vue.cjs +100 -9
  51. package/dist/vue.js +100 -9
  52. package/dist/webgl.cjs +104 -14
  53. package/dist/webgl.d.cts +1 -1
  54. package/dist/webgl.d.ts +1 -1
  55. package/dist/webgl.js +104 -14
  56. package/package.json +39 -39
@@ -300,6 +300,11 @@ class SnapResolver {
300
300
  this.raw = raw;
301
301
  this.recompute();
302
302
  }
303
+ setMode(mode) {
304
+ if (mode === this.mode) return;
305
+ this.mode = mode;
306
+ this.recompute();
307
+ }
303
308
  setAllowedIds(ids) {
304
309
  this.allowedIds = ids;
305
310
  this.rangeCache = null;
@@ -902,6 +907,11 @@ class ScrimController {
902
907
  interactive
903
908
  });
904
909
  }
910
+ setSheetMode(mode) {
911
+ if (this.isDestroyed() || mode === this.mode) return;
912
+ this.mode = mode;
913
+ this.invalidateOpacityCache();
914
+ }
905
915
  setScrimMode(mode, applySize) {
906
916
  if (this.isDestroyed()) return;
907
917
  if (mode === this.scrimMode) return;
@@ -1836,6 +1846,7 @@ const installGestures = (handle, mode, callbacks, options = {}) => {
1836
1846
  let activePointerId = null;
1837
1847
  let activePointerType = "touch";
1838
1848
  let startCoord = 0;
1849
+ let startCross = 0;
1839
1850
  let lastCoord = 0;
1840
1851
  let pendingStart = false;
1841
1852
  const VELOCITY_WINDOW_MS = (kind) => kind === "mouse" ? 160 : 120;
@@ -1844,6 +1855,7 @@ const installGestures = (handle, mode, callbacks, options = {}) => {
1844
1855
  const axis = isAxisVertical(mode) ? "Y" : "X";
1845
1856
  const sign = mode === "bottom" || mode === "right" ? -1 : 1;
1846
1857
  const coordOf = (e) => axis === "Y" ? e.clientY : e.clientX;
1858
+ const crossOf = (e) => axis === "Y" ? e.clientX : e.clientY;
1847
1859
  const capture = (pointerId) => {
1848
1860
  try {
1849
1861
  handle.setPointerCapture(pointerId);
@@ -1862,6 +1874,7 @@ const installGestures = (handle, mode, callbacks, options = {}) => {
1862
1874
  activePointerId = e.pointerId;
1863
1875
  activePointerType = e.pointerType || "touch";
1864
1876
  startCoord = coordOf(e);
1877
+ startCross = crossOf(e);
1865
1878
  lastCoord = startCoord;
1866
1879
  samples.reset();
1867
1880
  samples.push(e.timeStamp, startCoord);
@@ -1878,7 +1891,7 @@ const installGestures = (handle, mode, callbacks, options = {}) => {
1878
1891
  const rawDelta = coord - startCoord;
1879
1892
  const delta = rawDelta * sign;
1880
1893
  if (pendingStart) {
1881
- const verdict = options.deferStart(e, delta);
1894
+ const verdict = options.deferStart(e, delta, crossOf(e) - startCross);
1882
1895
  if (verdict === false) {
1883
1896
  releaseTracking();
1884
1897
  return;
@@ -2091,11 +2104,42 @@ function isDragAllowedFrom(target, mode) {
2091
2104
  const CONTENT_DRAG_SLOP = 6;
2092
2105
  function decideContentGesture(input) {
2093
2106
  const slop = input.slop ?? CONTENT_DRAG_SLOP;
2107
+ const cross = input.crossDelta ?? 0;
2108
+ const sharesScrollAxis = input.sharesScrollAxis ?? true;
2109
+ if (!sharesScrollAxis) {
2110
+ if (Math.abs(input.delta) < slop && Math.abs(cross) < slop) return "pending";
2111
+ if (Math.abs(input.delta) <= Math.abs(cross)) return "scroll";
2112
+ return "drag";
2113
+ }
2094
2114
  if (Math.abs(input.delta) < slop) return "pending";
2095
2115
  if (input.scrollTop > 0) return "scroll";
2096
2116
  if (input.delta > 0 && input.atMaxSnap) return "scroll";
2097
2117
  return "drag";
2098
2118
  }
2119
+ const isLogicalMode = (mode) => mode === "start" || mode === "end";
2120
+ const readDirection = (el) => {
2121
+ if (!el) return "ltr";
2122
+ if (typeof getComputedStyle === "function") {
2123
+ try {
2124
+ if (getComputedStyle(el).direction === "rtl") return "rtl";
2125
+ } catch {
2126
+ }
2127
+ }
2128
+ try {
2129
+ const marked = el.closest?.("[dir]");
2130
+ if (marked) {
2131
+ return marked.getAttribute("dir")?.toLowerCase() === "rtl" ? "rtl" : "ltr";
2132
+ }
2133
+ } catch {
2134
+ }
2135
+ return "ltr";
2136
+ };
2137
+ const resolveMode = (mode, el) => {
2138
+ if (!isLogicalMode(mode)) return mode;
2139
+ const rtl = readDirection(el) === "rtl";
2140
+ if (mode === "start") return rtl ? "right" : "left";
2141
+ return rtl ? "left" : "right";
2142
+ };
2099
2143
  function installTouchScrollGuard(surface, isDragging) {
2100
2144
  const onTouchMove = (e) => {
2101
2145
  if (!isDragging()) return;
@@ -2496,7 +2540,7 @@ function resolveEngineOptions(opts, extras) {
2496
2540
  }
2497
2541
  }
2498
2542
  return {
2499
- mode: opts.mode ?? "bottom",
2543
+ mode: resolveMode(opts.mode ?? "bottom", opts.element),
2500
2544
  flickVelocity: opts.flickVelocity ?? DEFAULT_FLICK_VELOCITY,
2501
2545
  dragThreshold: opts.dragThreshold ?? DEFAULT_DRAG_THRESHOLD,
2502
2546
  dragFrom: opts.dragFrom ?? (opts.handle ? "handle" : "sheet"),
@@ -2596,6 +2640,7 @@ class BottomSheetCore {
2596
2640
  __publicField(this, "disableDragFlag");
2597
2641
  __publicField(this, "closeOnRouteChange");
2598
2642
  __publicField(this, "maxHeight");
2643
+ __publicField(this, "maxHeightDeps");
2599
2644
  __publicField(this, "snapPointsRaw");
2600
2645
  __publicField(this, "snaps");
2601
2646
  __publicField(this, "activeId");
@@ -2603,6 +2648,7 @@ class BottomSheetCore {
2603
2648
  __publicField(this, "gesture");
2604
2649
  __publicField(this, "contentGesture");
2605
2650
  __publicField(this, "detachSheetGesture", null);
2651
+ __publicField(this, "detachSliderKeyboard", null);
2606
2652
  __publicField(this, "rootEl", null);
2607
2653
  __publicField(this, "destroyed", false);
2608
2654
  __publicField(this, "restClosed", false);
@@ -2655,6 +2701,7 @@ class BottomSheetCore {
2655
2701
  this.screenComponent = opts.scrim ?? opts.screenComponent;
2656
2702
  this.scrimParent = this.screenComponent?.parentElement ?? null;
2657
2703
  this.mode = resolved.mode;
2704
+ this.element.dataset.mode = this.mode;
2658
2705
  this.transformTemplate = buildTransformTemplate(this.mode);
2659
2706
  this.aria = new AriaSliderWriter(this.handle, this.mode);
2660
2707
  this.flickVelocity = resolved.flickVelocity;
@@ -2712,7 +2759,7 @@ class BottomSheetCore {
2712
2759
  auditVhUsage(this.snapPointsRaw);
2713
2760
  this.auditDuplicateSnapIds(this.snapPointsRaw);
2714
2761
  this.rootEl = this.element.closest(".bs-root");
2715
- this.maxHeight = createMaxHeightController({
2762
+ this.maxHeightDeps = {
2716
2763
  element: this.element,
2717
2764
  mode: this.mode,
2718
2765
  getMaxAxisSize: () => this.snaps.getMaxAxisSize(),
@@ -2720,7 +2767,8 @@ class BottomSheetCore {
2720
2767
  this.snaps.setMaxAxisSize(size);
2721
2768
  },
2722
2769
  recompute: () => this.recompute()
2723
- });
2770
+ };
2771
+ this.maxHeight = createMaxHeightController(this.maxHeightDeps);
2724
2772
  this.fitDeps = {
2725
2773
  element: this.element,
2726
2774
  scrollContainer: this.scrollContainer,
@@ -3050,6 +3098,37 @@ class BottomSheetCore {
3050
3098
  getDragFrom() {
3051
3099
  return this.dragFromMode;
3052
3100
  }
3101
+ setMode(mode) {
3102
+ if (this.destroyed) return;
3103
+ const next = resolveMode(mode, this.element);
3104
+ if (next === this.mode) return;
3105
+ const wasVertical = this.mode === "bottom" || this.mode === "top";
3106
+ const nowVertical = next === "bottom" || next === "top";
3107
+ this.gesture?.forceClearDragState();
3108
+ this.detachSheetGesture?.();
3109
+ this.animation.cancel();
3110
+ this.element.style.removeProperty(layoutAxis(this.mode));
3111
+ this.mode = next;
3112
+ this.element.dataset.mode = next;
3113
+ this.transformTemplate = buildTransformTemplate(next);
3114
+ this.maxHeightDeps.mode = next;
3115
+ this.fitDeps.mode = next;
3116
+ this.snaps.setMode(next);
3117
+ this.scrim.setSheetMode(next);
3118
+ if (wasVertical !== nowVertical) {
3119
+ this.aria = new AriaSliderWriter(this.handle, next);
3120
+ }
3121
+ this.detachSliderKeyboard?.();
3122
+ this.mountSliderKeyboard();
3123
+ this.mountSheetGesture();
3124
+ this.recompute();
3125
+ const active = this.snaps.findById(this.activeId);
3126
+ if (active) this.applySize(active.size);
3127
+ this.updateAriaSlider();
3128
+ }
3129
+ getMode() {
3130
+ return this.mode;
3131
+ }
3053
3132
  isTop() {
3054
3133
  return this.isTopSheet;
3055
3134
  }
@@ -3388,7 +3467,7 @@ class BottomSheetCore {
3388
3467
  const point = this.snapPointsRaw.find((p) => p.id === this.activeId);
3389
3468
  return point?.dragFromContent ?? this.dragFromContentDefault;
3390
3469
  }
3391
- decideContentDrag(surface, e, delta) {
3470
+ decideContentDrag(surface, e, delta, crossDelta) {
3392
3471
  if (this.destroyed) return false;
3393
3472
  if (e.pointerType === "mouse") return false;
3394
3473
  if (this.gesture?.isDragging) return false;
@@ -3396,6 +3475,8 @@ class BottomSheetCore {
3396
3475
  if (!isDragAllowedFrom(e.target, "sheet")) return false;
3397
3476
  const decision = decideContentGesture({
3398
3477
  delta,
3478
+ crossDelta,
3479
+ sharesScrollAxis: this.mode === "bottom" || this.mode === "top",
3399
3480
  scrollTop: surface.scrollTop,
3400
3481
  atMaxSnap: this.size >= this.getAllowedRange().max - 0.5
3401
3482
  });
@@ -3407,7 +3488,7 @@ class BottomSheetCore {
3407
3488
  if (this.contentGesture) return;
3408
3489
  const controller = new GestureController(this.buildGestureDeps(surface, {
3409
3490
  manageTouchAction: false,
3410
- deferStart: (e, delta) => this.decideContentDrag(surface, e, delta)
3491
+ deferStart: (e, delta, crossDelta) => this.decideContentDrag(surface, e, delta, crossDelta)
3411
3492
  }));
3412
3493
  this.contentGesture = controller;
3413
3494
  const detachGestures = controller.install();
@@ -3525,7 +3606,11 @@ class BottomSheetCore {
3525
3606
  this.teardowns.add(() => document.removeEventListener("keydown", onKey));
3526
3607
  }
3527
3608
  }
3528
- this.teardowns.add(installSliderKeyboard({
3609
+ this.mountSliderKeyboard();
3610
+ this.scrim.attach();
3611
+ }
3612
+ mountSliderKeyboard() {
3613
+ const detach = installSliderKeyboard({
3529
3614
  handle: this.handle,
3530
3615
  mode: this.mode,
3531
3616
  isDestroyed: () => this.destroyed,
@@ -3534,8 +3619,12 @@ class BottomSheetCore {
3534
3619
  snapTo: (id) => {
3535
3620
  void this.snapTo(id);
3536
3621
  }
3537
- }));
3538
- this.scrim.attach();
3622
+ });
3623
+ this.detachSliderKeyboard = detach;
3624
+ this.teardowns.add(() => {
3625
+ this.detachSliderKeyboard?.();
3626
+ this.detachSliderKeyboard = null;
3627
+ });
3539
3628
  }
3540
3629
  settleAfterDrag(delta, velocity, kind = "touch") {
3541
3630
  const signal = this.newCycle();
package/dist/qwik.cjs CHANGED
@@ -318,6 +318,11 @@ var SnapResolver = class {
318
318
  this.raw = raw;
319
319
  this.recompute();
320
320
  }
321
+ setMode(mode) {
322
+ if (mode === this.mode) return;
323
+ this.mode = mode;
324
+ this.recompute();
325
+ }
321
326
  setAllowedIds(ids) {
322
327
  this.allowedIds = ids;
323
328
  this.rangeCache = null;
@@ -901,6 +906,11 @@ var ScrimController = class {
901
906
  if (this.isDestroyed()) return;
902
907
  this.applyScrimStyles({ interactive });
903
908
  }
909
+ setSheetMode(mode) {
910
+ if (this.isDestroyed() || mode === this.mode) return;
911
+ this.mode = mode;
912
+ this.invalidateOpacityCache();
913
+ }
904
914
  setScrimMode(mode, applySize) {
905
915
  if (this.isDestroyed()) return;
906
916
  if (mode === this.scrimMode) return;
@@ -1823,6 +1833,7 @@ var installGestures = (handle, mode, callbacks, options = {}) => {
1823
1833
  let activePointerId = null;
1824
1834
  let activePointerType = "touch";
1825
1835
  let startCoord = 0;
1836
+ let startCross = 0;
1826
1837
  let lastCoord = 0;
1827
1838
  let pendingStart = false;
1828
1839
  const VELOCITY_WINDOW_MS = (kind) => kind === "mouse" ? 160 : 120;
@@ -1831,6 +1842,7 @@ var installGestures = (handle, mode, callbacks, options = {}) => {
1831
1842
  const axis = isAxisVertical(mode) ? "Y" : "X";
1832
1843
  const sign = mode === "bottom" || mode === "right" ? -1 : 1;
1833
1844
  const coordOf = (e) => axis === "Y" ? e.clientY : e.clientX;
1845
+ const crossOf = (e) => axis === "Y" ? e.clientX : e.clientY;
1834
1846
  const capture = (pointerId) => {
1835
1847
  try {
1836
1848
  handle.setPointerCapture(pointerId);
@@ -1849,6 +1861,7 @@ var installGestures = (handle, mode, callbacks, options = {}) => {
1849
1861
  activePointerId = e.pointerId;
1850
1862
  activePointerType = e.pointerType || "touch";
1851
1863
  startCoord = coordOf(e);
1864
+ startCross = crossOf(e);
1852
1865
  lastCoord = startCoord;
1853
1866
  samples.reset();
1854
1867
  samples.push(e.timeStamp, startCoord);
@@ -1865,7 +1878,7 @@ var installGestures = (handle, mode, callbacks, options = {}) => {
1865
1878
  const rawDelta = coord - startCoord;
1866
1879
  const delta = rawDelta * sign;
1867
1880
  if (pendingStart) {
1868
- const verdict = options.deferStart(e, delta);
1881
+ const verdict = options.deferStart(e, delta, crossOf(e) - startCross);
1869
1882
  if (verdict === false) {
1870
1883
  releaseTracking();
1871
1884
  return;
@@ -2083,12 +2096,45 @@ function isDragAllowedFrom(target, mode) {
2083
2096
  var CONTENT_DRAG_SLOP = 6;
2084
2097
  function decideContentGesture(input) {
2085
2098
  const slop = input.slop ?? CONTENT_DRAG_SLOP;
2099
+ const cross = input.crossDelta ?? 0;
2100
+ const sharesScrollAxis = input.sharesScrollAxis ?? true;
2101
+ if (!sharesScrollAxis) {
2102
+ if (Math.abs(input.delta) < slop && Math.abs(cross) < slop) return "pending";
2103
+ if (Math.abs(input.delta) <= Math.abs(cross)) return "scroll";
2104
+ return "drag";
2105
+ }
2086
2106
  if (Math.abs(input.delta) < slop) return "pending";
2087
2107
  if (input.scrollTop > 0) return "scroll";
2088
2108
  if (input.delta > 0 && input.atMaxSnap) return "scroll";
2089
2109
  return "drag";
2090
2110
  }
2091
2111
 
2112
+ // src/core/primitives/logical-mode.ts
2113
+ var isLogicalMode = (mode) => mode === "start" || mode === "end";
2114
+ var readDirection = (el) => {
2115
+ if (!el) return "ltr";
2116
+ if (typeof getComputedStyle === "function") {
2117
+ try {
2118
+ if (getComputedStyle(el).direction === "rtl") return "rtl";
2119
+ } catch {
2120
+ }
2121
+ }
2122
+ try {
2123
+ const marked = el.closest?.("[dir]");
2124
+ if (marked) {
2125
+ return marked.getAttribute("dir")?.toLowerCase() === "rtl" ? "rtl" : "ltr";
2126
+ }
2127
+ } catch {
2128
+ }
2129
+ return "ltr";
2130
+ };
2131
+ var resolveMode = (mode, el) => {
2132
+ if (!isLogicalMode(mode)) return mode;
2133
+ const rtl = readDirection(el) === "rtl";
2134
+ if (mode === "start") return rtl ? "right" : "left";
2135
+ return rtl ? "left" : "right";
2136
+ };
2137
+
2092
2138
  // src/core/primitives/touch-scroll-guard.ts
2093
2139
  function installTouchScrollGuard(surface, isDragging) {
2094
2140
  const onTouchMove = (e) => {
@@ -2451,7 +2497,7 @@ function resolveEngineOptions(opts, extras) {
2451
2497
  }
2452
2498
  }
2453
2499
  return {
2454
- mode: opts.mode ?? "bottom",
2500
+ mode: resolveMode(opts.mode ?? "bottom", opts.element),
2455
2501
  flickVelocity: opts.flickVelocity ?? DEFAULT_FLICK_VELOCITY,
2456
2502
  dragThreshold: opts.dragThreshold ?? DEFAULT_DRAG_THRESHOLD,
2457
2503
  dragFrom: opts.dragFrom ?? (opts.handle ? "handle" : "sheet"),
@@ -2555,6 +2601,7 @@ var BottomSheetCore = class {
2555
2601
  __publicField(this, "disableDragFlag");
2556
2602
  __publicField(this, "closeOnRouteChange");
2557
2603
  __publicField(this, "maxHeight");
2604
+ __publicField(this, "maxHeightDeps");
2558
2605
  __publicField(this, "snapPointsRaw");
2559
2606
  __publicField(this, "snaps");
2560
2607
  __publicField(this, "activeId");
@@ -2562,6 +2609,7 @@ var BottomSheetCore = class {
2562
2609
  __publicField(this, "gesture");
2563
2610
  __publicField(this, "contentGesture");
2564
2611
  __publicField(this, "detachSheetGesture", null);
2612
+ __publicField(this, "detachSliderKeyboard", null);
2565
2613
  __publicField(this, "rootEl", null);
2566
2614
  __publicField(this, "destroyed", false);
2567
2615
  __publicField(this, "restClosed", false);
@@ -2613,6 +2661,7 @@ var BottomSheetCore = class {
2613
2661
  this.screenComponent = opts.scrim ?? opts.screenComponent;
2614
2662
  this.scrimParent = this.screenComponent?.parentElement ?? null;
2615
2663
  this.mode = resolved.mode;
2664
+ this.element.dataset.mode = this.mode;
2616
2665
  this.transformTemplate = buildTransformTemplate(this.mode);
2617
2666
  this.aria = new AriaSliderWriter(this.handle, this.mode);
2618
2667
  this.flickVelocity = resolved.flickVelocity;
@@ -2679,7 +2728,7 @@ var BottomSheetCore = class {
2679
2728
  auditVhUsage(this.snapPointsRaw);
2680
2729
  this.auditDuplicateSnapIds(this.snapPointsRaw);
2681
2730
  this.rootEl = this.element.closest(".bs-root");
2682
- this.maxHeight = createMaxHeightController({
2731
+ this.maxHeightDeps = {
2683
2732
  element: this.element,
2684
2733
  mode: this.mode,
2685
2734
  getMaxAxisSize: () => this.snaps.getMaxAxisSize(),
@@ -2687,7 +2736,8 @@ var BottomSheetCore = class {
2687
2736
  this.snaps.setMaxAxisSize(size);
2688
2737
  },
2689
2738
  recompute: () => this.recompute()
2690
- });
2739
+ };
2740
+ this.maxHeight = createMaxHeightController(this.maxHeightDeps);
2691
2741
  this.fitDeps = {
2692
2742
  element: this.element,
2693
2743
  scrollContainer: this.scrollContainer,
@@ -3021,6 +3071,37 @@ var BottomSheetCore = class {
3021
3071
  getDragFrom() {
3022
3072
  return this.dragFromMode;
3023
3073
  }
3074
+ setMode(mode) {
3075
+ if (this.destroyed) return;
3076
+ const next = resolveMode(mode, this.element);
3077
+ if (next === this.mode) return;
3078
+ const wasVertical = this.mode === "bottom" || this.mode === "top";
3079
+ const nowVertical = next === "bottom" || next === "top";
3080
+ this.gesture?.forceClearDragState();
3081
+ this.detachSheetGesture?.();
3082
+ this.animation.cancel();
3083
+ this.element.style.removeProperty(layoutAxis(this.mode));
3084
+ this.mode = next;
3085
+ this.element.dataset.mode = next;
3086
+ this.transformTemplate = buildTransformTemplate(next);
3087
+ this.maxHeightDeps.mode = next;
3088
+ this.fitDeps.mode = next;
3089
+ this.snaps.setMode(next);
3090
+ this.scrim.setSheetMode(next);
3091
+ if (wasVertical !== nowVertical) {
3092
+ this.aria = new AriaSliderWriter(this.handle, next);
3093
+ }
3094
+ this.detachSliderKeyboard?.();
3095
+ this.mountSliderKeyboard();
3096
+ this.mountSheetGesture();
3097
+ this.recompute();
3098
+ const active = this.snaps.findById(this.activeId);
3099
+ if (active) this.applySize(active.size);
3100
+ this.updateAriaSlider();
3101
+ }
3102
+ getMode() {
3103
+ return this.mode;
3104
+ }
3024
3105
  isTop() {
3025
3106
  return this.isTopSheet;
3026
3107
  }
@@ -3369,7 +3450,7 @@ var BottomSheetCore = class {
3369
3450
  const point = this.snapPointsRaw.find((p) => p.id === this.activeId);
3370
3451
  return point?.dragFromContent ?? this.dragFromContentDefault;
3371
3452
  }
3372
- decideContentDrag(surface, e, delta) {
3453
+ decideContentDrag(surface, e, delta, crossDelta) {
3373
3454
  if (this.destroyed) return false;
3374
3455
  if (e.pointerType === "mouse") return false;
3375
3456
  if (this.gesture?.isDragging) return false;
@@ -3377,6 +3458,8 @@ var BottomSheetCore = class {
3377
3458
  if (!isDragAllowedFrom(e.target, "sheet")) return false;
3378
3459
  const decision = decideContentGesture({
3379
3460
  delta,
3461
+ crossDelta,
3462
+ sharesScrollAxis: this.mode === "bottom" || this.mode === "top",
3380
3463
  scrollTop: surface.scrollTop,
3381
3464
  atMaxSnap: this.size >= this.getAllowedRange().max - 0.5
3382
3465
  });
@@ -3389,7 +3472,7 @@ var BottomSheetCore = class {
3389
3472
  const controller = new GestureController(
3390
3473
  this.buildGestureDeps(surface, {
3391
3474
  manageTouchAction: false,
3392
- deferStart: (e, delta) => this.decideContentDrag(surface, e, delta)
3475
+ deferStart: (e, delta, crossDelta) => this.decideContentDrag(surface, e, delta, crossDelta)
3393
3476
  })
3394
3477
  );
3395
3478
  this.contentGesture = controller;
@@ -3515,7 +3598,11 @@ var BottomSheetCore = class {
3515
3598
  );
3516
3599
  }
3517
3600
  }
3518
- this.teardowns.add(installSliderKeyboard({
3601
+ this.mountSliderKeyboard();
3602
+ this.scrim.attach();
3603
+ }
3604
+ mountSliderKeyboard() {
3605
+ const detach = installSliderKeyboard({
3519
3606
  handle: this.handle,
3520
3607
  mode: this.mode,
3521
3608
  isDestroyed: () => this.destroyed,
@@ -3524,8 +3611,12 @@ var BottomSheetCore = class {
3524
3611
  snapTo: (id) => {
3525
3612
  void this.snapTo(id);
3526
3613
  }
3527
- }));
3528
- this.scrim.attach();
3614
+ });
3615
+ this.detachSliderKeyboard = detach;
3616
+ this.teardowns.add(() => {
3617
+ this.detachSliderKeyboard?.();
3618
+ this.detachSliderKeyboard = null;
3619
+ });
3529
3620
  }
3530
3621
  settleAfterDrag(delta, velocity, kind = "touch") {
3531
3622
  const signal = this.newCycle();
package/dist/qwik.d.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as _builder_io_qwik from '@builder.io/qwik';
2
2
  import { QRL } from '@builder.io/qwik';
3
3
  import { T as TeleportTarget } from './teleport-7uYNiEAT.cjs';
4
- import { b as SnapPointDef, c as SheetMode, a as EngineOptions, d as SheetEventMap, E as EngineState } from './BottomSheetCore-Cp7dWy91.cjs';
5
- export { e as SnapPoint } from './BottomSheetCore-Cp7dWy91.cjs';
4
+ import { a as SnapPointDef, b as SheetMode, c as EngineOptions, S as SheetEventMap, E as EngineState } from './BottomSheetCore-VPJZcKcg.cjs';
5
+ export { d as SnapPoint } from './BottomSheetCore-VPJZcKcg.cjs';
6
6
  import './transform-jVfAikE9.cjs';
7
7
 
8
8
  type BottomSheetProps<TId extends string = string> = {
package/dist/qwik.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as _builder_io_qwik from '@builder.io/qwik';
2
2
  import { QRL } from '@builder.io/qwik';
3
3
  import { T as TeleportTarget } from './teleport-7uYNiEAT.js';
4
- import { b as SnapPointDef, c as SheetMode, a as EngineOptions, d as SheetEventMap, E as EngineState } from './BottomSheetCore-DJYwWOqt.js';
5
- export { e as SnapPoint } from './BottomSheetCore-DJYwWOqt.js';
4
+ import { a as SnapPointDef, b as SheetMode, c as EngineOptions, S as SheetEventMap, E as EngineState } from './BottomSheetCore-Cgn8b_6A.js';
5
+ export { d as SnapPoint } from './BottomSheetCore-Cgn8b_6A.js';
6
6
  import './transform-jVfAikE9.js';
7
7
 
8
8
  type BottomSheetProps<TId extends string = string> = {