@micro-zoe/micro-app 1.0.0-rc.2 → 1.0.0-rc.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micro-zoe/micro-app",
3
- "version": "1.0.0-rc.2",
3
+ "version": "1.0.0-rc.4",
4
4
  "description": "A lightweight, efficient and powerful micro front-end framework",
5
5
  "private": false,
6
6
  "main": "lib/index.min.js",
@@ -65,28 +65,26 @@ declare module '@micro-app/types' {
65
65
  destroy?: boolean,
66
66
  }
67
67
 
68
- interface SandBoxAdapter {
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
- escapeSetterKeyList: PropertyKey[]
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>
87
+ interface WithSandBoxInterface extends BaseSandboxType {
90
88
  // proxy(microWindow)
91
89
  proxyWindow: WindowProxy
92
90
  // child window
@@ -108,6 +106,7 @@ declare module '@micro-app/types' {
108
106
  patchStaticElement (container: Element | ShadowRoot): void
109
107
  actionBeforeExecScripts (container: Element | ShadowRoot): void
110
108
  deleteIframeElement? (): void
109
+ setStaticAppState (state: string): void
111
110
  }
112
111
 
113
112
  type LinkSourceInfo = {
@@ -153,6 +152,15 @@ declare module '@micro-app/types' {
153
152
  // hiddenRouter: boolean
154
153
  }
155
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
+
156
164
  interface UnmountParam {
157
165
  destroy: boolean, // completely destroy, delete cache resources
158
166
  clearData: boolean // clear data of dateCenter
@@ -187,7 +195,7 @@ declare module '@micro-app/types' {
187
195
  loadSourceCode (): void
188
196
 
189
197
  // resource is loaded
190
- onLoad (html: HTMLElement, defaultPage?: string, disablePatchRequest?: boolean): void
198
+ onLoad (onLoadParam: OnLoadParam): void
191
199
 
192
200
  // Error loading HTML
193
201
  onLoadError (e: Error): void
@@ -210,6 +218,8 @@ declare module '@micro-app/types' {
210
218
  // get keep-alive state
211
219
  getKeepAliveState(): string | null
212
220
 
221
+ parseHtmlString(htmlString: string): HTMLElement
222
+
213
223
  // is app unmounted
214
224
  isUnmounted (): boolean
215
225
 
@@ -224,6 +234,9 @@ declare module '@micro-app/types' {
224
234
 
225
235
  // show app when connectedCallback with keep-alive
226
236
  showKeepAliveApp (container: HTMLElement | ShadowRoot): void
237
+
238
+ // get app lifecycle state
239
+ getLifeCycleState (): string
227
240
  }
228
241
 
229
242
  interface prefetchParam {
@@ -238,9 +251,9 @@ declare module '@micro-app/types' {
238
251
  inline?: boolean
239
252
  iframe?: boolean
240
253
  level?: number
254
+ // prerender only 👇
241
255
  'default-page'?: string
242
256
  'disable-patch-request'?: boolean
243
- // prerender only 👇
244
257
  'router-mode'?: string
245
258
  baseroute?: string
246
259
  // prerender only 👆
@@ -338,6 +351,7 @@ declare module '@micro-app/types' {
338
351
  fiber?: boolean
339
352
  prefetchLevel?: number
340
353
  prefetchDelay?: number
354
+ iframeSrc?: string
341
355
  }
342
356
 
343
357
  interface OptionsType extends MicroAppConfig {
@@ -374,13 +388,6 @@ declare module '@micro-app/types' {
374
388
 
375
389
  // Hooks for element attributes change
376
390
  attributeChangedCallback (a: 'name' | 'url', o: string, n: string): void
377
-
378
- /**
379
- * Get configuration
380
- * Global setting is lowest priority
381
- * @param name Configuration item name
382
- */
383
- getDisposeResult <T extends keyof OptionsType> (name: T): boolean
384
391
  }
385
392
 
386
393
  // special CallableFunction for interact
@@ -391,6 +398,7 @@ declare module '@micro-app/types' {
391
398
 
392
399
  interface MicroLocation extends Location, URL {
393
400
  fullPath: string
401
+ self: URL | Location
394
402
  [key: string]: any
395
403
  }
396
404
 
@@ -434,7 +442,7 @@ declare module '@micro-app/types' {
434
442
  replace?: boolean
435
443
  }
436
444
 
437
- type navigationMethod = (to: RouterTarget) => void
445
+ type navigationMethod = (to: RouterTarget) => Promise<void>
438
446
 
439
447
  interface AccurateGuard {
440
448
  [appName: string]: (to: GuardLocation, from: GuardLocation) => void