accessify-widget 0.2.18 → 0.2.19
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/accessify.min.js +1 -1
- package/dist/accessify.min.js.map +1 -1
- package/dist/accessify.mjs +1 -1
- package/dist/{index-DvpENReS.js → index-B2FUEI0d.js} +39 -5
- package/dist/{index-DvpENReS.js.map → index-B2FUEI0d.js.map} +1 -1
- package/dist/{keyboard-nav-BLkj3Uzc.js → keyboard-nav-B49dNgy3.js} +2 -2
- package/dist/{keyboard-nav-BLkj3Uzc.js.map → keyboard-nav-B49dNgy3.js.map} +1 -1
- package/dist/{page-structure-D88y-Y7V.js → page-structure-C9pDJKyf.js} +2 -2
- package/dist/{page-structure-D88y-Y7V.js.map → page-structure-C9pDJKyf.js.map} +1 -1
- package/dist/widget.js +1 -1
- package/dist/widget.js.map +1 -1
- package/package.json +1 -1
package/dist/accessify.mjs
CHANGED
|
@@ -1673,7 +1673,7 @@ function derived(fn) {
|
|
|
1673
1673
|
return signal;
|
|
1674
1674
|
}
|
|
1675
1675
|
// @__NO_SIDE_EFFECTS__
|
|
1676
|
-
function async_derived(fn, label,
|
|
1676
|
+
function async_derived(fn, label, location2) {
|
|
1677
1677
|
let parent = (
|
|
1678
1678
|
/** @type {Effect | null} */
|
|
1679
1679
|
active_effect
|
|
@@ -6310,14 +6310,14 @@ function FeatureGrid($$anchor, $$props) {
|
|
|
6310
6310
|
const FEATURE_LOADERS = {
|
|
6311
6311
|
contrast: () => import("./contrast-CqsICAkU.js"),
|
|
6312
6312
|
"text-size": () => import("./text-size-C6OFhCGi.js"),
|
|
6313
|
-
"keyboard-nav": () => import("./keyboard-nav-
|
|
6313
|
+
"keyboard-nav": () => import("./keyboard-nav-B49dNgy3.js"),
|
|
6314
6314
|
"link-highlight": () => import("./link-highlight-DBGm067Y.js"),
|
|
6315
6315
|
"reading-guide": () => import("./reading-guide-VT8NciIL.js"),
|
|
6316
6316
|
"reading-mask": () => import("./reading-mask-BABChuCz.js"),
|
|
6317
6317
|
"animation-stop": () => import("./animation-stop-C0MwseK0.js"),
|
|
6318
6318
|
"hide-images": () => import("./hide-images-B_LeCBcd.js"),
|
|
6319
6319
|
"big-cursor": () => import("./big-cursor-B2UKu9dQ.js"),
|
|
6320
|
-
"page-structure": () => import("./page-structure-
|
|
6320
|
+
"page-structure": () => import("./page-structure-C9pDJKyf.js"),
|
|
6321
6321
|
tts: () => import("./tts-CjszLRnb.js"),
|
|
6322
6322
|
"text-simplify": () => import("./text-simplify-Cvhpio7g.js"),
|
|
6323
6323
|
"alt-text": () => Promise.resolve().then(() => altText)
|
|
@@ -6630,6 +6630,8 @@ let currentTranslateLang = null;
|
|
|
6630
6630
|
let translating = false;
|
|
6631
6631
|
let observer = null;
|
|
6632
6632
|
let observerPaused = false;
|
|
6633
|
+
let navigationHandler = null;
|
|
6634
|
+
let lastUrl = "";
|
|
6633
6635
|
const TRANSLATABLE_ATTRS = [
|
|
6634
6636
|
"aria-label",
|
|
6635
6637
|
"aria-description",
|
|
@@ -6773,10 +6775,23 @@ async function translatePage(targetLang) {
|
|
|
6773
6775
|
}
|
|
6774
6776
|
function setupObserver(targetLang) {
|
|
6775
6777
|
if (observer) observer.disconnect();
|
|
6778
|
+
lastUrl = location.href;
|
|
6776
6779
|
const debouncedTranslate = debounce(() => {
|
|
6777
6780
|
if (!currentTranslateLang || observerPaused) return;
|
|
6778
6781
|
translatePage(currentTranslateLang);
|
|
6779
6782
|
}, 300);
|
|
6783
|
+
const onNavigation = () => {
|
|
6784
|
+
if (!currentTranslateLang || observerPaused) return;
|
|
6785
|
+
const newUrl = location.href;
|
|
6786
|
+
if (newUrl !== lastUrl) {
|
|
6787
|
+
lastUrl = newUrl;
|
|
6788
|
+
savedTextNodes = [];
|
|
6789
|
+
savedAttrs = [];
|
|
6790
|
+
setTimeout(() => {
|
|
6791
|
+
if (currentTranslateLang) translatePage(currentTranslateLang);
|
|
6792
|
+
}, 500);
|
|
6793
|
+
}
|
|
6794
|
+
};
|
|
6780
6795
|
observer = new MutationObserver((mutations) => {
|
|
6781
6796
|
if (observerPaused || !currentTranslateLang) return;
|
|
6782
6797
|
let hasRelevantChange = false;
|
|
@@ -6790,17 +6805,36 @@ function setupObserver(targetLang) {
|
|
|
6790
6805
|
break;
|
|
6791
6806
|
}
|
|
6792
6807
|
}
|
|
6793
|
-
if (hasRelevantChange)
|
|
6808
|
+
if (hasRelevantChange) {
|
|
6809
|
+
onNavigation();
|
|
6810
|
+
debouncedTranslate();
|
|
6811
|
+
}
|
|
6794
6812
|
});
|
|
6795
6813
|
observer.observe(document.body, {
|
|
6796
6814
|
childList: true,
|
|
6797
6815
|
subtree: true,
|
|
6798
6816
|
characterData: true
|
|
6799
6817
|
});
|
|
6818
|
+
navigationHandler = onNavigation;
|
|
6819
|
+
window.addEventListener("popstate", navigationHandler);
|
|
6820
|
+
const origPush = history.pushState;
|
|
6821
|
+
const origReplace = history.replaceState;
|
|
6822
|
+
history.pushState = function(...args) {
|
|
6823
|
+
origPush.apply(this, args);
|
|
6824
|
+
onNavigation();
|
|
6825
|
+
};
|
|
6826
|
+
history.replaceState = function(...args) {
|
|
6827
|
+
origReplace.apply(this, args);
|
|
6828
|
+
onNavigation();
|
|
6829
|
+
};
|
|
6800
6830
|
}
|
|
6801
6831
|
function teardownObserver() {
|
|
6802
6832
|
observer?.disconnect();
|
|
6803
6833
|
observer = null;
|
|
6834
|
+
if (navigationHandler) {
|
|
6835
|
+
window.removeEventListener("popstate", navigationHandler);
|
|
6836
|
+
navigationHandler = null;
|
|
6837
|
+
}
|
|
6804
6838
|
}
|
|
6805
6839
|
function getElId(el) {
|
|
6806
6840
|
return el.id || el.getAttribute("data-a11y-id") || (el.setAttribute("data-a11y-id", Math.random().toString(36).substr(2, 9)), el.getAttribute("data-a11y-id"));
|
|
@@ -8535,4 +8569,4 @@ export {
|
|
|
8535
8569
|
init as i,
|
|
8536
8570
|
t
|
|
8537
8571
|
};
|
|
8538
|
-
//# sourceMappingURL=index-
|
|
8572
|
+
//# sourceMappingURL=index-B2FUEI0d.js.map
|