@stone-js/use-react 0.2.0 → 0.3.0
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/LICENSE +1 -1
- package/README.md +1 -1
- package/dist/browser.js +157 -153
- package/dist/index.d.ts +262 -267
- package/dist/index.js +265 -261
- package/package.json +11 -11
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,40 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HeadContext as HeadContext$1, HTMLMetaDescriptor, FunctionalEventHandler, Route, Router, DecoratorPageRouteDefinition, NavigateOptions } from '@stone-js/router';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { ReactNode, ElementType, FunctionComponent } from 'react';
|
|
3
|
+
import { ReactNode, ElementType, FunctionComponent, AnchorHTMLAttributes, HTMLAttributes } from 'react';
|
|
4
4
|
import { Config } from '@stone-js/config';
|
|
5
5
|
import { BrowserEvent, BrowserResponse, BrowserContext, BrowserAdapterResponseBuilder } from '@stone-js/browser-adapter';
|
|
6
6
|
import { IncomingHttpEvent, OutgoingHttpResponse, RedirectResponse, IncomingHttpEventOptions, RedirectResponseOptions, OutgoingHttpResponseOptions } from '@stone-js/http-core';
|
|
7
|
-
import { IncomingBrowserEvent, OutgoingBrowserResponse, RedirectBrowserResponse,
|
|
8
|
-
import {
|
|
7
|
+
import { IncomingBrowserEvent, IncomingBrowserEventOptions, OutgoingBrowserResponse, RedirectBrowserResponse, RedirectBrowserResponseOptions, OutgoingBrowserResponseOptions } from '@stone-js/browser-core';
|
|
8
|
+
import { AdapterErrorHandlerOptions, FunctionalAdapterErrorHandler, IBlueprint, IContainer, AdapterContext, ErrorHandlerOptions, FunctionalErrorHandler, Promiseable, HookName as HookName$1, Laziable, LifecycleHookType, OutgoingResponseOptions, IEventHandler, IErrorHandler, AdapterErrorContext, IServiceProvider, AppConfig, StoneBlueprint, IAdapterErrorHandler, AdapterEventBuilderType, InitializationError, ErrorOptions, ClassType, BlueprintContext, NextMiddleware, ILogger, MetaMiddleware } from '@stone-js/core';
|
|
9
9
|
import { Root } from 'react-dom/client';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Stone DOM Attribute.
|
|
13
|
+
*/
|
|
14
|
+
declare const STONE_DOM_ATTR = "data-stone-head";
|
|
15
|
+
/**
|
|
16
|
+
* Apply meta tags to the document document.head.
|
|
17
|
+
*
|
|
18
|
+
* @param document - The document object.
|
|
19
|
+
* @param meta - The meta tag descriptor.
|
|
20
|
+
*/
|
|
21
|
+
declare const applyMeta: (document: Document, meta: HTMLMetaDescriptor) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Apply the head context to the document document.head.
|
|
24
|
+
*
|
|
25
|
+
* @param document - The document object.
|
|
26
|
+
* @param context - The head context containing meta, link, script, and style descriptors.
|
|
27
|
+
*/
|
|
28
|
+
declare const applyHeadContextToDom: (document: Document, context: HeadContext$1) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Escape HTML special characters in a string.
|
|
31
|
+
*
|
|
32
|
+
* @param context - The head context containing meta, link, script, and style descriptors.
|
|
33
|
+
* @param html - The HTML string to escape.
|
|
34
|
+
* @returns The escaped string.
|
|
35
|
+
*/
|
|
36
|
+
declare const applyHeadContextToHtmlString: (context: HeadContext$1, html: string) => string;
|
|
37
|
+
|
|
11
38
|
/**
|
|
12
39
|
* The type representing the Head Context for React.
|
|
13
40
|
* It extends the BaseHeadContext to include additional properties specific to React.
|
|
@@ -363,6 +390,12 @@ interface MetaAdapterErrorPage<RawEventType, RawResponseType, ExecutionContextTy
|
|
|
363
390
|
module: AdapterErrorPageType<RawEventType, RawResponseType, ExecutionContextType> | Laziable<AdapterErrorPageType<RawEventType, RawResponseType, ExecutionContextType>>;
|
|
364
391
|
}
|
|
365
392
|
|
|
393
|
+
/**
|
|
394
|
+
* Stone context.
|
|
395
|
+
* Usefull to pass data to the components.
|
|
396
|
+
*/
|
|
397
|
+
declare const StoneContext: react.Context<StoneContextType>;
|
|
398
|
+
|
|
366
399
|
/**
|
|
367
400
|
* ReactRuntimeOptions
|
|
368
401
|
*/
|
|
@@ -447,33 +480,6 @@ declare const MetaReactRuntime: {
|
|
|
447
480
|
singleton: boolean;
|
|
448
481
|
};
|
|
449
482
|
|
|
450
|
-
/**
|
|
451
|
-
* Stone DOM Attribute.
|
|
452
|
-
*/
|
|
453
|
-
declare const STONE_DOM_ATTR = "data-stone-head";
|
|
454
|
-
/**
|
|
455
|
-
* Apply meta tags to the document document.head.
|
|
456
|
-
*
|
|
457
|
-
* @param document - The document object.
|
|
458
|
-
* @param meta - The meta tag descriptor.
|
|
459
|
-
*/
|
|
460
|
-
declare const applyMeta: (document: Document, meta: HTMLMetaDescriptor) => void;
|
|
461
|
-
/**
|
|
462
|
-
* Apply the head context to the document document.head.
|
|
463
|
-
*
|
|
464
|
-
* @param document - The document object.
|
|
465
|
-
* @param context - The head context containing meta, link, script, and style descriptors.
|
|
466
|
-
*/
|
|
467
|
-
declare const applyHeadContextToDom: (document: Document, context: HeadContext$1) => void;
|
|
468
|
-
/**
|
|
469
|
-
* Escape HTML special characters in a string.
|
|
470
|
-
*
|
|
471
|
-
* @param context - The head context containing meta, link, script, and style descriptors.
|
|
472
|
-
* @param html - The HTML string to escape.
|
|
473
|
-
* @returns The escaped string.
|
|
474
|
-
*/
|
|
475
|
-
declare const applyHeadContextToHtmlString: (context: HeadContext$1, html: string) => string;
|
|
476
|
-
|
|
477
483
|
/**
|
|
478
484
|
* A useReact event handler for processing incoming events
|
|
479
485
|
* For single event handler.
|
|
@@ -508,12 +514,6 @@ declare class UseReactEventHandler<IncomingEventType extends ReactIncomingEvent
|
|
|
508
514
|
private getComponentEventHandler;
|
|
509
515
|
}
|
|
510
516
|
|
|
511
|
-
/**
|
|
512
|
-
* Stone context.
|
|
513
|
-
* Usefull to pass data to the components.
|
|
514
|
-
*/
|
|
515
|
-
declare const StoneContext: react.Context<StoneContextType>;
|
|
516
|
-
|
|
517
517
|
/**
|
|
518
518
|
* UseReactError response type.
|
|
519
519
|
*/
|
|
@@ -735,47 +735,6 @@ declare function renderStoneSnapshot(snapshot: string): string;
|
|
|
735
735
|
*/
|
|
736
736
|
declare function executeHooks(name: UseReactHookName, context: UseReactHookListenerContext): Promise<void>;
|
|
737
737
|
|
|
738
|
-
/**
|
|
739
|
-
* Options for configuring the use-react service provider.
|
|
740
|
-
*/
|
|
741
|
-
interface UseReactServiceProviderOptions {
|
|
742
|
-
container: IContainer;
|
|
743
|
-
}
|
|
744
|
-
/**
|
|
745
|
-
* Use React Service Provider.
|
|
746
|
-
*/
|
|
747
|
-
declare class UseReactServiceProvider implements IServiceProvider {
|
|
748
|
-
private readonly container;
|
|
749
|
-
/**
|
|
750
|
-
* Constructs a new `UseReactServiceProvider` instance.
|
|
751
|
-
*
|
|
752
|
-
* @param container - The container to register services in.
|
|
753
|
-
*/
|
|
754
|
-
constructor(container: IContainer);
|
|
755
|
-
/**
|
|
756
|
-
* Register method for the service provider.
|
|
757
|
-
*/
|
|
758
|
-
register(): Promiseable<void>;
|
|
759
|
-
/**
|
|
760
|
-
* Boot method for the service provider.
|
|
761
|
-
*/
|
|
762
|
-
boot(): Promiseable<void>;
|
|
763
|
-
/**
|
|
764
|
-
* Register the snapshot.
|
|
765
|
-
*
|
|
766
|
-
* We save the snapshot on server side rendering and
|
|
767
|
-
* we use it to hydrate the application on the client side.
|
|
768
|
-
*/
|
|
769
|
-
private registerSnapshot;
|
|
770
|
-
}
|
|
771
|
-
/**
|
|
772
|
-
* MetaUseReactServiceProvider
|
|
773
|
-
*/
|
|
774
|
-
declare const MetaUseReactServiceProvider: {
|
|
775
|
-
module: typeof UseReactServiceProvider;
|
|
776
|
-
isClass: boolean;
|
|
777
|
-
};
|
|
778
|
-
|
|
779
738
|
/**
|
|
780
739
|
* Prepare the page to render.
|
|
781
740
|
*
|
|
@@ -822,6 +781,47 @@ declare const STONE_SNAPSHOT = "__STONE_SNAPSHOT__";
|
|
|
822
781
|
*/
|
|
823
782
|
declare const STONE_PAGE_EVENT_OUTLET = "stone:inject:react-page:outlet";
|
|
824
783
|
|
|
784
|
+
/**
|
|
785
|
+
* Options for configuring the use-react service provider.
|
|
786
|
+
*/
|
|
787
|
+
interface UseReactServiceProviderOptions {
|
|
788
|
+
container: IContainer;
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* Use React Service Provider.
|
|
792
|
+
*/
|
|
793
|
+
declare class UseReactServiceProvider implements IServiceProvider {
|
|
794
|
+
private readonly container;
|
|
795
|
+
/**
|
|
796
|
+
* Constructs a new `UseReactServiceProvider` instance.
|
|
797
|
+
*
|
|
798
|
+
* @param container - The container to register services in.
|
|
799
|
+
*/
|
|
800
|
+
constructor(container: IContainer);
|
|
801
|
+
/**
|
|
802
|
+
* Register method for the service provider.
|
|
803
|
+
*/
|
|
804
|
+
register(): Promiseable<void>;
|
|
805
|
+
/**
|
|
806
|
+
* Boot method for the service provider.
|
|
807
|
+
*/
|
|
808
|
+
boot(): Promiseable<void>;
|
|
809
|
+
/**
|
|
810
|
+
* Register the snapshot.
|
|
811
|
+
*
|
|
812
|
+
* We save the snapshot on server side rendering and
|
|
813
|
+
* we use it to hydrate the application on the client side.
|
|
814
|
+
*/
|
|
815
|
+
private registerSnapshot;
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* MetaUseReactServiceProvider
|
|
819
|
+
*/
|
|
820
|
+
declare const MetaUseReactServiceProvider: {
|
|
821
|
+
module: typeof UseReactServiceProvider;
|
|
822
|
+
isClass: boolean;
|
|
823
|
+
};
|
|
824
|
+
|
|
825
825
|
/**
|
|
826
826
|
* Configuration options for integrating React with Stone.js.
|
|
827
827
|
*/
|
|
@@ -886,86 +886,6 @@ interface UseReactBlueprint extends StoneBlueprint<ReactIncomingEvent, ReactOutg
|
|
|
886
886
|
*/
|
|
887
887
|
declare const internalUseReactBlueprint: UseReactBlueprint;
|
|
888
888
|
|
|
889
|
-
/**
|
|
890
|
-
* Utility function to define a factory-based adapter error page.
|
|
891
|
-
*
|
|
892
|
-
* @param module - The adapter error page module.
|
|
893
|
-
* @param options - Optional adapter error page options.
|
|
894
|
-
* @returns The UseReactBlueprint.
|
|
895
|
-
*/
|
|
896
|
-
declare function defineAdapterErrorPage(module: FactoryAdapterErrorPage<unknown, unknown, unknown>, options?: AdapterErrorPageOptions): UseReactBlueprint;
|
|
897
|
-
/**
|
|
898
|
-
* Utility function to define a class-based adapter error page.
|
|
899
|
-
*
|
|
900
|
-
* @param module - The adapter error page module.
|
|
901
|
-
* @param options - Adapter error page options.
|
|
902
|
-
* @returns The UseReactBlueprint.
|
|
903
|
-
*/
|
|
904
|
-
declare function defineAdapterErrorPage(module: AdapterErrorPageClass<unknown, unknown, unknown>, options: AdapterErrorPageOptions & {
|
|
905
|
-
isClass: boolean;
|
|
906
|
-
}): UseReactBlueprint;
|
|
907
|
-
|
|
908
|
-
/**
|
|
909
|
-
* Utility function to define a factory-based page.
|
|
910
|
-
*
|
|
911
|
-
* @param module - The EventHandler module.
|
|
912
|
-
* @param options - Page definition options.
|
|
913
|
-
* @returns The UseReactBlueprint.
|
|
914
|
-
*/
|
|
915
|
-
declare function definePage<U extends ReactIncomingEvent = ReactIncomingEvent>(module: FactoryPage<U>, options: PageOptions & {
|
|
916
|
-
isClass?: undefined;
|
|
917
|
-
}): Partial<StoneBlueprint<U>>;
|
|
918
|
-
/**
|
|
919
|
-
* Utility function to define a class-based page.
|
|
920
|
-
*
|
|
921
|
-
* @param module - The EventHandler module.
|
|
922
|
-
* @param options - Page definition options.
|
|
923
|
-
* @returns The UseReactBlueprint.
|
|
924
|
-
*/
|
|
925
|
-
declare function definePage<U extends ReactIncomingEvent = ReactIncomingEvent>(module: PageClass<U>, options: PageOptions & {
|
|
926
|
-
isClass: true;
|
|
927
|
-
}): Partial<StoneBlueprint<U>>;
|
|
928
|
-
/**
|
|
929
|
-
* Utility function to define a factory-based page layout.
|
|
930
|
-
*
|
|
931
|
-
* @param module - The layout module.
|
|
932
|
-
* @param options - Optional page layout definition options.
|
|
933
|
-
* @returns The UseReactBlueprint.
|
|
934
|
-
*/
|
|
935
|
-
declare function definePageLayout(module: FactoryPageLayout, options?: PageLayoutOptions & {
|
|
936
|
-
isClass?: undefined;
|
|
937
|
-
}): UseReactBlueprint;
|
|
938
|
-
/**
|
|
939
|
-
* Utility function to define a class-based page layout.
|
|
940
|
-
*
|
|
941
|
-
* @param module - The layout module.
|
|
942
|
-
* @param options - Optional page layout definition options.
|
|
943
|
-
* @returns The UseReactBlueprint.
|
|
944
|
-
*/
|
|
945
|
-
declare function definePageLayout(module: PageLayoutClass, options: PageLayoutOptions & {
|
|
946
|
-
isClass: true;
|
|
947
|
-
}): UseReactBlueprint;
|
|
948
|
-
/**
|
|
949
|
-
* Utility function to define a factory-based error page.
|
|
950
|
-
*
|
|
951
|
-
* @param module - The layout module.
|
|
952
|
-
* @param options - Optional page layout definition options.
|
|
953
|
-
* @returns The UseReactBlueprint.
|
|
954
|
-
*/
|
|
955
|
-
declare function defineErrorPage(module: FactoryErrorPage<ReactIncomingEvent>, options?: ErrorPageOptions & {
|
|
956
|
-
isClass?: undefined;
|
|
957
|
-
}): UseReactBlueprint;
|
|
958
|
-
/**
|
|
959
|
-
* Utility function to define a class-based error page.
|
|
960
|
-
*
|
|
961
|
-
* @param module - The layout module.
|
|
962
|
-
* @param options - Optional page layout definition options.
|
|
963
|
-
* @returns The UseReactBlueprint.
|
|
964
|
-
*/
|
|
965
|
-
declare function defineErrorPage(module: ErrorPageClass<ReactIncomingEvent>, options: ErrorPageOptions & {
|
|
966
|
-
isClass: true;
|
|
967
|
-
}): UseReactBlueprint;
|
|
968
|
-
|
|
969
889
|
/**
|
|
970
890
|
* Defines a Stone React app using a factory-based main handler.
|
|
971
891
|
*
|
|
@@ -995,6 +915,25 @@ declare function defineStoneReactApp<U extends ReactIncomingEvent = ReactIncomin
|
|
|
995
915
|
*/
|
|
996
916
|
declare function defineStoneReactApp<U extends ReactIncomingEvent = ReactIncomingEvent>(options?: Partial<UseReactAppConfig>, blueprints?: Array<StoneBlueprint<any, any> & Record<string, any>>): StoneBlueprint<U>;
|
|
997
917
|
|
|
918
|
+
/**
|
|
919
|
+
* Utility function to define a factory-based adapter error page.
|
|
920
|
+
*
|
|
921
|
+
* @param module - The adapter error page module.
|
|
922
|
+
* @param options - Optional adapter error page options.
|
|
923
|
+
* @returns The UseReactBlueprint.
|
|
924
|
+
*/
|
|
925
|
+
declare function defineAdapterErrorPage(module: FactoryAdapterErrorPage<unknown, unknown, unknown>, options?: AdapterErrorPageOptions): UseReactBlueprint;
|
|
926
|
+
/**
|
|
927
|
+
* Utility function to define a class-based adapter error page.
|
|
928
|
+
*
|
|
929
|
+
* @param module - The adapter error page module.
|
|
930
|
+
* @param options - Adapter error page options.
|
|
931
|
+
* @returns The UseReactBlueprint.
|
|
932
|
+
*/
|
|
933
|
+
declare function defineAdapterErrorPage(module: AdapterErrorPageClass<unknown, unknown, unknown>, options: AdapterErrorPageOptions & {
|
|
934
|
+
isClass: boolean;
|
|
935
|
+
}): UseReactBlueprint;
|
|
936
|
+
|
|
998
937
|
/**
|
|
999
938
|
* UseReactBrowserErrorHandler options.
|
|
1000
939
|
*/
|
|
@@ -1032,6 +971,11 @@ declare class UseReactBrowserErrorHandler implements IAdapterErrorHandler<unknow
|
|
|
1032
971
|
private renderError;
|
|
1033
972
|
}
|
|
1034
973
|
|
|
974
|
+
/**
|
|
975
|
+
* Stone Error.
|
|
976
|
+
*/
|
|
977
|
+
declare const StoneError: FunctionComponent;
|
|
978
|
+
|
|
1035
979
|
/**
|
|
1036
980
|
* Create an UseReact response.
|
|
1037
981
|
*
|
|
@@ -1047,11 +991,6 @@ declare const reactResponse: (options: ReactResponseOptions) => ReactOutgoingRes
|
|
|
1047
991
|
*/
|
|
1048
992
|
declare const reactRedirectResponse: (options: ReactRedirectResponseOptions) => ReactOutgoingResponse;
|
|
1049
993
|
|
|
1050
|
-
/**
|
|
1051
|
-
* Stone Error.
|
|
1052
|
-
*/
|
|
1053
|
-
declare const StoneError: FunctionComponent;
|
|
1054
|
-
|
|
1055
994
|
/**
|
|
1056
995
|
* Stone Client options.
|
|
1057
996
|
*/
|
|
@@ -1067,13 +1006,70 @@ interface StoneClientOptions {
|
|
|
1067
1006
|
*/
|
|
1068
1007
|
declare const StoneClient: FunctionComponent<StoneClientOptions>;
|
|
1069
1008
|
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1009
|
+
/**
|
|
1010
|
+
* Utility function to define a factory-based page.
|
|
1011
|
+
*
|
|
1012
|
+
* @param module - The EventHandler module.
|
|
1013
|
+
* @param options - Page definition options.
|
|
1014
|
+
* @returns The UseReactBlueprint.
|
|
1015
|
+
*/
|
|
1016
|
+
declare function definePage<U extends ReactIncomingEvent = ReactIncomingEvent>(module: FactoryPage<U>, options: PageOptions & {
|
|
1017
|
+
isClass?: undefined;
|
|
1018
|
+
}): Partial<StoneBlueprint<U>>;
|
|
1019
|
+
/**
|
|
1020
|
+
* Utility function to define a class-based page.
|
|
1021
|
+
*
|
|
1022
|
+
* @param module - The EventHandler module.
|
|
1023
|
+
* @param options - Page definition options.
|
|
1024
|
+
* @returns The UseReactBlueprint.
|
|
1025
|
+
*/
|
|
1026
|
+
declare function definePage<U extends ReactIncomingEvent = ReactIncomingEvent>(module: PageClass<U>, options: PageOptions & {
|
|
1027
|
+
isClass: true;
|
|
1028
|
+
}): Partial<StoneBlueprint<U>>;
|
|
1029
|
+
/**
|
|
1030
|
+
* Utility function to define a factory-based page layout.
|
|
1031
|
+
*
|
|
1032
|
+
* @param module - The layout module.
|
|
1033
|
+
* @param options - Optional page layout definition options.
|
|
1034
|
+
* @returns The UseReactBlueprint.
|
|
1035
|
+
*/
|
|
1036
|
+
declare function definePageLayout(module: FactoryPageLayout, options?: PageLayoutOptions & {
|
|
1037
|
+
isClass?: undefined;
|
|
1038
|
+
}): UseReactBlueprint;
|
|
1039
|
+
/**
|
|
1040
|
+
* Utility function to define a class-based page layout.
|
|
1041
|
+
*
|
|
1042
|
+
* @param module - The layout module.
|
|
1043
|
+
* @param options - Optional page layout definition options.
|
|
1044
|
+
* @returns The UseReactBlueprint.
|
|
1045
|
+
*/
|
|
1046
|
+
declare function definePageLayout(module: PageLayoutClass, options: PageLayoutOptions & {
|
|
1047
|
+
isClass: true;
|
|
1048
|
+
}): UseReactBlueprint;
|
|
1049
|
+
/**
|
|
1050
|
+
* Utility function to define a factory-based error page.
|
|
1051
|
+
*
|
|
1052
|
+
* @param module - The layout module.
|
|
1053
|
+
* @param options - Optional page layout definition options.
|
|
1054
|
+
* @returns The UseReactBlueprint.
|
|
1055
|
+
*/
|
|
1056
|
+
declare function defineErrorPage(module: FactoryErrorPage<ReactIncomingEvent>, options?: ErrorPageOptions & {
|
|
1057
|
+
isClass?: undefined;
|
|
1058
|
+
}): UseReactBlueprint;
|
|
1059
|
+
/**
|
|
1060
|
+
* Utility function to define a class-based error page.
|
|
1061
|
+
*
|
|
1062
|
+
* @param module - The layout module.
|
|
1063
|
+
* @param options - Optional page layout definition options.
|
|
1064
|
+
* @returns The UseReactBlueprint.
|
|
1065
|
+
*/
|
|
1066
|
+
declare function defineErrorPage(module: ErrorPageClass<ReactIncomingEvent>, options: ErrorPageOptions & {
|
|
1067
|
+
isClass: true;
|
|
1068
|
+
}): UseReactBlueprint;
|
|
1069
|
+
|
|
1070
|
+
interface BaseProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
1074
1071
|
noRel?: boolean;
|
|
1075
1072
|
external?: boolean;
|
|
1076
|
-
className?: string;
|
|
1077
1073
|
children: ReactNode;
|
|
1078
1074
|
defaultNav?: boolean;
|
|
1079
1075
|
selectedClass?: string;
|
|
@@ -1087,7 +1083,7 @@ type StoneLinkOptions = (BaseProps & {
|
|
|
1087
1083
|
to: string | NavigateOptions;
|
|
1088
1084
|
});
|
|
1089
1085
|
/**
|
|
1090
|
-
*
|
|
1086
|
+
* Internal link component using Stone.js router.
|
|
1091
1087
|
*/
|
|
1092
1088
|
declare const StoneLink: FunctionComponent<StoneLinkOptions>;
|
|
1093
1089
|
|
|
@@ -1115,8 +1111,7 @@ declare const StonePage: FunctionComponent<StonePageOptions>;
|
|
|
1115
1111
|
/**
|
|
1116
1112
|
* Stone Outlet options.
|
|
1117
1113
|
*/
|
|
1118
|
-
interface StoneOutletOptions {
|
|
1119
|
-
children: ReactNode;
|
|
1114
|
+
interface StoneOutletOptions extends HTMLAttributes<HTMLDivElement> {
|
|
1120
1115
|
}
|
|
1121
1116
|
/**
|
|
1122
1117
|
* A dynamic rendering component that updates its content based on a global event.
|
|
@@ -1147,6 +1142,13 @@ interface StoneServerOptions {
|
|
|
1147
1142
|
*/
|
|
1148
1143
|
declare const StoneServer: FunctionComponent<StoneServerOptions>;
|
|
1149
1144
|
|
|
1145
|
+
/**
|
|
1146
|
+
* Custom error for react operations.
|
|
1147
|
+
*/
|
|
1148
|
+
declare class UseReactError extends InitializationError {
|
|
1149
|
+
constructor(message: string, options?: ErrorOptions);
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1150
1152
|
/**
|
|
1151
1153
|
* A class decorator for defining a class as a React Handler layout.
|
|
1152
1154
|
*
|
|
@@ -1228,27 +1230,7 @@ declare const Hook: <T extends Function = Function>(name: HookName) => MethodDec
|
|
|
1228
1230
|
* }
|
|
1229
1231
|
* ```
|
|
1230
1232
|
*/
|
|
1231
|
-
declare const Page: <T extends ClassType = ClassType>(path: string, options?: PageOptions) => ClassDecorator;
|
|
1232
|
-
|
|
1233
|
-
/**
|
|
1234
|
-
* A class decorator for defining a class as a React Page layout.
|
|
1235
|
-
*
|
|
1236
|
-
* @param options - Configuration options for the layout definition.
|
|
1237
|
-
* @returns A method decorator to be applied to a class method.
|
|
1238
|
-
*
|
|
1239
|
-
* @example
|
|
1240
|
-
* ```typescript
|
|
1241
|
-
* import { PageLayout } from '@stone-js/use-react';
|
|
1242
|
-
*
|
|
1243
|
-
* @PageLayout({ name: 'UserPageLayout' })
|
|
1244
|
-
* class UserPageLayout {
|
|
1245
|
-
* render({ data }) {
|
|
1246
|
-
* return <h1>User name: {data.name}</h1>;
|
|
1247
|
-
* }
|
|
1248
|
-
* }
|
|
1249
|
-
* ```
|
|
1250
|
-
*/
|
|
1251
|
-
declare const PageLayout: <T extends ClassType = ClassType>(options: PageLayoutOptions) => ClassDecorator;
|
|
1233
|
+
declare const Page: <T extends ClassType = ClassType>(path: string | string[], options?: PageOptions) => ClassDecorator;
|
|
1252
1234
|
|
|
1253
1235
|
/**
|
|
1254
1236
|
* Decorator to set the status code of the response.
|
|
@@ -1272,6 +1254,26 @@ declare const PageLayout: <T extends ClassType = ClassType>(options: PageLayoutO
|
|
|
1272
1254
|
*/
|
|
1273
1255
|
declare const PageStatus: <T extends Function = Function>(statusCode?: number, headers?: HeadersType) => MethodDecorator;
|
|
1274
1256
|
|
|
1257
|
+
/**
|
|
1258
|
+
* A class decorator for defining a class as a React Page layout.
|
|
1259
|
+
*
|
|
1260
|
+
* @param options - Configuration options for the layout definition.
|
|
1261
|
+
* @returns A method decorator to be applied to a class method.
|
|
1262
|
+
*
|
|
1263
|
+
* @example
|
|
1264
|
+
* ```typescript
|
|
1265
|
+
* import { PageLayout } from '@stone-js/use-react';
|
|
1266
|
+
*
|
|
1267
|
+
* @PageLayout({ name: 'UserPageLayout' })
|
|
1268
|
+
* class UserPageLayout {
|
|
1269
|
+
* render({ data }) {
|
|
1270
|
+
* return <h1>User name: {data.name}</h1>;
|
|
1271
|
+
* }
|
|
1272
|
+
* }
|
|
1273
|
+
* ```
|
|
1274
|
+
*/
|
|
1275
|
+
declare const PageLayout: <T extends ClassType = ClassType>(options: PageLayoutOptions) => ClassDecorator;
|
|
1276
|
+
|
|
1275
1277
|
/**
|
|
1276
1278
|
* Decorator to create a snapshot of the current data.
|
|
1277
1279
|
*
|
|
@@ -1294,6 +1296,31 @@ declare const PageStatus: <T extends Function = Function>(statusCode?: number, h
|
|
|
1294
1296
|
*/
|
|
1295
1297
|
declare const Snapshot: <T extends Function = Function>(name?: string) => MethodDecorator;
|
|
1296
1298
|
|
|
1299
|
+
/**
|
|
1300
|
+
* Constants are defined here to prevent Circular dependency between modules
|
|
1301
|
+
* This pattern must be applied to all Stone libraries or third party libraries.
|
|
1302
|
+
*/
|
|
1303
|
+
/**
|
|
1304
|
+
* A unique symbol key to mark classes as React Page component.
|
|
1305
|
+
*/
|
|
1306
|
+
declare const REACT_PAGE_KEY: unique symbol;
|
|
1307
|
+
/**
|
|
1308
|
+
* A unique symbol key to mark classes as React Page layout component.
|
|
1309
|
+
*/
|
|
1310
|
+
declare const REACT_PAGE_LAYOUT_KEY: unique symbol;
|
|
1311
|
+
/**
|
|
1312
|
+
* A unique symbol key to mark classes as React Error handler component.
|
|
1313
|
+
*/
|
|
1314
|
+
declare const REACT_ERROR_PAGE_KEY: unique symbol;
|
|
1315
|
+
/**
|
|
1316
|
+
* A unique symbol key to mark classes as React Adapter Error handler component.
|
|
1317
|
+
*/
|
|
1318
|
+
declare const REACT_ADAPTER_ERROR_PAGE_KEY: unique symbol;
|
|
1319
|
+
/**
|
|
1320
|
+
* A unique symbol key to mark classes as React Stone application entry point.
|
|
1321
|
+
*/
|
|
1322
|
+
declare const STONE_REACT_APP_KEY: unique symbol;
|
|
1323
|
+
|
|
1297
1324
|
/**
|
|
1298
1325
|
* Blueprint middleware to dynamically set lifecycle hooks for react.
|
|
1299
1326
|
*
|
|
@@ -1362,38 +1389,6 @@ declare const SetReactPageLayoutMiddleware: (context: BlueprintContext<IBlueprin
|
|
|
1362
1389
|
*/
|
|
1363
1390
|
declare function SetUseReactEventHandlerMiddleware(context: BlueprintContext<IBlueprint, ClassType>, next: NextMiddleware<BlueprintContext<IBlueprint, ClassType>, IBlueprint>): Promise<IBlueprint>;
|
|
1364
1391
|
|
|
1365
|
-
/**
|
|
1366
|
-
* Constants are defined here to prevent Circular dependency between modules
|
|
1367
|
-
* This pattern must be applied to all Stone libraries or third party libraries.
|
|
1368
|
-
*/
|
|
1369
|
-
/**
|
|
1370
|
-
* A unique symbol key to mark classes as React Page component.
|
|
1371
|
-
*/
|
|
1372
|
-
declare const REACT_PAGE_KEY: unique symbol;
|
|
1373
|
-
/**
|
|
1374
|
-
* A unique symbol key to mark classes as React Page layout component.
|
|
1375
|
-
*/
|
|
1376
|
-
declare const REACT_PAGE_LAYOUT_KEY: unique symbol;
|
|
1377
|
-
/**
|
|
1378
|
-
* A unique symbol key to mark classes as React Error handler component.
|
|
1379
|
-
*/
|
|
1380
|
-
declare const REACT_ERROR_PAGE_KEY: unique symbol;
|
|
1381
|
-
/**
|
|
1382
|
-
* A unique symbol key to mark classes as React Adapter Error handler component.
|
|
1383
|
-
*/
|
|
1384
|
-
declare const REACT_ADAPTER_ERROR_PAGE_KEY: unique symbol;
|
|
1385
|
-
/**
|
|
1386
|
-
* A unique symbol key to mark classes as React Stone application entry point.
|
|
1387
|
-
*/
|
|
1388
|
-
declare const STONE_REACT_APP_KEY: unique symbol;
|
|
1389
|
-
|
|
1390
|
-
/**
|
|
1391
|
-
* Custom error for react operations.
|
|
1392
|
-
*/
|
|
1393
|
-
declare class UseReactError extends InitializationError {
|
|
1394
|
-
constructor(message: string, options?: ErrorOptions);
|
|
1395
|
-
}
|
|
1396
|
-
|
|
1397
1392
|
/**
|
|
1398
1393
|
* UseReactServerErrorHandler options.
|
|
1399
1394
|
*/
|
|
@@ -1442,41 +1437,20 @@ declare class UseReactServerErrorHandler implements IAdapterErrorHandler<unknown
|
|
|
1442
1437
|
declare function setUseReactAdapterErrorHandler(errorHandler: typeof UseReactServerErrorHandler | typeof UseReactBrowserErrorHandler, context: BlueprintContext<IBlueprint, ClassType>): BlueprintContext<IBlueprint, ClassType>;
|
|
1443
1438
|
|
|
1444
1439
|
/**
|
|
1445
|
-
*
|
|
1446
|
-
*
|
|
1447
|
-
* The MetaBrowserResponseMiddleware is an adapter middleware and is useful
|
|
1448
|
-
* for handling outgoing responses and rendering them in the browser.
|
|
1449
|
-
*
|
|
1450
|
-
* @param context - The configuration context containing modules and blueprint.
|
|
1451
|
-
* @param next - The next pipeline function to continue processing.
|
|
1452
|
-
* @returns The updated blueprint or a promise resolving to it.
|
|
1453
|
-
*
|
|
1454
|
-
* @example
|
|
1455
|
-
* ```typescript
|
|
1456
|
-
* SetBrowserResponseMiddlewareMiddleware(context, next)
|
|
1457
|
-
* ```
|
|
1440
|
+
* UseReact decorator options.
|
|
1458
1441
|
*/
|
|
1459
|
-
|
|
1442
|
+
interface UseReactOptions extends Partial<UseReactConfig> {
|
|
1443
|
+
}
|
|
1460
1444
|
/**
|
|
1461
|
-
*
|
|
1462
|
-
*
|
|
1463
|
-
* @param context - The configuration context containing modules and blueprint.
|
|
1464
|
-
* @param next - The next pipeline function to continue processing.
|
|
1465
|
-
* @returns The updated blueprint or a promise resolving to it.
|
|
1445
|
+
* UseReact decorator.
|
|
1466
1446
|
*
|
|
1467
|
-
*
|
|
1468
|
-
*
|
|
1469
|
-
* SetReactAdapterErrorPageMiddleware(context, next)
|
|
1470
|
-
* ```
|
|
1471
|
-
*/
|
|
1472
|
-
declare const SetReactAdapterErrorPageMiddleware: (context: BlueprintContext<IBlueprint, ClassType>, next: NextMiddleware<BlueprintContext<IBlueprint, ClassType>, IBlueprint>) => Promiseable<IBlueprint>;
|
|
1473
|
-
/**
|
|
1474
|
-
* Configuration for react processing middleware.
|
|
1447
|
+
* UseReact is a class decorator that allows you to use React components in your Stone application.
|
|
1448
|
+
* The decorator is used to define the React configuration for the class.
|
|
1475
1449
|
*
|
|
1476
|
-
*
|
|
1477
|
-
*
|
|
1450
|
+
* @param options - UseReactOptions
|
|
1451
|
+
* @returns ClassDecorator
|
|
1478
1452
|
*/
|
|
1479
|
-
declare const
|
|
1453
|
+
declare const UseReact: <T extends ClassType = ClassType>(options?: UseReactOptions) => ClassDecorator;
|
|
1480
1454
|
|
|
1481
1455
|
/**
|
|
1482
1456
|
* Adapter Middleware for handling outgoing responses and rendering them in the browser.
|
|
@@ -1545,27 +1519,48 @@ declare const MetaBrowserResponseMiddleware: {
|
|
|
1545
1519
|
};
|
|
1546
1520
|
|
|
1547
1521
|
/**
|
|
1548
|
-
*
|
|
1522
|
+
* Default blueprint for a React-based Stone.js application.
|
|
1523
|
+
*
|
|
1524
|
+
* - Defines middleware, lifecycle hooks, and the default HTML template path.
|
|
1549
1525
|
*/
|
|
1550
|
-
|
|
1551
|
-
|
|
1526
|
+
declare const useReactBlueprint: UseReactBlueprint;
|
|
1527
|
+
|
|
1552
1528
|
/**
|
|
1553
|
-
*
|
|
1529
|
+
* Blueprint middleware to set BrowserResponseMiddleware for the Browser adapter.
|
|
1554
1530
|
*
|
|
1555
|
-
*
|
|
1556
|
-
*
|
|
1531
|
+
* The MetaBrowserResponseMiddleware is an adapter middleware and is useful
|
|
1532
|
+
* for handling outgoing responses and rendering them in the browser.
|
|
1557
1533
|
*
|
|
1558
|
-
* @param
|
|
1559
|
-
* @
|
|
1534
|
+
* @param context - The configuration context containing modules and blueprint.
|
|
1535
|
+
* @param next - The next pipeline function to continue processing.
|
|
1536
|
+
* @returns The updated blueprint or a promise resolving to it.
|
|
1537
|
+
*
|
|
1538
|
+
* @example
|
|
1539
|
+
* ```typescript
|
|
1540
|
+
* SetBrowserResponseMiddlewareMiddleware(context, next)
|
|
1541
|
+
* ```
|
|
1560
1542
|
*/
|
|
1561
|
-
declare const
|
|
1562
|
-
|
|
1543
|
+
declare const SetBrowserResponseMiddlewareMiddleware: (context: BlueprintContext<IBlueprint, ClassType>, next: NextMiddleware<BlueprintContext<IBlueprint, ClassType>, IBlueprint>) => Promise<IBlueprint>;
|
|
1563
1544
|
/**
|
|
1564
|
-
*
|
|
1545
|
+
* Blueprint middleware to process and register adapter error page definitions from modules.
|
|
1565
1546
|
*
|
|
1566
|
-
*
|
|
1547
|
+
* @param context - The configuration context containing modules and blueprint.
|
|
1548
|
+
* @param next - The next pipeline function to continue processing.
|
|
1549
|
+
* @returns The updated blueprint or a promise resolving to it.
|
|
1550
|
+
*
|
|
1551
|
+
* @example
|
|
1552
|
+
* ```typescript
|
|
1553
|
+
* SetReactAdapterErrorPageMiddleware(context, next)
|
|
1554
|
+
* ```
|
|
1567
1555
|
*/
|
|
1568
|
-
declare const
|
|
1556
|
+
declare const SetReactAdapterErrorPageMiddleware: (context: BlueprintContext<IBlueprint, ClassType>, next: NextMiddleware<BlueprintContext<IBlueprint, ClassType>, IBlueprint>) => Promiseable<IBlueprint>;
|
|
1557
|
+
/**
|
|
1558
|
+
* Configuration for react processing middleware.
|
|
1559
|
+
*
|
|
1560
|
+
* This array defines a list of middleware pipes, each with a `pipe` function and a `priority`.
|
|
1561
|
+
* These pipes are executed in the order of their priority values, with lower values running first.
|
|
1562
|
+
*/
|
|
1563
|
+
declare const metaBrowserUseReactBlueprintMiddleware: Array<MetaMiddleware<BlueprintContext<IBlueprint, ClassType>, IBlueprint>>;
|
|
1569
1564
|
|
|
1570
1565
|
export { AdapterErrorPage, BrowserResponseMiddleware, ErrorPage, Hook, MetaBrowserResponseMiddleware, MetaReactRuntime, MetaUseReactServiceProvider, Page, PageLayout, PageStatus, REACT_ADAPTER_ERROR_PAGE_KEY, REACT_ERROR_PAGE_KEY, REACT_PAGE_KEY, REACT_PAGE_LAYOUT_KEY, ReactRuntime, STONE_DOM_ATTR, STONE_PAGE_EVENT_OUTLET, STONE_REACT_APP_KEY, STONE_SNAPSHOT, SetBrowserResponseMiddlewareMiddleware, SetReactAdapterErrorPageMiddleware, SetReactKernelErrorPageMiddleware, SetReactPageLayoutMiddleware, SetReactRouteDefinitionsMiddleware, SetUseReactEventHandlerMiddleware, SetUseReactHooksMiddleware, Snapshot, StoneClient, StoneContext, StoneError, StoneLink, StoneOutlet, StonePage, StoneServer, UseReact, UseReactBrowserErrorHandler, UseReactError, UseReactEventHandler, UseReactKernelErrorHandler, UseReactServiceProvider, applyHeadContextToDom, applyHeadContextToHtmlString, applyMeta, buildAdapterErrorComponent, buildAppComponent, buildLayoutComponent, buildPageComponent, defineAdapterErrorPage, defineErrorPage, definePage, definePageLayout, defineStoneReactApp, executeHandler, executeHooks, getAppRootElement, getBrowserContent, getResponseSnapshot, getServerContent, htmlTemplate, hydrateReactApp, internalUseReactBlueprint, isClient, isSSR, isServer, metaBrowserUseReactBlueprintMiddleware, onPreparingResponse, prepareErrorPage, prepareFallbackErrorPage, preparePage, reactRedirectResponse, reactResponse, renderReactApp, renderStoneSnapshot, resolveComponent, resolveLazyComponent, setUseReactAdapterErrorHandler, snapshotResponse, useReactBlueprint };
|
|
1571
1566
|
export type { AdapterErrorPageClass, AdapterErrorPageOptions, AdapterErrorPageRenderContext, AdapterErrorPageType, AdapterPageLayoutRenderContext, BrowserResponseContent, ErrorPageClass, ErrorPageHeadContext, ErrorPageOptions, ErrorPageRenderContext, ErrorPageType, FactoryAdapterErrorPage, FactoryErrorPage, FactoryPage, FactoryPageLayout, HeadContext, HeadersType, HookName, IAdapterErrorPage, IErrorPage, IPage, IPageLayout, IRoute, IRouter, ISnapshot, MetaAdapterErrorPage, MetaErrorPage, MetaPage, MetaPageLayout, OnPreparingResponseOptions, PageClass, PageHeadContext, PageLayoutClass, PageLayoutOptions, PageLayoutRenderContext, PageLayoutType, PageOptions, PageRenderContext, PageType, ReactBrowserAdapterContext, ReactIncomingEvent, ReactIncomingEventOptions, ReactLifecycleHookType, ReactOutgoingResponse, ReactOutgoingResponseOptions, ReactRedirectResponseOptions, ReactResponseOptions, ReactRuntimeOptions, ResponseSnapshotType, StoneContextType, StoneLinkOptions, StoneOutletOptions, UseReactAppConfig, UseReactBlueprint, UseReactBrowserErrorHandlerOptions, UseReactConfig, UseReactErrorResponseType, UseReactHookListener, UseReactHookListenerContext, UseReactHookName, UseReactHookType, UseReactOptions, UseReactServiceProviderOptions };
|