@micro-zoe/micro-app 1.0.0-rc.0 → 1.0.0-rc.10
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 +46 -12
- package/lib/index.esm.js +1860 -952
- 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 +4 -1
- package/typings/global.d.ts +60 -46
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<a href="https://micro-zoe.github.io/micro-app/">
|
|
3
|
-
<img src="https://
|
|
3
|
+
<img src="https://micro-zoe.github.io/micro-app/home/assets/logo.png" alt="logo" width="200"/>
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
|
package/lib/index.d.ts
CHANGED
|
@@ -110,7 +110,7 @@ declare module '@micro-zoe/micro-app/prefetch' {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
declare module '@micro-zoe/micro-app/libs/utils' {
|
|
113
|
-
import { Func, LocationQueryObject, MicroLocation, AttrsType, fiberTasks, MicroAppElementTagNameMap } from '@micro-app/types';
|
|
113
|
+
import { Func, LocationQueryObject, MicroLocation, AttrsType, fiberTasks, MicroAppElementTagNameMap, MicroAppElementInterface } from '@micro-app/types';
|
|
114
114
|
export const version = "__MICRO_APP_VERSION__";
|
|
115
115
|
export const isBrowser: boolean;
|
|
116
116
|
export const globalThis: any;
|
|
@@ -125,7 +125,9 @@ declare module '@micro-zoe/micro-app/libs/utils' {
|
|
|
125
125
|
};
|
|
126
126
|
export const rawDefineProperty: (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType<any>) => any;
|
|
127
127
|
export const rawDefineProperties: (o: any, properties: PropertyDescriptorMap & ThisType<any>) => any;
|
|
128
|
+
export const rawToString: () => string;
|
|
128
129
|
export const rawHasOwnProperty: (v: string | number | symbol) => boolean;
|
|
130
|
+
export const toTypeString: (value: unknown) => string;
|
|
129
131
|
export function isUndefined(target: unknown): target is undefined;
|
|
130
132
|
export function isNull(target: unknown): target is null;
|
|
131
133
|
export function isString(target: unknown): target is string;
|
|
@@ -141,6 +143,10 @@ declare module '@micro-zoe/micro-app/libs/utils' {
|
|
|
141
143
|
export function isURL(target: unknown): target is URL;
|
|
142
144
|
export function isElement(target: unknown): target is Element;
|
|
143
145
|
export function isNode(target: unknown): target is Node;
|
|
146
|
+
export function isCanvasElement(target: unknown): target is HTMLCanvasElement;
|
|
147
|
+
export function isAnchorElement(target: unknown): target is HTMLAnchorElement;
|
|
148
|
+
export function isAudioElement(target: unknown): target is HTMLAudioElement;
|
|
149
|
+
export function isVideoElement(target: unknown): target is HTMLVideoElement;
|
|
144
150
|
export function isLinkElement(target: unknown): target is HTMLLinkElement;
|
|
145
151
|
export function isStyleElement(target: unknown): target is HTMLStyleElement;
|
|
146
152
|
export function isScriptElement(target: unknown): target is HTMLScriptElement;
|
|
@@ -148,8 +154,12 @@ declare module '@micro-zoe/micro-app/libs/utils' {
|
|
|
148
154
|
export function isDivElement(target: unknown): target is HTMLDivElement;
|
|
149
155
|
export function isImageElement(target: unknown): target is HTMLImageElement;
|
|
150
156
|
export function isBaseElement(target: unknown): target is HTMLBaseElement;
|
|
157
|
+
export function isDocumentFragment(target: unknown): target is DocumentFragment;
|
|
151
158
|
export function isMicroAppBody(target: unknown): target is HTMLElement;
|
|
159
|
+
export function isMicroAppHead(target: unknown): target is HTMLElement;
|
|
152
160
|
export function isProxyDocument(target: unknown): target is Document;
|
|
161
|
+
export function isTargetExtension(path: string, suffix: string): boolean;
|
|
162
|
+
export function includes(target: unknown[], searchElement: unknown, fromIndex?: number): boolean;
|
|
153
163
|
/**
|
|
154
164
|
* format error log
|
|
155
165
|
* @param msg message
|
|
@@ -168,6 +178,12 @@ declare module '@micro-zoe/micro-app/libs/utils' {
|
|
|
168
178
|
* @param args params
|
|
169
179
|
*/
|
|
170
180
|
export function defer(fn: Func, ...args: unknown[]): void;
|
|
181
|
+
/**
|
|
182
|
+
* async execution with macro task
|
|
183
|
+
* @param fn callback
|
|
184
|
+
* @param args params
|
|
185
|
+
*/
|
|
186
|
+
export function macro(fn: Func, delay?: number, ...args: unknown[]): void;
|
|
171
187
|
/**
|
|
172
188
|
* create URL as MicroLocation
|
|
173
189
|
*/
|
|
@@ -196,7 +212,9 @@ declare module '@micro-zoe/micro-app/libs/utils' {
|
|
|
196
212
|
*/
|
|
197
213
|
export function formatAppName(name: string | null): string;
|
|
198
214
|
/**
|
|
199
|
-
* Get valid address, such as
|
|
215
|
+
* Get valid address, such as
|
|
216
|
+
* 1. https://domain/xx/xx.html to https://domain/xx/
|
|
217
|
+
* 2. https://domain/xx to https://domain/xx/
|
|
200
218
|
* @param url app.url
|
|
201
219
|
*/
|
|
202
220
|
export function getEffectivePath(url: string): string;
|
|
@@ -230,28 +248,33 @@ declare module '@micro-zoe/micro-app/libs/utils' {
|
|
|
230
248
|
*/
|
|
231
249
|
export function promiseRequestIdle(callback: CallableFunction): Promise<void>;
|
|
232
250
|
export function setCurrentAppName(appName: string | null): void;
|
|
233
|
-
export function throttleDeferForSetAppName(appName: string): void;
|
|
234
251
|
export function getCurrentAppName(): string | null;
|
|
235
|
-
export function
|
|
252
|
+
export function throttleDeferForSetAppName(appName: string): void;
|
|
253
|
+
export function setIframeCurrentAppName(appName: string | null): void;
|
|
254
|
+
export function getIframeCurrentAppName(): string | null;
|
|
255
|
+
export function throttleDeferForIframeAppName(appName: string): void;
|
|
256
|
+
export function getPreventSetState(): boolean;
|
|
257
|
+
/**
|
|
258
|
+
* prevent set appName
|
|
259
|
+
* usage:
|
|
260
|
+
* removeDomScope(true)
|
|
261
|
+
* -----> element scope point to base app <-----
|
|
262
|
+
* removeDomScope(false)
|
|
263
|
+
*/
|
|
264
|
+
export function removeDomScope(force?: boolean): void;
|
|
236
265
|
export function isSafari(): boolean;
|
|
237
266
|
/**
|
|
238
267
|
* Create pure elements
|
|
239
268
|
*/
|
|
240
269
|
export function pureCreateElement<K extends keyof MicroAppElementTagNameMap>(tagName: K, options?: ElementCreationOptions): MicroAppElementTagNameMap[K];
|
|
241
|
-
/**
|
|
242
|
-
* clone origin elements to target
|
|
243
|
-
* @param origin Cloned element
|
|
244
|
-
* @param target Accept cloned elements
|
|
245
|
-
* @param deep deep clone or transfer dom
|
|
246
|
-
*/
|
|
247
|
-
export function cloneContainer<T extends Element | ShadowRoot, Q extends Element | ShadowRoot>(target: Q, origin: T, deep: boolean): Q;
|
|
248
270
|
export function isInvalidQuerySelectorKey(key: string): boolean;
|
|
249
271
|
export function isUniqueElement(key: string): boolean;
|
|
272
|
+
export type RootContainer = HTMLElement & MicroAppElementInterface;
|
|
250
273
|
/**
|
|
251
274
|
* get micro-app element
|
|
252
275
|
* @param target app container
|
|
253
276
|
*/
|
|
254
|
-
export function getRootContainer(target: HTMLElement | ShadowRoot):
|
|
277
|
+
export function getRootContainer(target: HTMLElement | ShadowRoot): RootContainer;
|
|
255
278
|
/**
|
|
256
279
|
* trim start & end
|
|
257
280
|
*/
|
|
@@ -309,7 +332,18 @@ declare module '@micro-zoe/micro-app/libs/utils' {
|
|
|
309
332
|
* @param args arguments
|
|
310
333
|
*/
|
|
311
334
|
export function execMicroAppGlobalHook(fn: Func | null, appName: string, hookName: string, ...args: unknown[]): void;
|
|
335
|
+
/**
|
|
336
|
+
* remove all childNode from target node
|
|
337
|
+
* @param $dom target node
|
|
338
|
+
*/
|
|
312
339
|
export function clearDOM($dom: HTMLElement | ShadowRoot | Document): void;
|
|
340
|
+
export function instanceOf<T extends new (...args: unknown[]) => unknown>(instance: unknown, constructor: T): instance is T extends new (...args: unknown[]) => infer R ? R : boolean;
|
|
341
|
+
export function formatEventType(type: string, appName: string): string;
|
|
342
|
+
/**
|
|
343
|
+
* Is the object empty
|
|
344
|
+
* target maybe number, string, array ...
|
|
345
|
+
*/
|
|
346
|
+
export function isEmptyObject(target: unknown): boolean;
|
|
313
347
|
}
|
|
314
348
|
|
|
315
349
|
declare module '@micro-zoe/micro-app/interact' {
|