@alepha/react 0.6.4 → 0.6.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.cjs +1 -1
- package/dist/index.browser.js +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +34 -24
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/{useActive-QkvcaSmu.js → useActive-BzjLwZjs.js} +97 -73
- package/dist/useActive-BzjLwZjs.js.map +1 -0
- package/dist/{useActive-BGtt_RNQ.cjs → useActive-Ce3Xvs5V.cjs} +96 -72
- package/dist/useActive-Ce3Xvs5V.cjs.map +1 -0
- package/package.json +46 -42
- package/src/components/Link.tsx +5 -3
- package/src/components/NestedView.tsx +9 -7
- package/src/contexts/RouterContext.ts +1 -3
- package/src/descriptors/$page.ts +11 -12
- package/src/hooks/useActive.ts +5 -5
- package/src/hooks/useRouterEvents.ts +25 -10
- package/src/hooks/useRouterState.ts +6 -8
- package/src/index.ts +15 -0
- package/src/providers/BrowserRouterProvider.ts +15 -9
- package/src/providers/PageDescriptorProvider.ts +9 -21
- package/src/providers/ReactBrowserProvider.ts +12 -3
- package/src/providers/ReactServerProvider.ts +10 -2
- package/dist/useActive-BGtt_RNQ.cjs.map +0 -1
- package/dist/useActive-QkvcaSmu.js.map +0 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { Alepha
|
|
1
|
+
import type { Alepha } from "@alepha/core";
|
|
2
2
|
import { createContext } from "react";
|
|
3
3
|
import type {
|
|
4
4
|
PageReactContext,
|
|
5
|
-
RouterEvents,
|
|
6
5
|
RouterState,
|
|
7
6
|
} from "../providers/PageDescriptorProvider.ts";
|
|
8
7
|
|
|
@@ -10,7 +9,6 @@ export interface RouterContextValue {
|
|
|
10
9
|
alepha: Alepha;
|
|
11
10
|
state: RouterState;
|
|
12
11
|
context: PageReactContext;
|
|
13
|
-
events: EventEmitter<RouterEvents>;
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
export const RouterContext = createContext<RouterContextValue | undefined>(
|
package/src/descriptors/$page.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Async, OPTIONS, type Static, type TSchema } from "@alepha/core";
|
|
2
2
|
import { KIND, NotImplementedError, __descriptor } from "@alepha/core";
|
|
3
3
|
import type { FC } from "react";
|
|
4
4
|
import type { RouterHookApi } from "../hooks/RouterHookApi.ts";
|
|
@@ -31,16 +31,14 @@ export interface PageDescriptorOptions<
|
|
|
31
31
|
|
|
32
32
|
lazy?: () => Promise<{ default: FC<TProps & TPropsParent> }>;
|
|
33
33
|
|
|
34
|
-
children?: Array<{
|
|
34
|
+
children?: Array<{ [OPTIONS]: PageDescriptorOptions }>;
|
|
35
35
|
|
|
36
|
-
parent?: {
|
|
36
|
+
parent?: { [OPTIONS]: PageDescriptorOptions<any, TPropsParent> };
|
|
37
37
|
|
|
38
38
|
can?: () => boolean;
|
|
39
39
|
|
|
40
40
|
head?: Head | ((props: TProps, previous?: Head) => Head);
|
|
41
41
|
|
|
42
|
-
notFoundHandler?: FC<{ url: string }>;
|
|
43
|
-
|
|
44
42
|
errorHandler?: FC<{ error: Error; url: string }>;
|
|
45
43
|
}
|
|
46
44
|
|
|
@@ -50,6 +48,8 @@ export interface PageDescriptor<
|
|
|
50
48
|
TPropsParent extends object = TPropsParentDefault,
|
|
51
49
|
> {
|
|
52
50
|
[KIND]: typeof KEY;
|
|
51
|
+
[OPTIONS]: PageDescriptorOptions<TConfig, TProps, TPropsParent>;
|
|
52
|
+
|
|
53
53
|
render: (options?: {
|
|
54
54
|
params?: Record<string, string>;
|
|
55
55
|
query?: Record<string, string>;
|
|
@@ -59,7 +59,6 @@ export interface PageDescriptor<
|
|
|
59
59
|
href: string;
|
|
60
60
|
onClick: () => void;
|
|
61
61
|
};
|
|
62
|
-
options: PageDescriptorOptions<TConfig, TProps, TPropsParent>;
|
|
63
62
|
can: () => boolean;
|
|
64
63
|
}
|
|
65
64
|
|
|
@@ -74,22 +73,22 @@ export const $page = <
|
|
|
74
73
|
|
|
75
74
|
if (options.children) {
|
|
76
75
|
for (const child of options.children) {
|
|
77
|
-
child.
|
|
78
|
-
|
|
76
|
+
child[OPTIONS].parent = {
|
|
77
|
+
[OPTIONS]: options as PageDescriptorOptions<any, any, any>,
|
|
79
78
|
};
|
|
80
79
|
}
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
if (options.parent) {
|
|
84
|
-
options.parent.
|
|
85
|
-
options.parent.
|
|
86
|
-
|
|
83
|
+
options.parent[OPTIONS].children ??= [];
|
|
84
|
+
options.parent[OPTIONS].children.push({
|
|
85
|
+
[OPTIONS]: options as PageDescriptorOptions<any, any, any>,
|
|
87
86
|
});
|
|
88
87
|
}
|
|
89
88
|
|
|
90
89
|
return {
|
|
91
90
|
[KIND]: KEY,
|
|
92
|
-
options,
|
|
91
|
+
[OPTIONS]: options,
|
|
93
92
|
render: () => {
|
|
94
93
|
throw new NotImplementedError(KEY);
|
|
95
94
|
},
|
package/src/hooks/useActive.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { useContext,
|
|
1
|
+
import { useContext, useMemo, useState } from "react";
|
|
2
2
|
import { RouterContext } from "../contexts/RouterContext.ts";
|
|
3
3
|
import { RouterLayerContext } from "../contexts/RouterLayerContext.ts";
|
|
4
4
|
import type { AnchorProps } from "../providers/PageDescriptorProvider.ts";
|
|
5
5
|
import type { HrefLike } from "./RouterHookApi.ts";
|
|
6
6
|
import { useRouter } from "./useRouter.ts";
|
|
7
|
+
import { useRouterEvents } from "./useRouterEvents.ts";
|
|
7
8
|
|
|
8
9
|
export const useActive = (path: HrefLike): UseActiveHook => {
|
|
9
10
|
const router = useRouter();
|
|
@@ -23,10 +24,9 @@ export const useActive = (path: HrefLike): UseActiveHook => {
|
|
|
23
24
|
const [isPending, setPending] = useState(false);
|
|
24
25
|
const isActive = current === href;
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
);
|
|
27
|
+
useRouterEvents({
|
|
28
|
+
onEnd: ({ state }) => setCurrent(state.pathname),
|
|
29
|
+
});
|
|
30
30
|
|
|
31
31
|
return {
|
|
32
32
|
name,
|
|
@@ -1,37 +1,52 @@
|
|
|
1
1
|
import { useContext, useEffect } from "react";
|
|
2
2
|
import { RouterContext } from "../contexts/RouterContext.ts";
|
|
3
|
-
import { RouterLayerContext } from "../contexts/RouterLayerContext.ts";
|
|
4
3
|
import type { RouterState } from "../providers/PageDescriptorProvider.ts";
|
|
5
4
|
|
|
6
5
|
export const useRouterEvents = (
|
|
7
6
|
opts: {
|
|
8
|
-
onBegin?: () => void;
|
|
9
|
-
onEnd?: (
|
|
10
|
-
onError?: (
|
|
7
|
+
onBegin?: (ev: { state: RouterState }) => void;
|
|
8
|
+
onEnd?: (ev: { state: RouterState }) => void;
|
|
9
|
+
onError?: (ev: { state: RouterState; error: Error }) => void;
|
|
11
10
|
} = {},
|
|
11
|
+
deps: any[] = [],
|
|
12
12
|
) => {
|
|
13
13
|
const ctx = useContext(RouterContext);
|
|
14
|
-
|
|
15
|
-
if (!ctx || !layer) {
|
|
14
|
+
if (!ctx) {
|
|
16
15
|
throw new Error("useRouter must be used within a RouterProvider");
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
useEffect(() => {
|
|
19
|
+
if (!ctx.alepha.isBrowser()) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
20
23
|
const subs: Function[] = [];
|
|
21
24
|
const onBegin = opts.onBegin;
|
|
22
25
|
const onEnd = opts.onEnd;
|
|
23
26
|
const onError = opts.onError;
|
|
24
27
|
|
|
25
28
|
if (onBegin) {
|
|
26
|
-
subs.push(
|
|
29
|
+
subs.push(
|
|
30
|
+
ctx.alepha.on("react:transition:begin", {
|
|
31
|
+
callback: onBegin,
|
|
32
|
+
}),
|
|
33
|
+
);
|
|
27
34
|
}
|
|
28
35
|
|
|
29
36
|
if (onEnd) {
|
|
30
|
-
subs.push(
|
|
37
|
+
subs.push(
|
|
38
|
+
ctx.alepha.on("react:transition:end", {
|
|
39
|
+
callback: onEnd,
|
|
40
|
+
}),
|
|
41
|
+
);
|
|
31
42
|
}
|
|
32
43
|
|
|
33
44
|
if (onError) {
|
|
34
|
-
subs.push(
|
|
45
|
+
subs.push(
|
|
46
|
+
ctx.alepha.on("react:transition:error", {
|
|
47
|
+
callback: onError,
|
|
48
|
+
}),
|
|
49
|
+
);
|
|
35
50
|
}
|
|
36
51
|
|
|
37
52
|
return () => {
|
|
@@ -39,5 +54,5 @@ export const useRouterEvents = (
|
|
|
39
54
|
sub();
|
|
40
55
|
}
|
|
41
56
|
};
|
|
42
|
-
},
|
|
57
|
+
}, deps);
|
|
43
58
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { useContext,
|
|
1
|
+
import { useContext, useState } from "react";
|
|
2
2
|
import { RouterContext } from "../contexts/RouterContext.ts";
|
|
3
3
|
import { RouterLayerContext } from "../contexts/RouterLayerContext.ts";
|
|
4
4
|
import type { RouterState } from "../providers/PageDescriptorProvider.ts";
|
|
5
|
+
import { useRouterEvents } from "./useRouterEvents.ts";
|
|
5
6
|
|
|
6
7
|
export const useRouterState = (): RouterState => {
|
|
7
8
|
const ctx = useContext(RouterContext);
|
|
@@ -11,13 +12,10 @@ export const useRouterState = (): RouterState => {
|
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
const [state, setState] = useState(ctx.state);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}),
|
|
19
|
-
[],
|
|
20
|
-
);
|
|
15
|
+
|
|
16
|
+
useRouterEvents({
|
|
17
|
+
onEnd: ({ state }) => setState({ ...state }),
|
|
18
|
+
});
|
|
21
19
|
|
|
22
20
|
return state;
|
|
23
21
|
};
|
package/src/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
PageDescriptorProvider,
|
|
10
10
|
type PageReactContext,
|
|
11
11
|
type PageRequest,
|
|
12
|
+
type RouterState,
|
|
12
13
|
} from "./providers/PageDescriptorProvider.ts";
|
|
13
14
|
import type { ReactHydrationState } from "./providers/ReactBrowserProvider.ts";
|
|
14
15
|
import { ReactServerProvider } from "./providers/ReactServerProvider.ts";
|
|
@@ -30,6 +31,20 @@ declare module "@alepha/core" {
|
|
|
30
31
|
request: ServerRequest;
|
|
31
32
|
pageRequest: PageRequest;
|
|
32
33
|
};
|
|
34
|
+
|
|
35
|
+
"react:transition:begin": {
|
|
36
|
+
state: RouterState;
|
|
37
|
+
};
|
|
38
|
+
"react:transition:success": {
|
|
39
|
+
state: RouterState;
|
|
40
|
+
};
|
|
41
|
+
"react:transition:error": {
|
|
42
|
+
error: Error;
|
|
43
|
+
state: RouterState;
|
|
44
|
+
};
|
|
45
|
+
"react:transition:end": {
|
|
46
|
+
state: RouterState;
|
|
47
|
+
};
|
|
33
48
|
}
|
|
34
49
|
}
|
|
35
50
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $hook, $inject, $logger, Alepha
|
|
1
|
+
import { $hook, $inject, $logger, Alepha } from "@alepha/core";
|
|
2
2
|
import { type Route, RouterProvider } from "@alepha/router";
|
|
3
3
|
import type { ReactNode } from "react";
|
|
4
4
|
import {
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
type PageReactContext,
|
|
7
7
|
type PageRoute,
|
|
8
8
|
type PageRouteEntry,
|
|
9
|
-
type RouterEvents,
|
|
10
9
|
type RouterRenderResult,
|
|
11
10
|
type RouterState,
|
|
12
11
|
type TransitionOptions,
|
|
@@ -21,7 +20,6 @@ export class BrowserRouterProvider extends RouterProvider<BrowserRoute> {
|
|
|
21
20
|
protected readonly log = $logger();
|
|
22
21
|
protected readonly alepha = $inject(Alepha);
|
|
23
22
|
protected readonly pageDescriptorProvider = $inject(PageDescriptorProvider);
|
|
24
|
-
public readonly events = new EventEmitter<RouterEvents>();
|
|
25
23
|
|
|
26
24
|
public add(entry: PageRouteEntry) {
|
|
27
25
|
this.pageDescriptorProvider.add(entry);
|
|
@@ -54,7 +52,7 @@ export class BrowserRouterProvider extends RouterProvider<BrowserRoute> {
|
|
|
54
52
|
head: {},
|
|
55
53
|
};
|
|
56
54
|
|
|
57
|
-
await this.
|
|
55
|
+
await this.alepha.emit("react:transition:begin", { state });
|
|
58
56
|
|
|
59
57
|
try {
|
|
60
58
|
const previous = options.previous;
|
|
@@ -103,7 +101,7 @@ export class BrowserRouterProvider extends RouterProvider<BrowserRoute> {
|
|
|
103
101
|
});
|
|
104
102
|
}
|
|
105
103
|
|
|
106
|
-
await this.
|
|
104
|
+
await this.alepha.emit("react:transition:success", { state });
|
|
107
105
|
} catch (e) {
|
|
108
106
|
this.log.error(e);
|
|
109
107
|
state.layers = [
|
|
@@ -115,11 +113,16 @@ export class BrowserRouterProvider extends RouterProvider<BrowserRoute> {
|
|
|
115
113
|
},
|
|
116
114
|
];
|
|
117
115
|
|
|
118
|
-
await this.
|
|
116
|
+
await this.alepha.emit("react:transition:error", {
|
|
117
|
+
error: e as Error,
|
|
118
|
+
state,
|
|
119
|
+
});
|
|
119
120
|
}
|
|
120
121
|
|
|
121
122
|
if (!options.state) {
|
|
122
|
-
await this.
|
|
123
|
+
await this.alepha.emit("react:transition:end", {
|
|
124
|
+
state,
|
|
125
|
+
});
|
|
123
126
|
return {
|
|
124
127
|
element: this.root(state, options.context),
|
|
125
128
|
layers: state.layers,
|
|
@@ -132,7 +135,10 @@ export class BrowserRouterProvider extends RouterProvider<BrowserRoute> {
|
|
|
132
135
|
options.state.search = state.search;
|
|
133
136
|
options.state.head = state.head;
|
|
134
137
|
|
|
135
|
-
await this.
|
|
138
|
+
await this.alepha.emit("react:transition:end", {
|
|
139
|
+
state: options.state,
|
|
140
|
+
});
|
|
141
|
+
|
|
136
142
|
return {
|
|
137
143
|
element: this.root(state, options.context),
|
|
138
144
|
layers: options.state.layers,
|
|
@@ -141,6 +147,6 @@ export class BrowserRouterProvider extends RouterProvider<BrowserRoute> {
|
|
|
141
147
|
}
|
|
142
148
|
|
|
143
149
|
public root(state: RouterState, context: PageReactContext = {}): ReactNode {
|
|
144
|
-
return this.pageDescriptorProvider.root(state, context
|
|
150
|
+
return this.pageDescriptorProvider.root(state, context);
|
|
145
151
|
}
|
|
146
152
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $hook, $inject, $logger, Alepha,
|
|
1
|
+
import { $hook, $inject, $logger, Alepha, OPTIONS } from "@alepha/core";
|
|
2
2
|
import type { HttpClientLink } from "@alepha/server";
|
|
3
3
|
import { type ReactNode, createElement } from "react";
|
|
4
4
|
import NestedView from "../components/NestedView.tsx";
|
|
@@ -30,11 +30,7 @@ export class PageDescriptorProvider {
|
|
|
30
30
|
throw new Error(`Page ${name} not found`);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
public root(
|
|
34
|
-
state: RouterState,
|
|
35
|
-
context: PageReactContext = {},
|
|
36
|
-
events?: EventEmitter<RouterEvents>,
|
|
37
|
-
): ReactNode {
|
|
33
|
+
public root(state: RouterState, context: PageReactContext = {}): ReactNode {
|
|
38
34
|
return createElement(
|
|
39
35
|
RouterContext.Provider,
|
|
40
36
|
{
|
|
@@ -42,7 +38,6 @@ export class PageDescriptorProvider {
|
|
|
42
38
|
alepha: this.alepha,
|
|
43
39
|
state,
|
|
44
40
|
context,
|
|
45
|
-
events: events ?? new EventEmitter<RouterEvents>(),
|
|
46
41
|
},
|
|
47
42
|
},
|
|
48
43
|
createElement(NestedView, {}, state.layers[0]?.element),
|
|
@@ -359,10 +354,10 @@ export class PageDescriptorProvider {
|
|
|
359
354
|
handler: () => {
|
|
360
355
|
const pages = this.alepha.getDescriptorValues($page);
|
|
361
356
|
for (const { value, key } of pages) {
|
|
362
|
-
value.
|
|
357
|
+
value[OPTIONS].name ??= key;
|
|
363
358
|
|
|
364
359
|
// skip children, we only want root pages
|
|
365
|
-
if (value.
|
|
360
|
+
if (value[OPTIONS].parent) {
|
|
366
361
|
continue;
|
|
367
362
|
}
|
|
368
363
|
|
|
@@ -372,19 +367,19 @@ export class PageDescriptorProvider {
|
|
|
372
367
|
});
|
|
373
368
|
|
|
374
369
|
protected map(
|
|
375
|
-
pages: Array<{ value: {
|
|
376
|
-
target: {
|
|
370
|
+
pages: Array<{ value: { [OPTIONS]: PageDescriptorOptions } }>,
|
|
371
|
+
target: { [OPTIONS]: PageDescriptorOptions },
|
|
377
372
|
): PageRouteEntry {
|
|
378
|
-
const children = target.
|
|
373
|
+
const children = target[OPTIONS].children ?? [];
|
|
379
374
|
|
|
380
375
|
for (const it of pages) {
|
|
381
|
-
if (it.value.
|
|
376
|
+
if (it.value[OPTIONS].parent === target) {
|
|
382
377
|
children.push(it.value);
|
|
383
378
|
}
|
|
384
379
|
}
|
|
385
380
|
|
|
386
381
|
return {
|
|
387
|
-
...target
|
|
382
|
+
...target[OPTIONS],
|
|
388
383
|
parent: undefined,
|
|
389
384
|
children: children.map((it) => this.map(pages, it)),
|
|
390
385
|
} as PageRoute;
|
|
@@ -480,13 +475,6 @@ export interface AnchorProps {
|
|
|
480
475
|
onClick?: (ev: any) => any;
|
|
481
476
|
}
|
|
482
477
|
|
|
483
|
-
export interface RouterEvents {
|
|
484
|
-
begin: undefined;
|
|
485
|
-
success: undefined;
|
|
486
|
-
error: Error;
|
|
487
|
-
end: RouterState;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
478
|
export interface RouterState {
|
|
491
479
|
pathname: string;
|
|
492
480
|
search: string;
|
|
@@ -166,7 +166,7 @@ export class ReactBrowserProvider {
|
|
|
166
166
|
*
|
|
167
167
|
* @protected
|
|
168
168
|
*/
|
|
169
|
-
|
|
169
|
+
public readonly ready = $hook({
|
|
170
170
|
name: "ready",
|
|
171
171
|
handler: async () => {
|
|
172
172
|
const hydration = this.getHydrationState();
|
|
@@ -203,11 +203,20 @@ export class ReactBrowserProvider {
|
|
|
203
203
|
this.render();
|
|
204
204
|
});
|
|
205
205
|
|
|
206
|
-
this.
|
|
207
|
-
|
|
206
|
+
this.alepha.on("react:transition:end", {
|
|
207
|
+
callback: ({ state }) => {
|
|
208
|
+
this.headProvider.renderHead(this.document, state.head);
|
|
209
|
+
},
|
|
208
210
|
});
|
|
209
211
|
},
|
|
210
212
|
});
|
|
213
|
+
|
|
214
|
+
public readonly onTransitionEnd = $hook({
|
|
215
|
+
name: "react:transition:end",
|
|
216
|
+
handler: async ({ state }) => {
|
|
217
|
+
this.headProvider.renderHead(this.document, state.head);
|
|
218
|
+
},
|
|
219
|
+
});
|
|
211
220
|
}
|
|
212
221
|
|
|
213
222
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
$hook,
|
|
6
|
+
$inject,
|
|
7
|
+
$logger,
|
|
8
|
+
Alepha,
|
|
9
|
+
OPTIONS,
|
|
10
|
+
type Static,
|
|
11
|
+
t,
|
|
12
|
+
} from "@alepha/core";
|
|
5
13
|
import {
|
|
6
14
|
type ServerHandler,
|
|
7
15
|
ServerLinksProvider,
|
|
@@ -54,7 +62,7 @@ export class ReactServerProvider {
|
|
|
54
62
|
}
|
|
55
63
|
|
|
56
64
|
for (const { key, instance, value } of pages) {
|
|
57
|
-
const name = value.
|
|
65
|
+
const name = value[OPTIONS].name ?? key;
|
|
58
66
|
|
|
59
67
|
if (this.alepha.isTest()) {
|
|
60
68
|
instance[key].render = this.createRenderFunction(name);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useActive-BGtt_RNQ.cjs","sources":["../src/descriptors/$page.ts","../src/contexts/RouterContext.ts","../src/contexts/RouterLayerContext.ts","../src/components/NestedView.tsx","../src/errors/RedirectionError.ts","../src/providers/PageDescriptorProvider.ts","../src/providers/BrowserHeadProvider.ts","../src/providers/BrowserRouterProvider.ts","../src/providers/ReactBrowserProvider.ts","../src/hooks/RouterHookApi.ts","../src/hooks/useRouter.ts","../src/components/Link.tsx","../src/hooks/useInject.ts","../src/hooks/useClient.ts","../src/hooks/useQueryParams.ts","../src/hooks/useRouterEvents.ts","../src/hooks/useRouterState.ts","../src/hooks/useActive.ts"],"sourcesContent":["import type { Async, Static, TSchema } from \"@alepha/core\";\nimport { KIND, NotImplementedError, __descriptor } from \"@alepha/core\";\nimport type { FC } from \"react\";\nimport type { RouterHookApi } from \"../hooks/RouterHookApi.ts\";\n\nconst KEY = \"PAGE\";\n\nexport interface PageConfigSchema {\n\tquery?: TSchema;\n\tparams?: TSchema;\n}\n\nexport type TPropsDefault = any;\n\nexport type TPropsParentDefault = object;\n\nexport interface PageDescriptorOptions<\n\tTConfig extends PageConfigSchema = PageConfigSchema,\n\tTProps extends object = TPropsDefault,\n\tTPropsParent extends object = TPropsParentDefault,\n> {\n\tname?: string;\n\n\tpath?: string;\n\n\tschema?: TConfig;\n\n\tresolve?: (config: PageResolve<TConfig, TPropsParent>) => Async<TProps>;\n\n\tcomponent?: FC<TProps & TPropsParent>;\n\n\tlazy?: () => Promise<{ default: FC<TProps & TPropsParent> }>;\n\n\tchildren?: Array<{ options: PageDescriptorOptions }>;\n\n\tparent?: { options: PageDescriptorOptions<any, TPropsParent> };\n\n\tcan?: () => boolean;\n\n\thead?: Head | ((props: TProps, previous?: Head) => Head);\n\n\tnotFoundHandler?: FC<{ url: string }>;\n\n\terrorHandler?: FC<{ error: Error; url: string }>;\n}\n\nexport interface PageDescriptor<\n\tTConfig extends PageConfigSchema = PageConfigSchema,\n\tTProps extends object = TPropsDefault,\n\tTPropsParent extends object = TPropsParentDefault,\n> {\n\t[KIND]: typeof KEY;\n\trender: (options?: {\n\t\tparams?: Record<string, string>;\n\t\tquery?: Record<string, string>;\n\t}) => Promise<string>;\n\tgo: () => void;\n\tcreateAnchorProps: (routerHook: RouterHookApi) => {\n\t\thref: string;\n\t\tonClick: () => void;\n\t};\n\toptions: PageDescriptorOptions<TConfig, TProps, TPropsParent>;\n\tcan: () => boolean;\n}\n\nexport const $page = <\n\tTConfig extends PageConfigSchema = PageConfigSchema,\n\tTProps extends object = TPropsDefault,\n\tTPropsParent extends object = TPropsParentDefault,\n>(\n\toptions: PageDescriptorOptions<TConfig, TProps, TPropsParent>,\n): PageDescriptor<TConfig, TProps, TPropsParent> => {\n\t__descriptor(KEY);\n\n\tif (options.children) {\n\t\tfor (const child of options.children) {\n\t\t\tchild.options.parent = {\n\t\t\t\toptions: options as PageDescriptorOptions<any, any, any>,\n\t\t\t};\n\t\t}\n\t}\n\n\tif (options.parent) {\n\t\toptions.parent.options.children ??= [];\n\t\toptions.parent.options.children.push({\n\t\t\toptions: options as PageDescriptorOptions<any, any, any>,\n\t\t});\n\t}\n\n\treturn {\n\t\t[KIND]: KEY,\n\t\toptions,\n\t\trender: () => {\n\t\t\tthrow new NotImplementedError(KEY);\n\t\t},\n\t\tgo: () => {\n\t\t\tthrow new NotImplementedError(KEY);\n\t\t},\n\t\tcreateAnchorProps: () => {\n\t\t\tthrow new NotImplementedError(KEY);\n\t\t},\n\t\tcan: () => {\n\t\t\tif (options.can) {\n\t\t\t\treturn options.can();\n\t\t\t}\n\t\t\treturn true;\n\t\t},\n\t};\n};\n\n$page[KIND] = KEY;\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport interface Head {\n\ttitle?: string;\n\ttitleSeparator?: string;\n\thtmlAttributes?: Record<string, string>;\n\tbodyAttributes?: Record<string, string>;\n\tmeta?: Array<{ name: string; content: string }>;\n}\n\nexport interface PageRequestConfig<\n\tTConfig extends PageConfigSchema = PageConfigSchema,\n> {\n\tparams: TConfig[\"params\"] extends TSchema\n\t\t? Static<TConfig[\"params\"]>\n\t\t: Record<string, string>;\n\n\tquery: TConfig[\"query\"] extends TSchema\n\t\t? Static<TConfig[\"query\"]>\n\t\t: Record<string, string>;\n}\n\nexport type PageResolve<\n\tTConfig extends PageConfigSchema = PageConfigSchema,\n\tTPropsParent extends object = TPropsParentDefault,\n> = PageRequestConfig<TConfig> & TPropsParent & PageResolveContext;\n\nexport interface PageResolveContext {\n\turl: URL;\n\thead: Head;\n}\n","import type { Alepha, EventEmitter } from \"@alepha/core\";\nimport { createContext } from \"react\";\nimport type {\n\tPageReactContext,\n\tRouterEvents,\n\tRouterState,\n} from \"../providers/PageDescriptorProvider.ts\";\n\nexport interface RouterContextValue {\n\talepha: Alepha;\n\tstate: RouterState;\n\tcontext: PageReactContext;\n\tevents: EventEmitter<RouterEvents>;\n}\n\nexport const RouterContext = createContext<RouterContextValue | undefined>(\n\tundefined,\n);\n","import { createContext } from \"react\";\n\nexport interface RouterLayerContextValue {\n\tindex: number;\n\tpath: string;\n}\n\nexport const RouterLayerContext = createContext<\n\tRouterLayerContextValue | undefined\n>(undefined);\n","import type { ReactNode } from \"react\";\nimport { useContext, useEffect, useState } from \"react\";\nimport { RouterContext } from \"../contexts/RouterContext.ts\";\nimport { RouterLayerContext } from \"../contexts/RouterLayerContext.ts\";\n\nexport interface NestedViewProps {\n\tchildren?: ReactNode;\n}\n\n/**\n * Nested view component\n *\n * @param props\n * @constructor\n */\nconst NestedView = (props: NestedViewProps) => {\n\tconst app = useContext(RouterContext);\n\tconst layer = useContext(RouterLayerContext);\n\tconst index = layer?.index ?? 0;\n\n\tconst [view, setView] = useState<ReactNode | undefined>(\n\t\tapp?.state.layers[index]?.element,\n\t);\n\n\tuseEffect(() => {\n\t\tif (app?.alepha.isBrowser()) {\n\t\t\treturn app?.events.on(\"end\", (state) => {\n\t\t\t\tsetView(state.layers[index]?.element);\n\t\t\t});\n\t\t}\n\t}, [app]);\n\n\treturn view ?? props.children ?? null;\n};\n\nexport default NestedView;\n","import type { HrefLike } from \"../hooks/RouterHookApi.ts\";\n\nexport class RedirectionError extends Error {\n\tconstructor(public readonly page: HrefLike) {\n\t\tsuper(\"Redirection\");\n\t}\n}\n","import { $hook, $inject, $logger, Alepha, EventEmitter } from \"@alepha/core\";\nimport type { HttpClientLink } from \"@alepha/server\";\nimport { type ReactNode, createElement } from \"react\";\nimport NestedView from \"../components/NestedView.tsx\";\nimport { RouterContext } from \"../contexts/RouterContext.ts\";\nimport { RouterLayerContext } from \"../contexts/RouterLayerContext.ts\";\nimport {\n\t$page,\n\ttype Head,\n\ttype PageDescriptorOptions,\n} from \"../descriptors/$page.ts\";\nimport { RedirectionError } from \"../errors/RedirectionError.ts\";\n\nexport class PageDescriptorProvider {\n\tprotected readonly log = $logger();\n\tprotected readonly alepha = $inject(Alepha);\n\tprotected readonly pages: PageRoute[] = [];\n\n\tpublic getPages(): PageRoute[] {\n\t\treturn this.pages;\n\t}\n\n\tpublic page(name: string): PageRoute {\n\t\tfor (const page of this.pages) {\n\t\t\tif (page.name === name) {\n\t\t\t\treturn page;\n\t\t\t}\n\t\t}\n\n\t\tthrow new Error(`Page ${name} not found`);\n\t}\n\n\tpublic root(\n\t\tstate: RouterState,\n\t\tcontext: PageReactContext = {},\n\t\tevents?: EventEmitter<RouterEvents>,\n\t): ReactNode {\n\t\treturn createElement(\n\t\t\tRouterContext.Provider,\n\t\t\t{\n\t\t\t\tvalue: {\n\t\t\t\t\talepha: this.alepha,\n\t\t\t\t\tstate,\n\t\t\t\t\tcontext,\n\t\t\t\t\tevents: events ?? new EventEmitter<RouterEvents>(),\n\t\t\t\t},\n\t\t\t},\n\t\t\tcreateElement(NestedView, {}, state.layers[0]?.element),\n\t\t);\n\t}\n\n\tpublic async createLayers(\n\t\troute: PageRoute,\n\t\trequest: PageRequest,\n\t): Promise<CreateLayersResult> {\n\t\tconst { pathname, search } = request.url;\n\t\tconst layers: Layer[] = []; // result layers\n\t\tlet context: Record<string, any> = {}; // all props\n\t\tconst stack: Array<RouterStackItem> = [{ route }]; // stack of routes\n\n\t\tlet parent = route.parent;\n\t\twhile (parent) {\n\t\t\tstack.unshift({ route: parent });\n\t\t\tparent = parent.parent;\n\t\t}\n\n\t\tlet forceRefresh = false;\n\n\t\tfor (let i = 0; i < stack.length; i++) {\n\t\t\tconst it = stack[i];\n\t\t\tconst route = it.route;\n\t\t\tconst config: Record<string, any> = {};\n\n\t\t\ttry {\n\t\t\t\tconfig.query = route.schema?.query\n\t\t\t\t\t? this.alepha.parse(route.schema.query, request.query)\n\t\t\t\t\t: request.query;\n\t\t\t} catch (e) {\n\t\t\t\tit.error = e as Error;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconfig.params = route.schema?.params\n\t\t\t\t\t? this.alepha.parse(route.schema.params, request.params)\n\t\t\t\t\t: request.params;\n\t\t\t} catch (e) {\n\t\t\t\tit.error = e as Error;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// save config\n\t\t\tit.config = {\n\t\t\t\t...config,\n\t\t\t};\n\n\t\t\t// no resolve, render a basic view by default\n\t\t\tif (!route.resolve) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// check if previous layer is the same, reuse if possible\n\t\t\tconst previous = request.previous;\n\t\t\tif (previous?.[i] && !forceRefresh && previous[i].name === route.name) {\n\t\t\t\tconst url = (str?: string) => (str ? str.replace(/\\/\\/+/g, \"/\") : \"/\");\n\n\t\t\t\tconst prev = JSON.stringify({\n\t\t\t\t\tpart: url(previous[i].part),\n\t\t\t\t\tparams: previous[i].config?.params ?? {},\n\t\t\t\t});\n\n\t\t\t\tconst curr = JSON.stringify({\n\t\t\t\t\tpart: url(route.path),\n\t\t\t\t\tparams: config.params ?? {},\n\t\t\t\t});\n\n\t\t\t\tif (prev === curr) {\n\t\t\t\t\t// part is the same, reuse previous layer\n\t\t\t\t\tit.props = previous[i].props;\n\t\t\t\t\tit.error = previous[i].error;\n\t\t\t\t\tcontext = {\n\t\t\t\t\t\t...context,\n\t\t\t\t\t\t...it.props,\n\t\t\t\t\t};\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t// part is different, force refresh of next layers\n\t\t\t\tforceRefresh = true;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst props =\n\t\t\t\t\t(await route.resolve?.({\n\t\t\t\t\t\t...request, // request\n\t\t\t\t\t\t...config, // params, query\n\t\t\t\t\t\t...context, // previous props\n\t\t\t\t\t} as any)) ?? {};\n\n\t\t\t\t// save props\n\t\t\t\tit.props = {\n\t\t\t\t\t...props,\n\t\t\t\t};\n\n\t\t\t\t// add props to context\n\t\t\t\tcontext = {\n\t\t\t\t\t...context,\n\t\t\t\t\t...props,\n\t\t\t\t};\n\t\t\t} catch (e) {\n\t\t\t\t// check if we need to redirect\n\t\t\t\tif (e instanceof RedirectionError) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tlayers: [],\n\t\t\t\t\t\tredirect: typeof e.page === \"string\" ? e.page : this.href(e.page),\n\t\t\t\t\t\thead: request.head,\n\t\t\t\t\t\tpathname,\n\t\t\t\t\t\tsearch,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tthis.log.error(e);\n\n\t\t\t\tit.error = e as Error;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tlet acc = \"\";\n\t\tfor (let i = 0; i < stack.length; i++) {\n\t\t\tconst it = stack[i];\n\t\t\tconst props = it.props ?? {};\n\n\t\t\tconst params = { ...it.config?.params };\n\t\t\tfor (const key of Object.keys(params)) {\n\t\t\t\tparams[key] = String(params[key]);\n\t\t\t}\n\n\t\t\tif (it.route.head && !it.error) {\n\t\t\t\tthis.fillHead(it.route, request, {\n\t\t\t\t\t...props,\n\t\t\t\t\t...context,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tacc += \"/\";\n\t\t\tacc += it.route.path ? this.compile(it.route.path, params) : \"\";\n\t\t\tconst path = acc.replace(/\\/+/, \"/\");\n\n\t\t\t// handler has thrown an error, render an error view\n\t\t\tif (it.error) {\n\t\t\t\tconst errorHandler = this.getErrorHandler(it.route);\n\t\t\t\tconst element = await (errorHandler\n\t\t\t\t\t? errorHandler({\n\t\t\t\t\t\t\t...it.config,\n\t\t\t\t\t\t\terror: it.error,\n\t\t\t\t\t\t\turl: \"\",\n\t\t\t\t\t\t})\n\t\t\t\t\t: this.renderError(it.error));\n\n\t\t\t\tlayers.push({\n\t\t\t\t\tprops,\n\t\t\t\t\terror: it.error,\n\t\t\t\t\tname: it.route.name,\n\t\t\t\t\tpart: it.route.path,\n\t\t\t\t\tconfig: it.config,\n\t\t\t\t\telement: this.renderView(i + 1, path, element),\n\t\t\t\t\tindex: i + 1,\n\t\t\t\t\tpath,\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// normal use case\n\n\t\t\tconst layer = await this.createElement(it.route, {\n\t\t\t\t...props,\n\t\t\t\t...context,\n\t\t\t});\n\n\t\t\tlayers.push({\n\t\t\t\tname: it.route.name,\n\t\t\t\tprops,\n\t\t\t\tpart: it.route.path,\n\t\t\t\tconfig: it.config,\n\t\t\t\telement: this.renderView(i + 1, path, layer),\n\t\t\t\tindex: i + 1,\n\t\t\t\tpath,\n\t\t\t});\n\t\t}\n\n\t\treturn { layers, head: request.head, pathname, search };\n\t}\n\n\tprotected getErrorHandler(route: PageRoute) {\n\t\tif (route.errorHandler) return route.errorHandler;\n\t\tlet parent = route.parent;\n\t\twhile (parent) {\n\t\t\tif (parent.errorHandler) return parent.errorHandler;\n\t\t\tparent = parent.parent;\n\t\t}\n\t}\n\n\tprotected async createElement(\n\t\tpage: PageRoute,\n\t\tprops: Record<string, any>,\n\t): Promise<ReactNode> {\n\t\tif (page.lazy) {\n\t\t\tconst component = await page.lazy(); // load component\n\t\t\treturn createElement(component.default, props);\n\t\t}\n\n\t\tif (page.component) {\n\t\t\treturn createElement(page.component, props);\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\tprotected fillHead(\n\t\tpage: PageRoute,\n\t\tctx: PageRequest,\n\t\tprops: Record<string, any>,\n\t): void {\n\t\tif (!page.head) {\n\t\t\treturn;\n\t\t}\n\n\t\tctx.head ??= {};\n\n\t\tconst head =\n\t\t\ttypeof page.head === \"function\" ? page.head(props, ctx.head) : page.head;\n\n\t\tif (head.title) {\n\t\t\tctx.head ??= {};\n\n\t\t\tif (ctx.head.titleSeparator) {\n\t\t\t\tctx.head.title = `${head.title}${ctx.head.titleSeparator}${ctx.head.title}`;\n\t\t\t} else {\n\t\t\t\tctx.head.title = head.title;\n\t\t\t}\n\n\t\t\tctx.head.titleSeparator = head.titleSeparator;\n\t\t}\n\n\t\tif (head.htmlAttributes) {\n\t\t\tctx.head.htmlAttributes = {\n\t\t\t\t...ctx.head.htmlAttributes,\n\t\t\t\t...head.htmlAttributes,\n\t\t\t};\n\t\t}\n\n\t\tif (head.bodyAttributes) {\n\t\t\tctx.head.bodyAttributes = {\n\t\t\t\t...ctx.head.bodyAttributes,\n\t\t\t\t...head.bodyAttributes,\n\t\t\t};\n\t\t}\n\n\t\tif (head.meta) {\n\t\t\tctx.head.meta = [...(ctx.head.meta ?? []), ...(head.meta ?? [])];\n\t\t}\n\t}\n\n\tpublic renderError(e: Error): ReactNode {\n\t\treturn createElement(\"pre\", { style: { overflow: \"auto\" } }, `${e.stack}`);\n\t}\n\n\tpublic renderEmptyView(): ReactNode {\n\t\treturn createElement(NestedView, {});\n\t}\n\n\tpublic href(\n\t\tpage: { options: { name?: string } },\n\t\tparams: Record<string, any> = {},\n\t): string {\n\t\tconst found = this.pages.find((it) => it.name === page.options.name);\n\t\tif (!found) {\n\t\t\tthrow new Error(`Page ${page.options.name} not found`);\n\t\t}\n\n\t\tlet url = found.path ?? \"\";\n\t\tlet parent = found.parent;\n\t\twhile (parent) {\n\t\t\turl = `${parent.path ?? \"\"}/${url}`;\n\t\t\tparent = parent.parent;\n\t\t}\n\n\t\turl = this.compile(url, params);\n\n\t\treturn url.replace(/\\/\\/+/g, \"/\") || \"/\";\n\t}\n\n\tpublic compile(path: string, params: Record<string, string> = {}) {\n\t\tfor (const [key, value] of Object.entries(params)) {\n\t\t\tpath = path.replace(`:${key}`, value);\n\t\t}\n\t\treturn path;\n\t}\n\n\tprotected renderView(\n\t\tindex: number,\n\t\tpath: string,\n\t\tview: ReactNode = this.renderEmptyView(),\n\t): ReactNode {\n\t\treturn createElement(\n\t\t\tRouterLayerContext.Provider,\n\t\t\t{\n\t\t\t\tvalue: {\n\t\t\t\t\tindex,\n\t\t\t\t\tpath,\n\t\t\t\t},\n\t\t\t},\n\t\t\tview,\n\t\t);\n\t}\n\n\tprotected readonly configure = $hook({\n\t\tname: \"configure\",\n\t\thandler: () => {\n\t\t\tconst pages = this.alepha.getDescriptorValues($page);\n\t\t\tfor (const { value, key } of pages) {\n\t\t\t\tvalue.options.name ??= key;\n\n\t\t\t\t// skip children, we only want root pages\n\t\t\t\tif (value.options.parent) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tthis.add(this.map(pages, value));\n\t\t\t}\n\t\t},\n\t});\n\n\tprotected map(\n\t\tpages: Array<{ value: { options: PageDescriptorOptions } }>,\n\t\ttarget: { options: PageDescriptorOptions },\n\t): PageRouteEntry {\n\t\tconst children = target.options.children ?? [];\n\n\t\tfor (const it of pages) {\n\t\t\tif (it.value.options.parent === target) {\n\t\t\t\tchildren.push(it.value);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\t...target.options,\n\t\t\tparent: undefined,\n\t\t\tchildren: children.map((it) => this.map(pages, it)),\n\t\t} as PageRoute;\n\t}\n\n\tpublic add(entry: PageRouteEntry) {\n\t\tif (this.alepha.isReady()) {\n\t\t\tthrow new Error(\"Router is already initialized\");\n\t\t}\n\n\t\tentry.name ??= this.nextId();\n\t\tconst page = entry as PageRoute;\n\n\t\tpage.match = this.createMatch(page);\n\t\tthis.pages.push(page);\n\n\t\tif (page.children) {\n\t\t\tfor (const child of page.children) {\n\t\t\t\t(child as PageRoute).parent = page;\n\t\t\t\tthis.add(child);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected createMatch(page: PageRoute): string {\n\t\tlet url = page.path ?? \"/\";\n\t\tlet target = page.parent;\n\t\twhile (target) {\n\t\t\turl = `${target.path ?? \"\"}/${url}`;\n\t\t\ttarget = target.parent;\n\t\t}\n\n\t\tlet path = url.replace(/\\/\\/+/g, \"/\");\n\n\t\tif (path.endsWith(\"/\") && path !== \"/\") {\n\t\t\t// remove trailing slash\n\t\t\tpath = path.slice(0, -1);\n\t\t}\n\n\t\treturn path;\n\t}\n\n\tprotected _next = 0;\n\n\tprotected nextId(): string {\n\t\tthis._next += 1;\n\t\treturn `P${this._next}`;\n\t}\n}\n\nexport const isPageRoute = (it: any): it is PageRoute => {\n\treturn (\n\t\tit &&\n\t\ttypeof it === \"object\" &&\n\t\ttypeof it.path === \"string\" &&\n\t\ttypeof it.page === \"object\"\n\t);\n};\n\nexport interface PageRouteEntry\n\textends Omit<PageDescriptorOptions, \"children\" | \"parent\"> {\n\tchildren?: PageRouteEntry[];\n}\n\nexport interface PageRoute extends PageRouteEntry {\n\ttype: \"page\";\n\tname: string;\n\tparent?: PageRoute;\n\tmatch: string;\n}\n\nexport interface Layer {\n\tconfig?: {\n\t\tquery?: Record<string, any>;\n\t\tparams?: Record<string, any>;\n\t\t// stack of resolved props\n\t\tcontext?: Record<string, any>;\n\t};\n\n\tname: string;\n\tprops?: Record<string, any>;\n\terror?: Error;\n\tpart?: string;\n\telement: ReactNode;\n\tindex: number;\n\tpath: string;\n}\n\nexport type PreviousLayerData = Omit<Layer, \"element\">;\n\nexport interface AnchorProps {\n\thref?: string;\n\tonClick?: (ev: any) => any;\n}\n\nexport interface RouterEvents {\n\tbegin: undefined;\n\tsuccess: undefined;\n\terror: Error;\n\tend: RouterState;\n}\n\nexport interface RouterState {\n\tpathname: string;\n\tsearch: string;\n\tlayers: Array<Layer>;\n\thead: Head;\n}\n\nexport interface TransitionOptions {\n\tstate?: RouterState;\n\tprevious?: PreviousLayerData[];\n\tcontext?: PageReactContext;\n}\n\nexport interface RouterStackItem {\n\troute: PageRoute;\n\tconfig?: Record<string, any>;\n\tprops?: Record<string, any>;\n\terror?: Error;\n}\n\nexport interface RouterRenderResult {\n\tredirect?: string;\n\tlayers: Layer[];\n\thead: Head;\n\telement: ReactNode;\n}\n\nexport interface PageRequest extends PageReactContext {\n\turl: URL;\n\tparams: Record<string, any>;\n\tquery: Record<string, string>;\n\thead: Head;\n\n\t// previous layers (browser history or browser hydration, always null on server)\n\tprevious?: PreviousLayerData[];\n}\n\nexport interface CreateLayersResult extends RouterState {\n\tredirect?: string;\n}\n\n// will be passed to ReactContext\nexport interface PageReactContext {\n\tlinks?: HttpClientLink[];\n}\n","import type { Head } from \"./ServerHeadProvider.ts\";\n\nexport class BrowserHeadProvider {\n\trenderHead(document: Document, head: Head): void {\n\t\tif (head.title) {\n\t\t\tdocument.title = head.title;\n\t\t}\n\n\t\tif (head.bodyAttributes) {\n\t\t\tfor (const [key, value] of Object.entries(head.bodyAttributes)) {\n\t\t\t\tif (value) {\n\t\t\t\t\tdocument.body.setAttribute(key, value);\n\t\t\t\t} else {\n\t\t\t\t\tdocument.body.removeAttribute(key);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (head.htmlAttributes) {\n\t\t\tfor (const [key, value] of Object.entries(head.htmlAttributes)) {\n\t\t\t\tif (value) {\n\t\t\t\t\tdocument.documentElement.setAttribute(key, value);\n\t\t\t\t} else {\n\t\t\t\t\tdocument.documentElement.removeAttribute(key);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (head.meta) {\n\t\t\tfor (const [key, value] of Object.entries(head.meta)) {\n\t\t\t\tconst meta = document.querySelector(`meta[name=\"${key}\"]`);\n\t\t\t\tif (meta) {\n\t\t\t\t\tmeta.setAttribute(\"content\", value.content);\n\t\t\t\t} else {\n\t\t\t\t\tconst newMeta = document.createElement(\"meta\");\n\t\t\t\t\tnewMeta.setAttribute(\"name\", key);\n\t\t\t\t\tnewMeta.setAttribute(\"content\", value.content);\n\t\t\t\t\tdocument.head.appendChild(newMeta);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import { $hook, $inject, $logger, Alepha, EventEmitter } from \"@alepha/core\";\nimport { type Route, RouterProvider } from \"@alepha/router\";\nimport type { ReactNode } from \"react\";\nimport {\n\tPageDescriptorProvider,\n\ttype PageReactContext,\n\ttype PageRoute,\n\ttype PageRouteEntry,\n\ttype RouterEvents,\n\ttype RouterRenderResult,\n\ttype RouterState,\n\ttype TransitionOptions,\n\tisPageRoute,\n} from \"./PageDescriptorProvider.ts\";\n\nexport interface BrowserRoute extends Route {\n\tpage: PageRoute;\n}\n\nexport class BrowserRouterProvider extends RouterProvider<BrowserRoute> {\n\tprotected readonly log = $logger();\n\tprotected readonly alepha = $inject(Alepha);\n\tprotected readonly pageDescriptorProvider = $inject(PageDescriptorProvider);\n\tpublic readonly events = new EventEmitter<RouterEvents>();\n\n\tpublic add(entry: PageRouteEntry) {\n\t\tthis.pageDescriptorProvider.add(entry);\n\t}\n\n\tprotected readonly configure = $hook({\n\t\tname: \"configure\",\n\t\thandler: async () => {\n\t\t\tfor (const page of this.pageDescriptorProvider.getPages()) {\n\t\t\t\t// mount only if a view is provided\n\t\t\t\tif (page.component || page.lazy) {\n\t\t\t\t\tthis.push({\n\t\t\t\t\t\tpath: page.match,\n\t\t\t\t\t\tpage,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t});\n\n\tpublic async transition(\n\t\turl: URL,\n\t\toptions: TransitionOptions = {},\n\t): Promise<RouterRenderResult> {\n\t\tconst { pathname, search } = url;\n\t\tconst state: RouterState = {\n\t\t\tpathname,\n\t\t\tsearch,\n\t\t\tlayers: [],\n\t\t\thead: {},\n\t\t};\n\n\t\tawait this.events.emit(\"begin\", undefined);\n\n\t\ttry {\n\t\t\tconst previous = options.previous;\n\t\t\tconst { route, params } = this.match(pathname);\n\n\t\t\tconst query: Record<string, string> = {};\n\t\t\tif (search) {\n\t\t\t\tfor (const [key, value] of new URLSearchParams(search).entries()) {\n\t\t\t\t\tquery[key] = String(value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (isPageRoute(route)) {\n\t\t\t\tconst result = await this.pageDescriptorProvider.createLayers(\n\t\t\t\t\troute.page,\n\t\t\t\t\t{\n\t\t\t\t\t\turl,\n\t\t\t\t\t\tparams: params ?? {},\n\t\t\t\t\t\tquery,\n\t\t\t\t\t\tprevious,\n\t\t\t\t\t\t...state,\n\t\t\t\t\t\thead: state.head,\n\t\t\t\t\t\t...(options.context ?? {}),\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\tif (result.redirect) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\telement: null,\n\t\t\t\t\t\tlayers: [],\n\t\t\t\t\t\tredirect: result.redirect,\n\t\t\t\t\t\thead: state.head,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tstate.layers = result.layers;\n\t\t\t\tstate.head = result.head;\n\t\t\t}\n\n\t\t\tif (state.layers.length === 0) {\n\t\t\t\tstate.layers.push({\n\t\t\t\t\tname: \"not-found\",\n\t\t\t\t\telement: \"Not Found\",\n\t\t\t\t\tindex: 0,\n\t\t\t\t\tpath: \"/\",\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tawait this.events.emit(\"success\", undefined);\n\t\t} catch (e) {\n\t\t\tthis.log.error(e);\n\t\t\tstate.layers = [\n\t\t\t\t{\n\t\t\t\t\tname: \"error\",\n\t\t\t\t\telement: this.pageDescriptorProvider.renderError(e as Error),\n\t\t\t\t\tindex: 0,\n\t\t\t\t\tpath: \"/\",\n\t\t\t\t},\n\t\t\t];\n\n\t\t\tawait this.events.emit(\"error\", e as Error);\n\t\t}\n\n\t\tif (!options.state) {\n\t\t\tawait this.events.emit(\"end\", state);\n\t\t\treturn {\n\t\t\t\telement: this.root(state, options.context),\n\t\t\t\tlayers: state.layers,\n\t\t\t\thead: state.head,\n\t\t\t};\n\t\t}\n\n\t\toptions.state.layers = state.layers;\n\t\toptions.state.pathname = state.pathname;\n\t\toptions.state.search = state.search;\n\t\toptions.state.head = state.head;\n\n\t\tawait this.events.emit(\"end\", options.state);\n\t\treturn {\n\t\t\telement: this.root(state, options.context),\n\t\t\tlayers: options.state.layers,\n\t\t\thead: state.head,\n\t\t};\n\t}\n\n\tpublic root(state: RouterState, context: PageReactContext = {}): ReactNode {\n\t\treturn this.pageDescriptorProvider.root(state, context, this.events);\n\t}\n}\n","import { $hook, $inject, $logger, Alepha, type Static, t } from \"@alepha/core\";\nimport { HttpClient, type HttpClientLink } from \"@alepha/server\";\nimport type { Root } from \"react-dom/client\";\nimport { createRoot, hydrateRoot } from \"react-dom/client\";\nimport type { Head } from \"../descriptors/$page.ts\";\nimport { BrowserHeadProvider } from \"./BrowserHeadProvider.ts\";\nimport { BrowserRouterProvider } from \"./BrowserRouterProvider.ts\";\nimport type {\n\tPreviousLayerData,\n\tRouterState,\n\tTransitionOptions,\n} from \"./PageDescriptorProvider.ts\";\n\nconst envSchema = t.object({\n\tREACT_ROOT_ID: t.string({ default: \"root\" }),\n});\n\ndeclare module \"@alepha/core\" {\n\tinterface Env extends Partial<Static<typeof envSchema>> {}\n}\n\nexport class ReactBrowserProvider {\n\tprotected readonly log = $logger();\n\tprotected readonly client = $inject(HttpClient);\n\tprotected readonly alepha = $inject(Alepha);\n\tprotected readonly router = $inject(BrowserRouterProvider);\n\tprotected readonly headProvider = $inject(BrowserHeadProvider);\n\tprotected readonly env = $inject(envSchema);\n\tprotected root!: Root;\n\n\tpublic transitioning?: {\n\t\tto: string;\n\t};\n\n\tpublic state: RouterState = {\n\t\tlayers: [],\n\t\tpathname: \"\",\n\t\tsearch: \"\",\n\t\thead: {},\n\t};\n\n\tpublic get document() {\n\t\treturn window.document;\n\t}\n\n\tpublic get history() {\n\t\treturn window.history;\n\t}\n\n\tpublic get url(): string {\n\t\treturn window.location.pathname + window.location.search;\n\t}\n\n\tpublic async invalidate(props?: Record<string, any>) {\n\t\tconst previous: PreviousLayerData[] = [];\n\n\t\tif (props) {\n\t\t\tconst [key] = Object.keys(props);\n\t\t\tconst value = props[key];\n\n\t\t\tfor (const layer of this.state.layers) {\n\t\t\t\tif (layer.props?.[key]) {\n\t\t\t\t\tprevious.push({\n\t\t\t\t\t\t...layer,\n\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t...layer.props,\n\t\t\t\t\t\t\t[key]: value,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tprevious.push(layer);\n\t\t\t}\n\t\t}\n\n\t\tawait this.render({ previous });\n\t}\n\n\t/**\n\t *\n\t * @param url\n\t * @param options\n\t */\n\tpublic async go(url: string, options: RouterGoOptions = {}): Promise<void> {\n\t\tconst result = await this.render({\n\t\t\turl,\n\t\t});\n\n\t\tif (result.url !== url) {\n\t\t\tthis.history.replaceState({}, \"\", result.url);\n\t\t\treturn;\n\t\t}\n\n\t\tif (options.replace) {\n\t\t\tthis.history.replaceState({}, \"\", url);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.history.pushState({}, \"\", url);\n\t}\n\n\tprotected async render(\n\t\toptions: {\n\t\t\turl?: string;\n\t\t\tprevious?: PreviousLayerData[];\n\t\t} = {},\n\t): Promise<{ url: string; head: Head }> {\n\t\tconst previous = options.previous ?? this.state.layers;\n\t\tconst url = options.url ?? this.url;\n\n\t\tthis.transitioning = { to: url };\n\n\t\tconst result = await this.router.transition(\n\t\t\tnew URL(`http://localhost${url}`),\n\t\t\t{\n\t\t\t\tprevious,\n\t\t\t\tstate: this.state,\n\t\t\t},\n\t\t);\n\n\t\tif (result.redirect) {\n\t\t\treturn await this.render({ url: result.redirect });\n\t\t}\n\n\t\tthis.transitioning = undefined;\n\n\t\treturn { url, head: result.head };\n\t}\n\n\t/**\n\t * Get embedded layers from the server.\n\t *\n\t * @protected\n\t */\n\tprotected getHydrationState(): ReactHydrationState | undefined {\n\t\ttry {\n\t\t\tif (\"__ssr\" in window && typeof window.__ssr === \"object\") {\n\t\t\t\treturn window.__ssr as ReactHydrationState;\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconsole.error(error);\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @protected\n\t */\n\tprotected getRootElement() {\n\t\tconst root = this.document.getElementById(this.env.REACT_ROOT_ID);\n\t\tif (root) {\n\t\t\treturn root;\n\t\t}\n\n\t\tconst div = this.document.createElement(\"div\");\n\t\tdiv.id = this.env.REACT_ROOT_ID;\n\n\t\tthis.document.body.prepend(div);\n\n\t\treturn div;\n\t}\n\n\t// -------------------------------------------------------------------------------------------------------------------\n\n\t/**\n\t *\n\t * @protected\n\t */\n\tprotected ready = $hook({\n\t\tname: \"ready\",\n\t\thandler: async () => {\n\t\t\tconst hydration = this.getHydrationState();\n\t\t\tconst previous = hydration?.layers ?? [];\n\n\t\t\tif (hydration?.links) {\n\t\t\t\tthis.client.links = hydration.links as HttpClientLink[];\n\t\t\t}\n\n\t\t\tconst { head } = await this.render({ previous });\n\t\t\tif (head) {\n\t\t\t\tthis.headProvider.renderHead(this.document, head);\n\t\t\t}\n\n\t\t\tconst context = {};\n\n\t\t\tawait this.alepha.emit(\"react:browser:render\", {\n\t\t\t\tcontext,\n\t\t\t\thydration,\n\t\t\t});\n\n\t\t\tconst element = this.router.root(this.state, context);\n\n\t\t\tif (previous.length > 0) {\n\t\t\t\tthis.root = hydrateRoot(this.getRootElement(), element);\n\t\t\t\tthis.log.info(\"Hydrated root element\");\n\t\t\t} else {\n\t\t\t\tthis.root ??= createRoot(this.getRootElement());\n\t\t\t\tthis.root.render(element);\n\t\t\t\tthis.log.info(\"Created root element\");\n\t\t\t}\n\n\t\t\twindow.addEventListener(\"popstate\", () => {\n\t\t\t\tthis.render();\n\t\t\t});\n\n\t\t\tthis.router.events.on(\"end\", ({ head }) => {\n\t\t\t\tthis.headProvider.renderHead(this.document, head);\n\t\t\t});\n\t\t},\n\t});\n}\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport interface RouterGoOptions {\n\treplace?: boolean;\n\tmatch?: TransitionOptions;\n}\n\nexport interface ReactHydrationState {\n\tlayers?: PreviousLayerData[];\n\tlinks?: HttpClientLink[];\n}\n","import type {\n\tAnchorProps,\n\tRouterState,\n} from \"../providers/PageDescriptorProvider.ts\";\nimport type {\n\tReactBrowserProvider,\n\tRouterGoOptions,\n} from \"../providers/ReactBrowserProvider.ts\";\n\nexport class RouterHookApi {\n\tconstructor(\n\t\tprivate readonly state: RouterState,\n\t\tprivate readonly layer: {\n\t\t\tpath: string;\n\t\t},\n\t\tprivate readonly browser?: ReactBrowserProvider,\n\t) {}\n\n\t/**\n\t *\n\t */\n\tpublic get current(): RouterState {\n\t\treturn this.state;\n\t}\n\n\t/**\n\t *\n\t */\n\tpublic get pathname(): string {\n\t\treturn this.state.pathname;\n\t}\n\n\t/**\n\t *\n\t */\n\tpublic get query(): Record<string, string> {\n\t\tconst query: Record<string, string> = {};\n\n\t\tfor (const [key, value] of new URLSearchParams(\n\t\t\tthis.state.search,\n\t\t).entries()) {\n\t\t\tquery[key] = String(value);\n\t\t}\n\n\t\treturn query;\n\t}\n\n\t/**\n\t *\n\t */\n\tpublic async back() {\n\t\tthis.browser?.history.back();\n\t}\n\n\t/**\n\t *\n\t */\n\tpublic async forward() {\n\t\tthis.browser?.history.forward();\n\t}\n\n\t/**\n\t *\n\t * @param props\n\t */\n\tpublic async invalidate(props?: Record<string, any>) {\n\t\tawait this.browser?.invalidate(props);\n\t}\n\n\t/**\n\t * Create a valid href for the given pathname.\n\t *\n\t * @param pathname\n\t * @param layer\n\t */\n\tpublic createHref(pathname: HrefLike, layer: { path: string } = this.layer) {\n\t\tif (typeof pathname === \"object\") {\n\t\t\tpathname = pathname.options.path ?? \"\";\n\t\t}\n\n\t\treturn pathname.startsWith(\"/\")\n\t\t\t? pathname\n\t\t\t: `${layer.path}/${pathname}`.replace(/\\/\\/+/g, \"/\");\n\t}\n\n\t/**\n\t *\n\t * @param path\n\t * @param options\n\t */\n\tpublic async go(\n\t\tpath: HrefLike,\n\t\toptions: RouterGoOptions = {},\n\t): Promise<void> {\n\t\treturn await this.browser?.go(this.createHref(path, this.layer), options);\n\t}\n\n\t/**\n\t *\n\t * @param path\n\t */\n\tpublic createAnchorProps(path: string): AnchorProps {\n\t\tconst href = this.createHref(path, this.layer);\n\t\treturn {\n\t\t\thref,\n\t\t\tonClick: (ev: any) => {\n\t\t\t\tev.stopPropagation();\n\t\t\t\tev.preventDefault();\n\n\t\t\t\tthis.go(path).catch(console.error);\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * Set query params.\n\t *\n\t * @param record\n\t * @param options\n\t */\n\tpublic setQueryParams(\n\t\trecord: Record<string, any>,\n\t\toptions: {\n\t\t\t/**\n\t\t\t * If true, this will merge current query params with the new ones.\n\t\t\t */\n\t\t\tmerge?: boolean;\n\n\t\t\t/**\n\t\t\t * If true, this will add a new entry to the history stack.\n\t\t\t */\n\t\t\tpush?: boolean;\n\t\t} = {},\n\t) {\n\t\tconst search = new URLSearchParams(\n\t\t\toptions.merge\n\t\t\t\t? {\n\t\t\t\t\t\t...this.query,\n\t\t\t\t\t\t...record,\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\t...record,\n\t\t\t\t\t},\n\t\t).toString();\n\n\t\tconst state = search ? `${this.pathname}?${search}` : this.pathname;\n\n\t\tif (options.push) {\n\t\t\twindow.history.pushState({}, \"\", state);\n\t\t} else {\n\t\t\twindow.history.replaceState({}, \"\", state);\n\t\t}\n\t}\n}\n\nexport type HrefLike = string | { options: { path?: string; name?: string } };\n","import { useContext, useMemo } from \"react\";\nimport { RouterContext } from \"../contexts/RouterContext.ts\";\nimport { RouterLayerContext } from \"../contexts/RouterLayerContext.ts\";\nimport { ReactBrowserProvider } from \"../providers/ReactBrowserProvider.ts\";\nimport { RouterHookApi } from \"./RouterHookApi.ts\";\n\nexport const useRouter = (): RouterHookApi => {\n\tconst ctx = useContext(RouterContext);\n\tconst layer = useContext(RouterLayerContext);\n\tif (!ctx || !layer) {\n\t\tthrow new Error(\"useRouter must be used within a RouterProvider\");\n\t}\n\n\treturn useMemo(\n\t\t() =>\n\t\t\tnew RouterHookApi(\n\t\t\t\tctx.state,\n\t\t\t\tlayer,\n\t\t\t\tctx.alepha.isBrowser()\n\t\t\t\t\t? ctx.alepha.get(ReactBrowserProvider)\n\t\t\t\t\t: undefined,\n\t\t\t),\n\t\t[layer],\n\t);\n};\n","import React from \"react\";\nimport type { AnchorHTMLAttributes } from \"react\";\nimport { RouterContext } from \"../contexts/RouterContext.ts\";\nimport type { PageDescriptor } from \"../descriptors/$page.ts\";\nimport { useRouter } from \"../hooks/useRouter.ts\";\n\nexport interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n\tto: string | PageDescriptor;\n\tchildren?: React.ReactNode;\n}\n\nconst Link = (props: LinkProps) => {\n\tReact.useContext(RouterContext);\n\n\tconst to = typeof props.to === \"string\" ? props.to : props.to.options.path;\n\tif (!to) {\n\t\treturn null;\n\t}\n\n\tconst can = typeof props.to === \"string\" ? undefined : props.to.options.can;\n\tif (can && !can()) {\n\t\treturn null;\n\t}\n\n\tconst name = typeof props.to === \"string\" ? undefined : props.to.options.name;\n\n\tconst router = useRouter();\n\treturn (\n\t\t<a {...router.createAnchorProps(to)} {...props}>\n\t\t\t{props.children ?? name}\n\t\t</a>\n\t);\n};\n\nexport default Link;\n","import type { Class } from \"@alepha/core\";\nimport { useContext } from \"react\";\nimport { RouterContext } from \"../contexts/RouterContext.ts\";\n\nexport const useInject = <T extends object>(clazz: Class<T>): T => {\n\tconst ctx = useContext(RouterContext);\n\tif (!ctx) {\n\t\tthrow new Error(\"useRouter must be used within a <RouterProvider>\");\n\t}\n\n\treturn ctx.alepha.get(clazz, {\n\t\tskipRegistration: true,\n\t});\n};\n","import { HttpClient } from \"@alepha/server\";\nimport { useInject } from \"./useInject.ts\";\n\nexport const useClient = (): HttpClient => {\n\treturn useInject(HttpClient);\n};\n","import type { Alepha, Static, TObject } from \"@alepha/core\";\nimport { useContext, useEffect, useState } from \"react\";\nimport { RouterContext } from \"../contexts/RouterContext.ts\";\nimport { useRouter } from \"./useRouter.ts\";\n\nexport interface UseQueryParamsHookOptions {\n\tformat?: \"base64\" | \"querystring\";\n\tkey?: string;\n\tpush?: boolean;\n}\n\nexport const useQueryParams = <T extends TObject>(\n\tschema: T,\n\toptions: UseQueryParamsHookOptions = {},\n): [Static<T>, (data: Static<T>) => void] => {\n\tconst ctx = useContext(RouterContext);\n\tif (!ctx) {\n\t\tthrow new Error(\"useQueryParams must be used within a RouterProvider\");\n\t}\n\n\tconst key = options.key ?? \"q\";\n\tconst router = useRouter();\n\tconst querystring = router.query[key];\n\n\tconst [queryParams, setQueryParams] = useState(\n\t\tdecode(ctx.alepha, schema, router.query[key]),\n\t);\n\n\tuseEffect(() => {\n\t\tsetQueryParams(decode(ctx.alepha, schema, querystring));\n\t}, [querystring]);\n\n\treturn [\n\t\tqueryParams,\n\t\t(queryParams: Static<T>) => {\n\t\t\tsetQueryParams(queryParams);\n\t\t\trouter.setQueryParams(\n\t\t\t\t{ [key]: encode(ctx.alepha, schema, queryParams) },\n\t\t\t\t{\n\t\t\t\t\tmerge: true,\n\t\t\t\t},\n\t\t\t);\n\t\t},\n\t];\n};\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nconst encode = (alepha: Alepha, schema: TObject, data: any) => {\n\treturn btoa(JSON.stringify(alepha.parse(schema, data)));\n};\n\nconst decode = (alepha: Alepha, schema: TObject, data: any) => {\n\ttry {\n\t\treturn alepha.parse(schema, JSON.parse(atob(decodeURIComponent(data))));\n\t} catch (error) {\n\t\treturn {};\n\t}\n};\n","import { useContext, useEffect } from \"react\";\nimport { RouterContext } from \"../contexts/RouterContext.ts\";\nimport { RouterLayerContext } from \"../contexts/RouterLayerContext.ts\";\nimport type { RouterState } from \"../providers/PageDescriptorProvider.ts\";\n\nexport const useRouterEvents = (\n\topts: {\n\t\tonBegin?: () => void;\n\t\tonEnd?: (it: RouterState) => void;\n\t\tonError?: (it: Error) => void;\n\t} = {},\n) => {\n\tconst ctx = useContext(RouterContext);\n\tconst layer = useContext(RouterLayerContext);\n\tif (!ctx || !layer) {\n\t\tthrow new Error(\"useRouter must be used within a RouterProvider\");\n\t}\n\n\tuseEffect(() => {\n\t\tconst subs: Function[] = [];\n\t\tconst onBegin = opts.onBegin;\n\t\tconst onEnd = opts.onEnd;\n\t\tconst onError = opts.onError;\n\n\t\tif (onBegin) {\n\t\t\tsubs.push(ctx.events.on(\"begin\", onBegin));\n\t\t}\n\n\t\tif (onEnd) {\n\t\t\tsubs.push(ctx.events.on(\"end\", onEnd));\n\t\t}\n\n\t\tif (onError) {\n\t\t\tsubs.push(ctx.events.on(\"error\", onError));\n\t\t}\n\n\t\treturn () => {\n\t\t\tfor (const sub of subs) {\n\t\t\t\tsub();\n\t\t\t}\n\t\t};\n\t}, []);\n};\n","import { useContext, useEffect, useState } from \"react\";\nimport { RouterContext } from \"../contexts/RouterContext.ts\";\nimport { RouterLayerContext } from \"../contexts/RouterLayerContext.ts\";\nimport type { RouterState } from \"../providers/PageDescriptorProvider.ts\";\n\nexport const useRouterState = (): RouterState => {\n\tconst ctx = useContext(RouterContext);\n\tconst layer = useContext(RouterLayerContext);\n\tif (!ctx || !layer) {\n\t\tthrow new Error(\"useRouter must be used within a RouterProvider\");\n\t}\n\n\tconst [state, setState] = useState(ctx.state);\n\tuseEffect(\n\t\t() =>\n\t\t\tctx.events.on(\"end\", (it) => {\n\t\t\t\tsetState({ ...it });\n\t\t\t}),\n\t\t[],\n\t);\n\n\treturn state;\n};\n","import { useContext, useEffect, useMemo, useState } from \"react\";\nimport { RouterContext } from \"../contexts/RouterContext.ts\";\nimport { RouterLayerContext } from \"../contexts/RouterLayerContext.ts\";\nimport type { AnchorProps } from \"../providers/PageDescriptorProvider.ts\";\nimport type { HrefLike } from \"./RouterHookApi.ts\";\nimport { useRouter } from \"./useRouter.ts\";\n\nexport const useActive = (path: HrefLike): UseActiveHook => {\n\tconst router = useRouter();\n\tconst ctx = useContext(RouterContext);\n\tconst layer = useContext(RouterLayerContext);\n\tif (!ctx || !layer) {\n\t\tthrow new Error(\"useRouter must be used within a RouterProvider\");\n\t}\n\n\tlet name: string | undefined;\n\tif (typeof path === \"object\" && path.options.name) {\n\t\tname = path.options.name;\n\t}\n\n\tconst [current, setCurrent] = useState(ctx.state.pathname);\n\tconst href = useMemo(() => router.createHref(path, layer), [path, layer]);\n\tconst [isPending, setPending] = useState(false);\n\tconst isActive = current === href;\n\n\tuseEffect(\n\t\t() => ctx.events.on(\"end\", ({ pathname }) => setCurrent(pathname)),\n\t\t[],\n\t);\n\n\treturn {\n\t\tname,\n\t\tisPending,\n\t\tisActive,\n\t\tanchorProps: {\n\t\t\thref,\n\t\t\tonClick: (ev: any) => {\n\t\t\t\tev.stopPropagation();\n\t\t\t\tev.preventDefault();\n\t\t\t\tif (isActive) return;\n\t\t\t\tif (isPending) return;\n\n\t\t\t\tsetPending(true);\n\t\t\t\trouter.go(href).then(() => {\n\t\t\t\t\tsetPending(false);\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t};\n};\n\nexport interface UseActiveHook {\n\tisActive: boolean;\n\tanchorProps: AnchorProps;\n\tisPending: boolean;\n\tname?: string;\n}\n"],"names":["__descriptor","KIND","NotImplementedError","createContext","useContext","useState","useEffect","$logger","$inject","Alepha","createElement","EventEmitter","$hook","RouterProvider","t","HttpClient","hydrateRoot","createRoot","useMemo","jsx"],"mappings":";;;;;;;;;AAEA,MAAM,GAAG,GAAG,MAAM;AACN,MAAC,KAAK,GAAG,CAAC,OAAO,KAAK;AAClC,EAAEA,iBAAY,CAAC,GAAG,CAAC;AACnB,EAAE,IAAI,OAAO,CAAC,QAAQ,EAAE;AACxB,IAAI,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,QAAQ,EAAE;AAC1C,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG;AAC7B,QAAQ;AACR,OAAO;AACP;AACA;AACA,EAAE,IAAI,OAAO,CAAC,MAAM,EAAE;AACtB,IAAI,OAAO,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