accessibility-plugin-react 2.0.2 → 2.2.1
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.d.mts +135 -4
- package/dist/index.d.ts +135 -4
- package/dist/index.js +540 -59
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +529 -59
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +110 -0
- package/docs/BASELINE_AUDIT.md +219 -0
- package/docs/RELEASE.md +2 -2
- package/package.json +5 -5
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
|
|
189
|
+
function getStorage(mode = "local") {
|
|
190
|
+
if (mode === "none" || typeof window === "undefined") return null;
|
|
179
191
|
try {
|
|
180
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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 =
|
|
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 (
|
|
278
|
+
if (resolvedMode !== "none") {
|
|
253
279
|
if (Object.keys(snapshot2).length) writer.schedule(snapshot2);
|
|
254
280
|
else writer.clear();
|
|
255
281
|
}
|
|
@@ -323,7 +349,8 @@ function validValue(key, value, fallback, validate) {
|
|
|
323
349
|
|
|
324
350
|
// src/core/effects.ts
|
|
325
351
|
var import_react3 = require("react");
|
|
326
|
-
var EXCLUDED = "[data-arap-ui], [data-arap-ui] *, script, style, link, meta";
|
|
352
|
+
var EXCLUDED = "[data-arap-ui], [data-arap-ui] *, script, style, link, meta, noscript, template";
|
|
353
|
+
var MAX_HOST_ELEMENTS = 4e3;
|
|
327
354
|
var cursor = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M4 2v32l9-9 7 13 6-3-7-12h14z' fill='black' stroke='white' stroke-width='2'/%3E%3C/svg%3E") 4 2, auto`;
|
|
328
355
|
var palette = {
|
|
329
356
|
"yellow-on-black": ["#ffff00", "#000000"],
|
|
@@ -355,9 +382,10 @@ function applyPage(values) {
|
|
|
355
382
|
else element.style.removeProperty(property);
|
|
356
383
|
});
|
|
357
384
|
}
|
|
358
|
-
const
|
|
385
|
+
const allElements = Array.from(
|
|
359
386
|
document.body.querySelectorAll("*")
|
|
360
387
|
).filter((el) => el instanceof HTMLElement && !el.matches(EXCLUDED));
|
|
388
|
+
const elements = allElements.length > MAX_HOST_ELEMENTS ? allElements.slice(0, MAX_HOST_ELEMENTS) : allElements;
|
|
361
389
|
const font = Number(values.fontSize ?? 100) / 100;
|
|
362
390
|
const line = Number(values.lineHeight ?? 100) / 100;
|
|
363
391
|
const measurements = font !== 1 || line !== 1 ? elements.map((el) => {
|
|
@@ -423,6 +451,10 @@ function applyPage(values) {
|
|
|
423
451
|
};
|
|
424
452
|
}
|
|
425
453
|
function readingAid(mask) {
|
|
454
|
+
const existing = document.body.querySelectorAll(
|
|
455
|
+
mask ? ".arap-reading-mask" : ".arap-reading-guide"
|
|
456
|
+
);
|
|
457
|
+
existing.forEach((node) => node.remove());
|
|
426
458
|
const el = document.createElement("div");
|
|
427
459
|
el.dataset.arapUi = "";
|
|
428
460
|
el.className = mask ? "arap-reading-mask" : "arap-reading-guide";
|
|
@@ -454,6 +486,8 @@ function useBuiltinEffects(values) {
|
|
|
454
486
|
))
|
|
455
487
|
return;
|
|
456
488
|
let undo = applyPage(values);
|
|
489
|
+
let mutationTimer = null;
|
|
490
|
+
let resizeTimer = null;
|
|
457
491
|
const observer = new MutationObserver((records) => {
|
|
458
492
|
if (!records.some(
|
|
459
493
|
(record) => record.target instanceof Element && !record.target.closest("[data-arap-ui]") && [...record.addedNodes, ...record.removedNodes].some(
|
|
@@ -461,16 +495,24 @@ function useBuiltinEffects(values) {
|
|
|
461
495
|
)
|
|
462
496
|
))
|
|
463
497
|
return;
|
|
464
|
-
|
|
465
|
-
|
|
498
|
+
if (mutationTimer) clearTimeout(mutationTimer);
|
|
499
|
+
mutationTimer = setTimeout(() => {
|
|
500
|
+
undo();
|
|
501
|
+
undo = applyPage(values);
|
|
502
|
+
}, 16);
|
|
466
503
|
});
|
|
467
504
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
468
505
|
const resize = () => {
|
|
469
|
-
|
|
470
|
-
|
|
506
|
+
if (resizeTimer) clearTimeout(resizeTimer);
|
|
507
|
+
resizeTimer = setTimeout(() => {
|
|
508
|
+
undo();
|
|
509
|
+
undo = applyPage(values);
|
|
510
|
+
}, 50);
|
|
471
511
|
};
|
|
472
512
|
window.addEventListener("resize", resize);
|
|
473
513
|
return () => {
|
|
514
|
+
if (mutationTimer) clearTimeout(mutationTimer);
|
|
515
|
+
if (resizeTimer) clearTimeout(resizeTimer);
|
|
474
516
|
observer.disconnect();
|
|
475
517
|
window.removeEventListener("resize", resize);
|
|
476
518
|
undo();
|
|
@@ -489,7 +531,10 @@ function CustomEffect({
|
|
|
489
531
|
definition,
|
|
490
532
|
value
|
|
491
533
|
}) {
|
|
492
|
-
(0, import_react3.useEffect)(() =>
|
|
534
|
+
(0, import_react3.useEffect)(() => {
|
|
535
|
+
const cleanup = definition.apply?.(value);
|
|
536
|
+
return typeof cleanup === "function" ? cleanup : void 0;
|
|
537
|
+
}, [definition, value]);
|
|
493
538
|
return null;
|
|
494
539
|
}
|
|
495
540
|
|
|
@@ -500,11 +545,15 @@ function AccessibilityPlugin({
|
|
|
500
545
|
children,
|
|
501
546
|
position = "right",
|
|
502
547
|
persistenceKey,
|
|
503
|
-
persist = true
|
|
548
|
+
persist = true,
|
|
549
|
+
storage,
|
|
550
|
+
locale,
|
|
551
|
+
statementUrl,
|
|
552
|
+
largeControls
|
|
504
553
|
}) {
|
|
505
554
|
const [isOpen, setIsOpen] = (0, import_react4.useState)(false);
|
|
506
555
|
const [store] = (0, import_react4.useState)(
|
|
507
|
-
() => createPreferenceStore(persistenceKey, persist)
|
|
556
|
+
() => createPreferenceStore(persistenceKey, persist, storage)
|
|
508
557
|
);
|
|
509
558
|
const features = (0, import_react4.useSyncExternalStore)(
|
|
510
559
|
store.subscribe,
|
|
@@ -618,7 +667,10 @@ function AccessibilityPlugin({
|
|
|
618
667
|
registerFeature,
|
|
619
668
|
resetAll,
|
|
620
669
|
registerReset,
|
|
621
|
-
unregisterReset
|
|
670
|
+
unregisterReset,
|
|
671
|
+
locale,
|
|
672
|
+
statementUrl,
|
|
673
|
+
largeControls
|
|
622
674
|
}),
|
|
623
675
|
[
|
|
624
676
|
isOpen,
|
|
@@ -634,7 +686,10 @@ function AccessibilityPlugin({
|
|
|
634
686
|
registerFeature,
|
|
635
687
|
resetAll,
|
|
636
688
|
registerReset,
|
|
637
|
-
unregisterReset
|
|
689
|
+
unregisterReset,
|
|
690
|
+
locale,
|
|
691
|
+
statementUrl,
|
|
692
|
+
largeControls
|
|
638
693
|
]
|
|
639
694
|
);
|
|
640
695
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AccessibilityContext.Provider, { value, children: [
|
|
@@ -673,21 +728,93 @@ function WidgetPortal({ children }) {
|
|
|
673
728
|
) : null;
|
|
674
729
|
}
|
|
675
730
|
|
|
731
|
+
// src/core/i18n/en.ts
|
|
732
|
+
var enLocale = Object.freeze({
|
|
733
|
+
title: "Accessibility settings",
|
|
734
|
+
description: "Adjust your reading experience",
|
|
735
|
+
closeLabel: "Close accessibility settings",
|
|
736
|
+
skipToActions: "Jump to quick actions",
|
|
737
|
+
toolsLabel: "Accessibility tools",
|
|
738
|
+
quickActionsLabel: "Quick actions",
|
|
739
|
+
resetLabel: "Reset all accessibility settings",
|
|
740
|
+
resetAll: "Reset All",
|
|
741
|
+
statementLink: "Accessibility Statement",
|
|
742
|
+
openInNewTab: "opens in a new tab",
|
|
743
|
+
buttonTitle: "Accessibility",
|
|
744
|
+
dragHelp: "Drag to move, or use Alt and arrow keys. The Move button menu offers click and keyboard controls.",
|
|
745
|
+
positionLabel: "Button position",
|
|
746
|
+
moveButton: "Move button",
|
|
747
|
+
moveButtonLabel: "Move accessibility button",
|
|
748
|
+
buttonPositionSelectLabel: "Accessibility button position",
|
|
749
|
+
customPosition: "Custom position",
|
|
750
|
+
resetPosition: "Reset button position",
|
|
751
|
+
doneMoving: "Done moving",
|
|
752
|
+
moveLeft: "Move accessibility button left",
|
|
753
|
+
moveUp: "Move accessibility button up",
|
|
754
|
+
moveDown: "Move accessibility button down",
|
|
755
|
+
moveRight: "Move accessibility button right",
|
|
756
|
+
largeControlsLabel: "Oversized widget controls",
|
|
757
|
+
formatPointPosition: (x, y) => `Button position: ${Math.round(x * 100)}% horizontally, ${Math.round(y * 100)}% vertically.`,
|
|
758
|
+
formatCornerPosition: (corner) => `Button position: ${corner.split("-").join(" ")}.`
|
|
759
|
+
});
|
|
760
|
+
|
|
761
|
+
// src/core/i18n/index.ts
|
|
762
|
+
var dictionaries = {
|
|
763
|
+
en: enLocale
|
|
764
|
+
};
|
|
765
|
+
var RTL_LOCALES = /* @__PURE__ */ new Set([
|
|
766
|
+
"ar",
|
|
767
|
+
"arc",
|
|
768
|
+
"dv",
|
|
769
|
+
"fa",
|
|
770
|
+
"ha",
|
|
771
|
+
"he",
|
|
772
|
+
"khw",
|
|
773
|
+
"ks",
|
|
774
|
+
"ku",
|
|
775
|
+
"ps",
|
|
776
|
+
"ur",
|
|
777
|
+
"yi"
|
|
778
|
+
]);
|
|
779
|
+
function registerLocale(code, strings) {
|
|
780
|
+
dictionaries[code.toLowerCase()] = strings;
|
|
781
|
+
}
|
|
782
|
+
function isRtlLocale(localeProp) {
|
|
783
|
+
if (!localeProp) return false;
|
|
784
|
+
const base = localeProp.toLowerCase().split("-")[0];
|
|
785
|
+
return RTL_LOCALES.has(base);
|
|
786
|
+
}
|
|
787
|
+
function resolveLocaleStrings(localeProp) {
|
|
788
|
+
const normalized = (localeProp || (typeof document !== "undefined" ? document.documentElement.lang : "en") || "en").trim().toLowerCase();
|
|
789
|
+
if (dictionaries[normalized]) {
|
|
790
|
+
return dictionaries[normalized];
|
|
791
|
+
}
|
|
792
|
+
const base = normalized.split("-")[0];
|
|
793
|
+
if (dictionaries[base]) {
|
|
794
|
+
return dictionaries[base];
|
|
795
|
+
}
|
|
796
|
+
return enLocale;
|
|
797
|
+
}
|
|
798
|
+
|
|
676
799
|
// src/core/AccessibilityButton.tsx
|
|
677
800
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
678
801
|
function AccessibilityButton({
|
|
679
802
|
icon,
|
|
680
803
|
draggable = true,
|
|
681
|
-
title
|
|
804
|
+
title,
|
|
682
805
|
description,
|
|
683
806
|
className = "",
|
|
684
|
-
style
|
|
807
|
+
style,
|
|
808
|
+
largeControls
|
|
685
809
|
}) {
|
|
686
810
|
const ctx = (0, import_react6.useContext)(AccessibilityContext);
|
|
687
811
|
if (!ctx)
|
|
688
812
|
throw new Error(
|
|
689
813
|
"AccessibilityButton must be used within an <AccessibilityPlugin> provider."
|
|
690
814
|
);
|
|
815
|
+
const strings = resolveLocaleStrings(ctx.locale);
|
|
816
|
+
const buttonTitle = title ?? strings.buttonTitle;
|
|
817
|
+
const isLarge = largeControls ?? ctx.largeControls ?? false;
|
|
691
818
|
const viewport = useViewport();
|
|
692
819
|
const triggerSize = useTriggerSize(`${ctx.panelId}-trigger`);
|
|
693
820
|
const [preview, setPreview] = (0, import_react6.useState)(null);
|
|
@@ -708,6 +835,7 @@ function AccessibilityButton({
|
|
|
708
835
|
"data-dragging": !!preview,
|
|
709
836
|
"data-open": ctx.isOpen,
|
|
710
837
|
"data-position": ctx.position,
|
|
838
|
+
"data-large-controls": isLarge,
|
|
711
839
|
onPointerDown: (event) => {
|
|
712
840
|
suppressClick.current = false;
|
|
713
841
|
if (!draggable || !event.isPrimary || event.button !== 0) return;
|
|
@@ -787,7 +915,7 @@ function AccessibilityButton({
|
|
|
787
915
|
);
|
|
788
916
|
}
|
|
789
917
|
},
|
|
790
|
-
"aria-label":
|
|
918
|
+
"aria-label": buttonTitle,
|
|
791
919
|
"aria-keyshortcuts": draggable ? "Alt+ArrowUp Alt+ArrowDown Alt+ArrowLeft Alt+ArrowRight" : void 0,
|
|
792
920
|
"aria-describedby": description || draggable ? `${ctx.panelId}-trigger-description` : void 0,
|
|
793
921
|
"aria-expanded": ctx.isOpen,
|
|
@@ -809,14 +937,16 @@ function AccessibilityButton({
|
|
|
809
937
|
}
|
|
810
938
|
) }),
|
|
811
939
|
(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."
|
|
940
|
+
description ? `${description} ` : "",
|
|
941
|
+
draggable && strings.dragHelp
|
|
815
942
|
] })
|
|
816
943
|
]
|
|
817
944
|
}
|
|
818
945
|
),
|
|
819
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "arap-sr-only", role: "status", children: ctx.widgetPlacement?.kind === "point" ?
|
|
946
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "arap-sr-only", role: "status", children: ctx.widgetPlacement?.kind === "point" ? strings.formatPointPosition ? strings.formatPointPosition(
|
|
947
|
+
ctx.widgetPlacement.x,
|
|
948
|
+
ctx.widgetPlacement.y
|
|
949
|
+
) : `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
950
|
] });
|
|
821
951
|
}
|
|
822
952
|
|
|
@@ -832,6 +962,7 @@ var import_react8 = require("react");
|
|
|
832
962
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
833
963
|
function PositionControls() {
|
|
834
964
|
const ctx = (0, import_react8.useContext)(AccessibilityContext);
|
|
965
|
+
const strings = resolveLocaleStrings(ctx.locale);
|
|
835
966
|
const [open, setOpen] = (0, import_react8.useState)(false);
|
|
836
967
|
const select = (0, import_react8.useRef)(null);
|
|
837
968
|
const opener = (0, import_react8.useRef)(null);
|
|
@@ -863,7 +994,7 @@ function PositionControls() {
|
|
|
863
994
|
event.currentTarget.focus();
|
|
864
995
|
setOpen(!open);
|
|
865
996
|
},
|
|
866
|
-
children:
|
|
997
|
+
children: strings.moveButton
|
|
867
998
|
}
|
|
868
999
|
),
|
|
869
1000
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
@@ -873,7 +1004,7 @@ function PositionControls() {
|
|
|
873
1004
|
className: "arap-position-popover",
|
|
874
1005
|
hidden: !open,
|
|
875
1006
|
role: "group",
|
|
876
|
-
"aria-label":
|
|
1007
|
+
"aria-label": strings.moveButtonLabel,
|
|
877
1008
|
onKeyDown: (event) => {
|
|
878
1009
|
if (event.key === "Escape") {
|
|
879
1010
|
event.stopPropagation();
|
|
@@ -886,7 +1017,7 @@ function PositionControls() {
|
|
|
886
1017
|
{
|
|
887
1018
|
className: "arap-position-label",
|
|
888
1019
|
htmlFor: `${ctx.panelId}-corner`,
|
|
889
|
-
children:
|
|
1020
|
+
children: strings.positionLabel
|
|
890
1021
|
}
|
|
891
1022
|
),
|
|
892
1023
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
@@ -894,33 +1025,33 @@ function PositionControls() {
|
|
|
894
1025
|
{
|
|
895
1026
|
ref: select,
|
|
896
1027
|
id: `${ctx.panelId}-corner`,
|
|
897
|
-
"aria-label":
|
|
1028
|
+
"aria-label": strings.buttonPositionSelectLabel,
|
|
898
1029
|
value: ctx.widgetPlacement?.kind === "point" ? "custom" : ctx.widgetPlacement?.corner ?? defaultCorner(ctx.position),
|
|
899
1030
|
onChange: (event) => ctx.setWidgetPlacement({
|
|
900
1031
|
kind: "corner",
|
|
901
1032
|
corner: event.target.value
|
|
902
1033
|
}),
|
|
903
1034
|
children: [
|
|
904
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "custom", disabled: true, children:
|
|
1035
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "custom", disabled: true, children: strings.customPosition }),
|
|
905
1036
|
corners.map((corner) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: corner, children: corner.split("-").join(" ") }, corner))
|
|
906
1037
|
]
|
|
907
1038
|
}
|
|
908
1039
|
),
|
|
909
1040
|
/* @__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)(
|
|
1041
|
+
["left", -20, 0, "\u2190", strings.moveLeft],
|
|
1042
|
+
["up", 0, -20, "\u2191", strings.moveUp],
|
|
1043
|
+
["down", 0, 20, "\u2193", strings.moveDown],
|
|
1044
|
+
["right", 20, 0, "\u2192", strings.moveRight]
|
|
1045
|
+
].map(([direction, dx, dy, arrowChar, label]) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
915
1046
|
"button",
|
|
916
1047
|
{
|
|
917
1048
|
type: "button",
|
|
918
|
-
"aria-label":
|
|
1049
|
+
"aria-label": label,
|
|
919
1050
|
onClick: (event) => {
|
|
920
1051
|
event.currentTarget.focus();
|
|
921
1052
|
move(dx, dy);
|
|
922
1053
|
},
|
|
923
|
-
children:
|
|
1054
|
+
children: arrowChar
|
|
924
1055
|
},
|
|
925
1056
|
direction
|
|
926
1057
|
)) }),
|
|
@@ -933,10 +1064,10 @@ function PositionControls() {
|
|
|
933
1064
|
event.currentTarget.focus();
|
|
934
1065
|
ctx.setWidgetPlacement(null);
|
|
935
1066
|
},
|
|
936
|
-
children:
|
|
1067
|
+
children: strings.resetPosition
|
|
937
1068
|
}
|
|
938
1069
|
),
|
|
939
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { className: "arap-position-default", type: "button", onClick: close, children:
|
|
1070
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { className: "arap-position-default", type: "button", onClick: close, children: strings.doneMoving })
|
|
940
1071
|
]
|
|
941
1072
|
}
|
|
942
1073
|
)
|
|
@@ -950,11 +1081,22 @@ function Panel({
|
|
|
950
1081
|
footer,
|
|
951
1082
|
className = "",
|
|
952
1083
|
style,
|
|
953
|
-
title
|
|
954
|
-
description
|
|
955
|
-
closeLabel
|
|
1084
|
+
title,
|
|
1085
|
+
description,
|
|
1086
|
+
closeLabel,
|
|
1087
|
+
statementUrl,
|
|
1088
|
+
largeControls,
|
|
1089
|
+
locale
|
|
956
1090
|
}) {
|
|
957
1091
|
const ctx = (0, import_react9.useContext)(AccessibilityContext);
|
|
1092
|
+
const effectiveLocale = locale ?? ctx.locale;
|
|
1093
|
+
const strings = resolveLocaleStrings(effectiveLocale);
|
|
1094
|
+
const panelTitle = title ?? strings.title;
|
|
1095
|
+
const panelDescription = description === void 0 ? strings.description : description;
|
|
1096
|
+
const panelCloseLabel = closeLabel ?? strings.closeLabel;
|
|
1097
|
+
const effectiveStatementUrl = statementUrl ?? ctx.statementUrl;
|
|
1098
|
+
const isLarge = largeControls ?? ctx.largeControls ?? false;
|
|
1099
|
+
const isRtl = isRtlLocale(effectiveLocale);
|
|
958
1100
|
const panel = (0, import_react9.useRef)(null);
|
|
959
1101
|
const [actions, setActions] = (0, import_react9.useState)(null);
|
|
960
1102
|
const viewport = useViewport();
|
|
@@ -988,10 +1130,14 @@ function Panel({
|
|
|
988
1130
|
},
|
|
989
1131
|
"data-corner": corner,
|
|
990
1132
|
"data-position": ctx.position,
|
|
1133
|
+
"data-large-controls": isLarge,
|
|
1134
|
+
lang: effectiveLocale ?? "en",
|
|
1135
|
+
dir: isRtl ? "rtl" : "ltr",
|
|
1136
|
+
translate: "no",
|
|
991
1137
|
hidden: !ctx.isOpen,
|
|
992
1138
|
role: "region",
|
|
993
|
-
"aria-label":
|
|
994
|
-
"aria-describedby":
|
|
1139
|
+
"aria-label": panelTitle,
|
|
1140
|
+
"aria-describedby": panelDescription ? `${ctx.panelId}-description` : void 0,
|
|
995
1141
|
tabIndex: -1,
|
|
996
1142
|
onKeyDown: (event) => {
|
|
997
1143
|
if (event.key === "Escape" && !event.defaultPrevented) {
|
|
@@ -1002,10 +1148,18 @@ function Panel({
|
|
|
1002
1148
|
children: [
|
|
1003
1149
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "arap-heading", children: [
|
|
1004
1150
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "arap-heading-copy", children: [
|
|
1005
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { children:
|
|
1006
|
-
|
|
1151
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { children: panelTitle }),
|
|
1152
|
+
panelDescription && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { id: `${ctx.panelId}-description`, className: "arap-description", children: panelDescription })
|
|
1007
1153
|
] }),
|
|
1008
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1154
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1155
|
+
"button",
|
|
1156
|
+
{
|
|
1157
|
+
type: "button",
|
|
1158
|
+
"aria-label": panelCloseLabel,
|
|
1159
|
+
onClick: ctx.closeMenu,
|
|
1160
|
+
children: "\xD7"
|
|
1161
|
+
}
|
|
1162
|
+
)
|
|
1009
1163
|
] }),
|
|
1010
1164
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1011
1165
|
"button",
|
|
@@ -1018,7 +1172,7 @@ function Panel({
|
|
|
1018
1172
|
);
|
|
1019
1173
|
target?.focus();
|
|
1020
1174
|
},
|
|
1021
|
-
children:
|
|
1175
|
+
children: strings.skipToActions
|
|
1022
1176
|
}
|
|
1023
1177
|
),
|
|
1024
1178
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PanelActionsContext.Provider, { value: actions, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
@@ -1027,7 +1181,7 @@ function Panel({
|
|
|
1027
1181
|
className: "arap-tools",
|
|
1028
1182
|
role: "group",
|
|
1029
1183
|
tabIndex: 0,
|
|
1030
|
-
"aria-label":
|
|
1184
|
+
"aria-label": strings.toolsLabel,
|
|
1031
1185
|
children
|
|
1032
1186
|
}
|
|
1033
1187
|
) }),
|
|
@@ -1036,13 +1190,30 @@ function Panel({
|
|
|
1036
1190
|
{
|
|
1037
1191
|
className: "arap-quick-actions",
|
|
1038
1192
|
role: "group",
|
|
1039
|
-
"aria-label":
|
|
1193
|
+
"aria-label": strings.quickActionsLabel,
|
|
1040
1194
|
children: [
|
|
1041
1195
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PositionControls, {}, ctx.isOpen ? "open" : "closed"),
|
|
1042
1196
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "arap-actions", ref: setActions, children: footer })
|
|
1043
1197
|
]
|
|
1044
1198
|
}
|
|
1045
|
-
)
|
|
1199
|
+
),
|
|
1200
|
+
effectiveStatementUrl && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "arap-statement", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1201
|
+
"a",
|
|
1202
|
+
{
|
|
1203
|
+
href: effectiveStatementUrl,
|
|
1204
|
+
className: "arap-statement-link",
|
|
1205
|
+
target: "_blank",
|
|
1206
|
+
rel: "noopener noreferrer",
|
|
1207
|
+
children: [
|
|
1208
|
+
strings.statementLink,
|
|
1209
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "arap-sr-only", children: [
|
|
1210
|
+
" (",
|
|
1211
|
+
strings.openInNewTab,
|
|
1212
|
+
")"
|
|
1213
|
+
] })
|
|
1214
|
+
]
|
|
1215
|
+
}
|
|
1216
|
+
) })
|
|
1046
1217
|
]
|
|
1047
1218
|
}
|
|
1048
1219
|
);
|
|
@@ -1094,6 +1265,304 @@ function useAccessibility(featureKey, defaultValue, options) {
|
|
|
1094
1265
|
return { value, setValue, reset };
|
|
1095
1266
|
}
|
|
1096
1267
|
|
|
1268
|
+
// src/core/preferences/defaults.ts
|
|
1269
|
+
var DEFAULT_PREFERENCES = Object.freeze({
|
|
1270
|
+
fontScale: 1,
|
|
1271
|
+
lineHeight: null,
|
|
1272
|
+
letterSpacingEm: null,
|
|
1273
|
+
wordSpacingEm: null,
|
|
1274
|
+
paragraphSpacingEm: null,
|
|
1275
|
+
textAlign: "original",
|
|
1276
|
+
contrastMode: "off",
|
|
1277
|
+
highlightLinks: false,
|
|
1278
|
+
highlightFocus: false,
|
|
1279
|
+
reduceMotion: false,
|
|
1280
|
+
hideDecorativeImages: false,
|
|
1281
|
+
fontFamily: "original",
|
|
1282
|
+
cursorSize: "original",
|
|
1283
|
+
readerMode: "off",
|
|
1284
|
+
saturation: "original",
|
|
1285
|
+
tooltips: false
|
|
1286
|
+
});
|
|
1287
|
+
var PROFILE_DEFINITIONS = {
|
|
1288
|
+
motor: {
|
|
1289
|
+
id: "motor",
|
|
1290
|
+
label: "Motor Impaired",
|
|
1291
|
+
description: "Enhanced focus rings, richer tooltips, and reduced motion.",
|
|
1292
|
+
settings: {
|
|
1293
|
+
reduceMotion: true,
|
|
1294
|
+
highlightFocus: true,
|
|
1295
|
+
tooltips: true
|
|
1296
|
+
}
|
|
1297
|
+
},
|
|
1298
|
+
blind: {
|
|
1299
|
+
id: "blind",
|
|
1300
|
+
label: "Blind & Screen Reader",
|
|
1301
|
+
description: "Semantic assistance and accessible authored descriptions.",
|
|
1302
|
+
settings: {
|
|
1303
|
+
tooltips: true
|
|
1304
|
+
}
|
|
1305
|
+
},
|
|
1306
|
+
"color-blind": {
|
|
1307
|
+
id: "color-blind",
|
|
1308
|
+
label: "Color Blind",
|
|
1309
|
+
description: "High contrast accents and non-color-only link indicators.",
|
|
1310
|
+
settings: {
|
|
1311
|
+
contrastMode: "high",
|
|
1312
|
+
highlightLinks: true
|
|
1313
|
+
}
|
|
1314
|
+
},
|
|
1315
|
+
dyslexia: {
|
|
1316
|
+
id: "dyslexia",
|
|
1317
|
+
label: "Dyslexia Friendly",
|
|
1318
|
+
description: "Legible typeface, reading guide line, and reduced motion.",
|
|
1319
|
+
settings: {
|
|
1320
|
+
fontFamily: "dyslexia-option",
|
|
1321
|
+
readerMode: "guide",
|
|
1322
|
+
reduceMotion: true
|
|
1323
|
+
}
|
|
1324
|
+
},
|
|
1325
|
+
"low-vision": {
|
|
1326
|
+
id: "low-vision",
|
|
1327
|
+
label: "Low Vision",
|
|
1328
|
+
description: "Enlarged text, large cursor pointer, and high-visibility focus.",
|
|
1329
|
+
settings: {
|
|
1330
|
+
fontScale: 1.25,
|
|
1331
|
+
cursorSize: "large",
|
|
1332
|
+
highlightFocus: true,
|
|
1333
|
+
tooltips: true
|
|
1334
|
+
}
|
|
1335
|
+
},
|
|
1336
|
+
cognitive: {
|
|
1337
|
+
id: "cognitive",
|
|
1338
|
+
label: "Cognitive & Learning",
|
|
1339
|
+
description: "Mild text scaling, reading guide line, and distraction reduction.",
|
|
1340
|
+
settings: {
|
|
1341
|
+
fontScale: 1.125,
|
|
1342
|
+
readerMode: "guide",
|
|
1343
|
+
reduceMotion: true,
|
|
1344
|
+
tooltips: true
|
|
1345
|
+
}
|
|
1346
|
+
},
|
|
1347
|
+
seizure: {
|
|
1348
|
+
id: "seizure",
|
|
1349
|
+
label: "Seizure & Epileptic",
|
|
1350
|
+
description: "Pauses nonessential motion and reduces transition flashes.",
|
|
1351
|
+
settings: {
|
|
1352
|
+
reduceMotion: true
|
|
1353
|
+
}
|
|
1354
|
+
},
|
|
1355
|
+
adhd: {
|
|
1356
|
+
id: "adhd",
|
|
1357
|
+
label: "ADHD / Focus",
|
|
1358
|
+
description: "Reading mask spotlight and reduced animation distraction.",
|
|
1359
|
+
settings: {
|
|
1360
|
+
readerMode: "mask",
|
|
1361
|
+
reduceMotion: true
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
};
|
|
1365
|
+
|
|
1366
|
+
// src/core/preferences/registry.ts
|
|
1367
|
+
var VALID_CONTRAST_MODES = /* @__PURE__ */ new Set([
|
|
1368
|
+
"off",
|
|
1369
|
+
"light",
|
|
1370
|
+
"dark",
|
|
1371
|
+
"high",
|
|
1372
|
+
"invert"
|
|
1373
|
+
]);
|
|
1374
|
+
var VALID_READER_MODES = /* @__PURE__ */ new Set([
|
|
1375
|
+
"off",
|
|
1376
|
+
"guide",
|
|
1377
|
+
"mask"
|
|
1378
|
+
]);
|
|
1379
|
+
var VALID_TEXT_ALIGNS = /* @__PURE__ */ new Set([
|
|
1380
|
+
"original",
|
|
1381
|
+
"left",
|
|
1382
|
+
"right",
|
|
1383
|
+
"center",
|
|
1384
|
+
"justify"
|
|
1385
|
+
]);
|
|
1386
|
+
var VALID_FONT_FAMILIES = /* @__PURE__ */ new Set([
|
|
1387
|
+
"original",
|
|
1388
|
+
"legible",
|
|
1389
|
+
"dyslexia-option"
|
|
1390
|
+
]);
|
|
1391
|
+
var VALID_CURSOR_SIZES = /* @__PURE__ */ new Set([
|
|
1392
|
+
"original",
|
|
1393
|
+
"large"
|
|
1394
|
+
]);
|
|
1395
|
+
var VALID_SATURATIONS = /* @__PURE__ */ new Set([
|
|
1396
|
+
"original",
|
|
1397
|
+
"low",
|
|
1398
|
+
"high",
|
|
1399
|
+
"grayscale"
|
|
1400
|
+
]);
|
|
1401
|
+
function clamp(value, min, max) {
|
|
1402
|
+
if (Number.isNaN(value) || !Number.isFinite(value)) return min;
|
|
1403
|
+
return Math.min(Math.max(value, min), max);
|
|
1404
|
+
}
|
|
1405
|
+
function normalizePreferenceValue(key, value) {
|
|
1406
|
+
switch (key) {
|
|
1407
|
+
case "fontScale":
|
|
1408
|
+
return typeof value === "number" ? clamp(value, 0.5, 2) : 1;
|
|
1409
|
+
case "lineHeight":
|
|
1410
|
+
if (value === null || value === void 0)
|
|
1411
|
+
return null;
|
|
1412
|
+
return typeof value === "number" ? clamp(value, 0.5, 2) : null;
|
|
1413
|
+
case "letterSpacingEm":
|
|
1414
|
+
if (value === null || value === void 0)
|
|
1415
|
+
return null;
|
|
1416
|
+
return typeof value === "number" ? clamp(value, 0, 0.5) : null;
|
|
1417
|
+
case "wordSpacingEm":
|
|
1418
|
+
if (value === null || value === void 0)
|
|
1419
|
+
return null;
|
|
1420
|
+
return typeof value === "number" ? clamp(value, 0, 0.5) : null;
|
|
1421
|
+
case "paragraphSpacingEm":
|
|
1422
|
+
if (value === null || value === void 0)
|
|
1423
|
+
return null;
|
|
1424
|
+
return typeof value === "number" ? clamp(value, 0, 1) : null;
|
|
1425
|
+
case "textAlign":
|
|
1426
|
+
return typeof value === "string" && VALID_TEXT_ALIGNS.has(value) ? value : "original";
|
|
1427
|
+
case "contrastMode":
|
|
1428
|
+
return typeof value === "string" && VALID_CONTRAST_MODES.has(value) ? value : "off";
|
|
1429
|
+
case "fontFamily":
|
|
1430
|
+
return typeof value === "string" && VALID_FONT_FAMILIES.has(value) ? value : "original";
|
|
1431
|
+
case "cursorSize":
|
|
1432
|
+
return typeof value === "string" && VALID_CURSOR_SIZES.has(value) ? value : "original";
|
|
1433
|
+
case "readerMode":
|
|
1434
|
+
return typeof value === "string" && VALID_READER_MODES.has(value) ? value : "off";
|
|
1435
|
+
case "saturation":
|
|
1436
|
+
return typeof value === "string" && VALID_SATURATIONS.has(value) ? value : "original";
|
|
1437
|
+
case "highlightLinks":
|
|
1438
|
+
case "highlightFocus":
|
|
1439
|
+
case "reduceMotion":
|
|
1440
|
+
case "hideDecorativeImages":
|
|
1441
|
+
case "tooltips":
|
|
1442
|
+
return Boolean(value);
|
|
1443
|
+
default:
|
|
1444
|
+
return value;
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
function normalizePreferences(input) {
|
|
1448
|
+
const result = { ...DEFAULT_PREFERENCES };
|
|
1449
|
+
if (!input || typeof input !== "object") return result;
|
|
1450
|
+
for (const k of Object.keys(DEFAULT_PREFERENCES)) {
|
|
1451
|
+
if (k in input && input[k] !== void 0) {
|
|
1452
|
+
result[k] = normalizePreferenceValue(k, input[k]);
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
return result;
|
|
1456
|
+
}
|
|
1457
|
+
function resolveEffectivePreferences(base, profileSnapshot, overrides) {
|
|
1458
|
+
const merged = {
|
|
1459
|
+
...DEFAULT_PREFERENCES,
|
|
1460
|
+
...base,
|
|
1461
|
+
...profileSnapshot ?? {},
|
|
1462
|
+
...overrides
|
|
1463
|
+
};
|
|
1464
|
+
return normalizePreferences(merged);
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
// src/core/preferences/reducer.ts
|
|
1468
|
+
function createInitialPreferencesState(initial) {
|
|
1469
|
+
const base = normalizePreferences(initial);
|
|
1470
|
+
return {
|
|
1471
|
+
base,
|
|
1472
|
+
activeProfileId: null,
|
|
1473
|
+
profileSnapshot: null,
|
|
1474
|
+
overrides: {},
|
|
1475
|
+
effective: { ...base }
|
|
1476
|
+
};
|
|
1477
|
+
}
|
|
1478
|
+
function preferencesReducer(state, action) {
|
|
1479
|
+
switch (action.type) {
|
|
1480
|
+
case "SET_PREFERENCE": {
|
|
1481
|
+
const normalizedValue = normalizePreferenceValue(
|
|
1482
|
+
action.key,
|
|
1483
|
+
action.value
|
|
1484
|
+
);
|
|
1485
|
+
if (state.activeProfileId) {
|
|
1486
|
+
const nextOverrides = {
|
|
1487
|
+
...state.overrides,
|
|
1488
|
+
[action.key]: normalizedValue
|
|
1489
|
+
};
|
|
1490
|
+
return {
|
|
1491
|
+
...state,
|
|
1492
|
+
overrides: nextOverrides,
|
|
1493
|
+
effective: resolveEffectivePreferences(
|
|
1494
|
+
state.base,
|
|
1495
|
+
state.profileSnapshot,
|
|
1496
|
+
nextOverrides
|
|
1497
|
+
)
|
|
1498
|
+
};
|
|
1499
|
+
}
|
|
1500
|
+
const nextBase = {
|
|
1501
|
+
...state.base,
|
|
1502
|
+
[action.key]: normalizedValue
|
|
1503
|
+
};
|
|
1504
|
+
return {
|
|
1505
|
+
...state,
|
|
1506
|
+
base: nextBase,
|
|
1507
|
+
effective: resolveEffectivePreferences(nextBase, null, state.overrides)
|
|
1508
|
+
};
|
|
1509
|
+
}
|
|
1510
|
+
case "APPLY_PROFILE": {
|
|
1511
|
+
const profile = PROFILE_DEFINITIONS[action.profileId];
|
|
1512
|
+
const settings = action.settings || profile?.settings || {};
|
|
1513
|
+
const profileSnapshot = { ...settings };
|
|
1514
|
+
const nextOverrides = {};
|
|
1515
|
+
return {
|
|
1516
|
+
...state,
|
|
1517
|
+
activeProfileId: action.profileId,
|
|
1518
|
+
profileSnapshot,
|
|
1519
|
+
overrides: nextOverrides,
|
|
1520
|
+
effective: resolveEffectivePreferences(
|
|
1521
|
+
state.base,
|
|
1522
|
+
profileSnapshot,
|
|
1523
|
+
nextOverrides
|
|
1524
|
+
)
|
|
1525
|
+
};
|
|
1526
|
+
}
|
|
1527
|
+
case "CLEAR_PROFILE": {
|
|
1528
|
+
const nextBase = {
|
|
1529
|
+
...state.base,
|
|
1530
|
+
...state.overrides
|
|
1531
|
+
};
|
|
1532
|
+
return {
|
|
1533
|
+
...state,
|
|
1534
|
+
activeProfileId: null,
|
|
1535
|
+
profileSnapshot: null,
|
|
1536
|
+
overrides: {},
|
|
1537
|
+
effective: normalizePreferences(nextBase),
|
|
1538
|
+
base: nextBase
|
|
1539
|
+
};
|
|
1540
|
+
}
|
|
1541
|
+
case "RESET_ALL": {
|
|
1542
|
+
const cleanBase = { ...DEFAULT_PREFERENCES };
|
|
1543
|
+
return {
|
|
1544
|
+
base: cleanBase,
|
|
1545
|
+
activeProfileId: null,
|
|
1546
|
+
profileSnapshot: null,
|
|
1547
|
+
overrides: {},
|
|
1548
|
+
effective: cleanBase
|
|
1549
|
+
};
|
|
1550
|
+
}
|
|
1551
|
+
case "IMPORT_PREFERENCES": {
|
|
1552
|
+
const cleanBase = normalizePreferences(action.preferences);
|
|
1553
|
+
return {
|
|
1554
|
+
base: cleanBase,
|
|
1555
|
+
activeProfileId: null,
|
|
1556
|
+
profileSnapshot: null,
|
|
1557
|
+
overrides: {},
|
|
1558
|
+
effective: cleanBase
|
|
1559
|
+
};
|
|
1560
|
+
}
|
|
1561
|
+
default:
|
|
1562
|
+
return state;
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1097
1566
|
// src/core/FeatureIcon.tsx
|
|
1098
1567
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1099
1568
|
var drawings = {
|
|
@@ -1687,9 +2156,10 @@ function ResetController() {
|
|
|
1687
2156
|
}
|
|
1688
2157
|
const actionHost = (0, import_react11.useContext)(PanelActionsContext);
|
|
1689
2158
|
const { resetAll } = ctx;
|
|
2159
|
+
const strings = resolveLocaleStrings(ctx.locale);
|
|
1690
2160
|
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
2161
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FeatureIcon, { name: "reset" }),
|
|
1692
|
-
|
|
2162
|
+
strings.resetAll
|
|
1693
2163
|
] }) });
|
|
1694
2164
|
return actionHost ? (0, import_react_dom2.createPortal)(button, actionHost) : button;
|
|
1695
2165
|
}
|
|
@@ -1701,6 +2171,7 @@ function ResetController() {
|
|
|
1701
2171
|
AccessibilityPlugin,
|
|
1702
2172
|
BigCursorController,
|
|
1703
2173
|
ContrastController,
|
|
2174
|
+
DEFAULT_PREFERENCES,
|
|
1704
2175
|
FontSizeController,
|
|
1705
2176
|
GrayscaleController,
|
|
1706
2177
|
HideImagesController,
|
|
@@ -1709,11 +2180,21 @@ function ResetController() {
|
|
|
1709
2180
|
LetterSpacingController,
|
|
1710
2181
|
LineHeightController,
|
|
1711
2182
|
LinkHighlightController,
|
|
2183
|
+
PROFILE_DEFINITIONS,
|
|
1712
2184
|
ReadingGuideController,
|
|
1713
2185
|
ReadingMaskController,
|
|
1714
2186
|
ResetController,
|
|
1715
2187
|
SaturationController,
|
|
1716
2188
|
TextAlignController,
|
|
2189
|
+
createInitialPreferencesState,
|
|
2190
|
+
enLocale,
|
|
2191
|
+
isRtlLocale,
|
|
2192
|
+
normalizePreferenceValue,
|
|
2193
|
+
normalizePreferences,
|
|
2194
|
+
preferencesReducer,
|
|
2195
|
+
registerLocale,
|
|
2196
|
+
resolveEffectivePreferences,
|
|
2197
|
+
resolveLocaleStrings,
|
|
1717
2198
|
useAccessibility
|
|
1718
2199
|
});
|
|
1719
2200
|
//# sourceMappingURL=index.js.map
|