accessibility-plugin-react 2.4.0 → 2.5.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,26 @@ 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` | 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. |
109
111
 
110
112
  Effects compose where appropriate. For example, contrast, saturation, invert,
111
113
  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,59 @@ 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];
364
372
 
365
373
  declare const TEXT_SCALE_PROTECTED_SELECTOR: string;
366
374
  declare function isProtectedFromTextScale(element: HTMLElement): boolean;
375
+ declare const TEXT_SPACING_EXCLUDED_SELECTOR: string;
376
+ declare function isProtectedFromTextSpacing(element: HTMLElement): boolean;
377
+ interface ScriptSpacingConstraints {
378
+ allowLetterSpacing: boolean;
379
+ maxLetterSpacingPx: number;
380
+ script: "cursive" | "indic" | "standard";
381
+ }
382
+ declare function getScriptSpacingConstraints(element: HTMLElement): ScriptSpacingConstraints;
383
+
384
+ interface LineHeightControllerProps {
385
+ /**
386
+ * Optional custom line height steps (percentages or factors, e.g. [100, 150, 175, 200] or [1.0, 1.5, 1.75, 2.0]).
387
+ * If provided, the stepper snaps to the nearest configured step.
388
+ */
389
+ steps?: readonly number[];
390
+ /**
391
+ * 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).
392
+ */
393
+ stepPresets?: boolean;
394
+ }
395
+ declare function LineHeightController({ steps: customSteps, stepPresets, }?: LineHeightControllerProps): react.JSX.Element;
367
396
 
368
- declare function LineHeightController(): react.JSX.Element;
397
+ interface LetterSpacingControllerProps {
398
+ min?: number;
399
+ max?: number;
400
+ step?: number;
401
+ steps?: readonly number[];
402
+ }
403
+ declare function LetterSpacingController({ min, max, step, steps, }?: LetterSpacingControllerProps): react.JSX.Element;
369
404
 
370
- declare function LetterSpacingController(): react.JSX.Element;
405
+ interface WordSpacingControllerProps {
406
+ min?: number;
407
+ max?: number;
408
+ step?: number;
409
+ steps?: readonly number[];
410
+ }
411
+ declare function WordSpacingController({ min, max, step, steps, }?: WordSpacingControllerProps): react.JSX.Element;
412
+
413
+ interface ParagraphSpacingControllerProps {
414
+ min?: number;
415
+ max?: number;
416
+ step?: number;
417
+ steps?: readonly number[];
418
+ }
419
+ declare function ParagraphSpacingController({ min, max, step, steps, }?: ParagraphSpacingControllerProps): react.JSX.Element;
371
420
 
372
421
  declare function ContrastController(): react.JSX.Element;
373
422
 
@@ -393,4 +442,4 @@ declare function ReadingGuideController(): react.JSX.Element;
393
442
 
394
443
  declare function ResetController(): react.JSX.Element;
395
444
 
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 };
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 };
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,59 @@ 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];
364
372
 
365
373
  declare const TEXT_SCALE_PROTECTED_SELECTOR: string;
366
374
  declare function isProtectedFromTextScale(element: HTMLElement): boolean;
375
+ declare const TEXT_SPACING_EXCLUDED_SELECTOR: string;
376
+ declare function isProtectedFromTextSpacing(element: HTMLElement): boolean;
377
+ interface ScriptSpacingConstraints {
378
+ allowLetterSpacing: boolean;
379
+ maxLetterSpacingPx: number;
380
+ script: "cursive" | "indic" | "standard";
381
+ }
382
+ declare function getScriptSpacingConstraints(element: HTMLElement): ScriptSpacingConstraints;
383
+
384
+ interface LineHeightControllerProps {
385
+ /**
386
+ * Optional custom line height steps (percentages or factors, e.g. [100, 150, 175, 200] or [1.0, 1.5, 1.75, 2.0]).
387
+ * If provided, the stepper snaps to the nearest configured step.
388
+ */
389
+ steps?: readonly number[];
390
+ /**
391
+ * 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).
392
+ */
393
+ stepPresets?: boolean;
394
+ }
395
+ declare function LineHeightController({ steps: customSteps, stepPresets, }?: LineHeightControllerProps): react.JSX.Element;
367
396
 
368
- declare function LineHeightController(): react.JSX.Element;
397
+ interface LetterSpacingControllerProps {
398
+ min?: number;
399
+ max?: number;
400
+ step?: number;
401
+ steps?: readonly number[];
402
+ }
403
+ declare function LetterSpacingController({ min, max, step, steps, }?: LetterSpacingControllerProps): react.JSX.Element;
369
404
 
370
- declare function LetterSpacingController(): react.JSX.Element;
405
+ interface WordSpacingControllerProps {
406
+ min?: number;
407
+ max?: number;
408
+ step?: number;
409
+ steps?: readonly number[];
410
+ }
411
+ declare function WordSpacingController({ min, max, step, steps, }?: WordSpacingControllerProps): react.JSX.Element;
412
+
413
+ interface ParagraphSpacingControllerProps {
414
+ min?: number;
415
+ max?: number;
416
+ step?: number;
417
+ steps?: readonly number[];
418
+ }
419
+ declare function ParagraphSpacingController({ min, max, step, steps, }?: ParagraphSpacingControllerProps): react.JSX.Element;
371
420
 
372
421
  declare function ContrastController(): react.JSX.Element;
373
422
 
@@ -393,4 +442,4 @@ declare function ReadingGuideController(): react.JSX.Element;
393
442
 
394
443
  declare function ResetController(): react.JSX.Element;
395
444
 
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 };
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 };