@blueking/bk-weweb 0.0.26-beta.1 → 0.0.26-beta.3
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/base-app/collect-source.esm.js +18 -17
- package/dist/base-app/collect-source.esm.js.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.esm.js +18 -17
- package/dist/index.esm.js.map +1 -1
- package/package.json +14 -19
package/dist/index.d.mts
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -6,11 +6,11 @@ function getCurrentRunningApp() {
|
|
|
6
6
|
function setCurrentRunningApp(appInstance) {
|
|
7
7
|
currentRunningApp = appInstance;
|
|
8
8
|
}
|
|
9
|
-
var windowNativeFuncMap =
|
|
9
|
+
var windowNativeFuncMap = {};
|
|
10
10
|
var collectNativeWindowFunc = () => {
|
|
11
11
|
Object.getOwnPropertyNames(window).forEach((key) => {
|
|
12
|
-
if (!windowNativeFuncMap
|
|
13
|
-
windowNativeFuncMap
|
|
12
|
+
if (!windowNativeFuncMap[key] && key.match(/^[A-Z]/) && typeof window[key] === "function" && window[key].toString().includes("[native code]")) {
|
|
13
|
+
windowNativeFuncMap[key] = true;
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
};
|
|
@@ -78,7 +78,7 @@ function fillUpPath(path, baseURI) {
|
|
|
78
78
|
function randomUrl() {
|
|
79
79
|
return `inline-${random(16)}`;
|
|
80
80
|
}
|
|
81
|
-
var requestIdleCallback = window.requestIdleCallback ||
|
|
81
|
+
var requestIdleCallback = window.requestIdleCallback || ((cb) => {
|
|
82
82
|
const start = Date.now();
|
|
83
83
|
return setTimeout(() => {
|
|
84
84
|
cb({
|
|
@@ -88,14 +88,14 @@ var requestIdleCallback = window.requestIdleCallback || function(cb) {
|
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
}, 1);
|
|
91
|
-
};
|
|
92
|
-
var cancelIdleCallback = window.cancelIdleCallback ||
|
|
91
|
+
});
|
|
92
|
+
var cancelIdleCallback = window.cancelIdleCallback || ((id) => {
|
|
93
93
|
clearTimeout(id);
|
|
94
|
-
};
|
|
94
|
+
});
|
|
95
95
|
var random = (n, str = "abcdefghijklmnopqrstuvwxyz0123456789") => {
|
|
96
96
|
let result = "";
|
|
97
97
|
for (let i = 0; i < n; i++) {
|
|
98
|
-
result += str[parseInt((Math.random() * str.length).toString(), 10)];
|
|
98
|
+
result += str[Number.parseInt((Math.random() * str.length).toString(), 10)];
|
|
99
99
|
}
|
|
100
100
|
return result;
|
|
101
101
|
};
|
|
@@ -338,11 +338,11 @@ function rewriteWindowFunction(fakeWindow) {
|
|
|
338
338
|
const intervalTimerList = [];
|
|
339
339
|
const rawWindow = window;
|
|
340
340
|
const { addEventListener, clearInterval: clearInterval2, removeEventListener, setInterval: setInterval2 } = window;
|
|
341
|
-
fakeWindow.addEventListener =
|
|
341
|
+
fakeWindow.addEventListener = (type, listener, options) => {
|
|
342
342
|
windowEventLisenerMap.set(type, [...windowEventLisenerMap.get(type) || [], listener]);
|
|
343
343
|
addEventListener.call(rawWindow, type, listener, options);
|
|
344
344
|
};
|
|
345
|
-
fakeWindow.removeEventListener =
|
|
345
|
+
fakeWindow.removeEventListener = (type, listener, options) => {
|
|
346
346
|
const listenerList = windowEventLisenerMap.get(type);
|
|
347
347
|
if (listenerList?.length) {
|
|
348
348
|
const index = listenerList.indexOf(listener);
|
|
@@ -350,12 +350,12 @@ function rewriteWindowFunction(fakeWindow) {
|
|
|
350
350
|
}
|
|
351
351
|
removeEventListener.call(rawWindow, type, listener, options);
|
|
352
352
|
};
|
|
353
|
-
fakeWindow.setInterval =
|
|
353
|
+
fakeWindow.setInterval = (handler, timeout, ...args) => {
|
|
354
354
|
const timer = setInterval2.call(rawWindow, handler, timeout, ...args);
|
|
355
355
|
intervalTimerList.push(timer);
|
|
356
356
|
return timer;
|
|
357
357
|
};
|
|
358
|
-
fakeWindow.clearInterval =
|
|
358
|
+
fakeWindow.clearInterval = (timer) => {
|
|
359
359
|
const index = intervalTimerList.indexOf(timer);
|
|
360
360
|
index > -1 && intervalTimerList.splice(index, 1);
|
|
361
361
|
clearInterval2.call(rawWindow, timer);
|
|
@@ -415,7 +415,8 @@ var SandBox = class {
|
|
|
415
415
|
return true;
|
|
416
416
|
},
|
|
417
417
|
get: (target, key) => {
|
|
418
|
-
if (windowNativeFuncMap
|
|
418
|
+
if (windowNativeFuncMap[key]) return rawWindow[key];
|
|
419
|
+
if (key === Symbol.unscopables) return rawWindow[Symbol.unscopables];
|
|
419
420
|
if (DEV_MICRO_APP_WINDOE_KEY_MAP[key]) return this.fakeWindow[key];
|
|
420
421
|
if (WINDOW_ALIAS_LIST.includes(key)) return this.proxyWindow;
|
|
421
422
|
if (key === "document") {
|
|
@@ -463,7 +464,7 @@ var SandBox = class {
|
|
|
463
464
|
}
|
|
464
465
|
return void 0;
|
|
465
466
|
},
|
|
466
|
-
has: (target, key) => windowNativeFuncMap
|
|
467
|
+
has: (target, key) => windowNativeFuncMap[key] || key in target || key in rawWindow,
|
|
467
468
|
// Object.getOwnPropertyNames(window)
|
|
468
469
|
ownKeys: (target) => Array.from(new Set(Reflect.ownKeys(rawWindow).concat(Reflect.ownKeys(target)))),
|
|
469
470
|
set: (target, key, value) => {
|
|
@@ -1002,7 +1003,7 @@ var MicroInstanceModel = class {
|
|
|
1002
1003
|
this.isPreLoad = false;
|
|
1003
1004
|
this.state = "ACTIVATED" /* ACTIVATED */;
|
|
1004
1005
|
if (this.container && container) {
|
|
1005
|
-
if (container instanceof Element) container
|
|
1006
|
+
if (container instanceof Element) container?.setAttribute(CSS_ATTRIBUTE_KEY, this.name);
|
|
1006
1007
|
const fragment = document.createDocumentFragment();
|
|
1007
1008
|
Array.from(this.container.childNodes).forEach((node) => {
|
|
1008
1009
|
fragment.appendChild(node);
|
|
@@ -1804,7 +1805,7 @@ var AppCache = class {
|
|
|
1804
1805
|
}
|
|
1805
1806
|
};
|
|
1806
1807
|
var appCache = new AppCache();
|
|
1807
|
-
window.__getAppOrInstance__ =
|
|
1808
|
+
window.__getAppOrInstance__ = (id) => {
|
|
1808
1809
|
if (!id) return appCache;
|
|
1809
1810
|
return appCache.getApp(id);
|
|
1810
1811
|
};
|
|
@@ -2084,7 +2085,7 @@ var BkWewebElement = class extends HTMLElement {
|
|
|
2084
2085
|
return ["url" /* url */];
|
|
2085
2086
|
}
|
|
2086
2087
|
getBooleanAttr(name) {
|
|
2087
|
-
return this.hasAttribute(name) || this.hasAttribute(name.replace(/([A-Z])/g,
|
|
2088
|
+
return this.hasAttribute(name) || this.hasAttribute(name.replace(/([A-Z])/g, "-$1").toLocaleLowerCase()) ? this.getAttribute(name) !== "false" : void 0;
|
|
2088
2089
|
}
|
|
2089
2090
|
async handleAttributeChanged() {
|
|
2090
2091
|
if (!this.appKey) return;
|