@bison-lab/payload-core 5.8.0 → 5.9.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 CHANGED
@@ -19,7 +19,7 @@ Media list with `next/navigation`, which Payload's admin already loads); `@bison
19
19
  Pin the plugin to the same version as `payload`; Payload releases them in
20
20
  lockstep.
21
21
 
22
- ## Thirteen entry points, and why
22
+ ## Fourteen entry points, and why
23
23
 
24
24
  | Import | Contents | Runs where |
25
25
  | ---------------------------------- | ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
@@ -32,11 +32,25 @@ lockstep.
32
32
  | `@bison-lab/payload-core/block-library` | `getSectionControls`, `sectionControlsFromLibrary`, `SectionControls`, the catalogue readers, the island height message | Server. What a page route and the Block Settings fold import; it does not load the plugin or React. |
33
33
  | `@bison-lab/payload-core/taxonomy` | `facetField`, `FacetEntry` | Anywhere. What a block config imports to tag content from a taxonomy; no plugin, no React, so a browser bundle can take it (`@bison-lab/payload-blocks` main entry reaches the docs island and Storybook). |
34
34
  | `@bison-lab/payload-core/block-thumbnails` | `captureThumbnails`, `thumbnailCss`, `NEUTRAL_THEME`, `thumbnailVersion`; the `bison-block-thumbnails` bin | Node, beside Playwright. What a site's thumbnail script imports; no Payload, no React. |
35
+ | `@bison-lab/payload-core/a11y` | `checkPage`, `expectAccessiblePage`, `formatPageCheck`, `PAGE_CHECK_RULES`, `AXE_TAGS` | Node, beside Playwright. What a site's own tests call over its rendered pages (#306): axe, heading order, keyboard focus. No Payload, no React. Needs the optional peer `@axe-core/playwright`. |
35
36
  | `@bison-lab/payload-core/wireframe` | Deprecated: the 4.15 wireframe generator and the `bison-wireframes` bin | Node. Kept for one release so a site's script keeps working; use `./block-thumbnails`. Goes in the next major. |
