@tarojs/runtime 4.0.0-canary.9 → 4.0.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/LICENSE +8 -8
  2. package/dist/bom/URL.d.ts +2 -2
  3. package/dist/bom/URL.js +3 -2
  4. package/dist/bom/URL.js.map +1 -1
  5. package/dist/bom/URLSearchParams.js +12 -4
  6. package/dist/bom/URLSearchParams.js.map +1 -1
  7. package/dist/bom/document.d.ts +2 -2
  8. package/dist/bom/document.js +3 -2
  9. package/dist/bom/document.js.map +1 -1
  10. package/dist/bom/getComputedStyle.d.ts +2 -2
  11. package/dist/bom/getComputedStyle.js +3 -2
  12. package/dist/bom/getComputedStyle.js.map +1 -1
  13. package/dist/bom/history.js.map +1 -1
  14. package/dist/bom/location.js +3 -3
  15. package/dist/bom/location.js.map +1 -1
  16. package/dist/bom/raf.d.ts +1 -0
  17. package/dist/bom/raf.js +2 -2
  18. package/dist/bom/raf.js.map +1 -1
  19. package/dist/bom/window.d.ts +5 -4
  20. package/dist/bom/window.js +7 -6
  21. package/dist/bom/window.js.map +1 -1
  22. package/dist/dom/anchor-element.js.map +1 -1
  23. package/dist/dom/class-list.js.map +1 -1
  24. package/dist/dom/document.js.map +1 -1
  25. package/dist/dom/element.js.map +1 -1
  26. package/dist/dom/event-target.js.map +1 -1
  27. package/dist/dom/event.js +5 -4
  28. package/dist/dom/event.js.map +1 -1
  29. package/dist/dom/form.js +1 -1
  30. package/dist/dom/form.js.map +1 -1
  31. package/dist/dom/node.js +2 -2
  32. package/dist/dom/node.js.map +1 -1
  33. package/dist/dom/root.js.map +1 -1
  34. package/dist/dom/style.js.map +1 -1
  35. package/dist/dom/style_properties.js.map +1 -1
  36. package/dist/dom/tree.js.map +1 -1
  37. package/dist/dom-external/element.js.map +1 -1
  38. package/dist/dom-external/index.js +1 -3
  39. package/dist/dom-external/index.js.map +1 -1
  40. package/dist/dom-external/inner-html/html.js.map +1 -1
  41. package/dist/dom-external/inner-html/parser.js.map +1 -1
  42. package/dist/dom-external/inner-html/scaner.js.map +1 -1
  43. package/dist/dom-external/inner-html/style.js.map +1 -1
  44. package/dist/dom-external/inner-html/tags.js +4 -4
  45. package/dist/dom-external/inner-html/tags.js.map +1 -1
  46. package/dist/dom-external/inner-html/utils.js.map +1 -1
  47. package/dist/dom-external/mutation-observer/implements.js.map +1 -1
  48. package/dist/dom-external/mutation-observer/index.js.map +1 -1
  49. package/dist/dom-external/node.js +1 -0
  50. package/dist/dom-external/node.js.map +1 -1
  51. package/dist/dsl/common.d.ts +1 -0
  52. package/dist/dsl/common.js +11 -6
  53. package/dist/dsl/common.js.map +1 -1
  54. package/dist/hydrate.js +9 -2
  55. package/dist/hydrate.js.map +1 -1
  56. package/dist/index.cjs.d.ts +27 -20
  57. package/dist/index.cjs.js +101 -49
  58. package/dist/index.cjs.js.map +1 -1
  59. package/dist/index.d.ts +5 -4
  60. package/dist/index.js +6 -5
  61. package/dist/index.js.map +1 -1
  62. package/dist/instance-4c64b022.d.ts +7 -14
  63. package/dist/next-tick.js.map +1 -1
  64. package/dist/perf.d.ts +3 -1
  65. package/dist/perf.js +24 -3
  66. package/dist/perf.js.map +1 -1
  67. package/dist/polyfill/array.js.map +1 -1
  68. package/dist/polyfill/index.js.map +1 -1
  69. package/dist/polyfill/intersection-observer.js +4 -3
  70. package/dist/polyfill/intersection-observer.js.map +1 -1
  71. package/dist/polyfill/object.js.map +1 -1
  72. package/dist/runtime.esm.d.ts +27 -20
  73. package/dist/runtime.esm.js +93 -43
  74. package/dist/runtime.esm.js.map +1 -1
  75. package/dist/utils/cache.js.map +1 -1
  76. package/dist/utils/index.js.map +1 -1
  77. package/dist/utils/lodash.d.ts +2 -1
  78. package/dist/utils/lodash.js +11 -1
  79. package/dist/utils/lodash.js.map +1 -1
  80. package/dist/utils/router.js +3 -3
  81. package/dist/utils/router.js.map +1 -1
  82. package/package.json +15 -23
