@blueking/bk-weweb 0.0.20 → 0.0.21
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 +15 -0
- package/dist/collect-source.js.map +1 -1
- package/dist/index.esm.js +15 -0
- 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/typings/base-app/base-element.d.ts +6 -0
- package/typings/context/memory.d.ts +10 -0
- package/typings/utils/element-event.d.ts +2 -0
package/dist/collect-source.js
CHANGED
|
@@ -722,6 +722,21 @@ class Style {
|
|
|
722
722
|
}
|
|
723
723
|
else {
|
|
724
724
|
const cssText = this.resetUrlHost(styleElement.textContent || templateStyle.textContent || '', app.url, this.url);
|
|
725
|
+
// fix https://bugs.chromium.org/p/chromium/issues/detail?id=336876
|
|
726
|
+
if (cssText && app.container instanceof ShadowRoot) {
|
|
727
|
+
let fontContent = '';
|
|
728
|
+
cssText.match(/@font-face\s*\{[^}]+\}/g)?.forEach(fontFace => {
|
|
729
|
+
fontContent += `${fontFace}\n`;
|
|
730
|
+
});
|
|
731
|
+
const rawDocument = app.sandBox?.rawDocument;
|
|
732
|
+
if (rawDocument && fontContent) {
|
|
733
|
+
const fontStyle = rawDocument.createElement('style');
|
|
734
|
+
fontStyle.setAttribute('type', 'text/css');
|
|
735
|
+
fontStyle.setAttribute('powered-by', 'bk-weweb');
|
|
736
|
+
fontStyle.textContent = fontContent;
|
|
737
|
+
rawDocument?.head?.append(fontStyle);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
725
740
|
styleElement.textContent = cssText;
|
|
726
741
|
}
|
|
727
742
|
this.scoped = true;
|