36
37
  | `@bison-lab/payload-core/translate` | `applyTranslation` / `translation`, the deprecated `autoTranslate`, `anthropicTranslator`, `translateDocument`, `translateStrings`, the settings readers and key helpers, `BisonTranslationMarker`, the languages (`LIBRARY_LOCALES`, `activeLocales`, `inactiveLocaleRedirect`, `activeAlternates`), the `localizeExistingContent` migration and `isLocalizedPath`, the test seam (`readTranslateState`, `withTranslator`), the guard and walk helpers; the `bison-translate-messages` bin | Node. What `payload.config.ts` and a seed script import (#278); no React. `@anthropic-ai/sdk` is a required peer (every site has translation), imported on the first translation. |
37
38
  | `@bison-lab/payload-core/admin` | Theme fields, the Roles and Features matrices, the Block library field, Admin nav, the Users Roles checklist, the FAQ Library list, "Translate now" (`TranslateNowMenuItem`) and the Translation key panel (`TranslationKeyPanel`) | Admin. Referenced by import-map string; `generate:importmap` writes it. |
38
39
  | `@bison-lab/payload-core/react` | `BlockLibraryIsland`; `ThemePreview` (legacy; Theme has no preview pane) | Client. What a Block library preview route wraps its sample in. |
39
40
 
41
+ ## Page check
42
+
43
+ `./a11y` is what a site's own tests run over its rendered pages (#306). It
44
+ runs axe with the WCAG 2.x A and AA tags, checks heading order (one `h1`, no
45
+ skipped level), and presses Tab from the top of the page to check that every
46
+ control is reached, shows a visible change on focus, and never traps focus
47
+ outside an open modal. `skip` takes this module's rule ids
48
+ (`PAGE_CHECK_RULES`) or axe's, and the result lists each skipped one.
49
+ `@axe-core/playwright` is an optional peer, imported on the first call; the
50
+ page must come from a browser context. `apps/storybook/page-check` runs it
51
+ over a page of every block sample, so a block change that breaks it fails
52
+ here first. The guide is the docs site's Page check page.
53
+
40
54
  ## What editors get
41
55
 
42
56
  An **SEO** tab beside the page's **Content** tab, never below the block
@@ -0,0 +1,80 @@
1
+ import { AxeBuilder } from "@axe-core/playwright";
2
+
3
+ //#region src/a11y.d.ts
4
+ /**
5
+ * The page check a site runs from its own tests over its own rendered pages
6
+ * (#306). The library's Storybook already runs axe on every block sample;
7
+ * this is the same bar on a site's real content and Theme, plus the two
8
+ * things axe cannot see: heading order across the whole page, and what Tab
9
+ * actually does.
10
+ *
11
+ * Node only, beside Playwright: no Payload, no React. `@axe-core/playwright`
12
+ * is an optional peer, loaded on first call.
13
+ */
14
+ /** Playwright's `Page`, as `@axe-core/playwright` types it, so a site passes its own. */
15
+ type CheckablePage = ConstructorParameters<typeof AxeBuilder>[0]["page"];
16
+ /** The rules this module owns. Any other id in `skip` is an axe rule id. */
17
+ declare const PAGE_CHECK_RULES: readonly ["heading-one", "heading-skipped-level", "keyboard-unreachable", "keyboard-focus-visible", "keyboard-focus-trap"];
18
+ type PageCheckRule = (typeof PAGE_CHECK_RULES)[number];
19
+ /**
20
+ * axe runs the WCAG 2.x A and AA rules, the bar the form contract targets.
21
+ * Its best-practice rules (its own heading-order among them) are left out:
22
+ * the heading checks here cover that ground across the whole page. axe
23
+ * leaves its experimental rules out unless `experimental` is in the list.
24
+ */
25
+ declare const AXE_TAGS: readonly ["wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa"];
26
+ interface PageCheckOptions {
27
+ /** Rule ids to turn off: this module's (`PAGE_CHECK_RULES`) or axe's (`color-contrast`). Each one is listed in the result. */
28
+ skip?: string[];
29
+ /** The most Tab presses the keyboard walk makes before it stops. Defaults to 1000. */
30
+ maxTabs?: number;
31
+ }
32
+ interface PageCheckViolation {
33
+ rule: string;
34
+ source: "axe" | "heading" | "keyboard";
35
+ message: string;
36
+ /** CSS selectors for the elements at fault (empty when the fault is the page's, such as a missing h1). */
37
+ targets: string[];
38
+ impact?: string | null;
39
+ helpUrl?: string;
40
+ }
41
+ interface PageCheckResult {
42
+ passed: boolean;
43
+ violations: PageCheckViolation[];
44
+ /** The rules `skip` turned off, as passed. */
45
+ skipped: string[];
46
+ }
47
+ /**
48
+ * Runs axe, the heading checks and the keyboard walk on the page as it is
49
+ * now, and returns every violation. It leaves the page as it found it apart
50
+ * from where focus ends up. The page should already be loaded (`goto`, then
51
+ * any interaction the test needs).
52
+ */
53
+ declare function checkPage(page: CheckablePage, options?: PageCheckOptions): Promise<PageCheckResult>;
54
+ /** `checkPage`, throwing the formatted report when anything fails. For a site's test: `await expectAccessiblePage(page)`. */
55
+ declare function expectAccessiblePage(page: CheckablePage, options?: PageCheckOptions): Promise<PageCheckResult>;
56
+ /** A plain-text report: one block per violation, then the skipped rules. */
57
+ declare function formatPageCheck(result: PageCheckResult): string;
58
+ interface Landing {
59
+ key: string;
60
+ target: string;
61
+ visible: boolean;
62
+ frame: boolean;
63
+ }
64
+ interface PageHelpers {
65
+ headings(): PageCheckViolation[];
66
+ prepareWalk(): {
67
+ modal: boolean;
68
+ };
69
+ landing(): Landing | null;
70
+ unreached(seen: string[]): string[];
71
+ cleanUp(): void;
72
+ }
73
+ declare global {
74
+ interface Window {
75
+ __bisonPageCheck?: PageHelpers;
76
+ }
77
+ }
78
+ //#endregion
79
+ export { AXE_TAGS, CheckablePage, PAGE_CHECK_RULES, PageCheckOptions, PageCheckResult, PageCheckRule, PageCheckViolation, checkPage, expectAccessiblePage, formatPageCheck };
80
+ //# sourceMappingURL=a11y.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"a11y.d.mts","names":[],"sources":["../src/a11y.ts"],"mappings":";;;;;AAcA;;;;;AAGA;;;;KAHY,aAAA,GAAgB,qBAAA,QAA6B,UAAA;AAWzD;AAAA,cARa,gBAAA;AAAA,KAQD,aAAA,WAAwB,gBAAA;;;AAQpC;;;;cAAa,QAAA;AAAA,UAEI,gBAAA;EAAgB;EAE/B,IAAA;EAAA;EAEA,OAAA;AAAA;AAAA,UAGe,kBAAA;EACf,IAAA;EACA,MAAA;EACA,OAAA;EADA;EAGA,OAAA;EACA,MAAA;EACA,OAAA;AAAA;AAAA,UAGe,eAAA;EACf,MAAA;EACA,UAAA,EAAY,kBAAA;EAFkB;EAI9B,OAAA;AAAA;;;;;;;iBAWoB,SAAA,CAAU,IAAA,EAAM,aAAA,EAAe,OAAA,GAAS,gBAAA,GAAwB,OAAA,CAAQ,eAAA;;iBAoBxE,oBAAA,CAAqB,IAAA,EAAM,aAAA,EAAe,OAAA,GAAU,gBAAA,GAAmB,OAAA,CAAQ,eAAA;;iBAOrF,eAAA,CAAgB,MAAA,EAAQ,eAAA;AAAA,UA4F9B,OAAA;EACR,GAAA;EACA,MAAA;EACA,OAAA;EACA,KAAA;AAAA;AAAA,UAGQ,WAAA;EACR,QAAA,IAAY,kBAAA;EACZ,WAAA;IAAiB,KAAA;EAAA;EACjB,OAAA,IAAW,OAAA;EACX,SAAA,CAAU,IAAA;EACV,OAAA;AAAA;AAAA,QAGM,MAAA;EAAA,UACI,MAAA;IACR,gBAAA,GAAmB,WAAA;EAAA;AAAA"}
package/dist/a11y.mjs ADDED
@@ -0,0 +1,320 @@
1
+ //#region src/a11y.ts
2
+ /** The rules this module owns. Any other id in `skip` is an axe rule id. */
3
+ const PAGE_CHECK_RULES = [
4
+ "heading-one",
5
+ "heading-skipped-level",
6
+ "keyboard-unreachable",
7
+ "keyboard-focus-visible",
8
+ "keyboard-focus-trap"
9
+ ];
10
+ /**
11
+ * axe runs the WCAG 2.x A and AA rules, the bar the form contract targets.
12
+ * Its best-practice rules (its own heading-order among them) are left out:
13
+ * the heading checks here cover that ground across the whole page. axe
14
+ * leaves its experimental rules out unless `experimental` is in the list.
15
+ */
16
+ const AXE_TAGS = [
17
+ "wcag2a",
18
+ "wcag2aa",
19
+ "wcag21a",
20
+ "wcag21aa",
21
+ "wcag22aa"
22
+ ];
23
+ const OWN = new Set(PAGE_CHECK_RULES);
24
+ /**
25
+ * Runs axe, the heading checks and the keyboard walk on the page as it is
26
+ * now, and returns every violation. It leaves the page as it found it apart
27
+ * from where focus ends up. The page should already be loaded (`goto`, then
28
+ * any interaction the test needs).
29
+ */
30
+ async function checkPage(page, options = {}) {
31
+ const skipped = [...new Set(options.skip ?? [])];
32
+ const skip = new Set(skipped);
33
+ const violations = [];
34
+ violations.push(...await runAxe(page, skipped.filter((id) => !OWN.has(id))));
35
+ await page.evaluate(installHelpers);
36
+ try {
37
+ violations.push(...await page.evaluate(() => window.__bisonPageCheck.headings()));
38
+ violations.push(...await walkKeyboard(page, options.maxTabs ?? 1e3));
39
+ } finally {
40
+ await page.evaluate(() => window.__bisonPageCheck?.cleanUp());
41
+ }
42
+ const kept = violations.filter((v) => !skip.has(v.rule));
43
+ return {
44
+ passed: kept.length === 0,
45
+ violations: kept,
46
+ skipped
47
+ };
48
+ }
49
+ /** `checkPage`, throwing the formatted report when anything fails. For a site's test: `await expectAccessiblePage(page)`. */
50
+ async function expectAccessiblePage(page, options) {
51
+ const result = await checkPage(page, options);
52
+ if (!result.passed) throw new Error(formatPageCheck(result));
53
+ return result;
54
+ }
55
+ /** A plain-text report: one block per violation, then the skipped rules. */
56
+ function formatPageCheck(result) {
57
+ const lines = [result.passed ? "Page check passed." : `Page check found ${result.violations.length} violation${result.violations.length === 1 ? "" : "s"}:`];
58
+ for (const v of result.violations) {
59
+ lines.push("", `${v.rule} (${v.source}${v.impact ? `, ${v.impact}` : ""}): ${v.message}`);
60
+ for (const target of v.targets) lines.push(` ${target}`);
61
+ if (v.helpUrl) lines.push(` ${v.helpUrl}`);
62
+ }
63
+ if (result.skipped.length > 0) lines.push("", `Skipped: ${result.skipped.join(", ")}`);
64
+ return lines.join("\n");
65
+ }
66
+ async function runAxe(page, disabled) {
67
+ let Builder;
68
+ try {
69
+ ({AxeBuilder: Builder} = await import("@axe-core/playwright"));
70
+ } catch {
71
+ throw new Error("checkPage needs @axe-core/playwright: install it as a dev dependency of the site.");
72
+ }
73
+ let builder = new Builder({ page }).withTags([...AXE_TAGS]);
74
+ if (disabled.length > 0) builder = builder.disableRules(disabled);
75
+ const { violations } = await builder.analyze();
76
+ return violations.map((v) => ({
77
+ rule: v.id,
78
+ source: "axe",
79
+ message: v.help,
80
+ impact: v.impact,
81
+ helpUrl: v.helpUrl,
82
+ targets: v.nodes.map((node) => node.target.map(String).join(" "))
83
+ }));
84
+ }
85
+ /**
86
+ * Presses Tab from the top of the page until focus leaves it, recording
87
+ * each element it lands on. The helpers in the page say which elements
88
+ * should be reachable and whether each landing drew a visible change.
89
+ */
90
+ async function walkKeyboard(page, maxTabs) {
91
+ const { modal } = await page.evaluate(() => window.__bisonPageCheck.prepareWalk());
92
+ const violations = [];
93
+ const seen = /* @__PURE__ */ new Set();
94
+ let previous = null;
95
+ for (let step = 0; step < maxTabs; step++) {
96
+ await page.keyboard.press("Tab");
97
+ const landing = await page.evaluate(() => window.__bisonPageCheck.landing());
98
+ if (landing === null) break;
99
+ if (previous && landing.key === previous.key && landing.frame) continue;
100
+ if (previous && landing.key === previous.key) {
101
+ if (!modal) violations.push(trap(landing.target, "Tab did not move focus off this element."));
102
+ break;
103
+ }
104
+ if (seen.has(landing.key)) {
105
+ if (!modal && previous) violations.push(trap(previous.target, "Tab from here sent focus back to an earlier element, so the rest of the page cannot be reached."));
106
+ break;
107
+ }
108
+ seen.add(landing.key);
109
+ if (!landing.visible && !landing.frame) violations.push({
110
+ rule: "keyboard-focus-visible",
111
+ source: "keyboard",
112
+ message: "Focus reached this element by Tab but nothing visible changed (no outline, ring, border or background).",
113
+ targets: [landing.target]
114
+ });
115
+ previous = landing;
116
+ }
117
+ const missed = await page.evaluate((keys) => window.__bisonPageCheck.unreached(keys), [...seen]);
118
+ for (const target of missed) violations.push({
119
+ rule: "keyboard-unreachable",
120
+ source: "keyboard",
121
+ message: "This control is interactive but Tab never reached it.",
122
+ targets: [target]
123
+ });
124
+ return violations;
125
+ }
126
+ function trap(target, message) {
127
+ return {
128
+ rule: "keyboard-focus-trap",
129
+ source: "keyboard",
130
+ message,
131
+ targets: [target]
132
+ };
133
+ }
134
+ /**
135
+ * Installs `window.__bisonPageCheck`. Runs in the page, so it closes over
136
+ * nothing from this module.
137
+ */
138
+ function installHelpers() {
139
+ const KEY = "data-bison-check";
140
+ const STYLE_ID = "bison-page-check-style";
141
+ const OWN_PROPS = [
142
+ "outline-style",
143
+ "outline-width",
144
+ "outline-color",
145
+ "outline-offset",
146
+ "box-shadow",
147
+ "border-top-color",
148
+ "border-bottom-color",
149
+ "border-top-width",
150
+ "background-color",
151
+ "color",
152
+ "text-decoration-line",
153
+ "width",
154
+ "height",
155
+ "clip-path",
156
+ "clip",
157
+ "opacity"
158
+ ];
159
+ const PARENT_PROPS = [
160
+ "outline-style",
161
+ "box-shadow",
162
+ "border-top-color",
163
+ "border-bottom-color",
164
+ "background-color"
165
+ ];
166
+ const INTERACTIVE = [
167
+ "a[href]",
168
+ "area[href]",
169
+ "button",
170
+ "input:not([type=hidden])",
171
+ "select",
172
+ "textarea",
173
+ "summary",
174
+ "iframe",
175
+ "[contenteditable]:not([contenteditable=false])",
176
+ "[tabindex]",
177
+ ...[
178
+ "button",
179
+ "link",
180
+ "checkbox",
181
+ "radio",
182
+ "switch",
183
+ "slider",
184
+ "combobox",
185
+ "textbox",
186
+ "searchbox",
187
+ "spinbutton"
188
+ ].map((role) => `[role=${role}]`)
189
+ ].join(",");
190
+ const snapshots = /* @__PURE__ */ new Map();
191
+ const groupOf = /* @__PURE__ */ new Map();
192
+ function path(el) {
193
+ if (el.id) return `#${CSS.escape(el.id)}`;
194
+ const parts = [];
195
+ let node = el;
196
+ while (node && node !== document.documentElement && parts.length < 5) {
197
+ if (node.id) {
198
+ parts.unshift(`#${CSS.escape(node.id)}`);
199
+ break;
200
+ }
201
+ const tag = node.tagName.toLowerCase();
202
+ const parent = node.parentElement;
203
+ const same = parent ? [...parent.children].filter((c) => c.tagName === node.tagName) : [];
204
+ parts.unshift(same.length > 1 ? `${tag}:nth-of-type(${same.indexOf(node) + 1})` : tag);
205
+ node = parent;
206
+ }
207
+ return parts.join(" > ");
208
+ }
209
+ function rendered(el) {
210
+ return el.getClientRects().length > 0 && getComputedStyle(el).visibility !== "hidden";
211
+ }
212
+ function read(el, props) {
213
+ if (!el) return [];
214
+ const style = getComputedStyle(el);
215
+ return props.map((p) => style.getPropertyValue(p));
216
+ }
217
+ function modalRoot() {
218
+ return [...document.querySelectorAll("dialog, [aria-modal=true]")].filter((el) => rendered(el) && (el.matches("[aria-modal=true]") || el.matches(":modal"))).at(-1) ?? null;
219
+ }
220
+ function candidates() {
221
+ return [...(modalRoot() ?? document).querySelectorAll(INTERACTIVE)].filter((el) => {
222
+ if (el.matches(":disabled") || el.closest("[inert]")) return false;
223
+ const tabindex = el.getAttribute("tabindex");
224
+ if (tabindex !== null && Number(tabindex) < 0) return false;
225
+ return rendered(el);
226
+ });
227
+ }
228
+ function keyOf(el) {
229
+ return groupOf.get(el) ?? el.getAttribute(KEY) ?? `x:${path(el)}`;
230
+ }
231
+ window.__bisonPageCheck = {
232
+ headings() {
233
+ const found = [...document.querySelectorAll("h1, h2, h3, h4, h5, h6, [role=heading]")].filter((el) => rendered(el) && !el.closest("[aria-hidden=true]")).map((el) => {
234
+ const aria = Number(el.getAttribute("aria-level"));
235
+ const tag = /^H(\d)$/.exec(el.tagName)?.[1];
236
+ return {
237
+ el,
238
+ level: aria > 0 ? aria : tag ? Number(tag) : 2,
239
+ text: (el.textContent ?? "").trim().replace(/\s+/g, " ").slice(0, 80)
240
+ };
241
+ });
242
+ const out = [];
243
+ const ones = found.filter((h) => h.level === 1);
244
+ if (ones.length === 0) out.push({
245
+ rule: "heading-one",
246
+ source: "heading",
247
+ message: "The page has no h1.",
248
+ targets: []
249
+ });
250
+ else if (ones.length > 1) out.push({
251
+ rule: "heading-one",
252
+ source: "heading",
253
+ message: `The page has ${ones.length} h1 headings; only the first, "${ones[0].text}", should be one.`,
254
+ targets: ones.slice(1).map((h) => path(h.el))
255
+ });
256
+ let previous = 0;
257
+ for (const h of found) {
258
+ if (h.level > previous + 1) out.push({
259
+ rule: "heading-skipped-level",
260
+ source: "heading",
261
+ message: `"${h.text}" is an h${h.level} ${previous === 0 ? "and the first heading on the page" : `after an h${previous}`}.`,
262
+ targets: [path(h.el)]
263
+ });
264
+ previous = h.level;
265
+ }
266
+ return out;
267
+ },
268
+ prepareWalk() {
269
+ const style = document.createElement("style");
270
+ style.id = STYLE_ID;
271
+ style.textContent = "*,*::before,*::after{transition:none!important;animation:none!important;scroll-behavior:auto!important}";
272
+ document.head.append(style);
273
+ document.activeElement?.blur?.();
274
+ candidates().forEach((el, i) => {
275
+ el.setAttribute(KEY, String(i));
276
+ if (el instanceof HTMLInputElement && el.type === "radio" && el.name) groupOf.set(el, `radio:${el.form ? path(el.form) : ""}:${el.name}`);
277
+ });
278
+ for (const el of document.querySelectorAll("*")) if (el.matches(INTERACTIVE) || el.scrollHeight > el.clientHeight) snapshots.set(el, {
279
+ own: read(el, OWN_PROPS),
280
+ parent: read(el.parentElement, PARENT_PROPS)
281
+ });
282
+ return { modal: modalRoot() !== null };
283
+ },
284
+ landing() {
285
+ let el = document.activeElement;
286
+ while (el?.shadowRoot?.activeElement) el = el.shadowRoot.activeElement;
287
+ if (!el || el === document.body || el === document.documentElement) return null;
288
+ const before = snapshots.get(el);
289
+ const own = read(el, OWN_PROPS);
290
+ const parent = read(el.parentElement, PARENT_PROPS);
291
+ const style = getComputedStyle(el);
292
+ const outlined = style.outlineStyle !== "none" && parseFloat(style.outlineWidth) > 0;
293
+ const changed = before ? own.some((v, i) => v !== before.own[i]) || parent.some((v, i) => v !== before.parent[i]) : style.boxShadow !== "none";
294
+ return {
295
+ key: keyOf(el),
296
+ target: path(el),
297
+ visible: outlined || changed,
298
+ frame: el.tagName === "IFRAME"
299
+ };
300
+ },
301
+ unreached(seen) {
302
+ const reached = new Set(seen);
303
+ const missed = /* @__PURE__ */ new Map();
304
+ for (const el of candidates()) {
305
+ const key = keyOf(el);
306
+ if (!reached.has(key) && !missed.has(key)) missed.set(key, path(el));
307
+ }
308
+ return [...missed.values()];
309
+ },
310
+ cleanUp() {
311
+ document.getElementById(STYLE_ID)?.remove();
312
+ for (const el of document.querySelectorAll(`[${KEY}]`)) el.removeAttribute(KEY);
313
+ delete window.__bisonPageCheck;
314
+ }
315
+ };
316
+ }
317
+ //#endregion
318
+ export { AXE_TAGS, PAGE_CHECK_RULES, checkPage, expectAccessiblePage, formatPageCheck };
319
+
320
+ //# sourceMappingURL=a11y.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"a11y.mjs","names":[],"sources":["../src/a11y.ts"],"sourcesContent":["import type { AxeBuilder } from \"@axe-core/playwright\";\n\n/**\n * The page check a site runs from its own tests over its own rendered pages\n * (#306). The library's Storybook already runs axe on every block sample;\n * this is the same bar on a site's real content and Theme, plus the two\n * things axe cannot see: heading order across the whole page, and what Tab\n * actually does.\n *\n * Node only, beside Playwright: no Payload, no React. `@axe-core/playwright`\n * is an optional peer, loaded on first call.\n */\n\n/** Playwright's `Page`, as `@axe-core/playwright` types it, so a site passes its own. */\nexport type CheckablePage = ConstructorParameters<typeof AxeBuilder>[0][\"page\"];\n\n/** The rules this module owns. Any other id in `skip` is an axe rule id. */\nexport const PAGE_CHECK_RULES = [\n \"heading-one\",\n \"heading-skipped-level\",\n \"keyboard-unreachable\",\n \"keyboard-focus-visible\",\n \"keyboard-focus-trap\",\n] as const;\n\nexport type PageCheckRule = (typeof PAGE_CHECK_RULES)[number];\n\n/**\n * axe runs the WCAG 2.x A and AA rules, the bar the form contract targets.\n * Its best-practice rules (its own heading-order among them) are left out:\n * the heading checks here cover that ground across the whole page. axe\n * leaves its experimental rules out unless `experimental` is in the list.\n */\nexport const AXE_TAGS = [\"wcag2a\", \"wcag2aa\", \"wcag21a\", \"wcag21aa\", \"wcag22aa\"] as const;\n\nexport interface PageCheckOptions {\n /** Rule ids to turn off: this module's (`PAGE_CHECK_RULES`) or axe's (`color-contrast`). Each one is listed in the result. */\n skip?: string[];\n /** The most Tab presses the keyboard walk makes before it stops. Defaults to 1000. */\n maxTabs?: number;\n}\n\nexport interface PageCheckViolation {\n rule: string;\n source: \"axe\" | \"heading\" | \"keyboard\";\n message: string;\n /** CSS selectors for the elements at fault (empty when the fault is the page's, such as a missing h1). */\n targets: string[];\n impact?: string | null;\n helpUrl?: string;\n}\n\nexport interface PageCheckResult {\n passed: boolean;\n violations: PageCheckViolation[];\n /** The rules `skip` turned off, as passed. */\n skipped: string[];\n}\n\nconst OWN = new Set<string>(PAGE_CHECK_RULES);\n\n/**\n * Runs axe, the heading checks and the keyboard walk on the page as it is\n * now, and returns every violation. It leaves the page as it found it apart\n * from where focus ends up. The page should already be loaded (`goto`, then\n * any interaction the test needs).\n */\nexport async function checkPage(page: CheckablePage, options: PageCheckOptions = {}): Promise<PageCheckResult> {\n const skipped = [...new Set(options.skip ?? [])];\n const skip = new Set(skipped);\n const violations: PageCheckViolation[] = [];\n\n violations.push(...(await runAxe(page, skipped.filter((id) => !OWN.has(id)))));\n\n await page.evaluate(installHelpers);\n try {\n violations.push(...(await page.evaluate(() => window.__bisonPageCheck!.headings())));\n violations.push(...(await walkKeyboard(page, options.maxTabs ?? 1000)));\n } finally {\n await page.evaluate(() => window.__bisonPageCheck?.cleanUp());\n }\n\n const kept = violations.filter((v) => !skip.has(v.rule));\n return { passed: kept.length === 0, violations: kept, skipped };\n}\n\n/** `checkPage`, throwing the formatted report when anything fails. For a site's test: `await expectAccessiblePage(page)`. */\nexport async function expectAccessiblePage(page: CheckablePage, options?: PageCheckOptions): Promise<PageCheckResult> {\n const result = await checkPage(page, options);\n if (!result.passed) throw new Error(formatPageCheck(result));\n return result;\n}\n\n/** A plain-text report: one block per violation, then the skipped rules. */\nexport function formatPageCheck(result: PageCheckResult): string {\n const lines = [\n result.passed\n ? \"Page check passed.\"\n : `Page check found ${result.violations.length} violation${result.violations.length === 1 ? \"\" : \"s\"}:`,\n ];\n for (const v of result.violations) {\n lines.push(\"\", `${v.rule} (${v.source}${v.impact ? `, ${v.impact}` : \"\"}): ${v.message}`);\n for (const target of v.targets) lines.push(` ${target}`);\n if (v.helpUrl) lines.push(` ${v.helpUrl}`);\n }\n if (result.skipped.length > 0) lines.push(\"\", `Skipped: ${result.skipped.join(\", \")}`);\n return lines.join(\"\\n\");\n}\n\nasync function runAxe(page: CheckablePage, disabled: string[]): Promise<PageCheckViolation[]> {\n let Builder: typeof AxeBuilder;\n try {\n ({ AxeBuilder: Builder } = await import(\"@axe-core/playwright\"));\n } catch {\n throw new Error(\"checkPage needs @axe-core/playwright: install it as a dev dependency of the site.\");\n }\n let builder = new Builder({ page }).withTags([...AXE_TAGS]);\n if (disabled.length > 0) builder = builder.disableRules(disabled);\n const { violations } = await builder.analyze();\n return violations.map((v) => ({\n rule: v.id,\n source: \"axe\" as const,\n message: v.help,\n impact: v.impact,\n helpUrl: v.helpUrl,\n targets: v.nodes.map((node) => node.target.map(String).join(\" \")),\n }));\n}\n\n/**\n * Presses Tab from the top of the page until focus leaves it, recording\n * each element it lands on. The helpers in the page say which elements\n * should be reachable and whether each landing drew a visible change.\n */\nasync function walkKeyboard(page: CheckablePage, maxTabs: number): Promise<PageCheckViolation[]> {\n const { modal } = await page.evaluate(() => window.__bisonPageCheck!.prepareWalk());\n const violations: PageCheckViolation[] = [];\n const seen = new Set<string>();\n let previous: Landing | null = null;\n\n for (let step = 0; step < maxTabs; step++) {\n await page.keyboard.press(\"Tab\");\n const landing = await page.evaluate(() => window.__bisonPageCheck!.landing());\n if (landing === null) break; // Focus left the page: the walk is over.\n // Tab inside a frame moves focus within the frame's own document, while\n // this one's activeElement stays the <iframe>: a repeat there is the walk\n // going through the frame, not a trap. It ends when focus comes back out.\n if (previous && landing.key === previous.key && landing.frame) continue;\n if (previous && landing.key === previous.key) {\n if (!modal) violations.push(trap(landing.target, \"Tab did not move focus off this element.\"));\n break;\n }\n if (seen.has(landing.key)) {\n if (!modal && previous) violations.push(trap(previous.target, \"Tab from here sent focus back to an earlier element, so the rest of the page cannot be reached.\"));\n break;\n }\n seen.add(landing.key);\n // A frame's focus ring is drawn by the document inside it, which may be\n // another origin's; it is not this page's to check.\n if (!landing.visible && !landing.frame) {\n violations.push({\n rule: \"keyboard-focus-visible\",\n source: \"keyboard\",\n message: \"Focus reached this element by Tab but nothing visible changed (no outline, ring, border or background).\",\n targets: [landing.target],\n });\n }\n previous = landing;\n }\n\n const missed = await page.evaluate((keys) => window.__bisonPageCheck!.unreached(keys), [...seen]);\n for (const target of missed) {\n violations.push({\n rule: \"keyboard-unreachable\",\n source: \"keyboard\",\n message: \"This control is interactive but Tab never reached it.\",\n targets: [target],\n });\n }\n return violations;\n}\n\nfunction trap(target: string, message: string): PageCheckViolation {\n return { rule: \"keyboard-focus-trap\", source: \"keyboard\", message, targets: [target] };\n}\n\ninterface Landing {\n key: string;\n target: string;\n visible: boolean;\n frame: boolean;\n}\n\ninterface PageHelpers {\n headings(): PageCheckViolation[];\n prepareWalk(): { modal: boolean };\n landing(): Landing | null;\n unreached(seen: string[]): string[];\n cleanUp(): void;\n}\n\ndeclare global {\n interface Window {\n __bisonPageCheck?: PageHelpers;\n }\n}\n\n/**\n * Installs `window.__bisonPageCheck`. Runs in the page, so it closes over\n * nothing from this module.\n */\nfunction installHelpers(): void {\n const KEY = \"data-bison-check\";\n const STYLE_ID = \"bison-page-check-style\";\n // What a focus indicator can change. Compared on the element and its\n // parent, because a ring is often drawn on a wrapper with :focus-within.\n const OWN_PROPS = [\n \"outline-style\",\n \"outline-width\",\n \"outline-color\",\n \"outline-offset\",\n \"box-shadow\",\n \"border-top-color\",\n \"border-bottom-color\",\n \"border-top-width\",\n \"background-color\",\n \"color\",\n \"text-decoration-line\",\n \"width\",\n \"height\",\n \"clip-path\",\n \"clip\",\n \"opacity\",\n ];\n const PARENT_PROPS = [\"outline-style\", \"box-shadow\", \"border-top-color\", \"border-bottom-color\", \"background-color\"];\n const INTERACTIVE = [\n \"a[href]\",\n \"area[href]\",\n \"button\",\n \"input:not([type=hidden])\",\n \"select\",\n \"textarea\",\n \"summary\",\n \"iframe\",\n \"[contenteditable]:not([contenteditable=false])\",\n \"[tabindex]\",\n // ARIA widgets that stand alone. Items inside a composite (option,\n // menuitem, tab, treeitem, gridcell) are reached by arrow keys, not Tab.\n ...[\"button\", \"link\", \"checkbox\", \"radio\", \"switch\", \"slider\", \"combobox\", \"textbox\", \"searchbox\", \"spinbutton\"].map(\n (role) => `[role=${role}]`,\n ),\n ].join(\",\");\n\n const snapshots = new Map<Element, { own: string[]; parent: string[] }>();\n const groupOf = new Map<Element, string>();\n\n function path(el: Element): string {\n if (el.id) return `#${CSS.escape(el.id)}`;\n const parts: string[] = [];\n let node: Element | null = el;\n while (node && node !== document.documentElement && parts.length < 5) {\n if (node.id) {\n parts.unshift(`#${CSS.escape(node.id)}`);\n break;\n }\n const tag = node.tagName.toLowerCase();\n const parent: Element | null = node.parentElement;\n const same = parent ? [...parent.children].filter((c) => c.tagName === node!.tagName) : [];\n parts.unshift(same.length > 1 ? `${tag}:nth-of-type(${same.indexOf(node) + 1})` : tag);\n node = parent;\n }\n return parts.join(\" > \");\n }\n\n function rendered(el: Element): boolean {\n return el.getClientRects().length > 0 && getComputedStyle(el).visibility !== \"hidden\";\n }\n\n function read(el: Element | null, props: string[]): string[] {\n if (!el) return [];\n const style = getComputedStyle(el);\n return props.map((p) => style.getPropertyValue(p));\n }\n\n function modalRoot(): Element | null {\n const open = [...document.querySelectorAll(\"dialog, [aria-modal=true]\")].filter(\n (el) => rendered(el) && (el.matches(\"[aria-modal=true]\") || el.matches(\":modal\")),\n );\n return open.at(-1) ?? null;\n }\n\n function candidates(): Element[] {\n const root = modalRoot() ?? document;\n return [...root.querySelectorAll(INTERACTIVE)].filter((el) => {\n if (el.matches(\":disabled\") || el.closest(\"[inert]\")) return false;\n const tabindex = el.getAttribute(\"tabindex\");\n if (tabindex !== null && Number(tabindex) < 0) return false;\n return rendered(el);\n });\n }\n\n // Only one radio in a native group takes Tab; the group counts as reached\n // when any of them is.\n function keyOf(el: Element): string {\n return groupOf.get(el) ?? el.getAttribute(KEY) ?? `x:${path(el)}`;\n }\n\n window.__bisonPageCheck = {\n headings() {\n const found = [...document.querySelectorAll(\"h1, h2, h3, h4, h5, h6, [role=heading]\")]\n .filter((el) => rendered(el) && !el.closest(\"[aria-hidden=true]\"))\n .map((el) => {\n const aria = Number(el.getAttribute(\"aria-level\"));\n const tag = /^H(\\d)$/.exec(el.tagName)?.[1];\n const level = aria > 0 ? aria : tag ? Number(tag) : 2;\n return { el, level, text: (el.textContent ?? \"\").trim().replace(/\\s+/g, \" \").slice(0, 80) };\n });\n const out: PageCheckViolation[] = [];\n const ones = found.filter((h) => h.level === 1);\n if (ones.length === 0) {\n out.push({ rule: \"heading-one\", source: \"heading\", message: \"The page has no h1.\", targets: [] });\n } else if (ones.length > 1) {\n out.push({\n rule: \"heading-one\",\n source: \"heading\",\n message: `The page has ${ones.length} h1 headings; only the first, \"${ones[0]!.text}\", should be one.`,\n targets: ones.slice(1).map((h) => path(h.el)),\n });\n }\n let previous = 0;\n for (const h of found) {\n if (h.level > previous + 1) {\n out.push({\n rule: \"heading-skipped-level\",\n source: \"heading\",\n message: `\"${h.text}\" is an h${h.level} ${previous === 0 ? \"and the first heading on the page\" : `after an h${previous}`}.`,\n targets: [path(h.el)],\n });\n }\n previous = h.level;\n }\n return out;\n },\n\n prepareWalk() {\n // A ring that fades in would read as unchanged mid-transition.\n const style = document.createElement(\"style\");\n style.id = STYLE_ID;\n style.textContent = \"*,*::before,*::after{transition:none!important;animation:none!important;scroll-behavior:auto!important}\";\n document.head.append(style);\n\n (document.activeElement as HTMLElement | null)?.blur?.();\n candidates().forEach((el, i) => {\n el.setAttribute(KEY, String(i));\n if (el instanceof HTMLInputElement && el.type === \"radio\" && el.name) {\n groupOf.set(el, `radio:${el.form ? path(el.form) : \"\"}:${el.name}`);\n }\n });\n // Snapshot every focusable element unfocused, including ones the\n // candidate list leaves out (a scroll container Chromium makes\n // focusable), so any landing can be compared.\n for (const el of document.querySelectorAll(\"*\")) {\n if (el.matches(INTERACTIVE) || el.scrollHeight > el.clientHeight) {\n snapshots.set(el, { own: read(el, OWN_PROPS), parent: read(el.parentElement, PARENT_PROPS) });\n }\n }\n return { modal: modalRoot() !== null };\n },\n\n landing() {\n let el: Element | null = document.activeElement;\n while (el?.shadowRoot?.activeElement) el = el.shadowRoot.activeElement;\n if (!el || el === document.body || el === document.documentElement) return null;\n const before = snapshots.get(el);\n const own = read(el, OWN_PROPS);\n const parent = read(el.parentElement, PARENT_PROPS);\n const style = getComputedStyle(el);\n const outlined = style.outlineStyle !== \"none\" && parseFloat(style.outlineWidth) > 0;\n const changed = before\n ? own.some((v, i) => v !== before.own[i]) || parent.some((v, i) => v !== before.parent[i])\n : style.boxShadow !== \"none\";\n return { key: keyOf(el), target: path(el), visible: outlined || changed, frame: el.tagName === \"IFRAME\" };\n },\n\n unreached(seen) {\n const reached = new Set(seen);\n const missed = new Map<string, string>();\n for (const el of candidates()) {\n const key = keyOf(el);\n if (!reached.has(key) && !missed.has(key)) missed.set(key, path(el));\n }\n return [...missed.values()];\n },\n\n cleanUp() {\n document.getElementById(STYLE_ID)?.remove();\n for (const el of document.querySelectorAll(`[${KEY}]`)) el.removeAttribute(KEY);\n delete window.__bisonPageCheck;\n },\n };\n}\n"],"mappings":";;AAiBA,MAAa,mBAAmB;CAC9B;CACA;CACA;CACA;CACA;CACD;;;;;;;AAUD,MAAa,WAAW;CAAC;CAAU;CAAW;CAAW;CAAY;CAAW;AA0BhF,MAAM,MAAM,IAAI,IAAY,iBAAiB;;;;;;;AAQ7C,eAAsB,UAAU,MAAqB,UAA4B,EAAE,EAA4B;CAC7G,MAAM,UAAU,CAAC,GAAG,IAAI,IAAI,QAAQ,QAAQ,EAAE,CAAC,CAAC;CAChD,MAAM,OAAO,IAAI,IAAI,QAAQ;CAC7B,MAAM,aAAmC,EAAE;AAE3C,YAAW,KAAK,GAAI,MAAM,OAAO,MAAM,QAAQ,QAAQ,OAAO,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAE;AAE9E,OAAM,KAAK,SAAS,eAAe;AACnC,KAAI;AACF,aAAW,KAAK,GAAI,MAAM,KAAK,eAAe,OAAO,iBAAkB,UAAU,CAAC,CAAE;AACpF,aAAW,KAAK,GAAI,MAAM,aAAa,MAAM,QAAQ,WAAW,IAAK,CAAE;WAC/D;AACR,QAAM,KAAK,eAAe,OAAO,kBAAkB,SAAS,CAAC;;CAG/D,MAAM,OAAO,WAAW,QAAQ,MAAM,CAAC,KAAK,IAAI,EAAE,KAAK,CAAC;AACxD,QAAO;EAAE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nostic Payload CMS configuration for Bison Lab sites: the SEO tab, the Theme global, the Roles Global, the brand-assets cupboard, and the metadata and theme readers for the pages they describe",
5
5
  "keywords": [
6
6
  "bison-lab",
@@ -67,6 +67,10 @@
67
67
  "import": "./dist/block-thumbnails.mjs",
68
68
  "types": "./dist/block-thumbnails.d.mts"
69
69
  },
70
+ "./a11y": {
71
+ "import": "./dist/a11y.mjs",
72
+ "types": "./dist/a11y.d.mts"
73
+ },
70
74
  "./wireframe": {
71
75
  "import": "./dist/wireframe.mjs",
72
76
  "types": "./dist/wireframe.d.mts"
@@ -92,6 +96,7 @@
92
96
  "@bison-lab/admin-ui": "5.5.0"
93
97
  },
94
98
  "peerDependencies": {
99
+ "@axe-core/playwright": "^4.14.0",
95
100
  "@anthropic-ai/sdk": ">=0.110.0",
96
101
  "@bison-lab/fonts": "^3.0.0 || ^4.0.0 || ^5.0.0",
97
102
  "@bison-lab/tokens": "^3.0.0 || ^4.0.0 || ^5.0.0",
@@ -108,6 +113,9 @@
108
113
  "satori": ">=0.10.0"
109
114
  },
110
115
  "peerDependenciesMeta": {
116
+ "@axe-core/playwright": {
117
+ "optional": true
118
+ },
111
119
  "@bison-lab/fonts": {
112
120
  "optional": false
113
121
  },
@@ -141,6 +149,7 @@
141
149
  },
142
150
  "devDependencies": {
143
151
  "@anthropic-ai/sdk": "^0.110.0",
152
+ "@axe-core/playwright": "^4.14.1",
144
153
  "@payloadcms/db-postgres": "3.94.2",
145
154
  "@payloadcms/live-preview-react": "^3.94.2",
146
155
  "@payloadcms/plugin-redirects": "3.94.2",
@@ -155,15 +164,16 @@
155
164
  "jsdom": "^29.0.1",
156
165
  "next": "^16.3.4",
157
166
  "payload": "^3.94.2",
167
+ "playwright": "^1.63.0",
158
168
  "react": "^19.2.4",
159
169
  "react-dom": "^19.2.4",
160
170
  "satori": "0.63.2",
161
171
  "tsdown": "^0.21.0",
162
172
  "typescript": "^5.9.3",
163
173
  "vitest": "^4.1.2",
164
- "@bison-lab/fonts": "4.38.0",
165
174
  "@bison-lab/tokens": "4.38.0",
166
- "@bison-lab/ui": "5.5.0"
175
+ "@bison-lab/ui": "5.8.1",
176
+ "@bison-lab/fonts": "4.38.0"
167
177
  },
168
178
  "publishConfig": {
169
179
  "access": "public"