@tarojs/runtime 3.7.0-alpha.2 → 3.7.0-alpha.4

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.
Files changed (67) hide show
  1. package/dist/runtime.cjs.d.ts +710 -0
  2. package/dist/runtime.cjs.js +4491 -0
  3. package/dist/runtime.esm.d.ts +20 -13
  4. package/dist/runtime.esm.js +133 -53
  5. package/dist/runtime.esm.js.map +1 -1
  6. package/dist/runtime.h5.d.ts +710 -0
  7. package/dist/runtime.h5.js +3249 -0
  8. package/package.json +11 -6
  9. package/dist/bom/URL.d.ts +0 -61
  10. package/dist/bom/URLSearchParams.d.ts +0 -14
  11. package/dist/bom/document.d.ts +0 -2
  12. package/dist/bom/getComputedStyle.d.ts +0 -3
  13. package/dist/bom/history.d.ts +0 -29
  14. package/dist/bom/location.d.ts +0 -36
  15. package/dist/bom/navigator.d.ts +0 -1
  16. package/dist/bom/raf.d.ts +0 -5
  17. package/dist/bom/window.d.ts +0 -4
  18. package/dist/constants/index.d.ts +0 -58
  19. package/dist/current.d.ts +0 -19
  20. package/dist/dom/anchor-element.d.ts +0 -13
  21. package/dist/dom/class-list.d.ts +0 -14
  22. package/dist/dom/custom-wrapper.d.ts +0 -4
  23. package/dist/dom/document.d.ts +0 -20
  24. package/dist/dom/element.d.ts +0 -38
  25. package/dist/dom/event-source.d.ts +0 -7
  26. package/dist/dom/event-target.d.ts +0 -7
  27. package/dist/dom/event.d.ts +0 -23
  28. package/dist/dom/form.d.ts +0 -7
  29. package/dist/dom/node.d.ts +0 -75
  30. package/dist/dom/node_types.d.ts +0 -10
  31. package/dist/dom/root.d.ts +0 -15
  32. package/dist/dom/style.d.ts +0 -14
  33. package/dist/dom/style_properties.d.ts +0 -3
  34. package/dist/dom/svg.d.ts +0 -3
  35. package/dist/dom/text.d.ts +0 -14
  36. package/dist/dom/tree.d.ts +0 -4
  37. package/dist/dom-external/element.d.ts +0 -3
  38. package/dist/dom-external/index.d.ts +0 -1
  39. package/dist/dom-external/inner-html/html.d.ts +0 -2
  40. package/dist/dom-external/inner-html/parser.d.ts +0 -25
  41. package/dist/dom-external/inner-html/scaner.d.ts +0 -30
  42. package/dist/dom-external/inner-html/style.d.ts +0 -27
  43. package/dist/dom-external/inner-html/tags.d.ts +0 -8
  44. package/dist/dom-external/inner-html/utils.d.ts +0 -1
  45. package/dist/dom-external/mutation-observer/implements.d.ts +0 -52
  46. package/dist/dom-external/mutation-observer/index.d.ts +0 -13
  47. package/dist/dom-external/mutation-observer/record.d.ts +0 -24
  48. package/dist/dom-external/node.d.ts +0 -11
  49. package/dist/dsl/common.d.ts +0 -16
  50. package/dist/dsl/instance.d.ts +0 -87
  51. package/dist/emitter/emitter.d.ts +0 -4
  52. package/dist/env.d.ts +0 -7
  53. package/dist/hydrate.d.ts +0 -10
  54. package/dist/index.d.ts +0 -30
  55. package/dist/interface/element.d.ts +0 -4
  56. package/dist/interface/event-target.d.ts +0 -10
  57. package/dist/interface/event.d.ts +0 -15
  58. package/dist/interface/hydrate.d.ts +0 -30
  59. package/dist/interface/index.d.ts +0 -7
  60. package/dist/interface/node.d.ts +0 -7
  61. package/dist/interface/options.d.ts +0 -16
  62. package/dist/interface/utils.d.ts +0 -2
  63. package/dist/next-tick.d.ts +0 -2
  64. package/dist/options.d.ts +0 -2
  65. package/dist/perf.d.ts +0 -7
  66. package/dist/utils/cache.d.ts +0 -12
  67. package/dist/utils/index.d.ts +0 -23
