accessibility-plugin-react 2.16.0 → 2.18.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 +2 -0
- package/dist/index.d.mts +116 -7
- package/dist/index.d.ts +116 -7
- package/dist/index.js +987 -126
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +944 -83
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +368 -1
- package/docs/API.md +4 -4
- package/docs/BUILD_AND_RELEASE_PLAN.md +2 -2
- package/docs/FEATURES.md +2 -0
- package/docs/LOCALES.md +149 -0
- package/docs/READING_MODE.md +128 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -283,6 +283,8 @@ See [troubleshooting](docs/TROUBLESHOOTING.md) before filing an issue.
|
|
|
283
283
|
- [Feature behavior and bounds](docs/FEATURES.md)
|
|
284
284
|
- [Link highlighting, focus visibility, and landmark skip links](docs/LINKS_AND_FOCUS.md)
|
|
285
285
|
- [Reduce motion and media controls](docs/REDUCE_MOTION.md)
|
|
286
|
+
- [Internationalization and locale packs](docs/LOCALES.md)
|
|
287
|
+
- [Non-destructive reading mode](docs/READING_MODE.md)
|
|
286
288
|
- [Contrast modes and forced-colors protection](docs/CONTRAST.md)
|
|
287
289
|
- [Legible and dyslexia font stacks](docs/FONTS.md)
|
|
288
290
|
- [Installation and Next.js](docs/INSTALLATION.md)
|
package/dist/index.d.mts
CHANGED
|
@@ -83,6 +83,25 @@ declare function resolveEffectivePreferences(base: AccessibilityPreferences, pro
|
|
|
83
83
|
declare function createInitialPreferencesState(initial?: Partial<AccessibilityPreferences> | null): PreferencesState;
|
|
84
84
|
declare function preferencesReducer(state: PreferencesState, action: PreferencesAction): PreferencesState;
|
|
85
85
|
|
|
86
|
+
interface FeatureLocaleLabels {
|
|
87
|
+
textScale?: string;
|
|
88
|
+
lineHeight?: string;
|
|
89
|
+
letterSpacing?: string;
|
|
90
|
+
wordSpacing?: string;
|
|
91
|
+
paragraphSpacing?: string;
|
|
92
|
+
textAlign?: string;
|
|
93
|
+
fontFamily?: string;
|
|
94
|
+
contrast?: string;
|
|
95
|
+
highlightLinks?: string;
|
|
96
|
+
focusOutline?: string;
|
|
97
|
+
reduceMotion?: string;
|
|
98
|
+
cursorGuide?: string;
|
|
99
|
+
headingsNavigator?: string;
|
|
100
|
+
profiles?: string;
|
|
101
|
+
presets?: string;
|
|
102
|
+
readingMode?: string;
|
|
103
|
+
[key: string]: string | undefined;
|
|
104
|
+
}
|
|
86
105
|
interface LocaleStrings {
|
|
87
106
|
title: string;
|
|
88
107
|
description: string;
|
|
@@ -112,13 +131,38 @@ interface LocaleStrings {
|
|
|
112
131
|
moveDown: string;
|
|
113
132
|
moveRight: string;
|
|
114
133
|
largeControlsLabel: string;
|
|
134
|
+
cornerNames?: Record<string, string>;
|
|
115
135
|
formatPointPosition?: (x: number, y: number) => string;
|
|
116
136
|
formatCornerPosition?: (corner: string) => string;
|
|
117
|
-
|
|
118
|
-
|
|
137
|
+
searchPlaceholder?: string;
|
|
138
|
+
searchClearLabel?: string;
|
|
139
|
+
formatSearchCount?: (matched: number, total: number, query?: string) => string;
|
|
140
|
+
emptySearchTitle?: string;
|
|
141
|
+
emptySearchDescription?: string;
|
|
142
|
+
clearSearchLabel?: string;
|
|
143
|
+
formatProfileApplied?: (profileName: string) => string;
|
|
144
|
+
formatProfileReverted?: () => string;
|
|
145
|
+
formatPresetSaved?: (presetName: string) => string;
|
|
146
|
+
formatPresetApplied?: (presetName: string) => string;
|
|
147
|
+
formatPresetDeleted?: (presetName: string) => string;
|
|
148
|
+
decreaseTextSize?: string;
|
|
149
|
+
increaseTextSize?: string;
|
|
150
|
+
readingModeDescription?: string;
|
|
151
|
+
readingModeOpen?: string;
|
|
152
|
+
readingModeClose?: string;
|
|
153
|
+
readingModeFailed?: string;
|
|
154
|
+
formatReadingWords?: (words: number) => string;
|
|
155
|
+
formatReadingTime?: (minutes: number) => string;
|
|
156
|
+
features?: FeatureLocaleLabels;
|
|
157
|
+
}
|
|
158
|
+
type SupportedLocale = "en" | "en-US" | "en-GB" | "si" | "si-LK" | "ta" | "ta-LK" | string;
|
|
119
159
|
|
|
120
160
|
declare const enLocale: Readonly<LocaleStrings>;
|
|
121
161
|
|
|
162
|
+
declare const siLocale: Readonly<LocaleStrings>;
|
|
163
|
+
|
|
164
|
+
declare const taLocale: Readonly<LocaleStrings>;
|
|
165
|
+
|
|
122
166
|
declare function registerLocale(code: string, strings: LocaleStrings): void;
|
|
123
167
|
declare function isRtlLocale(localeProp?: string): boolean;
|
|
124
168
|
declare function resolveLocaleStrings(localeProp?: string): LocaleStrings;
|
|
@@ -209,8 +253,9 @@ interface SearchCountProps {
|
|
|
209
253
|
query?: string;
|
|
210
254
|
className?: string;
|
|
211
255
|
style?: CSSProperties;
|
|
256
|
+
locale?: string;
|
|
212
257
|
}
|
|
213
|
-
declare function SearchCount({ totalCount, matchedCount, query, className, style, }: SearchCountProps): react.JSX.Element;
|
|
258
|
+
declare function SearchCount({ totalCount, matchedCount, query, className, style, locale, }: SearchCountProps): react.JSX.Element;
|
|
214
259
|
interface EmptyStateProps {
|
|
215
260
|
title?: string;
|
|
216
261
|
description?: string;
|
|
@@ -219,8 +264,9 @@ interface EmptyStateProps {
|
|
|
219
264
|
icon?: ReactNode;
|
|
220
265
|
className?: string;
|
|
221
266
|
style?: CSSProperties;
|
|
267
|
+
locale?: string;
|
|
222
268
|
}
|
|
223
|
-
declare function EmptyState({ title, description, actionLabel, onAction, icon, className, style, }: EmptyStateProps): react.JSX.Element;
|
|
269
|
+
declare function EmptyState({ title, description, actionLabel, onAction, icon, className, style, locale, }: EmptyStateProps): react.JSX.Element;
|
|
224
270
|
interface ErrorStateProps {
|
|
225
271
|
title?: string;
|
|
226
272
|
message: string;
|
|
@@ -426,7 +472,7 @@ interface TextScaleControllerProps {
|
|
|
426
472
|
*/
|
|
427
473
|
steps?: readonly number[];
|
|
428
474
|
/**
|
|
429
|
-
* Accessible group label and visible title. Default: "Bigger Text".
|
|
475
|
+
* Accessible group label and visible title. Default: "Bigger Text" (or localized).
|
|
430
476
|
*/
|
|
431
477
|
label?: string;
|
|
432
478
|
}
|
|
@@ -704,11 +750,74 @@ interface PresetsControllerProps {
|
|
|
704
750
|
description?: string;
|
|
705
751
|
largeControls?: boolean;
|
|
706
752
|
}
|
|
707
|
-
declare function PresetsController({ className, label, description, largeControls, }
|
|
753
|
+
declare function PresetsController({ className, label, description, largeControls, }?: PresetsControllerProps): react.JSX.Element;
|
|
708
754
|
declare const CustomPresetsController: typeof PresetsController;
|
|
709
755
|
declare const SettingsImportExportController: typeof PresetsController;
|
|
710
756
|
declare const PresetsBackupController: typeof PresetsController;
|
|
711
757
|
|
|
758
|
+
/**
|
|
759
|
+
* Non-destructive article content extraction for Reading Mode.
|
|
760
|
+
*
|
|
761
|
+
* Extracts readable article content from candidate containers without mutating
|
|
762
|
+
* or destroying host React DOM elements.
|
|
763
|
+
*
|
|
764
|
+
* Filters out:
|
|
765
|
+
* - Forms, interactive inputs, buttons, and sensitive fields (passwords, cards, hidden tokens)
|
|
766
|
+
* - Navigation menus, headers, footers, sidebars, cookie banners, advertisements
|
|
767
|
+
* - Scripts, styles, iframes, embeds, and dialogs
|
|
768
|
+
*
|
|
769
|
+
* Preserves:
|
|
770
|
+
* - Semantic headings (h1-h6), paragraphs (p), lists (ul, ol, li)
|
|
771
|
+
* - Hyperlinks (a[href]) with safe URIs
|
|
772
|
+
* - Images (img[src]) with alt text and captions (figure, figcaption)
|
|
773
|
+
* - Blockquotes and code blocks
|
|
774
|
+
*
|
|
775
|
+
* Purely client-side: zero network requests or external transmissions.
|
|
776
|
+
*/
|
|
777
|
+
interface ArticleContent {
|
|
778
|
+
title: string;
|
|
779
|
+
byline?: string;
|
|
780
|
+
wordCount: number;
|
|
781
|
+
readingTimeMinutes: number;
|
|
782
|
+
html: string;
|
|
783
|
+
text: string;
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Calculates word count from raw text string.
|
|
787
|
+
*/
|
|
788
|
+
declare function countWords(text: string): number;
|
|
789
|
+
/**
|
|
790
|
+
* Estimates reading time in whole minutes (standard 200 wpm baseline).
|
|
791
|
+
*/
|
|
792
|
+
declare function estimateReadingTime(words: number): number;
|
|
793
|
+
/**
|
|
794
|
+
* Finds the primary article candidate element within a root.
|
|
795
|
+
*/
|
|
796
|
+
declare function findArticleCandidate(root: HTMLElement | Document): HTMLElement | null;
|
|
797
|
+
/**
|
|
798
|
+
* Non-destructive article content extractor.
|
|
799
|
+
* Returns null if no sufficient readable content is found on the page.
|
|
800
|
+
*/
|
|
801
|
+
declare function extractArticleContent(root?: HTMLElement | Document): ArticleContent | null;
|
|
802
|
+
|
|
803
|
+
interface ReadingModeControllerProps {
|
|
804
|
+
className?: string;
|
|
805
|
+
label?: string;
|
|
806
|
+
description?: string;
|
|
807
|
+
onActivate?: (content: ArticleContent) => void;
|
|
808
|
+
onDeactivate?: () => void;
|
|
809
|
+
onError?: (error: Error) => void;
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* Controller for non-destructive Reading Mode.
|
|
813
|
+
*
|
|
814
|
+
* Extracts article-focused content without rewriting or mutating host React DOM elements.
|
|
815
|
+
* Preserves headings, links, and images while stripping forms, navigation, ads, and sensitive fields.
|
|
816
|
+
* If extraction fails or lacks readable content, gracefully notifies the user and returns to the original page.
|
|
817
|
+
* Zero content is sent externally.
|
|
818
|
+
*/
|
|
819
|
+
declare function ReadingModeController({ className, label, description, onActivate, onDeactivate, onError, }?: ReadingModeControllerProps): react.JSX.Element;
|
|
820
|
+
|
|
712
821
|
interface CustomPreset {
|
|
713
822
|
id: string;
|
|
714
823
|
name: string;
|
|
@@ -797,4 +906,4 @@ interface UsePresetsResult {
|
|
|
797
906
|
*/
|
|
798
907
|
declare function usePresets(): UsePresetsResult;
|
|
799
908
|
|
|
800
|
-
export { ALLOWED_PREFERENCE_KEYS, ALL_PROFILE_IDS, AccessibilityButton, type AccessibilityButtonProps, AccessibilityContext, type AccessibilityContextValue, AccessibilityList, type AccessibilityListProps, AccessibilityPlugin, type AccessibilityPluginProps, type AccessibilityPreferences, AccessibilityProfilesController, type AccessibilityState, AccessibleTooltipsController, type ActiveProfileState, BigCursorController, type BigCursorControllerProps, CONTRAST_MODES, CONTRAST_PALETTES, CONTRAST_PROTECTED_SELECTOR, ChoiceControl, type ChoiceControlProps, type ChoiceGroup, type ChoiceOption, ContrastController, type ContrastMode, ContrastModeController, type ContrastModeValue, type ContrastPalette, type CursorSizePreference, type CustomPreset, CustomPresetsController, DEFAULT_PREFERENCES, DEFAULT_READING_MASK_HEIGHT, 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, FocusHighlightController, FontFamilyController, type FontFamilyPreference, type FontFamilyPreset, FontSizeController, type FontSizeControllerProps, GrayscaleController, type HeadingItem, HeadingsNavigatorController, HideDecorativeImagesController, HideImagesController, type HideImagesControllerProps, HideVideosController, HighlightFocusController, type ImportResult, InvertColorsController, LEGIBLE_FONT_STACK, LINE_HEIGHT_RATIOS, LINE_HEIGHT_STEPS, type LandmarkItem, LetterSpacingController, type LetterSpacingControllerProps, LineHeightController, type LineHeightControllerProps, LinkHighlightController, type LocaleStrings, MAX_READING_MASK_HEIGHT, MIN_READING_MASK_HEIGHT, PROFILE_DEFINITIONS, PageNavigatorController, type PageNavigatorControllerProps, PageStructureController, ParagraphSpacingController, type ParagraphSpacingControllerProps, type PluginPosition, PresetsBackupController, PresetsController, type PresetsControllerProps, type PresetsExportV1, ProfileController, type ProfileDefinition, type ProfilePresetId, ProfilePreviewCard, type ProfilePreviewCardProps, ProfilesController, type ProfilesControllerProps, READING_MASK_HEIGHT_PRESETS, type ReaderMode, ReadingGuideController, type ReadingGuideControllerProps, ReadingMaskController, type ReadingMaskControllerProps, ReduceMotionController, ResetController, SaturationController, type SaturationPreference, type ScriptSpacingConstraints, SearchCount, type SearchCountProps, SettingsImportExportController, SkipToMainLink, type SkipToMainLinkProps, 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, TooltipsController, type TooltipsControllerProps, type UsePresetsResult, type UseProfilesResult, type WidgetPlacement, WordSpacingController, type WordSpacingControllerProps, applyCustomPresetToStore, applyProfileToStore, createCustomPreset, createInitialPreferencesState, downloadJsonFile, enLocale, enableAccessibleTooltips, exportPresetsToJson, findMainLandmark, getAuthoredDescription, getProfileDefinition, getScriptSpacingConstraints, hasFinePointer, isEligibleDecorativeImage, isForcedColorsActive, isFunctionalOrMeaningfulImage, isProtectedFromContrast, isProtectedFromFontFamily, isProtectedFromTextAlign, isProtectedFromTextScale, isProtectedFromTextSpacing, isReducedMotionActive, isRtlLocale, isValidCustomPreset, mapFeaturesToProfileSettings, mapProfileSettingsToFeatures, navigateToElement, normalizePreferenceValue, normalizePreferences, nudgeReadingAid, positionTooltip, preferencesReducer, recordProfileOverride, registerLocale, resolveEffectivePreferences, resolveLocaleStrings, revertProfileFromStore, sanitizePreferences, scanHeadings, scanLandmarks, subscribeFinePointer, subscribeForcedColors, subscribePageStructure, subscribeReducedMotion, useAccessibility, usePresets, useProfiles, validateAndParseImport };
|
|
909
|
+
export { ALLOWED_PREFERENCE_KEYS, ALL_PROFILE_IDS, AccessibilityButton, type AccessibilityButtonProps, AccessibilityContext, type AccessibilityContextValue, AccessibilityList, type AccessibilityListProps, AccessibilityPlugin, type AccessibilityPluginProps, type AccessibilityPreferences, AccessibilityProfilesController, type AccessibilityState, AccessibleTooltipsController, type ActiveProfileState, type ArticleContent, BigCursorController, type BigCursorControllerProps, CONTRAST_MODES, CONTRAST_PALETTES, CONTRAST_PROTECTED_SELECTOR, ChoiceControl, type ChoiceControlProps, type ChoiceGroup, type ChoiceOption, ContrastController, type ContrastMode, ContrastModeController, type ContrastModeValue, type ContrastPalette, type CursorSizePreference, type CustomPreset, CustomPresetsController, DEFAULT_PREFERENCES, DEFAULT_READING_MASK_HEIGHT, DYSLEXIA_FONT_STACK, EmptyState, type EmptyStateProps, ErrorState, type ErrorStateProps, FONT_FAMILY_PRESETS, FONT_FAMILY_PROTECTED_SELECTOR, FeatureCard, type FeatureCardProps, type FeatureLocaleLabels, type FeatureOptions, type FeatureRegistration, type FeatureStatus, FocusHighlightController, FontFamilyController, type FontFamilyPreference, type FontFamilyPreset, FontSizeController, type FontSizeControllerProps, GrayscaleController, type HeadingItem, HeadingsNavigatorController, HideDecorativeImagesController, HideImagesController, type HideImagesControllerProps, HideVideosController, HighlightFocusController, type ImportResult, InvertColorsController, LEGIBLE_FONT_STACK, LINE_HEIGHT_RATIOS, LINE_HEIGHT_STEPS, type LandmarkItem, LetterSpacingController, type LetterSpacingControllerProps, LineHeightController, type LineHeightControllerProps, LinkHighlightController, type LocaleStrings, MAX_READING_MASK_HEIGHT, MIN_READING_MASK_HEIGHT, PROFILE_DEFINITIONS, PageNavigatorController, type PageNavigatorControllerProps, PageStructureController, ParagraphSpacingController, type ParagraphSpacingControllerProps, type PluginPosition, PresetsBackupController, PresetsController, type PresetsControllerProps, type PresetsExportV1, ProfileController, type ProfileDefinition, type ProfilePresetId, ProfilePreviewCard, type ProfilePreviewCardProps, ProfilesController, type ProfilesControllerProps, READING_MASK_HEIGHT_PRESETS, type ReaderMode, ReadingGuideController, type ReadingGuideControllerProps, ReadingMaskController, type ReadingMaskControllerProps, ReadingModeController, type ReadingModeControllerProps, ReduceMotionController, ResetController, SaturationController, type SaturationPreference, type ScriptSpacingConstraints, SearchCount, type SearchCountProps, SettingsImportExportController, SkipToMainLink, type SkipToMainLinkProps, 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, TooltipsController, type TooltipsControllerProps, type UsePresetsResult, type UseProfilesResult, type WidgetPlacement, WordSpacingController, type WordSpacingControllerProps, applyCustomPresetToStore, applyProfileToStore, countWords, createCustomPreset, createInitialPreferencesState, downloadJsonFile, enLocale, enableAccessibleTooltips, estimateReadingTime, exportPresetsToJson, extractArticleContent, findArticleCandidate, findMainLandmark, getAuthoredDescription, getProfileDefinition, getScriptSpacingConstraints, hasFinePointer, isEligibleDecorativeImage, isForcedColorsActive, isFunctionalOrMeaningfulImage, isProtectedFromContrast, isProtectedFromFontFamily, isProtectedFromTextAlign, isProtectedFromTextScale, isProtectedFromTextSpacing, isReducedMotionActive, isRtlLocale, isValidCustomPreset, mapFeaturesToProfileSettings, mapProfileSettingsToFeatures, navigateToElement, normalizePreferenceValue, normalizePreferences, nudgeReadingAid, positionTooltip, preferencesReducer, recordProfileOverride, registerLocale, resolveEffectivePreferences, resolveLocaleStrings, revertProfileFromStore, sanitizePreferences, scanHeadings, scanLandmarks, siLocale, subscribeFinePointer, subscribeForcedColors, subscribePageStructure, subscribeReducedMotion, taLocale, useAccessibility, usePresets, useProfiles, validateAndParseImport };
|
package/dist/index.d.ts
CHANGED
|
@@ -83,6 +83,25 @@ declare function resolveEffectivePreferences(base: AccessibilityPreferences, pro
|
|
|
83
83
|
declare function createInitialPreferencesState(initial?: Partial<AccessibilityPreferences> | null): PreferencesState;
|
|
84
84
|
declare function preferencesReducer(state: PreferencesState, action: PreferencesAction): PreferencesState;
|
|
85
85
|
|
|
86
|
+
interface FeatureLocaleLabels {
|
|
87
|
+
textScale?: string;
|
|
88
|
+
lineHeight?: string;
|
|
89
|
+
letterSpacing?: string;
|
|
90
|
+
wordSpacing?: string;
|
|
91
|
+
paragraphSpacing?: string;
|
|
92
|
+
textAlign?: string;
|
|
93
|
+
fontFamily?: string;
|
|
94
|
+
contrast?: string;
|
|
95
|
+
highlightLinks?: string;
|
|
96
|
+
focusOutline?: string;
|
|
97
|
+
reduceMotion?: string;
|
|
98
|
+
cursorGuide?: string;
|
|
99
|
+
headingsNavigator?: string;
|
|
100
|
+
profiles?: string;
|
|
101
|
+
presets?: string;
|
|
102
|
+
readingMode?: string;
|
|
103
|
+
[key: string]: string | undefined;
|
|
104
|
+
}
|
|
86
105
|
interface LocaleStrings {
|
|
87
106
|
title: string;
|
|
88
107
|
description: string;
|
|
@@ -112,13 +131,38 @@ interface LocaleStrings {
|
|
|
112
131
|
moveDown: string;
|
|
113
132
|
moveRight: string;
|
|
114
133
|
largeControlsLabel: string;
|
|
134
|
+
cornerNames?: Record<string, string>;
|
|
115
135
|
formatPointPosition?: (x: number, y: number) => string;
|
|
116
136
|
formatCornerPosition?: (corner: string) => string;
|
|
117
|
-
|
|
118
|
-
|
|
137
|
+
searchPlaceholder?: string;
|
|
138
|
+
searchClearLabel?: string;
|
|
139
|
+
formatSearchCount?: (matched: number, total: number, query?: string) => string;
|
|
140
|
+
emptySearchTitle?: string;
|
|
141
|
+
emptySearchDescription?: string;
|
|
142
|
+
clearSearchLabel?: string;
|
|
143
|
+
formatProfileApplied?: (profileName: string) => string;
|
|
144
|
+
formatProfileReverted?: () => string;
|
|
145
|
+
formatPresetSaved?: (presetName: string) => string;
|
|
146
|
+
formatPresetApplied?: (presetName: string) => string;
|
|
147
|
+
formatPresetDeleted?: (presetName: string) => string;
|
|
148
|
+
decreaseTextSize?: string;
|
|
149
|
+
increaseTextSize?: string;
|
|
150
|
+
readingModeDescription?: string;
|
|
151
|
+
readingModeOpen?: string;
|
|
152
|
+
readingModeClose?: string;
|
|
153
|
+
readingModeFailed?: string;
|
|
154
|
+
formatReadingWords?: (words: number) => string;
|
|
155
|
+
formatReadingTime?: (minutes: number) => string;
|
|
156
|
+
features?: FeatureLocaleLabels;
|
|
157
|
+
}
|
|
158
|
+
type SupportedLocale = "en" | "en-US" | "en-GB" | "si" | "si-LK" | "ta" | "ta-LK" | string;
|
|
119
159
|
|
|
120
160
|
declare const enLocale: Readonly<LocaleStrings>;
|
|
121
161
|
|
|
162
|
+
declare const siLocale: Readonly<LocaleStrings>;
|
|
163
|
+
|
|
164
|
+
declare const taLocale: Readonly<LocaleStrings>;
|
|
165
|
+
|
|
122
166
|
declare function registerLocale(code: string, strings: LocaleStrings): void;
|
|
123
167
|
declare function isRtlLocale(localeProp?: string): boolean;
|
|
124
168
|
declare function resolveLocaleStrings(localeProp?: string): LocaleStrings;
|
|
@@ -209,8 +253,9 @@ interface SearchCountProps {
|
|
|
209
253
|
query?: string;
|
|
210
254
|
className?: string;
|
|
211
255
|
style?: CSSProperties;
|
|
256
|
+
locale?: string;
|
|
212
257
|
}
|
|
213
|
-
declare function SearchCount({ totalCount, matchedCount, query, className, style, }: SearchCountProps): react.JSX.Element;
|
|
258
|
+
declare function SearchCount({ totalCount, matchedCount, query, className, style, locale, }: SearchCountProps): react.JSX.Element;
|
|
214
259
|
interface EmptyStateProps {
|
|
215
260
|
title?: string;
|
|
216
261
|
description?: string;
|
|
@@ -219,8 +264,9 @@ interface EmptyStateProps {
|
|
|
219
264
|
icon?: ReactNode;
|
|
220
265
|
className?: string;
|
|
221
266
|
style?: CSSProperties;
|
|
267
|
+
locale?: string;
|
|
222
268
|
}
|
|
223
|
-
declare function EmptyState({ title, description, actionLabel, onAction, icon, className, style, }: EmptyStateProps): react.JSX.Element;
|
|
269
|
+
declare function EmptyState({ title, description, actionLabel, onAction, icon, className, style, locale, }: EmptyStateProps): react.JSX.Element;
|
|
224
270
|
interface ErrorStateProps {
|
|
225
271
|
title?: string;
|
|
226
272
|
message: string;
|
|
@@ -426,7 +472,7 @@ interface TextScaleControllerProps {
|
|
|
426
472
|
*/
|
|
427
473
|
steps?: readonly number[];
|
|
428
474
|
/**
|
|
429
|
-
* Accessible group label and visible title. Default: "Bigger Text".
|
|
475
|
+
* Accessible group label and visible title. Default: "Bigger Text" (or localized).
|
|
430
476
|
*/
|
|
431
477
|
label?: string;
|
|
432
478
|
}
|
|
@@ -704,11 +750,74 @@ interface PresetsControllerProps {
|
|
|
704
750
|
description?: string;
|
|
705
751
|
largeControls?: boolean;
|
|
706
752
|
}
|
|
707
|
-
declare function PresetsController({ className, label, description, largeControls, }
|
|
753
|
+
declare function PresetsController({ className, label, description, largeControls, }?: PresetsControllerProps): react.JSX.Element;
|
|
708
754
|
declare const CustomPresetsController: typeof PresetsController;
|
|
709
755
|
declare const SettingsImportExportController: typeof PresetsController;
|
|
710
756
|
declare const PresetsBackupController: typeof PresetsController;
|
|
711
757
|
|
|
758
|
+
/**
|
|
759
|
+
* Non-destructive article content extraction for Reading Mode.
|
|
760
|
+
*
|
|
761
|
+
* Extracts readable article content from candidate containers without mutating
|
|
762
|
+
* or destroying host React DOM elements.
|
|
763
|
+
*
|
|
764
|
+
* Filters out:
|
|
765
|
+
* - Forms, interactive inputs, buttons, and sensitive fields (passwords, cards, hidden tokens)
|
|
766
|
+
* - Navigation menus, headers, footers, sidebars, cookie banners, advertisements
|
|
767
|
+
* - Scripts, styles, iframes, embeds, and dialogs
|
|
768
|
+
*
|
|
769
|
+
* Preserves:
|
|
770
|
+
* - Semantic headings (h1-h6), paragraphs (p), lists (ul, ol, li)
|
|
771
|
+
* - Hyperlinks (a[href]) with safe URIs
|
|
772
|
+
* - Images (img[src]) with alt text and captions (figure, figcaption)
|
|
773
|
+
* - Blockquotes and code blocks
|
|
774
|
+
*
|
|
775
|
+
* Purely client-side: zero network requests or external transmissions.
|
|
776
|
+
*/
|
|
777
|
+
interface ArticleContent {
|
|
778
|
+
title: string;
|
|
779
|
+
byline?: string;
|
|
780
|
+
wordCount: number;
|
|
781
|
+
readingTimeMinutes: number;
|
|
782
|
+
html: string;
|
|
783
|
+
text: string;
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Calculates word count from raw text string.
|
|
787
|
+
*/
|
|
788
|
+
declare function countWords(text: string): number;
|
|
789
|
+
/**
|
|
790
|
+
* Estimates reading time in whole minutes (standard 200 wpm baseline).
|
|
791
|
+
*/
|
|
792
|
+
declare function estimateReadingTime(words: number): number;
|
|
793
|
+
/**
|
|
794
|
+
* Finds the primary article candidate element within a root.
|
|
795
|
+
*/
|
|
796
|
+
declare function findArticleCandidate(root: HTMLElement | Document): HTMLElement | null;
|
|
797
|
+
/**
|
|
798
|
+
* Non-destructive article content extractor.
|
|
799
|
+
* Returns null if no sufficient readable content is found on the page.
|
|
800
|
+
*/
|
|
801
|
+
declare function extractArticleContent(root?: HTMLElement | Document): ArticleContent | null;
|
|
802
|
+
|
|
803
|
+
interface ReadingModeControllerProps {
|
|
804
|
+
className?: string;
|
|
805
|
+
label?: string;
|
|
806
|
+
description?: string;
|
|
807
|
+
onActivate?: (content: ArticleContent) => void;
|
|
808
|
+
onDeactivate?: () => void;
|
|
809
|
+
onError?: (error: Error) => void;
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* Controller for non-destructive Reading Mode.
|
|
813
|
+
*
|
|
814
|
+
* Extracts article-focused content without rewriting or mutating host React DOM elements.
|
|
815
|
+
* Preserves headings, links, and images while stripping forms, navigation, ads, and sensitive fields.
|
|
816
|
+
* If extraction fails or lacks readable content, gracefully notifies the user and returns to the original page.
|
|
817
|
+
* Zero content is sent externally.
|
|
818
|
+
*/
|
|
819
|
+
declare function ReadingModeController({ className, label, description, onActivate, onDeactivate, onError, }?: ReadingModeControllerProps): react.JSX.Element;
|
|
820
|
+
|
|
712
821
|
interface CustomPreset {
|
|
713
822
|
id: string;
|
|
714
823
|
name: string;
|
|
@@ -797,4 +906,4 @@ interface UsePresetsResult {
|
|
|
797
906
|
*/
|
|
798
907
|
declare function usePresets(): UsePresetsResult;
|
|
799
908
|
|
|
800
|
-
export { ALLOWED_PREFERENCE_KEYS, ALL_PROFILE_IDS, AccessibilityButton, type AccessibilityButtonProps, AccessibilityContext, type AccessibilityContextValue, AccessibilityList, type AccessibilityListProps, AccessibilityPlugin, type AccessibilityPluginProps, type AccessibilityPreferences, AccessibilityProfilesController, type AccessibilityState, AccessibleTooltipsController, type ActiveProfileState, BigCursorController, type BigCursorControllerProps, CONTRAST_MODES, CONTRAST_PALETTES, CONTRAST_PROTECTED_SELECTOR, ChoiceControl, type ChoiceControlProps, type ChoiceGroup, type ChoiceOption, ContrastController, type ContrastMode, ContrastModeController, type ContrastModeValue, type ContrastPalette, type CursorSizePreference, type CustomPreset, CustomPresetsController, DEFAULT_PREFERENCES, DEFAULT_READING_MASK_HEIGHT, 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, FocusHighlightController, FontFamilyController, type FontFamilyPreference, type FontFamilyPreset, FontSizeController, type FontSizeControllerProps, GrayscaleController, type HeadingItem, HeadingsNavigatorController, HideDecorativeImagesController, HideImagesController, type HideImagesControllerProps, HideVideosController, HighlightFocusController, type ImportResult, InvertColorsController, LEGIBLE_FONT_STACK, LINE_HEIGHT_RATIOS, LINE_HEIGHT_STEPS, type LandmarkItem, LetterSpacingController, type LetterSpacingControllerProps, LineHeightController, type LineHeightControllerProps, LinkHighlightController, type LocaleStrings, MAX_READING_MASK_HEIGHT, MIN_READING_MASK_HEIGHT, PROFILE_DEFINITIONS, PageNavigatorController, type PageNavigatorControllerProps, PageStructureController, ParagraphSpacingController, type ParagraphSpacingControllerProps, type PluginPosition, PresetsBackupController, PresetsController, type PresetsControllerProps, type PresetsExportV1, ProfileController, type ProfileDefinition, type ProfilePresetId, ProfilePreviewCard, type ProfilePreviewCardProps, ProfilesController, type ProfilesControllerProps, READING_MASK_HEIGHT_PRESETS, type ReaderMode, ReadingGuideController, type ReadingGuideControllerProps, ReadingMaskController, type ReadingMaskControllerProps, ReduceMotionController, ResetController, SaturationController, type SaturationPreference, type ScriptSpacingConstraints, SearchCount, type SearchCountProps, SettingsImportExportController, SkipToMainLink, type SkipToMainLinkProps, 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, TooltipsController, type TooltipsControllerProps, type UsePresetsResult, type UseProfilesResult, type WidgetPlacement, WordSpacingController, type WordSpacingControllerProps, applyCustomPresetToStore, applyProfileToStore, createCustomPreset, createInitialPreferencesState, downloadJsonFile, enLocale, enableAccessibleTooltips, exportPresetsToJson, findMainLandmark, getAuthoredDescription, getProfileDefinition, getScriptSpacingConstraints, hasFinePointer, isEligibleDecorativeImage, isForcedColorsActive, isFunctionalOrMeaningfulImage, isProtectedFromContrast, isProtectedFromFontFamily, isProtectedFromTextAlign, isProtectedFromTextScale, isProtectedFromTextSpacing, isReducedMotionActive, isRtlLocale, isValidCustomPreset, mapFeaturesToProfileSettings, mapProfileSettingsToFeatures, navigateToElement, normalizePreferenceValue, normalizePreferences, nudgeReadingAid, positionTooltip, preferencesReducer, recordProfileOverride, registerLocale, resolveEffectivePreferences, resolveLocaleStrings, revertProfileFromStore, sanitizePreferences, scanHeadings, scanLandmarks, subscribeFinePointer, subscribeForcedColors, subscribePageStructure, subscribeReducedMotion, useAccessibility, usePresets, useProfiles, validateAndParseImport };
|
|
909
|
+
export { ALLOWED_PREFERENCE_KEYS, ALL_PROFILE_IDS, AccessibilityButton, type AccessibilityButtonProps, AccessibilityContext, type AccessibilityContextValue, AccessibilityList, type AccessibilityListProps, AccessibilityPlugin, type AccessibilityPluginProps, type AccessibilityPreferences, AccessibilityProfilesController, type AccessibilityState, AccessibleTooltipsController, type ActiveProfileState, type ArticleContent, BigCursorController, type BigCursorControllerProps, CONTRAST_MODES, CONTRAST_PALETTES, CONTRAST_PROTECTED_SELECTOR, ChoiceControl, type ChoiceControlProps, type ChoiceGroup, type ChoiceOption, ContrastController, type ContrastMode, ContrastModeController, type ContrastModeValue, type ContrastPalette, type CursorSizePreference, type CustomPreset, CustomPresetsController, DEFAULT_PREFERENCES, DEFAULT_READING_MASK_HEIGHT, DYSLEXIA_FONT_STACK, EmptyState, type EmptyStateProps, ErrorState, type ErrorStateProps, FONT_FAMILY_PRESETS, FONT_FAMILY_PROTECTED_SELECTOR, FeatureCard, type FeatureCardProps, type FeatureLocaleLabels, type FeatureOptions, type FeatureRegistration, type FeatureStatus, FocusHighlightController, FontFamilyController, type FontFamilyPreference, type FontFamilyPreset, FontSizeController, type FontSizeControllerProps, GrayscaleController, type HeadingItem, HeadingsNavigatorController, HideDecorativeImagesController, HideImagesController, type HideImagesControllerProps, HideVideosController, HighlightFocusController, type ImportResult, InvertColorsController, LEGIBLE_FONT_STACK, LINE_HEIGHT_RATIOS, LINE_HEIGHT_STEPS, type LandmarkItem, LetterSpacingController, type LetterSpacingControllerProps, LineHeightController, type LineHeightControllerProps, LinkHighlightController, type LocaleStrings, MAX_READING_MASK_HEIGHT, MIN_READING_MASK_HEIGHT, PROFILE_DEFINITIONS, PageNavigatorController, type PageNavigatorControllerProps, PageStructureController, ParagraphSpacingController, type ParagraphSpacingControllerProps, type PluginPosition, PresetsBackupController, PresetsController, type PresetsControllerProps, type PresetsExportV1, ProfileController, type ProfileDefinition, type ProfilePresetId, ProfilePreviewCard, type ProfilePreviewCardProps, ProfilesController, type ProfilesControllerProps, READING_MASK_HEIGHT_PRESETS, type ReaderMode, ReadingGuideController, type ReadingGuideControllerProps, ReadingMaskController, type ReadingMaskControllerProps, ReadingModeController, type ReadingModeControllerProps, ReduceMotionController, ResetController, SaturationController, type SaturationPreference, type ScriptSpacingConstraints, SearchCount, type SearchCountProps, SettingsImportExportController, SkipToMainLink, type SkipToMainLinkProps, 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, TooltipsController, type TooltipsControllerProps, type UsePresetsResult, type UseProfilesResult, type WidgetPlacement, WordSpacingController, type WordSpacingControllerProps, applyCustomPresetToStore, applyProfileToStore, countWords, createCustomPreset, createInitialPreferencesState, downloadJsonFile, enLocale, enableAccessibleTooltips, estimateReadingTime, exportPresetsToJson, extractArticleContent, findArticleCandidate, findMainLandmark, getAuthoredDescription, getProfileDefinition, getScriptSpacingConstraints, hasFinePointer, isEligibleDecorativeImage, isForcedColorsActive, isFunctionalOrMeaningfulImage, isProtectedFromContrast, isProtectedFromFontFamily, isProtectedFromTextAlign, isProtectedFromTextScale, isProtectedFromTextSpacing, isReducedMotionActive, isRtlLocale, isValidCustomPreset, mapFeaturesToProfileSettings, mapProfileSettingsToFeatures, navigateToElement, normalizePreferenceValue, normalizePreferences, nudgeReadingAid, positionTooltip, preferencesReducer, recordProfileOverride, registerLocale, resolveEffectivePreferences, resolveLocaleStrings, revertProfileFromStore, sanitizePreferences, scanHeadings, scanLandmarks, siLocale, subscribeFinePointer, subscribeForcedColors, subscribePageStructure, subscribeReducedMotion, taLocale, useAccessibility, usePresets, useProfiles, validateAndParseImport };
|