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

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
  }
@@ -2445,9 +2445,7 @@ var AppCache = class {
2445
2445
  if (!name) return void 0;
2446
2446
  const app = this.cache.get(name);
2447
2447
  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;
2448
+ return Array.from(this.cache.values()).find((item) => item.name === name);
2451
2449
  }
2452
2450
  /**
2453
2451
  * 删除缓存的应用实例
@@ -2712,7 +2710,7 @@ function getElementApp(element) {
2712
2710
  if (!element.__BK_WEWEB_APP_KEY__) {
2713
2711
  return null;
2714
2712
  }
2715
- return appCache.getApp(element.__BK_WEWEB_APP_KEY__);
2713
+ return appCache.getApp(element.__BK_WEWEB_APP_KEY__) || getCurrentRunningApp();
2716
2714
  }
2717
2715
  function createOverriddenSetAttribute() {
2718
2716
  return function(key, value) {
@@ -2785,11 +2783,10 @@ function createOverriddenInsertAdjacentElement() {
2785
2783
  };
2786
2784
  }
2787
2785
  function rewriteBodyAndHeaderMethods() {
2788
- if (hasRewrite || window.__BK_WEWEB_HAS_REWRITE__) {
2786
+ if (hasRewrite) {
2789
2787
  return;
2790
2788
  }
2791
2789
  hasRewrite = true;
2792
- window.__BK_WEWEB_HAS_REWRITE__ = true;
2793
2790
  Element.prototype.setAttribute = createOverriddenSetAttribute();
2794
2791
  HTMLBodyElement.prototype.appendChild = createOverriddenAppendChild();
2795
2792
  HTMLBodyElement.prototype.append = createOverriddenAppend();