@alepha/react 0.6.1 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -28
- package/dist/index.browser.cjs +19 -23
- package/dist/index.browser.js +7 -7
- package/dist/index.cjs +235 -512
- package/dist/index.d.ts +240 -678
- package/dist/index.js +220 -492
- package/dist/{useAuth-DOVx2kqa.cjs → useActive-BVqdq757.cjs} +333 -431
- package/dist/{useAuth-i7wbKVrt.js → useActive-dAmCT31a.js} +332 -427
- package/package.json +13 -14
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import * as _alepha_core from '@alepha/core';
|
|
2
|
-
import {
|
|
2
|
+
import { Alepha, EventEmitter, Static as Static$1, TSchema as TSchema$1, KIND, Async, Class, TObject as TObject$1 } from '@alepha/core';
|
|
3
|
+
import { HttpClientLink, HttpClient, ServerRouterProvider, ServerHandler, ServerRequest } from '@alepha/server';
|
|
3
4
|
import * as react from 'react';
|
|
4
|
-
import react__default, { ReactNode,
|
|
5
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
|
-
import { UserAccountToken } from '@alepha/security';
|
|
7
|
-
import * as _alepha_server from '@alepha/server';
|
|
8
|
-
import { FastifyCookieProvider, CookieManager, HttpClient, ServerProvider, ServeDescriptorOptions, CreateRoute } from '@alepha/server';
|
|
5
|
+
import react__default, { ReactNode, FC, AnchorHTMLAttributes } from 'react';
|
|
9
6
|
import { Root } from 'react-dom/client';
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
7
|
+
import { RouterProvider, Route } from '@alepha/router';
|
|
8
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
9
|
+
import { ServerStaticProvider } from '@alepha/server-static';
|
|
12
10
|
|
|
13
11
|
/** Symbol key applied to readonly types */
|
|
14
12
|
declare const ReadonlyKind: unique symbol;
|
|
@@ -51,19 +49,6 @@ interface TBoolean extends TSchema {
|
|
|
51
49
|
type: 'boolean';
|
|
52
50
|
}
|
|
53
51
|
|
|
54
|
-
interface NumberOptions extends SchemaOptions {
|
|
55
|
-
exclusiveMaximum?: number;
|
|
56
|
-
exclusiveMinimum?: number;
|
|
57
|
-
maximum?: number;
|
|
58
|
-
minimum?: number;
|
|
59
|
-
multipleOf?: number;
|
|
60
|
-
}
|
|
61
|
-
interface TNumber extends TSchema, NumberOptions {
|
|
62
|
-
[Kind]: 'Number';
|
|
63
|
-
static: number;
|
|
64
|
-
type: 'number';
|
|
65
|
-
}
|
|
66
|
-
|
|
67
52
|
type TOptional<T extends TSchema> = T & {
|
|
68
53
|
[OptionalKind]: 'Optional';
|
|
69
54
|
};
|
|
@@ -140,504 +125,64 @@ interface TSchema extends TKind, SchemaOptions {
|
|
|
140
125
|
static: unknown;
|
|
141
126
|
}
|
|
142
127
|
|
|
143
|
-
interface
|
|
144
|
-
children?: ReactNode;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Nested view component
|
|
148
|
-
*
|
|
149
|
-
* @param props
|
|
150
|
-
* @constructor
|
|
151
|
-
*/
|
|
152
|
-
declare const NestedView: (props: NestedViewProps) => string | number | boolean | react.ReactElement<any, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null;
|
|
153
|
-
|
|
154
|
-
interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
155
|
-
to: string;
|
|
156
|
-
children?: react__default.ReactNode;
|
|
157
|
-
}
|
|
158
|
-
declare const Link: (props: LinkProps) => react_jsx_runtime.JSX.Element;
|
|
159
|
-
|
|
160
|
-
declare class Router extends EventEmitter<RouterEvents> {
|
|
161
|
-
protected readonly log: _alepha_core.Logger;
|
|
162
|
-
protected readonly alepha: Alepha;
|
|
163
|
-
protected readonly pages: PageRoute[];
|
|
164
|
-
protected notFoundPageRoute?: PageRoute;
|
|
165
|
-
/**
|
|
166
|
-
* Get the page by name.
|
|
167
|
-
*
|
|
168
|
-
* @param name - Page name
|
|
169
|
-
* @return PageRoute
|
|
170
|
-
*/
|
|
171
|
-
page(name: string): PageRoute;
|
|
172
|
-
/**
|
|
173
|
-
*
|
|
174
|
-
*/
|
|
175
|
-
root(state: RouterState, context?: PageContext): ReactNode;
|
|
176
|
-
/**
|
|
177
|
-
*
|
|
178
|
-
* @param url
|
|
179
|
-
* @param options
|
|
180
|
-
*/
|
|
181
|
-
render(url: string, options?: RouterRenderOptions): Promise<RouterRenderResult>;
|
|
182
|
-
/**
|
|
183
|
-
*
|
|
184
|
-
* @param url
|
|
185
|
-
* @param options
|
|
186
|
-
* @param context
|
|
187
|
-
* @protected
|
|
188
|
-
*/
|
|
189
|
-
match(url: string, options?: RouterMatchOptions, context?: RouterRenderContext): Promise<Layer[]>;
|
|
190
|
-
/**
|
|
191
|
-
* Create layers for the given route.
|
|
192
|
-
*
|
|
193
|
-
* @param url
|
|
194
|
-
* @param route
|
|
195
|
-
* @param params
|
|
196
|
-
* @param query
|
|
197
|
-
* @param previous
|
|
198
|
-
* @param args
|
|
199
|
-
* @param renderContext
|
|
200
|
-
* @protected
|
|
201
|
-
*/
|
|
202
|
-
createLayers(url: string, route: PageRoute, params?: Record<string, any>, query?: Record<string, string>, previous?: PreviousLayerData[], args?: PageContext, renderContext?: RouterRenderContext): Promise<Layer[]>;
|
|
203
|
-
/**
|
|
204
|
-
*
|
|
205
|
-
* @param route
|
|
206
|
-
* @protected
|
|
207
|
-
*/
|
|
208
|
-
protected getErrorHandler(route: PageRoute): react.FC<{
|
|
209
|
-
error: Error;
|
|
210
|
-
url: string;
|
|
211
|
-
}> | undefined;
|
|
212
|
-
/**
|
|
213
|
-
*
|
|
214
|
-
* @param page
|
|
215
|
-
* @param props
|
|
216
|
-
* @protected
|
|
217
|
-
*/
|
|
218
|
-
protected createElement(page: PageRoute, props: Record<string, any>): Promise<ReactNode>;
|
|
219
|
-
/**
|
|
220
|
-
* Merge the render context with the page context.
|
|
221
|
-
*
|
|
222
|
-
* @param page
|
|
223
|
-
* @param ctx
|
|
224
|
-
* @param props
|
|
225
|
-
* @protected
|
|
226
|
-
*/
|
|
227
|
-
protected mergeRenderContext(page: PageRoute, ctx: RouterRenderContext, props: Record<string, any>): void;
|
|
228
|
-
/**
|
|
229
|
-
*
|
|
230
|
-
* @param e
|
|
231
|
-
* @protected
|
|
232
|
-
*/
|
|
233
|
-
protected renderError(e: Error): ReactNode;
|
|
234
|
-
/**
|
|
235
|
-
* Render an empty view.
|
|
236
|
-
*
|
|
237
|
-
* @protected
|
|
238
|
-
*/
|
|
239
|
-
protected renderEmptyView(): ReactNode;
|
|
240
|
-
/**
|
|
241
|
-
* Create a valid href for the given page.
|
|
242
|
-
* @param page
|
|
243
|
-
* @param params
|
|
244
|
-
*/
|
|
245
|
-
href(page: {
|
|
246
|
-
options: {
|
|
247
|
-
name?: string;
|
|
248
|
-
};
|
|
249
|
-
}, params?: Record<string, any>): string;
|
|
250
|
-
/**
|
|
251
|
-
*
|
|
252
|
-
* @param index
|
|
253
|
-
* @param path
|
|
254
|
-
* @param view
|
|
255
|
-
* @protected
|
|
256
|
-
*/
|
|
257
|
-
protected renderView(index: number, path: string, view?: ReactNode): ReactNode;
|
|
258
|
-
/**
|
|
259
|
-
*
|
|
260
|
-
* @param entry
|
|
261
|
-
*/
|
|
262
|
-
add(entry: PageRouteEntry): void;
|
|
263
|
-
/**
|
|
264
|
-
* Create a match function for the given page.
|
|
265
|
-
*
|
|
266
|
-
* @param page
|
|
267
|
-
* @protected
|
|
268
|
-
*/
|
|
269
|
-
protected createMatchFunction(page: PageRoute): {
|
|
270
|
-
exec: MatchFunction<ParamData>;
|
|
271
|
-
path: string;
|
|
272
|
-
} | undefined;
|
|
273
|
-
/**
|
|
274
|
-
*
|
|
275
|
-
*/
|
|
276
|
-
empty(): boolean;
|
|
277
|
-
/**
|
|
278
|
-
*
|
|
279
|
-
* @protected
|
|
280
|
-
*/
|
|
281
|
-
protected _next: number;
|
|
282
|
-
/**
|
|
283
|
-
*
|
|
284
|
-
* @protected
|
|
285
|
-
*/
|
|
286
|
-
protected nextId(): string;
|
|
287
|
-
}
|
|
288
|
-
interface PageRouteEntry extends Omit<PageDescriptorOptions, "children" | "parent"> {
|
|
289
|
-
/**
|
|
290
|
-
*
|
|
291
|
-
*/
|
|
292
|
-
name?: string;
|
|
293
|
-
/**
|
|
294
|
-
*
|
|
295
|
-
*/
|
|
296
|
-
match?: {
|
|
297
|
-
/**
|
|
298
|
-
*
|
|
299
|
-
*/
|
|
300
|
-
exec: MatchFunction<ParamData>;
|
|
301
|
-
/**
|
|
302
|
-
*
|
|
303
|
-
*/
|
|
304
|
-
path: string;
|
|
305
|
-
};
|
|
306
|
-
/**
|
|
307
|
-
*
|
|
308
|
-
*/
|
|
309
|
-
children?: PageRouteEntry[];
|
|
310
|
-
/**
|
|
311
|
-
*
|
|
312
|
-
*/
|
|
313
|
-
parent?: PageRoute;
|
|
314
|
-
}
|
|
315
|
-
interface PageRoute extends PageRouteEntry {
|
|
316
|
-
/**
|
|
317
|
-
*
|
|
318
|
-
*/
|
|
319
|
-
name: string;
|
|
320
|
-
/**
|
|
321
|
-
*
|
|
322
|
-
*/
|
|
323
|
-
parent?: PageRoute;
|
|
324
|
-
}
|
|
325
|
-
interface Layer {
|
|
326
|
-
/**
|
|
327
|
-
*
|
|
328
|
-
*/
|
|
329
|
-
config?: {
|
|
330
|
-
/**
|
|
331
|
-
*
|
|
332
|
-
*/
|
|
333
|
-
query?: Record<string, any>;
|
|
334
|
-
/**
|
|
335
|
-
*
|
|
336
|
-
*/
|
|
337
|
-
params?: Record<string, any>;
|
|
338
|
-
/**
|
|
339
|
-
*
|
|
340
|
-
*/
|
|
341
|
-
context?: Record<string, any>;
|
|
342
|
-
};
|
|
343
|
-
/**
|
|
344
|
-
*
|
|
345
|
-
*/
|
|
346
|
-
name: string;
|
|
347
|
-
/**
|
|
348
|
-
*
|
|
349
|
-
*/
|
|
350
|
-
props?: Record<string, any>;
|
|
351
|
-
/**
|
|
352
|
-
*
|
|
353
|
-
*/
|
|
354
|
-
part?: string;
|
|
355
|
-
/**
|
|
356
|
-
*
|
|
357
|
-
*/
|
|
358
|
-
element: ReactNode;
|
|
359
|
-
/**
|
|
360
|
-
*
|
|
361
|
-
*/
|
|
362
|
-
index: number;
|
|
363
|
-
/**
|
|
364
|
-
*
|
|
365
|
-
*/
|
|
366
|
-
path: string;
|
|
367
|
-
}
|
|
368
|
-
/**
|
|
369
|
-
*
|
|
370
|
-
*/
|
|
371
|
-
type PreviousLayerData = Omit<Layer, "element">;
|
|
372
|
-
interface AnchorProps {
|
|
373
|
-
/**
|
|
374
|
-
*
|
|
375
|
-
*/
|
|
376
|
-
href?: string;
|
|
377
|
-
/**
|
|
378
|
-
*
|
|
379
|
-
* @param ev
|
|
380
|
-
*/
|
|
381
|
-
onClick?: (ev: any) => any;
|
|
382
|
-
}
|
|
383
|
-
interface RouterMatchOptions {
|
|
384
|
-
/**
|
|
385
|
-
*
|
|
386
|
-
*/
|
|
387
|
-
previous?: PreviousLayerData[];
|
|
388
|
-
/**
|
|
389
|
-
*
|
|
390
|
-
*/
|
|
391
|
-
args?: PageContext;
|
|
392
|
-
}
|
|
393
|
-
interface RouterEvents {
|
|
394
|
-
/**
|
|
395
|
-
*
|
|
396
|
-
*/
|
|
397
|
-
begin: undefined;
|
|
398
|
-
/**
|
|
399
|
-
*
|
|
400
|
-
*/
|
|
401
|
-
success: undefined;
|
|
402
|
-
/**
|
|
403
|
-
*
|
|
404
|
-
*/
|
|
405
|
-
error: Error;
|
|
406
|
-
/**
|
|
407
|
-
*
|
|
408
|
-
*/
|
|
409
|
-
end: RouterState;
|
|
410
|
-
}
|
|
411
|
-
interface RouterState {
|
|
412
|
-
/**
|
|
413
|
-
*
|
|
414
|
-
*/
|
|
415
|
-
pathname: string;
|
|
416
|
-
/**
|
|
417
|
-
*
|
|
418
|
-
*/
|
|
419
|
-
search: string;
|
|
420
|
-
/**
|
|
421
|
-
*
|
|
422
|
-
*/
|
|
423
|
-
layers: Array<Layer>;
|
|
424
|
-
/**
|
|
425
|
-
*
|
|
426
|
-
*/
|
|
427
|
-
context: RouterRenderContext;
|
|
428
|
-
}
|
|
429
|
-
interface RouterRenderContext {
|
|
430
|
-
/**
|
|
431
|
-
*
|
|
432
|
-
*/
|
|
433
|
-
helmet?: RouterRenderHelmetContext;
|
|
434
|
-
}
|
|
435
|
-
interface RouterRenderOptions extends RouterMatchOptions {
|
|
436
|
-
/**
|
|
437
|
-
* State to update.
|
|
438
|
-
*/
|
|
439
|
-
state?: RouterState;
|
|
440
|
-
}
|
|
441
|
-
interface RouterStackItem {
|
|
442
|
-
/**
|
|
443
|
-
*
|
|
444
|
-
*/
|
|
445
|
-
route: PageRoute;
|
|
446
|
-
/**
|
|
447
|
-
*
|
|
448
|
-
*/
|
|
449
|
-
config?: Record<string, any>;
|
|
450
|
-
/**
|
|
451
|
-
*
|
|
452
|
-
*/
|
|
453
|
-
props?: Record<string, any>;
|
|
454
|
-
/**
|
|
455
|
-
*
|
|
456
|
-
*/
|
|
457
|
-
error?: Error;
|
|
458
|
-
}
|
|
459
|
-
interface RouterRenderHelmetContext {
|
|
460
|
-
/**
|
|
461
|
-
*
|
|
462
|
-
*/
|
|
128
|
+
interface Head$1 {
|
|
463
129
|
title?: string;
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
*/
|
|
467
|
-
html?: {
|
|
468
|
-
attributes?: Record<string, string>;
|
|
469
|
-
};
|
|
470
|
-
/**
|
|
471
|
-
*
|
|
472
|
-
*/
|
|
473
|
-
body?: {
|
|
474
|
-
attributes?: Record<string, string>;
|
|
475
|
-
};
|
|
476
|
-
/**
|
|
477
|
-
*
|
|
478
|
-
*/
|
|
130
|
+
htmlAttributes?: Record<string, string>;
|
|
131
|
+
bodyAttributes?: Record<string, string>;
|
|
479
132
|
meta?: Array<{
|
|
480
133
|
name: string;
|
|
481
134
|
content: string;
|
|
482
135
|
}>;
|
|
483
136
|
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
/**
|
|
490
|
-
*
|
|
491
|
-
*/
|
|
492
|
-
layers: Layer[];
|
|
493
|
-
/**
|
|
494
|
-
*
|
|
495
|
-
*/
|
|
496
|
-
redirect?: string;
|
|
497
|
-
/**
|
|
498
|
-
*
|
|
499
|
-
*/
|
|
500
|
-
context: RouterRenderContext;
|
|
137
|
+
declare class ServerHeadProvider {
|
|
138
|
+
renderHead(template: string, head: Head$1): string;
|
|
139
|
+
mergeAttributes(existing: string, attrs: Record<string, string>): string;
|
|
140
|
+
parseAttributes(attrStr: string): Record<string, string>;
|
|
141
|
+
escapeHtml(str: string): string;
|
|
501
142
|
}
|
|
502
143
|
|
|
503
|
-
declare class
|
|
504
|
-
|
|
505
|
-
protected readonly alepha: Alepha;
|
|
506
|
-
protected readonly fastifyCookieProvider: FastifyCookieProvider;
|
|
507
|
-
protected authProviders: AuthProvider[];
|
|
508
|
-
protected readonly authorizationCode: _alepha_server.CookieDescriptor<TObject<{
|
|
509
|
-
codeVerifier: TOptional<TString>;
|
|
510
|
-
redirectUri: TOptional<TString>;
|
|
511
|
-
}>>;
|
|
512
|
-
protected readonly tokens: _alepha_server.CookieDescriptor<TObject<{
|
|
513
|
-
access_token: TOptional<TString>;
|
|
514
|
-
expires_in: TOptional<TNumber>;
|
|
515
|
-
refresh_token: TOptional<TString>;
|
|
516
|
-
id_token: TOptional<TString>;
|
|
517
|
-
scope: TOptional<TString>;
|
|
518
|
-
issued_at: TOptional<TNumber>;
|
|
519
|
-
}>>;
|
|
520
|
-
protected readonly user: _alepha_server.CookieDescriptor<TObject<{
|
|
521
|
-
id: TString;
|
|
522
|
-
name: TOptional<TString>;
|
|
523
|
-
email: TOptional<TString>;
|
|
524
|
-
}>>;
|
|
525
|
-
protected readonly configure: _alepha_core.HookDescriptor<"configure">;
|
|
526
|
-
/**
|
|
527
|
-
* Configure Fastify to forward Session Access Token to Header Authorization.
|
|
528
|
-
*/
|
|
529
|
-
protected readonly configureFastify: _alepha_core.HookDescriptor<"configure:fastify">;
|
|
530
|
-
/**
|
|
531
|
-
*
|
|
532
|
-
* @param cookies
|
|
533
|
-
* @protected
|
|
534
|
-
*/
|
|
535
|
-
protected refresh(cookies: CookieManager): Promise<SessionTokens | undefined>;
|
|
536
|
-
/**
|
|
537
|
-
*
|
|
538
|
-
*/
|
|
539
|
-
readonly login: _alepha_server.RouteDescriptor<{
|
|
540
|
-
query: TObject<{
|
|
541
|
-
redirect: TOptional<TString>;
|
|
542
|
-
provider: TOptional<TString>;
|
|
543
|
-
}>;
|
|
544
|
-
}, false>;
|
|
545
|
-
/**
|
|
546
|
-
*
|
|
547
|
-
*/
|
|
548
|
-
readonly callback: _alepha_server.RouteDescriptor<{
|
|
549
|
-
query: TObject<{
|
|
550
|
-
provider: TOptional<TString>;
|
|
551
|
-
}>;
|
|
552
|
-
}, false>;
|
|
553
|
-
/**
|
|
554
|
-
*
|
|
555
|
-
* @param accessToken
|
|
556
|
-
* @protected
|
|
557
|
-
*/
|
|
558
|
-
protected userFromAccessToken(accessToken: string): {
|
|
559
|
-
id: any;
|
|
560
|
-
name: any;
|
|
561
|
-
email: any;
|
|
562
|
-
} | undefined;
|
|
563
|
-
/**
|
|
564
|
-
*
|
|
565
|
-
*/
|
|
566
|
-
readonly logout: _alepha_server.RouteDescriptor<{
|
|
567
|
-
query: TObject<{
|
|
568
|
-
redirect: TOptional<TString>;
|
|
569
|
-
provider: TOptional<TString>;
|
|
570
|
-
}>;
|
|
571
|
-
}, false>;
|
|
572
|
-
/**
|
|
573
|
-
*
|
|
574
|
-
* @param name
|
|
575
|
-
* @protected
|
|
576
|
-
*/
|
|
577
|
-
protected provider(name?: string): AuthProvider;
|
|
578
|
-
/**
|
|
579
|
-
*
|
|
580
|
-
* @param file
|
|
581
|
-
* @protected
|
|
582
|
-
*/
|
|
583
|
-
protected isViteFile(file: string): boolean;
|
|
584
|
-
}
|
|
585
|
-
interface SessionTokens {
|
|
586
|
-
access_token?: string;
|
|
587
|
-
expires_in?: number;
|
|
588
|
-
refresh_token?: string;
|
|
589
|
-
id_token?: string;
|
|
590
|
-
scope?: string;
|
|
591
|
-
issued_at?: number;
|
|
592
|
-
}
|
|
593
|
-
interface SessionAuthorizationCode {
|
|
594
|
-
codeVerifier?: string;
|
|
595
|
-
redirectUri?: string;
|
|
596
|
-
nonce?: string;
|
|
597
|
-
max_age?: number;
|
|
598
|
-
state?: string;
|
|
599
|
-
}
|
|
600
|
-
interface AuthProvider {
|
|
601
|
-
name: string;
|
|
602
|
-
redirectUri: string;
|
|
603
|
-
client: Configuration;
|
|
144
|
+
declare class BrowserHeadProvider {
|
|
145
|
+
renderHead(document: Document, head: Head$1): void;
|
|
604
146
|
}
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
email?: string;
|
|
147
|
+
|
|
148
|
+
interface BrowserRoute extends Route {
|
|
149
|
+
page: PageRoute;
|
|
609
150
|
}
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
151
|
+
declare class BrowserRouterProvider extends RouterProvider<BrowserRoute> {
|
|
152
|
+
protected readonly log: _alepha_core.Logger;
|
|
153
|
+
protected readonly alepha: Alepha;
|
|
154
|
+
protected readonly pageDescriptorProvider: PageDescriptorProvider;
|
|
155
|
+
readonly events: EventEmitter<RouterEvents>;
|
|
156
|
+
add(entry: PageRouteEntry): void;
|
|
157
|
+
protected readonly configure: _alepha_core.HookDescriptor<"configure">;
|
|
158
|
+
transition(url: URL, options?: TransitionOptions): Promise<RouterRenderResult>;
|
|
159
|
+
root(state: RouterState, context?: PageReactContext): ReactNode;
|
|
614
160
|
}
|
|
615
161
|
|
|
162
|
+
declare const envSchema$1: _alepha_core.TObject<{
|
|
163
|
+
REACT_ROOT_ID: TString;
|
|
164
|
+
}>;
|
|
165
|
+
declare module "@alepha/core" {
|
|
166
|
+
interface Env extends Partial<Static$1<typeof envSchema$1>> {
|
|
167
|
+
}
|
|
168
|
+
}
|
|
616
169
|
declare class ReactBrowserProvider {
|
|
617
170
|
protected readonly log: _alepha_core.Logger;
|
|
618
171
|
protected readonly client: HttpClient;
|
|
619
|
-
protected readonly
|
|
172
|
+
protected readonly alepha: Alepha;
|
|
173
|
+
protected readonly router: BrowserRouterProvider;
|
|
174
|
+
protected readonly headProvider: BrowserHeadProvider;
|
|
175
|
+
protected readonly env: {
|
|
176
|
+
REACT_ROOT_ID: string;
|
|
177
|
+
};
|
|
620
178
|
protected root: Root;
|
|
621
179
|
transitioning?: {
|
|
622
180
|
to: string;
|
|
623
181
|
};
|
|
624
182
|
state: RouterState;
|
|
625
|
-
/**
|
|
626
|
-
*
|
|
627
|
-
*/
|
|
628
183
|
get document(): Document;
|
|
629
|
-
/**
|
|
630
|
-
*
|
|
631
|
-
*/
|
|
632
184
|
get history(): History;
|
|
633
|
-
/**
|
|
634
|
-
*
|
|
635
|
-
*/
|
|
636
185
|
get url(): string;
|
|
637
|
-
/**
|
|
638
|
-
*
|
|
639
|
-
* @param props
|
|
640
|
-
*/
|
|
641
186
|
invalidate(props?: Record<string, any>): Promise<void>;
|
|
642
187
|
/**
|
|
643
188
|
*
|
|
@@ -645,18 +190,13 @@ declare class ReactBrowserProvider {
|
|
|
645
190
|
* @param options
|
|
646
191
|
*/
|
|
647
192
|
go(url: string, options?: RouterGoOptions): Promise<void>;
|
|
648
|
-
/**
|
|
649
|
-
*
|
|
650
|
-
* @param options
|
|
651
|
-
* @protected
|
|
652
|
-
*/
|
|
653
193
|
protected render(options?: {
|
|
654
194
|
url?: string;
|
|
655
195
|
previous?: PreviousLayerData[];
|
|
656
196
|
}): Promise<{
|
|
657
197
|
url: string;
|
|
198
|
+
head: Head;
|
|
658
199
|
}>;
|
|
659
|
-
protected renderHelmetContext(ctx: RouterRenderHelmetContext): void;
|
|
660
200
|
/**
|
|
661
201
|
* Get embedded layers from the server.
|
|
662
202
|
*
|
|
@@ -668,24 +208,19 @@ declare class ReactBrowserProvider {
|
|
|
668
208
|
* @protected
|
|
669
209
|
*/
|
|
670
210
|
protected getRootElement(): HTMLElement;
|
|
671
|
-
protected getUserFromCookies(): UserAccountToken | undefined;
|
|
672
211
|
/**
|
|
673
212
|
*
|
|
674
213
|
* @protected
|
|
675
214
|
*/
|
|
676
215
|
protected ready: _alepha_core.HookDescriptor<"ready">;
|
|
677
|
-
/**
|
|
678
|
-
*
|
|
679
|
-
* @protected
|
|
680
|
-
*/
|
|
681
|
-
protected stop: _alepha_core.HookDescriptor<"stop">;
|
|
682
216
|
}
|
|
683
|
-
/**
|
|
684
|
-
*
|
|
685
|
-
*/
|
|
686
217
|
interface RouterGoOptions {
|
|
687
218
|
replace?: boolean;
|
|
688
|
-
match?:
|
|
219
|
+
match?: TransitionOptions;
|
|
220
|
+
}
|
|
221
|
+
interface ReactHydrationState {
|
|
222
|
+
layers?: PreviousLayerData[];
|
|
223
|
+
links?: HttpClientLink[];
|
|
689
224
|
}
|
|
690
225
|
|
|
691
226
|
declare class RouterHookApi {
|
|
@@ -764,83 +299,40 @@ type HrefLike = string | {
|
|
|
764
299
|
};
|
|
765
300
|
};
|
|
766
301
|
|
|
767
|
-
declare const
|
|
768
|
-
interface
|
|
302
|
+
declare const KEY = "PAGE";
|
|
303
|
+
interface PageConfigSchema {
|
|
769
304
|
query?: TSchema$1;
|
|
770
305
|
params?: TSchema$1;
|
|
771
306
|
}
|
|
772
307
|
type TPropsDefault = any;
|
|
773
308
|
type TPropsParentDefault = object;
|
|
774
|
-
interface PageDescriptorOptions<TConfig extends
|
|
775
|
-
/**
|
|
776
|
-
*
|
|
777
|
-
*/
|
|
309
|
+
interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> {
|
|
778
310
|
name?: string;
|
|
779
|
-
/**
|
|
780
|
-
*
|
|
781
|
-
*/
|
|
782
311
|
path?: string;
|
|
783
|
-
/**
|
|
784
|
-
*
|
|
785
|
-
*/
|
|
786
312
|
schema?: TConfig;
|
|
787
|
-
|
|
788
|
-
* Function to call when the page is loaded.
|
|
789
|
-
*/
|
|
790
|
-
resolve?: (config: PageDescriptorConfigValue<TConfig> & TPropsParent & {
|
|
791
|
-
context: PageContext;
|
|
792
|
-
}, context: PageContext) => Async<TProps>;
|
|
793
|
-
/**
|
|
794
|
-
* Component to render when the page is loaded.
|
|
795
|
-
*/
|
|
313
|
+
resolve?: (config: PageResolve<TConfig, TPropsParent>) => Async<TProps>;
|
|
796
314
|
component?: FC<TProps & TPropsParent>;
|
|
797
|
-
/**
|
|
798
|
-
* Component to render when the page is loaded. (like .component)
|
|
799
|
-
*/
|
|
800
315
|
lazy?: () => Promise<{
|
|
801
316
|
default: FC<TProps & TPropsParent>;
|
|
802
317
|
}>;
|
|
803
|
-
|
|
804
|
-
*
|
|
805
|
-
*/
|
|
806
|
-
children?: () => Array<{
|
|
318
|
+
children?: Array<{
|
|
807
319
|
options: PageDescriptorOptions;
|
|
808
320
|
}>;
|
|
809
|
-
/**
|
|
810
|
-
*
|
|
811
|
-
*/
|
|
812
321
|
parent?: {
|
|
813
322
|
options: PageDescriptorOptions<any, TPropsParent>;
|
|
814
323
|
};
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
*/
|
|
818
|
-
helmet?: RouterRenderHelmetContext | ((props: TProps) => RouterRenderHelmetContext);
|
|
819
|
-
/**
|
|
820
|
-
*
|
|
821
|
-
*/
|
|
324
|
+
can?: () => boolean;
|
|
325
|
+
head?: Head | ((props: TProps, previous?: Head) => Head);
|
|
822
326
|
notFoundHandler?: FC<{
|
|
823
|
-
|
|
327
|
+
url: string;
|
|
824
328
|
}>;
|
|
825
|
-
/**
|
|
826
|
-
*
|
|
827
|
-
*/
|
|
828
329
|
errorHandler?: FC<{
|
|
829
330
|
error: Error;
|
|
830
331
|
url: string;
|
|
831
332
|
}>;
|
|
832
333
|
}
|
|
833
|
-
interface
|
|
834
|
-
|
|
835
|
-
cookies?: CookieManager;
|
|
836
|
-
}
|
|
837
|
-
interface PageDescriptorConfigValue<TConfig extends PageDescriptorConfigSchema = PageDescriptorConfigSchema> {
|
|
838
|
-
query: TConfig["query"] extends TSchema$1 ? Static$1<TConfig["query"]> : Record<string, string>;
|
|
839
|
-
params: TConfig["params"] extends TSchema$1 ? Static$1<TConfig["params"]> : Record<string, string>;
|
|
840
|
-
pathname: string;
|
|
841
|
-
}
|
|
842
|
-
interface PageDescriptor<TConfig extends PageDescriptorConfigSchema = PageDescriptorConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> {
|
|
843
|
-
[KIND]: typeof pageDescriptorKey;
|
|
334
|
+
interface PageDescriptor<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> {
|
|
335
|
+
[KIND]: typeof KEY;
|
|
844
336
|
render: (options?: {
|
|
845
337
|
params?: Record<string, string>;
|
|
846
338
|
query?: Record<string, string>;
|
|
@@ -851,17 +343,162 @@ interface PageDescriptor<TConfig extends PageDescriptorConfigSchema = PageDescri
|
|
|
851
343
|
onClick: () => void;
|
|
852
344
|
};
|
|
853
345
|
options: PageDescriptorOptions<TConfig, TProps, TPropsParent>;
|
|
346
|
+
can: () => boolean;
|
|
854
347
|
}
|
|
855
348
|
declare const $page: {
|
|
856
|
-
<TConfig extends
|
|
349
|
+
<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = any, TPropsParent extends object = object>(options: PageDescriptorOptions<TConfig, TProps, TPropsParent>): PageDescriptor<TConfig, TProps, TPropsParent>;
|
|
857
350
|
[KIND]: string;
|
|
858
351
|
};
|
|
352
|
+
interface Head {
|
|
353
|
+
title?: string;
|
|
354
|
+
titleSeparator?: string;
|
|
355
|
+
htmlAttributes?: Record<string, string>;
|
|
356
|
+
bodyAttributes?: Record<string, string>;
|
|
357
|
+
meta?: Array<{
|
|
358
|
+
name: string;
|
|
359
|
+
content: string;
|
|
360
|
+
}>;
|
|
361
|
+
}
|
|
362
|
+
interface PageRequestConfig<TConfig extends PageConfigSchema = PageConfigSchema> {
|
|
363
|
+
params: TConfig["params"] extends TSchema$1 ? Static$1<TConfig["params"]> : Record<string, string>;
|
|
364
|
+
query: TConfig["query"] extends TSchema$1 ? Static$1<TConfig["query"]> : Record<string, string>;
|
|
365
|
+
}
|
|
366
|
+
type PageResolve<TConfig extends PageConfigSchema = PageConfigSchema, TPropsParent extends object = TPropsParentDefault> = PageRequestConfig<TConfig> & TPropsParent & PageResolveContext;
|
|
367
|
+
interface PageResolveContext {
|
|
368
|
+
url: URL;
|
|
369
|
+
head: Head;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
declare class PageDescriptorProvider {
|
|
373
|
+
protected readonly log: _alepha_core.Logger;
|
|
374
|
+
protected readonly alepha: Alepha;
|
|
375
|
+
protected readonly pages: PageRoute[];
|
|
376
|
+
getPages(): PageRoute[];
|
|
377
|
+
page(name: string): PageRoute;
|
|
378
|
+
root(state: RouterState, context?: PageReactContext, events?: EventEmitter<RouterEvents>): ReactNode;
|
|
379
|
+
createLayers(route: PageRoute, request: PageRequest): Promise<CreateLayersResult>;
|
|
380
|
+
protected getErrorHandler(route: PageRoute): react.FC<{
|
|
381
|
+
error: Error;
|
|
382
|
+
url: string;
|
|
383
|
+
}> | undefined;
|
|
384
|
+
protected createElement(page: PageRoute, props: Record<string, any>): Promise<ReactNode>;
|
|
385
|
+
protected fillHead(page: PageRoute, ctx: PageRequest, props: Record<string, any>): void;
|
|
386
|
+
renderError(e: Error): ReactNode;
|
|
387
|
+
renderEmptyView(): ReactNode;
|
|
388
|
+
href(page: {
|
|
389
|
+
options: {
|
|
390
|
+
name?: string;
|
|
391
|
+
};
|
|
392
|
+
}, params?: Record<string, any>): string;
|
|
393
|
+
compile(path: string, params?: Record<string, string>): string;
|
|
394
|
+
protected renderView(index: number, path: string, view?: ReactNode): ReactNode;
|
|
395
|
+
protected readonly configure: _alepha_core.HookDescriptor<"configure">;
|
|
396
|
+
protected map(pages: Array<{
|
|
397
|
+
value: {
|
|
398
|
+
options: PageDescriptorOptions;
|
|
399
|
+
};
|
|
400
|
+
}>, target: {
|
|
401
|
+
options: PageDescriptorOptions;
|
|
402
|
+
}): PageRouteEntry;
|
|
403
|
+
add(entry: PageRouteEntry): void;
|
|
404
|
+
protected createMatch(page: PageRoute): string;
|
|
405
|
+
protected _next: number;
|
|
406
|
+
protected nextId(): string;
|
|
407
|
+
}
|
|
408
|
+
declare const isPageRoute: (it: any) => it is PageRoute;
|
|
409
|
+
interface PageRouteEntry extends Omit<PageDescriptorOptions, "children" | "parent"> {
|
|
410
|
+
children?: PageRouteEntry[];
|
|
411
|
+
}
|
|
412
|
+
interface PageRoute extends PageRouteEntry {
|
|
413
|
+
type: "page";
|
|
414
|
+
name: string;
|
|
415
|
+
parent?: PageRoute;
|
|
416
|
+
match: string;
|
|
417
|
+
}
|
|
418
|
+
interface Layer {
|
|
419
|
+
config?: {
|
|
420
|
+
query?: Record<string, any>;
|
|
421
|
+
params?: Record<string, any>;
|
|
422
|
+
context?: Record<string, any>;
|
|
423
|
+
};
|
|
424
|
+
name: string;
|
|
425
|
+
props?: Record<string, any>;
|
|
426
|
+
error?: Error;
|
|
427
|
+
part?: string;
|
|
428
|
+
element: ReactNode;
|
|
429
|
+
index: number;
|
|
430
|
+
path: string;
|
|
431
|
+
}
|
|
432
|
+
type PreviousLayerData = Omit<Layer, "element">;
|
|
433
|
+
interface AnchorProps {
|
|
434
|
+
href?: string;
|
|
435
|
+
onClick?: (ev: any) => any;
|
|
436
|
+
}
|
|
437
|
+
interface RouterEvents {
|
|
438
|
+
begin: undefined;
|
|
439
|
+
success: undefined;
|
|
440
|
+
error: Error;
|
|
441
|
+
end: RouterState;
|
|
442
|
+
}
|
|
443
|
+
interface RouterState {
|
|
444
|
+
pathname: string;
|
|
445
|
+
search: string;
|
|
446
|
+
layers: Array<Layer>;
|
|
447
|
+
head: Head;
|
|
448
|
+
}
|
|
449
|
+
interface TransitionOptions {
|
|
450
|
+
state?: RouterState;
|
|
451
|
+
previous?: PreviousLayerData[];
|
|
452
|
+
context?: PageReactContext;
|
|
453
|
+
}
|
|
454
|
+
interface RouterStackItem {
|
|
455
|
+
route: PageRoute;
|
|
456
|
+
config?: Record<string, any>;
|
|
457
|
+
props?: Record<string, any>;
|
|
458
|
+
error?: Error;
|
|
459
|
+
}
|
|
460
|
+
interface RouterRenderResult {
|
|
461
|
+
redirect?: string;
|
|
462
|
+
layers: Layer[];
|
|
463
|
+
head: Head;
|
|
464
|
+
element: ReactNode;
|
|
465
|
+
}
|
|
466
|
+
interface PageRequest extends PageReactContext {
|
|
467
|
+
url: URL;
|
|
468
|
+
params: Record<string, any>;
|
|
469
|
+
query: Record<string, string>;
|
|
470
|
+
head: Head;
|
|
471
|
+
previous?: PreviousLayerData[];
|
|
472
|
+
}
|
|
473
|
+
interface CreateLayersResult extends RouterState {
|
|
474
|
+
redirect?: string;
|
|
475
|
+
}
|
|
476
|
+
interface PageReactContext {
|
|
477
|
+
links?: HttpClientLink[];
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
interface NestedViewProps {
|
|
481
|
+
children?: ReactNode;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Nested view component
|
|
485
|
+
*
|
|
486
|
+
* @param props
|
|
487
|
+
* @constructor
|
|
488
|
+
*/
|
|
489
|
+
declare const NestedView: (props: NestedViewProps) => string | number | bigint | boolean | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null;
|
|
490
|
+
|
|
491
|
+
interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
492
|
+
to: string | PageDescriptor;
|
|
493
|
+
children?: react__default.ReactNode;
|
|
494
|
+
}
|
|
495
|
+
declare const Link: (props: LinkProps) => react_jsx_runtime.JSX.Element | null;
|
|
859
496
|
|
|
860
497
|
interface RouterContextValue {
|
|
861
|
-
router: Router;
|
|
862
498
|
alepha: Alepha;
|
|
863
499
|
state: RouterState;
|
|
864
|
-
|
|
500
|
+
context: PageReactContext;
|
|
501
|
+
events: EventEmitter<RouterEvents>;
|
|
865
502
|
}
|
|
866
503
|
declare const RouterContext: react.Context<RouterContextValue | undefined>;
|
|
867
504
|
|
|
@@ -871,35 +508,6 @@ interface RouterLayerContextValue {
|
|
|
871
508
|
}
|
|
872
509
|
declare const RouterLayerContext: react.Context<RouterLayerContextValue | undefined>;
|
|
873
510
|
|
|
874
|
-
declare class Auth {
|
|
875
|
-
alepha: Alepha;
|
|
876
|
-
log: _alepha_core.Logger;
|
|
877
|
-
client: HttpClient;
|
|
878
|
-
api: string;
|
|
879
|
-
start: _alepha_core.HookDescriptor<"start">;
|
|
880
|
-
login: (provider?: string) => void;
|
|
881
|
-
logout: () => void;
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
declare const KEY = "AUTH";
|
|
885
|
-
interface AuthDescriptorOptions {
|
|
886
|
-
name?: string;
|
|
887
|
-
oidc?: {
|
|
888
|
-
issuer: string;
|
|
889
|
-
clientId: string;
|
|
890
|
-
clientSecret?: string;
|
|
891
|
-
redirectUri?: string;
|
|
892
|
-
};
|
|
893
|
-
}
|
|
894
|
-
interface AuthDescriptor {
|
|
895
|
-
[KIND]: typeof KEY;
|
|
896
|
-
options: AuthDescriptorOptions;
|
|
897
|
-
}
|
|
898
|
-
declare const $auth: {
|
|
899
|
-
(options: AuthDescriptorOptions): AuthDescriptor;
|
|
900
|
-
[KIND]: string;
|
|
901
|
-
};
|
|
902
|
-
|
|
903
511
|
declare const useInject: <T extends object>(clazz: Class<T>) => T;
|
|
904
512
|
|
|
905
513
|
declare const useClient: () => HttpClient;
|
|
@@ -911,9 +519,6 @@ interface UseQueryParamsHookOptions {
|
|
|
911
519
|
}
|
|
912
520
|
declare const useQueryParams: <T extends TObject$1>(schema: T, options?: UseQueryParamsHookOptions) => [Static$1<T>, (data: Static$1<T>) => void];
|
|
913
521
|
|
|
914
|
-
/**
|
|
915
|
-
*
|
|
916
|
-
*/
|
|
917
522
|
declare const useRouter: () => RouterHookApi;
|
|
918
523
|
|
|
919
524
|
declare const useRouterEvents: (opts?: {
|
|
@@ -932,112 +537,69 @@ interface UseActiveHook {
|
|
|
932
537
|
name?: string;
|
|
933
538
|
}
|
|
934
539
|
|
|
935
|
-
declare
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
logout: () => void;
|
|
939
|
-
login: (provider?: string) => void;
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
declare class PageDescriptorProvider {
|
|
943
|
-
protected readonly alepha: Alepha;
|
|
944
|
-
protected readonly router: Router;
|
|
945
|
-
protected readonly configure: _alepha_core.HookDescriptor<"configure">;
|
|
946
|
-
/**
|
|
947
|
-
* Transform
|
|
948
|
-
* @param pages
|
|
949
|
-
* @param target
|
|
950
|
-
* @protected
|
|
951
|
-
*/
|
|
952
|
-
protected map(pages: Array<{
|
|
953
|
-
value: {
|
|
954
|
-
options: PageDescriptorOptions;
|
|
955
|
-
};
|
|
956
|
-
}>, target: {
|
|
957
|
-
options: PageDescriptorOptions;
|
|
958
|
-
}): PageRouteEntry;
|
|
540
|
+
declare class RedirectionError extends Error {
|
|
541
|
+
readonly page: HrefLike;
|
|
542
|
+
constructor(page: HrefLike);
|
|
959
543
|
}
|
|
960
544
|
|
|
961
|
-
declare const envSchema
|
|
545
|
+
declare const envSchema: TObject<{
|
|
962
546
|
REACT_SERVER_DIST: TString;
|
|
963
547
|
REACT_SERVER_PREFIX: TString;
|
|
964
548
|
REACT_SSR_ENABLED: TBoolean;
|
|
965
|
-
|
|
549
|
+
REACT_ROOT_ID: TString;
|
|
966
550
|
}>;
|
|
967
551
|
declare module "@alepha/core" {
|
|
968
|
-
interface Env extends Partial<Static$1<typeof envSchema
|
|
552
|
+
interface Env extends Partial<Static$1<typeof envSchema>> {
|
|
969
553
|
}
|
|
970
554
|
interface State {
|
|
971
555
|
"ReactServerProvider.template"?: string;
|
|
556
|
+
"ReactServerProvider.ssr"?: boolean;
|
|
972
557
|
}
|
|
973
558
|
}
|
|
974
559
|
declare class ReactServerProvider {
|
|
975
560
|
protected readonly log: _alepha_core.Logger;
|
|
976
561
|
protected readonly alepha: Alepha;
|
|
977
|
-
protected readonly
|
|
978
|
-
protected readonly
|
|
562
|
+
protected readonly pageDescriptorProvider: PageDescriptorProvider;
|
|
563
|
+
protected readonly serverStaticProvider: ServerStaticProvider;
|
|
564
|
+
protected readonly serverRouterProvider: ServerRouterProvider;
|
|
565
|
+
protected readonly headProvider: ServerHeadProvider;
|
|
979
566
|
protected readonly env: {
|
|
567
|
+
REACT_ROOT_ID: string;
|
|
980
568
|
REACT_SERVER_DIST: string;
|
|
981
569
|
REACT_SERVER_PREFIX: string;
|
|
982
570
|
REACT_SSR_ENABLED: boolean;
|
|
983
|
-
REACT_SSR_OUTLET: string;
|
|
984
571
|
};
|
|
572
|
+
protected readonly ROOT_DIV_REGEX: RegExp;
|
|
985
573
|
protected readonly configure: _alepha_core.HookDescriptor<"configure">;
|
|
986
|
-
protected
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
*/
|
|
999
|
-
protected createStaticHandler(root: string): ServeDescriptorOptions;
|
|
1000
|
-
/**
|
|
1001
|
-
*
|
|
1002
|
-
* @param templateLoader
|
|
1003
|
-
* @protected
|
|
1004
|
-
*/
|
|
1005
|
-
protected createHandler(templateLoader: () => Promise<string | undefined>): CreateRoute;
|
|
1006
|
-
protected processDescriptors(): void;
|
|
1007
|
-
/**
|
|
1008
|
-
*
|
|
1009
|
-
* @param url
|
|
1010
|
-
* @protected
|
|
1011
|
-
*/
|
|
1012
|
-
protected notFoundHandler(url: URL): Response | undefined;
|
|
1013
|
-
/**
|
|
1014
|
-
*
|
|
1015
|
-
* @param url
|
|
1016
|
-
* @param template
|
|
1017
|
-
* @param args
|
|
1018
|
-
*/
|
|
1019
|
-
ssr(url: URL, template?: string, args?: PageContext): Promise<Response>;
|
|
1020
|
-
protected renderHelmetContext(template: string, helmetContext: RouterRenderHelmetContext): string;
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
declare class RedirectionError extends Error {
|
|
1024
|
-
readonly page: HrefLike;
|
|
1025
|
-
constructor(page: HrefLike);
|
|
574
|
+
protected registerPages(templateLoader: () => Promise<string | undefined>): Promise<void>;
|
|
575
|
+
protected getPublicDirectory(): string;
|
|
576
|
+
protected configureStaticServer(root: string): Promise<void>;
|
|
577
|
+
protected configureVite(): Promise<void>;
|
|
578
|
+
protected createRenderFunction(name: string): (options?: {
|
|
579
|
+
params?: Record<string, string>;
|
|
580
|
+
query?: Record<string, string>;
|
|
581
|
+
}) => Promise<string>;
|
|
582
|
+
protected createHandler(page: PageRoute, templateLoader: () => Promise<string | undefined>): ServerHandler;
|
|
583
|
+
fillTemplate(response: {
|
|
584
|
+
html: string;
|
|
585
|
+
}, app: string, script: string): void;
|
|
1026
586
|
}
|
|
1027
587
|
|
|
1028
|
-
declare const envSchema: _alepha_core.TObject<{
|
|
1029
|
-
REACT_AUTH_ENABLED: TBoolean;
|
|
1030
|
-
}>;
|
|
1031
588
|
declare module "@alepha/core" {
|
|
1032
|
-
interface
|
|
589
|
+
interface Hooks {
|
|
590
|
+
"react:browser:render": {
|
|
591
|
+
context: PageReactContext;
|
|
592
|
+
hydration?: ReactHydrationState;
|
|
593
|
+
};
|
|
594
|
+
"react:server:render": {
|
|
595
|
+
request: ServerRequest;
|
|
596
|
+
pageRequest: PageRequest;
|
|
597
|
+
};
|
|
1033
598
|
}
|
|
1034
599
|
}
|
|
1035
600
|
declare class ReactModule {
|
|
1036
|
-
protected readonly env: {
|
|
1037
|
-
REACT_AUTH_ENABLED: boolean;
|
|
1038
|
-
};
|
|
1039
601
|
protected readonly alepha: Alepha;
|
|
1040
602
|
constructor();
|
|
1041
603
|
}
|
|
1042
604
|
|
|
1043
|
-
export { $
|
|
605
|
+
export { $page, type AnchorProps, type CreateLayersResult, type Head, type HrefLike, type Layer, Link, NestedView, type PageConfigSchema, type PageDescriptor, type PageDescriptorOptions, PageDescriptorProvider, type PageReactContext, type PageRequest, type PageRequestConfig, type PageResolve, type PageResolveContext, type PageRoute, type PageRouteEntry, type PreviousLayerData, ReactBrowserProvider, type ReactHydrationState, ReactModule, ReactServerProvider, RedirectionError, RouterContext, type RouterContextValue, type RouterEvents, type RouterGoOptions, RouterHookApi, RouterLayerContext, type RouterLayerContextValue, type RouterRenderResult, type RouterStackItem, type RouterState, type TPropsDefault, type TPropsParentDefault, type TransitionOptions, type UseActiveHook, type UseQueryParamsHookOptions, envSchema, isPageRoute, useActive, useClient, useInject, useQueryParams, useRouter, useRouterEvents, useRouterState };
|