You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(plugin-a11y): rename the injected script's internals off "agent"
The injected half is now the page script, talking to the panel over the
in-page channel, so "agent" stays reserved for coding agents. Internal
types, the wire message (a11y:page-script-ready), and UI copy follow;
the public export a11yAgentBundlePath keeps its name.
Copy file name to clipboardExpand all lines: plugins/a11y/README.md
+21-21Lines changed: 21 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,15 @@
1
1
# @devframes/plugin-a11y
2
2
3
3
> [!WARNING] Experimental
4
-
> This plugin is experimental and may change without a major version bump until
4
+
> This devframe is experimental and may change without a major version bump until
5
5
> it stabilizes.
6
6
7
7
An accessibility inspector built on [devframe](../../packages/devframe). It runs
8
-
[axe-core](https://github.com/dequelabs/axe-core) against a host application and
8
+
[axe-core](https://github.com/dequelabs/axe-core) against a user app and
9
9
surfaces the violations in a [Solid](https://www.solidjs.com/) panel:
10
10
11
11
-**Route-aware tracking** — buckets violations by `location.pathname` and tracks
12
-
them as you navigate the app (History-API patched, framework-neutral), persisted
12
+
them as you navigate the user app (History-API patched, framework-neutral), persisted
13
13
in `sessionStorage` so history survives reloads within a tab session.
14
14
-**Dashboard + grouped violations** — a Dashboard tab (totals, severity
15
15
breakdown, per-route inventory, scan controls) and a Violations tab listing
@@ -28,7 +28,7 @@ surfaces the violations in a [Solid](https://www.solidjs.com/) panel:
28
28
-**Console logging** — newly-appeared violations are logged (deduped) to the
29
29
browser console.
30
30
31
-
The scan + highlight loop works the same whether the plugin runs as a live dev
31
+
The scan + highlight loop works the same whether the devframe runs as a live dev
32
32
server or as a baked static build.
33
33
34
34
## How it works
@@ -37,28 +37,28 @@ Three pieces, two of them browser-side:
37
37
38
38
| Piece | Runs in | Role |
39
39
|-------|---------|------|
40
-
|**Agent** (`src/inject`) | the host app's page | runs axe-core, tracks routes, broadcasts the aggregate state, draws the preview + pinned rings |
40
+
|**Page script** (`src/inject`) | the user app's page | runs axe-core, tracks routes, broadcasts the aggregate state, draws the preview + pinned rings |
|**Node** (`src/index.ts`, `src/node`, `src/rpc`) | the devframe backend|`get-config` RPC (impact taxonomy + runtime config) — live in dev, baked in a static build |
42
+
|**Node** (`src/index.ts`, `src/node`, `src/rpc`) | the node side|`get-config` RPC (impact taxonomy + runtime config) — live in dev, baked in a static build |
43
43
44
-
The agent and panel talk over a same-origin
45
-
[`BroadcastChannel`](src/shared/protocol.ts), not the devframe RPC backend. That
44
+
The page script and panel talk over the in-page channel (a same-origin
45
+
[`BroadcastChannel`](src/shared/protocol.ts)), not the devframe RPC backend. That
46
46
is what keeps the live loop working in **both modes**: neither half needs a
47
47
server to reach the other, only a shared browser origin (host page + panel
48
-
iframe). The agent owns the authoritative route → report map and broadcasts the
48
+
iframe). The page script owns the authoritative route → report map and broadcasts the
49
49
whole aggregate on every change, so the panel stays a pure render of it. devframe
50
50
RPC carries the data model on top — `get-config` is a `static` function, so it
51
51
resolves over WebSocket in dev and from the baked dump in a static build; the
52
-
panel forwards its runtime-config slice to the agent over the channel, keeping the
53
-
agent itself free of any RPC dependency.
52
+
panel forwards its runtime-config slice to the page script over the channel, keeping the
53
+
page script itself free of any RPC dependency.
54
54
55
-
devframe deliberately provides no access to the host application's DOM, so the
56
-
agent is the author-provided bridge into the page being checked. In a hub, the
57
-
agent is the a11y dock's **client script**: attach `a11yAgentBundlePath` as the
55
+
devframe deliberately provides no access to the user app's DOM, so the
56
+
page script is the author-provided bridge into the user app's page. In a hub, the
57
+
page script is the a11y dock's **client script**: attach `a11yAgentBundlePath` as the
58
58
dock's `clientScript` (resolved to an importable URL — `/@fs/…` under Vite, or a
59
59
statically-served path) and the hub's client runtime (`createDevframeClientHost`
60
60
from `@devframes/hub/client`) imports it into the host page and calls its
61
-
default export with the client-script context. Booted that way, the agent also
61
+
default export with the client-script context. Booted that way, the page script also
62
62
mirrors the active route's scan into the hub's **messages feed** — a summary entry
63
63
driven through the loading → idle lifecycle plus one entry per violated rule,
64
64
carrying the impact-mapped level, WCAG tags as labels, and the first offending
@@ -73,7 +73,7 @@ shows it (no hub context, so the feed mirror simply stays off).
73
73
## Configuration
74
74
75
75
Pass options to `createA11yDevframe()` (surfaced through `get-config`, so they
76
-
reach both the panel and the agent):
76
+
reach both the panel and the page script):
77
77
78
78
```ts
79
79
createA11yDevframe({
@@ -93,7 +93,7 @@ The demo serves an intentionally-broken host page and the panel from **one
93
93
origin** so they share the channel.
94
94
95
95
```sh
96
-
pnpm -C plugins/a11y build # build the panel + the agent bundle
96
+
pnpm -C plugins/a11y build # build the panel + the page-script bundle
pnpm -C plugins/a11y cli:build # bake the static deploy (dist/static)
@@ -104,7 +104,7 @@ Open the URL, then hover any row in the panel — the matching element in the pa
104
104
gets a focus ring (and scrolls into view if it's off-screen). Both demo modes
105
105
behave identically; the panel's `websocket` / `static` tag is the only tell.
106
106
107
-
Standalone, without a host app:
107
+
Standalone, without a user app:
108
108
109
109
```sh
110
110
pnpx @devframes/plugin-a11y # the published package, panel only, at /__devframes_plugin_a11y/
@@ -115,13 +115,13 @@ pnpm -C plugins/a11y dev # from source: same, at /__devframes_plugin_a11
115
115
116
116
| Path | Export | Purpose |
117
117
|------|--------|---------|
118
-
|`src/index.ts`|`.`|`createA11yDevframe()` (also the default export); `a11yAgentBundlePath` — the agent module a hub attaches as this dock's client script |
118
+
|`src/index.ts`|`.`|`createA11yDevframe()` (also the default export); `a11yAgentBundlePath` — the page-script module a hub attaches as this dock's client script |
119
119
|`src/node/index.ts`|`/node`|`setupA11y(ctx, options?)` — registers the RPC functions with the runtime config |
120
120
|`src/cli.ts`|`/cli`|`createA11yCli()` — backs the `devframes_plugin_a11y` bin |
0 commit comments