@reqvire-org/ads 0.4.7 → 0.5.1
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 +268 -420
- package/dist/accessibility-declarations.mjs +43 -0
- package/dist/active-clock.d.mts +30 -0
- package/dist/active-clock.mjs +26 -17
- package/dist/ads-errors.mjs +3684 -0
- package/dist/ads-view-choices.mjs +17 -0
- package/dist/ads-views.mjs +12 -0
- package/dist/analysis/captured-content.mjs +16 -0
- package/dist/analysis/compiler-options.mjs +3 -7
- package/dist/analysis/context.mjs +14 -20
- package/dist/analysis/controller-gates.mjs +119 -0
- package/dist/analysis/design-usage.mjs +142 -0
- package/dist/analysis/file-tree.mjs +44 -29
- package/dist/analysis/framework-imports.mjs +62 -0
- package/dist/analysis/glyph-macros.mjs +103 -0
- package/dist/analysis/helpers.mjs +119 -91
- package/dist/analysis/impact.mjs +25 -12
- package/dist/analysis/inputs.mjs +19 -13
- package/dist/analysis/mock-check.mjs +99 -0
- package/dist/analysis/module-graph.mjs +156 -0
- package/dist/analysis/module-resolvers.mjs +30 -28
- package/dist/analysis/native-adapter.mjs +139 -146
- package/dist/analysis/native-boundary.mjs +52 -0
- package/dist/analysis/native-project.mjs +331 -231
- package/dist/analysis/native-session.mjs +20 -0
- package/dist/analysis/owner-accessibility.mjs +74 -0
- package/dist/analysis/owner-analysis-cache.mjs +125 -0
- package/dist/analysis/owner-analysis-key.mjs +114 -0
- package/dist/analysis/owner-choices.mjs +896 -0
- package/dist/analysis/owner-composition.mjs +636 -0
- package/dist/analysis/owner-controls.mjs +27 -0
- package/dist/analysis/owner-discovery.mjs +164 -0
- package/dist/analysis/owner-failures.mjs +19 -0
- package/dist/analysis/owner-outcomes.mjs +42 -0
- package/dist/analysis/owner-reuse.mjs +100 -0
- package/dist/analysis/owner-source.mjs +1555 -0
- package/dist/analysis/prose-owners.mjs +57 -0
- package/dist/analysis/public-imports.mjs +31 -0
- package/dist/analysis/queries.mjs +72 -54
- package/dist/analysis/runtime-setters.mjs +114 -0
- package/dist/analysis/scenario-keys.mjs +151 -0
- package/dist/analysis/service.mjs +111 -70
- package/dist/analysis/standalone.mjs +40 -37
- package/dist/analysis/styling-ownership.mjs +298 -0
- package/dist/analysis/svg-attributes.mjs +199 -0
- package/dist/analysis/syntax.mjs +82 -78
- package/dist/analysis/visual-bindings.mjs +68 -0
- package/dist/analysis/worker-protocol.mjs +302 -0
- package/dist/analysis/worker.mjs +234 -166
- package/dist/api-signature.mjs +53 -0
- package/dist/app-icon-checks.mjs +298 -0
- package/dist/app-icon-declaration.d.mts +53 -0
- package/dist/app-icon-declaration.mjs +66 -0
- package/dist/asset-binding.mjs +35 -0
- package/dist/asset-catalog.mjs +83 -0
- package/dist/asset-declaration.d.mts +42 -0
- package/dist/asset-declaration.mjs +108 -0
- package/dist/asset-macro.d.mts +63 -0
- package/dist/asset-macro.mjs +22 -0
- package/dist/asset-model.mjs +74 -0
- package/dist/asset-usage.mjs +14 -0
- package/dist/asset-view-facts.mjs +41 -0
- package/dist/authoring-macro.d.mts +11 -0
- package/dist/authoring-macro.mjs +21 -0
- package/dist/autocomplete-hints.mjs +31 -0
- package/dist/availability.mjs +9 -0
- package/dist/behavior-macro.d.mts +31 -0
- package/dist/behavior-macro.mjs +3 -0
- package/dist/behavior-registry.mjs +358 -0
- package/dist/boundaries.mjs +50 -212
- package/dist/browser-runtime.mjs +73 -0
- package/dist/browser-test.d.mts +3 -0
- package/dist/browser-test.mjs +2 -0
- package/dist/bun-bundler.mjs +10 -0
- package/dist/bun-compiler.mjs +30 -18
- package/dist/bun-runtime.mjs +4 -0
- package/dist/bun-worker.mjs +10 -4
- package/dist/capture/request.mjs +81 -0
- package/dist/capture/worker.mjs +69 -40
- package/dist/capture/worker.page.mjs +6 -0
- package/dist/capture-store.mjs +159 -75
- package/dist/capture.mjs +232 -95
- package/dist/check-service.mjs +27 -33
- package/dist/check.mjs +206 -904
- package/dist/cli-arguments.mjs +278 -0
- package/dist/cli.mjs +374 -304
- package/dist/color-values.mjs +294 -242
- package/dist/composed-contrast.mjs +648 -0
- package/dist/composed-keyline.mjs +107 -0
- package/dist/config.mjs +162 -468
- package/dist/construction-output.mjs +345 -0
- package/dist/construction-spec.d.mts +915 -0
- package/dist/construction-spec.mjs +1178 -0
- package/dist/corner-overpaint.mjs +53 -0
- package/dist/css-length.mjs +80 -0
- package/dist/css-quantity.mjs +173 -0
- package/dist/deletion-model.mjs +56 -0
- package/dist/deletion-plan.mjs +364 -0
- package/dist/dependency-manifest.mjs +56 -0
- package/dist/design-context-model.d.mts +61 -0
- package/dist/design-context-model.mjs +79 -0
- package/dist/design-contexts.mjs +105 -0
- package/dist/design-foundation.mjs +532 -0
- package/dist/design-inputs.mjs +156 -0
- package/dist/design-modules.mjs +27 -0
- package/dist/design-rejection.d.mts +23 -0
- package/dist/design-rejection.mjs +29 -0
- package/dist/design-system-closure.mjs +108 -0
- package/dist/design-usage.mjs +54 -0
- package/dist/development-modules.mjs +2 -0
- package/dist/development-runtime.mjs +0 -7
- package/dist/digest.mjs +2 -0
- package/dist/draft-boundary.mjs +1 -27
- package/dist/draft-workspace.mjs +11 -5
- package/dist/emit/accept.mjs +33 -0
- package/dist/emit/app-icon-emission.mjs +124 -0
- package/dist/emit/app-icon-render.mjs +126 -0
- package/dist/emit/asset-imports.mjs +18 -0
- package/dist/emit/cli-report.mjs +97 -0
- package/dist/emit/contract.mjs +136 -0
- package/dist/emit/emission.mjs +182 -0
- package/dist/emit/font-emission.mjs +111 -0
- package/dist/emit/foundation-sheet.mjs +56 -0
- package/dist/emit/icon-containers.mjs +46 -0
- package/dist/emit/integrity.mjs +61 -0
- package/dist/emit/lock.mjs +66 -0
- package/dist/emit/namespace.mjs +79 -0
- package/dist/emit/operation-reply.mjs +3 -0
- package/dist/emit/operation.mjs +36 -0
- package/dist/emit/output-location.mjs +20 -0
- package/dist/emit/output-package.mjs +7 -0
- package/dist/emit/owner-emission-cache.mjs +52 -0
- package/dist/emit/palette-module.mjs +19 -0
- package/dist/emit/palette-refresh.mjs +77 -0
- package/dist/emit/preview-emitter.mjs +110 -0
- package/dist/emit/preview-tree.mjs +174 -0
- package/dist/emit/scheduler.mjs +75 -0
- package/dist/emit/service.mjs +249 -0
- package/dist/emit/sync.mjs +38 -0
- package/dist/emit/watch.mjs +74 -0
- package/dist/emit/writer.mjs +102 -0
- package/dist/evidence.mjs +6 -8
- package/dist/example-babel.mjs +7 -0
- package/dist/example-literals.mjs +88 -0
- package/dist/finding-rules.mjs +78 -77
- package/dist/focus-checks.mjs +93 -0
- package/dist/font-checks.mjs +185 -0
- package/dist/font-declaration.d.mts +64 -0
- package/dist/font-declaration.mjs +99 -0
- package/dist/font-fallback.d.mts +37 -0
- package/dist/font-fallback.mjs +25 -0
- package/dist/font-macro.d.mts +42 -0
- package/dist/font-macro.mjs +6 -0
- package/dist/font-metrics.d.mts +34 -0
- package/dist/font-metrics.mjs +314 -0
- package/dist/font-model.mjs +63 -0
- package/dist/form-states.mjs +82 -0
- package/dist/foundation-macro.d.mts +108 -0
- package/dist/foundation-macro.mjs +6 -0
- package/dist/frame-regions.mjs +253 -0
- package/dist/glyph-set-declaration.d.mts +27 -0
- package/dist/glyph-set-declaration.mjs +36 -0
- package/dist/grid-checks.mjs +94 -0
- package/dist/grid-facts.mjs +148 -0
- package/dist/grid-lowering.mjs +263 -0
- package/dist/guard/cli.mjs +51 -0
- package/dist/guard/config.mjs +67 -0
- package/dist/guard/files.mjs +31 -0
- package/dist/guard/index.mjs +3 -0
- package/dist/guard/run.mjs +56 -0
- package/dist/guard/tsconfig.declarations.json +13 -0
- package/dist/index.mjs +2 -7
- package/dist/init-project.mjs +134 -0
- package/dist/init.mjs +217 -264
- package/dist/input-digests.mjs +109 -163
- package/dist/input-scope.mjs +18 -41
- package/dist/inspected-svg.d.mts +28 -0
- package/dist/inspected-svg.mjs +40 -0
- package/dist/inventories.mjs +149 -0
- package/dist/inventory-query.mjs +15 -0
- package/dist/investigations.mjs +177 -99
- package/dist/json.d.mts +10 -0
- package/dist/json.mjs +36 -0
- package/dist/linaria/atomic-processor.json +96 -0
- package/dist/linaria/atomic-processor.mjs +2452 -0
- package/dist/linaria/backend-identity.mjs +26 -0
- package/dist/linaria/compatibility.json +61 -0
- package/dist/linaria/css-shape.mjs +94 -0
- package/dist/linaria/custom-property-css.mjs +56 -0
- package/dist/linaria/delivery.mjs +111 -0
- package/dist/linaria/direct-extract.mjs +43 -0
- package/dist/linaria/extraction-cache.mjs +31 -0
- package/dist/linaria/extraction-model.mjs +5 -0
- package/dist/linaria/fingerprint.mjs +183 -0
- package/dist/linaria/pair-manifest.json +2315 -0
- package/dist/linaria/persisted-extraction-cache.mjs +352 -0
- package/dist/linaria/preservation.mjs +13 -0
- package/dist/linaria/priority-emitted-rank.mjs +40 -0
- package/dist/linaria/priority-manifest.mjs +87 -0
- package/dist/linaria/priority-table.mjs +47 -0
- package/dist/linaria/priority-tiers.mjs +27 -0
- package/dist/linaria/processor-host.mjs +42 -0
- package/dist/linaria/processor-runtime.mjs +36 -0
- package/dist/linaria-processor-NOTICES.md +147 -0
- package/dist/lowering-components.mjs +14 -0
- package/dist/lowering-effects.mjs +38 -0
- package/dist/lowering-emitter.mjs +29 -0
- package/dist/lowering-enter.mjs +31 -0
- package/dist/lowering-hidden.mjs +30 -0
- package/dist/lowering-layer.mjs +141 -0
- package/dist/lowering-motion.mjs +37 -0
- package/dist/lowering-normalize.mjs +194 -0
- package/dist/lowering-overlaps.mjs +328 -0
- package/dist/lowering-paint.mjs +32 -0
- package/dist/lowering-properties.mjs +165 -0
- package/dist/lowering-region-layout.mjs +225 -0
- package/dist/lowering-sequence.mjs +89 -0
- package/dist/lowering-serialize.mjs +40 -0
- package/dist/lowering-session.mjs +137 -0
- package/dist/lowering-tiers.mjs +23 -0
- package/dist/lowering-transitions.mjs +53 -0
- package/dist/mcp/ads-mcp.mjs +423 -0
- package/dist/mcp/apps.mjs +3 -25
- package/dist/mcp/behavior-pages.mjs +58 -51
- package/dist/mcp/build-status.mjs +233 -267
- package/dist/mcp/catalog.mjs +21 -128
- package/dist/mcp/compiler-channel.mjs +218 -83
- package/dist/mcp/context.mjs +50 -40
- package/dist/mcp/deletions.mjs +147 -0
- package/dist/mcp/draft-discovery.mjs +43 -38
- package/dist/mcp/drafts.mjs +635 -691
- package/dist/mcp/execution-context.mjs +33 -22
- package/dist/mcp/execution-coordinator.mjs +367 -354
- package/dist/mcp/execution-results.mjs +440 -173
- package/dist/mcp/mutation-limits.mjs +1 -2
- package/dist/mcp/mutations.mjs +515 -553
- package/dist/mcp/patch.mjs +117 -75
- package/dist/mcp/preview-http.bundle.js +3 -7
- package/dist/mcp/preview-http.mjs +220 -107
- package/dist/mcp/preview-owner-guard.mjs +81 -43
- package/dist/mcp/preview-watch.mjs +428 -365
- package/dist/mcp/preview-widget.bundle.js +42 -46
- package/dist/mcp/preview-work.mjs +25 -13
- package/dist/mcp/prompts.mjs +22 -16
- package/dist/mcp/resource-loader.js +1 -1
- package/dist/mcp/result-pages.mjs +94 -54
- package/dist/mcp/sandbox-host.mjs +41 -19
- package/dist/mcp/server-discovery.mjs +96 -0
- package/dist/mcp/server-guides.mjs +43 -0
- package/dist/mcp/server-host.mjs +203 -0
- package/dist/mcp/server-observation.mjs +225 -0
- package/dist/mcp/server-project.mjs +371 -0
- package/dist/mcp/server-resources.mjs +466 -0
- package/dist/mcp/server-shared.mjs +79 -0
- package/dist/mcp/server-tools.mjs +791 -0
- package/dist/mcp/server.mjs +2 -2813
- package/dist/mcp/showcase-host.mjs +209 -135
- package/dist/mcp/showcase-http.mjs +50 -28
- package/dist/mcp/skills.mjs +32 -36
- package/dist/mcp/text-diff.mjs +18 -36
- package/dist/measured-geometry.mjs +157 -0
- package/dist/motion-model.mjs +52 -0
- package/dist/non-text-contrast.mjs +118 -0
- package/dist/owner-analysis-check.mjs +711 -0
- package/dist/owner-design.mjs +15 -0
- package/dist/owner-errors.mjs +216 -0
- package/dist/owner-lowering.mjs +206 -0
- package/dist/owner-scenarios.mjs +854 -0
- package/dist/ownership-model.d.mts +6 -0
- package/dist/ownership-model.mjs +143 -0
- package/dist/package-declarations.mjs +34 -0
- package/dist/paint-contrast.mjs +186 -0
- package/dist/palette-generated.mjs +101 -116
- package/dist/pictogram-model.mjs +13 -51
- package/dist/placeholder-contrast.mjs +35 -0
- package/dist/platform-features.mjs +401 -0
- package/dist/press-scale.mjs +26 -0
- package/dist/preview-bun.mjs +334 -404
- package/dist/preview-compile-inputs.mjs +78 -0
- package/dist/preview-contexts.mjs +7 -0
- package/dist/preview-controls.mjs +35 -0
- package/dist/preview-failure.mjs +20 -10
- package/dist/preview-files.mjs +18 -36
- package/dist/preview-imports.mjs +76 -70
- package/dist/preview-incremental.mjs +322 -222
- package/dist/preview-inputs.mjs +26 -26
- package/dist/preview-manifest-update.mjs +67 -49
- package/dist/preview-requests.mjs +10 -17
- package/dist/preview-resources.mjs +275 -323
- package/dist/preview-scope.mjs +15 -17
- package/dist/preview-source.mjs +182 -0
- package/dist/preview-spatial.mjs +27 -0
- package/dist/profile-macro.d.mts +56 -0
- package/dist/profile-macro.mjs +6 -0
- package/dist/profile-model.d.mts +65 -0
- package/dist/profile-model.mjs +213 -0
- package/dist/profile-view-facts.mjs +93 -0
- package/dist/program-cache.mjs +9 -7
- package/dist/project-boundary.mjs +8 -13
- package/dist/project-documents.mjs +25 -29
- package/dist/property-registrations.mjs +44 -35
- package/dist/prose-model.d.mts +81 -0
- package/dist/prose-model.mjs +101 -0
- package/dist/public-catalog.mjs +76 -0
- package/dist/recipe-defaults.mjs +117 -0
- package/dist/recipe-macro.d.mts +502 -0
- package/dist/recipe-macro.mjs +23 -0
- package/dist/recipe-model.d.mts +26 -0
- package/dist/recipe-model.mjs +214 -0
- package/dist/region-lowering.mjs +723 -0
- package/dist/registration-css.mjs +41 -0
- package/dist/registration-roles.mjs +35 -0
- package/dist/render-audit/axe-run.page.mjs +28 -0
- package/dist/render-audit/corner-overpaint.page.mjs +54 -0
- package/dist/render-audit/first-render.page.mjs +35 -0
- package/dist/render-audit/image-shape.page.mjs +42 -0
- package/dist/render-audit/layout-overflow.page.mjs +240 -0
- package/dist/render-audit/layout-shift.page.mjs +36 -0
- package/dist/render-audit/non-text-contrast.page.mjs +138 -0
- package/dist/render-audit/render-states.mjs +66 -293
- package/dist/render-audit/render-states.page.mjs +177 -0
- package/dist/render-audit/text-scale.mjs +42 -0
- package/dist/render-audit/text-scale.page.mjs +25 -0
- package/dist/render-audit/worker.mjs +130 -112
- package/dist/render-audit/worker.page.mjs +21 -0
- package/dist/render-audit.mjs +490 -500
- package/dist/resource-limits.mjs +174 -223
- package/dist/result.d.mts +34 -0
- package/dist/result.mjs +60 -0
- package/dist/role-vocabulary.d.mts +260 -0
- package/dist/role-vocabulary.mjs +258 -0
- package/dist/runtime-paint-contrast.mjs +97 -0
- package/dist/runtime-paint.mjs +42 -0
- package/dist/runtime-requirements.mjs +10 -11
- package/dist/runtime-style.mjs +21 -0
- package/dist/scenario-groups.mjs +42 -33
- package/dist/scenario-inspector.mjs +4 -4
- package/dist/scenario-kit.d.mts +85 -0
- package/dist/scenario-kit.mjs +18 -0
- package/dist/scenario-registry-model.mjs +2 -0
- package/dist/scenario-registry.mjs +89 -108
- package/dist/scenarios-compiler.mjs +875 -662
- package/dist/scheme-switch.d.mts +8 -0
- package/dist/scheme-switch.mjs +1 -0
- package/dist/showcase/ads-views.mjs +166 -0
- package/dist/showcase/assets-view.mjs +252 -0
- package/dist/showcase/client.bundle.js +211 -48
- package/dist/showcase/guide-controls.d.mts +28 -0
- package/dist/showcase/guide-controls.mjs +31 -0
- package/dist/showcase/http-client.bundle.js +172 -9
- package/dist/showcase/index.html +1 -1
- package/dist/showcase/preview-frame.css +18 -0
- package/dist/showcase/preview-frame.d.mts +5 -0
- package/dist/showcase/preview-frame.mjs +4 -0
- package/dist/showcase/preview-root.d.mts +2 -0
- package/dist/showcase/preview-root.mjs +9 -0
- package/dist/showcase/profiles-view.mjs +321 -0
- package/dist/showcase/project-rules.mjs +9 -0
- package/dist/showcase/sandbox.bundle.js +1 -1
- package/dist/showcase/scenario-page.d.mts +49 -0
- package/dist/showcase/scenario-page.mjs +105 -0
- package/dist/showcase/style.css +2 -0
- package/dist/showcase/token-sample.mjs +89 -0
- package/dist/showcase/tokens-view.mjs +233 -0
- package/dist/showcase/ui/apple-touch-icon-9zwv3w79.png +0 -0
- package/dist/showcase/{favicon.ico → ui/favicon-c2c9kvtf.ico} +0 -0
- package/dist/showcase/ui/icon-192-t5zh7mxx.png +0 -0
- package/dist/showcase/ui/icon-512-ed6yz0n0.png +0 -0
- package/dist/showcase/ui/ui.css +1 -1353
- package/dist/showcase/ui/ui.js +165 -1064
- package/dist/showcase-http-routes.mjs +28 -21
- package/dist/skills/README.md +28 -28
- package/dist/skills/ads-designer/README.md +1 -1
- package/dist/skills/ads-designer/SKILL.md +313 -551
- package/dist/skills/ads-designer/references/accessibility.md +162 -114
- package/dist/skills/ads-designer/references/atomic-styles.md +72 -277
- package/dist/skills/ads-designer/references/behaviors.md +144 -280
- package/dist/skills/ads-designer/references/branding.md +137 -222
- package/dist/skills/ads-designer/references/captures.md +13 -7
- package/dist/skills/ads-designer/references/cli.md +80 -63
- package/dist/skills/ads-designer/references/contracts.md +225 -286
- package/dist/skills/ads-designer/references/design-craft.md +2 -2
- package/dist/skills/ads-designer/references/design-data.md +299 -323
- package/dist/skills/ads-designer/references/drafts.md +83 -22
- package/dist/skills/ads-designer/references/evidence.md +2 -1
- package/dist/skills/ads-designer/references/forms.md +199 -0
- package/dist/skills/ads-designer/references/guarded-editing.md +37 -48
- package/dist/skills/ads-designer/references/layers.md +64 -76
- package/dist/skills/ads-designer/references/layout.md +224 -330
- package/dist/skills/ads-designer/references/mobile.md +2 -2
- package/dist/skills/ads-designer/references/motion.md +66 -25
- package/dist/skills/ads-designer/references/performance.md +55 -50
- package/dist/skills/ads-designer/references/pictograms.md +62 -127
- package/dist/skills/ads-designer/references/recipes.md +368 -0
- package/dist/skills/ads-designer/references/review.md +51 -95
- package/dist/skills/ads-designer/references/runtimes.md +34 -33
- package/dist/skills/ads-designer/references/scenarios.md +256 -216
- package/dist/skills/ads-designer/references/stress-test.md +13 -5
- package/dist/skills/ads-designer/references/validation.md +28 -21
- package/dist/skills/ads-designer/references/workflows.md +7 -5
- package/dist/skills/ads-import/SKILL.md +29 -29
- package/dist/skills/ads-import/references/atomic-styles.md +72 -277
- package/dist/skills/ads-import/references/behaviors.md +144 -280
- package/dist/skills/ads-import/references/branding.md +24 -41
- package/dist/skills/ads-import/references/captures.md +13 -7
- package/dist/skills/ads-import/references/cli.md +80 -63
- package/dist/skills/ads-import/references/compatibility.md +3 -3
- package/dist/skills/ads-import/references/contracts.md +225 -286
- package/dist/skills/ads-import/references/design-data.md +299 -323
- package/dist/skills/ads-import/references/drafts.md +83 -22
- package/dist/skills/ads-import/references/evidence.md +2 -1
- package/dist/skills/ads-import/references/forms.md +199 -0
- package/dist/skills/ads-import/references/guarded-editing.md +37 -48
- package/dist/skills/ads-import/references/implementation.md +20 -20
- package/dist/skills/ads-import/references/layers.md +64 -76
- package/dist/skills/ads-import/references/layout.md +224 -330
- package/dist/skills/ads-import/references/recipes.md +368 -0
- package/dist/skills/ads-import/references/review.md +51 -95
- package/dist/skills/ads-import/references/runtimes.md +34 -33
- package/dist/skills/ads-import/references/scenarios.md +256 -216
- package/dist/skills/ads-import/references/tokens.md +26 -17
- package/dist/skills/ads-import/references/validation.md +28 -21
- package/dist/skills/ads-import/references/workflows.md +7 -5
- package/dist/skills/ads-migrate/SKILL.md +20 -5
- package/dist/skills/ads-migrate/references/0.4.1-to-0.4.2.md +6 -0
- package/dist/skills/ads-migrate/references/0.4.7-to-0.5.0-boundary.md +71 -0
- package/dist/skills/ads-migrate/references/0.4.7-to-0.5.0-grid.md +204 -0
- package/dist/skills/ads-migrate/references/0.4.7-to-0.5.0.md +727 -0
- package/dist/skills/ads-migrate/references/0.5.0-to-0.5.1.md +239 -0
- package/dist/skills/ads-port/SKILL.md +27 -28
- package/dist/skills/ads-port/references/atomic-styles.md +72 -277
- package/dist/skills/ads-port/references/behaviors.md +144 -280
- package/dist/skills/ads-port/references/captures.md +13 -7
- package/dist/skills/ads-port/references/cli.md +80 -63
- package/dist/skills/ads-port/references/contracts.md +225 -286
- package/dist/skills/ads-port/references/design-data.md +299 -323
- package/dist/skills/ads-port/references/drafts.md +83 -22
- package/dist/skills/ads-port/references/evidence.md +2 -1
- package/dist/skills/ads-port/references/forms.md +199 -0
- package/dist/skills/ads-port/references/guarded-editing.md +37 -48
- package/dist/skills/ads-port/references/layers.md +64 -76
- package/dist/skills/ads-port/references/layout.md +224 -330
- package/dist/skills/ads-port/references/lint-and-docs.md +2 -3
- package/dist/skills/ads-port/references/native-implementation.md +23 -33
- package/dist/skills/ads-port/references/recipes.md +368 -0
- package/dist/skills/ads-port/references/review.md +51 -95
- package/dist/skills/ads-port/references/runtimes.md +34 -33
- package/dist/skills/ads-port/references/scenarios.md +256 -216
- package/dist/skills/ads-port/references/validation.md +28 -21
- package/dist/skills/ads-port/references/workflows.md +7 -5
- package/dist/source-inventory.mjs +33 -0
- package/dist/source-values.mjs +272 -262
- package/dist/spatial-css.mjs +403 -0
- package/dist/spatial-metadata.mjs +11 -11
- package/dist/spatial-model.mjs +438 -0
- package/dist/spatial-reading.mjs +127 -0
- package/dist/stage-timing.mjs +27 -0
- package/dist/state-conditions.d.mts +80 -0
- package/dist/state-conditions.mjs +107 -0
- package/dist/static-values.mjs +94 -0
- package/dist/surface-contrast.mjs +252 -0
- package/dist/surface-effects.mjs +98 -0
- package/dist/target-size.mjs +177 -0
- package/dist/task-cache.mjs +142 -136
- package/dist/task-worker.mjs +18 -18
- package/dist/test-boundaries.mjs +50 -189
- package/dist/token-checks.mjs +21 -0
- package/dist/token-dtcg.mjs +136 -0
- package/dist/token-expression.mjs +19 -0
- package/dist/token-inventory.mjs +146 -0
- package/dist/token-operations.mjs +37 -0
- package/dist/token-overlap.mjs +29 -0
- package/dist/token-provenance.mjs +260 -0
- package/dist/token-references.mjs +71 -0
- package/dist/token-registrations.mjs +116 -0
- package/dist/token-resolution.mjs +38 -0
- package/dist/token-sections.mjs +123 -0
- package/dist/token-shapes.mjs +121 -0
- package/dist/token-sheet-check.mjs +54 -0
- package/dist/token-type-check.mjs +89 -0
- package/dist/token-view-facts.mjs +111 -0
- package/dist/tsconfig.declarations.json +24 -0
- package/dist/types/css-tree.d.ts +45 -0
- package/dist/ui-framework.mjs +34 -34
- package/dist/units.mjs +186 -226
- package/dist/unknown.d.mts +9 -0
- package/dist/unknown.mjs +13 -0
- package/dist/unreached-sources.mjs +5 -0
- package/dist/validation-checks.mjs +62 -71
- package/dist/validation-inputs.mjs +209 -279
- package/dist/validation.mjs +132 -159
- package/dist/verification/browser.d.mts +21 -25
- package/dist/verification/browser.mjs +281 -124
- package/dist/verification/browser.page.d.mts +22 -0
- package/dist/verification/browser.page.mjs +19 -0
- package/dist/verification/paint-audit.page.d.mts +55 -0
- package/dist/verification/paint-audit.page.mjs +144 -0
- package/dist/verification/playwright-reporter.mjs +160 -0
- package/dist/verification/preview-startup.d.mts +51 -0
- package/dist/verification/preview-startup.mjs +76 -0
- package/dist/verification/request.d.mts +28 -0
- package/dist/verification/request.mjs +30 -0
- package/dist/verification/unit-preload.mjs +37 -0
- package/dist/verification.mjs +574 -607
- package/docs/ADS.md +585 -565
- package/docs/ARCHITECTURE.md +2002 -1384
- package/docs/ASSETS.md +487 -0
- package/docs/BEHAVIORS.md +339 -370
- package/docs/CACHING.md +365 -154
- package/docs/CHANGELOG.md +462 -21
- package/docs/COMPARISON.md +21 -26
- package/docs/DESIGN-REFERENCES.md +40 -27
- package/docs/GUIDE.md +2473 -1292
- package/docs/LANGUAGE.md +1159 -0
- package/docs/LOWERING.md +180 -0
- package/docs/MCP.md +1461 -1179
- package/docs/MOTION.md +491 -0
- package/docs/PROFILE-KINDS.md +544 -0
- package/docs/PROFILES.md +176 -0
- package/docs/RULES.md +590 -0
- package/docs/TOKEN-ROLES.md +377 -0
- package/docs/benchmarks/README.md +26 -27
- package/package.json +59 -45
- package/dist/a11y.mjs +0 -187
- package/dist/assets.mjs +0 -159
- package/dist/atomic-composition.mjs +0 -337
- package/dist/atomic-trace.mjs +0 -162
- package/dist/behavior-libraries.mjs +0 -174
- package/dist/behaviors.mjs +0 -306
- package/dist/brand-assets.mjs +0 -458
- package/dist/brands.mjs +0 -141
- package/dist/component-contrast.mjs +0 -256
- package/dist/construction-styles.cjs +0 -10
- package/dist/contracts/foundation.json +0 -211
- package/dist/contracts/tokens.json +0 -52
- package/dist/contracts.d.mts +0 -30
- package/dist/contrast-composition.mjs +0 -80
- package/dist/contrast-styles.mjs +0 -88
- package/dist/control-padding.mjs +0 -113
- package/dist/css-values.mjs +0 -27
- package/dist/declarative-flow.mjs +0 -244
- package/dist/design-values.mjs +0 -173
- package/dist/font-rules.mjs +0 -108
- package/dist/fonts-generated.mjs +0 -112
- package/dist/foundation-views.mjs +0 -242
- package/dist/foundation.mjs +0 -154
- package/dist/generated-entries.mjs +0 -198
- package/dist/html.mjs +0 -30
- package/dist/icons.mjs +0 -154
- package/dist/image-attributes.mjs +0 -187
- package/dist/image-size.mjs +0 -28
- package/dist/layers.mjs +0 -461
- package/dist/layout-widths.mjs +0 -332
- package/dist/linaria/atomic-css.cjs +0 -2
- package/dist/linaria/atomic-styled.cjs +0 -2
- package/dist/linaria/preserve-values.cjs +0 -58
- package/dist/linaria/spatial-inputs.cjs +0 -56
- package/dist/linaria.d.mts +0 -1
- package/dist/linaria.mjs +0 -9
- package/dist/lockup-composition.mjs +0 -44
- package/dist/lockup-model.cjs +0 -64
- package/dist/paint-contracts.mjs +0 -216
- package/dist/pictograms.mjs +0 -52
- package/dist/public-api.mjs +0 -121
- package/dist/public-props.mjs +0 -91
- package/dist/render-audit/axe-run.mjs +0 -17
- package/dist/render-audit/first-render.mjs +0 -40
- package/dist/render-audit/image-shape.mjs +0 -46
- package/dist/render-audit/layout-overflow.mjs +0 -167
- package/dist/render-audit/layout-shift.mjs +0 -32
- package/dist/render-audit/non-text-contrast.mjs +0 -151
- package/dist/render-audit/pictograms.mjs +0 -88
- package/dist/render-color-probe.mjs +0 -202
- package/dist/render-composition.mjs +0 -186
- package/dist/runtime-contracts.mjs +0 -506
- package/dist/scenario-program.mjs +0 -19
- package/dist/scenario-selectors.mjs +0 -237
- package/dist/scenario-slots.mjs +0 -217
- package/dist/scenario-trace.mjs +0 -314
- package/dist/scenarios-vite.d.mts +0 -2
- package/dist/scenarios-vite.mjs +0 -2
- package/dist/scenarios.mjs +0 -616
- package/dist/selector-match.mjs +0 -94
- package/dist/showcase/comparison.js +0 -48
- package/dist/showcase/connection.js +0 -10
- package/dist/showcase/draft-navigation.js +0 -59
- package/dist/showcase/foundation-view.css +0 -58
- package/dist/showcase/foundation-view.mjs +0 -255
- package/dist/showcase/guide-controls.ads.review.mjs +0 -32
- package/dist/showcase/http-connection.js +0 -86
- package/dist/showcase/http-preview.js +0 -81
- package/dist/showcase/icons.js +0 -2
- package/dist/showcase/navigation.js +0 -13
- package/dist/showcase/pictogram-view.mjs +0 -53
- package/dist/showcase/preview-frame.ads.review.css +0 -46
- package/dist/showcase/preview-frame.ads.review.d.mts +0 -11
- package/dist/showcase/preview-frame.ads.review.mjs +0 -22
- package/dist/showcase/preview-state.js +0 -11
- package/dist/showcase/refresh-scheduler.js +0 -23
- package/dist/showcase/resource-reader.js +0 -37
- package/dist/showcase-coverage.mjs +0 -139
- package/dist/source-symbols.mjs +0 -4
- package/dist/spatial-composition.mjs +0 -322
- package/dist/spatial-contexts.cjs +0 -56
- package/dist/spatial-css.cjs +0 -351
- package/dist/spatial-inputs.cjs +0 -80
- package/dist/spatial-model.cjs +0 -322
- package/dist/spatial.mjs +0 -21
- package/dist/stage-timing.cjs +0 -21
- package/dist/starters/preact/design-system/patterns/Conversation/Conversation.tsx +0 -105
- package/dist/starters/preact/design-system/patterns/Shell/Shell.tsx +0 -275
- package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.ads.review.tsx +0 -7
- package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +0 -10
- package/dist/starters/preact/design-system/showcase/mcp/main.ads.mount.tsx +0 -8
- package/dist/starters/preact/ds.config.json +0 -37
- package/dist/starters/preact/package.json +0 -35
- package/dist/starters/preact/src/vite-env.d.ts +0 -7
- package/dist/starters/preact/tsconfig.json +0 -35
- package/dist/starters/preact/vite.config.ts +0 -23
- package/dist/starters/react/ADS.md +0 -286
- package/dist/starters/react/README.md +0 -184
- package/dist/starters/react/biome.css.json +0 -21
- package/dist/starters/react/design-system/assets/brand/README.md +0 -41
- package/dist/starters/react/design-system/assets/brand/app-icon.svg +0 -4
- package/dist/starters/react/design-system/assets/brand/logo.dark.svg +0 -6
- package/dist/starters/react/design-system/assets/brand/logo.svg +0 -6
- package/dist/starters/react/design-system/assets/glyphs/README.md +0 -15
- package/dist/starters/react/design-system/assets/glyphs/aliases.json +0 -1
- package/dist/starters/react/design-system/assets/glyphs/check.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/chevron-down.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/chevron-right.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/close.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/external-link.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/info.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/menu.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/plus.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/search.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/warning.svg +0 -1
- package/dist/starters/react/design-system/assets/pictograms/catalog.ads.json +0 -13
- package/dist/starters/react/design-system/assets/pictograms/journey.dark.svg +0 -7
- package/dist/starters/react/design-system/assets/pictograms/journey.svg +0 -7
- package/dist/starters/react/design-system/components/Actions/Button/Button.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/components/Actions/Button/Button.ads.fixture.ts +0 -1
- package/dist/starters/react/design-system/components/Actions/Button/Button.ads.scenario.tsx +0 -13
- package/dist/starters/react/design-system/components/Actions/Button/Button.tsx +0 -56
- package/dist/starters/react/design-system/components/Actions/Button/README.md +0 -12
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.fixture.ts +0 -9
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.scenario.tsx +0 -16
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.tsx +0 -60
- package/dist/starters/react/design-system/components/Actions/IconButton/README.md +0 -17
- package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.fixture.ts +0 -6
- package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.scenario.tsx +0 -16
- package/dist/starters/react/design-system/components/Content/Icon/Icon.tsx +0 -42
- package/dist/starters/react/design-system/components/Content/Icon/README.md +0 -17
- package/dist/starters/react/design-system/components/Content/Icon/glyphs.ts +0 -17
- package/dist/starters/react/design-system/components/Content/Image/Image.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/components/Content/Image/Image.ads.fixture.ts +0 -2
- package/dist/starters/react/design-system/components/Content/Image/Image.ads.scenario.tsx +0 -13
- package/dist/starters/react/design-system/components/Content/Image/Image.tsx +0 -51
- package/dist/starters/react/design-system/components/Content/Image/README.md +0 -20
- package/dist/starters/react/design-system/components/Content/Logo/Logo.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/components/Content/Logo/Logo.ads.fixture.ts +0 -1
- package/dist/starters/react/design-system/components/Content/Logo/Logo.ads.scenario.tsx +0 -12
- package/dist/starters/react/design-system/components/Content/Logo/Logo.tsx +0 -35
- package/dist/starters/react/design-system/components/Content/Logo/README.md +0 -12
- package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.fixture.ts +0 -1
- package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.scenario.tsx +0 -7
- package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.tsx +0 -26
- package/dist/starters/react/design-system/components/Forms/TextField/README.md +0 -14
- package/dist/starters/react/design-system/components/Forms/TextField/TextField.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/components/Forms/TextField/TextField.ads.fixture.ts +0 -6
- package/dist/starters/react/design-system/components/Forms/TextField/TextField.ads.scenario.tsx +0 -13
- package/dist/starters/react/design-system/components/Forms/TextField/TextField.tsx +0 -61
- package/dist/starters/react/design-system/composition/Search/SearchPage/README.md +0 -4
- package/dist/starters/react/design-system/composition/Search/SearchPage/SearchPage.ads.fixture.ts +0 -7
- package/dist/starters/react/design-system/composition/Search/SearchPage/SearchPage.ads.scenario.tsx +0 -16
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/README.md +0 -5
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.fixture.ts +0 -13
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.scenario.tsx +0 -22
- package/dist/starters/react/design-system/controllers/Palette/Palette.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/controllers/Palette/Palette.ts +0 -164
- package/dist/starters/react/design-system/index.ts +0 -12
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.fixture.ts +0 -7
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.scenario.tsx +0 -15
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.tsx +0 -105
- package/dist/starters/react/design-system/patterns/Conversation/README.md +0 -9
- package/dist/starters/react/design-system/patterns/Search/SearchBar/README.md +0 -12
- package/dist/starters/react/design-system/patterns/Search/SearchBar/SearchBar.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/patterns/Search/SearchBar/SearchBar.ads.fixture.ts +0 -1
- package/dist/starters/react/design-system/patterns/Search/SearchBar/SearchBar.ads.scenario.tsx +0 -11
- package/dist/starters/react/design-system/patterns/Search/SearchBar/SearchBar.tsx +0 -41
- package/dist/starters/react/design-system/patterns/Shell/Floating.ads.fixture.ts +0 -5
- package/dist/starters/react/design-system/patterns/Shell/Floating.ads.scenario.tsx +0 -21
- package/dist/starters/react/design-system/patterns/Shell/README.md +0 -43
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.fixture.ts +0 -5
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.scenario.tsx +0 -21
- package/dist/starters/react/design-system/patterns/Shell/Shell.tsx +0 -274
- package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.review.tsx +0 -7
- package/dist/starters/react/design-system/review/index.ads.review.ts +0 -4
- package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.review.tsx +0 -6
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +0 -10
- package/dist/starters/react/design-system/showcase/mcp/main.ads.mount.tsx +0 -10
- package/dist/starters/react/design-system/styles.css +0 -7
- package/dist/starters/react/design-system/tokens/base.css +0 -36
- package/dist/starters/react/design-system/tokens/catalog.ads.json +0 -1221
- package/dist/starters/react/design-system/tokens/colors.css +0 -215
- package/dist/starters/react/design-system/tokens/elevation.css +0 -53
- package/dist/starters/react/design-system/tokens/spacing.css +0 -87
- package/dist/starters/react/design-system/tokens/spatial.ads.json +0 -70
- package/dist/starters/react/design-system/tokens/themes.generated.css +0 -142
- package/dist/starters/react/design-system/tokens/themes.generated.ts +0 -402
- package/dist/starters/react/design-system/tokens/typography.css +0 -31
- package/dist/starters/react/ds.config.json +0 -37
- package/dist/starters/react/gitignore.template +0 -8
- package/dist/starters/react/package.json +0 -39
- package/dist/starters/react/scripts/build-mcp-previews.mjs +0 -3
- package/dist/starters/react/src/vite-env.d.ts +0 -7
- package/dist/starters/react/tsconfig.build.json +0 -20
- package/dist/starters/react/tsconfig.json +0 -34
- package/dist/starters/react/vite.config.ts +0 -23
- package/dist/style-boundaries.mjs +0 -106
- package/dist/style-token-rules.mjs +0 -51
- package/dist/themes-generated.mjs +0 -161
- package/dist/themes-watch.mjs +0 -83
- package/dist/themes.mjs +0 -360
- package/dist/token-export.mjs +0 -94
- package/dist/token-origins.mjs +0 -24
- package/dist/token-policy.mjs +0 -26
- package/dist/token-quality.mjs +0 -149
- package/dist/token-samples.mjs +0 -19
- package/dist/tokens.mjs +0 -194
- package/dist/unit-contracts.mjs +0 -396
- package/dist/usage.mjs +0 -184
- package/dist/verification/playwright-reporter.cjs +0 -87
- package/docs/CONTRACTS.md +0 -285
- package/docs/HTTP-SHOWCASE-POC.md +0 -397
- package/docs/SPATIAL-CHECKS.md +0 -69
- package/docs/benchmarks/http-showcase-optimized.json +0 -1879
- package/docs/benchmarks/http-showcase-profile.json +0 -308
- package/docs/benchmarks/http-showcase.json +0 -3069
- /package/dist/{starters/react/design-system/assets/fonts/.gitkeep → analysis/semantic.mjs} +0 -0
- /package/dist/{starters/react/design-system/controllers/.gitkeep → lowering-model.mjs} +0 -0
- /package/dist/showcase/{favicon.svg → ui/favicon-scavmehf.svg} +0 -0
package/dist/render-audit.mjs
CHANGED
|
@@ -1,90 +1,47 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { analyze } from "./analysis/service.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
|
+
import { adsPlaywright, browserInstallCommand, ensureBrowser } from "./browser-runtime.mjs";
|
|
4
5
|
import { existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
|
5
6
|
import path from "node:path";
|
|
6
7
|
import { fileURLToPath } from "node:url";
|
|
7
8
|
import { loadConfig } from "./config.mjs";
|
|
8
|
-
|
|
9
|
-
import { executeDevelopmentCommand } from "./verification.mjs";
|
|
9
|
+
import { designContextsOrThrow } from "./design-contexts.mjs";
|
|
10
|
+
import { executeDevelopmentCommand, affectedScenarios } from "./verification.mjs";
|
|
10
11
|
import { findingSeverity, routeFindings } from "./finding-rules.mjs";
|
|
11
|
-
import {
|
|
12
|
+
import { discoverScenarioRegistry, parseScenarioRegistry } from "./scenario-registry.mjs";
|
|
12
13
|
import { inspectUnits } from "./units.mjs";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
// Render audit: axe-core (Deque, MPL-2.0, an unmodified ADS dependency
|
|
18
|
-
// injected at run time, never bundled) runs inside each rendered scenario document, once per
|
|
19
|
-
// declared brand and theme, followed by ADS's own non-text contrast check (WCAG 1.4.11),
|
|
20
|
-
// which axe does not cover, and its layout-overflow check, which resizes the same page. Only the scenario's #root is audited; the preview status chrome is excluded.
|
|
21
|
-
// Findings are errors: they fail `ads audit`, ads_validate (which audits everything its change set
|
|
22
|
-
// reaches) and draft acceptance (the draft owners' scenarios, unless acceptance.audit is false).
|
|
23
|
-
// Automated rules catch a subset of WCAG failures; passing proves nothing more.
|
|
24
|
-
|
|
25
|
-
export const AUDIT_RULE = "a11y-axe";
|
|
26
|
-
/** What axe could not decide on its own, such as contrast over a gradient: to check by hand. */
|
|
27
|
-
export const INCOMPLETE_RULE = "a11y-incomplete";
|
|
28
|
-
/** ADS's own rendered check: WCAG 1.4.11 non-text contrast of control boundaries and icons (axe does not check it). */
|
|
29
|
-
export const NON_TEXT_RULE = "a11y-non-text-contrast";
|
|
30
|
-
/** ADS's own rendered layout check: horizontal overflow at each of overflowWidths. */
|
|
31
|
-
export const OVERFLOW_RULE = "layout-overflow";
|
|
32
|
-
export const NARROW_RULE = "layout-overflow-narrow";
|
|
33
|
-
/** ADS's own rendered check: a scenario's layout shift above the Core Web Vitals 0.1 threshold. */
|
|
34
|
-
export const SHIFT_RULE = "layout-shift";
|
|
14
|
+
import { notAvailable } from "./availability.mjs";
|
|
15
|
+
import { reportedDeclarations } from "./accessibility-declarations.mjs";
|
|
16
|
+
import { isRecord } from "./unknown.mjs";
|
|
17
|
+
export const AUDIT_RULE = "a11y-axe", INCOMPLETE_RULE = "a11y-incomplete", NON_TEXT_RULE = "a11y-non-text-contrast", DECLARED_BOUNDARY_RULE = "a11y-boundary-declared", OVERFLOW_RULE = "layout-overflow", NARROW_RULE = "layout-overflow-narrow", TEXT_SCALE_RULE = "a11y-text-scale", TEXT_SPACING_RULE = "a11y-text-spacing-override", REFLOW_RULE = "a11y-reflow", textWidths = Object.freeze({ reflow: 320, zoom: 640 }), SHIFT_RULE = "layout-shift";
|
|
35
18
|
const shiftLimit = 0.1;
|
|
36
|
-
/** WCAG A/AA rule tags. Best-practice and page-level rules (landmarks, one h1) don't fit isolated scenarios. */
|
|
37
19
|
export const auditTags = Object.freeze(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa"]);
|
|
38
20
|
const viewport = { width: 1280, height: 800 };
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
* a whole screen, and is never hosted in one. */
|
|
45
|
-
export const containerWidth = 240;
|
|
46
|
-
export const containerKinds = Object.freeze(["components", "patterns"]);
|
|
47
|
-
/** Attempts for one render, against a dropped preview connection or a slow preview. */
|
|
48
|
-
export const auditAttempts = 3;
|
|
49
|
-
/** overlays and controls bound what each render opens and hovers: distinct ones, in document order. */
|
|
50
|
-
const limits = { scenarios: 500, nodes: 5, findings: 2000, reportBytes: 8 * 1024 * 1024, overlays: 3, controls: 6, contentQuietMs: 500, contentLimitMs: 5000 };
|
|
51
|
-
|
|
52
|
-
/** WCAG success criteria named by axe tags such as wcag143 or wcag1412. */
|
|
21
|
+
export const overflowWidths = Object.freeze([390, 768, 1280]), auditedKinds = Object.freeze(["components", "patterns"]), containerWidth = 240, containerKinds = Object.freeze(["components", "patterns"]), auditAttempts = 3;
|
|
22
|
+
const limits = { scenarios: 500, nodes: 5, findings: 2000, reportBytes: 8388608, overlays: 3, controls: 6, contentQuietMs: 500, contentLimitMs: 5000 }, fileMap = (scenarios) => new Map(scenarios.map((scenario) => [scenario.id, scenario.file])), addOnce = (list, value) => {
|
|
23
|
+
if (value !== void 0 && !list.includes(value))
|
|
24
|
+
list.push(value);
|
|
25
|
+
}, where = (themes, brands) => `[${themes.join(", ")}${brands.length ? `; ${brands.join(", ")}` : ""}]`;
|
|
53
26
|
export function wcagCriteria(tags) {
|
|
54
27
|
return [
|
|
55
|
-
...new Set(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
.map(([, a, b, c]) => `${a}.${b}.${c}`),
|
|
60
|
-
),
|
|
28
|
+
...new Set(tags.flatMap((tag) => {
|
|
29
|
+
const match = tag.match(/^wcag(\d)(\d)(\d{1,2})$/);
|
|
30
|
+
return match ? [`${match[1]}.${match[2]}.${match[3]}`] : [];
|
|
31
|
+
}))
|
|
61
32
|
];
|
|
62
33
|
}
|
|
63
|
-
|
|
64
|
-
/** Collapse per-brand, per-theme axe violations into ADS errors: one per scenario, rule and failing element set. */
|
|
65
34
|
export function auditFindings(runs, scenarios) {
|
|
66
|
-
const files =
|
|
67
|
-
groups = new Map();
|
|
68
|
-
const add = (list, value) => {
|
|
69
|
-
if (value !== undefined && !list.includes(value)) list.push(value);
|
|
70
|
-
};
|
|
35
|
+
const files = fileMap(scenarios), groups = new Map;
|
|
71
36
|
for (const run of runs)
|
|
72
|
-
for (const violation of run.violations) {
|
|
73
|
-
const selectors = violation.nodes.map((node) => node.selector);
|
|
74
|
-
const key = JSON.stringify([run.scenario, violation.id, [...selectors].sort()]);
|
|
75
|
-
const group = groups.get(key) ?? { scenario: run.scenario, themes: [], brands: [], violation };
|
|
37
|
+
for (const violation of run.violations ?? []) {
|
|
38
|
+
const selectors = violation.nodes.map((node) => node.selector), key = JSON.stringify([run.scenario, violation.id, [...selectors].sort()]), group = groups.get(key) ?? { scenario: run.scenario, themes: [], brands: [], violation };
|
|
76
39
|
groups.set(key, group);
|
|
77
|
-
|
|
78
|
-
|
|
40
|
+
addOnce(group.themes, run.theme);
|
|
41
|
+
addOnce(group.brands, run.brand);
|
|
79
42
|
}
|
|
80
43
|
return [...groups.values()].slice(0, limits.findings).map(({ scenario, themes, brands, violation }) => {
|
|
81
|
-
const wcag = wcagCriteria(violation.tags),
|
|
82
|
-
contrast = violation.id === "color-contrast";
|
|
83
|
-
const where =
|
|
84
|
-
violation.nodes
|
|
85
|
-
.map((node) => node.selector)
|
|
86
|
-
.slice(0, 3)
|
|
87
|
-
.join(", ") + (violation.nodeCount > 3 ? ` and ${violation.nodeCount - 3} more` : "");
|
|
44
|
+
const wcag = wcagCriteria(violation.tags), contrast = violation.id === "color-contrast", elements = violation.nodes.map((node) => node.selector).slice(0, 3).join(", ") + (violation.nodeCount > 3 ? ` and ${violation.nodeCount - 3} more` : "");
|
|
88
45
|
return {
|
|
89
46
|
rule: AUDIT_RULE,
|
|
90
47
|
severity: findingSeverity(AUDIT_RULE),
|
|
@@ -98,38 +55,27 @@ export function auditFindings(runs, scenarios) {
|
|
|
98
55
|
tags: violation.tags,
|
|
99
56
|
scenario,
|
|
100
57
|
themes,
|
|
101
|
-
...
|
|
58
|
+
...brands.length ? { brands } : {},
|
|
102
59
|
nodes: violation.nodes,
|
|
103
60
|
nodeCount: violation.nodeCount,
|
|
104
61
|
helpUrl: violation.helpUrl,
|
|
105
62
|
guidanceUri: "ads://guides/accessibility",
|
|
106
|
-
...
|
|
107
|
-
message: `${contrast ? "Rendered contrast (render audit;
|
|
63
|
+
...contrast ? { overlaps: ["surface-contrast", "component-contrast"] } : {},
|
|
64
|
+
message: `${contrast ? "Rendered contrast (render audit; surface-contrast checks surface profiles' paint pairs and component-contrast composed pairs statically): " : ""}axe ${violation.id}${violation.impact ? ` (${violation.impact})` : ""}${wcag.length ? `, WCAG ${wcag.join("/")}` : ""} in ${scenario} ${where(themes, brands)}: ${violation.help}. ${violation.nodeCount} element${violation.nodeCount === 1 ? "" : "s"}: ${elements}. ${violation.helpUrl}`
|
|
108
65
|
};
|
|
109
66
|
});
|
|
110
67
|
}
|
|
111
|
-
|
|
112
|
-
/** One info item per scenario, axe rule and element set, across brands and themes. */
|
|
113
68
|
export function incompleteFindings(runs, scenarios) {
|
|
114
|
-
const files =
|
|
115
|
-
groups = new Map();
|
|
116
|
-
const add = (list, value) => {
|
|
117
|
-
if (value !== undefined && !list.includes(value)) list.push(value);
|
|
118
|
-
};
|
|
69
|
+
const files = fileMap(scenarios), groups = new Map;
|
|
119
70
|
for (const run of runs)
|
|
120
71
|
for (const item of run.incomplete ?? []) {
|
|
121
|
-
const key = JSON.stringify([run.scenario, item.id, item.nodes.map((node) => node.selector).sort()]);
|
|
122
|
-
const group = groups.get(key) ?? { scenario: run.scenario, themes: [], brands: [], item };
|
|
72
|
+
const key = JSON.stringify([run.scenario, item.id, item.nodes.map((node) => node.selector).sort()]), group = groups.get(key) ?? { scenario: run.scenario, themes: [], brands: [], item };
|
|
123
73
|
groups.set(key, group);
|
|
124
|
-
|
|
125
|
-
|
|
74
|
+
addOnce(group.themes, run.theme);
|
|
75
|
+
addOnce(group.brands, run.brand);
|
|
126
76
|
}
|
|
127
77
|
return [...groups.values()].slice(0, limits.findings).map(({ scenario, themes, brands, item }) => {
|
|
128
|
-
const
|
|
129
|
-
item.nodes
|
|
130
|
-
.slice(0, 3)
|
|
131
|
-
.map((node) => `${node.selector}${node.reason ? ` (${node.reason})` : ""}`)
|
|
132
|
-
.join(", ") + (item.nodeCount > 3 ? ` and ${item.nodeCount - 3} more` : "");
|
|
78
|
+
const elements = item.nodes.slice(0, 3).map((node) => `${node.selector}${node.reason ? ` (${node.reason})` : ""}`).join(", ") + (item.nodeCount > 3 ? ` and ${item.nodeCount - 3} more` : "");
|
|
133
79
|
return {
|
|
134
80
|
rule: INCOMPLETE_RULE,
|
|
135
81
|
severity: findingSeverity(INCOMPLETE_RULE),
|
|
@@ -141,66 +87,96 @@ export function incompleteFindings(runs, scenarios) {
|
|
|
141
87
|
impact: item.impact ?? null,
|
|
142
88
|
scenario,
|
|
143
89
|
themes,
|
|
144
|
-
...
|
|
90
|
+
...brands.length ? { brands } : {},
|
|
145
91
|
nodes: item.nodes,
|
|
146
92
|
nodeCount: item.nodeCount,
|
|
147
93
|
helpUrl: item.helpUrl,
|
|
148
94
|
guidanceUri: "ads://guides/accessibility",
|
|
149
|
-
message: `axe could not decide ${item.id} in ${scenario}
|
|
95
|
+
message: `axe could not decide ${item.id} in ${scenario} ${where(themes, brands)}: check it by hand. ${item.help}. ${item.nodeCount} element${item.nodeCount === 1 ? "" : "s"}: ${elements}. ${item.helpUrl}`
|
|
150
96
|
};
|
|
151
97
|
});
|
|
152
98
|
}
|
|
153
|
-
|
|
154
99
|
const nonTextKinds = {
|
|
155
100
|
border: {
|
|
156
|
-
what: (count) =>
|
|
101
|
+
what: (count) => count === 1 ? "control's border is its only boundary and has" : "controls' borders are their only boundary and have",
|
|
157
102
|
against: "the background around it",
|
|
158
|
-
fix: "Give the boundary a border token with 3:1 against the surface it sits on, such as --border-strong, or a background with 3:1 against it."
|
|
103
|
+
fix: "Give the boundary a border token with 3:1 against the surface it sits on, such as --border-strong, or a background with 3:1 against it."
|
|
159
104
|
},
|
|
160
105
|
icon: {
|
|
161
|
-
what: (count) =>
|
|
106
|
+
what: (count) => count === 1 ? "icon-only control's icon has" : "icon-only controls' icons have",
|
|
162
107
|
against: "its control's background",
|
|
163
|
-
fix: "Paint the icon with a text or foreground token that has 3:1 against the control's background."
|
|
108
|
+
fix: "Paint the icon with a text or foreground token that has 3:1 against the control's background."
|
|
164
109
|
},
|
|
165
110
|
focus: {
|
|
166
|
-
what: (count) =>
|
|
111
|
+
what: (count) => count === 1 ? "control's focus outline has" : "controls' focus outlines have",
|
|
167
112
|
against: "the background around it",
|
|
168
|
-
fix: "Paint the focus outline with --border-focus or a token with 3:1 against the surface it sits on."
|
|
169
|
-
}
|
|
113
|
+
fix: "Paint the focus outline with --border-focus or a token with 3:1 against the surface it sits on."
|
|
114
|
+
}
|
|
170
115
|
};
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
116
|
+
export const declaredControls = (report) => reportedDeclarations(report).map(({ file, selector, boundary }) => ({ file, selector, boundary }));
|
|
117
|
+
export function declaredBoundaryFindings(runs, scenarios, root) {
|
|
118
|
+
const files = fileMap(scenarios), groups = new Map;
|
|
119
|
+
for (const run of runs)
|
|
120
|
+
for (const hit of run.nonText?.declared ?? []) {
|
|
121
|
+
const key = JSON.stringify([run.scenario, hit.file, hit.part, hit.selector]), group = groups.get(key) ?? { scenario: run.scenario, hit, themes: [], brands: [], ratio: hit.ratio, evidence: [], unlabelled: [] };
|
|
122
|
+
groups.set(key, group);
|
|
123
|
+
addOnce(group.themes, run.theme);
|
|
124
|
+
addOnce(group.brands, run.brand);
|
|
125
|
+
group.ratio = Math.min(group.ratio, hit.ratio);
|
|
126
|
+
for (const file of hit.evidence ?? [])
|
|
127
|
+
group.evidence.push(path.relative(root, file).split(path.sep).join("/"));
|
|
128
|
+
if (hit.labelled === !1)
|
|
129
|
+
addOnce(group.unlabelled, `${run.theme}${run.brand ? `/${run.brand}` : ""}`);
|
|
130
|
+
}
|
|
131
|
+
return [...groups.values()].slice(0, limits.findings).flatMap(({ scenario, hit, themes, brands, ratio, evidence, unlabelled }) => {
|
|
132
|
+
const common = { file: files.get(scenario) ?? scenario, line: 1, column: 1, source: "ads", scenario, themes, ...brands.length ? { brands } : {}, ratio, guidanceUri: "ads://guides/accessibility" }, kind = hit.boundary === "visible-label" ? "its visible label" : "a boundary shown on hover and focus", listed = {
|
|
133
|
+
...common,
|
|
134
|
+
rule: DECLARED_BOUNDARY_RULE,
|
|
135
|
+
severity: findingSeverity(DECLARED_BOUNDARY_RULE),
|
|
136
|
+
kind: "declared",
|
|
137
|
+
wcag: ["1.4.11"],
|
|
138
|
+
nodes: [{ selector: hit.selector, ratio, owner: hit.file, part: hit.part, boundary: hit.boundary }],
|
|
139
|
+
nodeCount: 1,
|
|
140
|
+
...evidence.length ? { evidence } : {},
|
|
141
|
+
message: `Declared boundary in ${scenario} ${where(themes, brands)}: ${hit.selector} (${hit.part} of ${hit.file}) has a boundary below 3:1 (${ratio.toFixed(2)}:1) and is declared identified by ${kind}. A person approved this; check the screenshots${evidence.length ? ` (${evidence.length} files under .ds/audit-evidence)` : ""} still match the reason.`
|
|
142
|
+
};
|
|
143
|
+
if (!unlabelled.length)
|
|
144
|
+
return [listed];
|
|
145
|
+
return [
|
|
146
|
+
listed,
|
|
147
|
+
{
|
|
148
|
+
...common,
|
|
149
|
+
rule: NON_TEXT_RULE,
|
|
150
|
+
severity: findingSeverity(NON_TEXT_RULE),
|
|
151
|
+
kind: "declaration-unmet",
|
|
152
|
+
wcag: ["1.4.11", "1.3.1"],
|
|
153
|
+
nodes: [{ selector: hit.selector, ratio, owner: hit.file, part: hit.part, boundary: hit.boundary }],
|
|
154
|
+
nodeCount: 1,
|
|
155
|
+
message: `Declared boundary not met in ${scenario} [${unlabelled.join(", ")}]: ${hit.selector} (${hit.part} of ${hit.file}) declares "visible-label" but has no rendered, associated label (<label for>, a wrapping <label> or aria-labelledby to visible text). Show its label, or remove the declaration and give the field a 3:1 boundary.`
|
|
156
|
+
}
|
|
157
|
+
];
|
|
158
|
+
});
|
|
159
|
+
}
|
|
174
160
|
export function nonTextContrastFindings(runs, scenarios) {
|
|
175
|
-
const files =
|
|
176
|
-
groups = new Map();
|
|
177
|
-
const add = (list, value) => {
|
|
178
|
-
if (value !== undefined && !list.includes(value)) list.push(value);
|
|
179
|
-
};
|
|
161
|
+
const files = fileMap(scenarios), groups = new Map;
|
|
180
162
|
for (const run of runs)
|
|
181
163
|
for (const kind of Object.keys(nonTextKinds)) {
|
|
182
164
|
const issues = (run.nonText?.issues ?? []).filter((issue) => issue.kind === kind);
|
|
183
|
-
if (!issues.length)
|
|
184
|
-
|
|
185
|
-
const group = groups.get(key) ?? { scenario: run.scenario, kind, themes: [], brands: [], nodes: new Map
|
|
165
|
+
if (!issues.length)
|
|
166
|
+
continue;
|
|
167
|
+
const key = JSON.stringify([run.scenario, kind, issues.map((issue) => issue.selector).sort()]), group = groups.get(key) ?? { scenario: run.scenario, kind, themes: [], brands: [], nodes: new Map, nodeCount: 0 };
|
|
186
168
|
groups.set(key, group);
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
group.nodeCount = Math.max(group.nodeCount, run.nonText
|
|
169
|
+
addOnce(group.themes, run.theme);
|
|
170
|
+
addOnce(group.brands, run.brand);
|
|
171
|
+
group.nodeCount = Math.max(group.nodeCount, run.nonText?.counts[kind] ?? issues.length);
|
|
190
172
|
for (const issue of issues) {
|
|
191
|
-
const previous = group.nodes.get(issue.selector);
|
|
192
|
-
if (!previous ||
|
|
193
|
-
group.nodes.set(issue.selector, { ...issue, theme: run.theme, ...
|
|
173
|
+
const ratio = issue.ratio ?? 0, previous = group.nodes.get(issue.selector);
|
|
174
|
+
if (!previous || ratio < previous.ratio)
|
|
175
|
+
group.nodes.set(issue.selector, { ...issue, ratio, theme: run.theme, ...run.brand ? { brand: run.brand } : {} });
|
|
194
176
|
}
|
|
195
177
|
}
|
|
196
178
|
return [...groups.values()].slice(0, limits.findings).map(({ scenario, kind, themes, brands, nodes, nodeCount }) => {
|
|
197
|
-
const list = [...nodes.values()],
|
|
198
|
-
ratio = Math.min(...list.map((node) => node.ratio));
|
|
199
|
-
const where =
|
|
200
|
-
list
|
|
201
|
-
.slice(0, 3)
|
|
202
|
-
.map((node) => `${node.selector} (${node.ratio.toFixed(2)}:1, ${node.foreground} on ${node.background})`)
|
|
203
|
-
.join(", ") + (nodeCount > 3 ? ` and ${nodeCount - 3} more` : "");
|
|
179
|
+
const list = [...nodes.values()], ratio = Math.min(...list.map((node) => node.ratio)), elements = list.slice(0, 3).map((node) => `${node.selector} (${node.ratio.toFixed(2)}:1, ${node.foreground} on ${node.background})`).join(", ") + (nodeCount > 3 ? ` and ${nodeCount - 3} more` : "");
|
|
204
180
|
return {
|
|
205
181
|
rule: NON_TEXT_RULE,
|
|
206
182
|
severity: findingSeverity(NON_TEXT_RULE),
|
|
@@ -212,16 +188,15 @@ export function nonTextContrastFindings(runs, scenarios) {
|
|
|
212
188
|
wcag: ["1.4.11"],
|
|
213
189
|
scenario,
|
|
214
190
|
themes,
|
|
215
|
-
...
|
|
191
|
+
...brands.length ? { brands } : {},
|
|
216
192
|
ratio,
|
|
217
193
|
nodes: list,
|
|
218
194
|
nodeCount,
|
|
219
195
|
guidanceUri: "ads://guides/accessibility",
|
|
220
|
-
message: `Non-text contrast (WCAG 1.4.11) in ${scenario}
|
|
196
|
+
message: `Non-text contrast (WCAG 1.4.11) in ${scenario} ${where(themes, brands)}: ${nodeCount} ${nonTextKinds[kind].what(nodeCount)} less than 3:1 against ${nonTextKinds[kind].against}: ${elements}. ${nonTextKinds[kind].fix}`
|
|
221
197
|
};
|
|
222
198
|
});
|
|
223
199
|
}
|
|
224
|
-
|
|
225
200
|
const skipReasons = {
|
|
226
201
|
"overlay-did-not-open": "a control with aria-haspopup opened nothing with a dialog, menu or listbox role",
|
|
227
202
|
"overlay-trigger-gone": "a trigger left the page before its turn",
|
|
@@ -236,92 +211,135 @@ const skipReasons = {
|
|
|
236
211
|
"control-failed": "measuring a control failed",
|
|
237
212
|
"control-cap": "the limit of 6 controls per render was reached and no other scenario has them",
|
|
238
213
|
"content-still-changing": "the page kept changing past 5 s, so what it measured may be mid-change",
|
|
239
|
-
"focus-not-reachable": "a control a keyboard cannot reach (aria-hidden, inert, or tabindex -1 outside a roving widget): hover measured, focus not"
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
const overflowKinds = {
|
|
214
|
+
"focus-not-reachable": "a control a keyboard cannot reach (aria-hidden, inert, or tabindex -1 outside a roving widget): hover measured, focus not"
|
|
215
|
+
}, overflowKinds = {
|
|
243
216
|
document: {
|
|
244
217
|
what: "the page scrolls horizontally",
|
|
245
|
-
fix: "Find the element wider than its container; use fluid widths, min-width: 0 on flex and grid children, and let long text wrap."
|
|
218
|
+
fix: "Find the element wider than its container; use fluid widths, min-width: 0 on flex and grid children, and let long text wrap."
|
|
246
219
|
},
|
|
247
220
|
viewport: {
|
|
248
221
|
what: "content reaches past the viewport",
|
|
249
|
-
fix: "Make the element fluid (%, fr, a
|
|
222
|
+
fix: "Make the element fluid (%, fr, or a span of its owner's grid tracks instead of a fixed width; a container-context grid where it must follow its region), wrap it, or put it in an overflow-x: auto scroller."
|
|
250
223
|
},
|
|
251
224
|
container: {
|
|
252
225
|
what: "content reaches past its container",
|
|
253
|
-
fix: "Make the element fluid (%, fr, min(100%, ...)), wrap it, or put it in an overflow-x: auto scroller.
|
|
226
|
+
fix: "Make the element fluid (%, fr, min(100%, ...)), wrap it, or put it in an overflow-x: auto scroller."
|
|
254
227
|
},
|
|
255
228
|
clipped: {
|
|
256
|
-
what: "
|
|
257
|
-
fix: "Make the content fit, truncate it with text-overflow: ellipsis, or use overflow-x: auto if it should scroll."
|
|
229
|
+
what: "text or a control is cut off by overflow hidden or clip (cropped images, artwork and decorative layers do not count)",
|
|
230
|
+
fix: "Make the content fit, truncate it with text-overflow: ellipsis, or use overflow-x: auto if it should scroll."
|
|
231
|
+
},
|
|
232
|
+
"block-clipped": {
|
|
233
|
+
what: "text or a control is cut off by overflow hidden or clip on the block axis",
|
|
234
|
+
fix: "Let the box grow with its text: drop the fixed block size or use min-block-size, or scroll it with overflow-y: auto."
|
|
235
|
+
},
|
|
236
|
+
spilled: {
|
|
237
|
+
what: "content spills past a box whose block size does not grow with its text",
|
|
238
|
+
fix: "Replace the fixed height or max-height with min-block-size, or size it in rem or lh so it follows the text."
|
|
258
239
|
},
|
|
240
|
+
overlap: {
|
|
241
|
+
what: "items overlap, grown past the track or line reserved for them",
|
|
242
|
+
fix: "Size the reserved track or row with auto, min-content or minmax(<size>, auto) instead of a fixed length, so it grows with its text."
|
|
243
|
+
},
|
|
244
|
+
"focus-clipped": {
|
|
245
|
+
what: "a control or its focus outline is cut off by a clipping ancestor",
|
|
246
|
+
fix: "Leave room for the outline (padding at least the focus width plus offset) or move overflow hidden off the control's ancestor; let the clipping box grow."
|
|
247
|
+
}
|
|
259
248
|
};
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
add(group.widths, width);
|
|
278
|
-
add(group.themes, run.theme);
|
|
279
|
-
add(group.brands, run.brand);
|
|
280
|
-
group.nodeCount = Math.max(group.nodeCount, counts[kind] ?? found.length);
|
|
281
|
-
for (const issue of found) if (!(group.nodes.get(issue.selector)?.overflow >= issue.overflow)) group.nodes.set(issue.selector, { ...issue, width });
|
|
249
|
+
function groupLayout(entries) {
|
|
250
|
+
const groups = new Map;
|
|
251
|
+
for (const { run, tag, width, result } of entries)
|
|
252
|
+
for (const kind of Object.keys(overflowKinds)) {
|
|
253
|
+
const found = result.issues.filter((issue) => issue.kind === kind);
|
|
254
|
+
if (!found.length)
|
|
255
|
+
continue;
|
|
256
|
+
const key = JSON.stringify([run.scenario, tag, kind, found.map((issue) => issue.selector).sort()]), group = groups.get(key) ?? { scenario: run.scenario, tag, kind, widths: [], themes: [], brands: [], nodes: new Map, nodeCount: 0 };
|
|
257
|
+
groups.set(key, group);
|
|
258
|
+
addOnce(group.widths, width);
|
|
259
|
+
addOnce(group.themes, run.theme);
|
|
260
|
+
addOnce(group.brands, run.brand);
|
|
261
|
+
group.nodeCount = Math.max(group.nodeCount, result.counts[kind] ?? found.length);
|
|
262
|
+
for (const issue of found) {
|
|
263
|
+
const previous = group.nodes.get(issue.selector);
|
|
264
|
+
if (!(previous && previous.overflow >= issue.overflow))
|
|
265
|
+
group.nodes.set(issue.selector, { ...issue, width });
|
|
282
266
|
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
267
|
+
}
|
|
268
|
+
return [...groups.values()].slice(0, limits.findings);
|
|
269
|
+
}
|
|
270
|
+
const layoutElements = ({ nodes, nodeCount }) => [...nodes.values()].slice(0, 3).map((node) => `${node.selector} (${node.overflow}px at ${node.width}px${node.cut ? `, cutting ${node.cut.content === "text" ? "text" : "a control"} at ${node.cut.selector}` : ""})`).join(", ") + (nodeCount > 3 ? ` and ${nodeCount - 3} more` : "");
|
|
271
|
+
export function layoutOverflowFindings(runs, scenarios) {
|
|
272
|
+
const files = fileMap(scenarios), entries = runs.flatMap((run) => (run.layout ?? []).map(({ width, container = !1, issues = [], counts = {} }) => ({
|
|
273
|
+
run,
|
|
274
|
+
tag: container ? NARROW_RULE : OVERFLOW_RULE,
|
|
275
|
+
width,
|
|
276
|
+
result: { issues, counts }
|
|
277
|
+
})));
|
|
278
|
+
return groupLayout(entries).map((group) => {
|
|
279
|
+
const { scenario, tag: rule, kind, widths, themes, brands, nodes, nodeCount } = group, container = rule === NARROW_RULE, sorted = [...widths].sort((a, b) => a - b);
|
|
291
280
|
return {
|
|
292
|
-
rule
|
|
293
|
-
severity: findingSeverity(
|
|
281
|
+
rule,
|
|
282
|
+
severity: findingSeverity(rule),
|
|
294
283
|
file: files.get(scenario) ?? scenario,
|
|
295
284
|
line: 1,
|
|
296
285
|
column: 1,
|
|
297
286
|
source: "ads",
|
|
298
287
|
kind,
|
|
299
|
-
...
|
|
288
|
+
...container ? { container: sorted[0] } : { widths: sorted },
|
|
300
289
|
scenario,
|
|
301
290
|
themes,
|
|
302
|
-
...
|
|
303
|
-
nodes:
|
|
291
|
+
...brands.length ? { brands } : {},
|
|
292
|
+
nodes: [...nodes.values()],
|
|
304
293
|
nodeCount,
|
|
305
294
|
guidanceUri: "ads://guides/tokens",
|
|
306
|
-
message: `Layout overflow in ${scenario} ${container ? `in a ${sorted[0]} px container` : `at ${sorted.join(", ")} px wide`}
|
|
295
|
+
message: `Layout overflow in ${scenario} ${container ? `in a ${sorted[0]} px container` : `at ${sorted.join(", ")} px wide`} ${where(themes, brands)}: ${overflowKinds[kind].what}: ${layoutElements(group)}. ${overflowKinds[kind].fix}`
|
|
296
|
+
};
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
const textPasses = {
|
|
300
|
+
font: { rule: TEXT_SCALE_RULE, wcag: "1.4.4", title: "Text resize", setting: (width) => `with text at 200% at ${width} px wide` },
|
|
301
|
+
zoom: { rule: TEXT_SCALE_RULE, wcag: "1.4.4", title: "Zoom", setting: (width) => `zoomed to 200% (a ${width} px viewport)` },
|
|
302
|
+
spacing: {
|
|
303
|
+
rule: TEXT_SPACING_RULE,
|
|
304
|
+
wcag: "1.4.12",
|
|
305
|
+
title: "Text spacing",
|
|
306
|
+
setting: (width) => `with line height 1.5, letter spacing 0.12em, word spacing 0.16em and 2em after paragraphs at ${width} px wide`
|
|
307
|
+
},
|
|
308
|
+
reflow: { rule: REFLOW_RULE, wcag: "1.4.10", title: "Reflow", setting: (width) => `at ${width} px wide` }
|
|
309
|
+
};
|
|
310
|
+
export function textScaleFindings(runs, scenarios) {
|
|
311
|
+
const files = fileMap(scenarios), entries = runs.flatMap((run) => (run.textScale ?? []).map(({ pass, width, issues, counts }) => ({ run, tag: pass, width, result: { issues, counts } })));
|
|
312
|
+
return groupLayout(entries).map((group) => {
|
|
313
|
+
const { scenario, tag: pass, kind, widths, themes, brands, nodes, nodeCount } = group, { rule, wcag, title, setting } = textPasses[pass], sorted = [...widths].sort((a, b) => a - b);
|
|
314
|
+
return {
|
|
315
|
+
rule,
|
|
316
|
+
severity: findingSeverity(rule),
|
|
317
|
+
file: files.get(scenario) ?? scenario,
|
|
318
|
+
line: 1,
|
|
319
|
+
column: 1,
|
|
320
|
+
source: "ads",
|
|
321
|
+
pass,
|
|
322
|
+
kind,
|
|
323
|
+
wcag: [wcag],
|
|
324
|
+
widths: sorted,
|
|
325
|
+
scenario,
|
|
326
|
+
themes,
|
|
327
|
+
...brands.length ? { brands } : {},
|
|
328
|
+
nodes: [...nodes.values()],
|
|
329
|
+
nodeCount,
|
|
330
|
+
guidanceUri: "ads://guides/accessibility",
|
|
331
|
+
message: `${title} (WCAG ${wcag}) in ${scenario} ${setting(sorted.join(", "))} ${where(themes, brands)}: ${overflowKinds[kind].what}: ${layoutElements(group)}. ${overflowKinds[kind].fix}`
|
|
307
332
|
};
|
|
308
333
|
});
|
|
309
334
|
}
|
|
310
|
-
|
|
311
|
-
/** One error per scenario and image rendered at a shape other than the one it declares. */
|
|
312
335
|
export function imageShapeFindings(runs, scenarios) {
|
|
313
|
-
const files =
|
|
314
|
-
groups = new Map();
|
|
315
|
-
const add = (list, value) => {
|
|
316
|
-
if (value !== undefined && !list.includes(value)) list.push(value);
|
|
317
|
-
};
|
|
336
|
+
const files = fileMap(scenarios), groups = new Map;
|
|
318
337
|
for (const run of runs)
|
|
319
338
|
for (const issue of run.imageShape ?? []) {
|
|
320
|
-
const key = JSON.stringify([run.scenario, issue.selector]);
|
|
321
|
-
const group = groups.get(key) ?? { scenario: run.scenario, issue, themes: [], brands: [] };
|
|
339
|
+
const key = JSON.stringify([run.scenario, issue.selector]), group = groups.get(key) ?? { scenario: run.scenario, issue, themes: [], brands: [] };
|
|
322
340
|
groups.set(key, group);
|
|
323
|
-
|
|
324
|
-
|
|
341
|
+
addOnce(group.themes, run.theme);
|
|
342
|
+
addOnce(group.brands, run.brand);
|
|
325
343
|
}
|
|
326
344
|
return [...groups.values()].slice(0, limits.findings).map(({ scenario, issue, themes, brands }) => ({
|
|
327
345
|
rule: "img-shape",
|
|
@@ -332,62 +350,85 @@ export function imageShapeFindings(runs, scenarios) {
|
|
|
332
350
|
source: "ads",
|
|
333
351
|
scenario,
|
|
334
352
|
themes,
|
|
335
|
-
...
|
|
353
|
+
...brands.length ? { brands } : {},
|
|
336
354
|
nodes: [issue],
|
|
337
355
|
rendered: issue.rendered,
|
|
338
356
|
declared: issue.declared,
|
|
339
357
|
guidanceUri: "ads://guides/performance",
|
|
340
|
-
message: `Image shape in ${scenario}
|
|
358
|
+
message: `Image shape in ${scenario} ${where(themes, brands)}: ${issue.selector} renders at ${issue.rendered} at the ${issue.width} px viewport but declares ${issue.declared}, so it is cropped or stretched. A height attribute beats aspect-ratio: add height: auto. For a deliberate crop in a box of its own, set object-fit and no aspect-ratio.`
|
|
359
|
+
}));
|
|
360
|
+
}
|
|
361
|
+
export function cornerOverpaintFindings(runs, scenarios) {
|
|
362
|
+
const files = fileMap(scenarios), groups = new Map;
|
|
363
|
+
for (const run of runs)
|
|
364
|
+
for (const issue of run.corners ?? []) {
|
|
365
|
+
const key = JSON.stringify([run.scenario, issue.selector]), group = groups.get(key) ?? { scenario: run.scenario, issue, themes: [], brands: [] };
|
|
366
|
+
groups.set(key, group);
|
|
367
|
+
addOnce(group.themes, run.theme);
|
|
368
|
+
addOnce(group.brands, run.brand);
|
|
369
|
+
}
|
|
370
|
+
return [...groups.values()].slice(0, limits.findings).map(({ scenario, issue, themes, brands }) => ({
|
|
371
|
+
rule: "corner-overpainted",
|
|
372
|
+
severity: findingSeverity("corner-overpainted"),
|
|
373
|
+
file: files.get(scenario) ?? scenario,
|
|
374
|
+
line: 1,
|
|
375
|
+
column: 1,
|
|
376
|
+
source: "ads",
|
|
377
|
+
scenario,
|
|
378
|
+
themes,
|
|
379
|
+
...brands.length ? { brands } : {},
|
|
380
|
+
nodes: [issue],
|
|
381
|
+
guidanceUri: "ads://guides/recipes",
|
|
382
|
+
message: `Rounded corner in ${scenario} ${where(themes, brands)}: ${issue.selector} has a ${issue.radius} radius and visible overflow, and ${issue.painter} paints over its ${issue.corner} corner at the ${issue.width} px viewport. Clip the rounded element (overflow: "clip"), inset it, or round what it holds.`
|
|
341
383
|
}));
|
|
342
384
|
}
|
|
343
|
-
|
|
344
|
-
/** What a run measured, and what it skipped and why: per reason, with a few examples. An info finding
|
|
345
|
-
* for each reason, and a review item for a render assigned targets that measured none of them. */
|
|
346
385
|
export function auditCoverage(runs, capped, scenarios) {
|
|
347
|
-
const files = new Map(
|
|
348
|
-
reasons = new Map();
|
|
349
|
-
const claimedNow = new Set(runs.flatMap((run) => run.coverage?.claimed ?? []));
|
|
350
|
-
const note = (reason, example) => {
|
|
386
|
+
const files = fileMap(scenarios), reasons = new Map, claimedNow = new Set(runs.flatMap((run) => run.coverage?.claimed ?? [])), note = (reason, example) => {
|
|
351
387
|
const entry = reasons.get(reason) ?? { count: 0, examples: [] };
|
|
352
388
|
reasons.set(reason, entry);
|
|
353
389
|
entry.count++;
|
|
354
|
-
if (entry.examples.length < limits.nodes)
|
|
390
|
+
if (entry.examples.length < limits.nodes)
|
|
391
|
+
entry.examples.push(example);
|
|
355
392
|
};
|
|
356
393
|
for (const run of runs)
|
|
357
394
|
for (const { reason, name } of run.coverage?.skipped ?? [])
|
|
358
|
-
note(reason, { scenario: run.scenario, theme: run.theme, ...
|
|
359
|
-
for (const { claim, reason, ...example } of capped)
|
|
395
|
+
note(reason, { scenario: run.scenario, theme: run.theme, ...run.brand ? { brand: run.brand } : {}, name });
|
|
396
|
+
for (const { claim, reason, ...example } of capped)
|
|
397
|
+
if (!claimedNow.has(claim))
|
|
398
|
+
note(reason, example);
|
|
360
399
|
const coverage = {
|
|
361
400
|
renders: runs.length,
|
|
362
401
|
overlaysOpened: 0,
|
|
363
402
|
controlsMeasured: 0,
|
|
364
|
-
skipped: Object.fromEntries([...reasons].sort(([a], [b]) => a.localeCompare(b)))
|
|
365
|
-
};
|
|
366
|
-
const empty = [];
|
|
403
|
+
skipped: Object.fromEntries([...reasons].sort(([a], [b]) => a.localeCompare(b)))
|
|
404
|
+
}, empty = [];
|
|
367
405
|
for (const run of runs)
|
|
368
406
|
if (run.coverage) {
|
|
369
407
|
coverage.overlaysOpened += run.coverage.overlays;
|
|
370
408
|
coverage.controlsMeasured += run.coverage.controls;
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
if (failed && !run.coverage.overlays && !run.coverage.controls) empty.push(run);
|
|
409
|
+
if (run.coverage.skipped.filter((item) => /^(?:overlay|control)-(?:gone|timeout|detached|failed)$/.test(item.reason)).length && !run.coverage.overlays && !run.coverage.controls)
|
|
410
|
+
empty.push(run);
|
|
374
411
|
}
|
|
375
|
-
const findings = [...reasons].
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
412
|
+
const findings = [...reasons].flatMap(([reason, { count, examples }]) => {
|
|
413
|
+
const [first] = examples;
|
|
414
|
+
if (!first)
|
|
415
|
+
return [];
|
|
416
|
+
return [
|
|
417
|
+
{
|
|
418
|
+
rule: "render-audit-skipped",
|
|
419
|
+
severity: findingSeverity("render-audit-skipped"),
|
|
420
|
+
file: files.get(first.scenario) ?? first.scenario,
|
|
421
|
+
line: 1,
|
|
422
|
+
column: 1,
|
|
423
|
+
source: "ads",
|
|
424
|
+
reason,
|
|
425
|
+
count,
|
|
426
|
+
examples,
|
|
427
|
+
guidanceUri: "ads://guides/accessibility",
|
|
428
|
+
message: `The audit skipped ${count} target${count === 1 ? "" : "s"}: ${skipReasons[reason] ?? reason}. ${examples.slice(0, 3).map((item) => `"${item.name}" in ${item.scenario} [${item.theme}]`).join(", ")}${count > 3 ? ` and ${count - 3} more` : ""}.`
|
|
429
|
+
}
|
|
430
|
+
];
|
|
431
|
+
});
|
|
391
432
|
for (const run of empty)
|
|
392
433
|
findings.push({
|
|
393
434
|
rule: "render-audit-nothing-measured",
|
|
@@ -398,26 +439,23 @@ export function auditCoverage(runs, capped, scenarios) {
|
|
|
398
439
|
source: "ads",
|
|
399
440
|
scenario: run.scenario,
|
|
400
441
|
themes: [run.theme],
|
|
401
|
-
message: `Nothing the audit tried to open or hover in ${run.scenario} [${run.theme}] could be measured: ${[...new Set(run.coverage
|
|
442
|
+
message: `Nothing the audit tried to open or hover in ${run.scenario} [${run.theme}] could be measured: ${[...new Set((run.coverage?.skipped ?? []).map((item) => item.reason))].join(", ")}.`
|
|
402
443
|
});
|
|
403
444
|
return { coverage, findings };
|
|
404
445
|
}
|
|
405
|
-
|
|
406
|
-
/** One error per scenario above the threshold, with its worst score, themes, brands and elements. */
|
|
407
446
|
export function layoutShiftFindings(runs, scenarios) {
|
|
408
|
-
const files =
|
|
409
|
-
groups = new Map();
|
|
410
|
-
const add = (list, value) => {
|
|
411
|
-
if (value !== undefined && !list.includes(value)) list.push(value);
|
|
412
|
-
};
|
|
447
|
+
const files = fileMap(scenarios), groups = new Map;
|
|
413
448
|
for (const run of runs) {
|
|
414
|
-
|
|
449
|
+
const shift = run.layoutShift;
|
|
450
|
+
if (!shift || !(shift.value > shiftLimit))
|
|
451
|
+
continue;
|
|
415
452
|
const group = groups.get(run.scenario) ?? { scenario: run.scenario, themes: [], brands: [], value: 0, nodes: [] };
|
|
416
453
|
groups.set(run.scenario, group);
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
group.value = Math.max(group.value,
|
|
420
|
-
for (const node of
|
|
454
|
+
addOnce(group.themes, run.theme);
|
|
455
|
+
addOnce(group.brands, run.brand);
|
|
456
|
+
group.value = Math.max(group.value, shift.value);
|
|
457
|
+
for (const node of shift.nodes)
|
|
458
|
+
addOnce(group.nodes, node);
|
|
421
459
|
}
|
|
422
460
|
return [...groups.values()].slice(0, limits.findings).map(({ scenario, themes, brands, value, nodes }) => ({
|
|
423
461
|
rule: SHIFT_RULE,
|
|
@@ -429,50 +467,45 @@ export function layoutShiftFindings(runs, scenarios) {
|
|
|
429
467
|
scenario,
|
|
430
468
|
value,
|
|
431
469
|
themes,
|
|
432
|
-
...
|
|
470
|
+
...brands.length ? { brands } : {},
|
|
433
471
|
nodes: nodes.slice(0, limits.nodes).map((selector) => ({ selector })),
|
|
434
472
|
guidanceUri: "ads://guides/performance",
|
|
435
|
-
message: `Layout shift ${value} in ${scenario}
|
|
473
|
+
message: `Layout shift ${value} in ${scenario} ${where(themes, brands)}, above ${shiftLimit}${nodes.length ? `: ${nodes.slice(0, 3).join(", ")}` : ""}. Give images and media width and height, reserve space for late content, and load the fonts the first text uses early.`
|
|
436
474
|
}));
|
|
437
475
|
}
|
|
438
|
-
|
|
439
|
-
/**
|
|
440
|
-
* UI scenarios a candidate change can affect, for acceptance audits. Changes to configuration,
|
|
441
|
-
* foundation, tokens, assets or files outside every unit affect all rendering and select every UI
|
|
442
|
-
* scenario; so does a failure to trace imports. Public/review entry re-exports are bookkeeping
|
|
443
|
-
* for their own units and do not widen the selection.
|
|
444
|
-
*/
|
|
445
|
-
/** "owners": the changed owners' own scenarios. "affected": every scenario the change reaches. */
|
|
446
476
|
export async function auditScenarioSelection(options, changedFiles, { mode = "affected", owners = [], before } = {}) {
|
|
447
|
-
const scenarios = (await
|
|
448
|
-
const all = (reason) => ({ mode: "all", reason, scenarios: scenarios.map((scenario) => scenario.id) });
|
|
449
|
-
const inventory = await inspectUnits(options),
|
|
450
|
-
entries = [inventory.publicEntry, inventory.reviewEntry];
|
|
477
|
+
const scenarios = (await discoverScenarioRegistry(options)).scenarios.filter((scenario) => auditedKinds.includes(scenario.kind)), registered = scenarios.length, all = (reason) => ({ registered, mode: "all", reason, scenarios: scenarios.map((scenario) => scenario.id) }), inventory = await inspectUnits(options), entries = [inventory.publicEntry];
|
|
451
478
|
if (mode === "owners") {
|
|
452
|
-
const changed = new Set([
|
|
479
|
+
const changed = new Set([
|
|
480
|
+
...owners,
|
|
481
|
+
...changedFiles.map((file) => inventory.owner(inventory.relative(file))).filter((owner) => !!owner)
|
|
482
|
+
]);
|
|
453
483
|
return {
|
|
484
|
+
registered,
|
|
454
485
|
mode: "owners",
|
|
455
486
|
reason: "Owners' own scenarios; the validation stage audits everything they affect.",
|
|
456
|
-
scenarios: scenarios.filter((scenario) => changed.has(inventory.owner(inventory.relative(scenario.file)))).map((scenario) => scenario.id)
|
|
487
|
+
scenarios: scenarios.filter((scenario) => changed.has(inventory.owner(inventory.relative(scenario.file)))).map((scenario) => scenario.id)
|
|
457
488
|
};
|
|
458
489
|
}
|
|
459
|
-
const traced = changedFiles.filter((file) => !entries.includes(inventory.relative(file)))
|
|
460
|
-
const shared = traced.find((file) => {
|
|
490
|
+
const traced = changedFiles.filter((file) => !entries.includes(inventory.relative(file))), shared = traced.find((file) => {
|
|
461
491
|
const owner = inventory.owner(inventory.relative(file));
|
|
462
|
-
return
|
|
492
|
+
return owner === null || ["configuration", "foundation", "tokens"].includes(owner) || owner.startsWith("assets") || !inventory.units.some((unit) => unit.id === owner);
|
|
463
493
|
});
|
|
464
|
-
if (shared)
|
|
465
|
-
|
|
494
|
+
if (shared)
|
|
495
|
+
return all(`${shared} is shared configuration, foundation, token, asset or unowned input.`);
|
|
496
|
+
if (!before && traced.some((file) => !existsSync(path.resolve(options.root, file))))
|
|
497
|
+
return all("Deleted inputs have no previous dependency evidence.");
|
|
466
498
|
try {
|
|
467
|
-
return { mode: "affected", scenarios: await affectedScenarios(options, traced, scenarios, before) };
|
|
499
|
+
return { registered, mode: "affected", scenarios: await affectedScenarios(options, traced, scenarios, before) };
|
|
468
500
|
} catch (error) {
|
|
469
|
-
return all(`Affected scenario selection failed: ${error.message}`);
|
|
501
|
+
return all(`Affected scenario selection failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
470
502
|
}
|
|
471
503
|
}
|
|
472
|
-
|
|
473
|
-
/** Policy check entry and routed findings for one audit result. */
|
|
504
|
+
export const emptyAuditSelection = (selection) => selection.registered ? notAvailable("none-selected", "The change reaches no registered UI scenario.") : notAvailable("no-scenarios");
|
|
474
505
|
export function auditCheck(audit, extra = {}) {
|
|
475
506
|
const routed = routeFindings([], audit.findings);
|
|
507
|
+
if ("status" in audit)
|
|
508
|
+
return { routed, check: { name: "render-audit", skipped: !0, status: audit.status, reason: audit.reason, message: audit.message, scenarios: 0, ...extra } };
|
|
476
509
|
return {
|
|
477
510
|
routed,
|
|
478
511
|
check: {
|
|
@@ -481,149 +514,122 @@ export function auditCheck(audit, extra = {}) {
|
|
|
481
514
|
engine: audit.engine,
|
|
482
515
|
scenarios: audit.scenarios,
|
|
483
516
|
themes: audit.themes,
|
|
484
|
-
...
|
|
517
|
+
...audit.brands ? { brands: audit.brands } : {},
|
|
485
518
|
renders: audit.runs,
|
|
486
|
-
...
|
|
487
|
-
...
|
|
519
|
+
...audit.coverage ? { coverage: audit.coverage } : {},
|
|
520
|
+
...audit.retries ? { retries: audit.retries } : {},
|
|
488
521
|
errors: routed.diagnostics.length,
|
|
489
522
|
reviews: routed.advisories.filter((item) => item.severity === "review").length,
|
|
490
523
|
infos: routed.advisories.filter((item) => item.severity === "info").length,
|
|
491
524
|
elapsedMs: audit.elapsedMs,
|
|
492
|
-
...extra
|
|
493
|
-
}
|
|
525
|
+
...extra
|
|
526
|
+
}
|
|
494
527
|
};
|
|
495
528
|
}
|
|
496
|
-
|
|
497
|
-
function
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
529
|
+
const unavailable = (message) => Object.assign(Error(message), { code: "ADS_AUDIT_UNAVAILABLE" }), errorCode = (error) => isRecord(error) ? error.code : void 0, errorMessage = (error) => error instanceof Error ? error.message : String(error), renderKey = ({ scenario, theme, brand, state }) => JSON.stringify([scenario, theme, brand ?? null, state ?? null]);
|
|
530
|
+
export function findingsByState(runs, build) {
|
|
531
|
+
const states = [...new Set(runs.map((run) => run.state))];
|
|
532
|
+
if (states.every((state) => state === void 0))
|
|
533
|
+
return [...build(runs)];
|
|
534
|
+
const merged = new Map;
|
|
535
|
+
for (const state of states)
|
|
536
|
+
for (const finding of build(runs.filter((run) => run.state === state))) {
|
|
537
|
+
const key = JSON.stringify(finding), group = merged.get(key) ?? { finding, states: [] };
|
|
538
|
+
if (state !== void 0)
|
|
539
|
+
group.states.push(state);
|
|
540
|
+
merged.set(key, group);
|
|
504
541
|
}
|
|
505
|
-
}
|
|
506
|
-
return null;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
const installHint =
|
|
510
|
-
"`npm install -D @playwright/test` and `npx playwright install chromium` (Bun: `bun add -d @playwright/test` and `bunx playwright install chromium`)";
|
|
511
|
-
|
|
512
|
-
/** Whether the project can run the audit: project-local Playwright, as for captures. */
|
|
513
|
-
export const renderAuditAvailable = (root) => !!projectPlaywright(path.resolve(root));
|
|
514
|
-
|
|
515
|
-
/** Scenarios of an owner in layout.fixedWidthUnits float above the layout, and have no container to fit. */
|
|
516
|
-
async function floatingScenarios(options, scenarios) {
|
|
517
|
-
const globs = options.config.layout.fixedWidthUnits,
|
|
518
|
-
floating = globMatcher(globs);
|
|
519
|
-
if (!globs.length) return new Set();
|
|
520
|
-
const inventory = await inspectUnits(options);
|
|
521
|
-
return new Set(
|
|
522
|
-
scenarios
|
|
523
|
-
.filter((scenario) => {
|
|
524
|
-
const owner = inventory.owner(inventory.relative(scenario.file));
|
|
525
|
-
return owner && (floating(owner) || inventory.units.find((unit) => unit.id === owner)?.files.some(floating));
|
|
526
|
-
})
|
|
527
|
-
.map((scenario) => scenario.id),
|
|
528
|
-
);
|
|
542
|
+
return [...merged.values()].map(({ finding, states: found }) => found.length ? { ...finding, states: found, message: `${finding.message} State${found.length === 1 ? "" : "s"}: ${found.join(", ")}.` } : finding);
|
|
529
543
|
}
|
|
530
|
-
|
|
531
|
-
const renderKey = ({ scenario, theme, brand }) => JSON.stringify([scenario, theme, brand ?? null]);
|
|
532
544
|
const clipCause = (text) => String(text).replace(/\s+/g, " ").trim().slice(0, 500);
|
|
533
|
-
|
|
534
|
-
/** Warm scenarios, separating those that cannot build. A project that fails validation fails
|
|
535
|
-
* every scenario the same way, so it stops the audit as it always has; anything else is one
|
|
536
|
-
* scenario's trouble (a slow or dropped build) and comes back as its cause. */
|
|
537
545
|
async function warmScenariosApart(host, ids, signal) {
|
|
538
|
-
const unbuilt = new Map()
|
|
539
|
-
|
|
546
|
+
const unbuilt = new Map, projectWide = (error) => {
|
|
547
|
+
const build = isRecord(error) ? error.build : void 0, failure = isRecord(build) ? build.failure : void 0;
|
|
548
|
+
return signal.aborted || isRecord(failure) && (failure.scope === "project" || failure.phase === "validation");
|
|
549
|
+
};
|
|
540
550
|
try {
|
|
541
551
|
await host.warmScenarios?.(ids, signal);
|
|
542
552
|
return unbuilt;
|
|
543
553
|
} catch (error) {
|
|
544
|
-
if (projectWide(error))
|
|
554
|
+
if (projectWide(error))
|
|
555
|
+
throw error;
|
|
545
556
|
}
|
|
546
|
-
for (const id of ids)
|
|
557
|
+
for (const id of ids)
|
|
547
558
|
try {
|
|
548
559
|
await host.warmScenarios?.([id], signal);
|
|
549
560
|
} catch (error) {
|
|
550
|
-
if (projectWide(error))
|
|
551
|
-
|
|
561
|
+
if (projectWide(error))
|
|
562
|
+
throw error;
|
|
563
|
+
unbuilt.set(id, clipCause(errorMessage(error)));
|
|
552
564
|
}
|
|
553
|
-
}
|
|
554
565
|
return unbuilt;
|
|
555
566
|
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
567
|
+
const isAuditRun = (value) => isRecord(value) && typeof value.scenario === "string" && typeof value.theme === "string", isCapped = (value) => isRecord(value) && typeof value.claim === "string" && typeof value.reason === "string";
|
|
568
|
+
async function runAuditWorker({
|
|
569
|
+
root,
|
|
570
|
+
temporary,
|
|
571
|
+
playwright,
|
|
572
|
+
settings,
|
|
573
|
+
apps,
|
|
574
|
+
signal,
|
|
575
|
+
claimed,
|
|
576
|
+
pages,
|
|
577
|
+
declared,
|
|
578
|
+
evidence
|
|
579
|
+
}) {
|
|
580
|
+
const request = path.join(temporary, "request.json"), report = path.join(temporary, "report.json"), runId = randomUUID();
|
|
581
|
+
rmSync(report, { force: !0 });
|
|
582
|
+
writeFileSync(request, JSON.stringify({
|
|
583
|
+
schemaVersion: 1,
|
|
584
|
+
runId,
|
|
585
|
+
playwright,
|
|
586
|
+
axe: requireTool.resolve("axe-core/axe.min.js"),
|
|
587
|
+
settings,
|
|
588
|
+
viewport,
|
|
589
|
+
overflowWidths,
|
|
590
|
+
textWidths,
|
|
591
|
+
smallPart: 96,
|
|
592
|
+
overlayLimit: limits.overlays,
|
|
593
|
+
stateLimit: limits.controls,
|
|
594
|
+
contentQuietMs: limits.contentQuietMs,
|
|
595
|
+
contentLimitMs: limits.contentLimitMs,
|
|
596
|
+
claimed,
|
|
597
|
+
tags: auditTags,
|
|
598
|
+
nodeLimit: limits.nodes,
|
|
599
|
+
concurrency: pages,
|
|
600
|
+
apps,
|
|
601
|
+
output: temporary,
|
|
602
|
+
declared,
|
|
603
|
+
evidence
|
|
604
|
+
}));
|
|
605
|
+
const timeoutMs = Math.min(1800000, settings.timeoutMs + apps.length * Math.min(settings.timeoutMs, 15000));
|
|
589
606
|
let cause;
|
|
590
607
|
try {
|
|
591
|
-
const run = await executeDevelopmentCommand(
|
|
592
|
-
{ command: "runtime", timeoutMs, label: "Accessibility audit" },
|
|
593
|
-
[fileURLToPath(new URL("./render-audit/worker.mjs", import.meta.url)), request],
|
|
594
|
-
root,
|
|
595
|
-
{},
|
|
596
|
-
signal,
|
|
597
|
-
);
|
|
608
|
+
const run = await executeDevelopmentCommand({ command: "runtime", timeoutMs, label: "Accessibility audit" }, [fileURLToPath(new URL("./render-audit/worker.mjs", import.meta.url)), request], root, {}, signal);
|
|
598
609
|
if (run.code !== 0 && /Executable doesn't exist|playwright install/i.test(run.output))
|
|
599
|
-
throw
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
),
|
|
603
|
-
{ code: "ADS_AUDIT_UNAVAILABLE" },
|
|
604
|
-
);
|
|
605
|
-
if (run.code !== 0) cause = `Accessibility audit browser failed (${run.code}): ${clipCause(run.output.slice(-400))}`;
|
|
610
|
+
throw unavailable(`The render audit could not start Playwright's ${settings.browser} browser. Run \`${browserInstallCommand(settings.browser)}\`, or select an installed Chrome with mcp.capture.channel "chrome".`);
|
|
611
|
+
if (run.code !== 0)
|
|
612
|
+
cause = `Accessibility audit browser failed (${run.code}): ${clipCause(run.output.slice(-400))}`;
|
|
606
613
|
} catch (error) {
|
|
607
|
-
if (signal.aborted || error
|
|
608
|
-
|
|
614
|
+
if (signal.aborted || errorCode(error) === "ADS_AUDIT_UNAVAILABLE")
|
|
615
|
+
throw error;
|
|
616
|
+
cause = clipCause(errorMessage(error));
|
|
609
617
|
}
|
|
610
618
|
if (!existsSync(report) || realpathSync(report) !== report || lstatSync(report).size > limits.reportBytes)
|
|
611
619
|
return { runs: [], capped: [], cause: cause ?? "Accessibility audit produced no bounded report." };
|
|
612
|
-
const value = JSON.parse(readFileSync(report, "utf8"));
|
|
613
|
-
if (value.schemaVersion !== 1 || value.runId !== runId || !Array.isArray(
|
|
620
|
+
const value = JSON.parse(readFileSync(report, "utf8")), runs = isRecord(value) ? value.runs : void 0;
|
|
621
|
+
if (!isRecord(value) || value.schemaVersion !== 1 || value.runId !== runId || !Array.isArray(runs) || !runs.every(isAuditRun))
|
|
614
622
|
return { runs: [], capped: [], cause: cause ?? "Accessibility audit returned the wrong run identity." };
|
|
615
|
-
|
|
623
|
+
const capped = Array.isArray(value.capped) ? value.capped.filter(isCapped) : [];
|
|
624
|
+
return { runs, capped, cause };
|
|
616
625
|
}
|
|
617
|
-
|
|
618
|
-
/** A scenario that could not be audited is an error naming it and its last cause, never a pass. */
|
|
619
626
|
function unauditedFindings(renders, scenarios) {
|
|
620
|
-
const files =
|
|
621
|
-
groups = new Map();
|
|
627
|
+
const files = fileMap(scenarios), groups = new Map;
|
|
622
628
|
for (const { app, attempts, causes } of renders) {
|
|
623
629
|
const group = groups.get(app.scenario) ?? { scenario: app.scenario, themes: [], brands: [], attempts, cause: "" };
|
|
624
630
|
groups.set(app.scenario, group);
|
|
625
|
-
|
|
626
|
-
|
|
631
|
+
addOnce(group.themes, app.theme);
|
|
632
|
+
addOnce(group.brands, app.brand);
|
|
627
633
|
group.cause = causes.at(-1) ?? group.cause;
|
|
628
634
|
}
|
|
629
635
|
return [...groups.values()].map(({ scenario, themes, brands, attempts, cause }) => ({
|
|
@@ -635,204 +641,188 @@ function unauditedFindings(renders, scenarios) {
|
|
|
635
641
|
source: "ads",
|
|
636
642
|
scenario,
|
|
637
643
|
themes,
|
|
638
|
-
...
|
|
644
|
+
...brands.length ? { brands } : {},
|
|
639
645
|
attempts,
|
|
640
646
|
cause,
|
|
641
647
|
guidanceUri: "ads://guides/accessibility",
|
|
642
|
-
message: `Could not audit ${scenario}
|
|
648
|
+
message: `Could not audit ${scenario} ${where(themes, brands)} in ${attempts} attempt${attempts === 1 ? "" : "s"}: ${cause}`
|
|
643
649
|
}));
|
|
644
650
|
}
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
* Reuses a showcase-serving preview host when given one; otherwise starts and closes its own.
|
|
650
|
-
* A render that fails is retried on its own, up to auditAttempts, and the rest keep their results.
|
|
651
|
-
* Findings never cause a retry; a retried pass is listed in retries.
|
|
652
|
-
*/
|
|
653
|
-
export async function runRenderAudit(
|
|
654
|
-
root,
|
|
655
|
-
{ scenarios: selected, themes: selectedThemes, brands: selectedBrands, previewHost, signal = new AbortController().signal, onProgress } = {},
|
|
656
|
-
) {
|
|
657
|
-
root = path.resolve(root);
|
|
658
|
-
const startedAt = Date.now(),
|
|
659
|
-
options = loadConfig(root);
|
|
660
|
-
const playwright = projectPlaywright(root);
|
|
661
|
-
if (!playwright)
|
|
662
|
-
throw Object.assign(
|
|
663
|
-
new Error(
|
|
664
|
-
`The render audit needs Playwright in the project. Install it with ${installHint}; ads validate always runs it, and acceptance.audit: false turns it off for draft acceptance.`,
|
|
665
|
-
),
|
|
666
|
-
{ code: "ADS_AUDIT_UNAVAILABLE" },
|
|
667
|
-
);
|
|
668
|
-
const registry = await analyze(root, "registry", [], signal);
|
|
669
|
-
// Registry discovery already checked the captured SVGs. Send only their
|
|
670
|
-
// identity/geometry, not another copy of the artwork or a live filesystem read.
|
|
671
|
-
const pictograms = registry.scenarios.filter(item => item.foundation?.pictogram).map(({ foundation: { pictogram } }) => ({
|
|
672
|
-
id: pictogram.id, minHeight: pictogram.minHeight, variants: pictogram.variants,
|
|
673
|
-
assets: Object.fromEntries(Object.entries(pictogram.assets).map(([name, asset]) => [name, { digest: asset.digest, geometry: asset.geometry }])),
|
|
674
|
-
}));
|
|
675
|
-
if (registry.diagnostics.length) throw new Error(`Scenario registration failed: ${registry.diagnostics[0].message}`);
|
|
651
|
+
export async function runRenderAudit(directory, { scenarios: selected, themes: selectedThemes, brands: selectedBrands, previewHost, signal = new AbortController().signal, onProgress } = {}) {
|
|
652
|
+
const root = path.resolve(directory), startedAt = Date.now(), options = loadConfig(root), registry = parseScenarioRegistry(await analyze(root, "registry", [], signal)), [firstDiagnostic] = registry.diagnostics;
|
|
653
|
+
if (firstDiagnostic)
|
|
654
|
+
throw Error(`Scenario registration failed: ${firstDiagnostic.message}`);
|
|
676
655
|
const unknown = (selected ?? []).filter((id) => !registry.scenarios.some((scenario) => scenario.id === id));
|
|
677
|
-
if (unknown.length)
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
const scenarios = registry.scenarios
|
|
681
|
-
.filter((scenario) => (selected?.length ? selected.includes(scenario.id) : auditedKinds.includes(scenario.kind)))
|
|
682
|
-
.slice(0, limits.scenarios);
|
|
683
|
-
const themes = options.config.themes.filter((theme) => !selectedThemes?.length || selectedThemes.includes(theme.name));
|
|
656
|
+
if (unknown.length)
|
|
657
|
+
throw Error(`Unknown scenario ${unknown[0]}. Discover exact IDs with ads_scenarios.`);
|
|
658
|
+
const scenarios = registry.scenarios.filter((scenario) => selected?.length ? selected.includes(scenario.id) : auditedKinds.includes(scenario.kind)).slice(0, limits.scenarios), contexts = designContextsOrThrow(options), themes = contexts.themes.filter((theme) => !selectedThemes?.length || selectedThemes.includes(theme.name));
|
|
684
659
|
if (selectedThemes?.length && themes.length !== new Set(selectedThemes).size)
|
|
685
|
-
throw
|
|
686
|
-
const declaredBrands =
|
|
687
|
-
if (selectedBrands?.length && !declaredBrands.length)
|
|
660
|
+
throw Error(`Unknown theme; the project declares ${contexts.themes.map((theme) => theme.name).join(", ")}.`);
|
|
661
|
+
const declaredBrands = contexts.brands;
|
|
662
|
+
if (selectedBrands?.length && !declaredBrands.length)
|
|
663
|
+
throw Error("Unknown brand; the project declares no brands.");
|
|
688
664
|
const brands = declaredBrands.filter((brand) => !selectedBrands?.length || selectedBrands.includes(brand.name));
|
|
689
665
|
if (selectedBrands?.length && brands.length !== new Set(selectedBrands).size)
|
|
690
|
-
throw
|
|
666
|
+
throw Error(`Unknown brand; the project declares ${declaredBrands.map((brand) => brand.name).join(", ")}.`);
|
|
691
667
|
const summary = {
|
|
692
668
|
scenarios: scenarios.length,
|
|
693
669
|
themes: themes.map((theme) => theme.name),
|
|
694
|
-
...
|
|
670
|
+
...brands.length ? { brands: brands.map((brand) => brand.name) } : {},
|
|
695
671
|
tags: auditTags,
|
|
696
|
-
engine: `axe-core ${axeVersion()}
|
|
672
|
+
engine: `axe-core ${axeVersion()}`
|
|
697
673
|
};
|
|
698
|
-
if (!scenarios.length)
|
|
674
|
+
if (!scenarios.length)
|
|
675
|
+
return {
|
|
676
|
+
...summary,
|
|
677
|
+
runs: 0,
|
|
678
|
+
findings: [],
|
|
679
|
+
elapsedMs: Date.now() - startedAt,
|
|
680
|
+
...registry.scenarios.length ? notAvailable("none-selected", "No registered scenario is selected for the audit.") : notAvailable("no-scenarios")
|
|
681
|
+
};
|
|
682
|
+
const playwright = adsPlaywright(), browserSettings = { browser: "chromium", timeoutMs: 60000, ...options.config.mcp.capture };
|
|
683
|
+
try {
|
|
684
|
+
await ensureBrowser(browserSettings.browser, {
|
|
685
|
+
channel: browserSettings.channel,
|
|
686
|
+
signal,
|
|
687
|
+
onProgress: (line) => onProgress?.({ stage: "render-audit", message: line, elapsedMs: Date.now() - startedAt })
|
|
688
|
+
});
|
|
689
|
+
} catch (error) {
|
|
690
|
+
if (signal.aborted)
|
|
691
|
+
throw error;
|
|
692
|
+
throw unavailable(errorMessage(error));
|
|
693
|
+
}
|
|
699
694
|
const outputRoot = path.join(root, ".ds");
|
|
700
|
-
mkdirSync(outputRoot, { recursive:
|
|
701
|
-
if (realpathSync(outputRoot) !== outputRoot)
|
|
702
|
-
|
|
695
|
+
mkdirSync(outputRoot, { recursive: !0 });
|
|
696
|
+
if (realpathSync(outputRoot) !== outputRoot)
|
|
697
|
+
throw Error("Audit work output cannot resolve through a symlink.");
|
|
698
|
+
const temporary = mkdtempSync(path.join(outputRoot, "audit-work-")), declared = declaredControls(await analyze(root, "check", [], signal)), evidence = path.join(outputRoot, "audit-evidence");
|
|
699
|
+
rmSync(evidence, { recursive: !0, force: !0 });
|
|
703
700
|
let host = previewHost;
|
|
704
701
|
try {
|
|
705
702
|
onProgress?.({ stage: "render-audit", message: `Accessibility audit: building ${scenarios.length} scenario previews.`, elapsedMs: Date.now() - startedAt });
|
|
706
703
|
const startHost = async () => {
|
|
707
704
|
const { startAdsMcp } = await import("./mcp/server.mjs");
|
|
708
|
-
return startAdsMcp(root, { stdio:
|
|
705
|
+
return startAdsMcp(root, { stdio: !1, showcase: !0 });
|
|
709
706
|
};
|
|
710
|
-
if (!host?.url)
|
|
711
|
-
|
|
712
|
-
const
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
})),
|
|
722
|
-
),
|
|
723
|
-
);
|
|
724
|
-
const renders = new Map(wanted.map((app) => [renderKey(app), { app, attempts: 0, causes: [] }])),
|
|
725
|
-
capped = new Map();
|
|
707
|
+
if (!host?.url)
|
|
708
|
+
host = await startHost();
|
|
709
|
+
const settings = { browser: "chromium", timeoutMs: 60000, ...options.config.mcp.capture }, firstTheme = themes[0], firstBrand = brands[0], wanted = themes.flatMap((theme) => (brands.length ? brands : [void 0]).flatMap((brand) => scenarios.flatMap((scenario) => ((scenario.states?.length) ? scenario.states : [void 0]).map((state) => ({ scenario, state }))).map(({ scenario, state }) => ({
|
|
710
|
+
scenario: scenario.id,
|
|
711
|
+
theme: theme.name,
|
|
712
|
+
...brand ? { brand: brand.name } : {},
|
|
713
|
+
...state === void 0 ? {} : { state },
|
|
714
|
+
scheme: theme.scheme,
|
|
715
|
+
...theme === firstTheme && containerKinds.includes(scenario.kind) ? { container: containerWidth } : {},
|
|
716
|
+
...theme === firstTheme && brand === firstBrand ? { text: !0 } : {}
|
|
717
|
+
})))), renders = new Map(wanted.map((app) => [renderKey(app), { app, attempts: 0, causes: [] }])), capped = new Map;
|
|
726
718
|
onProgress?.({
|
|
727
719
|
stage: "render-audit",
|
|
728
|
-
message: `Accessibility audit: ${wanted.length} renders (${scenarios.length} scenarios
|
|
729
|
-
elapsedMs: Date.now() - startedAt
|
|
720
|
+
message: `Accessibility audit: ${wanted.length} renders (${scenarios.length} scenarios \xD7 ${themes.length} themes${brands.length ? ` \xD7 ${brands.length} brands` : ""}).`,
|
|
721
|
+
elapsedMs: Date.now() - startedAt
|
|
730
722
|
});
|
|
731
|
-
for (let attempt = 1;
|
|
723
|
+
for (let attempt = 1;attempt <= auditAttempts; attempt++) {
|
|
732
724
|
const pending = [...renders.values()].filter((render) => !render.result);
|
|
733
|
-
if (!pending.length)
|
|
725
|
+
if (!pending.length)
|
|
726
|
+
break;
|
|
734
727
|
signal.throwIfAborted();
|
|
735
|
-
for (const render of pending)
|
|
736
|
-
|
|
728
|
+
for (const render of pending)
|
|
729
|
+
render.attempts = attempt;
|
|
730
|
+
if (!host)
|
|
737
731
|
try {
|
|
738
732
|
host = await startHost();
|
|
739
733
|
} catch (error) {
|
|
740
|
-
if (signal.aborted)
|
|
741
|
-
|
|
734
|
+
if (signal.aborted)
|
|
735
|
+
throw error;
|
|
736
|
+
for (const render of pending)
|
|
737
|
+
render.causes.push(clipCause(errorMessage(error)));
|
|
742
738
|
continue;
|
|
743
739
|
}
|
|
740
|
+
const current = host, unbuilt = await warmScenariosApart(current, [...new Set(pending.map((render) => render.app.scenario))], signal);
|
|
741
|
+
for (const render of pending) {
|
|
742
|
+
const cause = unbuilt.get(render.app.scenario);
|
|
743
|
+
if (cause !== void 0)
|
|
744
|
+
render.causes.push(cause);
|
|
744
745
|
}
|
|
745
|
-
const
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
.
|
|
749
|
-
.
|
|
750
|
-
|
|
751
|
-
url.searchParams.set("
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
claimed: [...renders.values()].flatMap((render) => render.result?.coverage?.claimed ?? []),
|
|
768
|
-
})
|
|
769
|
-
: { runs: [], capped: [] };
|
|
770
|
-
for (const item of reached.capped ?? []) capped.set(item.claim, item);
|
|
746
|
+
const hostUrl = current.url, apps = hostUrl ? pending.filter((render) => !unbuilt.has(render.app.scenario)).map(({ app }) => {
|
|
747
|
+
const url = new URL(hostUrl);
|
|
748
|
+
url.searchParams.set("scenario", app.scenario);
|
|
749
|
+
url.searchParams.set("capture", "1");
|
|
750
|
+
url.searchParams.set("theme", app.theme);
|
|
751
|
+
if (app.brand)
|
|
752
|
+
url.searchParams.set("brand", app.brand);
|
|
753
|
+
return { ...app, url: url.href };
|
|
754
|
+
}) : [], reached = apps.length ? await runAuditWorker({
|
|
755
|
+
root,
|
|
756
|
+
temporary,
|
|
757
|
+
playwright,
|
|
758
|
+
settings,
|
|
759
|
+
apps,
|
|
760
|
+
signal,
|
|
761
|
+
pages: options.config.mcp.auditPages,
|
|
762
|
+
claimed: [...renders.values()].flatMap((render) => render.result?.coverage?.claimed ?? []),
|
|
763
|
+
declared,
|
|
764
|
+
evidence
|
|
765
|
+
}) : { runs: [], capped: [] };
|
|
766
|
+
for (const item of reached.capped)
|
|
767
|
+
capped.set(item.claim, item);
|
|
771
768
|
for (const run of reached.runs) {
|
|
772
769
|
const render = renders.get(renderKey(run));
|
|
773
|
-
if (!render)
|
|
770
|
+
if (!render)
|
|
771
|
+
continue;
|
|
774
772
|
if (run.failed) {
|
|
775
|
-
render.causes.push(run.cause);
|
|
776
|
-
if (run.violations)
|
|
777
|
-
|
|
773
|
+
render.causes.push(run.cause ?? "");
|
|
774
|
+
if (run.violations)
|
|
775
|
+
render.partial = run;
|
|
776
|
+
} else
|
|
777
|
+
render.result = run;
|
|
778
778
|
}
|
|
779
|
-
for (const { app } of pending.filter(
|
|
780
|
-
(render)
|
|
781
|
-
!render.result &&
|
|
782
|
-
apps.some((app) => renderKey(app) === renderKey(render.app)) &&
|
|
783
|
-
!reached.runs.some((run) => renderKey(run) === renderKey(render.app)),
|
|
784
|
-
))
|
|
785
|
-
renders.get(renderKey(app)).causes.push(reached.cause ?? "The audit browser stopped before this render.");
|
|
786
|
-
// The next attempt gets a new browser and, when this audit owns it, a new preview host.
|
|
779
|
+
for (const { app } of pending.filter((render) => !render.result && apps.some((item) => renderKey(item) === renderKey(render.app)) && !reached.runs.some((run) => renderKey(run) === renderKey(render.app))))
|
|
780
|
+
renders.get(renderKey(app))?.causes.push(reached.cause ?? "The audit browser stopped before this render.");
|
|
787
781
|
if (attempt < auditAttempts && host !== previewHost && [...renders.values()].some((render) => !render.result)) {
|
|
788
782
|
const previous = host;
|
|
789
|
-
host =
|
|
790
|
-
await previous.close().catch(() => {});
|
|
783
|
+
host = void 0;
|
|
784
|
+
await previous.close?.().catch(() => {});
|
|
791
785
|
}
|
|
792
786
|
}
|
|
793
|
-
const all = [...renders.values()],
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
.map(({ app, attempts, causes }) => ({ scenario: app.scenario, theme: app.theme, ...(app.brand ? { brand: app.brand } : {}), attempts, causes }));
|
|
798
|
-
const { coverage, findings: coverageItems } = auditCoverage(all.map((render) => render.result).filter(Boolean), [...capped.values()], scenarios);
|
|
799
|
-
const findings = [
|
|
787
|
+
const all = [...renders.values()], runs = all.flatMap((render) => {
|
|
788
|
+
const run = render.result ?? render.partial;
|
|
789
|
+
return run ? [run] : [];
|
|
790
|
+
}), retries = all.flatMap(({ app, attempts, causes, result }) => result && attempts > 1 ? [{ scenario: app.scenario, theme: app.theme, ...app.brand ? { brand: app.brand } : {}, attempts, causes }] : []), { coverage, findings: coverageItems } = auditCoverage(all.flatMap((render) => render.result ? [render.result] : []), [...capped.values()], scenarios), findings = [
|
|
800
791
|
...coverageItems,
|
|
801
|
-
...
|
|
802
|
-
...
|
|
803
|
-
...
|
|
804
|
-
...
|
|
805
|
-
...
|
|
806
|
-
...
|
|
807
|
-
...
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
),
|
|
811
|
-
|
|
812
|
-
];
|
|
813
|
-
const shifts = runs.filter((run) => run.layoutShift).sort((a, b) => b.layoutShift.value - a.layoutShift.value);
|
|
792
|
+
...findingsByState(runs, (some) => auditFindings(some, scenarios)),
|
|
793
|
+
...findingsByState(runs, (some) => nonTextContrastFindings(some, scenarios)),
|
|
794
|
+
...findingsByState(runs, (some) => declaredBoundaryFindings(some, scenarios, root)),
|
|
795
|
+
...findingsByState(runs, (some) => layoutOverflowFindings(some, scenarios)),
|
|
796
|
+
...findingsByState(runs, (some) => textScaleFindings(some, scenarios)),
|
|
797
|
+
...findingsByState(runs, (some) => layoutShiftFindings(some, scenarios)),
|
|
798
|
+
...findingsByState(runs, (some) => imageShapeFindings(some, scenarios)),
|
|
799
|
+
...findingsByState(runs, (some) => cornerOverpaintFindings(some, scenarios)),
|
|
800
|
+
...unauditedFindings(all.filter((render) => !render.result), scenarios),
|
|
801
|
+
...findingsByState(runs, (some) => incompleteFindings(some, scenarios))
|
|
802
|
+
], shifts = runs.flatMap((run) => run.layoutShift ? [{ scenario: run.scenario, value: run.layoutShift.value }] : []).sort((a, b) => b.value - a.value), [worst] = shifts;
|
|
814
803
|
return {
|
|
815
804
|
...summary,
|
|
816
|
-
...
|
|
805
|
+
...worst ? { worstLayoutShift: { value: worst.value, scenario: worst.scenario } } : {},
|
|
817
806
|
runs: all.filter((render) => render.result).length,
|
|
818
807
|
incomplete: findings.filter((finding) => finding.rule === INCOMPLETE_RULE).length,
|
|
819
808
|
overlaysOpened: coverage.overlaysOpened,
|
|
820
809
|
controlsMeasured: coverage.controlsMeasured,
|
|
821
810
|
coverage,
|
|
822
811
|
findings,
|
|
823
|
-
...
|
|
824
|
-
elapsedMs: Date.now() - startedAt
|
|
812
|
+
...retries.length ? { retries } : {},
|
|
813
|
+
elapsedMs: Date.now() - startedAt
|
|
825
814
|
};
|
|
826
815
|
} finally {
|
|
827
816
|
try {
|
|
828
|
-
if (host !== previewHost)
|
|
817
|
+
if (host !== previewHost)
|
|
818
|
+
await host?.close?.();
|
|
829
819
|
} finally {
|
|
830
|
-
rmSync(temporary, { recursive:
|
|
820
|
+
rmSync(temporary, { recursive: !0, force: !0 });
|
|
831
821
|
}
|
|
832
822
|
}
|
|
833
823
|
}
|
|
834
|
-
|
|
835
824
|
const requireTool = createRequire(import.meta.url);
|
|
836
825
|
function axeVersion() {
|
|
837
|
-
|
|
826
|
+
const value = JSON.parse(readFileSync(requireTool.resolve("axe-core/package.json"), "utf8"));
|
|
827
|
+
return isRecord(value) && typeof value.version === "string" ? value.version : "unknown";
|
|
838
828
|
}
|