@alepha/react 0.11.3 → 0.11.4

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.
@@ -1,14 +1,14 @@
1
- import * as _alepha_core1 from "@alepha/core";
2
- import { Alepha, Async, Configurable, Descriptor, Hooks, KIND, Service, State, Static, TObject, TSchema } from "@alepha/core";
1
+ import * as _alepha_core10 from "@alepha/core";
2
+ import { Alepha, Async, Configurable, Descriptor, Hook, Hooks, KIND, Service, State, Static, TObject, TSchema } from "@alepha/core";
3
+ import { DateTimeProvider, DurationLike } from "@alepha/datetime";
3
4
  import { RequestConfigSchema, ServerHandler, ServerProvider, ServerRequest, ServerRouterProvider, ServerTimingProvider } from "@alepha/server";
4
5
  import { ServerRouteCache } from "@alepha/server-cache";
5
6
  import { ClientScope, HttpVirtualClient, LinkProvider, VirtualAction } from "@alepha/server-links";
6
7
  import * as _alepha_logger0 from "@alepha/logger";
7
8
  import * as react0 from "react";
8
- import React, { AnchorHTMLAttributes, CSSProperties, ErrorInfo, FC, PropsWithChildren, ReactNode } from "react";
9
+ import React, { AnchorHTMLAttributes, CSSProperties, DependencyList, ErrorInfo, FC, PropsWithChildren, ReactNode } from "react";
9
10
  import * as react_jsx_runtime0 from "react/jsx-runtime";
10
11
  import { ServeDescriptorOptions, ServerStaticProvider } from "@alepha/server-static";
11
- import { DateTimeProvider } from "@alepha/datetime";
12
12
  import { Route, RouterProvider } from "@alepha/router";
13
13
 
14
14
  //#region src/components/ClientOnly.d.ts
@@ -40,8 +40,8 @@ declare class Redirection extends Error {
40
40
  }
41
41
  //#endregion
42
42
  //#region src/providers/ReactPageProvider.d.ts
