@ereo/client 0.1.6
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 +93 -0
- package/dist/error-boundary.d.ts +215 -0
- package/dist/error-boundary.d.ts.map +1 -0
- package/dist/form.d.ts +436 -0
- package/dist/form.d.ts.map +1 -0
- package/dist/hooks.d.ts +261 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hydration.d.ts +67 -0
- package/dist/hydration.d.ts.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2081 -0
- package/dist/islands.d.ts +103 -0
- package/dist/islands.d.ts.map +1 -0
- package/dist/link.d.ts +91 -0
- package/dist/link.d.ts.map +1 -0
- package/dist/navigation.d.ts +121 -0
- package/dist/navigation.d.ts.map +1 -0
- package/dist/prefetch.d.ts +57 -0
- package/dist/prefetch.d.ts.map +1 -0
- package/dist/typed-link.d.ts +189 -0
- package/dist/typed-link.d.ts.map +1 -0
- package/dist/typed-navigate.d.ts +238 -0
- package/dist/typed-navigate.d.ts.map +1 -0
- package/package.json +46 -0
package/dist/hooks.d.ts
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ereo/client - React Hooks
|
|
3
|
+
*
|
|
4
|
+
* Client-side React hooks for accessing loader data, action results,
|
|
5
|
+
* navigation state, and error boundaries.
|
|
6
|
+
*/
|
|
7
|
+
import { type ReactNode, type Context } from 'react';
|
|
8
|
+
/**
|
|
9
|
+
* Navigation status for useNavigation hook.
|
|
10
|
+
*/
|
|
11
|
+
export type NavigationStatus = 'idle' | 'loading' | 'submitting';
|
|
12
|
+
/**
|
|
13
|
+
* Navigation state returned by useNavigation.
|
|
14
|
+
*/
|
|
15
|
+
export interface NavigationStateHook {
|
|
16
|
+
/** Current navigation status */
|
|
17
|
+
status: NavigationStatus;
|
|
18
|
+
/** The location being navigated to (if loading/submitting) */
|
|
19
|
+
location?: string;
|
|
20
|
+
/** The form data being submitted (if submitting) */
|
|
21
|
+
formData?: FormData;
|
|
22
|
+
/** The form method being used (if submitting) */
|
|
23
|
+
formMethod?: string;
|
|
24
|
+
/** The form action being used (if submitting) */
|
|
25
|
+
formAction?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Context value for loader data.
|
|
29
|
+
*/
|
|
30
|
+
export interface LoaderDataContextValue {
|
|
31
|
+
data: unknown;
|
|
32
|
+
setData: (data: unknown) => void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Context value for action data.
|
|
36
|
+
*/
|
|
37
|
+
export interface ActionDataContextValue {
|
|
38
|
+
data: unknown;
|
|
39
|
+
setData: (data: unknown) => void;
|
|
40
|
+
clearData: () => void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Context value for navigation state.
|
|
44
|
+
*/
|
|
45
|
+
export interface NavigationContextValue {
|
|
46
|
+
state: NavigationStateHook;
|
|
47
|
+
setState: (state: NavigationStateHook) => void;
|
|
48
|
+
startLoading: (location: string) => void;
|
|
49
|
+
startSubmitting: (options: {
|
|
50
|
+
location: string;
|
|
51
|
+
formData?: FormData;
|
|
52
|
+
formMethod?: string;
|
|
53
|
+
formAction?: string;
|
|
54
|
+
}) => void;
|
|
55
|
+
complete: () => void;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Context value for error boundary.
|
|
59
|
+
*/
|
|
60
|
+
export interface ErrorContextValue {
|
|
61
|
+
error: Error | undefined;
|
|
62
|
+
setError: (error: Error | undefined) => void;
|
|
63
|
+
clearError: () => void;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Context for loader data - populated during hydration/navigation.
|
|
67
|
+
*/
|
|
68
|
+
export declare const LoaderDataContext: Context<LoaderDataContextValue | null>;
|
|
69
|
+
/**
|
|
70
|
+
* Context for action results - populated after form submissions.
|
|
71
|
+
*/
|
|
72
|
+
export declare const ActionDataContext: Context<ActionDataContextValue | null>;
|
|
73
|
+
/**
|
|
74
|
+
* Context for navigation state - tracks navigation state.
|
|
75
|
+
*/
|
|
76
|
+
export declare const NavigationContext: Context<NavigationContextValue | null>;
|
|
77
|
+
/**
|
|
78
|
+
* Context for error boundary - captures errors from boundaries.
|
|
79
|
+
*/
|
|
80
|
+
export declare const ErrorContext: Context<ErrorContextValue | null>;
|
|
81
|
+
/**
|
|
82
|
+
* Access loader data in components.
|
|
83
|
+
*
|
|
84
|
+
* @returns The loader data for the current route
|
|
85
|
+
* @throws Error if used outside of EreoProvider
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```tsx
|
|
89
|
+
* function UserProfile() {
|
|
90
|
+
* const { user, posts } = useLoaderData<{ user: User; posts: Post[] }>();
|
|
91
|
+
* return <div>{user.name}</div>;
|
|
92
|
+
* }
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export declare function useLoaderData<T>(): T;
|
|
96
|
+
/**
|
|
97
|
+
* Access action results in components.
|
|
98
|
+
*
|
|
99
|
+
* @returns The action data (undefined if no action has been submitted)
|
|
100
|
+
* @throws Error if used outside of EreoProvider
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```tsx
|
|
104
|
+
* function ContactForm() {
|
|
105
|
+
* const actionData = useActionData<{ success: boolean; errors?: string[] }>();
|
|
106
|
+
*
|
|
107
|
+
* if (actionData?.success) {
|
|
108
|
+
* return <div>Message sent!</div>;
|
|
109
|
+
* }
|
|
110
|
+
*
|
|
111
|
+
* return (
|
|
112
|
+
* <form method="post">
|
|
113
|
+
* {actionData?.errors?.map(e => <p>{e}</p>)}
|
|
114
|
+
* <input name="email" />
|
|
115
|
+
* <button>Submit</button>
|
|
116
|
+
* </form>
|
|
117
|
+
* );
|
|
118
|
+
* }
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
export declare function useActionData<T>(): T | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Get current navigation state.
|
|
124
|
+
*
|
|
125
|
+
* @returns The current navigation state
|
|
126
|
+
* @throws Error if used outside of EreoProvider
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```tsx
|
|
130
|
+
* function NavigationIndicator() {
|
|
131
|
+
* const navigation = useNavigation();
|
|
132
|
+
*
|
|
133
|
+
* if (navigation.status === 'loading') {
|
|
134
|
+
* return <Spinner />;
|
|
135
|
+
* }
|
|
136
|
+
*
|
|
137
|
+
* if (navigation.status === 'submitting') {
|
|
138
|
+
* return <div>Submitting form...</div>;
|
|
139
|
+
* }
|
|
140
|
+
*
|
|
141
|
+
* return null;
|
|
142
|
+
* }
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
export declare function useNavigation(): NavigationStateHook;
|
|
146
|
+
/**
|
|
147
|
+
* Access error from error boundary context.
|
|
148
|
+
*
|
|
149
|
+
* @returns The current error (undefined if no error)
|
|
150
|
+
* @throws Error if used outside of EreoProvider
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```tsx
|
|
154
|
+
* function ErrorDisplay() {
|
|
155
|
+
* const error = useError();
|
|
156
|
+
*
|
|
157
|
+
* if (!error) return null;
|
|
158
|
+
*
|
|
159
|
+
* return (
|
|
160
|
+
* <div className="error">
|
|
161
|
+
* <h1>Something went wrong</h1>
|
|
162
|
+
* <p>{error.message}</p>
|
|
163
|
+
* </div>
|
|
164
|
+
* );
|
|
165
|
+
* }
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
export declare function useError(): Error | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* Props for LoaderDataProvider.
|
|
171
|
+
*/
|
|
172
|
+
export interface LoaderDataProviderProps {
|
|
173
|
+
children: ReactNode;
|
|
174
|
+
initialData?: unknown;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Provider for loader data context.
|
|
178
|
+
*/
|
|
179
|
+
export declare function LoaderDataProvider({ children, initialData, }: LoaderDataProviderProps): ReactNode;
|
|
180
|
+
/**
|
|
181
|
+
* Props for ActionDataProvider.
|
|
182
|
+
*/
|
|
183
|
+
export interface ActionDataProviderProps {
|
|
184
|
+
children: ReactNode;
|
|
185
|
+
initialData?: unknown;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Provider for action data context.
|
|
189
|
+
*/
|
|
190
|
+
export declare function ActionDataProvider({ children, initialData, }: ActionDataProviderProps): ReactNode;
|
|
191
|
+
/**
|
|
192
|
+
* Props for NavigationProvider.
|
|
193
|
+
*/
|
|
194
|
+
export interface NavigationProviderProps {
|
|
195
|
+
children: ReactNode;
|
|
196
|
+
initialState?: NavigationStateHook;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Provider for navigation state context.
|
|
200
|
+
*/
|
|
201
|
+
export declare function NavigationProvider({ children, initialState, }: NavigationProviderProps): ReactNode;
|
|
202
|
+
/**
|
|
203
|
+
* Props for ErrorProvider.
|
|
204
|
+
*/
|
|
205
|
+
export interface ErrorProviderProps {
|
|
206
|
+
children: ReactNode;
|
|
207
|
+
initialError?: Error;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Provider for error context.
|
|
211
|
+
*/
|
|
212
|
+
export declare function ErrorProvider({ children, initialError, }: ErrorProviderProps): ReactNode;
|
|
213
|
+
/**
|
|
214
|
+
* Props for EreoProvider - the combined provider that wraps your app.
|
|
215
|
+
*/
|
|
216
|
+
export interface EreoProviderProps {
|
|
217
|
+
children: ReactNode;
|
|
218
|
+
/** Initial loader data (typically from SSR) */
|
|
219
|
+
loaderData?: unknown;
|
|
220
|
+
/** Initial action data (typically from SSR after form submission) */
|
|
221
|
+
actionData?: unknown;
|
|
222
|
+
/** Initial navigation state */
|
|
223
|
+
navigationState?: NavigationStateHook;
|
|
224
|
+
/** Initial error (if rendering an error boundary) */
|
|
225
|
+
error?: Error;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Combined provider that wraps the application with all EreoJS contexts.
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
* ```tsx
|
|
232
|
+
* // In your entry point
|
|
233
|
+
* import { EreoProvider } from '@ereo/client';
|
|
234
|
+
*
|
|
235
|
+
* function App() {
|
|
236
|
+
* return (
|
|
237
|
+
* <EreoProvider loaderData={window.__EREO_DATA__}>
|
|
238
|
+
* <Router />
|
|
239
|
+
* </EreoProvider>
|
|
240
|
+
* );
|
|
241
|
+
* }
|
|
242
|
+
* ```
|
|
243
|
+
*/
|
|
244
|
+
export declare function EreoProvider({ children, loaderData, actionData, navigationState, error, }: EreoProviderProps): ReactNode;
|
|
245
|
+
/**
|
|
246
|
+
* Get the raw loader data context (for internal use).
|
|
247
|
+
*/
|
|
248
|
+
export declare function useLoaderDataContext(): LoaderDataContextValue;
|
|
249
|
+
/**
|
|
250
|
+
* Get the raw action data context (for internal use).
|
|
251
|
+
*/
|
|
252
|
+
export declare function useActionDataContext(): ActionDataContextValue;
|
|
253
|
+
/**
|
|
254
|
+
* Get the raw navigation context (for internal use).
|
|
255
|
+
*/
|
|
256
|
+
export declare function useNavigationContext(): NavigationContextValue;
|
|
257
|
+
/**
|
|
258
|
+
* Get the raw error context (for internal use).
|
|
259
|
+
*/
|
|
260
|
+
export declare function useErrorContext(): ErrorContextValue;
|
|
261
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAML,KAAK,SAAS,EACd,KAAK,OAAO,EAEb,MAAM,OAAO,CAAC;AAMf;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,SAAS,GAAG,YAAY,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,gCAAgC;IAChC,MAAM,EAAE,gBAAgB,CAAC;IACzB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,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AAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,YAAY,CAAC,EAAE,KAAK,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,YAAY,GACb,EAAE,kBAAkB,GAAG,SAAS,CAahC;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qEAAqE;IACrE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,+BAA+B;IAC/B,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACtC,qDAAqD;IACrD,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,UAAU,EACV,UAAU,EACV,eAAe,EACf,KAAK,GACN,EAAE,iBAAiB,GAAG,SAAS,CAc/B;AAMD;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,sBAAsB,CAQ7D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,sBAAsB,CAQ7D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,sBAAsB,CAQ7D;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,iBAAiB,CAQnD"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ereo/client - Hydration Directives
|
|
3
|
+
*
|
|
4
|
+
* Selective hydration strategies inspired by Astro.
|
|
5
|
+
* Only hydrate what needs interactivity.
|
|
6
|
+
*/
|
|
7
|
+
import type { ComponentType } from 'react';
|
|
8
|
+
import type { HydrationStrategy } from '@ereo/core';
|
|
9
|
+
/**
|
|
10
|
+
* Hydration directive props.
|
|
11
|
+
*/
|
|
12
|
+
export interface HydrationProps {
|
|
13
|
+
/** Hydrate immediately on page load */
|
|
14
|
+
'client:load'?: boolean;
|
|
15
|
+
/** Hydrate when browser is idle */
|
|
16
|
+
'client:idle'?: boolean;
|
|
17
|
+
/** Hydrate when element is visible */
|
|
18
|
+
'client:visible'?: boolean;
|
|
19
|
+
/** Hydrate when media query matches */
|
|
20
|
+
'client:media'?: string;
|
|
21
|
+
/** Only render on client (no SSR) */
|
|
22
|
+
'client:only'?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Island component wrapper.
|
|
26
|
+
*/
|
|
27
|
+
export interface IslandComponent<P = {}> {
|
|
28
|
+
/** The React component */
|
|
29
|
+
Component: ComponentType<P>;
|
|
30
|
+
/** Component props */
|
|
31
|
+
props: P;
|
|
32
|
+
/** Hydration strategy */
|
|
33
|
+
strategy: HydrationStrategy;
|
|
34
|
+
/** Media query (for client:media) */
|
|
35
|
+
media?: string;
|
|
36
|
+
/** Unique island ID */
|
|
37
|
+
id: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Parse hydration directive from props.
|
|
41
|
+
*/
|
|
42
|
+
export declare function parseHydrationDirective(props: HydrationProps): {
|
|
43
|
+
strategy: HydrationStrategy;
|
|
44
|
+
media?: string;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Check if a component should be hydrated based on strategy.
|
|
48
|
+
*/
|
|
49
|
+
export declare function shouldHydrate(strategy: HydrationStrategy, media?: string): boolean | (() => boolean);
|
|
50
|
+
/**
|
|
51
|
+
* Create a deferred hydration trigger.
|
|
52
|
+
*/
|
|
53
|
+
export declare function createHydrationTrigger(strategy: HydrationStrategy, element: Element, onHydrate: () => void, media?: string): () => void;
|
|
54
|
+
/**
|
|
55
|
+
* Strip hydration props from component props.
|
|
56
|
+
*/
|
|
57
|
+
export declare function stripHydrationProps<P extends HydrationProps>(props: P): Omit<P, keyof HydrationProps>;
|
|
58
|
+
export declare function generateIslandId(): string;
|
|
59
|
+
/**
|
|
60
|
+
* Reset island counter (for testing).
|
|
61
|
+
*/
|
|
62
|
+
export declare function resetIslandCounter(): void;
|
|
63
|
+
/**
|
|
64
|
+
* Get the current island count.
|
|
65
|
+
*/
|
|
66
|
+
export declare function getIslandCount(): number;
|
|
67
|
+
//# sourceMappingURL=hydration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydration.d.ts","sourceRoot":"","sources":["../src/hydration.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,uCAAuC;IACvC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mCAAmC;IACnC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,sCAAsC;IACtC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,uCAAuC;IACvC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qCAAqC;IACrC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,EAAE;IACrC,0BAA0B;IAC1B,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAC5B,sBAAsB;IACtB,KAAK,EAAE,CAAC,CAAC;IACT,yBAAyB;IACzB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uBAAuB;IACvB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,cAAc,GAAG;IAC9D,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAiBA;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,iBAAiB,EAC3B,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,CAqB3B;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,MAAM,IAAI,EACrB,KAAK,CAAC,EAAE,MAAM,GACb,MAAM,IAAI,CAkEZ;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,cAAc,EAC1D,KAAK,EAAE,CAAC,GACP,IAAI,CAAC,CAAC,EAAE,MAAM,cAAc,CAAC,CAU/B;AAOD,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ereo/client
|
|
3
|
+
*
|
|
4
|
+
* Client-side runtime for the EreoJS framework.
|
|
5
|
+
* Includes islands architecture, navigation, and prefetching.
|
|
6
|
+
*/
|
|
7
|
+
export { parseHydrationDirective, createHydrationTrigger, stripHydrationProps, generateIslandId, resetIslandCounter, getIslandCount, shouldHydrate, } from './hydration';
|
|
8
|
+
export type { HydrationProps } from './hydration';
|
|
9
|
+
export { useLoaderData, useActionData, useNavigation, useError, useLoaderDataContext, useActionDataContext, useNavigationContext, useErrorContext, LoaderDataContext, ActionDataContext, NavigationContext, ErrorContext, LoaderDataProvider, ActionDataProvider, NavigationProvider, ErrorProvider, EreoProvider, } from './hooks';
|
|
10
|
+
export type { NavigationStatus, NavigationStateHook, LoaderDataContextValue, ActionDataContextValue, NavigationContextValue, ErrorContextValue, LoaderDataProviderProps, ActionDataProviderProps, NavigationProviderProps, ErrorProviderProps, EreoProviderProps, } from './hooks';
|
|
11
|
+
export { islandRegistry, hydrateIslands, registerIslandComponent, getIslandComponent, registerIslandComponents, createIsland, initializeIslands, cleanupIslands, } from './islands';
|
|
12
|
+
export type { IslandRegistration } from './islands';
|
|
13
|
+
export { router, navigate, goBack, goForward, onNavigate, getNavigationState, fetchLoaderData, submitAction, setupScrollRestoration, } from './navigation';
|
|
14
|
+
export type { NavigationState, NavigationEvent, NavigationListener } from './navigation';
|
|
15
|
+
export { prefetch, getPrefetchedData, clearPrefetchCache, setupLinkPrefetch, setupAutoPrefetch, prefetchAll, isPrefetching, isPrefetched, } from './prefetch';
|
|
16
|
+
export type { PrefetchOptions, LinkPrefetchProps } from './prefetch';
|
|
17
|
+
export { Link, NavLink, useIsActive } from './link';
|
|
18
|
+
export type { LinkProps, NavLinkProps, NavLinkActiveProps, PrefetchStrategy, } from './link';
|
|
19
|
+
export { TypedLink, TypedNavLink, useIsRouteActive, buildUrl, } from './typed-link';
|
|
20
|
+
export type { TypedLinkProps, TypedNavLinkProps, NavLinkActiveProps as TypedNavLinkActiveProps, } from './typed-link';
|
|
21
|
+
export { typedNavigate, useTypedNavigate, typedRedirect, redirect, buildTypedUrl, parseTypedSearchParams, parseTypedHashParams, goBack as typedGoBack, goForward as typedGoForward, go, isCurrentPath, preloadRoute, } from './typed-navigate';
|
|
22
|
+
export type { TypedNavigateOptions, TypedRedirectOptions, TypedNavigateFunction, } from './typed-navigate';
|
|
23
|
+
export { Form, FormProvider, useFormContext, useSubmit, useFetcher, useActionData as useFormActionData, useNavigation as useFormNavigation, serializeFormData, parseFormData, formDataToObject, objectToFormData, } from './form';
|
|
24
|
+
export type { FormProps, ActionResult, SubmissionState, SubmitOptions, FetcherState, Fetcher, FormContextValue, FormNavigationState, } from './form';
|
|
25
|
+
export { ErrorBoundary, RouteErrorBoundary, useErrorBoundary, useRouteError, isRouteErrorResponse, createRouteErrorResponse, withErrorBoundary, RouteError, } from './error-boundary';
|
|
26
|
+
export type { ErrorBoundaryProps, RouteErrorResponse, RouteErrorBoundaryProps, UseErrorBoundaryReturn, } from './error-boundary';
|
|
27
|
+
/**
|
|
28
|
+
* Initialize the client runtime.
|
|
29
|
+
* Call this in your entry point.
|
|
30
|
+
*/
|
|
31
|
+
export declare function initClient(): void;
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,aAAa,GACd,MAAM,aAAa,CAAC;AAErB,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,OAAO,EAEL,aAAa,EACb,aAAa,EACb,aAAa,EACb,QAAQ,EAER,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EAEf,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EAEZ,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,YAAY,GACb,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,gBAAgB,EAChB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EACjB,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,cAAc,EACd,cAAc,EACd,uBAAuB,EACvB,kBAAkB,EAClB,wBAAwB,EACxB,YAAY,EACZ,iBAAiB,EACjB,cAAc,GACf,MAAM,WAAW,CAAC;AAEnB,YAAY,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAGpD,OAAO,EACL,MAAM,EACN,QAAQ,EACR,MAAM,EACN,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,sBAAsB,GACvB,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAA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