accessibility-plugin-react 2.3.2 → 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,23 +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
- | `FontSizeController` | Scales eligible HTML text from 50% to 200%. |
94
- | `LineHeightController` | Scales computed line height from 50% to 200%. |
95
- | `LetterSpacingController` | Applies 0–10px letter spacing. |
96
- | `ContrastController` | Turns contrast off, reduces it, increases it, or selects a named palette. |
97
- | `SaturationController` | Reduces or increases saturation. |
98
- | `InvertColorsController` | Inverts eligible page content. |
99
- | `GrayscaleController` | Removes color while preserving the selected saturation value for later. |
100
- | `LinkHighlightController` | Highlights links or selects a link palette. |
101
- | `TextAlignController` | Restores the host alignment or forces left, center, right, or justified text. |
102
- | `HideImagesController` | Hides images and CSS background images while retaining layout. |
103
- | `HideVideosController` | Hides video elements and recognized YouTube/Vimeo embeds visually. |
104
- | `BigCursorController` | Applies a larger high-contrast cursor where supported. |
105
- | `ReadingMaskController` | Dims the page around a transparent reading window. |
106
- | `ReadingGuideController` | Follows pointer/focus with a reading guide line. |
107
- | `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. |
108
111
 
109
112
  Effects compose where appropriate. For example, contrast, saturation, invert,
110
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;
@@ -331,11 +334,89 @@ declare function useAccessibility<T>(featureKey: string, defaultValue: T, option
331
334
 
332
335
  declare const AccessibilityContext: react.Context<AccessibilityContextValue | null>;
333
336
 
334
- declare function FontSizeController(): react.JSX.Element;
337
+ interface FontSizeControllerProps {
338
+ /**
339
+ * Optional custom scale steps (percentages or factors, e.g. [100, 112.5, 125, 150, 200] or [1.0, 1.125, 1.25, 1.5, 2.0]).
340
+ * If provided, the stepper snaps to the nearest configured step.
341
+ */
342
+ steps?: readonly number[];
343
+ /**
344
+ * Optional step scale mode: when true, snaps to standard WCAG reflow steps: 100%, 112.5%, 125%, 150%, 200%.
345
+ */
346
+ stepScale?: boolean;
347
+ }
348
+ declare function FontSizeController({ steps: customSteps, stepScale, }?: FontSizeControllerProps): react.JSX.Element;
349
+
350
+ interface TextScaleControllerProps {
351
+ /**
352
+ * Custom scale factor steps. Default: [1.0, 1.125, 1.25, 1.5, 2.0].
353
+ */
354
+ steps?: readonly number[];
355
+ /**
356
+ * Accessible group label and visible title. Default: "Bigger Text".
357
+ */
358
+ label?: string;
359
+ }
360
+ declare function TextScaleController({ steps, label, }?: TextScaleControllerProps): react.JSX.Element;
361
+
362
+ /**
363
+ * Reflow-safe text scale steps: 1x baseline, 1.125x subtle, 1.25x medium, 1.5x large, 2.0x maximum.
364
+ */
365
+ declare const TEXT_SCALE_STEPS: readonly [1, 1.125, 1.25, 1.5, 2];
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
+ declare const TEXT_SCALE_PROTECTED_SELECTOR: string;
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;
335
396
 
336
- 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;
404
+
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;
337
412
 
338
- declare function LetterSpacingController(): react.JSX.Element;
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;
339
420
 
340
421
  declare function ContrastController(): react.JSX.Element;
341
422
 
@@ -361,4 +442,4 @@ declare function ReadingGuideController(): react.JSX.Element;
361
442
 
362
443
  declare function ResetController(): react.JSX.Element;
363
444
 
364
- 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, 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, TextAlignController, type TextAlignPreference, ToggleControl, type ToggleControlProps, type WidgetPlacement, createInitialPreferencesState, enLocale, 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;
@@ -331,11 +334,89 @@ declare function useAccessibility<T>(featureKey: string, defaultValue: T, option
331
334
 
332
335
  declare const AccessibilityContext: react.Context<AccessibilityContextValue | null>;
333
336
 
334
- declare function FontSizeController(): react.JSX.Element;
337
+ interface FontSizeControllerProps {
338
+ /**
339
+ * Optional custom scale steps (percentages or factors, e.g. [100, 112.5, 125, 150, 200] or [1.0, 1.125, 1.25, 1.5, 2.0]).
340
+ * If provided, the stepper snaps to the nearest configured step.
341
+ */
342
+ steps?: readonly number[];
343
+ /**
344
+ * Optional step scale mode: when true, snaps to standard WCAG reflow steps: 100%, 112.5%, 125%, 150%, 200%.
345
+ */
346
+ stepScale?: boolean;
347
+ }
348
+ declare function FontSizeController({ steps: customSteps, stepScale, }?: FontSizeControllerProps): react.JSX.Element;
349
+
350
+ interface TextScaleControllerProps {
351
+ /**
352
+ * Custom scale factor steps. Default: [1.0, 1.125, 1.25, 1.5, 2.0].
353
+ */
354
+ steps?: readonly number[];
355
+ /**
356
+ * Accessible group label and visible title. Default: "Bigger Text".
357
+ */
358
+ label?: string;
359
+ }
360
+ declare function TextScaleController({ steps, label, }?: TextScaleControllerProps): react.JSX.Element;
361
+
362
+ /**
363
+ * Reflow-safe text scale steps: 1x baseline, 1.125x subtle, 1.25x medium, 1.5x large, 2.0x maximum.
364
+ */
365
+ declare const TEXT_SCALE_STEPS: readonly [1, 1.125, 1.25, 1.5, 2];
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
+ declare const TEXT_SCALE_PROTECTED_SELECTOR: string;
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;
335
396
 
336
- 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;
404
+
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;
337
412
 
338
- declare function LetterSpacingController(): react.JSX.Element;
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;
339
420
 
340
421
  declare function ContrastController(): react.JSX.Element;
341
422
 
@@ -361,4 +442,4 @@ declare function ReadingGuideController(): react.JSX.Element;
361
442
 
362
443
  declare function ResetController(): react.JSX.Element;
363
444
 
364
- 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, 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, TextAlignController, type TextAlignPreference, ToggleControl, type ToggleControlProps, type WidgetPlacement, createInitialPreferencesState, enLocale, 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 };