accessify-widget 0.3.102 → 0.3.104
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-Bsfz4nea.js} +85 -4
- package/dist/{index-CyZv4-2d.js.map → index-Bsfz4nea.js.map} +1 -1
- package/dist/{keyboard-nav-BYl36wkS.js → keyboard-nav-Ce7uj953.js} +2 -2
- package/dist/{keyboard-nav-BYl36wkS.js.map → keyboard-nav-Ce7uj953.js.map} +1 -1
- package/dist/loader.min.js +1 -1
- package/dist/{page-structure-DkNwkCP-.js → page-structure-Bj5tC7r4.js} +2 -2
- package/dist/{page-structure-DkNwkCP-.js.map → page-structure-Bj5tC7r4.js.map} +1 -1
- package/dist/widget.js +1 -1
- package/dist/widget.js.map +1 -1
- package/package.json +3 -2
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-Ce7uj953.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-Bj5tC7r4.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,8 +7417,54 @@ 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";
|
|
7441
|
+
const SCHEMA_VERSION = 1;
|
|
7442
|
+
const SCHEMA_KEY = "accessify-schema-version";
|
|
7443
|
+
const MIGRATIONS = [
|
|
7444
|
+
// Future entries: { from: 1, to: 2, run: () => localStorage.removeItem('…') }
|
|
7445
|
+
];
|
|
7446
|
+
function runSchemaMigrations() {
|
|
7447
|
+
try {
|
|
7448
|
+
let stored = parseInt(localStorage.getItem(SCHEMA_KEY) || "0", 10);
|
|
7449
|
+
if (!Number.isFinite(stored) || stored < 0) stored = 0;
|
|
7450
|
+
if (stored === 0 && localStorage.getItem(SCHEMA_KEY) === null) {
|
|
7451
|
+
localStorage.setItem(SCHEMA_KEY, String(SCHEMA_VERSION));
|
|
7452
|
+
return;
|
|
7453
|
+
}
|
|
7454
|
+
if (stored === SCHEMA_VERSION) return;
|
|
7455
|
+
while (stored < SCHEMA_VERSION) {
|
|
7456
|
+
const mig = MIGRATIONS.find((m) => m.from === stored);
|
|
7457
|
+
if (!mig) break;
|
|
7458
|
+
try {
|
|
7459
|
+
mig.run();
|
|
7460
|
+
} catch {
|
|
7461
|
+
}
|
|
7462
|
+
stored = mig.to;
|
|
7463
|
+
}
|
|
7464
|
+
localStorage.setItem(SCHEMA_KEY, String(SCHEMA_VERSION));
|
|
7465
|
+
} catch {
|
|
7466
|
+
}
|
|
7467
|
+
}
|
|
7402
7468
|
let activeCount = /* @__PURE__ */ user_derived(() => Array.from(get(activeFeatures).values()).filter(Boolean).length);
|
|
7403
7469
|
let currentLangOption = /* @__PURE__ */ user_derived(() => LANGUAGE_OPTIONS.find((o) => o.code === get(widgetLang)));
|
|
7404
7470
|
function announce(message) {
|
|
@@ -7416,10 +7482,12 @@ function WidgetApp($$anchor, $$props) {
|
|
|
7416
7482
|
}
|
|
7417
7483
|
const savedX = localStorage.getItem(PANEL_X_KEY);
|
|
7418
7484
|
if (savedX !== null) {
|
|
7419
|
-
|
|
7485
|
+
const n = parseFloat(savedX);
|
|
7486
|
+
set(panelX, Number.isFinite(n) && n >= 0 ? n : null, true);
|
|
7420
7487
|
}
|
|
7421
7488
|
} catch {
|
|
7422
7489
|
}
|
|
7490
|
+
clampPanelPosition();
|
|
7423
7491
|
}
|
|
7424
7492
|
function savePrefs() {
|
|
7425
7493
|
try {
|
|
@@ -7461,8 +7529,10 @@ function WidgetApp($$anchor, $$props) {
|
|
|
7461
7529
|
setCurrentWidgetLang(get(widgetLang));
|
|
7462
7530
|
}
|
|
7463
7531
|
function open() {
|
|
7532
|
+
clampPanelPosition();
|
|
7464
7533
|
set(isOpen, true);
|
|
7465
7534
|
requestAnimationFrame(() => {
|
|
7535
|
+
clampPanelPosition();
|
|
7466
7536
|
if (get(panelEl)) {
|
|
7467
7537
|
const first = get(panelEl).querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
|
|
7468
7538
|
first?.focus();
|
|
@@ -7580,8 +7650,19 @@ function WidgetApp($$anchor, $$props) {
|
|
|
7580
7650
|
document.body.style.overflow = prev;
|
|
7581
7651
|
};
|
|
7582
7652
|
});
|
|
7653
|
+
user_effect(() => {
|
|
7654
|
+
if (typeof window === "undefined") return;
|
|
7655
|
+
const onResize = () => clampPanelPosition();
|
|
7656
|
+
window.addEventListener("resize", onResize);
|
|
7657
|
+
window.visualViewport?.addEventListener("resize", onResize);
|
|
7658
|
+
return () => {
|
|
7659
|
+
window.removeEventListener("resize", onResize);
|
|
7660
|
+
window.visualViewport?.removeEventListener("resize", onResize);
|
|
7661
|
+
};
|
|
7662
|
+
});
|
|
7583
7663
|
onMount(() => {
|
|
7584
7664
|
set(widgetLang, getSupportedLang(config2().lang || "en"), true);
|
|
7665
|
+
runSchemaMigrations();
|
|
7585
7666
|
detectTheme();
|
|
7586
7667
|
applyTheme();
|
|
7587
7668
|
loadPrefs();
|
|
@@ -9109,4 +9190,4 @@ export {
|
|
|
9109
9190
|
init as i,
|
|
9110
9191
|
t
|
|
9111
9192
|
};
|
|
9112
|
-
//# sourceMappingURL=index-
|
|
9193
|
+
//# sourceMappingURL=index-Bsfz4nea.js.map
|