@polyxd/verifier 0.3.0 → 0.4.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/NOTICE +32 -0
- package/README.md +15 -1
- package/dist/browser.d.ts +5 -1
- package/dist/browser.js +17 -4
- package/dist/browser.js.map +1 -1
- package/dist/patterns.generated.d.ts +3 -0
- package/dist/patterns.generated.js +312 -0
- package/dist/patterns.generated.js.map +1 -0
- package/dist/rendered.d.ts +2 -7
- package/dist/rendered.js.map +1 -1
- package/dist/static.d.ts +17 -2
- package/dist/static.js +24 -4
- package/dist/static.js.map +1 -1
- package/harness-dist/assets/{index-BwUinip0.css → index-CtDlIYLx.css} +1 -1
- package/harness-dist/index.html +2 -2
- package/harness-web-dist/polyxd-web.css +1 -1
- package/harness-web-dist/polyxd-web.js +6 -13
- package/package.json +27 -5
- /package/harness-dist/assets/{index-DtBFOUKj.js → index-Cdk80tid.js} +0 -0
package/NOTICE
CHANGED
|
@@ -135,6 +135,38 @@ Upstream: https://github.com/adobe/spectrum-tokens
|
|
|
135
135
|
|
|
136
136
|
Vendored under `packages/ds-spectrum/scripts/sources/`, with the upstream licence file beside it.
|
|
137
137
|
|
|
138
|
+
## Logos
|
|
139
|
+
|
|
140
|
+
Twelve packs ship their design system's official logo, unaltered, as `logo.svg`
|
|
141
|
+
(Bootstrap and Radix also ship the owner's white version as `logo-white.svg`),
|
|
142
|
+
downloaded from the owner's own site, repository or brand page. Where a design
|
|
143
|
+
system has no mark of its own (Polaris, Spectrum, Primer), the pack ships its
|
|
144
|
+
company's logo. Each is used only to identify the design system a pack is
|
|
145
|
+
modelled on, beside its name. The logos are trademarks of their owners, not
|
|
146
|
+
Polyxd's, and are not covered by Polyxd's licence:
|
|
147
|
+
|
|
148
|
+
- Material 3 (`@polyxd/ds-material3`) — Google LLC
|
|
149
|
+
- Carbon (`@polyxd/ds-carbon`) — IBM Corp.
|
|
150
|
+
- Fluent 2 (`@polyxd/ds-fluent`) — Microsoft Corporation
|
|
151
|
+
- Polaris (`@polyxd/ds-polaris`) — the Shopify logo, Shopify Inc.
|
|
152
|
+
- Spectrum 2 (`@polyxd/ds-spectrum`) — the Adobe logo, Adobe Inc.
|
|
153
|
+
- Primer (`@polyxd/ds-primer`) — the GitHub logo, GitHub, Inc.
|
|
154
|
+
- shadcn/ui (`@polyxd/ds-shadcn`) — shadcn
|
|
155
|
+
- Ant Design (`@polyxd/ds-antd`) — Ant Group
|
|
156
|
+
- Bootstrap (`@polyxd/ds-bootstrap`) — the Bootstrap team
|
|
157
|
+
- Chakra UI (`@polyxd/ds-chakra`) — Chakra Systems Inc.
|
|
158
|
+
- Mantine (`@polyxd/ds-mantine`) — Vitaly Rtishchev
|
|
159
|
+
- Radix UI (`@polyxd/ds-radix`) — WorkOS
|
|
160
|
+
|
|
161
|
+
Google, IBM, Microsoft, Shopify, Adobe and GitHub restrict the use of their
|
|
162
|
+
logos without permission; each pack's manifest (`logo`) and README record the
|
|
163
|
+
source and the owner's guidelines. GOV.UK's crown and logotype are protected and
|
|
164
|
+
may not be used by a service that is not on GOV.UK, so `@polyxd/ds-govuk` ships
|
|
165
|
+
no logo and is named in words only.
|
|
166
|
+
|
|
167
|
+
The twelve template packs' `logo.svg` files are Polyxd's own marks, drawn from
|
|
168
|
+
each template's tokens.
|
|
169
|
+
|
|
138
170
|
## Template packs
|
|
139
171
|
|
|
140
172
|
Twelve packs are original Polyxd templates, not readings of any design system:
|
package/README.md
CHANGED
|
@@ -3,11 +3,25 @@
|
|
|
3
3
|
Scores a Polyxd UI document the way it will actually be used: rendered, in every design system, by people and by agents.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npm install -D @polyxd/verifier
|
|
6
|
+
npm install -D @polyxd/verifier playwright
|
|
7
7
|
npx playwright install chromium # once
|
|
8
8
|
npx polyxd-verify my-ui.json --themes carbon --modes light --widths 390 --json report.json
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
Playwright is an optional peer dependency: the rendered checks need it, so install it beside the verifier as above. Nothing loads it until a browser is launched, and without it `launch()` says what to install.
|
|
12
|
+
|
|
13
|
+
## Document checks only
|
|
14
|
+
|
|
15
|
+
`@polyxd/verifier/static` is the document checks on their own: `staticAudit(doc, { registry, rules, emphasisBudget, missingData })`. It imports no Playwright and reads no files (the spec's pattern checks are built into it), so it runs in Node, browsers and Workers, and installing the verifier for it alone doesn't pull in Playwright.
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { staticAudit } from "@polyxd/verifier/static";
|
|
19
|
+
|
|
20
|
+
const findings = staticAudit(doc, { registry });
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`@polyxd/runtime` uses it as its default checks, and `@polyxd/mcp` and `@polyxd/server` use it for their verify tools. `npm run build:patterns -w @polyxd/verifier` regenerates the pattern checks from the spec; a test fails when they are out of date.
|
|
24
|
+
|
|
11
25
|
Inside the Polyxd repository, `npm run verify:examples -w @polyxd/verifier` runs every spec example through the full matrix with agent tasks.
|
|
12
26
|
|
|
13
27
|
## What it checks
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Browser, Page } from "playwright";
|
|
2
2
|
/**
|
|
3
3
|
* A page that renders `window.__PXD__` (see harness/README.md): the built-in React harness, the
|
|
4
4
|
* Web Components harness, or any renderer's own page, by URL or as a directory of static files.
|
|
@@ -18,6 +18,10 @@ export interface RenderTarget {
|
|
|
18
18
|
/** Viewport width in CSS pixels, e.g. 390 (phone) or 1100 (desktop) */
|
|
19
19
|
width: number;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Starts headless Chromium for the rendered checks. Playwright is an optional peer dependency, so
|
|
23
|
+
* nothing loads it until now: the document checks (`@polyxd/verifier/static`) never need it.
|
|
24
|
+
*/
|
|
21
25
|
export declare function launch(): Promise<Browser>;
|
|
22
26
|
/**
|
|
23
27
|
* Opens a page with one document rendered in one theme/mode/width. The harness is served from
|
package/dist/browser.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { extname } from "node:path";
|
|
4
|
-
import { chromium } from "playwright";
|
|
5
4
|
const ORIGIN = "http://harness.polyxd.local";
|
|
6
5
|
/** The harnesses this package ships, built by `npm run build:harness`. */
|
|
7
6
|
export const HARNESSES = {
|
|
@@ -9,9 +8,23 @@ export const HARNESSES = {
|
|
|
9
8
|
web: { name: "web", html: new URL("../harness-web-dist/index.html", import.meta.url) },
|
|
10
9
|
};
|
|
11
10
|
const TYPES = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml" };
|
|
12
|
-
|
|
11
|
+
let axeSource;
|
|
12
|
+
const axe = () => (axeSource ??= readFile(createRequire(import.meta.url).resolve("axe-core/axe.min.js"), "utf8"));
|
|
13
|
+
/**
|
|
14
|
+
* Starts headless Chromium for the rendered checks. Playwright is an optional peer dependency, so
|
|
15
|
+
* nothing loads it until now: the document checks (`@polyxd/verifier/static`) never need it.
|
|
16
|
+
*/
|
|
13
17
|
export async function launch() {
|
|
14
|
-
|
|
18
|
+
let playwright;
|
|
19
|
+
try {
|
|
20
|
+
playwright = await import("playwright");
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
if (err.code !== "ERR_MODULE_NOT_FOUND")
|
|
24
|
+
throw err;
|
|
25
|
+
throw new Error("The rendered checks need Playwright, which @polyxd/verifier doesn't install for you: run `npm install -D playwright && npx playwright install chromium`. The document checks alone are in @polyxd/verifier/static.");
|
|
26
|
+
}
|
|
27
|
+
return playwright.chromium.launch();
|
|
15
28
|
}
|
|
16
29
|
/**
|
|
17
30
|
* Opens a page with one document rendered in one theme/mode/width. The harness is served from
|
|
@@ -51,7 +64,7 @@ export async function renderPage(browser, document, target, harness = HARNESSES.
|
|
|
51
64
|
const doc = globalThis.document;
|
|
52
65
|
return Promise.all(doc.getAnimations().filter((a) => a.effect?.getTiming().iterations !== Infinity).map((a) => a.finished.catch(() => undefined)));
|
|
53
66
|
});
|
|
54
|
-
await page.addScriptTag({ content: await
|
|
67
|
+
await page.addScriptTag({ content: await axe() });
|
|
55
68
|
return { page, errors };
|
|
56
69
|
}
|
|
57
70
|
/** Actions the rendered UI has sent to the host so far. */
|
package/dist/browser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,MAAM,GAAG,6BAA6B,CAAC;AAU7C,0EAA0E;AAC1E,MAAM,CAAC,MAAM,SAAS,GAA6C;IACjE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,CAAC,4BAA4B,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE;IACtF,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,GAAG,CAAC,gCAAgC,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE;CACvF,CAAC;AACF,MAAM,KAAK,GAA2B,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;AACtI,IAAI,SAAsC,CAAC;AAC3C,M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attern id. */
|
|
2
|
+
export const PATTERN_CHECKS = {
|
|
3
|
+
"compare-and-choose": [
|
|
4
|
+
{
|
|
5
|
+
"id": "one-comparison",
|
|
6
|
+
"description": "Exactly one Comparison",
|
|
7
|
+
"severity": "error",
|
|
8
|
+
"rule": {
|
|
9
|
+
"check": "contains",
|
|
10
|
+
"component": "Comparison",
|
|
11
|
+
"min": 1,
|
|
12
|
+
"max": 1
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"id": "can-choose",
|
|
17
|
+
"description": "Each option can be chosen",
|
|
18
|
+
"severity": "error",
|
|
19
|
+
"rule": {
|
|
20
|
+
"check": "requires",
|
|
21
|
+
"component": "Comparison",
|
|
22
|
+
"props": [
|
|
23
|
+
"choose"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"id": "explains",
|
|
29
|
+
"description": "A one-line summary or the recommendation's reason helps the decision",
|
|
30
|
+
"severity": "warning",
|
|
31
|
+
"rule": {
|
|
32
|
+
"check": "anyOf",
|
|
33
|
+
"checks": [
|
|
34
|
+
{
|
|
35
|
+
"check": "requires",
|
|
36
|
+
"component": "Comparison",
|
|
37
|
+
"props": [
|
|
38
|
+
"summary"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"check": "requires",
|
|
43
|
+
"component": "Comparison",
|
|
44
|
+
"props": [
|
|
45
|
+
"recommendedReason"
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"confirm-destructive": [
|
|
53
|
+
{
|
|
54
|
+
"id": "root-is-confirm",
|
|
55
|
+
"description": "The surface is a confirmation dialog",
|
|
56
|
+
"severity": "error",
|
|
57
|
+
"rule": {
|
|
58
|
+
"check": "rootIs",
|
|
59
|
+
"components": [
|
|
60
|
+
"Confirm"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"id": "states-consequence",
|
|
66
|
+
"description": "It says what will happen and whether it can be undone",
|
|
67
|
+
"severity": "error",
|
|
68
|
+
"rule": {
|
|
69
|
+
"check": "requires",
|
|
70
|
+
"component": "Confirm",
|
|
71
|
+
"props": [
|
|
72
|
+
"consequence"
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"id": "specific-confirm-label",
|
|
78
|
+
"description": "The confirm button says what it does, never just 'OK' or 'Yes'",
|
|
79
|
+
"severity": "error",
|
|
80
|
+
"rule": {
|
|
81
|
+
"check": "noLabelMatches",
|
|
82
|
+
"pattern": "^(OK|Ok|Yes|Confirm|Submit|Done)$"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"id": "typed-for-destructive",
|
|
87
|
+
"description": "Irreversible, high-impact deletions ask the user to type a confirmation",
|
|
88
|
+
"severity": "warning",
|
|
89
|
+
"rule": {
|
|
90
|
+
"check": "requires",
|
|
91
|
+
"component": "Confirm",
|
|
92
|
+
"where": {
|
|
93
|
+
"severity": "destructive"
|
|
94
|
+
},
|
|
95
|
+
"props": [
|
|
96
|
+
"typeToConfirm"
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"filter-and-browse": [
|
|
102
|
+
{
|
|
103
|
+
"id": "has-results",
|
|
104
|
+
"description": "Results are shown as a Collection or Table",
|
|
105
|
+
"severity": "error",
|
|
106
|
+
"rule": {
|
|
107
|
+
"check": "anyOf",
|
|
108
|
+
"checks": [
|
|
109
|
+
{
|
|
110
|
+
"check": "contains",
|
|
111
|
+
"component": "Collection"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"check": "contains",
|
|
115
|
+
"component": "Table"
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"id": "filters-first",
|
|
122
|
+
"description": "Filters come before the results",
|
|
123
|
+
"severity": "error",
|
|
124
|
+
"rule": {
|
|
125
|
+
"check": "precedes",
|
|
126
|
+
"before": [
|
|
127
|
+
"TextInput",
|
|
128
|
+
"Choice",
|
|
129
|
+
"RangeInput",
|
|
130
|
+
"DateInput"
|
|
131
|
+
],
|
|
132
|
+
"after": [
|
|
133
|
+
"Collection",
|
|
134
|
+
"Table"
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"id": "empty-state",
|
|
140
|
+
"description": "Empty results explain what to do",
|
|
141
|
+
"severity": "error",
|
|
142
|
+
"rule": {
|
|
143
|
+
"check": "allOf",
|
|
144
|
+
"checks": [
|
|
145
|
+
{
|
|
146
|
+
"check": "requires",
|
|
147
|
+
"component": "Collection",
|
|
148
|
+
"props": [
|
|
149
|
+
"empty"
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"check": "requires",
|
|
154
|
+
"component": "Table",
|
|
155
|
+
"props": [
|
|
156
|
+
"empty"
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
"multi-step-form": [
|
|
164
|
+
{
|
|
165
|
+
"id": "form-or-steps",
|
|
166
|
+
"description": "Inputs are collected in a Form or in Steps",
|
|
167
|
+
"severity": "error",
|
|
168
|
+
"rule": {
|
|
169
|
+
"check": "anyOf",
|
|
170
|
+
"checks": [
|
|
171
|
+
{
|
|
172
|
+
"check": "contains",
|
|
173
|
+
"component": "Form"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"check": "contains",
|
|
177
|
+
"component": "Steps"
|
|
178
|
+
}
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"id": "short-views",
|
|
184
|
+
"description": "No more than 6 inputs are visible at once; longer tasks are split into steps",
|
|
185
|
+
"severity": "error",
|
|
186
|
+
"rule": {
|
|
187
|
+
"check": "maxInputsPerView",
|
|
188
|
+
"max": 6
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"id": "specific-submit",
|
|
193
|
+
"description": "The submit button says what happens next",
|
|
194
|
+
"severity": "warning",
|
|
195
|
+
"rule": {
|
|
196
|
+
"check": "noLabelMatches",
|
|
197
|
+
"pattern": "^(OK|Ok|Yes|Confirm|Submit|Done)$"
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
"review-and-submit": [
|
|
202
|
+
{
|
|
203
|
+
"id": "has-summary",
|
|
204
|
+
"description": "What will be submitted is shown as label/value pairs",
|
|
205
|
+
"severity": "error",
|
|
206
|
+
"rule": {
|
|
207
|
+
"check": "contains",
|
|
208
|
+
"component": "DetailList"
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"id": "submits",
|
|
213
|
+
"description": "There is a way to submit",
|
|
214
|
+
"severity": "error",
|
|
215
|
+
"rule": {
|
|
216
|
+
"check": "anyOf",
|
|
217
|
+
"checks": [
|
|
218
|
+
{
|
|
219
|
+
"check": "contains",
|
|
220
|
+
"component": "Form"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"check": "contains",
|
|
224
|
+
"component": "Steps"
|
|
225
|
+
}
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"id": "summary-before-inputs",
|
|
231
|
+
"description": "Review content comes before any last inputs",
|
|
232
|
+
"severity": "warning",
|
|
233
|
+
"rule": {
|
|
234
|
+
"check": "anyOf",
|
|
235
|
+
"checks": [
|
|
236
|
+
{
|
|
237
|
+
"check": "not",
|
|
238
|
+
"checks": [
|
|
239
|
+
{
|
|
240
|
+
"check": "contains",
|
|
241
|
+
"component": "Toggle"
|
|
242
|
+
}
|
|
243
|
+
]
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"check": "precedes",
|
|
247
|
+
"before": [
|
|
248
|
+
"DetailList"
|
|
249
|
+
],
|
|
250
|
+
"after": [
|
|
251
|
+
"Toggle"
|
|
252
|
+
]
|
|
253
|
+
}
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"id": "commitment-label",
|
|
259
|
+
"description": "The submit label states the commitment, not 'Submit'",
|
|
260
|
+
"severity": "error",
|
|
261
|
+
"rule": {
|
|
262
|
+
"check": "noLabelMatches",
|
|
263
|
+
"pattern": "^(OK|Ok|Yes|Confirm|Submit|Done|Continue)$"
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
],
|
|
267
|
+
"undo-over-confirm": [
|
|
268
|
+
{
|
|
269
|
+
"id": "has-undo-status",
|
|
270
|
+
"description": "An undo notice says what happened",
|
|
271
|
+
"severity": "error",
|
|
272
|
+
"rule": {
|
|
273
|
+
"check": "contains",
|
|
274
|
+
"component": "Status",
|
|
275
|
+
"where": {
|
|
276
|
+
"kind": "undo"
|
|
277
|
+
},
|
|
278
|
+
"min": 1
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"id": "undo-has-action",
|
|
283
|
+
"description": "The notice offers Undo",
|
|
284
|
+
"severity": "error",
|
|
285
|
+
"rule": {
|
|
286
|
+
"check": "requires",
|
|
287
|
+
"component": "Status",
|
|
288
|
+
"where": {
|
|
289
|
+
"kind": "undo"
|
|
290
|
+
},
|
|
291
|
+
"props": [
|
|
292
|
+
"action"
|
|
293
|
+
]
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"id": "no-confirm",
|
|
298
|
+
"description": "Nothing asks for confirmation first",
|
|
299
|
+
"severity": "warning",
|
|
300
|
+
"rule": {
|
|
301
|
+
"check": "not",
|
|
302
|
+
"checks": [
|
|
303
|
+
{
|
|
304
|
+
"check": "contains",
|
|
305
|
+
"component": "Confirm"
|
|
306
|
+
}
|
|
307
|
+
]
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
]
|
|
311
|
+
};
|
|
312
|
+
//# sourceMappingURL=patterns.generated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patterns.generated.js","sourceRoot":"","sources":["../src/patterns.generated.ts"],"names":[],"mappings":"AAGA,iDAAiD;AACjD,MAAM,CAAC,MAAM,cAAc,GAA2B;IACrD,oBAAoB,EAAE;QACrB;YACC,IAAI,EAAE,gBAAgB;YACtB,aAAa,EAAE,wBAAwB;YACvC,UAAU,EAAE,OAAO;YACnB,MAAM,EAAE;gBACP,OAAO,EAAE,UAAU;gBACnB,WAAW,EAAE,YAAY;gBACzB,KAAK,EAAE,CAAC;gBACR,KAAK,EAAE,CAAC;aACR;SACD;QACD;YACC,IAAI,EAAE,YAAY;YAClB,aAAa,EAAE,2BAA2B;YAC1C,UAAU,EAAE,OAAO;YACnB,MAAM,EAAE;gBACP,OAAO,EAAE,UAAU;gBACnB,WAAW,EAAE,YAAY;gBACzB,OAAO,EAAE;oBACR,QAAQ;iBACR;aACD;SACD;QACD;YACC,IAAI,EAAE,UAAU;YAChB,aAAa,EAAE,sEAAsE;YACrF,UAAU,EAAE,SAAS;YACrB,MAAM,EAAE;gBACP,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE;oBACT;wBACC,OAAO,EAAE,UAAU;wBACnB,WAAW,EAAE,YAAY;wBACzB,OAAO,EAAE;4BACR,SAAS;yBACT;qBACD;oBACD;wBACC,OAAO,EAAE,UAAU;wBACnB,WAAW,EAAE,YAAY;wBACzB,OAAO,EAAE;4BACR,mBAAmB;yBACnB;qBACD;iBACD;aACD;SACD;KACD;IACD,qBAAqB,EAAE;QACtB;YACC,IAAI,EAAE,iBAAiB;YACvB,aAAa,EAAE,sCAAsC;YACrD,UAAU,EAAE,OAAO;YACnB,MAAM,EAAE;gBACP,OAAO,EAAE,QAAQ;gBACjB,YAAY,EA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QAAQ;iBACR;aACD;SACD;QACD;YACC,IAAI,EAAE,YAAY;YAClB,aAAa,EAAE,qCAAqC;YACpD,UAAU,EAAE,SAAS;YACrB,MAAM,EAAE;gBACP,OAAO,EAAE,KAAK;gBACd,QAAQ,EAAE;oBACT;wBACC,OAAO,EAAE,UAAU;wBACnB,WAAW,EAAE,SAAS;qBACtB;iBACD;aACD;SACD;KACD;CACD,CAAC"}
|
package/dist/rendered.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import type { Page } from "playwright";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
check: string;
|
|
5
|
-
message: string;
|
|
6
|
-
/** How many elements are affected */
|
|
7
|
-
count?: number;
|
|
8
|
-
}
|
|
2
|
+
import type { Finding } from "./static.ts";
|
|
3
|
+
export type { Finding };
|
|
9
4
|
/** axe-core WCAG 2.2 AA audit of the surface (including dialogs, which portal inside it). */
|
|
10
5
|
export declare function axeAudit(page: Page): Promise<Finding[]>;
|
|
11
6
|
/**
|
package/dist/rendered.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rendered.js","sourceRoot":"","sources":["../src/rendered.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rendered.js","sourceRoot":"","sources":["../src/rendered.ts"],"names":[],"mappings":"AAKA,MAAM,SAAS,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AAE3E,6FAA6F;AAC7F,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,IAAU;IACvC,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACpD,MAAM,GAAG,GAAI,MAAc,CAAC,GAAG,CAAC;QAChC,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,aAAa,CAAC,cAAc,CAAC,EAAE,EAAE,OAAO,EAAE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CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;IACzN,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/static.d.ts
CHANGED
|
@@ -1,13 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Rule } from "@polyxd/spec/patterns";
|
|
2
2
|
import { type CapabilityRegistry } from "@polyxd/spec/capabilities";
|
|
3
|
-
|
|
3
|
+
export type { Rule, CapabilityRegistry };
|
|
4
|
+
export interface Finding {
|
|
5
|
+
severity: "error" | "warning";
|
|
6
|
+
check: string;
|
|
7
|
+
message: string;
|
|
8
|
+
/** How many elements are affected */
|
|
9
|
+
count?: number;
|
|
10
|
+
}
|
|
4
11
|
export interface StaticOptions {
|
|
5
12
|
registry?: CapabilityRegistry;
|
|
6
13
|
/** Design Direction or acceptance rules to hold the document to */
|
|
7
14
|
rules?: Rule[];
|
|
8
15
|
/** Primary actions allowed in one view (Design Direction's profile.emphasisBudget) */
|
|
9
16
|
emphasisBudget?: number;
|
|
17
|
+
/**
|
|
18
|
+
* How a binding that reads nothing from `data` is reported (`data:missing-path`). Default
|
|
19
|
+
* "error": against the data the screen is shown with, it renders a blank. Use "warning" when the
|
|
20
|
+
* document is checked without the data it will get.
|
|
21
|
+
*/
|
|
22
|
+
missingData?: "warning" | "error";
|
|
10
23
|
}
|
|
24
|
+
/** The ids of the spec's patterns, whose checks this module carries. */
|
|
25
|
+
export declare const PATTERN_IDS: string[];
|
|
11
26
|
/**
|
|
12
27
|
* Document-level checks that need no rendering: the spec validator, the declared pattern,
|
|
13
28
|
* capabilities, direction/acceptance rules, plus agent-readiness heuristics.
|
package/dist/static.js
CHANGED
|
@@ -1,7 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The document checks: everything the verifier can say without rendering. This module is also the
|
|
3
|
+
* `@polyxd/verifier/static` entry, so it imports nothing that needs a browser or a file system:
|
|
4
|
+
* the spec's browser-safe entries, and the pattern checks inlined at build time. It runs in Node,
|
|
5
|
+
* browsers and Workers.
|
|
6
|
+
*/
|
|
7
|
+
import { validateDocument } from "@polyxd/spec/browser";
|
|
3
8
|
import { checkCapabilities } from "@polyxd/spec/capabilities";
|
|
4
9
|
import { childIds, readingOrder, runCheck } from "@polyxd/spec/checks";
|
|
10
|
+
import { PATTERN_CHECKS } from "./patterns.generated.js";
|
|
11
|
+
/** The ids of the spec's patterns, whose checks this module carries. */
|
|
12
|
+
export const PATTERN_IDS = Object.keys(PATTERN_CHECKS);
|
|
13
|
+
function evaluate(rules, doc) {
|
|
14
|
+
return rules.map((r) => ({ id: r.id, description: r.description, severity: r.severity, ...runCheck(r.rule, doc) }));
|
|
15
|
+
}
|
|
16
|
+
function checkPattern(doc) {
|
|
17
|
+
const id = doc?.surface?.pattern;
|
|
18
|
+
if (!id)
|
|
19
|
+
return [];
|
|
20
|
+
const checks = PATTERN_CHECKS[id];
|
|
21
|
+
if (!checks)
|
|
22
|
+
return [{ id: "unknown-pattern", description: "Declared pattern exists", severity: "error", pass: false, message: `unknown pattern "${id}"` }];
|
|
23
|
+
return evaluate(checks, doc);
|
|
24
|
+
}
|
|
5
25
|
const INPUTS = new Set(["TextInput", "Choice", "Toggle", "DateInput", "RangeInput", "Rating", "FileInput", "ColorInput", "CodeInput"]);
|
|
6
26
|
const GENERIC = /^(ok|okay|yes|no|submit|go|click here|here|more|continue|next|done)$/i;
|
|
7
27
|
const TEXT_PROPS = ["title", "label", "summary", "caption", "text", "message", "consequence"];
|
|
@@ -59,7 +79,7 @@ export function staticAudit(doc, opts = {}) {
|
|
|
59
79
|
const out = [];
|
|
60
80
|
// A binding that reads nothing renders a blank where the answer should be: against the data the
|
|
61
81
|
// screen is shown with, that's an error, and one worth its own check id.
|
|
62
|
-
const v = validateDocument(doc, { emphasisBudget: opts.emphasisBudget, missingData: "error" });
|
|
82
|
+
const v = validateDocument(doc, { emphasisBudget: opts.emphasisBudget, missingData: opts.missingData ?? "error" });
|
|
63
83
|
for (const i of v.issues) {
|
|
64
84
|
// The shell's structure has a check of its own: shell components only in a shell document, a
|
|
65
85
|
// shell authored with a Frame at the root and one Outlet under its main, placement under a Frame.
|
|
@@ -80,7 +100,7 @@ export function staticAudit(doc, opts = {}) {
|
|
|
80
100
|
for (const i of checkCapabilities(doc, opts.registry))
|
|
81
101
|
out.push({ severity: i.severity, check: "capability", message: `${i.at}: ${i.message}` });
|
|
82
102
|
if (opts.rules)
|
|
83
|
-
for (const r of
|
|
103
|
+
for (const r of evaluate(opts.rules, doc))
|
|
84
104
|
if (!r.pass)
|
|
85
105
|
out.push({ severity: r.severity, check: `rule:${r.id}`, message: `${r.description}: ${r.message}` });
|
|
86
106
|
// Short views everywhere, not only in surfaces that declare the multi-step-form pattern.
|