aria-ease 6.12.2 → 7.0.0
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/AccordionComponentStrategy-2SWMNUR6.js +1 -0
- package/dist/ComboboxComponentStrategy-YSYLR2U5.js +5 -0
- package/dist/MenuComponentStrategy-C22BZEBH.js +5 -0
- package/dist/RelativeTargetResolver-T4P25J2M.js +1 -0
- package/dist/TabsComponentStrategy-ADEEFJXM.js +1 -0
- package/dist/audit-APAPHXRO.js +9 -0
- package/dist/badgeHelper-IB5RTMAG.js +11 -0
- package/dist/badgeHelper-JSROP5ML.js +1 -0
- package/dist/buildContracts-T4XQZBDU.js +13 -0
- package/dist/chunk-52I3INNG.js +11 -0
- package/dist/chunk-APUMBDOT.js +1 -0
- package/dist/chunk-BHNO4ZI3.js +1 -0
- package/dist/chunk-CNU4N4AY.js +1 -0
- package/dist/chunk-SM6ZKEDR.js +1 -0
- package/dist/chunk-ZNQ5BXVJ.js +1 -0
- package/dist/cli.cjs +132 -3494
- package/dist/cli.js +19 -161
- package/dist/configLoader-ZEJVXLX7.js +1 -0
- package/dist/configLoader-ZXTSCIP6.js +1 -0
- package/dist/contractTestRunnerPlaywright-FOCQTM4L.js +46 -0
- package/dist/contractTestRunnerPlaywright-QPU6HZXG.js +46 -0
- package/dist/formatters-H3CPDLG5.js +87 -0
- package/dist/index.cjs +64 -4657
- package/dist/index.d.cts +23 -2
- package/dist/index.d.ts +23 -2
- package/dist/index.js +17 -2351
- package/dist/src/accordion/index.cjs +1 -183
- package/dist/src/accordion/index.js +1 -181
- package/dist/src/block/index.cjs +1 -124
- package/dist/src/block/index.js +1 -122
- package/dist/src/checkbox/index.cjs +1 -109
- package/dist/src/checkbox/index.js +1 -107
- package/dist/src/combobox/index.cjs +1 -265
- package/dist/src/combobox/index.js +1 -263
- package/dist/src/menu/index.cjs +1 -339
- package/dist/src/menu/index.js +1 -337
- package/dist/src/radio/index.cjs +1 -117
- package/dist/src/radio/index.js +1 -115
- package/dist/src/tabs/index.cjs +1 -265
- package/dist/src/tabs/index.js +1 -263
- package/dist/src/toggle/index.cjs +1 -119
- package/dist/src/toggle/index.js +1 -117
- package/dist/src/utils/test/AccordionComponentStrategy-X2GSQ5KT.js +1 -0
- package/dist/src/utils/test/ComboboxComponentStrategy-SICWLI27.js +5 -0
- package/dist/src/utils/test/MenuComponentStrategy-R4VPAHDE.js +5 -0
- package/dist/src/utils/test/RelativeTargetResolver-UQQMZHI6.js +1 -0
- package/dist/src/utils/test/TabsComponentStrategy-L2PYNEW6.js +1 -0
- package/dist/src/utils/test/badgeHelper-ER5ZOHWF.js +11 -0
- package/dist/src/utils/test/chunk-APUMBDOT.js +1 -0
- package/dist/src/utils/test/chunk-BHNO4ZI3.js +1 -0
- package/dist/src/utils/test/configLoader-NCYRL2O6.js +1 -0
- package/dist/src/utils/test/contractTestRunnerPlaywright-YZCMF64Q.js +46 -0
- package/dist/src/utils/test/dsl/index.cjs +1 -486
- package/dist/src/utils/test/dsl/index.d.cts +21 -0
- package/dist/src/utils/test/dsl/index.d.ts +21 -0
- package/dist/src/utils/test/dsl/index.js +1 -484
- package/dist/src/utils/test/index.cjs +64 -2578
- package/dist/src/utils/test/index.d.cts +2 -2
- package/dist/src/utils/test/index.d.ts +2 -2
- package/dist/src/utils/test/index.js +16 -340
- package/dist/test-VXSCSKV5.js +19 -0
- package/package.json +7 -9
- package/dist/AccordionComponentStrategy-4ZEIQ2V6.js +0 -42
- package/dist/ComboboxComponentStrategy-DU342VMB.js +0 -64
- package/dist/MenuComponentStrategy-JAMTCSNF.js +0 -81
- package/dist/RelativeTargetResolver-DJAITO6D.js +0 -7
- package/dist/TabsComponentStrategy-3SQURPMX.js +0 -29
- package/dist/audit-JYEPKLHR.js +0 -63
- package/dist/badgeHelper-JOWO6RQG.js +0 -15
- package/dist/badgeHelper-RDOMCC6E.js +0 -108
- package/dist/buildContracts-FT6KWUJN.js +0 -465
- package/dist/chunk-4DU5Z5BR.js +0 -340
- package/dist/chunk-GJGUY643.js +0 -182
- package/dist/chunk-GLT43UVH.js +0 -43
- package/dist/chunk-I2KLQ2HA.js +0 -22
- package/dist/chunk-JJEPLK7L.js +0 -107
- package/dist/chunk-PK5L2SAF.js +0 -17
- package/dist/configLoader-Q7N5XV4P.js +0 -183
- package/dist/configLoader-REHK3S3Q.js +0 -7
- package/dist/contractTestRunnerPlaywright-47DCBO4A.js +0 -1300
- package/dist/contractTestRunnerPlaywright-UJKXRXBS.js +0 -1300
- package/dist/formatters-32KQIIYS.js +0 -183
- package/dist/src/utils/test/AccordionComponentStrategy-WRHZOEN6.js +0 -38
- package/dist/src/utils/test/ComboboxComponentStrategy-XKQ72RFD.js +0 -60
- package/dist/src/utils/test/MenuComponentStrategy-VKZQYLBE.js +0 -77
- package/dist/src/utils/test/RelativeTargetResolver-G2XDN2VV.js +0 -1
- package/dist/src/utils/test/TabsComponentStrategy-BKG53SEV.js +0 -26
- package/dist/src/utils/test/badgeHelper-HZKGOPB4.js +0 -102
- package/dist/src/utils/test/chunk-4DU5Z5BR.js +0 -332
- package/dist/src/utils/test/chunk-GLT43UVH.js +0 -41
- package/dist/src/utils/test/configLoader-NA7IBCS3.js +0 -181
- package/dist/src/utils/test/contractTestRunnerPlaywright-AZ4QKLYT.js +0 -1278
- package/dist/test-6Y4CIQOM.js +0 -358
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o}from"./chunk-SM6ZKEDR.js";import"./chunk-CNU4N4AY.js";var n=class{constructor(t,e,i=400,s=400){this.mainSelector=t;this.selectors=e;this.actionTimeoutMs=i;this.assertionTimeoutMs=s}async resetState(t){if(!this.selectors.panel||!this.selectors.trigger||this.selectors.popup)return;let e=this.selectors.trigger,i=this.selectors.panel;if(!e||!i)return;let s=await t.locator(e).all();for(let r of s){let c=await r.getAttribute("aria-expanded")==="true",a=await r.getAttribute("aria-controls");if(c&&a){await r.click({timeout:this.actionTimeoutMs});let l=t.locator(`#${a}`);await(0,o.expect)(l).toBeHidden({timeout:this.assertionTimeoutMs}).catch(()=>{})}}}async shouldSkipTest(){return!1}getMainSelector(){return this.mainSelector}};export{n as AccordionComponentStrategy};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as i}from"./chunk-SM6ZKEDR.js";import"./chunk-CNU4N4AY.js";var n=class{constructor(t,r,o=400,c=400){this.mainSelector=t;this.selectors=r;this.actionTimeoutMs=o;this.assertionTimeoutMs=c}async resetState(t){if(!this.selectors.popup)return;let r=this.selectors.popup,o=t.locator(r).first();if(!await o.isVisible().catch(()=>!1))return;let e=!1,s=this.selectors.input;if(!s&&this.selectors.focusable?s=this.selectors.focusable:s||(s=this.selectors.button),s&&(await t.locator(s).first().focus(),await t.keyboard.press("Escape"),e=await(0,i.expect)(o).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),!e&&this.selectors.button&&(await t.locator(this.selectors.button).first().click({timeout:this.actionTimeoutMs}),e=await(0,i.expect)(o).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),e||(await t.mouse.click(10,10),e=await(0,i.expect)(o).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),!e)throw new Error(`\u274C FATAL: Cannot close combobox popup between tests. Popup remains visible after trying:
|
|
2
|
+
1. Escape key
|
|
3
|
+
2. Clicking button
|
|
4
|
+
3. Clicking outside
|
|
5
|
+
This indicates a problem with the combobox component's close functionality.`);this.selectors.input&&await t.locator(this.selectors.input).first().clear()}async shouldSkipTest(){return!1}getMainSelector(){return this.mainSelector}};export{n as ComboboxComponentStrategy};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as r}from"./chunk-SM6ZKEDR.js";import"./chunk-CNU4N4AY.js";var c=class{constructor(t,o,i=400,n=400){this.mainSelector=t;this.selectors=o;this.actionTimeoutMs=i;this.assertionTimeoutMs=n}async resetState(t){if(!this.selectors.popup)return;let o=this.selectors.popup,i=t.locator(o).first();if(!await i.isVisible().catch(()=>!1))return;let s=!1,e=this.selectors.input;if(!e&&this.selectors.focusable?e=this.selectors.focusable:e||(e=this.selectors.main),e&&(await t.locator(e).first().focus(),await t.keyboard.press("Escape"),s=await(0,r.expect)(i).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),!s&&this.selectors.main&&(await t.locator(this.selectors.main).first().click({timeout:this.actionTimeoutMs}),s=await(0,r.expect)(i).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),s||(await t.mouse.click(10,10),s=await(0,r.expect)(i).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>!0).catch(()=>!1)),!s)throw new Error(`\u274C FATAL: Cannot close menu between tests. Menu remains visible after trying:
|
|
2
|
+
1. Escape key
|
|
3
|
+
2. Clicking trigger
|
|
4
|
+
3. Clicking outside
|
|
5
|
+
This indicates a problem with the menu component's close functionality.`);this.selectors.input&&await t.locator(this.selectors.input).first().clear(),this.selectors.main&&await t.locator(this.selectors.main).first().focus()}async shouldSkipTest(t,o){if(!(t.action.some(e=>e.target==="submenu"||e.target==="submenuTrigger"||e.target==="submenuItems")||t.assertions.some(e=>e.target==="submenu"||e.target==="submenuTrigger"||e.target==="submenuItems")))return!1;let n=this.selectors.submenuTrigger;return n?await o.locator(n).count()===0:!0}getMainSelector(){return this.mainSelector}};export{c as MenuComponentStrategy};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-BHNO4ZI3.js";import"./chunk-CNU4N4AY.js";export{a as RelativeTargetResolver};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-CNU4N4AY.js";var i=class{constructor(t,e){this.mainSelector=t;this.selectors=e}async resetState(){}async shouldSkipTest(t,e){if(t.isVertical!==void 0&&this.selectors.tablist){let r=this.selectors.tablist,o=await e.locator(r).first().getAttribute("aria-orientation")==="vertical";if(t.isVertical!==o)return!0}return!1}getMainSelector(){return this.mainSelector}};export{i as TabsComponentStrategy};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import"./chunk-CNU4N4AY.js";import d from"@axe-core/playwright";import{chromium as s}from"playwright";async function b(){return await s.launch({headless:!0})}async function h(a,l){let o=l.browser,i=!1,n=6e4,c="domcontentloaded";try{o||(o=await s.launch({headless:!0}),i=!0);let e=await o.newContext(),r=await e.newPage();await r.goto(a,{waitUntil:c,timeout:n});try{await r.waitForSelector("main",{state:"visible",timeout:n})}catch(t){console.warn(`\u26A0\uFE0F Warning: <main> landmark not found or not visible on ${a} after ${n}ms. Audit will continue, but results may be inaccurate. Consider adding a <main> element to improve audit accuracy. ${t instanceof Error?t.message:String(t)}`)}let u=await new d({page:r}).analyze();return await r.close(),await e.close(),u}catch(e){throw e instanceof Error?e.message.includes("Executable doesn't exist")?(console.error(`
|
|
2
|
+
\u274C Playwright browsers not found!
|
|
3
|
+
`),console.log("\u{1F4E6} First-time setup required:"),console.log(` Run: npx playwright install chromium
|
|
4
|
+
`),console.log("\u{1F4A1} This downloads the browser needed for auditing (~200MB)"),console.log(` You only need to do this once.
|
|
5
|
+
`)):e.message.includes("page.goto: net::ERR_CONNECTION_REFUSED")?(console.error(`
|
|
6
|
+
\u274C Server Not Running!
|
|
7
|
+
`),console.log(" Make sure your server is running before auditing URL"),console.log(" Run: npm run dev # or your start command")):e.message.includes("page.goto: Protocol error (Page.navigate): Cannot navigate to invalid URL")?console.error(`
|
|
8
|
+
\u274C Cannot audit invalid URL
|
|
9
|
+
`):(console.error("\u274C Audit error:",e.message),console.log(" Make sure you provide a valid URL")):console.error("\u274C Audit error (non-Error):",String(e)),e}finally{o&&i&&await o.close()}}export{b as createAuditBrowser,h as runAudit};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import"./chunk-CNU4N4AY.js";import l from"fs-extra";import f from"path";import e from"chalk";import y from"readline";var g={audit:{type:"audit",fileName:"audited-by-aria-ease.svg",label:"Audited by aria-ease",markdownUrl:"https://cdn.jsdelivr.net/gh/aria-ease/aria-ease@main/badges/audited-by-aria-ease.svg"},component:{type:"component",fileName:"components-tested-aria-ease.svg",label:"Components tested: aria-ease",markdownUrl:"https://cdn.jsdelivr.net/gh/aria-ease/aria-ease@main/badges/components-tested-aria-ease.svg"},verified:{type:"verified",fileName:"verified-by-aria-ease.svg",label:"Verified by aria-ease",markdownUrl:"https://cdn.jsdelivr.net/gh/aria-ease/aria-ease@main/badges/verified-by-aria-ease.svg"}};function d(t){let i=g[t];return`[](https://github.com/aria-ease/aria-ease)`}function B(t){let i=d(t);console.log(e.cyan(`
|
|
2
|
+
\u{1F3C5} Show your accessibility commitment!`)),console.log(e.white(` Add this badge to your README.md:
|
|
3
|
+
`)),console.log(e.green(" "+i)),console.log(e.dim(`
|
|
4
|
+
This helps others discover accessibility tools and shows you care!
|
|
5
|
+
`))}async function E(t,i=process.cwd()){let s=f.join(i,"README.md");if(!await l.pathExists(s)){console.log(e.yellow(" \u2139\uFE0F No README.md found in current directory"));return}let a=await l.readFile(s,"utf-8"),n=d(t);if(a.includes(n)||a.includes(g[t].fileName)){console.log(e.gray(" \u2713 Badge already in README.md"));return}let o=y.createInterface({input:process.stdin,output:process.stdout}),c=await new Promise(m=>{o.question(e.cyan(" Add badge to README.md now? (y/n): "),p=>{o.close(),m(p.toLowerCase().trim())})});c==="y"||c==="yes"?(await u(s,a,n),console.log(e.green(" \u2713 Badge added to README.md!"))):console.log(e.gray(" Skipped. You can add it manually anytime."))}async function u(t,i,s){let r=i.split(`
|
|
6
|
+
`),a=0;for(let n=0;n<r.length;n++){let o=r[n].trim();if(o.startsWith("[![")||o.startsWith("[!")){a=n+1;continue}if(a>0&&!o.startsWith("[![")&&!o.startsWith("[!")&&o.length>0)break;if(a===0&&o.startsWith("#")){a=n+2;break}}a===0&&(a=1),r.splice(a,0,s),await l.writeFile(t,r.join(`
|
|
7
|
+
`),"utf-8")}function A(){console.log(e.cyan(`
|
|
8
|
+
\u{1F4CD} Available badges:`)),console.log(e.white(`
|
|
9
|
+
For audits:`)),console.log(e.green(" "+d("audit"))),console.log(e.white(`
|
|
10
|
+
For component testing:`)),console.log(e.green(" "+d("component"))),console.log(e.white(`
|
|
11
|
+
For both (verified):`)),console.log(e.green(" "+d("verified"))),console.log("")}export{g as BADGE_CONFIGS,A as displayAllBadges,B as displayBadgeInfo,d as getBadgeMarkdown,E as promptAddBadge};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e}from"./chunk-52I3INNG.js";import"./chunk-CNU4N4AY.js";export{a as BADGE_CONFIGS,e as displayAllBadges,c as displayBadgeInfo,b as getBadgeMarkdown,d as promptAddBadge};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import"./chunk-CNU4N4AY.js";import g from"path";import v from"fs-extra";import{glob as q}from"fs/promises";import l from"chalk";function E(f){let e=[];if(!f||typeof f!="object")return{valid:!1,errors:[{path:"$",message:"Contract must be an object"}]};let r=f;if(!r.selectors)e.push({path:"$.selectors",message:"selectors is required"});else if(typeof r.selectors!="object"||r.selectors===null||Array.isArray(r.selectors))e.push({path:"$.selectors",message:"selectors must be an object"});else{let o=r.selectors;Object.entries(o).forEach(([s,a])=>{typeof a!="string"&&e.push({path:`$.selectors['${s}']`,message:"All selectors must be strings"})})}return Array.isArray(r.static)?r.static.forEach((o,s)=>{if(typeof o!="object"||o===null){e.push({path:`$.static[${s}]`,message:"static item must be an object"});return}let a=o;if(!Array.isArray(a.assertions)){e.push({path:`$.static[${s}].assertions`,message:"assertions must be an array"});return}a.assertions.forEach((n,i)=>{if(typeof n!="object"||n===null){e.push({path:`$.static[${s}].assertions[${i}]`,message:"assertion must be an object"});return}let t=n;typeof t.target!="string"&&e.push({path:`$.static[${s}].assertions[${i}].target`,message:"target is required and must be a string"}),typeof t.attribute!="string"&&e.push({path:`$.static[${s}].assertions[${i}].attribute`,message:"attribute is required and must be a string"}),typeof t.failureMessage!="string"&&e.push({path:`$.static[${s}].assertions[${i}].failureMessage`,message:"failureMessage is required and must be a string"}),t.level!==void 0&&!["required","recommended","optional"].includes(t.level)&&e.push({path:`$.static[${s}].assertions[${i}].level`,message:"level must be one of: required, recommended, optional"})})}):e.push({path:"$.static",message:"static must be an array"}),Array.isArray(r.dynamic)?r.dynamic.forEach((o,s)=>{if(typeof o!="object"||o===null){e.push({path:`$.dynamic[${s}]`,message:"dynamic item must be an object"});return}let a=o;typeof a.description!="string"&&e.push({path:`$.dynamic[${s}].description`,message:"description is required and must be a string"}),Array.isArray(a.action)?a.action.forEach((n,i)=>{if(typeof n!="object"||n===null){e.push({path:`$.dynamic[${s}].action[${i}]`,message:"action item must be an object"});return}let t=n;typeof t.type!="string"&&e.push({path:`$.dynamic[${s}].action[${i}].type`,message:"type is required and must be a string"}),typeof t.target!="string"&&e.push({path:`$.dynamic[${s}].action[${i}].target`,message:"target is required and must be a string"})}):e.push({path:`$.dynamic[${s}].action`,message:"action is required and must be an array"}),Array.isArray(a.assertions)?a.assertions.forEach((n,i)=>{if(typeof n!="object"||n===null){e.push({path:`$.dynamic[${s}].assertions[${i}]`,message:"assertion must be an object"});return}let t=n;typeof t.target!="string"&&e.push({path:`$.dynamic[${s}].assertions[${i}].target`,message:"target is required and must be a string"}),typeof t.assertion!="string"&&e.push({path:`$.dynamic[${s}].assertions[${i}].assertion`,message:"assertion is required and must be a string"}),t.level!==void 0&&!["required","recommended","optional"].includes(t.level)&&e.push({path:`$.dynamic[${s}].assertions[${i}].level`,message:"level must be one of: required, recommended, optional"})}):e.push({path:`$.dynamic[${s}].assertions`,message:"assertions is required and must be an array"})}):e.push({path:"$.dynamic",message:"dynamic must be an array"}),r.relationships!==void 0&&(Array.isArray(r.relationships)?r.relationships.forEach((o,s)=>{if(typeof o!="object"||o===null){e.push({path:`$.relationships[${s}]`,message:"relationship must be an object"});return}let a=o,n=a.type;["aria-reference","contains"].includes(n)||e.push({path:`$.relationships[${s}].type`,message:"type must be one of: aria-reference, contains"}),n==="aria-reference"?(typeof a.from!="string"&&e.push({path:`$.relationships[${s}].from`,message:"from is required for aria-reference and must be a string"}),typeof a.attribute!="string"&&e.push({path:`$.relationships[${s}].attribute`,message:"attribute is required for aria-reference and must be a string"}),typeof a.to!="string"&&e.push({path:`$.relationships[${s}].to`,message:"to is required for aria-reference and must be a string"})):n==="contains"&&(typeof a.parent!="string"&&e.push({path:`$.relationships[${s}].parent`,message:"parent is required for contains and must be a string"}),typeof a.child!="string"&&e.push({path:`$.relationships[${s}].child`,message:"child is required for contains and must be a string"}))}):e.push({path:"$.relationships",message:"relationships must be an array"})),{valid:e.length===0,errors:e}}function R(f,e){let r=[];if(!f||typeof f!="object")return r;let s=f.relationships;return Array.isArray(s)&&s.forEach((a,n)=>{let i=a.type;if(i==="aria-reference"){let t=a.from,c=a.to;t&&!e.has(t)&&r.push({path:`$.relationships[${n}].from`,message:`Selector '${t}' not found in selectors`}),c&&!e.has(c)&&r.push({path:`$.relationships[${n}].to`,message:`Selector '${c}' not found in selectors`})}else if(i==="contains"){let t=a.parent,c=a.child;t&&!e.has(t)&&r.push({path:`$.relationships[${n}].parent`,message:`Selector '${t}' not found in selectors`}),c&&!e.has(c)&&r.push({path:`$.relationships[${n}].child`,message:`Selector '${c}' not found in selectors`})}}),r}function k(f,e){let r=[];if(!f||typeof f!="object")return r;let o=f,s=o.static;Array.isArray(s)&&s.forEach((n,i)=>{let t=n.assertions;Array.isArray(t)&&t.forEach((c,h)=>{let p=c.target;p&&!e.has(p)&&r.push({path:`$.static[${i}].assertions[${h}].target`,message:`Selector '${p}' not found in selectors`})})});let a=o.dynamic;return Array.isArray(a)&&a.forEach((n,i)=>{let t=n.action;Array.isArray(t)&&t.forEach((h,p)=>{let u=h.target;u&&u!=="document"&&!e.has(u)&&r.push({path:`$.dynamic[${i}].action[${p}].target`,message:`Selector '${u}' not found in selectors (or use 'document')`})});let c=n.assertions;Array.isArray(c)&&c.forEach((h,p)=>{let u=h.target;u&&u!=="relative"&&!e.has(u)&&r.push({path:`$.dynamic[${i}].assertions[${p}].target`,message:`Selector '${u}' not found in selectors (or use 'relative')`})})}),r}async function F(f,e){let r=[],o=[];if(!e.contracts||e.contracts.length===0)return console.log(l.yellow('\u2139\uFE0F No contracts configured. Add "contracts" array to ariaease.config.js')),{success:!0,built:o,errors:r};try{console.log(l.cyanBright(`
|
|
2
|
+
\u{1F3D7}\uFE0F Building contracts...
|
|
3
|
+
`));for(let s of e.contracts){let a=g.resolve(f,s.src),n=s.out?g.resolve(f,s.out):void 0;console.log(l.gray(` Pattern: ${s.src}`)),console.log(n?l.gray(` Output: ${s.out}
|
|
4
|
+
`):l.gray(` Output: Same directory as source
|
|
5
|
+
`));let i=[];for await(let t of q(a,{cwd:f}))i.push(t);if(i.length===0){console.log(l.yellow(`\u26A0\uFE0F No contract files found matching pattern: ${s.src}`));continue}n&&await v.ensureDir(n);for(let t of i)try{let c=t.startsWith("/")?t:g.resolve(f,t),h=await import(`file://${c}`),p=h.default;if(!p){let d=Object.entries(h).find(([,m])=>m&&typeof m=="object"&&"toJSON"in m);d&&(p=d[1])}if(!p||typeof p.toJSON!="function"){r.push(`${g.basename(t)}: No contract with toJSON() method found`);continue}let u=p.toJSON(),A=E(u);if(!A.valid){let m=`Schema validation failed:
|
|
6
|
+
${A.errors.map($=>` ${l.red("\u2717")} ${$.path}: ${$.message}`).join(`
|
|
7
|
+
`)}`;r.push(`${g.basename(t)}: ${m}`),console.log(l.red(`\u274C ${g.basename(t)}`)),console.log(l.red(` ${m}`));continue}let y=new Set;if(u&&typeof u=="object"&&"selectors"in u){let d=u.selectors;Object.keys(d).forEach(m=>y.add(m))}let j=[...R(u,y),...k(u,y)];if(j.length>0){let m=`Reference validation failed:
|
|
8
|
+
${j.map($=>` ${l.red("\u2717")} ${$.path}: ${$.message}`).join(`
|
|
9
|
+
`)}`;r.push(`${g.basename(t)}: ${m}`),console.log(l.red(`\u274C ${g.basename(t)}`)),console.log(l.red(` ${m}`));continue}let w=g.basename(t,g.extname(t)),b=n?g.join(n,`${w}.json`):g.join(g.dirname(c),`${w}.json`);await v.writeFile(b,JSON.stringify(u,null,2)+`
|
|
10
|
+
`,"utf-8");let S=g.relative(f,b);o.push(S),console.log(l.green(`\u2705 ${g.basename(t)} \u2192 ${g.basename(b)}`))}catch(c){let h=c instanceof Error?c.message:String(c),p=g.basename(t);r.push(`${p}: ${h}`),console.log(l.red(`\u274C ${p}`)),console.log(l.red(` Error: ${h}`))}}return console.log(""),r.length===0?(console.log(l.green(`\u2705 Built ${o.length} contract${o.length!==1?"s":""} successfully
|
|
11
|
+
`)),{success:!0,built:o,errors:r}):(console.log(l.yellow(`\u26A0\uFE0F Built ${o.length} contracts with ${r.length} error${r.length!==1?"s":""}
|
|
12
|
+
`)),{success:!1,built:o,errors:r})}catch(s){let n=`Failed to build contracts: ${s instanceof Error?s.message:String(s)}`;return r.push(n),console.log(l.red(`\u274C ${n}
|
|
13
|
+
`)),{success:!1,built:o,errors:r}}}export{F as buildContracts};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import l from"fs-extra";import f from"path";import e from"chalk";import y from"readline";var g={audit:{type:"audit",fileName:"audited-by-aria-ease.svg",label:"Audited by aria-ease",markdownUrl:"https://cdn.jsdelivr.net/gh/aria-ease/aria-ease@main/badges/audited-by-aria-ease.svg"},component:{type:"component",fileName:"components-tested-aria-ease.svg",label:"Components tested: aria-ease",markdownUrl:"https://cdn.jsdelivr.net/gh/aria-ease/aria-ease@main/badges/components-tested-aria-ease.svg"},verified:{type:"verified",fileName:"verified-by-aria-ease.svg",label:"Verified by aria-ease",markdownUrl:"https://cdn.jsdelivr.net/gh/aria-ease/aria-ease@main/badges/verified-by-aria-ease.svg"}};function d(t){let i=g[t];return`[](https://github.com/aria-ease/aria-ease)`}function B(t){let i=d(t);console.log(e.cyan(`
|
|
2
|
+
\u{1F3C5} Show your accessibility commitment!`)),console.log(e.white(` Add this badge to your README.md:
|
|
3
|
+
`)),console.log(e.green(" "+i)),console.log(e.dim(`
|
|
4
|
+
This helps others discover accessibility tools and shows you care!
|
|
5
|
+
`))}async function E(t,i=process.cwd()){let s=f.join(i,"README.md");if(!await l.pathExists(s)){console.log(e.yellow(" \u2139\uFE0F No README.md found in current directory"));return}let a=await l.readFile(s,"utf-8"),n=d(t);if(a.includes(n)||a.includes(g[t].fileName)){console.log(e.gray(" \u2713 Badge already in README.md"));return}let o=y.createInterface({input:process.stdin,output:process.stdout}),c=await new Promise(m=>{o.question(e.cyan(" Add badge to README.md now? (y/n): "),p=>{o.close(),m(p.toLowerCase().trim())})});c==="y"||c==="yes"?(await u(s,a,n),console.log(e.green(" \u2713 Badge added to README.md!"))):console.log(e.gray(" Skipped. You can add it manually anytime."))}async function u(t,i,s){let r=i.split(`
|
|
6
|
+
`),a=0;for(let n=0;n<r.length;n++){let o=r[n].trim();if(o.startsWith("[![")||o.startsWith("[!")){a=n+1;continue}if(a>0&&!o.startsWith("[![")&&!o.startsWith("[!")&&o.length>0)break;if(a===0&&o.startsWith("#")){a=n+2;break}}a===0&&(a=1),r.splice(a,0,s),await l.writeFile(t,r.join(`
|
|
7
|
+
`),"utf-8")}function A(){console.log(e.cyan(`
|
|
8
|
+
\u{1F4CD} Available badges:`)),console.log(e.white(`
|
|
9
|
+
For audits:`)),console.log(e.green(" "+d("audit"))),console.log(e.white(`
|
|
10
|
+
For component testing:`)),console.log(e.green(" "+d("component"))),console.log(e.white(`
|
|
11
|
+
For both (verified):`)),console.log(e.green(" "+d("verified"))),console.log("")}export{g as a,d as b,B as c,E as d,A as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{chromium as t}from"playwright";var r=null,o=null;async function i(){return r||(r=await t.launch({headless:!0,args:["--disable-extensions","--disable-blink-features=AutomationControlled"]})),r}async function a(){return o||(o=await(await i()).newContext({permissions:[],ignoreHTTPSErrors:!0})),o}async function p(){return await(await a()).newPage()}async function w(){o&&(await o.close(),o=null),r&&(await r.close(),r=null)}var c="required";function f(e){return e==="required"||e==="recommended"||e==="optional"?e:c}function g(e){return e==="minimal"||e==="balanced"||e==="strict"||e==="paranoid"?e:"balanced"}function C(e,n){return{minimal:{required:"error",recommended:"ignore",optional:"ignore"},balanced:{required:"error",recommended:"warning",optional:"ignore"},strict:{required:"error",recommended:"error",optional:"warning"},paranoid:{required:"error",recommended:"error",optional:"error"}}[n][e]}export{p as a,w as b,f as c,g as d,C as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var a=class{static async resolve(t,n,c){let e=await t.locator(n).all();switch(c){case"first":return e[0];case"second":return e[1];case"last":return e[e.length-1];case"next":{let r=(await t.evaluate(([s])=>Array.from(document.querySelectorAll(s)).indexOf(document.activeElement),[n])+1)%e.length;return e[r]}case"previous":{let r=(await t.evaluate(([s])=>Array.from(document.querySelectorAll(s)).indexOf(document.activeElement),[n])-1+e.length)%e.length;return e[r]}default:return null}}};export{a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var g=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var k=(b,a)=>{for(var c in a)g(b,c,{get:a[c],enumerable:!0})},f=(b,a,c,e)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of i(a))!j.call(b,d)&&d!==c&&g(b,d,{get:()=>a[d],enumerable:!(e=h(a,d))||e.enumerable});return b},l=(b,a,c)=>(f(b,a,"default"),c&&f(c,a,"default"));export{k as a,l as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,b as r}from"./chunk-CNU4N4AY.js";var o={};e(o,{default:()=>f});r(o,t);import*as t from"playwright/test";import{default as f}from"playwright/test";export{o as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import f from"path";import c from"fs-extra";function l(o){let e=[];if(!o||typeof o!="object")return e.push("Config must be an object"),{valid:!1,errors:e};let t=o;if(t.audit!==void 0){if(typeof t.audit!="object"||t.audit===null)e.push("audit must be an object");else if(t.audit.urls!==void 0&&(Array.isArray(t.audit.urls)?t.audit.urls.some(n=>typeof n!="string")&&e.push("audit.urls must contain only strings"):e.push("audit.urls must be an array")),t.audit.output!==void 0)if(typeof t.audit.output!="object")e.push("audit.output must be an object");else{let n=t.audit.output;n.format!==void 0&&(["json","csv","html","all"].includes(n.format)||e.push("audit.output.format must be one of: json, csv, html, all")),n.out!==void 0&&typeof n.out!="string"&&e.push("audit.output.out must be a string")}}if(t.test!==void 0)if(typeof t.test!="object"||t.test===null)e.push("test must be an object");else{t.test.disableTimeouts!==void 0&&typeof t.test.disableTimeouts!="boolean"&&e.push("test.disableTimeouts must be a boolean when provided");let n=["actionTimeoutMs","assertionTimeoutMs","navigationTimeoutMs","componentReadyTimeoutMs"];for(let s of n){let i=t.test[s];i!==void 0&&(typeof i!="number"||!Number.isFinite(i)||i<0)&&e.push(`test.${s} must be a non-negative number when provided`)}t.test.components!==void 0&&(Array.isArray(t.test.components)?t.test.components.forEach((s,i)=>{if(typeof s!="object"||s===null)e.push(`test.components[${i}] must be an object`);else{typeof s.name!="string"&&e.push(`test.components[${i}].name must be a string`),s.contractPath!==void 0&&typeof s.contractPath!="string"&&e.push(`test.components[${i}].contractPath must be a string when provided`),s.strategyPath!==void 0&&typeof s.strategyPath!="string"&&e.push(`test.components[${i}].strategyPath must be a string when provided`),s.strictness!==void 0&&!["minimal","balanced","strict","paranoid"].includes(s.strictness)&&e.push(`test.components[${i}].strictness must be one of: minimal, balanced, strict, paranoid`),s.disableTimeouts!==void 0&&typeof s.disableTimeouts!="boolean"&&e.push(`test.components[${i}].disableTimeouts must be a boolean when provided`);let u=["actionTimeoutMs","assertionTimeoutMs","navigationTimeoutMs","componentReadyTimeoutMs"];for(let r of u){let a=s[r];a!==void 0&&(typeof a!="number"||!Number.isFinite(a)||a<0)&&e.push(`test.components[${i}].${r} must be a non-negative number when provided`)}}}):e.push("test.components must be an array")),t.test.strictness!==void 0&&(["minimal","balanced","strict","paranoid"].includes(t.test.strictness)||e.push("test.strictness must be one of: minimal, balanced, strict, paranoid"))}return t.contracts!==void 0&&(Array.isArray(t.contracts)?t.contracts.forEach((n,s)=>{typeof n!="object"||n===null?e.push(`contracts[${s}] must be an object`):(typeof n.src!="string"&&e.push(`contracts[${s}].src is required and must be a string`),n.out!==void 0&&typeof n.out!="string"&&e.push(`contracts[${s}].out must be a string`))}):e.push("contracts must be an array")),{valid:e.length===0,errors:e}}async function d(o){try{let e=f.extname(o);if(e===".json"){let t=await c.readFile(o,"utf-8");return JSON.parse(t)}else if([".js",".mjs",".cjs",".ts"].includes(e)){let t=await import(o);return t.default||t}return null}catch{return null}}async function b(o=process.cwd()){let e=["ariaease.config.js","ariaease.config.mjs","ariaease.config.cjs","ariaease.config.json","ariaease.config.ts"],t=null,n=null,s=[];for(let i of e){let u=f.resolve(o,i);if(await c.pathExists(u)){if(n=u,t=await d(u),t===null){s.push(`Found config at ${i} but failed to load it. Check for syntax errors.`);continue}let r=l(t);if(!r.valid){s.push(`Config validation failed in ${i}:`),s.push(...r.errors.map(a=>` - ${a}`)),t=null;continue}break}}return{config:t||{},configPath:t?n:null,errors:s}}export{b as a};
|