@alepha/react 0.7.6 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.d.ts +26 -81
- package/dist/index.browser.js +11 -61
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +53 -131
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +46 -95
- package/dist/index.d.ts +54 -103
- package/dist/index.js +52 -130
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
- package/src/descriptors/$page.ts +2 -47
- package/src/hooks/useClient.ts +3 -3
- package/src/index.ts +16 -4
- package/src/providers/BrowserRouterProvider.ts +3 -4
- package/src/providers/PageDescriptorProvider.ts +10 -57
- package/src/providers/ReactBrowserProvider.ts +3 -14
- package/src/providers/ReactServerProvider.ts +66 -58
- package/src/providers/BrowserHeadProvider.ts +0 -43
- package/src/providers/ServerHeadProvider.ts +0 -91
package/dist/index.d.cts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alepha_core12 from "@alepha/core";
|
|
2
2
|
import * as _alepha_core18 from "@alepha/core";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _alepha_core16 from "@alepha/core";
|
|
4
4
|
import * as _alepha_core6 from "@alepha/core";
|
|
5
5
|
import { Alepha, Async, KIND, Module, OPTIONS, Service, Static, TObject, TSchema } from "@alepha/core";
|
|
6
|
-
import { ApiLinksResponse,
|
|
7
|
-
import * as
|
|
6
|
+
import { ApiLinksResponse, ServerHandler, ServerRequest, ServerRouterProvider, ServerTimingProvider } from "@alepha/server";
|
|
7
|
+
import * as _sinclair_typebox11 from "@sinclair/typebox";
|
|
8
8
|
import * as _sinclair_typebox1 from "@sinclair/typebox";
|
|
9
|
+
import * as react23 from "react";
|
|
9
10
|
import * as react24 from "react";
|
|
10
|
-
import * as react22 from "react";
|
|
11
11
|
import React, { AnchorHTMLAttributes, ErrorInfo, FC, PropsWithChildren, ReactNode } from "react";
|
|
12
12
|
import { ServerRouteCache } from "@alepha/server-cache";
|
|
13
|
+
import { ClientScope, HttpVirtualClient, LinkProvider } from "@alepha/server-links";
|
|
13
14
|
import { Root } from "react-dom/client";
|
|
14
15
|
import { Route, RouterProvider } from "@alepha/router";
|
|
15
|
-
import * as
|
|
16
|
-
import * as
|
|
16
|
+
import * as react_jsx_runtime21 from "react/jsx-runtime";
|
|
17
|
+
import * as react_jsx_runtime22 from "react/jsx-runtime";
|
|
17
18
|
import { ServerStaticProvider } from "@alepha/server-static";
|
|
18
19
|
|
|
19
20
|
//#region src/components/ClientOnly.d.ts
|
|
@@ -111,7 +112,6 @@ interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSch
|
|
|
111
112
|
[OPTIONS]: PageDescriptorOptions<PageConfigSchema, TPropsParent>;
|
|
112
113
|
};
|
|
113
114
|
can?: () => boolean;
|
|
114
|
-
head?: Head | ((props: TProps, previous?: Head) => Head);
|
|
115
115
|
errorHandler?: (error: Error) => ReactNode;
|
|
116
116
|
prerender?: boolean | {
|
|
117
117
|
entries?: Array<Partial<PageRequestConfig<TConfig>>>;
|
|
@@ -142,49 +142,13 @@ declare const $page: {
|
|
|
142
142
|
interface PageDescriptorRenderOptions {
|
|
143
143
|
params?: Record<string, string>;
|
|
144
144
|
query?: Record<string, string>;
|
|
145
|
-
|
|
145
|
+
html?: boolean;
|
|
146
|
+
hydration?: boolean;
|
|
146
147
|
}
|
|
147
148
|
interface PageDescriptorRenderResult {
|
|
148
149
|
html: string;
|
|
149
150
|
context: PageReactContext;
|
|
150
151
|
}
|
|
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?: {
|
|
174
|
-
title?: string;
|
|
175
|
-
description?: string;
|
|
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
|
-
};
|
|
187
|
-
}
|
|
188
152
|
interface PageRequestConfig<TConfig extends PageConfigSchema = PageConfigSchema> {
|
|
189
153
|
params: TConfig["params"] extends TSchema ? Static<TConfig["params"]> : Record<string, string>;
|
|
190
154
|
query: TConfig["query"] extends TSchema ? Static<TConfig["query"]> : Record<string, string>;
|
|
@@ -192,14 +156,14 @@ interface PageRequestConfig<TConfig extends PageConfigSchema = PageConfigSchema>
|
|
|
192
156
|
type PageResolve<TConfig extends PageConfigSchema = PageConfigSchema, TPropsParent extends object = TPropsParentDefault> = PageRequestConfig<TConfig> & TPropsParent & PageReactContext;
|
|
193
157
|
//#endregion
|
|
194
158
|
//#region src/providers/PageDescriptorProvider.d.ts
|
|
195
|
-
declare const envSchema$1:
|
|
196
|
-
REACT_STRICT_MODE:
|
|
159
|
+
declare const envSchema$1: _alepha_core12.TObject<{
|
|
160
|
+
REACT_STRICT_MODE: _sinclair_typebox11.TBoolean;
|
|
197
161
|
}>;
|
|
198
162
|
declare module "@alepha/core" {
|
|
199
163
|
interface Env extends Partial<Static<typeof envSchema$1>> {}
|
|
200
164
|
}
|
|
201
165
|
declare class PageDescriptorProvider {
|
|
202
|
-
protected readonly log:
|
|
166
|
+
protected readonly log: _alepha_core12.Logger;
|
|
203
167
|
protected readonly env: {
|
|
204
168
|
REACT_STRICT_MODE: boolean;
|
|
205
169
|
};
|
|
@@ -215,7 +179,6 @@ declare class PageDescriptorProvider {
|
|
|
215
179
|
createLayers(route: PageRoute, request: PageRequest): Promise<CreateLayersResult>;
|
|
216
180
|
protected getErrorHandler(route: PageRoute): ((error: Error) => ReactNode) | undefined;
|
|
217
181
|
protected createElement(page: PageRoute, props: Record<string, any>): Promise<ReactNode>;
|
|
218
|
-
protected fillHead(page: PageRoute, ctx: PageRequest, props: Record<string, any>): void;
|
|
219
182
|
renderError(error: Error): ReactNode;
|
|
220
183
|
renderEmptyView(): ReactNode;
|
|
221
184
|
href(page: {
|
|
@@ -225,7 +188,7 @@ declare class PageDescriptorProvider {
|
|
|
225
188
|
}, params?: Record<string, any>): string;
|
|
226
189
|
compile(path: string, params?: Record<string, string>): string;
|
|
227
190
|
protected renderView(index: number, path: string, view: ReactNode | undefined, page: PageRoute): ReactNode;
|
|
228
|
-
protected readonly configure:
|
|
191
|
+
protected readonly configure: _alepha_core12.HookDescriptor<"configure">;
|
|
229
192
|
protected map(pages: Array<{
|
|
230
193
|
value: {
|
|
231
194
|
[OPTIONS]: PageDescriptorOptions;
|
|
@@ -261,6 +224,7 @@ interface Layer {
|
|
|
261
224
|
element: ReactNode;
|
|
262
225
|
index: number;
|
|
263
226
|
path: string;
|
|
227
|
+
route?: PageRoute;
|
|
264
228
|
}
|
|
265
229
|
type PreviousLayerData = Omit<Layer, "element" | "index" | "path">;
|
|
266
230
|
interface AnchorProps {
|
|
@@ -302,33 +266,10 @@ interface CreateLayersResult extends RouterState {
|
|
|
302
266
|
*/
|
|
303
267
|
interface PageReactContext {
|
|
304
268
|
url: URL;
|
|
305
|
-
head: Head;
|
|
306
269
|
onError: (error: Error) => ReactNode;
|
|
307
270
|
links?: ApiLinksResponse;
|
|
308
271
|
}
|
|
309
272
|
//#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
|
-
}>;
|
|
319
|
-
}
|
|
320
|
-
declare class ServerHeadProvider {
|
|
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;
|
|
325
|
-
}
|
|
326
|
-
//#endregion
|
|
327
|
-
//#region src/providers/BrowserHeadProvider.d.ts
|
|
328
|
-
declare class BrowserHeadProvider {
|
|
329
|
-
renderHead(document: Document, head: Head$1): void;
|
|
330
|
-
}
|
|
331
|
-
//#endregion
|
|
332
273
|
//#region src/providers/BrowserRouterProvider.d.ts
|
|
333
274
|
interface BrowserRoute extends Route {
|
|
334
275
|
page: PageRoute;
|
|
@@ -345,11 +286,10 @@ declare class BrowserRouterProvider extends RouterProvider<BrowserRoute> {
|
|
|
345
286
|
//#endregion
|
|
346
287
|
//#region src/providers/ReactBrowserProvider.d.ts
|
|
347
288
|
declare class ReactBrowserProvider {
|
|
348
|
-
protected readonly log:
|
|
349
|
-
protected readonly client:
|
|
289
|
+
protected readonly log: _alepha_core16.Logger;
|
|
290
|
+
protected readonly client: LinkProvider;
|
|
350
291
|
protected readonly alepha: Alepha;
|
|
351
292
|
protected readonly router: BrowserRouterProvider;
|
|
352
|
-
protected readonly headProvider: BrowserHeadProvider;
|
|
353
293
|
protected root: Root;
|
|
354
294
|
transitioning?: {
|
|
355
295
|
to: string;
|
|
@@ -368,8 +308,7 @@ declare class ReactBrowserProvider {
|
|
|
368
308
|
* Get embedded layers from the server.
|
|
369
309
|
*/
|
|
370
310
|
protected getHydrationState(): ReactHydrationState | undefined;
|
|
371
|
-
readonly ready:
|
|
372
|
-
readonly onTransitionEnd: _alepha_core15.HookDescriptor<"react:transition:end">;
|
|
311
|
+
readonly ready: _alepha_core16.HookDescriptor<"ready">;
|
|
373
312
|
}
|
|
374
313
|
interface RouterGoOptions {
|
|
375
314
|
replace?: boolean;
|
|
@@ -426,7 +365,7 @@ interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
|
426
365
|
to: string | PageDescriptor;
|
|
427
366
|
children?: React.ReactNode;
|
|
428
367
|
}
|
|
429
|
-
declare const Link: (props: LinkProps) =>
|
|
368
|
+
declare const Link: (props: LinkProps) => react_jsx_runtime21.JSX.Element | null;
|
|
430
369
|
//#endregion
|
|
431
370
|
//#region src/components/NestedView.d.ts
|
|
432
371
|
interface NestedViewProps {
|
|
@@ -453,7 +392,7 @@ interface NestedViewProps {
|
|
|
453
392
|
* }
|
|
454
393
|
* ```
|
|
455
394
|
*/
|
|
456
|
-
declare const NestedView: (props: NestedViewProps) =>
|
|
395
|
+
declare const NestedView: (props: NestedViewProps) => react_jsx_runtime22.JSX.Element;
|
|
457
396
|
//#endregion
|
|
458
397
|
//#region src/contexts/RouterContext.d.ts
|
|
459
398
|
interface RouterContextValue {
|
|
@@ -461,14 +400,14 @@ interface RouterContextValue {
|
|
|
461
400
|
state: RouterState;
|
|
462
401
|
context: PageReactContext;
|
|
463
402
|
}
|
|
464
|
-
declare const RouterContext:
|
|
403
|
+
declare const RouterContext: react23.Context<RouterContextValue | undefined>;
|
|
465
404
|
//#endregion
|
|
466
405
|
//#region src/contexts/RouterLayerContext.d.ts
|
|
467
406
|
interface RouterLayerContextValue {
|
|
468
407
|
index: number;
|
|
469
408
|
path: string;
|
|
470
409
|
}
|
|
471
|
-
declare const RouterLayerContext:
|
|
410
|
+
declare const RouterLayerContext: react24.Context<RouterLayerContextValue | undefined>;
|
|
472
411
|
//#endregion
|
|
473
412
|
//#region src/hooks/RouterHookApi.d.ts
|
|
474
413
|
declare class RouterHookApi {
|
|
@@ -597,7 +536,6 @@ declare class ReactServerProvider {
|
|
|
597
536
|
protected readonly pageDescriptorProvider: PageDescriptorProvider;
|
|
598
537
|
protected readonly serverStaticProvider: ServerStaticProvider;
|
|
599
538
|
protected readonly serverRouterProvider: ServerRouterProvider;
|
|
600
|
-
protected readonly headProvider: ServerHeadProvider;
|
|
601
539
|
protected readonly serverTimingProvider: ServerTimingProvider;
|
|
602
540
|
protected readonly env: {
|
|
603
541
|
REACT_SSR_ENABLED?: boolean | undefined;
|
|
@@ -607,7 +545,7 @@ declare class ReactServerProvider {
|
|
|
607
545
|
};
|
|
608
546
|
protected readonly ROOT_DIV_REGEX: RegExp;
|
|
609
547
|
readonly onConfigure: _alepha_core6.HookDescriptor<"configure">;
|
|
610
|
-
get template(): string
|
|
548
|
+
get template(): string;
|
|
611
549
|
protected registerPages(templateLoader: TemplateLoader): Promise<void>;
|
|
612
550
|
protected getPublicDirectory(): string;
|
|
613
551
|
protected configureStaticServer(root: string): Promise<void>;
|
|
@@ -615,15 +553,16 @@ declare class ReactServerProvider {
|
|
|
615
553
|
/**
|
|
616
554
|
* For testing purposes, creates a render function that can be used.
|
|
617
555
|
*/
|
|
618
|
-
protected createRenderFunction(name: string, withIndex?: boolean): (options?: {
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
556
|
+
protected createRenderFunction(name: string, withIndex?: boolean): (options?: PageDescriptorRenderOptions) => Promise<{
|
|
557
|
+
context: PageRequest;
|
|
558
|
+
state: CreateLayersResult;
|
|
559
|
+
html: string;
|
|
560
|
+
} | {
|
|
622
561
|
context: PageRequest;
|
|
623
562
|
html: string;
|
|
624
563
|
}>;
|
|
625
564
|
protected createHandler(page: PageRoute, templateLoader: TemplateLoader): ServerHandler;
|
|
626
|
-
renderToHtml(template: string, state: RouterState, context: PageReactContext): string;
|
|
565
|
+
renderToHtml(template: string, state: RouterState, context: PageReactContext, hydration?: boolean): string;
|
|
627
566
|
protected fillTemplate(response: {
|
|
628
567
|
html: string;
|
|
629
568
|
}, app: string, script: string): void;
|
|
@@ -633,21 +572,33 @@ type TemplateLoader = () => Promise<string | undefined>;
|
|
|
633
572
|
//#region src/index.d.ts
|
|
634
573
|
declare module "@alepha/core" {
|
|
635
574
|
interface Hooks {
|
|
575
|
+
"react:router:createLayers": {
|
|
576
|
+
request: ServerRequest;
|
|
577
|
+
context: PageRequest;
|
|
578
|
+
layers: PageRequest[];
|
|
579
|
+
};
|
|
580
|
+
"react:server:render:begin": {
|
|
581
|
+
request?: ServerRequest;
|
|
582
|
+
context: PageRequest;
|
|
583
|
+
};
|
|
584
|
+
"react:server:render:end": {
|
|
585
|
+
request?: ServerRequest;
|
|
586
|
+
context: PageRequest;
|
|
587
|
+
state: RouterState;
|
|
588
|
+
html: string;
|
|
589
|
+
};
|
|
636
590
|
"react:browser:render": {
|
|
637
591
|
state: RouterState;
|
|
638
592
|
context: PageReactContext;
|
|
639
593
|
hydration?: ReactHydrationState;
|
|
640
594
|
};
|
|
641
|
-
"react:server:render": {
|
|
642
|
-
request: ServerRequest;
|
|
643
|
-
pageRequest: PageRequest;
|
|
644
|
-
};
|
|
645
595
|
"react:transition:begin": {
|
|
646
596
|
state: RouterState;
|
|
647
597
|
context: PageReactContext;
|
|
648
598
|
};
|
|
649
599
|
"react:transition:success": {
|
|
650
600
|
state: RouterState;
|
|
601
|
+
context: PageReactContext;
|
|
651
602
|
};
|
|
652
603
|
"react:transition:error": {
|
|
653
604
|
error: Error;
|
|
@@ -674,5 +625,5 @@ declare class AlephaReact implements Module {
|
|
|
674
625
|
readonly $services: (alepha: Alepha) => Alepha;
|
|
675
626
|
}
|
|
676
627
|
//#endregion
|
|
677
|
-
export { $page, AlephaReact, AnchorProps, ClientOnly, CreateLayersResult, ErrorBoundary,
|
|
628
|
+
export { $page, AlephaReact, AnchorProps, ClientOnly, CreateLayersResult, ErrorBoundary, HrefLike, Layer, Link, NestedView, PageConfigSchema, PageDescriptor, PageDescriptorOptions, PageDescriptorProvider, PageDescriptorRenderOptions, PageDescriptorRenderResult, PageReactContext, PageRequest, PageRequestConfig, PageResolve, PageRoute, PageRouteEntry, PreviousLayerData, ReactBrowserProvider, ReactHydrationState, ReactServerProvider, RedirectionError, RouterContext, RouterContextValue, RouterGoOptions, RouterHookApi, RouterLayerContext, RouterLayerContextValue, RouterRenderResult, RouterStackItem, RouterState, TPropsDefault, TPropsParentDefault, TransitionOptions, UseActiveHook, UseQueryParamsHookOptions, VirtualRouter, isPageRoute, useActive, useAlepha, useClient, useInject, useQueryParams, useRouter, useRouterEvents, useRouterState };
|
|
678
629
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alepha_core12 from "@alepha/core";
|
|
2
2
|
import * as _alepha_core23 from "@alepha/core";
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
3
|
+
import * as _alepha_core16 from "@alepha/core";
|
|
4
|
+
import * as _alepha_core6 from "@alepha/core";
|
|
5
5
|
import { Alepha, Async, KIND, Module, OPTIONS, Service, Static, TObject, TSchema } from "@alepha/core";
|
|
6
|
-
import { ApiLinksResponse,
|
|
6
|
+
import { ApiLinksResponse, ServerHandler, ServerRequest, ServerRouterProvider, ServerTimingProvider } from "@alepha/server";
|
|
7
7
|
import { ServerRouteCache } from "@alepha/server-cache";
|
|
8
|
-
import * as
|
|
9
|
-
import * as
|
|
8
|
+
import * as react19 from "react";
|
|
9
|
+
import * as react20 from "react";
|
|
10
10
|
import React, { AnchorHTMLAttributes, ErrorInfo, FC, PropsWithChildren, ReactNode } from "react";
|
|
11
|
-
import * as react_jsx_runtime20 from "react/jsx-runtime";
|
|
12
11
|
import * as react_jsx_runtime22 from "react/jsx-runtime";
|
|
12
|
+
import * as react_jsx_runtime21 from "react/jsx-runtime";
|
|
13
|
+
import { ClientScope, HttpVirtualClient, LinkProvider } from "@alepha/server-links";
|
|
13
14
|
import { ServerStaticProvider } from "@alepha/server-static";
|
|
14
15
|
import { Route, RouterProvider } from "@alepha/router";
|
|
16
|
+
import * as _sinclair_typebox11 from "@sinclair/typebox";
|
|
15
17
|
import * as _sinclair_typebox1 from "@sinclair/typebox";
|
|
16
|
-
import * as _sinclair_typebox6 from "@sinclair/typebox";
|
|
17
18
|
import { Root } from "react-dom/client";
|
|
18
19
|
|
|
19
20
|
//#region src/components/ClientOnly.d.ts
|
|
@@ -111,7 +112,6 @@ interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSch
|
|
|
111
112
|
[OPTIONS]: PageDescriptorOptions<PageConfigSchema, TPropsParent>;
|
|
112
113
|
};
|
|
113
114
|
can?: () => boolean;
|
|
114
|
-
head?: Head | ((props: TProps, previous?: Head) => Head);
|
|
115
115
|
errorHandler?: (error: Error) => ReactNode;
|
|
116
116
|
prerender?: boolean | {
|
|
117
117
|
entries?: Array<Partial<PageRequestConfig<TConfig>>>;
|
|
@@ -142,49 +142,13 @@ declare const $page: {
|
|
|
142
142
|
interface PageDescriptorRenderOptions {
|
|
143
143
|
params?: Record<string, string>;
|
|
144
144
|
query?: Record<string, string>;
|
|
145
|
-
|
|
145
|
+
html?: boolean;
|
|
146
|
+
hydration?: boolean;
|
|
146
147
|
}
|
|
147
148
|
interface PageDescriptorRenderResult {
|
|
148
149
|
html: string;
|
|
149
150
|
context: PageReactContext;
|
|
150
151
|
}
|
|
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?: {
|
|
174
|
-
title?: string;
|
|
175
|
-
description?: string;
|
|
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
|
-
};
|
|
187
|
-
}
|
|
188
152
|
interface PageRequestConfig<TConfig extends PageConfigSchema = PageConfigSchema> {
|
|
189
153
|
params: TConfig["params"] extends TSchema ? Static<TConfig["params"]> : Record<string, string>;
|
|
190
154
|
query: TConfig["query"] extends TSchema ? Static<TConfig["query"]> : Record<string, string>;
|
|
@@ -192,14 +156,14 @@ interface PageRequestConfig<TConfig extends PageConfigSchema = PageConfigSchema>
|
|
|
192
156
|
type PageResolve<TConfig extends PageConfigSchema = PageConfigSchema, TPropsParent extends object = TPropsParentDefault> = PageRequestConfig<TConfig> & TPropsParent & PageReactContext;
|
|
193
157
|
//#endregion
|
|
194
158
|
//#region src/providers/PageDescriptorProvider.d.ts
|
|
195
|
-
declare const envSchema$1:
|
|
196
|
-
REACT_STRICT_MODE:
|
|
159
|
+
declare const envSchema$1: _alepha_core12.TObject<{
|
|
160
|
+
REACT_STRICT_MODE: _sinclair_typebox11.TBoolean;
|
|
197
161
|
}>;
|
|
198
162
|
declare module "@alepha/core" {
|
|
199
163
|
interface Env extends Partial<Static<typeof envSchema$1>> {}
|
|
200
164
|
}
|
|
201
165
|
declare class PageDescriptorProvider {
|
|
202
|
-
protected readonly log:
|
|
166
|
+
protected readonly log: _alepha_core12.Logger;
|
|
203
167
|
protected readonly env: {
|
|
204
168
|
REACT_STRICT_MODE: boolean;
|
|
205
169
|
};
|
|
@@ -215,7 +179,6 @@ declare class PageDescriptorProvider {
|
|
|
215
179
|
createLayers(route: PageRoute, request: PageRequest): Promise<CreateLayersResult>;
|
|
216
180
|
protected getErrorHandler(route: PageRoute): ((error: Error) => ReactNode) | undefined;
|
|
217
181
|
protected createElement(page: PageRoute, props: Record<string, any>): Promise<ReactNode>;
|
|
218
|
-
protected fillHead(page: PageRoute, ctx: PageRequest, props: Record<string, any>): void;
|
|
219
182
|
renderError(error: Error): ReactNode;
|
|
220
183
|
renderEmptyView(): ReactNode;
|
|
221
184
|
href(page: {
|
|
@@ -225,7 +188,7 @@ declare class PageDescriptorProvider {
|
|
|
225
188
|
}, params?: Record<string, any>): string;
|
|
226
189
|
compile(path: string, params?: Record<string, string>): string;
|
|
227
190
|
protected renderView(index: number, path: string, view: ReactNode | undefined, page: PageRoute): ReactNode;
|
|
228
|
-
protected readonly configure:
|
|
191
|
+
protected readonly configure: _alepha_core12.HookDescriptor<"configure">;
|
|
229
192
|
protected map(pages: Array<{
|
|
230
193
|
value: {
|
|
231
194
|
[OPTIONS]: PageDescriptorOptions;
|
|
@@ -261,6 +224,7 @@ interface Layer {
|
|
|
261
224
|
element: ReactNode;
|
|
262
225
|
index: number;
|
|
263
226
|
path: string;
|
|
227
|
+
route?: PageRoute;
|
|
264
228
|
}
|
|
265
229
|
type PreviousLayerData = Omit<Layer, "element" | "index" | "path">;
|
|
266
230
|
interface AnchorProps {
|
|
@@ -302,33 +266,10 @@ interface CreateLayersResult extends RouterState {
|
|
|
302
266
|
*/
|
|
303
267
|
interface PageReactContext {
|
|
304
268
|
url: URL;
|
|
305
|
-
head: Head;
|
|
306
269
|
onError: (error: Error) => ReactNode;
|
|
307
270
|
links?: ApiLinksResponse;
|
|
308
271
|
}
|
|
309
272
|
//#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
|
-
}>;
|
|
319
|
-
}
|
|
320
|
-
declare class ServerHeadProvider {
|
|
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;
|
|
325
|
-
}
|
|
326
|
-
//#endregion
|
|
327
|
-
//#region src/providers/BrowserHeadProvider.d.ts
|
|
328
|
-
declare class BrowserHeadProvider {
|
|
329
|
-
renderHead(document: Document, head: Head$1): void;
|
|
330
|
-
}
|
|
331
|
-
//#endregion
|
|
332
273
|
//#region src/providers/BrowserRouterProvider.d.ts
|
|
333
274
|
interface BrowserRoute extends Route {
|
|
334
275
|
page: PageRoute;
|
|
@@ -345,11 +286,10 @@ declare class BrowserRouterProvider extends RouterProvider<BrowserRoute> {
|
|
|
345
286
|
//#endregion
|
|
346
287
|
//#region src/providers/ReactBrowserProvider.d.ts
|
|
347
288
|
declare class ReactBrowserProvider {
|
|
348
|
-
protected readonly log:
|
|
349
|
-
protected readonly client:
|
|
289
|
+
protected readonly log: _alepha_core16.Logger;
|
|
290
|
+
protected readonly client: LinkProvider;
|
|
350
291
|
protected readonly alepha: Alepha;
|
|
351
292
|
protected readonly router: BrowserRouterProvider;
|
|
352
|
-
protected readonly headProvider: BrowserHeadProvider;
|
|
353
293
|
protected root: Root;
|
|
354
294
|
transitioning?: {
|
|
355
295
|
to: string;
|
|
@@ -368,8 +308,7 @@ declare class ReactBrowserProvider {
|
|
|
368
308
|
* Get embedded layers from the server.
|
|
369
309
|
*/
|
|
370
310
|
protected getHydrationState(): ReactHydrationState | undefined;
|
|
371
|
-
readonly ready:
|
|
372
|
-
readonly onTransitionEnd: _alepha_core15.HookDescriptor<"react:transition:end">;
|
|
311
|
+
readonly ready: _alepha_core16.HookDescriptor<"ready">;
|
|
373
312
|
}
|
|
374
313
|
interface RouterGoOptions {
|
|
375
314
|
replace?: boolean;
|
|
@@ -426,7 +365,7 @@ interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
|
426
365
|
to: string | PageDescriptor;
|
|
427
366
|
children?: React.ReactNode;
|
|
428
367
|
}
|
|
429
|
-
declare const Link: (props: LinkProps) =>
|
|
368
|
+
declare const Link: (props: LinkProps) => react_jsx_runtime22.JSX.Element | null;
|
|
430
369
|
//#endregion
|
|
431
370
|
//#region src/components/NestedView.d.ts
|
|
432
371
|
interface NestedViewProps {
|
|
@@ -453,7 +392,7 @@ interface NestedViewProps {
|
|
|
453
392
|
* }
|
|
454
393
|
* ```
|
|
455
394
|
*/
|
|
456
|
-
declare const NestedView: (props: NestedViewProps) =>
|
|
395
|
+
declare const NestedView: (props: NestedViewProps) => react_jsx_runtime21.JSX.Element;
|
|
457
396
|
//#endregion
|
|
458
397
|
//#region src/contexts/RouterContext.d.ts
|
|
459
398
|
interface RouterContextValue {
|
|
@@ -461,14 +400,14 @@ interface RouterContextValue {
|
|
|
461
400
|
state: RouterState;
|
|
462
401
|
context: PageReactContext;
|
|
463
402
|
}
|
|
464
|
-
declare const RouterContext:
|
|
403
|
+
declare const RouterContext: react19.Context<RouterContextValue | undefined>;
|
|
465
404
|
//#endregion
|
|
466
405
|
//#region src/contexts/RouterLayerContext.d.ts
|
|
467
406
|
interface RouterLayerContextValue {
|
|
468
407
|
index: number;
|
|
469
408
|
path: string;
|
|
470
409
|
}
|
|
471
|
-
declare const RouterLayerContext:
|
|
410
|
+
declare const RouterLayerContext: react20.Context<RouterLayerContextValue | undefined>;
|
|
472
411
|
//#endregion
|
|
473
412
|
//#region src/hooks/RouterHookApi.d.ts
|
|
474
413
|
declare class RouterHookApi {
|
|
@@ -578,11 +517,11 @@ declare const useRouterEvents: (opts?: {
|
|
|
578
517
|
declare const useRouterState: () => RouterState;
|
|
579
518
|
//#endregion
|
|
580
519
|
//#region src/providers/ReactServerProvider.d.ts
|
|
581
|
-
declare const envSchema:
|
|
582
|
-
REACT_SERVER_DIST:
|
|
583
|
-
REACT_SERVER_PREFIX:
|
|
584
|
-
REACT_SSR_ENABLED:
|
|
585
|
-
REACT_ROOT_ID:
|
|
520
|
+
declare const envSchema: _alepha_core6.TObject<{
|
|
521
|
+
REACT_SERVER_DIST: _sinclair_typebox1.TString;
|
|
522
|
+
REACT_SERVER_PREFIX: _sinclair_typebox1.TString;
|
|
523
|
+
REACT_SSR_ENABLED: _sinclair_typebox1.TOptional<_sinclair_typebox1.TBoolean>;
|
|
524
|
+
REACT_ROOT_ID: _sinclair_typebox1.TString;
|
|
586
525
|
}>;
|
|
587
526
|
declare module "@alepha/core" {
|
|
588
527
|
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
@@ -592,12 +531,11 @@ declare module "@alepha/core" {
|
|
|
592
531
|
}
|
|
593
532
|
}
|
|
594
533
|
declare class ReactServerProvider {
|
|
595
|
-
protected readonly log:
|
|
534
|
+
protected readonly log: _alepha_core6.Logger;
|
|
596
535
|
protected readonly alepha: Alepha;
|
|
597
536
|
protected readonly pageDescriptorProvider: PageDescriptorProvider;
|
|
598
537
|
protected readonly serverStaticProvider: ServerStaticProvider;
|
|
599
538
|
protected readonly serverRouterProvider: ServerRouterProvider;
|
|
600
|
-
protected readonly headProvider: ServerHeadProvider;
|
|
601
539
|
protected readonly serverTimingProvider: ServerTimingProvider;
|
|
602
540
|
protected readonly env: {
|
|
603
541
|
REACT_SSR_ENABLED?: boolean | undefined;
|
|
@@ -606,8 +544,8 @@ declare class ReactServerProvider {
|
|
|
606
544
|
REACT_ROOT_ID: string;
|
|
607
545
|
};
|
|
608
546
|
protected readonly ROOT_DIV_REGEX: RegExp;
|
|
609
|
-
readonly onConfigure:
|
|
610
|
-
get template(): string
|
|
547
|
+
readonly onConfigure: _alepha_core6.HookDescriptor<"configure">;
|
|
548
|
+
get template(): string;
|
|
611
549
|
protected registerPages(templateLoader: TemplateLoader): Promise<void>;
|
|
612
550
|
protected getPublicDirectory(): string;
|
|
613
551
|
protected configureStaticServer(root: string): Promise<void>;
|
|
@@ -615,15 +553,16 @@ declare class ReactServerProvider {
|
|
|
615
553
|
/**
|
|
616
554
|
* For testing purposes, creates a render function that can be used.
|
|
617
555
|
*/
|
|
618
|
-
protected createRenderFunction(name: string, withIndex?: boolean): (options?: {
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
556
|
+
protected createRenderFunction(name: string, withIndex?: boolean): (options?: PageDescriptorRenderOptions) => Promise<{
|
|
557
|
+
context: PageRequest;
|
|
558
|
+
state: CreateLayersResult;
|
|
559
|
+
html: string;
|
|
560
|
+
} | {
|
|
622
561
|
context: PageRequest;
|
|
623
562
|
html: string;
|
|
624
563
|
}>;
|
|
625
564
|
protected createHandler(page: PageRoute, templateLoader: TemplateLoader): ServerHandler;
|
|
626
|
-
renderToHtml(template: string, state: RouterState, context: PageReactContext): string;
|
|
565
|
+
renderToHtml(template: string, state: RouterState, context: PageReactContext, hydration?: boolean): string;
|
|
627
566
|
protected fillTemplate(response: {
|
|
628
567
|
html: string;
|
|
629
568
|
}, app: string, script: string): void;
|
|
@@ -633,21 +572,33 @@ type TemplateLoader = () => Promise<string | undefined>;
|
|
|
633
572
|
//#region src/index.d.ts
|
|
634
573
|
declare module "@alepha/core" {
|
|
635
574
|
interface Hooks {
|
|
575
|
+
"react:router:createLayers": {
|
|
576
|
+
request: ServerRequest;
|
|
577
|
+
context: PageRequest;
|
|
578
|
+
layers: PageRequest[];
|
|
579
|
+
};
|
|
580
|
+
"react:server:render:begin": {
|
|
581
|
+
request?: ServerRequest;
|
|
582
|
+
context: PageRequest;
|
|
583
|
+
};
|
|
584
|
+
"react:server:render:end": {
|
|
585
|
+
request?: ServerRequest;
|
|
586
|
+
context: PageRequest;
|
|
587
|
+
state: RouterState;
|
|
588
|
+
html: string;
|
|
589
|
+
};
|
|
636
590
|
"react:browser:render": {
|
|
637
591
|
state: RouterState;
|
|
638
592
|
context: PageReactContext;
|
|
639
593
|
hydration?: ReactHydrationState;
|
|
640
594
|
};
|
|
641
|
-
"react:server:render": {
|
|
642
|
-
request: ServerRequest;
|
|
643
|
-
pageRequest: PageRequest;
|
|
644
|
-
};
|
|
645
595
|
"react:transition:begin": {
|
|
646
596
|
state: RouterState;
|
|
647
597
|
context: PageReactContext;
|
|
648
598
|
};
|
|
649
599
|
"react:transition:success": {
|
|
650
600
|
state: RouterState;
|
|
601
|
+
context: PageReactContext;
|
|
651
602
|
};
|
|
652
603
|
"react:transition:error": {
|
|
653
604
|
error: Error;
|
|
@@ -674,5 +625,5 @@ declare class AlephaReact implements Module {
|
|
|
674
625
|
readonly $services: (alepha: Alepha) => Alepha;
|
|
675
626
|
}
|
|
676
627
|
//#endregion
|
|
677
|
-
export { $page, AlephaReact, AnchorProps, ClientOnly, CreateLayersResult, ErrorBoundary,
|
|
628
|
+
export { $page, AlephaReact, AnchorProps, ClientOnly, CreateLayersResult, ErrorBoundary, HrefLike, Layer, Link, NestedView, PageConfigSchema, PageDescriptor, PageDescriptorOptions, PageDescriptorProvider, PageDescriptorRenderOptions, PageDescriptorRenderResult, PageReactContext, PageRequest, PageRequestConfig, PageResolve, PageRoute, PageRouteEntry, PreviousLayerData, ReactBrowserProvider, ReactHydrationState, ReactServerProvider, RedirectionError, RouterContext, RouterContextValue, RouterGoOptions, RouterHookApi, RouterLayerContext, RouterLayerContextValue, RouterRenderResult, RouterStackItem, RouterState, TPropsDefault, TPropsParentDefault, TransitionOptions, UseActiveHook, UseQueryParamsHookOptions, VirtualRouter, isPageRoute, useActive, useAlepha, useClient, useInject, useQueryParams, useRouter, useRouterEvents, useRouterState };
|
|
678
629
|
//# sourceMappingURL=index.d.ts.map
|