@accesslint/storybook-addon 0.8.0 → 0.8.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/dist/portable.cjs +11 -3
- package/dist/portable.js +12 -4
- package/dist/preview.cjs +11 -3
- package/dist/preview.js +12 -4
- package/dist/vitest-setup.cjs +11 -3
- package/dist/vitest-setup.js +12 -4
- package/package.json +4 -3
package/dist/portable.cjs
CHANGED
|
@@ -16,6 +16,10 @@ __export(preview_exports, {
|
|
|
16
16
|
core.configureRules({
|
|
17
17
|
disabledRules: ["accesslint-045"]
|
|
18
18
|
});
|
|
19
|
+
var BUDGET_MS = 12;
|
|
20
|
+
function yieldToMain() {
|
|
21
|
+
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
22
|
+
}
|
|
19
23
|
function scopeViolations(violations) {
|
|
20
24
|
const root = document.getElementById("storybook-root");
|
|
21
25
|
if (!root) return violations;
|
|
@@ -55,8 +59,12 @@ var afterEach = async ({
|
|
|
55
59
|
if (tags?.includes("no-a11y")) return;
|
|
56
60
|
const skipTags = typeof __ACCESSLINT_SKIP_TAGS__ !== "undefined" ? __ACCESSLINT_SKIP_TAGS__ : [];
|
|
57
61
|
if (skipTags.length > 0 && tags?.some((t) => skipTags.includes(t))) return;
|
|
58
|
-
const
|
|
59
|
-
|
|
62
|
+
const audit = core.createChunkedAudit(document);
|
|
63
|
+
while (audit.processChunk(BUDGET_MS)) {
|
|
64
|
+
await yieldToMain();
|
|
65
|
+
}
|
|
66
|
+
const violations = audit.getViolations();
|
|
67
|
+
const scoped = scopeViolations(violations);
|
|
60
68
|
const enriched = enrichViolations(scoped);
|
|
61
69
|
const hasViolations = enriched.length > 0;
|
|
62
70
|
const mode = accesslintParam?.test === "todo" ? "warning" : "failed";
|
|
@@ -65,7 +73,7 @@ var afterEach = async ({
|
|
|
65
73
|
version: 1,
|
|
66
74
|
result: {
|
|
67
75
|
violations: enriched,
|
|
68
|
-
ruleCount:
|
|
76
|
+
ruleCount: core.getActiveRules().length
|
|
69
77
|
},
|
|
70
78
|
status: hasViolations ? mode : "passed"
|
|
71
79
|
});
|
package/dist/portable.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { configureRules,
|
|
1
|
+
import { configureRules, createChunkedAudit, getActiveRules, getRuleById } from '@accesslint/core';
|
|
2
2
|
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __export = (target, all) => {
|
|
@@ -14,6 +14,10 @@ __export(preview_exports, {
|
|
|
14
14
|
configureRules({
|
|
15
15
|
disabledRules: ["accesslint-045"]
|
|
16
16
|
});
|
|
17
|
+
var BUDGET_MS = 12;
|
|
18
|
+
function yieldToMain() {
|
|
19
|
+
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
20
|
+
}
|
|
17
21
|
function scopeViolations(violations) {
|
|
18
22
|
const root = document.getElementById("storybook-root");
|
|
19
23
|
if (!root) return violations;
|
|
@@ -53,8 +57,12 @@ var afterEach = async ({
|
|
|
53
57
|
if (tags?.includes("no-a11y")) return;
|
|
54
58
|
const skipTags = typeof __ACCESSLINT_SKIP_TAGS__ !== "undefined" ? __ACCESSLINT_SKIP_TAGS__ : [];
|
|
55
59
|
if (skipTags.length > 0 && tags?.some((t) => skipTags.includes(t))) return;
|
|
56
|
-
const
|
|
57
|
-
|
|
60
|
+
const audit = createChunkedAudit(document);
|
|
61
|
+
while (audit.processChunk(BUDGET_MS)) {
|
|
62
|
+
await yieldToMain();
|
|
63
|
+
}
|
|
64
|
+
const violations = audit.getViolations();
|
|
65
|
+
const scoped = scopeViolations(violations);
|
|
58
66
|
const enriched = enrichViolations(scoped);
|
|
59
67
|
const hasViolations = enriched.length > 0;
|
|
60
68
|
const mode = accesslintParam?.test === "todo" ? "warning" : "failed";
|
|
@@ -63,7 +71,7 @@ var afterEach = async ({
|
|
|
63
71
|
version: 1,
|
|
64
72
|
result: {
|
|
65
73
|
violations: enriched,
|
|
66
|
-
ruleCount:
|
|
74
|
+
ruleCount: getActiveRules().length
|
|
67
75
|
},
|
|
68
76
|
status: hasViolations ? mode : "passed"
|
|
69
77
|
});
|
package/dist/preview.cjs
CHANGED
|
@@ -6,6 +6,10 @@ var core = require('@accesslint/core');
|
|
|
6
6
|
core.configureRules({
|
|
7
7
|
disabledRules: ["accesslint-045"]
|
|
8
8
|
});
|
|
9
|
+
var BUDGET_MS = 12;
|
|
10
|
+
function yieldToMain() {
|
|
11
|
+
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
12
|
+
}
|
|
9
13
|
function scopeViolations(violations) {
|
|
10
14
|
const root = document.getElementById("storybook-root");
|
|
11
15
|
if (!root) return violations;
|
|
@@ -45,8 +49,12 @@ var afterEach = async ({
|
|
|
45
49
|
if (tags?.includes("no-a11y")) return;
|
|
46
50
|
const skipTags = typeof __ACCESSLINT_SKIP_TAGS__ !== "undefined" ? __ACCESSLINT_SKIP_TAGS__ : [];
|
|
47
51
|
if (skipTags.length > 0 && tags?.some((t) => skipTags.includes(t))) return;
|
|
48
|
-
const
|
|
49
|
-
|
|
52
|
+
const audit = core.createChunkedAudit(document);
|
|
53
|
+
while (audit.processChunk(BUDGET_MS)) {
|
|
54
|
+
await yieldToMain();
|
|
55
|
+
}
|
|
56
|
+
const violations = audit.getViolations();
|
|
57
|
+
const scoped = scopeViolations(violations);
|
|
50
58
|
const enriched = enrichViolations(scoped);
|
|
51
59
|
const hasViolations = enriched.length > 0;
|
|
52
60
|
const mode = accesslintParam?.test === "todo" ? "warning" : "failed";
|
|
@@ -55,7 +63,7 @@ var afterEach = async ({
|
|
|
55
63
|
version: 1,
|
|
56
64
|
result: {
|
|
57
65
|
violations: enriched,
|
|
58
|
-
ruleCount:
|
|
66
|
+
ruleCount: core.getActiveRules().length
|
|
59
67
|
},
|
|
60
68
|
status: hasViolations ? mode : "passed"
|
|
61
69
|
});
|
package/dist/preview.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { configureRules,
|
|
1
|
+
import { configureRules, createChunkedAudit, getActiveRules, getRuleById } from '@accesslint/core';
|
|
2
2
|
|
|
3
3
|
// src/preview.ts
|
|
4
4
|
configureRules({
|
|
5
5
|
disabledRules: ["accesslint-045"]
|
|
6
6
|
});
|
|
7
|
+
var BUDGET_MS = 12;
|
|
8
|
+
function yieldToMain() {
|
|
9
|
+
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
10
|
+
}
|
|
7
11
|
function scopeViolations(violations) {
|
|
8
12
|
const root = document.getElementById("storybook-root");
|
|
9
13
|
if (!root) return violations;
|
|
@@ -43,8 +47,12 @@ var afterEach = async ({
|
|
|
43
47
|
if (tags?.includes("no-a11y")) return;
|
|
44
48
|
const skipTags = typeof __ACCESSLINT_SKIP_TAGS__ !== "undefined" ? __ACCESSLINT_SKIP_TAGS__ : [];
|
|
45
49
|
if (skipTags.length > 0 && tags?.some((t) => skipTags.includes(t))) return;
|
|
46
|
-
const
|
|
47
|
-
|
|
50
|
+
const audit = createChunkedAudit(document);
|
|
51
|
+
while (audit.processChunk(BUDGET_MS)) {
|
|
52
|
+
await yieldToMain();
|
|
53
|
+
}
|
|
54
|
+
const violations = audit.getViolations();
|
|
55
|
+
const scoped = scopeViolations(violations);
|
|
48
56
|
const enriched = enrichViolations(scoped);
|
|
49
57
|
const hasViolations = enriched.length > 0;
|
|
50
58
|
const mode = accesslintParam?.test === "todo" ? "warning" : "failed";
|
|
@@ -53,7 +61,7 @@ var afterEach = async ({
|
|
|
53
61
|
version: 1,
|
|
54
62
|
result: {
|
|
55
63
|
violations: enriched,
|
|
56
|
-
ruleCount:
|
|
64
|
+
ruleCount: getActiveRules().length
|
|
57
65
|
},
|
|
58
66
|
status: hasViolations ? mode : "passed"
|
|
59
67
|
});
|
package/dist/vitest-setup.cjs
CHANGED
|
@@ -20,6 +20,10 @@ __export(preview_exports, {
|
|
|
20
20
|
core.configureRules({
|
|
21
21
|
disabledRules: ["accesslint-045"]
|
|
22
22
|
});
|
|
23
|
+
var BUDGET_MS = 12;
|
|
24
|
+
function yieldToMain() {
|
|
25
|
+
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
26
|
+
}
|
|
23
27
|
function scopeViolations(violations) {
|
|
24
28
|
const root = document.getElementById("storybook-root");
|
|
25
29
|
if (!root) return violations;
|
|
@@ -59,8 +63,12 @@ var afterEach = async ({
|
|
|
59
63
|
if (tags?.includes("no-a11y")) return;
|
|
60
64
|
const skipTags = typeof __ACCESSLINT_SKIP_TAGS__ !== "undefined" ? __ACCESSLINT_SKIP_TAGS__ : [];
|
|
61
65
|
if (skipTags.length > 0 && tags?.some((t) => skipTags.includes(t))) return;
|
|
62
|
-
const
|
|
63
|
-
|
|
66
|
+
const audit = core.createChunkedAudit(document);
|
|
67
|
+
while (audit.processChunk(BUDGET_MS)) {
|
|
68
|
+
await yieldToMain();
|
|
69
|
+
}
|
|
70
|
+
const violations = audit.getViolations();
|
|
71
|
+
const scoped = scopeViolations(violations);
|
|
64
72
|
const enriched = enrichViolations(scoped);
|
|
65
73
|
const hasViolations = enriched.length > 0;
|
|
66
74
|
const mode = accesslintParam?.test === "todo" ? "warning" : "failed";
|
|
@@ -69,7 +77,7 @@ var afterEach = async ({
|
|
|
69
77
|
version: 1,
|
|
70
78
|
result: {
|
|
71
79
|
violations: enriched,
|
|
72
|
-
ruleCount:
|
|
80
|
+
ruleCount: core.getActiveRules().length
|
|
73
81
|
},
|
|
74
82
|
status: hasViolations ? mode : "passed"
|
|
75
83
|
});
|
package/dist/vitest-setup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { expect } from 'storybook/test';
|
|
2
2
|
import { expect as expect$1 } from 'vitest';
|
|
3
3
|
import { composeConfigs } from 'storybook/preview-api';
|
|
4
|
-
import { configureRules,
|
|
4
|
+
import { configureRules, createChunkedAudit, getActiveRules, getRuleById } from '@accesslint/core';
|
|
5
5
|
import { accesslintMatchers } from '@accesslint/vitest/matchers';
|
|
6
6
|
|
|
7
7
|
var __defProp = Object.defineProperty;
|
|
@@ -18,6 +18,10 @@ __export(preview_exports, {
|
|
|
18
18
|
configureRules({
|
|
19
19
|
disabledRules: ["accesslint-045"]
|
|
20
20
|
});
|
|
21
|
+
var BUDGET_MS = 12;
|
|
22
|
+
function yieldToMain() {
|
|
23
|
+
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
24
|
+
}
|
|
21
25
|
function scopeViolations(violations) {
|
|
22
26
|
const root = document.getElementById("storybook-root");
|
|
23
27
|
if (!root) return violations;
|
|
@@ -57,8 +61,12 @@ var afterEach = async ({
|
|
|
57
61
|
if (tags?.includes("no-a11y")) return;
|
|
58
62
|
const skipTags = typeof __ACCESSLINT_SKIP_TAGS__ !== "undefined" ? __ACCESSLINT_SKIP_TAGS__ : [];
|
|
59
63
|
if (skipTags.length > 0 && tags?.some((t) => skipTags.includes(t))) return;
|
|
60
|
-
const
|
|
61
|
-
|
|
64
|
+
const audit = createChunkedAudit(document);
|
|
65
|
+
while (audit.processChunk(BUDGET_MS)) {
|
|
66
|
+
await yieldToMain();
|
|
67
|
+
}
|
|
68
|
+
const violations = audit.getViolations();
|
|
69
|
+
const scoped = scopeViolations(violations);
|
|
62
70
|
const enriched = enrichViolations(scoped);
|
|
63
71
|
const hasViolations = enriched.length > 0;
|
|
64
72
|
const mode = accesslintParam?.test === "todo" ? "warning" : "failed";
|
|
@@ -67,7 +75,7 @@ var afterEach = async ({
|
|
|
67
75
|
version: 1,
|
|
68
76
|
result: {
|
|
69
77
|
violations: enriched,
|
|
70
|
-
ruleCount:
|
|
78
|
+
ruleCount: getActiveRules().length
|
|
71
79
|
},
|
|
72
80
|
status: hasViolations ? mode : "passed"
|
|
73
81
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@accesslint/storybook-addon",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "Catch accessibility violations in your Storybook stories as you develop",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -67,10 +67,11 @@
|
|
|
67
67
|
"storybook": "^10.2.0",
|
|
68
68
|
"tsup": "^8.4.0",
|
|
69
69
|
"typescript": "^5.7.0",
|
|
70
|
-
"vitest": "^
|
|
70
|
+
"vitest": "^4.0.18"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
|
-
"storybook": "^9.0.0 || ^10.0.0"
|
|
73
|
+
"storybook": "^9.0.0 || ^10.0.0",
|
|
74
|
+
"vitest": ">=3.0.0"
|
|
74
75
|
},
|
|
75
76
|
"keywords": [
|
|
76
77
|
"storybook-addon",
|