@techsio/storybook-better-a11y 0.0.6 → 0.0.8
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/{visionSimulatorFilters.js → 100.js} +23 -1
- package/dist/{apcaChecker.js → 699.js} +253 -1
- package/dist/index.js +6 -5
- package/dist/manager.js +1540 -11
- package/dist/postinstall.js +1 -1
- package/dist/preview.js +1 -68
- package/dist/rslib-runtime.js +37 -0
- package/package.json +1 -1
- package/dist/AccessibilityRuleMaps.js +0 -532
- package/dist/a11yRunner.js +0 -105
- package/dist/a11yRunner.test.js +0 -21
- package/dist/a11yRunnerUtils.js +0 -30
- package/dist/a11yRunnerUtils.test.js +0 -61
- package/dist/apcaChecker.test.js +0 -124
- package/dist/axeRuleMappingHelper.js +0 -4
- package/dist/components/A11YPanel.js +0 -140
- package/dist/components/A11YPanel.stories.js +0 -198
- package/dist/components/A11YPanel.test.js +0 -110
- package/dist/components/A11yContext.js +0 -438
- package/dist/components/A11yContext.test.js +0 -277
- package/dist/components/Report/Details.js +0 -169
- package/dist/components/Report/Report.js +0 -106
- package/dist/components/Report/Report.stories.js +0 -86
- package/dist/components/Tabs.js +0 -54
- package/dist/components/TestDiscrepancyMessage.js +0 -55
- package/dist/components/TestDiscrepancyMessage.stories.js +0 -40
- package/dist/components/VisionSimulator.js +0 -83
- package/dist/components/VisionSimulator.stories.js +0 -56
- package/dist/constants.js +0 -25
- package/dist/manager.test.js +0 -86
- package/dist/params.js +0 -0
- package/dist/preview.test.js +0 -215
- package/dist/results.mock.js +0 -874
- package/dist/types.js +0 -6
- package/dist/utils.js +0 -21
- package/dist/withVisionSimulator.js +0 -41
package/dist/types.js
DELETED
package/dist/utils.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
function getIsVitestStandaloneRun() {
|
|
2
|
-
try {
|
|
3
|
-
return 'false' === ({
|
|
4
|
-
MODE: "production",
|
|
5
|
-
DEV: false,
|
|
6
|
-
PROD: true,
|
|
7
|
-
BASE_URL: "/",
|
|
8
|
-
ASSET_PREFIX: "auto"
|
|
9
|
-
}).VITEST_STORYBOOK;
|
|
10
|
-
} catch (e) {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
function getIsVitestRunning() {
|
|
15
|
-
try {
|
|
16
|
-
return false;
|
|
17
|
-
} catch (e) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export { getIsVitestRunning, getIsVitestStandaloneRun };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect } from "storybook/preview-api";
|
|
2
|
-
import { filterDefs, filters } from "./visionSimulatorFilters.js";
|
|
3
|
-
const knownFilters = Object.values(filters).map((f)=>f.filter);
|
|
4
|
-
const knownFiltersRegExp = new RegExp(`\\b(${knownFilters.join('|')})\\b`, 'g');
|
|
5
|
-
const withVisionSimulator = (StoryFn, { globals })=>{
|
|
6
|
-
const { vision } = globals;
|
|
7
|
-
const applyVisionFilter = useCallback(()=>{
|
|
8
|
-
const existingFilters = document.body.style.filter.replaceAll(knownFiltersRegExp, '').trim();
|
|
9
|
-
const visionFilter = filters[vision]?.filter;
|
|
10
|
-
if (visionFilter && document.body.classList.contains('sb-show-main')) if (existingFilters && 'none' !== existingFilters) document.body.style.filter = `${existingFilters} ${visionFilter}`;
|
|
11
|
-
else document.body.style.filter = visionFilter;
|
|
12
|
-
else document.body.style.filter = existingFilters || 'none';
|
|
13
|
-
return ()=>document.body.style.filter = existingFilters || 'none';
|
|
14
|
-
}, [
|
|
15
|
-
vision
|
|
16
|
-
]);
|
|
17
|
-
useEffect(()=>{
|
|
18
|
-
const cleanup = applyVisionFilter();
|
|
19
|
-
const observer = new MutationObserver(()=>applyVisionFilter());
|
|
20
|
-
observer.observe(document.body, {
|
|
21
|
-
attributeFilter: [
|
|
22
|
-
'class'
|
|
23
|
-
]
|
|
24
|
-
});
|
|
25
|
-
return ()=>{
|
|
26
|
-
cleanup();
|
|
27
|
-
observer.disconnect();
|
|
28
|
-
};
|
|
29
|
-
}, [
|
|
30
|
-
applyVisionFilter
|
|
31
|
-
]);
|
|
32
|
-
useEffect(()=>{
|
|
33
|
-
document.body.insertAdjacentHTML('beforeend', filterDefs);
|
|
34
|
-
return ()=>{
|
|
35
|
-
const filterDefsElement = document.getElementById('storybook-a11y-vision-filters');
|
|
36
|
-
filterDefsElement?.parentElement?.removeChild(filterDefsElement);
|
|
37
|
-
};
|
|
38
|
-
}, []);
|
|
39
|
-
return StoryFn();
|
|
40
|
-
};
|
|
41
|
-
export { withVisionSimulator };
|