@sprawlify/primitives 0.0.110 → 0.0.111
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/dist/{aria-hidden-BX4SWNE_.mjs → aria-hidden-C72KtklN.mjs} +1 -1
- package/dist/{aria-hidden-BAGrxNHt.cjs → aria-hidden-CIBHXlCy.cjs} +1 -1
- package/dist/aria-hidden.cjs +2 -2
- package/dist/aria-hidden.mjs +2 -2
- package/dist/{auto-resize-B1BDDnp1.cjs → auto-resize-BTTNXiml.cjs} +1 -1
- package/dist/{auto-resize-CN2vAzdj.mjs → auto-resize-CbNgN0OO.mjs} +1 -1
- package/dist/auto-resize.cjs +2 -2
- package/dist/auto-resize.mjs +2 -2
- package/dist/collection.d.cts +2 -2
- package/dist/collection.d.mts +2 -2
- package/dist/{core-BmIEKqtP.mjs → core-Ci9Yu6QI.mjs} +1 -1
- package/dist/{core-nBg9RC_y.cjs → core-DwdPztGA.cjs} +1 -1
- package/dist/core.cjs +2 -2
- package/dist/core.mjs +2 -2
- package/dist/{dismissable-DWfZGIA7.mjs → dismissable-B9k5K6f9.mjs} +2 -2
- package/dist/{dismissable-ChwcJMHk.cjs → dismissable-DxjbwsOf.cjs} +2 -2
- package/dist/dismissable.cjs +3 -3
- package/dist/dismissable.mjs +3 -3
- package/dist/{dom-query-s2ESLR2U.mjs → dom-query-BFuRs3l4.mjs} +1 -1
- package/dist/{dom-query-Bd63cRVF.cjs → dom-query-BUO7rGsg.cjs} +1 -1
- package/dist/dom-query.cjs +1 -1
- package/dist/dom-query.mjs +1 -1
- package/dist/{focus-trap-fucc6OU_.cjs → focus-trap-BewqTQFt.cjs} +1 -1
- package/dist/{focus-trap-DzBvBlTH.mjs → focus-trap-Do8IUXYh.mjs} +1 -1
- package/dist/focus-trap.cjs +2 -2
- package/dist/focus-trap.mjs +2 -2
- package/dist/{focus-visible-D5qBaAOn.mjs → focus-visible-GXKbbuiq.mjs} +1 -1
- package/dist/{focus-visible-75XTctXf.cjs → focus-visible-JdJXqMic.cjs} +1 -1
- package/dist/focus-visible.cjs +2 -2
- package/dist/focus-visible.mjs +2 -2
- package/dist/{i18n-utils-DB-lUfrr.cjs → i18n-utils-BRLqoCq8.cjs} +1 -1
- package/dist/{i18n-utils-oWZyUib_.mjs → i18n-utils-DZs1CPj8.mjs} +1 -1
- package/dist/i18n-utils.cjs +2 -2
- package/dist/i18n-utils.mjs +2 -2
- package/dist/{interact-outside-2qkUnl4N.mjs → interact-outside-Ba50N1a5.mjs} +1 -1
- package/dist/{interact-outside-Cx4J0EBf.cjs → interact-outside-Bg-QSXqp.cjs} +1 -1
- package/dist/interact-outside.cjs +2 -2
- package/dist/interact-outside.mjs +2 -2
- package/dist/{list-collection-B_8BN0XB.d.cts → list-collection-Cjgbx_9l.d.cts} +1 -1
- package/dist/{list-collection-DkRA5LOq.d.mts → list-collection-IF510iNl.d.mts} +1 -1
- package/dist/machines/accordion/index.cjs +2 -2
- package/dist/machines/accordion/index.d.cts +1 -1
- package/dist/machines/accordion/index.d.mts +1 -1
- package/dist/machines/accordion/index.mjs +2 -2
- package/dist/machines/angle-slider/index.cjs +2 -2
- package/dist/machines/angle-slider/index.d.cts +1 -1
- package/dist/machines/angle-slider/index.d.mts +1 -1
- package/dist/machines/angle-slider/index.mjs +2 -2
- package/dist/machines/aspect-ratio/index.cjs +2 -2
- package/dist/machines/aspect-ratio/index.mjs +2 -2
- package/dist/machines/async-list/index.cjs +2 -2
- package/dist/machines/async-list/index.mjs +2 -2
- package/dist/machines/avatar/index.cjs +2 -2
- package/dist/machines/avatar/index.mjs +2 -2
- package/dist/machines/carousel/index.cjs +3 -3
- package/dist/machines/carousel/index.d.cts +1 -1
- package/dist/machines/carousel/index.d.mts +1 -1
- package/dist/machines/carousel/index.mjs +3 -3
- package/dist/machines/cascade-select/index.cjs +5 -5
- package/dist/machines/cascade-select/index.d.cts +2 -2
- package/dist/machines/cascade-select/index.d.mts +2 -2
- package/dist/machines/cascade-select/index.mjs +5 -5
- package/dist/machines/checkbox/index.cjs +3 -3
- package/dist/machines/checkbox/index.mjs +3 -3
- package/dist/machines/clipboard/index.cjs +2 -2
- package/dist/machines/clipboard/index.mjs +2 -2
- package/dist/machines/collapsible/index.cjs +2 -2
- package/dist/machines/collapsible/index.d.cts +1 -1
- package/dist/machines/collapsible/index.d.mts +1 -1
- package/dist/machines/collapsible/index.mjs +2 -2
- package/dist/machines/color-picker/index.cjs +5 -5
- package/dist/machines/color-picker/index.d.cts +1 -1
- package/dist/machines/color-picker/index.d.mts +1 -1
- package/dist/machines/color-picker/index.mjs +5 -5
- package/dist/machines/combobox/index.cjs +5 -5
- package/dist/machines/combobox/index.d.cts +2 -2
- package/dist/machines/combobox/index.d.mts +2 -2
- package/dist/machines/combobox/index.mjs +5 -5
- package/dist/machines/date-picker/index.cjs +5 -5
- package/dist/machines/date-picker/index.d.cts +1 -1
- package/dist/machines/date-picker/index.d.mts +1 -1
- package/dist/machines/date-picker/index.mjs +5 -5
- package/dist/machines/dialog/index.cjs +7 -7
- package/dist/machines/dialog/index.d.cts +1 -1
- package/dist/machines/dialog/index.d.mts +1 -1
- package/dist/machines/dialog/index.mjs +7 -7
- package/dist/machines/drawer/index.cjs +1574 -307
- package/dist/machines/drawer/index.d.cts +217 -35
- package/dist/machines/drawer/index.d.mts +217 -35
- package/dist/machines/drawer/index.mjs +1574 -309
- package/dist/machines/dropdown-menu/index.cjs +5 -5
- package/dist/machines/dropdown-menu/index.d.cts +1 -1
- package/dist/machines/dropdown-menu/index.d.mts +1 -1
- package/dist/machines/dropdown-menu/index.mjs +5 -5
- package/dist/machines/editable/index.cjs +3 -3
- package/dist/machines/editable/index.mjs +3 -3
- package/dist/machines/file-upload/index.cjs +3 -3
- package/dist/machines/file-upload/index.d.cts +1 -1
- package/dist/machines/file-upload/index.d.mts +1 -1
- package/dist/machines/file-upload/index.mjs +3 -3
- package/dist/machines/floating-panel/index.cjs +2 -2
- package/dist/machines/floating-panel/index.d.cts +1 -1
- package/dist/machines/floating-panel/index.d.mts +1 -1
- package/dist/machines/floating-panel/index.mjs +2 -2
- package/dist/machines/hover-card/index.cjs +5 -5
- package/dist/machines/hover-card/index.d.cts +1 -1
- package/dist/machines/hover-card/index.d.mts +1 -1
- package/dist/machines/hover-card/index.mjs +5 -5
- package/dist/machines/image-cropper/index.cjs +2 -2
- package/dist/machines/image-cropper/index.mjs +2 -2
- package/dist/machines/listbox/index.cjs +3 -3
- package/dist/machines/listbox/index.d.cts +3 -3
- package/dist/machines/listbox/index.d.mts +3 -3
- package/dist/machines/listbox/index.mjs +3 -3
- package/dist/machines/marquee/index.cjs +2 -2
- package/dist/machines/marquee/index.d.cts +3 -3
- package/dist/machines/marquee/index.d.mts +3 -3
- package/dist/machines/marquee/index.mjs +2 -2
- package/dist/machines/navigation-menu/index.cjs +4 -4
- package/dist/machines/navigation-menu/index.d.cts +1 -1
- package/dist/machines/navigation-menu/index.d.mts +1 -1
- package/dist/machines/navigation-menu/index.mjs +4 -4
- package/dist/machines/number-input/index.cjs +2 -2
- package/dist/machines/number-input/index.d.cts +1 -1
- package/dist/machines/number-input/index.d.mts +1 -1
- package/dist/machines/number-input/index.mjs +2 -2
- package/dist/machines/pagination/index.cjs +2 -2
- package/dist/machines/pagination/index.mjs +2 -2
- package/dist/machines/password-input/index.cjs +2 -2
- package/dist/machines/password-input/index.mjs +2 -2
- package/dist/machines/pin-input/index.cjs +2 -2
- package/dist/machines/pin-input/index.mjs +2 -2
- package/dist/machines/popover/index.cjs +8 -8
- package/dist/machines/popover/index.d.cts +1 -1
- package/dist/machines/popover/index.d.mts +1 -1
- package/dist/machines/popover/index.mjs +8 -8
- package/dist/machines/presence/index.cjs +2 -2
- package/dist/machines/presence/index.mjs +2 -2
- package/dist/machines/progress/index.cjs +2 -2
- package/dist/machines/progress/index.d.cts +1 -1
- package/dist/machines/progress/index.d.mts +1 -1
- package/dist/machines/progress/index.mjs +2 -2
- package/dist/machines/qr-code/index.cjs +2 -2
- package/dist/machines/qr-code/index.mjs +2 -2
- package/dist/machines/radio-group/index.cjs +3 -3
- package/dist/machines/radio-group/index.mjs +3 -3
- package/dist/machines/rating-group/index.cjs +2 -2
- package/dist/machines/rating-group/index.mjs +2 -2
- package/dist/machines/scroll-area/index.cjs +2 -2
- package/dist/machines/scroll-area/index.d.cts +1 -1
- package/dist/machines/scroll-area/index.d.mts +1 -1
- package/dist/machines/scroll-area/index.mjs +2 -2
- package/dist/machines/select/index.cjs +6 -6
- package/dist/machines/select/index.d.cts +2 -2
- package/dist/machines/select/index.d.mts +2 -2
- package/dist/machines/select/index.mjs +6 -6
- package/dist/machines/separator/index.cjs +2 -2
- package/dist/machines/separator/index.mjs +2 -2
- package/dist/machines/signature-pad/index.cjs +2 -2
- package/dist/machines/signature-pad/index.d.cts +1 -1
- package/dist/machines/signature-pad/index.d.mts +1 -1
- package/dist/machines/signature-pad/index.mjs +2 -2
- package/dist/machines/slider/index.cjs +2 -2
- package/dist/machines/slider/index.d.cts +1 -1
- package/dist/machines/slider/index.d.mts +1 -1
- package/dist/machines/slider/index.mjs +2 -2
- package/dist/machines/splitter/index.cjs +2 -2
- package/dist/machines/splitter/index.mjs +2 -2
- package/dist/machines/steps/index.cjs +2 -2
- package/dist/machines/steps/index.d.cts +1 -1
- package/dist/machines/steps/index.d.mts +1 -1
- package/dist/machines/steps/index.mjs +2 -2
- package/dist/machines/switch/index.cjs +3 -3
- package/dist/machines/switch/index.mjs +3 -3
- package/dist/machines/tabs/index.cjs +2 -2
- package/dist/machines/tabs/index.d.cts +1 -1
- package/dist/machines/tabs/index.d.mts +1 -1
- package/dist/machines/tabs/index.mjs +2 -2
- package/dist/machines/tags-input/index.cjs +4 -4
- package/dist/machines/tags-input/index.d.cts +1 -1
- package/dist/machines/tags-input/index.d.mts +1 -1
- package/dist/machines/tags-input/index.mjs +4 -4
- package/dist/machines/timer/index.cjs +2 -2
- package/dist/machines/timer/index.d.cts +1 -1
- package/dist/machines/timer/index.d.mts +1 -1
- package/dist/machines/timer/index.mjs +2 -2
- package/dist/machines/toast/index.cjs +4 -4
- package/dist/machines/toast/index.d.cts +1 -1
- package/dist/machines/toast/index.d.mts +1 -1
- package/dist/machines/toast/index.mjs +4 -4
- package/dist/machines/toggle/index.cjs +2 -2
- package/dist/machines/toggle/index.mjs +2 -2
- package/dist/machines/toggle-group/index.cjs +2 -2
- package/dist/machines/toggle-group/index.mjs +2 -2
- package/dist/machines/tooltip/index.cjs +4 -4
- package/dist/machines/tooltip/index.d.cts +1 -1
- package/dist/machines/tooltip/index.d.mts +1 -1
- package/dist/machines/tooltip/index.mjs +4 -4
- package/dist/machines/tour/index.cjs +6 -6
- package/dist/machines/tour/index.d.cts +1 -1
- package/dist/machines/tour/index.d.mts +1 -1
- package/dist/machines/tour/index.mjs +6 -6
- package/dist/machines/tree-view/index.cjs +2 -2
- package/dist/machines/tree-view/index.d.cts +1 -1
- package/dist/machines/tree-view/index.d.mts +1 -1
- package/dist/machines/tree-view/index.mjs +2 -2
- package/dist/{popper-BDy37WA0.mjs → popper-BlgbmdAn.mjs} +1 -1
- package/dist/{popper-Cx3KHzeT.cjs → popper-viCrafLC.cjs} +1 -1
- package/dist/popper.cjs +2 -2
- package/dist/popper.mjs +2 -2
- package/dist/{remove-scroll-D9FAOapi.cjs → remove-scroll-D4CMJmU2.cjs} +1 -1
- package/dist/{remove-scroll-HcSiTbd5.mjs → remove-scroll-D55GZoBb.mjs} +1 -1
- package/dist/{scroll-snap-DfSwN3As.mjs → scroll-snap-CdneVP31.mjs} +1 -1
- package/dist/{scroll-snap-Dp_2adEa.cjs → scroll-snap-vZ2q6dcN.cjs} +1 -1
- package/dist/scroll-snap.cjs +2 -2
- package/dist/scroll-snap.mjs +2 -2
- package/dist/{selection-DdNvrKbj.d.mts → selection-6urf-c8j.d.mts} +1 -1
- package/dist/{selection-Bb_ZSVxe.d.cts → selection-BmS2RDMq.d.cts} +1 -1
- package/package.json +1 -1
|
@@ -1,51 +1,209 @@
|
|
|
1
1
|
import { n as AnatomyInstance } from "../../create-anatomy-9eFQs7lO.cjs";
|
|
2
2
|
import { p as Machine, u as EventObject, y as Service } from "../../types-B24gMTKq.cjs";
|
|
3
|
-
import { b as NormalizeProps, g as RequiredBy, p as Point, r as DirectionProperty, s as MaybeElement, t as CommonProperties, x as PropTypes } from "../../index-CLRsezW5.cjs";
|
|
3
|
+
import { C as JSX, b as NormalizeProps, g as RequiredBy, p as Point, r as DirectionProperty, s as MaybeElement, t as CommonProperties, x as PropTypes } from "../../index-CLRsezW5.cjs";
|
|
4
4
|
import { c as PointerDownOutsideEvent, n as FocusOutsideEvent, r as InteractOutsideEvent } from "../../index-DzWGFhcS.cjs";
|
|
5
5
|
import { t as DismissableElementHandlers } from "../../dismissable-layer-ZgyqN8AD.cjs";
|
|
6
6
|
|
|
7
7
|
//#region src/machines/drawer/drawer.anatomy.d.ts
|
|
8
|
-
declare const anatomy: AnatomyInstance<"
|
|
8
|
+
declare const anatomy: AnatomyInstance<"trigger" | "title" | "content" | "description" | "positioner" | "backdrop" | "closeTrigger" | "grabber" | "grabberIndicator" | "swipeArea">;
|
|
9
9
|
//#endregion
|
|
10
|
-
//#region src/machines/drawer/utils/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
//#region src/machines/drawer/utils/session.d.ts
|
|
11
|
+
type GestureAxis = "x" | "y";
|
|
12
|
+
type PhysicalSwipeDirection = "up" | "down" | "left" | "right";
|
|
13
|
+
type SwipePointerType = "mouse" | "pen" | "touch";
|
|
14
|
+
interface SwipeMoveDetails {
|
|
15
|
+
point: Point;
|
|
16
|
+
target: Element | null;
|
|
17
|
+
event: PointerEvent | TouchEvent;
|
|
18
|
+
pointerType: SwipePointerType;
|
|
19
|
+
axis: GestureAxis;
|
|
20
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
21
|
+
}
|
|
22
|
+
interface SwipeEndDetails {
|
|
23
|
+
point: Point;
|
|
24
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
25
|
+
}
|
|
26
|
+
interface SwipeStartDetails {
|
|
27
|
+
point: Point;
|
|
28
|
+
target: Element | null;
|
|
29
|
+
event: PointerEvent | TouchEvent;
|
|
30
|
+
pointerType: SwipePointerType;
|
|
31
|
+
axis: GestureAxis;
|
|
32
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
33
|
+
}
|
|
34
|
+
interface SwipeInterruptDetails {
|
|
35
|
+
reason: "visibility-hidden" | "lost-pointer-capture";
|
|
36
|
+
event: Event | Document;
|
|
37
|
+
target: Element | null;
|
|
38
|
+
pointerType: SwipePointerType | null;
|
|
39
|
+
}
|
|
40
|
+
interface SwipeTrackingOptions {
|
|
41
|
+
getDoc: () => Document;
|
|
42
|
+
getSelectionTarget?: () => HTMLElement | null;
|
|
43
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
44
|
+
onStart?: (details: SwipeStartDetails) => void;
|
|
45
|
+
onMove: (details: SwipeMoveDetails) => void;
|
|
46
|
+
onEnd: (details: SwipeEndDetails) => void;
|
|
47
|
+
onCancel: () => void;
|
|
48
|
+
preventDefault?: (details: SwipeMoveDetails) => boolean;
|
|
49
|
+
cancelOnInterrupt?: (details: SwipeInterruptDetails) => boolean;
|
|
50
|
+
}
|
|
51
|
+
interface PendingSwipeOptions {
|
|
52
|
+
getWin: () => Window;
|
|
53
|
+
pointerId: number;
|
|
54
|
+
startPoint: Point;
|
|
55
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
56
|
+
onCommit: (point: Point) => void;
|
|
57
|
+
canCommit?: () => boolean;
|
|
58
|
+
onCancel?: () => void;
|
|
59
|
+
}
|
|
60
|
+
declare class SwipeSession {
|
|
61
|
+
private startPoint;
|
|
16
62
|
private velocity;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
63
|
+
private samples;
|
|
64
|
+
private sampleStartIndex;
|
|
65
|
+
private gestureStartAxis;
|
|
66
|
+
private gestureStartTime;
|
|
67
|
+
private gestureSign;
|
|
68
|
+
private pendingSwipe;
|
|
69
|
+
setStartPoint(point: Point): void;
|
|
70
|
+
clearStartPoint(): void;
|
|
71
|
+
getStartPoint(): Point | null;
|
|
72
|
+
getGestureAxis(direction: PhysicalSwipeDirection): GestureAxis;
|
|
73
|
+
getGestureSign(direction: PhysicalSwipeDirection): number;
|
|
74
|
+
private getAxisValue;
|
|
75
|
+
getMainAxisDisplacement(point: Point, axis: GestureAxis, sign: number): number;
|
|
76
|
+
getCrossAxisDisplacement(point: Point, axis: GestureAxis): number;
|
|
77
|
+
track(point: Point, axis: GestureAxis, sign: number): void;
|
|
78
|
+
getReleaseVelocity(): number;
|
|
24
79
|
clearVelocityTracking(): void;
|
|
25
80
|
clear(): void;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
81
|
+
startDeferredSwipe(options: PendingSwipeOptions): void;
|
|
82
|
+
cancelDeferredSwipe(): void;
|
|
83
|
+
bind(options: SwipeTrackingOptions): () => void;
|
|
84
|
+
}
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/machines/drawer/utils/drawer-session.d.ts
|
|
87
|
+
interface ContentPointerDownOptions {
|
|
88
|
+
event: JSX.PointerEvent<HTMLElement>;
|
|
89
|
+
getDoc: () => Document;
|
|
90
|
+
getContentEl: () => HTMLElement | null;
|
|
91
|
+
getWin: () => Window;
|
|
92
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
93
|
+
canCommit: () => boolean;
|
|
94
|
+
onCommit: (point: Point) => void;
|
|
95
|
+
}
|
|
96
|
+
interface GrabberPointerDownOptions {
|
|
97
|
+
event: JSX.PointerEvent<HTMLElement>;
|
|
98
|
+
point: Point;
|
|
99
|
+
canCommit: () => boolean;
|
|
100
|
+
onCommit: (point: Point) => void;
|
|
101
|
+
}
|
|
102
|
+
declare class DrawerSwipeSession {
|
|
103
|
+
readonly session: SwipeSession;
|
|
104
|
+
private dragOffset;
|
|
105
|
+
private readonly preventDragOnScroll;
|
|
106
|
+
constructor(options: DrawerSwipeSessionOptions);
|
|
107
|
+
contentPointerDown(options: ContentPointerDownOptions): void;
|
|
108
|
+
grabberPointerDown(options: GrabberPointerDownOptions): void;
|
|
109
|
+
private adjustReleaseVelocityAgainstDisplacement;
|
|
110
|
+
private adjustReleaseVelocityForOpenSwipe;
|
|
111
|
+
beginSwipe(point: Point): void;
|
|
112
|
+
clearSwipeStart(): void;
|
|
113
|
+
getSwipeStart(): Point | null;
|
|
114
|
+
getDragOffset(): number | null;
|
|
115
|
+
resetDragOffset(): void;
|
|
116
|
+
resetVelocity(): void;
|
|
117
|
+
reset(): void;
|
|
118
|
+
setDragOffset(point: Point, resolvedActiveSnapPointOffset: number, direction: PhysicalSwipeDirection): void;
|
|
119
|
+
setSwipeOpenOffset(point: Point, contentSize: number, direction: PhysicalSwipeDirection): void;
|
|
120
|
+
canStartDrag(point: Point, target: EventTarget | null, container: HTMLElement | null, preventDragOnScroll: boolean, direction: PhysicalSwipeDirection): boolean;
|
|
121
|
+
resolveSnapPointOnRelease(snapPoints: ResolvedSnapPoint[], snapPoint: ResolvedSnapPoint | null, snapToSequentialPoints: boolean, contentSize: number): number | string | null;
|
|
122
|
+
shouldOpenOnRelease(contentSize: number | null, swipeVelocityThreshold: number, openThreshold: number): boolean;
|
|
123
|
+
shouldDismissOnRelease(contentSize: number | null, snapPoints: ResolvedSnapPoint[], resolvedSnapOffset: number): boolean;
|
|
124
|
+
getSwipeStrength(targetOffset: number, resolvedSnapOffset?: number | null): number;
|
|
125
|
+
bindDragTracking(options: DragTrackingOptions): () => void;
|
|
126
|
+
bindSwipeOpenTracking(options: SwipeOpenTrackingOptions): () => void;
|
|
127
|
+
}
|
|
128
|
+
interface DrawerSwipeSessionOptions {
|
|
129
|
+
preventDragOnScroll: () => boolean;
|
|
130
|
+
}
|
|
131
|
+
interface DragTrackingOptions {
|
|
132
|
+
getDoc: () => Document;
|
|
133
|
+
getContentEl: () => HTMLElement | null;
|
|
134
|
+
getSwipeAreaEl: () => HTMLElement | null;
|
|
135
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
136
|
+
onMove: (details: {
|
|
137
|
+
point: Point;
|
|
138
|
+
target: Element | null;
|
|
139
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
140
|
+
}) => void;
|
|
141
|
+
onEnd: (details: {
|
|
142
|
+
point: Point;
|
|
143
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
144
|
+
}) => void;
|
|
145
|
+
onCancel: () => void;
|
|
146
|
+
}
|
|
147
|
+
interface SwipeOpenTrackingOptions {
|
|
148
|
+
getDoc: () => Document;
|
|
149
|
+
getContentEl: () => HTMLElement | null;
|
|
150
|
+
getSwipeAreaEl: () => HTMLElement | null;
|
|
151
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
152
|
+
onMove: (details: {
|
|
153
|
+
point: Point;
|
|
154
|
+
}) => void;
|
|
155
|
+
onEnd: (details: {
|
|
156
|
+
point: Point;
|
|
157
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
158
|
+
}) => void;
|
|
159
|
+
onCancel: () => void;
|
|
29
160
|
}
|
|
30
161
|
//#endregion
|
|
31
162
|
//#region src/machines/drawer/drawer.types.d.ts
|
|
163
|
+
type SwipeDirection = "up" | "down" | "start" | "end";
|
|
164
|
+
type SnapPoint = number | string;
|
|
32
165
|
interface OpenChangeDetails {
|
|
33
166
|
open: boolean;
|
|
34
167
|
}
|
|
35
168
|
interface ResolvedSnapPoint {
|
|
36
|
-
value:
|
|
169
|
+
value: SnapPoint;
|
|
170
|
+
height: number;
|
|
37
171
|
offset: number;
|
|
38
172
|
}
|
|
39
173
|
interface SnapPointChangeDetails {
|
|
40
|
-
snapPoint:
|
|
174
|
+
snapPoint: SnapPoint | null;
|
|
175
|
+
}
|
|
176
|
+
interface DrawerStackSnapshot {
|
|
177
|
+
active: boolean;
|
|
178
|
+
openCount: number;
|
|
179
|
+
swipeProgress: number;
|
|
180
|
+
frontmostHeight: number;
|
|
181
|
+
}
|
|
182
|
+
interface DrawerStack {
|
|
183
|
+
getSnapshot(): DrawerStackSnapshot;
|
|
184
|
+
subscribe(listener: () => void): () => void;
|
|
185
|
+
register(id: string): void;
|
|
186
|
+
unregister(id: string): void;
|
|
187
|
+
setOpen(id: string, open: boolean): void;
|
|
188
|
+
setHeight(id: string, height: number): void;
|
|
189
|
+
setSwipe(id: string, swiping: boolean, progress: number): void;
|
|
190
|
+
}
|
|
191
|
+
interface DrawerStackApi<T extends PropTypes = PropTypes> {
|
|
192
|
+
getIndentProps(): T["element"];
|
|
193
|
+
getIndentBackgroundProps(): T["element"];
|
|
41
194
|
}
|
|
42
195
|
type ElementIds = Partial<{
|
|
43
196
|
backdrop: string;
|
|
197
|
+
positioner: string;
|
|
44
198
|
content: string;
|
|
199
|
+
title: string;
|
|
200
|
+
description: string;
|
|
201
|
+
header: string;
|
|
45
202
|
trigger: string;
|
|
46
203
|
grabber: string;
|
|
47
204
|
grabberIndicator: string;
|
|
48
205
|
closeTrigger: string;
|
|
206
|
+
swipeArea: string;
|
|
49
207
|
}>;
|
|
50
208
|
interface DrawerProps extends DirectionProperty, CommonProperties, DismissableElementHandlers {
|
|
51
209
|
ids?: ElementIds;
|
|
@@ -61,29 +219,41 @@ interface DrawerProps extends DirectionProperty, CommonProperties, DismissableEl
|
|
|
61
219
|
onOpenChange?: ((details: OpenChangeDetails) => void) | undefined;
|
|
62
220
|
closeOnInteractOutside?: boolean | undefined;
|
|
63
221
|
closeOnEscape?: boolean | undefined;
|
|
64
|
-
snapPoints?:
|
|
222
|
+
snapPoints?: SnapPoint[] | undefined;
|
|
223
|
+
swipeDirection?: SwipeDirection | undefined;
|
|
224
|
+
snapToSequentialPoints?: boolean | undefined;
|
|
65
225
|
swipeVelocityThreshold?: number;
|
|
66
226
|
closeThreshold?: number;
|
|
67
227
|
preventDragOnScroll?: boolean;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
228
|
+
snapPoint?: SnapPoint | null | undefined;
|
|
229
|
+
defaultSnapPoint?: SnapPoint | null | undefined;
|
|
230
|
+
onSnapPointChange?: ((details: SnapPointChangeDetails) => void) | undefined;
|
|
231
|
+
stack?: DrawerStack | undefined;
|
|
71
232
|
}
|
|
72
|
-
type PropsWithDefault = "closeOnInteractOutside" | "closeOnEscape" | "modal" | "trapFocus" | "restoreFocus" | "preventScroll" | "initialFocusEl" | "snapPoints" | "swipeVelocityThreshold" | "closeThreshold" | "preventDragOnScroll" | "
|
|
233
|
+
type PropsWithDefault = "closeOnInteractOutside" | "closeOnEscape" | "modal" | "trapFocus" | "restoreFocus" | "preventScroll" | "initialFocusEl" | "snapPoints" | "swipeDirection" | "snapToSequentialPoints" | "swipeVelocityThreshold" | "closeThreshold" | "preventDragOnScroll" | "defaultSnapPoint";
|
|
73
234
|
interface DrawerSchema {
|
|
74
235
|
props: RequiredBy<DrawerProps, PropsWithDefault>;
|
|
75
|
-
state: "open" | "closed" | "closing";
|
|
236
|
+
state: "open" | "closed" | "closing" | "swipe-area-dragging" | "swiping-open";
|
|
76
237
|
tag: "open" | "closed";
|
|
77
238
|
context: {
|
|
78
239
|
dragOffset: number | null;
|
|
79
|
-
|
|
240
|
+
snapPoint: SnapPoint | null;
|
|
80
241
|
resolvedActiveSnapPoint: ResolvedSnapPoint | null;
|
|
81
|
-
|
|
242
|
+
contentSize: number | null;
|
|
243
|
+
viewportSize: number;
|
|
244
|
+
rootFontSize: number;
|
|
245
|
+
swipeStrength: number;
|
|
246
|
+
rendered: {
|
|
247
|
+
title: boolean;
|
|
248
|
+
description: boolean;
|
|
249
|
+
};
|
|
82
250
|
};
|
|
83
251
|
refs: {
|
|
84
|
-
|
|
252
|
+
swipeSession: DrawerSwipeSession;
|
|
85
253
|
};
|
|
86
254
|
computed: {
|
|
255
|
+
drawerId: string;
|
|
256
|
+
physicalSwipeDirection: PhysicalSwipeDirection;
|
|
87
257
|
resolvedSnapPoints: ResolvedSnapPoint[];
|
|
88
258
|
};
|
|
89
259
|
event: EventObject;
|
|
@@ -96,23 +266,31 @@ type DrawerMachine = Machine<DrawerSchema>;
|
|
|
96
266
|
interface ContentProps {
|
|
97
267
|
draggable?: boolean | undefined;
|
|
98
268
|
}
|
|
269
|
+
interface SwipeAreaProps {
|
|
270
|
+
disabled?: boolean | undefined;
|
|
271
|
+
swipeDirection?: SwipeDirection | undefined;
|
|
272
|
+
}
|
|
99
273
|
interface DrawerApi<T extends PropTypes = PropTypes> {
|
|
100
274
|
open: boolean;
|
|
101
275
|
dragging: boolean;
|
|
102
276
|
setOpen: (open: boolean) => void;
|
|
103
|
-
snapPoints:
|
|
104
|
-
|
|
105
|
-
|
|
277
|
+
snapPoints: SnapPoint[];
|
|
278
|
+
swipeDirection: SwipeDirection;
|
|
279
|
+
snapPoint: SnapPoint | null;
|
|
280
|
+
setSnapPoint: (snapPoint: SnapPoint | null) => void;
|
|
106
281
|
getOpenPercentage: () => number;
|
|
107
|
-
|
|
108
|
-
|
|
282
|
+
getSnapPointIndex: () => number;
|
|
283
|
+
getContentSize: () => number | null;
|
|
284
|
+
getPositionerProps: () => T["element"];
|
|
109
285
|
getContentProps: (props?: ContentProps) => T["element"];
|
|
110
286
|
getTitleProps: () => T["element"];
|
|
287
|
+
getDescriptionProps: () => T["element"];
|
|
111
288
|
getTriggerProps: () => T["element"];
|
|
112
289
|
getBackdropProps: () => T["element"];
|
|
113
290
|
getGrabberProps: () => T["element"];
|
|
114
291
|
getGrabberIndicatorProps: () => T["element"];
|
|
115
292
|
getCloseTriggerProps: () => T["element"];
|
|
293
|
+
getSwipeAreaProps: (props?: SwipeAreaProps) => T["element"];
|
|
116
294
|
}
|
|
117
295
|
//#endregion
|
|
118
296
|
//#region src/machines/drawer/drawer.connect.d.ts
|
|
@@ -125,4 +303,8 @@ declare const machine: Machine<DrawerSchema>;
|
|
|
125
303
|
declare const props: (keyof DrawerProps)[];
|
|
126
304
|
declare const splitProps: <Props extends Partial<DrawerProps>>(props: Props) => [Partial<DrawerProps>, Omit<Props, keyof DrawerProps>];
|
|
127
305
|
//#endregion
|
|
128
|
-
|
|
306
|
+
//#region src/machines/drawer/drawer.stack.d.ts
|
|
307
|
+
declare function createStack(): DrawerStack;
|
|
308
|
+
declare function connectStack<T extends PropTypes>(snapshot: DrawerStackSnapshot, normalize: NormalizeProps<T>): DrawerStackApi<T>;
|
|
309
|
+
//#endregion
|
|
310
|
+
export { type DrawerApi as Api, type ContentProps, type DrawerStack, type DrawerStackApi, type DrawerStackSnapshot, type ElementIds, type FocusOutsideEvent, type InteractOutsideEvent, type DrawerMachine as Machine, type OpenChangeDetails, type PointerDownOutsideEvent, type DrawerProps as Props, type ResolvedSnapPoint, type DrawerService as Service, type SnapPoint, type SnapPointChangeDetails, type SwipeDirection, anatomy, connect, connectStack, createStack, machine, props, splitProps };
|
|
@@ -1,51 +1,209 @@
|
|
|
1
1
|
import { n as AnatomyInstance } from "../../create-anatomy-BedZVdg0.mjs";
|
|
2
2
|
import { p as Machine, u as EventObject, y as Service } from "../../types-DUM9rzfD.mjs";
|
|
3
|
-
import { b as NormalizeProps, g as RequiredBy, p as Point, r as DirectionProperty, s as MaybeElement, t as CommonProperties, x as PropTypes } from "../../index-BVFlU3b9.mjs";
|
|
3
|
+
import { C as JSX, b as NormalizeProps, g as RequiredBy, p as Point, r as DirectionProperty, s as MaybeElement, t as CommonProperties, x as PropTypes } from "../../index-BVFlU3b9.mjs";
|
|
4
4
|
import { c as PointerDownOutsideEvent, n as FocusOutsideEvent, r as InteractOutsideEvent } from "../../index-CGNNiDyE.mjs";
|
|
5
5
|
import { t as DismissableElementHandlers } from "../../dismissable-layer-h14gHVbJ.mjs";
|
|
6
6
|
|
|
7
7
|
//#region src/machines/drawer/drawer.anatomy.d.ts
|
|
8
|
-
declare const anatomy: AnatomyInstance<"
|
|
8
|
+
declare const anatomy: AnatomyInstance<"trigger" | "title" | "content" | "description" | "positioner" | "backdrop" | "closeTrigger" | "grabber" | "grabberIndicator" | "swipeArea">;
|
|
9
9
|
//#endregion
|
|
10
|
-
//#region src/machines/drawer/utils/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
//#region src/machines/drawer/utils/session.d.ts
|
|
11
|
+
type GestureAxis = "x" | "y";
|
|
12
|
+
type PhysicalSwipeDirection = "up" | "down" | "left" | "right";
|
|
13
|
+
type SwipePointerType = "mouse" | "pen" | "touch";
|
|
14
|
+
interface SwipeMoveDetails {
|
|
15
|
+
point: Point;
|
|
16
|
+
target: Element | null;
|
|
17
|
+
event: PointerEvent | TouchEvent;
|
|
18
|
+
pointerType: SwipePointerType;
|
|
19
|
+
axis: GestureAxis;
|
|
20
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
21
|
+
}
|
|
22
|
+
interface SwipeEndDetails {
|
|
23
|
+
point: Point;
|
|
24
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
25
|
+
}
|
|
26
|
+
interface SwipeStartDetails {
|
|
27
|
+
point: Point;
|
|
28
|
+
target: Element | null;
|
|
29
|
+
event: PointerEvent | TouchEvent;
|
|
30
|
+
pointerType: SwipePointerType;
|
|
31
|
+
axis: GestureAxis;
|
|
32
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
33
|
+
}
|
|
34
|
+
interface SwipeInterruptDetails {
|
|
35
|
+
reason: "visibility-hidden" | "lost-pointer-capture";
|
|
36
|
+
event: Event | Document;
|
|
37
|
+
target: Element | null;
|
|
38
|
+
pointerType: SwipePointerType | null;
|
|
39
|
+
}
|
|
40
|
+
interface SwipeTrackingOptions {
|
|
41
|
+
getDoc: () => Document;
|
|
42
|
+
getSelectionTarget?: () => HTMLElement | null;
|
|
43
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
44
|
+
onStart?: (details: SwipeStartDetails) => void;
|
|
45
|
+
onMove: (details: SwipeMoveDetails) => void;
|
|
46
|
+
onEnd: (details: SwipeEndDetails) => void;
|
|
47
|
+
onCancel: () => void;
|
|
48
|
+
preventDefault?: (details: SwipeMoveDetails) => boolean;
|
|
49
|
+
cancelOnInterrupt?: (details: SwipeInterruptDetails) => boolean;
|
|
50
|
+
}
|
|
51
|
+
interface PendingSwipeOptions {
|
|
52
|
+
getWin: () => Window;
|
|
53
|
+
pointerId: number;
|
|
54
|
+
startPoint: Point;
|
|
55
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
56
|
+
onCommit: (point: Point) => void;
|
|
57
|
+
canCommit?: () => boolean;
|
|
58
|
+
onCancel?: () => void;
|
|
59
|
+
}
|
|
60
|
+
declare class SwipeSession {
|
|
61
|
+
private startPoint;
|
|
16
62
|
private velocity;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
63
|
+
private samples;
|
|
64
|
+
private sampleStartIndex;
|
|
65
|
+
private gestureStartAxis;
|
|
66
|
+
private gestureStartTime;
|
|
67
|
+
private gestureSign;
|
|
68
|
+
private pendingSwipe;
|
|
69
|
+
setStartPoint(point: Point): void;
|
|
70
|
+
clearStartPoint(): void;
|
|
71
|
+
getStartPoint(): Point | null;
|
|
72
|
+
getGestureAxis(direction: PhysicalSwipeDirection): GestureAxis;
|
|
73
|
+
getGestureSign(direction: PhysicalSwipeDirection): number;
|
|
74
|
+
private getAxisValue;
|
|
75
|
+
getMainAxisDisplacement(point: Point, axis: GestureAxis, sign: number): number;
|
|
76
|
+
getCrossAxisDisplacement(point: Point, axis: GestureAxis): number;
|
|
77
|
+
track(point: Point, axis: GestureAxis, sign: number): void;
|
|
78
|
+
getReleaseVelocity(): number;
|
|
24
79
|
clearVelocityTracking(): void;
|
|
25
80
|
clear(): void;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
81
|
+
startDeferredSwipe(options: PendingSwipeOptions): void;
|
|
82
|
+
cancelDeferredSwipe(): void;
|
|
83
|
+
bind(options: SwipeTrackingOptions): () => void;
|
|
84
|
+
}
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/machines/drawer/utils/drawer-session.d.ts
|
|
87
|
+
interface ContentPointerDownOptions {
|
|
88
|
+
event: JSX.PointerEvent<HTMLElement>;
|
|
89
|
+
getDoc: () => Document;
|
|
90
|
+
getContentEl: () => HTMLElement | null;
|
|
91
|
+
getWin: () => Window;
|
|
92
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
93
|
+
canCommit: () => boolean;
|
|
94
|
+
onCommit: (point: Point) => void;
|
|
95
|
+
}
|
|
96
|
+
interface GrabberPointerDownOptions {
|
|
97
|
+
event: JSX.PointerEvent<HTMLElement>;
|
|
98
|
+
point: Point;
|
|
99
|
+
canCommit: () => boolean;
|
|
100
|
+
onCommit: (point: Point) => void;
|
|
101
|
+
}
|
|
102
|
+
declare class DrawerSwipeSession {
|
|
103
|
+
readonly session: SwipeSession;
|
|
104
|
+
private dragOffset;
|
|
105
|
+
private readonly preventDragOnScroll;
|
|
106
|
+
constructor(options: DrawerSwipeSessionOptions);
|
|
107
|
+
contentPointerDown(options: ContentPointerDownOptions): void;
|
|
108
|
+
grabberPointerDown(options: GrabberPointerDownOptions): void;
|
|
109
|
+
private adjustReleaseVelocityAgainstDisplacement;
|
|
110
|
+
private adjustReleaseVelocityForOpenSwipe;
|
|
111
|
+
beginSwipe(point: Point): void;
|
|
112
|
+
clearSwipeStart(): void;
|
|
113
|
+
getSwipeStart(): Point | null;
|
|
114
|
+
getDragOffset(): number | null;
|
|
115
|
+
resetDragOffset(): void;
|
|
116
|
+
resetVelocity(): void;
|
|
117
|
+
reset(): void;
|
|
118
|
+
setDragOffset(point: Point, resolvedActiveSnapPointOffset: number, direction: PhysicalSwipeDirection): void;
|
|
119
|
+
setSwipeOpenOffset(point: Point, contentSize: number, direction: PhysicalSwipeDirection): void;
|
|
120
|
+
canStartDrag(point: Point, target: EventTarget | null, container: HTMLElement | null, preventDragOnScroll: boolean, direction: PhysicalSwipeDirection): boolean;
|
|
121
|
+
resolveSnapPointOnRelease(snapPoints: ResolvedSnapPoint[], snapPoint: ResolvedSnapPoint | null, snapToSequentialPoints: boolean, contentSize: number): number | string | null;
|
|
122
|
+
shouldOpenOnRelease(contentSize: number | null, swipeVelocityThreshold: number, openThreshold: number): boolean;
|
|
123
|
+
shouldDismissOnRelease(contentSize: number | null, snapPoints: ResolvedSnapPoint[], resolvedSnapOffset: number): boolean;
|
|
124
|
+
getSwipeStrength(targetOffset: number, resolvedSnapOffset?: number | null): number;
|
|
125
|
+
bindDragTracking(options: DragTrackingOptions): () => void;
|
|
126
|
+
bindSwipeOpenTracking(options: SwipeOpenTrackingOptions): () => void;
|
|
127
|
+
}
|
|
128
|
+
interface DrawerSwipeSessionOptions {
|
|
129
|
+
preventDragOnScroll: () => boolean;
|
|
130
|
+
}
|
|
131
|
+
interface DragTrackingOptions {
|
|
132
|
+
getDoc: () => Document;
|
|
133
|
+
getContentEl: () => HTMLElement | null;
|
|
134
|
+
getSwipeAreaEl: () => HTMLElement | null;
|
|
135
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
136
|
+
onMove: (details: {
|
|
137
|
+
point: Point;
|
|
138
|
+
target: Element | null;
|
|
139
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
140
|
+
}) => void;
|
|
141
|
+
onEnd: (details: {
|
|
142
|
+
point: Point;
|
|
143
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
144
|
+
}) => void;
|
|
145
|
+
onCancel: () => void;
|
|
146
|
+
}
|
|
147
|
+
interface SwipeOpenTrackingOptions {
|
|
148
|
+
getDoc: () => Document;
|
|
149
|
+
getContentEl: () => HTMLElement | null;
|
|
150
|
+
getSwipeAreaEl: () => HTMLElement | null;
|
|
151
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
152
|
+
onMove: (details: {
|
|
153
|
+
point: Point;
|
|
154
|
+
}) => void;
|
|
155
|
+
onEnd: (details: {
|
|
156
|
+
point: Point;
|
|
157
|
+
swipeDirection: PhysicalSwipeDirection;
|
|
158
|
+
}) => void;
|
|
159
|
+
onCancel: () => void;
|
|
29
160
|
}
|
|
30
161
|
//#endregion
|
|
31
162
|
//#region src/machines/drawer/drawer.types.d.ts
|
|
163
|
+
type SwipeDirection = "up" | "down" | "start" | "end";
|
|
164
|
+
type SnapPoint = number | string;
|
|
32
165
|
interface OpenChangeDetails {
|
|
33
166
|
open: boolean;
|
|
34
167
|
}
|
|
35
168
|
interface ResolvedSnapPoint {
|
|
36
|
-
value:
|
|
169
|
+
value: SnapPoint;
|
|
170
|
+
height: number;
|
|
37
171
|
offset: number;
|
|
38
172
|
}
|
|
39
173
|
interface SnapPointChangeDetails {
|
|
40
|
-
snapPoint:
|
|
174
|
+
snapPoint: SnapPoint | null;
|
|
175
|
+
}
|
|
176
|
+
interface DrawerStackSnapshot {
|
|
177
|
+
active: boolean;
|
|
178
|
+
openCount: number;
|
|
179
|
+
swipeProgress: number;
|
|
180
|
+
frontmostHeight: number;
|
|
181
|
+
}
|
|
182
|
+
interface DrawerStack {
|
|
183
|
+
getSnapshot(): DrawerStackSnapshot;
|
|
184
|
+
subscribe(listener: () => void): () => void;
|
|
185
|
+
register(id: string): void;
|
|
186
|
+
unregister(id: string): void;
|
|
187
|
+
setOpen(id: string, open: boolean): void;
|
|
188
|
+
setHeight(id: string, height: number): void;
|
|
189
|
+
setSwipe(id: string, swiping: boolean, progress: number): void;
|
|
190
|
+
}
|
|
191
|
+
interface DrawerStackApi<T extends PropTypes = PropTypes> {
|
|
192
|
+
getIndentProps(): T["element"];
|
|
193
|
+
getIndentBackgroundProps(): T["element"];
|
|
41
194
|
}
|
|
42
195
|
type ElementIds = Partial<{
|
|
43
196
|
backdrop: string;
|
|
197
|
+
positioner: string;
|
|
44
198
|
content: string;
|
|
199
|
+
title: string;
|
|
200
|
+
description: string;
|
|
201
|
+
header: string;
|
|
45
202
|
trigger: string;
|
|
46
203
|
grabber: string;
|
|
47
204
|
grabberIndicator: string;
|
|
48
205
|
closeTrigger: string;
|
|
206
|
+
swipeArea: string;
|
|
49
207
|
}>;
|
|
50
208
|
interface DrawerProps extends DirectionProperty, CommonProperties, DismissableElementHandlers {
|
|
51
209
|
ids?: ElementIds;
|
|
@@ -61,29 +219,41 @@ interface DrawerProps extends DirectionProperty, CommonProperties, DismissableEl
|
|
|
61
219
|
onOpenChange?: ((details: OpenChangeDetails) => void) | undefined;
|
|
62
220
|
closeOnInteractOutside?: boolean | undefined;
|
|
63
221
|
closeOnEscape?: boolean | undefined;
|
|
64
|
-
snapPoints?:
|
|
222
|
+
snapPoints?: SnapPoint[] | undefined;
|
|
223
|
+
swipeDirection?: SwipeDirection | undefined;
|
|
224
|
+
snapToSequentialPoints?: boolean | undefined;
|
|
65
225
|
swipeVelocityThreshold?: number;
|
|
66
226
|
closeThreshold?: number;
|
|
67
227
|
preventDragOnScroll?: boolean;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
228
|
+
snapPoint?: SnapPoint | null | undefined;
|
|
229
|
+
defaultSnapPoint?: SnapPoint | null | undefined;
|
|
230
|
+
onSnapPointChange?: ((details: SnapPointChangeDetails) => void) | undefined;
|
|
231
|
+
stack?: DrawerStack | undefined;
|
|
71
232
|
}
|
|
72
|
-
type PropsWithDefault = "closeOnInteractOutside" | "closeOnEscape" | "modal" | "trapFocus" | "restoreFocus" | "preventScroll" | "initialFocusEl" | "snapPoints" | "swipeVelocityThreshold" | "closeThreshold" | "preventDragOnScroll" | "
|
|
233
|
+
type PropsWithDefault = "closeOnInteractOutside" | "closeOnEscape" | "modal" | "trapFocus" | "restoreFocus" | "preventScroll" | "initialFocusEl" | "snapPoints" | "swipeDirection" | "snapToSequentialPoints" | "swipeVelocityThreshold" | "closeThreshold" | "preventDragOnScroll" | "defaultSnapPoint";
|
|
73
234
|
interface DrawerSchema {
|
|
74
235
|
props: RequiredBy<DrawerProps, PropsWithDefault>;
|
|
75
|
-
state: "open" | "closed" | "closing";
|
|
236
|
+
state: "open" | "closed" | "closing" | "swipe-area-dragging" | "swiping-open";
|
|
76
237
|
tag: "open" | "closed";
|
|
77
238
|
context: {
|
|
78
239
|
dragOffset: number | null;
|
|
79
|
-
|
|
240
|
+
snapPoint: SnapPoint | null;
|
|
80
241
|
resolvedActiveSnapPoint: ResolvedSnapPoint | null;
|
|
81
|
-
|
|
242
|
+
contentSize: number | null;
|
|
243
|
+
viewportSize: number;
|
|
244
|
+
rootFontSize: number;
|
|
245
|
+
swipeStrength: number;
|
|
246
|
+
rendered: {
|
|
247
|
+
title: boolean;
|
|
248
|
+
description: boolean;
|
|
249
|
+
};
|
|
82
250
|
};
|
|
83
251
|
refs: {
|
|
84
|
-
|
|
252
|
+
swipeSession: DrawerSwipeSession;
|
|
85
253
|
};
|
|
86
254
|
computed: {
|
|
255
|
+
drawerId: string;
|
|
256
|
+
physicalSwipeDirection: PhysicalSwipeDirection;
|
|
87
257
|
resolvedSnapPoints: ResolvedSnapPoint[];
|
|
88
258
|
};
|
|
89
259
|
event: EventObject;
|
|
@@ -96,23 +266,31 @@ type DrawerMachine = Machine<DrawerSchema>;
|
|
|
96
266
|
interface ContentProps {
|
|
97
267
|
draggable?: boolean | undefined;
|
|
98
268
|
}
|
|
269
|
+
interface SwipeAreaProps {
|
|
270
|
+
disabled?: boolean | undefined;
|
|
271
|
+
swipeDirection?: SwipeDirection | undefined;
|
|
272
|
+
}
|
|
99
273
|
interface DrawerApi<T extends PropTypes = PropTypes> {
|
|
100
274
|
open: boolean;
|
|
101
275
|
dragging: boolean;
|
|
102
276
|
setOpen: (open: boolean) => void;
|
|
103
|
-
snapPoints:
|
|
104
|
-
|
|
105
|
-
|
|
277
|
+
snapPoints: SnapPoint[];
|
|
278
|
+
swipeDirection: SwipeDirection;
|
|
279
|
+
snapPoint: SnapPoint | null;
|
|
280
|
+
setSnapPoint: (snapPoint: SnapPoint | null) => void;
|
|
106
281
|
getOpenPercentage: () => number;
|
|
107
|
-
|
|
108
|
-
|
|
282
|
+
getSnapPointIndex: () => number;
|
|
283
|
+
getContentSize: () => number | null;
|
|
284
|
+
getPositionerProps: () => T["element"];
|
|
109
285
|
getContentProps: (props?: ContentProps) => T["element"];
|
|
110
286
|
getTitleProps: () => T["element"];
|
|
287
|
+
getDescriptionProps: () => T["element"];
|
|
111
288
|
getTriggerProps: () => T["element"];
|
|
112
289
|
getBackdropProps: () => T["element"];
|
|
113
290
|
getGrabberProps: () => T["element"];
|
|
114
291
|
getGrabberIndicatorProps: () => T["element"];
|
|
115
292
|
getCloseTriggerProps: () => T["element"];
|
|
293
|
+
getSwipeAreaProps: (props?: SwipeAreaProps) => T["element"];
|
|
116
294
|
}
|
|
117
295
|
//#endregion
|
|
118
296
|
//#region src/machines/drawer/drawer.connect.d.ts
|
|
@@ -125,4 +303,8 @@ declare const machine: Machine<DrawerSchema>;
|
|
|
125
303
|
declare const props: (keyof DrawerProps)[];
|
|
126
304
|
declare const splitProps: <Props extends Partial<DrawerProps>>(props: Props) => [Partial<DrawerProps>, Omit<Props, keyof DrawerProps>];
|
|
127
305
|
//#endregion
|
|
128
|
-
|
|
306
|
+
//#region src/machines/drawer/drawer.stack.d.ts
|
|
307
|
+
declare function createStack(): DrawerStack;
|
|
308
|
+
declare function connectStack<T extends PropTypes>(snapshot: DrawerStackSnapshot, normalize: NormalizeProps<T>): DrawerStackApi<T>;
|
|
309
|
+
//#endregion
|
|
310
|
+
export { type DrawerApi as Api, type ContentProps, type DrawerStack, type DrawerStackApi, type DrawerStackSnapshot, type ElementIds, type FocusOutsideEvent, type InteractOutsideEvent, type DrawerMachine as Machine, type OpenChangeDetails, type PointerDownOutsideEvent, type DrawerProps as Props, type ResolvedSnapPoint, type DrawerService as Service, type SnapPoint, type SnapPointChangeDetails, type SwipeDirection, anatomy, connect, connectStack, createStack, machine, props, splitProps };
|