@variousjs/various 4.2.0 → 4.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/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/loader.js +1 -1
- package/dist/loader.js.map +1 -1
- package/index.d.ts +29 -6
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ declare module '@variousjs/various' {
|
|
|
16
16
|
'SUBMODULE_NOT_DEFINED' |
|
|
17
17
|
'SUBMODULE_SCRIPT_ERROR' |
|
|
18
18
|
'DISPATCH' |
|
|
19
|
-
'I18N'
|
|
19
|
+
'I18N' | (string & {})
|
|
20
20
|
|
|
21
21
|
export interface ComponentDefaultProps {
|
|
22
22
|
$silent?: boolean,
|
|
@@ -42,17 +42,27 @@ declare module '@variousjs/various' {
|
|
|
42
42
|
}) => Promise<any>
|
|
43
43
|
type $postMessage = (event: string, value?: any) => void
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
interface $logger {
|
|
46
|
+
info: (message: any, type?: string) => void,
|
|
47
|
+
warn: (message: any, type?: string) => void,
|
|
48
|
+
error: (message: any, type?: string) => void,
|
|
49
|
+
}
|
|
46
50
|
|
|
47
|
-
export type
|
|
51
|
+
export type Intl = (
|
|
52
|
+
key: string,
|
|
53
|
+
paramsOrDefaultText?: Record<string, string | number> | string,
|
|
54
|
+
defaultText?: string,
|
|
55
|
+
) => string
|
|
48
56
|
|
|
49
57
|
export type PublicAction = (value: any, trigger: ModuleDefined) => any
|
|
50
58
|
|
|
51
|
-
export
|
|
59
|
+
export interface I18nConfig {
|
|
52
60
|
localeKey: string,
|
|
53
61
|
resources: Record<string, Record<string, string>>,
|
|
54
62
|
}
|
|
55
63
|
|
|
64
|
+
export type I18n = () => I18nConfig | Promise<I18nConfig>
|
|
65
|
+
|
|
56
66
|
export type OnMessage = (message: Message) => void
|
|
57
67
|
|
|
58
68
|
export interface StaticProps {
|
|
@@ -69,6 +79,7 @@ declare module '@variousjs/various' {
|
|
|
69
79
|
$dispatch: $dispatch,
|
|
70
80
|
$postMessage: $postMessage,
|
|
71
81
|
$t: Intl,
|
|
82
|
+
$logger: $logger,
|
|
72
83
|
} & P
|
|
73
84
|
|
|
74
85
|
export type ComponentNode<
|
|
@@ -121,10 +132,18 @@ declare module '@variousjs/various' {
|
|
|
121
132
|
beenLoaded: boolean,
|
|
122
133
|
}
|
|
123
134
|
|
|
135
|
+
type LogLevel = 'info' | 'warn' | 'error'
|
|
136
|
+
interface LogArgs extends ModuleDefined {
|
|
137
|
+
level: LogLevel,
|
|
138
|
+
type?: string,
|
|
139
|
+
message: any,
|
|
140
|
+
}
|
|
141
|
+
|
|
124
142
|
export type MessageEvent = (e: MessageEventArgs) => Promise<MessageEventRes> | MessageEventRes
|
|
125
143
|
export type DispatchEvent = (e: DispatchEventArgs) => Promise<DispatchEventRes> | DispatchEventRes
|
|
126
144
|
export type LoadEvent = (e: LoadEventArgs) => void
|
|
127
145
|
export type ErrorEvent = (e: VariousError) => void
|
|
146
|
+
export type LogEvent = (e: LogArgs) => boolean
|
|
128
147
|
|
|
129
148
|
export interface App<S extends object = ObjectAny> {
|
|
130
149
|
store?: readonly S,
|
|
@@ -137,17 +156,20 @@ declare module '@variousjs/various' {
|
|
|
137
156
|
onError?: ErrorEvent,
|
|
138
157
|
onMessage?: MessageEvent,
|
|
139
158
|
onDispatch?: DispatchEvent,
|
|
159
|
+
onLog?: LogEvent,
|
|
140
160
|
},
|
|
161
|
+
i18n?: I18n,
|
|
141
162
|
}
|
|
142
163
|
|
|
143
164
|
export interface Config {
|
|
144
165
|
dependencies: {
|
|
145
166
|
app: string,
|
|
146
167
|
'@variousjs/various'?: string,
|
|
168
|
+
react?: string,
|
|
169
|
+
'react-dom'?: string,
|
|
147
170
|
[x: string]: string,
|
|
148
171
|
},
|
|
149
172
|
root?: string,
|
|
150
|
-
env?: ENV,
|
|
151
173
|
timeout?: number,
|
|
152
174
|
earlyParallelDependencies?: string[],
|
|
153
175
|
}
|
|
@@ -180,10 +202,11 @@ declare module '@variousjs/various' {
|
|
|
180
202
|
) => () => void
|
|
181
203
|
export const defineDependencies: (deps: Record<string, string>) => void
|
|
182
204
|
|
|
183
|
-
export const
|
|
205
|
+
export const version: string
|
|
184
206
|
export function getConfig<C extends object = ObjectAny>(): C
|
|
185
207
|
export function getStore<S extends object = ObjectAny>(): S
|
|
186
208
|
|
|
187
209
|
export const createDispatch: (m: ModuleDefined) => $dispatch
|
|
188
210
|
export const createPostMessage: (m: ModuleDefined) => $postMessage
|
|
211
|
+
export const createLogger: (m: ModuleDefined) => $logger
|
|
189
212
|
}
|