accessify-widget 0.3.102 → 0.3.103
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-CyZv4-2d.js → index-z-PPlD77.js} +57 -4
- package/dist/{index-CyZv4-2d.js.map → index-z-PPlD77.js.map} +1 -1
- package/dist/{keyboard-nav-BYl36wkS.js → keyboard-nav-Ca6B6NGi.js} +2 -2
- package/dist/{keyboard-nav-BYl36wkS.js.map → keyboard-nav-Ca6B6NGi.js.map} +1 -1
- package/dist/{page-structure-DkNwkCP-.js → page-structure-CMx_Jviw.js} +2 -2
- package/dist/{page-structure-DkNwkCP-.js.map → page-structure-CMx_Jviw.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
|
@@ -5992,6 +5992,22 @@ function TriggerButton($$anchor, $$props) {
|
|
|
5992
5992
|
let startTop = 0;
|
|
5993
5993
|
let hasMoved = false;
|
|
5994
5994
|
let pointerId = null;
|
|
5995
|
+
function clampToViewport() {
|
|
5996
|
+
if (!btn.style.left && !btn.style.top) return;
|
|
5997
|
+
const rect = btn.getBoundingClientRect();
|
|
5998
|
+
const w = rect.width || 56;
|
|
5999
|
+
const h = rect.height || 56;
|
|
6000
|
+
const maxLeft = Math.max(0, window.innerWidth - w);
|
|
6001
|
+
const maxTop = Math.max(0, window.innerHeight - h);
|
|
6002
|
+
const curLeft = parseFloat(btn.style.left) || rect.left;
|
|
6003
|
+
const curTop = parseFloat(btn.style.top) || rect.top;
|
|
6004
|
+
const nextLeft = Math.max(0, Math.min(maxLeft, curLeft));
|
|
6005
|
+
const nextTop = Math.max(0, Math.min(maxTop, curTop));
|
|
6006
|
+
if (nextLeft !== curLeft || nextTop !== curTop) {
|
|
6007
|
+
btn.style.left = nextLeft + "px";
|
|
6008
|
+
btn.style.top = nextTop + "px";
|
|
6009
|
+
}
|
|
6010
|
+
}
|
|
5995
6011
|
function onDown(e) {
|
|
5996
6012
|
const rect = btn.getBoundingClientRect();
|
|
5997
6013
|
dragStartX = e.clientX;
|
|
@@ -6034,10 +6050,14 @@ function TriggerButton($$anchor, $$props) {
|
|
|
6034
6050
|
btn.addEventListener("pointerdown", onDown);
|
|
6035
6051
|
btn.addEventListener("pointermove", onMove);
|
|
6036
6052
|
btn.addEventListener("pointerup", onUp);
|
|
6053
|
+
window.addEventListener("resize", clampToViewport);
|
|
6054
|
+
window.visualViewport?.addEventListener("resize", clampToViewport);
|
|
6037
6055
|
return () => {
|
|
6038
6056
|
btn.removeEventListener("pointerdown", onDown);
|
|
6039
6057
|
btn.removeEventListener("pointermove", onMove);
|
|
6040
6058
|
btn.removeEventListener("pointerup", onUp);
|
|
6059
|
+
window.removeEventListener("resize", clampToViewport);
|
|
6060
|
+
window.visualViewport?.removeEventListener("resize", clampToViewport);
|
|
6041
6061
|
};
|
|
6042
6062
|
});
|
|
6043
6063
|
var button = root$5();
|
|
@@ -6643,14 +6663,14 @@ function FeatureGrid($$anchor, $$props) {
|
|
|
6643
6663
|
const FEATURE_LOADERS = {
|
|
6644
6664
|
contrast: () => import("./contrast-CqsOs6Uo.js"),
|
|
6645
6665
|
"text-size": () => import("./text-size-m_mHNPWo.js"),
|
|
6646
|
-
"keyboard-nav": () => import("./keyboard-nav-
|
|
6666
|
+
"keyboard-nav": () => import("./keyboard-nav-Ca6B6NGi.js"),
|
|
6647
6667
|
"link-highlight": () => import("./link-highlight-DBGm067Y.js"),
|
|
6648
6668
|
"reading-guide": () => import("./reading-guide-VT8NciIL.js"),
|
|
6649
6669
|
"reading-mask": () => import("./reading-mask-CImlx88t.js"),
|
|
6650
6670
|
"animation-stop": () => import("./animation-stop-C2Ced0LV.js"),
|
|
6651
6671
|
"hide-images": () => import("./hide-images-DdZdru63.js"),
|
|
6652
6672
|
"big-cursor": () => import("./big-cursor-B2UKu9dQ.js"),
|
|
6653
|
-
"page-structure": () => import("./page-structure-
|
|
6673
|
+
"page-structure": () => import("./page-structure-CMx_Jviw.js"),
|
|
6654
6674
|
tts: () => import("./tts-BytU4gzP.js"),
|
|
6655
6675
|
"text-simplify": () => import("./text-simplify-YuRRlyGQ.js"),
|
|
6656
6676
|
"alt-text": () => Promise.resolve().then(() => altText)
|
|
@@ -7397,6 +7417,25 @@ function WidgetApp($$anchor, $$props) {
|
|
|
7397
7417
|
let langDropdownOpen = /* @__PURE__ */ state(false);
|
|
7398
7418
|
let panelX = /* @__PURE__ */ state(null);
|
|
7399
7419
|
const PANEL_X_KEY = "accessify-panel-x";
|
|
7420
|
+
function estimatedPanelWidth() {
|
|
7421
|
+
if (get(panelEl) && get(panelEl).offsetWidth > 0) return get(panelEl).offsetWidth;
|
|
7422
|
+
const configured = config2().panelWidth;
|
|
7423
|
+
const fromConfig = typeof configured === "number" && configured > 0 ? configured : 420;
|
|
7424
|
+
return Math.min(fromConfig, window.innerWidth);
|
|
7425
|
+
}
|
|
7426
|
+
function clampPanelPosition() {
|
|
7427
|
+
if (get(panelX) === null) return;
|
|
7428
|
+
const panelW = estimatedPanelWidth();
|
|
7429
|
+
const maxLeft = Math.max(0, window.innerWidth - panelW);
|
|
7430
|
+
const clamped = Math.max(0, Math.min(maxLeft, get(panelX)));
|
|
7431
|
+
if (clamped !== get(panelX)) {
|
|
7432
|
+
set(panelX, clamped, true);
|
|
7433
|
+
try {
|
|
7434
|
+
localStorage.setItem(PANEL_X_KEY, String(clamped));
|
|
7435
|
+
} catch {
|
|
7436
|
+
}
|
|
7437
|
+
}
|
|
7438
|
+
}
|
|
7400
7439
|
const textTransformService = createTextTransformService();
|
|
7401
7440
|
const STORAGE_KEY = "accessify-prefs";
|
|
7402
7441
|
let activeCount = /* @__PURE__ */ user_derived(() => Array.from(get(activeFeatures).values()).filter(Boolean).length);
|
|
@@ -7416,10 +7455,12 @@ function WidgetApp($$anchor, $$props) {
|
|
|
7416
7455
|
}
|
|
7417
7456
|
const savedX = localStorage.getItem(PANEL_X_KEY);
|
|
7418
7457
|
if (savedX !== null) {
|
|
7419
|
-
|
|
7458
|
+
const n = parseFloat(savedX);
|
|
7459
|
+
set(panelX, Number.isFinite(n) && n >= 0 ? n : null, true);
|
|
7420
7460
|
}
|
|
7421
7461
|
} catch {
|
|
7422
7462
|
}
|
|
7463
|
+
clampPanelPosition();
|
|
7423
7464
|
}
|
|
7424
7465
|
function savePrefs() {
|
|
7425
7466
|
try {
|
|
@@ -7461,8 +7502,10 @@ function WidgetApp($$anchor, $$props) {
|
|
|
7461
7502
|
setCurrentWidgetLang(get(widgetLang));
|
|
7462
7503
|
}
|
|
7463
7504
|
function open() {
|
|
7505
|
+
clampPanelPosition();
|
|
7464
7506
|
set(isOpen, true);
|
|
7465
7507
|
requestAnimationFrame(() => {
|
|
7508
|
+
clampPanelPosition();
|
|
7466
7509
|
if (get(panelEl)) {
|
|
7467
7510
|
const first = get(panelEl).querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
|
|
7468
7511
|
first?.focus();
|
|
@@ -7580,6 +7623,16 @@ function WidgetApp($$anchor, $$props) {
|
|
|
7580
7623
|
document.body.style.overflow = prev;
|
|
7581
7624
|
};
|
|
7582
7625
|
});
|
|
7626
|
+
user_effect(() => {
|
|
7627
|
+
if (typeof window === "undefined") return;
|
|
7628
|
+
const onResize = () => clampPanelPosition();
|
|
7629
|
+
window.addEventListener("resize", onResize);
|
|
7630
|
+
window.visualViewport?.addEventListener("resize", onResize);
|
|
7631
|
+
return () => {
|
|
7632
|
+
window.removeEventListener("resize", onResize);
|
|
7633
|
+
window.visualViewport?.removeEventListener("resize", onResize);
|
|
7634
|
+
};
|
|
7635
|
+
});
|
|
7583
7636
|
onMount(() => {
|
|
7584
7637
|
set(widgetLang, getSupportedLang(config2().lang || "en"), true);
|
|
7585
7638
|
detectTheme();
|
|
@@ -9109,4 +9162,4 @@ export {
|
|
|
9109
9162
|
init as i,
|
|
9110
9163
|
t
|
|
9111
9164
|
};
|
|
9112
|
-
//# sourceMappingURL=index-
|
|
9165
|
+
//# sourceMappingURL=index-z-PPlD77.js.map
|