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.d.mts +135 -4
- package/dist/index.d.ts +135 -4
- package/dist/index.js +514 -52
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +503 -52
- 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.mjs
CHANGED
|
@@ -24,7 +24,7 @@ function styleInject(css, { insertAt } = {}) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
// src/styles/tailwind.css
|
|
27
|
-
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');
|
|
27
|
+
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');
|
|
28
28
|
|
|
29
29
|
// src/core/AccessibilityPlugin.tsx
|
|
30
30
|
import {
|
|
@@ -139,9 +139,19 @@ function validKey(key) {
|
|
|
139
139
|
function isRecord(value) {
|
|
140
140
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function getStorage(mode = "local") {
|
|
143
|
+
if (mode === "none" || typeof window === "undefined") return null;
|
|
143
144
|
try {
|
|
144
|
-
|
|
145
|
+
return mode === "session" ? window.sessionStorage : window.localStorage;
|
|
146
|
+
} catch {
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function loadState(key = DEFAULT_STORAGE_KEY, mode = "local") {
|
|
151
|
+
const storage = getStorage(mode);
|
|
152
|
+
if (!storage) return null;
|
|
153
|
+
try {
|
|
154
|
+
const raw = JSON.parse(storage.getItem(key) || "null");
|
|
145
155
|
if (!isRecord(raw)) return null;
|
|
146
156
|
const features = "version" in raw ? raw.version === 1 ? raw.features : null : raw;
|
|
147
157
|
if (!isRecord(features)) return null;
|
|
@@ -152,19 +162,23 @@ function loadState(key = DEFAULT_STORAGE_KEY) {
|
|
|
152
162
|
return null;
|
|
153
163
|
}
|
|
154
164
|
}
|
|
155
|
-
function saveState(state, key = DEFAULT_STORAGE_KEY) {
|
|
165
|
+
function saveState(state, key = DEFAULT_STORAGE_KEY, mode = "local") {
|
|
166
|
+
const storage = getStorage(mode);
|
|
167
|
+
if (!storage) return;
|
|
156
168
|
try {
|
|
157
|
-
|
|
169
|
+
storage.setItem(key, JSON.stringify({ version: 1, features: state }));
|
|
158
170
|
} catch {
|
|
159
171
|
}
|
|
160
172
|
}
|
|
161
|
-
function clearState(key = DEFAULT_STORAGE_KEY) {
|
|
173
|
+
function clearState(key = DEFAULT_STORAGE_KEY, mode = "local") {
|
|
174
|
+
const storage = getStorage(mode);
|
|
175
|
+
if (!storage) return;
|
|
162
176
|
try {
|
|
163
|
-
|
|
177
|
+
storage.removeItem(key);
|
|
164
178
|
} catch {
|
|
165
179
|
}
|
|
166
180
|
}
|
|
167
|
-
function createStorageWriter(key = DEFAULT_STORAGE_KEY) {
|
|
181
|
+
function createStorageWriter(key = DEFAULT_STORAGE_KEY, mode = "local") {
|
|
168
182
|
let timer;
|
|
169
183
|
let pending;
|
|
170
184
|
const cancel = () => {
|
|
@@ -175,7 +189,7 @@ function createStorageWriter(key = DEFAULT_STORAGE_KEY) {
|
|
|
175
189
|
const flush = () => {
|
|
176
190
|
const next = pending;
|
|
177
191
|
cancel();
|
|
178
|
-
if (next) saveState(next, key);
|
|
192
|
+
if (next) saveState(next, key, mode);
|
|
179
193
|
};
|
|
180
194
|
return {
|
|
181
195
|
schedule(state) {
|
|
@@ -185,7 +199,7 @@ function createStorageWriter(key = DEFAULT_STORAGE_KEY) {
|
|
|
185
199
|
},
|
|
186
200
|
clear() {
|
|
187
201
|
cancel();
|
|
188
|
-
clearState(key);
|
|
202
|
+
clearState(key, mode);
|
|
189
203
|
},
|
|
190
204
|
cancel,
|
|
191
205
|
flush
|
|
@@ -193,13 +207,14 @@ function createStorageWriter(key = DEFAULT_STORAGE_KEY) {
|
|
|
193
207
|
}
|
|
194
208
|
|
|
195
209
|
// src/core/preferenceStore.ts
|
|
196
|
-
function createPreferenceStore(key, persist) {
|
|
197
|
-
const
|
|
210
|
+
function createPreferenceStore(key, persist, storageMode) {
|
|
211
|
+
const resolvedMode = storageMode ?? (persist ? "local" : "none");
|
|
212
|
+
const writer = createStorageWriter(key, resolvedMode);
|
|
198
213
|
const empty = {};
|
|
199
214
|
let snapshot2;
|
|
200
215
|
const listeners = /* @__PURE__ */ new Set();
|
|
201
216
|
const getSnapshot = () => {
|
|
202
|
-
snapshot2 ?? (snapshot2 =
|
|
217
|
+
snapshot2 ?? (snapshot2 = resolvedMode !== "none" ? loadState(key, resolvedMode) ?? {} : {});
|
|
203
218
|
return snapshot2;
|
|
204
219
|
};
|
|
205
220
|
return {
|
|
@@ -213,7 +228,7 @@ function createPreferenceStore(key, persist) {
|
|
|
213
228
|
},
|
|
214
229
|
update(update) {
|
|
215
230
|
snapshot2 = update(getSnapshot());
|
|
216
|
-
if (
|
|
231
|
+
if (resolvedMode !== "none") {
|
|
217
232
|
if (Object.keys(snapshot2).length) writer.schedule(snapshot2);
|
|
218
233
|
else writer.clear();
|
|
219
234
|
}
|
|
@@ -464,11 +479,15 @@ function AccessibilityPlugin({
|
|
|
464
479
|
children,
|
|
465
480
|
position = "right",
|
|
466
481
|
persistenceKey,
|
|
467
|
-
persist = true
|
|
482
|
+
persist = true,
|
|
483
|
+
storage,
|
|
484
|
+
locale,
|
|
485
|
+
statementUrl,
|
|
486
|
+
largeControls
|
|
468
487
|
}) {
|
|
469
488
|
const [isOpen, setIsOpen] = useState(false);
|
|
470
489
|
const [store] = useState(
|
|
471
|
-
() => createPreferenceStore(persistenceKey, persist)
|
|
490
|
+
() => createPreferenceStore(persistenceKey, persist, storage)
|
|
472
491
|
);
|
|
473
492
|
const features = useSyncExternalStore2(
|
|
474
493
|
store.subscribe,
|
|
@@ -582,7 +601,10 @@ function AccessibilityPlugin({
|
|
|
582
601
|
registerFeature,
|
|
583
602
|
resetAll,
|
|
584
603
|
registerReset,
|
|
585
|
-
unregisterReset
|
|
604
|
+
unregisterReset,
|
|
605
|
+
locale,
|
|
606
|
+
statementUrl,
|
|
607
|
+
largeControls
|
|
586
608
|
}),
|
|
587
609
|
[
|
|
588
610
|
isOpen,
|
|
@@ -598,7 +620,10 @@ function AccessibilityPlugin({
|
|
|
598
620
|
registerFeature,
|
|
599
621
|
resetAll,
|
|
600
622
|
registerReset,
|
|
601
|
-
unregisterReset
|
|
623
|
+
unregisterReset,
|
|
624
|
+
locale,
|
|
625
|
+
statementUrl,
|
|
626
|
+
largeControls
|
|
602
627
|
]
|
|
603
628
|
);
|
|
604
629
|
return /* @__PURE__ */ jsxs(AccessibilityContext.Provider, { value, children: [
|
|
@@ -637,21 +662,93 @@ function WidgetPortal({ children }) {
|
|
|
637
662
|
) : null;
|
|
638
663
|
}
|
|
639
664
|
|
|
665
|
+
// src/core/i18n/en.ts
|
|
666
|
+
var enLocale = Object.freeze({
|
|
667
|
+
title: "Accessibility settings",
|
|
668
|
+
description: "Adjust your reading experience",
|
|
669
|
+
closeLabel: "Close accessibility settings",
|
|
670
|
+
skipToActions: "Jump to quick actions",
|
|
671
|
+
toolsLabel: "Accessibility tools",
|
|
672
|
+
quickActionsLabel: "Quick actions",
|
|
673
|
+
resetLabel: "Reset all accessibility settings",
|
|
674
|
+
resetAll: "Reset All",
|
|
675
|
+
statementLink: "Accessibility Statement",
|
|
676
|
+
openInNewTab: "opens in a new tab",
|
|
677
|
+
buttonTitle: "Accessibility",
|
|
678
|
+
dragHelp: "Drag to move, or use Alt and arrow keys. The Move button menu offers click and keyboard controls.",
|
|
679
|
+
positionLabel: "Button position",
|
|
680
|
+
moveButton: "Move button",
|
|
681
|
+
moveButtonLabel: "Move accessibility button",
|
|
682
|
+
buttonPositionSelectLabel: "Accessibility button position",
|
|
683
|
+
customPosition: "Custom position",
|
|
684
|
+
resetPosition: "Reset button position",
|
|
685
|
+
doneMoving: "Done moving",
|
|
686
|
+
moveLeft: "Move accessibility button left",
|
|
687
|
+
moveUp: "Move accessibility button up",
|
|
688
|
+
moveDown: "Move accessibility button down",
|
|
689
|
+
moveRight: "Move accessibility button right",
|
|
690
|
+
largeControlsLabel: "Oversized widget controls",
|
|
691
|
+
formatPointPosition: (x, y) => `Button position: ${Math.round(x * 100)}% horizontally, ${Math.round(y * 100)}% vertically.`,
|
|
692
|
+
formatCornerPosition: (corner) => `Button position: ${corner.split("-").join(" ")}.`
|
|
693
|
+
});
|
|
694
|
+
|
|
695
|
+
// src/core/i18n/index.ts
|
|
696
|
+
var dictionaries = {
|
|
697
|
+
en: enLocale
|
|
698
|
+
};
|
|
699
|
+
var RTL_LOCALES = /* @__PURE__ */ new Set([
|
|
700
|
+
"ar",
|
|
701
|
+
"arc",
|
|
702
|
+
"dv",
|
|
703
|
+
"fa",
|
|
704
|
+
"ha",
|
|
705
|
+
"he",
|
|
706
|
+
"khw",
|
|
707
|
+
"ks",
|
|
708
|
+
"ku",
|
|
709
|
+
"ps",
|
|
710
|
+
"ur",
|
|
711
|
+
"yi"
|
|
712
|
+
]);
|
|
713
|
+
function registerLocale(code, strings) {
|
|
714
|
+
dictionaries[code.toLowerCase()] = strings;
|
|
715
|
+
}
|
|
716
|
+
function isRtlLocale(localeProp) {
|
|
717
|
+
if (!localeProp) return false;
|
|
718
|
+
const base = localeProp.toLowerCase().split("-")[0];
|
|
719
|
+
return RTL_LOCALES.has(base);
|
|
720
|
+
}
|
|
721
|
+
function resolveLocaleStrings(localeProp) {
|
|
722
|
+
const normalized = (localeProp || (typeof document !== "undefined" ? document.documentElement.lang : "en") || "en").trim().toLowerCase();
|
|
723
|
+
if (dictionaries[normalized]) {
|
|
724
|
+
return dictionaries[normalized];
|
|
725
|
+
}
|
|
726
|
+
const base = normalized.split("-")[0];
|
|
727
|
+
if (dictionaries[base]) {
|
|
728
|
+
return dictionaries[base];
|
|
729
|
+
}
|
|
730
|
+
return enLocale;
|
|
731
|
+
}
|
|
732
|
+
|
|
640
733
|
// src/core/AccessibilityButton.tsx
|
|
641
734
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
642
735
|
function AccessibilityButton({
|
|
643
736
|
icon,
|
|
644
737
|
draggable = true,
|
|
645
|
-
title
|
|
738
|
+
title,
|
|
646
739
|
description,
|
|
647
740
|
className = "",
|
|
648
|
-
style
|
|
741
|
+
style,
|
|
742
|
+
largeControls
|
|
649
743
|
}) {
|
|
650
744
|
const ctx = useContext(AccessibilityContext);
|
|
651
745
|
if (!ctx)
|
|
652
746
|
throw new Error(
|
|
653
747
|
"AccessibilityButton must be used within an <AccessibilityPlugin> provider."
|
|
654
748
|
);
|
|
749
|
+
const strings = resolveLocaleStrings(ctx.locale);
|
|
750
|
+
const buttonTitle = title ?? strings.buttonTitle;
|
|
751
|
+
const isLarge = largeControls ?? ctx.largeControls ?? false;
|
|
655
752
|
const viewport = useViewport();
|
|
656
753
|
const triggerSize = useTriggerSize(`${ctx.panelId}-trigger`);
|
|
657
754
|
const [preview, setPreview] = useState2(null);
|
|
@@ -672,6 +769,7 @@ function AccessibilityButton({
|
|
|
672
769
|
"data-dragging": !!preview,
|
|
673
770
|
"data-open": ctx.isOpen,
|
|
674
771
|
"data-position": ctx.position,
|
|
772
|
+
"data-large-controls": isLarge,
|
|
675
773
|
onPointerDown: (event) => {
|
|
676
774
|
suppressClick.current = false;
|
|
677
775
|
if (!draggable || !event.isPrimary || event.button !== 0) return;
|
|
@@ -751,7 +849,7 @@ function AccessibilityButton({
|
|
|
751
849
|
);
|
|
752
850
|
}
|
|
753
851
|
},
|
|
754
|
-
"aria-label":
|
|
852
|
+
"aria-label": buttonTitle,
|
|
755
853
|
"aria-keyshortcuts": draggable ? "Alt+ArrowUp Alt+ArrowDown Alt+ArrowLeft Alt+ArrowRight" : void 0,
|
|
756
854
|
"aria-describedby": description || draggable ? `${ctx.panelId}-trigger-description` : void 0,
|
|
757
855
|
"aria-expanded": ctx.isOpen,
|
|
@@ -773,14 +871,16 @@ function AccessibilityButton({
|
|
|
773
871
|
}
|
|
774
872
|
) }),
|
|
775
873
|
(description || draggable) && /* @__PURE__ */ jsxs2("span", { id: `${ctx.panelId}-trigger-description`, hidden: true, children: [
|
|
776
|
-
description,
|
|
777
|
-
|
|
778
|
-
draggable && "Drag to move, or use Alt and arrow keys. The Move button menu offers click and keyboard controls."
|
|
874
|
+
description ? `${description} ` : "",
|
|
875
|
+
draggable && strings.dragHelp
|
|
779
876
|
] })
|
|
780
877
|
]
|
|
781
878
|
}
|
|
782
879
|
),
|
|
783
|
-
/* @__PURE__ */ jsx3("span", { className: "arap-sr-only", role: "status", children: ctx.widgetPlacement?.kind === "point" ?
|
|
880
|
+
/* @__PURE__ */ jsx3("span", { className: "arap-sr-only", role: "status", children: ctx.widgetPlacement?.kind === "point" ? strings.formatPointPosition ? strings.formatPointPosition(
|
|
881
|
+
ctx.widgetPlacement.x,
|
|
882
|
+
ctx.widgetPlacement.y
|
|
883
|
+
) : `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(" ")}.` })
|
|
784
884
|
] });
|
|
785
885
|
}
|
|
786
886
|
|
|
@@ -796,6 +896,7 @@ import { useContext as useContext2, useEffect as useEffect3, useRef as useRef3,
|
|
|
796
896
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
797
897
|
function PositionControls() {
|
|
798
898
|
const ctx = useContext2(AccessibilityContext);
|
|
899
|
+
const strings = resolveLocaleStrings(ctx.locale);
|
|
799
900
|
const [open, setOpen] = useState3(false);
|
|
800
901
|
const select = useRef3(null);
|
|
801
902
|
const opener = useRef3(null);
|
|
@@ -827,7 +928,7 @@ function PositionControls() {
|
|
|
827
928
|
event.currentTarget.focus();
|
|
828
929
|
setOpen(!open);
|
|
829
930
|
},
|
|
830
|
-
children:
|
|
931
|
+
children: strings.moveButton
|
|
831
932
|
}
|
|
832
933
|
),
|
|
833
934
|
/* @__PURE__ */ jsxs3(
|
|
@@ -837,7 +938,7 @@ function PositionControls() {
|
|
|
837
938
|
className: "arap-position-popover",
|
|
838
939
|
hidden: !open,
|
|
839
940
|
role: "group",
|
|
840
|
-
"aria-label":
|
|
941
|
+
"aria-label": strings.moveButtonLabel,
|
|
841
942
|
onKeyDown: (event) => {
|
|
842
943
|
if (event.key === "Escape") {
|
|
843
944
|
event.stopPropagation();
|
|
@@ -850,7 +951,7 @@ function PositionControls() {
|
|
|
850
951
|
{
|
|
851
952
|
className: "arap-position-label",
|
|
852
953
|
htmlFor: `${ctx.panelId}-corner`,
|
|
853
|
-
children:
|
|
954
|
+
children: strings.positionLabel
|
|
854
955
|
}
|
|
855
956
|
),
|
|
856
957
|
/* @__PURE__ */ jsxs3(
|
|
@@ -858,33 +959,33 @@ function PositionControls() {
|
|
|
858
959
|
{
|
|
859
960
|
ref: select,
|
|
860
961
|
id: `${ctx.panelId}-corner`,
|
|
861
|
-
"aria-label":
|
|
962
|
+
"aria-label": strings.buttonPositionSelectLabel,
|
|
862
963
|
value: ctx.widgetPlacement?.kind === "point" ? "custom" : ctx.widgetPlacement?.corner ?? defaultCorner(ctx.position),
|
|
863
964
|
onChange: (event) => ctx.setWidgetPlacement({
|
|
864
965
|
kind: "corner",
|
|
865
966
|
corner: event.target.value
|
|
866
967
|
}),
|
|
867
968
|
children: [
|
|
868
|
-
/* @__PURE__ */ jsx4("option", { value: "custom", disabled: true, children:
|
|
969
|
+
/* @__PURE__ */ jsx4("option", { value: "custom", disabled: true, children: strings.customPosition }),
|
|
869
970
|
corners.map((corner) => /* @__PURE__ */ jsx4("option", { value: corner, children: corner.split("-").join(" ") }, corner))
|
|
870
971
|
]
|
|
871
972
|
}
|
|
872
973
|
),
|
|
873
974
|
/* @__PURE__ */ jsx4("div", { className: "arap-position-arrows", children: [
|
|
874
|
-
["left", -20, 0, "\u2190"],
|
|
875
|
-
["up", 0, -20, "\u2191"],
|
|
876
|
-
["down", 0, 20, "\u2193"],
|
|
877
|
-
["right", 20, 0, "\u2192"]
|
|
878
|
-
].map(([direction, dx, dy, label]) => /* @__PURE__ */ jsx4(
|
|
975
|
+
["left", -20, 0, "\u2190", strings.moveLeft],
|
|
976
|
+
["up", 0, -20, "\u2191", strings.moveUp],
|
|
977
|
+
["down", 0, 20, "\u2193", strings.moveDown],
|
|
978
|
+
["right", 20, 0, "\u2192", strings.moveRight]
|
|
979
|
+
].map(([direction, dx, dy, arrowChar, label]) => /* @__PURE__ */ jsx4(
|
|
879
980
|
"button",
|
|
880
981
|
{
|
|
881
982
|
type: "button",
|
|
882
|
-
"aria-label":
|
|
983
|
+
"aria-label": label,
|
|
883
984
|
onClick: (event) => {
|
|
884
985
|
event.currentTarget.focus();
|
|
885
986
|
move(dx, dy);
|
|
886
987
|
},
|
|
887
|
-
children:
|
|
988
|
+
children: arrowChar
|
|
888
989
|
},
|
|
889
990
|
direction
|
|
890
991
|
)) }),
|
|
@@ -897,10 +998,10 @@ function PositionControls() {
|
|
|
897
998
|
event.currentTarget.focus();
|
|
898
999
|
ctx.setWidgetPlacement(null);
|
|
899
1000
|
},
|
|
900
|
-
children:
|
|
1001
|
+
children: strings.resetPosition
|
|
901
1002
|
}
|
|
902
1003
|
),
|
|
903
|
-
/* @__PURE__ */ jsx4("button", { className: "arap-position-default", type: "button", onClick: close, children:
|
|
1004
|
+
/* @__PURE__ */ jsx4("button", { className: "arap-position-default", type: "button", onClick: close, children: strings.doneMoving })
|
|
904
1005
|
]
|
|
905
1006
|
}
|
|
906
1007
|
)
|
|
@@ -914,11 +1015,22 @@ function Panel({
|
|
|
914
1015
|
footer,
|
|
915
1016
|
className = "",
|
|
916
1017
|
style,
|
|
917
|
-
title
|
|
918
|
-
description
|
|
919
|
-
closeLabel
|
|
1018
|
+
title,
|
|
1019
|
+
description,
|
|
1020
|
+
closeLabel,
|
|
1021
|
+
statementUrl,
|
|
1022
|
+
largeControls,
|
|
1023
|
+
locale
|
|
920
1024
|
}) {
|
|
921
1025
|
const ctx = useContext3(AccessibilityContext);
|
|
1026
|
+
const effectiveLocale = locale ?? ctx.locale;
|
|
1027
|
+
const strings = resolveLocaleStrings(effectiveLocale);
|
|
1028
|
+
const panelTitle = title ?? strings.title;
|
|
1029
|
+
const panelDescription = description === void 0 ? strings.description : description;
|
|
1030
|
+
const panelCloseLabel = closeLabel ?? strings.closeLabel;
|
|
1031
|
+
const effectiveStatementUrl = statementUrl ?? ctx.statementUrl;
|
|
1032
|
+
const isLarge = largeControls ?? ctx.largeControls ?? false;
|
|
1033
|
+
const isRtl = isRtlLocale(effectiveLocale);
|
|
922
1034
|
const panel = useRef4(null);
|
|
923
1035
|
const [actions, setActions] = useState4(null);
|
|
924
1036
|
const viewport = useViewport();
|
|
@@ -952,10 +1064,14 @@ function Panel({
|
|
|
952
1064
|
},
|
|
953
1065
|
"data-corner": corner,
|
|
954
1066
|
"data-position": ctx.position,
|
|
1067
|
+
"data-large-controls": isLarge,
|
|
1068
|
+
lang: effectiveLocale ?? "en",
|
|
1069
|
+
dir: isRtl ? "rtl" : "ltr",
|
|
1070
|
+
translate: "no",
|
|
955
1071
|
hidden: !ctx.isOpen,
|
|
956
1072
|
role: "region",
|
|
957
|
-
"aria-label":
|
|
958
|
-
"aria-describedby":
|
|
1073
|
+
"aria-label": panelTitle,
|
|
1074
|
+
"aria-describedby": panelDescription ? `${ctx.panelId}-description` : void 0,
|
|
959
1075
|
tabIndex: -1,
|
|
960
1076
|
onKeyDown: (event) => {
|
|
961
1077
|
if (event.key === "Escape" && !event.defaultPrevented) {
|
|
@@ -966,10 +1082,18 @@ function Panel({
|
|
|
966
1082
|
children: [
|
|
967
1083
|
/* @__PURE__ */ jsxs4("div", { className: "arap-heading", children: [
|
|
968
1084
|
/* @__PURE__ */ jsxs4("div", { className: "arap-heading-copy", children: [
|
|
969
|
-
/* @__PURE__ */ jsx5("h2", { children:
|
|
970
|
-
|
|
1085
|
+
/* @__PURE__ */ jsx5("h2", { children: panelTitle }),
|
|
1086
|
+
panelDescription && /* @__PURE__ */ jsx5("p", { id: `${ctx.panelId}-description`, className: "arap-description", children: panelDescription })
|
|
971
1087
|
] }),
|
|
972
|
-
/* @__PURE__ */ jsx5(
|
|
1088
|
+
/* @__PURE__ */ jsx5(
|
|
1089
|
+
"button",
|
|
1090
|
+
{
|
|
1091
|
+
type: "button",
|
|
1092
|
+
"aria-label": panelCloseLabel,
|
|
1093
|
+
onClick: ctx.closeMenu,
|
|
1094
|
+
children: "\xD7"
|
|
1095
|
+
}
|
|
1096
|
+
)
|
|
973
1097
|
] }),
|
|
974
1098
|
/* @__PURE__ */ jsx5(
|
|
975
1099
|
"button",
|
|
@@ -982,7 +1106,7 @@ function Panel({
|
|
|
982
1106
|
);
|
|
983
1107
|
target?.focus();
|
|
984
1108
|
},
|
|
985
|
-
children:
|
|
1109
|
+
children: strings.skipToActions
|
|
986
1110
|
}
|
|
987
1111
|
),
|
|
988
1112
|
/* @__PURE__ */ jsx5(PanelActionsContext.Provider, { value: actions, children: /* @__PURE__ */ jsx5(
|
|
@@ -991,7 +1115,7 @@ function Panel({
|
|
|
991
1115
|
className: "arap-tools",
|
|
992
1116
|
role: "group",
|
|
993
1117
|
tabIndex: 0,
|
|
994
|
-
"aria-label":
|
|
1118
|
+
"aria-label": strings.toolsLabel,
|
|
995
1119
|
children
|
|
996
1120
|
}
|
|
997
1121
|
) }),
|
|
@@ -1000,13 +1124,30 @@ function Panel({
|
|
|
1000
1124
|
{
|
|
1001
1125
|
className: "arap-quick-actions",
|
|
1002
1126
|
role: "group",
|
|
1003
|
-
"aria-label":
|
|
1127
|
+
"aria-label": strings.quickActionsLabel,
|
|
1004
1128
|
children: [
|
|
1005
1129
|
/* @__PURE__ */ jsx5(PositionControls, {}, ctx.isOpen ? "open" : "closed"),
|
|
1006
1130
|
/* @__PURE__ */ jsx5("div", { className: "arap-actions", ref: setActions, children: footer })
|
|
1007
1131
|
]
|
|
1008
1132
|
}
|
|
1009
|
-
)
|
|
1133
|
+
),
|
|
1134
|
+
effectiveStatementUrl && /* @__PURE__ */ jsx5("div", { className: "arap-statement", children: /* @__PURE__ */ jsxs4(
|
|
1135
|
+
"a",
|
|
1136
|
+
{
|
|
1137
|
+
href: effectiveStatementUrl,
|
|
1138
|
+
className: "arap-statement-link",
|
|
1139
|
+
target: "_blank",
|
|
1140
|
+
rel: "noopener noreferrer",
|
|
1141
|
+
children: [
|
|
1142
|
+
strings.statementLink,
|
|
1143
|
+
/* @__PURE__ */ jsxs4("span", { className: "arap-sr-only", children: [
|
|
1144
|
+
" (",
|
|
1145
|
+
strings.openInNewTab,
|
|
1146
|
+
")"
|
|
1147
|
+
] })
|
|
1148
|
+
]
|
|
1149
|
+
}
|
|
1150
|
+
) })
|
|
1010
1151
|
]
|
|
1011
1152
|
}
|
|
1012
1153
|
);
|
|
@@ -1058,6 +1199,304 @@ function useAccessibility(featureKey, defaultValue, options) {
|
|
|
1058
1199
|
return { value, setValue, reset };
|
|
1059
1200
|
}
|
|
1060
1201
|
|
|
1202
|
+
// src/core/preferences/defaults.ts
|
|
1203
|
+
var DEFAULT_PREFERENCES = Object.freeze({
|
|
1204
|
+
fontScale: 1,
|
|
1205
|
+
lineHeight: null,
|
|
1206
|
+
letterSpacingEm: null,
|
|
1207
|
+
wordSpacingEm: null,
|
|
1208
|
+
paragraphSpacingEm: null,
|
|
1209
|
+
textAlign: "original",
|
|
1210
|
+
contrastMode: "off",
|
|
1211
|
+
highlightLinks: false,
|
|
1212
|
+
highlightFocus: false,
|
|
1213
|
+
reduceMotion: false,
|
|
1214
|
+
hideDecorativeImages: false,
|
|
1215
|
+
fontFamily: "original",
|
|
1216
|
+
cursorSize: "original",
|
|
1217
|
+
readerMode: "off",
|
|
1218
|
+
saturation: "original",
|
|
1219
|
+
tooltips: false
|
|
1220
|
+
});
|
|
1221
|
+
var PROFILE_DEFINITIONS = {
|
|
1222
|
+
motor: {
|
|
1223
|
+
id: "motor",
|
|
1224
|
+
label: "Motor Impaired",
|
|
1225
|
+
description: "Enhanced focus rings, richer tooltips, and reduced motion.",
|
|
1226
|
+
settings: {
|
|
1227
|
+
reduceMotion: true,
|
|
1228
|
+
highlightFocus: true,
|
|
1229
|
+
tooltips: true
|
|
1230
|
+
}
|
|
1231
|
+
},
|
|
1232
|
+
blind: {
|
|
1233
|
+
id: "blind",
|
|
1234
|
+
label: "Blind & Screen Reader",
|
|
1235
|
+
description: "Semantic assistance and accessible authored descriptions.",
|
|
1236
|
+
settings: {
|
|
1237
|
+
tooltips: true
|
|
1238
|
+
}
|
|
1239
|
+
},
|
|
1240
|
+
"color-blind": {
|
|
1241
|
+
id: "color-blind",
|
|
1242
|
+
label: "Color Blind",
|
|
1243
|
+
description: "High contrast accents and non-color-only link indicators.",
|
|
1244
|
+
settings: {
|
|
1245
|
+
contrastMode: "high",
|
|
1246
|
+
highlightLinks: true
|
|
1247
|
+
}
|
|
1248
|
+
},
|
|
1249
|
+
dyslexia: {
|
|
1250
|
+
id: "dyslexia",
|
|
1251
|
+
label: "Dyslexia Friendly",
|
|
1252
|
+
description: "Legible typeface, reading guide line, and reduced motion.",
|
|
1253
|
+
settings: {
|
|
1254
|
+
fontFamily: "dyslexia-option",
|
|
1255
|
+
readerMode: "guide",
|
|
1256
|
+
reduceMotion: true
|
|
1257
|
+
}
|
|
1258
|
+
},
|
|
1259
|
+
"low-vision": {
|
|
1260
|
+
id: "low-vision",
|
|
1261
|
+
label: "Low Vision",
|
|
1262
|
+
description: "Enlarged text, large cursor pointer, and high-visibility focus.",
|
|
1263
|
+
settings: {
|
|
1264
|
+
fontScale: 1.25,
|
|
1265
|
+
cursorSize: "large",
|
|
1266
|
+
highlightFocus: true,
|
|
1267
|
+
tooltips: true
|
|
1268
|
+
}
|
|
1269
|
+
},
|
|
1270
|
+
cognitive: {
|
|
1271
|
+
id: "cognitive",
|
|
1272
|
+
label: "Cognitive & Learning",
|
|
1273
|
+
description: "Mild text scaling, reading guide line, and distraction reduction.",
|
|
1274
|
+
settings: {
|
|
1275
|
+
fontScale: 1.125,
|
|
1276
|
+
readerMode: "guide",
|
|
1277
|
+
reduceMotion: true,
|
|
1278
|
+
tooltips: true
|
|
1279
|
+
}
|
|
1280
|
+
},
|
|
1281
|
+
seizure: {
|
|
1282
|
+
id: "seizure",
|
|
1283
|
+
label: "Seizure & Epileptic",
|
|
1284
|
+
description: "Pauses nonessential motion and reduces transition flashes.",
|
|
1285
|
+
settings: {
|
|
1286
|
+
reduceMotion: true
|
|
1287
|
+
}
|
|
1288
|
+
},
|
|
1289
|
+
adhd: {
|
|
1290
|
+
id: "adhd",
|
|
1291
|
+
label: "ADHD / Focus",
|
|
1292
|
+
description: "Reading mask spotlight and reduced animation distraction.",
|
|
1293
|
+
settings: {
|
|
1294
|
+
readerMode: "mask",
|
|
1295
|
+
reduceMotion: true
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
};
|
|
1299
|
+
|
|
1300
|
+
// src/core/preferences/registry.ts
|
|
1301
|
+
var VALID_CONTRAST_MODES = /* @__PURE__ */ new Set([
|
|
1302
|
+
"off",
|
|
1303
|
+
"light",
|
|
1304
|
+
"dark",
|
|
1305
|
+
"high",
|
|
1306
|
+
"invert"
|
|
1307
|
+
]);
|
|
1308
|
+
var VALID_READER_MODES = /* @__PURE__ */ new Set([
|
|
1309
|
+
"off",
|
|
1310
|
+
"guide",
|
|
1311
|
+
"mask"
|
|
1312
|
+
]);
|
|
1313
|
+
var VALID_TEXT_ALIGNS = /* @__PURE__ */ new Set([
|
|
1314
|
+
"original",
|
|
1315
|
+
"left",
|
|
1316
|
+
"right",
|
|
1317
|
+
"center",
|
|
1318
|
+
"justify"
|
|
1319
|
+
]);
|
|
1320
|
+
var VALID_FONT_FAMILIES = /* @__PURE__ */ new Set([
|
|
1321
|
+
"original",
|
|
1322
|
+
"legible",
|
|
1323
|
+
"dyslexia-option"
|
|
1324
|
+
]);
|
|
1325
|
+
var VALID_CURSOR_SIZES = /* @__PURE__ */ new Set([
|
|
1326
|
+
"original",
|
|
1327
|
+
"large"
|
|
1328
|
+
]);
|
|
1329
|
+
var VALID_SATURATIONS = /* @__PURE__ */ new Set([
|
|
1330
|
+
"original",
|
|
1331
|
+
"low",
|
|
1332
|
+
"high",
|
|
1333
|
+
"grayscale"
|
|
1334
|
+
]);
|
|
1335
|
+
function clamp(value, min, max) {
|
|
1336
|
+
if (Number.isNaN(value) || !Number.isFinite(value)) return min;
|
|
1337
|
+
return Math.min(Math.max(value, min), max);
|
|
1338
|
+
}
|
|
1339
|
+
function normalizePreferenceValue(key, value) {
|
|
1340
|
+
switch (key) {
|
|
1341
|
+
case "fontScale":
|
|
1342
|
+
return typeof value === "number" ? clamp(value, 0.5, 2) : 1;
|
|
1343
|
+
case "lineHeight":
|
|
1344
|
+
if (value === null || value === void 0)
|
|
1345
|
+
return null;
|
|
1346
|
+
return typeof value === "number" ? clamp(value, 0.5, 2) : null;
|
|
1347
|
+
case "letterSpacingEm":
|
|
1348
|
+
if (value === null || value === void 0)
|
|
1349
|
+
return null;
|
|
1350
|
+
return typeof value === "number" ? clamp(value, 0, 0.5) : null;
|
|
1351
|
+
case "wordSpacingEm":
|
|
1352
|
+
if (value === null || value === void 0)
|
|
1353
|
+
return null;
|
|
1354
|
+
return typeof value === "number" ? clamp(value, 0, 0.5) : null;
|
|
1355
|
+
case "paragraphSpacingEm":
|
|
1356
|
+
if (value === null || value === void 0)
|
|
1357
|
+
return null;
|
|
1358
|
+
return typeof value === "number" ? clamp(value, 0, 1) : null;
|
|
1359
|
+
case "textAlign":
|
|
1360
|
+
return typeof value === "string" && VALID_TEXT_ALIGNS.has(value) ? value : "original";
|
|
1361
|
+
case "contrastMode":
|
|
1362
|
+
return typeof value === "string" && VALID_CONTRAST_MODES.has(value) ? value : "off";
|
|
1363
|
+
case "fontFamily":
|
|
1364
|
+
return typeof value === "string" && VALID_FONT_FAMILIES.has(value) ? value : "original";
|
|
1365
|
+
case "cursorSize":
|
|
1366
|
+
return typeof value === "string" && VALID_CURSOR_SIZES.has(value) ? value : "original";
|
|
1367
|
+
case "readerMode":
|
|
1368
|
+
return typeof value === "string" && VALID_READER_MODES.has(value) ? value : "off";
|
|
1369
|
+
case "saturation":
|
|
1370
|
+
return typeof value === "string" && VALID_SATURATIONS.has(value) ? value : "original";
|
|
1371
|
+
case "highlightLinks":
|
|
1372
|
+
case "highlightFocus":
|
|
1373
|
+
case "reduceMotion":
|
|
1374
|
+
case "hideDecorativeImages":
|
|
1375
|
+
case "tooltips":
|
|
1376
|
+
return Boolean(value);
|
|
1377
|
+
default:
|
|
1378
|
+
return value;
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
function normalizePreferences(input) {
|
|
1382
|
+
const result = { ...DEFAULT_PREFERENCES };
|
|
1383
|
+
if (!input || typeof input !== "object") return result;
|
|
1384
|
+
for (const k of Object.keys(DEFAULT_PREFERENCES)) {
|
|
1385
|
+
if (k in input && input[k] !== void 0) {
|
|
1386
|
+
result[k] = normalizePreferenceValue(k, input[k]);
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
return result;
|
|
1390
|
+
}
|
|
1391
|
+
function resolveEffectivePreferences(base, profileSnapshot, overrides) {
|
|
1392
|
+
const merged = {
|
|
1393
|
+
...DEFAULT_PREFERENCES,
|
|
1394
|
+
...base,
|
|
1395
|
+
...profileSnapshot ?? {},
|
|
1396
|
+
...overrides
|
|
1397
|
+
};
|
|
1398
|
+
return normalizePreferences(merged);
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
// src/core/preferences/reducer.ts
|
|
1402
|
+
function createInitialPreferencesState(initial) {
|
|
1403
|
+
const base = normalizePreferences(initial);
|
|
1404
|
+
return {
|
|
1405
|
+
base,
|
|
1406
|
+
activeProfileId: null,
|
|
1407
|
+
profileSnapshot: null,
|
|
1408
|
+
overrides: {},
|
|
1409
|
+
effective: { ...base }
|
|
1410
|
+
};
|
|
1411
|
+
}
|
|
1412
|
+
function preferencesReducer(state, action) {
|
|
1413
|
+
switch (action.type) {
|
|
1414
|
+
case "SET_PREFERENCE": {
|
|
1415
|
+
const normalizedValue = normalizePreferenceValue(
|
|
1416
|
+
action.key,
|
|
1417
|
+
action.value
|
|
1418
|
+
);
|
|
1419
|
+
if (state.activeProfileId) {
|
|
1420
|
+
const nextOverrides = {
|
|
1421
|
+
...state.overrides,
|
|
1422
|
+
[action.key]: normalizedValue
|
|
1423
|
+
};
|
|
1424
|
+
return {
|
|
1425
|
+
...state,
|
|
1426
|
+
overrides: nextOverrides,
|
|
1427
|
+
effective: resolveEffectivePreferences(
|
|
1428
|
+
state.base,
|
|
1429
|
+
state.profileSnapshot,
|
|
1430
|
+
nextOverrides
|
|
1431
|
+
)
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1434
|
+
const nextBase = {
|
|
1435
|
+
...state.base,
|
|
1436
|
+
[action.key]: normalizedValue
|
|
1437
|
+
};
|
|
1438
|
+
return {
|
|
1439
|
+
...state,
|
|
1440
|
+
base: nextBase,
|
|
1441
|
+
effective: resolveEffectivePreferences(nextBase, null, state.overrides)
|
|
1442
|
+
};
|
|
1443
|
+
}
|
|
1444
|
+
case "APPLY_PROFILE": {
|
|
1445
|
+
const profile = PROFILE_DEFINITIONS[action.profileId];
|
|
1446
|
+
const settings = action.settings || profile?.settings || {};
|
|
1447
|
+
const profileSnapshot = { ...settings };
|
|
1448
|
+
const nextOverrides = {};
|
|
1449
|
+
return {
|
|
1450
|
+
...state,
|
|
1451
|
+
activeProfileId: action.profileId,
|
|
1452
|
+
profileSnapshot,
|
|
1453
|
+
overrides: nextOverrides,
|
|
1454
|
+
effective: resolveEffectivePreferences(
|
|
1455
|
+
state.base,
|
|
1456
|
+
profileSnapshot,
|
|
1457
|
+
nextOverrides
|
|
1458
|
+
)
|
|
1459
|
+
};
|
|
1460
|
+
}
|
|
1461
|
+
case "CLEAR_PROFILE": {
|
|
1462
|
+
const nextBase = {
|
|
1463
|
+
...state.base,
|
|
1464
|
+
...state.overrides
|
|
1465
|
+
};
|
|
1466
|
+
return {
|
|
1467
|
+
...state,
|
|
1468
|
+
activeProfileId: null,
|
|
1469
|
+
profileSnapshot: null,
|
|
1470
|
+
overrides: {},
|
|
1471
|
+
effective: normalizePreferences(nextBase),
|
|
1472
|
+
base: nextBase
|
|
1473
|
+
};
|
|
1474
|
+
}
|
|
1475
|
+
case "RESET_ALL": {
|
|
1476
|
+
const cleanBase = { ...DEFAULT_PREFERENCES };
|
|
1477
|
+
return {
|
|
1478
|
+
base: cleanBase,
|
|
1479
|
+
activeProfileId: null,
|
|
1480
|
+
profileSnapshot: null,
|
|
1481
|
+
overrides: {},
|
|
1482
|
+
effective: cleanBase
|
|
1483
|
+
};
|
|
1484
|
+
}
|
|
1485
|
+
case "IMPORT_PREFERENCES": {
|
|
1486
|
+
const cleanBase = normalizePreferences(action.preferences);
|
|
1487
|
+
return {
|
|
1488
|
+
base: cleanBase,
|
|
1489
|
+
activeProfileId: null,
|
|
1490
|
+
profileSnapshot: null,
|
|
1491
|
+
overrides: {},
|
|
1492
|
+
effective: cleanBase
|
|
1493
|
+
};
|
|
1494
|
+
}
|
|
1495
|
+
default:
|
|
1496
|
+
return state;
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1061
1500
|
// src/core/FeatureIcon.tsx
|
|
1062
1501
|
import { Fragment, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1063
1502
|
var drawings = {
|
|
@@ -1651,9 +2090,10 @@ function ResetController() {
|
|
|
1651
2090
|
}
|
|
1652
2091
|
const actionHost = useContext5(PanelActionsContext);
|
|
1653
2092
|
const { resetAll } = ctx;
|
|
2093
|
+
const strings = resolveLocaleStrings(ctx.locale);
|
|
1654
2094
|
const button = /* @__PURE__ */ jsx21("div", { className: "arap-feature arap-feature-reset", children: /* @__PURE__ */ jsxs20("button", { className: "arap-reset-btn", onClick: resetAll, type: "button", children: [
|
|
1655
2095
|
/* @__PURE__ */ jsx21(FeatureIcon, { name: "reset" }),
|
|
1656
|
-
|
|
2096
|
+
strings.resetAll
|
|
1657
2097
|
] }) });
|
|
1658
2098
|
return actionHost ? createPortal2(button, actionHost) : button;
|
|
1659
2099
|
}
|
|
@@ -1664,6 +2104,7 @@ export {
|
|
|
1664
2104
|
AccessibilityPlugin,
|
|
1665
2105
|
BigCursorController,
|
|
1666
2106
|
ContrastController,
|
|
2107
|
+
DEFAULT_PREFERENCES,
|
|
1667
2108
|
FontSizeController,
|
|
1668
2109
|
GrayscaleController,
|
|
1669
2110
|
HideImagesController,
|
|
@@ -1672,11 +2113,21 @@ export {
|
|
|
1672
2113
|
LetterSpacingController,
|
|
1673
2114
|
LineHeightController,
|
|
1674
2115
|
LinkHighlightController,
|
|
2116
|
+
PROFILE_DEFINITIONS,
|
|
1675
2117
|
ReadingGuideController,
|
|
1676
2118
|
ReadingMaskController,
|
|
1677
2119
|
ResetController,
|
|
1678
2120
|
SaturationController,
|
|
1679
2121
|
TextAlignController,
|
|
2122
|
+
createInitialPreferencesState,
|
|
2123
|
+
enLocale,
|
|
2124
|
+
isRtlLocale,
|
|
2125
|
+
normalizePreferenceValue,
|
|
2126
|
+
normalizePreferences,
|
|
2127
|
+
preferencesReducer,
|
|
2128
|
+
registerLocale,
|
|
2129
|
+
resolveEffectivePreferences,
|
|
2130
|
+
resolveLocaleStrings,
|
|
1680
2131
|
useAccessibility
|
|
1681
2132
|
};
|
|
1682
2133
|
//# sourceMappingURL=index.mjs.map
|