@accesslint/core 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -11
- package/dist/index.cjs +5 -5
- package/dist/index.iife.js +5 -5
- package/dist/index.js +421 -384
- package/dist/rules/aria/aria-attr-audit.d.ts.map +1 -1
- package/dist/rules/color/color-contrast.d.ts.map +1 -1
- package/dist/rules/index.d.ts.map +1 -1
- package/dist/rules/keyboard/interactive-rules.d.ts.map +1 -1
- package/dist/rules/utils/aria.d.ts +1 -0
- package/dist/rules/utils/aria.d.ts.map +1 -1
- package/dist/rules/utils/selector.d.ts +1 -0
- package/dist/rules/utils/selector.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @accesslint/core
|
|
2
2
|
|
|
3
|
-
Pure accessibility rule engine for WCAG auditing.
|
|
3
|
+
Pure accessibility rule engine for WCAG auditing. 84 bundled rules, a declarative rule engine, and zero browser dependencies.
|
|
4
4
|
|
|
5
5
|
## Highlights
|
|
6
6
|
|
|
7
|
-
- **Lightweight** —
|
|
7
|
+
- **Lightweight** — 31 KB gzipped (IIFE), with zero runtime dependencies
|
|
8
8
|
- **Chunked audits** — time-budgeted processing via [`createChunkedAudit`](#createchunkedauditdoc-document-chunkedaudit) to avoid long tasks on the main thread
|
|
9
9
|
- **Declarative rule engine** — define custom rules as JSON and compile them with [`compileDeclarativeRule`](#compiledeclarativerulespec-declarativerule-rule), no JavaScript required
|
|
10
10
|
- **ESM, CJS, and IIFE** — tree-shakable ES modules, CommonJS for Node, and a single-file IIFE for script injection into any page
|
|
@@ -163,7 +163,7 @@ const rule = compileDeclarativeRule({
|
|
|
163
163
|
|
|
164
164
|
### `rules`
|
|
165
165
|
|
|
166
|
-
Array of all
|
|
166
|
+
Array of all 84 bundled `Rule` objects.
|
|
167
167
|
|
|
168
168
|
### `getActiveRules(): Rule[]`
|
|
169
169
|
|
|
@@ -188,7 +188,7 @@ Helpers for building custom rules:
|
|
|
188
188
|
|
|
189
189
|
## Rules
|
|
190
190
|
|
|
191
|
-
|
|
191
|
+
84 rules covering WCAG 2.1 Level A and AA.
|
|
192
192
|
|
|
193
193
|
| Rule | Level | WCAG | Description |
|
|
194
194
|
| ---- | ----- | ---- | ----------- |
|
|
@@ -275,18 +275,15 @@ Helpers for building custom rules:
|
|
|
275
275
|
| `duplicate-id-aria` | A | 4.1.2 | IDs used in ARIA must be unique. |
|
|
276
276
|
| `video-caption` | A | 1.2.2 | Videos must have captions. |
|
|
277
277
|
| `audio-caption` | A | 1.2.1 | Audio elements should have a text alternative. |
|
|
278
|
+
| `color-contrast` | AA | 1.4.3 | Text must have sufficient color contrast. |
|
|
278
279
|
|
|
279
280
|
## Benchmarks
|
|
280
281
|
|
|
281
|
-
Full audit (`runAudit`) on synthetic
|
|
282
|
+
Full audit (`runAudit`) on a synthetic 100-element document with a realistic mix of valid and invalid elements:
|
|
282
283
|
|
|
283
284
|
| Document size | ops/sec | mean |
|
|
284
285
|
| ------------- | ------: | ---: |
|
|
285
|
-
| 100 elements |
|
|
286
|
-
| 1,000 elements | 27 | 36.6 ms |
|
|
287
|
-
| 2,000 elements | 2.0 | 494 ms |
|
|
288
|
-
|
|
289
|
-
> Measured on GitHub Actions `ubuntu-latest` / Node 22 with `vitest bench` ([run](https://github.com/AccessLint/core/actions/runs/21695011947)).
|
|
286
|
+
| 100 elements | 392 | 2.5 ms |
|
|
290
287
|
|
|
291
288
|
### Concordance with axe-core
|
|
292
289
|
|
|
@@ -304,7 +301,7 @@ On a synthetic 500-element document exercising all rule categories:
|
|
|
304
301
|
|
|
305
302
|
```sh
|
|
306
303
|
npm install
|
|
307
|
-
npm test #
|
|
304
|
+
npm test # 410 tests
|
|
308
305
|
npm run bench # performance benchmarks
|
|
309
306
|
npm run build # produces dist/index.js, dist/index.cjs, dist/index.d.ts
|
|
310
307
|
```
|