@tarojs/runtime 3.6.22-nightly.0 → 3.6.22-nightly.2

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 (164) hide show
  1. package/LICENSE +7 -0
  2. package/dist/bom/URL.d.ts +7 -14
  3. package/dist/bom/URL.js +221 -0
  4. package/dist/bom/URL.js.map +1 -0
  5. package/dist/bom/URLSearchParams.d.ts +2 -14
  6. package/dist/bom/URLSearchParams.js +123 -0
  7. package/dist/bom/URLSearchParams.js.map +1 -0
  8. package/dist/bom/document.d.ts +2 -1
  9. package/dist/bom/document.js +39 -0
  10. package/dist/bom/document.js.map +1 -0
  11. package/dist/bom/getComputedStyle.d.ts +5 -3
  12. package/dist/bom/getComputedStyle.js +8 -0
  13. package/dist/bom/getComputedStyle.js.map +1 -0
  14. package/dist/bom/history.d.ts +11 -8
  15. package/dist/bom/history.js +121 -0
  16. package/dist/bom/history.js.map +1 -0
  17. package/dist/bom/location.d.ts +7 -4
  18. package/dist/bom/location.js +240 -0
  19. package/dist/bom/location.js.map +1 -0
  20. package/dist/bom/navigator.d.ts +2 -1
  21. package/dist/bom/navigator.js +24 -0
  22. package/dist/bom/navigator.js.map +1 -0
  23. package/dist/bom/raf.d.ts +3 -4
  24. package/dist/bom/raf.js +33 -0
  25. package/dist/bom/raf.js.map +1 -0
  26. package/dist/bom/window.d.ts +25 -4
  27. package/dist/bom/window.js +92 -0
  28. package/dist/bom/window.js.map +1 -0
  29. package/dist/constants/index.d.ts +52 -50
  30. package/dist/constants/index.js +63 -0
  31. package/dist/constants/index.js.map +1 -0
  32. package/dist/current.d.ts +5 -5
  33. package/dist/current.js +9 -0
  34. package/dist/current.js.map +1 -0
  35. package/dist/dom/anchor-element.d.ts +3 -2
  36. package/dist/dom/anchor-element.js +54 -0
  37. package/dist/dom/anchor-element.js.map +1 -0
  38. package/dist/dom/class-list.d.ts +3 -2
  39. package/dist/dom/class-list.js +92 -0
  40. package/dist/dom/class-list.js.map +1 -0
  41. package/dist/dom/document.d.ts +11 -6
  42. package/dist/dom/document.js +80 -0
  43. package/dist/dom/document.js.map +1 -0
  44. package/dist/dom/element.d.ts +8 -7
  45. package/dist/dom/element.js +318 -0
  46. package/dist/dom/element.js.map +1 -0
  47. package/dist/dom/event-source.d.ts +3 -3
  48. package/dist/dom/event-source.js +17 -0
  49. package/dist/dom/event-source.js.map +1 -0
  50. package/dist/dom/event-target.d.ts +3 -2
  51. package/dist/dom/event-target.js +78 -0
  52. package/dist/dom/event-target.js.map +1 -0
  53. package/dist/dom/event.d.ts +6 -5
  54. package/dist/dom/event.js +151 -0
  55. package/dist/dom/event.js.map +1 -0
  56. package/dist/dom/form.d.ts +4 -3
  57. package/dist/dom/form.js +38 -0
  58. package/dist/dom/form.js.map +1 -0
  59. package/dist/dom/node.d.ts +40 -9
  60. package/dist/dom/node.js +292 -0
  61. package/dist/dom/node.js.map +1 -0
  62. package/dist/dom/root.d.ts +6 -5
  63. package/dist/dom/root.js +169 -0
  64. package/dist/dom/root.js.map +1 -0
  65. package/dist/dom/style.d.ts +3 -2
  66. package/dist/dom/style.js +168 -0
  67. package/dist/dom/style.js.map +1 -0
  68. package/dist/dom/style_properties.js +186 -0
  69. package/dist/dom/style_properties.js.map +1 -0
  70. package/dist/dom/svg.d.ts +3 -2
  71. package/dist/dom/svg.js +8 -0
  72. package/dist/dom/svg.js.map +1 -0
  73. package/dist/dom/text.d.ts +4 -3
  74. package/dist/dom/text.js +41 -0
  75. package/dist/dom/text.js.map +1 -0
  76. package/dist/dom/transfer.d.ts +3 -2
  77. package/dist/dom/transfer.js +15 -0
  78. package/dist/dom/transfer.js.map +1 -0
  79. package/dist/dom/tree.d.ts +3 -3
  80. package/dist/dom/tree.js +38 -0
  81. package/dist/dom/tree.js.map +1 -0
  82. package/dist/dom-external/element.d.ts +4 -3
  83. package/dist/dom-external/element.js +29 -0
  84. package/dist/dom-external/element.js.map +1 -0
  85. package/dist/dom-external/index.js +38 -0
  86. package/dist/dom-external/index.js.map +1 -0
  87. package/dist/dom-external/inner-html/html.d.ts +3 -2
  88. package/dist/dom-external/inner-html/html.js +28 -0
  89. package/dist/dom-external/inner-html/html.js.map +1 -0
  90. package/dist/dom-external/inner-html/parser.d.ts +7 -7
  91. package/dist/dom-external/inner-html/parser.js +216 -0
  92. package/dist/dom-external/inner-html/parser.js.map +1 -0
  93. package/dist/dom-external/inner-html/scaner.d.ts +3 -3
  94. package/dist/dom-external/inner-html/scaner.js +304 -0
  95. package/dist/dom-external/inner-html/scaner.js.map +1 -0
  96. package/dist/dom-external/inner-html/style.d.ts +3 -3
  97. package/dist/dom-external/inner-html/style.js +235 -0
  98. package/dist/dom-external/inner-html/style.js.map +1 -0
  99. package/dist/dom-external/inner-html/tags.d.ts +6 -5
  100. package/dist/dom-external/inner-html/tags.js +26 -0
  101. package/dist/dom-external/inner-html/tags.js.map +1 -0
  102. package/dist/dom-external/inner-html/utils.d.ts +2 -1
  103. package/dist/dom-external/inner-html/utils.js +12 -0
  104. package/dist/dom-external/inner-html/utils.js.map +1 -0
  105. package/dist/dom-external/mutation-observer/implements.d.ts +25 -6
  106. package/dist/dom-external/mutation-observer/implements.js +108 -0
  107. package/dist/dom-external/mutation-observer/implements.js.map +1 -0
  108. package/dist/dom-external/mutation-observer/index.d.ts +5 -6
  109. package/dist/dom-external/mutation-observer/index.js +35 -0
  110. package/dist/dom-external/mutation-observer/index.js.map +1 -0
  111. package/dist/dom-external/node.d.ts +6 -5
  112. package/dist/dom-external/node.js +74 -0
  113. package/dist/dom-external/node.js.map +1 -0
  114. package/dist/dsl/common.d.ts +16 -16
  115. package/dist/dsl/common.js +337 -0
  116. package/dist/dsl/common.js.map +1 -0
  117. package/dist/emitter/emitter.d.ts +2 -2
  118. package/dist/emitter/emitter.js +7 -0
  119. package/dist/emitter/emitter.js.map +1 -0
  120. package/dist/env.d.ts +2 -2
  121. package/dist/env.js +9 -0
  122. package/dist/env.js.map +1 -0
  123. package/dist/hydrate.d.ts +5 -4
  124. package/dist/hydrate.js +84 -0
  125. package/dist/hydrate.js.map +1 -0
  126. package/dist/index-26658829.d.ts +23 -0
  127. package/dist/index.cjs.d.ts +775 -0
  128. package/dist/index.cjs.js +4347 -0
  129. package/dist/index.cjs.js.map +1 -0
  130. package/dist/index.d.ts +30 -31
  131. package/dist/index.js +31 -0
  132. package/dist/index.js.map +1 -0
  133. package/dist/{dsl/instance.d.ts → instance-0f017c6e.d.ts} +19 -18
  134. package/dist/next-tick.d.ts +3 -2
  135. package/dist/next-tick.js +47 -0
  136. package/dist/next-tick.js.map +1 -0
  137. package/dist/node_modules/.pnpm/registry.npmjs.org_tslib@2.5.0/node_modules/tslib/tslib.es6.js +32 -0
  138. package/dist/node_modules/.pnpm/registry.npmjs.org_tslib@2.5.0/node_modules/tslib/tslib.es6.js.map +1 -0
  139. package/dist/{dom/node_types.d.ts → node_types-9ac5b4dd.d.ts} +2 -1
  140. package/dist/{interface/options.d.ts → options-0f017c6e.d.ts} +5 -4
  141. package/dist/options.d.ts +3 -2
  142. package/dist/options.js +7 -0
  143. package/dist/options.js.map +1 -0
  144. package/dist/perf.d.ts +2 -2
  145. package/dist/perf.js +28 -0
  146. package/dist/perf.js.map +1 -0
  147. package/dist/{dom-external/mutation-observer/record.d.ts → record-32b054d8.d.ts} +4 -3
  148. package/dist/runtime.esm.d.ts +82 -88
  149. package/dist/runtime.esm.js +360 -374
  150. package/dist/runtime.esm.js.map +1 -1
  151. package/dist/utils/cache.d.ts +2 -1
  152. package/dist/utils/cache.js +27 -0
  153. package/dist/utils/cache.js.map +1 -0
  154. package/dist/utils/index.d.ts +15 -15
  155. package/dist/utils/index.js +95 -0
  156. package/dist/utils/index.js.map +1 -0
  157. package/package.json +20 -10
  158. package/dist/interface/element.d.ts +0 -4
  159. package/dist/interface/event-target.d.ts +0 -10
  160. package/dist/interface/event.d.ts +0 -15
  161. package/dist/interface/hydrate.d.ts +0 -30
  162. package/dist/interface/index.d.ts +0 -7
  163. package/dist/interface/node.d.ts +0 -7
  164. package/dist/interface/utils.d.ts +0 -2
