@tarojs/runtime 4.0.0-beta.60 → 4.0.0-beta.62

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.
@@ -69,6 +69,8 @@ interface PageInstance extends PageLifeCycle {
69
69
  options?: Record<string, unknown>;
70
70
  /** 页面渲染引擎类型 */
71
71
  renderer?: 'webview' | 'skyline';
72
+ /** 获得一个 EventChannel 对象,用于页面间通讯 */
73
+ getOpenerEventChannel?(): Record<string, any>;
72
74
  }
73
75
  interface Show {
74
76
  componentDidShow?(): void;
@@ -706,6 +706,8 @@ interface PageInstance extends PageLifeCycle {
706
706
  options?: Record<string, unknown>;
707
707
  /** 页面渲染引擎类型 */
708
708
  renderer?: "webview" | "skyline";
709
+ /** 获得一个 EventChannel 对象,用于页面间通讯 */
710
+ getOpenerEventChannel?(): Record<string, any>;
709
711
  }
710
712
  interface Show {
711
713
  componentDidShow?(): void;
@@ -1,4 +1,4 @@
1
- import { noop, hooks, Events, EMPTY_OBJ, isNumber, isString, isArray, isUndefined, warn, isFunction, getComponentsAlias as getComponentsAlias$1, internalComponents, toCamelCase, isObject, ensure, isNull, toDashed, controlledComponent } from '@tarojs/shared';
1
+ import { noop, hooks, Events, EMPTY_OBJ, isNumber, isString, isArray, isUndefined, warn, isFunction, getComponentsAlias as getComponentsAlias$1, internalComponents, toCamelCase, isObject, ensure, isNull, toDashed, controlledComponent, EventChannel } from '@tarojs/shared';
2
2
  export { Events, hooks } from '@tarojs/shared';
3
3
  import { __classPrivateFieldSet, __classPrivateFieldGet } from 'tslib';
4
4
 
@@ -1308,6 +1308,7 @@ function hydrate(node) {
1308
1308
  // 初始化 SPECIAL_NODES
1309
1309
  SPECIAL_NODES || (SPECIAL_NODES = hooks.call('getSpecialNodes'));
1310
1310
  const nodeName = node.nodeName;
1311
+ let compileModeName = null;
1311
1312
  if (isText(node)) {
1312
1313
  return {
1313
1314
  sid: node.sid,
@@ -1339,11 +1340,14 @@ function hydrate(node) {
1339
1340
  propInCamelCase !== COMPILE_MODE) {
1340
1341
  data[propInCamelCase] = props[prop];
1341
1342
  }
1342
- if (nodeName === VIEW && propInCamelCase === CATCHMOVE && props[prop] !== false) {
1343
+ if (process.env.TARO_ENV !== 'swan' &&
1344
+ nodeName === VIEW &&
1345
+ propInCamelCase === CATCHMOVE &&
1346
+ props[prop] !== false) {
1343
1347
  data["nn" /* Shortcuts.NodeName */] = CATCH_VIEW;
1344
1348
  }
1345
1349
  if (propInCamelCase === COMPILE_MODE) {
1346
- data["nn" /* Shortcuts.NodeName */] = props[prop];
1350
+ compileModeName = props[prop];
1347
1351
  }
1348
1352
  }
1349
1353
  // Children
@@ -1367,6 +1371,9 @@ function hydrate(node) {
1367
1371
  }
1368
1372
  }
1369
1373
  }
1374
+ if (compileModeName !== null) {
1375
+ data["nn" /* Shortcuts.NodeName */] = compileModeName;
1376
+ }
1370
1377
  const resData = hooks.call('transferHydrateData', data, node, componentAlias);
1371
1378
  return resData || data;
1372
1379
  }
@@ -3273,6 +3280,7 @@ function cloneNode(isDeep = false) {
3273
3280
  }
3274
3281
  for (const key in this) {
3275
3282
  const value = this[key];
3283
+ // eslint-disable-next-line valid-typeof
3276
3284
  if ([PROPS, DATASET].includes(key) && typeof value === OBJECT) {
3277
3285
  newNode[key] = Object.assign({}, value);
3278
3286
  }
@@ -4094,6 +4102,11 @@ function createPageConfig(component, pageName, data, pageConfig) {
4094
4102
  eventCenter.trigger(getOnHideEventKey(id));
4095
4103
  }
4096
4104
  };
4105
+ if (process.env.TARO_PLATFORM === 'web') {
4106
+ config.getOpenerEventChannel = () => {
4107
+ return EventChannel.pageChannel;
4108
+ };
4109
+ }
4097
4110
  LIFECYCLES.forEach((lifecycle) => {
4098
4111
  let isDefer = false;
4099
4112
  lifecycle = lifecycle.replace(/^defer:/, () => {