@glimt/record 0.0.41 → 0.0.42
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/record.cjs +59 -34
- package/dist/record.cjs.map +1 -1
- package/dist/record.js +59 -34
- package/dist/record.js.map +1 -1
- package/dist/record.umd.cjs +59 -34
- package/dist/record.umd.cjs.map +2 -2
- package/dist/record.umd.min.cjs +22 -22
- package/dist/record.umd.min.cjs.map +3 -3
- package/package.json +1 -1
package/dist/record.umd.cjs
CHANGED
|
@@ -854,23 +854,40 @@ const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
|
|
|
854
854
|
if (_AsyncStylesheetManager.instance) return _AsyncStylesheetManager.instance;
|
|
855
855
|
_AsyncStylesheetManager.instance = this;
|
|
856
856
|
}
|
|
857
|
+
removeCloneNode(href) {
|
|
858
|
+
if (!(href in this.clones) || this.clones[href] === void 0) return;
|
|
859
|
+
document.head.removeChild(this.clones[href].clone);
|
|
860
|
+
}
|
|
857
861
|
onLoad(href) {
|
|
858
862
|
if (!(href in this.clones) || this.clones[href] === void 0) return;
|
|
859
863
|
console.log("AsyncStylesheetManager, onLoad: href:", href);
|
|
860
864
|
const styleSheets2 = Array.from(document.styleSheets);
|
|
861
865
|
let clonedStyleSheet = null;
|
|
862
|
-
document.head.removeChild(this.clones[href].clone);
|
|
863
866
|
for (let i2 = styleSheets2.length - 1; i2 >= 0; i2--) {
|
|
864
867
|
if (styleSheets2[i2].href === href) {
|
|
865
868
|
clonedStyleSheet = styleSheets2[i2];
|
|
866
869
|
break;
|
|
867
870
|
}
|
|
868
871
|
}
|
|
869
|
-
if (!clonedStyleSheet)
|
|
872
|
+
if (!clonedStyleSheet) {
|
|
873
|
+
console.log(
|
|
874
|
+
"AsyncStylesheetManager, onLoad: couldn't find stylesheet for href:",
|
|
875
|
+
href
|
|
876
|
+
);
|
|
877
|
+
return this.removeCloneNode(href);
|
|
878
|
+
}
|
|
870
879
|
const newCssText = stringifyStylesheet$1(clonedStyleSheet);
|
|
871
|
-
|
|
880
|
+
this.removeCloneNode(href);
|
|
881
|
+
if (!newCssText) {
|
|
882
|
+
console.log(
|
|
883
|
+
"AsyncStylesheetManager, onLoad: couldn't stringify stylesheet for href:",
|
|
884
|
+
href
|
|
885
|
+
);
|
|
886
|
+
return;
|
|
887
|
+
}
|
|
872
888
|
console.log(
|
|
873
|
-
"AsyncStylesheetManager, onLoad: success! did get new css text! forcing mutation..."
|
|
889
|
+
"AsyncStylesheetManager, onLoad: success! did get new css text! forcing mutation... for href:",
|
|
890
|
+
href
|
|
874
891
|
);
|
|
875
892
|
this.clones[href].cssText = newCssText;
|
|
876
893
|
this.clones[href].loaded = true;
|
|
@@ -881,12 +898,11 @@ const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
|
|
|
881
898
|
}
|
|
882
899
|
onLoadError(href) {
|
|
883
900
|
if (!(href in this.clones) || this.clones[href] === void 0) return;
|
|
884
|
-
|
|
901
|
+
this.removeCloneNode(href);
|
|
885
902
|
}
|
|
886
903
|
removeAllCloneElements() {
|
|
887
|
-
for (const
|
|
888
|
-
|
|
889
|
-
document.head.removeChild(clone.clone);
|
|
904
|
+
for (const href of Object.keys(this.clones)) {
|
|
905
|
+
this.removeCloneNode(href);
|
|
890
906
|
}
|
|
891
907
|
}
|
|
892
908
|
onCleanTimeout() {
|
|
@@ -904,10 +920,6 @@ const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
|
|
|
904
920
|
this.blowCache();
|
|
905
921
|
this.currentHref = document.location.href;
|
|
906
922
|
const href = forElement.href;
|
|
907
|
-
console.log(
|
|
908
|
-
"AsyncStylesheetManager, registerClone: wants a clone for href:",
|
|
909
|
-
href
|
|
910
|
-
);
|
|
911
923
|
if (!href) return;
|
|
912
924
|
if (href in this.clones && this.clones[href] !== void 0) return;
|
|
913
925
|
if (forElement.getAttribute("crossorigin") === "anonymous") return;
|
|
@@ -937,7 +949,8 @@ const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
|
|
|
937
949
|
getClonedCssTextIfAvailable(href) {
|
|
938
950
|
if (href in this.clones && this.clones[href] !== void 0 && this.clones[href].loaded === true) {
|
|
939
951
|
console.log(
|
|
940
|
-
"AsyncStylesheetManager, getClonedCssTextIfAvailable: returning cloned cssText
|
|
952
|
+
"AsyncStylesheetManager, getClonedCssTextIfAvailable: returning cloned cssText, for href:",
|
|
953
|
+
href
|
|
941
954
|
);
|
|
942
955
|
return this.clones[href].cssText;
|
|
943
956
|
}
|
|
@@ -1339,10 +1352,13 @@ function serializeElementNode(n2, options) {
|
|
|
1339
1352
|
}
|
|
1340
1353
|
if (tagName === "link" && inlineStylesheet) {
|
|
1341
1354
|
const styleSheets2 = Array.from(doc.styleSheets);
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1355
|
+
let stylesheet = null;
|
|
1356
|
+
for (let i2 = 0; i2 < styleSheets2.length; i2++) {
|
|
1357
|
+
if (styleSheets2[i2].href === n2.href) {
|
|
1358
|
+
stylesheet = styleSheets2[i2];
|
|
1359
|
+
break;
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1346
1362
|
let cssText = null;
|
|
1347
1363
|
if (stylesheet) {
|
|
1348
1364
|
cssText = stringifyStylesheet$1(stylesheet);
|
|
@@ -1357,10 +1373,6 @@ function serializeElementNode(n2, options) {
|
|
|
1357
1373
|
delete attributes.href;
|
|
1358
1374
|
attributes._cssText = cssText;
|
|
1359
1375
|
} else {
|
|
1360
|
-
console.log(
|
|
1361
|
-
"missing cssText on first passthrough for href:",
|
|
1362
|
-
n2.href
|
|
1363
|
-
);
|
|
1364
1376
|
asyncStylesheetManager.registerClone({
|
|
1365
1377
|
forElement: n2
|
|
1366
1378
|
});
|
|
@@ -5663,23 +5675,40 @@ const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
|
5663
5675
|
if (_AsyncStylesheetManager22.instance) return _AsyncStylesheetManager22.instance;
|
|
5664
5676
|
_AsyncStylesheetManager22.instance = this;
|
|
5665
5677
|
}
|
|
5678
|
+
removeCloneNode(href) {
|
|
5679
|
+
if (!(href in this.clones) || this.clones[href] === void 0) return;
|
|
5680
|
+
document.head.removeChild(this.clones[href].clone);
|
|
5681
|
+
}
|
|
5666
5682
|
onLoad(href) {
|
|
5667
5683
|
if (!(href in this.clones) || this.clones[href] === void 0) return;
|
|
5668
5684
|
console.log("AsyncStylesheetManager, onLoad: href:", href);
|
|
5669
5685
|
const styleSheets2 = Array.from(document.styleSheets);
|
|
5670
5686
|
let clonedStyleSheet = null;
|
|
5671
|
-
document.head.removeChild(this.clones[href].clone);
|
|
5672
5687
|
for (let i2 = styleSheets2.length - 1; i2 >= 0; i2--) {
|
|
5673
5688
|
if (styleSheets2[i2].href === href) {
|
|
5674
5689
|
clonedStyleSheet = styleSheets2[i2];
|
|
5675
5690
|
break;
|
|
5676
5691
|
}
|
|
5677
5692
|
}
|
|
5678
|
-
if (!clonedStyleSheet)
|
|
5693
|
+
if (!clonedStyleSheet) {
|
|
5694
|
+
console.log(
|
|
5695
|
+
"AsyncStylesheetManager, onLoad: couldn't find stylesheet for href:",
|
|
5696
|
+
href
|
|
5697
|
+
);
|
|
5698
|
+
return this.removeCloneNode(href);
|
|
5699
|
+
}
|
|
5679
5700
|
const newCssText = stringifyStylesheet(clonedStyleSheet);
|
|
5680
|
-
|
|
5701
|
+
this.removeCloneNode(href);
|
|
5702
|
+
if (!newCssText) {
|
|
5703
|
+
console.log(
|
|
5704
|
+
"AsyncStylesheetManager, onLoad: couldn't stringify stylesheet for href:",
|
|
5705
|
+
href
|
|
5706
|
+
);
|
|
5707
|
+
return;
|
|
5708
|
+
}
|
|
5681
5709
|
console.log(
|
|
5682
|
-
"AsyncStylesheetManager, onLoad: success! did get new css text! forcing mutation..."
|
|
5710
|
+
"AsyncStylesheetManager, onLoad: success! did get new css text! forcing mutation... for href:",
|
|
5711
|
+
href
|
|
5683
5712
|
);
|
|
5684
5713
|
this.clones[href].cssText = newCssText;
|
|
5685
5714
|
this.clones[href].loaded = true;
|
|
@@ -5690,12 +5719,11 @@ const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
|
5690
5719
|
}
|
|
5691
5720
|
onLoadError(href) {
|
|
5692
5721
|
if (!(href in this.clones) || this.clones[href] === void 0) return;
|
|
5693
|
-
|
|
5722
|
+
this.removeCloneNode(href);
|
|
5694
5723
|
}
|
|
5695
5724
|
removeAllCloneElements() {
|
|
5696
|
-
for (const
|
|
5697
|
-
|
|
5698
|
-
document.head.removeChild(clone.clone);
|
|
5725
|
+
for (const href of Object.keys(this.clones)) {
|
|
5726
|
+
this.removeCloneNode(href);
|
|
5699
5727
|
}
|
|
5700
5728
|
}
|
|
5701
5729
|
onCleanTimeout() {
|
|
@@ -5713,10 +5741,6 @@ const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
|
5713
5741
|
this.blowCache();
|
|
5714
5742
|
this.currentHref = document.location.href;
|
|
5715
5743
|
const href = forElement.href;
|
|
5716
|
-
console.log(
|
|
5717
|
-
"AsyncStylesheetManager, registerClone: wants a clone for href:",
|
|
5718
|
-
href
|
|
5719
|
-
);
|
|
5720
5744
|
if (!href) return;
|
|
5721
5745
|
if (href in this.clones && this.clones[href] !== void 0) return;
|
|
5722
5746
|
if (forElement.getAttribute("crossorigin") === "anonymous") return;
|
|
@@ -5746,7 +5770,8 @@ const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
|
5746
5770
|
getClonedCssTextIfAvailable(href) {
|
|
5747
5771
|
if (href in this.clones && this.clones[href] !== void 0 && this.clones[href].loaded === true) {
|
|
5748
5772
|
console.log(
|
|
5749
|
-
"AsyncStylesheetManager, getClonedCssTextIfAvailable: returning cloned cssText
|
|
5773
|
+
"AsyncStylesheetManager, getClonedCssTextIfAvailable: returning cloned cssText, for href:",
|
|
5774
|
+
href
|
|
5750
5775
|
);
|
|
5751
5776
|
return this.clones[href].cssText;
|
|
5752
5777
|
}
|