@micro-zoe/micro-app 1.0.0-rc.21 → 1.0.0-rc.22

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.
package/lib/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- const version = '1.0.0-rc.21';
1
+ const version = '1.0.0-rc.22';
2
2
  // do not use isUndefined
3
3
  const isBrowser = typeof window !== 'undefined';
4
4
  // do not use isUndefined
@@ -1682,6 +1682,8 @@ const BASE_SCOPE_WINDOW_EVENT = [
1682
1682
  'appstate-change',
1683
1683
  'statechange',
1684
1684
  'mounted',
1685
+ 'error'
1686
+ // 'beforeunload', // remove at 2024.5.30 by cangdu
1685
1687
  ];
1686
1688
  // bind event of with sandbox
1687
1689
  const SCOPE_WINDOW_EVENT_OF_WITH = BASE_SCOPE_WINDOW_EVENT;
@@ -6012,9 +6014,9 @@ function patchDocumentPrototype(appName, microAppWindow) {
6012
6014
  }
6013
6015
  // query element👇
6014
6016
  function querySelector(selectors) {
6015
- var _a;
6017
+ var _a, _b;
6016
6018
  const _this = getBindTarget(this);
6017
- if (selectors === 'body') {
6019
+ if (selectors === 'body' && ((_a = microApp === null || microApp === void 0 ? void 0 : microApp.options) === null || _a === void 0 ? void 0 : _a.inheritBaseBody) !== true) {
6018
6020
  return this.body;
6019
6021
  }
6020
6022
  if (!selectors ||
@@ -6033,7 +6035,7 @@ function patchDocumentPrototype(appName, microAppWindow) {
6033
6035
  *
6034
6036
  * Issue: https://github.com/jd-opensource/micro-app/issues/1335
6035
6037
  */
6036
- const result = (_a = appInstanceMap.get(appName)) === null || _a === void 0 ? void 0 : _a.querySelector(selectors);
6038
+ const result = (_b = appInstanceMap.get(appName)) === null || _b === void 0 ? void 0 : _b.querySelector(selectors);
6037
6039
  return result || selectors === 'base' ? result : rawMicroQuerySelector.call(microDocument, selectors);
6038
6040
  }
6039
6041
  function querySelectorAll(selectors) {
@@ -6158,10 +6160,10 @@ function patchDocumentProperty(appName, microAppWindow, sandbox) {
6158
6160
  enumerable: true,
6159
6161
  configurable: true,
6160
6162
  get: () => {
6161
- var _a;
6163
+ var _a, _b;
6162
6164
  throttleDeferForIframeAppName(appName);
6163
- if (tagName === 'body') {
6164
- return ((_a = sandbox.options.container) === null || _a === void 0 ? void 0 : _a.querySelector('micro-app-body')) || rawDocument[tagName];
6165
+ if (tagName === 'body' && ((_a = microApp === null || microApp === void 0 ? void 0 : microApp.options) === null || _a === void 0 ? void 0 : _a.inheritBaseBody) !== true) {
6166
+ return ((_b = sandbox.options.container) === null || _b === void 0 ? void 0 : _b.querySelector('micro-app-body')) || rawDocument[tagName];
6165
6167
  }
6166
6168
  return rawDocument[tagName];
6167
6169
  },