accessibility-plugin-react 2.0.2 → 2.2.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/dist/index.js CHANGED
@@ -28,6 +28,7 @@ __export(index_exports, {
28
28
  AccessibilityPlugin: () => AccessibilityPlugin,
29
29
  BigCursorController: () => BigCursorController,
30
30
  ContrastController: () => ContrastController,
31
+ DEFAULT_PREFERENCES: () => DEFAULT_PREFERENCES,
31
32
  FontSizeController: () => FontSizeController,
32
33
  GrayscaleController: () => GrayscaleController,
33
34
  HideImagesController: () => HideImagesController,
@@ -36,11 +37,21 @@ __export(index_exports, {
36
37
  LetterSpacingController: () => LetterSpacingController,
37
38
  LineHeightController: () => LineHeightController,
38
39
  LinkHighlightController: () => LinkHighlightController,
40
+ PROFILE_DEFINITIONS: () => PROFILE_DEFINITIONS,
39
41
  ReadingGuideController: () => ReadingGuideController,
40
42
  ReadingMaskController: () => ReadingMaskController,
41
43
  ResetController: () => ResetController,
42
44
  SaturationController: () => SaturationController,
43
45
  TextAlignController: () => TextAlignController,
46
+ createInitialPreferencesState: () => createInitialPreferencesState,
47
+ enLocale: () => enLocale,
48
+ isRtlLocale: () => isRtlLocale,
49
+ normalizePreferenceValue: () => normalizePreferenceValue,
50
+ normalizePreferences: () => normalizePreferences,
51
+ preferencesReducer: () => preferencesReducer,
52
+ registerLocale: () => registerLocale,
53
+ resolveEffectivePreferences: () => resolveEffectivePreferences,
54
+ resolveLocaleStrings: () => resolveLocaleStrings,
44
55
  useAccessibility: () => useAccessibility
45
56
  });
46
57
  module.exports = __toCommonJS(index_exports);
@@ -68,7 +79,7 @@ function styleInject(css, { insertAt } = {}) {
68
79
  }
69
80
 
70
81
  // src/styles/tailwind.css
71
- styleInject('.arap-root {\n --arap-surface: #fff;\n --arap-text: #111827;\n --arap-muted: #475569;\n --arap-border: #cbd5e1;\n --arap-divider: #e2e8f0;\n --arap-accent: #1d4ed8;\n --arap-accent-hover: #1e40af;\n --arap-selected: #eff6ff;\n --arap-control: #f8fafc;\n color-scheme: light;\n font: 15px/1.5 system-ui, sans-serif;\n color: var(--arap-text);\n text-align: left;\n letter-spacing: normal;\n}\n.arap-root *,\n.arap-root *::before,\n.arap-root *::after {\n box-sizing: border-box;\n}\n.arap-root button {\n font: inherit;\n cursor: pointer;\n color: inherit;\n text-transform: none;\n letter-spacing: normal;\n transition: background-color 0.15s, border-color 0.15s;\n}\n.arap-root button:disabled {\n opacity: 0.45;\n cursor: not-allowed;\n}\n.arap-root button:focus-visible,\n.arap-panel:focus-visible {\n outline: 3px solid var(--arap-accent);\n outline-offset: 3px;\n}\n.arap-root .arap-btn {\n position: fixed;\n z-index: 2147483001;\n bottom: max(16px, env(safe-area-inset-bottom));\n right: max(16px, env(safe-area-inset-right));\n width: 56px;\n height: 56px;\n padding: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n border: 2px solid var(--arap-surface);\n border-radius: 50%;\n background: var(--arap-accent);\n color: #fff;\n box-shadow: 0 4px 12px #0f172a26, 0 10px 24px #0f172a14;\n}\n.arap-root .arap-btn:hover {\n background: var(--arap-accent-hover);\n}\n.arap-root .arap-btn[data-position=left] {\n right: auto;\n left: max(16px, env(safe-area-inset-left));\n}\n.arap-root .arap-btn[data-position=top] {\n bottom: auto;\n top: max(16px, env(safe-area-inset-top));\n}\n.arap-root .arap-panel {\n position: fixed;\n z-index: 2147483000;\n bottom: max(88px, calc(env(safe-area-inset-bottom) + 72px));\n right: max(16px, env(safe-area-inset-right));\n width: min(400px, calc(100vw - 32px));\n max-height: calc(100vh - 120px);\n max-height: calc(100dvh - 120px - env(safe-area-inset-bottom));\n overflow: auto;\n overscroll-behavior: contain;\n scrollbar-width: thin;\n scrollbar-color: var(--arap-border) transparent;\n padding: 20px;\n border: 1px solid var(--arap-divider);\n border-radius: 16px;\n background: var(--arap-surface);\n box-shadow: 0 8px 16px #0f172a0d, 0 20px 48px #0f172a1a;\n}\n.arap-root .arap-panel[hidden] {\n display: none !important;\n}\n.arap-root .arap-panel[data-position=left] {\n right: auto;\n left: max(16px, env(safe-area-inset-left));\n}\n.arap-root .arap-panel[data-position=top] {\n bottom: auto;\n top: max(88px, calc(env(safe-area-inset-top) + 72px));\n}\n.arap-heading {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n gap: 8px;\n padding-bottom: 18px;\n border-bottom: 1px solid var(--arap-divider);\n}\n.arap-heading-copy {\n min-width: 0;\n}\n.arap-heading h2 {\n margin: 0;\n font: 700 22px/1.3 system-ui, sans-serif;\n letter-spacing: -0.025em;\n color: var(--arap-text);\n overflow-wrap: anywhere;\n}\n.arap-description {\n margin: 6px 0 0;\n color: var(--arap-muted);\n font: 14px/1.5 system-ui, sans-serif;\n overflow-wrap: anywhere;\n}\n.arap-heading button {\n flex: none;\n width: 44px;\n height: 44px;\n margin-top: -6px;\n border: 1px solid transparent;\n border-radius: 8px;\n background: transparent;\n color: var(--arap-muted);\n font-size: 28px;\n line-height: 1;\n}\n.arap-heading button:hover {\n background: var(--arap-control);\n border-color: var(--arap-border);\n}\n.arap-feature {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n align-items: center;\n gap: 10px 12px;\n padding: 18px 0;\n border-bottom: 1px solid var(--arap-divider);\n}\n.arap-feature:last-child {\n border: 0;\n padding-bottom: 0;\n}\n.arap-label {\n display: flex;\n align-items: center;\n gap: 10px;\n font-weight: 500;\n min-width: 0;\n overflow-wrap: anywhere;\n}\n.arap-icon {\n flex: none;\n width: 22px;\n height: 22px;\n display: inline-block;\n vertical-align: middle;\n}\n.arap-controls {\n display: flex;\n align-items: stretch;\n border: 1px solid var(--arap-border);\n border-radius: 9px;\n overflow: hidden;\n background: var(--arap-control);\n}\n.arap-root .arap-btn-sm {\n flex: none;\n width: 44px;\n height: 44px;\n border: 0;\n border-radius: 0;\n background: transparent;\n font-size: 22px;\n}\n.arap-root .arap-btn-sm:hover:not(:disabled) {\n background: var(--arap-selected);\n color: var(--arap-accent);\n}\n.arap-root .arap-controls button:focus-visible {\n outline-offset: -4px;\n}\n.arap-value {\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 56px;\n padding: 0 6px;\n text-align: center;\n font-weight: 600;\n border-inline: 1px solid var(--arap-divider);\n background: var(--arap-surface);\n}\n.arap-segmented {\n grid-column: 1 / -1;\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n min-width: 0;\n}\n.arap-root .arap-segment {\n flex: 1 1 auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 5px;\n min-width: 44px;\n min-height: 44px;\n padding: 8px 10px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n background: var(--arap-control);\n color: var(--arap-muted);\n overflow-wrap: anywhere;\n}\n.arap-root .arap-segment:hover {\n background: var(--arap-selected);\n border-color: var(--arap-accent);\n}\n.arap-root .arap-segment-active {\n background: var(--arap-accent);\n color: #fff;\n border-color: var(--arap-accent);\n font-weight: 600;\n}\n.arap-root .arap-segment-active:hover {\n background: var(--arap-accent-hover);\n color: #fff;\n}\n.arap-check {\n flex: none;\n font-size: 15px;\n line-height: 1;\n}\n.arap-root .arap-toggle {\n position: relative;\n width: 56px;\n height: 44px;\n padding: 0;\n border: 0;\n border-radius: 10px;\n background: transparent;\n}\n.arap-toggle::before {\n content: "";\n position: absolute;\n inset: 6px 0;\n border: 2px solid #64748b;\n border-radius: 20px;\n background: #e2e8f0;\n}\n.arap-toggle-knob {\n position: absolute;\n top: 10px;\n left: 4px;\n width: 24px;\n height: 24px;\n border-radius: 50%;\n background: #475569;\n pointer-events: none;\n transition: transform 0.15s;\n}\n.arap-toggle-active::before {\n background: var(--arap-accent);\n border-color: var(--arap-accent);\n}\n.arap-toggle-active .arap-toggle-knob {\n transform: translateX(24px);\n background: #fff;\n}\n.arap-toggle-active .arap-toggle-knob::after {\n content: "\\2713";\n display: block;\n color: var(--arap-accent);\n font-size: 16px;\n font-weight: 700;\n line-height: 24px;\n text-align: center;\n}\n.arap-root .arap-toggle:hover::before {\n border-color: var(--arap-accent);\n}\n.arap-feature-reset {\n display: block;\n}\n.arap-root .arap-reset-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 10px;\n width: 100%;\n min-height: 48px;\n padding: 10px;\n border: 1px solid var(--arap-border);\n border-radius: 10px;\n background: var(--arap-control);\n color: var(--arap-accent);\n font-weight: 600;\n}\n.arap-root .arap-reset-btn:hover {\n background: var(--arap-selected);\n border-color: var(--arap-accent);\n}\n@media (max-width: 380px) {\n .arap-root .arap-panel {\n padding: 16px;\n }\n .arap-heading h2 {\n font-size: 20px;\n }\n .arap-feature-stepper {\n grid-template-columns: minmax(0, 1fr);\n }\n .arap-controls {\n width: 100%;\n }\n .arap-value {\n flex: 1;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .arap-root *,\n .arap-root *::before,\n .arap-root *::after {\n transition: none !important;\n animation: none !important;\n }\n}\n@media (forced-colors: active) {\n .arap-root {\n --arap-surface: Canvas;\n --arap-text: CanvasText;\n --arap-muted: CanvasText;\n --arap-border: ButtonText;\n --arap-divider: ButtonText;\n --arap-accent: Highlight;\n --arap-control: Canvas;\n --arap-selected: Canvas;\n }\n .arap-root button[aria-pressed=true] {\n outline: 2px solid Highlight;\n outline-offset: -4px;\n }\n .arap-root .arap-segment-active {\n color: HighlightText;\n background: Highlight;\n }\n .arap-toggle::before {\n border-color: ButtonText;\n background: Canvas;\n }\n .arap-toggle-knob {\n background: ButtonText;\n }\n .arap-toggle-active .arap-toggle-knob {\n background: Highlight;\n }\n .arap-toggle-active .arap-toggle-knob::after {\n color: HighlightText;\n }\n}\n.arap-root .arap-panel {\n display: flex;\n flex-direction: column;\n overflow: visible;\n}\n.arap-heading {\n flex: none;\n}\n.arap-tools {\n flex: 1 1 auto;\n min-height: 0;\n overflow: auto;\n overscroll-behavior: contain;\n scrollbar-width: thin;\n scrollbar-color: var(--arap-border) transparent;\n padding: 0 3px;\n margin: 0 -3px;\n}\n.arap-tools:focus-visible {\n outline: 3px solid var(--arap-accent);\n outline-offset: -3px;\n}\n.arap-quick-actions {\n position: relative;\n flex: none;\n display: flex;\n align-items: center;\n gap: 8px;\n padding-top: 14px;\n margin-top: 8px;\n border-top: 1px solid var(--arap-divider);\n}\n.arap-actions {\n flex: 1;\n min-width: 0;\n}\n.arap-actions:empty {\n display: none;\n}\n.arap-actions .arap-feature-reset {\n padding: 0;\n margin: 0;\n border: 0;\n}\n.arap-root .arap-position-button,\n.arap-root .arap-position-default,\n.arap-root .arap-position-arrows button {\n min-width: 44px;\n min-height: 44px;\n padding: 8px 10px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n background: var(--arap-control);\n color: var(--arap-accent);\n}\n.arap-root .arap-position-button:hover,\n.arap-root .arap-position-default:hover,\n.arap-root .arap-position-arrows button:hover {\n background: var(--arap-selected);\n border-color: var(--arap-accent);\n}\n.arap-position-popover {\n position: absolute;\n z-index: 1;\n bottom: calc(100% + 8px);\n left: 0;\n width: 100%;\n max-height: calc(100dvh - 160px);\n overflow: auto;\n padding: 14px;\n border: 1px solid var(--arap-border);\n border-radius: 12px;\n background: var(--arap-surface);\n box-shadow: 0 8px 24px #0f172a26;\n}\n.arap-position-popover[hidden] {\n display: none !important;\n}\n.arap-position-label {\n display: block;\n margin-bottom: 6px;\n font-weight: 600;\n}\n.arap-position-popover select {\n width: 100%;\n min-height: 44px;\n padding: 8px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n font: inherit;\n color: var(--arap-text);\n background: var(--arap-surface);\n}\n.arap-position-popover select:focus-visible {\n outline: 3px solid var(--arap-accent);\n outline-offset: 2px;\n}\n.arap-position-arrows {\n display: flex;\n justify-content: space-between;\n gap: 6px;\n margin-top: 10px;\n}\n.arap-position-default {\n width: 100%;\n margin-top: 8px;\n}\n.arap-root .arap-btn[data-draggable=true] {\n touch-action: none;\n user-select: none;\n cursor: grab;\n}\n.arap-root .arap-btn[data-dragging=true] {\n cursor: grabbing;\n}\n.arap-root .arap-btn[data-corner$=left],\n.arap-root .arap-panel[data-corner$=left] {\n right: auto;\n left: max(16px, env(safe-area-inset-left));\n}\n.arap-root .arap-btn[data-corner$=right],\n.arap-root .arap-panel[data-corner$=right] {\n left: auto;\n right: max(16px, env(safe-area-inset-right));\n}\n.arap-root .arap-btn[data-corner^=top] {\n bottom: auto;\n top: max(16px, env(safe-area-inset-top));\n}\n.arap-root .arap-btn[data-corner^=bottom] {\n top: auto;\n bottom: max(16px, env(safe-area-inset-bottom));\n}\n.arap-root .arap-panel[data-corner^=top] {\n bottom: auto;\n top: max(88px, calc(env(safe-area-inset-top) + 72px));\n}\n.arap-root .arap-panel[data-corner^=bottom] {\n top: auto;\n bottom: max(88px, calc(env(safe-area-inset-bottom) + 72px));\n}\n.arap-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n}\n.arap-root .arap-skip-actions {\n position: absolute;\n top: 12px;\n left: 20px;\n width: 44px;\n height: 44px;\n clip-path: inset(50%);\n overflow: hidden;\n pointer-events: none;\n}\n.arap-root .arap-skip-actions:focus-visible {\n right: 20px;\n width: auto;\n height: auto;\n min-height: 44px;\n clip-path: none;\n pointer-events: auto;\n z-index: 2;\n padding: 8px;\n border: 1px solid var(--arap-accent);\n border-radius: 8px;\n background: var(--arap-surface);\n color: var(--arap-accent);\n}\n@media (max-height: 480px) {\n .arap-root .arap-panel {\n top: max(16px, env(safe-area-inset-top)) !important;\n bottom: max(16px, env(safe-area-inset-bottom)) !important;\n max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;\n padding: 8px;\n }\n .arap-heading {\n padding-bottom: 8px;\n }\n .arap-heading h2 {\n font-size: 18px;\n }\n .arap-heading button {\n margin-top: 0;\n }\n .arap-description {\n display: none;\n }\n .arap-quick-actions {\n padding-top: 8px;\n margin-top: 0;\n }\n .arap-root .arap-reset-btn {\n min-height: 44px;\n }\n .arap-root .arap-btn[data-open=true] {\n visibility: hidden;\n }\n .arap-position-popover {\n max-height: calc(100dvh - 96px);\n }\n}\n');
82
+ styleInject('.arap-root {\n --arap-surface: #fff;\n --arap-text: #111827;\n --arap-muted: #475569;\n --arap-border: #cbd5e1;\n --arap-divider: #e2e8f0;\n --arap-accent: #1d4ed8;\n --arap-accent-hover: #1e40af;\n --arap-selected: #eff6ff;\n --arap-control: #f8fafc;\n color-scheme: light;\n font: 15px/1.5 system-ui, sans-serif;\n color: var(--arap-text);\n text-align: left;\n letter-spacing: normal;\n}\n.arap-root *,\n.arap-root *::before,\n.arap-root *::after {\n box-sizing: border-box;\n}\n.arap-root button {\n font: inherit;\n cursor: pointer;\n color: inherit;\n text-transform: none;\n letter-spacing: normal;\n transition: background-color 0.15s, border-color 0.15s;\n}\n.arap-root button:disabled {\n opacity: 0.45;\n cursor: not-allowed;\n}\n.arap-root button:focus-visible,\n.arap-panel:focus-visible {\n outline: 3px solid var(--arap-accent);\n outline-offset: 3px;\n}\n.arap-root .arap-btn {\n position: fixed;\n z-index: 2147483001;\n bottom: max(16px, env(safe-area-inset-bottom));\n right: max(16px, env(safe-area-inset-right));\n width: 56px;\n height: 56px;\n padding: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n border: 2px solid var(--arap-surface);\n border-radius: 50%;\n background: var(--arap-accent);\n color: #fff;\n box-shadow: 0 4px 12px #0f172a26, 0 10px 24px #0f172a14;\n}\n.arap-root .arap-btn:hover {\n background: var(--arap-accent-hover);\n}\n.arap-root .arap-btn[data-position=left] {\n right: auto;\n left: max(16px, env(safe-area-inset-left));\n}\n.arap-root .arap-btn[data-position=top] {\n bottom: auto;\n top: max(16px, env(safe-area-inset-top));\n}\n.arap-root .arap-panel {\n position: fixed;\n z-index: 2147483000;\n bottom: max(88px, calc(env(safe-area-inset-bottom) + 72px));\n right: max(16px, env(safe-area-inset-right));\n width: min(400px, calc(100vw - 32px));\n max-height: calc(100vh - 120px);\n max-height: calc(100dvh - 120px - env(safe-area-inset-bottom));\n overflow: auto;\n overscroll-behavior: contain;\n scrollbar-width: thin;\n scrollbar-color: var(--arap-border) transparent;\n padding: 20px;\n border: 1px solid var(--arap-divider);\n border-radius: 16px;\n background: var(--arap-surface);\n box-shadow: 0 8px 16px #0f172a0d, 0 20px 48px #0f172a1a;\n}\n.arap-root .arap-panel[hidden] {\n display: none !important;\n}\n.arap-root .arap-panel[data-position=left] {\n right: auto;\n left: max(16px, env(safe-area-inset-left));\n}\n.arap-root .arap-panel[data-position=top] {\n bottom: auto;\n top: max(88px, calc(env(safe-area-inset-top) + 72px));\n}\n.arap-heading {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n gap: 8px;\n padding-bottom: 18px;\n border-bottom: 1px solid var(--arap-divider);\n}\n.arap-heading-copy {\n min-width: 0;\n}\n.arap-heading h2 {\n margin: 0;\n font: 700 22px/1.3 system-ui, sans-serif;\n letter-spacing: -0.025em;\n color: var(--arap-text);\n overflow-wrap: anywhere;\n}\n.arap-description {\n margin: 6px 0 0;\n color: var(--arap-muted);\n font: 14px/1.5 system-ui, sans-serif;\n overflow-wrap: anywhere;\n}\n.arap-heading button {\n flex: none;\n width: 44px;\n height: 44px;\n margin-top: -6px;\n border: 1px solid transparent;\n border-radius: 8px;\n background: transparent;\n color: var(--arap-muted);\n font-size: 28px;\n line-height: 1;\n}\n.arap-heading button:hover {\n background: var(--arap-control);\n border-color: var(--arap-border);\n}\n.arap-feature {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n align-items: center;\n gap: 10px 12px;\n padding: 18px 0;\n border-bottom: 1px solid var(--arap-divider);\n}\n.arap-feature:last-child {\n border: 0;\n padding-bottom: 0;\n}\n.arap-label {\n display: flex;\n align-items: center;\n gap: 10px;\n font-weight: 500;\n min-width: 0;\n overflow-wrap: anywhere;\n}\n.arap-icon {\n flex: none;\n width: 22px;\n height: 22px;\n display: inline-block;\n vertical-align: middle;\n}\n.arap-controls {\n display: flex;\n align-items: stretch;\n border: 1px solid var(--arap-border);\n border-radius: 9px;\n overflow: hidden;\n background: var(--arap-control);\n}\n.arap-root .arap-btn-sm {\n flex: none;\n width: 44px;\n height: 44px;\n border: 0;\n border-radius: 0;\n background: transparent;\n font-size: 22px;\n}\n.arap-root .arap-btn-sm:hover:not(:disabled) {\n background: var(--arap-selected);\n color: var(--arap-accent);\n}\n.arap-root .arap-controls button:focus-visible {\n outline-offset: -4px;\n}\n.arap-value {\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 56px;\n padding: 0 6px;\n text-align: center;\n font-weight: 600;\n border-inline: 1px solid var(--arap-divider);\n background: var(--arap-surface);\n}\n.arap-segmented {\n grid-column: 1 / -1;\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n min-width: 0;\n}\n.arap-root .arap-segment {\n flex: 1 1 auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 5px;\n min-width: 44px;\n min-height: 44px;\n padding: 8px 10px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n background: var(--arap-control);\n color: var(--arap-muted);\n overflow-wrap: anywhere;\n}\n.arap-root .arap-segment:hover {\n background: var(--arap-selected);\n border-color: var(--arap-accent);\n}\n.arap-root .arap-segment-active {\n background: var(--arap-accent);\n color: #fff;\n border-color: var(--arap-accent);\n font-weight: 600;\n}\n.arap-root .arap-segment-active:hover {\n background: var(--arap-accent-hover);\n color: #fff;\n}\n.arap-check {\n flex: none;\n font-size: 15px;\n line-height: 1;\n}\n.arap-root .arap-toggle {\n position: relative;\n width: 56px;\n height: 44px;\n padding: 0;\n border: 0;\n border-radius: 10px;\n background: transparent;\n}\n.arap-toggle::before {\n content: "";\n position: absolute;\n inset: 6px 0;\n border: 2px solid #64748b;\n border-radius: 20px;\n background: #e2e8f0;\n}\n.arap-toggle-knob {\n position: absolute;\n top: 10px;\n left: 4px;\n width: 24px;\n height: 24px;\n border-radius: 50%;\n background: #475569;\n pointer-events: none;\n transition: transform 0.15s;\n}\n.arap-toggle-active::before {\n background: var(--arap-accent);\n border-color: var(--arap-accent);\n}\n.arap-toggle-active .arap-toggle-knob {\n transform: translateX(24px);\n background: #fff;\n}\n.arap-toggle-active .arap-toggle-knob::after {\n content: "\\2713";\n display: block;\n color: var(--arap-accent);\n font-size: 16px;\n font-weight: 700;\n line-height: 24px;\n text-align: center;\n}\n.arap-root .arap-toggle:hover::before {\n border-color: var(--arap-accent);\n}\n.arap-feature-reset {\n display: block;\n}\n.arap-root .arap-reset-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 10px;\n width: 100%;\n min-height: 48px;\n padding: 10px;\n border: 1px solid var(--arap-border);\n border-radius: 10px;\n background: var(--arap-control);\n color: var(--arap-accent);\n font-weight: 600;\n}\n.arap-root .arap-reset-btn:hover {\n background: var(--arap-selected);\n border-color: var(--arap-accent);\n}\n@media (max-width: 380px) {\n .arap-root .arap-panel {\n padding: 16px;\n }\n .arap-heading h2 {\n font-size: 20px;\n }\n .arap-feature-stepper {\n grid-template-columns: minmax(0, 1fr);\n }\n .arap-controls {\n width: 100%;\n }\n .arap-value {\n flex: 1;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .arap-root *,\n .arap-root *::before,\n .arap-root *::after {\n transition: none !important;\n animation: none !important;\n }\n}\n@media (forced-colors: active) {\n .arap-root {\n --arap-surface: Canvas;\n --arap-text: CanvasText;\n --arap-muted: CanvasText;\n --arap-border: ButtonText;\n --arap-divider: ButtonText;\n --arap-accent: Highlight;\n --arap-control: Canvas;\n --arap-selected: Canvas;\n }\n .arap-root button[aria-pressed=true] {\n outline: 2px solid Highlight;\n outline-offset: -4px;\n }\n .arap-root .arap-segment-active {\n color: HighlightText;\n background: Highlight;\n }\n .arap-toggle::before {\n border-color: ButtonText;\n background: Canvas;\n }\n .arap-toggle-knob {\n background: ButtonText;\n }\n .arap-toggle-active .arap-toggle-knob {\n background: Highlight;\n }\n .arap-toggle-active .arap-toggle-knob::after {\n color: HighlightText;\n }\n}\n.arap-root .arap-panel {\n display: flex;\n flex-direction: column;\n overflow: visible;\n}\n.arap-heading {\n flex: none;\n}\n.arap-tools {\n flex: 1 1 auto;\n min-height: 0;\n overflow: auto;\n overscroll-behavior: contain;\n scrollbar-width: thin;\n scrollbar-color: var(--arap-border) transparent;\n padding: 0 3px;\n margin: 0 -3px;\n}\n.arap-tools:focus-visible {\n outline: 3px solid var(--arap-accent);\n outline-offset: -3px;\n}\n.arap-quick-actions {\n position: relative;\n flex: none;\n display: flex;\n align-items: center;\n gap: 8px;\n padding-top: 14px;\n margin-top: 8px;\n border-top: 1px solid var(--arap-divider);\n}\n.arap-actions {\n flex: 1;\n min-width: 0;\n}\n.arap-actions:empty {\n display: none;\n}\n.arap-actions .arap-feature-reset {\n padding: 0;\n margin: 0;\n border: 0;\n}\n.arap-root .arap-position-button,\n.arap-root .arap-position-default,\n.arap-root .arap-position-arrows button {\n min-width: 44px;\n min-height: 44px;\n padding: 8px 10px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n background: var(--arap-control);\n color: var(--arap-accent);\n}\n.arap-root .arap-position-button:hover,\n.arap-root .arap-position-default:hover,\n.arap-root .arap-position-arrows button:hover {\n background: var(--arap-selected);\n border-color: var(--arap-accent);\n}\n.arap-position-popover {\n position: absolute;\n z-index: 1;\n bottom: calc(100% + 8px);\n left: 0;\n width: 100%;\n max-height: calc(100dvh - 160px);\n overflow: auto;\n padding: 14px;\n border: 1px solid var(--arap-border);\n border-radius: 12px;\n background: var(--arap-surface);\n box-shadow: 0 8px 24px #0f172a26;\n}\n.arap-position-popover[hidden] {\n display: none !important;\n}\n.arap-position-label {\n display: block;\n margin-bottom: 6px;\n font-weight: 600;\n}\n.arap-position-popover select {\n width: 100%;\n min-height: 44px;\n padding: 8px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n font: inherit;\n color: var(--arap-text);\n background: var(--arap-surface);\n}\n.arap-position-popover select:focus-visible {\n outline: 3px solid var(--arap-accent);\n outline-offset: 2px;\n}\n.arap-position-arrows {\n display: flex;\n justify-content: space-between;\n gap: 6px;\n margin-top: 10px;\n}\n.arap-position-default {\n width: 100%;\n margin-top: 8px;\n}\n.arap-root .arap-btn[data-draggable=true] {\n touch-action: none;\n user-select: none;\n cursor: grab;\n}\n.arap-root .arap-btn[data-dragging=true] {\n cursor: grabbing;\n}\n.arap-root .arap-btn[data-corner$=left],\n.arap-root .arap-panel[data-corner$=left] {\n right: auto;\n left: max(16px, env(safe-area-inset-left));\n}\n.arap-root .arap-btn[data-corner$=right],\n.arap-root .arap-panel[data-corner$=right] {\n left: auto;\n right: max(16px, env(safe-area-inset-right));\n}\n.arap-root .arap-btn[data-corner^=top] {\n bottom: auto;\n top: max(16px, env(safe-area-inset-top));\n}\n.arap-root .arap-btn[data-corner^=bottom] {\n top: auto;\n bottom: max(16px, env(safe-area-inset-bottom));\n}\n.arap-root .arap-panel[data-corner^=top] {\n bottom: auto;\n top: max(88px, calc(env(safe-area-inset-top) + 72px));\n}\n.arap-root .arap-panel[data-corner^=bottom] {\n top: auto;\n bottom: max(88px, calc(env(safe-area-inset-bottom) + 72px));\n}\n.arap-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n}\n.arap-root .arap-skip-actions {\n position: absolute;\n top: 12px;\n left: 20px;\n width: 44px;\n height: 44px;\n clip-path: inset(50%);\n overflow: hidden;\n pointer-events: none;\n}\n.arap-root .arap-skip-actions:focus-visible {\n right: 20px;\n width: auto;\n height: auto;\n min-height: 44px;\n clip-path: none;\n pointer-events: auto;\n z-index: 2;\n padding: 8px;\n border: 1px solid var(--arap-accent);\n border-radius: 8px;\n background: var(--arap-surface);\n color: var(--arap-accent);\n}\n@media (max-height: 480px) {\n .arap-root .arap-panel {\n top: max(16px, env(safe-area-inset-top)) !important;\n bottom: max(16px, env(safe-area-inset-bottom)) !important;\n max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;\n padding: 8px;\n }\n .arap-heading {\n padding-bottom: 8px;\n }\n .arap-heading h2 {\n font-size: 18px;\n }\n .arap-heading button {\n margin-top: 0;\n }\n .arap-description {\n display: none;\n }\n .arap-quick-actions {\n padding-top: 8px;\n margin-top: 0;\n }\n .arap-root .arap-reset-btn {\n min-height: 44px;\n }\n .arap-root .arap-btn[data-open=true] {\n visibility: hidden;\n }\n .arap-position-popover {\n max-height: calc(100dvh - 96px);\n }\n}\n.arap-statement {\n flex: none;\n padding-top: 10px;\n text-align: center;\n}\n.arap-statement-link {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-height: 44px;\n padding: 6px 12px;\n color: var(--arap-accent);\n text-decoration: underline;\n text-underline-offset: 4px;\n font-size: 14px;\n font-weight: 500;\n border-radius: 8px;\n}\n.arap-statement-link:hover {\n color: var(--arap-accent-hover);\n background: var(--arap-selected);\n}\n.arap-statement-link:focus-visible {\n outline: 3px solid var(--arap-accent);\n outline-offset: 2px;\n}\n.arap-root .arap-btn[data-large-controls=true] {\n width: 64px;\n height: 64px;\n min-width: 48px;\n min-height: 48px;\n}\n.arap-root .arap-panel[data-large-controls=true] {\n width: min(440px, calc(100vw - 32px));\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-heading button {\n width: 48px;\n height: 48px;\n min-width: 48px;\n min-height: 48px;\n font-size: 32px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-btn-sm {\n width: 48px;\n height: 48px;\n min-width: 48px;\n min-height: 48px;\n font-size: 24px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-value {\n min-width: 64px;\n font-size: 16px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-segment {\n min-width: 48px;\n min-height: 48px;\n padding: 10px 14px;\n font-size: 15px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-toggle {\n width: 64px;\n height: 48px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-toggle::before {\n inset: 8px 0;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-toggle-knob {\n top: 12px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-toggle-active .arap-toggle-knob {\n transform: translateX(28px);\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-reset-btn {\n min-height: 52px;\n font-size: 16px;\n padding: 12px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-position-button,\n.arap-root .arap-panel[data-large-controls=true] .arap-position-default,\n.arap-root .arap-panel[data-large-controls=true] .arap-position-arrows button {\n min-width: 48px;\n min-height: 48px;\n font-size: 15px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-position-popover select {\n min-height: 48px;\n font-size: 15px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-statement-link {\n min-height: 48px;\n font-size: 15px;\n padding: 10px 16px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-skip-actions {\n min-width: 48px;\n min-height: 48px;\n}\n');
72
83
 
73
84
  // src/core/AccessibilityPlugin.tsx
74
85
  var import_react4 = require("react");
@@ -175,9 +186,19 @@ function validKey(key) {
175
186
  function isRecord(value) {
176
187
  return !!value && typeof value === "object" && !Array.isArray(value);
177
188
  }
178
- function loadState(key = DEFAULT_STORAGE_KEY) {
189
+ function getStorage(mode = "local") {
190
+ if (mode === "none" || typeof window === "undefined") return null;
179
191
  try {
180
- const raw = JSON.parse(localStorage.getItem(key) || "null");
192
+ return mode === "session" ? window.sessionStorage : window.localStorage;
193
+ } catch {
194
+ return null;
195
+ }
196
+ }
197
+ function loadState(key = DEFAULT_STORAGE_KEY, mode = "local") {
198
+ const storage = getStorage(mode);
199
+ if (!storage) return null;
200
+ try {
201
+ const raw = JSON.parse(storage.getItem(key) || "null");
181
202
  if (!isRecord(raw)) return null;
182
203
  const features = "version" in raw ? raw.version === 1 ? raw.features : null : raw;
183
204
  if (!isRecord(features)) return null;
@@ -188,19 +209,23 @@ function loadState(key = DEFAULT_STORAGE_KEY) {
188
209
  return null;
189
210
  }
190
211
  }
191
- function saveState(state, key = DEFAULT_STORAGE_KEY) {
212
+ function saveState(state, key = DEFAULT_STORAGE_KEY, mode = "local") {
213
+ const storage = getStorage(mode);
214
+ if (!storage) return;
192
215
  try {
193
- localStorage.setItem(key, JSON.stringify({ version: 1, features: state }));
216
+ storage.setItem(key, JSON.stringify({ version: 1, features: state }));
194
217
  } catch {
195
218
  }
196
219
  }
197
- function clearState(key = DEFAULT_STORAGE_KEY) {
220
+ function clearState(key = DEFAULT_STORAGE_KEY, mode = "local") {
221
+ const storage = getStorage(mode);
222
+ if (!storage) return;
198
223
  try {
199
- localStorage.removeItem(key);
224
+ storage.removeItem(key);
200
225
  } catch {
201
226
  }
202
227
  }
203
- function createStorageWriter(key = DEFAULT_STORAGE_KEY) {
228
+ function createStorageWriter(key = DEFAULT_STORAGE_KEY, mode = "local") {
204
229
  let timer;
205
230
  let pending;
206
231
  const cancel = () => {
@@ -211,7 +236,7 @@ function createStorageWriter(key = DEFAULT_STORAGE_KEY) {
211
236
  const flush = () => {
212
237
  const next = pending;
213
238
  cancel();
214
- if (next) saveState(next, key);
239
+ if (next) saveState(next, key, mode);
215
240
  };
216
241
  return {
217
242
  schedule(state) {
@@ -221,7 +246,7 @@ function createStorageWriter(key = DEFAULT_STORAGE_KEY) {
221
246
  },
222
247
  clear() {
223
248
  cancel();
224
- clearState(key);
249
+ clearState(key, mode);
225
250
  },
226
251
  cancel,
227
252
  flush
@@ -229,13 +254,14 @@ function createStorageWriter(key = DEFAULT_STORAGE_KEY) {
229
254
  }
230
255
 
231
256
  // src/core/preferenceStore.ts
232
- function createPreferenceStore(key, persist) {
233
- const writer = createStorageWriter(key);
257
+ function createPreferenceStore(key, persist, storageMode) {
258
+ const resolvedMode = storageMode ?? (persist ? "local" : "none");
259
+ const writer = createStorageWriter(key, resolvedMode);
234
260
  const empty = {};
235
261
  let snapshot2;
236
262
  const listeners = /* @__PURE__ */ new Set();
237
263
  const getSnapshot = () => {
238
- snapshot2 ?? (snapshot2 = persist ? loadState(key) ?? {} : {});
264
+ snapshot2 ?? (snapshot2 = resolvedMode !== "none" ? loadState(key, resolvedMode) ?? {} : {});
239
265
  return snapshot2;
240
266
  };
241
267
  return {
@@ -249,7 +275,7 @@ function createPreferenceStore(key, persist) {
249
275
  },
250
276
  update(update) {
251
277
  snapshot2 = update(getSnapshot());
252
- if (persist) {
278
+ if (resolvedMode !== "none") {
253
279
  if (Object.keys(snapshot2).length) writer.schedule(snapshot2);
254
280
  else writer.clear();
255
281
  }
@@ -500,11 +526,15 @@ function AccessibilityPlugin({
500
526
  children,
501
527
  position = "right",
502
528
  persistenceKey,
503
- persist = true
529
+ persist = true,
530
+ storage,
531
+ locale,
532
+ statementUrl,
533
+ largeControls
504
534
  }) {
505
535
  const [isOpen, setIsOpen] = (0, import_react4.useState)(false);
506
536
  const [store] = (0, import_react4.useState)(
507
- () => createPreferenceStore(persistenceKey, persist)
537
+ () => createPreferenceStore(persistenceKey, persist, storage)
508
538
  );
509
539
  const features = (0, import_react4.useSyncExternalStore)(
510
540
  store.subscribe,
@@ -618,7 +648,10 @@ function AccessibilityPlugin({
618
648
  registerFeature,
619
649
  resetAll,
620
650
  registerReset,
621
- unregisterReset
651
+ unregisterReset,
652
+ locale,
653
+ statementUrl,
654
+ largeControls
622
655
  }),
623
656
  [
624
657
  isOpen,
@@ -634,7 +667,10 @@ function AccessibilityPlugin({
634
667
  registerFeature,
635
668
  resetAll,
636
669
  registerReset,
637
- unregisterReset
670
+ unregisterReset,
671
+ locale,
672
+ statementUrl,
673
+ largeControls
638
674
  ]
639
675
  );
640
676
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AccessibilityContext.Provider, { value, children: [
@@ -673,21 +709,93 @@ function WidgetPortal({ children }) {
673
709
  ) : null;
674
710
  }
675
711
 
712
+ // src/core/i18n/en.ts
713
+ var enLocale = Object.freeze({
714
+ title: "Accessibility settings",
715
+ description: "Adjust your reading experience",
716
+ closeLabel: "Close accessibility settings",
717
+ skipToActions: "Jump to quick actions",
718
+ toolsLabel: "Accessibility tools",
719
+ quickActionsLabel: "Quick actions",
720
+ resetLabel: "Reset all accessibility settings",
721
+ resetAll: "Reset All",
722
+ statementLink: "Accessibility Statement",
723
+ openInNewTab: "opens in a new tab",
724
+ buttonTitle: "Accessibility",
725
+ dragHelp: "Drag to move, or use Alt and arrow keys. The Move button menu offers click and keyboard controls.",
726
+ positionLabel: "Button position",
727
+ moveButton: "Move button",
728
+ moveButtonLabel: "Move accessibility button",
729
+ buttonPositionSelectLabel: "Accessibility button position",
730
+ customPosition: "Custom position",
731
+ resetPosition: "Reset button position",
732
+ doneMoving: "Done moving",
733
+ moveLeft: "Move accessibility button left",
734
+ moveUp: "Move accessibility button up",
735
+ moveDown: "Move accessibility button down",
736
+ moveRight: "Move accessibility button right",
737
+ largeControlsLabel: "Oversized widget controls",
738
+ formatPointPosition: (x, y) => `Button position: ${Math.round(x * 100)}% horizontally, ${Math.round(y * 100)}% vertically.`,
739
+ formatCornerPosition: (corner) => `Button position: ${corner.split("-").join(" ")}.`
740
+ });
741
+
742
+ // src/core/i18n/index.ts
743
+ var dictionaries = {
744
+ en: enLocale
745
+ };
746
+ var RTL_LOCALES = /* @__PURE__ */ new Set([
747
+ "ar",
748
+ "arc",
749
+ "dv",
750
+ "fa",
751
+ "ha",
752
+ "he",
753
+ "khw",
754
+ "ks",
755
+ "ku",
756
+ "ps",
757
+ "ur",
758
+ "yi"
759
+ ]);
760
+ function registerLocale(code, strings) {
761
+ dictionaries[code.toLowerCase()] = strings;
762
+ }
763
+ function isRtlLocale(localeProp) {
764
+ if (!localeProp) return false;
765
+ const base = localeProp.toLowerCase().split("-")[0];
766
+ return RTL_LOCALES.has(base);
767
+ }
768
+ function resolveLocaleStrings(localeProp) {
769
+ const normalized = (localeProp || (typeof document !== "undefined" ? document.documentElement.lang : "en") || "en").trim().toLowerCase();
770
+ if (dictionaries[normalized]) {
771
+ return dictionaries[normalized];
772
+ }
773
+ const base = normalized.split("-")[0];
774
+ if (dictionaries[base]) {
775
+ return dictionaries[base];
776
+ }
777
+ return enLocale;
778
+ }
779
+
676
780
  // src/core/AccessibilityButton.tsx
677
781
  var import_jsx_runtime3 = require("react/jsx-runtime");
678
782
  function AccessibilityButton({
679
783
  icon,
680
784
  draggable = true,
681
- title = "Accessibility",
785
+ title,
682
786
  description,
683
787
  className = "",
684
- style
788
+ style,
789
+ largeControls
685
790
  }) {
686
791
  const ctx = (0, import_react6.useContext)(AccessibilityContext);
687
792
  if (!ctx)
688
793
  throw new Error(
689
794
  "AccessibilityButton must be used within an <AccessibilityPlugin> provider."
690
795
  );
796
+ const strings = resolveLocaleStrings(ctx.locale);
797
+ const buttonTitle = title ?? strings.buttonTitle;
798
+ const isLarge = largeControls ?? ctx.largeControls ?? false;
691
799
  const viewport = useViewport();
692
800
  const triggerSize = useTriggerSize(`${ctx.panelId}-trigger`);
693
801
  const [preview, setPreview] = (0, import_react6.useState)(null);
@@ -708,6 +816,7 @@ function AccessibilityButton({
708
816
  "data-dragging": !!preview,
709
817
  "data-open": ctx.isOpen,
710
818
  "data-position": ctx.position,
819
+ "data-large-controls": isLarge,
711
820
  onPointerDown: (event) => {
712
821
  suppressClick.current = false;
713
822
  if (!draggable || !event.isPrimary || event.button !== 0) return;
@@ -787,7 +896,7 @@ function AccessibilityButton({
787
896
  );
788
897
  }
789
898
  },
790
- "aria-label": title,
899
+ "aria-label": buttonTitle,
791
900
  "aria-keyshortcuts": draggable ? "Alt+ArrowUp Alt+ArrowDown Alt+ArrowLeft Alt+ArrowRight" : void 0,
792
901
  "aria-describedby": description || draggable ? `${ctx.panelId}-trigger-description` : void 0,
793
902
  "aria-expanded": ctx.isOpen,
@@ -809,14 +918,16 @@ function AccessibilityButton({
809
918
  }
810
919
  ) }),
811
920
  (description || draggable) && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { id: `${ctx.panelId}-trigger-description`, hidden: true, children: [
812
- description,
813
- " ",
814
- draggable && "Drag to move, or use Alt and arrow keys. The Move button menu offers click and keyboard controls."
921
+ description ? `${description} ` : "",
922
+ draggable && strings.dragHelp
815
923
  ] })
816
924
  ]
817
925
  }
818
926
  ),
819
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "arap-sr-only", role: "status", children: ctx.widgetPlacement?.kind === "point" ? `Button position: ${Math.round(ctx.widgetPlacement.x * 100)}% horizontally, ${Math.round(ctx.widgetPlacement.y * 100)}% vertically.` : `Button position: ${corner.split("-").join(" ")}.` })
927
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "arap-sr-only", role: "status", children: ctx.widgetPlacement?.kind === "point" ? strings.formatPointPosition ? strings.formatPointPosition(
928
+ ctx.widgetPlacement.x,
929
+ ctx.widgetPlacement.y
930
+ ) : `Button position: ${Math.round(ctx.widgetPlacement.x * 100)}% horizontally, ${Math.round(ctx.widgetPlacement.y * 100)}% vertically.` : strings.formatCornerPosition ? strings.formatCornerPosition(corner) : `Button position: ${corner.split("-").join(" ")}.` })
820
931
  ] });
821
932
  }
822
933
 
@@ -832,6 +943,7 @@ var import_react8 = require("react");
832
943
  var import_jsx_runtime4 = require("react/jsx-runtime");
833
944
  function PositionControls() {
834
945
  const ctx = (0, import_react8.useContext)(AccessibilityContext);
946
+ const strings = resolveLocaleStrings(ctx.locale);
835
947
  const [open, setOpen] = (0, import_react8.useState)(false);
836
948
  const select = (0, import_react8.useRef)(null);
837
949
  const opener = (0, import_react8.useRef)(null);
@@ -863,7 +975,7 @@ function PositionControls() {
863
975
  event.currentTarget.focus();
864
976
  setOpen(!open);
865
977
  },
866
- children: "Move button"
978
+ children: strings.moveButton
867
979
  }
868
980
  ),
869
981
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
@@ -873,7 +985,7 @@ function PositionControls() {
873
985
  className: "arap-position-popover",
874
986
  hidden: !open,
875
987
  role: "group",
876
- "aria-label": "Move accessibility button",
988
+ "aria-label": strings.moveButtonLabel,
877
989
  onKeyDown: (event) => {
878
990
  if (event.key === "Escape") {
879
991
  event.stopPropagation();
@@ -886,7 +998,7 @@ function PositionControls() {
886
998
  {
887
999
  className: "arap-position-label",
888
1000
  htmlFor: `${ctx.panelId}-corner`,
889
- children: "Button position"
1001
+ children: strings.positionLabel
890
1002
  }
891
1003
  ),
892
1004
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
@@ -894,33 +1006,33 @@ function PositionControls() {
894
1006
  {
895
1007
  ref: select,
896
1008
  id: `${ctx.panelId}-corner`,
897
- "aria-label": "Accessibility button position",
1009
+ "aria-label": strings.buttonPositionSelectLabel,
898
1010
  value: ctx.widgetPlacement?.kind === "point" ? "custom" : ctx.widgetPlacement?.corner ?? defaultCorner(ctx.position),
899
1011
  onChange: (event) => ctx.setWidgetPlacement({
900
1012
  kind: "corner",
901
1013
  corner: event.target.value
902
1014
  }),
903
1015
  children: [
904
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "custom", disabled: true, children: "Custom position" }),
1016
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "custom", disabled: true, children: strings.customPosition }),
905
1017
  corners.map((corner) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: corner, children: corner.split("-").join(" ") }, corner))
906
1018
  ]
907
1019
  }
908
1020
  ),
909
1021
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "arap-position-arrows", children: [
910
- ["left", -20, 0, "\u2190"],
911
- ["up", 0, -20, "\u2191"],
912
- ["down", 0, 20, "\u2193"],
913
- ["right", 20, 0, "\u2192"]
914
- ].map(([direction, dx, dy, label]) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1022
+ ["left", -20, 0, "\u2190", strings.moveLeft],
1023
+ ["up", 0, -20, "\u2191", strings.moveUp],
1024
+ ["down", 0, 20, "\u2193", strings.moveDown],
1025
+ ["right", 20, 0, "\u2192", strings.moveRight]
1026
+ ].map(([direction, dx, dy, arrowChar, label]) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
915
1027
  "button",
916
1028
  {
917
1029
  type: "button",
918
- "aria-label": `Move accessibility button ${direction}`,
1030
+ "aria-label": label,
919
1031
  onClick: (event) => {
920
1032
  event.currentTarget.focus();
921
1033
  move(dx, dy);
922
1034
  },
923
- children: label
1035
+ children: arrowChar
924
1036
  },
925
1037
  direction
926
1038
  )) }),
@@ -933,10 +1045,10 @@ function PositionControls() {
933
1045
  event.currentTarget.focus();
934
1046
  ctx.setWidgetPlacement(null);
935
1047
  },
936
- children: "Reset button position"
1048
+ children: strings.resetPosition
937
1049
  }
938
1050
  ),
939
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { className: "arap-position-default", type: "button", onClick: close, children: "Done moving" })
1051
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { className: "arap-position-default", type: "button", onClick: close, children: strings.doneMoving })
940
1052
  ]
