accessify-widget 0.3.1 → 0.3.2
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-CFoky8Ty.js → index-C9-1BpqV.js} +21 -178
- package/dist/{index-CFoky8Ty.js.map → index-C9-1BpqV.js.map} +1 -1
- package/dist/{keyboard-nav-B66DnefL.js → keyboard-nav-DF9rgWAV.js} +2 -2
- package/dist/{keyboard-nav-B66DnefL.js.map → keyboard-nav-DF9rgWAV.js.map} +1 -1
- package/dist/{page-structure-C76rueHv.js → page-structure-BcyV93JT.js} +2 -2
- package/dist/{page-structure-C76rueHv.js.map → page-structure-BcyV93JT.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
|
@@ -6433,14 +6433,14 @@ function FeatureGrid($$anchor, $$props) {
|
|
|
6433
6433
|
const FEATURE_LOADERS = {
|
|
6434
6434
|
contrast: () => import("./contrast-CqsICAkU.js"),
|
|
6435
6435
|
"text-size": () => import("./text-size-C6OFhCGi.js"),
|
|
6436
|
-
"keyboard-nav": () => import("./keyboard-nav-
|
|
6436
|
+
"keyboard-nav": () => import("./keyboard-nav-DF9rgWAV.js"),
|
|
6437
6437
|
"link-highlight": () => import("./link-highlight-DBGm067Y.js"),
|
|
6438
6438
|
"reading-guide": () => import("./reading-guide-VT8NciIL.js"),
|
|
6439
6439
|
"reading-mask": () => import("./reading-mask-BABChuCz.js"),
|
|
6440
6440
|
"animation-stop": () => import("./animation-stop-C0MwseK0.js"),
|
|
6441
6441
|
"hide-images": () => import("./hide-images-B_LeCBcd.js"),
|
|
6442
6442
|
"big-cursor": () => import("./big-cursor-B2UKu9dQ.js"),
|
|
6443
|
-
"page-structure": () => import("./page-structure-
|
|
6443
|
+
"page-structure": () => import("./page-structure-BcyV93JT.js"),
|
|
6444
6444
|
tts: () => import("./tts-CjszLRnb.js"),
|
|
6445
6445
|
"text-simplify": () => import("./text-simplify-Cvhpio7g.js"),
|
|
6446
6446
|
"alt-text": () => Promise.resolve().then(() => altText)
|
|
@@ -7959,7 +7959,6 @@ async function autoApplyCachedAltTexts(widgetConfig) {
|
|
|
7959
7959
|
const cached = cache.get(src) || cache.get(normalizeImageUrl(src)) || cache.get(img.src);
|
|
7960
7960
|
if (cached) {
|
|
7961
7961
|
img.setAttribute("alt", cached);
|
|
7962
|
-
img.setAttribute("title", cached);
|
|
7963
7962
|
img.setAttribute("data-accessify-alt", "auto");
|
|
7964
7963
|
return true;
|
|
7965
7964
|
}
|
|
@@ -7986,7 +7985,6 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
7986
7985
|
const proxyUrl = serverConfig?.proxyUrl || "";
|
|
7987
7986
|
let enabled = false;
|
|
7988
7987
|
let styleEl = null;
|
|
7989
|
-
let badgeEl = null;
|
|
7990
7988
|
let tooltipEl = null;
|
|
7991
7989
|
let domObserver = null;
|
|
7992
7990
|
let autoGenerating = false;
|
|
@@ -8002,38 +8000,8 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
8002
8000
|
return lang().startsWith("de");
|
|
8003
8001
|
}
|
|
8004
8002
|
const STYLE_ID = "accessify-alt-text-styles";
|
|
8005
|
-
const HIGHLIGHT_CLASS = "accessify-alt-missing";
|
|
8006
8003
|
function getStyles() {
|
|
8007
8004
|
return `
|
|
8008
|
-
.${HIGHLIGHT_CLASS} {
|
|
8009
|
-
outline: 3px dashed #e63946 !important;
|
|
8010
|
-
outline-offset: 3px !important;
|
|
8011
|
-
position: relative !important;
|
|
8012
|
-
}
|
|
8013
|
-
.${HIGHLIGHT_CLASS}.accessify-alt-generating::after {
|
|
8014
|
-
content: '\\2026';
|
|
8015
|
-
position: absolute;
|
|
8016
|
-
top: 4px;
|
|
8017
|
-
left: 4px;
|
|
8018
|
-
padding: 2px 6px;
|
|
8019
|
-
background: #f77f00;
|
|
8020
|
-
color: #fff;
|
|
8021
|
-
font-family: system-ui, -apple-system, sans-serif;
|
|
8022
|
-
font-size: 10px;
|
|
8023
|
-
font-weight: 700;
|
|
8024
|
-
border-radius: 3px;
|
|
8025
|
-
line-height: 1.4;
|
|
8026
|
-
pointer-events: none;
|
|
8027
|
-
z-index: 1;
|
|
8028
|
-
}
|
|
8029
|
-
.${HIGHLIGHT_CLASS}.accessify-alt-done {
|
|
8030
|
-
outline-color: #2a9d8f !important;
|
|
8031
|
-
outline-style: solid !important;
|
|
8032
|
-
}
|
|
8033
|
-
.${HIGHLIGHT_CLASS}.accessify-alt-done::after {
|
|
8034
|
-
content: none;
|
|
8035
|
-
}
|
|
8036
|
-
|
|
8037
8005
|
img[data-a11y-describable="true"]:not([data-a11y-is-link="true"]) {
|
|
8038
8006
|
cursor: help !important;
|
|
8039
8007
|
}
|
|
@@ -8048,8 +8016,8 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
8048
8016
|
padding: 0;
|
|
8049
8017
|
border: none;
|
|
8050
8018
|
border-radius: 50%;
|
|
8051
|
-
background: rgba(
|
|
8052
|
-
color: #
|
|
8019
|
+
background: rgba(0, 0, 0, 0.55);
|
|
8020
|
+
color: #fff;
|
|
8053
8021
|
font-family: system-ui, -apple-system, sans-serif;
|
|
8054
8022
|
font-size: 14px;
|
|
8055
8023
|
font-weight: 700;
|
|
@@ -8059,60 +8027,44 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
8059
8027
|
opacity: 0;
|
|
8060
8028
|
transition: opacity 0.15s ease;
|
|
8061
8029
|
backdrop-filter: blur(4px);
|
|
8062
|
-
box-shadow: 0 2px 8px rgba(0,0,0,0.3);
|
|
8063
8030
|
}
|
|
8064
8031
|
img[data-a11y-is-link="true"]:hover ~ .accessify-describe-btn,
|
|
8065
8032
|
.accessify-describe-btn:hover {
|
|
8066
8033
|
opacity: 1;
|
|
8067
8034
|
}
|
|
8068
8035
|
.accessify-describe-btn:hover {
|
|
8069
|
-
background: rgba(
|
|
8070
|
-
color: #fff;
|
|
8036
|
+
background: rgba(0, 0, 0, 0.75);
|
|
8071
8037
|
}
|
|
8072
8038
|
|
|
8073
8039
|
.accessify-describe-tooltip {
|
|
8074
8040
|
position: fixed;
|
|
8075
8041
|
z-index: 2147483647;
|
|
8076
|
-
max-width:
|
|
8077
|
-
padding: 14px
|
|
8078
|
-
background:
|
|
8079
|
-
color: #
|
|
8080
|
-
border-radius:
|
|
8081
|
-
|
|
8042
|
+
max-width: 320px;
|
|
8043
|
+
padding: 10px 14px;
|
|
8044
|
+
background: rgba(0, 0, 0, 0.75);
|
|
8045
|
+
color: #fff;
|
|
8046
|
+
border-radius: 8px;
|
|
8047
|
+
backdrop-filter: blur(8px);
|
|
8082
8048
|
font-family: system-ui, -apple-system, sans-serif;
|
|
8083
|
-
font-size:
|
|
8084
|
-
line-height: 1.
|
|
8049
|
+
font-size: 13px;
|
|
8050
|
+
line-height: 1.5;
|
|
8085
8051
|
word-break: break-word;
|
|
8086
|
-
animation: accessify-fade-in 0.
|
|
8087
|
-
|
|
8088
|
-
.accessify-describe-tooltip .accessify-describe-close {
|
|
8089
|
-
position: absolute;
|
|
8090
|
-
top: 6px;
|
|
8091
|
-
right: 8px;
|
|
8092
|
-
background: none;
|
|
8093
|
-
border: none;
|
|
8094
|
-
color: #888;
|
|
8095
|
-
font-size: 16px;
|
|
8096
|
-
cursor: pointer;
|
|
8097
|
-
padding: 2px 6px;
|
|
8098
|
-
line-height: 1;
|
|
8099
|
-
}
|
|
8100
|
-
.accessify-describe-tooltip .accessify-describe-close:hover {
|
|
8101
|
-
color: #fff;
|
|
8052
|
+
animation: accessify-fade-in 0.12s ease;
|
|
8053
|
+
pointer-events: auto;
|
|
8102
8054
|
}
|
|
8103
8055
|
.accessify-describe-loading {
|
|
8104
8056
|
display: flex;
|
|
8105
8057
|
align-items: center;
|
|
8106
8058
|
gap: 8px;
|
|
8107
|
-
color: #
|
|
8059
|
+
color: #ddd;
|
|
8108
8060
|
font-style: italic;
|
|
8109
8061
|
}
|
|
8110
8062
|
.accessify-describe-loading::before {
|
|
8111
8063
|
content: '';
|
|
8112
|
-
width:
|
|
8113
|
-
height:
|
|
8114
|
-
border: 2px solid
|
|
8115
|
-
border-top-color: #
|
|
8064
|
+
width: 12px;
|
|
8065
|
+
height: 12px;
|
|
8066
|
+
border: 2px solid rgba(255,255,255,0.3);
|
|
8067
|
+
border-top-color: #fff;
|
|
8116
8068
|
border-radius: 50%;
|
|
8117
8069
|
animation: accessify-spin 0.8s linear infinite;
|
|
8118
8070
|
}
|
|
@@ -8123,37 +8075,6 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
8123
8075
|
from { opacity: 0; transform: translateY(4px); }
|
|
8124
8076
|
to { opacity: 1; transform: translateY(0); }
|
|
8125
8077
|
}
|
|
8126
|
-
|
|
8127
|
-
.accessify-alt-badge {
|
|
8128
|
-
position: fixed;
|
|
8129
|
-
top: 12px;
|
|
8130
|
-
right: 12px;
|
|
8131
|
-
z-index: 2147483646;
|
|
8132
|
-
display: flex;
|
|
8133
|
-
align-items: center;
|
|
8134
|
-
gap: 6px;
|
|
8135
|
-
padding: 8px 14px;
|
|
8136
|
-
background: #1a1a2e;
|
|
8137
|
-
color: #f0f0f0;
|
|
8138
|
-
border-radius: 8px;
|
|
8139
|
-
box-shadow: 0 4px 16px rgba(0,0,0,0.3);
|
|
8140
|
-
font-family: system-ui, -apple-system, sans-serif;
|
|
8141
|
-
font-size: 13px;
|
|
8142
|
-
user-select: none;
|
|
8143
|
-
}
|
|
8144
|
-
.accessify-alt-badge-count {
|
|
8145
|
-
display: inline-flex;
|
|
8146
|
-
align-items: center;
|
|
8147
|
-
justify-content: center;
|
|
8148
|
-
min-width: 22px;
|
|
8149
|
-
height: 22px;
|
|
8150
|
-
padding: 0 6px;
|
|
8151
|
-
background: #e63946;
|
|
8152
|
-
color: #fff;
|
|
8153
|
-
font-size: 12px;
|
|
8154
|
-
font-weight: 700;
|
|
8155
|
-
border-radius: 11px;
|
|
8156
|
-
}
|
|
8157
8078
|
`;
|
|
8158
8079
|
}
|
|
8159
8080
|
function injectStyles() {
|
|
@@ -8172,15 +8093,6 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
8172
8093
|
hideDescribeTooltip();
|
|
8173
8094
|
const tip = document.createElement("div");
|
|
8174
8095
|
tip.className = "accessify-describe-tooltip";
|
|
8175
|
-
const closeBtn = document.createElement("button");
|
|
8176
|
-
closeBtn.className = "accessify-describe-close";
|
|
8177
|
-
closeBtn.textContent = "×";
|
|
8178
|
-
closeBtn.setAttribute("aria-label", "Close");
|
|
8179
|
-
closeBtn.addEventListener("click", (e) => {
|
|
8180
|
-
e.stopPropagation();
|
|
8181
|
-
hideDescribeTooltip();
|
|
8182
|
-
});
|
|
8183
|
-
tip.appendChild(closeBtn);
|
|
8184
8096
|
if (loading) {
|
|
8185
8097
|
const loadingEl = document.createElement("div");
|
|
8186
8098
|
loadingEl.className = "accessify-describe-loading";
|
|
@@ -8237,7 +8149,6 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
8237
8149
|
const altText2 = await aiService.generateAltText(src, ctx, lang());
|
|
8238
8150
|
if (altText2) {
|
|
8239
8151
|
img.setAttribute("alt", altText2);
|
|
8240
|
-
img.setAttribute("title", altText2);
|
|
8241
8152
|
setCachedAltText(src, altText2, lang()).catch(() => {
|
|
8242
8153
|
});
|
|
8243
8154
|
if (siteKey) persistAltTextToServer(siteKey, proxyUrl, src, altText2, lang());
|
|
@@ -8382,12 +8293,7 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
8382
8293
|
}
|
|
8383
8294
|
function applyAltText(img, altText2) {
|
|
8384
8295
|
img.setAttribute("alt", altText2);
|
|
8385
|
-
img.setAttribute("title", altText2);
|
|
8386
8296
|
processedImages.set(img, { generatedAlt: altText2 });
|
|
8387
|
-
if (enabled) {
|
|
8388
|
-
img.classList.add("accessify-alt-done");
|
|
8389
|
-
img.classList.remove("accessify-alt-generating");
|
|
8390
|
-
}
|
|
8391
8297
|
}
|
|
8392
8298
|
async function generateAll() {
|
|
8393
8299
|
if (autoGenerating || !enabled || !aiService) return;
|
|
@@ -8404,12 +8310,10 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
8404
8310
|
uncached.push(img);
|
|
8405
8311
|
}
|
|
8406
8312
|
}
|
|
8407
|
-
updateBadge();
|
|
8408
8313
|
if (!uncached.length) {
|
|
8409
8314
|
autoGenerating = false;
|
|
8410
8315
|
return;
|
|
8411
8316
|
}
|
|
8412
|
-
uncached.forEach((img) => img.classList.add("accessify-alt-generating"));
|
|
8413
8317
|
for (let i = 0; i < uncached.length; i += CONCURRENCY) {
|
|
8414
8318
|
if (!enabled) break;
|
|
8415
8319
|
const batch = uncached.slice(i, i + CONCURRENCY);
|
|
@@ -8427,10 +8331,8 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
8427
8331
|
}
|
|
8428
8332
|
} catch (err) {
|
|
8429
8333
|
console.warn("[Accessify] Alt-text generation failed:", getImageSrc(img), err);
|
|
8430
|
-
img.classList.remove("accessify-alt-generating");
|
|
8431
8334
|
}
|
|
8432
8335
|
}));
|
|
8433
|
-
updateBadge();
|
|
8434
8336
|
}
|
|
8435
8337
|
autoGenerating = false;
|
|
8436
8338
|
}
|
|
@@ -8443,7 +8345,6 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
8443
8345
|
updateBadge();
|
|
8444
8346
|
return;
|
|
8445
8347
|
}
|
|
8446
|
-
img.classList.add("accessify-alt-generating");
|
|
8447
8348
|
try {
|
|
8448
8349
|
const ctx = gatherImageContext(img);
|
|
8449
8350
|
const alt = await aiService.generateAltText(src, ctx, lang());
|
|
@@ -8452,60 +8353,11 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
8452
8353
|
setCachedAltText(src, alt, lang()).catch(() => {
|
|
8453
8354
|
});
|
|
8454
8355
|
if (siteKey) persistAltTextToServer(siteKey, proxyUrl, src, alt, lang());
|
|
8455
|
-
updateBadge();
|
|
8456
8356
|
}
|
|
8457
8357
|
} catch (err) {
|
|
8458
8358
|
console.warn("[Accessify] Alt-text generation failed:", src, err);
|
|
8459
|
-
img.classList.remove("accessify-alt-generating");
|
|
8460
8359
|
}
|
|
8461
8360
|
}
|
|
8462
|
-
function updateBadge() {
|
|
8463
|
-
removeBadge();
|
|
8464
|
-
const remaining = missingAltImages.filter((img) => !processedImages.has(img)).length;
|
|
8465
|
-
const generating = missingAltImages.filter((img) => img.classList.contains("accessify-alt-generating")).length;
|
|
8466
|
-
if (generating > 0) {
|
|
8467
|
-
showBadge(isDE() ? `${generating} Bilder werden analysiert…` : `Analyzing ${generating} images…`, "#f77f00", generating);
|
|
8468
|
-
return;
|
|
8469
|
-
}
|
|
8470
|
-
if (remaining === 0 && processedImages.size > 0) {
|
|
8471
|
-
showBadge(
|
|
8472
|
-
isDE() ? `✓ ${processedImages.size} Bildbeschreibungen erstellt` : `✓ ${processedImages.size} descriptions generated`,
|
|
8473
|
-
"#2a9d8f",
|
|
8474
|
-
0
|
|
8475
|
-
);
|
|
8476
|
-
setTimeout(() => removeBadge(), 6e3);
|
|
8477
|
-
return;
|
|
8478
|
-
}
|
|
8479
|
-
if (remaining > 0) {
|
|
8480
|
-
showBadge(
|
|
8481
|
-
isDE() ? `${remaining} Bilder ohne Beschreibung` : `${remaining} images without description`,
|
|
8482
|
-
"#e63946",
|
|
8483
|
-
remaining
|
|
8484
|
-
);
|
|
8485
|
-
}
|
|
8486
|
-
}
|
|
8487
|
-
function showBadge(text, color, count) {
|
|
8488
|
-
const badge = document.createElement("div");
|
|
8489
|
-
badge.className = "accessify-alt-badge";
|
|
8490
|
-
badge.setAttribute("role", "status");
|
|
8491
|
-
badge.setAttribute("aria-live", "polite");
|
|
8492
|
-
if (count > 0) {
|
|
8493
|
-
const c = document.createElement("span");
|
|
8494
|
-
c.className = "accessify-alt-badge-count";
|
|
8495
|
-
c.style.background = color;
|
|
8496
|
-
c.textContent = String(count);
|
|
8497
|
-
badge.appendChild(c);
|
|
8498
|
-
}
|
|
8499
|
-
const label = document.createElement("span");
|
|
8500
|
-
label.textContent = text;
|
|
8501
|
-
badge.appendChild(label);
|
|
8502
|
-
document.body.appendChild(badge);
|
|
8503
|
-
badgeEl = badge;
|
|
8504
|
-
}
|
|
8505
|
-
function removeBadge() {
|
|
8506
|
-
badgeEl?.remove();
|
|
8507
|
-
badgeEl = null;
|
|
8508
|
-
}
|
|
8509
8361
|
function tryRegisterImage(img) {
|
|
8510
8362
|
if (!enabled) return;
|
|
8511
8363
|
if (img.closest("#accessify-root")) return;
|
|
@@ -8515,9 +8367,7 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
8515
8367
|
if (img.naturalWidth < 20 || img.naturalHeight < 20) return;
|
|
8516
8368
|
markImageDescribable(img);
|
|
8517
8369
|
if (needsAltText(img)) {
|
|
8518
|
-
img.classList.add(HIGHLIGHT_CLASS);
|
|
8519
8370
|
missingAltImages.push(img);
|
|
8520
|
-
updateBadge();
|
|
8521
8371
|
generateSingle(img);
|
|
8522
8372
|
}
|
|
8523
8373
|
}
|
|
@@ -8534,17 +8384,14 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
8534
8384
|
if (!processedImages.has(img)) {
|
|
8535
8385
|
processedImages.set(img, { generatedAlt: img.getAttribute("alt") || "" });
|
|
8536
8386
|
missingAltImages.push(img);
|
|
8537
|
-
img.classList.add(HIGHLIGHT_CLASS, "accessify-alt-done");
|
|
8538
8387
|
}
|
|
8539
8388
|
});
|
|
8540
8389
|
const missing = scanForMissingAlt();
|
|
8541
8390
|
for (const img of missing) {
|
|
8542
8391
|
if (!missingAltImages.includes(img)) {
|
|
8543
8392
|
missingAltImages.push(img);
|
|
8544
|
-
img.classList.add(HIGHLIGHT_CLASS);
|
|
8545
8393
|
}
|
|
8546
8394
|
}
|
|
8547
|
-
updateBadge();
|
|
8548
8395
|
generateAll();
|
|
8549
8396
|
enableClickToDescribe();
|
|
8550
8397
|
document.querySelectorAll("img").forEach((img) => {
|
|
@@ -8578,10 +8425,6 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
|
|
|
8578
8425
|
domObserver?.disconnect();
|
|
8579
8426
|
domObserver = null;
|
|
8580
8427
|
disableClickToDescribe();
|
|
8581
|
-
removeBadge();
|
|
8582
|
-
missingAltImages.forEach((img) => {
|
|
8583
|
-
img.classList.remove(HIGHLIGHT_CLASS, "accessify-alt-done", "accessify-alt-generating");
|
|
8584
|
-
});
|
|
8585
8428
|
missingAltImages = [];
|
|
8586
8429
|
removeStyles();
|
|
8587
8430
|
}
|
|
@@ -8796,4 +8639,4 @@ export {
|
|
|
8796
8639
|
init as i,
|
|
8797
8640
|
t
|
|
8798
8641
|
};
|
|
8799
|
-
//# sourceMappingURL=index-
|
|
8642
|
+
//# sourceMappingURL=index-C9-1BpqV.js.map
|