@alepha/react 0.7.4 → 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 +1333 -571
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +678 -0
- package/dist/index.d.ts +530 -570
- package/dist/index.js +1297 -557
- package/dist/index.js.map +1 -0
- package/package.json +11 -8
- package/src/components/NotFound.tsx +0 -10
- package/src/descriptors/$page.ts +5 -2
- package/src/index.browser.ts +1 -0
- package/src/index.shared.ts +0 -4
- package/src/index.ts +0 -2
- package/dist/ReactBrowserProvider-CXDElhnK.cjs +0 -960
- package/dist/ReactBrowserProvider-ufHSOTmv.js +0 -946
- package/dist/index.browser.cjs +0 -58
package/dist/index.d.ts
CHANGED
|
@@ -1,86 +1,25 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import * as
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import * as
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
declare const Kind: unique symbol;
|
|
19
|
-
|
|
20
|
-
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);
|
|
21
|
-
type StringContentEncodingOption = '7bit' | '8bit' | 'binary' | 'quoted-printable' | 'base64' | ({} & string);
|
|
22
|
-
interface StringOptions extends SchemaOptions {
|
|
23
|
-
/** The maximum string length */
|
|
24
|
-
maxLength?: number;
|
|
25
|
-
/** The minimum string length */
|
|
26
|
-
minLength?: number;
|
|
27
|
-
/** A regular expression pattern this string should match */
|
|
28
|
-
pattern?: string;
|
|
29
|
-
/** A format this string should match */
|
|
30
|
-
format?: StringFormatOption;
|
|
31
|
-
/** The content encoding for this string */
|
|
32
|
-
contentEncoding?: StringContentEncodingOption;
|
|
33
|
-
/** The content media type for this string */
|
|
34
|
-
contentMediaType?: string;
|
|
35
|
-
}
|
|
36
|
-
interface TString extends TSchema, StringOptions {
|
|
37
|
-
[Kind]: 'String';
|
|
38
|
-
static: string;
|
|
39
|
-
type: 'string';
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
interface TBoolean extends TSchema {
|
|
43
|
-
[Kind]: 'Boolean';
|
|
44
|
-
static: boolean;
|
|
45
|
-
type: 'boolean';
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
type TOptional<T extends TSchema> = T & {
|
|
49
|
-
[OptionalKind]: 'Optional';
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
interface SchemaOptions {
|
|
53
|
-
$schema?: string;
|
|
54
|
-
/** Id for this schema */
|
|
55
|
-
$id?: string;
|
|
56
|
-
/** Title of this schema */
|
|
57
|
-
title?: string;
|
|
58
|
-
/** Description of this schema */
|
|
59
|
-
description?: string;
|
|
60
|
-
/** Default value for this schema */
|
|
61
|
-
default?: any;
|
|
62
|
-
/** Example values matching this schema */
|
|
63
|
-
examples?: any;
|
|
64
|
-
/** Optional annotation for readOnly */
|
|
65
|
-
readOnly?: boolean;
|
|
66
|
-
/** Optional annotation for writeOnly */
|
|
67
|
-
writeOnly?: boolean;
|
|
68
|
-
[prop: string]: any;
|
|
69
|
-
}
|
|
70
|
-
interface TKind {
|
|
71
|
-
[Kind]: string;
|
|
72
|
-
}
|
|
73
|
-
interface TSchema extends TKind, SchemaOptions {
|
|
74
|
-
[ReadonlyKind]?: string;
|
|
75
|
-
[OptionalKind]?: string;
|
|
76
|
-
[Hint]?: string;
|
|
77
|
-
params: unknown[];
|
|
78
|
-
static: unknown;
|
|
79
|
-
}
|
|
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";
|
|
80
18
|
|
|
19
|
+
//#region src/components/ClientOnly.d.ts
|
|
81
20
|
interface ClientOnlyProps {
|
|
82
|
-
|
|
83
|
-
|
|
21
|
+
fallback?: ReactNode;
|
|
22
|
+
disabled?: boolean;
|
|
84
23
|
}
|
|
85
24
|
/**
|
|
86
25
|
* A small utility component that renders its children only on the client side.
|
|
@@ -93,351 +32,405 @@ interface ClientOnlyProps {
|
|
|
93
32
|
* - you want to prevent pre-rendering of a component
|
|
94
33
|
*/
|
|
95
34
|
declare const ClientOnly: (props: PropsWithChildren<ClientOnlyProps>) => ReactNode;
|
|
96
|
-
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/descriptors/$page.d.ts
|
|
97
37
|
declare const KEY = "PAGE";
|
|
98
38
|
interface PageConfigSchema {
|
|
99
|
-
|
|
100
|
-
|
|
39
|
+
query?: TSchema;
|
|
40
|
+
params?: TSchema;
|
|
101
41
|
}
|
|
102
42
|
type TPropsDefault = any;
|
|
103
43
|
type TPropsParentDefault = {};
|
|
104
|
-
interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault>
|
|
105
|
-
|
|
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
|
-
|
|
44
|
+
interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> {
|
|
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;
|
|
184
125
|
}
|
|
185
126
|
interface PageDescriptor<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
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>;
|
|
193
134
|
}
|
|
194
135
|
/**
|
|
195
136
|
* Main descriptor for defining a React route in the application.
|
|
196
137
|
*/
|
|
197
138
|
declare const $page: {
|
|
198
|
-
|
|
199
|
-
|
|
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;
|
|
200
141
|
};
|
|
201
142
|
interface PageDescriptorRenderOptions {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
143
|
+
params?: Record<string, string>;
|
|
144
|
+
query?: Record<string, string>;
|
|
145
|
+
withLayout?: boolean;
|
|
205
146
|
}
|
|
206
147
|
interface PageDescriptorRenderResult {
|
|
207
|
-
|
|
208
|
-
|
|
148
|
+
html: string;
|
|
149
|
+
context: PageReactContext;
|
|
209
150
|
}
|
|
210
|
-
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?: {
|
|
211
174
|
title?: string;
|
|
212
175
|
description?: string;
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
viewport?: string | {
|
|
225
|
-
width?: string;
|
|
226
|
-
height?: string;
|
|
227
|
-
initialScale?: string;
|
|
228
|
-
maximumScale?: string;
|
|
229
|
-
userScalable?: "no" | "yes" | "0" | "1";
|
|
230
|
-
interactiveWidget?: "resizes-visual" | "resizes-content" | "overlays-content";
|
|
231
|
-
};
|
|
232
|
-
og?: {
|
|
233
|
-
title?: string;
|
|
234
|
-
description?: string;
|
|
235
|
-
image?: string;
|
|
236
|
-
url?: string;
|
|
237
|
-
type?: string;
|
|
238
|
-
};
|
|
239
|
-
twitter?: {
|
|
240
|
-
card?: string;
|
|
241
|
-
title?: string;
|
|
242
|
-
description?: string;
|
|
243
|
-
image?: string;
|
|
244
|
-
site?: string;
|
|
245
|
-
};
|
|
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
|
+
};
|
|
246
187
|
}
|
|
247
188
|
interface PageRequestConfig<TConfig extends PageConfigSchema = PageConfigSchema> {
|
|
248
|
-
|
|
249
|
-
|
|
189
|
+
params: TConfig["params"] extends TSchema ? Static<TConfig["params"]> : Record<string, string>;
|
|
190
|
+
query: TConfig["query"] extends TSchema ? Static<TConfig["query"]> : Record<string, string>;
|
|
250
191
|
}
|
|
251
192
|
type PageResolve<TConfig extends PageConfigSchema = PageConfigSchema, TPropsParent extends object = TPropsParentDefault> = PageRequestConfig<TConfig> & TPropsParent & PageReactContext;
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region src/providers/PageDescriptorProvider.d.ts
|
|
195
|
+
declare const envSchema$1: _alepha_core2.TObject<{
|
|
196
|
+
REACT_STRICT_MODE: _sinclair_typebox1.TBoolean;
|
|
255
197
|
}>;
|
|
256
198
|
declare module "@alepha/core" {
|
|
257
|
-
|
|
258
|
-
}
|
|
199
|
+
interface Env extends Partial<Static<typeof envSchema$1>> {}
|
|
259
200
|
}
|
|
260
201
|
declare class PageDescriptorProvider {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
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;
|
|
264
232
|
};
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}): URL;
|
|
273
|
-
root(state: RouterState, context: PageReactContext): ReactNode;
|
|
274
|
-
createLayers(route: PageRoute, request: PageRequest): Promise<CreateLayersResult>;
|
|
275
|
-
protected getErrorHandler(route: PageRoute): ((error: Error) => ReactNode) | undefined;
|
|
276
|
-
protected createElement(page: PageRoute, props: Record<string, any>): Promise<ReactNode>;
|
|
277
|
-
protected fillHead(page: PageRoute, ctx: PageRequest, props: Record<string, any>): void;
|
|
278
|
-
renderError(error: Error): ReactNode;
|
|
279
|
-
renderEmptyView(): ReactNode;
|
|
280
|
-
href(page: {
|
|
281
|
-
options: {
|
|
282
|
-
name?: string;
|
|
283
|
-
};
|
|
284
|
-
}, params?: Record<string, any>): string;
|
|
285
|
-
compile(path: string, params?: Record<string, string>): string;
|
|
286
|
-
protected renderView(index: number, path: string, view: ReactNode | undefined, page: PageRoute): ReactNode;
|
|
287
|
-
protected readonly configure: _alepha_core.HookDescriptor<"configure">;
|
|
288
|
-
protected map(pages: Array<{
|
|
289
|
-
value: {
|
|
290
|
-
[OPTIONS]: PageDescriptorOptions;
|
|
291
|
-
};
|
|
292
|
-
}>, target: {
|
|
293
|
-
[OPTIONS]: PageDescriptorOptions;
|
|
294
|
-
}): PageRouteEntry;
|
|
295
|
-
add(entry: PageRouteEntry): void;
|
|
296
|
-
protected createMatch(page: PageRoute): string;
|
|
297
|
-
protected _next: number;
|
|
298
|
-
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;
|
|
299
240
|
}
|
|
300
241
|
declare const isPageRoute: (it: any) => it is PageRoute;
|
|
301
242
|
interface PageRouteEntry extends Omit<PageDescriptorOptions, "children" | "parent"> {
|
|
302
|
-
|
|
243
|
+
children?: PageRouteEntry[];
|
|
303
244
|
}
|
|
304
245
|
interface PageRoute extends PageRouteEntry {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
246
|
+
type: "page";
|
|
247
|
+
name: string;
|
|
248
|
+
parent?: PageRoute;
|
|
249
|
+
match: string;
|
|
309
250
|
}
|
|
310
251
|
interface Layer {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
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;
|
|
323
264
|
}
|
|
324
265
|
type PreviousLayerData = Omit<Layer, "element" | "index" | "path">;
|
|
325
266
|
interface AnchorProps {
|
|
326
|
-
|
|
327
|
-
|
|
267
|
+
href: string;
|
|
268
|
+
onClick: (ev: any) => any;
|
|
328
269
|
}
|
|
329
270
|
interface RouterState {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
271
|
+
pathname: string;
|
|
272
|
+
search: string;
|
|
273
|
+
layers: Array<Layer>;
|
|
333
274
|
}
|
|
334
275
|
interface TransitionOptions {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
276
|
+
state?: RouterState;
|
|
277
|
+
previous?: PreviousLayerData[];
|
|
278
|
+
context?: PageReactContext;
|
|
338
279
|
}
|
|
339
280
|
interface RouterStackItem {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
281
|
+
route: PageRoute;
|
|
282
|
+
config?: Record<string, any>;
|
|
283
|
+
props?: Record<string, any>;
|
|
284
|
+
error?: Error;
|
|
344
285
|
}
|
|
345
286
|
interface RouterRenderResult {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
287
|
+
state: RouterState;
|
|
288
|
+
context: PageReactContext;
|
|
289
|
+
redirect?: string;
|
|
349
290
|
}
|
|
350
291
|
interface PageRequest extends PageReactContext {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
292
|
+
params: Record<string, any>;
|
|
293
|
+
query: Record<string, string>;
|
|
294
|
+
previous?: PreviousLayerData[];
|
|
354
295
|
}
|
|
355
296
|
interface CreateLayersResult extends RouterState {
|
|
356
|
-
|
|
297
|
+
redirect?: string;
|
|
357
298
|
}
|
|
358
299
|
/**
|
|
359
300
|
* It's like RouterState, but publicly available in React context.
|
|
360
301
|
* This is where we store all plugin data!
|
|
361
302
|
*/
|
|
362
303
|
interface PageReactContext {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
304
|
+
url: URL;
|
|
305
|
+
head: Head;
|
|
306
|
+
onError: (error: Error) => ReactNode;
|
|
307
|
+
links?: ApiLinksResponse;
|
|
367
308
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
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
|
+
}>;
|
|
377
319
|
}
|
|
378
320
|
declare class ServerHeadProvider {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
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;
|
|
383
325
|
}
|
|
384
|
-
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region src/providers/BrowserHeadProvider.d.ts
|
|
385
328
|
declare class BrowserHeadProvider {
|
|
386
|
-
|
|
329
|
+
renderHead(document: Document, head: Head$1): void;
|
|
387
330
|
}
|
|
388
|
-
|
|
331
|
+
//#endregion
|
|
332
|
+
//#region src/providers/BrowserRouterProvider.d.ts
|
|
389
333
|
interface BrowserRoute extends Route {
|
|
390
|
-
|
|
334
|
+
page: PageRoute;
|
|
391
335
|
}
|
|
392
336
|
declare class BrowserRouterProvider extends RouterProvider<BrowserRoute> {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
}
|
|
401
|
-
|
|
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
|
|
402
347
|
declare class ReactBrowserProvider {
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
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">;
|
|
428
373
|
}
|
|
429
374
|
interface RouterGoOptions {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
375
|
+
replace?: boolean;
|
|
376
|
+
match?: TransitionOptions;
|
|
377
|
+
params?: Record<string, string>;
|
|
433
378
|
}
|
|
434
379
|
interface ReactHydrationState {
|
|
435
|
-
|
|
436
|
-
|
|
380
|
+
layers?: Array<PreviousLayerData>;
|
|
381
|
+
links?: ApiLinksResponse;
|
|
437
382
|
}
|
|
438
|
-
|
|
383
|
+
//#endregion
|
|
384
|
+
//#region src/components/ErrorBoundary.d.ts
|
|
385
|
+
/**
|
|
386
|
+
* Props for the ErrorBoundary component.
|
|
387
|
+
*/
|
|
388
|
+
interface ErrorBoundaryProps {
|
|
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;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* State of the ErrorBoundary component.
|
|
402
|
+
*/
|
|
403
|
+
interface ErrorBoundaryState {
|
|
404
|
+
error?: Error;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* A reusable error boundary for catching rendering errors
|
|
408
|
+
* in any part of the React component tree.
|
|
409
|
+
*/
|
|
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
|
|
425
|
+
interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
426
|
+
to: string | PageDescriptor;
|
|
427
|
+
children?: React.ReactNode;
|
|
428
|
+
}
|
|
429
|
+
declare const Link: (props: LinkProps) => react_jsx_runtime20.JSX.Element | null;
|
|
430
|
+
//#endregion
|
|
431
|
+
//#region src/components/NestedView.d.ts
|
|
439
432
|
interface NestedViewProps {
|
|
440
|
-
|
|
433
|
+
children?: ReactNode;
|
|
441
434
|
}
|
|
442
435
|
/**
|
|
443
436
|
* A component that renders the current view of the nested router layer.
|
|
@@ -460,246 +453,212 @@ interface NestedViewProps {
|
|
|
460
453
|
* }
|
|
461
454
|
* ```
|
|
462
455
|
*/
|
|
463
|
-
declare const NestedView: (props: NestedViewProps) =>
|
|
464
|
-
|
|
456
|
+
declare const NestedView: (props: NestedViewProps) => react_jsx_runtime22.JSX.Element;
|
|
457
|
+
//#endregion
|
|
458
|
+
//#region src/contexts/RouterContext.d.ts
|
|
459
|
+
interface RouterContextValue {
|
|
460
|
+
alepha: Alepha;
|
|
461
|
+
state: RouterState;
|
|
462
|
+
context: PageReactContext;
|
|
463
|
+
}
|
|
464
|
+
declare const RouterContext: react18.Context<RouterContextValue | undefined>;
|
|
465
|
+
//#endregion
|
|
466
|
+
//#region src/contexts/RouterLayerContext.d.ts
|
|
467
|
+
interface RouterLayerContextValue {
|
|
468
|
+
index: number;
|
|
469
|
+
path: string;
|
|
470
|
+
}
|
|
471
|
+
declare const RouterLayerContext: react21.Context<RouterLayerContextValue | undefined>;
|
|
472
|
+
//#endregion
|
|
473
|
+
//#region src/hooks/RouterHookApi.d.ts
|
|
465
474
|
declare class RouterHookApi {
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
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?: {
|
|
498
514
|
/**
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
* @param record
|
|
502
|
-
* @param options
|
|
515
|
+
* If true, this will add a new entry to the history stack.
|
|
503
516
|
*/
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
* If true, this will add a new entry to the history stack.
|
|
507
|
-
*/
|
|
508
|
-
push?: boolean;
|
|
509
|
-
}): void;
|
|
517
|
+
push?: boolean;
|
|
518
|
+
}): void;
|
|
510
519
|
}
|
|
511
520
|
type HrefLike = string | {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
};
|
|
517
|
-
type VirtualRouter<T> = {
|
|
518
|
-
[K in keyof T as T[K] extends PageDescriptor ? K : never]: T[K];
|
|
521
|
+
options: {
|
|
522
|
+
path?: string;
|
|
523
|
+
name?: string;
|
|
524
|
+
};
|
|
519
525
|
};
|
|
520
|
-
|
|
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
|
|
521
529
|
declare class RedirectionError extends Error {
|
|
522
|
-
|
|
523
|
-
|
|
530
|
+
readonly page: HrefLike;
|
|
531
|
+
constructor(page: HrefLike);
|
|
524
532
|
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
* Props for the ErrorBoundary component.
|
|
528
|
-
*/
|
|
529
|
-
interface ErrorBoundaryProps {
|
|
530
|
-
/**
|
|
531
|
-
* Fallback React node to render when an error is caught.
|
|
532
|
-
* If not provided, a default error message will be shown.
|
|
533
|
-
*/
|
|
534
|
-
fallback: (error: Error) => ReactNode;
|
|
535
|
-
/**
|
|
536
|
-
* Optional callback that receives the error and error info.
|
|
537
|
-
* Use this to log errors to a monitoring service.
|
|
538
|
-
*/
|
|
539
|
-
onError?: (error: Error, info: ErrorInfo) => void;
|
|
540
|
-
}
|
|
541
|
-
/**
|
|
542
|
-
* State of the ErrorBoundary component.
|
|
543
|
-
*/
|
|
544
|
-
interface ErrorBoundaryState {
|
|
545
|
-
error?: Error;
|
|
546
|
-
}
|
|
547
|
-
/**
|
|
548
|
-
* A reusable error boundary for catching rendering errors
|
|
549
|
-
* in any part of the React component tree.
|
|
550
|
-
*/
|
|
551
|
-
declare class ErrorBoundary extends React__default.Component<PropsWithChildren<ErrorBoundaryProps>, ErrorBoundaryState> {
|
|
552
|
-
constructor(props: ErrorBoundaryProps);
|
|
553
|
-
/**
|
|
554
|
-
* Update state so the next render shows the fallback UI.
|
|
555
|
-
*/
|
|
556
|
-
static getDerivedStateFromError(error: Error): ErrorBoundaryState;
|
|
557
|
-
/**
|
|
558
|
-
* Lifecycle method called when an error is caught.
|
|
559
|
-
* You can log the error or perform side effects here.
|
|
560
|
-
*/
|
|
561
|
-
componentDidCatch(error: Error, info: ErrorInfo): void;
|
|
562
|
-
render(): ReactNode;
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
566
|
-
to: string | PageDescriptor;
|
|
567
|
-
children?: React__default.ReactNode;
|
|
568
|
-
}
|
|
569
|
-
declare const Link: (props: LinkProps) => react_jsx_runtime.JSX.Element | null;
|
|
570
|
-
|
|
571
|
-
interface RouterContextValue {
|
|
572
|
-
alepha: Alepha;
|
|
573
|
-
state: RouterState;
|
|
574
|
-
context: PageReactContext;
|
|
575
|
-
}
|
|
576
|
-
declare const RouterContext: React.Context<RouterContextValue | undefined>;
|
|
577
|
-
|
|
578
|
-
interface RouterLayerContextValue {
|
|
579
|
-
index: number;
|
|
580
|
-
path: string;
|
|
581
|
-
}
|
|
582
|
-
declare const RouterLayerContext: React.Context<RouterLayerContextValue | undefined>;
|
|
583
|
-
|
|
533
|
+
//#endregion
|
|
534
|
+
//#region src/hooks/useActive.d.ts
|
|
584
535
|
declare const useActive: (path: HrefLike) => UseActiveHook;
|
|
585
536
|
interface UseActiveHook {
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
537
|
+
isActive: boolean;
|
|
538
|
+
anchorProps: AnchorProps;
|
|
539
|
+
isPending: boolean;
|
|
540
|
+
name?: string;
|
|
590
541
|
}
|
|
591
|
-
|
|
542
|
+
//#endregion
|
|
543
|
+
//#region src/hooks/useAlepha.d.ts
|
|
592
544
|
declare const useAlepha: () => Alepha;
|
|
593
|
-
|
|
545
|
+
//#endregion
|
|
546
|
+
//#region src/hooks/useClient.d.ts
|
|
594
547
|
declare const useClient: <T extends object>(_scope?: ClientScope) => HttpVirtualClient<T>;
|
|
595
|
-
|
|
548
|
+
//#endregion
|
|
549
|
+
//#region src/hooks/useInject.d.ts
|
|
596
550
|
declare const useInject: <T extends object>(clazz: Service<T>) => T;
|
|
597
|
-
|
|
551
|
+
//#endregion
|
|
552
|
+
//#region src/hooks/useQueryParams.d.ts
|
|
598
553
|
interface UseQueryParamsHookOptions {
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
554
|
+
format?: "base64" | "querystring";
|
|
555
|
+
key?: string;
|
|
556
|
+
push?: boolean;
|
|
602
557
|
}
|
|
603
558
|
declare const useQueryParams: <T extends TObject>(schema: T, options?: UseQueryParamsHookOptions) => [Static<T>, (data: Static<T>) => void];
|
|
604
|
-
|
|
559
|
+
//#endregion
|
|
560
|
+
//#region src/hooks/useRouter.d.ts
|
|
605
561
|
declare const useRouter: () => RouterHookApi;
|
|
606
|
-
|
|
562
|
+
//#endregion
|
|
563
|
+
//#region src/hooks/useRouterEvents.d.ts
|
|
607
564
|
declare const useRouterEvents: (opts?: {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
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;
|
|
618
575
|
}, deps?: any[]) => void;
|
|
619
|
-
|
|
576
|
+
//#endregion
|
|
577
|
+
//#region src/hooks/useRouterState.d.ts
|
|
620
578
|
declare const useRouterState: () => RouterState;
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
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;
|
|
627
586
|
}>;
|
|
628
587
|
declare module "@alepha/core" {
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
}
|
|
588
|
+
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
589
|
+
interface State {
|
|
590
|
+
"ReactServerProvider.template"?: string;
|
|
591
|
+
"ReactServerProvider.ssr"?: boolean;
|
|
592
|
+
}
|
|
635
593
|
}
|
|
636
594
|
declare class ReactServerProvider {
|
|
637
|
-
|
|
638
|
-
|
|
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
|
-
|
|
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;
|
|
672
630
|
}
|
|
673
631
|
type TemplateLoader = () => Promise<string | undefined>;
|
|
674
|
-
|
|
632
|
+
//#endregion
|
|
633
|
+
//#region src/index.d.ts
|
|
675
634
|
declare module "@alepha/core" {
|
|
676
|
-
|
|
677
|
-
|
|
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
|
-
|
|
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
|
+
}
|
|
703
662
|
}
|
|
704
663
|
/**
|
|
705
664
|
* Alepha React Module
|
|
@@ -711,8 +670,9 @@ declare module "@alepha/core" {
|
|
|
711
670
|
* @module alepha.react
|
|
712
671
|
*/
|
|
713
672
|
declare class AlephaReact implements Module {
|
|
714
|
-
|
|
715
|
-
|
|
673
|
+
readonly name = "alepha.react";
|
|
674
|
+
readonly $services: (alepha: Alepha) => Alepha;
|
|
716
675
|
}
|
|
717
|
-
|
|
718
|
-
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
|