axle-storybook 0.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 ADDED
@@ -0,0 +1,98 @@
1
+ # axle-storybook
2
+
3
+ Storybook addon — runs **axe-core 4.11** against every story and shows WCAG 2.2 AA violations in a Storybook panel. Same engine as [axle](https://axle-iota.vercel.app)'s GitHub Action and CLI.
4
+
5
+ ## Why use this and not `@storybook/addon-a11y`
6
+
7
+ Both addons run axe-core, so the engine is identical. The differences:
8
+
9
+ - `@storybook/addon-a11y` is the official, broadly-compatible addon focused on a panel + a11y testing during dev.
10
+ - `axle-storybook` is the same engine **packaged for the same compliance workflow as the axle GitHub Action**. Stories that fail the addon will fail axle CI on PR. The output schema matches the rest of the axle ecosystem (CLI, Vercel/Netlify/Cloudflare plugins, VS Code extension), so you can reason about a single set of rules across surfaces.
11
+
12
+ If you're already happy with `@storybook/addon-a11y` and don't use axle's CI, stick with it. If you do use axle CI and want consistency between dev (Storybook) and CI, use this.
13
+
14
+ ## Install
15
+
16
+ ```sh
17
+ npm install --save-dev axle-storybook
18
+ ```
19
+
20
+ Add to `.storybook/main.ts`:
21
+
22
+ ```ts
23
+ import type { StorybookConfig } from "@storybook/your-framework";
24
+
25
+ const config: StorybookConfig = {
26
+ // ...
27
+ addons: [
28
+ "@storybook/addon-essentials",
29
+ "axle-storybook",
30
+ ],
31
+ };
32
+ export default config;
33
+ ```
34
+
35
+ That's all. Open Storybook → switch stories — the **a11y / WCAG** panel will populate.
36
+
37
+ ## Configuration
38
+
39
+ Per-story or per-component:
40
+
41
+ ```ts
42
+ import type { Meta, StoryObj } from "@storybook/react";
43
+ import MyButton from "./MyButton";
44
+
45
+ const meta: Meta<typeof MyButton> = {
46
+ component: MyButton,
47
+ parameters: {
48
+ axle: {
49
+ // disable the addon for this component (e.g., demo of a known
50
+ // failure case)
51
+ disable: false,
52
+ // override axe-core options
53
+ options: {
54
+ runOnly: { type: "tag", values: ["wcag2aa", "wcag22aa"] },
55
+ },
56
+ },
57
+ },
58
+ };
59
+ export default meta;
60
+
61
+ export const Primary: StoryObj<typeof MyButton> = {};
62
+ ```
63
+
64
+ Globally in `.storybook/preview.ts`:
65
+
66
+ ```ts
67
+ import type { Preview } from "@storybook/react";
68
+
69
+ const preview: Preview = {
70
+ parameters: {
71
+ axle: {
72
+ options: {
73
+ runOnly: { type: "tag", values: ["wcag2aa", "wcag22aa"] },
74
+ },
75
+ },
76
+ },
77
+ };
78
+ export default preview;
79
+ ```
80
+
81
+ ## Companion tools
82
+
83
+ | Surface | Package |
84
+ |---|---|
85
+ | GitHub Action | `asafamos/axle-action@v1` |
86
+ | npm CLI | `axle-cli` |
87
+ | Netlify plugin | `axle-netlify-plugin` |
88
+ | Cloudflare Pages plugin | `axle-cloudflare-plugin` |
89
+ | Vercel plugin | `axle-vercel-plugin` |
90
+ | WordPress plugin | "AsafAmos Accessibility Scanner" on WP.org |
91
+ | VS Code extension | `axle-a11y` on VS Code Marketplace |
92
+ | Web (no install) | [axle-iota.vercel.app](https://axle-iota.vercel.app) |
93
+
94
+ All of these use the same axe-core 4.11 engine and the same rule set, so violations are consistent across surfaces.
95
+
96
+ ## License
97
+
98
+ MIT.
@@ -0,0 +1,37 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
13
+ var __commonJS = (cb, mod) => function __require2() {
14
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from))
19
+ if (!__hasOwnProp.call(to, key) && key !== except)
20
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
+ mod
31
+ ));
32
+
33
+ export {
34
+ __require,
35
+ __commonJS,
36
+ __toESM
37
+ };
@@ -0,0 +1,16 @@
1
+ // src/constants.ts
2
+ var ADDON_ID = "axle-a11y";
3
+ var PANEL_ID = `${ADDON_ID}/panel`;
4
+ var PARAM_KEY = "axle";
5
+ var EVENTS = {
6
+ RESULT: `${ADDON_ID}/result`,
7
+ ERROR: `${ADDON_ID}/error`,
8
+ RUNNING: `${ADDON_ID}/running`
9
+ };
10
+
11
+ export {
12
+ ADDON_ID,
13
+ PANEL_ID,
14
+ PARAM_KEY,
15
+ EVENTS
16
+ };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Server-side entrypoint registered by Storybook's `addons` array in
3
+ * .storybook/main.ts. We don't need any preset configuration for this
4
+ * addon — the panel and decorator are wired through manager.tsx and
5
+ * preview.ts respectively, which Storybook auto-discovers because of
6
+ * the `exports` map in package.json.
7
+ *
8
+ * Kept as an empty preset so Storybook resolves `axle-storybook`
9
+ * cleanly when listed in `addons`.
10
+ */
11
+ declare const managerEntries: string[];
12
+ declare const previewAnnotations: string[];
13
+ declare const _default: {};
14
+
15
+ export { _default as default, managerEntries, previewAnnotations };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Server-side entrypoint registered by Storybook's `addons` array in
3
+ * .storybook/main.ts. We don't need any preset configuration for this
4
+ * addon — the panel and decorator are wired through manager.tsx and
5
+ * preview.ts respectively, which Storybook auto-discovers because of
6
+ * the `exports` map in package.json.
7
+ *
8
+ * Kept as an empty preset so Storybook resolves `axle-storybook`
9
+ * cleanly when listed in `addons`.
10
+ */
11
+ declare const managerEntries: string[];
12
+ declare const previewAnnotations: string[];
13
+ declare const _default: {};
14
+
15
+ export { _default as default, managerEntries, previewAnnotations };
package/dist/index.js ADDED
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ default: () => index_default,
34
+ managerEntries: () => managerEntries,
35
+ previewAnnotations: () => previewAnnotations
36
+ });
37
+ module.exports = __toCommonJS(index_exports);
38
+ var managerEntries = [require.resolve("./manager")];
39
+ var previewAnnotations = [require.resolve("./preview")];
40
+ var index_default = {};
41
+ // Annotate the CommonJS export names for ESM import in node:
42
+ 0 && (module.exports = {
43
+ managerEntries,
44
+ previewAnnotations
45
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,13 @@
1
+ import {
2
+ __require
3
+ } from "./chunk-6DZX6EAA.mjs";
4
+
5
+ // src/index.ts
6
+ var managerEntries = [__require.resolve("./manager")];
7
+ var previewAnnotations = [__require.resolve("./preview")];
8
+ var index_default = {};
9
+ export {
10
+ index_default as default,
11
+ managerEntries,
12
+ previewAnnotations
13
+ };
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,2 @@
1
+
2
+ export { }