@yuktishaalaa/yuktai 2.0.13 → 2.0.15
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/README.md +202 -37
- package/dist/index.cjs +6 -6
- package/dist/index.js +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,31 +1,69 @@
|
|
|
1
1
|
# @yuktishaalaa/yuktai
|
|
2
2
|
|
|
3
|
-
> Universal runtime accessibility plugin — automatically fixes WCAG violations on every page, for every user, with zero configuration.
|
|
3
|
+
> Universal runtime accessibility plugin — automatically fixes WCAG 2.2 violations on every page, for every user, with zero configuration.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@yuktishaalaa/yuktai)
|
|
6
|
-
[](https://www.npmjs.com/package/@yuktishaalaa/yuktai)
|
|
7
|
+
[](./LICENSE)
|
|
8
|
+
[](https://nodejs.org)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## What's new in v2.0.0
|
|
13
|
+
|
|
14
|
+
- ✅ Built-in SpeechSynthesis — browser speaks on focus, zero install
|
|
15
|
+
- ✅ Visual alerts — sliding banner for deaf users, no audio needed
|
|
16
|
+
- ✅ Keyboard navigation — arrow keys, Escape, focus trap, no AT needed
|
|
17
|
+
- ✅ Skip links — multi-target (main, nav, search), always visible on mobile
|
|
18
|
+
- ✅ Preference panel — blind / deaf / motor / colour blind presets
|
|
19
|
+
- ✅ Persistent preferences — saved to localStorage across pages
|
|
20
|
+
- ✅ WCAG 2.2 — focus appearance, target size 44×44px, timeout warning
|
|
21
|
+
- ✅ Audit score — 0–100 with issue breakdown (localhost dev only)
|
|
22
|
+
- ✅ Dyslexia font — Atkinson Hyperlegible (research-backed)
|
|
23
|
+
- ✅ React 17, 18, 19 supported
|
|
24
|
+
- ✅ TypeScript declarations — full `index.d.ts` generated
|
|
7
25
|
|
|
8
26
|
---
|
|
9
27
|
|
|
10
28
|
## Install
|
|
11
29
|
|
|
30
|
+
### React 17 or 18
|
|
12
31
|
```bash
|
|
13
32
|
npm i @yuktishaalaa/yuktai
|
|
14
33
|
```
|
|
15
34
|
|
|
35
|
+
### React 19 or MUI v5 conflict
|
|
36
|
+
```bash
|
|
37
|
+
npm i @yuktishaalaa/yuktai --legacy-peer-deps
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### MUI v5 + React 19 permanent fix
|
|
41
|
+
```bash
|
|
42
|
+
npm i @mui/material@6 @mui/icons-material@6 --legacy-peer-deps
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Requirements
|
|
46
|
+
- Node.js 18 or higher
|
|
47
|
+
- npm 8 or higher
|
|
48
|
+
|
|
16
49
|
---
|
|
17
50
|
|
|
18
51
|
## What it does
|
|
19
52
|
|
|
20
53
|
yuktai scans every HTML element on the page and automatically injects missing accessibility attributes — `aria-label`, `alt`, `role`, `tabindex`, `scope`, `autocomplete`, `aria-required`, `aria-expanded`, and more. It also:
|
|
21
54
|
|
|
22
|
-
- Injects
|
|
55
|
+
- Injects multi-target skip links — main content, navigation, search
|
|
23
56
|
- Ensures `<html lang>` and `<title>` are present
|
|
24
57
|
- Fixes `<meta viewport>` if it blocks user zoom
|
|
25
|
-
- Watches for new DOM elements via `MutationObserver`
|
|
26
|
-
- Applies user-controlled visual preferences
|
|
58
|
+
- Watches for new DOM elements via `MutationObserver`
|
|
59
|
+
- Applies user-controlled visual preferences — high contrast, dark mode, reduce motion, large targets, font scale, dyslexia font, colour blind simulation
|
|
60
|
+
- Speaks focused elements aloud via browser SpeechSynthesis — zero install
|
|
61
|
+
- Shows visual alert banners for deaf users — no audio dependency
|
|
62
|
+
- Enforces keyboard navigation — arrow keys, Escape, focus trap in modals
|
|
63
|
+
- Saves user preferences to localStorage across sessions
|
|
64
|
+
- Shows accessibility audit score 0–100 in development
|
|
27
65
|
|
|
28
|
-
The floating button appears bottom-
|
|
66
|
+
The floating ♿ button appears bottom-right. Click it, choose preferences, click **Apply settings**.
|
|
29
67
|
|
|
30
68
|
---
|
|
31
69
|
|
|
@@ -53,9 +91,9 @@ export default function App() {
|
|
|
53
91
|
|
|
54
92
|
---
|
|
55
93
|
|
|
56
|
-
## Next.js
|
|
94
|
+
## Next.js — App Router
|
|
57
95
|
|
|
58
|
-
**Step 1 — next.config.js**
|
|
96
|
+
**Step 1 — next.config.js**
|
|
59
97
|
|
|
60
98
|
```js
|
|
61
99
|
const nextConfig = {
|
|
@@ -64,25 +102,48 @@ const nextConfig = {
|
|
|
64
102
|
module.exports = nextConfig;
|
|
65
103
|
```
|
|
66
104
|
|
|
67
|
-
**Step 2 —
|
|
105
|
+
**Step 2 — Create a client wrapper**
|
|
68
106
|
|
|
69
107
|
```tsx
|
|
108
|
+
// components/YuktaiClient.tsx
|
|
109
|
+
"use client";
|
|
110
|
+
import { useState, useEffect, type ReactNode } from "react";
|
|
70
111
|
import { YuktAIWrapper } from "@yuktishaalaa/yuktai";
|
|
71
112
|
|
|
113
|
+
export default function YuktaiClient({ children }: { children: ReactNode }) {
|
|
114
|
+
const [mounted, setMounted] = useState(false);
|
|
115
|
+
useEffect(() => setMounted(true), []);
|
|
116
|
+
|
|
117
|
+
// Prevents React hydration mismatch error #418
|
|
118
|
+
if (!mounted) return <>{children}</>;
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<YuktAIWrapper position="left">
|
|
122
|
+
{children}
|
|
123
|
+
</YuktAIWrapper>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Step 3 — app/layout.tsx**
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
import YuktaiClient from "@/components/YuktaiClient";
|
|
132
|
+
|
|
72
133
|
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
73
134
|
return (
|
|
74
135
|
<html lang="en">
|
|
75
136
|
<body>
|
|
76
|
-
<
|
|
137
|
+
<YuktaiClient>
|
|
77
138
|
<main>{children}</main>
|
|
78
|
-
</
|
|
139
|
+
</YuktaiClient>
|
|
79
140
|
</body>
|
|
80
141
|
</html>
|
|
81
142
|
);
|
|
82
143
|
}
|
|
83
144
|
```
|
|
84
145
|
|
|
85
|
-
**Pages Router
|
|
146
|
+
**Pages Router — pages/_app.tsx**
|
|
86
147
|
|
|
87
148
|
```tsx
|
|
88
149
|
import { YuktAIWrapper } from "@yuktishaalaa/yuktai";
|
|
@@ -210,16 +271,16 @@ import "@yuktishaalaa/yuktai/vanilla";
|
|
|
210
271
|
**Programmatic API**
|
|
211
272
|
|
|
212
273
|
```js
|
|
213
|
-
window.yuktai.apply();
|
|
214
|
-
window.yuktai.reset();
|
|
215
|
-
window.yuktai.wcagPlugin.scan();
|
|
274
|
+
window.yuktai.apply();
|
|
275
|
+
window.yuktai.reset();
|
|
276
|
+
window.yuktai.wcagPlugin.scan();
|
|
216
277
|
```
|
|
217
278
|
|
|
218
279
|
---
|
|
219
280
|
|
|
220
281
|
## Web Component
|
|
221
282
|
|
|
222
|
-
Works in every framework and plain HTML — uses native Custom Elements
|
|
283
|
+
Works in every framework and plain HTML — uses native Custom Elements.
|
|
223
284
|
|
|
224
285
|
**Plain HTML**
|
|
225
286
|
|
|
@@ -272,36 +333,82 @@ import "@yuktishaalaa/yuktai/web-component";
|
|
|
272
333
|
## Direct engine API
|
|
273
334
|
|
|
274
335
|
```ts
|
|
275
|
-
import { wcagPlugin } from "@yuktishaalaa/yuktai
|
|
336
|
+
import { wcagPlugin } from "@yuktishaalaa/yuktai";
|
|
276
337
|
|
|
277
338
|
// Apply all WCAG rules
|
|
278
|
-
const report = wcagPlugin.applyFixes({
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
339
|
+
const report = wcagPlugin.applyFixes({
|
|
340
|
+
enabled: true,
|
|
341
|
+
highContrast: false,
|
|
342
|
+
darkMode: false,
|
|
343
|
+
reduceMotion: false,
|
|
344
|
+
largeTargets: false,
|
|
345
|
+
speechEnabled: false,
|
|
346
|
+
colorBlindMode:"none",
|
|
347
|
+
autoFix: true,
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
console.log(report.fixed); // number of fixes applied
|
|
351
|
+
console.log(report.scanned); // number of nodes scanned
|
|
352
|
+
console.log(report.renderTime); // time in ms
|
|
353
|
+
console.log(report.score); // accessibility score 0–100
|
|
354
|
+
console.log(report.details); // array of A11yFix objects
|
|
282
355
|
|
|
283
356
|
// Scan only — no DOM changes
|
|
284
357
|
const violations = wcagPlugin.scan();
|
|
285
358
|
|
|
286
|
-
//
|
|
359
|
+
// Announce to screen readers + visual alert + speech
|
|
360
|
+
wcagPlugin.announce("Form submitted successfully", "success");
|
|
361
|
+
wcagPlugin.announce("Email is required", "error");
|
|
362
|
+
|
|
363
|
+
// Browser speech — zero install
|
|
364
|
+
wcagPlugin.speak("Welcome to the dashboard");
|
|
365
|
+
|
|
366
|
+
// Visual alert for deaf users
|
|
367
|
+
wcagPlugin.showVisualAlert("Settings saved", "success");
|
|
368
|
+
|
|
369
|
+
// Focus trap for modals
|
|
370
|
+
const modal = document.querySelector("#my-modal") as HTMLElement;
|
|
371
|
+
wcagPlugin.trapFocus(modal);
|
|
372
|
+
|
|
373
|
+
// Auto-fix new DOM elements
|
|
287
374
|
wcagPlugin.startObserver({ enabled: true, autoFix: true });
|
|
288
375
|
wcagPlugin.stopObserver();
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
## A11yConfig options
|
|
289
381
|
|
|
290
|
-
|
|
291
|
-
wcagPlugin
|
|
292
|
-
|
|
382
|
+
```ts
|
|
383
|
+
import { wcagPlugin, A11yConfig } from "@yuktishaalaa/yuktai";
|
|
384
|
+
|
|
385
|
+
const config: A11yConfig = {
|
|
386
|
+
enabled: true, // required
|
|
387
|
+
highContrast: false, // increase contrast
|
|
388
|
+
darkMode: false, // invert colours
|
|
389
|
+
reduceMotion: false, // disable animations
|
|
390
|
+
largeTargets: false, // 44×44px minimum touch targets
|
|
391
|
+
speechEnabled: false, // speak focused elements aloud
|
|
392
|
+
colorBlindMode: "none", // none | deuteranopia | protanopia | tritanopia | achromatopsia
|
|
393
|
+
autoFix: true, // MutationObserver watches for new elements
|
|
394
|
+
showPreferencePanel: true, // floating ♿ button + panel
|
|
395
|
+
showSkipLinks: true, // multi-target skip links
|
|
396
|
+
showAuditBadge: false, // score badge — dev only (localhost)
|
|
397
|
+
fontSizeMultiplier: 1, // font scale multiplier
|
|
398
|
+
timeoutWarning: 0, // seconds before session timeout warning (0 = off)
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
await wcagPlugin.execute(config);
|
|
293
402
|
```
|
|
294
403
|
|
|
295
404
|
---
|
|
296
405
|
|
|
297
406
|
## HTML elements covered
|
|
298
407
|
|
|
299
|
-
The engine covers every HTML element:
|
|
300
|
-
|
|
301
408
|
- **Headings** — `h1` through `h6`
|
|
302
|
-
- **Text** — `p`, `span`, `abbr`, `mark`, `time`, `meter`, `progress`,
|
|
409
|
+
- **Text** — `p`, `span`, `abbr`, `mark`, `time`, `meter`, `progress`, all inline elements
|
|
303
410
|
- **Images & media** — `img`, `area`, `svg`, `canvas`, `video`, `audio`, `iframe`, `object`, `embed`, `figure`
|
|
304
|
-
- **Interactive** — `button`, `a`, clickable `div
|
|
411
|
+
- **Interactive** — `button`, `a`, clickable `div` / `span`
|
|
305
412
|
- **Forms** — `input` (all types), `select`, `textarea`, `fieldset`, `label`
|
|
306
413
|
- **Tables** — `table`, `th`, `td`, `caption`
|
|
307
414
|
- **Lists** — `ul`, `ol`, `dl`, `li`, `dt`, `dd`
|
|
@@ -311,28 +418,86 @@ The engine covers every HTML element:
|
|
|
311
418
|
|
|
312
419
|
---
|
|
313
420
|
|
|
421
|
+
## WCAG coverage
|
|
422
|
+
|
|
423
|
+
| Standard | Criteria covered |
|
|
424
|
+
|---|---|
|
|
425
|
+
| WCAG 2.0 | 19 criteria |
|
|
426
|
+
| WCAG 2.1 | 7 criteria |
|
|
427
|
+
| WCAG 2.2 | 3 criteria (focus appearance, target size, timeout) |
|
|
428
|
+
| Beyond WCAG | SpeechSynthesis, visual alerts, keyboard cheatsheet, audit score, colour blind modes, dyslexia font |
|
|
429
|
+
|
|
430
|
+
---
|
|
431
|
+
|
|
432
|
+
## Accessibility features — no screen reader software needed
|
|
433
|
+
|
|
434
|
+
| Feature | Who it helps | How |
|
|
435
|
+
|---|---|---|
|
|
436
|
+
| SpeechSynthesis | Blind users without screen reader | Browser reads focused element aloud |
|
|
437
|
+
| Visual alerts | Deaf users | Sliding banner — no audio |
|
|
438
|
+
| Skip links | All keyboard users | Jump to main, nav, search |
|
|
439
|
+
| Focus trap | Keyboard users | Tab stays inside modals |
|
|
440
|
+
| Arrow key nav | Keyboard users | Navigate menus, tabs, listbox |
|
|
441
|
+
| Keyboard cheatsheet | All users | Press Alt+A |
|
|
442
|
+
| Colour blind modes | Colour blind users | Deuteranopia, protanopia, tritanopia, greyscale |
|
|
443
|
+
| High contrast | Low vision users | Filter-based contrast boost |
|
|
444
|
+
| Dark mode | Light sensitivity | Invert + hue rotate |
|
|
445
|
+
| Large targets | Motor impaired | 44×44px minimum |
|
|
446
|
+
| Timeout warning | Motor impaired | Warning before session expires |
|
|
447
|
+
| Dyslexia font | Dyslexia users | Atkinson Hyperlegible |
|
|
448
|
+
| Reduce motion | Vestibular disorder | Disables all animations |
|
|
449
|
+
|
|
450
|
+
---
|
|
451
|
+
|
|
314
452
|
## The report
|
|
315
453
|
|
|
316
454
|
After clicking **Apply settings**, the panel shows:
|
|
317
455
|
|
|
318
456
|
```
|
|
319
|
-
✓ 12 fixes
|
|
320
|
-
✓ 0 fixes needed · 534 nodes clean · 0.8ms
|
|
457
|
+
✓ 12 fixes · 534 nodes · 1.2ms · Score: 88/100
|
|
458
|
+
✓ 0 fixes needed · 534 nodes clean · 0.8ms · Score: 100/100
|
|
321
459
|
```
|
|
322
460
|
|
|
323
|
-
|
|
461
|
+
> **Note:** A score of 100/100 means yuktai found no issues it could automatically detect and fix. Automated scanning covers a significant portion of WCAG criteria but cannot substitute for manual testing and real user feedback. We recommend combining yuktai with periodic manual audits for comprehensive accessibility coverage.
|
|
324
462
|
|
|
325
463
|
---
|
|
326
464
|
|
|
327
465
|
## Design principles
|
|
328
466
|
|
|
329
|
-
- **Zero id attributes** — no injected node ever gets an `id`. All injected nodes
|
|
330
|
-
- **Zero API keys** —
|
|
331
|
-
- **Zero framework lock-in** — `core/renderer.ts` has no framework imports.
|
|
332
|
-
- **One engine, many adapters** — all adapters import from `core/renderer.ts`.
|
|
467
|
+
- **Zero id attributes** — no injected node ever gets an `id`. All injected nodes tracked via module-level JavaScript references. Never collides with host app ids.
|
|
468
|
+
- **Zero API keys** — runs entirely in the browser. No external calls, no telemetry, no cost.
|
|
469
|
+
- **Zero framework lock-in** — `core/renderer.ts` has no framework imports. Works in Node.js, browsers, and test environments.
|
|
470
|
+
- **One engine, many adapters** — all adapters import from `core/renderer.ts`. WCAG logic written once.
|
|
471
|
+
|
|
472
|
+
---
|
|
473
|
+
|
|
474
|
+
## Browser support
|
|
475
|
+
|
|
476
|
+
| Browser | Supported |
|
|
477
|
+
|---|---|
|
|
478
|
+
| Chrome 90+ | ✅ |
|
|
479
|
+
| Firefox 90+ | ✅ |
|
|
480
|
+
| Safari 15+ | ✅ |
|
|
481
|
+
| Edge 90+ | ✅ |
|
|
482
|
+
| Samsung Internet 14+ | ✅ |
|
|
483
|
+
|
|
484
|
+
---
|
|
485
|
+
|
|
486
|
+
## Framework compatibility
|
|
487
|
+
|
|
488
|
+
| Framework | Version | Supported |
|
|
489
|
+
|---|---|---|
|
|
490
|
+
| React | 17, 18, 19 | ✅ |
|
|
491
|
+
| Next.js | 13, 14, 15 | ✅ |
|
|
492
|
+
| Vue | 3+ | ✅ |
|
|
493
|
+
| Nuxt | 3+ | ✅ |
|
|
494
|
+
| Angular | 15+ | ✅ |
|
|
495
|
+
| Remix | Any | ✅ |
|
|
496
|
+
| Astro | Any | ✅ |
|
|
497
|
+
| Vanilla JS | ES2020+ | ✅ |
|
|
333
498
|
|
|
334
499
|
---
|
|
335
500
|
|
|
336
501
|
## License
|
|
337
502
|
|
|
338
|
-
|
|
503
|
+
ISC © Sandeep Miriyala — [Yuktishaalaa AI Lab]
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var be=Object.create;var z=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ge=Object.getOwnPropertyNames;var me=Object.getPrototypeOf,ye=Object.prototype.hasOwnProperty;var xe=(t,i)=>{for(var n in i)z(t,n,{get:i[n],enumerable:!0})},U=(t,i,n,s)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of ge(i))!ye.call(t,a)&&a!==n&&z(t,a,{get:()=>i[a],enumerable:!(s=pe(i,a))||s.enumerable});return t};var he=(t,i,n)=>(n=t!=null?be(me(t)):{},U(i||!t||!t.__esModule?z(n,"default",{value:t,enumerable:!0}):n,t)),Ae=t=>U(z({},"__esModule",{value:!0}),t);var Ie={};xe(Ie,{Runtime:()=>v,YuktAI:()=>Pe,YuktAIWrapper:()=>
|
|
1
|
+
"use strict";var be=Object.create;var z=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ge=Object.getOwnPropertyNames;var me=Object.getPrototypeOf,ye=Object.prototype.hasOwnProperty;var xe=(t,i)=>{for(var n in i)z(t,n,{get:i[n],enumerable:!0})},U=(t,i,n,s)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of ge(i))!ye.call(t,a)&&a!==n&&z(t,a,{get:()=>i[a],enumerable:!(s=pe(i,a))||s.enumerable});return t};var he=(t,i,n)=>(n=t!=null?be(me(t)):{},U(i||!t||!t.__esModule?z(n,"default",{value:t,enumerable:!0}):n,t)),Ae=t=>U(z({},"__esModule",{value:!0}),t);var Ie={};xe(Ie,{Runtime:()=>v,YuktAI:()=>Pe,YuktAIWrapper:()=>q,aiPlugin:()=>R,default:()=>q,voicePlugin:()=>H,wcag:()=>b,wcagPlugin:()=>b});module.exports=Ae(Ie);var _=null,J=null,$=null,X=null,O=null,m=null,w=null,B=null,j=null,S=null,I={deuteranopia:"yuktai-cb-d",protanopia:"yuktai-cb-p",tritanopia:"yuktai-cb-t"},Z=new Set(["h1","h2","h3","h4","h5","h6"]),Q=new Set(["input","select","textarea"]),ve=new Set(["button","a","input","select","textarea","details","summary"]),ke=new Set(["video","audio"]),we=new Set(["ul","ol","dl"]);var K={nav:"navigation",header:"banner",footer:"contentinfo",main:"main",aside:"complementary"};function Y(t,i="polite"){if(typeof window>"u"||!S?.speechEnabled||!window.speechSynthesis)return;window.speechSynthesis.cancel();let n=new SpeechSynthesisUtterance(t);n.rate=1,n.pitch=1,n.volume=1;let s=window.speechSynthesis.getVoices();s.length>0&&(n.voice=s[0]),window.speechSynthesis.speak(n)}function ae(t,i="info"){if(typeof document>"u")return;let s={success:{bg:"#0f9d58",border:"#0a7a44",icon:"\u2713"},error:{bg:"#d93025",border:"#b52a1c",icon:"\u2715"},warning:{bg:"#f29900",border:"#c67c00",icon:"\u26A0"},info:{bg:"#1a73e8",border:"#1557b0",icon:"\u2139"}}[i];m||(m=document.createElement("div"),m.setAttribute("role","alert"),m.setAttribute("aria-live","assertive"),m.setAttribute("aria-atomic","true"),m.style.cssText=`
|
|
2
2
|
position:fixed;top:80px;right:16px;z-index:999999;
|
|
3
3
|
max-width:320px;width:calc(100% - 32px);
|
|
4
4
|
border-radius:8px;padding:12px 16px;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<button onclick="this.parentElement.style.transform='translateX(120%)';this.parentElement.style.opacity='0'"
|
|
14
14
|
style="background:none;border:none;color:#fff;cursor:pointer;font-size:18px;padding:0;line-height:1"
|
|
15
15
|
aria-label="Close notification">\xD7</button>
|
|
16
|
-
`,requestAnimationFrame(()=>{m&&(m.style.transform="translateX(0)",m.style.opacity="1")}),setTimeout(()=>{m&&(m.style.transform="translateX(120%)",m.style.opacity="0")},5e3)}function p(t,i="info",n=!0){
|
|
16
|
+
`,requestAnimationFrame(()=>{m&&(m.style.transform="translateX(0)",m.style.opacity="1")}),setTimeout(()=>{m&&(m.style.transform="translateX(120%)",m.style.opacity="0")},5e3)}function p(t,i="info",n=!0){_&&(_.textContent=t),ae(t,i),n&&Y(t,i==="error"?"assertive":"polite")}function Se(){if(typeof document>"u"||X)return;let t=[{label:"Skip to main content",selector:"main,[role='main'],#main,#main-content"},{label:"Skip to navigation",selector:"nav,[role='navigation'],#nav,#navigation"},{label:"Skip to search",selector:"[role='search'],#search,input[type='search']"}],i=document.createElement("div");i.setAttribute("data-yuktai-skip-bar","true"),i.setAttribute("role","navigation"),i.setAttribute("aria-label","Skip links"),i.style.cssText=`
|
|
17
17
|
position:fixed;top:0;left:0;right:0;z-index:999999;
|
|
18
18
|
display:flex;gap:4px;padding:4px;
|
|
19
19
|
background:#111;
|
|
@@ -255,7 +255,7 @@
|
|
|
255
255
|
border-radius:8px;cursor:pointer;font-size:12px;color:#d93025;font-weight:600;
|
|
256
256
|
">Reset all preferences</button>
|
|
257
257
|
</div>
|
|
258
|
-
`,n.querySelectorAll("[data-yuktai-toggle]").forEach(a=>{a.addEventListener("click",()=>{let l=a.getAttribute("data-yuktai-toggle");t[l]=!P(t,l),te(t),L(t),ee(t),p(`${l.replace(/([A-Z])/g," $1")} ${P(t,l)?"enabled":"disabled"}`,"info")})}),n.querySelectorAll("input[type='radio']").forEach(a=>{a.addEventListener("change",()=>{let l=a.value.replace("colorBlind_","");t.colorBlindMode=l,te(t),L(t),p(`Colour blind mode: ${l}`,"info")})}),n.querySelector("[data-yuktai-show-keys]")?.addEventListener("click",()=>{re()}),n.querySelector("[data-yuktai-reset]")?.addEventListener("click",()=>{localStorage.removeItem("yuktai-a11y-prefs"),t.highContrast=!1,t.darkMode=!1,t.reduceMotion=!1,t.largeTargets=!1,t.speechEnabled=!1,t.colorBlindMode="none",L(t),ee(t),p("Preferences reset to default","info")}),n.querySelector("[data-yuktai-panel-close]")?.addEventListener("click",()=>{n.style.display="none",i.focus(),p("Preferences closed","info")}),n.addEventListener("keydown",a=>{a.key==="Escape"&&(n.style.display="none",i.focus())}),i.addEventListener("click",()=>{let a=n.style.display!=="none";n.style.display=a?"none":"block",i.setAttribute("aria-expanded",String(!a)),a||(E(n),p("Accessibility preferences opened","info"))}),document.body.appendChild(i),document.body.appendChild(n),$=n}function ee(t){$&&($.remove(),$=null),ne(t)}function P(t,i){return!!t[i]}function Le(t,i){let n=i.replace("colorBlind_","");return t.colorBlindMode===n}function te(t){try{let i={highContrast:t.highContrast,darkMode:t.darkMode,reduceMotion:t.reduceMotion,largeTargets:t.largeTargets,speechEnabled:t.speechEnabled,colorBlindMode:t.colorBlindMode};localStorage.setItem("yuktai-a11y-prefs",JSON.stringify(i))}catch{}}function L(t){if(typeof document>"u")return;let i=document.documentElement;i.toggleAttribute("data-yuktai-high-contrast",!!t.highContrast),i.toggleAttribute("data-yuktai-dark",!!t.darkMode),i.toggleAttribute("data-yuktai-reduce-motion",!!t.reduceMotion),i.toggleAttribute("data-yuktai-large-targets",!!t.largeTargets),i.toggleAttribute("data-yuktai-keyboard",!!t.keyboardHints);let n=document.body;if(t.colorBlindMode&&t.colorBlindMode!=="none"){let s=t.colorBlindMode==="achromatopsia"?"grayscale(100%)":`url(#${I[t.colorBlindMode]})`;n.style.filter=s}else n.style.filter=""}function $e(){if(typeof document>"u"||
|
|
258
|
+
`,n.querySelectorAll("[data-yuktai-toggle]").forEach(a=>{a.addEventListener("click",()=>{let l=a.getAttribute("data-yuktai-toggle");t[l]=!P(t,l),te(t),L(t),ee(t),p(`${l.replace(/([A-Z])/g," $1")} ${P(t,l)?"enabled":"disabled"}`,"info")})}),n.querySelectorAll("input[type='radio']").forEach(a=>{a.addEventListener("change",()=>{let l=a.value.replace("colorBlind_","");t.colorBlindMode=l,te(t),L(t),p(`Colour blind mode: ${l}`,"info")})}),n.querySelector("[data-yuktai-show-keys]")?.addEventListener("click",()=>{re()}),n.querySelector("[data-yuktai-reset]")?.addEventListener("click",()=>{localStorage.removeItem("yuktai-a11y-prefs"),t.highContrast=!1,t.darkMode=!1,t.reduceMotion=!1,t.largeTargets=!1,t.speechEnabled=!1,t.colorBlindMode="none",L(t),ee(t),p("Preferences reset to default","info")}),n.querySelector("[data-yuktai-panel-close]")?.addEventListener("click",()=>{n.style.display="none",i.focus(),p("Preferences closed","info")}),n.addEventListener("keydown",a=>{a.key==="Escape"&&(n.style.display="none",i.focus())}),i.addEventListener("click",()=>{let a=n.style.display!=="none";n.style.display=a?"none":"block",i.setAttribute("aria-expanded",String(!a)),a||(E(n),p("Accessibility preferences opened","info"))}),document.body.appendChild(i),document.body.appendChild(n),$=n}function ee(t){$&&($.remove(),$=null),ne(t)}function P(t,i){return!!t[i]}function Le(t,i){let n=i.replace("colorBlind_","");return t.colorBlindMode===n}function te(t){try{let i={highContrast:t.highContrast,darkMode:t.darkMode,reduceMotion:t.reduceMotion,largeTargets:t.largeTargets,speechEnabled:t.speechEnabled,colorBlindMode:t.colorBlindMode};localStorage.setItem("yuktai-a11y-prefs",JSON.stringify(i))}catch{}}function L(t){if(typeof document>"u")return;let i=document.documentElement;i.toggleAttribute("data-yuktai-high-contrast",!!t.highContrast),i.toggleAttribute("data-yuktai-dark",!!t.darkMode),i.toggleAttribute("data-yuktai-reduce-motion",!!t.reduceMotion),i.toggleAttribute("data-yuktai-large-targets",!!t.largeTargets),i.toggleAttribute("data-yuktai-keyboard",!!t.keyboardHints);let n=document.body;if(t.colorBlindMode&&t.colorBlindMode!=="none"){let s=t.colorBlindMode==="achromatopsia"?"grayscale(100%)":`url(#${I[t.colorBlindMode]})`;n.style.filter=s}else n.style.filter=""}function $e(){if(typeof document>"u"||_)return;let t=document.createElement("div");t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.setAttribute("aria-relevant","text"),t.style.cssText="position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);",document.body.appendChild(t),_=t}function Re(){if(typeof document>"u"||J)return;let t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("aria-hidden","true"),t.style.cssText="position:absolute;width:0;height:0;overflow:hidden;",t.innerHTML=`
|
|
259
259
|
<defs>
|
|
260
260
|
<filter id="${I.deuteranopia}">
|
|
261
261
|
<feColorMatrix type="matrix" values="0.625 0.375 0 0 0 0.7 0.3 0 0 0 0 0.3 0.7 0 0 0 0 0 1 0"/>
|
|
@@ -267,7 +267,7 @@
|
|
|
267
267
|
<feColorMatrix type="matrix" values="0.95 0.05 0 0 0 0 0.433 0.567 0 0 0 0 0.475 0.525 0 0 0 0 0 1 0"/>
|
|
268
268
|
</filter>
|
|
269
269
|
</defs>
|
|
270
|
-
`,document.body.appendChild(t),J=t}function ie(t){let i={critical:20,serious:10,moderate:5,minor:2},n=t.details.reduce((s,a)=>s+(i[a.severity]||0),0);return Math.max(0,Math.min(100,100-n))}var b={name:"yuktai-a11y",version:"2.0.0",observer:null,async execute(t){if(!t.enabled)return this.stopObserver(),"yuktai-a11y: disabled.";S=t,$e(),Re(),Ee(),Te(),t.showSkipLinks!==!1&&Se(),t.showPreferencePanel!==!1&&ne(t),L(t);let i=this.applyFixes(t);i.score=ie(i),t.showAuditBadge&&Me(i),t.timeoutWarning&&oe(t.timeoutWarning),t.autoFix&&this.startObserver(t);let n=`${i.fixed} accessibility fixes applied. Score: ${i.score}/100.`;return p(n,i.score>=90?"success":"info",!1),`yuktai-a11y v2: ${n} Scanned ${i.scanned} elements in ${i.renderTime}ms.`},applyFixes(t){let i={fixed:0,scanned:0,renderTime:0,score:100,details:[]};if(typeof document>"u")return i;let n=performance.now(),s=document.querySelectorAll("*");i.scanned=s.length;let a=(l,e,r,y)=>{i.details.push({tag:l,fix:e,severity:r,element:y.outerHTML.slice(0,100)}),i.fixed++};return s.forEach(l=>{let e=l,r=e.tagName.toLowerCase();if(r==="html"&&!e.getAttribute("lang")&&(e.setAttribute("lang","en"),a(r,'lang="en" added to <html>',"critical",e)),r==="head"&&!document.title&&(document.title=document.querySelector("h1")?.innerText?.trim()||"Page",a(r,`document.title set to "${document.title}"`,"serious",e)),r==="meta"){let o=e.getAttribute("name"),u=e.getAttribute("content")||"";o==="viewport"&&u.includes("user-scalable=no")&&(e.setAttribute("content",u.replace("user-scalable=no","user-scalable=yes")),a(r,"user-scalable=yes restored","serious",e)),o==="viewport"&&/maximum-scale=1(?:[^0-9]|$)/.test(u)&&(e.setAttribute("content",u.replace(/maximum-scale=1(?=[^0-9]|$)/,"maximum-scale=5")),a(r,"maximum-scale=5 restored","serious",e))}if(r==="main"&&!e.getAttribute("tabindex")&&(e.setAttribute("tabindex","-1"),e.getAttribute("id")||e.setAttribute("id","main-content")),r==="body"&&document.querySelectorAll("video[autoplay]:not([muted])").forEach(o=>{o.muted=!0,a("video","autoplay video muted (deaf users)","serious",e)}),t.largeTargets&&(r==="button"||r==="a"||r==="input")){let o=e.getBoundingClientRect();o.width>0&&o.width<24&&(e.style.minWidth="44px",e.style.minHeight="44px",a(r,"min 44px touch target enforced","minor",e))}if(Z.has(r)&&(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",`${r.toUpperCase()} section`),a(r,"aria-label added (empty heading)","moderate",e)),e.hasAttribute("onclick")&&!e.getAttribute("tabindex")&&(e.setAttribute("tabindex","0"),e.onkeydown||(e.onkeydown=o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),e.click())}),a(r,"tabindex=0 + keydown (clickable heading)","minor",e))),r==="img"&&(e.hasAttribute("alt")||(e.setAttribute("alt",""),e.setAttribute("aria-hidden","true"),a(r,'alt="" aria-hidden="true"',"serious",e)),e.getAttribute("role")==="presentation"&&e.getAttribute("alt")!==""&&(e.setAttribute("alt",""),a(r,'alt="" (role=presentation)',"minor",e))),r==="area"&&!e.getAttribute("alt")){let o=e.getAttribute("title")||e.getAttribute("href")||"map area";e.setAttribute("alt",o),a(r,`alt="${o}" on <area>`,"serious",e)}if(r==="svg"){if(!e.getAttribute("aria-hidden")&&!e.getAttribute("aria-label")&&!l.querySelector("title"))if(!e.getAttribute("role")||e.getAttribute("role")==="img"){let o=document.createElementNS("http://www.w3.org/2000/svg","title");o.textContent="graphic",e.prepend(o),e.setAttribute("role","img"),a(r,'role="img" + <title> injected',"moderate",e)}else e.setAttribute("aria-hidden","true"),a(r,'aria-hidden="true" (decorative svg)',"minor",e);e.getAttribute("focusable")||e.setAttribute("focusable","false")}if(r==="canvas"&&(e.getAttribute("role")||(e.setAttribute("role","img"),a(r,'role="img"',"serious",e)),e.getAttribute("aria-label")||(e.setAttribute("aria-label",e.getAttribute("title")||"canvas graphic"),a(r,"aria-label added to canvas","serious",e))),(r==="object"||r==="embed")&&!e.getAttribute("aria-label")&&!e.getAttribute("title")&&(e.setAttribute("aria-label",`embedded ${r} content`),a(r,`aria-label added to <${r}>`,"moderate",e)),r==="video"&&!l.querySelector("track")&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label",e.getAttribute("title")||"video player"),a(r,"aria-label added (no captions track)","serious",e)),r==="audio"&&!l.querySelector("track")&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label",e.getAttribute("title")||"audio player"),a(r,"aria-label added to audio","serious",e)),r==="iframe"&&!e.getAttribute("title")&&!e.getAttribute("aria-label")&&(e.setAttribute("title","embedded content"),e.setAttribute("aria-label","embedded content"),a(r,'title + aria-label="embedded content"',"serious",e)),r==="figure"&&!l.querySelector("figcaption")&&!e.getAttribute("aria-label")){let u=l.querySelector("img")?.getAttribute("alt");u&&(e.setAttribute("aria-label",u),a(r,"aria-label from inner img alt","minor",e))}if(r==="button"){if(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let o=e.getAttribute("title")||e.getAttribute("data-label")||"button";e.setAttribute("aria-label",o),a(r,`aria-label="${o}" (empty button)`,"critical",e)}e.hasAttribute("disabled")&&!e.getAttribute("aria-disabled")&&(e.setAttribute("aria-disabled","true"),i.fixed++),e.getAttribute("data-yuktai-announced")||(e.setAttribute("data-yuktai-announced","true"),e.addEventListener("click",()=>{let o=e.getAttribute("aria-label")||e.textContent?.trim()||"button";setTimeout(()=>{p(`${o} activated`,"success",!1)},100)}))}if(r==="a"){let o=e;if(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let u=e.getAttribute("title")||"link";e.setAttribute("aria-label",u),a(r,`aria-label="${u}" (empty link)`,"critical",e)}if(o.target==="_blank"){o.rel?.includes("noopener")||(o.rel="noopener noreferrer",i.fixed++);let u=o.getAttribute("aria-label")||o.innerText?.trim()||"link";u.includes("opens in new window")||(o.setAttribute("aria-label",`${u} (opens in new window)`),a(r,"aria-label: new-window warning","moderate",e))}!o.href&&!o.getAttribute("role")&&!o.getAttribute("tabindex")&&(o.setAttribute("role","button"),o.setAttribute("tabindex","0"),a(r,'role="button" tabindex=0 (href-less link)',"serious",e))}if((e.hasAttribute("onclick")||typeof window<"u"&&window.getComputedStyle(e).cursor==="pointer")&&!ve.has(r)&&(e.getAttribute("role")||(e.setAttribute("role","button"),a(r,'role="button" (clickable non-interactive)',"serious",e)),e.tabIndex<0&&(e.tabIndex=0,i.fixed++),e.onkeydown||(e.onkeydown=o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),e.click())})),Q.has(r)){let o=e;if(!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let u=e.getAttribute("placeholder")||e.getAttribute("name")||e.getAttribute("title")||r;e.setAttribute("aria-label",u),a(r,`aria-label="${u}"`,"serious",e)}if(e.hasAttribute("required")&&!e.getAttribute("aria-required")&&(e.setAttribute("aria-required","true"),i.fixed++),e.hasAttribute("disabled")&&!e.getAttribute("aria-disabled")&&(e.setAttribute("aria-disabled","true"),i.fixed++),e.hasAttribute("readonly")&&!e.getAttribute("aria-readonly")&&(e.setAttribute("aria-readonly","true"),i.fixed++),e.getAttribute("data-yuktai-validation")||(e.setAttribute("data-yuktai-validation","true"),e.addEventListener("invalid",()=>{let u=e.getAttribute("aria-label")||e.getAttribute("placeholder")||"Field",x=e.validationMessage||"is invalid";p(`Error: ${u} ${x}`,"error")}),e.addEventListener("change",()=>{if(e.validity?.valid){let u=e.getAttribute("aria-label")||e.getAttribute("placeholder")||"Field";p(`${u} looks good`,"success",!1)}})),r==="input"&&!o.autocomplete){let u=o.name||"";o.type==="email"||u.includes("email")?(o.autocomplete="email",i.fixed++):o.type==="tel"||u.includes("tel")?(o.autocomplete="tel",i.fixed++):o.type==="password"?(o.autocomplete="current-password",i.fixed++):u.includes("firstname")||u.includes("fname")?(o.autocomplete="given-name",i.fixed++):u.includes("lastname")||u.includes("lname")?(o.autocomplete="family-name",i.fixed++):u==="name"||u.includes("fullname")?(o.autocomplete="name",i.fixed++):u.includes("zip")||u.includes("postal")?(o.autocomplete="postal-code",i.fixed++):u.includes("city")?(o.autocomplete="address-level2",i.fixed++):u.includes("country")&&(o.autocomplete="country",i.fixed++)}r==="input"&&o.type==="image"&&!e.getAttribute("alt")&&(e.setAttribute("alt",e.getAttribute("value")||"submit"),a(r,"alt added to input[type=image]","serious",e)),r==="input"&&o.type==="range"&&(e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin",o.min||"0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax",o.max||"100"),e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow",o.value||"50"),i.fixed++)}if(r==="fieldset"&&!l.querySelector("legend")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","form group"),a(r,'aria-label="form group" (no legend)',"moderate",e)),r==="table"&&(!l.querySelector("th")&&!e.getAttribute("role")&&(e.setAttribute("role","grid"),a(r,'role="grid" (no <th>)',"serious",e)),!l.querySelector("caption")&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label","data table"),a(r,'aria-label="data table"',"moderate",e))),r==="th"&&!e.getAttribute("scope")){let o=e.closest("thead")!==null;e.setAttribute("scope",o?"col":"row"),a(r,`scope="${o?"col":"row"}"`,"moderate",e)}if(we.has(r)&&(e.getAttribute("role")==="presentation"&&(l.querySelectorAll("li").forEach(o=>{o.getAttribute("role")||o.setAttribute("role","presentation")}),i.fixed++),(r==="ul"||r==="ol")&&!e.getAttribute("aria-label"))){let o=e.closest("nav");o&&(e.setAttribute("aria-label",o.getAttribute("aria-label")||"navigation list"),a(r,"aria-label from parent nav","minor",e))}if(K[r]&&!e.getAttribute("role")&&(e.setAttribute("role",K[r]),a(r,`role="${K[r]}"`,"minor",e)),["nav","section","article","aside"].includes(r)){let o=l.parentElement?.querySelectorAll(r);if(o&&o.length>1&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let x=l.querySelector("h1,h2,h3,h4,h5,h6")?.textContent?.trim();x&&(e.setAttribute("aria-label",x),a(r,"aria-label from inner heading","moderate",e))}}if(r==="details"&&!l.querySelector("summary")){let o=document.createElement("summary");o.textContent=e.getAttribute("aria-label")||"More details",e.prepend(o),a(r,"<summary> injected","moderate",e)}if(r==="summary"&&!e.innerText?.trim()&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label","Toggle details"),a(r,'aria-label="Toggle details"',"moderate",e)),r==="dialog"){let o=e.getAttribute("role");if(o&&o!=="dialog"&&o!=="alertdialog"&&(e.setAttribute("role","dialog"),a(r,'role corrected to "dialog"',"serious",e)),!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let x=l.querySelector("h1,h2,h3,h4,h5,h6")?.textContent?.trim()||"dialog";e.setAttribute("aria-label",x),a(r,"aria-label added to dialog","serious",e)}e.getAttribute("data-yuktai-trap")||(e.setAttribute("data-yuktai-trap","true"),new MutationObserver(()=>{e.style.display!=="none"&&e.style.visibility!=="hidden"&&E(e)}).observe(e,{attributes:!0,attributeFilter:["style","open"]}))}if(r==="abbr"&&!e.getAttribute("title")&&(e.setAttribute("title",e.innerText?.trim()||"abbreviation"),a(r,"title added to <abbr>","minor",e)),r==="time"&&!e.getAttribute("datetime")&&e.innerText?.trim()&&(e.setAttribute("datetime",e.innerText.trim()),a(r,`datetime="${e.innerText.trim()}" added`,"minor",e)),r==="meter"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",e.getAttribute("title")||"meter"),a(r,"aria-label added to <meter>","moderate",e)),r==="progress"){!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",e.getAttribute("title")||"progress"),a(r,"aria-label added to <progress>","moderate",e));let o=e;e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow",String(o.value)),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax",String(o.max||1)),i.fixed++}let f=e.getAttribute("role")||"";if(f==="tab"&&!e.getAttribute("aria-selected")&&(e.setAttribute("aria-selected","false"),i.fixed++),f==="tabpanel"&&(!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","tab panel"),a(r,'aria-label="tab panel"',"moderate",e)),e.getAttribute("tabindex")||(e.setAttribute("tabindex","0"),i.fixed++)),["alert","status","log","marquee"].includes(f)){if(!e.getAttribute("aria-live")){let o=f==="alert"?"assertive":"polite";e.setAttribute("aria-live",o),a(r,`aria-live="${o}" on role=${f}`,"moderate",e)}e.getAttribute("aria-atomic")||(e.setAttribute("aria-atomic","true"),i.fixed++)}f==="tooltip"&&!e.getAttribute("aria-live")&&(e.setAttribute("aria-live","polite"),i.fixed++),(f==="menu"||f==="menubar")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","menu"),a(r,'aria-label="menu"',"moderate",e)),f==="listbox"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","listbox"),a(r,'aria-label="listbox"',"moderate",e)),f==="option"&&!e.getAttribute("aria-selected")&&(e.setAttribute("aria-selected","false"),i.fixed++),f==="slider"&&(e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin","0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax","100"),e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow","50"),i.fixed++),(f==="checkbox"||f==="radio")&&!e.getAttribute("aria-checked")&&(e.setAttribute("aria-checked","false"),a(r,`aria-checked="false" on role=${f}`,"serious",e)),f==="combobox"&&(e.getAttribute("aria-expanded")||(e.setAttribute("aria-expanded","false"),a(r,'aria-expanded="false" on combobox',"serious",e)),e.getAttribute("aria-haspopup")||(e.setAttribute("aria-haspopup","listbox"),i.fixed++)),(f==="grid"||f==="treegrid")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","data grid"),a(r,'aria-label="data grid"',"moderate",e)),f==="tree"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","tree"),a(r,'aria-label="tree"',"moderate",e)),f==="spinbutton"&&(e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow","0"),e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin","0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax","100"),i.fixed++)}),i.renderTime=parseFloat((performance.now()-n).toFixed(2)),i},scan(){let t={fixed:0,scanned:0,renderTime:0,score:100,details:[]};if(typeof document>"u")return t;let i=performance.now(),n=document.querySelectorAll("*");t.scanned=n.length;let s=(a,l,e,r)=>t.details.push({tag:a,fix:l,severity:e,element:r.outerHTML.slice(0,100)});return n.forEach(a=>{let l=a,e=l.tagName.toLowerCase();(e==="a"||e==="button")&&!l.innerText?.trim()&&!l.getAttribute("aria-label")&&s(e,"needs aria-label (empty)","critical",l),e==="img"&&!l.hasAttribute("alt")&&s(e,"needs alt text","serious",l),Q.has(e)&&!l.getAttribute("aria-label")&&!l.getAttribute("aria-labelledby")&&s(e,"needs aria-label","serious",l),e==="iframe"&&!l.getAttribute("title")&&!l.getAttribute("aria-label")&&s(e,"iframe needs title","serious",l),ke.has(e)&&!a.querySelector("track")&&!l.getAttribute("aria-label")&&s(e,"media needs captions/aria-label","serious",l),Z.has(e)&&!l.innerText?.trim()&&!l.getAttribute("aria-label")&&s(e,"empty heading","moderate",l)}),t.fixed=t.details.length,t.score=ie(t),t.renderTime=parseFloat((performance.now()-i).toFixed(2)),t},startObserver(t){this.observer||typeof document>"u"||(this.observer=new MutationObserver(()=>this.applyFixes(t)),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!1}))},stopObserver(){this.observer?.disconnect(),this.observer=null},announce:p,speak:Y,showVisualAlert:ae,trapFocus:E};var g=require("react");var _=he(require("react"),1),d=require("react/jsx-runtime"),G={highContrast:!1,reduceMotion:!1,autoFix:!0,dyslexiaFont:!1,fontScale:100,darkMode:!1,largeTargets:!1,speechEnabled:!1,colorBlindMode:"none",showAuditBadge:!1,timeoutWarning:void 0},T=[80,90,100,110,120,130],He=[{value:"none",label:"None"},{value:"deuteranopia",label:"Deuteranopia"},{value:"protanopia",label:"Protanopia"},{value:"tritanopia",label:"Tritanopia"},{value:"achromatopsia",label:"Greyscale"}],le=[{id:"highContrast",label:"High contrast",description:"Increases contrast for low vision",icon:"\u25D1"},{id:"darkMode",label:"Dark mode",description:"Inverts colours for dark preference",icon:"\u{1F319}"},{id:"reduceMotion",label:"Reduce motion",description:"Disables transitions & animations",icon:"\u23F8"},{id:"largeTargets",label:"Large click targets",description:"44\xD744px minimum touch targets",icon:"\u{1F446}"},{id:"speechEnabled",label:"Speak on focus",description:"Browser reads focused element aloud",icon:"\u{1F50A}"},{id:"autoFix",label:"Auto-fix ARIA",description:"Watches for new DOM nodes",icon:"\u267F"},{id:"dyslexiaFont",label:"Dyslexia-friendly font",description:"Atkinson Hyperlegible font",icon:"Aa"},{id:"showAuditBadge",label:"Show audit score",description:"Dev-only score badge (localhost)",icon:"\u{1F4CA}"}];function ze({checked:t,onChange:i,label:n}){return(0,d.jsxs)("label",{"aria-label":n,style:{position:"relative",display:"inline-flex",width:40,height:24,cursor:"pointer",flexShrink:0},children:[(0,d.jsx)("input",{type:"checkbox",checked:t,onChange:s=>i(s.target.checked),style:{opacity:0,width:0,height:0,position:"absolute"}}),(0,d.jsx)("span",{style:{position:"absolute",inset:0,borderRadius:99,background:t?"#0d9488":"#cbd5e1",transition:"background 0.2s"}}),(0,d.jsx)("span",{style:{position:"absolute",top:3,left:t?19:3,width:18,height:18,background:"#fff",borderRadius:"50%",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,0.2)",pointerEvents:"none"}})]})}var V=(0,_.forwardRef)(({position:t,settings:i,report:n,isActive:s,set:a,onApply:l,onReset:e,onClose:r},y)=>(0,d.jsxs)("div",{ref:y,role:"dialog","aria-modal":"true","aria-label":"yuktai-a11y accessibility options",style:{position:"fixed",bottom:24,...t==="left"?{left:88}:{right:88},width:320,background:"#fff",border:"1px solid #e2e8f0",borderRadius:16,boxShadow:"0 8px 32px rgba(0,0,0,0.12)",zIndex:9998,overflow:"hidden",fontFamily:"system-ui,-apple-system,sans-serif",maxHeight:"80vh",overflowY:"auto"},children:[(0,d.jsxs)("div",{style:{padding:"14px 18px 12px",borderBottom:"1px solid #f1f5f9",display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:5},children:[(0,d.jsx)("span",{style:{fontSize:10,fontWeight:700,padding:"2px 7px",borderRadius:99,background:"#f0fdfa",color:"#0d9488",letterSpacing:"0.05em",fontFamily:"monospace"},children:"@yuktishaalaa/yuktai v2.0.0"}),s&&(0,d.jsx)("span",{style:{fontSize:10,fontWeight:700,padding:"2px 7px",borderRadius:99,background:"#f0fdfa",color:"#0f766e",border:"1px solid #99f6e4"},children:"\u25CF ACTIVE"})]}),(0,d.jsx)("p",{style:{margin:"0 0 2px",fontSize:15,fontWeight:600,color:"#0f172a"},children:"Accessibility"}),(0,d.jsx)("p",{style:{margin:0,fontSize:12,color:"#64748b"},children:"WCAG 2.2 \xB7 No JAWS needed \xB7 Open Source"})]}),(0,d.jsx)("button",{onClick:r,"aria-label":"Close accessibility panel",style:{background:"none",border:"none",cursor:"pointer",padding:4,color:"#94a3b8",fontSize:18,lineHeight:1,borderRadius:6},children:"\xD7"})]}),(0,d.jsx)("div",{style:{padding:"6px 0"},children:le.map((o,u)=>(0,d.jsxs)(_.default.Fragment,{children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 18px",gap:12},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,flex:1},children:[(0,d.jsx)("span",{"aria-hidden":"true",style:{width:30,height:30,borderRadius:8,background:"#f0fdfa",color:"#0d9488",display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,flexShrink:0,fontWeight:700},children:o.icon}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{style:{margin:0,fontSize:13,fontWeight:500,color:"#0f172a"},children:o.label}),(0,d.jsx)("p",{style:{margin:0,fontSize:11,color:"#94a3b8"},children:o.description})]})]}),(0,d.jsx)(ze,{checked:i[o.id],onChange:x=>a(o.id,x),label:`Toggle ${o.label}`})]}),u<le.length-1&&(0,d.jsx)("div",{style:{height:1,background:"#f8fafc",margin:"0 18px"}})]},o.id))}),(0,d.jsxs)("div",{style:{padding:"10px 18px",borderTop:"1px solid #f1f5f9"},children:[(0,d.jsx)("p",{style:{margin:"0 0 8px",fontSize:13,fontWeight:500,color:"#0f172a"},children:"\u{1F3A8} Colour blindness"}),(0,d.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:He.map(o=>(0,d.jsx)("button",{onClick:()=>a("colorBlindMode",o.value),"aria-pressed":i.colorBlindMode===o.value,style:{padding:"4px 10px",borderRadius:20,fontSize:11,fontWeight:500,border:`1px solid ${i.colorBlindMode===o.value?"#0d9488":"#e2e8f0"}`,background:i.colorBlindMode===o.value?"#f0fdfa":"#fff",color:i.colorBlindMode===o.value?"#0d9488":"#64748b",cursor:"pointer",transition:"all 0.15s"},children:o.label},o.value))})]}),(0,d.jsxs)("div",{style:{padding:"10px 18px 14px",borderTop:"1px solid #f1f5f9"},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[(0,d.jsx)("p",{style:{margin:0,fontSize:13,fontWeight:500,color:"#0f172a"},children:"Text size"}),(0,d.jsxs)("span",{style:{fontSize:12,fontWeight:600,color:"#0d9488",background:"#f0fdfa",padding:"2px 8px",borderRadius:99},children:[i.fontScale,"%"]})]}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,d.jsx)("button",{onClick:()=>{let o=T.indexOf(i.fontScale);o>0&&a("fontScale",T[o-1])},disabled:i.fontScale<=80,"aria-label":"Decrease text size",style:{width:30,height:30,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",cursor:i.fontScale<=80?"not-allowed":"pointer",fontSize:16,color:i.fontScale<=80?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"\u2212"}),(0,d.jsx)("div",{style:{flex:1,display:"flex",gap:3},children:T.map(o=>(0,d.jsx)("button",{onClick:()=>a("fontScale",o),"aria-label":`Set text size to ${o}%`,style:{flex:1,height:6,borderRadius:99,border:"none",cursor:"pointer",padding:0,background:o<=i.fontScale?"#0d9488":"#e2e8f0",transition:"background 0.15s"}},o))}),(0,d.jsx)("button",{onClick:()=>{let o=T.indexOf(i.fontScale);o<T.length-1&&a("fontScale",T[o+1])},disabled:i.fontScale>=130,"aria-label":"Increase text size",style:{width:30,height:30,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",cursor:i.fontScale>=130?"not-allowed":"pointer",fontSize:16,color:i.fontScale>=130?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"+"})]})]}),n&&(0,d.jsx)("div",{role:"status",style:{margin:"0 14px",padding:"8px 12px",background:"#f0fdfa",border:"1px solid #99f6e4",borderRadius:8,fontSize:12,color:"#0f766e",fontWeight:500,fontFamily:"monospace"},children:n.fixed>0?`\u2713 ${n.fixed} fixes \xB7 ${n.scanned} nodes \xB7 ${n.renderTime}ms \xB7 Score: ${n.score}/100`:`\u2713 0 fixes needed \xB7 ${n.scanned} nodes clean \xB7 ${n.renderTime}ms`}),(0,d.jsxs)("div",{style:{display:"flex",gap:8,padding:"12px 14px 14px"},children:[(0,d.jsx)("button",{onClick:e,style:{flex:1,padding:"8px 0",fontSize:13,fontWeight:500,borderRadius:9,border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",cursor:"pointer"},children:"Reset"}),(0,d.jsx)("button",{onClick:l,style:{flex:2,padding:"8px 0",fontSize:13,fontWeight:600,borderRadius:9,border:"none",background:"#0d9488",color:"#fff",cursor:"pointer"},children:"Apply settings"})]})]}));V.displayName="WidgetPanel";var h=require("react/jsx-runtime"),F=null,M=null;function N({children:t,position:i="left"}){let[n,s]=(0,g.useState)(!1),[a,l]=(0,g.useState)(!1),[e,r]=(0,g.useState)(G),[y,f]=(0,g.useState)(null),[o,u]=(0,g.useState)(!1),x=(0,g.useRef)(null),k=(0,g.useRef)(null);(0,g.useEffect)(()=>s(!0),[]),(0,g.useEffect)(()=>{if(F)return;let c=document.createElement("style");return c.innerHTML=`
|
|
270
|
+
`,document.body.appendChild(t),J=t}function ie(t){let i={critical:20,serious:10,moderate:5,minor:2},n=t.details.reduce((s,a)=>s+(i[a.severity]||0),0);return Math.max(0,Math.min(100,100-n))}var b={name:"yuktai-a11y",version:"2.0.0",observer:null,async execute(t){if(!t.enabled)return this.stopObserver(),"yuktai-a11y: disabled.";S=t,$e(),Re(),Ee(),Te(),t.showSkipLinks!==!1&&Se(),t.showPreferencePanel!==!1&&ne(t),L(t);let i=this.applyFixes(t);i.score=ie(i),t.showAuditBadge&&Me(i),t.timeoutWarning&&oe(t.timeoutWarning),t.autoFix&&this.startObserver(t);let n=`${i.fixed} accessibility fixes applied. Score: ${i.score}/100.`;return p(n,i.score>=90?"success":"info",!1),`yuktai-a11y v2: ${n} Scanned ${i.scanned} elements in ${i.renderTime}ms.`},applyFixes(t){let i={fixed:0,scanned:0,renderTime:0,score:100,details:[]};if(typeof document>"u")return i;let n=performance.now(),s=document.querySelectorAll("*");i.scanned=s.length;let a=(l,e,r,y)=>{i.details.push({tag:l,fix:e,severity:r,element:y.outerHTML.slice(0,100)}),i.fixed++};return s.forEach(l=>{let e=l,r=e.tagName.toLowerCase();if(r==="html"&&!e.getAttribute("lang")&&(e.setAttribute("lang","en"),a(r,'lang="en" added to <html>',"critical",e)),r==="head"&&!document.title&&(document.title=document.querySelector("h1")?.innerText?.trim()||"Page",a(r,`document.title set to "${document.title}"`,"serious",e)),r==="meta"){let o=e.getAttribute("name"),u=e.getAttribute("content")||"";o==="viewport"&&u.includes("user-scalable=no")&&(e.setAttribute("content",u.replace("user-scalable=no","user-scalable=yes")),a(r,"user-scalable=yes restored","serious",e)),o==="viewport"&&/maximum-scale=1(?:[^0-9]|$)/.test(u)&&(e.setAttribute("content",u.replace(/maximum-scale=1(?=[^0-9]|$)/,"maximum-scale=5")),a(r,"maximum-scale=5 restored","serious",e))}if(r==="main"&&!e.getAttribute("tabindex")&&(e.setAttribute("tabindex","-1"),e.getAttribute("id")||e.setAttribute("id","main-content")),r==="body"&&document.querySelectorAll("video[autoplay]:not([muted])").forEach(o=>{o.muted=!0,a("video","autoplay video muted (deaf users)","serious",e)}),t.largeTargets&&(r==="button"||r==="a"||r==="input")){let o=e.getBoundingClientRect();o.width>0&&o.width<24&&(e.style.minWidth="44px",e.style.minHeight="44px",a(r,"min 44px touch target enforced","minor",e))}if(Z.has(r)&&(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",`${r.toUpperCase()} section`),a(r,"aria-label added (empty heading)","moderate",e)),e.hasAttribute("onclick")&&!e.getAttribute("tabindex")&&(e.setAttribute("tabindex","0"),e.onkeydown||(e.onkeydown=o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),e.click())}),a(r,"tabindex=0 + keydown (clickable heading)","minor",e))),r==="img"&&(e.hasAttribute("alt")||(e.setAttribute("alt",""),e.setAttribute("aria-hidden","true"),a(r,'alt="" aria-hidden="true"',"serious",e)),e.getAttribute("role")==="presentation"&&e.getAttribute("alt")!==""&&(e.setAttribute("alt",""),a(r,'alt="" (role=presentation)',"minor",e))),r==="area"&&!e.getAttribute("alt")){let o=e.getAttribute("title")||e.getAttribute("href")||"map area";e.setAttribute("alt",o),a(r,`alt="${o}" on <area>`,"serious",e)}if(r==="svg"){if(!e.getAttribute("aria-hidden")&&!e.getAttribute("aria-label")&&!l.querySelector("title"))if(!e.getAttribute("role")||e.getAttribute("role")==="img"){let o=document.createElementNS("http://www.w3.org/2000/svg","title");o.textContent="graphic",e.prepend(o),e.setAttribute("role","img"),a(r,'role="img" + <title> injected',"moderate",e)}else e.setAttribute("aria-hidden","true"),a(r,'aria-hidden="true" (decorative svg)',"minor",e);e.getAttribute("focusable")||e.setAttribute("focusable","false")}if(r==="canvas"&&(e.getAttribute("role")||(e.setAttribute("role","img"),a(r,'role="img"',"serious",e)),e.getAttribute("aria-label")||(e.setAttribute("aria-label",e.getAttribute("title")||"canvas graphic"),a(r,"aria-label added to canvas","serious",e))),(r==="object"||r==="embed")&&!e.getAttribute("aria-label")&&!e.getAttribute("title")&&(e.setAttribute("aria-label",`embedded ${r} content`),a(r,`aria-label added to <${r}>`,"moderate",e)),r==="video"&&!l.querySelector("track")&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label",e.getAttribute("title")||"video player"),a(r,"aria-label added (no captions track)","serious",e)),r==="audio"&&!l.querySelector("track")&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label",e.getAttribute("title")||"audio player"),a(r,"aria-label added to audio","serious",e)),r==="iframe"&&!e.getAttribute("title")&&!e.getAttribute("aria-label")&&(e.setAttribute("title","embedded content"),e.setAttribute("aria-label","embedded content"),a(r,'title + aria-label="embedded content"',"serious",e)),r==="figure"&&!l.querySelector("figcaption")&&!e.getAttribute("aria-label")){let u=l.querySelector("img")?.getAttribute("alt");u&&(e.setAttribute("aria-label",u),a(r,"aria-label from inner img alt","minor",e))}if(r==="button"){if(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let o=e.getAttribute("title")||e.getAttribute("data-label")||"button";e.setAttribute("aria-label",o),a(r,`aria-label="${o}" (empty button)`,"critical",e)}e.hasAttribute("disabled")&&!e.getAttribute("aria-disabled")&&(e.setAttribute("aria-disabled","true"),i.fixed++),e.getAttribute("data-yuktai-announced")||(e.setAttribute("data-yuktai-announced","true"),e.addEventListener("click",()=>{let o=e.getAttribute("aria-label")||e.textContent?.trim()||"button";setTimeout(()=>{p(`${o} activated`,"success",!1)},100)}))}if(r==="a"){let o=e;if(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let u=e.getAttribute("title")||"link";e.setAttribute("aria-label",u),a(r,`aria-label="${u}" (empty link)`,"critical",e)}if(o.target==="_blank"){o.rel?.includes("noopener")||(o.rel="noopener noreferrer",i.fixed++);let u=o.getAttribute("aria-label")||o.innerText?.trim()||"link";u.includes("opens in new window")||(o.setAttribute("aria-label",`${u} (opens in new window)`),a(r,"aria-label: new-window warning","moderate",e))}!o.href&&!o.getAttribute("role")&&!o.getAttribute("tabindex")&&(o.setAttribute("role","button"),o.setAttribute("tabindex","0"),a(r,'role="button" tabindex=0 (href-less link)',"serious",e))}if((e.hasAttribute("onclick")||typeof window<"u"&&window.getComputedStyle(e).cursor==="pointer")&&!ve.has(r)&&(e.getAttribute("role")||(e.setAttribute("role","button"),a(r,'role="button" (clickable non-interactive)',"serious",e)),e.tabIndex<0&&(e.tabIndex=0,i.fixed++),e.onkeydown||(e.onkeydown=o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),e.click())})),Q.has(r)){let o=e;if(!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let u=e.getAttribute("placeholder")||e.getAttribute("name")||e.getAttribute("title")||r;e.setAttribute("aria-label",u),a(r,`aria-label="${u}"`,"serious",e)}if(e.hasAttribute("required")&&!e.getAttribute("aria-required")&&(e.setAttribute("aria-required","true"),i.fixed++),e.hasAttribute("disabled")&&!e.getAttribute("aria-disabled")&&(e.setAttribute("aria-disabled","true"),i.fixed++),e.hasAttribute("readonly")&&!e.getAttribute("aria-readonly")&&(e.setAttribute("aria-readonly","true"),i.fixed++),e.getAttribute("data-yuktai-validation")||(e.setAttribute("data-yuktai-validation","true"),e.addEventListener("invalid",()=>{let u=e.getAttribute("aria-label")||e.getAttribute("placeholder")||"Field",x=e.validationMessage||"is invalid";p(`Error: ${u} ${x}`,"error")}),e.addEventListener("change",()=>{if(e.validity?.valid){let u=e.getAttribute("aria-label")||e.getAttribute("placeholder")||"Field";p(`${u} looks good`,"success",!1)}})),r==="input"&&!o.autocomplete){let u=o.name||"";o.type==="email"||u.includes("email")?(o.autocomplete="email",i.fixed++):o.type==="tel"||u.includes("tel")?(o.autocomplete="tel",i.fixed++):o.type==="password"?(o.autocomplete="current-password",i.fixed++):u.includes("firstname")||u.includes("fname")?(o.autocomplete="given-name",i.fixed++):u.includes("lastname")||u.includes("lname")?(o.autocomplete="family-name",i.fixed++):u==="name"||u.includes("fullname")?(o.autocomplete="name",i.fixed++):u.includes("zip")||u.includes("postal")?(o.autocomplete="postal-code",i.fixed++):u.includes("city")?(o.autocomplete="address-level2",i.fixed++):u.includes("country")&&(o.autocomplete="country",i.fixed++)}r==="input"&&o.type==="image"&&!e.getAttribute("alt")&&(e.setAttribute("alt",e.getAttribute("value")||"submit"),a(r,"alt added to input[type=image]","serious",e)),r==="input"&&o.type==="range"&&(e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin",o.min||"0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax",o.max||"100"),e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow",o.value||"50"),i.fixed++)}if(r==="fieldset"&&!l.querySelector("legend")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","form group"),a(r,'aria-label="form group" (no legend)',"moderate",e)),r==="table"&&(!l.querySelector("th")&&!e.getAttribute("role")&&(e.setAttribute("role","grid"),a(r,'role="grid" (no <th>)',"serious",e)),!l.querySelector("caption")&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label","data table"),a(r,'aria-label="data table"',"moderate",e))),r==="th"&&!e.getAttribute("scope")){let o=e.closest("thead")!==null;e.setAttribute("scope",o?"col":"row"),a(r,`scope="${o?"col":"row"}"`,"moderate",e)}if(we.has(r)&&(e.getAttribute("role")==="presentation"&&(l.querySelectorAll("li").forEach(o=>{o.getAttribute("role")||o.setAttribute("role","presentation")}),i.fixed++),(r==="ul"||r==="ol")&&!e.getAttribute("aria-label"))){let o=e.closest("nav");o&&(e.setAttribute("aria-label",o.getAttribute("aria-label")||"navigation list"),a(r,"aria-label from parent nav","minor",e))}if(K[r]&&!e.getAttribute("role")&&(e.setAttribute("role",K[r]),a(r,`role="${K[r]}"`,"minor",e)),["nav","section","article","aside"].includes(r)){let o=l.parentElement?.querySelectorAll(r);if(o&&o.length>1&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let x=l.querySelector("h1,h2,h3,h4,h5,h6")?.textContent?.trim();x&&(e.setAttribute("aria-label",x),a(r,"aria-label from inner heading","moderate",e))}}if(r==="details"&&!l.querySelector("summary")){let o=document.createElement("summary");o.textContent=e.getAttribute("aria-label")||"More details",e.prepend(o),a(r,"<summary> injected","moderate",e)}if(r==="summary"&&!e.innerText?.trim()&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label","Toggle details"),a(r,'aria-label="Toggle details"',"moderate",e)),r==="dialog"){let o=e.getAttribute("role");if(o&&o!=="dialog"&&o!=="alertdialog"&&(e.setAttribute("role","dialog"),a(r,'role corrected to "dialog"',"serious",e)),!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let x=l.querySelector("h1,h2,h3,h4,h5,h6")?.textContent?.trim()||"dialog";e.setAttribute("aria-label",x),a(r,"aria-label added to dialog","serious",e)}e.getAttribute("data-yuktai-trap")||(e.setAttribute("data-yuktai-trap","true"),new MutationObserver(()=>{e.style.display!=="none"&&e.style.visibility!=="hidden"&&E(e)}).observe(e,{attributes:!0,attributeFilter:["style","open"]}))}if(r==="abbr"&&!e.getAttribute("title")&&(e.setAttribute("title",e.innerText?.trim()||"abbreviation"),a(r,"title added to <abbr>","minor",e)),r==="time"&&!e.getAttribute("datetime")&&e.innerText?.trim()&&(e.setAttribute("datetime",e.innerText.trim()),a(r,`datetime="${e.innerText.trim()}" added`,"minor",e)),r==="meter"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",e.getAttribute("title")||"meter"),a(r,"aria-label added to <meter>","moderate",e)),r==="progress"){!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",e.getAttribute("title")||"progress"),a(r,"aria-label added to <progress>","moderate",e));let o=e;e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow",String(o.value)),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax",String(o.max||1)),i.fixed++}let f=e.getAttribute("role")||"";if(f==="tab"&&!e.getAttribute("aria-selected")&&(e.setAttribute("aria-selected","false"),i.fixed++),f==="tabpanel"&&(!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","tab panel"),a(r,'aria-label="tab panel"',"moderate",e)),e.getAttribute("tabindex")||(e.setAttribute("tabindex","0"),i.fixed++)),["alert","status","log","marquee"].includes(f)){if(!e.getAttribute("aria-live")){let o=f==="alert"?"assertive":"polite";e.setAttribute("aria-live",o),a(r,`aria-live="${o}" on role=${f}`,"moderate",e)}e.getAttribute("aria-atomic")||(e.setAttribute("aria-atomic","true"),i.fixed++)}f==="tooltip"&&!e.getAttribute("aria-live")&&(e.setAttribute("aria-live","polite"),i.fixed++),(f==="menu"||f==="menubar")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","menu"),a(r,'aria-label="menu"',"moderate",e)),f==="listbox"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","listbox"),a(r,'aria-label="listbox"',"moderate",e)),f==="option"&&!e.getAttribute("aria-selected")&&(e.setAttribute("aria-selected","false"),i.fixed++),f==="slider"&&(e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin","0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax","100"),e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow","50"),i.fixed++),(f==="checkbox"||f==="radio")&&!e.getAttribute("aria-checked")&&(e.setAttribute("aria-checked","false"),a(r,`aria-checked="false" on role=${f}`,"serious",e)),f==="combobox"&&(e.getAttribute("aria-expanded")||(e.setAttribute("aria-expanded","false"),a(r,'aria-expanded="false" on combobox',"serious",e)),e.getAttribute("aria-haspopup")||(e.setAttribute("aria-haspopup","listbox"),i.fixed++)),(f==="grid"||f==="treegrid")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","data grid"),a(r,'aria-label="data grid"',"moderate",e)),f==="tree"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","tree"),a(r,'aria-label="tree"',"moderate",e)),f==="spinbutton"&&(e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow","0"),e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin","0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax","100"),i.fixed++)}),i.renderTime=parseFloat((performance.now()-n).toFixed(2)),i},scan(){let t={fixed:0,scanned:0,renderTime:0,score:100,details:[]};if(typeof document>"u")return t;let i=performance.now(),n=document.querySelectorAll("*");t.scanned=n.length;let s=(a,l,e,r)=>t.details.push({tag:a,fix:l,severity:e,element:r.outerHTML.slice(0,100)});return n.forEach(a=>{let l=a,e=l.tagName.toLowerCase();(e==="a"||e==="button")&&!l.innerText?.trim()&&!l.getAttribute("aria-label")&&s(e,"needs aria-label (empty)","critical",l),e==="img"&&!l.hasAttribute("alt")&&s(e,"needs alt text","serious",l),Q.has(e)&&!l.getAttribute("aria-label")&&!l.getAttribute("aria-labelledby")&&s(e,"needs aria-label","serious",l),e==="iframe"&&!l.getAttribute("title")&&!l.getAttribute("aria-label")&&s(e,"iframe needs title","serious",l),ke.has(e)&&!a.querySelector("track")&&!l.getAttribute("aria-label")&&s(e,"media needs captions/aria-label","serious",l),Z.has(e)&&!l.innerText?.trim()&&!l.getAttribute("aria-label")&&s(e,"empty heading","moderate",l)}),t.fixed=t.details.length,t.score=ie(t),t.renderTime=parseFloat((performance.now()-i).toFixed(2)),t},startObserver(t){this.observer||typeof document>"u"||(this.observer=new MutationObserver(()=>this.applyFixes(t)),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!1}))},stopObserver(){this.observer?.disconnect(),this.observer=null},announce:p,speak:Y,showVisualAlert:ae,trapFocus:E};var g=require("react");var W=he(require("react"),1),d=require("react/jsx-runtime"),G={highContrast:!1,reduceMotion:!1,autoFix:!0,dyslexiaFont:!1,fontScale:100,darkMode:!1,largeTargets:!1,speechEnabled:!1,colorBlindMode:"none",showAuditBadge:!1,timeoutWarning:void 0},T=[80,90,100,110,120,130],He=[{value:"none",label:"None"},{value:"deuteranopia",label:"Deuteranopia"},{value:"protanopia",label:"Protanopia"},{value:"tritanopia",label:"Tritanopia"},{value:"achromatopsia",label:"Greyscale"}],le=[{id:"highContrast",label:"High contrast",description:"Increases contrast for low vision",icon:"\u25D1"},{id:"darkMode",label:"Dark mode",description:"Inverts colours for dark preference",icon:"\u{1F319}"},{id:"reduceMotion",label:"Reduce motion",description:"Disables transitions & animations",icon:"\u23F8"},{id:"largeTargets",label:"Large click targets",description:"44\xD744px minimum touch targets",icon:"\u{1F446}"},{id:"speechEnabled",label:"Speak on focus",description:"Browser reads focused element aloud",icon:"\u{1F50A}"},{id:"autoFix",label:"Auto-fix ARIA",description:"Watches for new DOM nodes",icon:"\u267F"},{id:"dyslexiaFont",label:"Dyslexia-friendly font",description:"Atkinson Hyperlegible font",icon:"Aa"},{id:"showAuditBadge",label:"Show audit score",description:"Dev-only score badge (localhost)",icon:"\u{1F4CA}"}];function ze({checked:t,onChange:i,label:n}){return(0,d.jsxs)("label",{"aria-label":n,style:{position:"relative",display:"inline-flex",width:40,height:24,cursor:"pointer",flexShrink:0},children:[(0,d.jsx)("input",{type:"checkbox",checked:t,onChange:s=>i(s.target.checked),style:{opacity:0,width:0,height:0,position:"absolute"}}),(0,d.jsx)("span",{style:{position:"absolute",inset:0,borderRadius:99,background:t?"#0d9488":"#cbd5e1",transition:"background 0.2s"}}),(0,d.jsx)("span",{style:{position:"absolute",top:3,left:t?19:3,width:18,height:18,background:"#fff",borderRadius:"50%",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,0.2)",pointerEvents:"none"}})]})}var V=(0,W.forwardRef)(({position:t,settings:i,report:n,isActive:s,set:a,onApply:l,onReset:e,onClose:r},y)=>(0,d.jsxs)("div",{ref:y,role:"dialog","aria-modal":"true","aria-label":"yuktai-a11y accessibility options",style:{position:"fixed",bottom:24,...t==="left"?{left:88}:{right:88},width:320,background:"#fff",border:"1px solid #e2e8f0",borderRadius:16,boxShadow:"0 8px 32px rgba(0,0,0,0.12)",zIndex:9998,overflow:"hidden",fontFamily:"system-ui,-apple-system,sans-serif",maxHeight:"80vh",overflowY:"auto"},children:[(0,d.jsxs)("div",{style:{padding:"14px 18px 12px",borderBottom:"1px solid #f1f5f9",display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:5},children:[(0,d.jsx)("span",{style:{fontSize:10,fontWeight:700,padding:"2px 7px",borderRadius:99,background:"#f0fdfa",color:"#0d9488",letterSpacing:"0.05em",fontFamily:"monospace"},children:"@yuktishaalaa/yuktai v2.0.0"}),s&&(0,d.jsx)("span",{style:{fontSize:10,fontWeight:700,padding:"2px 7px",borderRadius:99,background:"#f0fdfa",color:"#0f766e",border:"1px solid #99f6e4"},children:"\u25CF ACTIVE"})]}),(0,d.jsx)("p",{style:{margin:"0 0 2px",fontSize:15,fontWeight:600,color:"#0f172a"},children:"Accessibility"}),(0,d.jsx)("p",{style:{margin:0,fontSize:12,color:"#64748b"},children:"WCAG 2.2 \xB7 Open Source"})]}),(0,d.jsx)("button",{onClick:r,"aria-label":"Close accessibility panel",style:{background:"none",border:"none",cursor:"pointer",padding:4,color:"#94a3b8",fontSize:18,lineHeight:1,borderRadius:6},children:"\xD7"})]}),(0,d.jsx)("div",{style:{padding:"6px 0"},children:le.map((o,u)=>(0,d.jsxs)(W.default.Fragment,{children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 18px",gap:12},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,flex:1},children:[(0,d.jsx)("span",{"aria-hidden":"true",style:{width:30,height:30,borderRadius:8,background:"#f0fdfa",color:"#0d9488",display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,flexShrink:0,fontWeight:700},children:o.icon}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{style:{margin:0,fontSize:13,fontWeight:500,color:"#0f172a"},children:o.label}),(0,d.jsx)("p",{style:{margin:0,fontSize:11,color:"#94a3b8"},children:o.description})]})]}),(0,d.jsx)(ze,{checked:i[o.id],onChange:x=>a(o.id,x),label:`Toggle ${o.label}`})]}),u<le.length-1&&(0,d.jsx)("div",{style:{height:1,background:"#f8fafc",margin:"0 18px"}})]},o.id))}),(0,d.jsxs)("div",{style:{padding:"10px 18px",borderTop:"1px solid #f1f5f9"},children:[(0,d.jsx)("p",{style:{margin:"0 0 8px",fontSize:13,fontWeight:500,color:"#0f172a"},children:"\u{1F3A8} Colour blindness"}),(0,d.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:He.map(o=>(0,d.jsx)("button",{onClick:()=>a("colorBlindMode",o.value),"aria-pressed":i.colorBlindMode===o.value,style:{padding:"4px 10px",borderRadius:20,fontSize:11,fontWeight:500,border:`1px solid ${i.colorBlindMode===o.value?"#0d9488":"#e2e8f0"}`,background:i.colorBlindMode===o.value?"#f0fdfa":"#fff",color:i.colorBlindMode===o.value?"#0d9488":"#64748b",cursor:"pointer",transition:"all 0.15s"},children:o.label},o.value))})]}),(0,d.jsxs)("div",{style:{padding:"10px 18px 14px",borderTop:"1px solid #f1f5f9"},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[(0,d.jsx)("p",{style:{margin:0,fontSize:13,fontWeight:500,color:"#0f172a"},children:"Text size"}),(0,d.jsxs)("span",{style:{fontSize:12,fontWeight:600,color:"#0d9488",background:"#f0fdfa",padding:"2px 8px",borderRadius:99},children:[i.fontScale,"%"]})]}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,d.jsx)("button",{onClick:()=>{let o=T.indexOf(i.fontScale);o>0&&a("fontScale",T[o-1])},disabled:i.fontScale<=80,"aria-label":"Decrease text size",style:{width:30,height:30,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",cursor:i.fontScale<=80?"not-allowed":"pointer",fontSize:16,color:i.fontScale<=80?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"\u2212"}),(0,d.jsx)("div",{style:{flex:1,display:"flex",gap:3},children:T.map(o=>(0,d.jsx)("button",{onClick:()=>a("fontScale",o),"aria-label":`Set text size to ${o}%`,style:{flex:1,height:6,borderRadius:99,border:"none",cursor:"pointer",padding:0,background:o<=i.fontScale?"#0d9488":"#e2e8f0",transition:"background 0.15s"}},o))}),(0,d.jsx)("button",{onClick:()=>{let o=T.indexOf(i.fontScale);o<T.length-1&&a("fontScale",T[o+1])},disabled:i.fontScale>=130,"aria-label":"Increase text size",style:{width:30,height:30,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",cursor:i.fontScale>=130?"not-allowed":"pointer",fontSize:16,color:i.fontScale>=130?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"+"})]})]}),n&&(0,d.jsx)("div",{role:"status",style:{margin:"0 14px",padding:"8px 12px",background:"#f0fdfa",border:"1px solid #99f6e4",borderRadius:8,fontSize:12,color:"#0f766e",fontWeight:500,fontFamily:"monospace"},children:n.fixed>0?`\u2713 ${n.fixed} fixes \xB7 ${n.scanned} nodes \xB7 ${n.renderTime}ms \xB7 Score: ${n.score}/100`:`\u2713 0 fixes needed \xB7 ${n.scanned} nodes clean \xB7 ${n.renderTime}ms`}),(0,d.jsxs)("div",{style:{display:"flex",gap:8,padding:"12px 14px 14px"},children:[(0,d.jsx)("button",{onClick:e,style:{flex:1,padding:"8px 0",fontSize:13,fontWeight:500,borderRadius:9,border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",cursor:"pointer"},children:"Reset"}),(0,d.jsx)("button",{onClick:l,style:{flex:2,padding:"8px 0",fontSize:13,fontWeight:600,borderRadius:9,border:"none",background:"#0d9488",color:"#fff",cursor:"pointer"},children:"Apply settings"})]})]}));V.displayName="WidgetPanel";var h=require("react/jsx-runtime"),F=null,M=null;function q({children:t,position:i="left"}){let[n,s]=(0,g.useState)(!1),[a,l]=(0,g.useState)(!1),[e,r]=(0,g.useState)(G),[y,f]=(0,g.useState)(null),[o,u]=(0,g.useState)(!1),x=(0,g.useRef)(null),k=(0,g.useRef)(null);(0,g.useEffect)(()=>s(!0),[]),(0,g.useEffect)(()=>{if(F)return;let c=document.createElement("style");return c.innerHTML=`
|
|
271
271
|
*:focus-visible {
|
|
272
272
|
outline: 3px solid #0d9488 !important;
|
|
273
273
|
outline-offset: 3px !important;
|
|
@@ -277,11 +277,11 @@
|
|
|
277
277
|
*:focus:not(:focus-visible) {
|
|
278
278
|
outline: none !important;
|
|
279
279
|
}
|
|
280
|
-
`,document.head.appendChild(c),F=c,()=>{F?.remove(),F=null}},[]),(0,g.useEffect)(()=>()=>{b.stopObserver()},[]),(0,g.useEffect)(()=>{if(!a)return;let c=A=>{x.current&&!x.current.contains(A.target)&&k.current&&!k.current.contains(A.target)&&(l(!1),k.current?.focus(),b.announce("Accessibility panel closed","info",!1))};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[a]),(0,g.useEffect)(()=>{let c=A=>{A.key==="Escape"&&a&&(l(!1),k.current?.focus(),b.announce("Accessibility panel closed","info",!1))};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[a]);let de=(c,A)=>r(C=>({...C,[c]:A})),ue=(0,g.useCallback)(async()=>{let c={enabled:!0,highContrast:e.highContrast,darkMode:e.darkMode??!1,reduceMotion:e.reduceMotion,autoFix:e.autoFix,largeTargets:e.largeTargets??!1,speechEnabled:e.speechEnabled??!1,colorBlindMode:e.colorBlindMode??"none",showPreferencePanel:!1,showSkipLinks:!0,showAuditBadge:e.showAuditBadge??!1,timeoutWarning:e.timeoutWarning??void 0},A=await b.execute(c);console.log("[yuktai-a11y]",A);let C=b.applyFixes(c);f(C);let fe=Math.min(Math.max(e.fontScale??100,80),130);if(document.documentElement.style.fontSize=`${fe}%`,e.dyslexiaFont){if(!M){let
|
|
280
|
+
`,document.head.appendChild(c),F=c,()=>{F?.remove(),F=null}},[]),(0,g.useEffect)(()=>()=>{b.stopObserver()},[]),(0,g.useEffect)(()=>{if(!a)return;let c=A=>{x.current&&!x.current.contains(A.target)&&k.current&&!k.current.contains(A.target)&&(l(!1),k.current?.focus(),b.announce("Accessibility panel closed","info",!1))};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[a]),(0,g.useEffect)(()=>{let c=A=>{A.key==="Escape"&&a&&(l(!1),k.current?.focus(),b.announce("Accessibility panel closed","info",!1))};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[a]);let de=(c,A)=>r(C=>({...C,[c]:A})),ue=(0,g.useCallback)(async()=>{let c={enabled:!0,highContrast:e.highContrast,darkMode:e.darkMode??!1,reduceMotion:e.reduceMotion,autoFix:e.autoFix,largeTargets:e.largeTargets??!1,speechEnabled:e.speechEnabled??!1,colorBlindMode:e.colorBlindMode??"none",showPreferencePanel:!1,showSkipLinks:!0,showAuditBadge:e.showAuditBadge??!1,timeoutWarning:e.timeoutWarning??void 0},A=await b.execute(c);console.log("[yuktai-a11y]",A);let C=b.applyFixes(c);f(C);let fe=Math.min(Math.max(e.fontScale??100,80),130);if(document.documentElement.style.fontSize=`${fe}%`,e.dyslexiaFont){if(!M){let D=document.createElement("link");D.rel="stylesheet",D.href="https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:wght@400;700&display=swap",document.head.appendChild(D);let N=document.createElement("style");N.textContent=`
|
|
281
281
|
body, body * {
|
|
282
282
|
font-family: 'Atkinson Hyperlegible', Arial, sans-serif !important;
|
|
283
283
|
letter-spacing: 0.05em !important;
|
|
284
284
|
word-spacing: 0.1em !important;
|
|
285
285
|
line-height: 1.8 !important;
|
|
286
286
|
}
|
|
287
|
-
`,document.head.appendChild(
|
|
287
|
+
`,document.head.appendChild(N),M=N}}else M?.remove(),M=null;u(!0),l(!1),b.announce(`Accessibility active. ${C.fixed} fixes applied. Score: ${C.score}/100.`,"success")},[e]),ce=(0,g.useCallback)(async()=>{await b.execute({enabled:!1}),document.documentElement.style.fontSize="",M?.remove(),M=null,document.querySelectorAll("*").forEach(c=>{c.style.filter="",c.style.transition="",c.style.animation=""}),r(G),f(null),u(!1),b.announce("Accessibility reset to default.","info")},[]);return n?(0,h.jsxs)(h.Fragment,{children:[t,(0,h.jsxs)("button",{ref:k,onClick:()=>{let c=!a;l(c),c&&b.announce("Accessibility panel opened","info",!1)},"aria-label":o?"Accessibility options \u2014 currently active. Click to change settings.":"Open accessibility options","aria-expanded":a,"aria-haspopup":"dialog",style:{position:"fixed",bottom:24,...i==="left"?{left:24}:{right:24},width:52,height:52,borderRadius:"50%",background:o?"#0f766e":"#0d9488",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 14px rgba(0,0,0,0.18)",zIndex:9999,transition:"background 0.2s, transform 0.15s",outline:"none"},onMouseEnter:c=>c.currentTarget.style.transform="scale(1.08)",onMouseLeave:c=>c.currentTarget.style.transform="scale(1)",onFocus:c=>c.currentTarget.style.boxShadow="0 0 0 4px rgba(13,148,136,0.45)",onBlur:c=>c.currentTarget.style.boxShadow="0 4px 14px rgba(0,0,0,0.18)",children:[(0,h.jsx)("svg",{viewBox:"0 0 24 24",style:{width:26,height:26,fill:"#fff"},"aria-hidden":"true",focusable:"false",children:(0,h.jsx)("path",{d:"M12 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4zm9 4.5l-5-.5-2-.2V5l-4 .5-4-.5v.8L4 6.5 3 7l1 3 4-.5v2.3L6 17h2l2-4.5L12 14l2 2.5L16 17h2l-2-4.2V9.5l4 .5 1-3z"})}),o&&(0,h.jsx)("span",{"aria-hidden":"true",style:{position:"absolute",top:4,right:4,width:10,height:10,borderRadius:"50%",background:"#5eead4",border:"2px solid #fff"}})]}),a&&(0,h.jsx)(V,{ref:x,position:i,settings:e,report:y,isActive:o,set:de,onApply:ue,onReset:ce,onClose:()=>{l(!1),k.current?.focus(),b.announce("Accessibility panel closed","info",!1)}})]}):(0,h.jsx)(h.Fragment,{children:t})}var R={name:"ai.text",async execute(t){return`\u{1F916} YuktAI says: ${t}`}};var H={name:"voice.text",async execute(t){return!t||t.trim()===""?"\u{1F3A4} No speech detected":`\u{1F3A4} You said: ${t}`}};var v=class{plugins=new Map;register(i,n){if(!n||typeof n.execute!="function")throw new Error(`Invalid plugin: ${i}`);this.plugins.set(i,n)}use(i){return this.plugins.get(i)}async run(i,n){try{let s=this.use(i);if(!s)throw new Error(`Plugin not found: ${i}`);return await s.execute(n)}catch(s){throw console.error(`[YuktAI Runtime Error in ${i}]:`,s),s}}getPlugins(){return Array.from(this.plugins.keys())}};function Be(){if(typeof globalThis>"u")return new v;if(!globalThis.__yuktai_runtime__){let t=new v;t.register(b.name,b),t.register(R.name,R),t.register(H.name,H),globalThis.__yuktai_runtime__=t}return globalThis.__yuktai_runtime__}var se=typeof window<"u"?Be():new v,Pe={wcagPlugin:b,list(){return se.getPlugins()},use(t){return se.use(t)},fix(t){return b.applyFixes({enabled:!0,autoFix:!0,...t})},scan(){return b.scan()}};0&&(module.exports={Runtime,YuktAI,YuktAIWrapper,aiPlugin,voicePlugin,wcag,wcagPlugin});
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var I=null,U=null,L=null,J=null,
|
|
1
|
+
var I=null,U=null,L=null,J=null,N=null,g=null,k=null,z=null,O=null,w=null,P={deuteranopia:"yuktai-cb-d",protanopia:"yuktai-cb-p",tritanopia:"yuktai-cb-t"},X=new Set(["h1","h2","h3","h4","h5","h6"]),Z=new Set(["input","select","textarea"]),me=new Set(["button","a","input","select","textarea","details","summary"]),ye=new Set(["video","audio"]),xe=new Set(["ul","ol","dl"]);var j={nav:"navigation",header:"banner",footer:"contentinfo",main:"main",aside:"complementary"};function K(t,i="polite"){if(typeof window>"u"||!w?.speechEnabled||!window.speechSynthesis)return;window.speechSynthesis.cancel();let n=new SpeechSynthesisUtterance(t);n.rate=1,n.pitch=1,n.volume=1;let s=window.speechSynthesis.getVoices();s.length>0&&(n.voice=s[0]),window.speechSynthesis.speak(n)}function ie(t,i="info"){if(typeof document>"u")return;let s={success:{bg:"#0f9d58",border:"#0a7a44",icon:"\u2713"},error:{bg:"#d93025",border:"#b52a1c",icon:"\u2715"},warning:{bg:"#f29900",border:"#c67c00",icon:"\u26A0"},info:{bg:"#1a73e8",border:"#1557b0",icon:"\u2139"}}[i];g||(g=document.createElement("div"),g.setAttribute("role","alert"),g.setAttribute("aria-live","assertive"),g.setAttribute("aria-atomic","true"),g.style.cssText=`
|
|
2
2
|
position:fixed;top:80px;right:16px;z-index:999999;
|
|
3
3
|
max-width:320px;width:calc(100% - 32px);
|
|
4
4
|
border-radius:8px;padding:12px 16px;
|
|
@@ -134,7 +134,7 @@ var I=null,U=null,L=null,J=null,D=null,g=null,k=null,z=null,O=null,w=null,P={deu
|
|
|
134
134
|
<p style="margin:12px 0 0;font-size:11px;color:#888;text-align:center">
|
|
135
135
|
Powered by @yuktai/a11y \xB7 Press Escape to close
|
|
136
136
|
</p>
|
|
137
|
-
`,t.querySelector("[data-yuktai-close]")?.addEventListener("click",()=>{t.remove(),k=null}),t.addEventListener("keydown",s=>{s.key==="Escape"&&(t.remove(),k=null)}),document.body.appendChild(t),k=t,S(t),p("Keyboard shortcuts opened. Press Escape to close.","info")}function ke(t){if(typeof document>"u"||!w?.showAuditBadge||typeof window<"u"&&!window.location.hostname.includes("localhost")&&!window.location.hostname.includes("127.0.0.1"))return;
|
|
137
|
+
`,t.querySelector("[data-yuktai-close]")?.addEventListener("click",()=>{t.remove(),k=null}),t.addEventListener("keydown",s=>{s.key==="Escape"&&(t.remove(),k=null)}),document.body.appendChild(t),k=t,S(t),p("Keyboard shortcuts opened. Press Escape to close.","info")}function ke(t){if(typeof document>"u"||!w?.showAuditBadge||typeof window<"u"&&!window.location.hostname.includes("localhost")&&!window.location.hostname.includes("127.0.0.1"))return;N&&N.remove();let i=t.score,n=i>=90?"#0f9d58":i>=70?"#f29900":"#d93025",s=i>=90?"\u267F":i>=70?"\u26A0":"\u2715",a=document.createElement("button");a.setAttribute("aria-label",`Accessibility score: ${i} out of 100. Click for details.`),a.setAttribute("data-yuktai-badge","true"),a.style.cssText=`
|
|
138
138
|
position:fixed;bottom:16px;left:16px;z-index:999998;
|
|
139
139
|
background:${n};color:#fff;
|
|
140
140
|
border:none;border-radius:20px;cursor:pointer;
|
|
@@ -143,7 +143,7 @@ var I=null,U=null,L=null,J=null,D=null,g=null,k=null,z=null,O=null,w=null,P={deu
|
|
|
143
143
|
box-shadow:0 2px 8px rgba(0,0,0,0.3);
|
|
144
144
|
display:flex;align-items:center;gap:6px;
|
|
145
145
|
transition:transform 0.15s;
|
|
146
|
-
`,a.innerHTML=`${s} ${i}/100 <span style="font-weight:400;opacity:0.85">${t.details.length} issues</span>`,a.addEventListener("mouseenter",()=>{a.style.transform="scale(1.05)"}),a.addEventListener("mouseleave",()=>{a.style.transform="scale(1)"}),a.addEventListener("click",()=>{we(t)}),document.body.appendChild(a),
|
|
146
|
+
`,a.innerHTML=`${s} ${i}/100 <span style="font-weight:400;opacity:0.85">${t.details.length} issues</span>`,a.addEventListener("mouseenter",()=>{a.style.transform="scale(1.05)"}),a.addEventListener("mouseleave",()=>{a.style.transform="scale(1)"}),a.addEventListener("click",()=>{we(t)}),document.body.appendChild(a),N=a}function we(t){let i=document.querySelector("[data-yuktai-audit-details]");if(i){i.remove();return}let n=document.createElement("div");n.setAttribute("data-yuktai-audit-details","true"),n.setAttribute("role","dialog"),n.setAttribute("aria-label","Accessibility audit details"),n.style.cssText=`
|
|
147
147
|
position:fixed;bottom:56px;left:16px;z-index:999999;
|
|
148
148
|
background:#1a1a2e;color:#fff;border-radius:12px;
|
|
149
149
|
padding:16px;width:340px;max-width:calc(100vw - 32px);
|
|
@@ -267,7 +267,7 @@ var I=null,U=null,L=null,J=null,D=null,g=null,k=null,z=null,O=null,w=null,P={deu
|
|
|
267
267
|
<feColorMatrix type="matrix" values="0.95 0.05 0 0 0 0 0.433 0.567 0 0 0 0 0.475 0.525 0 0 0 0 0 1 0"/>
|
|
268
268
|
</filter>
|
|
269
269
|
</defs>
|
|
270
|
-
`,document.body.appendChild(t),U=t}function te(t){let i={critical:20,serious:10,moderate:5,minor:2},n=t.details.reduce((s,a)=>s+(i[a.severity]||0),0);return Math.max(0,Math.min(100,100-n))}var b={name:"yuktai-a11y",version:"2.0.0",observer:null,async execute(t){if(!t.enabled)return this.stopObserver(),"yuktai-a11y: disabled.";w=t,Ee(),Te(),Ae(),ve(),t.showSkipLinks!==!1&&he(),t.showPreferencePanel!==!1&&oe(t),C(t);let i=this.applyFixes(t);i.score=te(i),t.showAuditBadge&&ke(i),t.timeoutWarning&&re(t.timeoutWarning),t.autoFix&&this.startObserver(t);let n=`${i.fixed} accessibility fixes applied. Score: ${i.score}/100.`;return p(n,i.score>=90?"success":"info",!1),`yuktai-a11y v2: ${n} Scanned ${i.scanned} elements in ${i.renderTime}ms.`},applyFixes(t){let i={fixed:0,scanned:0,renderTime:0,score:100,details:[]};if(typeof document>"u")return i;let n=performance.now(),s=document.querySelectorAll("*");i.scanned=s.length;let a=(l,e,r,y)=>{i.details.push({tag:l,fix:e,severity:r,element:y.outerHTML.slice(0,100)}),i.fixed++};return s.forEach(l=>{let e=l,r=e.tagName.toLowerCase();if(r==="html"&&!e.getAttribute("lang")&&(e.setAttribute("lang","en"),a(r,'lang="en" added to <html>',"critical",e)),r==="head"&&!document.title&&(document.title=document.querySelector("h1")?.innerText?.trim()||"Page",a(r,`document.title set to "${document.title}"`,"serious",e)),r==="meta"){let o=e.getAttribute("name"),d=e.getAttribute("content")||"";o==="viewport"&&d.includes("user-scalable=no")&&(e.setAttribute("content",d.replace("user-scalable=no","user-scalable=yes")),a(r,"user-scalable=yes restored","serious",e)),o==="viewport"&&/maximum-scale=1(?:[^0-9]|$)/.test(d)&&(e.setAttribute("content",d.replace(/maximum-scale=1(?=[^0-9]|$)/,"maximum-scale=5")),a(r,"maximum-scale=5 restored","serious",e))}if(r==="main"&&!e.getAttribute("tabindex")&&(e.setAttribute("tabindex","-1"),e.getAttribute("id")||e.setAttribute("id","main-content")),r==="body"&&document.querySelectorAll("video[autoplay]:not([muted])").forEach(o=>{o.muted=!0,a("video","autoplay video muted (deaf users)","serious",e)}),t.largeTargets&&(r==="button"||r==="a"||r==="input")){let o=e.getBoundingClientRect();o.width>0&&o.width<24&&(e.style.minWidth="44px",e.style.minHeight="44px",a(r,"min 44px touch target enforced","minor",e))}if(X.has(r)&&(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",`${r.toUpperCase()} section`),a(r,"aria-label added (empty heading)","moderate",e)),e.hasAttribute("onclick")&&!e.getAttribute("tabindex")&&(e.setAttribute("tabindex","0"),e.onkeydown||(e.onkeydown=o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),e.click())}),a(r,"tabindex=0 + keydown (clickable heading)","minor",e))),r==="img"&&(e.hasAttribute("alt")||(e.setAttribute("alt",""),e.setAttribute("aria-hidden","true"),a(r,'alt="" aria-hidden="true"',"serious",e)),e.getAttribute("role")==="presentation"&&e.getAttribute("alt")!==""&&(e.setAttribute("alt",""),a(r,'alt="" (role=presentation)',"minor",e))),r==="area"&&!e.getAttribute("alt")){let o=e.getAttribute("title")||e.getAttribute("href")||"map area";e.setAttribute("alt",o),a(r,`alt="${o}" on <area>`,"serious",e)}if(r==="svg"){if(!e.getAttribute("aria-hidden")&&!e.getAttribute("aria-label")&&!l.querySelector("title"))if(!e.getAttribute("role")||e.getAttribute("role")==="img"){let o=document.createElementNS("http://www.w3.org/2000/svg","title");o.textContent="graphic",e.prepend(o),e.setAttribute("role","img"),a(r,'role="img" + <title> injected',"moderate",e)}else e.setAttribute("aria-hidden","true"),a(r,'aria-hidden="true" (decorative svg)',"minor",e);e.getAttribute("focusable")||e.setAttribute("focusable","false")}if(r==="canvas"&&(e.getAttribute("role")||(e.setAttribute("role","img"),a(r,'role="img"',"serious",e)),e.getAttribute("aria-label")||(e.setAttribute("aria-label",e.getAttribute("title")||"canvas graphic"),a(r,"aria-label added to canvas","serious",e))),(r==="object"||r==="embed")&&!e.getAttribute("aria-label")&&!e.getAttribute("title")&&(e.setAttribute("aria-label",`embedded ${r} content`),a(r,`aria-label added to <${r}>`,"moderate",e)),r==="video"&&!l.querySelector("track")&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label",e.getAttribute("title")||"video player"),a(r,"aria-label added (no captions track)","serious",e)),r==="audio"&&!l.querySelector("track")&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label",e.getAttribute("title")||"audio player"),a(r,"aria-label added to audio","serious",e)),r==="iframe"&&!e.getAttribute("title")&&!e.getAttribute("aria-label")&&(e.setAttribute("title","embedded content"),e.setAttribute("aria-label","embedded content"),a(r,'title + aria-label="embedded content"',"serious",e)),r==="figure"&&!l.querySelector("figcaption")&&!e.getAttribute("aria-label")){let d=l.querySelector("img")?.getAttribute("alt");d&&(e.setAttribute("aria-label",d),a(r,"aria-label from inner img alt","minor",e))}if(r==="button"){if(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let o=e.getAttribute("title")||e.getAttribute("data-label")||"button";e.setAttribute("aria-label",o),a(r,`aria-label="${o}" (empty button)`,"critical",e)}e.hasAttribute("disabled")&&!e.getAttribute("aria-disabled")&&(e.setAttribute("aria-disabled","true"),i.fixed++),e.getAttribute("data-yuktai-announced")||(e.setAttribute("data-yuktai-announced","true"),e.addEventListener("click",()=>{let o=e.getAttribute("aria-label")||e.textContent?.trim()||"button";setTimeout(()=>{p(`${o} activated`,"success",!1)},100)}))}if(r==="a"){let o=e;if(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let d=e.getAttribute("title")||"link";e.setAttribute("aria-label",d),a(r,`aria-label="${d}" (empty link)`,"critical",e)}if(o.target==="_blank"){o.rel?.includes("noopener")||(o.rel="noopener noreferrer",i.fixed++);let d=o.getAttribute("aria-label")||o.innerText?.trim()||"link";d.includes("opens in new window")||(o.setAttribute("aria-label",`${d} (opens in new window)`),a(r,"aria-label: new-window warning","moderate",e))}!o.href&&!o.getAttribute("role")&&!o.getAttribute("tabindex")&&(o.setAttribute("role","button"),o.setAttribute("tabindex","0"),a(r,'role="button" tabindex=0 (href-less link)',"serious",e))}if((e.hasAttribute("onclick")||typeof window<"u"&&window.getComputedStyle(e).cursor==="pointer")&&!me.has(r)&&(e.getAttribute("role")||(e.setAttribute("role","button"),a(r,'role="button" (clickable non-interactive)',"serious",e)),e.tabIndex<0&&(e.tabIndex=0,i.fixed++),e.onkeydown||(e.onkeydown=o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),e.click())})),Z.has(r)){let o=e;if(!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let d=e.getAttribute("placeholder")||e.getAttribute("name")||e.getAttribute("title")||r;e.setAttribute("aria-label",d),a(r,`aria-label="${d}"`,"serious",e)}if(e.hasAttribute("required")&&!e.getAttribute("aria-required")&&(e.setAttribute("aria-required","true"),i.fixed++),e.hasAttribute("disabled")&&!e.getAttribute("aria-disabled")&&(e.setAttribute("aria-disabled","true"),i.fixed++),e.hasAttribute("readonly")&&!e.getAttribute("aria-readonly")&&(e.setAttribute("aria-readonly","true"),i.fixed++),e.getAttribute("data-yuktai-validation")||(e.setAttribute("data-yuktai-validation","true"),e.addEventListener("invalid",()=>{let d=e.getAttribute("aria-label")||e.getAttribute("placeholder")||"Field",x=e.validationMessage||"is invalid";p(`Error: ${d} ${x}`,"error")}),e.addEventListener("change",()=>{if(e.validity?.valid){let d=e.getAttribute("aria-label")||e.getAttribute("placeholder")||"Field";p(`${d} looks good`,"success",!1)}})),r==="input"&&!o.autocomplete){let d=o.name||"";o.type==="email"||d.includes("email")?(o.autocomplete="email",i.fixed++):o.type==="tel"||d.includes("tel")?(o.autocomplete="tel",i.fixed++):o.type==="password"?(o.autocomplete="current-password",i.fixed++):d.includes("firstname")||d.includes("fname")?(o.autocomplete="given-name",i.fixed++):d.includes("lastname")||d.includes("lname")?(o.autocomplete="family-name",i.fixed++):d==="name"||d.includes("fullname")?(o.autocomplete="name",i.fixed++):d.includes("zip")||d.includes("postal")?(o.autocomplete="postal-code",i.fixed++):d.includes("city")?(o.autocomplete="address-level2",i.fixed++):d.includes("country")&&(o.autocomplete="country",i.fixed++)}r==="input"&&o.type==="image"&&!e.getAttribute("alt")&&(e.setAttribute("alt",e.getAttribute("value")||"submit"),a(r,"alt added to input[type=image]","serious",e)),r==="input"&&o.type==="range"&&(e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin",o.min||"0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax",o.max||"100"),e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow",o.value||"50"),i.fixed++)}if(r==="fieldset"&&!l.querySelector("legend")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","form group"),a(r,'aria-label="form group" (no legend)',"moderate",e)),r==="table"&&(!l.querySelector("th")&&!e.getAttribute("role")&&(e.setAttribute("role","grid"),a(r,'role="grid" (no <th>)',"serious",e)),!l.querySelector("caption")&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label","data table"),a(r,'aria-label="data table"',"moderate",e))),r==="th"&&!e.getAttribute("scope")){let o=e.closest("thead")!==null;e.setAttribute("scope",o?"col":"row"),a(r,`scope="${o?"col":"row"}"`,"moderate",e)}if(xe.has(r)&&(e.getAttribute("role")==="presentation"&&(l.querySelectorAll("li").forEach(o=>{o.getAttribute("role")||o.setAttribute("role","presentation")}),i.fixed++),(r==="ul"||r==="ol")&&!e.getAttribute("aria-label"))){let o=e.closest("nav");o&&(e.setAttribute("aria-label",o.getAttribute("aria-label")||"navigation list"),a(r,"aria-label from parent nav","minor",e))}if(j[r]&&!e.getAttribute("role")&&(e.setAttribute("role",j[r]),a(r,`role="${j[r]}"`,"minor",e)),["nav","section","article","aside"].includes(r)){let o=l.parentElement?.querySelectorAll(r);if(o&&o.length>1&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let x=l.querySelector("h1,h2,h3,h4,h5,h6")?.textContent?.trim();x&&(e.setAttribute("aria-label",x),a(r,"aria-label from inner heading","moderate",e))}}if(r==="details"&&!l.querySelector("summary")){let o=document.createElement("summary");o.textContent=e.getAttribute("aria-label")||"More details",e.prepend(o),a(r,"<summary> injected","moderate",e)}if(r==="summary"&&!e.innerText?.trim()&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label","Toggle details"),a(r,'aria-label="Toggle details"',"moderate",e)),r==="dialog"){let o=e.getAttribute("role");if(o&&o!=="dialog"&&o!=="alertdialog"&&(e.setAttribute("role","dialog"),a(r,'role corrected to "dialog"',"serious",e)),!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let x=l.querySelector("h1,h2,h3,h4,h5,h6")?.textContent?.trim()||"dialog";e.setAttribute("aria-label",x),a(r,"aria-label added to dialog","serious",e)}e.getAttribute("data-yuktai-trap")||(e.setAttribute("data-yuktai-trap","true"),new MutationObserver(()=>{e.style.display!=="none"&&e.style.visibility!=="hidden"&&S(e)}).observe(e,{attributes:!0,attributeFilter:["style","open"]}))}if(r==="abbr"&&!e.getAttribute("title")&&(e.setAttribute("title",e.innerText?.trim()||"abbreviation"),a(r,"title added to <abbr>","minor",e)),r==="time"&&!e.getAttribute("datetime")&&e.innerText?.trim()&&(e.setAttribute("datetime",e.innerText.trim()),a(r,`datetime="${e.innerText.trim()}" added`,"minor",e)),r==="meter"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",e.getAttribute("title")||"meter"),a(r,"aria-label added to <meter>","moderate",e)),r==="progress"){!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",e.getAttribute("title")||"progress"),a(r,"aria-label added to <progress>","moderate",e));let o=e;e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow",String(o.value)),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax",String(o.max||1)),i.fixed++}let f=e.getAttribute("role")||"";if(f==="tab"&&!e.getAttribute("aria-selected")&&(e.setAttribute("aria-selected","false"),i.fixed++),f==="tabpanel"&&(!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","tab panel"),a(r,'aria-label="tab panel"',"moderate",e)),e.getAttribute("tabindex")||(e.setAttribute("tabindex","0"),i.fixed++)),["alert","status","log","marquee"].includes(f)){if(!e.getAttribute("aria-live")){let o=f==="alert"?"assertive":"polite";e.setAttribute("aria-live",o),a(r,`aria-live="${o}" on role=${f}`,"moderate",e)}e.getAttribute("aria-atomic")||(e.setAttribute("aria-atomic","true"),i.fixed++)}f==="tooltip"&&!e.getAttribute("aria-live")&&(e.setAttribute("aria-live","polite"),i.fixed++),(f==="menu"||f==="menubar")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","menu"),a(r,'aria-label="menu"',"moderate",e)),f==="listbox"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","listbox"),a(r,'aria-label="listbox"',"moderate",e)),f==="option"&&!e.getAttribute("aria-selected")&&(e.setAttribute("aria-selected","false"),i.fixed++),f==="slider"&&(e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin","0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax","100"),e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow","50"),i.fixed++),(f==="checkbox"||f==="radio")&&!e.getAttribute("aria-checked")&&(e.setAttribute("aria-checked","false"),a(r,`aria-checked="false" on role=${f}`,"serious",e)),f==="combobox"&&(e.getAttribute("aria-expanded")||(e.setAttribute("aria-expanded","false"),a(r,'aria-expanded="false" on combobox',"serious",e)),e.getAttribute("aria-haspopup")||(e.setAttribute("aria-haspopup","listbox"),i.fixed++)),(f==="grid"||f==="treegrid")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","data grid"),a(r,'aria-label="data grid"',"moderate",e)),f==="tree"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","tree"),a(r,'aria-label="tree"',"moderate",e)),f==="spinbutton"&&(e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow","0"),e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin","0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax","100"),i.fixed++)}),i.renderTime=parseFloat((performance.now()-n).toFixed(2)),i},scan(){let t={fixed:0,scanned:0,renderTime:0,score:100,details:[]};if(typeof document>"u")return t;let i=performance.now(),n=document.querySelectorAll("*");t.scanned=n.length;let s=(a,l,e,r)=>t.details.push({tag:a,fix:l,severity:e,element:r.outerHTML.slice(0,100)});return n.forEach(a=>{let l=a,e=l.tagName.toLowerCase();(e==="a"||e==="button")&&!l.innerText?.trim()&&!l.getAttribute("aria-label")&&s(e,"needs aria-label (empty)","critical",l),e==="img"&&!l.hasAttribute("alt")&&s(e,"needs alt text","serious",l),Z.has(e)&&!l.getAttribute("aria-label")&&!l.getAttribute("aria-labelledby")&&s(e,"needs aria-label","serious",l),e==="iframe"&&!l.getAttribute("title")&&!l.getAttribute("aria-label")&&s(e,"iframe needs title","serious",l),ye.has(e)&&!a.querySelector("track")&&!l.getAttribute("aria-label")&&s(e,"media needs captions/aria-label","serious",l),X.has(e)&&!l.innerText?.trim()&&!l.getAttribute("aria-label")&&s(e,"empty heading","moderate",l)}),t.fixed=t.details.length,t.score=te(t),t.renderTime=parseFloat((performance.now()-i).toFixed(2)),t},startObserver(t){this.observer||typeof document>"u"||(this.observer=new MutationObserver(()=>this.applyFixes(t)),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!1}))},stopObserver(){this.observer?.disconnect(),this.observer=null},announce:p,speak:K,showVisualAlert:ie,trapFocus:S};import{useState as $,useEffect as R,useRef as le,useCallback as se}from"react";import Me,{forwardRef as Ce}from"react";import{jsx as c,jsxs as m}from"react/jsx-runtime";var Y={highContrast:!1,reduceMotion:!1,autoFix:!0,dyslexiaFont:!1,fontScale:100,darkMode:!1,largeTargets:!1,speechEnabled:!1,colorBlindMode:"none",showAuditBadge:!1,timeoutWarning:void 0},E=[80,90,100,110,120,130],Le=[{value:"none",label:"None"},{value:"deuteranopia",label:"Deuteranopia"},{value:"protanopia",label:"Protanopia"},{value:"tritanopia",label:"Tritanopia"},{value:"achromatopsia",label:"Greyscale"}],ne=[{id:"highContrast",label:"High contrast",description:"Increases contrast for low vision",icon:"\u25D1"},{id:"darkMode",label:"Dark mode",description:"Inverts colours for dark preference",icon:"\u{1F319}"},{id:"reduceMotion",label:"Reduce motion",description:"Disables transitions & animations",icon:"\u23F8"},{id:"largeTargets",label:"Large click targets",description:"44\xD744px minimum touch targets",icon:"\u{1F446}"},{id:"speechEnabled",label:"Speak on focus",description:"Browser reads focused element aloud",icon:"\u{1F50A}"},{id:"autoFix",label:"Auto-fix ARIA",description:"Watches for new DOM nodes",icon:"\u267F"},{id:"dyslexiaFont",label:"Dyslexia-friendly font",description:"Atkinson Hyperlegible font",icon:"Aa"},{id:"showAuditBadge",label:"Show audit score",description:"Dev-only score badge (localhost)",icon:"\u{1F4CA}"}];function $e({checked:t,onChange:i,label:n}){return m("label",{"aria-label":n,style:{position:"relative",display:"inline-flex",width:40,height:24,cursor:"pointer",flexShrink:0},children:[c("input",{type:"checkbox",checked:t,onChange:s=>i(s.target.checked),style:{opacity:0,width:0,height:0,position:"absolute"}}),c("span",{style:{position:"absolute",inset:0,borderRadius:99,background:t?"#0d9488":"#cbd5e1",transition:"background 0.2s"}}),c("span",{style:{position:"absolute",top:3,left:t?19:3,width:18,height:18,background:"#fff",borderRadius:"50%",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,0.2)",pointerEvents:"none"}})]})}var G=Ce(({position:t,settings:i,report:n,isActive:s,set:a,onApply:l,onReset:e,onClose:r},y)=>m("div",{ref:y,role:"dialog","aria-modal":"true","aria-label":"yuktai-a11y accessibility options",style:{position:"fixed",bottom:24,...t==="left"?{left:88}:{right:88},width:320,background:"#fff",border:"1px solid #e2e8f0",borderRadius:16,boxShadow:"0 8px 32px rgba(0,0,0,0.12)",zIndex:9998,overflow:"hidden",fontFamily:"system-ui,-apple-system,sans-serif",maxHeight:"80vh",overflowY:"auto"},children:[m("div",{style:{padding:"14px 18px 12px",borderBottom:"1px solid #f1f5f9",display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[m("div",{children:[m("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:5},children:[c("span",{style:{fontSize:10,fontWeight:700,padding:"2px 7px",borderRadius:99,background:"#f0fdfa",color:"#0d9488",letterSpacing:"0.05em",fontFamily:"monospace"},children:"@yuktishaalaa/yuktai v2.0.0"}),s&&c("span",{style:{fontSize:10,fontWeight:700,padding:"2px 7px",borderRadius:99,background:"#f0fdfa",color:"#0f766e",border:"1px solid #99f6e4"},children:"\u25CF ACTIVE"})]}),c("p",{style:{margin:"0 0 2px",fontSize:15,fontWeight:600,color:"#0f172a"},children:"Accessibility"}),c("p",{style:{margin:0,fontSize:12,color:"#64748b"},children:"WCAG 2.2 \xB7 No JAWS needed \xB7 Open Source"})]}),c("button",{onClick:r,"aria-label":"Close accessibility panel",style:{background:"none",border:"none",cursor:"pointer",padding:4,color:"#94a3b8",fontSize:18,lineHeight:1,borderRadius:6},children:"\xD7"})]}),c("div",{style:{padding:"6px 0"},children:ne.map((o,d)=>m(Me.Fragment,{children:[m("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 18px",gap:12},children:[m("div",{style:{display:"flex",alignItems:"center",gap:10,flex:1},children:[c("span",{"aria-hidden":"true",style:{width:30,height:30,borderRadius:8,background:"#f0fdfa",color:"#0d9488",display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,flexShrink:0,fontWeight:700},children:o.icon}),m("div",{children:[c("p",{style:{margin:0,fontSize:13,fontWeight:500,color:"#0f172a"},children:o.label}),c("p",{style:{margin:0,fontSize:11,color:"#94a3b8"},children:o.description})]})]}),c($e,{checked:i[o.id],onChange:x=>a(o.id,x),label:`Toggle ${o.label}`})]}),d<ne.length-1&&c("div",{style:{height:1,background:"#f8fafc",margin:"0 18px"}})]},o.id))}),m("div",{style:{padding:"10px 18px",borderTop:"1px solid #f1f5f9"},children:[c("p",{style:{margin:"0 0 8px",fontSize:13,fontWeight:500,color:"#0f172a"},children:"\u{1F3A8} Colour blindness"}),c("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:Le.map(o=>c("button",{onClick:()=>a("colorBlindMode",o.value),"aria-pressed":i.colorBlindMode===o.value,style:{padding:"4px 10px",borderRadius:20,fontSize:11,fontWeight:500,border:`1px solid ${i.colorBlindMode===o.value?"#0d9488":"#e2e8f0"}`,background:i.colorBlindMode===o.value?"#f0fdfa":"#fff",color:i.colorBlindMode===o.value?"#0d9488":"#64748b",cursor:"pointer",transition:"all 0.15s"},children:o.label},o.value))})]}),m("div",{style:{padding:"10px 18px 14px",borderTop:"1px solid #f1f5f9"},children:[m("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[c("p",{style:{margin:0,fontSize:13,fontWeight:500,color:"#0f172a"},children:"Text size"}),m("span",{style:{fontSize:12,fontWeight:600,color:"#0d9488",background:"#f0fdfa",padding:"2px 8px",borderRadius:99},children:[i.fontScale,"%"]})]}),m("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c("button",{onClick:()=>{let o=E.indexOf(i.fontScale);o>0&&a("fontScale",E[o-1])},disabled:i.fontScale<=80,"aria-label":"Decrease text size",style:{width:30,height:30,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",cursor:i.fontScale<=80?"not-allowed":"pointer",fontSize:16,color:i.fontScale<=80?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"\u2212"}),c("div",{style:{flex:1,display:"flex",gap:3},children:E.map(o=>c("button",{onClick:()=>a("fontScale",o),"aria-label":`Set text size to ${o}%`,style:{flex:1,height:6,borderRadius:99,border:"none",cursor:"pointer",padding:0,background:o<=i.fontScale?"#0d9488":"#e2e8f0",transition:"background 0.15s"}},o))}),c("button",{onClick:()=>{let o=E.indexOf(i.fontScale);o<E.length-1&&a("fontScale",E[o+1])},disabled:i.fontScale>=130,"aria-label":"Increase text size",style:{width:30,height:30,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",cursor:i.fontScale>=130?"not-allowed":"pointer",fontSize:16,color:i.fontScale>=130?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"+"})]})]}),n&&c("div",{role:"status",style:{margin:"0 14px",padding:"8px 12px",background:"#f0fdfa",border:"1px solid #99f6e4",borderRadius:8,fontSize:12,color:"#0f766e",fontWeight:500,fontFamily:"monospace"},children:n.fixed>0?`\u2713 ${n.fixed} fixes \xB7 ${n.scanned} nodes \xB7 ${n.renderTime}ms \xB7 Score: ${n.score}/100`:`\u2713 0 fixes needed \xB7 ${n.scanned} nodes clean \xB7 ${n.renderTime}ms`}),m("div",{style:{display:"flex",gap:8,padding:"12px 14px 14px"},children:[c("button",{onClick:e,style:{flex:1,padding:"8px 0",fontSize:13,fontWeight:500,borderRadius:9,border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",cursor:"pointer"},children:"Reset"}),c("button",{onClick:l,style:{flex:2,padding:"8px 0",fontSize:13,fontWeight:600,borderRadius:9,border:"none",background:"#0d9488",color:"#fff",cursor:"pointer"},children:"Apply settings"})]})]}));G.displayName="WidgetPanel";import{Fragment as de,jsx as H,jsxs as ue}from"react/jsx-runtime";var W=null,T=null;function V({children:t,position:i="left"}){let[n,s]=$(!1),[a,l]=$(!1),[e,r]=$(Y),[y,f]=$(null),[o,d]=$(!1),x=le(null),v=le(null);R(()=>s(!0),[]),R(()=>{if(W)return;let u=document.createElement("style");return u.innerHTML=`
|
|
270
|
+
`,document.body.appendChild(t),U=t}function te(t){let i={critical:20,serious:10,moderate:5,minor:2},n=t.details.reduce((s,a)=>s+(i[a.severity]||0),0);return Math.max(0,Math.min(100,100-n))}var b={name:"yuktai-a11y",version:"2.0.0",observer:null,async execute(t){if(!t.enabled)return this.stopObserver(),"yuktai-a11y: disabled.";w=t,Ee(),Te(),Ae(),ve(),t.showSkipLinks!==!1&&he(),t.showPreferencePanel!==!1&&oe(t),C(t);let i=this.applyFixes(t);i.score=te(i),t.showAuditBadge&&ke(i),t.timeoutWarning&&re(t.timeoutWarning),t.autoFix&&this.startObserver(t);let n=`${i.fixed} accessibility fixes applied. Score: ${i.score}/100.`;return p(n,i.score>=90?"success":"info",!1),`yuktai-a11y v2: ${n} Scanned ${i.scanned} elements in ${i.renderTime}ms.`},applyFixes(t){let i={fixed:0,scanned:0,renderTime:0,score:100,details:[]};if(typeof document>"u")return i;let n=performance.now(),s=document.querySelectorAll("*");i.scanned=s.length;let a=(l,e,r,y)=>{i.details.push({tag:l,fix:e,severity:r,element:y.outerHTML.slice(0,100)}),i.fixed++};return s.forEach(l=>{let e=l,r=e.tagName.toLowerCase();if(r==="html"&&!e.getAttribute("lang")&&(e.setAttribute("lang","en"),a(r,'lang="en" added to <html>',"critical",e)),r==="head"&&!document.title&&(document.title=document.querySelector("h1")?.innerText?.trim()||"Page",a(r,`document.title set to "${document.title}"`,"serious",e)),r==="meta"){let o=e.getAttribute("name"),d=e.getAttribute("content")||"";o==="viewport"&&d.includes("user-scalable=no")&&(e.setAttribute("content",d.replace("user-scalable=no","user-scalable=yes")),a(r,"user-scalable=yes restored","serious",e)),o==="viewport"&&/maximum-scale=1(?:[^0-9]|$)/.test(d)&&(e.setAttribute("content",d.replace(/maximum-scale=1(?=[^0-9]|$)/,"maximum-scale=5")),a(r,"maximum-scale=5 restored","serious",e))}if(r==="main"&&!e.getAttribute("tabindex")&&(e.setAttribute("tabindex","-1"),e.getAttribute("id")||e.setAttribute("id","main-content")),r==="body"&&document.querySelectorAll("video[autoplay]:not([muted])").forEach(o=>{o.muted=!0,a("video","autoplay video muted (deaf users)","serious",e)}),t.largeTargets&&(r==="button"||r==="a"||r==="input")){let o=e.getBoundingClientRect();o.width>0&&o.width<24&&(e.style.minWidth="44px",e.style.minHeight="44px",a(r,"min 44px touch target enforced","minor",e))}if(X.has(r)&&(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",`${r.toUpperCase()} section`),a(r,"aria-label added (empty heading)","moderate",e)),e.hasAttribute("onclick")&&!e.getAttribute("tabindex")&&(e.setAttribute("tabindex","0"),e.onkeydown||(e.onkeydown=o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),e.click())}),a(r,"tabindex=0 + keydown (clickable heading)","minor",e))),r==="img"&&(e.hasAttribute("alt")||(e.setAttribute("alt",""),e.setAttribute("aria-hidden","true"),a(r,'alt="" aria-hidden="true"',"serious",e)),e.getAttribute("role")==="presentation"&&e.getAttribute("alt")!==""&&(e.setAttribute("alt",""),a(r,'alt="" (role=presentation)',"minor",e))),r==="area"&&!e.getAttribute("alt")){let o=e.getAttribute("title")||e.getAttribute("href")||"map area";e.setAttribute("alt",o),a(r,`alt="${o}" on <area>`,"serious",e)}if(r==="svg"){if(!e.getAttribute("aria-hidden")&&!e.getAttribute("aria-label")&&!l.querySelector("title"))if(!e.getAttribute("role")||e.getAttribute("role")==="img"){let o=document.createElementNS("http://www.w3.org/2000/svg","title");o.textContent="graphic",e.prepend(o),e.setAttribute("role","img"),a(r,'role="img" + <title> injected',"moderate",e)}else e.setAttribute("aria-hidden","true"),a(r,'aria-hidden="true" (decorative svg)',"minor",e);e.getAttribute("focusable")||e.setAttribute("focusable","false")}if(r==="canvas"&&(e.getAttribute("role")||(e.setAttribute("role","img"),a(r,'role="img"',"serious",e)),e.getAttribute("aria-label")||(e.setAttribute("aria-label",e.getAttribute("title")||"canvas graphic"),a(r,"aria-label added to canvas","serious",e))),(r==="object"||r==="embed")&&!e.getAttribute("aria-label")&&!e.getAttribute("title")&&(e.setAttribute("aria-label",`embedded ${r} content`),a(r,`aria-label added to <${r}>`,"moderate",e)),r==="video"&&!l.querySelector("track")&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label",e.getAttribute("title")||"video player"),a(r,"aria-label added (no captions track)","serious",e)),r==="audio"&&!l.querySelector("track")&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label",e.getAttribute("title")||"audio player"),a(r,"aria-label added to audio","serious",e)),r==="iframe"&&!e.getAttribute("title")&&!e.getAttribute("aria-label")&&(e.setAttribute("title","embedded content"),e.setAttribute("aria-label","embedded content"),a(r,'title + aria-label="embedded content"',"serious",e)),r==="figure"&&!l.querySelector("figcaption")&&!e.getAttribute("aria-label")){let d=l.querySelector("img")?.getAttribute("alt");d&&(e.setAttribute("aria-label",d),a(r,"aria-label from inner img alt","minor",e))}if(r==="button"){if(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let o=e.getAttribute("title")||e.getAttribute("data-label")||"button";e.setAttribute("aria-label",o),a(r,`aria-label="${o}" (empty button)`,"critical",e)}e.hasAttribute("disabled")&&!e.getAttribute("aria-disabled")&&(e.setAttribute("aria-disabled","true"),i.fixed++),e.getAttribute("data-yuktai-announced")||(e.setAttribute("data-yuktai-announced","true"),e.addEventListener("click",()=>{let o=e.getAttribute("aria-label")||e.textContent?.trim()||"button";setTimeout(()=>{p(`${o} activated`,"success",!1)},100)}))}if(r==="a"){let o=e;if(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let d=e.getAttribute("title")||"link";e.setAttribute("aria-label",d),a(r,`aria-label="${d}" (empty link)`,"critical",e)}if(o.target==="_blank"){o.rel?.includes("noopener")||(o.rel="noopener noreferrer",i.fixed++);let d=o.getAttribute("aria-label")||o.innerText?.trim()||"link";d.includes("opens in new window")||(o.setAttribute("aria-label",`${d} (opens in new window)`),a(r,"aria-label: new-window warning","moderate",e))}!o.href&&!o.getAttribute("role")&&!o.getAttribute("tabindex")&&(o.setAttribute("role","button"),o.setAttribute("tabindex","0"),a(r,'role="button" tabindex=0 (href-less link)',"serious",e))}if((e.hasAttribute("onclick")||typeof window<"u"&&window.getComputedStyle(e).cursor==="pointer")&&!me.has(r)&&(e.getAttribute("role")||(e.setAttribute("role","button"),a(r,'role="button" (clickable non-interactive)',"serious",e)),e.tabIndex<0&&(e.tabIndex=0,i.fixed++),e.onkeydown||(e.onkeydown=o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),e.click())})),Z.has(r)){let o=e;if(!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let d=e.getAttribute("placeholder")||e.getAttribute("name")||e.getAttribute("title")||r;e.setAttribute("aria-label",d),a(r,`aria-label="${d}"`,"serious",e)}if(e.hasAttribute("required")&&!e.getAttribute("aria-required")&&(e.setAttribute("aria-required","true"),i.fixed++),e.hasAttribute("disabled")&&!e.getAttribute("aria-disabled")&&(e.setAttribute("aria-disabled","true"),i.fixed++),e.hasAttribute("readonly")&&!e.getAttribute("aria-readonly")&&(e.setAttribute("aria-readonly","true"),i.fixed++),e.getAttribute("data-yuktai-validation")||(e.setAttribute("data-yuktai-validation","true"),e.addEventListener("invalid",()=>{let d=e.getAttribute("aria-label")||e.getAttribute("placeholder")||"Field",x=e.validationMessage||"is invalid";p(`Error: ${d} ${x}`,"error")}),e.addEventListener("change",()=>{if(e.validity?.valid){let d=e.getAttribute("aria-label")||e.getAttribute("placeholder")||"Field";p(`${d} looks good`,"success",!1)}})),r==="input"&&!o.autocomplete){let d=o.name||"";o.type==="email"||d.includes("email")?(o.autocomplete="email",i.fixed++):o.type==="tel"||d.includes("tel")?(o.autocomplete="tel",i.fixed++):o.type==="password"?(o.autocomplete="current-password",i.fixed++):d.includes("firstname")||d.includes("fname")?(o.autocomplete="given-name",i.fixed++):d.includes("lastname")||d.includes("lname")?(o.autocomplete="family-name",i.fixed++):d==="name"||d.includes("fullname")?(o.autocomplete="name",i.fixed++):d.includes("zip")||d.includes("postal")?(o.autocomplete="postal-code",i.fixed++):d.includes("city")?(o.autocomplete="address-level2",i.fixed++):d.includes("country")&&(o.autocomplete="country",i.fixed++)}r==="input"&&o.type==="image"&&!e.getAttribute("alt")&&(e.setAttribute("alt",e.getAttribute("value")||"submit"),a(r,"alt added to input[type=image]","serious",e)),r==="input"&&o.type==="range"&&(e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin",o.min||"0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax",o.max||"100"),e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow",o.value||"50"),i.fixed++)}if(r==="fieldset"&&!l.querySelector("legend")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","form group"),a(r,'aria-label="form group" (no legend)',"moderate",e)),r==="table"&&(!l.querySelector("th")&&!e.getAttribute("role")&&(e.setAttribute("role","grid"),a(r,'role="grid" (no <th>)',"serious",e)),!l.querySelector("caption")&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label","data table"),a(r,'aria-label="data table"',"moderate",e))),r==="th"&&!e.getAttribute("scope")){let o=e.closest("thead")!==null;e.setAttribute("scope",o?"col":"row"),a(r,`scope="${o?"col":"row"}"`,"moderate",e)}if(xe.has(r)&&(e.getAttribute("role")==="presentation"&&(l.querySelectorAll("li").forEach(o=>{o.getAttribute("role")||o.setAttribute("role","presentation")}),i.fixed++),(r==="ul"||r==="ol")&&!e.getAttribute("aria-label"))){let o=e.closest("nav");o&&(e.setAttribute("aria-label",o.getAttribute("aria-label")||"navigation list"),a(r,"aria-label from parent nav","minor",e))}if(j[r]&&!e.getAttribute("role")&&(e.setAttribute("role",j[r]),a(r,`role="${j[r]}"`,"minor",e)),["nav","section","article","aside"].includes(r)){let o=l.parentElement?.querySelectorAll(r);if(o&&o.length>1&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let x=l.querySelector("h1,h2,h3,h4,h5,h6")?.textContent?.trim();x&&(e.setAttribute("aria-label",x),a(r,"aria-label from inner heading","moderate",e))}}if(r==="details"&&!l.querySelector("summary")){let o=document.createElement("summary");o.textContent=e.getAttribute("aria-label")||"More details",e.prepend(o),a(r,"<summary> injected","moderate",e)}if(r==="summary"&&!e.innerText?.trim()&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label","Toggle details"),a(r,'aria-label="Toggle details"',"moderate",e)),r==="dialog"){let o=e.getAttribute("role");if(o&&o!=="dialog"&&o!=="alertdialog"&&(e.setAttribute("role","dialog"),a(r,'role corrected to "dialog"',"serious",e)),!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let x=l.querySelector("h1,h2,h3,h4,h5,h6")?.textContent?.trim()||"dialog";e.setAttribute("aria-label",x),a(r,"aria-label added to dialog","serious",e)}e.getAttribute("data-yuktai-trap")||(e.setAttribute("data-yuktai-trap","true"),new MutationObserver(()=>{e.style.display!=="none"&&e.style.visibility!=="hidden"&&S(e)}).observe(e,{attributes:!0,attributeFilter:["style","open"]}))}if(r==="abbr"&&!e.getAttribute("title")&&(e.setAttribute("title",e.innerText?.trim()||"abbreviation"),a(r,"title added to <abbr>","minor",e)),r==="time"&&!e.getAttribute("datetime")&&e.innerText?.trim()&&(e.setAttribute("datetime",e.innerText.trim()),a(r,`datetime="${e.innerText.trim()}" added`,"minor",e)),r==="meter"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",e.getAttribute("title")||"meter"),a(r,"aria-label added to <meter>","moderate",e)),r==="progress"){!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",e.getAttribute("title")||"progress"),a(r,"aria-label added to <progress>","moderate",e));let o=e;e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow",String(o.value)),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax",String(o.max||1)),i.fixed++}let f=e.getAttribute("role")||"";if(f==="tab"&&!e.getAttribute("aria-selected")&&(e.setAttribute("aria-selected","false"),i.fixed++),f==="tabpanel"&&(!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","tab panel"),a(r,'aria-label="tab panel"',"moderate",e)),e.getAttribute("tabindex")||(e.setAttribute("tabindex","0"),i.fixed++)),["alert","status","log","marquee"].includes(f)){if(!e.getAttribute("aria-live")){let o=f==="alert"?"assertive":"polite";e.setAttribute("aria-live",o),a(r,`aria-live="${o}" on role=${f}`,"moderate",e)}e.getAttribute("aria-atomic")||(e.setAttribute("aria-atomic","true"),i.fixed++)}f==="tooltip"&&!e.getAttribute("aria-live")&&(e.setAttribute("aria-live","polite"),i.fixed++),(f==="menu"||f==="menubar")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","menu"),a(r,'aria-label="menu"',"moderate",e)),f==="listbox"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","listbox"),a(r,'aria-label="listbox"',"moderate",e)),f==="option"&&!e.getAttribute("aria-selected")&&(e.setAttribute("aria-selected","false"),i.fixed++),f==="slider"&&(e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin","0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax","100"),e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow","50"),i.fixed++),(f==="checkbox"||f==="radio")&&!e.getAttribute("aria-checked")&&(e.setAttribute("aria-checked","false"),a(r,`aria-checked="false" on role=${f}`,"serious",e)),f==="combobox"&&(e.getAttribute("aria-expanded")||(e.setAttribute("aria-expanded","false"),a(r,'aria-expanded="false" on combobox',"serious",e)),e.getAttribute("aria-haspopup")||(e.setAttribute("aria-haspopup","listbox"),i.fixed++)),(f==="grid"||f==="treegrid")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","data grid"),a(r,'aria-label="data grid"',"moderate",e)),f==="tree"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","tree"),a(r,'aria-label="tree"',"moderate",e)),f==="spinbutton"&&(e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow","0"),e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin","0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax","100"),i.fixed++)}),i.renderTime=parseFloat((performance.now()-n).toFixed(2)),i},scan(){let t={fixed:0,scanned:0,renderTime:0,score:100,details:[]};if(typeof document>"u")return t;let i=performance.now(),n=document.querySelectorAll("*");t.scanned=n.length;let s=(a,l,e,r)=>t.details.push({tag:a,fix:l,severity:e,element:r.outerHTML.slice(0,100)});return n.forEach(a=>{let l=a,e=l.tagName.toLowerCase();(e==="a"||e==="button")&&!l.innerText?.trim()&&!l.getAttribute("aria-label")&&s(e,"needs aria-label (empty)","critical",l),e==="img"&&!l.hasAttribute("alt")&&s(e,"needs alt text","serious",l),Z.has(e)&&!l.getAttribute("aria-label")&&!l.getAttribute("aria-labelledby")&&s(e,"needs aria-label","serious",l),e==="iframe"&&!l.getAttribute("title")&&!l.getAttribute("aria-label")&&s(e,"iframe needs title","serious",l),ye.has(e)&&!a.querySelector("track")&&!l.getAttribute("aria-label")&&s(e,"media needs captions/aria-label","serious",l),X.has(e)&&!l.innerText?.trim()&&!l.getAttribute("aria-label")&&s(e,"empty heading","moderate",l)}),t.fixed=t.details.length,t.score=te(t),t.renderTime=parseFloat((performance.now()-i).toFixed(2)),t},startObserver(t){this.observer||typeof document>"u"||(this.observer=new MutationObserver(()=>this.applyFixes(t)),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!1}))},stopObserver(){this.observer?.disconnect(),this.observer=null},announce:p,speak:K,showVisualAlert:ie,trapFocus:S};import{useState as $,useEffect as R,useRef as le,useCallback as se}from"react";import Me,{forwardRef as Ce}from"react";import{jsx as c,jsxs as m}from"react/jsx-runtime";var Y={highContrast:!1,reduceMotion:!1,autoFix:!0,dyslexiaFont:!1,fontScale:100,darkMode:!1,largeTargets:!1,speechEnabled:!1,colorBlindMode:"none",showAuditBadge:!1,timeoutWarning:void 0},E=[80,90,100,110,120,130],Le=[{value:"none",label:"None"},{value:"deuteranopia",label:"Deuteranopia"},{value:"protanopia",label:"Protanopia"},{value:"tritanopia",label:"Tritanopia"},{value:"achromatopsia",label:"Greyscale"}],ne=[{id:"highContrast",label:"High contrast",description:"Increases contrast for low vision",icon:"\u25D1"},{id:"darkMode",label:"Dark mode",description:"Inverts colours for dark preference",icon:"\u{1F319}"},{id:"reduceMotion",label:"Reduce motion",description:"Disables transitions & animations",icon:"\u23F8"},{id:"largeTargets",label:"Large click targets",description:"44\xD744px minimum touch targets",icon:"\u{1F446}"},{id:"speechEnabled",label:"Speak on focus",description:"Browser reads focused element aloud",icon:"\u{1F50A}"},{id:"autoFix",label:"Auto-fix ARIA",description:"Watches for new DOM nodes",icon:"\u267F"},{id:"dyslexiaFont",label:"Dyslexia-friendly font",description:"Atkinson Hyperlegible font",icon:"Aa"},{id:"showAuditBadge",label:"Show audit score",description:"Dev-only score badge (localhost)",icon:"\u{1F4CA}"}];function $e({checked:t,onChange:i,label:n}){return m("label",{"aria-label":n,style:{position:"relative",display:"inline-flex",width:40,height:24,cursor:"pointer",flexShrink:0},children:[c("input",{type:"checkbox",checked:t,onChange:s=>i(s.target.checked),style:{opacity:0,width:0,height:0,position:"absolute"}}),c("span",{style:{position:"absolute",inset:0,borderRadius:99,background:t?"#0d9488":"#cbd5e1",transition:"background 0.2s"}}),c("span",{style:{position:"absolute",top:3,left:t?19:3,width:18,height:18,background:"#fff",borderRadius:"50%",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,0.2)",pointerEvents:"none"}})]})}var G=Ce(({position:t,settings:i,report:n,isActive:s,set:a,onApply:l,onReset:e,onClose:r},y)=>m("div",{ref:y,role:"dialog","aria-modal":"true","aria-label":"yuktai-a11y accessibility options",style:{position:"fixed",bottom:24,...t==="left"?{left:88}:{right:88},width:320,background:"#fff",border:"1px solid #e2e8f0",borderRadius:16,boxShadow:"0 8px 32px rgba(0,0,0,0.12)",zIndex:9998,overflow:"hidden",fontFamily:"system-ui,-apple-system,sans-serif",maxHeight:"80vh",overflowY:"auto"},children:[m("div",{style:{padding:"14px 18px 12px",borderBottom:"1px solid #f1f5f9",display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[m("div",{children:[m("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:5},children:[c("span",{style:{fontSize:10,fontWeight:700,padding:"2px 7px",borderRadius:99,background:"#f0fdfa",color:"#0d9488",letterSpacing:"0.05em",fontFamily:"monospace"},children:"@yuktishaalaa/yuktai v2.0.0"}),s&&c("span",{style:{fontSize:10,fontWeight:700,padding:"2px 7px",borderRadius:99,background:"#f0fdfa",color:"#0f766e",border:"1px solid #99f6e4"},children:"\u25CF ACTIVE"})]}),c("p",{style:{margin:"0 0 2px",fontSize:15,fontWeight:600,color:"#0f172a"},children:"Accessibility"}),c("p",{style:{margin:0,fontSize:12,color:"#64748b"},children:"WCAG 2.2 \xB7 Open Source"})]}),c("button",{onClick:r,"aria-label":"Close accessibility panel",style:{background:"none",border:"none",cursor:"pointer",padding:4,color:"#94a3b8",fontSize:18,lineHeight:1,borderRadius:6},children:"\xD7"})]}),c("div",{style:{padding:"6px 0"},children:ne.map((o,d)=>m(Me.Fragment,{children:[m("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 18px",gap:12},children:[m("div",{style:{display:"flex",alignItems:"center",gap:10,flex:1},children:[c("span",{"aria-hidden":"true",style:{width:30,height:30,borderRadius:8,background:"#f0fdfa",color:"#0d9488",display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,flexShrink:0,fontWeight:700},children:o.icon}),m("div",{children:[c("p",{style:{margin:0,fontSize:13,fontWeight:500,color:"#0f172a"},children:o.label}),c("p",{style:{margin:0,fontSize:11,color:"#94a3b8"},children:o.description})]})]}),c($e,{checked:i[o.id],onChange:x=>a(o.id,x),label:`Toggle ${o.label}`})]}),d<ne.length-1&&c("div",{style:{height:1,background:"#f8fafc",margin:"0 18px"}})]},o.id))}),m("div",{style:{padding:"10px 18px",borderTop:"1px solid #f1f5f9"},children:[c("p",{style:{margin:"0 0 8px",fontSize:13,fontWeight:500,color:"#0f172a"},children:"\u{1F3A8} Colour blindness"}),c("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:Le.map(o=>c("button",{onClick:()=>a("colorBlindMode",o.value),"aria-pressed":i.colorBlindMode===o.value,style:{padding:"4px 10px",borderRadius:20,fontSize:11,fontWeight:500,border:`1px solid ${i.colorBlindMode===o.value?"#0d9488":"#e2e8f0"}`,background:i.colorBlindMode===o.value?"#f0fdfa":"#fff",color:i.colorBlindMode===o.value?"#0d9488":"#64748b",cursor:"pointer",transition:"all 0.15s"},children:o.label},o.value))})]}),m("div",{style:{padding:"10px 18px 14px",borderTop:"1px solid #f1f5f9"},children:[m("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[c("p",{style:{margin:0,fontSize:13,fontWeight:500,color:"#0f172a"},children:"Text size"}),m("span",{style:{fontSize:12,fontWeight:600,color:"#0d9488",background:"#f0fdfa",padding:"2px 8px",borderRadius:99},children:[i.fontScale,"%"]})]}),m("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c("button",{onClick:()=>{let o=E.indexOf(i.fontScale);o>0&&a("fontScale",E[o-1])},disabled:i.fontScale<=80,"aria-label":"Decrease text size",style:{width:30,height:30,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",cursor:i.fontScale<=80?"not-allowed":"pointer",fontSize:16,color:i.fontScale<=80?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"\u2212"}),c("div",{style:{flex:1,display:"flex",gap:3},children:E.map(o=>c("button",{onClick:()=>a("fontScale",o),"aria-label":`Set text size to ${o}%`,style:{flex:1,height:6,borderRadius:99,border:"none",cursor:"pointer",padding:0,background:o<=i.fontScale?"#0d9488":"#e2e8f0",transition:"background 0.15s"}},o))}),c("button",{onClick:()=>{let o=E.indexOf(i.fontScale);o<E.length-1&&a("fontScale",E[o+1])},disabled:i.fontScale>=130,"aria-label":"Increase text size",style:{width:30,height:30,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",cursor:i.fontScale>=130?"not-allowed":"pointer",fontSize:16,color:i.fontScale>=130?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"+"})]})]}),n&&c("div",{role:"status",style:{margin:"0 14px",padding:"8px 12px",background:"#f0fdfa",border:"1px solid #99f6e4",borderRadius:8,fontSize:12,color:"#0f766e",fontWeight:500,fontFamily:"monospace"},children:n.fixed>0?`\u2713 ${n.fixed} fixes \xB7 ${n.scanned} nodes \xB7 ${n.renderTime}ms \xB7 Score: ${n.score}/100`:`\u2713 0 fixes needed \xB7 ${n.scanned} nodes clean \xB7 ${n.renderTime}ms`}),m("div",{style:{display:"flex",gap:8,padding:"12px 14px 14px"},children:[c("button",{onClick:e,style:{flex:1,padding:"8px 0",fontSize:13,fontWeight:500,borderRadius:9,border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",cursor:"pointer"},children:"Reset"}),c("button",{onClick:l,style:{flex:2,padding:"8px 0",fontSize:13,fontWeight:600,borderRadius:9,border:"none",background:"#0d9488",color:"#fff",cursor:"pointer"},children:"Apply settings"})]})]}));G.displayName="WidgetPanel";import{Fragment as de,jsx as H,jsxs as ue}from"react/jsx-runtime";var _=null,T=null;function V({children:t,position:i="left"}){let[n,s]=$(!1),[a,l]=$(!1),[e,r]=$(Y),[y,f]=$(null),[o,d]=$(!1),x=le(null),v=le(null);R(()=>s(!0),[]),R(()=>{if(_)return;let u=document.createElement("style");return u.innerHTML=`
|
|
271
271
|
*:focus-visible {
|
|
272
272
|
outline: 3px solid #0d9488 !important;
|
|
273
273
|
outline-offset: 3px !important;
|
|
@@ -277,11 +277,11 @@ var I=null,U=null,L=null,J=null,D=null,g=null,k=null,z=null,O=null,w=null,P={deu
|
|
|
277
277
|
*:focus:not(:focus-visible) {
|
|
278
278
|
outline: none !important;
|
|
279
279
|
}
|
|
280
|
-
`,document.head.appendChild(u),
|
|
280
|
+
`,document.head.appendChild(u),_=u,()=>{_?.remove(),_=null}},[]),R(()=>()=>{b.stopObserver()},[]),R(()=>{if(!a)return;let u=h=>{x.current&&!x.current.contains(h.target)&&v.current&&!v.current.contains(h.target)&&(l(!1),v.current?.focus(),b.announce("Accessibility panel closed","info",!1))};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[a]),R(()=>{let u=h=>{h.key==="Escape"&&a&&(l(!1),v.current?.focus(),b.announce("Accessibility panel closed","info",!1))};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[a]);let fe=(u,h)=>r(M=>({...M,[u]:h})),be=se(async()=>{let u={enabled:!0,highContrast:e.highContrast,darkMode:e.darkMode??!1,reduceMotion:e.reduceMotion,autoFix:e.autoFix,largeTargets:e.largeTargets??!1,speechEnabled:e.speechEnabled??!1,colorBlindMode:e.colorBlindMode??"none",showPreferencePanel:!1,showSkipLinks:!0,showAuditBadge:e.showAuditBadge??!1,timeoutWarning:e.timeoutWarning??void 0},h=await b.execute(u);console.log("[yuktai-a11y]",h);let M=b.applyFixes(u);f(M);let ge=Math.min(Math.max(e.fontScale??100,80),130);if(document.documentElement.style.fontSize=`${ge}%`,e.dyslexiaFont){if(!T){let q=document.createElement("link");q.rel="stylesheet",q.href="https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:wght@400;700&display=swap",document.head.appendChild(q);let D=document.createElement("style");D.textContent=`
|
|
281
281
|
body, body * {
|
|
282
282
|
font-family: 'Atkinson Hyperlegible', Arial, sans-serif !important;
|
|
283
283
|
letter-spacing: 0.05em !important;
|
|
284
284
|
word-spacing: 0.1em !important;
|
|
285
285
|
line-height: 1.8 !important;
|
|
286
286
|
}
|
|
287
|
-
`,document.head.appendChild(
|
|
287
|
+
`,document.head.appendChild(D),T=D}}else T?.remove(),T=null;d(!0),l(!1),b.announce(`Accessibility active. ${M.fixed} fixes applied. Score: ${M.score}/100.`,"success")},[e]),pe=se(async()=>{await b.execute({enabled:!1}),document.documentElement.style.fontSize="",T?.remove(),T=null,document.querySelectorAll("*").forEach(u=>{u.style.filter="",u.style.transition="",u.style.animation=""}),r(Y),f(null),d(!1),b.announce("Accessibility reset to default.","info")},[]);return n?ue(de,{children:[t,ue("button",{ref:v,onClick:()=>{let u=!a;l(u),u&&b.announce("Accessibility panel opened","info",!1)},"aria-label":o?"Accessibility options \u2014 currently active. Click to change settings.":"Open accessibility options","aria-expanded":a,"aria-haspopup":"dialog",style:{position:"fixed",bottom:24,...i==="left"?{left:24}:{right:24},width:52,height:52,borderRadius:"50%",background:o?"#0f766e":"#0d9488",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 14px rgba(0,0,0,0.18)",zIndex:9999,transition:"background 0.2s, transform 0.15s",outline:"none"},onMouseEnter:u=>u.currentTarget.style.transform="scale(1.08)",onMouseLeave:u=>u.currentTarget.style.transform="scale(1)",onFocus:u=>u.currentTarget.style.boxShadow="0 0 0 4px rgba(13,148,136,0.45)",onBlur:u=>u.currentTarget.style.boxShadow="0 4px 14px rgba(0,0,0,0.18)",children:[H("svg",{viewBox:"0 0 24 24",style:{width:26,height:26,fill:"#fff"},"aria-hidden":"true",focusable:"false",children:H("path",{d:"M12 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4zm9 4.5l-5-.5-2-.2V5l-4 .5-4-.5v.8L4 6.5 3 7l1 3 4-.5v2.3L6 17h2l2-4.5L12 14l2 2.5L16 17h2l-2-4.2V9.5l4 .5 1-3z"})}),o&&H("span",{"aria-hidden":"true",style:{position:"absolute",top:4,right:4,width:10,height:10,borderRadius:"50%",background:"#5eead4",border:"2px solid #fff"}})]}),a&&H(G,{ref:x,position:i,settings:e,report:y,isActive:o,set:fe,onApply:be,onReset:pe,onClose:()=>{l(!1),v.current?.focus(),b.announce("Accessibility panel closed","info",!1)}})]}):H(de,{children:t})}var W={name:"ai.text",async execute(t){return`\u{1F916} YuktAI says: ${t}`}};var F={name:"voice.text",async execute(t){return!t||t.trim()===""?"\u{1F3A4} No speech detected":`\u{1F3A4} You said: ${t}`}};var A=class{plugins=new Map;register(i,n){if(!n||typeof n.execute!="function")throw new Error(`Invalid plugin: ${i}`);this.plugins.set(i,n)}use(i){return this.plugins.get(i)}async run(i,n){try{let s=this.use(i);if(!s)throw new Error(`Plugin not found: ${i}`);return await s.execute(n)}catch(s){throw console.error(`[YuktAI Runtime Error in ${i}]:`,s),s}}getPlugins(){return Array.from(this.plugins.keys())}};function Re(){if(typeof globalThis>"u")return new A;if(!globalThis.__yuktai_runtime__){let t=new A;t.register(b.name,b),t.register(W.name,W),t.register(F.name,F),globalThis.__yuktai_runtime__=t}return globalThis.__yuktai_runtime__}var ce=typeof window<"u"?Re():new A,it={wcagPlugin:b,list(){return ce.getPlugins()},use(t){return ce.use(t)},fix(t){return b.applyFixes({enabled:!0,autoFix:!0,...t})},scan(){return b.scan()}};export{A as Runtime,it as YuktAI,V as YuktAIWrapper,W as aiPlugin,V as default,F as voicePlugin,b as wcag,b as wcagPlugin};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuktishaalaa/yuktai",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.15",
|
|
4
4
|
"description": "Privacy-first, offline-first universal accessibility engine with WCAG auto-fix, OCR, voice, and Indic language AI support.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|