@micro-zoe/micro-app 1.0.0-rc.5 → 1.0.0-rc.7
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 +1 -1
- package/lib/index.d.ts +29 -20
- package/lib/index.esm.js +967 -574
- 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 +2 -1
- package/typings/global.d.ts +21 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micro-zoe/micro-app",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.7",
|
|
4
4
|
"description": "A lightweight, efficient and powerful micro front-end framework",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "lib/index.min.js",
|
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
"@rollup/plugin-babel": "~5.2.2",
|
|
97
97
|
"@rollup/plugin-node-resolve": "~11.0.1",
|
|
98
98
|
"@rollup/plugin-replace": "~2.4.1",
|
|
99
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
99
100
|
"@rollup/plugin-typescript": "~8.1.0",
|
|
100
101
|
"@types/jest": "~26.0.24",
|
|
101
102
|
"@types/node": "~14.14.19",
|
package/typings/global.d.ts
CHANGED
|
@@ -82,6 +82,8 @@ declare module '@micro-app/types' {
|
|
|
82
82
|
staticEscapeProperties: PropertyKey[]
|
|
83
83
|
// Variables that scoped in child app
|
|
84
84
|
staticScopeProperties: PropertyKey[]
|
|
85
|
+
// clear mount, unmount when stop in default mode
|
|
86
|
+
clearHijackUmdHooks: () => void
|
|
85
87
|
}
|
|
86
88
|
|
|
87
89
|
interface WithSandBoxInterface extends BaseSandboxType {
|
|
@@ -104,7 +106,7 @@ declare module '@micro-app/types' {
|
|
|
104
106
|
setPreRenderState (state: boolean): void
|
|
105
107
|
markUmdMode(state: boolean): void
|
|
106
108
|
patchStaticElement (container: Element | ShadowRoot): void
|
|
107
|
-
|
|
109
|
+
actionsBeforeExecScripts (container: Element | ShadowRoot, handleUmdHooks: Func): void
|
|
108
110
|
deleteIframeElement? (): void
|
|
109
111
|
setStaticAppState (state: string): void
|
|
110
112
|
}
|
|
@@ -169,7 +171,7 @@ declare module '@micro-app/types' {
|
|
|
169
171
|
}
|
|
170
172
|
|
|
171
173
|
// app instance
|
|
172
|
-
interface AppInterface extends Pick<
|
|
174
|
+
interface AppInterface extends Pick<Element, 'querySelector' | 'querySelectorAll'> {
|
|
173
175
|
source: sourceType // source list
|
|
174
176
|
// TODO: 去掉any
|
|
175
177
|
sandBox: WithSandBoxInterface | null | any // sandbox
|
|
@@ -234,9 +236,6 @@ declare module '@micro-app/types' {
|
|
|
234
236
|
|
|
235
237
|
// show app when connectedCallback with keep-alive
|
|
236
238
|
showKeepAliveApp (container: HTMLElement | ShadowRoot): void
|
|
237
|
-
|
|
238
|
-
// get app lifecycle state
|
|
239
|
-
getLifeCycleState (): string
|
|
240
239
|
}
|
|
241
240
|
|
|
242
241
|
interface prefetchParam {
|
|
@@ -342,10 +341,10 @@ declare module '@micro-app/types' {
|
|
|
342
341
|
'disable-memory-router'?: boolean
|
|
343
342
|
'disable-patch-request'?: boolean
|
|
344
343
|
'keep-router-state'?: boolean
|
|
345
|
-
'hidden-router'?: boolean
|
|
346
344
|
'keep-alive'?: boolean
|
|
347
345
|
'clear-data'?: boolean
|
|
348
346
|
'router-mode'?: string
|
|
347
|
+
'router-event-delay'?: number | ((appName: string) => number),
|
|
349
348
|
iframe?: boolean
|
|
350
349
|
ssr?: boolean
|
|
351
350
|
fiber?: boolean
|
|
@@ -376,18 +375,25 @@ declare module '@micro-app/types' {
|
|
|
376
375
|
start(options?: OptionsType): void
|
|
377
376
|
}
|
|
378
377
|
|
|
379
|
-
interface
|
|
378
|
+
interface MicroAppElementInterface {
|
|
380
379
|
appName: AttrType // app name
|
|
381
380
|
appUrl: AttrType // app url
|
|
382
|
-
|
|
383
381
|
// Hooks for element append to documents
|
|
384
382
|
connectedCallback (): void
|
|
385
|
-
|
|
386
383
|
// Hooks for element delete from documents
|
|
387
384
|
disconnectedCallback (): void
|
|
388
|
-
|
|
389
385
|
// Hooks for element attributes change
|
|
390
386
|
attributeChangedCallback (a: 'name' | 'url', o: string, n: string): void
|
|
387
|
+
// public mount action for micro_app_element & create_app
|
|
388
|
+
mount (app: AppInterface): void
|
|
389
|
+
// unmount app
|
|
390
|
+
unmount (destroy?: boolean, unmountcb?: CallableFunction): void
|
|
391
|
+
// Re render app from the command line
|
|
392
|
+
reload (destroy?: boolean): Promise<boolean>
|
|
393
|
+
// get delay time of router event
|
|
394
|
+
getRouterEventDelay (): number
|
|
395
|
+
// rewrite micro-app.setAttribute, process attr data
|
|
396
|
+
setAttribute (key: string, value: any): void
|
|
391
397
|
}
|
|
392
398
|
|
|
393
399
|
// special CallableFunction for interact
|
|
@@ -404,6 +410,11 @@ declare module '@micro-app/types' {
|
|
|
404
410
|
|
|
405
411
|
type MicroHistory = ProxyHandler<History>
|
|
406
412
|
type MicroState = any
|
|
413
|
+
interface MicroRouterInfoState {
|
|
414
|
+
fullPath: string | null,
|
|
415
|
+
state: MicroState,
|
|
416
|
+
mode: string,
|
|
417
|
+
}
|
|
407
418
|
type HistoryProxyValue =
|
|
408
419
|
Pick<
|
|
409
420
|
History,
|
|
@@ -554,12 +565,6 @@ declare module '@micro-app/types' {
|
|
|
554
565
|
}
|
|
555
566
|
}
|
|
556
567
|
|
|
557
|
-
declare namespace JSX {
|
|
558
|
-
interface IntrinsicElements {
|
|
559
|
-
'micro-app': any
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
|
|
563
568
|
declare module '@micro-zoe/micro-app/polyfill/jsx-custom-event'
|
|
564
569
|
|
|
565
570
|
declare const __DEV__: boolean
|