@storybook/addon-a11y 8.6.0-beta.1 → 8.6.0-beta.10
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.ts +1 -2
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +4 -4
- package/preview.js +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as core_dist_types from 'storybook/internal/types';
|
|
2
|
-
import * as _storybook_core_csf from '@storybook/core/csf';
|
|
3
2
|
import { ElementContext, Spec, RunOptions } from 'axe-core';
|
|
4
3
|
|
|
5
4
|
declare const PARAM_KEY = "a11y";
|
|
@@ -36,6 +35,6 @@ interface A11yParameters {
|
|
|
36
35
|
};
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
declare const _default: () => core_dist_types.ProjectAnnotations<
|
|
38
|
+
declare const _default: () => core_dist_types.ProjectAnnotations<core_dist_types.Renderer>;
|
|
40
39
|
|
|
41
40
|
export { A11yParameters, PARAM_KEY, Setup, _default as default };
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ ${indentationNext}`)},{edgeSpacing:config.spacingOuter,min:config.min,spacing:co
|
|
|
19
19
|
`;return violations2.map(violation=>violation.nodes.map(node=>`Expected the HTML found at $('${node.target.join(", ")}') to have no violations:`+lineBreak+source_default.grey(node.html)+lineBreak+"Received:"+lineBreak+printReceived(`${violation.help} (${violation.id})`)+lineBreak+source_default.yellow(node.failureSummary)+lineBreak+(violation.helpUrl?`You can find more information on this issue here:
|
|
20
20
|
${source_default.blue(violation.helpUrl)}`:"")).join(lineBreak)).join(lineBreak+"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"+lineBreak)}let formatedViolations=reporter(violations),pass=formatedViolations.length===0;function message(){if(!pass)return matcherHint(".toHaveNoViolations")+`
|
|
21
21
|
|
|
22
|
-
${formatedViolations}`}return {actual:violations,message,pass}}function filterViolations(violations,impactLevels){return impactLevels&&impactLevels.length>0?violations.filter(v=>impactLevels.includes(v.impact)):violations}var init_matchers=__esm({"../../node_modules/vitest-axe/dist/matchers.js"(){init_chunk_X4FZIUYL();init_source();}});var matchers_exports={};__export(matchers_exports,{toHaveNoViolations:()=>toHaveNoViolations});var init_matchers2=__esm({"../../node_modules/vitest-axe/matchers.js"(){init_matchers();}});var preview_exports={};__export(preview_exports,{experimental_afterEach:()=>experimental_afterEach,initialGlobals:()=>initialGlobals,parameters:()=>parameters});var ADDON_ID="storybook/a11y",PARAM_KEY="a11y",RESULT=`${ADDON_ID}/result`,REQUEST=`${ADDON_ID}/request`,RUNNING=`${ADDON_ID}/running`,ERROR=`${ADDON_ID}/error`,MANUAL=`${ADDON_ID}/manual`;var EVENTS={RESULT,REQUEST,RUNNING,ERROR,MANUAL};var{document: document$1}=global.global,channel=previewApi.addons.getChannel(),defaultParameters={config:{},options:{}},disabledRules=["region"],queue=[],isRunning=!1,runNext=async()=>{if(queue.length===0){isRunning=!1;return}isRunning=!0;let next=queue.shift();next&&await next(),runNext();},run=async(input=defaultParameters)=>{let{default:axe}=await import('axe-core'),{element="body",config={},options={}}=input,htmlElement=document$1.querySelector(element)??document$1.body;if(!htmlElement)return;axe.reset();let configWithDefault={...config,rules:[...disabledRules.map(id=>({id,enabled:!1})),...config?.rules??[]]};return axe.configure(configWithDefault),new Promise((resolve,reject)=>{let task=async()=>{try{let result=await axe.run(htmlElement,options);resolve(result);}catch(error){reject(error);}};queue.push(task),isRunning||runNext();})};channel.on(EVENTS.MANUAL,async(storyId,input=defaultParameters)=>{try{let result=await run(input),resultJson=JSON.parse(JSON.stringify(result));channel.emit(EVENTS.RESULT,resultJson,storyId);}catch(error){channel.emit(EVENTS.ERROR,error);}});function getIsVitestStandaloneRun(){try{return undefined.VITEST_STORYBOOK==="false"}catch{return !1}}var vitestMatchersExtended=!1,experimental_afterEach=async({reporting,parameters:parameters2,globals})=>{let a11yParameter=parameters2.a11y,a11yGlobals=globals.a11y,shouldRunEnvironmentIndependent=a11yParameter?.manual!==!0&&a11yParameter?.disable!==!0&&a11yParameter?.test!=="off"&&a11yGlobals?.manual!==!0,getMode=()=>{switch(a11yParameter?.test){case"todo":return "warning";case"error":default:return "failed"}};if(shouldRunEnvironmentIndependent)try{let result=await run(a11yParameter);if(result){let hasViolations=(result?.violations.length??0)>0;if(reporting.addReport({type:"a11y",version:1,result,status:hasViolations?getMode():"passed"}),getIsVitestStandaloneRun()&&hasViolations&&getMode()==="failed"){if(!vitestMatchersExtended){let{toHaveNoViolations:toHaveNoViolations2}=await Promise.resolve().then(()=>(init_matchers2(),matchers_exports));test.expect.extend({toHaveNoViolations:toHaveNoViolations2}),vitestMatchersExtended=!0;}test.expect(result).toHaveNoViolations();}}}catch(e){if(reporting.addReport({type:"a11y",version:1,result:{error:e},status:"failed"}),getIsVitestStandaloneRun())throw e}},initialGlobals={a11y:{manual:!1}},parameters={a11y:{test:"todo"}};var
|
|
22
|
+
${formatedViolations}`}return {actual:violations,message,pass}}function filterViolations(violations,impactLevels){return impactLevels&&impactLevels.length>0?violations.filter(v=>impactLevels.includes(v.impact)):violations}var init_matchers=__esm({"../../node_modules/vitest-axe/dist/matchers.js"(){init_chunk_X4FZIUYL();init_source();}});var matchers_exports={};__export(matchers_exports,{toHaveNoViolations:()=>toHaveNoViolations});var init_matchers2=__esm({"../../node_modules/vitest-axe/matchers.js"(){init_matchers();}});var preview_exports={};__export(preview_exports,{experimental_afterEach:()=>experimental_afterEach,initialGlobals:()=>initialGlobals,parameters:()=>parameters});var ADDON_ID="storybook/a11y",PARAM_KEY="a11y",RESULT=`${ADDON_ID}/result`,REQUEST=`${ADDON_ID}/request`,RUNNING=`${ADDON_ID}/running`,ERROR=`${ADDON_ID}/error`,MANUAL=`${ADDON_ID}/manual`;var EVENTS={RESULT,REQUEST,RUNNING,ERROR,MANUAL};var{document: document$1}=global.global,channel=previewApi.addons.getChannel(),defaultParameters={config:{},options:{}},disabledRules=["region"],queue=[],isRunning=!1,runNext=async()=>{if(queue.length===0){isRunning=!1;return}isRunning=!0;let next=queue.shift();next&&await next(),runNext();},run=async(input=defaultParameters)=>{let{default:axe}=await import('axe-core'),{element="body",config={},options={}}=input,htmlElement=document$1.querySelector(element)??document$1.body;if(!htmlElement)return;axe.reset();let configWithDefault={...config,rules:[...disabledRules.map(id=>({id,enabled:!1})),...config?.rules??[]]};return axe.configure(configWithDefault),new Promise((resolve,reject)=>{let task=async()=>{try{let result=await axe.run(htmlElement,options);resolve(result);}catch(error){reject(error);}};queue.push(task),isRunning||runNext();})};channel.on(EVENTS.MANUAL,async(storyId,input=defaultParameters)=>{try{let result=await run(input),resultJson=JSON.parse(JSON.stringify(result));channel.emit(EVENTS.RESULT,resultJson,storyId);}catch(error){channel.emit(EVENTS.ERROR,error);}});function getIsVitestStandaloneRun(){try{return undefined.VITEST_STORYBOOK==="false"}catch{return !1}}var vitestMatchersExtended=!1,experimental_afterEach=async({reporting,parameters:parameters2,globals})=>{let a11yParameter=parameters2.a11y,a11yGlobals=globals.a11y,shouldRunEnvironmentIndependent=a11yParameter?.manual!==!0&&a11yParameter?.disable!==!0&&a11yParameter?.test!=="off"&&a11yGlobals?.manual!==!0,getMode=()=>{switch(a11yParameter?.test){case"todo":return "warning";case"error":default:return "failed"}};if(shouldRunEnvironmentIndependent)try{let result=await run(a11yParameter);if(result){let hasViolations=(result?.violations.length??0)>0;if(reporting.addReport({type:"a11y",version:1,result,status:hasViolations?getMode():"passed"}),getIsVitestStandaloneRun()&&hasViolations&&getMode()==="failed"){if(!vitestMatchersExtended){let{toHaveNoViolations:toHaveNoViolations2}=await Promise.resolve().then(()=>(init_matchers2(),matchers_exports));test.expect.extend({toHaveNoViolations:toHaveNoViolations2}),vitestMatchersExtended=!0;}test.expect(result).toHaveNoViolations();}}}catch(e){if(reporting.addReport({type:"a11y",version:1,result:{error:e},status:"failed"}),getIsVitestStandaloneRun())throw e}},initialGlobals={a11y:{manual:!1}},parameters={a11y:{test:"todo"}};var index_default=()=>previewApi.definePreview(preview_exports);
|
|
23
23
|
|
|
24
24
|
exports.PARAM_KEY = PARAM_KEY;
|
|
25
|
-
exports.default =
|
|
25
|
+
exports.default = index_default;
|
package/dist/index.mjs
CHANGED
|
@@ -3,6 +3,6 @@ import { addons, definePreview } from 'storybook/internal/preview-api';
|
|
|
3
3
|
import { expect } from '@storybook/test';
|
|
4
4
|
import { global } from '@storybook/global';
|
|
5
5
|
|
|
6
|
-
var preview_exports={};__export(preview_exports,{experimental_afterEach:()=>experimental_afterEach,initialGlobals:()=>initialGlobals,parameters:()=>parameters});var ADDON_ID="storybook/a11y",PARAM_KEY="a11y",RESULT=`${ADDON_ID}/result`,REQUEST=`${ADDON_ID}/request`,RUNNING=`${ADDON_ID}/running`,ERROR=`${ADDON_ID}/error`,MANUAL=`${ADDON_ID}/manual`;var EVENTS={RESULT,REQUEST,RUNNING,ERROR,MANUAL};var{document}=global,channel=addons.getChannel(),defaultParameters={config:{},options:{}},disabledRules=["region"],queue=[],isRunning=!1,runNext=async()=>{if(queue.length===0){isRunning=!1;return}isRunning=!0;let next=queue.shift();next&&await next(),runNext();},run=async(input=defaultParameters)=>{let{default:axe}=await import('axe-core'),{element="body",config={},options={}}=input,htmlElement=document.querySelector(element)??document.body;if(!htmlElement)return;axe.reset();let configWithDefault={...config,rules:[...disabledRules.map(id=>({id,enabled:!1})),...config?.rules??[]]};return axe.configure(configWithDefault),new Promise((resolve,reject)=>{let task=async()=>{try{let result=await axe.run(htmlElement,options);resolve(result);}catch(error){reject(error);}};queue.push(task),isRunning||runNext();})};channel.on(EVENTS.MANUAL,async(storyId,input=defaultParameters)=>{try{let result=await run(input),resultJson=JSON.parse(JSON.stringify(result));channel.emit(EVENTS.RESULT,resultJson,storyId);}catch(error){channel.emit(EVENTS.ERROR,error);}});function getIsVitestStandaloneRun(){try{return import.meta.env.VITEST_STORYBOOK==="false"}catch{return !1}}var vitestMatchersExtended=!1,experimental_afterEach=async({reporting,parameters:parameters2,globals})=>{let a11yParameter=parameters2.a11y,a11yGlobals=globals.a11y,shouldRunEnvironmentIndependent=a11yParameter?.manual!==!0&&a11yParameter?.disable!==!0&&a11yParameter?.test!=="off"&&a11yGlobals?.manual!==!0,getMode=()=>{switch(a11yParameter?.test){case"todo":return "warning";case"error":default:return "failed"}};if(shouldRunEnvironmentIndependent)try{let result=await run(a11yParameter);if(result){let hasViolations=(result?.violations.length??0)>0;if(reporting.addReport({type:"a11y",version:1,result,status:hasViolations?getMode():"passed"}),getIsVitestStandaloneRun()&&hasViolations&&getMode()==="failed"){if(!vitestMatchersExtended){let{toHaveNoViolations}=await import('./matchers-K6QHBOFC.mjs');expect.extend({toHaveNoViolations}),vitestMatchersExtended=!0;}expect(result).toHaveNoViolations();}}}catch(e){if(reporting.addReport({type:"a11y",version:1,result:{error:e},status:"failed"}),getIsVitestStandaloneRun())throw e}},initialGlobals={a11y:{manual:!1}},parameters={a11y:{test:"todo"}};var
|
|
6
|
+
var preview_exports={};__export(preview_exports,{experimental_afterEach:()=>experimental_afterEach,initialGlobals:()=>initialGlobals,parameters:()=>parameters});var ADDON_ID="storybook/a11y",PARAM_KEY="a11y",RESULT=`${ADDON_ID}/result`,REQUEST=`${ADDON_ID}/request`,RUNNING=`${ADDON_ID}/running`,ERROR=`${ADDON_ID}/error`,MANUAL=`${ADDON_ID}/manual`;var EVENTS={RESULT,REQUEST,RUNNING,ERROR,MANUAL};var{document}=global,channel=addons.getChannel(),defaultParameters={config:{},options:{}},disabledRules=["region"],queue=[],isRunning=!1,runNext=async()=>{if(queue.length===0){isRunning=!1;return}isRunning=!0;let next=queue.shift();next&&await next(),runNext();},run=async(input=defaultParameters)=>{let{default:axe}=await import('axe-core'),{element="body",config={},options={}}=input,htmlElement=document.querySelector(element)??document.body;if(!htmlElement)return;axe.reset();let configWithDefault={...config,rules:[...disabledRules.map(id=>({id,enabled:!1})),...config?.rules??[]]};return axe.configure(configWithDefault),new Promise((resolve,reject)=>{let task=async()=>{try{let result=await axe.run(htmlElement,options);resolve(result);}catch(error){reject(error);}};queue.push(task),isRunning||runNext();})};channel.on(EVENTS.MANUAL,async(storyId,input=defaultParameters)=>{try{let result=await run(input),resultJson=JSON.parse(JSON.stringify(result));channel.emit(EVENTS.RESULT,resultJson,storyId);}catch(error){channel.emit(EVENTS.ERROR,error);}});function getIsVitestStandaloneRun(){try{return import.meta.env.VITEST_STORYBOOK==="false"}catch{return !1}}var vitestMatchersExtended=!1,experimental_afterEach=async({reporting,parameters:parameters2,globals})=>{let a11yParameter=parameters2.a11y,a11yGlobals=globals.a11y,shouldRunEnvironmentIndependent=a11yParameter?.manual!==!0&&a11yParameter?.disable!==!0&&a11yParameter?.test!=="off"&&a11yGlobals?.manual!==!0,getMode=()=>{switch(a11yParameter?.test){case"todo":return "warning";case"error":default:return "failed"}};if(shouldRunEnvironmentIndependent)try{let result=await run(a11yParameter);if(result){let hasViolations=(result?.violations.length??0)>0;if(reporting.addReport({type:"a11y",version:1,result,status:hasViolations?getMode():"passed"}),getIsVitestStandaloneRun()&&hasViolations&&getMode()==="failed"){if(!vitestMatchersExtended){let{toHaveNoViolations}=await import('./matchers-K6QHBOFC.mjs');expect.extend({toHaveNoViolations}),vitestMatchersExtended=!0;}expect(result).toHaveNoViolations();}}}catch(e){if(reporting.addReport({type:"a11y",version:1,result:{error:e},status:"failed"}),getIsVitestStandaloneRun())throw e}},initialGlobals={a11y:{manual:!1}},parameters={a11y:{test:"todo"}};var index_default=()=>definePreview(preview_exports);
|
|
7
7
|
|
|
8
|
-
export { PARAM_KEY,
|
|
8
|
+
export { PARAM_KEY, index_default as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-a11y",
|
|
3
|
-
"version": "8.6.0-beta.
|
|
3
|
+
"version": "8.6.0-beta.10",
|
|
4
4
|
"description": "Test component compliance with web accessibility standards",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"a11y",
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"prep": "jiti ../../../scripts/prepare/addon-bundle.ts"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@storybook/addon-highlight": "8.6.0-beta.
|
|
70
|
-
"@storybook/test": "8.6.0-beta.
|
|
69
|
+
"@storybook/addon-highlight": "8.6.0-beta.10",
|
|
70
|
+
"@storybook/test": "8.6.0-beta.10",
|
|
71
71
|
"axe-core": "^4.2.0"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"vitest-axe": "^0.1.0"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
|
-
"storybook": "^8.6.0-beta.
|
|
88
|
+
"storybook": "^8.6.0-beta.10"
|
|
89
89
|
},
|
|
90
90
|
"publishConfig": {
|
|
91
91
|
"access": "public"
|
package/preview.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export * from './dist/preview';
|