941
1053
  }
942
1054
  )
@@ -950,11 +1062,22 @@ function Panel({
950
1062
  footer,
951
1063
  className = "",
952
1064
  style,
953
- title = "Accessibility settings",
954
- description = "Adjust your reading experience",
955
- closeLabel = "Close accessibility settings"
1065
+ title,
1066
+ description,
1067
+ closeLabel,
1068
+ statementUrl,
1069
+ largeControls,
1070
+ locale
956
1071
  }) {
957
1072
  const ctx = (0, import_react9.useContext)(AccessibilityContext);
1073
+ const effectiveLocale = locale ?? ctx.locale;
1074
+ const strings = resolveLocaleStrings(effectiveLocale);
1075
+ const panelTitle = title ?? strings.title;
1076
+ const panelDescription = description === void 0 ? strings.description : description;
1077
+ const panelCloseLabel = closeLabel ?? strings.closeLabel;
1078
+ const effectiveStatementUrl = statementUrl ?? ctx.statementUrl;
1079
+ const isLarge = largeControls ?? ctx.largeControls ?? false;
1080
+ const isRtl = isRtlLocale(effectiveLocale);
958
1081
  const panel = (0, import_react9.useRef)(null);
959
1082
  const [actions, setActions] = (0, import_react9.useState)(null);
960
1083
  const viewport = useViewport();
@@ -988,10 +1111,14 @@ function Panel({
988
1111
  },
989
1112
  "data-corner": corner,
990
1113
  "data-position": ctx.position,
1114
+ "data-large-controls": isLarge,
1115
+ lang: effectiveLocale ?? "en",
1116
+ dir: isRtl ? "rtl" : "ltr",
1117
+ translate: "no",
991
1118
  hidden: !ctx.isOpen,
992
1119
  role: "region",
993
- "aria-label": title,
994
- "aria-describedby": description ? `${ctx.panelId}-description` : void 0,
1120
+ "aria-label": panelTitle,
1121
+ "aria-describedby": panelDescription ? `${ctx.panelId}-description` : void 0,
995
1122
  tabIndex: -1,
996
1123
  onKeyDown: (event) => {
997
1124
  if (event.key === "Escape" && !event.defaultPrevented) {
@@ -1002,10 +1129,18 @@ function Panel({
1002
1129
  children: [
1003
1130
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "arap-heading", children: [
1004
1131
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "arap-heading-copy", children: [
1005
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { children: title }),
1006
- description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { id: `${ctx.panelId}-description`, className: "arap-description", children: description })
1132
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { children: panelTitle }),
1133
+ panelDescription && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { id: `${ctx.panelId}-description`, className: "arap-description", children: panelDescription })
1007
1134
  ] }),
1008
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", "aria-label": closeLabel, onClick: ctx.closeMenu, children: "\xD7" })
1135
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1136
+ "button",
1137
+ {
1138
+ type: "button",
1139
+ "aria-label": panelCloseLabel,
1140
+ onClick: ctx.closeMenu,
1141
+ children: "\xD7"
1142
+ }
1143
+ )
1009
1144
  ] }),
