@micro-zoe/micro-app
Advanced tools
Comparing version 1.0.0-rc.5 to 1.0.0-rc.6
@@ -7,3 +7,3 @@ /// <reference path="../typings/global.d.ts" /> | ||
declare module '@micro-zoe/micro-app' { | ||
export { default, MicroApp, getActiveApps, getAllApps, unmountApp, unmountAllApps, reload, renderApp, getAppStatus } from '@micro-zoe/micro-app/micro_app'; | ||
export { default, MicroApp, getActiveApps, getAllApps, unmountApp, unmountAllApps, reload, renderApp, } from '@micro-zoe/micro-app/micro_app'; | ||
export { default as preFetch, } from '@micro-zoe/micro-app/prefetch'; | ||
@@ -64,8 +64,2 @@ export { removeDomScope, pureCreateElement, version, } from '@micro-zoe/micro-app/libs/utils'; | ||
export function renderApp(options: RenderAppOptions): Promise<boolean>; | ||
/** | ||
* get app state | ||
* @param appName app.name | ||
* @returns app.state | ||
*/ | ||
export function getAppStatus(appName: string): string | void; | ||
export class MicroApp extends EventCenterForBaseApp implements MicroAppBaseType { | ||
@@ -83,3 +77,2 @@ tagName: string; | ||
renderApp: typeof renderApp; | ||
getAppStatus: typeof getAppStatus; | ||
start(options?: OptionsType): void; | ||
@@ -123,3 +116,3 @@ } | ||
declare module '@micro-zoe/micro-app/libs/utils' { | ||
import { Func, LocationQueryObject, MicroLocation, AttrsType, fiberTasks, MicroAppElementTagNameMap } from '@micro-app/types'; | ||
import { Func, LocationQueryObject, MicroLocation, AttrsType, fiberTasks, MicroAppElementTagNameMap, MicroAppElementInterface } from '@micro-app/types'; | ||
export const version = "__MICRO_APP_VERSION__"; | ||
@@ -164,3 +157,5 @@ export const isBrowser: boolean; | ||
export function isBaseElement(target: unknown): target is HTMLBaseElement; | ||
export function isDocumentFragment(target: unknown): target is DocumentFragment; | ||
export function isMicroAppBody(target: unknown): target is HTMLElement; | ||
export function isMicroAppHead(target: unknown): target is HTMLElement; | ||
export function isProxyDocument(target: unknown): target is Document; | ||
@@ -188,2 +183,8 @@ export function isTargetExtension(path: string, suffix: string): boolean; | ||
/** | ||
* async execution with macro task | ||
* @param fn callback | ||
* @param args params | ||
*/ | ||
export function macro(fn: Func, delay?: number, ...args: unknown[]): void; | ||
/** | ||
* create URL as MicroLocation | ||
@@ -253,4 +254,15 @@ */ | ||
export function getCurrentAppName(): string | null; | ||
export function throttleDeferForSetAppName(appName: string): void; | ||
export function setIframeCurrentAppName(appName: string | null): void; | ||
export function getIframeCurrentAppName(): string | null; | ||
export function throttleDeferForIframeAppName(appName: string): void; | ||
export function getPreventSetState(): boolean; | ||
/** | ||
* prevent set appName | ||
* usage: | ||
* removeDomScope(true) | ||
* -----> element scope point to base app <----- | ||
* removeDomScope(false) | ||
*/ | ||
export function removeDomScope(force?: boolean): void; | ||
export function throttleDeferForSetAppName(appName: string): void; | ||
export function isSafari(): boolean; | ||
@@ -263,2 +275,3 @@ /** | ||
export function isUniqueElement(key: string): boolean; | ||
export type RootContainer = HTMLElement & MicroAppElementInterface; | ||
/** | ||
@@ -268,3 +281,3 @@ * get micro-app element | ||
*/ | ||
export function getRootContainer(target: HTMLElement | ShadowRoot): HTMLElement; | ||
export function getRootContainer(target: HTMLElement | ShadowRoot): RootContainer; | ||
/** | ||
@@ -332,13 +345,9 @@ * trim start & end | ||
export function clearDOM($dom: HTMLElement | ShadowRoot | Document): void; | ||
type BaseHTMLElementType = HTMLElement & { | ||
new (): HTMLElement; | ||
prototype: HTMLElement; | ||
}; | ||
export function instanceOf<T extends new (...args: unknown[]) => unknown>(instance: unknown, constructor: T): instance is T extends new (...args: unknown[]) => infer R ? R : boolean; | ||
export function formatEventType(type: string, appName: string): string; | ||
/** | ||
* get HTMLElement from base app | ||
* @returns HTMLElement | ||
* Is the object empty | ||
* target maybe number, string, array ... | ||
*/ | ||
export function getBaseHTMLElement(): BaseHTMLElementType; | ||
export function formatEventType(type: string, appName: string): string; | ||
export {}; | ||
export function isEmptyObject(target: unknown): boolean; | ||
} | ||
@@ -345,0 +354,0 @@ |
{ | ||
"name": "@micro-zoe/micro-app", | ||
"version": "1.0.0-rc.5", | ||
"version": "1.0.0-rc.6", | ||
"description": "A lightweight, efficient and powerful micro front-end framework", | ||
@@ -99,2 +99,3 @@ "private": false, | ||
"@rollup/plugin-replace": "~2.4.1", | ||
"@rollup/plugin-terser": "^0.4.4", | ||
"@rollup/plugin-typescript": "~8.1.0", | ||
@@ -101,0 +102,0 @@ "@types/jest": "~26.0.24", |
<p align="center"> | ||
<a href="https://micro-zoe.github.io/micro-app/"> | ||
<img src="https://zeroing.jd.com/micro-app/media/logo.png" alt="logo" width="200"/> | ||
<img src="https://micro-zoe.github.io/micro-app/home/assets/logo.png" alt="logo" width="200"/> | ||
</a> | ||
@@ -5,0 +5,0 @@ </p> |
@@ -85,2 +85,4 @@ declare module '@micro-app/types' { | ||
staticScopeProperties: PropertyKey[] | ||
// clear mount, unmount when stop in default mode | ||
clearHijackUmdHooks: () => void | ||
} | ||
@@ -108,3 +110,3 @@ | ||
patchStaticElement (container: Element | ShadowRoot): void | ||
actionBeforeExecScripts (container: Element | ShadowRoot): void | ||
actionsBeforeExecScripts (container: Element | ShadowRoot, handleUmdHooks: Func): void | ||
deleteIframeElement? (): void | ||
@@ -174,3 +176,3 @@ setStaticAppState (state: string): void | ||
// app instance | ||
interface AppInterface extends Pick<ParentNode, 'querySelector' | 'querySelectorAll'> { | ||
interface AppInterface extends Pick<Element, 'querySelector' | 'querySelectorAll'> { | ||
source: sourceType // source list | ||
@@ -240,5 +242,2 @@ // TODO: 去掉any | ||
showKeepAliveApp (container: HTMLElement | ShadowRoot): void | ||
// get app lifecycle state | ||
getLifeCycleState (): string | ||
} | ||
@@ -349,6 +348,6 @@ | ||
'keep-router-state'?: boolean | ||
'hidden-router'?: boolean | ||
'keep-alive'?: boolean | ||
'clear-data'?: boolean | ||
'router-mode'?: string | ||
'router-event-delay'?: number | ((appName: string) => number), | ||
iframe?: boolean | ||
@@ -384,14 +383,21 @@ ssr?: boolean | ||
interface MicroAppElementType { | ||
interface MicroAppElementInterface { | ||
appName: AttrType // app name | ||
appUrl: AttrType // app url | ||
// Hooks for element append to documents | ||
connectedCallback (): void | ||
// Hooks for element delete from documents | ||
disconnectedCallback (): void | ||
// Hooks for element attributes change | ||
attributeChangedCallback (a: 'name' | 'url', o: string, n: string): void | ||
// public mount action for micro_app_element & create_app | ||
mount (app: AppInterface): void | ||
// unmount app | ||
unmount (destroy?: boolean, unmountcb?: CallableFunction): void | ||
// Re render app from the command line | ||
reload (destroy?: boolean): Promise<boolean> | ||
// get delay time of router event | ||
getRouterEventDelay (): number | ||
// rewrite micro-app.setAttribute, process attr data | ||
setAttribute (key: string, value: any): void | ||
} | ||
@@ -413,2 +419,7 @@ | ||
type MicroState = any | ||
interface MicroRouterInfoState { | ||
fullPath: string | null, | ||
state: MicroState, | ||
mode: string, | ||
} | ||
type HistoryProxyValue = | ||
@@ -564,8 +575,2 @@ Pick< | ||
declare namespace JSX { | ||
interface IntrinsicElements { | ||
'micro-app': any | ||
} | ||
} | ||
declare module '@micro-zoe/micro-app/polyfill/jsx-custom-event' | ||
@@ -572,0 +577,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2336394
10958
44