@blueking/bk-weweb 0.0.36-beta.24 → 0.0.37

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.d.mts CHANGED
@@ -281,7 +281,7 @@ declare class SandBox {
281
281
  /** 代理的 window 对象 */
282
282
  readonly proxyWindow: WindowProxy & IInjectWindowAttrs;
283
283
  /** 原始 document 对象 */
284
- rawDocument: Document;
284
+ rawDocument: Record<string, any>;
285
285
  /** 原始 window 对象 */
286
286
  readonly rawWindow: Window;
287
287
  /** 在 window 上的唯一标识键 */
package/dist/index.esm.js CHANGED
@@ -241,10 +241,9 @@ var dispatchLinkOrScriptError = (element) => {
241
241
 
242
242
  // src/utils/fetch.ts
243
243
  var fetchSource = async (url, options = {}, app) => {
244
- const runningApp = app || getCurrentRunningApp();
245
- if (typeof runningApp?.fetchSource === "function") {
244
+ if (typeof app?.fetchSource === "function") {
246
245
  try {
247
- return await runningApp.fetchSource(url, options);
246
+ return await app.fetchSource(url, options);
248
247
  } catch {
249
248
  return "";
250
249
  }
@@ -1165,7 +1164,7 @@ var elementAppendHandler = (parent, newChild, rawMethod) => {
1165
1164
  if (!newChild.__BK_WEWEB_APP_KEY__) {
1166
1165
  return rawMethod.call(parent, newChild);
1167
1166
  }
1168
- const app = appCache.getApp(newChild.__BK_WEWEB_APP_KEY__) || getCurrentRunningApp();
1167
+ const app = appCache.getApp(newChild.__BK_WEWEB_APP_KEY__);
1169
1168
  if (!app?.container) {
1170
1169
  return rawMethod.call(parent, newChild);
1171
1170
  }
@@ -1180,7 +1179,7 @@ var elementInsertHandler = (parent, newChild, passiveChild, rawMethod) => {
1180
1179
  if (!newChild.__BK_WEWEB_APP_KEY__) {
1181
1180
  return rawMethod.call(parent, newChild, passiveChild);
1182
1181
  }
1183
- const app = appCache.getApp(newChild.__BK_WEWEB_APP_KEY__) || getCurrentRunningApp();
1182
+ const app = appCache.getApp(newChild.__BK_WEWEB_APP_KEY__);
1184
1183
  if (!app?.container) {
1185
1184
  return rawMethod.call(parent, newChild, passiveChild);
1186
1185
  }
@@ -1276,8 +1275,11 @@ function createElementWithAppKey(rawDocument, app) {
1276
1275
  tagName,
1277
1276
  options
1278
1277
  );
1279
- const runningApp = getCurrentRunningApp();
1280
- element[APP_KEY_PROPERTY] = runningApp?.appCacheKey || app.appCacheKey;
1278
+ const markAppKey = element[APP_KEY_PROPERTY];
1279
+ if (!markAppKey) {
1280
+ const runningApp = getCurrentRunningApp();
1281
+ element[APP_KEY_PROPERTY] = runningApp?.appCacheKey || app.appCacheKey;
1282
+ }
1281
1283
  if (element instanceof HTMLImageElement) {
1282
1284
  Object.defineProperty(element, "src", {
1283
1285
  get() {
@@ -1546,12 +1548,11 @@ var SandBox = class {
1546
1548
  const windowDescriptorSet = /* @__PURE__ */ new Set();
1547
1549
  const rawWindow = window;
1548
1550
  this.rawWindow = rawWindow;
1549
- const rawDocument = window.rawDocument || document;
1550
- this.rawDocument = createProxyDocument(rawDocument, app);
1551
+ this.rawDocument = createProxyDocument(document, app);
1551
1552
  const fakeWindow = /* @__PURE__ */ Object.create({});
1552
1553
  fakeWindow.__BK_WEWEB_APP_KEY__ = app.appCacheKey;
1553
1554
  fakeWindow.__POWERED_BY_BK_WEWEB__ = true;
1554
- fakeWindow.rawDocument = rawDocument;
1555
+ fakeWindow.rawDocument = document;
1555
1556
  fakeWindow.rawWindow = rawWindow;
1556
1557
  fakeWindow.__proto__ = Window;
1557
1558
  this.fakeWindow = fakeWindow;
@@ -2731,7 +2732,7 @@ function getElementApp(element) {
2731
2732
  if (!element.__BK_WEWEB_APP_KEY__) {
2732
2733
  return null;
2733
2734
  }
2734
- return appCache.getApp(element.__BK_WEWEB_APP_KEY__) || getCurrentRunningApp();
2735
+ return appCache.getApp(element.__BK_WEWEB_APP_KEY__);
2735
2736
  }
2736
2737
  function createOverriddenSetAttribute() {
2737
2738
  return function(key, value) {