accessibility-plugin-react 2.29.2 → 2.30.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/NOTICE +6 -3
- package/dist/fonts/Manrope-VariableFont_wght.ttf +0 -0
- package/dist/fonts/OFL.txt +93 -0
- package/dist/index.d.mts +53 -3
- package/dist/index.d.ts +53 -3
- package/dist/index.js +3756 -2703
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3715 -2663
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +1283 -92
- package/docs/API.md +5 -2
- package/docs/CSP.md +22 -10
- package/docs/DESIGN.md +1 -1
- package/docs/SECURITY_AUDIT.md +9 -9
- package/docs/TRANSLATION.md +20 -12
- package/package.json +3 -2
package/docs/API.md
CHANGED
|
@@ -11,6 +11,8 @@ All exports are named from `accessibility-plugin-react`. JavaScript consumers re
|
|
|
11
11
|
| AccessibilityList | `footer?: ReactNode` extra fixed actions; `children?: ReactNode` optional; `menuConfig?: MenuCustomizationConfig` optional; `title?: string` visible heading and region name, default Accessibility settings; `description?: string` default Adjust your reading experience; `closeLabel?: string` default Close; `statementUrl?: string`; `largeControls?: boolean`; `locale?: string`; `className?: string`; `style?: CSSProperties` |
|
|
12
12
|
| FeatureMenu | `config?: MenuCustomizationConfig`; `grouped?: boolean` default false; `className?: string`. Renders an ordered, validated, and optionally grouped accessibility menu with non-crashing diagnostics and stable rerenders. See docs/MENU_CUSTOMIZATION.md. |
|
|
13
13
|
| FeatureCard | `title: ReactNode` required; `children: ReactNode` required; `featureKey?: string`; `icon?: ReactNode`; `description?: ReactNode`; `statusBadge?: string`; `status?: 'idle' \| 'active' \| 'error' \| 'unavailable' \| 'permission-required'`; `errorMessage?: string`; `unavailableMessage?: string`; `permissionMessage?: string`; `onRequestPermission?: () => void`; `largeControls?: boolean` |
|
|
14
|
+
| FeatureGroup | `title: string` required; `id?: string`; `description?: string`; `badge?: string`; `collapsible?: boolean` default false; `defaultExpanded?: boolean` default true; `expanded?: boolean`; `onExpandedChange?: (expanded: boolean) => void`; `children: ReactNode` |
|
|
15
|
+
| ModalDialog | `isOpen: boolean` required; `onClose: () => void` required; `title: string` required; `subtitle?: string`; `icon?: ReactNode`; `closeLabel?: string`; `size?: 'md' \| 'lg' \| 'full'`; `trapFocus?: boolean`; `lockScroll?: boolean`; `footer?: ReactNode`; `children: ReactNode` |
|
|
14
16
|
| ToggleControl | `label: ReactNode` required; `checked: boolean` required; `onChange: (checked: boolean) => void` required; `disabled?: boolean`; `unavailable?: boolean`; `unavailableReason?: string`; `largeControls?: boolean` |
|
|
15
17
|
| ChoiceControl | `label: string` required; `value: T` required; `options?: ChoiceOption<T>[]`; `groups?: ChoiceGroup<T>[]`; `onChange: (value: T) => void` required; `disabled?: boolean`; `largeControls?: boolean` |
|
|
16
18
|
| StepperControl | `label: string` required; `value: number` required; `min: number`; `max: number`; `step: number`; `unit?: string` default '%'; `showSlider?: boolean`; `formatValue?: (val: number) => string`; `onChange: (value: number) => void` required; `disabled?: boolean`; `largeControls?: boolean` |
|
|
@@ -58,9 +60,9 @@ Definitions/defaults are immutable for the provider lifetime; the first register
|
|
|
58
60
|
|
|
59
61
|
`FeatureRegistration` is `FeatureOptions<unknown>` plus `defaultValue: unknown`. Use the generic hook instead of manually casting callbacks. Legacy `registerReset(key, fn)` / `unregisterReset(key)` remain available; callbacks run before global state is cleared. They are not the primary effect lifecycle API. Callback owners must unregister their callback on teardown.
|
|
60
62
|
|
|
61
|
-
Exported types: `AccessibilityPluginProps`, `AccessibilityButtonProps`, `AccessibilityListProps`, `AccessibilityState`, `AccessibilityContextValue`, `PluginPosition`, `WidgetPlacement`, `FeatureOptions<T>`, `FeatureRegistration`, `ToggleControlProps`, `ChoiceControlProps`, `ChoiceOption<T>`, `ChoiceGroup<T>`, `StepperControlProps`, `FeatureCardProps`, `FeatureStatus`, `SearchCountProps`, `EmptyStateProps`, `ErrorStateProps`, `ProfilePreviewCardProps`, `FontSizeControllerProps`, `TextScaleControllerProps`, `TextScaleStep`, `FontFamilyPreset`, `ContrastModeValue`, `ContrastPalette`, `LineHeightControllerProps`, `LetterSpacingControllerProps`, `WordSpacingControllerProps`, `ParagraphSpacingControllerProps`, `ScriptSpacingConstraints`, `SkipToMainLinkProps`, `HideImagesControllerProps`, `BigCursorControllerProps`, `ReadingMaskControllerProps`, `ReadingGuideControllerProps`, `TooltipsControllerProps`, `PageNavigatorControllerProps`, `HeadingItem`, `LandmarkItem`, `LinkItem`, `ProfilesControllerProps`, `ActiveProfileState`, `UseProfilesResult`, `AccessibilityPreferences`, `ContrastMode`, `CursorSizePreference`, `FontFamilyPreference`, `ProfileDefinition`, `ProfilePresetId`, `ReaderMode`, `SaturationPreference`, `StorageMode`, `TextAlignPreference`, `LocaleStrings`, `SupportedLocale`, `FeatureLocaleLabels`, `PresetsControllerProps`, `CustomPreset`, `PresetsExportV1`, `ImportResult`, `UsePresetsResult`, `ReadingModeControllerProps`, `ArticleContent`, `KeyboardShortcutsControllerProps`, `ShortcutDefinition`, `ValidationResult`, `ReadAloudControllerProps`, `ReadAloudOptions`, `ReadAloudState`, `SaturationControllerProps`, `GrayscaleControllerProps`, `DictionaryControllerProps`, `DictionaryEntry`, `DictionaryLookupResult`, `DictionaryProvider`, `FeatureMenuProps`, `FeatureMenuItemConfig`, `FeatureMenuGroupConfig`, `MenuCustomizationConfig`, `MenuValidationIssue`, `MenuValidationResult`, `NormalizedMenuConfig`, `NormalizedMenuItem`, `NormalizedMenuGroup`, `VoiceNavigationControllerProps`, `VoiceNavigationStatus`, `VoiceCommandId`, `VoiceCommandDefinition`, `VoiceNavigationResult`, `VoiceNavigationOptions`, `VoiceNavigationSession`, `VoiceExecutionContext`, `TranslationControllerProps`, `TranslationAdapter`, `TranslationRequest`, `TranslationResponse`, `TranslatedItem`, `DataRetentionPolicy`, `TranslationConsentStatus`, `TranslationConsentRecord`, `TranslatableNode`, `TranslationSession`, `TranslationErrorCode`, `SmartContrastLevel`, `UnsupportedReason`, `RgbColor`, `RgbaColor`, `UnsupportedElementInfo`, `SmartContrastReport`, `SmartContrastOptions`, `AppliedSmartContrast`, `BackdropResolution`, `DiagnosticsHarnessProps`, `DiagnosticCategory`, `DiagnosticIssue`, `DiagnosticSeverity`, `DiagnosticsConfig`, `DiagnosticsReport`, `DiagnosticsSummary`, `AccessibilityEventType`, `EventTriggerSource`, `BaseAccessibilityEvent`, `FeatureChangeEvent`, `FeatureResetEvent`, `PanelToggleEvent`, `PlacementChangeEvent`, `ProfileApplyEvent`, `PresetApplyEvent`, `AccessibilityFeatureEvent`, `FeatureEventListener`.
|
|
63
|
+
Exported types: `AccessibilityPluginProps`, `AccessibilityButtonProps`, `AccessibilityListProps`, `AccessibilityState`, `AccessibilityContextValue`, `PluginPosition`, `WidgetPlacement`, `FeatureOptions<T>`, `FeatureRegistration`, `ToggleControlProps`, `ChoiceControlProps`, `ChoiceOption<T>`, `ChoiceGroup<T>`, `StepperControlProps`, `FeatureCardProps`, `FeatureGroupProps`, `ModalDialogProps`, `FeatureStatus`, `SearchCountProps`, `EmptyStateProps`, `ErrorStateProps`, `ProfilePreviewCardProps`, `FontSizeControllerProps`, `TextScaleControllerProps`, `TextScaleStep`, `FontFamilyPreset`, `ContrastModeValue`, `ContrastPalette`, `LineHeightControllerProps`, `LetterSpacingControllerProps`, `WordSpacingControllerProps`, `ParagraphSpacingControllerProps`, `ScriptSpacingConstraints`, `SkipToMainLinkProps`, `HideImagesControllerProps`, `BigCursorControllerProps`, `ReadingMaskControllerProps`, `ReadingGuideControllerProps`, `TooltipsControllerProps`, `PageNavigatorControllerProps`, `HeadingItem`, `LandmarkItem`, `LinkItem`, `ProfilesControllerProps`, `ActiveProfileState`, `UseProfilesResult`, `AccessibilityPreferences`, `ContrastMode`, `CursorSizePreference`, `FontFamilyPreference`, `ProfileDefinition`, `ProfilePresetId`, `ReaderMode`, `SaturationPreference`, `StorageMode`, `TextAlignPreference`, `LocaleStrings`, `SupportedLocale`, `FeatureLocaleLabels`, `PresetsControllerProps`, `CustomPreset`, `PresetsExportV1`, `ImportResult`, `UsePresetsResult`, `ReadingModeControllerProps`, `ArticleContent`, `KeyboardShortcutsControllerProps`, `ShortcutDefinition`, `ValidationResult`, `ReadAloudControllerProps`, `ReadAloudOptions`, `ReadAloudState`, `SaturationControllerProps`, `GrayscaleControllerProps`, `DictionaryControllerProps`, `DictionaryEntry`, `DictionaryLookupResult`, `DictionaryProvider`, `FeatureMenuProps`, `FeatureMenuItemConfig`, `FeatureMenuGroupConfig`, `MenuCustomizationConfig`, `MenuValidationIssue`, `MenuValidationResult`, `NormalizedMenuConfig`, `NormalizedMenuItem`, `NormalizedMenuGroup`, `VoiceNavigationControllerProps`, `VoiceNavigationStatus`, `VoiceCommandId`, `VoiceCommandDefinition`, `VoiceNavigationResult`, `VoiceNavigationOptions`, `VoiceNavigationSession`, `VoiceExecutionContext`, `TranslationControllerProps`, `TranslationAdapter`, `TranslationRequest`, `TranslationResponse`, `TranslatedItem`, `DataRetentionPolicy`, `TranslationConsentStatus`, `TranslationConsentRecord`, `TranslatableNode`, `TranslationSession`, `TranslationErrorCode`, `SmartContrastLevel`, `UnsupportedReason`, `RgbColor`, `RgbaColor`, `UnsupportedElementInfo`, `SmartContrastReport`, `SmartContrastOptions`, `AppliedSmartContrast`, `BackdropResolution`, `DiagnosticsHarnessProps`, `DiagnosticCategory`, `DiagnosticIssue`, `DiagnosticSeverity`, `DiagnosticsConfig`, `DiagnosticsReport`, `DiagnosticsSummary`, `AccessibilityEventType`, `EventTriggerSource`, `BaseAccessibilityEvent`, `FeatureChangeEvent`, `FeatureResetEvent`, `PanelToggleEvent`, `PlacementChangeEvent`, `ProfileApplyEvent`, `PresetApplyEvent`, `AccessibilityFeatureEvent`, `FeatureEventListener`.
|
|
62
64
|
|
|
63
|
-
Exported control components: `ToggleControl`, `ChoiceControl`, `StepperControl`, `FeatureCard`, `SearchCount`, `EmptyState`, `ErrorState`, `ProfilePreviewCard`, `FontSizeController`, `TextScaleController`, `LineHeightController`, `LetterSpacingController`, `WordSpacingController`, `ParagraphSpacingController`, `FontFamilyController`, `TextAlignController`, `ContrastController`, `ContrastModeController`, `SmartContrastController`, `LinkHighlightController`, `HighlightFocusController`, `FocusHighlightController`, `ReduceMotionController`, `HideImagesController`, `HideDecorativeImagesController`, `BigCursorController`, `ReadingMaskController`, `ReadingGuideController`, `TooltipsController`, `AccessibleTooltipsController`, `PageNavigatorController`, `HeadingsNavigatorController`, `PageStructureController`, `ProfilesController`, `ProfileController`, `AccessibilityProfilesController`, `PresetsController`, `CustomPresetsController`, `SettingsImportExportController`, `PresetsBackupController`, `ReadingModeController`, `KeyboardShortcutsController`, `ReadAloudController`, `DictionaryController`, `VoiceNavigationController`, `TranslationController`, `FeatureMenu`, `SkipToMainLink`, `DiagnosticsHarness`.
|
|
65
|
+
Exported control components: `ToggleControl`, `ChoiceControl`, `StepperControl`, `FeatureCard`, `FeatureGroup`, `ModalDialog`, `SearchCount`, `EmptyState`, `ErrorState`, `ProfilePreviewCard`, `FontSizeController`, `TextScaleController`, `LineHeightController`, `LetterSpacingController`, `WordSpacingController`, `ParagraphSpacingController`, `FontFamilyController`, `TextAlignController`, `ContrastController`, `ContrastModeController`, `SmartContrastController`, `LinkHighlightController`, `HighlightFocusController`, `FocusHighlightController`, `ReduceMotionController`, `HideImagesController`, `HideDecorativeImagesController`, `BigCursorController`, `ReadingMaskController`, `ReadingGuideController`, `TooltipsController`, `AccessibleTooltipsController`, `PageNavigatorController`, `HeadingsNavigatorController`, `PageStructureController`, `ProfilesController`, `ProfileController`, `AccessibilityProfilesController`, `PresetsController`, `CustomPresetsController`, `SettingsImportExportController`, `PresetsBackupController`, `ReadingModeController`, `KeyboardShortcutsController`, `ReadAloudController`, `DictionaryController`, `VoiceNavigationController`, `TranslationController`, `FeatureMenu`, `SkipToMainLink`, `DiagnosticsHarness`.
|
|
64
66
|
|
|
65
67
|
Exported typography, contrast, reading aids, tooltips, reading mode, read aloud, reflow, and menu customization utilities: `TEXT_SCALE_STEPS`, `TEXT_SCALE_PROTECTED_SELECTOR`, `isProtectedFromTextScale`, `LINE_HEIGHT_STEPS`, `LINE_HEIGHT_RATIOS`, `TEXT_SPACING_EXCLUDED_SELECTOR`, `isProtectedFromTextSpacing`, `getScriptSpacingConstraints`, `FONT_FAMILY_PRESETS`, `LEGIBLE_FONT_STACK`, `DYSLEXIA_FONT_STACK`, `FONT_FAMILY_PROTECTED_SELECTOR`, `isProtectedFromFontFamily`, `TEXT_ALIGN_BLOCK_SELECTOR`, `isProtectedFromTextAlign`, `CONTRAST_MODES`, `isForcedColorsActive`, `subscribeForcedColors`, `isReducedMotionActive`, `subscribeReducedMotion`, `isEligibleDecorativeImage`, `isFunctionalOrMeaningfulImage`, `hasFinePointer`, `subscribeFinePointer`, `nudgeReadingAid`, `DEFAULT_READING_MASK_HEIGHT`, `MIN_READING_MASK_HEIGHT`, `MAX_READING_MASK_HEIGHT`, `READING_MASK_HEIGHT_PRESETS`, `getAuthoredDescription`, `positionTooltip`, `enableAccessibleTooltips`, `scanHeadings`, `scanLandmarks`, `scanLinks`, `navigateToElement`, `subscribePageStructure`, `useProfiles`, `ALL_PROFILE_IDS`, `getProfileDefinition`, `mapProfileSettingsToFeatures`, `mapFeaturesToProfileSettings`, `applyProfileToStore`, `revertProfileFromStore`, `recordProfileOverride`, `usePresets`, `createCustomPreset`, `isValidCustomPreset`, `exportPresetsToJson`, `downloadJsonFile`, `validateAndParseImport`, `applyCustomPresetToStore`, `sanitizePreferences`, `ALLOWED_PREFERENCE_KEYS`, `extractArticleContent`, `findArticleCandidate`, `countWords`, `estimateReadingTime`, `CONTRAST_PROTECTED_SELECTOR`, `isProtectedFromContrast`, `CONTRAST_PALETTES`, `findMainLandmark`, `DEFAULT_SHORTCUTS`, `RESERVED_BROWSER_SHORTCUTS`, `normalizeKeyCombo`, `parseKeyboardEventToCombo`, `isFormFieldOrEditable`, `validateShortcutRemap`, `resolveActiveShortcut`, `isSpeechSynthesisSupported`, `getSpeechVoices`, `subscribeSpeechVoices`, `getActiveSelectionText`, `extractReadAloudText`, `splitTextIntoChunks`, `ReadAloudSession`, `READ_ALOUD_EXCLUDED_SELECTORS`, `sanitizeLookupTerm`, `lookupLocalDictionary`, `lookupWord`, `LOCAL_DICTIONARY_EN`, `LOCAL_DICTIONARY_SI`, `LOCAL_DICTIONARY_TA`, `validateMenuConfig`, `getMenuConfigSignature`, `KNOWN_FEATURE_IDS`, `DEFAULT_MENU_GROUPS`, `DEFAULT_FEATURE_GROUP_MAP`, `SMART_CONTRAST_DISCLAIMER`, `TARGET_RATIOS`, `HIGH_CONTRAST_TOKENS`, `parseColor`, `calculateRelativeLuminance`, `calculateContrastRatio`, `compositeRgba`, `isLargeText`, `resolveEffectiveBackdrop`, `isEligibleForSmartContrast`, `evaluateSmartContrast`, `applySmartContrast`, `VOICE_COMMANDS`, `VOICE_NAVIGATION_DISCLAIMER`, `isSpeechRecognitionSupported`, `normalizeTranscript`, `matchVoiceCommand`, `executeVoiceCommand`, `createVoiceNavigationSession`, `TRANSLATION_ERROR_CODES`, `TRANSLATION_DISCLAIMER`, `MAX_NODES_PER_TRANSLATION_BATCH`, `MAX_TEXT_LENGTH_PER_NODE`, `isSensitiveElement`, `extractTranslatableNodes`, `sanitizeTranslationOutput`, `applyTranslations`, `createOfflineMockTranslationAdapter`, `translateHostContent`, `TranslationError`, `runDiagnostics`, `checkProviderDiagnostics`, `checkStorageDiagnostics`, `checkCspDiagnostics`, `checkHostCssDiagnostics`, `checkDomDiagnostics`, `checkBoundariesDiagnostics`, `DIAGNOSTICS_DISCLAIMER`, `useDiagnostics`, `sanitizeFeatureEvent`, `emitFeatureEvent`.
|
|
66
68
|
|
|
@@ -293,6 +295,7 @@ Opt-in research prototype controller enabling host application content translati
|
|
|
293
295
|
- `extractTranslatableNodes(root: Element, maxNodes?: number): TranslatableNode[]`: Traverses DOM tree starting from root and collects translatable text nodes, strictly skipping sensitive elements.
|
|
294
296
|
- `sanitizeTranslationOutput(raw: string): string`: Sanitizes translated strings, stripping control characters and null bytes.
|
|
295
297
|
- `applyTranslations(nodes: TranslatableNode[], translations: string[]): () => void`: Safely assigns translated strings to text nodes via `textContent` and returns an idempotent restore callback.
|
|
298
|
+
- `createGoogleTranslateAdapter(options?: GoogleTranslateAdapterOptions): TranslationAdapter`: Default adapter for `<TranslationController />` querying Google Translate (`translate.googleapis.com/translate_a/single`) after explicit consent, with caching and automatic offline fallback.
|
|
296
299
|
- `createOfflineMockTranslationAdapter(options?): TranslationAdapter`: Creates a local offline mock translation adapter operating with zero network requests.
|
|
297
300
|
- `translateHostContent(options): Promise<TranslationSession>`: Coordinates end-to-end translation, enforcing consent, provider language support, sensitive element exclusion, and DOM restoration.
|
|
298
301
|
- `TRANSLATION_DISCLAIMER`: Constant string disclaimer emphasizing prototype status and zero official WCAG compliance claims.
|
package/docs/CSP.md
CHANGED
|
@@ -37,6 +37,15 @@ This guide explains how `accessibility-plugin-react` operates under Content Secu
|
|
|
37
37
|
```
|
|
38
38
|
If `data:` is omitted from `img-src`, the browser will fall back to native system cursors.
|
|
39
39
|
|
|
40
|
+
### D. Bundled Manrope UI Typography (`font-src`)
|
|
41
|
+
|
|
42
|
+
- **Default UI font:** The library bundles the variable **Manrope** typeface locally (`dist/fonts/Manrope-VariableFont_wght.ttf` for standalone CSS imports, and inlined `data:font/ttf;base64,...` within the runtime injected styles in `dist/index.mjs` / `dist/index.js`) with zero external font CDN calls.
|
|
43
|
+
- **Recommended directive:**
|
|
44
|
+
```text
|
|
45
|
+
font-src 'self' data:;
|
|
46
|
+
```
|
|
47
|
+
If `data:` is omitted from `font-src`, import `accessibility-plugin-react/style.css` so your bundler serves `dist/fonts/Manrope-VariableFont_wght.ttf` from `'self'`.
|
|
48
|
+
|
|
40
49
|
---
|
|
41
50
|
|
|
42
51
|
## 2. Next.js App Router Strict CSP Recipe
|
|
@@ -54,7 +63,8 @@ const cspHeader = `
|
|
|
54
63
|
style-src 'self' 'unsafe-inline';
|
|
55
64
|
style-src-attr 'unsafe-inline';
|
|
56
65
|
img-src 'self' data:;
|
|
57
|
-
font-src 'self'
|
|
66
|
+
font-src 'self' data:;
|
|
67
|
+
connect-src 'self' https://translate.googleapis.com;
|
|
58
68
|
object-src 'none';
|
|
59
69
|
base-uri 'self';
|
|
60
70
|
form-action 'self';
|
|
@@ -106,7 +116,8 @@ export function middleware(request: NextRequest) {
|
|
|
106
116
|
style-src 'self' 'nonce-${nonce}';
|
|
107
117
|
style-src-attr 'unsafe-inline';
|
|
108
118
|
img-src 'self' data:;
|
|
109
|
-
font-src 'self'
|
|
119
|
+
font-src 'self' data:;
|
|
120
|
+
connect-src 'self' https://translate.googleapis.com;
|
|
110
121
|
base-uri 'self';
|
|
111
122
|
form-action 'self';
|
|
112
123
|
`
|
|
@@ -159,7 +170,8 @@ For Vite applications, configure CSP headers either through your production web
|
|
|
159
170
|
style-src 'self' 'unsafe-inline';
|
|
160
171
|
style-src-attr 'unsafe-inline';
|
|
161
172
|
img-src 'self' data:;
|
|
162
|
-
font-src 'self'
|
|
173
|
+
font-src 'self' data:;
|
|
174
|
+
connect-src 'self' https://translate.googleapis.com;
|
|
163
175
|
"
|
|
164
176
|
/>
|
|
165
177
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
@@ -176,10 +188,10 @@ For Vite applications, configure CSP headers either through your production web
|
|
|
176
188
|
|
|
177
189
|
## 4. Verification Checklist
|
|
178
190
|
|
|
179
|
-
| Requirement | Directive
|
|
180
|
-
| :---------------------------- |
|
|
181
|
-
| **Widget UI Styles** | `style-src 'self'` (with static `style.css` import)
|
|
182
|
-
| **Dynamic Host Effects** | `style-src-attr 'unsafe-inline'`
|
|
183
|
-
| **Big High-Contrast Cursor** | `img-src 'self' data:`
|
|
184
|
-
| **No External Font Requests** | `font-src 'self'`
|
|
185
|
-
| **No Network Calls** | No special `connect-src`
|
|
191
|
+
| Requirement | Directive | Why It Is Needed |
|
|
192
|
+
| :---------------------------- | :-------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
193
|
+
| **Widget UI Styles** | `style-src 'self'` (with static `style.css` import) | Renders the Clean light widget panel, trigger, and control cards |
|
|
194
|
+
| **Dynamic Host Effects** | `style-src-attr 'unsafe-inline'` | Applies runtime font-size, line-height, and filter adjustments to host elements |
|
|
195
|
+
| **Big High-Contrast Cursor** | `img-src 'self' data:` | Allows SVG data URI pointer rendering |
|
|
196
|
+
| **No External Font Requests** | `font-src 'self'` | The plugin does not load external web fonts; all font-legibility features use local and system fallbacks |
|
|
197
|
+
| **No Network Calls** | No special `connect-src` (unless using `TranslationController`) | Core preferences, state persistence, and effects operate 100% locally; opt-in `TranslationController` (`createGoogleTranslateAdapter()`) connects to `https://translate.googleapis.com` only after explicit user consent (`connect-src 'self' https://translate.googleapis.com`), with automatic offline fallback if blocked |
|
package/docs/DESIGN.md
CHANGED
|
@@ -4,7 +4,7 @@ The owner selected the Clean light concept on 2026-10-13. It establishes the def
|
|
|
4
4
|
|
|
5
5
|
## Principles implemented
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- 460px default desktop panel width (380–720px pointer/keyboard resizable on fine-pointer desktop viewports >=1024px wide; non-resizable and full-bleed responsive down to 320px/400% zoom), rounded border, Manrope default UI typography synced with `fontFamily` presets (`default`, `legible`, `dyslexia-option`), and spacious full-viewport dialogs (`ModalDialog`) for search-heavy views.
|
|
8
8
|
- Strong heading with optional supporting description; the close control keeps its accessible name and 44px target.
|
|
9
9
|
- Compact label/value rows on desktop. Steppers stack below labels on small screens so neither labels nor targets are squeezed.
|
|
10
10
|
- Cohesive decorative SVG icons. Existing names and native controls remain the semantic interface.
|
package/docs/SECURITY_AUDIT.md
CHANGED
|
@@ -6,14 +6,14 @@ This document provides a comprehensive security review, dependency audit, Conten
|
|
|
6
6
|
|
|
7
7
|
## 1. Executive summary and audit results
|
|
8
8
|
|
|
9
|
-
| Audit Area | Standard / Requirement | Current Verification Result
|
|
10
|
-
| :------------------- | :---------------------------------------------------------- |
|
|
11
|
-
| **Dependencies** | 0 runtime dependencies; peerDependencies only | Clean `package.json`; 0 runtime dependencies. Only peer dependencies: React (`^18.3.1 \|\| ^19.0.0`) and React DOM.
|
|
12
|
-
| **Vulnerabilities** | `npm audit` 0 findings across direct and transitive tooling | `npm audit` returns 0 vulnerabilities across all installed packages.
|
|
13
|
-
| **Script Injection** | No dynamic code execution (`eval`, `new Function`) | Automated AST scan verifies 0 instances of `eval` or `Function` constructors across all `src/` modules.
|
|
14
|
-
| **Network Requests** | No unauthorized telemetry, tracking, or background calls | 0 `fetch()`, 0 `XMLHttpRequest`, 0 `navigator.sendBeacon`, 0 `WebSocket` calls.
|
|
15
|
-
| **Data Residency** | All state stored locally; zero external exfiltration | Preferences persist strictly in `localStorage` under `react-accessibility-plugin:state`. Zero cloud sync.
|
|
16
|
-
| **Licensing** | Permissive ISC license
|
|
9
|
+
| Audit Area | Standard / Requirement | Current Verification Result | Status |
|
|
10
|
+
| :------------------- | :---------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- |
|
|
11
|
+
| **Dependencies** | 0 runtime dependencies; peerDependencies only | Clean `package.json`; 0 runtime dependencies. Only peer dependencies: React (`^18.3.1 \|\| ^19.0.0`) and React DOM. | **PASS** |
|
|
12
|
+
| **Vulnerabilities** | `npm audit` 0 findings across direct and transitive tooling | `npm audit` returns 0 vulnerabilities across all installed packages. | **PASS** |
|
|
13
|
+
| **Script Injection** | No dynamic code execution (`eval`, `new Function`) | Automated AST scan verifies 0 instances of `eval` or `Function` constructors across all `src/` modules. | **PASS** |
|
|
14
|
+
| **Network Requests** | No unauthorized telemetry, tracking, or background calls | 0 `fetch()`, 0 `XMLHttpRequest`, 0 `navigator.sendBeacon`, 0 `WebSocket` calls. | **PASS** |
|
|
15
|
+
| **Data Residency** | All state stored locally; zero external exfiltration | Preferences persist strictly in `localStorage` under `react-accessibility-plugin:state`. Zero cloud sync. | **PASS** |
|
|
16
|
+
| **Licensing** | Permissive ISC license + SIL OFL 1.1 font attribution | Dedicated `LICENSE` and `NOTICE` files committed; bundles SIL OFL 1.1 `Manrope-VariableFont_wght.ttf` with zero GPL/copyleft or proprietary binary assets. | **PASS** |
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
@@ -78,6 +78,6 @@ Features that inspect or transform DOM elements (such as host translation, read
|
|
|
78
78
|
- **License**: Released under the open-source **ISC License** (permissive, GPL-compatible).
|
|
79
79
|
- **Attribution**: Derived from the original vanilla JavaScript accessibility plugin; attribution is documented in `NOTICE` and `README.md`.
|
|
80
80
|
- **Assets**:
|
|
81
|
-
- **Fonts**:
|
|
81
|
+
- **Fonts**: Bundles the open-source variable **Manrope** font (`Manrope-VariableFont_wght.ttf`) under the **SIL Open Font License 1.1** (`dist/fonts/OFL.txt` and `NOTICE`), with offline client-system fallback stacks for legible and dyslexia presets. Zero external Google Fonts or remote CDN requests.
|
|
82
82
|
- **Icons**: Authored in-tree as native inline SVG icons under ISC.
|
|
83
83
|
- **Glossary Data**: Built-in dictionary entries (English, Sinhala, Tamil) are compiled in-tree under ISC for offline accessibility lookup.
|
package/docs/TRANSLATION.md
CHANGED
|
@@ -8,12 +8,12 @@ The host-content translation adapter (**A11Y-409**) provides a decoupled, privac
|
|
|
8
8
|
|
|
9
9
|
### Strict Distinction from Widget Localization
|
|
10
10
|
|
|
11
|
-
| Dimension | Widget UI Localization (`docs/LOCALES.md`) | Host-Content Translation (`docs/TRANSLATION.md`)
|
|
12
|
-
| :------------------- | :---------------------------------------------- |
|
|
13
|
-
| **Target Scope** | Widget buttons, labels, and dialog strings only | Arbitrary host document content (articles, headings)
|
|
14
|
-
| **Network Requests** | **Zero** — 100% static bundled locale packs | **
|
|
15
|
-
| **Privacy Risk** | None (no host content read) | High (host text transmitted to provider if configured)
|
|
16
|
-
| **User Consent** | Not required (local interface strings) | **Mandatory explicit consent** prior to transmission
|
|
11
|
+
| Dimension | Widget UI Localization (`docs/LOCALES.md`) | Host-Content Translation (`docs/TRANSLATION.md`) |
|
|
12
|
+
| :------------------- | :---------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------- |
|
|
13
|
+
| **Target Scope** | Widget buttons, labels, and dialog strings only | Arbitrary host document content (articles, headings) |
|
|
14
|
+
| **Network Requests** | **Zero** — 100% static bundled locale packs | **Opt-in after consent** — `createGoogleTranslateAdapter()` (default on `<TranslationController />`) or custom/offline adapter |
|
|
15
|
+
| **Privacy Risk** | None (no host content read) | High (host text transmitted to provider if configured) |
|
|
16
|
+
| **User Consent** | Not required (local interface strings) | **Mandatory explicit consent** prior to transmission |
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
@@ -94,11 +94,11 @@ The engine automatically scans element tags, attributes, and ancestor trees (`is
|
|
|
94
94
|
|
|
95
95
|
### 3. Content Security Policy (CSP)
|
|
96
96
|
|
|
97
|
-
If a host application uses a remote translation API (e.g. Google Cloud, DeepL, LibreTranslate):
|
|
97
|
+
If a host application uses the default Google Translate adapter or a custom remote translation API (e.g. Google Cloud, DeepL, LibreTranslate):
|
|
98
98
|
|
|
99
99
|
- The host's `connect-src` CSP directive must explicitly permit the provider endpoint:
|
|
100
100
|
```http
|
|
101
|
-
Content-Security-Policy: default-src 'self'; connect-src 'self' https://
|
|
101
|
+
Content-Security-Policy: default-src 'self'; connect-src 'self' https://translate.googleapis.com;
|
|
102
102
|
```
|
|
103
103
|
- If an on-device local model (e.g., Transformers.js via WebAssembly or browser native Translation API `ai.translator`) is used, no external `connect-src` is required, though `wasm-unsafe-eval` may be needed for WebAssembly execution.
|
|
104
104
|
|
|
@@ -139,14 +139,22 @@ session.restore();
|
|
|
139
139
|
|
|
140
140
|
## Example Custom Providers
|
|
141
141
|
|
|
142
|
-
### 1.
|
|
142
|
+
### 1. Google Translate Adapter (Default on `<TranslationController />`) & Offline Fallback
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
`<TranslationController />` defaults to `createGoogleTranslateAdapter()`, which performs client-side Google Translate requests only after explicit user consent and automatically falls back to local offline lexicons if offline or blocked:
|
|
145
145
|
|
|
146
146
|
```typescript
|
|
147
|
-
import {
|
|
147
|
+
import {
|
|
148
|
+
createGoogleTranslateAdapter,
|
|
149
|
+
createOfflineMockTranslationAdapter,
|
|
150
|
+
} from "accessibility-plugin-react";
|
|
151
|
+
|
|
152
|
+
const googleAdapter = createGoogleTranslateAdapter({
|
|
153
|
+
fallbackToOffline: true,
|
|
154
|
+
});
|
|
148
155
|
|
|
149
|
-
|
|
156
|
+
// Zero-network alternative for air-gapped development and testing:
|
|
157
|
+
const offlineAdapter = createOfflineMockTranslationAdapter({
|
|
150
158
|
prefix: "[ES]",
|
|
151
159
|
supportedLanguages: ["es", "fr", "de", "si", "ta"],
|
|
152
160
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "accessibility-plugin-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.30.1",
|
|
4
4
|
"description": "A composable React display-preference widget with a clean light design, persistent settings and movable accessible controls.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"./dist/style.css": "./dist/style.css",
|
|
20
|
-
"./style.css": "./dist/style.css"
|
|
20
|
+
"./style.css": "./dist/style.css",
|
|
21
|
+
"./fonts/*": "./dist/fonts/*"
|
|
21
22
|
},
|
|
22
23
|
"files": [
|
|
23
24
|
"dist",
|