@sc4rfurryx/proteusjs 1.1.0 → 1.1.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/README.md +5 -5
- package/dist/.tsbuildinfo +1 -1
- package/dist/adapters/react.d.ts +1 -0
- package/dist/adapters/react.esm.js +2 -1
- package/dist/adapters/react.esm.js.map +1 -1
- package/dist/adapters/svelte.esm.js +2 -1
- package/dist/adapters/svelte.esm.js.map +1 -1
- package/dist/adapters/vue.esm.js +2 -1
- package/dist/adapters/vue.esm.js.map +1 -1
- package/dist/modules/a11y-audit.d.ts +1 -9
- package/dist/modules/a11y-audit.esm.js +30 -475
- package/dist/modules/a11y-audit.esm.js.map +1 -1
- package/dist/modules/a11y-primitives.d.ts +8 -41
- package/dist/modules/a11y-primitives.esm.js +69 -400
- package/dist/modules/a11y-primitives.esm.js.map +1 -1
- package/dist/modules/anchor.d.ts +1 -0
- package/dist/modules/anchor.esm.js +2 -1
- package/dist/modules/anchor.esm.js.map +1 -1
- package/dist/modules/container.esm.js +1 -1
- package/dist/modules/perf.esm.js +1 -1
- package/dist/modules/popover.esm.js +1 -1
- package/dist/modules/scroll.esm.js +1 -1
- package/dist/modules/transitions.esm.js +1 -1
- package/dist/modules/typography.esm.js +1 -1
- package/dist/proteus.cjs.js +97 -875
- package/dist/proteus.cjs.js.map +1 -1
- package/dist/proteus.d.ts +11 -56
- package/dist/proteus.esm.js +97 -875
- package/dist/proteus.esm.js.map +1 -1
- package/dist/proteus.esm.min.js +2 -2
- package/dist/proteus.esm.min.js.map +1 -1
- package/dist/proteus.js +97 -875
- package/dist/proteus.js.map +1 -1
- package/dist/proteus.min.js +2 -2
- package/dist/proteus.min.js.map +1 -1
- package/package.json +9 -4
- package/src/index.ts +1 -1
- package/src/modules/a11y-audit/index.ts +29 -553
- package/src/modules/a11y-primitives/index.ts +73 -475
- package/src/modules/anchor/index.ts +2 -0
@@ -1,509 +1,64 @@
|
|
1
1
|
/*!
|
2
|
-
* ProteusJS v1.1.
|
2
|
+
* ProteusJS v1.1.1
|
3
3
|
* Shape-shifting responsive design that adapts like the sea god himself
|
4
4
|
* (c) 2025 sc4rfurry
|
5
5
|
* Released under the MIT License
|
6
6
|
*/
|
7
7
|
/**
|
8
8
|
* @sc4rfurryx/proteusjs/a11y-audit
|
9
|
-
*
|
9
|
+
* Lightweight accessibility audits for development
|
10
10
|
*
|
11
11
|
* @version 1.1.0
|
12
12
|
* @author sc4rfurry
|
13
13
|
* @license MIT
|
14
14
|
*/
|
15
|
-
/**
|
16
|
-
* Run accessibility audits with actionable output
|
17
|
-
* DEV-ONLY: This module should be tree-shaken in production
|
18
|
-
*/
|
19
15
|
async function audit(target = document, options = {}) {
|
20
|
-
|
21
|
-
|
22
|
-
console.warn('a11y-audit should not be used in production');
|
23
|
-
return {
|
24
|
-
violations: [],
|
25
|
-
passes: 0,
|
26
|
-
incomplete: 0,
|
27
|
-
timestamp: Date.now(),
|
28
|
-
url: window.location.href
|
29
|
-
};
|
16
|
+
if (typeof window === 'undefined' || process.env['NODE_ENV'] === 'production') {
|
17
|
+
return { violations: [], passes: 0, timestamp: Date.now(), url: '' };
|
30
18
|
}
|
31
|
-
const { rules = ['
|
19
|
+
const { rules = ['images', 'headings', 'forms'], format = 'console' } = options;
|
32
20
|
const violations = [];
|
33
21
|
let passes = 0;
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
'color-contrast': checkColorContrast,
|
38
|
-
'heading-order': checkHeadingOrder,
|
39
|
-
'image-alt': checkImageAlt,
|
40
|
-
'label': checkFormLabels,
|
41
|
-
'link-name': checkLinkNames,
|
42
|
-
'button-name': checkButtonNames,
|
43
|
-
'focus-visible': checkFocusVisible,
|
44
|
-
'aria-labels': checkAriaLabels,
|
45
|
-
'landmark-roles': checkLandmarkRoles,
|
46
|
-
'skip-links': checkSkipLinks
|
47
|
-
};
|
48
|
-
// Run selected checks
|
49
|
-
for (const ruleId of rules) {
|
50
|
-
if (checks[ruleId]) {
|
51
|
-
try {
|
52
|
-
const result = await checks[ruleId](target);
|
53
|
-
if (result.violations.length > 0) {
|
54
|
-
violations.push(...result.violations);
|
55
|
-
}
|
56
|
-
else {
|
57
|
-
passes++;
|
58
|
-
}
|
59
|
-
}
|
60
|
-
catch (error) {
|
61
|
-
incomplete++;
|
62
|
-
console.warn(`Failed to run accessibility check: ${ruleId}`, error);
|
63
|
-
}
|
64
|
-
}
|
65
|
-
}
|
66
|
-
const report = {
|
67
|
-
violations,
|
68
|
-
passes,
|
69
|
-
incomplete,
|
70
|
-
timestamp: Date.now(),
|
71
|
-
url: window.location.href
|
72
|
-
};
|
73
|
-
// Output results
|
74
|
-
if (format === 'console') {
|
75
|
-
outputToConsole(report);
|
76
|
-
}
|
77
|
-
if (openInBrowser) {
|
78
|
-
openReportInBrowser(report);
|
79
|
-
}
|
80
|
-
return report;
|
81
|
-
}
|
82
|
-
// Individual check functions
|
83
|
-
async function checkColorContrast(target) {
|
84
|
-
const violations = [];
|
85
|
-
const elements = target.querySelectorAll('*');
|
86
|
-
elements.forEach(element => {
|
87
|
-
const style = getComputedStyle(element);
|
88
|
-
const color = style.color;
|
89
|
-
const backgroundColor = style.backgroundColor;
|
90
|
-
// Simple contrast check (would need more sophisticated implementation)
|
91
|
-
if (color && backgroundColor && color !== 'rgba(0, 0, 0, 0)' && backgroundColor !== 'rgba(0, 0, 0, 0)') {
|
92
|
-
const contrast = calculateContrast(color, backgroundColor);
|
93
|
-
if (contrast < 4.5) {
|
94
|
-
violations.push({
|
95
|
-
id: 'color-contrast',
|
96
|
-
impact: 'serious',
|
97
|
-
nodes: 1,
|
98
|
-
help: 'Elements must have sufficient color contrast',
|
99
|
-
fix: `Increase contrast ratio to at least 4.5:1. Current: ${contrast.toFixed(2)}:1`,
|
100
|
-
elements: [element]
|
101
|
-
});
|
102
|
-
}
|
103
|
-
}
|
104
|
-
});
|
105
|
-
return { violations };
|
106
|
-
}
|
107
|
-
async function checkHeadingOrder(target) {
|
108
|
-
const violations = [];
|
109
|
-
const headings = target.querySelectorAll('h1, h2, h3, h4, h5, h6');
|
110
|
-
let lastLevel = 0;
|
111
|
-
headings.forEach(heading => {
|
112
|
-
const level = parseInt(heading.tagName.charAt(1));
|
113
|
-
if (level > lastLevel + 1) {
|
22
|
+
if (rules.includes('images')) {
|
23
|
+
const imgs = target.querySelectorAll('img:not([alt])');
|
24
|
+
if (imgs.length > 0) {
|
114
25
|
violations.push({
|
115
|
-
id: '
|
116
|
-
impact: 'moderate',
|
117
|
-
nodes: 1,
|
118
|
-
help: 'Heading levels should only increase by one',
|
119
|
-
fix: `Change ${heading.tagName} to H${lastLevel + 1} or add intermediate headings`,
|
120
|
-
elements: [heading]
|
26
|
+
id: 'image-alt', impact: 'critical', nodes: imgs.length, help: 'Images need alt text'
|
121
27
|
});
|
122
28
|
}
|
123
|
-
|
124
|
-
});
|
125
|
-
return { violations };
|
126
|
-
}
|
127
|
-
async function checkImageAlt(target) {
|
128
|
-
const violations = [];
|
129
|
-
const images = target.querySelectorAll('img');
|
130
|
-
images.forEach(img => {
|
131
|
-
if (!img.hasAttribute('alt')) {
|
132
|
-
violations.push({
|
133
|
-
id: 'image-alt',
|
134
|
-
impact: 'critical',
|
135
|
-
nodes: 1,
|
136
|
-
help: 'Images must have alternative text',
|
137
|
-
fix: 'Add alt attribute with descriptive text or alt="" for decorative images',
|
138
|
-
elements: [img]
|
139
|
-
});
|
140
|
-
}
|
141
|
-
});
|
142
|
-
return { violations };
|
143
|
-
}
|
144
|
-
async function checkFormLabels(target) {
|
145
|
-
const violations = [];
|
146
|
-
const inputs = target.querySelectorAll('input, select, textarea');
|
147
|
-
inputs.forEach(input => {
|
148
|
-
const hasLabel = input.hasAttribute('aria-label') ||
|
149
|
-
input.hasAttribute('aria-labelledby') ||
|
150
|
-
target.querySelector(`label[for="${input.id}"]`) ||
|
151
|
-
input.closest('label');
|
152
|
-
if (!hasLabel) {
|
153
|
-
violations.push({
|
154
|
-
id: 'label',
|
155
|
-
impact: 'critical',
|
156
|
-
nodes: 1,
|
157
|
-
help: 'Form elements must have labels',
|
158
|
-
fix: 'Add a label element, aria-label, or aria-labelledby attribute',
|
159
|
-
elements: [input]
|
160
|
-
});
|
161
|
-
}
|
162
|
-
});
|
163
|
-
return { violations };
|
164
|
-
}
|
165
|
-
async function checkLinkNames(target) {
|
166
|
-
const violations = [];
|
167
|
-
const links = target.querySelectorAll('a[href]');
|
168
|
-
links.forEach(link => {
|
169
|
-
const text = link.textContent?.trim();
|
170
|
-
const ariaLabel = link.getAttribute('aria-label');
|
171
|
-
if (!text && !ariaLabel) {
|
172
|
-
violations.push({
|
173
|
-
id: 'link-name',
|
174
|
-
impact: 'serious',
|
175
|
-
nodes: 1,
|
176
|
-
help: 'Links must have discernible text',
|
177
|
-
fix: 'Add descriptive text content or aria-label attribute',
|
178
|
-
elements: [link]
|
179
|
-
});
|
180
|
-
}
|
181
|
-
});
|
182
|
-
return { violations };
|
183
|
-
}
|
184
|
-
async function checkButtonNames(target) {
|
185
|
-
const violations = [];
|
186
|
-
const buttons = target.querySelectorAll('button, input[type="button"], input[type="submit"]');
|
187
|
-
buttons.forEach(button => {
|
188
|
-
const text = button.textContent?.trim();
|
189
|
-
const ariaLabel = button.getAttribute('aria-label');
|
190
|
-
const value = button.getAttribute('value');
|
191
|
-
if (!text && !ariaLabel && !value) {
|
192
|
-
violations.push({
|
193
|
-
id: 'button-name',
|
194
|
-
impact: 'serious',
|
195
|
-
nodes: 1,
|
196
|
-
help: 'Buttons must have discernible text',
|
197
|
-
fix: 'Add text content, aria-label, or value attribute',
|
198
|
-
elements: [button]
|
199
|
-
});
|
200
|
-
}
|
201
|
-
});
|
202
|
-
return { violations };
|
203
|
-
}
|
204
|
-
async function checkFocusVisible(target) {
|
205
|
-
const violations = [];
|
206
|
-
const focusableElements = target.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
|
207
|
-
focusableElements.forEach(element => {
|
208
|
-
const styles = getComputedStyle(element);
|
209
|
-
const hasVisibleFocus = styles.outline !== 'none' && styles.outline !== '0px' &&
|
210
|
-
styles.outline !== '0' && styles.outlineWidth !== '0px';
|
211
|
-
// Check if element has custom focus styles
|
212
|
-
const hasCustomFocus = styles.boxShadow.includes('inset') ||
|
213
|
-
styles.border !== styles.borderColor ||
|
214
|
-
element.hasAttribute('data-focus-visible');
|
215
|
-
if (!hasVisibleFocus && !hasCustomFocus) {
|
216
|
-
violations.push({
|
217
|
-
id: 'focus-visible',
|
218
|
-
impact: 'serious',
|
219
|
-
nodes: 1,
|
220
|
-
help: 'Interactive elements must have visible focus indicators',
|
221
|
-
fix: 'Add outline, box-shadow, or other visible focus styles',
|
222
|
-
elements: [element]
|
223
|
-
});
|
224
|
-
}
|
225
|
-
});
|
226
|
-
return { violations };
|
227
|
-
}
|
228
|
-
async function checkAriaLabels(target) {
|
229
|
-
const violations = [];
|
230
|
-
// Check for aria-labelledby pointing to non-existent elements
|
231
|
-
const elementsWithLabelledBy = target.querySelectorAll('[aria-labelledby]');
|
232
|
-
elementsWithLabelledBy.forEach(element => {
|
233
|
-
const labelledBy = element.getAttribute('aria-labelledby');
|
234
|
-
if (labelledBy) {
|
235
|
-
const labelIds = labelledBy.split(' ');
|
236
|
-
const missingIds = labelIds.filter(id => !target.querySelector(`#${id}`));
|
237
|
-
if (missingIds.length > 0) {
|
238
|
-
violations.push({
|
239
|
-
id: 'aria-labelledby-invalid',
|
240
|
-
impact: 'serious',
|
241
|
-
nodes: 1,
|
242
|
-
help: 'aria-labelledby must reference existing elements',
|
243
|
-
fix: `Fix or remove references to missing IDs: ${missingIds.join(', ')}`,
|
244
|
-
elements: [element]
|
245
|
-
});
|
246
|
-
}
|
247
|
-
}
|
248
|
-
});
|
249
|
-
// Check for aria-describedby pointing to non-existent elements
|
250
|
-
const elementsWithDescribedBy = target.querySelectorAll('[aria-describedby]');
|
251
|
-
elementsWithDescribedBy.forEach(element => {
|
252
|
-
const describedBy = element.getAttribute('aria-describedby');
|
253
|
-
if (describedBy) {
|
254
|
-
const descriptionIds = describedBy.split(' ');
|
255
|
-
const missingIds = descriptionIds.filter(id => !target.querySelector(`#${id}`));
|
256
|
-
if (missingIds.length > 0) {
|
257
|
-
violations.push({
|
258
|
-
id: 'aria-describedby-invalid',
|
259
|
-
impact: 'moderate',
|
260
|
-
nodes: 1,
|
261
|
-
help: 'aria-describedby must reference existing elements',
|
262
|
-
fix: `Fix or remove references to missing IDs: ${missingIds.join(', ')}`,
|
263
|
-
elements: [element]
|
264
|
-
});
|
265
|
-
}
|
266
|
-
}
|
267
|
-
});
|
268
|
-
return { violations };
|
269
|
-
}
|
270
|
-
async function checkLandmarkRoles(target) {
|
271
|
-
const violations = [];
|
272
|
-
// Check for missing main landmark
|
273
|
-
const mainElements = target.querySelectorAll('main, [role="main"]');
|
274
|
-
if (mainElements.length === 0) {
|
275
|
-
violations.push({
|
276
|
-
id: 'landmark-main-missing',
|
277
|
-
impact: 'moderate',
|
278
|
-
nodes: 0,
|
279
|
-
help: 'Page should have a main landmark',
|
280
|
-
fix: 'Add a <main> element or role="main" to identify the main content area'
|
281
|
-
});
|
282
|
-
}
|
283
|
-
else if (mainElements.length > 1) {
|
284
|
-
violations.push({
|
285
|
-
id: 'landmark-main-multiple',
|
286
|
-
impact: 'moderate',
|
287
|
-
nodes: mainElements.length,
|
288
|
-
help: 'Page should have only one main landmark',
|
289
|
-
fix: 'Ensure only one main element or role="main" exists per page',
|
290
|
-
elements: Array.from(mainElements)
|
291
|
-
});
|
29
|
+
passes += target.querySelectorAll('img[alt]').length;
|
292
30
|
}
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
navElements.forEach(nav => {
|
297
|
-
const hasLabel = nav.hasAttribute('aria-label') ||
|
298
|
-
nav.hasAttribute('aria-labelledby') ||
|
299
|
-
nav.querySelector('h1, h2, h3, h4, h5, h6');
|
300
|
-
if (!hasLabel) {
|
301
|
-
violations.push({
|
302
|
-
id: 'landmark-nav-unlabeled',
|
303
|
-
impact: 'moderate',
|
304
|
-
nodes: 1,
|
305
|
-
help: 'Multiple navigation landmarks should be labeled',
|
306
|
-
fix: 'Add aria-label or aria-labelledby to distinguish navigation areas',
|
307
|
-
elements: [nav]
|
308
|
-
});
|
309
|
-
}
|
310
|
-
});
|
311
|
-
}
|
312
|
-
return { violations };
|
313
|
-
}
|
314
|
-
async function checkSkipLinks(target) {
|
315
|
-
const violations = [];
|
316
|
-
// Check for skip links in documents with navigation
|
317
|
-
const navElements = target.querySelectorAll('nav, [role="navigation"]');
|
318
|
-
const mainElement = target.querySelector('main, [role="main"]');
|
319
|
-
if (navElements.length > 0 && mainElement) {
|
320
|
-
const skipLinks = target.querySelectorAll('a[href^="#"]');
|
321
|
-
const hasSkipToMain = Array.from(skipLinks).some(link => {
|
322
|
-
const href = link.getAttribute('href');
|
323
|
-
return href && (href === '#main' ||
|
324
|
-
href === `#${mainElement.id}` ||
|
325
|
-
link.textContent?.toLowerCase().includes('skip to main') ||
|
326
|
-
link.textContent?.toLowerCase().includes('skip to content'));
|
327
|
-
});
|
328
|
-
if (!hasSkipToMain) {
|
31
|
+
if (rules.includes('headings')) {
|
32
|
+
const h1s = target.querySelectorAll('h1');
|
33
|
+
if (h1s.length !== 1) {
|
329
34
|
violations.push({
|
330
|
-
id: '
|
331
|
-
impact: 'moderate',
|
332
|
-
nodes: 0,
|
333
|
-
help: 'Page with navigation should have skip links',
|
334
|
-
fix: 'Add a skip link to the main content area for keyboard users'
|
35
|
+
id: 'heading-structure', impact: 'moderate', nodes: h1s.length, help: 'Page should have exactly one h1'
|
335
36
|
});
|
336
37
|
}
|
38
|
+
else
|
39
|
+
passes++;
|
337
40
|
}
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
const href = firstFocusable.getAttribute('href');
|
342
|
-
if (!href?.startsWith('#')) {
|
41
|
+
if (rules.includes('forms')) {
|
42
|
+
const unlabeled = target.querySelectorAll('input:not([aria-label]):not([aria-labelledby])');
|
43
|
+
if (unlabeled.length > 0) {
|
343
44
|
violations.push({
|
344
|
-
id: '
|
345
|
-
impact: 'minor',
|
346
|
-
nodes: 1,
|
347
|
-
help: 'Skip links should be the first focusable elements',
|
348
|
-
fix: 'Move skip links to the beginning of the document',
|
349
|
-
elements: [firstFocusable]
|
45
|
+
id: 'form-labels', impact: 'critical', nodes: unlabeled.length, help: 'Form inputs need labels'
|
350
46
|
});
|
351
47
|
}
|
48
|
+
passes += target.querySelectorAll('input[aria-label], input[aria-labelledby]').length;
|
352
49
|
}
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
function calculateContrast(color1, color2) {
|
357
|
-
// Convert colors to RGB values
|
358
|
-
const rgb1 = parseColor(color1);
|
359
|
-
const rgb2 = parseColor(color2);
|
360
|
-
if (!rgb1 || !rgb2)
|
361
|
-
return 4.5; // Fallback if parsing fails
|
362
|
-
// Calculate relative luminance
|
363
|
-
const l1 = getRelativeLuminance(rgb1);
|
364
|
-
const l2 = getRelativeLuminance(rgb2);
|
365
|
-
// Calculate contrast ratio
|
366
|
-
const lighter = Math.max(l1, l2);
|
367
|
-
const darker = Math.min(l1, l2);
|
368
|
-
return (lighter + 0.05) / (darker + 0.05);
|
369
|
-
}
|
370
|
-
function parseColor(color) {
|
371
|
-
// Handle rgb() format
|
372
|
-
const rgbMatch = color.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
373
|
-
if (rgbMatch && rgbMatch[1] && rgbMatch[2] && rgbMatch[3]) {
|
374
|
-
return {
|
375
|
-
r: parseInt(rgbMatch[1], 10),
|
376
|
-
g: parseInt(rgbMatch[2], 10),
|
377
|
-
b: parseInt(rgbMatch[3], 10)
|
378
|
-
};
|
379
|
-
}
|
380
|
-
// Handle hex format
|
381
|
-
const hexMatch = color.match(/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);
|
382
|
-
if (hexMatch && hexMatch[1] && hexMatch[2] && hexMatch[3]) {
|
383
|
-
return {
|
384
|
-
r: parseInt(hexMatch[1], 16),
|
385
|
-
g: parseInt(hexMatch[2], 16),
|
386
|
-
b: parseInt(hexMatch[3], 16)
|
387
|
-
};
|
388
|
-
}
|
389
|
-
// Handle named colors (basic set)
|
390
|
-
const namedColors = {
|
391
|
-
'black': { r: 0, g: 0, b: 0 },
|
392
|
-
'white': { r: 255, g: 255, b: 255 },
|
393
|
-
'red': { r: 255, g: 0, b: 0 },
|
394
|
-
'green': { r: 0, g: 128, b: 0 },
|
395
|
-
'blue': { r: 0, g: 0, b: 255 }
|
50
|
+
const report = {
|
51
|
+
violations, passes, timestamp: Date.now(),
|
52
|
+
url: typeof window !== 'undefined' ? window.location.href : ''
|
396
53
|
};
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
// Convert to sRGB
|
402
|
-
const rsRGB = r / 255;
|
403
|
-
const gsRGB = g / 255;
|
404
|
-
const bsRGB = b / 255;
|
405
|
-
// Apply gamma correction
|
406
|
-
const rLinear = rsRGB <= 0.03928 ? rsRGB / 12.92 : Math.pow((rsRGB + 0.055) / 1.055, 2.4);
|
407
|
-
const gLinear = gsRGB <= 0.03928 ? gsRGB / 12.92 : Math.pow((gsRGB + 0.055) / 1.055, 2.4);
|
408
|
-
const bLinear = bsRGB <= 0.03928 ? bsRGB / 12.92 : Math.pow((bsRGB + 0.055) / 1.055, 2.4);
|
409
|
-
// Calculate relative luminance
|
410
|
-
return 0.2126 * rLinear + 0.7152 * gLinear + 0.0722 * bLinear;
|
411
|
-
}
|
412
|
-
function outputToConsole(report) {
|
413
|
-
console.group('🔍 Accessibility Audit Results');
|
414
|
-
if (report.violations.length === 0) {
|
415
|
-
console.log('✅ No accessibility violations found!');
|
54
|
+
if (format === 'console' && violations.length > 0) {
|
55
|
+
console.group('🔍 A11y Audit Results');
|
56
|
+
violations.forEach(v => console.warn(`${v.impact}: ${v.help}`));
|
57
|
+
console.groupEnd();
|
416
58
|
}
|
417
|
-
|
418
|
-
console.log(`❌ Found ${report.violations.length} accessibility violations:`);
|
419
|
-
report.violations.forEach(violation => {
|
420
|
-
const emoji = violation.impact === 'critical' ? '🚨' :
|
421
|
-
violation.impact === 'serious' ? '⚠️' :
|
422
|
-
violation.impact === 'moderate' ? '⚡' : 'ℹ️';
|
423
|
-
console.group(`${emoji} ${violation.help}`);
|
424
|
-
console.log(`Impact: ${violation.impact}`);
|
425
|
-
console.log(`Fix: ${violation.fix}`);
|
426
|
-
if (violation.elements) {
|
427
|
-
console.log('Elements:', violation.elements);
|
428
|
-
}
|
429
|
-
console.groupEnd();
|
430
|
-
});
|
431
|
-
}
|
432
|
-
console.log(`✅ ${report.passes} checks passed`);
|
433
|
-
if (report.incomplete > 0) {
|
434
|
-
console.log(`⚠️ ${report.incomplete} checks incomplete`);
|
435
|
-
}
|
436
|
-
console.groupEnd();
|
437
|
-
}
|
438
|
-
function openReportInBrowser(report) {
|
439
|
-
const html = generateHTMLReport(report);
|
440
|
-
const blob = new Blob([html], { type: 'text/html' });
|
441
|
-
const url = URL.createObjectURL(blob);
|
442
|
-
const newWindow = window.open(url, '_blank');
|
443
|
-
if (!newWindow) {
|
444
|
-
console.warn('Could not open report in new window. Please check popup blocker settings.');
|
445
|
-
// Fallback: download the report
|
446
|
-
const link = document.createElement('a');
|
447
|
-
link.href = url;
|
448
|
-
link.download = `proteus-a11y-report-${Date.now()}.html`;
|
449
|
-
link.click();
|
450
|
-
}
|
451
|
-
// Clean up the blob URL after a delay
|
452
|
-
setTimeout(() => URL.revokeObjectURL(url), 1000);
|
453
|
-
}
|
454
|
-
function generateHTMLReport(report) {
|
455
|
-
const violationsList = report.violations.map(violation => `
|
456
|
-
<div class="violation violation--${violation.impact}">
|
457
|
-
<h3>${violation.help}</h3>
|
458
|
-
<p><strong>Impact:</strong> ${violation.impact}</p>
|
459
|
-
<p><strong>Fix:</strong> ${violation.fix}</p>
|
460
|
-
<p><strong>Affected elements:</strong> ${violation.nodes}</p>
|
461
|
-
</div>
|
462
|
-
`).join('');
|
463
|
-
return `
|
464
|
-
<!DOCTYPE html>
|
465
|
-
<html lang="en">
|
466
|
-
<head>
|
467
|
-
<meta charset="UTF-8">
|
468
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
469
|
-
<title>ProteusJS Accessibility Report</title>
|
470
|
-
<style>
|
471
|
-
body { font-family: system-ui, sans-serif; margin: 2rem; line-height: 1.6; }
|
472
|
-
.header { border-bottom: 2px solid #e5e7eb; padding-bottom: 1rem; margin-bottom: 2rem; }
|
473
|
-
.summary { background: #f3f4f6; padding: 1rem; border-radius: 8px; margin-bottom: 2rem; }
|
474
|
-
.violation { border-left: 4px solid #ef4444; padding: 1rem; margin-bottom: 1rem; background: #fef2f2; }
|
475
|
-
.violation--critical { border-color: #dc2626; background: #fef2f2; }
|
476
|
-
.violation--serious { border-color: #ea580c; background: #fff7ed; }
|
477
|
-
.violation--moderate { border-color: #d97706; background: #fffbeb; }
|
478
|
-
.violation--minor { border-color: #65a30d; background: #f7fee7; }
|
479
|
-
.violation h3 { margin-top: 0; color: #374151; }
|
480
|
-
.no-violations { text-align: center; color: #059669; font-size: 1.25rem; padding: 2rem; }
|
481
|
-
</style>
|
482
|
-
</head>
|
483
|
-
<body>
|
484
|
-
<div class="header">
|
485
|
-
<h1>🌊 ProteusJS Accessibility Report</h1>
|
486
|
-
<p>Generated on ${new Date(report.timestamp).toLocaleString()}</p>
|
487
|
-
<p>URL: ${report.url}</p>
|
488
|
-
</div>
|
489
|
-
|
490
|
-
<div class="summary">
|
491
|
-
<h2>Summary</h2>
|
492
|
-
<p><strong>Violations:</strong> ${report.violations.length}</p>
|
493
|
-
<p><strong>Checks passed:</strong> ${report.passes}</p>
|
494
|
-
<p><strong>Incomplete checks:</strong> ${report.incomplete}</p>
|
495
|
-
</div>
|
496
|
-
|
497
|
-
${report.violations.length === 0 ?
|
498
|
-
'<div class="no-violations">✅ No accessibility violations found!</div>' :
|
499
|
-
`<h2>Violations</h2>${violationsList}`}
|
500
|
-
</body>
|
501
|
-
</html>`;
|
59
|
+
return report;
|
502
60
|
}
|
503
|
-
|
504
|
-
var index = {
|
505
|
-
audit
|
506
|
-
};
|
61
|
+
var index = { audit };
|
507
62
|
|
508
63
|
export { audit, index as default };
|
509
64
|
//# sourceMappingURL=a11y-audit.esm.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"a11y-audit.esm.js","sources":["../../src/modules/a11y-audit/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AAAA;;;;;;;AAOG;AAyBH;;;AAGG;AACI,eAAe,KAAK,CACzB,MAAA,GAA6B,QAAQ,EACrC,OAAA,GAAwB,EAAE,EAAA;;IAG1B,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,YAAY,EAAE;AAC5C,QAAA,OAAO,CAAC,IAAI,CAAC,6CAA6C,CAAC;QAC3D,OAAO;AACL,YAAA,UAAU,EAAE,EAAE;AACd,YAAA,MAAM,EAAE,CAAC;AACT,YAAA,UAAU,EAAE,CAAC;AACb,YAAA,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;AACrB,YAAA,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC;SACtB;IACH;IAEA,MAAM,EACJ,KAAK,GAAG,CAAC,gBAAgB,EAAE,eAAe,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,CAAC,EAC7F,MAAM,GAAG,SAAS,EAClB,aAAa,GAAG,KAAK,EACtB,GAAG,OAAO;IAEX,MAAM,UAAU,GAAqB,EAAE;IACvC,IAAI,MAAM,GAAG,CAAC;IACd,IAAI,UAAU,GAAG,CAAC;;AAGlB,IAAA,MAAM,MAAM,GAAG;AACb,QAAA,gBAAgB,EAAE,kBAAkB;AACpC,QAAA,eAAe,EAAE,iBAAiB;AAClC,QAAA,WAAW,EAAE,aAAa;AAC1B,QAAA,OAAO,EAAE,eAAe;AACxB,QAAA,WAAW,EAAE,cAAc;AAC3B,QAAA,aAAa,EAAE,gBAAgB;AAC/B,QAAA,eAAe,EAAE,iBAAiB;AAClC,QAAA,aAAa,EA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AAA,CAAC;QACJ;QACA,MAAM,IAAI,MAAM,CAAC,gBAAgB,CAAC,2CAA2C,CAAC,CAAC,MAAM;IACvF;AAEA,IAAA,MAAM,MAAM,GAAgB;QAC1B,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;AACzC,QAAA,GAAG,EAAE,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG;KAC7D;IAED,IAAI,MAAM,KAAK,SAAS,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;AACjD,QAAA,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC;QACtC,UAAU,CAAC,OAAO,CAAC,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAA,EAAA,EAAK,CAAC,CAAC,IAAI,CAAA,CAAE,CAAC,CAAC;QAC/D,OAAO,CAAC,QAAQ,EAAE;IACpB;AAEA,IAAA,OAAO,MAAM;AACf;AAEA,YAAe,EAAE,KAAK,EAAE;;;;"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/**
|
2
2
|
* @sc4rfurryx/proteusjs/a11y-primitives
|
3
|
-
*
|
3
|
+
* Lightweight accessibility patterns
|
4
4
|
*
|
5
5
|
* @version 1.1.0
|
6
6
|
* @author sc4rfurry
|
@@ -15,55 +15,22 @@ interface DialogOptions {
|
|
15
15
|
}
|
16
16
|
interface TooltipOptions {
|
17
17
|
delay?: number;
|
18
|
-
|
19
|
-
interface ComboboxOptions {
|
20
|
-
multiselect?: boolean;
|
21
|
-
filtering?: (query: string) => Promise<unknown[]> | unknown[];
|
22
|
-
}
|
23
|
-
interface ListboxOptions {
|
24
|
-
multiselect?: boolean;
|
18
|
+
placement?: 'top' | 'bottom' | 'left' | 'right';
|
25
19
|
}
|
26
20
|
interface FocusTrapController {
|
27
21
|
activate(): void;
|
28
22
|
deactivate(): void;
|
29
23
|
}
|
30
|
-
/**
|
31
|
-
* Dialog primitive with proper ARIA and focus management
|
32
|
-
*/
|
33
24
|
declare function dialog(root: Element | string, opts?: DialogOptions): Controller;
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
declare function tooltip(trigger: Element | string, panel: Element | string, opts?: TooltipOptions): Controller;
|
38
|
-
/**
|
39
|
-
* Listbox primitive with keyboard navigation
|
40
|
-
*/
|
41
|
-
declare function listbox(root: Element | string, opts?: ListboxOptions): Controller;
|
42
|
-
/**
|
43
|
-
* Combobox primitive with filtering and multiselect
|
44
|
-
*/
|
45
|
-
declare function combobox(root: Element | string, opts?: ComboboxOptions): Controller;
|
46
|
-
/**
|
47
|
-
* Tabs primitive with keyboard navigation
|
48
|
-
*/
|
49
|
-
declare function tabs(root: Element | string): Controller;
|
50
|
-
/**
|
51
|
-
* Menu primitive with keyboard navigation
|
52
|
-
*/
|
53
|
-
declare function menu(root: Element | string): Controller;
|
54
|
-
/**
|
55
|
-
* Focus trap utility
|
56
|
-
*/
|
57
|
-
declare function focusTrap(root: Element | string): FocusTrapController;
|
25
|
+
declare function tooltip(trigger: Element, content: Element, opts?: TooltipOptions): Controller;
|
26
|
+
declare function focusTrap(container: Element): FocusTrapController;
|
27
|
+
declare function menu(container: Element): Controller;
|
58
28
|
declare const _default: {
|
59
29
|
dialog: typeof dialog;
|
60
30
|
tooltip: typeof tooltip;
|
61
|
-
combobox: typeof combobox;
|
62
|
-
listbox: typeof listbox;
|
63
|
-
tabs: typeof tabs;
|
64
|
-
menu: typeof menu;
|
65
31
|
focusTrap: typeof focusTrap;
|
32
|
+
menu: typeof menu;
|
66
33
|
};
|
67
34
|
|
68
|
-
export {
|
69
|
-
export type {
|
35
|
+
export { _default as default, dialog, focusTrap, menu, tooltip };
|
36
|
+
export type { Controller, DialogOptions, FocusTrapController, TooltipOptions };
|