43
- declare const envSchema$2: _alepha_core1.TObject<{
44
- REACT_STRICT_MODE: _alepha_core1.TBoolean;
43
+ declare const envSchema$2: _alepha_core10.TObject<{
44
+ REACT_STRICT_MODE: _alepha_core10.TBoolean;
45
45
  }>;
46
46
  declare module "@alepha/core" {
47
47
  interface Env extends Partial<Static<typeof envSchema$2>> {}
@@ -54,6 +54,7 @@ declare class ReactPageProvider {
54
54
  protected readonly alepha: Alepha;
55
55
  protected readonly pages: PageRoute[];
56
56
  getPages(): PageRoute[];
57
+ getConcretePages(): PageRoute[];
57
58
  page(name: string): PageRoute;
58
59
  pathname(name: string, options?: {
59
60
  params?: Record<string, string>;
@@ -83,7 +84,7 @@ declare class ReactPageProvider {
83
84
  }, params?: Record<string, any>): string;
84
85
  compile(path: string, params?: Record<string, string>): string;
85
86
  protected renderView(index: number, path: string, view: ReactNode | undefined, page: PageRoute): ReactNode;
86
- protected readonly configure: _alepha_core1.HookDescriptor<"configure">;
87
+ protected readonly configure: _alepha_core10.HookDescriptor<"configure">;
87
88
  protected map(pages: Array<PageDescriptor>, target: PageDescriptor): PageRouteEntry;
88
89
  add(entry: PageRouteEntry): void;
89
90
  protected createMatch(page: PageRoute): string;
@@ -162,6 +163,15 @@ interface CreateLayersResult {
162
163
  state?: ReactRouterState;
163
164
  }
164
165
  //#endregion
166
+ //#region src/services/ReactPageService.d.ts
167
+ declare class ReactPageService {
168
+ fetch(pathname: string, options?: PageDescriptorRenderOptions): Promise<{
169
+ html: string;
170
+ response: Response;
171
+ }>;
172
+ render(name: string, options?: PageDescriptorRenderOptions): Promise<PageDescriptorRenderResult>;
173
+ }
174
+ //#endregion
165
175
  //#region src/descriptors/$page.d.ts
166
176
  /**
167
177
  * Main descriptor for defining a React route in the application.
@@ -257,15 +267,11 @@ declare const $page: {
257
267
  };
258
268
  interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> {
259
269
  /**
260
- * Name your page.
270
+ * Identifier name for the page. Must be unique.
261
271
  *
262
272
  * @default Descriptor key
263
273
  */
264
274
  name?: string;
265
- /**
266
- * Optional description of the page.
267
- */
268
- description?: string;
269
275
  /**
270
276
  * Add a pathname to the page.
271
277
  *
@@ -312,14 +318,14 @@ interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSch
312
318
  default: FC<TProps & TPropsParent>;
313
319
  }>;
314
320
  /**
315
- * Set some children pages and make the page a parent page.
316
- *
317
- * /!\ Parent page can't be rendered directly. /!\
318
- *
319
- * If you still want to render at this pathname, add a child page with an empty path.
321
+ * Attach child pages to create nested routes.
322
+ * This will make the page a parent route.
320
323
  */
321
324
  children?: Array<PageDescriptor> | (() => Array<PageDescriptor>);
322
- parent?: PageDescriptor<PageConfigSchema, TPropsParent>;
325
+ /**
326
+ * Define a parent page for nested routing.
327
+ */
328
+ parent?: PageDescriptor<PageConfigSchema, TPropsParent, any>;
323
329
  can?: () => boolean;
324
330
  /**
325
331
  * Catch any error from the `resolve` function or during `rendering`.
@@ -363,23 +369,23 @@ interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSch
363
369
  * If true, the page will be considered as a static page, immutable and cacheable.
364
370
  * Replace boolean by an object to define static entries. (e.g. list of params/query)
365
371
  *
366
- * For now, it only works with `@alepha/vite` which can pre-render the page at build time.
372
+ * Browser-side: it only works with `@alepha/vite`, which can pre-render the page at build time.
367
373
  *
368
- * It will act as timeless cached page server-side. You can use `cache` to configure the cache behavior.
374
+ * Server-side: It will act as timeless cached page. You can use `cache` to configure the cache behavior.
369
375
  */
370
376
  static?: boolean | {
371
377
  entries?: Array<Partial<PageRequestConfig<TConfig>>>;
372
378
  };
373
379
  cache?: ServerRouteCache;
374
380
  /**
375
- * If true, force the page to be rendered only on the client-side.
381
+ * If true, force the page to be rendered only on the client-side (browser).
376
382
  * It uses the `<ClientOnly/>` component to render the page.
377
383
  */
378
384
  client?: boolean | ClientOnlyProps;
379
385
  /**
380
- * Called before the server response is sent to the client.
386
+ * Called before the server response is sent to the client. (server only)
381
387
  */
382
- onServerResponse?: (request: ServerRequest) => any;
388
+ onServerResponse?: (request: ServerRequest) => unknown;
383
389
  /**
384
390
  * Called when user leaves the page. (browser only)
385
391
  */
@@ -430,10 +436,13 @@ interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSch
430
436
  }
431
437
  type ErrorHandler = (error: Error, state: ReactRouterState) => ReactNode | Redirection | undefined;
432
438
  declare class PageDescriptor<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> extends Descriptor<PageDescriptorOptions<TConfig, TProps, TPropsParent>> {
439
+ protected readonly reactPageService: ReactPageService;
433
440
  protected onInit(): void;
434
441
  get name(): string;
435
442
  /**
436
- * For testing or build purposes, this will render the page (with or without the HTML layout) and return the HTML and context.
443
+ * For testing or build purposes.
444
+ *
445
+ * This will render the page (HTML layout included or not) and return the HTML + context.
437
446
  * Only valid for server-side rendering, it will throw an error if called on the client-side.
438
447
  */
439
448
  render(options?: PageDescriptorRenderOptions): Promise<PageDescriptorRenderResult>;
@@ -493,14 +502,14 @@ declare class ReactBrowserRouterProvider extends RouterProvider<BrowserRoute> {
493
502
  protected readonly alepha: Alepha;
494
503
  protected readonly pageApi: ReactPageProvider;
495
504
  add(entry: PageRouteEntry): void;
496
- protected readonly configure: _alepha_core1.HookDescriptor<"configure">;
505
+ protected readonly configure: _alepha_core10.HookDescriptor<"configure">;
497
506
  transition(url: URL, previous?: PreviousLayerData[], meta?: {}): Promise<string | void>;
498
507
  root(state: ReactRouterState): ReactNode;
499
508
  }
500
509
  //#endregion
501
510
  //#region src/providers/ReactBrowserProvider.d.ts
502
- declare const envSchema$1: _alepha_core1.TObject<{
503
- REACT_ROOT_ID: _alepha_core1.TString;
511
+ declare const envSchema$1: _alepha_core10.TObject<{
512
+ REACT_ROOT_ID: _alepha_core10.TString;
504
513
  }>;
505
514
  declare module "@alepha/core" {
506
515
  interface Env extends Partial<Static<typeof envSchema$1>> {}
@@ -546,8 +555,8 @@ declare class ReactBrowserProvider {
546
555
  * Get embedded layers from the server.
547
556
  */
548
557
  protected getHydrationState(): ReactHydrationState | undefined;
549
- protected readonly onTransitionEnd: _alepha_core1.HookDescriptor<"react:transition:end">;
550
- readonly ready: _alepha_core1.HookDescriptor<"ready">;
558
+ protected readonly onTransitionEnd: _alepha_core10.HookDescriptor<"react:transition:end">;
559
+ readonly ready: _alepha_core10.HookDescriptor<"ready">;
551
560
  }
552
561
  interface RouterGoOptions {
553
562
  replace?: boolean;
@@ -649,6 +658,236 @@ interface RouterLayerContextValue {
649
658
  }
650
659
  declare const RouterLayerContext: react0.Context<RouterLayerContextValue | undefined>;
651
660
  //#endregion
661
+ //#region src/hooks/useAction.d.ts
662
+ /**
663
+ * Hook for handling async actions with automatic error handling and event emission.
664
+ *
665
+ * By default, prevents concurrent executions - if an action is running and you call it again,
666
+ * the second call will be ignored. Use `debounce` option to delay execution instead.
667
+ *
668
+ * Emits lifecycle events:
669
+ * - `react:action:begin` - When action starts
670
+ * - `react:action:success` - When action completes successfully
671
+ * - `react:action:error` - When action throws an error
672
+ * - `react:action:end` - Always emitted at the end
673
+ *
674
+ * @example Basic usage
675
+ * ```tsx
676
+ * const action = useAction({
677
+ * handler: async (data) => {
678
+ * await api.save(data);
679
+ * }
680
+ * }, []);
681
+ *
682
+ * <button onClick={() => action.run(data)} disabled={action.loading}>
683
+ * Save
684
+ * </button>
685
+ * ```
686
+ *
687
+ * @example With debounce (search input)
688
+ * ```tsx
689
+ * const search = useAction({
690
+ * handler: async (query: string) => {
691
+ * await api.search(query);
692
+ * },
693
+ * debounce: 300 // Wait 300ms after last call
694
+ * }, []);
695
+ *
696
+ * <input onChange={(e) => search.run(e.target.value)} />
697
+ * ```
698
+ *
699
+ * @example Run on component mount
700
+ * ```tsx
701
+ * const fetchData = useAction({
702
+ * handler: async () => {
703
+ * const data = await api.getData();
704
+ * return data;
705
+ * },
706
+ * runOnInit: true // Runs once when component mounts
707
+ * }, []);
708
+ * ```
709
+ *
710
+ * @example Run periodically (polling)
711
+ * ```tsx
712
+ * const pollStatus = useAction({
713
+ * handler: async () => {
714
+ * const status = await api.getStatus();
715
+ * return status;
716
+ * },
717
+ * runEvery: 5000 // Run every 5 seconds
718
+ * }, []);
719
+ *
720
+ * // Or with duration tuple
721
+ * const pollStatus = useAction({
722
+ * handler: async () => {
723
+ * const status = await api.getStatus();
724
+ * return status;
725
+ * },
726
+ * runEvery: [30, 'seconds'] // Run every 30 seconds
727
+ * }, []);
728
+ * ```
729
+ *
730
+ * @example With AbortController
731
+ * ```tsx
732
+ * const fetch = useAction({
733
+ * handler: async (url, { signal }) => {
734
+ * const response = await fetch(url, { signal });
735
+ * return response.json();
736
+ * }
737
+ * }, []);
738
+ * // Automatically cancelled on unmount or when new request starts
739
+ * ```
740
+ *
741
+ * @example With error handling
742
+ * ```tsx
743
+ * const deleteAction = useAction({
744
+ * handler: async (id: string) => {
745
+ * await api.delete(id);
746
+ * },
747
+ * onError: (error) => {
748
+ * if (error.code === 'NOT_FOUND') {
749
+ * // Custom error handling
750
+ * }
751
+ * }
752
+ * }, []);
753
+ *
754
+ * {deleteAction.error && <div>Error: {deleteAction.error.message}</div>}
755
+ * ```
756
+ *
757
+ * @example Global error handling
758
+ * ```tsx
759
+ * // In your root app setup
760
+ * alepha.events.on("react:action:error", ({ error }) => {
761
+ * toast.danger(error.message);
762
+ * Sentry.captureException(error);
763
+ * });
764
+ * ```
765
+ */
766
+ declare function useAction<Args extends any[], Result = void>(options: UseActionOptions<Args, Result>, deps: DependencyList): UseActionReturn<Args, Result>;
767
+ /**
768
+ * Context object passed as the last argument to action handlers.
769
+ * Contains an AbortSignal that can be used to cancel the request.
770
+ */
771
+ interface ActionContext {
772
+ /**
773
+ * AbortSignal that can be passed to fetch or other async operations.
774
+ * The signal will be aborted when:
775
+ * - The component unmounts
776
+ * - A new action is triggered (cancels previous)
777
+ * - The cancel() method is called
778
+ *
779
+ * @example
780
+ * ```tsx
781
+ * const action = useAction({
782
+ * handler: async (url, { signal }) => {
783
+ * const response = await fetch(url, { signal });
784
+ * return response.json();
785
+ * }
786
+ * }, []);
787
+ * ```
788
+ */
789
+ signal: AbortSignal;
790
+ }
791
+ interface UseActionOptions<Args extends any[] = any[], Result = any> {
792
+ /**
793
+ * The async action handler function.
794
+ * Receives the action arguments plus an ActionContext as the last parameter.
795
+ */
796
+ handler: (...args: [...Args, ActionContext]) => Promise<Result>;
797
+ /**
798
+ * Custom error handler. If provided, prevents default error re-throw.
799
+ */
800
+ onError?: (error: Error) => void | Promise<void>;
801
+ /**
802
+ * Custom success handler.
803
+ */
804
+ onSuccess?: (result: Result) => void | Promise<void>;
805
+ /**
806
+ * Optional identifier for this action (useful for debugging/analytics)
807
+ */
808
+ id?: string;
809
+ /**
810
+ * Debounce delay in milliseconds. If specified, the action will only execute
811
+ * after the specified delay has passed since the last call. Useful for search inputs
812
+ * or other high-frequency events.
813
+ *
814
+ * @example
815
+ * ```tsx
816
+ * // Execute search 300ms after user stops typing
817
+ * const search = useAction({ handler: search, debounce: 300 }, [])
818
+ * ```
819
+ */
820
+ debounce?: number;
821
+ /**
822
+ * If true, the action will be executed once when the component mounts.
823
+ *
824
+ * @example
825
+ * ```tsx
826
+ * const fetchData = useAction({
827
+ * handler: async () => await api.getData(),
828
+ * runOnInit: true
829
+ * }, []);
830
+ * ```
831
+ */
832
+ runOnInit?: boolean;
833
+ /**
834
+ * If specified, the action will be executed periodically at the given interval.
835
+ * The interval is specified as a DurationLike value (number in ms, Duration object, or [number, unit] tuple).
836
+ *
837
+ * @example
838
+ * ```tsx
839
+ * // Run every 5 seconds
840
+ * const poll = useAction({
841
+ * handler: async () => await api.poll(),
842
+ * runEvery: 5000
843
+ * }, []);
844
+ * ```
845
+ *
846
+ * @example
847
+ * ```tsx
848
+ * // Run every 1 minute
849
+ * const poll = useAction({
850
+ * handler: async () => await api.poll(),
851
+ * runEvery: [1, 'minute']
852
+ * }, []);
853
+ * ```
854
+ */
855
+ runEvery?: DurationLike;
856
+ }
857
+ interface UseActionReturn<Args extends any[], Result> {
858
+ /**
859
+ * Execute the action with the provided arguments.
860
+ *
861
+ * @example
862
+ * ```tsx
863
+ * const action = useAction({ handler: async (data) => { ... } }, []);
864
+ * action.run(data);
865
+ * ```
866
+ */
867
+ run: (...args: Args) => Promise<Result | undefined>;
868
+ /**
869
+ * Loading state - true when action is executing.
870
+ */
871
+ loading: boolean;
872
+ /**
873
+ * Error state - contains error if action failed, undefined otherwise.
874
+ */
875
+ error?: Error;
876
+ /**
877
+ * Cancel any pending debounced action or abort the current in-flight request.
878
+ *
879
+ * @example
880
+ * ```tsx
881
+ * const action = useAction({ ... }, []);
882
+ *
883
+ * <button onClick={action.cancel} disabled={!action.loading}>
884
+ * Cancel
885
+ * </button>
886
+ * ```
887
+ */
888
+ cancel: () => void;
889
+ }
890
+ //#endregion
652
891
  //#region src/hooks/useActive.d.ts
653
892
  interface UseActiveOptions {
654
893
  href: string;
@@ -682,20 +921,47 @@ declare const useAlepha: () => Alepha;
682
921
  *
683
922
  * It's the React-hook version of `$client()`, from `AlephaServerLinks` module.
684
923
  */
685
- declare const useClient: <T extends object>(scope?: ClientScope) => HttpVirtualClient<T>;
924
+ declare const useClient: <T$1 extends object>(scope?: ClientScope) => HttpVirtualClient<T$1>;
925
+ //#endregion
926
+ //#region src/hooks/useEvents.d.ts
927
+ /**
928
+ * Allow subscribing to multiple Alepha events. See {@link Hooks} for available events.
929
+ *
930
+ * useEvents is fully typed to ensure correct event callback signatures.
931
+ *
932
+ * @example
933
+ * ```tsx
934
+ * useEvents(
935
+ * {
936
+ * "react:transition:begin": (ev) => {
937
+ * console.log("Transition began to:", ev.to);
938
+ * },
939
+ * "react:transition:error": {
940
+ * priority: "first",
941
+ * callback: (ev) => {
942
+ * console.error("Transition error:", ev.error);
943
+ * },
944
+ * },
945
+ * },
946
+ * [],
947
+ * );
948
+ * ```
949
+ */
950
+ declare const useEvents: (opts: UseEvents, deps: DependencyList) => void;
951
+ type UseEvents = { [T in keyof Hooks]?: Hook<T> | ((payload: Hooks[T]) => Async<void>) };
686
952
  //#endregion
687
953
  //#region src/hooks/useInject.d.ts
688
954
  /**
689
955
  * Hook to inject a service instance.
690
956
  * It's a wrapper of `useAlepha().inject(service)` with a memoization.
691
957
  */
692
- declare const useInject: <T extends object>(service: Service<T>) => T;
958
+ declare const useInject: <T$1 extends object>(service: Service<T$1>) => T$1;
693
959
  //#endregion
694
960
  //#region src/hooks/useQueryParams.d.ts
695
961
  /**
696
962
  * Not well tested. Use with caution.
697
963
  */
698
- declare const useQueryParams: <T extends TObject>(schema: T, options?: UseQueryParamsHookOptions) => [Partial<Static<T>>, (data: Static<T>) => void];
964
+ declare const useQueryParams: <T$1 extends TObject>(schema: T$1, options?: UseQueryParamsHookOptions) => [Partial<Static<T$1>>, (data: Static<T$1>) => void];
699
965
  interface UseQueryParamsHookOptions {
700
966
  format?: "base64" | "querystring";
701
967
  key?: string;
@@ -703,13 +969,17 @@ interface UseQueryParamsHookOptions {
703
969
  }
704
970
  //#endregion
705
971
  //#region src/services/ReactRouter.d.ts
706
- declare class ReactRouter<T extends object> {
972
+ declare class ReactRouter<T$1 extends object> {
707
973
  protected readonly alepha: Alepha;
708
974
  protected readonly pageApi: ReactPageProvider;
709
975
  get state(): ReactRouterState;
710
976
  get pages(): PageRoute[];
977
+ get concretePages(): PageRoute[];
711
978
  get browser(): ReactBrowserProvider | undefined;
712
- path(name: keyof VirtualRouter<T>, config?: {
979
+ isActive(href: string, options?: {
980
+ startWith?: boolean;
981
+ }): boolean;
982
+ path(name: keyof VirtualRouter<T$1>, config?: {
713
983
  params?: Record<string, any>;
714
984
  query?: Record<string, any>;
715
985
  }): string;
@@ -727,9 +997,9 @@ declare class ReactRouter<T extends object> {
727
997
  forward(): Promise<void>;
728
998
  invalidate(props?: Record<string, any>): Promise<void>;
729
999
  go(path: string, options?: RouterGoOptions): Promise<void>;
730
- go(path: keyof VirtualRouter<T>, options?: RouterGoOptions): Promise<void>;
1000
+ go(path: keyof VirtualRouter<T$1>, options?: RouterGoOptions): Promise<void>;
731
1001
  anchor(path: string, options?: RouterGoOptions): AnchorProps;
732
- anchor(path: keyof VirtualRouter<T>, options?: RouterGoOptions): AnchorProps;
1002
+ anchor(path: keyof VirtualRouter<T$1>, options?: RouterGoOptions): AnchorProps;
733
1003
  base(path: string): string;
734
1004
  /**
735
1005
  * Set query params.
@@ -744,7 +1014,7 @@ declare class ReactRouter<T extends object> {
744
1014
  push?: boolean;
745
1015
  }): void;
746
1016
  }
747
- type VirtualRouter<T> = { [K in keyof T as T[K] extends PageDescriptor ? K : never]: T[K] };
1017
+ type VirtualRouter<T$1> = { [K in keyof T$1 as T$1[K] extends PageDescriptor ? K : never]: T$1[K] };
748
1018
  //#endregion
749
1019
  //#region src/hooks/useRouter.d.ts
750
1020
  /**
@@ -761,22 +1031,7 @@ type VirtualRouter<T> = { [K in keyof T as T[K] extends PageDescriptor ? K : nev
761
1031
  * const router = useRouter<App>();
762
1032
  * router.go("home"); // typesafe
763
1033
  */
764
- declare const useRouter: <T extends object = any>() => ReactRouter<T>;
765
- //#endregion
766
- //#region src/hooks/useRouterEvents.d.ts
767
- type Hook<T extends keyof Hooks> = ((ev: Hooks[T]) => void) | {
768
- priority?: "first" | "last";
769
- callback: (ev: Hooks[T]) => void;
770
- };
771
- /**
772
- * Subscribe to various router events.
773
- */
774
- declare const useRouterEvents: (opts?: {
775
- onBegin?: Hook<"react:transition:begin">;
776
- onError?: Hook<"react:transition:error">;
777
- onEnd?: Hook<"react:transition:end">;
778
- onSuccess?: Hook<"react:transition:success">;
779
- }, deps?: any[]) => void;
1034
+ declare const useRouter: <T$1 extends object = any>() => ReactRouter<T$1>;
780
1035
  //#endregion
781
1036
  //#region src/hooks/useRouterState.d.ts
782
1037
  declare const useRouterState: () => ReactRouterState;
@@ -800,12 +1055,12 @@ declare const ssrSchemaLoading: (alepha: Alepha, name: string) => RequestConfigS
800
1055
  declare const useStore: <Key extends keyof State>(key: Key, defaultValue?: State[Key]) => [State[Key], (value: State[Key]) => void];
801
1056
  //#endregion
802
1057
  //#region src/providers/ReactServerProvider.d.ts
803
- declare const envSchema: _alepha_core1.TObject<{
804
- REACT_SERVER_DIST: _alepha_core1.TString;
805
- REACT_SERVER_PREFIX: _alepha_core1.TString;
806
- REACT_SSR_ENABLED: _alepha_core1.TOptional<_alepha_core1.TBoolean>;
807
- REACT_ROOT_ID: _alepha_core1.TString;
808
- REACT_SERVER_TEMPLATE: _alepha_core1.TOptional<_alepha_core1.TString>;
1058
+ declare const envSchema: _alepha_core10.TObject<{
1059
+ REACT_SERVER_DIST: _alepha_core10.TString;
1060
+ REACT_SERVER_PREFIX: _alepha_core10.TString;
1061
+ REACT_SSR_ENABLED: _alepha_core10.TOptional<_alepha_core10.TBoolean>;
1062
+ REACT_ROOT_ID: _alepha_core10.TString;
1063
+ REACT_SERVER_TEMPLATE: _alepha_core10.TOptional<_alepha_core10.TString>;
809
1064
  }>;
810
1065
  declare module "@alepha/core" {
811
1066
  interface Env extends Partial<Static<typeof envSchema>> {}
@@ -835,13 +1090,13 @@ declare class ReactServerProvider implements Configurable {
835
1090
  protected readonly serverStaticProvider: ServerStaticProvider;
836
1091
  protected readonly serverRouterProvider: ServerRouterProvider;
837
1092
  protected readonly serverTimingProvider: ServerTimingProvider;
838
- protected readonly ROOT_DIV_REGEX: RegExp;
1093
+ readonly ROOT_DIV_REGEX: RegExp;
839
1094
  protected preprocessedTemplate: PreprocessedTemplate | null;
840
1095
  options: ReactServerProviderOptions;
841
1096
  /**
842
1097
  * Configure the React server provider.
843
1098
  */
844
- readonly onConfigure: _alepha_core1.HookDescriptor<"configure">;
1099
+ readonly onConfigure: _alepha_core10.HookDescriptor<"configure">;
845
1100
  get template(): string;
846
1101
  protected registerPages(templateLoader: TemplateLoader): Promise<void>;
847
1102
  /**
@@ -859,7 +1114,7 @@ declare class ReactServerProvider implements Configurable {
859
1114
  /**
860
1115
  * For testing purposes, creates a render function that can be used.
861
1116
  */
862
- protected createRenderFunction(name: string, withIndex?: boolean): (options?: PageDescriptorRenderOptions) => Promise<PageDescriptorRenderResult>;
1117
+ render(name: string, options?: PageDescriptorRenderOptions): Promise<PageDescriptorRenderResult>;
863
1118
  protected createHandler(route: PageRoute, templateLoader: TemplateLoader): ServerHandler;
864
1119
  renderToHtml(template: string, state: ReactRouterState, hydration?: boolean): string | Redirection;
865
1120
  protected preprocessTemplate(template: string): PreprocessedTemplate;
@@ -881,33 +1136,87 @@ declare module "@alepha/core" {
881
1136
  "react.router.state"?: ReactRouterState;
882
1137
  }
883
1138
  interface Hooks {
1139
+ /**
1140
+ * Fires when the React application is starting to be rendered on the server.
1141
+ */
884
1142
  "react:server:render:begin": {
885
1143
  request?: ServerRequest;
886
1144
  state: ReactRouterState;
887
1145
  };
1146
+ /**
1147
+ * Fires when the React application has been rendered on the server.
1148
+ */
888
1149
  "react:server:render:end": {
889
1150
  request?: ServerRequest;
890
1151
  state: ReactRouterState;
891
1152
  html: string;
892
1153
  };
1154
+ /**
1155
+ * Fires when the React application is being rendered on the browser.
1156
+ */
893
1157
  "react:browser:render": {
894
1158
  root: HTMLElement;
895
1159
  element: ReactNode;
896
1160
  state: ReactRouterState;
897
1161
  hydration?: ReactHydrationState;
898
1162
  };
1163
+ /**
1164
+ * Fires when a user action is starting.
1165
+ * Action can be a form submission, a route transition, or a custom action.
1166
+ */
1167
+ "react:action:begin": {
1168
+ type: string;
1169
+ id?: string;
1170
+ };
1171
+ /**
1172
+ * Fires when a user action has succeeded.
1173
+ * Action can be a form submission, a route transition, or a custom action.
1174
+ */
1175
+ "react:action:success": {
1176
+ type: string;
1177
+ id?: string;
1178
+ };
1179
+ /**
1180
+ * Fires when a user action has failed.
1181
+ * Action can be a form submission, a route transition, or a custom action.
1182
+ */
1183
+ "react:action:error": {
1184
+ type: string;
1185
+ id?: string;
1186
+ error: Error;
1187
+ };
1188
+ /**
1189
+ * Fires when a user action has completed, regardless of success or failure.
1190
+ * Action can be a form submission, a route transition, or a custom action.
1191
+ */
1192
+ "react:action:end": {
1193
+ type: string;
1194
+ id?: string;
1195
+ };
1196
+ /**
1197
+ * Fires when a route transition is starting.
1198
+ */
899
1199
  "react:transition:begin": {
900
1200
  previous: ReactRouterState;
901
1201
  state: ReactRouterState;
902
1202
  animation?: PageAnimation;
903
1203
  };
1204
+ /**
1205
+ * Fires when a route transition has succeeded.
1206
+ */
904
1207
  "react:transition:success": {
905
1208
  state: ReactRouterState;
906
1209
  };
1210
+ /**
1211
+ * Fires when a route transition has failed.
1212
+ */
907
1213
  "react:transition:error": {
908
1214
  state: ReactRouterState;
909
1215
  error: Error;
910
1216
  };
1217
+ /**
1218
+ * Fires when a route transition has completed, regardless of success or failure.
1219
+ */
911
1220
  "react:transition:end": {
912
1221
  state: ReactRouterState;
913
1222
  };
@@ -923,7 +1232,7 @@ declare module "@alepha/core" {
923
1232
  * @see {@link $page}
924
1233
  * @module alepha.react
925
1234
  */
926
- declare const AlephaReact: _alepha_core1.Service<_alepha_core1.Module<{}>>;
1235
+ declare const AlephaReact: _alepha_core10.Service<_alepha_core10.Module<{}>>;
927
1236
  //#endregion
928
- export { $page, AlephaContext, AlephaReact, AnchorProps, ClientOnly, CreateLayersResult, ErrorBoundary, ErrorHandler, ErrorViewer, Layer, Link, 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, UseActiveHook, UseActiveOptions, UseQueryParamsHookOptions, UseSchemaReturn, VirtualRouter, isPageRoute, ssrSchemaLoading, useActive, useAlepha, useClient, useInject, useQueryParams, useRouter, useRouterEvents, useRouterState, useSchema, useStore };
929
- //# sourceMappingURL=index.d.ts.map
1237
+ 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, VirtualRouter, isPageRoute, ssrSchemaLoading, useAction, useActive, useAlepha, useClient, useEvents, useInject, useQueryParams, useRouter, useRouterState, useSchema, useStore };
1238
+ //# sourceMappingURL=index.d.mts.map