@variousjs/various 5.1.5 → 5.2.1
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.dev.js +171 -254
- package/dist/index.dev.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/loader-dev.js +8 -2
- package/dist/loader-dev.js.map +1 -1
- package/dist/loader.js +1 -1
- package/dist/loader.js.map +1 -1
- package/dist/standalone.js +178 -265
- package/dist/standalone.js.map +1 -1
- package/index.d.ts +170 -78
- package/package.json +38 -33
- package/standalone.d.ts +27 -20
package/index.d.ts
CHANGED
|
@@ -6,7 +6,14 @@ declare module '@variousjs/various' {
|
|
|
6
6
|
|
|
7
7
|
export { default as Nycticorax, Dispatch } from 'nycticorax'
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* module name
|
|
11
|
+
* - e.g. A.B
|
|
12
|
+
* - e.g. B
|
|
13
|
+
* - e.g. app
|
|
14
|
+
* - e.g. A.default -> A
|
|
15
|
+
*/
|
|
16
|
+
export type ModuleDef = string
|
|
10
17
|
|
|
11
18
|
export type ObjectRecord<T = any> = Record<string, T>
|
|
12
19
|
|
|
@@ -25,31 +32,90 @@ declare module '@variousjs/various' {
|
|
|
25
32
|
'DISPATCH' |
|
|
26
33
|
'I18N' | (string & {})
|
|
27
34
|
|
|
28
|
-
export interface ComponentDefaultProps {
|
|
35
|
+
export interface ComponentDefaultProps<Ref = unknown> {
|
|
29
36
|
$silent?: boolean,
|
|
30
37
|
/**
|
|
31
38
|
* for React Component only
|
|
32
39
|
*/
|
|
33
|
-
$ref?: RefObject<
|
|
40
|
+
$ref?: RefObject<Ref>,
|
|
34
41
|
[k: string]: any,
|
|
35
42
|
}
|
|
36
43
|
|
|
37
44
|
export interface VariousError extends Error {
|
|
38
45
|
type: ErrorType,
|
|
39
46
|
originalError: Error,
|
|
40
|
-
module
|
|
41
|
-
name: ModuleDefined['name'],
|
|
47
|
+
module: ModuleDef,
|
|
42
48
|
}
|
|
43
49
|
|
|
44
|
-
interface
|
|
50
|
+
interface ActionDef {
|
|
51
|
+
payload: any,
|
|
52
|
+
result: any,
|
|
53
|
+
}
|
|
45
54
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
type
|
|
55
|
+
interface MessageDef {
|
|
56
|
+
payload: any,
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type PublicAction<A extends ActionDef = never> = (params: {
|
|
60
|
+
payload: [A] extends [never] ? any : A['payload'],
|
|
61
|
+
trigger: ModuleDef,
|
|
62
|
+
}) => [A] extends [never] ? any : A['result']
|
|
63
|
+
|
|
64
|
+
type PublicActionDef = Record<string, ActionDef>
|
|
65
|
+
|
|
66
|
+
type MessagesDef = Record<string, MessageDef>
|
|
51
67
|
|
|
52
|
-
|
|
68
|
+
export type DefineActions<T extends PublicActionDef> = T
|
|
69
|
+
|
|
70
|
+
export type DefineMessages<T extends MessagesDef> = T
|
|
71
|
+
|
|
72
|
+
interface Message<T extends MessagesDef = never> {
|
|
73
|
+
event: [T] extends [never] ? string : keyof T,
|
|
74
|
+
payload: [T] extends [never] ? any : T[keyof T]['payload'],
|
|
75
|
+
trigger: ModuleDef,
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export type StaticMethods<T extends PublicActionDef = never> =
|
|
79
|
+
[T] extends [never]
|
|
80
|
+
? Record<string, (params: { payload: any, trigger: ModuleDef }) => any>
|
|
81
|
+
: {
|
|
82
|
+
[K in keyof T]: T[K] extends { payload: infer V, result: infer R }
|
|
83
|
+
? (params: { payload?: V, trigger: ModuleDef }) => R
|
|
84
|
+
: never
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export type ComponentStatics<S extends PublicActionDef = never, T extends MessagesDef = never> = {
|
|
88
|
+
$i18n?: I18n,
|
|
89
|
+
$onMessage?: OnMessage<T>,
|
|
90
|
+
} & StaticMethods<S>
|
|
91
|
+
|
|
92
|
+
type ComponentPublicActionMap = {
|
|
93
|
+
[name: string]: PublicActionDef,
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
type $dispatch<M extends ComponentPublicActionMap = never> = [M] extends [never]
|
|
97
|
+
? {
|
|
98
|
+
(params: {
|
|
99
|
+
target: string,
|
|
100
|
+
action: string,
|
|
101
|
+
payload?: any,
|
|
102
|
+
}): Promise<any>
|
|
103
|
+
}
|
|
104
|
+
: {
|
|
105
|
+
<T extends keyof M, A extends keyof M[T]>(
|
|
106
|
+
params: {
|
|
107
|
+
target: T,
|
|
108
|
+
action: A,
|
|
109
|
+
payload?: M[T][A]['payload'],
|
|
110
|
+
}
|
|
111
|
+
): Promise<M[T][A]['result']>
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
type $postMessage<T extends MessagesDef = never> = [T] extends [never]
|
|
115
|
+
? (params: { event: string, payload?: any }) => void
|
|
116
|
+
: <K extends keyof T>(params: { event: K, payload?: T[K]['payload'] }) => void
|
|
117
|
+
|
|
118
|
+
type $logger = {
|
|
53
119
|
info: (message: any, type?: string) => void,
|
|
54
120
|
warn: (message: any, type?: string) => void,
|
|
55
121
|
error: (message: any, type?: string) => void,
|
|
@@ -63,17 +129,19 @@ declare module '@variousjs/various' {
|
|
|
63
129
|
update: (config: Partial<I18nConfig>, type?: 'app') => void,
|
|
64
130
|
}
|
|
65
131
|
|
|
66
|
-
interface ComponentBuiltinProps<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
132
|
+
interface ComponentBuiltinProps<
|
|
133
|
+
Store extends object = ObjectRecord,
|
|
134
|
+
Messages extends MessagesDef = never,
|
|
135
|
+
Actions extends ComponentPublicActionMap = never
|
|
136
|
+
> {
|
|
137
|
+
$store: Readonly<Store>,
|
|
138
|
+
$dispatch: $dispatch<Actions>,
|
|
139
|
+
$postMessage: $postMessage<Messages>,
|
|
70
140
|
$t: Intl,
|
|
71
141
|
$logger: $logger,
|
|
72
|
-
$self:
|
|
142
|
+
$self: { url: string, module: ModuleDef },
|
|
73
143
|
}
|
|
74
144
|
|
|
75
|
-
export type PublicAction = (value: any, trigger: ModuleDefined) => any
|
|
76
|
-
|
|
77
145
|
export interface I18nConfig {
|
|
78
146
|
/** app store key */
|
|
79
147
|
lngStoreKey: string,
|
|
@@ -82,39 +150,40 @@ declare module '@variousjs/various' {
|
|
|
82
150
|
|
|
83
151
|
export type I18n = () => I18nConfig | Promise<I18nConfig>
|
|
84
152
|
|
|
85
|
-
export type OnMessage = (message: Message) => void
|
|
153
|
+
export type OnMessage<T extends MessagesDef = never> = (message: Message<T>) => void
|
|
86
154
|
|
|
87
|
-
export
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
155
|
+
export type VariousProps<
|
|
156
|
+
Props extends object = ObjectRecord,
|
|
157
|
+
Store extends object = ObjectRecord,
|
|
158
|
+
Messages extends MessagesDef = never,
|
|
159
|
+
Actions extends ComponentPublicActionMap = never
|
|
160
|
+
> = ComponentBuiltinProps<Store, Messages, Actions> & Props
|
|
92
161
|
|
|
93
|
-
export type
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
162
|
+
export type VariousFC<
|
|
163
|
+
Props extends object = ObjectRecord,
|
|
164
|
+
Store extends object = ObjectRecord,
|
|
165
|
+
SelfActions extends PublicActionDef = never,
|
|
166
|
+
Messages extends MessagesDef = never,
|
|
167
|
+
Actions extends ComponentPublicActionMap = never
|
|
168
|
+
> = FC<VariousProps<Props, Store, Messages, Actions>> & ComponentStatics<SelfActions, Messages>
|
|
97
169
|
|
|
98
|
-
export
|
|
99
|
-
S extends object = {},
|
|
100
|
-
P extends object = {}
|
|
101
|
-
> = FC<ComponentProps<S, P>> & StaticProps
|
|
102
|
-
|
|
103
|
-
export interface ErrorFallbackProps<S extends object = ObjectRecord> {
|
|
170
|
+
export interface ErrorFallbackProps<Store extends object = ObjectRecord> {
|
|
104
171
|
$reload: () => void,
|
|
105
172
|
$error: VariousError,
|
|
106
|
-
$store: Readonly<
|
|
107
|
-
$self:
|
|
173
|
+
$store: Readonly<Store>,
|
|
174
|
+
$self: { url: string, module: ModuleDef },
|
|
108
175
|
}
|
|
109
176
|
export type ErrorFallbackNode<
|
|
110
|
-
|
|
111
|
-
> = ComponentType<ErrorFallbackProps<
|
|
177
|
+
Store extends object = ObjectRecord
|
|
178
|
+
> = ComponentType<ErrorFallbackProps<Store>>
|
|
112
179
|
|
|
113
|
-
export interface FallbackProps<
|
|
114
|
-
$store: Readonly<
|
|
115
|
-
$self:
|
|
180
|
+
export interface FallbackProps<Store extends object = ObjectRecord> {
|
|
181
|
+
$store: Readonly<Store>,
|
|
182
|
+
$self: { url: string, module: ModuleDef },
|
|
116
183
|
}
|
|
117
|
-
export type FallbackNode<
|
|
184
|
+
export type FallbackNode<
|
|
185
|
+
Store extends object = ObjectRecord
|
|
186
|
+
> = ComponentType<FallbackProps<Store>>
|
|
118
187
|
|
|
119
188
|
type Dispatch<T extends object = ObjectRecord> = (
|
|
120
189
|
nycticorax: {
|
|
@@ -122,31 +191,33 @@ declare module '@variousjs/various' {
|
|
|
122
191
|
K extends keyof T ? T[K] : T,
|
|
123
192
|
emit: (next: Partial<T>) => void,
|
|
124
193
|
},
|
|
125
|
-
|
|
126
|
-
trigger:
|
|
194
|
+
payload: any,
|
|
195
|
+
trigger: ModuleDef,
|
|
127
196
|
) => Promise<any>
|
|
128
197
|
|
|
129
198
|
interface MessageEventArgs {
|
|
130
|
-
trigger:
|
|
199
|
+
trigger: ModuleDef,
|
|
131
200
|
event: string,
|
|
132
|
-
|
|
201
|
+
payload?: any,
|
|
133
202
|
}
|
|
134
203
|
type MessageEventRes = boolean | Omit<MessageEventArgs, 'trigger'>
|
|
135
204
|
interface DispatchEventArgs {
|
|
136
|
-
target:
|
|
137
|
-
trigger:
|
|
205
|
+
target: ModuleDef,
|
|
206
|
+
trigger: ModuleDef,
|
|
138
207
|
action: string,
|
|
139
|
-
|
|
208
|
+
payload?: any,
|
|
140
209
|
}
|
|
141
210
|
type DispatchEventRes = boolean | Omit<DispatchEventArgs, 'trigger'>
|
|
142
|
-
interface LoadEventArgs
|
|
211
|
+
interface LoadEventArgs {
|
|
212
|
+
module: ModuleDef,
|
|
143
213
|
loadStart: number,
|
|
144
214
|
loadEnd: number,
|
|
145
215
|
beenLoaded: boolean,
|
|
146
216
|
}
|
|
147
217
|
|
|
148
218
|
type LogLevel = 'info' | 'warn' | 'error'
|
|
149
|
-
interface LogArgs
|
|
219
|
+
interface LogArgs {
|
|
220
|
+
module: ModuleDef,
|
|
150
221
|
level: LogLevel,
|
|
151
222
|
type?: string,
|
|
152
223
|
message: any,
|
|
@@ -158,11 +229,11 @@ declare module '@variousjs/various' {
|
|
|
158
229
|
export type ErrorEvent = (e: VariousError) => void
|
|
159
230
|
export type LogEvent = (e: LogArgs) => boolean
|
|
160
231
|
|
|
161
|
-
export interface App<
|
|
162
|
-
store?:
|
|
163
|
-
ErrorFallback?: ErrorFallbackNode<
|
|
164
|
-
Fallback?: FallbackNode<
|
|
165
|
-
actions?: Record<string, Dispatch<
|
|
232
|
+
export interface App<Store extends object = ObjectRecord> {
|
|
233
|
+
store?: Store,
|
|
234
|
+
ErrorFallback?: ErrorFallbackNode<Store>,
|
|
235
|
+
Fallback?: FallbackNode<Store>,
|
|
236
|
+
actions?: Record<string, Dispatch<Store>>,
|
|
166
237
|
Root: ComponentType,
|
|
167
238
|
middlewares?: {
|
|
168
239
|
onLoad?: LoadEvent,
|
|
@@ -181,53 +252,74 @@ declare module '@variousjs/various' {
|
|
|
181
252
|
react?: string,
|
|
182
253
|
'react-dom'?: string,
|
|
183
254
|
vue?: string,
|
|
184
|
-
|
|
185
|
-
},
|
|
255
|
+
} & Record<string, string>,
|
|
186
256
|
root?: string,
|
|
187
257
|
timeout?: number,
|
|
188
258
|
earlyParallelDependencies?: string[],
|
|
189
259
|
}
|
|
190
260
|
|
|
191
261
|
export function createComponent<
|
|
192
|
-
|
|
193
|
-
|
|
262
|
+
Props extends object = ObjectRecord,
|
|
263
|
+
Ref = unknown,
|
|
264
|
+
Store extends object = ObjectRecord
|
|
194
265
|
>(
|
|
195
|
-
config:
|
|
266
|
+
config: {
|
|
196
267
|
url?: string,
|
|
197
268
|
type?: VariousComponentType,
|
|
269
|
+
module: ModuleDef,
|
|
198
270
|
},
|
|
199
|
-
|
|
200
|
-
|
|
271
|
+
/**
|
|
272
|
+
* set store keys if component created before store initialization
|
|
273
|
+
*/
|
|
274
|
+
storeKeys?: (keyof Store)[],
|
|
275
|
+
): ComponentType<ComponentDefaultProps<Ref> & Props>
|
|
201
276
|
|
|
202
|
-
export function createModule<T = unknown> (params:
|
|
277
|
+
export function createModule<T = unknown> (params: {
|
|
203
278
|
url?: string,
|
|
279
|
+
module: ModuleDef,
|
|
204
280
|
}, logError?: boolean): Promise<T>
|
|
205
281
|
|
|
206
|
-
export function renderComponent<
|
|
282
|
+
export function renderComponent<
|
|
283
|
+
Props extends object = ObjectRecord
|
|
284
|
+
>(params: {
|
|
285
|
+
module: ModuleDef,
|
|
207
286
|
url?: string,
|
|
208
287
|
type?: VariousComponentType,
|
|
209
|
-
props?:
|
|
288
|
+
props?: Props & ComponentDefaultProps,
|
|
210
289
|
target: Element | null,
|
|
211
290
|
renderNode?: (children: ReactNode) => ReactNode,
|
|
212
291
|
onMounted?: () => void,
|
|
213
292
|
}): Promise<() => Promise<void>>
|
|
214
293
|
|
|
215
|
-
export type
|
|
294
|
+
export type VariousComponentProps<
|
|
295
|
+
Store extends object = ObjectRecord,
|
|
296
|
+
Messages extends MessagesDef = never,
|
|
297
|
+
Actions extends ComponentPublicActionMap = never,
|
|
298
|
+
> = PropType<ComponentBuiltinProps<Store, Messages, Actions>>
|
|
216
299
|
|
|
217
|
-
export const isModuleLoaded: (
|
|
218
|
-
export const removeLoadedModules: (
|
|
219
|
-
export const getMountedComponents: () =>
|
|
220
|
-
export const preloadModules: (
|
|
300
|
+
export const isModuleLoaded: (module: ModuleDef) => boolean
|
|
301
|
+
export const removeLoadedModules: (modules: ModuleDef[]) => void
|
|
302
|
+
export const getMountedComponents: () => ModuleDef[]
|
|
303
|
+
export const preloadModules: (modules: ModuleDef[]) => Promise<void>
|
|
221
304
|
export const onComponentMounted: (
|
|
222
|
-
|
|
305
|
+
module: ModuleDef | ModuleDef[],
|
|
306
|
+
callback: () => void
|
|
223
307
|
) => (() => void) | void
|
|
224
308
|
export const defineDependencies: (deps: Record<string, string>) => void
|
|
225
309
|
|
|
226
310
|
export const version: string
|
|
227
311
|
export function getConfig<C extends object = ObjectRecord>(): C
|
|
228
|
-
export function getStore<
|
|
229
|
-
|
|
230
|
-
export const createDispatch:
|
|
231
|
-
|
|
232
|
-
|
|
312
|
+
export function getStore<Store extends object = ObjectRecord>(): Store
|
|
313
|
+
|
|
314
|
+
export const createDispatch: <M extends ComponentPublicActionMap = never>(
|
|
315
|
+
module: ModuleDef,
|
|
316
|
+
) => $dispatch<M>
|
|
317
|
+
export const createPostMessage: <Messages extends MessagesDef = never>(
|
|
318
|
+
module: ModuleDef
|
|
319
|
+
) => $postMessage<Messages>
|
|
320
|
+
export const createLogger: (module: ModuleDef) => $logger
|
|
321
|
+
export const getModuleInfo: (module: ModuleDef) => {
|
|
322
|
+
name: string,
|
|
323
|
+
entry?: string,
|
|
324
|
+
}
|
|
233
325
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@variousjs/various",
|
|
3
|
-
"version": "5.1
|
|
3
|
+
"version": "5.2.1",
|
|
4
4
|
"description": "RequireJS(AMD) + React",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -35,23 +35,24 @@
|
|
|
35
35
|
},
|
|
36
36
|
"nyc": {
|
|
37
37
|
"exclude": [
|
|
38
|
-
"test/*"
|
|
38
|
+
"test/*",
|
|
39
|
+
"cypress/*"
|
|
39
40
|
],
|
|
40
41
|
"excludeAfterRemap": true
|
|
41
42
|
},
|
|
42
43
|
"scripts": {
|
|
43
|
-
"lint": "tsc --noemit && eslint . --ext .ts,.tsx,.js",
|
|
44
|
-
"create-empty": "touch
|
|
44
|
+
"lint": "tsc --noemit --skipLibCheck && eslint . --ext .ts,.tsx,.js",
|
|
45
|
+
"create-empty": "touch public/dist/empty.js",
|
|
45
46
|
"test-components": "webpack --config webpack/test-components.js",
|
|
46
47
|
"test-components:build": "NODE_ENV=production webpack --config webpack/test-components.js --progress",
|
|
47
48
|
"package-core": "webpack --config webpack/package-core.js",
|
|
48
49
|
"package-core:build": "NODE_ENV=production webpack --config webpack/package-core.js --progress",
|
|
49
50
|
"entry": "webpack serve --config webpack/entry.js --no-client-overlay",
|
|
50
51
|
"entry:build": "NODE_ENV=production webpack --config webpack/entry.js --progress",
|
|
51
|
-
"prestart": "mkdir -p
|
|
52
|
+
"prestart": "mkdir -p public/dist && npm run create-empty",
|
|
52
53
|
"start": "npm run test-components & npm run package-core & npm run entry",
|
|
53
54
|
"build": "npm run test-components:build && npm run package-core:build && npm run entry:build",
|
|
54
|
-
"prebuild": "npm run lint && rm -rf dist && rm -rf
|
|
55
|
+
"prebuild": "npm run lint && rm -rf dist && rm -rf public/dist",
|
|
55
56
|
"postbuild": "npm run create-empty",
|
|
56
57
|
"prepublishOnly": "npm run build",
|
|
57
58
|
"cy:run": "rm -rf .nyc_output && cypress run",
|
|
@@ -74,43 +75,47 @@
|
|
|
74
75
|
},
|
|
75
76
|
"homepage": "https://github.com/variousjs/various#readme",
|
|
76
77
|
"devDependencies": {
|
|
77
|
-
"@babel/core": "^7.
|
|
78
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
79
|
-
"@babel/preset-env": "^7.
|
|
80
|
-
"@babel/preset-react": "^7.
|
|
81
|
-
"@babel/preset-typescript": "^7.
|
|
82
|
-
"@babel/runtime": "^7.28.
|
|
83
|
-
"@cypress/code-coverage": "^3.
|
|
84
|
-
"@types/react": "^18.
|
|
85
|
-
"@types/react-dom": "^18.
|
|
78
|
+
"@babel/core": "^7.28.5",
|
|
79
|
+
"@babel/plugin-transform-runtime": "^7.28.5",
|
|
80
|
+
"@babel/preset-env": "^7.28.5",
|
|
81
|
+
"@babel/preset-react": "^7.28.5",
|
|
82
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
83
|
+
"@babel/runtime": "^7.28.4",
|
|
84
|
+
"@cypress/code-coverage": "^3.14.7",
|
|
85
|
+
"@types/react": "^18.2.45",
|
|
86
|
+
"@types/react-dom": "^18.2.18",
|
|
86
87
|
"@types/react-router-dom": "^5.3.3",
|
|
87
88
|
"@types/requirejs": "^2.1.34",
|
|
88
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
89
|
-
"@typescript-eslint/parser": "^
|
|
89
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
90
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
90
91
|
"@vue/compiler-sfc": "^3.5.22",
|
|
91
|
-
"babel-loader": "^
|
|
92
|
-
"babel-plugin-istanbul": "^
|
|
93
|
-
"cypress": "^
|
|
94
|
-
"eslint": "^
|
|
95
|
-
"eslint-config-airbnb": "^
|
|
96
|
-
"eslint-import-resolver-typescript": "^
|
|
97
|
-
"eslint-plugin-cypress": "^2.
|
|
98
|
-
"eslint-plugin-import": "^2.
|
|
99
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
100
|
-
"eslint-plugin-react": "^7.
|
|
92
|
+
"babel-loader": "^10.0.0",
|
|
93
|
+
"babel-plugin-istanbul": "^7.0.1",
|
|
94
|
+
"cypress": "^15.8.1",
|
|
95
|
+
"eslint": "^8.57.0",
|
|
96
|
+
"eslint-config-airbnb": "^19.0.4",
|
|
97
|
+
"eslint-import-resolver-typescript": "^3.6.1",
|
|
98
|
+
"eslint-plugin-cypress": "^2.15.1",
|
|
99
|
+
"eslint-plugin-import": "^2.29.1",
|
|
100
|
+
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
101
|
+
"eslint-plugin-react": "^7.33.2",
|
|
101
102
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
102
103
|
"react": "^18.3.1",
|
|
103
104
|
"react-dom": "^18.3.1",
|
|
104
105
|
"start-server-and-test": "^2.0.3",
|
|
105
|
-
"typescript": "^
|
|
106
|
+
"typescript": "^5.3.3",
|
|
106
107
|
"vue": "^3.5.21",
|
|
107
|
-
"vue-loader": "^17.
|
|
108
|
-
"webpack": "^5.
|
|
109
|
-
"webpack-cli": "^
|
|
110
|
-
"webpack-dev-server": "^
|
|
108
|
+
"vue-loader": "^17.4.2",
|
|
109
|
+
"webpack": "^5.104.1",
|
|
110
|
+
"webpack-cli": "^6.0.1",
|
|
111
|
+
"webpack-dev-server": "^5.2.2"
|
|
111
112
|
},
|
|
112
113
|
"dependencies": {
|
|
113
114
|
"@variousjs/requirejs": "0.0.2",
|
|
114
|
-
"nycticorax": "^4.
|
|
115
|
+
"nycticorax": "^4.2.0"
|
|
116
|
+
},
|
|
117
|
+
"overrides": {
|
|
118
|
+
"qs": "6.14.1",
|
|
119
|
+
"js-yaml": "4.1.1"
|
|
115
120
|
}
|
|
116
121
|
}
|
package/standalone.d.ts
CHANGED
|
@@ -3,10 +3,8 @@ declare module '@variousjs/various/standalone' {
|
|
|
3
3
|
import {
|
|
4
4
|
VariousComponentType,
|
|
5
5
|
ObjectRecord,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
ErrorFallbackNode,
|
|
9
|
-
Dispatch,
|
|
6
|
+
ModuleDef,
|
|
7
|
+
App,
|
|
10
8
|
} from '@variousjs/various'
|
|
11
9
|
|
|
12
10
|
export {
|
|
@@ -17,33 +15,42 @@ declare module '@variousjs/various/standalone' {
|
|
|
17
15
|
|
|
18
16
|
export type DependencyType = string | object | Function
|
|
19
17
|
|
|
20
|
-
export function createComponent<
|
|
21
|
-
|
|
18
|
+
export function createComponent<
|
|
19
|
+
Props extends object = ObjectRecord,
|
|
20
|
+
Ref = unknown,
|
|
21
|
+
Store extends object = ObjectRecord
|
|
22
|
+
>(
|
|
23
|
+
config: {
|
|
24
|
+
module: ModuleDef,
|
|
22
25
|
url: string,
|
|
23
26
|
type?: VariousComponentType,
|
|
24
27
|
dependencies?: Partial<Record<
|
|
25
28
|
string,
|
|
26
29
|
DependencyType
|
|
27
30
|
>>,
|
|
28
|
-
|
|
31
|
+
/**
|
|
32
|
+
* set store keys if component created before store initialization
|
|
33
|
+
*/
|
|
34
|
+
storeKeys?: (keyof Store)[],
|
|
29
35
|
},
|
|
30
|
-
): ComponentType<
|
|
36
|
+
): ComponentType<Props & {
|
|
31
37
|
/**
|
|
32
38
|
* for React Component only
|
|
33
39
|
*/
|
|
34
|
-
$ref?: RefObject<
|
|
40
|
+
$ref?: RefObject<Ref>,
|
|
35
41
|
}>
|
|
36
42
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
export type AppConfig<Store extends object = ObjectRecord> = Pick<
|
|
44
|
+
App<Store>,
|
|
45
|
+
'actions' | 'store' | 'Fallback' | 'ErrorFallback'
|
|
46
|
+
> & {
|
|
47
|
+
dependencies: Partial<Record<
|
|
48
|
+
string,
|
|
49
|
+
DependencyType
|
|
50
|
+
>>
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function createAppConfig<Store extends object = ObjectRecord>(
|
|
54
|
+
config: AppConfig<Store>
|
|
48
55
|
): void
|
|
49
56
|
}
|