@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
@@ -1,4 +1,4 @@
1
- import { noop, isFunction, getComponentsAlias as getComponentsAlias$1, internalComponents, isWebPlatform, EMPTY_OBJ, hooks, toCamelCase, isObject, warn, isArray, ensure, isNull, isUndefined, toDashed, isString, controlledComponent, Events, isNumber } from '@tarojs/shared';
1
+ import { noop, isFunction, getComponentsAlias as getComponentsAlias$1, internalComponents, EMPTY_OBJ, hooks, toCamelCase, isObject, warn, isArray, ensure, isNull, isUndefined, toDashed, isString, controlledComponent, Events, isNumber } from '@tarojs/shared';
2
2
  export { Events, hooks } from '@tarojs/shared';
3
3
 
4
4
  const PROPERTY_THRESHOLD = 2046;
@@ -38,6 +38,7 @@ const KEY_CODE = 'keyCode';
38
38
  const TOUCHMOVE = 'touchmove';
39
39
  const DATE = 'Date';
40
40
  const SET_TIMEOUT = 'setTimeout';
41
+ const COMPILE_MODE = 'compileMode';
41
42
  const CATCHMOVE = 'catchMove';
42
43
  const CATCH_VIEW = 'catch-view';
43
44
  const COMMENT = 'comment';
@@ -392,10 +393,9 @@ class EventSource extends Map {
392
393
  }
393
394
  const eventSource = new EventSource();
394
395
 
395
- const isWeb$1 = isWebPlatform();
396
396
  const env = {
397
- window: isWeb$1 ? window : EMPTY_OBJ,
398
- document: isWeb$1 ? document : EMPTY_OBJ
397
+ window: process.env.TARO_PLATFORM === 'web' ? window : EMPTY_OBJ,
398
+ document: process.env.TARO_PLATFORM === 'web' ? document : EMPTY_OBJ
399
399
  };
400
400
 
401
401
  let SPECIAL_NODES;
@@ -408,14 +408,10 @@ let componentsAlias;
408
408
  */