package/dist/index.d.ts CHANGED
@@ -1,33 +1,32 @@
1
- import './dom-external';
2
- import env from './env';
1
+ import env from "./env.js";
3
2
  export { hooks } from '@tarojs/shared';
4
- export { document } from './bom/document';
5
- export { getComputedStyle } from './bom/getComputedStyle';
6
- export { History } from './bom/history';
7
- export { Location } from './bom/location';
8
- export { nav as navigator } from './bom/navigator';
9
- export { caf as cancelAnimationFrame, now, raf as requestAnimationFrame } from './bom/raf';
10
- export { parseUrl, URL } from './bom/URL';
11
- export { URLSearchParams } from './bom/URLSearchParams';
12
- export { history, location, window } from './bom/window';
13
- export { TaroElement } from './dom/element';
14
- export { createEvent, eventHandler, TaroEvent } from './dom/event';
15
- export { FormElement } from './dom/form';
16
- export { TaroNode } from './dom/node';
17
- export { TaroRootElement } from './dom/root';
18
- export { Style } from './dom/style';
19
- export { SVGElement } from './dom/svg';
20
- export { TaroText } from './dom/text';
21
- export { MutationObserver } from './dom-external/mutation-observer';
3
+ export { document } from "./bom/document.js";
4
+ export { getComputedStyle } from "./bom/getComputedStyle.js";
5
+ export { History } from "./bom/history.js";
6
+ export { Location } from "./bom/location.js";
7
+ export { nav as navigator } from "./bom/navigator.js";
8
+ export { caf as cancelAnimationFrame, now, raf as requestAnimationFrame } from "./bom/raf.js";
9
+ export { parseUrl, URL } from "./bom/URL.js";
10
+ export { URLSearchParams } from "./bom/URLSearchParams.js";
11
+ export { history, location, window } from "./bom/window.js";
12
+ export { TaroElement } from "./dom/element.js";
13
+ export { createEvent, eventHandler, TaroEvent } from "./dom/event.js";
14
+ export { FormElement } from "./dom/form.js";
15
+ export { TaroNode } from "./dom/node.js";
16
+ export { TaroRootElement } from "./dom/root.js";
17
+ export { Style } from "./dom/style.js";
18
+ export { SVGElement } from "./dom/svg.js";
19
+ export { TaroText } from "./dom/text.js";
20
+ export { MutationObserver } from "./dom-external/mutation-observer/index.js";
22
21
  export { env };
