alepha 0.9.2 → 0.9.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.
- package/README.md +46 -0
- package/batch.d.ts +5 -8
- package/bucket.d.ts +9 -16
- package/cache/redis.d.ts +10 -10
- package/cache.d.ts +3 -7
- package/command.d.ts +19 -17
- package/core.d.ts +188 -340
- package/datetime.d.ts +6 -10
- package/file.d.ts +0 -3
- package/lock/redis.d.ts +3 -6
- package/lock.d.ts +9 -16
- package/{testing.cjs → logger.cjs} +1 -1
- package/logger.d.ts +222 -0
- package/logger.js +1 -0
- package/package.json +50 -49
- package/postgres.d.ts +273 -315
- package/queue/redis.d.ts +1 -3
- package/queue.d.ts +11 -19
- package/react/auth.d.ts +453 -146
- package/react/form.d.ts +119 -69
- package/react/head.d.ts +49 -18
- package/react/i18n.d.ts +61 -27
- package/react.d.ts +304 -212
- package/redis.d.ts +15 -15
- package/retry.d.ts +0 -4
- package/router.d.ts +0 -1
- package/scheduler.d.ts +6 -10
- package/security.d.ts +140 -138
- package/server/cache.d.ts +11 -11
- package/server/compress.d.ts +1 -4
- package/server/cookies.d.ts +45 -19
- package/server/cors.d.ts +4 -8
- package/server/health.d.ts +1 -4
- package/server/helmet.d.ts +28 -28
- package/server/links.d.ts +147 -45
- package/server/metrics.d.ts +5 -9
- package/server/multipart.d.ts +1 -3
- package/server/proxy.d.ts +5 -9
- package/server/security.d.ts +12 -15
- package/server/static.d.ts +6 -10
- package/server/swagger.d.ts +4 -8
- package/server.d.ts +75 -91
- package/topic/redis.d.ts +5 -8
- package/topic.d.ts +4 -12
- package/vite.d.ts +59 -30
- package/testing.d.ts +0 -1
- package/testing.js +0 -1
package/react/form.d.ts
CHANGED
|
@@ -1,41 +1,49 @@
|
|
|
1
1
|
import * as _alepha_core0 from "alepha";
|
|
2
|
-
import { Static, TObject, TSchema } from "alepha";
|
|
3
|
-
import { InputHTMLAttributes } from "react";
|
|
2
|
+
import { Alepha, Static, TObject, TSchema } from "alepha";
|
|
3
|
+
import { InputHTMLAttributes, ReactNode } from "react";
|
|
4
|
+
import * as _alepha_logger0 from "alepha/logger";
|
|
4
5
|
|
|
5
|
-
//#region src/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
6
|
+
//#region src/services/FormModel.d.ts
|
|
7
|
+
declare class FormModel<T extends TObject> {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
protected readonly options: FormCtrlOptions<T>;
|
|
10
|
+
protected readonly log: _alepha_logger0.Logger;
|
|
11
|
+
protected readonly alepha: Alepha;
|
|
12
|
+
protected readonly values: Record<string, any>;
|
|
13
|
+
input: SchemaToInput<T>;
|
|
14
|
+
constructor(id: string, options: FormCtrlOptions<T>);
|
|
15
|
+
readonly onSubmit: (event: FormEventLike) => Promise<void>;
|
|
16
|
+
protected parseValuesFromFormElement<T extends TObject>(options: FormCtrlOptions<T>, store: Record<string, any>): Record<string, any>;
|
|
17
|
+
protected getValueFromInputObject<T extends TObject>(options: FormCtrlOptions<T>, values: Record<string, any>, key: string, value: FormDataEntryValue): void;
|
|
18
|
+
protected createProxyFromSchema<T extends TObject>(options: FormCtrlOptions<T>, schema: TSchema, context: {
|
|
19
|
+
parent: string;
|
|
20
|
+
store: Record<string, any>;
|
|
21
|
+
}): SchemaToInput<T>;
|
|
22
|
+
protected createInputFromSchema<T extends TObject>(name: keyof Static<T> & string, options: FormCtrlOptions<T>, schema: TSchema, context: {
|
|
23
|
+
parent: string;
|
|
24
|
+
store: Record<string, any>;
|
|
25
|
+
}): InputField;
|
|
26
|
+
protected getValueFromInput(input: FormDataEntryValue, schema: TSchema): any;
|
|
27
|
+
protected valueToInputEntry(value: any): string | number | boolean;
|
|
28
|
+
}
|
|
29
|
+
type SchemaToInput<T extends TObject> = { [K in keyof T["properties"]]: T["properties"][K] extends TObject ? SchemaToInput<T["properties"][K]> : InputField };
|
|
30
|
+
interface FormEventLike {
|
|
31
|
+
currentTarget: HTMLFormElement;
|
|
32
|
+
preventDefault: () => void;
|
|
33
|
+
stopPropagation: () => void;
|
|
34
|
+
}
|
|
35
|
+
interface InputField {
|
|
36
|
+
path: string;
|
|
37
|
+
props: InputHTMLAttributesLike;
|
|
38
|
+
schema: TSchema;
|
|
39
|
+
set: (value: any) => void;
|
|
40
|
+
}
|
|
41
|
+
type InputHTMLAttributesLike = Pick<InputHTMLAttributes<unknown>, "id" | "name" | "type" | "value" | "defaultValue" | "required" | "maxLength" | "minLength" | "aria-label"> & {
|
|
42
|
+
value?: any;
|
|
43
|
+
defaultValue?: any;
|
|
44
|
+
onChange?: (event: any) => void;
|
|
45
|
+
};
|
|
46
|
+
type FormCtrlOptions<T extends TObject> = {
|
|
39
47
|
/**
|
|
40
48
|
* The schema defining the structure and validation rules for the form.
|
|
41
49
|
* This should be a TypeBox schema object.
|
|
@@ -47,12 +55,7 @@ type UseFormOptions<T extends TObject> = {
|
|
|
47
55
|
*/
|
|
48
56
|
handler: (values: Static<T>, args: {
|
|
49
57
|
form: HTMLFormElement;
|
|
50
|
-
}) =>
|
|
51
|
-
/**
|
|
52
|
-
* Optional callback to handle changes in form values.
|
|
53
|
-
* This can be used to update state or perform side effects when values change.
|
|
54
|
-
*/
|
|
55
|
-
onValuesChange?: (values: Static<T>, previous: Static<T>) => void;
|
|
58
|
+
}) => unknown;
|
|
56
59
|
/**
|
|
57
60
|
* Optional initial values for the form fields.
|
|
58
61
|
* This can be used to pre-populate the form with existing data.
|
|
@@ -71,33 +74,82 @@ type UseFormOptions<T extends TObject> = {
|
|
|
71
74
|
* If omitted, IDs will not be generated.
|
|
72
75
|
*/
|
|
73
76
|
id?: string;
|
|
77
|
+
onError?: (error: Error, args: {
|
|
78
|
+
form: HTMLFormElement;
|
|
79
|
+
}) => void;
|
|
80
|
+
onChange?: (key: string, value: any, store: Record<string, any>) => void;
|
|
74
81
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/components/FormState.d.ts
|
|
84
|
+
declare const FormState: <T extends TObject>(props: {
|
|
85
|
+
form: FormModel<T>;
|
|
86
|
+
children: (state: {
|
|
87
|
+
loading: boolean;
|
|
88
|
+
dirty: boolean;
|
|
89
|
+
}) => ReactNode;
|
|
90
|
+
}) => ReactNode;
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/hooks/useForm.d.ts
|
|
93
|
+
/**
|
|
94
|
+
* Custom hook to create a form with validation and field management.
|
|
95
|
+
* This hook uses TypeBox schemas to define the structure and validation rules for the form.
|
|
96
|
+
* It provides a way to handle form submission, field creation, and value management.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```tsx
|
|
100
|
+
* import { t } from "alepha";
|
|
101
|
+
*
|
|
102
|
+
* const form = useForm({
|
|
103
|
+
* schema: t.object({
|
|
104
|
+
* username: t.string(),
|
|
105
|
+
* password: t.string(),
|
|
106
|
+
* }),
|
|
107
|
+
* handler: (values) => {
|
|
108
|
+
* console.log("Form submitted with values:", values);
|
|
109
|
+
* },
|
|
110
|
+
* });
|
|
111
|
+
*
|
|
112
|
+
* return (
|
|
113
|
+
* <form onSubmit={form.onSubmit}>
|
|
114
|
+
* <input {...form.input("username")} />
|
|
115
|
+
* <input {...form.input("password")} />
|
|
116
|
+
* <button type="submit">Submit</button>
|
|
117
|
+
* </form>
|
|
118
|
+
* );
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
declare const useForm: <T extends TObject>(options: FormCtrlOptions<T>) => FormModel<T>;
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/hooks/useFormState.d.ts
|
|
124
|
+
interface UseFormStateReturn<T extends TObject> {
|
|
125
|
+
loading: boolean;
|
|
126
|
+
dirty: boolean;
|
|
127
|
+
values?: T;
|
|
128
|
+
error?: Error;
|
|
97
129
|
}
|
|
98
|
-
|
|
130
|
+
declare const useFormState: <T extends TObject>(form: FormModel<T>) => UseFormStateReturn<T>;
|
|
99
131
|
//#endregion
|
|
100
132
|
//#region src/index.d.ts
|
|
133
|
+
declare module "alepha" {
|
|
134
|
+
interface Hooks {
|
|
135
|
+
"form:change": {
|
|
136
|
+
id: string;
|
|
137
|
+
};
|
|
138
|
+
"form:submit:begin": {
|
|
139
|
+
id: string;
|
|
140
|
+
};
|
|
141
|
+
"form:submit:success": {
|
|
142
|
+
id: string;
|
|
143
|
+
};
|
|
144
|
+
"form:submit:error": {
|
|
145
|
+
id: string;
|
|
146
|
+
error: Error;
|
|
147
|
+
};
|
|
148
|
+
"form:submit:end": {
|
|
149
|
+
id: string;
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}
|
|
101
153
|
/**
|
|
102
154
|
* React hooks for managing forms in Alepha applications.
|
|
103
155
|
*
|
|
@@ -109,9 +161,7 @@ interface FormEventLike {
|
|
|
109
161
|
* @see {@link useForm}
|
|
110
162
|
* @module alepha.react.form
|
|
111
163
|
*/
|
|
112
|
-
declare const AlephaReactForm: _alepha_core0.
|
|
113
|
-
//# sourceMappingURL=index.d.ts.map
|
|
114
|
-
|
|
164
|
+
declare const AlephaReactForm: _alepha_core0.Service<_alepha_core0.Module>;
|
|
115
165
|
//#endregion
|
|
116
|
-
export { AlephaReactForm, FormEventLike,
|
|
166
|
+
export { AlephaReactForm, FormCtrlOptions, FormEventLike, FormModel, FormState, InputField, InputHTMLAttributesLike, SchemaToInput, UseFormStateReturn, useForm, useFormState };
|
|
117
167
|
//# sourceMappingURL=index.d.ts.map
|
package/react/head.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import { PageConfigSchema,
|
|
1
|
+
import * as _alepha_core1 from "alepha";
|
|
2
|
+
import { Descriptor, KIND } from "alepha";
|
|
3
|
+
import { PageConfigSchema, PageRoute, ReactRouterState, TPropsDefault, TPropsParentDefault } from "alepha/react";
|
|
4
|
+
import { ServerTimingProvider } from "alepha/server";
|
|
4
5
|
|
|
5
6
|
//#region src/interfaces/Head.d.ts
|
|
6
7
|
interface Head extends SimpleHead {
|
|
@@ -42,36 +43,68 @@ interface SimpleHead {
|
|
|
42
43
|
content: string;
|
|
43
44
|
}>;
|
|
44
45
|
}
|
|
45
|
-
//# sourceMappingURL=Head.d.ts.map
|
|
46
|
-
//#endregion
|
|
47
|
-
//#region src/hooks/useHead.d.ts
|
|
48
|
-
declare const useHead: (head?: Head | ((previous?: Head) => Head)) => void;
|
|
49
|
-
//# sourceMappingURL=useHead.d.ts.map
|
|
50
46
|
//#endregion
|
|
51
47
|
//#region src/providers/HeadProvider.d.ts
|
|
52
48
|
declare class HeadProvider {
|
|
53
|
-
|
|
54
|
-
protected
|
|
49
|
+
global?: Head | (() => Head);
|
|
50
|
+
protected getGlobalHead(): Head | undefined;
|
|
51
|
+
fillHead(state: ReactRouterState): void;
|
|
52
|
+
protected fillHeadByPage(page: PageRoute, state: ReactRouterState, props: Record<string, any>): void;
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/descriptors/$head.d.ts
|
|
56
|
+
/**
|
|
57
|
+
* Set global `<head>` options for the application.
|
|
58
|
+
*/
|
|
59
|
+
declare const $head: {
|
|
60
|
+
(options: HeadDescriptorOptions): HeadDescriptor;
|
|
61
|
+
[KIND]: typeof HeadDescriptor;
|
|
62
|
+
};
|
|
63
|
+
type HeadDescriptorOptions = Head | (() => Head);
|
|
64
|
+
declare class HeadDescriptor extends Descriptor<HeadDescriptorOptions> {
|
|
65
|
+
protected readonly provider: HeadProvider;
|
|
66
|
+
protected onInit(): void;
|
|
55
67
|
}
|
|
56
|
-
//#
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/hooks/useHead.d.ts
|
|
70
|
+
/**
|
|
71
|
+
* ```tsx
|
|
72
|
+
* const App = () => {
|
|
73
|
+
* const [head, setHead] = useHead({
|
|
74
|
+
* // will set the document title on the first render
|
|
75
|
+
* title: "My App",
|
|
76
|
+
* });
|
|
77
|
+
*
|
|
78
|
+
* return (
|
|
79
|
+
* // This will update the document title when the button is clicked
|
|
80
|
+
* <button onClick={() => setHead({ title: "Change Title" })}>
|
|
81
|
+
* Change Title {head.title}
|
|
82
|
+
* </button>
|
|
83
|
+
* );
|
|
84
|
+
* }
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
declare const useHead: (options?: UseHeadOptions) => void;
|
|
88
|
+
type UseHeadOptions = Head | ((previous?: Head) => Head);
|
|
89
|
+
type UseHeadReturn = [Head, (head?: Head | ((previous?: Head) => Head)) => void];
|
|
57
90
|
//#endregion
|
|
58
91
|
//#region src/providers/ServerHeadProvider.d.ts
|
|
59
92
|
declare class ServerHeadProvider {
|
|
60
93
|
protected readonly headProvider: HeadProvider;
|
|
61
|
-
protected readonly
|
|
94
|
+
protected readonly serverTimingProvider: ServerTimingProvider;
|
|
95
|
+
protected readonly onServerRenderEnd: _alepha_core1.HookDescriptor<"react:server:render:end">;
|
|
62
96
|
renderHead(template: string, head: SimpleHead): string;
|
|
63
97
|
protected mergeAttributes(existing: string, attrs: Record<string, string>): string;
|
|
64
98
|
protected parseAttributes(attrStr: string): Record<string, string>;
|
|
65
99
|
protected escapeHtml(str: string): string;
|
|
66
100
|
}
|
|
67
|
-
//# sourceMappingURL=ServerHeadProvider.d.ts.map
|
|
68
101
|
//#endregion
|
|
69
102
|
//#region src/index.d.ts
|
|
70
103
|
declare module "alepha/react" {
|
|
71
104
|
interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> {
|
|
72
105
|
head?: Head | ((props: TProps, previous?: Head) => Head);
|
|
73
106
|
}
|
|
74
|
-
interface
|
|
107
|
+
interface ReactRouterState {
|
|
75
108
|
head: Head;
|
|
76
109
|
}
|
|
77
110
|
}
|
|
@@ -81,9 +114,7 @@ declare module "alepha/react" {
|
|
|
81
114
|
* @see {@link ServerHeadProvider}
|
|
82
115
|
* @module alepha.react.head
|
|
83
116
|
*/
|
|
84
|
-
declare const AlephaReactHead:
|
|
85
|
-
//# sourceMappingURL=index.d.ts.map
|
|
86
|
-
|
|
117
|
+
declare const AlephaReactHead: _alepha_core1.Service<_alepha_core1.Module>;
|
|
87
118
|
//#endregion
|
|
88
|
-
export { AlephaReactHead, Head, ServerHeadProvider, SimpleHead, useHead };
|
|
119
|
+
export { $head, AlephaReactHead, Head, HeadDescriptor, HeadDescriptorOptions, ServerHeadProvider, SimpleHead, UseHeadOptions, UseHeadReturn, useHead };
|
|
89
120
|
//# sourceMappingURL=index.d.ts.map
|
package/react/i18n.d.ts
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as _alepha_core0 from "alepha";
|
|
1
|
+
import * as _alepha_core1 from "alepha";
|
|
3
2
|
import { Alepha, Descriptor, KIND } from "alepha";
|
|
3
|
+
import * as _alepha_logger0 from "alepha/logger";
|
|
4
|
+
import * as _alepha_server_cookies0 from "alepha/server/cookies";
|
|
5
|
+
import * as _sinclair_typebox0 from "@sinclair/typebox";
|
|
4
6
|
|
|
7
|
+
//#region src/hooks/useI18n.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Hook to access the i18n service.
|
|
10
|
+
*/
|
|
11
|
+
declare const useI18n: <S extends object, K extends keyof ServiceDictionary<S>>() => I18nProvider<object, never>;
|
|
12
|
+
type ServiceDictionary<T extends object> = { [K in keyof T]: T[K] extends DictionaryDescriptor<infer U> ? U : never };
|
|
13
|
+
//#endregion
|
|
5
14
|
//#region src/providers/I18nProvider.d.ts
|
|
6
|
-
declare class I18nProvider {
|
|
7
|
-
logger:
|
|
8
|
-
alepha: Alepha;
|
|
9
|
-
|
|
15
|
+
declare class I18nProvider<S extends object, K extends keyof ServiceDictionary<S>> {
|
|
16
|
+
protected logger: _alepha_logger0.Logger;
|
|
17
|
+
protected alepha: Alepha;
|
|
18
|
+
protected cookie: _alepha_server_cookies0.AbstractCookieDescriptor<_sinclair_typebox0.TString>;
|
|
19
|
+
readonly registry: Array<{
|
|
10
20
|
name: string;
|
|
11
21
|
lang: string;
|
|
12
22
|
loader: () => Promise<Record<string, string>>;
|
|
@@ -15,15 +25,53 @@ declare class I18nProvider {
|
|
|
15
25
|
options: {
|
|
16
26
|
fallbackLang: string;
|
|
17
27
|
};
|
|
18
|
-
|
|
19
|
-
|
|
28
|
+
numberFormat: {
|
|
29
|
+
format: (value: number) => string;
|
|
30
|
+
};
|
|
31
|
+
get languages(): string[];
|
|
32
|
+
protected readonly onRender: _alepha_core1.HookDescriptor<"server:onRequest">;
|
|
33
|
+
protected readonly onStart: _alepha_core1.HookDescriptor<"start">;
|
|
34
|
+
protected createFormatters(): void;
|
|
20
35
|
setLang(lang: string): Promise<void>;
|
|
36
|
+
protected readonly mutate: _alepha_core1.HookDescriptor<"state:mutate">;
|
|
21
37
|
get lang(): string;
|
|
22
|
-
translate: (key: string) => string;
|
|
38
|
+
translate: (key: string, args?: string[]) => string;
|
|
39
|
+
readonly tr: (key: keyof ServiceDictionary<S>[K] | string, args?: string[]) => string;
|
|
40
|
+
protected render(item: string, args: string[]): string;
|
|
23
41
|
}
|
|
24
|
-
//# sourceMappingURL=I18nProvider.d.ts.map
|
|
25
42
|
//#endregion
|
|
26
43
|
//#region src/descriptors/$dictionary.d.ts
|
|
44
|
+
/**
|
|
45
|
+
* Register a dictionary entry for translations.
|
|
46
|
+
*
|
|
47
|
+
* It allows you to define a set of translations for a specific language.
|
|
48
|
+
* Entry can be lazy-loaded, which is useful for large dictionaries or when translations are not needed immediately.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* import { $dictionary } from "alepha/react/i18n";
|
|
53
|
+
*
|
|
54
|
+
* const Example = () => {
|
|
55
|
+
* const { tr } = useI18n<App, "en">();
|
|
56
|
+
* return <div>{tr("hello")}</div>; //
|
|
57
|
+
* }
|
|
58
|
+
*
|
|
59
|
+
* class App {
|
|
60
|
+
*
|
|
61
|
+
* en = $dictionary({
|
|
62
|
+
* // { default: { hello: "Hey" } }
|
|
63
|
+
* lazy: () => import("./translations/en.ts"),
|
|
64
|
+
* });
|
|
65
|
+
*
|
|
66
|
+
* home = $page({
|
|
67
|
+
* path: "/",
|
|
68
|
+
* component: Example,
|
|
69
|
+
* })
|
|
70
|
+
* }
|
|
71
|
+
*
|
|
72
|
+
* run(App);
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
27
75
|
declare const $dictionary: {
|
|
28
76
|
<T extends Record<string, string>>(options: DictionaryDescriptorOptions<T>): DictionaryDescriptor<T>;
|
|
29
77
|
[KIND]: typeof DictionaryDescriptor;
|
|
@@ -36,21 +84,9 @@ interface DictionaryDescriptorOptions<T extends Record<string, string>> {
|
|
|
36
84
|
}>;
|
|
37
85
|
}
|
|
38
86
|
declare class DictionaryDescriptor<T extends Record<string, string>> extends Descriptor<DictionaryDescriptorOptions<T>> {
|
|
39
|
-
protected provider: I18nProvider
|
|
87
|
+
protected provider: I18nProvider<object, never>;
|
|
40
88
|
protected onInit(): void;
|
|
41
89
|
}
|
|
42
|
-
//# sourceMappingURL=$dictionary.d.ts.map
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region src/hooks/useI18n.d.ts
|
|
45
|
-
/**
|
|
46
|
-
* Hook to access the i18n service.
|
|
47
|
-
*/
|
|
48
|
-
declare const useI18n: <S extends object, K extends keyof ServiceDictionary<S>>() => {
|
|
49
|
-
lang: string;
|
|
50
|
-
setLang: (lang: string) => Promise<void>;
|
|
51
|
-
tr: (key: keyof ServiceDictionary<S>[K]) => string;
|
|
52
|
-
};
|
|
53
|
-
type ServiceDictionary<T extends object> = { [K in keyof T]: T[K] extends DictionaryDescriptor<infer U> ? U : never };
|
|
54
90
|
//#endregion
|
|
55
91
|
//#region src/index.d.ts
|
|
56
92
|
declare module "alepha" {
|
|
@@ -65,9 +101,7 @@ declare module "alepha" {
|
|
|
65
101
|
*
|
|
66
102
|
* @module alepha.react.i18n
|
|
67
103
|
*/
|
|
68
|
-
declare const AlephaReactI18n:
|
|
69
|
-
//# sourceMappingURL=index.d.ts.map
|
|
70
|
-
|
|
104
|
+
declare const AlephaReactI18n: _alepha_core1.Service<_alepha_core1.Module>;
|
|
71
105
|
//#endregion
|
|
72
|
-
export { $dictionary, AlephaReactI18n, DictionaryDescriptor, DictionaryDescriptorOptions, I18nProvider, useI18n };
|
|
106
|
+
export { $dictionary, AlephaReactI18n, DictionaryDescriptor, DictionaryDescriptorOptions, I18nProvider, ServiceDictionary, useI18n };
|
|
73
107
|
//# sourceMappingURL=index.d.ts.map
|