single-file-core 1.2.39 → 1.2.41
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/core/helper.js +1 -1
- package/core/index.js +19 -5
- package/package.json +1 -1
- package/vendor/zip/zip.js +2 -2
package/core/helper.js
CHANGED
|
@@ -244,7 +244,7 @@ function getElementsInfo(win, doc, element, options, data = { usedFonts: new Map
|
|
|
244
244
|
}
|
|
245
245
|
getResourcesInfo(win, doc, element, options, data, elementHidden, computedStyle);
|
|
246
246
|
const shadowRoot = !((element instanceof win.SVGElement) || (element instanceof globalThis.SVGElement)) && getShadowRoot(element);
|
|
247
|
-
if (shadowRoot && !element.classList.contains(SINGLE_FILE_UI_ELEMENT_CLASS)) {
|
|
247
|
+
if (shadowRoot && !element.classList.contains(SINGLE_FILE_UI_ELEMENT_CLASS) && element.tagName.toLowerCase() != INFOBAR_TAGNAME) {
|
|
248
248
|
const shadowRootInfo = {};
|
|
249
249
|
element.setAttribute(SHADOW_ROOT_ATTRIBUTE_NAME, data.shadowRoots.length);
|
|
250
250
|
data.markedElements.push(element);
|
package/core/index.js
CHANGED
|
@@ -651,6 +651,10 @@ class Processor {
|
|
|
651
651
|
}
|
|
652
652
|
|
|
653
653
|
saveFilenameTemplateData() {
|
|
654
|
+
const existingScript = this.doc.querySelector("script[" + SCRIPT_OPTIONS + "][type=\"application/json\"]");
|
|
655
|
+
if (existingScript) {
|
|
656
|
+
existingScript.remove();
|
|
657
|
+
}
|
|
654
658
|
const optionsElement = this.doc.createElement("script");
|
|
655
659
|
optionsElement.type = "application/json";
|
|
656
660
|
optionsElement.setAttribute(SCRIPT_OPTIONS, "");
|
|
@@ -1036,15 +1040,25 @@ class Processor {
|
|
|
1036
1040
|
this.stats.set("discarded", "hidden elements", removedElements.length);
|
|
1037
1041
|
this.stats.set("processed", "hidden elements", removedElements.length);
|
|
1038
1042
|
if (hiddenElements.length) {
|
|
1039
|
-
const
|
|
1040
|
-
|
|
1041
|
-
|
|
1043
|
+
const className = "sf-hidden";
|
|
1044
|
+
const stylesheetContent = "." + className + "{display:none!important}";
|
|
1045
|
+
let foundStylesheet = false;
|
|
1046
|
+
this.doc.querySelectorAll("style").forEach(styleElement => {
|
|
1047
|
+
if (styleElement.textContent == stylesheetContent) {
|
|
1048
|
+
foundStylesheet = true;
|
|
1049
|
+
}
|
|
1050
|
+
});
|
|
1051
|
+
if (!foundStylesheet) {
|
|
1052
|
+
const styleElement = this.doc.createElement("style");
|
|
1053
|
+
styleElement.textContent = stylesheetContent;
|
|
1054
|
+
this.doc.head.appendChild(styleElement);
|
|
1055
|
+
}
|
|
1042
1056
|
hiddenElements.forEach(element => {
|
|
1043
1057
|
if (element.style.getPropertyValue("display") != "none") {
|
|
1044
1058
|
if (element.style.getPropertyPriority("display") == "important") {
|
|
1045
1059
|
element.style.setProperty("display", "none", "important");
|
|
1046
|
-
} else {
|
|
1047
|
-
element.classList.add(
|
|
1060
|
+
} else if (!element.classList.contains(className)) {
|
|
1061
|
+
element.classList.add(className);
|
|
1048
1062
|
}
|
|
1049
1063
|
}
|
|
1050
1064
|
});
|
package/package.json
CHANGED
package/vendor/zip/zip.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { Array, Object, String, Number, BigInt, Math, Date, Map, Set, Response, URL, Error, Uint8Array, Uint16Array, Uint32Array, DataView, Blob, Promise, TextEncoder, TextDecoder,
|
|
1
|
+
const { Array, Object, String, Number, BigInt, Math, Date, Map, Set, Response, URL, Error, Uint8Array, Uint16Array, Uint32Array, DataView, Blob, Promise, TextEncoder, TextDecoder, crypto, btoa, TransformStream, ReadableStream, WritableStream, CompressionStream, DecompressionStream, navigator, Worker } = globalThis;
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
Copyright (c) 2022 Gildas Lormeau. All rights reserved.
|
|
@@ -4940,7 +4940,7 @@ function getLength(...arrayLikes) {
|
|
|
4940
4940
|
derived from this software without specific prior written permission.
|
|
4941
4941
|
|
|
4942
4942
|
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
4943
|
-
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
4943
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WA RRANTIES OF MERCHANTABILITY AND
|
|
4944
4944
|
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
4945
4945
|
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
4946
4946
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|