@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,6 +1,6 @@
1
1
  import { T as TransformAxis } from './transform-jVfAikE9.cjs';
2
2
 
3
- type SnapPoint = number | `${number}%` | "fit" | "full" | (string & {});
3
+ type SnapPoint = number | `${number}%` | "fit" | "content" | "full" | (string & {});
4
4
  type SnapPointDef<Id extends string = string> = {
5
5
  id: Id;
6
6
  size: SnapPoint;
@@ -43,9 +43,14 @@ type SheetEventMap = {
43
43
  cancel: () => void;
44
44
  previousId: string;
45
45
  };
46
+ "before-close": {
47
+ reason: "programmatic" | "backdrop" | "escape" | "back";
48
+ cancel: () => void;
49
+ };
46
50
  snap: {
47
51
  id: string;
48
52
  size: number;
53
+ progress: number;
49
54
  };
50
55
  progress: {
51
56
  value: number;
@@ -66,7 +71,12 @@ type SheetEventMap = {
66
71
  open: {
67
72
  id: string;
68
73
  };
74
+ opened: {
75
+ id: string;
76
+ };
77
+ closed: undefined;
69
78
  };
79
+ type CloseReason = "programmatic" | "backdrop" | "escape" | "back";
70
80
  type EngineOptions = {
71
81
  element: HTMLElement;
72
82
  handle?: HTMLElement;
@@ -105,6 +115,13 @@ type EngineOptions = {
105
115
  closeOnBack?: boolean;
106
116
  routedTo?: string;
107
117
  inertSiblings?: boolean;
118
+ persistent?: boolean;
119
+ disableClose?: boolean;
120
+ disableDrag?: boolean;
121
+ closeOnRouteChange?: boolean;
122
+ radius?: string | number;
123
+ maxHeight?: string | number;
124
+ returnFocusTo?: HTMLElement | string | (() => HTMLElement | null);
108
125
  persistKey?: string;
109
126
  autoCollapseAfter?: number;
110
127
  linkedSheets?: BottomSheetEngineLike[];
@@ -201,6 +218,11 @@ declare class BottomSheetEngine {
201
218
  private lifecycle;
202
219
  private closeOnBack;
203
220
  private routedTo;
221
+ private persistent;
222
+ private disableCloseFlag;
223
+ private disableDragFlag;
224
+ private closeOnRouteChange;
225
+ private maxHeightCap;
204
226
  private snapPointsRaw;
205
227
  private snaps;
206
228
  private activeId;
@@ -213,6 +235,7 @@ declare class BottomSheetEngine {
213
235
  private sizeWriteSentinel;
214
236
  private progressWriteSentinel;
215
237
  private isTopSheet;
238
+ private opening;
216
239
  private progressPayload;
217
240
  private dragContextBuf;
218
241
  private bus;
@@ -242,7 +265,15 @@ declare class BottomSheetEngine {
242
265
  signal?: AbortSignal;
243
266
  }): Promise<void>;
244
267
  open(id?: string): Promise<void>;
245
- close(): Promise<void>;
268
+ close(reason?: CloseReason): Promise<void>;
269
+ canDismiss(): boolean;
270
+ isTop(): boolean;
271
+ depth(): number;
272
+ expand(): Promise<void>;
273
+ collapse(): Promise<void>;
274
+ setRadius(r: string | number): void;
275
+ setMaxHeight(h: string | number): void;
276
+ private clampToMaxHeight;
246
277
  setAllowed(ids: string[], snap?: string): void;
247
278
  setBackdropRange(range: [number, number]): void;
248
279
  setScreenRange(range: [number, number]): void;
@@ -261,10 +292,15 @@ declare class BottomSheetEngine {
261
292
  enabled: boolean;
262
293
  };
263
294
  setSnapPoints(points: EngineOptions["snapPoints"], allowed?: string[]): void;
295
+ recompute(): void;
296
+ private measureFitSize;
297
+ private installFitObserver;
264
298
  destroy(): void;
265
299
  private emit;
266
300
  private newCycle;
267
301
  private emitBeforeSnap;
302
+ private emitBeforeClose;
303
+ private applyAutoAriaLabelledBy;
268
304
  private recomputeSnaps;
269
305
  private getAllowedRange;
270
306
  private allowedIdsBySize;
@@ -282,4 +318,4 @@ declare class BottomSheetEngine {
282
318
  private handleClose;
283
319
  }
284
320
 
285
- export { type AnchorOptions as A, BottomSheetEngine as B, type EngineState as E, type Plugin as P, type ScrimStagesOptions as S, type TeardownScope as T, type SnapPointDef as a, type SheetMode as b, type EngineOptions as c, type SnapPoint as d, type SheetEventMap as e, type ScrimOverlayPosition as f, type AnchorAnimationPreset as g, type AnchorAnimationSpec as h, type AnchorHandle as i, type AnchorPosition as j, type AnchorState as k, SCRIM_PRESETS as l, type ScrimOverlayOptions as m, type ScrimPreset as n, type ScrimPresetConfig as o, type ScrimStageDef as p, type ScrimUpdate as q, type SnapId as r, runAnchorTransition as s };
321
+ export { type AnchorOptions as A, BottomSheetEngine as B, type CloseReason as C, type EngineState as E, type Plugin as P, type ScrimStagesOptions as S, type TeardownScope as T, type SnapPointDef as a, type SheetMode as b, type EngineOptions as c, type SnapPoint as d, type SheetEventMap as e, type ScrimOverlayPosition as f, type AnchorAnimationPreset as g, type AnchorAnimationSpec as h, type AnchorHandle as i, type AnchorPosition as j, type AnchorState as k, SCRIM_PRESETS as l, type ScrimOverlayOptions as m, type ScrimPreset as n, type ScrimPresetConfig as o, type ScrimStageDef as p, type ScrimUpdate as q, type SnapId as r, runAnchorTransition as s };
@@ -1,6 +1,6 @@
1
1
  import { T as TransformAxis } from './transform-jVfAikE9.js';
2
2
 
3
- type SnapPoint = number | `${number}%` | "fit" | "full" | (string & {});
3
+ type SnapPoint = number | `${number}%` | "fit" | "content" | "full" | (string & {});
4
4
  type SnapPointDef<Id extends string = string> = {
5
5
  id: Id;
6
6
  size: SnapPoint;
@@ -43,9 +43,14 @@ type SheetEventMap = {
43
43
  cancel: () => void;
44
44
  previousId: string;
45
45
  };
46
+ "before-close": {
47
+ reason: "programmatic" | "backdrop" | "escape" | "back";
48
+ cancel: () => void;
49
+ };
46
50
  snap: {
47
51
  id: string;
48
52
  size: number;
53
+ progress: number;
49
54
  };
50
55
  progress: {
51
56
  value: number;
@@ -66,7 +71,12 @@ type SheetEventMap = {
66
71
  open: {
67
72
  id: string;
68
73
  };
74
+ opened: {
75
+ id: string;
76
+ };
77
+ closed: undefined;
69
78
  };
79
+ type CloseReason = "programmatic" | "backdrop" | "escape" | "back";
70
80
  type EngineOptions = {
71
81
  element: HTMLElement;
72
82
  handle?: HTMLElement;
@@ -105,6 +115,13 @@ type EngineOptions = {
105
115
  closeOnBack?: boolean;
106
116
  routedTo?: string;
107
117
  inertSiblings?: boolean;
118
+ persistent?: boolean;
119
+ disableClose?: boolean;
120
+ disableDrag?: boolean;
121
+ closeOnRouteChange?: boolean;
122
+ radius?: string | number;
123
+ maxHeight?: string | number;
124
+ returnFocusTo?: HTMLElement | string | (() => HTMLElement | null);
108
125
  persistKey?: string;
109
126
  autoCollapseAfter?: number;
110
127
  linkedSheets?: BottomSheetEngineLike[];
@@ -201,6 +218,11 @@ declare class BottomSheetEngine {
201
218
  private lifecycle;
202
219
  private closeOnBack;
203
220
  private routedTo;
221
+ private persistent;
222
+ private disableCloseFlag;
223
+ private disableDragFlag;
224
+ private closeOnRouteChange;
225
+ private maxHeightCap;
204
226
  private snapPointsRaw;
205
227
  private snaps;
206
228
  private activeId;
@@ -213,6 +235,7 @@ declare class BottomSheetEngine {
213
235
  private sizeWriteSentinel;
214
236
  private progressWriteSentinel;
215
237
  private isTopSheet;
238
+ private opening;
216
239
  private progressPayload;
217
240
  private dragContextBuf;
218
241
  private bus;
@@ -242,7 +265,15 @@ declare class BottomSheetEngine {
242
265
  signal?: AbortSignal;
243
266
  }): Promise<void>;
244
267
  open(id?: string): Promise<void>;
245
- close(): Promise<void>;
268
+ close(reason?: CloseReason): Promise<void>;
269
+ canDismiss(): boolean;
270
+ isTop(): boolean;
271
+ depth(): number;
272
+ expand(): Promise<void>;
273
+ collapse(): Promise<void>;
274
+ setRadius(r: string | number): void;
275
+ setMaxHeight(h: string | number): void;
276
+ private clampToMaxHeight;
246
277
  setAllowed(ids: string[], snap?: string): void;
247
278
  setBackdropRange(range: [number, number]): void;
248
279
  setScreenRange(range: [number, number]): void;
@@ -261,10 +292,15 @@ declare class BottomSheetEngine {
261
292
  enabled: boolean;
262
293
  };
263
294
  setSnapPoints(points: EngineOptions["snapPoints"], allowed?: string[]): void;
295
+ recompute(): void;
296
+ private measureFitSize;
297
+ private installFitObserver;
264
298
  destroy(): void;
265
299
  private emit;
266
300
  private newCycle;
267
301
  private emitBeforeSnap;
302
+ private emitBeforeClose;
303
+ private applyAutoAriaLabelledBy;
268
304
  private recomputeSnaps;
269
305
  private getAllowedRange;
270
306
  private allowedIdsBySize;
@@ -282,4 +318,4 @@ declare class BottomSheetEngine {
282
318
  private handleClose;
283
319
  }
284
320
 
285
- export { type AnchorOptions as A, BottomSheetEngine as B, type EngineState as E, type Plugin as P, type ScrimStagesOptions as S, type TeardownScope as T, type SnapPointDef as a, type SheetMode as b, type EngineOptions as c, type SnapPoint as d, type SheetEventMap as e, type ScrimOverlayPosition as f, type AnchorAnimationPreset as g, type AnchorAnimationSpec as h, type AnchorHandle as i, type AnchorPosition as j, type AnchorState as k, SCRIM_PRESETS as l, type ScrimOverlayOptions as m, type ScrimPreset as n, type ScrimPresetConfig as o, type ScrimStageDef as p, type ScrimUpdate as q, type SnapId as r, runAnchorTransition as s };
321
+ export { type AnchorOptions as A, BottomSheetEngine as B, type CloseReason as C, type EngineState as E, type Plugin as P, type ScrimStagesOptions as S, type TeardownScope as T, type SnapPointDef as a, type SheetMode as b, type EngineOptions as c, type SnapPoint as d, type SheetEventMap as e, type ScrimOverlayPosition as f, type AnchorAnimationPreset as g, type AnchorAnimationSpec as h, type AnchorHandle as i, type AnchorPosition as j, type AnchorState as k, SCRIM_PRESETS as l, type ScrimOverlayOptions as m, type ScrimPreset as n, type ScrimPresetConfig as o, type ScrimStageDef as p, type ScrimUpdate as q, type SnapId as r, runAnchorTransition as s };