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