aria-ease 2.2.0 ā 2.2.1
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/bin/audit-cli.cjs +40 -15
- package/bin/audit-cli.js +40 -15
- package/bin/audit-cli.js.map +1 -1
- package/bin/audit-cli.ts +1 -1
- package/dist/chunk-5HQ6LLC5.js.map +1 -1
- package/dist/chunk-FBQ5LF2T.js.map +1 -1
- package/dist/chunk-KVTLMA4J.js.map +1 -1
- package/dist/chunk-MEA5U2G4.js.map +1 -1
- package/dist/chunk-RK3JUAFZ.js.map +1 -1
- package/dist/chunk-RT5IROW4.js.map +1 -1
- package/dist/src/utils/audit/audit.cjs +32 -14
- package/dist/src/utils/audit/audit.js +32 -14
- package/dist/src/utils/audit/audit.js.map +1 -1
- package/package.json +9 -1
package/bin/audit-cli.cjs
CHANGED
|
@@ -40,6 +40,13 @@ function _async_to_generator(fn) {
|
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
+
function _instanceof(left, right) {
|
|
44
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
45
|
+
return !!right[Symbol.hasInstance](left);
|
|
46
|
+
} else {
|
|
47
|
+
return left instanceof right;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
43
50
|
function _getRequireWildcardCache(nodeInterop) {
|
|
44
51
|
if (typeof WeakMap !== "function") return null;
|
|
45
52
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -307,6 +314,13 @@ function _async_to_generator1(fn) {
|
|
|
307
314
|
});
|
|
308
315
|
};
|
|
309
316
|
}
|
|
317
|
+
function _instanceof1(left, right) {
|
|
318
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
319
|
+
return !!right[Symbol.hasInstance](left);
|
|
320
|
+
} else {
|
|
321
|
+
return _instanceof(left, right);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
310
324
|
function _ts_generator1(thisArg, body) {
|
|
311
325
|
var f, y, t, _ = {
|
|
312
326
|
label: 0,
|
|
@@ -404,6 +418,12 @@ function runAudit(url) {
|
|
|
404
418
|
return _ts_generator1(this, function(_state) {
|
|
405
419
|
switch(_state.label){
|
|
406
420
|
case 0:
|
|
421
|
+
_state.trys.push([
|
|
422
|
+
0,
|
|
423
|
+
6,
|
|
424
|
+
,
|
|
425
|
+
7
|
|
426
|
+
]);
|
|
407
427
|
return [
|
|
408
428
|
4,
|
|
409
429
|
import_playwright2.chromium.launch({
|
|
@@ -432,14 +452,6 @@ function runAudit(url) {
|
|
|
432
452
|
];
|
|
433
453
|
case 4:
|
|
434
454
|
_state.sent();
|
|
435
|
-
_state.label = 5;
|
|
436
|
-
case 5:
|
|
437
|
-
_state.trys.push([
|
|
438
|
-
5,
|
|
439
|
-
7,
|
|
440
|
-
,
|
|
441
|
-
8
|
|
442
|
-
]);
|
|
443
455
|
axe = new import_playwright.default({
|
|
444
456
|
page: page
|
|
445
457
|
});
|
|
@@ -447,26 +459,39 @@ function runAudit(url) {
|
|
|
447
459
|
4,
|
|
448
460
|
axe.analyze()
|
|
449
461
|
];
|
|
450
|
-
case
|
|
462
|
+
case 5:
|
|
451
463
|
axeResults = _state.sent();
|
|
452
464
|
return [
|
|
453
465
|
2,
|
|
454
466
|
axeResults
|
|
455
467
|
];
|
|
456
|
-
case
|
|
468
|
+
case 6:
|
|
457
469
|
error = _state.sent();
|
|
458
|
-
|
|
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");
|
|
476
|
+
process.exit(1);
|
|
477
|
+
}
|
|
459
478
|
return [
|
|
460
479
|
3,
|
|
461
|
-
|
|
480
|
+
7
|
|
481
|
+
];
|
|
482
|
+
case 7:
|
|
483
|
+
if (!browser) return [
|
|
484
|
+
3,
|
|
485
|
+
9
|
|
462
486
|
];
|
|
463
|
-
case 8:
|
|
464
487
|
return [
|
|
465
488
|
4,
|
|
466
489
|
browser.close()
|
|
467
490
|
];
|
|
468
|
-
case
|
|
491
|
+
case 8:
|
|
469
492
|
_state.sent();
|
|
493
|
+
_state.label = 9;
|
|
494
|
+
case 9:
|
|
470
495
|
return [
|
|
471
496
|
2
|
|
472
497
|
];
|
|
@@ -664,7 +689,7 @@ program.command("audit").description("Run axe-core powered accessibility audit o
|
|
|
664
689
|
6
|
|
665
690
|
];
|
|
666
691
|
case 5:
|
|
667
|
-
console.log(import_chalk.default.yellow("\u2139\uFE0F No ariaease.config.js found at project root, using
|
|
692
|
+
console.log(import_chalk.default.yellow("\u2139\uFE0F No ariaease.config.js found at project root, using CLI configurations."));
|
|
668
693
|
_state.label = 6;
|
|
669
694
|
case 6:
|
|
670
695
|
urls = [];
|
package/bin/audit-cli.js
CHANGED
|
@@ -39,6 +39,13 @@ function _async_to_generator(fn) {
|
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
+
function _instanceof(left, right) {
|
|
43
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
44
|
+
return !!right[Symbol.hasInstance](left);
|
|
45
|
+
} else {
|
|
46
|
+
return left instanceof right;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
42
49
|
function _iterable_to_array(iter) {
|
|
43
50
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
44
51
|
}
|
|
@@ -214,6 +221,13 @@ function _async_to_generator1(fn) {
|
|
|
214
221
|
});
|
|
215
222
|
};
|
|
216
223
|
}
|
|
224
|
+
function _instanceof1(left, right) {
|
|
225
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
226
|
+
return !!right[Symbol.hasInstance](left);
|
|
227
|
+
} else {
|
|
228
|
+
return _instanceof(left, right);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
217
231
|
function _ts_generator1(thisArg, body) {
|
|
218
232
|
var f, y, t, _ = {
|
|
219
233
|
label: 0,
|
|
@@ -311,6 +325,12 @@ function runAudit(url) {
|
|
|
311
325
|
return _ts_generator1(this, function(_state) {
|
|
312
326
|
switch(_state.label){
|
|
313
327
|
case 0:
|
|
328
|
+
_state.trys.push([
|
|
329
|
+
0,
|
|
330
|
+
6,
|
|
331
|
+
,
|
|
332
|
+
7
|
|
333
|
+
]);
|
|
314
334
|
return [
|
|
315
335
|
4,
|
|
316
336
|
chromium.launch({
|
|
@@ -339,14 +359,6 @@ function runAudit(url) {
|
|
|
339
359
|
];
|
|
340
360
|
case 4:
|
|
341
361
|
_state.sent();
|
|
342
|
-
_state.label = 5;
|
|
343
|
-
case 5:
|
|
344
|
-
_state.trys.push([
|
|
345
|
-
5,
|
|
346
|
-
7,
|
|
347
|
-
,
|
|
348
|
-
8
|
|
349
|
-
]);
|
|
350
362
|
axe = new AxeBuilder({
|
|
351
363
|
page: page
|
|
352
364
|
});
|
|
@@ -354,26 +366,39 @@ function runAudit(url) {
|
|
|
354
366
|
4,
|
|
355
367
|
axe.analyze()
|
|
356
368
|
];
|
|
357
|
-
case
|
|
369
|
+
case 5:
|
|
358
370
|
axeResults = _state.sent();
|
|
359
371
|
return [
|
|
360
372
|
2,
|
|
361
373
|
axeResults
|
|
362
374
|
];
|
|
363
|
-
case
|
|
375
|
+
case 6:
|
|
364
376
|
error = _state.sent();
|
|
365
|
-
|
|
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");
|
|
383
|
+
process.exit(1);
|
|
384
|
+
}
|
|
366
385
|
return [
|
|
367
386
|
3,
|
|
368
|
-
|
|
387
|
+
7
|
|
388
|
+
];
|
|
389
|
+
case 7:
|
|
390
|
+
if (!browser) return [
|
|
391
|
+
3,
|
|
392
|
+
9
|
|
369
393
|
];
|
|
370
|
-
case 8:
|
|
371
394
|
return [
|
|
372
395
|
4,
|
|
373
396
|
browser.close()
|
|
374
397
|
];
|
|
375
|
-
case
|
|
398
|
+
case 8:
|
|
376
399
|
_state.sent();
|
|
400
|
+
_state.label = 9;
|
|
401
|
+
case 9:
|
|
377
402
|
return [
|
|
378
403
|
2
|
|
379
404
|
];
|
|
@@ -567,7 +592,7 @@ program.command("audit").description("Run axe-core powered accessibility audit o
|
|
|
567
592
|
6
|
|
568
593
|
];
|
|
569
594
|
case 5:
|
|
570
|
-
console.log(chalk.yellow("\u2139\uFE0F No ariaease.config.js found at project root, using
|
|
595
|
+
console.log(chalk.yellow("\u2139\uFE0F No ariaease.config.js found at project root, using CLI configurations."));
|
|
571
596
|
_state.label = 6;
|
|
572
597
|
case 6:
|
|
573
598
|
urls = [];
|
package/bin/audit-cli.js.map
CHANGED
|
@@ -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 _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 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 _state.label = 5;\n case 5:\n _state.trys.push([\n 5,\n 7,\n ,\n 8\n ]);\n axe = new AxeBuilder({\n page: page\n });\n return [\n 4,\n axe.analyze()\n ];\n case 6:\n axeResults = _state.sent();\n return [\n 2,\n axeResults\n ];\n case 7:\n error = _state.sent();\n console.log(error);\n return [\n 3,\n 8\n ];\n case 8:\n return [\n 4,\n browser.close()\n ];\n case 9:\n _state.sent();\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 ,\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"]}
|
package/bin/audit-cli.ts
CHANGED
|
@@ -26,7 +26,7 @@ program.command('audit')
|
|
|
26
26
|
config = (await import(configPath)).default || (await import(configPath));
|
|
27
27
|
console.log(chalk.green('ā
Loaded config from ariaease.config.js\n'));
|
|
28
28
|
} else {
|
|
29
|
-
console.log(chalk.yellow('ā¹ļø No ariaease.config.js found at project root, using
|
|
29
|
+
console.log(chalk.yellow('ā¹ļø No ariaease.config.js found at project root, using CLI configurations.'));
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
const urls: string[] = [];
|
|
@@ -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,
|
|
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,CAAA,CAAA,CAAA,CAAI,CAACI,EAAAA,EAAAA,EAAAA,EAAAA,EAAU;wMACX,EAAA,EAAA,EAAM,EAAA,EAAIG,EAAAA,IAAM;oGACpB;QAEMC,aAA4BC,MAAMC,I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AA,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 +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","setAttribute","pressed"],"mappings":"AAAA,wEAAwE;ACUjE,SAASA,0BAA0BC,QAAA,EAAkBC,YAAA,EAAsBC,YAAA,EAA8BC,yBAAA;QACxGC,YAAgCC,SAASC,aAAA,CAAc,
|
|
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,CAAA,CAARN,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA;oGACjE,CAAA,CAAA,CAAA,CAAI,CAACI,CAAAA,EAAAA,EAAAA,EAAAA,EAAAA,EAAW;wMACd,EAAA,EAAA,EAAM,EAAA,EAAIG,EAAAA,IAAM;oGAClB;QAEMC,cAA6BC,MAAMC,IAAA,CAAKN,UAAUO,gBAAA,CAAiB,IAAgB,CAAA,CAAA,CAAZV,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAY,CAAA,CAAA,CAAA;oGACzF,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;wMAC5B,EAAA,EAAA,EAAM,EAAA,EAAIL,EAAAA,IAAM;oGAClB;oGAEA,CAAA,CAAA,CAAA,CAAGC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAYI,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAWV,CAAAA,EAAAA,EAAAA,EAAAA,EAAAA,EAAAA,EAAaU,EAAAA,EAAAA,EAAA,EAAQ;mEACsD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AAA,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;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 +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;
|
|
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,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AA6BD,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 +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,
|
|
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,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,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 +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,
|
|
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 +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;
|
|
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}"]}
|
|
@@ -28,6 +28,13 @@ function _async_to_generator(fn) {
|
|
|
28
28
|
});
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
+
function _instanceof(left, right) {
|
|
32
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
33
|
+
return !!right[Symbol.hasInstance](left);
|
|
34
|
+
} else {
|
|
35
|
+
return left instanceof right;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
31
38
|
function _ts_generator(thisArg, body) {
|
|
32
39
|
var f, y, t, _ = {
|
|
33
40
|
label: 0,
|
|
@@ -134,6 +141,12 @@ function runAudit(url) {
|
|
|
134
141
|
return _ts_generator(this, function(_state) {
|
|
135
142
|
switch(_state.label){
|
|
136
143
|
case 0:
|
|
144
|
+
_state.trys.push([
|
|
145
|
+
0,
|
|
146
|
+
6,
|
|
147
|
+
,
|
|
148
|
+
7
|
|
149
|
+
]);
|
|
137
150
|
return [
|
|
138
151
|
4,
|
|
139
152
|
playwright.chromium.launch({
|
|
@@ -162,14 +175,6 @@ function runAudit(url) {
|
|
|
162
175
|
];
|
|
163
176
|
case 4:
|
|
164
177
|
_state.sent();
|
|
165
|
-
_state.label = 5;
|
|
166
|
-
case 5:
|
|
167
|
-
_state.trys.push([
|
|
168
|
-
5,
|
|
169
|
-
7,
|
|
170
|
-
,
|
|
171
|
-
8
|
|
172
|
-
]);
|
|
173
178
|
axe = new AxeBuilder__default.default({
|
|
174
179
|
page: page
|
|
175
180
|
});
|
|
@@ -177,26 +182,39 @@ function runAudit(url) {
|
|
|
177
182
|
4,
|
|
178
183
|
axe.analyze()
|
|
179
184
|
];
|
|
180
|
-
case
|
|
185
|
+
case 5:
|
|
181
186
|
axeResults = _state.sent();
|
|
182
187
|
return [
|
|
183
188
|
2,
|
|
184
189
|
axeResults
|
|
185
190
|
];
|
|
186
|
-
case
|
|
191
|
+
case 6:
|
|
187
192
|
error = _state.sent();
|
|
188
|
-
|
|
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");
|
|
199
|
+
process.exit(1);
|
|
200
|
+
}
|
|
189
201
|
return [
|
|
190
202
|
3,
|
|
191
|
-
|
|
203
|
+
7
|
|
204
|
+
];
|
|
205
|
+
case 7:
|
|
206
|
+
if (!browser) return [
|
|
207
|
+
3,
|
|
208
|
+
9
|
|
192
209
|
];
|
|
193
|
-
case 8:
|
|
194
210
|
return [
|
|
195
211
|
4,
|
|
196
212
|
browser.close()
|
|
197
213
|
];
|
|
198
|
-
case
|
|
214
|
+
case 8:
|
|
199
215
|
_state.sent();
|
|
216
|
+
_state.label = 9;
|
|
217
|
+
case 9:
|
|
200
218
|
return [
|
|
201
219
|
2
|
|
202
220
|
];
|
|
@@ -27,6 +27,13 @@ function _async_to_generator(fn) {
|
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
+
function _instanceof(left, right) {
|
|
31
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
32
|
+
return !!right[Symbol.hasInstance](left);
|
|
33
|
+
} else {
|
|
34
|
+
return left instanceof right;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
30
37
|
function _ts_generator(thisArg, body) {
|
|
31
38
|
var f, y, t, _ = {
|
|
32
39
|
label: 0,
|
|
@@ -127,6 +134,12 @@ function runAudit(url) {
|
|
|
127
134
|
return _ts_generator(this, function(_state) {
|
|
128
135
|
switch(_state.label){
|
|
129
136
|
case 0:
|
|
137
|
+
_state.trys.push([
|
|
138
|
+
0,
|
|
139
|
+
6,
|
|
140
|
+
,
|
|
141
|
+
7
|
|
142
|
+
]);
|
|
130
143
|
return [
|
|
131
144
|
4,
|
|
132
145
|
chromium.launch({
|
|
@@ -155,14 +168,6 @@ function runAudit(url) {
|
|
|
155
168
|
];
|
|
156
169
|
case 4:
|
|
157
170
|
_state.sent();
|
|
158
|
-
_state.label = 5;
|
|
159
|
-
case 5:
|
|
160
|
-
_state.trys.push([
|
|
161
|
-
5,
|
|
162
|
-
7,
|
|
163
|
-
,
|
|
164
|
-
8
|
|
165
|
-
]);
|
|
166
171
|
axe = new AxeBuilder({
|
|
167
172
|
page: page
|
|
168
173
|
});
|
|
@@ -170,26 +175,39 @@ function runAudit(url) {
|
|
|
170
175
|
4,
|
|
171
176
|
axe.analyze()
|
|
172
177
|
];
|
|
173
|
-
case
|
|
178
|
+
case 5:
|
|
174
179
|
axeResults = _state.sent();
|
|
175
180
|
return [
|
|
176
181
|
2,
|
|
177
182
|
axeResults
|
|
178
183
|
];
|
|
179
|
-
case
|
|
184
|
+
case 6:
|
|
180
185
|
error = _state.sent();
|
|
181
|
-
|
|
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");
|
|
192
|
+
process.exit(1);
|
|
193
|
+
}
|
|
182
194
|
return [
|
|
183
195
|
3,
|
|
184
|
-
|
|
196
|
+
7
|
|
197
|
+
];
|
|
198
|
+
case 7:
|
|
199
|
+
if (!browser) return [
|
|
200
|
+
3,
|
|
201
|
+
9
|
|
185
202
|
];
|
|
186
|
-
case 8:
|
|
187
203
|
return [
|
|
188
204
|
4,
|
|
189
205
|
browser.close()
|
|
190
206
|
];
|
|
191
|
-
case
|
|
207
|
+
case 8:
|
|
192
208
|
_state.sent();
|
|
209
|
+
_state.label = 9;
|
|
210
|
+
case 9:
|
|
193
211
|
return [
|
|
194
212
|
2
|
|
195
213
|
];
|
|
@@ -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
|
|
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}"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aria-ease",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.1",
|
|
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",
|
|
@@ -98,6 +98,14 @@
|
|
|
98
98
|
"playwright": "^1.55.1",
|
|
99
99
|
"typescript-eslint": "^8.41.0"
|
|
100
100
|
},
|
|
101
|
+
"peerDependencies": {
|
|
102
|
+
"playwright": "^1.55.1"
|
|
103
|
+
},
|
|
104
|
+
"peerDependenciesMeta": {
|
|
105
|
+
"playwright": {
|
|
106
|
+
"optional": true
|
|
107
|
+
}
|
|
108
|
+
},
|
|
101
109
|
"bin": {
|
|
102
110
|
"aria-ease": "./bin/audit-cli.js"
|
|
103
111
|
}
|