From 1fc81ddb04d3ff5ceb7690be4f5666dcafca87df Mon Sep 17 00:00:00 2001 From: praboth charith - GBS - CLI Date: Wed, 28 Oct 2026 10:16:07 +0530 Subject: [PATCH] style: format documentation and test files according to prettier rules --- docs/API.md | 4 +-- docs/PERFORMANCE_PROFILING.md | 43 +++++++++++++++---------- docs/PUBLISH_REHEARSAL.md | 22 +++++++------ docs/RELEASE_PROPOSAL_M5.md | 38 +++++++++++----------- docs/ROADMAP.md | 60 +++++++++++++++++------------------ docs/SECURITY_AUDIT.md | 24 +++++++++----- docs/SUPPORTED_MATRIX.md | 43 ++++++++++++++++--------- examples/basic-usage/main.tsx | 6 ++-- examples/index.html | 6 ++-- tests/browser/widget.spec.ts | 1 - 10 files changed, 140 insertions(+), 107 deletions(-) diff --git a/docs/API.md b/docs/API.md index 81866a3..af2cd2c 100644 --- a/docs/API.md +++ b/docs/API.md @@ -28,8 +28,8 @@ All exports are named from `accessibility-plugin-react`. JavaScript consumers re | DictionaryController | Optional `className?: string`, `label?: string`, `description?: string`, `provider?: DictionaryProvider | null`, `defaultOpen?: boolean`, `initialTerm?: string`. Accessible dictionary lookup dialog with zero network requests by default, local glossaries, and sanitization. See docs/DICTIONARY.md. | | VoiceNavigationController | Optional `className?: string`, `label?: string`, `description?: string`. Opt-in research prototype controller enabling browser-native speech commands with inactivity watchdog and keyboard fallback buttons. See docs/VOICE_NAVIGATION.md. | | TranslationController | Optional `className?: string`, `label?: string`, `description?: string`, `provider?: TranslationAdapter`, `defaultTargetLanguage?: string`. Host-content translation adapter prototype with explicit consent, privacy boundaries, sensitive element exclusion, and DOM restoration. See docs/TRANSLATION.md. | -| SmartContrastController | Optional `className?: string`, `label?: string`, `description?: string`, `options?: SmartContrastOptions`. Measured smart contrast research prototype with relative luminance, alpha compositing, live statistics, and non-destructive restoration. See docs/SMART_CONTRAST.md. | -| DiagnosticsHarness | Optional `config?: DiagnosticsConfig`, `visible?: boolean`, `className?: string`. Development-only integration diagnostics harness inspecting containing-block traps, CSP, host CSS, and accessibility landmarks. See docs/DIAGNOSTICS.md. | +| SmartContrastController | Optional `className?: string`, `label?: string`, `description?: string`, `options?: SmartContrastOptions`. Measured smart contrast research prototype with relative luminance, alpha compositing, live statistics, and non-destructive restoration. See docs/SMART_CONTRAST.md. | +| DiagnosticsHarness | Optional `config?: DiagnosticsConfig`, `visible?: boolean`, `className?: string`. Development-only integration diagnostics harness inspecting containing-block traps, CSP, host CSS, and accessibility landmarks. See docs/DIAGNOSTICS.md. | | All other controllers in FEATURES.md | Pick/omit in JSX. For custom labels or behavior, compose a control with useAccessibility or the modular control primitives. | Use one button/list pair per provider and one provider per document. UI IDs use React `useId`; do not target the old fixed `arap-panel` ID. Plugin children can include ordinary app content, but mounting the widget as a sibling makes intent clearer. Persistence configuration is fixed at mount; use `` when switching storage identity. diff --git a/docs/PERFORMANCE_PROFILING.md b/docs/PERFORMANCE_PROFILING.md index 6de9e63..ce82ec7 100644 --- a/docs/PERFORMANCE_PROFILING.md +++ b/docs/PERFORMANCE_PROFILING.md @@ -9,28 +9,31 @@ This document records empirical performance profiling, bundle size analysis, lis ## 1. Bundle and chunk size analysis ### Library Distribution Assets (`dist/`) + Built with `tsup` targeting ES2020: -| Asset | Description | Raw Size | Gzip Size | Brotli Size | -| :--- | :--- | :--- | :--- | :--- | -| `dist/index.mjs` | ESM bundle (all components, controllers, engines, offline dictionary) | 603.27 KB | 111.48 KB | 86.04 KB | -| `dist/index.js` | CommonJS bundle | 636.96 KB | 114.52 KB | 87.33 KB | -| `dist/style.css` | Scoped CSS stylesheet | 71.31 KB | 11.31 KB | 9.57 KB | -| `dist/index.d.mts` | TypeScript ESM declarations | 83.58 KB | 22.07 KB | 18.48 KB | -| `dist/index.d.ts` | TypeScript CommonJS declarations | 83.58 KB | 22.07 KB | 18.48 KB | +| Asset | Description | Raw Size | Gzip Size | Brotli Size | +| :----------------- | :-------------------------------------------------------------------- | :-------- | :-------- | :---------- | +| `dist/index.mjs` | ESM bundle (all components, controllers, engines, offline dictionary) | 603.27 KB | 111.48 KB | 86.04 KB | +| `dist/index.js` | CommonJS bundle | 636.96 KB | 114.52 KB | 87.33 KB | +| `dist/style.css` | Scoped CSS stylesheet | 71.31 KB | 11.31 KB | 9.57 KB | +| `dist/index.d.mts` | TypeScript ESM declarations | 83.58 KB | 22.07 KB | 18.48 KB | +| `dist/index.d.ts` | TypeScript CommonJS declarations | 83.58 KB | 22.07 KB | 18.48 KB | ### Module Composition & Offline Guarantees + - **Offline Glossary & Dictionaries**: Contains built-in glossaries (English, Sinhala, Tamil) allowing instantaneous client-side definitions without external API latency, rate limits, or network tracking. - **Zero Runtime Dependencies**: The package relies exclusively on React and React DOM as peer dependencies. Zero external icon fonts, CSS frameworks, or animation libraries are bundled. ### Real Consumer Application Production Builds + Measured in clean consumer testbeds with minification and tree-shaking: -| Consumer Application | Framework / Bundler | Packed Archive Asset | Production Gzip Size | -| :--- | :--- | :--- | :--- | -| **React 18 Consumer** | React 18.3.1 + Vite 7 (Rollup) | Application bundle (React + React DOM + Plugin) | **127.36 KB** gzipped | -| **Next.js 16 App Router** | Next.js 16.2.10 (Webpack 5) | Page Route Chunks (`app/page.js`, `app/route-test/page.js`) | **1.85 KB** gzipped | -| **Next.js 16 App Router** | Next.js 16.2.10 (Webpack 5) | Shared Vendor Chunks | **59.37 KB – 79.42 KB** gzipped | +| Consumer Application | Framework / Bundler | Packed Archive Asset | Production Gzip Size | +| :------------------------ | :----------------------------- | :---------------------------------------------------------- | :------------------------------ | +| **React 18 Consumer** | React 18.3.1 + Vite 7 (Rollup) | Application bundle (React + React DOM + Plugin) | **127.36 KB** gzipped | +| **Next.js 16 App Router** | Next.js 16.2.10 (Webpack 5) | Page Route Chunks (`app/page.js`, `app/route-test/page.js`) | **1.85 KB** gzipped | +| **Next.js 16 App Router** | Next.js 16.2.10 (Webpack 5) | Shared Vendor Chunks | **59.37 KB – 79.42 KB** gzipped | --- @@ -39,6 +42,7 @@ Measured in clean consumer testbeds with minification and tree-shaking: When the accessibility widget is mounted in a host application with the panel closed (the standard idle state), its runtime footprint is strictly constrained: ### Event Listener Footprint (Closed State) + - **Window Listeners**: - `pagehide`: 1 handler attached to synchronously flush any debounced state to storage prior to navigation. - `resize`: 1 throttled listener for viewport boundary clamping during repositioning. @@ -51,7 +55,9 @@ When the accessibility widget is mounted in a host application with the panel cl - `0` persistent audio/microphone streams. ### Feature-Specific Listener Isolation + Listeners for features with dynamic tracking are registered **only while that specific feature is active**: + - **Reading Guide / Reading Mask**: Pointer tracking listeners (`pointermove`, `touchmove`, `scroll`) are attached only when either guide or mask is toggled ON, and are removed immediately upon toggle OFF or reset. - **Accessible Tooltips**: Global hover/focus listeners are active only when tooltips are enabled. - **Speech & Voice**: Recognition and synthesis listeners attach only during active listening or playback sessions, and disconnect immediately on stop, timeout, visibility change, or unmount. @@ -64,13 +70,14 @@ To verify that display preferences do not induce perceptible UI lag (jank) or bl ### Benchmark Results (Automated Vitest / JSDOM Suite) -| Operation | Scope | Target Budget | Measured Duration | Status | -| :--- | :--- | :--- | :--- | :--- | -| **Multi-Feature Apply** | 1,000 DOM elements (Text Scale, Line Height, Font Family, Contrast Mode, Hide Images) | < 3,000 ms (JSDOM non-JIT) | **~1,770 ms** | **PASS** | -| **Full Reset Teardown** | 1,000 DOM elements (Complete style restoration across all nodes) | < 1,500 ms (JSDOM non-JIT) | **~420 ms** | **PASS** | -| **Real Browser Main Thread** | Chrome 120+ / WebKit (Playwright runtime execution) | < 100 ms | **< 45 ms** | **PASS** | +| Operation | Scope | Target Budget | Measured Duration | Status | +| :--------------------------- | :------------------------------------------------------------------------------------ | :------------------------- | :---------------- | :------- | +| **Multi-Feature Apply** | 1,000 DOM elements (Text Scale, Line Height, Font Family, Contrast Mode, Hide Images) | < 3,000 ms (JSDOM non-JIT) | **~1,770 ms** | **PASS** | +| **Full Reset Teardown** | 1,000 DOM elements (Complete style restoration across all nodes) | < 1,500 ms (JSDOM non-JIT) | **~420 ms** | **PASS** | +| **Real Browser Main Thread** | Chrome 120+ / WebKit (Playwright runtime execution) | < 100 ms | **< 45 ms** | **PASS** | ### Style Application Efficiency + - Features modify inline styles using direct property assignment or scoped CSS class toggling rather than DOM tree rebuilds. - Protected elements (such as ``, `
`, form buttons, meaningful images, and CAPTCHAs) are identified via cached selector filters, avoiding redundant style computation.
 
@@ -79,12 +86,14 @@ To verify that display preferences do not induce perceptible UI lag (jank) or bl
 ## 4. 100 Mount/Unmount and toggle leak stress-testing
 
 ### Mount/Unmount Cycle Verification
+
 - Executed **100 consecutive mount and unmount cycles** of ``:
   - Verified `0` orphaned `.arap-root` or `.arap-panel` DOM nodes remaining in `document.body`.
   - Verified `0` residual `