aria-ease 2.2.1 → 2.2.2

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/README.md CHANGED
@@ -39,7 +39,7 @@ const toggleMenuDisplay = () => {
39
39
  };
40
40
  ```
41
41
 
42
- [Check out more features/functionality in the docs](https://ariaease.web.app/docs)
42
+ [Check out more features/functionality in the docs](https://ariaease.site/docs)
43
43
 
44
44
  [Start contributing on GitHub](https://github.com/aria-ease/aria-ease)
45
45
 
package/bin/audit-cli.cjs CHANGED
@@ -421,8 +421,8 @@ function runAudit(url) {
421
421
  _state.trys.push([
422
422
  0,
423
423
  6,
424
- ,
425
- 7
424
+ 7,
425
+ 10
426
426
  ]);
427
427
  return [
428
428
  4,
@@ -467,18 +467,22 @@ function runAudit(url) {
467
467
  ];
468
468
  case 6:
469
469
  error = _state.sent();
470
- if (_instanceof1(error, Error) && error.message.includes("Executable doesn't exist")) {
471
- console.error("\n\u274C Playwright browsers not found!\n");
472
- console.log("\uD83D\uDCE6 First-time setup required:");
473
- console.log(" Run: npx playwright install chromium\n");
474
- console.log("\uD83D\uDCA1 This downloads the browser needed for auditing (~200MB)");
475
- console.log(" You only need to do this once.\n");
470
+ if (_instanceof1(error, Error)) {
471
+ if (error.message.includes("Executable doesn't exist")) {
472
+ console.error("\n\u274C Playwright browsers not found!\n");
473
+ console.log("\uD83D\uDCE6 First-time setup required:");
474
+ console.log(" Run: npx playwright install chromium\n");
475
+ console.log("\uD83D\uDCA1 This downloads the browser needed for auditing (~200MB)");
476
+ console.log(" You only need to do this once.\n");
477
+ } else if (error.message.includes("page.goto: net::ERR_CONNECTION_REFUSED")) {
478
+ console.error("\n\u274C Server Not Running!\n");
479
+ console.log(" Make sure your server is running before auditing URL");
480
+ console.log(" Run: npm run dev # or your start command");
481
+ }
476
482
  process.exit(1);
477
483
  }
478
- return [
479
- 3,
480
- 7
481
- ];
484
+ console.error("Error during audit:", error);
485
+ throw error;
482
486
  case 7:
483
487
  if (!browser) return [
484
488
  3,
@@ -492,6 +496,10 @@ function runAudit(url) {
492
496
  _state.sent();
493
497
  _state.label = 9;
494
498
  case 9:
499
+ return [
500
+ 7
501
+ ];
502
+ case 10:
495
503
  return [
496
504
  2
497
505
  ];
@@ -609,7 +617,7 @@ var program = new import_commander.Command();
609
617
  program.name("aria-ease").description("Run accessibility tests and audits").version("2.1.1");
610
618
  program.command("audit").description("Run axe-core powered accessibility audit on webpages").option("-u, --url <url>", "Single URL to audit").option("-f, --format <format>", "Output format for the audit report: json | csv | html", "all").option("-o, --out <path>", "Directory to save the audit report", "./accessibility-reports/audit").action(function(opts) {
611
619
  return _async_to_generator(function() {
612
- var _urls, _opts_audit, _config_audit, _config_audit1, _opts_audit1, configPath, config, _tmp, urls, format, allResults, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, url, result, err1, err, hasResults;
620
+ var _urls, _opts_audit, _config_audit, _config_audit1, _opts_audit1, configPath, config, _tmp, urls, format, allResults, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, url, result, error, err, hasResults;
613
621
  function createReport(format2) {
614
622
  return _async_to_generator(function() {
615
623
  var _config_audit, formatted, out, d, pad, timestamp, fileName, filePath;
@@ -752,8 +760,10 @@ program.command("audit").description("Run axe-core powered accessibility audit o
752
760
  12
753
761
  ];
754
762
  case 11:
755
- err1 = _state.sent();
756
- console.log(import_chalk.default.red("❌ Failed auditing ".concat(url, ": ").concat(err1.message)));
763
+ error = _state.sent();
764
+ if (_instanceof(error, Error) && error.message) {
765
+ console.log(import_chalk.default.red("❌ Failed auditing ".concat(url, ": ").concat(error.message)));
766
+ }
757
767
  return [
758
768
  3,
759
769
  12
package/bin/audit-cli.js CHANGED
@@ -328,8 +328,8 @@ function runAudit(url) {
328
328
  _state.trys.push([
329
329
  0,
330
330
  6,
331
- ,
332
- 7
331
+ 7,
332
+ 10
333
333
  ]);
334
334
  return [
335
335
  4,
@@ -374,18 +374,22 @@ function runAudit(url) {
374
374
  ];
375
375
  case 6:
376
376
  error = _state.sent();
377
- if (_instanceof1(error, Error) && error.message.includes("Executable doesn't exist")) {
378
- console.error("\n\u274C Playwright browsers not found!\n");
379
- console.log("\uD83D\uDCE6 First-time setup required:");
380
- console.log(" Run: npx playwright install chromium\n");
381
- console.log("\uD83D\uDCA1 This downloads the browser needed for auditing (~200MB)");
382
- console.log(" You only need to do this once.\n");
377
+ if (_instanceof1(error, Error)) {
378
+ if (error.message.includes("Executable doesn't exist")) {
379
+ console.error("\n\u274C Playwright browsers not found!\n");
380
+ console.log("\uD83D\uDCE6 First-time setup required:");
381
+ console.log(" Run: npx playwright install chromium\n");
382
+ console.log("\uD83D\uDCA1 This downloads the browser needed for auditing (~200MB)");
383
+ console.log(" You only need to do this once.\n");
384
+ } else if (error.message.includes("page.goto: net::ERR_CONNECTION_REFUSED")) {
385
+ console.error("\n\u274C Server Not Running!\n");
386
+ console.log(" Make sure your server is running before auditing URL");
387
+ console.log(" Run: npm run dev # or your start command");
388
+ }
383
389
  process.exit(1);
384
390
  }
385
- return [
386
- 3,
387
- 7
388
- ];
391
+ console.error("Error during audit:", error);
392
+ throw error;
389
393
  case 7:
390
394
  if (!browser) return [
391
395
  3,
@@ -399,6 +403,10 @@ function runAudit(url) {
399
403
  _state.sent();
400
404
  _state.label = 9;
401
405
  case 9:
406
+ return [
407
+ 7
408
+ ];
409
+ case 10:
402
410
  return [
403
411
  2
404
412
  ];
@@ -516,7 +524,7 @@ var program = new Command();
516
524
  program.name("aria-ease").description("Run accessibility tests and audits").version("2.1.1");
517
525
  program.command("audit").description("Run axe-core powered accessibility audit on webpages").option("-u, --url <url>", "Single URL to audit").option("-f, --format <format>", "Output format for the audit report: json | csv | html", "all").option("-o, --out <path>", "Directory to save the audit report", "./accessibility-reports/audit").action(function(opts) {
518
526
  return _async_to_generator(function() {
519
- var _urls, _opts_audit, _config_audit, _config_audit1, _opts_audit1, configPath, config, _tmp, urls, format, allResults, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, url, result, err, err1, hasResults;
527
+ var _urls, _opts_audit, _config_audit, _config_audit1, _opts_audit1, configPath, config, _tmp, urls, format, allResults, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, url, result, error, err, hasResults;
520
528
  function createReport(format2) {
521
529
  return _async_to_generator(function() {
522
530
  var _config_audit, formatted, out, d, pad, timestamp, fileName, filePath;
@@ -655,8 +663,10 @@ program.command("audit").description("Run axe-core powered accessibility audit o
655
663
  12
656
664
  ];
657
665
  case 11:
658
- err = _state.sent();
659
- console.log(chalk.red("❌ Failed auditing ".concat(url, ": ").concat(err.message)));
666
+ error = _state.sent();
667
+ if (_instanceof(error, Error) && error.message) {
668
+ console.log(chalk.red("❌ Failed auditing ".concat(url, ": ").concat(error.message)));
669
+ }
660
670
  return [
661
671
  3,
662
672
  12
@@ -673,9 +683,9 @@ program.command("audit").description("Run axe-core powered accessibility audit o
673
683
  16
674
684
  ];
675
685
  case 14:
676
- err1 = _state.sent();
686
+ err = _state.sent();
677
687
  _didIteratorError = true;
678
- _iteratorError = err1;
688
+ _iteratorError = err;
679
689
  return [
680
690
  3,
681
691
  16
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/macx/aria-ease/package/bin/audit-cli.js","../dist/src/utils/audit/audit.js"],"names":[],"mappings":"","sourcesContent":["#!/usr/bin/env node\n\n// dist/src/utils/audit/audit.js\nimport AxeBuilder from \"@axe-core/playwright\";\nimport { chromium } from \"playwright\";\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\nfunction _async_to_generator(fn) {\n return function() {\n var self = this, args2 = arguments;\n return new Promise(function(resolve, reject) {\n var gen = fn.apply(self, args2);\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n _next(void 0);\n });\n };\n}\nfunction _ts_generator(thisArg, body) {\n var f, y, t, _ = {\n label: 0,\n sent: function() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n }, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() {\n return this;\n }), g;\n function verb(n) {\n return function(v) {\n return step([\n n,\n v\n ]);\n };\n }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [\n op[0] & 2,\n t.value\n ];\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n case 5:\n _.label++;\n y = op[1];\n op = [\n 0\n ];\n continue;\n case 7:\n op = _.ops.pop();\n _.trys.pop();\n continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n if (t && _.label < t[2]) {\n _.label = t[2];\n _.ops.push(op);\n break;\n }\n if (t[2]) _.ops.pop();\n _.trys.pop();\n continue;\n }\n op = body.call(thisArg, _);\n } catch (e) {\n op = [\n 6,\n e\n ];\n y = 0;\n } finally {\n f = t = 0;\n }\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n}\nfunction runAudit() {\n return _async_to_generator(function() {\n var browser, context, page, axe, axeResults, snapshot, error;\n return _ts_generator(this, function(_state) {\n switch (_state.label) {\n case 0:\n return [\n 4,\n chromium.launch({\n headless: true\n })\n ];\n case 1:\n browser = _state.sent();\n return [\n 4,\n browser.newContext()\n ];\n case 2:\n context = _state.sent();\n return [\n 4,\n context.newPage()\n ];\n case 3:\n page = _state.sent();\n return [\n 4,\n page.goto(\"http://localhost:5173/\")\n ];\n case 4:\n _state.sent();\n _state.label = 5;\n case 5:\n _state.trys.push([\n 5,\n 8,\n ,\n 9\n ]);\n axe = new AxeBuilder({\n page\n });\n return [\n 4,\n axe.analyze()\n ];\n case 6:\n axeResults = _state.sent();\n console.log(\"--- AXE-CORE RESULTS ---\");\n console.log(axeResults);\n return [\n 4,\n page.accessibility.snapshot()\n ];\n case 7:\n snapshot = _state.sent();\n console.log(\"\\n--- PLAYWRIGHT SNAPSHOT ---\");\n console.log(snapshot);\n return [\n 3,\n 9\n ];\n case 8:\n error = _state.sent();\n console.log(error);\n return [\n 3,\n 9\n ];\n case 9:\n return [\n 4,\n browser.close()\n ];\n case 10:\n _state.sent();\n return [\n 2\n ];\n }\n });\n })();\n}\n\n// bin/audit-cli.ts\nvar args = process.argv.slice(2);\nif (args[0] === \"audit\") {\n (async () => {\n await runAudit();\n })();\n} else {\n console.log(\"Usage: npx aria-ease audit\");\n}\n","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\nfunction _async_to_generator(fn) {\n return function() {\n var self = this, args = arguments;\n return new Promise(function(resolve, reject) {\n var gen = fn.apply(self, args);\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n _next(undefined);\n });\n };\n}\nfunction _instanceof(left, right) {\n if (right != null && typeof Symbol !== \"undefined\" && right[Symbol.hasInstance]) {\n return !!right[Symbol.hasInstance](left);\n } else {\n return left instanceof right;\n }\n}\nfunction _ts_generator(thisArg, body) {\n var f, y, t, _ = {\n label: 0,\n sent: function() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n }, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() {\n return this;\n }), g;\n function verb(n) {\n return function(v) {\n return step([\n n,\n v\n ]);\n };\n }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while(g && (g = 0, op[0] && (_ = 0)), _)try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [\n op[0] & 2,\n t.value\n ];\n switch(op[0]){\n case 0:\n case 1:\n t = op;\n break;\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n case 5:\n _.label++;\n y = op[1];\n op = [\n 0\n ];\n continue;\n case 7:\n op = _.ops.pop();\n _.trys.pop();\n continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n if (t && _.label < t[2]) {\n _.label = t[2];\n _.ops.push(op);\n break;\n }\n if (t[2]) _.ops.pop();\n _.trys.pop();\n continue;\n }\n op = body.call(thisArg, _);\n } catch (e) {\n op = [\n 6,\n e\n ];\n y = 0;\n } finally{\n f = t = 0;\n }\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n}\nimport AxeBuilder from '@axe-core/playwright';\nimport { chromium } from 'playwright';\n// src/utils/audit/audit.ts\nfunction runAudit(url) {\n return _async_to_generator(function() {\n var browser, context, page, axe, axeResults, error;\n return _ts_generator(this, function(_state) {\n switch(_state.label){\n case 0:\n _state.trys.push([\n 0,\n 6,\n ,\n 7\n ]);\n return [\n 4,\n chromium.launch({\n headless: true\n })\n ];\n case 1:\n browser = _state.sent();\n return [\n 4,\n browser.newContext()\n ];\n case 2:\n context = _state.sent();\n return [\n 4,\n context.newPage()\n ];\n case 3:\n page = _state.sent();\n return [\n 4,\n page.goto(url, {\n waitUntil: \"networkidle\"\n })\n ];\n case 4:\n _state.sent();\n axe = new AxeBuilder({\n page: page\n });\n return [\n 4,\n axe.analyze()\n ];\n case 5:\n axeResults = _state.sent();\n return [\n 2,\n axeResults\n ];\n case 6:\n error = _state.sent();\n if (_instanceof(error, Error) && error.message.includes(\"Executable doesn't exist\")) {\n console.error(\"\\n\\u274C Playwright browsers not found!\\n\");\n console.log(\"\\uD83D\\uDCE6 First-time setup required:\");\n console.log(\" Run: npx playwright install chromium\\n\");\n console.log(\"\\uD83D\\uDCA1 This downloads the browser needed for auditing (~200MB)\");\n console.log(\" You only need to do this once.\\n\");\n process.exit(1);\n }\n return [\n 3,\n 7\n ];\n case 7:\n if (!browser) return [\n 3,\n 9\n ];\n return [\n 4,\n browser.close()\n ];\n case 8:\n _state.sent();\n _state.label = 9;\n case 9:\n return [\n 2\n ];\n }\n });\n })();\n}\nexport { runAudit }; //# sourceMappingURL=audit.js.map\n//# sourceMappingURL=audit.js.map"]}
1
+ {"version":3,"sources":["/Users/macx/aria-ease/package/bin/audit-cli.js","../dist/src/utils/audit/audit.js"],"names":[],"mappings":"","sourcesContent":["#!/usr/bin/env node\n\n// dist/src/utils/audit/audit.js\nimport AxeBuilder from \"@axe-core/playwright\";\nimport { chromium } from \"playwright\";\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\nfunction _async_to_generator(fn) {\n return function() {\n var self = this, args2 = arguments;\n return new Promise(function(resolve, reject) {\n var gen = fn.apply(self, args2);\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n _next(void 0);\n });\n };\n}\nfunction _ts_generator(thisArg, body) {\n var f, y, t, _ = {\n label: 0,\n sent: function() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n }, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() {\n return this;\n }), g;\n function verb(n) {\n return function(v) {\n return step([\n n,\n v\n ]);\n };\n }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [\n op[0] & 2,\n t.value\n ];\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n case 5:\n _.label++;\n y = op[1];\n op = [\n 0\n ];\n continue;\n case 7:\n op = _.ops.pop();\n _.trys.pop();\n continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n if (t && _.label < t[2]) {\n _.label = t[2];\n _.ops.push(op);\n break;\n }\n if (t[2]) _.ops.pop();\n _.trys.pop();\n continue;\n }\n op = body.call(thisArg, _);\n } catch (e) {\n op = [\n 6,\n e\n ];\n y = 0;\n } finally {\n f = t = 0;\n }\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n}\nfunction runAudit() {\n return _async_to_generator(function() {\n var browser, context, page, axe, axeResults, snapshot, error;\n return _ts_generator(this, function(_state) {\n switch (_state.label) {\n case 0:\n return [\n 4,\n chromium.launch({\n headless: true\n })\n ];\n case 1:\n browser = _state.sent();\n return [\n 4,\n browser.newContext()\n ];\n case 2:\n context = _state.sent();\n return [\n 4,\n context.newPage()\n ];\n case 3:\n page = _state.sent();\n return [\n 4,\n page.goto(\"http://localhost:5173/\")\n ];\n case 4:\n _state.sent();\n _state.label = 5;\n case 5:\n _state.trys.push([\n 5,\n 8,\n ,\n 9\n ]);\n axe = new AxeBuilder({\n page\n });\n return [\n 4,\n axe.analyze()\n ];\n case 6:\n axeResults = _state.sent();\n console.log(\"--- AXE-CORE RESULTS ---\");\n console.log(axeResults);\n return [\n 4,\n page.accessibility.snapshot()\n ];\n case 7:\n snapshot = _state.sent();\n console.log(\"\\n--- PLAYWRIGHT SNAPSHOT ---\");\n console.log(snapshot);\n return [\n 3,\n 9\n ];\n case 8:\n error = _state.sent();\n console.log(error);\n return [\n 3,\n 9\n ];\n case 9:\n return [\n 4,\n browser.close()\n ];\n case 10:\n _state.sent();\n return [\n 2\n ];\n }\n });\n })();\n}\n\n// bin/audit-cli.ts\nvar args = process.argv.slice(2);\nif (args[0] === \"audit\") {\n (async () => {\n await runAudit();\n })();\n} else {\n console.log(\"Usage: npx aria-ease audit\");\n}\n","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\nfunction _async_to_generator(fn) {\n return function() {\n var self = this, args = arguments;\n return new Promise(function(resolve, reject) {\n var gen = fn.apply(self, args);\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n _next(undefined);\n });\n };\n}\nfunction _instanceof(left, right) {\n if (right != null && typeof Symbol !== \"undefined\" && right[Symbol.hasInstance]) {\n return !!right[Symbol.hasInstance](left);\n } else {\n return left instanceof right;\n }\n}\nfunction _ts_generator(thisArg, body) {\n var f, y, t, _ = {\n label: 0,\n sent: function() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n }, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() {\n return this;\n }), g;\n function verb(n) {\n return function(v) {\n return step([\n n,\n v\n ]);\n };\n }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while(g && (g = 0, op[0] && (_ = 0)), _)try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [\n op[0] & 2,\n t.value\n ];\n switch(op[0]){\n case 0:\n case 1:\n t = op;\n break;\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n case 5:\n _.label++;\n y = op[1];\n op = [\n 0\n ];\n continue;\n case 7:\n op = _.ops.pop();\n _.trys.pop();\n continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n if (t && _.label < t[2]) {\n _.label = t[2];\n _.ops.push(op);\n break;\n }\n if (t[2]) _.ops.pop();\n _.trys.pop();\n continue;\n }\n op = body.call(thisArg, _);\n } catch (e) {\n op = [\n 6,\n e\n ];\n y = 0;\n } finally{\n f = t = 0;\n }\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n}\nimport AxeBuilder from '@axe-core/playwright';\nimport { chromium } from 'playwright';\n// src/utils/audit/audit.ts\nfunction runAudit(url) {\n return _async_to_generator(function() {\n var browser, context, page, axe, axeResults, error;\n return _ts_generator(this, function(_state) {\n switch(_state.label){\n case 0:\n _state.trys.push([\n 0,\n 6,\n 7,\n 10\n ]);\n return [\n 4,\n chromium.launch({\n headless: true\n })\n ];\n case 1:\n browser = _state.sent();\n return [\n 4,\n browser.newContext()\n ];\n case 2:\n context = _state.sent();\n return [\n 4,\n context.newPage()\n ];\n case 3:\n page = _state.sent();\n return [\n 4,\n page.goto(url, {\n waitUntil: \"networkidle\"\n })\n ];\n case 4:\n _state.sent();\n axe = new AxeBuilder({\n page: page\n });\n return [\n 4,\n axe.analyze()\n ];\n case 5:\n axeResults = _state.sent();\n return [\n 2,\n axeResults\n ];\n case 6:\n error = _state.sent();\n if (_instanceof(error, Error)) {\n if (error.message.includes(\"Executable doesn't exist\")) {\n console.error(\"\\n\\u274C Playwright browsers not found!\\n\");\n console.log(\"\\uD83D\\uDCE6 First-time setup required:\");\n console.log(\" Run: npx playwright install chromium\\n\");\n console.log(\"\\uD83D\\uDCA1 This downloads the browser needed for auditing (~200MB)\");\n console.log(\" You only need to do this once.\\n\");\n } else if (error.message.includes(\"page.goto: net::ERR_CONNECTION_REFUSED\")) {\n console.error(\"\\n\\u274C Server Not Running!\\n\");\n console.log(\" Make sure your server is running before auditing URL\");\n console.log(\" Run: npm run dev # or your start command\");\n }\n process.exit(1);\n }\n console.error(\"Error during audit:\", error);\n throw error;\n case 7:\n if (!browser) return [\n 3,\n 9\n ];\n return [\n 4,\n browser.close()\n ];\n case 8:\n _state.sent();\n _state.label = 9;\n case 9:\n return [\n 7\n ];\n case 10:\n return [\n 2\n ];\n }\n });\n })();\n}\nexport { runAudit }; //# sourceMappingURL=audit.js.map\n//# sourceMappingURL=audit.js.map"]}
package/bin/audit-cli.ts CHANGED
@@ -48,13 +48,13 @@ program.command('audit')
48
48
  for (const url of urls) {
49
49
  console.log(chalk.yellow(`🔎 Auditing: ${url}`));
50
50
  try {
51
- const result = await runAudit(url);
51
+ const result: AxeResults = await runAudit(url);
52
52
  allResults.push({ url: url, result });
53
53
  console.log(chalk.green(`✅ Completed audit for ${url}\n`));
54
-
55
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
56
- } catch (err: any) {
57
- console.log(chalk.red(`❌ Failed auditing ${url}: ${err.message}`));
54
+ } catch (error: unknown) {
55
+ if(error instanceof Error && error.message) {
56
+ console.log(chalk.red(`❌ Failed auditing ${url}: ${error.message}`));
57
+ }
58
58
  }
59
59
  }
60
60
 
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/macx/aria-ease/package/dist/chunk-5HQ6LLC5.js","../src/radio/src/updateRadioAriaAttributes/updateRadioAriaAttributes.ts"],"names":["updateRadioAriaAttributes","radioId","radiosClass","radioStates","currentPressedRadioIndex","radioDiv","document","querySelector","Error","radioItems","Array","from","querySelectorAll","length","forEach","radioItem","index","state","checked","getAttribute","shouldBeChecked","setAttribute"],"mappings":"AAAA,uEAAuE;ACUhE,SAASA,0BAA0BC,OAAA,EAAiBC,WAAA,EAAqBC,WAAA,EAA4BC,wBAAA;QAClGC,WAA+BC,SAASC,aAAA,CAAc,IAAIN,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAPA,CAAAA;oGAChE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AAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAkBJ,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAUZ,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAA4Ba,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAMC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA,CAAA,CAAA,CAAU,CAAA,EAAA,EAAA,EAAA,EAAS,EAAA,EAAA,EAAA,EAAA,EAAW;wMAClG,GAAA,CAAIA,GAAAA,CAAAA,GAAAA,CAAAA,GAAWA,CAAAA,GAAAA,CAAAA,GAAAA,CAAAA,GAAYE,CAAAA,IAAAA,IAAAA,IAAAA,IAAiB;4SACxCL,GAAAA,CAAAA,CAAAA,IAAAA,CAAUM,CAAAA,IAAAA,CAAAA,CAAAA,IAAAA,CAAA,CAAa,IAAA,MAAA,MAAgBD;wMAC3C;oGACJ;AACJ","sourcesContent":["// src/radio/src/updateRadioAriaAttributes/updateRadioAriaAttributes.ts\nfunction updateRadioAriaAttributes(radioId, radiosClass, radioStates, currentPressedRadioIndex) {\n const radioDiv = document.querySelector(`#${radioId}`);\n if (!radioDiv) {\n throw new Error(\"Invalid radio main div id provided.\");\n }\n const radioItems = Array.from(radioDiv.querySelectorAll(`.${radiosClass}`));\n if (radioItems.length === 0) {\n throw new Error(\"Invalid radios shared class provided.\");\n }\n radioItems.forEach((radioItem, index) => {\n const state = radioStates[index];\n const checked = radioItem.getAttribute(\"aria-checked\");\n const shouldBeChecked = index === currentPressedRadioIndex ? state.checked ? \"true\" : \"false\" : \"false\";\n if (checked && checked !== shouldBeChecked) {\n radioItem.setAttribute(\"aria-checked\", shouldBeChecked);\n }\n });\n}\n\nexport { updateRadioAriaAttributes };\n//# sourceMappingURL=chunk-5HQ6LLC5.js.map\n","/**\n * Adds screen reader accessibility to multiple radio buttons. Updates the aria attributes of the radio buttons. Radio elements must possess the following aria attributes; aria-checked and aria-label.\n * @param {string} radioId The id of the radio parent container.\n * @param {string} radiosClass The shared class of all the radios.\n * @param {RadioStates[]} radioStates Array of objects containing radio buttons state information.\n * @param {number} currentPressedRadioIndex Index of the currently checked or unchecked radio button.\n */\n\nimport { HTMLElement, RadioStates } from \"../../../../Types\";\n\nexport function updateRadioAriaAttributes(radioId: string, radiosClass: string, radioStates: RadioStates[], currentPressedRadioIndex: number): void {\n const radioDiv: HTMLElement | null = document.querySelector(`#${radioId}`);\n if (!radioDiv) {\n throw new Error(\"Invalid radio main div id provided.\");\n }\n \n const radioItems: HTMLElement[] = Array.from(radioDiv.querySelectorAll(`.${radiosClass}`));\n if(radioItems.length === 0) {\n throw new Error('Invalid radios shared class provided.');\n }\n\n radioItems.forEach((radioItem: HTMLElement, index: number) => {\n const state = radioStates[index];\n const checked = radioItem.getAttribute(\"aria-checked\");\n const shouldBeChecked = index === currentPressedRadioIndex ? (state.checked ? \"true\" : \"false\") : \"false\";\n if (checked && checked !== shouldBeChecked) {\n radioItem.setAttribute(\"aria-checked\", shouldBeChecked);\n }\n });\n}"]}
1
+ {"version":3,"sources":["/Users/macx/aria-ease/package/dist/chunk-5HQ6LLC5.js","../src/radio/src/updateRadioAriaAttributes/updateRadioAriaAttributes.ts"],"names":["updateRadioAriaAttributes","radioId","radiosClass","radioStates","currentPressedRadioIndex","radioDiv","document","querySelector","Error","radioItems","Array","from","querySelectorAll","length","forEach","radioItem","index","state","checked","getAttribute","shouldBeChecked","setAttribute"],"mappings":"AAAA,uEAAuE;ACUhE,SAASA,0BAA0BC,OAAA,EAAiBC,WAAA,EAAqBC,WAAA,EAA4BC,wBAAA;QAClGC,WAA+BC,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A,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA,CAAa;4HACvC,CAAA,CAAMC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAkBJ,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAUZ,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAA4Ba,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAMC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA,CAAA,CAAA,CAAU,CAAA,EAAA,EAAA,EAAA,EAAS,EAAA,EAAA,EAAA,EAAA,EAAW;4OAClG,GAAA,CAAIA,GAAAA,CAAAA,GAAAA,CAAAA,GAAWA,CAAAA,GAAAA,CAAAA,GAAAA,CAAAA,GAAYE,CAAAA,IAAAA,IAAAA,IAAAA,IAAiB;kWACxCL,GAAAA,CAAAA,CAAAA,IAAAA,CAAUM,CAAAA,IAAAA,CAAAA,CAAAA,IAAAA,CAAA,CAAa,IAAA,MAAA,MAAgBD;4OAC3C;sHACJ;AACJ","sourcesContent":["// src/radio/src/updateRadioAriaAttributes/updateRadioAriaAttributes.ts\nfunction updateRadioAriaAttributes(radioId, radiosClass, radioStates, currentPressedRadioIndex) {\n const radioDiv = document.querySelector(`#${radioId}`);\n if (!radioDiv) {\n throw new Error(\"Invalid radio main div id provided.\");\n }\n const radioItems = Array.from(radioDiv.querySelectorAll(`.${radiosClass}`));\n if (radioItems.length === 0) {\n throw new Error(\"Invalid radios shared class provided.\");\n }\n radioItems.forEach((radioItem, index) => {\n const state = radioStates[index];\n const checked = radioItem.getAttribute(\"aria-checked\");\n const shouldBeChecked = index === currentPressedRadioIndex ? state.checked ? \"true\" : \"false\" : \"false\";\n if (checked && checked !== shouldBeChecked) {\n radioItem.setAttribute(\"aria-checked\", shouldBeChecked);\n }\n });\n}\n\nexport { updateRadioAriaAttributes };\n//# sourceMappingURL=chunk-5HQ6LLC5.js.map\n","/**\n * Adds screen reader accessibility to multiple radio buttons. Updates the aria attributes of the radio buttons. Radio elements must possess the following aria attributes; aria-checked and aria-label.\n * @param {string} radioId The id of the radio parent container.\n * @param {string} radiosClass The shared class of all the radios.\n * @param {RadioStates[]} radioStates Array of objects containing radio buttons state information.\n * @param {number} currentPressedRadioIndex Index of the currently checked or unchecked radio button.\n */\n\nimport { HTMLElement, RadioStates } from \"../../../../Types\";\n\nexport function updateRadioAriaAttributes(radioId: string, radiosClass: string, radioStates: RadioStates[], currentPressedRadioIndex: number): void {\n const radioDiv: HTMLElement | null = document.querySelector(`#${radioId}`);\n if (!radioDiv) {\n throw new Error(\"Invalid radio main div id provided.\");\n }\n \n const radioItems: HTMLElement[] = Array.from(radioDiv.querySelectorAll(`.${radiosClass}`));\n if(radioItems.length === 0) {\n throw new Error('Invalid radios shared class provided.');\n }\n\n radioItems.forEach((radioItem: HTMLElement, index: number) => {\n const state = radioStates[index];\n const checked = radioItem.getAttribute(\"aria-checked\");\n const shouldBeChecked = index === currentPressedRadioIndex ? (state.checked ? \"true\" : \"false\") : \"false\";\n if (checked && checked !== shouldBeChecked) {\n radioItem.setAttribute(\"aria-checked\", shouldBeChecked);\n }\n });\n}"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/macx/aria-ease/package/dist/chunk-FBQ5LF2T.js","../src/toggle/src/updateToggleAriaAttribute/updateToggleAriaAttribute.ts"],"names":["updateToggleAriaAttribute","toggleId","togglesClass","toggleStates","currentPressedToggleIndex","toggleDiv","document","querySelector","Error","toggleItems","Array","from","querySelectorAll","length","forEach","toggle","index","set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,CAAAA,GAAAA,CAAK,CAAEE,CAAAA,GAAAA,GAAA,GAAU,GAAA,MAAS;wMAC7E;oGACF;AACF","sourcesContent":["// src/toggle/src/updateToggleAriaAttribute/updateToggleAriaAttribute.ts\nfunction updateToggleAriaAttribute(toggleId, togglesClass, toggleStates, currentPressedToggleIndex) {\n const toggleDiv = document.querySelector(`#${toggleId}`);\n if (!toggleDiv) {\n throw new Error(\"Invalid toggle main div id provided.\");\n }\n const toggleItems = Array.from(toggleDiv.querySelectorAll(`.${togglesClass}`));\n if (toggleItems.length === 0) {\n throw new Error(\"Invalid toggles shared class provided.\");\n }\n if (toggleItems.length !== toggleStates.length) {\n throw new Error(`Toggle state/DOM length mismatch: found ${toggleItems.length} triggers, but got ${toggleStates.length} state objects.`);\n }\n toggleItems.forEach((toggle, index) => {\n if (index === currentPressedToggleIndex) {\n toggle.setAttribute(\"aria-pressed\", toggleStates[index].pressed ? \"true\" : \"false\");\n }\n });\n}\n\nexport { updateToggleAriaAttribute };\n//# sourceMappingURL=chunk-FBQ5LF2T.js.map\n","/**\n * Adds screen reader accessibility to toggle buttons. Updates the aria attributes of the toggle buttons. Button must be a semantic button element or a non-semantic element with a role of button, and possess the aria-pressed attribute.\n * @param {string} toggleId The id of the toggle buttons parent container.\n * @param {string} togglesClass The shared class of all the toggle buttons.\n * @param {ToggleStates[]} toggleStates Array of objects containing toggle buttons state information.\n * @param {number} currentPressedToggleIndex Index of the currently pressed or unpressed toggle button.\n*/\n\nimport { HTMLElement, ToggleStates } from \"../../../../Types\";\n\nexport function updateToggleAriaAttribute(toggleId: string, togglesClass: string, toggleStates: ToggleStates[], currentPressedToggleIndex: number): void {\n const toggleDiv: HTMLElement | null = document.querySelector(`#${toggleId}`);\n if (!toggleDiv) {\n throw new Error(\"Invalid toggle main div id provided.\");\n }\n\n const toggleItems: HTMLElement[] = Array.from(toggleDiv.querySelectorAll(`.${togglesClass}`));\n if (toggleItems.length === 0) {\n throw new Error('Invalid toggles shared class provided.');\n }\n\n if(toggleItems.length !== toggleStates.length) {\n throw new Error(`Toggle state/DOM length mismatch: found ${toggleItems.length} triggers, but got ${toggleStates.length} state objects.`);\n }\n\n toggleItems.forEach((toggle, index) => {\n if (index === currentPressedToggleIndex) {\n toggle.setAttribute(\"aria-pressed\", toggleStates[index].pressed ? 'true' : 'false');\n }\n });\n}"]}
1
+ {"version":3,"sources":["/Users/macx/aria-ease/package/dist/chunk-FBQ5LF2T.js","../src/toggle/src/updateToggleAriaAttribute/updateToggleAriaAttribute.ts"],"names":["updateToggleAriaAttribute","toggleId","togglesClass","toggleStates","currentPressedToggleIndex","toggleDiv","document","querySelector","Error","toggleItems","Array","from","querySelectorAll","length","forEach","toggle","index","setAttribute","pressed"],"mappings":"AAAA,wEAAwE;ACUjE,SAASA,0BAA0BC,QAAA,EAAkBC,YAAA,EAAsBC,YAAA,EAA8BC,yBAAA;QACxGC,YAAgCC,SAASC,aAAA,CAAc,IAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAARN,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAQ;sHACzE,CAAA,CAAA,CAAA,CAAI,CAACI,CAAAA,EAAAA,EAAAA,EAAAA,EAAAA,EAAW;4OACd,EAAA,EAAA,EAAM,EAAA,EAAIG,EAAAA,IAAM;sHAClB;QAEMC,cAA6BC,MAAMC,IAAA,CAAKN,UAAUO,gBAAA,CAAiB,IAAgB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAZV,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAY;sHACzF,CAAA,CAAA,CAAA,CAAIO,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAYI,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,EAAG;4OAC5B,EA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AAAA,CAA+C,KAAA,EAAA,CAA/CA,CAAAA,EAAAA,GAAvD,CAAA,GAA6D,GAAA,CAAyC,KAAA,EAAA,CAAzC,CAAA,EAAA,GAA7D,CAAA,GAAmFV,GAAAA,CAAmB,KAAA,EAAA,CAAnBA,CAAAA,EAAAA,GAAxCM,CAAAA,MAAAA,CAA2D,KAAA,EAAA,CAA3DA,CAAAA,EAAAA,IAAYI,MAAAA,CAA+C,KAAA,EAAA,CAA/CA,CAAM,EAAA,UAAA,CAAyC,KAAA,EAAA,CAAzC,aAAA,CAAyC,KAAA,EAAA,CAAnBV,aAAaU,MAAM,EAAA;sHACxH;8eAEAJ,OAAAA,EAAAA,CAAAA,OAAAA,EAAAA,CAAAA,OAAAA,EAAAA,CAAAA,OAAAA,EAAAA,CAAAA,OAAAA,EAAAA,CAAAA,OAAAA,EAAAA,CAAYK,OAAAA,EAAAA,CAAAA,OAAAA,EAAAA,CAAAA,OAAAA,EAAAA,CAAAA,OAAAA,EAAA,CAAQ,OAAA,EAACC,QAAQC;4OAC3B,CAAA,CAAA,EAAIA,CAAAA,CAAAA,GAAAA,CAAAA,GAAAA,CAAUZ,GAAAA,IAAAA,IAAAA,IAAAA,IAAAA,IAAAA,IAA2B;kWACvCW,CAAAA,CAAAA,CAAAA,GAAAA,CAAOE,CAAAA,CAAAA,GAAAA,CAAAA,CAAAA,CAAAA,GAAAA,CAAA,CAAa,CAAA,GAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,GAAgBd,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAAA,CAAAA,GAAA,CAAaa,CAAAA,CAAAA,GAAAA,CAAK,CAAEE,CAAAA,GAAAA,GAAA,GAAU,GAAA,MAAS;4OAC7E;sHACF;AACF","sourcesContent":["// src/toggle/src/updateToggleAriaAttribute/updateToggleAriaAttribute.ts\nfunction updateToggleAriaAttribute(toggleId, togglesClass, toggleStates, currentPressedToggleIndex) {\n const toggleDiv = document.querySelector(`#${toggleId}`);\n if (!toggleDiv) {\n throw new Error(\"Invalid toggle main div id provided.\");\n }\n const toggleItems = Array.from(toggleDiv.querySelectorAll(`.${togglesClass}`));\n if (toggleItems.length === 0) {\n throw new Error(\"Invalid toggles shared class provided.\");\n }\n if (toggleItems.length !== toggleStates.length) {\n throw new Error(`Toggle state/DOM length mismatch: found ${toggleItems.length} triggers, but got ${toggleStates.length} state objects.`);\n }\n toggleItems.forEach((toggle, index) => {\n if (index === currentPressedToggleIndex) {\n toggle.setAttribute(\"aria-pressed\", toggleStates[index].pressed ? \"true\" : \"false\");\n }\n });\n}\n\nexport { updateToggleAriaAttribute };\n//# sourceMappingURL=chunk-FBQ5LF2T.js.map\n","/**\n * Adds screen reader accessibility to toggle buttons. Updates the aria attributes of the toggle buttons. Button must be a semantic button element or a non-semantic element with a role of button, and possess the aria-pressed attribute.\n * @param {string} toggleId The id of the toggle buttons parent container.\n * @param {string} togglesClass The shared class of all the toggle buttons.\n * @param {ToggleStates[]} toggleStates Array of objects containing toggle buttons state information.\n * @param {number} currentPressedToggleIndex Index of the currently pressed or unpressed toggle button.\n*/\n\nimport { HTMLElement, ToggleStates } from \"../../../../Types\";\n\nexport function updateToggleAriaAttribute(toggleId: string, togglesClass: string, toggleStates: ToggleStates[], currentPressedToggleIndex: number): void {\n const toggleDiv: HTMLElement | null = document.querySelector(`#${toggleId}`);\n if (!toggleDiv) {\n throw new Error(\"Invalid toggle main div id provided.\");\n }\n\n const toggleItems: HTMLElement[] = Array.from(toggleDiv.querySelectorAll(`.${togglesClass}`));\n if (toggleItems.length === 0) {\n throw new Error('Invalid toggles shared class provided.');\n }\n\n if(toggleItems.length !== toggleStates.length) {\n throw new Error(`Toggle state/DOM length mismatch: found ${toggleItems.length} triggers, but got ${toggleStates.length} state objects.`);\n }\n\n toggleItems.forEach((toggle, index) => {\n if (index === currentPressedToggleIndex) {\n toggle.setAttribute(\"aria-pressed\", toggleStates[index].pressed ? 'true' : 'false');\n }\n });\n}"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/macx/aria-ease/package/dist/chunk-KVTLMA4J.js","../src/menu/src/makeMenuAccessible/makeMenuAccessible.ts"],"names":["handleKeyPress","menuElementsClass","menuDiv","document","querySelector","menuId","Error","triggerButton","triggerId","handlerMap","Map","setAria","isOpen","setAttribute","addListeners","menuItems","querySelectorAll","forEach","menuItem","index","has"],"mappings":"AAAA,SAASA,cAAc,QAAQ,sBAAsB;QCURC,CAAAA,QAAAA,MAAAA,CAAAA,IAAAA,KAAAA,EAAAA,MAAAA,YAAAA,GAAAA;QAAAA,CAAAA,QAAAA,MAAAA,CAAAA,IAAAA,KAAAA,EAAAA,MAAAA,YAAAA;QAAAA,SAAAA,MAAAA,CAAAA,OAAAA,oBAAAA,MAAAA,aAAAA,MAAAA,YAAAA;QACrCC,UAAUC,SAASC,aAAA,CAAc,IAAU,OAANC;oGAC3C,CAAA,CAAA,CAAA,CAAI,CAACH,CAAAA,EAAAA,EAAAA,EAAAA,EAAS,EAAA,EAAA,EAAM,EAAA,EAAII,EAAAA,EAAAA,EAAM;QAExBC,gBAAgBJ,SAASC,aAAA,CAAc,IAAa,CAAA,CAAA,CAATI,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAS,CAAA,CAAA,CAAA;oGAC1D,CAAA,CAAA,CAAA,CAAI,CAACD,CAAAA,EAAAA,EAAAA,EAAAA,EAAAA,EAAAA,EAAAA,EAAe,EAAA,EAAA,EAAM,EAAA,EAAID,EAAAA,EAAAA,EAAM;QAG9BG,aAAA,aAAA,GAAA,IAAiBC;oGAEvB,CAAA,EAAA,EAAA,EAAA,EAASC,EAAAA,EAAAA,EAAAA,EAAQC,EAAAA,EAAAA,EAAA;wMACfL,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAcM,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA,CAAa,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAiBD,CAAAA,CAAAA,GAAAA,CAAAA,GAAS,CAAA,IAAA,IAAS;oGAChE;oGAEA,CAAA,EAAA,EAAA,EAAA,EAASE;qDACDC,CAAoBC,CAApBD,CAAoBC,CAARd,CAAyB,CAAjBc,CAAsC,CAAtCA,CAApBD,CAAoBC,CAApBD,CAAqC,CAAzBb,CAA6BD,CAArBe,CAApBD,CAAoBC,CAApBD,CAAoBC,CAARd,CAAyB,CAAzBA,CAA6BD,CAArBe;wiBAC1BD,CAAAA,CAAAA,OAAAA,EAAAA,EAAAA,CAAAA,OAAAA,EAAAA,EAAAA,CAAUE,OAAAA,EAAAA,EAAAA,CAAAA,OAAAA,EAAAA,EAAA,CAAQ,OAAA,EAACC,UAAuBC;4SACxC,CAAA,CAAA,EAAI,CAACV,EAAAA,CAAAA,EAAAA,GAAAA,CAAAA,EAAWW,GAAA,CAAIF,KAAAA,MAAW","sourcesContent":["import { handleKeyPress } from './chunk-RT5IROW4.js';\n\n// src/menu/src/makeMenuAccessible/makeMenuAccessible.ts\nfunction makeMenuAccessible({ menuId, menuElementsClass, triggerId }) {\n const menuDiv = document.querySelector(`#${menuId}`);\n if (!menuDiv) throw new Error(\"Invalid menu div id provided\");\n const triggerButton = document.querySelector(`#${triggerId}`);\n if (!triggerButton) throw new Error(\"Invalid trigger button id provided\");\n const handlerMap = /* @__PURE__ */ new Map();\n function setAria(isOpen) {\n triggerButton.setAttribute(\"aria-expanded\", isOpen ? \"true\" : \"false\");\n }\n function addListeners() {\n const menuItems = menuDiv.querySelectorAll(`.${menuElementsClass}`);\n menuItems.forEach((menuItem, index) => {\n if (!handlerMap.has(menuItem)) {\n const handler = (event) => handleKeyPress(event, menuItems, index, menuDiv, triggerButton);\n menuItem.addEventListener(\"keydown\", handler);\n handlerMap.set(menuItem, handler);\n }\n });\n }\n function removeListeners() {\n const menuItems = menuDiv.querySelectorAll(`.${menuElementsClass}`);\n menuItems.forEach((menuItem) => {\n const handler = handlerMap.get(menuItem);\n if (handler) {\n menuItem.removeEventListener(\"keydown\", handler);\n handlerMap.delete(menuItem);\n }\n });\n }\n function openMenu() {\n menuDiv.style.display = \"block\";\n setAria(true);\n addListeners();\n const menuItems = menuDiv.querySelectorAll(`.${menuElementsClass}`);\n if (menuItems.length > 0) menuItems[0].focus();\n }\n function closeMenu() {\n removeListeners();\n menuDiv.style.display = \"none\";\n setAria(false);\n triggerButton.focus();\n }\n function cleanup() {\n removeListeners();\n }\n return { openMenu, closeMenu, cleanup };\n}\n\nexport { makeMenuAccessible };\n//# sourceMappingURL=chunk-KVTLMA4J.js.map\n","/**\n * Adds keyboard interaction to toggle menu. The menu traps focus and can be interacted with using the keyboard. The first interactive item of the menu has focus when menu open.\n * @param {string} menuId - The id of the menu.\n * @param {string} menuElementsClass - The class of the items that are children of the menu.\n * @param {string} triggerId - The id of the button that triggers the menu.\n*/\n\nimport { handleKeyPress } from \"../../../utils/handleKeyPress/handleKeyPress\";\nimport { NodeListOfHTMLElement } from \"../../../../Types\";\n\nexport function makeMenuAccessible({ menuId, menuElementsClass, triggerId }: {menuId: string; menuElementsClass: string; triggerId: string;}) {\n const menuDiv = document.querySelector(`#${menuId}`) as HTMLElement;\n if (!menuDiv) throw new Error(\"Invalid menu div id provided\");\n\n const triggerButton = document.querySelector(`#${triggerId}`) as HTMLElement;\n if (!triggerButton) throw new Error(\"Invalid trigger button id provided\");\n\n\n const handlerMap = new Map<HTMLElement, (event: KeyboardEvent) => void>();\n\n function setAria(isOpen: boolean) {\n triggerButton.setAttribute(\"aria-expanded\", isOpen ? \"true\" : \"false\");\n }\n\n function addListeners() {\n const menuItems = menuDiv.querySelectorAll(`.${menuElementsClass}`) as NodeListOfHTMLElement<HTMLElement>;\n menuItems.forEach((menuItem: HTMLElement, index: number) => {\n if (!handlerMap.has(menuItem)) {\n const handler = (event: KeyboardEvent) => handleKeyPress(event, menuItems, index, menuDiv, triggerButton);\n menuItem.addEventListener(\"keydown\", handler);\n handlerMap.set(menuItem, handler);\n }\n });\n }\n\n function removeListeners() {\n const menuItems = menuDiv.querySelectorAll(`.${menuElementsClass}`) as NodeListOfHTMLElement<HTMLElement>;\n menuItems.forEach((menuItem: HTMLElement) => {\n const handler = handlerMap.get(menuItem);\n if (handler) {\n menuItem.removeEventListener(\"keydown\", handler);\n handlerMap.delete(menuItem);\n }\n });\n }\n\n function openMenu() {\n menuDiv.style.display = \"block\";\n setAria(true);\n addListeners();\n \n const menuItems = menuDiv.querySelectorAll(`.${menuElementsClass}`) as NodeListOfHTMLElement<HTMLElement>;\n if (menuItems.length > 0) menuItems[0].focus();\n }\n\n function closeMenu() {\n removeListeners();\n menuDiv.style.display = \"none\";\n setAria(false);\n triggerButton.focus();\n }\n\n function cleanup() {\n removeListeners();\n }\n\n return { openMenu, closeMenu, cleanup };\n}"]}
1
+ {"version":3,"sources":["/Users/macx/aria-ease/package/dist/chunk-KVTLMA4J.js","../src/menu/src/makeMenuAccessible/makeMenuAccessible.ts"],"names":["handleKeyPress","menuElementsClass","menuDiv","document","querySelector","menuId","Error","triggerButton","triggerId","handlerMap","Map","setAria","isOpen","setAttribute","addListeners","querySelectorAll","menuItems","forEach","menuItem","index","has"],"mappings":"AAAA,SAASA,cAAc,QAAQ,sBAAsB;QCURC,CAAAA,QAAAA,MAAAA,CAAAA,IAAAA,KAAAA,EAAAA,MAAAA,YAAAA,GAAAA;QAAAA,CAAAA,QAAAA,MAAAA,CAAAA,IAAAA,KAAAA,EAAAA,MAAAA,YAAAA;QAAAA,SAAAA,MAAAA,CAAAA,OAAAA,oBAAAA,MAAAA,aAAAA,MAAAA,YAAAA;QACrCC,UAAUC,SAASC,aAAA,CAAc,IAAIC,OAAM;sHACjD,CAAA,CAAA,CAAA,CAAI,CAACH,CAAAA,EAAAA,EAAAA,EAAAA,EAAS,EAAA,EAAA,EAA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AA,CAAAA,EAAWW,GAAA,CAAIF,KAAAA,MAAW","sourcesContent":["import { handleKeyPress } from './chunk-RT5IROW4.js';\n\n// src/menu/src/makeMenuAccessible/makeMenuAccessible.ts\nfunction makeMenuAccessible({ menuId, menuElementsClass, triggerId }) {\n const menuDiv = document.querySelector(`#${menuId}`);\n if (!menuDiv) throw new Error(\"Invalid menu div id provided\");\n const triggerButton = document.querySelector(`#${triggerId}`);\n if (!triggerButton) throw new Error(\"Invalid trigger button id provided\");\n const handlerMap = /* @__PURE__ */ new Map();\n function setAria(isOpen) {\n triggerButton.setAttribute(\"aria-expanded\", isOpen ? \"true\" : \"false\");\n }\n function addListeners() {\n const menuItems = menuDiv.querySelectorAll(`.${menuElementsClass}`);\n menuItems.forEach((menuItem, index) => {\n if (!handlerMap.has(menuItem)) {\n const handler = (event) => handleKeyPress(event, menuItems, index, menuDiv, triggerButton);\n menuItem.addEventListener(\"keydown\", handler);\n handlerMap.set(menuItem, handler);\n }\n });\n }\n function removeListeners() {\n const menuItems = menuDiv.querySelectorAll(`.${menuElementsClass}`);\n menuItems.forEach((menuItem) => {\n const handler = handlerMap.get(menuItem);\n if (handler) {\n menuItem.removeEventListener(\"keydown\", handler);\n handlerMap.delete(menuItem);\n }\n });\n }\n function openMenu() {\n menuDiv.style.display = \"block\";\n setAria(true);\n addListeners();\n const menuItems = menuDiv.querySelectorAll(`.${menuElementsClass}`);\n if (menuItems.length > 0) menuItems[0].focus();\n }\n function closeMenu() {\n removeListeners();\n menuDiv.style.display = \"none\";\n setAria(false);\n triggerButton.focus();\n }\n function cleanup() {\n removeListeners();\n }\n return { openMenu, closeMenu, cleanup };\n}\n\nexport { makeMenuAccessible };\n//# sourceMappingURL=chunk-KVTLMA4J.js.map\n","/**\n * Adds keyboard interaction to toggle menu. The menu traps focus and can be interacted with using the keyboard. The first interactive item of the menu has focus when menu open.\n * @param {string} menuId - The id of the menu.\n * @param {string} menuElementsClass - The class of the items that are children of the menu.\n * @param {string} triggerId - The id of the button that triggers the menu.\n*/\n\nimport { handleKeyPress } from \"../../../utils/handleKeyPress/handleKeyPress\";\nimport { NodeListOfHTMLElement } from \"../../../../Types\";\n\nexport function makeMenuAccessible({ menuId, menuElementsClass, triggerId }: {menuId: string; menuElementsClass: string; triggerId: string;}) {\n const menuDiv = document.querySelector(`#${menuId}`) as HTMLElement;\n if (!menuDiv) throw new Error(\"Invalid menu div id provided\");\n\n const triggerButton = document.querySelector(`#${triggerId}`) as HTMLElement;\n if (!triggerButton) throw new Error(\"Invalid trigger button id provided\");\n\n\n const handlerMap = new Map<HTMLElement, (event: KeyboardEvent) => void>();\n\n function setAria(isOpen: boolean) {\n triggerButton.setAttribute(\"aria-expanded\", isOpen ? \"true\" : \"false\");\n }\n\n function addListeners() {\n const menuItems = menuDiv.querySelectorAll(`.${menuElementsClass}`) as NodeListOfHTMLElement<HTMLElement>;\n menuItems.forEach((menuItem: HTMLElement, index: number) => {\n if (!handlerMap.has(menuItem)) {\n const handler = (event: KeyboardEvent) => handleKeyPress(event, menuItems, index, menuDiv, triggerButton);\n menuItem.addEventListener(\"keydown\", handler);\n handlerMap.set(menuItem, handler);\n }\n });\n }\n\n function removeListeners() {\n const menuItems = menuDiv.querySelectorAll(`.${menuElementsClass}`) as NodeListOfHTMLElement<HTMLElement>;\n menuItems.forEach((menuItem: HTMLElement) => {\n const handler = handlerMap.get(menuItem);\n if (handler) {\n menuItem.removeEventListener(\"keydown\", handler);\n handlerMap.delete(menuItem);\n }\n });\n }\n\n function openMenu() {\n menuDiv.style.display = \"block\";\n setAria(true);\n addListeners();\n \n const menuItems = menuDiv.querySelectorAll(`.${menuElementsClass}`) as NodeListOfHTMLElement<HTMLElement>;\n if (menuItems.length > 0) menuItems[0].focus();\n }\n\n function closeMenu() {\n removeListeners();\n menuDiv.style.display = \"none\";\n setAria(false);\n triggerButton.focus();\n }\n\n function cleanup() {\n removeListeners();\n }\n\n return { openMenu, closeMenu, cleanup };\n}"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/macx/aria-ease/package/dist/chunk-MEA5U2G4.js","../src/accordion/src/updateAccordionTriggerAriaAttributes/updateAccordionTriggerAriaAttributes.ts"],"names":["updateAccordionTriggerAriaAttributes","accordionId","accordionTriggersClass","accordionStates","clickedTriggerIndex","accordionDiv","document","querySelector","Error","accordionItems","Array","from","querySelectorAll","length","forEach","accordionItem","index","state","expanded","getAttribute","shouldBeExpanded","display","setAttribute"],"mappings":"AAAA,iGAAiG;ACU1F,SAASA,qCAAqCC,WAAA,EAAqBC,sBAAA,EAAgCC,eAAA,EAAoCC,mBAAA;QACpIC,eAAmCC,SAASC,aAAA,CAAc,IAAe,CAAXN,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA;oGAC/E,CAAA,CAAA,CAAA,CAAI,CAACI,EAAAA,EAAAA,EAAAA,EAAAA,EAAAA,EAAAA,EAAc;wMACf,EAAA,EAAA,EAAM,EAAA,EAAIG,EAAAA,IAAM;oGACpB;QAEMC,iBAAgCC,MAAMC,IAAA,CAAKN,aAAaO,gBAAA,CAAiB,IAAIV,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAsB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAtBA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA;oGACnF,CAAA,CAAA,CAAA,CAAIO,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAeI,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,EAAG;wMAC7B,EAAA,EAAA,EAAM,EAAA,EAAIL,EAAAA,IAAM;oGACpB;oG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,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAmBJ,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAUZ,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAuBa,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAMI,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA,CAAA,CAAA,CAAU,CAAA,EAAA,EAAA,EAAA,EAAS,EAAA,EAAA,EAAA,EAAA,EAAW;wMAC9F,CAAA,EAAA,CAAIH,CAAAA,EAAAA,CAAAA,CAAAA,EAAAA,CAAAA,CAAAA,EAAAA,CAAYA,CAAAA,EAAAA,EAAAA,EAAAA,EAAAA,EAAAA,EAAaE,EAAAA,IAAAA,IAAAA,IAAAA,IAAkB;4SAC3CL,EAAAA,CAAAA,KAAAA,CAAAA,KAAcO,CAAAA,KAAAA,CAAAA,KAAA,CAAa,KAAA,MAAA,MAAiBF;wMAChD;oGACJ;AACJ","sourcesContent":["// src/accordion/src/updateAccordionTriggerAriaAttributes/updateAccordionTriggerAriaAttributes.ts\nfunction updateAccordionTriggerAriaAttributes(accordionId, accordionTriggersClass, accordionStates, clickedTriggerIndex) {\n const accordionDiv = document.querySelector(`#${accordionId}`);\n if (!accordionDiv) {\n throw new Error(\"Invalid accordion main div id provided.\");\n }\n const accordionItems = Array.from(accordionDiv.querySelectorAll(`.${accordionTriggersClass}`));\n if (accordionItems.length === 0) {\n throw new Error(\"Invalid accordion items shared class provided.\");\n }\n if (accordionItems.length !== accordionStates.length) {\n throw new Error(`Accordion state/DOM length mismatch: found ${accordionItems.length} triggers, but got ${accordionStates.length} state objects.`);\n }\n accordionItems.forEach((accordionItem, index) => {\n const state = accordionStates[index];\n const expanded = accordionItem.getAttribute(\"aria-expanded\");\n const shouldBeExpanded = index === clickedTriggerIndex ? state.display ? \"true\" : \"false\" : \"false\";\n if (expanded && expanded !== shouldBeExpanded) {\n accordionItem.setAttribute(\"aria-expanded\", shouldBeExpanded);\n }\n });\n}\n\nexport { updateAccordionTriggerAriaAttributes };\n//# sourceMappingURL=chunk-MEA5U2G4.js.map\n","/**\n * Adds screen reader accessibility to accordions. Updates the aria attributes of the accordion trigger button. Trigger button element must possess the following aria attributes; aria-expanded, aria-controls, aria-label (for only non-text triggers).\n * @param {string} accordionId The id of the accordion triggers parent container.\n * @param {string} accordionTriggersClass The shared class of all the accordion triggers.\n * @param {AccordionStates[]} accordionStates Array of objects containing accordions state information.\n * @param {number} clickedTriggerIndex Index of the currently clicked accordion trigger within the accordion div container.\n*/\n\nimport { HTMLElement, AccordionStates } from \"../../../../Types\";\n\nexport function updateAccordionTriggerAriaAttributes(accordionId: string, accordionTriggersClass: string, accordionStates: AccordionStates[], clickedTriggerIndex: number): void {\n const accordionDiv: HTMLElement | null = document.querySelector(`#${accordionId}`);\n if (!accordionDiv) {\n throw new Error(\"Invalid accordion main div id provided.\");\n }\n\n const accordionItems: HTMLElement[] = Array.from(accordionDiv.querySelectorAll(`.${accordionTriggersClass}`));\n if (accordionItems.length === 0) {\n throw new Error(\"Invalid accordion items shared class provided.\");\n }\n\n if (accordionItems.length !== accordionStates.length) {\n throw new Error(`Accordion state/DOM length mismatch: found ${accordionItems.length} triggers, but got ${accordionStates.length} state objects.`);\n }\n\n accordionItems.forEach((accordionItem: HTMLElement, index: number) => {\n const state = accordionStates[index];\n const expanded = accordionItem.getAttribute(\"aria-expanded\");\n const shouldBeExpanded = index === clickedTriggerIndex ? (state.display ? \"true\" : \"false\") : \"false\";\n if (expanded && expanded !== shouldBeExpanded) {\n accordionItem.setAttribute(\"aria-expanded\", shouldBeExpanded);\n }\n });\n}"]}
1
+ {"version":3,"sources":["/Users/macx/aria-ease/package/dist/chunk-MEA5U2G4.js","../src/accordion/src/updateAccordionTriggerAriaAttributes/updateAccordionTriggerAriaAttributes.ts"],"names":["updateAccordionTriggerAriaAttributes","accordionId","accordionTriggersClass","accordionStates","clickedTriggerIndex","accordionDiv","document","querySelector","Error","accordionItems","Array","from","querySelectorAll","length","forEach","accordionItem","index","state","expanded","getAttribute","shouldBeExpanded","display","setAttribute"],"mappings":"AAAA,iGAAiG;ACU1F,SAASA,qCAAqCC,WAAA,EAAqBC,sBAAA,EAAgCC,eAAA,EAAoCC,mBAAA;QACpIC,eAAmCC,SAASC,aAAA,CAAc,IAAe,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAXN,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA;sHACpE,CAAA,CAAA,CAAA,CAAI,CAACI,EAAAA,EAAAA,EAAAA,EAAAA,EAAAA,EAAAA,EAAc;4OACf,EAAA,EAAA,EAAM,EAAA,EAAIG,EAAAA,IAAM;sHACpB;QAEMC,iBAAgCC,MAAMC,IAAA,CAAKN,aAAaO,gBAAA,CAAiB,IAAIV,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAsB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAtBA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA;sHACnF,CAAA,CAAA,CAAA,CAAIO,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAeI,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,EAAG;4OAC7B,EAAA,EAAA,EAAM,EAAA,EAAIL,EAAAA,IAAM;sHACpB;sHAEA,CAAA,CAAA,CAAA,CAAIC,C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erAriaAttributes/updateAccordionTriggerAriaAttributes.ts\nfunction updateAccordionTriggerAriaAttributes(accordionId, accordionTriggersClass, accordionStates, clickedTriggerIndex) {\n const accordionDiv = document.querySelector(`#${accordionId}`);\n if (!accordionDiv) {\n throw new Error(\"Invalid accordion main div id provided.\");\n }\n const accordionItems = Array.from(accordionDiv.querySelectorAll(`.${accordionTriggersClass}`));\n if (accordionItems.length === 0) {\n throw new Error(\"Invalid accordion items shared class provided.\");\n }\n if (accordionItems.length !== accordionStates.length) {\n throw new Error(`Accordion state/DOM length mismatch: found ${accordionItems.length} triggers, but got ${accordionStates.length} state objects.`);\n }\n accordionItems.forEach((accordionItem, index) => {\n const state = accordionStates[index];\n const expanded = accordionItem.getAttribute(\"aria-expanded\");\n const shouldBeExpanded = index === clickedTriggerIndex ? state.display ? \"true\" : \"false\" : \"false\";\n if (expanded && expanded !== shouldBeExpanded) {\n accordionItem.setAttribute(\"aria-expanded\", shouldBeExpanded);\n }\n });\n}\n\nexport { updateAccordionTriggerAriaAttributes };\n//# sourceMappingURL=chunk-MEA5U2G4.js.map\n","/**\n * Adds screen reader accessibility to accordions. Updates the aria attributes of the accordion trigger button. Trigger button element must possess the following aria attributes; aria-expanded, aria-controls, aria-label (for only non-text triggers).\n * @param {string} accordionId The id of the accordion triggers parent container.\n * @param {string} accordionTriggersClass The shared class of all the accordion triggers.\n * @param {AccordionStates[]} accordionStates Array of objects containing accordions state information.\n * @param {number} clickedTriggerIndex Index of the currently clicked accordion trigger within the accordion div container.\n*/\n\nimport { HTMLElement, AccordionStates } from \"../../../../Types\";\n\nexport function updateAccordionTriggerAriaAttributes(accordionId: string, accordionTriggersClass: string, accordionStates: AccordionStates[], clickedTriggerIndex: number): void {\n const accordionDiv: HTMLElement | null = document.querySelector(`#${accordionId}`);\n if (!accordionDiv) {\n throw new Error(\"Invalid accordion main div id provided.\");\n }\n\n const accordionItems: HTMLElement[] = Array.from(accordionDiv.querySelectorAll(`.${accordionTriggersClass}`));\n if (accordionItems.length === 0) {\n throw new Error(\"Invalid accordion items shared class provided.\");\n }\n\n if (accordionItems.length !== accordionStates.length) {\n throw new Error(`Accordion state/DOM length mismatch: found ${accordionItems.length} triggers, but got ${accordionStates.length} state objects.`);\n }\n\n accordionItems.forEach((accordionItem: HTMLElement, index: number) => {\n const state = accordionStates[index];\n const expanded = accordionItem.getAttribute(\"aria-expanded\");\n const shouldBeExpanded = index === clickedTriggerIndex ? (state.display ? \"true\" : \"false\") : \"false\";\n if (expanded && expanded !== shouldBeExpanded) {\n accordionItem.setAttribute(\"aria-expanded\", shouldBeExpanded);\n }\n });\n}"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/macx/aria-ease/package/dist/chunk-RK3JUAFZ.js","../src/checkbox/src/updateCheckboxAriaAttributes/updateCheckboxAriaAttributes.ts"],"names":["updateCheckboxAriaAttributes","checkboxId","checkboxesClass","checkboxStates","currentPressedCheckboxIndex","checkboxDiv","document","querySelector","Error","checkboxItems","Array","from","querySelectorAll","length","forEach","checkbox","index","setAttribute","checked"],"mappings":"AAAA,gFAAgF;ACUzE,SAASA,6BAA6BC,UAAA,EAAoBC,eAAA,EAAyBC,cAAA,EAAkCC,2BAAA;QACpHC,cAAkCC,SAASC,aAAA,CAAc,IAAc,CAAVN,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA;oGAC7E,CAAA,CAAA,CAAA,CAAI,CAACI,CAAAA,EAAAA,EAAAA,EAAAA,EAAAA,EAAAA,EAAa;wMAChB,EAAA,EAAA,EAAM,EAAA,EAAIG,EAAAA,IAAM;oGAClB;QAEMC,gBAA+BC,MAAMC,IAAA,CAAKL,SAASM,gBAAA,CAAiB,IAAIV,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAe,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAfA,CAAAA;oGAC9E,CAAA,CAAA,CAAA,CAAIO,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAcI,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,EAAG;wMAC9B,EAAA,EAAA,EAAM,EAAA,EAAIL,EAAAA,IAAM;oGAClB;4YAEAC,SAAAA,CAAAA,SAAAA,CAAAA,SAAAA,CAAAA,SAAAA,CAAAA,SAAAA,CAAAA,SAAAA,CAAAA,SAAAA,CAAcK,SAAAA,CAAAA,SAAAA,CAAAA,SAAAA,CAAAA,SAAA,CAAQ,SAACC,UAAuBC;wMAC5C,EAAA,CAAA,CAAIA,EAAAA,CAAAA,GAAAA,CAAAA,GAAUZ,CAAAA,IAAAA,IAAAA,IAAAA,IAAAA,IAAAA,IAAAA,IAA6B;4SACzCW,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAASE,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA,CAAa,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAgBd,EAAAA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAAA,CAAAA,GAAA,CAAea,CAAAA,CAAAA,GAAAA,CAAK,CAAEE,CAAAA,GAAAA,GAAA,GAAU,GAAA,MAAS;wMACjF;oGACF;AACF","sourcesContent":["// src/checkbox/src/updateCheckboxAriaAttributes/updateCheckboxAriaAttributes.ts\nfunction updateCheckboxAriaAttributes(checkboxId, checkboxesClass, checkboxStates, currentPressedCheckboxIndex) {\n const checkboxDiv = document.querySelector(`#${checkboxId}`);\n if (!checkboxDiv) {\n throw new Error(\"Invalid checkbox main div id provided.\");\n }\n const checkboxItems = Array.from(document.querySelectorAll(`.${checkboxesClass}`));\n if (checkboxItems.length === 0) {\n throw new Error(\"Invalid checkboxes shared class provided.\");\n }\n checkboxItems.forEach((checkbox, index) => {\n if (index === currentPressedCheckboxIndex) {\n checkbox.setAttribute(\"aria-checked\", checkboxStates[index].checked ? \"true\" : \"false\");\n }\n });\n}\n\nexport { updateCheckboxAriaAttributes };\n//# sourceMappingURL=chunk-RK3JUAFZ.js.map\n","/**\n * Adds screen reader accessibility to multiple checkboxes. Updates the aria attributes of the checkboxes. Checkbox elements must possess the following aria attributes; aria-checked and aria-label.\n * @param {string} checkboxId The id of the checkbox parent container.\n * @param {string} checkboxesClass The shared class of all the checkboxes.\n * @param {CheckboxStates[]} checkboxStates Array of objects containing checkboxes state information.\n * @param {number} currentPressedCheckboxIndex Index of the currently checked or unchecked checkbox.\n*/\n\nimport { HTMLElement, CheckboxStates } from \"../../../../Types\";\n\nexport function updateCheckboxAriaAttributes(checkboxId: string, checkboxesClass: string, checkboxStates: CheckboxStates[], currentPressedCheckboxIndex: number): void {\n const checkboxDiv: HTMLElement | null = document.querySelector(`#${checkboxId}`);\n if (!checkboxDiv) {\n throw new Error(\"Invalid checkbox main div id provided.\");\n }\n \n const checkboxItems: HTMLElement[] = Array.from(document.querySelectorAll(`.${checkboxesClass}`));\n if (checkboxItems.length === 0) {\n throw new Error('Invalid checkboxes shared class provided.');\n };\n\n checkboxItems.forEach((checkbox: HTMLElement, index: number) => {\n if (index === currentPressedCheckboxIndex) {\n checkbox.setAttribute(\"aria-checked\", checkboxStates[index].checked ? 'true' : 'false');\n }\n });\n}"]}
1
+ {"version":3,"sources":["/Users/macx/aria-ease/package/dist/chunk-RK3JUAFZ.js","../src/checkbox/src/updateCheckboxAriaAttributes/updateCheckboxAriaAttributes.ts"],"names":["updateCheckboxAriaAttributes","checkboxId","checkboxesClass","checkboxStates","currentPressedCheckboxIndex","checkboxDiv","document","querySelector","Error","checkboxItems","Array","from","querySelectorAll","length","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,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAASE,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA,CAAa,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAgBd,EAAAA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAAA,CAAAA,GAAA,CAAea,CAAAA,CAAAA,GAAAA,CAAK,CAAEE,CAAAA,GAAAA,GAAA,GAAU,GAAA,MAAS;4OACjF;sHACF;AACF","sourcesContent":["// src/checkbox/src/updateCheckboxAriaAttributes/updateCheckboxAriaAttributes.ts\nfunction updateCheckboxAriaAttributes(checkboxId, checkboxesClass, checkboxStates, currentPressedCheckboxIndex) {\n const checkboxDiv = document.querySelector(`#${checkboxId}`);\n if (!checkboxDiv) {\n throw new Error(\"Invalid checkbox main div id provided.\");\n }\n const checkboxItems = Array.from(document.querySelectorAll(`.${checkboxesClass}`));\n if (checkboxItems.length === 0) {\n throw new Error(\"Invalid checkboxes shared class provided.\");\n }\n checkboxItems.forEach((checkbox, index) => {\n if (index === currentPressedCheckboxIndex) {\n checkbox.setAttribute(\"aria-checked\", checkboxStates[index].checked ? \"true\" : \"false\");\n }\n });\n}\n\nexport { updateCheckboxAriaAttributes };\n//# sourceMappingURL=chunk-RK3JUAFZ.js.map\n","/**\n * Adds screen reader accessibility to multiple checkboxes. Updates the aria attributes of the checkboxes. Checkbox elements must possess the following aria attributes; aria-checked and aria-label.\n * @param {string} checkboxId The id of the checkbox parent container.\n * @param {string} checkboxesClass The shared class of all the checkboxes.\n * @param {CheckboxStates[]} checkboxStates Array of objects containing checkboxes state information.\n * @param {number} currentPressedCheckboxIndex Index of the currently checked or unchecked checkbox.\n*/\n\nimport { HTMLElement, CheckboxStates } from \"../../../../Types\";\n\nexport function updateCheckboxAriaAttributes(checkboxId: string, checkboxesClass: string, checkboxStates: CheckboxStates[], currentPressedCheckboxIndex: number): void {\n const checkboxDiv: HTMLElement | null = document.querySelector(`#${checkboxId}`);\n if (!checkboxDiv) {\n throw new Error(\"Invalid checkbox main div id provided.\");\n }\n \n const checkboxItems: HTMLElement[] = Array.from(document.querySelectorAll(`.${checkboxesClass}`));\n if (checkboxItems.length === 0) {\n throw new Error('Invalid checkboxes shared class provided.');\n };\n\n checkboxItems.forEach((checkbox: HTMLElement, index: number) => {\n if (index === currentPressedCheckboxIndex) {\n checkbox.setAttribute(\"aria-checked\", checkboxStates[index].checked ? 'true' : 'false');\n }\n });\n}"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/macx/aria-ease/package/dist/chunk-RT5IROW4.js","../src/utils/handleKeyPress/handleKeyPress.ts"],"names":["isTextInput","el","tagName","type"],"mappings":"AAAA,6CAA6C;ACG7C,SAASA,YAAYC,EAAA;oGACjB,CAAA,CAAA,CAAA,CAAIA,CAAAA,CAAAA,CAAGC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,EAAA,EAAA,EAAO;QAC7BC,OAAQF,GAAwBE,IAAA","sourcesContent":["// src/utils/handleKeyPress/handleKeyPress.ts\nfunction isTextInput(el) {\n if (el.tagName !== \"INPUT\") return false;\n const type = el.type;\n return [\"text\", \"email\", \"password\", \"tel\", \"number\"].includes(type);\n}\nfunction isTextArea(el) {\n return el.tagName === \"TEXTAREA\";\n}\nfunction isNativeButton(el) {\n return el.tagName === \"BUTTON\" || el.tagName === \"INPUT\" && [\"button\", \"submit\", \"reset\"].includes(el.type);\n}\nfunction isLink(el) {\n return el.tagName === \"A\";\n}\nfunction moveFocus(elementItems, currentIndex, direction) {\n const len = elementItems.length;\n const nextIndex = (currentIndex + direction + len) % len;\n elementItems.item(nextIndex).focus();\n}\nfunction isClickableButNotSemantic(el) {\n return el.getAttribute(\"data-custom-click\") !== null || el.getAttribute(\"data-custom-click\") !== void 0;\n}\nfunction handleMenuEscapeKeyPress(menuElement, menuTriggerButton) {\n menuElement.style.display = \"none\";\n const menuTriggerButtonId = menuTriggerButton.getAttribute(\"id\");\n if (!menuTriggerButtonId) {\n throw new Error(\"Menu trigger button does not have id attribute\");\n }\n menuTriggerButton.setAttribute(\"aria-expanded\", \"false\");\n}\nfunction handleKeyPress(event, elementItems, elementItemIndex, menuElementDiv, triggerButton) {\n const currentEl = elementItems.item(elementItemIndex);\n switch (event.key) {\n case \"ArrowUp\":\n case \"ArrowLeft\": {\n if (!isTextInput(currentEl) && !isTextArea(currentEl)) {\n event.preventDefault();\n moveFocus(elementItems, elementItemIndex, -1);\n } else if (isTextInput(currentEl) || isTextArea(currentEl)) {\n const cursorStart = currentEl.selectionStart;\n if (cursorStart === 0) {\n event.preventDefault();\n moveFocus(elementItems, elementItemIndex, -1);\n }\n }\n break;\n }\n case \"ArrowDown\":\n case \"ArrowRight\": {\n if (!isTextInput(currentEl) && !isTextArea(currentEl)) {\n event.preventDefault();\n moveFocus(elementItems, elementItemIndex, 1);\n } else if (isTextInput(currentEl) || isTextArea(currentEl)) {\n const value = currentEl.value;\n const cursorEnd = currentEl.selectionStart;\n if (cursorEnd === value.length) {\n event.preventDefault();\n moveFocus(elementItems, elementItemIndex, 1);\n }\n }\n break;\n }\n case \"Escape\": {\n event.preventDefault();\n if (menuElementDiv && triggerButton) {\n if (getComputedStyle(menuElementDiv).display === \"block\") {\n handleMenuEscapeKeyPress(menuElementDiv, triggerButton);\n }\n triggerButton.focus();\n }\n break;\n }\n case \"Enter\":\n case \" \": {\n if (!isNativeButton(currentEl) && !isLink(currentEl) && isClickableButNotSemantic(currentEl)) {\n event.preventDefault();\n currentEl.click();\n }\n break;\n }\n }\n}\n\nexport { handleKeyPress };\n//# sourceMappingURL=chunk-RT5IROW4.js.map\n","import { NodeListOfHTMLElement, HTMLElement } from \"../../../Types\";\n\n\nfunction isTextInput(el: HTMLElement): boolean {\n if (el.tagName !== 'INPUT') return false;\n const type = (el as HTMLInputElement).type;\n return ['text', 'email', 'password', 'tel', 'number'].includes(type);\n}\n\nfunction isTextArea(el: HTMLElement): boolean {\n return el.tagName === 'TEXTAREA';\n}\n\nexport function isNativeButton(el: HTMLElement): boolean {\n return el.tagName === 'BUTTON' || (el.tagName === 'INPUT' && ['button', 'submit', 'reset'].includes((el as HTMLInputElement).type));\n}\n\nexport function isLink(el: HTMLElement): boolean {\n return el.tagName === 'A';\n}\n\nfunction moveFocus(elementItems: NodeListOfHTMLElement, currentIndex: number, direction: -1 | 1) {\n const len = elementItems.length;\n const nextIndex = (currentIndex + direction + len) % len;\n elementItems.item(nextIndex).focus();\n}\n\nfunction isClickableButNotSemantic(el: HTMLElement): boolean {\n return el.getAttribute(\"data-custom-click\") !== null || el.getAttribute(\"data-custom-click\") !== undefined;\n}\n\nfunction handleMenuEscapeKeyPress(menuElement: HTMLElement, menuTriggerButton: HTMLElement) {\n menuElement.style.display = 'none';\n const menuTriggerButtonId = menuTriggerButton.getAttribute('id');\n if (!menuTriggerButtonId) {\n throw new Error(\"Menu trigger button does not have id attribute\");\n }\n menuTriggerButton.setAttribute(\"aria-expanded\", \"false\");\n}\n\nexport function handleKeyPress(\n event: KeyboardEvent,\n elementItems: NodeListOfHTMLElement,\n elementItemIndex: number,\n menuElementDiv?: HTMLElement,\n triggerButton?: HTMLElement\n): void {\n const currentEl = elementItems.item(elementItemIndex);\n switch (event.key) {\n case 'ArrowUp':\n case 'ArrowLeft': {\n if (!isTextInput(currentEl) && !isTextArea(currentEl)) {\n event.preventDefault();\n moveFocus(elementItems, elementItemIndex, -1);\n } else if (isTextInput(currentEl) || isTextArea(currentEl)) {\n const cursorStart = (currentEl as HTMLInputElement | HTMLTextAreaElement).selectionStart;\n if (cursorStart === 0) {\n event.preventDefault();\n moveFocus(elementItems, elementItemIndex, -1);\n }\n }\n break;\n }\n case 'ArrowDown':\n case 'ArrowRight': {\n if (!isTextInput(currentEl) && !isTextArea(currentEl)) {\n event.preventDefault();\n moveFocus(elementItems, elementItemIndex, 1);\n } else if (isTextInput(currentEl) || isTextArea(currentEl)) {\n const value = (currentEl as HTMLInputElement | HTMLTextAreaElement).value;\n const cursorEnd = (currentEl as HTMLInputElement | HTMLTextAreaElement).selectionStart;\n if (cursorEnd === value.length) {\n event.preventDefault();\n moveFocus(elementItems, elementItemIndex, 1);\n }\n }\n break;\n }\n case 'Escape': {\n event.preventDefault();\n if (menuElementDiv && triggerButton) {\n if (getComputedStyle(menuElementDiv).display === 'block') {\n handleMenuEscapeKeyPress(menuElementDiv, triggerButton);\n }\n triggerButton.focus();\n }\n break;\n }\n case 'Enter':\n case ' ': {\n if (!isNativeButton(currentEl) && !isLink(currentEl) && isClickableButNotSemantic(currentEl)) {\n event.preventDefault();\n currentEl.click();\n }\n break;\n }\n default:\n break;\n }\n}"]}
1
+ {"version":3,"sources":["/Users/macx/aria-ease/package/dist/chunk-RT5IROW4.js","../src/utils/handleKeyPress/handleKeyPress.ts"],"names":["isTextInput","el","tagName","type"],"mappings":"AAAA,6CAA6C;ACG7C,SAASA,YAAYC,EAAA;sHACjB,CAAA,CAAA,CAAA,CAAIA,CAAAA,CAAAA,CAAGC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,EAAA,EAAA,EAAO;QAC7BC,OAAQF,GAAwBE,IAAA","sourcesContent":["// src/utils/handleKeyPress/handleKeyPress.ts\nfunction isTextInput(el) {\n if (el.tagName !== \"INPUT\") return false;\n const type = el.type;\n return [\"text\", \"email\", \"password\", \"tel\", \"number\"].includes(type);\n}\nfunction isTextArea(el) {\n return el.tagName === \"TEXTAREA\";\n}\nfunction isNativeButton(el) {\n return el.tagName === \"BUTTON\" || el.tagName === \"INPUT\" && [\"button\", \"submit\", \"reset\"].includes(el.type);\n}\nfunction isLink(el) {\n return el.tagName === \"A\";\n}\nfunction moveFocus(elementItems, currentIndex, direction) {\n const len = elementItems.length;\n const nextIndex = (currentIndex + direction + len) % len;\n elementItems.item(nextIndex).focus();\n}\nfunction isClickableButNotSemantic(el) {\n return el.getAttribute(\"data-custom-click\") !== null || el.getAttribute(\"data-custom-click\") !== void 0;\n}\nfunction handleMenuEscapeKeyPress(menuElement, menuTriggerButton) {\n menuElement.style.display = \"none\";\n const menuTriggerButtonId = menuTriggerButton.getAttribute(\"id\");\n if (!menuTriggerButtonId) {\n throw new Error(\"Menu trigger button does not have id attribute\");\n }\n menuTriggerButton.setAttribute(\"aria-expanded\", \"false\");\n}\nfunction handleKeyPress(event, elementItems, elementItemIndex, menuElementDiv, triggerButton) {\n const currentEl = elementItems.item(elementItemIndex);\n switch (event.key) {\n case \"ArrowUp\":\n case \"ArrowLeft\": {\n if (!isTextInput(currentEl) && !isTextArea(currentEl)) {\n event.preventDefault();\n moveFocus(elementItems, elementItemIndex, -1);\n } else if (isTextInput(currentEl) || isTextArea(currentEl)) {\n const cursorStart = currentEl.selectionStart;\n if (cursorStart === 0) {\n event.preventDefault();\n moveFocus(elementItems, elementItemIndex, -1);\n }\n }\n break;\n }\n case \"ArrowDown\":\n case \"ArrowRight\": {\n if (!isTextInput(currentEl) && !isTextArea(currentEl)) {\n event.preventDefault();\n moveFocus(elementItems, elementItemIndex, 1);\n } else if (isTextInput(currentEl) || isTextArea(currentEl)) {\n const value = currentEl.value;\n const cursorEnd = currentEl.selectionStart;\n if (cursorEnd === value.length) {\n event.preventDefault();\n moveFocus(elementItems, elementItemIndex, 1);\n }\n }\n break;\n }\n case \"Escape\": {\n event.preventDefault();\n if (menuElementDiv && triggerButton) {\n if (getComputedStyle(menuElementDiv).display === \"block\") {\n handleMenuEscapeKeyPress(menuElementDiv, triggerButton);\n }\n triggerButton.focus();\n }\n break;\n }\n case \"Enter\":\n case \" \": {\n if (!isNativeButton(currentEl) && !isLink(currentEl) && isClickableButNotSemantic(currentEl)) {\n event.preventDefault();\n currentEl.click();\n }\n break;\n }\n }\n}\n\nexport { handleKeyPress };\n//# sourceMappingURL=chunk-RT5IROW4.js.map\n","import { NodeListOfHTMLElement, HTMLElement } from \"../../../Types\";\n\n\nfunction isTextInput(el: HTMLElement): boolean {\n if (el.tagName !== 'INPUT') return false;\n const type = (el as HTMLInputElement).type;\n return ['text', 'email', 'password', 'tel', 'number'].includes(type);\n}\n\nfunction isTextArea(el: HTMLElement): boolean {\n return el.tagName === 'TEXTAREA';\n}\n\nexport function isNativeButton(el: HTMLElement): boolean {\n return el.tagName === 'BUTTON' || (el.tagName === 'INPUT' && ['button', 'submit', 'reset'].includes((el as HTMLInputElement).type));\n}\n\nexport function isLink(el: HTMLElement): boolean {\n return el.tagName === 'A';\n}\n\nfunction moveFocus(elementItems: NodeListOfHTMLElement, currentIndex: number, direction: -1 | 1) {\n const len = elementItems.length;\n const nextIndex = (currentIndex + direction + len) % len;\n elementItems.item(nextIndex).focus();\n}\n\nfunction isClickableButNotSemantic(el: HTMLElement): boolean {\n return el.getAttribute(\"data-custom-click\") !== null || el.getAttribute(\"data-custom-click\") !== undefined;\n}\n\nfunction handleMenuEscapeKeyPress(menuElement: HTMLElement, menuTriggerButton: HTMLElement) {\n menuElement.style.display = 'none';\n const menuTriggerButtonId = menuTriggerButton.getAttribute('id');\n if (!menuTriggerButtonId) {\n throw new Error(\"Menu trigger button does not have id attribute\");\n }\n menuTriggerButton.setAttribute(\"aria-expanded\", \"false\");\n}\n\nexport function handleKeyPress(\n event: KeyboardEvent,\n elementItems: NodeListOfHTMLElement,\n elementItemIndex: number,\n menuElementDiv?: HTMLElement,\n triggerButton?: HTMLElement\n): void {\n const currentEl = elementItems.item(elementItemIndex);\n switch (event.key) {\n case 'ArrowUp':\n case 'ArrowLeft': {\n if (!isTextInput(currentEl) && !isTextArea(currentEl)) {\n event.preventDefault();\n moveFocus(elementItems, elementItemIndex, -1);\n } else if (isTextInput(currentEl) || isTextArea(currentEl)) {\n const cursorStart = (currentEl as HTMLInputElement | HTMLTextAreaElement).selectionStart;\n if (cursorStart === 0) {\n event.preventDefault();\n moveFocus(elementItems, elementItemIndex, -1);\n }\n }\n break;\n }\n case 'ArrowDown':\n case 'ArrowRight': {\n if (!isTextInput(currentEl) && !isTextArea(currentEl)) {\n event.preventDefault();\n moveFocus(elementItems, elementItemIndex, 1);\n } else if (isTextInput(currentEl) || isTextArea(currentEl)) {\n const value = (currentEl as HTMLInputElement | HTMLTextAreaElement).value;\n const cursorEnd = (currentEl as HTMLInputElement | HTMLTextAreaElement).selectionStart;\n if (cursorEnd === value.length) {\n event.preventDefault();\n moveFocus(elementItems, elementItemIndex, 1);\n }\n }\n break;\n }\n case 'Escape': {\n event.preventDefault();\n if (menuElementDiv && triggerButton) {\n if (getComputedStyle(menuElementDiv).display === 'block') {\n handleMenuEscapeKeyPress(menuElementDiv, triggerButton);\n }\n triggerButton.focus();\n }\n break;\n }\n case 'Enter':\n case ' ': {\n if (!isNativeButton(currentEl) && !isLink(currentEl) && isClickableButNotSemantic(currentEl)) {\n event.preventDefault();\n currentEl.click();\n }\n break;\n }\n default:\n break;\n }\n}"]}
@@ -144,8 +144,8 @@ function runAudit(url) {
144
144
  _state.trys.push([
145
145
  0,
146
146
  6,
147
- ,
148
- 7
147
+ 7,
148
+ 10
149
149
  ]);
150
150
  return [
151
151
  4,
@@ -190,18 +190,22 @@ function runAudit(url) {
190
190
  ];
191
191
  case 6:
192
192
  error = _state.sent();
193
- if (_instanceof(error, Error) && error.message.includes("Executable doesn't exist")) {
194
- console.error("\n\u274C Playwright browsers not found!\n");
195
- console.log("\uD83D\uDCE6 First-time setup required:");
196
- console.log(" Run: npx playwright install chromium\n");
197
- console.log("\uD83D\uDCA1 This downloads the browser needed for auditing (~200MB)");
198
- console.log(" You only need to do this once.\n");
193
+ if (_instanceof(error, Error)) {
194
+ if (error.message.includes("Executable doesn't exist")) {
195
+ console.error("\n\u274C Playwright browsers not found!\n");
196
+ console.log("\uD83D\uDCE6 First-time setup required:");
197
+ console.log(" Run: npx playwright install chromium\n");
198
+ console.log("\uD83D\uDCA1 This downloads the browser needed for auditing (~200MB)");
199
+ console.log(" You only need to do this once.\n");
200
+ } else if (error.message.includes("page.goto: net::ERR_CONNECTION_REFUSED")) {
201
+ console.error("\n\u274C Server Not Running!\n");
202
+ console.log(" Make sure your server is running before auditing URL");
203
+ console.log(" Run: npm run dev # or your start command");
204
+ }
199
205
  process.exit(1);
200
206
  }
201
- return [
202
- 3,
203
- 7
204
- ];
207
+ console.error("Error during audit:", error);
208
+ throw error;
205
209
  case 7:
206
210
  if (!browser) return [
207
211
  3,
@@ -215,6 +219,10 @@ function runAudit(url) {
215
219
  _state.sent();
216
220
  _state.label = 9;
217
221
  case 9:
222
+ return [
223
+ 7
224
+ ];
225
+ case 10:
218
226
  return [
219
227
  2
220
228
  ];
@@ -1,5 +1,5 @@
1
1
  import * as axe_core from 'axe-core';
2
2
 
3
- declare function runAudit(url: string): Promise<axe_core.AxeResults | undefined>;
3
+ declare function runAudit(url: string): Promise<axe_core.AxeResults>;
4
4
 
5
5
  export { runAudit };
@@ -1,5 +1,5 @@
1
1
  import * as axe_core from 'axe-core';
2
2
 
3
- declare function runAudit(url: string): Promise<axe_core.AxeResults | undefined>;
3
+ declare function runAudit(url: string): Promise<axe_core.AxeResults>;
4
4
 
5
5
  export { runAudit };
@@ -137,8 +137,8 @@ function runAudit(url) {
137
137
  _state.trys.push([
138
138
  0,
139
139
  6,
140
- ,
141
- 7
140
+ 7,
141
+ 10
142
142
  ]);
143
143
  return [
144
144
  4,
@@ -183,18 +183,22 @@ function runAudit(url) {
183
183
  ];
184
184
  case 6:
185
185
  error = _state.sent();
186
- if (_instanceof(error, Error) && error.message.includes("Executable doesn't exist")) {
187
- console.error("\n\u274C Playwright browsers not found!\n");
188
- console.log("\uD83D\uDCE6 First-time setup required:");
189
- console.log(" Run: npx playwright install chromium\n");
190
- console.log("\uD83D\uDCA1 This downloads the browser needed for auditing (~200MB)");
191
- console.log(" You only need to do this once.\n");
186
+ if (_instanceof(error, Error)) {
187
+ if (error.message.includes("Executable doesn't exist")) {
188
+ console.error("\n\u274C Playwright browsers not found!\n");
189
+ console.log("\uD83D\uDCE6 First-time setup required:");
190
+ console.log(" Run: npx playwright install chromium\n");
191
+ console.log("\uD83D\uDCA1 This downloads the browser needed for auditing (~200MB)");
192
+ console.log(" You only need to do this once.\n");
193
+ } else if (error.message.includes("page.goto: net::ERR_CONNECTION_REFUSED")) {
194
+ console.error("\n\u274C Server Not Running!\n");
195
+ console.log(" Make sure your server is running before auditing URL");
196
+ console.log(" Run: npm run dev # or your start command");
197
+ }
192
198
  process.exit(1);
193
199
  }
194
- return [
195
- 3,
196
- 7
197
- ];
200
+ console.error("Error during audit:", error);
201
+ throw error;
198
202
  case 7:
199
203
  if (!browser) return [
200
204
  3,
@@ -208,6 +212,10 @@ function runAudit(url) {
208
212
  _state.sent();
209
213
  _state.label = 9;
210
214
  case 9:
215
+ return [
216
+ 7
217
+ ];
218
+ case 10:
211
219
  return [
212
220
  2
213
221
  ];
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/macx/aria-ease/package/dist/src/utils/audit/audit.js","../../../../src/utils/audit/audit.ts"],"names":[],"mappings":"","sourcesContent":["import AxeBuilder from '@axe-core/playwright';\nimport { chromium } from 'playwright';\n\n// src/utils/audit/audit.ts\nasync function runAudit() {\n const browser = await chromium.launch({ headless: true });\n const context = await browser.newContext();\n const page = await context.newPage();\n await page.goto(\"http://localhost:5173/\");\n try {\n const axe = new AxeBuilder({ page });\n const axeResults = await axe.analyze();\n console.log(\"--- AXE-CORE RESULTS ---\");\n console.log(axeResults);\n const snapshot = await page.accessibility.snapshot();\n console.log(\"\\n--- PLAYWRIGHT SNAPSHOT ---\");\n console.log(snapshot);\n } catch (error) {\n console.log(error);\n }\n await browser.close();\n}\n\nexport { runAudit };\n//# sourceMappingURL=audit.js.map\n","import AxeBuilder from \"@axe-core/playwright\";\nimport { chromium } from \"playwright\";\nimport { AxeResults } from \"Types\";\n\nexport async function runAudit(url: string) {\n let browser; \n\n try{\n browser = await chromium.launch({ headless: true });\n const context = await browser.newContext();\n const page = await context.newPage();\n await page.goto(url, { waitUntil: 'networkidle' });\n const axe = new AxeBuilder({ page });\n const axeResults: AxeResults = await axe.analyze();\n return axeResults;\n } catch(error: unknown) {\n if (error instanceof Error && error.message.includes(\"Executable doesn't exist\")) {\n console.error('\\n❌ Playwright browsers not found!\\n');\n console.log('📦 First-time setup required:');\n console.log(' Run: npx playwright install chromium\\n');\n console.log('💡 This downloads the browser needed for auditing (~200MB)');\n console.log(' You only need to do this once.\\n');\n process.exit(1);\n }\n \n }\n \n if(browser) await browser.close(); \n}"]}
1
+ {"version":3,"sources":["/Users/macx/aria-ease/package/dist/src/utils/audit/audit.js","../../../../src/utils/audit/audit.ts"],"names":[],"mappings":"","sourcesContent":["import AxeBuilder from '@axe-core/playwright';\nimport { chromium } from 'playwright';\n\n// src/utils/audit/audit.ts\nasync function runAudit() {\n const browser = await chromium.launch({ headless: true });\n const context = await browser.newContext();\n const page = await context.newPage();\n await page.goto(\"http://localhost:5173/\");\n try {\n const axe = new AxeBuilder({ page });\n const axeResults = await axe.analyze();\n console.log(\"--- AXE-CORE RESULTS ---\");\n console.log(axeResults);\n const snapshot = await page.accessibility.snapshot();\n console.log(\"\\n--- PLAYWRIGHT SNAPSHOT ---\");\n console.log(snapshot);\n } catch (error) {\n console.log(error);\n }\n await browser.close();\n}\n\nexport { runAudit };\n//# sourceMappingURL=audit.js.map\n","import AxeBuilder from \"@axe-core/playwright\";\nimport { chromium } from \"playwright\";\nimport { AxeResults } from \"Types\";\n\nexport async function runAudit(url: string) {\n let browser;\n\n try{ \n browser = await chromium.launch({ headless: true });\n const context = await browser.newContext();\n const page = await context.newPage();\n await page.goto(url, { waitUntil: 'networkidle' });\n const axe = new AxeBuilder({ page });\n const axeResults: AxeResults = await axe.analyze();\n return axeResults;\n } catch(error: unknown) {\n if (error instanceof Error) {\n if (error.message.includes(\"Executable doesn't exist\")) {\n console.error('\\n❌ Playwright browsers not found!\\n');\n console.log('📦 First-time setup required:');\n console.log(' Run: npx playwright install chromium\\n');\n console.log('💡 This downloads the browser needed for auditing (~200MB)');\n console.log(' You only need to do this once.\\n');\n } else if(error.message.includes(\"page.goto: net::ERR_CONNECTION_REFUSED\")) {\n console.error('\\n❌ Server Not Running!\\n');\n console.log(' Make sure your server is running before auditing URL')\n console.log(' Run: npm run dev # or your start command');\n }\n process.exit(1);\n }\n console.error('Error during audit:', error);\n throw error;\n } finally {\n if(browser) await browser.close(); \n }\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aria-ease",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "Out-of-the-box accessibility utility package to develop production ready applications.",
5
5
  "main": "dist/index.cjs",
6
6
  "type": "module",
@@ -35,7 +35,7 @@
35
35
  "bugs": {
36
36
  "url": "https://github.com/aria-ease/aria-ease/issues"
37
37
  },
38
- "homepage": "https://ariaease.web.app/docs",
38
+ "homepage": "https://ariaease.site/docs",
39
39
  "devDependencies": {
40
40
  "@swc/core": "^1.13.5",
41
41
  "@testing-library/dom": "^10.4.1",