@tarojs/runtime 3.6.24 → 3.6.26-alpha.1

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;
@@ -78,7 +78,7 @@ interface MiniTextData {
78
78
  }
79
79
  type MiniData = MiniElementData | MiniTextData;
80
80
  type HydratedData = () => MiniData | MiniData[];
81
- type UpdatePayloadValue = string | boolean | HydratedData;
81
+ type UpdatePayloadValue = string | boolean | HydratedData | null;
82
82
  type DataTree = Record<string, UpdatePayloadValue | ReturnType<HydratedData>>;
83
83
  interface UpdatePayload {
84
84
  path: string;
@@ -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, isFunction, getComponentsAlias as getComponentsAlias$1, internalComponents, 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, EventChannel } from '@tarojs/shared';
2
2
  export { Events, hooks } from '@tarojs/shared';
3
3
  import { __classPrivateFieldGet, __classPrivateFieldSet } from 'tslib';
4
4
 
@@ -434,6 +434,7 @@ function hydrate(node) {
434
434
  // 初始化 SPECIAL_NODES
435
435
  SPECIAL_NODES || (SPECIAL_NODES = hooks.call('getSpecialNodes'));
436
436
  const nodeName = node.nodeName;
437
+ let compileModeName = null;
437
438
  if (isText(node)) {
438
439
  return {
439
440
  sid: node.sid,
@@ -465,11 +466,14 @@ function hydrate(node) {
465
466
  propInCamelCase !== COMPILE_MODE) {
466
467
  data[propInCamelCase] = props[prop];
467
468
  }
468
- if (nodeName === VIEW && propInCamelCase === CATCHMOVE && props[prop] !== false) {
469
+ if (process.env.TARO_ENV !== 'swan' &&
470
+ nodeName === VIEW &&
471
+ propInCamelCase === CATCHMOVE &&
472
+ props[prop] !== false) {
469
473
  data["nn" /* Shortcuts.NodeName */] = CATCH_VIEW;
470
474
  }
471
475
  if (propInCamelCase === COMPILE_MODE) {
472
- data["nn" /* Shortcuts.NodeName */] = props[prop];
476
+ compileModeName = props[prop];
473
477
  }
474
478
  }
475
479
  // Children
@@ -493,6 +497,9 @@ function hydrate(node) {
493
497
  }
494
498
  }
495
499
  }
500
+ if (compileModeName !== null) {
501
+ data["nn" /* Shortcuts.NodeName */] = compileModeName;
502
+ }
496
503
  const resData = hooks.call('transferHydrateData', data, node, componentAlias);
497
504
  return resData || data;
498
505
  }
@@ -821,6 +828,8 @@ class TaroNode extends TaroEventTarget {
821
828
  }
822
829
  // Data Structure
823
830
  const index = this.findIndex(child);
831
+ const isLastChild = index === this.childNodes.length - 1;
832
+ const path = child._path;
824
833
  this.childNodes.splice(index, 1);
825
834
  child.parentNode = null;
826
835
  // Set eventSource
@@ -829,7 +838,15 @@ class TaroNode extends TaroEventTarget {
829
838
  }
830
839
  // Serialization
831
840
  if (this._root && doUpdate !== false) {
832
- this.updateChildNodes();
841
+ if (isLastChild) {
842
+ this.enqueueUpdate({
843
+ path,
844
+ value: null
845
+ });
846
+ }
847
+ else {
848
+ this.updateChildNodes();
849
+ }
833
850
  }
834
851
  return child;
835
852
  }
@@ -4067,6 +4084,11 @@ function createPageConfig(component, pageName, data, pageConfig) {
4067
4084
  eventCenter.trigger(getOnHideEventKey(id));
4068
4085
  }
4069
4086
  };
4087
+ if (process.env.TARO_PLATFORM === 'web') {
4088
+ config.getOpenerEventChannel = () => {
4089
+ return EventChannel.pageChannel;
4090
+ };
4091
+ }
4070
4092
  LIFECYCLES.forEach((lifecycle) => {
4071
4093
  let isDefer = false;
4072
4094
  lifecycle = lifecycle.replace(/^defer:/, () => {