@micro-zoe/micro-app 1.0.0-rc.3 → 1.0.0-rc.5
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/lib/index.d.ts +8 -10
- package/lib/index.esm.js +759 -496
- package/lib/index.esm.js.map +1 -1
- package/lib/index.min.js +1 -1
- package/lib/index.min.js.map +1 -1
- package/lib/index.umd.js +1 -1
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/typings/global.d.ts +36 -34
package/package.json
CHANGED
package/typings/global.d.ts
CHANGED
|
@@ -65,30 +65,26 @@ declare module '@micro-app/types' {
|
|
|
65
65
|
destroy?: boolean,
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
interface
|
|
68
|
+
interface BaseSandboxType {
|
|
69
|
+
// Properties that can only get and set in microAppWindow, will not escape to rawWindow
|
|
70
|
+
scopeProperties: PropertyKey[]
|
|
71
|
+
// Properties that can be escape to rawWindow
|
|
72
|
+
escapeProperties: PropertyKey[]
|
|
73
|
+
// Properties newly added to microAppWindow
|
|
74
|
+
injectedKeys: Set<PropertyKey>
|
|
75
|
+
// Properties escape to rawWindow, cleared when unmount
|
|
76
|
+
escapeKeys: Set<PropertyKey>
|
|
77
|
+
// Sandbox ready state
|
|
78
|
+
sandboxReady: Promise<void>
|
|
69
79
|
// Variables that can only assigned to rawWindow
|
|
70
|
-
|
|
71
|
-
|
|
80
|
+
rawWindowScopeKeyList: PropertyKey[]
|
|
72
81
|
// Variables that can escape to rawWindow
|
|
73
82
|
staticEscapeProperties: PropertyKey[]
|
|
74
|
-
|
|
75
83
|
// Variables that scoped in child app
|
|
76
84
|
staticScopeProperties: PropertyKey[]
|
|
77
85
|
}
|
|
78
86
|
|
|
79
|
-
interface WithSandBoxInterface {
|
|
80
|
-
// adapter for sandbox
|
|
81
|
-
adapter: SandBoxAdapter
|
|
82
|
-
// Scoped global Properties(Properties that can only get and set in microAppWindow, will not escape to rawWindow)
|
|
83
|
-
scopeProperties: PropertyKey[]
|
|
84
|
-
// Properties that can be escape to rawWindow
|
|
85
|
-
escapeProperties: PropertyKey[]
|
|
86
|
-
// Properties escape to rawWindow, cleared when unmount
|
|
87
|
-
escapeKeys: Set<PropertyKey>
|
|
88
|
-
// Properties newly added to microAppWindow
|
|
89
|
-
injectedKeys: Set<PropertyKey>
|
|
90
|
-
// sandbox ready state
|
|
91
|
-
sandboxReady: Promise<void>
|
|
87
|
+
interface WithSandBoxInterface extends BaseSandboxType {
|
|
92
88
|
// proxy(microWindow)
|
|
93
89
|
proxyWindow: WindowProxy
|
|
94
90
|
// child window
|
|
@@ -156,6 +152,15 @@ declare module '@micro-app/types' {
|
|
|
156
152
|
// hiddenRouter: boolean
|
|
157
153
|
}
|
|
158
154
|
|
|
155
|
+
interface OnLoadParam {
|
|
156
|
+
html: HTMLElement,
|
|
157
|
+
// below params is only for prerender app
|
|
158
|
+
defaultPage?: string // default page of virtual router
|
|
159
|
+
routerMode?: string // virtual router mode
|
|
160
|
+
baseroute?: string // route prefix, default is ''
|
|
161
|
+
disablePatchRequest?: boolean // prevent rewrite request method of child app
|
|
162
|
+
}
|
|
163
|
+
|
|
159
164
|
interface UnmountParam {
|
|
160
165
|
destroy: boolean, // completely destroy, delete cache resources
|
|
161
166
|
clearData: boolean // clear data of dateCenter
|
|
@@ -190,7 +195,7 @@ declare module '@micro-app/types' {
|
|
|
190
195
|
loadSourceCode (): void
|
|
191
196
|
|
|
192
197
|
// resource is loaded
|
|
193
|
-
onLoad (
|
|
198
|
+
onLoad (onLoadParam: OnLoadParam): void
|
|
194
199
|
|
|
195
200
|
// Error loading HTML
|
|
196
201
|
onLoadError (e: Error): void
|
|
@@ -213,6 +218,8 @@ declare module '@micro-app/types' {
|
|
|
213
218
|
// get keep-alive state
|
|
214
219
|
getKeepAliveState(): string | null
|
|
215
220
|
|
|
221
|
+
parseHtmlString(htmlString: string): HTMLElement
|
|
222
|
+
|
|
216
223
|
// is app unmounted
|
|
217
224
|
isUnmounted (): boolean
|
|
218
225
|
|
|
@@ -244,9 +251,9 @@ declare module '@micro-app/types' {
|
|
|
244
251
|
inline?: boolean
|
|
245
252
|
iframe?: boolean
|
|
246
253
|
level?: number
|
|
254
|
+
// prerender only 👇
|
|
247
255
|
'default-page'?: string
|
|
248
256
|
'disable-patch-request'?: boolean
|
|
249
|
-
// prerender only 👇
|
|
250
257
|
'router-mode'?: string
|
|
251
258
|
baseroute?: string
|
|
252
259
|
// prerender only 👆
|
|
@@ -257,14 +264,14 @@ declare module '@micro-app/types' {
|
|
|
257
264
|
|
|
258
265
|
// lifeCycles
|
|
259
266
|
interface lifeCyclesType {
|
|
260
|
-
created?(e: CustomEvent): void
|
|
261
|
-
beforemount?(e: CustomEvent): void
|
|
262
|
-
mounted?(e: CustomEvent): void
|
|
263
|
-
unmount?(e: CustomEvent): void
|
|
264
|
-
error?(e: CustomEvent): void
|
|
265
|
-
beforeshow?(e: CustomEvent): void
|
|
266
|
-
aftershow?(e: CustomEvent): void
|
|
267
|
-
afterhidden?(e: CustomEvent): void
|
|
267
|
+
created?(e: CustomEvent, appName: string): void
|
|
268
|
+
beforemount?(e: CustomEvent, appName: string): void
|
|
269
|
+
mounted?(e: CustomEvent, appName: string): void
|
|
270
|
+
unmount?(e: CustomEvent, appName: string): void
|
|
271
|
+
error?(e: CustomEvent, appName: string): void
|
|
272
|
+
beforeshow?(e: CustomEvent, appName: string): void
|
|
273
|
+
aftershow?(e: CustomEvent, appName: string): void
|
|
274
|
+
afterhidden?(e: CustomEvent, appName: string): void
|
|
268
275
|
}
|
|
269
276
|
|
|
270
277
|
type AssetsChecker = (url: string) => boolean;
|
|
@@ -344,6 +351,7 @@ declare module '@micro-app/types' {
|
|
|
344
351
|
fiber?: boolean
|
|
345
352
|
prefetchLevel?: number
|
|
346
353
|
prefetchDelay?: number
|
|
354
|
+
iframeSrc?: string
|
|
347
355
|
}
|
|
348
356
|
|
|
349
357
|
interface OptionsType extends MicroAppConfig {
|
|
@@ -380,13 +388,6 @@ declare module '@micro-app/types' {
|
|
|
380
388
|
|
|
381
389
|
// Hooks for element attributes change
|
|
382
390
|
attributeChangedCallback (a: 'name' | 'url', o: string, n: string): void
|
|
383
|
-
|
|
384
|
-
/**
|
|
385
|
-
* Get configuration
|
|
386
|
-
* Global setting is lowest priority
|
|
387
|
-
* @param name Configuration item name
|
|
388
|
-
*/
|
|
389
|
-
getDisposeResult <T extends keyof OptionsType> (name: T): boolean
|
|
390
391
|
}
|
|
391
392
|
|
|
392
393
|
// special CallableFunction for interact
|
|
@@ -397,6 +398,7 @@ declare module '@micro-app/types' {
|
|
|
397
398
|
|
|
398
399
|
interface MicroLocation extends Location, URL {
|
|
399
400
|
fullPath: string
|
|
401
|
+
self: URL | Location
|
|
400
402
|
[key: string]: any
|
|
401
403
|
}
|
|
402
404
|
|