@absolutejs/beacon 0.6.20 → 0.6.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/index.js +17 -2
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2184,7 +2184,18 @@ var createBeacon = (options) => {
|
|
|
2184
2184
|
};
|
|
2185
2185
|
const loadingFirstSeen = new WeakMap;
|
|
2186
2186
|
const reportedStuckLoading = new WeakSet;
|
|
2187
|
+
const loadingIndicatorSelector = `[aria-busy="true"], [role="progressbar"], [${BEACON_ATTRIBUTE.LOADING}]`;
|
|
2187
2188
|
const isPersistentDeterminateProgress = (indicator) => indicator.getAttribute("role") === "progressbar" && indicator.hasAttribute("aria-valuenow") && indicator.getAttribute("aria-busy") !== "true" && !indicator.hasAttribute(BEACON_ATTRIBUTE.LOADING);
|
|
2189
|
+
const hasTrackedLoadingAncestor = (indicator) => {
|
|
2190
|
+
let ancestor = indicator.parentElement?.closest(loadingIndicatorSelector);
|
|
2191
|
+
while (ancestor !== null && ancestor !== undefined) {
|
|
2192
|
+
if (!isPersistentDeterminateProgress(ancestor) && !isScanExempt(ancestor) && !hasHiddenAncestor(ancestor)) {
|
|
2193
|
+
return true;
|
|
2194
|
+
}
|
|
2195
|
+
ancestor = ancestor.parentElement?.closest(loadingIndicatorSelector);
|
|
2196
|
+
}
|
|
2197
|
+
return false;
|
|
2198
|
+
};
|
|
2188
2199
|
const loadingDeadlineMs = (indicator) => {
|
|
2189
2200
|
const configured = indicator.getAttribute(BEACON_ATTRIBUTE.LOADING_TIMEOUT)?.trim();
|
|
2190
2201
|
if (!configured)
|
|
@@ -2195,13 +2206,17 @@ var createBeacon = (options) => {
|
|
|
2195
2206
|
const checkStuckLoading = () => {
|
|
2196
2207
|
if (document.visibilityState === "hidden")
|
|
2197
2208
|
return;
|
|
2198
|
-
const indicators = document.querySelectorAll(
|
|
2209
|
+
const indicators = document.querySelectorAll(loadingIndicatorSelector);
|
|
2199
2210
|
const now = Date.now();
|
|
2200
2211
|
for (const indicator of Array.from(indicators)) {
|
|
2201
2212
|
if (isPersistentDeterminateProgress(indicator))
|
|
2202
2213
|
continue;
|
|
2203
2214
|
if (isScanExempt(indicator))
|
|
2204
2215
|
continue;
|
|
2216
|
+
if (hasHiddenAncestor(indicator))
|
|
2217
|
+
continue;
|
|
2218
|
+
if (hasTrackedLoadingAncestor(indicator))
|
|
2219
|
+
continue;
|
|
2205
2220
|
const rect = indicator.getBoundingClientRect();
|
|
2206
2221
|
if (rect.width === 0 && rect.height === 0)
|
|
2207
2222
|
continue;
|
|
@@ -3811,5 +3826,5 @@ export {
|
|
|
3811
3826
|
BEACON_ATTRIBUTE
|
|
3812
3827
|
};
|
|
3813
3828
|
|
|
3814
|
-
//# debugId=
|
|
3829
|
+
//# debugId=031AAABEB97215B864756E2164756E21
|
|
3815
3830
|
//# sourceMappingURL=index.js.map
|