@storybook/addon-a11y 9.1.0-alpha.2 → 9.1.0-alpha.4

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 CHANGED
@@ -1,8 +1,6 @@
1
- import * as core_dist_types from 'storybook/internal/types';
1
+ import * as storybook_internal_csf from 'storybook/internal/csf';
2
2
  import { Selector, SelectorList, RunOptions, Spec } from 'axe-core';
3
3
 
4
- declare const PARAM_KEY = "a11y";
5
-
6
4
  type SelectorWithoutNode = Omit<Selector, 'Node'> | Omit<SelectorList, 'NodeList'>;
7
5
  type ContextObjectWithoutNode = {
8
6
  include: SelectorWithoutNode;
@@ -47,7 +45,29 @@ interface A11yParameters {
47
45
  */
48
46
  a11y?: A11yParameters$1;
49
47
  }
48
+ interface A11yGlobals {
49
+ /**
50
+ * Accessibility configuration
51
+ *
52
+ * @see https://storybook.js.org/docs/writing-tests/accessibility-testing
53
+ */
54
+ a11y?: {
55
+ /**
56
+ * Prevent the addon from executing automated accessibility checks upon visiting a story. You
57
+ * can still trigger the checks from the addon panel.
58
+ *
59
+ * @see https://storybook.js.org/docs/writing-tests/accessibility-testing#turn-off-automated-a11y-tests
60
+ */
61
+ manual?: boolean;
62
+ };
63
+ }
64
+ interface A11yTypes {
65
+ parameters: A11yParameters;
66
+ globals: A11yGlobals;
67
+ }
68
+
69
+ declare const PARAM_KEY = "a11y";
50
70
 
51
- declare const _default: () => core_dist_types.ProjectAnnotations<core_dist_types.Renderer>;
71
+ declare const _default: () => storybook_internal_csf.PreviewAddon<A11yTypes>;
52
72
 
53
- export { A11yParameters, ContextObjectWithoutNode, ContextSpecWithoutNode, PARAM_KEY, SelectorWithoutNode, _default as default };
73
+ export { A11yParameters$1 as A11yParameters, A11yTypes, ContextObjectWithoutNode, ContextSpecWithoutNode, PARAM_KEY, SelectorWithoutNode, _default as default };
package/dist/index.js CHANGED
@@ -2,10 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var previewApi = require('storybook/preview-api');
5
+ var csf = require('storybook/internal/csf');
6
6
  var test = require('storybook/test');
7
7
  var previewErrors = require('storybook/internal/preview-errors');
8
8
  var global = require('@storybook/global');
9
+ var previewApi = require('storybook/preview-api');
9
10
 
10
11
  var __defProp=Object.defineProperty;var __getOwnPropNames=Object.getOwnPropertyNames;var __esm=(fn,res)=>function(){return fn&&(res=(0, fn[__getOwnPropNames(fn)[0]])(fn=0)),res};var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0});};function assembleStyles(){let codes=new Map;for(let[groupName,group]of Object.entries(styles)){for(let[styleName,style]of Object.entries(group))styles[styleName]={open:`\x1B[${style[0]}m`,close:`\x1B[${style[1]}m`},group[styleName]=styles[styleName],codes.set(style[0],style[1]);Object.defineProperty(styles,groupName,{value:group,enumerable:!1});}return Object.defineProperty(styles,"codes",{value:codes,enumerable:!1}),styles.color.close="\x1B[39m",styles.bgColor.close="\x1B[49m",styles.color.ansi=wrapAnsi16(),styles.color.ansi256=wrapAnsi256(),styles.color.ansi16m=wrapAnsi16m(),styles.bgColor.ansi=wrapAnsi16(10),styles.bgColor.ansi256=wrapAnsi256(10),styles.bgColor.ansi16m=wrapAnsi16m(10),Object.defineProperties(styles,{rgbToAnsi256:{value(red,green,blue){return red===green&&green===blue?red<8?16:red>248?231:Math.round((red-8)/247*24)+232:16+36*Math.round(red/255*5)+6*Math.round(green/255*5)+Math.round(blue/255*5)},enumerable:!1},hexToRgb:{value(hex){let matches=/[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));if(!matches)return [0,0,0];let[colorString]=matches;colorString.length===3&&(colorString=[...colorString].map(character=>character+character).join(""));let integer=Number.parseInt(colorString,16);return [integer>>16&255,integer>>8&255,integer&255]},enumerable:!1},hexToAnsi256:{value:hex=>styles.rgbToAnsi256(...styles.hexToRgb(hex)),enumerable:!1},ansi256ToAnsi:{value(code){if(code<8)return 30+code;if(code<16)return 90+(code-8);let red,green,blue;if(code>=232)red=((code-232)*10+8)/255,green=red,blue=red;else {code-=16;let remainder=code%36;red=Math.floor(code/36)/5,green=Math.floor(remainder/6)/5,blue=remainder%6/5;}let value=Math.max(red,green,blue)*2;if(value===0)return 30;let result=30+(Math.round(blue)<<2|Math.round(green)<<1|Math.round(red));return value===2&&(result+=60),result},enumerable:!1},rgbToAnsi:{value:(red,green,blue)=>styles.ansi256ToAnsi(styles.rgbToAnsi256(red,green,blue)),enumerable:!1},hexToAnsi:{value:hex=>styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),enumerable:!1}}),styles}var wrapAnsi16,wrapAnsi256,wrapAnsi16m,styles,foregroundColorNames,backgroundColorNames,ansiStyles,ansi_styles_default,init_ansi_styles=__esm({"../../node_modules/vitest-axe/node_modules/chalk/source/vendor/ansi-styles/index.js"(){wrapAnsi16=(offset=0)=>code=>`\x1B[${code+offset}m`,wrapAnsi256=(offset=0)=>code=>`\x1B[${38+offset};5;${code}m`,wrapAnsi16m=(offset=0)=>(red,green,blue)=>`\x1B[${38+offset};2;${red};${green};${blue}m`,styles={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},Object.keys(styles.modifier),foregroundColorNames=Object.keys(styles.color),backgroundColorNames=Object.keys(styles.bgColor),[...foregroundColorNames,...backgroundColorNames];ansiStyles=assembleStyles(),ansi_styles_default=ansiStyles;}});var level,colorSupport,supportsColor,browser_default,init_browser=__esm({"../../node_modules/vitest-axe/node_modules/chalk/source/vendor/supports-color/browser.js"(){level=(()=>{if(!("navigator"in globalThis))return 0;if(globalThis.navigator.userAgentData){let brand=navigator.userAgentData.brands.find(({brand:brand2})=>brand2==="Chromium");if(brand&&brand.version>93)return 3}return /\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)?1:0})(),colorSupport=level!==0&&{level,hasBasic:!0,has256:level>=2,has16m:level>=3},supportsColor={stdout:colorSupport,stderr:colorSupport},browser_default=supportsColor;}});function stringReplaceAll(string,substring,replacer){let index=string.indexOf(substring);if(index===-1)return string;let substringLength=substring.length,endIndex=0,returnValue="";do returnValue+=string.slice(endIndex,index)+substring+replacer,endIndex=index+substringLength,index=string.indexOf(substring,endIndex);while(index!==-1);return returnValue+=string.slice(endIndex),returnValue}function stringEncaseCRLFWithFirstIndex(string,prefix,postfix,index){let endIndex=0,returnValue="";do{let gotCR=string[index-1]==="\r";returnValue+=string.slice(endIndex,gotCR?index-1:index)+prefix+(gotCR?`\r
11
12
  `:`
@@ -20,7 +21,7 @@ ${indentationNext}`)},{edgeSpacing:config.spacingOuter,min:config.min,spacing:co
20
21
  `;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:
21
22
  ${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")+`
22
23
 
23
- ${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,{afterEach:()=>afterEach,initialGlobals:()=>initialGlobals,parameters:()=>parameters});var ADDON_ID="storybook/a11y",PANEL_ID=`${ADDON_ID}/panel`,PARAM_KEY="a11y",RESULT=`${ADDON_ID}/result`,REQUEST=`${ADDON_ID}/request`,RUNNING=`${ADDON_ID}/running`,ERROR=`${ADDON_ID}/error`,MANUAL=`${ADDON_ID}/manual`,SELECT=`${ADDON_ID}/select`;var EVENTS={RESULT,REQUEST,RUNNING,ERROR,MANUAL,SELECT};var{document: document$1}=global.global,withLinkPaths=(results,storyId)=>{let pathname=document$1.location.pathname.replace(/iframe\.html$/,""),enhancedResults={...results};return ["incomplete","passes","violations"].forEach(key=>{Array.isArray(results[key])&&(enhancedResults[key]=results[key].map(result=>({...result,nodes:result.nodes.map((node,index)=>{let id=`${key}.${result.id}.${index+1}`,linkPath=`${pathname}?path=/story/${storyId}&addonPanel=${PANEL_ID}&a11ySelection=${id}`;return {id,...node,linkPath}})})));}),enhancedResults};var{document:document2}=global.global,channel=previewApi.addons.getChannel(),DEFAULT_PARAMETERS={config:{},options:{}},DISABLED_RULES=["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=DEFAULT_PARAMETERS,storyId)=>{let axe=(await import('axe-core'))?.default||globalThis.axe,{config={},options={}}=input;if(input.element)throw new previewErrors.ElementA11yParameterError;let context={include:document2?.body,exclude:[".sb-wrapper","#storybook-docs"]};if(input.context){let hasInclude=typeof input.context=="object"&&"include"in input.context&&input.context.include!==void 0,hasExclude=typeof input.context=="object"&&"exclude"in input.context&&input.context.exclude!==void 0;hasInclude?context.include=input.context.include:!hasInclude&&!hasExclude&&(context.include=input.context),hasExclude&&(context.exclude=context.exclude.concat(input.context.exclude));}axe.reset();let configWithDefault={...config,rules:[...DISABLED_RULES.map(id=>({id,enabled:!1})),...config?.rules??[]]};return axe.configure(configWithDefault),new Promise((resolve,reject)=>{let task=async()=>{try{let result=await axe.run(context,options),resultWithLinks=withLinkPaths(result,storyId);resolve(resultWithLinks);}catch(error){reject(error);}};queue.push(task),isRunning||runNext();})};channel.on(EVENTS.MANUAL,async(storyId,input=DEFAULT_PARAMETERS)=>{try{await previewApi.waitForAnimations();let result=await run(input,storyId),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,afterEach=async({id:storyId,reporting,parameters:parameters2,globals,viewMode})=>{let a11yParameter=parameters2.a11y,a11yGlobals=globals.a11y,shouldRunEnvironmentIndependent=a11yParameter?.disable!==!0&&a11yParameter?.test!=="off"&&a11yGlobals?.manual!==!0,getMode=()=>{switch(a11yParameter?.test){case"todo":return "warning";case"error":default:return "failed"}};if(shouldRunEnvironmentIndependent&&viewMode==="story")try{let result=await run(a11yParameter,storyId);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);
24
+ ${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,{afterEach:()=>afterEach,initialGlobals:()=>initialGlobals,parameters:()=>parameters});var ADDON_ID="storybook/a11y",PANEL_ID=`${ADDON_ID}/panel`,PARAM_KEY="a11y",RESULT=`${ADDON_ID}/result`,REQUEST=`${ADDON_ID}/request`,RUNNING=`${ADDON_ID}/running`,ERROR=`${ADDON_ID}/error`,MANUAL=`${ADDON_ID}/manual`,SELECT=`${ADDON_ID}/select`;var EVENTS={RESULT,REQUEST,RUNNING,ERROR,MANUAL,SELECT};var{document: document$1}=global.global,withLinkPaths=(results,storyId)=>{let pathname=document$1.location.pathname.replace(/iframe\.html$/,""),enhancedResults={...results};return ["incomplete","passes","violations"].forEach(key=>{Array.isArray(results[key])&&(enhancedResults[key]=results[key].map(result=>({...result,nodes:result.nodes.map((node,index)=>{let id=`${key}.${result.id}.${index+1}`,linkPath=`${pathname}?path=/story/${storyId}&addonPanel=${PANEL_ID}&a11ySelection=${id}`;return {id,...node,linkPath}})})));}),enhancedResults};var{document:document2}=global.global,channel=previewApi.addons.getChannel(),DEFAULT_PARAMETERS={config:{},options:{}},DISABLED_RULES=["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=DEFAULT_PARAMETERS,storyId)=>{let axe=(await import('axe-core'))?.default||globalThis.axe,{config={},options={}}=input;if(input.element)throw new previewErrors.ElementA11yParameterError;let context={include:document2?.body,exclude:[".sb-wrapper","#storybook-docs","#storybook-highlights-root"]};if(input.context){let hasInclude=typeof input.context=="object"&&"include"in input.context&&input.context.include!==void 0,hasExclude=typeof input.context=="object"&&"exclude"in input.context&&input.context.exclude!==void 0;hasInclude?context.include=input.context.include:!hasInclude&&!hasExclude&&(context.include=input.context),hasExclude&&(context.exclude=context.exclude.concat(input.context.exclude));}axe.reset();let configWithDefault={...config,rules:[...DISABLED_RULES.map(id=>({id,enabled:!1})),...config?.rules??[]]};return axe.configure(configWithDefault),new Promise((resolve,reject)=>{let highlightsRoot=document2?.getElementById("storybook-highlights-root");highlightsRoot&&(highlightsRoot.style.display="none");let task=async()=>{try{let result=await axe.run(context,options),resultWithLinks=withLinkPaths(result,storyId);resolve(resultWithLinks);}catch(error){reject(error);}};queue.push(task),isRunning||runNext(),highlightsRoot&&(highlightsRoot.style.display="");})};channel.on(EVENTS.MANUAL,async(storyId,input=DEFAULT_PARAMETERS)=>{try{await previewApi.waitForAnimations();let result=await run(input,storyId),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,afterEach=async({id:storyId,reporting,parameters:parameters2,globals,viewMode})=>{let a11yParameter=parameters2.a11y,a11yGlobals=globals.a11y,shouldRunEnvironmentIndependent=a11yParameter?.disable!==!0&&a11yParameter?.test!=="off"&&a11yGlobals?.manual!==!0,getMode=()=>{switch(a11yParameter?.test){case"todo":return "warning";case"error":default:return "failed"}};if(shouldRunEnvironmentIndependent&&viewMode==="story")try{let result=await run(a11yParameter,storyId);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=()=>csf.definePreviewAddon(preview_exports);
24
25
 
25
26
  exports.PARAM_KEY = PARAM_KEY;
26
27
  exports.default = index_default;
package/dist/index.mjs CHANGED
@@ -1,9 +1,10 @@
1
1
  import { __export } from './chunk-CEH6MNVV.mjs';
2
- import { addons, waitForAnimations, definePreview } from 'storybook/preview-api';
2
+ import { definePreviewAddon } from 'storybook/internal/csf';
3
3
  import { expect } from 'storybook/test';
4
4
  import { ElementA11yParameterError } from 'storybook/internal/preview-errors';
5
5
  import { global } from '@storybook/global';
6
+ import { addons, waitForAnimations } from 'storybook/preview-api';
6
7
 
7
- var preview_exports={};__export(preview_exports,{afterEach:()=>afterEach,initialGlobals:()=>initialGlobals,parameters:()=>parameters});var ADDON_ID="storybook/a11y",PANEL_ID=`${ADDON_ID}/panel`,PARAM_KEY="a11y",RESULT=`${ADDON_ID}/result`,REQUEST=`${ADDON_ID}/request`,RUNNING=`${ADDON_ID}/running`,ERROR=`${ADDON_ID}/error`,MANUAL=`${ADDON_ID}/manual`,SELECT=`${ADDON_ID}/select`;var EVENTS={RESULT,REQUEST,RUNNING,ERROR,MANUAL,SELECT};var{document}=global,withLinkPaths=(results,storyId)=>{let pathname=document.location.pathname.replace(/iframe\.html$/,""),enhancedResults={...results};return ["incomplete","passes","violations"].forEach(key=>{Array.isArray(results[key])&&(enhancedResults[key]=results[key].map(result=>({...result,nodes:result.nodes.map((node,index)=>{let id=`${key}.${result.id}.${index+1}`,linkPath=`${pathname}?path=/story/${storyId}&addonPanel=${PANEL_ID}&a11ySelection=${id}`;return {id,...node,linkPath}})})));}),enhancedResults};var{document:document2}=global,channel=addons.getChannel(),DEFAULT_PARAMETERS={config:{},options:{}},DISABLED_RULES=["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=DEFAULT_PARAMETERS,storyId)=>{let axe=(await import('axe-core'))?.default||globalThis.axe,{config={},options={}}=input;if(input.element)throw new ElementA11yParameterError;let context={include:document2?.body,exclude:[".sb-wrapper","#storybook-docs"]};if(input.context){let hasInclude=typeof input.context=="object"&&"include"in input.context&&input.context.include!==void 0,hasExclude=typeof input.context=="object"&&"exclude"in input.context&&input.context.exclude!==void 0;hasInclude?context.include=input.context.include:!hasInclude&&!hasExclude&&(context.include=input.context),hasExclude&&(context.exclude=context.exclude.concat(input.context.exclude));}axe.reset();let configWithDefault={...config,rules:[...DISABLED_RULES.map(id=>({id,enabled:!1})),...config?.rules??[]]};return axe.configure(configWithDefault),new Promise((resolve,reject)=>{let task=async()=>{try{let result=await axe.run(context,options),resultWithLinks=withLinkPaths(result,storyId);resolve(resultWithLinks);}catch(error){reject(error);}};queue.push(task),isRunning||runNext();})};channel.on(EVENTS.MANUAL,async(storyId,input=DEFAULT_PARAMETERS)=>{try{await waitForAnimations();let result=await run(input,storyId),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,afterEach=async({id:storyId,reporting,parameters:parameters2,globals,viewMode})=>{let a11yParameter=parameters2.a11y,a11yGlobals=globals.a11y,shouldRunEnvironmentIndependent=a11yParameter?.disable!==!0&&a11yParameter?.test!=="off"&&a11yGlobals?.manual!==!0,getMode=()=>{switch(a11yParameter?.test){case"todo":return "warning";case"error":default:return "failed"}};if(shouldRunEnvironmentIndependent&&viewMode==="story")try{let result=await run(a11yParameter,storyId);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-TIWVOQAP.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);
8
+ var preview_exports={};__export(preview_exports,{afterEach:()=>afterEach,initialGlobals:()=>initialGlobals,parameters:()=>parameters});var ADDON_ID="storybook/a11y",PANEL_ID=`${ADDON_ID}/panel`,PARAM_KEY="a11y",RESULT=`${ADDON_ID}/result`,REQUEST=`${ADDON_ID}/request`,RUNNING=`${ADDON_ID}/running`,ERROR=`${ADDON_ID}/error`,MANUAL=`${ADDON_ID}/manual`,SELECT=`${ADDON_ID}/select`;var EVENTS={RESULT,REQUEST,RUNNING,ERROR,MANUAL,SELECT};var{document}=global,withLinkPaths=(results,storyId)=>{let pathname=document.location.pathname.replace(/iframe\.html$/,""),enhancedResults={...results};return ["incomplete","passes","violations"].forEach(key=>{Array.isArray(results[key])&&(enhancedResults[key]=results[key].map(result=>({...result,nodes:result.nodes.map((node,index)=>{let id=`${key}.${result.id}.${index+1}`,linkPath=`${pathname}?path=/story/${storyId}&addonPanel=${PANEL_ID}&a11ySelection=${id}`;return {id,...node,linkPath}})})));}),enhancedResults};var{document:document2}=global,channel=addons.getChannel(),DEFAULT_PARAMETERS={config:{},options:{}},DISABLED_RULES=["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=DEFAULT_PARAMETERS,storyId)=>{let axe=(await import('axe-core'))?.default||globalThis.axe,{config={},options={}}=input;if(input.element)throw new ElementA11yParameterError;let context={include:document2?.body,exclude:[".sb-wrapper","#storybook-docs","#storybook-highlights-root"]};if(input.context){let hasInclude=typeof input.context=="object"&&"include"in input.context&&input.context.include!==void 0,hasExclude=typeof input.context=="object"&&"exclude"in input.context&&input.context.exclude!==void 0;hasInclude?context.include=input.context.include:!hasInclude&&!hasExclude&&(context.include=input.context),hasExclude&&(context.exclude=context.exclude.concat(input.context.exclude));}axe.reset();let configWithDefault={...config,rules:[...DISABLED_RULES.map(id=>({id,enabled:!1})),...config?.rules??[]]};return axe.configure(configWithDefault),new Promise((resolve,reject)=>{let highlightsRoot=document2?.getElementById("storybook-highlights-root");highlightsRoot&&(highlightsRoot.style.display="none");let task=async()=>{try{let result=await axe.run(context,options),resultWithLinks=withLinkPaths(result,storyId);resolve(resultWithLinks);}catch(error){reject(error);}};queue.push(task),isRunning||runNext(),highlightsRoot&&(highlightsRoot.style.display="");})};channel.on(EVENTS.MANUAL,async(storyId,input=DEFAULT_PARAMETERS)=>{try{await waitForAnimations();let result=await run(input,storyId),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,afterEach=async({id:storyId,reporting,parameters:parameters2,globals,viewMode})=>{let a11yParameter=parameters2.a11y,a11yGlobals=globals.a11y,shouldRunEnvironmentIndependent=a11yParameter?.disable!==!0&&a11yParameter?.test!=="off"&&a11yGlobals?.manual!==!0,getMode=()=>{switch(a11yParameter?.test){case"todo":return "warning";case"error":default:return "failed"}};if(shouldRunEnvironmentIndependent&&viewMode==="story")try{let result=await run(a11yParameter,storyId);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-TIWVOQAP.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=()=>definePreviewAddon(preview_exports);
8
9
 
9
10
  export { PARAM_KEY, index_default as default };
package/dist/preview.js CHANGED
@@ -18,7 +18,7 @@ ${indentationNext}`)},{edgeSpacing:config.spacingOuter,min:config.min,spacing:co
18
18
  `;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:
19
19
  ${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")+`
20
20
 
21
- ${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 ADDON_ID="storybook/a11y",PANEL_ID=`${ADDON_ID}/panel`;var RESULT=`${ADDON_ID}/result`,REQUEST=`${ADDON_ID}/request`,RUNNING=`${ADDON_ID}/running`,ERROR=`${ADDON_ID}/error`,MANUAL=`${ADDON_ID}/manual`,SELECT=`${ADDON_ID}/select`;var EVENTS={RESULT,REQUEST,RUNNING,ERROR,MANUAL,SELECT};var{document: document$1}=global.global,withLinkPaths=(results,storyId)=>{let pathname=document$1.location.pathname.replace(/iframe\.html$/,""),enhancedResults={...results};return ["incomplete","passes","violations"].forEach(key=>{Array.isArray(results[key])&&(enhancedResults[key]=results[key].map(result=>({...result,nodes:result.nodes.map((node,index)=>{let id=`${key}.${result.id}.${index+1}`,linkPath=`${pathname}?path=/story/${storyId}&addonPanel=${PANEL_ID}&a11ySelection=${id}`;return {id,...node,linkPath}})})));}),enhancedResults};var{document:document2}=global.global,channel=previewApi.addons.getChannel(),DEFAULT_PARAMETERS={config:{},options:{}},DISABLED_RULES=["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=DEFAULT_PARAMETERS,storyId)=>{let axe=(await import('axe-core'))?.default||globalThis.axe,{config={},options={}}=input;if(input.element)throw new previewErrors.ElementA11yParameterError;let context={include:document2?.body,exclude:[".sb-wrapper","#storybook-docs"]};if(input.context){let hasInclude=typeof input.context=="object"&&"include"in input.context&&input.context.include!==void 0,hasExclude=typeof input.context=="object"&&"exclude"in input.context&&input.context.exclude!==void 0;hasInclude?context.include=input.context.include:!hasInclude&&!hasExclude&&(context.include=input.context),hasExclude&&(context.exclude=context.exclude.concat(input.context.exclude));}axe.reset();let configWithDefault={...config,rules:[...DISABLED_RULES.map(id=>({id,enabled:!1})),...config?.rules??[]]};return axe.configure(configWithDefault),new Promise((resolve,reject)=>{let task=async()=>{try{let result=await axe.run(context,options),resultWithLinks=withLinkPaths(result,storyId);resolve(resultWithLinks);}catch(error){reject(error);}};queue.push(task),isRunning||runNext();})};channel.on(EVENTS.MANUAL,async(storyId,input=DEFAULT_PARAMETERS)=>{try{await previewApi.waitForAnimations();let result=await run(input,storyId),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,afterEach=async({id:storyId,reporting,parameters:parameters2,globals,viewMode})=>{let a11yParameter=parameters2.a11y,a11yGlobals=globals.a11y,shouldRunEnvironmentIndependent=a11yParameter?.disable!==!0&&a11yParameter?.test!=="off"&&a11yGlobals?.manual!==!0,getMode=()=>{switch(a11yParameter?.test){case"todo":return "warning";case"error":default:return "failed"}};if(shouldRunEnvironmentIndependent&&viewMode==="story")try{let result=await run(a11yParameter,storyId);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"}};
21
+ ${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 ADDON_ID="storybook/a11y",PANEL_ID=`${ADDON_ID}/panel`;var RESULT=`${ADDON_ID}/result`,REQUEST=`${ADDON_ID}/request`,RUNNING=`${ADDON_ID}/running`,ERROR=`${ADDON_ID}/error`,MANUAL=`${ADDON_ID}/manual`,SELECT=`${ADDON_ID}/select`;var EVENTS={RESULT,REQUEST,RUNNING,ERROR,MANUAL,SELECT};var{document: document$1}=global.global,withLinkPaths=(results,storyId)=>{let pathname=document$1.location.pathname.replace(/iframe\.html$/,""),enhancedResults={...results};return ["incomplete","passes","violations"].forEach(key=>{Array.isArray(results[key])&&(enhancedResults[key]=results[key].map(result=>({...result,nodes:result.nodes.map((node,index)=>{let id=`${key}.${result.id}.${index+1}`,linkPath=`${pathname}?path=/story/${storyId}&addonPanel=${PANEL_ID}&a11ySelection=${id}`;return {id,...node,linkPath}})})));}),enhancedResults};var{document:document2}=global.global,channel=previewApi.addons.getChannel(),DEFAULT_PARAMETERS={config:{},options:{}},DISABLED_RULES=["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=DEFAULT_PARAMETERS,storyId)=>{let axe=(await import('axe-core'))?.default||globalThis.axe,{config={},options={}}=input;if(input.element)throw new previewErrors.ElementA11yParameterError;let context={include:document2?.body,exclude:[".sb-wrapper","#storybook-docs","#storybook-highlights-root"]};if(input.context){let hasInclude=typeof input.context=="object"&&"include"in input.context&&input.context.include!==void 0,hasExclude=typeof input.context=="object"&&"exclude"in input.context&&input.context.exclude!==void 0;hasInclude?context.include=input.context.include:!hasInclude&&!hasExclude&&(context.include=input.context),hasExclude&&(context.exclude=context.exclude.concat(input.context.exclude));}axe.reset();let configWithDefault={...config,rules:[...DISABLED_RULES.map(id=>({id,enabled:!1})),...config?.rules??[]]};return axe.configure(configWithDefault),new Promise((resolve,reject)=>{let highlightsRoot=document2?.getElementById("storybook-highlights-root");highlightsRoot&&(highlightsRoot.style.display="none");let task=async()=>{try{let result=await axe.run(context,options),resultWithLinks=withLinkPaths(result,storyId);resolve(resultWithLinks);}catch(error){reject(error);}};queue.push(task),isRunning||runNext(),highlightsRoot&&(highlightsRoot.style.display="");})};channel.on(EVENTS.MANUAL,async(storyId,input=DEFAULT_PARAMETERS)=>{try{await previewApi.waitForAnimations();let result=await run(input,storyId),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,afterEach=async({id:storyId,reporting,parameters:parameters2,globals,viewMode})=>{let a11yParameter=parameters2.a11y,a11yGlobals=globals.a11y,shouldRunEnvironmentIndependent=a11yParameter?.disable!==!0&&a11yParameter?.test!=="off"&&a11yGlobals?.manual!==!0,getMode=()=>{switch(a11yParameter?.test){case"todo":return "warning";case"error":default:return "failed"}};if(shouldRunEnvironmentIndependent&&viewMode==="story")try{let result=await run(a11yParameter,storyId);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"}};
22
22
 
23
23
  exports.afterEach = afterEach;
24
24
  exports.initialGlobals = initialGlobals;
package/dist/preview.mjs CHANGED
@@ -3,6 +3,6 @@ import { ElementA11yParameterError } from 'storybook/internal/preview-errors';
3
3
  import { global } from '@storybook/global';
4
4
  import { addons, waitForAnimations } from 'storybook/preview-api';
5
5
 
6
- var ADDON_ID="storybook/a11y",PANEL_ID=`${ADDON_ID}/panel`;var RESULT=`${ADDON_ID}/result`,REQUEST=`${ADDON_ID}/request`,RUNNING=`${ADDON_ID}/running`,ERROR=`${ADDON_ID}/error`,MANUAL=`${ADDON_ID}/manual`,SELECT=`${ADDON_ID}/select`;var EVENTS={RESULT,REQUEST,RUNNING,ERROR,MANUAL,SELECT};var{document}=global,withLinkPaths=(results,storyId)=>{let pathname=document.location.pathname.replace(/iframe\.html$/,""),enhancedResults={...results};return ["incomplete","passes","violations"].forEach(key=>{Array.isArray(results[key])&&(enhancedResults[key]=results[key].map(result=>({...result,nodes:result.nodes.map((node,index)=>{let id=`${key}.${result.id}.${index+1}`,linkPath=`${pathname}?path=/story/${storyId}&addonPanel=${PANEL_ID}&a11ySelection=${id}`;return {id,...node,linkPath}})})));}),enhancedResults};var{document:document2}=global,channel=addons.getChannel(),DEFAULT_PARAMETERS={config:{},options:{}},DISABLED_RULES=["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=DEFAULT_PARAMETERS,storyId)=>{let axe=(await import('axe-core'))?.default||globalThis.axe,{config={},options={}}=input;if(input.element)throw new ElementA11yParameterError;let context={include:document2?.body,exclude:[".sb-wrapper","#storybook-docs"]};if(input.context){let hasInclude=typeof input.context=="object"&&"include"in input.context&&input.context.include!==void 0,hasExclude=typeof input.context=="object"&&"exclude"in input.context&&input.context.exclude!==void 0;hasInclude?context.include=input.context.include:!hasInclude&&!hasExclude&&(context.include=input.context),hasExclude&&(context.exclude=context.exclude.concat(input.context.exclude));}axe.reset();let configWithDefault={...config,rules:[...DISABLED_RULES.map(id=>({id,enabled:!1})),...config?.rules??[]]};return axe.configure(configWithDefault),new Promise((resolve,reject)=>{let task=async()=>{try{let result=await axe.run(context,options),resultWithLinks=withLinkPaths(result,storyId);resolve(resultWithLinks);}catch(error){reject(error);}};queue.push(task),isRunning||runNext();})};channel.on(EVENTS.MANUAL,async(storyId,input=DEFAULT_PARAMETERS)=>{try{await waitForAnimations();let result=await run(input,storyId),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,afterEach=async({id:storyId,reporting,parameters:parameters2,globals,viewMode})=>{let a11yParameter=parameters2.a11y,a11yGlobals=globals.a11y,shouldRunEnvironmentIndependent=a11yParameter?.disable!==!0&&a11yParameter?.test!=="off"&&a11yGlobals?.manual!==!0,getMode=()=>{switch(a11yParameter?.test){case"todo":return "warning";case"error":default:return "failed"}};if(shouldRunEnvironmentIndependent&&viewMode==="story")try{let result=await run(a11yParameter,storyId);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-7Z3WT2CE.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"}};
6
+ var ADDON_ID="storybook/a11y",PANEL_ID=`${ADDON_ID}/panel`;var RESULT=`${ADDON_ID}/result`,REQUEST=`${ADDON_ID}/request`,RUNNING=`${ADDON_ID}/running`,ERROR=`${ADDON_ID}/error`,MANUAL=`${ADDON_ID}/manual`,SELECT=`${ADDON_ID}/select`;var EVENTS={RESULT,REQUEST,RUNNING,ERROR,MANUAL,SELECT};var{document}=global,withLinkPaths=(results,storyId)=>{let pathname=document.location.pathname.replace(/iframe\.html$/,""),enhancedResults={...results};return ["incomplete","passes","violations"].forEach(key=>{Array.isArray(results[key])&&(enhancedResults[key]=results[key].map(result=>({...result,nodes:result.nodes.map((node,index)=>{let id=`${key}.${result.id}.${index+1}`,linkPath=`${pathname}?path=/story/${storyId}&addonPanel=${PANEL_ID}&a11ySelection=${id}`;return {id,...node,linkPath}})})));}),enhancedResults};var{document:document2}=global,channel=addons.getChannel(),DEFAULT_PARAMETERS={config:{},options:{}},DISABLED_RULES=["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=DEFAULT_PARAMETERS,storyId)=>{let axe=(await import('axe-core'))?.default||globalThis.axe,{config={},options={}}=input;if(input.element)throw new ElementA11yParameterError;let context={include:document2?.body,exclude:[".sb-wrapper","#storybook-docs","#storybook-highlights-root"]};if(input.context){let hasInclude=typeof input.context=="object"&&"include"in input.context&&input.context.include!==void 0,hasExclude=typeof input.context=="object"&&"exclude"in input.context&&input.context.exclude!==void 0;hasInclude?context.include=input.context.include:!hasInclude&&!hasExclude&&(context.include=input.context),hasExclude&&(context.exclude=context.exclude.concat(input.context.exclude));}axe.reset();let configWithDefault={...config,rules:[...DISABLED_RULES.map(id=>({id,enabled:!1})),...config?.rules??[]]};return axe.configure(configWithDefault),new Promise((resolve,reject)=>{let highlightsRoot=document2?.getElementById("storybook-highlights-root");highlightsRoot&&(highlightsRoot.style.display="none");let task=async()=>{try{let result=await axe.run(context,options),resultWithLinks=withLinkPaths(result,storyId);resolve(resultWithLinks);}catch(error){reject(error);}};queue.push(task),isRunning||runNext(),highlightsRoot&&(highlightsRoot.style.display="");})};channel.on(EVENTS.MANUAL,async(storyId,input=DEFAULT_PARAMETERS)=>{try{await waitForAnimations();let result=await run(input,storyId),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,afterEach=async({id:storyId,reporting,parameters:parameters2,globals,viewMode})=>{let a11yParameter=parameters2.a11y,a11yGlobals=globals.a11y,shouldRunEnvironmentIndependent=a11yParameter?.disable!==!0&&a11yParameter?.test!=="off"&&a11yGlobals?.manual!==!0,getMode=()=>{switch(a11yParameter?.test){case"todo":return "warning";case"error":default:return "failed"}};if(shouldRunEnvironmentIndependent&&viewMode==="story")try{let result=await run(a11yParameter,storyId);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-7Z3WT2CE.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"}};
7
7
 
8
8
  export { afterEach, initialGlobals, parameters };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/addon-a11y",
3
- "version": "9.1.0-alpha.2",
3
+ "version": "9.1.0-alpha.4",
4
4
  "description": "Test component compliance with web accessibility standards",
5
5
  "keywords": [
6
6
  "a11y",
@@ -81,7 +81,7 @@
81
81
  "vitest-axe": "^0.1.0"
82
82
  },
83
83
  "peerDependencies": {
84
- "storybook": "^9.1.0-alpha.2"
84
+ "storybook": "^9.1.0-alpha.4"
85
85
  },
86
86
  "publishConfig": {
87
87
  "access": "public"