@alepha/react 0.7.5 → 0.7.7
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/index.browser.d.ts +523 -0
- package/dist/index.browser.js +1041 -49
- package/dist/index.browser.js.map +1 -0
- package/dist/index.cjs +1288 -375
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +629 -0
- package/dist/index.d.ts +468 -559
- package/dist/index.js +1245 -354
- package/dist/index.js.map +1 -0
- package/package.json +12 -8
- package/src/descriptors/$page.ts +2 -47
- package/src/hooks/useClient.ts +3 -3
- package/src/index.ts +16 -4
- package/src/providers/BrowserRouterProvider.ts +3 -4
- package/src/providers/PageDescriptorProvider.ts +10 -57
- package/src/providers/ReactBrowserProvider.ts +3 -14
- package/src/providers/ReactServerProvider.ts +66 -58
- package/dist/index.browser.cjs +0 -75
- package/dist/useRouterState-BTmuHxkM.cjs +0 -1183
- package/dist/useRouterState-cCucJfTC.js +0 -1161
- package/src/providers/BrowserHeadProvider.ts +0 -43
- package/src/providers/ServerHeadProvider.ts +0 -91
package/dist/index.d.ts
CHANGED
|
@@ -1,87 +1,26 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import * as
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import * as
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
declare const Kind: unique symbol;
|
|
20
|
-
|
|
21
|
-
type StringFormatOption = 'date-time' | 'time' | 'date' | 'email' | 'idn-email' | 'hostname' | 'idn-hostname' | 'ipv4' | 'ipv6' | 'uri' | 'uri-reference' | 'iri' | 'uuid' | 'iri-reference' | 'uri-template' | 'json-pointer' | 'relative-json-pointer' | 'regex' | ({} & string);
|
|
22
|
-
type StringContentEncodingOption = '7bit' | '8bit' | 'binary' | 'quoted-printable' | 'base64' | ({} & string);
|
|
23
|
-
interface StringOptions extends SchemaOptions {
|
|
24
|
-
/** The maximum string length */
|
|
25
|
-
maxLength?: number;
|
|
26
|
-
/** The minimum string length */
|
|
27
|
-
minLength?: number;
|
|
28
|
-
/** A regular expression pattern this string should match */
|
|
29
|
-
pattern?: string;
|
|
30
|
-
/** A format this string should match */
|
|
31
|
-
format?: StringFormatOption;
|
|
32
|
-
/** The content encoding for this string */
|
|
33
|
-
contentEncoding?: StringContentEncodingOption;
|
|
34
|
-
/** The content media type for this string */
|
|
35
|
-
contentMediaType?: string;
|
|
36
|
-
}
|
|
37
|
-
interface TString extends TSchema, StringOptions {
|
|
38
|
-
[Kind]: 'String';
|
|
39
|
-
static: string;
|
|
40
|
-
type: 'string';
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
interface TBoolean extends TSchema {
|
|
44
|
-
[Kind]: 'Boolean';
|
|
45
|
-
static: boolean;
|
|
46
|
-
type: 'boolean';
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
type TOptional<T extends TSchema> = T & {
|
|
50
|
-
[OptionalKind]: 'Optional';
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
interface SchemaOptions {
|
|
54
|
-
$schema?: string;
|
|
55
|
-
/** Id for this schema */
|
|
56
|
-
$id?: string;
|
|
57
|
-
/** Title of this schema */
|
|
58
|
-
title?: string;
|
|
59
|
-
/** Description of this schema */
|
|
60
|
-
description?: string;
|
|
61
|
-
/** Default value for this schema */
|
|
62
|
-
default?: any;
|
|
63
|
-
/** Example values matching this schema */
|
|
64
|
-
examples?: any;
|
|
65
|
-
/** Optional annotation for readOnly */
|
|
66
|
-
readOnly?: boolean;
|
|
67
|
-
/** Optional annotation for writeOnly */
|
|
68
|
-
writeOnly?: boolean;
|
|
69
|
-
[prop: string]: any;
|
|
70
|
-
}
|
|
71
|
-
interface TKind {
|
|
72
|
-
[Kind]: string;
|
|
73
|
-
}
|
|
74
|
-
interface TSchema extends TKind, SchemaOptions {
|
|
75
|
-
[ReadonlyKind]?: string;
|
|
76
|
-
[OptionalKind]?: string;
|
|
77
|
-
[Hint]?: string;
|
|
78
|
-
params: unknown[];
|
|
79
|
-
static: unknown;
|
|
80
|
-
}
|
|
1
|
+
import * as _alepha_core12 from "@alepha/core";
|
|
2
|
+
import * as _alepha_core23 from "@alepha/core";
|
|
3
|
+
import * as _alepha_core16 from "@alepha/core";
|
|
4
|
+
import * as _alepha_core6 from "@alepha/core";
|
|
5
|
+
import { Alepha, Async, KIND, Module, OPTIONS, Service, Static, TObject, TSchema } from "@alepha/core";
|
|
6
|
+
import { ApiLinksResponse, ServerHandler, ServerRequest, ServerRouterProvider, ServerTimingProvider } from "@alepha/server";
|
|
7
|
+
import { ServerRouteCache } from "@alepha/server-cache";
|
|
8
|
+
import * as react19 from "react";
|
|
9
|
+
import * as react20 from "react";
|
|
10
|
+
import React, { AnchorHTMLAttributes, ErrorInfo, FC, PropsWithChildren, ReactNode } from "react";
|
|
11
|
+
import * as react_jsx_runtime22 from "react/jsx-runtime";
|
|
12
|
+
import * as react_jsx_runtime21 from "react/jsx-runtime";
|
|
13
|
+
import { ClientScope, HttpVirtualClient, LinkProvider } from "@alepha/server-links";
|
|
14
|
+
import { ServerStaticProvider } from "@alepha/server-static";
|
|
15
|
+
import { Route, RouterProvider } from "@alepha/router";
|
|
16
|
+
import * as _sinclair_typebox11 from "@sinclair/typebox";
|
|
17
|
+
import * as _sinclair_typebox1 from "@sinclair/typebox";
|
|
18
|
+
import { Root } from "react-dom/client";
|
|
81
19
|
|
|
20
|
+
//#region src/components/ClientOnly.d.ts
|
|
82
21
|
interface ClientOnlyProps {
|
|
83
|
-
|
|
84
|
-
|
|
22
|
+
fallback?: ReactNode;
|
|
23
|
+
disabled?: boolean;
|
|
85
24
|
}
|
|
86
25
|
/**
|
|
87
26
|
* A small utility component that renders its children only on the client side.
|
|
@@ -94,397 +33,343 @@ interface ClientOnlyProps {
|
|
|
94
33
|
* - you want to prevent pre-rendering of a component
|
|
95
34
|
*/
|
|
96
35
|
declare const ClientOnly: (props: PropsWithChildren<ClientOnlyProps>) => ReactNode;
|
|
97
|
-
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/descriptors/$page.d.ts
|
|
98
38
|
declare const KEY = "PAGE";
|
|
99
39
|
interface PageConfigSchema {
|
|
100
|
-
|
|
101
|
-
|
|
40
|
+
query?: TSchema;
|
|
41
|
+
params?: TSchema;
|
|
102
42
|
}
|
|
103
43
|
type TPropsDefault = any;
|
|
104
44
|
type TPropsParentDefault = {};
|
|
105
45
|
interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
cache?: ServerRouteCache;
|
|
46
|
+
/**
|
|
47
|
+
* Name your page.
|
|
48
|
+
*
|
|
49
|
+
* @default Descriptor key
|
|
50
|
+
*/
|
|
51
|
+
name?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Optional description of the page.
|
|
54
|
+
*/
|
|
55
|
+
description?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Add a pathname to the page.
|
|
58
|
+
*
|
|
59
|
+
* Pathname can contain parameters, like `/post/:slug`.
|
|
60
|
+
*
|
|
61
|
+
* @default ""
|
|
62
|
+
*/
|
|
63
|
+
path?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Add an input schema to define:
|
|
66
|
+
* - `params`: parameters from the pathname.
|
|
67
|
+
* - `query`: query parameters from the URL.
|
|
68
|
+
*/
|
|
69
|
+
schema?: TConfig;
|
|
70
|
+
/**
|
|
71
|
+
* Load data before rendering the page.
|
|
72
|
+
*
|
|
73
|
+
* This function receives
|
|
74
|
+
* - the request context and
|
|
75
|
+
* - the parent props (if page has a parent)
|
|
76
|
+
*
|
|
77
|
+
* In SSR, the returned data will be serialized and sent to the client, then reused during the client-side hydration.
|
|
78
|
+
*
|
|
79
|
+
* Resolve can be stopped by throwing an error, which will be handled by the `errorHandler` function.
|
|
80
|
+
* It's common to throw a `NotFoundError` to display a 404 page.
|
|
81
|
+
*
|
|
82
|
+
* RedirectError can be thrown to redirect the user to another page.
|
|
83
|
+
*/
|
|
84
|
+
resolve?: (context: PageResolve<TConfig, TPropsParent>) => Async<TProps>;
|
|
85
|
+
/**
|
|
86
|
+
* The component to render when the page is loaded.
|
|
87
|
+
*
|
|
88
|
+
* If `lazy` is defined, this will be ignored.
|
|
89
|
+
* Prefer using `lazy` to improve the initial loading time.
|
|
90
|
+
*/
|
|
91
|
+
component?: FC<TProps & TPropsParent>;
|
|
92
|
+
/**
|
|
93
|
+
* Lazy load the component when the page is loaded.
|
|
94
|
+
*
|
|
95
|
+
* It's recommended to use this for components to improve the initial loading time
|
|
96
|
+
* and enable code-splitting.
|
|
97
|
+
*/
|
|
98
|
+
lazy?: () => Promise<{
|
|
99
|
+
default: FC<TProps & TPropsParent>;
|
|
100
|
+
}>;
|
|
101
|
+
/**
|
|
102
|
+
* Set some children pages and make the page a parent page.
|
|
103
|
+
*
|
|
104
|
+
* /!\ Parent page can't be rendered directly. /!\
|
|
105
|
+
*
|
|
106
|
+
* If you still want to render at this pathname, add a child page with an empty path.
|
|
107
|
+
*/
|
|
108
|
+
children?: Array<{
|
|
109
|
+
[OPTIONS]: PageDescriptorOptions;
|
|
110
|
+
}>;
|
|
111
|
+
parent?: {
|
|
112
|
+
[OPTIONS]: PageDescriptorOptions<PageConfigSchema, TPropsParent>;
|
|
113
|
+
};
|
|
114
|
+
can?: () => boolean;
|
|
115
|
+
errorHandler?: (error: Error) => ReactNode;
|
|
116
|
+
prerender?: boolean | {
|
|
117
|
+
entries?: Array<Partial<PageRequestConfig<TConfig>>>;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* If true, the page will be rendered on the client-side.
|
|
121
|
+
*/
|
|
122
|
+
client?: boolean | ClientOnlyProps;
|
|
123
|
+
afterHandler?: (request: ServerRequest) => any;
|
|
124
|
+
cache?: ServerRouteCache;
|
|
186
125
|
}
|
|
187
126
|
interface PageDescriptor<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
127
|
+
[KIND]: typeof KEY;
|
|
128
|
+
[OPTIONS]: PageDescriptorOptions<TConfig, TProps, TPropsParent>;
|
|
129
|
+
/**
|
|
130
|
+
* For testing or build purposes, this will render the page (with or without the HTML layout) and return the HTML and context.
|
|
131
|
+
* Only valid for server-side rendering, it will throw an error if called on the client-side.
|
|
132
|
+
*/
|
|
133
|
+
render: (options?: PageDescriptorRenderOptions) => Promise<PageDescriptorRenderResult>;
|
|
195
134
|
}
|
|
196
135
|
/**
|
|
197
136
|
* Main descriptor for defining a React route in the application.
|
|
198
137
|
*/
|
|
199
138
|
declare const $page: {
|
|
200
|
-
|
|
201
|
-
|
|
139
|
+
<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = any, TPropsParent extends object = TPropsParentDefault>(options: PageDescriptorOptions<TConfig, TProps, TPropsParent>): PageDescriptor<TConfig, TProps, TPropsParent>;
|
|
140
|
+
[KIND]: string;
|
|
202
141
|
};
|
|
203
142
|
interface PageDescriptorRenderOptions {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
143
|
+
params?: Record<string, string>;
|
|
144
|
+
query?: Record<string, string>;
|
|
145
|
+
html?: boolean;
|
|
146
|
+
hydration?: boolean;
|
|
207
147
|
}
|
|
208
148
|
interface PageDescriptorRenderResult {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
interface Head$1 {
|
|
213
|
-
title?: string;
|
|
214
|
-
description?: string;
|
|
215
|
-
titleSeparator?: string;
|
|
216
|
-
htmlAttributes?: Record<string, string>;
|
|
217
|
-
bodyAttributes?: Record<string, string>;
|
|
218
|
-
meta?: Array<{
|
|
219
|
-
name: string;
|
|
220
|
-
content: string;
|
|
221
|
-
}>;
|
|
222
|
-
keywords?: string[];
|
|
223
|
-
author?: string;
|
|
224
|
-
robots?: string;
|
|
225
|
-
themeColor?: string;
|
|
226
|
-
viewport?: string | {
|
|
227
|
-
width?: string;
|
|
228
|
-
height?: string;
|
|
229
|
-
initialScale?: string;
|
|
230
|
-
maximumScale?: string;
|
|
231
|
-
userScalable?: "no" | "yes" | "0" | "1";
|
|
232
|
-
interactiveWidget?: "resizes-visual" | "resizes-content" | "overlays-content";
|
|
233
|
-
};
|
|
234
|
-
og?: {
|
|
235
|
-
title?: string;
|
|
236
|
-
description?: string;
|
|
237
|
-
image?: string;
|
|
238
|
-
url?: string;
|
|
239
|
-
type?: string;
|
|
240
|
-
};
|
|
241
|
-
twitter?: {
|
|
242
|
-
card?: string;
|
|
243
|
-
title?: string;
|
|
244
|
-
description?: string;
|
|
245
|
-
image?: string;
|
|
246
|
-
site?: string;
|
|
247
|
-
};
|
|
149
|
+
html: string;
|
|
150
|
+
context: PageReactContext;
|
|
248
151
|
}
|
|
249
152
|
interface PageRequestConfig<TConfig extends PageConfigSchema = PageConfigSchema> {
|
|
250
|
-
|
|
251
|
-
|
|
153
|
+
params: TConfig["params"] extends TSchema ? Static<TConfig["params"]> : Record<string, string>;
|
|
154
|
+
query: TConfig["query"] extends TSchema ? Static<TConfig["query"]> : Record<string, string>;
|
|
252
155
|
}
|
|
253
156
|
type PageResolve<TConfig extends PageConfigSchema = PageConfigSchema, TPropsParent extends object = TPropsParentDefault> = PageRequestConfig<TConfig> & TPropsParent & PageReactContext;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region src/providers/PageDescriptorProvider.d.ts
|
|
159
|
+
declare const envSchema$1: _alepha_core12.TObject<{
|
|
160
|
+
REACT_STRICT_MODE: _sinclair_typebox11.TBoolean;
|
|
257
161
|
}>;
|
|
258
162
|
declare module "@alepha/core" {
|
|
259
|
-
|
|
260
|
-
}
|
|
163
|
+
interface Env extends Partial<Static<typeof envSchema$1>> {}
|
|
261
164
|
}
|
|
262
165
|
declare class PageDescriptorProvider {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
166
|
+
protected readonly log: _alepha_core12.Logger;
|
|
167
|
+
protected readonly env: {
|
|
168
|
+
REACT_STRICT_MODE: boolean;
|
|
169
|
+
};
|
|
170
|
+
protected readonly alepha: Alepha;
|
|
171
|
+
protected readonly pages: PageRoute[];
|
|
172
|
+
getPages(): PageRoute[];
|
|
173
|
+
page(name: string): PageRoute;
|
|
174
|
+
url(name: string, options?: {
|
|
175
|
+
params?: Record<string, string>;
|
|
176
|
+
base?: string;
|
|
177
|
+
}): URL;
|
|
178
|
+
root(state: RouterState, context: PageReactContext): ReactNode;
|
|
179
|
+
createLayers(route: PageRoute, request: PageRequest): Promise<CreateLayersResult>;
|
|
180
|
+
protected getErrorHandler(route: PageRoute): ((error: Error) => ReactNode) | undefined;
|
|
181
|
+
protected createElement(page: PageRoute, props: Record<string, any>): Promise<ReactNode>;
|
|
182
|
+
renderError(error: Error): ReactNode;
|
|
183
|
+
renderEmptyView(): ReactNode;
|
|
184
|
+
href(page: {
|
|
185
|
+
options: {
|
|
186
|
+
name?: string;
|
|
266
187
|
};
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
href(page: {
|
|
283
|
-
options: {
|
|
284
|
-
name?: string;
|
|
285
|
-
};
|
|
286
|
-
}, params?: Record<string, any>): string;
|
|
287
|
-
compile(path: string, params?: Record<string, string>): string;
|
|
288
|
-
protected renderView(index: number, path: string, view: ReactNode | undefined, page: PageRoute): ReactNode;
|
|
289
|
-
protected readonly configure: _alepha_core.HookDescriptor<"configure">;
|
|
290
|
-
protected map(pages: Array<{
|
|
291
|
-
value: {
|
|
292
|
-
[OPTIONS]: PageDescriptorOptions;
|
|
293
|
-
};
|
|
294
|
-
}>, target: {
|
|
295
|
-
[OPTIONS]: PageDescriptorOptions;
|
|
296
|
-
}): PageRouteEntry;
|
|
297
|
-
add(entry: PageRouteEntry): void;
|
|
298
|
-
protected createMatch(page: PageRoute): string;
|
|
299
|
-
protected _next: number;
|
|
300
|
-
protected nextId(): string;
|
|
188
|
+
}, params?: Record<string, any>): string;
|
|
189
|
+
compile(path: string, params?: Record<string, string>): string;
|
|
190
|
+
protected renderView(index: number, path: string, view: ReactNode | undefined, page: PageRoute): ReactNode;
|
|
191
|
+
protected readonly configure: _alepha_core12.HookDescriptor<"configure">;
|
|
192
|
+
protected map(pages: Array<{
|
|
193
|
+
value: {
|
|
194
|
+
[OPTIONS]: PageDescriptorOptions;
|
|
195
|
+
};
|
|
196
|
+
}>, target: {
|
|
197
|
+
[OPTIONS]: PageDescriptorOptions;
|
|
198
|
+
}): PageRouteEntry;
|
|
199
|
+
add(entry: PageRouteEntry): void;
|
|
200
|
+
protected createMatch(page: PageRoute): string;
|
|
201
|
+
protected _next: number;
|
|
202
|
+
protected nextId(): string;
|
|
301
203
|
}
|
|
302
204
|
declare const isPageRoute: (it: any) => it is PageRoute;
|
|
303
205
|
interface PageRouteEntry extends Omit<PageDescriptorOptions, "children" | "parent"> {
|
|
304
|
-
|
|
206
|
+
children?: PageRouteEntry[];
|
|
305
207
|
}
|
|
306
208
|
interface PageRoute extends PageRouteEntry {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
209
|
+
type: "page";
|
|
210
|
+
name: string;
|
|
211
|
+
parent?: PageRoute;
|
|
212
|
+
match: string;
|
|
311
213
|
}
|
|
312
214
|
interface Layer {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
215
|
+
config?: {
|
|
216
|
+
query?: Record<string, any>;
|
|
217
|
+
params?: Record<string, any>;
|
|
218
|
+
context?: Record<string, any>;
|
|
219
|
+
};
|
|
220
|
+
name: string;
|
|
221
|
+
props?: Record<string, any>;
|
|
222
|
+
error?: Error;
|
|
223
|
+
part?: string;
|
|
224
|
+
element: ReactNode;
|
|
225
|
+
index: number;
|
|
226
|
+
path: string;
|
|
227
|
+
route?: PageRoute;
|
|
325
228
|
}
|
|
326
229
|
type PreviousLayerData = Omit<Layer, "element" | "index" | "path">;
|
|
327
230
|
interface AnchorProps {
|
|
328
|
-
|
|
329
|
-
|
|
231
|
+
href: string;
|
|
232
|
+
onClick: (ev: any) => any;
|
|
330
233
|
}
|
|
331
234
|
interface RouterState {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
235
|
+
pathname: string;
|
|
236
|
+
search: string;
|
|
237
|
+
layers: Array<Layer>;
|
|
335
238
|
}
|
|
336
239
|
interface TransitionOptions {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
240
|
+
state?: RouterState;
|
|
241
|
+
previous?: PreviousLayerData[];
|
|
242
|
+
context?: PageReactContext;
|
|
340
243
|
}
|
|
341
244
|
interface RouterStackItem {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
245
|
+
route: PageRoute;
|
|
246
|
+
config?: Record<string, any>;
|
|
247
|
+
props?: Record<string, any>;
|
|
248
|
+
error?: Error;
|
|
346
249
|
}
|
|
347
250
|
interface RouterRenderResult {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
251
|
+
state: RouterState;
|
|
252
|
+
context: PageReactContext;
|
|
253
|
+
redirect?: string;
|
|
351
254
|
}
|
|
352
255
|
interface PageRequest extends PageReactContext {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
256
|
+
params: Record<string, any>;
|
|
257
|
+
query: Record<string, string>;
|
|
258
|
+
previous?: PreviousLayerData[];
|
|
356
259
|
}
|
|
357
260
|
interface CreateLayersResult extends RouterState {
|
|
358
|
-
|
|
261
|
+
redirect?: string;
|
|
359
262
|
}
|
|
360
263
|
/**
|
|
361
264
|
* It's like RouterState, but publicly available in React context.
|
|
362
265
|
* This is where we store all plugin data!
|
|
363
266
|
*/
|
|
364
267
|
interface PageReactContext {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
links?: ApiLinksResponse;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
interface Head {
|
|
372
|
-
title?: string;
|
|
373
|
-
htmlAttributes?: Record<string, string>;
|
|
374
|
-
bodyAttributes?: Record<string, string>;
|
|
375
|
-
meta?: Array<{
|
|
376
|
-
name: string;
|
|
377
|
-
content: string;
|
|
378
|
-
}>;
|
|
379
|
-
}
|
|
380
|
-
declare class ServerHeadProvider {
|
|
381
|
-
renderHead(template: string, head: Head): string;
|
|
382
|
-
mergeAttributes(existing: string, attrs: Record<string, string>): string;
|
|
383
|
-
parseAttributes(attrStr: string): Record<string, string>;
|
|
384
|
-
escapeHtml(str: string): string;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
declare class BrowserHeadProvider {
|
|
388
|
-
renderHead(document: Document, head: Head): void;
|
|
268
|
+
url: URL;
|
|
269
|
+
onError: (error: Error) => ReactNode;
|
|
270
|
+
links?: ApiLinksResponse;
|
|
389
271
|
}
|
|
390
|
-
|
|
272
|
+
//#endregion
|
|
273
|
+
//#region src/providers/BrowserRouterProvider.d.ts
|
|
391
274
|
interface BrowserRoute extends Route {
|
|
392
|
-
|
|
275
|
+
page: PageRoute;
|
|
393
276
|
}
|
|
394
277
|
declare class BrowserRouterProvider extends RouterProvider<BrowserRoute> {
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
}
|
|
403
|
-
|
|
278
|
+
protected readonly log: _alepha_core23.Logger;
|
|
279
|
+
protected readonly alepha: Alepha;
|
|
280
|
+
protected readonly pageDescriptorProvider: PageDescriptorProvider;
|
|
281
|
+
add(entry: PageRouteEntry): void;
|
|
282
|
+
protected readonly configure: _alepha_core23.HookDescriptor<"configure">;
|
|
283
|
+
transition(url: URL, options?: TransitionOptions): Promise<RouterRenderResult>;
|
|
284
|
+
root(state: RouterState, context: PageReactContext): ReactNode;
|
|
285
|
+
}
|
|
286
|
+
//#endregion
|
|
287
|
+
//#region src/providers/ReactBrowserProvider.d.ts
|
|
404
288
|
declare class ReactBrowserProvider {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
readonly ready: _alepha_core.HookDescriptor<"ready">;
|
|
429
|
-
readonly onTransitionEnd: _alepha_core.HookDescriptor<"react:transition:end">;
|
|
289
|
+
protected readonly log: _alepha_core16.Logger;
|
|
290
|
+
protected readonly client: LinkProvider;
|
|
291
|
+
protected readonly alepha: Alepha;
|
|
292
|
+
protected readonly router: BrowserRouterProvider;
|
|
293
|
+
protected root: Root;
|
|
294
|
+
transitioning?: {
|
|
295
|
+
to: string;
|
|
296
|
+
};
|
|
297
|
+
state: RouterState;
|
|
298
|
+
get document(): Document;
|
|
299
|
+
get history(): History;
|
|
300
|
+
get url(): string;
|
|
301
|
+
invalidate(props?: Record<string, any>): Promise<void>;
|
|
302
|
+
go(url: string, options?: RouterGoOptions): Promise<void>;
|
|
303
|
+
protected render(options?: {
|
|
304
|
+
url?: string;
|
|
305
|
+
previous?: PreviousLayerData[];
|
|
306
|
+
}): Promise<RouterRenderResult>;
|
|
307
|
+
/**
|
|
308
|
+
* Get embedded layers from the server.
|
|
309
|
+
*/
|
|
310
|
+
protected getHydrationState(): ReactHydrationState | undefined;
|
|
311
|
+
readonly ready: _alepha_core16.HookDescriptor<"ready">;
|
|
430
312
|
}
|
|
431
313
|
interface RouterGoOptions {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
314
|
+
replace?: boolean;
|
|
315
|
+
match?: TransitionOptions;
|
|
316
|
+
params?: Record<string, string>;
|
|
435
317
|
}
|
|
436
318
|
interface ReactHydrationState {
|
|
437
|
-
|
|
438
|
-
|
|
319
|
+
layers?: Array<PreviousLayerData>;
|
|
320
|
+
links?: ApiLinksResponse;
|
|
439
321
|
}
|
|
440
|
-
|
|
322
|
+
//#endregion
|
|
323
|
+
//#region src/components/ErrorBoundary.d.ts
|
|
441
324
|
/**
|
|
442
325
|
* Props for the ErrorBoundary component.
|
|
443
326
|
*/
|
|
444
327
|
interface ErrorBoundaryProps {
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
328
|
+
/**
|
|
329
|
+
* Fallback React node to render when an error is caught.
|
|
330
|
+
* If not provided, a default error message will be shown.
|
|
331
|
+
*/
|
|
332
|
+
fallback: (error: Error) => ReactNode;
|
|
333
|
+
/**
|
|
334
|
+
* Optional callback that receives the error and error info.
|
|
335
|
+
* Use this to log errors to a monitoring service.
|
|
336
|
+
*/
|
|
337
|
+
onError?: (error: Error, info: ErrorInfo) => void;
|
|
455
338
|
}
|
|
456
339
|
/**
|
|
457
340
|
* State of the ErrorBoundary component.
|
|
458
341
|
*/
|
|
459
342
|
interface ErrorBoundaryState {
|
|
460
|
-
|
|
343
|
+
error?: Error;
|
|
461
344
|
}
|
|
462
345
|
/**
|
|
463
346
|
* A reusable error boundary for catching rendering errors
|
|
464
347
|
* in any part of the React component tree.
|
|
465
348
|
*/
|
|
466
|
-
declare class ErrorBoundary extends
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
}
|
|
479
|
-
|
|
349
|
+
declare class ErrorBoundary extends React.Component<PropsWithChildren<ErrorBoundaryProps>, ErrorBoundaryState> {
|
|
350
|
+
constructor(props: ErrorBoundaryProps);
|
|
351
|
+
/**
|
|
352
|
+
* Update state so the next render shows the fallback UI.
|
|
353
|
+
*/
|
|
354
|
+
static getDerivedStateFromError(error: Error): ErrorBoundaryState;
|
|
355
|
+
/**
|
|
356
|
+
* Lifecycle method called when an error is caught.
|
|
357
|
+
* You can log the error or perform side effects here.
|
|
358
|
+
*/
|
|
359
|
+
componentDidCatch(error: Error, info: ErrorInfo): void;
|
|
360
|
+
render(): ReactNode;
|
|
361
|
+
}
|
|
362
|
+
//#endregion
|
|
363
|
+
//#region src/components/Link.d.ts
|
|
480
364
|
interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
481
|
-
|
|
482
|
-
|
|
365
|
+
to: string | PageDescriptor;
|
|
366
|
+
children?: React.ReactNode;
|
|
483
367
|
}
|
|
484
|
-
declare const Link: (props: LinkProps) =>
|
|
485
|
-
|
|
368
|
+
declare const Link: (props: LinkProps) => react_jsx_runtime22.JSX.Element | null;
|
|
369
|
+
//#endregion
|
|
370
|
+
//#region src/components/NestedView.d.ts
|
|
486
371
|
interface NestedViewProps {
|
|
487
|
-
|
|
372
|
+
children?: ReactNode;
|
|
488
373
|
}
|
|
489
374
|
/**
|
|
490
375
|
* A component that renders the current view of the nested router layer.
|
|
@@ -507,201 +392,224 @@ interface NestedViewProps {
|
|
|
507
392
|
* }
|
|
508
393
|
* ```
|
|
509
394
|
*/
|
|
510
|
-
declare const NestedView: (props: NestedViewProps) =>
|
|
511
|
-
|
|
395
|
+
declare const NestedView: (props: NestedViewProps) => react_jsx_runtime21.JSX.Element;
|
|
396
|
+
//#endregion
|
|
397
|
+
//#region src/contexts/RouterContext.d.ts
|
|
512
398
|
interface RouterContextValue {
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
399
|
+
alepha: Alepha;
|
|
400
|
+
state: RouterState;
|
|
401
|
+
context: PageReactContext;
|
|
516
402
|
}
|
|
517
|
-
declare const RouterContext:
|
|
518
|
-
|
|
403
|
+
declare const RouterContext: react19.Context<RouterContextValue | undefined>;
|
|
404
|
+
//#endregion
|
|
405
|
+
//#region src/contexts/RouterLayerContext.d.ts
|
|
519
406
|
interface RouterLayerContextValue {
|
|
520
|
-
|
|
521
|
-
|
|
407
|
+
index: number;
|
|
408
|
+
path: string;
|
|
522
409
|
}
|
|
523
|
-
declare const RouterLayerContext:
|
|
524
|
-
|
|
410
|
+
declare const RouterLayerContext: react20.Context<RouterLayerContextValue | undefined>;
|
|
411
|
+
//#endregion
|
|
412
|
+
//#region src/hooks/RouterHookApi.d.ts
|
|
525
413
|
declare class RouterHookApi {
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
414
|
+
private readonly pages;
|
|
415
|
+
private readonly state;
|
|
416
|
+
private readonly layer;
|
|
417
|
+
private readonly browser?;
|
|
418
|
+
constructor(pages: PageRoute[], state: RouterState, layer: {
|
|
419
|
+
path: string;
|
|
420
|
+
}, browser?: ReactBrowserProvider | undefined);
|
|
421
|
+
get current(): RouterState;
|
|
422
|
+
get pathname(): string;
|
|
423
|
+
get query(): Record<string, string>;
|
|
424
|
+
back(): Promise<void>;
|
|
425
|
+
forward(): Promise<void>;
|
|
426
|
+
invalidate(props?: Record<string, any>): Promise<void>;
|
|
427
|
+
/**
|
|
428
|
+
* Create a valid href for the given pathname.
|
|
429
|
+
*
|
|
430
|
+
* @param pathname
|
|
431
|
+
* @param layer
|
|
432
|
+
*/
|
|
433
|
+
createHref(pathname: HrefLike, layer?: {
|
|
434
|
+
path: string;
|
|
435
|
+
}, options?: {
|
|
436
|
+
params?: Record<string, any>;
|
|
437
|
+
}): string;
|
|
438
|
+
go(path: string, options?: RouterGoOptions): Promise<void>;
|
|
439
|
+
go<T extends object>(path: keyof VirtualRouter<T>, options?: RouterGoOptions): Promise<void>;
|
|
440
|
+
anchor(path: string, options?: {
|
|
441
|
+
params?: Record<string, any>;
|
|
442
|
+
}): AnchorProps;
|
|
443
|
+
anchor<T extends object>(path: keyof VirtualRouter<T>, options?: {
|
|
444
|
+
params?: Record<string, any>;
|
|
445
|
+
}): AnchorProps;
|
|
446
|
+
/**
|
|
447
|
+
* Set query params.
|
|
448
|
+
*
|
|
449
|
+
* @param record
|
|
450
|
+
* @param options
|
|
451
|
+
*/
|
|
452
|
+
setQueryParams(record: Record<string, any> | ((queryParams: Record<string, any>) => Record<string, any>), options?: {
|
|
558
453
|
/**
|
|
559
|
-
*
|
|
560
|
-
*
|
|
561
|
-
* @param record
|
|
562
|
-
* @param options
|
|
454
|
+
* If true, this will add a new entry to the history stack.
|
|
563
455
|
*/
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
* If true, this will add a new entry to the history stack.
|
|
567
|
-
*/
|
|
568
|
-
push?: boolean;
|
|
569
|
-
}): void;
|
|
456
|
+
push?: boolean;
|
|
457
|
+
}): void;
|
|
570
458
|
}
|
|
571
459
|
type HrefLike = string | {
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
};
|
|
577
|
-
type VirtualRouter<T> = {
|
|
578
|
-
[K in keyof T as T[K] extends PageDescriptor ? K : never]: T[K];
|
|
460
|
+
options: {
|
|
461
|
+
path?: string;
|
|
462
|
+
name?: string;
|
|
463
|
+
};
|
|
579
464
|
};
|
|
580
|
-
|
|
465
|
+
type VirtualRouter<T> = { [K in keyof T as T[K] extends PageDescriptor ? K : never]: T[K] };
|
|
466
|
+
//#endregion
|
|
467
|
+
//#region src/errors/RedirectionError.d.ts
|
|
581
468
|
declare class RedirectionError extends Error {
|
|
582
|
-
|
|
583
|
-
|
|
469
|
+
readonly page: HrefLike;
|
|
470
|
+
constructor(page: HrefLike);
|
|
584
471
|
}
|
|
585
|
-
|
|
472
|
+
//#endregion
|
|
473
|
+
//#region src/hooks/useActive.d.ts
|
|
586
474
|
declare const useActive: (path: HrefLike) => UseActiveHook;
|
|
587
475
|
interface UseActiveHook {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
476
|
+
isActive: boolean;
|
|
477
|
+
anchorProps: AnchorProps;
|
|
478
|
+
isPending: boolean;
|
|
479
|
+
name?: string;
|
|
592
480
|
}
|
|
593
|
-
|
|
481
|
+
//#endregion
|
|
482
|
+
//#region src/hooks/useAlepha.d.ts
|
|
594
483
|
declare const useAlepha: () => Alepha;
|
|
595
|
-
|
|
484
|
+
//#endregion
|
|
485
|
+
//#region src/hooks/useClient.d.ts
|
|
596
486
|
declare const useClient: <T extends object>(_scope?: ClientScope) => HttpVirtualClient<T>;
|
|
597
|
-
|
|
487
|
+
//#endregion
|
|
488
|
+
//#region src/hooks/useInject.d.ts
|
|
598
489
|
declare const useInject: <T extends object>(clazz: Service<T>) => T;
|
|
599
|
-
|
|
490
|
+
//#endregion
|
|
491
|
+
//#region src/hooks/useQueryParams.d.ts
|
|
600
492
|
interface UseQueryParamsHookOptions {
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
493
|
+
format?: "base64" | "querystring";
|
|
494
|
+
key?: string;
|
|
495
|
+
push?: boolean;
|
|
604
496
|
}
|
|
605
497
|
declare const useQueryParams: <T extends TObject>(schema: T, options?: UseQueryParamsHookOptions) => [Static<T>, (data: Static<T>) => void];
|
|
606
|
-
|
|
498
|
+
//#endregion
|
|
499
|
+
//#region src/hooks/useRouter.d.ts
|
|
607
500
|
declare const useRouter: () => RouterHookApi;
|
|
608
|
-
|
|
501
|
+
//#endregion
|
|
502
|
+
//#region src/hooks/useRouterEvents.d.ts
|
|
609
503
|
declare const useRouterEvents: (opts?: {
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
504
|
+
onBegin?: (ev: {
|
|
505
|
+
state: RouterState;
|
|
506
|
+
}) => void;
|
|
507
|
+
onEnd?: (ev: {
|
|
508
|
+
state: RouterState;
|
|
509
|
+
}) => void;
|
|
510
|
+
onError?: (ev: {
|
|
511
|
+
state: RouterState;
|
|
512
|
+
error: Error;
|
|
513
|
+
}) => void;
|
|
620
514
|
}, deps?: any[]) => void;
|
|
621
|
-
|
|
515
|
+
//#endregion
|
|
516
|
+
//#region src/hooks/useRouterState.d.ts
|
|
622
517
|
declare const useRouterState: () => RouterState;
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
518
|
+
//#endregion
|
|
519
|
+
//#region src/providers/ReactServerProvider.d.ts
|
|
520
|
+
declare const envSchema: _alepha_core6.TObject<{
|
|
521
|
+
REACT_SERVER_DIST: _sinclair_typebox1.TString;
|
|
522
|
+
REACT_SERVER_PREFIX: _sinclair_typebox1.TString;
|
|
523
|
+
REACT_SSR_ENABLED: _sinclair_typebox1.TOptional<_sinclair_typebox1.TBoolean>;
|
|
524
|
+
REACT_ROOT_ID: _sinclair_typebox1.TString;
|
|
629
525
|
}>;
|
|
630
526
|
declare module "@alepha/core" {
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
}
|
|
527
|
+
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
528
|
+
interface State {
|
|
529
|
+
"ReactServerProvider.template"?: string;
|
|
530
|
+
"ReactServerProvider.ssr"?: boolean;
|
|
531
|
+
}
|
|
637
532
|
}
|
|
638
533
|
declare class ReactServerProvider {
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
534
|
+
protected readonly log: _alepha_core6.Logger;
|
|
535
|
+
protected readonly alepha: Alepha;
|
|
536
|
+
protected readonly pageDescriptorProvider: PageDescriptorProvider;
|
|
537
|
+
protected readonly serverStaticProvider: ServerStaticProvider;
|
|
538
|
+
protected readonly serverRouterProvider: ServerRouterProvider;
|
|
539
|
+
protected readonly serverTimingProvider: ServerTimingProvider;
|
|
540
|
+
protected readonly env: {
|
|
541
|
+
REACT_SSR_ENABLED?: boolean | undefined;
|
|
542
|
+
REACT_SERVER_DIST: string;
|
|
543
|
+
REACT_SERVER_PREFIX: string;
|
|
544
|
+
REACT_ROOT_ID: string;
|
|
545
|
+
};
|
|
546
|
+
protected readonly ROOT_DIV_REGEX: RegExp;
|
|
547
|
+
readonly onConfigure: _alepha_core6.HookDescriptor<"configure">;
|
|
548
|
+
get template(): string;
|
|
549
|
+
protected registerPages(templateLoader: TemplateLoader): Promise<void>;
|
|
550
|
+
protected getPublicDirectory(): string;
|
|
551
|
+
protected configureStaticServer(root: string): Promise<void>;
|
|
552
|
+
protected configureVite(ssrEnabled: boolean): Promise<void>;
|
|
553
|
+
/**
|
|
554
|
+
* For testing purposes, creates a render function that can be used.
|
|
555
|
+
*/
|
|
556
|
+
protected createRenderFunction(name: string, withIndex?: boolean): (options?: PageDescriptorRenderOptions) => Promise<{
|
|
557
|
+
context: PageRequest;
|
|
558
|
+
state: CreateLayersResult;
|
|
559
|
+
html: string;
|
|
560
|
+
} | {
|
|
561
|
+
context: PageRequest;
|
|
562
|
+
html: string;
|
|
563
|
+
}>;
|
|
564
|
+
protected createHandler(page: PageRoute, templateLoader: TemplateLoader): ServerHandler;
|
|
565
|
+
renderToHtml(template: string, state: RouterState, context: PageReactContext, hydration?: boolean): string;
|
|
566
|
+
protected fillTemplate(response: {
|
|
567
|
+
html: string;
|
|
568
|
+
}, app: string, script: string): void;
|
|
674
569
|
}
|
|
675
570
|
type TemplateLoader = () => Promise<string | undefined>;
|
|
676
|
-
|
|
571
|
+
//#endregion
|
|
572
|
+
//#region src/index.d.ts
|
|
677
573
|
declare module "@alepha/core" {
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
574
|
+
interface Hooks {
|
|
575
|
+
"react:router:createLayers": {
|
|
576
|
+
request: ServerRequest;
|
|
577
|
+
context: PageRequest;
|
|
578
|
+
layers: PageRequest[];
|
|
579
|
+
};
|
|
580
|
+
"react:server:render:begin": {
|
|
581
|
+
request?: ServerRequest;
|
|
582
|
+
context: PageRequest;
|
|
583
|
+
};
|
|
584
|
+
"react:server:render:end": {
|
|
585
|
+
request?: ServerRequest;
|
|
586
|
+
context: PageRequest;
|
|
587
|
+
state: RouterState;
|
|
588
|
+
html: string;
|
|
589
|
+
};
|
|
590
|
+
"react:browser:render": {
|
|
591
|
+
state: RouterState;
|
|
592
|
+
context: PageReactContext;
|
|
593
|
+
hydration?: ReactHydrationState;
|
|
594
|
+
};
|
|
595
|
+
"react:transition:begin": {
|
|
596
|
+
state: RouterState;
|
|
597
|
+
context: PageReactContext;
|
|
598
|
+
};
|
|
599
|
+
"react:transition:success": {
|
|
600
|
+
state: RouterState;
|
|
601
|
+
context: PageReactContext;
|
|
602
|
+
};
|
|
603
|
+
"react:transition:error": {
|
|
604
|
+
error: Error;
|
|
605
|
+
state: RouterState;
|
|
606
|
+
context: PageReactContext;
|
|
607
|
+
};
|
|
608
|
+
"react:transition:end": {
|
|
609
|
+
state: RouterState;
|
|
610
|
+
context: PageReactContext;
|
|
611
|
+
};
|
|
612
|
+
}
|
|
705
613
|
}
|
|
706
614
|
/**
|
|
707
615
|
* Alepha React Module
|
|
@@ -713,8 +621,9 @@ declare module "@alepha/core" {
|
|
|
713
621
|
* @module alepha.react
|
|
714
622
|
*/
|
|
715
623
|
declare class AlephaReact implements Module {
|
|
716
|
-
|
|
717
|
-
|
|
624
|
+
readonly name = "alepha.react";
|
|
625
|
+
readonly $services: (alepha: Alepha) => Alepha;
|
|
718
626
|
}
|
|
719
|
-
|
|
720
|
-
export { $page, AlephaReact,
|
|
627
|
+
//#endregion
|
|
628
|
+
export { $page, AlephaReact, AnchorProps, ClientOnly, CreateLayersResult, ErrorBoundary, HrefLike, Layer, Link, NestedView, PageConfigSchema, PageDescriptor, PageDescriptorOptions, PageDescriptorProvider, PageDescriptorRenderOptions, PageDescriptorRenderResult, PageReactContext, PageRequest, PageRequestConfig, PageResolve, PageRoute, PageRouteEntry, PreviousLayerData, ReactBrowserProvider, ReactHydrationState, ReactServerProvider, RedirectionError, RouterContext, RouterContextValue, RouterGoOptions, RouterHookApi, RouterLayerContext, RouterLayerContextValue, RouterRenderResult, RouterStackItem, RouterState, TPropsDefault, TPropsParentDefault, TransitionOptions, UseActiveHook, UseQueryParamsHookOptions, VirtualRouter, isPageRoute, useActive, useAlepha, useClient, useInject, useQueryParams, useRouter, useRouterEvents, useRouterState };
|
|
629
|
+
//# sourceMappingURL=index.d.ts.map
|