package/dist/index.cjs.js CHANGED
@@ -219,6 +219,16 @@ function throttle(fn, threshold = 250, scope) {
219
219
  }
220
220
  };
221
221
  }
222
+ function debounce(fn, ms = 250, scope) {
223
+ let timer;
224
+ return function (...args) {
225
+ const context = scope || this;
226
+ clearTimeout(timer);
227
+ timer = setTimeout(function () {
228
+ fn.apply(context, args);
229
+ }, ms);
230
+ };
231
+ }
222
232
 
223
233
  const eventCenter = shared.hooks.call('getEventCenter', shared.Events);
224
234
 
@@ -227,7 +237,8 @@ const env = {
227
237
  document: process.env.TARO_PLATFORM === 'web' ? document : shared.EMPTY_OBJ
228
238
  };
229
239
 
230
- const getComputedStyle = process.env.TARO_PLATFORM === 'web' ? env.window.getComputedStyle : function (element) {
240
+ // Note: 小程序端 vite 打包成 commonjs,const getComputedStyle = xxx 会报错,所以把 GetComputedStyle 改为 taroGetComputedStyleProvider
241
+ const taroGetComputedStyleProvider = process.env.TARO_PLATFORM === 'web' ? env.window.getComputedStyle : function (element) {
231
242
  return element.style;
232
243
  };
233
244
 
@@ -418,11 +429,19 @@ const URLSearchParams = process.env.TARO_PLATFORM === 'web' ? env.window.URLSear
418
429
  for (let pairs = query.split('&'), i = 0, length = pairs.length; i < length; i++) {
419
430
  const value = pairs[i];
420
431
  const index = value.indexOf('=');
421
- if (index > -1) {
422
- appendTo(dict, decode(value.slice(0, index)), decode(value.slice(index + 1)));
432
+ // 针对不规范的 url 参数做容错处理,如:word=你%好
433
+ try {
434
+ if (index > -1) {
435
+ appendTo(dict, decode(value.slice(0, index)), decode(value.slice(index + 1)));
436
+ }
437
+ else if (value.length) {
438
+ appendTo(dict, decode(value), '');
439
+ }
423
440
  }
424
- else if (value.length) {
425
- appendTo(dict, decode(value), '');
441
+ catch (err) {
442
+ if (process.env.NODE_ENV !== 'production') {
443
+ console.warn(`[Taro warn] URL 参数 ${value} decode 异常`);
444
+ }
426
445
  }
427
446
  }
428
447
  }
@@ -641,7 +660,8 @@ class TaroURL {
641
660
  }
642
661
  }
643
662
  _TaroURL_hash = new WeakMap(), _TaroURL_hostname = new WeakMap(), _TaroURL_pathname = new WeakMap(), _TaroURL_port = new WeakMap(), _TaroURL_protocol = new WeakMap(), _TaroURL_search = new WeakMap();
644
- const URL = process.env.TARO_PLATFORM === 'web' ? env.window.URL : TaroURL;
663
+ // Note: 小程序端 vite 打包成 commonjs,const URL = xxx 会报错,所以把 URL 改为 TaroURLProvider
664
+ const TaroURLProvider = process.env.TARO_PLATFORM === 'web' ? env.window.URL : TaroURL;
645
665
  function parseUrl(url = '') {
646
666
  const result = {
647
667
  href: '',
@@ -714,7 +734,7 @@ class TaroLocation extends shared.Events {
714
734
  super();
715
735
  _TaroLocation_instances.add(this);
716
736
  /* private property */
717
- _TaroLocation_url.set(this, new URL(INIT_URL));
737
+ _TaroLocation_url.set(this, new TaroURLProvider(INIT_URL));
718
738
  _TaroLocation_noCheckUrl.set(this, false);
719
739
  _TaroLocation_window.set(this, void 0);
720
740
  tslib.__classPrivateFieldSet(this, _TaroLocation_window, options.window, "f");
@@ -891,7 +911,7 @@ _TaroLocation_url = new WeakMap(), _TaroLocation_noCheckUrl = new WeakMap(), _Ta
891
911
  });
892
912
  const searchStr = searchArr.length > 0 ? '?' + searchArr.join('&') : '';
893
913
  const url = `${INIT_URL}${path.startsWith('/') ? path : '/' + path}${searchStr}`;
894
- tslib.__classPrivateFieldSet(this, _TaroLocation_url, new URL(url), "f");
914
+ tslib.__classPrivateFieldSet(this, _TaroLocation_url, new TaroURLProvider(url), "f");
895
915
  this.trigger('__reset_history__', this.href);
896
916
  }
897
917
  }, _TaroLocation_getPreValue = function _TaroLocation_getPreValue() {
@@ -974,12 +994,12 @@ exports.now = void 0;
974
994
  let lastTime = 0;
975
995
  // https://gist.github.com/paulirish/1579671
976
996
  // https://gist.github.com/jalbam/5fe05443270fa6d8136238ec72accbc0
977
- const _raf = typeof requestAnimationFrame !== 'undefined' && requestAnimationFrame !== null ? requestAnimationFrame : function (callback) {
997
+ const _raf = process.env.TARO_PLATFORM === 'web' ? requestAnimationFrame : function (callback) {
978
998
  const _now = exports.now();
979
999
  const nextTime = Math.max(lastTime + 16, _now); // First time will execute it immediately but barely noticeable and performance is gained.
980
1000
  return setTimeout(function () { callback(lastTime = nextTime); }, nextTime - _now);
981
1001
  };
982
- const _caf = typeof cancelAnimationFrame !== 'undefined' && cancelAnimationFrame !== null
1002
+ const _caf = process.env.TARO_PLATFORM === 'web'
983
1003
  ? cancelAnimationFrame
984
1004
  : function (seed) {
985
1005
  // fix https://github.com/NervJS/taro/issues/7749
@@ -992,7 +1012,7 @@ class TaroWindow extends shared.Events {
992
1012
  this.navigator = nav;
993
1013
  this.requestAnimationFrame = _raf;
994
1014
  this.cancelAnimationFrame = _caf;
995
- this.getComputedStyle = getComputedStyle;
1015
+ this.getComputedStyle = taroGetComputedStyleProvider;
996
1016
  const globalProperties = [
997
1017
  ...Object.getOwnPropertyNames(global || {}),
998
1018
  ...Object.getOwnPropertySymbols(global || {})
@@ -1062,9 +1082,10 @@ class TaroWindow extends shared.Events {
1062
1082
  return clearTimeout(...args);
1063
1083
  }
1064
1084
  }
1065
- const window$1 = process.env.TARO_PLATFORM === 'web' ? env.window : (env.window = new TaroWindow());
1066
- const location = window$1.location;
1067
- const history = window$1.history;
1085
+ // Note: 小程序端 vite 打包成 commonjs,const window = xxx 会报错,所以把 window 改为 taroWindowProvider,location history 同理
1086
+ const taroWindowProvider = process.env.TARO_PLATFORM === 'web' ? env.window : (env.window = new TaroWindow());
1087
+ const taroLocationProvider = taroWindowProvider.location;
1088
+ const taroHistoryProvider = taroWindowProvider.history;
1068
1089
 
1069
1090
  // export const removeLeadingSlash = (str = '') => str.replace(/^\.?\//, '')
1070
1091
  // export const removeTrailingSearch = (str = '') => str.replace(/\?[\s\S]*$/, '')
@@ -1081,8 +1102,8 @@ const getHomePage = (path = '', basename = '', customRoutes = {}, entryPagePath
1081
1102
  };
1082
1103
  const getCurrentPage = (routerMode = 'hash', basename = '/') => {
1083
1104
  const pagePath = routerMode === 'hash'
1084
- ? location.hash.slice(1).split('?')[0]
1085
- : location.pathname;
1105
+ ? taroLocationProvider.hash.slice(1).split('?')[0]
1106
+ : taroLocationProvider.pathname;
1086
1107
  return addLeadingSlash(stripBasename(pagePath, basename));
1087
1108
  };
1088
1109
 
@@ -1299,6 +1320,7 @@ function hydrate(node) {
1299
1320
  // 初始化 SPECIAL_NODES
1300
1321
  SPECIAL_NODES || (SPECIAL_NODES = shared.hooks.call('getSpecialNodes'));
1301
1322
  const nodeName = node.nodeName;
1323
+ let compileModeName = null;
1302
1324
  if (isText(node)) {
1303
1325
  return {
1304
1326
  sid: node.sid,
@@ -1330,11 +1352,14 @@ function hydrate(node) {
1330
1352
  propInCamelCase !== COMPILE_MODE) {
1331
1353
  data[propInCamelCase] = props[prop];
1332
1354
  }
1333
- if (nodeName === VIEW && propInCamelCase === CATCHMOVE && props[prop] !== false) {
1355
+ if (process.env.TARO_ENV !== 'swan' &&
1356
+ nodeName === VIEW &&
1357
+ propInCamelCase === CATCHMOVE &&
1358
+ props[prop] !== false) {
1334
1359
  data["nn" /* Shortcuts.NodeName */] = CATCH_VIEW;
1335
1360
  }
1336
1361
  if (propInCamelCase === COMPILE_MODE) {
1337
- data["nn" /* Shortcuts.NodeName */] = props[prop];
1362
+ compileModeName = props[prop];
1338
1363
  }
1339
1364
  }
1340
1365
  // Children
@@ -1358,6 +1383,9 @@ function hydrate(node) {
1358
1383
  }
1359
1384
  }
1360
1385
  }
1386
+ if (compileModeName !== null) {
1387
+ data["nn" /* Shortcuts.NodeName */] = compileModeName;
1388
+ }
1361
1389
  const resData = shared.hooks.call('transferHydrateData', data, node, componentAlias);
1362
1390
  return resData || data;
1363
1391
  }
@@ -1629,7 +1657,7 @@ class TaroNode extends TaroEventTarget {
1629
1657
  : [],
1630
1658
  nextSibling: isReplace
1631
1659
  ? refChild.nextSibling /** replaceChild */
1632
- : (refChild || null),
1660
+ : (refChild || null), /** insertBefore & appendChild */
1633
1661
  previousSibling: newChild.previousSibling
1634
1662
  });
1635
1663
  return newChild;
@@ -2953,7 +2981,7 @@ function makeMap(str, expectsLowerCase) {
2953
2981
  for (let i = 0; i < list.length; i++) {
2954
2982
  map[list[i]] = true;
2955
2983
  }
2956
- return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];
2984
+ return val => !!map[val.toLowerCase()] ;
2957
2985
  }
2958
2986
  const specialMiniElements = {
2959
2987
  img: 'image',
@@ -2963,11 +2991,11 @@ const internalCompsList = Object.keys(shared.internalComponents)
2963
2991
  .map(i => i.toLowerCase())
2964
2992
  .join(',');
2965
2993
  // https://developers.weixin.qq.com/miniprogram/dev/component
2966
- const isMiniElements = makeMap(internalCompsList, true);
2994
+ const isMiniElements = makeMap(internalCompsList);
2967
2995
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements
2968
- const isInlineElements = makeMap('a,i,abbr,iframe,select,acronym,slot,small,span,bdi,kbd,strong,big,map,sub,sup,br,mark,mark,meter,template,canvas,textarea,cite,object,time,code,output,u,data,picture,tt,datalist,var,dfn,del,q,em,s,embed,samp,b', true);
2996
+ const isInlineElements = makeMap('a,i,abbr,iframe,select,acronym,slot,small,span,bdi,kbd,strong,big,map,sub,sup,br,mark,mark,meter,template,canvas,textarea,cite,object,time,code,output,u,data,picture,tt,datalist,var,dfn,del,q,em,s,embed,samp,b');
2969
2997
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements
2970
- const isBlockElements = makeMap('address,fieldset,li,article,figcaption,main,aside,figure,nav,blockquote,footer,ol,details,form,p,dialog,h1,h2,h3,h4,h5,h6,pre,dd,header,section,div,hgroup,table,dl,hr,ul,dt', true);
2998
+ const isBlockElements = makeMap('address,fieldset,li,article,figcaption,main,aside,figure,nav,blockquote,footer,ol,details,form,p,dialog,h1,h2,h3,h4,h5,h6,pre,dd,header,section,div,hgroup,table,dl,hr,ul,dt');
2971
2999
 
2972
3000
  const closingTagAncestorBreakers = {
2973
3001
  li: ['ul', 'ol', 'menu'],
@@ -3264,6 +3292,7 @@ function cloneNode(isDeep = false) {
3264
3292
  }
3265
3293
  for (const key in this) {
3266
3294
  const value = this[key];
3295
+ // eslint-disable-next-line valid-typeof
3267
3296
  if ([PROPS, DATASET].includes(key) && typeof value === OBJECT) {
3268
3297
  newNode[key] = Object.assign({}, value);
3269
3298
  }
@@ -3292,9 +3321,7 @@ function contains(node) {
3292
3321
  return isContains;
3293
3322
  }
3294
3323
 
3295
- const isWeb = process.env.TARO_PLATFORM === 'web';
3296
- const isHarmony = process.env.TARO_PLATFORM === 'harmony' || process.env.TARO_ENV === 'harmony';
3297
- if (!isWeb && !isHarmony) {
3324
+ if (process.env.TARO_PLATFORM !== 'web' && !(process.env.TARO_PLATFORM === 'harmony' || process.env.TARO_ENV === 'harmony')) {
3298
3325
  if (ENABLE_INNER_HTML) {
3299
3326
  TaroNode.extend('innerHTML', {
3300
3327
  set(html) {
@@ -3352,14 +3379,15 @@ class TaroEvent {
3352
3379
  this.defaultPrevented = true;
3353
3380
  }
3354
3381
  get target() {
3355
- var _a, _b, _c, _d;
3382
+ var _a, _b, _c, _d, _e;
3356
3383
  const cacheTarget = this.cacheTarget;
3357
3384
  if (!cacheTarget) {
3358
3385
  const target = Object.create(((_a = this.mpEvent) === null || _a === void 0 ? void 0 : _a.target) || null);
3386
+ const currentEle = env.document.getElementById(((_b = target.dataset) === null || _b === void 0 ? void 0 : _b.sid) || target.id || null);
3359
3387
  // Note:优先判断冒泡场景alipay的targetDataset的sid, 不然冒泡场景target属性吐出不对,其余拿取当前绑定id
3360
- const element = env.document.getElementById(((_b = target.targetDataset) === null || _b === void 0 ? void 0 : _b.sid) || ((_c = target.dataset) === null || _c === void 0 ? void 0 : _c.sid) || target.id || null);
3361
- target.dataset = element !== null ? element.dataset : shared.EMPTY_OBJ;
3362
- for (const key in (_d = this.mpEvent) === null || _d === void 0 ? void 0 : _d.detail) {
3388
+ const element = env.document.getElementById(((_c = target.targetDataset) === null || _c === void 0 ? void 0 : _c.sid) || ((_d = target.dataset) === null || _d === void 0 ? void 0 : _d.sid) || target.id || null);
3389
+ target.dataset = Object.assign(Object.assign({}, (currentEle !== null ? currentEle.dataset : shared.EMPTY_OBJ)), (element !== null ? element.dataset : shared.EMPTY_OBJ));
3390
+ for (const key in (_e = this.mpEvent) === null || _e === void 0 ? void 0 : _e.detail) {
3363
3391
  target[key] = this.mpEvent.detail[key];
3364
3392
  }
3365
3393
  this.cacheTarget = target;
@@ -3495,7 +3523,7 @@ class FormElement extends TaroElement {
3495
3523
  else if (event.type === INPUT) {
3496
3524
  // Web 规范中表单组件的 value 应该跟着输入改变
3497
3525
  // 只是改 this.props.value 的话不会进行 setData,因此这里修改 this.value。
3498
- // 只测试了 React、Vue、Vue3 input 组件的 onInput 事件,onChange 事件不确定有没有副作用,所以暂不修改。
3526
+ // 只测试了 React、Vue3 input 组件的 onInput 事件,onChange 事件不确定有没有副作用,所以暂不修改。
3499
3527
  this.value = val;
3500
3528
  }
3501
3529
  }
@@ -3503,8 +3531,10 @@ class FormElement extends TaroElement {
3503
3531
  }
3504
3532
  }
3505
3533
 
3534
+ var _Performance_instances, _Performance_parseTime;
3506
3535
  class Performance {
3507
3536
  constructor() {
3537
+ _Performance_instances.add(this);
3508
3538
  this.recorder = new Map();
3509
3539
  }
3510
3540
  start(id) {
@@ -3513,18 +3543,32 @@ class Performance {
3513
3543
  }
3514
3544
  this.recorder.set(id, Date.now());
3515
3545
  }
3516
- stop(id) {
3546
+ stop(id, now = Date.now()) {
3517
3547
  if (!options.debug) {
3518
3548
  return;
3519
3549
  }
3520
- const now = Date.now();
3521
3550
  const prev = this.recorder.get(id);
3551
+ if (!(prev >= 0))
3552
+ return;
3522
3553
  this.recorder.delete(id);
3523
3554
  const time = now - prev;
3524
3555
  // eslint-disable-next-line no-console
3525
- console.log(`${id} 时长: ${time}ms`);
3556
+ console.log(`${id} 时长: ${time}ms 开始时间:${tslib.__classPrivateFieldGet(this, _Performance_instances, "m", _Performance_parseTime).call(this, prev)} 结束时间:${tslib.__classPrivateFieldGet(this, _Performance_instances, "m", _Performance_parseTime).call(this, now)}`);
3557
+ }
3558
+ delayStop(id, delay = 500) {
3559
+ if (!options.debug) {
3560
+ return;
3561
+ }
3562
+ return debounce((now = Date.now(), cb) => {
3563
+ this.stop(id, now);
3564
+ cb === null || cb === void 0 ? void 0 : cb();
3565
+ }, delay);
3526
3566
  }
3527
3567
  }
3568
+ _Performance_instances = new WeakSet(), _Performance_parseTime = function _Performance_parseTime(time) {
3569
+ const d = new Date(time);
3570
+ return `${d.getHours()}:${d.getMinutes()}:${d.getSeconds()}.${`${d.getMilliseconds()}`.padStart(3, '0')}`;
3571
+ };
3528
3572
  const perf = new Performance();
3529
3573
 
3530
3574
  function findCustomWrapper(root, dataPathArr) {
@@ -3880,7 +3924,8 @@ function createDocument() {
3880
3924
  doc.body = body;
3881
3925
  return doc;
3882
3926
  }
3883
- const document$1 = process.env.TARO_PLATFORM === 'web' ? env.document : (env.document = createDocument());
3927
+ // Note: 小程序端 vite 打包成 commonjs,const document = xxx 会报错,所以把 document 改为 taroDocumentProvider
3928
+ const taroDocumentProvider = process.env.TARO_PLATFORM === 'web' ? env.document : (env.document = createDocument());
3884
3929
 
3885
3930
  // for Vue3
3886
3931
  class SVGElement extends TaroElement {
@@ -3983,7 +4028,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
3983
4028
  setCurrentRouter(this);
3984
4029
  // 初始化当前页面的上下文信息
3985
4030
  if (process.env.TARO_PLATFORM !== 'web') {
3986
- window$1.trigger(exports.CONTEXT_ACTIONS.INIT, $taroPath);
4031
+ taroWindowProvider.trigger(exports.CONTEXT_ACTIONS.INIT, $taroPath);
3987
4032
  }
3988
4033
  const mount = () => {
3989
4034
  Current.app.mount(component, $taroPath, () => {
@@ -4011,7 +4056,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
4011
4056
  const $taroPath = this.$taroPath;
4012
4057
  // 销毁当前页面的上下文信息
4013
4058
  if (process.env.TARO_PLATFORM !== 'web') {
4014
- window$1.trigger(exports.CONTEXT_ACTIONS.DESTORY, $taroPath);
4059
+ taroWindowProvider.trigger(exports.CONTEXT_ACTIONS.DESTORY, $taroPath);
4015
4060
  }
4016
4061
  // 触发onUnload生命周期
4017
4062
  safeExecute($taroPath, ONUNLOAD);
@@ -4045,7 +4090,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
4045
4090
  setCurrentRouter(this);
4046
4091
  // 恢复上下文信息
4047
4092
  if (process.env.TARO_PLATFORM !== 'web') {
4048
- window$1.trigger(exports.CONTEXT_ACTIONS.RECOVER, this.$taroPath);
4093
+ taroWindowProvider.trigger(exports.CONTEXT_ACTIONS.RECOVER, this.$taroPath);
4049
4094
  }
4050
4095
  // 触发生命周期
4051
4096
  safeExecute(this.$taroPath, ON_SHOW, options);
@@ -4056,7 +4101,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
4056
4101
  [ONHIDE]() {
4057
4102
  // 缓存当前页面上下文信息
4058
4103
  if (process.env.TARO_PLATFORM !== 'web') {
4059
- window$1.trigger(exports.CONTEXT_ACTIONS.RESTORE, this.$taroPath);
4104
+ taroWindowProvider.trigger(exports.CONTEXT_ACTIONS.RESTORE, this.$taroPath);
4060
4105
  }
4061
4106
  // 设置 Current 的 page 和 router
4062
4107
  if (Current.page === this) {
@@ -4069,6 +4114,11 @@ function createPageConfig(component, pageName, data, pageConfig) {
4069
4114
  eventCenter.trigger(getOnHideEventKey(id));
4070
4115
  }
4071
4116
  };
4117
+ if (process.env.TARO_PLATFORM === 'web') {
4118
+ config.getOpenerEventChannel = () => {
4119
+ return shared.EventChannel.pageChannel;
4120
+ };
4121
+ }
4072
4122
  LIFECYCLES.forEach((lifecycle) => {
4073
4123
  let isDefer = false;
4074
4124
  lifecycle = lifecycle.replace(/^defer:/, () => {
@@ -4763,7 +4813,7 @@ function handleIntersectionObserverObjectPolyfill() {
4763
4813
  */
4764
4814
  function addEvent(node, event, fn, opt_useCapture) {
4765
4815
  if (shared.isFunction(node.addEventListener)) {
4766
- node.addEventListener(event, fn, opt_useCapture || false);
4816
+ node.addEventListener(event, fn, opt_useCapture );
4767
4817
  }
4768
4818
  else if (shared.isFunction(node.attachEvent)) {
4769
4819
  node.attachEvent('on' + event, fn);
@@ -4779,7 +4829,7 @@ function handleIntersectionObserverObjectPolyfill() {
4779
4829
  */
4780
4830
  function removeEvent(node, event, fn, opt_useCapture) {
4781
4831
  if (shared.isFunction(node.removeEventListener)) {
4782
- node.removeEventListener(event, fn, opt_useCapture || false);
4832
+ node.removeEventListener(event, fn, opt_useCapture );
4783
4833
  }
4784
4834
  else if (shared.isFunction(node.detatchEvent)) {
4785
4835
  node.detatchEvent('on' + event, fn);
@@ -5016,11 +5066,11 @@ if (process.env.SUPPORT_TARO_POLYFILL !== 'disabled' && process.env.TARO_PLATFOR
5016
5066
  handlePolyfill();
5017
5067
  }
5018
5068
 
5019
- Object.defineProperty(exports, 'Events', {
5069
+ Object.defineProperty(exports, "Events", {
5020
5070
  enumerable: true,
5021
5071
  get: function () { return shared.Events; }
5022
5072
  });
5023
- Object.defineProperty(exports, 'hooks', {
5073
+ Object.defineProperty(exports, "hooks", {
5024
5074
  enumerable: true,
5025
5075
  get: function () { return shared.hooks; }
5026
5076
  });
@@ -5084,7 +5134,7 @@ exports.TaroNode = TaroNode;
5084
5134
  exports.TaroRootElement = TaroRootElement;
5085
5135
  exports.TaroText = TaroText;
5086
5136
  exports.UID = UID;
5087
- exports.URL = URL;
5137
+ exports.URL = TaroURLProvider;
5088
5138
  exports.URLSearchParams = URLSearchParams;
5089
5139
  exports.VALUE = VALUE;
5090
5140
  exports.VIEW = VIEW;
@@ -5096,14 +5146,15 @@ exports.createEvent = createEvent;
5096
5146
  exports.createPageConfig = createPageConfig;
5097
5147
  exports.createRecursiveComponentConfig = createRecursiveComponentConfig;
5098
5148
  exports.customWrapperCache = customWrapperCache;
5099
- exports.document = document$1;
5149
+ exports.debounce = debounce;
5150
+ exports.document = taroDocumentProvider;
5100
5151
  exports.env = env;
5101
5152
  exports.eventCenter = eventCenter;
5102
5153
  exports.eventHandler = eventHandler;
5103
5154
  exports.eventSource = eventSource;
5104
5155
  exports.extend = extend;
5105
5156
  exports.getComponentsAlias = getComponentsAlias;
5106
- exports.getComputedStyle = getComputedStyle;
5157
+ exports.getComputedStyle = taroGetComputedStyleProvider;
5107
5158
  exports.getCurrentInstance = getCurrentInstance;
5108
5159
  exports.getCurrentPage = getCurrentPage;
5109
5160
  exports.getHomePage = getHomePage;
@@ -5114,7 +5165,7 @@ exports.getPageInstance = getPageInstance;
5114
5165
  exports.getPath = getPath;
5115
5166
  exports.handlePolyfill = handlePolyfill;
5116
5167
  exports.hasBasename = hasBasename;
5117
- exports.history = history;
5168
+ exports.history = taroHistoryProvider;
5118
5169
  exports.hydrate = hydrate;
5119
5170
  exports.incrementId = incrementId;
5120
5171
  exports.injectPageInstance = injectPageInstance;
@@ -5123,11 +5174,12 @@ exports.isElement = isElement;
5123
5174
  exports.isHasExtractProp = isHasExtractProp;
5124
5175
  exports.isParentBinded = isParentBinded;
5125
5176
  exports.isText = isText;
5126
- exports.location = location;
5177
+ exports.location = taroLocationProvider;
5127
5178
  exports.navigator = nav;
5128
5179
  exports.nextTick = nextTick;
5129
5180
  exports.options = options;
5130
5181
  exports.parseUrl = parseUrl;
5182
+ exports.perf = perf;
5131
5183
  exports.removePageInstance = removePageInstance;
5132
5184
  exports.requestAnimationFrame = _raf;
5133
5185
  exports.safeExecute = safeExecute;
@@ -5137,5 +5189,5 @@ exports.stripBasename = stripBasename;
5137
5189
  exports.stripSuffix = stripSuffix;
5138
5190
  exports.stripTrailing = stripTrailing;
5139
5191
  exports.throttle = throttle;
5140
- exports.window = window$1;
5192
+ exports.window = taroWindowProvider;
5141
5193
  //# sourceMappingURL=index.cjs.js.map