1010
1145
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1011
1146
  "button",
@@ -1018,7 +1153,7 @@ function Panel({
1018
1153
  );
1019
1154
  target?.focus();
1020
1155
  },
1021
- children: "Jump to quick actions"
1156
+ children: strings.skipToActions
1022
1157
  }
1023
1158
  ),
1024
1159
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PanelActionsContext.Provider, { value: actions, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
@@ -1027,7 +1162,7 @@ function Panel({
1027
1162
  className: "arap-tools",
1028
1163
  role: "group",
1029
1164
  tabIndex: 0,
1030
- "aria-label": "Accessibility tools",
1165
+ "aria-label": strings.toolsLabel,
1031
1166
  children
1032
1167
  }
1033
1168
  ) }),
@@ -1036,13 +1171,30 @@ function Panel({
1036
1171
  {
1037
1172
  className: "arap-quick-actions",
1038
1173
  role: "group",
1039
- "aria-label": "Quick actions",
1174
+ "aria-label": strings.quickActionsLabel,
1040
1175
  children: [
1041
1176
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PositionControls, {}, ctx.isOpen ? "open" : "closed"),
1042
1177
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "arap-actions", ref: setActions, children: footer })
1043
1178
  ]
1044
1179
  }
1045
- )
1180
+ ),
1181
+ effectiveStatementUrl && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "arap-statement", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1182
+ "a",
1183
+ {
1184
+ href: effectiveStatementUrl,
1185
+ className: "arap-statement-link",
1186
+ target: "_blank",
1187
+ rel: "noopener noreferrer",
1188
+ children: [
1189
+ strings.statementLink,
1190
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "arap-sr-only", children: [
1191
+ " (",
1192
+ strings.openInNewTab,
1193
+ ")"
1194
+ ] })
1195
+ ]
1196
+ }
1197
+ ) })
1046
1198
  ]
