@yuktishaalaa/yuktai 5.3.0 → 5.3.1

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 CHANGED
@@ -1,810 +1,923 @@
1
- # @yuktishaalaa/yuktai
2
-
3
- > Universal accessibility, AI and data toolkit for Next.js, React **and plain HTML**. One install (or one script tag) brings WCAG 2.2 auto-fix, in-browser RAG, an AI agent, code generation, an accessible data grid with Agentic AI + WebMCP, and an agentic toolkit that audits, explains and fixes pages and answers questions about your data. Zero API keys, zero cost, works offline.
4
-
5
- [![npm](https://img.shields.io/npm/v/@yuktishaalaa/yuktai)](https://www.npmjs.com/package/@yuktishaalaa/yuktai)
6
- [![downloads](https://img.shields.io/npm/dm/@yuktishaalaa/yuktai)](https://www.npmjs.com/package/@yuktishaalaa/yuktai)
7
- [![license](https://img.shields.io/badge/license-GPL--3.0-blue)](./LICENSE)
8
- [![node](https://img.shields.io/badge/node-%3E%3D18-blue)](https://nodejs.org)
9
- [![Next.js](https://img.shields.io/badge/Next.js-13%2B-black)](https://nextjs.org)
10
- [![XERJ Corpus Hub contributor](https://hub.xerj.org/contributors/sandeepmiriyala03/badge.svg)](https://hub.xerj.org/contributors/sandeepmiriyala03)
11
-
12
- Built in free time by [Sandeep Miriyala](https://github.com/sandeepmiriyala03).
13
-
14
- **Live demos:**
15
- - Staff directory: https://aksharatantra.miriyala.in/staffdirectory
16
- - Ratnalabala, a Telugu poetry app built on YuktAI Grid: https://ratnalabala.vercel.app/poems?view=grid
17
-
18
- ---
19
-
20
- ## The story
21
-
22
- I have been building web apps since 2013. In all those years, the same things kept breaking on almost every website I touched: missing ARIA labels, no keyboard navigation, forms that senior citizens couldn't figure out, data grids that broke on mobile, accessibility tools that cost money, and AI tools that needed API keys.
23
-
24
- I wanted something without any of those barriers. Free. Open source. One install. Works on every device. No account. No key. No server.
25
-
26
- So I built yuktai, one weekend and one late night at a time.
27
-
28
- ---
29
-
30
- ## What's inside
31
-
32
- Six modules ship in a single npm package, for React/Next.js and, since v5.3, for plain HTML pages with one script tag:
33
-
34
- | Module | Features | What it does |
35
- |---|---|---|
36
- | **1. Accessibility Engine** | 16 | WCAG 2.2 auto-fix, speak on focus, colour-blind modes, dyslexia font, skip links |
37
- | **2. YuktaiGrid** ⭐ | 19 | Accessible data grid with Agentic AI, WebMCP, 5 WCAG themes, English/Telugu UI |
38
- | **3. In-Tab RAG** | 11 | Ask questions about any page, offline, no API |
39
- | **4. Autonomous AI Agent** | 13 | Natural-language browser guidance |
40
- | **5. Vibe Coder** | 19 | Generate full Next.js projects from plain English |
41
- | **6. Agentic AI Toolkit** | 10 | Accessibility copilot, QA reports, form and design review, smart grid queries, BI answers, multi-step tasks, voice settings |
42
- | **Vanilla JS build** 🆕 | All | Every module above for plain HTML, CSS and JavaScript: no React, no build step |
43
-
44
- ---
45
-
46
- ## What's new in v5.3: Vanilla JS (plain HTML)
47
-
48
- All of yuktai now works on any HTML page, without React or a build step. The vanilla build is bundled from the same source as the npm package, so a question gets the same answer in React and in plain HTML.
49
-
50
- ```html
51
- <script>
52
- window.YUKTAI_CONFIG = { position: "right", showPageTools: true } // optional
53
- </script>
54
- <script src="https://cdn.jsdelivr.net/npm/@yuktishaalaa/yuktai@5.3.0/vanilla/index.min.js"></script>
55
-
56
- <div id="staff"></div>
57
- <script>
58
- const grid = yuktai.renderGrid("#staff", {
59
- data: rows,
60
- rowKey: "id",
61
- columns: [
62
- { key: "name", label: "Name" },
63
- { key: "salary", label: "Salary", type: "number" },
64
- { key: "joined", label: "Joined", type: "date" },
65
- ],
66
- agentic: true, // question bar: "salary over 1 lakh", "average salary by department"
67
- ai: true, // assistant: custom rules, phrases, grid tools, voice input
68
- locale: "en-IN", // or "te-IN" for Telugu UI and messages
69
- webmcp: true,
70
- })
71
-
72
- await grid.ask("salary over 1 lakh in Hyderabad")
73
- yuktai.mountAgenticPanel("#tools", { defaultTab: "qa" }) // Copilot, QA, Forms, Design, Ask, Voice
74
- </script>
75
- ```
76
-
77
- | React / Next.js | Vanilla JS |
78
- |---|---|
79
- | `<YuktaiGrid>` | `yuktai.renderGrid(container, options)` |
80
- | `useAgenticGrid` + `<AgenticGridBar>` | `yuktai.createAgenticGrid()` + `yuktai.mountAgenticGridBar()`, or `agentic: true` |
81
- | `useYuktaiGridAgent` | `yuktai.createGridAgent()` |
82
- | `<YuktaiGridWebMCP>` | `yuktai.registerWebMCP()`, or `webmcp: true` |
83
- | `<AgenticPanel>` | `yuktai.mountAgenticPanel()` |
84
- | `<YuktAIWrapper>` | Automatic floating ♿ button (and 🛠 page tools with `showPageTools: true`) |
85
- | Every function (`runQaAudit`, `askInsight`, `parseAmount`, …) | Same names on `window.yuktai` |
86
-
87
- **Grid features in the vanilla build:**
88
- - search, sort, page-size switching, row selection and CSV export (Excel-safe)
89
- - table, card or auto view; 5 WCAG themes; Telugu UI
90
- - loading and empty states; row highlighting that scrolls to the row
91
- - ARIA grid keyboard navigation: arrow keys, Home/End, Page Up/Down, Space to select, Enter to open
92
-
93
- **Tested** in Chromium: 37 end-to-end checks pass, with axe-core reporting 0 violations and no console errors. Open `vanilla/index.html` in the repo for a demo of every feature, including a Telugu grid. Full API: [`vanilla/README.md`](./vanilla/README.md).
94
-
95
- ### Accessibility engine fixes in v5.3 (React and vanilla)
96
-
97
- - Auto-fix no longer adds an `aria-label` to form fields that already have a `<label>`. Before this, it replaced the name that screen readers announce.
98
- - Buttons and links hidden at scan time are no longer labelled "button" or "link".
99
- - `<header>` and `<footer>` inside sections and dialogs no longer become page-level banner and contentinfo landmarks.
100
- - The fix count only includes fixes that were actually applied.
101
- - Visual alert colours now meet a 4.5:1 contrast ratio.
102
-
103
- ---
104
-
105
- ## What's new in v5.2: Agentic AI Toolkit
106
-
107
- Ten agentic features, all running in the browser. No API keys, and no page or grid data leaves the device unless you plug in your own model through a `generate` or `summarize` hook.
108
-
109
- | # | Feature | What it does | Main export |
110
- |---|---|---|---|
111
- | 1 | Accessibility Copilot | Watches the page live, explains each issue in plain English, applies safe fixes and undoes them | `createA11yCopilot` |
112
- | 2 | Page Understanding | Answers "What does this page do?" and "Which form fields are missing labels?" | `analyzePage`, `askAboutPage` |
113
- | 3 | Smart Data Grid | Turns "overdue and over ₹10,000" into real filters, finds unusual rows, summarises data | `runGridQuery`, `detectAnomalies`, `summarizeRows` |
114
- | 4 | Voice Accessibility | "Turn on high contrast", "bigger text", "next row", plus Telugu phrases like "పెద్ద అక్షరాలు" | `createVoiceA11yController` |
115
- | 5 | QA Tester | 15 checks with WCAG references, a score, pass/fail, and a Markdown or JSON report | `runQaAudit`, `auditToMarkdown` |
116
- | 6 | Forms Agent | Reviews labels, autocomplete, error messages and senior-friendliness | `reviewForms` |
117
- | 7 | Page + Data RAG | Answers from page text and grid rows, Telugu-aware, offline | `createContextIndex` |
118
- | 8 | Multi-Step Tasks | "Show overdue, highlight the errors, then summarise what changed" | `runTasks` |
119
- | 9 | BI Copilot | "Which region had the highest drop in conversion this week?" | `askInsight`, `comparePeriods` |
120
- | 10 | Design Review | Hierarchy, readability, focus states, clutter, consistency | `reviewDesign` |
121
-
122
- ### Page tools in one panel
123
-
124
- ```tsx
125
- "use client";
126
- import { AgenticPanel } from "@yuktishaalaa/yuktai";
127
-
128
- export default function A11yTools() {
129
- return <AgenticPanel defaultTab="copilot" voiceLang="en-IN" />;
130
- }
131
- ```
132
-
133
- Tabs: **Copilot**, **QA report**, **Forms**, **Design**, **Ask page**, **Voice**. The panel marks itself with `data-yuktai-panel`, so it never audits its own UI.
134
-
135
- ### Ask your grid
136
-
137
- ```tsx
138
- "use client";
139
- import { YuktaiGrid, useAgenticGrid, AgenticGridBar } from "@yuktishaalaa/yuktai";
140
-
141
- const columns = [
142
- { key: "name", label: "Customer" },
143
- { key: "status", label: "Status" },
144
- { key: "region", label: "Region" },
145
- { key: "balance", label: "Balance", type: "number" as const },
146
- { key: "dueDate", label: "Due date", type: "date" as const },
147
- ];
148
-
149
- export default function Customers({ rows }: { rows: Customer[] }) {
150
- const grid = useAgenticGrid({ data: rows, columns, rowKey: "id" });
151
-
152
- return (
153
- <>
154
- <AgenticGridBar
155
- grid={grid}
156
- examples={[
157
- "overdue and over ₹10,000",
158
- "anything unusual?",
159
- "total balance by region",
160
- "show overdue, then sort by balance desc, then summarize what changed",
161
- ]}
162
- />
163
- <YuktaiGrid
164
- data={grid.gridData}
165
- columns={columns}
166
- rowKey="id"
167
- highlightIds={grid.highlightIds}
168
- autoScrollToHighlight
169
- />
170
- </>
171
- );
172
- }
173
- ```
174
-
175
- `grid.ask(text)` picks the right tool for the question:
176
-
177
- | Question type | Example | Handled by |
178
- |---|---|---|
179
- | Filters and lookups | "customer starting with A and balance between 1k and 9k" | Smart grid query |
180
- | Unusual data | "anything unusual?" | Outliers and duplicate rows |
181
- | Group and period questions | "which region had the highest drop in conversion this week?" | BI copilot |
182
- | Several steps | "show overdue, then highlight errors, then summarise" | Task runner, with a before/after report |
183
-
184
- Amounts like `₹10,000`, `10k`, `1.5 lakh` and `2 crore` are understood.
185
-
186
- ### Use the functions directly
187
-
188
- ```ts
189
- import { runQaAudit, auditToMarkdown, askInsight, runGridQuery } from "@yuktishaalaa/yuktai";
190
-
191
- // In the browser: accessibility QA report
192
- const report = runQaAudit();
193
- console.log(report.score, report.passed);
194
- const md = auditToMarkdown(report); // attach to a ticket or PR
195
-
196
- // Anywhere: data questions
197
- askInsight("which region had the highest drop in conversion this week", rows, columns).answer;
198
- runGridQuery("overdue and over 10k", { data: rows, columns }).ids;
199
- ```
200
-
201
- ### Plug in your own model (optional)
202
-
203
- Everything works offline with rules and keyword search. To get model-written answers, pass a `generate` hook, for example Gemini Nano or your own API:
204
-
205
- ```tsx
206
- <AgenticPanel generate={async (question, context) => myModel(question, context)} />
207
- ```
208
-
209
- ### Honest limits
210
-
211
- - Questions are understood with rules, not a language model, so unusual phrasing may need rewording. The parser returns `notes` explaining any assumption it made.
212
- - The QA and design checks are automatic heuristics. They catch common problems but don't replace testing with real users and assistive technology.
213
- - Smart grid queries, page answers and BI answers are in English today. Telugu and Hindi data questions are not parsed yet; use `customRules` with your own phrases for them.
214
- - Voice accessibility commands understand English and Telugu, not yet Hindi or other languages.
215
-
216
- ---
217
-
218
- ## What's new in v4.6.4: YuktaiGrid Agentic AI + WebMCP
219
-
220
- - Shared Grid Tools used by both the Agent and WebMCP
221
- - Tools: search, count, columns, get row, highlight, select, open
222
- - WebMCP registration through `document.modelContext`
223
- - `useYuktaiGridAgent` hook for programmatic tool execution
224
- - Embedded Grid AI Assistant inside YuktaiGrid
225
- - English and Telugu AI UI, with English or Telugu voice input
226
- - Working page-size switching (10 → 20 → 50 → 100)
227
- - Seven inline SVG icons, no external icon dependency
228
-
229
- **Architecture:** User → Agent / WebMCP → Grid Tools → YuktaiGrid → Data
230
-
231
- ---
232
-
233
- ## Works on every device
234
-
235
- | Device | Browser | Core features | AI engine |
236
- |---|---|---|---|
237
- | 🖥 Desktop | Chrome 147+ (needed only for Gemini Nano) | ✅ All | Gemini Nano |
238
- | 🖥 Desktop | Firefox / Edge / Safari | ✅ All | Transformers.js |
239
- | 📱 Android | Chrome Mobile | ✅ All | Transformers.js |
240
- | 📱 iOS | Safari Mobile | ✅ All | Transformers.js |
241
- | 📲 PWA offline | All browsers | ✅ All | Offline after first load |
242
-
243
- yuktai picks the best AI engine automatically. Users never need to know which one is running.
244
-
245
- ---
246
-
247
- ## Install
248
-
249
- **Next.js 16 + React 19 (recommended)**
250
-
251
- ```bash
252
- npm install @yuktishaalaa/yuktai --legacy-peer-deps
253
- ```
254
-
255
- **Next.js 13, 14, 15**
256
-
257
- ```bash
258
- npm install @yuktishaalaa/yuktai
259
- ```
260
-
261
- **Yarn / pnpm**
262
-
263
- ```bash
264
- yarn add @yuktishaalaa/yuktai
265
- pnpm add @yuktishaalaa/yuktai
266
- ```
267
-
268
- **Plain HTML (no install)**
269
-
270
- ```html
271
- <script src="https://cdn.jsdelivr.net/npm/@yuktishaalaa/yuktai@5.3.0/vanilla/index.min.js"></script>
272
- ```
273
-
274
- Requirements: Node.js 18+, npm 8+, Next.js 13+ (React builds only; the vanilla build needs only a browser).
275
-
276
- ---
277
-
278
- ## Quick start
279
-
280
- ### Step 1: `next.config.js`
281
-
282
- ```js
283
- const nextConfig = {
284
- transpilePackages: ["@yuktishaalaa/yuktai"],
285
- async headers() {
286
- return [
287
- {
288
- source: "/(.*)",
289
- headers: [
290
- // Needed for voice control and voice input
291
- { key: "Permissions-Policy", value: "microphone=*, speaker=*" },
292
- ],
293
- },
294
- ];
295
- },
296
- };
297
-
298
- module.exports = nextConfig;
299
- ```
300
-
301
- ### Step 2: Client wrapper
302
-
303
- ```tsx
304
- // components/YuktaiClient.tsx
305
- "use client";
306
-
307
- import { useState, useEffect, type ReactNode } from "react";
308
- import { YuktAIWrapper } from "@yuktishaalaa/yuktai";
309
-
310
- export default function YuktaiClient({ children }: { children: ReactNode }) {
311
- const [mounted, setMounted] = useState(false);
312
- useEffect(() => setMounted(true), []);
313
-
314
- if (!mounted) return <>{children}</>;
315
-
316
- return (
317
- <YuktAIWrapper position="left" showRag showAgent>
318
- {children}
319
- </YuktAIWrapper>
320
- );
321
- }
322
- ```
323
-
324
- ### Step 3: `app/layout.tsx`
325
-
326
- ```tsx
327
- import YuktaiClient from "@/components/YuktaiClient";
328
-
329
- export default function RootLayout({ children }: { children: React.ReactNode }) {
330
- return (
331
- <html lang="en">
332
- <body>
333
- <YuktaiClient>
334
- <main>{children}</main>
335
- </YuktaiClient>
336
- </body>
337
- </html>
338
- );
339
- }
340
- ```
341
-
342
- That's it. Floating buttons appear on every page: ♿ opens the accessibility panel, 💬 opens "Ask this page", and the agent button opens the AI agent.
343
-
344
- To add the v5.2 agentic tools, place `<AgenticPanel />` or `useAgenticGrid` in any client component (see [What's new in v5.2](#whats-new-in-v52-agentic-ai-toolkit)).
345
-
346
- ### Wrapper props
347
-
348
- | Prop | Type | Default | Description |
349
- |---|---|---|---|
350
- | `position` | `"left" \| "right"` | `"left"` | Which side the buttons appear on |
351
- | `showRag` | `boolean` | `false` | Show the 💬 Ask-this-page button |
352
- | `showAgent` | `boolean` | `false` | Show the AI agent button |
353
- | `config` | `Partial<A11yConfig>` | `undefined` | Accessibility config overrides |
354
- | `children` | `ReactNode` | required | Your app content |
355
-
356
- ---
357
-
358
- ## Module 1: Accessibility Engine
359
-
360
- Scans every element and injects missing accessibility attributes automatically. Covers headings, images, forms, tables, lists, landmarks, and ARIA widgets. Watches for new DOM elements with `MutationObserver`.
361
-
362
- **Features**
363
-
364
- - WCAG 2.2 auto-fix: ARIA, roles, tabindex, scope, autocomplete, alt text
365
- - Speak on focus using browser SpeechSynthesis
366
- - Voice control using the SpeechRecognition API
367
- - Visual alerts for deaf and hard-of-hearing users
368
- - High contrast, dark mode, reduce motion, large targets (44×44)
369
- - Colour-blind modes: Deuteranopia, Protanopia, Tritanopia, Greyscale
370
- - Dyslexia font: Atkinson Hyperlegible
371
- - Local font picker and font scaling from 80% to 130%
372
- - Audit badge with a WCAG score from 0 to 100 (localhost only)
373
- - Skip links, focus trap, saved preferences, reset
374
-
375
- **Direct API**
376
-
377
- ```ts
378
- import { wcagPlugin, type A11yConfig } from "@yuktishaalaa/yuktai";
379
-
380
- const config: A11yConfig = {
381
- enabled: true,
382
- highContrast: false,
383
- darkMode: false,
384
- reduceMotion: false,
385
- largeTargets: false,
386
- speechEnabled: false,
387
- colorBlindMode: "none", // none | deuteranopia | protanopia | tritanopia | achromatopsia
388
- autoFix: true,
389
- showPreferencePanel: true,
390
- showSkipLinks: true,
391
- showAuditBadge: false, // dev only (localhost)
392
- fontSizeMultiplier: 1,
393
- timeoutWarning: 0, // seconds, 0 = off
394
- };
395
-
396
- const report = wcagPlugin.applyFixes(config);
397
- console.log(report.fixed); // number of fixes applied
398
- console.log(report.score); // 0–100
399
- ```
400
-
401
- ### WCAG coverage
402
-
403
- | Standard | Criteria | Examples |
404
- |---|---|---|
405
- | WCAG 2.0 | 19 | Alt text, roles, labels, tables, landmarks, focus |
406
- | WCAG 2.1 | 7 | Touch targets, reflow, motion, orientation |
407
- | WCAG 2.2 | 3 | Focus appearance, target size, timeout warning |
408
- | Beyond WCAG | Extras | Speech, visual alerts, colour-blind modes, dyslexia font, audit score |
409
-
410
- ---
411
-
412
- ## Module 2: YuktaiGrid ⭐
413
-
414
- An accessible data grid for Next.js, with an embedded AI assistant, agent tools, and WebMCP support.
415
-
416
- ### Basic usage
417
-
418
- ```tsx
419
- "use client";
420
-
421
- import { YuktaiGrid } from "@yuktishaalaa/yuktai";
422
-
423
- const data = [
424
- { id: 1, name: "Sandeep", role: "Developer", salary: 85000 },
425
- { id: 2, name: "Priya", role: "Designer", salary: 90000 },
426
- ];
427
-
428
- export default function EmployeesPage() {
429
- return (
430
- <YuktaiGrid
431
- data={data}
432
- rowKey="id"
433
- columns={[
434
- { key: "name", label: "Name", sortable: true },
435
- { key: "role", label: "Role" },
436
- { key: "salary", label: "Salary", type: "number", align: "right" },
437
- ]}
438
- theme="default" // default | high-contrast | dark | color-blind | dyslexia
439
- locale="en-US" // en-US | te-IN
440
- view="auto" // auto | table | card
441
- search
442
- ai
443
- pagination={{
444
- pageSize: 20,
445
- showSizeChanger: true,
446
- sizeOptions: [10, 20, 50, 100],
447
- }}
448
- />
449
- );
450
- }
451
- ```
452
-
453
- ### Grid features
454
-
455
- - Real-time search, column sorting, client-side pagination with page-size switching
456
- - Mobile card view below a configurable breakpoint
457
- - Loading and empty states
458
- - 5 WCAG themes
459
- - Row selection, custom cell render, `rowKey`
460
- - Row highlighting with optional auto-scroll
461
- - Keyboard navigation, ARIA grid semantics, 44×44 targets
462
- - English and Telugu UI
463
- - Embedded Grid AI Assistant with voice and chat
464
- - **New in v5.2:** compound natural-language questions, anomaly detection and BI answers through `useAgenticGrid`
465
-
466
- ### Grid AI Assistant
467
-
468
- Runs embedded in the grid or as a standalone component. Intent parsing runs locally and supports search, sort, count, highest, lowest, average, total, and row lookup.
469
-
470
- ```tsx
471
- <YuktaiGridAI
472
- data={data}
473
- columns={columns}
474
- onSearch={handleSearch}
475
- onSort={handleSort}
476
- language="te-IN" // AI UI and responses: en-US | te-IN
477
- inputLanguage="te-IN" // voice input: en-IN, en-US or any of the 22 Indian languages
478
- embedded
479
- />
480
- ```
481
-
482
- Voice recognition depends on browser Web Speech API support.
483
-
484
- ### Agent tools
485
-
486
- Generic, reusable grid operations shared by the Agent and WebMCP:
487
-
488
- ```ts
489
- import {
490
- searchGrid,
491
- countGrid,
492
- getColumns,
493
- getRow,
494
- highlightRows,
495
- selectRow,
496
- openRow,
497
- } from "@yuktishaalaa/yuktai";
498
- ```
499
-
500
- Run tools programmatically:
501
-
502
- ```tsx
503
- import { useYuktaiGridAgent, type GridAgentTool } from "@yuktishaalaa/yuktai";
504
-
505
- const tools: GridAgentTool[] = [
506
- {
507
- name: "search",
508
- description: "Search grid rows by a text query",
509
- execute: async ({ query }) => searchGrid(data, query),
510
- },
511
- ];
512
-
513
- const { executeTool, loading } = useYuktaiGridAgent({ tools });
514
- ```
515
-
516
- **Design principle:** keep generic tools in the package and put app-specific rules in your app.
517
-
518
- ```text
519
- Generic YuktAI tools + Your domain rules = Your application agent
520
- ```
521
-
522
- ### WebMCP
523
-
524
- Exposes grid tools to browser AI agents through `document.modelContext`, so agents call real operations instead of guessing from the DOM. Registration is invisible in the UI.
525
-
526
- ```tsx
527
- <YuktaiGrid
528
- data={rows}
529
- columns={columns}
530
- ai
531
- webmcp
532
- toolName="my_grid"
533
- toolDescriptions={TOOL_DESCRIPTIONS}
534
- onWebMCPStatusChange={setStatus} // unsupported | registering | ready | partial | error
535
- />
536
- ```
537
-
538
- Or standalone:
539
-
540
- ```tsx
541
- <YuktaiGridWebMCP data={data} columns={columns} />
542
- ```
543
-
544
- WebMCP is not available in every browser, so always handle the `unsupported` status gracefully.
545
-
546
- ### Large datasets (100K+ rows)
547
-
548
- Client-side pagination handles a few thousand rows well. For anything larger, use server-side pagination and disable the grid's built-in search and pagination.
549
-
550
- `src/app/api/employees/route.ts`:
551
-
552
- ```ts
553
- import { NextRequest, NextResponse } from "next/server";
554
-
555
- let cachedData: any[] | null = null;
556
- let cacheTime = 0;
557
- const TTL_MS = 60_000;
558
-
559
- async function fetchAll(): Promise<any[]> {
560
- const now = Date.now();
561
- if (cachedData && now - cacheTime < TTL_MS) return cachedData;
562
- const res = await fetch("https://your-api.com/employees", { cache: "no-store" });
563
- const json = await res.json();
564
- cachedData = Array.isArray(json) ? json : json.employees ?? json.data ?? [];
565
- cacheTime = now;
566
- return cachedData;
567
- }
568
-
569
- export async function GET(req: NextRequest) {
570
- const p = req.nextUrl.searchParams;
571
- const page = Math.max(1, parseInt(p.get("page") || "1"));
572
- const pageSize = Math.max(1, parseInt(p.get("pageSize") || "5000"));
573
- const search = (p.get("search") || "").toLowerCase().trim();
574
-
575
- const all = await fetchAll();
576
- const filtered = search
577
- ? all.filter((r) => Object.values(r).some((v) => String(v).toLowerCase().includes(search)))
578
- : all;
579
-
580
- const total = filtered.length;
581
- const rows = filtered.slice((page - 1) * pageSize, page * pageSize);
582
-
583
- return NextResponse.json({
584
- rows,
585
- pagination: { page, pageSize, totalRows: total, totalPages: Math.ceil(total / pageSize) },
586
- });
587
- }
588
- ```
589
-
590
- Page:
591
-
592
- ```tsx
593
- const [apiResp, setApiResp] = useState<any>(null);
594
- const [currentPage, setPage] = useState(1);
595
-
596
- useEffect(() => {
597
- fetch(`/api/employees?page=${currentPage}&pageSize=5000`)
598
- .then((r) => r.json())
599
- .then(setApiResp);
600
- }, [currentPage]);
601
-
602
- <YuktaiGrid
603
- data={apiResp?.rows ?? []}
604
- columns={columns}
605
- search={false} // handled server-side
606
- pagination={false} // handled server-side
607
- loading={!apiResp}
608
- />;
609
- ```
610
-
611
- Render your own pagination bar from `apiResp.pagination`. The browser only ever holds one page in memory.
612
-
613
- ---
614
-
615
- ## Showcase: Ratnalabala (Telugu poetry)
616
-
617
- [Ratnalabala](https://ratnalabala.vercel.app/poems?view=grid) shows that an agentic grid is more than a chatbot next to a table. Users type or speak in Telugu, and the grid acts.
618
-
619
- | User says | Agent action |
620
- |---|---|
621
- | `ఎన్ని పద్యాలు` (how many poems) | `count` → "మొత్తం 36 పద్యాలు ఉన్నాయి." |
622
- | `గర్వం తెరువు` (open "Garvam") | `open` |
623
- | `"బుద్ధి" ఉన్న పద్యాలు` (poems with "buddhi") | `search` + highlight |
624
- | `అక్షర క్రమంలో` (alphabetical) | `sort(title, asc)` |
625
- | `ఈరోజు పద్యం` (poem of the day) | custom rule + highlight |
626
-
627
- **Stack:** Next.js · React + TypeScript · MUI · YuktAI Grid · FastAPI (Python) · PostgreSQL on Neon · Vercel · Web Speech API · WebMCP
628
-
629
- ```text
630
- PostgreSQL → FastAPI → Next.js API proxy → Ratnalabala UI → YuktAI Grid
631
- ├── Agent
632
- └── WebMCP
633
- ```
634
-
635
- ```tsx
636
- <YuktaiGrid<PoemRow>
637
- data={rows}
638
- columns={COLUMNS}
639
- rowKey="id"
640
- locale="te-IN"
641
- inputLanguage="te-IN"
642
- customRules={POEM_RULES}
643
- search
644
- highlightIds={highlightIds}
645
- autoScrollToHighlight
646
- onRowClick={(row) => onOpenPoem(row.title)}
647
- ai
648
- webmcp
649
- toolName="ratnalabala_poems"
650
- toolDescriptions={TOOL_DESCRIPTIONS}
651
- onWebMCPStatusChange={setWebmcp}
652
- />
653
- ```
654
-
655
- ---
656
-
657
- ## Module 3: In-Tab RAG (Ask This Page)
658
-
659
- Retrieval-Augmented Generation running entirely in the browser. It extracts text chunks from the current page, embeds them, finds the best match for the question, and answers. Offline, no API key.
660
-
661
- | Device | Engine | How it works |
662
- |---|---|---|
663
- | Desktop Chrome with Gemini Nano | `window.LanguageModel` | Page text sent as context, instant answer |
664
- | Mobile and all other browsers | Transformers.js | Embeddings + `flan-t5-small`, q4 quantized |
665
-
666
- - About 30 MB one-time model download on mobile, cached in IndexedDB
667
- - Works fully offline after first load
668
- - All processing on device, no data sent anywhere
669
-
670
- **What I learned:** Transformers.js kept crashing on iOS Safari with out-of-memory errors. Quantization (same model, 75% smaller) fixed it. DistilBERT gave short, useless spans; `flan-t5-small` gives real sentences.
671
-
672
- **New in v5.2:** `createContextIndex` also searches grid rows (including rows on other pages of the grid) and your own documents, with keyword search that handles Telugu and Hindi script correctly.
673
-
674
- ---
675
-
676
- ## Module 4: Autonomous AI Agent
677
-
678
- Type a goal in plain English. yuktai reads the page, finds the right elements, plans the steps, and highlights what to do.
679
-
680
- - 9 DOM traversal strategies and 11 form-label strategies
681
- - Works on static HTML, React, WordPress, and old government portals
682
- - Gemini Nano planning on desktop, Transformers.js on mobile, rule-based fallback
683
- - Highlights target fields, scrolls to sections, shows a numbered plan, handles iframes
684
-
685
- Every label strategy came from a real website: old portals put labels in the previous table cell, modern apps use `aria-label`, static pages use `placeholder`.
686
-
687
- ---
688
-
689
- ## Module 5: Vibe Coder
690
-
691
- Type a business requirement and download a full Next.js 16 project as a ZIP.
692
-
693
- - Detects website type (12), pages (21), features (14), theme colour (8), and site name
694
- - Preview before generating
695
- - TypeScript, Tailwind + CSS Modules, mobile responsive
696
- - Navbar, Footer, Home, About, Contact, Services, Pricing, Auth, Dashboard
697
- - `npm run dev` works immediately
698
-
699
- No AI writes the code. It's pure template engineering.
700
-
701
- ---
702
-
703
- ## Module 6: Agentic AI Toolkit 🆕
704
-
705
- The ten v5.2 features, described in detail in [What's new in v5.2](#whats-new-in-v52-agentic-ai-toolkit).
706
-
707
- - **Copilot and QA:** 15 WCAG checks, plain-English explanations, safe fixes with undo, downloadable reports
708
- - **Forms and design review:** labels, autocomplete, error messages, focus states, hierarchy, clutter, senior-friendly tips
709
- - **Data:** compound grid questions, outliers and duplicates, group-by, period comparison, trends
710
- - **Automation:** multi-step instructions with a before/after summary
711
- - **Voice:** accessibility settings and grid row navigation by voice, in English and Telugu
712
- - **React:** `AgenticPanel`, `AgenticGridBar`, `useAgenticGrid`
713
-
714
- ---
715
-
716
- ## Gemini Nano setup (desktop Chrome, one time)
717
-
718
- Needed only for Gemini Nano features on desktop Chrome. Mobile and other browsers use Transformers.js automatically.
719
-
720
- 1. Open `chrome://flags` and enable: Prompt API for Gemini Nano, Summarization API, Writer API, Rewriter API, Translation API.
721
- 2. Click **Relaunch**.
722
- 3. Open `chrome://components`, find **Optimization Guide On Device Model**, and click **Check for update**.
723
- 4. Refresh your page. AI features unlock automatically.
724
-
725
- **Gemini Nano features:** plain-English rewriting, 3-sentence page summary, AI-generated ARIA labels, page translation in 18 languages.
726
-
727
- > Chrome 147 moved the APIs from `window.ai` to standalone globals such as `window.LanguageModel`. yuktai supports both.
728
-
729
- ---
730
-
731
- ## Icons
732
-
733
- Seven custom SVG icons with no external dependency.
734
-
735
- ```tsx
736
- import {
737
- SearchIcon,
738
- SortUpIcon,
739
- SortDownIcon,
740
- ChevronLeftIcon,
741
- ChevronRightIcon,
742
- CheckIcon,
743
- CloseIcon,
744
- } from "@yuktishaalaa/yuktai";
745
-
746
- <SearchIcon size={20} />
747
- <CheckIcon size={20} color="#10b981" label="Task complete" />
748
- ```
749
-
750
- Props: `size` (default 20), `color` (default `currentColor`), `strokeWidth` (default 2.5), `label` (adds ARIA; decorative if omitted).
751
-
752
- ---
753
-
754
- ## Design principles
755
-
756
- - **Zero API keys, zero cost, zero telemetry.** Everything runs in the browser.
757
- - **Zero injected ids.** Injected nodes are tracked by JavaScript references, so they never collide with your app's ids.
758
- - **Zero framework lock-in.** `core/renderer.ts` has no framework imports, and the vanilla build runs on any HTML page.
759
- - **Never reads its own UI.** Panels are marked with `data-yuktai-panel`.
760
- - **SSR safe.** No `window` errors on the server.
761
- - **Every automatic fix can be undone.** The v5.2 copilot records each change it makes.
762
- - **Honest limits.** Client-side pagination is for a few thousand rows; use server-side beyond that.
763
-
764
- ---
765
-
766
- ## Compatibility
767
-
768
- | | Supported |
769
- |---|---|
770
- | Next.js | 13, 14, 15, 16 |
771
- | Plain HTML | Any page, one script tag (vanilla build) |
772
- | React | 17, 18, 19 (19 needs `--legacy-peer-deps`) |
773
- | Node.js | 18+ |
774
- | Browsers | Chrome 90+, Firefox 90+, Safari 15+, Edge 90+, Samsung Internet 14+ |
775
-
776
- ---
777
-
778
- ## Roadmap
779
-
780
- - **Shipped (v5.3):** Vanilla JS build of every module for plain HTML pages, plus accessibility engine fixes
781
- - **Shipped (v5.2):** Agentic AI Toolkit: accessibility copilot, QA reports, form and design review, smart grid queries, BI answers, multi-step tasks, page + data RAG, voice accessibility commands
782
- - **Shipped (v4.6.4):** YuktaiGrid Agentic AI + WebMCP, embedded Grid AI Assistant, English/Telugu UI, page-size switching, icon polish
783
- - **Next:** expose the v5.2 agentic tools through WebMCP, more Grid Agent tools, multilingual RAG (Telugu, Hindi, Tamil, Bengali)
784
- - **Later:** RTL support, richer browser-native AI, multimodal grid experiences
785
-
786
- ---
787
-
788
- ## Contributing
789
-
790
- Issues and pull requests are welcome at [github.com/sandeepmiriyala03/yuktai](https://github.com/sandeepmiriyala03/yuktai). For security issues, see [SECURITY.md](./SECURITY.md).
791
-
792
- ---
793
-
794
- ## Links
795
-
796
- - npm: [@yuktishaalaa/yuktai](https://www.npmjs.com/package/@yuktishaalaa/yuktai)
797
- - GitHub: [sandeepmiriyala03/yuktai](https://github.com/sandeepmiriyala03/yuktai)
798
- - Demo: [aksharatantra.miriyala.in/staffdirectory](https://aksharatantra.miriyala.in/staffdirectory)
799
- - Showcase: [ratnalabala.vercel.app](https://ratnalabala.vercel.app/poems?view=grid)
800
- - Vanilla JS (CDN): [cdn.jsdelivr.net/npm/@yuktishaalaa/yuktai/vanilla/index.min.js](https://cdn.jsdelivr.net/npm/@yuktishaalaa/yuktai/vanilla/index.min.js)
801
-
802
- ---
803
-
804
- ## License
805
-
806
- GPL-3.0 © Sandeep Miriyala, [Yuktishaalaa AI Lab](https://github.com/sandeepmiriyala03)
807
-
808
- Built in free time. AI coding assistants (Claude, GPT and Gemini) helped me learn, and helped write and test parts of the code. Every design decision, review and release is mine.
809
-
810
- **Free forever. Open source. Built for every user.**
1
+ # @yuktishaalaa/yuktai
2
+
3
+ > Universal accessibility, AI and data toolkit for Next.js, React **and plain HTML**. One install (or one script tag) brings WCAG 2.2 auto-fix, in-browser RAG, an AI agent, code generation, an accessible data grid with Agentic AI + WebMCP, and an agentic toolkit that audits, explains and fixes pages and answers questions about your data. Zero API keys, zero cost, works offline.
4
+
5
+ [![npm](https://img.shields.io/npm/v/@yuktishaalaa/yuktai)](https://www.npmjs.com/package/@yuktishaalaa/yuktai)
6
+ [![downloads](https://img.shields.io/npm/dm/@yuktishaalaa/yuktai)](https://www.npmjs.com/package/@yuktishaalaa/yuktai)
7
+ [![license](https://img.shields.io/badge/license-GPL--3.0-blue)](./LICENSE)
8
+ [![node](https://img.shields.io/badge/node-%3E%3D18-blue)](https://nodejs.org)
9
+ [![Next.js](https://img.shields.io/badge/Next.js-13%2B-black)](https://nextjs.org)
10
+ [![XERJ Corpus Hub contributor](https://hub.xerj.org/contributors/sandeepmiriyala03/badge.svg)](https://hub.xerj.org/contributors/sandeepmiriyala03)
11
+
12
+ Built in free time by [Sandeep Miriyala](https://github.com/sandeepmiriyala03).
13
+
14
+ **Live demos:**
15
+ - Staff directory (Next.js): https://aksharatantra.miriyala.in/staffdirectory
16
+ - Vanilla JS, plain HTML, installable PWA: https://sandeepmiriyala03.github.io/yuktai/vanilla/
17
+ - Ratnalabala, a Telugu poetry app built on YuktAI Grid: https://ratnalabala.vercel.app/poems?view=grid
18
+
19
+ **Recognition:** yuktai is part of the [XERJ Corpus Hub](https://hub.xerj.org). Contributor profile: [hub.xerj.org/contributors/sandeepmiriyala03](https://hub.xerj.org/contributors/sandeepmiriyala03).
20
+
21
+ ---
22
+
23
+ ## The story
24
+
25
+ I have been building web apps since 2013. In all those years, the same things kept breaking on almost every website I touched: missing ARIA labels, no keyboard navigation, forms that senior citizens couldn't figure out, data grids that broke on mobile, accessibility tools that cost money, and AI tools that needed API keys.
26
+
27
+ I wanted something without any of those barriers. Free. Open source. One install. Works on every device. No account. No key. No server.
28
+
29
+ So I built yuktai, one weekend and one late night at a time.
30
+
31
+ ---
32
+
33
+ ## What's inside
34
+
35
+ Six modules ship in a single npm package, for React/Next.js and, since v5.3, for plain HTML pages with one script tag:
36
+
37
+ | Module | Features | What it does |
38
+ |---|---|---|
39
+ | **1. Accessibility Engine** | 16 | WCAG 2.2 auto-fix, speak on focus, colour-blind modes, dyslexia font, skip links |
40
+ | **2. YuktaiGrid** ⭐ | 19 | Accessible data grid with Agentic AI, WebMCP, 5 WCAG themes, English/Telugu UI |
41
+ | **3. In-Tab RAG** | 11 | Ask questions about any page, offline, no API |
42
+ | **4. Autonomous AI Agent** | 13 | Natural-language browser guidance |
43
+ | **5. Vibe Coder** | 19 | Generate full Next.js projects from plain English |
44
+ | **6. Agentic AI Toolkit** | 10 | Accessibility copilot, QA reports, form and design review, smart grid queries, BI answers, multi-step tasks, voice settings |
45
+ | **Vanilla JS build** 🆕 | All | Every module above for plain HTML, CSS and JavaScript: no React, no build step, installable as a PWA |
46
+
47
+ ---
48
+
49
+ ## What's new in v5.3: Vanilla JS (plain HTML)
50
+
51
+ All of yuktai now works on any HTML page, without React or a build step. The vanilla build is bundled from the same source as the npm package, so a question gets the same answer in React and in plain HTML.
52
+
53
+ ```html
54
+ <script>
55
+ window.YUKTAI_CONFIG = { position: "right", showPageTools: true } // optional
56
+ </script>
57
+ <script src="https://cdn.jsdelivr.net/npm/@yuktishaalaa/yuktai@5.3.0/vanilla/index.min.js"></script>
58
+
59
+ <div id="staff"></div>
60
+ <script>
61
+ const grid = yuktai.renderGrid("#staff", {
62
+ data: rows,
63
+ rowKey: "id",
64
+ columns: [
65
+ { key: "name", label: "Name" },
66
+ { key: "salary", label: "Salary", type: "number" },
67
+ { key: "joined", label: "Joined", type: "date" },
68
+ ],
69
+ agentic: true, // question bar: "salary over 1 lakh", "average salary by department"
70
+ ai: true, // assistant: custom rules, phrases, grid tools, voice input
71
+ locale: "en-IN", // or "te-IN" for Telugu UI and messages
72
+ webmcp: true,
73
+ })
74
+
75
+ await grid.ask("salary over 1 lakh in Hyderabad")
76
+ yuktai.mountAgenticPanel("#tools", { defaultTab: "qa" }) // Copilot, QA, Forms, Design, Ask, Voice
77
+ </script>
78
+ ```
79
+
80
+ | React / Next.js | Vanilla JS |
81
+ |---|---|
82
+ | `<YuktaiGrid>` | `yuktai.renderGrid(container, options)` |
83
+ | `useAgenticGrid` + `<AgenticGridBar>` | `yuktai.createAgenticGrid()` + `yuktai.mountAgenticGridBar()`, or `agentic: true` |
84
+ | `useYuktaiGridAgent` | `yuktai.createGridAgent()` |
85
+ | `<YuktaiGridWebMCP>` | `yuktai.registerWebMCP()`, or `webmcp: true` |
86
+ | `<AgenticPanel>` | `yuktai.mountAgenticPanel()` |
87
+ | `<YuktAIWrapper>` | Automatic floating accessibility button (and a page tools button with `showPageTools: true`) |
88
+ | Every function (`runQaAudit`, `askInsight`, `parseAmount`, …) | Same names on `window.yuktai` |
89
+
90
+ **Grid features in the vanilla build:**
91
+ - search, sort, page-size switching, row selection and CSV export (Excel-safe)
92
+ - table, card or auto view; 5 WCAG themes; Telugu UI
93
+ - loading and empty states; row highlighting that scrolls to the row
94
+ - ARIA grid keyboard navigation: arrow keys, Home/End, Page Up/Down, Space to select, Enter to open
95
+
96
+ **Live demo:** https://sandeepmiriyala03.github.io/yuktai/vanilla/. It shows every feature, including a Telugu grid of the 27 poems from *Rangu Rangula Ratnadeepalu*. It is an installable PWA that works offline after the first visit, and it uses only yuktai's own inline SVG icons and the yuktai teal palette.
97
+
98
+ **Tested** in Chromium: 37 end-to-end checks pass, with axe-core reporting 0 violations and no console errors (`node vanilla/test/e2e.mjs`). Full API: [`vanilla/README.md`](./vanilla/README.md).
99
+
100
+ ### Accessibility engine fixes in v5.3 (React and vanilla)
101
+
102
+ - Auto-fix no longer adds an `aria-label` to form fields that already have a `<label>`. Before this, it replaced the name that screen readers announce.
103
+ - Buttons and links hidden at scan time are no longer labelled "button" or "link".
104
+ - `<header>` and `<footer>` inside sections and dialogs no longer become page-level banner and contentinfo landmarks.
105
+ - The fix count only includes fixes that were actually applied.
106
+ - Visual alert and skip-link colours use the yuktai teal palette and meet a 4.5:1 contrast ratio.
107
+
108
+ ---
109
+
110
+ ## What's new in v5.2: Agentic AI Toolkit
111
+
112
+ Ten agentic features, all running in the browser. No API keys, and no page or grid data leaves the device unless you plug in your own model through a `generate` or `summarize` hook.
113
+
114
+ | # | Feature | What it does | Main export |
115
+ |---|---|---|---|
116
+ | 1 | Accessibility Copilot | Watches the page live, explains each issue in plain English, applies safe fixes and undoes them | `createA11yCopilot` |
117
+ | 2 | Page Understanding | Answers "What does this page do?" and "Which form fields are missing labels?" | `analyzePage`, `askAboutPage` |
118
+ | 3 | Smart Data Grid | Turns "overdue and over ₹10,000" into real filters, finds unusual rows, summarises data | `runGridQuery`, `detectAnomalies`, `summarizeRows` |
119
+ | 4 | Voice Accessibility | "Turn on high contrast", "bigger text", "next row", plus Telugu phrases like "పెద్ద అక్షరాలు" | `createVoiceA11yController` |
120
+ | 5 | QA Tester | 15 checks with WCAG references, a score, pass/fail, and a Markdown or JSON report | `runQaAudit`, `auditToMarkdown` |
121
+ | 6 | Forms Agent | Reviews labels, autocomplete, error messages and senior-friendliness | `reviewForms` |
122
+ | 7 | Page + Data RAG | Answers from page text and grid rows, Telugu-aware, offline | `createContextIndex` |
123
+ | 8 | Multi-Step Tasks | "Show overdue, highlight the errors, then summarise what changed" | `runTasks` |
124
+ | 9 | BI Copilot | "Which region had the highest drop in conversion this week?" | `askInsight`, `comparePeriods` |
125
+ | 10 | Design Review | Hierarchy, readability, focus states, clutter, consistency | `reviewDesign` |
126
+
127
+ ### Page tools in one panel
128
+
129
+ ```tsx
130
+ "use client";
131
+ import { AgenticPanel } from "@yuktishaalaa/yuktai";
132
+
133
+ export default function A11yTools() {
134
+ return <AgenticPanel defaultTab="copilot" voiceLang="en-IN" />;
135
+ }
136
+ ```
137
+
138
+ Tabs: **Copilot**, **QA report**, **Forms**, **Design**, **Ask page**, **Voice**. The panel marks itself with `data-yuktai-panel`, so it never audits its own UI.
139
+
140
+ ### Ask your grid
141
+
142
+ ```tsx
143
+ "use client";
144
+ import { YuktaiGrid, useAgenticGrid, AgenticGridBar } from "@yuktishaalaa/yuktai";
145
+
146
+ const columns = [
147
+ { key: "name", label: "Customer" },
148
+ { key: "status", label: "Status" },
149
+ { key: "region", label: "Region" },
150
+ { key: "balance", label: "Balance", type: "number" as const },
151
+ { key: "dueDate", label: "Due date", type: "date" as const },
152
+ ];
153
+
154
+ export default function Customers({ rows }: { rows: Customer[] }) {
155
+ const grid = useAgenticGrid({ data: rows, columns, rowKey: "id" });
156
+
157
+ return (
158
+ <>
159
+ <AgenticGridBar
160
+ grid={grid}
161
+ examples={[
162
+ "overdue and over ₹10,000",
163
+ "anything unusual?",
164
+ "total balance by region",
165
+ "show overdue, then sort by balance desc, then summarize what changed",
166
+ ]}
167
+ />
168
+ <YuktaiGrid
169
+ data={grid.gridData}
170
+ columns={columns}
171
+ rowKey="id"
172
+ highlightIds={grid.highlightIds}
173
+ autoScrollToHighlight
174
+ />
175
+ </>
176
+ );
177
+ }
178
+ ```
179
+
180
+ `grid.ask(text)` picks the right tool for the question:
181
+
182
+ | Question type | Example | Handled by |
183
+ |---|---|---|
184
+ | Filters and lookups | "customer starting with A and balance between 1k and 9k" | Smart grid query |
185
+ | Unusual data | "anything unusual?" | Outliers and duplicate rows |
186
+ | Group and period questions | "which region had the highest drop in conversion this week?" | BI copilot |
187
+ | Several steps | "show overdue, then highlight errors, then summarise" | Task runner, with a before/after report |
188
+
189
+ Amounts like `₹10,000`, `10k`, `1.5 lakh` and `2 crore` are understood.
190
+
191
+ ### Use the functions directly
192
+
193
+ ```ts
194
+ import { runQaAudit, auditToMarkdown, askInsight, runGridQuery } from "@yuktishaalaa/yuktai";
195
+
196
+ // In the browser: accessibility QA report
197
+ const report = runQaAudit();
198
+ console.log(report.score, report.passed);
199
+ const md = auditToMarkdown(report); // attach to a ticket or PR
200
+
201
+ // Anywhere: data questions
202
+ askInsight("which region had the highest drop in conversion this week", rows, columns).answer;
203
+ runGridQuery("overdue and over 10k", { data: rows, columns }).ids;
204
+ ```
205
+
206
+ ### Plug in your own model (optional)
207
+
208
+ Everything works offline with rules and keyword search. To get model-written answers, pass a `generate` hook, for example Gemini Nano or your own API:
209
+
210
+ ```tsx
211
+ <AgenticPanel generate={async (question, context) => myModel(question, context)} />
212
+ ```
213
+
214
+ ### Honest limits
215
+
216
+ - Questions are understood with rules, not a language model, so unusual phrasing may need rewording. The parser returns `notes` explaining any assumption it made.
217
+ - The QA and design checks are automatic heuristics. They catch common problems but don't replace testing with real users and assistive technology.
218
+ - Smart grid queries, page answers and BI answers are in English today. Telugu and Hindi data questions are not parsed yet; use `customRules` with your own phrases for them.
219
+ - Voice accessibility commands understand English and Telugu, not yet Hindi or other languages.
220
+
221
+ ---
222
+
223
+ ## What's new in v4.6.4: YuktaiGrid Agentic AI + WebMCP
224
+
225
+ - Shared Grid Tools used by both the Agent and WebMCP
226
+ - Tools: search, count, columns, get row, highlight, select, open
227
+ - WebMCP registration through `document.modelContext`
228
+ - `useYuktaiGridAgent` hook for programmatic tool execution
229
+ - Embedded Grid AI Assistant inside YuktaiGrid
230
+ - English and Telugu AI UI, with English or Telugu voice input
231
+ - Working page-size switching (10 → 20 → 50 → 100)
232
+ - Seven inline SVG icons, no external icon dependency
233
+
234
+ **Architecture:** User → Agent / WebMCP → Grid Tools → YuktaiGrid → Data
235
+
236
+ ---
237
+
238
+ ## Works on every device
239
+
240
+ | Device | Browser | Core features | AI engine |
241
+ |---|---|---|---|
242
+ | 🖥 Desktop | Chrome 147+ (needed only for Gemini Nano) | ✅ All | Gemini Nano |
243
+ | 🖥 Desktop | Firefox / Edge / Safari | ✅ All | Transformers.js |
244
+ | 📱 Android | Chrome Mobile | ✅ All | Transformers.js |
245
+ | 📱 iOS | Safari Mobile | ✅ All | Transformers.js |
246
+ | 📲 PWA offline | All browsers | ✅ All | Offline after first load |
247
+
248
+ yuktai picks the best AI engine automatically. Users never need to know which one is running.
249
+
250
+ ---
251
+
252
+ ## Install
253
+
254
+ **Next.js 16 + React 19 (recommended)**
255
+
256
+ ```bash
257
+ npm install @yuktishaalaa/yuktai --legacy-peer-deps
258
+ ```
259
+
260
+ **Next.js 13, 14, 15**
261
+
262
+ ```bash
263
+ npm install @yuktishaalaa/yuktai
264
+ ```
265
+
266
+ **Yarn / pnpm**
267
+
268
+ ```bash
269
+ yarn add @yuktishaalaa/yuktai
270
+ pnpm add @yuktishaalaa/yuktai
271
+ ```
272
+
273
+ **Plain HTML (no install)**
274
+
275
+ ```html
276
+ <script src="https://cdn.jsdelivr.net/npm/@yuktishaalaa/yuktai@5.3.0/vanilla/index.min.js"></script>
277
+ ```
278
+
279
+ Requirements: Node.js 18+, npm 8+, Next.js 13+ (React builds only; the vanilla build needs only a browser).
280
+
281
+ ---
282
+
283
+ ## Quick start
284
+
285
+ ### Step 1: `next.config.js`
286
+
287
+ ```js
288
+ const nextConfig = {
289
+ transpilePackages: ["@yuktishaalaa/yuktai"],
290
+ async headers() {
291
+ return [
292
+ {
293
+ source: "/(.*)",
294
+ headers: [
295
+ // Needed for voice control and voice input
296
+ { key: "Permissions-Policy", value: "microphone=*, speaker=*" },
297
+ ],
298
+ },
299
+ ];
300
+ },
301
+ };
302
+
303
+ module.exports = nextConfig;
304
+ ```
305
+
306
+ ### Step 2: Client wrapper
307
+
308
+ ```tsx
309
+ // components/YuktaiClient.tsx
310
+ "use client";
311
+
312
+ import { useState, useEffect, type ReactNode } from "react";
313
+ import { YuktAIWrapper } from "@yuktishaalaa/yuktai";
314
+
315
+ export default function YuktaiClient({ children }: { children: ReactNode }) {
316
+ const [mounted, setMounted] = useState(false);
317
+ useEffect(() => setMounted(true), []);
318
+
319
+ if (!mounted) return <>{children}</>;
320
+
321
+ return (
322
+ <YuktAIWrapper position="left" showRag showAgent>
323
+ {children}
324
+ </YuktAIWrapper>
325
+ );
326
+ }
327
+ ```
328
+
329
+ ### Step 3: `app/layout.tsx`
330
+
331
+ ```tsx
332
+ import YuktaiClient from "@/components/YuktaiClient";
333
+
334
+ export default function RootLayout({ children }: { children: React.ReactNode }) {
335
+ return (
336
+ <html lang="en">
337
+ <body>
338
+ <YuktaiClient>
339
+ <main>{children}</main>
340
+ </YuktaiClient>
341
+ </body>
342
+ </html>
343
+ );
344
+ }
345
+ ```
346
+
347
+ That's it. Floating buttons appear on every page: ♿ opens the accessibility panel, 💬 opens "Ask this page", and the agent button opens the AI agent.
348
+
349
+ To add the v5.2 agentic tools, place `<AgenticPanel />` or `useAgenticGrid` in any client component (see [What's new in v5.2](#whats-new-in-v52-agentic-ai-toolkit)).
350
+
351
+ ### Wrapper props
352
+
353
+ | Prop | Type | Default | Description |
354
+ |---|---|---|---|
355
+ | `position` | `"left" \| "right"` | `"left"` | Which side the buttons appear on |
356
+ | `showRag` | `boolean` | `false` | Show the 💬 Ask-this-page button |
357
+ | `showAgent` | `boolean` | `false` | Show the AI agent button |
358
+ | `config` | `Partial<A11yConfig>` | `undefined` | Accessibility config overrides |
359
+ | `children` | `ReactNode` | required | Your app content |
360
+
361
+ ---
362
+
363
+ ## Module 1: Accessibility Engine
364
+
365
+ Scans every element and injects missing accessibility attributes automatically. Covers headings, images, forms, tables, lists, landmarks, and ARIA widgets. Watches for new DOM elements with `MutationObserver`.
366
+
367
+ **Features**
368
+
369
+ - WCAG 2.2 auto-fix: ARIA, roles, tabindex, scope, autocomplete, alt text
370
+ - Speak on focus using browser SpeechSynthesis
371
+ - Voice control using the SpeechRecognition API
372
+ - Visual alerts for deaf and hard-of-hearing users
373
+ - High contrast, dark mode, reduce motion, large targets (44×44)
374
+ - Colour-blind modes: Deuteranopia, Protanopia, Tritanopia, Greyscale
375
+ - Dyslexia font: Atkinson Hyperlegible
376
+ - Local font picker and font scaling from 80% to 130%
377
+ - Audit badge with a WCAG score from 0 to 100 (localhost only)
378
+ - Skip links, focus trap, saved preferences, reset
379
+
380
+ **Direct API**
381
+
382
+ ```ts
383
+ import { wcagPlugin, type A11yConfig } from "@yuktishaalaa/yuktai";
384
+
385
+ const config: A11yConfig = {
386
+ enabled: true,
387
+ highContrast: false,
388
+ darkMode: false,
389
+ reduceMotion: false,
390
+ largeTargets: false,
391
+ speechEnabled: false,
392
+ colorBlindMode: "none", // none | deuteranopia | protanopia | tritanopia | achromatopsia
393
+ autoFix: true,
394
+ showPreferencePanel: true,
395
+ showSkipLinks: true,
396
+ showAuditBadge: false, // dev only (localhost)
397
+ fontSizeMultiplier: 1,
398
+ timeoutWarning: 0, // seconds, 0 = off
399
+ };
400
+
401
+ const report = wcagPlugin.applyFixes(config);
402
+ console.log(report.fixed); // number of fixes applied
403
+ console.log(report.score); // 0–100
404
+ ```
405
+
406
+ ### WCAG coverage
407
+
408
+ | Standard | Criteria | Examples |
409
+ |---|---|---|
410
+ | WCAG 2.0 | 19 | Alt text, roles, labels, tables, landmarks, focus |
411
+ | WCAG 2.1 | 7 | Touch targets, reflow, motion, orientation |
412
+ | WCAG 2.2 | 3 | Focus appearance, target size, timeout warning |
413
+ | Beyond WCAG | Extras | Speech, visual alerts, colour-blind modes, dyslexia font, audit score |
414
+
415
+ ---
416
+
417
+ ## Module 2: YuktaiGrid ⭐
418
+
419
+ An accessible data grid for Next.js, with an embedded AI assistant, agent tools, and WebMCP support.
420
+
421
+ ### Basic usage
422
+
423
+ ```tsx
424
+ "use client";
425
+
426
+ import { YuktaiGrid } from "@yuktishaalaa/yuktai";
427
+
428
+ const data = [
429
+ { id: 1, name: "Sandeep", role: "Developer", salary: 85000 },
430
+ { id: 2, name: "Priya", role: "Designer", salary: 90000 },
431
+ ];
432
+
433
+ export default function EmployeesPage() {
434
+ return (
435
+ <YuktaiGrid
436
+ data={data}
437
+ rowKey="id"
438
+ columns={[
439
+ { key: "name", label: "Name", sortable: true },
440
+ { key: "role", label: "Role" },
441
+ { key: "salary", label: "Salary", type: "number", align: "right" },
442
+ ]}
443
+ theme="default" // default | high-contrast | dark | color-blind | dyslexia
444
+ locale="en-US" // en-US | te-IN
445
+ view="auto" // auto | table | card
446
+ search
447
+ ai
448
+ pagination={{
449
+ pageSize: 20,
450
+ showSizeChanger: true,
451
+ sizeOptions: [10, 20, 50, 100],
452
+ }}
453
+ />
454
+ );
455
+ }
456
+ ```
457
+
458
+ ### Grid features
459
+
460
+ - Real-time search, column sorting, client-side pagination with page-size switching
461
+ - Mobile card view below a configurable breakpoint
462
+ - Loading and empty states
463
+ - 5 WCAG themes
464
+ - Row selection, custom cell render, `rowKey`
465
+ - Row highlighting with optional auto-scroll
466
+ - Keyboard navigation, ARIA grid semantics, 44×44 targets
467
+ - English and Telugu UI
468
+ - Embedded Grid AI Assistant with voice and chat
469
+ - **New in v5.2:** compound natural-language questions, anomaly detection and BI answers through `useAgenticGrid`
470
+
471
+ ### Grid AI Assistant
472
+
473
+ Runs embedded in the grid or as a standalone component. Intent parsing runs locally and supports search, sort, count, highest, lowest, average, total, and row lookup.
474
+
475
+ ```tsx
476
+ <YuktaiGridAI
477
+ data={data}
478
+ columns={columns}
479
+ onSearch={handleSearch}
480
+ onSort={handleSort}
481
+ language="te-IN" // AI UI and responses: en-US | te-IN
482
+ inputLanguage="te-IN" // voice input: en-IN, en-US or any of the 22 Indian languages
483
+ embedded
484
+ />
485
+ ```
486
+
487
+ Voice recognition depends on browser Web Speech API support.
488
+
489
+ ### Agent tools
490
+
491
+ Generic, reusable grid operations shared by the Agent and WebMCP:
492
+
493
+ ```ts
494
+ import {
495
+ searchGrid,
496
+ countGrid,
497
+ getColumns,
498
+ getRow,
499
+ highlightRows,
500
+ selectRow,
501
+ openRow,
502
+ } from "@yuktishaalaa/yuktai";
503
+ ```
504
+
505
+ Run tools programmatically:
506
+
507
+ ```tsx
508
+ import { useYuktaiGridAgent, type GridAgentTool } from "@yuktishaalaa/yuktai";
509
+
510
+ const tools: GridAgentTool[] = [
511
+ {
512
+ name: "search",
513
+ description: "Search grid rows by a text query",
514
+ execute: async ({ query }) => searchGrid(data, query),
515
+ },
516
+ ];
517
+
518
+ const { executeTool, loading } = useYuktaiGridAgent({ tools });
519
+ ```
520
+
521
+ **Design principle:** keep generic tools in the package and put app-specific rules in your app.
522
+
523
+ ```text
524
+ Generic YuktAI tools + Your domain rules = Your application agent
525
+ ```
526
+
527
+ ### WebMCP
528
+
529
+ Exposes grid tools to browser AI agents through `document.modelContext`, so agents call real operations instead of guessing from the DOM. Registration is invisible in the UI.
530
+
531
+ ```tsx
532
+ <YuktaiGrid
533
+ data={rows}
534
+ columns={columns}
535
+ ai
536
+ webmcp
537
+ toolName="my_grid"
538
+ toolDescriptions={TOOL_DESCRIPTIONS}
539
+ onWebMCPStatusChange={setStatus} // unsupported | registering | ready | partial | error
540
+ />
541
+ ```
542
+
543
+ Or standalone:
544
+
545
+ ```tsx
546
+ <YuktaiGridWebMCP data={data} columns={columns} />
547
+ ```
548
+
549
+ WebMCP is not available in every browser, so always handle the `unsupported` status gracefully.
550
+
551
+ ### Large datasets (100K+ rows)
552
+
553
+ Client-side pagination handles a few thousand rows well. For anything larger, use server-side pagination and disable the grid's built-in search and pagination.
554
+
555
+ `src/app/api/employees/route.ts`:
556
+
557
+ ```ts
558
+ import { NextRequest, NextResponse } from "next/server";
559
+
560
+ let cachedData: any[] | null = null;
561
+ let cacheTime = 0;
562
+ const TTL_MS = 60_000;
563
+
564
+ async function fetchAll(): Promise<any[]> {
565
+ const now = Date.now();
566
+ if (cachedData && now - cacheTime < TTL_MS) return cachedData;
567
+ const res = await fetch("https://your-api.com/employees", { cache: "no-store" });
568
+ const json = await res.json();
569
+ cachedData = Array.isArray(json) ? json : json.employees ?? json.data ?? [];
570
+ cacheTime = now;
571
+ return cachedData;
572
+ }
573
+
574
+ export async function GET(req: NextRequest) {
575
+ const p = req.nextUrl.searchParams;
576
+ const page = Math.max(1, parseInt(p.get("page") || "1"));
577
+ const pageSize = Math.max(1, parseInt(p.get("pageSize") || "5000"));
578
+ const search = (p.get("search") || "").toLowerCase().trim();
579
+
580
+ const all = await fetchAll();
581
+ const filtered = search
582
+ ? all.filter((r) => Object.values(r).some((v) => String(v).toLowerCase().includes(search)))
583
+ : all;
584
+
585
+ const total = filtered.length;
586
+ const rows = filtered.slice((page - 1) * pageSize, page * pageSize);
587
+
588
+ return NextResponse.json({
589
+ rows,
590
+ pagination: { page, pageSize, totalRows: total, totalPages: Math.ceil(total / pageSize) },
591
+ });
592
+ }
593
+ ```
594
+
595
+ Page:
596
+
597
+ ```tsx
598
+ const [apiResp, setApiResp] = useState<any>(null);
599
+ const [currentPage, setPage] = useState(1);
600
+
601
+ useEffect(() => {
602
+ fetch(`/api/employees?page=${currentPage}&pageSize=5000`)
603
+ .then((r) => r.json())
604
+ .then(setApiResp);
605
+ }, [currentPage]);
606
+
607
+ <YuktaiGrid
608
+ data={apiResp?.rows ?? []}
609
+ columns={columns}
610
+ search={false} // handled server-side
611
+ pagination={false} // handled server-side
612
+ loading={!apiResp}
613
+ />;
614
+ ```
615
+
616
+ Render your own pagination bar from `apiResp.pagination`. The browser only ever holds one page in memory.
617
+
618
+ ---
619
+
620
+ ## Showcase: Ratnalabala (Telugu poetry)
621
+
622
+ [Ratnalabala](https://ratnalabala.vercel.app/poems?view=grid) shows that an agentic grid is more than a chatbot next to a table. Users type or speak in Telugu, and the grid acts.
623
+
624
+ | User says | Agent action |
625
+ |---|---|
626
+ | `ఎన్ని పద్యాలు` (how many poems) | `count` → "మొత్తం 36 పద్యాలు ఉన్నాయి." |
627
+ | `గర్వం తెరువు` (open "Garvam") | `open` |
628
+ | `"బుద్ధి" ఉన్న పద్యాలు` (poems with "buddhi") | `search` + highlight |
629
+ | `అక్షర క్రమంలో` (alphabetical) | `sort(title, asc)` |
630
+ | `ఈరోజు పద్యం` (poem of the day) | custom rule + highlight |
631
+
632
+ **Stack:** Next.js · React + TypeScript · MUI · YuktAI Grid · FastAPI (Python) · PostgreSQL on Neon · Vercel · Web Speech API · WebMCP
633
+
634
+ ```text
635
+ PostgreSQL → FastAPI → Next.js API proxy → Ratnalabala UI → YuktAI Grid
636
+ ├── Agent
637
+ └── WebMCP
638
+ ```
639
+
640
+ ```tsx
641
+ <YuktaiGrid<PoemRow>
642
+ data={rows}
643
+ columns={COLUMNS}
644
+ rowKey="id"
645
+ locale="te-IN"
646
+ inputLanguage="te-IN"
647
+ customRules={POEM_RULES}
648
+ search
649
+ highlightIds={highlightIds}
650
+ autoScrollToHighlight
651
+ onRowClick={(row) => onOpenPoem(row.title)}
652
+ ai
653
+ webmcp
654
+ toolName="ratnalabala_poems"
655
+ toolDescriptions={TOOL_DESCRIPTIONS}
656
+ onWebMCPStatusChange={setWebmcp}
657
+ />
658
+ ```
659
+
660
+ ---
661
+
662
+ ## Module 3: In-Tab RAG (Ask This Page)
663
+
664
+ Retrieval-Augmented Generation running entirely in the browser. It extracts text chunks from the current page, embeds them, finds the best match for the question, and answers. Offline, no API key.
665
+
666
+ | Device | Engine | How it works |
667
+ |---|---|---|
668
+ | Desktop Chrome with Gemini Nano | `window.LanguageModel` | Page text sent as context, instant answer |
669
+ | Mobile and all other browsers | Transformers.js | Embeddings + `flan-t5-small`, q4 quantized |
670
+
671
+ - About 30 MB one-time model download on mobile, cached in IndexedDB
672
+ - Works fully offline after first load
673
+ - All processing on device, no data sent anywhere
674
+
675
+ **What I learned:** Transformers.js kept crashing on iOS Safari with out-of-memory errors. Quantization (same model, 75% smaller) fixed it. DistilBERT gave short, useless spans; `flan-t5-small` gives real sentences.
676
+
677
+ **New in v5.2:** `createContextIndex` also searches grid rows (including rows on other pages of the grid) and your own documents, with keyword search that handles Telugu and Hindi script correctly.
678
+
679
+ ---
680
+
681
+ ## Module 4: Autonomous AI Agent
682
+
683
+ Type a goal in plain English. yuktai reads the page, finds the right elements, plans the steps, and highlights what to do.
684
+
685
+ - 9 DOM traversal strategies and 11 form-label strategies
686
+ - Works on static HTML, React, WordPress, and old government portals
687
+ - Gemini Nano planning on desktop, Transformers.js on mobile, rule-based fallback
688
+ - Highlights target fields, scrolls to sections, shows a numbered plan, handles iframes
689
+
690
+ Every label strategy came from a real website: old portals put labels in the previous table cell, modern apps use `aria-label`, static pages use `placeholder`.
691
+
692
+ ---
693
+
694
+ ## Module 5: Vibe Coder
695
+
696
+ Type a business requirement and download a full Next.js 16 project as a ZIP.
697
+
698
+ - Detects website type (12), pages (21), features (14), theme colour (8), and site name
699
+ - Preview before generating
700
+ - TypeScript, Tailwind + CSS Modules, mobile responsive
701
+ - Navbar, Footer, Home, About, Contact, Services, Pricing, Auth, Dashboard
702
+ - `npm run dev` works immediately
703
+
704
+ No AI writes the code. It's pure template engineering.
705
+
706
+ ---
707
+
708
+ ## Module 6: Agentic AI Toolkit
709
+
710
+ The ten v5.2 features, described in detail in [What's new in v5.2](#whats-new-in-v52-agentic-ai-toolkit).
711
+
712
+ - **Copilot and QA:** 15 WCAG checks, plain-English explanations, safe fixes with undo, downloadable reports
713
+ - **Forms and design review:** labels, autocomplete, error messages, focus states, hierarchy, clutter, senior-friendly tips
714
+ - **Data:** compound grid questions, outliers and duplicates, group-by, period comparison, trends
715
+ - **Automation:** multi-step instructions with a before/after summary
716
+ - **Voice:** accessibility settings and grid row navigation by voice, in English and Telugu
717
+ - **React:** `AgenticPanel`, `AgenticGridBar`, `useAgenticGrid`
718
+
719
+ ---
720
+
721
+ ## Gemini Nano setup (desktop Chrome, one time)
722
+
723
+ Needed only for Gemini Nano features on desktop Chrome. Mobile and other browsers use Transformers.js automatically.
724
+
725
+ 1. Open `chrome://flags` and enable: Prompt API for Gemini Nano, Summarization API, Writer API, Rewriter API, Translation API.
726
+ 2. Click **Relaunch**.
727
+ 3. Open `chrome://components`, find **Optimization Guide On Device Model**, and click **Check for update**.
728
+ 4. Refresh your page. AI features unlock automatically.
729
+
730
+ **Gemini Nano features:** plain-English rewriting, 3-sentence page summary, AI-generated ARIA labels, page translation in 18 languages.
731
+
732
+ > Chrome 147 moved the APIs from `window.ai` to standalone globals such as `window.LanguageModel`. yuktai supports both.
733
+
734
+ ---
735
+
736
+ ## Icons
737
+
738
+ 41 yuktai SVG icons for Next.js and React, with no icon library needed. They are the same icons the vanilla build draws with `yuktai.icon()`.
739
+
740
+ ### Next.js setup
741
+
742
+ ```bash
743
+ npm install @yuktishaalaa/yuktai@5.3.1
744
+ ```
745
+
746
+ Import from **`@yuktishaalaa/yuktai/icons`**. This entry has no hooks and no browser code, so the icons work in **Server Components** (no `"use client"` needed), in Client Components, and in the Pages Router.
747
+
748
+ ```tsx
749
+ // app/page.tsx — a Server Component
750
+ import { MicIcon, SearchIcon, AccessibilityIcon, YuktaiIcon } from "@yuktishaalaa/yuktai/icons"
751
+
752
+ export default function Page() {
753
+ return (
754
+ <>
755
+ {/* decorative: the button text or aria-label names it */}
756
+ <button type="button" aria-label="Start voice input"><MicIcon /></button>
757
+
758
+ {/* meaningful on its own: give it a label */}
759
+ <SearchIcon size={24} label="Search" />
760
+
761
+ {/* filled variant: blue square, glyph colour picked for contrast */}
762
+ <AccessibilityIcon variant="filled" color="#005A9C" size={32} label="Accessibility settings" />
763
+
764
+ {/* any icon by name */}
765
+ <YuktaiIcon name="wand" />
766
+ </>
767
+ )
768
+ }
769
+ ```
770
+
771
+ Importing from the main entry (`@yuktishaalaa/yuktai`) still works, but the `/icons` entry is smaller (about 14 KB) and safe on the server.
772
+
773
+ ### Props
774
+
775
+ | Prop | Default | What it does |
776
+ |---|---|---|
777
+ | `size` | `20` | Width and height in pixels |
778
+ | `color` | `currentColor` | Outline: the line colour. Filled: the background colour |
779
+ | `variant` | `"outline"` | `"outline"` or `"filled"` |
780
+ | `glyphColor` | auto | Filled only. White or near-black, whichever has more contrast |
781
+ | `shape` | `"rounded"` | Filled only. `"rounded"` square or `"circle"` |
782
+ | `strokeWidth` | `2.5` | Line thickness |
783
+ | `label` | none | Adds `role="img"` and `aria-label`. Without it the icon is decorative (`aria-hidden`) |
784
+
785
+ Any other SVG attribute (`className`, `style`, `id`) is passed through.
786
+
787
+ ### All 41 icons
788
+
789
+ | Component | `name` | Component | `name` |
790
+ |---|---|---|---|
791
+ | `AccessibilityIcon` | accessibility | `CopyIcon` | copy |
792
+ | `ContrastIcon` | contrast | `FilterIcon` | filter |
793
+ | `MoonIcon` | moon | `CheckIcon` | check |
794
+ | `MotionIcon` | motion | `ChevronLeftIcon` | left |
795
+ | `ReadingIcon` | reading | `ChevronRightIcon` | right |
796
+ | `TargetIcon` | target | `FirstIcon` | first |
797
+ | `SpeakerIcon` | speaker | `LastIcon` | last |
798
+ | `PaletteIcon` | palette | `SparkIcon` | spark |
799
+ | `SkipIcon` | skip | `AlertIcon` | alert |
800
+ | `CloseIcon` | close | `InfoIcon` | info |
801
+ | `PlusIcon` | plus | `FormIcon` | form |
802
+ | `MinusIcon` | minus | `EyeIcon` | eye |
803
+ | `ResetIcon` | reset | `LayoutIcon` | layout |
804
+ | `SearchIcon` | search | `WandIcon` | wand |
805
+ | `SortIcon` | sort | `UndoIcon` | undo |
806
+ | `SortUpIcon` | sortUp | `ToolsIcon` | tools |
807
+ | `SortDownIcon` | sortDown | `PlugIcon` | plug |
808
+ | `ChevronsIcon` | chevrons | `GridIcon` | grid |
809
+ | `CardsIcon` | cards | `ChatIcon` | chat |
810
+ | `MicIcon` | mic | `StopIcon` | stop |
811
+ | `DownloadIcon` | download | | |
812
+
813
+ `ICON_NAMES` lists every name, and the `IconName` type checks it, so `<YuktaiIcon name="mike" />` is a type error.
814
+
815
+ ### WCAG built in
816
+
817
+ - **1.1.1 Non-text content:** decorative by default; pass `label` when the icon carries meaning on its own.
818
+ - **1.4.11 Non-text contrast:** the filled variant picks a glyph colour with at least 3:1 contrast, and warns in the console if a custom `glyphColor` falls below that. For outline icons, choose a `color` with 3:1 against your background, for example W3C blue `#005A9C` on white (7.1:1).
819
+ - **Forced colours (Windows High Contrast):** outline icons follow the text colour; filled icons switch to system colours.
820
+ - **2.5.8 Target size:** an icon is not a target. Put it inside a `<button>` of at least 24×24 px (44×44 is better on touch screens).
821
+
822
+ Helpers: `iconContrast(fg, bg)` returns the contrast ratio, `pickGlyphColor(bg)` returns the best glyph colour, and `iconSvg(name, options)` returns SVG markup as a string (for emails or `dangerouslySetInnerHTML`).
823
+
824
+ ### Plain HTML
825
+
826
+ ```html
827
+ <span id="mic"></span>
828
+ <script src="https://cdn.jsdelivr.net/npm/@yuktishaalaa/yuktai@5/vanilla/index.min.js"></script>
829
+ <script>
830
+ document.getElementById("mic").innerHTML = yuktai.icon("mic", { size: 24, label: "Voice input" })
831
+ </script>
832
+ ```
833
+
834
+ ---
835
+
836
+ ## Design principles
837
+
838
+ - **Zero API keys, zero cost, zero telemetry.** Everything runs in the browser.
839
+ - **Zero injected ids.** Injected nodes are tracked by JavaScript references, so they never collide with your app's ids.
840
+ - **Zero framework lock-in.** `core/renderer.ts` has no framework imports, and the vanilla build runs on any HTML page.
841
+ - **Never reads its own UI.** Panels are marked with `data-yuktai-panel`.
842
+ - **SSR safe.** No `window` errors on the server.
843
+ - **Every automatic fix can be undone.** The v5.2 copilot records each change it makes.
844
+ - **Honest limits.** Client-side pagination is for a few thousand rows; use server-side beyond that.
845
+
846
+ ---
847
+
848
+ ## Compatibility
849
+
850
+ | | Supported |
851
+ |---|---|
852
+ | Next.js | 13, 14, 15, 16 |
853
+ | Plain HTML | Any page, one script tag (vanilla build) |
854
+ | React | 17, 18, 19 (19 needs `--legacy-peer-deps`) |
855
+ | Node.js | 18+ |
856
+ | Browsers | Chrome 90+, Firefox 90+, Safari 15+, Edge 90+, Samsung Internet 14+ |
857
+
858
+ ---
859
+
860
+ ## Roadmap
861
+
862
+ ### Completed
863
+
864
+ | Version | What shipped |
865
+ |---|---|
866
+ | **v5.3.1** | **41 icons for Next.js and React** from the new `@yuktishaalaa/yuktai/icons` entry, safe in Server Components; outline and filled variants with WCAG 1.4.11 contrast checks; same icons in the vanilla build |
867
+ | | Yuktisárathi brand on the demo: navy and gold logo, W3C blue `#005A9C` for links and controls |
868
+ | **v5.3** | **Vanilla JS build:** every module for plain HTML with one script tag, built from the same source as the npm package |
869
+ | | Vanilla grid: themes, card view, Telugu UI, ARIA grid keyboard navigation, question bar, assistant with custom rules and voice, WebMCP |
870
+ | | Vanilla page tools panel and floating accessibility button |
871
+ | | Live demo on GitHub Pages as an installable, offline PWA with the XERJ contributor badge |
872
+ | | Accessibility engine fixes: real labels are no longer overridden, hidden buttons are named correctly, nested landmarks, honest fix count, teal palette at 4.5:1 contrast |
873
+ | | CDN builds on jsDelivr and unpkg; 37 end-to-end browser checks with axe-core |
874
+ | **v5.2** | **Agentic AI Toolkit:** accessibility copilot, QA tester (15 WCAG checks), form review, design review, page understanding, page and data RAG |
875
+ | | Smart grid queries (lakh, crore, 10k), anomaly finder, BI copilot, multi-step task runner, voice accessibility commands in English and Telugu |
876
+ | | React: `AgenticPanel`, `AgenticGridBar`, `useAgenticGrid` |
877
+ | **v4.6.4** | YuktaiGrid Agentic AI + WebMCP, embedded Grid AI Assistant, English and Telugu UI, page-size switching, 7 inline SVG icons |
878
+ | **v4.x** | Accessibility engine, In-tab RAG (Gemini Nano + Transformers.js), autonomous AI agent, Vibe Coder |
879
+
880
+ ### Next (v5.4)
881
+
882
+ - Expose the v5.2 agentic tools (QA, forms, design, page Q&A) to browser AI agents through WebMCP
883
+ - Telugu and Hindi data questions in the smart grid parser, without needing custom rules
884
+ - Hindi voice accessibility commands
885
+ - More grid agent tools: group, export and compare
886
+ - Server-side paging helpers for the vanilla grid (100K+ rows)
887
+
888
+ ### Later
889
+
890
+ - Multilingual RAG: Telugu, Hindi, Tamil, Bengali
891
+ - RTL layout support (Urdu, Sindhi, Kashmiri)
892
+ - Richer browser-native AI as Chrome's built-in APIs mature
893
+ - Multimodal grid experiences (images and charts in rows)
894
+ - A web component build (`<yuktai-grid>`) for any framework
895
+
896
+ ---
897
+
898
+ ## Contributing
899
+
900
+ Issues and pull requests are welcome at [github.com/sandeepmiriyala03/yuktai](https://github.com/sandeepmiriyala03/yuktai). For security issues, see [SECURITY.md](./SECURITY.md).
901
+
902
+ ---
903
+
904
+ ## Links
905
+
906
+ - npm: [@yuktishaalaa/yuktai](https://www.npmjs.com/package/@yuktishaalaa/yuktai)
907
+ - GitHub: [sandeepmiriyala03/yuktai](https://github.com/sandeepmiriyala03/yuktai)
908
+ - Demo: [aksharatantra.miriyala.in/staffdirectory](https://aksharatantra.miriyala.in/staffdirectory)
909
+ - Showcase: [ratnalabala.vercel.app](https://ratnalabala.vercel.app/poems?view=grid)
910
+ - Vanilla JS demo (PWA): [sandeepmiriyala03.github.io/yuktai/vanilla](https://sandeepmiriyala03.github.io/yuktai/vanilla/)
911
+ - Vanilla JS (CDN): [cdn.jsdelivr.net/npm/@yuktishaalaa/yuktai/vanilla/index.min.js](https://cdn.jsdelivr.net/npm/@yuktishaalaa/yuktai/vanilla/index.min.js)
912
+ - XERJ Corpus Hub: [hub.xerj.org](https://hub.xerj.org)
913
+ - XERJ contributor profile: [hub.xerj.org/contributors/sandeepmiriyala03](https://hub.xerj.org/contributors/sandeepmiriyala03)
914
+
915
+ ---
916
+
917
+ ## License
918
+
919
+ GPL-3.0 © Sandeep Miriyala, [Yuktishaalaa AI Lab](https://github.com/sandeepmiriyala03)
920
+
921
+ Built in free time. AI coding assistants (Claude, GPT and Gemini) helped me learn, and helped write and test parts of the code. Every design decision, review and release is mine.
922
+
923
+ **Free forever. Open source. Built for every user.**