@blueking/bk-weweb 0.0.36-beta.17 → 0.0.36-beta.19

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/dist/index.esm.js CHANGED
@@ -1164,7 +1164,7 @@ var elementAppendHandler = (parent, newChild, rawMethod) => {
1164
1164
  if (!newChild.__BK_WEWEB_APP_KEY__) {
1165
1165
  return rawMethod.call(parent, newChild);
1166
1166
  }
1167
- const app = appCache.getApp(newChild.__BK_WEWEB_APP_KEY__);
1167
+ const app = appCache.getApp(newChild.__BK_WEWEB_APP_KEY__) || getCurrentRunningApp();
1168
1168
  if (!app?.container) {
1169
1169
  return rawMethod.call(parent, newChild);
1170
1170
  }
@@ -1179,7 +1179,7 @@ var elementInsertHandler = (parent, newChild, passiveChild, rawMethod) => {
1179
1179
  if (!newChild.__BK_WEWEB_APP_KEY__) {
1180
1180
  return rawMethod.call(parent, newChild, passiveChild);
1181
1181
  }
1182
- const app = appCache.getApp(newChild.__BK_WEWEB_APP_KEY__);
1182
+ const app = appCache.getApp(newChild.__BK_WEWEB_APP_KEY__) || getCurrentRunningApp();
1183
1183
  if (!app?.container) {
1184
1184
  return rawMethod.call(parent, newChild, passiveChild);
1185
1185
  }
@@ -1541,11 +1541,12 @@ var SandBox = class {
1541
1541
  const windowDescriptorSet = /* @__PURE__ */ new Set();
1542
1542
  const rawWindow = window;
1543
1543
  this.rawWindow = rawWindow;
1544
- this.rawDocument = createProxyDocument(document, app);
1544
+ const rawDocument = window.rawDocument || document;
1545
+ this.rawDocument = createProxyDocument(rawDocument, app);
1545
1546
  const fakeWindow = /* @__PURE__ */ Object.create({});
1546
1547
  fakeWindow.__BK_WEWEB_APP_KEY__ = app.appCacheKey;
1547
1548
  fakeWindow.__POWERED_BY_BK_WEWEB__ = true;
1548
- fakeWindow.rawDocument = document;
1549
+ fakeWindow.rawDocument = rawDocument;
1549
1550
  fakeWindow.rawWindow = rawWindow;
1550
1551
  fakeWindow.__proto__ = Window;
1551
1552
  this.fakeWindow = fakeWindow;
@@ -2445,9 +2446,7 @@ var AppCache = class {
2445
2446
  if (!name) return void 0;
2446
2447
  const app = this.cache.get(name);
2447
2448
  if (app) return app;
2448
- const item = Array.from(this.cache.values()).find((item2) => item2.name === name);
2449
- if (item) return item;
2450
- return window.__BK_WEWEB_APP_KEY__ ? window.__getAppOrInstance__()?.getApp(name) : void 0;
2449
+ return Array.from(this.cache.values()).find((item) => item.name === name);
2451
2450
  }
2452
2451
  /**
2453
2452
  * 删除缓存的应用实例
@@ -2712,7 +2711,7 @@ function getElementApp(element) {
2712
2711
  if (!element.__BK_WEWEB_APP_KEY__) {
2713
2712
  return null;
2714
2713
  }
2715
- return appCache.getApp(element.__BK_WEWEB_APP_KEY__);
2714
+ return appCache.getApp(element.__BK_WEWEB_APP_KEY__) || getCurrentRunningApp();
2716
2715
  }
2717
2716
  function createOverriddenSetAttribute() {
2718
2717
  return function(key, value) {
@@ -2785,11 +2784,10 @@ function createOverriddenInsertAdjacentElement() {
2785
2784
  };
2786
2785
  }
2787
2786
  function rewriteBodyAndHeaderMethods() {
2788
- if (hasRewrite || window.__BK_WEWEB_HAS_REWRITE__) {
2787
+ if (hasRewrite) {
2789
2788
  return;
2790
2789
  }
2791
2790
  hasRewrite = true;
2792
- window.__BK_WEWEB_HAS_REWRITE__ = true;
2793
2791
  Element.prototype.setAttribute = createOverriddenSetAttribute();
2794
2792
  HTMLBodyElement.prototype.appendChild = createOverriddenAppendChild();
2795
2793
  HTMLBodyElement.prototype.append = createOverriddenAppend();