@tarojs/runtime 4.1.3-alpha.0 → 4.1.3-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/bom/URL.d.ts +3 -4
  2. package/dist/bom/URL.js.map +1 -1
  3. package/dist/bom/URLSearchParams.d.ts +1 -0
  4. package/dist/bom/URLSearchParams.js.map +1 -1
  5. package/dist/bom/document.d.ts +3 -1
  6. package/dist/bom/document.js.map +1 -1
  7. package/dist/bom/getComputedStyle.d.ts +6 -3
  8. package/dist/bom/getComputedStyle.js.map +1 -1
  9. package/dist/bom/history.d.ts +8 -6
  10. package/dist/bom/history.js.map +1 -1
  11. package/dist/bom/location.d.ts +6 -5
  12. package/dist/bom/location.js.map +1 -1
  13. package/dist/bom/navigator.d.ts +1 -0
  14. package/dist/bom/navigator.js.map +1 -1
  15. package/dist/bom/raf.d.ts +2 -2
  16. package/dist/bom/raf.js.map +1 -1
  17. package/dist/bom/window.d.ts +11 -8
  18. package/dist/bom/window.js.map +1 -1
  19. package/dist/constants/index.d.ts +2 -1
  20. package/dist/constants/index.js.map +1 -1
  21. package/dist/current.d.ts +5 -2
  22. package/dist/current.js.map +1 -1
  23. package/dist/dom/anchor-element.js.map +1 -1
  24. package/dist/dom/class-list.d.ts +3 -1
  25. package/dist/dom/class-list.js.map +1 -1
  26. package/dist/dom/document.d.ts +7 -8
  27. package/dist/dom/document.js.map +1 -1
  28. package/dist/dom/element.d.ts +8 -5
  29. package/dist/dom/element.js.map +1 -1
  30. package/dist/dom/event-source.d.ts +3 -1
  31. package/dist/dom/event-source.js.map +1 -1
  32. package/dist/dom/event-target.d.ts +3 -1
  33. package/dist/dom/event-target.js.map +1 -1
  34. package/dist/dom/event.d.ts +4 -2
  35. package/dist/dom/event.js.map +1 -1
  36. package/dist/dom/form.d.ts +4 -2
  37. package/dist/dom/form.js.map +1 -1
  38. package/dist/dom/node.d.ts +9 -37
  39. package/dist/dom/node.js.map +1 -1
  40. package/dist/{node_types-9ac5b4dd.d.ts → dom/node_types.d.ts} +1 -0
  41. package/dist/dom/root.d.ts +6 -2
  42. package/dist/dom/root.js.map +1 -1
  43. package/dist/dom/style.d.ts +3 -1
  44. package/dist/dom/style.js.map +1 -1
  45. package/dist/dom/style_properties.js.map +1 -1
  46. package/dist/dom/svg.d.ts +3 -1
  47. package/dist/dom/svg.js.map +1 -1
  48. package/dist/dom/text.d.ts +4 -2
  49. package/dist/dom/text.js.map +1 -1
  50. package/dist/dom/transfer.js.map +1 -1
  51. package/dist/dom/tree.js.map +1 -1
  52. package/dist/dom-external/element.js.map +1 -1
  53. package/dist/dom-external/index.js.map +1 -1
  54. package/dist/dom-external/inner-html/html.js.map +1 -1
  55. package/dist/dom-external/inner-html/parser.d.ts +2 -7
  56. package/dist/dom-external/inner-html/parser.js.map +1 -1
  57. package/dist/dom-external/inner-html/scaner.js.map +1 -1
  58. package/dist/dom-external/inner-html/style.js.map +1 -1
  59. package/dist/dom-external/inner-html/tags.js.map +1 -1
  60. package/dist/dom-external/inner-html/utils.js.map +1 -1
  61. package/dist/dom-external/mutation-observer/implements.d.ts +6 -22
  62. package/dist/dom-external/mutation-observer/implements.js.map +1 -1
  63. package/dist/dom-external/mutation-observer/index.d.ts +7 -4
  64. package/dist/dom-external/mutation-observer/index.js.map +1 -1
  65. package/dist/{record-32b054d8.d.ts → dom-external/mutation-observer/record.d.ts} +5 -2
  66. package/dist/dom-external/node.js.map +1 -1
  67. package/dist/dsl/common.d.ts +5 -4
  68. package/dist/dsl/common.js.map +1 -1
  69. package/dist/{instance-530729bd.d.ts → dsl/instance.d.ts} +13 -11
  70. package/dist/emitter/emitter.d.ts +5 -1
  71. package/dist/emitter/emitter.js.map +1 -1
  72. package/dist/env.d.ts +3 -1
  73. package/dist/env.js.map +1 -1
  74. package/dist/hydrate.d.ts +5 -3
  75. package/dist/hydrate.js.map +1 -1
  76. package/dist/index.cjs.d.ts +87 -70
  77. package/dist/index.cjs.js +4 -4
  78. package/dist/index.cjs.js.map +1 -1
  79. package/dist/index.d.ts +41 -34
  80. package/dist/interface/element.d.ts +6 -0
  81. package/dist/interface/event-target.d.ts +13 -0
  82. package/dist/interface/event.d.ts +16 -0
  83. package/dist/interface/hydrate.d.ts +32 -0
  84. package/dist/interface/node.d.ts +10 -0
  85. package/dist/{options-530729bd.d.ts → interface/options.d.ts} +6 -4
  86. package/dist/interface/utils.d.ts +4 -0
  87. package/dist/next-tick.d.ts +3 -1
  88. package/dist/next-tick.js.map +1 -1
  89. package/dist/options.d.ts +3 -1
  90. package/dist/options.js.map +1 -1
  91. package/dist/perf.d.ts +1 -0
  92. package/dist/perf.js.map +1 -1
  93. package/dist/polyfill/array.js.map +1 -1
  94. package/dist/polyfill/index.d.ts +1 -0
  95. package/dist/polyfill/index.js.map +1 -1
  96. package/dist/polyfill/intersection-observer.js.map +1 -1
  97. package/dist/polyfill/object.js.map +1 -1
  98. package/dist/runtime.esm.d.ts +87 -70
  99. package/dist/runtime.esm.js.map +1 -1
  100. package/dist/utils/cache.d.ts +1 -0
  101. package/dist/utils/cache.js.map +1 -1
  102. package/dist/utils/index.d.ts +7 -7
  103. package/dist/utils/index.js.map +1 -1
  104. package/dist/utils/lodash.d.ts +2 -1
  105. package/dist/utils/lodash.js.map +1 -1
  106. package/dist/utils/router.d.ts +2 -1
  107. package/dist/utils/router.js.map +1 -1
  108. package/package.json +4 -6
  109. package/dist/dom/anchor-element.d.ts +0 -14
  110. package/dist/dom/style_properties.d.ts +0 -3
  111. package/dist/dom/transfer.d.ts +0 -8
  112. package/dist/dom/tree.d.ts +0 -4
  113. package/dist/dom-external/element.d.ts +0 -4
  114. package/dist/dom-external/index.d.ts +0 -1
  115. package/dist/dom-external/inner-html/html.d.ts +0 -3
  116. package/dist/dom-external/inner-html/scaner.d.ts +0 -30
  117. package/dist/dom-external/inner-html/style.d.ts +0 -27
  118. package/dist/dom-external/inner-html/tags.d.ts +0 -9
  119. package/dist/dom-external/inner-html/utils.d.ts +0 -2
  120. package/dist/dom-external/node.d.ts +0 -12
  121. package/dist/index-26658829.d.ts +0 -23
  122. package/dist/polyfill/array.d.ts +0 -3
  123. package/dist/polyfill/intersection-observer.d.ts +0 -2
  124. package/dist/polyfill/object.d.ts +0 -4