1047
1199
  }
1048
1200
  );
@@ -1094,6 +1246,304 @@ function useAccessibility(featureKey, defaultValue, options) {
1094
1246
  return { value, setValue, reset };
1095
1247
  }
1096
1248
 
1249
+ // src/core/preferences/defaults.ts
1250
+ var DEFAULT_PREFERENCES = Object.freeze({
1251
+ fontScale: 1,
1252
+ lineHeight: null,
1253
+ letterSpacingEm: null,
1254
+ wordSpacingEm: null,
1255
+ paragraphSpacingEm: null,
1256
+ textAlign: "original",
1257
+ contrastMode: "off",
1258
+ highlightLinks: false,
1259
+ highlightFocus: false,
1260
+ reduceMotion: false,
1261
+ hideDecorativeImages: false,
1262
+ fontFamily: "original",
1263
+ cursorSize: "original",
1264
+ readerMode: "off",
1265
+ saturation: "original",
1266
+ tooltips: false
1267
+ });
1268
+ var PROFILE_DEFINITIONS = {
1269
+ motor: {
1270
+ id: "motor",
1271
+ label: "Motor Impaired",
1272
+ description: "Enhanced focus rings, richer tooltips, and reduced motion.",
1273
+ settings: {
1274
+ reduceMotion: true,
1275
+ highlightFocus: true,
1276
+ tooltips: true
1277
+ }
1278
+ },
1279
+ blind: {
1280
+ id: "blind",
1281
+ label: "Blind & Screen Reader",
1282
+ description: "Semantic assistance and accessible authored descriptions.",
1283
+ settings: {
1284
+ tooltips: true
1285
+ }
1286
+ },
1287
+ "color-blind": {
1288
+ id: "color-blind",
1289
+ label: "Color Blind",
1290
+ description: "High contrast accents and non-color-only link indicators.",
1291
+ settings: {
1292
+ contrastMode: "high",
1293
+ highlightLinks: true
1294
+ }
1295
+ },
1296
+ dyslexia: {
1297
+ id: "dyslexia",
1298
+ label: "Dyslexia Friendly",
1299
+ description: "Legible typeface, reading guide line, and reduced motion.",
1300
+ settings: {
1301
+ fontFamily: "dyslexia-option",
1302
+ readerMode: "guide",
1303
+ reduceMotion: true
1304
+ }
1305
+ },
1306
+ "low-vision": {
1307
+ id: "low-vision",
1308
+ label: "Low Vision",
1309
+ description: "Enlarged text, large cursor pointer, and high-visibility focus.",
1310
+ settings: {
1311
+ fontScale: 1.25,
1312
+ cursorSize: "large",
1313
+ highlightFocus: true,
1314
+ tooltips: true
1315
+ }
1316
+ },
1317
+ cognitive: {
1318
+ id: "cognitive",
1319
+ label: "Cognitive & Learning",
1320
+ description: "Mild text scaling, reading guide line, and distraction reduction.",
1321
+ settings: {
1322
+ fontScale: 1.125,
1323
+ readerMode: "guide",
1324
+ reduceMotion: true,
1325
+ tooltips: true
1326
+ }
1327
+ },
1328
+ seizure: {
1329
+ id: "seizure",
1330
+ label: "Seizure & Epileptic",
1331
+ description: "Pauses nonessential motion and reduces transition flashes.",
1332
+ settings: {
1333
+ reduceMotion: true
1334
+ }
1335
+ },
1336
+ adhd: {
1337
+ id: "adhd",
1338
+ label: "ADHD / Focus",
1339
+ description: "Reading mask spotlight and reduced animation distraction.",
1340
+ settings: {
1341
+ readerMode: "mask",
1342
+ reduceMotion: true
1343
+ }
1344
+ }
1345
+ };
1346
+
1347
+ // src/core/preferences/registry.ts
1348
+ var VALID_CONTRAST_MODES = /* @__PURE__ */ new Set([
1349
+ "off",
1350
+ "light",
1351
+ "dark",
1352
+ "high",
1353
+ "invert"
1354
+ ]);
1355
+ var VALID_READER_MODES = /* @__PURE__ */ new Set([
1356
+ "off",
1357
+ "guide",
1358
+ "mask"
1359
+ ]);
1360
+ var VALID_TEXT_ALIGNS = /* @__PURE__ */ new Set([
1361
+ "original",
1362
+ "left",
1363
+ "right",
1364
+ "center",
1365
+ "justify"
1366
+ ]);
1367
+ var VALID_FONT_FAMILIES = /* @__PURE__ */ new Set([
1368
+ "original",
1369
+ "legible",
1370
+ "dyslexia-option"
1371
+ ]);
1372
+ var VALID_CURSOR_SIZES = /* @__PURE__ */ new Set([
1373
+ "original",
1374
+ "large"
1375
+ ]);
1376
+ var VALID_SATURATIONS = /* @__PURE__ */ new Set([
1377
+ "original",
1378
+ "low",
1379
+ "high",
1380
+ "grayscale"
1381
+ ]);
1382
+ function clamp(value, min, max) {
1383
+ if (Number.isNaN(value) || !Number.isFinite(value)) return min;
1384
+ return Math.min(Math.max(value, min), max);
1385
+ }
1386
+ function normalizePreferenceValue(key, value) {
1387
+ switch (key) {
1388
+ case "fontScale":
1389
+ return typeof value === "number" ? clamp(value, 0.5, 2) : 1;
1390
+ case "lineHeight":
1391
+ if (value === null || value === void 0)
1392
+ return null;
1393
+ return typeof value === "number" ? clamp(value, 0.5, 2) : null;
1394
+ case "letterSpacingEm":
1395
+ if (value === null || value === void 0)
1396
+ return null;
1397
+ return typeof value === "number" ? clamp(value, 0, 0.5) : null;
1398
+ case "wordSpacingEm":
1399
+ if (value === null || value === void 0)
1400
+ return null;
1401
+ return typeof value === "number" ? clamp(value, 0, 0.5) : null;
1402
+ case "paragraphSpacingEm":
1403
+ if (value === null || value === void 0)
1404
+ return null;
1405
+ return typeof value === "number" ? clamp(value, 0, 1) : null;
1406
+ case "textAlign":
1407
+ return typeof value === "string" && VALID_TEXT_ALIGNS.has(value) ? value : "original";
1408
+ case "contrastMode":
1409
+ return typeof value === "string" && VALID_CONTRAST_MODES.has(value) ? value : "off";
1410
+ case "fontFamily":
1411
+ return typeof value === "string" && VALID_FONT_FAMILIES.has(value) ? value : "original";
1412
+ case "cursorSize":
1413
+ return typeof value === "string" && VALID_CURSOR_SIZES.has(value) ? value : "original";
1414
+ case "readerMode":
1415
+ return typeof value === "string" && VALID_READER_MODES.has(value) ? value : "off";
1416
+ case "saturation":
1417
+ return typeof value === "string" && VALID_SATURATIONS.has(value) ? value : "original";
1418
+ case "highlightLinks":
1419
+ case "highlightFocus":
1420
+ case "reduceMotion":
1421
+ case "hideDecorativeImages":
1422
+ case "tooltips":
1423
+ return Boolean(value);
1424
+ default:
1425
+ return value;
1426
+ }
1427
+ }
1428
+ function normalizePreferences(input) {
1429
+ const result = { ...DEFAULT_PREFERENCES };
1430
+ if (!input || typeof input !== "object") return result;
1431
+ for (const k of Object.keys(DEFAULT_PREFERENCES)) {
1432
+ if (k in input && input[k] !== void 0) {
1433
+ result[k] = normalizePreferenceValue(k, input[k]);
1434
+ }
1435
+ }
1436
+ return result;
1437
+ }
1438
+ function resolveEffectivePreferences(base, profileSnapshot, overrides) {
1439
+ const merged = {
1440
+ ...DEFAULT_PREFERENCES,
1441
+ ...base,
1442
+ ...profileSnapshot ?? {},
1443
+ ...overrides
1444
+ };
1445
+ return normalizePreferences(merged);
1446
+ }
1447
+
1448
+ // src/core/preferences/reducer.ts
1449
+ function createInitialPreferencesState(initial) {
1450
+ const base = normalizePreferences(initial);
1451
+ return {
1452
+ base,
1453
+ activeProfileId: null,
1454
+ profileSnapshot: null,
1455
+ overrides: {},
1456
+ effective: { ...base }
1457
+ };
1458
+ }
1459
+ function preferencesReducer(state, action) {
1460
+ switch (action.type) {
1461
+ case "SET_PREFERENCE": {
1462
+ const normalizedValue = normalizePreferenceValue(
1463
+ action.key,
1464
+ action.value
1465
+ );
1466
+ if (state.activeProfileId) {
1467
+ const nextOverrides = {
1468
+ ...state.overrides,
1469
+ [action.key]: normalizedValue
1470
+ };
1471
+ return {
1472
+ ...state,
1473
+ overrides: nextOverrides,
1474
+ effective: resolveEffectivePreferences(
1475
+ state.base,
1476
+ state.profileSnapshot,
1477
+ nextOverrides
1478
+ )
1479
+ };
1480
+ }
1481
+ const nextBase = {
1482
+ ...state.base,
1483
+ [action.key]: normalizedValue
1484
+ };
1485
+ return {
1486
+ ...state,
1487
+ base: nextBase,
1488
+ effective: resolveEffectivePreferences(nextBase, null, state.overrides)
1489
+ };
1490
+ }
1491
+ case "APPLY_PROFILE": {
1492
+ const profile = PROFILE_DEFINITIONS[action.profileId];
1493
+ const settings = action.settings || profile?.settings || {};
1494
+ const profileSnapshot = { ...settings };
1495
+ const nextOverrides = {};
1496
+ return {
1497
+ ...state,
1498
+ activeProfileId: action.profileId,
1499
+ profileSnapshot,
1500
+ overrides: nextOverrides,
1501
+ effective: resolveEffectivePreferences(
1502
+ state.base,
1503
+ profileSnapshot,
1504
+ nextOverrides
1505
+ )
1506
+ };
1507
+ }
1508
+ case "CLEAR_PROFILE": {
1509
+ const nextBase = {
1510
+ ...state.base,
1511
+ ...state.overrides
1512
+ };
1513
+ return {
1514
+ ...state,
1515
+ activeProfileId: null,
1516
+ profileSnapshot: null,
1517
+ overrides: {},
1518
+ effective: normalizePreferences(nextBase),
1519
+ base: nextBase
1520
+ };
1521
+ }
1522
+ case "RESET_ALL": {
1523
+ const cleanBase = { ...DEFAULT_PREFERENCES };
1524
+ return {
1525
+ base: cleanBase,
1526
+ activeProfileId: null,
1527
+ profileSnapshot: null,
1528
+ overrides: {},
1529
+ effective: cleanBase
1530
+ };
1531
+ }
1532
+ case "IMPORT_PREFERENCES": {
1533
+ const cleanBase = normalizePreferences(action.preferences);
1534
+ return {
1535
+ base: cleanBase,
1536
+ activeProfileId: null,
1537
+ profileSnapshot: null,
1538
+ overrides: {},
1539
+ effective: cleanBase
1540
+ };
1541
+ }
1542
+ default:
1543
+ return state;
1544
+ }
1545
+ }
1546
+
1097
1547
  // src/core/FeatureIcon.tsx
