@tarojs/runtime 3.7.0-canary.1 → 3.8.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/URL.d.ts +61 -0
- package/dist/bom/URLSearchParams.d.ts +14 -0
- package/dist/bom/document.d.ts +2 -0
- package/dist/bom/getComputedStyle.d.ts +3 -0
- package/dist/bom/history.d.ts +29 -0
- package/dist/bom/location.d.ts +36 -0
- package/dist/bom/navigator.d.ts +1 -0
- package/dist/bom/raf.d.ts +5 -0
- package/dist/bom/window.d.ts +4 -0
- package/dist/constants/index.d.ts +59 -0
- package/dist/current.d.ts +19 -0
- package/dist/dom/anchor-element.d.ts +13 -0
- package/dist/dom/class-list.d.ts +16 -0
- package/dist/dom/document.d.ts +20 -0
- package/dist/dom/element.d.ts +39 -0
- package/dist/dom/event-source.d.ts +7 -0
- package/dist/dom/event-target.d.ts +7 -0
- package/dist/dom/event.d.ts +23 -0
- package/dist/dom/form.d.ts +9 -0
- package/dist/dom/node.d.ts +76 -0
- package/dist/dom/node_types.d.ts +10 -0
- package/dist/dom/root.d.ts +15 -0
- package/dist/dom/style.d.ts +14 -0
- package/dist/dom/style_properties.d.ts +3 -0
- package/dist/dom/svg.d.ts +3 -0
- package/dist/dom/text.d.ts +14 -0
- package/dist/dom/tree.d.ts +4 -0
- package/dist/dom-external/element.d.ts +3 -0
- package/dist/dom-external/index.d.ts +1 -0
- package/dist/dom-external/inner-html/html.d.ts +2 -0
- package/dist/dom-external/inner-html/parser.d.ts +25 -0
- package/dist/dom-external/inner-html/scaner.d.ts +30 -0
- package/dist/dom-external/inner-html/style.d.ts +27 -0
- package/dist/dom-external/inner-html/tags.d.ts +8 -0
- package/dist/dom-external/inner-html/utils.d.ts +1 -0
- package/dist/dom-external/mutation-observer/implements.d.ts +52 -0
- package/dist/dom-external/mutation-observer/index.d.ts +13 -0
- package/dist/dom-external/mutation-observer/record.d.ts +24 -0
- package/dist/dom-external/node.d.ts +11 -0
- package/dist/dsl/common.d.ts +16 -0
- package/dist/dsl/instance.d.ts +91 -0
- package/dist/emitter/emitter.d.ts +4 -0
- package/dist/env.d.ts +7 -0
- package/dist/hydrate.d.ts +10 -0
- package/dist/index.d.ts +33 -0
- package/dist/interface/element.d.ts +4 -0
- package/dist/interface/event-target.d.ts +10 -0
- package/dist/interface/event.d.ts +15 -0
- package/dist/interface/hydrate.d.ts +29 -0
- package/dist/interface/index.d.ts +7 -0
- package/dist/interface/node.d.ts +7 -0
- package/dist/interface/options.d.ts +16 -0
- package/dist/interface/utils.d.ts +2 -0
- package/dist/next-tick.d.ts +2 -0
- package/dist/options.d.ts +2 -0
- package/dist/perf.d.ts +7 -0
- package/dist/runtime.esm.d.ts +136 -66
- package/dist/runtime.esm.js +85 -60
- package/dist/runtime.esm.js.map +1 -1
- package/dist/utils/cache.d.ts +12 -0
- package/dist/utils/index.d.ts +23 -0
- package/package.json +6 -11
- package/dist/runtime.cjs.d.ts +0 -711
- package/dist/runtime.cjs.js +0 -4525
- package/dist/runtime.h5.d.ts +0 -711
- package/dist/runtime.h5.js +0 -3281
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { TaroNode } from '../../dom/node';
|
|
2
|
+
import type { MutationRecord } from './record';
|
|
3
|
+
export type MutationCallback = (mutations: MutationRecord[]) => any;
|
|
4
|
+
/**
|
|
5
|
+
* @see https://dom.spec.whatwg.org/#dictdef-mutationobserverinit
|
|
6
|
+
*/
|
|
7
|
+
export interface MutationObserverInit {
|
|
8
|
+
attributeFilter?: string[];
|
|
9
|
+
attributeOldValue?: boolean;
|
|
10
|
+
attributes?: boolean;
|
|
11
|
+
characterData?: boolean;
|
|
12
|
+
characterDataOldValue?: boolean;
|
|
13
|
+
childList?: boolean;
|
|
14
|
+
subtree?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The MutationObserver provides the ability
|
|
18
|
+
* to watch for changes being made to the DOM tree.
|
|
19
|
+
* It will invoke a specified callback function
|
|
20
|
+
* when DOM changes occur.
|
|
21
|
+
* @see https://dom.spec.whatwg.org/#mutationobserver
|
|
22
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
|
|
23
|
+
*/
|
|
24
|
+
export declare class MutationObserverImpl {
|
|
25
|
+
callback: MutationCallback;
|
|
26
|
+
target: TaroNode | null;
|
|
27
|
+
options: MutationObserverInit;
|
|
28
|
+
records: MutationRecord[];
|
|
29
|
+
constructor(callback: MutationCallback);
|
|
30
|
+
/**
|
|
31
|
+
* Configures the MutationObserver
|
|
32
|
+
* to begin receiving notifications
|
|
33
|
+
* through its callback function
|
|
34
|
+
* when DOM changes matching the given options occur.
|
|
35
|
+
*
|
|
36
|
+
* Options matching is to be implemented.
|
|
37
|
+
*/
|
|
38
|
+
observe(target: TaroNode, options?: MutationObserverInit): void;
|
|
39
|
+
/**
|
|
40
|
+
* Stop the MutationObserver instance
|
|
41
|
+
* from receiving further notifications
|
|
42
|
+
* until and unless observe() is called again.
|
|
43
|
+
*/
|
|
44
|
+
disconnect(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Removes all pending notifications
|
|
47
|
+
* from the MutationObserver's notification queue
|
|
48
|
+
* and returns them in a new Array of MutationRecord objects.
|
|
49
|
+
*/
|
|
50
|
+
takeRecords(): MutationRecord[];
|
|
51
|
+
}
|
|
52
|
+
export declare function recordMutation(record: MutationRecord): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MutationObserverImpl } from './implements';
|
|
2
|
+
import { MutationRecord, MutationRecordType } from './record';
|
|
3
|
+
import type { TaroNode } from '../../dom/node';
|
|
4
|
+
import type { MutationCallback, MutationObserverInit } from './implements';
|
|
5
|
+
export declare class MutationObserver {
|
|
6
|
+
core: Pick<MutationObserverImpl, 'observe' | 'disconnect' | 'takeRecords'>;
|
|
7
|
+
constructor(callback: MutationCallback);
|
|
8
|
+
observe(...args: [TaroNode, MutationObserverInit?]): void;
|
|
9
|
+
disconnect(): void;
|
|
10
|
+
takeRecords(): MutationRecord[];
|
|
11
|
+
static record(record: MutationRecord): void;
|
|
12
|
+
}
|
|
13
|
+
export { MutationRecordType };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { TaroNode } from '../../dom/node';
|
|
2
|
+
/**
|
|
3
|
+
* A MutationRecord represents an individual DOM mutation.
|
|
4
|
+
* It is the object that is passed to MutationObserver's callback.
|
|
5
|
+
* @see https://dom.spec.whatwg.org/#interface-mutationrecord
|
|
6
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord
|
|
7
|
+
*/
|
|
8
|
+
export interface MutationRecord {
|
|
9
|
+
readonly target: TaroNode;
|
|
10
|
+
readonly addedNodes?: TaroNode[];
|
|
11
|
+
readonly removedNodes?: TaroNode[];
|
|
12
|
+
readonly previousSibling?: TaroNode | null;
|
|
13
|
+
readonly nextSibling?: TaroNode | null;
|
|
14
|
+
readonly attributeName?: string | null;
|
|
15
|
+
readonly attributeNamespace?: string | null;
|
|
16
|
+
oldValue?: string | null;
|
|
17
|
+
readonly type: MutationRecordType;
|
|
18
|
+
readonly value?: string | null;
|
|
19
|
+
}
|
|
20
|
+
export declare const enum MutationRecordType {
|
|
21
|
+
ATTRIBUTES = "attributes",
|
|
22
|
+
CHARACTER_DATA = "characterData",
|
|
23
|
+
CHILD_LIST = "childList"
|
|
24
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TaroNode } from '../dom/node';
|
|
2
|
+
export type IPosition = 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend';
|
|
3
|
+
/**
|
|
4
|
+
* An implementation of `Element.insertAdjacentHTML()`
|
|
5
|
+
* to support Vue 3 with a version of or greater than `vue@3.1.2`
|
|
6
|
+
*/
|
|
7
|
+
export declare function insertAdjacentHTML(this: TaroNode, position: IPosition, html: string): void;
|
|
8
|
+
export declare function cloneNode(this: TaroNode, isDeep?: boolean): any;
|
|
9
|
+
export declare function contains(this: TaroNode, node: TaroNode & {
|
|
10
|
+
id?: string;
|
|
11
|
+
}): boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { PageConfig } from '@tarojs/taro';
|
|
3
|
+
import type { Instance, PageInstance, PageProps } from './instance';
|
|
4
|
+
export declare function injectPageInstance(inst: Instance<PageProps>, id: string): void;
|
|
5
|
+
export declare function getPageInstance(id: string): Instance | undefined;
|
|
6
|
+
export declare function removePageInstance(id: string): void;
|
|
7
|
+
export declare function addLeadingSlash(path?: string): string;
|
|
8
|
+
export declare function safeExecute(path: string, lifecycle: string, ...args: unknown[]): any;
|
|
9
|
+
export declare function stringify(obj?: Record<string, unknown>): string;
|
|
10
|
+
export declare function getPath(id: string, options?: Record<string, unknown>): string;
|
|
11
|
+
export declare function getOnReadyEventKey(path: string): string;
|
|
12
|
+
export declare function getOnShowEventKey(path: string): string;
|
|
13
|
+
export declare function getOnHideEventKey(path: string): string;
|
|
14
|
+
export declare function createPageConfig(component: any, pageName?: string, data?: Record<string, unknown>, pageConfig?: PageConfig): PageInstance;
|
|
15
|
+
export declare function createComponentConfig(component: React.ComponentClass, componentName?: string, data?: Record<string, unknown>): any;
|
|
16
|
+
export declare function createRecursiveComponentConfig(componentName?: string): any;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import VueCtor, { ComponentOptions, VNode } from 'vue';
|
|
2
|
+
import type { Component as Vue3Component } from '@vue/runtime-core';
|
|
3
|
+
import type { Component, ComponentClass } from 'react';
|
|
4
|
+
import type { CombinedVueInstance } from 'vue/types/vue';
|
|
5
|
+
import type { TaroElement } from '../dom/element';
|
|
6
|
+
import type { Func, MpEvent } from '../interface';
|
|
7
|
+
export interface Instance<T = Record<string, any>> extends Component<T>, Show, PageInstance {
|
|
8
|
+
tid?: string;
|
|
9
|
+
node?: TaroElement;
|
|
10
|
+
$forceUpdate?(): void;
|
|
11
|
+
$nextTick?(cb: () => void): void;
|
|
12
|
+
$options: Instance;
|
|
13
|
+
}
|
|
14
|
+
export interface VueAppInstance extends ComponentOptions<VueCtor> {
|
|
15
|
+
$options: AppInstance;
|
|
16
|
+
}
|
|
17
|
+
export type VueInstance<M = Record<string, any>, P = Record<string, any>> = CombinedVueInstance<VueCtor, Record<string, any>, M, P, Record<never, any>> & VueInternal;
|
|
18
|
+
interface VueInternal {
|
|
19
|
+
_render(): VNode;
|
|
20
|
+
_update(vnode: VNode, hyrate: boolean): void;
|
|
21
|
+
}
|
|
22
|
+
export interface PageProps {
|
|
23
|
+
tid?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ReactPageComponent<T = PageProps> extends ComponentClass<T>, PageInstance {
|
|
26
|
+
}
|
|
27
|
+
export interface ReactPageInstance<T = PageProps> extends Component<T>, PageInstance {
|
|
28
|
+
componentDidShow?(): void;
|
|
29
|
+
componentDidHide?(): void;
|
|
30
|
+
}
|
|
31
|
+
export interface ReactAppInstance<T = AppInstance> extends Component<T>, AppInstance {
|
|
32
|
+
}
|
|
33
|
+
export interface PageLifeCycle extends Show {
|
|
34
|
+
eh?(event: MpEvent): void;
|
|
35
|
+
onAddToFavorites?(): void;
|
|
36
|
+
onLoad?(options: Record<string, unknown>, cb?: Func): void;
|
|
37
|
+
onOptionMenuClick?(): void;
|
|
38
|
+
onPageScroll?(obj: {
|
|
39
|
+
scrollTop: number;
|
|
40
|
+
}): void;
|
|
41
|
+
onPullDownRefresh?(): void;
|
|
42
|
+
onPullIntercept?(): void;
|
|
43
|
+
onPopMenuClick?(): void;
|
|
44
|
+
onReachBottom?(): void;
|
|
45
|
+
onReady?(): void;
|
|
46
|
+
onResize?(options: unknown): void;
|
|
47
|
+
onSaveExitState?(): void;
|
|
48
|
+
onShareAppMessage?(obj: {
|
|
49
|
+
from: string;
|
|
50
|
+
target?: TaroElement;
|
|
51
|
+
webViewUrl: string;
|
|
52
|
+
}): void;
|
|
53
|
+
onShareTimeline?(): void;
|
|
54
|
+
onTabItemTap?(obj: {
|
|
55
|
+
index: string;
|
|
56
|
+
pagePath: string;
|
|
57
|
+
text: string;
|
|
58
|
+
}): void;
|
|
59
|
+
onTitleClick?(): void;
|
|
60
|
+
onUnload?(): void;
|
|
61
|
+
}
|
|
62
|
+
export interface PageInstance extends PageLifeCycle {
|
|
63
|
+
/** 页面的初始数据 */
|
|
64
|
+
data?: Record<string, unknown>;
|
|
65
|
+
/** 页面路径 */
|
|
66
|
+
path?: string;
|
|
67
|
+
/** 页面的组件选项 */
|
|
68
|
+
options?: Record<string, unknown>;
|
|
69
|
+
/** 页面渲染引擎类型 */
|
|
70
|
+
renderer?: 'webview' | 'skyline';
|
|
71
|
+
}
|
|
72
|
+
interface Show {
|
|
73
|
+
componentDidShow?(): void;
|
|
74
|
+
componentDidHide?(): void;
|
|
75
|
+
onShow?(): void;
|
|
76
|
+
onHide?(): void;
|
|
77
|
+
}
|
|
78
|
+
export interface AppInstance extends Show {
|
|
79
|
+
componentDidShow?(options?: Record<string, unknown>): void;
|
|
80
|
+
mount?(component: React.ComponentClass | ComponentOptions<VueCtor> | Vue3Component, id: string, cb: (...args: any[]) => void): void;
|
|
81
|
+
mount?(component: React.ComponentClass | ComponentOptions<VueCtor> | Vue3Component, id: string, getCtx: (...args: any[]) => void, cb: (...args: any[]) => void): void;
|
|
82
|
+
onError?(error: string): void;
|
|
83
|
+
onLaunch?(options?: Record<string, unknown>): void;
|
|
84
|
+
onPageNotFound?(res: any): void;
|
|
85
|
+
onUnhandledRejection?(error: any): void;
|
|
86
|
+
onShow?(options?: Record<string, unknown>): void;
|
|
87
|
+
unmount?(id: string, cb?: () => void): void;
|
|
88
|
+
taroGlobalData?: Record<any, any>;
|
|
89
|
+
config?: Record<any, any>;
|
|
90
|
+
}
|
|
91
|
+
export {};
|
package/dist/env.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TaroElement } from './dom/element';
|
|
2
|
+
import type { TaroText } from './dom/text';
|
|
3
|
+
import type { MiniData } from './interface';
|
|
4
|
+
/**
|
|
5
|
+
* React also has a fancy function's name for this: `hydrate()`.
|
|
6
|
+
* You may have been heard `hydrate` as a SSR-related function,
|
|
7
|
+
* actually, `hydrate` basicly do the `render()` thing, but ignore some properties,
|
|
8
|
+
* it's a vnode traverser and modifier: that's exactly what Taro's doing in here.
|
|
9
|
+
*/
|
|
10
|
+
export declare function hydrate(node: TaroElement | TaroText): MiniData;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import './dom-external';
|
|
2
|
+
import env from './env';
|
|
3
|
+
export { hooks } from '@tarojs/shared';
|
|
4
|
+
export { document } from './bom/document';
|
|
5
|
+
export { getComputedStyle } from './bom/getComputedStyle';
|
|
6
|
+
export { History } from './bom/history';
|
|
7
|
+
export { Location } from './bom/location';
|
|
8
|
+
export { nav as navigator } from './bom/navigator';
|
|
9
|
+
export { caf as cancelAnimationFrame, now, raf as requestAnimationFrame } from './bom/raf';
|
|
10
|
+
export { parseUrl, URL } from './bom/URL';
|
|
11
|
+
export { URLSearchParams } from './bom/URLSearchParams';
|
|
12
|
+
export { history, location, window } from './bom/window';
|
|
13
|
+
export { TaroElement } from './dom/element';
|
|
14
|
+
export { createEvent, eventHandler, TaroEvent } from './dom/event';
|
|
15
|
+
export { FormElement } from './dom/form';
|
|
16
|
+
export { TaroNode } from './dom/node';
|
|
17
|
+
export { TaroRootElement } from './dom/root';
|
|
18
|
+
export { Style } from './dom/style';
|
|
19
|
+
export { SVGElement } from './dom/svg';
|
|
20
|
+
export { TaroText } from './dom/text';
|
|
21
|
+
export { MutationObserver } from './dom-external/mutation-observer';
|
|
22
|
+
export { env };
|
|
23
|
+
export * from './constants';
|
|
24
|
+
export { Current, getCurrentInstance } from './current';
|
|
25
|
+
export { eventSource } from './dom/event-source';
|
|
26
|
+
export { addLeadingSlash, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify } from './dsl/common';
|
|
27
|
+
export * from './emitter/emitter';
|
|
28
|
+
export { hydrate } from './hydrate';
|
|
29
|
+
export { nextTick } from './next-tick';
|
|
30
|
+
export { options } from './options';
|
|
31
|
+
export { incrementId } from './utils';
|
|
32
|
+
export * from './dsl/instance';
|
|
33
|
+
export * from './interface';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface EventOptions {
|
|
2
|
+
bubbles: boolean;
|
|
3
|
+
cancelable: boolean;
|
|
4
|
+
}
|
|
5
|
+
type Target = Record<string, unknown> & {
|
|
6
|
+
dataset: Record<string, unknown>;
|
|
7
|
+
id: string;
|
|
8
|
+
};
|
|
9
|
+
export interface MpEvent {
|
|
10
|
+
type: string;
|
|
11
|
+
detail: Record<string, unknown>;
|
|
12
|
+
target: Target;
|
|
13
|
+
currentTarget: Target;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Shortcuts } from '@tarojs/shared';
|
|
2
|
+
import type { PageConfig } from '@tarojs/taro';
|
|
3
|
+
export interface MpInstance {
|
|
4
|
+
config: PageConfig;
|
|
5
|
+
setData: (data: unknown, cb: () => void) => void;
|
|
6
|
+
route?: string;
|
|
7
|
+
__route__: string;
|
|
8
|
+
$taroParams?: Record<string, unknown>;
|
|
9
|
+
$taroPath: string;
|
|
10
|
+
__data__: any;
|
|
11
|
+
data: any;
|
|
12
|
+
exitState?: any;
|
|
13
|
+
selectComponent: (selector: string) => any;
|
|
14
|
+
}
|
|
15
|
+
export interface MiniElementData {
|
|
16
|
+
[Shortcuts.Childnodes]?: MiniData[];
|
|
17
|
+
[Shortcuts.NodeName]: string;
|
|
18
|
+
[Shortcuts.Class]?: string;
|
|
19
|
+
[Shortcuts.Style]?: string;
|
|
20
|
+
uid?: string;
|
|
21
|
+
sid: string;
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
}
|
|
24
|
+
export interface MiniTextData {
|
|
25
|
+
[Shortcuts.Text]: string;
|
|
26
|
+
[Shortcuts.NodeName]: string;
|
|
27
|
+
}
|
|
28
|
+
export type MiniData = MiniElementData | MiniTextData;
|
|
29
|
+
export type HydratedData = () => MiniData | MiniData[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HydratedData } from './index';
|
|
2
|
+
export type UpdatePayloadValue = string | boolean | HydratedData;
|
|
3
|
+
export type DataTree = Record<string, UpdatePayloadValue | ReturnType<HydratedData>>;
|
|
4
|
+
export interface UpdatePayload {
|
|
5
|
+
path: string;
|
|
6
|
+
value: UpdatePayloadValue;
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TaroElement } from '../dom/element';
|
|
2
|
+
import type { TaroText } from '../dom/text';
|
|
3
|
+
import type { Element, Text } from '../dom-external/inner-html/parser';
|
|
4
|
+
export interface Options {
|
|
5
|
+
prerender: boolean;
|
|
6
|
+
debug: boolean;
|
|
7
|
+
html?: {
|
|
8
|
+
skipElements: Set<string>;
|
|
9
|
+
voidElements: Set<string>;
|
|
10
|
+
closingElements: Set<string>;
|
|
11
|
+
transformText?: (taroText: TaroText, text: Text) => TaroText;
|
|
12
|
+
transformElement?: (taroElement: TaroElement, element: Element) => TaroElement;
|
|
13
|
+
renderHTMLTag: boolean;
|
|
14
|
+
};
|
|
15
|
+
miniGlobal?: any;
|
|
16
|
+
}
|
package/dist/perf.d.ts
ADDED
package/dist/runtime.esm.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { ComponentOptions, VNode } from "vue";
|
|
|
5
5
|
import { Component as Vue3Component } from "@vue/runtime-core";
|
|
6
6
|
import { Component, ComponentClass } from "react";
|
|
7
7
|
import { CombinedVueInstance } from "vue/types/vue";
|
|
8
|
-
declare let document: any;
|
|
9
8
|
declare class ClassList {
|
|
10
9
|
private el;
|
|
11
10
|
private tokenList;
|
|
@@ -104,70 +103,6 @@ declare class TaroText extends TaroNode {
|
|
|
104
103
|
set data(text: string);
|
|
105
104
|
get data(): string;
|
|
106
105
|
}
|
|
107
|
-
// Taro 事件对象。以 Web 标准的事件对象为基础,加入小程序事件对象中携带的部分信息,并模拟实现事件冒泡。
|
|
108
|
-
declare class TaroEvent {
|
|
109
|
-
private cacheTarget;
|
|
110
|
-
private cacheCurrentTarget;
|
|
111
|
-
type: string;
|
|
112
|
-
bubbles: boolean;
|
|
113
|
-
cancelable: boolean;
|
|
114
|
-
_stop: boolean;
|
|
115
|
-
_end: boolean;
|
|
116
|
-
defaultPrevented: boolean;
|
|
117
|
-
// Mouse Event botton property, it's used in 3rd lib, like react-router. default 0 in general
|
|
118
|
-
button: number;
|
|
119
|
-
// timestamp can either be hi-res ( relative to page load) or low-res (relative to UNIX epoch)
|
|
120
|
-
// here use hi-res timestamp
|
|
121
|
-
timeStamp: number;
|
|
122
|
-
mpEvent: MpEvent | undefined;
|
|
123
|
-
constructor(type: string, opts: EventOptions, event?: MpEvent);
|
|
124
|
-
stopPropagation(): void;
|
|
125
|
-
stopImmediatePropagation(): void;
|
|
126
|
-
preventDefault(): void;
|
|
127
|
-
get target(): any;
|
|
128
|
-
get currentTarget(): any;
|
|
129
|
-
}
|
|
130
|
-
declare function createEvent(event: MpEvent | string, node?: TaroElement): TaroEvent;
|
|
131
|
-
// 小程序的事件代理回调函数
|
|
132
|
-
declare function eventHandler(event: MpEvent): any;
|
|
133
|
-
declare class FormElement extends TaroElement {
|
|
134
|
-
get type(): string;
|
|
135
|
-
set type(val: string);
|
|
136
|
-
get value(): string | boolean | number | any[];
|
|
137
|
-
set value(val: string | boolean | number | any[]);
|
|
138
|
-
dispatchEvent(event: TaroEvent): boolean;
|
|
139
|
-
}
|
|
140
|
-
declare class TaroRootElement extends TaroElement {
|
|
141
|
-
private updatePayloads;
|
|
142
|
-
private updateCallbacks;
|
|
143
|
-
pendingUpdate: boolean;
|
|
144
|
-
ctx: null | MpInstance;
|
|
145
|
-
constructor();
|
|
146
|
-
get _path(): string;
|
|
147
|
-
get _root(): TaroRootElement;
|
|
148
|
-
enqueueUpdate(payload: UpdatePayload): void;
|
|
149
|
-
performUpdate(initRender?: boolean, prerender?: Func): void;
|
|
150
|
-
enqueueUpdateCallback(cb: Func, ctx?: Record<string, any>): void;
|
|
151
|
-
flushUpdateCallback(): void;
|
|
152
|
-
}
|
|
153
|
-
declare class TaroDocument extends TaroElement {
|
|
154
|
-
documentElement: TaroElement;
|
|
155
|
-
head: TaroElement;
|
|
156
|
-
body: TaroElement;
|
|
157
|
-
createEvent: typeof createEvent;
|
|
158
|
-
constructor();
|
|
159
|
-
createElement(type: string): TaroElement | TaroRootElement | FormElement;
|
|
160
|
-
// an ugly fake createElementNS to deal with @vue/runtime-dom's
|
|
161
|
-
// support mounting app to svg container since vue@3.0.8
|
|
162
|
-
createElementNS(_svgNS: string, type: string): TaroElement | TaroRootElement | FormElement;
|
|
163
|
-
createTextNode(text: string): TaroText;
|
|
164
|
-
getElementById<T extends TaroElement>(id: string | undefined | null): T | null;
|
|
165
|
-
querySelector<T extends TaroElement>(query: string): T | null;
|
|
166
|
-
querySelectorAll(): never[];
|
|
167
|
-
// @TODO: @PERF: 在 hydrate 移除掉空的 node
|
|
168
|
-
createComment(): TaroText;
|
|
169
|
-
get defaultView(): any;
|
|
170
|
-
}
|
|
171
106
|
interface Node {
|
|
172
107
|
type: string;
|
|
173
108
|
}
|
|
@@ -207,6 +142,19 @@ declare class TaroEventTarget {
|
|
|
207
142
|
removeEventListener(type: string, handler: EventHandler): void;
|
|
208
143
|
isAnyEventBinded(): boolean;
|
|
209
144
|
}
|
|
145
|
+
declare class TaroRootElement extends TaroElement {
|
|
146
|
+
private updatePayloads;
|
|
147
|
+
private updateCallbacks;
|
|
148
|
+
pendingUpdate: boolean;
|
|
149
|
+
ctx: null | MpInstance;
|
|
150
|
+
constructor();
|
|
151
|
+
get _path(): string;
|
|
152
|
+
get _root(): TaroRootElement;
|
|
153
|
+
enqueueUpdate(payload: UpdatePayload): void;
|
|
154
|
+
performUpdate(initRender?: boolean, prerender?: Func): void;
|
|
155
|
+
enqueueUpdateCallback(cb: Func, ctx?: Record<string, any>): void;
|
|
156
|
+
flushUpdateCallback(): void;
|
|
157
|
+
}
|
|
210
158
|
interface RemoveChildOptions {
|
|
211
159
|
cleanRef?: boolean;
|
|
212
160
|
doUpdate?: boolean;
|
|
@@ -290,7 +238,34 @@ declare class Style {
|
|
|
290
238
|
removeProperty(propertyName: string): string;
|
|
291
239
|
getPropertyValue(propertyName: string): any;
|
|
292
240
|
}
|
|
241
|
+
// Taro 事件对象。以 Web 标准的事件对象为基础,加入小程序事件对象中携带的部分信息,并模拟实现事件冒泡。
|
|
242
|
+
declare class TaroEvent {
|
|
243
|
+
private cacheTarget;
|
|
244
|
+
private cacheCurrentTarget;
|
|
245
|
+
type: string;
|
|
246
|
+
bubbles: boolean;
|
|
247
|
+
cancelable: boolean;
|
|
248
|
+
_stop: boolean;
|
|
249
|
+
_end: boolean;
|
|
250
|
+
defaultPrevented: boolean;
|
|
251
|
+
// Mouse Event botton property, it's used in 3rd lib, like react-router. default 0 in general
|
|
252
|
+
button: number;
|
|
253
|
+
// timestamp can either be hi-res ( relative to page load) or low-res (relative to UNIX epoch)
|
|
254
|
+
// here use hi-res timestamp
|
|
255
|
+
timeStamp: number;
|
|
256
|
+
mpEvent: MpEvent | undefined;
|
|
257
|
+
constructor(type: string, opts: EventOptions, event?: MpEvent);
|
|
258
|
+
stopPropagation(): void;
|
|
259
|
+
stopImmediatePropagation(): void;
|
|
260
|
+
preventDefault(): void;
|
|
261
|
+
get target(): any;
|
|
262
|
+
get currentTarget(): any;
|
|
263
|
+
}
|
|
264
|
+
declare function createEvent(event: MpEvent | string, node?: TaroElement): TaroEvent;
|
|
265
|
+
// 小程序的事件代理回调函数
|
|
266
|
+
declare function eventHandler(event: MpEvent): any;
|
|
293
267
|
declare class TaroElement extends TaroNode {
|
|
268
|
+
ctx?: any;
|
|
294
269
|
tagName: string;
|
|
295
270
|
props: Record<string, any>;
|
|
296
271
|
style: Style;
|
|
@@ -324,6 +299,37 @@ declare class TaroElement extends TaroNode {
|
|
|
324
299
|
removeEventListener(type: any, handler: any, sideEffect?: boolean): void;
|
|
325
300
|
static extend(methodName: string, options: Func | Record<string, any>): void;
|
|
326
301
|
}
|
|
302
|
+
declare class FormElement extends TaroElement {
|
|
303
|
+
get type(): string;
|
|
304
|
+
set type(val: string);
|
|
305
|
+
get value(): string | boolean | number | any[];
|
|
306
|
+
set value(val: string | boolean | number | any[]);
|
|
307
|
+
dispatchEvent(event: TaroEvent): boolean;
|
|
308
|
+
}
|
|
309
|
+
declare class TaroDocument extends TaroElement {
|
|
310
|
+
documentElement: TaroElement;
|
|
311
|
+
head: TaroElement;
|
|
312
|
+
body: TaroElement;
|
|
313
|
+
createEvent: typeof createEvent;
|
|
314
|
+
constructor();
|
|
315
|
+
createElement(type: string): TaroElement | TaroRootElement | FormElement;
|
|
316
|
+
// an ugly fake createElementNS to deal with @vue/runtime-dom's
|
|
317
|
+
// support mounting app to svg container since vue@3.0.8
|
|
318
|
+
createElementNS(_svgNS: string, type: string): TaroElement | TaroRootElement | FormElement;
|
|
319
|
+
createTextNode(text: string): TaroText;
|
|
320
|
+
getElementById<T extends TaroElement>(id: string | undefined | null): T | null;
|
|
321
|
+
querySelector<T extends TaroElement>(query: string): T | null;
|
|
322
|
+
querySelectorAll(): never[];
|
|
323
|
+
// @TODO: @PERF: 在 hydrate 移除掉空的 node
|
|
324
|
+
createComment(): TaroText;
|
|
325
|
+
get defaultView(): any;
|
|
326
|
+
}
|
|
327
|
+
interface Env {
|
|
328
|
+
window: any;
|
|
329
|
+
document: TaroDocument;
|
|
330
|
+
}
|
|
331
|
+
declare const env: Env;
|
|
332
|
+
declare let document: any;
|
|
327
333
|
declare function getComputedStyle(element: TaroElement): Style;
|
|
328
334
|
declare const eventCenter: Events;
|
|
329
335
|
type EventsType = typeof Events;
|
|
@@ -583,8 +589,68 @@ declare class MutationObserver {
|
|
|
583
589
|
takeRecords(): MutationRecord[];
|
|
584
590
|
static record(record: MutationRecord): void;
|
|
585
591
|
}
|
|
592
|
+
declare const PROPERTY_THRESHOLD = 2046;
|
|
593
|
+
declare const TARO_RUNTIME = "Taro runtime";
|
|
594
|
+
declare const HOOKS_APP_ID = "taro-app";
|
|
595
|
+
declare const SET_DATA = "\u5C0F\u7A0B\u5E8F setData";
|
|
596
|
+
declare const PAGE_INIT = "\u9875\u9762\u521D\u59CB\u5316";
|
|
597
|
+
declare const ROOT_STR = "root";
|
|
598
|
+
declare const HTML = "html";
|
|
599
|
+
declare const HEAD = "head";
|
|
600
|
+
declare const BODY = "body";
|
|
601
|
+
declare const APP = "app";
|
|
602
|
+
declare const CONTAINER = "container";
|
|
603
|
+
declare const DOCUMENT_ELEMENT_NAME = "#document";
|
|
604
|
+
declare const DOCUMENT_FRAGMENT = "document-fragment";
|
|
605
|
+
declare const ID = "id";
|
|
606
|
+
declare const UID = "uid";
|
|
607
|
+
declare const CLASS = "class";
|
|
608
|
+
declare const STYLE = "style";
|
|
609
|
+
declare const FOCUS = "focus";
|
|
610
|
+
declare const VIEW = "view";
|
|
611
|
+
declare const STATIC_VIEW = "static-view";
|
|
612
|
+
declare const PURE_VIEW = "pure-view";
|
|
613
|
+
declare const PROPS = "props";
|
|
614
|
+
declare const DATASET = "dataset";
|
|
615
|
+
declare const OBJECT = "object";
|
|
616
|
+
declare const VALUE = "value";
|
|
617
|
+
declare const INPUT = "input";
|
|
618
|
+
declare const CHANGE = "change";
|
|
619
|
+
declare const CUSTOM_WRAPPER = "custom-wrapper";
|
|
620
|
+
declare const TARGET = "target";
|
|
621
|
+
declare const CURRENT_TARGET = "currentTarget";
|
|
622
|
+
declare const TYPE = "type";
|
|
623
|
+
declare const CONFIRM = "confirm";
|
|
624
|
+
declare const TIME_STAMP = "timeStamp";
|
|
625
|
+
declare const KEY_CODE = "keyCode";
|
|
626
|
+
declare const TOUCHMOVE = "touchmove";
|
|
627
|
+
declare const DATE = "Date";
|
|
628
|
+
declare const SET_TIMEOUT = "setTimeout";
|
|
629
|
+
declare const COMPILE_MODE = "compileMode";
|
|
630
|
+
declare const CATCHMOVE = "catchMove";
|
|
631
|
+
declare const CATCH_VIEW = "catch-view";
|
|
632
|
+
declare const COMMENT = "comment";
|
|
633
|
+
declare const ON_LOAD = "onLoad";
|
|
634
|
+
declare const ON_READY = "onReady";
|
|
635
|
+
declare const ON_SHOW = "onShow";
|
|
636
|
+
declare const ON_HIDE = "onHide";
|
|
637
|
+
declare const OPTIONS = "options";
|
|
638
|
+
declare const EXTERNAL_CLASSES = "externalClasses";
|
|
639
|
+
declare const EVENT_CALLBACK_RESULT = "e_result";
|
|
640
|
+
declare const BEHAVIORS = "behaviors";
|
|
641
|
+
declare const A = "a";
|
|
642
|
+
/**
|
|
643
|
+
* 页面上下文切换时的行为
|
|
644
|
+
*/
|
|
645
|
+
declare enum CONTEXT_ACTIONS {
|
|
646
|
+
INIT = "0",
|
|
647
|
+
RESTORE = "1",
|
|
648
|
+
RECOVER = "2",
|
|
649
|
+
DESTORY = "3"
|
|
650
|
+
}
|
|
586
651
|
interface Instance<T = Record<string, any>> extends Component<T>, Show, PageInstance {
|
|
587
652
|
tid?: string;
|
|
653
|
+
node?: TaroElement;
|
|
588
654
|
$forceUpdate?(): void;
|
|
589
655
|
$nextTick?(cb: () => void): void;
|
|
590
656
|
$options: Instance;
|
|
@@ -656,6 +722,7 @@ interface Show {
|
|
|
656
722
|
interface AppInstance extends Show {
|
|
657
723
|
componentDidShow?(options?: Record<string, unknown>): void;
|
|
658
724
|
mount?(component: React.ComponentClass | ComponentOptions<VueCtor> | Vue3Component, id: string, cb: (...args: any[]) => void): void;
|
|
725
|
+
mount?(component: React.ComponentClass | ComponentOptions<VueCtor> | Vue3Component, id: string, getCtx: (...args: any[]) => void, cb: (...args: any[]) => void): void;
|
|
659
726
|
onError?(error: string): void;
|
|
660
727
|
onLaunch?(options?: Record<string, unknown>): void;
|
|
661
728
|
onPageNotFound?(res: any): void;
|
|
@@ -694,6 +761,9 @@ declare function addLeadingSlash(path?: string): string;
|
|
|
694
761
|
declare function safeExecute(path: string, lifecycle: string, ...args: unknown[]): any;
|
|
695
762
|
declare function stringify(obj?: Record<string, unknown>): string;
|
|
696
763
|
declare function getPath(id: string, options?: Record<string, unknown>): string;
|
|
764
|
+
declare function getOnReadyEventKey(path: string): string;
|
|
765
|
+
declare function getOnShowEventKey(path: string): string;
|
|
766
|
+
declare function getOnHideEventKey(path: string): string;
|
|
697
767
|
declare function createPageConfig(component: any, pageName?: string, data?: Record<string, unknown>, pageConfig?: PageConfig): PageInstance;
|
|
698
768
|
declare function createComponentConfig(component: React.ComponentClass, componentName?: string, data?: Record<string, unknown>): any;
|
|
699
769
|
declare function createRecursiveComponentConfig(componentName?: string): any;
|
|
@@ -708,4 +778,4 @@ declare const nextTick: (cb: Func, ctx?: Record<string, any>) => void;
|
|
|
708
778
|
declare const options: Options;
|
|
709
779
|
declare const incrementId: () => () => string;
|
|
710
780
|
export { hooks } from '@tarojs/shared';
|
|
711
|
-
export { document, getComputedStyle, History, Location, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, parseUrl, URL, URLSearchParams, history, location, window, TaroElement, createEvent, eventHandler, TaroEvent, FormElement, TaroNode, TaroRootElement, Style, SVGElement, TaroText, MutationObserver, Current, getCurrentInstance, eventSource, addLeadingSlash, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify, EventsType, eventCenter, Events, hydrate, nextTick, options, incrementId, Instance, VueAppInstance, VueInstance, PageProps, ReactPageComponent, ReactPageInstance, ReactAppInstance, PageLifeCycle, PageInstance, AppInstance, Attributes, EventOptions, MpEvent, EventListenerOptions, AddEventListenerOptions, EventHandler, MpInstance, MiniElementData, MiniData, HydratedData, UpdatePayloadValue, DataTree, UpdatePayload, Options$0 as Options, Func, Ctx };
|
|
781
|
+
export { document, getComputedStyle, History, Location, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, parseUrl, URL, URLSearchParams, history, location, window, TaroElement, createEvent, eventHandler, TaroEvent, FormElement, TaroNode, TaroRootElement, Style, SVGElement, TaroText, MutationObserver, env, PROPERTY_THRESHOLD, TARO_RUNTIME, HOOKS_APP_ID, SET_DATA, PAGE_INIT, ROOT_STR, HTML, HEAD, BODY, APP, CONTAINER, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, ID, UID, CLASS, STYLE, FOCUS, VIEW, STATIC_VIEW, PURE_VIEW, PROPS, DATASET, OBJECT, VALUE, INPUT, CHANGE, CUSTOM_WRAPPER, TARGET, CURRENT_TARGET, TYPE, CONFIRM, TIME_STAMP, KEY_CODE, TOUCHMOVE, DATE, SET_TIMEOUT, COMPILE_MODE, CATCHMOVE, CATCH_VIEW, COMMENT, ON_LOAD, ON_READY, ON_SHOW, ON_HIDE, OPTIONS, EXTERNAL_CLASSES, EVENT_CALLBACK_RESULT, BEHAVIORS, A, CONTEXT_ACTIONS, Current, getCurrentInstance, eventSource, addLeadingSlash, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify, EventsType, eventCenter, Events, hydrate, nextTick, options, incrementId, Instance, VueAppInstance, VueInstance, PageProps, ReactPageComponent, ReactPageInstance, ReactAppInstance, PageLifeCycle, PageInstance, AppInstance, Attributes, EventOptions, MpEvent, EventListenerOptions, AddEventListenerOptions, EventHandler, MpInstance, MiniElementData, MiniTextData, MiniData, HydratedData, UpdatePayloadValue, DataTree, UpdatePayload, Options$0 as Options, Func, Ctx };
|