@tarojs/runtime 4.0.8-beta.1 → 4.0.8-beta.3
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 +3 -4
- package/dist/bom/URL.js +1 -1
- package/dist/bom/URL.js.map +1 -1
- package/dist/bom/URLSearchParams.d.ts +1 -0
- package/dist/bom/URLSearchParams.js.map +1 -1
- package/dist/bom/document.d.ts +3 -1
- package/dist/bom/document.js.map +1 -1
- package/dist/bom/getComputedStyle.d.ts +6 -3
- package/dist/bom/getComputedStyle.js.map +1 -1
- package/dist/bom/history.d.ts +8 -6
- package/dist/bom/history.js.map +1 -1
- package/dist/bom/location.d.ts +6 -5
- package/dist/bom/location.js.map +1 -1
- package/dist/bom/navigator.d.ts +1 -0
- package/dist/bom/navigator.js.map +1 -1
- package/dist/bom/raf.d.ts +2 -2
- package/dist/bom/raf.js.map +1 -1
- package/dist/bom/window.d.ts +11 -8
- package/dist/bom/window.js.map +1 -1
- package/dist/constants/index.d.ts +2 -1
- package/dist/constants/index.js.map +1 -1
- package/dist/current.d.ts +5 -2
- package/dist/current.js.map +1 -1
- package/dist/dom/anchor-element.js.map +1 -1
- package/dist/dom/class-list.d.ts +3 -1
- package/dist/dom/class-list.js.map +1 -1
- package/dist/dom/document.d.ts +7 -8
- package/dist/dom/document.js.map +1 -1
- package/dist/dom/element.d.ts +8 -5
- package/dist/dom/element.js +2 -2
- package/dist/dom/element.js.map +1 -1
- package/dist/dom/event-source.d.ts +3 -1
- package/dist/dom/event-source.js.map +1 -1
- package/dist/dom/event-target.d.ts +3 -1
- package/dist/dom/event-target.js.map +1 -1
- package/dist/dom/event.d.ts +4 -2
- package/dist/dom/event.js.map +1 -1
- package/dist/dom/form.d.ts +4 -2
- package/dist/dom/form.js.map +1 -1
- package/dist/dom/node.d.ts +9 -37
- package/dist/dom/node.js.map +1 -1
- package/dist/{node_types-9ac5b4dd.d.ts → dom/node_types.d.ts} +1 -0
- package/dist/dom/root.d.ts +6 -2
- package/dist/dom/root.js +1 -1
- package/dist/dom/root.js.map +1 -1
- package/dist/dom/style.d.ts +3 -1
- package/dist/dom/style.js.map +1 -1
- package/dist/dom/style_properties.js +1 -0
- package/dist/dom/style_properties.js.map +1 -1
- package/dist/dom/svg.d.ts +3 -1
- package/dist/dom/svg.js.map +1 -1
- package/dist/dom/text.d.ts +4 -2
- package/dist/dom/text.js.map +1 -1
- package/dist/dom/transfer.js.map +1 -1
- package/dist/dom/tree.js.map +1 -1
- package/dist/dom-external/element.js +7 -0
- package/dist/dom-external/element.js.map +1 -1
- package/dist/dom-external/index.js.map +1 -1
- package/dist/dom-external/inner-html/html.js.map +1 -1
- package/dist/dom-external/inner-html/parser.d.ts +2 -7
- package/dist/dom-external/inner-html/parser.js +1 -1
- package/dist/dom-external/inner-html/parser.js.map +1 -1
- package/dist/dom-external/inner-html/scaner.js.map +1 -1
- package/dist/dom-external/inner-html/style.js.map +1 -1
- package/dist/dom-external/inner-html/tags.js.map +1 -1
- package/dist/dom-external/inner-html/utils.js.map +1 -1
- package/dist/dom-external/mutation-observer/implements.d.ts +6 -22
- package/dist/dom-external/mutation-observer/implements.js.map +1 -1
- package/dist/dom-external/mutation-observer/index.d.ts +7 -4
- package/dist/dom-external/mutation-observer/index.js.map +1 -1
- package/dist/{record-32b054d8.d.ts → dom-external/mutation-observer/record.d.ts} +5 -2
- package/dist/dom-external/node.js.map +1 -1
- package/dist/dsl/common.d.ts +5 -4
- package/dist/dsl/common.js +32 -14
- package/dist/dsl/common.js.map +1 -1
- package/dist/{instance-4007cff2.d.ts → dsl/instance.d.ts} +23 -11
- package/dist/emitter/emitter.d.ts +5 -1
- package/dist/emitter/emitter.js.map +1 -1
- package/dist/env.d.ts +3 -1
- package/dist/env.js.map +1 -1
- package/dist/hydrate.d.ts +5 -3
- package/dist/hydrate.js +1 -1
- package/dist/hydrate.js.map +1 -1
- package/dist/index.cjs.d.ts +178 -70
- package/dist/index.cjs.js +50 -27
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +42 -34
- 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 +32 -0
- package/dist/interface/node.d.ts +10 -0
- package/dist/{options-4007cff2.d.ts → interface/options.d.ts} +6 -4
- package/dist/interface/utils.d.ts +4 -0
- package/dist/next-tick.d.ts +3 -1
- package/dist/next-tick.js.map +1 -1
- package/dist/options.d.ts +3 -1
- package/dist/options.js.map +1 -1
- package/dist/perf.d.ts +1 -0
- package/dist/perf.js.map +1 -1
- package/dist/polyfill/array.js.map +1 -1
- package/dist/polyfill/index.d.ts +1 -0
- package/dist/polyfill/index.js.map +1 -1
- package/dist/polyfill/intersection-observer.js +3 -6
- package/dist/polyfill/intersection-observer.js.map +1 -1
- package/dist/polyfill/object.js.map +1 -1
- package/dist/runtime.esm.d.ts +178 -70
- package/dist/runtime.esm.js +46 -23
- package/dist/runtime.esm.js.map +1 -1
- package/dist/utils/cache.d.ts +1 -0
- package/dist/utils/cache.js.map +1 -1
- package/dist/utils/index.d.ts +7 -7
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/lodash.d.ts +2 -1
- package/dist/utils/lodash.js.map +1 -1
- package/dist/utils/router.d.ts +2 -1
- package/dist/utils/router.js.map +1 -1
- package/package.json +10 -7
- package/dist/dom/anchor-element.d.ts +0 -14
- package/dist/dom/style_properties.d.ts +0 -3
- package/dist/dom/transfer.d.ts +0 -8
- package/dist/dom/tree.d.ts +0 -4
- package/dist/dom-external/element.d.ts +0 -4
- package/dist/dom-external/index.d.ts +0 -1
- package/dist/dom-external/inner-html/html.d.ts +0 -3
- package/dist/dom-external/inner-html/scaner.d.ts +0 -30
- package/dist/dom-external/inner-html/style.d.ts +0 -27
- package/dist/dom-external/inner-html/tags.d.ts +0 -9
- package/dist/dom-external/inner-html/utils.d.ts +0 -2
- package/dist/dom-external/node.d.ts +0 -12
- package/dist/index-26658829.d.ts +0 -23
- package/dist/polyfill/array.d.ts +0 -3
- package/dist/polyfill/intersection-observer.d.ts +0 -2
- package/dist/polyfill/object.d.ts +0 -4
package/dist/index.cjs.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import { Component as
|
|
5
|
-
|
|
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
6
|
declare class ClassList {
|
|
7
7
|
private el;
|
|
8
8
|
private tokenList;
|
|
@@ -18,10 +18,94 @@ declare class ClassList {
|
|
|
18
18
|
private checkTokenIsValid;
|
|
19
19
|
private _update;
|
|
20
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
|
+
|
|
21
104
|
interface Attributes {
|
|
22
105
|
name: string;
|
|
23
106
|
value: string;
|
|
24
107
|
}
|
|
108
|
+
|
|
25
109
|
interface EventOptions {
|
|
26
110
|
bubbles: boolean;
|
|
27
111
|
cancelable: boolean;
|
|
@@ -36,6 +120,7 @@ interface MpEvent {
|
|
|
36
120
|
target: Target;
|
|
37
121
|
currentTarget: Target;
|
|
38
122
|
}
|
|
123
|
+
|
|
39
124
|
interface EventListenerOptions {
|
|
40
125
|
capture?: boolean;
|
|
41
126
|
}
|
|
@@ -47,9 +132,10 @@ interface EventHandler<T = any, R = void> {
|
|
|
47
132
|
(...args: T[]): R;
|
|
48
133
|
_stop?: boolean;
|
|
49
134
|
}
|
|
50
|
-
|
|
135
|
+
|
|
51
136
|
type TFunc = (...args: any[]) => any;
|
|
52
137
|
type PageConfig = Record<string, any>;
|
|
138
|
+
|
|
53
139
|
interface MpInstance {
|
|
54
140
|
config: PageConfig;
|
|
55
141
|
setData: (data: unknown, cb: () => void) => void;
|
|
@@ -77,12 +163,14 @@ interface MiniTextData {
|
|
|
77
163
|
}
|
|
78
164
|
type MiniData = MiniElementData | MiniTextData;
|
|
79
165
|
type HydratedData = () => MiniData | MiniData[];
|
|
166
|
+
|
|
80
167
|
type UpdatePayloadValue = string | boolean | HydratedData;
|
|
81
168
|
type DataTree = Record<string, UpdatePayloadValue | ReturnType<HydratedData>>;
|
|
82
169
|
interface UpdatePayload {
|
|
83
170
|
path: string;
|
|
84
171
|
value: UpdatePayloadValue;
|
|
85
172
|
}
|
|
173
|
+
|
|
86
174
|
declare const enum NodeType {
|
|
87
175
|
ELEMENT_NODE = 1,
|
|
88
176
|
ATTRIBUTE_NODE = 2,
|
|
@@ -93,6 +181,7 @@ declare const enum NodeType {
|
|
|
93
181
|
PROCESSING_INSTRUCTION_NODE = 7,
|
|
94
182
|
DOCUMENT_NODE = 9
|
|
95
183
|
}
|
|
184
|
+
|
|
96
185
|
declare class TaroText extends TaroNode {
|
|
97
186
|
_value: string;
|
|
98
187
|
nodeType: NodeType;
|
|
@@ -105,25 +194,27 @@ declare class TaroText extends TaroNode {
|
|
|
105
194
|
set data(text: string);
|
|
106
195
|
get data(): string;
|
|
107
196
|
}
|
|
197
|
+
|
|
108
198
|
interface Node {
|
|
109
199
|
type: string;
|
|
110
200
|
}
|
|
111
201
|
interface Comment extends Node {
|
|
112
|
-
type:
|
|
202
|
+
type: 'comment';
|
|
113
203
|
content: string;
|
|
114
204
|
}
|
|
115
205
|
interface Text extends Node {
|
|
116
|
-
type:
|
|
206
|
+
type: 'text';
|
|
117
207
|
content: string;
|
|
118
208
|
}
|
|
119
209
|
interface Element extends Node {
|
|
120
|
-
type:
|
|
210
|
+
type: 'element';
|
|
121
211
|
tagName: string;
|
|
122
212
|
children: ChildNode[];
|
|
123
213
|
attributes: string[];
|
|
124
214
|
}
|
|
125
215
|
type ChildNode = Comment | Text | Element;
|
|
126
|
-
|
|
216
|
+
|
|
217
|
+
interface Options$2 {
|
|
127
218
|
prerender: boolean;
|
|
128
219
|
debug: boolean;
|
|
129
220
|
html?: {
|
|
@@ -136,6 +227,7 @@ interface Options {
|
|
|
136
227
|
};
|
|
137
228
|
miniGlobal?: any;
|
|
138
229
|
}
|
|
230
|
+
|
|
139
231
|
declare class TaroEventTarget {
|
|
140
232
|
__handlers: Record<string, EventHandler[]>;
|
|
141
233
|
addEventListener(type: string, handler: EventHandler, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -143,6 +235,7 @@ declare class TaroEventTarget {
|
|
|
143
235
|
isAnyEventBinded(): boolean;
|
|
144
236
|
isOnlyClickBinded(): boolean;
|
|
145
237
|
}
|
|
238
|
+
|
|
146
239
|
declare class TaroRootElement extends TaroElement {
|
|
147
240
|
private updatePayloads;
|
|
148
241
|
private updateCallbacks;
|
|
@@ -157,6 +250,7 @@ declare class TaroRootElement extends TaroElement {
|
|
|
157
250
|
enqueueUpdateCallback(cb: TFunc, ctx?: Record<string, any>): void;
|
|
158
251
|
flushUpdateCallback(): void;
|
|
159
252
|
}
|
|
253
|
+
|
|
160
254
|
interface RemoveChildOptions {
|
|
161
255
|
cleanRef?: boolean;
|
|
162
256
|
doUpdate?: boolean;
|
|
@@ -184,7 +278,6 @@ declare class TaroNode extends TaroEventTarget {
|
|
|
184
278
|
* @textContent 目前只能置空子元素
|
|
185
279
|
* @TODO 等待完整 innerHTML 实现
|
|
186
280
|
*/
|
|
187
|
-
// eslint-disable-next-line accessor-pairs
|
|
188
281
|
set textContent(text: string);
|
|
189
282
|
/**
|
|
190
283
|
* @doc https://developer.mozilla.org/zh-CN/docs/Web/API/Node/insertBefore
|
|
@@ -227,6 +320,7 @@ declare class TaroNode extends TaroEventTarget {
|
|
|
227
320
|
get ownerDocument(): TaroDocument;
|
|
228
321
|
static extend(methodName: string, options: TFunc | Record<string, any>): void;
|
|
229
322
|
}
|
|
323
|
+
|
|
230
324
|
declare class Style {
|
|
231
325
|
_pending: boolean;
|
|
232
326
|
_usedStyleProp: Set<string>;
|
|
@@ -240,7 +334,7 @@ declare class Style {
|
|
|
240
334
|
removeProperty(propertyName: string): string;
|
|
241
335
|
getPropertyValue(propertyName: string): any;
|
|
242
336
|
}
|
|
243
|
-
|
|
337
|
+
|
|
244
338
|
declare class TaroEvent {
|
|
245
339
|
private cacheTarget;
|
|
246
340
|
private cacheCurrentTarget;
|
|
@@ -250,10 +344,7 @@ declare class TaroEvent {
|
|
|
250
344
|
_stop: boolean;
|
|
251
345
|
_end: boolean;
|
|
252
346
|
defaultPrevented: boolean;
|
|
253
|
-
// Mouse Event botton property, it's used in 3rd lib, like react-router. default 0 in general
|
|
254
347
|
button: number;
|
|
255
|
-
// timestamp can either be hi-res ( relative to page load) or low-res (relative to UNIX epoch)
|
|
256
|
-
// here use hi-res timestamp
|
|
257
348
|
timeStamp: number;
|
|
258
349
|
mpEvent: MpEvent | undefined;
|
|
259
350
|
constructor(type: string, opts: EventOptions, event?: MpEvent);
|
|
@@ -264,8 +355,8 @@ declare class TaroEvent {
|
|
|
264
355
|
get currentTarget(): any;
|
|
265
356
|
}
|
|
266
357
|
declare function createEvent(event: MpEvent | string, node?: TaroElement): TaroEvent;
|
|
267
|
-
// 小程序的事件代理回调函数
|
|
268
358
|
declare function eventHandler(event: MpEvent): any;
|
|
359
|
+
|
|
269
360
|
declare class TaroElement extends TaroNode {
|
|
270
361
|
ctx?: any;
|
|
271
362
|
tagName: string;
|
|
@@ -288,7 +379,6 @@ declare class TaroElement extends TaroNode {
|
|
|
288
379
|
hasAttribute(qualifiedName: string): boolean;
|
|
289
380
|
hasAttributes(): boolean;
|
|
290
381
|
get focus(): () => void;
|
|
291
|
-
// 兼容 Vue3,详情请见:https://github.com/NervJS/taro/issues/10579
|
|
292
382
|
set focus(value: () => void);
|
|
293
383
|
blur(): void;
|
|
294
384
|
setAttribute(qualifiedName: string, value: any): void;
|
|
@@ -301,6 +391,7 @@ declare class TaroElement extends TaroNode {
|
|
|
301
391
|
removeEventListener(type: any, handler: any, sideEffect?: boolean): void;
|
|
302
392
|
static extend(methodName: string, options: TFunc | Record<string, any>): void;
|
|
303
393
|
}
|
|
394
|
+
|
|
304
395
|
declare class FormElement extends TaroElement {
|
|
305
396
|
get type(): string;
|
|
306
397
|
set type(val: string);
|
|
@@ -308,6 +399,7 @@ declare class FormElement extends TaroElement {
|
|
|
308
399
|
set value(val: string | boolean | number | any[]);
|
|
309
400
|
dispatchEvent(event: TaroEvent): boolean;
|
|
310
401
|
}
|
|
402
|
+
|
|
311
403
|
declare class TaroDocument extends TaroElement {
|
|
312
404
|
documentElement: TaroElement;
|
|
313
405
|
head: TaroElement;
|
|
@@ -316,29 +408,29 @@ declare class TaroDocument extends TaroElement {
|
|
|
316
408
|
cookie?: string;
|
|
317
409
|
constructor();
|
|
318
410
|
createElement(type: string): TaroElement | TaroRootElement | FormElement;
|
|
319
|
-
// an ugly fake createElementNS to deal with @vue/runtime-dom's
|
|
320
|
-
// support mounting app to svg container since vue@3.0.8
|
|
321
411
|
createElementNS(_svgNS: string, type: string): TaroElement | TaroRootElement | FormElement;
|
|
322
412
|
createTextNode(text: string): TaroText;
|
|
323
413
|
getElementById<T extends TaroElement>(id: string | undefined | null): T | null;
|
|
324
414
|
querySelector<T extends TaroElement>(query: string): T | null;
|
|
325
415
|
querySelectorAll(): never[];
|
|
326
|
-
// @TODO: @PERF: 在 hydrate 移除掉空的 node
|
|
327
416
|
createComment(): TaroText;
|
|
328
417
|
get defaultView(): any;
|
|
329
418
|
}
|
|
419
|
+
|
|
330
420
|
interface Env {
|
|
331
421
|
window: any;
|
|
332
422
|
document: TaroDocument;
|
|
333
423
|
}
|
|
334
424
|
declare const env: Env;
|
|
335
|
-
|
|
425
|
+
|
|
336
426
|
declare const taroDocumentProvider: TaroDocument;
|
|
427
|
+
|
|
337
428
|
type TGetComputedStyle = typeof window.getComputedStyle | ((el: TaroElement) => Style);
|
|
338
|
-
// Note: 小程序端 vite 打包成 commonjs,const getComputedStyle = xxx 会报错,所以把 GetComputedStyle 改为 taroGetComputedStyleProvider
|
|
339
429
|
declare const taroGetComputedStyleProvider: TGetComputedStyle;
|
|
430
|
+
|
|
340
431
|
declare const eventCenter: Events;
|
|
341
432
|
type EventsType = typeof Events;
|
|
433
|
+
|
|
342
434
|
/**
|
|
343
435
|
* 一个小型缓存池,用于在切换页面时,存储一些上下文信息
|
|
344
436
|
*/
|
|
@@ -351,7 +443,8 @@ declare class RuntimeCache<T> {
|
|
|
351
443
|
get(identifier: string): T | undefined;
|
|
352
444
|
delete(identifier: string): void;
|
|
353
445
|
}
|
|
354
|
-
|
|
446
|
+
|
|
447
|
+
type Options$1 = {
|
|
355
448
|
window: any;
|
|
356
449
|
};
|
|
357
450
|
type LocationContext = {
|
|
@@ -359,8 +452,7 @@ type LocationContext = {
|
|
|
359
452
|
};
|
|
360
453
|
declare class TaroLocation extends Events {
|
|
361
454
|
#private;
|
|
362
|
-
constructor(options: Options$
|
|
363
|
-
/* public property */
|
|
455
|
+
constructor(options: Options$1);
|
|
364
456
|
get protocol(): string;
|
|
365
457
|
set protocol(val: string);
|
|
366
458
|
get host(): string;
|
|
@@ -374,27 +466,26 @@ declare class TaroLocation extends Events {
|
|
|
374
466
|
get search(): string;
|
|
375
467
|
set search(val: string);
|
|
376
468
|
get hash(): string;
|
|
377
|
-
// 小程序的navigateTo存在截断hash字符串的问题
|
|
378
469
|
set hash(val: string);
|
|
379
470
|
get href(): string;
|
|
380
471
|
set href(val: string);
|
|
381
472
|
get origin(): string;
|
|
382
473
|
set origin(val: string);
|
|
383
|
-
/* public method */
|
|
384
474
|
assign(): void;
|
|
385
475
|
reload(): void;
|
|
386
476
|
replace(url: string): void;
|
|
387
477
|
toString(): string;
|
|
388
|
-
// For debug
|
|
389
478
|
get cache(): RuntimeCache<LocationContext>;
|
|
390
479
|
}
|
|
480
|
+
|
|
391
481
|
declare const Location: typeof TaroLocation;
|
|
482
|
+
|
|
392
483
|
interface HistoryState {
|
|
393
484
|
state: Record<string, any> | null;
|
|
394
485
|
title: string;
|
|
395
486
|
url: string;
|
|
396
487
|
}
|
|
397
|
-
type Options
|
|
488
|
+
type Options = {
|
|
398
489
|
window: any;
|
|
399
490
|
};
|
|
400
491
|
type HistoryContext = {
|
|
@@ -404,33 +495,30 @@ type HistoryContext = {
|
|
|
404
495
|
};
|
|
405
496
|
declare class TaroHistory extends Events {
|
|
406
497
|
#private;
|
|
407
|
-
constructor(location: TaroLocation, options: Options
|
|
408
|
-
/* public property */
|
|
498
|
+
constructor(location: TaroLocation, options: Options);
|
|
409
499
|
get length(): number;
|
|
410
500
|
get state(): Record<string, any> | null;
|
|
411
|
-
/* public method */
|
|
412
501
|
go(delta: number): void;
|
|
413
502
|
back(): void;
|
|
414
503
|
forward(): void;
|
|
415
504
|
pushState(state: any, title: string, url: string): void;
|
|
416
505
|
replaceState(state: any, title: string, url: string): void;
|
|
417
|
-
// For debug
|
|
418
506
|
get cache(): RuntimeCache<HistoryContext>;
|
|
419
507
|
}
|
|
508
|
+
|
|
420
509
|
declare const History: typeof TaroHistory;
|
|
510
|
+
|
|
421
511
|
declare const nav: typeof window.navigator;
|
|
422
|
-
|
|
512
|
+
|
|
423
513
|
declare let now: () => number;
|
|
424
|
-
// https://gist.github.com/paulirish/1579671
|
|
425
|
-
// https://gist.github.com/jalbam/5fe05443270fa6d8136238ec72accbc0
|
|
426
514
|
declare const _raf: typeof requestAnimationFrame | ((callback: any) => NodeJS.Timeout);
|
|
427
515
|
declare const _caf: typeof cancelAnimationFrame;
|
|
516
|
+
|
|
428
517
|
declare class TaroURL {
|
|
429
518
|
#private;
|
|
430
519
|
static createObjectURL(): void;
|
|
431
520
|
static revokeObjectURL(): void;
|
|
432
521
|
constructor(url: string, base?: string);
|
|
433
|
-
/* public property */
|
|
434
522
|
get protocol(): string;
|
|
435
523
|
set protocol(val: string);
|
|
436
524
|
get host(): string;
|
|
@@ -450,10 +538,8 @@ declare class TaroURL {
|
|
|
450
538
|
get origin(): string;
|
|
451
539
|
set origin(val: string);
|
|
452
540
|
get searchParams(): URLSearchParams;
|
|
453
|
-
// public method
|
|
454
541
|
toString(): string;
|
|
455
542
|
toJSON(): string;
|
|
456
|
-
// convenient for deconstructor
|
|
457
543
|
_toRaw(): {
|
|
458
544
|
protocol: string;
|
|
459
545
|
port: string;
|
|
@@ -466,7 +552,7 @@ declare class TaroURL {
|
|
|
466
552
|
href: string;
|
|
467
553
|
};
|
|
468
554
|
}
|
|
469
|
-
|
|
555
|
+
|
|
470
556
|
declare const TaroURLProvider: typeof TaroURL;
|
|
471
557
|
declare function parseUrl(url?: string): {
|
|
472
558
|
href: string;
|
|
@@ -479,7 +565,9 @@ declare function parseUrl(url?: string): {
|
|
|
479
565
|
search: string;
|
|
480
566
|
hash: string;
|
|
481
567
|
};
|
|
482
|
-
|
|
568
|
+
|
|
569
|
+
declare const URLSearchParams$1: any;
|
|
570
|
+
|
|
483
571
|
declare class TaroWindow extends Events {
|
|
484
572
|
navigator: Navigator;
|
|
485
573
|
requestAnimationFrame: typeof requestAnimationFrame | ((callback: any) => NodeJS.Timeout);
|
|
@@ -497,19 +585,20 @@ declare class TaroWindow extends Events {
|
|
|
497
585
|
setTimeout(...args: Parameters<typeof setTimeout>): NodeJS.Timeout;
|
|
498
586
|
clearTimeout(...args: Parameters<typeof clearTimeout>): void;
|
|
499
587
|
}
|
|
500
|
-
|
|
588
|
+
|
|
501
589
|
declare const taroWindowProvider: TaroWindow;
|
|
502
590
|
declare const taroLocationProvider: TaroLocation;
|
|
503
591
|
declare const taroHistoryProvider: TaroHistory;
|
|
504
|
-
|
|
592
|
+
|
|
505
593
|
declare class SVGElement extends TaroElement {
|
|
506
594
|
}
|
|
595
|
+
|
|
507
596
|
/**
|
|
508
597
|
* A MutationRecord represents an individual DOM mutation.
|
|
509
598
|
* It is the object that is passed to MutationObserver's callback.
|
|
510
599
|
* @see https://dom.spec.whatwg.org/#interface-mutationrecord
|
|
511
600
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord
|
|
512
|
-
|
|
601
|
+
*/
|
|
513
602
|
interface MutationRecord {
|
|
514
603
|
readonly target: TaroNode;
|
|
515
604
|
readonly addedNodes?: TaroNode[];
|
|
@@ -519,7 +608,6 @@ interface MutationRecord {
|
|
|
519
608
|
readonly attributeName?: string | null;
|
|
520
609
|
readonly attributeNamespace?: string | null;
|
|
521
610
|
oldValue?: string | null;
|
|
522
|
-
// extended
|
|
523
611
|
readonly type: MutationRecordType;
|
|
524
612
|
readonly value?: string | null;
|
|
525
613
|
}
|
|
@@ -528,6 +616,7 @@ declare const enum MutationRecordType {
|
|
|
528
616
|
CHARACTER_DATA = "characterData",
|
|
529
617
|
CHILD_LIST = "childList"
|
|
530
618
|
}
|
|
619
|
+
|
|
531
620
|
type MutationCallback = (mutations: MutationRecord[]) => any;
|
|
532
621
|
/**
|
|
533
622
|
* @see https://dom.spec.whatwg.org/#dictdef-mutationobserverinit
|
|
@@ -577,17 +666,16 @@ declare class MutationObserverImpl {
|
|
|
577
666
|
*/
|
|
578
667
|
takeRecords(): MutationRecord[];
|
|
579
668
|
}
|
|
669
|
+
|
|
580
670
|
declare class MutationObserver {
|
|
581
|
-
core: Pick<MutationObserverImpl,
|
|
671
|
+
core: Pick<MutationObserverImpl, 'observe' | 'disconnect' | 'takeRecords'>;
|
|
582
672
|
constructor(callback: MutationCallback);
|
|
583
|
-
observe(...args: [
|
|
584
|
-
TaroNode,
|
|
585
|
-
MutationObserverInit?
|
|
586
|
-
]): void;
|
|
673
|
+
observe(...args: [TaroNode, MutationObserverInit?]): void;
|
|
587
674
|
disconnect(): void;
|
|
588
675
|
takeRecords(): MutationRecord[];
|
|
589
676
|
static record(record: MutationRecord): void;
|
|
590
677
|
}
|
|
678
|
+
|
|
591
679
|
declare const PROPERTY_THRESHOLD = 2046;
|
|
592
680
|
declare const TARO_RUNTIME = "Taro runtime";
|
|
593
681
|
declare const HOOKS_APP_ID = "taro-app";
|
|
@@ -648,7 +736,8 @@ declare enum CONTEXT_ACTIONS {
|
|
|
648
736
|
RECOVER = "2",
|
|
649
737
|
DESTORY = "3"
|
|
650
738
|
}
|
|
651
|
-
|
|
739
|
+
|
|
740
|
+
interface Instance<T = Record<string, any>> extends Component$1<T>, Show, PageInstance {
|
|
652
741
|
tid?: string;
|
|
653
742
|
node?: TaroElement;
|
|
654
743
|
$forceUpdate?(): void;
|
|
@@ -660,17 +749,20 @@ interface PageProps {
|
|
|
660
749
|
}
|
|
661
750
|
interface ReactPageComponent<T = PageProps> extends ComponentClass<T>, PageInstance {
|
|
662
751
|
}
|
|
663
|
-
interface ReactPageInstance<T = PageProps> extends Component<T>, PageInstance {
|
|
752
|
+
interface ReactPageInstance<T = PageProps> extends Component$1<T>, PageInstance {
|
|
664
753
|
componentDidShow?(): void;
|
|
665
754
|
componentDidHide?(): void;
|
|
666
755
|
}
|
|
667
|
-
interface ReactAppInstance<T = AppInstance> extends Component<T>, AppInstance {
|
|
756
|
+
interface ReactAppInstance<T = AppInstance> extends Component$1<T>, AppInstance {
|
|
668
757
|
}
|
|
669
758
|
interface PageLifeCycle extends Show {
|
|
670
759
|
eh?(event: MpEvent): void;
|
|
671
760
|
onAddToFavorites?(): void;
|
|
672
761
|
onLoad?(options: Record<string, unknown>, cb?: TFunc): void;
|
|
673
762
|
onOptionMenuClick?(): void;
|
|
763
|
+
onKeyboardHeight?(obj: {
|
|
764
|
+
height: number;
|
|
765
|
+
}): void;
|
|
674
766
|
onPageScroll?(obj: {
|
|
675
767
|
scrollTop: number;
|
|
676
768
|
}): void;
|
|
@@ -703,9 +795,15 @@ interface PageInstance extends PageLifeCycle {
|
|
|
703
795
|
/** 页面的组件选项 */
|
|
704
796
|
options?: Record<string, unknown>;
|
|
705
797
|
/** 页面渲染引擎类型 */
|
|
706
|
-
renderer?:
|
|
798
|
+
renderer?: 'webview' | 'skyline';
|
|
799
|
+
/** 页面事件对象,支付宝小程序特有,详见[events](https://opendocs.alipay.com/mini/framework/page-detail#events) */
|
|
800
|
+
events?: Record<string, (...args: any[]) => any>;
|
|
707
801
|
/** 获得一个 EventChannel 对象,用于页面间通讯 */
|
|
708
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;
|
|
709
807
|
}
|
|
710
808
|
interface Show {
|
|
711
809
|
componentDidShow?(): void;
|
|
@@ -715,8 +813,8 @@ interface Show {
|
|
|
715
813
|
}
|
|
716
814
|
interface AppInstance extends Show {
|
|
717
815
|
componentDidShow?(options?: Record<string, unknown>): void;
|
|
718
|
-
mount?(component: React.ComponentClass |
|
|
719
|
-
mount?(component: React.ComponentClass |
|
|
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;
|
|
720
818
|
onError?(error: string): void;
|
|
721
819
|
onLaunch?(options?: Record<string, unknown>): void;
|
|
722
820
|
onPageNotFound?(res: any): void;
|
|
@@ -727,6 +825,7 @@ interface AppInstance extends Show {
|
|
|
727
825
|
taroGlobalData?: Record<any, any>;
|
|
728
826
|
config?: Record<any, any>;
|
|
729
827
|
}
|
|
828
|
+
|
|
730
829
|
interface Router {
|
|
731
830
|
params: Record<string, unknown>;
|
|
732
831
|
path: string;
|
|
@@ -744,11 +843,13 @@ interface Current {
|
|
|
744
843
|
}
|
|
745
844
|
declare const Current: Current;
|
|
746
845
|
declare const getCurrentInstance: () => Current;
|
|
846
|
+
|
|
747
847
|
interface IEventSource extends Map<string | undefined | null, TaroNode> {
|
|
748
848
|
removeNode(child: TaroNode): void;
|
|
749
849
|
removeNodeTree(child: TaroNode): void;
|
|
750
850
|
}
|
|
751
851
|
declare const eventSource: IEventSource;
|
|
852
|
+
|
|
752
853
|
declare function injectPageInstance(inst: Instance<PageProps>, id: string): void;
|
|
753
854
|
declare function getPageInstance(id: string): Instance | undefined;
|
|
754
855
|
declare function removePageInstance(id: string): void;
|
|
@@ -761,6 +862,7 @@ declare function getOnHideEventKey(path: string): string;
|
|
|
761
862
|
declare function createPageConfig(component: any, pageName?: string, data?: Record<string, unknown>, pageConfig?: PageConfig): PageInstance;
|
|
762
863
|
declare function createComponentConfig(component: React.ComponentClass, componentName?: string, data?: Record<string, unknown>): any;
|
|
763
864
|
declare function createRecursiveComponentConfig(componentName?: string): any;
|
|
865
|
+
|
|
764
866
|
/**
|
|
765
867
|
* React also has a fancy function's name for this: `hydrate()`.
|
|
766
868
|
* You may have been heard `hydrate` as a SSR-related function,
|
|
@@ -768,8 +870,11 @@ declare function createRecursiveComponentConfig(componentName?: string): any;
|
|
|
768
870
|
* it's a vnode traverser and modifier: that's exactly what Taro's doing in here.
|
|
769
871
|
*/
|
|
770
872
|
declare function hydrate(node: TaroElement | TaroText): MiniData;
|
|
873
|
+
|
|
771
874
|
declare const nextTick: (cb: TFunc, ctx?: Record<string, any>) => void;
|
|
772
|
-
|
|
875
|
+
|
|
876
|
+
declare const options: Options$2;
|
|
877
|
+
|
|
773
878
|
declare class Performance {
|
|
774
879
|
#private;
|
|
775
880
|
private recorder;
|
|
@@ -778,6 +883,18 @@ declare class Performance {
|
|
|
778
883
|
delayStop(id: string, delay?: number): ((...args: any[]) => void) | undefined;
|
|
779
884
|
}
|
|
780
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
|
+
|
|
781
898
|
declare const incrementId: () => () => string;
|
|
782
899
|
declare function isElement(node: TaroNode): node is TaroElement;
|
|
783
900
|
declare function isText(node: TaroNode): node is TaroText;
|
|
@@ -797,17 +914,8 @@ interface Ctor {
|
|
|
797
914
|
declare function extend(ctor: Ctor, methodName: string, options: TFunc | Record<string, any>): void;
|
|
798
915
|
declare function getComponentsAlias(): any;
|
|
799
916
|
declare function convertNumber2PX(value: number): string;
|
|
800
|
-
|
|
801
|
-
declare function debounce(fn: any, ms?: number, scope?: any): (...args: any[]) => void;
|
|
802
|
-
// export const removeLeadingSlash = (str = '') => str.replace(/^\.?\//, '')
|
|
803
|
-
// export const removeTrailingSearch = (str = '') => str.replace(/\?[\s\S]*$/, '')
|
|
804
|
-
declare const addLeadingSlash: (url?: string) => string;
|
|
805
|
-
declare const hasBasename: (path?: string, prefix?: string) => boolean;
|
|
806
|
-
declare const stripBasename: (path?: string, prefix?: string) => string;
|
|
807
|
-
declare const stripTrailing: (str?: string) => string;
|
|
808
|
-
declare const stripSuffix: (path?: string, suffix?: string) => string;
|
|
809
|
-
declare const getHomePage: (path?: string, basename?: string, customRoutes?: Record<string, string | string[]>, entryPagePath?: string) => string;
|
|
810
|
-
declare const getCurrentPage: (routerMode?: string, basename?: string) => string;
|
|
917
|
+
|
|
811
918
|
declare function handlePolyfill(): void;
|
|
812
|
-
|
|
813
|
-
export {
|
|
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, 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, isParentBinded, isText, taroLocationProvider as location, nav as navigator, nextTick, now, options, parseUrl, perf, removePageInstance, _raf as requestAnimationFrame, safeExecute, 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 };
|