@blueking/bk-weweb 0.0.3 → 0.0.6
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/collect-source.js +25 -51
- package/dist/collect-source.js.map +1 -1
- package/dist/index.esm.js +25 -51
- package/dist/index.esm.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/collect-source.js
CHANGED
|
@@ -203,7 +203,7 @@ const commonEScapeKeyList = ['System', '__cjsWrapper', '__REACT_ERROR_OVERLAY_GL
|
|
|
203
203
|
// 共享主应用上下文属性名
|
|
204
204
|
const escapeSetterKeyList = ['location'];
|
|
205
205
|
// 一定需要在子应用自身上下文获取的属性名
|
|
206
|
-
const scopeWindowKeyList = ['
|
|
206
|
+
const scopeWindowKeyList = ['__POWERED_BY_BK_WEWEB__', '__BK_WEWEB_APP_KEY__', '__BK_WEWEB_DATA__'];
|
|
207
207
|
// 设置了scopedLocation 后需要监听属性名
|
|
208
208
|
const scopedLocationKeyList = ['location', 'history'];
|
|
209
209
|
var DescriptorMapValue;
|
|
@@ -244,46 +244,6 @@ const commonRawWindowKeyMap = {
|
|
|
244
244
|
WeakMap: true,
|
|
245
245
|
WeakSet: true,
|
|
246
246
|
Uint8Array: true,
|
|
247
|
-
// btoa: true,
|
|
248
|
-
// unescape: true,
|
|
249
|
-
// WebSocket: true,
|
|
250
|
-
// encodeURIComponent: true,
|
|
251
|
-
// decodeURIComponent: true,
|
|
252
|
-
// ArrayBuffer: true,
|
|
253
|
-
// XMLHttpRequest: true,
|
|
254
|
-
// SVGElement: true,
|
|
255
|
-
// URLSearchParams: true,
|
|
256
|
-
// URL: true,
|
|
257
|
-
// RangeError: true,
|
|
258
|
-
// TypeError: true,
|
|
259
|
-
// Uint16Array: true,
|
|
260
|
-
// Uint32Array: true,
|
|
261
|
-
// Float64Array: true,
|
|
262
|
-
// Int32Array: true,
|
|
263
|
-
// requestAnimationFrame: true,
|
|
264
|
-
// SVGRect: true,
|
|
265
|
-
// Error: true,
|
|
266
|
-
// Buffer: true,
|
|
267
|
-
// SyntaxError: true,
|
|
268
|
-
// DataView: true,
|
|
269
|
-
// Worker: true,
|
|
270
|
-
// localStorage: true,
|
|
271
|
-
// Text: true,
|
|
272
|
-
// FormData: true,
|
|
273
|
-
// ShadowRoot: true,
|
|
274
|
-
// encodeURI: true,
|
|
275
|
-
// crypto: true,
|
|
276
|
-
// HTMLAnchorElement: true,
|
|
277
|
-
// Int8Array: true,
|
|
278
|
-
// FinalizationRegistry: true,
|
|
279
|
-
// BigInt: true,
|
|
280
|
-
// Atomics: true,
|
|
281
|
-
// Uint8ClampedArray: true,
|
|
282
|
-
// WeakRef: true,
|
|
283
|
-
// getComputedStyle,
|
|
284
|
-
// innerHeight: true,
|
|
285
|
-
// innerWidth: true,
|
|
286
|
-
// getComputedStyle: true,
|
|
287
247
|
};
|
|
288
248
|
const commonFakeWindowKeyMap = {
|
|
289
249
|
__VUE_OPTIONS_API__: true,
|
|
@@ -296,8 +256,11 @@ const commonFakeWindowKeyMap = {
|
|
|
296
256
|
webpackChunktrace: true,
|
|
297
257
|
webpackChunkpc: true,
|
|
298
258
|
webpackChunkapm: true,
|
|
259
|
+
webpackJsonp: true,
|
|
299
260
|
i18n: true,
|
|
300
261
|
'__core-js_shared__': true,
|
|
262
|
+
__bk_pop_manager: true,
|
|
263
|
+
__bk_zIndex_manager: true,
|
|
301
264
|
};
|
|
302
265
|
|
|
303
266
|
function eventHandler(event, element) {
|
|
@@ -663,9 +626,7 @@ function elementInsertHandler(parent, newChild, passiveChild, rawMethod) {
|
|
|
663
626
|
const container = needKeepAlive ? document.head : app?.container;
|
|
664
627
|
const targetChild = resetNewElement(parent, newChild, app);
|
|
665
628
|
if (needKeepAlive) {
|
|
666
|
-
targetChild
|
|
667
|
-
targetChild.setAttribute('data-from', app.name);
|
|
668
|
-
targetChild.setAttribute('data-keep-alive', 'true');
|
|
629
|
+
setMarkElement(targetChild, app, needKeepAlive);
|
|
669
630
|
}
|
|
670
631
|
if (passiveChild && !container.contains(passiveChild)) {
|
|
671
632
|
return bodyAppendChild$1.call(container, targetChild);
|
|
@@ -966,7 +927,6 @@ class SandBox {
|
|
|
966
927
|
&& this.app.scopeLocation) {
|
|
967
928
|
return this.app.iframe.contentWindow?.[key];
|
|
968
929
|
}
|
|
969
|
-
// if (key === Symbol.unscopables) return com;
|
|
970
930
|
if (key === 'hasOwnProperty')
|
|
971
931
|
return (key) => this.fakeWindow.hasOwnProperty(key) || rawWindow.hasOwnProperty(key);
|
|
972
932
|
if (key === 'top' || key === 'parent') {
|
|
@@ -1246,7 +1206,7 @@ function unmount(appKey) {
|
|
|
1246
1206
|
function activated(appKey, container, callback) {
|
|
1247
1207
|
const app = appCache.getApp(appKey);
|
|
1248
1208
|
if (app?.status === AppState.DEACTIVATED && app.keepAlive) {
|
|
1249
|
-
nextTask(() => app
|
|
1209
|
+
nextTask(() => app.activated(container, callback));
|
|
1250
1210
|
}
|
|
1251
1211
|
else {
|
|
1252
1212
|
nextTask(() => app?.mount(container, callback));
|
|
@@ -1327,7 +1287,7 @@ class BkIframeElement extends HTMLElement {
|
|
|
1327
1287
|
async connectedCallback() {
|
|
1328
1288
|
beforeLoad();
|
|
1329
1289
|
if (this.getBooleanAttr(ObserveAttrs.setShodowDom) && !this.shadowRoot) {
|
|
1330
|
-
this.attachShadow({ mode: 'open', delegatesFocus:
|
|
1290
|
+
this.attachShadow({ mode: 'open', delegatesFocus: false });
|
|
1331
1291
|
}
|
|
1332
1292
|
await load(this.appProps);
|
|
1333
1293
|
activated(this.appKey, this.shadowRoot ?? this);
|
|
@@ -1647,6 +1607,7 @@ async function execAppScripts(app) {
|
|
|
1647
1607
|
});
|
|
1648
1608
|
}
|
|
1649
1609
|
|
|
1610
|
+
const BLANK_ORIGN = 'about:blank';
|
|
1650
1611
|
class MicroAppModel {
|
|
1651
1612
|
state = AppState.UNSET;
|
|
1652
1613
|
isPreLoad = false;
|
|
@@ -1718,7 +1679,6 @@ class MicroAppModel {
|
|
|
1718
1679
|
this.container = container ?? this.container;
|
|
1719
1680
|
this.state = AppState.MOUNTING;
|
|
1720
1681
|
if (this.container) {
|
|
1721
|
-
debugger;
|
|
1722
1682
|
if (this.container instanceof Element)
|
|
1723
1683
|
this.container.setAttribute(CSS_ATTRIBUTE_KEY, this.name);
|
|
1724
1684
|
const clonedNode = this.source.html.cloneNode(true);
|
|
@@ -1767,10 +1727,24 @@ class MicroAppModel {
|
|
|
1767
1727
|
return new Promise((resolve) => {
|
|
1768
1728
|
const iframe = document.createElement('iframe');
|
|
1769
1729
|
const url = new URL(this.url);
|
|
1770
|
-
|
|
1771
|
-
iframe.
|
|
1730
|
+
const isChrome = navigator.userAgent.indexOf('Chrome') > -1;
|
|
1731
|
+
iframe.setAttribute('src', `${isChrome ? BLANK_ORIGN : location.origin}${url.pathname || '/'}${url.search}${url.hash}`);
|
|
1732
|
+
iframe.style.cssText = 'display: none;';
|
|
1772
1733
|
document.body.appendChild(iframe);
|
|
1773
|
-
|
|
1734
|
+
if (isChrome) {
|
|
1735
|
+
setTimeout(() => resolve(iframe), 0);
|
|
1736
|
+
}
|
|
1737
|
+
else {
|
|
1738
|
+
// 其他浏览器在about:blank下会出现同源检测安全错误 换另一种方式来做location保持
|
|
1739
|
+
const interval = setInterval(() => {
|
|
1740
|
+
if (iframe.contentWindow && iframe.contentWindow.location.href !== BLANK_ORIGN) {
|
|
1741
|
+
iframe.contentWindow.stop();
|
|
1742
|
+
iframe.contentDocument.body.parentElement.innerHTML = '<head></head><body></body>';
|
|
1743
|
+
clearInterval(interval);
|
|
1744
|
+
resolve(iframe);
|
|
1745
|
+
}
|
|
1746
|
+
}, 0);
|
|
1747
|
+
}
|
|
1774
1748
|
});
|
|
1775
1749
|
}
|
|
1776
1750
|
registerRunningApp() {
|