aria-ease 2.0.2 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -3
- package/bin/audit-cli.cjs +663 -0
- package/bin/audit-cli.cjs.map +1 -0
- package/bin/audit-cli.d.cts +1 -0
- package/bin/audit-cli.d.ts +1 -0
- package/bin/audit-cli.js +566 -0
- package/bin/audit-cli.js.map +1 -0
- package/bin/audit-cli.ts +80 -0
- package/dist/Types.d-p85gN5m_.d.cts +22 -0
- package/dist/Types.d-p85gN5m_.d.ts +22 -0
- package/dist/chunk-4366LRNM.js +38 -0
- package/dist/chunk-4366LRNM.js.map +1 -0
- package/dist/chunk-5HQ6LLC5.js +21 -0
- package/dist/chunk-5HQ6LLC5.js.map +1 -0
- package/dist/chunk-FBQ5LF2T.js +21 -0
- package/dist/chunk-FBQ5LF2T.js.map +1 -0
- package/dist/chunk-KVTLMA4J.js +58 -0
- package/dist/chunk-KVTLMA4J.js.map +1 -0
- package/dist/chunk-MEA5U2G4.js +24 -0
- package/dist/chunk-MEA5U2G4.js.map +1 -0
- package/dist/chunk-RK3JUAFZ.js +18 -0
- package/dist/chunk-RK3JUAFZ.js.map +1 -0
- package/dist/chunk-RT5IROW4.js +99 -0
- package/dist/chunk-RT5IROW4.js.map +1 -0
- package/dist/index.cjs +6 -55
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -115
- package/dist/index.d.ts +7 -115
- package/dist/index.js +7 -313
- package/dist/index.js.map +1 -1
- package/dist/src/accordion/index.cjs +25 -0
- package/dist/src/accordion/index.cjs.map +1 -0
- package/dist/src/accordion/index.d.cts +13 -0
- package/dist/src/accordion/index.d.ts +13 -0
- package/dist/src/accordion/index.js +2 -0
- package/dist/src/accordion/index.js.map +1 -0
- package/dist/src/block/index.cjs +121 -0
- package/dist/src/block/index.cjs.map +1 -0
- package/dist/src/block/index.d.cts +8 -0
- package/dist/src/block/index.d.ts +8 -0
- package/dist/src/block/index.js +3 -0
- package/dist/src/block/index.js.map +1 -0
- package/dist/src/checkbox/index.cjs +19 -0
- package/dist/src/checkbox/index.cjs.map +1 -0
- package/dist/src/checkbox/index.d.cts +13 -0
- package/dist/src/checkbox/index.d.ts +13 -0
- package/dist/src/checkbox/index.js +2 -0
- package/dist/src/checkbox/index.js.map +1 -0
- package/dist/src/menu/index.cjs +155 -0
- package/dist/src/menu/index.cjs.map +1 -0
- package/dist/src/menu/index.d.cts +17 -0
- package/dist/src/menu/index.d.ts +17 -0
- package/dist/src/menu/index.js +3 -0
- package/dist/src/menu/index.js.map +1 -0
- package/dist/src/radio/index.cjs +22 -0
- package/dist/src/radio/index.cjs.map +1 -0
- package/dist/src/radio/index.d.cts +13 -0
- package/dist/src/radio/index.d.ts +13 -0
- package/dist/src/radio/index.js +2 -0
- package/dist/src/radio/index.js.map +1 -0
- package/dist/src/toggle/index.cjs +22 -0
- package/dist/src/toggle/index.cjs.map +1 -0
- package/dist/src/toggle/index.d.cts +13 -0
- package/dist/src/toggle/index.d.ts +13 -0
- package/dist/src/toggle/index.js +2 -0
- package/dist/src/toggle/index.js.map +1 -0
- package/dist/src/utils/audit/audit.cjs +208 -0
- package/dist/src/utils/audit/audit.cjs.map +1 -0
- package/dist/src/utils/audit/audit.d.cts +5 -0
- package/dist/src/utils/audit/audit.d.ts +5 -0
- package/dist/src/utils/audit/audit.js +201 -0
- package/dist/src/utils/audit/audit.js.map +1 -0
- package/package.json +46 -4
- package/dist/index.d.mts +0 -140
- package/dist/index.mjs +0 -110
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { R as RadioStates } from '../../Types.d-p85gN5m_.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 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.
|
|
5
|
+
* @param {string} radioId The id of the radio parent container.
|
|
6
|
+
* @param {string} radiosClass The shared class of all the radios.
|
|
7
|
+
* @param {RadioStates[]} radioStates Array of objects containing radio buttons state information.
|
|
8
|
+
* @param {number} currentPressedRadioIndex Index of the currently checked or unchecked radio button.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
declare function updateRadioAriaAttributes(radioId: string, radiosClass: string, radioStates: RadioStates[], currentPressedRadioIndex: number): void;
|
|
12
|
+
|
|
13
|
+
export { updateRadioAriaAttributes };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/macx/aria-ease/package/dist/src/radio/index.js"],"names":["updateRadioAriaAttributes"],"mappings":"AAAA,SAASA,yBAAyB,QAAQ,0BAA0B,CACpE,iCAAiC","sourcesContent":["export { updateRadioAriaAttributes } from '../../chunk-5HQ6LLC5.js';\n//# sourceMappingURL=index.js.map\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// src/toggle/src/updateToggleAriaAttribute/updateToggleAriaAttribute.ts
|
|
3
|
+
function updateToggleAriaAttribute(toggleId, togglesClass, toggleStates, currentPressedToggleIndex) {
|
|
4
|
+
var toggleDiv = document.querySelector("#".concat(toggleId));
|
|
5
|
+
if (!toggleDiv) {
|
|
6
|
+
throw new Error("Invalid toggle main div id provided.");
|
|
7
|
+
}
|
|
8
|
+
var toggleItems = Array.from(toggleDiv.querySelectorAll(".".concat(togglesClass)));
|
|
9
|
+
if (toggleItems.length === 0) {
|
|
10
|
+
throw new Error("Invalid toggles shared class provided.");
|
|
11
|
+
}
|
|
12
|
+
if (toggleItems.length !== toggleStates.length) {
|
|
13
|
+
throw new Error("Toggle state/DOM length mismatch: found ".concat(toggleItems.length, " triggers, but got ").concat(toggleStates.length, " state objects."));
|
|
14
|
+
}
|
|
15
|
+
toggleItems.forEach(function(toggle, index) {
|
|
16
|
+
if (index === currentPressedToggleIndex) {
|
|
17
|
+
toggle.setAttribute("aria-pressed", toggleStates[index].pressed ? "true" : "false");
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
exports.updateToggleAriaAttribute = updateToggleAriaAttribute; //# sourceMappingURL=index.cjs.map
|
|
22
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/macx/aria-ease/package/dist/src/toggle/index.cjs"],"names":[],"mappings":"AAAA","sourcesContent":["'use strict';\n\n// 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\nexports.updateToggleAriaAttribute = updateToggleAriaAttribute;\n//# sourceMappingURL=index.cjs.map\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { T as ToggleStates } from '../../Types.d-p85gN5m_.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 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.
|
|
5
|
+
* @param {string} toggleId The id of the toggle buttons parent container.
|
|
6
|
+
* @param {string} togglesClass The shared class of all the toggle buttons.
|
|
7
|
+
* @param {ToggleStates[]} toggleStates Array of objects containing toggle buttons state information.
|
|
8
|
+
* @param {number} currentPressedToggleIndex Index of the currently pressed or unpressed toggle button.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
declare function updateToggleAriaAttribute(toggleId: string, togglesClass: string, toggleStates: ToggleStates[], currentPressedToggleIndex: number): void;
|
|
12
|
+
|
|
13
|
+
export { updateToggleAriaAttribute };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { T as ToggleStates } from '../../Types.d-p85gN5m_.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 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.
|
|
5
|
+
* @param {string} toggleId The id of the toggle buttons parent container.
|
|
6
|
+
* @param {string} togglesClass The shared class of all the toggle buttons.
|
|
7
|
+
* @param {ToggleStates[]} toggleStates Array of objects containing toggle buttons state information.
|
|
8
|
+
* @param {number} currentPressedToggleIndex Index of the currently pressed or unpressed toggle button.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
declare function updateToggleAriaAttribute(toggleId: string, togglesClass: string, toggleStates: ToggleStates[], currentPressedToggleIndex: number): void;
|
|
12
|
+
|
|
13
|
+
export { updateToggleAriaAttribute };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/macx/aria-ease/package/dist/src/toggle/index.js"],"names":["updateToggleAriaAttribute"],"mappings":"AAAA,SAASA,yBAAyB,QAAQ,0BAA0B,CACpE,iCAAiC","sourcesContent":["export { updateToggleAriaAttribute } from '../../chunk-FBQ5LF2T.js';\n//# sourceMappingURL=index.js.map\n"]}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
3
|
+
try {
|
|
4
|
+
var info = gen[key](arg);
|
|
5
|
+
var value = info.value;
|
|
6
|
+
} catch (error) {
|
|
7
|
+
reject(error);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (info.done) {
|
|
11
|
+
resolve(value);
|
|
12
|
+
} else {
|
|
13
|
+
Promise.resolve(value).then(_next, _throw);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function _async_to_generator(fn) {
|
|
17
|
+
return function() {
|
|
18
|
+
var self = this, args = arguments;
|
|
19
|
+
return new Promise(function(resolve, reject) {
|
|
20
|
+
var gen = fn.apply(self, args);
|
|
21
|
+
function _next(value) {
|
|
22
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
23
|
+
}
|
|
24
|
+
function _throw(err) {
|
|
25
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
26
|
+
}
|
|
27
|
+
_next(undefined);
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function _ts_generator(thisArg, body) {
|
|
32
|
+
var f, y, t, _ = {
|
|
33
|
+
label: 0,
|
|
34
|
+
sent: function() {
|
|
35
|
+
if (t[0] & 1) throw t[1];
|
|
36
|
+
return t[1];
|
|
37
|
+
},
|
|
38
|
+
trys: [],
|
|
39
|
+
ops: []
|
|
40
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
41
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
42
|
+
return this;
|
|
43
|
+
}), g;
|
|
44
|
+
function verb(n) {
|
|
45
|
+
return function(v) {
|
|
46
|
+
return step([
|
|
47
|
+
n,
|
|
48
|
+
v
|
|
49
|
+
]);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function step(op) {
|
|
53
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
54
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
55
|
+
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;
|
|
56
|
+
if (y = 0, t) op = [
|
|
57
|
+
op[0] & 2,
|
|
58
|
+
t.value
|
|
59
|
+
];
|
|
60
|
+
switch(op[0]){
|
|
61
|
+
case 0:
|
|
62
|
+
case 1:
|
|
63
|
+
t = op;
|
|
64
|
+
break;
|
|
65
|
+
case 4:
|
|
66
|
+
_.label++;
|
|
67
|
+
return {
|
|
68
|
+
value: op[1],
|
|
69
|
+
done: false
|
|
70
|
+
};
|
|
71
|
+
case 5:
|
|
72
|
+
_.label++;
|
|
73
|
+
y = op[1];
|
|
74
|
+
op = [
|
|
75
|
+
0
|
|
76
|
+
];
|
|
77
|
+
continue;
|
|
78
|
+
case 7:
|
|
79
|
+
op = _.ops.pop();
|
|
80
|
+
_.trys.pop();
|
|
81
|
+
continue;
|
|
82
|
+
default:
|
|
83
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
84
|
+
_ = 0;
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
88
|
+
_.label = op[1];
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
92
|
+
_.label = t[1];
|
|
93
|
+
t = op;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
if (t && _.label < t[2]) {
|
|
97
|
+
_.label = t[2];
|
|
98
|
+
_.ops.push(op);
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
if (t[2]) _.ops.pop();
|
|
102
|
+
_.trys.pop();
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
op = body.call(thisArg, _);
|
|
106
|
+
} catch (e) {
|
|
107
|
+
op = [
|
|
108
|
+
6,
|
|
109
|
+
e
|
|
110
|
+
];
|
|
111
|
+
y = 0;
|
|
112
|
+
} finally{
|
|
113
|
+
f = t = 0;
|
|
114
|
+
}
|
|
115
|
+
if (op[0] & 5) throw op[1];
|
|
116
|
+
return {
|
|
117
|
+
value: op[0] ? op[1] : void 0,
|
|
118
|
+
done: true
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
var AxeBuilder = require('@axe-core/playwright');
|
|
123
|
+
var playwright = require('playwright');
|
|
124
|
+
function _interopDefault(e) {
|
|
125
|
+
return e && e.__esModule ? e : {
|
|
126
|
+
default: e
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
var AxeBuilder__default = /*#__PURE__*/ _interopDefault(AxeBuilder);
|
|
130
|
+
// src/utils/audit/audit.ts
|
|
131
|
+
function runAudit(url) {
|
|
132
|
+
return _async_to_generator(function() {
|
|
133
|
+
var browser, context, page, axe, axeResults, error;
|
|
134
|
+
return _ts_generator(this, function(_state) {
|
|
135
|
+
switch(_state.label){
|
|
136
|
+
case 0:
|
|
137
|
+
return [
|
|
138
|
+
4,
|
|
139
|
+
playwright.chromium.launch({
|
|
140
|
+
headless: true
|
|
141
|
+
})
|
|
142
|
+
];
|
|
143
|
+
case 1:
|
|
144
|
+
browser = _state.sent();
|
|
145
|
+
return [
|
|
146
|
+
4,
|
|
147
|
+
browser.newContext()
|
|
148
|
+
];
|
|
149
|
+
case 2:
|
|
150
|
+
context = _state.sent();
|
|
151
|
+
return [
|
|
152
|
+
4,
|
|
153
|
+
context.newPage()
|
|
154
|
+
];
|
|
155
|
+
case 3:
|
|
156
|
+
page = _state.sent();
|
|
157
|
+
return [
|
|
158
|
+
4,
|
|
159
|
+
page.goto(url, {
|
|
160
|
+
waitUntil: "networkidle"
|
|
161
|
+
})
|
|
162
|
+
];
|
|
163
|
+
case 4:
|
|
164
|
+
_state.sent();
|
|
165
|
+
_state.label = 5;
|
|
166
|
+
case 5:
|
|
167
|
+
_state.trys.push([
|
|
168
|
+
5,
|
|
169
|
+
7,
|
|
170
|
+
,
|
|
171
|
+
8
|
|
172
|
+
]);
|
|
173
|
+
axe = new AxeBuilder__default.default({
|
|
174
|
+
page: page
|
|
175
|
+
});
|
|
176
|
+
return [
|
|
177
|
+
4,
|
|
178
|
+
axe.analyze()
|
|
179
|
+
];
|
|
180
|
+
case 6:
|
|
181
|
+
axeResults = _state.sent();
|
|
182
|
+
return [
|
|
183
|
+
2,
|
|
184
|
+
axeResults
|
|
185
|
+
];
|
|
186
|
+
case 7:
|
|
187
|
+
error = _state.sent();
|
|
188
|
+
console.log(error);
|
|
189
|
+
return [
|
|
190
|
+
3,
|
|
191
|
+
8
|
|
192
|
+
];
|
|
193
|
+
case 8:
|
|
194
|
+
return [
|
|
195
|
+
4,
|
|
196
|
+
browser.close()
|
|
197
|
+
];
|
|
198
|
+
case 9:
|
|
199
|
+
_state.sent();
|
|
200
|
+
return [
|
|
201
|
+
2
|
|
202
|
+
];
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
})();
|
|
206
|
+
}
|
|
207
|
+
exports.runAudit = runAudit; //# sourceMappingURL=audit.cjs.map
|
|
208
|
+
//# sourceMappingURL=audit.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/macx/aria-ease/package/dist/src/utils/audit/audit.cjs"],"names":[],"mappings":"AAAA","sourcesContent":["'use strict';\n\nvar AxeBuilder = require('@axe-core/playwright');\nvar playwright = require('playwright');\n\nfunction _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }\n\nvar AxeBuilder__default = /*#__PURE__*/_interopDefault(AxeBuilder);\n\n// src/utils/audit/audit.ts\nasync function runAudit() {\n const browser = await playwright.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__default.default({ 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\nexports.runAudit = runAudit;\n//# sourceMappingURL=audit.cjs.map\n"]}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
|
+
try {
|
|
3
|
+
var info = gen[key](arg);
|
|
4
|
+
var value = info.value;
|
|
5
|
+
} catch (error) {
|
|
6
|
+
reject(error);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (info.done) {
|
|
10
|
+
resolve(value);
|
|
11
|
+
} else {
|
|
12
|
+
Promise.resolve(value).then(_next, _throw);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function _async_to_generator(fn) {
|
|
16
|
+
return function() {
|
|
17
|
+
var self = this, args = arguments;
|
|
18
|
+
return new Promise(function(resolve, reject) {
|
|
19
|
+
var gen = fn.apply(self, args);
|
|
20
|
+
function _next(value) {
|
|
21
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
22
|
+
}
|
|
23
|
+
function _throw(err) {
|
|
24
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
25
|
+
}
|
|
26
|
+
_next(undefined);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function _ts_generator(thisArg, body) {
|
|
31
|
+
var f, y, t, _ = {
|
|
32
|
+
label: 0,
|
|
33
|
+
sent: function() {
|
|
34
|
+
if (t[0] & 1) throw t[1];
|
|
35
|
+
return t[1];
|
|
36
|
+
},
|
|
37
|
+
trys: [],
|
|
38
|
+
ops: []
|
|
39
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
40
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
41
|
+
return this;
|
|
42
|
+
}), g;
|
|
43
|
+
function verb(n) {
|
|
44
|
+
return function(v) {
|
|
45
|
+
return step([
|
|
46
|
+
n,
|
|
47
|
+
v
|
|
48
|
+
]);
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function step(op) {
|
|
52
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
53
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
54
|
+
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;
|
|
55
|
+
if (y = 0, t) op = [
|
|
56
|
+
op[0] & 2,
|
|
57
|
+
t.value
|
|
58
|
+
];
|
|
59
|
+
switch(op[0]){
|
|
60
|
+
case 0:
|
|
61
|
+
case 1:
|
|
62
|
+
t = op;
|
|
63
|
+
break;
|
|
64
|
+
case 4:
|
|
65
|
+
_.label++;
|
|
66
|
+
return {
|
|
67
|
+
value: op[1],
|
|
68
|
+
done: false
|
|
69
|
+
};
|
|
70
|
+
case 5:
|
|
71
|
+
_.label++;
|
|
72
|
+
y = op[1];
|
|
73
|
+
op = [
|
|
74
|
+
0
|
|
75
|
+
];
|
|
76
|
+
continue;
|
|
77
|
+
case 7:
|
|
78
|
+
op = _.ops.pop();
|
|
79
|
+
_.trys.pop();
|
|
80
|
+
continue;
|
|
81
|
+
default:
|
|
82
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
83
|
+
_ = 0;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
87
|
+
_.label = op[1];
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
91
|
+
_.label = t[1];
|
|
92
|
+
t = op;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
if (t && _.label < t[2]) {
|
|
96
|
+
_.label = t[2];
|
|
97
|
+
_.ops.push(op);
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
if (t[2]) _.ops.pop();
|
|
101
|
+
_.trys.pop();
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
op = body.call(thisArg, _);
|
|
105
|
+
} catch (e) {
|
|
106
|
+
op = [
|
|
107
|
+
6,
|
|
108
|
+
e
|
|
109
|
+
];
|
|
110
|
+
y = 0;
|
|
111
|
+
} finally{
|
|
112
|
+
f = t = 0;
|
|
113
|
+
}
|
|
114
|
+
if (op[0] & 5) throw op[1];
|
|
115
|
+
return {
|
|
116
|
+
value: op[0] ? op[1] : void 0,
|
|
117
|
+
done: true
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
import AxeBuilder from '@axe-core/playwright';
|
|
122
|
+
import { chromium } from 'playwright';
|
|
123
|
+
// src/utils/audit/audit.ts
|
|
124
|
+
function runAudit(url) {
|
|
125
|
+
return _async_to_generator(function() {
|
|
126
|
+
var browser, context, page, axe, axeResults, error;
|
|
127
|
+
return _ts_generator(this, function(_state) {
|
|
128
|
+
switch(_state.label){
|
|
129
|
+
case 0:
|
|
130
|
+
return [
|
|
131
|
+
4,
|
|
132
|
+
chromium.launch({
|
|
133
|
+
headless: true
|
|
134
|
+
})
|
|
135
|
+
];
|
|
136
|
+
case 1:
|
|
137
|
+
browser = _state.sent();
|
|
138
|
+
return [
|
|
139
|
+
4,
|
|
140
|
+
browser.newContext()
|
|
141
|
+
];
|
|
142
|
+
case 2:
|
|
143
|
+
context = _state.sent();
|
|
144
|
+
return [
|
|
145
|
+
4,
|
|
146
|
+
context.newPage()
|
|
147
|
+
];
|
|
148
|
+
case 3:
|
|
149
|
+
page = _state.sent();
|
|
150
|
+
return [
|
|
151
|
+
4,
|
|
152
|
+
page.goto(url, {
|
|
153
|
+
waitUntil: "networkidle"
|
|
154
|
+
})
|
|
155
|
+
];
|
|
156
|
+
case 4:
|
|
157
|
+
_state.sent();
|
|
158
|
+
_state.label = 5;
|
|
159
|
+
case 5:
|
|
160
|
+
_state.trys.push([
|
|
161
|
+
5,
|
|
162
|
+
7,
|
|
163
|
+
,
|
|
164
|
+
8
|
|
165
|
+
]);
|
|
166
|
+
axe = new AxeBuilder({
|
|
167
|
+
page: page
|
|
168
|
+
});
|
|
169
|
+
return [
|
|
170
|
+
4,
|
|
171
|
+
axe.analyze()
|
|
172
|
+
];
|
|
173
|
+
case 6:
|
|
174
|
+
axeResults = _state.sent();
|
|
175
|
+
return [
|
|
176
|
+
2,
|
|
177
|
+
axeResults
|
|
178
|
+
];
|
|
179
|
+
case 7:
|
|
180
|
+
error = _state.sent();
|
|
181
|
+
console.log(error);
|
|
182
|
+
return [
|
|
183
|
+
3,
|
|
184
|
+
8
|
|
185
|
+
];
|
|
186
|
+
case 8:
|
|
187
|
+
return [
|
|
188
|
+
4,
|
|
189
|
+
browser.close()
|
|
190
|
+
];
|
|
191
|
+
case 9:
|
|
192
|
+
_state.sent();
|
|
193
|
+
return [
|
|
194
|
+
2
|
|
195
|
+
];
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
})();
|
|
199
|
+
}
|
|
200
|
+
export { runAudit }; //# sourceMappingURL=audit.js.map
|
|
201
|
+
//# sourceMappingURL=audit.js.map
|
|
@@ -0,0 +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 const 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\n try{\n const axe = new AxeBuilder({ page });\n\n const axeResults: AxeResults = await axe.analyze();\n //console.log(\"--- AXE-CORE VIOLATIONS RESULTS ---\");\n //const violations = axeResults.violations.filter(v => v.nodes.length > 0);\n /* console.log(JSON.stringify(violations, null, 2));\n\n\n console.log(\"--- EACH AXE-CORE VIOLATION ---\");\n\n violations.forEach(v => {\n console.log(`\\nRule: ${v.id}`);\n console.log(`Impact: ${v.impact}`);\n console.log(`Description: ${v.description}`);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n v.nodes.forEach((n: any) => {\n console.log(` → Target: ${n.target}`);\n console.log(` Failure: ${n.failureSummary}`);\n });\n });\n\n\n const snapshot = await page.accessibility.snapshot();\n console.log(\"\\n--- PLAYWRIGHT SNAPSHOT ---\");\n console.log(snapshot); */\n\n\n return axeResults;\n } catch(error) {\n console.log(error);\n }\n \n await browser.close(); \n}"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aria-ease",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
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",
|
|
@@ -8,11 +8,12 @@
|
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"dev": "tsup ./index.ts --watch",
|
|
11
|
-
"build": "tsup ./index.ts --format esm,cjs --dts --treeshake --sourcemap",
|
|
11
|
+
"build": "tsup ./index.ts ./src/utils/audit/audit.ts ./src/accordion/index.ts ./src/block/index.ts ./src/checkbox/index.ts ./src/menu/index.ts ./src/radio/index.ts ./src/toggle/index.ts --format esm,cjs --dts --treeshake --sourcemap --outDir dist && tsup ./bin/audit-cli.ts --format esm,cjs --dts --sourcemap --outDir bin",
|
|
12
12
|
"test": "vitest run --reporter verbose -- --config ./vitest.config.mts",
|
|
13
13
|
"bench": "node --loader ts-node/esm benchmarks/sample.bench.ts",
|
|
14
14
|
"lint": "eslint src --ext .ts",
|
|
15
|
-
"prepublishOnly": "tsc && npm run lint && npm run test && npm run build"
|
|
15
|
+
"prepublishOnly": "tsc && npm run lint && npm run test && npm run build",
|
|
16
|
+
"release": "standard-version"
|
|
16
17
|
},
|
|
17
18
|
"repository": {
|
|
18
19
|
"type": "git",
|
|
@@ -37,10 +38,12 @@
|
|
|
37
38
|
"devDependencies": {
|
|
38
39
|
"@swc/core": "^1.13.5",
|
|
39
40
|
"@testing-library/dom": "^10.4.1",
|
|
41
|
+
"@types/fs-extra": "^11.0.4",
|
|
40
42
|
"benchmark": "^2.1.4",
|
|
41
43
|
"eslint": "^9.34.0",
|
|
42
44
|
"jsdom": "^26.1.0",
|
|
43
45
|
"prettier": "^3.6.2",
|
|
46
|
+
"standard-version": "^9.5.0",
|
|
44
47
|
"tsup": "^8.5.0",
|
|
45
48
|
"typescript": "^5.9.2",
|
|
46
49
|
"vitest": "^3.2.4"
|
|
@@ -50,12 +53,51 @@
|
|
|
50
53
|
".": {
|
|
51
54
|
"import": "./dist/index.js",
|
|
52
55
|
"require": "./dist/index.cjs"
|
|
56
|
+
},
|
|
57
|
+
"./accordion": {
|
|
58
|
+
"import": "./dist/src/accordion/index.js",
|
|
59
|
+
"require": "./dist/src/accordion/index.cjs"
|
|
60
|
+
},
|
|
61
|
+
"./block": {
|
|
62
|
+
"import": "./dist/src/block/index.js",
|
|
63
|
+
"require": "./dist/src/block/index.cjs"
|
|
64
|
+
},
|
|
65
|
+
"./checkbox": {
|
|
66
|
+
"import": "./dist/src/checkbox/index.js",
|
|
67
|
+
"require": "./dist/src/checkbox/index.cjs"
|
|
68
|
+
},
|
|
69
|
+
"./menu": {
|
|
70
|
+
"import": "./dist/src/menu/index.js",
|
|
71
|
+
"require": "./dist/src/menu/index.cjs"
|
|
72
|
+
},
|
|
73
|
+
"./radio": {
|
|
74
|
+
"import": "./dist/src/radio/index.js",
|
|
75
|
+
"require": "./dist/src/radio/index.cjs"
|
|
76
|
+
},
|
|
77
|
+
"./toggle": {
|
|
78
|
+
"import": "./dist/src/toggle/index.js",
|
|
79
|
+
"require": "./dist/src/toggle/index.cjs"
|
|
80
|
+
},
|
|
81
|
+
"./audit": {
|
|
82
|
+
"import": "./dist/src/utils/audit/audit.js",
|
|
83
|
+
"require": "./dist/src/utils/audit/audit.cjs",
|
|
84
|
+
"types": "./dist/src/utils/audit/audit.d.ts"
|
|
53
85
|
}
|
|
54
86
|
},
|
|
55
87
|
"files": [
|
|
56
|
-
"dist"
|
|
88
|
+
"dist",
|
|
89
|
+
"bin"
|
|
57
90
|
],
|
|
58
91
|
"dependencies": {
|
|
92
|
+
"@axe-core/playwright": "^4.10.2",
|
|
93
|
+
"chalk": "^5.6.2",
|
|
94
|
+
"commander": "^14.0.1",
|
|
95
|
+
"fs-extra": "^11.3.2",
|
|
96
|
+
"path": "^0.12.7",
|
|
97
|
+
"playwright": "^1.55.1",
|
|
59
98
|
"typescript-eslint": "^8.41.0"
|
|
99
|
+
},
|
|
100
|
+
"bin": {
|
|
101
|
+
"aria-ease": "./bin/audit-cli.js"
|
|
60
102
|
}
|
|
61
103
|
}
|