409
409
  function hydrate(node) {
410
410
  var _a;
411
- if (!componentsAlias) {
412
- // 初始化 componentsAlias
413
- componentsAlias = getComponentsAlias();
414
- }
415
- if (!SPECIAL_NODES) {
416
- // 初始化 SPECIAL_NODES
417
- SPECIAL_NODES = hooks.call('getSpecialNodes');
418
- }
411
+ // 初始化 componentsAlias
412
+ componentsAlias || (componentsAlias = getComponentsAlias());
413
+ // 初始化 SPECIAL_NODES
414
+ SPECIAL_NODES || (SPECIAL_NODES = hooks.call('getSpecialNodes'));
419
415
  const nodeName = node.nodeName;
420
416
  if (isText(node)) {
421
417
  return {
@@ -444,22 +440,19 @@ function hydrate(node) {
444
440
  prop !== CLASS &&
445
441
  prop !== STYLE &&
446
442
  prop !== ID &&
447
- propInCamelCase !== CATCHMOVE) {
443
+ propInCamelCase !== CATCHMOVE &&
444
+ propInCamelCase !== COMPILE_MODE) {
448
445
  data[propInCamelCase] = props[prop];
449
446
  }
450
447
  if (nodeName === VIEW && propInCamelCase === CATCHMOVE && props[prop] !== false) {
451
448
  data["nn" /* Shortcuts.NodeName */] = CATCH_VIEW;
452
449
  }
450
+ if (propInCamelCase === COMPILE_MODE) {
451
+ data["nn" /* Shortcuts.NodeName */] = props[prop];
452
+ }
453
453
  }
454
- let { childNodes } = node;
455
- // 过滤 comment 节点
456
- childNodes = childNodes.filter(node => !isComment(node));
457
- if (childNodes.length > 0) {
458
- data["cn" /* Shortcuts.Childnodes */] = childNodes.map(hydrate);
459
- }
460
- else {
461
- data["cn" /* Shortcuts.Childnodes */] = [];
462
- }
454
+ // Children
455
+ data["cn" /* Shortcuts.Childnodes */] = node.childNodes.filter(node => !isComment(node)).map(hydrate);
463
456
  if (node.className !== '') {
464
457
  data["cl" /* Shortcuts.Class */] = node.className;
465
458
  }
@@ -2416,7 +2409,7 @@ function contains(node) {
2416
2409
  return isContains;
2417
2410
  }
2418
2411
 
2419
- if (!isWebPlatform()) {
2412
+ if (process.env.TARO_PLATFORM !== 'web') {
2420
2413
  if (ENABLE_INNER_HTML) {
2421
2414
  TaroNode.extend('innerHTML', {
2422
2415
  set(html) {
@@ -2859,6 +2852,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2859
2852
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2860
2853
  PERFORMANCE OF THIS SOFTWARE.
2861
2854
  ***************************************************************************** */
2855
+ /* global Reflect, Promise */
2856
+
2862
2857
 
2863
2858
  function __classPrivateFieldGet(receiver, state, kind, f) {
2864
2859
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
@@ -2873,7 +2868,7 @@ function __classPrivateFieldSet(receiver, state, value, kind, f) {
2873
2868
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
2874
2869
  }
2875
2870
 
2876
- var _URLSearchParams_dict;
2871
+ var _dict, _a;
2877
2872
  const findReg = /[!'()~]|%20|%00/g;
2878
2873
  const plusReg = /\+/g;
2879
2874
  const replaceCharMap = {
@@ -2904,93 +2899,94 @@ function decode(str) {
2904
2899
  function encode(str) {
2905
2900
  return encodeURIComponent(str).replace(findReg, replacer);
2906
2901
  }
2907
- class URLSearchParams {
2908
- constructor(query) {
2909
- _URLSearchParams_dict.set(this, Object.create(null));
2910
- query !== null && query !== void 0 ? query : (query = '');
2911
- const dict = __classPrivateFieldGet(this, _URLSearchParams_dict, "f");
2912
- if (typeof query === 'string') {
2913
- if (query.charAt(0) === '?') {
2914
- query = query.slice(1);
2915
- }
2916
- for (let pairs = query.split('&'), i = 0, length = pairs.length; i < length; i++) {
2917
- const value = pairs[i];
2918
- const index = value.indexOf('=');
2919
- if (index > -1) {
2920
- appendTo(dict, decode(value.slice(0, index)), decode(value.slice(index + 1)));
2902
+ const URLSearchParams = process.env.TARO_PLATFORM === 'web' ? env.window.URLSearchParams : (_a = class {
2903
+ constructor(query) {
2904
+ _dict.set(this, Object.create(null));
2905
+ query !== null && query !== void 0 ? query : (query = '');
2906
+ const dict = __classPrivateFieldGet(this, _dict, "f");
2907
+ if (typeof query === 'string') {
2908
+ if (query.charAt(0) === '?') {
2909
+ query = query.slice(1);
2921
2910
  }
2922
- else if (value.length) {
2923
- appendTo(dict, decode(value), '');
2924
- }
2925
- }
2926
- }
2927
- else {
2928
- if (isArray(query)) {
2929
- for (let i = 0, length = query.length; i < length; i++) {
2930
- const value = query[i];
2931
- appendTo(dict, value[0], value[1]);
2911
+ for (let pairs = query.split('&'), i = 0, length = pairs.length; i < length; i++) {
2912
+ const value = pairs[i];
2913
+ const index = value.indexOf('=');
2914
+ if (index > -1) {
2915
+ appendTo(dict, decode(value.slice(0, index)), decode(value.slice(index + 1)));
2916
+ }
2917
+ else if (value.length) {
2918
+ appendTo(dict, decode(value), '');
2919
+ }
2932
2920
  }
2933
2921
  }
2934
- else if (query.forEach) {
2935
- query.forEach(addEach, dict);
2936
- }
2937
2922
  else {
2938
- for (const key in query) {
2939
- appendTo(dict, key, query[key]);
2923
+ if (isArray(query)) {
2924
+ for (let i = 0, length = query.length; i < length; i++) {
2925
+ const value = query[i];
2926
+ appendTo(dict, value[0], value[1]);
2927
+ }
2928
+ }
2929
+ else if (query.forEach) {
2930
+ query.forEach(addEach, dict);
2931
+ }
2932
+ else {
2933
+ for (const key in query) {
2934
+ appendTo(dict, key, query[key]);
2935
+ }
2940
2936
  }
2941
2937
  }
2942
2938
  }
2943
- }
2944
- append(name, value) {
2945
- appendTo(__classPrivateFieldGet(this, _URLSearchParams_dict, "f"), name, value);
2946
- }
2947
- delete(name) {
2948
- delete __classPrivateFieldGet(this, _URLSearchParams_dict, "f")[name];
2949
- }
2950
- get(name) {
2951
- const dict = __classPrivateFieldGet(this, _URLSearchParams_dict, "f");
2952
- return name in dict ? dict[name][0] : null;
2953
- }
2954
- getAll(name) {
2955
- const dict = __classPrivateFieldGet(this, _URLSearchParams_dict, "f");
2956
- return name in dict ? dict[name].slice(0) : [];
2957
- }
2958
- has(name) {
2959
- return name in __classPrivateFieldGet(this, _URLSearchParams_dict, "f");
2960
- }
2961
- keys() {
2962
- return Object.keys(__classPrivateFieldGet(this, _URLSearchParams_dict, "f"));
2963
- }
2964
- set(name, value) {
2965
- __classPrivateFieldGet(this, _URLSearchParams_dict, "f")[name] = ['' + value];
2966
- }
2967
- forEach(callback, thisArg) {
2968
- const dict = __classPrivateFieldGet(this, _URLSearchParams_dict, "f");
2969
- Object.getOwnPropertyNames(dict).forEach(function (name) {
2970
- dict[name].forEach(function (value) {
2971
- callback.call(thisArg, value, name, this);
2939
+ append(name, value) {
2940
+ appendTo(__classPrivateFieldGet(this, _dict, "f"), name, value);
2941
+ }
2942
+ delete(name) {
2943
+ delete __classPrivateFieldGet(this, _dict, "f")[name];
2944
+ }
2945
+ get(name) {
2946
+ const dict = __classPrivateFieldGet(this, _dict, "f");
2947
+ return name in dict ? dict[name][0] : null;
2948
+ }
2949
+ getAll(name) {
2950
+ const dict = __classPrivateFieldGet(this, _dict, "f");
2951
+ return name in dict ? dict[name].slice(0) : [];
2952
+ }
2953
+ has(name) {
2954
+ return name in __classPrivateFieldGet(this, _dict, "f");
2955
+ }
2956
+ keys() {
2957
+ return Object.keys(__classPrivateFieldGet(this, _dict, "f"));
2958
+ }
2959
+ set(name, value) {
2960
+ __classPrivateFieldGet(this, _dict, "f")[name] = ['' + value];
2961
+ }
2962
+ forEach(callback, thisArg) {
2963
+ const dict = __classPrivateFieldGet(this, _dict, "f");
2964
+ Object.getOwnPropertyNames(dict).forEach(function (name) {
2965
+ dict[name].forEach(function (value) {
2966
+ callback.call(thisArg, value, name, this);
2967
+ }, this);
2972
2968
  }, this);
2973
- }, this);
2974
- }
2975
- toJSON() {
2976
- return {};
2977
- }
2978
- toString() {
2979
- const dict = __classPrivateFieldGet(this, _URLSearchParams_dict, "f");
2980
- const query = [];
2981
- for (const key in dict) {
2982
- const name = encode(key);
2983
- for (let i = 0, value = dict[key]; i < value.length; i++) {
2984
- query.push(name + '=' + encode(value[i]));
2969
+ }
2970
+ toJSON() {
2971
+ return {};
2972
+ }
2973
+ toString() {
2974
+ const dict = __classPrivateFieldGet(this, _dict, "f");
2975
+ const query = [];
2976
+ for (const key in dict) {
2977
+ const name = encode(key);
2978
+ for (let i = 0, value = dict[key]; i < value.length; i++) {
2979
+ query.push(name + '=' + encode(value[i]));
2980
+ }
2985
2981
  }
2982
+ return query.join('&');
2986
2983
  }
2987
- return query.join('&');
2988
- }
2989
- }
2990
- _URLSearchParams_dict = new WeakMap();
2984
+ },
2985
+ _dict = new WeakMap(),
2986
+ _a);
2991
2987
 
2992
- var _URL_hash, _URL_hostname, _URL_pathname, _URL_port, _URL_protocol, _URL_search;
2993
- class URL {
2988
+ var _TaroURL_hash, _TaroURL_hostname, _TaroURL_pathname, _TaroURL_port, _TaroURL_protocol, _TaroURL_search;
2989
+ class TaroURL {
2994
2990
  static createObjectURL() {
2995
2991
  throw new Error('Oops, not support URL.createObjectURL() in miniprogram.');
2996
2992
  }
@@ -2999,29 +2995,29 @@ class URL {
2999
2995
  }
3000
2996
  constructor(url, base) {
3001
2997
  /* private property */
3002
- _URL_hash.set(this, '');
3003
- _URL_hostname.set(this, '');
3004
- _URL_pathname.set(this, '');
3005
- _URL_port.set(this, '');
3006
- _URL_protocol.set(this, '');
3007
- _URL_search.set(this, void 0);
2998
+ _TaroURL_hash.set(this, '');
2999
+ _TaroURL_hostname.set(this, '');
3000
+ _TaroURL_pathname.set(this, '');
3001
+ _TaroURL_port.set(this, '');
3002
+ _TaroURL_protocol.set(this, '');
3003
+ _TaroURL_search.set(this, void 0);
3008
3004
  if (!isString(url))
3009
3005
  url = String(url);
3010
3006
  const parseResult = parseUrlBase(url, base);
3011
3007
  const { hash, hostname, pathname, port, protocol, search } = parseResult;
3012
- __classPrivateFieldSet(this, _URL_hash, hash, "f");
3013
- __classPrivateFieldSet(this, _URL_hostname, hostname, "f");
3014
- __classPrivateFieldSet(this, _URL_pathname, pathname || '/', "f");
3015
- __classPrivateFieldSet(this, _URL_port, port, "f");
3016
- __classPrivateFieldSet(this, _URL_protocol, protocol, "f");
3017
- __classPrivateFieldSet(this, _URL_search, new URLSearchParams(search), "f");
3008
+ __classPrivateFieldSet(this, _TaroURL_hash, hash, "f");
3009
+ __classPrivateFieldSet(this, _TaroURL_hostname, hostname, "f");
3010
+ __classPrivateFieldSet(this, _TaroURL_pathname, pathname || '/', "f");
3011
+ __classPrivateFieldSet(this, _TaroURL_port, port, "f");
3012
+ __classPrivateFieldSet(this, _TaroURL_protocol, protocol, "f");
3013
+ __classPrivateFieldSet(this, _TaroURL_search, new URLSearchParams(search), "f");
3018
3014
  }
3019
3015
  /* public property */
3020
3016
  get protocol() {
3021
- return __classPrivateFieldGet(this, _URL_protocol, "f");
3017
+ return __classPrivateFieldGet(this, _TaroURL_protocol, "f");
3022
3018
  }
3023
3019
  set protocol(val) {
3024
- isString(val) && (__classPrivateFieldSet(this, _URL_protocol, val.trim(), "f"));
3020
+ isString(val) && (__classPrivateFieldSet(this, _TaroURL_protocol, val.trim(), "f"));
3025
3021
  }
3026
3022
  get host() {
3027
3023
  return this.hostname + (this.port ? ':' + this.port : '');
@@ -3035,19 +3031,19 @@ class URL {
3035
3031
  }
3036
3032
  }
3037
3033
  get hostname() {
3038
- return __classPrivateFieldGet(this, _URL_hostname, "f");
3034
+ return __classPrivateFieldGet(this, _TaroURL_hostname, "f");
3039
3035
  }
3040
3036
  set hostname(val) {
3041
- val && isString(val) && (__classPrivateFieldSet(this, _URL_hostname, val.trim(), "f"));
3037
+ val && isString(val) && (__classPrivateFieldSet(this, _TaroURL_hostname, val.trim(), "f"));
3042
3038
  }
3043
3039
  get port() {
3044
- return __classPrivateFieldGet(this, _URL_port, "f");
3040
+ return __classPrivateFieldGet(this, _TaroURL_port, "f");
3045
3041
  }
3046
3042
  set port(val) {
3047
- isString(val) && (__classPrivateFieldSet(this, _URL_port, val.trim(), "f"));
3043
+ isString(val) && (__classPrivateFieldSet(this, _TaroURL_port, val.trim(), "f"));
3048
3044
  }
3049
3045
  get pathname() {
3050
- return __classPrivateFieldGet(this, _URL_pathname, "f");
3046
+ return __classPrivateFieldGet(this, _TaroURL_pathname, "f");
3051
3047
  }
3052
3048
  set pathname(val) {
3053
3049
  if (isString(val)) {
@@ -3058,31 +3054,31 @@ class URL {
3058
3054
  temp = temp.replace(HEAD_REG, '');
3059
3055
  }
3060
3056
  if (temp)
3061
- __classPrivateFieldSet(this, _URL_pathname, '/' + temp, "f");
3057
+ __classPrivateFieldSet(this, _TaroURL_pathname, '/' + temp, "f");
3062
3058
  else
3063
- __classPrivateFieldSet(this, _URL_pathname, '/', "f");
3059
+ __classPrivateFieldSet(this, _TaroURL_pathname, '/', "f");
3064
3060
  }
3065
3061
  }
3066
3062
  get search() {
3067
- const val = __classPrivateFieldGet(this, _URL_search, "f").toString();
3063
+ const val = __classPrivateFieldGet(this, _TaroURL_search, "f").toString();
3068
3064
  return (val.length === 0 || val.startsWith('?')) ? val : `?${val}`;
3069
3065
  }
3070
3066
  set search(val) {
3071
3067
  if (isString(val)) {
3072
3068
  val = val.trim();
3073
- __classPrivateFieldSet(this, _URL_search, new URLSearchParams(val), "f");
3069
+ __classPrivateFieldSet(this, _TaroURL_search, new URLSearchParams(val), "f");
3074
3070
  }
3075
3071
  }
3076
3072
  get hash() {
3077
- return __classPrivateFieldGet(this, _URL_hash, "f");
3073
+ return __classPrivateFieldGet(this, _TaroURL_hash, "f");
3078
3074
  }
3079
3075
  set hash(val) {
3080
3076
  if (isString(val)) {
3081
3077
  val = val.trim();
3082
3078
  if (val)
3083
- __classPrivateFieldSet(this, _URL_hash, val.startsWith('#') ? val : `#${val}`, "f");
3079
+ __classPrivateFieldSet(this, _TaroURL_hash, val.startsWith('#') ? val : `#${val}`, "f");
3084
3080
  else
3085
- __classPrivateFieldSet(this, _URL_hash, '', "f");
3081
+ __classPrivateFieldSet(this, _TaroURL_hash, '', "f");
3086
3082
  }
3087
3083
  }
3088
3084
  get href() {
@@ -3113,7 +3109,7 @@ class URL {
3113
3109
  }
3114
3110
  }
3115
3111
  get searchParams() {
3116
- return __classPrivateFieldGet(this, _URL_search, "f");
3112
+ return __classPrivateFieldGet(this, _TaroURL_search, "f");
3117
3113
  }
3118
3114
  // public method
3119
3115
  toString() {
@@ -3137,7 +3133,8 @@ class URL {
3137
3133
  };
3138
3134
  }
3139
3135
  }
3140
- _URL_hash = new WeakMap(), _URL_hostname = new WeakMap(), _URL_pathname = new WeakMap(), _URL_port = new WeakMap(), _URL_protocol = new WeakMap(), _URL_search = new WeakMap();
3136
+ _TaroURL_hash = new WeakMap(), _TaroURL_hostname = new WeakMap(), _TaroURL_pathname = new WeakMap(), _TaroURL_port = new WeakMap(), _TaroURL_protocol = new WeakMap(), _TaroURL_search = new WeakMap();
3137
+ const URL = process.env.TARO_PLATFORM === 'web' ? env.window.URL : TaroURL;
3141
3138
  function parseUrl(url = '') {
3142
3139
  const result = {
3143
3140
  href: '',
@@ -3328,49 +3325,42 @@ class TaroDocument extends TaroElement {
3328
3325
  }
3329
3326
  }
3330
3327
 
3331
- let document$1;
3332
- if (process.env.TARO_ENV && !isWebPlatform()) {
3333
- /* eslint-disable no-inner-declarations */
3334
- function createDocument() {
3335
- /**
3336
- * <document>
3337
- * <html>
3338
- * <head></head>
3339
- * <body>
3340
- * <container>
3341
- * <app id="app" />
3342
- * </container>
3343
- * </body>
3344
- * </html>
3345
- * </document>
3346
- */
3347
- const doc = new TaroDocument();
3348
- const documentCreateElement = doc.createElement.bind(doc);
3349
- const html = documentCreateElement(HTML);
3350
- const head = documentCreateElement(HEAD);
3351
- const body = documentCreateElement(BODY);
3352
- const app = documentCreateElement(APP);
3353
- app.id = APP;
3354
- const container = documentCreateElement(CONTAINER); // 多包一层主要为了兼容 vue
3355
- doc.appendChild(html);
3356
- html.appendChild(head);
3357
- html.appendChild(body);
3358
- body.appendChild(container);
3359
- container.appendChild(app);
3360
- doc.documentElement = html;
3361
- doc.head = head;
3362
- doc.body = body;
3363
- return doc;
3364
- }
3365
- document$1 = env.document = createDocument();
3366
- }
3367
- else {
3368
- document$1 = env.document;
3328
+ function createDocument() {
3329
+ /**
3330
+ * <document>
3331
+ * <html>
3332
+ * <head></head>
3333
+ * <body>
3334
+ * <container>
3335
+ * <app id="app" />
3336
+ * </container>
3337
+ * </body>
3338
+ * </html>
3339
+ * </document>
3340
+ */
3341
+ const doc = new TaroDocument();
3342
+ const documentCreateElement = doc.createElement.bind(doc);
3343
+ const html = documentCreateElement(HTML);
3344
+ const head = documentCreateElement(HEAD);
3345
+ const body = documentCreateElement(BODY);
3346
+ const app = documentCreateElement(APP);
3347
+ app.id = APP;
3348
+ const container = documentCreateElement(CONTAINER); // 多包一层主要为了兼容 vue
3349
+ doc.appendChild(html);
3350
+ html.appendChild(head);
3351
+ html.appendChild(body);
3352
+ body.appendChild(container);
3353
+ container.appendChild(app);
3354
+ doc.documentElement = html;
3355
+ doc.head = head;
3356
+ doc.body = body;
3357
+ return doc;
3369
3358
  }
3359
+ const document$1 = process.env.TARO_PLATFORM === 'web' ? env.document : createDocument();
3370
3360
 
3371
- function getComputedStyle(element) {
3361
+ const getComputedStyle = process.env.TARO_PLATFORM === 'web' ? env.window.getComputedStyle : function (element) {
3372
3362
  return element.style;
3373
- }
3363
+ };
3374
3364
 
3375
3365
  const eventCenter = hooks.call('getEventCenter', Events);
3376
3366
 
@@ -3399,72 +3389,72 @@ class RuntimeCache {
3399
3389
  }
3400
3390
  }
3401
3391
 
3402
- var _History_instances, _History_location, _History_stack, _History_cur, _History_window, _History_reset;
3392
+ var _TaroHistory_instances, _TaroHistory_location, _TaroHistory_stack, _TaroHistory_cur, _TaroHistory_window, _TaroHistory_reset;
3403
3393
  const cache$1 = new RuntimeCache('history');
3404
- class History extends Events {
3394
+ class TaroHistory extends Events {
3405
3395
  constructor(location, options) {
3406
3396
  super();
3407
- _History_instances.add(this);
3397
+ _TaroHistory_instances.add(this);
3408
3398
  /* private property */
3409
- _History_location.set(this, void 0);
3410
- _History_stack.set(this, []);
3411
- _History_cur.set(this, 0);
3412
- _History_window.set(this, void 0);
3413
- __classPrivateFieldSet(this, _History_window, options.window, "f");
3414
- __classPrivateFieldSet(this, _History_location, location, "f");
3415
- __classPrivateFieldGet(this, _History_location, "f").on('__record_history__', (href) => {
3399
+ _TaroHistory_location.set(this, void 0);
3400
+ _TaroHistory_stack.set(this, []);
3401
+ _TaroHistory_cur.set(this, 0);
3402
+ _TaroHistory_window.set(this, void 0);
3403
+ __classPrivateFieldSet(this, _TaroHistory_window, options.window, "f");
3404
+ __classPrivateFieldSet(this, _TaroHistory_location, location, "f");
3405
+ __classPrivateFieldGet(this, _TaroHistory_location, "f").on('__record_history__', (href) => {
3416
3406
  var _a;
3417
- __classPrivateFieldSet(this, _History_cur, (_a = __classPrivateFieldGet(this, _History_cur, "f"), _a++, _a), "f");
3418
- __classPrivateFieldSet(this, _History_stack, __classPrivateFieldGet(this, _History_stack, "f").slice(0, __classPrivateFieldGet(this, _History_cur, "f")), "f");
3419
- __classPrivateFieldGet(this, _History_stack, "f").push({
3407
+ __classPrivateFieldSet(this, _TaroHistory_cur, (_a = __classPrivateFieldGet(this, _TaroHistory_cur, "f"), _a++, _a), "f");
3408
+ __classPrivateFieldSet(this, _TaroHistory_stack, __classPrivateFieldGet(this, _TaroHistory_stack, "f").slice(0, __classPrivateFieldGet(this, _TaroHistory_cur, "f")), "f");
3409
+ __classPrivateFieldGet(this, _TaroHistory_stack, "f").push({
3420
3410
  state: null,
3421
3411
  title: '',
3422
3412
  url: href
3423
3413
  });
3424
3414
  }, null);
3425
- __classPrivateFieldGet(this, _History_location, "f").on('__reset_history__', (href) => {
3426
- __classPrivateFieldGet(this, _History_instances, "m", _History_reset).call(this, href);
3415
+ __classPrivateFieldGet(this, _TaroHistory_location, "f").on('__reset_history__', (href) => {
3416
+ __classPrivateFieldGet(this, _TaroHistory_instances, "m", _TaroHistory_reset).call(this, href);
3427
3417
  }, null);
3428
3418
  // 切换上下文行为
3429
3419
  this.on(CONTEXT_ACTIONS.INIT, () => {
3430
- __classPrivateFieldGet(this, _History_instances, "m", _History_reset).call(this);
3420
+ __classPrivateFieldGet(this, _TaroHistory_instances, "m", _TaroHistory_reset).call(this);
3431
3421
  }, null);
3432
3422
  this.on(CONTEXT_ACTIONS.RESTORE, (pageId) => {
3433
3423
  cache$1.set(pageId, {
3434
- location: __classPrivateFieldGet(this, _History_location, "f"),
3435
- stack: __classPrivateFieldGet(this, _History_stack, "f").slice(),
3436
- cur: __classPrivateFieldGet(this, _History_cur, "f")
3424
+ location: __classPrivateFieldGet(this, _TaroHistory_location, "f"),
3425
+ stack: __classPrivateFieldGet(this, _TaroHistory_stack, "f").slice(),
3426
+ cur: __classPrivateFieldGet(this, _TaroHistory_cur, "f")
3437
3427
  });
3438
3428
  }, null);
3439
3429
  this.on(CONTEXT_ACTIONS.RECOVER, (pageId) => {
3440
3430
  if (cache$1.has(pageId)) {
3441
3431
  const ctx = cache$1.get(pageId);
3442
- __classPrivateFieldSet(this, _History_location, ctx.location, "f");
3443
- __classPrivateFieldSet(this, _History_stack, ctx.stack, "f");
3444
- __classPrivateFieldSet(this, _History_cur, ctx.cur, "f");
3432
+ __classPrivateFieldSet(this, _TaroHistory_location, ctx.location, "f");
3433
+ __classPrivateFieldSet(this, _TaroHistory_stack, ctx.stack, "f");
3434
+ __classPrivateFieldSet(this, _TaroHistory_cur, ctx.cur, "f");
3445
3435
  }
3446
3436
  }, null);
3447
3437
  this.on(CONTEXT_ACTIONS.DESTORY, (pageId) => {
3448
3438
  cache$1.delete(pageId);
3449
3439
  }, null);
3450
- __classPrivateFieldGet(this, _History_instances, "m", _History_reset).call(this);
3440
+ __classPrivateFieldGet(this, _TaroHistory_instances, "m", _TaroHistory_reset).call(this);
3451
3441
  }
3452
3442
  /* public property */
3453
3443
  get length() {
3454
- return __classPrivateFieldGet(this, _History_stack, "f").length;
3444
+ return __classPrivateFieldGet(this, _TaroHistory_stack, "f").length;
3455
3445
  }
3456
3446
  get state() {
3457
- return __classPrivateFieldGet(this, _History_stack, "f")[__classPrivateFieldGet(this, _History_cur, "f")].state;
3447
+ return __classPrivateFieldGet(this, _TaroHistory_stack, "f")[__classPrivateFieldGet(this, _TaroHistory_cur, "f")].state;
3458
3448
  }
3459
3449
  /* public method */
3460
3450
  go(delta) {
3461
3451
  if (!isNumber(delta) || isNaN(delta))
3462
3452
  return;
3463
- let targetIdx = __classPrivateFieldGet(this, _History_cur, "f") + delta;
3453
+ let targetIdx = __classPrivateFieldGet(this, _TaroHistory_cur, "f") + delta;
3464
3454
  targetIdx = Math.min(Math.max(targetIdx, 0), this.length - 1);
3465
- __classPrivateFieldSet(this, _History_cur, targetIdx, "f");
3466
- __classPrivateFieldGet(this, _History_location, "f").trigger('__set_href_without_history__', __classPrivateFieldGet(this, _History_stack, "f")[__classPrivateFieldGet(this, _History_cur, "f")].url);
3467
- __classPrivateFieldGet(this, _History_window, "f").trigger('popstate', __classPrivateFieldGet(this, _History_stack, "f")[__classPrivateFieldGet(this, _History_cur, "f")]);
3455
+ __classPrivateFieldSet(this, _TaroHistory_cur, targetIdx, "f");
3456
+ __classPrivateFieldGet(this, _TaroHistory_location, "f").trigger('__set_href_without_history__', __classPrivateFieldGet(this, _TaroHistory_stack, "f")[__classPrivateFieldGet(this, _TaroHistory_cur, "f")].url);
3457
+ __classPrivateFieldGet(this, _TaroHistory_window, "f").trigger('popstate', __classPrivateFieldGet(this, _TaroHistory_stack, "f")[__classPrivateFieldGet(this, _TaroHistory_cur, "f")]);
3468
3458
  }
3469
3459
  back() {
3470
3460
  this.go(-1);
@@ -3475,40 +3465,41 @@ class History extends Events {
3475
3465
  pushState(state, title, url) {
3476
3466
  if (!url || !isString(url))
3477
3467
  return;
3478
- __classPrivateFieldSet(this, _History_stack, __classPrivateFieldGet(this, _History_stack, "f").slice(0, __classPrivateFieldGet(this, _History_cur, "f") + 1), "f");
3479
- __classPrivateFieldGet(this, _History_stack, "f").push({
3468
+ __classPrivateFieldSet(this, _TaroHistory_stack, __classPrivateFieldGet(this, _TaroHistory_stack, "f").slice(0, __classPrivateFieldGet(this, _TaroHistory_cur, "f") + 1), "f");
3469
+ __classPrivateFieldGet(this, _TaroHistory_stack, "f").push({
3480
3470
  state,
3481
3471
  title,
3482
3472
  url
3483
3473
  });
3484
- __classPrivateFieldSet(this, _History_cur, this.length - 1, "f");
3485
- __classPrivateFieldGet(this, _History_location, "f").trigger('__set_href_without_history__', url);
3474
+ __classPrivateFieldSet(this, _TaroHistory_cur, this.length - 1, "f");
3475
+ __classPrivateFieldGet(this, _TaroHistory_location, "f").trigger('__set_href_without_history__', url);
3486
3476
  }
3487
3477
  replaceState(state, title, url) {
3488
3478
  if (!url || !isString(url))
3489
3479
  return;
3490
- __classPrivateFieldGet(this, _History_stack, "f")[__classPrivateFieldGet(this, _History_cur, "f")] = {
3480
+ __classPrivateFieldGet(this, _TaroHistory_stack, "f")[__classPrivateFieldGet(this, _TaroHistory_cur, "f")] = {
3491
3481
  state,
3492
3482
  title,
3493
3483
  url
3494
3484
  };
3495
- __classPrivateFieldGet(this, _History_location, "f").trigger('__set_href_without_history__', url);
3485
+ __classPrivateFieldGet(this, _TaroHistory_location, "f").trigger('__set_href_without_history__', url);
3496
3486
  }
3497
3487
  // For debug
3498
3488
  get cache() {
3499
3489
  return cache$1;
3500
3490
  }
3501
3491
  }
3502
- _History_location = new WeakMap(), _History_stack = new WeakMap(), _History_cur = new WeakMap(), _History_window = new WeakMap(), _History_instances = new WeakSet(), _History_reset = function _History_reset(href = '') {
3503
- __classPrivateFieldSet(this, _History_stack, [
3492
+ _TaroHistory_location = new WeakMap(), _TaroHistory_stack = new WeakMap(), _TaroHistory_cur = new WeakMap(), _TaroHistory_window = new WeakMap(), _TaroHistory_instances = new WeakSet(), _TaroHistory_reset = function _TaroHistory_reset(href = '') {
3493
+ __classPrivateFieldSet(this, _TaroHistory_stack, [
3504
3494
  {
3505
3495
  state: null,
3506
3496
  title: '',
3507
- url: href || __classPrivateFieldGet(this, _History_location, "f").href
3497
+ url: href || __classPrivateFieldGet(this, _TaroHistory_location, "f").href
3508
3498
  }
3509
3499
  ], "f");
3510
- __classPrivateFieldSet(this, _History_cur, 0, "f");
3500
+ __classPrivateFieldSet(this, _TaroHistory_cur, 0, "f");
3511
3501
  };
3502
+ const History = process.env.TARO_PLATFORM === 'web' ? env.window.History : TaroHistory;
3512
3503
 
3513
3504
  const Current = {
3514
3505
  app: null,
@@ -3517,31 +3508,31 @@ const Current = {
3517
3508
  };
3518
3509
  const getCurrentInstance = () => Current;
3519
3510
 
3520
- var _Location_instances, _Location_url, _Location_noCheckUrl, _Location_window, _Location_reset, _Location_getPreValue, _Location_rollBack, _Location_recordHistory, _Location_checkUrlChange;
3511
+ var _TaroLocation_instances, _TaroLocation_url, _TaroLocation_noCheckUrl, _TaroLocation_window, _TaroLocation_reset, _TaroLocation_getPreValue, _TaroLocation_rollBack, _TaroLocation_recordHistory, _TaroLocation_checkUrlChange;
3521
3512
  const INIT_URL = 'https://taro.com';
3522
3513
  const cache = new RuntimeCache('location');
3523
- class Location extends Events {
3514
+ class TaroLocation extends Events {
3524
3515
  constructor(options) {
3525
3516
  super();
3526
- _Location_instances.add(this);
3517
+ _TaroLocation_instances.add(this);
3527
3518
  /* private property */
3528
- _Location_url.set(this, new URL(INIT_URL));
3529
- _Location_noCheckUrl.set(this, false);
3530
- _Location_window.set(this, void 0);
3531
- __classPrivateFieldSet(this, _Location_window, options.window, "f");
3532
- __classPrivateFieldGet(this, _Location_instances, "m", _Location_reset).call(this);
3519
+ _TaroLocation_url.set(this, new URL(INIT_URL));
3520
+ _TaroLocation_noCheckUrl.set(this, false);
3521
+ _TaroLocation_window.set(this, void 0);
3522
+ __classPrivateFieldSet(this, _TaroLocation_window, options.window, "f");
3523
+ __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_reset).call(this);
3533
3524
  this.on('__set_href_without_history__', (href) => {
3534
- __classPrivateFieldSet(this, _Location_noCheckUrl, true, "f");
3535
- const lastHash = __classPrivateFieldGet(this, _Location_url, "f").hash;
3536
- __classPrivateFieldGet(this, _Location_url, "f").href = generateFullUrl(href);
3537
- if (lastHash !== __classPrivateFieldGet(this, _Location_url, "f").hash) {
3538
- __classPrivateFieldGet(this, _Location_window, "f").trigger('hashchange');
3525
+ __classPrivateFieldSet(this, _TaroLocation_noCheckUrl, true, "f");
3526
+ const lastHash = __classPrivateFieldGet(this, _TaroLocation_url, "f").hash;
3527
+ __classPrivateFieldGet(this, _TaroLocation_url, "f").href = generateFullUrl(href);
3528
+ if (lastHash !== __classPrivateFieldGet(this, _TaroLocation_url, "f").hash) {
3529
+ __classPrivateFieldGet(this, _TaroLocation_window, "f").trigger('hashchange');
3539
3530
  }
3540
- __classPrivateFieldSet(this, _Location_noCheckUrl, false, "f");
3531
+ __classPrivateFieldSet(this, _TaroLocation_noCheckUrl, false, "f");
3541
3532
  }, null);
3542
3533
  // 切换上下文行为
3543
3534
  this.on(CONTEXT_ACTIONS.INIT, () => {
3544
- __classPrivateFieldGet(this, _Location_instances, "m", _Location_reset).call(this);
3535
+ __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_reset).call(this);
3545
3536
  }, null);
3546
3537
  this.on(CONTEXT_ACTIONS.RESTORE, (pageId) => {
3547
3538
  cache.set(pageId, {
@@ -3552,9 +3543,9 @@ class Location extends Events {
3552
3543
  // 数据恢复时,不需要执行跳转
3553
3544
  if (cache.has(pageId)) {
3554
3545
  const ctx = cache.get(pageId);
3555
- __classPrivateFieldSet(this, _Location_noCheckUrl, true, "f");
3556
- __classPrivateFieldGet(this, _Location_url, "f").href = ctx.lastHref;
3557
- __classPrivateFieldSet(this, _Location_noCheckUrl, false, "f");
3546
+ __classPrivateFieldSet(this, _TaroLocation_noCheckUrl, true, "f");
3547
+ __classPrivateFieldGet(this, _TaroLocation_url, "f").href = ctx.lastHref;
3548
+ __classPrivateFieldSet(this, _TaroLocation_noCheckUrl, false, "f");
3558
3549
  }
3559
3550
  }, null);
3560
3551
  this.on(CONTEXT_ACTIONS.DESTORY, (pageId) => {
@@ -3563,81 +3554,81 @@ class Location extends Events {
3563
3554
  }
3564
3555
  /* public property */
3565
3556
  get protocol() {
3566
- return __classPrivateFieldGet(this, _Location_url, "f").protocol;
3557
+ return __classPrivateFieldGet(this, _TaroLocation_url, "f").protocol;
3567
3558
  }
3568
3559
  set protocol(val) {
3569
3560
  const REG = /^(http|https):$/i;
3570
3561
  if (!val || !isString(val) || !REG.test(val.trim()))
3571
3562
  return;
3572
3563
  val = val.trim();
3573
- const preValue = __classPrivateFieldGet(this, _Location_instances, "m", _Location_getPreValue).call(this);
3574
- __classPrivateFieldGet(this, _Location_url, "f").protocol = val;
3575
- if (__classPrivateFieldGet(this, _Location_instances, "m", _Location_checkUrlChange).call(this, preValue))
3576
- __classPrivateFieldGet(this, _Location_instances, "m", _Location_recordHistory).call(this);
3564
+ const preValue = __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_getPreValue).call(this);
3565
+ __classPrivateFieldGet(this, _TaroLocation_url, "f").protocol = val;
3566
+ if (__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_checkUrlChange).call(this, preValue))
3567
+ __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_recordHistory).call(this);
3577
3568
  }
3578
3569
  get host() {
3579
- return __classPrivateFieldGet(this, _Location_url, "f").host;
3570
+ return __classPrivateFieldGet(this, _TaroLocation_url, "f").host;
3580
3571
  }
3581
3572
  set host(val) {
3582
3573
  if (!val || !isString(val))
3583
3574
  return;
3584
3575
  val = val.trim();
3585
- const preValue = __classPrivateFieldGet(this, _Location_instances, "m", _Location_getPreValue).call(this);
3586
- __classPrivateFieldGet(this, _Location_url, "f").host = val;
3587
- if (__classPrivateFieldGet(this, _Location_instances, "m", _Location_checkUrlChange).call(this, preValue))
3588
- __classPrivateFieldGet(this, _Location_instances, "m", _Location_recordHistory).call(this);
3576
+ const preValue = __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_getPreValue).call(this);
3577
+ __classPrivateFieldGet(this, _TaroLocation_url, "f").host = val;
3578
+ if (__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_checkUrlChange).call(this, preValue))
3579
+ __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_recordHistory).call(this);
3589
3580
  }
3590
3581
  get hostname() {
3591
- return __classPrivateFieldGet(this, _Location_url, "f").hostname;
3582
+ return __classPrivateFieldGet(this, _TaroLocation_url, "f").hostname;
3592
3583
  }
3593
3584
  set hostname(val) {
3594
3585
  if (!val || !isString(val))
3595
3586
  return;
3596
3587
  val = val.trim();
3597
- const preValue = __classPrivateFieldGet(this, _Location_instances, "m", _Location_getPreValue).call(this);
3598
- __classPrivateFieldGet(this, _Location_url, "f").hostname = val;
3599
- if (__classPrivateFieldGet(this, _Location_instances, "m", _Location_checkUrlChange).call(this, preValue))
3600
- __classPrivateFieldGet(this, _Location_instances, "m", _Location_recordHistory).call(this);
3588
+ const preValue = __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_getPreValue).call(this);
3589
+ __classPrivateFieldGet(this, _TaroLocation_url, "f").hostname = val;
3590
+ if (__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_checkUrlChange).call(this, preValue))
3591
+ __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_recordHistory).call(this);
3601
3592
  }
3602
3593
  get port() {
3603
- return __classPrivateFieldGet(this, _Location_url, "f").port;
3594
+ return __classPrivateFieldGet(this, _TaroLocation_url, "f").port;
3604
3595
  }
3605
3596
  set port(val) {
3606
3597
  const xVal = Number((val = val.trim()));
3607
3598
  if (!isNumber(xVal) || xVal <= 0)
3608
3599
  return;
3609
- const preValue = __classPrivateFieldGet(this, _Location_instances, "m", _Location_getPreValue).call(this);
3610
- __classPrivateFieldGet(this, _Location_url, "f").port = val;
3611
- if (__classPrivateFieldGet(this, _Location_instances, "m", _Location_checkUrlChange).call(this, preValue))
3612
- __classPrivateFieldGet(this, _Location_instances, "m", _Location_recordHistory).call(this);
3600
+ const preValue = __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_getPreValue).call(this);
3601
+ __classPrivateFieldGet(this, _TaroLocation_url, "f").port = val;
3602
+ if (__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_checkUrlChange).call(this, preValue))
3603
+ __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_recordHistory).call(this);
3613
3604
  }
3614
3605
  get pathname() {
3615
- return __classPrivateFieldGet(this, _Location_url, "f").pathname;
3606
+ return __classPrivateFieldGet(this, _TaroLocation_url, "f").pathname;
3616
3607
  }
3617
3608
  set pathname(val) {
3618
3609
  if (!val || !isString(val))
3619
3610
  return;
3620
3611
  val = val.trim();
3621
- const preValue = __classPrivateFieldGet(this, _Location_instances, "m", _Location_getPreValue).call(this);
3622
- __classPrivateFieldGet(this, _Location_url, "f").pathname = val;
3623
- if (__classPrivateFieldGet(this, _Location_instances, "m", _Location_checkUrlChange).call(this, preValue))
3624
- __classPrivateFieldGet(this, _Location_instances, "m", _Location_recordHistory).call(this);
3612
+ const preValue = __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_getPreValue).call(this);
3613
+ __classPrivateFieldGet(this, _TaroLocation_url, "f").pathname = val;
3614
+ if (__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_checkUrlChange).call(this, preValue))
3615
+ __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_recordHistory).call(this);
3625
3616
  }
3626
3617
  get search() {
3627
- return __classPrivateFieldGet(this, _Location_url, "f").search;
3618
+ return __classPrivateFieldGet(this, _TaroLocation_url, "f").search;
3628
3619
  }
3629
3620
  set search(val) {
3630
3621
  if (!val || !isString(val))
3631
3622
  return;
3632
3623
  val = val.trim();
3633
3624
  val = val.startsWith('?') ? val : `?${val}`;
3634
- const preValue = __classPrivateFieldGet(this, _Location_instances, "m", _Location_getPreValue).call(this);
3635
- __classPrivateFieldGet(this, _Location_url, "f").search = val;
3636
- if (__classPrivateFieldGet(this, _Location_instances, "m", _Location_checkUrlChange).call(this, preValue))
3637
- __classPrivateFieldGet(this, _Location_instances, "m", _Location_recordHistory).call(this);
3625
+ const preValue = __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_getPreValue).call(this);
3626
+ __classPrivateFieldGet(this, _TaroLocation_url, "f").search = val;
3627
+ if (__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_checkUrlChange).call(this, preValue))
3628
+ __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_recordHistory).call(this);
3638
3629
  }
3639
3630
  get hash() {
3640
- return __classPrivateFieldGet(this, _Location_url, "f").hash;
3631
+ return __classPrivateFieldGet(this, _TaroLocation_url, "f").hash;
3641
3632
  }
3642
3633
  // 小程序的navigateTo存在截断hash字符串的问题
3643
3634
  set hash(val) {
@@ -3645,34 +3636,34 @@ class Location extends Events {
3645
3636
  return;
3646
3637
  val = val.trim();
3647
3638
  val = val.startsWith('#') ? val : `#${val}`;
3648
- const preValue = __classPrivateFieldGet(this, _Location_instances, "m", _Location_getPreValue).call(this);
3649
- __classPrivateFieldGet(this, _Location_url, "f").hash = val;
3650
- if (__classPrivateFieldGet(this, _Location_instances, "m", _Location_checkUrlChange).call(this, preValue))
3651
- __classPrivateFieldGet(this, _Location_instances, "m", _Location_recordHistory).call(this);
3639
+ const preValue = __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_getPreValue).call(this);
3640
+ __classPrivateFieldGet(this, _TaroLocation_url, "f").hash = val;
3641
+ if (__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_checkUrlChange).call(this, preValue))
3642
+ __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_recordHistory).call(this);
3652
3643
  }
3653
3644
  get href() {
3654
- return __classPrivateFieldGet(this, _Location_url, "f").href;
3645
+ return __classPrivateFieldGet(this, _TaroLocation_url, "f").href;
3655
3646
  }
3656
3647
  set href(val) {
3657
3648
  const REG = /^(http:|https:)?\/\/.+/;
3658
3649
  if (!val || !isString(val) || !REG.test((val = val.trim())))
3659
3650
  return;
3660
- const preValue = __classPrivateFieldGet(this, _Location_instances, "m", _Location_getPreValue).call(this);
3661
- __classPrivateFieldGet(this, _Location_url, "f").href = val;
3662
- if (__classPrivateFieldGet(this, _Location_instances, "m", _Location_checkUrlChange).call(this, preValue))
3663
- __classPrivateFieldGet(this, _Location_instances, "m", _Location_recordHistory).call(this);
3651
+ const preValue = __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_getPreValue).call(this);
3652
+ __classPrivateFieldGet(this, _TaroLocation_url, "f").href = val;
3653
+ if (__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_checkUrlChange).call(this, preValue))
3654
+ __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_recordHistory).call(this);
3664
3655
  }
3665
3656
  get origin() {
3666
- return __classPrivateFieldGet(this, _Location_url, "f").origin;
3657
+ return __classPrivateFieldGet(this, _TaroLocation_url, "f").origin;
3667
3658
  }
3668
3659
  set origin(val) {
3669
3660
  const REG = /^(http:|https:)?\/\/.+/;
3670
3661
  if (!val || !isString(val) || !REG.test((val = val.trim())))
3671
3662
  return;
3672
- const preValue = __classPrivateFieldGet(this, _Location_instances, "m", _Location_getPreValue).call(this);
3673
- __classPrivateFieldGet(this, _Location_url, "f").origin = val;
3674
- if (__classPrivateFieldGet(this, _Location_instances, "m", _Location_checkUrlChange).call(this, preValue))
3675
- __classPrivateFieldGet(this, _Location_instances, "m", _Location_recordHistory).call(this);
3663
+ const preValue = __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_getPreValue).call(this);
3664
+ __classPrivateFieldGet(this, _TaroLocation_url, "f").origin = val;
3665
+ if (__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_checkUrlChange).call(this, preValue))
3666
+ __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_recordHistory).call(this);
3676
3667
  }
3677
3668
  /* public method */
3678
3669
  assign() {
@@ -3692,7 +3683,7 @@ class Location extends Events {
3692
3683
  return cache;
3693
3684
  }
3694
3685
  }
3695
- _Location_url = new WeakMap(), _Location_noCheckUrl = new WeakMap(), _Location_window = new WeakMap(), _Location_instances = new WeakSet(), _Location_reset = function _Location_reset() {
3686
+ _TaroLocation_url = new WeakMap(), _TaroLocation_noCheckUrl = new WeakMap(), _TaroLocation_window = new WeakMap(), _TaroLocation_instances = new WeakSet(), _TaroLocation_reset = function _TaroLocation_reset() {
3696
3687
  const Current = getCurrentInstance();
3697
3688
  const router = Current.router;
3698
3689
  if (router) {
@@ -3702,23 +3693,23 @@ _Location_url = new WeakMap(), _Location_noCheckUrl = new WeakMap(), _Location_w
3702
3693
  });
3703
3694
  const searchStr = searchArr.length > 0 ? '?' + searchArr.join('&') : '';
3704
3695
  const url = `${INIT_URL}${path.startsWith('/') ? path : '/' + path}${searchStr}`;
3705
- __classPrivateFieldSet(this, _Location_url, new URL(url), "f");
3696
+ __classPrivateFieldSet(this, _TaroLocation_url, new URL(url), "f");
3706
3697
  this.trigger('__reset_history__', this.href);
3707
3698
  }
3708
- }, _Location_getPreValue = function _Location_getPreValue() {
3709
- return __classPrivateFieldGet(this, _Location_url, "f")._toRaw();
3710
- }, _Location_rollBack = function _Location_rollBack(href) {
3711
- __classPrivateFieldGet(this, _Location_url, "f").href = href;
3712
- }, _Location_recordHistory = function _Location_recordHistory() {
3699
+ }, _TaroLocation_getPreValue = function _TaroLocation_getPreValue() {
3700
+ return __classPrivateFieldGet(this, _TaroLocation_url, "f")._toRaw();
3701
+ }, _TaroLocation_rollBack = function _TaroLocation_rollBack(href) {
3702
+ __classPrivateFieldGet(this, _TaroLocation_url, "f").href = href;
3703
+ }, _TaroLocation_recordHistory = function _TaroLocation_recordHistory() {
3713
3704
  this.trigger('__record_history__', this.href);
3714
- }, _Location_checkUrlChange = function _Location_checkUrlChange(preValue) {
3715
- if (__classPrivateFieldGet(this, _Location_noCheckUrl, "f")) {
3705
+ }, _TaroLocation_checkUrlChange = function _TaroLocation_checkUrlChange(preValue) {
3706
+ if (__classPrivateFieldGet(this, _TaroLocation_noCheckUrl, "f")) {
3716
3707
  return false;
3717
3708
  }
3718
- const { protocol, hostname, port, pathname, search, hash } = __classPrivateFieldGet(this, _Location_url, "f")._toRaw();
3709
+ const { protocol, hostname, port, pathname, search, hash } = __classPrivateFieldGet(this, _TaroLocation_url, "f")._toRaw();
3719
3710
  // 跨域三要素不允许修改
3720
3711
  if (protocol !== preValue.protocol || hostname !== preValue.hostname || port !== preValue.port) {
3721
- __classPrivateFieldGet(this, _Location_instances, "m", _Location_rollBack).call(this, preValue.href);
3712
+ __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_rollBack).call(this, preValue.href);
3722
3713
  return false;
3723
3714
  }
3724
3715
  // pathname
@@ -3731,12 +3722,13 @@ _Location_url = new WeakMap(), _Location_noCheckUrl = new WeakMap(), _Location_w
3731
3722
  }
3732
3723
  // hashchange
3733
3724
  if (hash !== preValue.hash) {
3734
- __classPrivateFieldGet(this, _Location_window, "f").trigger('hashchange');
3725
+ __classPrivateFieldGet(this, _TaroLocation_window, "f").trigger('hashchange');
3735
3726
  return true;
3736
3727
  }
3737
- __classPrivateFieldGet(this, _Location_instances, "m", _Location_rollBack).call(this, preValue.href);
3728
+ __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_rollBack).call(this, preValue.href);
3738
3729
  return false;
3739
3730
  };
3731
+ const Location = process.env.TARO_PLATFORM === 'web' ? env.window.Location : TaroLocation;
3740
3732
  function generateFullUrl(val = '') {
3741
3733
  const origin = INIT_URL;
3742
3734
  if (/^[/?#]/.test(val)) {
@@ -3749,7 +3741,7 @@ const machine = 'Macintosh';
3749
3741
  const arch = 'Intel Mac OS X 10_14_5';
3750
3742
  const engine = 'AppleWebKit/534.36 (KHTML, like Gecko) NodeJS/v4.1.0 Chrome/76.0.3809.132 Safari/534.36';
3751
3743
  const msg = '(' + machine + '; ' + arch + ') ' + engine;
3752
- const nav = isWebPlatform() ? env.window.navigator : {
3744
+ const nav = process.env.TARO_PLATFORM === 'web' ? env.window.navigator : {
3753
3745
  appCodeName: 'Mozilla',
3754
3746
  appName: 'Netscape',
3755
3747
  appVersion: '5.0 ' + msg,
@@ -3796,88 +3788,83 @@ const _caf = typeof cancelAnimationFrame !== 'undefined' && cancelAnimationFrame
3796
3788
  clearTimeout(seed);
3797
3789
  };
3798
3790
 
3799
- let window$1;
3800
- if (process.env.TARO_ENV && !isWebPlatform()) {
3801
- class Window extends Events {
3802
- constructor() {
3803
- super();
3804
- this.navigator = nav;
3805
- this.requestAnimationFrame = _raf;
3806
- this.cancelAnimationFrame = _caf;
3807
- this.getComputedStyle = getComputedStyle;
3808
- const globalProperties = [
3809
- ...Object.getOwnPropertyNames(global || {}),
3810
- ...Object.getOwnPropertySymbols(global || {})
3811
- ];
3812
- globalProperties.forEach(property => {
3813
- if (property === 'atob' || property === 'document')
3814
- return;
3815
- if (!Object.prototype.hasOwnProperty.call(this, property)) {
3816
- // 防止小程序环境下,window 上的某些 get 属性在赋值时报错
3817
- try {
3818
- this[property] = global[property];
3819
- }
3820
- catch (e) {
3821
- if (process.env.NODE_ENV !== 'production') {
3822
- console.warn(`[Taro warn] window.${String(property)} 在赋值到 window 时报错`);
3823
- }
3791
+ class TaroWindow extends Events {
3792
+ constructor() {
3793
+ super();
3794
+ this.navigator = nav;
3795
+ this.requestAnimationFrame = _raf;
3796
+ this.cancelAnimationFrame = _caf;
3797
+ this.getComputedStyle = getComputedStyle;
3798
+ const globalProperties = [
3799
+ ...Object.getOwnPropertyNames(global || {}),
3800
+ ...Object.getOwnPropertySymbols(global || {})
3801
+ ];
3802
+ globalProperties.forEach(property => {
3803
+ if (property === 'atob' || property === 'document')
3804
+ return;
3805
+ if (!Object.prototype.hasOwnProperty.call(this, property)) {
3806
+ // 防止小程序环境下,window 上的某些 get 属性在赋值时报错
3807
+ try {
3808
+ this[property] = global[property];
3809
+ }
3810
+ catch (e) {
3811
+ if (process.env.NODE_ENV !== 'production') {
3812
+ console.warn(`[Taro warn] window.${String(property)} 在赋值到 window 时报错`);
3824
3813
  }
3825
3814
  }
3826
- });
3827
- this.Date || (this.Date = Date);
3828
- // 应用启动时,提供给需要读取历史信息的库使用
3829
- this.location = new Location({ window: this });
3830
- this.history = new History(this.location, { window: this });
3831
- this.initEvent();
3832
- }
3833
- initEvent() {
3834
- const _location = this.location;
3835
- const _history = this.history;
3836
- this.on(CONTEXT_ACTIONS.INIT, (pageId) => {
3837
- // 页面onload,为该页面建立新的上下文信息
3838
- _location.trigger(CONTEXT_ACTIONS.INIT, pageId);
3839
- }, null);
3840
- this.on(CONTEXT_ACTIONS.RECOVER, (pageId) => {
3841
- // 页面onshow,恢复当前页面的上下文信息
3842
- _location.trigger(CONTEXT_ACTIONS.RECOVER, pageId);
3843
- _history.trigger(CONTEXT_ACTIONS.RECOVER, pageId);
3844
- }, null);
3845
- this.on(CONTEXT_ACTIONS.RESTORE, (pageId) => {
3846
- // 页面onhide,缓存当前页面的上下文信息
3847
- _location.trigger(CONTEXT_ACTIONS.RESTORE, pageId);
3848
- _history.trigger(CONTEXT_ACTIONS.RESTORE, pageId);
3849
- }, null);
3850
- this.on(CONTEXT_ACTIONS.DESTORY, (pageId) => {
3851
- // 页面onunload,清除当前页面的上下文信息
3852
- _location.trigger(CONTEXT_ACTIONS.DESTORY, pageId);
3853
- _history.trigger(CONTEXT_ACTIONS.DESTORY, pageId);
3854
- }, null);
3855
- }
3856
- get document() {
3857
- return env.document;
3858
- }
3859
- addEventListener(event, callback) {
3860
- if (!isString(event))
3861
- return;
3862
- this.on(event, callback, null);
3863
- }
3864
- removeEventListener(event, callback) {
3865
- if (!isString(event))
3866
- return;
3867
- this.off(event, callback, null);
3868
- }
3869
- setTimeout(...args) {
3870
- return setTimeout(...args);
3871
- }
3872
- clearTimeout(...args) {
3873
- return clearTimeout(...args);
3874
- }
3815
+ }
3816
+ });
3817
+ this.Date || (this.Date = Date);
3818
+ // 应用启动时,提供给需要读取历史信息的库使用
3819
+ this.location = new Location({ window: this });
3820
+ // @ts-ignore
3821
+ this.history = new History(this.location, { window: this });
3822
+ this.initEvent();
3823
+ }
3824
+ initEvent() {
3825
+ const _location = this.location;
3826
+ const _history = this.history;
3827
+ this.on(CONTEXT_ACTIONS.INIT, (pageId) => {
3828
+ // 页面onload,为该页面建立新的上下文信息
3829
+ _location.trigger(CONTEXT_ACTIONS.INIT, pageId);
3830
+ }, null);
3831
+ this.on(CONTEXT_ACTIONS.RECOVER, (pageId) => {
3832
+ // 页面onshow,恢复当前页面的上下文信息
3833
+ _location.trigger(CONTEXT_ACTIONS.RECOVER, pageId);
3834
+ _history.trigger(CONTEXT_ACTIONS.RECOVER, pageId);
3835
+ }, null);
3836
+ this.on(CONTEXT_ACTIONS.RESTORE, (pageId) => {
3837
+ // 页面onhide,缓存当前页面的上下文信息
3838
+ _location.trigger(CONTEXT_ACTIONS.RESTORE, pageId);
3839
+ _history.trigger(CONTEXT_ACTIONS.RESTORE, pageId);
3840
+ }, null);
3841
+ this.on(CONTEXT_ACTIONS.DESTORY, (pageId) => {
3842
+ // 页面onunload,清除当前页面的上下文信息
3843
+ _location.trigger(CONTEXT_ACTIONS.DESTORY, pageId);
3844
+ _history.trigger(CONTEXT_ACTIONS.DESTORY, pageId);
3845
+ }, null);
3846
+ }
3847
+ get document() {
3848
+ return env.document;
3849
+ }
3850
+ addEventListener(event, callback) {
3851
+ if (!isString(event))
3852
+ return;
3853
+ this.on(event, callback, null);
3854
+ }
3855
+ removeEventListener(event, callback) {
3856
+ if (!isString(event))
3857
+ return;
3858
+ this.off(event, callback, null);
3859
+ }
3860
+ setTimeout(...args) {
3861
+ return setTimeout(...args);
3862
+ }
3863
+ clearTimeout(...args) {
3864
+ return clearTimeout(...args);
3875
3865
  }
3876
- window$1 = env.window = new Window();
3877
- }
3878
- else {
3879
- window$1 = env.window;
3880
3866
  }
3867
+ const window$1 = process.env.TARO_PLATFORM === 'web' ? env.window : (env.window || new TaroWindow());
3881
3868
  const location = window$1.location;
3882
3869
  const history = window$1.history;
3883
3870
 
@@ -3888,7 +3875,6 @@ class SVGElement extends TaroElement {
3888
3875
  /* eslint-disable dot-notation */
3889
3876
  const instances = new Map();
3890
3877
  const pageId = incrementId();
3891
- const isWeb = isWebPlatform();
3892
3878
  function injectPageInstance(inst, id) {
3893
3879
  hooks.call('mergePageInstance', instances.get(id), inst);
3894
3880
  instances.set(id, inst);
@@ -3931,7 +3917,7 @@ function stringify(obj) {
3931
3917
  }
3932
3918
  function getPath(id, options) {
3933
3919
  const idx = id.indexOf('?');
3934
- if (isWeb) {
3920
+ if (process.env.TARO_PLATFORM === 'web') {
3935
3921
  return `${idx > -1 ? id.substring(0, idx) : id}${stringify((options === null || options === void 0 ? void 0 : options.stamp) ? { stamp: options.stamp } : {})}`;
3936
3922
  }
3937
3923
  else {
@@ -3955,7 +3941,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
3955
3941
  let unmounting = false;
3956
3942
  let prepareMountList = [];
3957
3943
  function setCurrentRouter(page) {
3958
- const router = isWeb ? page.$taroPath : page.route || page.__route__ || page.$taroPath;
3944
+ const router = process.env.TARO_PLATFORM === 'web' ? page.$taroPath : page.route || page.__route__ || page.$taroPath;
3959
3945
  Current.router = {
3960
3946
  params: page.$taroParams,
3961
3947
  path: addLeadingSlash(router),
@@ -3979,7 +3965,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
3979
3965
  // this.$taroPath 是页面唯一标识
3980
3966
  const uniqueOptions = Object.assign({}, options, { $taroTimestamp: Date.now() });
3981
3967
  const $taroPath = this.$taroPath = getPath(id, uniqueOptions);
3982
- if (isWeb) {
3968
+ if (process.env.TARO_PLATFORM === 'web') {
3983
3969
  config.path = $taroPath;
3984
3970
  }
3985
3971
  // this.$taroParams 作为暴露给开发者的页面参数对象,可以被随意修改
@@ -3988,7 +3974,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
3988
3974
  }
3989
3975
  setCurrentRouter(this);
3990
3976
  // 初始化当前页面的上下文信息
3991
- if (!isWeb) {
3977
+ if (process.env.TARO_PLATFORM !== 'web') {
3992
3978
  window$1.trigger(CONTEXT_ACTIONS.INIT, $taroPath);
3993
3979
  }
3994
3980
  const mount = () => {
@@ -3997,7 +3983,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
3997
3983
  ensure(pageElement !== null, '没有找到页面实例。');
3998
3984
  safeExecute($taroPath, ON_LOAD, this.$taroParams);
3999
3985
  loadResolver();
4000
- if (!isWeb) {
3986
+ if (process.env.TARO_PLATFORM !== 'web') {
4001
3987
  pageElement.ctx = this;
4002
3988
  pageElement.performUpdate(true, cb);
4003
3989
  }
@@ -4016,7 +4002,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
4016
4002
  [ONUNLOAD]() {
4017
4003
  const $taroPath = this.$taroPath;
4018
4004
  // 销毁当前页面的上下文信息
4019
- if (!isWeb) {
4005
+ if (process.env.TARO_PLATFORM !== 'web') {
4020
4006
  window$1.trigger(CONTEXT_ACTIONS.DESTORY, $taroPath);
4021
4007
  }
4022
4008
  // 触发onUnload生命周期
@@ -4050,7 +4036,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
4050
4036
  Current.page = this;
4051
4037
  setCurrentRouter(this);
4052
4038
  // 恢复上下文信息
4053
- if (!isWeb) {
4039
+ if (process.env.TARO_PLATFORM !== 'web') {
4054
4040
  window$1.trigger(CONTEXT_ACTIONS.RECOVER, this.$taroPath);
4055
4041
  }
4056
4042
  // 触发生命周期
@@ -4061,7 +4047,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
4061
4047
  },
4062
4048
  [ONHIDE]() {
4063
4049
  // 缓存当前页面上下文信息
4064
- if (!isWeb) {
4050
+ if (process.env.TARO_PLATFORM !== 'web') {
4065
4051
  window$1.trigger(CONTEXT_ACTIONS.RESTORE, this.$taroPath);
4066
4052
  }
4067
4053
  // 设置 Current 的 page 和 router
@@ -4134,7 +4120,7 @@ function createComponentConfig(component, componentName, data) {
4134
4120
  ensure(componentElement !== null, '没有找到组件实例。');
4135
4121
  this.$taroInstances = instances.get(path);
4136
4122
  safeExecute(path, ON_LOAD);
4137
- if (!isWeb) {
4123
+ if (process.env.TARO_PLATFORM !== 'web') {
4138
4124
  componentElement.ctx = this;
4139
4125
  componentElement.performUpdate(true);
4140
4126
  }
@@ -4232,7 +4218,7 @@ const nextTick = (cb, ctx) => {
4232
4218
  var _a, _b, _c;
4233
4219
  const pageElement = env.document.getElementById(path);
4234
4220
  if (pageElement === null || pageElement === void 0 ? void 0 : pageElement.pendingUpdate) {
4235
- if (isWebPlatform()) {
4221
+ if (process.env.TARO_PLATFORM === 'web') {
4236
4222
  // eslint-disable-next-line dot-notation
4237
4223
  (_c = (_b = (_a = pageElement.firstChild) === null || _a === void 0 ? void 0 : _a['componentOnReady']) === null || _b === void 0 ? void 0 : _b.call(_a).then(() => {
4238
4224
  timerFunc();
@@ -4252,5 +4238,5 @@ const nextTick = (cb, ctx) => {
4252
4238
  next();
4253
4239
  };
4254
4240
 
4255
- export { A, APP, BEHAVIORS, BODY, CATCHMOVE, CATCH_VIEW, CHANGE, CLASS, COMMENT, 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, URL, URLSearchParams, VALUE, VIEW, addLeadingSlash, _caf as cancelAnimationFrame, createComponentConfig, createEvent, createPageConfig, createRecursiveComponentConfig, document$1 as document, env, eventCenter, eventHandler, eventSource, getComputedStyle, getCurrentInstance, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, history, hydrate, incrementId, injectPageInstance, isHasExtractProp, location, nav as navigator, nextTick, now, options, parseUrl, removePageInstance, _raf as requestAnimationFrame, safeExecute, stringify, window$1 as window };
4241
+ export { A, APP, BEHAVIORS, BODY, CATCHMOVE, CATCH_VIEW, CHANGE, CLASS, 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, URL, URLSearchParams, VALUE, VIEW, addLeadingSlash, _caf as cancelAnimationFrame, createComponentConfig, createEvent, createPageConfig, createRecursiveComponentConfig, document$1 as document, env, eventCenter, eventHandler, eventSource, getComputedStyle, getCurrentInstance, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, history, hydrate, incrementId, injectPageInstance, isHasExtractProp, location, nav as navigator, nextTick, now, options, parseUrl, removePageInstance, _raf as requestAnimationFrame, safeExecute, stringify, window$1 as window };
4256
4242
  //# sourceMappingURL=runtime.esm.js.map