@@ -1,8 +1,8 @@
1
- /// <reference types="node" />
2
- /// <reference types="react" />
3
- import { Shortcuts, Events } from "@tarojs/shared";
4
- import { Component as Vue3Component } from "@vue/runtime-core";
5
- import { Component, ComponentClass } from "react";
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,12 @@ declare class ClassList {
18
18
  private checkTokenIsValid;
19
19
  private _update;
20
20
  }
21
+
21
22
  interface Attributes {
22
23
  name: string;
23
24
  value: string;
24
25
  }
26
+
25
27
  interface EventOptions {
26
28
  bubbles: boolean;
27
29
  cancelable: boolean;
@@ -36,6 +38,7 @@ interface MpEvent {
36
38
  target: Target;
37
39
  currentTarget: Target;
38
40
  }
41
+
39
42
  interface EventListenerOptions {
40
43
  capture?: boolean;
41
44
  }
@@ -47,9 +50,10 @@ interface EventHandler<T = any, R = void> {
47
50
  (...args: T[]): R;
48
51
  _stop?: boolean;
49
52
  }
50
- // Note: @tarojs/runtime 不依赖 @tarojs/taro, 所以不能改为从 @tarojs/taro 引入 (可能导致循环依赖)
53
+
51
54
  type TFunc = (...args: any[]) => any;
52
55
  type PageConfig = Record<string, any>;
56
+
53
57
  interface MpInstance {
54
58
  config: PageConfig;
55
59
  setData: (data: unknown, cb: () => void) => void;
@@ -77,12 +81,14 @@ interface MiniTextData {
77
81
  }
78
82
  type MiniData = MiniElementData | MiniTextData;
79
83
  type HydratedData = () => MiniData | MiniData[];
84
+
80
85
  type UpdatePayloadValue = string | boolean | HydratedData;
81
86
  type DataTree = Record<string, UpdatePayloadValue | ReturnType<HydratedData>>;
82
87
  interface UpdatePayload {
83
88
  path: string;
84
89
  value: UpdatePayloadValue;
85
90
  }
91
+
86
92
  declare const enum NodeType {
87
93
  ELEMENT_NODE = 1,
88
94
  ATTRIBUTE_NODE = 2,
@@ -93,6 +99,7 @@ declare const enum NodeType {
93
99
  PROCESSING_INSTRUCTION_NODE = 7,
94
100
  DOCUMENT_NODE = 9
95
101
  }
102
+
96
103
  declare class TaroText extends TaroNode {
97
104
  _value: string;
98
105
  nodeType: NodeType;
@@ -105,25 +112,27 @@ declare class TaroText extends TaroNode {
105
112
  set data(text: string);
106
113
  get data(): string;
107
114
  }
115
+
108
116
  interface Node {
109
117
  type: string;
110
118
  }
111
119
  interface Comment extends Node {
112
- type: "comment";
120
+ type: 'comment';
113
121
  content: string;
114
122
  }
115
123
  interface Text extends Node {
116
- type: "text";
124
+ type: 'text';
117
125
  content: string;
118
126
  }
119
127
  interface Element extends Node {
120
- type: "element";
128
+ type: 'element';
121
129
  tagName: string;
122
130
  children: ChildNode[];
123
131
  attributes: string[];
124
132
  }
125
133
  type ChildNode = Comment | Text | Element;
126
- interface Options {
134
+
135
+ interface Options$2 {
127
136
  prerender: boolean;
128
137
  debug: boolean;
129
138
  html?: {
@@ -136,6 +145,7 @@ interface Options {
136
145
  };
137
146
  miniGlobal?: any;
138
147
  }
148
+
139
149
  declare class TaroEventTarget {
140
150
  __handlers: Record<string, EventHandler[]>;
141
151
  addEventListener(type: string, handler: EventHandler, options?: boolean | AddEventListenerOptions): void;
@@ -143,6 +153,7 @@ declare class TaroEventTarget {
143
153
  isAnyEventBinded(): boolean;
144
154
  isOnlyClickBinded(): boolean;
145
155
  }
156
+
146
157
  declare class TaroRootElement extends TaroElement {
147
158
  private updatePayloads;
148
159
  private updateCallbacks;
@@ -157,6 +168,7 @@ declare class TaroRootElement extends TaroElement {
157
168
  enqueueUpdateCallback(cb: TFunc, ctx?: Record<string, any>): void;
158
169
  flushUpdateCallback(): void;
159
170
  }
171
+
160
172
  interface RemoveChildOptions {
161
173
  cleanRef?: boolean;
162
174
  doUpdate?: boolean;
@@ -184,7 +196,6 @@ declare class TaroNode extends TaroEventTarget {
184
196
  * @textContent 目前只能置空子元素
185
197
  * @TODO 等待完整 innerHTML 实现
186
198
  */
187
- // eslint-disable-next-line accessor-pairs
188
199
  set textContent(text: string);
189
200
  /**
190
201
  * @doc https://developer.mozilla.org/zh-CN/docs/Web/API/Node/insertBefore
@@ -227,6 +238,7 @@ declare class TaroNode extends TaroEventTarget {
227
238
  get ownerDocument(): TaroDocument;
228
239
  static extend(methodName: string, options: TFunc | Record<string, any>): void;
229
240
  }
241
+
230
242
  declare class Style {
231
243
  _pending: boolean;
232
244
  _usedStyleProp: Set<string>;
@@ -240,7 +252,7 @@ declare class Style {
240
252
  removeProperty(propertyName: string): string;
241
253
  getPropertyValue(propertyName: string): any;
242
254
  }
243
- // Taro 事件对象。以 Web 标准的事件对象为基础,加入小程序事件对象中携带的部分信息,并模拟实现事件冒泡。
255
+
244
256
  declare class TaroEvent {
245
257
  private cacheTarget;
246
258
  private cacheCurrentTarget;
@@ -250,10 +262,7 @@ declare class TaroEvent {
250
262
  _stop: boolean;
251
263
  _end: boolean;
252
264
  defaultPrevented: boolean;
253
- // Mouse Event botton property, it's used in 3rd lib, like react-router. default 0 in general
254
265
  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
266
  timeStamp: number;
258
267
  mpEvent: MpEvent | undefined;
259
268
  constructor(type: string, opts: EventOptions, event?: MpEvent);
@@ -264,8 +273,8 @@ declare class TaroEvent {
264
273
  get currentTarget(): any;
265
274
  }
266
275
  declare function createEvent(event: MpEvent | string, node?: TaroElement): TaroEvent;
267
- // 小程序的事件代理回调函数
268
276
  declare function eventHandler(event: MpEvent): any;
277
+
269
278
  declare class TaroElement extends TaroNode {
270
279
  ctx?: any;
271
280
  tagName: string;
@@ -288,7 +297,6 @@ declare class TaroElement extends TaroNode {
288
297
  hasAttribute(qualifiedName: string): boolean;
289
298
  hasAttributes(): boolean;
290
299
  get focus(): () => void;
291
- // 兼容 Vue3,详情请见:https://github.com/NervJS/taro/issues/10579
292
300
  set focus(value: () => void);
293
301
  blur(): void;
294
302
  setAttribute(qualifiedName: string, value: any): void;
@@ -301,6 +309,7 @@ declare class TaroElement extends TaroNode {
301
309
  removeEventListener(type: any, handler: any, sideEffect?: boolean): void;
302
310
  static extend(methodName: string, options: TFunc | Record<string, any>): void;
303
311
  }
312
+
304
313
  declare class FormElement extends TaroElement {
305
314
  get type(): string;
306
315
  set type(val: string);
@@ -308,6 +317,7 @@ declare class FormElement extends TaroElement {
308
317
  set value(val: string | boolean | number | any[]);
309
318
  dispatchEvent(event: TaroEvent): boolean;
310
319
  }
320
+
311
321
  declare class TaroDocument extends TaroElement {
312
322
  documentElement: TaroElement;
313
323
  head: TaroElement;
@@ -316,29 +326,29 @@ declare class TaroDocument extends TaroElement {
316
326
  cookie?: string;
317
327
  constructor();
318
328
  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
329
  createElementNS(_svgNS: string, type: string): TaroElement | TaroRootElement | FormElement;
322
330
  createTextNode(text: string): TaroText;
323
331
  getElementById<T extends TaroElement>(id: string | undefined | null): T | null;
324
332
  querySelector<T extends TaroElement>(query: string): T | null;
325
333
  querySelectorAll(): never[];
326
- // @TODO: @PERF: 在 hydrate 移除掉空的 node
327
334
  createComment(): TaroText;
328
335
  get defaultView(): any;
329
336
  }
337
+
330
338
  interface Env {
331
339
  window: any;
332
340
  document: TaroDocument;
333
341
  }
334
342
  declare const env: Env;
335
- // Note: 小程序端 vite 打包成 commonjs,const document = xxx 会报错,所以把 document 改为 taroDocumentProvider
343
+
336
344
  declare const taroDocumentProvider: TaroDocument;
345
+
337
346
  type TGetComputedStyle = typeof window.getComputedStyle | ((el: TaroElement) => Style);
338
- // Note: 小程序端 vite 打包成 commonjs,const getComputedStyle = xxx 会报错,所以把 GetComputedStyle 改为 taroGetComputedStyleProvider
339
347
  declare const taroGetComputedStyleProvider: TGetComputedStyle;
348
+
340
349
  declare const eventCenter: Events;
341
350
  type EventsType = typeof Events;
351
+
342
352
  /**
343
353
  * 一个小型缓存池,用于在切换页面时,存储一些上下文信息
344
354
  */
@@ -351,7 +361,8 @@ declare class RuntimeCache<T> {
351
361
  get(identifier: string): T | undefined;
352
362
  delete(identifier: string): void;
353
363
  }
354
- type Options$0 = {
364
+
365
+ type Options$1 = {
355
366
  window: any;
356
367
  };
357
368
  type LocationContext = {
@@ -359,8 +370,7 @@ type LocationContext = {
359
370
  };
360
371
  declare class TaroLocation extends Events {
361
372
  #private;
362
- constructor(options: Options$0);
363
- /* public property */
373
+ constructor(options: Options$1);
364
374
  get protocol(): string;
365
375
  set protocol(val: string);
366
376
  get host(): string;
@@ -374,27 +384,26 @@ declare class TaroLocation extends Events {
374
384
  get search(): string;
375
385
  set search(val: string);
376
386
  get hash(): string;
377
- // 小程序的navigateTo存在截断hash字符串的问题
378
387
  set hash(val: string);
379
388
  get href(): string;
380
389
  set href(val: string);
381
390
  get origin(): string;
382
391
  set origin(val: string);
383
- /* public method */
384
392
  assign(): void;
385
393
  reload(): void;
386
394
  replace(url: string): void;
387
395
  toString(): string;
388
- // For debug
389
396
  get cache(): RuntimeCache<LocationContext>;
390
397
  }
398
+
391
399
  declare const Location: typeof TaroLocation;
400
+
392
401
  interface HistoryState {
393
402
  state: Record<string, any> | null;
394
403
  title: string;
395
404
  url: string;
396
405
  }
397
- type Options$1 = {
406
+ type Options = {
398
407
  window: any;
399
408
  };
400
409
  type HistoryContext = {
@@ -404,33 +413,30 @@ type HistoryContext = {
404
413
  };
405
414
  declare class TaroHistory extends Events {
406
415
  #private;
407
- constructor(location: TaroLocation, options: Options$1);
408
- /* public property */
416
+ constructor(location: TaroLocation, options: Options);
409
417
  get length(): number;
410
418
  get state(): Record<string, any> | null;
411
- /* public method */
412
419
  go(delta: number): void;
413
420
  back(): void;
414
421
  forward(): void;
415
422
  pushState(state: any, title: string, url: string): void;
416
423
  replaceState(state: any, title: string, url: string): void;
417
- // For debug
418
424
  get cache(): RuntimeCache<HistoryContext>;
419
425
  }
426
+
420
427
  declare const History: typeof TaroHistory;
428
+
421
429
  declare const nav: typeof window.navigator;
422
- // https://github.com/myrne/performance-now
430
+
423
431
  declare let now: () => number;
424
- // https://gist.github.com/paulirish/1579671
425
- // https://gist.github.com/jalbam/5fe05443270fa6d8136238ec72accbc0
426
432
  declare const _raf: typeof requestAnimationFrame | ((callback: any) => NodeJS.Timeout);
427
433
  declare const _caf: typeof cancelAnimationFrame;
434
+
428
435
  declare class TaroURL {
429
436
  #private;
430
437
  static createObjectURL(): void;
431
438
  static revokeObjectURL(): void;
432
439
  constructor(url: string, base?: string);
433
- /* public property */
434
440
  get protocol(): string;
435
441
  set protocol(val: string);
436
442
  get host(): string;
@@ -450,10 +456,8 @@ declare class TaroURL {
450
456
  get origin(): string;
451
457
  set origin(val: string);
452
458
  get searchParams(): URLSearchParams;
453
- // public method
454
459
  toString(): string;
455
460
  toJSON(): string;
456
- // convenient for deconstructor
457
461
  _toRaw(): {
458
462
  protocol: string;
459
463
  port: string;
@@ -466,7 +470,7 @@ declare class TaroURL {
466
470
  href: string;
467
471
  };
468
472
  }
469
- // Note: 小程序端 vite 打包成 commonjs,const URL = xxx 会报错,所以把 URL 改为 TaroURLProvider
473
+
470
474
  declare const TaroURLProvider: typeof TaroURL;
471
475
  declare function parseUrl(url?: string): {
472
476
  href: string;
@@ -479,7 +483,9 @@ declare function parseUrl(url?: string): {
479
483
  search: string;
480
484
  hash: string;
481
485
  };
482
- declare const URLSearchParams: any;
486
+
487
+ declare const URLSearchParams$1: any;
488
+
483
489
  declare class TaroWindow extends Events {
484
490
  navigator: Navigator;
485
491
  requestAnimationFrame: typeof requestAnimationFrame | ((callback: any) => NodeJS.Timeout);
@@ -497,19 +503,20 @@ declare class TaroWindow extends Events {
497
503
  setTimeout(...args: Parameters<typeof setTimeout>): NodeJS.Timeout;
498
504
  clearTimeout(...args: Parameters<typeof clearTimeout>): void;
499
505
  }
500
- // Note: 小程序端 vite 打包成 commonjs,const window = xxx 会报错,所以把 window 改为 taroWindowProvider,location 和 history 同理
506
+
501
507
  declare const taroWindowProvider: TaroWindow;
502
508
  declare const taroLocationProvider: TaroLocation;
503
509
  declare const taroHistoryProvider: TaroHistory;
504
- // for Vue3
510
+
505
511
  declare class SVGElement extends TaroElement {
506
512
  }
513
+
507
514
  /**
508
515
  * A MutationRecord represents an individual DOM mutation.
509
516
  * It is the object that is passed to MutationObserver's callback.
510
517
  * @see https://dom.spec.whatwg.org/#interface-mutationrecord
511
518
  * @see https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord
512
- */
519
+ */
513
520
  interface MutationRecord {
514
521
  readonly target: TaroNode;
515
522
  readonly addedNodes?: TaroNode[];
@@ -519,7 +526,6 @@ interface MutationRecord {
519
526
  readonly attributeName?: string | null;
520
527
  readonly attributeNamespace?: string | null;
521
528
  oldValue?: string | null;
522
- // extended
523
529
  readonly type: MutationRecordType;
524
530
  readonly value?: string | null;
525
531
  }
@@ -528,6 +534,7 @@ declare const enum MutationRecordType {
528
534
  CHARACTER_DATA = "characterData",
529
535
  CHILD_LIST = "childList"
530
536
  }
537
+
531
538
  type MutationCallback = (mutations: MutationRecord[]) => any;
532
539
  /**
533
540
  * @see https://dom.spec.whatwg.org/#dictdef-mutationobserverinit
@@ -577,17 +584,16 @@ declare class MutationObserverImpl {
577
584
  */
578
585
  takeRecords(): MutationRecord[];
579
586
  }
587
+
580
588
  declare class MutationObserver {
581
- core: Pick<MutationObserverImpl, "observe" | "disconnect" | "takeRecords">;
589
+ core: Pick<MutationObserverImpl, 'observe' | 'disconnect' | 'takeRecords'>;
582
590
  constructor(callback: MutationCallback);
583
- observe(...args: [
584
- TaroNode,
585
- MutationObserverInit?
586
- ]): void;
591
+ observe(...args: [TaroNode, MutationObserverInit?]): void;
587
592
  disconnect(): void;
588
593
  takeRecords(): MutationRecord[];
589
594
  static record(record: MutationRecord): void;
590
595
  }
596
+
591
597
  declare const PROPERTY_THRESHOLD = 2046;
592
598
  declare const TARO_RUNTIME = "Taro runtime";
593
599
  declare const HOOKS_APP_ID = "taro-app";
@@ -648,7 +654,8 @@ declare enum CONTEXT_ACTIONS {
648
654
  RECOVER = "2",
649
655
  DESTORY = "3"
650
656
  }
651
- interface Instance<T = Record<string, any>> extends Component<T>, Show, PageInstance {
657
+
658
+ interface Instance<T = Record<string, any>> extends Component$1<T>, Show, PageInstance {
652
659
  tid?: string;
653
660
  node?: TaroElement;
654
661
  $forceUpdate?(): void;
@@ -660,11 +667,11 @@ interface PageProps {
660
667
  }
661
668
  interface ReactPageComponent<T = PageProps> extends ComponentClass<T>, PageInstance {
662
669
  }
663
- interface ReactPageInstance<T = PageProps> extends Component<T>, PageInstance {
670
+ interface ReactPageInstance<T = PageProps> extends Component$1<T>, PageInstance {
664
671
  componentDidShow?(): void;
665
672
  componentDidHide?(): void;
666
673
  }
667
- interface ReactAppInstance<T = AppInstance> extends Component<T>, AppInstance {
674
+ interface ReactAppInstance<T = AppInstance> extends Component$1<T>, AppInstance {
668
675
  }
669
676
  interface PageLifeCycle extends Show {
670
677
  eh?(event: MpEvent): void;
@@ -703,7 +710,7 @@ interface PageInstance extends PageLifeCycle {
703
710
  /** 页面的组件选项 */
704
711
  options?: Record<string, unknown>;
705
712
  /** 页面渲染引擎类型 */
706
- renderer?: "webview" | "skyline";
713
+ renderer?: 'webview' | 'skyline';
707
714
  /** 获得一个 EventChannel 对象,用于页面间通讯 */
708
715
  getOpenerEventChannel?(): Record<string, any>;
709
716
  }
@@ -715,8 +722,8 @@ interface Show {
715
722
  }
716
723
  interface AppInstance extends Show {
717
724
  componentDidShow?(options?: Record<string, unknown>): void;
718
- mount?(component: React.ComponentClass | Vue3Component, id: string, cb: (...args: any[]) => void): void;
719
- mount?(component: React.ComponentClass | Vue3Component, id: string, getCtx: (...args: any[]) => void, cb: (...args: any[]) => void): void;
725
+ mount?(component: React.ComponentClass | Component, id: string, cb: (...args: any[]) => void): void;
726
+ mount?(component: React.ComponentClass | Component, id: string, getCtx: (...args: any[]) => void, cb: (...args: any[]) => void): void;
720
727
  onError?(error: string): void;
721
728
  onLaunch?(options?: Record<string, unknown>): void;
722
729
  onPageNotFound?(res: any): void;
@@ -727,6 +734,7 @@ interface AppInstance extends Show {
727
734
  taroGlobalData?: Record<any, any>;
728
735
  config?: Record<any, any>;
729
736
  }
737
+
730
738
  interface Router {
731
739
  params: Record<string, unknown>;
732
740
  path: string;
@@ -744,11 +752,13 @@ interface Current {
744
752
  }
745
753
  declare const Current: Current;
746
754
  declare const getCurrentInstance: () => Current;
755
+
747
756
  interface IEventSource extends Map<string | undefined | null, TaroNode> {
748
757
  removeNode(child: TaroNode): void;
749
758
  removeNodeTree(child: TaroNode): void;
750
759
  }
751
760
  declare const eventSource: IEventSource;
761
+
752
762
  declare function injectPageInstance(inst: Instance<PageProps>, id: string): void;
753
763
  declare function getPageInstance(id: string): Instance | undefined;
754
764
  declare function removePageInstance(id: string): void;
@@ -761,6 +771,7 @@ declare function getOnHideEventKey(path: string): string;
761
771
  declare function createPageConfig(component: any, pageName?: string, data?: Record<string, unknown>, pageConfig?: PageConfig): PageInstance;
762
772
  declare function createComponentConfig(component: React.ComponentClass, componentName?: string, data?: Record<string, unknown>): any;
763
773
  declare function createRecursiveComponentConfig(componentName?: string): any;
774
+
764
775
  /**
765
776
  * React also has a fancy function's name for this: `hydrate()`.
766
777
  * You may have been heard `hydrate` as a SSR-related function,
@@ -768,8 +779,11 @@ declare function createRecursiveComponentConfig(componentName?: string): any;
768
779
  * it's a vnode traverser and modifier: that's exactly what Taro's doing in here.
769
780
  */
770
781
  declare function hydrate(node: TaroElement | TaroText): MiniData;
782
+
771
783
  declare const nextTick: (cb: TFunc, ctx?: Record<string, any>) => void;
772
- declare const options: Options;
784
+
785
+ declare const options: Options$2;
786
+
773
787
  declare class Performance {
774
788
  #private;
775
789
  private recorder;
@@ -778,6 +792,18 @@ declare class Performance {
778
792
  delayStop(id: string, delay?: number): ((...args: any[]) => void) | undefined;
779
793
  }
780
794
  declare const perf: Performance;
795
+
796
+ declare function throttle(fn: any, threshold?: number, scope?: any): (...args: any[]) => void;
797
+ declare function debounce(fn: any, ms?: number, scope?: any): (...args: any[]) => void;
798
+
799
+ declare const addLeadingSlash: (url?: string) => string;
800
+ declare const hasBasename: (path?: string, prefix?: string) => boolean;
801
+ declare const stripBasename: (path?: string, prefix?: string) => string;
802
+ declare const stripTrailing: (str?: string) => string;
803
+ declare const stripSuffix: (path?: string, suffix?: string) => string;
804
+ declare const getHomePage: (path?: string, basename?: string, customRoutes?: Record<string, string | string[]>, entryPagePath?: string) => string;
805
+ declare const getCurrentPage: (routerMode?: string, basename?: string) => string;
806
+
781
807
  declare const incrementId: () => () => string;
782
808
  declare function isElement(node: TaroNode): node is TaroElement;
783
809
  declare function isText(node: TaroNode): node is TaroText;
@@ -797,17 +823,8 @@ interface Ctor {
797
823
  declare function extend(ctor: Ctor, methodName: string, options: TFunc | Record<string, any>): void;
798
824
  declare function getComponentsAlias(): any;
799
825
  declare function convertNumber2PX(value: number): string;
800
- declare function throttle(fn: any, threshold?: number, scope?: any): (...args: any[]) => void;
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;
826
+
811
827
  declare function handlePolyfill(): void;
812
- export { hooks } from '@tarojs/shared';
813
- export { taroDocumentProvider as document, taroGetComputedStyleProvider as getComputedStyle, History, Location, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, parseUrl, TaroURLProvider as URL, URLSearchParams, taroHistoryProvider as history, taroLocationProvider as location, taroWindowProvider as window, TaroElement, createEvent, eventHandler, TaroEvent, FormElement, TaroNode, TaroRootElement, Style, SVGElement, TaroText, MutationObserver, env, PROPERTY_THRESHOLD, TARO_RUNTIME, HOOKS_APP_ID, SET_DATA, PAGE_INIT, ROOT_STR, HTML, HEAD, BODY, APP, CONTAINER, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, ID, UID, CLASS, STYLE, FOCUS, VIEW, STATIC_VIEW, PURE_VIEW, CLICK_VIEW, PROPS, DATASET, OBJECT, VALUE, INPUT, CHANGE, CUSTOM_WRAPPER, TARGET, CURRENT_TARGET, TYPE, CONFIRM, TIME_STAMP, KEY_CODE, TOUCHMOVE, DATE, SET_TIMEOUT, COMPILE_MODE, CATCHMOVE, CATCH_VIEW, COMMENT, ON_LOAD, ON_READY, ON_SHOW, ON_HIDE, OPTIONS, EXTERNAL_CLASSES, EVENT_CALLBACK_RESULT, BEHAVIORS, A, CONTEXT_ACTIONS, Current, getCurrentInstance, eventSource, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify, EventsType, eventCenter, Events, hydrate, nextTick, options, perf, incrementId, isElement, isText, isComment, isHasExtractProp, isParentBinded, shortcutAttr, customWrapperCache, extend, getComponentsAlias, convertNumber2PX, throttle, debounce, addLeadingSlash, hasBasename, stripBasename, stripTrailing, stripSuffix, getHomePage, getCurrentPage, Instance, PageProps, ReactPageComponent, ReactPageInstance, ReactAppInstance, PageLifeCycle, PageInstance, AppInstance, Attributes, EventOptions, MpEvent, EventListenerOptions, AddEventListenerOptions, EventHandler, MpInstance, MiniElementData, MiniTextData, MiniData, HydratedData, UpdatePayloadValue, DataTree, UpdatePayload, Options$1 as Options, TFunc, PageConfig, handlePolyfill };
828
+
829
+ 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 };
830
+ export type { AddEventListenerOptions, AppInstance, Attributes, DataTree, EventHandler, EventListenerOptions, EventOptions, EventsType, HydratedData, Instance, MiniData, MiniElementData, MiniTextData, MpEvent, MpInstance, Options$2 as Options, PageConfig, PageInstance, PageLifeCycle, PageProps, ReactAppInstance, ReactPageComponent, ReactPageInstance, TFunc, UpdatePayload, UpdatePayloadValue };
package/dist/index.cjs.js CHANGED
@@ -5091,12 +5091,12 @@ if (process.env.SUPPORT_TARO_POLYFILL !== 'disabled' && process.env.TARO_PLATFOR
5091
5091
  }
5092
5092
 
5093
5093
  Object.defineProperty(exports, "Events", {
5094
- enumerable: true,
5095
- get: function () { return shared.Events; }
5094
+ enumerable: true,
5095
+ get: function () { return shared.Events; }
5096
5096
  });
5097
5097
  Object.defineProperty(exports, "hooks", {
5098
- enumerable: true,
5099
- get: function () { return shared.hooks; }
5098
+ enumerable: true,
5099
+ get: function () { return shared.hooks; }
5100
5100
  });
5101
5101
  exports.A = A;
5102
5102
  exports.APP = APP;