accessibility-plugin-react 2.5.0 → 2.7.0

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
@@ -88,26 +88,27 @@ export function App() {
88
88
  Every controller is opt-in. Add only the controls that make sense for your
89
89
  site, and choose their order in JSX.
90
90
 
91
- | Controller | Effect |
92
- | ---------------------------- | ---------------------------------------------------------------------------------------------------------- |
93
- | `TextScaleController` | Stepwise reflow-safe text enlargement (1.0x, 1.125x, 1.25x, 1.5x, 2.0x) protecting forms, code, and icons. |
94
- | `FontSizeController` | Scales eligible HTML text from 50% to 200%; supports continuous 10% steps or `stepScale` mode. |
95
- | `LineHeightController` | Scales computed line height (50%–200%, step 10); supports `stepPresets` (100%, 150%, 175%, 200%). |
96
- | `LetterSpacingController` | Applies 0–10px letter spacing with automatic cursive (Arabic/RTL) and Indic (Sinhala/Tamil) protection. |
97
- | `WordSpacingController` | Applies 0–10px word spacing while protecting tables, code, forms, and widget internals. |
98
- | `ParagraphSpacingController` | Applies 0–32px paragraph bottom margin spacing without altering table or code layouts. |
99
- | `ContrastController` | Turns contrast off, reduces it, increases it, or selects a named palette. |
100
- | `SaturationController` | Reduces or increases saturation. |
101
- | `InvertColorsController` | Inverts eligible page content. |
102
- | `GrayscaleController` | Removes color while preserving the selected saturation value for later. |
103
- | `LinkHighlightController` | Highlights links or selects a link palette. |
104
- | `TextAlignController` | Restores the host alignment or forces left, center, right, or justified text. |
105
- | `HideImagesController` | Hides images and CSS background images while retaining layout. |
106
- | `HideVideosController` | Hides video elements and recognized YouTube/Vimeo embeds visually. |
107
- | `BigCursorController` | Applies a larger high-contrast cursor where supported. |
108
- | `ReadingMaskController` | Dims the page around a transparent reading window. |
109
- | `ReadingGuideController` | Follows pointer/focus with a reading guide line. |
110
- | `ResetController` | Resets display features and custom registered features without moving the widget. |
91
+ | Controller | Effect |
92
+ | ------------------------- | ------------------------------------------------------------------------------------------------------------ |
93
+ | `TextScaleController` | Stepwise reflow-safe text enlargement (1.0x, 1.125x, 1.25x, 1.5x, 2.0x) protecting forms, code, and icons. |
94
+ | `FontSizeController` | Scales eligible HTML text from 50% to 200%; supports continuous 10% steps or `stepScale` mode. |
95
+ | `LineHeightController` | Scales computed line height (50%–200%, step 10); supports `stepPresets` (100%, 150%, 175%, 200%). |
96
+ | `LetterSpacingController` | Applies 0–10px letter spacing with automatic cursive (Arabic/RTL) and Indic (Sinhala/Tamil) protection. |
97
+ | `WordSpacingController` | Applies 0–10px word spacing while protecting tables, code, forms, and widget internals. |
98
+ | `ContrastController` | Adjusts contrast levels, palettes, or semantic modes while preserving images, video, charts, and validation. |
99
+ | `ContrastModeController` | Applies light, dark, high contrast, or media-safe invert tokens with native forced-colors protection. |
100
+ | `SaturationController` | Reduces or increases saturation. |
101
+ | `InvertColorsController` | Inverts eligible page content. |
102
+ | `GrayscaleController` | Removes color while preserving the selected saturation value for later. |
103
+ | `LinkHighlightController` | Highlights links or selects a link palette. |
104
+ | `TextAlignController` | Scopes left, center, right, or justified alignment to text blocks; warns about justification. |
105
+ | `FontFamilyController` | Applies clean system-ui or OpenDyslexic with Sinhala/Tamil fallbacks while protecting code and icons. |
106
+ | `HideImagesController` | Hides images and CSS background images while retaining layout. |
107
+ | `HideVideosController` | Hides video elements and recognized YouTube/Vimeo embeds visually. |
108
+ | `BigCursorController` | Applies a larger high-contrast cursor where supported. |
109
+ | `ReadingMaskController` | Dims the page around a transparent reading window. |
110
+ | `ReadingGuideController` | Follows pointer/focus with a reading guide line. |
111
+ | `ResetController` | Resets display features and custom registered features without moving the widget. |
111
112
 
112
113
  Effects compose where appropriate. For example, contrast, saturation, invert,
113
114
  and grayscale are applied in a deterministic order. Defaults leave host styles
package/dist/index.d.mts CHANGED
@@ -369,11 +369,46 @@ type TextScaleStep = (typeof TEXT_SCALE_STEPS)[number];
369
369
  */
370
370
  declare const LINE_HEIGHT_STEPS: readonly [100, 150, 175, 200];
371
371
  declare const LINE_HEIGHT_RATIOS: readonly [1, 1.5, 1.75, 2];
372
-
372
+ /**
373
+ * Font family options: default (host fonts), legible (clean modern sans-serif), dyslexia-option (weighted baseline fonts).
374
+ */
375
+ declare const FONT_FAMILY_PRESETS: readonly ["default", "legible", "dyslexia-option"];
376
+ type FontFamilyPreset = (typeof FONT_FAMILY_PRESETS)[number];
377
+ /**
378
+ * Semantic contrast modes: off/original (standard colors), light (crisp light), dark (deep dark), high (AAA high contrast), invert (luminance inversion).
379
+ */
380
+ declare const CONTRAST_MODES: readonly ["off", "original", "light", "dark", "high", "invert"];
381
+ type ContrastModeValue = (typeof CONTRAST_MODES)[number];
382
+
383
+ /** Detects whether the user's operating system has forced colors / high contrast active. */
384
+ declare function isForcedColorsActive(): boolean;
385
+ interface ContrastPalette {
386
+ text: string;
387
+ background: string;
388
+ border?: string;
389
+ link?: string;
390
+ }
391
+ declare const CONTRAST_PALETTES: Record<string, ContrastPalette>;
392
+ declare const CONTRAST_PROTECTED_SELECTOR: string;
393
+ declare function isProtectedFromContrast(element: HTMLElement): boolean;
373
394
  declare const TEXT_SCALE_PROTECTED_SELECTOR: string;
374
395
  declare function isProtectedFromTextScale(element: HTMLElement): boolean;
375
396
  declare const TEXT_SPACING_EXCLUDED_SELECTOR: string;
376
397
  declare function isProtectedFromTextSpacing(element: HTMLElement): boolean;
398
+ declare const TEXT_ALIGN_BLOCK_SELECTOR: string;
399
+ declare function isProtectedFromTextAlign(element: HTMLElement): boolean;
400
+ /**
401
+ * Standard legible font stack with Sinhala ("Noto Sans Sinhala", "Iskoola Pota")
402
+ * and Tamil ("Noto Sans Tamil", "Latha", "Nirmala UI") script fallbacks.
403
+ */
404
+ declare const LEGIBLE_FONT_STACK: string;
405
+ /**
406
+ * Dyslexia-friendly font stack with OpenDyslexic (licensed under SIL OFL / CC-BY),
407
+ * weighted rounded fallbacks, and Indic/Sinhala/Tamil script fallbacks.
408
+ */
409
+ declare const DYSLEXIA_FONT_STACK: string;
410
+ declare const FONT_FAMILY_PROTECTED_SELECTOR: string;
411
+ declare function isProtectedFromFontFamily(element: HTMLElement): boolean;
377
412
  interface ScriptSpacingConstraints {
378
413
  allowLetterSpacing: boolean;
379
414
  maxLetterSpacingPx: number;
@@ -420,6 +455,8 @@ declare function ParagraphSpacingController({ min, max, step, steps, }?: Paragra
420
455
 
421
456
  declare function ContrastController(): react.JSX.Element;
422
457
 
458
+ declare function ContrastModeController(): react.JSX.Element;
459
+
423
460
  declare function SaturationController(): react.JSX.Element;
424
461
 
425
462
  declare function InvertColorsController(): react.JSX.Element;
@@ -430,6 +467,8 @@ declare function LinkHighlightController(): react.JSX.Element;
430
467
 
431
468
  declare function TextAlignController(): react.JSX.Element;
432
469
 
470
+ declare function FontFamilyController(): react.JSX.Element;
471
+
433
472
  declare function HideImagesController(): react.JSX.Element;
434
473
 
435
474
  declare function HideVideosController(): react.JSX.Element;
@@ -442,4 +481,4 @@ declare function ReadingGuideController(): react.JSX.Element;
442
481
 
443
482
  declare function ResetController(): react.JSX.Element;
444
483
 
445
- export { AccessibilityButton, type AccessibilityButtonProps, AccessibilityContext, type AccessibilityContextValue, AccessibilityList, type AccessibilityListProps, AccessibilityPlugin, type AccessibilityPluginProps, type AccessibilityPreferences, type AccessibilityState, BigCursorController, ChoiceControl, type ChoiceControlProps, type ChoiceGroup, type ChoiceOption, ContrastController, type ContrastMode, type CursorSizePreference, DEFAULT_PREFERENCES, EmptyState, type EmptyStateProps, ErrorState, type ErrorStateProps, FeatureCard, type FeatureCardProps, type FeatureOptions, type FeatureRegistration, type FeatureStatus, type FontFamilyPreference, FontSizeController, type FontSizeControllerProps, GrayscaleController, HideImagesController, HideVideosController, InvertColorsController, LINE_HEIGHT_RATIOS, LINE_HEIGHT_STEPS, LetterSpacingController, type LetterSpacingControllerProps, LineHeightController, type LineHeightControllerProps, LinkHighlightController, type LocaleStrings, PROFILE_DEFINITIONS, ParagraphSpacingController, type ParagraphSpacingControllerProps, type PluginPosition, type ProfileDefinition, type ProfilePresetId, ProfilePreviewCard, type ProfilePreviewCardProps, type ReaderMode, ReadingGuideController, ReadingMaskController, ResetController, SaturationController, type SaturationPreference, type ScriptSpacingConstraints, SearchCount, type SearchCountProps, StepperControl, type StepperControlProps, type StorageMode, type SupportedLocale, TEXT_SCALE_PROTECTED_SELECTOR, TEXT_SCALE_STEPS, TEXT_SPACING_EXCLUDED_SELECTOR, TextAlignController, type TextAlignPreference, TextScaleController, type TextScaleControllerProps, type TextScaleStep, ToggleControl, type ToggleControlProps, type WidgetPlacement, WordSpacingController, type WordSpacingControllerProps, createInitialPreferencesState, enLocale, getScriptSpacingConstraints, isProtectedFromTextScale, isProtectedFromTextSpacing, isRtlLocale, normalizePreferenceValue, normalizePreferences, preferencesReducer, registerLocale, resolveEffectivePreferences, resolveLocaleStrings, useAccessibility };
484
+ export { AccessibilityButton, type AccessibilityButtonProps, AccessibilityContext, type AccessibilityContextValue, AccessibilityList, type AccessibilityListProps, AccessibilityPlugin, type AccessibilityPluginProps, type AccessibilityPreferences, type AccessibilityState, BigCursorController, CONTRAST_MODES, CONTRAST_PALETTES, CONTRAST_PROTECTED_SELECTOR, ChoiceControl, type ChoiceControlProps, type ChoiceGroup, type ChoiceOption, ContrastController, type ContrastMode, ContrastModeController, type ContrastModeValue, type ContrastPalette, type CursorSizePreference, DEFAULT_PREFERENCES, DYSLEXIA_FONT_STACK, EmptyState, type EmptyStateProps, ErrorState, type ErrorStateProps, FONT_FAMILY_PRESETS, FONT_FAMILY_PROTECTED_SELECTOR, FeatureCard, type FeatureCardProps, type FeatureOptions, type FeatureRegistration, type FeatureStatus, FontFamilyController, type FontFamilyPreference, type FontFamilyPreset, FontSizeController, type FontSizeControllerProps, GrayscaleController, HideImagesController, HideVideosController, InvertColorsController, LEGIBLE_FONT_STACK, LINE_HEIGHT_RATIOS, LINE_HEIGHT_STEPS, LetterSpacingController, type LetterSpacingControllerProps, LineHeightController, type LineHeightControllerProps, LinkHighlightController, type LocaleStrings, PROFILE_DEFINITIONS, ParagraphSpacingController, type ParagraphSpacingControllerProps, type PluginPosition, type ProfileDefinition, type ProfilePresetId, ProfilePreviewCard, type ProfilePreviewCardProps, type ReaderMode, ReadingGuideController, ReadingMaskController, ResetController, SaturationController, type SaturationPreference, type ScriptSpacingConstraints, SearchCount, type SearchCountProps, StepperControl, type StepperControlProps, type StorageMode, type SupportedLocale, TEXT_ALIGN_BLOCK_SELECTOR, TEXT_SCALE_PROTECTED_SELECTOR, TEXT_SCALE_STEPS, TEXT_SPACING_EXCLUDED_SELECTOR, TextAlignController, type TextAlignPreference, TextScaleController, type TextScaleControllerProps, type TextScaleStep, ToggleControl, type ToggleControlProps, type WidgetPlacement, WordSpacingController, type WordSpacingControllerProps, createInitialPreferencesState, enLocale, getScriptSpacingConstraints, isForcedColorsActive, isProtectedFromContrast, isProtectedFromFontFamily, isProtectedFromTextAlign, isProtectedFromTextScale, isProtectedFromTextSpacing, isRtlLocale, normalizePreferenceValue, normalizePreferences, preferencesReducer, registerLocale, resolveEffectivePreferences, resolveLocaleStrings, useAccessibility };
package/dist/index.d.ts CHANGED
@@ -369,11 +369,46 @@ type TextScaleStep = (typeof TEXT_SCALE_STEPS)[number];
369
369
  */
370
370
  declare const LINE_HEIGHT_STEPS: readonly [100, 150, 175, 200];
371
371
  declare const LINE_HEIGHT_RATIOS: readonly [1, 1.5, 1.75, 2];
372
-
372
+ /**
373
+ * Font family options: default (host fonts), legible (clean modern sans-serif), dyslexia-option (weighted baseline fonts).
374
+ */
375
+ declare const FONT_FAMILY_PRESETS: readonly ["default", "legible", "dyslexia-option"];
376
+ type FontFamilyPreset = (typeof FONT_FAMILY_PRESETS)[number];
377
+ /**
378
+ * Semantic contrast modes: off/original (standard colors), light (crisp light), dark (deep dark), high (AAA high contrast), invert (luminance inversion).
379
+ */
380
+ declare const CONTRAST_MODES: readonly ["off", "original", "light", "dark", "high", "invert"];
381
+ type ContrastModeValue = (typeof CONTRAST_MODES)[number];
382
+
383
+ /** Detects whether the user's operating system has forced colors / high contrast active. */
384
+ declare function isForcedColorsActive(): boolean;
385
+ interface ContrastPalette {
386
+ text: string;
387
+ background: string;
388
+ border?: string;
389
+ link?: string;
390
+ }
391
+ declare const CONTRAST_PALETTES: Record<string, ContrastPalette>;
392
+ declare const CONTRAST_PROTECTED_SELECTOR: string;
393
+ declare function isProtectedFromContrast(element: HTMLElement): boolean;
373
394
  declare const TEXT_SCALE_PROTECTED_SELECTOR: string;
374
395
  declare function isProtectedFromTextScale(element: HTMLElement): boolean;
375
396
  declare const TEXT_SPACING_EXCLUDED_SELECTOR: string;
376
397
  declare function isProtectedFromTextSpacing(element: HTMLElement): boolean;
398
+ declare const TEXT_ALIGN_BLOCK_SELECTOR: string;
399
+ declare function isProtectedFromTextAlign(element: HTMLElement): boolean;
400
+ /**
401
+ * Standard legible font stack with Sinhala ("Noto Sans Sinhala", "Iskoola Pota")
402
+ * and Tamil ("Noto Sans Tamil", "Latha", "Nirmala UI") script fallbacks.
403
+ */
404
+ declare const LEGIBLE_FONT_STACK: string;
405
+ /**
406
+ * Dyslexia-friendly font stack with OpenDyslexic (licensed under SIL OFL / CC-BY),
407
+ * weighted rounded fallbacks, and Indic/Sinhala/Tamil script fallbacks.
408
+ */
409
+ declare const DYSLEXIA_FONT_STACK: string;
410
+ declare const FONT_FAMILY_PROTECTED_SELECTOR: string;
411
+ declare function isProtectedFromFontFamily(element: HTMLElement): boolean;
377
412
  interface ScriptSpacingConstraints {
378
413
  allowLetterSpacing: boolean;
379
414
  maxLetterSpacingPx: number;
@@ -420,6 +455,8 @@ declare function ParagraphSpacingController({ min, max, step, steps, }?: Paragra
420
455
 
421
456
  declare function ContrastController(): react.JSX.Element;
422
457
 
458
+ declare function ContrastModeController(): react.JSX.Element;
459
+
423
460
  declare function SaturationController(): react.JSX.Element;
424
461
 
425
462
  declare function InvertColorsController(): react.JSX.Element;
@@ -430,6 +467,8 @@ declare function LinkHighlightController(): react.JSX.Element;
430
467
 
431
468
  declare function TextAlignController(): react.JSX.Element;
432
469
 
470
+ declare function FontFamilyController(): react.JSX.Element;
471
+
433
472
  declare function HideImagesController(): react.JSX.Element;
434
473
 
435
474
  declare function HideVideosController(): react.JSX.Element;
@@ -442,4 +481,4 @@ declare function ReadingGuideController(): react.JSX.Element;
442
481
 
443
482
  declare function ResetController(): react.JSX.Element;
444
483
 
445
- export { AccessibilityButton, type AccessibilityButtonProps, AccessibilityContext, type AccessibilityContextValue, AccessibilityList, type AccessibilityListProps, AccessibilityPlugin, type AccessibilityPluginProps, type AccessibilityPreferences, type AccessibilityState, BigCursorController, ChoiceControl, type ChoiceControlProps, type ChoiceGroup, type ChoiceOption, ContrastController, type ContrastMode, type CursorSizePreference, DEFAULT_PREFERENCES, EmptyState, type EmptyStateProps, ErrorState, type ErrorStateProps, FeatureCard, type FeatureCardProps, type FeatureOptions, type FeatureRegistration, type FeatureStatus, type FontFamilyPreference, FontSizeController, type FontSizeControllerProps, GrayscaleController, HideImagesController, HideVideosController, InvertColorsController, LINE_HEIGHT_RATIOS, LINE_HEIGHT_STEPS, LetterSpacingController, type LetterSpacingControllerProps, LineHeightController, type LineHeightControllerProps, LinkHighlightController, type LocaleStrings, PROFILE_DEFINITIONS, ParagraphSpacingController, type ParagraphSpacingControllerProps, type PluginPosition, type ProfileDefinition, type ProfilePresetId, ProfilePreviewCard, type ProfilePreviewCardProps, type ReaderMode, ReadingGuideController, ReadingMaskController, ResetController, SaturationController, type SaturationPreference, type ScriptSpacingConstraints, SearchCount, type SearchCountProps, StepperControl, type StepperControlProps, type StorageMode, type SupportedLocale, TEXT_SCALE_PROTECTED_SELECTOR, TEXT_SCALE_STEPS, TEXT_SPACING_EXCLUDED_SELECTOR, TextAlignController, type TextAlignPreference, TextScaleController, type TextScaleControllerProps, type TextScaleStep, ToggleControl, type ToggleControlProps, type WidgetPlacement, WordSpacingController, type WordSpacingControllerProps, createInitialPreferencesState, enLocale, getScriptSpacingConstraints, isProtectedFromTextScale, isProtectedFromTextSpacing, isRtlLocale, normalizePreferenceValue, normalizePreferences, preferencesReducer, registerLocale, resolveEffectivePreferences, resolveLocaleStrings, useAccessibility };
484
+ export { AccessibilityButton, type AccessibilityButtonProps, AccessibilityContext, type AccessibilityContextValue, AccessibilityList, type AccessibilityListProps, AccessibilityPlugin, type AccessibilityPluginProps, type AccessibilityPreferences, type AccessibilityState, BigCursorController, CONTRAST_MODES, CONTRAST_PALETTES, CONTRAST_PROTECTED_SELECTOR, ChoiceControl, type ChoiceControlProps, type ChoiceGroup, type ChoiceOption, ContrastController, type ContrastMode, ContrastModeController, type ContrastModeValue, type ContrastPalette, type CursorSizePreference, DEFAULT_PREFERENCES, DYSLEXIA_FONT_STACK, EmptyState, type EmptyStateProps, ErrorState, type ErrorStateProps, FONT_FAMILY_PRESETS, FONT_FAMILY_PROTECTED_SELECTOR, FeatureCard, type FeatureCardProps, type FeatureOptions, type FeatureRegistration, type FeatureStatus, FontFamilyController, type FontFamilyPreference, type FontFamilyPreset, FontSizeController, type FontSizeControllerProps, GrayscaleController, HideImagesController, HideVideosController, InvertColorsController, LEGIBLE_FONT_STACK, LINE_HEIGHT_RATIOS, LINE_HEIGHT_STEPS, LetterSpacingController, type LetterSpacingControllerProps, LineHeightController, type LineHeightControllerProps, LinkHighlightController, type LocaleStrings, PROFILE_DEFINITIONS, ParagraphSpacingController, type ParagraphSpacingControllerProps, type PluginPosition, type ProfileDefinition, type ProfilePresetId, ProfilePreviewCard, type ProfilePreviewCardProps, type ReaderMode, ReadingGuideController, ReadingMaskController, ResetController, SaturationController, type SaturationPreference, type ScriptSpacingConstraints, SearchCount, type SearchCountProps, StepperControl, type StepperControlProps, type StorageMode, type SupportedLocale, TEXT_ALIGN_BLOCK_SELECTOR, TEXT_SCALE_PROTECTED_SELECTOR, TEXT_SCALE_STEPS, TEXT_SPACING_EXCLUDED_SELECTOR, TextAlignController, type TextAlignPreference, TextScaleController, type TextScaleControllerProps, type TextScaleStep, ToggleControl, type ToggleControlProps, type WidgetPlacement, WordSpacingController, type WordSpacingControllerProps, createInitialPreferencesState, enLocale, getScriptSpacingConstraints, isForcedColorsActive, isProtectedFromContrast, isProtectedFromFontFamily, isProtectedFromTextAlign, isProtectedFromTextScale, isProtectedFromTextSpacing, isRtlLocale, normalizePreferenceValue, normalizePreferences, preferencesReducer, registerLocale, resolveEffectivePreferences, resolveLocaleStrings, useAccessibility };