@alepha/react 0.11.7 → 0.11.10

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.
@@ -0,0 +1,1263 @@
1
+ import * as _alepha_core1 from "@alepha/core";
2
+ import { Alepha, Async, Atom, Descriptor, Hook, Hooks, KIND, Service, State, Static, TAtomObject, TObject, TSchema } from "@alepha/core";
3
+ import { RequestConfigSchema, ServerHandler, ServerProvider, ServerRequest, ServerRouterProvider, ServerTimingProvider } from "@alepha/server";
4
+ import * as react0 from "react";
5
+ import React, { AnchorHTMLAttributes, CSSProperties, DependencyList, ErrorInfo, FC, PropsWithChildren, ReactNode } from "react";
6
+ import { ServerRouteCache } from "@alepha/server-cache";
7
+ import * as _alepha_logger0 from "@alepha/logger";
8
+ import * as typebox0 from "typebox";
9
+ import { DateTimeProvider, DurationLike } from "@alepha/datetime";
10
+ import { ClientScope, HttpVirtualClient, LinkProvider, VirtualAction } from "@alepha/server-links";
11
+ import { Route, RouterProvider } from "@alepha/router";
12
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
13
+ import { ServerStaticProvider } from "@alepha/server-static";
14
+
15
+ //#region src/components/ClientOnly.d.ts
16
+ interface ClientOnlyProps {
17
+ fallback?: ReactNode;
18
+ disabled?: boolean;
19
+ }
20
+ /**
21
+ * A small utility component that renders its children only on the client side.
22
+ *
23
+ * Optionally, you can provide a fallback React node that will be rendered.
24
+ *
25
+ * You should use this component when
26
+ * - you have code that relies on browser-specific APIs
27
+ * - you want to avoid server-side rendering for a specific part of your application
28
+ * - you want to prevent pre-rendering of a component
29
+ */
30
+ declare const ClientOnly: (props: PropsWithChildren<ClientOnlyProps>) => ReactNode;
31
+ //#endregion
32
+ //#region src/errors/Redirection.d.ts
33
+ /**
34
+ * Used for Redirection during the page loading.
35
+ *
36
+ * Depends on the context, it can be thrown or just returned.
37
+ */
38
+ declare class Redirection extends Error {
39
+ readonly redirect: string;
40
+ constructor(redirect: string);
41
+ }
42
+ //#endregion
43
+ //#region src/providers/ReactPageProvider.d.ts
44
+ declare const envSchema$2: _alepha_core1.TObject<{
45
+ REACT_STRICT_MODE: _alepha_core1.TBoolean;
46
+ }>;
47
+ declare module "@alepha/core" {
48
+ interface Env extends Partial<Static<typeof envSchema$2>> {}
49
+ }
50
+ declare class ReactPageProvider {
51
+ protected readonly log: _alepha_logger0.Logger;
52
+ protected readonly env: {
53
+ REACT_STRICT_MODE: boolean;
54
+ };
55
+ protected readonly alepha: Alepha;
56
+ protected readonly pages: PageRoute[];
57
+ getPages(): PageRoute[];
58
+ getConcretePages(): PageRoute[];
59
+ page(name: string): PageRoute;
60
+ pathname(name: string, options?: {
61
+ params?: Record<string, string>;
62
+ query?: Record<string, string>;
63
+ }): string;
64
+ url(name: string, options?: {
65
+ params?: Record<string, string>;
66
+ host?: string;
67
+ }): URL;
68
+ root(state: ReactRouterState): ReactNode;
69
+ protected convertStringObjectToObject: (schema?: TSchema, value?: any) => any;
70
+ /**
71
+ * Create a new RouterState based on a given route and request.
72
+ * This method resolves the layers for the route, applying any query and params schemas defined in the route.
73
+ * It also handles errors and redirects.
74
+ */
75
+ createLayers(route: PageRoute, state: ReactRouterState, previous?: PreviousLayerData[]): Promise<CreateLayersResult>;
76
+ protected createRedirectionLayer(redirect: string): CreateLayersResult;
77
+ protected getErrorHandler(route: PageRoute): ErrorHandler | undefined;
78
+ protected createElement(page: PageRoute, props: Record<string, any>): Promise<ReactNode>;
79
+ renderError(error: Error): ReactNode;
80
+ renderEmptyView(): ReactNode;
81
+ href(page: {
82
+ options: {
83
+ name?: string;
84
+ };
85
+ }, params?: Record<string, any>): string;
86
+ compile(path: string, params?: Record<string, string>): string;
87
+ protected renderView(index: number, path: string, view: ReactNode | undefined, page: PageRoute): ReactNode;
88
+ protected readonly configure: _alepha_core1.HookDescriptor<"configure">;
89
+ protected map(pages: Array<PageDescriptor>, target: PageDescriptor): PageRouteEntry;
90
+ add(entry: PageRouteEntry): void;
91
+ protected createMatch(page: PageRoute): string;
92
+ protected _next: number;
93
+ protected nextId(): string;
94
+ }
95
+ declare const isPageRoute: (it: any) => it is PageRoute;
96
+ interface PageRouteEntry extends Omit<PageDescriptorOptions, "children" | "parent"> {
97
+ children?: PageRouteEntry[];
98
+ }
99
+ interface PageRoute extends PageRouteEntry {
100
+ type: "page";
101
+ name: string;
102
+ parent?: PageRoute;
103
+ match: string;
104
+ }
105
+ interface Layer {
106
+ config?: {
107
+ query?: Record<string, any>;
108
+ params?: Record<string, any>;
109
+ context?: Record<string, any>;
110
+ };
111
+ name: string;
112
+ props?: Record<string, any>;
113
+ error?: Error;
114
+ part?: string;
115
+ element: ReactNode;
116
+ index: number;
117
+ path: string;
118
+ route?: PageRoute;
119
+ cache?: boolean;
120
+ }
121
+ type PreviousLayerData = Omit<Layer, "element" | "index" | "path">;
122
+ interface AnchorProps {
123
+ href: string;
124
+ onClick: (ev?: any) => any;
125
+ }
126
+ interface ReactRouterState {
127
+ /**
128
+ * Stack of layers for the current page.
129
+ */
130
+ layers: Array<Layer>;
131
+ /**
132
+ * URL of the current page.
133
+ */
134
+ url: URL;
135
+ /**
136
+ * Error handler for the current page.
137
+ */
138
+ onError: ErrorHandler;
139
+ /**
140
+ * Params extracted from the URL for the current page.
141
+ */
142
+ params: Record<string, any>;
143
+ /**
144
+ * Query parameters extracted from the URL for the current page.
145
+ */
146
+ query: Record<string, string>;
147
+ /**
148
+ * Optional meta information associated with the current page.
149
+ */
150
+ meta: Record<string, any>;
151
+ }
152
+ interface RouterStackItem {
153
+ route: PageRoute;
154
+ config?: Record<string, any>;
155
+ props?: Record<string, any>;
156
+ error?: Error;
157
+ cache?: boolean;
158
+ }
159
+ interface TransitionOptions {
160
+ previous?: PreviousLayerData[];
161
+ }
162
+ interface CreateLayersResult {
163
+ redirect?: string;
164
+ state?: ReactRouterState;
165
+ }
166
+ //#endregion
167
+ //#region src/services/ReactPageService.d.ts
168
+ declare class ReactPageService {
169
+ fetch(pathname: string, options?: PageDescriptorRenderOptions): Promise<{
170
+ html: string;
171
+ response: Response;
172
+ }>;
173
+ render(name: string, options?: PageDescriptorRenderOptions): Promise<PageDescriptorRenderResult>;
174
+ }
175
+ //#endregion
176
+ //#region src/descriptors/$page.d.ts
177
+ /**
178
+ * Main descriptor for defining a React route in the application.
179
+ *
180
+ * The $page descriptor is the core building block for creating type-safe, SSR-enabled React routes.
181
+ * It provides a declarative way to define pages with powerful features:
182
+ *
183
+ * **Routing & Navigation**
184
+ * - URL pattern matching with parameters (e.g., `/users/:id`)
185
+ * - Nested routing with parent-child relationships
186
+ * - Type-safe URL parameter and query string validation
187
+ *
188
+ * **Data Loading**
189
+ * - Server-side data fetching with the `resolve` function
190
+ * - Automatic serialization and hydration for SSR
191
+ * - Access to request context, URL params, and parent data
192
+ *
193
+ * **Component Loading**
194
+ * - Direct component rendering or lazy loading for code splitting
195
+ * - Client-only rendering when browser APIs are needed
196
+ * - Automatic fallback handling during hydration
197
+ *
198
+ * **Performance Optimization**
199
+ * - Static generation for pre-rendered pages at build time
200
+ * - Server-side caching with configurable TTL and providers
201
+ * - Code splitting through lazy component loading
202
+ *
203
+ * **Error Handling**
204
+ * - Custom error handlers with support for redirects
205
+ * - Hierarchical error handling (child → parent)
206
+ * - HTTP status code handling (404, 401, etc.)
207
+ *
208
+ * **Page Animations**
209
+ * - CSS-based enter/exit animations
210
+ * - Dynamic animations based on page state
211
+ * - Custom timing and easing functions
212
+ *
213
+ * **Lifecycle Management**
214
+ * - Server response hooks for headers and status codes
215
+ * - Page leave handlers for cleanup (browser only)
216
+ * - Permission-based access control
217
+ *
218
+ * @example Simple page with data fetching
219
+ * ```typescript
220
+ * const userProfile = $page({
221
+ * path: "/users/:id",
222
+ * schema: {
223
+ * params: t.object({ id: t.int() }),
224
+ * query: t.object({ tab: t.optional(t.text()) })
225
+ * },
226
+ * resolve: async ({ params }) => {
227
+ * const user = await userApi.getUser(params.id);
228
+ * return { user };
229
+ * },
230
+ * lazy: () => import("./UserProfile.tsx")
231
+ * });
232
+ * ```
233
+ *
234
+ * @example Nested routing with error handling
235
+ * ```typescript
236
+ * const projectSection = $page({
237
+ * path: "/projects/:id",
238
+ * children: () => [projectBoard, projectSettings],
239
+ * resolve: async ({ params }) => {
240
+ * const project = await projectApi.get(params.id);
241
+ * return { project };
242
+ * },
243
+ * errorHandler: (error) => {
244
+ * if (HttpError.is(error, 404)) {
245
+ * return <ProjectNotFound />;
246
+ * }
247
+ * }
248
+ * });
249
+ * ```
250
+ *
251
+ * @example Static generation with caching
252
+ * ```typescript
253
+ * const blogPost = $page({
254
+ * path: "/blog/:slug",
255
+ * static: {
256
+ * entries: posts.map(p => ({ params: { slug: p.slug } }))
257
+ * },
258
+ * resolve: async ({ params }) => {
259
+ * const post = await loadPost(params.slug);
260
+ * return { post };
261
+ * }
262
+ * });
263
+ * ```
264
+ */
265
+ declare const $page: {
266
+ <TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = any, TPropsParent extends object = TPropsParentDefault>(options: PageDescriptorOptions<TConfig, TProps, TPropsParent>): PageDescriptor<TConfig, TProps, TPropsParent>;
267
+ [KIND]: typeof PageDescriptor;
268
+ };
269
+ interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> {
270
+ /**
271
+ * Identifier name for the page. Must be unique.
272
+ *
273
+ * @default Descriptor key
274
+ */
275
+ name?: string;
276
+ /**
277
+ * Add a pathname to the page.
278
+ *
279
+ * Pathname can contain parameters, like `/post/:slug`.
280
+ *
281
+ * @default ""
282
+ */
283
+ path?: string;
284
+ /**
285
+ * Add an input schema to define:
286
+ * - `params`: parameters from the pathname.
287
+ * - `query`: query parameters from the URL.
288
+ */
289
+ schema?: TConfig;
290
+ /**
291
+ * Load data before rendering the page.
292
+ *
293
+ * This function receives
294
+ * - the request context and
295
+ * - the parent props (if page has a parent)
296
+ *
297
+ * In SSR, the returned data will be serialized and sent to the client, then reused during the client-side hydration.
298
+ *
299
+ * Resolve can be stopped by throwing an error, which will be handled by the `errorHandler` function.
300
+ * It's common to throw a `NotFoundError` to display a 404 page.
301
+ *
302
+ * RedirectError can be thrown to redirect the user to another page.
303
+ */
304
+ resolve?: (context: PageResolve<TConfig, TPropsParent>) => Async<TProps>;
305
+ /**
306
+ * The component to render when the page is loaded.
307
+ *
308
+ * If `lazy` is defined, this will be ignored.
309
+ * Prefer using `lazy` to improve the initial loading time.
310
+ */
311
+ component?: FC<TProps & TPropsParent>;
312
+ /**
313
+ * Lazy load the component when the page is loaded.
314
+ *
315
+ * It's recommended to use this for components to improve the initial loading time
316
+ * and enable code-splitting.
317
+ */
318
+ lazy?: () => Promise<{
319
+ default: FC<TProps & TPropsParent>;
320
+ }>;
321
+ /**
322
+ * Attach child pages to create nested routes.
323
+ * This will make the page a parent route.
324
+ */
325
+ children?: Array<PageDescriptor> | (() => Array<PageDescriptor>);
326
+ /**
327
+ * Define a parent page for nested routing.
328
+ */
329
+ parent?: PageDescriptor<PageConfigSchema, TPropsParent, any>;
330
+ can?: () => boolean;
331
+ /**
332
+ * Catch any error from the `resolve` function or during `rendering`.
333
+ *
334
+ * Expected to return one of the following:
335
+ * - a ReactNode to render an error page
336
+ * - a Redirection to redirect the user
337
+ * - undefined to let the error propagate
338
+ *
339
+ * If not defined, the error will be thrown and handled by the server or client error handler.
340
+ * If a leaf $page does not define an error handler, the error can be caught by parent pages.
341
+ *
342
+ * @example Catch a 404 from API and render a custom not found component:
343
+ * ```ts
344
+ * resolve: async ({ params, query }) => {
345
+ * api.fetch("/api/resource", { params, query });
346
+ * },
347
+ * errorHandler: (error, context) => {
348
+ * if (HttpError.is(error, 404)) {
349
+ * return <ResourceNotFound />;
350
+ * }
351
+ * }
352
+ * ```
353
+ *
354
+ * @example Catch an 401 error and redirect the user to the login page:
355
+ * ```ts
356
+ * resolve: async ({ params, query }) => {
357
+ * // but the user is not authenticated
358
+ * api.fetch("/api/resource", { params, query });
359
+ * },
360
+ * errorHandler: (error, context) => {
361
+ * if (HttpError.is(error, 401)) {
362
+ * // throwing a Redirection is also valid!
363
+ * return new Redirection("/login");
364
+ * }
365
+ * }
366
+ * ```
367
+ */
368
+ errorHandler?: ErrorHandler;
369
+ /**
370
+ * If true, the page will be considered as a static page, immutable and cacheable.
371
+ * Replace boolean by an object to define static entries. (e.g. list of params/query)
372
+ *
373
+ * Browser-side: it only works with `@alepha/vite`, which can pre-render the page at build time.
374
+ *
375
+ * Server-side: It will act as timeless cached page. You can use `cache` to configure the cache behavior.
376
+ */
377
+ static?: boolean | {
378
+ entries?: Array<Partial<PageRequestConfig<TConfig>>>;
379
+ };
380
+ cache?: ServerRouteCache;
381
+ /**
382
+ * If true, force the page to be rendered only on the client-side (browser).
383
+ * It uses the `<ClientOnly/>` component to render the page.
384
+ */
385
+ client?: boolean | ClientOnlyProps;
386
+ /**
387
+ * Called before the server response is sent to the client. (server only)
388
+ */
389
+ onServerResponse?: (request: ServerRequest) => unknown;
390
+ /**
391
+ * Called when user leaves the page. (browser only)
392
+ */
393
+ onLeave?: () => void;
394
+ /**
395
+ * @experimental
396
+ *
397
+ * Add a css animation when the page is loaded or unloaded.
398
+ * It uses CSS animations, so you need to define the keyframes in your CSS.
399
+ *
400
+ * @example Simple animation name
401
+ * ```ts
402
+ * animation: "fadeIn"
403
+ * ```
404
+ *
405
+ * CSS example:
406
+ * ```css
407
+ * @keyframes fadeIn {
408
+ * from { opacity: 0; }
409
+ * to { opacity: 1; }
410
+ * }
411
+ * ```
412
+ *
413
+ * @example Detailed animation
414
+ * ```ts
415
+ * animation: {
416
+ * enter: { name: "fadeIn", duration: 300 },
417
+ * exit: { name: "fadeOut", duration: 200, timing: "ease-in-out" },
418
+ * }
419
+ * ```
420
+ *
421
+ * @example Only exit animation
422
+ * ```ts
423
+ * animation: {
424
+ * exit: "fadeOut"
425
+ * }
426
+ * ```
427
+ *
428
+ * @example With custom timing function
429
+ * ```ts
430
+ * animation: {
431
+ * enter: { name: "fadeIn", duration: 300, timing: "cubic-bezier(0.4, 0, 0.2, 1)" },
432
+ * exit: { name: "fadeOut", duration: 200, timing: "ease-in-out" },
433
+ * }
434
+ * ```
435
+ */
436
+ animation?: PageAnimation;
437
+ }
438
+ type ErrorHandler = (error: Error, state: ReactRouterState) => ReactNode | Redirection | undefined;
439
+ declare class PageDescriptor<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> extends Descriptor<PageDescriptorOptions<TConfig, TProps, TPropsParent>> {
440
+ protected readonly reactPageService: ReactPageService;
441
+ protected onInit(): void;
442
+ get name(): string;
443
+ /**
444
+ * For testing or build purposes.
445
+ *
446
+ * This will render the page (HTML layout included or not) and return the HTML + context.
447
+ * Only valid for server-side rendering, it will throw an error if called on the client-side.
448
+ */
449
+ render(options?: PageDescriptorRenderOptions): Promise<PageDescriptorRenderResult>;
450
+ fetch(options?: PageDescriptorRenderOptions): Promise<{
451
+ html: string;
452
+ response: Response;
453
+ }>;
454
+ match(url: string): boolean;
455
+ pathname(config: any): string;
456
+ }
457
+ interface PageConfigSchema {
458
+ query?: TSchema;
459
+ params?: TSchema;
460
+ }
461
+ type TPropsDefault = any;
462
+ type TPropsParentDefault = {};
463
+ interface PageDescriptorRenderOptions {
464
+ params?: Record<string, string>;
465
+ query?: Record<string, string>;
466
+ /**
467
+ * If true, the HTML layout will be included in the response.
468
+ * If false, only the page content will be returned.
469
+ *
470
+ * @default true
471
+ */
472
+ html?: boolean;
473
+ hydration?: boolean;
474
+ }
475
+ interface PageDescriptorRenderResult {
476
+ html: string;
477
+ state: ReactRouterState;
478
+ redirect?: string;
479
+ }
480
+ interface PageRequestConfig<TConfig extends PageConfigSchema = PageConfigSchema> {
481
+ params: TConfig["params"] extends TSchema ? Static<TConfig["params"]> : Record<string, string>;
482
+ query: TConfig["query"] extends TSchema ? Static<TConfig["query"]> : Record<string, string>;
483
+ }
484
+ type PageResolve<TConfig extends PageConfigSchema = PageConfigSchema, TPropsParent extends object = TPropsParentDefault> = PageRequestConfig<TConfig> & TPropsParent & Omit<ReactRouterState, "layers" | "onError">;
485
+ type PageAnimation = PageAnimationObject | ((state: ReactRouterState) => PageAnimationObject | undefined);
486
+ type PageAnimationObject = CssAnimationName | {
487
+ enter?: CssAnimation | CssAnimationName;
488
+ exit?: CssAnimation | CssAnimationName;
489
+ };
490
+ type CssAnimationName = string;
491
+ type CssAnimation = {
492
+ name: string;
493
+ duration?: number;
494
+ timing?: string;
495
+ };
496
+ //#endregion
497
+ //#region src/providers/ReactBrowserRouterProvider.d.ts
498
+ interface BrowserRoute extends Route {
499
+ page: PageRoute;
500
+ }
501
+ declare class ReactBrowserRouterProvider extends RouterProvider<BrowserRoute> {
502
+ protected readonly log: _alepha_logger0.Logger;
503
+ protected readonly alepha: Alepha;
504
+ protected readonly pageApi: ReactPageProvider;
505
+ add(entry: PageRouteEntry): void;
506
+ protected readonly configure: _alepha_core1.HookDescriptor<"configure">;
507
+ transition(url: URL, previous?: PreviousLayerData[], meta?: {}): Promise<string | void>;
508
+ root(state: ReactRouterState): ReactNode;
509
+ }
510
+ //#endregion
511
+ //#region src/providers/ReactBrowserProvider.d.ts
512
+ declare const envSchema$1: _alepha_core1.TObject<{
513
+ REACT_ROOT_ID: _alepha_core1.TString;
514
+ }>;
515
+ declare module "@alepha/core" {
516
+ interface Env extends Partial<Static<typeof envSchema$1>> {}
517
+ }
518
+ /**
519
+ * React browser renderer configuration atom
520
+ */
521
+ declare const reactBrowserOptions: _alepha_core1.Atom<_alepha_core1.TObject<{
522
+ scrollRestoration: typebox0.TUnsafe<"top" | "manual">;
523
+ }>, "alepha.react.browser.options">;
524
+ type ReactBrowserRendererOptions = Static<typeof reactBrowserOptions.schema>;
525
+ declare module "@alepha/core" {
526
+ interface State {
527
+ [reactBrowserOptions.key]: ReactBrowserRendererOptions;
528
+ }
529
+ }
530
+ declare class ReactBrowserProvider {
531
+ protected readonly env: {
532
+ REACT_ROOT_ID: string;
533
+ };
534
+ protected readonly log: _alepha_logger0.Logger;
535
+ protected readonly client: LinkProvider;
536
+ protected readonly alepha: Alepha;
537
+ protected readonly router: ReactBrowserRouterProvider;
538
+ protected readonly dateTimeProvider: DateTimeProvider;
539
+ protected readonly options: Readonly<{
540
+ scrollRestoration: "top" | "manual";
541
+ }>;
542
+ protected getRootElement(): HTMLElement;
543
+ transitioning?: {
544
+ to: string;
545
+ from?: string;
546
+ };
547
+ get state(): ReactRouterState;
548
+ /**
549
+ * Accessor for Document DOM API.
550
+ */
551
+ get document(): Document;
552
+ /**
553
+ * Accessor for History DOM API.
554
+ */
555
+ get history(): History;
556
+ /**
557
+ * Accessor for Location DOM API.
558
+ */
559
+ get location(): Location;
560
+ get base(): string;
561
+ get url(): string;
562
+ pushState(path: string, replace?: boolean): void;
563
+ invalidate(props?: Record<string, any>): Promise<void>;
564
+ go(url: string, options?: RouterGoOptions): Promise<void>;
565
+ protected render(options?: RouterRenderOptions): Promise<void>;
566
+ /**
567
+ * Get embedded layers from the server.
568
+ */
569
+ protected getHydrationState(): ReactHydrationState | undefined;
570
+ protected readonly onTransitionEnd: _alepha_core1.HookDescriptor<"react:transition:end">;
571
+ readonly ready: _alepha_core1.HookDescriptor<"ready">;
572
+ }
573
+ interface RouterGoOptions {
574
+ replace?: boolean;
575
+ match?: TransitionOptions;
576
+ params?: Record<string, string>;
577
+ query?: Record<string, string>;
578
+ meta?: Record<string, any>;
579
+ /**
580
+ * Recreate the whole page, ignoring the current state.
581
+ */
582
+ force?: boolean;
583
+ }
584
+ type ReactHydrationState = {
585
+ layers?: Array<PreviousLayerData>;
586
+ } & {
587
+ [key: string]: any;
588
+ };
589
+ interface RouterRenderOptions {
590
+ url?: string;
591
+ previous?: PreviousLayerData[];
592
+ meta?: Record<string, any>;
593
+ }
594
+ //#endregion
595
+ //#region src/components/ErrorBoundary.d.ts
596
+ /**
597
+ * Props for the ErrorBoundary component.
598
+ */
599
+ interface ErrorBoundaryProps {
600
+ /**
601
+ * Fallback React node to render when an error is caught.
602
+ * If not provided, a default error message will be shown.
603
+ */
604
+ fallback: (error: Error) => ReactNode;
605
+ /**
606
+ * Optional callback that receives the error and error info.
607
+ * Use this to log errors to a monitoring service.
608
+ */
609
+ onError?: (error: Error, info: ErrorInfo) => void;
610
+ }
611
+ /**
612
+ * State of the ErrorBoundary component.
613
+ */
614
+ interface ErrorBoundaryState {
615
+ error?: Error;
616
+ }
617
+ /**
618
+ * A reusable error boundary for catching rendering errors
619
+ * in any part of the React component tree.
620
+ */
621
+ declare class ErrorBoundary extends React.Component<PropsWithChildren<ErrorBoundaryProps>, ErrorBoundaryState> {
622
+ constructor(props: ErrorBoundaryProps);
623
+ /**
624
+ * Update state so the next render shows the fallback UI.
625
+ */
626
+ static getDerivedStateFromError(error: Error): ErrorBoundaryState;
627
+ /**
628
+ * Lifecycle method called when an error is caught.
629
+ * You can log the error or perform side effects here.
630
+ */
631
+ componentDidCatch(error: Error, info: ErrorInfo): void;
632
+ render(): ReactNode;
633
+ }
634
+ //#endregion
635
+ //#region src/components/ErrorViewer.d.ts
636
+ interface ErrorViewerProps {
637
+ error: Error;
638
+ alepha: Alepha;
639
+ }
640
+ declare const ErrorViewer: ({
641
+ error,
642
+ alepha
643
+ }: ErrorViewerProps) => react_jsx_runtime0.JSX.Element;
644
+ //#endregion
645
+ //#region src/components/Link.d.ts
646
+ interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
647
+ href: string;
648
+ }
649
+ declare const Link: (props: LinkProps) => react_jsx_runtime0.JSX.Element;
650
+ //#endregion
651
+ //#region src/components/NestedView.d.ts
652
+ interface NestedViewProps {
653
+ children?: ReactNode;
654
+ errorBoundary?: false | ((error: Error) => ReactNode);
655
+ }
656
+ declare const _default: react0.MemoExoticComponent<(props: NestedViewProps) => react_jsx_runtime0.JSX.Element>;
657
+ //#endregion
658
+ //#region src/components/NotFound.d.ts
659
+ declare function NotFoundPage(props: {
660
+ style?: CSSProperties;
661
+ }): react_jsx_runtime0.JSX.Element;
662
+ //#endregion
663
+ //#region src/contexts/AlephaContext.d.ts
664
+ declare const AlephaContext: react0.Context<Alepha | undefined>;
665
+ //#endregion
666
+ //#region src/contexts/RouterLayerContext.d.ts
667
+ interface RouterLayerContextValue {
668
+ index: number;
669
+ path: string;
670
+ }
671
+ declare const RouterLayerContext: react0.Context<RouterLayerContextValue | undefined>;
672
+ //#endregion
673
+ //#region src/hooks/useAction.d.ts
674
+ /**
675
+ * Hook for handling async actions with automatic error handling and event emission.
676
+ *
677
+ * By default, prevents concurrent executions - if an action is running and you call it again,
678
+ * the second call will be ignored. Use `debounce` option to delay execution instead.
679
+ *
680
+ * Emits lifecycle events:
681
+ * - `react:action:begin` - When action starts
682
+ * - `react:action:success` - When action completes successfully
683
+ * - `react:action:error` - When action throws an error
684
+ * - `react:action:end` - Always emitted at the end
685
+ *
686
+ * @example Basic usage
687
+ * ```tsx
688
+ * const action = useAction({
689
+ * handler: async (data) => {
690
+ * await api.save(data);
691
+ * }
692
+ * }, []);
693
+ *
694
+ * <button onClick={() => action.run(data)} disabled={action.loading}>
695
+ * Save
696
+ * </button>
697
+ * ```
698
+ *
699
+ * @example With debounce (search input)
700
+ * ```tsx
701
+ * const search = useAction({
702
+ * handler: async (query: string) => {
703
+ * await api.search(query);
704
+ * },
705
+ * debounce: 300 // Wait 300ms after last call
706
+ * }, []);
707
+ *
708
+ * <input onChange={(e) => search.run(e.target.value)} />
709
+ * ```
710
+ *
711
+ * @example Run on component mount
712
+ * ```tsx
713
+ * const fetchData = useAction({
714
+ * handler: async () => {
715
+ * const data = await api.getData();
716
+ * return data;
717
+ * },
718
+ * runOnInit: true // Runs once when component mounts
719
+ * }, []);
720
+ * ```
721
+ *
722
+ * @example Run periodically (polling)
723
+ * ```tsx
724
+ * const pollStatus = useAction({
725
+ * handler: async () => {
726
+ * const status = await api.getStatus();
727
+ * return status;
728
+ * },
729
+ * runEvery: 5000 // Run every 5 seconds
730
+ * }, []);
731
+ *
732
+ * // Or with duration tuple
733
+ * const pollStatus = useAction({
734
+ * handler: async () => {
735
+ * const status = await api.getStatus();
736
+ * return status;
737
+ * },
738
+ * runEvery: [30, 'seconds'] // Run every 30 seconds
739
+ * }, []);
740
+ * ```
741
+ *
742
+ * @example With AbortController
743
+ * ```tsx
744
+ * const fetch = useAction({
745
+ * handler: async (url, { signal }) => {
746
+ * const response = await fetch(url, { signal });
747
+ * return response.json();
748
+ * }
749
+ * }, []);
750
+ * // Automatically cancelled on unmount or when new request starts
751
+ * ```
752
+ *
753
+ * @example With error handling
754
+ * ```tsx
755
+ * const deleteAction = useAction({
756
+ * handler: async (id: string) => {
757
+ * await api.delete(id);
758
+ * },
759
+ * onError: (error) => {
760
+ * if (error.code === 'NOT_FOUND') {
761
+ * // Custom error handling
762
+ * }
763
+ * }
764
+ * }, []);
765
+ *
766
+ * {deleteAction.error && <div>Error: {deleteAction.error.message}</div>}
767
+ * ```
768
+ *
769
+ * @example Global error handling
770
+ * ```tsx
771
+ * // In your root app setup
772
+ * alepha.events.on("react:action:error", ({ error }) => {
773
+ * toast.danger(error.message);
774
+ * Sentry.captureException(error);
775
+ * });
776
+ * ```
777
+ */
778
+ declare function useAction<Args extends any[], Result = void>(options: UseActionOptions<Args, Result>, deps: DependencyList): UseActionReturn<Args, Result>;
779
+ /**
780
+ * Context object passed as the last argument to action handlers.
781
+ * Contains an AbortSignal that can be used to cancel the request.
782
+ */
783
+ interface ActionContext {
784
+ /**
785
+ * AbortSignal that can be passed to fetch or other async operations.
786
+ * The signal will be aborted when:
787
+ * - The component unmounts
788
+ * - A new action is triggered (cancels previous)
789
+ * - The cancel() method is called
790
+ *
791
+ * @example
792
+ * ```tsx
793
+ * const action = useAction({
794
+ * handler: async (url, { signal }) => {
795
+ * const response = await fetch(url, { signal });
796
+ * return response.json();
797
+ * }
798
+ * }, []);
799
+ * ```
800
+ */
801
+ signal: AbortSignal;
802
+ }
803
+ interface UseActionOptions<Args extends any[] = any[], Result = any> {
804
+ /**
805
+ * The async action handler function.
806
+ * Receives the action arguments plus an ActionContext as the last parameter.
807
+ */
808
+ handler: (...args: [...Args, ActionContext]) => Promise<Result>;
809
+ /**
810
+ * Custom error handler. If provided, prevents default error re-throw.
811
+ */
812
+ onError?: (error: Error) => void | Promise<void>;
813
+ /**
814
+ * Custom success handler.
815
+ */
816
+ onSuccess?: (result: Result) => void | Promise<void>;
817
+ /**
818
+ * Optional identifier for this action (useful for debugging/analytics)
819
+ */
820
+ id?: string;
821
+ /**
822
+ * Debounce delay in milliseconds. If specified, the action will only execute
823
+ * after the specified delay has passed since the last call. Useful for search inputs
824
+ * or other high-frequency events.
825
+ *
826
+ * @example
827
+ * ```tsx
828
+ * // Execute search 300ms after user stops typing
829
+ * const search = useAction({ handler: search, debounce: 300 }, [])
830
+ * ```
831
+ */
832
+ debounce?: number;
833
+ /**
834
+ * If true, the action will be executed once when the component mounts.
835
+ *
836
+ * @example
837
+ * ```tsx
838
+ * const fetchData = useAction({
839
+ * handler: async () => await api.getData(),
840
+ * runOnInit: true
841
+ * }, []);
842
+ * ```
843
+ */
844
+ runOnInit?: boolean;
845
+ /**
846
+ * If specified, the action will be executed periodically at the given interval.
847
+ * The interval is specified as a DurationLike value (number in ms, Duration object, or [number, unit] tuple).
848
+ *
849
+ * @example
850
+ * ```tsx
851
+ * // Run every 5 seconds
852
+ * const poll = useAction({
853
+ * handler: async () => await api.poll(),
854
+ * runEvery: 5000
855
+ * }, []);
856
+ * ```
857
+ *
858
+ * @example
859
+ * ```tsx
860
+ * // Run every 1 minute
861
+ * const poll = useAction({
862
+ * handler: async () => await api.poll(),
863
+ * runEvery: [1, 'minute']
864
+ * }, []);
865
+ * ```
866
+ */
867
+ runEvery?: DurationLike;
868
+ }
869
+ interface UseActionReturn<Args extends any[], Result> {
870
+ /**
871
+ * Execute the action with the provided arguments.
872
+ *
873
+ * @example
874
+ * ```tsx
875
+ * const action = useAction({ handler: async (data) => { ... } }, []);
876
+ * action.run(data);
877
+ * ```
878
+ */
879
+ run: (...args: Args) => Promise<Result | undefined>;
880
+ /**
881
+ * Loading state - true when action is executing.
882
+ */
883
+ loading: boolean;
884
+ /**
885
+ * Error state - contains error if action failed, undefined otherwise.
886
+ */
887
+ error?: Error;
888
+ /**
889
+ * Cancel any pending debounced action or abort the current in-flight request.
890
+ *
891
+ * @example
892
+ * ```tsx
893
+ * const action = useAction({ ... }, []);
894
+ *
895
+ * <button onClick={action.cancel} disabled={!action.loading}>
896
+ * Cancel
897
+ * </button>
898
+ * ```
899
+ */
900
+ cancel: () => void;
901
+ }
902
+ //#endregion
903
+ //#region src/hooks/useActive.d.ts
904
+ interface UseActiveOptions {
905
+ href: string;
906
+ startWith?: boolean;
907
+ }
908
+ declare const useActive: (args: string | UseActiveOptions) => UseActiveHook;
909
+ interface UseActiveHook {
910
+ isActive: boolean;
911
+ anchorProps: AnchorProps;
912
+ isPending: boolean;
913
+ }
914
+ //#endregion
915
+ //#region src/hooks/useAlepha.d.ts
916
+ /**
917
+ * Main Alepha hook.
918
+ *
919
+ * It provides access to the Alepha instance within a React component.
920
+ *
921
+ * With Alepha, you can access the core functionalities of the framework:
922
+ *
923
+ * - alepha.state() for state management
924
+ * - alepha.inject() for dependency injection
925
+ * - alepha.events.emit() for event handling
926
+ * etc...
927
+ */
928
+ declare const useAlepha: () => Alepha;
929
+ //#endregion
930
+ //#region src/hooks/useClient.d.ts
931
+ /**
932
+ * Hook to get a virtual client for the specified scope.
933
+ *
934
+ * It's the React-hook version of `$client()`, from `AlephaServerLinks` module.
935
+ */
936
+ declare const useClient: <T$1 extends object>(scope?: ClientScope) => HttpVirtualClient<T$1>;
937
+ //#endregion
938
+ //#region src/hooks/useEvents.d.ts
939
+ /**
940
+ * Allow subscribing to multiple Alepha events. See {@link Hooks} for available events.
941
+ *
942
+ * useEvents is fully typed to ensure correct event callback signatures.
943
+ *
944
+ * @example
945
+ * ```tsx
946
+ * useEvents(
947
+ * {
948
+ * "react:transition:begin": (ev) => {
949
+ * console.log("Transition began to:", ev.to);
950
+ * },
951
+ * "react:transition:error": {
952
+ * priority: "first",
953
+ * callback: (ev) => {
954
+ * console.error("Transition error:", ev.error);
955
+ * },
956
+ * },
957
+ * },
958
+ * [],
959
+ * );
960
+ * ```
961
+ */
962
+ declare const useEvents: (opts: UseEvents, deps: DependencyList) => void;
963
+ type UseEvents = { [T in keyof Hooks]?: Hook<T> | ((payload: Hooks[T]) => Async<void>) };
964
+ //#endregion
965
+ //#region src/hooks/useInject.d.ts
966
+ /**
967
+ * Hook to inject a service instance.
968
+ * It's a wrapper of `useAlepha().inject(service)` with a memoization.
969
+ */
970
+ declare const useInject: <T$1 extends object>(service: Service<T$1>) => T$1;
971
+ //#endregion
972
+ //#region src/hooks/useQueryParams.d.ts
973
+ /**
974
+ * Not well tested. Use with caution.
975
+ */
976
+ declare const useQueryParams: <T$1 extends TObject>(schema: T$1, options?: UseQueryParamsHookOptions) => [Partial<Static<T$1>>, (data: Static<T$1>) => void];
977
+ interface UseQueryParamsHookOptions {
978
+ format?: "base64" | "querystring";
979
+ key?: string;
980
+ push?: boolean;
981
+ }
982
+ //#endregion
983
+ //#region src/services/ReactRouter.d.ts
984
+ declare class ReactRouter<T$1 extends object> {
985
+ protected readonly alepha: Alepha;
986
+ protected readonly pageApi: ReactPageProvider;
987
+ get state(): ReactRouterState;
988
+ get pages(): PageRoute[];
989
+ get concretePages(): PageRoute[];
990
+ get browser(): ReactBrowserProvider | undefined;
991
+ isActive(href: string, options?: {
992
+ startWith?: boolean;
993
+ }): boolean;
994
+ path(name: keyof VirtualRouter<T$1>, config?: {
995
+ params?: Record<string, any>;
996
+ query?: Record<string, any>;
997
+ }): string;
998
+ /**
999
+ * Reload the current page.
1000
+ * This is equivalent to calling `go()` with the current pathname and search.
1001
+ */
1002
+ reload(): Promise<void>;
1003
+ getURL(): URL;
1004
+ get location(): Location;
1005
+ get current(): ReactRouterState;
1006
+ get pathname(): string;
1007
+ get query(): Record<string, string>;
1008
+ back(): Promise<void>;
1009
+ forward(): Promise<void>;
1010
+ invalidate(props?: Record<string, any>): Promise<void>;
1011
+ go(path: string, options?: RouterGoOptions): Promise<void>;
1012
+ go(path: keyof VirtualRouter<T$1>, options?: RouterGoOptions): Promise<void>;
1013
+ anchor(path: string, options?: RouterGoOptions): AnchorProps;
1014
+ anchor(path: keyof VirtualRouter<T$1>, options?: RouterGoOptions): AnchorProps;
1015
+ base(path: string): string;
1016
+ /**
1017
+ * Set query params.
1018
+ *
1019
+ * @param record
1020
+ * @param options
1021
+ */
1022
+ setQueryParams(record: Record<string, any> | ((queryParams: Record<string, any>) => Record<string, any>), options?: {
1023
+ /**
1024
+ * If true, this will add a new entry to the history stack.
1025
+ */
1026
+ push?: boolean;
1027
+ }): void;
1028
+ }
1029
+ type VirtualRouter<T$1> = { [K in keyof T$1 as T$1[K] extends PageDescriptor ? K : never]: T$1[K] };
1030
+ //#endregion
1031
+ //#region src/hooks/useRouter.d.ts
1032
+ /**
1033
+ * Use this hook to access the React Router instance.
1034
+ *
1035
+ * You can add a type parameter to specify the type of your application.
1036
+ * This will allow you to use the router in a typesafe way.
1037
+ *
1038
+ * @example
1039
+ * class App {
1040
+ * home = $page();
1041
+ * }
1042
+ *
1043
+ * const router = useRouter<App>();
1044
+ * router.go("home"); // typesafe
1045
+ */
1046
+ declare const useRouter: <T$1 extends object = any>() => ReactRouter<T$1>;
1047
+ //#endregion
1048
+ //#region src/hooks/useRouterState.d.ts
1049
+ declare const useRouterState: () => ReactRouterState;
1050
+ //#endregion
1051
+ //#region src/hooks/useSchema.d.ts
1052
+ declare const useSchema: <TConfig extends RequestConfigSchema>(action: VirtualAction<TConfig>) => UseSchemaReturn<TConfig>;
1053
+ type UseSchemaReturn<TConfig extends RequestConfigSchema> = TConfig & {
1054
+ loading: boolean;
1055
+ };
1056
+ /**
1057
+ * Get an action schema during server-side rendering (SSR) or client-side rendering (CSR).
1058
+ */
1059
+ declare const ssrSchemaLoading: (alepha: Alepha, name: string) => RequestConfigSchema | {
1060
+ loading: boolean;
1061
+ };
1062
+ //#endregion
1063
+ //#region src/hooks/useStore.d.ts
1064
+ /**
1065
+ * Hook to access and mutate the Alepha state.
1066
+ */
1067
+ declare function useStore<T$1 extends TAtomObject>(target: Atom<T$1>, defaultValue?: Static<T$1>): UseStoreReturn<Static<T$1>>;
1068
+ declare function useStore<Key extends keyof State>(target: Key, defaultValue?: State[Key]): UseStoreReturn<State[Key]>;
1069
+ type UseStoreReturn<T$1> = [T$1, (value: T$1) => void];
1070
+ //#endregion
1071
+ //#region src/providers/ReactServerProvider.d.ts
1072
+ declare const envSchema: _alepha_core1.TObject<{
1073
+ REACT_SSR_ENABLED: _alepha_core1.TOptional<_alepha_core1.TBoolean>;
1074
+ REACT_ROOT_ID: _alepha_core1.TString;
1075
+ REACT_SERVER_TEMPLATE: _alepha_core1.TOptional<_alepha_core1.TString>;
1076
+ }>;
1077
+ declare module "@alepha/core" {
1078
+ interface Env extends Partial<Static<typeof envSchema>> {}
1079
+ interface State {
1080
+ "alepha.react.server.ssr"?: boolean;
1081
+ }
1082
+ }
1083
+ /**
1084
+ * React server provider configuration atom
1085
+ */
1086
+ declare const reactServerOptions: _alepha_core1.Atom<_alepha_core1.TObject<{
1087
+ publicDir: _alepha_core1.TString;
1088
+ staticServer: _alepha_core1.TObject<{
1089
+ disabled: _alepha_core1.TBoolean;
1090
+ path: _alepha_core1.TString;
1091
+ }>;
1092
+ }>, "alepha.react.server.options">;
1093
+ type ReactServerProviderOptions = Static<typeof reactServerOptions.schema>;
1094
+ declare module "@alepha/core" {
1095
+ interface State {
1096
+ [reactServerOptions.key]: ReactServerProviderOptions;
1097
+ }
1098
+ }
1099
+ declare class ReactServerProvider {
1100
+ protected readonly log: _alepha_logger0.Logger;
1101
+ protected readonly alepha: Alepha;
1102
+ protected readonly env: {
1103
+ REACT_SSR_ENABLED?: boolean | undefined;
1104
+ REACT_SERVER_TEMPLATE?: string | undefined;
1105
+ REACT_ROOT_ID: string;
1106
+ };
1107
+ protected readonly pageApi: ReactPageProvider;
1108
+ protected readonly serverProvider: ServerProvider;
1109
+ protected readonly serverStaticProvider: ServerStaticProvider;
1110
+ protected readonly serverRouterProvider: ServerRouterProvider;
1111
+ protected readonly serverTimingProvider: ServerTimingProvider;
1112
+ readonly ROOT_DIV_REGEX: RegExp;
1113
+ protected preprocessedTemplate: PreprocessedTemplate | null;
1114
+ protected readonly options: Readonly<{
1115
+ publicDir: string;
1116
+ staticServer: {
1117
+ disabled: boolean;
1118
+ path: string;
1119
+ };
1120
+ }>;
1121
+ /**
1122
+ * Configure the React server provider.
1123
+ */
1124
+ readonly onConfigure: _alepha_core1.HookDescriptor<"configure">;
1125
+ get template(): string;
1126
+ protected registerPages(templateLoader: TemplateLoader): Promise<void>;
1127
+ /**
1128
+ * Get the public directory path where static files are located.
1129
+ */
1130
+ protected getPublicDirectory(): string;
1131
+ /**
1132
+ * Configure the static file server to serve files from the given root directory.
1133
+ */
1134
+ protected configureStaticServer(root: string): Promise<void>;
1135
+ /**
1136
+ * Configure Vite for SSR.
1137
+ */
1138
+ protected configureVite(ssrEnabled: boolean): Promise<void>;
1139
+ /**
1140
+ * For testing purposes, creates a render function that can be used.
1141
+ */
1142
+ render(name: string, options?: PageDescriptorRenderOptions): Promise<PageDescriptorRenderResult>;
1143
+ protected createHandler(route: PageRoute, templateLoader: TemplateLoader): ServerHandler;
1144
+ renderToHtml(template: string, state: ReactRouterState, hydration?: boolean): string | Redirection;
1145
+ protected preprocessTemplate(template: string): PreprocessedTemplate;
1146
+ protected fillTemplate(response: {
1147
+ html: string;
1148
+ }, app: string, script: string): void;
1149
+ }
1150
+ type TemplateLoader = () => Promise<string | undefined>;
1151
+ interface PreprocessedTemplate {
1152
+ beforeApp: string;
1153
+ afterApp: string;
1154
+ beforeScript: string;
1155
+ afterScript: string;
1156
+ }
1157
+ //#endregion
1158
+ //#region src/index.d.ts
1159
+ declare module "@alepha/core" {
1160
+ interface State {
1161
+ "alepha.react.router.state"?: ReactRouterState;
1162
+ }
1163
+ interface Hooks {
1164
+ /**
1165
+ * Fires when the React application is starting to be rendered on the server.
1166
+ */
1167
+ "react:server:render:begin": {
1168
+ request?: ServerRequest;
1169
+ state: ReactRouterState;
1170
+ };
1171
+ /**
1172
+ * Fires when the React application has been rendered on the server.
1173
+ */
1174
+ "react:server:render:end": {
1175
+ request?: ServerRequest;
1176
+ state: ReactRouterState;
1177
+ html: string;
1178
+ };
1179
+ /**
1180
+ * Fires when the React application is being rendered on the browser.
1181
+ */
1182
+ "react:browser:render": {
1183
+ root: HTMLElement;
1184
+ element: ReactNode;
1185
+ state: ReactRouterState;
1186
+ hydration?: ReactHydrationState;
1187
+ };
1188
+ /**
1189
+ * Fires when a user action is starting.
1190
+ * Action can be a form submission, a route transition, or a custom action.
1191
+ */
1192
+ "react:action:begin": {
1193
+ type: string;
1194
+ id?: string;
1195
+ };
1196
+ /**
1197
+ * Fires when a user action has succeeded.
1198
+ * Action can be a form submission, a route transition, or a custom action.
1199
+ */
1200
+ "react:action:success": {
1201
+ type: string;
1202
+ id?: string;
1203
+ };
1204
+ /**
1205
+ * Fires when a user action has failed.
1206
+ * Action can be a form submission, a route transition, or a custom action.
1207
+ */
1208
+ "react:action:error": {
1209
+ type: string;
1210
+ id?: string;
1211
+ error: Error;
1212
+ };
1213
+ /**
1214
+ * Fires when a user action has completed, regardless of success or failure.
1215
+ * Action can be a form submission, a route transition, or a custom action.
1216
+ */
1217
+ "react:action:end": {
1218
+ type: string;
1219
+ id?: string;
1220
+ };
1221
+ /**
1222
+ * Fires when a route transition is starting.
1223
+ */
1224
+ "react:transition:begin": {
1225
+ previous: ReactRouterState;
1226
+ state: ReactRouterState;
1227
+ animation?: PageAnimation;
1228
+ };
1229
+ /**
1230
+ * Fires when a route transition has succeeded.
1231
+ */
1232
+ "react:transition:success": {
1233
+ state: ReactRouterState;
1234
+ };
1235
+ /**
1236
+ * Fires when a route transition has failed.
1237
+ */
1238
+ "react:transition:error": {
1239
+ state: ReactRouterState;
1240
+ error: Error;
1241
+ };
1242
+ /**
1243
+ * Fires when a route transition has completed, regardless of success or failure.
1244
+ */
1245
+ "react:transition:end": {
1246
+ state: ReactRouterState;
1247
+ };
1248
+ }
1249
+ }
1250
+ /**
1251
+ * Provides full-stack React development with declarative routing, server-side rendering, and client-side hydration.
1252
+ *
1253
+ * The React module enables building modern React applications using the `$page` descriptor on class properties.
1254
+ * It delivers seamless server-side rendering, automatic code splitting, and client-side navigation with full
1255
+ * type safety and schema validation for route parameters and data.
1256
+ *
1257
+ * @see {@link $page}
1258
+ * @module alepha.react
1259
+ */
1260
+ declare const AlephaReact: _alepha_core1.Service<_alepha_core1.Module>;
1261
+ //#endregion
1262
+ export { $page, ActionContext, AlephaContext, AlephaReact, AnchorProps, ClientOnly, CreateLayersResult, ErrorBoundary, ErrorHandler, ErrorViewer, Layer, Link, type LinkProps, _default as NestedView, NotFoundPage as NotFound, PageAnimation, PageConfigSchema, PageDescriptor, PageDescriptorOptions, PageDescriptorRenderOptions, PageDescriptorRenderResult, PageRequestConfig, PageResolve, PageRoute, PageRouteEntry, PreviousLayerData, ReactBrowserProvider, ReactBrowserRendererOptions, ReactHydrationState, ReactPageProvider, ReactRouter, ReactRouterState, ReactServerProvider, ReactServerProviderOptions, Redirection, RouterGoOptions, RouterLayerContext, RouterLayerContextValue, RouterRenderOptions, RouterStackItem, TPropsDefault, TPropsParentDefault, TransitionOptions, UseActionOptions, UseActionReturn, UseActiveHook, UseActiveOptions, UseQueryParamsHookOptions, UseSchemaReturn, UseStoreReturn, VirtualRouter, isPageRoute, reactBrowserOptions, reactServerOptions, ssrSchemaLoading, useAction, useActive, useAlepha, useClient, useEvents, useInject, useQueryParams, useRouter, useRouterState, useSchema, useStore };
1263
+ //# sourceMappingURL=index.d.cts.map