@storybook/addon-a11y 11.0.0-alpha.4 → 11.0.0-alpha.6
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/constants.ts
|
|
2
|
-
var ADDON_ID = "storybook/a11y", PANEL_ID = `${ADDON_ID}/panel`, PARAM_KEY = "a11y", VISION_GLOBAL_KEY = "vision", UI_STATE_ID = `${ADDON_ID}/ui`, RESULT = `${ADDON_ID}/result`, REQUEST = `${ADDON_ID}/request`, RUNNING = `${ADDON_ID}/running`, ERROR = `${ADDON_ID}/error`, MANUAL = `${ADDON_ID}/manual`,
|
|
3
|
-
var EVENTS = { RESULT, REQUEST, RUNNING, ERROR, MANUAL
|
|
2
|
+
var ADDON_ID = "storybook/a11y", PANEL_ID = `${ADDON_ID}/panel`, PARAM_KEY = "a11y", VISION_GLOBAL_KEY = "vision", UI_STATE_ID = `${ADDON_ID}/ui`, RESULT = `${ADDON_ID}/result`, REQUEST = `${ADDON_ID}/request`, RUNNING = `${ADDON_ID}/running`, ERROR = `${ADDON_ID}/error`, MANUAL = `${ADDON_ID}/manual`, DOCUMENTATION_LINK = "writing-tests/accessibility-testing", DOCUMENTATION_DISCREPANCY_LINK = `${DOCUMENTATION_LINK}#why-are-my-tests-failing-in-different-environments`;
|
|
3
|
+
var EVENTS = { RESULT, REQUEST, RUNNING, ERROR, MANUAL }, STATUS_TYPE_ID_COMPONENT_TEST = "storybook/component-test", STATUS_TYPE_ID_A11Y = "storybook/a11y";
|
|
4
4
|
|
|
5
5
|
// src/visionSimulatorFilters.ts
|
|
6
6
|
var filters = {
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
preview_exports
|
|
3
|
-
} from "./_browser-chunks/chunk-
|
|
3
|
+
} from "./_browser-chunks/chunk-5WURYCET.js";
|
|
4
4
|
import {
|
|
5
5
|
PARAM_KEY
|
|
6
|
-
} from "./_browser-chunks/chunk-
|
|
6
|
+
} from "./_browser-chunks/chunk-QB47YQRA.js";
|
|
7
7
|
import "./_browser-chunks/chunk-4BE7D4DS.js";
|
|
8
8
|
|
|
9
9
|
// src/index.ts
|
package/dist/manager.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
VISION_GLOBAL_KEY,
|
|
10
10
|
filterDefs,
|
|
11
11
|
filters
|
|
12
|
-
} from "./_browser-chunks/chunk-
|
|
12
|
+
} from "./_browser-chunks/chunk-QB47YQRA.js";
|
|
13
13
|
import "./_browser-chunks/chunk-4BE7D4DS.js";
|
|
14
14
|
|
|
15
15
|
// src/manager.tsx
|
|
@@ -46,7 +46,12 @@ import {
|
|
|
46
46
|
STORY_HOT_UPDATED,
|
|
47
47
|
STORY_RENDER_PHASE_CHANGED
|
|
48
48
|
} from "storybook/internal/core-events";
|
|
49
|
-
import {
|
|
49
|
+
import {
|
|
50
|
+
HIGHLIGHT,
|
|
51
|
+
HIGHLIGHT_MENU_CLICK,
|
|
52
|
+
REMOVE_HIGHLIGHT,
|
|
53
|
+
SCROLL_INTO_VIEW
|
|
54
|
+
} from "storybook/highlight";
|
|
50
55
|
import {
|
|
51
56
|
experimental_getStatusStore,
|
|
52
57
|
experimental_useStatusStore,
|
|
@@ -581,7 +586,7 @@ var axeRuleMapping_wcag_2_0_a_aa = {
|
|
|
581
586
|
var getTitleForAxeResult = (axeResult) => combinedRulesMap[axeResult.id]?.title || axeResult.id, getFriendlySummaryForAxeResult = (axeResult) => combinedRulesMap[axeResult.id]?.friendlySummary || axeResult.description;
|
|
582
587
|
|
|
583
588
|
// src/components/A11yContext.tsx
|
|
584
|
-
var unhighlightedSelectors = ["html", "body", "main"], theme = convert(themes.light), colorsByType = {
|
|
589
|
+
var unhighlightedSelectors = ["html", "body", "main"], SELECTED_HIGHLIGHT_ID = `${ADDON_ID}/selected`, OTHERS_HIGHLIGHT_ID = `${ADDON_ID}/others`, theme = convert(themes.light), colorsByType = {
|
|
585
590
|
[RuleType.VIOLATION]: theme.color.negative,
|
|
586
591
|
[RuleType.PASS]: theme.color.positive,
|
|
587
592
|
[RuleType.INCOMPLETION]: theme.color.warning
|
|
@@ -692,7 +697,9 @@ var unhighlightedSelectors = ["html", "body", "main"], theme = convert(themes.li
|
|
|
692
697
|
},
|
|
693
698
|
[storyId, setState, setSelectedItems]
|
|
694
699
|
), handleSelect = useCallback(
|
|
695
|
-
(itemId, details) => {
|
|
700
|
+
(highlightId, itemId, details) => {
|
|
701
|
+
if (highlightId !== SELECTED_HIGHLIGHT_ID && highlightId !== OTHERS_HIGHLIGHT_ID)
|
|
702
|
+
return;
|
|
696
703
|
let [type, id] = itemId.split("."), { helpUrl, nodes } = results?.[type]?.find((r) => r.id === id) || {}, openedWindow = helpUrl && window.open(helpUrl, "_blank", "noopener,noreferrer");
|
|
697
704
|
if (nodes && !openedWindow) {
|
|
698
705
|
let index = nodes.findIndex((n) => details.selectors.some((s) => s === String(n.target))) ?? -1;
|
|
@@ -724,7 +731,7 @@ var unhighlightedSelectors = ["html", "body", "main"], theme = convert(themes.li
|
|
|
724
731
|
{
|
|
725
732
|
[EVENTS.RESULT]: handleResult,
|
|
726
733
|
[EVENTS.ERROR]: handleError,
|
|
727
|
-
[
|
|
734
|
+
[HIGHLIGHT_MENU_CLICK]: handleSelect,
|
|
728
735
|
[STORY_CHANGED]: () => setSelectedItems(/* @__PURE__ */ new Map()),
|
|
729
736
|
[STORY_RENDER_PHASE_CHANGED]: handleReset,
|
|
730
737
|
[STORY_FINISHED]: handleReport,
|
|
@@ -752,7 +759,7 @@ var unhighlightedSelectors = ["html", "body", "main"], theme = convert(themes.li
|
|
|
752
759
|
return type && Object.values(RuleType).includes(type) && (update.tab = type), { ...prev, ui: update };
|
|
753
760
|
});
|
|
754
761
|
}, [a11ySelection]), useEffect(() => {
|
|
755
|
-
if (emit(REMOVE_HIGHLIGHT,
|
|
762
|
+
if (emit(REMOVE_HIGHLIGHT, SELECTED_HIGHLIGHT_ID), emit(REMOVE_HIGHLIGHT, OTHERS_HIGHLIGHT_ID), !ui.highlighted || isInitial)
|
|
756
763
|
return;
|
|
757
764
|
let selected = Array.from(selectedItems.values()).flatMap((key) => {
|
|
758
765
|
let [type, id, number] = key.split(".");
|
|
@@ -762,7 +769,7 @@ var unhighlightedSelectors = ["html", "body", "main"], theme = convert(themes.li
|
|
|
762
769
|
return target ? [String(target)] : [];
|
|
763
770
|
});
|
|
764
771
|
selected.length && emit(HIGHLIGHT, {
|
|
765
|
-
id:
|
|
772
|
+
id: SELECTED_HIGHLIGHT_ID,
|
|
766
773
|
priority: 1,
|
|
767
774
|
selectors: selected,
|
|
768
775
|
styles: {
|
|
@@ -789,7 +796,7 @@ var unhighlightedSelectors = ["html", "body", "main"], theme = convert(themes.li
|
|
|
789
796
|
iconLeft: "info",
|
|
790
797
|
iconRight: "shareAlt",
|
|
791
798
|
title: "Learn how to resolve this violation",
|
|
792
|
-
|
|
799
|
+
clickable: !0,
|
|
793
800
|
selectors
|
|
794
801
|
}
|
|
795
802
|
];
|
|
@@ -797,7 +804,7 @@ var unhighlightedSelectors = ["html", "body", "main"], theme = convert(themes.li
|
|
|
797
804
|
});
|
|
798
805
|
let others = results?.[ui.tab].flatMap((r) => r.nodes.flatMap((n) => n.target).map(String)).filter((e) => ![...unhighlightedSelectors, ...selected].includes(e));
|
|
799
806
|
others?.length && emit(HIGHLIGHT, {
|
|
800
|
-
id:
|
|
807
|
+
id: OTHERS_HIGHLIGHT_ID,
|
|
801
808
|
selectors: others,
|
|
802
809
|
styles: {
|
|
803
810
|
outline: `1px solid color-mix(in srgb, ${colorsByType[ui.tab]}, transparent 30%)`,
|
|
@@ -823,7 +830,7 @@ var unhighlightedSelectors = ["html", "body", "main"], theme = convert(themes.li
|
|
|
823
830
|
iconLeft: "info",
|
|
824
831
|
iconRight: "shareAlt",
|
|
825
832
|
title: "Learn how to resolve this violation",
|
|
826
|
-
|
|
833
|
+
clickable: !0,
|
|
827
834
|
selectors
|
|
828
835
|
}
|
|
829
836
|
];
|
package/dist/preset.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_vfg85vip05 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_vfg85vip05 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_vfg85vip05 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_vfg85vip05.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_vfg85vip05.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_vfg85vip05.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
package/dist/preview.js
CHANGED
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
decorators,
|
|
4
4
|
initialGlobals,
|
|
5
5
|
parameters
|
|
6
|
-
} from "./_browser-chunks/chunk-
|
|
7
|
-
import "./_browser-chunks/chunk-
|
|
6
|
+
} from "./_browser-chunks/chunk-5WURYCET.js";
|
|
7
|
+
import "./_browser-chunks/chunk-QB47YQRA.js";
|
|
8
8
|
import "./_browser-chunks/chunk-4BE7D4DS.js";
|
|
9
9
|
export {
|
|
10
10
|
afterEach,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-a11y",
|
|
3
|
-
"version": "11.0.0-alpha.
|
|
3
|
+
"version": "11.0.0-alpha.6",
|
|
4
4
|
"description": "Storybook Addon A11y: Test UI component compliance with WCAG web accessibility standards",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"a11y",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"vitest-axe": "^0.1.0"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"storybook": "^11.0.0-alpha.
|
|
75
|
+
"storybook": "^11.0.0-alpha.6"
|
|
76
76
|
},
|
|
77
77
|
"publishConfig": {
|
|
78
78
|
"access": "public"
|