@surdeddd/bottom-sheet 0.1.0 → 0.3.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.
- package/README.md +57 -21
- package/dist/BottomSheetEngine-CAymrH-P.d.cts +285 -0
- package/dist/BottomSheetEngine-DcqcuudN.d.ts +285 -0
- package/dist/element.cjs +775 -537
- package/dist/element.d.cts +9 -57
- package/dist/element.d.ts +9 -57
- package/dist/element.iife.global.js +2 -2
- package/dist/element.js +775 -537
- package/dist/index.cjs +760 -600
- package/dist/index.d.cts +18 -85
- package/dist/index.d.ts +18 -85
- package/dist/index.js +758 -601
- package/dist/integrations/formik.d.cts +2 -8
- package/dist/integrations/formik.d.ts +2 -8
- package/dist/integrations/react-hook-form.d.cts +2 -11
- package/dist/integrations/react-hook-form.d.ts +2 -11
- package/dist/overlay.cjs +168 -122
- package/dist/overlay.d.cts +14 -137
- package/dist/overlay.d.ts +14 -137
- package/dist/overlay.js +168 -122
- package/dist/preact.d.cts +2 -2
- package/dist/preact.d.ts +2 -2
- package/dist/preact.js +0 -1
- package/dist/qwik.cjs +667 -519
- package/dist/qwik.d.cts +3 -24
- package/dist/qwik.d.ts +3 -24
- package/dist/qwik.js +668 -520
- package/dist/react.cjs +873 -648
- package/dist/react.d.cts +34 -159
- package/dist/react.d.ts +34 -159
- package/dist/react.js +873 -648
- package/dist/solid.cjs +703 -560
- package/dist/solid.d.cts +264 -32
- package/dist/solid.d.ts +264 -32
- package/dist/solid.js +704 -561
- package/dist/solid.source.jsx +3215 -0
- package/dist/styles.css +37 -112
- package/dist/svelte-core.cjs +3149 -0
- package/dist/svelte-core.js +3147 -0
- package/dist/svelte-src/BottomSheet.svelte +210 -0
- package/dist/svelte-src/index.js +2 -0
- package/dist/svelte.cjs +718 -547
- package/dist/svelte.d.cts +100 -0
- package/dist/svelte.d.ts +15 -4
- package/dist/svelte.js +719 -548
- package/dist/themes/ios.css +0 -3
- package/dist/themes/material.css +0 -3
- package/dist/themes/vercel.css +0 -3
- package/dist/{transform-Brkf-wzo.d.cts → transform-jVfAikE9.d.cts} +0 -1
- package/dist/{transform-Brkf-wzo.d.ts → transform-jVfAikE9.d.ts} +0 -1
- package/dist/vue.cjs +677 -526
- package/dist/vue.d.cts +78 -0
- package/dist/vue.d.ts +12 -2
- package/dist/vue.js +678 -527
- package/package.json +105 -45
- package/dist/BottomSheetEngine-CvSVbo6c.d.cts +0 -704
- package/dist/BottomSheetEngine-DbO8rW_3.d.ts +0 -704
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { B as BottomSheetEngine, E as EngineState, P as Plugin,
|
|
1
|
+
import { d as SnapPoint, b as SheetMode, a as SnapPointDef, c as EngineOptions, f as ScrimOverlayPosition } from './BottomSheetEngine-CAymrH-P.cjs';
|
|
2
|
+
export { g as AnchorAnimationPreset, h as AnchorAnimationSpec, i as AnchorHandle, A as AnchorOptions, j as AnchorPosition, k as AnchorState, B as BottomSheetEngine, E as EngineState, P as Plugin, l as SCRIM_PRESETS, m as ScrimOverlayOptions, n as ScrimPreset, o as ScrimPresetConfig, p as ScrimStageDef, S as ScrimStagesOptions, q as ScrimUpdate, e as SheetEventMap, r as SnapId, T as TeardownScope, s as runAnchorTransition } from './BottomSheetEngine-CAymrH-P.cjs';
|
|
3
3
|
export { OVERLAY_PRESETS, Overlay, OverlayAnimation, OverlayCloseReason, OverlayEdge, Overlay as OverlayEngine, OverlayEventMap, OverlayMountTarget, OverlayOptions, OverlayPreset, OverlayState, OverlayUpdate, SwipeToCloseConfig, createOverlay } from './overlay.cjs';
|
|
4
|
-
import './transform-
|
|
4
|
+
import './transform-jVfAikE9.cjs';
|
|
5
5
|
|
|
6
6
|
declare const easeOutBack: (t: number) => number;
|
|
7
7
|
declare const easeOutCubic: (t: number) => number;
|
|
@@ -16,24 +16,13 @@ type TweenOptions = {
|
|
|
16
16
|
easing?: (t: number) => number;
|
|
17
17
|
onUpdate: (value: number) => void;
|
|
18
18
|
};
|
|
19
|
-
/**
|
|
20
|
-
* rAF tween. Promise resolves both on natural completion AND on cancel so
|
|
21
|
-
* callers awaiting it always settle; they're expected to cycle-nonce-check
|
|
22
|
-
* after the await before running post-settle effects.
|
|
23
|
-
*/
|
|
24
19
|
declare const tween: ({ from, to, duration, easing, onUpdate, }: TweenOptions) => Tween;
|
|
25
20
|
declare const prefersReducedMotion: () => boolean;
|
|
26
21
|
|
|
27
|
-
/**
|
|
28
|
-
* Damped harmonic oscillator: x'' = -k(x - target)/m - c*x'/m
|
|
29
|
-
* Integrated with semi-implicit Euler at variable dt; settles when both
|
|
30
|
-
* displacement and velocity drop below epsilon.
|
|
31
|
-
*/
|
|
32
22
|
type SpringConfig = {
|
|
33
23
|
stiffness: number;
|
|
34
24
|
damping: number;
|
|
35
25
|
mass: number;
|
|
36
|
-
/** Stop animation when |x - target| < restDelta AND |v| < restSpeed. */
|
|
37
26
|
restDelta?: number;
|
|
38
27
|
restSpeed?: number;
|
|
39
28
|
};
|
|
@@ -49,24 +38,8 @@ type SpringHandle = {
|
|
|
49
38
|
cancel: () => void;
|
|
50
39
|
promise: Promise<void>;
|
|
51
40
|
};
|
|
52
|
-
/**
|
|
53
|
-
* Run a spring animation from `from` to `to` with initial velocity. The
|
|
54
|
-
* promise resolves on natural settle AND on cancel so awaiters always
|
|
55
|
-
* settle; callers cycle-nonce-check after the await before running
|
|
56
|
-
* post-settle effects.
|
|
57
|
-
*/
|
|
58
41
|
declare const runSpring: ({ from, to, velocity, config, onUpdate, }: SpringRunOptions) => SpringHandle;
|
|
59
42
|
|
|
60
|
-
/**
|
|
61
|
-
* Resolve a `SnapPoint` to pixels.
|
|
62
|
-
*
|
|
63
|
-
* number → as-is
|
|
64
|
-
* "full" → viewport along the axis
|
|
65
|
-
* "fit" → measureFit() — handle/header offset
|
|
66
|
-
* "30%" → percent of viewport along axis (fast path)
|
|
67
|
-
* any other → CSS length resolved via probe element (dvh, vmin,
|
|
68
|
-
* clamp(), env(safe-area-inset-bottom), ...)
|
|
69
|
-
*/
|
|
70
43
|
declare const resolveSnap: (point: SnapPoint | string, mode: SheetMode, measureFit?: () => number) => number;
|
|
71
44
|
|
|
72
45
|
type ResolvedSnap = {
|
|
@@ -74,11 +47,6 @@ type ResolvedSnap = {
|
|
|
74
47
|
size: number;
|
|
75
48
|
};
|
|
76
49
|
declare const resolveSnapList: (points: SnapPointDef[], mode: SheetMode, measureFit?: () => number) => ResolvedSnap[];
|
|
77
|
-
/**
|
|
78
|
-
* Finds the snap point closest to `size`, optionally biased by drag
|
|
79
|
-
* direction (positive = expanding) so flicks settle on the next-up snap
|
|
80
|
-
* even when geometrically closer to the previous one.
|
|
81
|
-
*/
|
|
82
50
|
declare const findNearest: (size: number, resolved: ResolvedSnap[], allowed: string[], direction?: 1 | -1 | 0, bias?: number) => ResolvedSnap | null;
|
|
83
51
|
declare const allowedRange: (resolved: ResolvedSnap[], allowed: string[]) => {
|
|
84
52
|
min: number;
|
|
@@ -93,28 +61,9 @@ type GestureCallbacks = {
|
|
|
93
61
|
onEnd: (delta: number, velocity: number, pointerType: PointerKind) => void;
|
|
94
62
|
onCancel?: () => void;
|
|
95
63
|
};
|
|
96
|
-
/**
|
|
97
|
-
* Pointer Events handler with velocity tracking. Listens on `handle` for the
|
|
98
|
-
* initial press, then captures the pointer so movement outside the element is
|
|
99
|
-
* still tracked. Multi-touch is ignored: only the first pointer drives the gesture.
|
|
100
|
-
*
|
|
101
|
-
* Velocity is computed from the last ~80ms of samples for stable flick detection.
|
|
102
|
-
*/
|
|
103
64
|
declare const installGestures: (handle: HTMLElement, mode: SheetMode, callbacks: GestureCallbacks) => (() => void);
|
|
104
|
-
/**
|
|
105
|
-
* @deprecated Renamed to `installGestures` for naming consistency with the
|
|
106
|
-
* other `installX` feature factories. Will be removed in v2 — see
|
|
107
|
-
* `docs/migration-v2.md`.
|
|
108
|
-
*/
|
|
109
65
|
declare const attachGestures: (handle: HTMLElement, mode: SheetMode, callbacks: GestureCallbacks) => (() => void);
|
|
110
66
|
|
|
111
|
-
/**
|
|
112
|
-
* Trap Tab focus inside `container`. Calls `onEscape` when Esc is pressed
|
|
113
|
-
* (caller decides whether to close the sheet). Returns a teardown function
|
|
114
|
-
* that releases the trap and restores focus to the previously-active element.
|
|
115
|
-
*
|
|
116
|
-
* SSR-safe: if `document` is unavailable, returns a no-op teardown.
|
|
117
|
-
*/
|
|
118
67
|
declare const installFocusTrap: (container: HTMLElement, options?: {
|
|
119
68
|
initialFocus?: HTMLElement | string;
|
|
120
69
|
onEscape?: () => void;
|
|
@@ -122,63 +71,47 @@ declare const installFocusTrap: (container: HTMLElement, options?: {
|
|
|
122
71
|
|
|
123
72
|
declare const lockBodyScroll: () => (() => void);
|
|
124
73
|
|
|
125
|
-
/**
|
|
126
|
-
* Multi-sheet z-index orchestration.
|
|
127
|
-
*
|
|
128
|
-
* When you have a sheet that itself opens another sheet (e.g. menu → detail),
|
|
129
|
-
* naive rendering stacks them at the same z-index and the second one is
|
|
130
|
-
* obscured. The stack assigns ascending z-indices and notifies the topmost
|
|
131
|
-
* sheet so it can render its backdrop while inner sheets skip theirs.
|
|
132
|
-
*/
|
|
133
74
|
type StackEntry = {
|
|
134
75
|
id: string;
|
|
135
76
|
setZIndex: (z: number) => void;
|
|
136
77
|
setIsTop: (isTop: boolean) => void;
|
|
78
|
+
isOpen?: () => boolean;
|
|
79
|
+
setDepth?: (depth: number) => void;
|
|
137
80
|
};
|
|
138
81
|
declare class SheetStack {
|
|
139
82
|
private entries;
|
|
140
83
|
push(entry: StackEntry): () => void;
|
|
141
84
|
remove(id: string): void;
|
|
85
|
+
promote(id: string): void;
|
|
86
|
+
update(): void;
|
|
142
87
|
size(): number;
|
|
143
88
|
clear(): void;
|
|
144
89
|
private recompute;
|
|
145
90
|
}
|
|
146
|
-
/** Process-wide singleton so any adapter can reach the same stack. */
|
|
147
91
|
declare const sheetStack: SheetStack;
|
|
148
92
|
|
|
149
|
-
/**
|
|
150
|
-
* Route-based / context-based sheet config registry. Caller maps a key
|
|
151
|
-
* (route name, screen id, modal kind, anything) to a partial engine config;
|
|
152
|
-
* `manager.resolve(key)` returns the merged options ready to feed into
|
|
153
|
-
* `BottomSheetEngine` or any adapter.
|
|
154
|
-
*
|
|
155
|
-
* Lifecycle hooks (`onOpen`, `onClose`) are stored alongside the config so
|
|
156
|
-
* the consumer can attach them via `engine.on(...)` without ceremony.
|
|
157
|
-
*
|
|
158
|
-
* const manager = createSheetManager({
|
|
159
|
-
* home: { snapPoints: [...], allowed: ["min","half","full"], onOpen: load },
|
|
160
|
-
* marker: { snapPoints: [...], allowed: ["half","full"], onOpen: focus },
|
|
161
|
-
* });
|
|
162
|
-
* manager.resolve("home"); // → { snapPoints, allowed, onOpen, onClose }
|
|
163
|
-
*/
|
|
164
93
|
type SheetConfig<Key extends string = string> = Partial<Omit<EngineOptions, "element" | "handle" | "scrollContainer" | "backdrop">> & {
|
|
165
|
-
/** Logical key (route name, modal kind, ...) — useful for telemetry. */
|
|
166
94
|
key?: Key;
|
|
167
95
|
onOpen?: (key: Key) => void;
|
|
168
96
|
onClose?: (key: Key) => void;
|
|
169
97
|
};
|
|
170
98
|
type SheetManager<Key extends string = string> = {
|
|
171
|
-
/** Register or replace a config. */
|
|
172
99
|
register(key: Key, config: SheetConfig<Key>): void;
|
|
173
|
-
/** Remove a registered config. */
|
|
174
100
|
unregister(key: Key): void;
|
|
175
|
-
/** Look up a config by key. Returns null if absent. */
|
|
176
101
|
resolve(key: Key): SheetConfig<Key> | null;
|
|
177
|
-
/** Get all registered keys. */
|
|
178
102
|
keys(): Key[];
|
|
179
|
-
/** Run `onClose(prev)` then `onOpen(next)` — for route transitions. */
|
|
180
103
|
transition(prev: Key | null, next: Key | null): void;
|
|
181
104
|
};
|
|
182
105
|
declare const createSheetManager: <Key extends string = string>(initial?: Record<Key, SheetConfig<Key>>) => SheetManager<Key>;
|
|
183
106
|
|
|
184
|
-
|
|
107
|
+
type SheetAnchoredStyle = {
|
|
108
|
+
top?: string;
|
|
109
|
+
bottom?: string;
|
|
110
|
+
left?: string;
|
|
111
|
+
right?: string;
|
|
112
|
+
transform?: string;
|
|
113
|
+
};
|
|
114
|
+
declare function resolveSheetAnchoredStyle(mode: SheetMode, position: "sheet-top-left" | "sheet-top-center" | "sheet-top-right", inset: string): SheetAnchoredStyle;
|
|
115
|
+
declare function applyOverlayPosition(ws: CSSStyleDeclaration, mode: SheetMode, position: ScrimOverlayPosition, inset: string): void;
|
|
116
|
+
|
|
117
|
+
export { DEFAULT_SPRING, EngineOptions, type ResolvedSnap, ScrimOverlayPosition, type SheetConfig, type SheetManager, SheetMode, SnapPoint, SnapPointDef, type SpringConfig, type SpringHandle, type SpringRunOptions, type StackEntry, type Tween, type TweenOptions, allowedRange, applyOverlayPosition, attachGestures, createSheetManager, easeOutBack, easeOutCubic, findById, findNearest, installFocusTrap, installGestures, lockBodyScroll, prefersReducedMotion, resolveSheetAnchoredStyle, resolveSnap, resolveSnapList, runSpring, sheetStack, tween };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { B as BottomSheetEngine, E as EngineState, P as Plugin,
|
|
1
|
+
import { d as SnapPoint, b as SheetMode, a as SnapPointDef, c as EngineOptions, f as ScrimOverlayPosition } from './BottomSheetEngine-DcqcuudN.js';
|
|
2
|
+
export { g as AnchorAnimationPreset, h as AnchorAnimationSpec, i as AnchorHandle, A as AnchorOptions, j as AnchorPosition, k as AnchorState, B as BottomSheetEngine, E as EngineState, P as Plugin, l as SCRIM_PRESETS, m as ScrimOverlayOptions, n as ScrimPreset, o as ScrimPresetConfig, p as ScrimStageDef, S as ScrimStagesOptions, q as ScrimUpdate, e as SheetEventMap, r as SnapId, T as TeardownScope, s as runAnchorTransition } from './BottomSheetEngine-DcqcuudN.js';
|
|
3
3
|
export { OVERLAY_PRESETS, Overlay, OverlayAnimation, OverlayCloseReason, OverlayEdge, Overlay as OverlayEngine, OverlayEventMap, OverlayMountTarget, OverlayOptions, OverlayPreset, OverlayState, OverlayUpdate, SwipeToCloseConfig, createOverlay } from './overlay.js';
|
|
4
|
-
import './transform-
|
|
4
|
+
import './transform-jVfAikE9.js';
|
|
5
5
|
|
|
6
6
|
declare const easeOutBack: (t: number) => number;
|
|
7
7
|
declare const easeOutCubic: (t: number) => number;
|
|
@@ -16,24 +16,13 @@ type TweenOptions = {
|
|
|
16
16
|
easing?: (t: number) => number;
|
|
17
17
|
onUpdate: (value: number) => void;
|
|
18
18
|
};
|
|
19
|
-
/**
|
|
20
|
-
* rAF tween. Promise resolves both on natural completion AND on cancel so
|
|
21
|
-
* callers awaiting it always settle; they're expected to cycle-nonce-check
|
|
22
|
-
* after the await before running post-settle effects.
|
|
23
|
-
*/
|
|
24
19
|
declare const tween: ({ from, to, duration, easing, onUpdate, }: TweenOptions) => Tween;
|
|
25
20
|
declare const prefersReducedMotion: () => boolean;
|
|
26
21
|
|
|
27
|
-
/**
|
|
28
|
-
* Damped harmonic oscillator: x'' = -k(x - target)/m - c*x'/m
|
|
29
|
-
* Integrated with semi-implicit Euler at variable dt; settles when both
|
|
30
|
-
* displacement and velocity drop below epsilon.
|
|
31
|
-
*/
|
|
32
22
|
type SpringConfig = {
|
|
33
23
|
stiffness: number;
|
|
34
24
|
damping: number;
|
|
35
25
|
mass: number;
|
|
36
|
-
/** Stop animation when |x - target| < restDelta AND |v| < restSpeed. */
|
|
37
26
|
restDelta?: number;
|
|
38
27
|
restSpeed?: number;
|
|
39
28
|
};
|
|
@@ -49,24 +38,8 @@ type SpringHandle = {
|
|
|
49
38
|
cancel: () => void;
|
|
50
39
|
promise: Promise<void>;
|
|
51
40
|
};
|
|
52
|
-
/**
|
|
53
|
-
* Run a spring animation from `from` to `to` with initial velocity. The
|
|
54
|
-
* promise resolves on natural settle AND on cancel so awaiters always
|
|
55
|
-
* settle; callers cycle-nonce-check after the await before running
|
|
56
|
-
* post-settle effects.
|
|
57
|
-
*/
|
|
58
41
|
declare const runSpring: ({ from, to, velocity, config, onUpdate, }: SpringRunOptions) => SpringHandle;
|
|
59
42
|
|
|
60
|
-
/**
|
|
61
|
-
* Resolve a `SnapPoint` to pixels.
|
|
62
|
-
*
|
|
63
|
-
* number → as-is
|
|
64
|
-
* "full" → viewport along the axis
|
|
65
|
-
* "fit" → measureFit() — handle/header offset
|
|
66
|
-
* "30%" → percent of viewport along axis (fast path)
|
|
67
|
-
* any other → CSS length resolved via probe element (dvh, vmin,
|
|
68
|
-
* clamp(), env(safe-area-inset-bottom), ...)
|
|
69
|
-
*/
|
|
70
43
|
declare const resolveSnap: (point: SnapPoint | string, mode: SheetMode, measureFit?: () => number) => number;
|
|
71
44
|
|
|
72
45
|
type ResolvedSnap = {
|
|
@@ -74,11 +47,6 @@ type ResolvedSnap = {
|
|
|
74
47
|
size: number;
|
|
75
48
|
};
|
|
76
49
|
declare const resolveSnapList: (points: SnapPointDef[], mode: SheetMode, measureFit?: () => number) => ResolvedSnap[];
|
|
77
|
-
/**
|
|
78
|
-
* Finds the snap point closest to `size`, optionally biased by drag
|
|
79
|
-
* direction (positive = expanding) so flicks settle on the next-up snap
|
|
80
|
-
* even when geometrically closer to the previous one.
|
|
81
|
-
*/
|
|
82
50
|
declare const findNearest: (size: number, resolved: ResolvedSnap[], allowed: string[], direction?: 1 | -1 | 0, bias?: number) => ResolvedSnap | null;
|
|
83
51
|
declare const allowedRange: (resolved: ResolvedSnap[], allowed: string[]) => {
|
|
84
52
|
min: number;
|
|
@@ -93,28 +61,9 @@ type GestureCallbacks = {
|
|
|
93
61
|
onEnd: (delta: number, velocity: number, pointerType: PointerKind) => void;
|
|
94
62
|
onCancel?: () => void;
|
|
95
63
|
};
|
|
96
|
-
/**
|
|
97
|
-
* Pointer Events handler with velocity tracking. Listens on `handle` for the
|
|
98
|
-
* initial press, then captures the pointer so movement outside the element is
|
|
99
|
-
* still tracked. Multi-touch is ignored: only the first pointer drives the gesture.
|
|
100
|
-
*
|
|
101
|
-
* Velocity is computed from the last ~80ms of samples for stable flick detection.
|
|
102
|
-
*/
|
|
103
64
|
declare const installGestures: (handle: HTMLElement, mode: SheetMode, callbacks: GestureCallbacks) => (() => void);
|
|
104
|
-
/**
|
|
105
|
-
* @deprecated Renamed to `installGestures` for naming consistency with the
|
|
106
|
-
* other `installX` feature factories. Will be removed in v2 — see
|
|
107
|
-
* `docs/migration-v2.md`.
|
|
108
|
-
*/
|
|
109
65
|
declare const attachGestures: (handle: HTMLElement, mode: SheetMode, callbacks: GestureCallbacks) => (() => void);
|
|
110
66
|
|
|
111
|
-
/**
|
|
112
|
-
* Trap Tab focus inside `container`. Calls `onEscape` when Esc is pressed
|
|
113
|
-
* (caller decides whether to close the sheet). Returns a teardown function
|
|
114
|
-
* that releases the trap and restores focus to the previously-active element.
|
|
115
|
-
*
|
|
116
|
-
* SSR-safe: if `document` is unavailable, returns a no-op teardown.
|
|
117
|
-
*/
|
|
118
67
|
declare const installFocusTrap: (container: HTMLElement, options?: {
|
|
119
68
|
initialFocus?: HTMLElement | string;
|
|
120
69
|
onEscape?: () => void;
|
|
@@ -122,63 +71,47 @@ declare const installFocusTrap: (container: HTMLElement, options?: {
|
|
|
122
71
|
|
|
123
72
|
declare const lockBodyScroll: () => (() => void);
|
|
124
73
|
|
|
125
|
-
/**
|
|
126
|
-
* Multi-sheet z-index orchestration.
|
|
127
|
-
*
|
|
128
|
-
* When you have a sheet that itself opens another sheet (e.g. menu → detail),
|
|
129
|
-
* naive rendering stacks them at the same z-index and the second one is
|
|
130
|
-
* obscured. The stack assigns ascending z-indices and notifies the topmost
|
|
131
|
-
* sheet so it can render its backdrop while inner sheets skip theirs.
|
|
132
|
-
*/
|
|
133
74
|
type StackEntry = {
|
|
134
75
|
id: string;
|
|
135
76
|
setZIndex: (z: number) => void;
|
|
136
77
|
setIsTop: (isTop: boolean) => void;
|
|
78
|
+
isOpen?: () => boolean;
|
|
79
|
+
setDepth?: (depth: number) => void;
|
|
137
80
|
};
|
|
138
81
|
declare class SheetStack {
|
|
139
82
|
private entries;
|
|
140
83
|
push(entry: StackEntry): () => void;
|
|
141
84
|
remove(id: string): void;
|
|
85
|
+
promote(id: string): void;
|
|
86
|
+
update(): void;
|
|
142
87
|
size(): number;
|
|
143
88
|
clear(): void;
|
|
144
89
|
private recompute;
|
|
145
90
|
}
|
|
146
|
-
/** Process-wide singleton so any adapter can reach the same stack. */
|
|
147
91
|
declare const sheetStack: SheetStack;
|
|
148
92
|
|
|
149
|
-
/**
|
|
150
|
-
* Route-based / context-based sheet config registry. Caller maps a key
|
|
151
|
-
* (route name, screen id, modal kind, anything) to a partial engine config;
|
|
152
|
-
* `manager.resolve(key)` returns the merged options ready to feed into
|
|
153
|
-
* `BottomSheetEngine` or any adapter.
|
|
154
|
-
*
|
|
155
|
-
* Lifecycle hooks (`onOpen`, `onClose`) are stored alongside the config so
|
|
156
|
-
* the consumer can attach them via `engine.on(...)` without ceremony.
|
|
157
|
-
*
|
|
158
|
-
* const manager = createSheetManager({
|
|
159
|
-
* home: { snapPoints: [...], allowed: ["min","half","full"], onOpen: load },
|
|
160
|
-
* marker: { snapPoints: [...], allowed: ["half","full"], onOpen: focus },
|
|
161
|
-
* });
|
|
162
|
-
* manager.resolve("home"); // → { snapPoints, allowed, onOpen, onClose }
|
|
163
|
-
*/
|
|
164
93
|
type SheetConfig<Key extends string = string> = Partial<Omit<EngineOptions, "element" | "handle" | "scrollContainer" | "backdrop">> & {
|
|
165
|
-
/** Logical key (route name, modal kind, ...) — useful for telemetry. */
|
|
166
94
|
key?: Key;
|
|
167
95
|
onOpen?: (key: Key) => void;
|
|
168
96
|
onClose?: (key: Key) => void;
|
|
169
97
|
};
|
|
170
98
|
type SheetManager<Key extends string = string> = {
|
|
171
|
-
/** Register or replace a config. */
|
|
172
99
|
register(key: Key, config: SheetConfig<Key>): void;
|
|
173
|
-
/** Remove a registered config. */
|
|
174
100
|
unregister(key: Key): void;
|
|
175
|
-
/** Look up a config by key. Returns null if absent. */
|
|
176
101
|
resolve(key: Key): SheetConfig<Key> | null;
|
|
177
|
-
/** Get all registered keys. */
|
|
178
102
|
keys(): Key[];
|
|
179
|
-
/** Run `onClose(prev)` then `onOpen(next)` — for route transitions. */
|
|
180
103
|
transition(prev: Key | null, next: Key | null): void;
|
|
181
104
|
};
|
|
182
105
|
declare const createSheetManager: <Key extends string = string>(initial?: Record<Key, SheetConfig<Key>>) => SheetManager<Key>;
|
|
183
106
|
|
|
184
|
-
|
|
107
|
+
type SheetAnchoredStyle = {
|
|
108
|
+
top?: string;
|
|
109
|
+
bottom?: string;
|
|
110
|
+
left?: string;
|
|
111
|
+
right?: string;
|
|
112
|
+
transform?: string;
|
|
113
|
+
};
|
|
114
|
+
declare function resolveSheetAnchoredStyle(mode: SheetMode, position: "sheet-top-left" | "sheet-top-center" | "sheet-top-right", inset: string): SheetAnchoredStyle;
|
|
115
|
+
declare function applyOverlayPosition(ws: CSSStyleDeclaration, mode: SheetMode, position: ScrimOverlayPosition, inset: string): void;
|
|
116
|
+
|
|
117
|
+
export { DEFAULT_SPRING, EngineOptions, type ResolvedSnap, ScrimOverlayPosition, type SheetConfig, type SheetManager, SheetMode, SnapPoint, SnapPointDef, type SpringConfig, type SpringHandle, type SpringRunOptions, type StackEntry, type Tween, type TweenOptions, allowedRange, applyOverlayPosition, attachGestures, createSheetManager, easeOutBack, easeOutCubic, findById, findNearest, installFocusTrap, installGestures, lockBodyScroll, prefersReducedMotion, resolveSheetAnchoredStyle, resolveSnap, resolveSnapList, runSpring, sheetStack, tween };
|