@@ -0,0 +1,710 @@
1
+ import { Shortcuts, Events } from "@tarojs/shared";
2
+ import { PageConfig } from "@tarojs/taro";
3
+ import VueCtor from "vue";
4
+ import { ComponentOptions, VNode } from "vue";
5
+ import { Component as Vue3Component } from "@vue/runtime-core";
6
+ import { Component, ComponentClass } from "react";
7
+ import { CombinedVueInstance } from "vue/types/vue";
8
+ declare let document: any;
9
+ declare class ClassList {
10
+ private el;
11
+ private tokenList;
12
+ constructor(className: string, el: TaroElement);
13
+ get value(): string;
14
+ get length(): number;
15
+ add(): void;
16
+ remove(): void;
17
+ contains(token: string): boolean;
18
+ toggle(token: string, force: boolean): boolean;
19
+ replace(token: string, replacement_token: string): void;
20
+ toString(): string;
21
+ private checkTokenIsValid;
22
+ private _update;
23
+ }
24
+ interface Attributes {
25
+ name: string;
26
+ value: string;
27
+ }
28
+ interface EventOptions {
29
+ bubbles: boolean;
30
+ cancelable: boolean;
31
+ }
32
+ type Target = Record<string, unknown> & {
33
+ dataset: Record<string, unknown>;
34
+ id: string;
35
+ };
36
+ interface MpEvent {
37
+ type: string;
38
+ detail: Record<string, unknown>;
39
+ target: Target;
40
+ currentTarget: Target;
41
+ }
42
+ interface EventListenerOptions {
43
+ capture?: boolean;
44
+ }
45
+ interface AddEventListenerOptions extends EventListenerOptions {
46
+ once?: boolean;
47
+ passive?: boolean;
48
+ }
49
+ interface EventHandler extends Function {
50
+ _stop?: boolean;
51
+ }
52
+ interface MpInstance {
53
+ config: PageConfig;
54
+ setData: (data: unknown, cb: () => void) => void;
55
+ route?: string;
56
+ __route__: string;
57
+ $taroParams?: Record<string, unknown>;
58
+ $taroPath: string;
59
+ __data__: any;
60
+ data: any;
61
+ exitState?: any;
62
+ selectComponent: (selector: string) => any;
63
+ }
64
+ interface MiniElementData {
65
+ [Shortcuts.Childnodes]?: MiniData[];
66
+ [Shortcuts.NodeName]: string;
67
+ [Shortcuts.Class]?: string;
68
+ [Shortcuts.Style]?: string;
69
+ uid?: string;
70
+ sid: string;
71
+ [key: string]: unknown;
72
+ }
73
+ interface MiniTextData {
74
+ [Shortcuts.Text]: string;
75
+ [Shortcuts.NodeName]: string;
76
+ }
77
+ type MiniData = MiniElementData | MiniTextData;
78
+ type HydratedData = () => MiniData | MiniData[];
79
+ type UpdatePayloadValue = string | boolean | HydratedData;
80
+ type DataTree = Record<string, UpdatePayloadValue | ReturnType<HydratedData>>;
81
+ interface UpdatePayload {
82
+ path: string;
83
+ value: UpdatePayloadValue;
84
+ }
85
+ declare const enum NodeType {
86
+ ELEMENT_NODE = 1,
87
+ ATTRIBUTE_NODE = 2,
88
+ TEXT_NODE = 3,
89
+ CDATA_SECTION_NODE = 4,
90
+ ENTITY_REFERENCE_NODE = 5,
91
+ COMMENT_NODE = 6,
92
+ PROCESSING_INSTRUCTION_NODE = 7,
93
+ DOCUMENT_NODE = 9
94
+ }
95
+ declare class TaroText extends TaroNode {
96
+ _value: string;
97
+ nodeType: NodeType;
98
+ nodeName: string;
99
+ constructor(value: any);
100
+ set textContent(text: string);
101
+ get textContent(): string;
102
+ set nodeValue(text: string);
103
+ get nodeValue(): string;
104
+ set data(text: string);
105
+ get data(): string;
106
+ }
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
+ interface Node {
172
+ type: string;
173
+ }
174
+ interface Comment extends Node {
175
+ type: "comment";
176
+ content: string;
177
+ }
178
+ interface Text extends Node {
179
+ type: "text";
180
+ content: string;
181
+ }
182
+ interface Element extends Node {
183
+ type: "element";
184
+ tagName: string;
185
+ children: ChildNode[];
186
+ attributes: string[];
187
+ }
188
+ type ChildNode = Comment | Text | Element;
189
+ interface Options {
190
+ prerender: boolean;
191
+ debug: boolean;
192
+ html?: {
193
+ skipElements: Set<string>;
194
+ voidElements: Set<string>;
195
+ closingElements: Set<string>;
196
+ transformText?: (taroText: TaroText, text: Text) => TaroText;
197
+ transformElement?: (taroElement: TaroElement, element: Element) => TaroElement;
198
+ renderHTMLTag: boolean;
199
+ };
200
+ miniGlobal?: any;
201
+ }
202
+ type Func = (...args: any[]) => any;
203
+ type Ctx = Record<string, any>;
204
+ declare class TaroEventTarget {
205
+ __handlers: Record<string, EventHandler[]>;
206
+ addEventListener(type: string, handler: EventHandler, options?: boolean | AddEventListenerOptions): void;
207
+ removeEventListener(type: string, handler: EventHandler): void;
208
+ isAnyEventBinded(): boolean;
209
+ }
210
+ interface RemoveChildOptions {
211
+ cleanRef?: boolean;
212
+ doUpdate?: boolean;
213
+ }
214
+ declare class TaroNode extends TaroEventTarget {
215
+ uid: string;
216
+ sid: string;
217
+ nodeType: NodeType;
218
+ nodeName: string;
219
+ parentNode: TaroNode | null;
220
+ childNodes: TaroNode[];
221
+ constructor();
222
+ private hydrate;
223
+ private updateChildNodes;
224
+ get _root(): TaroRootElement | null;
225
+ protected findIndex(refChild: TaroNode): number;
226
+ get _path(): string;
227
+ get nextSibling(): TaroNode | null;
228
+ get previousSibling(): TaroNode | null;
229
+ get parentElement(): TaroElement | null;
230
+ get firstChild(): TaroNode | null;
231
+ get lastChild(): TaroNode | null;
232
+ /**
233
+ * @textContent 目前只能置空子元素
234
+ * @TODO 等待完整 innerHTML 实现
235
+ */
236
+ // eslint-disable-next-line accessor-pairs
237
+ set textContent(text: string);
238
+ /**
239
+ * @doc https://developer.mozilla.org/zh-CN/docs/Web/API/Node/insertBefore
240
+ * @scenario
241
+ * [A,B,C]
242
+ * 1. insert D before C, D has no parent
243
+ * 2. insert D before C, D has the same parent of C
244
+ * 3. insert D before C, D has the different parent of C
245
+ */
246
+ insertBefore<T extends TaroNode>(newChild: T, refChild?: TaroNode | null, isReplace?: boolean): T;
247
+ /**
248
+ * @doc https://developer.mozilla.org/zh-CN/docs/Web/API/Node/appendChild
249
+ * @scenario
250
+ * [A,B,C]
251
+ * 1. append C, C has no parent
252
+ * 2. append C, C has the same parent of B
253
+ * 3. append C, C has the different parent of B
254
+ */
255
+ appendChild(newChild: TaroNode): TaroNode;
256
+ /**
257
+ * @doc https://developer.mozilla.org/zh-CN/docs/Web/API/Node/replaceChild
258
+ * @scenario
259
+ * [A,B,C]
260
+ * 1. replace B with C, C has no parent
261
+ * 2. replace B with C, C has no parent, C has the same parent of B
262
+ * 3. replace B with C, C has no parent, C has the different parent of B
263
+ */
264
+ replaceChild(newChild: TaroNode, oldChild: TaroNode): TaroNode | undefined;
265
+ /**
266
+ * @doc https://developer.mozilla.org/zh-CN/docs/Web/API/Node/removeChild
267
+ * @scenario
268
+ * [A,B,C]
269
+ * 1. remove A or B
270
+ * 2. remove C
271
+ */
272
+ removeChild<T extends TaroNode>(child: T, options?: RemoveChildOptions): T;
273
+ remove(options?: RemoveChildOptions): void;
274
+ hasChildNodes(): boolean;
275
+ enqueueUpdate(payload: UpdatePayload): void;
276
+ get ownerDocument(): TaroDocument;
277
+ static extend(methodName: string, options: Func | Record<string, any>): void;
278
+ }
279
+ declare class Style {
280
+ _pending: boolean;
281
+ _usedStyleProp: Set<string>;
282
+ _value: Partial<CSSStyleDeclaration>;
283
+ _element: TaroElement;
284
+ constructor(element: TaroElement);
285
+ private setCssVariables;
286
+ get cssText(): string;
287
+ set cssText(str: string);
288
+ setProperty(propertyName: string, value?: string | null): void;
289
+ removeProperty(propertyName: string): string;
290
+ getPropertyValue(propertyName: string): any;
291
+ }
292
+ declare class TaroElement extends TaroNode {
293
+ tagName: string;
294
+ props: Record<string, any>;
295
+ style: Style;
296
+ dataset: Record<string, unknown>;
297
+ innerHTML: string;
298
+ constructor();
299
+ private _stopPropagation;
300
+ get id(): string;
301
+ set id(val: string);
302
+ get className(): string;
303
+ set className(val: string);
304
+ get cssText(): string;
305
+ get classList(): ClassList;
306
+ get children(): TaroElement[];
307
+ get attributes(): Attributes[];
308
+ get textContent(): string;
309
+ set textContent(text: string);
310
+ hasAttribute(qualifiedName: string): boolean;
311
+ hasAttributes(): boolean;
312
+ get focus(): () => void;
313
+ // 兼容 Vue3,详情请见:https://github.com/NervJS/taro/issues/10579
314
+ set focus(value: () => void);
315
+ blur(): void;
316
+ setAttribute(qualifiedName: string, value: any): void;
317
+ removeAttribute(qualifiedName: string): void;
318
+ getAttribute(qualifiedName: string): string;
319
+ getElementsByTagName(tagName: string): TaroElement[];
320
+ getElementsByClassName(className: string): TaroElement[];
321
+ dispatchEvent(event: TaroEvent): boolean;
322
+ addEventListener(type: any, handler: any, options: any): void;
323
+ removeEventListener(type: any, handler: any, sideEffect?: boolean): void;
324
+ static extend(methodName: string, options: Func | Record<string, any>): void;
325
+ }
326
+ declare function getComputedStyle(element: TaroElement): Style;
327
+ declare const eventCenter: Events;
328
+ type EventsType = typeof Events;
329
+ /**
330
+ * 一个小型缓存池,用于在切换页面时,存储一些上下文信息
331
+ */
332
+ declare class RuntimeCache<T> {
333
+ name: string;
334
+ cache: Map<string, T>;
335
+ constructor(name: string);
336
+ has(identifier: string): boolean;
337
+ set(identifier: string, ctx: T): void;
338
+ get(identifier: string): T | undefined;
339
+ delete(identifier: string): void;
340
+ }
341
+ declare namespace LocationType {
342
+ const eventCenter: Events;
343
+ type EventsType = typeof Events;
344
+ /**
345
+ * 一个小型缓存池,用于在切换页面时,存储一些上下文信息
346
+ */
347
+ class RuntimeCache<T> {
348
+ name: string;
349
+ cache: Map<string, T>;
350
+ constructor(name: string);
351
+ has(identifier: string): boolean;
352
+ set(identifier: string, ctx: T): void;
353
+ get(identifier: string): T | undefined;
354
+ delete(identifier: string): void;
355
+ }
356
+ type Options = {
357
+ window: any;
358
+ };
359
+ type LocationContext = {
360
+ lastHref: string;
361
+ };
362
+ class Location extends Events {
363
+ #private;
364
+ constructor(options: Options);
365
+ /* public property */
366
+ get protocol(): string;
367
+ set protocol(val: string);
368
+ get host(): string;
369
+ set host(val: string);
370
+ get hostname(): string;
371
+ set hostname(val: string);
372
+ get port(): string;
373
+ set port(val: string);
374
+ get pathname(): string;
375
+ set pathname(val: string);
376
+ get search(): string;
377
+ set search(val: string);
378
+ get hash(): string;
379
+ // 小程序的navigateTo存在截断hash字符串的问题
380
+ set hash(val: string);
381
+ get href(): string;
382
+ set href(val: string);
383
+ get origin(): string;
384
+ set origin(val: string);
385
+ /* public method */
386
+ assign(): void;
387
+ reload(): void;
388
+ replace(url: string): void;
389
+ toString(): string;
390
+ // For debug
391
+ get cache(): RuntimeCache<LocationContext>;
392
+ }
393
+ }
394
+ interface HistoryState {
395
+ state: Record<string, any> | null;
396
+ title: string;
397
+ url: string;
398
+ }
399
+ type Options$0 = {
400
+ window: any;
401
+ };
402
+ type HistoryContext = {
403
+ location: LocationType.Location;
404
+ stack: HistoryState[];
405
+ cur: number;
406
+ };
407
+ declare class History extends Events {
408
+ #private;
409
+ constructor(location: LocationType.Location, options: Options$0);
410
+ /* public property */
411
+ get length(): number;
412
+ get state(): Record<string, any> | null;
413
+ /* public method */
414
+ go(delta: number): void;
415
+ back(): void;
416
+ forward(): void;
417
+ pushState(state: any, title: string, url: string): void;
418
+ replaceState(state: any, title: string, url: string): void;
419
+ // For debug
420
+ get cache(): RuntimeCache<HistoryContext>;
421
+ }
422
+ declare const nav: any;
423
+ // https://github.com/myrne/performance-now
424
+ declare let now: () => number;
425
+ // https://gist.github.com/paulirish/1579671
426
+ // https://gist.github.com/jalbam/5fe05443270fa6d8136238ec72accbc0
427
+ declare const _raf: typeof requestAnimationFrame | ((callback: any) => NodeJS.Timeout);
428
+ declare const _caf: typeof cancelAnimationFrame;
429
+ declare class URLSearchParams {
430
+ #private;
431
+ constructor(query: any);
432
+ append(name: string, value: string): void;
433
+ delete(name: string): void;
434
+ get(name: string): any;
435
+ getAll(name: string): any;
436
+ has(name: string): boolean;
437
+ keys(): string[];
438
+ set(name: string, value: string): void;
439
+ forEach(callback: any, thisArg: any): void;
440
+ toJSON(): {};
441
+ toString(): string;
442
+ }
443
+ declare class URL {
444
+ #private;
445
+ static createObjectURL(): void;
446
+ static revokeObjectURL(): void;
447
+ constructor(url: string, base?: string);
448
+ /* public property */
449
+ get protocol(): string;
450
+ set protocol(val: string);
451
+ get host(): string;
452
+ set host(val: string);
453
+ get hostname(): string;
454
+ set hostname(val: string);
455
+ get port(): string;
456
+ set port(val: string);
457
+ get pathname(): string;
458
+ set pathname(val: string);
459
+ get search(): string;
460
+ set search(val: string);
461
+ get hash(): string;
462
+ set hash(val: string);
463
+ get href(): string;
464
+ set href(val: string);
465
+ get origin(): string;
466
+ set origin(val: string);
467
+ get searchParams(): URLSearchParams;
468
+ // public method
469
+ toString(): string;
470
+ toJSON(): string;
471
+ // convenient for deconstructor
472
+ _toRaw(): {
473
+ protocol: string;
474
+ port: string;
475
+ host: string;
476
+ hostname: string;
477
+ pathname: string;
478
+ hash: string;
479
+ search: string;
480
+ origin: string;
481
+ href: string;
482
+ };
483
+ }
484
+ declare function parseUrl(url?: string): {
485
+ href: string;
486
+ origin: string;
487
+ protocol: string;
488
+ hostname: string;
489
+ host: string;
490
+ port: string;
491
+ pathname: string;
492
+ search: string;
493
+ hash: string;
494
+ };
495
+ declare let window: any;
496
+ declare const location: any;
497
+ declare const history: any;
498
+ // for Vue3
499
+ declare class SVGElement extends TaroElement {
500
+ }
501
+ /**
502
+ * A MutationRecord represents an individual DOM mutation.
503
+ * It is the object that is passed to MutationObserver's callback.
504
+ * @see https://dom.spec.whatwg.org/#interface-mutationrecord
505
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord
506
+ */
507
+ interface MutationRecord {
508
+ readonly target: TaroNode;
509
+ readonly addedNodes?: TaroNode[];
510
+ readonly removedNodes?: TaroNode[];
511
+ readonly previousSibling?: TaroNode | null;
512
+ readonly nextSibling?: TaroNode | null;
513
+ readonly attributeName?: string | null;
514
+ readonly attributeNamespace?: string | null;
515
+ oldValue?: string | null;
516
+ // extended
517
+ readonly type: MutationRecordType;
518
+ readonly value?: string | null;
519
+ }
520
+ declare const enum MutationRecordType {
521
+ ATTRIBUTES = "attributes",
522
+ CHARACTER_DATA = "characterData",
523
+ CHILD_LIST = "childList"
524
+ }
525
+ type MutationCallback = (mutations: MutationRecord[]) => any;
526
+ /**
527
+ * @see https://dom.spec.whatwg.org/#dictdef-mutationobserverinit
528
+ */
529
+ interface MutationObserverInit {
530
+ attributeFilter?: string[];
531
+ attributeOldValue?: boolean;
532
+ attributes?: boolean;
533
+ characterData?: boolean;
534
+ characterDataOldValue?: boolean;
535
+ childList?: boolean;
536
+ subtree?: boolean;
537
+ }
538
+ /**
539
+ * The MutationObserver provides the ability
540
+ * to watch for changes being made to the DOM tree.
541
+ * It will invoke a specified callback function
542
+ * when DOM changes occur.
543
+ * @see https://dom.spec.whatwg.org/#mutationobserver
544
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
545
+ */
546
+ declare class MutationObserverImpl {
547
+ callback: MutationCallback;
548
+ target: TaroNode | null;
549
+ options: MutationObserverInit;
550
+ records: MutationRecord[];
551
+ constructor(callback: MutationCallback);
552
+ /**
553
+ * Configures the MutationObserver
554
+ * to begin receiving notifications
555
+ * through its callback function
556
+ * when DOM changes matching the given options occur.
557
+ *
558
+ * Options matching is to be implemented.
559
+ */
560
+ observe(target: TaroNode, options?: MutationObserverInit): void;
561
+ /**
562
+ * Stop the MutationObserver instance
563
+ * from receiving further notifications
564
+ * until and unless observe() is called again.
565
+ */
566
+ disconnect(): void;
567
+ /**
568
+ * Removes all pending notifications
569
+ * from the MutationObserver's notification queue
570
+ * and returns them in a new Array of MutationRecord objects.
571
+ */
572
+ takeRecords(): MutationRecord[];
573
+ }
574
+ declare class MutationObserver {
575
+ core: Pick<MutationObserverImpl, "observe" | "disconnect" | "takeRecords">;
576
+ constructor(callback: MutationCallback);
577
+ observe(...args: [
578
+ TaroNode,
579
+ MutationObserverInit?
580
+ ]): void;
581
+ disconnect(): void;
582
+ takeRecords(): MutationRecord[];
583
+ static record(record: MutationRecord): void;
584
+ }
585
+ interface Instance<T = Record<string, any>> extends Component<T>, Show, PageInstance {
586
+ tid?: string;
587
+ $forceUpdate?(): void;
588
+ $nextTick?(cb: () => void): void;
589
+ $options: Instance;
590
+ }
591
+ interface VueAppInstance extends ComponentOptions<VueCtor> {
592
+ $options: AppInstance;
593
+ }
594
+ type VueInstance<M = Record<string, any>, P = Record<string, any>> = CombinedVueInstance<VueCtor, Record<string, any>, M, P, Record<never, any>> & VueInternal;
595
+ interface VueInternal {
596
+ _render(): VNode;
597
+ _update(vnode: VNode, hyrate: boolean): void;
598
+ }
599
+ interface PageProps {
600
+ tid?: string;
601
+ }
602
+ interface ReactPageComponent<T = PageProps> extends ComponentClass<T>, PageInstance {
603
+ }
604
+ interface ReactPageInstance<T = PageProps> extends Component<T>, PageInstance {
605
+ componentDidShow?(): void;
606
+ componentDidHide?(): void;
607
+ }
608
+ interface ReactAppInstance<T = AppInstance> extends Component<T>, AppInstance {
609
+ }
610
+ interface PageLifeCycle extends Show {
611
+ eh?(event: MpEvent): void;
612
+ onAddToFavorites?(): void;
613
+ onLoad?(options: Record<string, unknown>, cb?: Func): void;
614
+ onOptionMenuClick?(): void;
615
+ onPageScroll?(obj: {
616
+ scrollTop: number;
617
+ }): void;
618
+ onPullDownRefresh?(): void;
619
+ onPullIntercept?(): void;
620
+ onPopMenuClick?(): void;
621
+ onReachBottom?(): void;
622
+ onReady?(): void;
623
+ onResize?(options: unknown): void;
624
+ onSaveExitState?(): void;
625
+ onShareAppMessage?(obj: {
626
+ from: string;
627
+ target?: TaroElement;
628
+ webViewUrl: string;
629
+ }): void;
630
+ onShareTimeline?(): void;
631
+ onTabItemTap?(obj: {
632
+ index: string;
633
+ pagePath: string;
634
+ text: string;
635
+ }): void;
636
+ onTitleClick?(): void;
637
+ onUnload?(): void;
638
+ }
639
+ interface PageInstance extends PageLifeCycle {
640
+ /** 页面的初始数据 */
641
+ data?: Record<string, unknown>;
642
+ /** 页面路径 */
643
+ path?: string;
644
+ /** 页面的组件选项 */
645
+ options?: Record<string, unknown>;
646
+ /** 页面渲染引擎类型 */
647
+ renderer?: "webview" | "skyline";
648
+ }
649
+ interface Show {
650
+ componentDidShow?(): void;
651
+ componentDidHide?(): void;
652
+ onShow?(): void;
653
+ onHide?(): void;
654
+ }
655
+ interface AppInstance extends Show {
656
+ componentDidShow?(options?: Record<string, unknown>): void;
657
+ mount?(component: React.ComponentClass | ComponentOptions<VueCtor> | Vue3Component, id: string, cb: (...args: any[]) => void): void;
658
+ onError?(error: string): void;
659
+ onLaunch?(options?: Record<string, unknown>): void;
660
+ onPageNotFound?(res: any): void;
661
+ onUnhandledRejection?(error: any): void;
662
+ onShow?(options?: Record<string, unknown>): void;
663
+ unmount?(id: string, cb?: () => void): void;
664
+ taroGlobalData?: Record<any, any>;
665
+ config?: Record<any, any>;
666
+ }
667
+ interface Router {
668
+ params: Record<string, unknown>;
669
+ path: string;
670
+ $taroPath: string;
671
+ onReady: string;
672
+ onHide: string;
673
+ onShow: string;
674
+ exitState?: any;
675
+ }
676
+ interface Current {
677
+ app: AppInstance | null;
678
+ router: Router | null;
679
+ page: PageInstance | null;
680
+ preloadData?: any;
681
+ }
682
+ declare const Current: Current;
683
+ declare const getCurrentInstance: () => Current;
684
+ interface IEventSource extends Map<string | undefined | null, TaroNode> {
685
+ removeNode(child: TaroNode): void;
686
+ removeNodeTree(child: TaroNode): void;
687
+ }
688
+ declare const eventSource: IEventSource;
689
+ declare function injectPageInstance(inst: Instance<PageProps>, id: string): void;
690
+ declare function getPageInstance(id: string): Instance | undefined;
691
+ declare function removePageInstance(id: string): void;
692
+ declare function addLeadingSlash(path?: string): string;
693
+ declare function safeExecute(path: string, lifecycle: string, ...args: unknown[]): any;
694
+ declare function stringify(obj?: Record<string, unknown>): string;
695
+ declare function getPath(id: string, options?: Record<string, unknown>): string;
696
+ declare function createPageConfig(component: any, pageName?: string, data?: Record<string, unknown>, pageConfig?: PageConfig): PageInstance;
697
+ declare function createComponentConfig(component: React.ComponentClass, componentName?: string, data?: Record<string, unknown>): any;
698
+ declare function createRecursiveComponentConfig(componentName?: string): any;
699
+ /**
700
+ * React also has a fancy function's name for this: `hydrate()`.
701
+ * You may have been heard `hydrate` as a SSR-related function,
702
+ * actually, `hydrate` basicly do the `render()` thing, but ignore some properties,
703
+ * it's a vnode traverser and modifier: that's exactly what Taro's doing in here.
704
+ */
705
+ declare function hydrate(node: TaroElement | TaroText): MiniData;
706
+ declare const nextTick: (cb: Func, ctx?: Record<string, any>) => void;
707
+ declare const options: Options;
708
+ declare const incrementId: () => () => string;
709
+ export { hooks } from '@tarojs/shared';
710
+ 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 };