vite-plugin-taro-runtime 0.6.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/LICENSE +174 -0
- package/README.md +45 -0
- package/dist/bom/URL.d.ts +53 -0
- package/dist/bom/URL.js +222 -0
- package/dist/bom/URL.js.map +1 -0
- package/dist/bom/URLSearchParams.d.ts +3 -0
- package/dist/bom/URLSearchParams.js +131 -0
- package/dist/bom/URLSearchParams.js.map +1 -0
- package/dist/bom/document.d.ts +5 -0
- package/dist/bom/document.js +185 -0
- package/dist/bom/document.js.map +1 -0
- package/dist/bom/getComputedStyle.d.ts +8 -0
- package/dist/bom/getComputedStyle.js +9 -0
- package/dist/bom/getComputedStyle.js.map +1 -0
- package/dist/bom/history.d.ts +34 -0
- package/dist/bom/history.js +121 -0
- package/dist/bom/history.js.map +1 -0
- package/dist/bom/location.d.ts +40 -0
- package/dist/bom/location.js +240 -0
- package/dist/bom/location.js.map +1 -0
- package/dist/bom/navigator.d.ts +3 -0
- package/dist/bom/navigator.js +24 -0
- package/dist/bom/navigator.js.map +1 -0
- package/dist/bom/raf.d.ts +5 -0
- package/dist/bom/raf.js +33 -0
- package/dist/bom/raf.js.map +1 -0
- package/dist/bom/window.d.ts +28 -0
- package/dist/bom/window.js +93 -0
- package/dist/bom/window.js.map +1 -0
- package/dist/constants/index.d.ts +59 -0
- package/dist/constants/index.js +62 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/current.d.ts +22 -0
- package/dist/current.js +9 -0
- package/dist/current.js.map +1 -0
- package/dist/dom/anchor-element.js +54 -0
- package/dist/dom/anchor-element.js.map +1 -0
- package/dist/dom/class-list.d.ts +19 -0
- package/dist/dom/class-list.js +92 -0
- package/dist/dom/class-list.js.map +1 -0
- package/dist/dom/document.d.ts +24 -0
- package/dist/dom/document.js +80 -0
- package/dist/dom/document.js.map +1 -0
- package/dist/dom/element.d.ts +43 -0
- package/dist/dom/element.js +317 -0
- package/dist/dom/element.js.map +1 -0
- package/dist/dom/event-source.d.ts +9 -0
- package/dist/dom/event-source.js +17 -0
- package/dist/dom/event-source.js.map +1 -0
- package/dist/dom/event-target.d.ts +11 -0
- package/dist/dom/event-target.js +83 -0
- package/dist/dom/event-target.js.map +1 -0
- package/dist/dom/event.d.ts +27 -0
- package/dist/dom/event.js +160 -0
- package/dist/dom/event.js.map +1 -0
- package/dist/dom/form.d.ts +12 -0
- package/dist/dom/form.js +38 -0
- package/dist/dom/form.js.map +1 -0
- package/dist/dom/node.d.ts +79 -0
- package/dist/dom/node.js +301 -0
- package/dist/dom/node.js.map +1 -0
- package/dist/dom/node_types.d.ts +12 -0
- package/dist/dom/root.d.ts +21 -0
- package/dist/dom/root.js +186 -0
- package/dist/dom/root.js.map +1 -0
- package/dist/dom/style.d.ts +17 -0
- package/dist/dom/style.js +168 -0
- package/dist/dom/style.js.map +1 -0
- package/dist/dom/style_properties.js +187 -0
- package/dist/dom/style_properties.js.map +1 -0
- package/dist/dom/svg.d.ts +6 -0
- package/dist/dom/svg.js +8 -0
- package/dist/dom/svg.js.map +1 -0
- package/dist/dom/text.d.ts +17 -0
- package/dist/dom/text.js +41 -0
- package/dist/dom/text.js.map +1 -0
- package/dist/dom/transfer.js +15 -0
- package/dist/dom/transfer.js.map +1 -0
- package/dist/dom/tree.js +38 -0
- package/dist/dom/tree.js.map +1 -0
- package/dist/dom-external/element.js +36 -0
- package/dist/dom-external/element.js.map +1 -0
- package/dist/dom-external/index.js +39 -0
- package/dist/dom-external/index.js.map +1 -0
- package/dist/dom-external/inner-html/html.d.ts +5 -0
- package/dist/dom-external/inner-html/html.js +35 -0
- package/dist/dom-external/inner-html/html.js.map +1 -0
- package/dist/dom-external/inner-html/parser.d.ts +20 -0
- package/dist/dom-external/inner-html/parser.js +216 -0
- package/dist/dom-external/inner-html/parser.js.map +1 -0
- package/dist/dom-external/inner-html/scanner.js +304 -0
- package/dist/dom-external/inner-html/scanner.js.map +1 -0
- package/dist/dom-external/inner-html/style.js +235 -0
- package/dist/dom-external/inner-html/style.js.map +1 -0
- package/dist/dom-external/inner-html/tags.js +26 -0
- package/dist/dom-external/inner-html/tags.js.map +1 -0
- package/dist/dom-external/inner-html/utils.js +12 -0
- package/dist/dom-external/inner-html/utils.js.map +1 -0
- package/dist/dom-external/mutation-observer/implements.d.ts +55 -0
- package/dist/dom-external/mutation-observer/implements.js +108 -0
- package/dist/dom-external/mutation-observer/implements.js.map +1 -0
- package/dist/dom-external/mutation-observer/index.d.ts +15 -0
- package/dist/dom-external/mutation-observer/index.js +35 -0
- package/dist/dom-external/mutation-observer/index.js.map +1 -0
- package/dist/dom-external/mutation-observer/record.d.ts +28 -0
- package/dist/dom-external/node.js +75 -0
- package/dist/dom-external/node.js.map +1 -0
- package/dist/dsl/common.d.ts +17 -0
- package/dist/dsl/common.js +376 -0
- package/dist/dsl/common.js.map +1 -0
- package/dist/dsl/instance.d.ts +97 -0
- package/dist/emitter/emitter.d.ts +8 -0
- package/dist/emitter/emitter.js +7 -0
- package/dist/emitter/emitter.js.map +1 -0
- package/dist/env.d.ts +9 -0
- package/dist/env.js +9 -0
- package/dist/env.js.map +1 -0
- package/dist/hydrate.d.ts +13 -0
- package/dist/hydrate.js +104 -0
- package/dist/hydrate.js.map +1 -0
- package/dist/index.cjs.d.ts +921 -0
- package/dist/index.cjs.js +5401 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/interface/animate.d.ts +83 -0
- package/dist/interface/element.d.ts +6 -0
- package/dist/interface/event-target.d.ts +13 -0
- package/dist/interface/event.d.ts +16 -0
- package/dist/interface/hydrate.d.ts +33 -0
- package/dist/interface/node.d.ts +10 -0
- package/dist/interface/options.d.ts +19 -0
- package/dist/interface/utils.d.ts +4 -0
- package/dist/next-tick.d.ts +5 -0
- package/dist/next-tick.js +47 -0
- package/dist/next-tick.js.map +1 -0
- package/dist/options.d.ts +5 -0
- package/dist/options.js +7 -0
- package/dist/options.js.map +1 -0
- package/dist/perf.d.ts +10 -0
- package/dist/perf.js +49 -0
- package/dist/perf.js.map +1 -0
- package/dist/polyfill/array.js +56 -0
- package/dist/polyfill/array.js.map +1 -0
- package/dist/polyfill/index.d.ts +3 -0
- package/dist/polyfill/index.js +34 -0
- package/dist/polyfill/index.js.map +1 -0
- package/dist/polyfill/intersection-observer.js +597 -0
- package/dist/polyfill/intersection-observer.js.map +1 -0
- package/dist/polyfill/object.js +102 -0
- package/dist/polyfill/object.js.map +1 -0
- package/dist/runtime.esm.d.ts +921 -0
- package/dist/runtime.esm.js +5274 -0
- package/dist/runtime.esm.js.map +1 -0
- package/dist/utils/cache.d.ts +14 -0
- package/dist/utils/cache.js +27 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/index.d.ts +26 -0
- package/dist/utils/index.js +99 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/lodash.d.ts +4 -0
- package/dist/utils/lodash.js +32 -0
- package/dist/utils/lodash.js.map +1 -0
- package/dist/utils/router.d.ts +9 -0
- package/dist/utils/router.js +24 -0
- package/dist/utils/router.js.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,921 @@
|
|
|
1
|
+
import { Shortcuts, Events } from '@tarojs/shared';
|
|
2
|
+
export { Events, hooks } from '@tarojs/shared';
|
|
3
|
+
import { Component } from '@vue/runtime-core';
|
|
4
|
+
import { Component as Component$1, ComponentClass } from 'react';
|
|
5
|
+
|
|
6
|
+
declare class ClassList {
|
|
7
|
+
private el;
|
|
8
|
+
private tokenList;
|
|
9
|
+
constructor(className: string, el: TaroElement);
|
|
10
|
+
get value(): string;
|
|
11
|
+
get length(): number;
|
|
12
|
+
add(): void;
|
|
13
|
+
remove(): void;
|
|
14
|
+
contains(token: string): boolean;
|
|
15
|
+
toggle(token: string, force: boolean): boolean;
|
|
16
|
+
replace(token: string, replacement_token: string): void;
|
|
17
|
+
toString(): string;
|
|
18
|
+
private checkTokenIsValid;
|
|
19
|
+
private _update;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** @ignore */
|
|
23
|
+
interface KeyFrame {
|
|
24
|
+
/** 关键帧的偏移,范围[0-1] */
|
|
25
|
+
offset?: number;
|
|
26
|
+
/** 动画缓动函数 */
|
|
27
|
+
ease?: string;
|
|
28
|
+
/** 基点位置,即 CSS transform-origin */
|
|
29
|
+
transformOrigin?: string;
|
|
30
|
+
/** 背景颜色,即 CSS background-color */
|
|
31
|
+
backgroundColor?: string;
|
|
32
|
+
/** 底边位置,即 CSS bottom */
|
|
33
|
+
bottom?: number | string;
|
|
34
|
+
/** 高度,即 CSS height */
|
|
35
|
+
height?: number | string;
|
|
36
|
+
/** 左边位置,即 CSS left */
|
|
37
|
+
left?: number | string;
|
|
38
|
+
/** 宽度,即 CSS width */
|
|
39
|
+
width?: number | string;
|
|
40
|
+
/** 不透明度,即 CSS opacity */
|
|
41
|
+
opacity?: number | string;
|
|
42
|
+
/** 右边位置,即 CSS right */
|
|
43
|
+
right?: number | string;
|
|
44
|
+
/** 顶边位置,即 CSS top */
|
|
45
|
+
top?: number | string;
|
|
46
|
+
/** 变换矩阵,即 CSS transform matrix */
|
|
47
|
+
matrix?: number[];
|
|
48
|
+
/** 三维变换矩阵,即 CSS transform matrix3d */
|
|
49
|
+
matrix3d?: number[];
|
|
50
|
+
/** 旋转,即 CSS transform rotate */
|
|
51
|
+
rotate?: number;
|
|
52
|
+
/** 三维旋转,即 CSS transform rotate3d */
|
|
53
|
+
rotate3d?: number[];
|
|
54
|
+
/** X 方向旋转,即 CSS transform rotateX */
|
|
55
|
+
rotateX?: number;
|
|
56
|
+
/** Y 方向旋转,即 CSS transform rotateY */
|
|
57
|
+
rotateY?: number;
|
|
58
|
+
/** Z 方向旋转,即 CSS transform rotateZ */
|
|
59
|
+
rotateZ?: number;
|
|
60
|
+
/** 缩放,即 CSS transform scale */
|
|
61
|
+
scale?: number[];
|
|
62
|
+
/** 三维缩放,即 CSS transform scale3d */
|
|
63
|
+
scale3d?: number[];
|
|
64
|
+
/** X 方向缩放,即 CSS transform scaleX */
|
|
65
|
+
scaleX?: number;
|
|
66
|
+
/** Y 方向缩放,即 CSS transform scaleY */
|
|
67
|
+
scaleY?: number;
|
|
68
|
+
/** Z 方向缩放,即 CSS transform scaleZ */
|
|
69
|
+
scaleZ?: number;
|
|
70
|
+
/** 倾斜,即 CSS transform skew */
|
|
71
|
+
skew?: number[];
|
|
72
|
+
/** X 方向倾斜,即 CSS transform skewX */
|
|
73
|
+
skewX?: number;
|
|
74
|
+
/** Y 方向倾斜,即 CSS transform skewY */
|
|
75
|
+
skewY?: number;
|
|
76
|
+
/** 位移,即 CSS transform translate */
|
|
77
|
+
translate?: Array<number | string>;
|
|
78
|
+
/** 三维位移,即 CSS transform translate3d */
|
|
79
|
+
translate3d?: Array<number | string>;
|
|
80
|
+
/** X 方向位移,即 CSS transform translateX */
|
|
81
|
+
translateX?: number | string;
|
|
82
|
+
/** Y 方向位移,即 CSS transform translateY */
|
|
83
|
+
translateY?: number | string;
|
|
84
|
+
/** Z 方向位移,即 CSS transform translateZ */
|
|
85
|
+
translateZ?: number | string;
|
|
86
|
+
composite?: 'replace' | 'add' | 'accumulate' | 'auto';
|
|
87
|
+
easing?: string;
|
|
88
|
+
[property: string]: any;
|
|
89
|
+
}
|
|
90
|
+
/** @ignore */
|
|
91
|
+
interface ScrollTimelineOption {
|
|
92
|
+
/** 指定滚动元素的选择器(只支持 scroll-view),该元素滚动时会驱动动画的进度 */
|
|
93
|
+
scrollSource: string;
|
|
94
|
+
/** 指定滚动的方向。有效值为 horizontal 或 vertical */
|
|
95
|
+
orientation?: string;
|
|
96
|
+
/** 指定开始驱动动画进度的滚动偏移量,单位 px */
|
|
97
|
+
startScrollOffset: number;
|
|
98
|
+
/** 指定停止驱动动画进度的滚动偏移量,单位 px */
|
|
99
|
+
endScrollOffset: number;
|
|
100
|
+
/** 起始和结束的滚动范围映射的时间长度,该时间可用于与关键帧动画里的时间 (duration) 相匹配,单位 ms */
|
|
101
|
+
timeRange: number;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
interface Attributes {
|
|
105
|
+
name: string;
|
|
106
|
+
value: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
interface EventOptions {
|
|
110
|
+
bubbles: boolean;
|
|
111
|
+
cancelable: boolean;
|
|
112
|
+
}
|
|
113
|
+
type Target = Record<string, unknown> & {
|
|
114
|
+
dataset: Record<string, unknown>;
|
|
115
|
+
id: string;
|
|
116
|
+
};
|
|
117
|
+
interface MpEvent {
|
|
118
|
+
type: string;
|
|
119
|
+
detail: Record<string, unknown>;
|
|
120
|
+
target: Target;
|
|
121
|
+
currentTarget: Target;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
interface EventListenerOptions {
|
|
125
|
+
capture?: boolean;
|
|
126
|
+
}
|
|
127
|
+
interface AddEventListenerOptions extends EventListenerOptions {
|
|
128
|
+
once?: boolean;
|
|
129
|
+
passive?: boolean;
|
|
130
|
+
}
|
|
131
|
+
interface EventHandler<T = any, R = void> {
|
|
132
|
+
(...args: T[]): R;
|
|
133
|
+
_stop?: boolean;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
type TFunc = (...args: any[]) => any;
|
|
137
|
+
type PageConfig = Record<string, any>;
|
|
138
|
+
|
|
139
|
+
interface MpInstance {
|
|
140
|
+
config: PageConfig;
|
|
141
|
+
setData: (data: unknown, cb: () => void) => void;
|
|
142
|
+
route?: string;
|
|
143
|
+
__route__: string;
|
|
144
|
+
$taroParams?: Record<string, unknown>;
|
|
145
|
+
$taroPath: string;
|
|
146
|
+
__data__: any;
|
|
147
|
+
data: any;
|
|
148
|
+
exitState?: any;
|
|
149
|
+
selectComponent: (selector: string) => any;
|
|
150
|
+
__webviewId__?: number;
|
|
151
|
+
}
|
|
152
|
+
interface MiniElementData {
|
|
153
|
+
[Shortcuts.Childnodes]?: MiniData[];
|
|
154
|
+
[Shortcuts.NodeName]: string;
|
|
155
|
+
[Shortcuts.Class]?: string;
|
|
156
|
+
[Shortcuts.Style]?: string;
|
|
157
|
+
uid?: string;
|
|
158
|
+
sid: string;
|
|
159
|
+
[key: string]: unknown;
|
|
160
|
+
}
|
|
161
|
+
interface MiniTextData {
|
|
162
|
+
[Shortcuts.Text]: string;
|
|
163
|
+
[Shortcuts.NodeName]: string;
|
|
164
|
+
}
|
|
165
|
+
type MiniData = MiniElementData | MiniTextData;
|
|
166
|
+
type HydratedData = () => MiniData | MiniData[];
|
|
167
|
+
|
|
168
|
+
type UpdatePayloadValue = string | boolean | HydratedData;
|
|
169
|
+
type DataTree = Record<string, UpdatePayloadValue | ReturnType<HydratedData>>;
|
|
170
|
+
interface UpdatePayload {
|
|
171
|
+
path: string;
|
|
172
|
+
value: UpdatePayloadValue;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
declare const enum NodeType {
|
|
176
|
+
ELEMENT_NODE = 1,
|
|
177
|
+
ATTRIBUTE_NODE = 2,
|
|
178
|
+
TEXT_NODE = 3,
|
|
179
|
+
CDATA_SECTION_NODE = 4,
|
|
180
|
+
ENTITY_REFERENCE_NODE = 5,
|
|
181
|
+
COMMENT_NODE = 6,
|
|
182
|
+
PROCESSING_INSTRUCTION_NODE = 7,
|
|
183
|
+
DOCUMENT_NODE = 9
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
declare class TaroText extends TaroNode {
|
|
187
|
+
_value: string;
|
|
188
|
+
nodeType: NodeType;
|
|
189
|
+
nodeName: string;
|
|
190
|
+
constructor(value: any);
|
|
191
|
+
set textContent(text: string);
|
|
192
|
+
get textContent(): string;
|
|
193
|
+
set nodeValue(text: string);
|
|
194
|
+
get nodeValue(): string;
|
|
195
|
+
set data(text: string);
|
|
196
|
+
get data(): string;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
interface Node {
|
|
200
|
+
type: string;
|
|
201
|
+
}
|
|
202
|
+
interface Comment extends Node {
|
|
203
|
+
type: 'comment';
|
|
204
|
+
content: string;
|
|
205
|
+
}
|
|
206
|
+
interface Text extends Node {
|
|
207
|
+
type: 'text';
|
|
208
|
+
content: string;
|
|
209
|
+
}
|
|
210
|
+
interface Element extends Node {
|
|
211
|
+
type: 'element';
|
|
212
|
+
tagName: string;
|
|
213
|
+
children: ChildNode[];
|
|
214
|
+
attributes: string[];
|
|
215
|
+
}
|
|
216
|
+
type ChildNode = Comment | Text | Element;
|
|
217
|
+
|
|
218
|
+
interface Options$2 {
|
|
219
|
+
prerender: boolean;
|
|
220
|
+
debug: boolean;
|
|
221
|
+
html?: {
|
|
222
|
+
skipElements: Set<string>;
|
|
223
|
+
voidElements: Set<string>;
|
|
224
|
+
closingElements: Set<string>;
|
|
225
|
+
transformText?: (taroText: TaroText, text: Text) => TaroText;
|
|
226
|
+
transformElement?: (taroElement: TaroElement, element: Element) => TaroElement;
|
|
227
|
+
renderHTMLTag: boolean;
|
|
228
|
+
};
|
|
229
|
+
miniGlobal?: any;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
declare class TaroEventTarget {
|
|
233
|
+
__handlers: Record<string, EventHandler[]>;
|
|
234
|
+
addEventListener(type: string, handler: EventHandler, options?: boolean | AddEventListenerOptions): void;
|
|
235
|
+
removeEventListener(type: string, handler: EventHandler): void;
|
|
236
|
+
isAnyEventBinded(): boolean;
|
|
237
|
+
isOnlyClickBinded(): boolean;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
declare class TaroRootElement extends TaroElement {
|
|
241
|
+
private updatePayloads;
|
|
242
|
+
private updateCallbacks;
|
|
243
|
+
pendingUpdate: boolean;
|
|
244
|
+
ctx: null | MpInstance;
|
|
245
|
+
constructor();
|
|
246
|
+
get _path(): string;
|
|
247
|
+
get _root(): TaroRootElement;
|
|
248
|
+
scheduleTask(fn: TFunc): void;
|
|
249
|
+
enqueueUpdate(payload: UpdatePayload): void;
|
|
250
|
+
performUpdate(initRender?: boolean, prerender?: TFunc): void;
|
|
251
|
+
enqueueUpdateCallback(cb: TFunc, ctx?: Record<string, any>): void;
|
|
252
|
+
flushUpdateCallback(): void;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
interface RemoveChildOptions {
|
|
256
|
+
cleanRef?: boolean;
|
|
257
|
+
doUpdate?: boolean;
|
|
258
|
+
}
|
|
259
|
+
declare class TaroNode extends TaroEventTarget {
|
|
260
|
+
uid: string;
|
|
261
|
+
sid: string;
|
|
262
|
+
nodeType: NodeType;
|
|
263
|
+
nodeName: string;
|
|
264
|
+
parentNode: TaroNode | null;
|
|
265
|
+
childNodes: TaroNode[];
|
|
266
|
+
constructor();
|
|
267
|
+
private hydrate;
|
|
268
|
+
private updateChildNodes;
|
|
269
|
+
private updateSingleChild;
|
|
270
|
+
get _root(): TaroRootElement | null;
|
|
271
|
+
protected findIndex(refChild: TaroNode): number;
|
|
272
|
+
get _path(): string;
|
|
273
|
+
get nextSibling(): TaroNode | null;
|
|
274
|
+
get previousSibling(): TaroNode | null;
|
|
275
|
+
get parentElement(): TaroElement | null;
|
|
276
|
+
get firstChild(): TaroNode | null;
|
|
277
|
+
get lastChild(): TaroNode | null;
|
|
278
|
+
/**
|
|
279
|
+
* @textContent 目前只能置空子元素
|
|
280
|
+
* @TODO 等待完整 innerHTML 实现
|
|
281
|
+
*/
|
|
282
|
+
set textContent(text: string);
|
|
283
|
+
/**
|
|
284
|
+
* @doc https://developer.mozilla.org/zh-CN/docs/Web/API/Node/insertBefore
|
|
285
|
+
* @scenario
|
|
286
|
+
* [A,B,C]
|
|
287
|
+
* 1. insert D before C, D has no parent
|
|
288
|
+
* 2. insert D before C, D has the same parent of C
|
|
289
|
+
* 3. insert D before C, D has the different parent of C
|
|
290
|
+
*/
|
|
291
|
+
insertBefore<T extends TaroNode>(newChild: T, refChild?: TaroNode | null, isReplace?: boolean): T;
|
|
292
|
+
/**
|
|
293
|
+
* @doc https://developer.mozilla.org/zh-CN/docs/Web/API/Node/appendChild
|
|
294
|
+
* @scenario
|
|
295
|
+
* [A,B,C]
|
|
296
|
+
* 1. append C, C has no parent
|
|
297
|
+
* 2. append C, C has the same parent of B
|
|
298
|
+
* 3. append C, C has the different parent of B
|
|
299
|
+
*/
|
|
300
|
+
appendChild(newChild: TaroNode): TaroNode;
|
|
301
|
+
/**
|
|
302
|
+
* @doc https://developer.mozilla.org/zh-CN/docs/Web/API/Node/replaceChild
|
|
303
|
+
* @scenario
|
|
304
|
+
* [A,B,C]
|
|
305
|
+
* 1. replace B with C, C has no parent
|
|
306
|
+
* 2. replace B with C, C has no parent, C has the same parent of B
|
|
307
|
+
* 3. replace B with C, C has no parent, C has the different parent of B
|
|
308
|
+
*/
|
|
309
|
+
replaceChild(newChild: TaroNode, oldChild: TaroNode): TaroNode | undefined;
|
|
310
|
+
/**
|
|
311
|
+
* @doc https://developer.mozilla.org/zh-CN/docs/Web/API/Node/removeChild
|
|
312
|
+
* @scenario
|
|
313
|
+
* [A,B,C]
|
|
314
|
+
* 1. remove A or B
|
|
315
|
+
* 2. remove C
|
|
316
|
+
*/
|
|
317
|
+
removeChild<T extends TaroNode>(child: T, options?: RemoveChildOptions): T;
|
|
318
|
+
remove(options?: RemoveChildOptions): void;
|
|
319
|
+
hasChildNodes(): boolean;
|
|
320
|
+
enqueueUpdate(payload: UpdatePayload): void;
|
|
321
|
+
get ownerDocument(): TaroDocument;
|
|
322
|
+
static extend(methodName: string, options: TFunc | Record<string, any>): void;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
declare class Style {
|
|
326
|
+
_pending: boolean;
|
|
327
|
+
_usedStyleProp: Set<string>;
|
|
328
|
+
_value: Partial<CSSStyleDeclaration>;
|
|
329
|
+
_element: TaroElement;
|
|
330
|
+
constructor(element: TaroElement);
|
|
331
|
+
private setCssVariables;
|
|
332
|
+
get cssText(): string;
|
|
333
|
+
set cssText(str: string);
|
|
334
|
+
setProperty(propertyName: string, value?: string | null): void;
|
|
335
|
+
removeProperty(propertyName: string): string;
|
|
336
|
+
getPropertyValue(propertyName: string): any;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
declare class TaroEvent {
|
|
340
|
+
private cacheTarget;
|
|
341
|
+
private cacheCurrentTarget;
|
|
342
|
+
type: string;
|
|
343
|
+
bubbles: boolean;
|
|
344
|
+
cancelable: boolean;
|
|
345
|
+
_stop: boolean;
|
|
346
|
+
_end: boolean;
|
|
347
|
+
defaultPrevented: boolean;
|
|
348
|
+
button: number;
|
|
349
|
+
timeStamp: number;
|
|
350
|
+
mpEvent: MpEvent | undefined;
|
|
351
|
+
constructor(type: string, opts: EventOptions, event?: MpEvent);
|
|
352
|
+
stopPropagation(): void;
|
|
353
|
+
stopImmediatePropagation(): void;
|
|
354
|
+
preventDefault(): void;
|
|
355
|
+
get target(): any;
|
|
356
|
+
get currentTarget(): any;
|
|
357
|
+
}
|
|
358
|
+
declare function createEvent(event: MpEvent | string, node?: TaroElement): TaroEvent;
|
|
359
|
+
declare function eventHandler(event: MpEvent): any;
|
|
360
|
+
declare function eventHandlerTTDom(ele: any, listener: (event: MpEvent, element: any) => void, event: MpEvent): void;
|
|
361
|
+
|
|
362
|
+
declare class TaroElement extends TaroNode {
|
|
363
|
+
ctx?: any;
|
|
364
|
+
tagName: string;
|
|
365
|
+
props: Record<string, any>;
|
|
366
|
+
style: Style;
|
|
367
|
+
dataset: Record<string, unknown>;
|
|
368
|
+
innerHTML: string;
|
|
369
|
+
constructor();
|
|
370
|
+
private _stopPropagation;
|
|
371
|
+
get id(): string;
|
|
372
|
+
set id(val: string);
|
|
373
|
+
get className(): string;
|
|
374
|
+
set className(val: string);
|
|
375
|
+
get cssText(): string;
|
|
376
|
+
get classList(): ClassList;
|
|
377
|
+
get children(): TaroElement[];
|
|
378
|
+
get attributes(): Attributes[];
|
|
379
|
+
get textContent(): string;
|
|
380
|
+
set textContent(text: string);
|
|
381
|
+
hasAttribute(qualifiedName: string): boolean;
|
|
382
|
+
hasAttributes(): boolean;
|
|
383
|
+
get focus(): () => void;
|
|
384
|
+
set focus(value: () => void);
|
|
385
|
+
blur(): void;
|
|
386
|
+
setAttribute(qualifiedName: string, value: any): void;
|
|
387
|
+
removeAttribute(qualifiedName: string): void;
|
|
388
|
+
getAttribute(qualifiedName: string): string;
|
|
389
|
+
getElementsByTagName(tagName: string): TaroElement[];
|
|
390
|
+
getElementsByClassName(className: string): TaroElement[];
|
|
391
|
+
dispatchEvent(event: TaroEvent): boolean;
|
|
392
|
+
addEventListener(type: any, handler: any, options: any): void;
|
|
393
|
+
removeEventListener(type: any, handler: any, sideEffect?: boolean): void;
|
|
394
|
+
static extend(methodName: string, options: TFunc | Record<string, any>): void;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
declare class FormElement extends TaroElement {
|
|
398
|
+
get type(): string;
|
|
399
|
+
set type(val: string);
|
|
400
|
+
get value(): string | boolean | number | any[];
|
|
401
|
+
set value(val: string | boolean | number | any[]);
|
|
402
|
+
dispatchEvent(event: TaroEvent): boolean;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
declare class TaroDocument extends TaroElement {
|
|
406
|
+
documentElement: TaroElement;
|
|
407
|
+
head: TaroElement;
|
|
408
|
+
body: TaroElement;
|
|
409
|
+
createEvent: typeof createEvent;
|
|
410
|
+
cookie?: string;
|
|
411
|
+
constructor();
|
|
412
|
+
createElement(type: string): TaroElement | TaroRootElement | FormElement;
|
|
413
|
+
createElementNS(_svgNS: string, type: string): TaroElement | TaroRootElement | FormElement;
|
|
414
|
+
createTextNode(text: string): TaroText;
|
|
415
|
+
getElementById<T extends TaroElement>(id: string | undefined | null): T | null;
|
|
416
|
+
querySelector<T extends TaroElement>(query: string): T | null;
|
|
417
|
+
querySelectorAll(): never[];
|
|
418
|
+
createComment(): TaroText;
|
|
419
|
+
get defaultView(): any;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
interface Env {
|
|
423
|
+
window: any;
|
|
424
|
+
document: TaroDocument;
|
|
425
|
+
}
|
|
426
|
+
declare const env: Env;
|
|
427
|
+
|
|
428
|
+
declare const taroDocumentProvider: TaroDocument;
|
|
429
|
+
|
|
430
|
+
type TGetComputedStyle = typeof window.getComputedStyle | ((el: TaroElement) => Style);
|
|
431
|
+
declare const taroGetComputedStyleProvider: TGetComputedStyle;
|
|
432
|
+
|
|
433
|
+
declare const eventCenter: Events;
|
|
434
|
+
type EventsType = typeof Events;
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* 一个小型缓存池,用于在切换页面时,存储一些上下文信息
|
|
438
|
+
*/
|
|
439
|
+
declare class RuntimeCache<T> {
|
|
440
|
+
name: string;
|
|
441
|
+
cache: Map<string, T>;
|
|
442
|
+
constructor(name: string);
|
|
443
|
+
has(identifier: string): boolean;
|
|
444
|
+
set(identifier: string, ctx: T): void;
|
|
445
|
+
get(identifier: string): T | undefined;
|
|
446
|
+
delete(identifier: string): void;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
type Options$1 = {
|
|
450
|
+
window: any;
|
|
451
|
+
};
|
|
452
|
+
type LocationContext = {
|
|
453
|
+
lastHref: string;
|
|
454
|
+
};
|
|
455
|
+
declare class TaroLocation extends Events {
|
|
456
|
+
#private;
|
|
457
|
+
constructor(options: Options$1);
|
|
458
|
+
get protocol(): string;
|
|
459
|
+
set protocol(val: string);
|
|
460
|
+
get host(): string;
|
|
461
|
+
set host(val: string);
|
|
462
|
+
get hostname(): string;
|
|
463
|
+
set hostname(val: string);
|
|
464
|
+
get port(): string;
|
|
465
|
+
set port(val: string);
|
|
466
|
+
get pathname(): string;
|
|
467
|
+
set pathname(val: string);
|
|
468
|
+
get search(): string;
|
|
469
|
+
set search(val: string);
|
|
470
|
+
get hash(): string;
|
|
471
|
+
set hash(val: string);
|
|
472
|
+
get href(): string;
|
|
473
|
+
set href(val: string);
|
|
474
|
+
get origin(): string;
|
|
475
|
+
set origin(val: string);
|
|
476
|
+
assign(): void;
|
|
477
|
+
reload(): void;
|
|
478
|
+
replace(url: string): void;
|
|
479
|
+
toString(): string;
|
|
480
|
+
get cache(): RuntimeCache<LocationContext>;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
declare const Location: typeof TaroLocation;
|
|
484
|
+
|
|
485
|
+
interface HistoryState {
|
|
486
|
+
state: Record<string, any> | null;
|
|
487
|
+
title: string;
|
|
488
|
+
url: string;
|
|
489
|
+
}
|
|
490
|
+
type Options = {
|
|
491
|
+
window: any;
|
|
492
|
+
};
|
|
493
|
+
type HistoryContext = {
|
|
494
|
+
location: TaroLocation;
|
|
495
|
+
stack: HistoryState[];
|
|
496
|
+
cur: number;
|
|
497
|
+
};
|
|
498
|
+
declare class TaroHistory extends Events {
|
|
499
|
+
#private;
|
|
500
|
+
constructor(location: TaroLocation, options: Options);
|
|
501
|
+
get length(): number;
|
|
502
|
+
get state(): Record<string, any> | null;
|
|
503
|
+
go(delta: number): void;
|
|
504
|
+
back(): void;
|
|
505
|
+
forward(): void;
|
|
506
|
+
pushState(state: any, title: string, url: string): void;
|
|
507
|
+
replaceState(state: any, title: string, url: string): void;
|
|
508
|
+
get cache(): RuntimeCache<HistoryContext>;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
declare const History: typeof TaroHistory;
|
|
512
|
+
|
|
513
|
+
declare const nav: typeof window.navigator;
|
|
514
|
+
|
|
515
|
+
declare let now: () => number;
|
|
516
|
+
declare const _raf: typeof requestAnimationFrame | ((callback: any) => NodeJS.Timeout);
|
|
517
|
+
declare const _caf: typeof cancelAnimationFrame;
|
|
518
|
+
|
|
519
|
+
declare class TaroURL {
|
|
520
|
+
#private;
|
|
521
|
+
static createObjectURL(): void;
|
|
522
|
+
static revokeObjectURL(): void;
|
|
523
|
+
constructor(url: string, base?: string);
|
|
524
|
+
get protocol(): string;
|
|
525
|
+
set protocol(val: string);
|
|
526
|
+
get host(): string;
|
|
527
|
+
set host(val: string);
|
|
528
|
+
get hostname(): string;
|
|
529
|
+
set hostname(val: string);
|
|
530
|
+
get port(): string;
|
|
531
|
+
set port(val: string);
|
|
532
|
+
get pathname(): string;
|
|
533
|
+
set pathname(val: string);
|
|
534
|
+
get search(): string;
|
|
535
|
+
set search(val: string);
|
|
536
|
+
get hash(): string;
|
|
537
|
+
set hash(val: string);
|
|
538
|
+
get href(): string;
|
|
539
|
+
set href(val: string);
|
|
540
|
+
get origin(): string;
|
|
541
|
+
set origin(val: string);
|
|
542
|
+
get searchParams(): URLSearchParams;
|
|
543
|
+
toString(): string;
|
|
544
|
+
toJSON(): string;
|
|
545
|
+
_toRaw(): {
|
|
546
|
+
protocol: string;
|
|
547
|
+
port: string;
|
|
548
|
+
host: string;
|
|
549
|
+
hostname: string;
|
|
550
|
+
pathname: string;
|
|
551
|
+
hash: string;
|
|
552
|
+
search: string;
|
|
553
|
+
origin: string;
|
|
554
|
+
href: string;
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
declare const TaroURLProvider: typeof TaroURL;
|
|
559
|
+
declare function parseUrl(url?: string): {
|
|
560
|
+
href: string;
|
|
561
|
+
origin: string;
|
|
562
|
+
protocol: string;
|
|
563
|
+
hostname: string;
|
|
564
|
+
host: string;
|
|
565
|
+
port: string;
|
|
566
|
+
pathname: string;
|
|
567
|
+
search: string;
|
|
568
|
+
hash: string;
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
declare const URLSearchParams$1: any;
|
|
572
|
+
|
|
573
|
+
declare class TaroWindow extends Events {
|
|
574
|
+
navigator: Navigator;
|
|
575
|
+
requestAnimationFrame: typeof requestAnimationFrame | ((callback: any) => NodeJS.Timeout);
|
|
576
|
+
cancelAnimationFrame: typeof cancelAnimationFrame;
|
|
577
|
+
getComputedStyle: TGetComputedStyle;
|
|
578
|
+
Date: DateConstructor;
|
|
579
|
+
location: TaroLocation;
|
|
580
|
+
history: TaroHistory;
|
|
581
|
+
XMLHttpRequest?: Partial<XMLHttpRequest>;
|
|
582
|
+
constructor();
|
|
583
|
+
initEvent(): void;
|
|
584
|
+
get document(): TaroDocument;
|
|
585
|
+
addEventListener(event: string, callback: (arg: any) => void): void;
|
|
586
|
+
removeEventListener(event: string, callback: (arg: any) => void): void;
|
|
587
|
+
setTimeout(...args: Parameters<typeof setTimeout>): NodeJS.Timeout;
|
|
588
|
+
clearTimeout(...args: Parameters<typeof clearTimeout>): void;
|
|
589
|
+
}
|
|
590
|
+
declare const taroWindowProvider: TaroWindow;
|
|
591
|
+
declare const taroLocationProvider: TaroLocation;
|
|
592
|
+
declare const taroHistoryProvider: TaroHistory;
|
|
593
|
+
|
|
594
|
+
declare class SVGElement extends TaroElement {
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
declare function setInnerHTML(element: TaroNode, html: string): void;
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* A MutationRecord represents an individual DOM mutation.
|
|
601
|
+
* It is the object that is passed to MutationObserver's callback.
|
|
602
|
+
* @see https://dom.spec.whatwg.org/#interface-mutationrecord
|
|
603
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord
|
|
604
|
+
*/
|
|
605
|
+
interface MutationRecord {
|
|
606
|
+
readonly target: TaroNode;
|
|
607
|
+
readonly addedNodes?: TaroNode[];
|
|
608
|
+
readonly removedNodes?: TaroNode[];
|
|
609
|
+
readonly previousSibling?: TaroNode | null;
|
|
610
|
+
readonly nextSibling?: TaroNode | null;
|
|
611
|
+
readonly attributeName?: string | null;
|
|
612
|
+
readonly attributeNamespace?: string | null;
|
|
613
|
+
oldValue?: string | null;
|
|
614
|
+
readonly type: MutationRecordType;
|
|
615
|
+
readonly value?: string | null;
|
|
616
|
+
}
|
|
617
|
+
declare const enum MutationRecordType {
|
|
618
|
+
ATTRIBUTES = "attributes",
|
|
619
|
+
CHARACTER_DATA = "characterData",
|
|
620
|
+
CHILD_LIST = "childList"
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
type MutationCallback = (mutations: MutationRecord[]) => any;
|
|
624
|
+
/**
|
|
625
|
+
* @see https://dom.spec.whatwg.org/#dictdef-mutationobserverinit
|
|
626
|
+
*/
|
|
627
|
+
interface MutationObserverInit {
|
|
628
|
+
attributeFilter?: string[];
|
|
629
|
+
attributeOldValue?: boolean;
|
|
630
|
+
attributes?: boolean;
|
|
631
|
+
characterData?: boolean;
|
|
632
|
+
characterDataOldValue?: boolean;
|
|
633
|
+
childList?: boolean;
|
|
634
|
+
subtree?: boolean;
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* The MutationObserver provides the ability
|
|
638
|
+
* to watch for changes being made to the DOM tree.
|
|
639
|
+
* It will invoke a specified callback function
|
|
640
|
+
* when DOM changes occur.
|
|
641
|
+
* @see https://dom.spec.whatwg.org/#mutationobserver
|
|
642
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
|
|
643
|
+
*/
|
|
644
|
+
declare class MutationObserverImpl {
|
|
645
|
+
callback: MutationCallback;
|
|
646
|
+
target: TaroNode | null;
|
|
647
|
+
options: MutationObserverInit;
|
|
648
|
+
records: MutationRecord[];
|
|
649
|
+
constructor(callback: MutationCallback);
|
|
650
|
+
/**
|
|
651
|
+
* Configures the MutationObserver
|
|
652
|
+
* to begin receiving notifications
|
|
653
|
+
* through its callback function
|
|
654
|
+
* when DOM changes matching the given options occur.
|
|
655
|
+
*
|
|
656
|
+
* Options matching is to be implemented.
|
|
657
|
+
*/
|
|
658
|
+
observe(target: TaroNode, options?: MutationObserverInit): void;
|
|
659
|
+
/**
|
|
660
|
+
* Stop the MutationObserver instance
|
|
661
|
+
* from receiving further notifications
|
|
662
|
+
* until and unless observe() is called again.
|
|
663
|
+
*/
|
|
664
|
+
disconnect(): void;
|
|
665
|
+
/**
|
|
666
|
+
* Removes all pending notifications
|
|
667
|
+
* from the MutationObserver's notification queue
|
|
668
|
+
* and returns them in a new Array of MutationRecord objects.
|
|
669
|
+
*/
|
|
670
|
+
takeRecords(): MutationRecord[];
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
declare class MutationObserver {
|
|
674
|
+
core: Pick<MutationObserverImpl, 'observe' | 'disconnect' | 'takeRecords'>;
|
|
675
|
+
constructor(callback: MutationCallback);
|
|
676
|
+
observe(...args: [TaroNode, MutationObserverInit?]): void;
|
|
677
|
+
disconnect(): void;
|
|
678
|
+
takeRecords(): MutationRecord[];
|
|
679
|
+
static record(record: MutationRecord): void;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
declare const PROPERTY_THRESHOLD = 2046;
|
|
683
|
+
declare const TARO_RUNTIME = "Taro runtime";
|
|
684
|
+
declare const HOOKS_APP_ID = "taro-app";
|
|
685
|
+
declare const SET_DATA = "\u5C0F\u7A0B\u5E8F setData";
|
|
686
|
+
declare const PAGE_INIT = "\u9875\u9762\u521D\u59CB\u5316";
|
|
687
|
+
declare const ROOT_STR = "root";
|
|
688
|
+
declare const HTML = "html";
|
|
689
|
+
declare const HEAD = "head";
|
|
690
|
+
declare const BODY = "body";
|
|
691
|
+
declare const APP = "app";
|
|
692
|
+
declare const CONTAINER = "container";
|
|
693
|
+
declare const DOCUMENT_ELEMENT_NAME = "#document";
|
|
694
|
+
declare const DOCUMENT_FRAGMENT = "document-fragment";
|
|
695
|
+
declare const ID = "id";
|
|
696
|
+
declare const UID = "uid";
|
|
697
|
+
declare const CLASS = "class";
|
|
698
|
+
declare const STYLE = "style";
|
|
699
|
+
declare const FOCUS = "focus";
|
|
700
|
+
declare const VIEW = "view";
|
|
701
|
+
declare const STATIC_VIEW = "static-view";
|
|
702
|
+
declare const PURE_VIEW = "pure-view";
|
|
703
|
+
declare const CLICK_VIEW = "click-view";
|
|
704
|
+
declare const PROPS = "props";
|
|
705
|
+
declare const DATASET = "dataset";
|
|
706
|
+
declare const OBJECT = "object";
|
|
707
|
+
declare const VALUE = "value";
|
|
708
|
+
declare const INPUT = "input";
|
|
709
|
+
declare const CHANGE = "change";
|
|
710
|
+
declare const CUSTOM_WRAPPER = "custom-wrapper";
|
|
711
|
+
declare const TARGET = "target";
|
|
712
|
+
declare const CURRENT_TARGET = "currentTarget";
|
|
713
|
+
declare const TYPE = "type";
|
|
714
|
+
declare const CONFIRM = "confirm";
|
|
715
|
+
declare const TIME_STAMP = "timeStamp";
|
|
716
|
+
declare const KEY_CODE = "keyCode";
|
|
717
|
+
declare const TOUCHMOVE = "touchmove";
|
|
718
|
+
declare const DATE = "Date";
|
|
719
|
+
declare const SET_TIMEOUT = "setTimeout";
|
|
720
|
+
declare const COMPILE_MODE = "compileMode";
|
|
721
|
+
declare const CATCHMOVE = "catchMove";
|
|
722
|
+
declare const CATCH_VIEW = "catch-view";
|
|
723
|
+
declare const COMMENT = "comment";
|
|
724
|
+
declare const ON_LOAD = "onLoad";
|
|
725
|
+
declare const ON_READY = "onReady";
|
|
726
|
+
declare const ON_SHOW = "onShow";
|
|
727
|
+
declare const ON_HIDE = "onHide";
|
|
728
|
+
declare const OPTIONS = "options";
|
|
729
|
+
declare const EXTERNAL_CLASSES = "externalClasses";
|
|
730
|
+
declare const EVENT_CALLBACK_RESULT = "e_result";
|
|
731
|
+
declare const BEHAVIORS = "behaviors";
|
|
732
|
+
declare const A = "a";
|
|
733
|
+
declare enum CONTEXT_ACTIONS {
|
|
734
|
+
INIT = "0",
|
|
735
|
+
RESTORE = "1",
|
|
736
|
+
RECOVER = "2",
|
|
737
|
+
DESTROY = "3"
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
interface Instance<T = Record<string, any>> extends Component$1<T>, Show, PageInstance {
|
|
741
|
+
tid?: string;
|
|
742
|
+
node?: TaroElement;
|
|
743
|
+
$forceUpdate?(): void;
|
|
744
|
+
$nextTick?(cb: () => void): void;
|
|
745
|
+
$options: Instance;
|
|
746
|
+
}
|
|
747
|
+
interface PageProps {
|
|
748
|
+
tid?: string;
|
|
749
|
+
}
|
|
750
|
+
interface ReactPageComponent<T = PageProps> extends ComponentClass<T>, PageInstance {
|
|
751
|
+
}
|
|
752
|
+
interface ReactPageInstance<T = PageProps> extends Component$1<T>, PageInstance {
|
|
753
|
+
componentDidShow?(): void;
|
|
754
|
+
componentDidHide?(): void;
|
|
755
|
+
}
|
|
756
|
+
interface ReactAppInstance<T = AppInstance> extends Component$1<T>, AppInstance {
|
|
757
|
+
}
|
|
758
|
+
interface PageLifeCycle extends Show {
|
|
759
|
+
eh?(event: MpEvent): void;
|
|
760
|
+
onAddToFavorites?(): void;
|
|
761
|
+
onLoad?(options: Record<string, unknown>, cb?: TFunc): void;
|
|
762
|
+
onOptionMenuClick?(): void;
|
|
763
|
+
onKeyboardHeight?(obj: {
|
|
764
|
+
height: number;
|
|
765
|
+
}): void;
|
|
766
|
+
onPageScroll?(obj: {
|
|
767
|
+
scrollTop: number;
|
|
768
|
+
}): void;
|
|
769
|
+
onPullDownRefresh?(): void;
|
|
770
|
+
onPullIntercept?(): void;
|
|
771
|
+
onPopMenuClick?(): void;
|
|
772
|
+
onReachBottom?(): void;
|
|
773
|
+
onReady?(): void;
|
|
774
|
+
onResize?(options: unknown): void;
|
|
775
|
+
onSaveExitState?(): void;
|
|
776
|
+
onShareAppMessage?(obj: {
|
|
777
|
+
from: string;
|
|
778
|
+
target?: TaroElement;
|
|
779
|
+
webViewUrl: string;
|
|
780
|
+
}): void;
|
|
781
|
+
onShareTimeline?(): void;
|
|
782
|
+
onTabItemTap?(obj: {
|
|
783
|
+
index: string;
|
|
784
|
+
pagePath: string;
|
|
785
|
+
text: string;
|
|
786
|
+
}): void;
|
|
787
|
+
onTitleClick?(): void;
|
|
788
|
+
onUnload?(): void;
|
|
789
|
+
}
|
|
790
|
+
interface PageInstance extends PageLifeCycle {
|
|
791
|
+
/** 页面的初始数据 */
|
|
792
|
+
data?: Record<string, unknown>;
|
|
793
|
+
/** 页面路径 */
|
|
794
|
+
path?: string;
|
|
795
|
+
/** 页面的组件选项 */
|
|
796
|
+
options?: Record<string, unknown>;
|
|
797
|
+
/** 页面渲染引擎类型 */
|
|
798
|
+
renderer?: 'webview' | 'skyline';
|
|
799
|
+
/** 页面事件对象,支付宝小程序特有,详见[events](https://opendocs.alipay.com/mini/framework/page-detail#events) */
|
|
800
|
+
events?: Record<string, (...args: any[]) => any>;
|
|
801
|
+
/** 获得一个 EventChannel 对象,用于页面间通讯 */
|
|
802
|
+
getOpenerEventChannel?(): Record<string, any>;
|
|
803
|
+
/** 执行关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
|
|
804
|
+
animate?(selector: string, keyFrames: KeyFrame[], duration: number, callback: () => void): void;
|
|
805
|
+
/** 滚动驱动的动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
|
|
806
|
+
animate?(selector: string, keyFrames: KeyFrame[], duration: number, scrollTimeline: ScrollTimelineOption): void;
|
|
807
|
+
}
|
|
808
|
+
interface Show {
|
|
809
|
+
componentDidShow?(): void;
|
|
810
|
+
componentDidHide?(): void;
|
|
811
|
+
onShow?(): void;
|
|
812
|
+
onHide?(): void;
|
|
813
|
+
}
|
|
814
|
+
interface AppInstance extends Show {
|
|
815
|
+
componentDidShow?(options?: Record<string, unknown>): void;
|
|
816
|
+
mount?(component: React.ComponentClass | Component, id: string, cb: (...args: any[]) => void): void;
|
|
817
|
+
mount?(component: React.ComponentClass | Component, id: string, getCtx: (...args: any[]) => void, cb: (...args: any[]) => void): void;
|
|
818
|
+
onError?(error: string): void;
|
|
819
|
+
onLaunch?(options?: Record<string, unknown>): void;
|
|
820
|
+
onPageNotFound?(res: any): void;
|
|
821
|
+
onUnhandledRejection?(error: any): void;
|
|
822
|
+
onShow?(options?: Record<string, unknown>): void;
|
|
823
|
+
onHide?(options?: Record<string, unknown>): void;
|
|
824
|
+
unmount?(id: string, cb?: () => void): void;
|
|
825
|
+
taroGlobalData?: Record<any, any>;
|
|
826
|
+
config?: Record<any, any>;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
interface Router {
|
|
830
|
+
params: Record<string, unknown>;
|
|
831
|
+
path: string;
|
|
832
|
+
$taroPath: string;
|
|
833
|
+
onReady: string;
|
|
834
|
+
onHide: string;
|
|
835
|
+
onShow: string;
|
|
836
|
+
exitState?: any;
|
|
837
|
+
}
|
|
838
|
+
interface Current {
|
|
839
|
+
app: AppInstance | null;
|
|
840
|
+
router: Router | null;
|
|
841
|
+
page: PageInstance | null;
|
|
842
|
+
preloadData?: any;
|
|
843
|
+
}
|
|
844
|
+
declare const Current: Current;
|
|
845
|
+
declare const getCurrentInstance: () => Current;
|
|
846
|
+
|
|
847
|
+
interface IEventSource extends Map<string | undefined | null, TaroNode> {
|
|
848
|
+
removeNode(child: TaroNode): void;
|
|
849
|
+
removeNodeTree(child: TaroNode): void;
|
|
850
|
+
}
|
|
851
|
+
declare const eventSource: IEventSource;
|
|
852
|
+
|
|
853
|
+
declare function injectPageInstance(inst: Instance<PageProps>, id: string): void;
|
|
854
|
+
declare function getPageInstance(id: string): Instance | undefined;
|
|
855
|
+
declare function removePageInstance(id: string): void;
|
|
856
|
+
declare function safeExecute(path: string, lifecycle: string, ...args: unknown[]): any;
|
|
857
|
+
declare function stringify(obj?: Record<string, unknown>): string;
|
|
858
|
+
declare function getPath(id: string, options?: Record<string, unknown>): string;
|
|
859
|
+
declare function getOnReadyEventKey(path: string): string;
|
|
860
|
+
declare function getOnShowEventKey(path: string): string;
|
|
861
|
+
declare function getOnHideEventKey(path: string): string;
|
|
862
|
+
declare function createPageConfig(component: any, pageName?: string, data?: Record<string, unknown>, pageConfig?: PageConfig): PageInstance;
|
|
863
|
+
declare function createComponentConfig(component: React.ComponentClass, componentName?: string, data?: Record<string, unknown>): any;
|
|
864
|
+
declare function createRecursiveComponentConfig(componentName?: string): any;
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* React also has a fancy function's name for this: `hydrate()`.
|
|
868
|
+
* You may have been heard `hydrate` as a SSR-related function,
|
|
869
|
+
* actually, `hydrate` basicly do the `render()` thing, but ignore some properties,
|
|
870
|
+
* it's a vnode traverser and modifier: that's exactly what Taro's doing in here.
|
|
871
|
+
*/
|
|
872
|
+
declare function hydrate(node: TaroElement | TaroText): MiniData;
|
|
873
|
+
|
|
874
|
+
declare const nextTick: (cb: TFunc, ctx?: Record<string, any>) => void;
|
|
875
|
+
|
|
876
|
+
declare const options: Options$2;
|
|
877
|
+
|
|
878
|
+
declare class Performance {
|
|
879
|
+
#private;
|
|
880
|
+
private recorder;
|
|
881
|
+
start(id: string): void;
|
|
882
|
+
stop(id: string, now?: number): void;
|
|
883
|
+
delayStop(id: string, delay?: number): ((...args: any[]) => void) | undefined;
|
|
884
|
+
}
|
|
885
|
+
declare const perf: Performance;
|
|
886
|
+
|
|
887
|
+
declare function throttle(fn: any, threshold?: number, scope?: any): (...args: any[]) => void;
|
|
888
|
+
declare function debounce(fn: any, ms?: number, scope?: any): (...args: any[]) => void;
|
|
889
|
+
|
|
890
|
+
declare const addLeadingSlash: (url?: string) => string;
|
|
891
|
+
declare const hasBasename: (path?: string, prefix?: string) => boolean;
|
|
892
|
+
declare const stripBasename: (path?: string, prefix?: string) => string;
|
|
893
|
+
declare const stripTrailing: (str?: string) => string;
|
|
894
|
+
declare const stripSuffix: (path?: string, suffix?: string) => string;
|
|
895
|
+
declare const getHomePage: (path?: string, basename?: string, customRoutes?: Record<string, string | string[]>, entryPagePath?: string) => string;
|
|
896
|
+
declare const getCurrentPage: (routerMode?: string, basename?: string) => string;
|
|
897
|
+
|
|
898
|
+
declare const incrementId: () => () => string;
|
|
899
|
+
declare function isElement(node: TaroNode): node is TaroElement;
|
|
900
|
+
declare function isText(node: TaroNode): node is TaroText;
|
|
901
|
+
declare function isComment(node: TaroNode): boolean;
|
|
902
|
+
declare function isHasExtractProp(el: TaroElement): boolean;
|
|
903
|
+
/**
|
|
904
|
+
* 往上寻找组件树直到 root,寻找是否有祖先组件绑定了同类型的事件
|
|
905
|
+
* @param node 当前组件
|
|
906
|
+
* @param type 事件类型
|
|
907
|
+
*/
|
|
908
|
+
declare function isParentBound(node: TaroElement | null, type: string): boolean;
|
|
909
|
+
declare function shortcutAttr(key: string): string;
|
|
910
|
+
declare const customWrapperCache: Map<string, Record<string, any>>;
|
|
911
|
+
interface Ctor {
|
|
912
|
+
new (...args: any[]): any;
|
|
913
|
+
}
|
|
914
|
+
declare function extend(ctor: Ctor, methodName: string, options: TFunc | Record<string, any>): void;
|
|
915
|
+
declare function getComponentsAlias(): any;
|
|
916
|
+
declare function convertNumber2PX(value: number): string;
|
|
917
|
+
|
|
918
|
+
declare function handlePolyfill(): void;
|
|
919
|
+
|
|
920
|
+
export { A, APP, BEHAVIORS, BODY, CATCHMOVE, CATCH_VIEW, CHANGE, CLASS, CLICK_VIEW, COMMENT, COMPILE_MODE, CONFIRM, CONTAINER, CONTEXT_ACTIONS, CURRENT_TARGET, CUSTOM_WRAPPER, Current, DATASET, DATE, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, EVENT_CALLBACK_RESULT, EXTERNAL_CLASSES, FOCUS, FormElement, HEAD, HOOKS_APP_ID, HTML, History, ID, INPUT, KEY_CODE, Location, MutationObserver, OBJECT, ON_HIDE, ON_LOAD, ON_READY, ON_SHOW, OPTIONS, PAGE_INIT, PROPERTY_THRESHOLD, PROPS, PURE_VIEW, ROOT_STR, SET_DATA, SET_TIMEOUT, STATIC_VIEW, STYLE, SVGElement, Style, TARGET, TARO_RUNTIME, TIME_STAMP, TOUCHMOVE, TYPE, TaroElement, TaroEvent, TaroNode, TaroRootElement, TaroText, UID, TaroURLProvider as URL, URLSearchParams$1 as URLSearchParams, VALUE, VIEW, addLeadingSlash, _caf as cancelAnimationFrame, convertNumber2PX, createComponentConfig, createEvent, createPageConfig, createRecursiveComponentConfig, customWrapperCache, debounce, taroDocumentProvider as document, env, eventCenter, eventHandler, eventHandlerTTDom, eventSource, extend, getComponentsAlias, taroGetComputedStyleProvider as getComputedStyle, getCurrentInstance, getCurrentPage, getHomePage, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, handlePolyfill, hasBasename, taroHistoryProvider as history, hydrate, incrementId, injectPageInstance, isComment, isElement, isHasExtractProp, isParentBound, isText, taroLocationProvider as location, nav as navigator, nextTick, now, options, parseUrl, perf, removePageInstance, _raf as requestAnimationFrame, safeExecute, setInnerHTML, shortcutAttr, stringify, stripBasename, stripSuffix, stripTrailing, throttle, taroWindowProvider as window };
|
|
921
|
+
export type { AddEventListenerOptions, AppInstance, Attributes, DataTree, EventHandler, EventListenerOptions, EventOptions, EventsType, HydratedData, Instance, KeyFrame, MiniData, MiniElementData, MiniTextData, MpEvent, MpInstance, Options$2 as Options, PageConfig, PageInstance, PageLifeCycle, PageProps, ReactAppInstance, ReactPageComponent, ReactPageInstance, ScrollTimelineOption, TFunc, UpdatePayload, UpdatePayloadValue };
|