1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | import React = require(".");
|
27 |
|
28 | export {};
|
29 |
|
30 | declare const UNDEFINED_VOID_ONLY: unique symbol;
|
31 | type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
|
32 |
|
33 | type NativeToggleEvent = ToggleEvent;
|
34 |
|
35 | declare module "." {
|
36 | export type Usable<T> = PromiseLike<T> | Context<T>;
|
37 |
|
38 | export function use<T>(usable: Usable<T>): T;
|
39 |
|
40 | interface ServerContextJSONArray extends ReadonlyArray<ServerContextJSONValue> {}
|
41 | export type ServerContextJSONValue =
|
42 | | string
|
43 | | boolean
|
44 | | number
|
45 | | null
|
46 | | ServerContextJSONArray
|
47 | | { [key: string]: ServerContextJSONValue };
|
48 | export interface ServerContext<T extends ServerContextJSONValue> {
|
49 | Provider: Provider<T>;
|
50 | }
|
51 | |
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 | function useContext<T extends ServerContextJSONValue>(context: ServerContext<T>): T;
|
59 | export function createServerContext<T extends ServerContextJSONValue>(
|
60 | globalName: string,
|
61 | defaultValue: T,
|
62 | ): ServerContext<T>;
|
63 |
|
64 |
|
65 | export function cache<CachedFunction extends Function>(fn: CachedFunction): CachedFunction;
|
66 |
|
67 | export function unstable_useCacheRefresh(): () => void;
|
68 |
|
69 | interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS {
|
70 | functions: (formData: FormData) => void | Promise<void>;
|
71 | }
|
72 |
|
73 | export interface TransitionStartFunction {
|
74 | |
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 | (callback: () => Promise<VoidOrUndefinedOnly>): void;
|
82 | }
|
83 |
|
84 | |
85 |
|
86 |
|
87 |
|
88 |
|
89 | export function startTransition(scope: () => Promise<VoidOrUndefinedOnly>): void;
|
90 |
|
91 | export function useOptimistic<State>(
|
92 | passthrough: State,
|
93 | ): [State, (action: State | ((pendingState: State) => State)) => void];
|
94 | export function useOptimistic<State, Action>(
|
95 | passthrough: State,
|
96 | reducer: (state: State, action: Action) => State,
|
97 | ): [State, (action: Action) => void];
|
98 |
|
99 | interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES {
|
100 | cleanup: () => VoidOrUndefinedOnly;
|
101 | }
|
102 |
|
103 | export function useActionState<State>(
|
104 | action: (state: Awaited<State>) => State | Promise<State>,
|
105 | initialState: Awaited<State>,
|
106 | permalink?: string,
|
107 | ): [state: Awaited<State>, dispatch: () => void, isPending: boolean];
|
108 | export function useActionState<State, Payload>(
|
109 | action: (state: Awaited<State>, payload: Payload) => State | Promise<State>,
|
110 | initialState: Awaited<State>,
|
111 | permalink?: string,
|
112 | ): [state: Awaited<State>, dispatch: (payload: Payload) => void, isPending: boolean];
|
113 |
|
114 | interface DOMAttributes<T> {
|
115 |
|
116 | onTransitionCancel?: TransitionEventHandler<T> | undefined;
|
117 | onTransitionCancelCapture?: TransitionEventHandler<T> | undefined;
|
118 | onTransitionRun?: TransitionEventHandler<T> | undefined;
|
119 | onTransitionRunCapture?: TransitionEventHandler<T> | undefined;
|
120 | onTransitionStart?: TransitionEventHandler<T> | undefined;
|
121 | onTransitionStartCapture?: TransitionEventHandler<T> | undefined;
|
122 | }
|
123 |
|
124 | type ToggleEventHandler<T = Element> = EventHandler<ToggleEvent<T>>;
|
125 |
|
126 | interface HTMLAttributes<T> {
|
127 | popover?: "" | "auto" | "manual" | undefined;
|
128 | popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
|
129 | popoverTarget?: string | undefined;
|
130 | onToggle?: ToggleEventHandler<T> | undefined;
|
131 | onBeforeToggle?: ToggleEventHandler<T> | undefined;
|
132 | }
|
133 |
|
134 | interface ToggleEvent<T = Element> extends SyntheticEvent<T, NativeToggleEvent> {
|
135 | oldState: "closed" | "open";
|
136 | newState: "closed" | "open";
|
137 | }
|
138 |
|
139 | interface LinkHTMLAttributes<T> {
|
140 | precedence?: string | undefined;
|
141 | }
|
142 |
|
143 | interface StyleHTMLAttributes<T> {
|
144 | href?: string | undefined;
|
145 | precedence?: string | undefined;
|
146 | }
|
147 |
|
148 | |
149 |
|
150 |
|
151 |
|
152 |
|
153 | type AwaitedReactNode =
|
154 | | ReactElement
|
155 | | string
|
156 | | number
|
157 | | Iterable<AwaitedReactNode>
|
158 | | ReactPortal
|
159 | | boolean
|
160 | | null
|
161 | | undefined;
|
162 | interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES {
|
163 | promises: Promise<AwaitedReactNode>;
|
164 | bigints: bigint;
|
165 | }
|
166 | }
|