@absolutejs/beacon 0.6.25 → 0.6.26
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/index.js +38 -1
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -404,6 +404,27 @@ var resourceSourceOf = (url) => {
|
|
|
404
404
|
return "unknown source";
|
|
405
405
|
}
|
|
406
406
|
};
|
|
407
|
+
var isExtensionResourceUrl = (url) => {
|
|
408
|
+
if (url === undefined)
|
|
409
|
+
return false;
|
|
410
|
+
try {
|
|
411
|
+
const protocol = new URL(url, location.href).protocol;
|
|
412
|
+
return protocol === "chrome-extension:" || protocol === "moz-extension:";
|
|
413
|
+
} catch {
|
|
414
|
+
return false;
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
var injectionMarkersOf = (element) => {
|
|
418
|
+
const markers = new Set;
|
|
419
|
+
for (let current = element;current; current = current.parentElement) {
|
|
420
|
+
for (const attribute of Array.from(current.attributes)) {
|
|
421
|
+
if (/^(?:data-darkreader|data-adguard|data-extension|data-gramm|data-lastpass|bis_)/u.test(attribute.name)) {
|
|
422
|
+
markers.add(attribute.name);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return markers.size === 0 ? undefined : Array.from(markers).sort().join(",");
|
|
427
|
+
};
|
|
407
428
|
var describeElement = (element) => {
|
|
408
429
|
const tag = element.tagName.toLowerCase();
|
|
409
430
|
const beaconName = element.getAttribute(BEACON_ATTRIBUTE.NAME)?.trim().replace(/[^a-zA-Z0-9:_-]+/g, "-").slice(0, 64);
|
|
@@ -1852,11 +1873,24 @@ var createBeacon = (options) => {
|
|
|
1852
1873
|
return;
|
|
1853
1874
|
seenOverflows.add(key);
|
|
1854
1875
|
overflowReports += 1;
|
|
1876
|
+
const rect = element.getBoundingClientRect();
|
|
1877
|
+
const resourceUrl = RESOURCE_ERROR_TAGS.has(element.tagName.toLowerCase()) ? resourceUrlOf(element) : undefined;
|
|
1878
|
+
const injectionMarkers = injectionMarkersOf(element);
|
|
1855
1879
|
emitSignal(`Layout overflow — ${describeElement(element)} ${detail} — ${shortUrl(location.href)} [${bucket}]`, {
|
|
1856
1880
|
overflowKind: kind,
|
|
1857
1881
|
signal: BEACON_SIGNAL.LAYOUT_OVERFLOW,
|
|
1858
1882
|
spillPx: String(Math.round(spillPx)),
|
|
1859
1883
|
target: describeElement(element),
|
|
1884
|
+
targetAncestor: element.parentElement === null ? "none" : describeElement(element.parentElement),
|
|
1885
|
+
targetBottomPx: String(Math.round(rect.bottom)),
|
|
1886
|
+
targetHeightPx: String(Math.round(rect.height)),
|
|
1887
|
+
targetLeftPx: String(Math.round(rect.left)),
|
|
1888
|
+
targetPosition: window.getComputedStyle(element).position,
|
|
1889
|
+
targetRightPx: String(Math.round(rect.right)),
|
|
1890
|
+
targetTopPx: String(Math.round(rect.top)),
|
|
1891
|
+
targetWidthPx: String(Math.round(rect.width)),
|
|
1892
|
+
...resourceUrl === undefined ? {} : { resourceSource: resourceSourceOf(resourceUrl) },
|
|
1893
|
+
...injectionMarkers === undefined ? {} : { injectionMarkers },
|
|
1860
1894
|
viewportBucket: bucket,
|
|
1861
1895
|
viewportWidth: String(document.documentElement.clientWidth)
|
|
1862
1896
|
});
|
|
@@ -1871,6 +1905,9 @@ var createBeacon = (options) => {
|
|
|
1871
1905
|
return;
|
|
1872
1906
|
if (element.getAttribute(BEACON_ATTRIBUTE.OVERFLOW) === "allow")
|
|
1873
1907
|
return;
|
|
1908
|
+
if (RESOURCE_ERROR_TAGS.has(element.tagName.toLowerCase()) && isExtensionResourceUrl(resourceUrlOf(element))) {
|
|
1909
|
+
return;
|
|
1910
|
+
}
|
|
1874
1911
|
const style = window.getComputedStyle(element);
|
|
1875
1912
|
if (hasHiddenAncestor(element))
|
|
1876
1913
|
return;
|
|
@@ -3875,5 +3912,5 @@ export {
|
|
|
3875
3912
|
BEACON_ATTRIBUTE
|
|
3876
3913
|
};
|
|
3877
3914
|
|
|
3878
|
-
//# debugId=
|
|
3915
|
+
//# debugId=5144B9A028EDFBDF64756E2164756E21
|
|
3879
3916
|
//# sourceMappingURL=index.js.map
|