@surdeddd/bottom-sheet 0.3.0 → 0.4.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.
Files changed (45) hide show
  1. package/dist/{BottomSheetEngine-CAymrH-P.d.cts → BottomSheetEngine-BJrH7qY3.d.cts} +39 -3
  2. package/dist/{BottomSheetEngine-DcqcuudN.d.ts → BottomSheetEngine-L05jGZvU.d.ts} +39 -3
  3. package/dist/element.cjs +490 -91
  4. package/dist/element.d.cts +23 -4
  5. package/dist/element.d.ts +23 -4
  6. package/dist/element.iife.global.js +2 -2
  7. package/dist/element.js +490 -91
  8. package/dist/index.cjs +347 -80
  9. package/dist/index.d.cts +3 -2
  10. package/dist/index.d.ts +3 -2
  11. package/dist/index.js +347 -80
  12. package/dist/integrations/formik.d.cts +1 -1
  13. package/dist/integrations/formik.d.ts +1 -1
  14. package/dist/integrations/react-hook-form.d.cts +1 -1
  15. package/dist/integrations/react-hook-form.d.ts +1 -1
  16. package/dist/overlay.cjs +13 -2
  17. package/dist/overlay.js +13 -2
  18. package/dist/preact.d.cts +1 -1
  19. package/dist/preact.d.ts +1 -1
  20. package/dist/qwik.cjs +358 -81
  21. package/dist/qwik.d.cts +4 -2
  22. package/dist/qwik.d.ts +4 -2
  23. package/dist/qwik.js +358 -81
  24. package/dist/react.cjs +451 -89
  25. package/dist/react.d.cts +29 -4
  26. package/dist/react.d.ts +29 -4
  27. package/dist/react.js +451 -89
  28. package/dist/solid.cjs +347 -80
  29. package/dist/solid.d.cts +38 -2
  30. package/dist/solid.d.ts +38 -2
  31. package/dist/solid.js +347 -80
  32. package/dist/solid.source.jsx +347 -80
  33. package/dist/styles.css +68 -55
  34. package/dist/svelte-core.cjs +352 -80
  35. package/dist/svelte-core.js +352 -80
  36. package/dist/svelte-src/BottomSheet.svelte +113 -15
  37. package/dist/svelte.cjs +474 -133
  38. package/dist/svelte.d.cts +21 -0
  39. package/dist/svelte.d.ts +21 -0
  40. package/dist/svelte.js +474 -133
  41. package/dist/vue.cjs +610 -109
  42. package/dist/vue.d.cts +51 -2
  43. package/dist/vue.d.ts +51 -2
  44. package/dist/vue.js +611 -110
  45. package/package.json +8 -8
@@ -1,4 +1,4 @@
1
- import { e as SheetEventMap } from '../BottomSheetEngine-CAymrH-P.cjs';
1
+ import { e as SheetEventMap } from '../BottomSheetEngine-BJrH7qY3.cjs';
2
2
  import '../transform-jVfAikE9.cjs';
3
3
 
