@diegovelasquezweb/a11y-engine 0.11.12 → 0.11.13

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.mjs +26 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegovelasquezweb/a11y-engine",
3
- "version": "0.11.12",
3
+ "version": "0.11.13",
4
4
  "description": "WCAG 2.2 accessibility audit engine — scanner, analyzer, and report builders",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/index.mjs CHANGED
@@ -1006,11 +1006,36 @@ export async function getChecklist(options = {}) {
1006
1006
  if (chevron) chevron.style.transform = nextExpanded ? 'rotate(180deg)' : 'rotate(0deg)';
1007
1007
  }
1008
1008
 
1009
+ function updateCardStateUI(card) {
1010
+ const state = card.dataset.state || '';
1011
+ const verifiedBtn = card.querySelector('.manual-verified-btn');
1012
+ const naBtn = card.querySelector('.manual-na-btn');
1013
+ if (verifiedBtn) {
1014
+ verifiedBtn.setAttribute('aria-pressed', state === 'verified' ? 'true' : 'false');
1015
+ verifiedBtn.classList.toggle('border-emerald-500', state === 'verified');
1016
+ verifiedBtn.classList.toggle('bg-emerald-100', state === 'verified');
1017
+ verifiedBtn.classList.toggle('text-emerald-800', state === 'verified');
1018
+ verifiedBtn.classList.toggle('border-slate-200', state !== 'verified');
1019
+ verifiedBtn.classList.toggle('bg-white', state !== 'verified');
1020
+ verifiedBtn.classList.toggle('text-slate-500', state !== 'verified');
1021
+ }
1022
+ if (naBtn) {
1023
+ naBtn.setAttribute('aria-pressed', state === 'na' ? 'true' : 'false');
1024
+ naBtn.classList.toggle('border-slate-500', state === 'na');
1025
+ naBtn.classList.toggle('bg-slate-200', state === 'na');
1026
+ naBtn.classList.toggle('text-slate-800', state === 'na');
1027
+ naBtn.classList.toggle('border-slate-200', state !== 'na');
1028
+ naBtn.classList.toggle('bg-white', state !== 'na');
1029
+ naBtn.classList.toggle('text-slate-500', state !== 'na');
1030
+ }
1031
+ }
1032
+
1009
1033
  function setManualState(criterion, newState) {
1010
1034
  const card = document.getElementById('manual-' + criterion.replace(/\./g, '-'));
1011
1035
  if (!card) return;
1012
1036
  const current = card.dataset.state || '';
1013
1037
  card.dataset.state = current === newState ? '' : newState;
1038
+ updateCardStateUI(card);
1014
1039
  }
1015
1040
 
1016
1041
  function applyFilter() {
@@ -1023,6 +1048,7 @@ export async function getChecklist(options = {}) {
1023
1048
 
1024
1049
  window.toggleCard = toggleCard;
1025
1050
  window.setManualState = setManualState;
1051
+ items.forEach(updateCardStateUI);
1026
1052
  const levelFilter = document.getElementById('level-filter');
1027
1053
  if (levelFilter) levelFilter.addEventListener('change', applyFilter);
1028
1054
  applyFilter();