accessibility-plugin-react 2.4.0 → 2.6.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,24 +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 from 50% to 200%. |
96
- | `LetterSpacingController` | Applies 0–10px letter spacing. |
97
- | `ContrastController` | Turns contrast off, reduces it, increases it, or selects a named palette. |
98
- | `SaturationController` | Reduces or increases saturation. |
99
- | `InvertColorsController` | Inverts eligible page content. |
100
- | `GrayscaleController` | Removes color while preserving the selected saturation value for later. |
101
- | `LinkHighlightController` | Highlights links or selects a link palette. |
102
- | `TextAlignController` | Restores the host alignment or forces left, center, right, or justified text. |
103
- | `HideImagesController` | Hides images and CSS background images while retaining layout. |
104
- | `HideVideosController` | Hides video elements and recognized YouTube/Vimeo embeds visually. |
105
- | `BigCursorController` | Applies a larger high-contrast cursor where supported. |
106
- | `ReadingMaskController` | Dims the page around a transparent reading window. |
107
- | `ReadingGuideController` | Follows pointer/focus with a reading guide line. |
108
- | `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
+ | `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` | 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. |
109
112
 
110
113
  Effects compose where appropriate. For example, contrast, saturation, invert,
111
114
  and grayscale are applied in a deterministic order. Defaults leave host styles
package/dist/index.d.mts CHANGED
@@ -88,6 +88,9 @@ interface LocaleStrings {
88
88
  resetAll: string;
89
89
  statementLink: string;
90
90
  openInNewTab: string;
91
+ creditsPrefix?: string;
92
+ creditsName?: string;
93
+ documentationLink?: string;
91
94
  buttonTitle: string;
92
95
  dragHelp: string;
93
96
  positionLabel: string;
@@ -361,13 +364,78 @@ declare function TextScaleController({ steps, label, }?: TextScaleControllerProp
361
364
  */
362
365
  declare const TEXT_SCALE_STEPS: readonly [1, 1.125, 1.25, 1.5, 2];
363
366
  type TextScaleStep = (typeof TEXT_SCALE_STEPS)[number];
367
+ /**
368
+ * Standard WCAG SC 1.4.12 line height options: 1.0 (baseline), 1.5 (150%), 1.75 (175%), 2.0 (200%).
369
+ */
370
+ declare const LINE_HEIGHT_STEPS: readonly [100, 150, 175, 200];
371
+ declare const LINE_HEIGHT_RATIOS: readonly [1, 1.5, 1.75, 2];
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];
364
377
 
365
378
  declare const TEXT_SCALE_PROTECTED_SELECTOR: string;
366
379
  declare function isProtectedFromTextScale(element: HTMLElement): boolean;
380
+ declare const TEXT_SPACING_EXCLUDED_SELECTOR: string;
381
+ declare function isProtectedFromTextSpacing(element: HTMLElement): boolean;
382
+ declare const TEXT_ALIGN_BLOCK_SELECTOR: string;
383
+ declare function isProtectedFromTextAlign(element: HTMLElement): boolean;
384
+ /**
385
+ * Standard legible font stack with Sinhala ("Noto Sans Sinhala", "Iskoola Pota")
386
+ * and Tamil ("Noto Sans Tamil", "Latha", "Nirmala UI") script fallbacks.
387
+ */
388
+ declare const LEGIBLE_FONT_STACK: string;
389
+ /**
390
+ * Dyslexia-friendly font stack with OpenDyslexic (licensed under SIL OFL / CC-BY),
391
+ * weighted rounded fallbacks, and Indic/Sinhala/Tamil script fallbacks.
392
+ */
393
+ declare const DYSLEXIA_FONT_STACK: string;
394
+ declare const FONT_FAMILY_PROTECTED_SELECTOR: string;
395
+ declare function isProtectedFromFontFamily(element: HTMLElement): boolean;
396
+ interface ScriptSpacingConstraints {
397
+ allowLetterSpacing: boolean;
398
+ maxLetterSpacingPx: number;
399
+ script: "cursive" | "indic" | "standard";
400
+ }
401
+ declare function getScriptSpacingConstraints(element: HTMLElement): ScriptSpacingConstraints;
367
402
 
368
- declare function LineHeightController(): react.JSX.Element;
403
+ interface LineHeightControllerProps {
404
+ /**
405
+ * Optional custom line height steps (percentages or factors, e.g. [100, 150, 175, 200] or [1.0, 1.5, 1.75, 2.0]).
406
+ * If provided, the stepper snaps to the nearest configured step.
407
+ */
408
+ steps?: readonly number[];
409
+ /**
410
+ * Optional preset step mode: when true, snaps to standard WCAG SC 1.4.12 line height options: 100%, 150%, 175%, 200% (1.0x, 1.5x, 1.75x, 2.0x).
411
+ */
412
+ stepPresets?: boolean;
413
+ }
414
+ declare function LineHeightController({ steps: customSteps, stepPresets, }?: LineHeightControllerProps): react.JSX.Element;
415
+
416
+ interface LetterSpacingControllerProps {
417
+ min?: number;
418
+ max?: number;
419
+ step?: number;
420
+ steps?: readonly number[];
421
+ }
422
+ declare function LetterSpacingController({ min, max, step, steps, }?: LetterSpacingControllerProps): react.JSX.Element;
369
423
 
370
- declare function LetterSpacingController(): react.JSX.Element;
424
+ interface WordSpacingControllerProps {
425
+ min?: number;
426
+ max?: number;
427
+ step?: number;
428
+ steps?: readonly number[];
429
+ }
430
+ declare function WordSpacingController({ min, max, step, steps, }?: WordSpacingControllerProps): react.JSX.Element;
431
+
432
+ interface ParagraphSpacingControllerProps {
433
+ min?: number;
434
+ max?: number;
435
+ step?: number;
436
+ steps?: readonly number[];
437
+ }
438
+ declare function ParagraphSpacingController({ min, max, step, steps, }?: ParagraphSpacingControllerProps): react.JSX.Element;
371
439
 
372
440
  declare function ContrastController(): react.JSX.Element;
373
441
 
@@ -381,6 +449,8 @@ declare function LinkHighlightController(): react.JSX.Element;
381
449
 
382
450
  declare function TextAlignController(): react.JSX.Element;
383
451
 
452
+ declare function FontFamilyController(): react.JSX.Element;
453
+
384
454
  declare function HideImagesController(): react.JSX.Element;
385
455
 
386
456
  declare function HideVideosController(): react.JSX.Element;
@@ -393,4 +463,4 @@ declare function ReadingGuideController(): react.JSX.Element;
393
463
 
394
464
  declare function ResetController(): react.JSX.Element;
395
465
 
396
- 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, LetterSpacingController, LineHeightController, LinkHighlightController, type LocaleStrings, PROFILE_DEFINITIONS, type PluginPosition, type ProfileDefinition, type ProfilePresetId, ProfilePreviewCard, type ProfilePreviewCardProps, type ReaderMode, ReadingGuideController, ReadingMaskController, ResetController, SaturationController, type SaturationPreference, SearchCount, type SearchCountProps, StepperControl, type StepperControlProps, type StorageMode, type SupportedLocale, TEXT_SCALE_PROTECTED_SELECTOR, TEXT_SCALE_STEPS, TextAlignController, type TextAlignPreference, TextScaleController, type TextScaleControllerProps, type TextScaleStep, ToggleControl, type ToggleControlProps, type WidgetPlacement, createInitialPreferencesState, enLocale, isProtectedFromTextScale, isRtlLocale, normalizePreferenceValue, normalizePreferences, preferencesReducer, registerLocale, resolveEffectivePreferences, resolveLocaleStrings, useAccessibility };
466
+ 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, 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, isProtectedFromFontFamily, isProtectedFromTextAlign, isProtectedFromTextScale, isProtectedFromTextSpacing, isRtlLocale, normalizePreferenceValue, normalizePreferences, preferencesReducer, registerLocale, resolveEffectivePreferences, resolveLocaleStrings, useAccessibility };
package/dist/index.d.ts CHANGED
@@ -88,6 +88,9 @@ interface LocaleStrings {
88
88
  resetAll: string;
89
89
  statementLink: string;
90
90
  openInNewTab: string;
91
+ creditsPrefix?: string;
92
+ creditsName?: string;
93
+ documentationLink?: string;
91
94
  buttonTitle: string;
92
95
  dragHelp: string;
93
96
  positionLabel: string;
@@ -361,13 +364,78 @@ declare function TextScaleController({ steps, label, }?: TextScaleControllerProp
361
364
  */
362
365
  declare const TEXT_SCALE_STEPS: readonly [1, 1.125, 1.25, 1.5, 2];
363
366
  type TextScaleStep = (typeof TEXT_SCALE_STEPS)[number];
367
+ /**
368
+ * Standard WCAG SC 1.4.12 line height options: 1.0 (baseline), 1.5 (150%), 1.75 (175%), 2.0 (200%).
369
+ */
370
+ declare const LINE_HEIGHT_STEPS: readonly [100, 150, 175, 200];
371
+ declare const LINE_HEIGHT_RATIOS: readonly [1, 1.5, 1.75, 2];
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];
364
377
 
365
378
  declare const TEXT_SCALE_PROTECTED_SELECTOR: string;
366
379
  declare function isProtectedFromTextScale(element: HTMLElement): boolean;
380
+ declare const TEXT_SPACING_EXCLUDED_SELECTOR: string;
381
+ declare function isProtectedFromTextSpacing(element: HTMLElement): boolean;
382
+ declare const TEXT_ALIGN_BLOCK_SELECTOR: string;
383
+ declare function isProtectedFromTextAlign(element: HTMLElement): boolean;
384
+ /**
385
+ * Standard legible font stack with Sinhala ("Noto Sans Sinhala", "Iskoola Pota")
386
+ * and Tamil ("Noto Sans Tamil", "Latha", "Nirmala UI") script fallbacks.
387
+ */
388
+ declare const LEGIBLE_FONT_STACK: string;
389
+ /**
390
+ * Dyslexia-friendly font stack with OpenDyslexic (licensed under SIL OFL / CC-BY),
391
+ * weighted rounded fallbacks, and Indic/Sinhala/Tamil script fallbacks.
392
+ */
393
+ declare const DYSLEXIA_FONT_STACK: string;
394
+ declare const FONT_FAMILY_PROTECTED_SELECTOR: string;
395
+ declare function isProtectedFromFontFamily(element: HTMLElement): boolean;
396
+ interface ScriptSpacingConstraints {
397
+ allowLetterSpacing: boolean;
398
+ maxLetterSpacingPx: number;
399
+ script: "cursive" | "indic" | "standard";
400
+ }
401
+ declare function getScriptSpacingConstraints(element: HTMLElement): ScriptSpacingConstraints;
367
402
 
368
- declare function LineHeightController(): react.JSX.Element;
403
+ interface LineHeightControllerProps {
404
+ /**
405
+ * Optional custom line height steps (percentages or factors, e.g. [100, 150, 175, 200] or [1.0, 1.5, 1.75, 2.0]).
406
+ * If provided, the stepper snaps to the nearest configured step.
407
+ */
408
+ steps?: readonly number[];
409
+ /**
410
+ * Optional preset step mode: when true, snaps to standard WCAG SC 1.4.12 line height options: 100%, 150%, 175%, 200% (1.0x, 1.5x, 1.75x, 2.0x).
411
+ */
412
+ stepPresets?: boolean;
413
+ }
414
+ declare function LineHeightController({ steps: customSteps, stepPresets, }?: LineHeightControllerProps): react.JSX.Element;
415
+
416
+ interface LetterSpacingControllerProps {
417
+ min?: number;
418
+ max?: number;
419
+ step?: number;
420
+ steps?: readonly number[];
421
+ }
422
+ declare function LetterSpacingController({ min, max, step, steps, }?: LetterSpacingControllerProps): react.JSX.Element;
369
423
 
370
- declare function LetterSpacingController(): react.JSX.Element;
424
+ interface WordSpacingControllerProps {
425
+ min?: number;
426
+ max?: number;
427
+ step?: number;
428
+ steps?: readonly number[];
429
+ }
430
+ declare function WordSpacingController({ min, max, step, steps, }?: WordSpacingControllerProps): react.JSX.Element;
431
+
432
+ interface ParagraphSpacingControllerProps {
433
+ min?: number;
434
+ max?: number;
435
+ step?: number;
436
+ steps?: readonly number[];
437
+ }
438
+ declare function ParagraphSpacingController({ min, max, step, steps, }?: ParagraphSpacingControllerProps): react.JSX.Element;
371
439
 
372
440
  declare function ContrastController(): react.JSX.Element;
373
441
 
@@ -381,6 +449,8 @@ declare function LinkHighlightController(): react.JSX.Element;
381
449
 
382
450
  declare function TextAlignController(): react.JSX.Element;
383
451
 
452
+ declare function FontFamilyController(): react.JSX.Element;
453
+
384
454
  declare function HideImagesController(): react.JSX.Element;
385
455
 
386
456
  declare function HideVideosController(): react.JSX.Element;
@@ -393,4 +463,4 @@ declare function ReadingGuideController(): react.JSX.Element;
393
463
 
394
464
  declare function ResetController(): react.JSX.Element;
395
465
 
396
- 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, LetterSpacingController, LineHeightController, LinkHighlightController, type LocaleStrings, PROFILE_DEFINITIONS, type PluginPosition, type ProfileDefinition, type ProfilePresetId, ProfilePreviewCard, type ProfilePreviewCardProps, type ReaderMode, ReadingGuideController, ReadingMaskController, ResetController, SaturationController, type SaturationPreference, SearchCount, type SearchCountProps, StepperControl, type StepperControlProps, type StorageMode, type SupportedLocale, TEXT_SCALE_PROTECTED_SELECTOR, TEXT_SCALE_STEPS, TextAlignController, type TextAlignPreference, TextScaleController, type TextScaleControllerProps, type TextScaleStep, ToggleControl, type ToggleControlProps, type WidgetPlacement, createInitialPreferencesState, enLocale, isProtectedFromTextScale, isRtlLocale, normalizePreferenceValue, normalizePreferences, preferencesReducer, registerLocale, resolveEffectivePreferences, resolveLocaleStrings, useAccessibility };
466
+ 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, 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, isProtectedFromFontFamily, isProtectedFromTextAlign, isProtectedFromTextScale, isProtectedFromTextSpacing, isRtlLocale, normalizePreferenceValue, normalizePreferences, preferencesReducer, registerLocale, resolveEffectivePreferences, resolveLocaleStrings, useAccessibility };