4
4
  type FormikStateLike = {
@@ -1,4 +1,4 @@
1
- import { e as SheetEventMap } from '../BottomSheetEngine-DcqcuudN.js';
1
+ import { e as SheetEventMap } from '../BottomSheetEngine-L05jGZvU.js';
2
2
  import '../transform-jVfAikE9.js';
3
3
 
4
4
  type FormikStateLike = {
@@ -1,4 +1,4 @@
1
- import { e as SheetEventMap } from '../BottomSheetEngine-CAymrH-P.cjs';
1
+ import { e as SheetEventMap } from '../BottomSheetEngine-BJrH7qY3.cjs';
2
2
  import '../transform-jVfAikE9.cjs';
3
3
 
4
4
  type RhfFormStateLike = {
@@ -1,4 +1,4 @@
1
- import { e as SheetEventMap } from '../BottomSheetEngine-DcqcuudN.js';
1
+ import { e as SheetEventMap } from '../BottomSheetEngine-L05jGZvU.js';
2
2
  import '../transform-jVfAikE9.js';
3
3
 
4
4
  type RhfFormStateLike = {
package/dist/overlay.cjs CHANGED
@@ -37,6 +37,15 @@ var SheetStack = class {
37
37
  size() {
38
38
  return this.entries.length;
39
39
  }
40
+ depthOf(id) {
41
+ const open = [];
42
+ for (const entry of this.entries) {
43
+ if (!entry.isOpen || entry.isOpen()) open.push(entry);
44
+ }
45
+ const idx = open.findIndex((e) => e.id === id);
46
+ if (idx === -1) return 0;
47
+ return open.length - 1 - idx;
48
+ }
40
49
  clear() {
41
50
  this.entries = [];
42
51
  }
@@ -103,7 +112,9 @@ var PERCENT = /^(-?\d+(?:\.\d+)?)%$/;
103
112
  var resolveSnap = (point, mode, measureFit) => {
104
113
  if (typeof point === "number") return Math.max(0, point);
105
114
  if (point === "full") return viewportSize();
106
- if (point === "fit") return Math.max(0, 0);
115
+ if (point === "fit" || point === "content") {
116
+ return Math.max(0, 0);
117
+ }
107
118
  const pctMatch = point.match(PERCENT);
108
119
  if (pctMatch) {
109
120
  const pct = parseFloat(pctMatch[1]) / 100;
@@ -367,7 +378,7 @@ var LifecycleController = class {
367
378
  this.releaseScrollLock = null;
368
379
  this.inertSiblings.remove();
369
380
  if (this.returnFocus) {
370
- const target = typeof this.returnFocus === "function" ? this.returnFocus() : this.returnFocus;
381
+ const target = typeof this.returnFocus === "function" ? this.returnFocus() : typeof this.returnFocus === "string" ? typeof document !== "undefined" ? document.querySelector(this.returnFocus) : null : this.returnFocus;
371
382
  target?.focus?.();
372
383
  }
373
384
  }
package/dist/overlay.js CHANGED
@@ -35,6 +35,15 @@ var SheetStack = class {
35
35
  size() {
36
36
  return this.entries.length;
37
37
  }
38
+ depthOf(id) {
39
+ const open = [];
40
+ for (const entry of this.entries) {
41
+ if (!entry.isOpen || entry.isOpen()) open.push(entry);
42
+ }
43
+ const idx = open.findIndex((e) => e.id === id);
44
+ if (idx === -1) return 0;
45
+ return open.length - 1 - idx;
46
+ }
38
47
  clear() {
39
48
  this.entries = [];
40
49
  }
@@ -101,7 +110,9 @@ var PERCENT = /^(-?\d+(?:\.\d+)?)%$/;
101
110
  var resolveSnap = (point, mode, measureFit) => {
102
111
  if (typeof point === "number") return Math.max(0, point);
103
112
  if (point === "full") return viewportSize();
104
- if (point === "fit") return Math.max(0, 0);
113
+ if (point === "fit" || point === "content") {
114
+ return Math.max(0, 0);
115
+ }
105
116
  const pctMatch = point.match(PERCENT);
106
117
  if (pctMatch) {
107
118
  const pct = parseFloat(pctMatch[1]) / 100;
@@ -365,7 +376,7 @@ var LifecycleController = class {
365
376
  this.releaseScrollLock = null;
366
377
  this.inertSiblings.remove();
367
378
  if (this.returnFocus) {
368
- const target = typeof this.returnFocus === "function" ? this.returnFocus() : this.returnFocus;
379
+ const target = typeof this.returnFocus === "function" ? this.returnFocus() : typeof this.returnFocus === "string" ? typeof document !== "undefined" ? document.querySelector(this.returnFocus) : null : this.returnFocus;
369
380
  target?.focus?.();
370
381
  }
371
382
  }
package/dist/preact.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { BottomSheet, BottomSheetFromConfig, BottomSheetFromConfigProps, BottomSheetHandle, BottomSheetProps, HeaderProp, Overlay, OverlayHandle, OverlayProps, SheetConfig, UseBottomSheetRefs, UseBottomSheetReturn, UseOverlayReturn, useBottomSheet, useOverlay } from './react.cjs';
2
- export { E as EngineState, b as SheetMode, d as SnapPoint, a as SnapPointDef } from './BottomSheetEngine-CAymrH-P.cjs';
2
+ export { E as EngineState, b as SheetMode, d as SnapPoint, a as SnapPointDef } from './BottomSheetEngine-BJrH7qY3.cjs';
3
3
  export { OverlayEdge, OverlayOptions, OverlayState } from './overlay.cjs';
4
4
  import 'react';
5
5
  import './transform-jVfAikE9.cjs';
package/dist/preact.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { BottomSheet, BottomSheetFromConfig, BottomSheetFromConfigProps, BottomSheetHandle, BottomSheetProps, HeaderProp, Overlay, OverlayHandle, OverlayProps, SheetConfig, UseBottomSheetRefs, UseBottomSheetReturn, UseOverlayReturn, useBottomSheet, useOverlay } from './react.js';
2
- export { E as EngineState, b as SheetMode, d as SnapPoint, a as SnapPointDef } from './BottomSheetEngine-DcqcuudN.js';
2
+ export { E as EngineState, b as SheetMode, d as SnapPoint, a as SnapPointDef } from './BottomSheetEngine-L05jGZvU.js';
3
3
  export { OverlayEdge, OverlayOptions, OverlayState } from './overlay.js';
4
4
  import 'react';
5
5
  import './transform-jVfAikE9.js';