@tarojs/runtime 3.3.14 → 3.5.0-canary.0
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/dist/bom/raf.d.ts +1 -2
- package/dist/bom/window.d.ts +1 -18
- package/dist/constants/identifiers.d.ts +32 -0
- package/dist/constants/index.d.ts +7 -0
- package/dist/container/default-hooks.d.ts +2 -0
- package/dist/container/store.d.ts +15 -0
- package/dist/dom/document.d.ts +2 -5
- package/dist/dom/element.d.ts +4 -7
- package/dist/dom/event-target.d.ts +1 -2
- package/dist/dom/node.d.ts +3 -9
- package/dist/dom/root.d.ts +2 -9
- package/dist/dom/text.d.ts +5 -5
- package/dist/dom-external/element.d.ts +2 -1
- package/dist/dom-external/node.d.ts +6 -3
- package/dist/dsl/common.d.ts +1 -1
- package/dist/dsl/instance.d.ts +2 -2
- package/dist/env.d.ts +0 -1
- package/dist/hooks.d.ts +9 -4
- package/dist/index.d.ts +4 -6
- package/dist/interface/document.d.ts +1 -0
- package/dist/interface/hooks.d.ts +42 -2
- package/dist/runtime.esm.js +795 -2591
- package/dist/runtime.esm.js.map +1 -1
- package/package.json +4 -4
- package/dist/dsl/hooks.d.ts +0 -17
- package/dist/dsl/react.d.ts +0 -28
- package/dist/dsl/vue.d.ts +0 -7
- package/dist/dsl/vue3.d.ts +0 -5
package/dist/bom/raf.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
export declare let now: any;
|
|
3
|
-
declare const raf: typeof requestAnimationFrame
|
|
2
|
+
declare const raf: typeof requestAnimationFrame;
|
|
4
3
|
declare const caf: typeof cancelAnimationFrame;
|
|
5
4
|
export { raf, caf };
|
package/dist/bom/window.d.ts
CHANGED
|
@@ -1,18 +1 @@
|
|
|
1
|
-
export declare const window:
|
|
2
|
-
navigator: Navigator | {
|
|
3
|
-
appCodeName: string;
|
|
4
|
-
appName: string;
|
|
5
|
-
appVersion: string;
|
|
6
|
-
cookieEnabled: boolean;
|
|
7
|
-
mimeTypes: never[];
|
|
8
|
-
onLine: boolean;
|
|
9
|
-
platform: string;
|
|
10
|
-
plugins: never[];
|
|
11
|
-
product: string;
|
|
12
|
-
productSub: string;
|
|
13
|
-
userAgent: string;
|
|
14
|
-
vendor: string;
|
|
15
|
-
vendorSub: string;
|
|
16
|
-
};
|
|
17
|
-
document: import("..").TaroDocumentInstance;
|
|
18
|
-
};
|
|
1
|
+
export declare const window: any;
|
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
export declare const SID_TARO_ELEMENT = "0";
|
|
2
|
+
export declare const SID_TARO_ELEMENT_FACTORY = "1";
|
|
3
|
+
export declare const SID_TARO_TEXT = "2";
|
|
4
|
+
export declare const SID_TARO_TEXT_FACTORY = "3";
|
|
5
|
+
export declare const SID_TARO_NODE_IMPL = "4";
|
|
6
|
+
export declare const SID_TARO_ELEMENT_IMPL = "5";
|
|
7
|
+
export declare const SID_HOOKS = "6";
|
|
8
|
+
export declare const SID_ON_REMOVE_ATTRIBUTE = "7";
|
|
9
|
+
export declare const SID_GET_MINI_LIFECYCLE = "8";
|
|
10
|
+
export declare const SID_GET_LIFECYCLE = "9";
|
|
11
|
+
export declare const SID_GET_PATH_INDEX = "10";
|
|
12
|
+
export declare const SID_GET_EVENT_CENTER = "11";
|
|
13
|
+
export declare const SID_IS_BUBBLE_EVENTS = "12";
|
|
14
|
+
export declare const SID_GET_SPECIAL_NODES = "13";
|
|
15
|
+
export declare const SID_EVENT_CENTER = "14";
|
|
16
|
+
export declare const SID_MODIFY_MP_EVENT = "15";
|
|
17
|
+
export declare const SID_MODIFY_TARO_EVENT = "16";
|
|
18
|
+
export declare const SID_MODIFY_DISPATCH_EVENT = "17";
|
|
19
|
+
export declare const SID_BATCHED_EVENT_UPDATES = "18";
|
|
20
|
+
export declare const SID_MERGE_PAGE_INSTANCE = "19";
|
|
21
|
+
export declare const SID_CREATE_PULLDOWN_COMPONENT = "20";
|
|
22
|
+
export declare const SID_GET_DOM_NODE = "21";
|
|
23
|
+
export declare const SID_INIT_NATIVE_API = "22";
|
|
24
|
+
export declare const SID_MODIFY_HYDRATE_DATA = "23";
|
|
25
|
+
export declare const SID_MODIFY_SET_ATTR_PAYLOAD = "24";
|
|
26
|
+
export declare const SID_MODIFY_RM_ATTR_PAYLOAD = "25";
|
|
27
|
+
export declare const SID_ON_ADD_EVENT = "26";
|
|
28
|
+
export declare const SID_PATCH_ELEMENT = "27";
|
|
29
|
+
export declare const SID_MODIFY_PAGE_OBJECT = "28";
|
|
1
30
|
declare const SERVICE_IDENTIFIER: {
|
|
2
31
|
TaroElement: string;
|
|
3
32
|
TaroElementFactory: string;
|
|
@@ -7,6 +36,7 @@ declare const SERVICE_IDENTIFIER: {
|
|
|
7
36
|
TaroElementImpl: string;
|
|
8
37
|
Hooks: string;
|
|
9
38
|
onRemoveAttribute: string;
|
|
39
|
+
getMiniLifecycle: string;
|
|
10
40
|
getLifecycle: string;
|
|
11
41
|
getPathIndex: string;
|
|
12
42
|
getEventCenter: string;
|
|
@@ -15,6 +45,7 @@ declare const SERVICE_IDENTIFIER: {
|
|
|
15
45
|
eventCenter: string;
|
|
16
46
|
modifyMpEvent: string;
|
|
17
47
|
modifyTaroEvent: string;
|
|
48
|
+
modifyDispatchEvent: string;
|
|
18
49
|
batchedEventUpdates: string;
|
|
19
50
|
mergePageInstance: string;
|
|
20
51
|
createPullDownComponent: string;
|
|
@@ -25,5 +56,6 @@ declare const SERVICE_IDENTIFIER: {
|
|
|
25
56
|
modifyRmAttrPayload: string;
|
|
26
57
|
onAddEvent: string;
|
|
27
58
|
patchElement: string;
|
|
59
|
+
modifyPageObject: string;
|
|
28
60
|
};
|
|
29
61
|
export default SERVICE_IDENTIFIER;
|
|
@@ -38,3 +38,10 @@ export declare const SET_TIMEOUT = "setTimeout";
|
|
|
38
38
|
export declare const CATCHMOVE = "catchMove";
|
|
39
39
|
export declare const CATCH_VIEW = "catch-view";
|
|
40
40
|
export declare const COMMENT = "comment";
|
|
41
|
+
export declare const ON_LOAD = "onLoad";
|
|
42
|
+
export declare const ON_READY = "onReady";
|
|
43
|
+
export declare const ON_SHOW = "onShow";
|
|
44
|
+
export declare const ON_HIDE = "onHide";
|
|
45
|
+
export declare const OPTIONS = "options";
|
|
46
|
+
export declare const EXTERNAL_CLASSES = "externalClasses";
|
|
47
|
+
export declare const BEHAVIORS = "behaviors";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TaroDocumentInstance } from '../interface';
|
|
2
|
+
import type { Container } from 'inversify';
|
|
3
|
+
import type { IHooks, InstanceNamedFactory } from '../interface';
|
|
4
|
+
import type { TaroNodeImpl } from '../dom-external/node-impl';
|
|
5
|
+
import type { TaroElementImpl } from '../dom-external/element-impl';
|
|
6
|
+
interface IStore {
|
|
7
|
+
container: Container | null;
|
|
8
|
+
}
|
|
9
|
+
export declare const store: IStore;
|
|
10
|
+
export declare function getHooks(): IHooks;
|
|
11
|
+
export declare function getElementFactory(): InstanceNamedFactory;
|
|
12
|
+
export declare function getNodeImpl(): TaroNodeImpl;
|
|
13
|
+
export declare function getElementImpl(): TaroElementImpl;
|
|
14
|
+
export declare function getDocument(): TaroDocumentInstance;
|
|
15
|
+
export {};
|
package/dist/dom/document.d.ts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { TaroElement } from '../dom/element';
|
|
2
|
-
import { InstanceFactory
|
|
2
|
+
import { InstanceFactory } from '../interface';
|
|
3
3
|
import type { FormElement } from '../dom/form';
|
|
4
4
|
import type { TaroRootElement } from '../dom/root';
|
|
5
5
|
import type { TaroText } from '../dom/text';
|
|
6
|
-
import type { TaroNodeImpl } from '../dom-external/node-impl';
|
|
7
|
-
import type { TaroElementImpl } from '../dom-external/element-impl';
|
|
8
|
-
import type { Hooks } from '../hooks';
|
|
9
6
|
export declare class TaroDocument extends TaroElement {
|
|
10
7
|
private _getText;
|
|
11
8
|
constructor(// eslint-disable-next-line @typescript-eslint/indent
|
|
12
|
-
|
|
9
|
+
getText: InstanceFactory<TaroText>);
|
|
13
10
|
createElement(type: string): TaroElement | TaroRootElement | FormElement;
|
|
14
11
|
createElementNS(_svgNS: string, type: string): TaroElement | TaroRootElement | FormElement;
|
|
15
12
|
createTextNode(text: string): TaroText;
|
package/dist/dom/element.d.ts
CHANGED
|
@@ -2,18 +2,14 @@ import { TaroNode } from './node';
|
|
|
2
2
|
import { Style } from './style';
|
|
3
3
|
import { ClassList } from './class-list';
|
|
4
4
|
import type { TaroEvent } from './event';
|
|
5
|
-
import type { Attributes
|
|
6
|
-
import type { TaroNodeImpl } from '../dom-external/node-impl';
|
|
7
|
-
import type { TaroElementImpl } from '../dom-external/element-impl';
|
|
8
|
-
import type { Hooks } from '../hooks';
|
|
5
|
+
import type { Attributes } from '../interface';
|
|
9
6
|
export declare class TaroElement extends TaroNode {
|
|
10
7
|
tagName: string;
|
|
11
8
|
props: Record<string, any>;
|
|
12
9
|
style: Style;
|
|
13
10
|
dataset: Record<string, unknown>;
|
|
14
11
|
innerHTML: string;
|
|
15
|
-
constructor(
|
|
16
|
-
nodeImpl: TaroNodeImpl, getElement: InstanceNamedFactory, hooks: Hooks, elementImpl: TaroElementImpl);
|
|
12
|
+
constructor();
|
|
17
13
|
private _stopPropagation;
|
|
18
14
|
get id(): string;
|
|
19
15
|
set id(val: string);
|
|
@@ -27,7 +23,8 @@ export declare class TaroElement extends TaroNode {
|
|
|
27
23
|
set textContent(text: string);
|
|
28
24
|
hasAttribute(qualifiedName: string): boolean;
|
|
29
25
|
hasAttributes(): boolean;
|
|
30
|
-
focus(): void;
|
|
26
|
+
get focus(): () => void;
|
|
27
|
+
set focus(value: () => void);
|
|
31
28
|
blur(): void;
|
|
32
29
|
setAttribute(qualifiedName: string, value: any): void;
|
|
33
30
|
removeAttribute(qualifiedName: string): void;
|
|
@@ -2,8 +2,7 @@ import type { EventHandler, AddEventListenerOptions, IHooks } from '../interface
|
|
|
2
2
|
export declare class TaroEventTarget {
|
|
3
3
|
__handlers: Record<string, EventHandler[]>;
|
|
4
4
|
hooks: IHooks;
|
|
5
|
-
constructor(
|
|
6
|
-
hooks: IHooks);
|
|
5
|
+
constructor();
|
|
7
6
|
addEventListener(type: string, handler: EventHandler, options?: boolean | AddEventListenerOptions): void;
|
|
8
7
|
removeEventListener(type: string, handler: EventHandler): void;
|
|
9
8
|
isAnyEventBinded(): boolean;
|
package/dist/dom/node.d.ts
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import { NodeType } from './node_types';
|
|
2
2
|
import { TaroEventTarget } from './event-target';
|
|
3
|
-
import type { UpdatePayload
|
|
3
|
+
import type { UpdatePayload } from '../interface';
|
|
4
4
|
import type { TaroDocument } from './document';
|
|
5
5
|
import type { TaroRootElement } from './root';
|
|
6
6
|
import type { TaroElement } from './element';
|
|
7
|
-
import type { TaroNodeImpl } from '../dom-external/node-impl';
|
|
8
|
-
import type { Hooks } from '../hooks';
|
|
9
7
|
export declare class TaroNode extends TaroEventTarget {
|
|
10
8
|
uid: string;
|
|
11
9
|
nodeType: NodeType;
|
|
12
10
|
nodeName: string;
|
|
13
11
|
parentNode: TaroNode | null;
|
|
14
12
|
childNodes: TaroNode[];
|
|
15
|
-
protected _getElement: InstanceNamedFactory;
|
|
16
|
-
constructor(
|
|
17
|
-
impl: TaroNodeImpl, getElement: InstanceNamedFactory, hooks: Hooks);
|
|
13
|
+
protected _getElement: import("../interface").InstanceNamedFactory;
|
|
14
|
+
constructor();
|
|
18
15
|
private hydrate;
|
|
19
16
|
/**
|
|
20
17
|
* like jQuery's $.empty()
|
|
@@ -40,8 +37,5 @@ export declare class TaroNode extends TaroEventTarget {
|
|
|
40
37
|
remove(isReplace?: boolean): void;
|
|
41
38
|
hasChildNodes(): boolean;
|
|
42
39
|
enqueueUpdate(payload: UpdatePayload): void;
|
|
43
|
-
contains(node: TaroNode & {
|
|
44
|
-
id?: string;
|
|
45
|
-
}): boolean;
|
|
46
40
|
get ownerDocument(): TaroDocument;
|
|
47
41
|
}
|
package/dist/dom/root.d.ts
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import { TaroElement } from './element';
|
|
2
|
-
import type { Func, UpdatePayload,
|
|
3
|
-
import type { TaroNodeImpl } from '../dom-external/node-impl';
|
|
4
|
-
import type { TaroElementImpl } from '../dom-external/element-impl';
|
|
5
|
-
import type { Hooks } from '../hooks';
|
|
6
|
-
import type { Events } from '../emitter/emitter';
|
|
2
|
+
import type { Func, UpdatePayload, MpInstance } from '../interface';
|
|
7
3
|
export declare class TaroRootElement extends TaroElement {
|
|
8
|
-
private pendingFlush;
|
|
9
4
|
private updatePayloads;
|
|
10
5
|
private updateCallbacks;
|
|
11
|
-
private eventCenter;
|
|
12
6
|
pendingUpdate: boolean;
|
|
13
7
|
ctx: null | MpInstance;
|
|
14
|
-
constructor(
|
|
15
|
-
nodeImpl: TaroNodeImpl, getElement: InstanceNamedFactory, hooks: Hooks, elementImpl: TaroElementImpl, eventCenter: Events);
|
|
8
|
+
constructor();
|
|
16
9
|
get _path(): string;
|
|
17
10
|
protected get _root(): TaroRootElement;
|
|
18
11
|
enqueueUpdate(payload: UpdatePayload): void;
|
package/dist/dom/text.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { TaroNode } from './node';
|
|
2
|
-
import
|
|
3
|
-
import type { InstanceNamedFactory } from '../interface';
|
|
4
|
-
import type { Hooks } from '../hooks';
|
|
2
|
+
import { NodeType } from './node_types';
|
|
5
3
|
export declare class TaroText extends TaroNode {
|
|
6
4
|
_value: string;
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
nodeType: NodeType;
|
|
6
|
+
nodeName: string;
|
|
9
7
|
set textContent(text: string);
|
|
10
8
|
get textContent(): string;
|
|
11
9
|
set nodeValue(text: string);
|
|
12
10
|
get nodeValue(): string;
|
|
11
|
+
set data(text: string);
|
|
12
|
+
get data(): string;
|
|
13
13
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { Ctx } from '../interface';
|
|
2
|
-
|
|
2
|
+
import type { TaroElement } from 'src/dom/element';
|
|
3
|
+
export declare function getBoundingClientRectImpl(this: TaroElement): Promise<null>;
|
|
3
4
|
export declare function getTemplateContent(ctx: Ctx): string | undefined;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { GetDoc } from '../interface';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TaroNode } from 'src/dom/node';
|
|
3
3
|
export declare type IPosition = 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend';
|
|
4
4
|
/**
|
|
5
5
|
* An implementation of `Element.insertAdjacentHTML()`
|
|
6
6
|
* to support Vue 3 with a version of or greater than `vue@3.1.2`
|
|
7
7
|
*/
|
|
8
|
-
export declare function insertAdjacentHTMLImpl(position: IPosition, html: string
|
|
9
|
-
export declare function cloneNode(
|
|
8
|
+
export declare function insertAdjacentHTMLImpl(this: TaroNode, getDoc: GetDoc, position: IPosition, html: string): void;
|
|
9
|
+
export declare function cloneNode(this: TaroNode, getDoc: any, isDeep?: boolean): any;
|
|
10
|
+
export declare function contains(this: TaroNode, node: TaroNode & {
|
|
11
|
+
id?: string;
|
|
12
|
+
}): boolean;
|
package/dist/dsl/common.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { Instance, PageInstance, PageProps } from './instance';
|
|
|
5
5
|
export declare function injectPageInstance(inst: Instance<PageProps>, id: string): void;
|
|
6
6
|
export declare function getPageInstance(id: string): Instance | undefined;
|
|
7
7
|
export declare function addLeadingSlash(path?: string): string;
|
|
8
|
-
export declare function safeExecute(path: string, lifecycle:
|
|
8
|
+
export declare function safeExecute(path: string, lifecycle: string, ...args: unknown[]): any;
|
|
9
9
|
export declare function stringify(obj?: Record<string, unknown>): string;
|
|
10
10
|
export declare function getPath(id: string, options?: Record<string, unknown>): string;
|
|
11
11
|
export declare function getOnReadyEventKey(path: string): string;
|
package/dist/dsl/instance.d.ts
CHANGED
|
@@ -54,8 +54,8 @@ export interface PageLifeCycle extends Show {
|
|
|
54
54
|
onShareTimeline?(): void;
|
|
55
55
|
onAddToFavorites?(): void;
|
|
56
56
|
eh?(event: MpEvent): void;
|
|
57
|
-
onLoad(options: Record<string, unknown>, cb?: Func): void;
|
|
58
|
-
onUnload(): void;
|
|
57
|
+
onLoad?(options: Record<string, unknown>, cb?: Func): void;
|
|
58
|
+
onUnload?(): void;
|
|
59
59
|
}
|
|
60
60
|
export interface PageInstance extends PageLifeCycle {
|
|
61
61
|
data?: Record<string, unknown>;
|
package/dist/env.d.ts
CHANGED
package/dist/hooks.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { IHooks, OnRemoveAttribute, GetLifecycle, GetPathIndex, GetEventCenter, IsBubbleEvents, GetSpecialNodes, BatchedEventUpdates, MergePageInstance, CreatePullDownComponent, GetDOMNode, InitNativeApi, ModifySetAttrPayload, ModifyHydrateData, ModifyRmAttrPayload, MpEvent, OnAddEvent, patchElement } from './interface';
|
|
2
1
|
import type { TaroElement } from './dom/element';
|
|
3
2
|
import type { TaroEvent } from './dom/event';
|
|
3
|
+
import type { IHooks, OnRemoveAttribute, GetMiniLifecycle, GetLifecycle, GetPathIndex, GetEventCenter, ModifyMpEvent, ModifyTaroEvent, ModifyDispatchEvent, IsBubbleEvents, GetSpecialNodes, BatchedEventUpdates, MergePageInstance, CreatePullDownComponent, GetDOMNode, InitNativeApi, ModifySetAttrPayload, ModifyHydrateData, ModifyRmAttrPayload, MpEvent, OnAddEvent, PatchElement, ModifyPageObject } from './interface';
|
|
4
4
|
export declare class Hooks implements IHooks {
|
|
5
|
+
getMiniLifecycle: GetMiniLifecycle;
|
|
6
|
+
getMiniLifecycleImpl(): import("./interface").MiniLifecycle;
|
|
5
7
|
getLifecycle: GetLifecycle;
|
|
6
8
|
getPathIndex: GetPathIndex;
|
|
7
9
|
getEventCenter: GetEventCenter;
|
|
@@ -10,18 +12,21 @@ export declare class Hooks implements IHooks {
|
|
|
10
12
|
onRemoveAttribute?: OnRemoveAttribute;
|
|
11
13
|
batchedEventUpdates?: BatchedEventUpdates;
|
|
12
14
|
mergePageInstance?: MergePageInstance;
|
|
15
|
+
modifyPageObject?: ModifyPageObject;
|
|
13
16
|
createPullDownComponent?: CreatePullDownComponent;
|
|
14
17
|
getDOMNode?: GetDOMNode;
|
|
15
18
|
modifyHydrateData?: ModifyHydrateData;
|
|
16
19
|
modifySetAttrPayload?: ModifySetAttrPayload;
|
|
17
20
|
modifyRmAttrPayload?: ModifyRmAttrPayload;
|
|
18
21
|
onAddEvent?: OnAddEvent;
|
|
19
|
-
|
|
22
|
+
modifyMpEventImpls?: ModifyMpEvent[];
|
|
20
23
|
modifyMpEvent(e: MpEvent): void;
|
|
21
|
-
|
|
24
|
+
modifyTaroEventImpls?: ModifyTaroEvent[];
|
|
22
25
|
modifyTaroEvent(e: TaroEvent, element: TaroElement): void;
|
|
26
|
+
modifyDispatchEventImpls?: ModifyDispatchEvent[];
|
|
27
|
+
modifyDispatchEvent(e: TaroEvent, element: TaroElement): void;
|
|
23
28
|
initNativeApiImpls?: InitNativeApi[];
|
|
24
29
|
initNativeApi(taro: Record<string, any>): void;
|
|
25
|
-
patchElementImpls?:
|
|
30
|
+
patchElementImpls?: PatchElement[];
|
|
26
31
|
patchElement(element: TaroElement): void;
|
|
27
32
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,21 +5,18 @@ export { TaroElement } from './dom/element';
|
|
|
5
5
|
export { TaroRootElement } from './dom/root';
|
|
6
6
|
export { FormElement } from './dom/form';
|
|
7
7
|
export { SVGElement } from './dom/svg';
|
|
8
|
-
export { TaroEvent, createEvent } from './dom/event';
|
|
8
|
+
export { TaroEvent, createEvent, eventHandler } from './dom/event';
|
|
9
9
|
export { createDocument, document } from './bom/document';
|
|
10
10
|
export { window } from './bom/window';
|
|
11
11
|
export { navigator } from './bom/navigator';
|
|
12
12
|
export { default as container } from './container';
|
|
13
13
|
export { default as processPluginHooks } from './container/plugin-hooks';
|
|
14
14
|
export { default as SERVICE_IDENTIFIER } from './constants/identifiers';
|
|
15
|
-
export {
|
|
16
|
-
export { connectVuePage, createVueApp } from './dsl/vue';
|
|
17
|
-
export { createVue3App } from './dsl/vue3';
|
|
15
|
+
export { addLeadingSlash, safeExecute } from './dsl/common';
|
|
18
16
|
export * from './dsl/instance';
|
|
19
|
-
export { createPageConfig, injectPageInstance, createComponentConfig, createRecursiveComponentConfig, stringify } from './dsl/common';
|
|
17
|
+
export { createPageConfig, injectPageInstance, createComponentConfig, createRecursiveComponentConfig, stringify, getPageInstance } from './dsl/common';
|
|
20
18
|
export { Current, getCurrentInstance } from './current';
|
|
21
19
|
export { Style } from './dom/style';
|
|
22
|
-
export * from './dsl/hooks';
|
|
23
20
|
export { options } from './options';
|
|
24
21
|
export { nextTick } from './next-tick';
|
|
25
22
|
export { hydrate } from './hydrate';
|
|
@@ -27,3 +24,4 @@ export * from './emitter/emitter';
|
|
|
27
24
|
export { raf as requestAnimationFrame, caf as cancelAnimationFrame, now } from './bom/raf';
|
|
28
25
|
export { getComputedStyle } from './bom/getComputedStyle';
|
|
29
26
|
export * from './interface';
|
|
27
|
+
export { incrementId } from './utils';
|
|
@@ -4,6 +4,24 @@ import type { Func, MpEvent, EventHandler, UpdatePayload } from '../interface';
|
|
|
4
4
|
import type { EventsType } from '../emitter/emitter';
|
|
5
5
|
import type { TaroEvent } from '../dom/event';
|
|
6
6
|
import type { TaroEventTarget } from '../dom/event-target';
|
|
7
|
+
export interface MiniLifecycle {
|
|
8
|
+
app: [
|
|
9
|
+
string,
|
|
10
|
+
string,
|
|
11
|
+
string /** onHide */
|
|
12
|
+
];
|
|
13
|
+
page: [
|
|
14
|
+
string,
|
|
15
|
+
string,
|
|
16
|
+
string,
|
|
17
|
+
string,
|
|
18
|
+
string,
|
|
19
|
+
string[] /** others */
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
export interface GetMiniLifecycle {
|
|
23
|
+
(defaultConfig: MiniLifecycle): MiniLifecycle;
|
|
24
|
+
}
|
|
7
25
|
export interface GetLifecycle<Instance = any> {
|
|
8
26
|
(instance: Instance, lifecyle: keyof PageInstance): Func | Array<Func> | undefined;
|
|
9
27
|
}
|
|
@@ -28,6 +46,9 @@ export interface ModifyMpEvent {
|
|
|
28
46
|
export interface ModifyTaroEvent {
|
|
29
47
|
(event: TaroEvent, element: TaroElement): void;
|
|
30
48
|
}
|
|
49
|
+
export interface ModifyDispatchEvent {
|
|
50
|
+
(event: TaroEvent, element: TaroElement): void;
|
|
51
|
+
}
|
|
31
52
|
export interface BatchedEventUpdates {
|
|
32
53
|
(cb: Func): void;
|
|
33
54
|
}
|
|
@@ -56,10 +77,16 @@ export interface ModifyRmAttrPayload {
|
|
|
56
77
|
export interface OnAddEvent<T extends TaroEventTarget = TaroEventTarget> {
|
|
57
78
|
(type: string, handler: EventHandler, options: any, node: T): void;
|
|
58
79
|
}
|
|
59
|
-
export interface
|
|
80
|
+
export interface PatchElement {
|
|
60
81
|
(node: TaroElement): void;
|
|
61
82
|
}
|
|
83
|
+
export interface ModifyPageObject {
|
|
84
|
+
(config: Record<any, any>): void;
|
|
85
|
+
}
|
|
62
86
|
export interface IHooks {
|
|
87
|
+
/** 小程序端 App、Page 构造对象的生命周期方法名称 */
|
|
88
|
+
getMiniLifecycle: GetMiniLifecycle;
|
|
89
|
+
getMiniLifecycleImpl: () => MiniLifecycle;
|
|
63
90
|
/** 解决 React 生命周期名称的兼容问题 */
|
|
64
91
|
getLifecycle: GetLifecycle;
|
|
65
92
|
/** 解决百度小程序的模版语法问题 */
|
|
@@ -74,16 +101,27 @@ export interface IHooks {
|
|
|
74
101
|
* @multi-inject
|
|
75
102
|
* 用于修改小程序原生事件对象
|
|
76
103
|
**/
|
|
104
|
+
modifyMpEventImpls?: ModifyMpEvent[];
|
|
77
105
|
modifyMpEvent: ModifyMpEvent;
|
|
78
106
|
/**
|
|
79
107
|
* @multi-inject
|
|
80
108
|
* 用于修改 Taro DOM 事件对象
|
|
81
109
|
**/
|
|
110
|
+
modifyTaroEventImpls?: ModifyTaroEvent[];
|
|
82
111
|
modifyTaroEvent: ModifyTaroEvent;
|
|
112
|
+
/**
|
|
113
|
+
* @multi-inject
|
|
114
|
+
* 用于修改触发回调前的 Taro DOM 事件对象
|
|
115
|
+
* 比 modifyTaroEvent 稍晚,为了可以在 el.__handlers[event.type] 取得回调函数后再修改事件对象
|
|
116
|
+
**/
|
|
117
|
+
modifyDispatchEventImpls?: ModifyDispatchEvent[];
|
|
118
|
+
modifyDispatchEvent: ModifyDispatchEvent;
|
|
83
119
|
/** 用于把 React 同一事件回调中的所有 setState 合并到同一个更新处理中 */
|
|
84
120
|
batchedEventUpdates?: BatchedEventUpdates;
|
|
85
121
|
/** 用于处理 React 中的小程序生命周期 hooks */
|
|
86
122
|
mergePageInstance?: MergePageInstance;
|
|
123
|
+
/** 用于修改传递给小程序 Page 构造器的对象 */
|
|
124
|
+
modifyPageObject?: ModifyPageObject;
|
|
87
125
|
/** H5 下拉刷新 wrapper */
|
|
88
126
|
createPullDownComponent?: CreatePullDownComponent;
|
|
89
127
|
/** H5 获取原生 DOM 对象 */
|
|
@@ -92,6 +130,7 @@ export interface IHooks {
|
|
|
92
130
|
* @multi-inject
|
|
93
131
|
* 挂载属性或 API 到 Taro 对象上
|
|
94
132
|
**/
|
|
133
|
+
initNativeApiImpls?: InitNativeApi[];
|
|
95
134
|
initNativeApi?: InitNativeApi;
|
|
96
135
|
/**
|
|
97
136
|
* @todo: mutiInject
|
|
@@ -117,6 +156,7 @@ export interface IHooks {
|
|
|
117
156
|
* @todo: mutiInject
|
|
118
157
|
* 给 TaroElement 实例注入属性或方法
|
|
119
158
|
**/
|
|
120
|
-
|
|
159
|
+
patchElementImpls?: PatchElement[];
|
|
160
|
+
patchElement?: PatchElement;
|
|
121
161
|
}
|
|
122
162
|
export {};
|