@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/overlay.d.cts
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
import { T as TransformAxis } from './transform-
|
|
1
|
+
import { T as TransformAxis } from './transform-jVfAikE9.cjs';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Slide-up panel without gestures. CSS-transition-driven, single-state.
|
|
5
|
-
* Distinct from `BottomSheetEngine`, which is gesture-driven and multi-snap.
|
|
6
|
-
*
|
|
7
|
-
* Shares scroll-lock / focus-trap / sheet-stack / inert-siblings / transform
|
|
8
|
-
* primitives with the engine so z-indices orchestrate automatically when
|
|
9
|
-
* sheets and overlays mix and feature behaviour stays consistent.
|
|
10
|
-
*/
|
|
11
3
|
type OverlayEdge = TransformAxis;
|
|
12
4
|
type OverlayAnimation = "slide" | "fade" | "scale";
|
|
13
5
|
type OverlayCloseReason = "escape" | "backdrop" | "swipe" | "back" | "programmatic" | "outside-pointer";
|
|
@@ -17,12 +9,6 @@ type SwipeToCloseConfig = {
|
|
|
17
9
|
velocityThreshold?: number;
|
|
18
10
|
};
|
|
19
11
|
type OverlayMountTarget = HTMLElement | "body" | "parent";
|
|
20
|
-
/**
|
|
21
|
-
* Named overlay archetypes — bundle the common animation + dim + gesture
|
|
22
|
-
* combinations so consumers can opt into a "mode" without restating every
|
|
23
|
-
* field. Applied BEFORE individual options at construction, and as the
|
|
24
|
-
* first step of `setOverlay()` so individual overrides win.
|
|
25
|
-
*/
|
|
26
12
|
type OverlayPreset = "sheet" | "dialog" | "sidebar" | "toast";
|
|
27
13
|
type OverlayPresetConfig = {
|
|
28
14
|
enterAnimation: OverlayAnimation;
|
|
@@ -32,12 +18,6 @@ type OverlayPresetConfig = {
|
|
|
32
18
|
swipeToClose: boolean | SwipeToCloseConfig;
|
|
33
19
|
};
|
|
34
20
|
declare const OVERLAY_PRESETS: Readonly<Record<OverlayPreset, Readonly<OverlayPresetConfig>>>;
|
|
35
|
-
/**
|
|
36
|
-
* Batch payload for `setOverlay()`. `null` on `backdropFilter` clears it
|
|
37
|
-
* (distinct from `undefined` which means "leave as-is" in the diff). Apply
|
|
38
|
-
* order: preset first, then individual overrides — single DOM-write phase
|
|
39
|
-
* if the overlay is currently open.
|
|
40
|
-
*/
|
|
41
21
|
type OverlayUpdate = {
|
|
42
22
|
backdropOpacity?: number;
|
|
43
23
|
backdropFilter?: string | null;
|
|
@@ -45,107 +25,40 @@ type OverlayUpdate = {
|
|
|
45
25
|
enterAnimation?: OverlayAnimation;
|
|
46
26
|
exitAnimation?: OverlayAnimation;
|
|
47
27
|
preset?: OverlayPreset;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
28
|
+
duration?: number;
|
|
29
|
+
enterEasing?: string;
|
|
30
|
+
exitEasing?: string;
|
|
31
|
+
closeOnEscape?: boolean;
|
|
32
|
+
closeOnBackdrop?: boolean;
|
|
33
|
+
closeOnOutsidePointer?: boolean;
|
|
53
34
|
children?: HTMLElement | DocumentFragment | (() => HTMLElement | DocumentFragment) | null;
|
|
54
35
|
};
|
|
55
36
|
type OverlayOptions = {
|
|
56
|
-
/** The panel element — gets transform/opacity inline writes. */
|
|
57
37
|
element: HTMLElement;
|
|
58
|
-
/** Optional dimmed backdrop element. */
|
|
59
38
|
backdrop?: HTMLElement;
|
|
60
|
-
/** Edge the panel slides in from. Default: "bottom". */
|
|
61
39
|
edge?: OverlayEdge;
|
|
62
|
-
/** Open immediately on construction. Default: false. */
|
|
63
40
|
initialOpen?: boolean;
|
|
64
|
-
/** Listen for Escape key. Default: true. */
|
|
65
41
|
closeOnEscape?: boolean;
|
|
66
|
-
/** Tap on backdrop closes. Default: true. */
|
|
67
42
|
closeOnBackdrop?: boolean;
|
|
68
|
-
/** Trap Tab focus inside the panel. Default: true. */
|
|
69
43
|
focusTrap?: boolean;
|
|
70
|
-
/** Selector or HTMLElement focused on open. */
|
|
71
44
|
initialFocus?: string | HTMLElement;
|
|
72
|
-
/**
|
|
73
|
-
* Element to focus after close. By default the focus trap restores
|
|
74
|
-
* whatever was focused before open. Pass an element or a getter for
|
|
75
|
-
* explicit control (e.g. focus a status banner instead of the trigger).
|
|
76
|
-
*/
|
|
77
45
|
returnFocus?: HTMLElement | (() => HTMLElement | null);
|
|
78
|
-
/** Lock body scroll while open. Default: true. */
|
|
79
46
|
lockBodyScroll?: boolean;
|
|
80
|
-
/** Mark page siblings `inert` while open (full a11y modal). Default: false. */
|
|
81
47
|
inertSiblings?: boolean;
|
|
82
|
-
/** Push history state so Android back closes the overlay. Default: false. */
|
|
83
48
|
closeOnBack?: boolean;
|
|
84
|
-
/** Animation duration in ms. Default: 320. */
|
|
85
49
|
duration?: number;
|
|
86
|
-
/** CSS easing for the slide-in. Default matches monitoring's bezier. */
|
|
87
50
|
enterEasing?: string;
|
|
88
|
-
/** CSS easing for the slide-out. Default: ease-in. */
|
|
89
51
|
exitEasing?: string;
|
|
90
|
-
/**
|
|
91
|
-
* Peak backdrop opacity when open. Useful when `backdropFilter` blur
|
|
92
|
-
* already darkens enough and the dim should be light (e.g. 0.3).
|
|
93
|
-
* Default: 1.
|
|
94
|
-
*/
|
|
95
52
|
backdropOpacity?: number;
|
|
96
|
-
/**
|
|
97
|
-
* CSS `backdrop-filter` value applied to the backdrop while open
|
|
98
|
-
* (e.g. `"blur(8px)"`, `"blur(12px) saturate(140%)"`). Cleared on close.
|
|
99
|
-
*/
|
|
100
53
|
backdropFilter?: string;
|
|
101
|
-
/**
|
|
102
|
-
* Allow drag-to-dismiss along the entry edge — pointer-driven. The panel
|
|
103
|
-
* follows the finger past the closed-edge axis and dismisses if the user
|
|
104
|
-
* crosses 30% of the panel size or releases with > 0.5 px/ms velocity.
|
|
105
|
-
*
|
|
106
|
-
* Pass a config object to tune thresholds:
|
|
107
|
-
* `{ enabled: true, threshold: 0.5, velocityThreshold: 1.0 }`.
|
|
108
|
-
* Default: false (CSS-only transition).
|
|
109
|
-
*/
|
|
110
54
|
swipeToClose?: boolean | SwipeToCloseConfig;
|
|
111
|
-
/**
|
|
112
|
-
* Entry animation. `"slide"` (default) translates from the edge.
|
|
113
|
-
* `"fade"` is opacity-only (no transform). `"scale"` fades + scales
|
|
114
|
-
* from 0.94 — best for centred dialogs.
|
|
115
|
-
*/
|
|
116
55
|
enterAnimation?: OverlayAnimation;
|
|
117
|
-
/** Exit animation. Defaults to `enterAnimation`. */
|
|
118
56
|
exitAnimation?: OverlayAnimation;
|
|
119
|
-
/**
|
|
120
|
-
* Move `element` to a different container on first open. `'parent'`
|
|
121
|
-
* (default) leaves it in place. `'body'` appends to `document.body`.
|
|
122
|
-
* Pass an explicit `HTMLElement` for any other portal target.
|
|
123
|
-
*
|
|
124
|
-
* Restored to its original parent on `destroy()`. Move is deferred to
|
|
125
|
-
* first `open()` so SSR / pre-mount construction doesn't crash.
|
|
126
|
-
*/
|
|
127
57
|
mountTo?: OverlayMountTarget;
|
|
128
|
-
/**
|
|
129
|
-
* `peek` keeps part of the panel visible when closed instead of
|
|
130
|
-
* translating fully off-screen. Number is treated as pixels; strings
|
|
131
|
-
* accept any CSS length (`"10dvh"`, `"clamp(40px, 8vh, 80px)"`).
|
|
132
|
-
* Only honoured when `edge: 'bottom'` — warns and falls back otherwise.
|
|
133
|
-
*/
|
|
134
58
|
peek?: number | string;
|
|
135
|
-
/**
|
|
136
|
-
* Close when a pointerdown lands outside `element` AND outside `backdrop`.
|
|
137
|
-
* Distinct from `closeOnBackdrop` — this fires even when no backdrop is
|
|
138
|
-
* mounted. Single document-level listener, removed on close.
|
|
139
|
-
*/
|
|
140
59
|
closeOnOutsidePointer?: boolean;
|
|
141
|
-
/**
|
|
142
|
-
* Named archetype — bundles `enterAnimation`/`exitAnimation`/
|
|
143
|
-
* `backdropOpacity`/`backdropFilter`/`swipeToClose` defaults. Applied
|
|
144
|
-
* BEFORE the individual options on this object, so any explicit field
|
|
145
|
-
* still wins over the preset's default.
|
|
146
|
-
*/
|
|
147
60
|
preset?: OverlayPreset;
|
|
148
|
-
|
|
61
|
+
respectReducedMotion?: boolean;
|
|
149
62
|
onOpen?: () => void;
|
|
150
63
|
onClose?: () => void;
|
|
151
64
|
};
|
|
@@ -193,6 +106,10 @@ declare class OverlayEngine {
|
|
|
193
106
|
private closeOnOutsidePointerEnabled;
|
|
194
107
|
private detachOutsidePointer;
|
|
195
108
|
private detachSwipe;
|
|
109
|
+
private respectReducedMotionEnabled;
|
|
110
|
+
private isTop;
|
|
111
|
+
private backPushed;
|
|
112
|
+
private movedToTarget;
|
|
196
113
|
private onOpenCb?;
|
|
197
114
|
private onCloseCb?;
|
|
198
115
|
private isOpen_;
|
|
@@ -213,52 +130,19 @@ declare class OverlayEngine {
|
|
|
213
130
|
close(reason?: OverlayCloseReason): Promise<void>;
|
|
214
131
|
toggle(): Promise<void>;
|
|
215
132
|
destroy(): void;
|
|
216
|
-
/**
|
|
217
|
-
* Runtime visual setter — opacity is applied immediately when open so a
|
|
218
|
-
* live-controls panel can preview the change without re-opening. When
|
|
219
|
-
* closed we only stash the field; next open() picks it up so we don't
|
|
220
|
-
* mutate hidden DOM (avoids paint thrash on detached panels).
|
|
221
|
-
*/
|
|
222
133
|
setBackdropOpacity(opacity: number): void;
|
|
223
|
-
/**
|
|
224
|
-
* Runtime visual setter for `backdrop-filter`. `undefined` clears the
|
|
225
|
-
* filter (mirrors the close() behaviour). Defers to next open() when the
|
|
226
|
-
* overlay is currently closed.
|
|
227
|
-
*/
|
|
228
134
|
setBackdropFilter(filter: string | undefined): void;
|
|
229
|
-
/**
|
|
230
|
-
* Toggle / reconfigure swipe-to-close at runtime. Re-resolves the flat
|
|
231
|
-
* threshold fields, then installs or tears down the pointer listener so
|
|
232
|
-
* the change applies to the CURRENT open cycle. Idempotent: safe to call
|
|
233
|
-
* with the same config repeatedly.
|
|
234
|
-
*/
|
|
235
135
|
setSwipeToClose(config: boolean | SwipeToCloseConfig): void;
|
|
236
|
-
/** Animation setters only stage the field — applied on next open/close. */
|
|
237
136
|
setEnterAnimation(animation: OverlayAnimation): void;
|
|
238
137
|
setExitAnimation(animation: OverlayAnimation): void;
|
|
239
|
-
/** Updates the field used at next close() — no immediate side effect. */
|
|
240
138
|
setReturnFocus(target: HTMLElement | (() => HTMLElement | null) | undefined): void;
|
|
241
|
-
/**
|
|
242
|
-
* Batch update — preset first, then individual overrides. Applied as a
|
|
243
|
-
* single DOM-write phase when open so live-controls don't trigger
|
|
244
|
-
* cascading reflows. Safe to call when closed (defers to next open).
|
|
245
|
-
*/
|
|
246
139
|
setOverlay(opts: OverlayUpdate): void;
|
|
247
|
-
/**
|
|
248
|
-
* Runtime children injection — replace the panel's contents without
|
|
249
|
-
* unmounting the engine. `replaceChildren()` is a single atomic DOM op,
|
|
250
|
-
* so callers can swap content rapidly without intermediate flicker.
|
|
251
|
-
* Function form is resolved exactly ONCE per call (cheap lazy content).
|
|
252
|
-
*/
|
|
253
140
|
setOverlayChildren(children: HTMLElement | DocumentFragment | (() => HTMLElement | DocumentFragment)): void;
|
|
254
|
-
/**
|
|
255
|
-
* Clear injected children. No-op when nothing was injected so consumers
|
|
256
|
-
* who never used setOverlayChildren can call this defensively without
|
|
257
|
-
* paying for a DOM mutation.
|
|
258
|
-
*/
|
|
259
141
|
clearOverlayChildren(): void;
|
|
260
142
|
private assignSwipeFromConfig;
|
|
261
143
|
private emit;
|
|
144
|
+
private effectiveDuration;
|
|
145
|
+
private popBackMarker;
|
|
262
146
|
private resolvePeekPx;
|
|
263
147
|
private maybeMount;
|
|
264
148
|
private restoreMount;
|
|
@@ -266,13 +150,6 @@ declare class OverlayEngine {
|
|
|
266
150
|
private awaitTransition;
|
|
267
151
|
private installInteractiveListeners;
|
|
268
152
|
private releaseInteractiveListeners;
|
|
269
|
-
/**
|
|
270
|
-
* Light pointer-driven dismiss. Tracks finger along the edge axis, follows
|
|
271
|
-
* with translate, dismisses if past `swipeThreshold` (fraction of panel
|
|
272
|
-
* size) or release velocity exceeds `swipeVelocityThreshold` (px/ms).
|
|
273
|
-
* Pure CSS-transform during drag — no rAF or physics required since the
|
|
274
|
-
* panel only moves one direction.
|
|
275
|
-
*/
|
|
276
153
|
private installSwipeToClose;
|
|
277
154
|
private registerInStack;
|
|
278
155
|
}
|
package/dist/overlay.d.ts
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
import { T as TransformAxis } from './transform-
|
|
1
|
+
import { T as TransformAxis } from './transform-jVfAikE9.js';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Slide-up panel without gestures. CSS-transition-driven, single-state.
|
|
5
|
-
* Distinct from `BottomSheetEngine`, which is gesture-driven and multi-snap.
|
|
6
|
-
*
|
|
7
|
-
* Shares scroll-lock / focus-trap / sheet-stack / inert-siblings / transform
|
|
8
|
-
* primitives with the engine so z-indices orchestrate automatically when
|
|
9
|
-
* sheets and overlays mix and feature behaviour stays consistent.
|
|
10
|
-
*/
|
|
11
3
|
type OverlayEdge = TransformAxis;
|
|
12
4
|
type OverlayAnimation = "slide" | "fade" | "scale";
|
|
13
5
|
type OverlayCloseReason = "escape" | "backdrop" | "swipe" | "back" | "programmatic" | "outside-pointer";
|
|
@@ -17,12 +9,6 @@ type SwipeToCloseConfig = {
|
|
|
17
9
|
velocityThreshold?: number;
|
|
18
10
|
};
|
|
19
11
|
type OverlayMountTarget = HTMLElement | "body" | "parent";
|
|
20
|
-
/**
|
|
21
|
-
* Named overlay archetypes — bundle the common animation + dim + gesture
|
|
22
|
-
* combinations so consumers can opt into a "mode" without restating every
|
|
23
|
-
* field. Applied BEFORE individual options at construction, and as the
|
|
24
|
-
* first step of `setOverlay()` so individual overrides win.
|
|
25
|
-
*/
|
|
26
12
|
type OverlayPreset = "sheet" | "dialog" | "sidebar" | "toast";
|
|
27
13
|
type OverlayPresetConfig = {
|
|
28
14
|
enterAnimation: OverlayAnimation;
|
|
@@ -32,12 +18,6 @@ type OverlayPresetConfig = {
|
|
|
32
18
|
swipeToClose: boolean | SwipeToCloseConfig;
|
|
33
19
|
};
|
|
34
20
|
declare const OVERLAY_PRESETS: Readonly<Record<OverlayPreset, Readonly<OverlayPresetConfig>>>;
|
|
35
|
-
/**
|
|
36
|
-
* Batch payload for `setOverlay()`. `null` on `backdropFilter` clears it
|
|
37
|
-
* (distinct from `undefined` which means "leave as-is" in the diff). Apply
|
|
38
|
-
* order: preset first, then individual overrides — single DOM-write phase
|
|
39
|
-
* if the overlay is currently open.
|
|
40
|
-
*/
|
|
41
21
|
type OverlayUpdate = {
|
|
42
22
|
backdropOpacity?: number;
|
|
43
23
|
backdropFilter?: string | null;
|
|
@@ -45,107 +25,40 @@ type OverlayUpdate = {
|
|
|
45
25
|
enterAnimation?: OverlayAnimation;
|
|
46
26
|
exitAnimation?: OverlayAnimation;
|
|
47
27
|
preset?: OverlayPreset;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
28
|
+
duration?: number;
|
|
29
|
+
enterEasing?: string;
|
|
30
|
+
exitEasing?: string;
|
|
31
|
+
closeOnEscape?: boolean;
|
|
32
|
+
closeOnBackdrop?: boolean;
|
|
33
|
+
closeOnOutsidePointer?: boolean;
|
|
53
34
|
children?: HTMLElement | DocumentFragment | (() => HTMLElement | DocumentFragment) | null;
|
|
54
35
|
};
|
|
55
36
|
type OverlayOptions = {
|
|
56
|
-
/** The panel element — gets transform/opacity inline writes. */
|
|
57
37
|
element: HTMLElement;
|
|
58
|
-
/** Optional dimmed backdrop element. */
|
|
59
38
|
backdrop?: HTMLElement;
|
|
60
|
-
/** Edge the panel slides in from. Default: "bottom". */
|
|
61
39
|
edge?: OverlayEdge;
|
|
62
|
-
/** Open immediately on construction. Default: false. */
|
|
63
40
|
initialOpen?: boolean;
|
|
64
|
-
/** Listen for Escape key. Default: true. */
|
|
65
41
|
closeOnEscape?: boolean;
|
|
66
|
-
/** Tap on backdrop closes. Default: true. */
|
|
67
42
|
closeOnBackdrop?: boolean;
|
|
68
|
-
/** Trap Tab focus inside the panel. Default: true. */
|
|
69
43
|
focusTrap?: boolean;
|
|
70
|
-
/** Selector or HTMLElement focused on open. */
|
|
71
44
|
initialFocus?: string | HTMLElement;
|
|
72
|
-
/**
|
|
73
|
-
* Element to focus after close. By default the focus trap restores
|
|
74
|
-
* whatever was focused before open. Pass an element or a getter for
|
|
75
|
-
* explicit control (e.g. focus a status banner instead of the trigger).
|
|
76
|
-
*/
|
|
77
45
|
returnFocus?: HTMLElement | (() => HTMLElement | null);
|
|
78
|
-
/** Lock body scroll while open. Default: true. */
|
|
79
46
|
lockBodyScroll?: boolean;
|
|
80
|
-
/** Mark page siblings `inert` while open (full a11y modal). Default: false. */
|
|
81
47
|
inertSiblings?: boolean;
|
|
82
|
-
/** Push history state so Android back closes the overlay. Default: false. */
|
|
83
48
|
closeOnBack?: boolean;
|
|
84
|
-
/** Animation duration in ms. Default: 320. */
|
|
85
49
|
duration?: number;
|
|
86
|
-
/** CSS easing for the slide-in. Default matches monitoring's bezier. */
|
|
87
50
|
enterEasing?: string;
|
|
88
|
-
/** CSS easing for the slide-out. Default: ease-in. */
|
|
89
51
|
exitEasing?: string;
|
|
90
|
-
/**
|
|
91
|
-
* Peak backdrop opacity when open. Useful when `backdropFilter` blur
|
|
92
|
-
* already darkens enough and the dim should be light (e.g. 0.3).
|
|
93
|
-
* Default: 1.
|
|
94
|
-
*/
|
|
95
52
|
backdropOpacity?: number;
|
|
96
|
-
/**
|
|
97
|
-
* CSS `backdrop-filter` value applied to the backdrop while open
|
|
98
|
-
* (e.g. `"blur(8px)"`, `"blur(12px) saturate(140%)"`). Cleared on close.
|
|
99
|
-
*/
|
|
100
53
|
backdropFilter?: string;
|
|
101
|
-
/**
|
|
102
|
-
* Allow drag-to-dismiss along the entry edge — pointer-driven. The panel
|
|
103
|
-
* follows the finger past the closed-edge axis and dismisses if the user
|
|
104
|
-
* crosses 30% of the panel size or releases with > 0.5 px/ms velocity.
|
|
105
|
-
*
|
|
106
|
-
* Pass a config object to tune thresholds:
|
|
107
|
-
* `{ enabled: true, threshold: 0.5, velocityThreshold: 1.0 }`.
|
|
108
|
-
* Default: false (CSS-only transition).
|
|
109
|
-
*/
|
|
110
54
|
swipeToClose?: boolean | SwipeToCloseConfig;
|
|
111
|
-
/**
|
|
112
|
-
* Entry animation. `"slide"` (default) translates from the edge.
|
|
113
|
-
* `"fade"` is opacity-only (no transform). `"scale"` fades + scales
|
|
114
|
-
* from 0.94 — best for centred dialogs.
|
|
115
|
-
*/
|
|
116
55
|
enterAnimation?: OverlayAnimation;
|
|
117
|
-
/** Exit animation. Defaults to `enterAnimation`. */
|
|
118
56
|
exitAnimation?: OverlayAnimation;
|
|
119
|
-
/**
|
|
120
|
-
* Move `element` to a different container on first open. `'parent'`
|
|
121
|
-
* (default) leaves it in place. `'body'` appends to `document.body`.
|
|
122
|
-
* Pass an explicit `HTMLElement` for any other portal target.
|
|
123
|
-
*
|
|
124
|
-
* Restored to its original parent on `destroy()`. Move is deferred to
|
|
125
|
-
* first `open()` so SSR / pre-mount construction doesn't crash.
|
|
126
|
-
*/
|
|
127
57
|
mountTo?: OverlayMountTarget;
|
|
128
|
-
/**
|
|
129
|
-
* `peek` keeps part of the panel visible when closed instead of
|
|
130
|
-
* translating fully off-screen. Number is treated as pixels; strings
|
|
131
|
-
* accept any CSS length (`"10dvh"`, `"clamp(40px, 8vh, 80px)"`).
|
|
132
|
-
* Only honoured when `edge: 'bottom'` — warns and falls back otherwise.
|
|
133
|
-
*/
|
|
134
58
|
peek?: number | string;
|
|
135
|
-
/**
|
|
136
|
-
* Close when a pointerdown lands outside `element` AND outside `backdrop`.
|
|
137
|
-
* Distinct from `closeOnBackdrop` — this fires even when no backdrop is
|
|
138
|
-
* mounted. Single document-level listener, removed on close.
|
|
139
|
-
*/
|
|
140
59
|
closeOnOutsidePointer?: boolean;
|
|
141
|
-
/**
|
|
142
|
-
* Named archetype — bundles `enterAnimation`/`exitAnimation`/
|
|
143
|
-
* `backdropOpacity`/`backdropFilter`/`swipeToClose` defaults. Applied
|
|
144
|
-
* BEFORE the individual options on this object, so any explicit field
|
|
145
|
-
* still wins over the preset's default.
|
|
146
|
-
*/
|
|
147
60
|
preset?: OverlayPreset;
|
|
148
|
-
|
|
61
|
+
respectReducedMotion?: boolean;
|
|
149
62
|
onOpen?: () => void;
|
|
150
63
|
onClose?: () => void;
|
|
151
64
|
};
|
|
@@ -193,6 +106,10 @@ declare class OverlayEngine {
|
|
|
193
106
|
private closeOnOutsidePointerEnabled;
|
|
194
107
|
private detachOutsidePointer;
|
|
195
108
|
private detachSwipe;
|
|
109
|
+
private respectReducedMotionEnabled;
|
|
110
|
+
private isTop;
|
|
111
|
+
private backPushed;
|
|
112
|
+
private movedToTarget;
|
|
196
113
|
private onOpenCb?;
|
|
197
114
|
private onCloseCb?;
|
|
198
115
|
private isOpen_;
|
|
@@ -213,52 +130,19 @@ declare class OverlayEngine {
|
|
|
213
130
|
close(reason?: OverlayCloseReason): Promise<void>;
|
|
214
131
|
toggle(): Promise<void>;
|
|
215
132
|
destroy(): void;
|
|
216
|
-
/**
|
|
217
|
-
* Runtime visual setter — opacity is applied immediately when open so a
|
|
218
|
-
* live-controls panel can preview the change without re-opening. When
|
|
219
|
-
* closed we only stash the field; next open() picks it up so we don't
|
|
220
|
-
* mutate hidden DOM (avoids paint thrash on detached panels).
|
|
221
|
-
*/
|
|
222
133
|
setBackdropOpacity(opacity: number): void;
|
|
223
|
-
/**
|
|
224
|
-
* Runtime visual setter for `backdrop-filter`. `undefined` clears the
|
|
225
|
-
* filter (mirrors the close() behaviour). Defers to next open() when the
|
|
226
|
-
* overlay is currently closed.
|
|
227
|
-
*/
|
|
228
134
|
setBackdropFilter(filter: string | undefined): void;
|
|
229
|
-
/**
|
|
230
|
-
* Toggle / reconfigure swipe-to-close at runtime. Re-resolves the flat
|
|
231
|
-
* threshold fields, then installs or tears down the pointer listener so
|
|
232
|
-
* the change applies to the CURRENT open cycle. Idempotent: safe to call
|
|
233
|
-
* with the same config repeatedly.
|
|
234
|
-
*/
|
|
235
135
|
setSwipeToClose(config: boolean | SwipeToCloseConfig): void;
|
|
236
|
-
/** Animation setters only stage the field — applied on next open/close. */
|
|
237
136
|
setEnterAnimation(animation: OverlayAnimation): void;
|
|
238
137
|
setExitAnimation(animation: OverlayAnimation): void;
|
|
239
|
-
/** Updates the field used at next close() — no immediate side effect. */
|
|
240
138
|
setReturnFocus(target: HTMLElement | (() => HTMLElement | null) | undefined): void;
|
|
241
|
-
/**
|
|
242
|
-
* Batch update — preset first, then individual overrides. Applied as a
|
|
243
|
-
* single DOM-write phase when open so live-controls don't trigger
|
|
244
|
-
* cascading reflows. Safe to call when closed (defers to next open).
|
|
245
|
-
*/
|
|
246
139
|
setOverlay(opts: OverlayUpdate): void;
|
|
247
|
-
/**
|
|
248
|
-
* Runtime children injection — replace the panel's contents without
|
|
249
|
-
* unmounting the engine. `replaceChildren()` is a single atomic DOM op,
|
|
250
|
-
* so callers can swap content rapidly without intermediate flicker.
|
|
251
|
-
* Function form is resolved exactly ONCE per call (cheap lazy content).
|
|
252
|
-
*/
|
|
253
140
|
setOverlayChildren(children: HTMLElement | DocumentFragment | (() => HTMLElement | DocumentFragment)): void;
|
|
254
|
-
/**
|
|
255
|
-
* Clear injected children. No-op when nothing was injected so consumers
|
|
256
|
-
* who never used setOverlayChildren can call this defensively without
|
|
257
|
-
* paying for a DOM mutation.
|
|
258
|
-
*/
|
|
259
141
|
clearOverlayChildren(): void;
|
|
260
142
|
private assignSwipeFromConfig;
|
|
261
143
|
private emit;
|
|
144
|
+
private effectiveDuration;
|
|
145
|
+
private popBackMarker;
|
|
262
146
|
private resolvePeekPx;
|
|
263
147
|
private maybeMount;
|
|
264
148
|
private restoreMount;
|
|
@@ -266,13 +150,6 @@ declare class OverlayEngine {
|
|
|
266
150
|
private awaitTransition;
|
|
267
151
|
private installInteractiveListeners;
|
|
268
152
|
private releaseInteractiveListeners;
|
|
269
|
-
/**
|
|
270
|
-
* Light pointer-driven dismiss. Tracks finger along the edge axis, follows
|
|
271
|
-
* with translate, dismisses if past `swipeThreshold` (fraction of panel
|
|
272
|
-
* size) or release velocity exceeds `swipeVelocityThreshold` (px/ms).
|
|
273
|
-
* Pure CSS-transform during drag — no rAF or physics required since the
|
|
274
|
-
* panel only moves one direction.
|
|
275
|
-
*/
|
|
276
153
|
private installSwipeToClose;
|
|
277
154
|
private registerInStack;
|
|
278
155
|
}
|