23
- export * from './constants';
24
- export { Current, getCurrentInstance } from './current';
25
- export { eventSource } from './dom/event-source';
26
- export { addLeadingSlash, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify } from './dsl/common';
27
- export * from './emitter/emitter';
28
- export { hydrate } from './hydrate';
29
- export { nextTick } from './next-tick';
30
- export { options } from './options';
31
- export { incrementId, isHasExtractProp } from './utils';
32
- export * from './dsl/instance';
33
- export * from './interface';
22
+ export * from "./constants/index.js";
23
+ export { Current, getCurrentInstance } from "./current.js";
24
+ export { eventSource } from "./dom/event-source.js";
25
+ export { addLeadingSlash, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify } from "./dsl/common.js";
26
+ export * from "./emitter/emitter.js";
27
+ export { hydrate } from "./hydrate.js";
28
+ export { nextTick } from "./next-tick.js";
29
+ export { options } from "./options.js";
30
+ export { incrementId, isHasExtractProp } from "./utils/index.js";
31
+ export * from "./instance-0f017c6e.js";
32
+ export * from "./index-26658829.js";
package/dist/index.js ADDED
@@ -0,0 +1,31 @@
1
+ import './dom-external/index.js';
2
+ export { default as env } from './env.js';
3
+ export { Events, hooks } from '@tarojs/shared';
4
+ export { document } from './bom/document.js';
5
+ export { getComputedStyle } from './bom/getComputedStyle.js';
6
+ export { History } from './bom/history.js';
7
+ export { Location } from './bom/location.js';
8
+ export { nav as navigator } from './bom/navigator.js';
9
+ export { caf as cancelAnimationFrame, now, raf as requestAnimationFrame } from './bom/raf.js';
10
+ export { URL, parseUrl } from './bom/URL.js';
11
+ export { URLSearchParams } from './bom/URLSearchParams.js';
12
+ export { history, location, window } from './bom/window.js';
13
+ export { TaroElement } from './dom/element.js';
14
+ export { TaroEvent, createEvent, eventHandler } from './dom/event.js';
15
+ export { FormElement } from './dom/form.js';
16
+ export { TaroNode } from './dom/node.js';
17
+ export { TaroRootElement } from './dom/root.js';
18
+ export { Style } from './dom/style.js';
19
+ export { SVGElement } from './dom/svg.js';
20
+ export { TaroText } from './dom/text.js';
21
+ export { MutationObserver } from './dom-external/mutation-observer/index.js';
22
+ export { A, APP, BEHAVIORS, BODY, CATCHMOVE, CATCH_VIEW, CHANGE, CLASS, COMMENT, COMPILE_MODE, CONFIRM, CONTAINER, CONTEXT_ACTIONS, CURRENT_TARGET, CUSTOM_WRAPPER, DATASET, DATE, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, EVENT_CALLBACK_RESULT, EXTERNAL_CLASSES, FOCUS, HEAD, HOOKS_APP_ID, HTML, ID, INPUT, KEY_CODE, 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, TARGET, TARO_RUNTIME, TIME_STAMP, TOUCHMOVE, TYPE, UID, VALUE, VIEW } from './constants/index.js';
23
+ export { Current, getCurrentInstance } from './current.js';
24
+ export { eventSource } from './dom/event-source.js';
25
+ export { addLeadingSlash, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify } from './dsl/common.js';
26
+ export { eventCenter } from './emitter/emitter.js';
27
+ export { hydrate } from './hydrate.js';
28
+ export { nextTick } from './next-tick.js';
29
+ export { options } from './options.js';
30
+ export { incrementId, isHasExtractProp } from './utils/index.js';
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,39 +1,40 @@
1
- import VueCtor, { ComponentOptions, VNode } from 'vue';
2
- import type { Component as Vue3Component } from '@vue/runtime-core';
3
- import type { Component, ComponentClass } from 'react';
4
- import type { CombinedVueInstance } from 'vue/types/vue';
5
- import type { TaroElement } from '../dom/element';
6
- import type { Func, MpEvent } from '../interface';
7
- export interface Instance<T = Record<string, any>> extends Component<T>, Show, PageInstance {
1
+ import VueCtor from 'vue';
2
+ import { ComponentOptions, VNode } from "vue";
3
+ import { Component as Vue3Component } from '@vue/runtime-core';
4
+ import { Component, ComponentClass } from 'react';
5
+ import { CombinedVueInstance } from 'vue/types/vue';
6
+ import { TaroElement } from "./dom/element.js";
7
+ import { MpEvent, TFunc } from "./index-26658829.js";
8
+ interface Instance<T = Record<string, any>> extends Component<T>, Show, PageInstance {
8
9
  tid?: string;
9
10
  node?: TaroElement;
10
11
  $forceUpdate?(): void;
11
12
  $nextTick?(cb: () => void): void;
12
13
  $options: Instance;
13
14
  }
14
- export interface VueAppInstance extends ComponentOptions<VueCtor> {
15
+ interface VueAppInstance extends ComponentOptions<VueCtor> {
15
16
  $options: AppInstance;
16
17
  }
17
- export type VueInstance<M = Record<string, any>, P = Record<string, any>> = CombinedVueInstance<VueCtor, Record<string, any>, M, P, Record<never, any>> & VueInternal;
18
+ type VueInstance<M = Record<string, any>, P = Record<string, any>> = CombinedVueInstance<VueCtor, Record<string, any>, M, P, Record<never, any>> & VueInternal;
18
19
  interface VueInternal {
19
20
  _render(): VNode;
20
21
  _update(vnode: VNode, hyrate: boolean): void;
21
22
  }
22
- export interface PageProps {
23
+ interface PageProps {
23
24
  tid?: string;
24
25
  }
25
- export interface ReactPageComponent<T = PageProps> extends ComponentClass<T>, PageInstance {
26
+ interface ReactPageComponent<T = PageProps> extends ComponentClass<T>, PageInstance {
26
27
  }
27
- export interface ReactPageInstance<T = PageProps> extends Component<T>, PageInstance {
28
+ interface ReactPageInstance<T = PageProps> extends Component<T>, PageInstance {
28
29
  componentDidShow?(): void;
29
30
  componentDidHide?(): void;
30
31
  }
31
- export interface ReactAppInstance<T = AppInstance> extends Component<T>, AppInstance {
32
+ interface ReactAppInstance<T = AppInstance> extends Component<T>, AppInstance {
32
33
  }
33
- export interface PageLifeCycle extends Show {
34
+ interface PageLifeCycle extends Show {
34
35
  eh?(event: MpEvent): void;
35
36
  onAddToFavorites?(): void;
36
- onLoad?(options: Record<string, unknown>, cb?: Func): void;
37
+ onLoad?(options: Record<string, unknown>, cb?: TFunc): void;
37
38
  onOptionMenuClick?(): void;
38
39
  onPageScroll?(obj: {
39
40
  scrollTop: number;
@@ -59,7 +60,7 @@ export interface PageLifeCycle extends Show {
59
60
  onTitleClick?(): void;
60
61
  onUnload?(): void;
61
62
  }
62
- export interface PageInstance extends PageLifeCycle {
63
+ interface PageInstance extends PageLifeCycle {
63
64
  /** 页面的初始数据 */
64
65
  data?: Record<string, unknown>;
65
66
  /** 页面路径 */
@@ -75,7 +76,7 @@ interface Show {
75
76
  onShow?(): void;
76
77
  onHide?(): void;
77
78
  }
78
- export interface AppInstance extends Show {
79
+ interface AppInstance extends Show {
79
80
  componentDidShow?(options?: Record<string, unknown>): void;
80
81
  mount?(component: React.ComponentClass | ComponentOptions<VueCtor> | Vue3Component, id: string, cb: (...args: any[]) => void): void;
81
82
  mount?(component: React.ComponentClass | ComponentOptions<VueCtor> | Vue3Component, id: string, getCtx: (...args: any[]) => void, cb: (...args: any[]) => void): void;
@@ -88,4 +89,4 @@ export interface AppInstance extends Show {
88
89
  taroGlobalData?: Record<any, any>;
89
90
  config?: Record<any, any>;
90
91
  }
91
- export {};
92
+ export { Instance, VueAppInstance, VueInstance, PageProps, ReactPageComponent, ReactPageInstance, ReactAppInstance, PageLifeCycle, PageInstance, AppInstance };
@@ -1,2 +1,3 @@
1
- import type { Func } from './interface';
2
- export declare const nextTick: (cb: Func, ctx?: Record<string, any>) => void;
1
+ import { TFunc } from "./index-26658829.js";
2
+ declare const nextTick: (cb: TFunc, ctx?: Record<string, any>) => void;
3
+ export { nextTick };
@@ -0,0 +1,47 @@
1
+ import { Current } from './current.js';
2
+ import env from './env.js';
3
+
4
+ const TIMEOUT = 100;
5
+ const nextTick = (cb, ctx) => {
6
+ const beginTime = Date.now();
7
+ const router = Current.router;
8
+ const timerFunc = () => {
9
+ setTimeout(function () {
10
+ ctx ? cb.call(ctx) : cb();
11
+ }, 1);
12
+ };
13
+ if (router === null)
14
+ return timerFunc();
15
+ const path = router.$taroPath;
16
+ /**
17
+ * 三种情况
18
+ * 1. 调用 nextTick 时,pendingUpdate 已经从 true 变为 false(即已更新完成),那么需要光等 100ms
19
+ * 2. 调用 nextTick 时,pendingUpdate 为 true,那么刚好可以搭上便车
20
+ * 3. 调用 nextTick 时,pendingUpdate 还是 false,框架仍未启动更新逻辑,这时最多轮询 100ms,等待 pendingUpdate 变为 true。
21
+ */
22
+ function next() {
23
+ var _a, _b, _c;
24
+ const pageElement = env.document.getElementById(path);
25
+ if (pageElement === null || pageElement === void 0 ? void 0 : pageElement.pendingUpdate) {
26
+ if (process.env.TARO_PLATFORM === 'web') {
27
+ // eslint-disable-next-line dot-notation
28
+ (_c = (_b = (_a = pageElement.firstChild) === null || _a === void 0 ? void 0 : _a['componentOnReady']) === null || _b === void 0 ? void 0 : _b.call(_a).then(() => {
29
+ timerFunc();
30
+ })) !== null && _c !== void 0 ? _c : timerFunc();
31
+ }
32
+ else {
33
+ pageElement.enqueueUpdateCallback(cb, ctx);
34
+ }
35
+ }
36
+ else if (Date.now() - beginTime > TIMEOUT) {
37
+ timerFunc();
38
+ }
39
+ else {
40
+ setTimeout(() => next(), 20);
41
+ }
42
+ }
43
+ next();
44
+ };
45
+
46
+ export { nextTick };
47
+ //# sourceMappingURL=next-tick.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"next-tick.js","sources":["../src/next-tick.ts"],"sourcesContent":["import { Current } from './current'\nimport { TaroRootElement } from './dom/root'\nimport env from './env'\n\nimport type { TFunc } from './interface'\n\nconst TIMEOUT = 100\n\nexport const nextTick = (cb: TFunc, ctx?: Record<string, any>) => {\n const beginTime = Date.now()\n const router = Current.router\n\n const timerFunc = () => {\n setTimeout(function () {\n ctx ? cb.call(ctx) : cb()\n }, 1)\n }\n\n if (router === null) return timerFunc()\n\n const path = router.$taroPath\n\n /**\n * 三种情况\n * 1. 调用 nextTick 时,pendingUpdate 已经从 true 变为 false(即已更新完成),那么需要光等 100ms\n * 2. 调用 nextTick 时,pendingUpdate 为 true,那么刚好可以搭上便车\n * 3. 调用 nextTick 时,pendingUpdate 还是 false,框架仍未启动更新逻辑,这时最多轮询 100ms,等待 pendingUpdate 变为 true。\n */\n function next () {\n const pageElement: TaroRootElement | null = env.document.getElementById<TaroRootElement>(path)\n if (pageElement?.pendingUpdate) {\n if (process.env.TARO_PLATFORM === 'web') {\n // eslint-disable-next-line dot-notation\n pageElement.firstChild?.['componentOnReady']?.().then(() => {\n timerFunc()\n }) ?? timerFunc()\n } else {\n pageElement.enqueueUpdateCallback(cb, ctx)\n }\n } else if (Date.now() - beginTime > TIMEOUT) {\n timerFunc()\n } else {\n setTimeout(() => next(), 20)\n }\n }\n\n next()\n}\n"],"names":[],"mappings":";;;AAMA,MAAM,OAAO,GAAG,GAAG,CAAA;MAEN,QAAQ,GAAG,CAAC,EAAS,EAAE,GAAyB,KAAI;AAC/D,IAAA,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;AAC5B,IAAA,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;IAE7B,MAAM,SAAS,GAAG,MAAK;AACrB,QAAA,UAAU,CAAC,YAAA;AACT,YAAA,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAA;SAC1B,EAAE,CAAC,CAAC,CAAA;AACP,KAAC,CAAA;IAED,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,SAAS,EAAE,CAAA;AAEvC,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAA;AAE7B;;;;;AAKG;AACH,IAAA,SAAS,IAAI,GAAA;;QACX,MAAM,WAAW,GAA2B,GAAG,CAAC,QAAQ,CAAC,cAAc,CAAkB,IAAI,CAAC,CAAA;AAC9F,QAAA,IAAI,WAAW,KAAX,IAAA,IAAA,WAAW,uBAAX,WAAW,CAAE,aAAa,EAAE;AAC9B,YAAA,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,KAAK,EAAE;;AAEvC,gBAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,WAAW,CAAC,UAAU,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAG,kBAAkB,CAAC,MAAK,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,IAAI,CAAC,MAAK;AACzD,oBAAA,SAAS,EAAE,CAAA;AACb,iBAAC,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,SAAS,EAAE,CAAA;AAClB,aAAA;AAAM,iBAAA;AACL,gBAAA,WAAW,CAAC,qBAAqB,CAAC,EAAE,EAAE,GAAG,CAAC,CAAA;AAC3C,aAAA;AACF,SAAA;aAAM,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,GAAG,OAAO,EAAE;AAC3C,YAAA,SAAS,EAAE,CAAA;AACZ,SAAA;AAAM,aAAA;YACL,UAAU,CAAC,MAAM,IAAI,EAAE,EAAE,EAAE,CAAC,CAAA;AAC7B,SAAA;KACF;AAED,IAAA,IAAI,EAAE,CAAA;AACR;;;;"}
@@ -0,0 +1,32 @@
1
+ /******************************************************************************
2
+ Copyright (c) Microsoft Corporation.
3
+
4
+ Permission to use, copy, modify, and/or distribute this software for any
5
+ purpose with or without fee is hereby granted.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
+ PERFORMANCE OF THIS SOFTWARE.
14
+ ***************************************************************************** */
15
+ /* global Reflect, Promise */
16
+
17
+
18
+ function __classPrivateFieldGet(receiver, state, kind, f) {
19
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
20
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
21
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
22
+ }
23
+
24
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
25
+ if (kind === "m") throw new TypeError("Private method is not writable");
26
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
27
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
28
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
29
+ }
30
+
31
+ export { __classPrivateFieldGet, __classPrivateFieldSet };
32
+ //# sourceMappingURL=tslib.es6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tslib.es6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- export declare const enum NodeType {
1
+ declare const enum NodeType {
2
2
  ELEMENT_NODE = 1,
3
3
  ATTRIBUTE_NODE = 2,
4
4
  TEXT_NODE = 3,
@@ -8,3 +8,4 @@ export declare const enum NodeType {
8
8
  PROCESSING_INSTRUCTION_NODE = 7,
9
9
  DOCUMENT_NODE = 9
10
10
  }
11
+ export { NodeType };
@@ -1,7 +1,7 @@
1
- import type { TaroElement } from '../dom/element';
2
- import type { TaroText } from '../dom/text';
3
- import type { Element, Text } from '../dom-external/inner-html/parser';
4
- export interface Options {
1
+ import { TaroElement } from "./dom/element.js";
2
+ import { TaroText } from "./dom/text.js";
3
+ import { Element, Text } from "./dom-external/inner-html/parser.js";
4
+ interface Options {
5
5
  prerender: boolean;
6
6
  debug: boolean;
7
7
  html?: {
@@ -14,3 +14,4 @@ export interface Options {
14
14
  };
15
15
  miniGlobal?: any;
16
16
  }
17
+ export { Options };
package/dist/options.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- import type { Options } from './interface';
2
- export declare const options: Options;
1
+ import { Options } from "./index-26658829.js";
2
+ declare const options: Options;
3
+ export { options };
@@ -0,0 +1,7 @@
1
+ const options = {
2
+ prerender: true,
3
+ debug: false
4
+ };
5
+
6
+ export { options };
7
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sources":["../src/options.ts"],"sourcesContent":["import type { Options } from './interface'\n\nexport const options: Options = {\n prerender: true,\n debug: false\n}\n"],"names":[],"mappings":"AAEa,MAAA,OAAO,GAAY;AAC9B,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,KAAK,EAAE,KAAK;;;;;"}
package/dist/perf.d.ts CHANGED
@@ -3,5 +3,5 @@ declare class Performance {
3
3
  start(id: string): void;
4
4
  stop(id: string): void;
5
5
  }
6
- export declare const perf: Performance;
7
- export {};
6
+ declare const perf: Performance;
7
+ export { perf };
package/dist/perf.js ADDED
@@ -0,0 +1,28 @@
1
+ import { options } from './options.js';
2
+
3
+ class Performance {
4
+ constructor() {
5
+ this.recorder = new Map();
6
+ }
7
+ start(id) {
8
+ if (!options.debug) {
9
+ return;
10
+ }
11
+ this.recorder.set(id, Date.now());
12
+ }
13
+ stop(id) {
14
+ if (!options.debug) {
15
+ return;
16
+ }
17
+ const now = Date.now();
18
+ const prev = this.recorder.get(id);
19
+ this.recorder.delete(id);
20
+ const time = now - prev;
21
+ // eslint-disable-next-line no-console
22
+ console.log(`${id} 时长: ${time}ms`);
23
+ }
24
+ }
25
+ const perf = new Performance();
26
+
27
+ export { perf };
28
+ //# sourceMappingURL=perf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"perf.js","sources":["../src/perf.ts"],"sourcesContent":["import { options } from './options'\n\nclass Performance {\n private recorder = new Map<string, number>()\n\n public start (id: string) {\n if (!options.debug) {\n return\n }\n this.recorder.set(id, Date.now())\n }\n\n public stop (id: string) {\n if (!options.debug) {\n return\n }\n const now = Date.now()\n const prev = this.recorder.get(id)!\n this.recorder.delete(id)\n const time = now - prev\n // eslint-disable-next-line no-console\n console.log(`${id} 时长: ${time}ms`)\n }\n}\n\nexport const perf = new Performance()\n"],"names":[],"mappings":";;AAEA,MAAM,WAAW,CAAA;AAAjB,IAAA,WAAA,GAAA;AACU,QAAA,IAAA,CAAA,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAA;KAoB7C;AAlBQ,IAAA,KAAK,CAAE,EAAU,EAAA;AACtB,QAAA,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;YAClB,OAAM;AACP,SAAA;AACD,QAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;KAClC;AAEM,IAAA,IAAI,CAAE,EAAU,EAAA;AACrB,QAAA,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;YAClB,OAAM;AACP,SAAA;AACD,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAE,CAAA;AACnC,QAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;AACxB,QAAA,MAAM,IAAI,GAAG,GAAG,GAAG,IAAI,CAAA;;QAEvB,OAAO,CAAC,GAAG,CAAC,CAAA,EAAG,EAAE,CAAQ,KAAA,EAAA,IAAI,CAAI,EAAA,CAAA,CAAC,CAAA;KACnC;AACF,CAAA;AAEY,MAAA,IAAI,GAAG,IAAI,WAAW;;;;"}
@@ -1,11 +1,11 @@
1
- import type { TaroNode } from '../../dom/node';
1
+ import { TaroNode } from "./dom/node.js";
2
2
  /**
3
3
  * A MutationRecord represents an individual DOM mutation.
4
4
  * It is the object that is passed to MutationObserver's callback.
5
5
  * @see https://dom.spec.whatwg.org/#interface-mutationrecord
6
6
  * @see https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord
7
7
  */
8
- export interface MutationRecord {
8
+ interface MutationRecord {
9
9
  readonly target: TaroNode;
10
10
  readonly addedNodes?: TaroNode[];
11
11
  readonly removedNodes?: TaroNode[];
@@ -17,8 +17,9 @@ export interface MutationRecord {
17
17
  readonly type: MutationRecordType;
18
18
  readonly value?: string | null;
19
19
  }
20
- export declare const enum MutationRecordType {
20
+ declare const enum MutationRecordType {
21
21
  ATTRIBUTES = "attributes",
22
22
  CHARACTER_DATA = "characterData",
23
23
  CHILD_LIST = "childList"
24
24
  }
25
+ export { MutationRecord, MutationRecordType };