accessibility-plugin-react 2.8.0 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -21
- package/dist/index.d.mts +29 -2
- package/dist/index.d.ts +29 -2
- package/dist/index.js +340 -84
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +326 -77
- package/dist/index.mjs.map +1 -1
- package/docs/API.md +3 -3
- package/docs/BUILD_AND_RELEASE_PLAN.md +2 -2
- package/docs/DECORATIVE_IMAGES.md +176 -0
- package/docs/FEATURES.md +25 -24
- package/docs/REDUCE_MOTION.md +64 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -340,7 +340,8 @@ for (const key of [
|
|
|
340
340
|
"readingMask",
|
|
341
341
|
"readingGuide",
|
|
342
342
|
"highlightFocus",
|
|
343
|
-
"focusHighlight"
|
|
343
|
+
"focusHighlight",
|
|
344
|
+
"reduceMotion"
|
|
344
345
|
]) {
|
|
345
346
|
builtins[key] = {
|
|
346
347
|
defaultValue: false,
|
|
@@ -384,6 +385,26 @@ function subscribeForcedColors(callback) {
|
|
|
384
385
|
};
|
|
385
386
|
}
|
|
386
387
|
}
|
|
388
|
+
function isReducedMotionActive() {
|
|
389
|
+
if (typeof window === "undefined" || !window.matchMedia) return false;
|
|
390
|
+
try {
|
|
391
|
+
return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
392
|
+
} catch {
|
|
393
|
+
return false;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
function subscribeReducedMotion(callback) {
|
|
397
|
+
if (typeof window === "undefined" || !window.matchMedia) return () => {
|
|
398
|
+
};
|
|
399
|
+
try {
|
|
400
|
+
const mql = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
401
|
+
mql.addEventListener("change", callback);
|
|
402
|
+
return () => mql.removeEventListener("change", callback);
|
|
403
|
+
} catch {
|
|
404
|
+
return () => {
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
}
|
|
387
408
|
var CONTRAST_PALETTES = {
|
|
388
409
|
light: {
|
|
389
410
|
text: "#0f172a",
|
|
@@ -797,6 +818,104 @@ function getScriptSpacingConstraints(element) {
|
|
|
797
818
|
script: "standard"
|
|
798
819
|
};
|
|
799
820
|
}
|
|
821
|
+
function isFunctionalOrMeaningfulImage(el) {
|
|
822
|
+
try {
|
|
823
|
+
if (el.closest(
|
|
824
|
+
"a, button, [role='button'], [role='link'], [role='menuitem'], [role='tab'], input, select, textarea, summary"
|
|
825
|
+
)) {
|
|
826
|
+
return true;
|
|
827
|
+
}
|
|
828
|
+
if (el.closest(
|
|
829
|
+
"[id*='captcha' i], [class*='captcha' i], [aria-label*='captcha' i], [data-captcha]"
|
|
830
|
+
) || el.matches(
|
|
831
|
+
"[src*='captcha' i], [alt*='captcha' i], [title*='captcha' i], [id*='captcha' i], [class*='captcha' i]"
|
|
832
|
+
)) {
|
|
833
|
+
return true;
|
|
834
|
+
}
|
|
835
|
+
if (el.closest(
|
|
836
|
+
"[role='graphics-document'], [role='graphics-symbol'], [role='figure'], figure, [class*='chart' i], [id*='chart' i], [class*='graph' i], [id*='graph' i], [class*='diagram' i], [id*='diagram' i]"
|
|
837
|
+
) || el.matches(
|
|
838
|
+
"[role='graphics-document'], [role='graphics-symbol'], [aria-roledescription*='chart' i]"
|
|
839
|
+
)) {
|
|
840
|
+
return true;
|
|
841
|
+
}
|
|
842
|
+
if (el.closest(
|
|
843
|
+
"[role='region'][aria-label*='map' i], [class*='map' i], [id*='map' i], [data-map]"
|
|
844
|
+
) || el.matches(
|
|
845
|
+
"[src*='maps' i], [src*='tiles' i], [src*='openstreetmap' i], [src*='mapbox' i]"
|
|
846
|
+
)) {
|
|
847
|
+
return true;
|
|
848
|
+
}
|
|
849
|
+
if (el.closest(
|
|
850
|
+
"[class*='qr' i], [id*='qr' i], [class*='barcode' i], [id*='barcode' i]"
|
|
851
|
+
) || el.matches(
|
|
852
|
+
"[src*='qr' i], [alt*='qr' i], [src*='barcode' i], [alt*='barcode' i]"
|
|
853
|
+
)) {
|
|
854
|
+
return true;
|
|
855
|
+
}
|
|
856
|
+
if (el.closest("[role='math'], math, [class*='math' i]")) {
|
|
857
|
+
return true;
|
|
858
|
+
}
|
|
859
|
+
if (el.hasAttribute("alt")) {
|
|
860
|
+
const alt = el.getAttribute("alt")?.trim();
|
|
861
|
+
if (alt && alt.length > 0) return true;
|
|
862
|
+
}
|
|
863
|
+
if (el.hasAttribute("aria-label")) {
|
|
864
|
+
const label = el.getAttribute("aria-label")?.trim();
|
|
865
|
+
if (label && label.length > 0) return true;
|
|
866
|
+
}
|
|
867
|
+
if (el.hasAttribute("aria-labelledby")) {
|
|
868
|
+
const labelledby = el.getAttribute("aria-labelledby")?.trim();
|
|
869
|
+
if (labelledby && labelledby.length > 0) return true;
|
|
870
|
+
}
|
|
871
|
+
if (el.hasAttribute("title")) {
|
|
872
|
+
const title = el.getAttribute("title")?.trim();
|
|
873
|
+
if (title && title.length > 0) return true;
|
|
874
|
+
}
|
|
875
|
+
const role = el.getAttribute("role");
|
|
876
|
+
if (role && role !== "presentation" && role !== "none" && role !== "img") {
|
|
877
|
+
return true;
|
|
878
|
+
}
|
|
879
|
+
if (role === "img" && (el.hasAttribute("aria-label") || el.hasAttribute("aria-labelledby") || el.hasAttribute("title") || el.hasAttribute("alt") && el.getAttribute("alt")?.trim() !== "")) {
|
|
880
|
+
return true;
|
|
881
|
+
}
|
|
882
|
+
} catch {
|
|
883
|
+
return false;
|
|
884
|
+
}
|
|
885
|
+
return false;
|
|
886
|
+
}
|
|
887
|
+
function isEligibleDecorativeImage(el) {
|
|
888
|
+
try {
|
|
889
|
+
if (isFunctionalOrMeaningfulImage(el)) {
|
|
890
|
+
return false;
|
|
891
|
+
}
|
|
892
|
+
if (el.matches("img, picture")) {
|
|
893
|
+
if (el.hasAttribute("alt") && el.getAttribute("alt")?.trim() === "") {
|
|
894
|
+
return true;
|
|
895
|
+
}
|
|
896
|
+
const role = el.getAttribute("role");
|
|
897
|
+
if (role === "presentation" || role === "none") {
|
|
898
|
+
return true;
|
|
899
|
+
}
|
|
900
|
+
if (el.getAttribute("aria-hidden") === "true") {
|
|
901
|
+
return true;
|
|
902
|
+
}
|
|
903
|
+
if (el.hasAttribute("data-decorative") || el.classList.contains("decorative") || el.classList.contains("deco")) {
|
|
904
|
+
return true;
|
|
905
|
+
}
|
|
906
|
+
if (el.matches("picture")) {
|
|
907
|
+
const childImg = el.querySelector("img");
|
|
908
|
+
if (childImg && isEligibleDecorativeImage(childImg)) {
|
|
909
|
+
return true;
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
return false;
|
|
913
|
+
}
|
|
914
|
+
} catch {
|
|
915
|
+
return false;
|
|
916
|
+
}
|
|
917
|
+
return false;
|
|
918
|
+
}
|
|
800
919
|
function applyPage(values) {
|
|
801
920
|
const undo = [];
|
|
802
921
|
function set(element, property, value) {
|
|
@@ -1039,11 +1158,91 @@ function applyPage(values) {
|
|
|
1039
1158
|
});
|
|
1040
1159
|
}
|
|
1041
1160
|
}
|
|
1161
|
+
if (values.reduceMotion) {
|
|
1162
|
+
const MOTION_STYLE_ID = "arap-reduce-motion-style";
|
|
1163
|
+
let styleEl = document.getElementById(
|
|
1164
|
+
MOTION_STYLE_ID
|
|
1165
|
+
);
|
|
1166
|
+
if (!styleEl) {
|
|
1167
|
+
styleEl = document.createElement("style");
|
|
1168
|
+
styleEl.id = MOTION_STYLE_ID;
|
|
1169
|
+
styleEl.dataset.arapUi = "";
|
|
1170
|
+
styleEl.textContent = `
|
|
1171
|
+
*:not([data-arap-ui]):not([data-arap-ui] *),
|
|
1172
|
+
*:not([data-arap-ui]):not([data-arap-ui] *)::before,
|
|
1173
|
+
*:not([data-arap-ui]):not([data-arap-ui] *)::after {
|
|
1174
|
+
animation-duration: 0.001ms !important;
|
|
1175
|
+
animation-iteration-count: 1 !important;
|
|
1176
|
+
transition-duration: 0.001ms !important;
|
|
1177
|
+
scroll-behavior: auto !important;
|
|
1178
|
+
}
|
|
1179
|
+
`;
|
|
1180
|
+
document.head.appendChild(styleEl);
|
|
1181
|
+
undo.push(() => {
|
|
1182
|
+
styleEl?.remove();
|
|
1183
|
+
});
|
|
1184
|
+
}
|
|
1185
|
+
const trackedAnimations = /* @__PURE__ */ new Set();
|
|
1186
|
+
if (typeof document !== "undefined" && typeof document.getAnimations === "function") {
|
|
1187
|
+
try {
|
|
1188
|
+
const animations = document.getAnimations();
|
|
1189
|
+
for (const anim of animations) {
|
|
1190
|
+
const target = anim.effect?.target;
|
|
1191
|
+
if (target instanceof Element && target.closest("[data-arap-ui]")) {
|
|
1192
|
+
continue;
|
|
1193
|
+
}
|
|
1194
|
+
if (anim.playState === "running") {
|
|
1195
|
+
anim.pause();
|
|
1196
|
+
trackedAnimations.add(anim);
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
} catch {
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
if (typeof document !== "undefined") {
|
|
1203
|
+
const mediaList = Array.from(
|
|
1204
|
+
document.querySelectorAll("video, audio")
|
|
1205
|
+
).filter((media) => !media.closest("[data-arap-ui]"));
|
|
1206
|
+
for (const media of mediaList) {
|
|
1207
|
+
if (!media.paused) {
|
|
1208
|
+
try {
|
|
1209
|
+
media.pause();
|
|
1210
|
+
} catch {
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
undo.push(() => {
|
|
1216
|
+
for (const anim of trackedAnimations) {
|
|
1217
|
+
if (anim.playState === "paused") {
|
|
1218
|
+
try {
|
|
1219
|
+
anim.play();
|
|
1220
|
+
} catch {
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1042
1226
|
for (const el of elements) {
|
|
1043
1227
|
if (values.bigCursor) set(el, "cursor", cursor);
|
|
1044
1228
|
if (values.hideImages) {
|
|
1045
|
-
if (el
|
|
1046
|
-
|
|
1229
|
+
if (isEligibleDecorativeImage(el)) {
|
|
1230
|
+
set(el, "visibility", "hidden");
|
|
1231
|
+
}
|
|
1232
|
+
if (!isFunctionalOrMeaningfulImage(el)) {
|
|
1233
|
+
const inlineBg = el.style.backgroundImage;
|
|
1234
|
+
if (inlineBg && inlineBg !== "none") {
|
|
1235
|
+
set(el, "background-image", "none");
|
|
1236
|
+
} else {
|
|
1237
|
+
try {
|
|
1238
|
+
const computedBg = getComputedStyle(el).backgroundImage;
|
|
1239
|
+
if (computedBg && computedBg !== "none") {
|
|
1240
|
+
set(el, "background-image", "none");
|
|
1241
|
+
}
|
|
1242
|
+
} catch {
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1047
1246
|
}
|
|
1048
1247
|
if (values.hideVideos && el.matches(
|
|
1049
1248
|
'video, iframe[src*="youtube.com/embed/"], iframe[src*="youtube-nocookie.com/embed/"], iframe[src*="player.vimeo.com/video/"]'
|
|
@@ -2338,6 +2537,11 @@ var drawings = {
|
|
|
2338
2537
|
/* @__PURE__ */ jsx7("path", { d: "M4 8V4h4M20 8V4h-4M4 16v4h4M20 16v4h-4" }),
|
|
2339
2538
|
/* @__PURE__ */ jsx7("circle", { cx: "12", cy: "12", r: "3" })
|
|
2340
2539
|
] }),
|
|
2540
|
+
reduceMotion: /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
2541
|
+
/* @__PURE__ */ jsx7("path", { d: "M3 8h4M3 12h6M3 16h4" }),
|
|
2542
|
+
/* @__PURE__ */ jsx7("rect", { x: "14", y: "6", width: "2", height: "12", rx: "1" }),
|
|
2543
|
+
/* @__PURE__ */ jsx7("rect", { x: "18", y: "6", width: "2", height: "12", rx: "1" })
|
|
2544
|
+
] }),
|
|
2341
2545
|
textAlign: /* @__PURE__ */ jsx7(Fragment, { children: /* @__PURE__ */ jsx7("path", { d: "M3 5h18M3 10h12M3 15h18M3 20h12" }) }),
|
|
2342
2546
|
fontFamily: /* @__PURE__ */ jsx7(Fragment, { children: /* @__PURE__ */ jsx7("path", { d: "M4 7V4h16v3M9 20h6M12 4v16" }) }),
|
|
2343
2547
|
hideImages: /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
@@ -3222,22 +3426,24 @@ function FontFamilyController() {
|
|
|
3222
3426
|
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3223
3427
|
var FEATURE_KEY15 = "hideImages";
|
|
3224
3428
|
var DEFAULT_VALUE15 = false;
|
|
3225
|
-
function HideImagesController(
|
|
3429
|
+
function HideImagesController({
|
|
3430
|
+
label = "Hide Images"
|
|
3431
|
+
} = {}) {
|
|
3226
3432
|
const { value, setValue } = useAccessibility(
|
|
3227
3433
|
FEATURE_KEY15,
|
|
3228
3434
|
DEFAULT_VALUE15
|
|
3229
3435
|
);
|
|
3230
|
-
return /* @__PURE__ */ jsxs20("div", { className: "arap-feature", role: "group", "aria-label":
|
|
3436
|
+
return /* @__PURE__ */ jsxs20("div", { className: "arap-feature", role: "group", "aria-label": label, children: [
|
|
3231
3437
|
/* @__PURE__ */ jsxs20("span", { className: "arap-label", children: [
|
|
3232
3438
|
/* @__PURE__ */ jsx22(FeatureIcon, { name: FEATURE_KEY15 }),
|
|
3233
|
-
/* @__PURE__ */ jsx22("span", { children:
|
|
3439
|
+
/* @__PURE__ */ jsx22("span", { children: label })
|
|
3234
3440
|
] }),
|
|
3235
3441
|
/* @__PURE__ */ jsx22(
|
|
3236
3442
|
"button",
|
|
3237
3443
|
{
|
|
3238
3444
|
className: `arap-toggle ${value ? "arap-toggle-active" : ""}`,
|
|
3239
3445
|
onClick: () => setValue(!value),
|
|
3240
|
-
"aria-label":
|
|
3446
|
+
"aria-label": label,
|
|
3241
3447
|
"aria-pressed": value,
|
|
3242
3448
|
type: "button",
|
|
3243
3449
|
children: /* @__PURE__ */ jsx22("span", { className: "arap-toggle-knob", "aria-hidden": "true" })
|
|
@@ -3245,6 +3451,7 @@ function HideImagesController() {
|
|
|
3245
3451
|
)
|
|
3246
3452
|
] });
|
|
3247
3453
|
}
|
|
3454
|
+
var HideDecorativeImagesController = HideImagesController;
|
|
3248
3455
|
|
|
3249
3456
|
// src/features/HideVideosController.tsx
|
|
3250
3457
|
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
@@ -3387,10 +3594,45 @@ function HighlightFocusController() {
|
|
|
3387
3594
|
}
|
|
3388
3595
|
var FocusHighlightController = HighlightFocusController;
|
|
3389
3596
|
|
|
3597
|
+
// src/features/ReduceMotionController.tsx
|
|
3598
|
+
import { useSyncExternalStore as useSyncExternalStore7 } from "react";
|
|
3599
|
+
import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3600
|
+
var FEATURE_KEY21 = "reduceMotion";
|
|
3601
|
+
var DEFAULT_VALUE21 = false;
|
|
3602
|
+
function ReduceMotionController() {
|
|
3603
|
+
const { value, setValue } = useAccessibility(
|
|
3604
|
+
FEATURE_KEY21,
|
|
3605
|
+
DEFAULT_VALUE21
|
|
3606
|
+
);
|
|
3607
|
+
const osReducedMotion = useSyncExternalStore7(
|
|
3608
|
+
subscribeReducedMotion,
|
|
3609
|
+
isReducedMotionActive,
|
|
3610
|
+
() => false
|
|
3611
|
+
);
|
|
3612
|
+
return /* @__PURE__ */ jsxs26("div", { className: "arap-feature", role: "group", "aria-label": "Reduce Motion", children: [
|
|
3613
|
+
/* @__PURE__ */ jsxs26("span", { className: "arap-label", children: [
|
|
3614
|
+
/* @__PURE__ */ jsx28(FeatureIcon, { name: FEATURE_KEY21 }),
|
|
3615
|
+
/* @__PURE__ */ jsx28("span", { children: "Reduce Motion" })
|
|
3616
|
+
] }),
|
|
3617
|
+
/* @__PURE__ */ jsx28(
|
|
3618
|
+
"button",
|
|
3619
|
+
{
|
|
3620
|
+
className: `arap-toggle ${value ? "arap-toggle-active" : ""}`,
|
|
3621
|
+
onClick: () => setValue(!value),
|
|
3622
|
+
"aria-label": "Reduce Motion",
|
|
3623
|
+
"aria-pressed": Boolean(value),
|
|
3624
|
+
type: "button",
|
|
3625
|
+
children: /* @__PURE__ */ jsx28("span", { className: "arap-toggle-knob", "aria-hidden": "true" })
|
|
3626
|
+
}
|
|
3627
|
+
),
|
|
3628
|
+
osReducedMotion && /* @__PURE__ */ jsx28("div", { className: "arap-notice", role: "status", "aria-live": "polite", children: "Operating system prefers-reduced-motion is active." })
|
|
3629
|
+
] });
|
|
3630
|
+
}
|
|
3631
|
+
|
|
3390
3632
|
// src/features/ResetController.tsx
|
|
3391
3633
|
import { createPortal as createPortal2 } from "react-dom";
|
|
3392
3634
|
import { useContext as useContext6 } from "react";
|
|
3393
|
-
import { jsx as
|
|
3635
|
+
import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
3394
3636
|
function ResetController() {
|
|
3395
3637
|
const ctx = useContext6(AccessibilityContext);
|
|
3396
3638
|
if (!ctx) {
|
|
@@ -3401,15 +3643,15 @@ function ResetController() {
|
|
|
3401
3643
|
const actionHost = useContext6(PanelActionsContext);
|
|
3402
3644
|
const { resetAll } = ctx;
|
|
3403
3645
|
const strings = resolveLocaleStrings(ctx.locale);
|
|
3404
|
-
const button = /* @__PURE__ */
|
|
3405
|
-
/* @__PURE__ */
|
|
3646
|
+
const button = /* @__PURE__ */ jsx29("div", { className: "arap-feature arap-feature-reset", children: /* @__PURE__ */ jsxs27("button", { className: "arap-reset-btn", onClick: resetAll, type: "button", children: [
|
|
3647
|
+
/* @__PURE__ */ jsx29(FeatureIcon, { name: "reset" }),
|
|
3406
3648
|
strings.resetAll
|
|
3407
3649
|
] }) });
|
|
3408
3650
|
return actionHost ? createPortal2(button, actionHost) : button;
|
|
3409
3651
|
}
|
|
3410
3652
|
|
|
3411
3653
|
// src/core/controls/ToggleControl.tsx
|
|
3412
|
-
import { jsx as
|
|
3654
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
3413
3655
|
function ToggleControl({
|
|
3414
3656
|
id,
|
|
3415
3657
|
label,
|
|
@@ -3431,12 +3673,12 @@ function ToggleControl({
|
|
|
3431
3673
|
onChange(!checked);
|
|
3432
3674
|
}
|
|
3433
3675
|
};
|
|
3434
|
-
return /* @__PURE__ */
|
|
3676
|
+
return /* @__PURE__ */ jsx30(
|
|
3435
3677
|
"div",
|
|
3436
3678
|
{
|
|
3437
3679
|
className: `arap-toggle-wrapper ${largeControls ? "arap-large-controls" : ""} ${className}`,
|
|
3438
3680
|
style,
|
|
3439
|
-
children: /* @__PURE__ */
|
|
3681
|
+
children: /* @__PURE__ */ jsx30(
|
|
3440
3682
|
"button",
|
|
3441
3683
|
{
|
|
3442
3684
|
id,
|
|
@@ -3450,7 +3692,7 @@ function ToggleControl({
|
|
|
3450
3692
|
disabled: !isInteractive,
|
|
3451
3693
|
onClick: handleClick,
|
|
3452
3694
|
title: unavailableReason || description || toggleLabel,
|
|
3453
|
-
children: /* @__PURE__ */
|
|
3695
|
+
children: /* @__PURE__ */ jsx30(
|
|
3454
3696
|
"span",
|
|
3455
3697
|
{
|
|
3456
3698
|
className: "arap-toggle-knob",
|
|
@@ -3467,7 +3709,7 @@ function ToggleControl({
|
|
|
3467
3709
|
|
|
3468
3710
|
// src/core/controls/ChoiceControl.tsx
|
|
3469
3711
|
import { useCallback as useCallback4, useMemo as useMemo2, useRef as useRef5 } from "react";
|
|
3470
|
-
import { jsx as
|
|
3712
|
+
import { jsx as jsx31, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3471
3713
|
function ChoiceControl({
|
|
3472
3714
|
id,
|
|
3473
3715
|
label,
|
|
@@ -3523,7 +3765,7 @@ function ChoiceControl({
|
|
|
3523
3765
|
const renderOptionButton = (opt) => {
|
|
3524
3766
|
const isSelected = value === opt.value;
|
|
3525
3767
|
const isOptionDisabled = disabled || Boolean(opt.disabled);
|
|
3526
|
-
return /* @__PURE__ */
|
|
3768
|
+
return /* @__PURE__ */ jsxs28(
|
|
3527
3769
|
"button",
|
|
3528
3770
|
{
|
|
3529
3771
|
type: "button",
|
|
@@ -3537,15 +3779,15 @@ function ChoiceControl({
|
|
|
3537
3779
|
onClick: () => !isOptionDisabled && onChange(opt.value),
|
|
3538
3780
|
title: opt.description,
|
|
3539
3781
|
children: [
|
|
3540
|
-
isSelected && /* @__PURE__ */
|
|
3541
|
-
/* @__PURE__ */
|
|
3542
|
-
opt.badge && /* @__PURE__ */
|
|
3782
|
+
isSelected && /* @__PURE__ */ jsx31("span", { className: "arap-check", "aria-hidden": "true", children: "\u2713" }),
|
|
3783
|
+
/* @__PURE__ */ jsx31("span", { children: opt.label }),
|
|
3784
|
+
opt.badge && /* @__PURE__ */ jsx31("span", { className: "arap-choice-badge", "aria-hidden": "true", children: opt.badge })
|
|
3543
3785
|
]
|
|
3544
3786
|
},
|
|
3545
3787
|
String(opt.value)
|
|
3546
3788
|
);
|
|
3547
3789
|
};
|
|
3548
|
-
return /* @__PURE__ */
|
|
3790
|
+
return /* @__PURE__ */ jsx31(
|
|
3549
3791
|
"div",
|
|
3550
3792
|
{
|
|
3551
3793
|
ref: containerRef,
|
|
@@ -3556,15 +3798,15 @@ function ChoiceControl({
|
|
|
3556
3798
|
className: `arap-choice-control arap-segmented ${largeControls ? "arap-large-controls" : ""} ${className}`,
|
|
3557
3799
|
style,
|
|
3558
3800
|
onKeyDown: handleKeyDown,
|
|
3559
|
-
children: groups ? groups.map((group) => /* @__PURE__ */
|
|
3801
|
+
children: groups ? groups.map((group) => /* @__PURE__ */ jsxs28(
|
|
3560
3802
|
"div",
|
|
3561
3803
|
{
|
|
3562
3804
|
className: "arap-choice-group",
|
|
3563
3805
|
role: "group",
|
|
3564
3806
|
"aria-label": group.label,
|
|
3565
3807
|
children: [
|
|
3566
|
-
/* @__PURE__ */
|
|
3567
|
-
/* @__PURE__ */
|
|
3808
|
+
/* @__PURE__ */ jsx31("span", { className: "arap-choice-group-title", children: group.label }),
|
|
3809
|
+
/* @__PURE__ */ jsx31("div", { className: "arap-segmented", children: group.options.map(renderOptionButton) })
|
|
3568
3810
|
]
|
|
3569
3811
|
},
|
|
3570
3812
|
group.label
|
|
@@ -3574,7 +3816,7 @@ function ChoiceControl({
|
|
|
3574
3816
|
}
|
|
3575
3817
|
|
|
3576
3818
|
// src/core/controls/StepperControl.tsx
|
|
3577
|
-
import { jsx as
|
|
3819
|
+
import { jsx as jsx32, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3578
3820
|
function StepperControl({
|
|
3579
3821
|
id,
|
|
3580
3822
|
label,
|
|
@@ -3604,15 +3846,15 @@ function StepperControl({
|
|
|
3604
3846
|
onChange(Math.min(max, Number((value + step).toFixed(2))));
|
|
3605
3847
|
}
|
|
3606
3848
|
};
|
|
3607
|
-
return /* @__PURE__ */
|
|
3849
|
+
return /* @__PURE__ */ jsxs29(
|
|
3608
3850
|
"div",
|
|
3609
3851
|
{
|
|
3610
3852
|
id,
|
|
3611
3853
|
className: `arap-stepper-control-wrapper ${largeControls ? "arap-large-controls" : ""} ${className}`,
|
|
3612
3854
|
style,
|
|
3613
3855
|
children: [
|
|
3614
|
-
/* @__PURE__ */
|
|
3615
|
-
/* @__PURE__ */
|
|
3856
|
+
/* @__PURE__ */ jsxs29("div", { className: "arap-controls", children: [
|
|
3857
|
+
/* @__PURE__ */ jsx32(
|
|
3616
3858
|
"button",
|
|
3617
3859
|
{
|
|
3618
3860
|
type: "button",
|
|
@@ -3623,8 +3865,8 @@ function StepperControl({
|
|
|
3623
3865
|
children: "\u2212"
|
|
3624
3866
|
}
|
|
3625
3867
|
),
|
|
3626
|
-
/* @__PURE__ */
|
|
3627
|
-
/* @__PURE__ */
|
|
3868
|
+
/* @__PURE__ */ jsx32("output", { className: "arap-value", "aria-live": "polite", children: displayValue }),
|
|
3869
|
+
/* @__PURE__ */ jsx32(
|
|
3628
3870
|
"button",
|
|
3629
3871
|
{
|
|
3630
3872
|
type: "button",
|
|
@@ -3636,7 +3878,7 @@ function StepperControl({
|
|
|
3636
3878
|
}
|
|
3637
3879
|
)
|
|
3638
3880
|
] }),
|
|
3639
|
-
showSlider && /* @__PURE__ */
|
|
3881
|
+
showSlider && /* @__PURE__ */ jsx32("div", { className: "arap-slider-container", children: /* @__PURE__ */ jsx32(
|
|
3640
3882
|
"input",
|
|
3641
3883
|
{
|
|
3642
3884
|
type: "range",
|
|
@@ -3660,7 +3902,7 @@ function StepperControl({
|
|
|
3660
3902
|
}
|
|
3661
3903
|
|
|
3662
3904
|
// src/core/controls/FeatureCard.tsx
|
|
3663
|
-
import { jsx as
|
|
3905
|
+
import { jsx as jsx33, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3664
3906
|
function FeatureCard({
|
|
3665
3907
|
id,
|
|
3666
3908
|
featureKey,
|
|
@@ -3679,7 +3921,7 @@ function FeatureCard({
|
|
|
3679
3921
|
largeControls = false
|
|
3680
3922
|
}) {
|
|
3681
3923
|
const cardTitle = typeof title === "string" ? title : void 0;
|
|
3682
|
-
return /* @__PURE__ */
|
|
3924
|
+
return /* @__PURE__ */ jsxs30(
|
|
3683
3925
|
"div",
|
|
3684
3926
|
{
|
|
3685
3927
|
id,
|
|
@@ -3688,27 +3930,27 @@ function FeatureCard({
|
|
|
3688
3930
|
className: `arap-feature arap-feature-card ${status !== "idle" ? `arap-feature-${status}` : ""} ${largeControls ? "arap-large-controls" : ""} ${className}`,
|
|
3689
3931
|
style,
|
|
3690
3932
|
children: [
|
|
3691
|
-
/* @__PURE__ */
|
|
3692
|
-
/* @__PURE__ */
|
|
3693
|
-
icon ?? (featureKey ? /* @__PURE__ */
|
|
3694
|
-
/* @__PURE__ */
|
|
3933
|
+
/* @__PURE__ */ jsxs30("div", { className: "arap-card-header", children: [
|
|
3934
|
+
/* @__PURE__ */ jsxs30("span", { className: "arap-label", children: [
|
|
3935
|
+
icon ?? (featureKey ? /* @__PURE__ */ jsx33(FeatureIcon, { name: featureKey }) : null),
|
|
3936
|
+
/* @__PURE__ */ jsx33("span", { className: "arap-card-title", children: title })
|
|
3695
3937
|
] }),
|
|
3696
|
-
statusBadge && /* @__PURE__ */
|
|
3938
|
+
statusBadge && /* @__PURE__ */ jsx33("span", { className: "arap-status-badge", "aria-hidden": "true", children: statusBadge })
|
|
3697
3939
|
] }),
|
|
3698
|
-
description && /* @__PURE__ */
|
|
3699
|
-
status === "error" && errorMessage && /* @__PURE__ */
|
|
3700
|
-
/* @__PURE__ */
|
|
3701
|
-
/* @__PURE__ */
|
|
3940
|
+
description && /* @__PURE__ */ jsx33("p", { className: "arap-card-desc", children: description }),
|
|
3941
|
+
status === "error" && errorMessage && /* @__PURE__ */ jsxs30("div", { className: "arap-card-alert arap-card-error", role: "alert", children: [
|
|
3942
|
+
/* @__PURE__ */ jsx33("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u26A0\uFE0F" }),
|
|
3943
|
+
/* @__PURE__ */ jsx33("span", { children: errorMessage })
|
|
3702
3944
|
] }),
|
|
3703
|
-
status === "unavailable" && unavailableMessage && /* @__PURE__ */
|
|
3704
|
-
/* @__PURE__ */
|
|
3705
|
-
/* @__PURE__ */
|
|
3945
|
+
status === "unavailable" && unavailableMessage && /* @__PURE__ */ jsxs30("div", { className: "arap-card-alert arap-card-unavailable", role: "status", children: [
|
|
3946
|
+
/* @__PURE__ */ jsx33("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u2139\uFE0F" }),
|
|
3947
|
+
/* @__PURE__ */ jsx33("span", { children: unavailableMessage })
|
|
3706
3948
|
] }),
|
|
3707
|
-
status === "permission-required" && permissionMessage && /* @__PURE__ */
|
|
3708
|
-
/* @__PURE__ */
|
|
3709
|
-
/* @__PURE__ */
|
|
3710
|
-
/* @__PURE__ */
|
|
3711
|
-
onRequestPermission && /* @__PURE__ */
|
|
3949
|
+
status === "permission-required" && permissionMessage && /* @__PURE__ */ jsxs30("div", { className: "arap-card-alert arap-card-permission", role: "status", children: [
|
|
3950
|
+
/* @__PURE__ */ jsx33("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u{1F512}" }),
|
|
3951
|
+
/* @__PURE__ */ jsxs30("div", { className: "arap-permission-content", children: [
|
|
3952
|
+
/* @__PURE__ */ jsx33("span", { children: permissionMessage }),
|
|
3953
|
+
onRequestPermission && /* @__PURE__ */ jsx33(
|
|
3712
3954
|
"button",
|
|
3713
3955
|
{
|
|
3714
3956
|
type: "button",
|
|
@@ -3719,14 +3961,14 @@ function FeatureCard({
|
|
|
3719
3961
|
)
|
|
3720
3962
|
] })
|
|
3721
3963
|
] }),
|
|
3722
|
-
/* @__PURE__ */
|
|
3964
|
+
/* @__PURE__ */ jsx33("div", { className: "arap-card-content", children })
|
|
3723
3965
|
]
|
|
3724
3966
|
}
|
|
3725
3967
|
);
|
|
3726
3968
|
}
|
|
3727
3969
|
|
|
3728
3970
|
// src/core/controls/FeatureStatusState.tsx
|
|
3729
|
-
import { jsx as
|
|
3971
|
+
import { jsx as jsx34, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3730
3972
|
function SearchCount({
|
|
3731
3973
|
totalCount,
|
|
3732
3974
|
matchedCount,
|
|
@@ -3735,7 +3977,7 @@ function SearchCount({
|
|
|
3735
3977
|
style
|
|
3736
3978
|
}) {
|
|
3737
3979
|
const text = query ? `Showing ${matchedCount} of ${totalCount} tools matching "${query}"` : `Showing all ${totalCount} tools`;
|
|
3738
|
-
return /* @__PURE__ */
|
|
3980
|
+
return /* @__PURE__ */ jsx34(
|
|
3739
3981
|
"div",
|
|
3740
3982
|
{
|
|
3741
3983
|
role: "status",
|
|
@@ -3755,17 +3997,17 @@ function EmptyState({
|
|
|
3755
3997
|
className = "",
|
|
3756
3998
|
style
|
|
3757
3999
|
}) {
|
|
3758
|
-
return /* @__PURE__ */
|
|
4000
|
+
return /* @__PURE__ */ jsxs31(
|
|
3759
4001
|
"div",
|
|
3760
4002
|
{
|
|
3761
4003
|
role: "status",
|
|
3762
4004
|
className: `arap-empty-state ${className}`,
|
|
3763
4005
|
style,
|
|
3764
4006
|
children: [
|
|
3765
|
-
/* @__PURE__ */
|
|
3766
|
-
/* @__PURE__ */
|
|
3767
|
-
/* @__PURE__ */
|
|
3768
|
-
onAction && /* @__PURE__ */
|
|
4007
|
+
/* @__PURE__ */ jsx34("div", { className: "arap-empty-icon", "aria-hidden": "true", children: icon ?? "\u{1F50D}" }),
|
|
4008
|
+
/* @__PURE__ */ jsx34("h3", { className: "arap-empty-title", children: title }),
|
|
4009
|
+
/* @__PURE__ */ jsx34("p", { className: "arap-empty-desc", children: description }),
|
|
4010
|
+
onAction && /* @__PURE__ */ jsx34("button", { type: "button", className: "arap-empty-btn", onClick: onAction, children: actionLabel })
|
|
3769
4011
|
]
|
|
3770
4012
|
}
|
|
3771
4013
|
);
|
|
@@ -3778,18 +4020,18 @@ function ErrorState({
|
|
|
3778
4020
|
className = "",
|
|
3779
4021
|
style
|
|
3780
4022
|
}) {
|
|
3781
|
-
return /* @__PURE__ */
|
|
4023
|
+
return /* @__PURE__ */ jsxs31(
|
|
3782
4024
|
"div",
|
|
3783
4025
|
{
|
|
3784
4026
|
role: "alert",
|
|
3785
4027
|
className: `arap-error-state arap-card-alert arap-card-error ${className}`,
|
|
3786
4028
|
style,
|
|
3787
4029
|
children: [
|
|
3788
|
-
/* @__PURE__ */
|
|
3789
|
-
/* @__PURE__ */
|
|
3790
|
-
title && /* @__PURE__ */
|
|
3791
|
-
/* @__PURE__ */
|
|
3792
|
-
onRetry && /* @__PURE__ */
|
|
4030
|
+
/* @__PURE__ */ jsx34("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u26A0\uFE0F" }),
|
|
4031
|
+
/* @__PURE__ */ jsxs31("div", { className: "arap-error-content", children: [
|
|
4032
|
+
title && /* @__PURE__ */ jsx34("h4", { className: "arap-error-title", children: title }),
|
|
4033
|
+
/* @__PURE__ */ jsx34("p", { className: "arap-error-message", children: message }),
|
|
4034
|
+
onRetry && /* @__PURE__ */ jsx34("button", { type: "button", className: "arap-retry-btn", onClick: onRetry, children: retryLabel })
|
|
3793
4035
|
] })
|
|
3794
4036
|
]
|
|
3795
4037
|
}
|
|
@@ -3797,7 +4039,7 @@ function ErrorState({
|
|
|
3797
4039
|
}
|
|
3798
4040
|
|
|
3799
4041
|
// src/core/controls/ProfilePreviewCard.tsx
|
|
3800
|
-
import { jsx as
|
|
4042
|
+
import { jsx as jsx35, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3801
4043
|
function ProfilePreviewCard({
|
|
3802
4044
|
profile,
|
|
3803
4045
|
isActive,
|
|
@@ -3847,7 +4089,7 @@ function ProfilePreviewCard({
|
|
|
3847
4089
|
if (val === null || val === void 0) return "Original";
|
|
3848
4090
|
return String(val);
|
|
3849
4091
|
};
|
|
3850
|
-
return /* @__PURE__ */
|
|
4092
|
+
return /* @__PURE__ */ jsxs32(
|
|
3851
4093
|
"div",
|
|
3852
4094
|
{
|
|
3853
4095
|
role: "group",
|
|
@@ -3855,10 +4097,10 @@ function ProfilePreviewCard({
|
|
|
3855
4097
|
className: `arap-profile-card ${isActive ? "arap-profile-card-active" : ""} ${largeControls ? "arap-large-controls" : ""} ${className}`,
|
|
3856
4098
|
style,
|
|
3857
4099
|
children: [
|
|
3858
|
-
/* @__PURE__ */
|
|
3859
|
-
/* @__PURE__ */
|
|
3860
|
-
/* @__PURE__ */
|
|
3861
|
-
isActive && /* @__PURE__ */
|
|
4100
|
+
/* @__PURE__ */ jsxs32("div", { className: "arap-profile-header", children: [
|
|
4101
|
+
/* @__PURE__ */ jsxs32("div", { className: "arap-profile-title-row", children: [
|
|
4102
|
+
/* @__PURE__ */ jsx35("h4", { className: "arap-profile-title", children: profile.label }),
|
|
4103
|
+
isActive && /* @__PURE__ */ jsx35(
|
|
3862
4104
|
"span",
|
|
3863
4105
|
{
|
|
3864
4106
|
className: "arap-profile-active-badge",
|
|
@@ -3867,14 +4109,14 @@ function ProfilePreviewCard({
|
|
|
3867
4109
|
}
|
|
3868
4110
|
)
|
|
3869
4111
|
] }),
|
|
3870
|
-
/* @__PURE__ */
|
|
4112
|
+
/* @__PURE__ */ jsx35("p", { className: "arap-profile-desc", children: profile.description })
|
|
3871
4113
|
] }),
|
|
3872
|
-
/* @__PURE__ */
|
|
3873
|
-
/* @__PURE__ */
|
|
3874
|
-
/* @__PURE__ */
|
|
4114
|
+
/* @__PURE__ */ jsxs32("div", { className: "arap-profile-affected", children: [
|
|
4115
|
+
/* @__PURE__ */ jsx35("span", { className: "arap-profile-affected-label", children: "Affected settings:" }),
|
|
4116
|
+
/* @__PURE__ */ jsx35("div", { className: "arap-profile-chips", children: affectedKeys.map((key) => {
|
|
3875
4117
|
const val = profile.settings[key];
|
|
3876
|
-
return /* @__PURE__ */
|
|
3877
|
-
/* @__PURE__ */
|
|
4118
|
+
return /* @__PURE__ */ jsxs32("span", { className: "arap-profile-chip", children: [
|
|
4119
|
+
/* @__PURE__ */ jsxs32("strong", { children: [
|
|
3878
4120
|
formatKeyName(key),
|
|
3879
4121
|
":"
|
|
3880
4122
|
] }),
|
|
@@ -3883,7 +4125,7 @@ function ProfilePreviewCard({
|
|
|
3883
4125
|
] }, key);
|
|
3884
4126
|
}) })
|
|
3885
4127
|
] }),
|
|
3886
|
-
/* @__PURE__ */
|
|
4128
|
+
/* @__PURE__ */ jsx35("div", { className: "arap-profile-actions", children: isActive ? /* @__PURE__ */ jsx35(
|
|
3887
4129
|
"button",
|
|
3888
4130
|
{
|
|
3889
4131
|
type: "button",
|
|
@@ -3892,7 +4134,7 @@ function ProfilePreviewCard({
|
|
|
3892
4134
|
"aria-label": `Revert ${profile.label} profile`,
|
|
3893
4135
|
children: "Revert to custom settings"
|
|
3894
4136
|
}
|
|
3895
|
-
) : /* @__PURE__ */
|
|
4137
|
+
) : /* @__PURE__ */ jsx35(
|
|
3896
4138
|
"button",
|
|
3897
4139
|
{
|
|
3898
4140
|
type: "button",
|
|
@@ -3929,6 +4171,7 @@ export {
|
|
|
3929
4171
|
FontFamilyController,
|
|
3930
4172
|
FontSizeController,
|
|
3931
4173
|
GrayscaleController,
|
|
4174
|
+
HideDecorativeImagesController,
|
|
3932
4175
|
HideImagesController,
|
|
3933
4176
|
HideVideosController,
|
|
3934
4177
|
HighlightFocusController,
|
|
@@ -3944,6 +4187,7 @@ export {
|
|
|
3944
4187
|
ProfilePreviewCard,
|
|
3945
4188
|
ReadingGuideController,
|
|
3946
4189
|
ReadingMaskController,
|
|
4190
|
+
ReduceMotionController,
|
|
3947
4191
|
ResetController,
|
|
3948
4192
|
SaturationController,
|
|
3949
4193
|
SearchCount,
|
|
@@ -3961,12 +4205,15 @@ export {
|
|
|
3961
4205
|
enLocale,
|
|
3962
4206
|
findMainLandmark,
|
|
3963
4207
|
getScriptSpacingConstraints,
|
|
4208
|
+
isEligibleDecorativeImage,
|
|
3964
4209
|
isForcedColorsActive,
|
|
4210
|
+
isFunctionalOrMeaningfulImage,
|
|
3965
4211
|
isProtectedFromContrast,
|
|
3966
4212
|
isProtectedFromFontFamily,
|
|
3967
4213
|
isProtectedFromTextAlign,
|
|
3968
4214
|
isProtectedFromTextScale,
|
|
3969
4215
|
isProtectedFromTextSpacing,
|
|
4216
|
+
isReducedMotionActive,
|
|
3970
4217
|
isRtlLocale,
|
|
3971
4218
|
normalizePreferenceValue,
|
|
3972
4219
|
normalizePreferences,
|
|
@@ -3974,6 +4221,8 @@ export {
|
|
|
3974
4221
|
registerLocale,
|
|
3975
4222
|
resolveEffectivePreferences,
|
|
3976
4223
|
resolveLocaleStrings,
|
|
4224
|
+
subscribeForcedColors,
|
|
4225
|
+
subscribeReducedMotion,
|
|
3977
4226
|
useAccessibility
|
|
3978
4227
|
};
|
|
3979
4228
|
//# sourceMappingURL=index.mjs.map
|