@techsio/storybook-better-a11y 0.0.6 → 0.0.7

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.
Files changed (36) hide show
  1. package/dist/{visionSimulatorFilters.js → 100.js} +23 -1
  2. package/dist/{apcaChecker.js → 699.js} +253 -1
  3. package/dist/index.js +6 -5
  4. package/dist/manager.js +1540 -11
  5. package/dist/postinstall.js +1 -1
  6. package/dist/preview.js +1 -68
  7. package/dist/rslib-runtime.js +37 -0
  8. package/package.json +1 -1
  9. package/dist/AccessibilityRuleMaps.js +0 -532
  10. package/dist/a11yRunner.js +0 -105
  11. package/dist/a11yRunner.test.js +0 -21
  12. package/dist/a11yRunnerUtils.js +0 -30
  13. package/dist/a11yRunnerUtils.test.js +0 -61
  14. package/dist/apcaChecker.test.js +0 -124
  15. package/dist/axeRuleMappingHelper.js +0 -4
  16. package/dist/components/A11YPanel.js +0 -140
  17. package/dist/components/A11YPanel.stories.js +0 -198
  18. package/dist/components/A11YPanel.test.js +0 -110
  19. package/dist/components/A11yContext.js +0 -438
  20. package/dist/components/A11yContext.test.js +0 -277
  21. package/dist/components/Report/Details.js +0 -169
  22. package/dist/components/Report/Report.js +0 -106
  23. package/dist/components/Report/Report.stories.js +0 -86
  24. package/dist/components/Tabs.js +0 -54
  25. package/dist/components/TestDiscrepancyMessage.js +0 -55
  26. package/dist/components/TestDiscrepancyMessage.stories.js +0 -40
  27. package/dist/components/VisionSimulator.js +0 -83
  28. package/dist/components/VisionSimulator.stories.js +0 -56
  29. package/dist/constants.js +0 -25
  30. package/dist/manager.test.js +0 -86
  31. package/dist/params.js +0 -0
  32. package/dist/preview.test.js +0 -215
  33. package/dist/results.mock.js +0 -874
  34. package/dist/types.js +0 -6
  35. package/dist/utils.js +0 -21
  36. package/dist/withVisionSimulator.js +0 -41
package/dist/types.js DELETED
@@ -1,6 +0,0 @@
1
- const RuleType = {
2
- VIOLATION: 'violations',
3
- PASS: 'passes',
4
- INCOMPLETION: 'incomplete'
5
- };
6
- export { RuleType };
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 };