@kinti/a11y-toolkit 5.22.1 → 5.22.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/a11y_toolkit/__init__.py +5 -0
- package/a11y_toolkit/a11y.py +115 -0
- package/a11y_toolkit/a11yact.py +167 -0
- package/a11y_toolkit/a11yaudit.py +1951 -0
- package/a11y_toolkit/a11ybadge.py +102 -0
- package/a11y_toolkit/a11ybudget.py +122 -0
- package/a11y_toolkit/a11ycrit.py +1017 -0
- package/a11y_toolkit/a11ydiff.py +192 -0
- package/a11y_toolkit/a11ydisprove.py +175 -0
- package/a11y_toolkit/a11ydocx.py +132 -0
- package/a11y_toolkit/a11ydom.py +1831 -0
- package/a11y_toolkit/a11yevidence.py +272 -0
- package/a11y_toolkit/a11yfix.py +330 -0
- package/a11y_toolkit/a11yi18n.py +100 -0
- package/a11y_toolkit/a11yinit.py +113 -0
- package/a11y_toolkit/a11yjourney.py +284 -0
- package/a11y_toolkit/a11yledger.py +210 -0
- package/a11y_toolkit/a11ymutants.py +406 -0
- package/a11y_toolkit/a11yopenacr.py +207 -0
- package/a11y_toolkit/a11ypdf.py +273 -0
- package/a11y_toolkit/a11yroute.py +378 -0
- package/a11y_toolkit/a11ysarif.py +139 -0
- package/a11y_toolkit/a11yscroll.py +212 -0
- package/a11y_toolkit/a11ystatement.py +158 -0
- package/a11y_toolkit/a11yvalidate.py +127 -0
- package/a11y_toolkit/a11yvpat.py +238 -0
- package/a11y_toolkit/a11yvtt.py +136 -0
- package/a11y_toolkit/a11ywcag3.py +262 -0
- package/a11y_toolkit/arialive.js +107 -0
- package/a11y_toolkit/arialive_js.py +113 -0
- package/a11y_toolkit/contrast.py +536 -0
- package/a11y_toolkit/locales/_template.json +468 -0
- package/a11y_toolkit/locales/en.json +525 -0
- package/a11y_toolkit/locales/es.json +525 -0
- package/a11y_toolkit/server.py +1529 -0
- package/package.json +2 -1
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/* Monitor de anuncios aria-live · v1.0 · jquin.net/lab
|
|
2
|
+
* Inyectable como bookmarklet o vía Playwright (page.evaluate).
|
|
3
|
+
* Registra cada anuncio de regiones dinámicas (aria-live, role=alert/status/
|
|
4
|
+
* log) con hora, cortesía, rol y texto — lo que un lector de pantalla
|
|
5
|
+
* "diría", visible en pantalla. Sin dependencias.
|
|
6
|
+
*/
|
|
7
|
+
(function () {
|
|
8
|
+
'use strict';
|
|
9
|
+
var LANG = (window.ALM_LANG === 'en')
|
|
10
|
+
? { titulo: 'aria-live monitor', copiar: 'Copy', cerrar: 'Close',
|
|
11
|
+
label: 'aria-live announcement monitor' }
|
|
12
|
+
: { titulo: 'aria-live monitor', copiar: 'Copiar', cerrar: 'Cerrar',
|
|
13
|
+
label: 'Monitor de anuncios aria-live' };
|
|
14
|
+
if (window.__ariaLiveMonitor) { window.__ariaLiveMonitor(); return; }
|
|
15
|
+
var SEL = '[aria-live],[role=alert],[role=status],[role=log],[role=marquee],[role=timer]';
|
|
16
|
+
var log = [];
|
|
17
|
+
var observados = new WeakSet();
|
|
18
|
+
|
|
19
|
+
var css = document.createElement('style');
|
|
20
|
+
css.textContent = '.alm-panel{position:fixed;bottom:12px;right:12px;z-index:2147483647;' +
|
|
21
|
+
'width:min(420px,90vw);max-height:45vh;overflow:auto;background:#111;color:#fff;' +
|
|
22
|
+
'font:12px/1.5 ui-monospace,monospace;border:2px solid #ffd33d;border-radius:8px;padding:8px}' +
|
|
23
|
+
'.alm-panel button{background:#ffd33d;color:#111;border:0;border-radius:4px;padding:3px 8px;' +
|
|
24
|
+
'font:inherit;cursor:pointer;margin-left:6px}' +
|
|
25
|
+
'.alm-e{padding:4px 6px;border-bottom:1px solid #333;white-space:pre-wrap}' +
|
|
26
|
+
'.alm-t{color:#ffd33d}.alm-e b{color:#8ec2f5}';
|
|
27
|
+
document.head.appendChild(css);
|
|
28
|
+
|
|
29
|
+
var panel = document.createElement('div');
|
|
30
|
+
panel.className = 'alm-panel';
|
|
31
|
+
// Sin role="log" a propósito: una región viva casaría con nuestro propio
|
|
32
|
+
// selector y crearía un bucle de auto-observación infinito.
|
|
33
|
+
panel.setAttribute('aria-label', LANG.label);
|
|
34
|
+
panel.innerHTML = '<div><span class="alm-t">' + LANG.titulo + '</span>' +
|
|
35
|
+
'<button type="button" data-alm="copy">' + LANG.copiar + '</button>' +
|
|
36
|
+
'<button type="button" data-alm="close">' + LANG.cerrar + '</button></div><div data-alm="log"></div>';
|
|
37
|
+
document.body.appendChild(panel);
|
|
38
|
+
var cont = panel.querySelector('[data-alm=log]');
|
|
39
|
+
|
|
40
|
+
function desc(el) {
|
|
41
|
+
var d = el.tagName.toLowerCase();
|
|
42
|
+
if (el.id) d += '#' + el.id;
|
|
43
|
+
else if (el.className && typeof el.className === 'string')
|
|
44
|
+
d += '.' + el.className.trim().split(/\s+/).slice(0, 2).join('.');
|
|
45
|
+
return d;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function anota(el, razon) {
|
|
49
|
+
var rol = el.getAttribute('role') || '(sin role)';
|
|
50
|
+
var cortesia = el.getAttribute('aria-live') ||
|
|
51
|
+
({ alert: 'assertive', status: 'polite', log: 'polite',
|
|
52
|
+
marquee: 'off', timer: 'off' })[el.getAttribute('role')] || 'polite';
|
|
53
|
+
var texto = (el.innerText || el.textContent || '').trim().replace(/\s+/g, ' ').slice(0, 220);
|
|
54
|
+
var hora = new Date().toTimeString().slice(0, 8);
|
|
55
|
+
log.push(hora + ' [' + cortesia + '] ' + rol + ' · ' + desc(el) + ' · ' + texto);
|
|
56
|
+
var fila = document.createElement('div');
|
|
57
|
+
fila.className = 'alm-e';
|
|
58
|
+
// DOM-safe: el contenido de la página auditada NUNCA va a innerHTML
|
|
59
|
+
var t = document.createElement('span'); t.className = 'alm-t'; t.textContent = hora;
|
|
60
|
+
fila.appendChild(t);
|
|
61
|
+
fila.appendChild(document.createTextNode(' [' + cortesia + '] '));
|
|
62
|
+
var b = document.createElement('b'); b.textContent = rol; fila.appendChild(b);
|
|
63
|
+
fila.appendChild(document.createTextNode(' \u00b7 ' + desc(el)));
|
|
64
|
+
if (razon) {
|
|
65
|
+
var i = document.createElement('i'); i.textContent = ' (' + razon + ')';
|
|
66
|
+
fila.appendChild(i);
|
|
67
|
+
}
|
|
68
|
+
fila.appendChild(document.createElement('br'));
|
|
69
|
+
fila.appendChild(document.createTextNode(texto));
|
|
70
|
+
cont.appendChild(fila);
|
|
71
|
+
panel.scrollTop = panel.scrollHeight;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function vigila(el) {
|
|
75
|
+
if (!el || observados.has(el) || el.nodeType !== 1) return;
|
|
76
|
+
// Nunca monitorizar nuestro propio panel (bucle de auto-observación).
|
|
77
|
+
if (el.closest && el.closest('.alm-panel')) return;
|
|
78
|
+
if (!el.matches(SEL)) return;
|
|
79
|
+
observados.add(el);
|
|
80
|
+
if (el.getAttribute('role') === 'alert') anota(el, 'insertado');
|
|
81
|
+
new MutationObserver(function () {
|
|
82
|
+
anota(el, null);
|
|
83
|
+
}).observe(el, { childList: true, characterData: true, subtree: true });
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
document.querySelectorAll(SEL).forEach(function (el) { vigila(el); });
|
|
87
|
+
|
|
88
|
+
new MutationObserver(function (muts) {
|
|
89
|
+
muts.forEach(function (m) {
|
|
90
|
+
m.addedNodes.forEach(function (n) {
|
|
91
|
+
if (n.nodeType !== 1) return;
|
|
92
|
+
vigila(n);
|
|
93
|
+
if (n.querySelectorAll) n.querySelectorAll(SEL).forEach(vigila);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
}).observe(document.body, { childList: true, subtree: true });
|
|
97
|
+
|
|
98
|
+
panel.addEventListener('click', function (ev) {
|
|
99
|
+
var b = ev.target.closest('button');
|
|
100
|
+
if (!b) return;
|
|
101
|
+
if (b.dataset.alm === 'close') { panel.remove(); css.remove(); delete window.__ariaLiveMonitor; }
|
|
102
|
+
if (b.dataset.alm === 'copy' && navigator.clipboard)
|
|
103
|
+
navigator.clipboard.writeText(log.join('\n'));
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
window.__ariaLiveMonitor = function () { panel.remove(); css.remove(); delete window.__ariaLiveMonitor; };
|
|
107
|
+
})();
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"""Embedded aria-live monitor JS (arialive.js) so pip installs can read it.
|
|
2
|
+
|
|
3
|
+
Regenerated from arialive.js — edit that file, then regenerate this one.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
ARIALIVE_JS = r"""/* Monitor de anuncios aria-live · v1.0 · jquin.net/lab
|
|
7
|
+
* Inyectable como bookmarklet o vía Playwright (page.evaluate).
|
|
8
|
+
* Registra cada anuncio de regiones dinámicas (aria-live, role=alert/status/
|
|
9
|
+
* log) con hora, cortesía, rol y texto — lo que un lector de pantalla
|
|
10
|
+
* "diría", visible en pantalla. Sin dependencias.
|
|
11
|
+
*/
|
|
12
|
+
(function () {
|
|
13
|
+
'use strict';
|
|
14
|
+
var LANG = (window.ALM_LANG === 'en')
|
|
15
|
+
? { titulo: 'aria-live monitor', copiar: 'Copy', cerrar: 'Close',
|
|
16
|
+
label: 'aria-live announcement monitor' }
|
|
17
|
+
: { titulo: 'aria-live monitor', copiar: 'Copiar', cerrar: 'Cerrar',
|
|
18
|
+
label: 'Monitor de anuncios aria-live' };
|
|
19
|
+
if (window.__ariaLiveMonitor) { window.__ariaLiveMonitor(); return; }
|
|
20
|
+
var SEL = '[aria-live],[role=alert],[role=status],[role=log],[role=marquee],[role=timer]';
|
|
21
|
+
var log = [];
|
|
22
|
+
var observados = new WeakSet();
|
|
23
|
+
|
|
24
|
+
var css = document.createElement('style');
|
|
25
|
+
css.textContent = '.alm-panel{position:fixed;bottom:12px;right:12px;z-index:2147483647;' +
|
|
26
|
+
'width:min(420px,90vw);max-height:45vh;overflow:auto;background:#111;color:#fff;' +
|
|
27
|
+
'font:12px/1.5 ui-monospace,monospace;border:2px solid #ffd33d;border-radius:8px;padding:8px}' +
|
|
28
|
+
'.alm-panel button{background:#ffd33d;color:#111;border:0;border-radius:4px;padding:3px 8px;' +
|
|
29
|
+
'font:inherit;cursor:pointer;margin-left:6px}' +
|
|
30
|
+
'.alm-e{padding:4px 6px;border-bottom:1px solid #333;white-space:pre-wrap}' +
|
|
31
|
+
'.alm-t{color:#ffd33d}.alm-e b{color:#8ec2f5}';
|
|
32
|
+
document.head.appendChild(css);
|
|
33
|
+
|
|
34
|
+
var panel = document.createElement('div');
|
|
35
|
+
panel.className = 'alm-panel';
|
|
36
|
+
// Sin role="log" a propósito: una región viva casaría con nuestro propio
|
|
37
|
+
// selector y crearía un bucle de auto-observación infinito.
|
|
38
|
+
panel.setAttribute('aria-label', LANG.label);
|
|
39
|
+
panel.innerHTML = '<div><span class="alm-t">' + LANG.titulo + '</span>' +
|
|
40
|
+
'<button type="button" data-alm="copy">' + LANG.copiar + '</button>' +
|
|
41
|
+
'<button type="button" data-alm="close">' + LANG.cerrar + '</button></div><div data-alm="log"></div>';
|
|
42
|
+
document.body.appendChild(panel);
|
|
43
|
+
var cont = panel.querySelector('[data-alm=log]');
|
|
44
|
+
|
|
45
|
+
function desc(el) {
|
|
46
|
+
var d = el.tagName.toLowerCase();
|
|
47
|
+
if (el.id) d += '#' + el.id;
|
|
48
|
+
else if (el.className && typeof el.className === 'string')
|
|
49
|
+
d += '.' + el.className.trim().split(/\s+/).slice(0, 2).join('.');
|
|
50
|
+
return d;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function anota(el, razon) {
|
|
54
|
+
var rol = el.getAttribute('role') || '(sin role)';
|
|
55
|
+
var cortesia = el.getAttribute('aria-live') ||
|
|
56
|
+
({ alert: 'assertive', status: 'polite', log: 'polite',
|
|
57
|
+
marquee: 'off', timer: 'off' })[el.getAttribute('role')] || 'polite';
|
|
58
|
+
var texto = (el.innerText || el.textContent || '').trim().replace(/\s+/g, ' ').slice(0, 220);
|
|
59
|
+
var hora = new Date().toTimeString().slice(0, 8);
|
|
60
|
+
log.push(hora + ' [' + cortesia + '] ' + rol + ' · ' + desc(el) + ' · ' + texto);
|
|
61
|
+
var fila = document.createElement('div');
|
|
62
|
+
fila.className = 'alm-e';
|
|
63
|
+
// DOM-safe: el contenido de la página auditada NUNCA va a innerHTML
|
|
64
|
+
var t = document.createElement('span'); t.className = 'alm-t'; t.textContent = hora;
|
|
65
|
+
fila.appendChild(t);
|
|
66
|
+
fila.appendChild(document.createTextNode(' [' + cortesia + '] '));
|
|
67
|
+
var b = document.createElement('b'); b.textContent = rol; fila.appendChild(b);
|
|
68
|
+
fila.appendChild(document.createTextNode(' \u00b7 ' + desc(el)));
|
|
69
|
+
if (razon) {
|
|
70
|
+
var i = document.createElement('i'); i.textContent = ' (' + razon + ')';
|
|
71
|
+
fila.appendChild(i);
|
|
72
|
+
}
|
|
73
|
+
fila.appendChild(document.createElement('br'));
|
|
74
|
+
fila.appendChild(document.createTextNode(texto));
|
|
75
|
+
cont.appendChild(fila);
|
|
76
|
+
panel.scrollTop = panel.scrollHeight;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function vigila(el) {
|
|
80
|
+
if (!el || observados.has(el) || el.nodeType !== 1) return;
|
|
81
|
+
// Nunca monitorizar nuestro propio panel (bucle de auto-observación).
|
|
82
|
+
if (el.closest && el.closest('.alm-panel')) return;
|
|
83
|
+
if (!el.matches(SEL)) return;
|
|
84
|
+
observados.add(el);
|
|
85
|
+
if (el.getAttribute('role') === 'alert') anota(el, 'insertado');
|
|
86
|
+
new MutationObserver(function () {
|
|
87
|
+
anota(el, null);
|
|
88
|
+
}).observe(el, { childList: true, characterData: true, subtree: true });
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
document.querySelectorAll(SEL).forEach(function (el) { vigila(el); });
|
|
92
|
+
|
|
93
|
+
new MutationObserver(function (muts) {
|
|
94
|
+
muts.forEach(function (m) {
|
|
95
|
+
m.addedNodes.forEach(function (n) {
|
|
96
|
+
if (n.nodeType !== 1) return;
|
|
97
|
+
vigila(n);
|
|
98
|
+
if (n.querySelectorAll) n.querySelectorAll(SEL).forEach(vigila);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}).observe(document.body, { childList: true, subtree: true });
|
|
102
|
+
|
|
103
|
+
panel.addEventListener('click', function (ev) {
|
|
104
|
+
var b = ev.target.closest('button');
|
|
105
|
+
if (!b) return;
|
|
106
|
+
if (b.dataset.alm === 'close') { panel.remove(); css.remove(); delete window.__ariaLiveMonitor; }
|
|
107
|
+
if (b.dataset.alm === 'copy' && navigator.clipboard)
|
|
108
|
+
navigator.clipboard.writeText(log.join('\n'));
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
window.__ariaLiveMonitor = function () { panel.remove(); css.remove(); delete window.__ariaLiveMonitor; };
|
|
112
|
+
})();
|
|
113
|
+
"""
|