1098
1548
  var import_jsx_runtime6 = require("react/jsx-runtime");
1099
1549
  var drawings = {
@@ -1687,9 +2137,10 @@ function ResetController() {
1687
2137
  }
1688
2138
  const actionHost = (0, import_react11.useContext)(PanelActionsContext);
1689
2139
  const { resetAll } = ctx;
2140
+ const strings = resolveLocaleStrings(ctx.locale);
1690
2141
  const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "arap-feature arap-feature-reset", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("button", { className: "arap-reset-btn", onClick: resetAll, type: "button", children: [
1691
2142
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FeatureIcon, { name: "reset" }),
1692
- "Reset All"
2143
+ strings.resetAll
1693
2144
  ] }) });
1694
2145
  return actionHost ? (0, import_react_dom2.createPortal)(button, actionHost) : button;
1695
2146
  }
@@ -1701,6 +2152,7 @@ function ResetController() {
1701
2152
  AccessibilityPlugin,
1702
2153
  BigCursorController,
1703
2154
  ContrastController,
2155
+ DEFAULT_PREFERENCES,
1704
2156
  FontSizeController,
1705
2157
  GrayscaleController,
1706
2158
  HideImagesController,
@@ -1709,11 +2161,21 @@ function ResetController() {
1709
2161
  LetterSpacingController,
1710
2162
  LineHeightController,
1711
2163
  LinkHighlightController,
2164
+ PROFILE_DEFINITIONS,
1712
2165
  ReadingGuideController,
1713
2166
  ReadingMaskController,
1714
2167
  ResetController,
1715
2168
  SaturationController,
1716
2169
  TextAlignController,
2170
+ createInitialPreferencesState,
2171
+ enLocale,
2172
+ isRtlLocale,
2173
+ normalizePreferenceValue,
2174
+ normalizePreferences,
2175
+ preferencesReducer,
2176
+ registerLocale,
2177
+ resolveEffectivePreferences,
2178
+ resolveLocaleStrings,
1717
2179
  useAccessibility
1718
2180
  });
1719
2181
  //# sourceMappingURL=index.js.map